ZenMagick 0.9.10


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

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.
group
The group this plugin belongs to.
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_ALL.
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_NONE

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

final static str

LP_PLUGIN

Alias for LP_NONE.

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

__construct()

Create new plugin with some defaults.

int

getContext()

Get the context flags.

string

getDescription()

Get the description.

string

getGroup()

Get the group.

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

setGroup(string group)

Set the group.

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, singleton

Constant Detail

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

LP_ALL

public final static str LP_ALL = 'ALL'

Load all files including subfolder.


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

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 59

LP_NONE

public final static str LP_NONE = 'NONE'

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


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

LP_PLUGIN

public final static str LP_PLUGIN = 'PLUGIN'

Alias for LP_NONE.


Method Detail

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

__construct

public void __construct()

Create new plugin with some defaults.


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

getContext

public int getContext()

Get the context flags.

Returns:
The context flags.

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

getDescription

public string getDescription()

Get the description.

Returns:
The description.

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

getGroup

public string getGroup()

Get the group.

Returns:
The group.

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

getId

public string getId()

Get the id.

Returns:
A unique id.

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

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_PLUGIN
Only the plugin class may be added; this is the default.
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 144

getName

public string getName()

Get the name.

Returns:
The name.

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

getPluginDirectory

public string getPluginDirectory()

Get the plugin directory.

Returns:
The plugin directoryr.

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

getVersion

public string getVersion()

Get the version.

Returns:
The version.

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

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 216

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 277

setContext

public void setContext(int context)

Set the context flags.

Parameters:
context - The context flags.

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

setDescription

public void setDescription(string description)

Set the description.

Parameters:
description - The description.

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

setEnabled

public void setEnabled(boolean status)

Enable/disable this plugin.

Parameters:
status - The new status.

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

setGroup

public void setGroup(string group)

Set the group.

Parameters:
group - The group.

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

setId

public void setId(string id)

Set the id.

Parameters:
id - A unique id.

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

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 153

setName

public void setName(string name)

Set the name.

Parameters:
name - The name.

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

setPluginDirectory

public void setPluginDirectory(string directory)

Set the plugin directory.

Parameters:
directory - The installation folder.

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

setVersion

public void setVersion(string version)

Set the version.

Parameters:
version - The version.

ZenMagick 0.9.10