@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | protected $model_name = ''; |
40 | 40 | |
41 | - protected $table_exists = false; |
|
41 | + protected $table_exists = false; |
|
42 | 42 | |
43 | 43 | //-------------------------------------------------------------------- |
44 | 44 | |
@@ -46,32 +46,32 @@ discard block |
||
46 | 46 | { |
47 | 47 | $name = array_shift( $segments ); |
48 | 48 | |
49 | - // If a table already exists then we don't need a migration |
|
50 | - $this->load->database(); |
|
51 | - if ($this->db->table_exists($name)) |
|
52 | - { |
|
53 | - $this->table_exists = true; |
|
54 | - } |
|
49 | + // If a table already exists then we don't need a migration |
|
50 | + $this->load->database(); |
|
51 | + if ($this->db->table_exists($name)) |
|
52 | + { |
|
53 | + $this->table_exists = true; |
|
54 | + } |
|
55 | 55 | |
56 | 56 | // If we didn't attach any fields, then we |
57 | 57 | // need to generate the barebones here. |
58 | 58 | $this->fields = CLI::option('fields'); |
59 | 59 | |
60 | - // If we don't have any fields, and no model |
|
61 | - // exists, then we need to provide some default fields. |
|
62 | - if (empty($this->fields)) |
|
63 | - { |
|
64 | - if (! $this->table_exists) |
|
65 | - { |
|
66 | - $this->fields = "id:int id:id title:string created_on:datetime modified_on:datetime"; |
|
67 | - } |
|
68 | - } |
|
60 | + // If we don't have any fields, and no model |
|
61 | + // exists, then we need to provide some default fields. |
|
62 | + if (empty($this->fields)) |
|
63 | + { |
|
64 | + if (! $this->table_exists) |
|
65 | + { |
|
66 | + $this->fields = "id:int id:id title:string created_on:datetime modified_on:datetime"; |
|
67 | + } |
|
68 | + } |
|
69 | 69 | |
70 | 70 | // Perform the steps. |
71 | - if (! $this->table_exists) |
|
72 | - { |
|
73 | - $this->makeMigration( $name ); |
|
74 | - } |
|
71 | + if (! $this->table_exists) |
|
72 | + { |
|
73 | + $this->makeMigration( $name ); |
|
74 | + } |
|
75 | 75 | $this->makeSeed($name); |
76 | 76 | $this->makeModel($name); |
77 | 77 | $this->makeController($name); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | public function makeSeed($name) |
100 | 100 | { |
101 | - $this->generate("seed {$name}", null, true); |
|
101 | + $this->generate("seed {$name}", null, true); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | //-------------------------------------------------------------------- |
@@ -106,33 +106,33 @@ discard block |
||
106 | 106 | |
107 | 107 | public function makeModel($name) |
108 | 108 | { |
109 | - $this->load->helper('inflector'); |
|
109 | + $this->load->helper('inflector'); |
|
110 | 110 | |
111 | 111 | $name = singular($name); |
112 | 112 | $this->model_name = $name; |
113 | 113 | |
114 | - // If a table exists, we can build it from that |
|
115 | - if ($this->table_exists) |
|
116 | - { |
|
117 | - $this->generate( "model {$name}", "-table $name -primary_key id", TRUE ); |
|
118 | - } |
|
119 | - // Otherwise, we need to provide the fields to make the model out of. |
|
120 | - else |
|
121 | - { |
|
122 | - $this->generate( "model {$name}", "-fields '{$this->fields}'", TRUE ); |
|
123 | - } |
|
114 | + // If a table exists, we can build it from that |
|
115 | + if ($this->table_exists) |
|
116 | + { |
|
117 | + $this->generate( "model {$name}", "-table $name -primary_key id", TRUE ); |
|
118 | + } |
|
119 | + // Otherwise, we need to provide the fields to make the model out of. |
|
120 | + else |
|
121 | + { |
|
122 | + $this->generate( "model {$name}", "-fields '{$this->fields}'", TRUE ); |
|
123 | + } |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | //-------------------------------------------------------------------- |
127 | 127 | |
128 | 128 | public function makeController($name) |
129 | 129 | { |
130 | - $options = "-model {$this->model_name} -create_views"; |
|
130 | + $options = "-model {$this->model_name} -create_views"; |
|
131 | 131 | |
132 | - if (! empty($this->fields)) |
|
133 | - { |
|
134 | - $options .= " -fields '{$this->fields}'"; |
|
135 | - } |
|
132 | + if (! empty($this->fields)) |
|
133 | + { |
|
134 | + $options .= " -fields '{$this->fields}'"; |
|
135 | + } |
|
136 | 136 | |
137 | 137 | $this->generate("controller {$name}", $options, true); |
138 | 138 | } |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | |
43 | 43 | //-------------------------------------------------------------------- |
44 | 44 | |
45 | - public function run($segments = [ ], $quiet = false) |
|
45 | + public function run($segments = [], $quiet = false) |
|
46 | 46 | { |
47 | - $name = array_shift( $segments ); |
|
47 | + $name = array_shift($segments); |
|
48 | 48 | |
49 | 49 | // If a table already exists then we don't need a migration |
50 | 50 | $this->load->database(); |
@@ -61,16 +61,16 @@ discard block |
||
61 | 61 | // exists, then we need to provide some default fields. |
62 | 62 | if (empty($this->fields)) |
63 | 63 | { |
64 | - if (! $this->table_exists) |
|
64 | + if ( ! $this->table_exists) |
|
65 | 65 | { |
66 | 66 | $this->fields = "id:int id:id title:string created_on:datetime modified_on:datetime"; |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | 70 | // Perform the steps. |
71 | - if (! $this->table_exists) |
|
71 | + if ( ! $this->table_exists) |
|
72 | 72 | { |
73 | - $this->makeMigration( $name ); |
|
73 | + $this->makeMigration($name); |
|
74 | 74 | } |
75 | 75 | $this->makeSeed($name); |
76 | 76 | $this->makeModel($name); |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | // If a table exists, we can build it from that |
115 | 115 | if ($this->table_exists) |
116 | 116 | { |
117 | - $this->generate( "model {$name}", "-table $name -primary_key id", TRUE ); |
|
117 | + $this->generate("model {$name}", "-table $name -primary_key id", TRUE); |
|
118 | 118 | } |
119 | 119 | // Otherwise, we need to provide the fields to make the model out of. |
120 | 120 | else |
121 | 121 | { |
122 | - $this->generate( "model {$name}", "-fields '{$this->fields}'", TRUE ); |
|
122 | + $this->generate("model {$name}", "-fields '{$this->fields}'", TRUE); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | { |
130 | 130 | $options = "-model {$this->model_name} -create_views"; |
131 | 131 | |
132 | - if (! empty($this->fields)) |
|
132 | + if ( ! empty($this->fields)) |
|
133 | 133 | { |
134 | 134 | $options .= " -fields '{$this->fields}'"; |
135 | 135 | } |
@@ -34,36 +34,36 @@ |
||
34 | 34 | |
35 | 35 | class SeedGenerator extends \Myth\Forge\BaseGenerator { |
36 | 36 | |
37 | - public function run($segments=[], $quiet=false) |
|
37 | + public function run($segments = [], $quiet = false) |
|
38 | 38 | { |
39 | - $name = array_shift( $segments ); |
|
39 | + $name = array_shift($segments); |
|
40 | 40 | |
41 | - if ( empty( $name ) ) |
|
41 | + if (empty($name)) |
|
42 | 42 | { |
43 | - $name = CLI::prompt( 'Seed name' ); |
|
43 | + $name = CLI::prompt('Seed name'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | // Format to CI Standards |
47 | - $name = str_replace('.php', '', strtolower( $name ) ); |
|
48 | - if (substr( $name, -4) == 'seed') |
|
47 | + $name = str_replace('.php', '', strtolower($name)); |
|
48 | + if (substr($name, -4) == 'seed') |
|
49 | 49 | { |
50 | 50 | $name = substr($name, 0, strlen($name) - 4); |
51 | 51 | } |
52 | - $name = ucfirst($name) .'Seeder'; |
|
52 | + $name = ucfirst($name).'Seeder'; |
|
53 | 53 | |
54 | 54 | $data = [ |
55 | 55 | 'seed_name' => $name, |
56 | - 'today' => date( 'Y-m-d H:ia' ) |
|
56 | + 'today' => date('Y-m-d H:ia') |
|
57 | 57 | ]; |
58 | 58 | |
59 | - $destination = $this->determineOutputPath( 'database/seeds' ) . $name . '.php'; |
|
59 | + $destination = $this->determineOutputPath('database/seeds').$name.'.php'; |
|
60 | 60 | |
61 | 61 | if (strpos($destination, 'modules') !== false) |
62 | 62 | { |
63 | 63 | $destination = str_replace('database/', '', $destination); |
64 | 64 | } |
65 | 65 | |
66 | - if (! $this->copyTemplate( 'seed', $destination, $data, $this->overwrite) ) |
|
66 | + if ( ! $this->copyTemplate('seed', $destination, $data, $this->overwrite)) |
|
67 | 67 | { |
68 | 68 | CLI::error('Error creating seed file.'); |
69 | 69 | } |
@@ -34,21 +34,21 @@ |
||
34 | 34 | |
35 | 35 | class ViewGenerator extends \Myth\Forge\BaseGenerator { |
36 | 36 | |
37 | - public function run($segments=[], $quiet=false) |
|
37 | + public function run($segments = [], $quiet = false) |
|
38 | 38 | { |
39 | - $name = array_shift( $segments ); |
|
39 | + $name = array_shift($segments); |
|
40 | 40 | |
41 | - if ( empty( $name ) ) |
|
41 | + if (empty($name)) |
|
42 | 42 | { |
43 | - $name = CLI::prompt( 'View name' ); |
|
43 | + $name = CLI::prompt('View name'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | // Format to CI Standards |
47 | - $name = str_replace('.php', '', strtolower( $name ) ); |
|
47 | + $name = str_replace('.php', '', strtolower($name)); |
|
48 | 48 | |
49 | - $destination = $this->determineOutputPath( 'views' ) . $name . '.php'; |
|
49 | + $destination = $this->determineOutputPath('views').$name.'.php'; |
|
50 | 50 | |
51 | - if (! $this->createFile($destination, "The {$name}.php view file.", $this->overwrite) ) |
|
51 | + if ( ! $this->createFile($destination, "The {$name}.php view file.", $this->overwrite)) |
|
52 | 52 | { |
53 | 53 | CLI::error('Error creating view file.'); |
54 | 54 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * Start the timer... tick tock tick tock... |
186 | 186 | * ------------------------------------------------------ |
187 | 187 | */ |
188 | - $BM =& load_class('Benchmark', 'core'); |
|
188 | + $BM = & load_class('Benchmark', 'core'); |
|
189 | 189 | $BM->mark('total_execution_time_start'); |
190 | 190 | $BM->mark('loading_time:_base_classes_start'); |
191 | 191 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * Instantiate the hooks class |
195 | 195 | * ------------------------------------------------------ |
196 | 196 | */ |
197 | - $EXT =& load_class('Hooks', 'core'); |
|
197 | + $EXT = & load_class('Hooks', 'core'); |
|
198 | 198 | |
199 | 199 | /* |
200 | 200 | * ------------------------------------------------------ |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * depending on another class that uses it. |
214 | 214 | * |
215 | 215 | */ |
216 | - $CFG =& load_class('Config', 'core'); |
|
216 | + $CFG = & load_class('Config', 'core'); |
|
217 | 217 | |
218 | 218 | // Do we have any manually set config items in the index.php file? |
219 | 219 | if (isset($assign_to_config) && is_array($assign_to_config)) |
@@ -291,28 +291,28 @@ discard block |
||
291 | 291 | * Instantiate the UTF-8 class |
292 | 292 | * ------------------------------------------------------ |
293 | 293 | */ |
294 | - $UNI =& load_class('Utf8', 'core'); |
|
294 | + $UNI = & load_class('Utf8', 'core'); |
|
295 | 295 | |
296 | 296 | /* |
297 | 297 | * ------------------------------------------------------ |
298 | 298 | * Instantiate the URI class |
299 | 299 | * ------------------------------------------------------ |
300 | 300 | */ |
301 | - $URI =& load_class('URI', 'core'); |
|
301 | + $URI = & load_class('URI', 'core'); |
|
302 | 302 | |
303 | 303 | /* |
304 | 304 | * ------------------------------------------------------ |
305 | 305 | * Instantiate the routing class and set the routing |
306 | 306 | * ------------------------------------------------------ |
307 | 307 | */ |
308 | - $RTR =& load_class('Router', 'core', isset($routing) ? $routing : NULL); |
|
308 | + $RTR = & load_class('Router', 'core', isset($routing) ? $routing : NULL); |
|
309 | 309 | |
310 | 310 | /* |
311 | 311 | * ------------------------------------------------------ |
312 | 312 | * Instantiate the output class |
313 | 313 | * ------------------------------------------------------ |
314 | 314 | */ |
315 | - $OUT =& load_class('Output', 'core'); |
|
315 | + $OUT = & load_class('Output', 'core'); |
|
316 | 316 | |
317 | 317 | /* |
318 | 318 | * ------------------------------------------------------ |
@@ -329,21 +329,21 @@ discard block |
||
329 | 329 | * Load the security class for xss and csrf support |
330 | 330 | * ----------------------------------------------------- |
331 | 331 | */ |
332 | - $SEC =& load_class('Security', 'core'); |
|
332 | + $SEC = & load_class('Security', 'core'); |
|
333 | 333 | |
334 | 334 | /* |
335 | 335 | * ------------------------------------------------------ |
336 | 336 | * Load the Input class and sanitize globals |
337 | 337 | * ------------------------------------------------------ |
338 | 338 | */ |
339 | - $IN =& load_class('Input', 'core'); |
|
339 | + $IN = & load_class('Input', 'core'); |
|
340 | 340 | |
341 | 341 | /* |
342 | 342 | * ------------------------------------------------------ |
343 | 343 | * Load the Language class |
344 | 344 | * ------------------------------------------------------ |
345 | 345 | */ |
346 | - $LANG =& load_class('Lang', 'core'); |
|
346 | + $LANG = & load_class('Lang', 'core'); |
|
347 | 347 | |
348 | 348 | /* |
349 | 349 | * ------------------------------------------------------ |
@@ -169,12 +169,10 @@ discard block |
||
169 | 169 | file_exists(APPPATH.'vendor/autoload.php') |
170 | 170 | ? require_once(APPPATH.'vendor/autoload.php') |
171 | 171 | : log_message('error', '$config[\'composer_autoload\'] is set to TRUE but '.APPPATH.'vendor/autoload.php was not found.'); |
172 | - } |
|
173 | - elseif (file_exists($composer_autoload)) |
|
172 | + } elseif (file_exists($composer_autoload)) |
|
174 | 173 | { |
175 | 174 | require_once($composer_autoload); |
176 | - } |
|
177 | - else |
|
175 | + } else |
|
178 | 176 | { |
179 | 177 | log_message('error', 'Could not find the specified $config[\'composer_autoload\'] path: '.$composer_autoload); |
180 | 178 | } |
@@ -250,8 +248,7 @@ discard block |
||
250 | 248 | // This is required for mb_convert_encoding() to strip invalid characters. |
251 | 249 | // That's utilized by CI_Utf8, but it's also done for consistency with iconv. |
252 | 250 | mb_substitute_character('none'); |
253 | - } |
|
254 | - else |
|
251 | + } else |
|
255 | 252 | { |
256 | 253 | define('MB_ENABLED', FALSE); |
257 | 254 | } |
@@ -264,8 +261,7 @@ discard block |
||
264 | 261 | // iconv.internal_encoding is deprecated starting with PHP 5.6 |
265 | 262 | // and it's usage triggers E_DEPRECATED messages. |
266 | 263 | @ini_set('iconv.internal_encoding', $charset); |
267 | - } |
|
268 | - else |
|
264 | + } else |
|
269 | 265 | { |
270 | 266 | define('ICONV_ENABLED', FALSE); |
271 | 267 | } |
@@ -402,16 +398,14 @@ discard block |
||
402 | 398 | if (empty($class) OR ! file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php')) |
403 | 399 | { |
404 | 400 | $e404 = TRUE; |
405 | - } |
|
406 | - else |
|
401 | + } else |
|
407 | 402 | { |
408 | 403 | require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php'); |
409 | 404 | |
410 | 405 | if ( ! class_exists($class, FALSE) OR $method[0] === '_' OR method_exists('CI_Controller', $method)) |
411 | 406 | { |
412 | 407 | $e404 = TRUE; |
413 | - } |
|
414 | - elseif (method_exists($class, '_remap')) |
|
408 | + } elseif (method_exists($class, '_remap')) |
|
415 | 409 | { |
416 | 410 | $params = array($method, array_slice($URI->rsegments, 2)); |
417 | 411 | $method = '_remap'; |
@@ -453,8 +447,7 @@ discard block |
||
453 | 447 | $RTR->directory = ''; |
454 | 448 | } |
455 | 449 | } |
456 | - } |
|
457 | - else |
|
450 | + } else |
|
458 | 451 | { |
459 | 452 | $e404 = FALSE; |
460 | 453 | } |
@@ -470,8 +463,7 @@ discard block |
||
470 | 463 | 1 => $class, |
471 | 464 | 2 => $method |
472 | 465 | ); |
473 | - } |
|
474 | - else |
|
466 | + } else |
|
475 | 467 | { |
476 | 468 | show_404($RTR->directory.$class.'/'.$method); |
477 | 469 | } |
@@ -65,17 +65,17 @@ |
||
65 | 65 | */ |
66 | 66 | public function __construct() |
67 | 67 | { |
68 | - self::$instance =& $this; |
|
68 | + self::$instance = & $this; |
|
69 | 69 | |
70 | 70 | // Assign all the class objects that were instantiated by the |
71 | 71 | // bootstrap file (CodeIgniter.php) to local class variables |
72 | 72 | // so that CI can run as one big super object. |
73 | 73 | foreach (is_loaded() as $var => $class) |
74 | 74 | { |
75 | - $this->$var =& load_class($class); |
|
75 | + $this->$var = & load_class($class); |
|
76 | 76 | } |
77 | 77 | |
78 | - $this->load =& load_class('Loader', 'core'); |
|
78 | + $this->load = & load_class('Loader', 'core'); |
|
79 | 79 | $this->load->initialize(); |
80 | 80 | log_message('info', 'Controller Class Initialized'); |
81 | 81 | } |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @var array |
55 | 55 | */ |
56 | - public $language = array(); |
|
56 | + public $language = array(); |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * List of loaded language files |
60 | 60 | * |
61 | 61 | * @var array |
62 | 62 | */ |
63 | - public $is_loaded = array(); |
|
63 | + public $is_loaded = array(); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Class constructor |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | if (empty($idiom) OR ! preg_match('/^[a-z_-]+$/i', $idiom)) |
110 | 110 | { |
111 | - $config =& get_config(); |
|
111 | + $config = & get_config(); |
|
112 | 112 | $idiom = empty($config['language']) ? 'english' : $config['language']; |
113 | 113 | } |
114 | 114 |
@@ -266,8 +266,7 @@ |
||
266 | 266 | if ($reduce_linebreaks === TRUE) |
267 | 267 | { |
268 | 268 | $table['#<p>\n*</p>#'] = ''; |
269 | - } |
|
270 | - else |
|
269 | + } else |
|
271 | 270 | { |
272 | 271 | // If we have empty paragraph tags we add a non-breaking space |
273 | 272 | // otherwise most browsers won't treat them as true paragraphs |
@@ -113,7 +113,7 @@ |
||
113 | 113 | */ |
114 | 114 | public function __construct() |
115 | 115 | { |
116 | - $config =& get_config(); |
|
116 | + $config = & get_config(); |
|
117 | 117 | |
118 | 118 | $this->_log_path = ($config['log_path'] !== '') ? $config['log_path'] : APPPATH.'logs/'; |
119 | 119 | $this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '') |
@@ -129,8 +129,7 @@ discard block |
||
129 | 129 | if (is_numeric($config['log_threshold'])) |
130 | 130 | { |
131 | 131 | $this->_threshold = (int) $config['log_threshold']; |
132 | - } |
|
133 | - elseif (is_array($config['log_threshold'])) |
|
132 | + } elseif (is_array($config['log_threshold'])) |
|
134 | 133 | { |
135 | 134 | $this->_threshold = 0; |
136 | 135 | $this->_threshold_array = array_flip($config['log_threshold']); |
@@ -198,8 +197,7 @@ discard block |
||
198 | 197 | $microtime_short = sprintf("%06d", ($microtime_full - floor($microtime_full)) * 1000000); |
199 | 198 | $date = new DateTime(date('Y-m-d H:i:s.'.$microtime_short, $microtime_full)); |
200 | 199 | $date = $date->format($this->_date_fmt); |
201 | - } |
|
202 | - else |
|
200 | + } else |
|
203 | 201 | { |
204 | 202 | $date = date($this->_date_fmt); |
205 | 203 | } |
@@ -62,21 +62,21 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @var array |
64 | 64 | */ |
65 | - public $routes = array(); |
|
65 | + public $routes = array(); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Current class name |
69 | 69 | * |
70 | 70 | * @var string |
71 | 71 | */ |
72 | - public $class = ''; |
|
72 | + public $class = ''; |
|
73 | 73 | |
74 | 74 | /** |
75 | 75 | * Current method name |
76 | 76 | * |
77 | 77 | * @var string |
78 | 78 | */ |
79 | - public $method = 'index'; |
|
79 | + public $method = 'index'; |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Sub-directory that contains the requested controller class |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function __construct($routing = NULL) |
125 | 125 | { |
126 | - $this->config =& load_class('Config', 'core'); |
|
127 | - $this->uri =& load_class('URI', 'core'); |
|
126 | + $this->config = & load_class('Config', 'core'); |
|
127 | + $this->uri = & load_class('URI', 'core'); |
|
128 | 128 | |
129 | 129 | $this->enable_query_strings = ( ! is_cli() && $this->config->item('enable_query_strings') === TRUE); |
130 | 130 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | if (is_array($routing)) |
137 | 137 | { |
138 | 138 | empty($routing['controller']) OR $this->set_class($routing['controller']); |
139 | - empty($routing['function']) OR $this->set_method($routing['function']); |
|
139 | + empty($routing['function']) OR $this->set_method($routing['function']); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | log_message('info', 'Router Class Initialized'); |
@@ -211,8 +211,7 @@ discard block |
||
211 | 211 | 1 => $this->class, |
212 | 212 | 2 => $this->method |
213 | 213 | ); |
214 | - } |
|
215 | - else |
|
214 | + } else |
|
216 | 215 | { |
217 | 216 | $this->_set_default_controller(); |
218 | 217 | } |
@@ -226,8 +225,7 @@ discard block |
||
226 | 225 | if ($this->uri->uri_string !== '') |
227 | 226 | { |
228 | 227 | $this->_parse_routes(); |
229 | - } |
|
230 | - else |
|
228 | + } else |
|
231 | 229 | { |
232 | 230 | $this->_set_default_controller(); |
233 | 231 | } |
@@ -269,8 +267,7 @@ discard block |
||
269 | 267 | if (isset($segments[1])) |
270 | 268 | { |
271 | 269 | $this->set_method($segments[1]); |
272 | - } |
|
273 | - else |
|
270 | + } else |
|
274 | 271 | { |
275 | 272 | $segments[1] = 'index'; |
276 | 273 | } |
@@ -385,8 +382,7 @@ discard block |
||
385 | 382 | if (isset($val[$http_verb])) |
386 | 383 | { |
387 | 384 | $val = $val[$http_verb]; |
388 | - } |
|
389 | - else |
|
385 | + } else |
|
390 | 386 | { |
391 | 387 | continue; |
392 | 388 | } |
@@ -489,8 +485,7 @@ discard block |
||
489 | 485 | if ($append !== TRUE OR empty($this->directory)) |
490 | 486 | { |
491 | 487 | $this->directory = str_replace('.', '', trim($dir, '/')).'/'; |
492 | - } |
|
493 | - else |
|
488 | + } else |
|
494 | 489 | { |
495 | 490 | $this->directory .= str_replace('.', '', trim($dir, '/')).'/'; |
496 | 491 | } |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @var array |
55 | 55 | */ |
56 | - public $filename_bad_chars = array( |
|
56 | + public $filename_bad_chars = array( |
|
57 | 57 | '../', '<!--', '-->', '<', '>', |
58 | 58 | "'", '"', '&', '$', '#', |
59 | 59 | '{', '}', '[', ']', '=', |
60 | 60 | ';', '?', '%20', '%22', |
61 | - '%3c', // < |
|
62 | - '%253c', // < |
|
63 | - '%3e', // > |
|
64 | - '%0e', // > |
|
65 | - '%28', // ( |
|
66 | - '%29', // ) |
|
67 | - '%2528', // ( |
|
68 | - '%26', // & |
|
69 | - '%24', // $ |
|
70 | - '%3f', // ? |
|
71 | - '%3b', // ; |
|
61 | + '%3c', // < |
|
62 | + '%253c', // < |
|
63 | + '%3e', // > |
|
64 | + '%0e', // > |
|
65 | + '%28', // ( |
|
66 | + '%29', // ) |
|
67 | + '%2528', // ( |
|
68 | + '%26', // & |
|
69 | + '%24', // $ |
|
70 | + '%3f', // ? |
|
71 | + '%3b', // ; |
|
72 | 72 | '%3d' // = |
73 | 73 | ); |
74 | 74 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @var int |
109 | 109 | */ |
110 | - protected $_csrf_expire = 7200; |
|
110 | + protected $_csrf_expire = 7200; |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * CSRF Token name |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @var string |
118 | 118 | */ |
119 | - protected $_csrf_token_name = 'ci_csrf_token'; |
|
119 | + protected $_csrf_token_name = 'ci_csrf_token'; |
|
120 | 120 | |
121 | 121 | /** |
122 | 122 | * CSRF Cookie name |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @var string |
127 | 127 | */ |
128 | - protected $_csrf_cookie_name = 'ci_csrf_token'; |
|
128 | + protected $_csrf_cookie_name = 'ci_csrf_token'; |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * List of never allowed strings |
132 | 132 | * |
133 | 133 | * @var array |
134 | 134 | */ |
135 | - protected $_never_allowed_str = array( |
|
135 | + protected $_never_allowed_str = array( |
|
136 | 136 | 'document.cookie' => '[removed]', |
137 | 137 | 'document.write' => '[removed]', |
138 | 138 | '.parentNode' => '[removed]', |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | */ |
796 | 796 | protected function _sanitize_naughty_html($matches) |
797 | 797 | { |
798 | - static $naughty_tags = array( |
|
798 | + static $naughty_tags = array( |
|
799 | 799 | 'alert', 'prompt', 'confirm', 'applet', 'audio', 'basefont', 'base', 'behavior', 'bgsound', |
800 | 800 | 'blink', 'body', 'embed', 'expression', 'form', 'frameset', 'frame', 'head', 'html', 'ilayer', |
801 | 801 | 'iframe', 'input', 'button', 'select', 'isindex', 'layer', 'link', 'meta', 'keygen', 'object', |
@@ -225,10 +225,12 @@ discard block |
||
225 | 225 | |
226 | 226 | // Do the tokens exist in both the _POST and _COOKIE arrays? |
227 | 227 | if ( ! isset($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name]) |
228 | - OR $_POST[$this->_csrf_token_name] !== $_COOKIE[$this->_csrf_cookie_name]) // Do the tokens match? |
|
228 | + OR $_POST[$this->_csrf_token_name] !== $_COOKIE[$this->_csrf_cookie_name]) { |
|
229 | + // Do the tokens match? |
|
229 | 230 | { |
230 | 231 | $this->csrf_show_error(); |
231 | 232 | } |
233 | + } |
|
232 | 234 | |
233 | 235 | // We kill this since we're done and we don't want to polute the _POST array |
234 | 236 | unset($_POST[$this->_csrf_token_name]); |
@@ -421,8 +423,7 @@ discard block |
||
421 | 423 | // closing tags every so often so we skip those and only |
422 | 424 | // do the long opening tags. |
423 | 425 | $str = preg_replace('/<\?(php)/i', '<?\\1', $str); |
424 | - } |
|
425 | - else |
|
426 | + } else |
|
426 | 427 | { |
427 | 428 | $str = str_replace(array('<?', '?'.'>'), array('<?', '?>'), $str); |
428 | 429 | } |
@@ -599,8 +600,7 @@ discard block |
||
599 | 600 | { |
600 | 601 | // The cast is required to avoid TypeError |
601 | 602 | return random_bytes((int) $length); |
602 | - } |
|
603 | - catch (Exception $e) |
|
603 | + } catch (Exception $e) |
|
604 | 604 | { |
605 | 605 | // If random_bytes() can't do the job, we can't either ... |
606 | 606 | // There's no point in using fallbacks. |
@@ -854,8 +854,7 @@ discard block |
||
854 | 854 | ) |
855 | 855 | { |
856 | 856 | $attributes[] = 'xss=removed'; |
857 | - } |
|
858 | - else |
|
857 | + } else |
|
859 | 858 | { |
860 | 859 | $attributes[] = $attribute[0][0]; |
861 | 860 | } |
@@ -1237,6 +1237,7 @@ |
||
1237 | 1237 | * Valid Email |
1238 | 1238 | * |
1239 | 1239 | * @param string |
1240 | + * @param string $str |
|
1240 | 1241 | * @return bool |
1241 | 1242 | */ |
1242 | 1243 | public function valid_email($str) |