ZMLoader
public class ZMLoader
| Field Summary | |
|---|---|
| final str | |
| Constructor Summary | |
|---|---|
ZMLoader(string name) 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(string prefix) 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) Shortcut version of ZMLoader::instance()->resolveClass($name). |
| string | resolveClass(string name, string key) Resolve and load the class code for the given class name. |
| protected array | scan(string path, boolean recursive) Scan the given path for PHP files. |
| void | setParent(mixed parent) Set the parent loader. |
public final str CLASS_PREFIX = 'ZM'
public ZMLoader(string name)
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(string prefix)
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)
Shortcut version of ZMLoader::instance()->resolveClass($name).
null.public string resolveClass(string name, string key)
Resolve and load the class code for the given class name.
null.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(..)methodNote1: This is not as scalable as Java code and does not handle more than on level of inheritance.
Note2: Static methods operate all on the root loader.
Note3: Custom classes without prefix that extend prefixed classes must extend
ZMObjectin order to be recognized properly.