protected function _ci_load_stock_library($library_name, $file_path, $params, $object_name)
{
$prefix = 'CI_';
if (class_exists($prefix . $library_name, FALSE)) {
if (class_exists(config_item('subclass_prefix') . $library_name, FALSE)) {
$prefix = config_item('subclass_prefix');
}
// Before we deem this to be a duplicate request, let's see
// if a custom object name is being supplied. If so, we'll
// return a new instance of the object
if ($object_name !== NULL) {
$CI = $this->get_instance();
if (!isset($CI->{$object_name})) {
return $this->_ci_init_library($library_name, $prefix, $params, $object_name);
}
}
log_message('debug', $library_name . ' class already loaded. Second attempt ignored.');
return;
}
$paths = $this->_ci_library_paths;
array_pop($paths);
// BASEPATH
array_pop($paths);
// APPPATH (needs to be the first path checked)
array_unshift($paths, APPPATH);
foreach ($paths as $path) {
if (file_exists($path = $path . 'libraries/' . $file_path . $library_name . '.php')) {
// Override
include_once $path;
if (class_exists($prefix . $library_name, FALSE)) {
return $this->_ci_init_library($library_name, $prefix, $params, $object_name);
} else {
log_message('debug', $path . ' exists, but does not declare ' . $prefix . $library_name);
}
}
}
include_once BASEPATH . 'libraries/' . $file_path . $library_name . '.php';
// Check for extensions
$subclass = config_item('subclass_prefix') . $library_name;
foreach ($paths as $path) {
if (file_exists($path = $path . 'libraries/' . $file_path . $subclass . '.php')) {
include_once $path;
if (class_exists($subclass, FALSE)) {
$prefix = config_item('subclass_prefix');
break;
} else {
log_message('debug', $path . ' exists, but does not declare ' . $subclass);
}
}
}
return $this->_ci_init_library($library_name, $prefix, $params, $object_name);
}