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