From: Andrew Dolgov Date: Tue, 19 Mar 2013 14:58:42 +0000 (+0400) Subject: reimplement HOOK_SANITIZE (plugs before final removal of harmful tags) X-Git-Tag: 1.7.5~105 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=e9b86f0a1c6165f4f06b1f7909889abfea96b620;p=tt-rss.git reimplement HOOK_SANITIZE (plugs before final removal of harmful tags) --- diff --git a/classes/pluginhost.php b/classes/pluginhost.php index 59262988..79544b01 100644 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -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; diff --git a/include/functions.php b/include/functions.php index 3793e042..d1743af7 100644 --- a/include/functions.php +++ b/include/functions.php @@ -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();