Browse Source

fixes #549: ability to use HTMLPurifier multiple times

tags/2.0.0-beta
Alexander Makarov 12 years ago
parent
commit
7dfae28b81
  1. 3
      framework/yii/helpers/HtmlPurifier.php
  2. 4
      framework/yii/helpers/base/HtmlPurifier.php

3
framework/yii/helpers/HtmlPurifier.php

@ -26,6 +26,9 @@ namespace yii\helpers;
* *
* For more details please refer to HTMLPurifier documentation](http://htmlpurifier.org/). * 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> * @author Alexander Makarov <sam@rmcreative.ru>
* @since 2.0 * @since 2.0
*/ */

4
framework/yii/helpers/base/HtmlPurifier.php

@ -25,7 +25,9 @@ class HtmlPurifier
*/ */
public static function process($content, $config = null) 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()); $purifier->config->set('Cache.SerializerPath', \Yii::$app->getRuntimePath());
return $purifier->purify($content); return $purifier->purify($content);
} }

Loading…
Cancel
Save