Completed
Pull Request — master (#172)
by
unknown
02:56
created
application/models/Tracker/Sites/MangaFox.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -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
 class MangaFox extends Base_Site_Model {
4 4
 	public $titleFormat   = '/^[a-z0-9_]+$/';
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		];
16 16
 	}
17 17
 
18
-	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ?array {
18
+	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ? array {
19 19
 		$titleData = [];
20 20
 
21 21
 		$fullURL = $this->getFullTitleURL($title_url);
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 
35 35
 			$link = preg_replace('/^(.*\/)(?:[0-9]+\.html)?$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
36 36
 			$chapterURLSegments = explode('/', $link);
37
-			$titleData['latest_chapter'] = $chapterURLSegments[5] . (isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : "");
38
-			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue));
37
+			$titleData['latest_chapter'] = $chapterURLSegments[5].(isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : "");
38
+			$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue));
39 39
 
40 40
 			if($firstGet) {
41 41
 				$titleData = array_merge($titleData, $this->doCustomFollow($content['body']));
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 
115 115
 							$link = preg_replace('/^(.*\/)(?:[0-9]+\.html)?$/', '$1', (string) $nodes_chapter->item(0)->getAttribute('href'));
116 116
 							$chapterURLSegments = explode('/', $link);
117
-							$titleData['latest_chapter'] = $chapterURLSegments[5] . (isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : "");
117
+							$titleData['latest_chapter'] = $chapterURLSegments[5].(isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : "");
118 118
 
119
-							$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $nodes_latest->item(0)->nodeValue));
119
+							$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest->item(0)->nodeValue));
120 120
 
121 121
 							$title_url = explode('/', $title->getAttribute('href'))[4];
122 122
 							$titleDataList[$title_url] = $titleData;
