CWIS Developer Documentation

- Home
- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Attributes | List of all members
Plugin Class Reference

Base class for all plugins. More...

## Public Member Functions
| Register ()
| Set the plugin attributes. More...
| SetUpConfigOptions ()
| Set up plugin configuration options. More...
| Initialize ()
| Initialize the plugin. More...
| HookEvents ()
| Hook methods to be called when specific events occur. More...
| DeclareEvents ()
| Declare events defined by this plugin. More...
| Install ()
| Perform any work needed when the plugin is first installed (for example, creating database tables). More...
| Upgrade ($PreviousVersion)
| Perform any work needed when the plugin is upgraded to a new version (for example, adding fields to database tables). More...
| Uninstall ()
| Perform any work needed when the plugin is uninstalled. More...
| GetAttributes ()
| Retrieve plugin information. More...
| ConfigSetting ($SettingName, $NewValue=NULL)
| Get/set plugin configuration setting. More...

## Protected Attributes
| $Name = NULL
| Proper (human-readable) name of plugin. More...
| $Version = NULL
| Version number of plugin in the format X.X.X (for example: 1.2.12). More...
| $Description = NULL
| Text description of the plugin. More...
| $Author = NULL
| Name of the plugin's author. More...
| $Url = NULL
| Web address for more information about the plugin. More...
| $Email = NULL
| Contact email for the plugin's author. More...
| $Instructions = NULL
| Instructions for configuring the plugin (displayed on the automatically-generated configuration page if configuration values are supplied). More...
| $EnabledByDefault = FALSE
| Whether the plugin should be enabled by default when installed. More...
| $Requires = array()
| Array with plugin base (class) names for the index and minimum version numbers for the values. More...
| $CfgSetup = array()
| Associative array describing the configuration values for the plugin. More...
| $CfgPage = NULL
| Name of configuration page for plugin. More...

## Detailed Description

Base class for all plugins.

Definition at line 13 of file Plugin.php.

## Member Function Documentation

Plugin::ConfigSetting | ( |  | $SettingName,
|  |  | $NewValue = `NULL`
| ) |  |
| final

Get/set plugin configuration setting.

Parameters

  string | $SettingName | Name of configuration value.
  mixed | $NewValue | New setting value.

Returns
  Requested value, or NULL if value was not set or there was no configuration value with the specified name.

Definition at line 138 of file Plugin.php.

Plugin::DeclareEvents | ( |  | ) |

Declare events defined by this plugin.

This is used when a plugin defines new events that it signals or responds to. Names of these events should begin with the plugin base name, followed by "_EVENT_" and the event name in all caps (for example "MyPlugin_EVENT_MY_EVENT").

Returns
  Array with event names for the index and event types for the values.

Definition at line 71 of file Plugin.php.

Plugin::GetAttributes | ( |  | ) |
| final

Retrieve plugin information.

Returns
  Array of attribute values indexed by attribute names.

Definition at line 114 of file Plugin.php.

Plugin::HookEvents | ( |  | ) |

Hook methods to be called when specific events occur.

For events declared by other plugins the name string should start with the plugin base (class) name followed by "::" and then the event name.

Returns
  Array of method names to hook indexed by the event constants or names to hook them to.

Definition at line 59 of file Plugin.php.

Plugin::Initialize | ( |  | ) |

Initialize the plugin.

This is called (if the plugin is enabled) after all plugins have been loaded but before any methods for this plugin (other than Register()) have been called.

Returns
  NULL if initialization was successful, otherwise a string containing an error message indicating why initialization failed.

Definition at line 47 of file Plugin.php.

Plugin::Install | ( |  | ) |

Perform any work needed when the plugin is first installed (for example, creating database tables).

Returns
  NULL if installation succeeded, otherwise a string containing an error message indicating why installation failed.

Definition at line 82 of file Plugin.php.

Plugin::Register | ( |  | ) |
| abstract

Set the plugin attributes.

At minimum this method MUST set $this->Name and $this->Version. This is called when the plugin is loaded, and is normally the only method called for disabled plugins (except for SetUpConfigOptions(), which is called for pages within the plugin configuration interface).

Plugin::SetUpConfigOptions | ( |  | ) |

Set up plugin configuration options.

This is called if the plugin is enabled and/or when loading the plugin configuration interface. Config options must be set up using this method (rather than going into Register()) whenever their setup references data from outside of the plugin in any fashion.

Returns
  NULL if configuration setup succeeded, otherwise a string with an error message indicating why config setup failed.

Definition at line 35 of file Plugin.php.

Plugin::Uninstall | ( |  | ) |

Perform any work needed when the plugin is uninstalled.

Returns
  NULL if uninstall succeeded, otherwise a string containing an error message indicating why uninstall failed.

Definition at line 105 of file Plugin.php.

Plugin::Upgrade | ( |  | $PreviousVersion | ) |

Perform any work needed when the plugin is upgraded to a new version (for example, adding fields to database tables).

Parameters

  string | $PreviousVersion | The version number of this plugin that was previously installed.

Returns
  NULL if upgrade succeeded, otherwise a string containing an error message indicating why upgrade failed.

Definition at line 95 of file Plugin.php.

## Member Data Documentation

Plugin::$Author = NULL
| protected

Name of the plugin's author.

Definition at line 169 of file Plugin.php.

Plugin::$CfgPage = NULL
| protected

Name of configuration page for plugin.

Definition at line 202 of file Plugin.php.

Plugin::$CfgSetup = array()
| protected

Associative array describing the configuration values for the plugin.

The first index is the name of the configuration setting, and the second indicates the type of information about that setting. For more information please see Implementing CWIS Plugins.

Definition at line 197 of file Plugin.php.

Plugin::$Description = NULL
| protected

Text description of the plugin.

Definition at line 167 of file Plugin.php.

Plugin::$Email = NULL
| protected

Contact email for the plugin's author.

Definition at line 173 of file Plugin.php.

Plugin::$EnabledByDefault = FALSE
| protected

Whether the plugin should be enabled by default when installed.

Definition at line 179 of file Plugin.php.

Plugin::$Instructions = NULL
| protected

Instructions for configuring the plugin (displayed on the automatically-generated configuration page if configuration values are supplied).

Definition at line 177 of file Plugin.php.

Plugin::$Name = NULL
| protected

Proper (human-readable) name of plugin.

Definition at line 163 of file Plugin.php.

Plugin::$Requires = array()
| protected

Array with plugin base (class) names for the index and minimum version numbers for the values.

Special indexes of "PHP" may be used to specify a minimum required PHP version or "PHPX_xxx" to specify a required PHP extension, where "xxx" is the extension name (e.g. "PHPX_GD"). The version number value is ignored for PHP extensions.

Definition at line 188 of file Plugin.php.

Plugin::$Url = NULL
| protected

Web address for more information about the plugin.

Definition at line 171 of file Plugin.php.

Plugin::$Version = NULL
| protected

Version number of plugin in the format X.X.X (for example: 1.2.12).

Definition at line 165 of file Plugin.php.

The documentation for this class was generated from the following file:

- lib/ScoutLib/Plugin.php