Loads component listed in the config/autoload.php file.
protected _ci_autoloader ( ) : void | ||
return | void |
/** * Constructor */ public function __construct() { self::$instance =& $this; // Assign all the class objects that were instantiated by the // bootstrap file (CodeIgniter.php) to local class variables // so that CI can run as one big super object. foreach (is_loaded() as $var => $class) { $this->{$var} =& load_class($class); } $this->load =& load_class('Loader', 'core'); $this->load->_base_classes =& is_loaded(); $this->load->_ci_autoloader(); log_message('debug', "Controller Class Initialized"); }
/** Autload items **/ public function _ci_autoloader() { parent::_ci_autoloader(); if ($this->_module) { $autoload = array(); list($path, $file) = Modules::find('autoload', $this->_module, 'config/'); /* module autoload file */ if ($path != FALSE) { $autoload = array_merge(Modules::load_file($file, $path, 'autoload'), $autoload); } /* nothing to do */ if (count($autoload) == 0) { return; } /* autoload config */ if (isset($autoload['config'])) { foreach ($autoload['config'] as $key => $val) { $this->config($val); } } /* autoload helpers, plugins, languages */ foreach (array('helper', 'plugin', 'language') as $type) { if (isset($autoload[$type])) { foreach ($autoload[$type] as $item) { $this->{$type}($item); } } } /* autoload database & libraries */ if (isset($autoload['libraries'])) { if (in_array('database', $autoload['libraries'])) { /* autoload database */ if (!($db = self::$APP->config->item('database'))) { $db['params'] = 'default'; $db['active_record'] = TRUE; } $this->database($db['params'], FALSE, $db['active_record']); $autoload['libraries'] = array_diff($autoload['libraries'], array('database')); } /* autoload libraries */ foreach ($autoload['libraries'] as $library) { $this->library($library); } } /* autoload models */ if (isset($autoload['model'])) { foreach ($autoload['model'] as $model => $alias) { is_numeric($model) ? $this->model($alias) : $this->model($model, $alias); } } } }
function _ci_autoloader() { Lib(false); // load all that has been loaded by the front controller parent::_ci_autoloader(); }