ZenMagick 0.9.11


org.zenmagick.core.services.plugins\ZMPlugin
core\services\plugins\ZMPlugin.php at line 55

Class ZMPlugin

ZMObject
└─ZMPlugin

public abstract class ZMPlugin
extends ZMObject

Abstract base class for plugins.

Plugins are a simple way to add custom code to ZenMagick.

This base class comes with the following defaults:

id
The plugin's class name.
name
Empty string.
description
Empty string.
version
0.0.
enabled
null; unless the status is explicitely set, the setting zenmagick.core.plugins.[id].enabled will be checked instead.
pluginDirectory
Location of the plugin class file.
loaderPolicy
ZMPlugin::LP_LIB.
context
Generic code to allow to configure different context values where the plugin allowed; default is 0.

Files affected by the loader policy are all .php files, as documented for ZMLoader.

Author:
DerManoMann

Constant Summary
final static str

LP_ALL

Load all files including subfolder.

final static str

LP_FOLDER

Load files from the plugin folder, but ignore subfolder.

final static str

LP_LIB

Load all files from a lib subfolder, including subfolder.

final static str

LP_NONE

Do not load any plugin files (except, of course, the plugin itself).

Fields inherited from org.zenmagick.core\ZMObject
properties_
Method Summary
void

__construct(array properties)

Create new plugin with some defaults.

int

getContext()

Get the context flags.

string

getDescription()

Get the description.

string

getId()

Get the id.

string

getLoaderPolicy()

Get this plugin's loader policy.

string

getName()

Get the name.

string

getPluginDirectory()

Get the plugin directory.

string

getVersion()

Get the version.

abstract void

init()

Init this plugin.

boolean

isEnabled()

Check if this plugin is enabled.

void

setContext(int context)

Set the context flags.

void

setDescription(string description)

Set the description.

void

setEnabled(boolean status)

Enable/disable this plugin.

void

setId(string id)

Set the id.

void

setLoaderPolicy(string loaderPolicy)

Set the loader policy for this plugin.

void

setName(string name)

Set the name.

void

setPluginDirectory(string directory)

Set the plugin directory.

void

setVersion(string version)

Set the version.

Methods inherited from org.zenmagick.core\ZMObject
__construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set

Constant Detail

core\services\plugins\ZMPlugin.php at line 63

LP_ALL

public final static str LP_ALL = 'ALL'

Load all files including subfolder.


core\services\plugins\ZMPlugin.php at line 59

LP_FOLDER

public final static str LP_FOLDER = 'FOLDER'

Load files from the plugin folder, but ignore subfolder.


core\services\plugins\ZMPlugin.php at line 61

LP_LIB

public final static str LP_LIB = 'LIB'

Load all files from a lib subfolder, including subfolder.


core\services\plugins\ZMPlugin.php at line 57

LP_NONE

public final static str LP_NONE = 'NONE'

Do not load any plugin files (except, of course, the plugin itself).


Method Detail

core\services\plugins\ZMPlugin.php at line 78

__construct

public void __construct(array properties)

Create new plugin with some defaults.

Parameters:
properties - Optional properties; default is an empty array;

core\services\plugins\ZMPlugin.php at line 245

getContext

public int getContext()

Get the context flags.

Returns:
The context flags.

core\services\plugins\ZMPlugin.php at line 140

getDescription

public string getDescription()

Get the description.

Returns:
The description.

core\services\plugins\ZMPlugin.php at line 104

getId

public string getId()

Get the id.

Returns:
A unique id.

core\services\plugins\ZMPlugin.php at line 227

getLoaderPolicy

public string getLoaderPolicy()

Get this plugin's loader policy.

The policy controlls the extend of automatic ZMLoader support this plugin requires.

It also affects the code included in core.php. Valid values are:

ZMPlugin::LP_NONE
Not supported.
ZMPlugin::LP_FOLDER
Everything in the plugin folder, excluding all subfolder and their contents.
ZMPlugin::LP_ALL
All (.php) files can be added to core.php.

Returns:
The loader policy.

core\services\plugins\ZMPlugin.php at line 122

getName

public string getName()

Get the name.

Returns:
The name.

core\services\plugins\ZMPlugin.php at line 176

getPluginDirectory

public string getPluginDirectory()

Get the plugin directory.

Returns:
The plugin directoryr.

core\services\plugins\ZMPlugin.php at line 158

getVersion

public string getVersion()

Get the version.

Returns:
The version.

core\services\plugins\ZMPlugin.php at line 212

init

public abstract void init()

Init this plugin.

Code to set up internal resources, etc. should be called here, rather than in the * constructor.


core\services\plugins\ZMPlugin.php at line 194

isEnabled

public boolean isEnabled()

Check if this plugin is enabled.

Returns:
true if the plugin is enabled, false if not.

core\services\plugins\ZMPlugin.php at line 254

setContext

public void setContext(int context)

Set the context flags.

Parameters:
context - The context flags.

core\services\plugins\ZMPlugin.php at line 149

setDescription

public void setDescription(string description)

Set the description.

Parameters:
description - The description.

core\services\plugins\ZMPlugin.php at line 203

setEnabled

public void setEnabled(boolean status)

Enable/disable this plugin.

Parameters:
status - The new status.

core\services\plugins\ZMPlugin.php at line 113

setId

public void setId(string id)

Set the id.

Parameters:
id - A unique id.

core\services\plugins\ZMPlugin.php at line 236

setLoaderPolicy

public void setLoaderPolicy(string loaderPolicy)

Set the loader policy for this plugin.

Parameters:
loaderPolicy - The loader policy.

core\services\plugins\ZMPlugin.php at line 131

setName

public void setName(string name)

Set the name.

Parameters:
name - The name.

core\services\plugins\ZMPlugin.php at line 185

setPluginDirectory

public void setPluginDirectory(string directory)

Set the plugin directory.

Parameters:
directory - The installation folder.

core\services\plugins\ZMPlugin.php at line 167

setVersion

public void setVersion(string version)

Set the version.

Parameters:
version - The version.

ZenMagick 0.9.11