-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
59 lines (57 loc) · 2.33 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
55
56
57
58
59
<?php
use Kirby\Cms\App;
App::plugin('femundfilou/kirby-accessibility-check', [
'options' => [
'enabled' => false
],
'hooks' => [
'page.render:after' => function (string $contentType, array $data, string $html, Kirby\Cms\Page $page) {
if ($contentType === 'html') {
$snippet = snippet('accessibility-check/accessibility-check', [], true);
$html = str_replace('</head>', $snippet, $html) . '</head>';
}
return $html;
}
],
'api' => [
'routes' => [
[
'pattern' => 'accessibility-check/status',
'method' => 'GET',
'action' => function () {
$session = kirby()->session();
$current = $session->get('accessibility-check-enabled', false);
return ['status' => 'success', 'mode' => $current];
}
],
[
'pattern' => 'accessibility-check/toggle',
'method' => 'POST',
'action' => function () {
$session = kirby()->session();
$current = $session->get('accessibility-check-enabled', false);
$session->set('accessibility-check-enabled', !$current);
return ['status' => 'success', 'mode' => !$current];
}
]
]
],
'snippets' => [
'accessibility-check/accessibility-check' => __DIR__ . '/snippets/accessibility-check.php',
'accessibility-check/providers/sa11y' => __DIR__ . '/snippets/providers/sa11y.php'
],
'translations' => [
'en' => [
"femundfilou.accessibility-check.buttons.enable" => "Enable",
"femundfilou.accessibility-check.buttons.disable" => "Disable",
"femundfilou.accessibility-check.buttons.open" => "Open",
"femundfilou.accessibility-check.buttons.toggle" => "Check accessibility"
],
'de' => [
"femundfilou.accessibility-check.buttons.enable" => "Aktivieren",
"femundfilou.accessibility-check.buttons.disable" => "Deaktivieren",
"femundfilou.accessibility-check.buttons.open" => "Öffnen",
"femundfilou.accessibility-check.buttons.toggle" => "Barrierefreiheit prüfen"
]
]
]);