|
@@ -1,4 +1,4 @@ discard block |
|
|
block discarded – undo |
|
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
|
* Class Tracker_Sites_Model |
|
@@ -153,7 +153,7 @@ discard block |
|
|
block discarded – undo |
|
153
|
153
|
|
|
154
|
154
|
$ch = curl_init(); |
|
155
|
155
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
156
|
|
- curl_setopt($ch, CURLOPT_ENCODING , "gzip"); |
|
|
156
|
+ curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
157
|
157
|
//curl_setopt($ch, CURLOPT_VERBOSE, 1); |
|
158
|
158
|
curl_setopt($ch, CURLOPT_HEADER, 1); |
|
159
|
159
|
|
|
@@ -175,8 +175,8 @@ discard block |
|
|
block discarded – undo |
|
175
|
175
|
curl_setopt($ch, CURLOPT_URL, $url); |
|
176
|
176
|
|
|
177
|
177
|
if($isPost) { |
|
178
|
|
- curl_setopt($ch,CURLOPT_POST, count($postFields)); |
|
179
|
|
- curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($postFields)); |
|
|
178
|
+ curl_setopt($ch, CURLOPT_POST, count($postFields)); |
|
|
179
|
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postFields)); |
|
180
|
180
|
} |
|
181
|
181
|
|
|
182
|
182
|
$response = curl_exec($ch); |
|
@@ -223,7 +223,7 @@ discard block |
|
|
block discarded – undo |
|
223
|
223
|
$result = shell_exec('python '.APPPATH.'../_scripts/get_cloudflare_cookie.py '.escapeshellarg(json_encode($urlData))); |
|
224
|
224
|
$cookieData = json_decode($result, TRUE); |
|
225
|
225
|
|
|
226
|
|
- $this->cache->save("cloudflare_{$this->site}", $cookieData['cookies'], 31536000 /* 1 year, or until we renew it */); |
|
|
226
|
+ $this->cache->save("cloudflare_{$this->site}", $cookieData['cookies'], 31536000 /* 1 year, or until we renew it */); |
|
227
|
227
|
log_message('debug', "Saving CloudFlare Cookies for {$this->site}"); |
|
228
|
228
|
|
|
229
|
229
|
$refresh = TRUE; |
|
@@ -274,7 +274,7 @@ discard block |
|
|
block discarded – undo |
|
274
|
274
|
|
|
275
|
275
|
$dom = new DOMDocument(); |
|
276
|
276
|
libxml_use_internal_errors(TRUE); |
|
277
|
|
- $dom->loadHTML('<?xml encoding="utf-8" ?>' . $data); |
|
|
277
|
+ $dom->loadHTML('<?xml encoding="utf-8" ?>'.$data); |
|
278
|
278
|
libxml_use_internal_errors(FALSE); |
|
279
|
279
|
|
|
280
|
280
|
$xpath = new DOMXPath($dom); |
|
@@ -282,7 +282,7 @@ discard block |
|
|
block discarded – undo |
|
282
|
282
|
$nodes_row = $xpath->query($node_row_string); |
|
283
|
283
|
if($nodes_title->length === 1 && $nodes_row->length === 1) { |
|
284
|
284
|
$firstRow = $nodes_row->item(0); |
|
285
|
|
- $nodes_latest = $xpath->query($node_latest_string, $firstRow); |
|
|
285
|
+ $nodes_latest = $xpath->query($node_latest_string, $firstRow); |
|
286
|
286
|
|
|
287
|
287
|
if($node_chapter_string !== '') { |
|
288
|
288
|
$nodes_chapter = $xpath->query($node_chapter_string, $firstRow); |
|
@@ -470,7 +470,7 @@ discard block |
|
|
block discarded – undo |
|
470
|
470
|
$chapter_parts = explode('/', $chapter); //returns #LANG#/#VOLUME#/#CHAPTER#/#CHAPTER_EXTRA#(/#PAGE#/) |
|
471
|
471
|
return [ |
|
472
|
472
|
'url' => $this->getChapterURL($title_url, $chapter), |
|
473
|
|
- 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
|
473
|
+ 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
474
|
474
|
]; |
|
475
|
475
|
} |
|
476
|
476
|
public function getChapterURL(string $title_url, string $chapter) : string { |
|
@@ -675,9 +675,9 @@ discard block |
|
|
block discarded – undo |
|
675
|
675
|
|
|
676
|
676
|
$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. |
|
677
|
677
|
if($dateString == 'T') { |
|
678
|
|
- $dateString = date("Y-m-d",now()); |
|
|
678
|
+ $dateString = date("Y-m-d", now()); |
|
679
|
679
|
} |
|
680
|
|
- $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString . ' 00:00')); |
|
|
680
|
+ $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString.' 00:00')); |
|
681
|
681
|
|
|
682
|
682
|
$titleDataList[$title_url] = $titleData; |
|
683
|
683
|
} |