fix: html purify init wasn't done always when it was used (#5626)

This commit is contained in:
Tony Murray
2017-01-26 13:23:03 -06:00
committed by Neil Lathwood
parent 08edfc60e0
commit 2f1095cb8d
2 changed files with 8 additions and 6 deletions

View File

@@ -1504,7 +1504,14 @@ function clean($value)
function display($value)
{
/** @var HTMLPurifier $purifier */
global $purifier;
global $config, $purifier;
if (!isset($purifier)) {
// initialize HTML Purifier here since this is the only user
$p_config = HTMLPurifier_Config::createDefault();
$p_config->set('Cache.SerializerPath', $config['temp_dir']);
$purifier = new HTMLPurifier($p_config);
}
return $purifier->purify(stripslashes($value));
}