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 * Return the path to the icon being displayed in the main admin menu. 35 * By default it tries to find an 'admin.svg' file in the plugin directory. 36 * (Override this function for setting another image) 37 * 38 * Important: you have to return a single path, monochrome SVG icon! It has to be 39 * under 1024 bytes! 40 * 41 * We recommend icons from https://materialdesignicons.com/ or to use a matching 42 * style. 43 * 44 * @return string full path to the icon file 45 */ 46 public function getMenuIcon() { 47 $plugin = $this->getPluginName(); 48 return DOKU_PLUGIN . $plugin . '/admin.svg'; 49 } 50 51 /** 52 * Determine position in list in admin window 53 * Lower values are sorted up 54 * 55 * @return int 56 */ 57 public function getMenuSort() { 58 return 1000; 59 } 60 61 /** 62 * Carry out required processing 63 */ 64 public function handle() { 65 trigger_error('handle() not implemented in '.get_class($this), E_USER_WARNING); 66 } 67 68 /** 69 * Output html of the admin page 70 */ 71 public function html() { 72 trigger_error('html() not implemented in '.get_class($this), E_USER_WARNING); 73 } 74 75 /** 76 * Return true for access only by admins (config:superuser) or false if managers are allowed as well 77 * 78 * @return bool 79 */ 80 public function forAdminOnly() { 81 return true; 82 } 83 84 /** 85 * Return array with ToC items. Items can be created with the html_mktocitem() 86 * 87 * @see html_mktocitem() 88 * @see tpl_toc() 89 * 90 * @return array 91 */ 92 public function getTOC(){ 93 return array(); 94 } 95} 96//Setup VIM: ex: et ts=4 : 97