18282910dbacf40da57a247b469fba8fd9d4a0b1
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Classes / ViewHelpers / Format / RawViewHelper.php
1 <?php
2 namespace TYPO3\CMS\Fluid\ViewHelpers\Format;
3
4 /* *
5 * This script is backported from the TYPO3 Flow package "TYPO3.Fluid". *
6 * *
7 * It is free software; you can redistribute it and/or modify it under *
8 * the terms of the GNU Lesser General Public License, either version 3 *
9 * of the License, or (at your option) any later version. *
10 * *
11 * The TYPO3 project - inspiring people to share! *
12 * */
13 /**
14 * Outputs an argument/value without any escaping. Is normally used to output
15 * an ObjectAccessor which should not be escaped, but output as-is.
16 *
17 * PAY SPECIAL ATTENTION TO SECURITY HERE (especially Cross Site Scripting),
18 * as the output is NOT SANITIZED!
19 *
20 * = Examples =
21 *
22 * <code title="Child nodes">
23 * <f:format.raw>{string}</f:format.raw>
24 * </code>
25 * <output>
26 * (Content of {string} without any conversion/escaping)
27 * </output>
28 *
29 * <code title="Value attribute">
30 * <f:format.raw value="{string}" />
31 * </code>
32 * <output>
33 * (Content of {string} without any conversion/escaping)
34 * </output>
35 *
36 * <code title="Inline notation">
37 * {string -> f:format.raw()}
38 * </code>
39 * <output>
40 * (Content of {string} without any conversion/escaping)
41 * </output>
42 *
43 * @api
44 */
45 class RawViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
46
47 /**
48 * Disable the escaping interceptor because otherwise the child nodes would be escaped before this view helper
49 * can decode the text's entities.
50 *
51 * @var boolean
52 */
53 protected $escapingInterceptorEnabled = FALSE;
54
55 /**
56 * @param mixed $value The value to output
57 * @return string
58 */
59 public function render($value = NULL) {
60 if ($value === NULL) {
61 return $this->renderChildren();
62 } else {
63 return $value;
64 }
65 }
66 }
67
68 ?>