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