Commit 7dfae28b by Alexander Makarov

fixes #549: ability to use HTMLPurifier multiple times

parent ae419eaf
......@@ -26,6 +26,9 @@ namespace yii\helpers;
*
* For more details please refer to HTMLPurifier documentation](http://htmlpurifier.org/).
*
* Note that you should add `ezyang/htmlpurifier` to your composer.json `require` section and run `composer install`
* before using it.
*
* @author Alexander Makarov <sam@rmcreative.ru>
* @since 2.0
*/
......
......@@ -25,7 +25,9 @@ class HtmlPurifier
*/
public static function process($content, $config = null)
{
$purifier=\HTMLPurifier::instance($config);
$configInstance = \HTMLPurifier_Config::create($config);
$configInstance->autoFinalize = false;
$purifier=\HTMLPurifier::instance($configInstance);
$purifier->config->set('Cache.SerializerPath', \Yii::$app->getRuntimePath());
return $purifier->purify($content);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment