@@ -112,7 +112,9 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | final public function isValidTitleURL(string $title_url) : bool { |
| 114 | 114 | $success = (bool) preg_match($this->titleFormat, $title_url); |
| 115 | - if(!$success) log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
| 115 | + if(!$success) { |
|
| 116 | + log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
| 117 | + } |
|
| 116 | 118 | return $success; |
| 117 | 119 | } |
| 118 | 120 | |
@@ -126,7 +128,9 @@ discard block |
||
| 126 | 128 | */ |
| 127 | 129 | final public function isValidChapter(string $chapter) : bool { |
| 128 | 130 | $success = (bool) preg_match($this->chapterFormat, $chapter); |
| 129 | - if(!$success) log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
| 131 | + if(!$success) { |
|
| 132 | + log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
| 133 | + } |
|
| 130 | 134 | return $success; |
| 131 | 135 | } |
| 132 | 136 | |
@@ -149,10 +153,16 @@ discard block |
||
| 149 | 153 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
| 150 | 154 | curl_setopt($ch, CURLOPT_HEADER, 1); |
| 151 | 155 | |
| 152 | - if($follow_redirect) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 156 | + if($follow_redirect) { |
|
| 157 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 158 | + } |
|
| 153 | 159 | |
| 154 | - if(!empty($cookie_string)) curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 155 | - if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 160 | + if(!empty($cookie_string)) { |
|
| 161 | + curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 162 | + } |
|
| 163 | + if(!empty($cookiejar_path)) { |
|
| 164 | + curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 165 | + } |
|
| 156 | 166 | |
| 157 | 167 | //Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff. |
| 158 | 168 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2824.0 Safari/537.36'); |
@@ -362,8 +372,12 @@ discard block |
||
| 362 | 372 | $status = FALSE; |
| 363 | 373 | |
| 364 | 374 | //Make sure we have a volume element |
| 365 | - if(count($oldChapterSegments) === 1) array_unshift($oldChapterSegments, 'v0'); |
|
| 366 | - if(count($newChapterSegments) === 1) array_unshift($newChapterSegments, 'v0'); |
|
| 375 | + if(count($oldChapterSegments) === 1) { |
|
| 376 | + array_unshift($oldChapterSegments, 'v0'); |
|
| 377 | + } |
|
| 378 | + if(count($newChapterSegments) === 1) { |
|
| 379 | + array_unshift($newChapterSegments, 'v0'); |
|
| 380 | + } |
|
| 367 | 381 | |
| 368 | 382 | $oldCount = count($oldChapterSegments); |
| 369 | 383 | $newCount = count($newChapterSegments); |
@@ -376,8 +390,12 @@ discard block |
||
| 376 | 390 | $newVolume = substr(array_shift($newChapterSegments), 1); |
| 377 | 391 | |
| 378 | 392 | //Forcing volume to 0 as TBD might not be the latest (although it can be, but that is covered by other checks) |
| 379 | - if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $oldVolume = 0; |
|
| 380 | - if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $newVolume = 0; |
|
| 393 | + if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
| 394 | + $oldVolume = 0; |
|
| 395 | + } |
|
| 396 | + if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
| 397 | + $newVolume = 0; |
|
| 398 | + } |
|
| 381 | 399 | |
| 382 | 400 | $oldVolume = floatval($oldVolume); |
| 383 | 401 | $newVolume = floatval($newVolume); |