PHP Class MY_Loader, CodeIgniter-HMVC

Inheritance: extends MX_Loader
Mostra file Open project: hex-ci/CodeIgniter-HMVC Class Usage Examples

Public Properties

Property Type Description
$_ci_autoload_libraries 当前 Module 的控制器名
$_ci_autoload_models 自动装载的类库名数组
$_ci_is_inside_module
$_ci_module_class 当前 Module 所在路径
$_ci_module_method 当前 Module 的调用 URI
$_ci_module_models 当前 Module 执行的方法
$_ci_module_path 当前是否是 Module 里的 Loader
$_ci_module_uri 自动装载的模型名数组

Public Methods

Method Description
__construct ( ) Constructor
_ci_module_ready ( $class_path, $class_name ) Module 中的 Loader 类实例初始化时,自动调用此函数
config ( string $file, boolean $use_sections = FALSE, boolean $fail_gracefully = FALSE ) : boolean Config Loader
database ( mixed $params = '', boolean $return = FALSE, boolean $query_builder = NULL ) : object | boolean Database Loader
dbforge ( object $db = NULL, boolean $return = FALSE ) : object Load the Database Forge Class
dbutil ( object $db = NULL, boolean $return = FALSE ) : object Load the Database Utilities Class
get_base_classes ( ) 获取 _base_classes 属性
language ( string | string[] $files, $lang = '' ) : object Language Loader
model ( string $model, string $name = '', boolean $db_conn = FALSE ) : object Model Loader
module ( $module_uri, $vars = [], $return = FALSE ) : void Module Loader
module_url ( $uri, $controller_name = '' ) : string 取当前 Module 某方法的 URL 地址
view ( string $view, array $vars = [], boolean $return = FALSE ) : object | string View Loader

Protected Methods

Method Description
_ci_get_component ( string $component ) : boolean CI Component getter
_ci_init_library ( string $class, string $prefix, array | null | boolean $config = FALSE, string $object_name = NULL ) : void Internal CI Library Instantiator
_ci_load ( array $_ci_data ) : object Internal CI Data Loader
_ci_load_library ( string $class, mixed $params = NULL, string $object_name = NULL ) : void Internal CI Library Loader
_ci_load_stock_library ( $library_name, string $file_path, mixed $params, string $object_name ) : void Internal CI Stock Library Loader

Private Methods

Method Description
get_instance ( ) 根据是否在模块中来取超级对象

Method Details

__construct() public method

Sets the path to the view files and gets the initial output buffering level
public __construct ( )

_ci_get_component() protected method

Get a reference to a specific library or model.
protected _ci_get_component ( string $component ) : boolean
$component string Component name
return boolean

_ci_init_library() protected method

Internal CI Library Instantiator
protected _ci_init_library ( string $class, string $prefix, array | null | boolean $config = FALSE, string $object_name = NULL ) : void
$class string Class name
$prefix string Class name prefix
$config array | null | boolean Optional configuration to pass to the class constructor: FALSE to skip; NULL to search in config paths; array containing configuration data
$object_name string Optional object name to assign to
return void

_ci_load() protected method

Used to load views and files. Variables are prefixed with _ci_ to avoid symbol collision with variables made available to view files.
protected _ci_load ( array $_ci_data ) : object
$_ci_data array Data to load
return object

_ci_load_library() protected method

Internal CI Library Loader
protected _ci_load_library ( string $class, mixed $params = NULL, string $object_name = NULL ) : void
$class string Class name to load
$params mixed Optional parameters to pass to the class constructor
$object_name string Optional object name to assign to
return void

_ci_load_stock_library() protected method

Internal CI Stock Library Loader
protected _ci_load_stock_library ( $library_name, string $file_path, mixed $params, string $object_name ) : void
$file_path string Path to the library filename, relative to libraries/
$params mixed Optional parameters to pass to the class constructor
$object_name string Optional object name to assign to
return void

_ci_module_ready() public method

Module 中的 Loader 类实例初始化时,自动调用此函数
public _ci_module_ready ( $class_path, $class_name )

config() public method

Loads a config file (an alias for CI_Config::load()).
public config ( string $file, boolean $use_sections = FALSE, boolean $fail_gracefully = FALSE ) : boolean
$file string Configuration file name
$use_sections boolean Whether configuration values should be loaded into their own section
$fail_gracefully boolean Whether to just return FALSE or display an error message
return boolean TRUE if the file was loaded correctly or FALSE on failure

database() public method

Database Loader
public database ( mixed $params = '', boolean $return = FALSE, boolean $query_builder = NULL ) : object | boolean
$params mixed Database configuration options
$return boolean Whether to return the database object
$query_builder boolean Whether to enable Query Builder (overrides the configuration setting)
return object | boolean Database object if $return is set to TRUE, FALSE on failure, CI_Loader instance in any other case

dbforge() public method

Load the Database Forge Class
public dbforge ( object $db = NULL, boolean $return = FALSE ) : object
$db object Database object
$return boolean Whether to return the DB Forge class object or not
return object

dbutil() public method

Load the Database Utilities Class
public dbutil ( object $db = NULL, boolean $return = FALSE ) : object
$db object Database object
$return boolean Whether to return the DB Utilities class object or not
return object

get_base_classes() public method

获取 _base_classes 属性
public get_base_classes ( )

language() public method

Loads language files.
public language ( string | string[] $files, $lang = '' ) : object
$files string | string[] List of language file names to load
return object

model() public method

Loads and instantiates models.
public model ( string $model, string $name = '', boolean $db_conn = FALSE ) : object
$model string Model name
$name string An optional object name to assign to
$db_conn boolean An optional database connection configuration to initialize
return object

module() public method

This function lets users load and instantiate module.
public module ( $module_uri, $vars = [], $return = FALSE ) : void
return void

module_url() public method

取当前 Module 某方法的 URL 地址
public module_url ( $uri, $controller_name = '' ) : string
return string

view() public method

Loads "view" files.
public view ( string $view, array $vars = [], boolean $return = FALSE ) : object | string
$view string View name
$vars array An associative array of data to be extracted for use in the view
$return boolean Whether to return the view output or leave it to the Output class
return object | string

Property Details

$_ci_autoload_libraries public_oe property

当前 Module 的控制器名
public $_ci_autoload_libraries

$_ci_autoload_models public_oe property

自动装载的类库名数组
public $_ci_autoload_models

$_ci_is_inside_module public_oe property

public $_ci_is_inside_module

$_ci_module_class public_oe property

当前 Module 所在路径
public $_ci_module_class

$_ci_module_method public_oe property

当前 Module 的调用 URI
public $_ci_module_method

$_ci_module_models public_oe property

当前 Module 执行的方法
public $_ci_module_models

$_ci_module_path public_oe property

当前是否是 Module 里的 Loader
public $_ci_module_path

$_ci_module_uri public_oe property

自动装载的模型名数组
public $_ci_module_uri