89 lines
No EOL
3.2 KiB
PHP
89 lines
No EOL
3.2 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<!-- favicons -->
|
|
<link rel="apple-touch-icon" sizes="180x180"
|
|
href="assets/favicons/apple-touch-icon.png">
|
|
<link rel="icon" type="image/png" sizes="32x32"
|
|
href="assets/favicons/favicon-32x32.png">
|
|
<link rel="icon" type="image/png" sizes="16x16"
|
|
href="assets/favicons/favicon-16x16.png">
|
|
<link rel="manifest" href="assets/favicons/site.webmanifest">
|
|
<link rel="mask-icon"
|
|
href="assets/favicons/safari-pinned-tab.svg" color="#5bbad5">
|
|
<meta name="msapplication-TileColor" content="#da532c">
|
|
<meta name="theme-color" content="#ffffff">
|
|
<link rel="favicon" type="ico" href="assets/favicons/favicon.ico">
|
|
<!-- head data -->
|
|
<title>Le plus beau des voyages</title>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="stylesheet" href="scss/styles.css" />
|
|
</head>
|
|
<?php
|
|
$removeAcastBranding = function($text) {
|
|
return preg_replace(
|
|
"/<br \/>.+<\/p>/", "", $text
|
|
);
|
|
};
|
|
|
|
$formatDate = function($locale,$date) {
|
|
$fmt = new \IntlDateFormatter($locale, null, null);
|
|
$fmt->setPattern('d MMMM yyyy HH:mm');
|
|
$dateTimeCFF = DateTime::createFromFormat(
|
|
DateTime::RFC7231,
|
|
$date
|
|
);
|
|
return $fmt->format($dateTimeCFF);
|
|
};
|
|
|
|
$formatAudioData = function($rawAudioData) {
|
|
return "controls=true".
|
|
" src={$rawAudioData->url}".
|
|
" type={$rawAudioData->type}".
|
|
" length={$rawAudioData->length}";
|
|
};
|
|
|
|
$data = file_get_contents(
|
|
"https://feeds.acast.com/public/shows/le-plus-beau-des-voyages"
|
|
);
|
|
$xml = simplexml_load_string($data,'SimpleXMLElement', LIBXML_NOCDATA);
|
|
$podcast = (object) [
|
|
"title" => ucfirst(
|
|
strtolower($xml->channel->title)
|
|
),
|
|
"description" => $removeAcastBranding(
|
|
$xml->channel->description
|
|
),
|
|
"latestEpTitle" => $xml->channel->item[0]->title,
|
|
"latestEpPublicationDate" => $formatDate(
|
|
"fr_FR",$xml->channel->item[0]->pubDate
|
|
),
|
|
"latestEpDescription" => $removeAcastBranding(
|
|
$xml->channel->item[0]->description
|
|
),
|
|
"latestEpAudioData" => $formatAudioData($xml->channel->item[0]->enclosure->attributes())
|
|
];
|
|
?>
|
|
<body>
|
|
<!-- Header -->
|
|
<div class="Title">
|
|
<h1><?php echo $podcast->title ?></h1>
|
|
<p>Animé par Pauline</p>
|
|
</div>
|
|
<p><?php echo $podcast->description ?></p>
|
|
<!-- Latest episode -->
|
|
<h2>Dernier épisode :</h2>
|
|
<div class="Latest-Ep">
|
|
<img src="https://assets.pippa.io/shows/645f2650b6652d00118486b5/1685609690535-035baa450878ca2a6a8770e8d5c7f963.jpeg" alt="podcast logo" />
|
|
<div class="Latest-Ep-Header">
|
|
<h3><?php echo $podcast->latestEpTitle ?></h3>
|
|
<div><?php echo (string) $podcast->latestEpPublicationDate ?></div>
|
|
</div>
|
|
<div>
|
|
<div><?php echo $podcast->latestEpDescription ?></div>
|
|
<audio controls=true <?php echo $podcast->latestEpAudioData ?>>podcast audio</audio>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|