/** * @test */ public function testAddEscapingInterceptor() { $interceptor = new Escape(); $configuration = new Configuration(); $configuration->addEscapingInterceptor($interceptor); $interceptors = $configuration->getEscapingInterceptors(InterceptorInterface::INTERCEPT_OBJECTACCESSOR); $this->assertContains($interceptor, $interceptors); }
/** * Call all interceptors registered for a given interception point. * * @param NodeInterface $node The syntax tree node which can be modified by the interceptors. * @param integer $interceptionPoint the interception point. One of the \TYPO3Fluid\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_* constants. * @param ParsingState $state the parsing state * @return void */ protected function callInterceptor(NodeInterface &$node, $interceptionPoint, ParsingState $state) { if ($this->configuration === NULL) { return; } if ($this->escapingEnabled) { /** @var $interceptor InterceptorInterface */ foreach ($this->configuration->getEscapingInterceptors($interceptionPoint) as $interceptor) { $node = $interceptor->process($node, $interceptionPoint, $state); } } /** @var $interceptor InterceptorInterface */ foreach ($this->configuration->getInterceptors($interceptionPoint) as $interceptor) { $node = $interceptor->process($node, $interceptionPoint, $state); } }
/** * Build parser configuration * * @return Configuration */ protected function buildParserConfiguration() { $parserConfiguration = new Configuration(); $escapeInterceptor = new Escape(); $parserConfiguration->addEscapingInterceptor($escapeInterceptor); return $parserConfiguration; }