478 lines
24 KiB
PHP
478 lines
24 KiB
PHP
<?php
|
|
require_once 'includes/config.php';
|
|
require_once 'includes/structured-data.php';
|
|
require_once 'includes/social/youtube.php';
|
|
require_once 'includes/social/stats.php';
|
|
require_once 'includes/wordpress.php';
|
|
setSecurityHeaders();
|
|
|
|
if (defined('COUNTDOWN_ENABLED') && COUNTDOWN_ENABLED === true) {
|
|
require_once 'countdown.php';
|
|
exit;
|
|
}
|
|
|
|
$youtubeVideos = getYouTubeLatestVideos(defined('YOUTUBE_VIDEOS_COUNT') ? YOUTUBE_VIDEOS_COUNT : 6);
|
|
$wordpressPosts = (defined('WORDPRESS_ENABLED') && WORDPRESS_ENABLED) ? getWordPressPosts() : [];
|
|
$youtubeSubscribers = getYouTubeSubscriberCount();
|
|
$instagramFollowers = getInstagramFollowers();
|
|
$tiktokFollowers = getTikTokFollowers();
|
|
$wordpressPostCount = getWordPressPostCount();
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="csrf-token" content="<?php echo generateCSRFToken(); ?>">
|
|
<title><?php echo htmlspecialchars(SITE_NAME); ?> - Plateforme Multimédia</title>
|
|
<link rel="stylesheet" href="css/styles.css?v=<?php echo filemtime('css/styles.css'); ?>">
|
|
<link rel="stylesheet" href="css/social.css?v=<?php echo filemtime('css/social.css'); ?>">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css">
|
|
|
|
<!-- Favicons -->
|
|
<link rel="apple-touch-icon" sizes="180x180" href="img/apple-touch-icon.png">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon-16x16.png">
|
|
<link rel="manifest" href="site.webmanifest">
|
|
<link rel="icon" type="image/x-icon" href="img/favicon.ico">
|
|
<meta name="theme-color" content="#FF0000">
|
|
|
|
<!-- PWA -->
|
|
<meta name="mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
|
<meta name="apple-mobile-web-app-title" content="<?php echo htmlspecialchars(SITE_NAME); ?>">
|
|
<meta name="application-name" content="<?php echo htmlspecialchars(SITE_NAME); ?>">
|
|
<meta name="msapplication-TileColor" content="#FF0000">
|
|
<meta name="msapplication-config" content="browserconfig.xml">
|
|
|
|
<!-- Open Graph -->
|
|
<meta property="og:title" content="<?php echo htmlspecialchars(SITE_NAME); ?> - Plateforme Multimédia">
|
|
<meta property="og:description" content="<?php echo htmlspecialchars(SITE_DESCRIPTION); ?>">
|
|
<meta property="og:image" content="<?php echo 'https://' . $_SERVER['HTTP_HOST'] . '/img/logo.png'; ?>">
|
|
<meta property="og:url" content="<?php echo 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>">
|
|
<meta property="og:type" content="website">
|
|
<meta property="og:site_name" content="<?php echo htmlspecialchars(SITE_NAME); ?>">
|
|
<meta property="og:locale" content="fr_FR">
|
|
|
|
<!-- Twitter Card -->
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta name="twitter:title" content="<?php echo htmlspecialchars(SITE_NAME); ?> - Plateforme Multimédia">
|
|
<meta name="twitter:description" content="<?php echo htmlspecialchars(SITE_DESCRIPTION); ?>">
|
|
<meta name="twitter:image" content="<?php echo 'https://' . $_SERVER['HTTP_HOST'] . '/img/logo.png'; ?>">
|
|
|
|
<?php
|
|
$websiteJsonLd = generateWebSiteJsonLd();
|
|
outputJsonLd($websiteJsonLd);
|
|
?>
|
|
|
|
<script>
|
|
(function() {
|
|
const savedTheme = localStorage.getItem('theme');
|
|
const systemPrefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
if (savedTheme === 'dark' || (!savedTheme && systemPrefersDark)) {
|
|
document.documentElement.setAttribute('data-theme', 'dark');
|
|
}
|
|
})();
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<?php include 'includes/sidebar.php'; ?>
|
|
|
|
<main class="main-content" id="main-content" role="main">
|
|
<?php include 'includes/header.php'; ?>
|
|
|
|
<!-- ====== HERO ====== -->
|
|
<section class="social-hero" aria-labelledby="hero-title">
|
|
<div class="social-hero-inner">
|
|
<div class="social-hero-brand">
|
|
<img src="img/logo.png" alt="<?php echo htmlspecialchars(SITE_NAME); ?>" class="social-hero-logo">
|
|
<div class="social-hero-text">
|
|
<h1 id="hero-title"><?php echo htmlspecialchars(SITE_NAME); ?></h1>
|
|
<p><?php echo htmlspecialchars(SITE_DESCRIPTION); ?></p>
|
|
</div>
|
|
</div>
|
|
<nav class="platform-nav" aria-label="Accès aux plateformes">
|
|
<div class="platform-badge-wrap">
|
|
<a href="#youtube" class="platform-badge platform-youtube">
|
|
<i class="fab fa-youtube" aria-hidden="true"></i>
|
|
<span>YouTube</span>
|
|
</a>
|
|
<?php if ($youtubeSubscribers !== null): ?>
|
|
<span class="platform-badge-count"><?php echo formatFollowerCount($youtubeSubscribers); ?></span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="platform-badge-wrap">
|
|
<a href="#instagram" class="platform-badge platform-instagram">
|
|
<i class="fab fa-instagram" aria-hidden="true"></i>
|
|
<span>Instagram</span>
|
|
</a>
|
|
<?php if ($instagramFollowers !== null): ?>
|
|
<span class="platform-badge-count"><?php echo formatFollowerCount($instagramFollowers); ?></span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="platform-badge-wrap">
|
|
<a href="#tiktok" class="platform-badge platform-tiktok">
|
|
<i class="fab fa-tiktok" aria-hidden="true"></i>
|
|
<span>TikTok</span>
|
|
</a>
|
|
<?php if ($tiktokFollowers !== null): ?>
|
|
<span class="platform-badge-count"><?php echo formatFollowerCount($tiktokFollowers); ?></span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="platform-badge-wrap">
|
|
<a href="#actualites" class="platform-badge platform-wp">
|
|
<i class="fas fa-newspaper" aria-hidden="true"></i>
|
|
<span>Actualités</span>
|
|
</a>
|
|
<?php if ($wordpressPostCount !== null): ?>
|
|
<span class="platform-badge-count"><?php echo formatFollowerCount($wordpressPostCount); ?> art.</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
</nav>
|
|
</div>
|
|
</section>
|
|
|
|
<hr class="section-divider">
|
|
|
|
<!-- ====== YOUTUBE ====== -->
|
|
<section id="youtube" class="social-section" aria-labelledby="youtube-heading">
|
|
<div class="social-section-header platform-youtube-header">
|
|
<div class="social-section-header-left">
|
|
<i class="fab fa-youtube" aria-hidden="true"></i>
|
|
<h2 id="youtube-heading">YouTube</h2>
|
|
<span class="platform-handle">@<?php echo htmlspecialchars(YOUTUBE_HANDLE); ?></span>
|
|
<?php if ($youtubeSubscribers !== null): ?>
|
|
<span class="platform-stat-badge">
|
|
<i class="fas fa-users" aria-hidden="true"></i>
|
|
<?php echo formatFollowerCount($youtubeSubscribers); ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<a href="<?php echo htmlspecialchars(YOUTUBE_URL); ?>"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="platform-cta-btn platform-youtube-btn">
|
|
<i class="fab fa-youtube" aria-hidden="true"></i> S'abonner
|
|
</a>
|
|
</div>
|
|
|
|
<?php if (!empty($youtubeVideos)):
|
|
$ytShorts = array_values(array_filter($youtubeVideos, fn($v) => $v['isShort'] ?? false));
|
|
$ytRegular = array_values(array_filter($youtubeVideos, fn($v) => !($v['isShort'] ?? false)));
|
|
?>
|
|
|
|
<?php if (!empty($ytShorts)): ?>
|
|
<div class="yt-subgrid-label">
|
|
<i class="fas fa-film" aria-hidden="true"></i> Shorts
|
|
</div>
|
|
<div class="video-grid social-video-grid social-shorts-grid">
|
|
<?php foreach ($ytShorts as $video): ?>
|
|
<a href="<?php echo htmlspecialchars($video['url']); ?>"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="video-card social-video-card video-card--short"
|
|
aria-label="<?php echo htmlspecialchars($video['title']); ?>">
|
|
<div class="video-thumbnail">
|
|
<img src="<?php echo htmlspecialchars($video['thumbnail']); ?>"
|
|
alt="<?php echo htmlspecialchars($video['title']); ?>"
|
|
loading="lazy">
|
|
<div class="video-play-icon" aria-hidden="true">
|
|
<i class="fab fa-youtube youtube-play-icon"></i>
|
|
</div>
|
|
<span class="short-badge" aria-label="YouTube Short">
|
|
<i class="fas fa-film" aria-hidden="true"></i> #Shorts
|
|
</span>
|
|
</div>
|
|
<div class="video-info">
|
|
<h3 class="video-title"><?php echo htmlspecialchars($video['title']); ?></h3>
|
|
<div class="video-metadata">
|
|
<span class="video-date">
|
|
<i class="far fa-calendar-alt" aria-hidden="true"></i>
|
|
<?php echo htmlspecialchars(formatDate($video['publishedAt'])); ?>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty($ytRegular)): ?>
|
|
<div class="yt-subgrid-label">
|
|
<i class="fab fa-youtube" aria-hidden="true"></i> Vidéos
|
|
</div>
|
|
<div class="video-grid social-video-grid">
|
|
<?php foreach ($ytRegular as $video): ?>
|
|
<a href="<?php echo htmlspecialchars($video['url'] . '&autoplay=1'); ?>"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="video-card social-video-card"
|
|
aria-label="<?php echo htmlspecialchars($video['title']); ?>">
|
|
<div class="video-thumbnail">
|
|
<img src="<?php echo htmlspecialchars($video['thumbnail']); ?>"
|
|
alt="<?php echo htmlspecialchars($video['title']); ?>"
|
|
loading="lazy">
|
|
<div class="video-play-icon" aria-hidden="true">
|
|
<i class="fab fa-youtube youtube-play-icon"></i>
|
|
</div>
|
|
</div>
|
|
<div class="video-info">
|
|
<h3 class="video-title"><?php echo htmlspecialchars($video['title']); ?></h3>
|
|
<div class="video-metadata">
|
|
<span class="video-date">
|
|
<i class="far fa-calendar-alt" aria-hidden="true"></i>
|
|
<?php echo htmlspecialchars(formatDate($video['publishedAt'])); ?>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php else: ?>
|
|
<div class="platform-fallback-card">
|
|
<div class="platform-fallback-icon youtube-fallback-icon">
|
|
<i class="fab fa-youtube" aria-hidden="true"></i>
|
|
</div>
|
|
<div class="platform-fallback-content">
|
|
<h3>@<?php echo htmlspecialchars(YOUTUBE_HANDLE); ?></h3>
|
|
<p>Regardez nos vidéos et abonnez-vous à notre chaîne YouTube.</p>
|
|
<a href="<?php echo htmlspecialchars(YOUTUBE_URL); ?>"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="platform-cta-btn platform-youtube-btn">
|
|
<i class="fab fa-youtube" aria-hidden="true"></i> Voir la chaîne
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
|
|
<hr class="section-divider">
|
|
|
|
<!-- ====== INSTAGRAM + TIKTOK ====== -->
|
|
<div class="social-two-col social-two-col--top">
|
|
|
|
<section id="instagram" class="social-section" aria-labelledby="instagram-heading">
|
|
<div class="social-section-header platform-instagram-header">
|
|
<div class="social-section-header-left">
|
|
<i class="fab fa-instagram" aria-hidden="true"></i>
|
|
<h2 id="instagram-heading">Instagram</h2>
|
|
<span class="platform-handle">@<?php echo htmlspecialchars(INSTAGRAM_HANDLE); ?></span>
|
|
<?php if ($instagramFollowers !== null): ?>
|
|
<span class="platform-stat-badge">
|
|
<i class="fas fa-users" aria-hidden="true"></i>
|
|
<?php echo formatFollowerCount($instagramFollowers); ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<a href="<?php echo htmlspecialchars(INSTAGRAM_URL); ?>"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="platform-cta-btn platform-instagram-btn">
|
|
<i class="fab fa-instagram" aria-hidden="true"></i> Suivre
|
|
</a>
|
|
</div>
|
|
|
|
<?php if (!empty(INSTAGRAM_POST_URLS)): ?>
|
|
<div class="instagram-posts-grid">
|
|
<?php foreach (INSTAGRAM_POST_URLS as $postUrl): ?>
|
|
<div class="instagram-post-wrapper">
|
|
<blockquote class="instagram-media"
|
|
data-instgrm-permalink="<?php echo htmlspecialchars($postUrl); ?>"
|
|
data-instgrm-version="14"
|
|
style="max-width:100%;">
|
|
</blockquote>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="social-embed-container platform-profile-embed">
|
|
<iframe
|
|
src="https://www.instagram.com/<?php echo htmlspecialchars(INSTAGRAM_HANDLE); ?>/embed/"
|
|
class="platform-profile-iframe platform-profile-iframe--instagram"
|
|
loading="lazy"
|
|
title="Profil Instagram @<?php echo htmlspecialchars(INSTAGRAM_HANDLE); ?>">
|
|
</iframe>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
|
|
<section id="tiktok" class="social-section" aria-labelledby="tiktok-heading">
|
|
<div class="social-section-header platform-tiktok-header">
|
|
<div class="social-section-header-left">
|
|
<i class="fab fa-tiktok" aria-hidden="true"></i>
|
|
<h2 id="tiktok-heading">TikTok</h2>
|
|
<span class="platform-handle">@<?php echo htmlspecialchars(TIKTOK_HANDLE); ?></span>
|
|
<?php if ($tiktokFollowers !== null): ?>
|
|
<span class="platform-stat-badge">
|
|
<i class="fas fa-users" aria-hidden="true"></i>
|
|
<?php echo formatFollowerCount($tiktokFollowers); ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<a href="<?php echo htmlspecialchars(TIKTOK_URL); ?>"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="platform-cta-btn platform-tiktok-btn">
|
|
<i class="fab fa-tiktok" aria-hidden="true"></i> Suivre
|
|
</a>
|
|
</div>
|
|
|
|
<?php if (!empty(TIKTOK_VIDEO_URLS)): ?>
|
|
<div class="tiktok-videos-grid">
|
|
<?php foreach (TIKTOK_VIDEO_URLS as $videoUrl):
|
|
preg_match('/\/video\/(\d+)/', $videoUrl, $matches);
|
|
$tiktokVideoId = $matches[1] ?? '';
|
|
if (!$tiktokVideoId) continue;
|
|
?>
|
|
<div class="tiktok-video-wrapper">
|
|
<blockquote class="tiktok-embed"
|
|
cite="<?php echo htmlspecialchars($videoUrl); ?>"
|
|
data-video-id="<?php echo htmlspecialchars($tiktokVideoId); ?>"
|
|
style="max-width:100%;">
|
|
</blockquote>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="social-embed-container platform-profile-embed">
|
|
<iframe
|
|
src="https://www.tiktok.com/embed/@<?php echo htmlspecialchars(TIKTOK_HANDLE); ?>"
|
|
class="platform-profile-iframe"
|
|
allow="autoplay; encrypted-media; picture-in-picture"
|
|
loading="lazy"
|
|
title="Profil TikTok @<?php echo htmlspecialchars(TIKTOK_HANDLE); ?>">
|
|
</iframe>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
|
|
</div>
|
|
|
|
<?php if (!empty($wordpressPosts)): ?>
|
|
<hr class="section-divider">
|
|
|
|
<!-- ====== WORDPRESS ====== -->
|
|
<section id="actualites" class="social-section" aria-labelledby="wp-heading">
|
|
<div class="social-section-header wp-section-header">
|
|
<div class="social-section-header-left">
|
|
<img src="https://kaubuntu.com/wp-content/uploads/2026/04/logo-ka-ubuntu.png" alt="" class="wp-section-logo" aria-hidden="true">
|
|
<h2 id="wp-heading">Actualités</h2>
|
|
<span class="platform-handle">kaubuntu.com</span>
|
|
<?php if ($wordpressPostCount !== null): ?>
|
|
<span class="platform-stat-badge">
|
|
<i class="fas fa-newspaper" aria-hidden="true"></i>
|
|
<?php echo formatFollowerCount($wordpressPostCount); ?> articles
|
|
</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<a href="<?php echo htmlspecialchars(WORDPRESS_URL); ?>"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="platform-cta-btn wp-cta-btn">
|
|
<i class="fas fa-newspaper" aria-hidden="true"></i> Voir tous les articles
|
|
</a>
|
|
</div>
|
|
<div class="wp-posts-grid">
|
|
<?php foreach ($wordpressPosts as $post): ?>
|
|
<a href="<?php echo htmlspecialchars($post['link']); ?>"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="wp-post-card">
|
|
<?php if (!empty($post['featured_image'])): ?>
|
|
<div class="wp-post-thumbnail">
|
|
<img src="<?php echo htmlspecialchars($post['featured_image']); ?>"
|
|
alt="<?php echo htmlspecialchars($post['title']); ?>"
|
|
loading="lazy">
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="wp-post-thumbnail wp-post-thumbnail--placeholder">
|
|
<i class="fas fa-newspaper" aria-hidden="true"></i>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="wp-post-info">
|
|
<h3 class="wp-post-title"><?php echo htmlspecialchars($post['title']); ?></h3>
|
|
<?php if (!empty($post['excerpt'])): ?>
|
|
<p class="wp-post-excerpt"><?php echo htmlspecialchars($post['excerpt']); ?></p>
|
|
<?php endif; ?>
|
|
<div class="wp-post-meta">
|
|
<span><i class="far fa-calendar-alt" aria-hidden="true"></i> <?php echo htmlspecialchars($post['date']); ?></span>
|
|
<?php if (!empty($post['author'])): ?>
|
|
<span><i class="far fa-user" aria-hidden="true"></i> <?php echo htmlspecialchars($post['author']); ?></span>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</section>
|
|
<?php endif; ?>
|
|
|
|
</main>
|
|
|
|
<button id="back-to-top" aria-label="Retour en haut de page" title="Retour en haut">
|
|
<i class="fas fa-chevron-up" aria-hidden="true"></i>
|
|
</button>
|
|
|
|
<?php include 'includes/footer.php'; ?>
|
|
<?php include 'includes/mobile-menu.php'; ?>
|
|
|
|
<script src="js/main.js?v=<?php echo filemtime('js/main.js'); ?>"></script>
|
|
|
|
<?php if (!empty(INSTAGRAM_POST_URLS)): ?>
|
|
<script async src="//www.instagram.com/embed.js"></script>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty(TIKTOK_VIDEO_URLS)): ?>
|
|
<script async src="https://www.tiktok.com/embed.js"></script>
|
|
<?php endif; ?>
|
|
|
|
<!-- PWA Service Worker -->
|
|
<script>
|
|
if ('serviceWorker' in navigator) {
|
|
window.addEventListener('load', function() {
|
|
navigator.serviceWorker.register('/sw.js')
|
|
.then(function(reg) {
|
|
reg.addEventListener('updatefound', function() {
|
|
const worker = reg.installing;
|
|
worker.addEventListener('statechange', function() {
|
|
if (worker.state === 'installed' && navigator.serviceWorker.controller) {
|
|
if (confirm('Une nouvelle version est disponible. Recharger ?')) {
|
|
window.location.reload();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
})
|
|
.catch(function(err) {
|
|
console.log('Service Worker failed:', err);
|
|
});
|
|
});
|
|
}
|
|
|
|
let deferredPrompt;
|
|
const installButton = document.getElementById('install-pwa');
|
|
window.addEventListener('beforeinstallprompt', function(e) {
|
|
e.preventDefault();
|
|
deferredPrompt = e;
|
|
if (installButton) {
|
|
installButton.style.display = 'block';
|
|
installButton.addEventListener('click', function() {
|
|
deferredPrompt.prompt();
|
|
deferredPrompt.userChoice.then(function() {
|
|
deferredPrompt = null;
|
|
installButton.style.display = 'none';
|
|
});
|
|
});
|
|
}
|
|
});
|
|
window.addEventListener('appinstalled', function() {
|
|
if (installButton) installButton.style.display = 'none';
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|