@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed'); |
|
| 1 | +<?php declare(strict_types = 1); defined('BASEPATH') or exit('No direct script access allowed'); |
|
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | 4 | * Checks if view file exists. |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @return bool |
| 7 | 7 | */ |
| 8 | 8 | function view_exists(string $path) : bool { |
| 9 | - return file_exists(APPPATH . "/views/{$path}.php"); |
|
| 9 | + return file_exists(APPPATH."/views/{$path}.php"); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | function get_time_class(string $time_string) : string { |
@@ -29,19 +29,19 @@ discard block |
||
| 29 | 29 | return $time_string; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | -if (!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
| 33 | - function http_parse_headers ($raw_headers){ |
|
| 32 | +if(!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
| 33 | + function http_parse_headers($raw_headers) { |
|
| 34 | 34 | $headers = array(); // $headers = []; |
| 35 | - foreach (explode("\n", $raw_headers) as $i => $h) { |
|
| 35 | + foreach(explode("\n", $raw_headers) as $i => $h) { |
|
| 36 | 36 | $h = explode(':', $h, 2); |
| 37 | - if (isset($h[1])){ |
|
| 38 | - if(!isset($headers[$h[0]])){ |
|
| 37 | + if(isset($h[1])) { |
|
| 38 | + if(!isset($headers[$h[0]])) { |
|
| 39 | 39 | $headers[$h[0]] = trim($h[1]); |
| 40 | - }else if(is_array($headers[$h[0]])){ |
|
| 41 | - $tmp = array_merge($headers[$h[0]],array(trim($h[1]))); |
|
| 40 | + } else if(is_array($headers[$h[0]])) { |
|
| 41 | + $tmp = array_merge($headers[$h[0]], array(trim($h[1]))); |
|
| 42 | 42 | $headers[$h[0]] = $tmp; |
| 43 | - }else{ |
|
| 44 | - $tmp = array_merge(array($headers[$h[0]]),array(trim($h[1]))); |
|
| 43 | + } else { |
|
| 44 | + $tmp = array_merge(array($headers[$h[0]]), array(trim($h[1]))); |
|
| 45 | 45 | $headers[$h[0]] = $tmp; |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -29,18 +29,19 @@ |
||
| 29 | 29 | return $time_string; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | -if (!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
| 33 | - function http_parse_headers ($raw_headers){ |
|
| 32 | +if (!function_exists('http_parse_headers')) { |
|
| 33 | +#http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
| 34 | + function http_parse_headers ($raw_headers) { |
|
| 34 | 35 | $headers = array(); // $headers = []; |
| 35 | 36 | foreach (explode("\n", $raw_headers) as $i => $h) { |
| 36 | 37 | $h = explode(':', $h, 2); |
| 37 | - if (isset($h[1])){ |
|
| 38 | - if(!isset($headers[$h[0]])){ |
|
| 38 | + if (isset($h[1])) { |
|
| 39 | + if(!isset($headers[$h[0]])) { |
|
| 39 | 40 | $headers[$h[0]] = trim($h[1]); |
| 40 | - }else if(is_array($headers[$h[0]])){ |
|
| 41 | + } else if(is_array($headers[$h[0]])) { |
|
| 41 | 42 | $tmp = array_merge($headers[$h[0]],array(trim($h[1]))); |
| 42 | 43 | $headers[$h[0]] = $tmp; |
| 43 | - }else{ |
|
| 44 | + } else { |
|
| 44 | 45 | $tmp = array_merge(array($headers[$h[0]]),array(trim($h[1]))); |
| 45 | 46 | $headers[$h[0]] = $tmp; |
| 46 | 47 | } |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 1 | +<?php declare(strict_types = 1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 2 | 2 | |
| 3 | 3 | abstract class Site_Model extends CI_Model { |
| 4 | 4 | public function __construct() { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | protected function get_content(string $url, string $cookie_string = "", string $cookiejar_path = "", bool $follow_redirect = FALSE) { |
| 21 | 21 | $ch = curl_init(); |
| 22 | 22 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 23 | - curl_setopt($ch, CURLOPT_ENCODING , "gzip"); |
|
| 23 | + curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
| 24 | 24 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
| 25 | 25 | curl_setopt($ch, CURLOPT_HEADER, 1); |
| 26 | 26 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $nodes_row = $xpath->query($node_row_string); |
| 80 | 80 | if($nodes_title->length === 1 && $nodes_row->length === 1) { |
| 81 | 81 | $firstRow = $nodes_row->item(0); |
| 82 | - $nodes_latest = $xpath->query($node_latest_string, $firstRow); |
|
| 82 | + $nodes_latest = $xpath->query($node_latest_string, $firstRow); |
|
| 83 | 83 | $nodes_chapter = $xpath->query($node_chapter_string, $firstRow); |
| 84 | 84 | |
| 85 | 85 | if($nodes_latest->length === 1 && $nodes_chapter->length === 1) { |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | $link = preg_replace('/^(.*\/)(?:[0-9]+\.html)?$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
| 180 | 180 | $chapterURLSegments = explode('/', $link); |
| 181 | - $titleData['latest_chapter'] = $chapterURLSegments[5] . (isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
| 182 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
| 181 | + $titleData['latest_chapter'] = $chapterURLSegments[5].(isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
| 182 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | return (!empty($titleData) ? $titleData : NULL); |
@@ -231,8 +231,8 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | $link = preg_replace('/^(.*\/)(?:[0-9]+\.html)?$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
| 233 | 233 | $chapterURLSegments = explode('/', $link); |
| 234 | - $titleData['latest_chapter'] = $chapterURLSegments[5] . (isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
| 235 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
| 234 | + $titleData['latest_chapter'] = $chapterURLSegments[5].(isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
| 235 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | return (!empty($titleData) ? $titleData : NULL); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | $chapter_parts = explode(':--:', $chapter); |
| 273 | 273 | return [ |
| 274 | - 'url' => "http://bato.to/reader#" . $chapter_parts[0], |
|
| 274 | + 'url' => "http://bato.to/reader#".$chapter_parts[0], |
|
| 275 | 275 | 'number' => $chapter_parts[1] |
| 276 | 276 | ]; |
| 277 | 277 | } |
@@ -287,8 +287,8 @@ discard block |
||
| 287 | 287 | //Bato.to is annoying and locks stuff behind auth. See: https://github.com/DakuTree/manga-tracker/issues/14#issuecomment-233830855 |
| 288 | 288 | $cookies = [ |
| 289 | 289 | "lang_option={$title_lang}", |
| 290 | - "member_id=" . $this->config->item('batoto_cookie_member_id'), |
|
| 291 | - "pass_hash=" . $this->config->item('batoto_cookie_pass_hash') |
|
| 290 | + "member_id=".$this->config->item('batoto_cookie_member_id'), |
|
| 291 | + "pass_hash=".$this->config->item('batoto_cookie_pass_hash') |
|
| 292 | 292 | ]; |
| 293 | 293 | $content = $this->get_content($title_url, implode("; ", $cookies), "", TRUE); |
| 294 | 294 | $data = $content['body']; |
@@ -322,13 +322,13 @@ discard block |
||
| 322 | 322 | preg_match('/^(?:Vol\.(?<volume>\S+) )?(?:Ch.(?<chapter>[^\s:]+)(?:\s?-\s?(?<extra>[0-9]+))?):?.*/', trim($chapter_element->nodeValue), $text); |
| 323 | 323 | |
| 324 | 324 | $titleData['title'] = html_entity_decode(trim($xpath->query('//h1[@class="ipsType_pagetitle"]')->item(0)->nodeValue)); |
| 325 | - $titleData['latest_chapter'] = substr($chapter_element->getAttribute('href'), 22) . ':--:' . ((!empty($text['volume']) ? 'v'.$text['volume'].'/' : '') . 'c'.$text['chapter'] . (!empty($text['extra']) ? '-'.$text['extra'] : '')); |
|
| 325 | + $titleData['latest_chapter'] = substr($chapter_element->getAttribute('href'), 22).':--:'.((!empty($text['volume']) ? 'v'.$text['volume'].'/' : '').'c'.$text['chapter'].(!empty($text['extra']) ? '-'.$text['extra'] : '')); |
|
| 326 | 326 | |
| 327 | 327 | $dateString = $updated_element->nodeValue; |
| 328 | 328 | if($dateString == 'An hour ago') { |
| 329 | 329 | $dateString = '1 hour ago'; |
| 330 | 330 | } |
| 331 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(preg_replace('/ (-|\[A\]).*$/', '', $dateString))); |
|
| 331 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(preg_replace('/ (-|\[A\]).*$/', '', $dateString))); |
|
| 332 | 332 | } else { |
| 333 | 333 | log_message('error', "Batoto: Regex missing <td> ({$title_url})"); |
| 334 | 334 | return NULL; |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | */ |
| 377 | 377 | |
| 378 | 378 | $chapterData = [ |
| 379 | - 'url' => 'http://dynasty-scans.com/chapters/' . $title_parts[0].'_'.$chapter, |
|
| 379 | + 'url' => 'http://dynasty-scans.com/chapters/'.$title_parts[0].'_'.$chapter, |
|
| 380 | 380 | 'number' => '' |
| 381 | 381 | ]; |
| 382 | 382 | |
@@ -417,14 +417,14 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | preg_match('/<b>.*<\/b>/', $data, $matchesT); |
| 419 | 419 | preg_match('/\/doujins\/[^"]+">(.+)?(?=<\/a>)<\/a>/', $data, $matchesD); |
| 420 | - $titleData['title'] = (!empty($matchesD) ? (substr($matchesD[1], 0, -7) !== 'Original' ? substr($matchesD[1], 0, -7).' - ' : '') : '') . substr($matchesT[0], 3, -4); |
|
| 420 | + $titleData['title'] = (!empty($matchesD) ? (substr($matchesD[1], 0, -7) !== 'Original' ? substr($matchesD[1], 0, -7).' - ' : '') : '').substr($matchesT[0], 3, -4); |
|
| 421 | 421 | |
| 422 | 422 | $data = preg_replace('/^[\S\s]*(<dl class=\'chapter-list\'>[\S\s]*<\/dl>)[\S\s]*$/', '$1', $data); |
| 423 | 423 | preg_match_all('/<dd>[\s\S]+?(?=<\/dd>)<\/dd>/', $data, $matches); |
| 424 | 424 | $latest_chapter_html = array_pop($matches[0]); |
| 425 | 425 | |
| 426 | 426 | preg_match('/\/chapters\/([^"]+)/', $latest_chapter_html, $matches); |
| 427 | - $titleData['latest_chapter'] = substr($matches[1], strlen($title_url)+1); |
|
| 427 | + $titleData['latest_chapter'] = substr($matches[1], strlen($title_url) + 1); |
|
| 428 | 428 | //FIXME: THIS IS A TEMP FIX, SEE https://github.com/DakuTree/manga-tracker/issues/58 |
| 429 | 429 | if(!$titleData['latest_chapter']) { |
| 430 | 430 | log_message('error', 'DynastyScans::getTitleData cannot parse title properly as it contains oneshot. || URL: '.$title_url); |
@@ -432,14 +432,14 @@ discard block |
||
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | preg_match('/<small>released (.*)<\/small>/', $latest_chapter_html, $matches); |
| 435 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(str_replace('\'', '', $matches[1]))); |
|
| 435 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(str_replace('\'', '', $matches[1]))); |
|
| 436 | 436 | } elseif($title_parts[1] == '1') { |
| 437 | 437 | $content = $this->get_content('http://dynasty-scans.com/chapters/'.$title_url); |
| 438 | 438 | $data = $content['body']; |
| 439 | 439 | |
| 440 | 440 | preg_match('/<b>.*<\/b>/', $data, $matchesT); |
| 441 | 441 | preg_match('/\/doujins\/[^"]+">(.+)?(?=<\/a>)<\/a>/', $data, $matchesD); |
| 442 | - $titleData['title'] = (!empty($matchesD) ? ($matchesD[1] !== 'Original' ? $matchesD[1].' - ' : '') : '') . substr($matchesT[0], 3, -4); |
|
| 442 | + $titleData['title'] = (!empty($matchesD) ? ($matchesD[1] !== 'Original' ? $matchesD[1].' - ' : '') : '').substr($matchesT[0], 3, -4); |
|
| 443 | 443 | |
| 444 | 444 | $titleData['latest_chapter'] = 'oneshot'; //This will never change |
| 445 | 445 | |
@@ -503,11 +503,11 @@ discard block |
||
| 503 | 503 | $titleData['title'] = $nodes_title->item(0)->nodeValue; |
| 504 | 504 | |
| 505 | 505 | $firstRow = $nodes_row->item(0); |
| 506 | - $nodes_latest = $xpath->query("td[2]", $firstRow); |
|
| 506 | + $nodes_latest = $xpath->query("td[2]", $firstRow); |
|
| 507 | 507 | $nodes_chapter = $xpath->query("td[1]/a", $firstRow); |
| 508 | 508 | |
| 509 | 509 | $titleData['latest_chapter'] = preg_replace('/^.*\/([0-9]+)$/', '$1', (string) $nodes_chapter->item(0)->getAttribute('href')); |
| 510 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest->item(0)->nodeValue)); |
|
| 510 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest->item(0)->nodeValue)); |
|
| 511 | 511 | } |
| 512 | 512 | } else { |
| 513 | 513 | log_message('error', "Series missing? (MangaPanda): {$title_url}"); |
@@ -564,11 +564,11 @@ discard block |
||
| 564 | 564 | $titleData['title'] = $nodes_title->item(0)->nodeValue; |
| 565 | 565 | |
| 566 | 566 | $firstRow = $nodes_row->item(0); |
| 567 | - $nodes_latest = $xpath->query("td[2]", $firstRow); |
|
| 567 | + $nodes_latest = $xpath->query("td[2]", $firstRow); |
|
| 568 | 568 | $nodes_chapter = $xpath->query("td[1]/a", $firstRow); |
| 569 | 569 | |
| 570 | 570 | $titleData['latest_chapter'] = preg_replace('/^.*\/(.*?\/[0-9]+)\/[0-9]+$/', '$1', (string) $nodes_chapter->item(0)->getAttribute('href')); |
| 571 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest->item(0)->nodeValue)); |
|
| 571 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest->item(0)->nodeValue)); |
|
| 572 | 572 | } |
| 573 | 573 | } else { |
| 574 | 574 | log_message('error', "Series missing? (MangaStream): {$title_url}"); |
@@ -635,8 +635,8 @@ discard block |
||
| 635 | 635 | $titleData['title'] = trim((string) $xml->{'channel'}->title); |
| 636 | 636 | |
| 637 | 637 | $chapterURLSegments = explode('/', ((string) $xml->{'channel'}->item[0]->link)); |
| 638 | - $titleData['latest_chapter'] = preg_replace('/^.*?([0-9]+)$/', '$1', $chapterURLSegments[7]) . ':--:' . $chapterURLSegments[6]; |
|
| 639 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $xml->{'channel'}->item[0]->pubDate)); |
|
| 638 | + $titleData['latest_chapter'] = preg_replace('/^.*?([0-9]+)$/', '$1', $chapterURLSegments[7]).':--:'.$chapterURLSegments[6]; |
|
| 639 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $xml->{'channel'}->item[0]->pubDate)); |
|
| 640 | 640 | } |
| 641 | 641 | } else { |
| 642 | 642 | log_message('error', "Series missing? (WebToons): {$title_url}"); |
@@ -714,13 +714,13 @@ discard block |
||
| 714 | 714 | $titleData['title'] = $nodes_title->item(0)->textContent; |
| 715 | 715 | |
| 716 | 716 | $firstRow = $nodes_row->item(0); |
| 717 | - $nodes_latest = $xpath->query("td[2]", $firstRow); |
|
| 717 | + $nodes_latest = $xpath->query("td[2]", $firstRow); |
|
| 718 | 718 | $nodes_chapter = $xpath->query("td[1]/a", $firstRow); |
| 719 | 719 | |
| 720 | 720 | $link = (string) $nodes_chapter->item(0)->getAttribute('href'); |
| 721 | 721 | $chapterURLSegments = explode('/', preg_replace('/\?.*$/', '', $link)); |
| 722 | - $titleData['latest_chapter'] = $chapterURLSegments[3] . ':--:' . preg_replace('/.*?([0-9]+)$/', '$1', $link); |
|
| 723 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest->item(0)->textContent)); |
|
| 722 | + $titleData['latest_chapter'] = $chapterURLSegments[3].':--:'.preg_replace('/.*?([0-9]+)$/', '$1', $link); |
|
| 723 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest->item(0)->textContent)); |
|
| 724 | 724 | } |
| 725 | 725 | } else { |
| 726 | 726 | //TODO: Throw ERRORS; |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | $chapter_parts = explode('/', $chapter); |
| 756 | 756 | return [ |
| 757 | 757 | 'url' => "https://reader.kireicake.com/read/{$title_url}/{$chapter}/", |
| 758 | - 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 758 | + 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 759 | 759 | ]; |
| 760 | 760 | } |
| 761 | 761 | |
@@ -783,12 +783,12 @@ discard block |
||
| 783 | 783 | $titleData['title'] = trim($nodes_title->item(0)->textContent); |
| 784 | 784 | |
| 785 | 785 | $firstRow = $nodes_row->item(0); |
| 786 | - $nodes_latest = $xpath->query("div[@class='meta_r']", $firstRow); |
|
| 786 | + $nodes_latest = $xpath->query("div[@class='meta_r']", $firstRow); |
|
| 787 | 787 | $nodes_chapter = $xpath->query("div[@class='title']/a", $firstRow); |
| 788 | 788 | |
| 789 | 789 | $link = (string) $nodes_chapter->item(0)->getAttribute('href'); |
| 790 | 790 | $titleData['latest_chapter'] = preg_replace('/.*\/read\/.*?\/(.*?)\/$/', '$1', $link); |
| 791 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) str_replace('.', '', explode(',', $nodes_latest->item(0)->textContent)[1]))); |
|
| 791 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) str_replace('.', '', explode(',', $nodes_latest->item(0)->textContent)[1]))); |
|
| 792 | 792 | } |
| 793 | 793 | } else { |
| 794 | 794 | //TODO: Throw ERRORS; |
@@ -845,11 +845,11 @@ discard block |
||
| 845 | 845 | |
| 846 | 846 | $firstRow = $nodes_row->item(0); |
| 847 | 847 | $nodes_latest = $xpath->query("p[@class='author']/span|p[@class='author']/abbr", $firstRow); |
| 848 | - $nodes_chapter = $xpath->query("p[@class='text_work']/a", $firstRow); |
|
| 848 | + $nodes_chapter = $xpath->query("p[@class='text_work']/a", $firstRow); |
|
| 849 | 849 | |
| 850 | 850 | $link = (string) $nodes_chapter->item(0)->getAttribute('href'); |
| 851 | 851 | $titleData['latest_chapter'] = preg_replace('/^projects\/.*?\/(.*?)\/$/', '$1', $link); |
| 852 | - $titleData['last_updated'] = date("Y-m-d H:i:s", (int) $nodes_latest->item(0)->getAttribute('data-time')); |
|
| 852 | + $titleData['last_updated'] = date("Y-m-d H:i:s", (int) $nodes_latest->item(0)->getAttribute('data-time')); |
|
| 853 | 853 | } else { |
| 854 | 854 | log_message('error', "GameOfScanlation: Unable to find nodes."); |
| 855 | 855 | return NULL; |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | |
| 911 | 911 | $link = (string) $nodes_chapter->item(0)->getAttribute('href'); |
| 912 | 912 | $titleData['latest_chapter'] = preg_replace('/^.*\/([0-9]+)\/$/', '$1', $link); |
| 913 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) substr($nodes_latest->item(0)->getAttribute('title'), 13))); |
|
| 913 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) substr($nodes_latest->item(0)->getAttribute('title'), 13))); |
|
| 914 | 914 | } else { |
| 915 | 915 | log_message('error', "MangaCow: Unable to find nodes."); |
| 916 | 916 | return NULL; |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | $chapter_parts = explode('/', $chapter); |
| 945 | 945 | return [ |
| 946 | 946 | 'url' => "https://reader.seaotterscans.com/read/{$title_url}/{$chapter}/", |
| 947 | - 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 947 | + 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 948 | 948 | ]; |
| 949 | 949 | } |
| 950 | 950 | |
@@ -971,18 +971,18 @@ discard block |
||
| 971 | 971 | //SOO sometimes uses volume groups which are above recent chapters (if they haven't been grouped yet), so make sure we check for both. |
| 972 | 972 | $nodes_row = $xpath->query("//div[@class='list']/div[@class='group']/div[@class='title' and text() = 'Chapters']/following-sibling::div[@class='element'][1]"); |
| 973 | 973 | if($nodes_row->length !== 1) { |
| 974 | - $nodes_row = $xpath->query("//div[@class='list']/div[@class='group'][1]/div[@class='element'][1]"); |
|
| 974 | + $nodes_row = $xpath->query("//div[@class='list']/div[@class='group'][1]/div[@class='element'][1]"); |
|
| 975 | 975 | } |
| 976 | 976 | if($nodes_title->length === 1 && $nodes_row->length === 1) { |
| 977 | 977 | $titleData['title'] = trim($nodes_title->item(0)->textContent); |
| 978 | 978 | |
| 979 | 979 | $firstRow = $nodes_row->item(0); |
| 980 | - $nodes_latest = $xpath->query("div[@class='meta_r']", $firstRow); |
|
| 980 | + $nodes_latest = $xpath->query("div[@class='meta_r']", $firstRow); |
|
| 981 | 981 | $nodes_chapter = $xpath->query("div[@class='title']/a", $firstRow); |
| 982 | 982 | |
| 983 | 983 | $link = (string) $nodes_chapter->item(0)->getAttribute('href'); |
| 984 | 984 | $titleData['latest_chapter'] = preg_replace('/.*\/read\/.*?\/(.*?)\/$/', '$1', $link); |
| 985 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) str_replace('.', '', explode(',', $nodes_latest[0]->textContent)[1]))); |
|
| 985 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) str_replace('.', '', explode(',', $nodes_latest[0]->textContent)[1]))); |
|
| 986 | 986 | } |
| 987 | 987 | } else { |
| 988 | 988 | //TODO: Throw ERRORS; |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | $chapter_parts = explode('/', $chapter); |
| 1014 | 1014 | return [ |
| 1015 | 1015 | 'url' => "http://helveticascans.com/reader/read/{$title_url}/{$chapter}/", |
| 1016 | - 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 1016 | + 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 1017 | 1017 | ]; |
| 1018 | 1018 | } |
| 1019 | 1019 | |
@@ -1038,7 +1038,7 @@ discard block |
||
| 1038 | 1038 | $nodes_title = $xpath->query("//div[@class='large comic']/h1[@class='title']"); |
| 1039 | 1039 | $nodes_row = $xpath->query("//div[@class='list']/div[@class='group']/div[@class='title' and text() = 'Chapters']/following-sibling::div[@class='element'][1]"); |
| 1040 | 1040 | if($nodes_row->length !== 1) { |
| 1041 | - $nodes_row = $xpath->query("//div[@class='list']/div[@class='group'][1]/div[@class='element'][1]"); |
|
| 1041 | + $nodes_row = $xpath->query("//div[@class='list']/div[@class='group'][1]/div[@class='element'][1]"); |
|
| 1042 | 1042 | } |
| 1043 | 1043 | if($nodes_title->length === 1 && $nodes_row->length === 1) { |
| 1044 | 1044 | $titleData['title'] = trim($nodes_title->item(0)->textContent); |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | |
| 1050 | 1050 | $link = (string) $nodes_chapter->item(0)->getAttribute('href'); |
| 1051 | 1051 | $titleData['latest_chapter'] = preg_replace('/.*\/read\/.*?\/(.*?)\/$/', '$1', $link); |
| 1052 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) str_replace('.', '', explode(',', $nodes_latest->item(0)->textContent)[1]))); |
|
| 1052 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) str_replace('.', '', explode(',', $nodes_latest->item(0)->textContent)[1]))); |
|
| 1053 | 1053 | } |
| 1054 | 1054 | } else { |
| 1055 | 1055 | //TODO: Throw ERRORS; |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | $chapter_parts = explode('/', $chapter); |
| 1081 | 1081 | return [ |
| 1082 | 1082 | 'url' => "http://reader.sensescans.com/read/{$title_url}/{$chapter}/", |
| 1083 | - 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 1083 | + 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 1084 | 1084 | ]; |
| 1085 | 1085 | } |
| 1086 | 1086 | |
@@ -1105,7 +1105,7 @@ discard block |
||
| 1105 | 1105 | $nodes_title = $xpath->query("//div[@class='large comic']/h1[@class='title']"); |
| 1106 | 1106 | $nodes_row = $xpath->query("//div[@class='list']/div[@class='group']/div[@class='title' and text() = 'Chapters']/following-sibling::div[@class='element'][1]"); |
| 1107 | 1107 | if($nodes_row->length !== 1) { |
| 1108 | - $nodes_row = $xpath->query("//div[@class='list']/div[@class='group'][1]/div[@class='element'][1]"); |
|
| 1108 | + $nodes_row = $xpath->query("//div[@class='list']/div[@class='group'][1]/div[@class='element'][1]"); |
|
| 1109 | 1109 | } |
| 1110 | 1110 | if($nodes_title->length === 1 && $nodes_row->length === 1) { |
| 1111 | 1111 | $titleData['title'] = trim($nodes_title->item(0)->textContent); |
@@ -1115,7 +1115,7 @@ discard block |
||
| 1115 | 1115 | |
| 1116 | 1116 | $link = (string) $nodes_chapter->item(0)->getAttribute('href'); |
| 1117 | 1117 | $titleData['latest_chapter'] = preg_replace('/.*\/read\/.*?\/(.*?)\/$/', '$1', $link); |
| 1118 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) str_replace('.', '', explode(',', $nodes_latest->item(0)->textContent)[1]))); |
|
| 1118 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) str_replace('.', '', explode(',', $nodes_latest->item(0)->textContent)[1]))); |
|
| 1119 | 1119 | } |
| 1120 | 1120 | } else { |
| 1121 | 1121 | //TODO: Throw ERRORS; |
@@ -24,10 +24,16 @@ discard block |
||
| 24 | 24 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
| 25 | 25 | curl_setopt($ch, CURLOPT_HEADER, 1); |
| 26 | 26 | |
| 27 | - if($follow_redirect) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 27 | + if($follow_redirect) { |
|
| 28 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 29 | + } |
|
| 28 | 30 | |
| 29 | - if(!empty($cookie_string)) curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 30 | - if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 31 | + if(!empty($cookie_string)) { |
|
| 32 | + curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 33 | + } |
|
| 34 | + if(!empty($cookiejar_path)) { |
|
| 35 | + curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 36 | + } |
|
| 31 | 37 | |
| 32 | 38 | //Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff. |
| 33 | 39 | 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'); |
@@ -141,12 +147,16 @@ discard block |
||
| 141 | 147 | |
| 142 | 148 | public function isValidTitleURL(string $title_url) : bool { |
| 143 | 149 | $success = (bool) preg_match('/^[a-z0-9_]+$/', $title_url); |
| 144 | - if(!$success) log_message('error', "Invalid Title URL (MangaFox): {$title_url}"); |
|
| 150 | + if(!$success) { |
|
| 151 | + log_message('error', "Invalid Title URL (MangaFox): {$title_url}"); |
|
| 152 | + } |
|
| 145 | 153 | return $success; |
| 146 | 154 | } |
| 147 | 155 | public function isValidChapter(string $chapter) : bool { |
| 148 | 156 | $success = (bool) preg_match('/^(?:v[0-9a-zA-Z]+\/)?c[0-9\.]+$/', $chapter); |
| 149 | - if(!$success) log_message('error', 'Invalid Chapter (MangaFox): '.$chapter); |
|
| 157 | + if(!$success) { |
|
| 158 | + log_message('error', 'Invalid Chapter (MangaFox): '.$chapter); |
|
| 159 | + } |
|
| 150 | 160 | return $success; |
| 151 | 161 | } |
| 152 | 162 | |
@@ -193,12 +203,16 @@ discard block |
||
| 193 | 203 | |
| 194 | 204 | public function isValidTitleURL(string $title_url) : bool { |
| 195 | 205 | $success = (bool) preg_match('/^[a-z0-9_]+$/', $title_url); |
| 196 | - if(!$success) log_message('error', "Invalid Title URL (MangaFox): {$title_url}"); |
|
| 206 | + if(!$success) { |
|
| 207 | + log_message('error', "Invalid Title URL (MangaFox): {$title_url}"); |
|
| 208 | + } |
|
| 197 | 209 | return $success; |
| 198 | 210 | } |
| 199 | 211 | public function isValidChapter(string $chapter) : bool { |
| 200 | 212 | $success = (bool) preg_match('/^(?:v[0-9]+\/)?c[0-9]+(?:\.[0-9]+)?$/', $chapter); |
| 201 | - if(!$success) log_message('error', 'Invalid Chapter (MangaFox): '.$chapter); |
|
| 213 | + if(!$success) { |
|
| 214 | + log_message('error', 'Invalid Chapter (MangaFox): '.$chapter); |
|
| 215 | + } |
|
| 202 | 216 | return $success; |
| 203 | 217 | } |
| 204 | 218 | |
@@ -254,7 +268,9 @@ discard block |
||
| 254 | 268 | |
| 255 | 269 | public function isValidTitleURL(string $title_url) : bool { |
| 256 | 270 | $success = (bool) preg_match('/^[0-9]+:--:(?:English|Spanish|French|German|Portuguese|Turkish|Indonesian|Greek|Filipino|Italian|Polish|Thai|Malay|Hungarian|Romanian|Arabic|Hebrew|Russian|Vietnamese|Dutch)$/', $title_url); |
| 257 | - if(!$success) log_message('error', "Invalid Title URL (Batoto): {$title_url}"); |
|
| 271 | + if(!$success) { |
|
| 272 | + log_message('error', "Invalid Title URL (Batoto): {$title_url}"); |
|
| 273 | + } |
|
| 258 | 274 | return $success; |
| 259 | 275 | } |
| 260 | 276 | public function isValidChapter(string $chapter) : bool { |
@@ -262,7 +278,9 @@ discard block |
||
| 262 | 278 | // Preferably we'd just use /^[0-9a-z]+:--:(v[0-9]+\/)?c[0-9]+(\.[0-9]+)?$/ |
| 263 | 279 | |
| 264 | 280 | $success = (bool) preg_match('/^[0-9a-z]+:--:.+$/', $chapter); |
| 265 | - if(!$success) log_message('error', 'Invalid Chapter (Batoto): '.$chapter); |
|
| 281 | + if(!$success) { |
|
| 282 | + log_message('error', 'Invalid Chapter (Batoto): '.$chapter); |
|
| 283 | + } |
|
| 266 | 284 | return $success; |
| 267 | 285 | } |
| 268 | 286 | |
@@ -357,12 +375,16 @@ discard block |
||
| 357 | 375 | |
| 358 | 376 | public function isValidTitleURL(string $title_url) : bool { |
| 359 | 377 | $success = (bool) preg_match('/^[a-z0-9_]+:--:(?:0|1)$/', $title_url); |
| 360 | - if(!$success) log_message('error', "Invalid Title URL (DynastyScans): {$title_url}"); |
|
| 378 | + if(!$success) { |
|
| 379 | + log_message('error', "Invalid Title URL (DynastyScans): {$title_url}"); |
|
| 380 | + } |
|
| 361 | 381 | return $success; |
| 362 | 382 | } |
| 363 | 383 | public function isValidChapter(string $chapter) : bool { |
| 364 | 384 | $success = (bool) preg_match('/^[0-9a-z_]+$/', $chapter); |
| 365 | - if(!$success) log_message('error', 'Invalid Chapter (DynastyScans): '.$chapter); |
|
| 385 | + if(!$success) { |
|
| 386 | + log_message('error', 'Invalid Chapter (DynastyScans): '.$chapter); |
|
| 387 | + } |
|
| 366 | 388 | return $success; |
| 367 | 389 | } |
| 368 | 390 | |
@@ -470,12 +492,16 @@ discard block |
||
| 470 | 492 | |
| 471 | 493 | public function isValidTitleURL(string $title_url) : bool { |
| 472 | 494 | $success = (bool) preg_match('/^[a-z0-9-]+$/', $title_url); |
| 473 | - if(!$success) log_message('error', "Invalid Title URL (MangaPanda): {$title_url}"); |
|
| 495 | + if(!$success) { |
|
| 496 | + log_message('error', "Invalid Title URL (MangaPanda): {$title_url}"); |
|
| 497 | + } |
|
| 474 | 498 | return $success; |
| 475 | 499 | } |
| 476 | 500 | public function isValidChapter(string $chapter) : bool { |
| 477 | 501 | $success = (bool) preg_match('/^[0-9]+$/', $chapter); |
| 478 | - if(!$success) log_message('error', 'Invalid Chapter (MangaPanda): '.$chapter); |
|
| 502 | + if(!$success) { |
|
| 503 | + log_message('error', 'Invalid Chapter (MangaPanda): '.$chapter); |
|
| 504 | + } |
|
| 479 | 505 | return $success; |
| 480 | 506 | } |
| 481 | 507 | |
@@ -525,12 +551,16 @@ discard block |
||
| 525 | 551 | |
| 526 | 552 | public function isValidTitleURL(string $title_url) : bool { |
| 527 | 553 | $success = (bool) preg_match('/^[a-z0-9_]+$/', $title_url); |
| 528 | - if(!$success) log_message('error', "Invalid Title URL (MangaStream): {$title_url}"); |
|
| 554 | + if(!$success) { |
|
| 555 | + log_message('error', "Invalid Title URL (MangaStream): {$title_url}"); |
|
| 556 | + } |
|
| 529 | 557 | return $success; |
| 530 | 558 | } |
| 531 | 559 | public function isValidChapter(string $chapter) : bool { |
| 532 | 560 | $success = (bool) preg_match('/^(.*?)\/[0-9]+$/', $chapter); |
| 533 | - if(!$success) log_message('error', 'Invalid Chapter (MangaStream): '.$chapter); |
|
| 561 | + if(!$success) { |
|
| 562 | + log_message('error', 'Invalid Chapter (MangaStream): '.$chapter); |
|
| 563 | + } |
|
| 534 | 564 | return $success; |
| 535 | 565 | } |
| 536 | 566 | |
@@ -548,7 +578,8 @@ discard block |
||
| 548 | 578 | |
| 549 | 579 | $content = $this->get_content($fullURL); |
| 550 | 580 | $data = $content['body']; |
| 551 | - if($data !== 'Can\'t find the manga series.') { //FIXME: We should check for he proper error here. |
|
| 581 | + if($data !== 'Can\'t find the manga series.') { |
|
| 582 | +//FIXME: We should check for he proper error here. |
|
| 552 | 583 | //$data = preg_replace('/^[\S\s]*(<body id="body">[\S\s]*<\/body>)[\S\s]*$/', '$1', $data); |
| 553 | 584 | |
| 554 | 585 | $dom = new DOMDocument(); |
@@ -602,12 +633,16 @@ discard block |
||
| 602 | 633 | |
| 603 | 634 | public function isValidTitleURL(string $title_url) : bool { |
| 604 | 635 | $success = (bool) preg_match('/^[0-9]+:--:(?:en|zh-hant|zh-hans|th|id):--:[a-z0-9-]+:--:(?:drama|fantasy|comedy|action|slice-of-life|romance|superhero|thriller|sports|sci-fi)$/', $title_url); |
| 605 | - if(!$success) log_message('error', "Invalid Title URL (WebToons): {$title_url}"); |
|
| 636 | + if(!$success) { |
|
| 637 | + log_message('error', "Invalid Title URL (WebToons): {$title_url}"); |
|
| 638 | + } |
|
| 606 | 639 | return $success; |
| 607 | 640 | } |
| 608 | 641 | public function isValidChapter(string $chapter) : bool { |
| 609 | 642 | $success = (bool) preg_match('/^[0-9]+:--:.*$/', $chapter); |
| 610 | - if(!$success) log_message('error', 'Invalid Chapter (WebToons): '.$chapter); |
|
| 643 | + if(!$success) { |
|
| 644 | + log_message('error', 'Invalid Chapter (WebToons): '.$chapter); |
|
| 645 | + } |
|
| 611 | 646 | return $success; |
| 612 | 647 | } |
| 613 | 648 | |
@@ -629,7 +664,8 @@ discard block |
||
| 629 | 664 | |
| 630 | 665 | $content = $this->get_content($fullURL); |
| 631 | 666 | $data = $content['body']; |
| 632 | - if($data !== 'Can\'t find the manga series.') { //FIXME: We should check for he proper error here. |
|
| 667 | + if($data !== 'Can\'t find the manga series.') { |
|
| 668 | +//FIXME: We should check for he proper error here. |
|
| 633 | 669 | $xml = simplexml_load_string($data) or die("Error: Cannot create object"); |
| 634 | 670 | if(isset($xml->{'channel'}->item[0])) { |
| 635 | 671 | $titleData['title'] = trim((string) $xml->{'channel'}->title); |
@@ -666,12 +702,16 @@ discard block |
||
| 666 | 702 | |
| 667 | 703 | public function isValidTitleURL(string $title_url) : bool { |
| 668 | 704 | $success = (bool) preg_match('/^[A-Za-z0-9-]+/', $title_url); |
| 669 | - if(!$success) log_message('error', "Invalid Title URL (KissManga): {$title_url}"); |
|
| 705 | + if(!$success) { |
|
| 706 | + log_message('error', "Invalid Title URL (KissManga): {$title_url}"); |
|
| 707 | + } |
|
| 670 | 708 | return $success; |
| 671 | 709 | } |
| 672 | 710 | public function isValidChapter(string $chapter) : bool { |
| 673 | 711 | $success = (bool) preg_match('/^.*?:--:[0-9]+$/', $chapter); |
| 674 | - if(!$success) log_message('error', 'Invalid Chapter (KissManga): '.$chapter); |
|
| 712 | + if(!$success) { |
|
| 713 | + log_message('error', 'Invalid Chapter (KissManga): '.$chapter); |
|
| 714 | + } |
|
| 675 | 715 | return $success; |
| 676 | 716 | } |
| 677 | 717 | |
@@ -741,12 +781,16 @@ discard block |
||
| 741 | 781 | |
| 742 | 782 | public function isValidTitleURL(string $title_url) : bool { |
| 743 | 783 | $success = (bool) preg_match('/^[a-z0-9_]+/', $title_url); |
| 744 | - if(!$success) log_message('error', "Invalid Title URL (KireiCake): {$title_url}"); |
|
| 784 | + if(!$success) { |
|
| 785 | + log_message('error', "Invalid Title URL (KireiCake): {$title_url}"); |
|
| 786 | + } |
|
| 745 | 787 | return $success; |
| 746 | 788 | } |
| 747 | 789 | public function isValidChapter(string $chapter) : bool { |
| 748 | 790 | $success = (bool) preg_match('/^en\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+)?)?)?$/', $chapter); |
| 749 | - if(!$success) log_message('error', 'Invalid Chapter (KireiCake): '.$chapter); |
|
| 791 | + if(!$success) { |
|
| 792 | + log_message('error', 'Invalid Chapter (KireiCake): '.$chapter); |
|
| 793 | + } |
|
| 750 | 794 | return $success; |
| 751 | 795 | } |
| 752 | 796 | |
@@ -805,12 +849,16 @@ discard block |
||
| 805 | 849 | |
| 806 | 850 | public function isValidTitleURL(string $title_url) : bool { |
| 807 | 851 | $success = (bool) preg_match('/^[a-z0-9-]+/', $title_url); |
| 808 | - if(!$success) log_message('error', "Invalid Title URL (GameOfScanlation): {$title_url}"); |
|
| 852 | + if(!$success) { |
|
| 853 | + log_message('error', "Invalid Title URL (GameOfScanlation): {$title_url}"); |
|
| 854 | + } |
|
| 809 | 855 | return $success; |
| 810 | 856 | } |
| 811 | 857 | public function isValidChapter(string $chapter) : bool { |
| 812 | 858 | $success = (bool) preg_match('/^[a-z0-9\.-]+$/', $chapter); |
| 813 | - if(!$success) log_message('error', 'Invalid Chapter (GameOfScanlation): '.$chapter); |
|
| 859 | + if(!$success) { |
|
| 860 | + log_message('error', 'Invalid Chapter (GameOfScanlation): '.$chapter); |
|
| 861 | + } |
|
| 814 | 862 | return $success; |
| 815 | 863 | } |
| 816 | 864 | |
@@ -869,12 +917,16 @@ discard block |
||
| 869 | 917 | |
| 870 | 918 | public function isValidTitleURL(string $title_url) : bool { |
| 871 | 919 | $success = (bool) preg_match('/^[a-zA-Z0-9_]+/', $title_url); |
| 872 | - if(!$success) log_message('error', "Invalid Title URL (MangaCow): {$title_url}"); |
|
| 920 | + if(!$success) { |
|
| 921 | + log_message('error', "Invalid Title URL (MangaCow): {$title_url}"); |
|
| 922 | + } |
|
| 873 | 923 | return $success; |
| 874 | 924 | } |
| 875 | 925 | public function isValidChapter(string $chapter) : bool { |
| 876 | 926 | $success = (bool) preg_match('/^[0-9]+$/', $chapter); |
| 877 | - if(!$success) log_message('error', 'Invalid Chapter (MangaCow): '.$chapter); |
|
| 927 | + if(!$success) { |
|
| 928 | + log_message('error', 'Invalid Chapter (MangaCow): '.$chapter); |
|
| 929 | + } |
|
| 878 | 930 | return $success; |
| 879 | 931 | } |
| 880 | 932 | |
@@ -930,12 +982,16 @@ discard block |
||
| 930 | 982 | |
| 931 | 983 | public function isValidTitleURL(string $title_url) : bool { |
| 932 | 984 | $success = (bool) preg_match('/^[a-z0-9_]+/', $title_url); |
| 933 | - if(!$success) log_message('error', "Invalid Title URL (SeaOtterScans): {$title_url}"); |
|
| 985 | + if(!$success) { |
|
| 986 | + log_message('error', "Invalid Title URL (SeaOtterScans): {$title_url}"); |
|
| 987 | + } |
|
| 934 | 988 | return $success; |
| 935 | 989 | } |
| 936 | 990 | public function isValidChapter(string $chapter) : bool { |
| 937 | 991 | $success = (bool) preg_match('/^en\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+)?)?)?$/', $chapter); |
| 938 | - if(!$success) log_message('error', 'Invalid Chapter (SeaOtterScans): '.$chapter); |
|
| 992 | + if(!$success) { |
|
| 993 | + log_message('error', 'Invalid Chapter (SeaOtterScans): '.$chapter); |
|
| 994 | + } |
|
| 939 | 995 | return $success; |
| 940 | 996 | } |
| 941 | 997 | |
@@ -999,12 +1055,16 @@ discard block |
||
| 999 | 1055 | |
| 1000 | 1056 | public function isValidTitleURL(string $title_url) : bool { |
| 1001 | 1057 | $success = (bool) preg_match('/^[a-z0-9_]+/', $title_url); |
| 1002 | - if(!$success) log_message('error', "Invalid Title URL (HelveticaScans): {$title_url}"); |
|
| 1058 | + if(!$success) { |
|
| 1059 | + log_message('error', "Invalid Title URL (HelveticaScans): {$title_url}"); |
|
| 1060 | + } |
|
| 1003 | 1061 | return $success; |
| 1004 | 1062 | } |
| 1005 | 1063 | public function isValidChapter(string $chapter) : bool { |
| 1006 | 1064 | $success = (bool) preg_match('/^en\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+)?)?)?$/', $chapter); |
| 1007 | - if(!$success) log_message('error', 'Invalid Chapter (HelveticaScans): '.$chapter); |
|
| 1065 | + if(!$success) { |
|
| 1066 | + log_message('error', 'Invalid Chapter (HelveticaScans): '.$chapter); |
|
| 1067 | + } |
|
| 1008 | 1068 | return $success; |
| 1009 | 1069 | } |
| 1010 | 1070 | |
@@ -1066,12 +1126,16 @@ discard block |
||
| 1066 | 1126 | |
| 1067 | 1127 | public function isValidTitleURL(string $title_url) : bool { |
| 1068 | 1128 | $success = (bool) preg_match('/^[a-z0-9_]+/', $title_url); |
| 1069 | - if(!$success) log_message('error', "Invalid Title URL (SenseScans): {$title_url}"); |
|
| 1129 | + if(!$success) { |
|
| 1130 | + log_message('error', "Invalid Title URL (SenseScans): {$title_url}"); |
|
| 1131 | + } |
|
| 1070 | 1132 | return $success; |
| 1071 | 1133 | } |
| 1072 | 1134 | public function isValidChapter(string $chapter) : bool { |
| 1073 | 1135 | $success = (bool) preg_match('/^en\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+)?)?)?$/', $chapter); |
| 1074 | - if(!$success) log_message('error', 'Invalid Chapter (SenseScans): '.$chapter); |
|
| 1136 | + if(!$success) { |
|
| 1137 | + log_message('error', 'Invalid Chapter (SenseScans): '.$chapter); |
|
| 1138 | + } |
|
| 1075 | 1139 | return $success; |
| 1076 | 1140 | } |
| 1077 | 1141 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 1 | +<?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed'); |
|
| 2 | 2 | |
| 3 | 3 | abstract class Site_Model extends CI_Model { |
| 4 | 4 | public function __construct() { |
@@ -303,9 +303,9 @@ discard block |
||
| 303 | 303 | if(strpos($data, '>Register now<') === FALSE) { |
| 304 | 304 | //Auth was successful |
| 305 | 305 | $dom = new DOMDocument(); |
| 306 | - libxml_use_internal_errors(true); |
|
| 306 | + libxml_use_internal_errors(TRUE); |
|
| 307 | 307 | $dom->loadHTML($data); |
| 308 | - libxml_use_internal_errors(false); |
|
| 308 | + libxml_use_internal_errors(FALSE); |
|
| 309 | 309 | |
| 310 | 310 | $xpath = new DOMXPath($dom); |
| 311 | 311 | $nodes = $xpath->query("(//div/div)[last()]/table/tbody/tr[2]"); |
@@ -490,9 +490,9 @@ discard block |
||
| 490 | 490 | //$data = preg_replace('/^[\S\s]*(<body id="body">[\S\s]*<\/body>)[\S\s]*$/', '$1', $data); |
| 491 | 491 | |
| 492 | 492 | $dom = new DOMDocument(); |
| 493 | - libxml_use_internal_errors(true); |
|
| 493 | + libxml_use_internal_errors(TRUE); |
|
| 494 | 494 | $dom->loadHTML($data); |
| 495 | - libxml_use_internal_errors(false); |
|
| 495 | + libxml_use_internal_errors(FALSE); |
|
| 496 | 496 | |
| 497 | 497 | $xpath = new DOMXPath($dom); |
| 498 | 498 | |
@@ -552,9 +552,9 @@ discard block |
||
| 552 | 552 | //$data = preg_replace('/^[\S\s]*(<body id="body">[\S\s]*<\/body>)[\S\s]*$/', '$1', $data); |
| 553 | 553 | |
| 554 | 554 | $dom = new DOMDocument(); |
| 555 | - libxml_use_internal_errors(true); |
|
| 555 | + libxml_use_internal_errors(TRUE); |
|
| 556 | 556 | $dom->loadHTML($data); |
| 557 | - libxml_use_internal_errors(false); |
|
| 557 | + libxml_use_internal_errors(FALSE); |
|
| 558 | 558 | |
| 559 | 559 | $xpath = new DOMXPath($dom); |
| 560 | 560 | |
@@ -702,9 +702,9 @@ discard block |
||
| 702 | 702 | $data = preg_replace('/^[\S\s]*(<div id="leftside">[\S\s]*)<div id="rightside">[\S\s]*$/', '$1', $data); |
| 703 | 703 | |
| 704 | 704 | $dom = new DOMDocument(); |
| 705 | - libxml_use_internal_errors(true); |
|
| 705 | + libxml_use_internal_errors(TRUE); |
|
| 706 | 706 | $dom->loadHTML($data); |
| 707 | - libxml_use_internal_errors(false); |
|
| 707 | + libxml_use_internal_errors(FALSE); |
|
| 708 | 708 | |
| 709 | 709 | $xpath = new DOMXPath($dom); |
| 710 | 710 | |
@@ -771,9 +771,9 @@ discard block |
||
| 771 | 771 | $data = preg_replace('/^[\S\s]*(<article>[\S\s]*)<\/article>[\S\s]*$/', '$1', $data); |
| 772 | 772 | |
| 773 | 773 | $dom = new DOMDocument(); |
| 774 | - libxml_use_internal_errors(true); |
|
| 774 | + libxml_use_internal_errors(TRUE); |
|
| 775 | 775 | $dom->loadHTML($data); |
| 776 | - libxml_use_internal_errors(false); |
|
| 776 | + libxml_use_internal_errors(FALSE); |
|
| 777 | 777 | |
| 778 | 778 | $xpath = new DOMXPath($dom); |
| 779 | 779 | |
@@ -832,9 +832,9 @@ discard block |
||
| 832 | 832 | //$data = preg_replace('/^[\S\s]*(<ol[\S\s]*)<\/ol>[\S\s]*$/', '$1', $data); |
| 833 | 833 | |
| 834 | 834 | $dom = new DOMDocument(); |
| 835 | - libxml_use_internal_errors(true); |
|
| 835 | + libxml_use_internal_errors(TRUE); |
|
| 836 | 836 | $dom->loadHTML($data); |
| 837 | - libxml_use_internal_errors(false); |
|
| 837 | + libxml_use_internal_errors(FALSE); |
|
| 838 | 838 | |
| 839 | 839 | $xpath = new DOMXPath($dom); |
| 840 | 840 | |
@@ -894,9 +894,9 @@ discard block |
||
| 894 | 894 | $data = $content['body']; |
| 895 | 895 | if(strpos($data, '404 Page Not Found') === FALSE) { |
| 896 | 896 | $dom = new DOMDocument(); |
| 897 | - libxml_use_internal_errors(true); |
|
| 897 | + libxml_use_internal_errors(TRUE); |
|
| 898 | 898 | $dom->loadHTML($data); |
| 899 | - libxml_use_internal_errors(false); |
|
| 899 | + libxml_use_internal_errors(FALSE); |
|
| 900 | 900 | |
| 901 | 901 | $xpath = new DOMXPath($dom); |
| 902 | 902 | |
@@ -960,9 +960,9 @@ discard block |
||
| 960 | 960 | $data = preg_replace('/^[\S\s]*(<article[\S\s]*)<\/article>[\S\s]*$/', '$1', $data); |
| 961 | 961 | |
| 962 | 962 | $dom = new DOMDocument(); |
| 963 | - libxml_use_internal_errors(true); |
|
| 963 | + libxml_use_internal_errors(TRUE); |
|
| 964 | 964 | $dom->loadHTML($data); |
| 965 | - libxml_use_internal_errors(false); |
|
| 965 | + libxml_use_internal_errors(FALSE); |
|
| 966 | 966 | |
| 967 | 967 | $xpath = new DOMXPath($dom); |
| 968 | 968 | |
@@ -1029,9 +1029,9 @@ discard block |
||
| 1029 | 1029 | $data = preg_replace('/^[\S\s]*(<article[\S\s]*)<\/article>[\S\s]*$/', '$1', $data); |
| 1030 | 1030 | |
| 1031 | 1031 | $dom = new DOMDocument(); |
| 1032 | - libxml_use_internal_errors(true); |
|
| 1032 | + libxml_use_internal_errors(TRUE); |
|
| 1033 | 1033 | $dom->loadHTML($data); |
| 1034 | - libxml_use_internal_errors(false); |
|
| 1034 | + libxml_use_internal_errors(FALSE); |
|
| 1035 | 1035 | |
| 1036 | 1036 | $xpath = new DOMXPath($dom); |
| 1037 | 1037 | |
@@ -1096,9 +1096,9 @@ discard block |
||
| 1096 | 1096 | $data = preg_replace('/^[\S\s]*(<article[\S\s]*)<\/article>[\S\s]*$/', '$1', $data); |
| 1097 | 1097 | |
| 1098 | 1098 | $dom = new DOMDocument(); |
| 1099 | - libxml_use_internal_errors(true); |
|
| 1099 | + libxml_use_internal_errors(TRUE); |
|
| 1100 | 1100 | $dom->loadHTML($data); |
| 1101 | - libxml_use_internal_errors(false); |
|
| 1101 | + libxml_use_internal_errors(FALSE); |
|
| 1102 | 1102 | |
| 1103 | 1103 | $xpath = new DOMXPath($dom); |
| 1104 | 1104 | |