Completed
Pull Request — master (#172)
by
unknown
02:56
created
application/models/User_Options_Model.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); 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 User_Options_Model extends CI_Model {
4 4
 	public $options = array(
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @return mixed Returns option value as STRING, or FALSE if option does not exist.
118 118
 	 */
119
-	public function get(string $option, ?int $userID = NULL) {
119
+	public function get(string $option, ? int $userID = NULL) {
120 120
 		$userID = (is_null($userID) ? (int) $this->User->id : $userID);
121 121
 
122 122
 		return $this->get_by_userid($option, $userID);
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 			$query = $this->db->select('value_str, value_int')
191 191
 			                  ->from('user_options')
192 192
 			                  ->where('user_id', $userID)
193
-			                  ->where('name',    $option)
193
+			                  ->where('name', $option)
194 194
 			                  ->limit(1);
195 195
 			$data = $query->get()->row_array();
196 196
 		} else {
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 				$query = $this->db->select('value_str, value_int')
199 199
 				                  ->from('user_options')
200 200
 				                  ->where('user_id', $userID)
201
-				                  ->where('name',    $option)
201
+				                  ->where('name', $option)
202 202
 				                  ->limit(1);
203 203
 				$data = $query->get()->row_array();
204 204
 				$this->session->set_tempdata("option_{$option}", $data, 3600);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			);
252 252
 			//FIXME: Get a better solution than str_replace for removing special characters
253 253
 			$elements = array();
254
-			foreach (array_values($this->options[$option]['valid_options']) as $valid_option) {
254
+			foreach(array_values($this->options[$option]['valid_options']) as $valid_option) {
255 255
 				$elements[$option.'_'.str_replace(',', '_', $valid_option)] = array_merge($base_attributes, array(
256 256
 					'value' => $valid_option
257 257
 				));
Please login to merge, or discard this patch.
application/controllers/User/Options.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
 		$usedCategories   = $this->Tracker->category->getUsed($this->User->id);
17 17
 
18 18
 		//NOTE: The checkbox validation is handled in run()
19
-		$this->form_validation->set_rules('category_custom_1_text',  'Custom Category 1 Text',  'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]');
20
-		$this->form_validation->set_rules('category_custom_2_text',  'Custom Category 2 Text',  'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]');
21
-		$this->form_validation->set_rules('category_custom_3_text',  'Custom Category 3 Text',  'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]');
19
+		$this->form_validation->set_rules('category_custom_1_text', 'Custom Category 1 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]');
20
+		$this->form_validation->set_rules('category_custom_2_text', 'Custom Category 2 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]');
21
+		$this->form_validation->set_rules('category_custom_3_text', 'Custom Category 3 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]');
22 22
 		$this->form_validation->set_rules('default_series_category', 'Default Series Category', 'required|is_valid_option_value[default_series_category]');
23
-		$this->form_validation->set_rules('list_sort_type',          'List Sort Type',          'required|is_valid_option_value[list_sort_type]');
24
-		$this->form_validation->set_rules('list_sort_order',         'List Sort Order',         'required|is_valid_option_value[list_sort_order]');
25
-		$this->form_validation->set_rules('theme',                   'Theme',                   'required|is_valid_option_value[theme]');
26
-		$this->form_validation->set_rules('mal_sync',                'MAL Sync',                'required|is_valid_option_value[mal_sync]');
23
+		$this->form_validation->set_rules('list_sort_type', 'List Sort Type', 'required|is_valid_option_value[list_sort_type]');
24
+		$this->form_validation->set_rules('list_sort_order', 'List Sort Order', 'required|is_valid_option_value[list_sort_order]');
25
+		$this->form_validation->set_rules('theme', 'Theme', 'required|is_valid_option_value[theme]');
26
+		$this->form_validation->set_rules('mal_sync', 'MAL Sync', 'required|is_valid_option_value[mal_sync]');
27 27
 
28
-		if ($isValid = $this->form_validation->run() === TRUE) {
28
+		if($isValid = $this->form_validation->run() === TRUE) {
29 29
 			foreach($customCategories as $categoryK => $category) {
30 30
 				if(!in_array($categoryK, $usedCategories)) {
31 31
 					$this->User_Options->set($category, $this->input->post($category) ? 'enabled' : 'disabled');
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
 			$this->User_Options->set('enable_live_countdown_timer', $this->input->post('enable_live_countdown_timer'));
40 40
 
41
-			$this->User_Options->set('list_sort_type',  $this->input->post('list_sort_type'));
41
+			$this->User_Options->set('list_sort_type', $this->input->post('list_sort_type'));
42 42
 			$this->User_Options->set('list_sort_order', $this->input->post('list_sort_order'));
43 43
 			
44 44
 			$this->User_Options->set('theme', $this->input->post('theme'));
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_Base_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 Tracker_Base_Model extends CI_Model {
4 4
 	public $sites;
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 			$this->enabledCategories['custom3'] = $this->User_Options->get('category_custom_3_text');
27 27
 		}
28 28
 
29
-		foreach (glob(APPPATH.'models/Tracker/Sites/*.php') as $filename) {
29
+		foreach(glob(APPPATH.'models/Tracker/Sites/*.php') as $filename) {
30 30
 			/** @noinspection PhpIncludeInspection */
31 31
 			include_once $filename;
32 32
 		}
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 	}
36 36
 
37
-	public function getEnabledCategories(?int $userID = NULL) : array {
37
+	public function getEnabledCategories(? int $userID = NULL) : array {
38 38
 		$userID = (is_null($userID) ? (int) $this->User->id : $userID);
39 39
 
40 40
 		$enabledCategories = [];
Please login to merge, or discard this patch.
application/controllers/User/History.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 			case 'csv':
33 33
 				$this->output->set_content_type('text/csv', 'utf-8');
34
-				$this->_render_content($this->arrayToCSVRecursive($historyData), 'csv',TRUE, 'tracker-history');
34
+				$this->_render_content($this->arrayToCSVRecursive($historyData), 'csv', TRUE, 'tracker-history');
35 35
 				break;
36 36
 
37 37
 			default:
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
 		$enclosure_esc = preg_quote($enclosure, '/');
51 51
 
52 52
 		$output = array();
53
-		foreach ($fields as $field) {
54
-			if ($field === NULL && $nullToMysqlNull) {
53
+		foreach($fields as $field) {
54
+			if($field === NULL && $nullToMysqlNull) {
55 55
 				$output[] = 'NULL';
56 56
 				continue;
57 57
 			}
58 58
 
59 59
 			// Enclose fields containing $delimiter, $enclosure or whitespace
60
-			if ($encloseAll || preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field)) {
61
-				$output[] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field) . $enclosure;
60
+			if($encloseAll || preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field)) {
61
+				$output[] = $enclosure.str_replace($enclosure, $enclosure.$enclosure, $field).$enclosure;
62 62
 			} else {
63 63
 				$output[] = $field;
64 64
 			}
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 		$csvArr = [
71 71
 			'Date/Time,Title,URL,Site,Status'
72 72
 		];
73
-		foreach ($fields as $field) {
74
-			$csvArr[] = $this->arrayToCSV($field, $delimiter, $enclosure,$encloseAll,$nullToMysqlNull);
73
+		foreach($fields as $field) {
74
+			$csvArr[] = $this->arrayToCSV($field, $delimiter, $enclosure, $encloseAll, $nullToMysqlNull);
75 75
 		}
76 76
 
77
-		return implode(PHP_EOL,$csvArr);
77
+		return implode(PHP_EOL, $csvArr);
78 78
 	}
79 79
 }
Please login to merge, or discard this patch.
application/controllers/UpdateStatus.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 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 UpdateStatus extends MY_Controller {
4 4
 	public function __construct() {
Please login to merge, or discard this patch.
application/controllers/AdminPanel.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 AdminPanel extends Admin_Controller {
4 4
 	public function __construct() {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
 				if(!empty($matches)) {
82 82
 					$malID = ($matches[1] !== 'none' ? $matches[1] : '0');
83
-					$new_tags = implode(',', array_diff( explode(',', $row->tags), [$matches[0]]));
83
+					$new_tags = implode(',', array_diff(explode(',', $row->tags), [$matches[0]]));
84 84
 
85 85
 					$this->db->set(['mal_id' => $malID, 'tags' => $new_tags, 'last_updated' => NULL])
86 86
 					         ->where('id', $row->id)
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
 		$this->load->driver('cache', array('adapter' => 'file', 'backup' => 'apc')); //Sadly we can't autoload this with params
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 		$this->global_data['analytics_tracking_id'] = $this->config->item('tracking_id');
21 21
 
22 22
 		$css_path = "css/main.{$this->User_Options->get('theme')}";
23
-		$this->global_data['complied_css_path'] = asset_url()."{$css_path}.".filemtime(APPPATH . "../public/assets/{$css_path}.css").".css";
23
+		$this->global_data['complied_css_path'] = asset_url()."{$css_path}.".filemtime(APPPATH."../public/assets/{$css_path}.css").".css";
24 24
 
25 25
 		$js_path = 'js/compiled.min';
26
-		$this->global_data['complied_js_path']  = asset_url()."{$js_path}.".filemtime(APPPATH . "../public/assets/{$js_path}.js").".js";
26
+		$this->global_data['complied_js_path']  = asset_url()."{$js_path}.".filemtime(APPPATH."../public/assets/{$js_path}.js").".js";
27 27
 	}
28 28
 
29 29
 	public function _render_page(/*(array) $paths*/) : void {
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		$json = is_array($json_input) ? json_encode($json_input) : $json_input;
48 48
 
49 49
 		$this->output->set_content_type('application/json', 'utf-8');
50
-		$this->_render_content($json,'json', $download, $filenamePrefix);
50
+		$this->_render_content($json, 'json', $download, $filenamePrefix);
51 51
 	}
52 52
 	public function _render_content(string $content, string $filenameExt, bool $download = FALSE, string $filenamePrefix = 'tracker') : void {
53 53
 		if($download) {
Please login to merge, or discard this patch.
application/controllers/Ajax/TrackerInline.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * URL:        /ajax/update_inline
27 27
 	 */
28 28
 	public function update() : void {
29
-		$this->form_validation->set_rules('id',      'Chapter ID', 'required|ctype_digit');
30
-		$this->form_validation->set_rules('chapter', 'Chapter',    'required');
29
+		$this->form_validation->set_rules('id', 'Chapter ID', 'required|ctype_digit');
30
+		$this->form_validation->set_rules('chapter', 'Chapter', 'required');
31 31
 
32 32
 		if($this->form_validation->run() === TRUE) {
33 33
 			$success = $this->Tracker->list->updateByID($this->userID, $this->input->post('id'), $this->input->post('chapter'));
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 * URL:        /tag_update
123 123
 	 */
124 124
 	public function tag_update() : void {
125
-		$this->form_validation->set_rules('id',         'Chapter ID', 'required|ctype_digit');
125
+		$this->form_validation->set_rules('id', 'Chapter ID', 'required|ctype_digit');
126 126
 		$this->form_validation->set_rules('tag_string', 'Tag String', 'max_length[255]|is_valid_tag_string|not_equals[none]');
127 127
 
128 128
 		if($this->form_validation->run() === TRUE) {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * URL:        /set_category
170 170
 	 */
171 171
 	public function set_category() : void {
172
-		$this->form_validation->set_rules('id[]',     'List of IDs',   'required|ctype_digit');
172
+		$this->form_validation->set_rules('id[]', 'List of IDs', 'required|ctype_digit');
173 173
 		$this->form_validation->set_rules('category', 'Category Name', 'required|is_valid_category');
174 174
 
175 175
 		if($this->form_validation->run() === TRUE) {
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
 	 * URL:        /ajax/ignore_inline
216 216
 	 */
217 217
 	public function ignore() : void {
218
-		$this->form_validation->set_rules('id',      'Chapter ID', 'required|ctype_digit');
219
-		$this->form_validation->set_rules('chapter', 'Chapter',    'required');
218
+		$this->form_validation->set_rules('id', 'Chapter ID', 'required|ctype_digit');
219
+		$this->form_validation->set_rules('chapter', 'Chapter', 'required');
220 220
 
221 221
 		if($this->form_validation->run() === TRUE) {
222 222
 			$success = $this->Tracker->list->ignoreByID($this->userID, $this->input->post('id'), $this->input->post('chapter'));
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 	 * URL:        /set_mal_id
239 239
 	 */
240 240
 	public function set_mal_id() : void {
241
-		$this->form_validation->set_rules('id',     'Chapter ID', 'required|ctype_digit');
242
-		$this->form_validation->set_rules('mal_id', 'MAL ID',     'regex_match[/^[0-9]*$/]');
241
+		$this->form_validation->set_rules('id', 'Chapter ID', 'required|ctype_digit');
242
+		$this->form_validation->set_rules('mal_id', 'MAL ID', 'regex_match[/^[0-9]*$/]');
243 243
 
244 244
 		if($this->form_validation->run() === TRUE) {
245 245
 			$malID = (is_numeric($this->input->post('mal_id')) ? $this->input->post('mal_id') : NULL);
Please login to merge, or discard this patch.
application/controllers/Ajax/Userscript.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
 	public function report_bug() : void {
79 79
 		$this->load->library('user_agent');
80 80
 		if($this->output->is_custom_header_set()) { $this->output->reset_status_header(); return; }
81
-		$this->form_validation->set_rules('bug[url]',  'Bug [URL]',  'required');
81
+		$this->form_validation->set_rules('bug[url]', 'Bug [URL]', 'required');
82 82
 		$this->form_validation->set_rules('bug[text]', 'Bug [Text]', 'required');
83 83
 
84 84
 		if($this->form_validation->run() === TRUE) {
Please login to merge, or discard this patch.