Dynamic copyright

This commit is contained in:
2018-01-01 13:07:14 +01:00
parent 8580307459
commit 95e0ff6178
4 changed files with 22 additions and 3 deletions
+19
View File
@@ -0,0 +1,19 @@
<?php
/**
* copyright Kirbytag
*
* Usage: (copyright: <Copyright begin year>)
*/
kirby()->set('tag', 'copyright', [
'html' => function($tag) {
$begin = $tag->attr('copyright');
$current = date('Y');
if($begin === $current) {
return $current;
} else {
return $begin . '–' . $current;
}
}
]);