HumHub Documentation (unofficial)

EscaperExtension extends AbstractExtension
in package

FinalYes

Table of Contents

Properties

$defaultStrategy  : mixed
$environment  : mixed
$escaper  : mixed
$escapers  : mixed

Methods

__construct()  : mixed
addSafeClass()  : mixed
getDefaultStrategy()  : string|false
Gets the default strategy to use when not defined by the user.
getEscapers()  : mixed
Gets all defined escapers.
getFilters()  : array<string|int, TwigFilter>
Returns a list of filters to add to the existing list.
getFunctions()  : array<string|int, TwigFunction>
Returns a list of functions to add to the existing list.
getNodeVisitors()  : array<string|int, NodeVisitorInterface>
Returns the node visitor instances to add to the existing list.
getOperators()  : array<string|int, array<string|int, mixed>>
Returns a list of operators to add to the existing list.
getTests()  : array<string|int, TwigTest>
Returns a list of tests to add to the existing list.
getTokenParsers()  : array<string|int, TokenParserInterface>
Returns the token parser instances to add to the existing list.
setDefaultStrategy()  : void
Sets the default strategy to use when not defined by the user.
setEnvironment()  : void
setEscaper()  : mixed
Defines a new escaper to be used via the escape filter.
setEscaperRuntime()  : mixed
setSafeClasses()  : mixed

Properties

Methods

__construct()

public __construct([string|false|callable $defaultStrategy = 'html' ]) : mixed
Parameters
$defaultStrategy : string|false|callable = 'html'

An escaping strategy

Tags
see
setDefaultStrategy()

addSafeClass()

public addSafeClass(string $class, array<string|int, mixed> $strategies) : mixed
Parameters
$class : string
$strategies : array<string|int, mixed>
Tags
deprecated

since Twig 3.10

getDefaultStrategy()

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

public getDefaultStrategy(string $name) : string|false
Parameters
$name : string

The template name

Return values
string|false

The default strategy to use for the template

getEscapers()

Gets all defined escapers.

public getEscapers() : mixed
Tags
@return

array<callable(Environment, string, string)> An array of escapers

deprecated

since Twig 3.10

getOperators()

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

public getOperators() : array<string|int, array<string|int, mixed>>
Return values
array<string|int, array<string|int, mixed>>

First array of unary operators, second array of binary operators

setDefaultStrategy()

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

public setDefaultStrategy(string|false|callable(string $templateName): string $defaultStrategy) : void

The strategy can be a valid PHP callback that takes the template name as an argument and returns the strategy to use.

Parameters
$defaultStrategy : string|false|callable(string $templateName): string

An escaping strategy

setEnvironment()

public setEnvironment(Environment $environment[, bool $triggerDeprecation = true ]) : void
Parameters
$environment : Environment
$triggerDeprecation : bool = true
Tags
deprecated

since Twig 3.10

setEscaper()

Defines a new escaper to be used via the escape filter.

public setEscaper(string $strategy, callable $callable) : mixed
Parameters
$strategy : string

The strategy name that should be used as a strategy in the escape call

$callable : callable

A valid PHP callable

Tags
deprecated

since Twig 3.10

setSafeClasses()

public setSafeClasses([array<string|int, mixed> $safeClasses = [] ]) : mixed
Parameters
$safeClasses : array<string|int, mixed> = []
Tags
deprecated

since Twig 3.10


        
On this page

Search results