diff options
author | rvelices <rv-github@modusoptimus.com> | 2007-01-09 11:38:54 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2007-01-09 11:38:54 +0000 |
commit | b910549db2dc6e5b62750ac6faa68ea406d7b142 (patch) | |
tree | cb0e93aac7fc6d54adedc8230a8e7d16f4a20fb7 /include | |
parent | c841c568f6d6f098fc097b7d8ee06c8602aa03d4 (diff) |
Plugins: new way of adding links and content to administration pages...
git-svn-id: http://piwigo.org/svn/trunk@1705 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/functions_plugins.inc.php | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/include/functions_plugins.inc.php b/include/functions_plugins.inc.php index 204d4e315..ccc52d194 100644 --- a/include/functions_plugins.inc.php +++ b/include/functions_plugins.inc.php @@ -1,7 +1,7 @@ <?php // +-----------------------------------------------------------------------+ // | PhpWebGallery - a PHP based picture gallery | -// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | +// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | // +-----------------------------------------------------------------------+ // | branch : BSF (Best So Far) // | file : $Id$ @@ -152,7 +152,6 @@ function trigger_event($event, $data=null) return $data; } - function trigger_action($event, $data=null) { global $pwg_event_handlers; @@ -195,6 +194,35 @@ function trigger_action($event, $data=null) } } +/** Saves some data with the associated plugim id. It can be retrieved later ( + * during this script lifetime) using get_plugin_data + * @param string plugin_id + * @param mixed data + * returns true on success, false otherwise + */ +function set_plugin_data($plugin_id, &$data) +{ + global $pwg_loaded_plugins; + if ( isset($pwg_loaded_plugins[$plugin_id]) ) + { + $pwg_loaded_plugins[$plugin_id]['plugin_data'] = &$data; + return true; + } + return false; +} + +/** Retrieves plugin data saved previously with set_plugin_data + * @param string plugin_id + */ +function &get_plugin_data($plugin_id) +{ + global $pwg_loaded_plugins; + if ( isset($pwg_loaded_plugins[$plugin_id]) ) + { + return $pwg_loaded_plugins[$plugin_id]['plugin_data']; + } + return null; +} /* Returns an array of plugins defined in the database * @param string $state optional filter on this state @@ -235,6 +263,8 @@ function load_plugin($plugin) $file_name = PHPWG_PLUGINS_PATH.$plugin['id'].'/main.inc.php'; if ( file_exists($file_name) ) { + global $pwg_loaded_plugins; + $pwg_loaded_plugins[ $plugin['id'] ] = $plugin; include_once( $file_name ); } } @@ -242,7 +272,8 @@ function load_plugin($plugin) /*loads all the plugins on startup*/ function load_plugins() { - global $conf; + global $conf, $pwg_loaded_plugins; + $pwg_loaded_plugins = array(); if ($conf['enable_plugins']) { $plugins = get_db_plugins('active'); |