xref: /dokuwiki/inc/pluginutils.php (revision db959ae30700e3924a73350a3a43a2c36b431de7)
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/');
1106207565SChris Smithrequire_once(DOKU_INC.'inc/plugincontroller.class.php');
1210e43949SChris Smith
137d992a19SEsther Brunner$plugin_types = array('admin','syntax','action','renderer', 'helper');
144b15e09dSAndreas Gohr
1510e43949SChris Smithglobal $plugin_controller_class, $plugin_controller;
1610e43949SChris Smithif (empty($plugin_controller_class)) $plugin_controller_class = 'Doku_Plugin_Controller';
1710e43949SChris Smith
1810e43949SChris Smith$plugin_controller = new $plugin_controller_class();
1910e43949SChris Smith
2010e43949SChris Smith/**
2110e43949SChris Smith * Original plugin functions, remain for backwards compatibility
2210e43949SChris Smith */
23*db959ae3SAndreas Gohrfunction plugin_list($type='',$all=false) {
24*db959ae3SAndreas Gohr    global $plugin_controller;
25*db959ae3SAndreas Gohr    return $plugin_controller->getList($type,$all);
26*db959ae3SAndreas Gohr}
27*db959ae3SAndreas Gohrfunction &plugin_load($type,$name,$new=false) {
28*db959ae3SAndreas Gohr    global $plugin_controller;
29*db959ae3SAndreas Gohr    return $plugin_controller->load($type,$name,$new);
30*db959ae3SAndreas Gohr}
31*db959ae3SAndreas Gohrfunction plugin_isdisabled($plugin) {
32*db959ae3SAndreas Gohr    global $plugin_controller;
33*db959ae3SAndreas Gohr    return $plugin_controller->isdisabled($plugin);
34*db959ae3SAndreas Gohr}
35*db959ae3SAndreas Gohrfunction plugin_enable($plugin) {
36*db959ae3SAndreas Gohr    global $plugin_controller;
37*db959ae3SAndreas Gohr    return $plugin_controller->enable($plugin);
38*db959ae3SAndreas Gohr}
39*db959ae3SAndreas Gohrfunction plugin_disable($plugin) {
40*db959ae3SAndreas Gohr    global $plugin_controller;
41*db959ae3SAndreas Gohr    return $plugin_controller->disable($plugin);
42*db959ae3SAndreas Gohr}
43*db959ae3SAndreas Gohrfunction plugin_directory($plugin) {
44*db959ae3SAndreas Gohr    global $plugin_controller;
45*db959ae3SAndreas Gohr    return $plugin_controller->get_directory($plugin);
46*db959ae3SAndreas Gohr}
4710e43949SChris Smith
48