My Project
 All Data Structures Namespaces Functions Variables
Public Member Functions | Protected Member Functions | Protected Attributes
CI_Loader Class Reference

Public Member Functions

 __construct ()
 
 initialize ()
 
 is_loaded ($class)
 
 library ($library= '', $params=NULL, $object_name=NULL)
 
 model ($model, $name= '', $db_conn=FALSE)
 
 database ($params= '', $return=FALSE, $active_record=NULL)
 
 dbutil ()
 
 dbforge ()
 
 view ($view, $vars=array(), $return=FALSE)
 
 file ($path, $return=FALSE)
 
 vars ($vars=array(), $val= '')
 
 get_var ($key)
 
 helper ($helpers=array())
 
 helpers ($helpers=array())
 
 language ($file=array(), $lang= '')
 
 config ($file= '', $use_sections=FALSE, $fail_gracefully=FALSE)
 
 driver ($library= '', $params=NULL, $object_name=NULL)
 
 add_package_path ($path, $view_cascade=TRUE)
 
 get_package_paths ($include_base=FALSE)
 
 remove_package_path ($path= '', $remove_config_path=TRUE)
 

Protected Member Functions

 _ci_load ($_ci_data)
 
 _ci_load_class ($class, $params=NULL, $object_name=NULL)
 
 _ci_init_class ($class, $prefix= '', $config=FALSE, $object_name=NULL)
 
 _ci_object_to_array ($object)
 
_ci_get_component ($component)
 
 _ci_prep_filename ($filename, $extension)
 

Protected Attributes

 $_ci_ob_level
 
 $_ci_view_paths = array()
 
 $_ci_library_paths = array()
 
 $_ci_model_paths = array()
 
 $_ci_helper_paths = array()
 
 $_base_classes = array()
 
 $_ci_cached_vars = array()
 
 $_ci_classes = array()
 
 $_ci_loaded_files = array()
 
 $_ci_models = array()
 
 $_ci_helpers = array()
 
 $_ci_varmap
 

Constructor & Destructor Documentation

__construct ( )

Constructor

Sets the path to the view files and gets the initial output buffering level

Member Function Documentation

& _ci_get_component (   $component)
protected

Get a reference to a specific library or model

Parameters
string
Returns
bool
_ci_init_class (   $class,
  $prefix = '',
  $config = FALSE,
  $object_name = NULL 
)
protected

Instantiates a class

Parameters
string
string
bool
stringan optional object name
Returns
null
_ci_load (   $_ci_data)
protected

Loader

This function is used to load views and files. Variables are prefixed with ci to avoid symbol collision with variables made available to view files

Parameters
array
Returns
void
_ci_load_class (   $class,
  $params = NULL,
  $object_name = NULL 
)
protected

Load class

This function loads the requested class.

Parameters
stringthe item that is being loaded
mixedany additional parameters
stringan optional object name
Returns
void
_ci_object_to_array (   $object)
protected

Object to Array

Takes an object as input and converts the class variables to array key/vals

Parameters
object
Returns
array
_ci_prep_filename (   $filename,
  $extension 
)
protected

Prep filename

This function preps the name of various items to make loading them more reliable.

Parameters
mixed
string
Returns
array
add_package_path (   $path,
  $view_cascade = TRUE 
)

Add Package Path

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

Parameters
string
boolean
Returns
void
config (   $file = '',
  $use_sections = FALSE,
  $fail_gracefully = FALSE 
)

Loads a config file

Parameters
string
bool
bool
Returns
void
database (   $params = '',
  $return = FALSE,
  $active_record = NULL 
)

Database Loader

Parameters
stringthe DB credentials
boolwhether to return the DB object
boolwhether to enable active record (this allows us to override the config setting)
Returns
object
dbforge ( )

Load the Database Forge Class

Returns
string
dbutil ( )

Load the Utilities Class

Returns
string
driver (   $library = '',
  $params = NULL,
  $object_name = NULL 
)

Driver

Loads a driver library

Parameters
stringthe name of the class
mixedthe optional parameters
stringan optional object name
Returns
void
file (   $path,
  $return = FALSE 
)

Load File

This is a generic file loader

Parameters
string
bool
Returns
string
get_package_paths (   $include_base = FALSE)

Get Package Paths

Return a list of all package paths, by default it will ignore BASEPATH.

Parameters
string
Returns
void
get_var (   $key)

Get Variable

Check if a variable is set and retrieve it.

Parameters
array
Returns
void
helper (   $helpers = array())

Load Helper

This function loads the specified helper file.

Parameters
mixed
Returns
void
helpers (   $helpers = array())

Load Helpers

This is simply an alias to the above function in case the user has written the plural form of this function.

Parameters
array
Returns
void
initialize ( )

Initialize the Loader

This method is called once in CI_Controller.

Parameters
array
Returns
object
is_loaded (   $class)

Is Loaded

A utility function to test if a class is in the self::$_ci_classes array. This function returns the object name if the class tested for is loaded, and returns FALSE if it isn't.

It is mainly used in the form_helper -> _get_validation_object()

Parameters
stringclass being checked for
Returns
mixed class object name on the CI SuperObject or FALSE
language (   $file = array(),
  $lang = '' 
)

Loads a language file

Parameters
array
string
Returns
void
library (   $library = '',
  $params = NULL,
  $object_name = NULL 
)

Class Loader

This function lets users load and instantiate classes. It is designed to be called from a user's app controllers.

Parameters
stringthe name of the class
mixedthe optional parameters
stringan optional object name
Returns
void
model (   $model,
  $name = '',
  $db_conn = FALSE 
)

Model Loader

This function lets users load and instantiate models.

Parameters
stringthe name of the class
stringname for the model
booldatabase connection
Returns
void
remove_package_path (   $path = '',
  $remove_config_path = TRUE 
)

Remove Package Path

Remove a path from the library, model, and helper path arrays if it exists If no path is provided, the most recently added path is removed.

Parameters
type
bool
Returns
type
vars (   $vars = array(),
  $val = '' 
)

Set Variables

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

Parameters
array
string
Returns
void
view (   $view,
  $vars = array(),
  $return = FALSE 
)

Load View

This function is used to load a "view" file. It has three parameters:

  1. The name of the "view" file to be included.
  2. An associative array of data to be extracted for use in the view.
  3. TRUE/FALSE - whether to return the data or load it. In some cases it's advantageous to be able to return data so that a developer can process it in some way.
Parameters
string
array
bool
Returns
void

Field Documentation

$_ci_varmap
protected
Initial value:
= array('unit_test' => 'unit',
'user_agent' => 'agent')

The documentation for this class was generated from the following file: