diff --git a/inc/parserutils.php b/inc/parserutils.php index 414e2e3d65fe86cf05a2ff7f0529833e2356058e..9f8b88cb65e43f15521ed116d94351386c89a881 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -594,7 +594,7 @@ function & p_get_renderer($mode) { $Renderer = & new $rclass(); }else{ // Maybe a plugin is available? - $Renderer =& plugin_load('renderer',$rname); + $Renderer =& plugin_load('renderer',$rname, true); if(is_null($Renderer)){ msg("No renderer '$rname' found for mode '$mode'",-1); return null; diff --git a/inc/pluginutils.php b/inc/pluginutils.php index 55c03f4a5c278f3042f2813dc4f5dd51e66cc4e7..100f781f21c3114974d02d3d4cdee1698410dfe3 100644 --- a/inc/pluginutils.php +++ b/inc/pluginutils.php @@ -60,16 +60,21 @@ function plugin_list($type='',$all=false){ * * @param $type string type of plugin to load * @param $name string name of the plugin to load + * @param $new bool true to return a new instance of the plugin, false to use an already loaded instance * @return objectreference the plugin object or null on failure */ -function &plugin_load($type,$name){ +function &plugin_load($type,$name,$new=false){ //we keep all loaded plugins available in global scope for reuse global $DOKU_PLUGINS; - //plugin already loaded? if(!empty($DOKU_PLUGINS[$type][$name])){ - return $DOKU_PLUGINS[$type][$name]; + if ($new) { + $class = $type.'_plugin_'.$name; + return class_exists($class) ? new $class : null; + } else { + return $DOKU_PLUGINS[$type][$name]; + } } //try to load the wanted plugin file