1<?php 2/** 3 * Plugin Now: Inserts a timestamp. 4 * 5 * @license GPL 3 (http://www.gnu.org/licenses/gpl.html) 6 */ 7// must be run within DokuWiki 8if(!defined('DOKU_INC')) die(); 9 10if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 11require_once DOKU_PLUGIN.'syntax.php'; 12/** 13 * All DokuWiki plugins to extend the parser/rendering mechanism 14 * need to inherit from this class 15 */ 16class syntax_plugin_bez_qlink extends DokuWiki_Syntax_Plugin { 17 18 function getType() { return 'substition'; } 19 function getSort() { return 34; } 20 function connectTo($mode) { 21 $this->Lexer->addSpecialPattern('#[0-9]+',$mode,'plugin_bez_qlink'); 22 } 23 24 25 function handle($match, $state, $pos, Doku_Handler $handler) { 26 $nr = substr($match, 1, strlen($match)); 27 return $nr; 28 } 29 30 function render($mode, Doku_Renderer $renderer, $nr) { 31 if ($mode == 'xhtml') { 32 $id = $_GET['id']; 33 $ex = explode(':', $id); 34 35 $lang_code = ''; 36 /*english namespace*/ 37 switch($ex[0]) { 38 case 'en': 39 $lang_code = $ex[0].':'; 40 } 41 $renderer->doc .= '<a href="?id='.$lang_code.'bez:issue:id:'.$nr.'">#'.$nr.'</a>'; 42 return true; 43 } 44 return false; 45 } 46} 47