xref: /plugin/bez/syntax/qlink.php (revision d00bbb0cd3d53bb4b45776b5bcc676c7616019a9)
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		$nr = substr($match, 1, strlen($match));
27		return $nr;
28    }
29
30    function render($mode, &$renderer, $nr) {
31		if ($mode == 'xhtml') {
32			$helper = $this->loadHelper('bez');
33			$renderer->doc .= $helper->html_issue_link($nr);
34
35			return true;
36		}
37		return false;
38    }
39}
40