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 int $start The byte position for the edit start |
||
63 | * @param array $data Associative array with section data: |
||
64 | * Key 'name': the section name/title |
||
65 | * Key 'target': the target for the section edit, |
||
66 | * e.g. 'section' or 'table' |
||
67 | * Key 'hid': header id |
||
68 | * Key 'codeblockOffset': actual code block index |
||
69 | * Key 'start': set in startSectionEdit(), |
||
70 | * do not set yourself |
||
71 | * Key 'range': calculated from 'start' and |
||
72 | * $key in finishSectionEdit(), |
||
73 | * do not set yourself |
||
74 | * @return string A marker class for the starting HTML element |
||
75 | * |
||
76 | * @author Adrian Lang <[email protected]> |
||
77 | */ |
||
78 | public function startSectionEdit($start, $data) { |
||
99 | |||
100 | /** |
||
101 | * Finish an edit section range |
||
102 | * |
||
103 | * @param int $end The byte position for the edit end; null for the rest of the page |
||
104 | * |
||
105 | * @author Adrian Lang <[email protected]> |
||
106 | */ |
||
107 | public function finishSectionEdit($end = null, $hid = null) { |
||
119 | |||
120 | /** |
||
121 | * Returns the format produced by this renderer. |
||
122 | * |
||
123 | * @return string always 'xhtml' |
||
124 | */ |
||
125 | function getFormat() { |
||
128 | |||
129 | /** |
||
130 | * Initialize the document |
||
131 | */ |
||
132 | function document_start() { |
||
137 | |||
138 | /** |
||
139 | * Finalize the document |
||
140 | */ |
||
141 | function document_end() { |
||
194 | |||
195 | /** |
||
196 | * Add an item to the TOC |
||
197 | * |
||
198 | * @param string $id the hash link |
||
199 | * @param string $text the text to display |
||
200 | * @param int $level the nesting level |
||
201 | */ |
||
202 | function toc_additem($id, $text, $level) { |
||
210 | |||
211 | /** |
||
212 | * Render a heading |
||
213 | * |
||
214 | * @param string $text the text to display |
||
215 | * @param int $level header level |
||
216 | * @param int $pos byte position in the original source |
||
217 | */ |
||
218 | function header($text, $level, $pos) { |
||
258 | |||
259 | /** |
||
260 | * Open a new section |
||
261 | * |
||
262 | * @param int $level section level (as determined by the previous header) |
||
263 | */ |
||
264 | function section_open($level) { |
||
267 | |||
268 | /** |
||
269 | * Close the current section |
||
270 | */ |
||
271 | function section_close() { |
||
274 | |||
275 | /** |
||
276 | * Render plain text data |
||
277 | * |
||
278 | * @param $text |
||
279 | */ |
||
280 | function cdata($text) { |
||
283 | |||
284 | /** |
||
285 | * Open a paragraph |
||
286 | */ |
||
287 | function p_open() { |
||
290 | |||
291 | /** |
||
292 | * Close a paragraph |
||
293 | */ |
||
294 | function p_close() { |
||
297 | |||
298 | /** |
||
299 | * Create a line break |
||
300 | */ |
||
301 | function linebreak() { |
||
304 | |||
305 | /** |
||
306 | * Create a horizontal line |
||
307 | */ |
||
308 | function hr() { |
||
311 | |||
312 | /** |
||
313 | * Start strong (bold) formatting |
||
314 | */ |
||
315 | function strong_open() { |
||
318 | |||
319 | /** |
||
320 | * Stop strong (bold) formatting |
||
321 | */ |
||
322 | function strong_close() { |
||
325 | |||
326 | /** |
||
327 | * Start emphasis (italics) formatting |
||
328 | */ |
||
329 | function emphasis_open() { |
||
332 | |||
333 | /** |
||
334 | * Stop emphasis (italics) formatting |
||
335 | */ |
||
336 | function emphasis_close() { |
||
339 | |||
340 | /** |
||
341 | * Start underline formatting |
||
342 | */ |
||
343 | function underline_open() { |
||
346 | |||
347 | /** |
||
348 | * Stop underline formatting |
||
349 | */ |
||
350 | function underline_close() { |
||
353 | |||
354 | /** |
||
355 | * Start monospace formatting |
||
356 | */ |
||
357 | function monospace_open() { |
||
360 | |||
361 | /** |
||
362 | * Stop monospace formatting |
||
363 | */ |
||
364 | function monospace_close() { |
||
367 | |||
368 | /** |
||
369 | * Start a subscript |
||
370 | */ |
||
371 | function subscript_open() { |
||
374 | |||
375 | /** |
||
376 | * Stop a subscript |
||
377 | */ |
||
378 | function subscript_close() { |
||
381 | |||
382 | /** |
||
383 | * Start a superscript |
||
384 | */ |
||
385 | function superscript_open() { |
||
388 | |||
389 | /** |
||
390 | * Stop a superscript |
||
391 | */ |
||
392 | function superscript_close() { |
||
395 | |||
396 | /** |
||
397 | * Start deleted (strike-through) formatting |
||
398 | */ |
||
399 | function deleted_open() { |
||
402 | |||
403 | /** |
||
404 | * Stop deleted (strike-through) formatting |
||
405 | */ |
||
406 | function deleted_close() { |
||
409 | |||
410 | /** |
||
411 | * Callback for footnote start syntax |
||
412 | * |
||
413 | * All following content will go to the footnote instead of |
||
414 | * the document. To achieve this the previous rendered content |
||
415 | * is moved to $store and $doc is cleared |
||
416 | * |
||
417 | * @author Andreas Gohr <[email protected]> |
||
418 | */ |
||
419 | function footnote_open() { |
||
425 | |||
426 | /** |
||
427 | * Callback for footnote end syntax |
||
428 | * |
||
429 | * All rendered content is moved to the $footnotes array and the old |
||
430 | * content is restored from $store again |
||
431 | * |
||
432 | * @author Andreas Gohr |
||
433 | */ |
||
434 | function footnote_close() { |
||
459 | |||
460 | /** |
||
461 | * Open an unordered list |
||
462 | * |
||
463 | * @param string|string[] $classes css classes - have to be valid, do not pass unfiltered user input |
||
464 | */ |
||
465 | function listu_open($classes = null) { |
||
473 | |||
474 | /** |
||
475 | * Close an unordered list |
||
476 | */ |
||
477 | function listu_close() { |
||
480 | |||
481 | /** |
||
482 | * Open an ordered list |
||
483 | * |
||
484 | * @param string|string[] $classes css classes - have to be valid, do not pass unfiltered user input |
||
485 | */ |
||
486 | function listo_open($classes = null) { |
||
494 | |||
495 | /** |
||
496 | * Close an ordered list |
||
497 | */ |
||
498 | function listo_close() { |
||
501 | |||
502 | /** |
||
503 | * Open a list item |
||
504 | * |
||
505 | * @param int $level the nesting level |
||
506 | * @param bool $node true when a node; false when a leaf |
||
507 | */ |
||
508 | function listitem_open($level, $node=false) { |
||
512 | |||
513 | /** |
||
514 | * Close a list item |
||
515 | */ |
||
516 | function listitem_close() { |
||
519 | |||
520 | /** |
||
521 | * Start the content of a list item |
||
522 | */ |
||
523 | function listcontent_open() { |
||
526 | |||
527 | /** |
||
528 | * Stop the content of a list item |
||
529 | */ |
||
530 | function listcontent_close() { |
||
533 | |||
534 | /** |
||
535 | * Output unformatted $text |
||
536 | * |
||
537 | * Defaults to $this->cdata() |
||
538 | * |
||
539 | * @param string $text |
||
540 | */ |
||
541 | function unformatted($text) { |
||
544 | |||
545 | /** |
||
546 | * Execute PHP code if allowed |
||
547 | * |
||
548 | * @param string $text PHP code that is either executed or printed |
||
549 | * @param string $wrapper html element to wrap result if $conf['phpok'] is okff |
||
550 | * |
||
551 | * @author Andreas Gohr <[email protected]> |
||
552 | */ |
||
553 | function php($text, $wrapper = 'code') { |
||
565 | |||
566 | /** |
||
567 | * Output block level PHP code |
||
568 | * |
||
569 | * If $conf['phpok'] is true this should evaluate the given code and append the result |
||
570 | * to $doc |
||
571 | * |
||
572 | * @param string $text The PHP code |
||
573 | */ |
||
574 | function phpblock($text) { |
||
577 | |||
578 | /** |
||
579 | * Insert HTML if allowed |
||
580 | * |
||
581 | * @param string $text html text |
||
582 | * @param string $wrapper html element to wrap result if $conf['htmlok'] is okff |
||
583 | * |
||
584 | * @author Andreas Gohr <[email protected]> |
||
585 | */ |
||
586 | function html($text, $wrapper = 'code') { |
||
595 | |||
596 | /** |
||
597 | * Output raw block-level HTML |
||
598 | * |
||
599 | * If $conf['htmlok'] is true this should add the code as is to $doc |
||
600 | * |
||
601 | * @param string $text The HTML |
||
602 | */ |
||
603 | function htmlblock($text) { |
||
606 | |||
607 | /** |
||
608 | * Start a block quote |
||
609 | */ |
||
610 | function quote_open() { |
||
613 | |||
614 | /** |
||
615 | * Stop a block quote |
||
616 | */ |
||
617 | function quote_close() { |
||
620 | |||
621 | /** |
||
622 | * Output preformatted text |
||
623 | * |
||
624 | * @param string $text |
||
625 | */ |
||
626 | function preformatted($text) { |
||
629 | |||
630 | /** |
||
631 | * Display text as file content, optionally syntax highlighted |
||
632 | * |
||
633 | * @param string $text text to show |
||
634 | * @param string $language programming language to use for syntax highlighting |
||
635 | * @param string $filename file path label |
||
636 | * @param array $options assoziative array with additional geshi options |
||
637 | */ |
||
638 | function file($text, $language = null, $filename = null, $options=null) { |
||
641 | |||
642 | /** |
||
643 | * Display text as code content, optionally syntax highlighted |
||
644 | * |
||
645 | * @param string $text text to show |
||
646 | * @param string $language programming language to use for syntax highlighting |
||
647 | * @param string $filename file path label |
||
648 | * @param array $options assoziative array with additional geshi options |
||
649 | */ |
||
650 | function code($text, $language = null, $filename = null, $options=null) { |
||
653 | |||
654 | /** |
||
655 | * Use GeSHi to highlight language syntax in code and file blocks |
||
656 | * |
||
657 | * @author Andreas Gohr <[email protected]> |
||
658 | * @param string $type code|file |
||
659 | * @param string $text text to show |
||
660 | * @param string $language programming language to use for syntax highlighting |
||
661 | * @param string $filename file path label |
||
662 | * @param array $options assoziative array with additional geshi options |
||
663 | */ |
||
664 | function _highlight($type, $text, $language = null, $filename = null, $options = null) { |
||
709 | |||
710 | /** |
||
711 | * Format an acronym |
||
712 | * |
||
713 | * Uses $this->acronyms |
||
714 | * |
||
715 | * @param string $acronym |
||
716 | */ |
||
717 | function acronym($acronym) { |
||
730 | |||
731 | /** |
||
732 | * Format a smiley |
||
733 | * |
||
734 | * Uses $this->smiley |
||
735 | * |
||
736 | * @param string $smiley |
||
737 | */ |
||
738 | function smiley($smiley) { |
||
747 | |||
748 | /** |
||
749 | * Format an entity |
||
750 | * |
||
751 | * Entities are basically small text replacements |
||
752 | * |
||
753 | * Uses $this->entities |
||
754 | * |
||
755 | * @param string $entity |
||
756 | */ |
||
757 | function entity($entity) { |
||
764 | |||
765 | /** |
||
766 | * Typographically format a multiply sign |
||
767 | * |
||
768 | * Example: ($x=640, $y=480) should result in "640×480" |
||
769 | * |
||
770 | * @param string|int $x first value |
||
771 | * @param string|int $y second value |
||
772 | */ |
||
773 | function multiplyentity($x, $y) { |
||
776 | |||
777 | /** |
||
778 | * Render an opening single quote char (language specific) |
||
779 | */ |
||
780 | function singlequoteopening() { |
||
784 | |||
785 | /** |
||
786 | * Render a closing single quote char (language specific) |
||
787 | */ |
||
788 | function singlequoteclosing() { |
||
792 | |||
793 | /** |
||
794 | * Render an apostrophe char (language specific) |
||
795 | */ |
||
796 | function apostrophe() { |
||
800 | |||
801 | /** |
||
802 | * Render an opening double quote char (language specific) |
||
803 | */ |
||
804 | function doublequoteopening() { |
||
808 | |||
809 | /** |
||
810 | * Render an closinging double quote char (language specific) |
||
811 | */ |
||
812 | function doublequoteclosing() { |
||
816 | |||
817 | /** |
||
818 | * Render a CamelCase link |
||
819 | * |
||
820 | * @param string $link The link name |
||
821 | * @param bool $returnonly whether to return html or write to doc attribute |
||
822 | * @return void|string writes to doc attribute or returns html depends on $returnonly |
||
823 | * |
||
824 | * @see http://en.wikipedia.org/wiki/CamelCase |
||
825 | */ |
||
826 | function camelcaselink($link, $returnonly = false) { |
||
833 | |||
834 | /** |
||
835 | * Render a page local link |
||
836 | * |
||
837 | * @param string $hash hash link identifier |
||
838 | * @param string $name name for the link |
||
839 | * @param bool $returnonly whether to return html or write to doc attribute |
||
840 | * @return void|string writes to doc attribute or returns html depends on $returnonly |
||
841 | */ |
||
842 | function locallink($hash, $name = null, $returnonly = false) { |
||
858 | |||
859 | /** |
||
860 | * Render an internal Wiki Link |
||
861 | * |
||
862 | * $search,$returnonly & $linktype are not for the renderer but are used |
||
863 | * elsewhere - no need to implement them in other renderers |
||
864 | * |
||
865 | * @author Andreas Gohr <[email protected]> |
||
866 | * @param string $id pageid |
||
867 | * @param string|null $name link name |
||
868 | * @param string|null $search adds search url param |
||
869 | * @param bool $returnonly whether to return html or write to doc attribute |
||
870 | * @param string $linktype type to set use of headings |
||
871 | * @return void|string writes to doc attribute or returns html depends on $returnonly |
||
872 | */ |
||
873 | function internallink($id, $name = null, $search = null, $returnonly = false, $linktype = 'content') { |
||
960 | |||
961 | /** |
||
962 | * Render an external link |
||
963 | * |
||
964 | * @param string $url full URL with scheme |
||
965 | * @param string|array $name name for the link, array for media file |
||
966 | * @param bool $returnonly whether to return html or write to doc attribute |
||
967 | * @return void|string writes to doc attribute or returns html depends on $returnonly |
||
968 | */ |
||
969 | function externallink($url, $name = null, $returnonly = false) { |
||
1020 | |||
1021 | /** |
||
1022 | * Render an interwiki link |
||
1023 | * |
||
1024 | * You may want to use $this->_resolveInterWiki() here |
||
1025 | * |
||
1026 | * @param string $match original link - probably not much use |
||
1027 | * @param string|array $name name for the link, array for media file |
||
1028 | * @param string $wikiName indentifier (shortcut) for the remote wiki |
||
1029 | * @param string $wikiUri the fragment parsed from the original link |
||
1030 | * @param bool $returnonly whether to return html or write to doc attribute |
||
1031 | * @return void|string writes to doc attribute or returns html depends on $returnonly |
||
1032 | */ |
||
1033 | function interwikilink($match, $name = null, $wikiName, $wikiUri, $returnonly = false) { |
||
1079 | |||
1080 | /** |
||
1081 | * Link to windows share |
||
1082 | * |
||
1083 | * @param string $url the link |
||
1084 | * @param string|array $name name for the link, array for media file |
||
1085 | * @param bool $returnonly whether to return html or write to doc attribute |
||
1086 | * @return void|string writes to doc attribute or returns html depends on $returnonly |
||
1087 | */ |
||
1088 | function windowssharelink($url, $name = null, $returnonly = false) { |
||
1117 | |||
1118 | /** |
||
1119 | * Render a linked E-Mail Address |
||
1120 | * |
||
1121 | * Honors $conf['mailguard'] setting |
||
1122 | * |
||
1123 | * @param string $address Email-Address |
||
1124 | * @param string|array $name name for the link, array for media file |
||
1125 | * @param bool $returnonly whether to return html or write to doc attribute |
||
1126 | * @return void|string writes to doc attribute or returns html depends on $returnonly |
||
1127 | */ |
||
1128 | function emaillink($address, $name = null, $returnonly = false) { |
||
1166 | |||
1167 | /** |
||
1168 | * Render an internal media file |
||
1169 | * |
||
1170 | * @param string $src media ID |
||
1171 | * @param string $title descriptive text |
||
1172 | * @param string $align left|center|right |
||
1173 | * @param int $width width of media in pixel |
||
1174 | * @param int $height height of media in pixel |
||
1175 | * @param string $cache cache|recache|nocache |
||
1176 | * @param string $linking linkonly|detail|nolink |
||
1177 | * @param bool $return return HTML instead of adding to $doc |
||
1178 | * @return void|string writes to doc attribute or returns html depends on $return |
||
1179 | */ |
||
1180 | function internalmedia($src, $title = null, $align = null, $width = null, |
||
1222 | |||
1223 | /** |
||
1224 | * Render an external media file |
||
1225 | * |
||
1226 | * @param string $src full media URL |
||
1227 | * @param string $title descriptive text |
||
1228 | * @param string $align left|center|right |
||
1229 | * @param int $width width of media in pixel |
||
1230 | * @param int $height height of media in pixel |
||
1231 | * @param string $cache cache|recache|nocache |
||
1232 | * @param string $linking linkonly|detail|nolink |
||
1233 | * @param bool $return return HTML instead of adding to $doc |
||
1234 | * @return void|string writes to doc attribute or returns html depends on $return |
||
1235 | */ |
||
1236 | function externalmedia($src, $title = null, $align = null, $width = null, |
||
1274 | |||
1275 | /** |
||
1276 | * Renders an RSS feed |
||
1277 | * |
||
1278 | * @param string $url URL of the feed |
||
1279 | * @param array $params Finetuning of the output |
||
1280 | * |
||
1281 | * @author Andreas Gohr <[email protected]> |
||
1282 | */ |
||
1283 | function rss($url, $params) { |
||
1366 | |||
1367 | /** |
||
1368 | * Start a table |
||
1369 | * |
||
1370 | * @param int $maxcols maximum number of columns |
||
1371 | * @param int $numrows NOT IMPLEMENTED |
||
1372 | * @param int $pos byte position in the original source |
||
1373 | * @param string|string[] $classes css classes - have to be valid, do not pass unfiltered user input |
||
1374 | */ |
||
1375 | function table_open($maxcols = null, $numrows = null, $pos = null, $classes = null) { |
||
1394 | |||
1395 | /** |
||
1396 | * Close a table |
||
1397 | * |
||
1398 | * @param int $pos byte position in the original source |
||
1399 | */ |
||
1400 | function table_close($pos = null) { |
||
1406 | |||
1407 | /** |
||
1408 | * Open a table header |
||
1409 | */ |
||
1410 | function tablethead_open() { |
||
1413 | |||
1414 | /** |
||
1415 | * Close a table header |
||
1416 | */ |
||
1417 | function tablethead_close() { |
||
1420 | |||
1421 | /** |
||
1422 | * Open a table body |
||
1423 | */ |
||
1424 | function tabletbody_open() { |
||
1427 | |||
1428 | /** |
||
1429 | * Close a table body |
||
1430 | */ |
||
1431 | function tabletbody_close() { |
||
1434 | |||
1435 | /** |
||
1436 | * Open a table footer |
||
1437 | */ |
||
1438 | function tabletfoot_open() { |
||
1441 | |||
1442 | /** |
||
1443 | * Close a table footer |
||
1444 | */ |
||
1445 | function tabletfoot_close() { |
||
1448 | |||
1449 | /** |
||
1450 | * Open a table row |
||
1451 | * |
||
1452 | * @param string|string[] $classes css classes - have to be valid, do not pass unfiltered user input |
||
1453 | */ |
||
1454 | function tablerow_open($classes = null) { |
||
1464 | |||
1465 | /** |
||
1466 | * Close a table row |
||
1467 | */ |
||
1468 | function tablerow_close() { |
||
1471 | |||
1472 | /** |
||
1473 | * Open a table header cell |
||
1474 | * |
||
1475 | * @param int $colspan |
||
1476 | * @param string $align left|center|right |
||
1477 | * @param int $rowspan |
||
1478 | * @param string|string[] $classes css classes - have to be valid, do not pass unfiltered user input |
||
1479 | */ |
||
1480 | function tableheader_open($colspan = 1, $align = null, $rowspan = 1, $classes = null) { |
||
1500 | |||
1501 | /** |
||
1502 | * Close a table header cell |
||
1503 | */ |
||
1504 | function tableheader_close() { |
||
1507 | |||
1508 | /** |
||
1509 | * Open a table cell |
||
1510 | * |
||
1511 | * @param int $colspan |
||
1512 | * @param string $align left|center|right |
||
1513 | * @param int $rowspan |
||
1514 | * @param string|string[] $classes css classes - have to be valid, do not pass unfiltered user input |
||
1515 | */ |
||
1516 | function tablecell_open($colspan = 1, $align = null, $rowspan = 1, $classes = null) { |
||
1536 | |||
1537 | /** |
||
1538 | * Close a table cell |
||
1539 | */ |
||
1540 | function tablecell_close() { |
||
1543 | |||
1544 | /** |
||
1545 | * Returns the current header level. |
||
1546 | * (required e.g. by the filelist plugin) |
||
1547 | * |
||
1548 | * @return int The current header level |
||
1549 | */ |
||
1550 | function getLastlevel() { |
||
1553 | |||
1554 | #region Utility functions |
||
1555 | |||
1556 | /** |
||
1557 | * Build a link |
||
1558 | * |
||
1559 | * Assembles all parts defined in $link returns HTML for the link |
||
1560 | * |
||
1561 | * @param array $link attributes of a link |
||
1562 | * @return string |
||
1563 | * |
||
1564 | * @author Andreas Gohr <[email protected]> |
||
1565 | */ |
||
1566 | function _formatLink($link) { |
||
1595 | |||
1596 | /** |
||
1597 | * Renders internal and external media |
||
1598 | * |
||
1599 | * @author Andreas Gohr <[email protected]> |
||
1600 | * @param string $src media ID |
||
1601 | * @param string $title descriptive text |
||
1602 | * @param string $align left|center|right |
||
1603 | * @param int $width width of media in pixel |
||
1604 | * @param int $height height of media in pixel |
||
1605 | * @param string $cache cache|recache|nocache |
||
1606 | * @param bool $render should the media be embedded inline or just linked |
||
1607 | * @return string |
||
1608 | */ |
||
1609 | function _media($src, $title = null, $align = null, $width = null, |
||
1712 | |||
1713 | /** |
||
1714 | * Escape string for output |
||
1715 | * |
||
1716 | * @param $string |
||
1717 | * @return string |
||
1718 | */ |
||
1719 | function _xmlEntities($string) { |
||
1722 | |||
1723 | /** |
||
1724 | * Creates a linkid from a headline |
||
1725 | * |
||
1726 | * @author Andreas Gohr <[email protected]> |
||
1727 | * @param string $title The headline title |
||
1728 | * @param boolean $create Create a new unique ID? |
||
1729 | * @return string |
||
1730 | */ |
||
1731 | function _headerToLink($title, $create = false) { |
||
1739 | |||
1740 | /** |
||
1741 | * Construct a title and handle images in titles |
||
1742 | * |
||
1743 | * @author Harry Fuecks <[email protected]> |
||
1744 | * @param string|array $title either string title or media array |
||
1745 | * @param string $default default title if nothing else is found |
||
1746 | * @param bool $isImage will be set to true if it's a media file |
||
1747 | * @param null|string $id linked page id (used to extract title from first heading) |
||
1748 | * @param string $linktype content|navigation |
||
1749 | * @return string HTML of the title, might be full image tag or just escaped text |
||
1750 | */ |
||
1751 | function _getLinkTitle($title, $default, &$isImage, $id = null, $linktype = 'content') { |
||
1768 | |||
1769 | /** |
||
1770 | * Returns HTML code for images used in link titles |
||
1771 | * |
||
1772 | * @author Andreas Gohr <[email protected]> |
||
1773 | * @param array $img |
||
1774 | * @return string HTML img tag or similar |
||
1775 | */ |
||
1776 | function _imageTitle($img) { |
||
1795 | |||
1796 | /** |
||
1797 | * helperfunction to return a basic link to a media |
||
1798 | * |
||
1799 | * used in internalmedia() and externalmedia() |
||
1800 | * |
||
1801 | * @author Pierre Spring <[email protected]> |
||
1802 | * @param string $src media ID |
||
1803 | * @param string $title descriptive text |
||
1804 | * @param string $align left|center|right |
||
1805 | * @param int $width width of media in pixel |
||
1806 | * @param int $height height of media in pixel |
||
1807 | * @param string $cache cache|recache|nocache |
||
1808 | * @param bool $render should the media be embedded inline or just linked |
||
1809 | * @return array associative array with link config |
||
1810 | */ |
||
1811 | function _getMediaLinkConf($src, $title, $align, $width, $height, $cache, $render) { |
||
1827 | |||
1828 | /** |
||
1829 | * Embed video(s) in HTML |
||
1830 | * |
||
1831 | * @author Anika Henke <[email protected]> |
||
1832 | * @author Schplurtz le Déboulonné <[email protected]> |
||
1833 | * |
||
1834 | * @param string $src - ID of video to embed |
||
1835 | * @param int $width - width of the video in pixels |
||
1836 | * @param int $height - height of the video in pixels |
||
1837 | * @param array $atts - additional attributes for the <video> tag |
||
1838 | * @return string |
||
1839 | */ |
||
1840 | function _video($src, $width, $height, $atts = null) { |
||
1904 | |||
1905 | /** |
||
1906 | * Embed audio in HTML |
||
1907 | * |
||
1908 | * @author Anika Henke <[email protected]> |
||
1909 | * |
||
1910 | * @param string $src - ID of audio to embed |
||
1911 | * @param array $atts - additional attributes for the <audio> tag |
||
1912 | * @return string |
||
1913 | */ |
||
1914 | function _audio($src, $atts = array()) { |
||
1954 | |||
1955 | /** |
||
1956 | * _getLastMediaRevisionAt is a helperfunction to internalmedia() and _media() |
||
1957 | * which returns an existing media revision less or equal to rev or date_at |
||
1958 | * |
||
1959 | * @author lisps |
||
1960 | * @param string $media_id |
||
1961 | * @access protected |
||
1962 | * @return string revision ('' for current) |
||
1963 | */ |
||
1964 | function _getLastMediaRevisionAt($media_id){ |
||
1969 | |||
1970 | #endregion |
||
1971 | } |
||
1972 | |||
1974 |
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.