PublicSiteController::url($page, $query); $theme = in_array($settings['public_site_theme'] ?? 'warm', ['warm','nature','minimal','custom'], true) ? $settings['public_site_theme'] : 'warm'; $association = $settings['association_name'] ?: 'Association'; $siteName = trim((string)($settings['public_site_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); $socialNetworks = [ 'facebook' => ['Facebook','f'], 'instagram' => ['Instagram','โ'], 'youtube' => ['YouTube','โถ'], 'tiktok' => ['TikTok','โช'], 'whatsapp' => ['WhatsApp','โ'], 'linkedin' => ['LinkedIn','in'], 'x' => ['X','๐'], 'snapchat' => ['Snapchat','๐ป'], ]; 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]); } } ?>