diff options
author | Andreas Gohr <andi@splitbrain.org> | 2015-06-26 11:07:20 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2015-06-26 11:07:20 +0200 |
commit | 5ddba4576a304c9e62b028c97ee466d79de12429 (patch) | |
tree | 03199c579f9302f0ed1e0b47f9c597a7f9bd2fc7 /inc/pluginutils.php | |
parent | 5114259bf530b89afbb21bd693b1da3f96016b7f (diff) | |
parent | 71c46303d9cd8a321e58a7e7255d13f0d5a5c4eb (diff) | |
download | rpg-5ddba4576a304c9e62b028c97ee466d79de12429.tar.gz rpg-5ddba4576a304c9e62b028c97ee466d79de12429.tar.bz2 |
Merge branch 'master' into styler
* master: (26 commits)
translation update
translation update
Replace old constructor call by __construct() in dokuwiki_xmlrpc_server
translation update
change two spaces to a space
translation update
translation update
translation update
translation update
Upgrade to jQuery 1.11.3 and jQueryUI 1.11.4 closes #1175
update confToHash() inline documentation for new parameter
translation update
Plugins can send usage data
fixed isBundled() check when remote info is unavailable
avoid accessing nonexistant array key. fixes #1165
translation update
Define the negation character in a constant
Ensure single value negation is not affected by white space differences
Ensure filtering only removes empty string values (not other values which PHP evaluates to false)
translation update
...
Diffstat (limited to 'inc/pluginutils.php')
-rw-r--r-- | inc/pluginutils.php | 31 |
1 files changed, 31 insertions, 0 deletions
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; +} |