{ return date('c', $t); } include __DIR__ . '/locale.php'; $sitemap = []; $sitemap[] = ['loc' => $url, 'priority' => 1, 'lastmod' => sitemap_date(strtotime(date('Y-m-d')))]; $city = new cityController(); $cities = $city->get($country); $rate = new rateModel(); if (isset($cities['cities'])) { foreach ($cities['cities'] as $city) { $sitemap[] = ['loc' => $url . 'events/' . $city['lat'] . '/' . $city['lng'] . '/' . round($city['distance']) . '/' . urlencode($city['name']), 'priority' => 0.9, 'lastmod' => sitemap_date(strtotime(date('Y-m-d')))]; } } $event = new eventModel(); $events = $event->allEventsForCountry($country); $hosts = []; foreach ($events as $e) { $date = $e['d_change'] ?: strtotime(date('Y-m-d')); $reviews = $rate->event_reviews($e['event_id'], true, 1) ?: []; if (isset($reviews[0]) && $reviews[0]['d_create'] > $date) { $date = $reviews[0]['d_create']; } $sitemap[] = ['loc' => $url . $e['host_url'] . '/' . $e['event_url'], 'priority' => 0.8, 'lastmod' => sitemap_date($date)]; if (isset($hosts[$e['host_url']])) { $hosts[$e['host_url']] = max($hosts[$e['host_url']], $date); } else { $hosts[$e['host_url']] = $date; } } foreach ($hosts as $host => $date) {