diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-06-04 23:51:14 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-06-04 23:51:14 +0200 |
commit | 39b1c11f5976104dce30fe83e1d3c6f9ed616122 (patch) | |
tree | 482b07468ca201d0dbdbfcf3cdb121c967003112 /system/helpers/file_helper.php | |
parent | 10d78f61399dd647ada0afaa43e5e9ec48d55e82 (diff) |
Direct return from mimes config, instead of using global $mimes;
Global variables are generally a terrible idea, especially for something as simple as this. The mimes.php now returns an array instead of just injecting a variable name into the global namespace.
Diffstat (limited to 'system/helpers/file_helper.php')
-rw-r--r-- | system/helpers/file_helper.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 0061c4285..068706c30 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -349,17 +349,17 @@ if ( ! function_exists('get_mime_by_extension')) { $extension = strtolower(substr(strrchr($file, '.'), 1)); - global $mimes; + static $mimes; if ( ! is_array($mimes)) { if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) { - include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'); + $mimes = include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'); } elseif (is_file(APPPATH.'config/mimes.php')) { - include(APPPATH.'config/mimes.php'); + $mimes = include(APPPATH.'config/mimes.php'); } if ( ! is_array($mimes)) |