forked from GNUsocial/gnu-social
Drop HTMLPurifier; we don't need its extra capabilities and we're already using htmLawed which is lighter-weight.
This commit is contained in:
@@ -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:
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user