xref: /dokuwiki/inc/parser/renderer.php (revision 78b498a7f2693854397176be6f5e90772e9868c8)
10cecf9d5Sandi<?php
261faf446Schris/**
35587e44cSchris * Renderer output base class
461faf446Schris *
561faf446Schris * @author Harry Fuecks <hfuecks@gmail.com>
661faf446Schris * @author Andreas Gohr <andi@splitbrain.org>
761faf446Schris */
861faf446Schris
9e1d9dcc8SAndreas Gohruse dokuwiki\Extension\Plugin;
10e1d9dcc8SAndreas Gohruse dokuwiki\Extension\SyntaxPlugin;
11e1d9dcc8SAndreas Gohr
12863befa1SAndreas Gohr/**
1356bd9509SPhy * Allowed chars in $language for code highlighting
1456bd9509SPhy * @see GeSHi::set_language()
1556bd9509SPhy */
1656bd9509SPhydefine('PREG_PATTERN_VALID_LANGUAGE', '#[^a-zA-Z0-9\-_]#');
1756bd9509SPhy
1856bd9509SPhy/**
19863befa1SAndreas Gohr * An empty renderer, produces no output
20863befa1SAndreas Gohr *
21e1d9dcc8SAndreas Gohr * Inherits from dokuwiki\Plugin\DokuWiki_Plugin for giving additional functions to render plugins
228e3a5477SAndreas Gohr *
238e3a5477SAndreas Gohr * The renderer transforms the syntax instructions created by the parser and handler into the
248e3a5477SAndreas Gohr * desired output format. For each instruction a corresponding method defined in this class will
258e3a5477SAndreas Gohr * be called. That method needs to produce the desired output for the instruction and add it to the
268e3a5477SAndreas Gohr * $doc field. When all instructions are processed, the $doc field contents will be cached by
278e3a5477SAndreas Gohr * DokuWiki and sent to the user.
28863befa1SAndreas Gohr */
29e1d9dcc8SAndreas Gohrabstract class Doku_Renderer extends Plugin {
30cfa2b40eSAndreas Gohr    /** @var array Settings, control the behavior of the renderer */
31cfa2b40eSAndreas Gohr    public $info = array(
3244881bd0Shenning.noren        'cache' => true, // may the rendered result cached?
3344881bd0Shenning.noren        'toc'   => true, // render the TOC?
349dc2c2afSandi    );
359dc2c2afSandi
36cfa2b40eSAndreas Gohr    /** @var array contains the smiley configuration, set in p_render() */
37cfa2b40eSAndreas Gohr    public $smileys = array();
38cfa2b40eSAndreas Gohr    /** @var array contains the entity configuration, set in p_render() */
39cfa2b40eSAndreas Gohr    public $entities = array();
40cfa2b40eSAndreas Gohr    /** @var array contains the acronym configuration, set in p_render() */
41cfa2b40eSAndreas Gohr    public $acronyms = array();
42cfa2b40eSAndreas Gohr    /** @var array contains the interwiki configuration, set in p_render() */
43cfa2b40eSAndreas Gohr    public $interwiki = array();
44*78b498a7SAndreas Gohr    /** @var string|int link pages and media against this revision */
45*78b498a7SAndreas Gohr    public $date_at = '';
46e41c4da9SAndreas Gohr
47de369923SAndreas Gohr    /** @var array the list of headers used to create unique link ids */
48de369923SAndreas Gohr    protected $headers = array();
49de369923SAndreas Gohr
505f70445dSAndreas Gohr    /**
51cfa2b40eSAndreas Gohr     * @var string the rendered document, this will be cached after the renderer ran through
525f70445dSAndreas Gohr     */
53cfa2b40eSAndreas Gohr    public $doc = '';
54cfa2b40eSAndreas Gohr
55cfa2b40eSAndreas Gohr    /**
56cfa2b40eSAndreas Gohr     * clean out any per-use values
57cfa2b40eSAndreas Gohr     *
58cfa2b40eSAndreas Gohr     * This is called before each use of the renderer object and should be used to
59cfa2b40eSAndreas Gohr     * completely reset the state of the renderer to be reused for a new document
60cfa2b40eSAndreas Gohr     */
61de369923SAndreas Gohr    public function reset(){
62de369923SAndreas Gohr        $this->headers = array();
63abaaba9aSSatoshi Sahara        $this->doc           = '';
64abaaba9aSSatoshi Sahara        $this->info['cache'] = true;
65abaaba9aSSatoshi Sahara        $this->info['toc']   = true;
665f70445dSAndreas Gohr    }
675f70445dSAndreas Gohr
68f6ec8df8SAdrian Lang    /**
69f6ec8df8SAdrian Lang     * Allow the plugin to prevent DokuWiki from reusing an instance
70f6ec8df8SAdrian Lang     *
71cfa2b40eSAndreas Gohr     * Since most renderer plugins fail to implement Doku_Renderer::reset() we default
72cfa2b40eSAndreas Gohr     * to reinstantiating the renderer here
73cfa2b40eSAndreas Gohr     *
74f6ec8df8SAdrian Lang     * @return bool   false if the plugin has to be instantiated
75f6ec8df8SAdrian Lang     */
76de369923SAndreas Gohr    public function isSingleton() {
77f6ec8df8SAdrian Lang        return false;
78f6ec8df8SAdrian Lang    }
79f6ec8df8SAdrian Lang
808cc41db0SAndreas Gohr    /**
81cfa2b40eSAndreas Gohr     * Returns the format produced by this renderer.
82cfa2b40eSAndreas Gohr     *
83cfa2b40eSAndreas Gohr     * Has to be overidden by sub classes
84cfa2b40eSAndreas Gohr     *
85cfa2b40eSAndreas Gohr     * @return string
86cfa2b40eSAndreas Gohr     */
87de369923SAndreas Gohr    abstract public function getFormat();
88cfa2b40eSAndreas Gohr
89cfa2b40eSAndreas Gohr    /**
90cfa2b40eSAndreas Gohr     * Disable caching of this renderer's output
91cfa2b40eSAndreas Gohr     */
92e1cdd96cSAndreas Gohr    public function nocache() {
93cfa2b40eSAndreas Gohr        $this->info['cache'] = false;
94cfa2b40eSAndreas Gohr    }
95cfa2b40eSAndreas Gohr
96cfa2b40eSAndreas Gohr    /**
97cfa2b40eSAndreas Gohr     * Disable TOC generation for this renderer's output
98cfa2b40eSAndreas Gohr     *
99cfa2b40eSAndreas Gohr     * This might not be used for certain sub renderer
100cfa2b40eSAndreas Gohr     */
101e1cdd96cSAndreas Gohr    public function notoc() {
102cfa2b40eSAndreas Gohr        $this->info['toc'] = false;
103cfa2b40eSAndreas Gohr    }
104cfa2b40eSAndreas Gohr
105cfa2b40eSAndreas Gohr    /**
106cfa2b40eSAndreas Gohr     * Handle plugin rendering
107cfa2b40eSAndreas Gohr     *
108cfa2b40eSAndreas Gohr     * Most likely this needs NOT to be overwritten by sub classes
1098cc41db0SAndreas Gohr     *
1108cc41db0SAndreas Gohr     * @param string $name  Plugin name
1118cc41db0SAndreas Gohr     * @param mixed  $data  custom data set by handler
1128cc41db0SAndreas Gohr     * @param string $state matched state if any
1138cc41db0SAndreas Gohr     * @param string $match raw matched syntax
1148cc41db0SAndreas Gohr     */
115de369923SAndreas Gohr    public function plugin($name, $data, $state = '', $match = '') {
116e1d9dcc8SAndreas Gohr        /** @var SyntaxPlugin $plugin */
117e8b5a4f9SAndreas Gohr        $plugin = plugin_load('syntax', $name);
11861faf446Schris        if($plugin != null) {
1195f70445dSAndreas Gohr            $plugin->render($this->getFormat(), $this, $data);
12061faf446Schris        }
12161faf446Schris    }
12261faf446Schris
1235587e44cSchris    /**
1245587e44cSchris     * handle nested render instructions
1255587e44cSchris     * this method (and nest_close method) should not be overloaded in actual renderer output classes
126cfa2b40eSAndreas Gohr     *
127cfa2b40eSAndreas Gohr     * @param array $instructions
1285587e44cSchris     */
129de369923SAndreas Gohr    public function nest($instructions) {
1305587e44cSchris        foreach($instructions as $instruction) {
1315587e44cSchris            // execute the callback against ourself
132c2122b83SChristopher Smith            if(method_exists($this, $instruction[0])) {
133d6a1a955SAndreas Gohr                call_user_func_array(array($this, $instruction[0]), $instruction[1] ? $instruction[1] : array());
134c2122b83SChristopher Smith            }
1355587e44cSchris        }
1365587e44cSchris    }
1375587e44cSchris
138cfa2b40eSAndreas Gohr    /**
139cfa2b40eSAndreas Gohr     * dummy closing instruction issued by Doku_Handler_Nest
140cfa2b40eSAndreas Gohr     *
141cfa2b40eSAndreas Gohr     * normally the syntax mode should override this instruction when instantiating Doku_Handler_Nest -
142cfa2b40eSAndreas Gohr     * however plugins will not be able to - as their instructions require data.
143cfa2b40eSAndreas Gohr     */
144de369923SAndreas Gohr    public function nest_close() {
1452c2835c2SAndreas Gohr    }
1465587e44cSchris
147cfa2b40eSAndreas Gohr    #region Syntax modes - sub classes will need to implement them to fill $doc
148cfa2b40eSAndreas Gohr
149cfa2b40eSAndreas Gohr    /**
150cfa2b40eSAndreas Gohr     * Initialize the document
151cfa2b40eSAndreas Gohr     */
152de369923SAndreas Gohr    public function document_start() {
1532c2835c2SAndreas Gohr    }
1540cecf9d5Sandi
155cfa2b40eSAndreas Gohr    /**
156cfa2b40eSAndreas Gohr     * Finalize the document
157cfa2b40eSAndreas Gohr     */
158de369923SAndreas Gohr    public function document_end() {
1592c2835c2SAndreas Gohr    }
1600cecf9d5Sandi
161cfa2b40eSAndreas Gohr    /**
162cfa2b40eSAndreas Gohr     * Render the Table of Contents
163cfa2b40eSAndreas Gohr     *
164cfa2b40eSAndreas Gohr     * @return string
165cfa2b40eSAndreas Gohr     */
166de369923SAndreas Gohr    public function render_TOC() {
1672c2835c2SAndreas Gohr        return '';
1682c2835c2SAndreas Gohr    }
1690cecf9d5Sandi
170cfa2b40eSAndreas Gohr    /**
171cfa2b40eSAndreas Gohr     * Add an item to the TOC
172cfa2b40eSAndreas Gohr     *
173cfa2b40eSAndreas Gohr     * @param string $id       the hash link
174cfa2b40eSAndreas Gohr     * @param string $text     the text to display
175cfa2b40eSAndreas Gohr     * @param int    $level    the nesting level
176cfa2b40eSAndreas Gohr     */
177de369923SAndreas Gohr    public function toc_additem($id, $text, $level) {
1782c2835c2SAndreas Gohr    }
179e7856beaSchris
180cfa2b40eSAndreas Gohr    /**
181cfa2b40eSAndreas Gohr     * Render a heading
182cfa2b40eSAndreas Gohr     *
183cfa2b40eSAndreas Gohr     * @param string $text  the text to display
184cfa2b40eSAndreas Gohr     * @param int    $level header level
185cfa2b40eSAndreas Gohr     * @param int    $pos   byte position in the original source
186cfa2b40eSAndreas Gohr     */
187de369923SAndreas Gohr    public function header($text, $level, $pos) {
1882c2835c2SAndreas Gohr    }
1890cecf9d5Sandi
190cfa2b40eSAndreas Gohr    /**
191cfa2b40eSAndreas Gohr     * Open a new section
192cfa2b40eSAndreas Gohr     *
193cfa2b40eSAndreas Gohr     * @param int $level section level (as determined by the previous header)
194cfa2b40eSAndreas Gohr     */
195de369923SAndreas Gohr    public function section_open($level) {
1962c2835c2SAndreas Gohr    }
1970cecf9d5Sandi
198cfa2b40eSAndreas Gohr    /**
199cfa2b40eSAndreas Gohr     * Close the current section
200cfa2b40eSAndreas Gohr     */
201de369923SAndreas Gohr    public function section_close() {
2022c2835c2SAndreas Gohr    }
2030cecf9d5Sandi
204cfa2b40eSAndreas Gohr    /**
205cfa2b40eSAndreas Gohr     * Render plain text data
206cfa2b40eSAndreas Gohr     *
20742ea7f44SGerrit Uitslag     * @param string $text
208cfa2b40eSAndreas Gohr     */
209de369923SAndreas Gohr    public function cdata($text) {
2102c2835c2SAndreas Gohr    }
2110cecf9d5Sandi
212cfa2b40eSAndreas Gohr    /**
213cfa2b40eSAndreas Gohr     * Open a paragraph
214cfa2b40eSAndreas Gohr     */
215de369923SAndreas Gohr    public function p_open() {
2162c2835c2SAndreas Gohr    }
2170cecf9d5Sandi
218cfa2b40eSAndreas Gohr    /**
219cfa2b40eSAndreas Gohr     * Close a paragraph
220cfa2b40eSAndreas Gohr     */
221de369923SAndreas Gohr    public function p_close() {
2222c2835c2SAndreas Gohr    }
2230cecf9d5Sandi
224cfa2b40eSAndreas Gohr    /**
2253dd5c225SAndreas Gohr     * Create a line break
226cfa2b40eSAndreas Gohr     */
227de369923SAndreas Gohr    public function linebreak() {
2282c2835c2SAndreas Gohr    }
2290cecf9d5Sandi
230cfa2b40eSAndreas Gohr    /**
231cfa2b40eSAndreas Gohr     * Create a horizontal line
232cfa2b40eSAndreas Gohr     */
233de369923SAndreas Gohr    public function hr() {
2342c2835c2SAndreas Gohr    }
2350cecf9d5Sandi
236cfa2b40eSAndreas Gohr    /**
237cfa2b40eSAndreas Gohr     * Start strong (bold) formatting
238cfa2b40eSAndreas Gohr     */
239de369923SAndreas Gohr    public function strong_open() {
2402c2835c2SAndreas Gohr    }
2410cecf9d5Sandi
242cfa2b40eSAndreas Gohr    /**
243cfa2b40eSAndreas Gohr     * Stop strong (bold) formatting
244cfa2b40eSAndreas Gohr     */
245de369923SAndreas Gohr    public function strong_close() {
2462c2835c2SAndreas Gohr    }
2470cecf9d5Sandi
248cfa2b40eSAndreas Gohr    /**
249cfa2b40eSAndreas Gohr     * Start emphasis (italics) formatting
250cfa2b40eSAndreas Gohr     */
251de369923SAndreas Gohr    public function emphasis_open() {
2522c2835c2SAndreas Gohr    }
2530cecf9d5Sandi
254cfa2b40eSAndreas Gohr    /**
255cfa2b40eSAndreas Gohr     * Stop emphasis (italics) formatting
256cfa2b40eSAndreas Gohr     */
257de369923SAndreas Gohr    public function emphasis_close() {
2582c2835c2SAndreas Gohr    }
2590cecf9d5Sandi
260cfa2b40eSAndreas Gohr    /**
261cfa2b40eSAndreas Gohr     * Start underline formatting
262cfa2b40eSAndreas Gohr     */
263de369923SAndreas Gohr    public function underline_open() {
2642c2835c2SAndreas Gohr    }
2650cecf9d5Sandi
266cfa2b40eSAndreas Gohr    /**
267cfa2b40eSAndreas Gohr     * Stop underline formatting
268cfa2b40eSAndreas Gohr     */
269de369923SAndreas Gohr    public function underline_close() {
2702c2835c2SAndreas Gohr    }
2710cecf9d5Sandi
272cfa2b40eSAndreas Gohr    /**
273cfa2b40eSAndreas Gohr     * Start monospace formatting
274cfa2b40eSAndreas Gohr     */
275de369923SAndreas Gohr    public function monospace_open() {
2762c2835c2SAndreas Gohr    }
2770cecf9d5Sandi
278cfa2b40eSAndreas Gohr    /**
279cfa2b40eSAndreas Gohr     * Stop monospace formatting
280cfa2b40eSAndreas Gohr     */
281de369923SAndreas Gohr    public function monospace_close() {
2822c2835c2SAndreas Gohr    }
2830cecf9d5Sandi
284cfa2b40eSAndreas Gohr    /**
285cfa2b40eSAndreas Gohr     * Start a subscript
286cfa2b40eSAndreas Gohr     */
287de369923SAndreas Gohr    public function subscript_open() {
2882c2835c2SAndreas Gohr    }
2890cecf9d5Sandi
290cfa2b40eSAndreas Gohr    /**
291cfa2b40eSAndreas Gohr     * Stop a subscript
292cfa2b40eSAndreas Gohr     */
293de369923SAndreas Gohr    public function subscript_close() {
2942c2835c2SAndreas Gohr    }
2950cecf9d5Sandi
296cfa2b40eSAndreas Gohr    /**
297cfa2b40eSAndreas Gohr     * Start a superscript
298cfa2b40eSAndreas Gohr     */
299de369923SAndreas Gohr    public function superscript_open() {
3002c2835c2SAndreas Gohr    }
3010cecf9d5Sandi
302cfa2b40eSAndreas Gohr    /**
303cfa2b40eSAndreas Gohr     * Stop a superscript
304cfa2b40eSAndreas Gohr     */
305de369923SAndreas Gohr    public function superscript_close() {
3062c2835c2SAndreas Gohr    }
3070cecf9d5Sandi
308cfa2b40eSAndreas Gohr    /**
309cfa2b40eSAndreas Gohr     * Start deleted (strike-through) formatting
310cfa2b40eSAndreas Gohr     */
311de369923SAndreas Gohr    public function deleted_open() {
3122c2835c2SAndreas Gohr    }
3130cecf9d5Sandi
314cfa2b40eSAndreas Gohr    /**
315cfa2b40eSAndreas Gohr     * Stop deleted (strike-through) formatting
316cfa2b40eSAndreas Gohr     */
317de369923SAndreas Gohr    public function deleted_close() {
3182c2835c2SAndreas Gohr    }
3190cecf9d5Sandi
320cfa2b40eSAndreas Gohr    /**
321cfa2b40eSAndreas Gohr     * Start a footnote
322cfa2b40eSAndreas Gohr     */
323de369923SAndreas Gohr    public function footnote_open() {
3242c2835c2SAndreas Gohr    }
3250cecf9d5Sandi
326cfa2b40eSAndreas Gohr    /**
327cfa2b40eSAndreas Gohr     * Stop a footnote
328cfa2b40eSAndreas Gohr     */
329de369923SAndreas Gohr    public function footnote_close() {
3302c2835c2SAndreas Gohr    }
3310cecf9d5Sandi
332cfa2b40eSAndreas Gohr    /**
333cfa2b40eSAndreas Gohr     * Open an unordered list
334cfa2b40eSAndreas Gohr     */
335de369923SAndreas Gohr    public function listu_open() {
3362c2835c2SAndreas Gohr    }
3370cecf9d5Sandi
338cfa2b40eSAndreas Gohr    /**
339cfa2b40eSAndreas Gohr     * Close an unordered list
340cfa2b40eSAndreas Gohr     */
341de369923SAndreas Gohr    public function listu_close() {
3422c2835c2SAndreas Gohr    }
3430cecf9d5Sandi
344cfa2b40eSAndreas Gohr    /**
345cfa2b40eSAndreas Gohr     * Open an ordered list
346cfa2b40eSAndreas Gohr     */
347de369923SAndreas Gohr    public function listo_open() {
3482c2835c2SAndreas Gohr    }
3490cecf9d5Sandi
350cfa2b40eSAndreas Gohr    /**
351cfa2b40eSAndreas Gohr     * Close an ordered list
352cfa2b40eSAndreas Gohr     */
353de369923SAndreas Gohr    public function listo_close() {
3542c2835c2SAndreas Gohr    }
3550cecf9d5Sandi
356cfa2b40eSAndreas Gohr    /**
357cfa2b40eSAndreas Gohr     * Open a list item
358cfa2b40eSAndreas Gohr     *
359cfa2b40eSAndreas Gohr     * @param int $level the nesting level
360e3a24861SChristopher Smith     * @param bool $node true when a node; false when a leaf
361cfa2b40eSAndreas Gohr     */
362de369923SAndreas Gohr    public function listitem_open($level,$node=false) {
3632c2835c2SAndreas Gohr    }
3640cecf9d5Sandi
365cfa2b40eSAndreas Gohr    /**
366cfa2b40eSAndreas Gohr     * Close a list item
367cfa2b40eSAndreas Gohr     */
368de369923SAndreas Gohr    public function listitem_close() {
3692c2835c2SAndreas Gohr    }
3700cecf9d5Sandi
371cfa2b40eSAndreas Gohr    /**
372cfa2b40eSAndreas Gohr     * Start the content of a list item
373cfa2b40eSAndreas Gohr     */
374de369923SAndreas Gohr    public function listcontent_open() {
3752c2835c2SAndreas Gohr    }
3760cecf9d5Sandi
377cfa2b40eSAndreas Gohr    /**
378cfa2b40eSAndreas Gohr     * Stop the content of a list item
379cfa2b40eSAndreas Gohr     */
380de369923SAndreas Gohr    public function listcontent_close() {
3812c2835c2SAndreas Gohr    }
3820cecf9d5Sandi
383cfa2b40eSAndreas Gohr    /**
384cfa2b40eSAndreas Gohr     * Output unformatted $text
385cfa2b40eSAndreas Gohr     *
386cfa2b40eSAndreas Gohr     * Defaults to $this->cdata()
387cfa2b40eSAndreas Gohr     *
388cfa2b40eSAndreas Gohr     * @param string $text
389cfa2b40eSAndreas Gohr     */
390de369923SAndreas Gohr    public function unformatted($text) {
391cfa2b40eSAndreas Gohr        $this->cdata($text);
3922c2835c2SAndreas Gohr    }
3930cecf9d5Sandi
394cfa2b40eSAndreas Gohr    /**
395cfa2b40eSAndreas Gohr     * Output preformatted text
396cfa2b40eSAndreas Gohr     *
397cfa2b40eSAndreas Gohr     * @param string $text
398cfa2b40eSAndreas Gohr     */
399de369923SAndreas Gohr    public function preformatted($text) {
4002c2835c2SAndreas Gohr    }
4010cecf9d5Sandi
402cfa2b40eSAndreas Gohr    /**
403cfa2b40eSAndreas Gohr     * Start a block quote
404cfa2b40eSAndreas Gohr     */
405de369923SAndreas Gohr    public function quote_open() {
4062c2835c2SAndreas Gohr    }
4070cecf9d5Sandi
408cfa2b40eSAndreas Gohr    /**
409cfa2b40eSAndreas Gohr     * Stop a block quote
410cfa2b40eSAndreas Gohr     */
411de369923SAndreas Gohr    public function quote_close() {
4122c2835c2SAndreas Gohr    }
4130cecf9d5Sandi
414cfa2b40eSAndreas Gohr    /**
415cfa2b40eSAndreas Gohr     * Display text as file content, optionally syntax highlighted
416cfa2b40eSAndreas Gohr     *
417cfa2b40eSAndreas Gohr     * @param string $text text to show
418cfa2b40eSAndreas Gohr     * @param string $lang programming language to use for syntax highlighting
419cfa2b40eSAndreas Gohr     * @param string $file file path label
420cfa2b40eSAndreas Gohr     */
421de369923SAndreas Gohr    public function file($text, $lang = null, $file = null) {
4222c2835c2SAndreas Gohr    }
4233d491f75SAndreas Gohr
424cfa2b40eSAndreas Gohr    /**
425cfa2b40eSAndreas Gohr     * Display text as code content, optionally syntax highlighted
426cfa2b40eSAndreas Gohr     *
427cfa2b40eSAndreas Gohr     * @param string $text text to show
428cfa2b40eSAndreas Gohr     * @param string $lang programming language to use for syntax highlighting
429cfa2b40eSAndreas Gohr     * @param string $file file path label
430cfa2b40eSAndreas Gohr     */
431de369923SAndreas Gohr    public function code($text, $lang = null, $file = null) {
4322c2835c2SAndreas Gohr    }
4330cecf9d5Sandi
434cfa2b40eSAndreas Gohr    /**
435cfa2b40eSAndreas Gohr     * Format an acronym
436cfa2b40eSAndreas Gohr     *
437cfa2b40eSAndreas Gohr     * Uses $this->acronyms
438cfa2b40eSAndreas Gohr     *
439cfa2b40eSAndreas Gohr     * @param string $acronym
440cfa2b40eSAndreas Gohr     */
441de369923SAndreas Gohr    public function acronym($acronym) {
4422c2835c2SAndreas Gohr    }
4430cecf9d5Sandi
444cfa2b40eSAndreas Gohr    /**
445cfa2b40eSAndreas Gohr     * Format a smiley
446cfa2b40eSAndreas Gohr     *
447cfa2b40eSAndreas Gohr     * Uses $this->smiley
448cfa2b40eSAndreas Gohr     *
449cfa2b40eSAndreas Gohr     * @param string $smiley
450cfa2b40eSAndreas Gohr     */
451de369923SAndreas Gohr    public function smiley($smiley) {
4522c2835c2SAndreas Gohr    }
4530cecf9d5Sandi
454cfa2b40eSAndreas Gohr    /**
455cfa2b40eSAndreas Gohr     * Format an entity
456cfa2b40eSAndreas Gohr     *
457cfa2b40eSAndreas Gohr     * Entities are basically small text replacements
458cfa2b40eSAndreas Gohr     *
459cfa2b40eSAndreas Gohr     * Uses $this->entities
460cfa2b40eSAndreas Gohr     *
461cfa2b40eSAndreas Gohr     * @param string $entity
462cfa2b40eSAndreas Gohr     */
463de369923SAndreas Gohr    public function entity($entity) {
4642c2835c2SAndreas Gohr    }
4650cecf9d5Sandi
466cfa2b40eSAndreas Gohr    /**
467cfa2b40eSAndreas Gohr     * Typographically format a multiply sign
468cfa2b40eSAndreas Gohr     *
469cfa2b40eSAndreas Gohr     * Example: ($x=640, $y=480) should result in "640×480"
470cfa2b40eSAndreas Gohr     *
471cfa2b40eSAndreas Gohr     * @param string|int $x first value
472cfa2b40eSAndreas Gohr     * @param string|int $y second value
473cfa2b40eSAndreas Gohr     */
474de369923SAndreas Gohr    public function multiplyentity($x, $y) {
4752c2835c2SAndreas Gohr    }
4760cecf9d5Sandi
477cfa2b40eSAndreas Gohr    /**
478cfa2b40eSAndreas Gohr     * Render an opening single quote char (language specific)
479cfa2b40eSAndreas Gohr     */
480de369923SAndreas Gohr    public function singlequoteopening() {
4812c2835c2SAndreas Gohr    }
4820cecf9d5Sandi
483cfa2b40eSAndreas Gohr    /**
484cfa2b40eSAndreas Gohr     * Render a closing single quote char (language specific)
485cfa2b40eSAndreas Gohr     */
486de369923SAndreas Gohr    public function singlequoteclosing() {
4872c2835c2SAndreas Gohr    }
4880cecf9d5Sandi
489cfa2b40eSAndreas Gohr    /**
490cfa2b40eSAndreas Gohr     * Render an apostrophe char (language specific)
491cfa2b40eSAndreas Gohr     */
492de369923SAndreas Gohr    public function apostrophe() {
4932c2835c2SAndreas Gohr    }
49457d757d1SAndreas Gohr
495cfa2b40eSAndreas Gohr    /**
496cfa2b40eSAndreas Gohr     * Render an opening double quote char (language specific)
497cfa2b40eSAndreas Gohr     */
498de369923SAndreas Gohr    public function doublequoteopening() {
4992c2835c2SAndreas Gohr    }
5000cecf9d5Sandi
501cfa2b40eSAndreas Gohr    /**
502cfa2b40eSAndreas Gohr     * Render an closinging double quote char (language specific)
503cfa2b40eSAndreas Gohr     */
504de369923SAndreas Gohr    public function doublequoteclosing() {
5052c2835c2SAndreas Gohr    }
5060cecf9d5Sandi
507cfa2b40eSAndreas Gohr    /**
508cfa2b40eSAndreas Gohr     * Render a CamelCase link
509cfa2b40eSAndreas Gohr     *
510cfa2b40eSAndreas Gohr     * @param string $link The link name
511cfa2b40eSAndreas Gohr     * @see http://en.wikipedia.org/wiki/CamelCase
512cfa2b40eSAndreas Gohr     */
513de369923SAndreas Gohr    public function camelcaselink($link) {
5142c2835c2SAndreas Gohr    }
5150cecf9d5Sandi
516cfa2b40eSAndreas Gohr    /**
517cfa2b40eSAndreas Gohr     * Render a page local link
518cfa2b40eSAndreas Gohr     *
519cfa2b40eSAndreas Gohr     * @param string $hash hash link identifier
520cfa2b40eSAndreas Gohr     * @param string $name name for the link
521cfa2b40eSAndreas Gohr     */
522de369923SAndreas Gohr    public function locallink($hash, $name = null) {
5232c2835c2SAndreas Gohr    }
524a939d432SAndreas Gohr
525cfa2b40eSAndreas Gohr    /**
526cfa2b40eSAndreas Gohr     * Render a wiki internal link
527cfa2b40eSAndreas Gohr     *
528cfa2b40eSAndreas Gohr     * @param string       $link  page ID to link to. eg. 'wiki:syntax'
529cfa2b40eSAndreas Gohr     * @param string|array $title name for the link, array for media file
530cfa2b40eSAndreas Gohr     */
531de369923SAndreas Gohr    public function internallink($link, $title = null) {
5322c2835c2SAndreas Gohr    }
5330cecf9d5Sandi
534cfa2b40eSAndreas Gohr    /**
535cfa2b40eSAndreas Gohr     * Render an external link
536cfa2b40eSAndreas Gohr     *
537cfa2b40eSAndreas Gohr     * @param string       $link  full URL with scheme
538cfa2b40eSAndreas Gohr     * @param string|array $title name for the link, array for media file
539cfa2b40eSAndreas Gohr     */
540de369923SAndreas Gohr    public function externallink($link, $title = null) {
5412c2835c2SAndreas Gohr    }
5420cecf9d5Sandi
543cfa2b40eSAndreas Gohr    /**
544cfa2b40eSAndreas Gohr     * Render the output of an RSS feed
545cfa2b40eSAndreas Gohr     *
546cfa2b40eSAndreas Gohr     * @param string $url    URL of the feed
547cfa2b40eSAndreas Gohr     * @param array  $params Finetuning of the output
548cfa2b40eSAndreas Gohr     */
549de369923SAndreas Gohr    public function rss($url, $params) {
5502c2835c2SAndreas Gohr    }
551c5cfca61SAndreas Gohr
552cfa2b40eSAndreas Gohr    /**
553cfa2b40eSAndreas Gohr     * Render an interwiki link
554cfa2b40eSAndreas Gohr     *
555cfa2b40eSAndreas Gohr     * You may want to use $this->_resolveInterWiki() here
556cfa2b40eSAndreas Gohr     *
557cfa2b40eSAndreas Gohr     * @param string       $link     original link - probably not much use
558cfa2b40eSAndreas Gohr     * @param string|array $title    name for the link, array for media file
559cfa2b40eSAndreas Gohr     * @param string       $wikiName indentifier (shortcut) for the remote wiki
560cfa2b40eSAndreas Gohr     * @param string       $wikiUri  the fragment parsed from the original link
561cfa2b40eSAndreas Gohr     */
562de369923SAndreas Gohr    public function interwikilink($link, $title, $wikiName, $wikiUri) {
5632c2835c2SAndreas Gohr    }
5640cecf9d5Sandi
565cfa2b40eSAndreas Gohr    /**
566cfa2b40eSAndreas Gohr     * Link to file on users OS
567cfa2b40eSAndreas Gohr     *
568cfa2b40eSAndreas Gohr     * @param string       $link  the link
569cfa2b40eSAndreas Gohr     * @param string|array $title name for the link, array for media file
570cfa2b40eSAndreas Gohr     */
571de369923SAndreas Gohr    public function filelink($link, $title = null) {
5722c2835c2SAndreas Gohr    }
5730cecf9d5Sandi
574cfa2b40eSAndreas Gohr    /**
575cfa2b40eSAndreas Gohr     * Link to windows share
576cfa2b40eSAndreas Gohr     *
577cfa2b40eSAndreas Gohr     * @param string       $link  the link
578cfa2b40eSAndreas Gohr     * @param string|array $title name for the link, array for media file
579cfa2b40eSAndreas Gohr     */
580de369923SAndreas Gohr    public function windowssharelink($link, $title = null) {
5812c2835c2SAndreas Gohr    }
5820cecf9d5Sandi
583cfa2b40eSAndreas Gohr    /**
584cfa2b40eSAndreas Gohr     * Render a linked E-Mail Address
585cfa2b40eSAndreas Gohr     *
586cfa2b40eSAndreas Gohr     * Should honor $conf['mailguard'] setting
587cfa2b40eSAndreas Gohr     *
588cfa2b40eSAndreas Gohr     * @param string $address Email-Address
5893dd5c225SAndreas Gohr     * @param string|array $name name for the link, array for media file
590cfa2b40eSAndreas Gohr     */
591de369923SAndreas Gohr    public function emaillink($address, $name = null) {
5922c2835c2SAndreas Gohr    }
5930cecf9d5Sandi
594cfa2b40eSAndreas Gohr    /**
595cfa2b40eSAndreas Gohr     * Render an internal media file
596cfa2b40eSAndreas Gohr     *
597cfa2b40eSAndreas Gohr     * @param string $src     media ID
598cfa2b40eSAndreas Gohr     * @param string $title   descriptive text
599cfa2b40eSAndreas Gohr     * @param string $align   left|center|right
600cfa2b40eSAndreas Gohr     * @param int    $width   width of media in pixel
601cfa2b40eSAndreas Gohr     * @param int    $height  height of media in pixel
602cfa2b40eSAndreas Gohr     * @param string $cache   cache|recache|nocache
603cfa2b40eSAndreas Gohr     * @param string $linking linkonly|detail|nolink
604cfa2b40eSAndreas Gohr     */
605de369923SAndreas Gohr    public function internalmedia($src, $title = null, $align = null, $width = null,
606d8ab8746SAndreas Gohr                           $height = null, $cache = null, $linking = null) {
6072c2835c2SAndreas Gohr    }
608a939d432SAndreas Gohr
609cfa2b40eSAndreas Gohr    /**
610cfa2b40eSAndreas Gohr     * Render an external media file
611cfa2b40eSAndreas Gohr     *
612cfa2b40eSAndreas Gohr     * @param string $src     full media URL
613cfa2b40eSAndreas Gohr     * @param string $title   descriptive text
614cfa2b40eSAndreas Gohr     * @param string $align   left|center|right
615cfa2b40eSAndreas Gohr     * @param int    $width   width of media in pixel
616cfa2b40eSAndreas Gohr     * @param int    $height  height of media in pixel
617cfa2b40eSAndreas Gohr     * @param string $cache   cache|recache|nocache
618cfa2b40eSAndreas Gohr     * @param string $linking linkonly|detail|nolink
619cfa2b40eSAndreas Gohr     */
620de369923SAndreas Gohr    public function externalmedia($src, $title = null, $align = null, $width = null,
621d8ab8746SAndreas Gohr                           $height = null, $cache = null, $linking = null) {
6222c2835c2SAndreas Gohr    }
623a939d432SAndreas Gohr
624cfa2b40eSAndreas Gohr    /**
625cfa2b40eSAndreas Gohr     * Render a link to an internal media file
626cfa2b40eSAndreas Gohr     *
627cfa2b40eSAndreas Gohr     * @param string $src     media ID
628cfa2b40eSAndreas Gohr     * @param string $title   descriptive text
629cfa2b40eSAndreas Gohr     * @param string $align   left|center|right
630cfa2b40eSAndreas Gohr     * @param int    $width   width of media in pixel
631cfa2b40eSAndreas Gohr     * @param int    $height  height of media in pixel
632cfa2b40eSAndreas Gohr     * @param string $cache   cache|recache|nocache
633cfa2b40eSAndreas Gohr     */
634de369923SAndreas Gohr    public function internalmedialink($src, $title = null, $align = null,
635cfa2b40eSAndreas Gohr                               $width = null, $height = null, $cache = null) {
6362c2835c2SAndreas Gohr    }
6370cecf9d5Sandi
638cfa2b40eSAndreas Gohr    /**
639cfa2b40eSAndreas Gohr     * Render a link to an external media file
640cfa2b40eSAndreas Gohr     *
641cfa2b40eSAndreas Gohr     * @param string $src     media ID
642cfa2b40eSAndreas Gohr     * @param string $title   descriptive text
643cfa2b40eSAndreas Gohr     * @param string $align   left|center|right
644cfa2b40eSAndreas Gohr     * @param int    $width   width of media in pixel
645cfa2b40eSAndreas Gohr     * @param int    $height  height of media in pixel
646cfa2b40eSAndreas Gohr     * @param string $cache   cache|recache|nocache
647cfa2b40eSAndreas Gohr     */
648de369923SAndreas Gohr    public function externalmedialink($src, $title = null, $align = null,
649cfa2b40eSAndreas Gohr                               $width = null, $height = null, $cache = null) {
6502c2835c2SAndreas Gohr    }
6510cecf9d5Sandi
652cfa2b40eSAndreas Gohr    /**
653cfa2b40eSAndreas Gohr     * Start a table
654cfa2b40eSAndreas Gohr     *
655cfa2b40eSAndreas Gohr     * @param int $maxcols maximum number of columns
656cfa2b40eSAndreas Gohr     * @param int $numrows NOT IMPLEMENTED
657cfa2b40eSAndreas Gohr     * @param int $pos     byte position in the original source
658cfa2b40eSAndreas Gohr     */
659de369923SAndreas Gohr    public function table_open($maxcols = null, $numrows = null, $pos = null) {
6602c2835c2SAndreas Gohr    }
6610cecf9d5Sandi
662cfa2b40eSAndreas Gohr    /**
663cfa2b40eSAndreas Gohr     * Close a table
664cfa2b40eSAndreas Gohr     *
665cfa2b40eSAndreas Gohr     * @param int $pos byte position in the original source
666cfa2b40eSAndreas Gohr     */
667de369923SAndreas Gohr    public function table_close($pos = null) {
6682c2835c2SAndreas Gohr    }
6690cecf9d5Sandi
670cfa2b40eSAndreas Gohr    /**
671cfa2b40eSAndreas Gohr     * Open a table header
672cfa2b40eSAndreas Gohr     */
673de369923SAndreas Gohr    public function tablethead_open() {
6742c2835c2SAndreas Gohr    }
675f05a1cc5SGerrit Uitslag
676cfa2b40eSAndreas Gohr    /**
677cfa2b40eSAndreas Gohr     * Close a table header
678cfa2b40eSAndreas Gohr     */
679de369923SAndreas Gohr    public function tablethead_close() {
6802c2835c2SAndreas Gohr    }
681f05a1cc5SGerrit Uitslag
682cfa2b40eSAndreas Gohr    /**
6835a93f869SAnika Henke     * Open a table body
6845a93f869SAnika Henke     */
685de369923SAndreas Gohr    public function tabletbody_open() {
6865a93f869SAnika Henke    }
6875a93f869SAnika Henke
6885a93f869SAnika Henke    /**
6895a93f869SAnika Henke     * Close a table body
6905a93f869SAnika Henke     */
691de369923SAndreas Gohr    public function tabletbody_close() {
6925a93f869SAnika Henke    }
6935a93f869SAnika Henke
6945a93f869SAnika Henke    /**
695d2a99739SAndreas Gohr     * Open a table footer
696d2a99739SAndreas Gohr     */
697de369923SAndreas Gohr    public function tabletfoot_open() {
698d2a99739SAndreas Gohr    }
699d2a99739SAndreas Gohr
700d2a99739SAndreas Gohr    /**
701d2a99739SAndreas Gohr     * Close a table footer
702d2a99739SAndreas Gohr     */
703de369923SAndreas Gohr    public function tabletfoot_close() {
704d2a99739SAndreas Gohr    }
705d2a99739SAndreas Gohr
706d2a99739SAndreas Gohr    /**
707cfa2b40eSAndreas Gohr     * Open a table row
708cfa2b40eSAndreas Gohr     */
709de369923SAndreas Gohr    public function tablerow_open() {
7102c2835c2SAndreas Gohr    }
7110cecf9d5Sandi
712cfa2b40eSAndreas Gohr    /**
713cfa2b40eSAndreas Gohr     * Close a table row
714cfa2b40eSAndreas Gohr     */
715de369923SAndreas Gohr    public function tablerow_close() {
7162c2835c2SAndreas Gohr    }
7170cecf9d5Sandi
718cfa2b40eSAndreas Gohr    /**
719cfa2b40eSAndreas Gohr     * Open a table header cell
720cfa2b40eSAndreas Gohr     *
721cfa2b40eSAndreas Gohr     * @param int    $colspan
722cfa2b40eSAndreas Gohr     * @param string $align left|center|right
723cfa2b40eSAndreas Gohr     * @param int    $rowspan
724cfa2b40eSAndreas Gohr     */
725de369923SAndreas Gohr    public function tableheader_open($colspan = 1, $align = null, $rowspan = 1) {
7262c2835c2SAndreas Gohr    }
7270cecf9d5Sandi
728cfa2b40eSAndreas Gohr    /**
729cfa2b40eSAndreas Gohr     * Close a table header cell
730cfa2b40eSAndreas Gohr     */
731de369923SAndreas Gohr    public function tableheader_close() {
7322c2835c2SAndreas Gohr    }
7330cecf9d5Sandi
734cfa2b40eSAndreas Gohr    /**
735cfa2b40eSAndreas Gohr     * Open a table cell
736cfa2b40eSAndreas Gohr     *
737cfa2b40eSAndreas Gohr     * @param int    $colspan
738cfa2b40eSAndreas Gohr     * @param string $align left|center|right
739cfa2b40eSAndreas Gohr     * @param int    $rowspan
740cfa2b40eSAndreas Gohr     */
741de369923SAndreas Gohr    public function tablecell_open($colspan = 1, $align = null, $rowspan = 1) {
7422c2835c2SAndreas Gohr    }
7430cecf9d5Sandi
744cfa2b40eSAndreas Gohr    /**
745cfa2b40eSAndreas Gohr     * Close a table cell
746cfa2b40eSAndreas Gohr     */
747de369923SAndreas Gohr    public function tablecell_close() {
7482c2835c2SAndreas Gohr    }
7492ea4044fSAndreas Gohr
750cfa2b40eSAndreas Gohr    #endregion
751cfa2b40eSAndreas Gohr
752cfa2b40eSAndreas Gohr    #region util functions, you probably won't need to reimplement them
7532ea4044fSAndreas Gohr
7542ea4044fSAndreas Gohr    /**
755de369923SAndreas Gohr     * Creates a linkid from a headline
756de369923SAndreas Gohr     *
757de369923SAndreas Gohr     * @author Andreas Gohr <andi@splitbrain.org>
758de369923SAndreas Gohr     * @param string  $title   The headline title
759de369923SAndreas Gohr     * @param boolean $create  Create a new unique ID?
760de369923SAndreas Gohr     * @return string
761de369923SAndreas Gohr     */
762de369923SAndreas Gohr    public function _headerToLink($title, $create = false) {
763de369923SAndreas Gohr        if($create) {
764de369923SAndreas Gohr            return sectionID($title, $this->headers);
765de369923SAndreas Gohr        } else {
766de369923SAndreas Gohr            $check = false;
767de369923SAndreas Gohr            return sectionID($title, $check);
768de369923SAndreas Gohr        }
769de369923SAndreas Gohr    }
770de369923SAndreas Gohr
771de369923SAndreas Gohr    /**
7722ea4044fSAndreas Gohr     * Removes any Namespace from the given name but keeps
7732ea4044fSAndreas Gohr     * casing and special chars
7742ea4044fSAndreas Gohr     *
7752ea4044fSAndreas Gohr     * @author Andreas Gohr <andi@splitbrain.org>
77642ea7f44SGerrit Uitslag     *
77742ea7f44SGerrit Uitslag     * @param string $name
77842ea7f44SGerrit Uitslag     * @return string
7792ea4044fSAndreas Gohr     */
78007a296cbSAndreas Gohr    public function _simpleTitle($name) {
7812ea4044fSAndreas Gohr        global $conf;
7822ea4044fSAndreas Gohr
7832ea4044fSAndreas Gohr        //if there is a hash we use the ancor name only
784ec34bb30SAndreas Gohr        list($name, $hash) = sexplode('#', $name, 2);
7852ea4044fSAndreas Gohr        if($hash) return $hash;
7862ea4044fSAndreas Gohr
7872ea4044fSAndreas Gohr        if($conf['useslash']) {
7883755fc25STom N Harris            $name = strtr($name, ';/', ';:');
7893755fc25STom N Harris        } else {
7903755fc25STom N Harris            $name = strtr($name, ';', ':');
7912ea4044fSAndreas Gohr        }
7922ea4044fSAndreas Gohr
7939708106bSAdrian Lang        return noNSorNS($name);
7942ea4044fSAndreas Gohr    }
7952ea4044fSAndreas Gohr
7961f82fabeSAndreas Gohr    /**
7971f82fabeSAndreas Gohr     * Resolve an interwikilink
79842ea7f44SGerrit Uitslag     *
79942ea7f44SGerrit Uitslag     * @param string    $shortcut  identifier for the interwiki link
80042ea7f44SGerrit Uitslag     * @param string    $reference fragment that refers the content
80142ea7f44SGerrit Uitslag     * @param null|bool $exists    reference which returns if an internal page exists
80242ea7f44SGerrit Uitslag     * @return string interwikilink
8031f82fabeSAndreas Gohr     */
804de369923SAndreas Gohr    public function _resolveInterWiki(&$shortcut, $reference, &$exists = null) {
8051f82fabeSAndreas Gohr        //get interwiki URL
8061f82fabeSAndreas Gohr        if(isset($this->interwiki[$shortcut])) {
8071f82fabeSAndreas Gohr            $url = $this->interwiki[$shortcut];
808768be5a3SPhy        }elseif(isset($this->interwiki['default'])) {
809768be5a3SPhy            $shortcut = 'default';
810768be5a3SPhy            $url = $this->interwiki[$shortcut];
8111f82fabeSAndreas Gohr        }else{
812abde5980SPhy            // not parsable interwiki outputs '' to make sure string manipluation works
813abde5980SPhy            $shortcut = '';
814abde5980SPhy            $url      = '';
8151f82fabeSAndreas Gohr        }
8162ea4044fSAndreas Gohr
8171f82fabeSAndreas Gohr        //split into hash and url part
81817e17ae2SPatrick Brown        $hash = strrchr($reference, '#');
81917e17ae2SPatrick Brown        if($hash) {
82017e17ae2SPatrick Brown            $reference = substr($reference, 0, -strlen($hash));
82117e17ae2SPatrick Brown            $hash = substr($hash, 1);
82217e17ae2SPatrick Brown        }
8231f82fabeSAndreas Gohr
8241f82fabeSAndreas Gohr        //replace placeholder
8251f82fabeSAndreas Gohr        if(preg_match('#\{(URL|NAME|SCHEME|HOST|PORT|PATH|QUERY)\}#', $url)) {
8261f82fabeSAndreas Gohr            //use placeholders
8271f82fabeSAndreas Gohr            $url    = str_replace('{URL}', rawurlencode($reference), $url);
82817e17ae2SPatrick Brown            //wiki names will be cleaned next, otherwise urlencode unsafe chars
8292401f18dSSyntaxseed            $url    = str_replace('{NAME}', ($url[0] === ':') ? $reference :
83017e17ae2SPatrick Brown                                  preg_replace_callback('/[[\\\\\]^`{|}#%]/', function($match) {
83117e17ae2SPatrick Brown                                    return rawurlencode($match[0]);
83217e17ae2SPatrick Brown                                  }, $reference), $url);
8331f82fabeSAndreas Gohr            $parsed = parse_url($reference);
8348f34cf3dSMichael Große            if (empty($parsed['scheme'])) $parsed['scheme'] = '';
8358f34cf3dSMichael Große            if (empty($parsed['host'])) $parsed['host'] = '';
8368f34cf3dSMichael Große            if (empty($parsed['port'])) $parsed['port'] = 80;
8378f34cf3dSMichael Große            if (empty($parsed['path'])) $parsed['path'] = '';
8388f34cf3dSMichael Große            if (empty($parsed['query'])) $parsed['query'] = '';
8398f34cf3dSMichael Große            $url = strtr($url,[
8408f34cf3dSMichael Große                '{SCHEME}' => $parsed['scheme'],
8418f34cf3dSMichael Große                '{HOST}' => $parsed['host'],
8428f34cf3dSMichael Große                '{PORT}' => $parsed['port'],
8438f34cf3dSMichael Große                '{PATH}' => $parsed['path'],
8448f34cf3dSMichael Große                '{QUERY}' => $parsed['query'] ,
8458f34cf3dSMichael Große            ]);
846abde5980SPhy        } else if($url != '') {
847abde5980SPhy            // make sure when no url is defined, we keep it null
8481f82fabeSAndreas Gohr            // default
8491f82fabeSAndreas Gohr            $url = $url.rawurlencode($reference);
8501f82fabeSAndreas Gohr        }
851f379edc2SGerrit Uitslag        //handle as wiki links
852056bf31fSDamien Regad        if($url && $url[0] === ':') {
853c55b109cSMichael Große            $urlparam = null;
854c55b109cSMichael Große            $id = $url;
855c55b109cSMichael Große            if (strpos($url, '?') !== false) {
856ec34bb30SAndreas Gohr                list($id, $urlparam) = sexplode('?', $url, 2, '');
857c55b109cSMichael Große            }
8586496c33fSGerrit Uitslag            $url    = wl(cleanID($id), $urlparam);
8596496c33fSGerrit Uitslag            $exists = page_exists($id);
8602345e871SGerrit Uitslag        }
8611f82fabeSAndreas Gohr        if($hash) $url .= '#'.rawurlencode($hash);
8621f82fabeSAndreas Gohr
8631f82fabeSAndreas Gohr        return $url;
8641f82fabeSAndreas Gohr    }
865cfa2b40eSAndreas Gohr
866cfa2b40eSAndreas Gohr    #endregion
8670cecf9d5Sandi}
8680cecf9d5Sandi
869340756e4Sandi
870e3776c06SMichael Hamann//Setup VIM: ex: et ts=4 :
871