-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathboot.php
More file actions
53 lines (46 loc) · 2.14 KB
/
boot.php
File metadata and controls
53 lines (46 loc) · 2.14 KB
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
<?php
use FriendsOfREDAXO\Maintenance\Maintenance;
/**
* This file is part of the maintenance package.
*
* @author (c) Friends Of REDAXO
* @author <friendsof@redaxo.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
// stop if Setup is active
if (rex::isSetup()) {
return;
}
rex_extension::register('PACKAGES_INCLUDED', static function () {
$addon = rex_addon::get('maintenance');
// Check domain-based maintenance or global frontend maintenance
$domainInMaintenance = false;
if (rex::isFrontend() && rex_addon::exists('yrewrite') && rex_addon::get('yrewrite')->isAvailable()) {
$domainInMaintenance = Maintenance::isDomainInMaintenance();
}
if (rex::isFrontend() && ((bool) $addon->getConfig('block_frontend') || $domainInMaintenance)) {
Maintenance::checkFrontend();
}
if (rex::isBackend() && (bool) $addon->getConfig('block_backend')) {
Maintenance::checkBackend();
}
if (rex::isBackend()) {
Maintenance::setIndicators();
rex_view::addJsFile($addon->getAssetsUrl('dist/bootstrap-tokenfield.js'));
rex_view::addJsFile($addon->getAssetsUrl('dist/init_bootstrap-tokenfield.js'));
rex_view::addCssFile($addon->getAssetsUrl('dist/css/bootstrap-tokenfield.css'));
rex_view::addCssFile($addon->getAssetsUrl('css/maintenance.css'));
rex_view::addCssFile($addon->getAssetsUrl('css/maintenance-icons.css'));
if ('maintenance/frontend' === rex_be_controller::getCurrentPage()
|| 'maintenance/frontend/index' === rex_be_controller::getCurrentPage()
|| 'maintenance/frontend/announcement' === rex_be_controller::getCurrentPage()) {
rex_extension::register('OUTPUT_FILTER', static function (rex_extension_point $ep) {
$suchmuster = 'class="###maintenance-settings-editor###"';
$ersetzen = (string) rex_config::get('maintenance', 'editor'); // @phpstan-ignore-line
$ep->setSubject(str_replace($suchmuster, $ersetzen, $ep->getSubject())); // @phpstan-ignore-line
});
}
}
});