xref: /dokuwiki/inc/pluginutils.php (revision 7521090b08245f81410c713f00d3d7fbaf1afda6)
1ee20e7d1Sandi<?php
2ee20e7d1Sandi/**
3ee20e7d1Sandi * Utilities for handling plugins
4ee20e7d1Sandi *
5ee20e7d1Sandi * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6ee20e7d1Sandi * @author     Andreas Gohr <andi@splitbrain.org>
7ee20e7d1Sandi */
8ee20e7d1Sandi
9087b3a7fSchris// plugin related constants
1003c4aec3Schrisif(!defined('DOKU_PLUGIN'))  define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
11*7521090bSMichael Hamann// note that only [a-z0-9]+ is officially supported, this is only to support plugins that don't follow these conventions, too
12*7521090bSMichael Hamannif(!defined('DOKU_PLUGIN_NAME_REGEX')) define('DOKU_PLUGIN_NAME_REGEX', '[a-zA-Z0-9\x7f-\xff]+');
1310e43949SChris Smith
1410e43949SChris Smith/**
1510e43949SChris Smith * Original plugin functions, remain for backwards compatibility
1610e43949SChris Smith */
17db959ae3SAndreas Gohrfunction plugin_list($type='',$all=false) {
18db959ae3SAndreas Gohr    global $plugin_controller;
19db959ae3SAndreas Gohr    return $plugin_controller->getList($type,$all);
20db959ae3SAndreas Gohr}
21b838050eSPiyush Mishrafunction plugin_load($type,$name,$new=false,$disabled=false) {
22db959ae3SAndreas Gohr    global $plugin_controller;
23db6f7eaeSAndreas Gohr    return $plugin_controller->load($type,$name,$new,$disabled);
24db959ae3SAndreas Gohr}
25db959ae3SAndreas Gohrfunction plugin_isdisabled($plugin) {
26db959ae3SAndreas Gohr    global $plugin_controller;
27db959ae3SAndreas Gohr    return $plugin_controller->isdisabled($plugin);
28db959ae3SAndreas Gohr}
29db959ae3SAndreas Gohrfunction plugin_enable($plugin) {
30db959ae3SAndreas Gohr    global $plugin_controller;
31db959ae3SAndreas Gohr    return $plugin_controller->enable($plugin);
32db959ae3SAndreas Gohr}
33db959ae3SAndreas Gohrfunction plugin_disable($plugin) {
34db959ae3SAndreas Gohr    global $plugin_controller;
35db959ae3SAndreas Gohr    return $plugin_controller->disable($plugin);
36db959ae3SAndreas Gohr}
37db959ae3SAndreas Gohrfunction plugin_directory($plugin) {
38db959ae3SAndreas Gohr    global $plugin_controller;
39db959ae3SAndreas Gohr    return $plugin_controller->get_directory($plugin);
40db959ae3SAndreas Gohr}
41b838050eSPiyush Mishrafunction plugin_getcascade() {
42b838050eSPiyush Mishra    global $plugin_controller;
43b838050eSPiyush Mishra    return $plugin_controller->getCascade();
44b838050eSPiyush Mishra}
45