summaryrefslogtreecommitdiff
path: root/inc/pluginutils.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/pluginutils.php')
-rw-r--r--inc/pluginutils.php37
1 files changed, 34 insertions, 3 deletions
diff --git a/inc/pluginutils.php b/inc/pluginutils.php
index 911c4e5c0..60f79869f 100644
--- a/inc/pluginutils.php
+++ b/inc/pluginutils.php
@@ -49,7 +49,7 @@ function plugin_load($type,$name,$new=false,$disabled=false) {
* Whether plugin is disabled
*
* @param string $plugin name of plugin
- * @return bool; true disabled, false enabled
+ * @return bool true disabled, false enabled
*/
function plugin_isdisabled($plugin) {
/** @var $plugin_controller Doku_Plugin_Controller */
@@ -61,7 +61,7 @@ function plugin_isdisabled($plugin) {
* Enable the plugin
*
* @param string $plugin name of plugin
- * @return bool; true saving succeed, false saving failed
+ * @return bool true saving succeed, false saving failed
*/
function plugin_enable($plugin) {
/** @var $plugin_controller Doku_Plugin_Controller */
@@ -73,7 +73,7 @@ function plugin_enable($plugin) {
* Disable the plugin
*
* @param string $plugin name of plugin
- * @return bool; true saving succeed, false saving failed
+ * @return bool true saving succeed, false saving failed
*/
function plugin_disable($plugin) {
/** @var $plugin_controller Doku_Plugin_Controller */
@@ -103,3 +103,34 @@ function plugin_getcascade() {
global $plugin_controller;
return $plugin_controller->getCascade();
}
+
+
+/**
+ * Return the currently operating admin plugin or null
+ * if not on an admin plugin page
+ *
+ * @return Doku_Plugin_Admin
+ */
+function plugin_getRequestAdminPlugin(){
+ static $admin_plugin = false;
+ global $ACT,$INPUT,$INFO;
+
+ if ($admin_plugin === false) {
+ if (($ACT == 'admin') && ($page = $INPUT->str('page', '', true)) != '') {
+ $pluginlist = plugin_list('admin');
+ if (in_array($page, $pluginlist)) {
+ // attempt to load the plugin
+ /** @var $admin_plugin DokuWiki_Admin_Plugin */
+ $admin_plugin = plugin_load('admin', $page);
+ // verify
+ if ($admin_plugin && $admin_plugin->forAdminOnly() && !$INFO['isadmin']) {
+ $admin_plugin = null;
+ $INPUT->remove('page');
+ msg('For admins only',-1);
+ }
+ }
+ }
+ }
+
+ return $admin_plugin;
+}