[TASK] Sync CMS Fluid with Flow Fluid 1.1 (part1)
[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 /**
15 * Outputs an argument/value without any escaping. Is normally used to output
16 * an ObjectAccessor which should not be escaped, but output as-is.
17 *
18 * PAY SPECIAL ATTENTION TO SECURITY HERE (especially Cross Site Scripting),
19 * as the output is NOT SANITIZED!
20 *
21 * = Examples =
22 *
23 * <code title="Child nodes">
24 * <f:format.raw>{string}</f:format.raw>
25 * </code>
26 * <output>
27 * (Content of {string} without any conversion/escaping)
28 * </output>
29 *
30 * <code title="Value attribute">
31 * <f:format.raw value="{string}" />
32 * </code>
33 * <output>
34 * (Content of {string} without any conversion/escaping)
35 * </output>
36 *
37 * <code title="Inline notation">
38 * {string -> f:format.raw()}
39 * </code>
40 * <output>
41 * (Content of {string} without any conversion/escaping)
42 * </output>
43 *
44 * @api
45 */
46 class RawViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
47
48 /**
49 * Disable the escaping interceptor because otherwise the child nodes would be escaped before this view helper
50 * can decode the text's entities.
51 *
52 * @var boolean
53 */
54 protected $escapingInterceptorEnabled = FALSE;
55
56 /**
57 * @param mixed $value The value to output
58 * @return string
59 */
60 public function render($value = NULL) {
61 if ($value === NULL) {
62 return $this->renderChildren();
63 } else {
64 return $value;
65 }
66 }
67 }
68
69 ?>