]> git.wh0rd.org - tt-rss.git/blobdiff - plugins/af_readability/init.php
checkbox to sql bool related changes, some more boolean fixes
[tt-rss.git] / plugins / af_readability / init.php
index 34bd99ae006324f66527d641d2bd870fe6cbdd21..873eba1bae90c16c818412834966b38763033f60 100755 (executable)
@@ -14,7 +14,7 @@ class Af_Readability extends Plugin {
        }
 
        function save() {
-               $enable_share_anything = checkbox_to_sql_bool($_POST["enable_share_anything"]) == "true";
+               $enable_share_anything = checkbox_to_sql_bool($_POST["enable_share_anything"]);
 
                $this->host->set($this, "enable_share_anything", $enable_share_anything);
 
@@ -36,7 +36,7 @@ class Af_Readability extends Plugin {
        function hook_prefs_tab($args) {
                if ($args != "prefFeeds") return;
 
-               print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('af_readability settings')."\">";
+               print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Readability settings (af_readability)')."\">";
 
                print_notice("Enable the plugin for specific feeds in the feed editor.");
 
@@ -56,20 +56,16 @@ class Af_Readability extends Plugin {
                        }
                        </script>";
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"af_readability\">";
+               print_hidden("op", "pluginhandler");
+               print_hidden("method", "save");
+               print_hidden("plugin", "af_readability");
 
                $enable_share_anything = $this->host->get($this, "enable_share_anything");
-               $enable_share_anything_checked = $enable_share_anything ? "checked" : "";
 
-               print "<input dojoType=\"dijit.form.CheckBox\"
-                       $enable_share_anything_checked name=\"enable_share_anything\" id=\"enable_share_anything\">
-                       <label for=\"enable_share_anything\">" . __("Use Readability for pages shared via bookmarklet.") . "</label>";
-
-               print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
-                               __("Save")."</button>";
+               print_checkbox("enable_share_anything", $enable_share_anything);
+               print "&nbsp;<label for=\"enable_share_anything\">" . __("Use Readability for pages shared via bookmarklet.") . "</label>";
 
+               print "<p>"; print_button("submit", __("Save"));
                print "</form>";
 
                $enabled_feeds = $this->host->get($this, "enabled_feeds");
@@ -87,7 +83,7 @@ class Af_Readability extends Plugin {
                                        "<img src='images/pub_set.png'
                                                style='vertical-align : middle'> <a href='#'
                                                onclick='editFeed($f)'>".
-                                       getFeedTitle($f) . "</a></li>";
+                                       Feeds::getFeedTitle($f) . "</a></li>";
                        }
                        print "</ul>";
                }
@@ -116,7 +112,7 @@ class Af_Readability extends Plugin {
                $enabled_feeds = $this->host->get($this, "enabled_feeds");
                if (!is_array($enabled_feeds)) $enabled_feeds = array();
 
-               $enable = checkbox_to_sql_bool($_POST["af_readability_enabled"]) == 'true';
+               $enable = checkbox_to_sql_bool($_POST["af_readability_enabled"]);
                $key = array_search($feed_id, $enabled_feeds);
 
                if ($enable) {
@@ -132,6 +128,9 @@ class Af_Readability extends Plugin {
                $this->host->set($this, "enabled_feeds", $enabled_feeds);
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function hook_article_filter_action($article, $action) {
                return $this->process_article($article);
        }
@@ -150,7 +149,7 @@ class Af_Readability extends Plugin {
                        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
                        curl_setopt($ch, CURLOPT_USERAGENT, SELF_USER_AGENT);
 
-                       @$result = curl_exec($ch);
+                       @curl_exec($ch);
                        $content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
 
                        if (strpos($content_type, "text/html") === FALSE)
@@ -247,4 +246,3 @@ class Af_Readability extends Plugin {
        }
 
 }
-?>