ZenMagick 0.9.6


org.zenmagick.service.ZMPlugins

Class ZMPlugins

ZMObject
|
+--ZMPlugins

public class ZMPlugins
extends ZMObject

Plugins.

The plugin type is controlled by the base directory within the plugins directory. Please note that even though it is valid to create payment, shipping and order_total directories/plugins, zen-cart will not (yet) recognize them as such.

For now, plugins are a simple way to add configuration options to zen-cart without the need to write custom installer/uninstaller.Plugins may consist of either:

a single file
In this case the filename is expected to reflect the classname and the class, in turn, to extend from ZMPlugin.
a directory containing multiple files
In this case the convention require a .php with the same name as the directory in the directory, containing the main plugin class. Again, the classname is expected to be the same as the filename (without the .php extension). It is the plugins responsibility to load all other files it depons upon.

Plugins are grouped according to the way they are used/required. Valid groups (subdirectories) are:

init
system plugins
admin
admin plugins
request
created for each request

Author:
DerManoMann
Version:
$Id: ZMPlugins.php 2005 2009-03-02 02:53:05Z dermanomann $

Fields inherited from org.zenmagick.ZMObject
properties_
Constructor Summary

ZMPlugins()

Create new instance.

Method Summary
array

getAllPlugins(string scope, boolean configured)

Get all plugins.

static ZMPlugin

getPluginForId(string id, string type)

Get plugin for the given id.

array

getPluginTypes()

Get a list of available plugin types.

static array

getPluginsForType(string type, string scope, boolean configured)

Get all plugins for the given type.

static ZMPlugin

initPluginForId(string id, boolean forceInit)

Init a single plugin.

static void

initPlugins(mixed types, string scope)

Init all plugins of the given type and scope.

static void

instance()

Get instance.

Methods inherited from org.zenmagick.ZMObject
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Constructor Detail

ZMPlugins

public ZMPlugins()

Create new instance. /


Method Detail

getAllPlugins

public array getAllPlugins(string scope, boolean configured)

Get all plugins.

Parameters:
scope - The plugin scope; default is ZMPlugin::SCOPE_ALL.
configured - If true, return only configured provider: default is true.
Returns:
A list of ZMPlugin instances grouped by type.

getPluginForId

public static ZMPlugin getPluginForId(string id, string type)

Get plugin for the given id.

Parameters:
id - The plugin id.
type - Optional type.
Returns:
A plugin instance or null.

getPluginTypes

public array getPluginTypes()

Get a list of available plugin types.

Returns:
A list of types and their associated directories.

getPluginsForType

public static array getPluginsForType(string type, string scope, boolean configured)

Get all plugins for the given type.

Parameters:
type - The plugin type.
scope - The plugin scope; default is ZMPlugin::SCOPE_ALL.
configured - If true, return only configured provider: default is true.
Returns:
A list of ZMPlugin instances.

initPluginForId

public static ZMPlugin initPluginForId(string id, boolean forceInit)

Init a single plugin.

This is the single version of initPlugins().

Parameters:
id - The plugin id.
forceInit - Optional flag to force init even if plugin is not enabled; default is false.
Returns:
An instantiated and initallized plugin or null.

initPlugins

public static void initPlugins(mixed types, string scope)

Init all plugins of the given type and scope.

Parameters:
types - The type or type array.
scope - The current scope.

instance

public static void instance()

Get instance. /


ZenMagick 0.9.6