@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | } |
7 | 7 | |
8 | 8 | public function index(int $page = 1) : void { |
9 | - if($page === 0) redirect('user/history/1'); |
|
9 | + if($page === 0) { |
|
10 | + redirect('user/history/1'); |
|
11 | + } |
|
10 | 12 | |
11 | 13 | $this->header_data['title'] = "History"; |
12 | 14 | $this->header_data['page'] = "history"; |
@@ -16,7 +18,9 @@ discard block |
||
16 | 18 | $this->body_data['currentPage'] = (int) $page; |
17 | 19 | $this->body_data['totalPages'] = $historyData['totalPages']; |
18 | 20 | |
19 | - if($page > $this->body_data['totalPages'] && $page > 1) redirect('user/history/1'); |
|
21 | + if($page > $this->body_data['totalPages'] && $page > 1) { |
|
22 | + redirect('user/history/1'); |
|
23 | + } |
|
20 | 24 | |
21 | 25 | $this->_render_page('User/History'); |
22 | 26 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | case 'csv': |
33 | 33 | $this->output->set_content_type('text/csv', 'utf-8'); |
34 | - $this->_render_content($this->Tracker->portation->arrayToCSVRecursive($historyData, 'Date/Time,Title,URL,Site,Status'), 'csv',TRUE, 'tracker-history'); |
|
34 | + $this->_render_content($this->Tracker->portation->arrayToCSVRecursive($historyData, 'Date/Time,Title,URL,Site,Status'), 'csv', TRUE, 'tracker-history'); |
|
35 | 35 | break; |
36 | 36 | |
37 | 37 | default: |
@@ -60,7 +60,9 @@ |
||
60 | 60 | $show_404 = TRUE; |
61 | 61 | } |
62 | 62 | |
63 | - if($show_404) show_404(); |
|
63 | + if($show_404) { |
|
64 | + show_404(); |
|
65 | + } |
|
64 | 66 | } |
65 | 67 | |
66 | 68 | private function _walk_recursive_remove (array $array, callable $callback) : array { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // break; |
27 | 27 | |
28 | 28 | case 'html': |
29 | - $this->body_data['trackerData'] = $trackerData['series']; |
|
29 | + $this->body_data['trackerData'] = $trackerData['series']; |
|
30 | 30 | |
31 | 31 | $this->header_data['show_header'] = FALSE; |
32 | 32 | $this->footer_data['show_footer'] = FALSE; |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | if($show_404) show_404(); |
63 | 63 | } |
64 | 64 | |
65 | - private function _walk_recursive_remove (array $array, callable $callback) : array { |
|
66 | - foreach ($array as $k => $v) { |
|
67 | - if (is_array($v)) { |
|
65 | + private function _walk_recursive_remove(array $array, callable $callback) : array { |
|
66 | + foreach($array as $k => $v) { |
|
67 | + if(is_array($v)) { |
|
68 | 68 | $array[$k] = $this->_walk_recursive_remove($v, $callback); |
69 | 69 | } else { |
70 | - if ($callback($v, $k)) { |
|
70 | + if($callback($v, $k)) { |
|
71 | 71 | unset($array[$k]); |
72 | 72 | } |
73 | 73 | } |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | } |
7 | 7 | |
8 | 8 | public function index(int $page = 1) : void { |
9 | - if($page === 0) redirect('user/favourites/1'); |
|
9 | + if($page === 0) { |
|
10 | + redirect('user/favourites/1'); |
|
11 | + } |
|
10 | 12 | |
11 | 13 | $this->header_data['title'] = "Favourites"; |
12 | 14 | $this->header_data['page'] = "favourites"; |
@@ -16,7 +18,9 @@ discard block |
||
16 | 18 | $this->body_data['currentPage'] = $page; |
17 | 19 | $this->body_data['totalPages'] = $favouriteData['totalPages']; |
18 | 20 | |
19 | - if($page > $this->body_data['totalPages'] && $page <= 1) redirect('user/favourites/1'); |
|
21 | + if($page > $this->body_data['totalPages'] && $page <= 1) { |
|
22 | + redirect('user/favourites/1'); |
|
23 | + } |
|
20 | 24 | |
21 | 25 | $this->_render_page('User/Favourites'); |
22 | 26 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | case 'csv': |
33 | 33 | $this->output->set_content_type('text/csv', 'utf-8'); |
34 | - $this->_render_content($this->Tracker->portation->arrayToCSVRecursive($favouriteData, 'Date/Time,Title,Manga URL,Site,Chapter,Chapter Number, Chapter URL'), 'csv',TRUE, 'tracker-favourite'); |
|
34 | + $this->_render_content($this->Tracker->portation->arrayToCSVRecursive($favouriteData, 'Date/Time,Title,Manga URL,Site,Chapter,Chapter Number, Chapter URL'), 'csv', TRUE, 'tracker-favourite'); |
|
35 | 35 | break; |
36 | 36 | |
37 | 37 | default: |
@@ -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 | * Checks if view file exists. |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @return bool |
7 | 7 | */ |
8 | 8 | function view_exists(string $path) : bool { |
9 | - return file_exists(APPPATH . "/views/{$path}.php"); |
|
9 | + return file_exists(APPPATH."/views/{$path}.php"); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | function get_time_class(string $time_string) : string { |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | return $time_string; |
33 | 33 | } |
34 | 34 | |
35 | -if (!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
36 | - function http_parse_headers (string $raw_headers) : array { |
|
35 | +if(!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
36 | + function http_parse_headers(string $raw_headers) : array { |
|
37 | 37 | $headers = array(); // $headers = []; |
38 | - foreach (explode("\n", $raw_headers) as $i => $h) { |
|
38 | + foreach(explode("\n", $raw_headers) as $i => $h) { |
|
39 | 39 | $h = explode(':', $h, 2); |
40 | - if (isset($h[1])){ |
|
41 | - if(!isset($headers[$h[0]])){ |
|
40 | + if(isset($h[1])) { |
|
41 | + if(!isset($headers[$h[0]])) { |
|
42 | 42 | $headers[$h[0]] = trim($h[1]); |
43 | - }else if(is_array($headers[$h[0]])){ |
|
44 | - $tmp = array_merge($headers[$h[0]],array(trim($h[1]))); |
|
43 | + } else if(is_array($headers[$h[0]])) { |
|
44 | + $tmp = array_merge($headers[$h[0]], array(trim($h[1]))); |
|
45 | 45 | $headers[$h[0]] = $tmp; |
46 | - }else{ |
|
47 | - $tmp = array_merge(array($headers[$h[0]]),array(trim($h[1]))); |
|
46 | + } else { |
|
47 | + $tmp = array_merge(array($headers[$h[0]]), array(trim($h[1]))); |
|
48 | 48 | $headers[$h[0]] = $tmp; |
49 | 49 | } |
50 | 50 | } |
@@ -32,18 +32,19 @@ |
||
32 | 32 | return $time_string; |
33 | 33 | } |
34 | 34 | |
35 | -if (!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
35 | +if (!function_exists('http_parse_headers')) { |
|
36 | +#http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
36 | 37 | function http_parse_headers (string $raw_headers) : array { |
37 | 38 | $headers = array(); // $headers = []; |
38 | 39 | foreach (explode("\n", $raw_headers) as $i => $h) { |
39 | 40 | $h = explode(':', $h, 2); |
40 | - if (isset($h[1])){ |
|
41 | - if(!isset($headers[$h[0]])){ |
|
41 | + if (isset($h[1])) { |
|
42 | + if(!isset($headers[$h[0]])) { |
|
42 | 43 | $headers[$h[0]] = trim($h[1]); |
43 | - }else if(is_array($headers[$h[0]])){ |
|
44 | + } else if(is_array($headers[$h[0]])) { |
|
44 | 45 | $tmp = array_merge($headers[$h[0]],array(trim($h[1]))); |
45 | 46 | $headers[$h[0]] = $tmp; |
46 | - }else{ |
|
47 | + } else { |
|
47 | 48 | $tmp = array_merge(array($headers[$h[0]]),array(trim($h[1]))); |
48 | 49 | $headers[$h[0]] = $tmp; |
49 | 50 | } |
@@ -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 @@ 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 | |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | |
93 | 93 | //Update @updated |
94 | 94 | $currentDate = date("Y-m-d", time()); |
95 | - $baseFile = str_replace("@updated {$matches[1]}","@updated {$currentDate}", $baseFile); |
|
95 | + $baseFile = str_replace("@updated {$matches[1]}", "@updated {$currentDate}", $baseFile); |
|
96 | 96 | |
97 | 97 | //Update @version |
98 | 98 | $currentVersion = explode('.', $matches[2]); |
99 | - $newVersion = "{$currentVersion[0]}.{$currentVersion[1]}.". (((int) $currentVersion[2]) + 1); |
|
100 | - $baseFile = str_replace("@version {$matches[2]}","@version {$newVersion}", $baseFile); |
|
99 | + $newVersion = "{$currentVersion[0]}.{$currentVersion[1]}.".(((int) $currentVersion[2]) + 1); |
|
100 | + $baseFile = str_replace("@version {$matches[2]}", "@version {$newVersion}", $baseFile); |
|
101 | 101 | |
102 | 102 | //Add site |
103 | 103 | $siteData = <<<EOT |
@@ -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 | |
@@ -82,7 +84,9 @@ discard block |
||
82 | 84 | $baseFile = file_get_contents('./public/userscripts/manga-tracker.user.js'); |
83 | 85 | |
84 | 86 | $parse = parse_url($this->baseURL); |
85 | - if(strpos($baseFile, $parse['host']) !== false) die("Domain already exists in userscript?"); |
|
87 | + if(strpos($baseFile, $parse['host']) !== false) { |
|
88 | + die("Domain already exists in userscript?"); |
|
89 | + } |
|
86 | 90 | |
87 | 91 | preg_match('/\@updated ([0-9\-]+)\r.*?\@version ([0-9\.]+)/s', $baseFile, $matches); |
88 | 92 | |
@@ -179,7 +183,9 @@ discard block |
||
179 | 183 | } |
180 | 184 | } |
181 | 185 | |
182 | - if(empty($titleArr)) die("API isn't returning any titles?"); |
|
186 | + if(empty($titleArr)) { |
|
187 | + die("API isn't returning any titles?"); |
|
188 | + } |
|
183 | 189 | return $titleArr; |
184 | 190 | } |
185 | 191 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | //Replace class names |
60 | 60 | $baseFile = str_replace('class HelveticaScans', "class {$this->className}", $baseFile); |
61 | - $baseFile = str_replace('coversDefaultClass HelveticaScans', "coversDefaultClass {$this->className}", $baseFile); |
|
61 | + $baseFile = str_replace('coversDefaultClass HelveticaScans', "coversdefaultclass {$this->className}", $baseFile); |
|
62 | 62 | |
63 | 63 | //Replace tests |
64 | 64 | $titleList = $this->getTitles(); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $baseFile = file_get_contents('./public/userscripts/manga-tracker.user.js'); |
83 | 83 | |
84 | 84 | $parse = parse_url($this->baseURL); |
85 | - if(strpos($baseFile, $parse['host']) !== false) die("Domain already exists in userscript?"); |
|
85 | + if(strpos($baseFile, $parse['host']) !== FALSE) die("Domain already exists in userscript?"); |
|
86 | 86 | |
87 | 87 | preg_match('/\@updated ([0-9\-]+)\r.*?\@version ([0-9\.]+)/s', $baseFile, $matches); |
88 | 88 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | }), |
114 | 114 | |
115 | 115 | //Tracking site |
116 | -EOT; |
|
116 | +eot; |
|
117 | 117 | $baseFile = str_replace(' //Tracking site', $siteData, $baseFile); |
118 | 118 | |
119 | 119 | file_put_contents('./public/userscripts/manga-tracker.user.js', $baseFile); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | ## [{$date}] |
147 | 147 | ### Added |
148 | 148 | - Support for {$this->className}. |
149 | -EOT; |
|
149 | +eot; |
|
150 | 150 | $changelogFile = str_replace('All notable changes to this project will be documented in this file.', "All notable changes to this project will be documented in this file.\r\n\r\n{$log}", $changelogFile); |
151 | 151 | } |
152 | 152 | |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | |
159 | 159 | $ch = curl_init("{$this->baseURL}/api/reader/chapters/orderby/desc_created/format/json"); |
160 | 160 | |
161 | - curl_setopt($ch, CURLOPT_NOBODY, true); |
|
162 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
|
161 | + curl_setopt($ch, CURLOPT_NOBODY, TRUE); |
|
162 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); |
|
163 | 163 | curl_exec($ch); |
164 | 164 | $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
165 | 165 | curl_close($ch); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | if($content = file_get_contents($jsonURL)) { |
174 | 174 | $json = json_decode($content, TRUE); |
175 | 175 | shuffle($json['comics']); |
176 | - $comics = array_slice($json['comics'], 0, 5, true); |
|
176 | + $comics = array_slice($json['comics'], 0, 5, TRUE); |
|
177 | 177 | |
178 | 178 | foreach($comics as $comic) { |
179 | 179 | $titleArr[$comic['stub']] = $comic['name']; |
@@ -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 |