1 | <?php |
||
29 | class Base { |
||
30 | private $template; // The template |
||
31 | private $vars; // Vars |
||
32 | |||
33 | /** @var \OCP\IL10N */ |
||
34 | private $l10n; |
||
35 | |||
36 | /** @var \OC_Defaults */ |
||
37 | private $theme; |
||
38 | |||
39 | /** |
||
40 | * @param string $template |
||
41 | * @param string $requestToken |
||
42 | * @param \OCP\IL10N $l10n |
||
43 | * @param \OC_Defaults $theme |
||
44 | */ |
||
45 | public function __construct($template, $requestToken, $l10n, $theme ) { |
||
52 | |||
53 | /** |
||
54 | * @param string $serverRoot |
||
55 | * @param string|false $app_dir |
||
56 | * @param string $theme |
||
57 | * @param string $app |
||
58 | * @return string[] |
||
59 | */ |
||
60 | protected function getAppTemplateDirs($theme, $app, $serverRoot, $app_dir) { |
||
73 | |||
74 | /** |
||
75 | * @param string $serverRoot |
||
76 | * @param string $theme |
||
77 | * @return string[] |
||
78 | */ |
||
79 | protected function getCoreTemplateDirs($theme, $serverRoot) { |
||
85 | |||
86 | /** |
||
87 | * Assign variables |
||
88 | * @param string $key key |
||
89 | * @param array|bool|integer|string $value value |
||
90 | * @return bool |
||
91 | * |
||
92 | * This function assigns a variable. It can be accessed via $_[$key] in |
||
93 | * the template. |
||
94 | * |
||
95 | * If the key existed before, it will be overwritten |
||
96 | */ |
||
97 | public function assign( $key, $value) { |
||
101 | |||
102 | /** |
||
103 | * Appends a variable |
||
104 | * @param string $key key |
||
105 | * @param mixed $value value |
||
106 | * @return boolean|null |
||
107 | * |
||
108 | * This function assigns a variable in an array context. If the key already |
||
109 | * exists, the value will be appended. It can be accessed via |
||
110 | * $_[$key][$position] in the template. |
||
111 | */ |
||
112 | public function append( $key, $value ) { |
||
120 | |||
121 | /** |
||
122 | * Prints the proceeded template |
||
123 | * @return bool |
||
124 | * |
||
125 | * This function proceeds the template and prints its output. |
||
126 | */ |
||
127 | public function printPage() { |
||
137 | |||
138 | /** |
||
139 | * Process the template |
||
140 | * |
||
141 | * @param array|null $additionalParams |
||
142 | * @return string This function processes the template. |
||
143 | * |
||
144 | * This function processes the template. |
||
145 | */ |
||
146 | public function fetchPage($additionalParams = null) { |
||
149 | |||
150 | /** |
||
151 | * doing the actual work |
||
152 | * |
||
153 | * @param string $file |
||
154 | * @param array|null $additionalParams |
||
155 | * @return string content |
||
156 | * |
||
157 | * Includes the template file, fetches its output |
||
158 | */ |
||
159 | protected function load($file, $additionalParams = null) { |
||
183 | |||
184 | } |
||
185 |
If you suppress an error, we recommend checking for the error condition explicitly: