Complex classes like Doku_Renderer_xhtml often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Doku_Renderer_xhtml, and based on these observations, apply Extract Interface, too.
| 1 | <?php  | 
            ||
| 25 | class Doku_Renderer_xhtml extends Doku_Renderer { | 
            ||
| 26 | /** @var array store the table of contents */  | 
            ||
| 27 | public $toc = array();  | 
            ||
| 28 | |||
| 29 | /** @var array A stack of section edit data */  | 
            ||
| 30 | protected $sectionedits = array();  | 
            ||
| 31 | var $date_at = ''; // link pages and media against this revision  | 
            ||
| 32 | |||
| 33 | /** @var int last section edit id, used by startSectionEdit */  | 
            ||
| 34 | protected $lastsecid = 0;  | 
            ||
| 35 | |||
| 36 | /** @var array the list of headers used to create unique link ids */  | 
            ||
| 37 | protected $headers = array();  | 
            ||
| 38 | |||
| 39 | /** @var array a list of footnotes, list starts at 1! */  | 
            ||
| 40 | protected $footnotes = array();  | 
            ||
| 41 | |||
| 42 | /** @var int current section level */  | 
            ||
| 43 | protected $lastlevel = 0;  | 
            ||
| 44 | /** @var array section node tracker */  | 
            ||
| 45 | protected $node = array(0, 0, 0, 0, 0);  | 
            ||
| 46 | |||
| 47 | /** @var string temporary $doc store */  | 
            ||
| 48 | protected $store = '';  | 
            ||
| 49 | |||
| 50 | /** @var array global counter, for table classes etc. */  | 
            ||
| 51 | protected $_counter = array(); //  | 
            ||
| 52 | |||
| 53 | /** @var int counts the code and file blocks, used to provide download links */  | 
            ||
| 54 | protected $_codeblock = 0;  | 
            ||
| 55 | |||
| 56 | /** @var array list of allowed URL schemes */  | 
            ||
| 57 | protected $schemes = null;  | 
            ||
| 58 | |||
| 59 | /**  | 
            ||
| 60 | * Register a new edit section range  | 
            ||
| 61 | *  | 
            ||
| 62 | * @param string $type The section type identifier  | 
            ||
| 63 | * @param string $title The section title  | 
            ||
| 64 | * @param int $start The byte position for the edit start  | 
            ||
| 65 | * @return string A marker class for the starting HTML element  | 
            ||
| 66 | *  | 
            ||
| 67 | * @author Adrian Lang <[email protected]>  | 
            ||
| 68 | */  | 
            ||
| 69 |     public function startSectionEdit($start, $type, $title = null) { | 
            ||
| 73 | |||
| 74 | /**  | 
            ||
| 75 | * Finish an edit section range  | 
            ||
| 76 | *  | 
            ||
| 77 | * @param int $end The byte position for the edit end; null for the rest of the page  | 
            ||
| 78 | *  | 
            ||
| 79 | * @author Adrian Lang <[email protected]>  | 
            ||
| 80 | */  | 
            ||
| 81 |     public function finishSectionEdit($end = null) { | 
            ||
| 92 | |||
| 93 | /**  | 
            ||
| 94 | * Returns the format produced by this renderer.  | 
            ||
| 95 | *  | 
            ||
| 96 | * @return string always 'xhtml'  | 
            ||
| 97 | */  | 
            ||
| 98 |     function getFormat() { | 
            ||
| 101 | |||
| 102 | /**  | 
            ||
| 103 | * Initialize the document  | 
            ||
| 104 | */  | 
            ||
| 105 |     function document_start() { | 
            ||
| 110 | |||
| 111 | /**  | 
            ||
| 112 | * Finalize the document  | 
            ||
| 113 | */  | 
            ||
| 114 |     function document_end() { | 
            ||
| 167 | |||
| 168 | /**  | 
            ||
| 169 | * Add an item to the TOC  | 
            ||
| 170 | *  | 
            ||
| 171 | * @param string $id the hash link  | 
            ||
| 172 | * @param string $text the text to display  | 
            ||
| 173 | * @param int $level the nesting level  | 
            ||
| 174 | */  | 
            ||
| 175 |     function toc_additem($id, $text, $level) { | 
            ||
| 183 | |||
| 184 | /**  | 
            ||
| 185 | * Render a heading  | 
            ||
| 186 | *  | 
            ||
| 187 | * @param string $text the text to display  | 
            ||
| 188 | * @param int $level header level  | 
            ||
| 189 | * @param int $pos byte position in the original source  | 
            ||
| 190 | */  | 
            ||
| 191 |     function header($text, $level, $pos) { | 
            ||
| 226 | |||
| 227 | /**  | 
            ||
| 228 | * Open a new section  | 
            ||
| 229 | *  | 
            ||
| 230 | * @param int $level section level (as determined by the previous header)  | 
            ||
| 231 | */  | 
            ||
| 232 |     function section_open($level) { | 
            ||
| 235 | |||
| 236 | /**  | 
            ||
| 237 | * Close the current section  | 
            ||
| 238 | */  | 
            ||
| 239 |     function section_close() { | 
            ||
| 242 | |||
| 243 | /**  | 
            ||
| 244 | * Render plain text data  | 
            ||
| 245 | *  | 
            ||
| 246 | * @param $text  | 
            ||
| 247 | */  | 
            ||
| 248 |     function cdata($text) { | 
            ||
| 251 | |||
| 252 | /**  | 
            ||
| 253 | * Open a paragraph  | 
            ||
| 254 | */  | 
            ||
| 255 |     function p_open() { | 
            ||
| 258 | |||
| 259 | /**  | 
            ||
| 260 | * Close a paragraph  | 
            ||
| 261 | */  | 
            ||
| 262 |     function p_close() { | 
            ||
| 265 | |||
| 266 | /**  | 
            ||
| 267 | * Create a line break  | 
            ||
| 268 | */  | 
            ||
| 269 |     function linebreak() { | 
            ||
| 272 | |||
| 273 | /**  | 
            ||
| 274 | * Create a horizontal line  | 
            ||
| 275 | */  | 
            ||
| 276 |     function hr() { | 
            ||
| 279 | |||
| 280 | /**  | 
            ||
| 281 | * Start strong (bold) formatting  | 
            ||
| 282 | */  | 
            ||
| 283 |     function strong_open() { | 
            ||
| 286 | |||
| 287 | /**  | 
            ||
| 288 | * Stop strong (bold) formatting  | 
            ||
| 289 | */  | 
            ||
| 290 |     function strong_close() { | 
            ||
| 293 | |||
| 294 | /**  | 
            ||
| 295 | * Start emphasis (italics) formatting  | 
            ||
| 296 | */  | 
            ||
| 297 |     function emphasis_open() { | 
            ||
| 300 | |||
| 301 | /**  | 
            ||
| 302 | * Stop emphasis (italics) formatting  | 
            ||
| 303 | */  | 
            ||
| 304 |     function emphasis_close() { | 
            ||
| 307 | |||
| 308 | /**  | 
            ||
| 309 | * Start underline formatting  | 
            ||
| 310 | */  | 
            ||
| 311 |     function underline_open() { | 
            ||
| 314 | |||
| 315 | /**  | 
            ||
| 316 | * Stop underline formatting  | 
            ||
| 317 | */  | 
            ||
| 318 |     function underline_close() { | 
            ||
| 321 | |||
| 322 | /**  | 
            ||
| 323 | * Start monospace formatting  | 
            ||
| 324 | */  | 
            ||
| 325 |     function monospace_open() { | 
            ||
| 328 | |||
| 329 | /**  | 
            ||
| 330 | * Stop monospace formatting  | 
            ||
| 331 | */  | 
            ||
| 332 |     function monospace_close() { | 
            ||
| 335 | |||
| 336 | /**  | 
            ||
| 337 | * Start a subscript  | 
            ||
| 338 | */  | 
            ||
| 339 |     function subscript_open() { | 
            ||
| 342 | |||
| 343 | /**  | 
            ||
| 344 | * Stop a subscript  | 
            ||
| 345 | */  | 
            ||
| 346 |     function subscript_close() { | 
            ||
| 349 | |||
| 350 | /**  | 
            ||
| 351 | * Start a superscript  | 
            ||
| 352 | */  | 
            ||
| 353 |     function superscript_open() { | 
            ||
| 356 | |||
| 357 | /**  | 
            ||
| 358 | * Stop a superscript  | 
            ||
| 359 | */  | 
            ||
| 360 |     function superscript_close() { | 
            ||
| 363 | |||
| 364 | /**  | 
            ||
| 365 | * Start deleted (strike-through) formatting  | 
            ||
| 366 | */  | 
            ||
| 367 |     function deleted_open() { | 
            ||
| 370 | |||
| 371 | /**  | 
            ||
| 372 | * Stop deleted (strike-through) formatting  | 
            ||
| 373 | */  | 
            ||
| 374 |     function deleted_close() { | 
            ||
| 377 | |||
| 378 | /**  | 
            ||
| 379 | * Callback for footnote start syntax  | 
            ||
| 380 | *  | 
            ||
| 381 | * All following content will go to the footnote instead of  | 
            ||
| 382 | * the document. To achieve this the previous rendered content  | 
            ||
| 383 | * is moved to $store and $doc is cleared  | 
            ||
| 384 | *  | 
            ||
| 385 | * @author Andreas Gohr <[email protected]>  | 
            ||
| 386 | */  | 
            ||
| 387 |     function footnote_open() { | 
            ||
| 393 | |||
| 394 | /**  | 
            ||
| 395 | * Callback for footnote end syntax  | 
            ||
| 396 | *  | 
            ||
| 397 | * All rendered content is moved to the $footnotes array and the old  | 
            ||
| 398 | * content is restored from $store again  | 
            ||
| 399 | *  | 
            ||
| 400 | * @author Andreas Gohr  | 
            ||
| 401 | */  | 
            ||
| 402 |     function footnote_close() { | 
            ||
| 427 | |||
| 428 | /**  | 
            ||
| 429 | * Open an unordered list  | 
            ||
| 430 | */  | 
            ||
| 431 |     function listu_open() { | 
            ||
| 434 | |||
| 435 | /**  | 
            ||
| 436 | * Close an unordered list  | 
            ||
| 437 | */  | 
            ||
| 438 |     function listu_close() { | 
            ||
| 441 | |||
| 442 | /**  | 
            ||
| 443 | * Open an ordered list  | 
            ||
| 444 | */  | 
            ||
| 445 |     function listo_open() { | 
            ||
| 448 | |||
| 449 | /**  | 
            ||
| 450 | * Close an ordered list  | 
            ||
| 451 | */  | 
            ||
| 452 |     function listo_close() { | 
            ||
| 455 | |||
| 456 | /**  | 
            ||
| 457 | * Open a list item  | 
            ||
| 458 | *  | 
            ||
| 459 | * @param int $level the nesting level  | 
            ||
| 460 | * @param bool $node true when a node; false when a leaf  | 
            ||
| 461 | */  | 
            ||
| 462 |     function listitem_open($level, $node=false) { | 
            ||
| 466 | |||
| 467 | /**  | 
            ||
| 468 | * Close a list item  | 
            ||
| 469 | */  | 
            ||
| 470 |     function listitem_close() { | 
            ||
| 473 | |||
| 474 | /**  | 
            ||
| 475 | * Start the content of a list item  | 
            ||
| 476 | */  | 
            ||
| 477 |     function listcontent_open() { | 
            ||
| 480 | |||
| 481 | /**  | 
            ||
| 482 | * Stop the content of a list item  | 
            ||
| 483 | */  | 
            ||
| 484 |     function listcontent_close() { | 
            ||
| 487 | |||
| 488 | /**  | 
            ||
| 489 | * Output unformatted $text  | 
            ||
| 490 | *  | 
            ||
| 491 | * Defaults to $this->cdata()  | 
            ||
| 492 | *  | 
            ||
| 493 | * @param string $text  | 
            ||
| 494 | */  | 
            ||
| 495 |     function unformatted($text) { | 
            ||
| 498 | |||
| 499 | /**  | 
            ||
| 500 | * Execute PHP code if allowed  | 
            ||
| 501 | *  | 
            ||
| 502 | * @param string $text PHP code that is either executed or printed  | 
            ||
| 503 | * @param string $wrapper html element to wrap result if $conf['phpok'] is okff  | 
            ||
| 504 | *  | 
            ||
| 505 | * @author Andreas Gohr <[email protected]>  | 
            ||
| 506 | */  | 
            ||
| 507 |     function php($text, $wrapper = 'code') { | 
            ||
| 519 | |||
| 520 | /**  | 
            ||
| 521 | * Output block level PHP code  | 
            ||
| 522 | *  | 
            ||
| 523 | * If $conf['phpok'] is true this should evaluate the given code and append the result  | 
            ||
| 524 | * to $doc  | 
            ||
| 525 | *  | 
            ||
| 526 | * @param string $text The PHP code  | 
            ||
| 527 | */  | 
            ||
| 528 |     function phpblock($text) { | 
            ||
| 531 | |||
| 532 | /**  | 
            ||
| 533 | * Insert HTML if allowed  | 
            ||
| 534 | *  | 
            ||
| 535 | * @param string $text html text  | 
            ||
| 536 | * @param string $wrapper html element to wrap result if $conf['htmlok'] is okff  | 
            ||
| 537 | *  | 
            ||
| 538 | * @author Andreas Gohr <[email protected]>  | 
            ||
| 539 | */  | 
            ||
| 540 |     function html($text, $wrapper = 'code') { | 
            ||
| 549 | |||
| 550 | /**  | 
            ||
| 551 | * Output raw block-level HTML  | 
            ||
| 552 | *  | 
            ||
| 553 | * If $conf['htmlok'] is true this should add the code as is to $doc  | 
            ||
| 554 | *  | 
            ||
| 555 | * @param string $text The HTML  | 
            ||
| 556 | */  | 
            ||
| 557 |     function htmlblock($text) { | 
            ||
| 560 | |||
| 561 | /**  | 
            ||
| 562 | * Start a block quote  | 
            ||
| 563 | */  | 
            ||
| 564 |     function quote_open() { | 
            ||
| 567 | |||
| 568 | /**  | 
            ||
| 569 | * Stop a block quote  | 
            ||
| 570 | */  | 
            ||
| 571 |     function quote_close() { | 
            ||
| 574 | |||
| 575 | /**  | 
            ||
| 576 | * Output preformatted text  | 
            ||
| 577 | *  | 
            ||
| 578 | * @param string $text  | 
            ||
| 579 | */  | 
            ||
| 580 |     function preformatted($text) { | 
            ||
| 583 | |||
| 584 | /**  | 
            ||
| 585 | * Display text as file content, optionally syntax highlighted  | 
            ||
| 586 | *  | 
            ||
| 587 | * @param string $text text to show  | 
            ||
| 588 | * @param string $language programming language to use for syntax highlighting  | 
            ||
| 589 | * @param string $filename file path label  | 
            ||
| 590 | */  | 
            ||
| 591 |     function file($text, $language = null, $filename = null) { | 
            ||
| 594 | |||
| 595 | /**  | 
            ||
| 596 | * Display text as code content, optionally syntax highlighted  | 
            ||
| 597 | *  | 
            ||
| 598 | * @param string $text text to show  | 
            ||
| 599 | * @param string $language programming language to use for syntax highlighting  | 
            ||
| 600 | * @param string $filename file path label  | 
            ||
| 601 | */  | 
            ||
| 602 |     function code($text, $language = null, $filename = null) { | 
            ||
| 605 | |||
| 606 | /**  | 
            ||
| 607 | * Use GeSHi to highlight language syntax in code and file blocks  | 
            ||
| 608 | *  | 
            ||
| 609 | * @author Andreas Gohr <[email protected]>  | 
            ||
| 610 | * @param string $type code|file  | 
            ||
| 611 | * @param string $text text to show  | 
            ||
| 612 | * @param string $language programming language to use for syntax highlighting  | 
            ||
| 613 | * @param string $filename file path label  | 
            ||
| 614 | */  | 
            ||
| 615 |     function _highlight($type, $text, $language = null, $filename = null) { | 
            ||
| 653 | |||
| 654 | /**  | 
            ||
| 655 | * Format an acronym  | 
            ||
| 656 | *  | 
            ||
| 657 | * Uses $this->acronyms  | 
            ||
| 658 | *  | 
            ||
| 659 | * @param string $acronym  | 
            ||
| 660 | */  | 
            ||
| 661 |     function acronym($acronym) { | 
            ||
| 674 | |||
| 675 | /**  | 
            ||
| 676 | * Format a smiley  | 
            ||
| 677 | *  | 
            ||
| 678 | * Uses $this->smiley  | 
            ||
| 679 | *  | 
            ||
| 680 | * @param string $smiley  | 
            ||
| 681 | */  | 
            ||
| 682 |     function smiley($smiley) { | 
            ||
| 691 | |||
| 692 | /**  | 
            ||
| 693 | * Format an entity  | 
            ||
| 694 | *  | 
            ||
| 695 | * Entities are basically small text replacements  | 
            ||
| 696 | *  | 
            ||
| 697 | * Uses $this->entities  | 
            ||
| 698 | *  | 
            ||
| 699 | * @param string $entity  | 
            ||
| 700 | */  | 
            ||
| 701 |     function entity($entity) { | 
            ||
| 708 | |||
| 709 | /**  | 
            ||
| 710 | * Typographically format a multiply sign  | 
            ||
| 711 | *  | 
            ||
| 712 | * Example: ($x=640, $y=480) should result in "640×480"  | 
            ||
| 713 | *  | 
            ||
| 714 | * @param string|int $x first value  | 
            ||
| 715 | * @param string|int $y second value  | 
            ||
| 716 | */  | 
            ||
| 717 |     function multiplyentity($x, $y) { | 
            ||
| 720 | |||
| 721 | /**  | 
            ||
| 722 | * Render an opening single quote char (language specific)  | 
            ||
| 723 | */  | 
            ||
| 724 |     function singlequoteopening() { | 
            ||
| 728 | |||
| 729 | /**  | 
            ||
| 730 | * Render a closing single quote char (language specific)  | 
            ||
| 731 | */  | 
            ||
| 732 |     function singlequoteclosing() { | 
            ||
| 736 | |||
| 737 | /**  | 
            ||
| 738 | * Render an apostrophe char (language specific)  | 
            ||
| 739 | */  | 
            ||
| 740 |     function apostrophe() { | 
            ||
| 744 | |||
| 745 | /**  | 
            ||
| 746 | * Render an opening double quote char (language specific)  | 
            ||
| 747 | */  | 
            ||
| 748 |     function doublequoteopening() { | 
            ||
| 752 | |||
| 753 | /**  | 
            ||
| 754 | * Render an closinging double quote char (language specific)  | 
            ||
| 755 | */  | 
            ||
| 756 |     function doublequoteclosing() { | 
            ||
| 760 | |||
| 761 | /**  | 
            ||
| 762 | * Render a CamelCase link  | 
            ||
| 763 | *  | 
            ||
| 764 | * @param string $link The link name  | 
            ||
| 765 | * @param bool $returnonly whether to return html or write to doc attribute  | 
            ||
| 766 | * @see http://en.wikipedia.org/wiki/CamelCase  | 
            ||
| 767 | */  | 
            ||
| 768 |     function camelcaselink($link, $returnonly = false) { | 
            ||
| 775 | |||
| 776 | /**  | 
            ||
| 777 | * Render a page local link  | 
            ||
| 778 | *  | 
            ||
| 779 | * @param string $hash hash link identifier  | 
            ||
| 780 | * @param string $name name for the link  | 
            ||
| 781 | * @param bool $returnonly whether to return html or write to doc attribute  | 
            ||
| 782 | */  | 
            ||
| 783 |     function locallink($hash, $name = null, $returnonly = false) { | 
            ||
| 799 | |||
| 800 | /**  | 
            ||
| 801 | * Render an internal Wiki Link  | 
            ||
| 802 | *  | 
            ||
| 803 | * $search,$returnonly & $linktype are not for the renderer but are used  | 
            ||
| 804 | * elsewhere - no need to implement them in other renderers  | 
            ||
| 805 | *  | 
            ||
| 806 | * @author Andreas Gohr <[email protected]>  | 
            ||
| 807 | * @param string $id pageid  | 
            ||
| 808 | * @param string|null $name link name  | 
            ||
| 809 | * @param string|null $search adds search url param  | 
            ||
| 810 | * @param bool $returnonly whether to return html or write to doc attribute  | 
            ||
| 811 | * @param string $linktype type to set use of headings  | 
            ||
| 812 | * @return void|string writes to doc attribute or returns html depends on $returnonly  | 
            ||
| 813 | */  | 
            ||
| 814 |     function internallink($id, $name = null, $search = null, $returnonly = false, $linktype = 'content') { | 
            ||
| 896 | |||
| 897 | /**  | 
            ||
| 898 | * Render an external link  | 
            ||
| 899 | *  | 
            ||
| 900 | * @param string $url full URL with scheme  | 
            ||
| 901 | * @param string|array $name name for the link, array for media file  | 
            ||
| 902 | * @param bool $returnonly whether to return html or write to doc attribute  | 
            ||
| 903 | */  | 
            ||
| 904 |     function externallink($url, $name = null, $returnonly = false) { | 
            ||
| 953 | |||
| 954 | /**  | 
            ||
| 955 | * Render an interwiki link  | 
            ||
| 956 | *  | 
            ||
| 957 | * You may want to use $this->_resolveInterWiki() here  | 
            ||
| 958 | *  | 
            ||
| 959 | * @param string $match original link - probably not much use  | 
            ||
| 960 | * @param string|array $name name for the link, array for media file  | 
            ||
| 961 | * @param string $wikiName indentifier (shortcut) for the remote wiki  | 
            ||
| 962 | * @param string $wikiUri the fragment parsed from the original link  | 
            ||
| 963 | * @param bool $returnonly whether to return html or write to doc attribute  | 
            ||
| 964 | */  | 
            ||
| 965 |     function interwikilink($match, $name = null, $wikiName, $wikiUri, $returnonly = false) { | 
            ||
| 1009 | |||
| 1010 | /**  | 
            ||
| 1011 | * Link to windows share  | 
            ||
| 1012 | *  | 
            ||
| 1013 | * @param string $url the link  | 
            ||
| 1014 | * @param string|array $name name for the link, array for media file  | 
            ||
| 1015 | * @param bool $returnonly whether to return html or write to doc attribute  | 
            ||
| 1016 | */  | 
            ||
| 1017 |     function windowssharelink($url, $name = null, $returnonly = false) { | 
            ||
| 1046 | |||
| 1047 | /**  | 
            ||
| 1048 | * Render a linked E-Mail Address  | 
            ||
| 1049 | *  | 
            ||
| 1050 | * Honors $conf['mailguard'] setting  | 
            ||
| 1051 | *  | 
            ||
| 1052 | * @param string $address Email-Address  | 
            ||
| 1053 | * @param string|array $name name for the link, array for media file  | 
            ||
| 1054 | * @param bool $returnonly whether to return html or write to doc attribute  | 
            ||
| 1055 | */  | 
            ||
| 1056 |     function emaillink($address, $name = null, $returnonly = false) { | 
            ||
| 1094 | |||
| 1095 | /**  | 
            ||
| 1096 | * Render an internal media file  | 
            ||
| 1097 | *  | 
            ||
| 1098 | * @param string $src media ID  | 
            ||
| 1099 | * @param string $title descriptive text  | 
            ||
| 1100 | * @param string $align left|center|right  | 
            ||
| 1101 | * @param int $width width of media in pixel  | 
            ||
| 1102 | * @param int $height height of media in pixel  | 
            ||
| 1103 | * @param string $cache cache|recache|nocache  | 
            ||
| 1104 | * @param string $linking linkonly|detail|nolink  | 
            ||
| 1105 | * @param bool $return return HTML instead of adding to $doc  | 
            ||
| 1106 | * @return void|string  | 
            ||
| 1107 | */  | 
            ||
| 1108 | function internalmedia($src, $title = null, $align = null, $width = null,  | 
            ||
| 1148 | |||
| 1149 | /**  | 
            ||
| 1150 | * Render an external media file  | 
            ||
| 1151 | *  | 
            ||
| 1152 | * @param string $src full media URL  | 
            ||
| 1153 | * @param string $title descriptive text  | 
            ||
| 1154 | * @param string $align left|center|right  | 
            ||
| 1155 | * @param int $width width of media in pixel  | 
            ||
| 1156 | * @param int $height height of media in pixel  | 
            ||
| 1157 | * @param string $cache cache|recache|nocache  | 
            ||
| 1158 | * @param string $linking linkonly|detail|nolink  | 
            ||
| 1159 | * @param bool $return return HTML instead of adding to $doc  | 
            ||
| 1160 | */  | 
            ||
| 1161 | function externalmedia($src, $title = null, $align = null, $width = null,  | 
            ||
| 1194 | |||
| 1195 | /**  | 
            ||
| 1196 | * Renders an RSS feed  | 
            ||
| 1197 | *  | 
            ||
| 1198 | * @author Andreas Gohr <[email protected]>  | 
            ||
| 1199 | */  | 
            ||
| 1200 |     function rss($url, $params) { | 
            ||
| 1283 | |||
| 1284 | /**  | 
            ||
| 1285 | * Start a table  | 
            ||
| 1286 | *  | 
            ||
| 1287 | * @param int $maxcols maximum number of columns  | 
            ||
| 1288 | * @param int $numrows NOT IMPLEMENTED  | 
            ||
| 1289 | * @param int $pos byte position in the original source  | 
            ||
| 1290 | */  | 
            ||
| 1291 |     function table_open($maxcols = null, $numrows = null, $pos = null) { | 
            ||
| 1301 | |||
| 1302 | /**  | 
            ||
| 1303 | * Close a table  | 
            ||
| 1304 | *  | 
            ||
| 1305 | * @param int $pos byte position in the original source  | 
            ||
| 1306 | */  | 
            ||
| 1307 |     function table_close($pos = null) { | 
            ||
| 1313 | |||
| 1314 | /**  | 
            ||
| 1315 | * Open a table header  | 
            ||
| 1316 | */  | 
            ||
| 1317 |     function tablethead_open() { | 
            ||
| 1320 | |||
| 1321 | /**  | 
            ||
| 1322 | * Close a table header  | 
            ||
| 1323 | */  | 
            ||
| 1324 |     function tablethead_close() { | 
            ||
| 1327 | |||
| 1328 | /**  | 
            ||
| 1329 | * Open a table body  | 
            ||
| 1330 | */  | 
            ||
| 1331 |     function tabletbody_open() { | 
            ||
| 1334 | |||
| 1335 | /**  | 
            ||
| 1336 | * Close a table body  | 
            ||
| 1337 | */  | 
            ||
| 1338 |     function tabletbody_close() { | 
            ||
| 1341 | |||
| 1342 | /**  | 
            ||
| 1343 | * Open a table row  | 
            ||
| 1344 | */  | 
            ||
| 1345 |     function tablerow_open() { | 
            ||
| 1351 | |||
| 1352 | /**  | 
            ||
| 1353 | * Close a table row  | 
            ||
| 1354 | */  | 
            ||
| 1355 |     function tablerow_close() { | 
            ||
| 1358 | |||
| 1359 | /**  | 
            ||
| 1360 | * Open a table header cell  | 
            ||
| 1361 | *  | 
            ||
| 1362 | * @param int $colspan  | 
            ||
| 1363 | * @param string $align left|center|right  | 
            ||
| 1364 | * @param int $rowspan  | 
            ||
| 1365 | */  | 
            ||
| 1366 |     function tableheader_open($colspan = 1, $align = null, $rowspan = 1) { | 
            ||
| 1382 | |||
| 1383 | /**  | 
            ||
| 1384 | * Close a table header cell  | 
            ||
| 1385 | */  | 
            ||
| 1386 |     function tableheader_close() { | 
            ||
| 1389 | |||
| 1390 | /**  | 
            ||
| 1391 | * Open a table cell  | 
            ||
| 1392 | *  | 
            ||
| 1393 | * @param int $colspan  | 
            ||
| 1394 | * @param string $align left|center|right  | 
            ||
| 1395 | * @param int $rowspan  | 
            ||
| 1396 | */  | 
            ||
| 1397 |     function tablecell_open($colspan = 1, $align = null, $rowspan = 1) { | 
            ||
| 1413 | |||
| 1414 | /**  | 
            ||
| 1415 | * Close a table cell  | 
            ||
| 1416 | */  | 
            ||
| 1417 |     function tablecell_close() { | 
            ||
| 1420 | |||
| 1421 | #region Utility functions  | 
            ||
| 1422 | |||
| 1423 | /**  | 
            ||
| 1424 | * Build a link  | 
            ||
| 1425 | *  | 
            ||
| 1426 | * Assembles all parts defined in $link returns HTML for the link  | 
            ||
| 1427 | *  | 
            ||
| 1428 | * @author Andreas Gohr <[email protected]>  | 
            ||
| 1429 | */  | 
            ||
| 1430 |     function _formatLink($link) { | 
            ||
| 1459 | |||
| 1460 | /**  | 
            ||
| 1461 | * Renders internal and external media  | 
            ||
| 1462 | *  | 
            ||
| 1463 | * @author Andreas Gohr <[email protected]>  | 
            ||
| 1464 | * @param string $src media ID  | 
            ||
| 1465 | * @param string $title descriptive text  | 
            ||
| 1466 | * @param string $align left|center|right  | 
            ||
| 1467 | * @param int $width width of media in pixel  | 
            ||
| 1468 | * @param int $height height of media in pixel  | 
            ||
| 1469 | * @param string $cache cache|recache|nocache  | 
            ||
| 1470 | * @param bool $render should the media be embedded inline or just linked  | 
            ||
| 1471 | * @return string  | 
            ||
| 1472 | */  | 
            ||
| 1473 | function _media($src, $title = null, $align = null, $width = null,  | 
            ||
| 1576 | |||
| 1577 | /**  | 
            ||
| 1578 | * Escape string for output  | 
            ||
| 1579 | *  | 
            ||
| 1580 | * @param $string  | 
            ||
| 1581 | * @return string  | 
            ||
| 1582 | */  | 
            ||
| 1583 |     function _xmlEntities($string) { | 
            ||
| 1586 | |||
| 1587 | /**  | 
            ||
| 1588 | * Creates a linkid from a headline  | 
            ||
| 1589 | *  | 
            ||
| 1590 | * @author Andreas Gohr <[email protected]>  | 
            ||
| 1591 | * @param string $title The headline title  | 
            ||
| 1592 | * @param boolean $create Create a new unique ID?  | 
            ||
| 1593 | * @return string  | 
            ||
| 1594 | */  | 
            ||
| 1595 |     function _headerToLink($title, $create = false) { | 
            ||
| 1603 | |||
| 1604 | /**  | 
            ||
| 1605 | * Construct a title and handle images in titles  | 
            ||
| 1606 | *  | 
            ||
| 1607 | * @author Harry Fuecks <[email protected]>  | 
            ||
| 1608 | * @param string|array $title either string title or media array  | 
            ||
| 1609 | * @param string $default default title if nothing else is found  | 
            ||
| 1610 | * @param bool $isImage will be set to true if it's a media file  | 
            ||
| 1611 | * @param null|string $id linked page id (used to extract title from first heading)  | 
            ||
| 1612 | * @param string $linktype content|navigation  | 
            ||
| 1613 | * @return string HTML of the title, might be full image tag or just escaped text  | 
            ||
| 1614 | */  | 
            ||
| 1615 |     function _getLinkTitle($title, $default, &$isImage, $id = null, $linktype = 'content') { | 
            ||
| 1632 | |||
| 1633 | /**  | 
            ||
| 1634 | * Returns HTML code for images used in link titles  | 
            ||
| 1635 | *  | 
            ||
| 1636 | * @author Andreas Gohr <[email protected]>  | 
            ||
| 1637 | * @param array $img  | 
            ||
| 1638 | * @return string HTML img tag or similar  | 
            ||
| 1639 | */  | 
            ||
| 1640 |     function _imageTitle($img) { | 
            ||
| 1659 | |||
| 1660 | /**  | 
            ||
| 1661 | * helperfunction to return a basic link to a media  | 
            ||
| 1662 | *  | 
            ||
| 1663 | * used in internalmedia() and externalmedia()  | 
            ||
| 1664 | *  | 
            ||
| 1665 | * @author Pierre Spring <[email protected]>  | 
            ||
| 1666 | * @param string $src media ID  | 
            ||
| 1667 | * @param string $title descriptive text  | 
            ||
| 1668 | * @param string $align left|center|right  | 
            ||
| 1669 | * @param int $width width of media in pixel  | 
            ||
| 1670 | * @param int $height height of media in pixel  | 
            ||
| 1671 | * @param string $cache cache|recache|nocache  | 
            ||
| 1672 | * @param bool $render should the media be embedded inline or just linked  | 
            ||
| 1673 | * @return array associative array with link config  | 
            ||
| 1674 | */  | 
            ||
| 1675 |     function _getMediaLinkConf($src, $title, $align, $width, $height, $cache, $render) { | 
            ||
| 1690 | |||
| 1691 | /**  | 
            ||
| 1692 | * Embed video(s) in HTML  | 
            ||
| 1693 | *  | 
            ||
| 1694 | * @author Anika Henke <[email protected]>  | 
            ||
| 1695 | *  | 
            ||
| 1696 | * @param string $src - ID of video to embed  | 
            ||
| 1697 | * @param int $width - width of the video in pixels  | 
            ||
| 1698 | * @param int $height - height of the video in pixels  | 
            ||
| 1699 | * @param array $atts - additional attributes for the <video> tag  | 
            ||
| 1700 | * @return string  | 
            ||
| 1701 | */  | 
            ||
| 1702 |     function _video($src, $width, $height, $atts = null) { | 
            ||
| 1756 | |||
| 1757 | /**  | 
            ||
| 1758 | * Embed audio in HTML  | 
            ||
| 1759 | *  | 
            ||
| 1760 | * @author Anika Henke <[email protected]>  | 
            ||
| 1761 | *  | 
            ||
| 1762 | * @param string $src - ID of audio to embed  | 
            ||
| 1763 | * @param array $atts - additional attributes for the <audio> tag  | 
            ||
| 1764 | * @return string  | 
            ||
| 1765 | */  | 
            ||
| 1766 |     function _audio($src, $atts = array()) { | 
            ||
| 1806 | |||
| 1807 | /**  | 
            ||
| 1808 | * _getLastMediaRevisionAt is a helperfunction to internalmedia() and _media()  | 
            ||
| 1809 | * which returns an existing media revision less or equal to rev or date_at  | 
            ||
| 1810 | *  | 
            ||
| 1811 | * @author lisps  | 
            ||
| 1812 | * @param string $media_id  | 
            ||
| 1813 | * @access protected  | 
            ||
| 1814 |      * @return string revision ('' for current) | 
            ||
| 1815 | */  | 
            ||
| 1816 |     function _getLastMediaRevisionAt($media_id){ | 
            ||
| 1821 | |||
| 1822 | #endregion  | 
            ||
| 1823 | }  | 
            ||
| 1824 | |||
| 1826 | 
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.