127 lines
7.1 KiB
PHP
127 lines
7.1 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
$translations = [
|
|
'en' => [
|
|
'page_title' => 'Compañía — Platonic Companion Booking',
|
|
'nav_companions' => 'Companions',
|
|
'nav_how_it_works' => 'How it Works',
|
|
'nav_matches' => 'My Matches',
|
|
'nav_logout' => 'Logout',
|
|
'hero_title_1' => 'Find your perfect',
|
|
'hero_title_2' => 'platonic',
|
|
'hero_title_3' => 'companion.',
|
|
'hero_lead' => 'Book vetted companions for dinner dates, movie nights, or city tours. Safe, secure, and strictly platonic.',
|
|
'search_where' => 'Where?',
|
|
'search_city_any' => 'Any City',
|
|
'search_activity' => 'Activity / Keyword',
|
|
'search_placeholder' => 'e.g. Dinner, Coffee, Casual Dates...',
|
|
'search_button' => 'Search Companions',
|
|
'featured_companions' => 'Discover Companions',
|
|
'no_companions_found' => 'No new companions found. Check back later!',
|
|
'clear_filters' => 'Clear Filters',
|
|
'verified' => 'Verified',
|
|
'rate_per_hour' => '/hr',
|
|
'like_button' => 'Like',
|
|
'dislike_button' => 'Dislike',
|
|
'matches_title' => 'Your Matches',
|
|
'matches_empty' => 'No matches yet. Keep swiping!',
|
|
'match_modal_title' => 'It\'s a Match!',
|
|
'match_modal_body' => 'You and {name} have liked each other.',
|
|
'match_modal_button' => 'Keep Swiping',
|
|
'footer_copyright' => 'Compañía. All rights reserved.',
|
|
'footer_coc' => 'Strict Code of Conduct: Sexual services are strictly prohibited.',
|
|
'footer_safety' => 'Read our Safety Guidelines',
|
|
],
|
|
'es' => [
|
|
'page_title' => 'Compañía — Reserva de Compañeros Platónicos',
|
|
'nav_companions' => 'Compañeros',
|
|
'nav_how_it_works' => 'Cómo Funciona',
|
|
'nav_matches' => 'Mis Matches',
|
|
'nav_logout' => 'Cerrar Sesión',
|
|
'hero_title_1' => 'Encuentra tu compañero',
|
|
'hero_title_2' => 'platónico',
|
|
'hero_title_3' => 'perfecto.',
|
|
'hero_lead' => 'Reserva compañeros verificados para cenas, noches de cine o tours por la ciudad. Seguro, protegido y estrictamente platónico.',
|
|
'search_where' => '¿Dónde?',
|
|
'search_city_any' => 'Cualquier ciudad',
|
|
'search_activity' => 'Actividad / Palabra Clave',
|
|
'search_placeholder' => 'Ej: Cena, Café, Citas Casuales...',
|
|
'search_button' => 'Buscar Compañeros',
|
|
'featured_companions' => 'Descubre Compañeros',
|
|
'no_companions_found' => 'No se encontraron nuevos compañeros. ¡Vuelve más tarde!',
|
|
'clear_filters' => 'Limpiar Filtros',
|
|
'verified' => 'Verificado',
|
|
'rate_per_hour' => '/hora',
|
|
'like_button' => 'Me gusta',
|
|
'dislike_button' => 'No me gusta',
|
|
'matches_title' => 'Tus Matches',
|
|
'matches_empty' => 'Aún no tienes matches. ¡Sigue deslizando!',
|
|
'match_modal_title' => '¡Es un Match!',
|
|
'match_modal_body' => 'A ti y a {name} se gustaron.',
|
|
'match_modal_button' => 'Seguir Deslizando',
|
|
'footer_copyright' => 'Compañía. Todos los derechos reservados.',
|
|
'footer_coc' => 'Código de Conducta Estricto: Los servicios sexuales están estrictamente prohibidos.',
|
|
'footer_safety' => 'Lee nuestras Guías de Seguridad',
|
|
],
|
|
];
|
|
|
|
function t($key, $replacements = []) {
|
|
global $lang, $translations;
|
|
// Fallback to session language if not passed explicitly
|
|
$current_lang = $lang ?? $_SESSION['lang'] ?? 'en';
|
|
$text = $translations[$current_lang][$key] ?? $key;
|
|
foreach ($replacements as $k => $v) {
|
|
$text = str_replace('{'.$k.'}', $v, $text);
|
|
}
|
|
return $text;
|
|
}
|
|
|
|
function render_companion_card($companion) {
|
|
if (!$companion) {
|
|
return '<div class="text-center py-5"><p class="text-muted fs-5">' . t('no_companions_found') . '</p></div>';
|
|
}
|
|
|
|
$companion['img'] = $companion['profile_photo_path'] ?? 'assets/images/avatar_placeholder.svg';
|
|
$verified_badge = $companion['is_verified'] ? '<div class="verified-badge"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" class="bi bi-patch-check-fill" viewBox="0 0 16 16"><path d="M10.067.87a2.89 2.89 0 0 0-4.134 0l-.622.638-.896-.011a2.89 2.89 0 0 0-2.924 2.924l.01.896-.636.622a2.89 2.89 0 0 0 0 4.134l.638.622-.011.896a2.89 2.89 0 0 0 2.924 2.924l.896-.01.622.636a2.89 2.89 0 0 0 4.134 0l.622-.638.896.011a2.89 2.89 0 0 0 2.924-2.924l-.01-.896.636-.622a2.89 2.89 0 0 0 0-4.134l-.638-.622.011-.896a2.89 2.89 0 0 0-2.924-2.924l-.896.01-.622-.636zm.93 5.395l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7.5 9.293l2.646-2.647a.5.5 0 0 1 .708.708z"/></svg> ' . t('verified') . '</div>' : '';
|
|
|
|
return '
|
|
<div class="card companion-card card-swipe" data-companion-id="'.$companion['user_id'].'">
|
|
<div class="companion-img-wrapper">
|
|
<img src="'.htmlspecialchars($companion['img']).'" alt="'.htmlspecialchars($companion['name']).'" class="companion-img">
|
|
'.$verified_badge.'
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<div>
|
|
<h3 class="companion-name">'.htmlspecialchars($companion['name']).', '.$companion['age'].'</h3>
|
|
<div class="companion-meta">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" class="bi bi-geo-alt-fill" viewBox="0 0 16 16"><path d="M8 16s6-5.686 6-10A6 6 0 0 0 2 6c0 4.314 6 10 6 10zm0-7a3 3 0 1 1 0-6 3 3 0 0 1 0 6z"/></svg>
|
|
'.htmlspecialchars($companion['city']).'
|
|
</div>
|
|
</div>
|
|
<div class="text-end">
|
|
<div class="rate-badge">'.number_format((float)($companion['hourly_rate'] ?? 0), 0).t('rate_per_hour').'</div>
|
|
<small class="text-muted">★ '.$companion['rating'].'</small>
|
|
</div>
|
|
</div>
|
|
<p class="companion-bio mt-2">'.htmlspecialchars($companion['bio']).'</p>
|
|
</div>
|
|
<div class="card-footer-swipe">
|
|
<div class="row g-0">
|
|
<div class="col">
|
|
<button class="btn btn-swipe btn-dislike" onclick="handleSwipe(\'dislike\', '.$companion['user_id'].')">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16"><path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z"/></svg>
|
|
</button>
|
|
</div>
|
|
<div class="col">
|
|
<button class="btn btn-swipe btn-like" onclick="handleSwipe(\'like\', '.$companion['user_id'].')">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-heart-fill" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 1.314C12.438-3.248 23.534 4.735 8 15-7.534 4.736 3.562-3.248 8 1.314z"/></svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>';
|
|
}
|
|
|