CI_Loader =============== Loader Class Loads framework components. * Class name: CI_Loader * Namespace: Properties ---------- ### $_ci_ob_level protected integer $_ci_ob_level Nesting level of the output buffering mechanism * Visibility: **protected** ### $_ci_view_paths protected array $_ci_view_paths = array(VIEWPATH => TRUE) List of paths to load views from * Visibility: **protected** ### $_ci_library_paths protected array $_ci_library_paths = array(APPPATH, BASEPATH) List of paths to load libraries from * Visibility: **protected** ### $_ci_model_paths protected array $_ci_model_paths = array(APPPATH) List of paths to load models from * Visibility: **protected** ### $_ci_helper_paths protected array $_ci_helper_paths = array(APPPATH, BASEPATH) List of paths to load helpers from * Visibility: **protected** ### $_ci_cached_vars protected array $_ci_cached_vars = array() List of cached variables * Visibility: **protected** ### $_ci_classes protected array $_ci_classes = array() List of loaded classes * Visibility: **protected** ### $_ci_models protected array $_ci_models = array() List of loaded models * Visibility: **protected** ### $_ci_helpers protected array $_ci_helpers = array() List of loaded helpers * Visibility: **protected** ### $_ci_varmap protected array $_ci_varmap = array('unit_test' => 'unit', 'user_agent' => 'agent') List of class name mappings * Visibility: **protected** Methods ------- ### __construct void CI_Loader::__construct() Class constructor Sets component load paths, gets the initial output buffering level. * Visibility: **public** ### initialize void CI_Loader::initialize() Initializer * Visibility: **public** ### is_loaded string|boolean CI_Loader::is_loaded(string $class) Is Loaded A utility method to test if a class is in the self::$_ci_classes array. * Visibility: **public** #### Arguments * $class **string** - <p>Class name to check for</p> ### library object CI_Loader::library(string $library, array $params, string $object_name) Library Loader Loads and instantiates libraries. Designed to be called from application controllers. * Visibility: **public** #### Arguments * $library **string** - <p>Library name</p> * $params **array** - <p>Optional parameters to pass to the library class constructor</p> * $object_name **string** - <p>An optional object name to assign to</p> ### model object CI_Loader::model(string $model, string $name, boolean $db_conn) Model Loader Loads and instantiates models. * Visibility: **public** #### Arguments * $model **string** - <p>Model name</p> * $name **string** - <p>An optional object name to assign to</p> * $db_conn **boolean** - <p>An optional database connection configuration to initialize</p> ### database object|boolean CI_Loader::database(mixed $params, boolean $return, boolean $query_builder) Database Loader * Visibility: **public** #### Arguments * $params **mixed** - <p>Database configuration options</p> * $return **boolean** - <p>Whether to return the database object</p> * $query_builder **boolean** - <p>Whether to enable Query Builder (overrides the configuration setting)</p> ### dbutil object CI_Loader::dbutil(object $db, boolean $return) Load the Database Utilities Class * Visibility: **public** #### Arguments * $db **object** - <p>Database object</p> * $return **boolean** - <p>Whether to return the DB Utilities class object or not</p> ### dbforge object CI_Loader::dbforge(object $db, boolean $return) Load the Database Forge Class * Visibility: **public** #### Arguments * $db **object** - <p>Database object</p> * $return **boolean** - <p>Whether to return the DB Forge class object or not</p> ### view object|string CI_Loader::view(string $view, array $vars, boolean $return) View Loader Loads "view" files. * Visibility: **public** #### Arguments * $view **string** - <p>View name</p> * $vars **array** - <p>An associative array of data to be extracted for use in the view</p> * $return **boolean** - <p>Whether to return the view output or leave it to the Output class</p> ### file object|string CI_Loader::file(string $path, boolean $return) Generic File Loader * Visibility: **public** #### Arguments * $path **string** - <p>File path</p> * $return **boolean** - <p>Whether to return the file output</p> ### vars object CI_Loader::vars(array|object|string $vars, string $val) Set Variables Once variables are set they become available within the controller class and its "view" files. * Visibility: **public** #### Arguments * $vars **array|object|string** - <p>An associative array or object containing values to be set, or a value's name if string</p> * $val **string** - <p>Value to set, only used if $vars is a string</p> ### clear_vars object CI_Loader::clear_vars() Clear Cached Variables Clears the cached variables. * Visibility: **public** ### get_var mixed CI_Loader::get_var(string $key) Get Variable Check if a variable is set and retrieve it. * Visibility: **public** #### Arguments * $key **string** - <p>Variable name</p> ### get_vars array CI_Loader::get_vars() Get Variables Retrieves all loaded variables. * Visibility: **public** ### helper object CI_Loader::helper(string|array $helpers) Helper Loader * Visibility: **public** #### Arguments * $helpers **string|array<mixed,string>** - <p>Helper name(s)</p> ### helpers object CI_Loader::helpers(string|array $helpers) Load Helpers An alias for the helper() method in case the developer has written the plural form of it. * Visibility: **public** #### Arguments * $helpers **string|array<mixed,string>** - <p>Helper name(s)</p> ### language object CI_Loader::language(string|array $files, $lang) Language Loader Loads language files. * Visibility: **public** #### Arguments * $files **string|array<mixed,string>** - <p>List of language file names to load</p> * $lang **mixed** ### config boolean CI_Loader::config(string $file, boolean $use_sections, boolean $fail_gracefully) Config Loader Loads a config file (an alias for CI_Config::load()). * Visibility: **public** #### Arguments * $file **string** - <p>Configuration file name</p> * $use_sections **boolean** - <p>Whether configuration values should be loaded into their own section</p> * $fail_gracefully **boolean** - <p>Whether to just return FALSE or display an error message</p> ### driver object|boolean CI_Loader::driver(string|array $library, array $params, string $object_name) Driver Loader Loads a driver library. * Visibility: **public** #### Arguments * $library **string|array<mixed,string>** - <p>Driver name(s)</p> * $params **array** - <p>Optional parameters to pass to the driver</p> * $object_name **string** - <p>An optional object name to assign to</p> ### add_package_path object CI_Loader::add_package_path(string $path, boolean $view_cascade) Add Package Path Prepends a parent path to the library, model, helper and config path arrays. * Visibility: **public** #### Arguments * $path **string** - <p>Path to add</p> * $view_cascade **boolean** - <p>(default: TRUE)</p> ### get_package_paths array CI_Loader::get_package_paths(boolean $include_base) Get Package Paths Return a list of all package paths. * Visibility: **public** #### Arguments * $include_base **boolean** - <p>Whether to include BASEPATH (default: FALSE)</p> ### remove_package_path object CI_Loader::remove_package_path(string $path) Remove Package Path Remove a path from the library, model, helper and/or config path arrays if it exists. If no path is provided, the most recently added path will be removed removed. * Visibility: **public** #### Arguments * $path **string** - <p>Path to remove</p> ### _ci_load object CI_Loader::_ci_load(array $_ci_data) Internal CI Data Loader Used to load views and files. Variables are prefixed with _ci_ to avoid symbol collision with variables made available to view files. * Visibility: **protected** #### Arguments * $_ci_data **array** - <p>Data to load</p> ### _ci_load_library void CI_Loader::_ci_load_library(string $class, mixed $params, string $object_name) Internal CI Library Loader * Visibility: **protected** #### Arguments * $class **string** - <p>Class name to load</p> * $params **mixed** - <p>Optional parameters to pass to the class constructor</p> * $object_name **string** - <p>Optional object name to assign to</p> ### _ci_load_stock_library void CI_Loader::_ci_load_stock_library($library_name, string $file_path, mixed $params, string $object_name) Internal CI Stock Library Loader * Visibility: **protected** #### Arguments * $library_name **mixed** * $file_path **string** - <p>Path to the library filename, relative to libraries/</p> * $params **mixed** - <p>Optional parameters to pass to the class constructor</p> * $object_name **string** - <p>Optional object name to assign to</p> ### _ci_init_library void CI_Loader::_ci_init_library(string $class, string $prefix, array|null|boolean $config, string $object_name) Internal CI Library Instantiator * Visibility: **protected** #### Arguments * $class **string** - <p>Class name</p> * $prefix **string** - <p>Class name prefix</p> * $config **array|null|boolean** - <p>Optional configuration to pass to the class constructor: FALSE to skip; NULL to search in config paths; array containing configuration data</p> * $object_name **string** - <p>Optional object name to assign to</p> ### _ci_autoloader void CI_Loader::_ci_autoloader() CI Autoloader Loads component listed in the config/autoload.php file. * Visibility: **protected** ### _ci_object_to_array array CI_Loader::_ci_object_to_array(object $object) CI Object to Array translator Takes an object as input and converts the class variables to an associative array with key/value pairs. * Visibility: **protected** #### Arguments * $object **object** - <p>Object data to translate</p> ### _ci_get_component boolean CI_Loader::_ci_get_component(string $component) CI Component getter Get a reference to a specific library or model. * Visibility: **protected** #### Arguments * $component **string** - <p>Component name</p> ### _ci_prep_filename array CI_Loader::_ci_prep_filename(string|array $filename, string $extension) Prep filename This function prepares filenames of various items to make their loading more reliable. * Visibility: **protected** #### Arguments * $filename **string|array<mixed,string>** - <p>Filename(s)</p> * $extension **string** - <p>Filename extension</p>