note 88491 deleted from function.strip-tags by googleguy
| From: | googleguy@php.net | Date: | Mon, 11 Feb 2013 05:14:26 +0000 |
| Subject: | note 88491 deleted from function.strip-tags by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193582@lists.php.net to get a copy of this message | ||
Note Submitter: Leendert W
----
Maybe also a usefull function for someone.
<?php
function removeUnsafeAttributesAndGivenTags($input, $validTags = '')
{
$regex = '#\s*<(/?\w+)\s+(?:on\w+\s*=\s*(["\'\s])?.+?
\(\1?.+?\1?\);?\1?|style=["\'].+?["\'])\s*>#is';
return preg_replace($regex, '<${1}>',strip_tags($input, $validTags));
}
?>