summaryrefslogtreecommitdiffstats
path: root/system/core/Loader.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/core/Loader.php')
-rwxr-xr-xsystem/core/Loader.php45
1 files changed, 27 insertions, 18 deletions
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 */