vers. 3.0.0 - nuova interfaccia app per mobile e desktop
Nuova UI disegnata sul tema RPIGroup Radio Theme dei siti del gruppo: guscio unico responsive (sidebar e player in basso da 900px, topbar e tab bar su telefono), player della radio persistente nel dock con now playing, HLS/MP3, volume e Media Session; pagine radio, tv, podcast (copertine e programma dal feed), player e pagine di testo rifatte; icone SVG inline al posto di Bootstrap, jQuery e Material Icons; font Bricolage Grotesque e Plus Jakarta Sans in locale; service worker v5, manifest con orientamento libero, icone PWA 192 e 384 rigenerate. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
0ee93d3b75
commit
24391c49ac
58 files changed
+5226
-16550
No files matched your search
+138
-206
@@ -1,206 +1,138 @@
|
||||
<?php
|
||||
header('Content-Type: text/html; charset=UTF-8');
|
||||
|
||||
// Feeds configuration
|
||||
$feeds = [
|
||||
['url' => "https://www.radiodiffusionelibera.com/podcast/feed/", 'source' => 'RDL'],
|
||||
['url' => "https://www.radiocitta105.it/podcast/feed/", 'source' => 'Radio Città 105']
|
||||
];
|
||||
|
||||
$all_items = [];
|
||||
foreach ($feeds as $feed) {
|
||||
// Caricamento feed con soppressione errori per non bloccare l'intera lista
|
||||
$rss = @simplexml_load_file($feed['url']);
|
||||
if ($rss && isset($rss->channel->item)) {
|
||||
foreach ($rss->channel->item as $item) {
|
||||
$all_items[] = [
|
||||
'title' => (string)$item->title,
|
||||
'link' => (string)$item->link,
|
||||
'pubDate' => (string)$item->pubDate,
|
||||
'timestamp' => strtotime((string)$item->pubDate),
|
||||
'source' => $feed['source']
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ordinamento cronologico decrescente (i più recenti in alto)
|
||||
usort($all_items, function($a, $b) {
|
||||
return $b['timestamp'] - $a['timestamp'];
|
||||
});
|
||||
|
||||
function formatDateItalian($dateString) {
|
||||
try {
|
||||
$date = new DateTime($dateString);
|
||||
$months = [
|
||||
'January' => 'Gennaio', 'February' => 'Febbraio', 'March' => 'Marzo',
|
||||
'April' => 'Aprile', 'May' => 'Maggio', 'June' => 'Giugno',
|
||||
'July' => 'Luglio', 'August' => 'Agosto', 'September' => 'Settembre',
|
||||
'October' => 'Ottobre', 'November' => 'Novembre', 'December' => 'Dicembre'
|
||||
];
|
||||
$formatted = $date->format('j F Y');
|
||||
return strtr($formatted, $months);
|
||||
} catch (Exception $e) {
|
||||
return $dateString;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<style>
|
||||
.podcast-container {
|
||||
position: relative;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.podcast-item {
|
||||
background: #ffffff;
|
||||
border-left: 5px solid #2a377e;
|
||||
border-radius: 12px;
|
||||
padding: 16px;
|
||||
margin-bottom: 15px;
|
||||
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
cursor: pointer;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
|
||||
border-top: 1px solid #f0f0f0;
|
||||
border-right: 1px solid #f0f0f0;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
.podcast-item:hover {
|
||||
/*transform: translateY(-4px);*/
|
||||
/*box-shadow: 0 12px 20px rgba(42, 55, 126, 0.15);*/
|
||||
background: #f8faff;
|
||||
}
|
||||
.podcast-source {
|
||||
display: inline-block;
|
||||
padding: 2px 10px;
|
||||
border-radius: 50px;
|
||||
font-size: 0.7rem;
|
||||
font-weight: 800;
|
||||
margin-bottom: 8px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
.source-rdl {
|
||||
background: #eef1ff;
|
||||
color: #2a377e;
|
||||
border: 1px solid #2a377e30;
|
||||
}
|
||||
.source-rc105 {
|
||||
background: #fff4e5;
|
||||
color: #e65100;
|
||||
border: 1px solid #e6510030;
|
||||
}
|
||||
.podcast-title {
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
font-size: 1.05rem;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.podcast-date {
|
||||
font-size: 0.8rem;
|
||||
color: #777;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
.podcast-date .material-icons {
|
||||
font-size: 14px;
|
||||
margin-right: 6px;
|
||||
color: #f7b835;
|
||||
}
|
||||
#podcast-detail {
|
||||
display: none;
|
||||
animation: slideIn 0s ease-out;
|
||||
position: fixed;
|
||||
background: #ffffff;
|
||||
top: 154px;
|
||||
max-width: 750px;
|
||||
min-width: 330px;
|
||||
width: 100%;
|
||||
left: calc(50% + 1px);
|
||||
transform: translateX(calc(-50% - 1px));
|
||||
}
|
||||
@keyframes slideIn {
|
||||
from { opacity: 0; transform: translateX(0); }
|
||||
to { opacity: 1; transform: translateX(0); }
|
||||
}
|
||||
.podcast-header-nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 0 20px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.podcast-iframe {
|
||||
width: 100%;
|
||||
height: calc(100vh - 290px);
|
||||
border: none;
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
||||
background: #f9f9f9;
|
||||
}
|
||||
.error-msg {
|
||||
text-align: center;
|
||||
padding: 40px 20px;
|
||||
color: #666;
|
||||
}
|
||||
.error-msg i {
|
||||
font-size: 48px;
|
||||
color: #ccc;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="radio-header" id="podcast-header" style="padding: 20px; margin: 0 0 20px 0; border-bottom: 1px solid #eee; display: flex; align-items: center; justify-content: space-between;position: sticky;top: 0px;z-index: 1;background: white;">
|
||||
<div class="left-controls" style="display: flex; align-items: center;">
|
||||
<a href="<?php echo $base_path; ?>/home" data-page="home" class="linkBox" style="color: #333; display: flex; align-items: center; text-decoration: none;">
|
||||
<span class="material-icons" style="font-size: 28px;">arrow_back</span>
|
||||
</a>
|
||||
<span style="font-size: 18px; font-weight: 600; color: #333; margin-left: 15px;">Podcast</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tec px-4">
|
||||
<div id="podcast-container" class="podcast-container">
|
||||
|
||||
<!-- Podcast List -->
|
||||
<div id="podcast-list">
|
||||
<?php if (!empty($all_items)): ?>
|
||||
<?php foreach ($all_items as $item): ?>
|
||||
<div class="podcast-item" onclick="openPodcast('<?php echo addslashes($item['link']); ?>', '<?php echo addslashes($item['title']); ?>')">
|
||||
<div class="podcast-source <?php echo $item['source'] === 'RDL' ? 'source-rdl' : 'source-rc105'; ?>">
|
||||
<?php echo $item['source']; ?>
|
||||
</div>
|
||||
<div class="podcast-title"><?php echo $item['title']; ?></div>
|
||||
<div class="podcast-date">
|
||||
<span class="material-icons">calendar_today</span>
|
||||
<?php echo formatDateItalian($item['pubDate']); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<div class="error-msg">
|
||||
<span class="material-icons">rss_feed</span>
|
||||
<p>Impossibile caricare i podcast al momento. Riprova più tardi.</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- Podcast Detail (Iframe) -->
|
||||
<div id="podcast-detail">
|
||||
<div class="radio-header" style="padding: 20px; border-bottom: 1px solid #eee; display: flex; align-items: center; justify-content: space-between;position: relative;background: white; z-index: 5;">
|
||||
<div class="left-controls" style="display: flex; align-items: center;">
|
||||
<div class="back-to-list" onclick="closePodcast()" class="linkBox" style="color: #333; display: flex; align-items: center; text-decoration: none; cursor: pointer;">
|
||||
<span class="material-icons" style="font-size: 28px;">arrow_back</span>
|
||||
</div>
|
||||
<span style="font-size: 18px; font-weight: 600; color: #333; margin-left: 15px;">Torna ai podcast</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<iframe id="podcast-iframe" class="podcast-iframe" src="about:blank"></iframe>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
// Feed RSS dei podcast delle radio del gruppo. Il <link> di ogni puntata è la pagina per l'app (contentrpigplay),
|
||||
// che viene mostrata in un iframe. Le copertine arrivano da <itunes:image>.
|
||||
$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);
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="podcast-page" id="podcast-page">
|
||||
|
||||
<!-- Elenco delle puntate -->
|
||||
<div id="podcast-list" class="podcast-list">
|
||||
<?php rpi_page_header([
|
||||
'eyebrow' => 'Podcast',
|
||||
'title' => 'Riascolta le dirette',
|
||||
'subtitle' => 'Le puntate dei programmi delle radio del gruppo, dalla più recente.',
|
||||
'back' => ['page' => 'home', 'label' => 'Home'],
|
||||
]); ?>
|
||||
|
||||
<div class="page">
|
||||
<div class="container">
|
||||
<?php if (!empty($all_items)): ?>
|
||||
<div class="podcast-grid">
|
||||
<?php foreach ($all_items as $i => $item): ?>
|
||||
<article class="card card-link podcast-card" role="button" tabindex="0"
|
||||
data-podcast-url="<?= htmlspecialchars($item['link']) ?>"
|
||||
data-podcast-title="<?= htmlspecialchars($item['title']) ?>"
|
||||
data-podcast-source="<?= htmlspecialchars($item['source']) ?>">
|
||||
<div class="cover">
|
||||
<?php if ($item['image'] !== ''): ?>
|
||||
<img src="<?= htmlspecialchars($item['image']) ?>" alt="" loading="<?= $i < 3 ? 'eager' : 'lazy' ?>" decoding="async">
|
||||
<?php else: ?>
|
||||
<span class="cover-fallback"><?= rpi_icon('mic', 36) ?></span>
|
||||
<?php endif; ?>
|
||||
<span class="play" aria-hidden="true"><?= rpi_icon('play', 20) ?></span>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="chips">
|
||||
<span class="chip <?= $item['class'] ?>"><?= htmlspecialchars($item['source']) ?></span>
|
||||
<?php if ($item['program'] !== ''): ?><span class="chip chip-brand"><?= htmlspecialchars($item['program']) ?></span><?php endif; ?>
|
||||
</div>
|
||||
<h3><?= htmlspecialchars($item['title']) ?></h3>
|
||||
<time datetime="<?= $item['timestamp'] ? date('Y-m-d', $item['timestamp']) : '' ?>">
|
||||
<?= rpi_icon('calendar', 14) ?> <?= rpi_date_it($item['timestamp']) ?>
|
||||
</time>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="empty-state">
|
||||
<?= rpi_icon('rss', 40) ?>
|
||||
<p>Impossibile caricare i podcast al momento. Riprova più tardi.</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Puntata aperta (pagina del sito per l'app, in un iframe) -->
|
||||
<div id="podcast-detail" class="podcast-detail" hidden>
|
||||
<div class="view-bar">
|
||||
<button type="button" class="back-pill" data-podcast-close>
|
||||
<?= rpi_icon('arrow-left', 18) ?> Podcast
|
||||
</button>
|
||||
<div class="view-title">
|
||||
<strong id="podcast-detail-title"></strong>
|
||||
<span id="podcast-detail-source"></span>
|
||||
</div>
|
||||
</div>
|
||||
<iframe id="podcast-iframe" class="contentplayer" src="about:blank" title="Puntata del podcast" allow="autoplay"></iframe>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
Reference in new issue
Block a user