1 | <?php |
||
14 | final class DummyPlugin extends AbstractPicoPlugin |
||
15 | { |
||
16 | /** |
||
17 | * This plugin is enabled by default? |
||
18 | * |
||
19 | * @see AbstractPicoPlugin::$enabled |
||
20 | * @var boolean |
||
21 | */ |
||
22 | protected $enabled = false; |
||
23 | |||
24 | /** |
||
25 | * This plugin depends on ... |
||
26 | * |
||
27 | * @see AbstractPicoPlugin::$dependsOn |
||
28 | * @var string[] |
||
29 | */ |
||
30 | protected $dependsOn = array(); |
||
31 | |||
32 | /** |
||
33 | * Triggered after Pico has loaded all available plugins |
||
34 | * |
||
35 | * This event is triggered nevertheless the plugin is enabled or not. |
||
36 | * It is NOT guaranteed that plugin dependencies are fulfilled! |
||
37 | * |
||
38 | * @see Pico::getPlugin() |
||
39 | * @see Pico::getPlugins() |
||
40 | * @param object[] &$plugins loaded plugin instances |
||
41 | * @return void |
||
42 | */ |
||
43 | public function onPluginsLoaded(array &$plugins) |
||
47 | |||
48 | /** |
||
49 | * Triggered after Pico has read its configuration |
||
50 | * |
||
51 | * @see Pico::getConfig() |
||
52 | * @param array &$config array of config variables |
||
53 | * @return void |
||
54 | */ |
||
55 | public function onConfigLoaded(array &$config) |
||
59 | |||
60 | /** |
||
61 | * Triggered after Pico has evaluated the request URL |
||
62 | * |
||
63 | * @see Pico::getRequestUrl() |
||
64 | * @param string &$url part of the URL describing the requested contents |
||
65 | * @return void |
||
66 | */ |
||
67 | public function onRequestUrl(&$url) |
||
71 | |||
72 | /** |
||
73 | * Triggered after Pico has discovered the content file to serve |
||
74 | * |
||
75 | * @see Pico::getBaseUrl() |
||
76 | * @see Pico::getRequestFile() |
||
77 | * @param string &$file absolute path to the content file to serve |
||
78 | * @return void |
||
79 | */ |
||
80 | public function onRequestFile(&$file) |
||
84 | |||
85 | /** |
||
86 | * Triggered before Pico reads the contents of the file to serve |
||
87 | * |
||
88 | * @see Pico::loadFileContent() |
||
89 | * @see DummyPlugin::onContentLoaded() |
||
90 | * @param string &$file path to the file which contents will be read |
||
91 | * @return void |
||
92 | */ |
||
93 | public function onContentLoading(&$file) |
||
97 | |||
98 | /** |
||
99 | * Triggered after Pico has read the contents of the file to serve |
||
100 | * |
||
101 | * @see Pico::getRawContent() |
||
102 | * @param string &$rawContent raw file contents |
||
103 | * @return void |
||
104 | */ |
||
105 | public function onContentLoaded(&$rawContent) |
||
109 | |||
110 | /** |
||
111 | * Triggered before Pico reads the contents of a 404 file |
||
112 | * |
||
113 | * @see Pico::load404Content() |
||
114 | * @see DummyPlugin::on404ContentLoaded() |
||
115 | * @param string &$file path to the file which contents were requested |
||
116 | * @return void |
||
117 | */ |
||
118 | public function on404ContentLoading(&$file) |
||
122 | |||
123 | /** |
||
124 | * Triggered after Pico has read the contents of the 404 file |
||
125 | * |
||
126 | * @see Pico::getRawContent() |
||
127 | * @param string &$rawContent raw file contents |
||
128 | * @return void |
||
129 | */ |
||
130 | public function on404ContentLoaded(&$rawContent) |
||
134 | |||
135 | /** |
||
136 | * Triggered when Pico reads its known meta header fields |
||
137 | * |
||
138 | * @see Pico::getMetaHeaders() |
||
139 | * @param string[] &$headers list of known meta header |
||
140 | * fields; the array value specifies the YAML key to search for, the |
||
141 | * array key is later used to access the found value |
||
142 | * @return void |
||
143 | */ |
||
144 | public function onMetaHeaders(array &$headers) |
||
148 | |||
149 | /** |
||
150 | * Triggered before Pico parses the meta header |
||
151 | * |
||
152 | * @see Pico::parseFileMeta() |
||
153 | * @see DummyPlugin::onMetaParsed() |
||
154 | * @param string &$rawContent raw file contents |
||
155 | * @param string[] &$headers known meta header fields |
||
156 | * @return void |
||
157 | */ |
||
158 | public function onMetaParsing(&$rawContent, array &$headers) |
||
162 | |||
163 | /** |
||
164 | * Triggered after Pico has parsed the meta header |
||
165 | * |
||
166 | * @see Pico::getFileMeta() |
||
167 | * @param string[] &$meta parsed meta data |
||
168 | * @return void |
||
169 | */ |
||
170 | public function onMetaParsed(array &$meta) |
||
174 | |||
175 | /** |
||
176 | * Triggered before Pico parses the pages content |
||
177 | * |
||
178 | * @see Pico::prepareFileContent() |
||
179 | * @see DummyPlugin::prepareFileContent() |
||
180 | * @see DummyPlugin::onContentParsed() |
||
181 | * @param string &$rawContent raw file contents |
||
182 | * @return void |
||
183 | */ |
||
184 | public function onContentParsing(&$rawContent) |
||
188 | |||
189 | /** |
||
190 | * Triggered after Pico has prepared the raw file contents for parsing |
||
191 | * |
||
192 | * @see Pico::parseFileContent() |
||
193 | * @see DummyPlugin::onContentParsed() |
||
194 | * @param string &$content prepared file contents for parsing |
||
195 | * @return void |
||
196 | */ |
||
197 | public function onContentPrepared(&$content) |
||
201 | |||
202 | /** |
||
203 | * Triggered after Pico has parsed the contents of the file to serve |
||
204 | * |
||
205 | * @see Pico::getFileContent() |
||
206 | * @param string &$content parsed contents |
||
207 | * @return void |
||
208 | */ |
||
209 | public function onContentParsed(&$content) |
||
213 | |||
214 | /** |
||
215 | * Triggered before Pico reads all known pages |
||
216 | * |
||
217 | * @see Pico::readPages() |
||
218 | * @see DummyPlugin::onSinglePageLoaded() |
||
219 | * @see DummyPlugin::onPagesLoaded() |
||
220 | * @return void |
||
221 | */ |
||
222 | public function onPagesLoading() |
||
226 | |||
227 | /** |
||
228 | * Triggered when Pico reads a single page from the list of all known pages |
||
229 | * |
||
230 | * The `$pageData` parameter consists of the following values: |
||
231 | * |
||
232 | * | Array key | Type | Description | |
||
233 | * | -------------- | ------ | ---------------------------------------- | |
||
234 | * | id | string | relative path to the content file | |
||
235 | * | url | string | URL to the page | |
||
236 | * | title | string | title of the page (YAML header) | |
||
237 | * | description | string | description of the page (YAML header) | |
||
238 | * | author | string | author of the page (YAML header) | |
||
239 | * | time | string | timestamp derived from the Date header | |
||
240 | * | date | string | date of the page (YAML header) | |
||
241 | * | date_formatted | string | formatted date of the page | |
||
242 | * | raw_content | string | raw, not yet parsed contents of the page | |
||
243 | * | meta | string | parsed meta data of the page | |
||
244 | * |
||
245 | * @see DummyPlugin::onPagesLoaded() |
||
246 | * @param array &$pageData data of the loaded page |
||
247 | * @return void |
||
248 | */ |
||
249 | public function onSinglePageLoaded(array &$pageData) |
||
253 | |||
254 | /** |
||
255 | * Triggered after Pico has read all known pages |
||
256 | * |
||
257 | * See {@link DummyPlugin::onSinglePageLoaded()} for details about the |
||
258 | * structure of the page data. |
||
259 | * |
||
260 | * @see Pico::getPages() |
||
261 | * @see Pico::getCurrentPage() |
||
262 | * @see Pico::getPreviousPage() |
||
263 | * @see Pico::getNextPage() |
||
264 | * @param array[] &$pages data of all known pages |
||
265 | * @param array|null &$currentPage data of the page being served |
||
266 | * @param array|null &$previousPage data of the previous page |
||
267 | * @param array|null &$nextPage data of the next page |
||
268 | * @return void |
||
269 | */ |
||
270 | public function onPagesLoaded( |
||
278 | |||
279 | /** |
||
280 | * Triggered before Pico registers the twig template engine |
||
281 | * |
||
282 | * @return void |
||
283 | */ |
||
284 | public function onTwigRegistration() |
||
288 | |||
289 | /** |
||
290 | * Triggered before Pico renders the page |
||
291 | * |
||
292 | * @see Pico::getTwig() |
||
293 | * @see DummyPlugin::onPageRendered() |
||
294 | * @param Twig_Environment &$twig twig template engine |
||
295 | * @param array &$twigVariables template variables |
||
296 | * @param string &$templateName file name of the template |
||
297 | * @return void |
||
298 | */ |
||
299 | public function onPageRendering(Twig_Environment &$twig, array &$twigVariables, &$templateName) |
||
303 | |||
304 | /** |
||
305 | * Triggered after Pico has rendered the page |
||
306 | * |
||
307 | * @param string &$output contents which will be sent to the user |
||
308 | * @return void |
||
309 | */ |
||
310 | public function onPageRendered(&$output) |
||
314 | } |
||
315 |