Completed
Push — master ( e9904b...fc1eea )
by Angus
02:49
created
application/models/Tracker/Tracker_Sites_Model.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 				//We don't want double trailing slashes, so fix this when possible.
121 121
 				$pageSeparator = '';
122 122
 			}
123
-			$pageURL = $chapterData['url'] . $pageSeparator . $page;
123
+			$pageURL = $chapterData['url'].$pageSeparator.$page;
124 124
 		}
125 125
 		return $pageURL;
126 126
 	}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
 			$ch = curl_init();
216 216
 			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
217
-			curl_setopt($ch, CURLOPT_ENCODING , 'gzip');
217
+			curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
218 218
 			//curl_setopt($ch, CURLOPT_VERBOSE, 1);
219 219
 			curl_setopt($ch, CURLOPT_HEADER, 1);
220 220
 
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 			curl_setopt($ch, CURLOPT_URL, $url);
242 242
 
243 243
 			if($isPost) {
244
-				curl_setopt($ch,CURLOPT_POST, count($postFields));
245
-				curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($postFields));
244
+				curl_setopt($ch, CURLOPT_POST, count($postFields));
245
+				curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postFields));
246 246
 			}
247 247
 
248 248
 			$response = curl_exec($ch);
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 			$result = shell_exec('python '.APPPATH.'../_scripts/get_cloudflare_cookie.py '.escapeshellarg(json_encode($urlData)));
290 290
 			$cookieData = json_decode($result, TRUE);
291 291
 
292
-			$this->cache->save("cloudflare_{$this->site}", $cookieData['cookies'],  31536000 /* 1 year, or until we renew it */);
292
+			$this->cache->save("cloudflare_{$this->site}", $cookieData['cookies'], 31536000 /* 1 year, or until we renew it */);
293 293
 			log_message('debug', "Saving CloudFlare Cookies for {$this->site}");
294 294
 
295 295
 			$refresh = TRUE;
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 				$dom = new DOMDocument();
354 354
 				libxml_use_internal_errors(TRUE);
355
-				$dom->loadHTML('<?xml encoding="utf-8" ?>' . $data);
355
+				$dom->loadHTML('<?xml encoding="utf-8" ?>'.$data);
356 356
 				libxml_use_internal_errors(FALSE);
357 357
 
358 358
 				$xpath = new DOMXPath($dom);
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 				if($nodes_title->length === 1) {
362 362
 					if($nodes_row->length === 1) {
363 363
 						$firstRow      = $nodes_row->item(0);
364
-						$nodes_latest  = $xpath->query($node_latest_string,  $firstRow);
364
+						$nodes_latest  = $xpath->query($node_latest_string, $firstRow);
365 365
 
366 366
 						if($node_chapter_string !== '') {
367 367
 							$nodes_chapter = $xpath->query($node_chapter_string, $firstRow);
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	final private function _setSiteRateLimit(?int $rateLimit = NULL) : bool {
578 578
 		//We would just use increment(), but we can't set ttl with it...
579 579
 		$currentRateLimit = $rateLimit ?: $this->_getSiteRateLimit();
580
-		return $this->cache->save("{$this->site}_ratelimit", $currentRateLimit + 1,3600);
580
+		return $this->cache->save("{$this->site}_ratelimit", $currentRateLimit + 1, 3600);
581 581
 	}
582 582
 }
583 583
 
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 		$chapter_parts = explode('/', $chapter); //returns #LANG#/#VOLUME#/#CHAPTER#/#CHAPTER_EXTRA#(/#PAGE#/)
596 596
 		return [
597 597
 			'url'    => $this->getChapterURL($title_url, $chapter),
598
-			'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/
598
+			'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/
599 599
 		];
600 600
 	}
601 601
 	public function getChapterURL(string $title_url, string $chapter) : string {
@@ -785,9 +785,9 @@  discard block
 block discarded – undo
785 785
 
786 786
 							$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.
787 787
 							if($dateString == 'T') {
788
-								$dateString = date("Y-m-d",now());
788
+								$dateString = date("Y-m-d", now());
789 789
 							}
790
-							$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString . ' 00:00'));
790
+							$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString.' 00:00'));
791 791
 
792 792
 							$titleDataList[$title_url] = $titleData;
793 793
 						}
@@ -952,11 +952,11 @@  discard block
 block discarded – undo
952 952
 			""
953 953
 		);
954 954
 		if($data) {
955
-			$titleData['title'] = trim(preg_replace('/ Added on .*$/','', $data['nodes_title']->textContent));
955
+			$titleData['title'] = trim(preg_replace('/ Added on .*$/', '', $data['nodes_title']->textContent));
956 956
 			$titleData['latest_chapter'] = preg_replace('/^.*\/([0-9\.]+)$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
957 957
 
958
-			$dateString = preg_replace('/^Added (?:on )?/', '',$data['nodes_latest']->textContent);
959
-			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime($dateString));
958
+			$dateString = preg_replace('/^Added (?:on )?/', '', $data['nodes_latest']->textContent);
959
+			$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime($dateString));
960 960
 		}
961 961
 		return (!empty($titleData) ? $titleData : NULL);
962 962
 	}
@@ -1034,9 +1034,9 @@  discard block
 block discarded – undo
1034 1034
 	public function getChapterData(string $title_url, string $chapter) : array {
1035 1035
 		if(strpos($chapter, '/')) {
1036 1036
 			$chapterArr = explode('/', $chapter);
1037
-			$chapterN   = "v{$chapterArr[0]}/c".str_replace('chapter_','',$chapterArr[1]);
1038
-		} else if (ctype_digit($chapter)) {
1039
-			$chapterN = 'c'.str_replace('chapter_','', $chapter);
1037
+			$chapterN   = "v{$chapterArr[0]}/c".str_replace('chapter_', '', $chapterArr[1]);
1038
+		} else if(ctype_digit($chapter)) {
1039
+			$chapterN = 'c'.str_replace('chapter_', '', $chapter);
1040 1040
 		}
1041 1041
 		return [
1042 1042
 			'url'    => $this->getChapterURL($title_url, $chapter),
Please login to merge, or discard this patch.