summaryrefslogtreecommitdiff
path: root/inc/pluginutils.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2005-07-30 23:51:56 +0200
committerAndreas Gohr <andi@splitbrain.org>2005-07-30 23:51:56 +0200
commita46d0d658b98649869f6c9660e168af3940d7c30 (patch)
tree31bd3d6bd347602ae1e632be3c03b50b284a562d /inc/pluginutils.php
parent1e694c4cf2863c5f7211a2e888f79249c9383696 (diff)
downloadrpg-a46d0d658b98649869f6c9660e168af3940d7c30.tar.gz
rpg-a46d0d658b98649869f6c9660e168af3940d7c30.tar.bz2
Changed pluginloading to use references
This patch allows the use of $this in syntax plugins to set internal variables and let them remain between handle and render calls. Even when it is possible now to use this method you should exchange data betwenn handler and render calls by using the $data array only. darcs-hash:20050730215156-7ad00-69ea79859360d9902533633395de3e1b677f6e46.gz
Diffstat (limited to 'inc/pluginutils.php')
-rw-r--r--inc/pluginutils.php13
1 files changed, 5 insertions, 8 deletions
diff --git a/inc/pluginutils.php b/inc/pluginutils.php
index 49dd44816..6c758a1be 100644
--- a/inc/pluginutils.php
+++ b/inc/pluginutils.php
@@ -34,29 +34,26 @@ function plugin_list($type){
*
* @param $type string type of plugin to load
* @param $name string name of the plugin to load
- * @param $ref ref will contain the plugin object
- * @return boolean plugin loading successful?
+ * @return object the plugin object or null on failure
*/
-function plugin_load($type,$name,&$ref){
+function &plugin_load($type,$name){
//we keep all loaded plugins available in global scope for reuse
global $DOKU_PLUGINS;
//plugin already loaded?
if($DOKU_PLUGINS[$type][$name] != null){
- $ref = $DOKU_PLUGINS[$type][$name];
- return true;
+ return $DOKU_PLUGINS[$type][$name];
}
//try to load the wanted plugin file
if(!include_once(DOKU_PLUGIN.$name.'/'.$type.'.php')){
- return false;
+ return null;
}
//construct class and instanciate
$class = $type.'_plugin_'.$name;
$DOKU_PLUGINS[$type][$name] = new $class;
- $ref = $DOKU_PLUGINS[$type][$name];
- return true;
+ return $DOKU_PLUGINS[$type][$name];
}