@@ -44,12 +44,16 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | final public function isValidTitleURL(string $title_url) : bool { |
| 46 | 46 | $success = (bool) preg_match($this->titleFormat, $title_url); |
| 47 | - if(!$success) log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
| 47 | + if(!$success) { |
|
| 48 | + log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
| 49 | + } |
|
| 48 | 50 | return $success; |
| 49 | 51 | } |
| 50 | 52 | final public function isValidChapter(string $chapter) : bool { |
| 51 | 53 | $success = (bool) preg_match($this->chapterFormat, $chapter); |
| 52 | - if(!$success) log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
| 54 | + if(!$success) { |
|
| 55 | + log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
| 56 | + } |
|
| 53 | 57 | return $success; |
| 54 | 58 | } |
| 55 | 59 | |
@@ -60,10 +64,16 @@ discard block |
||
| 60 | 64 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
| 61 | 65 | curl_setopt($ch, CURLOPT_HEADER, 1); |
| 62 | 66 | |
| 63 | - if($follow_redirect) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 67 | + if($follow_redirect) { |
|
| 68 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 69 | + } |
|
| 64 | 70 | |
| 65 | - if(!empty($cookie_string)) curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 66 | - if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 71 | + if(!empty($cookie_string)) { |
|
| 72 | + curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 73 | + } |
|
| 74 | + if(!empty($cookiejar_path)) { |
|
| 75 | + curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 76 | + } |
|
| 67 | 77 | |
| 68 | 78 | //Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff. |
| 69 | 79 | 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'); |
@@ -234,8 +244,12 @@ discard block |
||
| 234 | 244 | $status = FALSE; |
| 235 | 245 | |
| 236 | 246 | //Make sure we have a volume element |
| 237 | - if(count($oldChapterSegments) === 1) array_unshift($oldChapterSegments, 'v0'); |
|
| 238 | - if(count($newChapterSegments) === 1) array_unshift($newChapterSegments, 'v0'); |
|
| 247 | + if(count($oldChapterSegments) === 1) { |
|
| 248 | + array_unshift($oldChapterSegments, 'v0'); |
|
| 249 | + } |
|
| 250 | + if(count($newChapterSegments) === 1) { |
|
| 251 | + array_unshift($newChapterSegments, 'v0'); |
|
| 252 | + } |
|
| 239 | 253 | |
| 240 | 254 | $oldCount = count($oldChapterSegments); |
| 241 | 255 | $newCount = count($newChapterSegments); |
@@ -248,8 +262,12 @@ discard block |
||
| 248 | 262 | $newVolume = substr(array_shift($newChapterSegments), 1); |
| 249 | 263 | |
| 250 | 264 | //Forcing volume to 0 as TBD might not be the latest (although it can be, but that is covered by other checks) |
| 251 | - if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $oldVolume = 0; |
|
| 252 | - if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $newVolume = 0; |
|
| 265 | + if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
| 266 | + $oldVolume = 0; |
|
| 267 | + } |
|
| 268 | + if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
| 269 | + $newVolume = 0; |
|
| 270 | + } |
|
| 253 | 271 | |
| 254 | 272 | $oldVolume = floatval($oldVolume); |
| 255 | 273 | $newVolume = floatval($newVolume); |