DummyPlugin   A
last analyzed

Complexity

Total Complexity 20

Size/Duplication

Total Lines 301
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1
Metric Value
wmc 20
lcom 0
cbo 1
dl 0
loc 301
rs 10

20 Methods

Rating   Name   Duplication   Size   Complexity  
A onPluginsLoaded() 0 4 1
A onConfigLoaded() 0 4 1
A onRequestUrl() 0 4 1
A onRequestFile() 0 4 1
A onContentLoading() 0 4 1
A onContentLoaded() 0 4 1
A on404ContentLoading() 0 4 1
A on404ContentLoaded() 0 4 1
A onMetaHeaders() 0 4 1
A onMetaParsing() 0 4 1
A onMetaParsed() 0 4 1
A onContentParsing() 0 4 1
A onContentPrepared() 0 4 1
A onContentParsed() 0 4 1
A onPagesLoading() 0 4 1
A onSinglePageLoaded() 0 4 1
A onPagesLoaded() 0 8 1
A onTwigRegistration() 0 4 1
A onPageRendering() 0 4 1
A onPageRendered() 0 4 1
1
<?php
2
3
/**
4
 * Pico dummy plugin - a template for plugins
5
 *
6
 * You're a plugin developer? This template may be helpful :-)
7
 * Simply remove the events you don't need and add your own logic.
8
 *
9
 * @author  Daniel Rudolf
10
 * @link    http://picocms.org
11
 * @license http://opensource.org/licenses/MIT
12
 * @version 1.0
13
 */
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)
44
    {
45
        // your code
46
    }
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)
56
    {
57
        // your code
58
    }
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)
68
    {
69
        // your code
70
    }
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)
81
    {
82
        // your code
83
    }
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)
94
    {
95
        // your code
96
    }
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)
106
    {
107
        // your code
108
    }
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)
119
    {
120
        // your code
121
    }
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)
131
    {
132
        // your code
133
    }
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)
145
    {
146
        // your code
147
    }
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)
159
    {
160
        // your code
161
    }
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)
171
    {
172
        // your code
173
    }
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)
185
    {
186
        // your code
187
    }
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)
198
    {
199
        // your code
200
    }
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)
210
    {
211
        // your code
212
    }
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()
223
    {
224
        // your code
225
    }
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)
250
    {
251
        // your code
252
    }
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(
271
        array &$pages,
272
        array &$currentPage = null,
273
        array &$previousPage = null,
274
        array &$nextPage = null
275
    ) {
276
        // your code
277
    }
278
279
    /**
280
     * Triggered before Pico registers the twig template engine
281
     *
282
     * @return void
283
     */
284
    public function onTwigRegistration()
285
    {
286
        // your code
287
    }
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)
300
    {
301
        // your code
302
    }
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)
311
    {
312
        // your code
313
    }
314
}
315