[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/plugins/model/ -> _plugins_admin.class.php (sommaire)

This file implements the {@link Plugins_admin} class, which gets used for administrative handling of the {@link Plugin Plugins}. This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}. See also {@link http://sourceforge.net/projects/evocms/}.

Author: blueyed: Daniel HAHLER
Copyright: (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}.
License: http://b2evolution.net/about/license.html GNU General Public License (GPL)
Version: $Id: _plugins_admin.class.php,v 1.3 2007/07/24 23:29:25 blueyed Exp $
Poids: 1663 lignes (54 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

Plugins_admin:: (21 méthodes):
  get_supported_events()
  unregister()
  count_regs()
  discover()
  get_apply_rendering_values()
  get_registered_events()
  uninstall()
  load_events()
  save_events()
  set_apply_rendering()
  set_code()
  set_event_status()
  set_priority()
  sort()
  sort_Plugin_priority()
  sort_Plugin_name()
  sort_Plugin_group()
  validate_dependencies()
  validate_renderer_list()
  filter_contents()
  unfilter_contents()


Classe: Plugins_admin  - X-Ref

A Plugins object that loads all Plugins, not just the enabled ones.
This is needed for the backoffice plugin management.

This extends the basic Plugins by adding all the functionnality needed for administering plugins
in addition to just using the already enabled plugins.

get_supported_events()   X-Ref
Get the list of all events/hooks supported by the plugin framework.

Also puts in additional events provided by plugins.
fp> please provide an example/use case

Additional to the returned event methods (which can be disabled), there are internal
ones which just get called on the plugin (and get not remembered in T_pluginevents), e.g.:
- AfterInstall
- BeforeEnable
- BeforeDisable
- BeforeInstall
- BeforeUninstall
- BeforeUninstallPayload
- DisplaySkin (called on a skin from {@link GetProvidedSkins()})
- ExecCronJob
- GetDefaultSettings
- GetDefaultUserSettings
- GetExtraEvents
- GetHtsrvMethods
- PluginInit
- PluginSettingsUpdateAction (Called as action before updating the plugin's settings)
- PluginSettingsEditAction (Called as action before editing the plugin's settings)
- PluginSettingsEditDisplayAfter (Called after standard plugin settings are displayed for editing)
- PluginSettingsValidateSet (Called before setting a plugin's setting in the backoffice)
- PluginUserSettingsUpdateAction (Called as action before updating the plugin's user settings)
- PluginUserSettingsEditDisplayAfter (Called after displaying normal user settings)
- PluginUserSettingsValidateSet (Called before setting a plugin's user setting in the backoffice)
- PluginVersionChanged (Called when we detect a version change)

The max length of event names is 40 chars (T_pluginevents.pevt_event).

return: array Name of event (key) => description (value)

unregister( & $Plugin, $force = false )   X-Ref
Un-register a plugin, only if forced.

This does not un-install it from DB, just from the internal indexes.

param: Plugin
param: boolean Force unregistering
return: boolean True, if unregistered

count_regs( $classname )   X-Ref
Count # of registrations of same plugin.

Plugins with negative ID (auto-generated; not installed (yet)) will not get considered.

param: string class name
return: int # of regs

discover()   X-Ref
Discover and register all available plugins in the {@link $plugins_path} folder/subfolders.


get_apply_rendering_values( $with_desc = false )   X-Ref
Get the list of all possible values for apply_rendering (defines when a rendering Plugin can apply).

param: boolean Return an associative array with description for the values?
return: array

get_registered_events( $Plugin )   X-Ref
Discover plugin events from its source file.

Get a list of methods that are supported as events out of the Plugin's
class definition.

return: array

uninstall( $plugin_ID )   X-Ref
Pas de description

load_events()   X-Ref
(Re)load Plugin Events for enabled (normal use) or all (admin use) plugins.

This is the same as {@link Plugins::load_events()} except that it loads all Plugins (not just enabled ones)

save_events( $Plugin, $enable_events = NULL, $disable_events = NULL )   X-Ref
Save the events that the plugin provides into DB, while removing obsolete
entries (that the plugin does not register anymore).

param: Plugin Plugin to save events for
param: array List of events to save as enabled for the Plugin.
param: array List of events to save as disabled for the Plugin.
return: boolean True, if events have changed, false if not.

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

set_code( $plugin_ID, $code )   X-Ref
Set the code for a given Plugin ID.

It makes sure that the index is handled and writes it to DB.

param: string Plugin ID
param: string Code to set the plugin to
return: boolean|integer|string

set_event_status( $plugin_ID, $plugin_event, $enabled )   X-Ref
Set the status of an event for a given Plugin.

return: boolean True, if status has changed; false if not

set_priority( $plugin_ID, $priority )   X-Ref
Set the priority for a given Plugin ID.

It makes sure that the index is handled and writes it to DB.

return: boolean|integer

sort( $order = 'priority' )   X-Ref
Sort the list of plugins.

WARNING: do NOT sort by anything else than priority unless you're handling a list of NOT-YET-INSTALLED plugins!

param: string Order: 'priority' (default), 'name'

sort_Plugin_priority( & $a_ID, & $b_ID )   X-Ref
Callback function to sort plugins by priority (and classname, if they have same priority).


sort_Plugin_name( & $a_ID, & $b_ID )   X-Ref
Callback function to sort plugins by name.

WARNING: do NOT sort by anything else than priority unless you're handling a list of NOT-YET-INSTALLED plugins

sort_Plugin_group( & $a_ID, & $b_ID )   X-Ref
Callback function to sort plugins by group, sub-group and name.

Those, which have a group get sorted above the ones without one.

WARNING: do NOT sort by anything else than priority unless you're handling a list of NOT-YET-INSTALLED plugins

validate_dependencies( & $Plugin, $mode )   X-Ref
Validate dependencies of a Plugin.

param: Plugin
param: string Mode of check: either 'enable' or 'disable'
return: array The key 'note' holds an array of notes (recommendations), the key 'error' holds a list

validate_renderer_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

filter_contents( & $title, & $content, $renderers )   X-Ref
Filter (post) contents by calling the relevant filter plugins.

Works very much like render() except that it's called at insert/update time and BEFORE validation.
Gives an opportunity to do some serious cleanup on what the user has typed.

This uses the lost of renderers, because filtering may need to work in conjunction with rendering,
e-g: code display: you want to filter out tags before validation and later you want to render color/fixed font.
For brute force filtering, use 'always' or 'stealth' modes.
param: string content to render (by reference)
param: array renderer codes to use for opt-out, opt-in and lazy
return: string rendered content

unfilter_contents( & $title, & $content, $renderers )   X-Ref
UnFilter (post) contents by calling the relevant filter plugins.

This is the opposite of filter_content. It is used to restore some specifcs before editing text.
For example, this can be used to replace complex sequences of tags with a custome meta-tag,
e-g: <strong> can become <s> for convenient editing.

This uses the list of renderers, because un/filtering may need to work in conjunction with rendering,
e-g: code display: you want to filter in/out tags before validation and later you want to render color/fixed font.
For brute force unfiltering, use 'always' or 'stealth' modes.
param: string title to render (by reference)
param: string content to render (by reference)
param: array renderer codes to use for opt-out, opt-in and lazy
return: string rendered content



Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics