|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of TwigView. |
|
5
|
|
|
* |
|
6
|
|
|
** (c) 2014 Cees-Jan Kiewiet |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
namespace WyriHaximus\TwigView\Lib\Twig\Extension; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Class Basic |
|
15
|
|
|
* @package WyriHaximus\TwigView\Lib\Twig\Extension |
|
16
|
|
|
*/ |
|
17
|
|
|
class Basic extends \Twig_Extension |
|
18
|
|
|
{ |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Get declared filters. |
|
22
|
|
|
* |
|
23
|
|
|
* @return \Twig_SimpleFilter[] |
|
24
|
|
|
*/ |
|
25
|
4 |
|
public function getFilters() |
|
26
|
|
|
{ |
|
27
|
|
|
return [ |
|
28
|
4 |
|
new \Twig_SimpleFilter('debug', 'debug'), |
|
29
|
4 |
|
new \Twig_SimpleFilter('pr', 'pr'), |
|
30
|
4 |
|
new \Twig_SimpleFilter('low', 'low'), |
|
31
|
4 |
|
new \Twig_SimpleFilter('up', 'up'), |
|
32
|
4 |
|
new \Twig_SimpleFilter('env', 'env'), |
|
33
|
4 |
|
new \Twig_SimpleFilter('count', 'count'), |
|
34
|
4 |
|
new \Twig_SimpleFilter('h', 'h'), |
|
35
|
4 |
|
new \Twig_SimpleFilter('null', function () { |
|
36
|
|
|
return ''; |
|
37
|
4 |
|
}), |
|
38
|
4 |
|
]; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Get declared functions. |
|
43
|
|
|
* |
|
44
|
|
|
* @return \Twig_SimpleFunction[] |
|
45
|
|
|
*/ |
|
46
|
1 |
|
public function getFunctions() |
|
47
|
|
|
{ |
|
48
|
|
|
return [ |
|
49
|
1 |
|
new \Twig_SimpleFunction('config', 'Cake\Core\Configure::read'), |
|
50
|
1 |
|
]; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Get extension name. |
|
55
|
|
|
* |
|
56
|
|
|
* @return string |
|
57
|
|
|
*/ |
|
58
|
1 |
|
public function getName() |
|
59
|
|
|
{ |
|
60
|
1 |
|
return 'basic'; |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|