Ignore:
Timestamp:
Jan 9, 2007, 12:38:54 PM (17 years ago)
Author:
rvelices
Message:

Plugins: new way of adding links and content to administration pages...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_plugins.inc.php

    r1699 r1705  
    22// +-----------------------------------------------------------------------+
    33// | PhpWebGallery - a PHP based picture gallery                           |
    4 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
     4// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    55// +-----------------------------------------------------------------------+
    66// | branch        : BSF (Best So Far)
     
    153153}
    154154
    155 
    156155function trigger_action($event, $data=null)
    157156{
     
    196195}
    197196
     197/** Saves some data with the associated plugim id. It can be retrieved later (
     198 * during this script lifetime) using get_plugin_data
     199 * @param string plugin_id
     200 * @param mixed data
     201 * returns true on success, false otherwise
     202 */
     203function set_plugin_data($plugin_id, &$data)
     204{
     205  global $pwg_loaded_plugins;
     206  if ( isset($pwg_loaded_plugins[$plugin_id]) )
     207  {
     208    $pwg_loaded_plugins[$plugin_id]['plugin_data'] = &$data;
     209    return true;
     210  }
     211  return false;
     212}
     213
     214/** Retrieves plugin data saved previously with set_plugin_data
     215 * @param string plugin_id
     216 */
     217function &get_plugin_data($plugin_id)
     218{
     219  global $pwg_loaded_plugins;
     220  if ( isset($pwg_loaded_plugins[$plugin_id]) )
     221  {
     222    return $pwg_loaded_plugins[$plugin_id]['plugin_data'];
     223  }
     224  return null;
     225}
    198226
    199227/* Returns an array of plugins defined in the database
     
    236264  if ( file_exists($file_name) )
    237265  {
     266    global $pwg_loaded_plugins;
     267    $pwg_loaded_plugins[ $plugin['id'] ] = $plugin;
    238268    include_once( $file_name );
    239269  }
     
    243273function load_plugins()
    244274{
    245   global $conf;
     275  global $conf, $pwg_loaded_plugins;
     276  $pwg_loaded_plugins = array();
    246277  if ($conf['enable_plugins'])
    247278  {
Note: See TracChangeset for help on using the changeset viewer.