Passed
Branch master (de5173)
by Cody
11:03
created
plugins/af_comics/filters/af_comics_tfd.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 
8 8
 	function process(&$article) {
9 9
 		if (strpos($article["link"], "toothpastefordinner.com") !== FALSE ||
10
-		    strpos($article["link"], "marriedtothesea.com") !== FALSE) {
10
+			strpos($article["link"], "marriedtothesea.com") !== FALSE) {
11 11
 			$res = fetch_file_contents($article["link"], false, false, false,
12 12
 				false, false, 0,
13 13
 				"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@
 block discarded – undo
12 12
 				false, false, 0,
13 13
 				"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
14 14
 
15
-			if (!$res) return $article;
15
+			if (!$res) {
16
+				return $article;
17
+			}
16 18
 
17 19
 			$doc = new DOMDocument();
18 20
 
Please login to merge, or discard this patch.
plugins/af_comics/filters/af_comics_dilbert.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 					foreach ($matches as $tag) {
38 38
 						// Only strings starting with a number sign are considered tags
39
-						if ( substr($tag->textContent, 0, 1) == '#' ) {
39
+						if (substr($tag->textContent, 0, 1) == '#') {
40 40
 							$tags[] = mb_strtolower(substr($tag->textContent, 1), 'utf-8');
41 41
 						}
42 42
 					}
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 					// Add comic title to article type if not empty (mostly Sunday strips)
56 56
 					if ($comic_title) {
57
-						$article["title"] = $article["title"] . " - " . $comic_title;
57
+						$article["title"] = $article["title"]." - ".$comic_title;
58 58
 					}
59 59
 
60 60
 					if (!empty($tags)) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@
 block discarded – undo
16 16
 
17 17
 				global $fetch_last_error_content;
18 18
 
19
-				if (!$res && $fetch_last_error_content)
20
-					$res = $fetch_last_error_content;
19
+				if (!$res && $fetch_last_error_content) {
20
+									$res = $fetch_last_error_content;
21
+				}
21 22
 
22 23
 				$doc = new DOMDocument();
23 24
 
Please login to merge, or discard this patch.
plugins/cache_starred_images/init.php 3 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 	private $host;
6 6
 	/* @var DiskCache $cache */
7 7
 	private $cache;
8
-    private $max_cache_attempts = 5; // per-article
8
+	private $max_cache_attempts = 5; // per-article
9 9
 
10 10
 	function about() {
11 11
 		return array(1.0,
@@ -167,30 +167,30 @@  discard block
 block discarded – undo
167 167
 
168 168
 		Debug::log("status: $status_filename", Debug::$LOG_VERBOSE);
169 169
 
170
-        if ($this->cache->exists($status_filename))
171
-            $status = json_decode($this->cache->get($status_filename), true);
172
-        else
173
-            $status = [];
170
+		if ($this->cache->exists($status_filename))
171
+			$status = json_decode($this->cache->get($status_filename), true);
172
+		else
173
+			$status = [];
174 174
 
175
-        $status["attempt"] += 1;
175
+		$status["attempt"] += 1;
176 176
 
177
-        // only allow several download attempts for article
178
-        if ($status["attempt"] > $this->max_cache_attempts) {
179
-            Debug::log("too many attempts for $site_url", Debug::$LOG_VERBOSE);
180
-            return false;
181
-        }
177
+		// only allow several download attempts for article
178
+		if ($status["attempt"] > $this->max_cache_attempts) {
179
+			Debug::log("too many attempts for $site_url", Debug::$LOG_VERBOSE);
180
+			return false;
181
+		}
182 182
 
183
-        if (!$this->cache->put($status_filename, json_encode($status))) {
184
-            user_error("unable to write status file: $status_filename", E_USER_WARNING);
185
-            return false;
186
-        }
183
+		if (!$this->cache->put($status_filename, json_encode($status))) {
184
+			user_error("unable to write status file: $status_filename", E_USER_WARNING);
185
+			return false;
186
+		}
187 187
 
188 188
 		$doc = new DOMDocument();
189 189
 
190 190
 		$has_images = false;
191 191
 		$success = false;
192 192
 
193
-        if ($doc->loadHTML('<?xml encoding="UTF-8">' . $content)) {
193
+		if ($doc->loadHTML('<?xml encoding="UTF-8">' . $content)) {
194 194
 			$xpath = new DOMXPath($doc);
195 195
 			$entries = $xpath->query('(//img[@src])|(//video/source[@src])');
196 196
 
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 		$esth = $this->pdo->prepare("SELECT content_url FROM ttrss_enclosures WHERE post_id = ? AND
213 213
 			(content_type LIKE '%image%' OR content_type LIKE '%video%')");
214 214
 
215
-        if ($esth->execute([$article_id])) {
216
-        	while ($enc = $esth->fetch()) {
215
+		if ($esth->execute([$article_id])) {
216
+			while ($enc = $esth->fetch()) {
217 217
 
218
-        		$has_images = true;
219
-        		$url = rewrite_relative_url($site_url, $enc["content_url"]);
218
+				$has_images = true;
219
+				$url = rewrite_relative_url($site_url, $enc["content_url"]);
220 220
 
221 221
 				if ($this->cache_url($article_id, $url)) {
222 222
 					$success = true;
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	function hook_house_keeping() {
39 39
 		/* since HOOK_UPDATE_TASK is not available to user plugins, this hook is a next best thing */
40 40
 
41
-		Debug::log("caching media of starred articles for user " . $this->host->get_owner_uid() . "...");
41
+		Debug::log("caching media of starred articles for user ".$this->host->get_owner_uid()."...");
42 42
 
43 43
 		$sth = $this->pdo->prepare("SELECT content, ttrss_entries.title, 
44 44
        		ttrss_user_entries.owner_uid, link, site_url, ttrss_entries.id, plugin_data
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 			$usth = $this->pdo->prepare("UPDATE ttrss_entries SET plugin_data = ? WHERE id = ?");
57 57
 
58 58
 			while ($line = $sth->fetch()) {
59
-				Debug::log("processing article " . $line["title"], Debug::$LOG_VERBOSE);
59
+				Debug::log("processing article ".$line["title"], Debug::$LOG_VERBOSE);
60 60
 
61 61
 				if ($line["site_url"]) {
62 62
 					$success = $this->cache_article_images($line["content"], $line["site_url"], $line["owner_uid"], $line["id"]);
63 63
 
64 64
 					if ($success) {
65
-						$plugin_data = "starred_cache_images,${line['owner_uid']}:" . $line["plugin_data"];
65
+						$plugin_data = "starred_cache_images,${line['owner_uid']}:".$line["plugin_data"];
66 66
 
67 67
 						$usth->execute([$plugin_data, $line['id']]);
68 68
 					}
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 
73 73
 		/* actual housekeeping */
74 74
 
75
-		Debug::log("expiring " . $this->cache->getDir() . "...");
75
+		Debug::log("expiring ".$this->cache->getDir()."...");
76 76
 
77
-		$files = glob($this->cache->getDir() . "/*.{png,mp4,status}", GLOB_BRACE);
77
+		$files = glob($this->cache->getDir()."/*.{png,mp4,status}", GLOB_BRACE);
78 78
 
79 79
 		$last_article_id = 0;
80 80
 		$article_exists = 1;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 	function hook_enclosure_entry($enc, $article_id) {
101
-		$local_filename = $article_id . "-" . sha1($enc["content_url"]);
101
+		$local_filename = $article_id."-".sha1($enc["content_url"]);
102 102
 
103 103
 		if ($this->cache->exists($local_filename)) {
104 104
 			$enc["content_url"] = $this->cache->getUrl($local_filename);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 				if ($entry->hasAttribute('src')) {
121 121
 					$src = rewrite_relative_url($site_url, $entry->getAttribute('src'));
122 122
 
123
-					$local_filename = $article_id . "-" . sha1($src);
123
+					$local_filename = $article_id."-".sha1($src);
124 124
 
125 125
 					if ($this->cache->exists($local_filename)) {
126 126
 						$entry->setAttribute("src", $this->cache->getUrl($local_filename));
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	}
135 135
 
136 136
 	private function cache_url($article_id, $url) {
137
-		$local_filename = $article_id . "-" . sha1($url);
137
+		$local_filename = $article_id."-".sha1($url);
138 138
 
139 139
 		if (!$this->cache->exists($local_filename)) {
140 140
 			Debug::log("cache_images: downloading: $url to $local_filename", Debug::$LOG_VERBOSE);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 			$data = fetch_file_contents(["url" => $url, "max_size" => MAX_CACHE_FILE_SIZE]);
143 143
 
144 144
 			if ($data)
145
-				return $this->cache->put($local_filename, $data);;
145
+				return $this->cache->put($local_filename, $data); ;
146 146
 
147 147
 		} else {
148 148
 			//Debug::log("cache_images: local file exists for $url", Debug::$LOG_VERBOSE);
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
158 158
 	 */
159 159
 	private function cache_article_images($content, $site_url, $owner_uid, $article_id) {
160
-		$status_filename = $article_id . "-" . sha1($site_url) . ".status";
160
+		$status_filename = $article_id."-".sha1($site_url).".status";
161 161
 
162 162
 		/* housekeeping might run as a separate user, in this case status/media might not be writable */
163 163
 		if (!$this->cache->isWritable($status_filename)) {
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		$has_images = false;
191 191
 		$success = false;
192 192
 
193
-        if ($doc->loadHTML('<?xml encoding="UTF-8">' . $content)) {
193
+        if ($doc->loadHTML('<?xml encoding="UTF-8">'.$content)) {
194 194
 			$xpath = new DOMXPath($doc);
195 195
 			$entries = $xpath->query('(//img[@src])|(//video/source[@src])');
196 196
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,11 +17,13 @@  discard block
 block discarded – undo
17 17
 		$this->host = $host;
18 18
 		$this->cache = new DiskCache("starred-images");
19 19
 
20
-		if ($this->cache->makeDir())
21
-			chmod($this->cache->getDir(), 0777);
20
+		if ($this->cache->makeDir()) {
21
+					chmod($this->cache->getDir(), 0777);
22
+		}
22 23
 
23
-		if (!$this->cache->exists(".no-auto-expiry"))
24
-			$this->cache->touch(".no-auto-expiry");
24
+		if (!$this->cache->exists(".no-auto-expiry")) {
25
+					$this->cache->touch(".no-auto-expiry");
26
+		}
25 27
 
26 28
 		if ($this->cache->isWritable()) {
27 29
 			$host->add_hook($host::HOOK_HOUSE_KEEPING, $this);
@@ -141,8 +143,10 @@  discard block
 block discarded – undo
141 143
 
142 144
 			$data = fetch_file_contents(["url" => $url, "max_size" => MAX_CACHE_FILE_SIZE]);
143 145
 
144
-			if ($data)
145
-				return $this->cache->put($local_filename, $data);;
146
+			if ($data) {
147
+							return $this->cache->put($local_filename, $data);
148
+			}
149
+			;
146 150
 
147 151
 		} else {
148 152
 			//Debug::log("cache_images: local file exists for $url", Debug::$LOG_VERBOSE);
@@ -167,10 +171,11 @@  discard block
 block discarded – undo
167 171
 
168 172
 		Debug::log("status: $status_filename", Debug::$LOG_VERBOSE);
169 173
 
170
-        if ($this->cache->exists($status_filename))
171
-            $status = json_decode($this->cache->get($status_filename), true);
172
-        else
173
-            $status = [];
174
+        if ($this->cache->exists($status_filename)) {
175
+                    $status = json_decode($this->cache->get($status_filename), true);
176
+        } else {
177
+                    $status = [];
178
+        }
174 179
 
175 180
         $status["attempt"] += 1;
176 181
 
Please login to merge, or discard this patch.
plugins/mailto/init.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	}
16 16
 
17 17
 	function get_js() {
18
-		return file_get_contents(dirname(__FILE__) . "/init.js");
18
+		return file_get_contents(dirname(__FILE__)."/init.js");
19 19
 	}
20 20
 
21 21
 	function hook_article_button($line) {
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		$sth->execute(array_merge($ids, [$_SESSION['uid']]));
47 47
 
48 48
 		if (count($ids) > 1) {
49
-			$subject = __("[Forwarded]") . " " . __("Multiple articles");
49
+			$subject = __("[Forwarded]")." ".__("Multiple articles");
50 50
 		} else {
51 51
 			$subject = "";
52 52
 		}
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		while ($line = $sth->fetch()) {
55 55
 
56 56
 			if (!$subject)
57
-				$subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]);
57
+				$subject = __("[Forwarded]")." ".htmlspecialchars($line["title"]);
58 58
 
59 59
 			$tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"]));
60 60
 			$tpl->setVariable('ARTICLE_URL', strip_tags($line["link"]));
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,9 @@
 block discarded – undo
53 53
 
54 54
 		while ($line = $sth->fetch()) {
55 55
 
56
-			if (!$subject)
57
-				$subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]);
56
+			if (!$subject) {
57
+							$subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]);
58
+			}
58 59
 
59 60
 			$tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"]));
60 61
 			$tpl->setVariable('ARTICLE_URL', strip_tags($line["link"]));
Please login to merge, or discard this patch.
plugins/toggle_sidebar/init.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 	}
17 17
 
18 18
 	function get_js() {
19
-		return file_get_contents(__DIR__ . "/init.js");
19
+		return file_get_contents(__DIR__."/init.js");
20 20
 	}
21 21
 
22 22
 	function hook_main_toolbar_button() {
Please login to merge, or discard this patch.
plugins/note/init.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 	}
18 18
 
19 19
 	function get_js() {
20
-		return file_get_contents(dirname(__FILE__) . "/note.js");
20
+		return file_get_contents(dirname(__FILE__)."/note.js");
21 21
 	}
22 22
 
23 23
 
Please login to merge, or discard this patch.
plugins/af_fsckportal/init.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 
20 20
 			$doc = new DOMDocument();
21 21
 
22
-			@$doc->loadHTML('<?xml encoding="UTF-8">' . $article["content"]);
22
+			@$doc->loadHTML('<?xml encoding="UTF-8">'.$article["content"]);
23 23
 
24 24
 			if ($doc) {
25 25
 				$xpath = new DOMXPath($doc);
Please login to merge, or discard this patch.
plugins/af_zz_noautoplay/init.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	function get_js() {
16
-		return file_get_contents(__DIR__ . "/init.js");
16
+		return file_get_contents(__DIR__."/init.js");
17 17
 	}
18 18
 
19 19
 	function api_version() {
Please login to merge, or discard this patch.
classes/db.php 3 patches
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
 		$er = error_reporting(E_ALL);
25 25
 
26 26
 		switch (DB_TYPE) {
27
-			case "mysql":
28
-				$this->adapter = new Db_Mysqli();
29
-				break;
30
-			case "pgsql":
31
-				$this->adapter = new Db_Pgsql();
32
-				break;
33
-			default:
34
-				die("Unknown DB_TYPE: " . DB_TYPE);
27
+		case "mysql":
28
+			$this->adapter = new Db_Mysqli();
29
+			break;
30
+		case "pgsql":
31
+			$this->adapter = new Db_Pgsql();
32
+			break;
33
+		default:
34
+			die("Unknown DB_TYPE: " . DB_TYPE);
35 35
 		}
36 36
 
37 37
 		if (!$this->adapter) {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 	private function legacy_connect() {
21 21
 
22
-		user_error("Legacy connect requested to " . DB_TYPE, E_USER_NOTICE);
22
+		user_error("Legacy connect requested to ".DB_TYPE, E_USER_NOTICE);
23 23
 
24 24
 		$er = error_reporting(E_ALL);
25 25
 
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
31 31
 				$this->adapter = new Db_Pgsql();
32 32
 				break;
33 33
 			default:
34
-				die("Unknown DB_TYPE: " . DB_TYPE);
34
+				die("Unknown DB_TYPE: ".DB_TYPE);
35 35
 		}
36 36
 
37 37
 		if (!$this->adapter) {
38
-			print("Error initializing database adapter for " . DB_TYPE);
38
+			print("Error initializing database adapter for ".DB_TYPE);
39 39
 			exit(100);
40 40
 		}
41 41
 
42 42
 		$this->link = $this->adapter->connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, defined('DB_PORT') ? DB_PORT : "");
43 43
 
44 44
 		if (!$this->link) {
45
-			print("Error connecting through adapter: " . $this->adapter->last_error());
45
+			print("Error connecting through adapter: ".$this->adapter->last_error());
46 46
 			exit(101);
47 47
 		}
48 48
 
@@ -53,15 +53,15 @@  discard block
 block discarded – undo
53 53
 	// normal usage is Db::pdo()->prepare(...) etc
54 54
 	public function pdo_connect() {
55 55
 
56
-		$db_port = defined('DB_PORT') && DB_PORT ? ';port=' . DB_PORT : '';
57
-		$db_host = defined('DB_HOST') && DB_HOST ? ';host=' . DB_HOST : '';
56
+		$db_port = defined('DB_PORT') && DB_PORT ? ';port='.DB_PORT : '';
57
+		$db_host = defined('DB_HOST') && DB_HOST ? ';host='.DB_HOST : '';
58 58
 
59 59
 		try {
60
-			$pdo = new PDO(DB_TYPE . ':dbname=' . DB_NAME . $db_host . $db_port,
60
+			$pdo = new PDO(DB_TYPE.':dbname='.DB_NAME.$db_host.$db_port,
61 61
 				DB_USER,
62 62
 				DB_PASS);
63 63
 		} catch (Exception $e) {
64
-			print "<pre>Exception while creating PDO object:" . $e->getMessage() . "</pre>";
64
+			print "<pre>Exception while creating PDO object:".$e->getMessage()."</pre>";
65 65
 			exit(101);
66 66
 		}
67 67
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			$pdo->query("SET time_zone = '+0:0'");
79 79
 
80 80
 			if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) {
81
-				$pdo->query("SET NAMES " . MYSQL_CHARSET);
81
+				$pdo->query("SET NAMES ".MYSQL_CHARSET);
82 82
 			}
83 83
 		}
84 84
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -86,15 +86,17 @@  discard block
 block discarded – undo
86 86
 	}
87 87
 
88 88
 	public static function instance() {
89
-		if (self::$instance == null)
90
-			self::$instance = new self();
89
+		if (self::$instance == null) {
90
+					self::$instance = new self();
91
+		}
91 92
 
92 93
 		return self::$instance;
93 94
 	}
94 95
 
95 96
 	public static function get() {
96
-		if (self::$instance == null)
97
-			self::$instance = new self();
97
+		if (self::$instance == null) {
98
+					self::$instance = new self();
99
+		}
98 100
 
99 101
 		if (!self::$instance->adapter) {
100 102
 			self::$instance->legacy_connect();
@@ -104,8 +106,9 @@  discard block
 block discarded – undo
104 106
 	}
105 107
 
106 108
 	public static function pdo() {
107
-		if (self::$instance == null)
108
-			self::$instance = new self();
109
+		if (self::$instance == null) {
110
+					self::$instance = new self();
111
+		}
109 112
 
110 113
 		if (!self::$instance->pdo) {
111 114
 			self::$instance->pdo = self::$instance->pdo_connect();
Please login to merge, or discard this patch.