[ Index ]
 

Code source de Serendipity 1.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/include/ -> plugin_api.inc.php (sommaire)

(pas de description)

Poids: 1566 lignes (57 kb)
Inclus ou requis: 5 fois
Référencé: 0 fois
Nécessite: 2 fichiers
 include/plugin_internal.inc.php
 include/functions.inc.php

Définit 4 classes

serendipity_plugin_api:: (24 méthodes):
  register_default_plugins()
  create_plugin_instance()
  remove_plugin_instance()
  remove_plugin_value()
  enum_plugin_classes()
  traverse_plugin_dir()
  get_installed_plugins()
  enum_plugins()
  count_plugins()
  includePlugin()
  getClassByInstanceID()
  probePlugin()
  load_plugin()
  getPluginInfo()
  setPluginInfo()
  update_plugin_placement()
  update_plugin_owner()
  generate_plugins()
  get_plugin_title()
  is_event_plugin()
  get_event_plugins()
  hook_event()
  exists()
  autodetect_instance()

serendipity_property_bag:: (3 méthodes):
  add()
  get()
  is_set()

serendipity_plugin:: (12 méthodes):
  serendipity_plugin()
  performConfig()
  install()
  uninstall()
  introspect()
  introspect_config_item()
  validate()
  generate_content()
  get_config()
  set_config()
  cleanup()
  register_dependencies()

serendipity_event:: (3 méthodes):
  serendipity_event()
  getFieldReference()
  event_hook()


Classe: serendipity_plugin_api  - X-Ref

register_default_plugins()   X-Ref
Register the default list of plugins for installation.

return: null

create_plugin_instance($plugin_class_id, $copy_from_instance = null, $default_placement = 'right', $authorid = '0', $pluginPath = '')   X-Ref
Create an instance of a plugin.

$plugin_class_id is of the form:
param: string  classname of the plugin to insert (see description above for details)
param: boolean (reserved) variable to indicate a copy of an existing instance
param: string  The type of the plugin to insert (event/left/right/hide/eventh)
param: int     The authorid of the plugin owner
param: string  The source path of the plugin file
return: string  ID of the new plugin

remove_plugin_instance($plugin_instance_id)   X-Ref
Removes a plugin by it's instance name

param: string  The name of the plugin id ("serendipity_plugin_xxx:1232132fsdf")
return: null

remove_plugin_value($plugin_instance_id, $where)   X-Ref
Removes an empty plugin configuration value

param: string  The name of the plugin id ("serendipity_plugin_xxx:1232132fsdf")
param: array   An array of configuration item names
return: null

enum_plugin_classes($event_only = false)   X-Ref
Retrieve a list of available plugin classes

This function searches through all directories and loaded internal files and tries
to detect the serendipity plugins.

param: boolean     If true, only event plugins will be searched. If false, sidebar plugins will be searched.
return:

traverse_plugin_dir($ppath, &$classes, $event_only, $maindir = '')   X-Ref
Traverse a specific directory and search if a serendipity plugin exists there.

param: string      The path to start from (usually '.')
param: array       A referenced array of currently found classes
param: boolean     If true, only event plugins will be searched. If false, only sidebar plugins will be searched.
param: string      The maindir where we started searching from [for recursive use]
return:

get_installed_plugins($filter = '*')   X-Ref
Returns a list of currently installed plugins

param: string  The filter for plugins (left|right|hide|event|eventh)
return: array   The list of plugins

enum_plugins($filter = '*', $negate = false, $classname = null, $id = null)   X-Ref
Searches for installed plugins based on specific conditions

param: string  The filter for plugins (left|right|hide|event|eventh)
param: boolean If true, the filtering logic will be reversed an all plugins that are NOT part of the filter will be returned
param: string  Filter by a specific classname (like 'serendipity_plugin_archives'). Can take SQL wildcards.
param: string  Filter by a specific plugin instance id
return: array   Returns the associative array of found plugins in the database

count_plugins($filter = '*', $negate = false)   X-Ref
Count the number of plugins to which the filter criteria matches

param: string  The filter for plugins (left|right|hide|event|eventh)
param: boolean If true, the filtering logic will be reversed an all plugins that are NOT part of the filter will be evaluated
return: int     Number of plugins that were found.

includePlugin($name, $pluginPath = '', $instance_id = '')   X-Ref
Detect the filename to use for a specific plugin

param: string  The name of the plugin ('serendipity_event_archive')
param: string  The path to the plugin file (if empty, the current path structure will be used.)
param: string  If an instance ID is passed this means, the plugin to be loaded is internally available
return: string  Returns the filename to include for a specific plugin

