1 | <?php |
||
8 | class FileExtension extends \Twig_Extension |
||
9 | { |
||
10 | /** |
||
11 | * @return string |
||
12 | */ |
||
13 | public function getName() |
||
14 | { |
||
15 | return 'application/file'; |
||
16 | } |
||
17 | |||
18 | /** |
||
19 | * @return \Twig_SimpleFunction[] |
||
20 | */ |
||
21 | public function getFunctions() |
||
22 | { |
||
23 | return array( |
||
24 | new \Twig_SimpleFunction( |
||
25 | 'file_contents', |
||
26 | array( |
||
27 | $this, |
||
28 | 'fileContents', |
||
29 | ), |
||
30 | array( |
||
31 | 'is_safe' => array('html'), |
||
32 | ) |
||
33 | ), |
||
34 | ); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @return string|false |
||
39 | */ |
||
40 | public function fileContents($path) |
||
50 | } |
||
51 |