note 80861 deleted from function.strip-tags by danbrown

From: Date: Sun, 17 May 2009 15:55:24 +0000
Subject: note 80861 deleted from function.strip-tags by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154717@lists.php.net to get a copy of this message
Note Submitter: sbritton ---- The function below corrects a typo in y5's function to strip tags and attributes - it also adds lithium1330's recommended 's' parameter: <?php function strip_tags_attributes($sSource, $aAllowedTags = array(), $aDisabledAttributes = array('onclick', 'ondblclick', 'onkeydown', 'onkeypress', 'onkeyup', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onunload')) { if (empty($aDisabledAttributes)) return strip_tags($sSource, implode('', $aAllowedTags)); return preg_replace('/<(.*?)>/ie', "'<' . preg_replace(array('/javascript:[^\"\']*/i', '/(" . implode('|', $aDisabledAttributes) . ")=[\"\'][^\"\']*[\"\']/i', '/\s+/'), array('', '', ' '), stripslashes('\\1')) . '>'", strip_tags($sSource, implode('', $aAllowedTags))); } ?>

« previous php.notes (#154717) next »