f84bcaec01
I wanted to ensure that all pages (even the downtime page, terms page, home page, etc) had the appropriate `data-` attributes on `<body>` (because those are required for certain javascript, eg autocomplete, to work). One thing led to another and now everything in `head` is microhtml'ed
34 lines
919 B
PHP
34 lines
919 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Shimmie2;
|
|
|
|
use function MicroHTML\LINK;
|
|
|
|
class Holiday extends Extension
|
|
{
|
|
public function onInitExt(InitExtEvent $event): void
|
|
{
|
|
global $config;
|
|
$config->set_default_bool("holiday_aprilfools", false);
|
|
}
|
|
|
|
public function onSetupBuilding(SetupBuildingEvent $event): void
|
|
{
|
|
$sb = $event->panel->create_new_block("Holiday Theme");
|
|
$sb->add_bool_option("holiday_aprilfools", "Enable April Fools");
|
|
}
|
|
|
|
public function onPageRequest(PageRequestEvent $event): void
|
|
{
|
|
global $config, $page;
|
|
if (date('d/m') == '01/04' && $config->get_bool("holiday_aprilfools")) {
|
|
$page->add_html_header(LINK([
|
|
'rel' => 'stylesheet',
|
|
'href' => get_base_href() . '/ext/holiday/stylesheets/aprilfools.css',
|
|
'type' => 'text/css'
|
|
]));
|
|
}
|
|
}
|
|
}
|