note 84816 added to function.preg-replace
| From: | halityesil | Date: | Thu, 31 Jul 2008 13:08:57 +0000 |
| Subject: | note 84816 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-142970@lists.php.net to get a copy of this message | ||
<?PHP
function strip_tags_attributes($sSource, $aAllowedTags = FALSE, $aDisabledAttributes = FALSE,
$aAllowedProperties = 'font|font-size|font-weight|color' .
'|text-align|text-decoration|margin|margin-left' .
'|margin-top|margin-bottom|margin-right|padding' .
'|padding-top|padding-left|padding-right|padding-bottom' . '|width|height'){
if( !is_array( $aDisabledAttributes ) ){
$aDisabledAttributes = array('onabort', 'onactivate',
'onafterprint', 'onafterupdate', 'onbeforeactivate',
'onbeforecopy', 'onbeforecut', 'onbeforedeactivate',
'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint',
'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce',
'oncellchange', 'onchange', 'onclick', 'oncontextmenu',
'oncontrolselect', 'oncopy', 'oncut', 'ondataavaible',
'ondatasetchanged', 'ondatasetcomplete', 'ondblclick',
'ondeactivate', 'ondrag', 'ondragdrop', 'ondragend',
'ondragenter', 'ondragleave', 'ondragover', 'ondragstart',
'ondrop', 'onerror', 'onerrorupdate', 'onfilterupdate',
'onfinish', 'onfocus', 'onfocusin', 'onfocusout',
'onhelp', 'onkeydown', 'onkeypress', 'onkeyup',
'onlayoutcomplete', 'onload', 'onlosecapture',
'onmousedown', 'onmouseenter', 'onmouseleave',
'onmousemove', 'onmoveout', 'onmouseover', 'onmouseup',
'onmousewheel', 'onmove', 'onmoveend', 'onmovestart',
'onpaste', 'onpropertychange', 'onreadystatechange',
'onreset', 'onresize', 'onresizeend', 'onresizestart',
'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll',
'onselect', 'onselectionchange', 'onselectstart', 'onstart',
'onstop', 'onsubmit', 'onunload');
}
$sSource = stripcslashes( $sSource );
$sSource = strip_tags( $sSource, $aAllowedTags );
if( empty($aDisabledAttributes) ){
return $sSource;
}
$aDisabledAttributes = @ implode('|', $aDisabledAttributes);
$sSource = preg_replace('/<(.*?)>/ie', "'<' .
preg_replace(array('/javascript:[^\"\']*/i', '/(" .
$aDisabledAttributes . ")[ \\t\\n]*=[
\\t\\n]*[\"\'][^\"\']*[\"\']/i', '/\s+/'),
array('', '', ' '), stripslashes('\\1')) .
'>'", $sSource );
$sSource = preg_replace('/\s(' . $aDisabledAttributes . ').*?([\s\>])/',
'\\2', $sSource);
$regexp = '@([^;"]+)?(?<!'. $aAllowedProperties
.'):(?!\/\/(.+?)\/)((.*?)[^;"]+)(;)?@is';
$sSource = preg_replace($regexp, '', $sSource);
$sSource = preg_replace('@[a-z]*=""@is', '', $sSource);
return $sSource;
}
?>
Online resource help skype name : globya
good luck !
----
Server IP: 69.147.83.197
Probable Submitter: 88.254.107.140
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/84816
Del: integrated -- https://master.php.net/note/delete/84816/integrated
Del: useless -- https://master.php.net/note/delete/84816/useless
Del: bad code -- https://master.php.net/note/delete/84816/bad+code
Del: spam -- https://master.php.net/note/delete/84816/spam
Del: non-english -- https://master.php.net/note/delete/84816/non-english
Del: in docs -- https://master.php.net/note/delete/84816/in+docs
Del: other reasons-- https://master.php.net/note/delete/84816
Reject -- https://master.php.net/note/reject/84816
Search -- https://master.php.net/manage/user-notes.php