blob: c0622b145bc1a26b393efd18a19d88d8185249d7 (
plain) (
blame)
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
|
<?php
declare(strict_types=1);
final class UserCSSExtension extends Minz_Extension {
public string $css_rules = '';
private const FILENAME = 'style.css';
#[\Override]
public function init(): void {
parent::init();
$this->registerTranslates();
if ($this->hasFile(self::FILENAME)) {
Minz_View::appendStyle($this->getFileUrl(self::FILENAME, 'css', false));
}
}
#[\Override]
public function handleConfigureAction(): void {
parent::init();
$this->registerTranslates();
if (Minz_Request::isPost()) {
$css_rules = Minz_Request::paramString('css-rules', plaintext: true);
$this->saveFile(self::FILENAME, $css_rules);
}
$this->css_rules = '';
if ($this->hasFile(self::FILENAME)) {
$this->css_rules = htmlspecialchars($this->getFile(self::FILENAME) ?? '', ENT_NOQUOTES, 'UTF-8');
}
}
}
|