/ Published in: PHP
The PHP Code appears in Post Comments
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function cleanHTML($html) { /// <summary> /// Removes all FONT and SPAN tags, and all Class and Style attributes. /// Designed to get rid of non-standard Microsoft Word HTML tags. /// </summary> // start by completely removing all unwanted tags // then run another pass over the html (twice), removing unwanted attributes $html = ereg_replace("<([^>]*)(class|lang|style|size|face)=(\"[^\"]*\"|'[^']*'|[^>]+)([^>]*)>","<\\1>",$html); $html = ereg_replace("<([^>]*)(class|lang|style|size|face)=(\"[^\"]*\"|'[^']*'|[^>]+)([^>]*)>","<\\1>",$html); return $html }
URL: http://tim.mackey.ie/CommentView,guid,2ece42de-a334-4fd0-8f94-53c6602d5718.aspx