html purifier class redeclaration error in while loop

75 views Asked by At

I was installed html purifier and integrated in my website. i am getting this fatal error.

Here is my Code

include_once(ABSPATH.'htmlpurifier/library/HTMLPurifier.auto.php');
$config1 = HTMLPurifier_Config::createDefault();
// configuration goes here:
$config1->set('Core.Encoding', 'UTF-8'); // replace with your encoding
$config1->set('HTML.Doctype', 'XHTML 1.0 Transitional'); // replace with your doctype
$config1->set('Cache.DefinitionImpl', null); 
$purifier1 = new HTMLPurifier($config1);
$userinfo['msgmail'] = $purifier1->purify($userinfo['msgmail']);

Fatal error: Cannot redeclare class HTMLPurifier_AttrDef_URI in /var/www/vhosts/xxxxxx/xxxx/htmlpurifier/library/HTMLPurifier/URI.php on line 110

Even i added this line also in URI.php

if(class_exists('HTMLPurifier_AttrDef_URI') != true) { }

When i used it directly..i mean in test samples its working fine. Please let me know what is the issue.

0

There are 0 answers