Compare commits
24 Commits
d9b4c71735
...
fix/issue-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41ade292c4 | ||
|
|
ac8b3f4d79 | ||
|
|
a25eac3b04 | ||
|
|
d34fc00078 | ||
|
|
db83e09a3a | ||
| 5781b5b5f0 | |||
|
|
e3769b6588 | ||
|
|
e72fd08953 | ||
|
|
2869dbd059 | ||
|
|
a765497bc9 | ||
|
|
949ab201b1 | ||
|
|
38410c4ebc | ||
|
|
a879aa0165 | ||
|
|
ce87b8b531 | ||
|
|
3b4c73425a | ||
|
|
acaea97415 | ||
|
|
69e23d959a | ||
|
|
391985cd42 | ||
|
|
70691ff242 | ||
|
|
08235b0faf | ||
|
|
9a14803d26 | ||
|
|
7dd8023222 | ||
|
|
c737312ada | ||
|
|
4bc035b783 |
@@ -1,131 +1,134 @@
|
||||
name: Deploy Feature Branch to Test
|
||||
name: Deploy Feature Branch to Test (haus.test.kies-media.de)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "feature/**"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ref:
|
||||
description: "Branch or tag to deploy (default: HEAD)"
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
jobs:
|
||||
lint-php:
|
||||
name: PHP Syntax Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install PHP
|
||||
run: apt-get update -qq && apt-get install -y -qq php-cli > /dev/null 2>&1
|
||||
|
||||
- name: PHP Lint
|
||||
run: |
|
||||
errors=0
|
||||
while IFS= read -r file; do
|
||||
if ! php -l "$file" > /dev/null 2>&1; then
|
||||
echo "❌ Syntax error in $file"
|
||||
php -l "$file"
|
||||
errors=1
|
||||
fi
|
||||
done < <(find . -name "*.php" -not -path "./vendor/*")
|
||||
if [ "$errors" -eq 1 ]; then
|
||||
echo "::error::PHP lint check failed"
|
||||
exit 1
|
||||
fi
|
||||
echo "✅ All PHP files pass syntax check"
|
||||
|
||||
lint-css:
|
||||
name: CSS Lint (stylelint)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js & stylelint
|
||||
run: |
|
||||
apt-get update -qq && apt-get install -y -qq npm nodejs > /dev/null 2>&1
|
||||
npm install -g stylelint stylelint-config-standard stylelint-prettier > /dev/null 2>&1
|
||||
|
||||
- name: CSS Lint
|
||||
run: |
|
||||
npx stylelint "**/*.css" --config .stylelintrc.json --allow-empty-input
|
||||
echo "✅ All CSS files pass lint"
|
||||
|
||||
lint-html:
|
||||
name: HTML Lint (htmlhint)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js & htmlhint
|
||||
run: |
|
||||
apt-get update -qq && apt-get install -y -qq npm nodejs > /dev/null 2>&1
|
||||
npm install -g htmlhint > /dev/null 2>&1
|
||||
|
||||
- name: HTML Lint
|
||||
run: |
|
||||
npx htmlhint "**/*.html" --config .htmlhintrc
|
||||
echo "✅ All HTML files pass lint"
|
||||
|
||||
deploy:
|
||||
name: Deploy to Test Environment
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint-php, lint-css, lint-html]
|
||||
container:
|
||||
volumes:
|
||||
- /var/www/test/html:/deploy
|
||||
concurrency:
|
||||
group: deploy-test
|
||||
cancel-in-progress: false
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Show branch info
|
||||
- name: Setup SSH
|
||||
env:
|
||||
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
run: |
|
||||
echo "=== Deploying branch: ${{ gitea.ref_name }} ==="
|
||||
echo "=== Commit: ${{ gitea.sha }} ==="
|
||||
echo "=== By: ${{ gitea.actor }} ==="
|
||||
echo "=== All lint checks passed ✅ ==="
|
||||
date
|
||||
if [ -z "$DEPLOY_SSH_KEY" ]; then
|
||||
echo "⚠️ DEPLOY_SSH_KEY secret not set — skipping deploy step"
|
||||
echo "skip_deploy=1" >> $GITHUB_ENV
|
||||
exit 0
|
||||
fi
|
||||
mkdir -p ~/.ssh
|
||||
echo "$DEPLOY_SSH_KEY" > ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
ssh-keyscan -H 188.245.242.194 >> ~/.ssh/known_hosts 2>/dev/null
|
||||
echo "✅ SSH key configured"
|
||||
|
||||
- name: Deploy to test environment
|
||||
- name: Verify SSH connectivity
|
||||
if: env.skip_deploy != '1'
|
||||
run: |
|
||||
echo "Syncing files to test environment..."
|
||||
apt-get update -qq && apt-get install -y -qq rsync > /dev/null 2>&1 || true
|
||||
ssh -o StrictHostKeyChecking=yes -i ~/.ssh/id_ed25519 \
|
||||
haustest@188.245.242.194 "echo 'SSH-OK as:' \$(whoami) 'on' \$(hostname)"
|
||||
|
||||
rsync -av --delete \
|
||||
- name: Backup current test deployment
|
||||
if: env.skip_deploy != '1'
|
||||
run: |
|
||||
ssh -i ~/.ssh/id_ed25519 haustest@188.245.242.194 \
|
||||
"cd /home/haustest/htdocs && \
|
||||
tar czf /home/haustest/backup-pre-deploy-\$(date +%Y%m%d-%H%M%S).tar.gz \
|
||||
haus.test.kies-media.de && \
|
||||
ls -lh /home/haustest/backup-pre-deploy-*.tar.gz | tail -1"
|
||||
|
||||
- name: Rsync to test environment
|
||||
if: env.skip_deploy != '1'
|
||||
run: |
|
||||
rsync -avz --delete \
|
||||
--exclude='.git' \
|
||||
--exclude='node_modules' \
|
||||
--exclude='tests' \
|
||||
--exclude='docs' \
|
||||
--exclude='.gitea' \
|
||||
--exclude='.husky' \
|
||||
--exclude='.prettierrc' \
|
||||
--exclude='.prettierignore' \
|
||||
--exclude='.stylelintrc.json' \
|
||||
--exclude='.htmlhintrc' \
|
||||
--exclude='.gitignore' \
|
||||
--exclude='.dockerignore' \
|
||||
--exclude='.continue' \
|
||||
--exclude='.husky' \
|
||||
--exclude='Dockerfile' \
|
||||
--exclude='.dockerignore' \
|
||||
--exclude='nginx.conf' \
|
||||
--exclude='eslint.config.js' \
|
||||
--exclude='package.json' \
|
||||
--exclude='package-lock.json' \
|
||||
--exclude='docs/' \
|
||||
--exclude='phpunit.xml' \
|
||||
--exclude='scripts' \
|
||||
--exclude='AGENTS.md' \
|
||||
--exclude='README.md' \
|
||||
--exclude='scripts/' \
|
||||
./ /deploy/
|
||||
--exclude='CLAUDE.md' \
|
||||
--exclude='*.md' \
|
||||
--exclude='.htmlhintrc' \
|
||||
--exclude='.prettierrc' \
|
||||
--exclude='.prettierignore' \
|
||||
--exclude='.stylelintrc.json' \
|
||||
--exclude='.editorconfig' \
|
||||
--exclude='.well-known' \
|
||||
-e "ssh -i ~/.ssh/id_ed25519" \
|
||||
./ haustest@188.245.242.194:/home/haustest/htdocs/haus.test.kies-media.de/
|
||||
|
||||
|
||||
echo "✅ Deployment complete!"
|
||||
|
||||
- name: Set permissions
|
||||
- name: Smoke test
|
||||
if: env.skip_deploy != '1'
|
||||
run: |
|
||||
chown -R 33:33 /deploy/ 2>/dev/null || true
|
||||
chmod -R 755 /deploy/ 2>/dev/null || true
|
||||
echo "✅ Permissions set"
|
||||
sleep 2
|
||||
echo "--- HTTP status codes ---"
|
||||
for path in "/" "/impressum" "/datenschutz"; do
|
||||
code=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||
-H "Cache-Control: no-cache" \
|
||||
"https://haus.test.kies-media.de${path}")
|
||||
echo " $path → HTTP $code"
|
||||
if [ "$code" != "200" ]; then
|
||||
echo "❌ Smoke test failed for $path"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo ""
|
||||
echo "--- Locale switcher present? ---"
|
||||
if curl -sL "https://haus.test.kies-media.de/" | grep -q "class=\"locale-switcher\""; then
|
||||
echo " ✅ Locale switcher rendered"
|
||||
else
|
||||
echo " ❌ Locale switcher MISSING"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
echo "--- All 4 locales serving? ---"
|
||||
for loc in de en uk ru; do
|
||||
lang=$(curl -sL -H "Cache-Control: no-cache" \
|
||||
-b "locale=$loc" \
|
||||
"https://haus.test.kies-media.de/" \
|
||||
| grep -oE '<html lang="[a-z]+"' | head -1)
|
||||
echo " locale=$loc → $lang"
|
||||
done
|
||||
echo ""
|
||||
echo "🎉 Test deployment verified: https://haus.test.kies-media.de"
|
||||
|
||||
- name: Deployment summary
|
||||
if: always()
|
||||
run: |
|
||||
echo "=========================================="
|
||||
echo " 🚀 Deployment Summary"
|
||||
echo "=========================================="
|
||||
echo " Branch: ${{ gitea.ref_name }}"
|
||||
echo " Commit: ${{ gitea.sha }}"
|
||||
echo " Target: http://178.104.150.0:6427/"
|
||||
echo " Lint: ✅ All checks passed"
|
||||
echo " Time: $(date)"
|
||||
echo "=========================================="
|
||||
echo "### 🚀 Deployment Summary" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Target:** https://haus.test.kies-media.de" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Server:** haustest@188.245.242.194" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Review URL:** https://haus.test.kies-media.de" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
@@ -25,10 +25,13 @@ abstract class Controller
|
||||
* Render a view inside a layout.
|
||||
*
|
||||
* @param array<string,mixed> $data
|
||||
* @param string|null $forceLocale If set, overrides the locale resolved from
|
||||
* cookie/Accept-Language for this render. Used by legal pages (Impressum,
|
||||
* Datenschutz) that must be served in German only by German law.
|
||||
*/
|
||||
protected function render(string $view, array $data = [], string $layout = 'main'): void
|
||||
protected function render(string $view, array $data = [], string $layout = 'main', ?string $forceLocale = null): void
|
||||
{
|
||||
$locale = LocaleController::current();
|
||||
$locale = $forceLocale ?? LocaleController::current();
|
||||
$i18n = static fn (string $key, array $params = []): string => I18n::t($key, $params, $locale);
|
||||
|
||||
$globals = [
|
||||
|
||||
@@ -11,17 +11,18 @@ class DatenschutzController extends Controller
|
||||
{
|
||||
public function index(): void
|
||||
{
|
||||
$locale = LocaleController::current();
|
||||
|
||||
// Legal pages (Datenschutzerklärung) must be served in German only by GDPR / German law.
|
||||
// Force German locale for render() so <html lang="de"> + German meta are emitted
|
||||
// regardless of cookie/Accept-Language.
|
||||
$this->render('datenschutz/index', [
|
||||
'pageTitle' => I18n::t('legal.privacy_h1', [], $locale) . ' – ' . I18n::t('site.title', [], $locale),
|
||||
'pageDescription' => I18n::t('legal.privacy_h1', [], $locale) . ' – ' . I18n::t('site.title', [], $locale),
|
||||
'pageTitle' => I18n::t('legal.privacy_h1', [], 'de') . ' – ' . I18n::t('site.title', [], 'de'),
|
||||
'pageDescription' => I18n::t('legal.privacy_h1', [], 'de') . ' – ' . I18n::t('site.title', [], 'de'),
|
||||
'robots' => 'noindex',
|
||||
'canonical' => I18n::t('site.canonical_base', [], $locale) . '/datenschutz',
|
||||
'ogLocale' => Locale::toOgLocale($locale),
|
||||
'ogUrl' => I18n::t('site.canonical_base', [], $locale) . '/datenschutz',
|
||||
'ogTitle' => I18n::t('legal.privacy_h1', [], $locale),
|
||||
'ogDescription' => I18n::t('legal.privacy_h1', [], $locale),
|
||||
]);
|
||||
'canonical' => I18n::t('site.canonical_base', [], 'de') . '/datenschutz',
|
||||
'ogLocale' => Locale::toOgLocale('de'),
|
||||
'ogUrl' => I18n::t('site.canonical_base', [], 'de') . '/datenschutz',
|
||||
'ogTitle' => I18n::t('legal.privacy_h1', [], 'de'),
|
||||
'ogDescription' => I18n::t('legal.privacy_h1', [], 'de'),
|
||||
], 'main', 'de');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,17 +11,18 @@ class ImpressumController extends Controller
|
||||
{
|
||||
public function index(): void
|
||||
{
|
||||
$locale = LocaleController::current();
|
||||
|
||||
// Legal pages (Impressum) must be served in German only by German law (TMG §5).
|
||||
// Force German locale for render() so <html lang="de"> + German meta are emitted
|
||||
// regardless of cookie/Accept-Language.
|
||||
$this->render('impressum/index', [
|
||||
'pageTitle' => I18n::t('legal.imprint_h1', [], $locale) . ' – ' . I18n::t('site.title', [], $locale),
|
||||
'pageDescription' => I18n::t('legal.imprint_h1', [], $locale) . ' – ' . I18n::t('site.title', [], $locale),
|
||||
'pageTitle' => I18n::t('legal.imprint_h1', [], 'de') . ' – ' . I18n::t('site.title', [], 'de'),
|
||||
'pageDescription' => I18n::t('legal.imprint_h1', [], 'de') . ' – ' . I18n::t('site.title', [], 'de'),
|
||||
'robots' => 'noindex',
|
||||
'canonical' => I18n::t('site.canonical_base', [], $locale) . '/impressum',
|
||||
'ogLocale' => Locale::toOgLocale($locale),
|
||||
'ogUrl' => I18n::t('site.canonical_base', [], $locale) . '/impressum',
|
||||
'ogTitle' => I18n::t('legal.imprint_h1', [], $locale),
|
||||
'ogDescription' => I18n::t('legal.imprint_h1', [], $locale),
|
||||
]);
|
||||
'canonical' => I18n::t('site.canonical_base', [], 'de') . '/impressum',
|
||||
'ogLocale' => Locale::toOgLocale('de'),
|
||||
'ogUrl' => I18n::t('site.canonical_base', [], 'de') . '/impressum',
|
||||
'ogTitle' => I18n::t('legal.imprint_h1', [], 'de'),
|
||||
'ogDescription' => I18n::t('legal.imprint_h1', [], 'de'),
|
||||
], 'main', 'de');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,13 +11,18 @@ use App\Core\Locale;
|
||||
* Renders the language switcher widget. Pure HTML generation — no
|
||||
* side effects, no header writing.
|
||||
*
|
||||
* Each option gets:
|
||||
* - an inline 24×16 SVG flag (sub-Issue D),
|
||||
* Single <details>-based dropdown shown at every viewport. The
|
||||
* trigger is a flag-sized button (24×16 SVG + tiny caret) that
|
||||
* opens to a menu of all 4 supported locales.
|
||||
*
|
||||
* Each menu option gets:
|
||||
* - an inline 24×16 SVG flag,
|
||||
* - `hreflang` and `lang` for SEO and screen readers,
|
||||
* - `aria-current="true"` on the active option.
|
||||
*
|
||||
* Active option is rendered as a <span> (not a link) so it cannot
|
||||
* be reactivated. All options are ≥44px touch targets via CSS.
|
||||
* The active option is rendered as a <span> (not a link) so it
|
||||
* cannot be reactivated. The trigger and every menu option are
|
||||
* ≥44px touch targets via CSS.
|
||||
*/
|
||||
final class LocaleSwitcher
|
||||
{
|
||||
@@ -36,7 +41,25 @@ final class LocaleSwitcher
|
||||
'UTF-8',
|
||||
);
|
||||
|
||||
$html = '<ul class="locale-switcher" role="list" aria-label="' . $ariaLabel . '">';
|
||||
$currentName = htmlspecialchars(
|
||||
I18n::t('locale.' . $this->currentLocale, [], $this->currentLocale),
|
||||
ENT_QUOTES,
|
||||
'UTF-8',
|
||||
);
|
||||
$currentCode = htmlspecialchars($this->currentLocale, ENT_QUOTES, 'UTF-8');
|
||||
$currentFlag = self::flagImg($this->currentLocale);
|
||||
|
||||
$html = '<details class="locale-switcher">';
|
||||
$html .= '<summary class="locale-switcher__trigger"'
|
||||
. ' aria-label="' . $ariaLabel . '"'
|
||||
. ' title="' . $currentName . '"'
|
||||
. '>';
|
||||
$html .= '<span class="locale-switcher__current" lang="' . $currentCode . '">';
|
||||
$html .= $currentFlag;
|
||||
$html .= '</span>';
|
||||
$html .= '<span class="locale-switcher__caret" aria-hidden="true">▾</span>';
|
||||
$html .= '</summary>';
|
||||
$html .= '<ul class="locale-switcher__menu" role="list">';
|
||||
foreach (Locale::SUPPORTED as $code) {
|
||||
$isCurrent = $code === $this->currentLocale;
|
||||
$name = htmlspecialchars(
|
||||
@@ -45,22 +68,19 @@ final class LocaleSwitcher
|
||||
'UTF-8',
|
||||
);
|
||||
$codeAttr = htmlspecialchars($code, ENT_QUOTES, 'UTF-8');
|
||||
$flag = self::flagSvg($code);
|
||||
$flag = self::flagImg($code);
|
||||
|
||||
$classes = 'locale-switcher__option';
|
||||
$html .= '<li>';
|
||||
if ($isCurrent) {
|
||||
$classes .= ' is-current';
|
||||
}
|
||||
|
||||
$html .= '<li class="locale-switcher__item">';
|
||||
if ($isCurrent) {
|
||||
$html .= '<span class="' . $classes . '" aria-current="true" lang="' . $codeAttr . '">'
|
||||
$html .= '<span class="locale-switcher__option is-current"'
|
||||
. ' aria-current="true"'
|
||||
. ' lang="' . $codeAttr . '">'
|
||||
. $flag
|
||||
. '<span class="locale-switcher__label">' . $name . '</span>'
|
||||
. '</span>';
|
||||
} else {
|
||||
$url = '/locale?set=' . rawurlencode($code) . '&return=' . rawurlencode($path);
|
||||
$html .= '<a class="' . $classes . '"'
|
||||
$html .= '<a class="locale-switcher__option"'
|
||||
. ' href="' . $url . '"'
|
||||
. ' hreflang="' . $codeAttr . '"'
|
||||
. ' lang="' . $codeAttr . '"'
|
||||
@@ -73,51 +93,50 @@ final class LocaleSwitcher
|
||||
$html .= '</li>';
|
||||
}
|
||||
$html .= '</ul>';
|
||||
$html .= '</details>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inline 24×16 SVG for the four supported locales.
|
||||
* Country flag for the given locale. Renders a 24×18 <img>
|
||||
* pointing at the official flag-icons SVG asset shipped under
|
||||
* public/img/flags/. 4:3 aspect (de/gb/ua/ru), crisp at any DPI,
|
||||
* no external CDN dependency.
|
||||
*
|
||||
* - DE: black/red/gold horizontal stripes (Germany)
|
||||
* - EN: simplified Union Jack (en-GB per ADR-002)
|
||||
* - UK: blue/yellow horizontal stripes (Ukraine)
|
||||
* - RU: white/blue/red horizontal stripes (Russia)
|
||||
*
|
||||
* Decorative: marked `aria-hidden="true"` + `focusable="false"`.
|
||||
* The full accessible name is conveyed by the visible label and
|
||||
* the <a>'s hreflang/lang.
|
||||
* Decorative: `alt=""` (the visible locale-switcher label and
|
||||
* the <a>'s `hreflang`/`lang` carry the accessible name).
|
||||
*/
|
||||
public static function flagSvg(string $locale): string
|
||||
public static function flagImg(string $locale): string
|
||||
{
|
||||
$svg = match ($locale) {
|
||||
'de' => '<svg class="flag" viewBox="0 0 24 16" aria-hidden="true" focusable="false">'
|
||||
. '<rect width="24" height="5.33" fill="#000"/>'
|
||||
. '<rect y="5.33" width="24" height="5.34" fill="#DD0000"/>'
|
||||
. '<rect y="10.67" width="24" height="5.33" fill="#FFCC00"/>'
|
||||
. '</svg>',
|
||||
'en' => '<svg class="flag" viewBox="0 0 24 16" aria-hidden="true" focusable="false">'
|
||||
. '<rect width="24" height="16" fill="#012169"/>'
|
||||
. '<path d="M0,0 L24,16 M24,0 L0,16" stroke="#fff" stroke-width="2.4"/>'
|
||||
. '<path d="M0,0 L24,16 M24,0 L0,16" stroke="#C8102E" stroke-width="1.2"/>'
|
||||
. '<path d="M12,0 V16 M0,8 H24" stroke="#fff" stroke-width="3.2"/>'
|
||||
. '<path d="M12,0 V16 M0,8 H24" stroke="#C8102E" stroke-width="1.6"/>'
|
||||
. '</svg>',
|
||||
'uk' => '<svg class="flag" viewBox="0 0 24 16" aria-hidden="true" focusable="false">'
|
||||
. '<rect width="24" height="8" fill="#005BBB"/>'
|
||||
. '<rect y="8" width="24" height="8" fill="#FFD500"/>'
|
||||
. '</svg>',
|
||||
'ru' => '<svg class="flag" viewBox="0 0 24 16" aria-hidden="true" focusable="false">'
|
||||
. '<rect width="24" height="5.33" fill="#fff"/>'
|
||||
. '<rect y="5.33" width="24" height="5.34" fill="#0039A6"/>'
|
||||
. '<rect y="10.67" width="24" height="5.33" fill="#D52B1E"/>'
|
||||
. '</svg>',
|
||||
default => '<svg class="flag" viewBox="0 0 24 16" aria-hidden="true" focusable="false">'
|
||||
. '<rect width="24" height="16" fill="#888"/>'
|
||||
. '</svg>',
|
||||
$src = self::flagSource($locale);
|
||||
// 32×24 = ~4:3, large enough that the flag is the visual
|
||||
// anchor of the option. No loading="lazy" — these are 4
|
||||
// small SVGs that must be ready the moment the <details>
|
||||
// opens (lazy would cause a flash of empty boxes).
|
||||
return '<img class="flag" src="' . $src . '" alt="" width="32" height="24">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Map our locale codes to flag-icons file names. Locale "en"
|
||||
* is en-GB per ADR-002, so the asset is "gb.svg". Anything we
|
||||
* do not know falls back to a transparent 1×1 gif so the layout
|
||||
* stays intact and the alt text (from the surrounding <a>) is
|
||||
* the only signal.
|
||||
*/
|
||||
private static function flagSource(string $locale): string
|
||||
{
|
||||
$file = match ($locale) {
|
||||
'de' => 'de',
|
||||
'en' => 'gb',
|
||||
'uk' => 'ua',
|
||||
'ru' => 'ru',
|
||||
default => null,
|
||||
};
|
||||
return $svg;
|
||||
if ($file === null) {
|
||||
return 'data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAACAkQBADs=';
|
||||
}
|
||||
return '/img/flags/' . $file . '.svg';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -69,6 +69,10 @@ return [
|
||||
'gallery.kid1' => 'Kinderzimmer 1 · 21,7 m²',
|
||||
'gallery.kid2' => 'Kinderzimmer 2 · 15,7 m²',
|
||||
'gallery.kid_detail' => 'Kinderzimmer Detail',
|
||||
'gallery.kid_extra' => 'Kinderzimmer · Spielbereich',
|
||||
'gallery.bath2' => 'Badezimmer · 6,4 m²',
|
||||
'gallery.bath3' => 'Badezimmer · 5,8 m²',
|
||||
'gallery.bath4' => 'Badezimmer · Wellness',
|
||||
'gallery.guest' => 'Gästezimmer · 11,5 m²',
|
||||
'gallery.area1' => 'Wohnbereich',
|
||||
'gallery.area2' => 'Wohnbereich Detail',
|
||||
@@ -80,9 +84,11 @@ return [
|
||||
'gallery.alt.kid1' => 'Kinderzimmer 1 mit 21,7 m²',
|
||||
'gallery.alt.kid2' => 'Kinderzimmer 2 mit 15,7 m²',
|
||||
'gallery.alt.kid_detail' => 'Detailansicht Kinderzimmer',
|
||||
'gallery.alt.kid_extra' => 'Spielbereich im Kinderzimmer',
|
||||
'gallery.alt.guest' => 'Gästezimmer mit 11,5 m²',
|
||||
'gallery.alt.bath2' => 'Zweites Badezimmer im Haus',
|
||||
'gallery.alt.bath3' => 'Drittes Badezimmer im Haus',
|
||||
'gallery.alt.bath4' => 'Viertes Badezimmer im Haus',
|
||||
'gallery.alt.exterior' => 'Außenansicht des Einfamilienhauses',
|
||||
|
||||
// ─── Floor plans (Grundriss) ────────────────────────────────────────
|
||||
@@ -120,6 +126,10 @@ return [
|
||||
'floors.alt.og1' => 'Grundriss 1. Obergeschoss',
|
||||
'floors.alt.og2' => 'Grundriss 2. Obergeschoss',
|
||||
'floors.alt.attic' => 'Grundriss Dachboden',
|
||||
'floors.alt.eg_3d' => '3D-Ansicht Erdgeschoss',
|
||||
'floors.alt.og1_3d' => '3D-Ansicht 1. Obergeschoss',
|
||||
'floors.alt.og2_3d' => '3D-Ansicht 2. Obergeschoss',
|
||||
'floors.alt.attic_2' => 'Alternative Ansicht Dachboden',
|
||||
|
||||
// ─── Rent (Miete) ────────────────────────────────────────────────────
|
||||
'rent.eyebrow' => 'Mietkonditionen',
|
||||
|
||||
@@ -59,6 +59,10 @@ return [
|
||||
'gallery.kid1' => 'Child\'s room 1 · 21.7 m²',
|
||||
'gallery.kid2' => 'Child\'s room 2 · 15.7 m²',
|
||||
'gallery.kid_detail' => 'Child\'s room detail',
|
||||
'gallery.kid_extra' => 'Child\'s room · play area',
|
||||
'gallery.bath2' => 'Bathroom · 6.4 m²',
|
||||
'gallery.bath3' => 'Bathroom · 5.8 m²',
|
||||
'gallery.bath4' => 'Bathroom · wellness',
|
||||
'gallery.guest' => 'Guest room · 11.5 m²',
|
||||
'gallery.area1' => 'Living area',
|
||||
'gallery.area2' => 'Living area detail',
|
||||
@@ -70,9 +74,11 @@ return [
|
||||
'gallery.alt.kid1' => 'Child\'s room 1 with 21.7 m²',
|
||||
'gallery.alt.kid2' => 'Child\'s room 2 with 15.7 m²',
|
||||
'gallery.alt.kid_detail' => 'Child\'s room detail view',
|
||||
'gallery.alt.kid_extra' => 'Play area in the child\'s room',
|
||||
'gallery.alt.guest' => 'Guest room with 11.5 m²',
|
||||
'gallery.alt.bath2' => 'Second bathroom in the house',
|
||||
'gallery.alt.bath3' => 'Third bathroom in the house',
|
||||
'gallery.alt.bath4' => 'Fourth bathroom in the house',
|
||||
'gallery.alt.exterior' => 'Exterior view of the detached house',
|
||||
|
||||
'floors.eyebrow' => 'Layout',
|
||||
@@ -109,6 +115,10 @@ return [
|
||||
'floors.alt.og1' => 'Floor plan 1st upper floor',
|
||||
'floors.alt.og2' => 'Floor plan 2nd upper floor',
|
||||
'floors.alt.attic' => 'Floor plan attic',
|
||||
'floors.alt.eg_3d' => '3D view ground floor',
|
||||
'floors.alt.og1_3d' => '3D view 1st upper floor',
|
||||
'floors.alt.og2_3d' => '3D view 2nd upper floor',
|
||||
'floors.alt.attic_2' => 'Alternative view of the attic',
|
||||
|
||||
'rent.eyebrow' => 'Rental terms',
|
||||
'rent.aria' => 'Rental terms',
|
||||
|
||||
@@ -59,6 +59,10 @@ return [
|
||||
'gallery.kid1' => 'Детская 1 · 21,7 м²',
|
||||
'gallery.kid2' => 'Детская 2 · 15,7 м²',
|
||||
'gallery.kid_detail' => 'Деталь детской',
|
||||
'gallery.kid_extra' => 'Детская · игровая зона',
|
||||
'gallery.bath2' => 'Ванная · 6,4 м²',
|
||||
'gallery.bath3' => 'Ванная · 5,8 м²',
|
||||
'gallery.bath4' => 'Ванная · велнес',
|
||||
'gallery.guest' => 'Гостевая комната · 11,5 м²',
|
||||
'gallery.area1' => 'Жилая зона',
|
||||
'gallery.area2' => 'Деталь жилой зоны',
|
||||
@@ -70,9 +74,11 @@ return [
|
||||
'gallery.alt.kid1' => 'Детская комната 1 — 21,7 м²',
|
||||
'gallery.alt.kid2' => 'Детская комната 2 — 15,7 м²',
|
||||
'gallery.alt.kid_detail' => 'Детальный вид детской комнаты',
|
||||
'gallery.alt.kid_extra' => 'Игровая зона в детской комнате',
|
||||
'gallery.alt.guest' => 'Гостевая комната 11,5 м²',
|
||||
'gallery.alt.bath2' => 'Вторая ванная комната в доме',
|
||||
'gallery.alt.bath3' => 'Третья ванная комната в доме',
|
||||
'gallery.alt.bath4' => 'Четвертая ванная комната в доме',
|
||||
'gallery.alt.exterior' => 'Внешний вид частного дома',
|
||||
|
||||
'floors.eyebrow' => 'Планировка',
|
||||
@@ -109,6 +115,10 @@ return [
|
||||
'floors.alt.og1' => 'План второго этажа',
|
||||
'floors.alt.og2' => 'План третьего этажа',
|
||||
'floors.alt.attic' => 'План чердака',
|
||||
'floors.alt.eg_3d' => '3D-вид первого этажа',
|
||||
'floors.alt.og1_3d' => '3D-вид второго этажа',
|
||||
'floors.alt.og2_3d' => '3D-вид третьего этажа',
|
||||
'floors.alt.attic_2' => 'Альтернативный вид чердака',
|
||||
|
||||
'rent.eyebrow' => 'Условия аренды',
|
||||
'rent.aria' => 'Условия аренды',
|
||||
|
||||
@@ -59,6 +59,10 @@ return [
|
||||
'gallery.kid1' => 'Дитяча кімната 1 · 21,7 м²',
|
||||
'gallery.kid2' => 'Дитяча кімната 2 · 15,7 м²',
|
||||
'gallery.kid_detail' => 'Деталь дитячої кімнати',
|
||||
'gallery.kid_extra' => 'Дитяча кімната · ігрова зона',
|
||||
'gallery.bath2' => 'Ванна кімната · 6,4 м²',
|
||||
'gallery.bath3' => 'Ванна кімната · 5,8 м²',
|
||||
'gallery.bath4' => 'Ванна кімната · велнес',
|
||||
'gallery.guest' => 'Гостьова кімната · 11,5 м²',
|
||||
'gallery.area1' => 'Житлова зона',
|
||||
'gallery.area2' => 'Деталь житлової зони',
|
||||
@@ -70,9 +74,11 @@ return [
|
||||
'gallery.alt.kid1' => 'Дитяча кімната 1 — 21,7 м²',
|
||||
'gallery.alt.kid2' => 'Дитяча кімната 2 — 15,7 м²',
|
||||
'gallery.alt.kid_detail' => 'Детальний вигляд дитячої кімнати',
|
||||
'gallery.alt.kid_extra' => 'Ігрова зона в дитячій кімнаті',
|
||||
'gallery.alt.guest' => 'Гостьова кімната 11,5 м²',
|
||||
'gallery.alt.bath2' => 'Друга ванна кімната в будинку',
|
||||
'gallery.alt.bath3' => 'Третя ванна кімната в будинку',
|
||||
'gallery.alt.bath4' => 'Четверта ванна кімната в будинку',
|
||||
'gallery.alt.exterior' => 'Зовнішній вигляд приватного будинку',
|
||||
|
||||
'floors.eyebrow' => 'Планування',
|
||||
@@ -109,6 +115,10 @@ return [
|
||||
'floors.alt.og1' => 'План другого поверху',
|
||||
'floors.alt.og2' => 'План третього поверху',
|
||||
'floors.alt.attic' => 'План горища',
|
||||
'floors.alt.eg_3d' => '3D-вигляд першого поверху',
|
||||
'floors.alt.og1_3d' => '3D-вигляд другого поверху',
|
||||
'floors.alt.og2_3d' => '3D-вигляд третього поверху',
|
||||
'floors.alt.attic_2' => 'Альтернативний вигляд горища',
|
||||
|
||||
'rent.eyebrow' => 'Умови оренди',
|
||||
'rent.aria' => 'Умови оренди',
|
||||
|
||||
@@ -15,22 +15,27 @@ declare(strict_types=1);
|
||||
*/
|
||||
|
||||
$gridItems = [
|
||||
['img' => 'bilder/Außenansicht-2.png', 'key' => 'gallery.exterior', 'alt' => 'gallery.alt.exterior', 'class' => 'span-2 row-2'],
|
||||
['img' => 'bilder/Wohnzimmer-1.png', 'key' => 'gallery.living', 'alt' => 'gallery.alt.living', 'class' => 'span-2 row-1'],
|
||||
['img' => 'bilder/Küche-1.png', 'key' => 'gallery.kitchen', 'alt' => 'gallery.alt.kitchen', 'class' => ''],
|
||||
['img' => 'bilder/Schlafzimmer-1.png','key' => 'gallery.bedroom', 'alt' => 'gallery.alt.bedroom', 'class' => ''],
|
||||
['img' => 'bilder/Badezimmer-1.png', 'key' => 'gallery.bath', 'alt' => 'gallery.alt.bath', 'class' => ''],
|
||||
['img' => 'bilder/Kinderzimmer-1-1.png', 'key' => 'gallery.kid1', 'alt' => 'gallery.alt.kid1', 'class' => ''],
|
||||
['img' => 'bilder/Kinderzimmer-2.png','key' => 'gallery.kid2', 'alt' => 'gallery.alt.kid2', 'class' => ''],
|
||||
['img' => 'bilder/Kinderzimmer-Detail.png','key' => 'gallery.kid_detail', 'alt' => 'gallery.alt.kid_detail', 'class' => 'span-2 row-1'],
|
||||
['img' => 'bilder/Gästezimmer.png', 'key' => 'gallery.guest', 'alt' => 'gallery.alt.guest', 'class' => ''],
|
||||
['img' => 'bilder/Wohnbereich.png', 'key' => 'gallery.area1', 'alt' => 'gallery.alt.living', 'class' => ''],
|
||||
['img' => 'bilder/Wohnbereich-Detail.png', 'key' => 'gallery.area2', 'alt' => 'gallery.alt.living', 'class' => ''],
|
||||
['img' => 'bilder/Außenansicht-1.png','key' => 'gallery.area3', 'alt' => 'gallery.alt.exterior', 'class' => 'span-2 row-1'],
|
||||
// NOTE: image filenames reflect the actual files in public/bilder/ on the server.
|
||||
// 3 items were removed (gästezimmer / wohnbereich / wohnbereich-detail)
|
||||
// because no matching files exist in the image inventory.
|
||||
['img' => 'bilder/Außenansicht-2.png', 'key' => 'gallery.exterior', 'alt' => 'gallery.alt.exterior', 'class' => 'span-2 row-2'],
|
||||
['img' => 'bilder/wohnzimmer2.png', 'key' => 'gallery.living', 'alt' => 'gallery.alt.living', 'class' => 'span-2 row-1'],
|
||||
['img' => 'bilder/Küche 1.jpg', 'key' => 'gallery.kitchen', 'alt' => 'gallery.alt.kitchen', 'class' => ''],
|
||||
['img' => 'bilder/schlafzimmer.png', 'key' => 'gallery.bedroom', 'alt' => 'gallery.alt.bedroom', 'class' => ''],
|
||||
['img' => 'bilder/Bad.jpg', 'key' => 'gallery.bath', 'alt' => 'gallery.alt.bath', 'class' => ''],
|
||||
['img' => 'bilder/Bad-2.jpeg', 'key' => 'gallery.bath2', 'alt' => 'gallery.alt.bath2', 'class' => ''],
|
||||
['img' => 'bilder/Bad-3.jpeg', 'key' => 'gallery.bath3', 'alt' => 'gallery.alt.bath3', 'class' => ''],
|
||||
['img' => 'bilder/Bad-4.jpeg', 'key' => 'gallery.bath4', 'alt' => 'gallery.alt.bath4', 'class' => ''],
|
||||
['img' => 'bilder/Kinderzimmer 2.jpg', 'key' => 'gallery.kid1', 'alt' => 'gallery.alt.kid1', 'class' => ''],
|
||||
['img' => 'bilder/Kinderzimmer 3.jpg', 'key' => 'gallery.kid2', 'alt' => 'gallery.alt.kid2', 'class' => ''],
|
||||
['img' => 'bilder/kinderzimmer 2 2.webp', 'key' => 'gallery.kid_detail', 'alt' => 'gallery.alt.kid_detail', 'class' => 'span-2 row-1'],
|
||||
['img' => 'bilder/Kinderzimmer.png', 'key' => 'gallery.kid_extra', 'alt' => 'gallery.alt.kid_extra', 'class' => ''],
|
||||
['img' => 'bilder/Außenansicht-2.png', 'key' => 'gallery.area3', 'alt' => 'gallery.alt.exterior', 'class' => 'span-2 row-1'],
|
||||
];
|
||||
?>
|
||||
<header class="hero" id="hero">
|
||||
<img src="/bilder/hero-bg.jpg" alt="" class="hero-bg" id="heroBg" loading="eager" decoding="async" fetchpriority="high">
|
||||
<img src="/bilder/Außenansicht-2.webp" alt="" class="hero-bg" id="heroBg" loading="eager" decoding="async" fetchpriority="high">
|
||||
<div class="hero-overlay" aria-hidden="true"></div>
|
||||
<div class="hero-content" id="heroContent">
|
||||
<span class="hero-tag"><?= htmlspecialchars($t('hero.tag'), ENT_QUOTES) ?></span>
|
||||
<h1 class="hero-h1">
|
||||
@@ -44,7 +49,6 @@ $gridItems = [
|
||||
<li class="hero-meta-item"><?= htmlspecialchars($t('hero.rooms'), ENT_QUOTES) ?></li>
|
||||
<li class="hero-meta-item"><?= htmlspecialchars($t('hero.floors'), ENT_QUOTES) ?></li>
|
||||
</ul>
|
||||
<a class="hero-cta" href="#galerie"><?= htmlspecialchars($t('hero.discover'), ENT_QUOTES) ?> ↓</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -82,17 +86,17 @@ $gridItems = [
|
||||
</section>
|
||||
|
||||
<section class="gallery-section" id="galerie" aria-label="<?= htmlspecialchars($t('gallery.aria'), ENT_QUOTES) ?>">
|
||||
<div class="section-head">
|
||||
<div class="section-head gallery-header">
|
||||
<span class="section-eyebrow"><?= htmlspecialchars($t('gallery.eyebrow'), ENT_QUOTES) ?></span>
|
||||
<h2><?= htmlspecialchars($t('gallery.h2'), ENT_QUOTES) ?></h2>
|
||||
</div>
|
||||
<div class="gallery-grid">
|
||||
<div class="masonry-grid">
|
||||
<?php foreach ($gridItems as $item): ?>
|
||||
<button type="button" class="grid-item <?= htmlspecialchars($item['class'], ENT_QUOTES) ?>"
|
||||
<button type="button" class="grid-item"
|
||||
data-img="<?= htmlspecialchars($item['img'], ENT_QUOTES) ?>"
|
||||
aria-label="<?= htmlspecialchars($t($item['key']) . $t('gallery.zoom'), ENT_QUOTES) ?>">
|
||||
<img src="/<?= htmlspecialchars($item['img'], ENT_QUOTES) ?>" alt="<?= htmlspecialchars($t($item['alt']), ENT_QUOTES) ?>" loading="lazy" decoding="async">
|
||||
<span class="grid-caption"><?= htmlspecialchars($t($item['key']), ENT_QUOTES) ?></span>
|
||||
<span class="grid-item-label"><?= htmlspecialchars($t($item['key']), ENT_QUOTES) ?></span>
|
||||
</button>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
@@ -105,6 +109,20 @@ $gridItems = [
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$floorImageMap = [
|
||||
'eg' => 'bilder/grundrisse/EG.png',
|
||||
'og1' => 'bilder/grundrisse/OG 1 2.png',
|
||||
'og2' => 'bilder/grundrisse/OG 2 grundriss.png',
|
||||
'attic' => 'bilder/grundrisse/Dachboden unten.png',
|
||||
];
|
||||
|
||||
$floorImageMapExtra = [
|
||||
'eg' => ['img' => 'bilder/grundrisse/EG 3D.png', 'altKey' => 'floors.alt.eg_3d'],
|
||||
'og1' => ['img' => 'bilder/grundrisse/OG 1 3D.png', 'altKey' => 'floors.alt.og1_3d'],
|
||||
'og2' => ['img' => 'bilder/grundrisse/OG 2 3D.png', 'altKey' => 'floors.alt.og2_3d'],
|
||||
'attic' => ['img' => 'bilder/grundrisse/Dachboden unten 2.png', 'altKey' => 'floors.alt.attic_2'],
|
||||
];
|
||||
|
||||
$floors = [
|
||||
['id' => 'eg', 'titleKey' => 'floors.eg.title', 'areaKey' => 'floors.eg.area', 'altKey' => 'floors.alt.eg',
|
||||
'rooms' => [
|
||||
@@ -146,12 +164,26 @@ $gridItems = [
|
||||
<summary class="floor-header">
|
||||
<span class="floor-title"><?= htmlspecialchars($t($floor['titleKey']), ENT_QUOTES) ?></span>
|
||||
<span class="floor-area"><?= htmlspecialchars($t($floor['areaKey']), ENT_QUOTES) ?></span>
|
||||
<span class="floor-icon" aria-hidden="true">+</span>
|
||||
</summary>
|
||||
<div class="floor-body">
|
||||
<img src="/bilder/grundriss-<?= htmlspecialchars($floor['id'], ENT_QUOTES) ?>.png"
|
||||
alt="<?= htmlspecialchars($t($floor['altKey']), ENT_QUOTES) ?>"
|
||||
loading="lazy" decoding="async"
|
||||
class="floor-plan-img">
|
||||
<?php
|
||||
$primaryImg = $floorImageMap[$floor['id']] ?? 'bilder/grundrisse/EG.png';
|
||||
$extra = $floorImageMapExtra[$floor['id']] ?? null;
|
||||
$wrapperCls = $extra ? 'floor-plan-multi' : 'floor-plan';
|
||||
?>
|
||||
<div class="<?= htmlspecialchars($wrapperCls, ENT_QUOTES) ?>">
|
||||
<img src="/<?= htmlspecialchars($primaryImg, ENT_QUOTES) ?>"
|
||||
alt="<?= htmlspecialchars($t($floor['altKey']), ENT_QUOTES) ?>"
|
||||
loading="lazy" decoding="async"
|
||||
class="floor-plan-img">
|
||||
<?php if ($extra !== null): ?>
|
||||
<img src="/<?= htmlspecialchars($extra['img'], ENT_QUOTES) ?>"
|
||||
alt="<?= htmlspecialchars($t($extra['altKey']), ENT_QUOTES) ?>"
|
||||
loading="lazy" decoding="async"
|
||||
class="floor-plan-img">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<ul class="room-list">
|
||||
<?php foreach ($floor['rooms'] as $room): ?>
|
||||
<li>
|
||||
@@ -225,17 +257,17 @@ $gridItems = [
|
||||
<span class="lage-feature-desc"><?= htmlspecialchars($t('loc.center_desc'), ENT_QUOTES) ?></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="lage-map">
|
||||
<iframe
|
||||
title="<?= htmlspecialchars($t('loc.map_title'), ENT_QUOTES) ?>"
|
||||
src="https://www.openstreetmap.org/export/embed.html?bbox=10.7535%2C50.5095%2C10.7705%2C50.5185&layer=mapnik&marker=50.5140%2C10.7620"
|
||||
loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
|
||||
<p class="lage-address">
|
||||
<strong><?= htmlspecialchars($t('loc.address'), ENT_QUOTES) ?>:</strong><br>
|
||||
<?= /* address HTML is XSS-safe — composed of trusted translations */ $t('loc.address_val') ?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="lage-map-wrapper">
|
||||
<iframe
|
||||
title="<?= htmlspecialchars($t('loc.map_title'), ENT_QUOTES) ?>"
|
||||
src="https://www.openstreetmap.org/export/embed.html?bbox=10.7424%2C50.5072%2C10.7524%2C50.5108&layer=mapnik&marker=50.5090%2C10.7474"
|
||||
loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
|
||||
<p class="lage-address">
|
||||
<strong><?= htmlspecialchars($t('loc.address'), ENT_QUOTES) ?>:</strong><br>
|
||||
<?= /* address HTML is XSS-safe — composed of trusted translations */ $t('loc.address_val') ?>
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -266,7 +298,7 @@ $gridItems = [
|
||||
<form class="contact-form" method="post" action="/#kontakt" novalidate>
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token'] ?? '', ENT_QUOTES) ?>">
|
||||
<input type="hidden" name="form_time" value="<?= htmlspecialchars((string) time(), ENT_QUOTES) ?>">
|
||||
<div class="form-hp" aria-hidden="true">
|
||||
<div class="hp-field" aria-hidden="true">
|
||||
<label for="website-hp"><?= htmlspecialchars($t('contact.hp_label'), ENT_QUOTES) ?></label>
|
||||
<input type="text" id="website-hp" name="website" tabindex="-1" autocomplete="off">
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,7 @@ $canonical = $canonical ?? $canonicalBase . ($currentPath === '/' ? '
|
||||
$siteName = I18n::t('site.name', [], $locale);
|
||||
$ogTitle = $openGraph['ogTitle'] ?? $title;
|
||||
$ogDescription = $openGraph['ogDescription'] ?? $description;
|
||||
$ogImage = $openGraph['ogImage'] ?? 'https://haus-schleusingen.de/bilder/Aussenansicht-2.webp';
|
||||
$ogImage = $openGraph['ogImage'] ?? 'https://haus-schleusingen.de/bilder/Außenansicht-2.png';
|
||||
$ogUrl = $openGraph['ogUrl'] ?? $canonical;
|
||||
$hreflangs = Locale::hreflangAlternates($currentPath === '/' ? '/' : $currentPath, $canonicalBase);
|
||||
|
||||
@@ -72,14 +72,14 @@ $navItems = [
|
||||
<meta property="og:description" content="<?= htmlspecialchars($ogDescription ?? $pageDescription ?? $t('site.description'), ENT_QUOTES) ?>">
|
||||
<meta property="og:locale" content="<?= htmlspecialchars($ogLocale ?? Locale::toOgLocale($locale), ENT_QUOTES) ?>">
|
||||
<meta property="og:site_name" content="<?= htmlspecialchars($ogSiteName ?? $t('site.name'), ENT_QUOTES) ?>">
|
||||
<meta property="og:image" content="<?= htmlspecialchars($ogImage ?? ($t('site.canonical_base') . '/bilder/hero-bg.jpg'), ENT_QUOTES) ?>">
|
||||
<meta property="og:image" content="<?= htmlspecialchars($ogImage ?? ($t('site.canonical_base') . '/bilder/Außenansicht-2.png'), ENT_QUOTES) ?>">
|
||||
|
||||
<?php if (isset($structuredData)): ?>
|
||||
<script type="application/ld+json"><?= $structuredData ?></script>
|
||||
<?php endif; ?>
|
||||
|
||||
<link rel="stylesheet" href="/fonts/fonts.css" />
|
||||
<link rel="stylesheet" href="/css/haus-schleusingen.css" />
|
||||
<link rel="stylesheet" href="/css/haus-schleusingen.css?v=<?= @filemtime(dirname(__DIR__, 3) . '/public/css/haus-schleusingen.css') ?: time() ?>" />
|
||||
<?php if (isset($extraCss)): ?>
|
||||
<style><?= $extraCss ?></style>
|
||||
<?php endif; ?>
|
||||
@@ -87,11 +87,10 @@ $navItems = [
|
||||
<body>
|
||||
<a class="skip-link" href="#main"><?= htmlspecialchars($t('nav.skip'), ENT_QUOTES) ?></a>
|
||||
|
||||
<nav id="navbar" class="scrolled" aria-label="<?= htmlspecialchars($t('nav.main'), ENT_QUOTES) ?>">
|
||||
<nav id="navbar" aria-label="<?= htmlspecialchars($t('nav.main'), ENT_QUOTES) ?>">
|
||||
<div class="nav-logo">
|
||||
<a href="<?= htmlspecialchars($homeUrl) ?>">
|
||||
<a href="<?= htmlspecialchars($homeUrl) ?>" aria-label="<?= htmlspecialchars($siteName, ENT_QUOTES) ?>">
|
||||
<span class="logo-icon" aria-hidden="true">🏠</span>
|
||||
<span class="logo-text"><?= htmlspecialchars($siteName) ?></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
cacheDirectory=".phpunit.cache"
|
||||
failOnWarning="true"
|
||||
failOnRisky="true"
|
||||
failOnEmptyTestSuite="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
failOnPhpunitWarning="false"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
5
public/img/flags/de.svg
Normal file
5
public/img/flags/de.svg
Normal file
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-de" viewBox="0 0 640 480">
|
||||
<path fill="#fc0" d="M0 320h640v160H0z"/>
|
||||
<path fill="#000001" d="M0 0h640v160H0z"/>
|
||||
<path fill="red" d="M0 160h640v160H0z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 221 B |
7
public/img/flags/gb.svg
Normal file
7
public/img/flags/gb.svg
Normal file
@@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-gb" viewBox="0 0 640 480">
|
||||
<path fill="#012169" d="M0 0h640v480H0z"/>
|
||||
<path fill="#FFF" d="m75 0 244 181L562 0h78v62L400 241l240 178v61h-80L320 301 81 480H0v-60l239-178L0 64V0z"/>
|
||||
<path fill="#C8102E" d="m424 281 216 159v40L369 281zm-184 20 6 35L54 480H0zM640 0v3L391 191l2-44L590 0zM0 0l239 176h-60L0 42z"/>
|
||||
<path fill="#FFF" d="M241 0v480h160V0zM0 160v160h640V160z"/>
|
||||
<path fill="#C8102E" d="M0 193v96h640v-96zM273 0v480h96V0z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 504 B |
5
public/img/flags/ru.svg
Normal file
5
public/img/flags/ru.svg
Normal file
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-ru" viewBox="0 0 640 480">
|
||||
<path fill="#fff" d="M0 0h640v160H0z"/>
|
||||
<path fill="#0039a6" d="M0 160h640v160H0z"/>
|
||||
<path fill="#d52b1e" d="M0 320h640v160H0z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 225 B |
6
public/img/flags/ua.svg
Normal file
6
public/img/flags/ua.svg
Normal file
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-ua" viewBox="0 0 640 480">
|
||||
<g fill-rule="evenodd" stroke-width="1pt">
|
||||
<path fill="gold" d="M0 0h640v480H0z"/>
|
||||
<path fill="#0057b8" d="M0 0h640v240H0z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 232 B |
@@ -11,19 +11,28 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Renders the language switcher widget and checks that:
|
||||
* - 4 items, one per supported locale,
|
||||
* - exactly one <details class="locale-switcher"> dropdown,
|
||||
* - 4 menu items, one per supported locale,
|
||||
* - the active locale is marked aria-current="true" and is a <span>,
|
||||
* - inactive locales are <a> links to /locale?set=...&return=...,
|
||||
* - every item contains a flag SVG,
|
||||
* - the trigger and every menu item contain a flag SVG,
|
||||
* - the rendered label is in the current locale's language.
|
||||
*/
|
||||
final class LocaleSwitcherTest extends TestCase
|
||||
{
|
||||
#[Test]
|
||||
public function rendersFourItemsForAllSupportedLocales(): void
|
||||
public function rendersSingleDropdownForAllSupportedLocales(): void
|
||||
{
|
||||
$html = (new LocaleSwitcher('en', '/'))->render();
|
||||
self::assertStringContainsString('<ul class="locale-switcher"', $html);
|
||||
|
||||
// exactly one <details class="locale-switcher"> (no -mobile suffix, no desktop <ul>)
|
||||
self::assertStringContainsString('<details class="locale-switcher">', $html);
|
||||
self::assertStringNotContainsString('locale-switcher-mobile', $html);
|
||||
self::assertStringNotContainsString('<ul class="locale-switcher"', $html);
|
||||
self::assertStringNotContainsString('locale-switcher__item', $html);
|
||||
|
||||
// the menu lists all 4 supported locales
|
||||
self::assertSame(4, substr_count($html, 'class="locale-switcher__option'), 'expected 4 menu options');
|
||||
|
||||
// The 3 inactive locales render as <a hreflang="..">. The active
|
||||
// locale renders as <span lang=".."> (no hreflang). Together all
|
||||
@@ -34,7 +43,9 @@ final class LocaleSwitcherTest extends TestCase
|
||||
"locale '$code' is missing from switcher",
|
||||
);
|
||||
}
|
||||
self::assertSame(4, substr_count($html, 'class="flag"'), 'expected 4 flag SVGs');
|
||||
|
||||
// 1 flag in trigger + 4 flags in menu = 5 total
|
||||
self::assertSame(5, substr_count($html, 'class="flag"'), 'expected 5 flag SVGs (1 trigger + 4 menu)');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
@@ -86,34 +97,35 @@ final class LocaleSwitcherTest extends TestCase
|
||||
public static function flagDataProvider(): array
|
||||
{
|
||||
return [
|
||||
'DE Germany' => ['de', '#FFCC00'],
|
||||
'EN UnionJack' => ['en', '#C8102E'],
|
||||
'UK Ukraine' => ['uk', '#FFD500'],
|
||||
'RU Russia' => ['ru', '#D52B1E'],
|
||||
'DE Germany' => ['de', 'de.svg'],
|
||||
'EN en-GB' => ['en', 'gb.svg'],
|
||||
'UK Ukraine' => ['uk', 'ua.svg'],
|
||||
'RU Russia' => ['ru', 'ru.svg'],
|
||||
];
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function flagSvgReturnsValidSvgForEverySupportedLocale(): void
|
||||
public function flagImgReturnsValidImgForEverySupportedLocale(): void
|
||||
{
|
||||
foreach (Locale::SUPPORTED as $code) {
|
||||
$svg = LocaleSwitcher::flagSvg($code);
|
||||
self::assertStringStartsWith('<svg', $svg);
|
||||
self::assertStringContainsString('viewBox="0 0 24 16"', $svg);
|
||||
self::assertStringContainsString('aria-hidden="true"', $svg);
|
||||
self::assertStringContainsString('focusable="false"', $svg);
|
||||
self::assertStringContainsString('class="flag"', $svg);
|
||||
self::assertStringEndsWith('</svg>', $svg);
|
||||
$img = LocaleSwitcher::flagImg($code);
|
||||
self::assertStringStartsWith('<img', $img);
|
||||
self::assertStringContainsString('class="flag"', $img);
|
||||
self::assertStringContainsString('width="32" height="24"', $img);
|
||||
self::assertStringContainsString('alt=""', $img);
|
||||
self::assertStringEndsWith('>', $img);
|
||||
}
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function flagSvgHasFallbackForUnknownLocale(): void
|
||||
public function flagImgHasFallbackForUnknownLocale(): void
|
||||
{
|
||||
$svg = LocaleSwitcher::flagSvg('xx');
|
||||
self::assertStringStartsWith('<svg', $svg);
|
||||
self::assertStringContainsString('class="flag"', $svg);
|
||||
self::assertStringEndsWith('</svg>', $svg);
|
||||
$img = LocaleSwitcher::flagImg('xx');
|
||||
self::assertStringStartsWith('<img', $img);
|
||||
self::assertStringContainsString('class="flag"', $img);
|
||||
// 1×1 transparent gif keeps the layout stable even when the
|
||||
// locale code is not one of our four.
|
||||
self::assertStringContainsString('data:image/gif', $img);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
@@ -125,4 +137,17 @@ final class LocaleSwitcherTest extends TestCase
|
||||
self::assertStringContainsString('aria-label="Sprache wählen"', $htmlDe);
|
||||
self::assertStringContainsString('aria-label="Choose language"', $htmlEn);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function triggerContainsCurrentLocaleFlag(): void
|
||||
{
|
||||
// The closed dropdown shows the current locale's flag in the trigger
|
||||
$html = (new LocaleSwitcher('de', '/'))->render();
|
||||
// The first <img class="flag"> in the document is the trigger and it
|
||||
// must point at the German flag asset under /img/flags/.
|
||||
$deFlag = LocaleSwitcher::flagImg('de');
|
||||
$pos = strpos($html, $deFlag);
|
||||
self::assertNotFalse($pos, 'expected German flag <img> in the trigger (first <img class="flag"> in document)');
|
||||
self::assertStringContainsString('src="/img/flags/de.svg"', $deFlag);
|
||||
}
|
||||
}
|
||||
|
||||
178
tests/Views/HomeGalleryInventoryTest.php
Normal file
178
tests/Views/HomeGalleryInventoryTest.php
Normal file
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Views;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Regression test for issue #80: all house images in public/bilder/ must be
|
||||
* referenced from the home view. Catches drift when new photos are added to
|
||||
* disk but not yet wired into the gallery or floor-plan map.
|
||||
*/
|
||||
final class HomeGalleryInventoryTest extends TestCase
|
||||
{
|
||||
private const VIEW_PATH = __DIR__ . '/../../app/views/home/index.php';
|
||||
private const BILDER_DIR = __DIR__ . '/../../public/bilder';
|
||||
|
||||
/** @var list<string> Files that may exist on disk but are intentionally NOT shown on the page. */
|
||||
private const ALLOWED_UNUSED = [
|
||||
// Hero / page background uses a .webp variant; the .png in bilder/ is the
|
||||
// gallery source. Hero-bg is referenced separately in the <header>.
|
||||
'favicon/',
|
||||
// -small.* variants are served as thumb hints by JS lazy-load optimization.
|
||||
'*-small.*',
|
||||
];
|
||||
|
||||
public function testAllBilderFilesAreReferencedInHomeView(): void
|
||||
{
|
||||
$view = file_get_contents(self::VIEW_PATH);
|
||||
self::assertNotFalse($view, 'Could not read home view');
|
||||
|
||||
$diskFiles = $this->listBilderFiles();
|
||||
self::assertNotEmpty($diskFiles, 'No files found in public/bilder/');
|
||||
|
||||
// Group files by base name (filename without extension) so the
|
||||
// .jpg/.png/.jpeg source + auto-generated .webp variant count as ONE image.
|
||||
$groups = [];
|
||||
foreach ($diskFiles as $relPath) {
|
||||
if ($this->isAllowedUnused($relPath)) {
|
||||
continue;
|
||||
}
|
||||
$groups[$this->baseOf($relPath)][] = $relPath;
|
||||
}
|
||||
|
||||
$missing = [];
|
||||
foreach ($groups as $base => $variants) {
|
||||
$hit = false;
|
||||
foreach ($variants as $v) {
|
||||
// View may reference raw or with leading slash.
|
||||
if (str_contains($view, $v) || str_contains($view, '/' . ltrim($v, '/'))) {
|
||||
$hit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$hit) {
|
||||
$missing[] = $base . ' (' . implode(', ', $variants) . ')';
|
||||
}
|
||||
}
|
||||
|
||||
self::assertSame(
|
||||
[],
|
||||
$missing,
|
||||
sprintf(
|
||||
"These image groups exist in public/bilder/ but are NOT referenced anywhere in the home view:\n - %s\n\nFix: add them to \$gridItems (gallery) or \$floorImageMap / \$floorImageMapExtra (floor plans), and add the matching Locale keys.",
|
||||
implode("\n - ", $missing),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGalleryContainsAllRequiredImages(): void
|
||||
{
|
||||
$view = file_get_contents(self::VIEW_PATH);
|
||||
self::assertNotFalse($view, 'Could not read home view');
|
||||
|
||||
$required = [
|
||||
// Bathrooms (3 new ones in addition to the existing Bad.jpg)
|
||||
'bilder/Bad.jpg',
|
||||
'bilder/Bad-2.jpeg',
|
||||
'bilder/Bad-3.jpeg',
|
||||
'bilder/Bad-4.jpeg',
|
||||
// Kids room extras
|
||||
'bilder/Kinderzimmer.png',
|
||||
// Floor plans 2D
|
||||
'bilder/grundrisse/EG.png',
|
||||
'bilder/grundrisse/OG 1 2.png',
|
||||
'bilder/grundrisse/OG 2 grundriss.png',
|
||||
'bilder/grundrisse/Dachboden unten.png',
|
||||
// Floor plans 3D / alternate
|
||||
'bilder/grundrisse/EG 3D.png',
|
||||
'bilder/grundrisse/OG 1 3D.png',
|
||||
'bilder/grundrisse/OG 2 3D.png',
|
||||
'bilder/grundrisse/Dachboden unten 2.png',
|
||||
];
|
||||
|
||||
$missing = array_values(array_filter($required, static fn (string $img) => !str_contains($view, $img)));
|
||||
|
||||
self::assertSame(
|
||||
[],
|
||||
$missing,
|
||||
sprintf(
|
||||
"Required images missing from home view:\n - %s",
|
||||
implode("\n - ", $missing),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testFloorPlanMapsCoverAllFloors(): void
|
||||
{
|
||||
$view = file_get_contents(self::VIEW_PATH);
|
||||
self::assertNotFalse($view, 'Could not read home view');
|
||||
|
||||
// Each floor in the $floors array must have an entry in BOTH maps
|
||||
// (primary 2D + extra 3D/alternate) so the floor body renders both.
|
||||
foreach (['eg', 'og1', 'og2', 'attic'] as $floorId) {
|
||||
self::assertStringContainsString(
|
||||
"'{$floorId}'",
|
||||
$view,
|
||||
"Floor '{$floorId}' not declared in home view",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string> relative paths (forward-slash, e.g. "grundrisse/EG.png")
|
||||
*/
|
||||
private function listBilderFiles(): array
|
||||
{
|
||||
$files = [];
|
||||
$iter = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator(self::BILDER_DIR, \FilesystemIterator::SKIP_DOTS),
|
||||
);
|
||||
|
||||
foreach ($iter as $file) {
|
||||
if (!$file->isFile()) {
|
||||
continue;
|
||||
}
|
||||
$rel = substr($file->getPathname(), strlen(self::BILDER_DIR) + 1);
|
||||
$rel = str_replace(DIRECTORY_SEPARATOR, '/', $rel);
|
||||
$files[] = $rel;
|
||||
}
|
||||
|
||||
sort($files);
|
||||
return $files;
|
||||
}
|
||||
|
||||
private function isAllowedUnused(string $relPath): bool
|
||||
{
|
||||
foreach (self::ALLOWED_UNUSED as $pattern) {
|
||||
if (str_ends_with($pattern, '/')) {
|
||||
// Directory prefix
|
||||
if (str_starts_with($relPath, $pattern)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// Glob-style match (only `*` supported, for `-small.*` variants)
|
||||
$regex = '#^' . str_replace('\\*', '.*', preg_quote($pattern, '#')) . '$#';
|
||||
if (preg_match($regex, $relPath) === 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base name = path minus extension. So "grundrisse/EG 3D.png" → "grundrisse/EG 3D",
|
||||
* and "Küche 1.jpg" → "Küche 1". Used to group source + auto-generated variants.
|
||||
*/
|
||||
private function baseOf(string $relPath): string
|
||||
{
|
||||
$dot = strrpos($relPath, '.');
|
||||
if ($dot === false || $dot === 0) {
|
||||
return $relPath;
|
||||
}
|
||||
return substr($relPath, 0, $dot);
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,7 @@ final class HomeViewA11yTest extends TestCase
|
||||
{
|
||||
$html = $this->renderHomeView(formErrors: [], formFieldErrors: [], formSuccess: false);
|
||||
|
||||
self::assertStringContainsString('class="form-hp"', $html);
|
||||
self::assertStringContainsString('class="hp-field"', $html);
|
||||
self::assertStringContainsString('aria-hidden="true"', $html);
|
||||
self::assertStringContainsString('tabindex="-1"', $html);
|
||||
self::assertStringContainsString('autocomplete="off"', $html);
|
||||
|
||||
Reference in New Issue
Block a user