ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
FileExtensionEscapingStrategy.php
Go to the documentation of this file.
1
<?
php
2
3
/*
4
* This file is part of Twig.
5
*
6
* (c) 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
*/
11
23
class
Twig_FileExtensionEscapingStrategy
24
{
32
public
static
function
guess
(
$name
)
33
{
34
if
(in_array(substr(
$name
, -1), array(
'/'
,
'\\'
))) {
35
return
'html'
;
// return html for directories
36
}
37
38
if
(
'.twig'
=== substr(
$name
, -5)) {
39
$name
= substr(
$name
, 0, -5);
40
}
41
42
$extension = pathinfo(
$name
, PATHINFO_EXTENSION);
43
44
switch
($extension) {
45
case
'js'
:
46
return
'js'
;
47
48
case
'css'
:
49
return
'css'
;
50
51
case
'txt'
:
52
return
false
;
53
54
default
:
55
return
'html'
;
56
}
57
}
58
}
59
60
class_alias(
'Twig_FileExtensionEscapingStrategy'
,
'Twig\FileExtensionEscapingStrategy'
,
false
);
php
An exception for terminatinating execution or to throw for unit testing.
Twig_FileExtensionEscapingStrategy
Default autoescaping strategy based on file names.
Definition:
FileExtensionEscapingStrategy.php:24
Twig_FileExtensionEscapingStrategy\guess
static guess($name)
Guesses the best autoescaping strategy based on the file name.
Definition:
FileExtensionEscapingStrategy.php:32
$name
$name
Definition:
client_example.php:35
libs
composer
vendor
twig
twig
lib
Twig
FileExtensionEscapingStrategy.php
Generated on Thu Oct 2 2025 19:01:21 for ILIAS by
1.9.4 (using
Doxyfile
)