/functions/plugin.php

Description

plugin.php

This file provides the framework for a plugin architecture.

Documentation on how to write plugins might show up some time.

Functions
boolean_hook_function (line 180)

This function is used for hooks which are to return true or false. If $priority is > 0, any one or more trues will override any falses. If $priority < 0, then one or more falses will override any trues.

Priority 0 means majority rules. Ties will be broken with $tie

  • return: the result of the function
bool boolean_hook_function (mixed $name, [mixed $parm = NULL], [mixed $priority = 0], [mixed $tie = false])
check_plugin_version (line 308)

Check a plugin's version.

Returns TRUE if the given plugin is installed, activated and is at minimum version $a.$b.$c. If any one of those conditions fails, FALSE will be returned (careful of plugins that are sufficiently versioned but are not activated).

By overriding the default value of $force_inclusion, this function will attempt to grab versioning information from the given plugin even if it is not activated (plugin still has to be unpackaged and set in place in the plugins directory). Use with care - some plugins might break SquirrelMail when this is used.

Note that this function assumes plugin versioning is consistently applied in the same fashion that SquirrelMail versions are, with the exception that an applicable SquirrelMail version may be appended to the version number (which will be ignored herein). That is, plugin version number schemes are expected in the following format: 1.2.3, or 1.2.3-1.4.0.

Any characters after the third number are discarded, so formats such as the following will also work, although extra information about beta versions can possibly confuse the desired results of the version check: 1.2.3-beta4, 1.2.3.RC2, and so forth.

  • since: 1.5.2
bool check_plugin_version (mixed $plugin_name, [mixed $a = 0], [mixed $b = 0], [mixed $c = 0], [mixed $force_inclusion = FALSE])
concat_hook_function (line 142)

This function executes a hook, allows for parameters to be passed, and looks for an array returned from each plugin: each array is then merged into one and returned to the core hook location.

Note that unlike PHP's array_merge function, matching array keys will not overwrite each other, instead, values under such keys will be concatenated if they are both strings, or merged if they are arrays (in the same (non-overwrite) manner recursively).

Plugins returning non-arrays (strings, objects, etc) will have their output added to the end of the ultimate return array, unless ALL values returned are strings, in which case one string with all returned strings concatenated together is returned.

  • return: the merged return arrays or strings of each plugin on this hook
mixed concat_hook_function (mixed $name, [mixed $parm = NULL])
do_hook (line 36)

This function executes a hook.

mixed do_hook (string $name)
  • string $name: Name of hook to fire
do_hook_function (line 98)

This function executes a hook and allows for parameters to be passed.

  • return: the return value of the hook function
mixed do_hook_function (mixed $name, [mixed $parm = NULL])
filter_hook_function (line 69)

This function executes a hook and allows for parameters to be

passed, wherein each plugin can modify the parameters before they are passed to the next funciton. Whether or not the parameters are modified, plugins on this hook should always return the given parameters.

  • return: the possibly modified hook parameters
mixed filter_hook_function (mixed $name, [mixed $parm = NULL])
is_plugin_enabled (line 241)

Check if plugin is enabled

  • since: 1.5.1
boolean is_plugin_enabled (string $plugin_name)
  • string $plugin_name: plugin name
soupNazi (line 231)

This function checks whether the user's USER_AGENT is known to be broken. If so, returns true and the plugin is invisible to the offending browser.

*** THIS IS A TEST FOR JAVASCRIPT SUPPORT *** FIXME: This function needs to have its name changed!

  • return: whether this browser properly supports JavaScript
  • deprecated: use checkForJavascript() since 1.5.1
bool soupNazi ()
use_plugin (line 21)

This function adds a plugin.

void use_plugin (string $name)
  • string $name: Internal plugin name (ie. delete_move_next)

Documentation generated on Sat, 07 Oct 2006 16:13:04 +0300 by phpDocumentor 1.3.0RC6