@@ -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 | class Site_Model extends CI_Model { |
| 4 | 4 | public function __construct() { |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | public function isValidTitleURL(string $title_url) : bool {} |
| 17 | 17 | public function isValidChapter(string $chapter): bool {} |
| 18 | 18 | |
| 19 | - protected function get_content(string $url, string $cookie_string = "", string $cookiejar_path = "", bool $follow_redirect = FALSE){ |
|
| 19 | + protected function get_content(string $url, string $cookie_string = "", string $cookiejar_path = "", bool $follow_redirect = FALSE) { |
|
| 20 | 20 | $ch = curl_init(); |
| 21 | 21 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 22 | - curl_setopt($ch, CURLOPT_ENCODING , "gzip"); |
|
| 22 | + curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
| 23 | 23 | |
| 24 | 24 | if($follow_redirect) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
| 25 | 25 | |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | $link = preg_replace('/^(.*\/)(?:[0-9]+\.html)?$/', '$1', (string) $nodes_chapter[0]->getAttribute('href')); |
| 117 | 117 | $chapterURLSegments = explode('/', $link); |
| 118 | - $titleData['latest_chapter'] = $chapterURLSegments[5] . (isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
| 119 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue)); |
|
| 118 | + $titleData['latest_chapter'] = $chapterURLSegments[5].(isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
| 119 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue)); |
|
| 120 | 120 | } |
| 121 | 121 | } else { |
| 122 | 122 | //TODO: Throw ERRORS; |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | $link = preg_replace('/^(.*\/)(?:[0-9]+\.html)?$/', '$1', (string) $nodes_chapter[0]->getAttribute('href')); |
| 177 | 177 | $chapterURLSegments = explode('/', $link); |
| 178 | - $titleData['latest_chapter'] = $chapterURLSegments[5] . (isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
| 179 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue)); |
|
| 178 | + $titleData['latest_chapter'] = $chapterURLSegments[5].(isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
| 179 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue)); |
|
| 180 | 180 | } |
| 181 | 181 | } else { |
| 182 | 182 | //TODO: Throw ERRORS; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | $chapter_parts = explode(':--:', $chapter); |
| 219 | 219 | return [ |
| 220 | - 'url' => "http://bato.to/reader#" . $chapter_parts[0], |
|
| 220 | + 'url' => "http://bato.to/reader#".$chapter_parts[0], |
|
| 221 | 221 | 'number' => $chapter_parts[1] |
| 222 | 222 | ]; |
| 223 | 223 | } |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | //Bato.to is annoying and locks stuff behind auth. See: https://github.com/DakuTree/manga-tracker/issues/14#issuecomment-233830855 |
| 234 | 234 | $cookies = [ |
| 235 | 235 | "lang_option={$title_lang}", |
| 236 | - "member_id=" . $this->config->item('batoto_cookie_member_id'), |
|
| 237 | - "pass_hash=" . $this->config->item('batoto_cookie_pass_hash') |
|
| 236 | + "member_id=".$this->config->item('batoto_cookie_member_id'), |
|
| 237 | + "pass_hash=".$this->config->item('batoto_cookie_pass_hash') |
|
| 238 | 238 | ]; |
| 239 | 239 | $data = $this->get_content($title_url, implode("; ", $cookies), "", TRUE); |
| 240 | 240 | if(!$data) { |
@@ -266,13 +266,13 @@ discard block |
||
| 266 | 266 | preg_match('/^(?:Vol\.(?<volume>\S+) )?(?:Ch.(?<chapter>[^\s:]+)):?.*/', trim($chapter_element->nodeValue), $text); |
| 267 | 267 | |
| 268 | 268 | $titleData['title'] = html_entity_decode(trim($xpath->query('//h1[@class="ipsType_pagetitle"]')->item(0)->nodeValue)); |
| 269 | - $titleData['latest_chapter'] = substr($chapter_element->getAttribute('href'), 22) . ':--:' . ((!empty($text['volume']) ? 'v'.$text['volume'].'/' : '') . 'c'.$text['chapter']); |
|
| 269 | + $titleData['latest_chapter'] = substr($chapter_element->getAttribute('href'), 22).':--:'.((!empty($text['volume']) ? 'v'.$text['volume'].'/' : '').'c'.$text['chapter']); |
|
| 270 | 270 | |
| 271 | 271 | $dateString = $updated_element->nodeValue; |
| 272 | 272 | if($dateString == 'An hour ago') { |
| 273 | 273 | $dateString = '1 hour ago'; |
| 274 | 274 | } |
| 275 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(preg_replace('/ (-|\[A\]).*$/', '', $dateString))); |
|
| 275 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(preg_replace('/ (-|\[A\]).*$/', '', $dateString))); |
|
| 276 | 276 | } else { |
| 277 | 277 | log_message('error', "Batoto: Regex missing <td> ({$title_url})"); |
| 278 | 278 | return NULL; |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | |
| 322 | 322 | $chapterData = [ |
| 323 | - 'url' => 'http://dynasty-scans.com/chapters/' . $title_parts[0].'_'.$chapter, |
|
| 323 | + 'url' => 'http://dynasty-scans.com/chapters/'.$title_parts[0].'_'.$chapter, |
|
| 324 | 324 | 'number' => '' |
| 325 | 325 | ]; |
| 326 | 326 | |
@@ -360,14 +360,14 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | preg_match('/<b>.*<\/b>/', $data, $matchesT); |
| 362 | 362 | preg_match('/\/doujins\/[^"]+">(.+)?(?=<\/a>)<\/a>/', $data, $matchesD); |
| 363 | - $titleData['title'] = (!empty($matchesD) ? (substr($matchesD[1], 0, -7) !== 'Original' ? substr($matchesD[1], 0, -7).' - ' : '') : '') . substr($matchesT[0], 3, -4); |
|
| 363 | + $titleData['title'] = (!empty($matchesD) ? (substr($matchesD[1], 0, -7) !== 'Original' ? substr($matchesD[1], 0, -7).' - ' : '') : '').substr($matchesT[0], 3, -4); |
|
| 364 | 364 | |
| 365 | 365 | $data = preg_replace('/^[\S\s]*(<dl class=\'chapter-list\'>[\S\s]*<\/dl>)[\S\s]*$/', '$1', $data); |
| 366 | 366 | preg_match_all('/<dd>[\s\S]+?(?=<\/dd>)<\/dd>/', $data, $matches); |
| 367 | 367 | $latest_chapter_html = array_pop($matches[0]); |
| 368 | 368 | |
| 369 | 369 | preg_match('/\/chapters\/([^"]+)/', $latest_chapter_html, $matches); |
| 370 | - $titleData['latest_chapter'] = substr($matches[1], strlen($title_url)+1); |
|
| 370 | + $titleData['latest_chapter'] = substr($matches[1], strlen($title_url) + 1); |
|
| 371 | 371 | //FIXME: THIS IS A TEMP FIX, SEE https://github.com/DakuTree/manga-tracker/issues/58 |
| 372 | 372 | if(!$titleData['latest_chapter']) { |
| 373 | 373 | log_message('error', 'DynastyScans::getTitleData cannot parse title properly as it contains oneshot. || URL: '.$title_url); |
@@ -375,13 +375,13 @@ discard block |
||
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | preg_match('/<small>released (.*)<\/small>/', $latest_chapter_html, $matches); |
| 378 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(str_replace('\'', '', $matches[1]))); |
|
| 378 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(str_replace('\'', '', $matches[1]))); |
|
| 379 | 379 | } elseif($title_parts[1] == '1') { |
| 380 | 380 | $data = $this->get_content('http://dynasty-scans.com/chapters/'.$title_url); |
| 381 | 381 | |
| 382 | 382 | preg_match('/<b>.*<\/b>/', $data, $matchesT); |
| 383 | 383 | preg_match('/\/doujins\/[^"]+">(.+)?(?=<\/a>)<\/a>/', $data, $matchesD); |
| 384 | - $titleData['title'] = (!empty($matchesD) ? ($matchesD[1] !== 'Original' ? $matchesD[1].' - ' : '') : '') . substr($matchesT[0], 3, -4); |
|
| 384 | + $titleData['title'] = (!empty($matchesD) ? ($matchesD[1] !== 'Original' ? $matchesD[1].' - ' : '') : '').substr($matchesT[0], 3, -4); |
|
| 385 | 385 | |
| 386 | 386 | $titleData['latest_chapter'] = 'oneshot'; //This will never change |
| 387 | 387 | |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | $nodes_chapter = $xpath->query("td[1]/a", $nodes_row[0]); |
| 448 | 448 | |
| 449 | 449 | $titleData['latest_chapter'] = preg_replace('/^.*\/([0-9]+)$/', '$1', (string) $nodes_chapter[0]->getAttribute('href')); |
| 450 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue)); |
|
| 450 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue)); |
|
| 451 | 451 | } |
| 452 | 452 | } else { |
| 453 | 453 | //TODO: Throw ERRORS; |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | $nodes_chapter = $xpath->query("td[1]/a", $nodes_row[0]); |
| 506 | 506 | |
| 507 | 507 | $titleData['latest_chapter'] = preg_replace('/^.*\/(.*?\/[0-9]+)\/[0-9]+$/', '$1', (string) $nodes_chapter[0]->getAttribute('href')); |
| 508 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue)); |
|
| 508 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->nodeValue)); |
|
| 509 | 509 | } |
| 510 | 510 | } else { |
| 511 | 511 | //TODO: Throw ERRORS; |
@@ -570,8 +570,8 @@ discard block |
||
| 570 | 570 | $titleData['title'] = trim((string) $xml->channel->title); |
| 571 | 571 | |
| 572 | 572 | $chapterURLSegments = explode('/', ((string) $xml->channel->item[0]->link)); |
| 573 | - $titleData['latest_chapter'] = preg_replace('/^.*?([0-9]+)$/', '$1', $chapterURLSegments[7]) . ':--:' . $chapterURLSegments[6]; |
|
| 574 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $xml->channel->item[0]->pubDate)); |
|
| 573 | + $titleData['latest_chapter'] = preg_replace('/^.*?([0-9]+)$/', '$1', $chapterURLSegments[7]).':--:'.$chapterURLSegments[6]; |
|
| 574 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $xml->channel->item[0]->pubDate)); |
|
| 575 | 575 | } |
| 576 | 576 | } else { |
| 577 | 577 | //TODO: Throw ERRORS; |
@@ -650,8 +650,8 @@ discard block |
||
| 650 | 650 | |
| 651 | 651 | $link = (string) $nodes_chapter[0]->getAttribute('href'); |
| 652 | 652 | $chapterURLSegments = explode('/', preg_replace('/\?.*$/', '', $link)); |
| 653 | - $titleData['latest_chapter'] = $chapterURLSegments[3] . ':--:' . preg_replace('/.*?([0-9]+)$/', '$1', $link); |
|
| 654 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->textContent)); |
|
| 653 | + $titleData['latest_chapter'] = $chapterURLSegments[3].':--:'.preg_replace('/.*?([0-9]+)$/', '$1', $link); |
|
| 654 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest[0]->textContent)); |
|
| 655 | 655 | } |
| 656 | 656 | } else { |
| 657 | 657 | //TODO: Throw ERRORS; |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | $chapter_parts = explode('/', $chapter); |
| 687 | 687 | return [ |
| 688 | 688 | 'url' => "https://reader.kireicake.com/read/{$title_url}/{$chapter}", |
| 689 | - 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 689 | + 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
| 690 | 690 | ]; |
| 691 | 691 | } |
| 692 | 692 | |
@@ -717,7 +717,7 @@ discard block |
||
| 717 | 717 | |
| 718 | 718 | $link = (string) $nodes_chapter[0]->getAttribute('href'); |
| 719 | 719 | $titleData['latest_chapter'] = preg_replace('/.*\/read\/.*?\/(.*?)\/$/', '$1', $link); |
| 720 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) str_replace('.', '', explode(',', $nodes_latest[0]->textContent)[1]))); |
|
| 720 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) str_replace('.', '', explode(',', $nodes_latest[0]->textContent)[1]))); |
|
| 721 | 721 | } |
| 722 | 722 | } else { |
| 723 | 723 | //TODO: Throw ERRORS; |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | |
| 776 | 776 | $link = (string) $nodes_chapter[0]->getAttribute('href'); |
| 777 | 777 | $titleData['latest_chapter'] = preg_replace('/^projects\/.*?\/(.*?)\/$/', '$1', $link); |
| 778 | - $titleData['last_updated'] = date("Y-m-d H:i:s", (int) $nodes_latest[0]->getAttribute('data-time')); |
|
| 778 | + $titleData['last_updated'] = date("Y-m-d H:i:s", (int) $nodes_latest[0]->getAttribute('data-time')); |
|
| 779 | 779 | } else { |
| 780 | 780 | log_message('error', "GameOfScanlation: Unable to find nodes."); |
| 781 | 781 | return NULL; |
@@ -16,15 +16,21 @@ discard block |
||
| 16 | 16 | public function isValidTitleURL(string $title_url) : bool {} |
| 17 | 17 | public function isValidChapter(string $chapter): bool {} |
| 18 | 18 | |
| 19 | - protected function get_content(string $url, string $cookie_string = "", string $cookiejar_path = "", bool $follow_redirect = FALSE){ |
|
| 19 | + protected function get_content(string $url, string $cookie_string = "", string $cookiejar_path = "", bool $follow_redirect = FALSE) { |
|
| 20 | 20 | $ch = curl_init(); |
| 21 | 21 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 22 | 22 | curl_setopt($ch, CURLOPT_ENCODING , "gzip"); |
| 23 | 23 | |
| 24 | - if($follow_redirect) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 24 | + if($follow_redirect) { |
|
| 25 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
| 26 | + } |
|
| 25 | 27 | |
| 26 | - if(!empty($cookie_string)) curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 27 | - if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 28 | + if(!empty($cookie_string)) { |
|
| 29 | + curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
| 30 | + } |
|
| 31 | + if(!empty($cookiejar_path)) { |
|
| 32 | + curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
| 33 | + } |
|
| 28 | 34 | |
| 29 | 35 | //Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff. |
| 30 | 36 | 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'); |
@@ -72,12 +78,16 @@ discard block |
||
| 72 | 78 | |
| 73 | 79 | public function isValidTitleURL(string $title_url) : bool { |
| 74 | 80 | $success = (bool) preg_match('/^[a-z0-9_]+$/', $title_url); |
| 75 | - if(!$success) log_message('error', "Invalid Title URL (MangaFox): {$title_url}"); |
|
| 81 | + if(!$success) { |
|
| 82 | + log_message('error', "Invalid Title URL (MangaFox): {$title_url}"); |
|
| 83 | + } |
|
| 76 | 84 | return $success; |
| 77 | 85 | } |
| 78 | 86 | public function isValidChapter(string $chapter) : bool { |
| 79 | 87 | $success = (bool) preg_match('/^(?:v[0-9a-zA-Z]+\/)?c[0-9\.]+$/', $chapter); |
| 80 | - if(!$success) log_message('error', 'Invalid Chapter (MangaFox): '.$chapter); |
|
| 88 | + if(!$success) { |
|
| 89 | + log_message('error', 'Invalid Chapter (MangaFox): '.$chapter); |
|
| 90 | + } |
|
| 81 | 91 | return $success; |
| 82 | 92 | } |
| 83 | 93 | |
@@ -133,12 +143,16 @@ discard block |
||
| 133 | 143 | |
| 134 | 144 | public function isValidTitleURL(string $title_url) : bool { |
| 135 | 145 | $success = (bool) preg_match('/^[a-z0-9_]+$/', $title_url); |
| 136 | - if(!$success) log_message('error', "Invalid Title URL (MangaFox): {$title_url}"); |
|
| 146 | + if(!$success) { |
|
| 147 | + log_message('error', "Invalid Title URL (MangaFox): {$title_url}"); |
|
| 148 | + } |
|
| 137 | 149 | return $success; |
| 138 | 150 | } |
| 139 | 151 | public function isValidChapter(string $chapter) : bool { |
| 140 | 152 | $success = (bool) preg_match('/^(?:v[0-9]+\/)?c[0-9]+(?:\.[0-9]+)?$/', $chapter); |
| 141 | - if(!$success) log_message('error', 'Invalid Chapter (MangaFox): '.$chapter); |
|
| 153 | + if(!$success) { |
|
| 154 | + log_message('error', 'Invalid Chapter (MangaFox): '.$chapter); |
|
| 155 | + } |
|
| 142 | 156 | return $success; |
| 143 | 157 | } |
| 144 | 158 | |
@@ -200,7 +214,9 @@ discard block |
||
| 200 | 214 | |
| 201 | 215 | public function isValidTitleURL(string $title_url) : bool { |
| 202 | 216 | $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); |
| 203 | - if(!$success) log_message('error', "Invalid Title URL (Batoto): {$title_url}"); |
|
| 217 | + if(!$success) { |
|
| 218 | + log_message('error', "Invalid Title URL (Batoto): {$title_url}"); |
|
| 219 | + } |
|
| 204 | 220 | return $success; |
| 205 | 221 | } |
| 206 | 222 | public function isValidChapter(string $chapter) : bool { |
@@ -208,7 +224,9 @@ discard block |
||
| 208 | 224 | // Preferably we'd just use /^[0-9a-z]+:--:(v[0-9]+\/)?c[0-9]+(\.[0-9]+)?$/ |
| 209 | 225 | |
| 210 | 226 | $success = (bool) preg_match('/^[0-9a-z]+:--:.+$/', $chapter); |
| 211 | - if(!$success) log_message('error', 'Invalid Chapter (Batoto): '.$chapter); |
|
| 227 | + if(!$success) { |
|
| 228 | + log_message('error', 'Invalid Chapter (Batoto): '.$chapter); |
|
| 229 | + } |
|
| 212 | 230 | return $success; |
| 213 | 231 | } |
| 214 | 232 | |
@@ -301,12 +319,16 @@ discard block |
||
| 301 | 319 | |
| 302 | 320 | public function isValidTitleURL(string $title_url) : bool { |
| 303 | 321 | $success = (bool) preg_match('/^[a-z0-9_]+:--:(?:0|1)$/', $title_url); |
| 304 | - if(!$success) log_message('error', "Invalid Title URL (DynastyScans): {$title_url}"); |
|
| 322 | + if(!$success) { |
|
| 323 | + log_message('error', "Invalid Title URL (DynastyScans): {$title_url}"); |
|
| 324 | + } |
|
| 305 | 325 | return $success; |
| 306 | 326 | } |
| 307 | 327 | public function isValidChapter(string $chapter) : bool { |
| 308 | 328 | $success = (bool) preg_match('/^[0-9a-z_]+$/', $chapter); |
| 309 | - if(!$success) log_message('error', 'Invalid Chapter (DynastyScans): '.$chapter); |
|
| 329 | + if(!$success) { |
|
| 330 | + log_message('error', 'Invalid Chapter (DynastyScans): '.$chapter); |
|
| 331 | + } |
|
| 310 | 332 | return $success; |
| 311 | 333 | } |
| 312 | 334 | |
@@ -412,12 +434,16 @@ discard block |
||
| 412 | 434 | |
| 413 | 435 | public function isValidTitleURL(string $title_url) : bool { |
| 414 | 436 | $success = (bool) preg_match('/^[a-z0-9-]+$/', $title_url); |
| 415 | - if(!$success) log_message('error', "Invalid Title URL (MangaPanda): {$title_url}"); |
|
| 437 | + if(!$success) { |
|
| 438 | + log_message('error', "Invalid Title URL (MangaPanda): {$title_url}"); |
|
| 439 | + } |
|
| 416 | 440 | return $success; |
| 417 | 441 | } |
| 418 | 442 | public function isValidChapter(string $chapter) : bool { |
| 419 | 443 | $success = (bool) preg_match('/^[0-9]+$/', $chapter); |
| 420 | - if(!$success) log_message('error', 'Invalid Chapter (MangaPanda): '.$chapter); |
|
| 444 | + if(!$success) { |
|
| 445 | + log_message('error', 'Invalid Chapter (MangaPanda): '.$chapter); |
|
| 446 | + } |
|
| 421 | 447 | return $success; |
| 422 | 448 | } |
| 423 | 449 | |
@@ -464,12 +490,16 @@ discard block |
||
| 464 | 490 | |
| 465 | 491 | public function isValidTitleURL(string $title_url) : bool { |
| 466 | 492 | $success = (bool) preg_match('/^[a-z0-9_]+$/', $title_url); |
| 467 | - if(!$success) log_message('error', "Invalid Title URL (MangaStream): {$title_url}"); |
|
| 493 | + if(!$success) { |
|
| 494 | + log_message('error', "Invalid Title URL (MangaStream): {$title_url}"); |
|
| 495 | + } |
|
| 468 | 496 | return $success; |
| 469 | 497 | } |
| 470 | 498 | public function isValidChapter(string $chapter) : bool { |
| 471 | 499 | $success = (bool) preg_match('/^(.*?)\/[0-9]+$/', $chapter); |
| 472 | - if(!$success) log_message('error', 'Invalid Chapter (MangaStream): '.$chapter); |
|
| 500 | + if(!$success) { |
|
| 501 | + log_message('error', 'Invalid Chapter (MangaStream): '.$chapter); |
|
| 502 | + } |
|
| 473 | 503 | return $success; |
| 474 | 504 | } |
| 475 | 505 | |
@@ -538,12 +568,16 @@ discard block |
||
| 538 | 568 | |
| 539 | 569 | public function isValidTitleURL(string $title_url) : bool { |
| 540 | 570 | $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); |
| 541 | - if(!$success) log_message('error', "Invalid Title URL (WebToons): {$title_url}"); |
|
| 571 | + if(!$success) { |
|
| 572 | + log_message('error', "Invalid Title URL (WebToons): {$title_url}"); |
|
| 573 | + } |
|
| 542 | 574 | return $success; |
| 543 | 575 | } |
| 544 | 576 | public function isValidChapter(string $chapter) : bool { |
| 545 | 577 | $success = (bool) preg_match('/^[0-9]+:--:.*$/', $chapter); |
| 546 | - if(!$success) log_message('error', 'Invalid Chapter (WebToons): '.$chapter); |
|
| 578 | + if(!$success) { |
|
| 579 | + log_message('error', 'Invalid Chapter (WebToons): '.$chapter); |
|
| 580 | + } |
|
| 547 | 581 | return $success; |
| 548 | 582 | } |
| 549 | 583 | |
@@ -600,12 +634,16 @@ discard block |
||
| 600 | 634 | |
| 601 | 635 | public function isValidTitleURL(string $title_url) : bool { |
| 602 | 636 | $success = (bool) preg_match('/^[A-Za-z0-9-]+/', $title_url); |
| 603 | - if(!$success) log_message('error', "Invalid Title URL (KissManga): {$title_url}"); |
|
| 637 | + if(!$success) { |
|
| 638 | + log_message('error', "Invalid Title URL (KissManga): {$title_url}"); |
|
| 639 | + } |
|
| 604 | 640 | return $success; |
| 605 | 641 | } |
| 606 | 642 | public function isValidChapter(string $chapter) : bool { |
| 607 | 643 | $success = (bool) preg_match('/^.*?:--:[0-9]+$/', $chapter); |
| 608 | - if(!$success) log_message('error', 'Invalid Chapter (KissManga): '.$chapter); |
|
| 644 | + if(!$success) { |
|
| 645 | + log_message('error', 'Invalid Chapter (KissManga): '.$chapter); |
|
| 646 | + } |
|
| 609 | 647 | return $success; |
| 610 | 648 | } |
| 611 | 649 | |
@@ -672,12 +710,16 @@ discard block |
||
| 672 | 710 | |
| 673 | 711 | public function isValidTitleURL(string $title_url) : bool { |
| 674 | 712 | $success = (bool) preg_match('/^[a-z0-9_]+/', $title_url); |
| 675 | - if(!$success) log_message('error', "Invalid Title URL (KireiCake): {$title_url}"); |
|
| 713 | + if(!$success) { |
|
| 714 | + log_message('error', "Invalid Title URL (KireiCake): {$title_url}"); |
|
| 715 | + } |
|
| 676 | 716 | return $success; |
| 677 | 717 | } |
| 678 | 718 | public function isValidChapter(string $chapter) : bool { |
| 679 | 719 | $success = (bool) preg_match('/^en\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+)?)?)?$/', $chapter); |
| 680 | - if(!$success) log_message('error', 'Invalid Chapter (KireiCake): '.$chapter); |
|
| 720 | + if(!$success) { |
|
| 721 | + log_message('error', 'Invalid Chapter (KireiCake): '.$chapter); |
|
| 722 | + } |
|
| 681 | 723 | return $success; |
| 682 | 724 | } |
| 683 | 725 | |
@@ -734,12 +776,16 @@ discard block |
||
| 734 | 776 | |
| 735 | 777 | public function isValidTitleURL(string $title_url) : bool { |
| 736 | 778 | $success = (bool) preg_match('/^[a-z0-9-]+/', $title_url); |
| 737 | - if(!$success) log_message('error', "Invalid Title URL (GameOfScanlation): {$title_url}"); |
|
| 779 | + if(!$success) { |
|
| 780 | + log_message('error', "Invalid Title URL (GameOfScanlation): {$title_url}"); |
|
| 781 | + } |
|
| 738 | 782 | return $success; |
| 739 | 783 | } |
| 740 | 784 | public function isValidChapter(string $chapter) : bool { |
| 741 | 785 | $success = (bool) preg_match('/^[a-z0-9\.-]+$/', $chapter); |
| 742 | - if(!$success) log_message('error', 'Invalid Chapter (GameOfScanlation): '.$chapter); |
|
| 786 | + if(!$success) { |
|
| 787 | + log_message('error', 'Invalid Chapter (GameOfScanlation): '.$chapter); |
|
| 788 | + } |
|
| 743 | 789 | return $success; |
| 744 | 790 | } |
| 745 | 791 | |