1<?php 2/** 3 * DokuWiki Plugin cmsmode (Action Component) 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author Andreas Gohr <gohr@cosmocode.de> 7 */ 8class action_plugin_cmsmode_start extends \dokuwiki\Extension\ActionPlugin 9{ 10 11 /** @inheritDoc */ 12 public function register(Doku_Event_Handler $controller) 13 { 14 $controller->register_hook('DOKUWIKI_INIT_DONE', 'AFTER', $this, 'handleStart'); 15 } 16 17 18 /** 19 * Event handler for DOKUWIKI_INIT_DONE 20 * 21 * @see https://www.dokuwiki.org/devel:events:DOKUWIKI_INIT_DONE 22 * @param Doku_Event $event Event object 23 * @param mixed $param optional parameter passed when event was registered 24 * @return void 25 */ 26 public function handleStart(Doku_Event $event, $param) { 27 global $conf; 28 global $INPUT; 29 30 if($INPUT->server->bool('REMOTE_USER')) return; 31 32 if($this->getConf('breadcrumbs')) { 33 $conf['breadcrumbs'] = 0; 34 } 35 if($this->getConf('youarehere')) { 36 $conf['youarehere'] = 0; 37 } 38 39 $disabled = explode(',', $conf['disableactions'].','.$this->getConf('actions')); 40 $disabled = array_map('trim', $disabled); 41 $disabled = array_filter($disabled); 42 $disabled = array_unique($disabled); 43 $conf['disableactions'] = join(',', $disabled); 44 } 45} 46 47