note 15913 deleted from function.strip-tags by nlopess
| From: | nlopess@php.net | Date: | Thu, 11 Mar 2004 14:52:31 +0000 |
| Subject: | note 15913 deleted from function.strip-tags by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66639@lists.php.net to get a copy of this message | ||
Note Submitter: ryland@ryland.net
----
This function seems to work for me. Allowable tags are
'<b><i><u><a>', and it strips out all parameters except for HREFs.
function safeHTML($text) {
$text = stripslashes($text);
$text = strip_tags($text, '<b><i><u><a>');
$text = eregi_replace ("<a [^>]*href *= *([^ ]+)[^>]*>", "<a
href=\\1>", $text);
$text = eregi_replace ("<([b|i|u])[^>]*>", "<\\1>",
$text);
return $text;
}