Internal CI Library Instantiator
protected _ci_init_library ( string $class, string $prefix, array | null | boolean $config = FALSE, string $object_name = NULL ) : void | ||
$class | string | Class name |
$prefix | string | Class name prefix |
$config | array | null | boolean | Optional configuration to pass to the class constructor: FALSE to skip; NULL to search in config paths; array containing configuration data |
$object_name | string | Optional object name to assign to |
리턴 | void |
/** * Internal CI Library Instantiator * * @used-by CI_Loader::_ci_load_stock_library() * @used-by CI_Loader::_ci_load_library() * * @param string $class Class name * @param string $prefix Class name prefix * @param array|null|bool $config Optional configuration to pass to the class constructor: * FALSE to skip; * NULL to search in config paths; * array containing configuration data * @param string $object_name Optional object name to assign to * @return void */ protected function _ci_init_library($class, $prefix, $config = FALSE, $object_name = NULL) { // Is there an associated config file for this class? Note: these should always be lowercase if ($config === NULL) { // Fetch the config paths containing any package paths $config_component = $this->_ci_get_component('config'); if (is_array($config_component->_config_paths)) { $_config = array(); 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. Load global first, // override with environment next if (file_exists($path . 'config/' . strtolower($class) . '.php')) { include $path . 'config/' . strtolower($class) . '.php'; } elseif (file_exists($path . 'config/' . ucfirst(strtolower($class)) . '.php')) { include $path . 'config/' . ucfirst(strtolower($class)) . '.php'; } isset($config) && array_merge($_config, $config); if (file_exists($path . 'config/' . ENVIRONMENT . '/' . strtolower($class) . '.php')) { include $path . 'config/' . ENVIRONMENT . '/' . strtolower($class) . '.php'; } elseif (file_exists($path . 'config/' . ENVIRONMENT . '/' . ucfirst(strtolower($class)) . '.php')) { include $path . 'config/' . ENVIRONMENT . '/' . ucfirst(strtolower($class)) . '.php'; } isset($config) && array_merge($_config, $config); } // Create a copy of config merged files !empty($_config) && ($config = $_config); } } return parent::_ci_init_library($class, $prefix, $config, $object_name); }