本文整理汇总了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);
}