<?php
// Strips html from string
function StripHTML
($strString,
$strAllowed =
"")
{
// Strip tags
$strString =
strip_tags($strString,
$strAllowed);
// Remove evil
return preg_replace('/<(.*?)>/ie',
"'<'.StripHTMLHelper('\\1').'>'",
$strString);
}
// Helper
function StripHTMLHelper
($strSource)
{
$strAttrb =
"' (style|class)=\"(.*?)\"'i";
$strSource =
stripslashes($strSource);
$strSource =
preg_replace($strAttrb,
'',
$strSource);
return $strSource;
}
?>