Class rcube_plugin_api

Description

The plugin loader and global API

Located in /lib/Roundcube/rcube_plugin_api.php (line 30)


	
			
Variable Summary
 static mixed $instance
 mixed $actionmap
 mixed $actions
 mixed $active_hook
 mixed $dir
 mixed $handlers
 mixed $objectsmap
 mixed $output
 mixed $plugins
 mixed $task
 mixed $tasks
 mixed $url
Method Summary
 rcube_plugin_api __construct ()
 void add_content (string $html, string $container)
 void exec_action (string $action)
 array exec_hook (string $hook, [array $args = array()])
 array get_info (string $plugin_name)
 void include_script (string $fn)
 void include_stylesheet (string $fn)
 void init (object rcube $app, [string $task = ''])
 boolean is_plugin_task (string $task)
 boolean is_processing ([string $hook = null])
 array loaded_plugins ()
 boolean load_plugin (string $plugin_name)
 void load_plugins (array $plugins_enabled, [array $required_plugins = array()])
 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)
 string resource_url (string $fn)
 array template_container_hook (array $attrib)
 void unregister_hook (string $hook, mixed $callback)
Variables
static mixed $instance (line 32)
  • access: protected
mixed $actionmap = array() (line 44)
  • access: protected
mixed $actions = array() (line 43)
  • access: protected
mixed $active_hook = false (line 47)
  • access: protected
mixed $allowed_prefs = array() (line 39)
  • access: public
mixed $deprecated_hooks = array(
'create_user' => 'user_create',
'kill_session' => 'session_destroy',
'upload_attachment' => 'attachment_upload',
'save_attachment' => 'attachment_save',
'get_attachment' => 'attachment_get',
'cleanup_attachments' => 'attachments_cleanup',
'display_attachment' => 'attachment_display',
'remove_attachment' => 'attachment_delete',
'outgoing_message_headers' => 'message_outgoing_headers',
'outgoing_message_body' => 'message_outgoing_body',
'address_sources' => 'addressbooks_list',
'get_address_book' => 'addressbook_get',
'create_contact' => 'contact_create',
'save_contact' => 'contact_update',
'contact_save' => 'contact_update',
'delete_contact' => 'contact_delete',
'manage_folders' => 'folders_list',
'list_mailboxes' => 'mailboxes_list',
'save_preferences' => 'preferences_save',
'user_preferences' => 'preferences_list',
'list_prefs_sections' => 'preferences_sections_list',
'list_identities' => 'identities_list',
'create_identity' => 'identity_create',
'delete_identity' => 'identity_delete',
'save_identity' => 'identity_update',
'identity_save' => 'identity_update',
// to be removed after 0.8
'imap_init' => 'storage_init',
'mailboxes_list' => 'storage_folders',
'imap_connect' => 'storage_connect',
)
(line 50)
  • access: protected
mixed $dir (line 34)
  • access: public
mixed $handlers = array() (line 38)
  • access: public
mixed $objectsmap = array() (line 45)
  • access: protected
mixed $output (line 37)
  • access: public
mixed $plugins = array() (line 41)
  • access: protected
mixed $task = '' (line 36)
  • access: public
mixed $tasks = array() (line 42)
  • access: protected
mixed $template_contents = array() (line 46)
  • access: protected
mixed $url = 'plugins/' (line 35)
  • access: public
Methods
static get_instance (line 88)

This implements the 'singleton' design pattern

  • return: The one and only instance if this class
rcube_plugin_api get_instance ()
Constructor __construct (line 100)

Private constructor

  • access: protected
rcube_plugin_api __construct ()
add_content (line 584)

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 451)

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 392)

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)
get_info (line 237)

Get information about a specific plugin.

This is either provided my a plugin's info() method or extracted from a package.xml or a composer.json file

  • return: Meta information about a plugin or False if plugin was not found
  • access: public
array get_info (string $plugin_name)
  • string $plugin_name: Plugin name
include_script (line 556)

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 570)

Include a plugin stylesheet in the current HTML page

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

Initialize plugin engine

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 (object rcube $app, [string $task = ''])
  • object rcube $app: Instance of the rcube base class
  • string $task: Current application task (used for conditional plugin loading)
is_plugin_task (line 533)

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 546)

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 594)

Returns list of loaded plugins names

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

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
load_plugins (line 135)

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 load_plugins (array $plugins_enabled, [array $required_plugins = array()])
  • array $plugins_enabled: List of configured plugins to load
  • array $required_plugins: List of plugins required by the application
register_action (line 424)

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 470)

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 350)

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 498)

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
resource_url (line 617)

Make the given file name link into the plugins directory

  • access: protected
string resource_url (string $fn)
  • string $fn: Filename
template_container_hook (line 605)

Callback for template_container hooks

  • access: protected
array template_container_hook (array $attrib)
  • array $attrib
unregister_hook (line 375)

Allow a plugin object to unregister a callback.

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

Documentation generated on Fri, 03 May 2013 12:45:04 +0200 by phpDocumentor 1.4.4