getClassByInstanceID($instance_id, &$is_internal)   X-Ref
Returns the plugin class name by a plugin instance ID

param: string      The ID of a plugin
param: boolean     If true, the plugin is a internal plugin (prefixed with '@')
return: string      The classname of the plugin

probePlugin($instance_id, &$class_name, &$pluginPath)   X-Ref
Auto-detect a plugin and see if the file information is given, and if not, detect it.

param: string      The ID of a plugin to load
param: string      A reference variable that will hold the class name of the plugin (do not pass manually)
param: string      A reference variable that will hold the path to the plugin (do not pass manually)
return: string      Returns the filename of a plugin to load

load_plugin($instance_id, $authorid = null, $pluginPath = '', $pluginFile = null)   X-Ref
Instantiates a plugin class

param: string      The ID of the plugin to load
param: int         The owner of the plugin (can be autodetected)
param: string      The path to a plugin (can be autodetected)
param: string      The filename of a plugin (can be autodetected)
return:

getPluginInfo(&$pluginFile, &$class_data, $type)   X-Ref
Gets cached properties/information about a specific plugin, auto-loads a cache of all plugins

param: string      The filename of the plugin to get information about
param: array       A referenced array that holds information about the plugin instance (self::load_plugin() response)
param: type        The type of the plugin (local|spartacus|...)
return: array       Information about the plugin

setPluginInfo(&$plugin, &$pluginFile, &$bag, &$class_data, $pluginlocation = 'local')   X-Ref
Set cache information about a plugin

param: mixed       Either an plugin object or a plugin information array that holds the information about the plugin
param: string      The filename of the plugin
param: object      The property bag object bundled with the plugin
param: array       Previous/additional information about the plugin
param: string      The location/type of a plugin (local|spartacus)
return:

update_plugin_placement($name, $placement, $order=null)   X-Ref
Moves a sidebar plugin to a different side or up/down

param: string  The instance ID of a plugin
param: string  The new placement of a plugin (left|right|hide|event|eventh)
param: string  A new sort order for the plugin
return:

update_plugin_owner($name, $authorid)   X-Ref
Updates the ownership information about a plugin

param: string  The instance ID of the plugin
param: int     The ID of the new author owner of the plugin
return:

generate_plugins($side, $tag = '', $negate = false, $class = null, $id = null)   X-Ref
Get a list of Sidebar plugins and pass them to Smarty

param: string      The side of plugins to show (left/right/hide/event/eventh)
param: string      deprecated: Indicated which wrapping HTML element to use for plugins
param: boolean     Indicates whether only all plugins should be shown that are not in the $side list
param: string      Only show plugins of this plugin class
param: string      Only show a plugin with this instance ID
return: string      Smarty HTML output

get_plugin_title(&$plugin, $default_title = '')   X-Ref
Gets the title of a plugin to be shown in plugin overview

param: object      The plugin object
param: string      The default title, if none was configured
return: string      The title of the plugin

is_event_plugin($name)   X-Ref
Check if a plugin is an event plugin

Refactoring: decompose conditional

param: string  Name of a plugin
return: boolean

get_event_plugins($getInstance = false, $refresh = false)   X-Ref
Prepares a cache of all event plugins and load them in queue so that they can be fetched

param: mixed    If set to a string, a certain event plugin cache object will be returned by this function
param: boolean  If set to true, the list of cached event plugins will be refreshed
return: mixed    Either returns the whole list of event plugins, or only a specific instance

hook_event($event_name, &$eventData, $addData = null)   X-Ref
Executes a specific Eventhook

If you want to temporarily block any event plugins, you can set $serendipity['no_events'] before
this method call.

param: string      The name of the event to hook on to
param: mixed       May contain any type of variables that are passed by reference to an event plugin
param: mixed       May contain any type of variables that are passed to an event plugin
return: true

exists($instance_id)   X-Ref
Checks if a specific plugin instance is already installed

param: string      A name (may contain wildcards) of a plugin class to check
return: boolean     True if a plugin was found

autodetect_instance($plugin_name, $authorid, $is_event_plugin = false)   X-Ref
Install a new plugin by ensuring that it does not already exist

param: string      The classname of the plugin
param: int         The new owner author
param: boolean     Indicates if the plugin is an event plugin
return: object      Returns the plugin object or false, if failure

Classe: serendipity_property_bag  - X-Ref

add($name, $value)   X-Ref
Adds a property value to the bag

param: string  The name of the property
param: mixed   The value of a property
return: null

