From 1bdc9c8903eb2db33fdb8174d61e15100dfbbca8 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 10 Apr 2011 10:39:31 +0200 Subject: update to CI 2.0.2 Signed-off-by: Florian Pritz --- system/core/Loader.php | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) (limited to 'system/core/Loader.php') diff --git a/system/core/Loader.php b/system/core/Loader.php index 07166188e..e75805d0e 100755 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -79,9 +79,9 @@ class CI_Loader { { if (is_array($library)) { - foreach($library as $read) + foreach ($library as $class) { - $this->library($read); + $this->library($class, $params); } return; @@ -97,17 +97,7 @@ class CI_Loader { $params = NULL; } - if (is_array($library)) - { - foreach ($library as $class) - { - $this->_ci_load_class($class, $params, $object_name); - } - } - else - { - $this->_ci_load_class($library, $params, $object_name); - } + $this->_ci_load_class($library, $params, $object_name); } // -------------------------------------------------------------------- @@ -127,7 +117,7 @@ class CI_Loader { { if (is_array($model)) { - foreach($model as $babe) + foreach ($model as $babe) { $this->model($babe); } @@ -880,8 +870,19 @@ class CI_Loader { foreach ($config_component->_config_paths as $path) { // We test for both uppercase and lowercase, for servers that - // are case-sensitive with regard to file names - if (file_exists($path .'config/'.strtolower($class).EXT)) + // are case-sensitive with regard to file names. Check for environment + // first, global next + if (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.strtolower($class).EXT)) + { + include_once($path .'config/'.ENVIRONMENT.'/'.strtolower($class).EXT); + break; + } + elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).EXT)) + { + include_once($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).EXT); + break; + } + elseif (file_exists($path .'config/'.strtolower($class).EXT)) { include_once($path .'config/'.strtolower($class).EXT); break; @@ -964,7 +965,15 @@ class CI_Loader { */ function _ci_autoloader() { - include_once(APPPATH.'config/autoload'.EXT); + if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT)) + { + include_once(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT); + } + else + { + include_once(APPPATH.'config/autoload'.EXT); + } + if ( ! isset($autoload)) { @@ -1092,4 +1101,4 @@ class CI_Loader { } /* End of file Loader.php */ -/* Location: ./system/core/Loader.php */ \ No newline at end of file +/* Location: ./system/core/Loader.php */ -- cgit v1.2.3-24-g4f1b