PublicSiteController::url($page, $query); $theme = in_array($settings['public_site_theme'] ?? 'warm', ['warm','nature','minimal'], true) ? $settings['public_site_theme'] : 'warm'; $association = $settings['association_name'] ?: 'Association'; $viewFile = __DIR__ . '/' . $view; $requestPath = rtrim((string)(parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH) ?: '/'), '/') ?: '/'; $activePage = match($requestPath) { '/','/site' => 'home','/animaux','/site/animaux','/adoption','/site/animal' => 'animals','/presentation','/site/presentation' => 'about','/dons','/site/dons' => 'donation','/contact','/site/contact' => 'contact',default => '' }; $activeSpecies = (string)($selectedSpecies ?? ($animal['species'] ?? '')); $navClass = static fn (bool$active): string => $active ? ' class="active" aria-current="page"' : ''; $fullAddress = implode(', ', array_filter([$settings['association_address'] ?? '',trim(($settings['association_postal_code'] ?? '') . ' ' . ($settings['association_city'] ?? ''))])); $hasContactMap = $activePage === 'contact' && is_numeric($settings['association_latitude'] ?? null) && is_numeric($settings['association_longitude'] ?? null); if (!function_exists('public_age')) { function public_age(array$a): string { $months = null; if (!empty($a['birth_date'])) { $born = new DateTimeImmutable($a['birth_date']); $now = new DateTimeImmutable('today'); $months = max(0, $born->diff($now)->y * 12 + $born->diff($now)->m); } elseif (($a['birth_estimated_months'] ?? '') !== '') { $months = (int)$a['birth_estimated_months']; }if ($months === null) { return t('public_site.age_unknown'); }if ($months < 12) { return t('public_site.months', ['count' => $months]); }$years = intdiv($months, 12); $rest = $months % 12; return$rest ? t('public_site.years_months', ['years' => $years,'months' => $rest]) : t('public_site.years', ['count' => $years]); } } ?> <?= h($title . ' — ' . $association) ?>