xref: /dokuwiki/lib/plugins/admin.php (revision 79e79377626799a77c11aa7849cb9c64305590c8)
1<?php
2/**
3 * Admin Plugin Prototype
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Christopher Smith <chris@jalakai.co.uk>
7 */
8// must be run within Dokuwiki
9if(!defined('DOKU_INC')) die();
10
11/**
12 * All DokuWiki plugins to extend the admin function
13 * need to inherit from this class
14 */
15class DokuWiki_Admin_Plugin extends DokuWiki_Plugin {
16
17    /**
18     * Return the text that is displayed at the main admin menu
19     * (Default localized language string 'menu' is returned, override this function for setting another name)
20     *
21     * @param string $language language code
22     * @return string menu string
23     */
24    public function getMenuText($language) {
25        $menutext = $this->getLang('menu');
26        if (!$menutext) {
27            $info = $this->getInfo();
28            $menutext = $info['name'].' ...';
29        }
30        return $menutext;
31    }
32
33    /**
34     * Determine position in list in admin window
35     * Lower values are sorted up
36     *
37     * @return int
38     */
39    public function getMenuSort() {
40        return 1000;
41    }
42
43    /**
44     * Carry out required processing
45     */
46    public function handle() {
47        trigger_error('handle() not implemented in '.get_class($this), E_USER_WARNING);
48    }
49
50    /**
51     * Output html of the admin page
52     */
53    public function html() {
54        trigger_error('html() not implemented in '.get_class($this), E_USER_WARNING);
55    }
56
57    /**
58     * Return true for access only by admins (config:superuser) or false if managers are allowed as well
59     *
60     * @return bool
61     */
62    public function forAdminOnly() {
63        return true;
64    }
65
66    /**
67     * Return array with ToC items. Items can be created with the html_mktocitem()
68     *
69     * @see html_mktocitem()
70     * @see tpl_toc()
71     *
72     * @return array
73     */
74    public function getTOC(){
75        return array();
76    }
77}
78//Setup VIM: ex: et ts=4 :
79