note 63570 deleted from function.strip-tags by bjori

From: Date: Fri, 24 Mar 2006 08:57:21 +0000
Subject: note 63570 deleted from function.strip-tags by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-106518@lists.php.net to get a copy of this message
Note Submitter: ---- 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); }

« previous php.notes (#106518) next »