From e842bd07d5bcb07c236b970d1c91c8b101753b0e Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 11 Feb 2009 15:35:20 +0100 Subject: Fix for FS#1598 - allow a plugin to be a singleton if it so desires DokuWiki typically instantiates a plugin once and reuses that instance whenever the plugin is required. However on some occasions DokuWiki will request a new instantiation of a plugin. This particularly applies to render plugins. This patch allows a plugin to force DokuWiki to reuse the existing instance. If a plugin wishes to only be instantiated once then it should implement an "isSingleton()" method and that method should return boolean true. darcs-hash:20090211143520-f07c6-5c1a33dbed55f0b196a204745fe3139f3c7c0aa9.gz --- inc/plugincontroller.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/plugincontroller.class.php') diff --git a/inc/plugincontroller.class.php b/inc/plugincontroller.class.php index 670dcff5d..924a475e0 100644 --- a/inc/plugincontroller.class.php +++ b/inc/plugincontroller.class.php @@ -66,7 +66,7 @@ class Doku_Plugin_Controller { //plugin already loaded? if(!empty($DOKU_PLUGINS[$type][$name])){ - if ($new) { + if ($new && !$DOKU_PLUGINS[$type][$name]->isSingleton()) { $class = $type.'_plugin_'.$name; return class_exists($class) ? new $class : null; } else { -- cgit v1.2.3