Completed
Push — master ( 9156a4...0ac3a5 )
by Angus
04:44
created
application/models/Tracker/Tracker_Sites_Model.php 1 patch
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -125,7 +125,9 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	final public function isValidTitleURL(string $title_url) : bool {
127 127
 		$success = (bool) preg_match($this->titleFormat, $title_url);
128
-		if(!$success) log_message('error', "Invalid Title URL ({$this->site}): {$title_url}");
128
+		if(!$success) {
129
+			log_message('error', "Invalid Title URL ({$this->site}): {$title_url}");
130
+		}
129 131
 		return $success;
130 132
 	}
131 133
 
@@ -139,7 +141,9 @@  discard block
 block discarded – undo
139 141
 	 */
140 142
 	final public function isValidChapter(string $chapter) : bool {
141 143
 		$success = (bool) preg_match($this->chapterFormat, $chapter);
142
-		if(!$success) log_message('error', "Invalid Chapter ({$this->site}): {$chapter}");
144
+		if(!$success) {
145
+			log_message('error', "Invalid Chapter ({$this->site}): {$chapter}");
146
+		}
143 147
 		return $success;
144 148
 	}
145 149
 
@@ -168,14 +172,20 @@  discard block
 block discarded – undo
168 172
 			//curl_setopt($ch, CURLOPT_VERBOSE, 1);
169 173
 			curl_setopt($ch, CURLOPT_HEADER, 1);
170 174
 
171
-			if($follow_redirect)        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
175
+			if($follow_redirect) {
176
+				curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
177
+			}
172 178
 
173 179
 			if($cookies = $this->cache->get("cloudflare_{$this->site}")) {
174 180
 				$cookie_string .= "; {$cookies}";
175 181
 			}
176 182
 
177
-			if(!empty($cookie_string))  curl_setopt($ch, CURLOPT_COOKIE, $cookie_string);
178
-			if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path);
183
+			if(!empty($cookie_string)) {
184
+				curl_setopt($ch, CURLOPT_COOKIE, $cookie_string);
185
+			}
186
+			if(!empty($cookiejar_path)) {
187
+				curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path);
188
+			}
179 189
 
180 190
 			//Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff.
181 191
 			curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent);
@@ -206,7 +216,9 @@  discard block
 block discarded – undo
206 216
 			$body        = substr($response, $header_size);
207 217
 			curl_close($ch);
208 218
 
209
-			if($status_code === 503) $refresh = $this->handleCloudFlare($url, $body);
219
+			if($status_code === 503) {
220
+				$refresh = $this->handleCloudFlare($url, $body);
221
+			}
210 222
 		}
211 223
 
212 224
 		return [
@@ -312,7 +324,9 @@  discard block
 block discarded – undo
312 324
 								'nodes_chapter' => $nodes_chapter->item(0)
313 325
 							];
314 326
 
315
-							if(is_callable($extraCall)) $extraCall($xpath, $returnData);
327
+							if(is_callable($extraCall)) {
328
+								$extraCall($xpath, $returnData);
329
+							}
316 330
 
317 331
 							return $returnData;
