Skip to content

Commit

Permalink
Update Maintenance.php
Browse files Browse the repository at this point in the history
  • Loading branch information
skerbis authored Nov 12, 2024
1 parent ad8bb75 commit 65f792e
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions lib/Maintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@
*/
class Maintenance
{
/** @var rex_addon */
private static rex_addon $addon;
/** @var rex_addon|null */
private static ?rex_addon $addon = null;

static {
self::$addon = rex_addon::get('maintenance');
/**
* Gets the addon instance
*/
private static function addon(): rex_addon
{
if (self::$addon === null) {
self::$addon = rex_addon::get('maintenance');
}
return self::$addon;
}

/**
Expand Down Expand Up @@ -256,20 +263,20 @@ public static function checkBackend(): void
*/
public static function setIndicators(): void
{
$page = self::$addon->getProperty('page');
$page = self::addon()->getProperty('page');

if (self::getBoolConfig('block_backend', false)) {
$page['title'] .= ' <span class="label label-info pull-right">B</span>';
$page['icon'] .= ' fa-toggle-on block_backend';
self::$addon->setProperty('page', $page);
self::addon()->setProperty('page', $page);
}

if (self::getBoolConfig('block_frontend', false)) {
$page['title'] .= ' <span class="label label-danger pull-right">F</span>';
$page['icon'] .= ' fa-toggle-on block_frontend';
}

self::$addon->setProperty('page', $page);
self::addon()->setProperty('page', $page);
}

/**
Expand Down Expand Up @@ -310,7 +317,7 @@ public static function getAnnouncement(): string
*/
private static function getConfig(string $key, mixed $default = null): mixed
{
return self::$addon->getConfig($key, $default);
return self::addon()->getConfig($key, $default);
}

/**
Expand Down

0 comments on commit 65f792e

Please sign in to comment.