', '', '', '', '
    ', '
  • ', '
    ', '
    ', '
    ', '')) { $_allowed_tags = implode('', $allowed_tags); $inputHTML = strip_tags($inputHTML, $_allowed_tags); return preg_replace('#<(.*?)>#ise', "'<' . removeBadAttributes('\\1') . '>'" , $inputHTML); } // removes the unallowed attributes from $inputHTML function removeBadAttributes($inputHTML) { // define the list of unallowed attributes $bad_attributes = 'onerror|onmousemove|onmouseout|onmouseover|' . 'onkeypress|onkeydown|onkeyup|javascript:'; // remove the bad attributes and return the result return stripslashes(preg_replace("#($bad_attributes)(\s*)(?==)#is" , 'SANITIZED', $inputHTML)); } ?>