ZMLoader
public class ZMLoader
| Constructor Summary | |
|---|---|
ZMLoader() Create a new loader. |
|
| Method Summary | |
|---|---|
| void | addGlobal(string filename) Add a file to be loaded in global context. |
| void | addPath(string path, boolean recursive) Add a given path to the loaders path. |
| static array | findIncludes(string dir, string ext, boolean recursive, mixed level) Scan (recursively) for .php files. |
| protected string | getClassFile(string name) Get the class file for the given class name. |
| array | getClassPath(boolean includeParent) Get the class path. |
| void | getGlobal(array List) Get files to be loaded in global context. |
| array | Returns a list of all the static code in this loaders path. |
| void | getStats(mixed all, all Optional) Get loader stats. |
| static ZMLoader | instance() Get the root loader. |
| void | Load all available static code. |
| static mixed | make(mixed args, string name, var arg) Shortcut for creating new class instances. |
| protected mixed | makeClass(string name, var arg) Resolve, load and instantiate a new instance of the given class. |
| static string | makeClassname(string filename) Normalize class names based on the filename This is pretty much following Java conventions. |
| void | registerClass(string clazz, string filename) Manually register a class. |
| static string | resolve(string name, mixed isAutoLoad, boolean isAutoload) Shortcut version of ZMLoader::instance()->resolveClass($name). |
| string | resolveClass(string name, mixed isAutoLoad, boolean isAutoload) Resolve and load the class code for the given class name. |
| private string | resolveFromClassPath(string name, mixed isAutoLoad, boolean isAutoload) Resolve and load the class given. |
| protected array | scan(string path, boolean recursive) Scan the given path for PHP files. |
| void | setParent(mixed parent) Set the parent loader. |
public ZMLoader()
Create a new loader. /
public void addGlobal(string filename)
Add a file to be loaded in global context.
public void addPath(string path, boolean recursive)
Add a given path to the loaders path.
public static array findIncludes(string dir, string ext, boolean recursive, mixed level)
Scan (recursively) for .php files.
It is worth mentioning that directories will always be processed only after all plain files in a directory are done.
true, scan recursively..php files.protected string getClassFile(string name)
Get the class file for the given class name.
null.public array getClassPath(boolean includeParent)
Get the class path.
true include the parent loader path: default is true.public void getGlobal(array List)
Get files to be loaded in global context.
public array getStatic()
Returns a list of all the static code in this loaders path. Code is identified by a filename starting with a lower case character.
Note: This is an instance specific method. There is no delegation to a parent loader.
public void getStats(mixed all, all Optional)
Get loader stats.
public static ZMLoader instance()
Get the root loader.
public void loadStatic()
Load all available static code.
Note: Using this is intended to load functions, defines, etc. As this is loaded inside a method, variables inside static files will not be real globals.
/public static mixed make(mixed args, string name, var arg)
Shortcut for creating new class instances.
Please note that is it also possible to pass just a single parameter (array) that contains the class name (first element) and optionally constructor arguments (second, third,..).
protected mixed makeClass(string name, var arg)
Resolve, load and instantiate a new instance of the given class.
public static string makeClassname(string filename)
Normalize class names based on the filename
This is pretty much following Java conventions.
public void registerClass(string clazz, string filename)
Manually register a class.
public static string resolve(string name, mixed isAutoLoad, boolean isAutoload)
Shortcut version of ZMLoader::instance()->resolveClass($name).
false.null.public string resolveClass(string name, mixed isAutoLoad, boolean isAutoload)
Resolve and load the class code for the given class name.
false.null.private string resolveFromClassPath(string name, mixed isAutoLoad, boolean isAutoload)
Resolve and load the class given.
false.null.protected array scan(string path, boolean recursive)
Scan the given path for PHP files.
public void setParent(mixed parent)
Set the parent loader. /
ZenMagick code/class loader.
Loader might be chained to allow delegation of theme loading. All loader implement a parent first strategy.
Classes in ZenMagick have to adhere to the following conventions:
ZMIndexControllerand be namedIndexControllermakeClass(..)methodNote: This is not as scalable as Java code and does not handle more than on level of inheritance.
Static methods operate all on the root loader.