@@ -22,12 +22,16 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function isValidTitleURL(string $title_url) : bool { |
| 24 | 24 | $success = (bool) preg_match($this->titleFormat, $title_url); |
| 25 | - if(!$success) log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
| 25 | + if(!$success) { |
|
| 26 | + log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
| 27 | + } |
|
| 26 | 28 | return $success; |
| 27 | 29 | } |
| 28 | 30 | public function isValidChapter(string $chapter) : bool { |
| 29 | 31 | $success = (bool) preg_match($this->chapterFormat, $chapter); |
| 30 | - if(!$success) log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
| 32 | + if(!$success) { |
|
| 33 | + log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
| 34 | + } |
|
| 31 | 35 | return $success; |
| 32 | 36 | } |
| 33 | 37 | |
@@ -38,10 +42,16 @@ discard block |
||
| 38 | 42 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
| 39 | 43 | curl_setopt($ch, CURLOPT_HEADER, 1); |
| 40 | 44 | |
| 41 | - if($follow_redirect) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 45 | + if($follow_redirect) { |
|
| 46 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 47 | + } |
|
| 42 | 48 | |
| 43 | - if(!empty($cookie_string)) curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 44 | - if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 49 | + if(!empty($cookie_string)) { |
|
| 50 | + curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 51 | + } |
|
| 52 | + if(!empty($cookiejar_path)) { |
|
| 53 | + curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 54 | + } |
|
| 45 | 55 | |
| 46 | 56 | //Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff. |
| 47 | 57 | 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'); |
@@ -345,8 +355,12 @@ discard block |
||
| 345 | 355 | $oldVolume = substr(array_shift($oldChapterSegments), 1); |
| 346 | 356 | $newVolume = substr(array_shift($newChapterSegments), 1); |
| 347 | 357 | |
| 348 | - if(in_array($oldVolume, ['TBD', 'TBA', 'NA'])) $oldVolume = 999; |
|
| 349 | - if(in_array($newVolume, ['TBD', 'TBA', 'NA'])) $newVolume = 999; |
|
| 358 | + if(in_array($oldVolume, ['TBD', 'TBA', 'NA'])) { |
|
| 359 | + $oldVolume = 999; |
|
| 360 | + } |
|
| 361 | + if(in_array($newVolume, ['TBD', 'TBA', 'NA'])) { |
|
| 362 | + $newVolume = 999; |
|
| 363 | + } |
|
| 350 | 364 | |
| 351 | 365 | $oldVolume = floatval($oldVolume); |
| 352 | 366 | $newVolume = floatval($newVolume); |
@@ -616,8 +630,12 @@ discard block |
||
| 616 | 630 | $oldVolume = substr(array_shift($oldChapterSegments), 1); |
| 617 | 631 | $newVolume = substr(array_shift($newChapterSegments), 1); |
| 618 | 632 | |
| 619 | - if(in_array($oldVolume, ['TBD', 'TBA', 'NA'])) $oldVolume = 999; |
|
| 620 | - if(in_array($newVolume, ['TBD', 'TBA', 'NA'])) $newVolume = 999; |
|
| 633 | + if(in_array($oldVolume, ['TBD', 'TBA', 'NA'])) { |
|
| 634 | + $oldVolume = 999; |
|
| 635 | + } |
|
| 636 | + if(in_array($newVolume, ['TBD', 'TBA', 'NA'])) { |
|
| 637 | + $newVolume = 999; |
|
| 638 | + } |
|
| 621 | 639 | |
| 622 | 640 | $oldVolume = floatval($oldVolume); |
| 623 | 641 | $newVolume = floatval($newVolume); |
@@ -883,7 +901,8 @@ discard block |
||
| 883 | 901 | |
| 884 | 902 | $content = $this->get_content($fullURL); |
| 885 | 903 | $data = $content['body']; |
| 886 | - if($data !== 'Can\'t find the manga series.') { //FIXME: We should check for he proper error here. |
|
| 904 | + if($data !== 'Can\'t find the manga series.') { |
|
| 905 | +//FIXME: We should check for he proper error here. |
|
| 887 | 906 | $xml = simplexml_load_string($data) or die("Error: Cannot create object"); |
| 888 | 907 | if(isset($xml->{'channel'}->item[0])) { |
| 889 | 908 | $titleData['title'] = trim((string) $xml->{'channel'}->title); |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 1 | +<?php defined('BASEPATH') or exit('No direct script access allowed'); |
|
| 2 | 2 | |
| 3 | 3 | class Migration_Tracker_Add_Site_Custom extends CI_Migration { |
| 4 | 4 | public function __construct() { |