@@ -20,12 +20,16 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function isValidTitleURL(string $title_url, string $regex) : bool { |
| 22 | 22 | $success = (bool) preg_match($regex, $title_url); |
| 23 | - if(!$success) log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
| 23 | + if(!$success) { |
|
| 24 | + log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
| 25 | + } |
|
| 24 | 26 | return $success; |
| 25 | 27 | } |
| 26 | 28 | public function isValidChapter(string $chapter, string $regex) : bool { |
| 27 | 29 | $success = (bool) preg_match($regex, $chapter); |
| 28 | - if(!$success) log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
| 30 | + if(!$success) { |
|
| 31 | + log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
| 32 | + } |
|
| 29 | 33 | return $success; |
| 30 | 34 | } |
| 31 | 35 | |
@@ -36,10 +40,16 @@ discard block |
||
| 36 | 40 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
| 37 | 41 | curl_setopt($ch, CURLOPT_HEADER, 1); |
| 38 | 42 | |
| 39 | - if($follow_redirect) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 43 | + if($follow_redirect) { |
|
| 44 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 45 | + } |
|
| 40 | 46 | |
| 41 | - if(!empty($cookie_string)) curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 42 | - if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 47 | + if(!empty($cookie_string)) { |
|
| 48 | + curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 49 | + } |
|
| 50 | + if(!empty($cookiejar_path)) { |
|
| 51 | + curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 52 | + } |
|
| 43 | 53 | |
| 44 | 54 | //Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff. |
| 45 | 55 | 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'); |
@@ -600,7 +610,8 @@ discard block |
||
| 600 | 610 | |
| 601 | 611 | $content = $this->get_content($fullURL); |
| 602 | 612 | $data = $content['body']; |
| 603 | - if($data !== 'Can\'t find the manga series.') { //FIXME: We should check for he proper error here. |
|
| 613 | + if($data !== 'Can\'t find the manga series.') { |
|
| 614 | +//FIXME: We should check for he proper error here. |
|
| 604 | 615 | $xml = simplexml_load_string($data) or die("Error: Cannot create object"); |
| 605 | 616 | if(isset($xml->{'channel'}->item[0])) { |
| 606 | 617 | $titleData['title'] = trim((string) $xml->{'channel'}->title); |