318 332
 						} else {
@@ -326,7 +340,9 @@  discard block
 block discarded – undo
326 340
 						$noChaptersCall($data, $xpath, $returnData);
327 341
 
328 342
 						if(is_array($returnData)) {
329
-							if(is_callable($extraCall) && is_array($returnData)) $extraCall($xpath, $returnData);
343
+							if(is_callable($extraCall) && is_array($returnData)) {
344
+								$extraCall($xpath, $returnData);
345
+							}
330 346
 						} else {
331 347
 							log_message('error', "{$this->site} : {$title_url} | canHaveNoChapters set, but doesn't match possible checks! XPath is probably broken.");
332 348
 						}
@@ -461,8 +477,12 @@  discard block
 block discarded – undo
461 477
 		$status = FALSE;
462 478
 
463 479
 		//Make sure we have a volume element
464
-		if(count($oldChapterSegments) === 1) array_unshift($oldChapterSegments, 'v0');
465
-		if(count($newChapterSegments) === 1) array_unshift($newChapterSegments, 'v0');
480
+		if(count($oldChapterSegments) === 1) {
481
+			array_unshift($oldChapterSegments, 'v0');
482
+		}
483
+		if(count($newChapterSegments) === 1) {
484
+			array_unshift($newChapterSegments, 'v0');
485
+		}
466 486
 
467 487
 		$oldCount = count($oldChapterSegments);
468 488
 		$newCount = count($newChapterSegments);
@@ -475,8 +495,12 @@  discard block
 block discarded – undo
475 495
 				$newVolume = substr(array_shift($newChapterSegments), 1);
476 496
 
477 497
 				//Forcing volume to 0 as TBD might not be the latest (although it can be, but that is covered by other checks)
478
-				if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $oldVolume = 0;
479
-				if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $newVolume = 0;
498
+				if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) {
499
+					$oldVolume = 0;
500
+				}
501
+				if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) {
502
+					$newVolume = 0;
503
+				}
480 504
 
481 505
 				$oldVolume = floatval($oldVolume);
482 506
 				$newVolume = floatval($newVolume);
Please login to merge, or discard this patch.
application/config/constants.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 | always be used to set the mode correctly.
27 27
 |
28 28
 */
29
-defined('FILE_READ_MODE')  OR define('FILE_READ_MODE', 0644);
29
+defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644);
30 30
 defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
31
-defined('DIR_READ_MODE')   OR define('DIR_READ_MODE', 0755);
32
-defined('DIR_WRITE_MODE')  OR define('DIR_WRITE_MODE', 0755);
31
+defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755);
32
+defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
33 33
 
34 34
 /*
35 35
 |--------------------------------------------------------------------------
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
 | These modes are used when working with fopen()/popen()
40 40
 |
41 41
 */
