@@ -5,8 +5,9 @@ discard block |
||
5 | 5 | $namespace = ''; |
6 | 6 | $class_name = $class; |
7 | 7 | |
8 | - if (strpos($class, '\\') !== FALSE) |
|
9 | - list ($namespace, $class_name) = explode('\\', $class, 2); |
|
8 | + if (strpos($class, '\\') !== FALSE) { |
|
9 | + list ($namespace, $class_name) = explode('\\', $class, 2); |
|
10 | + } |
|
10 | 11 | |
11 | 12 | $root_dir = dirname(__DIR__); // we're in tt-rss/include |
12 | 13 | |
@@ -20,7 +21,8 @@ discard block |
||
20 | 21 | $class_file = "$root_dir/classes/" . str_replace("_", "/", strtolower($class)) . ".php"; |
21 | 22 | } |
22 | 23 | |
23 | - if (file_exists($class_file)) |
|
24 | - include $class_file; |
|
24 | + if (file_exists($class_file)) { |
|
25 | + include $class_file; |
|
26 | + } |
|
25 | 27 | |
26 | 28 | }); |
@@ -86,15 +86,17 @@ discard block |
||
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 |
||
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(); |
@@ -19,8 +19,9 @@ discard block |
||
19 | 19 | $from_combined = $from_name ? "$from_name <$from_address>" : $from_address; |
20 | 20 | $to_combined = $to_name ? "$to_name <$to_address>" : $to_address; |
21 | 21 | |
22 | - if (defined('_LOG_SENT_MAIL') && _LOG_SENT_MAIL) |
|
23 | - Logger::get()->log("Sending mail from $from_combined to $to_combined [$subject]: $message"); |
|
22 | + if (defined('_LOG_SENT_MAIL') && _LOG_SENT_MAIL) { |
|
23 | + Logger::get()->log("Sending mail from $from_combined to $to_combined [$subject]: $message"); |
|
24 | + } |
|
24 | 25 | |
25 | 26 | // HOOK_SEND_MAIL plugin instructions: |
26 | 27 | // 1. return 1 or true if mail is handled |
@@ -31,11 +32,13 @@ discard block |
||
31 | 32 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEND_MAIL) as $p) { |
32 | 33 | $rc = $p->hook_send_mail($this, $params); |
33 | 34 | |
34 | - if ($rc == 1) |
|
35 | - return $rc; |
|
35 | + if ($rc == 1) { |
|
36 | + return $rc; |
|
37 | + } |
|
36 | 38 | |
37 | - if ($rc == -1) |
|
38 | - return 0; |
|
39 | + if ($rc == -1) { |
|
40 | + return 0; |
|
41 | + } |
|
39 | 42 | } |
40 | 43 | |
41 | 44 | $headers = [ "From: $from_combined", "Content-Type: text/plain; charset=UTF-8" ]; |
@@ -43,10 +43,11 @@ discard block |
||
43 | 43 | || $link->getAttribute("rel") == "standout")) { |
44 | 44 | $base = $this->xpath->evaluate("string(ancestor-or-self::*[@xml:base][1]/@xml:base)", $link); |
45 | 45 | |
46 | - if ($base) |
|
47 | - return rewrite_relative_url($base, clean(trim($link->getAttribute("href")))); |
|
48 | - else |
|
49 | - return clean(trim($link->getAttribute("href"))); |
|
46 | + if ($base) { |
|
47 | + return rewrite_relative_url($base, clean(trim($link->getAttribute("href")))); |
|
48 | + } else { |
|
49 | + return clean(trim($link->getAttribute("href"))); |
|
50 | + } |
|
50 | 51 | |
51 | 52 | } |
52 | 53 | } |
@@ -106,8 +107,9 @@ discard block |
||
106 | 107 | $cats = []; |
107 | 108 | |
108 | 109 | foreach ($categories as $cat) { |
109 | - if ($cat->hasAttribute("term")) |
|
110 | - array_push($cats, $cat->getAttribute("term")); |
|
110 | + if ($cat->hasAttribute("term")) { |
|
111 | + array_push($cats, $cat->getAttribute("term")); |
|
112 | + } |
|
111 | 113 | } |
112 | 114 | |
113 | 115 | $categories = $this->xpath->query("dc:subject", $this->elem); |
@@ -95,10 +95,11 @@ discard block |
||
95 | 95 | |
96 | 96 | $count = getFeedUnread($i); |
97 | 97 | |
98 | - if ($i == 0 || $i == -1 || $i == -2) |
|
99 | - $auxctr = Feeds::getFeedArticles($i, false); |
|
100 | - else |
|
101 | - $auxctr = 0; |
|
98 | + if ($i == 0 || $i == -1 || $i == -2) { |
|
99 | + $auxctr = Feeds::getFeedArticles($i, false); |
|
100 | + } else { |
|
101 | + $auxctr = 0; |
|
102 | + } |
|
102 | 103 | |
103 | 104 | $cv = array("id" => $i, |
104 | 105 | "counter" => (int) $count, |
@@ -117,8 +118,9 @@ discard block |
||
117 | 118 | $cv = array("id" => PluginHost::pfeed_to_feed_id($feed['id']), |
118 | 119 | "counter" => $feed['sender']->get_unread($feed['id'])); |
119 | 120 | |
120 | - if (method_exists($feed['sender'], 'get_total')) |
|
121 | - $cv["auxcounter"] = $feed['sender']->get_total($feed['id']); |
|
121 | + if (method_exists($feed['sender'], 'get_total')) { |
|
122 | + $cv["auxcounter"] = $feed['sender']->get_total($feed['id']); |
|
123 | + } |
|
122 | 124 | |
123 | 125 | array_push($ret_arr, $cv); |
124 | 126 | } |
@@ -150,8 +152,9 @@ discard block |
||
150 | 152 | "counter" => (int) $line["unread"], |
151 | 153 | "auxcounter" => (int) $line["total"]); |
152 | 154 | |
153 | - if ($descriptions) |
|
154 | - $cv["description"] = $line["caption"]; |
|
155 | + if ($descriptions) { |
|
156 | + $cv["description"] = $line["caption"]; |
|
157 | + } |
|
155 | 158 | |
156 | 159 | array_push($ret_arr, $cv); |
157 | 160 | } |
@@ -189,22 +192,25 @@ discard block |
||
189 | 192 | $has_img = false; |
190 | 193 | } |
191 | 194 | |
192 | - if (date('Y') - date('Y', strtotime($line['last_updated'])) > 2) |
|
193 | - $last_updated = ''; |
|
195 | + if (date('Y') - date('Y', strtotime($line['last_updated'])) > 2) { |
|
196 | + $last_updated = ''; |
|
197 | + } |
|
194 | 198 | |
195 | 199 | $cv = array("id" => $id, |
196 | 200 | "updated" => $last_updated, |
197 | 201 | "counter" => (int) $count, |
198 | 202 | "has_img" => (int) $has_img); |
199 | 203 | |
200 | - if ($last_error) |
|
201 | - $cv["error"] = $last_error; |
|
204 | + if ($last_error) { |
|
205 | + $cv["error"] = $last_error; |
|
206 | + } |
|
202 | 207 | |
203 | 208 | // if (get_pref('EXTENDED_FEEDLIST')) |
204 | 209 | // $cv["xmsg"] = getFeedArticles($id)." ".__("total"); |
205 | 210 | |
206 | - if ($active_feed && $id == $active_feed) |
|
207 | - $cv["title"] = truncate_string($line["title"], 30); |
|
211 | + if ($active_feed && $id == $active_feed) { |
|
212 | + $cv["title"] = truncate_string($line["title"], 30); |
|
213 | + } |
|
208 | 214 | |
209 | 215 | array_push($ret_arr, $cv); |
210 | 216 |
@@ -43,10 +43,11 @@ |
||
43 | 43 | foreach ($lines as $line) { |
44 | 44 | if (strpos($line, "--") !== 0 && $line) { |
45 | 45 | |
46 | - if ($html_output) |
|
47 | - print "<pre>$line</pre>"; |
|
48 | - else |
|
49 | - Debug::log("> $line"); |
|
46 | + if ($html_output) { |
|
47 | + print "<pre>$line</pre>"; |
|
48 | + } else { |
|
49 | + Debug::log("> $line"); |
|
50 | + } |
|
50 | 51 | |
51 | 52 | try { |
52 | 53 | $this->pdo->query($line); // PDO returns errors as exceptions now |
@@ -24,13 +24,15 @@ discard block |
||
24 | 24 | $r = ord($str[2]); |
25 | 25 | if (strlen($str) > 3) { |
26 | 26 | $a = 127 - (ord($str[3]) / 2); |
27 | - if ($a != 0 && $a != 127) |
|
28 | - $this->had_alpha = 1; |
|
27 | + if ($a != 0 && $a != 127) { |
|
28 | + $this->had_alpha = 1; |
|
29 | + } |
|
29 | 30 | } else { |
30 | 31 | $a = 0; |
31 | 32 | } |
32 | - if ($a != 127) |
|
33 | - $this->all_transaprent = 0; |
|
33 | + if ($a != 127) { |
|
34 | + $this->all_transaprent = 0; |
|
35 | + } |
|
34 | 36 | return imagecolorallocatealpha($img, $r, $g, $b, $a); |
35 | 37 | } |
36 | 38 | |
@@ -65,8 +67,9 @@ discard block |
||
65 | 67 | $most_pixels = 0; |
66 | 68 | for ($i = 0; $i < $h["num"]; $i++) { |
67 | 69 | $entry = substr($ico, 6 + 16 * $i, 16); |
68 | - if (!$entry || strlen($entry) < 16) |
|
69 | - continue; |
|
70 | + if (!$entry || strlen($entry) < 16) { |
|
71 | + continue; |
|
72 | + } |
|
70 | 73 | $e = unpack("Cwidth/" . |
71 | 74 | "Cheight/" . |
72 | 75 | "Ccolors/" . |
@@ -76,10 +79,12 @@ discard block |
||
76 | 79 | "Vsize/" . |
77 | 80 | "Voffset/", |
78 | 81 | $entry); |
79 | - if ($e["width"] == 0) |
|
80 | - $e["width"] = 256; |
|
81 | - if ($e["height"] == 0) |
|
82 | - $e["height"] = 256; |
|
82 | + if ($e["width"] == 0) { |
|
83 | + $e["width"] = 256; |
|
84 | + } |
|
85 | + if ($e["height"] == 0) { |
|
86 | + $e["height"] = 256; |
|
87 | + } |
|
83 | 88 | if ($e["zero"] != 0) { |
84 | 89 | $this->error = "nonzero reserved field"; |
85 | 90 | return false; |
@@ -226,8 +231,9 @@ discard block |
||
226 | 231 | } |
227 | 232 | } |
228 | 233 | // End of row padding |
229 | - while ($offset & 3) |
|
230 | - $offset++; |
|
234 | + while ($offset & 3) { |
|
235 | + $offset++; |
|
236 | + } |
|
231 | 237 | } |
232 | 238 | |
233 | 239 | // Now the "AND" image, which is 1 bit per pixel. Ignore |
@@ -261,8 +267,9 @@ discard block |
||
261 | 267 | } |
262 | 268 | |
263 | 269 | // End of row padding |
264 | - while ($offset & 3) |
|
265 | - $offset++; |
|
270 | + while ($offset & 3) { |
|
271 | + $offset++; |
|
272 | + } |
|
266 | 273 | } |
267 | 274 | return $img; |
268 | 275 | } |
@@ -108,13 +108,15 @@ discard block |
||
108 | 108 | //---------------------------------------------------------------------- |
109 | 109 | public function appendNum($bits, $num) |
110 | 110 | { |
111 | - if ($bits == 0) |
|
112 | - return 0; |
|
111 | + if ($bits == 0) { |
|
112 | + return 0; |
|
113 | + } |
|
113 | 114 | |
114 | 115 | $b = QRbitstream::newFromNum($bits, $num); |
115 | 116 | |
116 | - if(is_null($b)) |
|
117 | - return -1; |
|
117 | + if(is_null($b)) { |
|
118 | + return -1; |
|
119 | + } |
|
118 | 120 | |
119 | 121 | $ret = $this->append($b); |
120 | 122 | unset($b); |
@@ -125,13 +127,15 @@ discard block |
||
125 | 127 | //---------------------------------------------------------------------- |
126 | 128 | public function appendBytes($size, $data) |
127 | 129 | { |
128 | - if ($size == 0) |
|
129 | - return 0; |
|
130 | + if ($size == 0) { |
|
131 | + return 0; |
|
132 | + } |
|
130 | 133 | |
131 | 134 | $b = QRbitstream::newFromBytes($size, $data); |
132 | 135 | |
133 | - if(is_null($b)) |
|
134 | - return -1; |
|
136 | + if(is_null($b)) { |
|
137 | + return -1; |
|
138 | + } |
|
135 | 139 | |
136 | 140 | $ret = $this->append($b); |
137 | 141 | unset($b); |
@@ -115,8 +115,9 @@ discard block |
||
115 | 115 | |
116 | 116 | for($i=1; $i<= QRSPEC_VERSION_MAX; $i++) { |
117 | 117 | $words = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level]; |
118 | - if($words >= $size) |
|
119 | - return $i; |
|
118 | + if($words >= $size) { |
|
119 | + return $i; |
|
120 | + } |
|
120 | 121 | } |
121 | 122 | |
122 | 123 | return -1; |
@@ -134,8 +135,9 @@ discard block |
||
134 | 135 | //---------------------------------------------------------------------- |
135 | 136 | public static function lengthIndicator($mode, $version) |
136 | 137 | { |
137 | - if ($mode == QR_MODE_STRUCTURE) |
|
138 | - return 0; |
|
138 | + if ($mode == QR_MODE_STRUCTURE) { |
|
139 | + return 0; |
|
140 | + } |
|
139 | 141 | |
140 | 142 | if ($version <= 9) { |
141 | 143 | $l = 0; |
@@ -151,8 +153,9 @@ discard block |
||
151 | 153 | //---------------------------------------------------------------------- |
152 | 154 | public static function maximumWords($mode, $version) |
153 | 155 | { |
154 | - if($mode == QR_MODE_STRUCTURE) |
|
155 | - return 3; |
|
156 | + if($mode == QR_MODE_STRUCTURE) { |
|
157 | + return 3; |
|
158 | + } |
|
156 | 159 | |
157 | 160 | if($version <= 9) { |
158 | 161 | $l = 0; |
@@ -298,8 +301,9 @@ discard block |
||
298 | 301 | //---------------------------------------------------------------------- |
299 | 302 | public static function putAlignmentPattern($version, &$frame, $width) |
300 | 303 | { |
301 | - if($version < 2) |
|
302 | - return; |
|
304 | + if($version < 2) { |
|
305 | + return; |
|
306 | + } |
|
303 | 307 | |
304 | 308 | $d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0]; |
305 | 309 | if($d < 0) { |
@@ -351,8 +355,9 @@ discard block |
||
351 | 355 | //---------------------------------------------------------------------- |
352 | 356 | public static function getVersionPattern($version) |
353 | 357 | { |
354 | - if($version < 7 || $version > QRSPEC_VERSION_MAX) |
|
355 | - return 0; |
|
358 | + if($version < 7 || $version > QRSPEC_VERSION_MAX) { |
|
359 | + return 0; |
|
360 | + } |
|
356 | 361 | |
357 | 362 | return self::$versionPattern[$version -7]; |
358 | 363 | } |
@@ -369,11 +374,13 @@ discard block |
||
369 | 374 | |
370 | 375 | public static function getFormatInfo($mask, $level) |
371 | 376 | { |
372 | - if($mask < 0 || $mask > 7) |
|
373 | - return 0; |
|
377 | + if($mask < 0 || $mask > 7) { |
|
378 | + return 0; |
|
379 | + } |
|
374 | 380 | |
375 | - if($level < 0 || $level > 3) |
|
376 | - return 0; |
|
381 | + if($level < 0 || $level > 3) { |
|
382 | + return 0; |
|
383 | + } |
|
377 | 384 | |
378 | 385 | return self::$formatInfo[$level][$mask]; |
379 | 386 | } |
@@ -553,8 +560,9 @@ discard block |
||
553 | 560 | //---------------------------------------------------------------------- |
554 | 561 | public static function newFrame($version) |
555 | 562 | { |
556 | - if($version < 1 || $version > QRSPEC_VERSION_MAX) |
|
557 | - return null; |
|
563 | + if($version < 1 || $version > QRSPEC_VERSION_MAX) { |
|
564 | + return null; |
|
565 | + } |
|
558 | 566 | |
559 | 567 | if(!isset(self::$frames[$version])) { |
560 | 568 | |
@@ -572,8 +580,9 @@ discard block |
||
572 | 580 | } |
573 | 581 | } |
574 | 582 | |
575 | - if(is_null(self::$frames[$version])) |
|
576 | - return null; |
|
583 | + if(is_null(self::$frames[$version])) { |
|
584 | + return null; |
|
585 | + } |
|
577 | 586 | |
578 | 587 | return self::$frames[$version]; |
579 | 588 | } |