]> git.wh0rd.org Git - tt-rss.git/commitdiff
add HOOK_FETCH_FEED
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 20 May 2013 11:26:53 +0000 (15:26 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 20 May 2013 11:26:53 +0000 (15:26 +0400)
classes/pluginhost.php
include/rssfuncs.php

index bc5dc96beb5c0ca4cc47e40aa9bbe46d0b1317fe..9ac1789f562e39d3cdda0d59c30f7200b8891f6e 100644 (file)
@@ -36,6 +36,7 @@ class PluginHost {
        const HOOK_ARTICLE_LEFT_BUTTON = 19;
        const HOOK_PREFS_EDIT_FEED = 20;
        const HOOK_PREFS_SAVE_FEED = 21;
+       const HOOK_FETCH_FEED = 22;
 
        const KIND_ALL = 1;
        const KIND_SYSTEM = 2;
index 70414ccaae0022616295896bf9dab7ebde8adf2b..217bc2bf3ae792e12c454599b8751b4e55fa88d4 100644 (file)
 
                $cache_filename = CACHE_DIR . "/simplepie/" . sha1($fetch_url) . ".xml";
 
+               $pluginhost = new PluginHost();
+               $pluginhost->set_debug($debug_enabled);
+               $user_plugins = get_pref("_ENABLED_PLUGINS", $owner_uid);
+
+               $pluginhost->load(PLUGINS, PluginHost::KIND_ALL);
+               $pluginhost->load($user_plugins, PluginHost::KIND_USER, $owner_uid);
+               $pluginhost->load_data();
+
                $rss = false;
                $rss_hash = false;
-               $cache_timestamp = file_exists($cache_filename) ? filemtime($cache_filename) : 0;
 
                $force_refetch = isset($_REQUEST["force_refetch"]);
 
 
                if (!$rss) {
 
+                       foreach ($pluginhost->get_hooks(PluginHost::HOOK_FETCH_FEED) as $plugin) {
+                               $feed_data = $plugin->hook_fetch_feed($feed_data, $fetch_url, $owner_uid);
+                       }
+
                        if (!$feed_data) {
                                _debug("fetching [$fetch_url]...", $debug_enabled);
                                _debug("If-Modified-Since: ".gmdate('D, d M Y H:i:s \G\M\T', $last_article_timestamp), $debug_enabled);
                        }
                }
 
-               $pluginhost = new PluginHost();
-               $pluginhost->set_debug($debug_enabled);
-               $user_plugins = get_pref("_ENABLED_PLUGINS", $owner_uid);
-
-               $pluginhost->load(PLUGINS, PluginHost::KIND_ALL);
-               $pluginhost->load($user_plugins, PluginHost::KIND_USER, $owner_uid);
-               $pluginhost->load_data();
-
                foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_FETCHED) as $plugin) {
                        $feed_data = $plugin->hook_feed_fetched($feed_data, $fetch_url, $owner_uid);
                }