-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.php
40 lines (35 loc) · 1.22 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
<?php
use Kirby\Cms\App;
use Kirby\Data\Json;
use Kirby\Filesystem\F;
use Kirby\Toolkit\Str;
use Michnhokn\CookieBanner;
F::loadClasses(['Michnhokn\CookieBanner' => __DIR__ . '/CookieBanner.php']);
try {
$germanTranslations = Json::read(__DIR__ . "/translations/de.json");
$englishTranslations = Json::read(__DIR__ . "/translations/en.json");
// support for use without option "languages => true"
$cookieBannerTranslations = [];
foreach ($germanTranslations as $key => $translation) {
$cookieBannerTranslations[Str::replace($key, 'michnhokn.cookie-banner.', '')] = $translation;
}
} catch (Exception $exception) {
}
App::plugin('michnhokn/cookie-banner', [
'snippets' => [
'cookie-modal' => __DIR__ . '/snippets/cookie-modal.php',
'cookie-modal-option' => __DIR__ . '/snippets/cookie-modal-option.php',
],
'translations' => [
'de' => $germanTranslations ?? [],
'en' => $englishTranslations ?? []
],
'options' => [
'features' => [],
'translations' => $cookieBannerTranslations ?? []
],
'assets' => [
'cookie-banner.js' => CookieBanner::realAsset('js'),
'cookie-banner.css' => CookieBanner::realAsset('css'),
]
]);