-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·41 lines (34 loc) · 1.09 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
<?php
@include_once __DIR__ . '/vendor/autoload.php';
Kirby::plugin('genxbe/k3x-cli-tools', [
'options' => [
'maintenance' => true,
],
'snippets' => [
'maintenance' => __DIR__ . '/snippets/maintenance.php',
],
'commands' => array_merge(
/** Kirby Commands **/
X\Commands\KirbyCommands\RootsCommand::render(),
X\Commands\KirbyCommands\DownCommand::render(),
X\Commands\KirbyCommands\UpCommand::render(),
/** Plugin Commands **/
X\Commands\PluginCommands\ListCommand::render(),
X\Commands\PluginCommands\DeleteCommand::render(),
X\Commands\PluginCommands\PublishCommand::render(),
),
'hooks' => [
'route:after' => function($route, $path, $method) {
if (kirby()->option('genxbe.k3x-cli-tools.maintenance') === true) {
$rootFolder = getcwd();
$panelUrl = option('panel.slug') ?? 'panel';
if(!kirby()->user() && Str::position(Url::current(),$panelUrl) === false && file_exists($rootFolder.'/.maintenance'))
{
$email = file_get_contents($rootFolder.'/.maintenance');
snippet('maintenance', compact('email'));
die();
}
}
},
],
]);