From: fabien Date: Tue, 15 Dec 2009 07:21:46 +0000 (+0000) Subject: made the escaper filter configurable in the Escaper node transformer X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=2deb490a4011ba083e3f7ea6bcb4d239716d2228;p=web%2Fkonrad%2Ftwig.git made the escaper filter configurable in the Escaper node transformer git-svn-id: http://svn.twig-project.org/trunk@187 93ef8e89-cb99-4229-a87c-7fa0fa45744b --- diff --git a/lib/Twig/NodeTransformer/Escaper.php b/lib/Twig/NodeTransformer/Escaper.php index 3943186..9fbcd27 100644 --- a/lib/Twig/NodeTransformer/Escaper.php +++ b/lib/Twig/NodeTransformer/Escaper.php @@ -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()); + } }