rcube_plugin

Plugin interface class

package

Framework

subpackage

PluginAPI

Methods

Default constructor.

__construct(\rcube_plugin_api $api) 

Arguments

$api

\rcube_plugin_api

Plugin API

Initialization method, needs to be implemented by the plugin itself

init() 
abstract

Provide information about this

info() : array
static

Response

array

Meta information about a plugin or false if not implemented

Attempt to load the given plugin which is required for the current plugin

require_plugin($plugin_name) : boolean

Arguments

$plugin_name

Response

boolean

True on success, false on failure

Load local config file from plugins directory.

load_config(string $fname = 'config.inc.php') : boolean

The loaded values are patched over the global configuration.

Arguments

$fname

string

Config file name relative to the plugin's folder

Response

boolean

True on success, false on failure

Register a callback function for a specific (server-side) hook

add_hook(string $hook, mixed $callback) 

Arguments

$hook

string

Hook name

$callback

mixed

Callback function as string or array

                    with object reference and method name

Unregister a callback function for a specific (server-side) hook.

remove_hook(string $hook, mixed $callback) 

Arguments

$hook

string

Hook name

$callback

mixed

Callback function as string or array

                    with object reference and method name

Load localized texts from the plugins dir

add_texts(string $dir, mixed $add2client = false) 

Arguments

$dir

string

Directory to search in

$add2client

mixed

Make texts also available on the client

                      (array with list or true for all)

Wrapper for add_label() adding the plugin ID as domain

add_label() 

Wrapper for rcube::gettext() adding the plugin ID as domain

gettext(string $p) : string
see \rcube::gettext()

Arguments

$p

string

Message identifier

Response

string

Localized text

Register this plugin to be responsible for a specific task

register_task(string $task) 

Arguments

$task

string

Task name (only characters [a-z0-9_-] are allowed)

Register a handler for a specific client-request action

register_action(string $action, mixed $callback) 

The callback will be executed upon a request like /?_task=mail&_action=plugin.myaction

Arguments

$action

string

Action name (should be unique)

$callback

mixed

Callback function as string

                   or array with object reference and method name

Register a handler function for a template object

register_handler(string $name, mixed $callback) 

When parsing a template for display, tags like will be replaced by the return value if the registered callback function.

Arguments

$name

string

Object name (should be unique and start with 'plugin.')

$callback

mixed

Callback function as string or array with object reference

                    and method name

Make this javascipt file available on the client

include_script(string $fn) 

Arguments

$fn

string

File path; absolute or relative to the plugin directory

Make this stylesheet available on the client

include_stylesheet(string $fn) 

Arguments

$fn

string

File path; absolute or relative to the plugin directory

Append a button to a certain container

add_button(array $p, string $container) 
see \rcube_remplate::button()

Arguments

$p

array

Hash array with named parameters (as used in skin templates)

$container

string

Container name where the buttons should be added to

Generate an absolute URL to the given resource within the current plugin directory

url(string $fn) : string

Arguments

$fn

string

The file name

Response

string

Absolute URL to the given resource

Make the given file name link into the plugin directory

resource_url(string $fn) 

Arguments

$fn

string

Filename

Provide path to the currently selected skin folder within the plugin directory with a fallback to the default skin folder.

local_skin_path() : string

Response

string

Skin path relative to plugins directory

Callback function for array_map

label_map_callback(string $key) : string

Arguments

$key

string

Array key.

Response

string

Properties

Class name of the plugin instance

ID : string
var

Type(s)

string

Instance of Plugin API

api : \rcube_plugin_api
var

Type(s)

\rcube_plugin_api

Regular expression defining task(s) to bind with

task : string
var

Type(s)

string

Disables plugin in AJAX requests

noajax : boolean
var

Type(s)

boolean

Disables plugin in framed mode

noframe : boolean
var

Type(s)

boolean

A list of config option names that can be modified by the user via user interface (with save-prefs command)

allowed_prefs : array
var

Type(s)

array

home

home : 

urlbase

urlbase : 

mytask

mytask :