本文整理匯總了PHP中CI_Loader::_ci_init_library方法的典型用法代碼示例。如果您正苦於以下問題:PHP CI_Loader::_ci_init_library方法的具體用法?PHP CI_Loader::_ci_init_library怎麽用?PHP CI_Loader::_ci_init_library使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CI_Loader
的用法示例。
在下文中一共展示了CI_Loader::_ci_init_library方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _ci_init_library
/**
* 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);
}