note 70046 added to function.strip-tags
| From: | magdolen at elepha dot info | Date: | Sun, 01 Oct 2006 14:24:50 +0000 |
| Subject: | note 70046 added to function.strip-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117897@lists.php.net to get a copy of this message | ||
i edited strip_selected_tags function that salavert created to strip also single tags (xhtml only)
here it is also with metric modification:
function strip_selected_tags($text, $tags = array()) {
$args = func_get_args();
// metric edit
$text = preg_replace("/\r\n|\n|\r/","",array_shift($args));
$tags = func_num_args() > 2 ? array_diff($args,array($text)) : (array)$tags;
foreach ($tags as $tag){
if(preg_match_all('/<'.$tag.'[^>]*>(.*)<\/'.$tag.'>/iU',
$text, $found)){
$text = str_replace($found[0],$found[1],$text);
}
// hrax edit
if(preg_match_all('/<'.$tag.'.*\/>/iU', $text, $found)){
$text = str_replace($found[0], "", $text);
}
}
return $text;
}
----
Server IP: 212.24.129.110
Probable Submitter: 86.49.14.141
----
Manual Page -- http://www.php.net/manual/en/function.strip-tags.php
Edit -- https://master.php.net/note/edit/70046
Del: integrated -- https://master.php.net/note/delete/70046/integrated
Del: useless -- https://master.php.net/note/delete/70046/useless
Del: bad code -- https://master.php.net/note/delete/70046/bad+code
Del: spam -- https://master.php.net/note/delete/70046/spam
Del: non-english -- https://master.php.net/note/delete/70046/non-english
Del: in docs -- https://master.php.net/note/delete/70046/in+docs
Del: other reasons-- https://master.php.net/note/delete/70046
Reject -- https://master.php.net/note/reject/70046
Search -- https://master.php.net/manage/user-notes.php