diff --git a/inc/plugin.php b/inc/plugin.php index 763b57bf2ff63163b2f822f356044fe0bd2a6a61..33cb06c877310d99f0726322795acdad2085cdfe 100644 --- a/inc/plugin.php +++ b/inc/plugin.php @@ -215,6 +215,15 @@ class DokuWiki_Plugin { return p_render($format, p_get_instructions($text),$info); } + /** + * Allow the plugin to prevent DokuWiki creating a second instance of itself + * + * @return bool true if the plugin can not be instantiated more than once + */ + function isSingleton() { + return false; + } + // deprecated functions function plugin_localFN($id) { return $this->localFN($id); } function plugin_locale_xhtml($id) { return $this->locale_xhtml($id); } diff --git a/inc/plugincontroller.class.php b/inc/plugincontroller.class.php index 670dcff5d4051cd9e01795240f3327985ece6b9b..924a475e05a91362d8709cc805c20b98ea53d17a 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 { diff --git a/lib/plugins/syntax.php b/lib/plugins/syntax.php index 7ded173cdc73724f860a592a2328ab0c30f83a0e..126e01952df3516b83f25ef1e2942ea189f791ff 100644 --- a/lib/plugins/syntax.php +++ b/lib/plugins/syntax.php @@ -266,5 +266,13 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { return $conf; } + /** + * Allow the plugin to prevent DokuWiki creating a second instance of itself + * + * @return bool true if the plugin can not be instantiated more than once + */ + function isSingleton() { + return false; + } } //Setup VIM: ex: et ts=4 enc=utf-8 :