2010-09-08 23:14:17 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Defines a function wrapper for HTML Purifier for quick use.
|
|
|
|
* @note ''HTMLPurifier()'' is NOT the same as ''new HTMLPurifier()''
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Purify HTML.
|
2016-02-09 05:06:17 -05:00
|
|
|
* @param string $html String HTML to purify
|
|
|
|
* @param mixed $config Configuration to use, can be any value accepted by
|
2010-09-08 23:14:17 -04:00
|
|
|
* HTMLPurifier_Config::create()
|
2016-02-09 05:06:17 -05:00
|
|
|
* @return string
|
2010-09-08 23:14:17 -04:00
|
|
|
*/
|
2016-02-09 05:06:17 -05:00
|
|
|
function HTMLPurifier($html, $config = null)
|
|
|
|
{
|
2010-09-08 23:14:17 -04:00
|
|
|
static $purifier = false;
|
|
|
|
if (!$purifier) {
|
|
|
|
$purifier = new HTMLPurifier();
|
|
|
|
}
|
|
|
|
return $purifier->purify($html, $config);
|
|
|
|
}
|
|
|
|
|
|
|
|
// vim: et sw=4 sts=4
|