Twig API
Class

Twig_Extension_Escaper

class Twig_Extension_Escaper 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.

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 variables to add to the existing list.

from Twig_Extension
__construct($defaultStrategy = 'html')

setDefaultStrategy(mixed $defaultStrategy)

Sets the default strategy to use when not defined by the user.

string getDefaultStrategy(string $filename)

Gets the default strategy to use when not defined by the user.

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 25
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 35
public array getNodeVisitors()

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

Return Value

array An array of Twig_NodeVisitorInterface instances

at line 45
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 variables to add to the existing list.

Return Value

array An array of global variables

at line 15
public __construct($defaultStrategy = 'html')

Parameters

$defaultStrategy

at line 60
public setDefaultStrategy(mixed $defaultStrategy)

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.

Parameters

mixed $defaultStrategy An escaping strategy

at line 77
public string getDefaultStrategy(string $filename)

Gets the default strategy to use when not defined by the user.

Parameters

string $filename The template "filename"

Return Value

string The default strategy to use for the template

at line 93
public string getName()

Returns the name of the extension.

Return Value

string The extension name