@@ -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']; |
@@ -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 | } |
@@ -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 | { |
@@ -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; |