feat: add last podcast from castopod

This commit is contained in:
2025-10-17 17:38:16 +04:00
parent b35dbde8c9
commit 0319fa20c3
9 changed files with 692 additions and 87 deletions
+64 -51
View File
@@ -27,6 +27,9 @@ setSecurityHeaders();
<?php if (defined('WORDPRESS_ENABLED') && WORDPRESS_ENABLED): ?>
<link rel="stylesheet" href="css/wordpress-posts.css?v=<?php echo filemtime('css/wordpress-posts.css'); ?>">
<?php endif; ?>
<?php if (defined('CASTOPOD_ENABLED') && CASTOPOD_ENABLED): ?>
<link rel="stylesheet" href="css/castopod-podcasts.css?v=<?php echo filemtime('css/castopod-podcasts.css'); ?>">
<?php endif; ?>
<!-- Favicons -->
<link rel="apple-touch-icon" sizes="180x180" href="img/apple-touch-icon.png">
@@ -104,67 +107,66 @@ setSecurityHeaders();
<!-- Hero Banner -->
<?php include 'includes/hero-section.php'; ?>
<!-- Container pour Mastodon et WordPress côte à côte -->
<div class="timeline-wordpress-container">
<div id="mt-container" class="mt-container">
<div class="mt-header">
<h2 class="mt-title">Fil d'actualités <i class="fab fa-mastodon"></i></h2>
</div>
<div class="mt-body" role="feed">
<div class="mt-loading-spinner"></div>
</div>
</div>
<!-- Section Articles WordPress (desktop à droite, mobile en dessous) -->
<?php if (defined('WORDPRESS_ENABLED') && WORDPRESS_ENABLED && !empty(WORDPRESS_URL)): ?>
<div class="wordpress-section">
<div class="wordpress-container">
<div class="wordpress-header">
<i class="fas fa-newspaper"></i>
Articles <?php if (!empty(WORDPRESS_URL)): ?>
<a href="<?php echo htmlspecialchars(WORDPRESS_URL); ?>"
target="_blank"
rel="noopener noreferrer"
title="Visiter <?php echo htmlspecialchars(parse_url(WORDPRESS_URL, PHP_URL_HOST)); ?>">
<?php echo htmlspecialchars(parse_url(WORDPRESS_URL, PHP_URL_HOST)); ?>
<!-- Section Podcasts Castopod -->
<?php if (defined('CASTOPOD_ENABLED') && CASTOPOD_ENABLED && defined('CASTOPOD_URL') && !empty(CASTOPOD_URL)): ?>
<div class="castopod-section">
<div class="castopod-container">
<div class="castopod-header">
<i class="fas fa-podcast"></i>
Podcasts
<?php if (!empty(CASTOPOD_URL)): ?>
<a href="<?php echo htmlspecialchars(CASTOPOD_URL); ?>"
target="_blank"
rel="noopener noreferrer"
title="Visiter <?php echo htmlspecialchars(parse_url(CASTOPOD_URL, PHP_URL_HOST)); ?>">
<?php echo htmlspecialchars(parse_url(CASTOPOD_URL, PHP_URL_HOST)); ?>
</a>
<?php endif; ?>
</div>
<div class="wordpress-posts-list">
<div class="castopod-episodes-list">
<?php
$wordpressPosts = getWordPressPosts();
if (empty($wordpressPosts)) {
echo '<div class="wordpress-no-posts">Aucun article disponible</div>';
$castopodEpisodes = getCastopodEpisodes();
if (empty($castopodEpisodes)) {
echo '<div class="castopod-no-episodes">Aucun épisode disponible</div>';
} else {
foreach ($wordpressPosts as $post):
foreach ($castopodEpisodes as $episode):
?>
<a href="<?php echo htmlspecialchars($post['link']); ?>"
class="wordpress-post-item"
target="_blank"
rel="noopener noreferrer"
title="<?php echo htmlspecialchars($post['title']); ?>">
<div class="wordpress-post-thumb">
<?php if (!empty($post['featured_image'])): ?>
<img src="<?php echo htmlspecialchars($post['featured_image']); ?>"
alt="<?php echo htmlspecialchars($post['title']); ?>"
loading="lazy">
<a href="<?php echo htmlspecialchars($episode['link']); ?>"
class="castopod-episode-item"
target="_blank"
rel="noopener noreferrer"
title="<?php echo htmlspecialchars($episode['title']); ?>">
<div class="castopod-episode-thumb">
<?php if (!empty($episode['image'])): ?>
<img src="<?php echo htmlspecialchars($episode['image']); ?>"
alt="<?php echo htmlspecialchars($episode['title']); ?>"
loading="lazy">
<div class="castopod-play-icon">
<i class="fas fa-play-circle"></i>
</div>
<?php else: ?>
<i class="fas fa-file-alt"></i>
<i class="fas fa-podcast"></i>
<?php endif; ?>
</div>
<div class="wordpress-post-info">
<h3 class="wordpress-post-title">
<?php echo htmlspecialchars($post['title']); ?>
<div class="castopod-episode-info">
<h3 class="castopod-episode-title">
<?php echo htmlspecialchars($episode['title']); ?>
</h3>
<div class="wordpress-post-meta">
<span><?php echo htmlspecialchars($post['date']); ?></span>
<?php if (!empty($post['author'])): ?>
<?php if (!empty($episode['podcastTitle'])): ?>
<div class="castopod-podcast-badge">
<i class="fas fa-podcast"></i> <?php echo htmlspecialchars($episode['podcastTitle']); ?>
</div>
<?php endif; ?>
<div class="castopod-episode-meta">
<span><i class="far fa-calendar"></i> <?php echo htmlspecialchars($episode['formattedDate']); ?></span>
<?php if (!empty($episode['formattedDuration'])): ?>
<span>•</span>
<span><?php echo htmlspecialchars($post['author']); ?></span>
<span><i class="far fa-clock"></i> <?php echo htmlspecialchars($episode['formattedDuration']); ?></span>
<?php endif; ?>
</div>
</div>
@@ -176,7 +178,18 @@ setSecurityHeaders();
</div>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
<!-- Container pour Mastodon et Castopod côte à côte -->
<div style="<?php if(defined('HERO_TYPE') && HERO_TYPE !== 'none'): echo 'grid-column: 1 / -1;'; endif; ?>" class="timeline-container">
<div id="mt-container" class="mt-container">
<div class="mt-header">
<h2 class="mt-title">Fil d'actualités <i class="fab fa-mastodon"></i></h2>
</div>
<div class="mt-body" role="feed">
<div class="mt-loading-spinner"></div>
</div>
</div>
</div>
</div>