-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
54 lines (46 loc) · 1.18 KB
/
index.php
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
51
52
53
54
<?php
//namespace scottboms\kirbytag-kbd;
/**
* Kirby kbd KirbyTag
*
* @author Scott Boms <[email protected]>
* @link https://github.com/scottboms/kirbytag-kbd
* @license MIT
**/
use Kirby\Sane\Html;
Kirby\Sane\Html::$allowedTags['kbd'] = ['class'];
use Composer\Semver\Semver;
use Kirby\Cms\App as Kirby;
// validate Kirby version
if (Semver::satisfies(Kirby::version() ?? '0.0.0', '~4.0 || ~5.0') === false) {
throw new Exception('HTML5 Video Tag requires Kirby 4 or 5');
}
Kirby::plugin(
name: 'scottboms/kirbytag-kbd',
info: [
'homepage' => 'https://github.com/scottboms/kirbytag-kbd'
],
version: '1.1.0',
extends: [
'tags' => [
'kbd' => [
'attr' => [
'class',
],
'html' => function($tag) {
$html = '';
// Variables to hold tag options
$kbd_string = $tag->kbd;
$class = $tag->class;
if($class == '') {
// If no class attribute, output the <kbd></kbd>
$html .= '<kbd>' . $kbd_string . '</kbd>';
} else {
$html .= '<kbd class="' . $class . '">' . $kbd_string . '</kbd>';
}
return $html;
}
]
]
]
);