Revert "add experimental HOOK_SANITIZE"
This reverts commit 2130fe7a18
.
This commit is contained in:
parent
2130fe7a18
commit
be124dc236
|
@ -21,7 +21,6 @@ class PluginHost {
|
||||||
const HOOK_RENDER_ARTICLE = 10;
|
const HOOK_RENDER_ARTICLE = 10;
|
||||||
const HOOK_RENDER_ARTICLE_CDM = 11;
|
const HOOK_RENDER_ARTICLE_CDM = 11;
|
||||||
const HOOK_FEED_FETCHED = 12;
|
const HOOK_FEED_FETCHED = 12;
|
||||||
const HOOK_SANITIZE = 13;
|
|
||||||
|
|
||||||
const KIND_ALL = 1;
|
const KIND_ALL = 1;
|
||||||
const KIND_SYSTEM = 2;
|
const KIND_SYSTEM = 2;
|
||||||
|
|
|
@ -2597,25 +2597,12 @@
|
||||||
|
|
||||||
//$node = $doc->getElementsByTagName('body')->item(0);
|
//$node = $doc->getElementsByTagName('body')->item(0);
|
||||||
|
|
||||||
|
$doc->removeChild($doc->firstChild); //remove doctype
|
||||||
|
$res = $doc->saveHTML();
|
||||||
|
|
||||||
$beforehooks = $res;
|
$config = array('safe' => 1, 'deny_attribute' => 'style, width, height, class, id', 'comment' => 1, 'cdata' => 1, 'balance' => 0);
|
||||||
|
$spec = 'img=width,height';
|
||||||
global $pluginhost;
|
$res = htmLawed($res, $config, $spec);
|
||||||
if ($pluginhost) {
|
|
||||||
foreach ($pluginhost->get_hooks($pluginhost::HOOK_SANITIZE) as $p) {
|
|
||||||
$res = $p->hook_sanitize($res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// nothing changed, use standard filters
|
|
||||||
if ($beforehooks == $res) {
|
|
||||||
$doc->removeChild($doc->firstChild); //remove doctype
|
|
||||||
$res = $doc->saveHTML();
|
|
||||||
|
|
||||||
$config = array('safe' => 1, 'deny_attribute' => 'style, width, height, class, id', 'comment' => 1, 'cdata' => 1, 'balance' => 0);
|
|
||||||
$spec = 'img=width,height';
|
|
||||||
$res = htmLawed($res, $config, $spec);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue