Class rcube_plugin_api

Description

The plugin loader and global API

Located in /rcube_plugin_api.php (line 27)


	
			
Variable Summary
 mixed $config
 mixed $dir
 mixed $handlers
 mixed $output
 mixed $url
Method Summary
 void add_content (string $html, string $container)
 void exec_action (string $action)
 array exec_hook (string $hook, [array $args = array()])
 void include_script (string $fn)
 void include_stylesheet (string $fn)
 void init ()
 boolean is_plugin_task (string $task)
 boolean is_processing ([string $hook = null])
 array loaded_plugins ()
 boolean load_plugin (string $plugin_name)
 void register_action (string $action, string $owner, mixed $callback, [string $task = null])
 void register_handler (string $name, string $owner, mixed $callback)
 void register_hook (string $hook, mixed $callback)
 void register_task (string $task, string $owner)
Variables
mixed $config (line 34)
  • access: public
mixed $dir (line 31)
  • access: public
mixed $handlers = array() (line 36)
  • access: public
mixed $output (line 33)
  • access: public
mixed $url = 'plugins/' (line 32)
  • access: public
Methods
static get_instance (line 81)

This implements the 'singleton' design pattern

  • return: The one and only instance if this class
rcube_plugin_api get_instance ()
add_content (line 418)

Save the given HTML content to be added to a template container

  • access: public
void add_content (string $html, string $container)
  • string $html: HTML content
  • string $container: Template container identifier
exec_action (line 293)

This method handles requests like _task=mail&_action=plugin.foo It executes the callback function that was registered with the given action.

  • access: public
void exec_action (string $action)
  • string $action: Action name
exec_hook (line 236)

Triggers a plugin hook.

This is called from the application and executes all registered handlers

  • return: The (probably) altered hook arguments
  • access: public
array exec_hook (string $hook, [array $args = array()])
  • string $hook: Hook name
  • array $args: Named arguments (key->value pairs)
include_script (line 389)

Include a plugin script file in the current HTML page

  • access: public
void include_script (string $fn)
  • string $fn: Path to script
include_stylesheet (line 403)

Include a plugin stylesheet in the current HTML page

  • access: public
void include_stylesheet (string $fn)
  • string $fn: Path to stylesheet
init (line 106)

Load and init all enabled plugins

This has to be done after rcmail::load_gui() or rcmail::json_init() was called because plugins need to have access to rcmail->output

  • access: public
void init ()
is_plugin_task (line 366)

Checks whether the given task is registered by a plugin

  • return: True if registered, otherwise false
  • access: public
boolean is_plugin_task (string $task)
  • string $task: Task name
is_processing (line 379)

Check if a plugin hook is currently processing.

Mainly used to prevent loops and recursion.

  • return: True if any/the given hook is currently processed, otherwise false
  • access: public
boolean is_processing ([string $hook = null])
  • string $hook: Hook to check (optional)
loaded_plugins (line 429)

Returns list of loaded plugins names

  • return: List of plugin names
  • access: public
array loaded_plugins ()
load_plugin (line 152)

Load the specified plugin

  • return: True on success, false if not loaded or failure
  • access: public
boolean load_plugin (string $plugin_name)
  • string $plugin_name: Plugin name
register_action (line 266)

Let a plugin register a handler for a specific request

  • access: public
void register_action (string $action, string $owner, mixed $callback, [string $task = null])
  • string $action: Action name (_task=mail&_action=plugin.foo)
  • string $owner: Plugin name that registers this action
  • mixed $callback: Callback: string with global function name or array($obj, 'methodname')
  • string $task: Task name registered by this plugin
register_handler (line 313)

Register a handler function for template objects

  • access: public
void register_handler (string $name, string $owner, mixed $callback)
  • string $name: Object name
  • string $owner: Plugin name that registers this action
  • mixed $callback: Callback: string with global function name or array($obj, 'methodname')
register_hook (line 210)

Allows a plugin object to register a callback for a certain hook

  • access: public
void register_hook (string $hook, mixed $callback)
  • string $hook: Hook name
  • mixed $callback: String with global function name or array($obj, 'methodname')
register_task (line 338)

Register this plugin to be responsible for a specific task

  • access: public
void register_task (string $task, string $owner)
  • string $task: Task name (only characters [a-z0-9_.-] are allowed)
  • string $owner: Plugin name that registers this action

Documentation generated on Tue, 04 Oct 2011 22:55:25 +0200 by phpDocumentor 1.4.3