Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 304b22791a
Fetching contributors…

Cannot retrieve contributors at this time

executable file 16 lines (14 sloc) 0.766 kb
function removeEvilTags($source) {
// Code by tREXX [], "strip_tags",
// [Jon Aquino 2005-10-28]
$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);
function removeEvilAttributes($tagSource) {
$stripAttrib = 'javascript:|onclick|ondblclick|onmousedown|onmouseup|onmouseover|'.
return stripslashes(preg_replace("/$stripAttrib/i", 'forbidden', $tagSource));
Jump to Line
Something went wrong with that request. Please try again.