]> git.wh0rd.org - tt-rss.git/blobdiff - include/rssfuncs.php
update translations
[tt-rss.git] / include / rssfuncs.php
index eaa975a5af04f4b4f09cc8aca6cf732c3e5cf06f..4a5bd7680f3bff998af546c9c97976659a4a5cf9 100644 (file)
                                _debug("update_rss_feed: " . count($filters) . " filters loaded.");
                        }
 
-                       $filter_plugins = array();
-
-                       if (defined('_ARTICLE_FILTER_PLUGINS')) {
-                               foreach (explode(",", _ARTICLE_FILTER_PLUGINS) as $p) {
-                                       $pclass = "filter_" . trim($p);
-
-                                       if (class_exists($pclass)) {
-                                               $plugin = new $pclass($link);
-                                               array_push($filter_plugins, $plugin);
-                                       }
-                               }
-                       }
-
-                       if ($debug_enabled) {
-                               _debug("update_rss_feed: " . count($filter_plugins) . " filter plugins loaded.");
-                       }
-
                        if ($use_simplepie) {
                                $iterator = $rss->get_items();
                        } else {
                                $entry_author = mb_substr($entry_author, 0, 250);
 
                                if ($use_simplepie) {
-                                       $num_comments = 0; #FIXME#
+                                       $num_comments = $item->get_item_tags('http://purl.org/rss/1.0/modules/slash/', 'comments');
+
+                                       if (is_array($num_comments) && is_array($num_comments[0])) {
+                                               $num_comments = (int) $num_comments[0]["data"];
+                                       } else {
+                                               $num_comments = 0;
+                                       }
                                } else {
-                                       $num_comments = db_escape_string($item["slash"]["comments"]);
+                                       $num_comments = (int) $item["slash"]["comments"];
                                }
 
-                               if (!$num_comments) $num_comments = 0;
-
                                if ($debug_enabled) {
+                                       _debug("update_rss_feed: num_comments: $num_comments");
                                        _debug("update_rss_feed: looking for tags [1]...");
                                }
 
                                }
 
                                // TODO: less memory-hungry implementation
-                               if (count($filter_plugins) > 0) {
+                               global $pluginhost;
+
+                               foreach ($pluginhost->get_hooks($pluginhost::HOOK_ARTICLE_FILTER) as $p) {
                                        if ($debug_enabled) {
                                                _debug("update_rss_feed: applying plugin filters...");
                                        }
                                                "author" => $entry_author);
 
                                        foreach ($filter_plugins as $plugin) {
-                                               $article = $plugin->filter_article($article);
+                                               $article = $plugin->hook_article_filter($article);
                                        }
 
                                        $entry_title = $article["title"];