summaryrefslogtreecommitdiff
path: root/inc/lib/Twig/Filter.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/lib/Twig/Filter.php')
-rw-r--r--inc/lib/Twig/Filter.php31
1 files changed, 27 insertions, 4 deletions
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 <fabien@symfony.com>
+ * Use Twig_SimpleFilter instead.
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ * @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'];
+ }
}