|
@@ -120,7 +120,7 @@ discard block |
|
|
block discarded – undo |
|
120
|
120
|
//We don't want double trailing slashes, so fix this when possible. |
|
121
|
121
|
$pageSeparator = ''; |
|
122
|
122
|
} |
|
123
|
|
- $pageURL = $chapterData['url'] . $pageSeparator . $page; |
|
|
123
|
+ $pageURL = $chapterData['url'].$pageSeparator.$page; |
|
124
|
124
|
} |
|
125
|
125
|
return $pageURL; |
|
126
|
126
|
} |
|
@@ -214,7 +214,7 @@ discard block |
|
|
block discarded – undo |
|
214
|
214
|
|
|
215
|
215
|
$ch = curl_init(); |
|
216
|
216
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
217
|
|
- curl_setopt($ch, CURLOPT_ENCODING , 'gzip'); |
|
|
217
|
+ curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); |
|
218
|
218
|
//curl_setopt($ch, CURLOPT_VERBOSE, 1); |
|
219
|
219
|
curl_setopt($ch, CURLOPT_HEADER, 1); |
|
220
|
220
|
|
|
@@ -241,8 +241,8 @@ discard block |
|
|
block discarded – undo |
|
241
|
241
|
curl_setopt($ch, CURLOPT_URL, $url); |
|
242
|
242
|
|
|
243
|
243
|
if($isPost) { |
|
244
|
|
- curl_setopt($ch,CURLOPT_POST, count($postFields)); |
|
245
|
|
- curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($postFields)); |
|
|
244
|
+ curl_setopt($ch, CURLOPT_POST, count($postFields)); |
|
|
245
|
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postFields)); |
|
246
|
246
|
} |
|
247
|
247
|
|
|
248
|
248
|
$response = curl_exec($ch); |
|
@@ -289,7 +289,7 @@ discard block |
|
|
block discarded – undo |
|
289
|
289
|
$result = shell_exec('python '.APPPATH.'../_scripts/get_cloudflare_cookie.py '.escapeshellarg(json_encode($urlData))); |
|
290
|
290
|
$cookieData = json_decode($result, TRUE); |
|
291
|
291
|
|
|
292
|
|
- $this->cache->save("cloudflare_{$this->site}", $cookieData['cookies'], 31536000 /* 1 year, or until we renew it */); |
|
|
292
|
+ $this->cache->save("cloudflare_{$this->site}", $cookieData['cookies'], 31536000 /* 1 year, or until we renew it */); |
|
293
|
293
|
log_message('debug', "Saving CloudFlare Cookies for {$this->site}"); |
|
294
|
294
|
|
|
295
|
295
|
$refresh = TRUE; |
|
@@ -352,7 +352,7 @@ discard block |
|
|
block discarded – undo |
|
352
|
352
|
|
|
353
|
353
|
$dom = new DOMDocument(); |
|
354
|
354
|
libxml_use_internal_errors(TRUE); |
|
355
|
|
- $dom->loadHTML('<?xml encoding="utf-8" ?>' . $data); |
|
|
355
|
+ $dom->loadHTML('<?xml encoding="utf-8" ?>'.$data); |
|
356
|
356
|
libxml_use_internal_errors(FALSE); |
|
357
|
357
|
|
|
358
|
358
|
$xpath = new DOMXPath($dom); |
|
@@ -361,7 +361,7 @@ discard block |
|
|
block discarded – undo |
|
361
|
361
|
if($nodes_title->length === 1) { |
|
362
|
362
|
if($nodes_row->length === 1) { |
|
363
|
363
|
$firstRow = $nodes_row->item(0); |
|
364
|
|
- $nodes_latest = $xpath->query($node_latest_string, $firstRow); |
|
|
364
|
+ $nodes_latest = $xpath->query($node_latest_string, $firstRow); |
|
365
|
365
|
|
|
366
|
366
|
if($node_chapter_string !== '') { |
|
367
|
367
|
$nodes_chapter = $xpath->query($node_chapter_string, $firstRow); |
|
@@ -577,7 +577,7 @@ discard block |
|
|
block discarded – undo |
|
577
|
577
|
final private function _setSiteRateLimit(?int $rateLimit = NULL) : bool { |
|
578
|
578
|
//We would just use increment(), but we can't set ttl with it... |
|
579
|
579
|
$currentRateLimit = $rateLimit ?: $this->_getSiteRateLimit(); |
|
580
|
|
- return $this->cache->save("{$this->site}_ratelimit", $currentRateLimit + 1,3600); |
|
|
580
|
+ return $this->cache->save("{$this->site}_ratelimit", $currentRateLimit + 1, 3600); |
|
581
|
581
|
} |
|
582
|
582
|
} |
|
583
|
583
|
|
|
@@ -595,7 +595,7 @@ discard block |
|
|
block discarded – undo |
|
595
|
595
|
$chapter_parts = explode('/', $chapter); //returns #LANG#/#VOLUME#/#CHAPTER#/#CHAPTER_EXTRA#(/#PAGE#/) |
|
596
|
596
|
return [ |
|
597
|
597
|
'url' => $this->getChapterURL($title_url, $chapter), |
|
598
|
|
- 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
|
598
|
+ 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
599
|
599
|
]; |
|
600
|
600
|
} |
|
601
|
601
|
public function getChapterURL(string $title_url, string $chapter) : string { |
|
@@ -785,9 +785,9 @@ discard block |
|
|
block discarded – undo |
|
785
|
785
|
|
|
786
|
786
|
$dateString = str_replace('/', '-', trim($nodes_latest->item(0)->nodeValue)); //NOTE: We replace slashes here as it stops strtotime interpreting the date as US date format. |
|
787
|
787
|
if($dateString == 'T') { |
|
788
|
|
- $dateString = date("Y-m-d",now()); |
|
|
788
|
+ $dateString = date("Y-m-d", now()); |
|
789
|
789
|
} |
|
790
|
|
- $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString . ' 00:00')); |
|
|
790
|
+ $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString.' 00:00')); |
|
791
|
791
|
|
|
792
|
792
|
$titleDataList[$title_url] = $titleData; |
|
793
|
793
|
} |
|
@@ -811,7 +811,7 @@ discard block |
|
|
block discarded – undo |
|
811
|
811
|
public $chapterFormat = '/^[0-9\.]+$/'; |
|
812
|
812
|
public $pageSeparator = '/'; |
|
813
|
813
|
|
|
814
|
|
- public $customType = 2;# |
|
|
814
|
+ public $customType = 2; # |
|
815
|
815
|
|
|
816
|
816
|
public $version = 1; # New versions of GlossyBright have a diff style. |
|
817
|
817
|
|
|
@@ -979,11 +979,11 @@ discard block |
|
|
block discarded – undo |
|
979
|
979
|
"" |
|
980
|
980
|
); |
|
981
|
981
|
if($data) { |
|
982
|
|
- $titleData['title'] = trim(preg_replace('/ Added on .*$/','', $data['nodes_title']->textContent)); |
|
|
982
|
+ $titleData['title'] = trim(preg_replace('/ Added on .*$/', '', $data['nodes_title']->textContent)); |
|
983
|
983
|
$titleData['latest_chapter'] = preg_replace('/^.*\/([0-9\.]+)$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
|
984
|
984
|
|
|
985
|
|
- $dateString = preg_replace('/^Added (?:on )?/', '',$data['nodes_latest']->textContent); |
|
986
|
|
- $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString)); |
|
|
985
|
+ $dateString = preg_replace('/^Added (?:on )?/', '', $data['nodes_latest']->textContent); |
|
|
986
|
+ $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString)); |
|
987
|
987
|
} |
|
988
|
988
|
return (!empty($titleData) ? $titleData : NULL); |
|
989
|
989
|
} |
|
@@ -1061,9 +1061,9 @@ discard block |
|
|
block discarded – undo |
|
1061
|
1061
|
public function getChapterData(string $title_url, string $chapter) : array { |
|
1062
|
1062
|
if(strpos($chapter, '/')) { |
|
1063
|
1063
|
$chapterArr = explode('/', $chapter); |
|
1064
|
|
- $chapterN = "v{$chapterArr[0]}/c".str_replace('chapter_','',$chapterArr[1]); |
|
1065
|
|
- } else if (ctype_digit($chapter)) { |
|
1066
|
|
- $chapterN = 'c'.str_replace('chapter_','', $chapter); |
|
|
1064
|
+ $chapterN = "v{$chapterArr[0]}/c".str_replace('chapter_', '', $chapterArr[1]); |
|
|
1065
|
+ } else if(ctype_digit($chapter)) { |
|
|
1066
|
+ $chapterN = 'c'.str_replace('chapter_', '', $chapter); |
|
1067
|
1067
|
} |
|
1068
|
1068
|
return [ |
|
1069
|
1069
|
'url' => $this->getChapterURL($title_url, $chapter), |