1<?php 2/** 3 * Admin Plugin Prototype 4 * 5 * All DokuWiki plugins to extend the admin function 6 * need to inherit from this class 7 * 8 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 9 * @author Christopher Smith <chris@jalakai.co.uk> 10 */ 11abstract class DokuWiki_Admin_Plugin extends DokuWiki_Plugin { 12 13 /** 14 * Return the text that is displayed at the main admin menu 15 * (Default localized language string 'menu' is returned, override this function for setting another name) 16 * 17 * @param string $language language code 18 * @return string menu string 19 */ 20 public function getMenuText($language) { 21 $menutext = $this->getLang('menu'); 22 if (!$menutext) { 23 $info = $this->getInfo(); 24 $menutext = $info['name'].' ...'; 25 } 26 return $menutext; 27 } 28 29 /** 30 * Return the path to the icon being displayed in the main admin menu. 31 * By default it tries to find an 'admin.svg' file in the plugin directory. 32 * (Override this function for setting another image) 33 * 34 * Important: you have to return a single path, monochrome SVG icon! It has to be 35 * under 2 Kilobytes! 36 * 37 * We recommend icons from https://materialdesignicons.com/ or to use a matching 38 * style. 39 * 40 * @return string full path to the icon file 41 */ 42 public function getMenuIcon() { 43 $plugin = $this->getPluginName(); 44 return DOKU_PLUGIN . $plugin . '/admin.svg'; 45 } 46 47 /** 48 * Determine position in list in admin window 49 * Lower values are sorted up 50 * 51 * @return int 52 */ 53 public function getMenuSort() { 54 return 1000; 55 } 56 57 /** 58 * Carry out required processing 59 */ 60 public function handle() { 61 // some plugins might not need this 62 } 63 64 /** 65 * Output html of the admin page 66 */ 67 abstract public function html(); 68 69 /** 70 * Return true for access only by admins (config:superuser) or false if managers are allowed as well 71 * 72 * @return bool 73 */ 74 public function forAdminOnly() { 75 return true; 76 } 77 78 /** 79 * Return array with ToC items. Items can be created with the html_mktocitem() 80 * 81 * @see html_mktocitem() 82 * @see tpl_toc() 83 * 84 * @return array 85 */ 86 public function getTOC(){ 87 return array(); 88 } 89} 90//Setup VIM: ex: et ts=4 : 91