Action plugins are designed to work with Dokuwiki events to allow for customisation/extension of any part of Dokuwiki that signals its activity using events!
Action plugins are loaded before any significant dokuwiki processing takes place. Immediately after loading, each plugin is called by its register() method to give it the opportunity to register any of its event handlers. When an event is signalled all event handlers registered for that event are called in turn (and in no particular order) and passed the event object by reference. The handler has the opportunity to take action based on the event data and to alter either the event data or the event's subsequent processing. For more details of how the events system works and lists of events refer to the events page.
Action plugins follow the same basic format and naming convention as the other Dokuwiki plugin types.
lib/pluginsaction.php, or if located in the sub-directory action within its plugin sub directory can be called anything.action_plugin_<plugin name> which extends the base class DokuWiki_Action_Plugin, found in lib/plugins/action.php. If the action plugin is a file in the action subfolder of the plugin folder then the class will need to be action_plugin_<plugin name>_<action plugin filename>. This filename is without the .php extension.DokuWiki_Plugin, found in lib/plugins/base.php, see Common Plugin Functions.getInfo() and register().required
function getInfo(){ return array( 'author' => '<plugin author name>', 'email' => '<plugin author contact email address>', 'date' => '<date applicable to this version of the plugin>', 'name' => '<the plugin\'s name', 'desc' => '<brief description of what the plugin does (multiline acceptable)', 'url' => '<plugin homepage: a url to find more information on the plugin>', ); }
required
/** * plugin should use this method to register its handlers with the dokuwiki's event controller * * @param $controller Dokuwiki's event controller object. Also available as global $EVENT_HANDLER * * @return not required */ function register(&$controller) { $controller->register_hook(<EVENT NAME>, <EVENT ADVISE>, $this, <event handler function>, <parameters to be passed to event handler>); }
optional have as many as necessary, can be given any name not already in use in this plugin or its ancestor classes
/** * custom event handler * * @param $param (mixed) the parameters passed to register_hook when this handler was registered * @param $event (object) event object by reference * * @return not required */ function <event_handler>(&$event, $param) { // custom script statements ... }