public static function Purify($html = null, $encoding = 'UTF-8') {

		$config = self::GetHTMLPurifierConfig();
		$config->set('Core.Encoding', $encoding);
		$config->set('HTML.Allowed', 'span,p,br,a,h1,h2,h3,h4,h5,strong,em,u,ul,li,ol,hr,blockquote,sub,sup,p[class],img');
		$config->set('HTML.AllowedElements', array('span', 'p', 'br', 'a', 'h1', 'h2', 'h3', 'h4', 'h5', 'strong', 'em', 'u', 'ul', 'li', 'ol', 'hr', 'blockquote', 'sub', 'sup', 'img'));
		$config->set('HTML.AllowedAttributes', 'style,target,title,href,class,src,border,alt,width,height,title,name,id');
		$config->set('CSS.AllowedProperties', 'text-align,font-weight,text-decoration');
		$config->set('AutoFormat.RemoveEmpty', true);
		$config->set('Attr.ForbiddenClasses', array('MsoNormal'));

		$purifier = new \HTMLPurifier($config);
		return $cleanCode = $purifier->purify($html);
	}
public static function Purify($html = null, $encoding = 'UTF-8') {

		$config = self::GetHTMLPurifierConfig();
		$config->set('Core.Encoding', $encoding);
		$config->set('HTML.Allowed', 'span,p,br,a,h1,h2,h3,h4,h5,strong,em,u,ul,li,ol,hr,blockquote,sub,sup,p[class],img');
		$config->set('HTML.AllowedElements', array('span', 'p', 'br', 'a', 'h1', 'h2', 'h3', 'h4', 'h5', 'strong', 'em', 'u', 'ul', 'li', 'ol', 'hr', 'blockquote', 'sub', 'sup', 'img'));
		$config->set('HTML.AllowedAttributes', 'style,target,title,href,class,src,border,alt,width,height,title,name,id');
		$config->set('CSS.AllowedProperties', 'text-align,font-weight,text-decoration');
		$config->set('AutoFormat.RemoveEmpty', true);
		$config->set('Attr.ForbiddenClasses', array('MsoNormal'));

		$purifier = new \HTMLPurifier($config);
		return $cleanCode = $purifier->purify($html);
	}
public static function Purify ( $ html = null , $ encoding = 'UTF-8' ) { $ config = self :: GetHTMLPurifierConfig ( ) ; $ config -> set ( 'Core.Encoding' , $ encoding ) ; $ config -> set ( 'HTML.Allowed' , 'span,p,br,a,h1,h2,h3,h4,h5,strong,em,u,ul,li,ol,hr,blockquote,sub,sup,p[class],img' ) ; $ config -> set ( 'HTML.AllowedElements' , array ( 'span' , 'p' , 'br' , 'a' , 'h1' , 'h2' , 'h3' , 'h4' , 'h5' , 'strong' , 'em' , 'u' , 'ul' , 'li' , 'ol' , 'hr' , 'blockquote' , 'sub' , 'sup' , 'img' ) ) ; $ config -> set ( 'HTML.AllowedAttributes' , 'style,target,title,href,class,src,border,alt,width,height,title,name,id' ) ; $ config -> set ( 'CSS.AllowedProperties' , 'text-align,font-weight,text-decoration' ) ; $ config -> set ( 'AutoFormat.RemoveEmpty' , true ) ; $ config -> set ( 'Attr.ForbiddenClasses' , array ( 'MsoNormal' ) ) ; $ purifier = new \ HTMLPurifier ( $ config ) ; return $ cleanCode = $ purifier -> purify ( $ html ) ; }
Standard HTML purifier
@param String $html HTML to purify
@param String $encoding
@return String Valid HTML string
Standard HTML purifier