[TASK] Remove last XCLASS statements
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / media / scripts / plaintextLib.inc
1 <?php
2 /***************************************************************
3 *  Copyright notice
4 *
5 *  (c) 1999-2009 Kasper Skårhøj (kasperYYYY@typo3.com)
6 *  All rights reserved
7 *
8 *  This script is part of the TYPO3 project. The TYPO3 project is
9 *  free software; you can redistribute it and/or modify
10 *  it under the terms of the GNU General Public License as published by
11 *  the Free Software Foundation; either version 2 of the License, or
12 *  (at your option) any later version.
13 *
14 *  The GNU General Public License can be found at
15 *  http://www.gnu.org/copyleft/gpl.html.
16 *  A copy is found in the textfile GPL.txt and important notices to the license
17 *  from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 *  This script is distributed in the hope that it will be useful,
21 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
22 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 *  GNU General Public License for more details.
24 *
25 *  This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 /**
29  * Generating plain text content of content elements for Direct Mails
30  *
31  * Alternative rendering of content elements for Plain Text emails. That means text-only output. No HTML at all. Used by the Direct Mail extension.
32  * Normally the plain text output should appear with type=99.
33  * To use this library you can include the static template "plugin.alt.plaintext"
34  *
35  * ## Insert DMailer Boundaries for all elements.
36  * config.insertDmailerBoundaries = 1
37  * includeLibs.plaintextLib = media/scripts/plaintextLib.inc
38  *
39  * ## Set up page/type number:
40  * alt_plaintext >
41  * alt_plaintext = PAGE
42  * alt_plaintext.typeNum=99
43  * alt_plaintext.config.disableAllHeaderCode = 1
44  * alt_plaintext.10 = TEMPLATE
45  * alt_plaintext.10 {
46  *   template = FILE
47  *   template.file = {$plugin.alt.plaintext.file.template}
48  *   marks.CONTENT < styles.content.get
49  *   marks.CONTENT.renderObj = < lib.alt_plaintext.renderObj
50  *   marks.DATE = TEXT
51  *   marks.DATE.data = date:U
52  *   marks.DATE.strftime = %e. %B %Y
53  * }
54  *
55  * (And then also "lib.alt_plaintext.renderObj" is configured extensively - basically with the TypoScript options passed to this class. See the static template "plugin.alt.plaintext")
56  *
57  * @author Kasper Skårhøj <kasperYYYY@typo3.com>
58  * @package TYPO3
59  * @subpackage tslib
60  */
61 class user_plaintext {
62         var $cObj;
63         var $conf = array();
64         var $charWidth = 76;
65
66         /**
67          * Main function, called from TypoScript
68          * A content object that renders "tt_content" records. See the comment to this class for TypoScript example of how to trigger it.
69          * This detects the CType of the current content element and renders it accordingly. Only wellknown types are rendered.
70          *
71          * @param string $content Empty, ignore.
72          * @param array $conf TypoScript properties for this content object/function call
73          * @return string Plain text content
74          */
75         function main_plaintext($content, $conf) {
76                 $this->conf = $conf;
77                 $this->siteUrl=$conf['siteUrl'];
78                 $lines = array();
79                 $CType= (string)$this->cObj->data['CType'];
80                 switch($CType) {
81                         case 'header':
82                                 $lines[]=$this->getHeader();
83                                 if ($this->cObj->data['subheader']) {
84                                         $lines[]=$this->breakContent(strip_tags($this->cObj->data['subheader']));
85                                 }
86                         break;
87                         case 'text':
88                         case 'textpic':
89                                 $lines[]=$this->getHeader();
90                                 if ($CType=='textpic' && !($this->cObj->data['imageorient']&24)) {
91                                         $lines[]=$this->getImages();
92                                         $lines[]='';
93                                 }
94                                 $lines[]=$this->breakContent(strip_tags($this->parseBody($this->cObj->data['bodytext'])));
95                                 if ($CType=='textpic' && ($this->cObj->data['imageorient']&24)) {
96                                         $lines[]='';
97                                         $lines[]=$this->getImages();
98                                 }
99                         break;
100                         case 'image':
101                                 $lines[]=$this->getHeader();
102                                 $lines[]=$this->getImages();
103                         break;
104                         case 'uploads':
105                                 $lines[]=$this->getHeader();
106                                 $lines[]=$this->renderUploads($this->cObj->data['media']);
107                         break;
108                         case 'menu':
109                                 $lines[]=$this->getHeader();
110                                 $lines[]=$this->getMenuSitemap();
111                         break;
112                         case 'shortcut':
113                                 $lines[]=$this->getShortcut();
114                         break;
115                         case 'bullets':
116                                 $lines[]=$this->getHeader();
117                                 $lines[]=$this->breakBulletlist(strip_tags($this->parseBody($this->cObj->data['bodytext'])));
118                         break;
119                         case 'list':
120                                 $lines[]=$this->getHeader();
121                                 $lines[]=$this->getList();
122                         break;
123                         case 'table':
124                                 $lines[]=$this->getHeader();
125                                 $lines[]=$this->breakTable(strip_tags($this->parseBody($this->cObj->data['bodytext'])));
126                         break;
127                         case 'html':
128                                 $lines[]=$this->getHTML();
129                         break;
130                         default:
131                                 $defaultOutput = $this->getString($this->conf['defaultOutput']);
132                                 if ($defaultOutput) {
133                                         $lines[]=str_replace('###CType###', $CType, $defaultOutput);
134                                 }
135                         break;
136                 }
137
138                         // First break.
139                 $lines[] = '';
140                 $content = implode(chr(10), $lines);
141
142                         // User processing:
143                 $content=$this->userProcess('userProc', $content);
144                 return $content;
145         }
146
147         /**
148          * Creates a menu/sitemap
149          *
150          * @return string Content
151          */
152         function getMenuSitemap() {
153                 $str = $this->cObj->cObjGetSingle($this->conf['menu'], $this->conf['menu.']);
154                 $str = $this->breakBulletlist(trim(strip_tags(preg_replace('/<br[ \/]*>/i', chr(10), $this->parseBody($str)))));
155                 return $str;
156         }
157
158         /**
159          * Creates a shortcut ("Insert Records")
160          *
161          * @return string Content
162          */
163         function getShortcut() {
164                 $str = $this->cObj->cObjGetSingle($this->conf['shortcut'], $this->conf['shortcut.']);
165                 return $str;
166         }
167
168         /**
169          * Creates an HTML element (stripping tags of course)
170          *
171          * @param string $str HTML content to process. If not passed along, the bodytext field is used.
172          * @return string Content
173          */
174         function getHTML($str = array()) {
175                 return $this->breakContent(strip_tags(preg_replace('/<br[ \/]*>/i', chr(10), $this->parseBody(is_string($str) ? $str : $this->cObj->data['bodytext']))));
176         }
177
178         /**
179          * Creates a header (used for most elements)
180          *
181          * @return string Content
182          * @see renderHeader()
183          */
184         function getHeader() {
185                         // links...
186                 return $this->renderHeader($this->cObj->data['header'], $this->cObj->data['header_layout']);
187         }
188
189         /**
190          * Get images found in the "image" field of "tt_content"
191          *
192          * @return string Content
193          */
194         function getImages() {
195                 $images = $this->renderImages($this->cObj->data['image'], !$this->cObj->data['image_zoom'] ? $this->cObj->data['image_link'] : '', $this->cObj->data['imagecaption']);
196                 return $images;
197         }
198
199         /**
200          * Parsing the bodytext field content, removing typical entities and <br /> tags.
201          *
202          * @param string $str Field content from "bodytext"
203          * @return string Processed content
204          */
205         function parseBody($str) {
206                         // First, regular parsing:
207                 $str = preg_replace('/<br[ \/]*>/i', ' ', $str);
208                 $str = $this->cObj->stdWrap($str, $this->conf['bodytext.']['stdWrap.']);
209                         // Then all a-tags:
210                 $aConf = array();
211                 $aConf['parseFunc.']['tags.']['a']='USER';
212                 $aConf['parseFunc.']['tags.']['a.']['userFunc'] = 'user_plaintext->atag_to_http';
213                 $aConf['parseFunc.']['tags.']['a.']['siteUrl'] = $this->siteUrl;
214
215                 $str = $this->cObj->stdWrap($str, $aConf);
216                 $str = str_replace('&nbsp;', ' ', t3lib_div::htmlspecialchars_decode($str));
217                 return $str;
218         }
219
220         /**
221          * Creates a list of links to uploaded files.
222          *
223          * @param string $str List of uploaded filenames from "uploads/media/" (or $upload_path)
224          * @param string $upload_path Alternative path value
225          * @return string Content
226          */
227         function renderUploads($str, $upload_path = 'uploads/media/') {
228                 $files = explode(',', $str);
229                 $lines = array();
230                 if ($this->conf['uploads.']['header']) {
231                         $lines[] = $this->getString($this->conf['uploads.']['header']);
232                 }
233                 foreach ($files as $k => $file) {
234                         $lines[] = $this->siteUrl.$upload_path.$file;
235                 }
236                 return implode(chr(10), $lines);
237         }
238
239         /**
240          * Creates a list
241          *
242          * @param string $CType Type of content
243          * @return string Content
244          */
245         function getList($CType = 'list') {
246                 $str = $this->cObj->cObjGetSingle($this->conf[$CType], $this->conf[$CType . '.']);
247                 return trim(strip_tags($this->parseBody($str)));
248         }
249
250         /**
251          * Renders a content element header, observing the layout type giving different header formattings
252          *
253          * @param string $str The header string
254          * @param integer $type The layout type of the header (in the content element)
255          * @return string Content
256          */
257         function renderHeader($str, $type = 0) {
258                 if ($str) {
259                         $hConf = $this->conf['header.'];
260                         $defaultType = t3lib_utility_Math::forceIntegerInRange($hConf['defaultType'], 1, 5);
261                         $type=t3lib_utility_Math::forceIntegerInRange($type, 0, 6);
262                         if (!$type)     $type = $defaultType;
263                                 // not hidden
264                         if ($type != 6) {
265                                 $tConf = $hConf[$type.'.'];
266
267                                 $lines=array();
268
269                                 $blanks = t3lib_utility_Math::forceIntegerInRange($tConf['preBlanks'], 0, 1000);
270                                 if ($blanks) {
271                                         $lines[]=str_pad('', $blanks-1, chr(10));
272                                 }
273
274                                 $lines=$this->pad($lines, $tConf['preLineChar'], $tConf['preLineLen']);
275
276                                 $blanks = t3lib_utility_Math::forceIntegerInRange($tConf['preLineBlanks'], 0, 1000);
277                                 if ($blanks)    {$lines[]=str_pad('', $blanks-1, chr(10));}
278
279                                 if ($this->cObj->data['date']) {
280                                         $lines[] = $this->getString($hConf['datePrefix']) . date($hConf['date'] ? $hConf['date'] : $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $this->cObj->data['date']);
281                                 }
282                                 $prefix = '';
283                                 $str = $this->getString($tConf['prefix']).$str;
284                                 if ($tConf['autonumber'])       $str=$this->cObj->parentRecordNumber.$str;
285                                 if ($this->cObj->data['header_position']=='right')      {$prefix=str_pad(' ', ($this->charWidth-strlen($str)));}
286                                 if ($this->cObj->data['header_position']=='center')     {$prefix=str_pad(' ', floor(($this->charWidth-strlen($str))/2));}
287                                 $lines[]=$this->cObj->stdWrap($prefix.$str, $tConf['stdWrap.']);
288                                 if ($this->cObj->data['header_link'])           {$lines[] = $this->getString($hConf['linkPrefix']).$this->getLink($this->cObj->data['header_link']);}
289
290                                 $blanks = t3lib_utility_Math::forceIntegerInRange($tConf['postLineBlanks'], 0, 1000);
291                                 if ($blanks) {
292                                         $lines[] = str_pad('', $blanks-1, chr(10));
293                                 }
294
295                                 $lines=$this->pad($lines, $tConf['postLineChar'], $tConf['postLineLen']);
296
297                                 $blanks = t3lib_utility_Math::forceIntegerInRange($tConf['postBlanks'], 0, 1000);
298                                 if ($blanks) {
299                                         $lines[] = str_pad('', $blanks-1, chr(10));
300                                 }
301                                 return implode(chr(10), $lines);
302                         }
303                 }
304         }
305
306         /**
307          * Function used to repeat a char pattern in head lines (like if you want "********" above/below a header)
308          *
309          * @param array $lines Array of existing lines to which the new char-pattern should be added
310          * @param string $preLineChar The character pattern to repeat. Default is "-"
311          * @param integer $len The length of the line. $preLineChar will be repeated to fill in this length.
312          * @return array The input array with a new line added.
313          * @see renderHeader()
314          */
315         function pad($lines, $preLineChar, $len) {
316                 $strPad = t3lib_utility_Math::forceIntegerInRange($len, 0, 1000);
317                 $strPadChar = $preLineChar?$preLineChar:'-';
318                 if ($strPad) {
319                         $lines[]=str_pad('', $strPad, $strPadChar);
320                 }
321                 return $lines;
322         }
323
324         /**
325          * Function used to wrap the bodytext field content (or image caption) into lines of a max length of
326          *
327          * @param string The content to break
328          * @return string Processed value.
329          * @see main_plaintext(), breakLines()
330          */
331         function breakContent($str) {
332                 $cParts = explode(chr(10), $str);
333                 $lines = array();
334                 foreach ($cParts as $substrs) {
335                         $lines[] = $this->breakLines($substrs);
336                 }
337                 return implode(chr(10), $lines);
338         }
339
340         /**
341          * Breaks content lines into a bullet list
342          *
343          * @param string $str Content string to make into a bullet list
344          * @return string Processed value
345          */
346         function breakBulletlist($str) {
347                 $type = $this->cObj->data['layout'];
348                 $type=t3lib_utility_Math::forceIntegerInRange($type, 0, 3);
349
350                 $tConf = $this->conf['bulletlist.'][$type.'.'];
351
352                 $cParts = explode(chr(10), $str);
353                 $lines = array();
354                 $c = 0;
355                 foreach ($cParts as $substrs) {
356                         $c++;
357                         $bullet = $tConf['bullet'] ? $this->getString($tConf['bullet']) : ' - ';
358                         $bLen = strlen($bullet);
359                         $bullet = substr(str_replace('#', $c, $bullet), 0, $bLen);
360                         $secondRow = substr($tConf['secondRow'] ? $this->getString($tConf['secondRow']) : str_pad('', strlen($bullet), ' '), 0, $bLen);
361
362                         $lines[] = $bullet . $this->breakLines($substrs, chr(10) . $secondRow, $this->charWidth-$bLen);
363
364                         $blanks = t3lib_utility_Math::forceIntegerInRange($tConf['blanks'], 0, 1000);
365                         if ($blanks) {
366                                 $lines[]=str_pad('', $blanks-1, chr(10));
367                         }
368                 }
369                 return implode(chr(10), $lines);
370         }
371
372         /**
373          * Formatting a table in plain text (based on the paradigm of lines being content rows and cells separated by "|")
374          *
375          * @param string $str Content string
376          * @return string Processed value
377          */
378         function breakTable($str) {
379                 $cParts = explode(chr(10), $str);
380                 $lines = array();
381                 $cols = intval($this->conf['cols']) ? intval($this->conf['cols']) : 0;
382                 $c = 0;
383                 foreach ($cParts as $substrs) {
384                         $c++;
385                         if (trim($substrs)) {
386                                 $lineParts=explode('|', $substrs);
387                                 if (!$cols)     $cols=count($lineParts);
388
389                                 for ($a=0;$a<$cols;$a++) {
390                                         $jdu = explode(chr(10), $this->breakLines($lineParts[$a], chr(10), ceil($this->charWidth/$cols)));
391                                         $lines[$c][$a]=$jdu;
392                                 }
393                         }
394                 }
395                 $messure = $this->traverseTable($lines);
396
397                 $divChar = '-';
398                 $joinChar = '+';
399                 $colChar = '|';
400
401                         // Make table:
402                 $outLines = array();
403                 $outLines[] = $this->addDiv($messure, '', $divChar, $joinChar, $cols);
404
405                 foreach ($lines as $k => $v) {
406                         $top = intval($messure[1][$k]);
407                         for ($aa = 0; $aa < $top; $aa++) {
408                                 $tempArr = array();
409                                 for ($bb = 0; $bb < $cols; $bb++) {
410                                         $tempArr[$bb]=str_pad($v[$bb][$aa], $messure[0][$bb], ' ');
411                                 }
412                                 $outLines[] = $colChar . implode($colChar, $tempArr) . $colChar;
413                         }
414                         $outLines[] = $this->addDiv($messure, '', $divChar, $joinChar, $cols);
415                 }
416                 return implode(chr(10), $outLines);
417         }
418
419         /**
420          * Subfunction for breakTable(): Adds a divider line between table rows.
421          *
422          * @param array $messure Some information about sizes
423          * @param string $content Empty string.
424          * @param string $divChar Character to use for the divider line, typically "-"
425          * @param string $joinChar Join character, typically "+"
426          * @param integer $colsNumber of table columns
427          * @return string Divider line for the table
428          * @access private
429          * @see breakTable()
430          */
431         function addDiv($messure, $content, $divChar, $joinChar, $cols) {
432                 $tempArr=array();
433                 for ($a=0;$a<$cols;$a++) {
434                         $tempArr[$a]=str_pad($content, $messure[0][$a], $divChar);
435                 }
436                 return $joinChar . implode($joinChar, $tempArr) . $joinChar;
437         }
438
439         /**
440          * Traverses the table lines/cells and creates arrays with statistics for line numbers and lengths
441          *
442          * @param array $tableLines Array with [table rows] [table cells] [lines in cell]
443          * @return array Statistics (max lines/lengths)
444          * @access private
445          * @see breakTable()
446          */
447         function traverseTable($tableLines) {
448                 $maxLen=array();
449                 $maxLines=array();
450                 foreach ($tableLines as $k => $v) {
451                         foreach ($v as $kk => $vv) {
452                                 foreach ($vv as $lk => $lv) {
453                                         if (strlen($lv)>intval($maxLen[$kk]))   $maxLen[$kk]=strlen($lv);
454                                 }
455                                 if (count($vv)>intval($maxLines[$k]))   $maxLines[$k]=count($vv);
456                         }
457                 }
458                 return array($maxLen, $maxLines);
459         }
460
461         /**
462          * Render block of images - which means creating lines with links to the images.
463          *
464          * @param string $str List of image filenames (from "image" field in tt_content records)
465          * @param string $links Link value from the "image_link" field in tt_content records
466          * @param string $caption Caption text
467          * @param string $upload_path Alternative relative path for the files listed in $str
468          * @return string Content
469          * @see getImages()
470          */
471         function renderImages($str, $links, $caption, $upload_path = 'uploads/pics/') {
472                 $images = explode(',', $str);
473                 $linksArr = explode(LF, $links);
474                 $lines = array();
475                 if ($this->conf['images.']['header'])   {
476                         $lines[] = $this->getString($this->conf['images.']['header']);
477                 }
478                 foreach ($images as $k => $file) {
479                         $lines[]=$this->siteUrl.$upload_path.$file;
480                         if ($links && count($linksArr)>1) {
481                                 if (isset($linksArr[$k])) {
482                                         $ll=$linksArr[$k];
483                                 } else {
484                                         $ll=$linksArr[0];
485                                 }
486
487                                 $theLink = $this->getLink($ll);
488                                 if ($theLink)   {$lines[]=$this->getString($this->conf['images.']['linkPrefix']).$theLink;}
489                         }
490                 }
491                 if ($links && count($linksArr) == 1) {
492                         $theLink = $this->getLink($links);
493                         if ($theLink)   {$lines[]=$this->getString($this->conf['images.']['linkPrefix']).$theLink;}
494                 }
495                 if ($caption) {
496                         $lines[] = '';
497                         $cHeader = trim($this->getString($this->conf['images.']['captionHeader']));
498                         if ($cHeader)           $lines[] = $cHeader;
499                         $lines[] = $this->breakContent($caption);
500                 }
501
502                 return implode(chr(10), $lines);
503         }
504
505         /**
506          * Returns a typolink URL based on input.
507          *
508          * @param string $ll Parameter to typolink
509          * @return string The URL returned from $this->cObj->getTypoLink_URL(); - possibly it prefixed with the URL of the site if not present already
510          */
511         function getLink($ll) {
512                 $theLink=$this->cObj->getTypoLink_URL($ll);
513                 if (substr($theLink, 0, 4) != 'http') {
514                         $theLink=$this->siteUrl.$theLink;
515                 }
516                 return $theLink;
517         }
518
519         /**
520          * Breaking lines into fixed length lines, using t3lib_div::breakLinesForEmail()
521          *
522          * @param string $str The string to break
523          * @param string $implChar Line break character
524          * @param integer $charWidth Length of lines, default is $this->charWidth
525          * @return string Processed string
526          * @see t3lib_div::breakLinesForEmail()
527          */
528         function breakLines($str, $implChar = "\n", $charWidth = 0) {
529                 return t3lib_div::breakLinesForEmail($str, $implChar, $charWidth ? $charWidth : $this->charWidth);
530         }
531
532         /**
533          * Explodes a string with "|" and if the second part is found it will return this, otherwise the first part.
534          * Used for many TypoScript properties used in this class since they need preceeding whitespace to be preserved.
535          *
536          * @param string $str Input string
537          * @return string Output string
538          * @access private
539          */
540         function getString($str) {
541                 $parts = explode('|', $str);
542                 return strcmp($parts[1], '') ? $parts[1] : $parts[0];
543         }
544
545         /**
546          * Calls a user function for processing of data
547          *
548          * @param string $mConfKey TypoScript property name, pointing to the definition of the user function to call (from the TypoScript array internally in this class). This array is passed to the user function. Notice that "parentObj" property is a reference to this class ($this)
549          * @param mixed $passVar Variable to process
550          * @return mixed The processed $passVar as returned by the function call
551          */
552         function userProcess($mConfKey, $passVar) {
553                 if ($this->conf[$mConfKey]) {
554                         $funcConf = $this->conf[$mConfKey.'.'];
555                         $funcConf['parentObj'] = $this;
556                         $passVar = $GLOBALS['TSFE']->cObj->callUserFunction($this->conf[$mConfKey], $funcConf, $passVar);
557                 }
558                 return $passVar;
559         }
560
561         /**
562          * Function used by TypoScript "parseFunc" to process links in the bodytext.
563          * Extracts the link and shows it in plain text in a parathesis next to the link text. If link was relative the site URL was prepended.
564          *
565          * @param string $content Empty, ignore.
566          * @param array $conf TypoScript parameters
567          * @return string Processed output.
568          * @see parseBody()
569          */
570         function atag_to_http($content, $conf) {
571                 $this->conf = $conf;
572                 $this->siteUrl=$conf['siteUrl'];
573                 $theLink  = trim($this->cObj->parameters['href']);
574                 if (strtolower(substr($theLink, 0, 7)) == 'mailto:') {
575                         $theLink = substr($theLink, 7);
576                 } elseif (substr($theLink, 0, 4) != 'http') {
577                         $theLink=$this->siteUrl.$theLink;
578                 }
579                 return $this->cObj->getCurrentVal().' (Link: '.$theLink.' )';
580         }
581
582         /**
583          * User function (called from TypoScript) for generating a bullet list (used in parsefunc)
584          *
585          * @param string $content Empty, ignore.
586          * @param array $conf TypoScript parameters
587          * @return string Processed output.
588          */
589         function typolist($content, $conf) {
590                 $this->conf = $this->cObj->mergeTSRef($conf, 'bulletlist');
591                 $this->siteUrl=$conf['siteUrl'];
592                 $str = trim($this->cObj->getCurrentVal());
593                 $this->cObj->data['layout'] = $this->cObj->parameters['type'];
594                 return $this->breakBulletlist($str);
595         }
596
597         /**
598          * User function (called from TypoScript) for generating a typo header tag (used in parsefunc)
599          *
600          * @param string $content Empty, ignore.
601          * @param array $conf TypoScript parameters
602          * @return string Processed output.
603          */
604         function typohead($content, $conf) {
605                 $this->conf = $this->cObj->mergeTSRef($conf, 'header');
606
607                 $this->siteUrl=$conf['siteUrl'];
608                 $str = trim($this->cObj->getCurrentVal());
609                 $this->cObj->data['header_layout'] = $this->cObj->parameters['type'];
610                 $this->cObj->data['header_position'] = $this->cObj->parameters['align'];
611                 $this->cObj->data['header'] = $str;
612
613                 return $this->getHeader();
614         }
615
616         /**
617          * User function (called from TypoScript) for generating a code listing (used in parsefunc)
618          *
619          * @param string $content Empty, ignore.
620          * @param array $conf TypoScript parameters
621          * @return string Processed output.
622          */
623         function typocode($content, $conf) {
624                         // Nothing is really done here...
625                 $this->conf = $conf;
626                 $this->siteUrl = $conf['siteUrl'];
627                 return $this->cObj->getCurrentVal();
628         }
629 }
630 ?>