42
-defined('FOPEN_READ')                           OR define('FOPEN_READ', 'rb');
43
-defined('FOPEN_READ_WRITE')                     OR define('FOPEN_READ_WRITE', 'r+b');
44
-defined('FOPEN_WRITE_CREATE_DESTRUCTIVE')       OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
42
+defined('FOPEN_READ') OR define('FOPEN_READ', 'rb');
43
+defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b');
44
+defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
45 45
 defined('FOPEN_READ_WRITE_CREATE_DESCTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
46
-defined('FOPEN_WRITE_CREATE')                   OR define('FOPEN_WRITE_CREATE', 'ab');
47
-defined('FOPEN_READ_WRITE_CREATE')              OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
48
-defined('FOPEN_WRITE_CREATE_STRICT')            OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
49
-defined('FOPEN_READ_WRITE_CREATE_STRICT')       OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
46
+defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab');
47
+defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
48
+defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
49
+defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
50 50
 
51 51
 /*
52 52
 |--------------------------------------------------------------------------
@@ -73,20 +73,20 @@  discard block
 block discarded – undo
73 73
 |       http://tldp.org/LDP/abs/html/exitcodes.html
74 74
 |
75 75
 */
76
-defined('EXIT_SUCCESS')        OR define('EXIT_SUCCESS', 0); // no errors
77
-defined('EXIT_ERROR')          OR define('EXIT_ERROR', 1); // generic error
78
-defined('EXIT_CONFIG')         OR define('EXIT_CONFIG', 3); // configuration error
79
-defined('EXIT_UNKNOWN_FILE')   OR define('EXIT_UNKNOWN_FILE', 4); // file not found
80
-defined('EXIT_UNKNOWN_CLASS')  OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
76
+defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors
77
+defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error
78
+defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error
79
+defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found
80
+defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
81 81
 defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
82
-defined('EXIT_USER_INPUT')     OR define('EXIT_USER_INPUT', 7); // invalid user input
83
-defined('EXIT_DATABASE')       OR define('EXIT_DATABASE', 8); // database error
84
-defined('EXIT__AUTO_MIN')      OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
85
-defined('EXIT__AUTO_MAX')      OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
82
+defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input
83
+defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error
84
+defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
85
+defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
86 86
 
87 87
 /***** TIMEAGO CONSTANTS *****/
88 88
 defined('TIMEAGO_MONTH') OR define('TIMEAGO_MONTH', strtotime('-1 month')); //1 month ago
89
-defined('TIMEAGO_WEEK')  OR define('TIMEAGO_WEEK', strtotime('-1 week')); //1 week ago
90
-defined('TIMEAGO_3DAY')  OR define('TIMEAGO_3DAY', strtotime('-3 day')); //3 days ago
89
+defined('TIMEAGO_WEEK') OR define('TIMEAGO_WEEK', strtotime('-1 week')); //1 week ago
90
+defined('TIMEAGO_3DAY') OR define('TIMEAGO_3DAY', strtotime('-3 day')); //3 days ago
91 91
 
92 92
 defined('USERSCRIPT_VERSION') OR define('USERSCRIPT_VERSION', '1.10.8'); //This is automatically set by a PHPStorm File Watcher
Please login to merge, or discard this patch.
Upper-Lower-Casing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-defined('BASEPATH') OR exit('No direct script access allowed');
2
+defined('BASEPATH') or exit('No direct script access allowed');
3 3
 
4 4
 /*
5 5
 |--------------------------------------------------------------------------
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 | of this setting
12 12
 |
13 13
 */
14
-defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
14
+defined('SHOW_DEBUG_BACKTRACE') or define('SHOW_DEBUG_BACKTRACE', TRUE);
15 15
 
16 16
 /*
17 17
 |--------------------------------------------------------------------------
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 | always be used to set the mode correctly.
27 27
 |
28 28
 */
29
-defined('FILE_READ_MODE')  OR define('FILE_READ_MODE', 0644);
30
-defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
31
-defined('DIR_READ_MODE')   OR define('DIR_READ_MODE', 0755);
32
-defined('DIR_WRITE_MODE')  OR define('DIR_WRITE_MODE', 0755);
29
+defined('FILE_READ_MODE')  or define('FILE_READ_MODE', 0644);
30
+defined('FILE_WRITE_MODE') or define('FILE_WRITE_MODE', 0666);
31
+defined('DIR_READ_MODE')   or define('DIR_READ_MODE', 0755);
32
+defined('DIR_WRITE_MODE')  or define('DIR_WRITE_MODE', 0755);
33 33
 
34 34
 /*
35 35
 |--------------------------------------------------------------------------
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
 | These modes are used when working with fopen()/popen()
40 40
 |
41 41
 */
42
-defined('FOPEN_READ')                           OR define('FOPEN_READ', 'rb');
43
-defined('FOPEN_READ_WRITE')                     OR define('FOPEN_READ_WRITE', 'r+b');
44
-defined('FOPEN_WRITE_CREATE_DESTRUCTIVE')       OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
45
-defined('FOPEN_READ_WRITE_CREATE_DESCTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
46
-defined('FOPEN_WRITE_CREATE')                   OR define('FOPEN_WRITE_CREATE', 'ab');
47
-defined('FOPEN_READ_WRITE_CREATE')              OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
48
-defined('FOPEN_WRITE_CREATE_STRICT')            OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
49
-defined('FOPEN_READ_WRITE_CREATE_STRICT')       OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
42
+defined('FOPEN_READ')                           or define('FOPEN_READ', 'rb');
43
+defined('FOPEN_READ_WRITE')                     or define('FOPEN_READ_WRITE', 'r+b');
44
+defined('FOPEN_WRITE_CREATE_DESTRUCTIVE')       or define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
45
+defined('FOPEN_READ_WRITE_CREATE_DESCTRUCTIVE') or define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
46
+defined('FOPEN_WRITE_CREATE')                   or define('FOPEN_WRITE_CREATE', 'ab');
47
+defined('FOPEN_READ_WRITE_CREATE')              or define('FOPEN_READ_WRITE_CREATE', 'a+b');
48
+defined('FOPEN_WRITE_CREATE_STRICT')            or define('FOPEN_WRITE_CREATE_STRICT', 'xb');
49
+defined('FOPEN_READ_WRITE_CREATE_STRICT')       or define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
50 50
 
51 51
 /*
52 52
 |--------------------------------------------------------------------------
@@ -73,20 +73,20 @@  discard block
 block discarded – undo
73 73
 |       http://tldp.org/LDP/abs/html/exitcodes.html
74 74
 |
75 75
 */
76
-defined('EXIT_SUCCESS')        OR define('EXIT_SUCCESS', 0); // no errors
77
-defined('EXIT_ERROR')          OR define('EXIT_ERROR', 1); // generic error
78
-defined('EXIT_CONFIG')         OR define('EXIT_CONFIG', 3); // configuration error
79
-defined('EXIT_UNKNOWN_FILE')   OR define('EXIT_UNKNOWN_FILE', 4); // file not found
80
-defined('EXIT_UNKNOWN_CLASS')  OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
81
-defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
82
-defined('EXIT_USER_INPUT')     OR define('EXIT_USER_INPUT', 7); // invalid user input
83
-defined('EXIT_DATABASE')       OR define('EXIT_DATABASE', 8); // database error
84
-defined('EXIT__AUTO_MIN')      OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
85
-defined('EXIT__AUTO_MAX')      OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
76
+defined('EXIT_SUCCESS')        or define('EXIT_SUCCESS', 0); // no errors
77
+defined('EXIT_ERROR')          or define('EXIT_ERROR', 1); // generic error
78
+defined('EXIT_CONFIG')         or define('EXIT_CONFIG', 3); // configuration error
79
+defined('EXIT_UNKNOWN_FILE')   or define('EXIT_UNKNOWN_FILE', 4); // file not found
80
+defined('EXIT_UNKNOWN_CLASS')  or define('EXIT_UNKNOWN_CLASS', 5); // unknown class
81
+defined('EXIT_UNKNOWN_METHOD') or define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
82
+defined('EXIT_USER_INPUT')     or define('EXIT_USER_INPUT', 7); // invalid user input
83
+defined('EXIT_DATABASE')       or define('EXIT_DATABASE', 8); // database error
84
+defined('EXIT__AUTO_MIN')      or define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
85
+defined('EXIT__AUTO_MAX')      or define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
86 86
 
87 87
 /***** TIMEAGO CONSTANTS *****/
88
-defined('TIMEAGO_MONTH') OR define('TIMEAGO_MONTH', strtotime('-1 month')); //1 month ago
89
-defined('TIMEAGO_WEEK')  OR define('TIMEAGO_WEEK', strtotime('-1 week')); //1 week ago
90
-defined('TIMEAGO_3DAY')  OR define('TIMEAGO_3DAY', strtotime('-3 day')); //3 days ago
88
+defined('TIMEAGO_MONTH') or define('TIMEAGO_MONTH', strtotime('-1 month')); //1 month ago
89
+defined('TIMEAGO_WEEK')  or define('TIMEAGO_WEEK', strtotime('-1 week')); //1 week ago
90
+defined('TIMEAGO_3DAY')  or define('TIMEAGO_3DAY', strtotime('-3 day')); //3 days ago
91 91
 
92
-defined('USERSCRIPT_VERSION') OR define('USERSCRIPT_VERSION', '1.10.8'); //This is automatically set by a PHPStorm File Watcher
92
+defined('USERSCRIPT_VERSION') or define('USERSCRIPT_VERSION', '1.10.8'); //This is automatically set by a PHPStorm File Watcher
Please login to merge, or discard this patch.