]> git.wh0rd.org Git - tt-rss.git/commitdiff
update phpmd ruleset to use (subset) of cleancode
authorAndrew Dolgov <noreply@fakecake.org>
Wed, 26 Apr 2017 17:57:36 +0000 (20:57 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Wed, 26 Apr 2017 17:57:36 +0000 (20:57 +0300)
fix various minor issues reported by static analysis
remove redundant php closing tag from several more files

53 files changed:
plugins/af_comics/af_comics_template.php
plugins/af_comics/filter_base.php
plugins/af_comics/filters/af_comics_cad.php
plugins/af_comics/filters/af_comics_comicclass.php
plugins/af_comics/filters/af_comics_comicpress.php
plugins/af_comics/filters/af_comics_darklegacy.php
plugins/af_comics/filters/af_comics_dilbert.php
plugins/af_comics/filters/af_comics_explosm.php
plugins/af_comics/filters/af_comics_pa.php
plugins/af_comics/filters/af_comics_pvp.php
plugins/af_comics/filters/af_comics_tfd.php
plugins/af_comics/filters/af_comics_twp.php
plugins/af_comics/filters/af_comics_whomp.php
plugins/af_comics/init.php
plugins/af_fsckportal/init.php
plugins/af_lang_detect/init.php
plugins/af_lang_detect/languagedetect/LanguageDetect.php
plugins/af_lang_detect/languagedetect/Text/LanguageDetect/ISO639.php
plugins/af_lang_detect/languagedetect/Text/LanguageDetect/Parser.php
plugins/af_psql_trgm/init.php
plugins/af_readability/init.php
plugins/af_redditimgur/init.php
plugins/af_tumblr_1280/init.php
plugins/af_unburn/init.php
plugins/af_youtube_embed/init.php
plugins/af_zz_imgproxy/init.php
plugins/af_zz_imgsetsizes/init.php
plugins/af_zz_noautoplay/init.php
plugins/af_zz_vidmute/init.php
plugins/auth_remote/init.php
plugins/auto_assign_labels/init.php
plugins/bookmarklets/init.php
plugins/cache_starred_images/init.php
plugins/close_button/init.php
plugins/embed_original/init.php
plugins/googlereaderkeys/init.php
plugins/import_export/init.php
plugins/instances/init.php
plugins/mail/init.php
plugins/mailto/init.php
plugins/mark_button/init.php
plugins/no_iframes/init.php
plugins/no_title_counters/init.php
plugins/no_url_hashes/init.php
plugins/note/init.php
plugins/nsfw/init.php
plugins/search_sphinx/init.php
plugins/search_sphinx/sphinxapi.php
plugins/share/init.php
plugins/shorten_expanded/init.php
plugins/swap_jk/init.php
plugins/vf_shared/init.php
utils/gitlab-ci/phpmd-ruleset.xml

index 117d6928043accc8375a27337b1aa2c86e67cf14..a8054a3df0e4c934c2b11b049f7c8113845a1a7a 100644 (file)
@@ -6,9 +6,8 @@ class Af_Comics_Template extends Af_ComicFilter {
        }
 
        function process(&$article) {
-               $owner_uid = $article["owner_uid"];
+               //$owner_uid = $article["owner_uid"];
 
                return false;
        }
-}
-?>
+}
\ No newline at end of file
index a534306458cbd99ed65058713ca6c8e02a56b515..bfa077776dcc13a7c7515eb01d9269e3aa535aa7 100644 (file)
@@ -2,5 +2,4 @@
 abstract class Af_ComicFilter {
        public abstract function supported();
        public abstract function process(&$article);
-}
-?>
+}
\ No newline at end of file
index 43836724fb18a005a2abb6ee493e549bad85cc2c..7c06709187c1e3e5c1a66d94aabe821593b2b54b 100644 (file)
@@ -6,17 +6,12 @@ class Af_Comics_Cad extends Af_ComicFilter {
        }
 
        function process(&$article) {
-               $owner_uid = $article["owner_uid"];
-
                if (strpos($article["link"], "cad-comic.com/cad/") !== FALSE) {
                        if (strpos($article["title"], "News:") === FALSE) {
 
                                $doc = new DOMDocument();
-                               @$doc->loadHTML(fetch_file_contents($article["link"]));
-
-                               $basenode = false;
 
-                               if ($doc) {
+                               if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
                                        $xpath = new DOMXPath($doc);
                                        $basenode = $xpath->query('(//img[contains(@src, "/comics/cad-")])')->item(0);
 
@@ -32,5 +27,4 @@ class Af_Comics_Cad extends Af_ComicFilter {
 
                return false;
        }
-}
-?>
+}
\ No newline at end of file
index 45698751b36a29d8d74932813d1331ed053f0ccc..56a5b9cf6ad5193106cd34270e07de5be514e47f 100644 (file)
@@ -6,8 +6,6 @@ class Af_Comics_ComicClass extends Af_ComicFilter {
        }
 
        function process(&$article) {
-               $owner_uid = $article["owner_uid"];
-
                if (strpos($article["guid"], "loadingartist.com") !== FALSE) {
 
                                // lol at people who block clients by user agent
@@ -18,11 +16,8 @@ class Af_Comics_ComicClass extends Af_ComicFilter {
                                         "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
 
                                $doc = new DOMDocument();
-                               @$doc->loadHTML($res);
-
-                               $basenode = false;
 
-                               if ($doc) {
+                               if (@$doc->loadHTML($res)) {
                                        $xpath = new DOMXPath($doc);
                                        $basenode = $xpath->query('//div[@class="comic"]')->item(0);
 
@@ -36,5 +31,4 @@ class Af_Comics_ComicClass extends Af_ComicFilter {
 
                return false;
        }
-}
-?>
+}
\ No newline at end of file
index 3068375986552bdbdace10a2920a65d5a7db876c..81994d90bddc082dec57743b22b925349c183901 100644 (file)
@@ -7,8 +7,6 @@ class Af_Comics_ComicPress extends Af_ComicFilter {
        }
 
        function process(&$article) {
-               $owner_uid = $article["owner_uid"];
-
                if (strpos($article["guid"], "bunicomic.com") !== FALSE ||
                                strpos($article["guid"], "buttersafe.com") !== FALSE ||
                                strpos($article["guid"], "extrafabulouscomics.com") !== FALSE ||
@@ -23,11 +21,8 @@ class Af_Comics_ComicPress extends Af_ComicFilter {
                                         "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
 
                                $doc = new DOMDocument();
-                               @$doc->loadHTML($res);
-
-                               $basenode = false;
 
-                               if ($doc) {
+                               if (@$doc->loadHTML($res)) {
                                        $xpath = new DOMXPath($doc);
                                        $basenode = $xpath->query('//div[@id="comic"]')->item(0);
 
@@ -41,5 +36,4 @@ class Af_Comics_ComicPress extends Af_ComicFilter {
 
                return false;
        }
-}
-?>
+}
\ No newline at end of file
index c03919b1d896e5a603ec7506345726d15cabe7e8..33c1eca5cd1092c6d7767e872320213a759f3543 100644 (file)
@@ -6,7 +6,6 @@ class Af_Comics_DarkLegacy extends Af_ComicFilter {
        }
 
        function process(&$article) {
-               $owner_uid = $article["owner_uid"];
 
                if (strpos($article["guid"], "darklegacycomics.com") !== FALSE) {
 
@@ -20,11 +19,8 @@ class Af_Comics_DarkLegacy extends Af_ComicFilter {
                                        $res = $fetch_last_error_content;
 
                                $doc = new DOMDocument();
-                               @$doc->loadHTML($res);
 
-                               $basenode = false;
-
-                               if ($doc) {
+                               if (@$doc->loadHTML($res)) {
                                        $xpath = new DOMXPath($doc);
                                        $basenode = $xpath->query('//div[@class="comic"]')->item(0);
 
@@ -39,5 +35,4 @@ class Af_Comics_DarkLegacy extends Af_ComicFilter {
 
                return false;
        }
-}
-?>
+}
\ No newline at end of file
index 5faba7eb7f2530ffb1667bbd930f1147b5b0ad58..9eed7232a5c168999e6623f3fd0769cb62c53247 100644 (file)
@@ -19,30 +19,11 @@ class Af_Comics_Dilbert extends Af_ComicFilter {
                                $doc = new DOMDocument();
                                @$doc->loadHTML($res);
 
-                               $basenode = false;
-
                                if ($doc) {
                                        $xpath = new DOMXPath($doc);
 
                                        $basenode = $xpath->query('//img[contains(@class, "img-comic")]')->item(0);
 
-                                       /* $entries = $xpath->query('(//img[@src])'); // we might also check for img[@class='strip'] I guess...
-
-                                       $matches = array();
-
-                                       foreach ($entries as $entry) {
-
-                                               if (preg_match("/dyn\/str_strip\/.*strip\.gif$/", $entry->getAttribute("src"), $matches)) {
-
-                                                       $entry->setAttribute("src",
-                                                               rewrite_relative_url("http://dilbert.com/",
-                                                               $matches[0]));
-
-                                                       $basenode = $entry;
-                                                       break;
-                                               }
-                                       } */
-
                                        if ($basenode) {
                                                $article["content"] = $doc->saveXML($basenode);
                                        }
@@ -53,5 +34,4 @@ class Af_Comics_Dilbert extends Af_ComicFilter {
 
                return false;
        }
-}
-?>
+}
\ No newline at end of file
index 30b7e24c93efb40f7ce0c5eac96cbaae7f24bb90..35a2edd41f392d5822e758d5759a1142aa97a61a 100644 (file)
@@ -6,16 +6,12 @@ class Af_Comics_Explosm extends Af_ComicFilter {
        }
 
        function process(&$article) {
-               $owner_uid = $article["owner_uid"];
 
                if (strpos($article["link"], "explosm.net/comics") !== FALSE) {
 
                                $doc = new DOMDocument();
-                               @$doc->loadHTML(fetch_file_contents($article["link"]));
 
-                               $basenode = false;
-
-                               if ($doc) {
+                               if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
                                        $xpath = new DOMXPath($doc);
                                        $basenode = $xpath->query('(//img[@id="main-comic"])')->item(0);
 
@@ -29,5 +25,4 @@ class Af_Comics_Explosm extends Af_ComicFilter {
 
                return false;
        }
-}
-?>
+}
\ No newline at end of file
index 0848adbd0eaf7bf93facab67787cf5101ea0b65d..ae5cabec06ee482404c8d5618a70970c83f69640 100644 (file)
@@ -8,16 +8,13 @@ class Af_Comics_Pa extends Af_ComicFilter {
        function process(&$article) {
                if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "Comic:") !== FALSE) {
 
-                               if ($debug_enabled) {
+                               /*if ($debug_enabled) {
                                        _debug("af_pennyarcade: Processing comic");
-                               }
+                               }*/
 
                                $doc = new DOMDocument();
-                               $doc->loadHTML(fetch_file_contents($article["link"]));
-
-                               $basenode = false;
 
-                               if ($doc) {
+                               if ($doc->loadHTML(fetch_file_contents($article["link"]))) {
                                        $xpath = new DOMXPath($doc);
                                        $basenode = $xpath->query('(//div[@id="comicFrame"])')->item(0);
 
@@ -30,13 +27,12 @@ class Af_Comics_Pa extends Af_ComicFilter {
                }
 
                if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "News Post:") !== FALSE) {
-                               if ($debug_enabled) {
+                               /*if ($debug_enabled) {
                                        _debug("af_pennyarcade: Processing news post");
-                               }
+                               }*/
                                $doc = new DOMDocument();
-                               $doc->loadHTML(fetch_file_contents($article["link"]));
 
-                               if ($doc) {
+                               if ($doc->loadHTML(fetch_file_contents($article["link"]))) {
                                        $xpath = new DOMXPath($doc);
                                        $entries = $xpath->query('(//div[@class="post"])');
 
@@ -75,5 +71,4 @@ class Af_Comics_Pa extends Af_ComicFilter {
 
                return false;
        }
-}
-?>
+}
\ No newline at end of file
index 2094e684e82b5743066f67c160dedb65224b6a95..1a1ccab3dde42863e90a37cfa8d5d84037f6647f 100644 (file)
@@ -13,9 +13,8 @@ class Af_Comics_Pvp extends Af_ComicFilter {
                                         "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
 
                                $doc = new DOMDocument();
-                               @$doc->loadHTML($res);
 
-                               if ($doc) {
+                               if (@$doc->loadHTML($res)) {
                                        $xpath = new DOMXPath($doc);
                                        $basenode = $xpath->query('//section[@class="comic-art"]')->item(0);
 
@@ -29,5 +28,4 @@ class Af_Comics_Pvp extends Af_ComicFilter {
 
                return false;
        }
-}
-?>
+}
\ No newline at end of file
index eeec28fa3bddf48340845e55d7eade93dce1c30c..78792d25455f941f3b892eb26519f8c662a1fef1 100644 (file)
@@ -15,11 +15,8 @@ class Af_Comics_Tfd extends Af_ComicFilter {
                        if (!$res) return $article;
 
                        $doc = new DOMDocument();
-                       @$doc->loadHTML(fetch_file_contents($article["link"]));
-                       
-                       $basenode = false;
 
-                       if ($doc) {
+                       if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
                                $xpath = new DOMXPath($doc);
                                $basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0);
 
@@ -32,5 +29,4 @@ class Af_Comics_Tfd extends Af_ComicFilter {
 
                return false;
        }
-}
-?>
+}
\ No newline at end of file
index ec43c1379d2e304a5965e234f2b7681a46ab85b9..712d54a1dd789ed26b0765aa95821dea779cb3e8 100644 (file)
@@ -10,11 +10,8 @@ class Af_Comics_Twp extends Af_ComicFilter {
                if (strpos($article["link"], "threewordphrase.com") !== FALSE) {
 
                                $doc = new DOMDocument();
-                               @$doc->loadHTML(fetch_file_contents($article["link"]));
 
-                               $basenode = false;
-
-                               if ($doc) {
+                               if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
                                        $xpath = new DOMXpath($doc);
 
                                        $basenode = $xpath->query("//td/center/img")->item(0);
@@ -29,5 +26,4 @@ class Af_Comics_Twp extends Af_ComicFilter {
 
                return false;
        }
-}
-?>
+}
\ No newline at end of file
index 5bc6a14e7987eb95c7e62c2f6ce9a3dc7a2d3c93..3c2e0b0c7dbd0bcf5f1cbbe5f4c268593d7705d6 100644 (file)
@@ -33,5 +33,4 @@ class Af_Comics_Whomp extends Af_ComicFilter {
 
                return false;
        }
-}
-?>
+}
\ No newline at end of file
index 31994176e748ecbf2720476f440963f165037d15..15af1d1a6d6dd4b83cd88f4bed9757679a1c21cd 100644 (file)
@@ -63,18 +63,18 @@ class Af_Comics extends Plugin {
        }
 
        function hook_article_filter($article) {
-               $owner_uid = $article["owner_uid"];
-
                foreach ($this->filters as $f) {
                        if ($f->process($article))
                                break;
                }
 
                return $article;
-
        }
 
        // GoComics dropped feed support so it needs to be handled when fetching the feed.
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed, $last_article_timestamp, $auth_login, $auth_pass) {
                if ($auth_login || $auth_pass)
                        return $feed_data;
@@ -143,5 +143,4 @@ class Af_Comics extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index 4718eca913da3bb26feaafa05a52b5ede28afe92..40ace5022838eab6897b8b1cf61fe1c79dc714bc 100644 (file)
@@ -48,5 +48,4 @@ class Af_Fsckportal extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index 3f2eb29f89609a4e76ad21e91305dd50def5a4c8..e78741319514c81bbedec7cfd08f85a74b0dd3ba 100644 (file)
@@ -43,4 +43,3 @@ class Af_Lang_Detect extends Plugin {
        }
 
 }
-?>
index 0856571bf7422deb4164eb053a41279957464ce9..6c1863508818a87b061a87c4e4479486196eaff1 100644 (file)
@@ -64,6 +64,8 @@ require_once __DIR__ . '/Text/LanguageDetect/ISO639.php';
  * @version   Release: @package_version@
  * @link      http://pear.php.net/package/Text_LanguageDetect/
  * @todo      allow users to generate their own language models
+ *
+ * @SuppressWarnings(PHPMD)
  */
 class Text_LanguageDetect
 {
@@ -1704,5 +1706,3 @@ class Text_LanguageDetect
 }
 
 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-?>
index c577a2e1a06a8b3e407ed8dbb8aa65560d7d9028..7caa9794e33e476b47523e63ff05df64d9a3c308 100644 (file)
@@ -25,6 +25,8 @@
  * @copyright 2011 Christian Weiske <cweiske@php.net>
  * @license   http://www.debian.org/misc/bsd.license BSD
  * @link      http://www.loc.gov/standards/iso639-2/php/code_list.php
+ *
+ * @SuppressWarnings(PHPMD)
  */
 class Text_LanguageDetect_ISO639
 {
@@ -337,5 +339,3 @@ class Text_LanguageDetect_ISO639
         return self::$code3ToName[$code];
     }
 }
-
-?>
\ No newline at end of file
index 1c20c2657eb2b466d90846842547576e026b5fcb..44eea897f03674fc20d263b7d0e424262bfbba69 100644 (file)
@@ -345,5 +345,3 @@ class Text_LanguageDetect_Parser extends Text_LanguageDetect
 }
 
 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-?>
index 542cd720e6934513e58b6d381384a045f3289507..087b116d69cc57ecab7570f99b70f5dab7dae462 100644 (file)
@@ -321,5 +321,4 @@ class Af_Psql_Trgm extends Plugin {
                return $tmp;
        }
 
-}
-?>
+}
\ No newline at end of file
index 9557a9791eaa891679dcc6b67f300d0b78ea0aa1..fae50a7eaf2f95107d9a5fc23c77171b508418f4 100755 (executable)
@@ -128,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);
        }
@@ -146,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)
@@ -243,4 +246,3 @@ class Af_Readability extends Plugin {
        }
 
 }
-?>
index aa3ef59bb3ba807203baa138e15849e8cb685e15..d08dfa7a66c420bac9de158f8a3a36bf376c9c84 100755 (executable)
@@ -73,6 +73,9 @@ class Af_RedditImgur extends Plugin {
                echo __("Configuration saved");
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        private function inline_stuff($article, &$doc, $xpath, $debug = false) {
 
                $entries = $xpath->query('(//a[@href]|//img[@src])');
@@ -442,13 +445,16 @@ class Af_RedditImgur extends Plugin {
                        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, !ini_get("open_basedir"));
                        curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
 
-                       @$result = curl_exec($ch);
+                       @curl_exec($ch);
                        $content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
                }
 
                return $content_type;
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        private function readability($article, $url, $doc, $xpath, $debug = false) {
 
                if (!defined('NO_CURL') && function_exists("curl_init") && $this->host->get($this, "enable_readability") &&
@@ -510,4 +516,3 @@ class Af_RedditImgur extends Plugin {
                return $article;
        }
 }
-?>
index dbdc78e9364f8033a8e8594d597a062571685430..d74253b57636d9c1c9b85ed35fee0e7bb545ad1e 100755 (executable)
@@ -79,5 +79,4 @@ class Af_Tumblr_1280 extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index e5f43e40aafa9b86892ff999fe79acc57d881ae8..bfd0f66e1483b108730d45c5c1590bcac08f637b 100755 (executable)
@@ -81,5 +81,4 @@ class Af_Unburn extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index 7820113409e74d4fdf9344c771bda5ec0977e9fc..16dcc926cfd55147de22f36b7ce68a662e5a852c 100644 (file)
@@ -14,6 +14,9 @@ class Af_Youtube_Embed extends Plugin {
                $host->add_hook($host::HOOK_RENDER_ENCLOSURE, $this);
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function hook_render_enclosure($entry, $hide_images) {
 
                $matches = array();
@@ -37,4 +40,3 @@ class Af_Youtube_Embed extends Plugin {
        }
 
 }
-?>
index 86f79c6946875bc4b142145b474d871a14903b09..c85ec642756c7e928348c1e7e1221b96cc050252 100644 (file)
@@ -80,7 +80,7 @@ class Af_Zz_ImgProxy extends Plugin {
                                if (function_exists("imagecreate") && !isset($_REQUEST["text"])) {
                                        $img = imagecreate(450, 75);
 
-                                       $bg = imagecolorallocate($img, 255, 255, 255);
+                                       /*$bg =*/ imagecolorallocate($img, 255, 255, 255);
                                        $textcolor = imagecolorallocate($img, 255, 0, 0);
 
                                        imagerectangle($img, 0, 0, 450-1, 75-1, $textcolor);
@@ -143,6 +143,9 @@ class Af_Zz_ImgProxy extends Plugin {
                return $url;
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function hook_render_article_cdm($article, $api_mode = false) {
 
                $need_saving = false;
index cdfd06338d95b6689bb0aefb030325d3a7dace14..7f55e386f440649ace4fcfbdb1e0dd90b9a26bc2 100644 (file)
@@ -89,5 +89,4 @@ class Af_Zz_ImgSetSizes extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index a36dafa963f9fada3f3032e184d52f4d17e0b0ce..491800708fd27e7c06866c7d38676a0dda16740f 100644 (file)
@@ -20,5 +20,4 @@ class Af_Zz_NoAutoPlay extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index e1da850ded665ba5fd9971e38d7962c0dec4a69f..48efff5adb241bc5e4e0bd091554cc608a58992b 100644 (file)
@@ -20,5 +20,4 @@ class Af_Zz_VidMute extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index 838178b26f5a6a259e1115b1ebb8b304de7ee1a4..dd04dcd10503487832adc6351dd9ace272adbc0a 100644 (file)
@@ -34,7 +34,9 @@ class Auth_Remote extends Plugin implements IAuthModule {
                return "";
        }
 
-
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function authenticate($login, $password) {
                $try_login = db_escape_string($_SERVER["REMOTE_USER"]);
 
@@ -43,7 +45,6 @@ class Auth_Remote extends Plugin implements IAuthModule {
                if (!$try_login) $try_login = db_escape_string($_SERVER["PHP_AUTH_USER"]);
 
                if (!$try_login) $try_login = $this->get_login_by_ssl_certificate();
-#              if (!$try_login) $try_login = "test_qqq";
 
                if ($try_login) {
                        $user_id = $this->base->auto_create_user($try_login, $password);
@@ -84,5 +85,3 @@ class Auth_Remote extends Plugin implements IAuthModule {
        }
 
 }
-
-?>
index 36f7c32676f6fc58244ef7852f394350ed832de0..4592175e36d358a034de59457cc5308d33ea8189 100644 (file)
@@ -53,5 +53,4 @@ class Auto_Assign_Labels extends Plugin {
        function api_version() {
                return 2;
        }
-}
-?>
+}
\ No newline at end of file
index a230b2854555c97947224e4ca48d9c7eef93d970..1ec4bbe9d277b75468c8150ffd23c0db96299cb8 100644 (file)
@@ -50,5 +50,4 @@ class Bookmarklets extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index de627fc7722946f63b503f187b5a532455cb1cd5..6c9e67b171f025c29aeea31120483a2c3a3ba4ad 100644 (file)
@@ -11,10 +11,16 @@ class Cache_Starred_Images extends Plugin implements IHandler {
                        true);
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function csrf_ignore($method) {
                return false;
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function before($method) {
                return true;
        }
@@ -88,6 +94,9 @@ class Cache_Starred_Images extends Plugin implements IHandler {
                }
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedLocalVariable)
+        */
        function hook_house_keeping() {
                $files = glob($this->cache_dir . "/*.{png,mp4}", GLOB_BRACE);
 
@@ -112,6 +121,9 @@ class Cache_Starred_Images extends Plugin implements IHandler {
                }
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes, $article_id) {
                $xpath = new DOMXpath($doc);
 
@@ -162,6 +174,9 @@ class Cache_Starred_Images extends Plugin implements IHandler {
                }
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function cache_article_images($content, $site_url, $owner_uid, $article_id) {
                libxml_use_internal_errors(true);
 
@@ -211,4 +226,3 @@ class Cache_Starred_Images extends Plugin implements IHandler {
                return 2;
        }
 }
-?>
index 7911642c313247d3a91122fa8a1dbe780595d8de..66d2af679b2522ce6043834941b6b62f197804bd 100644 (file)
@@ -14,6 +14,9 @@ class Close_Button extends Plugin {
                        "fox");
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function hook_article_button($line) {
                if (!get_pref("COMBINED_DISPLAY_MODE")) {
                        $rv = "<img src=\"plugins/close_button/button.png\"
@@ -29,5 +32,4 @@ class Close_Button extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index df803d38b64f9f2db136ce031aac2bb43ba2595e..a74905f8f65009f369d5373cc33e374dffe4f000 100644 (file)
@@ -54,5 +54,4 @@ class Embed_Original extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index a8b7069db9b1f7c6cf4b6d18513a971d8e2598d9..ca8b88516dbb5c34b46a31e57941b35f3f6c9375 100644 (file)
@@ -37,5 +37,4 @@ class GoogleReaderKeys extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index 491216e06c98b66dd4016934786d2b494106263d..ec618b72352c977c09767707935d62a9965b145c 100644 (file)
@@ -91,6 +91,9 @@ class Import_Export extends Plugin implements IHandler {
                return in_array($method, array("exportget"));
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function before($method) {
                return $_SESSION["uid"] != false;
        }
@@ -99,6 +102,9 @@ class Import_Export extends Plugin implements IHandler {
                return true;
        }
 
+       /**
+        * @SuppressWarnings(unused)
+        */
        function exportget() {
                $exportname = CACHE_DIR . "/export/" .
                        sha1($_SESSION['uid'] . $_SESSION['login']) . ".xml";
@@ -468,5 +474,4 @@ class Import_Export extends Plugin implements IHandler {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index 643475dcada942df10eadf7ad1d6a5addd7ee62f..7b65d6d4a25bb6c87c6ac4aef659a4ab05300d88 100644 (file)
@@ -25,6 +25,9 @@ class Instances extends Plugin implements IHandler {
                $host->add_hook($host::HOOK_UPDATE_TASK, $this);
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function hook_update_task($args) {
                _debug("Get linked feeds...");
                $this->get_linked_feeds();
@@ -134,6 +137,9 @@ class Instances extends Plugin implements IHandler {
                return file_get_contents(dirname(__FILE__) . "/instances.js");
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function hook_prefs_tabs($args) {
                if ($_SESSION["access_level"] >= 10 || SINGLE_USER_MODE) {
                        ?><div id="instanceConfigTab" dojoType="dijit.layout.ContentPane"
@@ -148,6 +154,9 @@ class Instances extends Plugin implements IHandler {
                return array_search($method, $csrf_ignored) !== false;
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function before($method) {
                if ($_SESSION["uid"]) {
                        if ($_SESSION["access_level"] < 10) {
@@ -171,7 +180,7 @@ class Instances extends Plugin implements IHandler {
        }
 
        function add() {
-               $id = db_escape_string($_REQUEST["id"]);
+               //$id = db_escape_string($_REQUEST["id"]);
                $access_url = db_escape_string($_REQUEST["access_url"]);
                $access_key = db_escape_string($_REQUEST["access_key"]);
 
@@ -449,4 +458,3 @@ class Instances extends Plugin implements IHandler {
        }
 
 }
-?>
index ef97797f4d8d2770df43104c794fbe251c8a17d7..5fa8c8e1ce159c601cecaab94338d45401b3acfb 100644 (file)
@@ -224,5 +224,4 @@ class Mail extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index 12f80ec89504bfb3fd1ca2dd5ad680036786f641..83e6432319eba628e3842270847834c48ab5632e 100644 (file)
@@ -32,12 +32,11 @@ class MailTo extends Plugin {
                require_once "lib/MiniTemplator.class.php";
 
                $tpl = new MiniTemplator;
-               $tpl_t = new MiniTemplator;
 
                $tpl->readTemplateFromFile("templates/email_article_template.txt");
 
                $tpl->setVariable('USER_NAME', $_SESSION["name"], true);
-               $tpl->setVariable('USER_EMAIL', $user_email, true);
+               //$tpl->setVariable('USER_EMAIL', $user_email, true);
                $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true);
 
 
@@ -91,4 +90,3 @@ class MailTo extends Plugin {
        }
 
 }
-?>
index 4cdff53d0cabf0438c4d7b4ee953de3bcc453077..3910305cd5db8b06a291788e798a421e5e31a028 100644 (file)
@@ -40,4 +40,3 @@ class Mark_Button extends Plugin {
        }
 
 }
-?>
index 35f7187f5843827a1aab8a61a3e40440eea32c41..18cc3ba17f76ea13a62abc63ca1e0c7ceeaec778 100644 (file)
@@ -14,6 +14,9 @@ class No_Iframes extends Plugin {
                $host->add_hook($host::HOOK_SANITIZE, $this);
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes) {
 
                $xpath = new DOMXpath($doc);
@@ -31,5 +34,4 @@ class No_Iframes extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index a9f22831dd8cd1a6c1186689f54d1f6c4377d5c5..86d2bdfc3458e5aee23c25475a606c440f655085 100644 (file)
@@ -21,5 +21,4 @@ class No_Title_Counters extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index da31267c28c3b32dc3a594f15a362d7909df4740..54d6f42856b3602683d5b89b61b1146b23cf8295 100644 (file)
@@ -21,5 +21,4 @@ class No_URL_Hashes extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index 7231845fed441c3b09a25aa5728379fbfb40da8d..dd372ce5e971554d342353d748fc15bde0d640e4 100644 (file)
@@ -72,5 +72,4 @@ class Note extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index 7a3265fa0ba7c4d766aeadd81140150357cc83d8..f10881ba5f56ce0d9166f1b8d979cc67f7cd6276 100644 (file)
@@ -104,5 +104,4 @@ class NSFW extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index 065af64f2ae08ac68d5e1f9100db023dc4ad3199..8520bb0d80bae14a6ae7050537c3a360f91d5ee7 100644 (file)
@@ -61,5 +61,4 @@ class Search_Sphinx extends Plugin {
        function api_version() {
                return 2;
        }
-}
-?>
+}
\ No newline at end of file
index 90643d3c74c6d2322ba94e9914e8e309e622c732..41b0fac41bd2a1f3f57ffe4b9b4758cea52975e2 100644 (file)
@@ -973,6 +973,10 @@ class SphinxClient
                return pack ( "N", $t2 );
        }
 
+       /**
+        * @SuppressWarnings(unused)
+        */
+
        /// add query to multi-query batch
        /// returns index into results array from RunQueries() call
        function AddQuery ( $query, $index="*", $comment="" )
index a028c057b4630ce607552fc42c6407012eb22454..133f0944749eae17885d4eb2b6e633c9e155fdc3 100644 (file)
@@ -78,7 +78,7 @@ class Share extends Plugin {
        function shareArticle() {
                $param = db_escape_string($_REQUEST['param']);
 
-               $result = db_query("SELECT uuid, ref_id FROM ttrss_user_entries WHERE int_id = '$param'
+               $result = db_query("SELECT uuid FROM ttrss_user_entries WHERE int_id = '$param'
                        AND owner_uid = " . $_SESSION['uid']);
 
                if (db_num_rows($result) == 0) {
@@ -86,7 +86,6 @@ class Share extends Plugin {
                } else {
 
                        $uuid = db_fetch_result($result, 0, "uuid");
-                       $ref_id = db_fetch_result($result, 0, "ref_id");
 
                        if (!$uuid) {
                                $uuid = db_escape_string(uniqid_short());
@@ -127,5 +126,4 @@ class Share extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index 1d0c99eca642de3e1dbf47846eb586b37c1e51f3..64b4ad7abb8ab25ca8cfb4f82951612fc7afb733 100644 (file)
@@ -25,5 +25,4 @@ class Shorten_Expanded extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index e60e7201f7ca5c6543496329400daa104bbf35dd..d85149ef3630a23a8fb13693cc8e2e44d23dc391 100644 (file)
@@ -27,5 +27,4 @@ class Swap_JK extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file
index 3138c8a7dcb04891c101341c7421d7aa399da792..9caf1093e875badcaa0031b267d162244b4e15a4 100644 (file)
@@ -20,12 +20,18 @@ class VF_Shared extends Plugin {
                return 2;
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function get_unread($feed_id) {
                $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and unread = true and uuid != ''");
 
                return db_fetch_result($result, 0, "count");
        }
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function get_total($feed_id) {
                $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and uuid != ''");
 
@@ -34,6 +40,9 @@ class VF_Shared extends Plugin {
 
        //function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false) {
 
+       /**
+        * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        */
        function get_headlines($feed_id, $options) {
                /*$qfh_ret = queryFeedHeadlines(-4,
                        $options['limit'],
@@ -71,5 +80,4 @@ class VF_Shared extends Plugin {
                return $qfh_ret;
        }
 
-}
-?>
+}
\ No newline at end of file
index 510eed15283feec323d724692715821646f4e041..fce9cee77ff135d6c3ae328755ad0ba4ad7f70b8 100644 (file)
@@ -9,6 +9,11 @@
 
        <!-- phpmd author is a bit weird i guess -->
 
+       <rule ref="rulesets/cleancode.xml">
+               <exclude name="BooleanArgumentFlag" />
+               <exclude name="ElseExpression" />
+       </rule>
+
        <rule ref="rulesets/unusedcode.xml" />
 
 </ruleset>