2020-01-26 13:19:35 +00:00
|
|
|
<?php declare(strict_types=1);
|
2019-08-07 14:53:59 -05:00
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
class Holiday extends Extension
|
|
|
|
{
|
2020-02-04 00:46:36 +00:00
|
|
|
/** @var HolidayTheme */
|
2021-03-14 23:43:50 +00:00
|
|
|
protected ?Themelet $theme;
|
2020-02-04 00:46:36 +00:00
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
public function onInitExt(InitExtEvent $event)
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
$config->set_default_bool("holiday_aprilfools", false);
|
|
|
|
}
|
2012-01-18 09:55:00 +00:00
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
public function onSetupBuilding(SetupBuildingEvent $event)
|
|
|
|
{
|
2020-10-26 10:13:28 -05:00
|
|
|
$sb = $event->panel->create_new_block("Holiday Theme");
|
2019-05-28 17:59:38 +01:00
|
|
|
$sb->add_bool_option("holiday_aprilfools", "Enable April Fools");
|
|
|
|
}
|
2012-01-18 09:55:00 +00:00
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
public function onPageRequest(PageRequestEvent $event)
|
|
|
|
{
|
|
|
|
global $config;
|
2021-03-14 23:43:50 +00:00
|
|
|
if (date('d/m') == '01/04' && $config->get_bool("holiday_aprilfools")) {
|
|
|
|
$this->theme->display_holiday("aprilfools");
|
2019-05-28 17:59:38 +01:00
|
|
|
}
|
|
|
|
}
|
2012-01-18 09:55:00 +00:00
|
|
|
}
|