From 0fe552857468aa12097a74e08f51f5aaa983be07 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Thu, 1 Aug 2013 15:20:12 -0400 Subject: Upgrade Twig library --- inc/lib/Twig/Filter.php | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'inc/lib/Twig/Filter.php') diff --git a/inc/lib/Twig/Filter.php b/inc/lib/Twig/Filter.php index 9595a1a8..5cfbb662 100644 --- a/inc/lib/Twig/Filter.php +++ b/inc/lib/Twig/Filter.php @@ -12,12 +12,15 @@ /** * Represents a template filter. * - * @package twig - * @author Fabien Potencier + * Use Twig_SimpleFilter instead. + * + * @author Fabien Potencier + * @deprecated since 1.12 (to be removed in 2.0) */ -abstract class Twig_Filter implements Twig_FilterInterface +abstract class Twig_Filter implements Twig_FilterInterface, Twig_FilterCallableInterface { protected $options; + protected $arguments = array(); public function __construct(array $options = array()) { @@ -25,9 +28,21 @@ abstract class Twig_Filter implements Twig_FilterInterface 'needs_environment' => false, 'needs_context' => false, 'pre_escape' => null, + 'preserves_safety' => null, + 'callable' => null, ), $options); } + public function setArguments($arguments) + { + $this->arguments = $arguments; + } + + public function getArguments() + { + return $this->arguments; + } + public function needsEnvironment() { return $this->options['needs_environment']; @@ -47,12 +62,20 @@ abstract class Twig_Filter implements Twig_FilterInterface if (isset($this->options['is_safe_callback'])) { return call_user_func($this->options['is_safe_callback'], $filterArgs); } + } - return array(); + public function getPreservesSafety() + { + return $this->options['preserves_safety']; } public function getPreEscape() { return $this->options['pre_escape']; } + + public function getCallable() + { + return $this->options['callable']; + } } -- cgit v1.3