1<?php
2/**
3 * Nosidebar Plugin: Disables DokuWikis internal sidebar for individual pages
4 *
5 * Syntax: ~~NOSIDEBAR~~
6 *
7 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
8 * @author     Matthias Schulte <dokuwiki@lupo49.de>
9 * @version    2013-07-14
10 */
11
12if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
13if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
14require_once(DOKU_PLUGIN.'syntax.php');
15
16class syntax_plugin_nosidebar extends DokuWiki_Syntax_Plugin {
17
18    function getType(){ return 'substition'; }
19    function getPType(){ return 'normal'; }
20    function getSort(){ return 990; }
21
22    function connectTo($mode) {
23        $this->Lexer->addSpecialPattern('~~NOSIDEBAR~~', $mode, 'plugin_nosidebar');
24    }
25
26    function handle($match, $state, $pos, Doku_Handler $handler){
27        return true;
28    }
29
30    function render($mode, Doku_Renderer $renderer, $data) {
31        if($mode == "metadata") {
32            // set flag in metadata to disable sidebar in action component
33            $renderer->meta['nosidebar'] = true;
34        }
35        return true;
36    }
37}
38
39//Setup VIM: ex: et ts=4 enc=utf-8 :
40