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