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() |
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.
zLoader::__construct | ( | ) |
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().
00045 { 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);//Parse the class.ini.php File 00054 }
zLoader::zLoader | ( | ) |
Definition at line 37 of file preloader.php.
References __construct().
00037 { 00038 $this->__construct(); 00039 }
zLoader::ld | ( | $ | path, | |
$ | str, | |||
$ | 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 / .....
$key | string | |
$str | string |
Definition at line 64 of file preloader.php.
References perror().
Referenced by module(), and plugin().
00064 { 00065 //global ${Z_LOADER_VAR_NAME}; 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 }
zLoader::module | ( | $ | str, | |
$ | 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.
$str | string Name of the Module to load | |
$mode | int Optional MOD_EXPLICIT By default. Use MOD_INTERNAL for loading Abstract modules |
Definition at line 92 of file preloader.php.
References ld(), and perror().
Referenced by modules().
00092 { 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 }
zLoader::modules | ( | ) |
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
$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().
00107 { 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 }
zLoader::plugin | ( | $ | str, | |
$ | 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.
$str | string Name of the Plugin to Load | |
$mode | int optinal PLUG_EXPLICIT by default use PLUG_INTERNAL to load abstract Plugins |
Definition at line 124 of file preloader.php.
References ld(), and perror().
Referenced by plugins().
00124 { 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 }
zLoader::plugins | ( | ) |
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
$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().
00139 { 00140 $lst_args = func_get_args(); 00141 foreach($lst_args as $var){ 00142 $this->plugin($val); 00143 } 00144 }
zLoader::lib | ( | $ | libName | ) |
Load a Lib of the Current Project.
$libName | string Name of the lib to Load |
Definition at line 150 of file preloader.php.
References perror().
00150 { 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 }
zLoader::listModules | ( | ) |
List's all the aviliable/loadable modules.
Definition at line 167 of file preloader.php.
zLoader::listPlugins | ( | ) |
List's all the aviliable/loadable plugins.
Definition at line 175 of file preloader.php.
zLoader::$class |
Definition at line 34 of file preloader.php.
zLoader::$loaded_mods = array() |
Definition at line 35 of file preloader.php.