PEEL Shopping
Open source ecommerce : PEEL Shopping
Escaper.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of Twig.
5  *
6  * (c) 2009 Fabien Potencier
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
12 {
13  protected $defaultStrategy;
14 
15  public function __construct($defaultStrategy = 'html')
16  {
18  }
19 
25  public function getTokenParsers()
26  {
27  return array(new Twig_TokenParser_AutoEscape());
28  }
29 
35  public function getNodeVisitors()
36  {
37  return array(new Twig_NodeVisitor_Escaper());
38  }
39 
45  public function getFilters()
46  {
47  return array(
48  new Twig_SimpleFilter('raw', 'twig_raw_filter', array('is_safe' => array('all'))),
49  );
50  }
51 
61  {
62  // for BC
63  if (true === $defaultStrategy) {
64  $defaultStrategy = 'html';
65  }
66 
67  $this->defaultStrategy = $defaultStrategy;
68  }
69 
77  public function getDefaultStrategy($filename)
78  {
79  // disable string callables to avoid calling a function named html or js,
80  // or any other upcoming escaping strategy
81  if (!is_string($this->defaultStrategy) && is_callable($this->defaultStrategy)) {
82  return call_user_func($this->defaultStrategy, $filename);
83  }
84 
86  }
87 
93  public function getName()
94  {
95  return 'escaper';
96  }
97 }
98 
104 function twig_raw_filter($string)
105 {
106  return $string;
107 }
setDefaultStrategy($defaultStrategy)
Sets the default strategy to use when not defined by the user.
Definition: Escaper.php:60
getDefaultStrategy($filename)
Gets the default strategy to use when not defined by the user.
Definition: Escaper.php:77
getName()
Returns the name of the extension.
Definition: Escaper.php:93
Marks a section of a template to be escaped or not.
Definition: AutoEscape.php:30
getFilters()
Returns a list of filters to add to the existing list.
Definition: Escaper.php:45
getTokenParsers()
Returns the token parser instances to add to the existing list.
Definition: Escaper.php:25
__construct($defaultStrategy= 'html')
Definition: Escaper.php:15
getNodeVisitors()
Returns the node visitor instances to add to the existing list.
Definition: Escaper.php:35
Twig_NodeVisitor_Escaper implements output escaping.
Definition: Escaper.php:17
$filename
Represents a template filter.
twig_raw_filter($string)
Marks a variable as being safe.
Definition: Escaper.php:104

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:18 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.