@@ -53,9 +53,9 @@ |
||
53 | 53 | ]; |
54 | 54 | |
55 | 55 | $this->output |
56 | - ->set_status_header('200') |
|
57 | - ->set_content_type('application/json', 'utf-8') |
|
58 | - ->set_output(json_encode($json)); |
|
56 | + ->set_status_header('200') |
|
57 | + ->set_content_type('application/json', 'utf-8') |
|
58 | + ->set_output(json_encode($json)); |
|
59 | 59 | } else { |
60 | 60 | //TODO: We should probably try and have more verbose errors here. Return via JSON or something. |
61 | 61 | $this->output->set_status_header('400', 'Unable to update?'); |
@@ -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 | |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | imagealphablending($sheetImage, FALSE); |
24 | 24 | imagesavealpha($sheetImage, TRUE); |
25 | 25 | |
26 | - imagefill($sheetImage,0,0,0x7fff0000); |
|
26 | + imagefill($sheetImage, 0, 0, 0x7fff0000); |
|
27 | 27 | |
28 | 28 | $x = 0; |
29 | - foreach ($this->fileList as $filename) { |
|
30 | - $siteImage = imagecreatefrompng(ICON_FOLDER. "/{$filename}"); |
|
29 | + foreach($this->fileList as $filename) { |
|
30 | + $siteImage = imagecreatefrompng(ICON_FOLDER."/{$filename}"); |
|
31 | 31 | imagealphablending($siteImage, TRUE); |
32 | 32 | |
33 | 33 | $dst_x = ((16 + 2) * $x); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | if(preg_match('/\.sprite-site.*\@cache-version: ([0-9]+);/s', $oldLESS, $cvMatches)) { |
58 | 58 | $cacheVersion = ((int) $cvMatches[1]) + 1; |
59 | 59 | |
60 | - $newLESS = preg_replace('/\.sprite-site.*/s', '',$oldLESS); |
|
60 | + $newLESS = preg_replace('/\.sprite-site.*/s', '', $oldLESS); |
|
61 | 61 | $newLESS .= ''. |
62 | 62 | ".sprite-site {\n". |
63 | 63 | " .sprite();\n". |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php declare(strict_types=1); |
2 | 2 | |
3 | -if(!extension_loaded('gd')) die('GD ext is required to run this!'); |
|
3 | +if(!extension_loaded('gd')) { |
|
4 | + die('GD ext is required to run this!'); |
|
5 | +} |
|
4 | 6 | |
5 | 7 | chdir(dirname(__FILE__).'/../'); //Just to make things easier, change dir to project root. |
6 | 8 | const ASSET_FOLDER = 'public/assets'; |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('BASEPATH') OR exit('No direct script access allowed'); |
|
1 | +<?php defined('BASEPATH') or exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | class MY_Config extends CI_Config { |
4 | 4 | public function __construct() { |
@@ -136,7 +136,7 @@ |
||
136 | 136 | | |
137 | 137 | <a href="#" class="set-mal-id" data-mal-id="<?=$row['mal_id']?>" data-mal-type="<?=$row['mal_type']?>">Set MAL ID</a> <?php if(!is_null($row['mal_id']) && $row['mal_type'] == 'chapter') { ?><span>(<small><?=($row['mal_id'] !== '0' ? $row['mal_id'] : 'none')?></small>)</span><?php } ?> |
138 | 138 | | |
139 | - Tags (<a href="#" class="edit-tags small">Edit</a>): <span class="text-lowercase tag-list"><?=($row['has_tags'] ? implode("", array_map(function ($str) { return "<i class='tag'>{$str}</i>"; }, explode(",", $row['tag_list']))) : "none")?></span> |
|
139 | + Tags (<a href="#" class="edit-tags small">Edit</a>): <span class="text-lowercase tag-list"><?=($row['has_tags'] ? implode("", array_map(function($str) { return "<i class='tag'>{$str}</i>"; }, explode(",", $row['tag_list']))) : "none")?></span> |
|
140 | 140 | <div class="input-group hidden tag-edit"> |
141 | 141 | <input type="text" class="form-control" placeholder="tag1,tag2,tag3" maxlength="255" pattern='[a-z0-9-_,]{0,255}' value="<?=$row['tag_list']?>"> |
142 | 142 | <span class="input-group-btn"> |
@@ -1,4 +1,4 @@ |
||
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 |
@@ -114,7 +114,9 @@ discard block |
||
114 | 114 | */ |
115 | 115 | final public function isValidTitleURL(string $title_url) : bool { |
116 | 116 | $success = (bool) preg_match($this->titleFormat, $title_url); |
117 | - if(!$success) log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
117 | + if(!$success) { |
|
118 | + log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
119 | + } |
|
118 | 120 | return $success; |
119 | 121 | } |
120 | 122 | |
@@ -128,7 +130,9 @@ discard block |
||
128 | 130 | */ |
129 | 131 | final public function isValidChapter(string $chapter) : bool { |
130 | 132 | $success = (bool) preg_match($this->chapterFormat, $chapter); |
131 | - if(!$success) log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
133 | + if(!$success) { |
|
134 | + log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
135 | + } |
|
132 | 136 | return $success; |
133 | 137 | } |
134 | 138 | |
@@ -157,14 +161,20 @@ discard block |
||
157 | 161 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
158 | 162 | curl_setopt($ch, CURLOPT_HEADER, 1); |
159 | 163 | |
160 | - if($follow_redirect) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
164 | + if($follow_redirect) { |
|
165 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
166 | + } |
|
161 | 167 | |
162 | 168 | if($cookies = $this->cache->get("cloudflare_{$this->site}")) { |
163 | 169 | $cookie_string .= "; {$cookies}"; |
164 | 170 | } |
165 | 171 | |
166 | - if(!empty($cookie_string)) curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
167 | - if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
172 | + if(!empty($cookie_string)) { |
|
173 | + curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
174 | + } |
|
175 | + if(!empty($cookiejar_path)) { |
|
176 | + curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
177 | + } |
|
168 | 178 | |
169 | 179 | //Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff. |
170 | 180 | curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent); |
@@ -192,7 +202,9 @@ discard block |
||
192 | 202 | $body = substr($response, $header_size); |
193 | 203 | curl_close($ch); |
194 | 204 | |
195 | - if($status_code === 503) $refresh = $this->handleCloudFlare($url, $body); |
|
205 | + if($status_code === 503) { |
|
206 | + $refresh = $this->handleCloudFlare($url, $body); |
|
207 | + } |
|
196 | 208 | } |
197 | 209 | |
198 | 210 | return [ |
@@ -405,8 +417,12 @@ discard block |
||
405 | 417 | $status = FALSE; |
406 | 418 | |
407 | 419 | //Make sure we have a volume element |
408 | - if(count($oldChapterSegments) === 1) array_unshift($oldChapterSegments, 'v0'); |
|
409 | - if(count($newChapterSegments) === 1) array_unshift($newChapterSegments, 'v0'); |
|
420 | + if(count($oldChapterSegments) === 1) { |
|
421 | + array_unshift($oldChapterSegments, 'v0'); |
|
422 | + } |
|
423 | + if(count($newChapterSegments) === 1) { |
|
424 | + array_unshift($newChapterSegments, 'v0'); |
|
425 | + } |
|
410 | 426 | |
411 | 427 | $oldCount = count($oldChapterSegments); |
412 | 428 | $newCount = count($newChapterSegments); |
@@ -419,8 +435,12 @@ discard block |
||
419 | 435 | $newVolume = substr(array_shift($newChapterSegments), 1); |
420 | 436 | |
421 | 437 | //Forcing volume to 0 as TBD might not be the latest (although it can be, but that is covered by other checks) |
422 | - if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $oldVolume = 0; |
|
423 | - if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $newVolume = 0; |
|
438 | + if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
439 | + $oldVolume = 0; |
|
440 | + } |
|
441 | + if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
442 | + $newVolume = 0; |
|
443 | + } |
|
424 | 444 | |
425 | 445 | $oldVolume = floatval($oldVolume); |
426 | 446 | $newVolume = floatval($newVolume); |
@@ -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 | /** |
4 | 4 | * Class Tracker_Sites_Model |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | $ch = curl_init(); |
166 | 166 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
167 | - curl_setopt($ch, CURLOPT_ENCODING , "gzip"); |
|
167 | + curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
168 | 168 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
169 | 169 | curl_setopt($ch, CURLOPT_HEADER, 1); |
170 | 170 | |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | curl_setopt($ch, CURLOPT_URL, $url); |
187 | 187 | |
188 | 188 | if($isPost) { |
189 | - curl_setopt($ch,CURLOPT_POST, count($postFields)); |
|
190 | - curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($postFields)); |
|
189 | + curl_setopt($ch, CURLOPT_POST, count($postFields)); |
|
190 | + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postFields)); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | $response = curl_exec($ch); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $result = shell_exec('python '.APPPATH.'../_scripts/get_cloudflare_cookie.py '.escapeshellarg(json_encode($urlData))); |
235 | 235 | $cookieData = json_decode($result, TRUE); |
236 | 236 | |
237 | - $this->cache->save("cloudflare_{$this->site}", $cookieData['cookies'], 31536000 /* 1 year, or until we renew it */); |
|
237 | + $this->cache->save("cloudflare_{$this->site}", $cookieData['cookies'], 31536000 /* 1 year, or until we renew it */); |
|
238 | 238 | log_message('debug', "Saving CloudFlare Cookies for {$this->site}"); |
239 | 239 | |
240 | 240 | $refresh = TRUE; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | $dom = new DOMDocument(); |
288 | 288 | libxml_use_internal_errors(TRUE); |
289 | - $dom->loadHTML('<?xml encoding="utf-8" ?>' . $data); |
|
289 | + $dom->loadHTML('<?xml encoding="utf-8" ?>'.$data); |
|
290 | 290 | libxml_use_internal_errors(FALSE); |
291 | 291 | |
292 | 292 | $xpath = new DOMXPath($dom); |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | if($nodes_title->length === 1) { |
296 | 296 | if($nodes_row->length === 1) { |
297 | 297 | $firstRow = $nodes_row->item(0); |
298 | - $nodes_latest = $xpath->query($node_latest_string, $firstRow); |
|
298 | + $nodes_latest = $xpath->query($node_latest_string, $firstRow); |
|
299 | 299 | |
300 | 300 | if($node_chapter_string !== '') { |
301 | 301 | $nodes_chapter = $xpath->query($node_chapter_string, $firstRow); |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | $chapter_parts = explode('/', $chapter); //returns #LANG#/#VOLUME#/#CHAPTER#/#CHAPTER_EXTRA#(/#PAGE#/) |
502 | 502 | return [ |
503 | 503 | 'url' => $this->getChapterURL($title_url, $chapter), |
504 | - 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
504 | + 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
505 | 505 | ]; |
506 | 506 | } |
507 | 507 | public function getChapterURL(string $title_url, string $chapter) : string { |
@@ -683,9 +683,9 @@ discard block |
||
683 | 683 | |
684 | 684 | $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. |
685 | 685 | if($dateString == 'T') { |
686 | - $dateString = date("Y-m-d",now()); |
|
686 | + $dateString = date("Y-m-d", now()); |
|
687 | 687 | } |
688 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString . ' 00:00')); |
|
688 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString.' 00:00')); |
|
689 | 689 | |
690 | 690 | $titleDataList[$title_url] = $titleData; |
691 | 691 | } |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | //For whatever reason, DOMDocument breaks the <link> element we need to grab the chapter, so we have to grab it elsewhere. |
741 | 741 | $titleData['latest_chapter'] = preg_replace('/^.*? - ([0-9\.]+) - .*?$/', '$1', trim($data['nodes_chapter']->textContent)); |
742 | 742 | |
743 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->textContent)); |
|
743 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->textContent)); |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | return (!empty($titleData) ? $titleData : NULL); |
@@ -842,11 +842,11 @@ discard block |
||
842 | 842 | "" |
843 | 843 | ); |
844 | 844 | if($data) { |
845 | - $titleData['title'] = trim(preg_replace('/ Added on .*$/','', $data['nodes_title']->textContent)); |
|
845 | + $titleData['title'] = trim(preg_replace('/ Added on .*$/', '', $data['nodes_title']->textContent)); |
|
846 | 846 | $titleData['latest_chapter'] = preg_replace('/^.*\/([0-9\.]+)$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
847 | 847 | |
848 | - $dateString = preg_replace('/^Added (?:on )?/', '',$data['nodes_latest']->textContent); |
|
849 | - $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString)); |
|
848 | + $dateString = preg_replace('/^Added (?:on )?/', '', $data['nodes_latest']->textContent); |
|
849 | + $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString)); |
|
850 | 850 | } |
851 | 851 | return (!empty($titleData) ? $titleData : NULL); |
852 | 852 | } |
@@ -1,11 +1,11 @@ |
||
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 | //Because we can't autoload the cache driver with params - https://forum.codeigniter.com/thread-62217-post-319687.html#pid319687 |
4 | 4 | class Cacher { |
5 | 5 | protected $CI; |
6 | 6 | |
7 | 7 | public function __construct() { |
8 | - $this->CI =& get_instance(); //grab an instance of CI |
|
8 | + $this->CI = & get_instance(); //grab an instance of CI |
|
9 | 9 | $this->initiate_cache(); |
10 | 10 | } |
11 | 11 |
@@ -11,9 +11,9 @@ |
||
11 | 11 | |
12 | 12 | //This is pretty barebones issue reporting, and honestly not a great way to do it, but it works for now (until the Github is public). |
13 | 13 | $body = "". |
14 | - (!is_null($url) && !empty($url) ? "URL: ".htmlspecialchars(substr($url, 0, 255))."<br>\n" : ""). |
|
15 | - "Submitted by: ".$this->input->ip_address().(!is_null($userID) ? "| {$userID}" : "")."<br>\n". |
|
16 | - "<br>Bug report: ".htmlspecialchars(substr($text, 0, 1000)); |
|
14 | + (!is_null($url) && !empty($url) ? "URL: ".htmlspecialchars(substr($url, 0, 255))."<br>\n" : ""). |
|
15 | + "Submitted by: ".$this->input->ip_address().(!is_null($userID) ? "| {$userID}" : "")."<br>\n". |
|
16 | + "<br>Bug report: ".htmlspecialchars(substr($text, 0, 1000)); |
|
17 | 17 | |
18 | 18 | $success = TRUE; |
19 | 19 | $this->email->from('[email protected]', $this->config->item('site_title', 'ion_auth')); |
@@ -1,4 +1,4 @@ |
||
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 Tracker_Issue_Model extends Tracker_Base_Model { |
4 | 4 | public function __construct() { |
@@ -1,4 +1,4 @@ |
||
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 Tracker_Issue_Model extends Tracker_Base_Model { |
4 | 4 | public function __construct() { |
@@ -12,12 +12,12 @@ |
||
12 | 12 | $this->header_data['page'] = "report-issue"; |
13 | 13 | |
14 | 14 | $this->form_validation->set_rules('issue_description', 'Description', 'required|max_length[255]'); |
15 | - $this->form_validation->set_rules('issue_url', 'URL', 'valid_url'); |
|
15 | + $this->form_validation->set_rules('issue_url', 'URL', 'valid_url'); |
|
16 | 16 | |
17 | 17 | $this->body_data['issue_submitted'] = FALSE; |
18 | 18 | if($isValid = $this->form_validation->run() === TRUE) { |
19 | 19 | //send report |
20 | - $this->body_data['issue_submitted'] = $this->Tracker->issue->report("USERID:" . $this->User->id . " ||| " . $this->input->post('issue_description'), NULL, $this->input->post('issue_url')); |
|
20 | + $this->body_data['issue_submitted'] = $this->Tracker->issue->report("USERID:".$this->User->id." ||| ".$this->input->post('issue_description'), NULL, $this->input->post('issue_url')); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | if(!$isValid) { |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('BASEPATH') OR exit('No direct script access allowed'); |
|
1 | +<?php defined('BASEPATH') or exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | class ReportIssue extends MY_Controller { |
4 | 4 | public function __construct() { |
@@ -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 |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php declare(strict_types=1); |
2 | 2 | |
3 | -if(!extension_loaded('gd')) die('GD ext is required to run this!'); |
|
3 | +if(!extension_loaded('gd')) { |
|
4 | + die('GD ext is required to run this!'); |
|
5 | +} |
|
4 | 6 | |
5 | 7 | chdir(dirname(__FILE__).'/../'); //Just to make things easier, change dir to project root. |
6 | 8 | |
@@ -9,7 +11,7 @@ discard block |
||
9 | 11 | private $className; |
10 | 12 | |
11 | 13 | public function __construct() { |
12 | - if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3){ |
|
14 | + if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3) { |
|
13 | 15 | $this->baseURL = rtrim($_SERVER['argv'][1], '/'); |
14 | 16 | $this->className = $_SERVER['argv'][2]; |
15 | 17 | |
@@ -98,7 +100,9 @@ discard block |
||
98 | 100 | $baseFile = file_get_contents($baseFileName); |
99 | 101 | |
100 | 102 | $parse = parse_url($this->baseURL); |
101 | - if(strpos($baseFile, $parse['host']) !== false) die("Domain already exists in userscript?"); |
|
103 | + if(strpos($baseFile, $parse['host']) !== false) { |
|
104 | + die("Domain already exists in userscript?"); |
|
105 | + } |
|
102 | 106 | |
103 | 107 | preg_match('/\@updated ([0-9\-]+)[\r\n]+.*?\@version ([0-9\.]+)/s', $baseFile, $matches); |
104 | 108 | |
@@ -188,7 +192,9 @@ discard block |
||
188 | 192 | } |
189 | 193 | } |
190 | 194 | |
191 | - if(empty($titleArr)) die("API isn't returning any titles?"); |
|
195 | + if(empty($titleArr)) { |
|
196 | + die("API isn't returning any titles?"); |
|
197 | + } |
|
192 | 198 | return $titleArr; |
193 | 199 | } |
194 | 200 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | //Replace class names |
69 | 69 | $baseFile = str_replace('class HelveticaScans', "class {$this->className}", $baseFile); |
70 | - $baseFile = str_replace('coversDefaultClass HelveticaScans', "coversDefaultClass {$this->className}", $baseFile); |
|
70 | + $baseFile = str_replace('coversDefaultClass HelveticaScans', "coversdefaultclass {$this->className}", $baseFile); |
|
71 | 71 | |
72 | 72 | //Replace tests |
73 | 73 | $titleList = $this->getTitles(); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $baseFile = file_get_contents($baseFileName); |
99 | 99 | |
100 | 100 | $parse = parse_url($this->baseURL); |
101 | - if(strpos($baseFile, $parse['host']) !== false) die("Domain already exists in userscript?"); |
|
101 | + if(strpos($baseFile, $parse['host']) !== FALSE) die("Domain already exists in userscript?"); |
|
102 | 102 | |
103 | 103 | preg_match('/\@updated ([0-9\-]+)[\r\n]+.*?\@version ([0-9\.]+)/s', $baseFile, $matches); |
104 | 104 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $require = <<<EOT |
121 | 121 | // @require https://{$baseDomain}/userscripts/sites/{$this->className}.1.js |
122 | 122 | // @resource fontAwesome |
123 | -EOT; |
|
123 | +eot; |
|
124 | 124 | $baseFile = str_replace('// @resource fontAwesome', $require, $baseFile); |
125 | 125 | |
126 | 126 | file_put_contents($baseFileName, $baseFile); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | }; |
147 | 147 | })(window.trackerSites = (window.trackerSites || {})); |
148 | 148 | |
149 | -EOT; |
|
149 | +eot; |
|
150 | 150 | |
151 | 151 | file_put_contents("./public/userscripts/sites/{$this->className}.js", $siteData); |
152 | 152 | } |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | |
167 | 167 | $ch = curl_init("{$this->baseURL}/api/reader/chapters/orderby/desc_created/format/json"); |
168 | 168 | |
169 | - curl_setopt($ch, CURLOPT_NOBODY, true); |
|
170 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
|
169 | + curl_setopt($ch, CURLOPT_NOBODY, TRUE); |
|
170 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); |
|
171 | 171 | curl_exec($ch); |
172 | 172 | $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
173 | 173 | curl_close($ch); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | if($content = file_get_contents($jsonURL)) { |
182 | 182 | $json = json_decode($content, TRUE); |
183 | 183 | shuffle($json['comics']); |
184 | - $comics = array_slice($json['comics'], 0, 5, true); |
|
184 | + $comics = array_slice($json['comics'], 0, 5, TRUE); |
|
185 | 185 | |
186 | 186 | foreach($comics as $comic) { |
187 | 187 | $titleArr[$comic['stub']] = $comic['name']; |