From e3710957c6b7e12293805a15d0624be7c7054092 Mon Sep 17 00:00:00 2001
From: Gerrit Uitslag <klapinklapin@gmail.com>
Date: Wed, 1 Oct 2014 17:05:40 +0200
Subject: more phpdocs and minor check

---
 inc/pluginutils.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'inc/pluginutils.php')

diff --git a/inc/pluginutils.php b/inc/pluginutils.php
index 911c4e5c0..4d591869d 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 */
-- 
cgit v1.2.3


From a61966c55d9d0ac4b800d65cfc6ee1aea44899b5 Mon Sep 17 00:00:00 2001
From: Christopher Smith <chris@jalakai.co.uk>
Date: Sat, 16 May 2015 19:07:23 +0200
Subject: Provide a function to return admin plugin for the page request.

This was previously carried out in three separate places. Refactor
that code to use the new function.

Update tpl_pageTitle test to use a manager level admin plugin.
---
 inc/pluginutils.php | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

(limited to 'inc/pluginutils.php')

diff --git a/inc/pluginutils.php b/inc/pluginutils.php
index 4d591869d..60f79869f 100644
--- a/inc/pluginutils.php
+++ b/inc/pluginutils.php
@@ -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;
+}
-- 
cgit v1.2.3