Properties

$_ci_ob_level

$_ci_ob_level : integer

Nesting level of the output buffering mechanism

Type

integer

$_ci_view_paths

$_ci_view_paths : array

List of paths to load views from

Type

array

$_ci_library_paths

$_ci_library_paths : array

List of paths to load libraries from

Type

array

$_ci_model_paths

$_ci_model_paths : array

List of paths to load models from

Type

array

$_ci_helper_paths

$_ci_helper_paths : array

List of paths to load helpers from

Type

array

$_ci_cached_vars

$_ci_cached_vars : array

List of cached variables

Type

array

$_ci_classes

$_ci_classes : array

List of loaded classes

Type

array

$_ci_models

$_ci_models : array

List of loaded models

Type

array

$_ci_helpers

$_ci_helpers : array

List of loaded helpers

Type

array

$_ci_varmap

$_ci_varmap : array

List of class name mappings

Type

array

Methods

__construct()

__construct() : void

Class constructor

Sets component load paths, gets the initial output buffering level.

initialize()

initialize() : void

Initializer

is_loaded()

is_loaded(string  $class) : string|boolean

Is Loaded

A utility method to test if a class is in the self::$_ci_classes array.

Parameters

string $class

Class name to check for

Returns

string|boolean —

Class object name if loaded or FALSE

library()

library(mixed  $library, array  $params = NULL, string  $object_name = NULL) : object

Library Loader

Loads and instantiates libraries. Designed to be called from application controllers.

Parameters

mixed $library

Library name

array $params

Optional parameters to pass to the library class constructor

string $object_name

An optional object name to assign to

Returns

object

model()

model(mixed  $model, string  $name = '', boolean  $db_conn = FALSE) : object

Model Loader

Loads and instantiates models.

Parameters

mixed $model

Model name

string $name

An optional object name to assign to

boolean $db_conn

An optional database connection configuration to initialize

Returns

object

database()

database(mixed  $params = '', boolean  $return = FALSE, boolean  $query_builder = NULL) : object|boolean

Database Loader

Parameters

mixed $params

Database configuration options

boolean $return

Whether to return the database object

boolean $query_builder

Whether to enable Query Builder (overrides the configuration setting)

Returns

object|boolean —

Database object if $return is set to TRUE, FALSE on failure, CI_Loader instance in any other case

dbutil()

dbutil(object  $db = NULL, boolean  $return = FALSE) : object

Load the Database Utilities Class

Parameters

object $db

Database object

boolean $return

Whether to return the DB Utilities class object or not

Returns

object

dbforge()

dbforge(object  $db = NULL, boolean  $return = FALSE) : object

Load the Database Forge Class

Parameters

object $db

Database object

boolean $return

Whether to return the DB Forge class object or not

Returns

object

view()

view(string  $view, array  $vars = array(), boolean  $return = FALSE) : object|string

View Loader

Loads "view" files.

Parameters

string $view

View name

array $vars

An associative array of data to be extracted for use in the view

boolean $return

Whether to return the view output or leave it to the Output class

Returns

object|string

file()

file(string  $path, boolean  $return = FALSE) : object|string

Generic File Loader

Parameters

string $path

File path

boolean $return

Whether to return the file output

Returns

object|string

vars()

vars(array|object|string  $vars, string  $val = '') : object

Set Variables

Once variables are set they become available within the controller class and its "view" files.

Parameters

array|object|string $vars

An associative array or object containing values to be set, or a value's name if string

string $val

Value to set, only used if $vars is a string

Returns

object

clear_vars()

clear_vars() : \CI_Loader

Clear Cached Variables

Clears the cached variables.

Returns

\CI_Loader

get_var()

get_var(string  $key) : mixed

Get Variable

Check if a variable is set and retrieve it.

Parameters

string $key

Variable name

Returns

mixed —

The variable or NULL if not found

get_vars()

get_vars() : array

Get Variables

Retrieves all loaded variables.

