Completed
Push — master ( 0f9479...65c76e )
by Angus
02:49
created
application/libraries/Cacher.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 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
 //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
 
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_Sites_Model.php 1 patch
Spacing   +11 added lines, -11 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
 /**
4 4
  * Class Tracker_Sites_Model
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @param bool   $firstGet
103 103
 	 * @return array|null [title,latest_chapter,last_updated,followed?]
104 104
 	 */
105
-	abstract public function getTitleData(string $title_url, bool $firstGet = FALSE) : ?array;
105
+	abstract public function getTitleData(string $title_url, bool $firstGet = FALSE) : ? array;
106 106
 
107 107
 	/**
108 108
 	 * Validates given $title_url against titleFormat.
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
 			$ch = curl_init();
153 153
 			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
154
-			curl_setopt($ch, CURLOPT_ENCODING , "gzip");
154
+			curl_setopt($ch, CURLOPT_ENCODING, "gzip");
155 155
 			//curl_setopt($ch, CURLOPT_VERBOSE, 1);
156 156
 			curl_setopt($ch, CURLOPT_HEADER, 1);
157 157
 
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 			curl_setopt($ch, CURLOPT_URL, $url);
174 174
 
175 175
 			if($isPost) {
176
-				curl_setopt($ch,CURLOPT_POST, count($postFields));
177
-				curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($postFields));
176
+				curl_setopt($ch, CURLOPT_POST, count($postFields));
177
+				curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postFields));
178 178
 			}
179 179
 
180 180
 			$response = curl_exec($ch);
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			$result = shell_exec('python '.APPPATH.'../_scripts/get_cloudflare_cookie.py '.escapeshellarg(json_encode($urlData)));
218 218
 			$cookieData = json_decode($result, TRUE);
219 219
 
220
-			$this->cache->save("cloudflare_{$this->site}", $cookieData['cookies'],  31536000 /* 1 year, or until we renew it */);
220
+			$this->cache->save("cloudflare_{$this->site}", $cookieData['cookies'], 31536000 /* 1 year, or until we renew it */);
221 221
 			$refresh = TRUE;
