summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-04-26 20:57:36 +0300
committerAndrew Dolgov <[email protected]>2017-04-26 20:57:36 +0300
commit21ce7d9ec02b0bf7c6e0ac7c28bc7c1bb0a841c5 (patch)
tree2a784cf4c91abe828b42e79a886c2cc0f80df5e2
parentea79a0e033e40057279a7f464c9464145eedc932 (diff)
update phpmd ruleset to use (subset) of cleancode
fix various minor issues reported by static analysis remove redundant php closing tag from several more files
-rw-r--r--plugins/af_comics/af_comics_template.php5
-rw-r--r--plugins/af_comics/filter_base.php3
-rw-r--r--plugins/af_comics/filters/af_comics_cad.php10
-rw-r--r--plugins/af_comics/filters/af_comics_comicclass.php10
-rw-r--r--plugins/af_comics/filters/af_comics_comicpress.php10
-rw-r--r--plugins/af_comics/filters/af_comics_darklegacy.php9
-rw-r--r--plugins/af_comics/filters/af_comics_dilbert.php22
-rw-r--r--plugins/af_comics/filters/af_comics_explosm.php9
-rw-r--r--plugins/af_comics/filters/af_comics_pa.php19
-rw-r--r--plugins/af_comics/filters/af_comics_pvp.php6
-rw-r--r--plugins/af_comics/filters/af_comics_tfd.php8
-rw-r--r--plugins/af_comics/filters/af_comics_twp.php8
-rw-r--r--plugins/af_comics/filters/af_comics_whomp.php3
-rw-r--r--plugins/af_comics/init.php9
-rw-r--r--plugins/af_fsckportal/init.php3
-rw-r--r--plugins/af_lang_detect/init.php1
-rw-r--r--plugins/af_lang_detect/languagedetect/LanguageDetect.php4
-rw-r--r--plugins/af_lang_detect/languagedetect/Text/LanguageDetect/ISO639.php4
-rw-r--r--plugins/af_lang_detect/languagedetect/Text/LanguageDetect/Parser.php2
-rw-r--r--plugins/af_psql_trgm/init.php3
-rwxr-xr-xplugins/af_readability/init.php6
-rwxr-xr-xplugins/af_redditimgur/init.php9
-rwxr-xr-xplugins/af_tumblr_1280/init.php3
-rwxr-xr-xplugins/af_unburn/init.php3
-rw-r--r--plugins/af_youtube_embed/init.php4
-rw-r--r--plugins/af_zz_imgproxy/init.php5
-rw-r--r--plugins/af_zz_imgsetsizes/init.php3
-rw-r--r--plugins/af_zz_noautoplay/init.php3
-rw-r--r--plugins/af_zz_vidmute/init.php3
-rw-r--r--plugins/auth_remote/init.php7
-rw-r--r--plugins/auto_assign_labels/init.php3
-rw-r--r--plugins/bookmarklets/init.php3
-rw-r--r--plugins/cache_starred_images/init.php16
-rw-r--r--plugins/close_button/init.php6
-rw-r--r--plugins/embed_original/init.php3
-rw-r--r--plugins/googlereaderkeys/init.php3
-rw-r--r--plugins/import_export/init.php9
-rw-r--r--plugins/instances/init.php12
-rw-r--r--plugins/mail/init.php3
-rw-r--r--plugins/mailto/init.php4
-rw-r--r--plugins/mark_button/init.php1
-rw-r--r--plugins/no_iframes/init.php6
-rw-r--r--plugins/no_title_counters/init.php3
-rw-r--r--plugins/no_url_hashes/init.php3
-rw-r--r--plugins/note/init.php3
-rw-r--r--plugins/nsfw/init.php3
-rw-r--r--plugins/search_sphinx/init.php3
-rw-r--r--plugins/search_sphinx/sphinxapi.php4
-rw-r--r--plugins/share/init.php6
-rw-r--r--plugins/shorten_expanded/init.php3
-rw-r--r--plugins/swap_jk/init.php3
-rw-r--r--plugins/vf_shared/init.php12
-rw-r--r--utils/gitlab-ci/phpmd-ruleset.xml5
53 files changed, 138 insertions, 173 deletions
diff --git a/plugins/af_comics/af_comics_template.php b/plugins/af_comics/af_comics_template.php
index 117d69280..a8054a3df 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 a53430645..bfa077776 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 43836724f..7c0670918 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 45698751b..56a5b9cf6 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 306837598..81994d90b 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 c03919b1d..33c1eca5c 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 5faba7eb7..9eed7232a 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 30b7e24c9..35a2edd41 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 0848adbd0..ae5cabec0 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 2094e684e..1a1ccab3d 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 eeec28fa3..78792d254 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 ec43c1379..712d54a1d 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 5bc6a14e7..3c2e0b0c7 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 31994176e..15af1d1a6 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 4718eca91..40ace5022 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 3f2eb29f8..e78741319 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 0856571bf..6c1863508 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 c577a2e1a..7caa9794e 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 <[email protected]>
* @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 1c20c2657..44eea897f 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 542cd720e..087b116d6 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 9557a9791..fae50a7ea 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 aa3ef59bb..d08dfa7a6 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 dbdc78e93..d74253b57 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 e5f43e40a..bfd0f66e1 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 782011340..16dcc926c 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 86f79c694..c85ec6427 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 cdfd06338..7f55e386f 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 a36dafa96..491800708 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 e1da850de..48efff5ad 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 838178b26..dd04dcd10 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 36f7c3267..4592175e3 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 a230b2854..1ec4bbe9d 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 de627fc77..6c9e67b17 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 7911642c3..66d2af679 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 = "<img src=\"plugins/close_button/button.png\"
@@ -29,5 +32,4 @@ class Close_Button extends Plugin {
return 2;
}
-}
-?>
+} \ No newline at end of file
diff --git a/plugins/embed_original/init.php b/plugins/embed_original/init.php
index df803d38b..a74905f8f 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 a8b7069db..ca8b88516 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 491216e06..ec618b723 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 643475dca..7b65d6d4a 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) {
?><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 {
}
}
-?>
diff --git a/plugins/mail/init.php b/plugins/mail/init.php
index ef97797f4..5fa8c8e1c 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 12f80ec89..83e643231 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 4cdff53d0..3910305cd 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 35f7187f5..18cc3ba17 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 a9f22831d..86d2bdfc3 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 da31267c2..54d6f4285 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 7231845fe..dd372ce5e 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 7a3265fa0..f10881ba5 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 065af64f2..8520bb0d8 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 90643d3c7..41b0fac41 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 a028c057b..133f09447 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 1d0c99eca..64b4ad7ab 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 e60e7201f..d85149ef3 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 3138c8a7d..9caf1093e 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/phpmd-ruleset.xml b/utils/gitlab-ci/phpmd-ruleset.xml
index 510eed152..fce9cee77 100644
--- a/utils/gitlab-ci/phpmd-ruleset.xml
+++ b/utils/gitlab-ci/phpmd-ruleset.xml
@@ -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>