diff options
Diffstat (limited to 'system/core')
-rw-r--r-- | system/core/Config.php | 1 | ||||
-rw-r--r-- | system/core/Lang.php | 18 | ||||
-rw-r--r-- | system/core/Loader.php | 35 |
3 files changed, 32 insertions, 22 deletions
diff --git a/system/core/Config.php b/system/core/Config.php index 081f1d899..8ecfba73a 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -51,7 +51,6 @@ class CI_Config { // Set the base_url automatically if none was provided if ($this->config['base_url'] == '') { - // Base URL (keeps this crazy sh*t out of the config.php if(isset($_SERVER['HTTP_HOST'])) { $base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http'; diff --git a/system/core/Lang.php b/system/core/Lang.php index e7867b354..8ec179771 100644 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -78,17 +78,21 @@ class CI_Lang { { include($alt_path.'language/'.$idiom.'/'.$langfile); } - elseif (file_exists(APPPATH.'language/'.$idiom.'/'.$langfile)) - { - include(APPPATH.'language/'.$idiom.'/'.$langfile); - } else { - if (file_exists(BASEPATH.'language/'.$idiom.'/'.$langfile)) + $found = FALSE; + + foreach (get_instance()->load->get_package_paths(TRUE) as $package_path) { - include(BASEPATH.'language/'.$idiom.'/'.$langfile); + if (file_exists($package_path.'language/'.$idiom.'/'.$langfile)) + { + include($package_path.'language/'.$idiom.'/'.$langfile); + $found = TRUE; + break; + } } - else + + if ($found !== TRUE) { show_error('Unable to load the requested language file: language/'.$idiom.'/'.$langfile); } diff --git a/system/core/Loader.php b/system/core/Loader.php index afbae6175..136cae9bf 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -81,12 +81,12 @@ class CI_Loader { { foreach($library as $read) { - $this->library($read); + $this->library($read); } - + return; } - + if ($library == '' OR isset($this->_base_classes[$library])) { return FALSE; @@ -527,7 +527,7 @@ class CI_Loader { function add_package_path($path) { $path = rtrim($path, '/').'/'; - + array_unshift($this->_ci_library_paths, $path); array_unshift($this->_ci_model_paths, $path); array_unshift($this->_ci_helper_paths, $path); @@ -540,6 +540,22 @@ class CI_Loader { // -------------------------------------------------------------------- /** + * Get Package Paths + * + * Return a list of all package paths, by default it will ignore BASEPATH. + * + * @access public + * @param string + * @return void + */ + function get_package_paths($include_base = FALSE) + { + return $include_base === TRUE ? $this->_ci_library_paths : $this->_ci_model_paths; + } + + // -------------------------------------------------------------------- + + /** * Remove Package Path * * Remove a path from the library, model, and helper path arrays if it exists @@ -563,7 +579,7 @@ class CI_Loader { else { $path = rtrim($path, '/').'/'; - + foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) { if (($key = array_search($path, $this->{$var})) !== FALSE) @@ -942,15 +958,6 @@ class CI_Loader { return FALSE; } - // Autoload packages - if (isset($autoload['packages'])) - { - foreach ($autoload['packages'] as $package_path) - { - $this->add_package_path($package_path); - } - } - // Load any custom config file if (count($autoload['config']) > 0) { |