aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc/pluginutils.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/pluginutils.php')
-rw-r--r--inc/pluginutils.php29
1 files changed, 17 insertions, 12 deletions
diff --git a/inc/pluginutils.php b/inc/pluginutils.php
index 0cd113b14..f1ad82fe6 100644
--- a/inc/pluginutils.php
+++ b/inc/pluginutils.php
@@ -7,8 +7,13 @@
*/
// plugin related constants
+use dokuwiki\Extension\AdminPlugin;
+use dokuwiki\Extension\PluginController;
+use dokuwiki\Extension\PluginInterface;
+
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
-// note that only [a-z0-9]+ is officially supported, this is only to support plugins that don't follow these conventions, too
+// note that only [a-z0-9]+ is officially supported,
+// this is only to support plugins that don't follow these conventions, too
if(!defined('DOKU_PLUGIN_NAME_REGEX')) define('DOKU_PLUGIN_NAME_REGEX', '[a-zA-Z0-9\x7f-\xff]+');
/**
@@ -23,7 +28,7 @@ if(!defined('DOKU_PLUGIN_NAME_REGEX')) define('DOKU_PLUGIN_NAME_REGEX', '[a-zA-Z
* @return array with plugin names or plugin component names
*/
function plugin_list($type='',$all=false) {
- /** @var $plugin_controller Doku_Plugin_Controller */
+ /** @var $plugin_controller PluginController */
global $plugin_controller;
return $plugin_controller->getList($type,$all);
}
@@ -37,10 +42,10 @@ function plugin_list($type='',$all=false) {
* @param $name string name of the plugin to load
* @param $new bool true to return a new instance of the plugin, false to use an already loaded instance
* @param $disabled bool true to load even disabled plugins
- * @return DokuWiki_PluginInterface|null the plugin object or null on failure
+ * @return PluginInterface|null the plugin object or null on failure
*/
function plugin_load($type,$name,$new=false,$disabled=false) {
- /** @var $plugin_controller Doku_Plugin_Controller */
+ /** @var $plugin_controller PluginController */
global $plugin_controller;
return $plugin_controller->load($type,$name,$new,$disabled);
}
@@ -52,7 +57,7 @@ function plugin_load($type,$name,$new=false,$disabled=false) {
* @return bool true disabled, false enabled
*/
function plugin_isdisabled($plugin) {
- /** @var $plugin_controller Doku_Plugin_Controller */
+ /** @var $plugin_controller PluginController */
global $plugin_controller;
return $plugin_controller->isdisabled($plugin);
}
@@ -64,7 +69,7 @@ function plugin_isdisabled($plugin) {
* @return bool true saving succeed, false saving failed
*/
function plugin_enable($plugin) {
- /** @var $plugin_controller Doku_Plugin_Controller */
+ /** @var $plugin_controller PluginController */
global $plugin_controller;
return $plugin_controller->enable($plugin);
}
@@ -76,7 +81,7 @@ function plugin_enable($plugin) {
* @return bool true saving succeed, false saving failed
*/
function plugin_disable($plugin) {
- /** @var $plugin_controller Doku_Plugin_Controller */
+ /** @var $plugin_controller PluginController */
global $plugin_controller;
return $plugin_controller->disable($plugin);
}
@@ -86,11 +91,11 @@ function plugin_disable($plugin) {
*
* @param string $plugin name of plugin
* @return string name of directory
+ * @deprecated 2018-07-20
*/
function plugin_directory($plugin) {
- /** @var $plugin_controller Doku_Plugin_Controller */
- global $plugin_controller;
- return $plugin_controller->get_directory($plugin);
+ dbg_deprecated('$plugin directly');
+ return $plugin;
}
/**
@@ -99,7 +104,7 @@ function plugin_directory($plugin) {
* @return array with arrays of plugin configs
*/
function plugin_getcascade() {
- /** @var $plugin_controller Doku_Plugin_Controller */
+ /** @var $plugin_controller PluginController */
global $plugin_controller;
return $plugin_controller->getCascade();
}
@@ -120,7 +125,7 @@ function plugin_getRequestAdminPlugin(){
$pluginlist = plugin_list('admin');
if (in_array($page, $pluginlist)) {
// attempt to load the plugin
- /** @var $admin_plugin DokuWiki_Admin_Plugin */
+ /** @var $admin_plugin AdminPlugin */
$admin_plugin = plugin_load('admin', $page);
// verify
if ($admin_plugin && !$admin_plugin->isAccessibleByCurrentUser()) {