From e18e659ca3b40ade283f51c91a263507d7c6694e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 24 Feb 2010 23:39:40 +0000 Subject: Drop HTMLPurifier; we don't need its extra capabilities and we're already using htmLawed which is lighter-weight. --- plugins/OStatus/README | 4 ---- plugins/OStatus/classes/Ostatus_profile.php | 25 +++---------------------- 2 files changed, 3 insertions(+), 26 deletions(-) (limited to 'plugins') diff --git a/plugins/OStatus/README b/plugins/OStatus/README index 09a59e349..3a98b7b25 100644 --- a/plugins/OStatus/README +++ b/plugins/OStatus/README @@ -12,10 +12,6 @@ $config['ostatus']['hub_retries'] (default 0) Number of times to retry a PuSH send to consumers if using internal hub -$config['ostatus']['purify_cache'] - (default cache disabled) - Set to a writable cache directory for HTMLPurifier's configuration settings, can speed up processing of remote messages (have not tested by how much) - For testing, shouldn't be used in production: diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 33b0ceb9e..a366c1c2c 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -668,28 +668,9 @@ class Ostatus_profile extends Memcached_DataObject */ protected function purify($html) { - require_once(INSTALLDIR.'/extlib/HTMLPurifier/HTMLPurifier.auto.php'); - - // By default Purifier wants to cache data to its own code directories, - // and spews error messages if they're not writable. - $config = HTMLPurifier_Config::createDefault(); - if (common_config('ostatus', 'purify_cache')) { - $config->set('Cache.SerializerPath', common_config('ostatus', 'purify_cache')); - } else { - // Although recommended in the documentation, this produces a notice: - // "Core.DefinitionCache is an alias, preferred directive name is Cache.DefinitionImpl" - // If I then follow *those* directions, I get a warning and it doesn't work: - // "Cannot set undefined directive Core.DefinitionImpl" - // So... lesser of two evils. Suppressing the notice from output, - // though it'll still be seen and logged by StatusNet's error handler. - $old = error_reporting(); - error_reporting($old & ~E_NOTICE); - $config->set('Core.DefinitionCache', null); - error_reporting($old); - } - - $purifier = new HTMLPurifier($config); - return $purifier->purify($html); + require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php'; + $config = array('safe' => 1); + return htmLawed($html, $config); } /** -- cgit v1.2.3-54-g00ecf