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 9863befa1SAndreas Gohr/** 1056bd9509SPhy * Allowed chars in $language for code highlighting 1156bd9509SPhy * @see GeSHi::set_language() 1256bd9509SPhy */ 1356bd9509SPhydefine('PREG_PATTERN_VALID_LANGUAGE', '#[^a-zA-Z0-9\-_]#'); 1456bd9509SPhy 1556bd9509SPhy/** 16863befa1SAndreas Gohr * An empty renderer, produces no output 17863befa1SAndreas Gohr * 18863befa1SAndreas Gohr * Inherits from DokuWiki_Plugin for giving additional functions to render plugins 198e3a5477SAndreas Gohr * 208e3a5477SAndreas Gohr * The renderer transforms the syntax instructions created by the parser and handler into the 218e3a5477SAndreas Gohr * desired output format. For each instruction a corresponding method defined in this class will 228e3a5477SAndreas Gohr * be called. That method needs to produce the desired output for the instruction and add it to the 238e3a5477SAndreas Gohr * $doc field. When all instructions are processed, the $doc field contents will be cached by 248e3a5477SAndreas Gohr * DokuWiki and sent to the user. 25863befa1SAndreas Gohr */ 26*de369923SAndreas Gohrabstract class Doku_Renderer extends DokuWiki_Plugin { 27cfa2b40eSAndreas Gohr /** @var array Settings, control the behavior of the renderer */ 28cfa2b40eSAndreas Gohr public $info = array( 2944881bd0Shenning.noren 'cache' => true, // may the rendered result cached? 3044881bd0Shenning.noren 'toc' => true, // render the TOC? 319dc2c2afSandi ); 329dc2c2afSandi 33cfa2b40eSAndreas Gohr /** @var array contains the smiley configuration, set in p_render() */ 34cfa2b40eSAndreas Gohr public $smileys = array(); 35cfa2b40eSAndreas Gohr /** @var array contains the entity configuration, set in p_render() */ 36cfa2b40eSAndreas Gohr public $entities = array(); 37cfa2b40eSAndreas Gohr /** @var array contains the acronym configuration, set in p_render() */ 38cfa2b40eSAndreas Gohr public $acronyms = array(); 39cfa2b40eSAndreas Gohr /** @var array contains the interwiki configuration, set in p_render() */ 40cfa2b40eSAndreas Gohr public $interwiki = array(); 41e41c4da9SAndreas Gohr 42*de369923SAndreas Gohr /** @var array the list of headers used to create unique link ids */ 43*de369923SAndreas Gohr protected $headers = array(); 44*de369923SAndreas Gohr 455f70445dSAndreas Gohr /** 46cfa2b40eSAndreas Gohr * @var string the rendered document, this will be cached after the renderer ran through 475f70445dSAndreas Gohr */ 48cfa2b40eSAndreas Gohr public $doc = ''; 49cfa2b40eSAndreas Gohr 50cfa2b40eSAndreas Gohr /** 51cfa2b40eSAndreas Gohr * clean out any per-use values 52cfa2b40eSAndreas Gohr * 53cfa2b40eSAndreas Gohr * This is called before each use of the renderer object and should be used to 54cfa2b40eSAndreas Gohr * completely reset the state of the renderer to be reused for a new document 55cfa2b40eSAndreas Gohr */ 56*de369923SAndreas Gohr public function reset(){ 57*de369923SAndreas Gohr $this->headers = array(); 585f70445dSAndreas Gohr } 595f70445dSAndreas Gohr 60f6ec8df8SAdrian Lang /** 61f6ec8df8SAdrian Lang * Allow the plugin to prevent DokuWiki from reusing an instance 62f6ec8df8SAdrian Lang * 63cfa2b40eSAndreas Gohr * Since most renderer plugins fail to implement Doku_Renderer::reset() we default 64cfa2b40eSAndreas Gohr * to reinstantiating the renderer here 65cfa2b40eSAndreas Gohr * 66f6ec8df8SAdrian Lang * @return bool false if the plugin has to be instantiated 67f6ec8df8SAdrian Lang */ 68*de369923SAndreas Gohr public function isSingleton() { 69f6ec8df8SAdrian Lang return false; 70f6ec8df8SAdrian Lang } 71f6ec8df8SAdrian Lang 728cc41db0SAndreas Gohr /** 73cfa2b40eSAndreas Gohr * Returns the format produced by this renderer. 74cfa2b40eSAndreas Gohr * 75cfa2b40eSAndreas Gohr * Has to be overidden by sub classes 76cfa2b40eSAndreas Gohr * 77cfa2b40eSAndreas Gohr * @return string 78cfa2b40eSAndreas Gohr */ 79*de369923SAndreas Gohr abstract public function getFormat(); 80cfa2b40eSAndreas Gohr 81cfa2b40eSAndreas Gohr /** 82cfa2b40eSAndreas Gohr * Disable caching of this renderer's output 83cfa2b40eSAndreas Gohr */ 84cfa2b40eSAndreas Gohr function nocache() { 85cfa2b40eSAndreas Gohr $this->info['cache'] = false; 86cfa2b40eSAndreas Gohr } 87cfa2b40eSAndreas Gohr 88cfa2b40eSAndreas Gohr /** 89cfa2b40eSAndreas Gohr * Disable TOC generation for this renderer's output 90cfa2b40eSAndreas Gohr * 91cfa2b40eSAndreas Gohr * This might not be used for certain sub renderer 92cfa2b40eSAndreas Gohr */ 93cfa2b40eSAndreas Gohr function notoc() { 94cfa2b40eSAndreas Gohr $this->info['toc'] = false; 95cfa2b40eSAndreas Gohr } 96cfa2b40eSAndreas Gohr 97cfa2b40eSAndreas Gohr /** 98cfa2b40eSAndreas Gohr * Handle plugin rendering 99cfa2b40eSAndreas Gohr * 100cfa2b40eSAndreas Gohr * Most likely this needs NOT to be overwritten by sub classes 1018cc41db0SAndreas Gohr * 1028cc41db0SAndreas Gohr * @param string $name Plugin name 1038cc41db0SAndreas Gohr * @param mixed $data custom data set by handler 1048cc41db0SAndreas Gohr * @param string $state matched state if any 1058cc41db0SAndreas Gohr * @param string $match raw matched syntax 1068cc41db0SAndreas Gohr */ 107*de369923SAndreas Gohr public function plugin($name, $data, $state = '', $match = '') { 108cfa2b40eSAndreas Gohr /** @var DokuWiki_Syntax_Plugin $plugin */ 109e8b5a4f9SAndreas Gohr $plugin = plugin_load('syntax', $name); 11061faf446Schris if($plugin != null) { 1115f70445dSAndreas Gohr $plugin->render($this->getFormat(), $this, $data); 11261faf446Schris } 11361faf446Schris } 11461faf446Schris 1155587e44cSchris /** 1165587e44cSchris * handle nested render instructions 1175587e44cSchris * this method (and nest_close method) should not be overloaded in actual renderer output classes 118cfa2b40eSAndreas Gohr * 119cfa2b40eSAndreas Gohr * @param array $instructions 1205587e44cSchris */ 121*de369923SAndreas Gohr public function nest($instructions) { 1225587e44cSchris foreach($instructions as $instruction) { 1235587e44cSchris // execute the callback against ourself 124c2122b83SChristopher Smith if(method_exists($this, $instruction[0])) { 125d6a1a955SAndreas Gohr call_user_func_array(array($this, $instruction[0]), $instruction[1] ? $instruction[1] : array()); 126c2122b83SChristopher Smith } 1275587e44cSchris } 1285587e44cSchris } 1295587e44cSchris 130cfa2b40eSAndreas Gohr /** 131cfa2b40eSAndreas Gohr * dummy closing instruction issued by Doku_Handler_Nest 132cfa2b40eSAndreas Gohr * 133cfa2b40eSAndreas Gohr * normally the syntax mode should override this instruction when instantiating Doku_Handler_Nest - 134cfa2b40eSAndreas Gohr * however plugins will not be able to - as their instructions require data. 135cfa2b40eSAndreas Gohr */ 136*de369923SAndreas Gohr public function nest_close() { 1372c2835c2SAndreas Gohr } 1385587e44cSchris 139cfa2b40eSAndreas Gohr #region Syntax modes - sub classes will need to implement them to fill $doc 140cfa2b40eSAndreas Gohr 141cfa2b40eSAndreas Gohr /** 142cfa2b40eSAndreas Gohr * Initialize the document 143cfa2b40eSAndreas Gohr */ 144*de369923SAndreas Gohr public function document_start() { 1452c2835c2SAndreas Gohr } 1460cecf9d5Sandi 147cfa2b40eSAndreas Gohr /** 148cfa2b40eSAndreas Gohr * Finalize the document 149cfa2b40eSAndreas Gohr */ 150*de369923SAndreas Gohr public function document_end() { 1512c2835c2SAndreas Gohr } 1520cecf9d5Sandi 153cfa2b40eSAndreas Gohr /** 154cfa2b40eSAndreas Gohr * Render the Table of Contents 155cfa2b40eSAndreas Gohr * 156cfa2b40eSAndreas Gohr * @return string 157cfa2b40eSAndreas Gohr */ 158*de369923SAndreas Gohr public function render_TOC() { 1592c2835c2SAndreas Gohr return ''; 1602c2835c2SAndreas Gohr } 1610cecf9d5Sandi 162cfa2b40eSAndreas Gohr /** 163cfa2b40eSAndreas Gohr * Add an item to the TOC 164cfa2b40eSAndreas Gohr * 165cfa2b40eSAndreas Gohr * @param string $id the hash link 166cfa2b40eSAndreas Gohr * @param string $text the text to display 167cfa2b40eSAndreas Gohr * @param int $level the nesting level 168cfa2b40eSAndreas Gohr */ 169*de369923SAndreas Gohr public function toc_additem($id, $text, $level) { 1702c2835c2SAndreas Gohr } 171e7856beaSchris 172cfa2b40eSAndreas Gohr /** 173cfa2b40eSAndreas Gohr * Render a heading 174cfa2b40eSAndreas Gohr * 175cfa2b40eSAndreas Gohr * @param string $text the text to display 176cfa2b40eSAndreas Gohr * @param int $level header level 177cfa2b40eSAndreas Gohr * @param int $pos byte position in the original source 178cfa2b40eSAndreas Gohr */ 179*de369923SAndreas Gohr public function header($text, $level, $pos) { 1802c2835c2SAndreas Gohr } 1810cecf9d5Sandi 182cfa2b40eSAndreas Gohr /** 183cfa2b40eSAndreas Gohr * Open a new section 184cfa2b40eSAndreas Gohr * 185cfa2b40eSAndreas Gohr * @param int $level section level (as determined by the previous header) 186cfa2b40eSAndreas Gohr */ 187*de369923SAndreas Gohr public function section_open($level) { 1882c2835c2SAndreas Gohr } 1890cecf9d5Sandi 190cfa2b40eSAndreas Gohr /** 191cfa2b40eSAndreas Gohr * Close the current section 192cfa2b40eSAndreas Gohr */ 193*de369923SAndreas Gohr public function section_close() { 1942c2835c2SAndreas Gohr } 1950cecf9d5Sandi 196cfa2b40eSAndreas Gohr /** 197cfa2b40eSAndreas Gohr * Render plain text data 198cfa2b40eSAndreas Gohr * 19942ea7f44SGerrit Uitslag * @param string $text 200cfa2b40eSAndreas Gohr */ 201*de369923SAndreas Gohr public function cdata($text) { 2022c2835c2SAndreas Gohr } 2030cecf9d5Sandi 204cfa2b40eSAndreas Gohr /** 205cfa2b40eSAndreas Gohr * Open a paragraph 206cfa2b40eSAndreas Gohr */ 207*de369923SAndreas Gohr public function p_open() { 2082c2835c2SAndreas Gohr } 2090cecf9d5Sandi 210cfa2b40eSAndreas Gohr /** 211cfa2b40eSAndreas Gohr * Close a paragraph 212cfa2b40eSAndreas Gohr */ 213*de369923SAndreas Gohr public function p_close() { 2142c2835c2SAndreas Gohr } 2150cecf9d5Sandi 216cfa2b40eSAndreas Gohr /** 2173dd5c225SAndreas Gohr * Create a line break 218cfa2b40eSAndreas Gohr */ 219*de369923SAndreas Gohr public function linebreak() { 2202c2835c2SAndreas Gohr } 2210cecf9d5Sandi 222cfa2b40eSAndreas Gohr /** 223cfa2b40eSAndreas Gohr * Create a horizontal line 224cfa2b40eSAndreas Gohr */ 225*de369923SAndreas Gohr public function hr() { 2262c2835c2SAndreas Gohr } 2270cecf9d5Sandi 228cfa2b40eSAndreas Gohr /** 229cfa2b40eSAndreas Gohr * Start strong (bold) formatting 230cfa2b40eSAndreas Gohr */ 231*de369923SAndreas Gohr public function strong_open() { 2322c2835c2SAndreas Gohr } 2330cecf9d5Sandi 234cfa2b40eSAndreas Gohr /** 235cfa2b40eSAndreas Gohr * Stop strong (bold) formatting 236cfa2b40eSAndreas Gohr */ 237*de369923SAndreas Gohr public function strong_close() { 2382c2835c2SAndreas Gohr } 2390cecf9d5Sandi 240cfa2b40eSAndreas Gohr /** 241cfa2b40eSAndreas Gohr * Start emphasis (italics) formatting 242cfa2b40eSAndreas Gohr */ 243*de369923SAndreas Gohr public function emphasis_open() { 2442c2835c2SAndreas Gohr } 2450cecf9d5Sandi 246cfa2b40eSAndreas Gohr /** 247cfa2b40eSAndreas Gohr * Stop emphasis (italics) formatting 248cfa2b40eSAndreas Gohr */ 249*de369923SAndreas Gohr public function emphasis_close() { 2502c2835c2SAndreas Gohr } 2510cecf9d5Sandi 252cfa2b40eSAndreas Gohr /** 253cfa2b40eSAndreas Gohr * Start underline formatting 254cfa2b40eSAndreas Gohr */ 255*de369923SAndreas Gohr public function underline_open() { 2562c2835c2SAndreas Gohr } 2570cecf9d5Sandi 258cfa2b40eSAndreas Gohr /** 259cfa2b40eSAndreas Gohr * Stop underline formatting 260cfa2b40eSAndreas Gohr */ 261*de369923SAndreas Gohr public function underline_close() { 2622c2835c2SAndreas Gohr } 2630cecf9d5Sandi 264cfa2b40eSAndreas Gohr /** 265cfa2b40eSAndreas Gohr * Start monospace formatting 266cfa2b40eSAndreas Gohr */ 267*de369923SAndreas Gohr public function monospace_open() { 2682c2835c2SAndreas Gohr } 2690cecf9d5Sandi 270cfa2b40eSAndreas Gohr /** 271cfa2b40eSAndreas Gohr * Stop monospace formatting 272cfa2b40eSAndreas Gohr */ 273*de369923SAndreas Gohr public function monospace_close() { 2742c2835c2SAndreas Gohr } 2750cecf9d5Sandi 276cfa2b40eSAndreas Gohr /** 277cfa2b40eSAndreas Gohr * Start a subscript 278cfa2b40eSAndreas Gohr */ 279*de369923SAndreas Gohr public function subscript_open() { 2802c2835c2SAndreas Gohr } 2810cecf9d5Sandi 282cfa2b40eSAndreas Gohr /** 283cfa2b40eSAndreas Gohr * Stop a subscript 284cfa2b40eSAndreas Gohr */ 285*de369923SAndreas Gohr public function subscript_close() { 2862c2835c2SAndreas Gohr } 2870cecf9d5Sandi 288cfa2b40eSAndreas Gohr /** 289cfa2b40eSAndreas Gohr * Start a superscript 290cfa2b40eSAndreas Gohr */ 291*de369923SAndreas Gohr public function superscript_open() { 2922c2835c2SAndreas Gohr } 2930cecf9d5Sandi 294cfa2b40eSAndreas Gohr /** 295cfa2b40eSAndreas Gohr * Stop a superscript 296cfa2b40eSAndreas Gohr */ 297*de369923SAndreas Gohr public function superscript_close() { 2982c2835c2SAndreas Gohr } 2990cecf9d5Sandi 300cfa2b40eSAndreas Gohr /** 301cfa2b40eSAndreas Gohr * Start deleted (strike-through) formatting 302cfa2b40eSAndreas Gohr */ 303*de369923SAndreas Gohr public function deleted_open() { 3042c2835c2SAndreas Gohr } 3050cecf9d5Sandi 306cfa2b40eSAndreas Gohr /** 307cfa2b40eSAndreas Gohr * Stop deleted (strike-through) formatting 308cfa2b40eSAndreas Gohr */ 309*de369923SAndreas Gohr public function deleted_close() { 3102c2835c2SAndreas Gohr } 3110cecf9d5Sandi 312cfa2b40eSAndreas Gohr /** 313cfa2b40eSAndreas Gohr * Start a footnote 314cfa2b40eSAndreas Gohr */ 315*de369923SAndreas Gohr public function footnote_open() { 3162c2835c2SAndreas Gohr } 3170cecf9d5Sandi 318cfa2b40eSAndreas Gohr /** 319cfa2b40eSAndreas Gohr * Stop a footnote 320cfa2b40eSAndreas Gohr */ 321*de369923SAndreas Gohr public function footnote_close() { 3222c2835c2SAndreas Gohr } 3230cecf9d5Sandi 324cfa2b40eSAndreas Gohr /** 325cfa2b40eSAndreas Gohr * Open an unordered list 326cfa2b40eSAndreas Gohr */ 327*de369923SAndreas Gohr public function listu_open() { 3282c2835c2SAndreas Gohr } 3290cecf9d5Sandi 330cfa2b40eSAndreas Gohr /** 331cfa2b40eSAndreas Gohr * Close an unordered list 332cfa2b40eSAndreas Gohr */ 333*de369923SAndreas Gohr public function listu_close() { 3342c2835c2SAndreas Gohr } 3350cecf9d5Sandi 336cfa2b40eSAndreas Gohr /** 337cfa2b40eSAndreas Gohr * Open an ordered list 338cfa2b40eSAndreas Gohr */ 339*de369923SAndreas Gohr public function listo_open() { 3402c2835c2SAndreas Gohr } 3410cecf9d5Sandi 342cfa2b40eSAndreas Gohr /** 343cfa2b40eSAndreas Gohr * Close an ordered list 344cfa2b40eSAndreas Gohr */ 345*de369923SAndreas Gohr public function listo_close() { 3462c2835c2SAndreas Gohr } 3470cecf9d5Sandi 348cfa2b40eSAndreas Gohr /** 349cfa2b40eSAndreas Gohr * Open a list item 350cfa2b40eSAndreas Gohr * 351cfa2b40eSAndreas Gohr * @param int $level the nesting level 352e3a24861SChristopher Smith * @param bool $node true when a node; false when a leaf 353cfa2b40eSAndreas Gohr */ 354*de369923SAndreas Gohr public function listitem_open($level,$node=false) { 3552c2835c2SAndreas Gohr } 3560cecf9d5Sandi 357cfa2b40eSAndreas Gohr /** 358cfa2b40eSAndreas Gohr * Close a list item 359cfa2b40eSAndreas Gohr */ 360*de369923SAndreas Gohr public function listitem_close() { 3612c2835c2SAndreas Gohr } 3620cecf9d5Sandi 363cfa2b40eSAndreas Gohr /** 364cfa2b40eSAndreas Gohr * Start the content of a list item 365cfa2b40eSAndreas Gohr */ 366*de369923SAndreas Gohr public function listcontent_open() { 3672c2835c2SAndreas Gohr } 3680cecf9d5Sandi 369cfa2b40eSAndreas Gohr /** 370cfa2b40eSAndreas Gohr * Stop the content of a list item 371cfa2b40eSAndreas Gohr */ 372*de369923SAndreas Gohr public function listcontent_close() { 3732c2835c2SAndreas Gohr } 3740cecf9d5Sandi 375cfa2b40eSAndreas Gohr /** 376cfa2b40eSAndreas Gohr * Output unformatted $text 377cfa2b40eSAndreas Gohr * 378cfa2b40eSAndreas Gohr * Defaults to $this->cdata() 379cfa2b40eSAndreas Gohr * 380cfa2b40eSAndreas Gohr * @param string $text 381cfa2b40eSAndreas Gohr */ 382*de369923SAndreas Gohr public function unformatted($text) { 383cfa2b40eSAndreas Gohr $this->cdata($text); 3842c2835c2SAndreas Gohr } 3850cecf9d5Sandi 386cfa2b40eSAndreas Gohr /** 387cfa2b40eSAndreas Gohr * Output inline PHP code 388cfa2b40eSAndreas Gohr * 389cfa2b40eSAndreas Gohr * If $conf['phpok'] is true this should evaluate the given code and append the result 390cfa2b40eSAndreas Gohr * to $doc 391cfa2b40eSAndreas Gohr * 392cfa2b40eSAndreas Gohr * @param string $text The PHP code 393cfa2b40eSAndreas Gohr */ 394*de369923SAndreas Gohr public function php($text) { 3952c2835c2SAndreas Gohr } 3960cecf9d5Sandi 397cfa2b40eSAndreas Gohr /** 398cfa2b40eSAndreas Gohr * Output block level PHP code 399cfa2b40eSAndreas Gohr * 400cfa2b40eSAndreas Gohr * If $conf['phpok'] is true this should evaluate the given code and append the result 401cfa2b40eSAndreas Gohr * to $doc 402cfa2b40eSAndreas Gohr * 403cfa2b40eSAndreas Gohr * @param string $text The PHP code 404cfa2b40eSAndreas Gohr */ 405*de369923SAndreas Gohr public function phpblock($text) { 4062c2835c2SAndreas Gohr } 40707f89c3cSAnika Henke 408cfa2b40eSAndreas Gohr /** 409cfa2b40eSAndreas Gohr * Output raw inline HTML 410cfa2b40eSAndreas Gohr * 411cfa2b40eSAndreas Gohr * If $conf['htmlok'] is true this should add the code as is to $doc 412cfa2b40eSAndreas Gohr * 413cfa2b40eSAndreas Gohr * @param string $text The HTML 414cfa2b40eSAndreas Gohr */ 415*de369923SAndreas Gohr public function html($text) { 4162c2835c2SAndreas Gohr } 4170cecf9d5Sandi 418cfa2b40eSAndreas Gohr /** 419cfa2b40eSAndreas Gohr * Output raw block-level HTML 420cfa2b40eSAndreas Gohr * 421cfa2b40eSAndreas Gohr * If $conf['htmlok'] is true this should add the code as is to $doc 422cfa2b40eSAndreas Gohr * 423cfa2b40eSAndreas Gohr * @param string $text The HTML 424cfa2b40eSAndreas Gohr */ 425*de369923SAndreas Gohr public function htmlblock($text) { 4262c2835c2SAndreas Gohr } 42707f89c3cSAnika Henke 428cfa2b40eSAndreas Gohr /** 429cfa2b40eSAndreas Gohr * Output preformatted text 430cfa2b40eSAndreas Gohr * 431cfa2b40eSAndreas Gohr * @param string $text 432cfa2b40eSAndreas Gohr */ 433*de369923SAndreas Gohr public function preformatted($text) { 4342c2835c2SAndreas Gohr } 4350cecf9d5Sandi 436cfa2b40eSAndreas Gohr /** 437cfa2b40eSAndreas Gohr * Start a block quote 438cfa2b40eSAndreas Gohr */ 439*de369923SAndreas Gohr public function quote_open() { 4402c2835c2SAndreas Gohr } 4410cecf9d5Sandi 442cfa2b40eSAndreas Gohr /** 443cfa2b40eSAndreas Gohr * Stop a block quote 444cfa2b40eSAndreas Gohr */ 445*de369923SAndreas Gohr public function quote_close() { 4462c2835c2SAndreas Gohr } 4470cecf9d5Sandi 448cfa2b40eSAndreas Gohr /** 449cfa2b40eSAndreas Gohr * Display text as file content, optionally syntax highlighted 450cfa2b40eSAndreas Gohr * 451cfa2b40eSAndreas Gohr * @param string $text text to show 452cfa2b40eSAndreas Gohr * @param string $lang programming language to use for syntax highlighting 453cfa2b40eSAndreas Gohr * @param string $file file path label 454cfa2b40eSAndreas Gohr */ 455*de369923SAndreas Gohr public function file($text, $lang = null, $file = null) { 4562c2835c2SAndreas Gohr } 4573d491f75SAndreas Gohr 458cfa2b40eSAndreas Gohr /** 459cfa2b40eSAndreas Gohr * Display text as code content, optionally syntax highlighted 460cfa2b40eSAndreas Gohr * 461cfa2b40eSAndreas Gohr * @param string $text text to show 462cfa2b40eSAndreas Gohr * @param string $lang programming language to use for syntax highlighting 463cfa2b40eSAndreas Gohr * @param string $file file path label 464cfa2b40eSAndreas Gohr */ 465*de369923SAndreas Gohr public function code($text, $lang = null, $file = null) { 4662c2835c2SAndreas Gohr } 4670cecf9d5Sandi 468cfa2b40eSAndreas Gohr /** 469cfa2b40eSAndreas Gohr * Format an acronym 470cfa2b40eSAndreas Gohr * 471cfa2b40eSAndreas Gohr * Uses $this->acronyms 472cfa2b40eSAndreas Gohr * 473cfa2b40eSAndreas Gohr * @param string $acronym 474cfa2b40eSAndreas Gohr */ 475*de369923SAndreas Gohr public function acronym($acronym) { 4762c2835c2SAndreas Gohr } 4770cecf9d5Sandi 478cfa2b40eSAndreas Gohr /** 479cfa2b40eSAndreas Gohr * Format a smiley 480cfa2b40eSAndreas Gohr * 481cfa2b40eSAndreas Gohr * Uses $this->smiley 482cfa2b40eSAndreas Gohr * 483cfa2b40eSAndreas Gohr * @param string $smiley 484cfa2b40eSAndreas Gohr */ 485*de369923SAndreas Gohr public function smiley($smiley) { 4862c2835c2SAndreas Gohr } 4870cecf9d5Sandi 488cfa2b40eSAndreas Gohr /** 489cfa2b40eSAndreas Gohr * Format an entity 490cfa2b40eSAndreas Gohr * 491cfa2b40eSAndreas Gohr * Entities are basically small text replacements 492cfa2b40eSAndreas Gohr * 493cfa2b40eSAndreas Gohr * Uses $this->entities 494cfa2b40eSAndreas Gohr * 495cfa2b40eSAndreas Gohr * @param string $entity 496cfa2b40eSAndreas Gohr */ 497*de369923SAndreas Gohr public function entity($entity) { 4982c2835c2SAndreas Gohr } 4990cecf9d5Sandi 500cfa2b40eSAndreas Gohr /** 501cfa2b40eSAndreas Gohr * Typographically format a multiply sign 502cfa2b40eSAndreas Gohr * 503cfa2b40eSAndreas Gohr * Example: ($x=640, $y=480) should result in "640×480" 504cfa2b40eSAndreas Gohr * 505cfa2b40eSAndreas Gohr * @param string|int $x first value 506cfa2b40eSAndreas Gohr * @param string|int $y second value 507cfa2b40eSAndreas Gohr */ 508*de369923SAndreas Gohr public function multiplyentity($x, $y) { 5092c2835c2SAndreas Gohr } 5100cecf9d5Sandi 511cfa2b40eSAndreas Gohr /** 512cfa2b40eSAndreas Gohr * Render an opening single quote char (language specific) 513cfa2b40eSAndreas Gohr */ 514*de369923SAndreas Gohr public function singlequoteopening() { 5152c2835c2SAndreas Gohr } 5160cecf9d5Sandi 517cfa2b40eSAndreas Gohr /** 518cfa2b40eSAndreas Gohr * Render a closing single quote char (language specific) 519cfa2b40eSAndreas Gohr */ 520*de369923SAndreas Gohr public function singlequoteclosing() { 5212c2835c2SAndreas Gohr } 5220cecf9d5Sandi 523cfa2b40eSAndreas Gohr /** 524cfa2b40eSAndreas Gohr * Render an apostrophe char (language specific) 525cfa2b40eSAndreas Gohr */ 526*de369923SAndreas Gohr public function apostrophe() { 5272c2835c2SAndreas Gohr } 52857d757d1SAndreas Gohr 529cfa2b40eSAndreas Gohr /** 530cfa2b40eSAndreas Gohr * Render an opening double quote char (language specific) 531cfa2b40eSAndreas Gohr */ 532*de369923SAndreas Gohr public function doublequoteopening() { 5332c2835c2SAndreas Gohr } 5340cecf9d5Sandi 535cfa2b40eSAndreas Gohr /** 536cfa2b40eSAndreas Gohr * Render an closinging double quote char (language specific) 537cfa2b40eSAndreas Gohr */ 538*de369923SAndreas Gohr public function doublequoteclosing() { 5392c2835c2SAndreas Gohr } 5400cecf9d5Sandi 541cfa2b40eSAndreas Gohr /** 542cfa2b40eSAndreas Gohr * Render a CamelCase link 543cfa2b40eSAndreas Gohr * 544cfa2b40eSAndreas Gohr * @param string $link The link name 545cfa2b40eSAndreas Gohr * @see http://en.wikipedia.org/wiki/CamelCase 546cfa2b40eSAndreas Gohr */ 547*de369923SAndreas Gohr public function camelcaselink($link) { 5482c2835c2SAndreas Gohr } 5490cecf9d5Sandi 550cfa2b40eSAndreas Gohr /** 551cfa2b40eSAndreas Gohr * Render a page local link 552cfa2b40eSAndreas Gohr * 553cfa2b40eSAndreas Gohr * @param string $hash hash link identifier 554cfa2b40eSAndreas Gohr * @param string $name name for the link 555cfa2b40eSAndreas Gohr */ 556*de369923SAndreas Gohr public function locallink($hash, $name = null) { 5572c2835c2SAndreas Gohr } 558a939d432SAndreas Gohr 559cfa2b40eSAndreas Gohr /** 560cfa2b40eSAndreas Gohr * Render a wiki internal link 561cfa2b40eSAndreas Gohr * 562cfa2b40eSAndreas Gohr * @param string $link page ID to link to. eg. 'wiki:syntax' 563cfa2b40eSAndreas Gohr * @param string|array $title name for the link, array for media file 564cfa2b40eSAndreas Gohr */ 565*de369923SAndreas Gohr public function internallink($link, $title = null) { 5662c2835c2SAndreas Gohr } 5670cecf9d5Sandi 568cfa2b40eSAndreas Gohr /** 569cfa2b40eSAndreas Gohr * Render an external link 570cfa2b40eSAndreas Gohr * 571cfa2b40eSAndreas Gohr * @param string $link full URL with scheme 572cfa2b40eSAndreas Gohr * @param string|array $title name for the link, array for media file 573cfa2b40eSAndreas Gohr */ 574*de369923SAndreas Gohr public function externallink($link, $title = null) { 5752c2835c2SAndreas Gohr } 5760cecf9d5Sandi 577cfa2b40eSAndreas Gohr /** 578cfa2b40eSAndreas Gohr * Render the output of an RSS feed 579cfa2b40eSAndreas Gohr * 580cfa2b40eSAndreas Gohr * @param string $url URL of the feed 581cfa2b40eSAndreas Gohr * @param array $params Finetuning of the output 582cfa2b40eSAndreas Gohr */ 583*de369923SAndreas Gohr public function rss($url, $params) { 5842c2835c2SAndreas Gohr } 585c5cfca61SAndreas Gohr 586cfa2b40eSAndreas Gohr /** 587cfa2b40eSAndreas Gohr * Render an interwiki link 588cfa2b40eSAndreas Gohr * 589cfa2b40eSAndreas Gohr * You may want to use $this->_resolveInterWiki() here 590cfa2b40eSAndreas Gohr * 591cfa2b40eSAndreas Gohr * @param string $link original link - probably not much use 592cfa2b40eSAndreas Gohr * @param string|array $title name for the link, array for media file 593cfa2b40eSAndreas Gohr * @param string $wikiName indentifier (shortcut) for the remote wiki 594cfa2b40eSAndreas Gohr * @param string $wikiUri the fragment parsed from the original link 595cfa2b40eSAndreas Gohr */ 596*de369923SAndreas Gohr public function interwikilink($link, $title, $wikiName, $wikiUri) { 5972c2835c2SAndreas Gohr } 5980cecf9d5Sandi 599cfa2b40eSAndreas Gohr /** 600cfa2b40eSAndreas Gohr * Link to file on users OS 601cfa2b40eSAndreas Gohr * 602cfa2b40eSAndreas Gohr * @param string $link the link 603cfa2b40eSAndreas Gohr * @param string|array $title name for the link, array for media file 604cfa2b40eSAndreas Gohr */ 605*de369923SAndreas Gohr public function filelink($link, $title = null) { 6062c2835c2SAndreas Gohr } 6070cecf9d5Sandi 608cfa2b40eSAndreas Gohr /** 609cfa2b40eSAndreas Gohr * Link to windows share 610cfa2b40eSAndreas Gohr * 611cfa2b40eSAndreas Gohr * @param string $link the link 612cfa2b40eSAndreas Gohr * @param string|array $title name for the link, array for media file 613cfa2b40eSAndreas Gohr */ 614*de369923SAndreas Gohr public function windowssharelink($link, $title = null) { 6152c2835c2SAndreas Gohr } 6160cecf9d5Sandi 617cfa2b40eSAndreas Gohr /** 618cfa2b40eSAndreas Gohr * Render a linked E-Mail Address 619cfa2b40eSAndreas Gohr * 620cfa2b40eSAndreas Gohr * Should honor $conf['mailguard'] setting 621cfa2b40eSAndreas Gohr * 622cfa2b40eSAndreas Gohr * @param string $address Email-Address 6233dd5c225SAndreas Gohr * @param string|array $name name for the link, array for media file 624cfa2b40eSAndreas Gohr */ 625*de369923SAndreas Gohr public function emaillink($address, $name = null) { 6262c2835c2SAndreas Gohr } 6270cecf9d5Sandi 628cfa2b40eSAndreas Gohr /** 629cfa2b40eSAndreas Gohr * Render an internal media file 630cfa2b40eSAndreas Gohr * 631cfa2b40eSAndreas Gohr * @param string $src media ID 632cfa2b40eSAndreas Gohr * @param string $title descriptive text 633cfa2b40eSAndreas Gohr * @param string $align left|center|right 634cfa2b40eSAndreas Gohr * @param int $width width of media in pixel 635cfa2b40eSAndreas Gohr * @param int $height height of media in pixel 636cfa2b40eSAndreas Gohr * @param string $cache cache|recache|nocache 637cfa2b40eSAndreas Gohr * @param string $linking linkonly|detail|nolink 638cfa2b40eSAndreas Gohr */ 639*de369923SAndreas Gohr public function internalmedia($src, $title = null, $align = null, $width = null, 6402c2835c2SAndreas Gohr $height = null, $cache = null, $linking = null) { 6412c2835c2SAndreas Gohr } 642a939d432SAndreas Gohr 643cfa2b40eSAndreas Gohr /** 644cfa2b40eSAndreas Gohr * Render an external media file 645cfa2b40eSAndreas Gohr * 646cfa2b40eSAndreas Gohr * @param string $src full media URL 647cfa2b40eSAndreas Gohr * @param string $title descriptive text 648cfa2b40eSAndreas Gohr * @param string $align left|center|right 649cfa2b40eSAndreas Gohr * @param int $width width of media in pixel 650cfa2b40eSAndreas Gohr * @param int $height height of media in pixel 651cfa2b40eSAndreas Gohr * @param string $cache cache|recache|nocache 652cfa2b40eSAndreas Gohr * @param string $linking linkonly|detail|nolink 653cfa2b40eSAndreas Gohr */ 654*de369923SAndreas Gohr public function externalmedia($src, $title = null, $align = null, $width = null, 6552c2835c2SAndreas Gohr $height = null, $cache = null, $linking = null) { 6562c2835c2SAndreas Gohr } 657a939d432SAndreas Gohr 658cfa2b40eSAndreas Gohr /** 659cfa2b40eSAndreas Gohr * Render a link to an internal media file 660cfa2b40eSAndreas Gohr * 661cfa2b40eSAndreas Gohr * @param string $src media ID 662cfa2b40eSAndreas Gohr * @param string $title descriptive text 663cfa2b40eSAndreas Gohr * @param string $align left|center|right 664cfa2b40eSAndreas Gohr * @param int $width width of media in pixel 665cfa2b40eSAndreas Gohr * @param int $height height of media in pixel 666cfa2b40eSAndreas Gohr * @param string $cache cache|recache|nocache 667cfa2b40eSAndreas Gohr */ 668*de369923SAndreas Gohr public function internalmedialink($src, $title = null, $align = null, 669cfa2b40eSAndreas Gohr $width = null, $height = null, $cache = null) { 6702c2835c2SAndreas Gohr } 6710cecf9d5Sandi 672cfa2b40eSAndreas Gohr /** 673cfa2b40eSAndreas Gohr * Render a link to an external media file 674cfa2b40eSAndreas Gohr * 675cfa2b40eSAndreas Gohr * @param string $src media ID 676cfa2b40eSAndreas Gohr * @param string $title descriptive text 677cfa2b40eSAndreas Gohr * @param string $align left|center|right 678cfa2b40eSAndreas Gohr * @param int $width width of media in pixel 679cfa2b40eSAndreas Gohr * @param int $height height of media in pixel 680cfa2b40eSAndreas Gohr * @param string $cache cache|recache|nocache 681cfa2b40eSAndreas Gohr */ 682*de369923SAndreas Gohr public function externalmedialink($src, $title = null, $align = null, 683cfa2b40eSAndreas Gohr $width = null, $height = null, $cache = null) { 6842c2835c2SAndreas Gohr } 6850cecf9d5Sandi 686cfa2b40eSAndreas Gohr /** 687cfa2b40eSAndreas Gohr * Start a table 688cfa2b40eSAndreas Gohr * 689cfa2b40eSAndreas Gohr * @param int $maxcols maximum number of columns 690cfa2b40eSAndreas Gohr * @param int $numrows NOT IMPLEMENTED 691cfa2b40eSAndreas Gohr * @param int $pos byte position in the original source 692cfa2b40eSAndreas Gohr */ 693*de369923SAndreas Gohr public function table_open($maxcols = null, $numrows = null, $pos = null) { 6942c2835c2SAndreas Gohr } 6950cecf9d5Sandi 696cfa2b40eSAndreas Gohr /** 697cfa2b40eSAndreas Gohr * Close a table 698cfa2b40eSAndreas Gohr * 699cfa2b40eSAndreas Gohr * @param int $pos byte position in the original source 700cfa2b40eSAndreas Gohr */ 701*de369923SAndreas Gohr public function table_close($pos = null) { 7022c2835c2SAndreas Gohr } 7030cecf9d5Sandi 704cfa2b40eSAndreas Gohr /** 705cfa2b40eSAndreas Gohr * Open a table header 706cfa2b40eSAndreas Gohr */ 707*de369923SAndreas Gohr public function tablethead_open() { 7082c2835c2SAndreas Gohr } 709f05a1cc5SGerrit Uitslag 710cfa2b40eSAndreas Gohr /** 711cfa2b40eSAndreas Gohr * Close a table header 712cfa2b40eSAndreas Gohr */ 713*de369923SAndreas Gohr public function tablethead_close() { 7142c2835c2SAndreas Gohr } 715f05a1cc5SGerrit Uitslag 716cfa2b40eSAndreas Gohr /** 7175a93f869SAnika Henke * Open a table body 7185a93f869SAnika Henke */ 719*de369923SAndreas Gohr public function tabletbody_open() { 7205a93f869SAnika Henke } 7215a93f869SAnika Henke 7225a93f869SAnika Henke /** 7235a93f869SAnika Henke * Close a table body 7245a93f869SAnika Henke */ 725*de369923SAndreas Gohr public function tabletbody_close() { 7265a93f869SAnika Henke } 7275a93f869SAnika Henke 7285a93f869SAnika Henke /** 729d2a99739SAndreas Gohr * Open a table footer 730d2a99739SAndreas Gohr */ 731*de369923SAndreas Gohr public function tabletfoot_open() { 732d2a99739SAndreas Gohr } 733d2a99739SAndreas Gohr 734d2a99739SAndreas Gohr /** 735d2a99739SAndreas Gohr * Close a table footer 736d2a99739SAndreas Gohr */ 737*de369923SAndreas Gohr public function tabletfoot_close() { 738d2a99739SAndreas Gohr } 739d2a99739SAndreas Gohr 740d2a99739SAndreas Gohr /** 741cfa2b40eSAndreas Gohr * Open a table row 742cfa2b40eSAndreas Gohr */ 743*de369923SAndreas Gohr public function tablerow_open() { 7442c2835c2SAndreas Gohr } 7450cecf9d5Sandi 746cfa2b40eSAndreas Gohr /** 747cfa2b40eSAndreas Gohr * Close a table row 748cfa2b40eSAndreas Gohr */ 749*de369923SAndreas Gohr public function tablerow_close() { 7502c2835c2SAndreas Gohr } 7510cecf9d5Sandi 752cfa2b40eSAndreas Gohr /** 753cfa2b40eSAndreas Gohr * Open a table header cell 754cfa2b40eSAndreas Gohr * 755cfa2b40eSAndreas Gohr * @param int $colspan 756cfa2b40eSAndreas Gohr * @param string $align left|center|right 757cfa2b40eSAndreas Gohr * @param int $rowspan 758cfa2b40eSAndreas Gohr */ 759*de369923SAndreas Gohr public function tableheader_open($colspan = 1, $align = null, $rowspan = 1) { 7602c2835c2SAndreas Gohr } 7610cecf9d5Sandi 762cfa2b40eSAndreas Gohr /** 763cfa2b40eSAndreas Gohr * Close a table header cell 764cfa2b40eSAndreas Gohr */ 765*de369923SAndreas Gohr public function tableheader_close() { 7662c2835c2SAndreas Gohr } 7670cecf9d5Sandi 768cfa2b40eSAndreas Gohr /** 769cfa2b40eSAndreas Gohr * Open a table cell 770cfa2b40eSAndreas Gohr * 771cfa2b40eSAndreas Gohr * @param int $colspan 772cfa2b40eSAndreas Gohr * @param string $align left|center|right 773cfa2b40eSAndreas Gohr * @param int $rowspan 774cfa2b40eSAndreas Gohr */ 775*de369923SAndreas Gohr public function tablecell_open($colspan = 1, $align = null, $rowspan = 1) { 7762c2835c2SAndreas Gohr } 7770cecf9d5Sandi 778cfa2b40eSAndreas Gohr /** 779cfa2b40eSAndreas Gohr * Close a table cell 780cfa2b40eSAndreas Gohr */ 781*de369923SAndreas Gohr public function tablecell_close() { 7822c2835c2SAndreas Gohr } 7832ea4044fSAndreas Gohr 784cfa2b40eSAndreas Gohr #endregion 785cfa2b40eSAndreas Gohr 786cfa2b40eSAndreas Gohr #region util functions, you probably won't need to reimplement them 7872ea4044fSAndreas Gohr 7882ea4044fSAndreas Gohr /** 789*de369923SAndreas Gohr * Creates a linkid from a headline 790*de369923SAndreas Gohr * 791*de369923SAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org> 792*de369923SAndreas Gohr * @param string $title The headline title 793*de369923SAndreas Gohr * @param boolean $create Create a new unique ID? 794*de369923SAndreas Gohr * @return string 795*de369923SAndreas Gohr */ 796*de369923SAndreas Gohr public function _headerToLink($title, $create = false) { 797*de369923SAndreas Gohr if($create) { 798*de369923SAndreas Gohr return sectionID($title, $this->headers); 799*de369923SAndreas Gohr } else { 800*de369923SAndreas Gohr $check = false; 801*de369923SAndreas Gohr return sectionID($title, $check); 802*de369923SAndreas Gohr } 803*de369923SAndreas Gohr } 804*de369923SAndreas Gohr 805*de369923SAndreas Gohr /** 8062ea4044fSAndreas Gohr * Removes any Namespace from the given name but keeps 8072ea4044fSAndreas Gohr * casing and special chars 8082ea4044fSAndreas Gohr * 8092ea4044fSAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org> 81042ea7f44SGerrit Uitslag * 81142ea7f44SGerrit Uitslag * @param string $name 81242ea7f44SGerrit Uitslag * @return string 8132ea4044fSAndreas Gohr */ 814*de369923SAndreas Gohr protected function _simpleTitle($name) { 8152ea4044fSAndreas Gohr global $conf; 8162ea4044fSAndreas Gohr 8172ea4044fSAndreas Gohr //if there is a hash we use the ancor name only 8186d2af55dSChristopher Smith @list($name, $hash) = explode('#', $name, 2); 8192ea4044fSAndreas Gohr if($hash) return $hash; 8202ea4044fSAndreas Gohr 8212ea4044fSAndreas Gohr if($conf['useslash']) { 8223755fc25STom N Harris $name = strtr($name, ';/', ';:'); 8233755fc25STom N Harris } else { 8243755fc25STom N Harris $name = strtr($name, ';', ':'); 8252ea4044fSAndreas Gohr } 8262ea4044fSAndreas Gohr 8279708106bSAdrian Lang return noNSorNS($name); 8282ea4044fSAndreas Gohr } 8292ea4044fSAndreas Gohr 8301f82fabeSAndreas Gohr /** 8311f82fabeSAndreas Gohr * Resolve an interwikilink 83242ea7f44SGerrit Uitslag * 83342ea7f44SGerrit Uitslag * @param string $shortcut identifier for the interwiki link 83442ea7f44SGerrit Uitslag * @param string $reference fragment that refers the content 83542ea7f44SGerrit Uitslag * @param null|bool $exists reference which returns if an internal page exists 83642ea7f44SGerrit Uitslag * @return string interwikilink 8371f82fabeSAndreas Gohr */ 838*de369923SAndreas Gohr public function _resolveInterWiki(&$shortcut, $reference, &$exists = null) { 8391f82fabeSAndreas Gohr //get interwiki URL 8401f82fabeSAndreas Gohr if(isset($this->interwiki[$shortcut])) { 8411f82fabeSAndreas Gohr $url = $this->interwiki[$shortcut]; 8421f82fabeSAndreas Gohr } else { 8431f82fabeSAndreas Gohr // Default to Google I'm feeling lucky 844ccee93d9SPatrick Brown $url = 'https://www.google.com/search?q={URL}&btnI=lucky'; 8451f82fabeSAndreas Gohr $shortcut = 'go'; 8461f82fabeSAndreas Gohr } 8472ea4044fSAndreas Gohr 8481f82fabeSAndreas Gohr //split into hash and url part 84917e17ae2SPatrick Brown $hash = strrchr($reference, '#'); 85017e17ae2SPatrick Brown if($hash) { 85117e17ae2SPatrick Brown $reference = substr($reference, 0, -strlen($hash)); 85217e17ae2SPatrick Brown $hash = substr($hash, 1); 85317e17ae2SPatrick Brown } 8541f82fabeSAndreas Gohr 8551f82fabeSAndreas Gohr //replace placeholder 8561f82fabeSAndreas Gohr if(preg_match('#\{(URL|NAME|SCHEME|HOST|PORT|PATH|QUERY)\}#', $url)) { 8571f82fabeSAndreas Gohr //use placeholders 8581f82fabeSAndreas Gohr $url = str_replace('{URL}', rawurlencode($reference), $url); 85917e17ae2SPatrick Brown //wiki names will be cleaned next, otherwise urlencode unsafe chars 86017e17ae2SPatrick Brown $url = str_replace('{NAME}', ($url{0} === ':') ? $reference : 86117e17ae2SPatrick Brown preg_replace_callback('/[[\\\\\]^`{|}#%]/', function($match) { 86217e17ae2SPatrick Brown return rawurlencode($match[0]); 86317e17ae2SPatrick Brown }, $reference), $url); 8641f82fabeSAndreas Gohr $parsed = parse_url($reference); 8658f34cf3dSMichael Große if (empty($parsed['scheme'])) $parsed['scheme'] = ''; 8668f34cf3dSMichael Große if (empty($parsed['host'])) $parsed['host'] = ''; 8678f34cf3dSMichael Große if (empty($parsed['port'])) $parsed['port'] = 80; 8688f34cf3dSMichael Große if (empty($parsed['path'])) $parsed['path'] = ''; 8698f34cf3dSMichael Große if (empty($parsed['query'])) $parsed['query'] = ''; 8708f34cf3dSMichael Große $url = strtr($url,[ 8718f34cf3dSMichael Große '{SCHEME}' => $parsed['scheme'], 8728f34cf3dSMichael Große '{HOST}' => $parsed['host'], 8738f34cf3dSMichael Große '{PORT}' => $parsed['port'], 8748f34cf3dSMichael Große '{PATH}' => $parsed['path'], 8758f34cf3dSMichael Große '{QUERY}' => $parsed['query'] , 8768f34cf3dSMichael Große ]); 8771f82fabeSAndreas Gohr } else { 8781f82fabeSAndreas Gohr //default 8791f82fabeSAndreas Gohr $url = $url.rawurlencode($reference); 8801f82fabeSAndreas Gohr } 881f379edc2SGerrit Uitslag //handle as wiki links 8826496c33fSGerrit Uitslag if($url{0} === ':') { 883c55b109cSMichael Große $urlparam = null; 884c55b109cSMichael Große $id = $url; 885c55b109cSMichael Große if (strpos($url, '?') !== false) { 8866496c33fSGerrit Uitslag list($id, $urlparam) = explode('?', $url, 2); 887c55b109cSMichael Große } 8886496c33fSGerrit Uitslag $url = wl(cleanID($id), $urlparam); 8896496c33fSGerrit Uitslag $exists = page_exists($id); 8902345e871SGerrit Uitslag } 8911f82fabeSAndreas Gohr if($hash) $url .= '#'.rawurlencode($hash); 8921f82fabeSAndreas Gohr 8931f82fabeSAndreas Gohr return $url; 8941f82fabeSAndreas Gohr } 895cfa2b40eSAndreas Gohr 896cfa2b40eSAndreas Gohr #endregion 8970cecf9d5Sandi} 8980cecf9d5Sandi 899340756e4Sandi 900e3776c06SMichael Hamann//Setup VIM: ex: et ts=4 : 901