b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (CVS HEAD) [ class tree: plugins ] [ index: plugins ] [ all elements ]

Source for file _plugin.class.php

Documentation is available at _plugin.class.php

  1. <?php
  2. /**
  3.  * This file implements the abstract {@link Plugin} class.
  4.  *
  5.  * This file is part of the evoCore framework - {@link http://evocore.net/}
  6.  * See also {@link http://sourceforge.net/projects/evocms/}.
  7.  *
  8.  * @copyright (c)2003-2010 by Francois PLANQUE - {@link http://fplanque.net/}
  9.  *  Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.
  10.  *
  11.  *  {@internal License choice
  12.  *  - If you have received this file as part of a package, please find the license.txt file in
  13.  *    the same folder or the closest folder above for complete license terms.
  14.  *  - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
  15.  *    then you must choose one of the following licenses before using the file:
  16.  *    - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  17.  *    - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  18.  *  }}}
  19.  *
  20.  *  {@internal Open Source relicensing agreement:
  21.  *  Daniel HAHLER grants Francois PLANQUE the right to license
  22.  *  Daniel HAHLER's contributions to this file and the b2evolution project
  23.  *  under any OSI approved OSS license (http://www.opensource.org/licenses/).
  24.  *  }}}
  25.  *
  26.  * @package plugins
  27.  *
  28.  * @todo Add links to pages on manual.b2evolution.net, once they are "clean"/tiny
  29.  *
  30.  *  {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  31.  * @author fplanque: Francois PLANQUE - {@link http://fplanque.net/}
  32.  * @author blueyed: Daniel HAHLER
  33.  *
  34.  * @version $Id: _plugin.class.php,v 1.35 2010/02/23 05:07:17 sam2kb Exp $
  35.  */
  36. if!defined('EVO_MAIN_INIT') ) die'Please, do not access this page directly.' );
  37.  
  38.  
  39. /**
  40.  * Plugin Class
  41.  *
  42.  * Real plugins should be derived from this class.
  43.  *
  44.  * @abstract
  45.  * @package plugins
  46.  */
  47. class Plugin
  48. {
  49.     /**#@+
  50.      * Variables below MUST be overriden by plugin implementations,
  51.      * either in the subclass declaration or in the subclass constructor.
  52.      */
  53.  
  54.     /**
  55.      * Default plugin name as it will appear in lists.
  56.      *
  57.      * To make it available for translations set it in the constructor by
  58.      * using the {@link Plugin::T_()} function.
  59.      *
  60.      * This should be no longer than 50 characters.
  61.      *
  62.      * @var string 
  63.      */
  64.     var $name = '';
  65.  
  66.     /**
  67.      * Globally unique code for this plugin functionality. 32 chars. MUST BE SET.
  68.      *
  69.      * A common code MIGHT be shared between different plugins providing the same functionnality.
  70.      * This allows to replace a given renderer with another one and keep the associations with posts.
  71.      * Example: replacing a GIF smiley renderer with an SWF smiley renderer...
  72.      *
  73.      * @var string 
  74.      */
  75.     var $code = '';
  76.  
  77.     /**
  78.      * Default priority.
  79.      *
  80.      * Priority determines in which order the plugins get called.
  81.      * Range: 1 to 100 (the lower the number, the earlier it gets called)
  82.      *
  83.      * @var int 
  84.      */
  85.     var $priority = 50;
  86.  
  87.     /**
  88.      * Plugin version number (max 42 chars, so obscure CVS Revision keywords get handled).
  89.      *
  90.      * This must be compatible to PHP's {@link version_compare()},
  91.      * e.g. '1', '2', '1.1', '2.1b' and '10-1-1a' are fine.
  92.      *
  93.      * This can be used by other plugins when requiring your plugin
  94.      * through {@link Plugin::GetDependencies()}.
  95.      *
  96.      * By increasing it you can request a call of {@link GetDbLayout()} upon instantiating.
  97.      * If there are DB layout changes to be made, the plugin gets changed to status "needs_config".
  98.      *
  99.      * @var string 
  100.      */
  101.     var $version = '0';
  102.  
  103.     /**
  104.      * Plugin author.
  105.      *
  106.      * This is for user info only.
  107.      *
  108.      * @var string 
  109.      */
  110.     var $author = 'Unknown author';
  111.  
  112.     /**
  113.      * URL for more info about the plugin, author and new versions.
  114.      *
  115.      * This is for user info only.
  116.      *
  117.      * If empty, it defaults to 'http://manual.b2evolution.net/[plugin_classname]',
  118.      * where '[plugin_classname]' is the plugin's PHP class name (with first char uppercased).
  119.      *
  120.      * @var string 
  121.      */
  122.     var $help_url = '';
  123.  
  124.     /**
  125.      * Plugin short description.
  126.      *
  127.      * This should be no longer than a line and is limited to 255 chars.
  128.      *
  129.      * @var string 
  130.      */
  131.     var $short_desc;
  132.  
  133.     /**#@-*/
  134.  
  135.  
  136.     /**#@+
  137.      * Variables below MAY be overriden.
  138.      */
  139.  
  140.     /**
  141.      * Plugin long description.
  142.      *
  143.      * This should be no longer than a line.
  144.      *
  145.      * @var string 
  146.      */
  147.     var $long_desc;
  148.  
  149.  
  150.     /**
  151.      * If this is a rendering plugin, when should rendering apply?
  152.      *
  153.      * This is the default value for the plugin and can be overriden in the Plugins
  154.      * administration for plugins that provide rendering events.
  155.      *
  156.      * {@internal The actual value for the plugin gets stored in T_plugins.plug_apply_rendering.}}
  157.      *
  158.      * Possible values:
  159.      * - 'stealth': gets always used, but not displayed as option
  160.      * - 'always': gets always used, and displayed as disabled checkbox
  161.      * - 'opt-out': enabled by default
  162.      * - 'opt-in': disabled by default
  163.      * - 'lazy': checkbox gets displayed, but is disabled
  164.      * - 'never': cannot get used as a renderer
  165.      *
  166.      * @todo blueyed>> IMHO we would need another value, which is the same as "lazy", but does not display a checkbox, which is useful for Plugins that add themselves as renderers on Item update
  167.      *
  168.      * @var string 
  169.      */
  170.     var $apply_rendering = 'never'// By default, this may not be a rendering plugin
  171.  
  172.  
  173.     /**
  174.      * Number of allowed installs.
  175.      *
  176.      * When installing the plugin it gets checked if the plugin is already installed this
  177.      * many times. If so, the installation gets aborted.
  178.      */
  179.     var $number_of_installs;
  180.  
  181.  
  182.     /**
  183.      * Main group of the plugin.
  184.      *
  185.      * @var string 
  186.      */
  187.     var $group;
  188.  
  189.  
  190.     /**
  191.      * Sub-Group of the plugin.
  192.      *
  193.      * @var string 
  194.      */
  195.     var $sub_group;
  196.  
  197.  
  198.     /**
  199.      * Name of the ping service (if this is a ping plugin, see {@link Plugin::ItemSendPing()})
  200.      * @var string 
  201.      */
  202.     var $ping_service_name;
  203.  
  204.     /**
  205.      * Note about the ping service, used in the list of ping services in the blog settings
  206.      * (if this is a ping plugin, see {@link Plugin::ItemSendPing()})
  207.      * @var string 
  208.      */
  209.     var $ping_service_note;
  210.  
  211.     /**#@-*/
  212.  
  213.  
  214.     /**#@+
  215.      * Variables below MUST NOT be overriden or changed by you!
  216.      * @access private
  217.      */
  218.  
  219.     /**
  220.      * Name of the current class. (AUTOMATIC)
  221.      *
  222.      * Will be set automatically (from filename) when registering plugin.
  223.      *
  224.      * @var string 
  225.      */
  226.     var $classname;
  227.  
  228.     /**
  229.      * Internal (DB) ID. (AUTOMATIC)
  230.      *
  231.      * ID < 1 means 'NOT installed'
  232.      *
  233.      * @var int 
  234.      */
  235.     var $ID 0;
  236.  
  237.  
  238.     /**
  239.      * If the plugin provides settings, this will become the object to access them.
  240.      *
  241.      * This gets instantianted on Plugin registration for PHP4 and through
  242.      * overloading in PHP5+, which means on first access.
  243.      *
  244.      * @see GetDefaultSettings()
  245.      * @var PluginSettings 
  246.      */
  247.     var $Settings;
  248.  
  249.  
  250.     /**
  251.      * If the plugin provides user settings, this will become the object to access them.
  252.      *
  253.      * This gets instantianted on Plugin registration for PHP4 and through
  254.      * overloading in PHP5+, which means on first access.
  255.      *
  256.      * NOTE: its methods use {@link $current_User::$ID} by default, but you may call it
  257.      *       if there's no {@link $current_User} instantiated (yet).
  258.      *
  259.      * @see GetDefaultUserSettings()
  260.      * @var PluginUserSettings 
  261.      */
  262.     var $UserSettings;
  263.  
  264.  
  265.     /**
  266.      * The status of the plugin.
  267.      *
  268.      * Use {@link set_status()} to change it, if you need to.
  269.      * Either 'enabled', 'disabled', 'needs_config' or 'broken'.
  270.      *
  271.      * @var string 
  272.      */
  273.     var $status;
  274.  
  275.     /**
  276.      * The "mother" object, where this Plugin got instantiated from.
  277.      *
  278.      * @deprecated since 2.0
  279.      * @var Plugins|Plugins_admin
  280.      */
  281.     var $Plugins;
  282.  
  283.     /**
  284.      * The translations keyed by locale. They get loaded through include() of _global.php.
  285.      * @see Plugin::T_()
  286.      * @var array 
  287.      */
  288.     var $_trans array();
  289.  
  290.     /**
  291.      * Has the global /locales/_global.php file (where translation for
  292.      * all languages can be put into) been loaded?
  293.      *
  294.      * @var boolean 
  295.      */
  296.     var $_trans_loaded_global false;
  297.  
  298.     /**#@-*/
  299.  
  300.  
  301.     /**
  302.      * Constructor.
  303.      *
  304.      * You should not use a constructor with your plugin, but the
  305.      * {@link Plugin::PluginInit()} method instead!
  306.      */
  307.     function Plugin()
  308.     {
  309.     }
  310.  
  311.  
  312.     /**
  313.      * Init the Plugin after it has been registered/instantiated.
  314.      *
  315.      * Should set name and description in a localizable fashion.
  316.      *
  317.      * This gets called on every instantiated plugin, also if it's just for
  318.      * discovering the list of available plugins in the backoffice.
  319.      *
  320.      * Use this to validate Settings/requirements and/or cache them into class properties.
  321.      *
  322.      * @param array Associative array of parameters.
  323.      *               'is_installed': true, if the plugin is installed; false if not (probably it got discovered then)
  324.      *               'db_row': an array with the columns of the plugin DB entry (in T_plugins).
  325.      *                         This is empty, if the plugin is not installed!
  326.      *                         E.g., 'plug_version' might be interesting to compare again "$this->version".
  327.      * @return boolean If this method returns false, the Plugin gets unregistered (for the current request only).
  328.      */
  329.     function PluginInit$params )
  330.     {
  331.         // NOTE: the code below is just to handle stuff that has been deprecated since
  332.         //       b2evolution 1.9. You don't have to include this, if you override this method.
  333.  
  334.         ifis_null($this->short_desc) )
  335.         // may have been set in plugin's constructor (which is deprecated since 1.9)
  336.             $this->short_desc = T_('No desc available');
  337.         }
  338.         ifis_null($this->long_desc) )
  339.         // may have been set in plugin's constructor (which is deprecated since 1.9)
  340.             $this->long_desc = T_('No description available');
  341.         }
  342.  
  343.         ifmethod_exists$this'AppendPluginRegister' && $params['is_installed')
  344.         // Wrapper for deprecated AppendPluginRegister method (deprecated since 1.9)
  345.             $this->debug_log('Plugin has deprecated AppendPluginRegister method. Use PluginInit instead.'array('deprecated'));
  346.  
  347.             return $this->AppendPluginRegister($params);
  348.         }
  349.  
  350.         return true;
  351.     }
  352.  
  353.  
  354.     // Plugin information (settings, DB layout, ..): {{{
  355.  
  356.     /**
  357.      * Define default settings here.
  358.      * Those can then be edited in the backoffice.
  359.      *
  360.      * You can access them in the plugin through the member object
  361.      * {@link Plugin::$Settings}, e.g.:
  362.      * <code>$this->Settings->get( 'my_param' );</code>
  363.      *
  364.      * fp> this is unclear: You probably don't need to set or change values (other than the
  365.      * defaultvalues), but if you know what you're doing, see
  366.      * {@link PluginSettings}, where {@link Plugin::$Settings} gets derived from.
  367.      *
  368.      * NOTE: this method gets called by b2evo when instantiating the plugin
  369.      *       settings and when the settings get displayed for editing in the backoffice.
  370.      *       In the second case, $params['for_editing'] will be true.
  371.      *
  372.      * @todo 3.0 fp> 1) This is not an event: RENAME to lowercase (in b2evo 3.0)
  373.      *            dh> Not only events are CamelCase, but "interactions" with the Plugins(_admin) class, too!
  374.      *                Maybe it should get prefixed with "Plugin"?!
  375.      *                The intention is: all interfacing methods are camel-cased. That makes a lot of sense,
  376.      *                given the provided helpers (get_plugin_url etc).
  377.      *                This applies to the other todos below, too.
  378.      * @todo 3.0 fp> 2) This defines more than Default values ::  confusing name
  379.      * @todo name tentative get_general_param_definitions()
  380.      *
  381.      * @param array Associative array of parameters (since 1.9).
  382.      *     'for_editing': true, if the settings get queried for editing;
  383.      *                    false, if they get queried for instantiating {@link Plugin::$Settings}.
  384.      * @return array 
  385.      *  The array to be returned should define the names of the settings as keys (max length is 30 chars)
  386.      *  and assign an array with the following keys to them (only 'label' is required):
  387.      *
  388.      *  'label': Name/Title of the param, gets displayed as label for the input field, or
  389.      *               as "legend" tag with types "array" and "fieldset".
  390.      *  'defaultvalue': Default value for the setting, defaults to '' (empty string)
  391.      *  'type', which can be:
  392.      *      'text' (default): a simple string
  393.      *      'password': like text, but hidden during input
  394.      *      'html_input' : like text, but allows html
  395.      *      'checkbox': either 0 or 1
  396.      *      'integer': a number (no float, can have leading "+" or "-") (like 'text' for input, but gets validated when submitting)
  397.      *      'float': a floating number (can have leading "+" or "-", e.g. "+1", "-0.05") (like 'text' for input, but gets validated when submitting)
  398.      *      'textarea': several lines of input. The following can be set for this type:
  399.      *          'rows': number of rows
  400.      *          'cols': number of columns
  401.      *      'html_textarea': like textarea, but allows html
  402.      *      'select': a drop down field; you must set 'options' for it:
  403.      *          'options': an array of options ('value' => 'description'), see {@link Form::select_input_array()}.
  404.      *      'select_blog': a drop down field, providing all existing blogs (Blog ID is the value or "" if "allow_none" is true) (WARNING: does not scale - not recommended)
  405.      *      'select_group': a drop down field, providing all existing groups (Group ID is the value or "" if "allow_none" is true)
  406.      *      'select_user': a drop down field, providing all existing groups (User ID is the value or "" if "allow_none" is true) (WARNING: does not scale - not recommended)
  407.      *      'array': a subset of settings. The value gets automagically (un)serialized through get() and set().
  408.      *          The following keys apply to this type:
  409.      *         'entries': an array with meta information about sub-settings
  410.      *              (which can be everything from the top-level, except: "valid_pattern", "valid_range").
  411.      *              Note: currently there's no type forcing or checking
  412.      *                  for sub-entries involved (e.g., if you have an entry of type "integer", you could get
  413.      *                  a non-numeric string there).
  414.      *          fp> TODO: !!!! very unsafe
  415.      *         'key': defines the key to use for each entry. This may be a text input for example
  416.      *               (with label, note etc). (optional, default is numeric keys, which are not editable)
  417.      *        'max_count': maximum count of sets (optional, default is no restriction)
  418.      *        'min_count': minimum count of sets (optional, default is no restriction)
  419.      *  'note' (gets displayed as a note to the param field),
  420.      *  'size': Size of the HTML input field (applies to types 'text', 'password' and 'integer'; defaults to 15)
  421.      *  'maxlength': maxlength attribute for the input field (See 'size' above; defaults to no limit)
  422.      *  'disabled': if true, it adds a 'disabled="disabled"' html attribute to the element and the value cannot be changed
  423.      *  'no_edit': if true, the setting is not editable. This is useful for internal settings.
  424.      *  'allow_none': set this to true to have "None" in the options list for types 'select_group' and 'select_user'.
  425.      *  'valid_pattern': A regular expression pattern that the value must match.
  426.      *                       This is either just a regexp pattern as string or an array
  427.      *                       with the keys 'pattern' and 'error' to define a custom error message.
  428.      *  'valid_range': An array with keys 'min', 'max' and (optionally) 'error' to define
  429.      *                     a custom error message. At least "min" or "max" must be given.
  430.      *  'help': can be:
  431.      *           '#anchor': anchor that gets appended to {@link $help_url}
  432.      *           true: the settings name/key gets transformed to an html ID and gets used as anchor to {@link $help_url}.
  433.      *           'http://example.com/uri': a full URL (starting with http:// or https://)
  434.      *  'layout': Use this to visually group your settings.
  435.      *                Either 'begin_fieldset', 'end_fieldset' or 'separator'. You can use 'label' for 'begin_fieldset'.
  436.      *  'multiple': This allows to select multiple values in a SELECT (including select_*) (boolean)
  437.      *  'id', 'onchange', 'onclick', 'onfocus', 'onkeyup', 'onkeydown', 'onreset', 'onselect', 'cols', 'rows', 'maxlength':
  438.      *        get passed through as attributes to the form/input element.
  439.      *
  440.      *  e.g.:
  441.      *  <code>
  442.      *  return array(
  443.      *    'my_param' => array(
  444.      *      'label' => $this->T_('My Param'),
  445.      *      'defaultvalue' => '10',
  446.      *      'note' => $this->T_('Quite cool, eh?'),
  447.      *      'valid_pattern' => array( 'pattern' => '[1-9]\d+', $this->T_('The value must be >= 10.') ),
  448.      *    ),
  449.      *    'another_param' => array( // this one has no 'note'
  450.      *      'label' => $this->T_('My checkbox'),
  451.      *      'defaultvalue' => '1',
  452.      *      'type' => 'checkbox',
  453.      *    ),
  454.      *    array( 'layout' => 'separator' ),
  455.      *    'my_select' => array(
  456.      *      'label' => $this->T_('Selector'),
  457.      *      'defaultvalue' => 'one',
  458.      *      'type' => 'select',
  459.      *      'options' => array( 'sun' => $this->T_('Sunday'), 'mon' => $this->T_('Monday') ),
  460.      *    ) );
  461.      *  </code>
  462.      *
  463.      */
  464.     function GetDefaultSettings$params )
  465.     {
  466.         return array();
  467.     }
  468.  
  469.  
  470.     /**
  471.      * Define here default user settings that are then available in the backoffice.
  472.      *
  473.      * You can access them in the plugin through the member object
  474.      * {@link $UserSettings}, e.g.:
  475.      * <code>$this->UserSettings->get( 'my_param' );</code>
  476.      *
  477.      * This method behaves exactly like {@link Plugin::GetDefaultSettings()},
  478.      * except that it defines user specific settings instead of global settings.
  479.      *
  480.      * @todo 3.0 fp> 1) This is not an event: RENAME to lowercase (in b2evo 3.0)
  481.      * @todo 3.0 fp> 2) This defines more than Default values ::  confusing name
  482.      * @todo name tentative get_user_param_definitions()
  483.      *
  484.      * @see Plugin::GetDefaultSettings()
  485.      * @param array Associative array of parameters.
  486.      *     'for_editing': true, if the settings get queried for editing;
  487.      *                    false, if they get queried for instantiating {@link Plugin::$UserSettings}.
  488.      * @return array See {@link Plugin::GetDefaultSettings()}.
  489.      */
  490.     function GetDefaultUserSettings$params )
  491.     {
  492.         return array();
  493.     }
  494.  
  495.  
  496.     /**
  497.      * Define here default collection/blog settings that are to be made available in the backoffice.
  498.      *
  499.      * @see Plugin::GetDefaultSettings()
  500.      * @param array Associative array of parameters.
  501.      *     'for_editing': true, if the settings get queried for editing;
  502.      *                    false, if they get queried for instantiating {@link Plugin::$UserSettings}.
  503.      * @return array See {@link Plugin::GetDefaultSettings()}.
  504.      */
  505.     function get_coll_setting_definitions$params )
  506.     {
  507.         return array();
  508.     }
  509.  
  510.  
  511.   /**
  512.    * Get definitions for widget specific editable params
  513.    *
  514.      * @see Plugin::GetDefaultSettings()
  515.      * @param local params like 'for_editing' => true
  516.      */
  517.     function get_widget_param_definitions$params )
  518.     {
  519.         return array();
  520.     }
  521.  
  522.  
  523.     /**
  524.      * Get the list of dependencies that the plugin has.
  525.      *
  526.      * This gets checked on install or uninstall of a plugin.
  527.      *
  528.      * There are two <b>classes</b> of dependencies:
  529.      *  - 'recommends': This is just a recommendation. If it cannot get fulfilled
  530.      *                  there will just be a note added on install.
  531.      *  - 'requires': A plugin cannot be installed if the dependencies cannot get
  532.      *                fulfilled. Also, a plugin cannot get uninstalled, if another
  533.      *                plugin depends on it.
  534.      *
  535.      * Each <b>class</b> of dependency can have the following types:
  536.      *  - 'events_by_one': A list of eventlists that have to be provided by a single plugin,
  537.      *                     e.g., <code>array( array('CaptchaPayload', 'CaptchaValidated') )</code>
  538.      *                     to look for a plugin that provides both events.
  539.      *  - 'plugins':
  540.      *    A list of plugins, either just the plugin's classname or an array with
  541.      *    classname and minimum version of the plugin (see {@link Plugin::$version}).
  542.      *    E.g.: <code>array( 'test_plugin', '1' )</code> to require at least version "1"
  543.      *          of the test plugin.
  544.      *  - 'app_min': Minimum application (b2evo) version, e.g. "1.9".
  545.      *               This way you can make sure that the hooks you need are implemented
  546.      *               in the core.
  547.      *               (Available since b2evo 1.8.3. To make it work before 1.8.2 use
  548.      *               "api_min" and check for array(1, 2) (API version of 1.9)).
  549.      *  - 'api_min': You can require a specific minimum version of the Plugins API here.
  550.      *               If it's just a number, only the major version is checked against.
  551.      *               To check also for the minor version, you have to give an array:
  552.      *               array( major, minor ).
  553.      *               Obsolete since 1.9! Used API versions: 1.1 (b2evo 1.8.1) and 1.2 (b2evo 1.9).
  554.      *
  555.      * @see test_plugin::GetDependencies()
  556.      * @return array 
  557.      */
  558.     function GetDependencies()
  559.     {
  560.         return array()// no dependencies by default, of course
  561.     }
  562.  
  563.  
  564.     /**
  565.      * This method should return your DB schema, consisting of a list of CREATE TABLE
  566.      * queries.
  567.      *
  568.      * The DB gets changed accordingly on installing or enabling your Plugin.
  569.      *
  570.      * If you want to change your DB layout in a new version of your Plugin, simply
  571.      * adjust the queries here and increase {@link Plugin::$version}, because this will
  572.      * request to check the current DB layout against the one you require.
  573.      *
  574.      * For restrictions see {@link db_delta()}.
  575.      */
  576.     function GetDbLayout()
  577.     {
  578.         return array();
  579.     }
  580.  
  581.  
  582.     /**
  583.      * This method gets asked when plugins get installed and allows you to return a list
  584.      * of extra events, which your plugin triggers itself (e.g. through
  585.      * {@link $Plugins->trigger_event()}).
  586.      *
  587.      * NOTE: PLEASE use a distinct prefix for the event name, e.g. "$this->classname".
  588.      *
  589.      * NOTE: The length of event names is limited to 40 chars.
  590.      *
  591.      * NOTE: Please comment the params and the return value here with the list
  592.      *       that you return. Only informal as comment, but makes it easier for
  593.      *       others.
  594.      *
  595.      * @see test_plugin::GetExtraEvents()
  596.      * @return NULL|array"event_name" => "description"
  597.      */
  598.     function GetExtraEvents()
  599.     {
  600.     }
  601.  
  602.  
  603.     /**
  604.      * Override this method to define methods/functions that you want to make accessible
  605.      * through /htsrv/call_plugin.php, which allows you to call those methods by HTTP request.
  606.      *
  607.      * This is useful for things like AJAX or displaying an <iframe> element, where the content
  608.      * should get provided by the plugin itself.
  609.      *
  610.      * E.g., the image captcha plugin uses this method to serve a generated image.
  611.      *
  612.      * NOTE: the Plugin's method must be prefixed with "htsrv_", but in this list (and the URL) it
  613.      *       is not. E.g., to have a method "disp_image" that should be callable through this method
  614.      *       return <code>array('disp_image')</code> here and implement it as
  615.      *       <code>function htsrv_disp_image( $params )</code> in your plugin.
  616.      *       This is used to distinguish those methods from others, but keep URLs nice.
  617.      *
  618.      * @see get_htsrv_url()
  619.      * @return array 
  620.      */
  621.     function GetHtsrvMethods()
  622.     {
  623.         return array();
  624.     }
  625.  
  626.  
  627.     /**
  628.      * This method gets asked for a list of cronjobs that the plugin
  629.      * provides.
  630.      * If a user installs a cron job out of this list, the
  631.      * {@link Plugin::ExecCronJob()} of the plugin gets called.
  632.      *
  633.      * @return array Array of arrays with keys "name", "ctrl" and "params".
  634.      *                "name" gets used for display. "ctrl" (string) and
  635.      *                "params" (array) get passed to the
  636.      *                {@link Plugin::ExecCronJob()} method when the cronjob
  637.      *                gets executed.
  638.      */
  639.     function GetCronJobs$params )
  640.     {
  641.         return array();
  642.     }
  643.  
  644.  
  645.     /**
  646.      * Execute/handle a cron job, which has been scheduled by the admin out
  647.      * of the list that the Plugin provides (see {@link GetCronJobs()}).
  648.      *
  649.      * @param array Associative array of parameters
  650.      *    - 'ctrl': The "ctrl" name as defined in {@link GetCronJobs()}
  651.      *    - 'params': The "params" value as defined in {@link GetCronJobs()},
  652.      *                plus "ctsk_ID" which holds the cron task ID.
  653.      * @return array with keys "code" (integer, 1 is ok), "message" (gets logged)
  654.      */
  655.     function ExecCronJob$params )
  656.     {
  657.     }
  658.  
  659.     // }}}
  660.  
  661.  
  662.     /*
  663.      * Event handlers. These are meant to be implemented by your plugin. {{{
  664.      */
  665.  
  666.     // Admin/backoffice events (without events specific to Items or Comments): {{{
  667.  
  668.  
  669.     /**
  670.      * Event handler: Gets invoked in /toolbar.inc.php after the menu structure is built.
  671.      */
  672.     function AdminAfterEvobarInit()
  673.     {
  674.     }
  675.  
  676.  
  677.     /**
  678.      * Event handler: Gets invoked in /admin.php for every backoffice page after
  679.      *                the menu structure is built. You could use the {@link $AdminUI} object
  680.      *                to modify it.
  681.      *
  682.      * This is the hook to register menu entries. See {@link register_menu_entry()}.
  683.      */
  684.     function AdminAfterMenuInit()
  685.     {
  686.         // Example:
  687.         $this->register_menu_entry$this->T_('My Tab') );
  688.     }
  689.  
  690.  
  691.     /**
  692.      * Event handler: Called when ending the admin html head section.
  693.      *
  694.      * @param array Associative array of parameters
  695.      * @return boolean did we do something?
  696.      */
  697.     function AdminEndHtmlHead$params )
  698.     {
  699.         return false;        // Do nothing by default.
  700.     }
  701.  
  702.  
  703.     /**
  704.      * Event handler: Called right after displaying the admin page footer.
  705.      *
  706.      * @param array Associative array of parameters
  707.      * @return boolean did we do something?
  708.      */
  709.     function AdminAfterPageFooter$params )
  710.     {
  711.         return false;        // Do nothing by default.
  712.     }
  713.  
  714.  
  715.     /**
  716.      * Event handler: Called when displaying editor buttons.
  717.      *
  718.      * This method, if implemented, should output the buttons
  719.      * (probably as html INPUT elements) and return true, if
  720.      * button(s) have been displayed.
  721.      *
  722.      * You should provide an unique html ID with your button.
  723.      *
  724.      * @param array Associative array of parameters.
  725.      *    - 'target_type': either 'Comment' or 'Item'.
  726.      *    - 'edit_layout': "simple", "expert", etc. (users, hackers, plugins, etc. may create their own layouts in addition to these)
  727.      *                     NOTE: Please respect the "simple" mode, which should display only the most simple things!
  728.      * @return boolean did we display a button?
  729.      */
  730.     function AdminDisplayEditorButton$params )
  731.     {
  732.         if$params['edit_layout'== 'simple' )
  733.         // Do nothing in simple mode
  734.             return false;
  735.         }
  736.  
  737.         return false;        // Do nothing by default.
  738.     }
  739.  
  740.  
  741.     /**
  742.      * Event handler: Called when displaying editor toolbars.
  743.      *
  744.      * @param array Associative array of parameters
  745.      *    - 'target_type': either 'Comment' or 'Item'.
  746.      *    - 'edit_layout': "simple", "expert", etc. (users, hackers, plugins, etc. may create their own layouts in addition to these)
  747.      *                     NOTE: Please respect the "simple" mode, which should display only the most simple things!
  748.      * @return boolean did we display a toolbar?
  749.      */
  750.     function AdminDisplayToolbar$params )
  751.     {
  752.         return false;        // Do nothing by default.
  753.     }
  754.  
  755.  
  756.     /**
  757.      * Event handler: Called when handling actions for the "Tools" menu.
  758.      *
  759.      * Use {@link msg()} to add messages for the user.
  760.      */
  761.     function AdminToolAction()
  762.     {
  763.     }
  764.  
  765.  
  766.     /**
  767.      * Event handler: Called when displaying the block in the "Tools" menu.
  768.      *
  769.      * @return boolean did we display something?
  770.      */
  771.     function AdminToolPayload()
  772.     {
  773.         return false;        // Do nothing by default.
  774.     }
  775.  
  776.  
  777.     /**
  778.      * Event handler: Method that gets invoked when our tab is selected.
  779.      *
  780.      * You should catch (your own) params (using {@link param()}) here and do actions
  781.      * (but no output!).
  782.      *
  783.      * Use {@link msg()} to add messages for the user.
  784.      */
  785.     function AdminTabAction()
  786.     {
  787.     }
  788.  
  789.  
  790.     /**
  791.      * Event handler: Gets invoked when our tab is selected and should get displayed.
  792.      *
  793.      * Do your output here.
  794.      *
  795.      * @return boolean did we display something?
  796.      */
  797.     function AdminTabPayload()
  798.     {
  799.         return false;        // Do nothing by default.
  800.     }
  801.  
  802.  
  803.     /**
  804.      * Event handler: Gets invoked before the main payload in the backoffice.
  805.      */
  806.     function AdminBeginPayload()
  807.     {
  808.     }
  809.  
  810.     // }}}
  811.  
  812.  
  813.     // Skin/Blog events: {{{
  814.  
  815.     /**
  816.      * Event handler: Called before a blog gets displayed (in _blog_main.inc.php).
  817.      */
  818.     function BeforeBlogDisplay$params )
  819.     {
  820.     }
  821.  
  822.  
  823.     /**
  824.      * Event handler: Called at the beginning of the skin's HTML HEAD section.
  825.      *
  826.      * Use this to add any HTML HEAD lines (like CSS styles or links to resource
  827.      * files (CSS, JavaScript, ..)).
  828.      */
  829.     function SkinBeginHtmlHead$params )
  830.     {
  831.     }
  832.  
  833.  
  834.     /**
  835.      * Event handler: Called at the end of the skin's HTML BODY section.
  836.      *
  837.      * Use this to add any HTML snippet at the end of the generated page.
  838.      */
  839.     function SkinEndHtmlBody$params )
  840.     {
  841.     }
  842.  
  843.     /**
  844.      * Called when a plugin gets called by its @{link $code}.
  845.      *
  846.      * If you provide this event, b2evolution will assume your plugin
  847.      * provides a widget and list it in the "Available widgets" list.
  848.      *
  849.      * @see $code
  850.      * @see Plugins::call_by_code()
  851.      * @param array The array passed to @{link Plugins::call_by_code()}.
  852.      */
  853.     function SkinTag$params )
  854.     {
  855.     }
  856.  
  857.     /**
  858.      * Event handler: Gets asked about a list of skin names that the plugin handles.
  859.      *
  860.      * If one of the skins returned gets called through the "skin=X" URL param, the
  861.      * {@link Plugin::DisplaySkin()} method of your plugin gets called.
  862.      *
  863.      * @return array 
  864.      */
  865.     function GetProvidedSkins()
  866.     {
  867.         return array();
  868.     }
  869.  
  870.  
  871.     /**
  872.      * Event handler: Display a skin. Use {@link Plugin::GetProvidedSkins()} to return
  873.      * a list of names that you register.
  874.      *
  875.      * @param array Associative array of parameters
  876.      *    - 'skin': name of skin to be displayed (from the list of {@link Plugin::GetProvidedSkins()}).
  877.      *              If your Plugin only registers one skin, you can ignore it.
  878.      */
  879.     function DisplaySkin$params )
  880.     {
  881.     }
  882.  
  883.     // }}}
  884.  
  885.  
  886.     // (Un)Install / (De)Activate events: {{{
  887.  
  888.     /**
  889.      * Event handler: Called before the plugin is going to be installed.
  890.      *
  891.      * This is the hook to create any DB tables or the like.
  892.      *
  893.      * If you just want to add a note, use {@link Plugin::msg()} (and return true).
  894.      *
  895.      * @return true|stringTrue, if the plugin can be enabled/activated,
  896.      *                      a string with an error/note otherwise.
  897.      */
  898.     function BeforeInstall()
  899.     {
  900.         return true;  // default is to allow Installation
  901.     }
  902.  
  903.  
  904.     /**
  905.      * Event handler: Called after the plugin has been installed.
  906.      */
  907.     function AfterInstall()
  908.     {
  909.     }
  910.  
  911.  
  912.     /**
  913.      * Event handler: Called before the plugin is going to be un-installed.
  914.      *
  915.      * This is the hook to remove any files or the like - tables with canonical names
  916.      * (see {@link Plugin::get_sql_table()}, are handled internally.
  917.      *
  918.      * See {@link BeforeUninstallPayload()} for the corresponding payload handler, which you
  919.      * can request to invoke by returning NULL here.
  920.      *
  921.      * Note: this method gets called again, if the uninstallation has to be confirmed,
  922.      *       either because you've requested a call to {@link BeforeUninstallPayload()}
  923.      *       or there are tables to be dropped (what the admin user has to confirm).
  924.      *
  925.      * @param array Associative array of parameters.
  926.      *               'unattended': true if Uninstall is unattended (e.g., the /install action "deletedb" uses it).
  927.      *                             This should cleanup everything without confirmation!
  928.      * @return boolean|NULL
  929.      *          true when it's ok to uninstall,
  930.      *          false on failure (the plugin won't get uninstalled then).
  931.      *                You should add the reason for it through {@link Plugin::msg()}.
  932.      *          NULL requests to execute the {@link BeforeUninstallPayload()} method.
  933.      */
  934.     function BeforeUninstall$params )
  935.     {
  936.         return true;
  937.     }
  938.  
  939.  
  940.     /**
  941.      * Event handler: Gets invoked to display the payload before uninstalling the plugin.
  942.      *
  943.      * You have to request a call to this during the plugin uninstall procedure by
  944.      * returning NULL in {@link BeforeUninstall()}.
  945.      *
  946.      * @param array Associative array of parameters.
  947.      *               'Form': The {@link Form} that asks the user for confirmation (by reference).
  948.      *                       If your plugin uses canonical table names (see {@link Plugin::get_sql_table()}),
  949.      *                       there will be already a list of those tables included in it.
  950.      *                       Do not end the form, just add own inputs or hidden keys to it.
  951.      */
  952.     function BeforeUninstallPayload$params )
  953.     {
  954.     }
  955.  
  956.  
  957.     /**
  958.      * Event handler: Called when the admin tries to enable the plugin, changes
  959.      * its configuration/settings and after installation.
  960.      *
  961.      * Use this, if your plugin needs configuration before it can be used.
  962.      *
  963.      * @return true|stringTrue, if the plugin can be enabled/activated,
  964.      *                      a string with an error/note otherwise.
  965.      */
  966.     function BeforeEnable()
  967.     {
  968.         return true;  // default is to allow Activation
  969.     }
  970.  
  971.  
  972.     /**
  973.      * Event handler: Your plugin gets notified here, just before it gets
  974.      * disabled.
  975.      *
  976.      * You cannot prevent this, but only clean up stuff, if you have to.
  977.      */
  978.     function BeforeDisable()
  979.     {
  980.     }
  981.  
  982.  
  983.     /*
  984.      * NOTE: function AppendPluginRegister( & $params ) is deprecated since 1.9.
  985.      * Use Plugin::PluginInit() instead.
  986.      */
  987.  
  988.  
  989.     /**
  990.      * Event handler: Called when we detect a version change (in {@link Plugins::register()}).
  991.      *
  992.      * Use this for your upgrade needs.
  993.      *
  994.      * @param array Associative array of parameters.
  995.      *               'old_version': The old version of your plugin as stored in DB.
  996.      *               'db_row': an array with the columns of the plugin DB entry (in T_plugins).
  997.      *                         The key 'plug_version' is the same as the 'old_version' key.
  998.      * @return boolean If this method returns false, the Plugin's status gets changed to "needs_config" and
  999.      *                  it gets unregistered for the current request.
  1000.      */
  1001.     function PluginVersionChanged$params )
  1002.     {
  1003.         return true;
  1004.     }
  1005.  
  1006.     // }}}
  1007.  
  1008.  
  1009.     // Blog events: {{{
  1010.  
  1011.     /**
  1012.      * Event handler: called at the end of {@link Blog::dbinsert() inserting}
  1013.      * a blog into the database}, which means it has been created.
  1014.      *
  1015.      * @param array Associative array of parameters
  1016.      *    - 'Blog': the related Blog (by reference)
  1017.      */
  1018.     function AfterCollectionInsert$params )
  1019.     {
  1020.     }
  1021.  
  1022.  
  1023.     /**
  1024.      * Event handler: called at the end of {@link Blog::dbupdate() updating}
  1025.      * a blog in the database}.
  1026.      *
  1027.      * @param array Associative array of parameters
  1028.      *    - 'Blog': the related Blog (by reference)
  1029.      */
  1030.     function AfterCollectionUpdate$params )
  1031.     {
  1032.     }
  1033.  
  1034.  
  1035.     /**
  1036.      * Event handler: called at the end of {@link Blog::dbdelete() deleting}
  1037.      * a blog from the database}.
  1038.      *
  1039.      * @param array Associative array of parameters
  1040.      *    - 'Blog': the related Blog (by reference)
  1041.      */
  1042.     function AfterCollectionDelete$params )
  1043.     {
  1044.     }
  1045.  
  1046.     // }}}
  1047.  
  1048.  
  1049.     // Item events: {{{
  1050.  
  1051.     /**
  1052.      * Event handler: Called when rendering item/post contents as HTML. (CACHED)
  1053.      *
  1054.      * The rendered content will be *cached* and the cached content will be reused on subsequent displays.
  1055.      * Use {@link DisplayItemAsHtml()} instead if you want to do rendering at display time.
  1056.      *
  1057.       * Note: You have to change $params['data'] (which gets passed by reference).
  1058.      *
  1059.      * @param array Associative array of parameters
  1060.      *    - 'data': the data (by reference). You probably want to modify this.
  1061.      *    - 'format': see {@link format_to_output()}. Only 'htmlbody' and 'entityencoded' will arrive here.
  1062.      *    - 'Item': the {@link Item} object which gets rendered.
  1063.      * @return boolean Have we changed something?
  1064.      */
  1065.     function RenderItemAsHtml$params )
  1066.     {
  1067.         /*
  1068.         $content = & $params['data'];
  1069.         $content = 'PREFIX__'.$content.'__SUFFIX'; // just an example
  1070.         return true;
  1071.         */
  1072.     }
  1073.  
  1074.  
  1075.     /**
  1076.      * Event handler: Called when rendering item/post contents as XML.
  1077.      *
  1078.      * Should this plugin apply to XML?
  1079.      * It should actually only apply when:
  1080.      * - it generates some content that is visible without HTML tags
  1081.      * - it removes some dirty markup when generating the tags (which will get stripped afterwards)
  1082.      * Note: htmlentityencoded is not considered as XML here.
  1083.      *
  1084.      * Note: You have to change $params['data'] (which gets passed by reference).
  1085.      *
  1086.      * @param array Associative array of parameters
  1087.      *    - 'data': the data (by reference). You probably want to modify this.
  1088.      *    - 'format': see {@link format_to_output()}. Only 'xml' will arrive here.
  1089.      *    - 'Item': the {@link Item} object which gets rendered.
  1090.      * @return boolean Have we changed something?
  1091.      */
  1092.     function RenderItemAsXml$params )
  1093.     {
  1094.         return false;        // Do nothing by default.
  1095.     }
  1096.  
  1097.  
  1098.     /**
  1099.      * Event handler: Called when rendering item/post contents other than XML or HTML.
  1100.      *
  1101.      * Note: return value is ignored. You have to change $params['data'].
  1102.      *
  1103.      * @param array Associative array of parameters
  1104.      *    - 'data': the data (by reference). You probably want to modify this.
  1105.      *    - 'format': see {@link format_to_output()}. Only 'text' will arrive here.
  1106.      *    - 'Item': the {@link Item} object which gets rendered.
  1107.      * @return boolean Have we changed something?
  1108.      */
  1109.     function RenderItemAsText()
  1110.     {
  1111.         return false;        // Do nothing by default.
  1112.     }
  1113.  
  1114.  
  1115.     /**
  1116.      * Event handler: Called when displaying an item/post's content as HTML.
  1117.      *
  1118.      * This is different from {@link RenderItemAsHtml()}, because it gets called
  1119.      * on every display (while rendering gets cached).
  1120.      *
  1121.      * @param array Associative array of parameters
  1122.      *    - 'data': the data (by reference). You probably want to modify this.
  1123.      *    - 'format': see {@link format_to_output()}.
  1124.      *    - 'Item': The {@link Item} that gets displayed (by reference).
  1125.      *    - 'preview': Is this only a preview?
  1126.      *    - 'dispmore': Does this include the "more" text (if available), which means "full post"?
  1127.      * @return boolean Have we changed something?
  1128.      */
  1129.     function DisplayItemAsHtml$params )
  1130.     {
  1131.         return false;        // Do nothing by default.
  1132.     }
  1133.  
  1134.  
  1135.     /**
  1136.      * Event handler: Called when displaying an item/post's content as XML.
  1137.      *
  1138.      * This is different from {@link RenderItemAsXml()}, because it gets called
  1139.      * on every display (while rendering gets cached).
  1140.      *
  1141.      * @param array Associative array of parameters
  1142.      *    - 'data': the data (by reference). You probably want to modify this.
  1143.      *    - 'format': see {@link format_to_output()}.
  1144.      *    - 'Item': The {@link Item} that gets displayed (by reference).
  1145.      *    - 'preview': Is this only a preview?
  1146.      *    - 'dispmore': Does this include the "more" text (if available), which means "full post"?
  1147.      * @return boolean Have we changed something?
  1148.      */
  1149.     function DisplayItemAsXml$params )
  1150.     {
  1151.         return false;        // Do nothing by default.
  1152.     }
  1153.  
  1154.  
  1155.     /**
  1156.      * Event handler: Called when displaying an item/post's content as text.
  1157.      *
  1158.      * This is different from {@link RenderItemAsText()}, because it gets called
  1159.      * on every display (while rendering gets cached).
  1160.      *
  1161.      * @param array Associative array of parameters
  1162.      *    - 'data': the data (by reference). You probably want to modify this.
  1163.      *    - 'format': see {@link format_to_output()}. Only 'text' will arrive here.
  1164.      *    - 'Item': The {@link Item} that gets displayed (by reference).
  1165.      *    - 'preview': Is this only a preview?
  1166.      *    - 'dispmore': Does this include the "more" text (if available), which means "full post"?
  1167.      * @return boolean Have we changed something?
  1168.      */
  1169.     function DisplayItemAsText$params )
  1170.     {
  1171.         return false;        // Do nothing by default.
  1172.     }
  1173.  
  1174.  
  1175.     /**
  1176.      * Event handler: called at the beginning of {@link Item::dbupdate() updating}
  1177.      * an item/post in the database}.
  1178.      *
  1179.      * Use this to manipulate the {@link Item}, e.g. adding a renderer code
  1180.      * through {@link Item::add_renderer()}.
  1181.      *
  1182.      * @param array Associative array of parameters
  1183.      *    - 'Item': the related Item (by reference)
  1184.      */
  1185.     function PrependItemUpdateTransact$params )
  1186.     {
  1187.     }
  1188.  
  1189.  
  1190.     /**
  1191.      * Event handler: called at the end of {@link Item::dbupdate() updating}
  1192.      * an item/post in the database}.
  1193.      *
  1194.      * @param array Associative array of parameters
  1195.      *    - 'Item': the related Item (by reference)
  1196.      *    - 'dbchanges': array with DB changes; a copy of {@link Item::dbchanges()},
  1197.      *                   before they got applied (since 1.9)
  1198.      */
  1199.     function AfterItemUpdate$params )
  1200.     {
  1201.     }
  1202.  
  1203.  
  1204.     /**
  1205.      * Event handler: called at the beginning of {@link Item::dbinsert() inserting}
  1206.      * an item/post in the database}.
  1207.      *
  1208.      * Use this to manipulate the {@link Item}, e.g. adding a renderer code
  1209.      * through {@link Item::add_renderer()}.
  1210.      *
  1211.      * @param array Associative array of parameters
  1212.      *    - 'Item': the related Item (by reference)
  1213.      */
  1214.     function PrependItemInsertTransact$params )
  1215.     {
  1216.     }
  1217.  
  1218.  
  1219.     /**
  1220.      * Event handler: called at the end of {@link Item::dbinsert() inserting}
  1221.      * a item/post into the database}, which means it has been created.
  1222.      *
  1223.      * @param array Associative array of parameters
  1224.      *    - 'Item': the related Item (by reference)
  1225.      *    - 'dbchanges': array with DB changes; a copy of {@link Item::dbchanges()},
  1226.      *                   before they got applied (since 1.9)
  1227.      */
  1228.     function AfterItemInsert$params )
  1229.     {
  1230.     }
  1231.  
  1232.  
  1233.     /**
  1234.      * Event handler: called at the end of {@link Item::dbdelete() deleting}
  1235.      * an item/post from the database}.
  1236.      *
  1237.      * @param array Associative array of parameters
  1238.      *    - 'Item': the related Item (by reference)
  1239.      */
  1240.     function AfterItemDelete$params )
  1241.     {
  1242.     }
  1243.  
  1244.  
  1245.     /**
  1246.      * Event handler: called when instantiating an Item for preview.
  1247.      *
  1248.      * @param array Associative array of parameters
  1249.      *    - 'Item': the related Item (by reference)
  1250.      */
  1251.     function AppendItemPreviewTransact$params )
  1252.     {
  1253.     }
  1254.  
  1255.  
  1256.     /**
  1257.      * Event handler: Called when the view counter of an item got increased.
  1258.      *
  1259.      * @param array Associative array of parameters
  1260.      *    - 'Item': the Item object (by reference)
  1261.      */
  1262.     function ItemViewsIncreased$params )
  1263.     {
  1264.     }
  1265.  
  1266.  
  1267.     /**
  1268.      * Event handler: Called at the end of the "Edit item" form.
  1269.      *
  1270.      * @param array Associative array of parameters
  1271.      *    - 'Form': the {@link Form} object (by reference)
  1272.      *    - 'Item': the Item which gets edited (by reference)
  1273.      *    - 'edit_layout': "simple", "expert", etc. (users, hackers, plugins, etc. may create their own layouts in addition to these)
  1274.      *                     NOTE: Please respect the "simple" mode, which should display only the most simple things!
  1275.      * @return boolean did we display something?
  1276.      */
  1277.     function AdminDisplayItemFormFieldset$params )
  1278.     {
  1279.         return false;        // Do nothing by default.
  1280.     }
  1281.  
  1282.  
  1283.     /**
  1284.      * Event handler: Called before an item gets deleted (in the backoffice).
  1285.      *
  1286.      * You could {@link Plugin::msg() add a message} of
  1287.      * category "error" here, to prevent the comment from being deleted.
  1288.      *
  1289.      * @since 2.0
  1290.      * @param array Associative array of parameters
  1291.      *               'Item': the Item which gets created (by reference)
  1292.      */
  1293.     function AdminBeforeItemEditDelete$params )
  1294.     {
  1295.     }
  1296.  
  1297.  
  1298.     /**
  1299.      * Event handler: Called before a new item gets created (in the backoffice).
  1300.      *
  1301.      * You could {@link Plugin::msg() add a message} of
  1302.      * category "error" here, to prevent the comment from being inserted.
  1303.      *
  1304.      * @param array Associative array of parameters
  1305.      *               'Item': the Item which gets created (by reference)
  1306.      */
  1307.     function AdminBeforeItemEditCreate$params )
  1308.     {
  1309.     }
  1310.  
  1311.  
  1312.     /**
  1313.      * Event handler: Called before an existing item gets updated (in the backoffice).
  1314.      *
  1315.      * You could {@link Plugin::msg() add a message} of
  1316.      * category "error" here, to prevent the comment from being inserted.
  1317.      *
  1318.      * @param array Associative array of parameters
  1319.      *               'Item': the Item which gets updated (by reference)
  1320.      */
  1321.     function AdminBeforeItemEditUpdate$params )
  1322.     {
  1323.     }
  1324.  
  1325.  
  1326.     /**
  1327.      * Event handler: the plugin gets asked if an item can receive feedback/comments.
  1328.      *
  1329.      * @param array Associative array of parameters
  1330.      *               'Item': the Item
  1331.      * @return boolean|string
  1332.      *    true, if the Item can receive feedback
  1333.      *    false/string, if the Item cannot receive feedback. If you return a string
  1334.      *                  this gets displayed as an error/explanation.
  1335.      *    NULL, if you do not want to say "yes" or "no".
  1336.      */
  1337.     function ItemCanComment$params )
  1338.     {
  1339.     }
  1340.  
  1341.  
  1342.     /**
  1343.      * Event handler: send a ping about a new item.
  1344.      *
  1345.      * @param array Associative array of parameters
  1346.      *         'Item': the Item (by reference)
  1347.      *         'xmlrpcresp': Set this to the {@link xmlrpcresp} object, if the plugin
  1348.      *                       uses XMLRPC.
  1349.      *         'display': Should results get displayed? (normally you should not need
  1350.      *                    to care about this, especially if you can set 'xmlrpcresp')
  1351.      * @return boolean Was the ping successful?
  1352.      */
  1353.     function ItemSendPing$params )
  1354.     {
  1355.     }
  1356.  
  1357.  
  1358.     /**
  1359.      * Event handler: called to display the URL that accepts trackbacks for
  1360.      *                an item.
  1361.      *
  1362.      * @param array Associative array of parameters
  1363.      *    - 'Item': the {@link Item} object (by reference)
  1364.      *    - 'template': the template to display the URL (%url%)
  1365.      */
  1366.     function DisplayTrackbackAddr$params )
  1367.     {
  1368.     }
  1369.  
  1370.  
  1371.     /**
  1372.      * Event handler: Does your Plugin want to apply as a renderer for the item?
  1373.      *
  1374.      * NOTE: this is especially useful for lazy Plugins, which would look
  1375.      *       at the content and decide, if they apply.
  1376.      *
  1377.      * @return boolean|NULLIf true, the Plugin gets added as a renderer, false
  1378.      *          removes it as a renderer (if existing) and NULL does not change the
  1379.      *          renderer setting regarding your Plugin.
  1380.      */
  1381.     function ItemApplyAsRenderer$params )
  1382.     {
  1383.     }
  1384.  
  1385.     // }}}
  1386.  
  1387.  
  1388.     // Feedback (Comment/Trackback) events: {{{
  1389.  
  1390.     /**
  1391.      * Event handler: Called when displaying editor toolbars.
  1392.      *
  1393.      * @param array Associative array of parameters
  1394.      * @return boolean did we display a toolbar?
  1395.      */
  1396.     function DisplayCommentToolbar$params )
  1397.     {
  1398.         return false;        // Do nothing by default.
  1399.     }
  1400.  
  1401.  
  1402.     /**
  1403.      * Event handler: Called at the end of the "Edit comment" form.
  1404.      *
  1405.      * @param array Associative array of parameters
  1406.      *    - 'Form': the {@link Form} object (by reference)
  1407.      *    - 'Comment': the Comment which gets edited (by reference)
  1408.      *    - 'edit_layout': only NULL currently, as there's only one layout
  1409.      * @return boolean did we display something?
  1410.      */
  1411.     function AdminDisplayCommentFormFieldset$params )
  1412.     {
  1413.         return false;        // Do nothing by default.
  1414.     }
  1415.  
  1416.  
  1417.     /**
  1418.      * Event handler: Called at the end of the frontend comment form.
  1419.      *
  1420.      * You might want to use this to inject antispam payload to use in
  1421.      * in {@link GetSpamKarmaForComment()} or modify the Comment according
  1422.      * to it in {@link BeforeCommentFormInsert()}.
  1423.      *
  1424.      * @see Plugin::BeforeCommentFormInsert(), Plugin::AfterCommentFormInsert()
  1425.      * @param array Associative array of parameters
  1426.      *    - 'Form': the comment form generating object
  1427.      *    - 'Item': the Item for which the comment is meant
  1428.      */
  1429.     function DisplayCommentFormFieldset$params )
  1430.     {
  1431.     }
  1432.  
  1433.  
  1434.     /**
  1435.      * Event handler: Called in the submit button section of the
  1436.      * frontend comment form.
  1437.      *
  1438.      * @param array Associative array of parameters
  1439.      *    - 'Form': the comment form generating object
  1440.      *    - 'Item': the Item for which the comment is meant
  1441.      */
  1442.     function DisplayCommentFormButton$params )
  1443.     {
  1444.     }
  1445.  
  1446.  
  1447.     /**
  1448.      * Event handler: Called before at the beginning, if a comment form gets sent (and received).
  1449.      *
  1450.      * Use this to filter input, e.g. the OpenID uses this to provide alternate authentication.
  1451.      *
  1452.      * @since 1.10.0
  1453.      * @see Plugin::DisplayCommentFormFieldset()
  1454.      * @param array Associative array of parameters
  1455.      *    - 'comment_post_ID': ID of the item the comment is for
  1456.      *    - 'comment': the comment text (by reference)
  1457.      *    - 'original_comment': the original, unfiltered comment text - you should not modify it here,
  1458.      *       this is meant e.g. for the OpenID plugin to re-inject it after redirection (by reference)
  1459.      *    - 'comment_autobr': is the Auto-BR checkbox checked (by reference)
  1460.      *    - 'action': "save" or "preview" (by reference)
  1461.      *    - 'User': {@link User}, if logged in or null (by reference)
  1462.      *    - 'anon_name': Name of the anonymous commenter (by reference)
  1463.      *    - 'anon_email': E-Mail of the anonymous commenter (by reference)
  1464.      *    - 'anon_url': URL of the anonymous commenter (by reference)
  1465.      *    - 'anon_allow_msgform': "Allow msgform" preference of the anonymous commenter (by reference)
  1466.      *    - 'anon_cookies': "Remember me" preference of the anonymous commenter (by reference)
  1467.      *    - 'redirect_to': URL where to redirect to in the end of comment posting (by reference)
  1468.      */
  1469.     function CommentFormSent$params )
  1470.     {
  1471.     }
  1472.  
  1473.  
  1474.     /**
  1475.      * Event handler: Called before a comment gets inserted through the public comment
  1476.      *                form.
  1477.      *
  1478.      * Use this, to validate a comment: you could {@link Plugin::msg() add a message} of
  1479.      * category "error" here, to prevent the comment from being inserted.
  1480.      *
  1481.      * @see Plugin::DisplayCommentFormFieldset()
  1482.      * @param array Associative array of parameters
  1483.      *    - 'Comment': the Comment (by reference)
  1484.      *    - 'original_comment': this is the unstripped and unformated posted comment
  1485.      *    - 'action': "save" or "preview" (by reference) (since 1.10)
  1486.      *    - 'is_preview': is this a request for previewing the comment? (boolean)
  1487.      */
  1488.     function BeforeCommentFormInsert$params )
  1489.     {
  1490.     }
  1491.  
  1492.  
  1493.     /**
  1494.      * Event handler: Called when a comment form has been processed and the comment
  1495.      *                got inserted into DB.
  1496.      *
  1497.      * @param array Associative array of parameters
  1498.      *    - 'Comment': the Comment (by reference)
  1499.      *    - 'original_comment': this is the unstripped and unformated posted comment
  1500.      */
  1501.     function AfterCommentFormInsert$params )
  1502.     {
  1503.     }
  1504.  
  1505.  
  1506.     /**
  1507.      * Event handler: Called to ask the plugin for the spam karma of a comment/trackback.
  1508.      *
  1509.      * This gets called just before the comment gets stored.
  1510.      *
  1511.      * @param array Associative array of parameters
  1512.      *    - 'Comment': the {@link Comment} object (by reference)
  1513.      *    - The following values are interesting if you want to provide skipping of a test:
  1514.      *      - 'cur_karma': current karma value (cur_karma_abs/cur_karma_divider or NULL)
  1515.      *      - 'cur_karma_abs': current karma absolute value or NULL (if no Plugin returned karma before)
  1516.      *      - 'cur_karma_divider': current divider (sum of weights)
  1517.      *      - 'cur_count_plugins': number of Plugins that have already been asked
  1518.      * @return integer|NULLSpam probability (-100 - 100).
  1519.      *                 -100 means "absolutely no spam", 100 means "absolutely spam".
  1520.      *                 Only if you return a numeric value, it gets considered (e.g., "", NULL or false get ignored).
  1521.      */
  1522.     function GetSpamKarmaForComment$params )
  1523.     {
  1524.         return;
  1525.     }
  1526.  
  1527.  
  1528.     /**
  1529.      * Event handler: called at the end of {@link Comment::dbupdate() updating}
  1530.      * a comment in the database}.
  1531.      *
  1532.      * @param array Associative array of parameters
  1533.      *    - 'Comment': the related Comment (by reference)
  1534.      *    - 'dbchanges': array with DB changes; a copy of {@link Comment::dbchanges()},
  1535.      *                   before they got applied (since 1.9)
  1536.      */
  1537.     function AfterCommentUpdate$params )
  1538.     {
  1539.     }
  1540.  
  1541.  
  1542.     /**
  1543.      * Event handler: called at the end of {@link Comment::dbinsert() inserting}
  1544.      * a comment into the database}, which means it has been created.
  1545.      *
  1546.      * @param array Associative array of parameters
  1547.      *    - 'Comment': the related Comment (by reference)
  1548.      *    - 'dbchanges': array with DB changes; a copy of {@link Comment::dbchanges()},
  1549.      *                   before they got applied (since 1.9)
  1550.      */
  1551.     function AfterCommentInsert$params )
  1552.     {
  1553.     }
  1554.  
  1555.  
  1556.     /**
  1557.      * Event handler: called at the end of {@link Comment::dbdelete() deleting}
  1558.      * a comment from the database}.
  1559.      *
  1560.      * @param array Associative array of parameters
  1561.      *    - 'Comment': the related Comment (by reference)
  1562.      */
  1563.     function AfterCommentDelete$params )
  1564.     {
  1565.     }
  1566.  
  1567.  
  1568.     /**
  1569.      * Event handler: called before a trackback gets recorded.
  1570.      *
  1571.      * Use this, to validate a trackback: you could {@link Plugin::msg() add a message} of
  1572.      * category "error" here, to prevent the trackback from being accepted.
  1573.      *
  1574.      * @param array Associative array of parameters
  1575.      *    - 'Comment': the trackback (which is a {@link Comment} object with "trackback" type) (by reference)
  1576.      *         The trackback-params get mapped like this:
  1577.      *         - "blog_name" => "author"
  1578.      *         - "url" => "author_url"
  1579.      *         - "title"/"excerpt" => "comment"
  1580.      *
  1581.      */
  1582.     function BeforeTrackbackInsert$params )
  1583.     {
  1584.     }
  1585.  
  1586.     /**
  1587.      * Event handler: Gets called after a trackback has been recorded.
  1588.      *
  1589.      * @param array Associative array of parameters
  1590.      *    - 'Comment': the trackback (which is a {@link Comment} object with "trackback" type) (by reference)
  1591.      *         The trackback-params get mapped like this:
  1592.      *         - "blog_name" => "author"
  1593.      *         - "url" => "author_url"
  1594.      *         - "title"/"excerpt" => "comment"
  1595.      */
  1596.     function AfterTrackbackInsert$params )
  1597.     {
  1598.     }
  1599.  
  1600.     /**
  1601.      * Event handler: called to filter the comment's author name (blog name for trackbacks)
  1602.      *
  1603.      * @param array Associative array of parameters
  1604.      *    - 'data': the name of the author/blog (by reference)
  1605.      *    - 'makelink': true, if the "data" contains a link
  1606.      *    - 'Comment': the {@link Comment} object
  1607.      */
  1608.     function FilterCommentAuthor$params )
  1609.     {
  1610.     }
  1611.  
  1612.  
  1613.     /**
  1614.      * Event handler: called to filter the comment's author URL.
  1615.      * This may be either the URL only or a full link (A tag).
  1616.      *
  1617.      * @param array Associative array of parameters
  1618.      *    - 'data': the URL of the author/blog (by reference)
  1619.      *    - 'makelink': true, if the "data" contains a link (HTML A tag)
  1620.      *    - 'Comment': the {@link Comment} object
  1621.      */
  1622.     function FilterCommentAuthorUrl$params )
  1623.     {
  1624.     }
  1625.  
  1626.  
  1627.     /**
  1628.      * Event handler: called to filter the comment's content
  1629.      *
  1630.      * @param array Associative array of parameters
  1631.      *    - 'data': the name of the author/blog (by reference)
  1632.      *    - 'Comment': the {@link Comment} object
  1633.      */
  1634.     function FilterCommentContent$params )
  1635.     {
  1636.     }
  1637.  
  1638.     // }}}
  1639.  
  1640.  
  1641.     // Message form events: {{{
  1642.  
  1643.     /**
  1644.      * Event handler: Called at the end of the frontend message form, which
  1645.      * allows to send an email to a user/commentator.
  1646.      *
  1647.      * You might want to use this to inject antispam payload to use in
  1648.      * in {@link MessageFormSent()}.
  1649.      *
  1650.      * @param array Associative array of parameters
  1651.      *    - 'Form': the comment form generating object
  1652.      *    - 'recipient_ID': ID of the user (if any)
  1653.      *    - 'item_ID': ID of the item where the user clicked the msgform icon (if any)
  1654.      *    - 'comment_ID': ID of the comment where the user clicked the msgform icon (if any)
  1655.      */
  1656.     function DisplayMessageFormFieldset$params )
  1657.     {
  1658.     }
  1659.  
  1660.  
  1661.     /**
  1662.      * Event handler: Called in the submit button section of the
  1663.      * frontend message form.
  1664.      *
  1665.      * @param array Associative array of parameters
  1666.      *    - 'Form': the comment form generating object
  1667.      *    - 'recipient_ID': ID of the user (if any)
  1668.      *    - 'item_ID': ID of the item where the user clicked the msgform icon (if any)
  1669.      *    - 'comment_ID': ID of the comment where the user clicked the msgform icon (if any)
  1670.      */
  1671.     function DisplayMessageFormButton$params )
  1672.     {
  1673.     }
  1674.  
  1675.  
  1676.     /**
  1677.      * Event handler: Called when a message form has been submitted.
  1678.      *
  1679.      * Add messages of category "error" to prevent the message from being sent.
  1680.      *
  1681.      * You can also alter the "message" or "message_footer" that gets sent here.
  1682.      *
  1683.      * @param array Associative array of parameters
  1684.      *    - 'recipient_ID': ID of the user (if any)
  1685.      *    - 'item_ID': ID of the item where the user clicked the msgform icon (if any)
  1686.      *    - 'comment_ID': ID of the comment where the user clicked the msgform icon (if any)
  1687.      *    - 'sender_name': The name of the sender (by reference) (since 1.10.0)
  1688.      *    - 'sender_email': The email address of the sender (by reference) (since 1.10.0)
  1689.      *    - 'subject': The subject of the message to be sent (by reference) (since 1.10.0)
  1690.      *    - 'message': The message to be sent (by reference)
  1691.      *    - 'message_footer': The footer of the message (by reference)
  1692.      *    - 'Blog': The blog, depending on the context (may be null) (by reference) (since 1.10.0)
  1693.      */
  1694.     function MessageFormSent$params )
  1695.     {
  1696.     }
  1697.  
  1698.  
  1699.     /**
  1700.      * Event handler: Called after a message has been sent through the public email form.
  1701.      *
  1702.      * This is meant to cleanup generated data.
  1703.      */
  1704.     function MessageFormSentCleanup()
  1705.     {
  1706.     }
  1707.  
  1708.     // }}}
  1709.  
  1710.  
  1711.     // Caching events: {{{
  1712.  
  1713.     /**
  1714.      * Event handler: called to cache object data.
  1715.      *
  1716.      * @param array Associative array of parameters
  1717.      *    - 'action': 'delete', 'set', 'get'
  1718.      *    - 'key': The key to refer to 'data'
  1719.      *    - 'data': The actual data. This must be set by the plugin.
  1720.      * @return boolean True if action was successful, false otherwise.
  1721.      */
  1722.     function CacheObjects$params )
  1723.     {
  1724.     }
  1725.  
  1726.  
  1727.     /**
  1728.      * Event handler: called to cache page content (get cached content or request caching).
  1729.      *
  1730.      * This method must build a unique key for the requested page (including cookie/session info) and
  1731.      * start an output buffer, to get the content to cache.
  1732.      *
  1733.      * Note, that there are special occassions when this event does not get called, because we want
  1734.      * really fresh content always:
  1735.      *  - we're generating static pages
  1736.      *  - there gets a "dynamic object", such as "Messages" or "core.preview_Comment" transported in the session
  1737.      *
  1738.      * @see Plugin::CacheIsCollectingContent()
  1739.      * @param array Associative array of parameters
  1740.      *    - 'data': this must get set to the page content on cache hit
  1741.      * @return boolean True if we handled the request (either returned caching data or started buffering),
  1742.      *                  false if we do not want to cache this page.
  1743.      */
  1744.     function CachePageContent$params )
  1745.     {
  1746.     }
  1747.  
  1748.  
  1749.     /**
  1750.      * Event handler: gets asked for if we are generating cached content.
  1751.      *
  1752.      * This is useful to not generate a list of online users or the like.
  1753.      *
  1754.      * @see Plugin::CachePageContent()
  1755.      * @return boolean 
  1756.      */
  1757.     function CacheIsCollectingContent()
  1758.     {
  1759.     }
  1760.  
  1761.     // }}}
  1762.  
  1763.  
  1764.     // PluginSettings {{{
  1765.     /**
  1766.      * Event handler: Called before displaying or setting a plugin's setting in the backoffice.
  1767.      *
  1768.      * @see GetDefaultSettings()
  1769.      * @param array Associative array of parameters
  1770.      *    - 'name': name of the setting
  1771.      *    - 'value': value of the setting (by reference)
  1772.      *    - 'meta': meta data of the setting (as given in {@link GetDefaultSettings()})
  1773.      *    - 'action': 'display' or 'set'
  1774.      * @return string|NULLReturn a string with an error to prevent the setting from being set
  1775.      *                      and/or a message added to the settings field.
  1776.      */
  1777.     function PluginSettingsValidateSet$params )
  1778.     {
  1779.     }
  1780.  
  1781.  
  1782.     /**
  1783.      * Event handler: Called as action just before updating the {@link Plugin::$Settings plugin's settings}.
  1784.      *
  1785.      * The "regular" settings from {@link GetDefaultSettings()} have been set into
  1786.      * {@link Plugin::$Settings}, but get saved into DB after this method has been called.
  1787.      *
  1788.      * Use this to catch custom input fields from {@link PluginSettingsEditDisplayAfter()} or
  1789.      * add notes/errors through {@link Plugin::msg()}.
  1790.      *
  1791.      * If you want to modify plugin events (see {@link Plugin::enable_event()} and
  1792.      * {@link Plugin::disable_event()}), you should use {@link Plugin::BeforeEnable()}, because Plugin
  1793.      * events get saved (according to the edit settings screen) after this event.
  1794.      *
  1795.      * @return false|NULLReturn false to prevent the settings from being updated to DB.
  1796.      */
  1797.     function PluginSettingsUpdateAction()
  1798.     {
  1799.     }
  1800.  
  1801.  
  1802.     /**
  1803.      * Event handler: Called as action before displaying the "Edit plugin" form,
  1804.      * which includes the display of the {@link Plugin::$Settings plugin's settings}.
  1805.      *
  1806.      * You may want to use this to check existing settings or display notes about
  1807.      * something.
  1808.      */
  1809.     function PluginSettingsEditAction()
  1810.     {
  1811.     }
  1812.  
  1813.  
  1814.     /**
  1815.      * Event handler: Called after the form to edit the {@link Plugin::$Settings} has been
  1816.      * displayed.
  1817.      *
  1818.      * Use this to add custom input fields (and catch them in {@link PluginSettingsUpdateAction()})
  1819.      * or display custom output (e.g. a test link).
  1820.      *
  1821.      * @param array Associative array of parameters
  1822.      *    - 'Form': the {@link Form}, where an fieldset has been opened already (by reference)
  1823.      */
  1824.     function PluginSettingsEditDisplayAfter$params )
  1825.     {
  1826.     }
  1827.  
  1828.     // }}}
  1829.  
  1830.  
  1831.     // PluginUserSettings {{{
  1832.     /**
  1833.      * Event handler: Called before displaying or setting a plugin's user setting in the backoffice.
  1834.      *
  1835.      * @see GetDefaultUserSettings()
  1836.      * @param array Associative array of parameters
  1837.      *    - 'name': name of the setting
  1838.      *    - 'value': value of the setting (by reference)
  1839.      *    - 'meta': meta data of the setting (as given in {@link GetDefaultUserSettings()})
  1840.      *    - 'User': the {@link User} for which the setting is
  1841.      *    - 'action': 'display' or 'set'
  1842.      * @return string|NULLReturn a string with an error to prevent the setting from being set
  1843.      *                      and/or a message added to the settings field.
  1844.      */
  1845.     function PluginUserSettingsValidateSet$params )
  1846.     {
  1847.     }
  1848.  
  1849.  
  1850.     /**
  1851.      * Event handler: Called as action just before updating the {@link Plugin::$UserSettings plugin's user settings}.
  1852.      *
  1853.      * The "regular" settings from {@link GetDefaultUserSettings()} have been set into
  1854.      * {@link Plugin::$UserSettings}, but get saved into DB after this method has been called.
  1855.      *
  1856.      * Use this to catch custom input fields from {@link PluginUserSettingsEditDisplayAfter()} or
  1857.      * add notes/errors through {@link Plugin::msg()}.
  1858.      *
  1859.      * @param array Associative array of parameters
  1860.      *    - 'User': the {@link User} for which the settings get updated
  1861.      *    - 'action': "save", "reset"
  1862.      *
  1863.      * @return false|NULLReturn false to prevent the settings from being updated to DB.
  1864.      */
  1865.     function PluginUserSettingsUpdateAction$params )
  1866.     {
  1867.     }
  1868.  
  1869.  
  1870.     /**
  1871.      * Event handler: Called as action before displaying the "Edit user" form,
  1872.      * which includes the display of the {@link Plugin::$UserSettings plugin's user settings}.
  1873.      *
  1874.      * You may want to use this to check existing settings or display notes about
  1875.      * something.
  1876.      *
  1877.      * @param array Associative array of parameters
  1878.      *    - 'User': the {@link User} for which the settings are being displayed/edited
  1879.      */
  1880.     function PluginUserSettingsEditAction$params )
  1881.     {
  1882.     }
  1883.  
  1884.  
  1885.     /**
  1886.      * Event handler: Called after the form to edit the {@link Plugin::$UserSettings} has been
  1887.      * displayed.
  1888.      *
  1889.      * Use this to add custom input fields (and catch them in {@link PluginUserSettingsUpdateAction()})
  1890.      * or display custom output (e.g. a test link).
  1891.      *
  1892.      * @param array Associative array of parameters
  1893.      *    - 'Form': the {@link Form}, where an fieldset has been opened already (by reference)
  1894.      *    - 'User': the {@link User} whose settings get displayed for editing (since 1.10.0)
  1895.      */
  1896.     function PluginUserSettingsEditDisplayAfter$params )
  1897.     {
  1898.     }
  1899.  
  1900.     // }}}
  1901.  
  1902.  
  1903.     // User related events, including registration and login (procedure): {{{
  1904.  
  1905.     /**
  1906.      * Event handler: Called at the end of the login procedure, if the
  1907.      *                user is anonymous ({@link $current_User current User} NOT set).
  1908.      *
  1909.      * Use this for example to read some cookie and define further handling of
  1910.      * this visitor or force them to login, by {@link Plugin::msg() adding a message}
  1911.      * of class "login_error", which will trigger the login screen.
  1912.      */
  1913.     function AfterLoginAnonymousUser$params )
  1914.     {
  1915.     }
  1916.  
  1917.  
  1918.     /**
  1919.      * Event handler: Called at the end of the login procedure, if the
  1920.      *                {@link $current_User current User} is set and the
  1921.      *                user is therefor registered.
  1922.      *
  1923.      * Use this for example to re-act on specific {@link Plugin::$UserSettings user settings},
  1924.      * e.g., call {@link Plugin::forget_events()} to de-activate the plugin for
  1925.      * the current request.
  1926.      *
  1927.      * You can also {@link Plugin::msg() add a message} of class "login_error"
  1928.      * to prevent the user from accessing the site and triggering
  1929.      * the login screen.
  1930.      */
  1931.     function AfterLoginRegisteredUser$params )
  1932.     {
  1933.     }
  1934.  
  1935.  
  1936.     /**
  1937.      * Event handler: Called when a new user has registered, at the end of the
  1938.      *                DB transaction that created this user.
  1939.      *
  1940.      * If you want to modify the about-to-be-created user (if the transaction gets
  1941.      * committed), you'll have to call {@link User::dbupdate()} on it, because he
  1942.      * got already inserted (but the transaction is not yet committed).
  1943.      *
  1944.      * Note: if you want to re-act on a new user,
  1945.      * use {@link Plugin::AfterUserRegistration()} instead!
  1946.      *
  1947.      * @param array Associative array of parameters
  1948.      *    - 'User': the {@link User user object} (as reference).
  1949.      * @return boolean false if the whole transaction should get rolled back (the user does not get created).
  1950.      */
  1951.     function AppendUserRegistrTransact$params )
  1952.     {
  1953.         return true;
  1954.     }
  1955.  
  1956.  
  1957.     /**
  1958.      * Event handler: Called when a new user has registered and got created.
  1959.      *
  1960.      * Note: if you want to modify a new user,
  1961.      * use {@link Plugin::AppendUserRegistrTransact()} instead!
  1962.      *
  1963.      * @param array Associative array of parameters
  1964.      *    - 'User': the {@link User user object} (as reference).
  1965.      */
  1966.     function AfterUserRegistration$params )
  1967.     {
  1968.     }
  1969.  
  1970.  
  1971.     /**
  1972.      * Event handler: Called at the end of the "Register as new user" form.
  1973.      *
  1974.      * You might want to use this to inject antispam payload to use
  1975.      * in {@link Plugin::RegisterFormSent()}.
  1976.      *
  1977.      * @param array Associative array of parameters
  1978.      *    - 'Form': the comment form generating object (by reference)
  1979.      */
  1980.     function DisplayRegisterFormFieldset$params )
  1981.     {
  1982.     }
  1983.  
  1984.  
  1985.     /**
  1986.      * Event handler: Called when a "Register as new user" form has been submitted.
  1987.      *
  1988.      * You can cancel the registration process by {@link Plugin::msg() adding a message}
  1989.      * of type "error".
  1990.      *
  1991.      * @param array Associative array of parameters
  1992.      *    - 'login': Login name (by reference) (since 1.10.0)
  1993.      *    - 'email': E-Mail value (by reference) (since 1.10.0)
  1994.      *    - 'locale': Locale value (by reference) (since 1.10.0)
  1995.      *    - 'pass1': Password (by reference) (since 1.10.0)
  1996.      *    - 'pass2': Confirmed password (by reference) (since 1.10.0)
  1997.      */
  1998.     function RegisterFormSent$params )
  1999.     {
  2000.     }
  2001.  
  2002.  
  2003.     /**
  2004.      * Event handler: Called at the end of the "Login" form.
  2005.      *
  2006.      * You might want to use this to inject payload to use
  2007.      * in {@link LoginAttempt()}.
  2008.      *
  2009.      * @param array Associative array of parameters
  2010.      *    - 'Form': the comment form generating object (by reference)
  2011.      */
  2012.     function DisplayLoginFormFieldset$params )
  2013.     {
  2014.     }
  2015.  
  2016.  
  2017.     /**
  2018.      * Event handler: called when a user attemps to login.
  2019.      *
  2020.      * You can prevent the user from logging in by {@link Plugin::msg() adding a message}
  2021.      * of type "login_error".
  2022.      *
  2023.      * Otherwise, this hook is meant to authenticate a user against some
  2024.      * external database (e.g. LDAP) and generate a new user.
  2025.      *
  2026.      * To check, if a user already exists in b2evo with that login/password, you might
  2027.      * want to use <code>user_pass_ok( $login, $pass_md5, true )</code>.
  2028.      *
  2029.      * NOTE: if 'pass_hashed' is not empty, you won't receive the password in clear-type. It
  2030.      *       has been hashed using client-side Javascript.
  2031.      *       SHA1( MD5($params['pass']).$params['pass_salt'] ) should result in $params['pass_hashed']!
  2032.      *       If you need the raw password, see {@link LoginAttemptNeedsRawPassword()}.
  2033.      *
  2034.      * @see Plugin::AlternateAuthentication()
  2035.      * @see Plugin::Logout()
  2036.      * @param array Associative array of parameters
  2037.      *    - 'login': user's login (by reference since 1.10.0)
  2038.      *    - 'pass': user's password (by reference since 1.10.0)
  2039.      *    - 'pass_md5': user's md5 password (by reference since 1.10.0)
  2040.      *    - 'pass_salt': the salt used in "pass_hashed" (by reference)
  2041.      *    - 'pass_hashed': if non-empty this is the users passwords hashed. See note above. (by reference)
  2042.      *    - 'pass_ok': is the password ok for 'login'? (by reference) (since 1.10.0)
  2043.      */
  2044.     function LoginAttempt$params )
  2045.     {
  2046.     }
  2047.  
  2048.  
  2049.     /**
  2050.      * Event handler: your Plugin should return true here, if it needs a raw (un-hashed)
  2051.      * password for the {@link Plugin::LoginAttempt()} event. If any Plugin returns true
  2052.      * for this event, client-side hashing of the password is not used.
  2053.      * NOTE: this causes passwords to travel un-encrypted, unless SSL/HTTPS get used.
  2054.      *
  2055.      * @return boolean True, if you need the raw password.
  2056.      */
  2057.     function LoginAttemptNeedsRawPassword()
  2058.     {
  2059.         return false;
  2060.     }
  2061.  
  2062.  
  2063.     /**
  2064.      * Event handler: called when a user logs out.
  2065.      *
  2066.      * This is meant to cleanup data, e.g. if you use the
  2067.      * {@link Plugin::AlternateAuthentication()} hook.
  2068.      *
  2069.      * @see Plugin::AlternateAuthentication()
  2070.      * @see Plugin::Logout()
  2071.      * @param array Associative array of parameters
  2072.      *    - 'User': the user object
  2073.      */
  2074.     function Logout$params )
  2075.     {
  2076.     }
  2077.  
  2078.  
  2079.     /**
  2080.      * Event handler: Called at the end of the "Validate user account" form, which gets
  2081.      *                invoked if newusers_mustvalidate is enabled and the user has not
  2082.      *                been validated yet.
  2083.      *
  2084.      * The corresponding action event is {@link Plugin::ValidateAccountFormSent()}.
  2085.      *
  2086.      * @param array Associative array of parameters
  2087.      *    - 'Form': the comment form generating object (by reference)
  2088.      */
  2089.     function DisplayValidateAccountFormFieldset$params )
  2090.     {
  2091.     }
  2092.  
  2093.  
  2094.     /**
  2095.      * Event handler: Called when a "Validate user account" form has been submitted.
  2096.      *
  2097.      * You can cancel the registration process by {@link Plugin::msg() adding a message}
  2098.      * of type "error".
  2099.      */
  2100.     function ValidateAccountFormSent$params )
  2101.     {
  2102.     }
  2103.     
  2104.     
  2105.     /**
  2106.      * Event handler: Called at the end of the "User profile" form.
  2107.      *
  2108.      * The corresponding action event is {@link Plugin::ProfileFormSent()}.
  2109.      *
  2110.      * @param array Associative array of parameters
  2111.      *    - 'Form': the user profile form generating object (by reference)
  2112.      *    - 'User': the edited user object (by reference)
  2113.      *    - 'edit_layout':
  2114.      *             "public" - public frontend user profile form (info only),
  2115.      *             "private" - private frontend user profile form (editable),
  2116.      */
  2117.     function DisplayProfileFormFieldset$params )
  2118.     {
  2119.         if$params['edit_layout'== 'public' )
  2120.         // Do nothing in public mode
  2121.             return false;
  2122.         }
  2123.  
  2124.         return false;        // Do nothing by default.
  2125.     }
  2126.  
  2127.  
  2128.     /**
  2129.      * Event handler: Called before at the beginning, if a profile form gets sent (and received).
  2130.      *
  2131.      * Use this to filter input
  2132.      *
  2133.      * @see Plugin::DisplayProfileFormFieldset()
  2134.      * @param array Associative array of parameters
  2135.      *    - 'User': edited {@link User} object (by reference)
  2136.      *    - 'newuser_firstname': firstname (by reference)
  2137.      *    - 'newuser_lastname': lastname (by reference)
  2138.      *    - 'newuser_nickname': nickname (by reference)
  2139.      *    - 'newuser_idmode': "Identity shown" mode (by reference)
  2140.      *    - 'newuser_locale': locale (by reference)
  2141.      *    - 'newuser_icq': ICQ (by reference)
  2142.      *    - 'newuser_aim': AOL I.M. (by reference)
  2143.      *    - 'newuser_msn': MSN I.M. (by reference)
  2144.      *    - 'newuser_yim': Yahoo I.M. (by reference)
  2145.      *    - 'newuser_url': URL (by reference)
  2146.      *    - 'newuser_email': email (by reference)
  2147.      *    - 'newuser_allow_msgform': "message form" status (by reference)
  2148.      *    - 'newuser_notify': "notifications" status (by reference)
  2149.      *    - 'newuser_showonline': "show online" status (by reference)
  2150.      *    - 'pass1': pass1 (by reference)
  2151.      *    - 'pass2': pass2 (by reference)
  2152.      */
  2153.     function ProfileFormSent$params )
  2154.     {
  2155.     }
  2156.     
  2157.     
  2158.     /**
  2159.      * Event handler: called at the end of the login process, if the user did not try to
  2160.      *                login (by sending "login" and "pwd"), the session has no user attached
  2161.      *                or only "login" is given.
  2162.      *
  2163.      * This hook is meant to automagically login/authenticate an user by his/her IP address,
  2164.      * special cookie, etc..
  2165.      *
  2166.      * If you can authenticate the user, you'll have to attach him to the {@link $Session},
  2167.      * either through {@link Session::set_user_ID()} or {@link Session::set_User()}.
  2168.      *
  2169.      * @see Plugin::LoginAttempt()
  2170.      * @see Plugin::Logout()
  2171.      * @return boolean True, if the user has been authentificated (set in $Session)
  2172.      */
  2173.     function AlternateAuthentication$params )
  2174.     {
  2175.     }
  2176.  
  2177.  
  2178.     /**
  2179.      * Event handler: called at the end of {@link User::dbupdate() updating}
  2180.      * an user account in the database}, which means that it has been changed.
  2181.      *
  2182.      * @since 1.8.1
  2183.      * @param array Associative array of parameters
  2184.      *    - 'User': the related User (by reference)
  2185.      */
  2186.     function AfterUserUpdate$params )
  2187.     {
  2188.     }
  2189.  
  2190.  
  2191.     /**
  2192.      * Event handler: called at the end of {@link User::dbinsert() inserting}
  2193.      * an user account into the database}, which means it has been created.
  2194.      *
  2195.      * @since 1.8.1
  2196.      * @param array Associative array of parameters
  2197.      *    - 'User': the related User (by reference)
  2198.      */
  2199.     function AfterUserInsert$params )
  2200.     {
  2201.     }
  2202.  
  2203.  
  2204.     /**
  2205.      * Event handler: called at the end of {@link User::dbdelete() deleting}
  2206.      * an user from the database}.
  2207.      *
  2208.      * @since 1.8.1
  2209.      * @param array Associative array of parameters
  2210.      *    - 'User': the related User (by reference)
  2211.      */
  2212.     function AfterUserDelete$params )
  2213.     {
  2214.     }
  2215.  
  2216.     // }}}
  2217.  
  2218.  
  2219.     // General events: {{{
  2220.  
  2221.     /**
  2222.      * Event handler: general event to inject payload for a captcha test.
  2223.      *
  2224.      * This does not get called by b2evolution itself, but provides an interface
  2225.      * to other plugins. E.g., the {@link dnsbl_antispam_plugin DNS blacklist plugin}
  2226.      * uses this event optionally to whitelist a user.
  2227.      *
  2228.      * @param array Associative array of parameters
  2229.      *    - 'Form': the {@link form} where payload should get added (by reference, OPTIONALLY!)
  2230.      *      If it's not given as param, you have to create an own form, if you need one.
  2231.      *    - 'form_use_fieldset': if a "Form" param is given and we use it, should we add
  2232.      *                           an own fieldset? (boolean, default "true", OPTIONALLY!)
  2233.      *    - 'key': A key that is associated to the caller of the event (string, OPTIONALLY!)
  2234.      * @return boolean True, if you have provided payload for a captcha test
  2235.      */
  2236.     function CaptchaPayload$params )
  2237.     {
  2238.     }
  2239.  
  2240.  
  2241.     /**
  2242.      * Event handler: general event to validate a captcha which payload was added
  2243.      * through {@link CaptchaPayload()}.
  2244.      *
  2245.      * This does not get called by b2evolution itself, but provides an interface
  2246.      * to other plugins. E.g., the {@link dnsbl_antispam_plugin DNS blacklist plugin}
  2247.      * uses this event optionally to whitelist a user.
  2248.      *
  2249.      * NOTE: if the action is verified/completed in total, you HAVE to call
  2250.      *       {@link CaptchaValidatedCleanup()}, so that the plugin can cleanup its data
  2251.      *       and is not vulnerable against multiple usage of the same captcha!
  2252.      *
  2253.      * @param array Associative array of parameters
  2254.      *    - 'validate_error': you can optionally set this, if you want to give a reason
  2255.      *      of the failure. This is optionally and meant to be used by other plugins
  2256.      *      that trigger this event.
  2257.      * @return boolean true if the catcha could be validated
  2258.      */
  2259.     function CaptchaValidated$params )
  2260.     {
  2261.     }
  2262.  
  2263.  
  2264.     /**
  2265.      * Event handler: general event to be called after an action has been taken, which
  2266.      * involved {@link CaptchaPayload()} and {@link CaptchaValidated()}.
  2267.      *
  2268.      * This is meant to cleanup generated data for the Captcha test.
  2269.      *
  2270.      * This does not get called by b2evolution itself, but provides an interface
  2271.      * to other plugins. E.g., the {@link dnsbl_antispam_plugin DNS blacklist plugin}
  2272.      * uses this event optionally to whitelist a user.
  2273.      */
  2274.     function CaptchaValidatedCleanup$params )
  2275.     {
  2276.     }
  2277.  
  2278.     // }}}
  2279.  
  2280.  
  2281.     /**
  2282.      * Event handler: Called when an IP address gets displayed, typically in a protected
  2283.      * area or for a privileged user, e.g. in the backoffice statistics menu.
  2284.      *
  2285.      * @param array Associative array of parameters
  2286.      *    - 'data': the data (by reference). You probably want to modify this.
  2287.      *    - 'format': see {@link format_to_output()}.
  2288.      * @return boolean Have we changed something?
  2289.      */
  2290.     function FilterIpAddress$params )
  2291.     {
  2292.         return false;        // Do nothing by default.
  2293.     }
  2294.  
  2295.  
  2296.     /**
  2297.      * Event handler: Called after initializing plugins, DB, Settings, Hit, .. but
  2298.      * quite early.
  2299.      *
  2300.      * This is meant to be a good point for Antispam plugins to cancel the request.
  2301.      *
  2302.      * @see dnsbl_antispam_plugin
  2303.      */
  2304.     function SessionLoaded()
  2305.     {
  2306.     }
  2307.  
  2308.  
  2309.     /**
  2310.      * Event handler: Called before pruning sessions. The plugin can prevent deletion
  2311.      * of particular sessions, by returning their IDs.
  2312.      *
  2313.      * Note: There can be hundreds of thousands of sessions about to be deleted.
  2314.      * Any plugin making use of this may have serious performance/memory issues.
  2315.      *
  2316.      * fp> TODO: maybe we should pass the prune cut off date instead.
  2317.      * What's a use case for this?
  2318.      *
  2319.      * @param array Associative array of parameters
  2320.      *    - 'IDs': list of session IDs that are about to get deleted (WARNING: potentially huge)
  2321.      * @return array List of IDs that should not get deleted
  2322.      */
  2323.     function BeforeSessionsDelete$params )
  2324.     {
  2325.         return array();
  2326.     }
  2327.  
  2328.  
  2329.     /**
  2330.      * Event handler: Called when a hit gets logged, but before it gets recorded.
  2331.      *
  2332.      * @param array Associative array of parameters
  2333.      *    - 'Hit': The "Hit" object (by reference).
  2334.      *
  2335.      * @return boolean True if you've handled the recording of the hit, false otherwise.
  2336.      */
  2337.     function AppendHitLog$params )
  2338.     {
  2339.         // Do nothing by default:
  2340.         return false;
  2341.     }
  2342.  
  2343.     /*
  2344.      * Event handlers }}}
  2345.      */
  2346.  
  2347.  
  2348.     /*
  2349.      * Helper methods. You should not change/derive those in your plugin, but use them only. {{{
  2350.      */
  2351.  
  2352.     /**
  2353.      * Get a string, unqiue for the plugin, usable in HTML form elements.
  2354.      *
  2355.      * @param string Optional text to append (gets prefixed with "_").
  2356.      * @return string 
  2357.      */
  2358.     function get_class_id$append '' )
  2359.     {
  2360.         return $this->classname.'_id'.$this->ID.$append '_'.$append '' );
  2361.     }
  2362.  
  2363.  
  2364.     /**
  2365.      * Translate a given string, in the Plugin's context.
  2366.      *
  2367.      * This means, that the translation is obtained from the Plugin's "locales" folder.
  2368.      * @link http://manual.b2evolution.net/Localization#Plugins
  2369.      *
  2370.      *  It uses the global/regular {@link T_()} function as a fallback.
  2371.      *
  2372.      * @param string The string (english), that should be translated
  2373.      * @param string Requested locale ({@link $current_locale} gets used by default)
  2374.      * @return string The translated string.
  2375.      * @uses T_()
  2376.      */
  2377.     function T_$string$req_locale '' )
  2378.     {
  2379.         global $plugins_path;
  2380.  
  2381.         $globalfile_path $plugins_path.$this->classname.'/locales/_global.php';
  2382.         $trans $this->_trans;
  2383.  
  2384.         // Load the global messages file, if existing:
  2385.         if$this->_trans_loaded_global )
  2386.         {
  2387.             $this->_trans_loaded_global true;
  2388.  
  2389.             iffile_exists$globalfile_path && is_readable$globalfile_path ) )
  2390.             {
  2391.                 include_once $globalfile_path;
  2392.             }
  2393.             else
  2394.             {
  2395.                 $this->debug_log'T_: Plugin global messages file does not exist or is not readable: '.$globalfile_path'locale' );
  2396.             }
  2397.         }
  2398.  
  2399.         if ( ( $return T_$string$req_localearray(
  2400.                                 'ext_transarray' => $this->_trans,
  2401.                                 'alt_basedir'    => $plugins_path.$this->classname,
  2402.                             ) ) ) == $string )
  2403.         {    // Fallback to global translation file:
  2404.             return T_$string$req_locale );
  2405.         }
  2406.         return $return;
  2407.     }
  2408.  
  2409.  
  2410.     /**
  2411.      * Translate and escape single quotes.
  2412.      *
  2413.      * This is to be used mainly for Javascript strings.
  2414.      *
  2415.      * @uses Plugin::T_()
  2416.      * @since 2.5.0
  2417.      * @param string String to translate
  2418.      * @param string Locale to use
  2419.      * @return string The translated and escaped string.
  2420.      */
  2421.     function TS_$string$req_locale '' )
  2422.     {
  2423.         return str_replace"'""\\'"$this->T_$string$req_locale ) );
  2424.     }
  2425.  
  2426.  
  2427.     /**
  2428.      * Get the absolute URL to the plugin's directory (where the plugins classfile is).
  2429.      * Trailing slash included.
  2430.      *
  2431.      * @param string Get absolute URL? (or make it relative to $ReqHost)
  2432.      * @return string 
  2433.      */
  2434.     function get_plugin_url$abs false )
  2435.     {
  2436.         global $plugins_url$plugins_path;
  2437.  
  2438.         // Get sub-path below $plugins_path, if any:
  2439.         $sub_path preg_replace':^'.preg_quote($plugins_path':').':'''dirname($this->classfile_path).'/' );
  2440.  
  2441.         $r $plugins_url.$sub_path;
  2442.  
  2443.         // Use the same protocol as with current host (so includes from within https do not fail when on http):
  2444.         $r url_same_protocol($r);
  2445.  
  2446.         // Make it relative to current host, if absolute is not required:
  2447.         if$abs )
  2448.         {
  2449.             global $ReqHost;
  2450.             $r url_rel_to_same_host($r$ReqHost);
  2451.         }
  2452.         return $r;
  2453.     }
  2454.  
  2455.  
  2456.     /**
  2457.      * Log a debug message.
  2458.      *
  2459.      * This gets added to {@link $Debuglog the global Debuglog} with
  2460.      * the category '[plugin_classname]_[plugin_ID]'.
  2461.      *
  2462.      * NOTE: if debugging is not enabled (see {@link $debug}), {@link $Debuglog}
  2463.      * is of class {@link Log_noop}, which means it does not accept nor display
  2464.      * messages.
  2465.      *
  2466.      * @param string Message to log.
  2467.      * @param array Optional list of additional categories.
  2468.      */
  2469.     function debug_log$msg$add_cats array() )
  2470.     {
  2471.         global $Debuglog;
  2472.  
  2473.         ifis_array($add_cats) )
  2474.         {
  2475.             $add_cats array($add_cats);
  2476.         }
  2477.  
  2478.         ifisset($this->ID$this->classname) )
  2479.         // plugin not yet instantiated. This happens, if the (deprecated) constructor of a plugin gets used.
  2480.             $add_cats[get_class($this).'_?';
  2481.         }
  2482.         else
  2483.         {
  2484.             $add_cats[$this->classname.'_'.$this->ID;
  2485.         }
  2486.         $Debuglog->add$msg$add_cats );
  2487.     }
  2488.  
  2489.  
  2490.     /**
  2491.      * Get the URL to call a plugin method through http. This links to the /htsrv/call_plugin.php
  2492.      * file.
  2493.      *
  2494.      * It uses either {@link $htsrv_url} or {@link $htsrv_url_sensitive} (if {@link $ReqHost} is on https).
  2495.      *
  2496.      * NOTE: AJAX callbacks are required to be on the same domain/protocol, so if you're using absolute
  2497.      *       blog URLs on different domains you must set {@link $htsrv_url} dynamically, to use the same domain!
  2498.      *
  2499.      * @todo dh> we might want to provide whitelisting of methods through {@link $Session} here and check for it in the htsrv handler.
  2500.      *
  2501.      * @param string Method to call. This must be listed in {@link GetHtsrvMethods()}.
  2502.      * @param array Array of optional parameters passed to the method.
  2503.      * @param string Glue for additional GET params used internally.
  2504.      * @param string Get absolute URL? (or cut off $ReqHost at the beginning)
  2505.      * @return string The URL
  2506.      */
  2507.     function get_htsrv_url$method$params array()$glue '&amp;'$abs false )
  2508.     {
  2509.         global $htsrv_url$htsrv_url_sensitive;
  2510.         global $ReqHost$Blog;
  2511.  
  2512.         $base substr($ReqHost06== 'https:' $htsrv_url_sensitive $htsrv_url;
  2513.  
  2514.         if$abs && strpos$base$ReqHost === )
  2515.         // cut off $ReqHost if the resulting URL starts with it:
  2516.             $base substr($basestrlen($ReqHost));
  2517.         }
  2518.  
  2519.         $r $base.'call_plugin.php?plugin_ID='.$this->ID.$glue.'method='.$method;
  2520.         if!empty$params ) )
  2521.         {
  2522.             $r .= $glue.'params='.rawurlencode(serialize$params ));
  2523.         }
  2524.  
  2525.         return $r;
  2526.     }
  2527.  
  2528.  
  2529.     /**
  2530.      * A simple wrapper around the {@link $Messages} object with a default
  2531.      * catgory of 'note'.
  2532.      *
  2533.      * @param string Message
  2534.      * @param string|arraycategory ('note', 'error', 'success'; default: 'note')
  2535.      */
  2536.     function msg$msg$category 'note' )
  2537.     {
  2538.         global $Messages;
  2539.         $Messages->add$msg$category );
  2540.     }
  2541.  
  2542.  
  2543.     /**
  2544.      * Register a tab (sub-menu) for the backoffice Tools menus.
  2545.      *
  2546.      * @param string Text for the tab.
  2547.      * @param string|arrayPath to add the menu entry into.
  2548.      *         See {@link AdminUI::add_menu_entries()}. Default: 'tools' for the Tools menu.
  2549.      * @param array Optional params. See {@link AdminUI::add_menu_entries()}.
  2550.      */
  2551.     function register_menu_entry$text$path 'tools'$menu_entry_props array() )
  2552.     {
  2553.         global $AdminUI;
  2554.  
  2555.         $menu_entry_props['text'$text;
  2556.         $menu_entry_props['href'$this->get_tools_tab_url();
  2557.  
  2558.         $AdminUI->add_menu_entries$patharray'plug_ID_'.$this->ID => $menu_entry_props ) );
  2559.     }
  2560.  
  2561.  
  2562.     /**
  2563.      * Get URL for the tools tab for this plugin.
  2564.      *
  2565.      * The tools tab must be provided with AdminTabPayload()
  2566.      */
  2567.     function get_tools_tab_url()
  2568.     {
  2569.         global $admin_url;
  2570.         return $admin_url.'?ctrl=tools&amp;tab=plug_ID_'.$this->ID;
  2571.     }
  2572.  
  2573.  
  2574.     /**
  2575.      * Check if the requested list of events is provided by any or one plugin.
  2576.      *
  2577.      * @param array|stringA single event or a list thereof
  2578.      * @param boolean Make sure there's at least one plugin that provides them all?
  2579.      *                 This is useful for event pairs like "CaptchaPayload" and "CaptchaValidated", which
  2580.      *                 should be served by the same plugin.
  2581.      * @return boolean 
  2582.      */
  2583.     function are_events_available$events$by_one_plugin false )
  2584.     {
  2585.         global $Plugins;
  2586.  
  2587.         return $Plugins->are_events_available$events$by_one_plugin );
  2588.     }
  2589.  
  2590.  
  2591.     /**
  2592.      * Set the status of the plugin.
  2593.      *
  2594.      * @param string 'enabled', 'disabled' or 'needs_config'
  2595.      * @return boolean 
  2596.      */
  2597.     function set_status$status )
  2598.     {
  2599.         global $Plugins;
  2600.  
  2601.         ifin_array$statusarray'enabled''disabled''needs_config' ) ) )
  2602.         {
  2603.             return false;
  2604.         }
  2605.  
  2606.         return $Plugins->set_Plugin_status$this$status );
  2607.     }
  2608.  
  2609.  
  2610.     /**
  2611.      * Get canonical name for database tables a plugin uses, by adding an unique
  2612.      * prefix for your plugin instance.
  2613.      *
  2614.      * You should use this when refering to your SQL table names.
  2615.      *
  2616.      * E.g., for the "test_plugin" with ID 7 and the default {@link $tableprefix} of "evo_" it
  2617.      * would generate: "evo_plugin_test_7_log" for a requested name "log".
  2618.      *
  2619.      * @param string Your name, which gets returned with the unique prefix.
  2620.      * @return string 
  2621.      */
  2622.     function get_sql_table$name )
  2623.     {
  2624.         global $tableprefix;
  2625.  
  2626.         // NOTE: table name length seems limited to 64 chars (MySQL 5) - classname is limited to 40 (in T_plugins)
  2627.         return $tableprefix.'plugin_'.preg_replace'#_plugin$#'''$this->classname ).'_'.$this->ID.'_'.$name;
  2628.     }
  2629.  
  2630.  
  2631.     /**
  2632.      * Stop propagation of the event to next plugins (with lower priority)
  2633.      * in events that get triggered for a batch of Plugins.
  2634.      *
  2635.      * @see Plugins::trigger_event()
  2636.      * @see Plugins::stop_propagation()
  2637.      */
  2638.     function stop_propagation()
  2639.     {
  2640.         global $Plugins;
  2641.         $Plugins->stop_propagation();
  2642.     }
  2643.  
  2644.  
  2645.     /**
  2646.      * Set a data value for the session.
  2647.      *
  2648.      * NOTE: the session data is limited to about 64kb, so do not use it for huge data!
  2649.      *       Please consider using an own database table (see {@link Plugin::GetDbLayout()}).
  2650.      *
  2651.      * @param string Name of the data's key (gets prefixed with 'plugIDX_' internally).
  2652.      * @param mixed The value
  2653.      * @param integer Time in seconds for data to expire (0 to disable).
  2654.      * @param boolean Should the data get saved immediately? (otherwise it gets saved on script shutdown)
  2655.      */
  2656.     function session_set$name$value$timeout$save_immediately false )
  2657.     {
  2658.         global $Session;
  2659.  
  2660.         $r $Session->set'plugID'.$this->ID.'_'.$name$value$timeout );
  2661.         if$save_immediately )
  2662.         {
  2663.             $Session->dbsave();
  2664.         }
  2665.         return $r;
  2666.     }
  2667.  
  2668.  
  2669.     /**
  2670.      * Get a data value for the session, using a unique prefix to the Plugin.
  2671.      * This checks for the data to be expired and unsets it then.
  2672.      *
  2673.      * @param string Name of the data's key (gets prefixed with 'plugIDX_' internally).
  2674.      * @param mixed Default value to use if key is not set or has expired. (since 1.10.0)
  2675.      * @return mixed The value, if set; otherwise $default
  2676.      */
  2677.     function session_get$name$default NULL )
  2678.     {
  2679.         global $Session;
  2680.  
  2681.         return $Session->get'plugID'.$this->ID.'_'.$name$default );
  2682.     }
  2683.  
  2684.  
  2685.     /**
  2686.      * Delete a value from the session data, using a unique prefix to the Plugin.
  2687.      *
  2688.      * @param string Name of the data's key (gets prefixed with 'plugIDX_' internally).
  2689.      */
  2690.     function session_delete$name )
  2691.     {
  2692.         global $Session;
  2693.  
  2694.         return $Session->delete'plugID'.$this->ID.'_'.$name );
  2695.     }
  2696.  
  2697.  
  2698.     /**
  2699.      * Call this to unregister all your events for the current request.
  2700.      */
  2701.     function forget_events()
  2702.     {
  2703.         global $Plugins;
  2704.         $Plugins->forget_events$this->ID );
  2705.     }
  2706.  
  2707.  
  2708.     /**
  2709.      * Disable an event.
  2710.      *
  2711.      * This removes it from the events table.
  2712.      *
  2713.      * @return boolean True, if status has changed; false if it was disabled already
  2714.      */
  2715.     function disable_event$event )
  2716.     {
  2717.         $Plugins_admin get_Plugins_admin();
  2718.         return $Plugins_admin->set_event_status$this->ID$event);
  2719.     }
  2720.  
  2721.  
  2722.     /**
  2723.      * Enable an event.
  2724.      *
  2725.      * This adds it to the events table.
  2726.      *
  2727.      * @return boolean True, if status has changed; false if it was enabled already
  2728.      */
  2729.     function enable_event$event )
  2730.     {
  2731.         $Plugins_admin get_Plugins_admin();
  2732.         return $Plugins_admin->set_event_status$this->ID$event);
  2733.     }
  2734.  
  2735.     /*
  2736.      * Helper methods }}}
  2737.      */
  2738.  
  2739.  
  2740.     /*
  2741.      * Interface methods. You should not override those! {{{
  2742.      *
  2743.      * These are used to access certain plugin internals.
  2744.      */
  2745.  
  2746.     /**
  2747.      * Get a link to a help page (with icon).
  2748.      *
  2749.      * @param string Target; one of the following:
  2750.      *          - anchor to {@link $help_url} ("#anchor")
  2751.      *          - absolute link to some URL, e.g. "http://example.com/example.php"
  2752.      *          - '$help_url' or empty for {@link $help_url}, then also the "www" icon gets used
  2753.      *          - '$readme' to link to the plugin's README.html file (if available)
  2754.      * @return string The html A tag, linking to the help (or empty in case of $readme, if there is none).
  2755.      */
  2756.     function get_help_link$target '' )
  2757.     {
  2758.         static $target_counter 0;
  2759.         $title '';
  2760.         $icon 'help';
  2761.         $word '';
  2762.         $link_attribs array'target' => '_blank''id'=>'anchor_help_plugin_'.$this->ID.'_'.$target_counter++ );
  2763.  
  2764.         if$target == '$help_url' || empty($target) )
  2765.         {
  2766.             $url $this->get_help_url();
  2767.             $title T_('Homepage of the plugin');
  2768.             $icon 'www';
  2769.         }
  2770.         elseif$target == '$readme' )
  2771.         // README
  2772.             if$this->get_help_file() )
  2773.             {
  2774.                 return '';
  2775.             }
  2776.  
  2777.             global $admin_url;
  2778.  
  2779.             $link_attribs['use_js_popup'true;
  2780.             $link_attribs['use_js_size''500, 400';
  2781.             $title T_('Local documentation of the plugin');
  2782.             $url url_add_param$admin_url'ctrl=plugins&amp;action=disp_help_plain&amp;plugin_class='.$this->classname );
  2783.             $icon 'help';
  2784.         }
  2785.         elseifsubstr($target01== '#' )
  2786.         // anchor
  2787.             $url $this->get_help_url().$target;
  2788.         }
  2789.         elseifpreg_match'~^https?://~'$target ) )
  2790.         // absolute URL (strict match to allow other formats later if needed)
  2791.             $url $target;
  2792.         }
  2793.         else
  2794.         {
  2795.             debug_die'Invalid get_help_link() target: '.$target );
  2796.         }
  2797.  
  2798.         return action_icon$title$icon$url$word41$link_attribs );
  2799.     }
  2800.  
  2801.  
  2802.     /**
  2803.      * Get the plugin's external help/website URL.
  2804.      *
  2805.      * If {@link Plugin::$help_url} is empty, it defaults to the manual wiki.
  2806.      *
  2807.      * @return string 
  2808.      */
  2809.     function get_help_url()
  2810.     {
  2811.         ifempty$this->help_url ) )
  2812.         {
  2813.             return 'http://manual.b2evolution.net/'.strtoupper($this->classname[0]).substr($this->classname,1);
  2814.         }
  2815.         else
  2816.         {
  2817.             return $this->help_url;
  2818.         }
  2819.     }
  2820.  
  2821.  
  2822.     /**
  2823.      * @deprecated Backwards compatibility wrapper (for 1.8)
  2824.      */
  2825.     function get_README_link()
  2826.     {
  2827.         return $this->get_help_link('$readme');
  2828.     }
  2829.  
  2830.  
  2831.     /**
  2832.      * Get the help file for a Plugin ID. README.LOCALE.html will take
  2833.      * precedence above the general (english) README.html.
  2834.      *
  2835.      * @todo Handle encoding of files (to $io_charset)
  2836.      *
  2837.      * @return false|string
  2838.      */
  2839.     function get_help_file()
  2840.     {
  2841.         global $default_locale$plugins_path$current_User;
  2842.  
  2843.         if$current_User->check_perm'options''view'false ) )
  2844.         // README gets displayed through plugins controller, which requires these perms
  2845.             // TODO: Catch "disp_help" and "disp_help_plain" messages in plugins.php before general perms check!?
  2846.             return false;
  2847.         }
  2848.  
  2849.         // Get the language. We use $default_locale because it does not have to be activated ($current_locale)
  2850.         $lang substr$default_locale0);
  2851.  
  2852.         $help_dir dirname($this->classfile_path).'/';
  2853.         if$help_dir == $plugins_path )
  2854.         {
  2855.             $help_dir .= $this->classname.'/';
  2856.         }
  2857.  
  2858.         // Try help for the user's locale:
  2859.         $help_file $help_dir.'README.'.$lang.'.html';
  2860.  
  2861.         iffile_exists($help_file) )
  2862.         // Fallback: README.html
  2863.             $help_file $help_dir.'README.html';
  2864.  
  2865.             iffile_exists($help_file) )
  2866.             {
  2867.                 return false;
  2868.             }
  2869.         }
  2870.  
  2871.         return $help_file;
  2872.     }
  2873.  
  2874.  
  2875.     /**
  2876.      * Get a link to edit the Plugin's settings (if the user has permission).
  2877.      *
  2878.      * @return false|string
  2879.      */
  2880.     function get_edit_settings_link()
  2881.     {
  2882.         global $current_User$admin_url;
  2883.  
  2884.         if$current_User->check_perm'options''view'false ) )
  2885.         {
  2886.             return false;
  2887.         }
  2888.  
  2889.         return action_iconT_('Edit plugin settings!')'edit'$admin_url.'?ctrl=plugins&amp;action=edit_settings&amp;plugin_ID='.$this->ID );
  2890.     }
  2891.  
  2892.  
  2893.     /**
  2894.      * PHP5 overloading of get method to lazy-load (User)Settings, when they get
  2895.      * accessed.
  2896.      *
  2897.      * With PHP4, settings get instantiated in Plugins::init_settings right away.
  2898.      *
  2899.      * @return Reference to the object or null
  2900.      */
  2901.     function __get$nm )
  2902.     {
  2903.         global $inc_path;
  2904.         global $Plugins;
  2905.  
  2906.         switch$nm )
  2907.         {
  2908.             case 'Settings':
  2909.                 if$this->ID )
  2910.                 {
  2911.                     debug_die('Tried to access "Settings" on a non-installed plugin. ('.$this->classname.'/'.$this->ID.')');
  2912.                 }
  2913.                 $Plugins->instantiate_Settings$this'Settings' );
  2914.                 ifisset($this->Settings) )
  2915.                 {
  2916.                     return $this->Settings;
  2917.                 }
  2918.                 break;
  2919.  
  2920.             case 'UserSettings':
  2921.                 if$this->ID )
  2922.                 {
  2923.                     debug_die('Tried to access "UserSettings" on a non-installed plugin. ('.$this->classname.'/'.$this->ID.')');
  2924.                 }
  2925.                 $Plugins->instantiate_Settings$this'UserSettings' );
  2926.                 ifisset($this->UserSettings) )
  2927.                 {
  2928.                     return $this->UserSettings;
  2929.                 }
  2930.                 break;
  2931.         }
  2932.         $r null;
  2933.         return $r;
  2934.     }
  2935.  
  2936.     /*
  2937.      * Interface methods }}}
  2938.      */
  2939.  
  2940.     /**
  2941.       * Get a skin specific param value from current Blog
  2942.       *
  2943.       * @param string 
  2944.       * @param Blog collection
  2945.      */
  2946.     function get_coll_setting$parname$Blog )
  2947.     {
  2948.         // Name of the setting in the blog settings:
  2949.         $blog_setting_name 'plugin'.$this->ID.'_'.$parname;
  2950.  
  2951.         $value $Blog->get_setting$blog_setting_name );
  2952.  
  2953.         ifis_null$value ) )
  2954.         {    // We have a value for this param:
  2955.             return $value;
  2956.         }
  2957.  
  2958.         // Try default values:
  2959.         $params $this->get_coll_setting_definitions$tmp_params array('for_editing'=>true) );
  2960.         ifisset$params[$parname]['defaultvalue') )
  2961.         {    // We ahve a default value:
  2962.             return $params[$parname]['defaultvalue';
  2963.         }
  2964.  
  2965.         return NULL;
  2966.     }
  2967.  
  2968.  
  2969.     /**
  2970.      * Set a skin specific param value for current Blog
  2971.      *
  2972.      * @param string parameter name
  2973.      * @param mixed parameter value
  2974.      */
  2975.     function set_coll_setting$parname$parvalue )
  2976.     {
  2977.         /**
  2978.          * @var Blog
  2979.          */
  2980.         global $Blog;
  2981.  
  2982.         // Name of the setting in the blog settings:
  2983.         $blog_setting_name 'plugin'.$this->ID.'_'.$parname;
  2984.         $Blog->set_setting$blog_setting_name$parvalue );
  2985.     }
  2986.  
  2987.  
  2988. }
  2989.  
  2990.  
  2991. /*
  2992.  * $Log: _plugin.class.php,v $
  2993.  * Revision 1.35  2010/02/23 05:07:17  sam2kb
  2994.  * New plugin hooks: DisplayProfileFormFieldset and ProfileFormSent
  2995.  *
  2996.  * Revision 1.34  2010/02/08 17:53:23  efy-yury
  2997.  * copyright 2009 -> 2010
  2998.  *
  2999.  * Revision 1.33  2010/01/03 12:36:15  fplanque
  3000.  * Renamed hooks
  3001.  *
  3002.  * Revision 1.32  2010/01/02 20:11:08  sam2kb
  3003.  * Added new hooks: AfterBlogInsert, AfterBlogUpdate, AfterBlogDelete
  3004.  *
  3005.  * Revision 1.31  2009/09/25 07:32:53  efy-cantor
  3006.  * replace get_cache to get_*cache
  3007.  *
  3008.  * Revision 1.30  2009/09/23 21:37:03  blueyed
  3009.  * Unify Debuglogging of T_ methods.
  3010.  *
  3011.  * Revision 1.29  2009/09/06 21:50:25  tblue246
  3012.  * Remove EVO_NEXT_VERSION, which at a point was not replaced and is useless now (since nobody knows by what version it should be replaced now).
  3013.  *
  3014.  * Revision 1.28  2009/08/25 16:54:24  tblue246
  3015.  * Doc
  3016.  *
  3017.  * Revision 1.27  2009/07/06 23:00:33  fplanque
  3018.  * minor
  3019.  *
  3020.  * Revision 1.26  2009/07/04 01:52:51  fplanque
  3021.  * doc
  3022.  *
  3023.  * Revision 1.25  2009/07/02 22:01:14  blueyed
  3024.  * Fix BeforeSessionsDelete: add it to base plugin class, test plugin and implement FPs requirements.
  3025.  *
  3026.  * Revision 1.24  2009/06/22 19:31:07  tblue246
  3027.  * Skin-specific translations ("locales" folder in the skin's folder, directory structure is the same as for plugins).
  3028.  *
  3029.  * Revision 1.23  2009/05/26 20:14:10  blueyed
  3030.  * BeforeDisable now gets triggered only if status gets changed to disabled. Also do not update status, if it would be the same, but add safety net (which rather should be an assert prolly).
  3031.  *
  3032.  * Revision 1.22  2009/05/26 19:31:58  fplanque
  3033.  * Plugins can now have Settings that are specific to each blog.
  3034.  *
  3035.  * Revision 1.21  2009/05/26 18:29:11  fplanque
  3036.  * yeah I know I just fucked up the PHP doc on that but now I can actually READ the options and make sense of them for the first time ever!
  3037.  * No, adding tons of HTML markup in teh comments is not a good idea.
  3038.  * If using ascii lists doesn't resolve to html lists, it's not the comments that ,need to be fixed, it's phpdoc.
  3039.  *
  3040.  * Revision 1.20  2009/03/23 23:04:43  fplanque
  3041.  * Demo of how to tap into menu structure from a plugin.
  3042.  *
  3043.  * Revision 1.19  2009/03/08 23:57:45  fplanque
  3044.  * 2009
  3045.  *
  3046.  * Revision 1.18  2009/03/08 23:34:29  blueyed
  3047.  * Plugin::__get: use $Plugins for instantiating settings. Previously Plugins_admin was used here ("because Plugin::BeforeEnable() may use $Settings"), but that made no sense. Thanks, Tblue.
  3048.  *
  3049.  * Revision 1.17  2009/03/08 23:02:19  blueyed
  3050.  * doc
  3051.  *
  3052.  * Revision 1.16  2009/03/08 22:37:33  fplanque
  3053.  * doc
  3054.  *
  3055.  * Revision 1.15  2009/03/06 14:12:27  tblue246
  3056.  * Added missing documentation for Plugin hooks
  3057.  *
  3058.  * Revision 1.14  2009/03/05 23:38:53  blueyed
  3059.  * Merge autoload branch (lp:~blueyed/b2evolution/autoload) into CVS HEAD.
  3060.  *
  3061.  * Revision 1.13  2009/03/03 20:15:49  tblue246
  3062.  * T_(): Adding workaround for PHP 4 compatibility...
  3063.  *
  3064.  * Revision 1.12  2009/02/28 16:47:56  blueyed
  3065.  * Fix Plugins::init_settings: it is not meant to work for uninstalled plugins. Add according debug_die calls for PHP>=5.1 in Plugin::__get.
  3066.  *
  3067.  * Revision 1.11  2009/02/25 20:15:21  tblue246
  3068.  * L10n:
  3069.  * - Remove Gettext functionality (that means we now use our PHP arrays from the _global.php files only).
  3070.  * - Try to merge most functionality of Plugin::T_() into the global T_() function.
  3071.  *
  3072.  * Revision 1.10  2009/01/22 23:56:47  blueyed
  3073.  * todo
  3074.  *
  3075.  * Revision 1.9  2008/06/17 18:41:34  blueyed
  3076.  * Add Plugin::TS_(), doing the same as TS_() but for plugins.
  3077.  *
  3078.  * Revision 1.8  2008/04/06 19:19:30  fplanque
  3079.  * Started moving some intelligence to the Modules.
  3080.  * 1) Moved menu structure out of the AdminUI class.
  3081.  * It is part of the app structure, not the UI. Up to this point at least.
  3082.  * Note: individual Admin skins can still override the whole menu.
  3083.  * 2) Moved DB schema to the modules. This will be reused outside
  3084.  * of install for integrity checks and backup.
  3085.  * 3) cleaned up config files
  3086.  *
  3087.  * Revision 1.7  2008/02/11 20:53:50  blueyed
  3088.  * fix indent
  3089.  *
  3090.  * Revision 1.6  2008/01/21 09:35:32  fplanque
  3091.  * (c) 2008
  3092.  *
  3093.  * Revision 1.5  2008/01/14 23:41:47  fplanque
  3094.  * cleanup load_funcs( urls ) in main because it is ubiquitously used
  3095.  *
  3096.  * Revision 1.4  2007/09/22 22:11:18  fplanque
  3097.  * minor
  3098.  *
  3099.  * Revision 1.3  2007/08/11 17:59:05  blueyed
  3100.  * Mention also trackback in GetSpamKarmaForComment doc
  3101.  *
  3102.  * Revision 1.2  2007/08/03 20:40:49  blueyed
  3103.  * - doc for todos/discussion
  3104.  * - Made get_plugin_url more usable again
  3105.  *
  3106.  * Revision 1.1  2007/06/25 11:00:41  fplanque
  3107.  * MODULES (refactored MVC)
  3108.  *
  3109.  * Revision 1.161  2007/06/20 21:42:14  fplanque
  3110.  * implemented working widget/plugin params
  3111.  *
  3112.  * Revision 1.160  2007/06/19 22:54:04  blueyed
  3113.  * doc fix
  3114.  *
  3115.  * Revision 1.159  2007/06/19 22:53:25  blueyed
  3116.  * todos/doc fixes
  3117.  *
  3118.  * Revision 1.158  2007/06/19 00:03:26  fplanque
  3119.  * doc / trying to make sense of automatic settings forms generation.
  3120.  *
  3121.  * Revision 1.157  2007/05/28 15:18:30  fplanque
  3122.  * cleanup
  3123.  *
  3124.  * Revision 1.156  2007/05/26 19:05:03  blueyed
  3125.  * Return array() in GetDefaultUserSettings, as with GetDefaultSettings
  3126.  *
  3127.  * Revision 1.155  2007/05/06 21:14:19  personman2
  3128.  * Fixed broken link from Tools > Scheduler to Tools > [any plugin tab]
  3129.  *
  3130.  * Revision 1.154  2007/04/28 22:33:26  blueyed
  3131.  * Fixed "must return reference notice" for __get()
  3132.  *
  3133.  * Revision 1.153  2007/04/26 00:11:08  fplanque
  3134.  * (c) 2007
  3135.  *
  3136.  * Revision 1.152  2007/03/26 21:34:59  blueyed
  3137.  * Removed $Plugin->Plugins reference
  3138.  *
  3139.  * Revision 1.151  2007/03/26 21:04:12  blueyed
  3140.  * Return by reference in __get()
  3141.  *
  3142.  * Revision 1.150  2007/02/28 23:21:53  blueyed
  3143.  * Pass $original_comment to CommentFormSent and "action" to BeforeCommentFormInsert
  3144.  *
  3145.  * Revision 1.149  2007/02/25 02:03:51  fplanque
  3146.  * no message
  3147.  *
  3148.  * Revision 1.148  2007/02/23 00:21:23  blueyed
  3149.  * Fixed Plugins::get_next() if the last Plugin got unregistered; Added AdminBeforeItemEditDelete hook
  3150.  *
  3151.  * Revision 1.147  2007/02/22 22:14:13  blueyed
  3152.  * Improved CommentFormSent hook
  3153.  *
  3154.  * Revision 1.146  2007/02/19 23:20:07  blueyed
  3155.  * Added plugin event SkinEndHtmlBody
  3156.  *
  3157.  * Revision 1.145  2007/02/17 21:12:14  blueyed
  3158.  * Removed magic in Plugin::get_htsrv_url() which used the blog url and assumed that "htsrv" was available in there
  3159.  *
  3160.  * Revision 1.144  2007/02/03 20:25:37  blueyed
  3161.  * Added "sender_name", "sender_email" and "subject" params to MessageFormSent
  3162.  *
  3163.  * Revision 1.143  2007/02/03 19:49:36  blueyed
  3164.  * Added "Blog" param to MessageFormSent hook
  3165.  *
  3166.  * Revision 1.142  2007/01/28 23:58:46  blueyed
  3167.  * - Added hook CommentFormSent
  3168.  * - Re-ordered comment_post.php to: init, validate, process
  3169.  * - RegisterFormSent hook can now filter the form values in a clean way
  3170.  *
  3171.  * Revision 1.141  2007/01/27 16:08:53  blueyed
  3172.  * Pass "User" param to PluginUserSettingsEditDisplayAfter plugin hook
  3173.  *
  3174.  * Revision 1.140  2007/01/27 15:19:06  blueyed
  3175.  * doc
  3176.  *
  3177.  * Revision 1.139  2007/01/26 21:52:42  blueyed
  3178.  * Improved LoginAttempt hook: all params get passed by reference and "pass_ok" has been added
  3179.  *
  3180.  * Revision 1.138  2007/01/25 00:59:49  blueyed
  3181.  * Do not pass "original_comment" in BeforeCommentFormInsert as a reference: makes no sense
  3182.  *
  3183.  * Revision 1.137  2007/01/24 00:48:58  fplanque
  3184.  * Refactoring
  3185.  *
  3186.  * Revision 1.136  2007/01/20 23:48:10  blueyed
  3187.  * Changed plugin default URL to manual.b2evolution.net/classname_plugin
  3188.  *
  3189.  * Revision 1.135  2007/01/17 23:37:10  blueyed
  3190.  * Bypass new $default param in Plugin::session_get()
  3191.  *
  3192.  * Revision 1.134  2007/01/14 18:05:45  blueyed
  3193.  * Optimized "info", "disp_help" and "disp_help_plain" actions by refering to them through classname, which makes Plugins::discover() unnecessary
  3194.  *
  3195.  * Revision 1.133  2007/01/13 16:41:51  blueyed
  3196.  * doc
  3197.  *
  3198.  * Revision 1.132  2007/01/13 03:34:00  fplanque
  3199.  * ...
  3200.  *
  3201.  * Revision 1.131  2007/01/12 21:01:23  blueyed
  3202.  * doc about $Plugins member
  3203.  *
  3204.  * Revision 1.130  2007/01/12 05:14:42  fplanque
  3205.  * doc
  3206.  *
  3207.  * Revision 1.129  2006/12/28 23:20:40  fplanque
  3208.  * added plugin event for displaying comment form toolbars
  3209.  * used by smilies plugin
  3210.  *
  3211.  * Revision 1.128  2006/12/22 22:29:35  blueyed
  3212.  * Support for "multiple" attribute in SELECT elements, especially for GetDefault(User)Settings plugin callback
  3213.  *
  3214.  * Revision 1.127  2006/12/07 23:13:13  fplanque
  3215.  * @var needs to have only one argument: the variable type
  3216.  * Otherwise, I can't code!
  3217.  *
  3218.  * Revision 1.126  2006/12/05 00:24:10  blueyed
  3219.  * doc fix
  3220.  *
  3221.  * Revision 1.125  2006/12/04 00:18:53  fplanque
  3222.  * keeping the login hashing
  3223.  *
  3224.  * Revision 1.123  2006/12/01 20:34:03  blueyed
  3225.  * Moved Plugins::get_apply_rendering_values() and Plugins::set_apply_rendering() to Plugins_admin class
  3226.  *
  3227.  * Revision 1.122  2006/12/01 16:47:26  blueyed
  3228.  * - Use EVO_NEXT_VERSION, which should get replaced with the next version 1.10 or 2.0 or whatever
  3229.  * - "action" param for PluginSettingsValidateSet
  3230.  * - Removed deprecated Plugin::set_param()
  3231.  *
  3232.  * Revision 1.121  2006/12/01 16:26:34  blueyed
  3233.  * Added AdminDisplayCommentFormFieldset hook
  3234.  *
  3235.  * Revision 1.120  2006/12/01 02:03:04  blueyed
  3236.  * Moved Plugins::set_event_status() to Plugins_admin
  3237.  *
  3238.  * Revision 1.119  2006/11/24 18:27:27  blueyed
  3239.  * Fixed link to b2evo CVS browsing interface in file docblocks
  3240.  *
  3241.  * Revision 1.118  2006/11/17 18:36:22  blueyed
  3242.  * dbchanges param for AfterItemUpdate, AfterItemInsert, AfterCommentUpdate and AfterCommentInsert
  3243.  *
  3244.  * Revision 1.117  2006/11/16 23:43:39  blueyed
  3245.  * - "key" entry for array-type Plugin(User)Settings can define an input field for the key of the settings entry
  3246.  * - cleanup
  3247.  *
  3248.  * Revision 1.116  2006/11/15 21:14:04  blueyed
  3249.  * "Restore defaults" in user profile
  3250.  *
  3251.  * Revision 1.115  2006/11/14 00:21:33  blueyed
  3252.  * doc
  3253.  *
  3254.  * Revision 1.114  2006/11/12 02:12:58  blueyed
  3255.  * removed bloat param
  3256.  *
  3257.  * Revision 1.113  2006/11/11 20:33:14  blueyed
  3258.  * Moved BeforeBlogDisplay hook to after $skin has been determined
  3259.  *
  3260.  * Revision 1.112  2006/11/10 17:14:20  blueyed
  3261.  * Added "select_blog" type for Plugin (User)Settings
  3262.  *
  3263.  * Revision 1.111  2006/11/09 22:27:57  blueyed
  3264.  * doc
  3265.  *
  3266.  * Revision 1.110  2006/11/04 18:16:31  blueyed
  3267.  * MFB: note about bug in 1.8.x
  3268.  *
  3269.  * Revision 1.109  2006/11/02 15:57:10  blueyed
  3270.  * doc
  3271.  *
  3272.  * Revision 1.108  2006/11/01 23:18:58  blueyed
  3273.  * Fixed __get()
  3274.  *
  3275.  * Revision 1.106  2006/10/30 19:53:27  blueyed
  3276.  * doc fix
  3277.  *
  3278.  * Revision 1.105  2006/10/30 19:00:36  blueyed
  3279.  * Lazy-loading of Plugin (User)Settings for PHP5 through overloading
  3280.  *
  3281.  * Revision 1.104  2006/10/29 20:07:34  blueyed
  3282.  * Added "app_min" plugin dependency; Deprecated "api_min"
  3283.  *
  3284.  * Revision 1.103  2006/10/28 20:07:01  blueyed
  3285.  * Deprecated Plugin::set_param() - no use
  3286.  *
  3287.  * Revision 1.102  2006/10/28 15:01:36  blueyed
  3288.  * Documentation
  3289.  *
  3290.  * Revision 1.100  2006/10/14 16:27:05  blueyed
  3291.  * Client-side password hashing in the login form.
  3292.  *
  3293.  * Revision 1.99  2006/10/08 22:59:31  blueyed
  3294.  * Added GetProvidedSkins and DisplaySkin hooks. Allow for optimization in Plugins::trigger_event_first_return()
  3295.  *
  3296.  * Revision 1.98  2006/10/08 22:13:06  blueyed
  3297.  * Added "float" type to Plugin Setting types.
  3298.  *
  3299.  * Revision 1.97  2006/10/05 01:06:37  blueyed
  3300.  * Removed dirty "hack"; added ItemApplyAsRenderer hook instead.
  3301.  *
  3302.  * Revision 1.96  2006/10/04 23:51:02  blueyed
  3303.  * Dirty workaround for lazy renderers who detect when they should apply and pre-rendering
  3304.  *
  3305.  * Revision 1.95  2006/10/01 22:21:54  blueyed
  3306.  * edit_layout param fixes/doc
  3307.  *
  3308.  * Revision 1.94  2006/10/01 22:11:42  blueyed
  3309.  * Ping services as plugins.
  3310.  *
  3311.  * Revision 1.93  2006/10/01 15:11:08  blueyed
  3312.  * Added DisplayItemAs* equivs to RenderItemAs*; removed DisplayItemAllFormats; clearing of pre-rendered cache, according to plugin event changes
  3313.  */
  3314. ?>

Documentation generated on Sat, 06 Mar 2010 04:20:50 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).