1999 Posts in 1408 Topics by 613 members
|Go to End|
24 January 2013 at 6:56pm
After upgrading to SS3 I am running into problems with loading of HTMLPurifier which I use to clean frontend TinyMCE text entries. I get the following error message:
[User Error] Uncaught Exception: HTML Purifier autoloader registrar is not compatible with non-static object methods due to PHP Bug #44144; Please do not use HTMLPurifier.autoload.php (or any file that includes this file); instead, place the code: spl_autoload_register(array('HTMLPurifier_Bootstrap', 'autoload')) after your own autoloaders.
Where would I put that code? I saw that the spl_autoload_register function gets called in the manifest ClassLoader class, but I don't know how to add the other autoloader to that.
Can anybody help me with this?
25 January 2013 at 2:05pm Last edited: 25 January 2013 2:06pm
The answer to this is easy actually, you can avoid the whole autoloader thing if you just get the standalone version. I was just too tired yesterday..
As there's not much documentation on this topic in general, I though I'd just post my way of implementing HTMLPurifier. Perhaps somebody has a better way.
I just dropped in HTMLpurifier.standalone.php under mysite/thirdparty/ (it could be anywhere really), then created a class Purifier.php:
//put your code here
public static function purify($content)
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
return $cleanCode = $purifier->purify($content);
No you can call Purifier::purify($content) from anywhere.
I also tried the class in the CMS and that worked as well:
$purifier = HTMLCleaner::inst();
$cleanhtml = $purifier->cleanHTML($content);
But this is without the config then.
|Go to Top|