@@ -23,8 +23,9 @@ |
||
23 | 23 | $entries = $xpath->query('//iframe'); |
24 | 24 | |
25 | 25 | foreach ($entries as $entry) { |
26 | - if (!iframe_whitelisted($entry)) |
|
27 | - $entry->parentNode->removeChild($entry); |
|
26 | + if (!iframe_whitelisted($entry)) { |
|
27 | + $entry->parentNode->removeChild($entry); |
|
28 | + } |
|
28 | 29 | } |
29 | 30 | |
30 | 31 | return array($doc, $allowed_elements, $disallowed_attributes); |
@@ -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) { |
@@ -17,8 +17,9 @@ |
||
17 | 17 | false, false, 0, |
18 | 18 | "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0"); |
19 | 19 | |
20 | - if (!$res && $fetch_last_error_content) |
|
21 | - $res = $fetch_last_error_content; |
|
20 | + if (!$res && $fetch_last_error_content) { |
|
21 | + $res = $fetch_last_error_content; |
|
22 | + } |
|
22 | 23 | |
23 | 24 | if (@$doc->loadHTML($res)) { |
24 | 25 | $xpath = new DOMXPath($doc); |
@@ -12,7 +12,9 @@ |
||
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 |
@@ -17,11 +17,13 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -53,8 +53,9 @@ |
||
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"])); |
@@ -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(); |