TYPO3 CMS  TYPO3_6-2
Escape.php
Go to the documentation of this file.
1 <?php
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 
18 
24  protected $interceptorEnabled = TRUE;
25 
33 
38  protected $objectManager;
39 
49  public function process(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\NodeInterface $node, $interceptorPosition, \TYPO3\CMS\Fluid\Core\Parser\ParsingState $parsingState) {
50  if ($interceptorPosition === \TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_OPENING_VIEWHELPER) {
51  if (!$node->getUninitializedViewHelper()->isEscapingInterceptorEnabled()) {
52  $this->interceptorEnabled = FALSE;
53  $this->viewHelperNodesWhichDisableTheInterceptor[] = $node;
54  }
55  } elseif ($interceptorPosition === \TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_CLOSING_VIEWHELPER) {
56  if (end($this->viewHelperNodesWhichDisableTheInterceptor) === $node) {
57  array_pop($this->viewHelperNodesWhichDisableTheInterceptor);
58  if (count($this->viewHelperNodesWhichDisableTheInterceptor) === 0) {
59  $this->interceptorEnabled = TRUE;
60  }
61  }
62  } elseif ($this->interceptorEnabled && $node instanceof \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode) {
63  $escapeViewHelper = $this->objectManager->get('TYPO3\\CMS\\Fluid\\ViewHelpers\\Format\\HtmlspecialcharsViewHelper');
64  $node = $this->objectManager->get(
65  'TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode',
66  $escapeViewHelper,
67  array('value' => $node)
68  );
69  }
70  return $node;
71  }
72 
78  public function getInterceptionPoints() {
79  return array(
83  );
84  }
85 }
process(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\NodeInterface $node, $interceptorPosition, \TYPO3\CMS\Fluid\Core\Parser\ParsingState $parsingState)
Definition: Escape.php:49