@@ -45,7 +45,8 @@ |
||
45 | 45 | |
46 | 46 | $content = $this->get_content($fullURL); |
47 | 47 | $data = $content['body']; |
48 | - if($data !== 'Can\'t find the manga series.') { //FIXME: We should check for he proper error here. |
|
48 | + if($data !== 'Can\'t find the manga series.') { |
|
49 | +//FIXME: We should check for he proper error here. |
|
49 | 50 | $xml = simplexml_load_string($data); |
50 | 51 | if($xml) { |
51 | 52 | if(isset($xml->{'channel'}->item[0])) { |
@@ -114,11 +114,15 @@ |
||
114 | 114 | |
115 | 115 | if($sortOrder == 'asc') { |
116 | 116 | $unreadSort = ($a_text <=> $b_text); |
117 | - if($unreadSort) return $unreadSort; |
|
117 | + if($unreadSort) { |
|
118 | + return $unreadSort; |
|
119 | + } |
|
118 | 120 | return $a_text2 <=> $b_text2; |
119 | 121 | } else { |
120 | 122 | $unreadSort = ($a_text <=> $b_text); |
121 | - if($unreadSort) return $unreadSort; |
|
123 | + if($unreadSort) { |
|
124 | + return $unreadSort; |
|
125 | + } |
|
122 | 126 | return $b_text2 <=> $a_text2; |
123 | 127 | } |
124 | 128 | }); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | $data = $content['body']; |
28 | 28 | $xml = simplexml_load_string($data) or die("Error: Cannot create object"); |
29 | - if(((string) $xml->{'channel'}->title) !== 'Comments on: '){ |
|
29 | + if(((string) $xml->{'channel'}->title) !== 'Comments on: ') { |
|
30 | 30 | if(isset($xml->{'channel'}->item[0])) { |
31 | 31 | if($title = (string) $xml->{'channel'}->item[0]->category) { |
32 | 32 | $titleData['title'] = trim($title); |
@@ -114,7 +114,9 @@ discard block |
||
114 | 114 | */ |
115 | 115 | final public function isValidTitleURL(string $title_url) : bool { |
116 | 116 | $success = (bool) preg_match($this->titleFormat, $title_url); |
117 | - if(!$success) log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
117 | + if(!$success) { |
|
118 | + log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
119 | + } |
|
118 | 120 | return $success; |
119 | 121 | } |
120 | 122 | |
@@ -128,7 +130,9 @@ discard block |
||
128 | 130 | */ |
129 | 131 | final public function isValidChapter(string $chapter) : bool { |
130 | 132 | $success = (bool) preg_match($this->chapterFormat, $chapter); |
131 | - if(!$success) log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
133 | + if(!$success) { |
|
134 | + log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
135 | + } |
|
132 | 136 | return $success; |
133 | 137 | } |
134 | 138 | |
@@ -157,14 +161,20 @@ discard block |
||
157 | 161 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
158 | 162 | curl_setopt($ch, CURLOPT_HEADER, 1); |
159 | 163 | |
160 | - if($follow_redirect) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
164 | + if($follow_redirect) { |
|
165 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
166 | + } |
|
161 | 167 | |
162 | 168 | if($cookies = $this->cache->get("cloudflare_{$this->site}")) { |
163 | 169 | $cookie_string .= "; {$cookies}"; |
164 | 170 | } |
165 | 171 | |
166 | - if(!empty($cookie_string)) curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
167 | - if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
172 | + if(!empty($cookie_string)) { |
|
173 | + curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
174 | + } |
|
175 | + if(!empty($cookiejar_path)) { |
|
176 | + curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
177 | + } |
|
168 | 178 | |
169 | 179 | //Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff. |
170 | 180 | curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent); |
@@ -192,7 +202,9 @@ discard block |
||
192 | 202 | $body = substr($response, $header_size); |
193 | 203 | curl_close($ch); |
194 | 204 | |
195 | - if($status_code === 503) $refresh = $this->handleCloudFlare($url, $body); |
|
205 | + if($status_code === 503) { |
|
206 | + $refresh = $this->handleCloudFlare($url, $body); |
|
207 | + } |
|
196 | 208 | } |
197 | 209 | |
198 | 210 | return [ |
@@ -405,8 +417,12 @@ discard block |
||
405 | 417 | $status = FALSE; |
406 | 418 | |
407 | 419 | //Make sure we have a volume element |
408 | - if(count($oldChapterSegments) === 1) array_unshift($oldChapterSegments, 'v0'); |
|
409 | - if(count($newChapterSegments) === 1) array_unshift($newChapterSegments, 'v0'); |
|
420 | + if(count($oldChapterSegments) === 1) { |
|
421 | + array_unshift($oldChapterSegments, 'v0'); |
|
422 | + } |
|
423 | + if(count($newChapterSegments) === 1) { |
|
424 | + array_unshift($newChapterSegments, 'v0'); |
|
425 | + } |
|
410 | 426 | |
411 | 427 | $oldCount = count($oldChapterSegments); |
412 | 428 | $newCount = count($newChapterSegments); |
@@ -419,8 +435,12 @@ discard block |
||
419 | 435 | $newVolume = substr(array_shift($newChapterSegments), 1); |
420 | 436 | |
421 | 437 | //Forcing volume to 0 as TBD might not be the latest (although it can be, but that is covered by other checks) |
422 | - if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $oldVolume = 0; |
|
423 | - if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $newVolume = 0; |
|
438 | + if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
439 | + $oldVolume = 0; |
|
440 | + } |
|
441 | + if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
442 | + $newVolume = 0; |
|
443 | + } |
|
424 | 444 | |
425 | 445 | $oldVolume = floatval($oldVolume); |
426 | 446 | $newVolume = floatval($newVolume); |