You are here

protected function Twig_NodeVisitor_Escaper::isSafeFor in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php \Twig_NodeVisitor_Escaper::isSafeFor()
2 calls to Twig_NodeVisitor_Escaper::isSafeFor()
Twig_NodeVisitor_Escaper::escapePrintNode in vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php
Twig_NodeVisitor_Escaper::preEscapeFilterNode in vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php

File

vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php, line 114

Class

Twig_NodeVisitor_Escaper
Twig_NodeVisitor_Escaper implements output escaping.

Code

protected function isSafeFor($type, Twig_NodeInterface $expression, $env) {
  $safe = $this->safeAnalysis
    ->getSafe($expression);
  if (null === $safe) {
    if (null === $this->traverser) {
      $this->traverser = new Twig_NodeTraverser($env, array(
        $this->safeAnalysis,
      ));
    }
    $this->safeAnalysis
      ->setSafeVars($this->safeVars);
    $this->traverser
      ->traverse($expression);
    $safe = $this->safeAnalysis
      ->getSafe($expression);
  }
  return in_array($type, $safe) || in_array('all', $safe);
}