Formatting output Plese Wait...
Contains the methods to load module(s), View(s), plugin(s).
More...
|
Public Member Functions |
| zLoader () |
| __construct () |
| Defines the constants required and dumps the array of parsed class.ini.php file under settings also links $zLoader to zLoader class.
|
| ld ($path, $str, $indx) |
| The main loader Method ran through module and plugin method that actually loads the method / Plugin $key === module / Plugin / .
|
| module ($str, $mode=MOD_EXPLICIT) |
| Loads a Module.
|
| modules () |
| Loads multiple modules at a time.
|
| plugin ($str, $mode=PLUG_EXPLICIT) |
| Loads Plugins.
|
| plugins () |
| Loads multiple Modules at a time.
|
| lib ($libName) |
| Load a Lib of the Current Project.
|
| listModules () |
| List's all the aviliable/loadable modules.
|
| listPlugins () |
| List's all the aviliable/loadable plugins.
|
Data Fields |
| $class |
| $loaded_mods = array() |
Detailed Description
Contains the methods to load module(s), View(s), plugin(s).
Get's Instantiated as $load Global Object. You can Use $load->module() or $load->plugin() etc.. and from your Controler you get a reference to $load Object as $this->load
Definition at line 33 of file preloader.php.
Constructor & Destructor Documentation
Defines the constants required and dumps the array of parsed class.ini.php file under settings also links $zLoader to zLoader class.
Reimplemented from zCore.
Definition at line 45 of file preloader.php.
Referenced by zLoader().
Show Source00045 {
00046 parent::__construct();
00047 if(!defined('MOD_INTERNAL')){define("MOD_INTERNAL", "module-abstract");}
00048 if(!defined('MOD_EXPLICIT')){define("MOD_EXPLICIT", "module");}
00049 if(!defined('PLUG_INTERNAL')){define("PLUG_INTERNAL", "plugin-abstract");}
00050 if(!defined('PLUG_EXPLICIT')){define("PLUG_EXPLICIT", "plugin");}
00051 if(!defined('Z_CLS_LOAD_CNS')){define('Z_CLS_LOAD_CNS', 1);}
00052 if(!defined('Z_MODULE_FILE_NAME')){define('Z_MODULE_FILE_NAME', 'class.ini.php');}
00053 $this->class = parse_ini_file(ZIGSETTINGS.DRS.'class.ini.php', true);
00054 }
Top
Member Function Documentation
zLoader::ld( unknown $path, string $str, string $indx )
The main loader Method ran through module and plugin method that actually loads the method / Plugin $key === module / Plugin / .
.... $str === name of the module / plugin / .....
- Parameters:
-
Definition at line 64 of file preloader.php.
References perror().
Referenced by module(), and plugin().
Show Source00064 {
00065
00066 $trg = ZIGROOT.DRS.$path.DRS.@$this->class[$indx][$str];
00067 if(!@in_array($str, array_keys($this->class[$indx]))){
00068 perror("Sorry the ".$indx." `".$str."` is not Installed/listed/Found according to ".Z_MODULE_FILE_NAME);
00069 }else{
00070 if(file_exists($trg) && is_readable($trg)){
00071 if(!@isset($this->loaded_mods[$indx][$str])){
00072 $this->loaded_mods[$indx][$str] = $path;
00073 include_once($trg);
00074 }
00075 }else{
00076 is_file($trg) ? $sts = "Not readable [ Permission : ".fileperms($trg)." ]" : $sts = "Not Present";
00077 perror("<code>zigmoyd.loader</code><br />Sorry the ".$path." `".$str."` is Not accessible<br /> as the file `".$trg."` is ".$sts);
00078 }
00079 }
00080 }
Top
zLoader::module( string $str, int $mode = MOD_EXPLICIT
)
Loads a Module.
Fires Error if the module doesn't exists. after successfull loading of a module you can use all the classes and functions in that module. e.g. $load->module('zFaccess'); will load zFaccess module returns true if successfully loaded else returns false.
- Parameters:
-
| $str | Name of the Module to load |
| $mode | Optional MOD_EXPLICIT By default. Use MOD_INTERNAL for loading Abstract modules |
- Returns:
- bool
Definition at line 92 of file preloader.php.
References ld(), and perror().
Referenced by modules().
Show Source00092 {
00093 if($mode == MOD_EXPLICIT){$key = MOD_KEY_NAME_EXPLICIT;}elseif($mode == MOD_INTERNAL){
00094 $key = MOD_KEY_NAME_INTERNAL;}else{perror("Unknown Mode `".$mode."` Specified");}
00095 $this->ld($key, $str, $mode);
00096 }
Top
Loads multiple modules at a time.
Loads numbers of modules through module() accept infinite number of arguments (module name) can also can accept Numarically indexed array of module names to load
- Parameters:
-
| $module_name | mixed name of the Module(s) To Load can be string or array |
| ..... | mixed name(s) of module name can be string or array |
Definition at line 107 of file preloader.php.
References $val, and module().
Show Source00107 {
00108 $lst_args = func_get_args();
00109 foreach($lst_args as $key => $val){
00110 if(!is_array($val)){$this->module($val);}
00111 else{foreach($val as $k => $v){$this->module($v);}}
00112 }
00113 }
Top
zLoader::plugin( string $str, int $mode = PLUG_EXPLICIT
)
Loads Plugins.
Fires error if Plugin doesn't exists. after successful loading of a plugin you can use all the classes, functions in that plugin. $load->plugin('weather'); will load weather Plugin.
- Parameters:
-
| $str | Name of the Plugin to Load |
| $mode | optinal PLUG_EXPLICIT by default use PLUG_INTERNAL to load abstract Plugins |
- Returns:
- bool
Definition at line 124 of file preloader.php.
References ld(), and perror().
Referenced by plugins().
Show Source00124 {
00125 if($mode == PLUG_EXPLICIT){$key = PLUG_KEY_NAME_EXPLICIT;}elseif($mode == PLUG_INTERNAL){
00126 $key = PLUG_KEY_NAME_INTERNAL;}else{perror("Unknown Mode `".$mode."` Specified");}
00127 $this->ld($key, $str, $mode);
00128 }
Top
Loads multiple Modules at a time.
Loads numbers of plugins through plugin() accept infinite number of arguments (plugin name) can also can accept 0 indexed array of plugin names to load
- Parameters:
-
| $plugin_name | mixed name of the plugin(s) To Load can be string or array |
| ..... | mixed name(s) of plugin name can be string or array |
Definition at line 139 of file preloader.php.
References $val, and plugin().
Show Source00139 {
00140 $lst_args = func_get_args();
00141 foreach($lst_args as $var){
00142 $this->plugin($val);
00143 }
00144 }
Top
zLoader::lib( string $libName )
Load a Lib of the Current Project.
- Parameters:
-
| $libName | Name of the lib to Load |
Definition at line 150 of file preloader.php.
References perror().
Show Source00150 {
00151 if(!file_exists(ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.Z_PROJECT_DIR.DRS.Z_DIR_LOCAL_LIB.DRS.$libName.'.lib.php')){
00152 perror("<code>zigmoyd.loader.lib</code><br />Failed to load Lib $libName as file $libName.lib.php doesn't exist");
00153 return false;
00154 }
00155 if(!is_readable(ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.Z_PROJECT_DIR.DRS.Z_DIR_LOCAL_LIB.DRS.$libName.'.lib.php')){
00156 perror("<code>zigmoyd.loader.lib</code><br />Failed to load Lib $libName as file $libName.lib.php is not readable");
00157 return false;
00158 }
00159 include_once(ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.Z_PROJECT_DIR.DRS.Z_DIR_LOCAL_LIB.DRS.$libName.'.lib.php');
00160 return true;
00161 }
Top
List's all the aviliable/loadable modules.
- Returns:
- array
Definition at line 167 of file preloader.php.
Show Source00167 {
00168 return array_keys($this->class['module']);
00169 }
Top
List's all the aviliable/loadable plugins.
- Returns:
- array
Definition at line 175 of file preloader.php.
Show Source00175 {
00176 return array_keys($this->class['plugin']);
00177 }
Top
Field Documentation
zLoader::$loaded_mods = array()
The documentation for this class was generated from the following file: