Twig API
Class

Twig_Extension_Sandbox

class Twig_Extension_Sandbox extends Twig_Extension

Methods

initRuntime(Twig_Environment $environment)

Initializes the runtime environment.

from Twig_Extension
array getTokenParsers()

Returns the token parser instances to add to the existing list.

array getNodeVisitors()

Returns the node visitor instances to add to the existing list.

array getFilters()

Returns a list of filters to add to the existing list.

from Twig_Extension
array getTests()

Returns a list of tests to add to the existing list.

from Twig_Extension
array getFunctions()

Returns a list of functions to add to the existing list.

from Twig_Extension
array getOperators()

Returns a list of operators to add to the existing list.

from Twig_Extension
array getGlobals()

Returns a list of global functions to add to the existing list.

from Twig_Extension
__construct(Twig_Sandbox_SecurityPolicyInterface $policy, $sandboxed = false)

enableSandbox()

disableSandbox()

isSandboxed()

isSandboxedGlobally()

setSecurityPolicy(Twig_Sandbox_SecurityPolicyInterface $policy)

getSecurityPolicy()

checkSecurity($tags, $filters, $functions)

checkMethodAllowed($obj, $method)

checkPropertyAllowed($obj, $method)

ensureToStringAllowed($obj)

string getName()

Returns the name of the extension.

Details

in Twig_Extension at line 20
public initRuntime(Twig_Environment $environment)

Initializes the runtime environment.

This is where you can load some file that contains filter functions for instance.

Parameters

Twig_Environment $environment The current Twig_Environment instance

at line 28
public array getTokenParsers()

Returns the token parser instances to add to the existing list.

Return Value

array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances

at line 38
public array getNodeVisitors()

Returns the node visitor instances to add to the existing list.

Return Value

array An array of Twig_NodeVisitorInterface instances

in Twig_Extension at line 49
public array getFilters()

Returns a list of filters to add to the existing list.

Return Value

array An array of filters

in Twig_Extension at line 59
public array getTests()

Returns a list of tests to add to the existing list.

Return Value

array An array of tests

in Twig_Extension at line 69
public array getFunctions()

Returns a list of functions to add to the existing list.

Return Value

array An array of functions

in Twig_Extension at line 79
public array getOperators()

Returns a list of operators to add to the existing list.

Return Value

array An array of operators

in Twig_Extension at line 89
public array getGlobals()

Returns a list of global functions to add to the existing list.

Return Value

array An array of global functions

at line 17
public __construct(Twig_Sandbox_SecurityPolicyInterface $policy, $sandboxed = false)

Parameters

Twig_Sandbox_SecurityPolicyInterface $policy
$sandboxed

at line 43
public enableSandbox()

at line 48
public disableSandbox()

at line 53
public isSandboxed()

at line 58
public isSandboxedGlobally()

at line 63
public setSecurityPolicy(Twig_Sandbox_SecurityPolicyInterface $policy)

at line 68
public getSecurityPolicy()

at line 73
public checkSecurity($tags, $filters, $functions)

Parameters

$tags
$filters
$functions

at line 80
public checkMethodAllowed($obj, $method)

Parameters

$obj
$method

at line 87
public checkPropertyAllowed($obj, $method)

Parameters

$obj
$method

at line 94
public ensureToStringAllowed($obj)

Parameters

$obj

at line 108
public string getName()

Returns the name of the extension.

Return Value

string The extension name