Please login to merge, or discard this patch.
application/models/Tracker/Sites/WebToons.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -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
 class WebToons extends Base_Site_Model {
4 4
 	/* Webtoons.com has a very weird and pointless URL format.
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		];
35 35
 	}
36 36
 
37
-	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ?array {
37
+	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ? array {
38 38
 		$titleData = [];
39 39
 
40 40
 		//FIXME: We don't use parseTitleDOM here due to using rss. Should probably have an alternate method for XML parsing.
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 				$titleData['title'] = trim((string) $xml->{'channel'}->title);
52 52
 
53 53
 				$chapterURLSegments = explode('/', ((string) $xml->{'channel'}->item[0]->link));
54
-				$titleData['latest_chapter'] = preg_replace('/^.*?([0-9]+)$/', '$1', $chapterURLSegments[7]) . ':--:' . $chapterURLSegments[6];
55
-				$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $xml->{'channel'}->item[0]->pubDate));
54
+				$titleData['latest_chapter'] = preg_replace('/^.*?([0-9]+)$/', '$1', $chapterURLSegments[7]).':--:'.$chapterURLSegments[6];
55
+				$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $xml->{'channel'}->item[0]->pubDate));
56 56
 
57 57
 				if($firstGet) {
58 58
 					$titleData = array_merge($titleData, $this->doCustomFollow($content['body'], ['id' => $title_parts[0]]));
Please login to merge, or discard this patch.
application/models/Tracker/Sites/MangaCow.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -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
 class MangaCow extends Base_Site_Model {
4 4
 	public $titleFormat   = '/^[a-zA-Z0-9_-]+$/';
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		];
16 16
 	}
17 17
 
18
-	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ?array {
18
+	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ? array {
19 19
 		$titleData = [];
20 20
 
21 21
 		$fullURL = $this->getFullTitleURL($title_url);
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 			$titleData['latest_chapter'] = preg_replace('/^.*\/([0-9\.]+)\/$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
38 38
 
39
-			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) substr($data['nodes_latest']->getAttribute('title'), 13)));
39
+			$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) substr($data['nodes_latest']->getAttribute('title'), 13)));
40 40
 		}
41 41
 
42 42
 		return (!empty($titleData) ? $titleData : NULL);
Please login to merge, or discard this patch.
application/models/Tracker/Sites/ReadMangaToday.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -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
 class ReadMangaToday extends Base_Site_Model {
4 4
 	public $titleFormat   = '/^[a-zA-Z0-9_-]+$/';
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 		];
17 17
 	}
18 18
 
19
-	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ?array {
19
+	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ? array {
20 20
 		$titleData = [];
21 21
 
22 22
 		$fullURL = $this->getFullTitleURL($title_url);
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			$titleData['latest_chapter'] = preg_replace('/^.*\/([0-9\.]+)$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
39 39
 
40 40
 			$dateString = $data['nodes_latest']->nodeValue;
41
-			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime(preg_replace('/ (-|\[A\]).*$/', '', $dateString)));
41
+			$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(preg_replace('/ (-|\[A\]).*$/', '', $dateString)));
42 42
 		}
43 43
 
44 44
 		return (!empty($titleData) ? $titleData : NULL);
Please login to merge, or discard this patch.
application/models/History_Model.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -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
 class History_Model extends CI_Model {
4 4
 	public function __construct() {
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 			foreach($result as $row) {
50 50
 				$arrRow = [];
51 51
 
52
-				$arrRow['updated_at']  = $row->updated_at;
52
+				$arrRow['updated_at'] = $row->updated_at;
53 53
 
54 54
 				$newChapterData = $this->Tracker->sites->{$row->site_class}->getChapterData($row->title_url, $row->new_chapter);
55 55
 				$arrRow['new_chapter']      = "<a href=\"{$newChapterData['url']}\">{$newChapterData['number']}</a>";
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 		return $success;
173 173
 	}
174
-	public function userSetMalID(int $chapterID, ?int $malID) : bool {
174
+	public function userSetMalID(int $chapterID, ? int $malID) : bool {
175 175
 		$success = $this->db->insert('tracker_user_history', [
176 176
 			'chapter_id'  => $chapterID,
177 177
 
Please login to merge, or discard this patch.
_scripts/generate_spritesheet.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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".
Please login to merge, or discard this patch.
application/models/Tracker/Sites/FallenAngelsScans.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -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
 class FallenAngelsScans extends Base_Site_Model {
4 4
 	public $titleFormat   = '/^[a-zA-Z0-9_-]+$/';
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		];
16 16
 	}
17 17
 
18
-	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ?array {
18
+	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ? array {
19 19
 		$titleData = [];
20 20
 
21 21
 		$fullURL = $this->getFullTitleURL($title_url);
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_List_Model.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  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
 class Tracker_List_Model extends Tracker_Base_Model {
4 4
 	public function __construct() {
5 5
 		parent::__construct();
6 6
 	}
7 7
 
8
-	public function get(?int $userID = NULL) {
8
+	public function get(? int $userID = NULL) {
9 9
 		$userID = (is_null($userID) ? (int) $this->User->id : $userID);
10 10
 
11 11
 		$query = $this->db
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 			];
30 30
 		}
31 31
 		if($query->num_rows() > 0) {
32
-			foreach ($query->result() as $row) {
32
+			foreach($query->result() as $row) {
33 33
 				$is_unread = intval(($row->latest_chapter == $row->ignore_chapter) || ($row->latest_chapter == $row->current_chapter) ? '1' : '0');
34 34
 				$arr['series'][$row->category]['unread_count'] = (($arr['series'][$row->category]['unread_count'] ?? 0) + !$is_unread);
35 35
 				$data = [
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 			$sortOrder = $this->User_Options->get('list_sort_order', $userID);
83 83
 			switch($this->User_Options->get('list_sort_type', $userID)) {
84 84
 				case 'unread':
85
-					foreach (array_keys($arr['series']) as $category) {
86
-						usort($arr['series'][$category]['manga'], function ($a, $b) use($sortOrder) {
85
+					foreach(array_keys($arr['series']) as $category) {
86
+						usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) {
87 87
 							$a_text = strtolower("{$a['new_chapter_exists']} - {$a['title_data']['title']}");
88 88
 							$b_text = strtolower("{$b['new_chapter_exists']} - {$b['title_data']['title']}");
89 89
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 					break;
98 98
 
99 99
 				case 'unread_latest':
100
-					foreach (array_keys($arr['series']) as $category) {
101
-						usort($arr['series'][$category]['manga'], function ($a, $b) use($sortOrder) {
100
+					foreach(array_keys($arr['series']) as $category) {
101
+						usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) {
102 102
 							$a_text = $a['new_chapter_exists'];
103 103
 							$b_text = $b['new_chapter_exists'];
104 104
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 					break;
120 120
 
121 121
 				case 'alphabetical':
122
-					foreach (array_keys($arr['series']) as $category) {
122
+					foreach(array_keys($arr['series']) as $category) {
123 123
 						usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) {
124 124
 							$a_text = strtolower("{$a['title_data']['title']}");
125 125
 							$b_text = strtolower("{$b['title_data']['title']}");
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 					break;
135 135
 
136 136
 				case 'my_status':
137
-					foreach (array_keys($arr['series']) as $category) {
137
+					foreach(array_keys($arr['series']) as $category) {
138 138
 						usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) {
139 139
 							$a_text = strtolower("{$a['generated_current_data']['number']}");
140 140
 							$b_text = strtolower("{$b['generated_current_data']['number']}");
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 					break;
150 150
 
151 151
 				case 'latest':
152
-					foreach (array_keys($arr['series']) as $category) {
152
+					foreach(array_keys($arr['series']) as $category) {
153 153
 						usort($arr['series'][$category]['manga'], function($a, $b) use($sortOrder) {
154 154
 							$a_text = new DateTime("{$a['title_data']['last_updated']}");
155 155
 							$b_text = new DateTime("{$b['title_data']['last_updated']}");
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 		return $status;
282 282
 	}
283 283
 
284
-	public function getMalID(int $userID, int $titleID) : ?array{
284
+	public function getMalID(int $userID, int $titleID) : ? array{
285 285
 		$malIDArr = NULL;
286 286
 
287 287
 		//NEW METHOD
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 			                  ->get('tracker_chapters');
320 320
 
321 321
 			if($queryC2->num_rows() > 0 && ($tag_string = $queryC2->row()->tags) && !is_null($tag_string)) {
322
-				$arr   = preg_grep('/^mal:([0-9]+|none)$/', explode(',', $tag_string));
322
+				$arr = preg_grep('/^mal:([0-9]+|none)$/', explode(',', $tag_string));
323 323
 				if(!empty($arr)) {
324 324
 					$malIDArr = [
325 325
 						'id'   => explode(':', $arr[0])[1],
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 
332 332
 		return $malIDArr;
333 333
 	}
334
-	public function setMalID(int $userID, int $chapterID, ?int $malID) : bool {
334
+	public function setMalID(int $userID, int $chapterID, ? int $malID) : bool {
335 335
 		//TODO: Handle NULL?
336 336
 		$success = (bool) $this->db->set(['mal_id' => $malID, 'active' => 'Y', 'last_updated' => NULL])
337 337
 		                           ->where('user_id', $userID)
Please login to merge, or discard this patch.
application/models/Tracker/Sites/LHTranslation.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -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
 class LHTranslation extends Base_Site_Model {
4 4
 	public $titleFormat   = '/^[a-zA-Z0-9_\-.]+$/';
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		];
16 16
 	}
17 17
 
18
-	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ?array {
18
+	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ? array {
19 19
 		$titleData = [];
20 20
 
21 21
 		$fullURL = $this->getFullTitleURL($title_url);
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 			$titleData['latest_chapter'] = preg_replace('/^read-(?:.*?)chapter-(.*?)\.html$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
38 38
 
39
-			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->textContent));
39
+			$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->textContent));
40 40
 		}
41 41
 
42 42
 		return (!empty($titleData) ? $titleData : NULL);
Please login to merge, or discard this patch.