get($name)   X-Ref
Returns a property value of a bag

param: string  Name of property to fetch
return: mixed   The value of the property

is_set($name)   X-Ref
Check if a specific property name is already set

param: string  Name of the property to check
return: boolean True, if already set.

Classe: serendipity_plugin  - X-Ref

serendipity_plugin($instance)   X-Ref
The constructor of a plugin

Needs to be implemented by your own class.
Be sure to call this method from your derived classes constructors,
otherwise your config data will not be stored or retrieved correctly

return: true

performConfig(&$bag)   X-Ref
Perform configuration routines

Called by Serendipity when the plugin is being configured.
Can be used to query the database for configuration values that
only need to be available for the global configuration and not
on each page request.

return: true

install()   X-Ref
Perform install routines

Called by Serendipity when the plugin is first installed.
Can be used to install database tables etc.

return: true

uninstall(&$propbag)   X-Ref
Perform uninstall routines

Called by Serendipity when the plugin is removed/uninstalled.
Can be used to drop installed database tables etc.

param: object   A property bag object
return: true

introspect(&$propbag)   X-Ref
The introspection function of a plugin, to setup properties

Called by serendipity when it wants to display information
about your plugin.
You need to override this method in your child class.

param: object  A property bag object you can manipulate
return: true

introspect_config_item($name, &$propbag)   X-Ref
Introspection of a plugin configuration item

Called by serendipity when it wants to display the configuration
editor for your plugin.
$name is the name of a configuration item you added in
your instrospect method.
You need to fill the property bag with appropriate items
that describe the type and value(s) for that particular
configuration option.
You need to override this method in your child class if
you have configuration options.

param: string      Name of the config item
param: object      A property bag object you can store the configuration in
return:

validate($config_item, &$cbag, &$value)   X-Ref
Validate plugin configuration options.

Called from Plugin Configuration manager. Can be extended by your own plugin, if you need.

param: string      Name of the config item to validate
param: object      Property bag of the config item
param: value       The value of a config item
return:

generate_content(&$title)   X-Ref
Output plugin's contents (Sidebar plugins)

Called by serendipity when it wants your plugin to display itself.
You need to set $title to be whatever text you want want to
appear in the item caption space.
Simply echo/print your content to the output; serendipity will
capture it and make things work.
You need to override this method in your child class.

param: string       The referenced varaiable that holds the sidebar title of your plugin.
return: null

get_config($name, $defaultvalue = null, $empty = true)   X-Ref
Get a config value of the plugin

param: string  Name of the config value to fetch
param: mixed   The default value of a configuration item, if not set
param: boolean If true, the default value will only be set if the plugin config item was not set.
return: mixed   The value of the config item

set_config($name, $value, $implodekey = '^')   X-Ref
Sets a configuration value for a plugin

param: string  Name of the plugin configuration item
param: string  Value of the plugin configuration item
param: string  A concatenation key for imploding arrays
return:

cleanup()   X-Ref
Garbage Collection

Called by serendipity after insertion of a config item. If you want to kick out certain
elements based on contents, create the corresponding function here.

return: true

register_dependencies($remove = false, $authorid = '0')   X-Ref
Auto-Register dependencies of a plugin

This method evaluates the "dependencies" member variable to check which plugins need to be installed.

param: boolean     If true, a depending plugin will be removed when this plugin is uninstalled
param: int         The owner id of the current plugin
return: true

Classe: serendipity_event  - X-Ref

serendipity_event($instance)   X-Ref
The class constructor

Be sure to call this method from your derived classes constructors,
otherwise your config data will not be stored or retrieved correctly

param: string      The instance name
return:

getFieldReference($fieldname = 'body', &$eventData)   X-Ref
Gets a reference to an $entry / $eventData array pointer, interacting with Cache-Options

This function is used by specific event plugins that require to properly get a reference
to the 'extended' or 'body' field of an entry superarray. If they would immediately operate
on the 'body' field, it might get overwritten by other plugins later on.

param: string      The fieldname to get a reference for
param: array       The entry superarray to get the reference from
return: array       The value of the array for the fieldname (reference)

event_hook($event, &$bag, &$eventData, $addData = null)   X-Ref
Main logic for making a plugin "listen" to an event

This method is called by the main plugin API for every event, that is executed.
You need to implement each actions that shall be performed by your plugin here.

param: string      The name of the executed event
param: object      A property bag for the current plugin
param: mixed       Any referenced event data from the serendipity_plugin_api::hook_event() function
param: mixed       Any additional data from the hook_event call
return: true



Généré le : Sat Nov 24 09:00:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics