@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param mixed $library Library name |
| 192 | 192 | * @param array $params Optional parameters to pass to the library class constructor |
| 193 | 193 | * @param string $object_name An optional object name to assign to |
| 194 | - * @return object |
|
| 194 | + * @return CI_Loader |
|
| 195 | 195 | * |
| 196 | 196 | * @codeCoverageIgnore |
| 197 | 197 | */ |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | * @param mixed $model Model name |
| 238 | 238 | * @param string $name An optional object name to assign to |
| 239 | 239 | * @param bool $db_conn An optional database connection configuration to initialize |
| 240 | - * @return object |
|
| 240 | + * @return CI_Loader |
|
| 241 | 241 | * |
| 242 | 242 | * modified by ci-phpunit-test |
| 243 | 243 | */ |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | /** |
| 376 | 376 | * Database Loader |
| 377 | 377 | * |
| 378 | - * @param mixed $params Database configuration options |
|
| 378 | + * @param string|boolean $params Database configuration options |
|
| 379 | 379 | * @param bool $return Whether to return the database object |
| 380 | 380 | * @param bool $query_builder Whether to enable Query Builder |
| 381 | 381 | * (overrides the configuration setting) |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | * An associative array or object containing values |
| 540 | 540 | * to be set, or a value's name if string |
| 541 | 541 | * @param string $val Value to set, only used if $vars is a string |
| 542 | - * @return object |
|
| 542 | + * @return CI_Loader |
|
| 543 | 543 | * |
| 544 | 544 | * @codeCoverageIgnore |
| 545 | 545 | */ |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | * Helper Loader |
| 614 | 614 | * |
| 615 | 615 | * @param string|string[] $helpers Helper name(s) |
| 616 | - * @return object |
|
| 616 | + * @return CI_Loader |
|
| 617 | 617 | * |
| 618 | 618 | * @codeCoverageIgnore |
| 619 | 619 | */ |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | * |
| 693 | 693 | * @uses CI_Loader::helper() |
| 694 | 694 | * @param string|string[] $helpers Helper name(s) |
| 695 | - * @return object |
|
| 695 | + * @return CI_Loader |
|
| 696 | 696 | * |
| 697 | 697 | * @codeCoverageIgnore |
| 698 | 698 | */ |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | * |
| 711 | 711 | * @param string|string[] $files List of language file names to load |
| 712 | 712 | * @param string Language name |
| 713 | - * @return object |
|
| 713 | + * @return CI_Loader |
|
| 714 | 714 | * |
| 715 | 715 | * @codeCoverageIgnore |
| 716 | 716 | */ |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | * |
| 811 | 811 | * @param string $path Path to add |
| 812 | 812 | * @param bool $view_cascade (default: TRUE) |
| 813 | - * @return object |
|
| 813 | + * @return CI_Loader |
|
| 814 | 814 | * |
| 815 | 815 | * @codeCoverageIgnore |
| 816 | 816 | */ |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | * added path will be removed removed. |
| 859 | 859 | * |
| 860 | 860 | * @param string $path Path to remove |
| 861 | - * @return object |
|
| 861 | + * @return CI_Loader |
|
| 862 | 862 | * |
| 863 | 863 | * @codeCoverageIgnore |
| 864 | 864 | */ |
@@ -200,16 +200,14 @@ discard block |
||
| 200 | 200 | if (empty($library)) |
| 201 | 201 | { |
| 202 | 202 | return $this; |
| 203 | - } |
|
| 204 | - elseif (is_array($library)) |
|
| 203 | + } elseif (is_array($library)) |
|
| 205 | 204 | { |
| 206 | 205 | foreach ($library as $key => $value) |
| 207 | 206 | { |
| 208 | 207 | if (is_int($key)) |
| 209 | 208 | { |
| 210 | 209 | $this->library($value, $params); |
| 211 | - } |
|
| 212 | - else |
|
| 210 | + } else |
|
| 213 | 211 | { |
| 214 | 212 | $this->library($key, $params, $value); |
| 215 | 213 | } |
@@ -246,8 +244,7 @@ discard block |
||
| 246 | 244 | if (empty($model)) |
| 247 | 245 | { |
| 248 | 246 | return $this; |
| 249 | - } |
|
| 250 | - elseif (is_array($model)) |
|
| 247 | + } elseif (is_array($model)) |
|
| 251 | 248 | { |
| 252 | 249 | foreach ($model as $key => $value) |
| 253 | 250 | { |
@@ -315,8 +312,7 @@ discard block |
||
| 315 | 312 | } |
| 316 | 313 | |
| 317 | 314 | log_message('info', 'CI_Model class loaded'); |
| 318 | - } |
|
| 319 | - elseif ( ! class_exists('CI_Model', FALSE)) |
|
| 315 | + } elseif ( ! class_exists('CI_Model', FALSE)) |
|
| 320 | 316 | { |
| 321 | 317 | require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php'); |
| 322 | 318 | } |
@@ -477,8 +473,7 @@ discard block |
||
| 477 | 473 | require_once($driver_path); |
| 478 | 474 | $class = 'CI_DB_'.$db->dbdriver.'_'.$db->subdriver.'_forge'; |
| 479 | 475 | } |
| 480 | - } |
|
| 481 | - else |
|
| 476 | + } else |
|
| 482 | 477 | { |
| 483 | 478 | $class = 'CI_DB_'.$db->dbdriver.'_forge'; |
| 484 | 479 | } |
@@ -765,16 +760,14 @@ discard block |
||
| 765 | 760 | if (is_int($key)) |
| 766 | 761 | { |
| 767 | 762 | $this->driver($value, $params); |
| 768 | - } |
|
| 769 | - else |
|
| 763 | + } else |
|
| 770 | 764 | { |
| 771 | 765 | $this->driver($key, $params, $value); |
| 772 | 766 | } |
| 773 | 767 | } |
| 774 | 768 | |
| 775 | 769 | return $this; |
| 776 | - } |
|
| 777 | - elseif (empty($library)) |
|
| 770 | + } elseif (empty($library)) |
|
| 778 | 771 | { |
| 779 | 772 | return FALSE; |
| 780 | 773 | } |
@@ -873,8 +866,7 @@ discard block |
||
| 873 | 866 | array_shift($this->_ci_helper_paths); |
| 874 | 867 | array_shift($this->_ci_view_paths); |
| 875 | 868 | array_pop($config->_config_paths); |
| 876 | - } |
|
| 877 | - else |
|
| 869 | + } else |
|
| 878 | 870 | { |
| 879 | 871 | $path = rtrim($path, '/').'/'; |
| 880 | 872 | foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) |
@@ -938,8 +930,7 @@ discard block |
||
| 938 | 930 | { |
| 939 | 931 | $_ci_x = explode('/', $_ci_path); |
| 940 | 932 | $_ci_file = end($_ci_x); |
| 941 | - } |
|
| 942 | - else |
|
| 933 | + } else |
|
| 943 | 934 | { |
| 944 | 935 | $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); |
| 945 | 936 | $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view; |
@@ -1006,8 +997,7 @@ discard block |
||
| 1006 | 997 | if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE) |
| 1007 | 998 | { |
| 1008 | 999 | echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); |
| 1009 | - } |
|
| 1010 | - else |
|
| 1000 | + } else |
|
| 1011 | 1001 | { |
| 1012 | 1002 | include($_ci_path); // include() vs include_once() allows for multiple views with the same name |
| 1013 | 1003 | } |
@@ -1034,8 +1024,7 @@ discard block |
||
| 1034 | 1024 | if (ob_get_level() > $this->_ci_ob_level + 1) |
| 1035 | 1025 | { |
| 1036 | 1026 | ob_end_flush(); |
| 1037 | - } |
|
| 1038 | - else |
|
| 1027 | + } else |
|
| 1039 | 1028 | { |
| 1040 | 1029 | $_ci_CI->output->append_output(ob_get_contents()); |
| 1041 | 1030 | @ob_end_clean(); |
@@ -1075,8 +1064,7 @@ discard block |
||
| 1075 | 1064 | |
| 1076 | 1065 | // Get the filename from the path |
| 1077 | 1066 | $class = substr($class, $last_slash); |
| 1078 | - } |
|
| 1079 | - else |
|
| 1067 | + } else |
|
| 1080 | 1068 | { |
| 1081 | 1069 | $subdir = ''; |
| 1082 | 1070 | } |
@@ -1214,8 +1202,7 @@ discard block |
||
| 1214 | 1202 | if (file_exists(TESTPATH.'_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php')) |
| 1215 | 1203 | { |
| 1216 | 1204 | include_once(TESTPATH.'_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php'); |
| 1217 | - } |
|
| 1218 | - else |
|
| 1205 | + } else |
|
| 1219 | 1206 | { |
| 1220 | 1207 | include_once(BASEPATH.'libraries/'.$file_path.$library_name.'.php'); |
| 1221 | 1208 | } |
@@ -1279,8 +1266,7 @@ discard block |
||
| 1279 | 1266 | { |
| 1280 | 1267 | include($path.'config/'.strtolower($class).'.php'); |
| 1281 | 1268 | $found = TRUE; |
| 1282 | - } |
|
| 1283 | - elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1269 | + } elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1284 | 1270 | { |
| 1285 | 1271 | include($path.'config/'.ucfirst(strtolower($class)).'.php'); |
| 1286 | 1272 | $found = TRUE; |
@@ -1290,8 +1276,7 @@ discard block |
||
| 1290 | 1276 | { |
| 1291 | 1277 | include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
| 1292 | 1278 | $found = TRUE; |
| 1293 | - } |
|
| 1294 | - elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1279 | + } elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1295 | 1280 | { |
| 1296 | 1281 | include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
| 1297 | 1282 | $found = TRUE; |
@@ -331,19 +331,16 @@ discard block |
||
| 331 | 331 | if ($reflection->hasMethod('set_'.$key)) |
| 332 | 332 | { |
| 333 | 333 | $this->{'set_'.$key}($config[$key]); |
| 334 | - } |
|
| 335 | - else |
|
| 334 | + } else |
|
| 336 | 335 | { |
| 337 | 336 | $this->$key = $config[$key]; |
| 338 | 337 | } |
| 339 | - } |
|
| 340 | - else |
|
| 338 | + } else |
|
| 341 | 339 | { |
| 342 | 340 | $this->$key = $defaults[$key]; |
| 343 | 341 | } |
| 344 | 342 | } |
| 345 | - } |
|
| 346 | - else |
|
| 343 | + } else |
|
| 347 | 344 | { |
| 348 | 345 | foreach ($config as $key => &$value) |
| 349 | 346 | { |
@@ -352,8 +349,7 @@ discard block |
||
| 352 | 349 | if ($reflection->hasMethod('set_'.$key)) |
| 353 | 350 | { |
| 354 | 351 | $this->{'set_'.$key}($value); |
| 355 | - } |
|
| 356 | - else |
|
| 352 | + } else |
|
| 357 | 353 | { |
| 358 | 354 | $this->$key = $value; |
| 359 | 355 | } |
@@ -415,9 +411,11 @@ discard block |
||
| 415 | 411 | } |
| 416 | 412 | |
| 417 | 413 | // Was the file able to be uploaded? If not, determine the reason why. |
| 418 | - if ( ! file_exists($_file['tmp_name'])) // modified by ci-phpunit-test |
|
| 414 | + if ( ! file_exists($_file['tmp_name'])) { |
|
| 415 | + // modified by ci-phpunit-test |
|
| 419 | 416 | { |
| 420 | 417 | $error = isset($_file['error']) ? $_file['error'] : 4; |
| 418 | + } |
|
| 421 | 419 | |
| 422 | 420 | switch ($error) |
| 423 | 421 | { |
@@ -482,8 +480,7 @@ discard block |
||
| 482 | 480 | if (strpos($this->_file_name_override, '.') === FALSE) |
| 483 | 481 | { |
| 484 | 482 | $this->file_name .= $this->file_ext; |
| 485 | - } |
|
| 486 | - else |
|
| 483 | + } else |
|
| 487 | 484 | { |
| 488 | 485 | // An extension was provided, let's have it! |
| 489 | 486 | $this->file_ext = $this->get_extension($this->_file_name_override); |
@@ -881,8 +878,7 @@ discard block |
||
| 881 | 878 | if (in_array($this->file_type, $png_mimes)) |
| 882 | 879 | { |
| 883 | 880 | $this->file_type = 'image/png'; |
| 884 | - } |
|
| 885 | - elseif (in_array($this->file_type, $jpeg_mimes)) |
|
| 881 | + } elseif (in_array($this->file_type, $jpeg_mimes)) |
|
| 886 | 882 | { |
| 887 | 883 | $this->file_type = 'image/jpeg'; |
| 888 | 884 | } |
@@ -1148,9 +1144,12 @@ discard block |
||
| 1148 | 1144 | |
| 1149 | 1145 | if (function_exists('getimagesize') && @getimagesize($file) !== FALSE) |
| 1150 | 1146 | { |
| 1151 | - if (($file = @fopen($file, 'rb')) === FALSE) // "b" to force binary |
|
| 1147 | + if (($file = @fopen($file, 'rb')) === FALSE) { |
|
| 1148 | + // "b" to force binary |
|
| 1152 | 1149 | { |
| 1153 | - return FALSE; // Couldn't open the file, return FALSE |
|
| 1150 | + return FALSE; |
|
| 1151 | + } |
|
| 1152 | + // Couldn't open the file, return FALSE |
|
| 1154 | 1153 | } |
| 1155 | 1154 | |
| 1156 | 1155 | $opening_bytes = fread($file, 256); |
@@ -1269,9 +1268,11 @@ discard block |
||
| 1269 | 1268 | if (function_exists('finfo_file')) |
| 1270 | 1269 | { |
| 1271 | 1270 | $finfo = @finfo_open(FILEINFO_MIME); |
| 1272 | - if (is_resource($finfo)) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system |
|
| 1271 | + if (is_resource($finfo)) { |
|
| 1272 | + // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system |
|
| 1273 | 1273 | { |
| 1274 | 1274 | $mime = @finfo_file($finfo, $file['tmp_name']); |
| 1275 | + } |
|
| 1275 | 1276 | finfo_close($finfo); |
| 1276 | 1277 | |
| 1277 | 1278 | /* According to the comments section of the PHP manual page, |
@@ -1356,10 +1357,12 @@ discard block |
||
| 1356 | 1357 | if (function_exists('mime_content_type')) |
| 1357 | 1358 | { |
| 1358 | 1359 | $this->file_type = @mime_content_type($file['tmp_name']); |
| 1359 | - if (strlen($this->file_type) > 0) // It's possible that mime_content_type() returns FALSE or an empty string |
|
| 1360 | + if (strlen($this->file_type) > 0) { |
|
| 1361 | + // It's possible that mime_content_type() returns FALSE or an empty string |
|
| 1360 | 1362 | { |
| 1361 | 1363 | return; |
| 1362 | 1364 | } |
| 1365 | + } |
|
| 1363 | 1366 | } |
| 1364 | 1367 | |
| 1365 | 1368 | $this->file_type = $file['type']; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // Load the mime types |
| 104 | - $mimes =& get_mimes(); |
|
| 104 | + $mimes = & get_mimes(); |
|
| 105 | 105 | |
| 106 | 106 | // Only change the default MIME if we can find one |
| 107 | 107 | if (isset($mimes[$extension])) |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | if (ENVIRONMENT === 'testing') |
| 148 | 148 | { |
| 149 | - $CI =& get_instance(); |
|
| 149 | + $CI = & get_instance(); |
|
| 150 | 150 | $CI->output->set_header('Content-Type: '.$mime); |
| 151 | 151 | $CI->output->set_header('Content-Disposition: attachment; filename="'.$filename.'"'); |
| 152 | 152 | $CI->output->set_header('Expires: 0'); |
@@ -67,8 +67,7 @@ discard block |
||
| 67 | 67 | if ($filename === '' OR $data === '') |
| 68 | 68 | { |
| 69 | 69 | return; |
| 70 | - } |
|
| 71 | - elseif ($data === NULL) |
|
| 70 | + } elseif ($data === NULL) |
|
| 72 | 71 | { |
| 73 | 72 | if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) |
| 74 | 73 | { |
@@ -78,8 +77,7 @@ discard block |
||
| 78 | 77 | $filepath = $filename; |
| 79 | 78 | $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); |
| 80 | 79 | $filename = end($filename); |
| 81 | - } |
|
| 82 | - else |
|
| 80 | + } else |
|
| 83 | 81 | { |
| 84 | 82 | $filesize = strlen($data); |
| 85 | 83 | } |
@@ -158,8 +156,7 @@ discard block |
||
| 158 | 156 | if (ENVIRONMENT !== 'testing') |
| 159 | 157 | { |
| 160 | 158 | exit($data); |
| 161 | - } |
|
| 162 | - else |
|
| 159 | + } else |
|
| 163 | 160 | { |
| 164 | 161 | echo($data); |
| 165 | 162 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
@@ -176,8 +173,7 @@ discard block |
||
| 176 | 173 | if (ENVIRONMENT !== 'testing') |
| 177 | 174 | { |
| 178 | 175 | exit; |
| 179 | - } |
|
| 180 | - else |
|
| 176 | + } else |
|
| 181 | 177 | { |
| 182 | 178 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
| 183 | 179 | } |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | ob_end_clean(); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - throw new CIPHPUnitTestRedirectException('Redirect to ' . $uri, $code); |
|
| 108 | + throw new CIPHPUnitTestRedirectException('Redirect to '.$uri, $code); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -63,16 +63,14 @@ discard block |
||
| 63 | 63 | if ($method === 'auto' && isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== FALSE) |
| 64 | 64 | { |
| 65 | 65 | $method = 'refresh'; |
| 66 | - } |
|
| 67 | - elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) |
|
| 66 | + } elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) |
|
| 68 | 67 | { |
| 69 | 68 | if (isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') |
| 70 | 69 | { |
| 71 | 70 | $code = ($_SERVER['REQUEST_METHOD'] !== 'GET') |
| 72 | 71 | ? 303 // reference: http://en.wikipedia.org/wiki/Post/Redirect/Get |
| 73 | 72 | : 307; |
| 74 | - } |
|
| 75 | - else |
|
| 73 | + } else |
|
| 76 | 74 | { |
| 77 | 75 | $code = 302; |
| 78 | 76 | } |
@@ -97,8 +95,7 @@ discard block |
||
| 97 | 95 | if (ENVIRONMENT !== 'testing') |
| 98 | 96 | { |
| 99 | 97 | exit; |
| 100 | - } |
|
| 101 | - else |
|
| 98 | + } else |
|
| 102 | 99 | { |
| 103 | 100 | while (ob_get_level() > 1) |
| 104 | 101 | { |
@@ -139,17 +139,17 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function __construct() |
| 141 | 141 | { |
| 142 | - $this->_allow_get_array = (config_item('allow_get_array') !== FALSE); |
|
| 143 | - $this->_enable_xss = (config_item('global_xss_filtering') === TRUE); |
|
| 144 | - $this->_enable_csrf = (config_item('csrf_protection') === TRUE); |
|
| 145 | - $this->_standardize_newlines = (bool) config_item('standardize_newlines'); |
|
| 142 | + $this->_allow_get_array = (config_item('allow_get_array') !== FALSE); |
|
| 143 | + $this->_enable_xss = (config_item('global_xss_filtering') === TRUE); |
|
| 144 | + $this->_enable_csrf = (config_item('csrf_protection') === TRUE); |
|
| 145 | + $this->_standardize_newlines = (bool) config_item('standardize_newlines'); |
|
| 146 | 146 | |
| 147 | - $this->security =& load_class('Security', 'core'); |
|
| 147 | + $this->security = & load_class('Security', 'core'); |
|
| 148 | 148 | |
| 149 | 149 | // Do we need the UTF-8 class? |
| 150 | 150 | if (UTF8_ENABLED === TRUE) |
| 151 | 151 | { |
| 152 | - $this->uni =& load_class('Utf8', 'core'); |
|
| 152 | + $this->uni = & load_class('Utf8', 'core'); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | // Sanitize global arrays |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | |
| 430 | 430 | // Save cookie in Output object |
| 431 | 431 | // added by ci-phpunit-test |
| 432 | - $CI =& get_instance(); |
|
| 432 | + $CI = & get_instance(); |
|
| 433 | 433 | $output = $CI->output; |
| 434 | 434 | $output->_cookies[$prefix.$name][] = [ |
| 435 | 435 | 'value' => $value, |