@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | if(!extension_loaded('gd')) die('GD ext is required to run this!'); |
| 4 | 4 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | private $className; |
| 10 | 10 | |
| 11 | 11 | public function __construct() { |
| 12 | - if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3){ |
|
| 12 | + if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3) { |
|
| 13 | 13 | $this->baseURL = rtrim($_SERVER['argv'][1], '/'); |
| 14 | 14 | $this->className = $_SERVER['argv'][2]; |
| 15 | 15 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $this->updateDocs(); |
| 31 | 31 | |
| 32 | - $domain = preg_replace('#^https?://(.*?)(?:/.*?)?$#', '$1', $this->baseURL); |
|
| 32 | + $domain = preg_replace('#^https?://(.*?)(?:/.*?)?$#', '$1', $this->baseURL); |
|
| 33 | 33 | say("\nAdmin SQL:"); |
| 34 | 34 | say("INSERT INTO `mangatracker_development`.`tracker_sites` (`id`, `site`, `site_class`, `status`, `use_custom`) VALUES (NULL, '{$domain}', '{$this->className}', 'enabled', 'Y');"); |
| 35 | 35 | say("INSERT INTO `mangatracker_production`.`tracker_sites` (`id`, `site`, `site_class`, `status`, `use_custom`) VALUES (NULL, '{$domain}', '{$this->className}', 'enabled', 'Y');"); |
@@ -97,12 +97,12 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | //Update @updated |
| 99 | 99 | $currentDate = date("Y-m-d", time()); |
| 100 | - $baseFile = str_replace("@updated {$matches[1]}","@updated {$currentDate}", $baseFile); |
|
| 100 | + $baseFile = str_replace("@updated {$matches[1]}", "@updated {$currentDate}", $baseFile); |
|
| 101 | 101 | |
| 102 | 102 | //Update @version |
| 103 | 103 | $currentVersion = explode('.', $matches[2]); |
| 104 | - $newVersion = "{$currentVersion[0]}.{$currentVersion[1]}.". (((int) $currentVersion[2]) + 1); |
|
| 105 | - $baseFile = str_replace("@version {$matches[2]}","@version {$newVersion}", $baseFile); |
|
| 104 | + $newVersion = "{$currentVersion[0]}.{$currentVersion[1]}.".(((int) $currentVersion[2]) + 1); |
|
| 105 | + $baseFile = str_replace("@version {$matches[2]}", "@version {$newVersion}", $baseFile); |
|
| 106 | 106 | |
| 107 | 107 | //Add @require |
| 108 | 108 | // @resource fontAwesome |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | //Replace class names |
| 65 | 65 | $baseFile = str_replace('class HelveticaScans', "class {$this->className}", $baseFile); |
| 66 | - $baseFile = str_replace('coversDefaultClass HelveticaScans', "coversDefaultClass {$this->className}", $baseFile); |
|
| 66 | + $baseFile = str_replace('coversDefaultClass HelveticaScans', "coversdefaultclass {$this->className}", $baseFile); |
|
| 67 | 67 | |
| 68 | 68 | //Replace tests |
| 69 | 69 | $titleList = $this->getTitles(); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $baseFile = file_get_contents('./public/userscripts/manga-tracker.user.js'); |
| 88 | 88 | |
| 89 | 89 | $parse = parse_url($this->baseURL); |
| 90 | - if(strpos($baseFile, $parse['host']) !== false) die("Domain already exists in userscript?"); |
|
| 90 | + if(strpos($baseFile, $parse['host']) !== FALSE) die("Domain already exists in userscript?"); |
|
| 91 | 91 | |
| 92 | 92 | preg_match('/\@updated ([0-9\-]+)\r.*?\@version ([0-9\.]+)/s', $baseFile, $matches); |
| 93 | 93 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $require = <<<EOT |
| 110 | 110 | // @require https://trackr.moe/userscripts/sites/{$this->className}.1.js |
| 111 | 111 | // @resource fontAwesome |
| 112 | -EOT; |
|
| 112 | +eot; |
|
| 113 | 113 | $baseFile = str_replace(' // @resource fontAwesome', $require, $baseFile); |
| 114 | 114 | |
| 115 | 115 | file_put_contents('./public/userscripts/manga-tracker.user.js', $baseFile); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | }; |
| 136 | 136 | })(window.trackerSites = (window.trackerSites || {})); |
| 137 | 137 | |
| 138 | -EOT; |
|
| 138 | +eot; |
|
| 139 | 139 | |
| 140 | 140 | file_put_contents("./public/userscripts/sites/{$this->className}.js", $siteData); |
| 141 | 141 | } |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | $ch = curl_init("{$this->baseURL}/api/reader/chapters/orderby/desc_created/format/json"); |
| 157 | 157 | |
| 158 | - curl_setopt($ch, CURLOPT_NOBODY, true); |
|
| 159 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
|
| 158 | + curl_setopt($ch, CURLOPT_NOBODY, TRUE); |
|
| 159 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); |
|
| 160 | 160 | curl_exec($ch); |
| 161 | 161 | $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
| 162 | 162 | curl_close($ch); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | if($content = file_get_contents($jsonURL)) { |
| 171 | 171 | $json = json_decode($content, TRUE); |
| 172 | 172 | shuffle($json['comics']); |
| 173 | - $comics = array_slice($json['comics'], 0, 5, true); |
|
| 173 | + $comics = array_slice($json['comics'], 0, 5, TRUE); |
|
| 174 | 174 | |
| 175 | 175 | foreach($comics as $comic) { |
| 176 | 176 | $titleArr[$comic['stub']] = $comic['name']; |