]> git.wh0rd.org - tt-rss.git/blobdiff - classes/pref/filters.php
wrap rssfuncs into rssutils class
[tt-rss.git] / classes / pref / filters.php
index 95f82765fe7cb80206de73a36120ff071b4a3240..e5abf46277990380437cae7f479106adbcb16c95 100755 (executable)
@@ -44,8 +44,6 @@ class Pref_Filters extends Handler_Protected {
        }
 
        function testFilterDo() {
-               require_once "include/rssfuncs.php";
-
                $offset = (int) db_escape_string($_REQUEST["offset"]);
                $limit = (int) db_escape_string($_REQUEST["limit"]);
 
@@ -129,8 +127,8 @@ class Pref_Filters extends Handler_Protected {
 
                        while ($line = db_fetch_assoc($result)) {
 
-                               $rc = get_article_filters(array($filter), $line['title'], $line['content'], $line['link'],
-                                       false, $line['author'], explode(",", $line['tag_cache']));
+                               $rc = RSSUtils::get_article_filters(array($filter), $line['title'], $line['content'], $line['link'],
+                                       $line['author'], explode(",", $line['tag_cache']));
 
                                if (count($rc) > 0) {
 
@@ -224,9 +222,9 @@ class Pref_Filters extends Handler_Protected {
                while ($line = $this->dbh->fetch_assoc($result)) {
 
                        $where = sql_bool_to_bool($line["cat_filter"]) ?
-                               getCategoryTitle($line["cat_id"]) :
+                               Feeds::getCategoryTitle($line["cat_id"]) :
                                ($line["feed_id"] ?
-                                       getFeedTitle($line["feed_id"]) : __("All feeds"));
+                                       Feeds::getFeedTitle($line["feed_id"]) : __("All feeds"));
 
 #                      $where = $line["cat_id"] . "/" . $line["feed_id"];
 
@@ -340,10 +338,10 @@ class Pref_Filters extends Handler_Protected {
 
                print "<form id=\"filter_edit_form\" onsubmit='return false'>";
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-filters\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$filter_id\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"editSave\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"csrf_token\" value=\"".$_SESSION['csrf_token']."\">";
+               print_hidden("op", "pref-filters");
+               print_hidden("id", "$filter_id");
+               print_hidden("method", "editSave");
+               print_hidden("csrf_token", $_SESSION['csrf_token']);
 
                print "<div class=\"dlgSec\">".__("Caption")."</div>";
 
@@ -497,12 +495,12 @@ class Pref_Filters extends Handler_Protected {
 
                if (strpos($feed_id, "CAT:") === 0) {
                        $feed_id = (int) substr($feed_id, 4);
-                       $feed = getCategoryTitle($feed_id);
+                       $feed = Feeds::getCategoryTitle($feed_id);
                } else {
                        $feed_id = (int) $feed_id;
 
                        if ($rule["feed_id"])
-                               $feed = getFeedTitle((int)$rule["feed_id"]);
+                               $feed = Feeds::getFeedTitle((int)$rule["feed_id"]);
                        else
                                $feed = __("All feeds");
                }
@@ -816,9 +814,9 @@ class Pref_Filters extends Handler_Protected {
 
                print "<form name='filter_new_form' id='filter_new_form'>";
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-filters\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"add\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"csrf_token\" value=\"".$_SESSION['csrf_token']."\">";
+               print_hidden("op", "pref-filters");
+               print_hidden("method", "add");
+               print_hidden("csrf_token", $_SESSION['csrf_token']);
 
                print "<div class=\"dlgSec\">".__("Caption")."</div>";
 
@@ -1096,7 +1094,7 @@ class Pref_Filters extends Handler_Protected {
 
                if (!$title) $title = __("[No caption]");
 
-               $title = sprintf(_ngettext("%s (%d rule)", "%s (%d rules)", $num_rules), $title, $num_rules);
+               $title = sprintf(_ngettext("%s (%d rule)", "%s (%d rules)", (int) $num_rules), $title, $num_rules);
 
 
                $result = $this->dbh->query(
@@ -1114,7 +1112,7 @@ class Pref_Filters extends Handler_Protected {
                if ($match_any_rule) $title .= " (" . __("matches any rule") . ")";
 
                if ($num_actions > 0)
-                       $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", $num_actions), $actions, $num_actions);
+                       $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions);
 
                return array($title, $actions);
        }
@@ -1192,5 +1190,4 @@ class Pref_Filters extends Handler_Protected {
 
                $this->dbh->query("COMMIT");
        }
-}
-?>
+}
\ No newline at end of file