]> git.wh0rd.org - tt-rss.git/commitdiff
reimplement HOOK_SANITIZE (plugs before final removal of harmful tags)
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 19 Mar 2013 14:58:42 +0000 (18:58 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 19 Mar 2013 15:00:18 +0000 (19:00 +0400)
classes/pluginhost.php
include/functions.php

index 592629881e98dbbccab8bd306ca5c205c4f66baf..79544b01b6a7f3378d92e309c6c2cd342dc82f7c 100644 (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;
index 3793e042634ffb35eb94958b79c6c6e001d2cabb..d1743af7a09ac13ac655531a0942df232cecdae7 100644 (file)
                        $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();