note 63570 added to function.strip-tags

From: Date: Fri, 24 Mar 2006 01:27:03 +0000
Subject: note 63570 added to function.strip-tags
Groups: php.notes 
Request: Send a blank email to php-notes+get-106508@lists.php.net to get a copy of this message
these functions here that people have posted, will not work in an object oriented context. if i try to make the return line on removeEvilTags be this instead: return preg_replace('/<(.*?)>/ie', "'<'.$this->removeEvilAttributes('\\1').'>'", $source); or return preg_replace('/<(.*?)>/ie', "'<'.".$this->removeEvilAttributes('\\1').".'>'", $source); both generate stupid errors for reasons that i cant figure out. if someone could tell me how one might modify this so that these functions may access each other in an object-oriented context i would very much appreciate it. function removeEvilAttributes($tagSource) { $stripAttrib = "' (style|class)=\"(.*?)\"'i"; $tagSource = stripslashes($tagSource); $tagSource = preg_replace($stripAttrib, '', $tagSource); return $tagSource; } function removeEvilTags($source) { $allowedTags='<a><br><b><h1><h2><h3><h4><i>' . '<img><li><ol><p><strong><table>' . '<tr><td><th><u><ul>'; $source = strip_tags($source, $allowedTags); return preg_replace('/<(.*?)>/ie', "'<'.removeEvilAttributes('\\1').'>'", $source); } ---- Server IP: 66.207.199.35 Probable Submitter: 198.53.253.173 ---- X-Spam-Status: No, hits=4.6 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HTML_IMAGE_ONLY_10,HTML_MESSAGE,HTML_SHOUTING8,HTML_TAG_BALANCE_TABLE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.strip-tags.php Edit -- http://master.php.net/note/edit/63570 Del: integrated -- http://master.php.net/note/delete/63570/integrated Del: useless -- http://master.php.net/note/delete/63570/useless Del: bad code -- http://master.php.net/note/delete/63570/bad+code Del: spam -- http://master.php.net/note/delete/63570/spam Del: non-english -- http://master.php.net/note/delete/63570/non-english Del: in docs -- http://master.php.net/note/delete/63570/in+docs Del: other reasons-- http://master.php.net/note/delete/63570 Reject -- http://master.php.net/note/reject/63570 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#106508) next »