mit Versionsstempel. */ public static function script(string $path, string $base = '', bool $defer = false): string { return ''; } /** * Theme-Bootstrap: gespeicherte Auswahl, sonst Systemeinstellung. * Muss im
stehen, damit nichts hell aufblitzt. */ public static function themeScript(): string { return ''; } /** Gueltige Hex-Farbe oder Fallback. */ private static function color(?string $value, string $fallback): string { $value = trim((string)$value); return preg_match('/^#[0-9a-fA-F]{6}$/', $value) ? strtolower($value) : $fallback; } /** * CSS-Overrides fuer die Markenfarben. Gibt einen leeren String zurueck, * wenn nichts vom Standard abweicht. */ public static function brandingStyle($db = null): string { if (!$db) { return ''; } $accent = self::color($db->getSetting('brand_accent', ''), self::DEFAULT_ACCENT); $accentDark = self::color($db->getSetting('brand_accent_dark', ''), self::DEFAULT_ACCENT_DARK); $from = self::color($db->getSetting('brand_gradient_from', ''), self::DEFAULT_GRADIENT_FROM); $to = self::color($db->getSetting('brand_gradient_to', ''), self::DEFAULT_GRADIENT_TO); $radius = (int)$db->getSetting('brand_radius', (string)self::DEFAULT_RADIUS); $radius = max(0, min(28, $radius)); $isDefault = $accent === self::DEFAULT_ACCENT && $accentDark === self::DEFAULT_ACCENT_DARK && $from === self::DEFAULT_GRADIENT_FROM && $to === self::DEFAULT_GRADIENT_TO && $radius === self::DEFAULT_RADIUS; if ($isDefault) { return ''; } // Abgeleitete Töne über color-mix – so genügt eine einzige Grundfarbe. return ''; } /** * Kleines Formular für eine verändernde Aktion. * * Löschen und Umschalten liefen früher über Links mit CSRF-Token in der * URL – das landet in Server-Logs, Referer-Headern und der Chronik. * Deshalb POST, auch wenn es im Markup etwas mehr ist. * * @param string $action Name des Submit-Feldes (z. B. 'delete_site') * @param array $fields weitere versteckte Felder, z. B. ['site_id' => 4] * @param string $inner Inhalt des Knopfes (HTML) */ public static function actionForm( string $action, array $fields, string $csrf, string $inner, string $class = 'btn btn-secondary btn-sm', string $confirm = '', string $title = '' ): string { $esc = static fn ($text) => htmlspecialchars((string)$text, ENT_QUOTES); $hidden = ''; foreach ($fields as $name => $value) { $hidden .= ''; } $attr = ''; if ($confirm !== '') { $attr = ' onsubmit="return confirm(\'' . str_replace("'", "\\'", $confirm) . '\');"'; } $titleAttr = $title !== '' ? ' title="' . $esc($title) . '" aria-label="' . $esc($title) . '"' : ''; return ''; } /** * Bildfeld mit Vorschau, Upload und URL-Eingabe. * Wird von den Einstellungen und der Kiosk-Verwaltung genutzt. */ public static function imageField( string $name, string $label, ?string $value, string $hint = '', string $accept = 'image/*', string $base = '../' ): string { $value = (string)$value; $preview = self::mediaUrl($value, $base); $esc = static fn ($text) => htmlspecialchars((string)$text, ENT_QUOTES); $t = static fn ($key, $fallback) => function_exists('__') ? __($key) : $fallback; $thumb = $preview !== '' ? '' . $prefix . htmlspecialchars($label) . ' ' . '' . self::CREDIT_NAME . '
'; } /** Lizenz der Anwendung selbst (siehe LICENSE im Wurzelverzeichnis). */ public const LICENSE = 'MIT'; public const REPOSITORY_URL = 'https://git.loheide.cloud/friloo/Unifi-Voucher-Tool'; public const LICENSE_URL = self::REPOSITORY_URL . '/src/branch/main/LICENSE'; /** * Mitgelieferte Komponenten Dritter – dieselbe Liste wie in * THIRD-PARTY-NOTICES.md, nur maschinenlesbar fuer die Uebersicht in der * Administration. 'license_file' zeigt auf den ausgelieferten Lizenztext; * ein Test stellt sicher, dass die Dateien wirklich vorhanden sind. * * @return array