[-TASK] Fluid: Removed @package/@subpackage annotations from all Fluid classes. They...
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Classes / ViewHelpers / Format / HtmlViewHelper.php
1 <?php
2
3 /* *
4 * This script is part of the TYPO3 project - inspiring people to share! *
5 * *
6 * TYPO3 is free software; you can redistribute it and/or modify it under *
7 * the terms of the GNU General Public License version 2 as published by *
8 * the Free Software Foundation. *
9 * *
10 * This script is distributed in the hope that it will be useful, but *
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
12 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
13 * Public License for more details. *
14 * */
15
16 /**
17 */
18
19 /**
20 * Renders a string by passing it to a TYPO3 parseFunc.
21 * You can either specify a path to the TypoScript setting or set the parseFunc options directly.
22 * By default lib.parseFunc_RTE is used to parse the string.
23 *
24 * Example:
25 *
26 * (1) default parameters:
27 * <f:format.html>foo <b>bar</b>. Some <LINK 1>link</LINK>.</f:format.html>
28 *
29 * Result:
30 * <p class="bodytext">foo <b>bar</b>. Some <a href="index.php?id=1" >link</a>.</p>
31 * (depending on your TYPO3 setup)
32 *
33 * (2) custom parseFunc
34 * <f:format.html parseFuncTSPath="lib.parseFunc">foo <b>bar</b>. Some <LINK 1>link</LINK>.</f:format.html>
35 *
36 * Output:
37 * foo <b>bar</b>. Some <a href="index.php?id=1" >link</a>.
38 *
39 * @see http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/1/5/#id4198758
40 *
41 */
42 class Tx_Fluid_ViewHelpers_Format_HtmlViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
43
44 /**
45 * @var tslib_cObj
46 */
47 protected $contentObject;
48
49 /**
50 * If the escaping interceptor should be disabled inside this ViewHelper, then set this value to FALSE.
51 * This is internal and NO part of the API. It is very likely to change.
52 *
53 * @var boolean
54 * @internal
55 */
56 protected $escapingInterceptorEnabled = FALSE;
57
58 /**
59 * Constructor. Used to create an instance of tslib_cObj used by the render() method.
60 * @param tslib_cObj $contentObject injector for tslib_cObj (optional)
61 * @return void
62 */
63 public function __construct($contentObject = NULL) {
64 $this->contentObject = $contentObject !== NULL ? $contentObject : t3lib_div::makeInstance('tslib_cObj');
65 }
66
67 /**
68 * @param string $parseFuncTSPath path to TypoScript parseFunc setup.
69 * @return the parsed string.
70 * @author Bastian Waidelich <bastian@typo3.org>
71 * @author Niels Pardon <mail@niels-pardon.de>
72 */
73 public function render($parseFuncTSPath = 'lib.parseFunc_RTE') {
74 $value = $this->renderChildren();
75 return $this->contentObject->parseFunc($value, array(), '< ' . $parseFuncTSPath);
76 }
77 }
78
79 ?>