made the escaper filter configurable in the Escaper node transformer
authorfabien <fabien@93ef8e89-cb99-4229-a87c-7fa0fa45744b>
Tue, 15 Dec 2009 07:21:46 +0000 (07:21 +0000)
committerfabien <fabien@93ef8e89-cb99-4229-a87c-7fa0fa45744b>
Tue, 15 Dec 2009 07:21:46 +0000 (07:21 +0000)
git-svn-id: http://svn.twig-project.org/trunk@187 93ef8e89-cb99-4229-a87c-7fa0fa45744b

lib/Twig/NodeTransformer/Escaper.php

index 3943186..9fbcd27 100644 (file)
@@ -83,20 +83,20 @@ class Twig_NodeTransformer_Escaper extends Twig_NodeTransformer
       }
 
       $expression->setFilters($filters);
-      $expression->prependFilter(array('escape', array()));
+      $expression->prependFilter($this->getEscaperFilter());
 
       return $node;
     }
     elseif ($node instanceof Twig_Node_Print)
     {
       return new Twig_Node_Print(
-        new Twig_Node_Expression_Filter($expression, array(array('escape', array())), $node->getLine())
+        new Twig_Node_Expression_Filter($expression, array($this->getEscaperFilter()), $node->getLine())
         , $node->getLine()
       );
     }
     else
     {
-      return new Twig_Node_Expression_Filter($node, array(array('escape', array())), $node->getLine());
+      return new Twig_Node_Expression_Filter($node, array($this->getEscaperFilter()), $node->getLine());
     }
   }
 
@@ -111,4 +111,9 @@ class Twig_NodeTransformer_Escaper extends Twig_NodeTransformer
       return $this->env->hasExtension('escaper') ? $this->env->getExtension('escaper')->isGlobal() : false;
     }
   }
+
+  protected function getEscaperFilter()
+  {
+    return array('escape', array());
+  }
 }