@@ -7,7 +7,7 @@ |
||
| 7 | 7 | $userscriptProd = file_get_contents('./public/userscripts/manga-tracker.user.js'); |
| 8 | 8 | |
| 9 | 9 | // Replace where needed. |
| 10 | -$userscriptProd = str_replace('https://trackr.moe/userscripts','http://manga-tracker.localhost:20180/userscripts', $userscriptProd); |
|
| 10 | +$userscriptProd = str_replace('https://trackr.moe/userscripts', 'http://manga-tracker.localhost:20180/userscripts', $userscriptProd); |
|
| 11 | 11 | |
| 12 | 12 | // Push to dev file. |
| 13 | 13 | file_put_contents('./public/userscripts/manga-tracker.dev.user.js', $userscriptProd); |
@@ -120,15 +120,15 @@ discard block |
||
| 120 | 120 | )'); |
| 121 | 121 | }); |
| 122 | 122 | |
| 123 | -task('deploy:copy_files', function () { |
|
| 123 | +task('deploy:copy_files', function() { |
|
| 124 | 124 | $sharedPath = '{{deploy_path}}/shared'; |
| 125 | - foreach (get('copy_files') as $file) { |
|
| 125 | + foreach(get('copy_files') as $file) { |
|
| 126 | 126 | $dirname = dirname(parse($file)); |
| 127 | 127 | // Create dir of shared file |
| 128 | - runS("mkdir -p $sharedPath/" . $dirname); |
|
| 128 | + runS("mkdir -p $sharedPath/".$dirname); |
|
| 129 | 129 | // Check if shared file does not exist in shared. |
| 130 | 130 | // and file exist in release |
| 131 | - if (!test("[ -f $sharedPath/$file ]") && test("[ -f {{release_path}}/$file ]")) { |
|
| 131 | + if(!test("[ -f $sharedPath/$file ]") && test("[ -f {{release_path}}/$file ]")) { |
|
| 132 | 132 | // Copy file in shared dir if not present |
| 133 | 133 | runS("cp -rv {{release_path}}/$file $sharedPath/$file"); |
| 134 | 134 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | 145 | |
| 146 | -task('deploy:migrate_db', function () { |
|
| 146 | +task('deploy:migrate_db', function() { |
|
| 147 | 147 | // Migration is disabled by default on production, so we need to toggle it temporally. |
| 148 | 148 | runS('( \ |
| 149 | 149 | cd {{release_path}} && \ |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | )'); |
| 154 | 154 | }); |
| 155 | 155 | |
| 156 | -task('deploy:maintenance_enable', function () { |
|
| 156 | +task('deploy:maintenance_enable', function() { |
|
| 157 | 157 | //define('MAINTENANCE', FALSE); |
| 158 | 158 | runS('( \ |
| 159 | 159 | cd {{previous_release}} && \ |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | sed -i -r "s/(\'MAINTENANCE\',) FALSE/\1 TRUE/" public/index.php \ |
| 165 | 165 | )'); |
| 166 | 166 | }); |
| 167 | -task('deploy:maintenance_disable', function () { |
|
| 167 | +task('deploy:maintenance_disable', function() { |
|
| 168 | 168 | //define('MAINTENANCE', FALSE); |
| 169 | 169 | runS('( \ |
| 170 | 170 | cd {{release_path}} && \ |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * Series are only checked if they haven't been updated in 16+ hours (unless they are marked as complete, to which they are only checked once a week). |
| 31 | 31 | */ |
| 32 | 32 | public function updateSeries() { |
| 33 | - print 'Environment: ' . ENVIRONMENT . "\n"; |
|
| 33 | + print 'Environment: '.ENVIRONMENT."\n"; |
|
| 34 | 34 | $this->Tracker->admin->updateLatestChapters(); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -120,7 +120,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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), |