76 lines
2.7 KiB
PHP
76 lines
2.7 KiB
PHP
<?php
|
|
// public/partials/header.php
|
|
|
|
// Fallback, falls $currentLang nicht gesetzt ist
|
|
if (!isset($currentLang)) {
|
|
$currentLang = 'en';
|
|
}
|
|
|
|
$supportedLangs = [
|
|
'de' => 'Deutsch',
|
|
'en' => 'English',
|
|
'it' => 'Italiano',
|
|
'fr' => 'Français',
|
|
];
|
|
|
|
/**
|
|
* Baut eine URL und hängt immer ?lang=<code> dran.
|
|
* $path sollte mit / beginnen, z.B. "/", "/fakecheck/", "/impressum".
|
|
*/
|
|
function usbcheck_url_with_lang(string $path, string $lang): string
|
|
{
|
|
$path = $path ?: '/';
|
|
$separator = str_contains($path, '?') ? '&' : '?';
|
|
return $path . $separator . 'lang=' . urlencode($lang);
|
|
}
|
|
?>
|
|
<header class="site-header">
|
|
<div class="container header-inner">
|
|
<a href="<?php echo htmlspecialchars(usbcheck_url_with_lang('/', $currentLang)); ?>" class="logo-wrap">
|
|
<img src="/img/logo.png" alt="usbcheck.it Logo" class="logo-img">
|
|
</a>
|
|
|
|
<nav class="main-nav">
|
|
<a href="<?php echo htmlspecialchars(usbcheck_url_with_lang('/', $currentLang)); ?>#how-it-works"
|
|
class="nav-link"
|
|
data-i18n="nav_how_it_works"></a>
|
|
|
|
<a href="<?php echo htmlspecialchars(usbcheck_url_with_lang('/', $currentLang)); ?>#features"
|
|
class="nav-link"
|
|
data-i18n="nav_features"></a>
|
|
|
|
<a href="<?php echo htmlspecialchars(usbcheck_url_with_lang('/', $currentLang)); ?>#pricing"
|
|
class="nav-link"
|
|
data-i18n="nav_pricing"></a>
|
|
|
|
<a href="<?php echo htmlspecialchars(usbcheck_url_with_lang('/', $currentLang)); ?>#faq"
|
|
class="nav-link"
|
|
data-i18n="nav_faq"></a>
|
|
</nav>
|
|
|
|
<div class="header-actions">
|
|
<div class="lang-switch" data-current-lang="<?php echo htmlspecialchars($currentLang); ?>">
|
|
<button id="lang-current" class="lang-current">
|
|
<?php echo strtoupper(htmlspecialchars($currentLang)); ?>
|
|
</button>
|
|
<div id="lang-menu" class="lang-menu hidden">
|
|
<?php foreach ($supportedLangs as $code => $label): ?>
|
|
<button data-lang="<?php echo htmlspecialchars($code); ?>">
|
|
<?php echo htmlspecialchars($label); ?>
|
|
</button>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<button id="login-button"
|
|
class="btn btn-outline"
|
|
data-i18n="btn_login"></button>
|
|
|
|
<div id="user-avatar" class="user-avatar hidden" title="Account">
|
|
<!-- Standard: Initialen, später durch Bild ersetzbar -->
|
|
<span id="user-avatar-initials">U</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|