@@ -22,8 +22,9 @@ |
||
22 | 22 | |
23 | 23 | function hook_article_filter($article) { |
24 | 24 | |
25 | - if (!function_exists("curl_init") || ini_get("open_basedir")) |
|
26 | - return $article; |
|
25 | + if (!function_exists("curl_init") || ini_get("open_basedir")) { |
|
26 | + return $article; |
|
27 | + } |
|
27 | 28 | |
28 | 29 | $doc = new DOMDocument(); |
29 | 30 | $doc->loadHTML('<?xml encoding="UTF-8">' . $article["content"]); |
@@ -200,13 +200,17 @@ |
||
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | - if ($need_saving) $article["content"] = $doc->saveHTML(); |
|
203 | + if ($need_saving) { |
|
204 | + $article["content"] = $doc->saveHTML(); |
|
205 | + } |
|
204 | 206 | |
205 | 207 | return $article; |
206 | 208 | } |
207 | 209 | |
208 | 210 | function hook_prefs_tab($args) { |
209 | - if ($args != "prefFeeds") return; |
|
211 | + if ($args != "prefFeeds") { |
|
212 | + return; |
|
213 | + } |
|
210 | 214 | |
211 | 215 | print "<div dojoType=\"dijit.layout.AccordionPane\" |
212 | 216 | title=\"<i class='material-icons'>extension</i> ".__('Image proxy settings (af_proxy_http)')."\">"; |
@@ -30,7 +30,9 @@ discard block |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | function hook_prefs_tab($args) { |
33 | - if ($args != "prefPrefs") return; |
|
33 | + if ($args != "prefPrefs") { |
|
34 | + return; |
|
35 | + } |
|
34 | 36 | |
35 | 37 | print "<div dojoType=\"dijit.layout.AccordionPane\" |
36 | 38 | title=\"<i class='material-icons'>mail</i> ".__('Mail plugin')."\">"; |
@@ -94,7 +96,9 @@ discard block |
||
94 | 96 | $user_name = htmlspecialchars($row['full_name']); |
95 | 97 | } |
96 | 98 | |
97 | - if (!$user_name) $user_name = $_SESSION['name']; |
|
99 | + if (!$user_name) { |
|
100 | + $user_name = $_SESSION['name']; |
|
101 | + } |
|
98 | 102 | |
99 | 103 | print_hidden("from_email", "$user_email"); |
100 | 104 | print_hidden("from_name", "$user_name"); |
@@ -120,8 +124,9 @@ discard block |
||
120 | 124 | |
121 | 125 | while ($line = $sth->fetch()) { |
122 | 126 | |
123 | - if (!$subject) |
|
124 | - $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]); |
|
127 | + if (!$subject) { |
|
128 | + $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]); |
|
129 | + } |
|
125 | 130 | |
126 | 131 | $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"])); |
127 | 132 | $tnote = strip_tags($line["note"]); |
@@ -47,7 +47,9 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | function hook_prefs_tab($args) { |
50 | - if ($args != "prefFeeds") return; |
|
50 | + if ($args != "prefFeeds") { |
|
51 | + return; |
|
52 | + } |
|
51 | 53 | |
52 | 54 | print "<div dojoType='dijit.layout.AccordionPane' |
53 | 55 | title=\"<i class='material-icons'>extension</i> ".__('Readability settings (af_readability)')."\">"; |
@@ -93,7 +95,9 @@ discard block |
||
93 | 95 | print "</form>"; |
94 | 96 | |
95 | 97 | $enabled_feeds = $this->host->get($this, "enabled_feeds"); |
96 | - if (!is_array($enabled_feeds)) $enabled_feeds = array(); |
|
98 | + if (!is_array($enabled_feeds)) { |
|
99 | + $enabled_feeds = array(); |
|
100 | + } |
|
97 | 101 | |
98 | 102 | $enabled_feeds = $this->filter_unknown_feeds($enabled_feeds); |
99 | 103 | $this->host->set($this, "enabled_feeds", $enabled_feeds); |
@@ -120,7 +124,9 @@ discard block |
||
120 | 124 | print "<section>"; |
121 | 125 | |
122 | 126 | $enabled_feeds = $this->host->get($this, "enabled_feeds"); |
123 | - if (!is_array($enabled_feeds)) $enabled_feeds = array(); |
|
127 | + if (!is_array($enabled_feeds)) { |
|
128 | + $enabled_feeds = array(); |
|
129 | + } |
|
124 | 130 | |
125 | 131 | $key = array_search($feed_id, $enabled_feeds); |
126 | 132 | $checked = $key !== FALSE ? "checked" : ""; |
@@ -137,7 +143,9 @@ discard block |
||
137 | 143 | |
138 | 144 | function hook_prefs_save_feed($feed_id) { |
139 | 145 | $enabled_feeds = $this->host->get($this, "enabled_feeds"); |
140 | - if (!is_array($enabled_feeds)) $enabled_feeds = array(); |
|
146 | + if (!is_array($enabled_feeds)) { |
|
147 | + $enabled_feeds = array(); |
|
148 | + } |
|
141 | 149 | |
142 | 150 | $enable = checkbox_to_sql_bool($_POST["af_readability_enabled"]); |
143 | 151 | $key = array_search($feed_id, $enabled_feeds); |
@@ -174,8 +182,9 @@ discard block |
||
174 | 182 | if ($tmp && mb_strlen($tmp) < 1024 * 500) { |
175 | 183 | $tmpdoc = new DOMDocument("1.0", "UTF-8"); |
176 | 184 | |
177 | - if (!@$tmpdoc->loadHTML($tmp)) |
|
178 | - return false; |
|
185 | + if (!@$tmpdoc->loadHTML($tmp)) { |
|
186 | + return false; |
|
187 | + } |
|
179 | 188 | |
180 | 189 | // this is the worst hack yet :( |
181 | 190 | if (strtolower($tmpdoc->encoding) != 'utf-8') { |
@@ -237,10 +246,14 @@ discard block |
||
237 | 246 | function hook_article_filter($article) { |
238 | 247 | |
239 | 248 | $enabled_feeds = $this->host->get($this, "enabled_feeds"); |
240 | - if (!is_array($enabled_feeds)) return $article; |
|
249 | + if (!is_array($enabled_feeds)) { |
|
250 | + return $article; |
|
251 | + } |
|
241 | 252 | |
242 | 253 | $key = array_search($article["feed"]["id"], $enabled_feeds); |
243 | - if ($key === FALSE) return $article; |
|
254 | + if ($key === FALSE) { |
|
255 | + return $article; |
|
256 | + } |
|
244 | 257 | |
245 | 258 | return $this->process_article($article); |
246 | 259 |
@@ -22,7 +22,9 @@ discard block |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | function hook_prefs_tab($args) { |
25 | - if ($args != "prefFeeds") return; |
|
25 | + if ($args != "prefFeeds") { |
|
26 | + return; |
|
27 | + } |
|
26 | 28 | |
27 | 29 | print "<div dojoType=\"dijit.layout.AccordionPane\" |
28 | 30 | title=\"<i class='material-icons'>extension</i> ".__('Reddit content settings (af_redditimgur)')."\">"; |
@@ -173,8 +175,7 @@ discard block |
||
173 | 175 | if ($child["data"]["url"] == $matches[0]) { |
174 | 176 | try { |
175 | 177 | $source_stream = $child["data"]["media"]["reddit_video"]["fallback_url"]; |
176 | - } |
|
177 | - catch (Exception $e) { |
|
178 | + } catch (Exception $e) { |
|
178 | 179 | } |
179 | 180 | break 2; |
180 | 181 | } |
@@ -230,8 +231,9 @@ discard block |
||
230 | 231 | |
231 | 232 | $source_stream = str_replace(".gifv", ".mp4", $entry->getAttribute("href")); |
232 | 233 | |
233 | - if (strpos($source_stream, "imgur.com") !== FALSE) |
|
234 | - $poster_url = str_replace(".mp4", "h.jpg", $source_stream); |
|
234 | + if (strpos($source_stream, "imgur.com") !== FALSE) { |
|
235 | + $poster_url = str_replace(".mp4", "h.jpg", $source_stream); |
|
236 | + } |
|
235 | 237 | |
236 | 238 | $this->handle_as_video($doc, $entry, $source_stream, $poster_url); |
237 | 239 | |
@@ -426,7 +428,9 @@ discard block |
||
426 | 428 | if ($row = $sth->fetch()) { |
427 | 429 | $num_found = $row['cid']; |
428 | 430 | |
429 | - if ($num_found > 0) $article["force_catchup"] = true; |
|
431 | + if ($num_found > 0) { |
|
432 | + $article["force_catchup"] = true; |
|
433 | + } |
|
430 | 434 | } |
431 | 435 | } |
432 | 436 | } |
@@ -458,7 +462,9 @@ discard block |
||
458 | 462 | $video->setAttribute("controls", "1"); |
459 | 463 | $video->setAttribute("loop", "1"); |
460 | 464 | |
461 | - if ($poster_url) $video->setAttribute("poster", $poster_url); |
|
465 | + if ($poster_url) { |
|
466 | + $video->setAttribute("poster", $poster_url); |
|
467 | + } |
|
462 | 468 | |
463 | 469 | $source = $doc->createElement('source'); |
464 | 470 | $source->setAttribute("src", $source_stream); |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | function hook_prefs_tab($args) { |
48 | - if ($args != "prefFeeds") return; |
|
48 | + if ($args != "prefFeeds") { |
|
49 | + return; |
|
50 | + } |
|
49 | 51 | |
50 | 52 | print "<div dojoType=\"dijit.layout.AccordionPane\" |
51 | 53 | title=\"<i class='material-icons'>photo</i> ".__('Feeds supported by af_comics')."\">"; |
@@ -77,8 +79,9 @@ discard block |
||
77 | 79 | |
78 | 80 | function hook_article_filter($article) { |
79 | 81 | foreach ($this->filters as $f) { |
80 | - if ($f->process($article)) |
|
81 | - break; |
|
82 | + if ($f->process($article)) { |
|
83 | + break; |
|
84 | + } |
|
82 | 85 | } |
83 | 86 | |
84 | 87 | return $article; |
@@ -89,8 +92,9 @@ discard block |
||
89 | 92 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
90 | 93 | */ |
91 | 94 | function hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed, $last_article_timestamp, $auth_login, $auth_pass) { |
92 | - if ($auth_login || $auth_pass) |
|
93 | - return $feed_data; |
|
95 | + if ($auth_login || $auth_pass) { |
|
96 | + return $feed_data; |
|
97 | + } |
|
94 | 98 | |
95 | 99 | if (preg_match('#^https?://(?:feeds\.feedburner\.com/uclick|www\.gocomics\.com)/([-a-z0-9]+)$#i', $fetch_url, $comic)) { |
96 | 100 | $site_url = 'https://www.gocomics.com/' . $comic[1]; |
@@ -153,29 +157,35 @@ discard block |
||
153 | 157 | |
154 | 158 | $tpl->addBlock('feed'); |
155 | 159 | |
156 | - if ($tpl->generateOutputToString($tmp_data)) |
|
157 | - $feed_data = $tmp_data; |
|
160 | + if ($tpl->generateOutputToString($tmp_data)) { |
|
161 | + $feed_data = $tmp_data; |
|
162 | + } |
|
158 | 163 | } |
159 | 164 | |
160 | 165 | return $feed_data; |
161 | 166 | } |
162 | 167 | |
163 | 168 | function hook_subscribe_feed($contents, $url, $auth_login, $auth_pass) { |
164 | - if ($auth_login || $auth_pass) |
|
165 | - return $contents; |
|
169 | + if ($auth_login || $auth_pass) { |
|
170 | + return $contents; |
|
171 | + } |
|
166 | 172 | |
167 | - if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $url)) |
|
168 | - return '<?xml version="1.0" encoding="utf-8"?>'; // Get is_html() to return false. |
|
173 | + if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $url)) { |
|
174 | + return '<?xml version="1.0" encoding="utf-8"?>'; |
|
175 | + } |
|
176 | + // Get is_html() to return false. |
|
169 | 177 | |
170 | 178 | return $contents; |
171 | 179 | } |
172 | 180 | |
173 | 181 | function hook_feed_basic_info($basic_info, $fetch_url, $owner_uid, $feed, $auth_login, $auth_pass) { |
174 | - if ($auth_login || $auth_pass) |
|
175 | - return $basic_info; |
|
182 | + if ($auth_login || $auth_pass) { |
|
183 | + return $basic_info; |
|
184 | + } |
|
176 | 185 | |
177 | - if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $fetch_url, $matches)) |
|
178 | - $basic_info = array('title' => ucfirst($matches[1]), 'site_url' => $matches[0]); |
|
186 | + if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $fetch_url, $matches)) { |
|
187 | + $basic_info = array('title' => ucfirst($matches[1]), 'site_url' => $matches[0]); |
|
188 | + } |
|
179 | 189 | |
180 | 190 | return $basic_info; |
181 | 191 | } |
@@ -14,8 +14,9 @@ |
||
14 | 14 | |
15 | 15 | global $fetch_last_error_content; |
16 | 16 | |
17 | - if (!$res && $fetch_last_error_content) |
|
18 | - $res = $fetch_last_error_content; |
|
17 | + if (!$res && $fetch_last_error_content) { |
|
18 | + $res = $fetch_last_error_content; |
|
19 | + } |
|
19 | 20 | |
20 | 21 | $doc = new DOMDocument(); |
21 | 22 |
@@ -15,8 +15,9 @@ |
||
15 | 15 | |
16 | 16 | global $fetch_last_error_content; |
17 | 17 | |
18 | - if (!$res && $fetch_last_error_content) |
|
19 | - $res = $fetch_last_error_content; |
|
18 | + if (!$res && $fetch_last_error_content) { |
|
19 | + $res = $fetch_last_error_content; |
|
20 | + } |
|
20 | 21 | |
21 | 22 | $doc = new DOMDocument(); |
22 | 23 |
@@ -46,8 +46,9 @@ |
||
46 | 46 | |
47 | 47 | $avatar = $xpath->query('(//div[@class="avatar"]//img)')->item(0); |
48 | 48 | |
49 | - if ($basenode) |
|
50 | - $basenode->insertBefore($avatar, $basenode->firstChild); |
|
49 | + if ($basenode) { |
|
50 | + $basenode->insertBefore($avatar, $basenode->firstChild); |
|
51 | + } |
|
51 | 52 | |
52 | 53 | $uninteresting = $xpath->query('(//div[@class="avatar"])'); |
53 | 54 | foreach ($uninteresting as $i) { |