-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVersionPlugin.php
More file actions
50 lines (47 loc) · 1.24 KB
/
VersionPlugin.php
File metadata and controls
50 lines (47 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* This file is part of Pico. It's copyrighted by the contributors recorded
* in the version control history of the file, available from the following
* original location:
*
* <https://github.com/hermannmarkus/Pico-VersionPlugin/blob/master/VersionPlugin.php>
*
* SPDX-License-Identifier: MIT
* License-Filename: LICENSE
*/
/**
* Pico Version Plugin
*
* The plugin provides a twig filter to include the Pico Version into a template.
* Used for the <meta name="generator" content="Pico"> tag.
*
* @author Markus Hermann
* @link http://picocms.org
* @license http://opensource.org/licenses/MIT The MIT License
* @version 1.0
*/
class VersionPlugin extends AbstractPicoPlugin
{
/**
* API version used by this plugin
*
* @var int
*/
const API_VERSION = 2;
/**
* Triggered when Pico registers the twig template engine
*
* @see Pico::getTwig()
*
* @param Twig_Environment &$twig Twig instance
*
* @return void
*/
public function onTwigRegistered(Twig_Environment &$twig)
{
$versionFilter = new \Twig\TwigFilter('PicoVersion', function ($string) {
return $this->getPico()::VERSION;
});
$twig->addFilter($versionFilter);
}
}