diff --git a/plugins/af_comics/af_comics_template.php b/plugins/af_comics/af_comics_template.php index 117d6928..a8054a3d 100644 --- a/plugins/af_comics/af_comics_template.php +++ b/plugins/af_comics/af_comics_template.php @@ -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 diff --git a/plugins/af_comics/filter_base.php b/plugins/af_comics/filter_base.php index a5343064..bfa07777 100644 --- a/plugins/af_comics/filter_base.php +++ b/plugins/af_comics/filter_base.php @@ -2,5 +2,4 @@ abstract class Af_ComicFilter { public abstract function supported(); public abstract function process(&$article); -} -?> +} \ No newline at end of file diff --git a/plugins/af_comics/filters/af_comics_cad.php b/plugins/af_comics/filters/af_comics_cad.php index 43836724..7c067091 100644 --- a/plugins/af_comics/filters/af_comics_cad.php +++ b/plugins/af_comics/filters/af_comics_cad.php @@ -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 diff --git a/plugins/af_comics/filters/af_comics_comicclass.php b/plugins/af_comics/filters/af_comics_comicclass.php index 45698751..56a5b9cf 100644 --- a/plugins/af_comics/filters/af_comics_comicclass.php +++ b/plugins/af_comics/filters/af_comics_comicclass.php @@ -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 diff --git a/plugins/af_comics/filters/af_comics_comicpress.php b/plugins/af_comics/filters/af_comics_comicpress.php index 30683759..81994d90 100644 --- a/plugins/af_comics/filters/af_comics_comicpress.php +++ b/plugins/af_comics/filters/af_comics_comicpress.php @@ -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 diff --git a/plugins/af_comics/filters/af_comics_darklegacy.php b/plugins/af_comics/filters/af_comics_darklegacy.php index c03919b1..33c1eca5 100644 --- a/plugins/af_comics/filters/af_comics_darklegacy.php +++ b/plugins/af_comics/filters/af_comics_darklegacy.php @@ -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 diff --git a/plugins/af_comics/filters/af_comics_dilbert.php b/plugins/af_comics/filters/af_comics_dilbert.php index 5faba7eb..9eed7232 100644 --- a/plugins/af_comics/filters/af_comics_dilbert.php +++ b/plugins/af_comics/filters/af_comics_dilbert.php @@ -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 diff --git a/plugins/af_comics/filters/af_comics_explosm.php b/plugins/af_comics/filters/af_comics_explosm.php index 30b7e24c..35a2edd4 100644 --- a/plugins/af_comics/filters/af_comics_explosm.php +++ b/plugins/af_comics/filters/af_comics_explosm.php @@ -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 diff --git a/plugins/af_comics/filters/af_comics_pa.php b/plugins/af_comics/filters/af_comics_pa.php index 0848adbd..ae5cabec 100644 --- a/plugins/af_comics/filters/af_comics_pa.php +++ b/plugins/af_comics/filters/af_comics_pa.php @@ -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 diff --git a/plugins/af_comics/filters/af_comics_pvp.php b/plugins/af_comics/filters/af_comics_pvp.php index 2094e684..1a1ccab3 100644 --- a/plugins/af_comics/filters/af_comics_pvp.php +++ b/plugins/af_comics/filters/af_comics_pvp.php @@ -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 diff --git a/plugins/af_comics/filters/af_comics_tfd.php b/plugins/af_comics/filters/af_comics_tfd.php index eeec28fa..78792d25 100644 --- a/plugins/af_comics/filters/af_comics_tfd.php +++ b/plugins/af_comics/filters/af_comics_tfd.php @@ -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 diff --git a/plugins/af_comics/filters/af_comics_twp.php b/plugins/af_comics/filters/af_comics_twp.php index ec43c137..712d54a1 100644 --- a/plugins/af_comics/filters/af_comics_twp.php +++ b/plugins/af_comics/filters/af_comics_twp.php @@ -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 diff --git a/plugins/af_comics/filters/af_comics_whomp.php b/plugins/af_comics/filters/af_comics_whomp.php index 5bc6a14e..3c2e0b0c 100644 --- a/plugins/af_comics/filters/af_comics_whomp.php +++ b/plugins/af_comics/filters/af_comics_whomp.php @@ -33,5 +33,4 @@ class Af_Comics_Whomp extends Af_ComicFilter { return false; } -} -?> +} \ No newline at end of file diff --git a/plugins/af_comics/init.php b/plugins/af_comics/init.php index 31994176..15af1d1a 100644 --- a/plugins/af_comics/init.php +++ b/plugins/af_comics/init.php @@ -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 diff --git a/plugins/af_fsckportal/init.php b/plugins/af_fsckportal/init.php index 4718eca9..40ace502 100644 --- a/plugins/af_fsckportal/init.php +++ b/plugins/af_fsckportal/init.php @@ -48,5 +48,4 @@ class Af_Fsckportal extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/af_lang_detect/init.php b/plugins/af_lang_detect/init.php index 3f2eb29f..e7874131 100644 --- a/plugins/af_lang_detect/init.php +++ b/plugins/af_lang_detect/init.php @@ -43,4 +43,3 @@ class Af_Lang_Detect extends Plugin { } } -?> diff --git a/plugins/af_lang_detect/languagedetect/LanguageDetect.php b/plugins/af_lang_detect/languagedetect/LanguageDetect.php index 0856571b..6c186350 100644 --- a/plugins/af_lang_detect/languagedetect/LanguageDetect.php +++ b/plugins/af_lang_detect/languagedetect/LanguageDetect.php @@ -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: */ - -?> diff --git a/plugins/af_lang_detect/languagedetect/Text/LanguageDetect/ISO639.php b/plugins/af_lang_detect/languagedetect/Text/LanguageDetect/ISO639.php index c577a2e1..7caa9794 100644 --- a/plugins/af_lang_detect/languagedetect/Text/LanguageDetect/ISO639.php +++ b/plugins/af_lang_detect/languagedetect/Text/LanguageDetect/ISO639.php @@ -25,6 +25,8 @@ * @copyright 2011 Christian Weiske * @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 diff --git a/plugins/af_lang_detect/languagedetect/Text/LanguageDetect/Parser.php b/plugins/af_lang_detect/languagedetect/Text/LanguageDetect/Parser.php index 1c20c265..44eea897 100644 --- a/plugins/af_lang_detect/languagedetect/Text/LanguageDetect/Parser.php +++ b/plugins/af_lang_detect/languagedetect/Text/LanguageDetect/Parser.php @@ -345,5 +345,3 @@ class Text_LanguageDetect_Parser extends Text_LanguageDetect } /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -?> diff --git a/plugins/af_psql_trgm/init.php b/plugins/af_psql_trgm/init.php index 542cd720..087b116d 100644 --- a/plugins/af_psql_trgm/init.php +++ b/plugins/af_psql_trgm/init.php @@ -321,5 +321,4 @@ class Af_Psql_Trgm extends Plugin { return $tmp; } -} -?> +} \ No newline at end of file diff --git a/plugins/af_readability/init.php b/plugins/af_readability/init.php index 9557a979..fae50a7e 100755 --- a/plugins/af_readability/init.php +++ b/plugins/af_readability/init.php @@ -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 { } } -?> diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index aa3ef59b..d08dfa7a 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -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; } } -?> diff --git a/plugins/af_tumblr_1280/init.php b/plugins/af_tumblr_1280/init.php index dbdc78e9..d74253b5 100755 --- a/plugins/af_tumblr_1280/init.php +++ b/plugins/af_tumblr_1280/init.php @@ -79,5 +79,4 @@ class Af_Tumblr_1280 extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/af_unburn/init.php b/plugins/af_unburn/init.php index e5f43e40..bfd0f66e 100755 --- a/plugins/af_unburn/init.php +++ b/plugins/af_unburn/init.php @@ -81,5 +81,4 @@ class Af_Unburn extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/af_youtube_embed/init.php b/plugins/af_youtube_embed/init.php index 78201134..16dcc926 100644 --- a/plugins/af_youtube_embed/init.php +++ b/plugins/af_youtube_embed/init.php @@ -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 { } } -?> diff --git a/plugins/af_zz_imgproxy/init.php b/plugins/af_zz_imgproxy/init.php index 86f79c69..c85ec642 100644 --- a/plugins/af_zz_imgproxy/init.php +++ b/plugins/af_zz_imgproxy/init.php @@ -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; diff --git a/plugins/af_zz_imgsetsizes/init.php b/plugins/af_zz_imgsetsizes/init.php index cdfd0633..7f55e386 100644 --- a/plugins/af_zz_imgsetsizes/init.php +++ b/plugins/af_zz_imgsetsizes/init.php @@ -89,5 +89,4 @@ class Af_Zz_ImgSetSizes extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/af_zz_noautoplay/init.php b/plugins/af_zz_noautoplay/init.php index a36dafa9..49180070 100644 --- a/plugins/af_zz_noautoplay/init.php +++ b/plugins/af_zz_noautoplay/init.php @@ -20,5 +20,4 @@ class Af_Zz_NoAutoPlay extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/af_zz_vidmute/init.php b/plugins/af_zz_vidmute/init.php index e1da850d..48efff5a 100644 --- a/plugins/af_zz_vidmute/init.php +++ b/plugins/af_zz_vidmute/init.php @@ -20,5 +20,4 @@ class Af_Zz_VidMute extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/auth_remote/init.php b/plugins/auth_remote/init.php index 838178b2..dd04dcd1 100644 --- a/plugins/auth_remote/init.php +++ b/plugins/auth_remote/init.php @@ -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 { } } - -?> diff --git a/plugins/auto_assign_labels/init.php b/plugins/auto_assign_labels/init.php index 36f7c326..4592175e 100644 --- a/plugins/auto_assign_labels/init.php +++ b/plugins/auto_assign_labels/init.php @@ -53,5 +53,4 @@ class Auto_Assign_Labels extends Plugin { function api_version() { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/bookmarklets/init.php b/plugins/bookmarklets/init.php index a230b285..1ec4bbe9 100644 --- a/plugins/bookmarklets/init.php +++ b/plugins/bookmarklets/init.php @@ -50,5 +50,4 @@ class Bookmarklets extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/cache_starred_images/init.php b/plugins/cache_starred_images/init.php index de627fc7..6c9e67b1 100644 --- a/plugins/cache_starred_images/init.php +++ b/plugins/cache_starred_images/init.php @@ -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; } } -?> diff --git a/plugins/close_button/init.php b/plugins/close_button/init.php index 7911642c..66d2af67 100644 --- a/plugins/close_button/init.php +++ b/plugins/close_button/init.php @@ -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 = " +} \ No newline at end of file diff --git a/plugins/embed_original/init.php b/plugins/embed_original/init.php index df803d38..a74905f8 100644 --- a/plugins/embed_original/init.php +++ b/plugins/embed_original/init.php @@ -54,5 +54,4 @@ class Embed_Original extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/googlereaderkeys/init.php b/plugins/googlereaderkeys/init.php index a8b7069d..ca8b8851 100644 --- a/plugins/googlereaderkeys/init.php +++ b/plugins/googlereaderkeys/init.php @@ -37,5 +37,4 @@ class GoogleReaderKeys extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/import_export/init.php b/plugins/import_export/init.php index 491216e0..ec618b72 100644 --- a/plugins/import_export/init.php +++ b/plugins/import_export/init.php @@ -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 diff --git a/plugins/instances/init.php b/plugins/instances/init.php index 643475dc..7b65d6d4 100644 --- a/plugins/instances/init.php +++ b/plugins/instances/init.php @@ -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) { ?>
diff --git a/plugins/mail/init.php b/plugins/mail/init.php index ef97797f..5fa8c8e1 100644 --- a/plugins/mail/init.php +++ b/plugins/mail/init.php @@ -224,5 +224,4 @@ class Mail extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/mailto/init.php b/plugins/mailto/init.php index 12f80ec8..83e64323 100644 --- a/plugins/mailto/init.php +++ b/plugins/mailto/init.php @@ -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 { } } -?> diff --git a/plugins/mark_button/init.php b/plugins/mark_button/init.php index 4cdff53d..3910305c 100644 --- a/plugins/mark_button/init.php +++ b/plugins/mark_button/init.php @@ -40,4 +40,3 @@ class Mark_Button extends Plugin { } } -?> diff --git a/plugins/no_iframes/init.php b/plugins/no_iframes/init.php index 35f7187f..18cc3ba1 100644 --- a/plugins/no_iframes/init.php +++ b/plugins/no_iframes/init.php @@ -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 diff --git a/plugins/no_title_counters/init.php b/plugins/no_title_counters/init.php index a9f22831..86d2bdfc 100644 --- a/plugins/no_title_counters/init.php +++ b/plugins/no_title_counters/init.php @@ -21,5 +21,4 @@ class No_Title_Counters extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/no_url_hashes/init.php b/plugins/no_url_hashes/init.php index da31267c..54d6f428 100644 --- a/plugins/no_url_hashes/init.php +++ b/plugins/no_url_hashes/init.php @@ -21,5 +21,4 @@ class No_URL_Hashes extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/note/init.php b/plugins/note/init.php index 7231845f..dd372ce5 100644 --- a/plugins/note/init.php +++ b/plugins/note/init.php @@ -72,5 +72,4 @@ class Note extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/nsfw/init.php b/plugins/nsfw/init.php index 7a3265fa..f10881ba 100644 --- a/plugins/nsfw/init.php +++ b/plugins/nsfw/init.php @@ -104,5 +104,4 @@ class NSFW extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/search_sphinx/init.php b/plugins/search_sphinx/init.php index 065af64f..8520bb0d 100644 --- a/plugins/search_sphinx/init.php +++ b/plugins/search_sphinx/init.php @@ -61,5 +61,4 @@ class Search_Sphinx extends Plugin { function api_version() { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/search_sphinx/sphinxapi.php b/plugins/search_sphinx/sphinxapi.php index 90643d3c..41b0fac4 100644 --- a/plugins/search_sphinx/sphinxapi.php +++ b/plugins/search_sphinx/sphinxapi.php @@ -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="" ) diff --git a/plugins/share/init.php b/plugins/share/init.php index a028c057..133f0944 100644 --- a/plugins/share/init.php +++ b/plugins/share/init.php @@ -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 diff --git a/plugins/shorten_expanded/init.php b/plugins/shorten_expanded/init.php index 1d0c99ec..64b4ad7a 100644 --- a/plugins/shorten_expanded/init.php +++ b/plugins/shorten_expanded/init.php @@ -25,5 +25,4 @@ class Shorten_Expanded extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/swap_jk/init.php b/plugins/swap_jk/init.php index e60e7201..d85149ef 100644 --- a/plugins/swap_jk/init.php +++ b/plugins/swap_jk/init.php @@ -27,5 +27,4 @@ class Swap_JK extends Plugin { return 2; } -} -?> +} \ No newline at end of file diff --git a/plugins/vf_shared/init.php b/plugins/vf_shared/init.php index 3138c8a7..9caf1093 100644 --- a/plugins/vf_shared/init.php +++ b/plugins/vf_shared/init.php @@ -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 diff --git a/utils/gitlab-ci/php-lint.sh b/utils/gitlab-ci/php-lint.sh index 172abd87..9bd513f8 100644 --- a/utils/gitlab-ci/php-lint.sh +++ b/utils/gitlab-ci/php-lint.sh @@ -1,3 +1,5 @@ -#!/bin/sh -e +#!/bin/sh + +set -e exec find . -name "*.php" -not -path "*/lib/*" -print0 | xargs -0 -n1 php -l diff --git a/utils/gitlab-ci/phpmd-ruleset.xml b/utils/gitlab-ci/phpmd-ruleset.xml index 510eed15..d2c010fb 100644 --- a/utils/gitlab-ci/phpmd-ruleset.xml +++ b/utils/gitlab-ci/phpmd-ruleset.xml @@ -9,6 +9,11 @@ + + diff --git a/utils/gitlab-ci/phpmd.sh b/utils/gitlab-ci/phpmd.sh index 117be184..7541db84 100644 --- a/utils/gitlab-ci/phpmd.sh +++ b/utils/gitlab-ci/phpmd.sh @@ -1,7 +1,8 @@ -#!/bin/sh -i -e +#!/bin/sh -phpmd include,classes text utils/gitlab-ci/phpmd-ruleset.xml +set -e + +phpmd include,classes,plugins text utils/gitlab-ci/phpmd-ruleset.xml FILES=$(ls -dm *.php | tr -d " "| tr -d "\n") phpmd $FILES text utils/gitlab-ci/phpmd-ruleset.xml -