Returns

array

helper()

helper(string|array<mixed,string>  $helpers = array()) : object

Helper Loader

Parameters

string|array<mixed,string> $helpers

Helper name(s)

Returns

object

helpers()

helpers(string|array<mixed,string>  $helpers = array()) : object

Load Helpers

An alias for the helper() method in case the developer has written the plural form of it.

Parameters

string|array<mixed,string> $helpers

Helper name(s)

Returns

object

language()

language(string|array<mixed,string>  $files,   $lang = '') : object

Language Loader

Loads language files.

Parameters

string|array<mixed,string> $files

List of language file names to load

$lang

Returns

object

config()

config(string  $file, boolean  $use_sections = FALSE, boolean  $fail_gracefully = FALSE) : boolean

Config Loader

Loads a config file (an alias for CI_Config::load()).

Parameters

string $file

Configuration file name

boolean $use_sections

Whether configuration values should be loaded into their own section

boolean $fail_gracefully

Whether to just return FALSE or display an error message

Returns

boolean —

TRUE if the file was loaded correctly or FALSE on failure

driver()

driver(string|array<mixed,string>  $library, array  $params = NULL, string  $object_name = NULL) : object|boolean

Driver Loader

Loads a driver library.

Parameters

string|array<mixed,string> $library

Driver name(s)

array $params

Optional parameters to pass to the driver

string $object_name

An optional object name to assign to

Returns

object|boolean —

Object or FALSE on failure if $library is a string and $object_name is set. CI_Loader instance otherwise.

add_package_path()

add_package_path(string  $path, boolean  $view_cascade = TRUE) : object

Add Package Path

Prepends a parent path to the library, model, helper and config path arrays.

Parameters

string $path

Path to add

boolean $view_cascade

(default: TRUE)

Returns

object

get_package_paths()

get_package_paths(boolean  $include_base = FALSE) : array

Get Package Paths

Return a list of all package paths.

Parameters

boolean $include_base

Whether to include BASEPATH (default: FALSE)

Returns

array

remove_package_path()

remove_package_path(string  $path = '') : object

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.

Parameters

string $path

Path to remove

Returns

object

_ci_load()

_ci_load(array  $_ci_data) : object

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.

Parameters

array $_ci_data

Data to load

Returns

object

_ci_load_library()

_ci_load_library(string  $class, mixed  $params = NULL, string  $object_name = NULL) : void

Internal CI Library Loader

Parameters

string $class

Class name to load

mixed $params

Optional parameters to pass to the class constructor

string $object_name

Optional object name to assign to

_ci_load_stock_library()

_ci_load_stock_library(string  $library_name, string  $file_path, mixed  $params, string  $object_name) : void

Internal CI Stock Library Loader

Parameters

string $library_name

Library name to load

string $file_path

Path to the library filename, relative to libraries/

mixed $params

Optional parameters to pass to the class constructor

string $object_name

Optional object name to assign to

_ci_init_library()

_ci_init_library(string  $class, string  $prefix, array|null|boolean  $config = FALSE, string  $object_name = NULL) : void

Internal CI Library Instantiator

Parameters

string $class

Class name

string $prefix

Class name prefix

array|null|boolean $config

Optional configuration to pass to the class constructor: FALSE to skip; NULL to search in config paths; array containing configuration data

string $object_name

Optional object name to assign to

_ci_autoloader()

_ci_autoloader() : void

CI Autoloader

Loads component listed in the config/autoload.php file.

_ci_prepare_view_vars()

_ci_prepare_view_vars(mixed  $vars) : array

Prepare variables for _ci_vars, to be later extract()-ed inside views

Converts objects to associative arrays and filters-out internal variable names (i.e. keys prefixed with 'ci').

Parameters

mixed $vars

Returns

array

_ci_get_component()

_ci_get_component(string  $component) : boolean

CI Component getter

Get a reference to a specific library or model.

Parameters

string $component

Component name

Returns

boolean