1 | <?php |
||
21 | class Loader implements \Twig_LoaderInterface |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * Get the file contents of a template. |
||
26 | * |
||
27 | * @param string $name Template. |
||
28 | * |
||
29 | * @return string |
||
30 | */ |
||
31 | 4 | public function getSource($name) |
|
32 | { |
||
33 | 4 | $name = $this->resolveFileName($name); |
|
34 | 3 | return file_get_contents($name); |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * Get cache key for template. |
||
39 | * |
||
40 | * @param string $name Template. |
||
41 | * |
||
42 | * @return string |
||
43 | */ |
||
44 | 5 | public function getCacheKey($name) |
|
48 | |||
49 | /** |
||
50 | * Check if template is still fresh. |
||
51 | * |
||
52 | * @param string $name Template. |
||
53 | * @param integer $time Timestamp. |
||
54 | * |
||
55 | * @return boolean |
||
56 | */ |
||
57 | 2 | public function isFresh($name, $time) |
|
62 | |||
63 | /** |
||
64 | * Resolve template name to filename. |
||
65 | * |
||
66 | * @param string $name Template. |
||
67 | * |
||
68 | * @return string |
||
69 | * |
||
70 | * @throws \Twig_Error_Loader Thrown when template file isn't found. |
||
71 | */ |
||
72 | // @codingStandardsIgnoreStart |
||
73 | 9 | protected function resolveFileName($name) |
|
101 | |||
102 | /** |
||
103 | * Check if $plugin is active and return it's template paths or return the aps template paths. |
||
104 | * |
||
105 | * @param string|null $plugin The plugin in question. |
||
106 | * |
||
107 | * @return array |
||
108 | */ |
||
109 | 6 | protected function getPaths($plugin) |
|
117 | } |
||
118 |