silverstripe-framework/View/Parsers/PurifierHTMLCleaner.php
Damian Mooyman 8dd644d25d
API Namespace all classes
Namespace all templates
Move difflib and BBCodeParser2 to thirdparty
Remove deprecated API marked for removal in 4.0
2016-09-08 10:23:17 +12:00

21 lines
412 B
PHP

<?php
namespace SilverStripe\View\Parsers;
use SilverStripe\Core\Injector\Injector;
use HTMLPurifier;
/**
* Cleans HTML using the HTMLPurifier package
* http://htmlpurifier.org/
*/
class PurifierHTMLCleaner extends HTMLCleaner
{
public function cleanHTML($content)
{
$html = new HTMLPurifier();
$doc = Injector::inst()->create('HTMLValue', $html->purify($content));
return $doc->getContent();
}
}