222 222
 		} else {
223 223
 			//Either site doesn't have CloudFlare or we have bypassed it. Either is good!
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
 				$dom = new DOMDocument();
268 268
 				libxml_use_internal_errors(TRUE);
269
-				$dom->loadHTML('<?xml encoding="utf-8" ?>' . $data);
269
+				$dom->loadHTML('<?xml encoding="utf-8" ?>'.$data);
270 270
 				libxml_use_internal_errors(FALSE);
271 271
 
272 272
 				$xpath = new DOMXPath($dom);
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 				$nodes_row   = $xpath->query($node_row_string);
275 275
 				if($nodes_title->length === 1 && $nodes_row->length === 1) {
276 276
 					$firstRow      = $nodes_row->item(0);
277
-					$nodes_latest  = $xpath->query($node_latest_string,  $firstRow);
277
+					$nodes_latest  = $xpath->query($node_latest_string, $firstRow);
278 278
 
279 279
 					if($node_chapter_string !== '') {
280 280
 						$nodes_chapter = $xpath->query($node_chapter_string, $firstRow);
@@ -462,14 +462,14 @@  discard block
 block discarded – undo
462 462
 		$chapter_parts = explode('/', $chapter); //returns #LANG#/#VOLUME#/#CHAPTER#/#CHAPTER_EXTRA#(/#PAGE#/)
463 463
 		return [
464 464
 			'url'    => $this->getChapterURL($title_url, $chapter),
465
-			'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/
465
+			'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/
466 466
 		];
467 467
 	}
468 468
 	public function getChapterURL(string $title_url, string $chapter) : string {
469 469
 		return "{$this->baseURL}/read/{$title_url}/{$chapter}/";
470 470
 	}
471 471
 
472
-	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ?array {
472
+	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ? array {
473 473
 		$titleData = [];
474 474
 
475 475
 		$jsonURL = $this->getJSONTitleURL($title_url);
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		return $this->getFullTitleURL($title_url).'/'.$chapter;
590 590
 	}
591 591
 
592
-	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ?array {
592
+	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ? array {
593 593
 		$titleData = [];
594 594
 
595 595
 		$fullURL = $this->getFullTitleURL($title_url);
Please login to merge, or discard this patch.
application/models/Tracker/Sites/LHTranslation.php 1 patch
Spacing   +5 added lines, -5 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 LHTranslation extends Base_Site_Model {
4 4
 	public $titleFormat   = '/^[a-zA-Z0-9_\-.]+$/';
5 5
 	public $chapterFormat = '/^[0-9\.]+$/';
6 6
 
7 7
 	public function getFullTitleURL(string $title_url) : string {
8
-		$title_url = str_replace('.','', $title_url);
8
+		$title_url = str_replace('.', '', $title_url);
9 9
 		return "http://lhtranslation.com/{$title_url}";
10 10
 	}
11 11
 
@@ -17,17 +17,17 @@  discard block
 block discarded – undo
17 17
 		];
18 18
 	}
19 19
 
20
-	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ?array {
20
+	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ? array {
21 21
 		$titleData = [];
22 22
 
23
-		$title_url = str_replace('.','', $title_url);
23
+		$title_url = str_replace('.', '', $title_url);
24 24
 		$title_url = $this->_fixTitle($title_url);
25 25
 		$fullURL = "http://lhtranslation.com/{$title_url}/feed/";
26 26
 		$content = $this->get_content($fullURL);
27 27
 
28 28
 		$data = $content['body'];
29 29
 		$xml = simplexml_load_string($data) or die("Error: Cannot create object");
30
-		if(((string) $xml->{'channel'}->title) !== 'Comments on: '){
30
+		if(((string) $xml->{'channel'}->title) !== 'Comments on: ') {
31 31
 			if(isset($xml->{'channel'}->item[0])) {
32 32
 				if($title = (string) $xml->{'channel'}->item[0]->category) {
33 33
 					$titleData['title'] = trim($title);
Please login to merge, or discard this patch.
application/core/MY_Controller.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 	protected $footer_data = array();
7 7
 	public    $global_data = array();
8 8
 
9
-	public function __construct(){
9
+	public function __construct() {
10 10
 		parent::__construct();
11 11
 
12 12
 		//FIXME: This is pretty much a phpUnit hack. Without it phpUnit fails here. We need a proper way to fake user/admin testing.
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 
19 19
 		$this->global_data['theme'] = $this->User_Options->get('theme');
20 20
 		$css_path = "css/main.{$this->User_Options->get('theme')}";
21
-		$this->global_data['complied_css_path'] = asset_url()."{$css_path}.".filemtime(APPPATH . "../public/assets/{$css_path}.css").".css";
21
+		$this->global_data['complied_css_path'] = asset_url()."{$css_path}.".filemtime(APPPATH."../public/assets/{$css_path}.css").".css";
22 22
 
23 23
 		$js_path = 'js/compiled.min';
24
-		$this->global_data['complied_js_path']  = asset_url()."{$js_path}.".filemtime(APPPATH . "../public/assets/{$js_path}.js").".js";
24
+		$this->global_data['complied_js_path']  = asset_url()."{$js_path}.".filemtime(APPPATH."../public/assets/{$js_path}.js").".js";
25 25
 	}
26 26
 
27 27
 	public function _render_page(/*(array) $paths*/) : void {
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		$json = is_array($json_input) ? json_encode($json_input) : $json_input;
46 46
 
47 47
 		$this->output->set_content_type('application/json', 'utf-8');
48
-		$this->_render_content($json,'json', $download, $filenamePrefix);
48
+		$this->_render_content($json, 'json', $download, $filenamePrefix);
49 49
 	}
50 50
 	public function _render_content(string $content, string $filenameExt, bool $download = FALSE, string $filenamePrefix = 'tracker') : void {
51 51
 		if($download) {
Please login to merge, or discard this patch.