1<?php 2/** 3 * Plugin Now: Inserts a timestamp. 4 * 5 * @license GPL 3 (http://www.gnu.org/licenses/gpl.html) 6 * @author Szymon Olewniczak <szymon.olewniczak@rid.pl> 7 */ 8 9// must be run within DokuWiki 10if(!defined('DOKU_INC')) die(); 11 12if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 13require_once DOKU_PLUGIN.'syntax.php'; 14 15/** 16 * All DokuWiki plugins to extend the parser/rendering mechanism 17 * need to inherit from this class 18 */ 19class syntax_plugin_bez_nav extends DokuWiki_Syntax_Plugin { 20 21 function getPType() { return 'block'; } 22 function getType() { return 'substition'; } 23 function getSort() { return 99; } 24 25 26 function connectTo($mode) { 27 $this->Lexer->addSpecialPattern('~~BEZNAV~~',$mode,'plugin_bez_nav'); 28 } 29 30 function handle($match, $state, $pos, &$handler) 31 { 32 return true; 33 } 34 35 function render($mode, &$renderer, $data) { 36 37 $helper = $this->loadHelper('bez'); 38 if ($mode == 'xhtml' && $helper->user_viewer()) { 39 40 $renderer->doc .= '<ul>'; 41 $renderer->doc .= '<li><a href="?id=bez:timeline">'.$this->getLang('bds_timeline').'</a></li>'; 42 $renderer->doc .= '<li><a href="?id=bez:issues">'.$this->getLang('bds_issues').'</a></li>'; 43 44 if ($helper->user_editor()) 45 $renderer->doc .= '<li><a href="?id=bez:issue_report">'.$this->getLang('bds_issue_report').'</a></li>'; 46 47 if ($helper->user_admin()) 48 $renderer->doc .= '<li><a href="?id=bez:entity">'.$this->getLang('entity_manage').'</a></li>'; 49 50 $renderer->doc .= '</ul>'; 51 return true; 52 } else 53 $renderer->meta['plugin_bez_nav']['nocache'] = true; 54 55 return false; 56 } 57} 58