di ogni puntata è la pagina per l'app (contentrpigplay), // che viene mostrata in un iframe. Le copertine arrivano da . $feeds = [ ['url' => "https://www.radiodiffusionelibera.com/podcast/feed/", 'source' => 'RDL', 'class' => 'source-rdl'], ['url' => "https://www.radiocitta105.it/podcast/feed/", 'source' => 'Radio Città 105', 'class' => 'source-rc105'], ]; /** * Scarica un feed con un tempo massimo di attesa (un sito lento non deve bloccare la pagina) e lo tiene in una * cache su file per 5 minuti: la pagina Podcast si apre spesso e i feed cambiano di rado. */ function rpi_load_feed(string $url) { $cache_file = sys_get_temp_dir() . '/rpigroupplay-feed-' . md5($url) . '.xml'; $cache_ttl = 300; if (is_file($cache_file) && (time() - filemtime($cache_file)) < $cache_ttl) { $xml = @simplexml_load_file($cache_file); if ($xml !== false) return $xml; } $ctx = stream_context_create(['http' => ['timeout' => 6, 'user_agent' => 'RPIGroupPlay/' . ($GLOBALS['version_app'] ?? '1.0')]]); $raw = @file_get_contents($url, false, $ctx); if ($raw === false || $raw === '') { // Rete assente: si usa la copia vecchia, se c'è return is_file($cache_file) ? @simplexml_load_file($cache_file) : false; } $xml = @simplexml_load_string($raw); if ($xml !== false) @file_put_contents($cache_file, $raw, LOCK_EX); return $xml; } $all_items = []; foreach ($feeds as $feed) { $rss = rpi_load_feed($feed['url']); if ($rss && isset($rss->channel->item)) { foreach ($rss->channel->item as $item) { $itunes = $item->children('itunes', true); $image = ''; if (isset($itunes->image)) { $image = (string)$itunes->image->attributes()->href; } $all_items[] = [ 'title' => (string)$item->title, 'link' => (string)$item->link, 'pubDate' => (string)$item->pubDate, 'timestamp' => strtotime((string)$item->pubDate) ?: 0, 'program' => (string)$item->category, 'image' => $image, 'source' => $feed['source'], 'class' => $feed['class'], ]; } } } // Dalla più recente usort($all_items, function ($a, $b) { return $b['timestamp'] - $a['timestamp']; }); function rpi_date_it(int $timestamp): string { static $months = ['', 'gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre']; if ($timestamp <= 0) return ''; return date('j', $timestamp) . ' ' . $months[(int)date('n', $timestamp)] . ' ' . date('Y', $timestamp); } ?>
'Podcast', 'title' => 'Riascolta le dirette', 'subtitle' => 'Le puntate dei programmi delle radio del gruppo, dalla più recente.', 'back' => ['page' => 'home', 'label' => 'Home'], ]); ?>
$item): ?>

Impossibile caricare i podcast al momento. Riprova più tardi.