38 $this->allowedTags =
$tags;
43 $this->allowedFilters = $filters;
48 $this->allowedMethods =
array();
49 foreach ($methods as $class =>
$m) {
50 $this->allowedMethods[$class] = array_map(
'strtolower', is_array(
$m) ?
$m :
array(
$m));
56 $this->allowedProperties = $properties;
61 $this->allowedFunctions = $functions;
67 if (!in_array($tag, $this->allowedTags)) {
72 foreach ($filters as $filter) {
73 if (!in_array($filter, $this->allowedFilters)) {
79 if (!in_array($function, $this->allowedFunctions)) {
92 $method = strtolower($method);
93 foreach ($this->allowedMethods as $class => $methods) {
94 if ($obj instanceof $class) {
95 $allowed = in_array($method, $methods);
102 $class = get_class($obj);
110 foreach ($this->allowedProperties as $class => $properties) {
111 if ($obj instanceof $class) {
112 $allowed = in_array($property, is_array($properties) ? $properties :
array($properties));
119 $class = get_class($obj);
125 class_alias(
'Twig_Sandbox_SecurityPolicy',
'Twig\Sandbox\SecurityPolicy',
false);
Interface implemented by all compiled templates.
setAllowedFilters(array $filters)
checkMethodAllowed($obj, $method)
Exception thrown when a not allowed class method is used in a template.
Interfaces that all security policy classes must implements.
__construct(array $allowedTags=array(), array $allowedFilters=array(), array $allowedMethods=array(), array $allowedProperties=array(), array $allowedFunctions=array())
checkPropertyAllowed($obj, $property)
Exception thrown when a not allowed function is used in a template.
Exception thrown when a not allowed tag is used in a template.
Create styles array
The data for the language used.
checkSecurity($tags, $filters, $functions)
setAllowedProperties(array $properties)
setAllowedFunctions(array $functions)
Represents a security policy which need to be enforced when sandbox mode is enabled.
setAllowedMethods(array $methods)
setAllowedTags(array $tags)
Exception thrown when a not allowed class property is used in a template.
Exception thrown when a not allowed filter is used in a template.
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag