1<?php
2
3// must be run within Dokuwiki
4if(!defined('DOKU_INC')) die();
5
6/**
7 * Base class for a decorator, containing default behavior for all decorators.
8 * As a convenience it extends the Doku_Renderer.
9 * The base decorator just passes all calls to the next decorator.
10 * Each call returns the decorator to use for next call. This allows decorator
11 * to create additional layers depending on particular conditions.
12 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
13 * @author Jean-Michel Gonet <jmgonet@yahoo.com>
14 */
15class decorator extends Doku_Renderer {
16
17	/**
18	 * The next decorator layer.
19	 * Should be initialized by the class constructor.
20	 */
21	protected $decorator;
22
23	/**
24	 * Class constructor.
25	 * @param decorator The next decorator layer.
26	 */
27	function __construct($decorator) {
28		$this->decorator = $decorator;
29	}
30
31	/**
32	 * Returns the format provided by this renderer.
33	 */
34	function getFormat() {
35		return 'tex';
36	}
37
38	/**
39	 * Returns a TeX compliant version of the page ID.
40	 * @param pageId the page ID, or page name.
41	 * @param ext The extension. Default value is '.tex'.
42	 * @return A TeX compliant version of the page ID, with the specified extension.
43	 */
44	protected function texifyPageId($pageId, $ext = 'tex') {
45		return str_replace(':','-',$pageId).'.'.$ext;
46	}
47
48	/**
49	 * Escapes Tex reserved chars.
50	 * @param text String The text to escape.
51	 * @return String The escaped text.
52	 */
53	function texifyText($text) {
54		$text = str_replace('}', '\\}', $text);
55		$text = str_replace('{', '\\{', $text);
56		$text = str_replace('%', '\\%', $text);
57		$text = str_replace('#', '\\#', $text);
58		$text = str_replace('_', '\\_', $text);
59		$text = str_replace('&', '\\&', $text);
60		$text = str_replace('$', '\\$', $text);
61		$text = str_replace('^', '\\^', $text);
62		return $text;
63	}
64
65	/**
66	 * Returns a TeX compliant version of the specified file name.
67	 * @param filename The filename.
68	 * @return A TeX compliant version, with no spaces, and no dot besides the extension.
69	 */
70	function texifyFilename($filename) {
71		$ext = pathinfo($filename, PATHINFO_EXTENSION);
72		if ($ext) {
73			$filename = substr($filename, 0, -strlen($ext) - 1);
74		}
75		$texifiedFilename = $this->texifyReference($filename);
76		return "$texifiedFilename.$ext";
77	}
78
79	/**
80	 * Returns a TeX compliant version of the specified reference.
81	 * @param filename The reference.
82	 * @return A TeX compliant version, with no spaces, and no weird char.
83	 */
84	function texifyReference($reference) {
85		$patterns[ 0] = '/[áâàåä]/ui';
86		$patterns[ 1] = '/[ðéêèë]/ui';
87		$patterns[ 2] = '/[íîìï]/ui';
88		$patterns[ 3] = '/[óôòøõö]/ui';
89		$patterns[ 4] = '/[úûùü]/ui';
90		$patterns[ 5] = '/æ/ui';
91		$patterns[ 6] = '/ç/ui';
92		$patterns[ 7] = '/ß/ui';
93		$patterns[ 8] = '/\\s/';
94		$patterns[ 9] = '/#/';
95		$patterns[10] = '/[^A-Za-z0-9\\-:]/';
96		$replacements[ 0] = 'a';
97		$replacements[ 1] = 'e';
98		$replacements[ 2] = 'i';
99		$replacements[ 3] = 'o';
100		$replacements[ 4] = 'u';
101		$replacements[ 5] = 'ae';
102		$replacements[ 6] = 'c';
103		$replacements[ 7] = 'ss';
104		$replacements[ 8] = '-';
105		$replacements[ 9] = ':';
106		$replacements[10] = '_';
107
108		return preg_replace($patterns, $replacements, $reference);
109	}
110
111	//////////////////////////////////////////////////////////////////////////////////
112	//////////////////////////////////////////////////////////////////////////////////
113	//                                                                              //
114	//                          Handle latexport syntax.                            //
115	//                                                                              //
116	//////////////////////////////////////////////////////////////////////////////////
117	//////////////////////////////////////////////////////////////////////////////////
118
119	/**
120	 * Receives a local file to include.
121	 * @param $link string Local file to include.
122	 */
123	function input($link) {
124		$this->any_command();
125		$this->decorator->input($link);
126	}
127
128	/**
129	 * To draw an horizontal rule between two rows of a table,
130	 * @param $start int The starting column.
131	 * @param $end int The ending column.
132	 */
133	function table_cline($start, $end) {
134		$this->any_command();
135		$this->decorator->table_cline($start, $end);
136	}
137
138	/**
139	 * Adds a latex command to the document.
140	 * @param command  The command
141	 * @param scope    The name of the scope, or the mandatory argument,
142	 *                 to be included inside the curly brackets.
143	 * @param argument If specified, to be included in square brackets. Depending
144	 *                 on the command, square brackets are placed before or after
145	 *                 the curly brackets.
146	 */
147	function appendCommand($command, $scope, $argument = '') {
148		$this->any_command();
149		$this->decorator->appendCommand($command, $scope, $argument);
150	}
151
152	/**
153	 * Adds a latex command to the document.
154	 * @param command  The command
155	 * @param scope    The name of the scope, or the mandatory argument,
156	 *                 to be included inside the curly brackets.
157	 * @param argument If specified, to be included in square brackets. Depending
158	 *                 on the command, square brackets are placed before or after
159	 *                 the curly brackets.
160	 */
161	function appendInlineCommand($command, $scope, $argument = '') {
162		$this->any_command();
163		$this->decorator->appendInlineCommand($command, $scope, $argument);
164	}
165
166	/**
167	 * Adds simple content to the document.
168	 * @param c The content.
169	 */
170	function appendContent($c) {
171		$this->any_command();
172		$this->decorator->appendContent($c);
173	}
174
175	/**
176	 * Override this if you want to have code for all commands.
177	 */
178	function any_command() {
179		// Do nothing.
180	}
181
182	//////////////////////////////////////////////////////////////////////////////////
183	//////////////////////////////////////////////////////////////////////////////////
184	//                                                                              //
185	//             Handle plugin syntax like mathjax, anchor...                     //
186	//                                                                              //
187	//////////////////////////////////////////////////////////////////////////////////
188	//////////////////////////////////////////////////////////////////////////////////
189
190	/**
191	 * Receives mathematic formula from Mathjax plugin.
192	 */
193	function mathjax_content($formula) {
194		$this->any_command();
195		$this->decorator->mathjax_content($formula);
196	}
197
198	/**
199	 * Receives the anchors from the 'anchor' plugin.
200	 * @param string $link The anchor name.
201	 * @param string $title The associated text.
202	 */
203	function anchor($link, $title = null) {
204		$this->any_command();
205		$this->decorator->anchor($link, $title);
206	}
207
208	//////////////////////////////////////////////////////////////////////////////////
209	//////////////////////////////////////////////////////////////////////////////////
210	//                                                                              //
211	//                      Handle standard dokuwiki syntax                         //
212	//                                                                              //
213	//////////////////////////////////////////////////////////////////////////////////
214	//////////////////////////////////////////////////////////////////////////////////
215
216	/**
217	 * Starts rendering a new page.
218	 * @param string $pageId The identifier of the opening page.
219	 * @param int $recursionLevel The level of recursion. When a page includes a page, that's one level of recursion.
220	 */
221	function document_start($pageId = null, $recursionLevel = 0) {
222		$this->any_command();
223		$this->decorator->document_start($pageId, $recursionLevel);
224	}
225
226	/**
227	 * Closes the document
228	 */
229	function document_end($recursionLevel = 0){
230		$this->any_command();
231		$this->decorator->document_end($recursionLevel);
232	}
233
234    /**
235     * Render the Table of Contents
236     *
237     * @return string
238     */
239    function render_TOC() {
240		$this->any_command();
241		$this->decorator->render_TOC();
242    }
243
244    /**
245     * Add an item to the TOC
246     *
247     * @param string $id       the hash link
248     * @param string $text     the text to display
249     * @param int    $level    the nesting level
250     */
251    function toc_additem($id, $text, $level) {
252		$this->any_command();
253		$this->decorator->toc_additem($id, $text, $level);
254    }
255
256    /**
257     * Render a heading
258     *
259     * @param string $text  the text to display
260     * @param int    $level header level
261     * @param int    $pos   byte position in the original source
262     */
263    function header($text, $level, $pos) {
264		$this->any_command();
265		$this->decorator->header($text, $level, $pos);
266    }
267
268    /**
269     * Open a new section
270     *
271     * @param int $level section level (as determined by the previous header)
272     */
273    function section_open($level) {
274		$this->any_command();
275		$this->decorator->section_open($level);
276    }
277
278    /**
279     * Close the current section
280     */
281    function section_close() {
282		$this->any_command();
283		$this->decorator->section_close($level);
284    }
285
286    /**
287     * Render plain text data
288     *
289     * @param string $text
290     */
291	function cdata($text) {
292		$this->any_command();
293		$this->decorator->cdata($text);
294	}
295
296	/**
297	 * Open a paragraph.
298	 */
299	function p_open() {
300		$this->any_command();
301		$this->decorator->p_open();
302	}
303
304	/**
305	 * Close a paragraph.
306	 */
307	function p_close() {
308		$this->any_command();
309		$this->decorator->p_close();
310	}
311
312  /**
313   * Create a line break
314   */
315  function linebreak() {
316		$this->any_command();
317		$this->decorator->linebreak();
318  }
319
320  /**
321   * Create a horizontal line
322   */
323  function hr() {
324		$this->any_command();
325		$this->decorator->hr();
326  }
327
328	/**
329	 * Start strong (bold) formatting
330	 */
331	function strong_open() {
332		$this->any_command();
333		$this->decorator->strong_open();
334	}
335
336	/**
337	 * Stop strong (bold) formatting
338	 */
339	function strong_close() {
340		$this->any_command();
341		$this->decorator->strong_close();
342	}
343
344	/**
345	 * Start emphasis (italics) formatting
346	 */
347	function emphasis_open() {
348		$this->any_command();
349		$this->decorator->emphasis_open();
350	}
351
352	/**
353	 * Stop emphasis (italics) formatting
354	 */
355	function emphasis_close() {
356		$this->any_command();
357		$this->decorator->emphasis_close();
358	}
359
360	/**
361	 * Start underline formatting
362	 */
363	function underline_open() {
364		$this->any_command();
365		$this->decorator->underline_open();
366	}
367
368	/**
369	 * Stop underline formatting
370	 */
371	function underline_close() {
372		$this->any_command();
373		$this->decorator->underline_close();
374	}
375
376  /**
377   * Start monospace formatting
378   */
379  function monospace_open() {
380		$this->any_command();
381		$this->decorator->monospace_open();
382  }
383
384  /**
385   * Stop monospace formatting
386   */
387  function monospace_close() {
388		$this->any_command();
389		$this->decorator->monospace_close();
390  }
391
392  /**
393   * Start a subscript
394   */
395  function subscript_open() {
396		$this->any_command();
397		$this->decorator->subscript_open();
398  }
399
400  /**
401   * Stop a subscript
402   */
403  function subscript_close() {
404		$this->any_command();
405		$this->decorator->subscript_close();
406  }
407
408  /**
409   * Start a superscript
410   */
411  function superscript_open() {
412		$this->any_command();
413		$this->decorator->superscript_open();
414  }
415
416  /**
417   * Stop a superscript
418   */
419  function superscript_close() {
420		$this->any_command();
421		$this->decorator->superscript_close();
422  }
423
424  /**
425   * Start deleted (strike-through) formatting
426   */
427  function deleted_open() {
428		$this->any_command();
429		$this->decorator->deleted_open();
430  }
431
432  /**
433   * Stop deleted (strike-through) formatting
434   */
435  function deleted_close() {
436		$this->any_command();
437		$this->decorator->deleted_close();
438  }
439
440  /**
441   * Start a footnote
442   */
443  function footnote_open() {
444		$this->any_command();
445		$this->decorator->footnote_open();
446  }
447
448  /**
449   * Stop a footnote
450   */
451  function footnote_close() {
452		$this->any_command();
453		$this->decorator->footnote_close();
454  }
455
456/**
457 * Open an unordered list
458 */
459function listu_open() {
460		$this->any_command();
461		$this->decorator->listu_open();
462	}
463
464	/**
465	 * Close an unordered list
466	 */
467	function listu_close() {
468		$this->any_command();
469		$this->decorator->listu_close();
470	}
471
472  /**
473   * Open an ordered list
474   */
475  function listo_open() {
476		$this->any_command();
477		$this->decorator->listo_open();
478  }
479
480  /**
481   * Close an ordered list
482   */
483  function listo_close() {
484		$this->any_command();
485		$this->decorator->listo_close();
486  }
487
488	/**
489	 * Open a list item
490	 *
491	 * @param int $level the nesting level
492	 * @param bool $node true when a node; false when a leaf
493	 */
494	function listitem_open($level,$node=false) {
495		$this->any_command();
496		$this->decorator->listitem_open($level, $node);
497	}
498
499	/**
500	 * Start the content of a list item
501	 */
502	function listcontent_open() {
503		$this->any_command();
504		$this->decorator->listcontent_open();
505	}
506
507	/**
508	 * Stop the content of a list item
509	 */
510	function listcontent_close() {
511		$this->any_command();
512		$this->decorator->listcontent_close();
513	}
514
515  /**
516   * Close a list item
517   */
518  function listitem_close() {
519		$this->any_command();
520		$this->decorator->listitem_close();
521  }
522
523  /**
524   * Output unformatted $text
525   *
526   * @param string $text
527   */
528  function unformatted($text) {
529		error_log("decorator.unformatted <$text>");
530		$this->any_command();
531    $this->decorator->unformatted($text);
532  }
533
534  /**
535   * Output inline PHP code
536   *
537   * @param string $text The PHP code
538   */
539  function php($text) {
540		$this->any_command();
541		$this->decorator->php($text);
542  }
543
544  /**
545   * Output block level PHP code
546   *
547   * @param string $text The PHP code
548   */
549  function phpblock($text) {
550		$this->any_command();
551		$this->decorator->phpblock($text);
552  }
553
554  /**
555   * Output raw inline HTML
556   *
557   * If $conf['htmlok'] is true this should add the code as is to $doc
558   *
559   * @param string $text The HTML
560   */
561  function html($text) {
562		$this->any_command();
563		$this->decorator->html($text);
564  }
565
566  /**
567   * Output raw block-level HTML
568   *
569   * If $conf['htmlok'] is true this should add the code as is to $doc
570   *
571   * @param string $text The HTML
572   */
573  function htmlblock($text) {
574		$this->any_command();
575		$this->decorator->htmlblock($text);
576  }
577
578  /**
579   * Output preformatted text
580   *
581   * @param string $text
582   */
583  function preformatted($text) {
584		$this->any_command();
585		$this->decorator->preformatted($text);
586  }
587
588  /**
589   * Start a block quote
590   */
591  function quote_open() {
592		$this->any_command();
593		$this->decorator->quote_open();
594  }
595
596  /**
597   * Stop a block quote
598   */
599  function quote_close() {
600		$this->any_command();
601		$this->decorator->quote_close();
602  }
603
604  /**
605   * Display text as file content, optionally syntax highlighted
606   *
607   * @param string $text text to show
608   * @param string $lang programming language to use for syntax highlighting
609   * @param string $file file path label
610   */
611  function file($text, $lang = null, $file = null) {
612		$this->any_command();
613		$this->decorator->file($text, $lang, $file);
614  }
615
616  /**
617   * Display text as code content, optionally syntax highlighted
618   *
619   * @param string $text text to show
620   * @param string $lang programming language to use for syntax highlighting
621   * @param string $file file path label
622   */
623  function code($text, $lang = null, $file = null) {
624		$this->any_command();
625		$this->decorator->code($text, $lang, $file);
626  }
627
628  /**
629   * Format an acronym
630   *
631   * Uses $this->acronyms
632   *
633   * @param string $acronym
634   */
635  function acronym($acronym) {
636		$this->any_command();
637		$this->decorator->acronym($acronym);
638  }
639
640  /**
641   * Format a smiley
642   *
643   * Uses $this->smiley
644   *
645   * @param string $smiley
646   */
647  function smiley($smiley) {
648		$this->any_command();
649		$this->decorator->smiley($smiley);
650  }
651
652  /**
653   * Format an entity
654   *
655   * Entities are basically small text replacements
656   *
657   * Uses $this->entities
658   *
659   * @param string $entity
660   */
661  function entity($entity) {
662		$this->any_command();
663		$this->decorator->entity($entity);
664  }
665
666  /**
667   * Typographically format a multiply sign
668   *
669   * Example: ($x=640, $y=480) should result in "640×480"
670   *
671   * @param string|int $x first value
672   * @param string|int $y second value
673   */
674  function multiplyentity($x, $y) {
675		$this->any_command();
676		$this->decorator->multiplyentity($x, $y);
677  }
678
679  /**
680   * Render an opening single quote char (language specific)
681   */
682  function singlequoteopening() {
683		$this->any_command();
684		$this->decorator->singlequoteopening();
685  }
686
687  /**
688   * Render a closing single quote char (language specific)
689   */
690  function singlequoteclosing() {
691		$this->any_command();
692		$this->decorator->singlequoteclosing();
693  }
694
695  /**
696   * Render an apostrophe char (language specific)
697   */
698  function apostrophe() {
699		$this->any_command();
700		$this->decorator->apostrophe();
701  }
702
703  /**
704   * Render an opening double quote char (language specific)
705   */
706  function doublequoteopening() {
707		$this->any_command();
708		$this->decorator->doublequoteopening();
709  }
710
711  /**
712   * Render an closinging double quote char (language specific)
713   */
714  function doublequoteclosing() {
715		$this->any_command();
716		$this->decorator->doublequoteclosing();
717  }
718
719  /**
720   * Render a CamelCase link
721   *
722   * @param string $link The link name
723   * @see http://en.wikipedia.org/wiki/CamelCase
724   */
725  function camelcaselink($link) {
726		$this->any_command();
727		$this->decorator->camelcaselink($link);
728  }
729
730  /**
731   * Render a page local link
732   *
733   * @param string $hash hash link identifier
734   * @param string $name name for the link
735   */
736  function locallink($hash, $name = null) {
737		$this->any_command();
738		$this->decorator->locallink($hash, $name);
739  }
740
741	/**
742	 * Render a wiki internal link.
743	 * Internal links at the very beginning of an unordered item include
744	 * the destination page.
745	 * @param string       $link  page ID to link to. eg. 'wiki:syntax'
746	 * @param string|array $title name for the link, array for media file
747	 */
748	function internallink($link, $title = null) {
749		$this->any_command();
750		$this->decorator->internallink($link, $title);
751	}
752
753  /**
754   * Render an external link
755   *
756   * @param string       $link  full URL with scheme
757   * @param string|array $title name for the link, array for media file
758   */
759  function externallink($link, $title = null) {
760		$this->any_command();
761		$this->decorator->externallink($link, $title);
762  }
763
764  /**
765   * Render the output of an RSS feed
766   *
767   * @param string $url    URL of the feed
768   * @param array  $params Finetuning of the output
769   */
770  function rss($url, $params) {
771		$this->any_command();
772		$this->decorator->rss($link, $title);
773  }
774
775  /**
776   * Render an interwiki link
777   *
778   * You may want to use $this->_resolveInterWiki() here
779   *
780   * @param string       $link     original link - probably not much use
781   * @param string|array $title    name for the link, array for media file
782   * @param string       $wikiName indentifier (shortcut) for the remote wiki
783   * @param string       $wikiUri  the fragment parsed from the original link
784   */
785  function interwikilink($link, $title = null, $wikiName, $wikiUri) {
786		$this->any_command();
787		$this->decorator->interwikilink($link, $title, $wikiName, $wikiUri);
788  }
789
790  /**
791   * Link to file on users OS
792   *
793   * @param string       $link  the link
794   * @param string|array $title name for the link, array for media file
795   */
796  function filelink($link, $title = null) {
797		$this->any_command();
798		$this->decorator->filelink($link, $title);
799  }
800
801  /**
802   * Link to windows share
803   *
804   * @param string       $link  the link
805   * @param string|array $title name for the link, array for media file
806   */
807  function windowssharelink($link, $title = null) {
808		$this->any_command();
809		$this->decorator->windowssharelink($link, $title);
810  }
811
812  /**
813   * Render a linked E-Mail Address
814   *
815   * Should honor $conf['mailguard'] setting
816   *
817   * @param string $address Email-Address
818   * @param string|array $name name for the link, array for media file
819   */
820  function emaillink($address, $name = null) {
821		$this->any_command();
822		$this->decorator->emaillink($address, $name);
823  }
824
825	/**
826	 * Render an internal media file
827	 *
828	 * @param string $src     media ID
829	 * @param string $title   descriptive text
830	 * @param string $align   left|center|right
831	 * @param int    $width   width of media in pixel
832	 * @param int    $height  height of media in pixel
833	 * @param string $cache   cache|recache|nocache
834	 * @param string $linking linkonly|detail|nolink
835	 * @param int    $positionInGroup Position of the media in the group.
836	 * @param int    $totalInGroup Size of the group of media.
837	 */
838	function internalmedia($src, $title = null, $align = null, $width = null,
839	                       $height = null, $cache = null, $linking = null, $positionInGroup = 1, $totalInGroup = 1) {
840		$this->any_command();
841		$this->decorator->internalmedia($src, $title, $align, $width, $height, $cache, $linking, $positionInGroup, $totalInGroup);
842	}
843
844  /**
845   * Render an external media file
846   *
847   * @param string $src     full media URL
848   * @param string $title   descriptive text
849   * @param string $align   left|center|right
850   * @param int    $width   width of media in pixel
851   * @param int    $height  height of media in pixel
852   * @param string $cache   cache|recache|nocache
853   * @param string $linking linkonly|detail|nolink
854   */
855  function externalmedia($src, $title = null, $align = null, $width = null,
856                         $height = null, $cache = null, $linking = null) {
857		$this->any_command();
858		$this->decorator->externalmedia($src, $title, $align, $width, $height, $cache, $linking);
859  }
860
861  /**
862   * Render a link to an internal media file
863   *
864   * @param string $src     media ID
865   * @param string $title   descriptive text
866   * @param string $align   left|center|right
867   * @param int    $width   width of media in pixel
868   * @param int    $height  height of media in pixel
869   * @param string $cache   cache|recache|nocache
870   */
871  function internalmedialink($src, $title = null, $align = null,
872                               $width = null, $height = null, $cache = null) {
873		$this->any_command();
874		$this->decorator->internalmedialink($src, $title, $align, $width, $height, $cache);
875  }
876
877  /**
878   * Render a link to an external media file
879   *
880   * @param string $src     media ID
881   * @param string $title   descriptive text
882   * @param string $align   left|center|right
883   * @param int    $width   width of media in pixel
884   * @param int    $height  height of media in pixel
885   * @param string $cache   cache|recache|nocache
886   */
887  function externalmedialink($src, $title = null, $align = null,
888                             $width = null, $height = null, $cache = null) {
889 		$this->any_command();
890 		$this->decorator->externalmedialink($src, $title, $align, $width, $height, $cache);
891  }
892
893  /**
894   * Start a table
895   *
896   * @param int $maxcols maximum number of columns
897   * @param int $numrows NOT IMPLEMENTED
898   * @param int $pos     byte position in the original source
899   */
900  function table_open($maxcols = null, $numrows = null, $pos = null) {
901		$this->any_command();
902		$this->decorator->table_open($maxcols, $numrows, $pos);
903  }
904
905  /**
906   * Close a table
907   *
908   * @param int $pos byte position in the original source
909   */
910  function table_close($pos = null) {
911		$this->any_command();
912		$this->decorator->table_close($pos);
913  }
914
915  /**
916   * Open a table header
917   */
918  function tablethead_open() {
919		$this->any_command();
920		$this->decorator->any_command();
921  }
922
923  /**
924   * Close a table header
925   */
926  function tablethead_close() {
927		$this->any_command();
928		$this->decorator->tablethead_close();
929  }
930
931  /**
932   * Open a table body
933   */
934  function tabletbody_open() {
935		$this->any_command();
936		$this->decorator->tabletbody_open();
937  }
938
939  /**
940   * Close a table body
941   */
942  function tabletbody_close() {
943		$this->any_command();
944		$this->decorator->tabletbody_close();
945  }
946
947  /**
948   * Open a table footer
949   */
950  function tabletfoot_open() {
951		$this->any_command();
952		$this->decorator->tabletfoot_open();
953  }
954
955  /**
956   * Close a table footer
957   */
958  function tabletfoot_close() {
959		$this->any_command();
960		$this->decorator->tabletfoot_close();
961  }
962
963  /**
964   * Open a table row
965   */
966  function tablerow_open() {
967		$this->any_command();
968		$this->decorator->tablerow_open();
969  }
970
971  /**
972   * Close a table row
973   */
974  function tablerow_close() {
975		$this->any_command();
976		$this->decorator->tablerow_close();
977  }
978
979  /**
980   * Open a table header cell
981   *
982   * @param int    $colspan
983   * @param string $align left|center|right
984   * @param int    $rowspan
985   */
986  function tableheader_open($colspan = 1, $align = null, $rowspan = 1) {
987		$this->any_command();
988		$this->decorator->tableheader_open($colspan, $align, $rowspan);
989  }
990
991  /**
992   * Close a table header cell
993   */
994  function tableheader_close() {
995		$this->any_command();
996		$this->decorator->tableheader_close();
997  }
998
999  /**
1000   * Open a table cell
1001   *
1002   * @param int    $colspan
1003   * @param string $align left|center|right
1004   * @param int    $rowspan
1005   */
1006  function tablecell_open($colspan = 1, $align = null, $rowspan = 1) {
1007		$this->any_command();
1008		$this->decorator->tablecell_open($colspan, $align, $rowspan);
1009  }
1010
1011  /**
1012   * Close a table cell
1013   */
1014  function tablecell_close() {
1015		$this->any_command();
1016		$this->decorator->tablecell_close();
1017  }
1018}
1019