Detect if HTML Purifier in include path? June 27, 2009 08:44AM |
Registered: 10 years ago Posts: 6 |
I'm developing a web app for distribution. I'd like HTML Purifier to be an optional addition but not a requirement (I do extensive output filtering via a DOMDocument based filter I wrote that enforces most of mozilla's CSP server side), but basically use it if it's available on the system and in the include path.
What's the best way to detect it's presence?
If it is present on the system, I'll need to configure it - ala
if (testForPurifierAvailabilty) { require_once('HTMLPurifier.auto.php'); $pconfig = HTMLPurifier_Config::createDefault(); $pconfig->set('HTML','Allowed','div[class],p,br,strong,em,span[class],span[style],a[href],img[class],img[src],img[alt],ol,ul,li'); $pconfig->set('HTML','Doctype','XHTML 1.1'); $purifier = new HTMLPurifier($pconfig); $output = $purifier->purify($output); }
Are there any version specific considerations I need to worry about? IE earlier versions that don't work with the above syntax that I need to try to detect?
Re: Detect if HTML Purifier in include path? June 27, 2009 03:23PM |
Admin Registered: 12 years ago Posts: 3,123 |