From 7dfae28b81502720d402676702ca9faf97d05cda Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 18 Jun 2013 00:24:40 +0400 Subject: [PATCH] fixes #549: ability to use HTMLPurifier multiple times --- framework/yii/helpers/HtmlPurifier.php | 3 +++ framework/yii/helpers/base/HtmlPurifier.php | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/framework/yii/helpers/HtmlPurifier.php b/framework/yii/helpers/HtmlPurifier.php index 1173091..efba874 100644 --- a/framework/yii/helpers/HtmlPurifier.php +++ b/framework/yii/helpers/HtmlPurifier.php @@ -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 * @since 2.0 */ diff --git a/framework/yii/helpers/base/HtmlPurifier.php b/framework/yii/helpers/base/HtmlPurifier.php index 799dabf..9c4835f 100644 --- a/framework/yii/helpers/base/HtmlPurifier.php +++ b/framework/yii/helpers/base/HtmlPurifier.php @@ -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); }