This repository was archived by the owner on Aug 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathhelper.php
53 lines (51 loc) · 1.96 KB
/
helper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
// must be run within Dokuwiki
if (!defined('DOKU_INC')) die();
class helper_plugin_xml extends DokuWiki_Plugin {
/**
* Hooks for handling other plugins
*
* Since we generally outputs xml-ized instructions,
* we don't really need the plugins themselves to manage them.
*
* Feel free to add or modify hooks for plugins below to match your need.
*/
function _xml_extension(&$renderer,$name,$data) {
switch ($name) {
case 'htmlcomment':
list($state, $match) = $data;
$renderer->doc .= '<!--';
if (HTMLCOMMENT_SAFE) {
$renderer->doc .= $renderer->_xmlEntities($match);
} else {
$renderer->doc .= $match;
}
$renderer->doc .= '-->';
return true;
case 'info':
$renderer->doc .= '<macro name="info" type="'.$data[0].'" />'.DOKU_LF;
return true;
case 'pageredirect':
list($page, $message) = $data;
$renderer->doc .= '<macro name="pageredirect" target="'.$page.'" />'.DOKU_LF;
return true;
case 'plaintext':
$renderer->doc .= '<plaintext>';
$renderer->doc .= $renderer->_xmlEntities($data);
$renderer->doc .= '</plaintext>';
return true;
case 'tag_tag':
$renderer->doc .= '<tags>';
foreach ($data as $tag) {
$renderer->doc .= '<tag target="'.$renderer->_xmlEntities($tag).'" />';
}
$renderer->doc .= '</tags>'.DOKU_LF;
return true;
case 'tag_topic':
list($ns, $tag, $flags) = $data;
$renderer->doc .= '<topic namespace="'.$ns.'" tags="'.$tag.'" flags="'.implode(' ',$flags).'" />'.DOKU_LF;
return true;
}
return false;
}
}