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