PageRenderTime 166ms CodeModel.GetById 56ms app.highlight 100ms RepoModel.GetById 2ms app.codeStats 0ms

/typo3/sysext/cms/tslib/media/scripts/plaintextLib.inc

https://bitbucket.org/linxpinx/mercurial
PHP | 673 lines | 320 code | 73 blank | 280 comment | 45 complexity | 3235e1775ea33a20c369fc4e358c46d9 MD5 | raw file
  1<?php
  2/***************************************************************
  3*  Copyright notice
  4*
  5*  (c) 1999-2009 Kasper Skaarhoj (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 * $Id: plaintextLib.inc 7601 2010-05-13 17:12:58Z baschny $
 31 * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
 32 *
 33 * @author	Kasper Skaarhoj <kasperYYYY@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 <kasperYYYY@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 */
123class 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(preg_replace('/<br[ \/]*>/i',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(preg_replace('/<br[ \/]*>/i',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 = preg_replace('/<br[ \/]*>/i',' ',$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		$lines=array();
287		if ($this->conf['uploads.']['header'])	{$lines[]=$this->getString($this->conf['uploads.']['header']);}
288		foreach ($files as $k => $file) {
289			$lines[]=$this->siteUrl.$upload_path.$file;
290		}
291		return implode(chr(10),$lines);
292	}
293
294	/**
295	 * Renders a content element header, observing the layout type giving different header formattings
296	 *
297	 * @param	string		The header string
298	 * @param	integer		The layout type of the header (in the content element)
299	 * @return	string		Content
300	 */
301	function renderHeader($str,$type=0)	{
302		if ($str)	{
303			$hConf = $this->conf['header.'];
304			$defaultType = t3lib_div::intInRange($hConf['defaultType'],1,5);
305			$type=t3lib_div::intInRange($type,0,6);
306			if (!$type)	$type=$defaultType;
307			if ($type!=6)	{	// not hidden
308				$tConf = $hConf[$type.'.'];
309
310				$lines=array();
311
312				$blanks = t3lib_div::intInRange($tConf['preBlanks'],0,1000);
313				if ($blanks)	{
314					$lines[]=str_pad('', $blanks-1, chr(10));
315				}
316
317				$lines=$this->pad($lines,$tConf['preLineChar'],$tConf['preLineLen']);
318
319				$blanks = t3lib_div::intInRange($tConf['preLineBlanks'],0,1000);
320				if ($blanks)	{$lines[]=str_pad('', $blanks-1, chr(10));}
321
322				if ($this->cObj->data['date'])	{
323					$lines[] = $this->getString($hConf['datePrefix']).date($hConf['date']?$hConf['date']:$GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],$this->cObj->data['date']);
324				}
325				$prefix='';
326				$str=$this->getString($tConf['prefix']).$str;
327				if ($tConf['autonumber'])	$str=$this->cObj->parentRecordNumber.$str;
328				if ($this->cObj->data['header_position']=='right')	{$prefix=str_pad(' ',($this->charWidth-strlen($str)));}
329				if ($this->cObj->data['header_position']=='center')	{$prefix=str_pad(' ',floor(($this->charWidth-strlen($str))/2));}
330				$lines[]=$this->cObj->stdWrap($prefix.$str,$tConf['stdWrap.']);
331				if ($this->cObj->data['header_link'])		{$lines[] = $this->getString($hConf['linkPrefix']).$this->getLink($this->cObj->data['header_link']);}
332
333				$blanks = t3lib_div::intInRange($tConf['postLineBlanks'],0,1000);
334				if ($blanks)	{$lines[]=str_pad('', $blanks-1, chr(10));}
335
336				$lines=$this->pad($lines,$tConf['postLineChar'],$tConf['postLineLen']);
337
338				$blanks = t3lib_div::intInRange($tConf['postBlanks'],0,1000);
339				if ($blanks)	{$lines[]=str_pad('', $blanks-1, chr(10));}
340				return implode(chr(10),$lines);
341			}
342		}
343	}
344
345	/**
346	 * Function used to repeat a char pattern in head lines (like if you want "********" above/below a header)
347	 *
348	 * @param	array		Array of existing lines to which the new char-pattern should be added
349	 * @param	string		The character pattern to repeat. Default is "-"
350	 * @param	integer		The length of the line. $preLineChar will be repeated to fill in this length.
351	 * @return	array		The input array with a new line added.
352	 * @see renderHeader()
353	 */
354	function pad($lines,$preLineChar,$len)	{
355		$strPad = t3lib_div::intInRange($len,0,1000);
356		$strPadChar = $preLineChar?$preLineChar:'-';
357		if ($strPad)	{
358			$lines[]=str_pad('', $strPad, $strPadChar);
359		}
360		return $lines;
361	}
362
363	/**
364	 * Function used to wrap the bodytext field content (or image caption) into lines of a max length of
365	 *
366	 * @param	string		The content to break
367	 * @return	string		Processed value.
368	 * @see main_plaintext(), breakLines()
369	 */
370	function breakContent($str)	{
371		$cParts = explode(chr(10),$str);
372		$lines=array();
373		foreach ($cParts as $substrs) {
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		$lines=array();
393		$c=0;
394		foreach ($cParts as $substrs) {
395			$c++;
396			$bullet = $tConf['bullet'] ? $this->getString($tConf['bullet']) : ' - ';
397			$bLen=strlen($bullet);
398			$bullet = substr(str_replace('#',$c,$bullet),0,$bLen);
399			$secondRow = substr($tConf['secondRow']?$this->getString($tConf['secondRow']):str_pad('',strlen($bullet),' '),0,$bLen);
400
401			$lines[]=$bullet.$this->breakLines($substrs,chr(10).$secondRow,$this->charWidth-$bLen);
402
403			$blanks = t3lib_div::intInRange($tConf['blanks'],0,1000);
404			if ($blanks)	{$lines[]=str_pad('', $blanks-1, chr(10));}
405		}
406		return implode(chr(10),$lines);
407	}
408
409	/**
410	 * Formatting a table in plain text (based on the paradigm of lines being content rows and cells separated by "|")
411	 *
412	 * @param	string		Content string
413	 * @return	string		Processed value
414	 */
415	function breakTable($str)	{
416		$cParts = explode(chr(10),$str);
417		$lines=array();
418		$cols = intval($this->conf['cols']) ? intval($this->conf['cols']) : 0 ;
419		$c=0;
420		foreach ($cParts as $substrs) {
421			$c++;
422			if (trim($substrs))	{
423				$lineParts=explode('|',$substrs);
424				if (!$cols)	$cols=count($lineParts);
425
426				for ($a=0;$a<$cols;$a++)	{
427					$jdu = explode(chr(10),$this->breakLines($lineParts[$a],chr(10),ceil($this->charWidth/$cols)));
428					$lines[$c][$a]=$jdu;
429				}
430			}
431		}
432		$messure = $this->traverseTable($lines);
433
434
435		$divChar='-';
436		$joinChar='+';
437		$colChar='|';
438
439		// Make table:
440		$outLines = array();
441		$outLines[]=$this->addDiv($messure,'',$divChar,$joinChar,$cols);
442
443		foreach ($lines as $k => $v) {
444			$top = intval($messure[1][$k]);
445			for ($aa=0;$aa<$top;$aa++)	{
446				$tempArr=array();
447				for ($bb=0;$bb<$cols;$bb++)	{
448					$tempArr[$bb]=str_pad($v[$bb][$aa],$messure[0][$bb],' ');
449				}
450				$outLines[]=$colChar.implode($colChar,$tempArr).$colChar;
451			}
452			$outLines[]=$this->addDiv($messure,'',$divChar,$joinChar,$cols);
453		}
454		return implode(chr(10),$outLines);
455	}
456
457	/**
458	 * Subfunction for breakTable(): Adds a divider line between table rows.
459	 *
460	 * @param	array		Some information about sizes
461	 * @param	string		Empty string.
462	 * @param	string		Character to use for the divider line, typically "-"
463	 * @param	string		Join character, typically "+"
464	 * @param	integer		Number of table columns
465	 * @return	string		Divider line for the table
466	 * @access private
467	 * @see breakTable()
468	 */
469	function addDiv($messure,$content,$divChar,$joinChar,$cols)	{
470		$tempArr=array();
471		for ($a=0;$a<$cols;$a++)	{
472			$tempArr[$a]=str_pad($content,$messure[0][$a],$divChar);
473		}
474		return $joinChar.implode($joinChar,$tempArr).$joinChar;
475	}
476
477	/**
478	 * Traverses the table lines/cells and creates arrays with statistics for line numbers and lengths
479	 *
480	 * @param	array		Array with [table rows] [table cells] [lines in cell]
481	 * @return	array		Statistics (max lines/lengths)
482	 * @access private
483	 * @see breakTable()
484	 */
485	function traverseTable($tableLines)	{
486		$maxLen=array();
487		$maxLines=array();
488		foreach ($tableLines as $k => $v) {
489			foreach ($v as $kk => $vv) {
490				foreach ($vv as $lk => $lv) {
491					if (strlen($lv)>intval($maxLen[$kk]))	$maxLen[$kk]=strlen($lv);
492				}
493				if (count($vv)>intval($maxLines[$k]))	$maxLines[$k]=count($vv);
494			}
495		}
496		return array($maxLen,$maxLines);
497	}
498
499	/**
500	 * Render block of images - which means creating lines with links to the images.
501	 *
502	 * @param	string		List of image filenames (from "image" field in tt_content records)
503	 * @param	string		Link value from the "image_link" field in tt_content records
504	 * @param	string		Caption text
505	 * @param	string		Alternative relative path for the files listed in $str
506	 * @return	string		Content
507	 * @see getImages()
508	 */
509	function renderImages($str,$links,$caption,$upload_path='uploads/pics/')	{
510		$images = explode(',',$str);
511		$linksArr = explode(',',$links);
512		$lines=array();
513		if ($this->conf['images.']['header'])	{$lines[]=$this->getString($this->conf['images.']['header']);}
514		foreach ($images as $k => $file) {
515			$lines[]=$this->siteUrl.$upload_path.$file;
516			if ($links && count($linksArr)>1)	{
517				if (isset($linksArr[$k]))	{
518					$ll=$linksArr[$k];
519				} else {
520					$ll=$linksArr[0];
521				}
522
523				$theLink = $this->getLink($ll);
524				if ($theLink)	{$lines[]=$this->getString($this->conf['images.']['linkPrefix']).$theLink;}
525			}
526		}
527		if ($links && count($linksArr)==1)	{
528			$theLink = $this->getLink($links);
529			if ($theLink)	{$lines[]=$this->getString($this->conf['images.']['linkPrefix']).$theLink;}
530		}
531		if ($caption)	{
532			$lines[]='';
533			$cHeader = trim($this->getString($this->conf['images.']['captionHeader']));
534			if ($cHeader)		$lines[]=$cHeader;
535			$lines[]=$this->breakContent($caption);
536		}
537
538		return implode(chr(10),$lines);
539	}
540
541	/**
542	 * Returns a typolink URL based on input.
543	 *
544	 * @param	string		Parameter to typolink
545	 * @return	string		The URL returned from $this->cObj->getTypoLink_URL(); - possibly it prefixed with the URL of the site if not present already
546	 */
547	function getLink($ll)	{
548		$theLink=$this->cObj->getTypoLink_URL($ll);
549		if (substr($theLink,0,4)!='http')	{
550			$theLink=$this->siteUrl.$theLink;
551		}
552		return $theLink;
553	}
554
555	/**
556	 * Breaking lines into fixed length lines, using t3lib_div::breakLinesForEmail()
557	 *
558	 * @param	string		The string to break
559	 * @param	string		Line break character
560	 * @param	integer		Length of lines, default is $this->charWidth
561	 * @return	string		Processed string
562	 * @see t3lib_div::breakLinesForEmail()
563	 */
564	function breakLines($str,$implChar="\n",$charWidth=0)	{
565		return t3lib_div::breakLinesForEmail($str,$implChar,$charWidth?$charWidth:$this->charWidth);
566	}
567
568	/**
569	 * Explodes a string with "|" and if the second part is found it will return this, otherwise the first part.
570	 * Used for many TypoScript properties used in this class since they need preceeding whitespace to be preserved.
571	 *
572	 * @param	string		Input string
573	 * @return	string		Output string
574	 * @access private
575	 */
576	function getString($str)	{
577		$parts = explode('|',$str);
578		return strcmp($parts[1],'')?$parts[1]:$parts[0];
579	}
580
581	/**
582	 * Calls a user function for processing of data
583	 *
584	 * @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)
585	 * @param	mixed		Variable to process
586	 * @return	mixed		The processed $passVar as returned by the function call
587	 */
588	function userProcess($mConfKey,$passVar)	{
589		if ($this->conf[$mConfKey])	{
590			$funcConf = $this->conf[$mConfKey.'.'];
591			$funcConf['parentObj'] = $this;
592			$passVar = $GLOBALS['TSFE']->cObj->callUserFunction($this->conf[$mConfKey], $funcConf, $passVar);
593		}
594		return $passVar;
595	}
596
597	/**
598	 * Function used by TypoScript "parseFunc" to process links in the bodytext.
599	 * 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.
600	 *
601	 * @param	string		Empty, ignore.
602	 * @param	array		TypoScript parameters
603	 * @return	string		Processed output.
604	 * @see parseBody()
605	 */
606	function atag_to_http($content,$conf)	{
607		$this->conf = $conf;
608		$this->siteUrl=$conf['siteUrl'];
609		$theLink  = trim($this->cObj->parameters['href']);
610		if (strtolower(substr($theLink,0,7))=='mailto:')	{
611			$theLink=substr($theLink,7);
612		} elseif (substr($theLink,0,4)!='http')	{
613			$theLink=$this->siteUrl.$theLink;
614		}
615		return $this->cObj->getCurrentVal().' (Link: '.$theLink.' )';
616	}
617
618	/**
619	 * User function (called from TypoScript) for generating a bullet list (used in parsefunc)
620	 *
621	 * @param	string		Empty, ignore.
622	 * @param	array		TypoScript parameters
623	 * @return	string		Processed output.
624	 */
625	function typolist($content,$conf)	{
626		$this->conf = $this->cObj->mergeTSRef($conf,'bulletlist');
627		$this->siteUrl=$conf['siteUrl'];
628		$str = trim($this->cObj->getCurrentVal());
629		$this->cObj->data['layout'] = $this->cObj->parameters['type'];
630		return $this->breakBulletlist($str);
631	}
632
633	/**
634	 * User function (called from TypoScript) for generating a typo header tag (used in parsefunc)
635	 *
636	 * @param	string		Empty, ignore.
637	 * @param	array		TypoScript parameters
638	 * @return	string		Processed output.
639	 */
640	function typohead($content,$conf)	{
641		$this->conf = $this->cObj->mergeTSRef($conf,'header');
642
643		$this->siteUrl=$conf['siteUrl'];
644		$str = trim($this->cObj->getCurrentVal());
645		$this->cObj->data['header_layout'] = $this->cObj->parameters['type'];
646		$this->cObj->data['header_position'] = $this->cObj->parameters['align'];
647		$this->cObj->data['header']=$str;
648
649		return $this->getHeader();
650	}
651
652	/**
653	 * User function (called from TypoScript) for generating a code listing (used in parsefunc)
654	 *
655	 * @param	string		Empty, ignore.
656	 * @param	array		TypoScript parameters
657	 * @return	string		Processed output.
658	 */
659	function typocode($content,$conf)	{
660			// Nothing is really done here...
661		$this->conf = $conf;
662		$this->siteUrl=$conf['siteUrl'];
663		return $this->cObj->getCurrentVal();
664	}
665}
666
667
668
669
670if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['media/scripts/plaintextLib.inc'])	{
671	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['media/scripts/plaintextLib.inc']);
672}
673?>