From 4f5b44bd3bd490309eb2ba7b44df4769816ba729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sat, 3 Aug 2013 19:26:54 +0200 Subject: twig implementation --- inc/3rdparty/Twig/Extension/Escaper.php | 107 -------------------------------- 1 file changed, 107 deletions(-) delete mode 100644 inc/3rdparty/Twig/Extension/Escaper.php (limited to 'inc/3rdparty/Twig/Extension/Escaper.php') diff --git a/inc/3rdparty/Twig/Extension/Escaper.php b/inc/3rdparty/Twig/Extension/Escaper.php deleted file mode 100644 index c9a7f68e..00000000 --- a/inc/3rdparty/Twig/Extension/Escaper.php +++ /dev/null @@ -1,107 +0,0 @@ -setDefaultStrategy($defaultStrategy); - } - - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - public function getTokenParsers() - { - return array(new Twig_TokenParser_AutoEscape()); - } - - /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances - */ - public function getNodeVisitors() - { - return array(new Twig_NodeVisitor_Escaper()); - } - - /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters - */ - public function getFilters() - { - return array( - new Twig_SimpleFilter('raw', 'twig_raw_filter', array('is_safe' => array('all'))), - ); - } - - /** - * Sets the default strategy to use when not defined by the user. - * - * The strategy can be a valid PHP callback that takes the template - * "filename" as an argument and returns the strategy to use. - * - * @param mixed $defaultStrategy An escaping strategy - */ - public function setDefaultStrategy($defaultStrategy) - { - // for BC - if (true === $defaultStrategy) { - $defaultStrategy = 'html'; - } - - $this->defaultStrategy = $defaultStrategy; - } - - /** - * Gets the default strategy to use when not defined by the user. - * - * @param string $filename The template "filename" - * - * @return string The default strategy to use for the template - */ - public function getDefaultStrategy($filename) - { - // disable string callables to avoid calling a function named html or js, - // or any other upcoming escaping strategy - if (!is_string($this->defaultStrategy) && is_callable($this->defaultStrategy)) { - return call_user_func($this->defaultStrategy, $filename); - } - - return $this->defaultStrategy; - } - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName() - { - return 'escaper'; - } -} - -/** - * Marks a variable as being safe. - * - * @param string $string A PHP variable - */ -function twig_raw_filter($string) -{ - return $string; -} -- cgit v1.2.3