[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
[Code source] [Imprimer] [Statistiques]
This file implements the PluginS class. This is where you can plug in some {@link Plugin plugins} :D
Author: | fplanque: Francois PLANQUE - {@link http://fplanque.net/} |
Author: | blueyed: Daniel HAHLER |
Copyright: | (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/} |
Version: | $Id: _plugins.class.php,v 1.2 2007/09/22 22:11:18 fplanque Exp $ |
Poids: | 2023 lignes (60 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 0 fichiers |
Plugins:: (37 méthodes):
Plugins()
get_plugin_groups()
get_Plugins_in_group()
get_Plugins_in_sub_group()
set_Plugin_status()
unregister()
forget_events()
init_settings()
instantiate_Settings()
restart()
stop_propagation()
trigger_event()
trigger_event_first_true()
trigger_event_first_false()
trigger_event_first_return()
get_trigger_event()
get_trigger_event_first_true()
get_trigger_event_first_return()
trigger_collect()
trigger_karma_collect()
call_method()
call_method_if_active()
call_by_code()
render()
quick()
load_plugins_table()
get_list_by_event()
get_list_by_events()
get_list_by_all_events()
get_enabled_events()
has_event()
are_events_available()
load_events()
get_object_from_cacheplugin_or_create()
count_regs()
set_apply_rendering()
validate_list()
Plugins() X-Ref |
Constructor. Sets {@link $plugins_path} and load events. |
get_plugin_groups() X-Ref |
Get a list of available Plugin groups. return: array |
get_Plugins_in_group( $group ) X-Ref |
Will return an array that contents are references to plugins that have the same group, regardless of the sub_group. return: array |
get_Plugins_in_sub_group( $group, $sub_group = '' ) X-Ref |
Will return an array that contents are references to plugins that have the same group and sub_group. return: array |
set_Plugin_status( & $Plugin, $status ) X-Ref |
Sets the status of a Plugin in DB and registers it into the internal indices when "enabled". Otherwise it gets unregistered, but only when we're not in {@link Plugins_admin}, because we want to keep it in then in our indices. {@internal Note: this should probably always get called on the {@link $Plugins} object, not {@link $admin_Plugins}. }} param: Plugin param: string New status ("enabled", "disabled", "needs_config", "broken") |
unregister( & $Plugin, $force = false ) X-Ref |
Pas de description |
forget_events( $plugin_ID ) X-Ref |
Forget the events a Plugin has registered. This gets used when {@link unregister() unregistering} a Plugin or if {@link Plugin::PluginInit()} returned false, which means "do not use it for subsequent events in the request". param: integer Plugin ID |
init_settings( & $Plugin ) X-Ref |
Init {@link Plugin::$Settings} and {@link Plugin::$UserSettings}, either by unsetting them for PHP5's overloading or instantiating them for PHP4. param: Plugin |
instantiate_Settings( & $Plugin, $set_type ) X-Ref |
Instantiate Settings object (class {@link PluginSettings}) for the given plugin. The plugin must provide setting definitions (through {@link Plugin::GetDefaultSettings()} OR {@link Plugin::GetDefaultUserSettings()}). param: Plugin param: string settings type: "Settings" or "UserSettings" return: boolean NULL, if no Settings |
restart() X-Ref |
Load plugins table and rewind iterator used by {@link get_next()}. |
stop_propagation() X-Ref |
Pas de description |
trigger_event( $event, $params = array() X-Ref |
Call all plugins for a given event. param: string event name, see {@link Plugins_admin::get_supported_events()} param: array Associative array of parameters for the Plugin return: boolean True, if at least one plugin has been called. |
trigger_event_first_true( $event, $params = NULL ) X-Ref |
Call all plugins for a given event, until the first one returns true. param: string event name, see {@link Plugins_admin::get_supported_events()} param: array Associative array of parameters for the Plugin return: array The (modified) params array with key "plugin_ID" set to the last called plugin; |
trigger_event_first_false( $event, $params = NULL ) X-Ref |
Call all plugins for a given event, until the first one returns false. param: string event name, see {@link Plugins_admin::get_supported_events()} param: array Associative array of parameters for the Plugin return: array The (modified) params array with key "plugin_ID" set to the last called plugin; |
trigger_event_first_return( $event, $params = NULL, $search = NULL ) X-Ref |
Call all plugins for a given event, until the first one returns a value (not NULL) (and $search is fulfilled, if given). param: string event name, see {@link Plugins_admin::get_supported_events()} param: array|NULL Associative array of parameters for the Plugin param: array|NULL If provided, the return value gets checks against this criteria. return: array The (modified) params array with key "plugin_ID" set to the last called plugin |
get_trigger_event( $event, $params = NULL, $get = 'data' ) X-Ref |
Trigger an event and return an index of params. This is handy to collect return values from all plugins hooking an event. param: string Event name, see {@link Plugins_admin::get_supported_events()} param: array Associative array of parameters for the Plugin param: string Index of $params that should get returned return: mixed The requested index of $params |
get_trigger_event_first_true( $event, $params = NULL, $get = 'data' ) X-Ref |
The same as {@link get_trigger_event()}, but stop when the first Plugin returns true. param: string Event name, see {@link Plugins_admin::get_supported_events()} param: array Associative array of parameters for the Plugin param: string Index of $params that should get returned return: mixed The requested index of $params |
get_trigger_event_first_return( $event, $params = NULL ) X-Ref |
Trigger an event and return the first return value of a plugin. param: string Event name, see {@link Plugins_admin::get_supported_events()} param: array Associative array of parameters for the Plugin return: mixed NULL if no Plugin returned something or the return value of the first Plugin |
trigger_collect( $event, $params = NULL, $ignore_empty = true ) X-Ref |
Trigger an event and return an array of all return values of the relevant plugins. param: string Event name, see {@link Plugins_admin::get_supported_events()} param: array Associative array of parameters for the Plugin param: boolean Ignore {@link empty() empty} return values? return: array List of return values, indexed by Plugin ID |
trigger_karma_collect( $event, $params ) X-Ref |
Trigger a karma collecting event in order to get Karma percentage. param: string Event param: array Params to the event return: integer|NULL Spam Karma (-100 - 100); "100" means "absolutely spam"; NULL if no plugin gave us a karma value |
call_method( $plugin_ID, $method, & $params ) X-Ref |
Call a method on a Plugin. This makes sure that the Timer for the Plugin gets resumed. param: integer Plugin ID param: string Method name. param: array Params (by reference). return: NULL|mixed Return value of the plugin's method call or NULL if no such method. |
call_method_if_active( $plugin_ID, $method, & $params ) X-Ref |
Call a method on a Plugin if it is not deactivated. This is a wrapper around {@link call_method()}. fp> why doesn't call_method always check if it's deactivated? param: integer Plugin ID param: string Method name. param: array Params (by reference). return: NULL|mixed Return value of the plugin's method call or NULL if no such method (or inactive). |
call_by_code( $code, $params = array() X-Ref |
Call a specific plugin by its code. This will call the SkinTag event handler. param: string plugin code param: array Associative array of parameters (gets passed to the plugin) return: boolean |
render( & $content, $renderers, $format, $params, $event_prefix = 'Render' ) X-Ref |
Render the content of an item by calling the relevant renderer plugins. param: string content to render (by reference) param: array renderer codes to use for opt-out, opt-in and lazy param: string Output format, see {@link format_to_output()}. Only 'htmlbody', param: array Additional params to the Render* methods (e.g. "Item" for items). return: string rendered content |
quick( $plugin_code, $params ) X-Ref |
Quick-render a string with a single plugin and format it for output. param: string Plugin code (must have render() method) param: array return: string Rendered string |
load_plugins_table() X-Ref |
Load Plugins data from T_plugins (only once), ordered by priority. This fills the needed indexes to lazy-instantiate a Plugin when requested. |
get_list_by_event( $event ) X-Ref |
Pas de description |
get_list_by_events( $events ) X-Ref |
Get a list of Plugins for a list of events. Every Plugin is only once in this list. param: array Array of events return: array plugin_ID => & Plugin |
get_list_by_all_events( $events ) X-Ref |
Get a list of plugins that provide all given events. return: array plugin_ID => & Plugin |
get_enabled_events( $plugin_ID ) X-Ref |
Get a list of (enabled) events for a given Plugin ID. param: integer Plugin ID return: array |
has_event( $plugin_ID, $event ) X-Ref |
Has a plugin a specific event registered/enabled? param: integer param: string return: boolean |
are_events_available( $events, $require_all_in_same_plugin = false ) X-Ref |
Check if the requested list of events is provided by any or one plugin. param: array|string A single event or a list thereof param: boolean Make sure there's at least one plugin that provides them all? return: boolean |
load_events() X-Ref |
(Re)load Plugin Events for enabled (normal use) or all (admin use) plugins. |
get_object_from_cacheplugin_or_create( $objectName, $eval_create_object = NULL ) X-Ref |
Load an object from a Cache plugin or create a new one if we have a cache miss or no caching plugins. It registers a shutdown function, that refreshes the data to the cache plugin which is not optimal, but we have no hook to see if data retrieved from a {@link DataObjectCache} derived class has changed. param: string object name param: string eval this to create the object. Default is to create an object return: boolean True, if retrieved from cache; false if not |
count_regs( $classname ) X-Ref |
Pas de description |
set_apply_rendering( $plugin_ID, $apply_rendering ) X-Ref |
Set the apply_rendering value for a given Plugin ID. It makes sure that the index is handled and writes it to DB. return: boolean true if set to new value, false in case of error or if already set to same value |
validate_list( $renderers = array('default') X-Ref |
Validate renderer list. param: array renderer codes ('default' will include all "opt-out"-ones) return: array validated array of renderer codes |
Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |