note 81553 added to function.strip-tags
| From: | brian at diamondsea dot com | Date: | Mon, 03 Mar 2008 19:47:04 +0000 |
| Subject: | note 81553 added to function.strip-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136708@lists.php.net to get a copy of this message | ||
An update agolna's update to sbritton's function:
Adds additional javascript events to the aDisabledAttributes array.
<?php
function strip_tags_attributes($sSource, $aAllowedTags = array(), $aDisabledAttributes =
array('onabort', 'onblue', 'onchange', 'onclick',
'ondblclick', 'onerror', 'onfocus', 'onkeydown',
'onkeyup', 'onload', 'onmousedown', 'onmousemove',
'onmouseover', 'onmouseup', 'onreset', 'onresize',
'onselect', 'onsubmit', 'onunload'))
{
if (empty($aDisabledAttributes)) return strip_tags($sSource, implode('',
$aAllowedTags));
return preg_replace('/<(.*?)>/ie', "'<' .
preg_replace(array('/javascript:[^\"\']*/i', '/(" .
implode('|', $aDisabledAttributes) . ")[ \\t\\n]*=[
\\t\\n]*[\"\'][^\"\']*[\"\']/i', '/\s+/'),
array('', '', ' '), stripslashes('\\1')) .
'>'", strip_tags($sSource, implode('', $aAllowedTags)));
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 63.217.142.210
----
Manual Page -- http://www.php.net/manual/en/function.strip-tags.php
Edit -- https://master.php.net/note/edit/81553
Del: integrated -- https://master.php.net/note/delete/81553/integrated
Del: useless -- https://master.php.net/note/delete/81553/useless
Del: bad code -- https://master.php.net/note/delete/81553/bad+code
Del: spam -- https://master.php.net/note/delete/81553/spam
Del: non-english -- https://master.php.net/note/delete/81553/non-english
Del: in docs -- https://master.php.net/note/delete/81553/in+docs
Del: other reasons-- https://master.php.net/note/delete/81553
Reject -- https://master.php.net/note/reject/81553
Search -- https://master.php.net/manage/user-notes.php