@@ -125,7 +125,9 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | final public function isValidTitleURL(string $title_url) : bool { |
| 127 | 127 | $success = (bool) preg_match($this->titleFormat, $title_url); |
| 128 | - if(!$success) log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
| 128 | + if(!$success) { |
|
| 129 | + log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
| 130 | + } |
|
| 129 | 131 | return $success; |
| 130 | 132 | } |
| 131 | 133 | |
@@ -139,7 +141,9 @@ discard block |
||
| 139 | 141 | */ |
| 140 | 142 | final public function isValidChapter(string $chapter) : bool { |
| 141 | 143 | $success = (bool) preg_match($this->chapterFormat, $chapter); |
| 142 | - if(!$success) log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
| 144 | + if(!$success) { |
|
| 145 | + log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
| 146 | + } |
|
| 143 | 147 | return $success; |
| 144 | 148 | } |
| 145 | 149 | |
@@ -168,14 +172,20 @@ discard block |
||
| 168 | 172 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
| 169 | 173 | curl_setopt($ch, CURLOPT_HEADER, 1); |
| 170 | 174 | |
| 171 | - if($follow_redirect) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 175 | + if($follow_redirect) { |
|
| 176 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 177 | + } |
|
| 172 | 178 | |
| 173 | 179 | if($cookies = $this->cache->get("cloudflare_{$this->site}")) { |
| 174 | 180 | $cookie_string .= "; {$cookies}"; |
| 175 | 181 | } |
| 176 | 182 | |
| 177 | - if(!empty($cookie_string)) curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 178 | - if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 183 | + if(!empty($cookie_string)) { |
|
| 184 | + curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 185 | + } |
|
| 186 | + if(!empty($cookiejar_path)) { |
|
| 187 | + curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 188 | + } |
|
| 179 | 189 | |
| 180 | 190 | //Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff. |
| 181 | 191 | curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent); |
@@ -206,7 +216,9 @@ discard block |
||
| 206 | 216 | $body = substr($response, $header_size); |
| 207 | 217 | curl_close($ch); |
| 208 | 218 | |
| 209 | - if($status_code === 503) $refresh = $this->handleCloudFlare($url, $body); |
|
| 219 | + if($status_code === 503) { |
|
| 220 | + $refresh = $this->handleCloudFlare($url, $body); |
|
| 221 | + } |
|
| 210 | 222 | } |
| 211 | 223 | |
| 212 | 224 | return [ |
@@ -312,7 +324,9 @@ discard block |
||
| 312 | 324 | 'nodes_chapter' => $nodes_chapter->item(0) |
| 313 | 325 | ]; |
| 314 | 326 | |
| 315 | - if(is_callable($extraCall)) $extraCall($xpath, $returnData); |
|
| 327 | + if(is_callable($extraCall)) { |
|
| 328 | + $extraCall($xpath, $returnData); |
|
| 329 | + } |
|
| 316 | 330 | |
| 317 | 331 | return $returnData; |
| 318 | 332 | } else { |
@@ -451,8 +465,12 @@ discard block |
||
| 451 | 465 | $status = FALSE; |
| 452 | 466 | |
| 453 | 467 | //Make sure we have a volume element |
| 454 | - if(count($oldChapterSegments) === 1) array_unshift($oldChapterSegments, 'v0'); |
|
| 455 | - if(count($newChapterSegments) === 1) array_unshift($newChapterSegments, 'v0'); |
|
| 468 | + if(count($oldChapterSegments) === 1) { |
|
| 469 | + array_unshift($oldChapterSegments, 'v0'); |
|
| 470 | + } |
|
| 471 | + if(count($newChapterSegments) === 1) { |
|
| 472 | + array_unshift($newChapterSegments, 'v0'); |
|
| 473 | + } |
|
| 456 | 474 | |
| 457 | 475 | $oldCount = count($oldChapterSegments); |
| 458 | 476 | $newCount = count($newChapterSegments); |
@@ -465,8 +483,12 @@ discard block |
||
| 465 | 483 | $newVolume = substr(array_shift($newChapterSegments), 1); |
| 466 | 484 | |
| 467 | 485 | //Forcing volume to 0 as TBD might not be the latest (although it can be, but that is covered by other checks) |
| 468 | - if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $oldVolume = 0; |
|
| 469 | - if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $newVolume = 0; |
|
| 486 | + if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
| 487 | + $oldVolume = 0; |
|
| 488 | + } |
|
| 489 | + if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
| 490 | + $newVolume = 0; |
|
| 491 | + } |
|
| 470 | 492 | |
| 471 | 493 | $oldVolume = floatval($oldVolume); |
| 472 | 494 | $newVolume = floatval($newVolume); |