1<?php 2/** 3 * DokuWiki Plugin nosecedit (Action Component) 4 * 5 * 6 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 7 * @author lisps 8 * @author einhirn 9 */ 10 11use dokuwiki\Extension\ActionPlugin; 12use dokuwiki\Extension\EventHandler; 13use dokuwiki\Extension\Event; 14 15class action_plugin_nosecedit extends DokuWiki_Action_Plugin 16{ 17 /** 18 * Register its handlers with the DokuWiki's event controller 19 */ 20 public function register(EventHandler $controller) 21 { 22 $controller->register_hook('HTML_SECEDIT_BUTTON', 'BEFORE', $this, 'html_secedit_button'); 23 } 24 25 public function html_secedit_button(Event $event) 26 { 27 global $ID; 28 29 //Section event? 30 if ($event->data['target'] !== 'section' && $event->data['target'] !== 'table') 31 { 32 return; 33 } 34 35 //disable requested? 36 if (p_get_metadata($ID,"sectionedit",FALSE) == "off") 37 { 38 $event->data['name'] = ""; 39 } 40 } 41} 42# vi:ts=4 sw=4 et 43# 44