Lexer->addSpecialPattern('#(?:z|zk|k)?[0-9]+',$mode,'plugin_bez_qlink'); } function handle($match, $state, $pos, Doku_Handler $handler) { preg_match('/#([a-z]*)([0-9]+)/', $match, $matches); list(,$code, $id) = $matches; $anchor = ''; $id_key = 'id'; switch ($code) { case '': $table = 'thread'; break; case 'k': $table = 'thread'; $anchor = '#k' . $id; /** @var helper_plugin_sqlite $sqlite */ $sqlite = plugin_load('helper', 'bez_db')->getDB(); $res = $sqlite->query("SELECT thread_id FROM thread_comment WHERE id=?", $id); $id = $res->fetchColumn(); break; case 'z': $table = 'task'; $id_key = 'tid'; break; case 'zk': $table = 'task'; $id_key = 'tid'; $anchor = '#zk' . $id; /** @var helper_plugin_sqlite $sqlite */ $sqlite = plugin_load('helper', 'bez_db')->getDB(); $res = $sqlite->query("SELECT task_id FROM task_comment WHERE id=?", $id); $id = $res->fetchColumn(); break; } return array($match, $table, $id_key, $id, $anchor); } function render($mode, Doku_Renderer $renderer, $data) { if ($mode == 'xhtml') { $id = $_GET['id']; $ex = explode(':', $id); $lang_code = ''; /*english namespace*/ switch($ex[0]) { case 'en': $lang_code = $ex[0].':'; } list($match, $table, $id_key, $id, $anchor) = $data; $renderer->doc .= ''.$match.''; return true; } return false; } }