up
This commit is contained in:
@@ -1,10 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
// partials/structure/header.php
|
// partials/structure/header.php
|
||||||
|
|
||||||
// Aktuelle Domain + Protokoll
|
// Aktuelle Basis-URL der laufenden Instanz (staging, prod, etc.)
|
||||||
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
$baseUrl = app_current_base_url();
|
||||||
$host = $_SERVER['HTTP_HOST'] ?? app_primary_domain();
|
|
||||||
$baseUrl = $scheme . '://' . $host;
|
|
||||||
|
|
||||||
// Aktueller Page-Key (z.B. 'landing', 'fakecheck', 'dashboard')
|
// Aktueller Page-Key (z.B. 'landing', 'fakecheck', 'dashboard')
|
||||||
$pageKey = $GLOBALS['pageKey'] ?? null;
|
$pageKey = $GLOBALS['pageKey'] ?? null;
|
||||||
@@ -84,7 +82,7 @@ $currentLangLabel = $currentLangInfo['label'] ?? $currentLangCode;
|
|||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
// Helper: URL mit anderem ?lang=.. bauen
|
// Helper: URL mit anderem ?lang=.. bauen
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
$currentPath = strtok($_SERVER['REQUEST_URI'] ?? '/', '?');
|
$currentPath = app_current_path();
|
||||||
$currentQuery = $_GET ?? [];
|
$currentQuery = $_GET ?? [];
|
||||||
|
|
||||||
function build_lang_url(string $code, string $path, array $query): string
|
function build_lang_url(string $code, string $path, array $query): string
|
||||||
@@ -97,7 +95,6 @@ function build_lang_url(string $code, string $path, array $query): string
|
|||||||
<header class="sticky top-0 z-40 border-b border-brand-border/70 backdrop-blur bg-brand-bg/85">
|
<header class="sticky top-0 z-40 border-b border-brand-border/70 backdrop-blur bg-brand-bg/85">
|
||||||
<div class="mx-auto max-w-6xl px-4 sm:px-6 lg:px-8 flex items-center justify-between min-h-16 py-2">
|
<div class="mx-auto max-w-6xl px-4 sm:px-6 lg:px-8 flex items-center justify-between min-h-16 py-2">
|
||||||
|
|
||||||
|
|
||||||
<!-- Logo -->
|
<!-- Logo -->
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-3">
|
||||||
<a href="<?= htmlspecialchars(build_lang_url($currentLang, '/', [])) ?>" class="flex items-center gap-3">
|
<a href="<?= htmlspecialchars(build_lang_url($currentLang, '/', [])) ?>" class="flex items-center gap-3">
|
||||||
@@ -120,11 +117,8 @@ function build_lang_url(string $code, string $path, array $query): string
|
|||||||
<div class="flex items-center gap-6">
|
<div class="flex items-center gap-6">
|
||||||
|
|
||||||
<!-- Hauptnavigation -->
|
<!-- Hauptnavigation -->
|
||||||
<!-- Hauptnavigation -->
|
|
||||||
<?php if (!empty($navAnchors)): ?>
|
<?php if (!empty($navAnchors)): ?>
|
||||||
|
|
||||||
<nav class="flex flex-wrap items-center gap-x-4 gap-y-1 sm:gap-x-6 text-xs font-medium text-brand-muted uppercase tracking-[0.18em]">
|
<nav class="flex flex-wrap items-center gap-x-4 gap-y-1 sm:gap-x-6 text-xs font-medium text-brand-muted uppercase tracking-[0.18em]">
|
||||||
|
|
||||||
<?php foreach ($navAnchors as $item): ?>
|
<?php foreach ($navAnchors as $item): ?>
|
||||||
<?php
|
<?php
|
||||||
$href = $item['href'] ?? '#';
|
$href = $item['href'] ?? '#';
|
||||||
@@ -141,7 +135,6 @@ function build_lang_url(string $code, string $path, array $query): string
|
|||||||
</nav>
|
</nav>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
<!-- Language Switcher -->
|
<!-- Language Switcher -->
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<button id="langCurrent"
|
<button id="langCurrent"
|
||||||
|
|||||||
@@ -3,11 +3,9 @@
|
|||||||
|
|
||||||
// Erwartet (vor require):
|
// Erwartet (vor require):
|
||||||
// - $pageKey (string) – Seiten-Key für i18n, z. B. 'landing', 'fakecheck', 'login', 'dashboard'
|
// - $pageKey (string) – Seiten-Key für i18n, z. B. 'landing', 'fakecheck', 'login', 'dashboard'
|
||||||
// - $lang (2-letter ISO, z. B. 'de', 'en', 'it', 'fr'), möglichst bereits aus fileload.php
|
|
||||||
// - optional: $pageTitle (string)
|
// - optional: $pageTitle (string)
|
||||||
// - optional: $pageDescription (string)
|
// - optional: $pageDescription (string)
|
||||||
// - optional: $canonical (string)
|
// - optional: $canonical (string)
|
||||||
// - optional: $userInitials (string|null)
|
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
// Fallbacks & i18n Title/Description
|
// Fallbacks & i18n Title/Description
|
||||||
@@ -21,45 +19,39 @@ if (!isset($pageKey) || !is_string($pageKey) || $pageKey === '') {
|
|||||||
$pageKey = 'landing';
|
$pageKey = 'landing';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sprache: erst lokale $lang prüfen, sonst global aus fileload.php, dann Fallback
|
// Sprache: aus Globals (fileload.php) bzw. Fallback
|
||||||
if (!isset($lang) || !isset($availableLangs[$lang])) {
|
|
||||||
$lang = $GLOBALS['lang'] ?? (array_key_first($availableLangs) ?: 'en');
|
$lang = $GLOBALS['lang'] ?? (array_key_first($availableLangs) ?: 'en');
|
||||||
}
|
|
||||||
|
|
||||||
// Title aus i18n, falls nichts explizit gesetzt wurde
|
// Title aus i18n, falls nichts explizit gesetzt wurde
|
||||||
if (!isset($pageTitle) || !is_string($pageTitle) || $pageTitle === '') {
|
if (!isset($pageTitle) || !is_string($pageTitle) || $pageTitle === '') {
|
||||||
// pages.{pageKey}.meta.title
|
|
||||||
$pageTitle = i18n_get("pages.$pageKey.meta.title", app_primary_domain());
|
$pageTitle = i18n_get("pages.$pageKey.meta.title", app_primary_domain());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Description aus i18n, falls nichts explizit gesetzt wurde
|
// Description aus i18n, falls nichts explizit gesetzt wurde
|
||||||
if (!isset($pageDescription) || !is_string($pageDescription) || $pageDescription === '') {
|
if (!isset($pageDescription) || !is_string($pageDescription) || $pageDescription === '') {
|
||||||
// pages.{pageKey}.meta.description
|
|
||||||
$pageDescription = i18n_get("pages.$pageKey.meta.description", '');
|
$pageDescription = i18n_get("pages.$pageKey.meta.description", '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
// Standard-Script für Header-Interaktionen
|
// Standard-Scripts für Header-Interaktionen (Footer-Scripts)
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
if (function_exists('tpl_add_script')) {
|
if (function_exists('tpl_add_script')) {
|
||||||
// header.js kommt wie gehabt in den Footer
|
|
||||||
tpl_add_script('/assets/js/header.js', 'footer', true, false, '', null);
|
tpl_add_script('/assets/js/header.js', 'footer', true, false, '', null);
|
||||||
}
|
|
||||||
if (function_exists('tpl_add_script')) {
|
|
||||||
// header.js kommt wie gehabt in den Footer
|
|
||||||
tpl_add_script('/assets/js/lang.js', 'footer', true, false, '', null);
|
tpl_add_script('/assets/js/lang.js', 'footer', true, false, '', null);
|
||||||
}
|
}
|
||||||
// -----------------------------------------------------------
|
|
||||||
// Canonical-URL bestimmen
|
|
||||||
// -----------------------------------------------------------
|
|
||||||
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
|
||||||
$host = $_SERVER['HTTP_HOST'] ?? app_primary_domain();
|
|
||||||
$requestUri = $_SERVER['REQUEST_URI'] ?? '/';
|
|
||||||
|
|
||||||
// Wenn $canonical gesetzt → verwenden, sonst aktuelle URL ohne Query-String
|
// -----------------------------------------------------------
|
||||||
$effectiveCanonical = isset($canonical) && is_string($canonical) && $canonical !== ''
|
// Globales CSS registrieren (z.B. main.css)
|
||||||
? $canonical
|
// → Priority 'late', damit es Tailwind überschreiben kann
|
||||||
: ($scheme . '://' . $host . strtok($requestUri, '?'));
|
// -----------------------------------------------------------
|
||||||
|
if (function_exists('tpl_add_style')) {
|
||||||
|
tpl_add_style('/assets/css/main.css', 'header', 'late'); // <– Pfad ist korrekt, relativ zum Webroot
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------
|
||||||
|
// Canonical-URL bestimmen (zentral über Helper)
|
||||||
|
// -----------------------------------------------------------
|
||||||
|
$effectiveCanonical = app_canonical_url($canonical ?? null);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@@ -79,47 +71,12 @@ $effectiveCanonical = isset($canonical) && is_string($canonical) && $canonical !
|
|||||||
<!-- Fonts -->
|
<!-- Fonts -->
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Montserrat:wght@600;700;800&display=swap" rel="stylesheet">
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Montserrat:wght@600;700;800&display=swap"
|
||||||
<?php
|
rel="stylesheet"
|
||||||
// App-Config (usbConfig + i18n.available/current) ins Fenster schreiben
|
>
|
||||||
tpl('app_config', 'structure');
|
|
||||||
|
|
||||||
// CSS im Header aus der zentralen Registry
|
|
||||||
foreach ($GLOBALS['page_styles'] as $style) {
|
|
||||||
if (($style['pos'] ?? 'header') !== 'header') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$href = $style['href'];
|
|
||||||
if (!empty($style['version'])) {
|
|
||||||
$href .= (str_contains($href, '?') ? '&' : '?') . 'v=' . urlencode($style['version']);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<link rel="stylesheet" href="' . htmlspecialchars($href) . '">' . PHP_EOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scripts im Header aus der zentralen Registry
|
|
||||||
foreach ($GLOBALS['page_header_scripts'] as $script) {
|
|
||||||
$src = $script['src'];
|
|
||||||
if (!empty($script['version'])) {
|
|
||||||
$src .= (str_contains($src, '?') ? '&' : '?') . 'v=' . urlencode($script['version']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$attr = '';
|
|
||||||
if (!empty($script['async'])) {
|
|
||||||
$attr .= ' async';
|
|
||||||
} elseif (!empty($script['defer'])) {
|
|
||||||
$attr .= ' defer';
|
|
||||||
}
|
|
||||||
if (!empty($script['type'])) {
|
|
||||||
$attr .= ' type="' . htmlspecialchars($script['type']) . '"';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<script src="' . htmlspecialchars($src) . '"' . $attr . '></script>' . PHP_EOL;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
<!-- Tailwind Config -->
|
||||||
<script>
|
<script>
|
||||||
window.tailwind = window.tailwind || {};
|
window.tailwind = window.tailwind || {};
|
||||||
window.tailwind.config = {
|
window.tailwind.config = {
|
||||||
@@ -148,11 +105,78 @@ $effectiveCanonical = isset($canonical) && is_string($canonical) && $canonical !
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Tailwind (Dev) -->
|
<!-- Tailwind (Dev) -->
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
|
|
||||||
<!-- Eigenes CSS -->
|
<?php
|
||||||
<link rel="stylesheet" href="/assets/css/main.css">
|
// App-Config (usbConfig + i18n.available/current) ins Fenster schreiben
|
||||||
|
tpl('app_config', 'structure');
|
||||||
|
|
||||||
|
// -------------------------------------------------------
|
||||||
|
// CSS im Header aus der zentralen Registry
|
||||||
|
// -------------------------------------------------------
|
||||||
|
$styles = $GLOBALS['page_styles'] ?? [];
|
||||||
|
|
||||||
|
if (!empty($styles)) {
|
||||||
|
usort($styles, function ($a, $b) {
|
||||||
|
$order = ['early' => 0, 'normal' => 1, 'late' => 2];
|
||||||
|
|
||||||
|
$pa = $order[$a['priority'] ?? 'normal'] ?? 1;
|
||||||
|
$pb = $order[$b['priority'] ?? 'normal'] ?? 1;
|
||||||
|
|
||||||
|
return $pa <=> $pb;
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach ($styles as $s) {
|
||||||
|
$href = $s['href'] ?? '';
|
||||||
|
$version = $s['version'] ?? null;
|
||||||
|
|
||||||
|
if ($href === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cache-Buster nur, wenn Version explizit gesetzt und nicht leer
|
||||||
|
if ($version !== null && $version !== '') {
|
||||||
|
$separator = (strpos($href, '?') === false) ? '?' : '&';
|
||||||
|
$href .= $separator . 'v=' . rawurlencode($version);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<link rel="stylesheet" href="' . htmlspecialchars($href) . '">' . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------
|
||||||
|
// Scripts im Header aus der zentralen Registry
|
||||||
|
// -------------------------------------------------------
|
||||||
|
$headerScripts = $GLOBALS['page_header_scripts'] ?? [];
|
||||||
|
|
||||||
|
foreach ($headerScripts as $script) {
|
||||||
|
$src = $script['src'] ?? '';
|
||||||
|
$version = $script['version'] ?? null;
|
||||||
|
|
||||||
|
if ($src === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($version !== null && $version !== '') {
|
||||||
|
$src .= (str_contains($src, '?') ? '&' : '?') . 'v=' . urlencode($version);
|
||||||
|
}
|
||||||
|
|
||||||
|
$attr = '';
|
||||||
|
if (!empty($script['async'])) {
|
||||||
|
$attr .= ' async';
|
||||||
|
} elseif (!empty($script['defer'])) {
|
||||||
|
$attr .= ' defer';
|
||||||
|
}
|
||||||
|
if (!empty($script['type'])) {
|
||||||
|
$attr .= ' type="' . htmlspecialchars($script['type']) . '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<script src="' . htmlspecialchars($src) . '"' . $attr . '></script>' . PHP_EOL;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="bg-brand-bg text-brand-text font-sans antialiased scroll-smooth">
|
<body class="bg-brand-bg text-brand-text font-sans antialiased scroll-smooth">
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ $GLOBALS['page_header_scripts'] = $GLOBALS['page_header_scripts'] ?? [];
|
|||||||
$GLOBALS['page_footer_scripts'] = $GLOBALS['page_footer_scripts'] ?? [];
|
$GLOBALS['page_footer_scripts'] = $GLOBALS['page_footer_scripts'] ?? [];
|
||||||
$GLOBALS['page_styles'] = $GLOBALS['page_styles'] ?? [];
|
$GLOBALS['page_styles'] = $GLOBALS['page_styles'] ?? [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primäre Domain / URL (Brand)
|
||||||
|
*/
|
||||||
function app_primary_domain(): string
|
function app_primary_domain(): string
|
||||||
{
|
{
|
||||||
return defined('APP_DOMAIN_PRIMARY') ? APP_DOMAIN_PRIMARY : 'usbcheck.it';
|
return defined('APP_DOMAIN_PRIMARY') ? APP_DOMAIN_PRIMARY : 'usbcheck.it';
|
||||||
@@ -25,6 +28,88 @@ function app_fakecheck_url(): string
|
|||||||
return rtrim($url, '/');
|
return rtrim($url, '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------
|
||||||
|
Zentrale Request-/URL-Helper
|
||||||
|
------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aktuelles Schema (http / https), inkl. Proxy-Header-Fallback.
|
||||||
|
*/
|
||||||
|
function app_request_scheme(): string
|
||||||
|
{
|
||||||
|
// Proxy / Loadbalancer
|
||||||
|
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
|
||||||
|
$proto = strtolower((string)$_SERVER['HTTP_X_FORWARDED_PROTO']);
|
||||||
|
if ($proto === 'https' || $proto === 'http') {
|
||||||
|
return $proto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Direkt
|
||||||
|
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
|
||||||
|
return 'https';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'http';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aktueller Host (inkl. Port, falls im Host-Header).
|
||||||
|
*/
|
||||||
|
function app_request_host(): string
|
||||||
|
{
|
||||||
|
return $_SERVER['HTTP_HOST'] ?? app_primary_domain();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basis-URL der aktuellen Anfrage, z. B. https://staging.usbcheck.it
|
||||||
|
*/
|
||||||
|
function app_current_base_url(): string
|
||||||
|
{
|
||||||
|
return app_request_scheme() . '://' . app_request_host();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aktueller Pfad ohne Query, z. B. /login/ oder /fakecheck/demo
|
||||||
|
*/
|
||||||
|
function app_current_path(): string
|
||||||
|
{
|
||||||
|
return strtok($_SERVER['REQUEST_URI'] ?? '/', '?');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aktuelle URL, optional mit Query-String.
|
||||||
|
*/
|
||||||
|
function app_current_url(bool $withQuery = true): string
|
||||||
|
{
|
||||||
|
$base = app_current_base_url();
|
||||||
|
$uri = $_SERVER['REQUEST_URI'] ?? '/';
|
||||||
|
|
||||||
|
if ($withQuery) {
|
||||||
|
return $base . $uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $base . strtok($uri, '?');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Canonical-URL bestimmen.
|
||||||
|
* - Wenn $override gesetzt: exakt diesen Wert verwenden.
|
||||||
|
* - Sonst: aktuelle URL ohne Query.
|
||||||
|
*/
|
||||||
|
function app_canonical_url(?string $override = null): string
|
||||||
|
{
|
||||||
|
if (is_string($override) && $override !== '') {
|
||||||
|
return $override;
|
||||||
|
}
|
||||||
|
|
||||||
|
return app_current_url(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------
|
||||||
|
Assets: JS / CSS
|
||||||
|
------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Script registrieren
|
* Script registrieren
|
||||||
*/
|
*/
|
||||||
@@ -59,32 +144,37 @@ function tpl_add_script(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CSS registrieren – MIT korrekt funktionierendem Cache-Buster
|
* CSS registrieren – MIT Cache-Buster und Priorität
|
||||||
|
*
|
||||||
|
* @param string $href Pfad zur CSS-Datei oder externe URL
|
||||||
|
* @param string $pos aktuell nur 'header' relevant (aber für Symmetrie drin)
|
||||||
|
* @param string $priority 'early' | 'normal' | 'late'
|
||||||
|
* @param string|null $version null = nutze ASSET_VERSION (falls definiert),
|
||||||
|
* '' = kein ?v=,
|
||||||
|
* 'xyz'= erzwinge diese Version
|
||||||
*/
|
*/
|
||||||
function tpl_add_style(string $href, string $pos = 'header', ?string $version = null): void
|
function tpl_add_style(
|
||||||
{
|
string $href,
|
||||||
|
string $pos = 'header',
|
||||||
|
string $priority = 'normal',
|
||||||
|
?string $version = null
|
||||||
|
): void {
|
||||||
if ($version === null && defined('ASSET_VERSION')) {
|
if ($version === null && defined('ASSET_VERSION')) {
|
||||||
$version = ASSET_VERSION;
|
$version = ASSET_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
// version = null oder '' → kein Cache-Buster
|
|
||||||
$finalHref = $href;
|
|
||||||
|
|
||||||
if ($version !== null && $version !== '') {
|
|
||||||
$separator = (strpos($href, '?') === false) ? '?' : '&';
|
|
||||||
$finalHref = $href . $separator . 'v=' . rawurlencode($version);
|
|
||||||
}
|
|
||||||
|
|
||||||
$GLOBALS['page_styles'][] = [
|
$GLOBALS['page_styles'][] = [
|
||||||
'href' => $finalHref,
|
'href' => $href,
|
||||||
'pos' => $pos,
|
'pos' => $pos,
|
||||||
|
'priority' => $priority,
|
||||||
'version' => $version,
|
'version' => $version,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* -------------------------------------------------
|
||||||
* Template Loader
|
Template Loader
|
||||||
*/
|
------------------------------------------------- */
|
||||||
|
|
||||||
function tpl(string $file, string $type = 'structure', string $site = 'main'): void
|
function tpl(string $file, string $type = 'structure', string $site = 'main'): void
|
||||||
{
|
{
|
||||||
$base = __DIR__ . '/../partials/';
|
$base = __DIR__ . '/../partials/';
|
||||||
@@ -117,9 +207,10 @@ function tpl(string $file, string $type = 'structure', string $site = 'main'): v
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* -------------------------------------------------
|
||||||
* Flash setzen
|
Flash-Messages
|
||||||
*/
|
------------------------------------------------- */
|
||||||
|
|
||||||
function flash_set(string $type, string $message, ?string $context = null): void
|
function flash_set(string $type, string $message, ?string $context = null): void
|
||||||
{
|
{
|
||||||
if (session_status() !== PHP_SESSION_ACTIVE) {
|
if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||||
@@ -133,9 +224,6 @@ function flash_set(string $type, string $message, ?string $context = null): void
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Flash holen
|
|
||||||
*/
|
|
||||||
function flash_get(): ?array
|
function flash_get(): ?array
|
||||||
{
|
{
|
||||||
if (session_status() !== PHP_SESSION_ACTIVE) {
|
if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||||
@@ -156,6 +244,10 @@ function flash_get(): ?array
|
|||||||
return $flash;
|
return $flash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------
|
||||||
|
i18n Helper
|
||||||
|
------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* interner Helper für dot-notation keys
|
* interner Helper für dot-notation keys
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user