ZMObject
|
+--ZMPlugin
public class ZMPlugin
extends ZMObject
| Field Summary | |
|---|---|
| final mixed | |
| final mixed | |
| final mixed | |
| final mixed | |
| final mixed | |
| final mixed | |
| final mixed | |
| final mixed | |
| final mixed | |
| final mixed | |
| Fields inherited from org.zenmagick.ZMObject | |
|---|---|
| properties_ | |
| Constructor Summary | |
|---|---|
ZMPlugin(string title, string description, string version) Create new plugin. |
|
| Method Summary | |
|---|---|
| void | addConfigValue(string title, string key, string value, string description, string setFunction, string useFunction, int sortOrder) Add a configuration value. |
| void | addMenuItem(string id, string title, string function, string menuKey) Add plugin maintenance screen to navigation. |
| mixed | get(string name, mixed default) Support to access plugin config values by name. |
| string | getConfigPath(string file) Get a plugin config file path. |
| array | getConfigValues(boolean prefix) Get all the config values. |
| string | Get description. |
| array | Get optional files to be loaded in global scope. |
| string | getId() Get Id. |
| array | getKeys() Get a list of configuration keys used by this plugin. |
| string | Get this plugin's loader policy. |
| array | Get optional installation messages. |
| string | getName() Get name. |
| string | Get the plugin directory. |
| string | getScope() Get this plugins scope. |
| int | Get the sort order. |
| string | getType() Get the plugin type. |
| string | Get version. |
| void | init() Init this plugin. |
| void | install() Install this plugin. |
| boolean | Check if the plugin is enabled. |
| boolean | Check if the plugin is installed. |
| boolean | Get the traditional flag. |
| string | pluginURL(string uri, boolean echo) Resolve a plugin relative URI. |
| void | remove(boolean keepSettings) Remove this plugin. |
| void | set(string name, mixed value) Support to set plugin config values by name. |
| void | setKeys(array keys) Set the list of configuration keys the actual implementation is using. |
| void | setLoaderPolicy(string loaderPolicy) Set the loader policy for this plugin. |
| void | setPluginDir(string pluginDir) Set the plugin directory. |
| void | setPreferredSortOrder(int sortOrder) Set the preferred sort order. |
| void | setScope(string scope) Set the scope. |
| void | setSortOrder(int sortOrder) Set the sort order. |
| void | setTraditional(boolean traditional) Set the traditional flag. |
| void | setType(string type) Set the plugin type. |
| void | Register this plugin as zen-cart zco subscriber. |
| void | Un-register this plugin as zen-cart zco subscriber. |
| Methods inherited from org.zenmagick.ZMObject | |
|---|---|
| attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton | |
public final mixed KEY_ENABLED_SUFFIX = 'ENABLED'
public final mixed KEY_ORDER_SUFFIX = 'ORDER'
public final mixed KEY_PREFIX = 'PLUGIN_'
public final mixed LP_ALL = 'ALL'
public final mixed LP_FOLDER = 'FOLDER'
public final mixed LP_NONE = 'NONE'
public final mixed LP_PLUGIN = 'PLUGIN'
public final mixed SCOPE_ADMIN = 'admin'
public final mixed SCOPE_ALL = 'all'
public final mixed SCOPE_STORE = 'store'
public ZMPlugin(string title, string description, string version)
Create new plugin.
public void addConfigValue(string title, string key, string value, string description, string setFunction, string useFunction, int sortOrder)
Add a configuration value.
If no sort order is specified, entries will be listed in the order they are added. Effectively, this means sort order can be easier accomplished by adding values in the order they should be displayed.
''.null.null.0.public void addMenuItem(string id, string title, string function, string menuKey)
Add plugin maintenance screen to navigation.
The provided function is free to implement content generation in one of two different ways:
null.ZMPluginPage
instance.public mixed get(string name, mixed default)
Support to access plugin config values by name.
null.public string getConfigPath(string file)
Get a plugin config file path.
Return a fully qualified filename; resolved either against the plugin directory or config/.
If neither file exists, the config/ based filename is returned.
public array getConfigValues(boolean prefix)
Get all the config values.
true, the plugin prefix will be kept, otherwise it will be stripped.ZMConfigValue instances.public string getDescription()
Get description.
public array getGlobal()
Get optional files to be loaded in global scope.
Files returned here would typically have an extension different to .php as otherwise the loader will load them as static.
Global
public string getId()
Get Id.
public array getKeys()
Get a list of configuration keys used by this plugin.
public string getLoaderPolicy()
Get this plugin's loader policy.
The policy controlls the extend of automatic ZMLoader support this plugin requests.
It also affects the code included in core.php. Valid values are:
.php) files can be added to core.php.public array getMessages()
Get optional installation messages.
ZMMessage instances.public string getName()
Get name.
public string getPluginDir()
Get the plugin directory.
null if this plugin is single file only.public string getScope()
Get this plugins scope.
public int getSortOrder()
Get the sort order.
public string getType()
Get the plugin type.
The plugin type is determined by the plugin folder. The type controls if and when a plugin is loaded during the init process. Valid types are:
Plugins do not have to set the type, as this is take care of during configuration.
public string getVersion()
Get version.
public void init()
Init this plugin.
This method is part of the lifecylce of a plugin during storefront request handling.
Code to set up internal resources should be placed here, rather than in the * constructor.
/public void install()
Install this plugin.
This default implementation will automatically create the following settings:
public boolean isEnabled()
Check if the plugin is enabled.
true if the plugin is enabled, false if not.public boolean isInstalled()
Check if the plugin is installed.
true if the plugin is installed, false if not.public boolean isTraditional()
Get the traditional flag.
true if this plugin required traditional configuration handling, false if not.public string pluginURL(string uri, boolean echo)
Resolve a plugin relative URI.
The given uri is assumed to be relative to the plugin folder.
true, the URL will be echo'ed as well as returned.null.public void remove(boolean keepSettings)
Remove this plugin.
true, the settings will not be removed; default is false.public void set(string name, mixed value)
Support to set plugin config values by name.
public void setKeys(array keys)
Set the list of configuration keys the actual implementation is using.
public void setLoaderPolicy(string loaderPolicy)
Set the loader policy for this plugin.
public void setPluginDir(string pluginDir)
Set the plugin directory.
public void setPreferredSortOrder(int sortOrder)
Set the preferred sort order.
public void setScope(string scope)
Set the scope.
This determines where a plugin is active. Allowed values are:
Please note that there are constants that may be used intead of plain strings:
self::SCOPE_STOREself::SCOPE_ADMINself::SCOPE_ALLThe default scope is
self::SCOPE_ALLpublic void setSortOrder(int sortOrder)
Set the sort order.
public void setTraditional(boolean traditional)
Set the traditional flag.
true if this plugin required traditional configuration handling, false if not.public void setType(string type)
Set the plugin type.
public void zcoSubscribe()
Register this plugin as zen-cart zco subscriber. /
public void zcoUnsubscribe()
Un-register this plugin as zen-cart zco subscriber. /
Plugin base class.
Plugins are NOT compatible with zen-cart modules.
The plugin code (id) is based on the plugin class/file name.