ZenMagick 0.9.8


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

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
Version:
$Id: ZMPlugin.php 2755 2009-12-17 23:17:31Z dermanomann $

Field Summary
final str

LP_ALL

Load all files including subfolder.

final str

LP_FOLDER

Load files from the plugin folder, but ignore subfolder.

final str

LP_NONE

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

final str

LP_PLUGIN

Alias for LP_NONE.

Fields inherited from org.zenmagick.core.ZMObject
properties_
Constructor Summary

ZMPlugin()

Create new plugin with some defaults.

Method Summary
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
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Field Detail

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

LP_ALL

public final str LP_ALL = 'ALL'

Load all files including subfolder.


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

LP_FOLDER

public final str LP_FOLDER = 'FOLDER'

Load files from the plugin folder, but ignore subfolder.


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

LP_NONE

public final str LP_NONE = 'NONE'

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


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

LP_PLUGIN

public final str LP_PLUGIN = 'PLUGIN'

Alias for LP_NONE.


Constructor Detail

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

ZMPlugin

public ZMPlugin()

Create new plugin with some defaults.


Method Detail

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

getContext

public int getContext()

Get the context flags.

Returns:
The context flags.

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

getDescription

public string getDescription()

Get the description.

Returns:
The description.

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

getGroup

public string getGroup()

Get the group.

Returns:
The group.

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

getId

public string getId()

Get the id.

Returns:
A unique id.

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

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 145

getName

public string getName()

Get the name.

Returns:
The name.

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

getPluginDirectory

public string getPluginDirectory()

Get the plugin directory.

Returns:
The plugin directoryr.

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

getVersion

public string getVersion()

Get the version.

Returns:
The version.

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

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 217

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 278

setContext

public void setContext(int context)

Set the context flags.

Parameters:
context - The context flags.

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

setDescription

public void setDescription(string description)

Set the description.

Parameters:
description - The description.

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

setEnabled

public void setEnabled(boolean status)

Enable/disable this plugin.

Parameters:
status - The new status.

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

setGroup

public void setGroup(string group)

Set the group.

Parameters:
group - The group.

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

setId

public void setId(string id)

Set the id.

Parameters:
id - A unique id.

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

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 154

setName

public void setName(string name)

Set the name.

Parameters:
name - The name.

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

setPluginDirectory

public void setPluginDirectory(string directory)

Set the plugin directory.

Parameters:
directory - The installation folder.

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

setVersion

public void setVersion(string version)

Set the version.

Parameters:
version - The version.

ZenMagick 0.9.8