1
0
mirror of https://tt-rss.org/git/tt-rss.git synced 2024-06-24 11:56:36 +02:00

reimplement HOOK_SANITIZE (plugs before final removal of harmful tags)

This commit is contained in:
Andrew Dolgov 2013-03-19 18:58:42 +04:00
parent 1d5cf085a3
commit e9b86f0a1c
2 changed files with 9 additions and 0 deletions

View File

@ -21,6 +21,7 @@ class PluginHost {
const HOOK_RENDER_ARTICLE = 10;
const HOOK_RENDER_ARTICLE_CDM = 11;
const HOOK_FEED_FETCHED = 12;
const HOOK_SANITIZE = 13;
const KIND_ALL = 1;
const KIND_SYSTEM = 2;

View File

@ -2615,6 +2615,14 @@
$entry->setAttribute('sandbox', true);
}
global $pluginhost;
if (isset($pluginhost)) {
foreach ($pluginhost->get_hooks($pluginhost::HOOK_SANITIZE) as $plugin) {
$doc = $plugin->hook_sanitize($doc, $site_url);
}
}
$doc->removeChild($doc->firstChild); //remove doctype
$doc = strip_harmful_tags($doc);
$res = $doc->saveHTML();