xref: /plugin/bez/syntax/qlink.php (revision b898877ee3b1870896be803e73ccef3ce140724a)
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, &$handler) {
26		$whash = substr($match, 1, strlen($match));
27		$ex = explode(':', $whash);
28		return array($ex[0], isset($ex[1]) ? $ex[1] : 0);
29    }
30
31    function render($mode, &$renderer, $data) {
32		if ($mode == 'xhtml') {
33			list($issue, $event) = $data;
34
35			$helper = $this->loadHelper('bez');
36			$renderer->doc .= $bds->html_anchor_to_event($issue, $event, true);
37
38			return true;
39		}
40		return false;
41    }
42}
43