public static function cleanHtml($html) { $chain = new Zend_filter(); //$chain->addFilter(new Zend_Filter_StripTags(self::$tags)); $chain->addFilter(new Zend_Filter_StringTrim()); //$chain = new Zend_Filter_HtmlEntities(); $html = $chain->filter($html); $html = stripslashes($html); //echo $html; $temp = $html; while (1) { $html = preg_replace('/(<[^>]*)javascript:([^>]*>)/i', '$1$2', $html); //if nothing changed this iteration then break the loop if ($html == $temp) { break; } $temp = $html; } return $html; }