getPrivateCategories(); $Parsedown = new Parsedown(); $now = time(); $base = rtrim(APP_URL, '/'); $filterCat = trim($_GET['category'] ?? ''); $all = array_values(array_filter( $articles->getAll(publishedOnly: true), static function (array $a) use ($now, $privateCats, $filterCat): bool { if (strtotime((string)($a['published_at'] ?? '')) > $now) { return false; } $cat = trim($a['category'] ?? ''); if ($cat !== '' && in_array($cat, $privateCats, true)) { return false; } if ($filterCat !== '' && $cat !== $filterCat) { return false; } return true; } )); // ─── Pagination curseur ────────────────────────────────────────────────────── $after = trim($_GET['after'] ?? ''); $offset = 0; if ($after !== '') { foreach ($all as $i => $a) { if ($a['uuid'] === $after) { $offset = $i + 1; break; } } } $items = array_slice($all, $offset, FEED_PAGE_SIZE); $nextCursor = (count($all) > $offset + FEED_PAGE_SIZE) ? ($all[$offset + FEED_PAGE_SIZE - 1]['uuid'] ?? null) : null; $feedUrl = $base . '/feed' . ($filterCat !== '' ? '?category=' . rawurlencode($filterCat) : ''); $feedNextUrl = $nextCursor !== null ? $base . '/feed/' . $nextCursor . ($filterCat !== '' ? '?category=' . rawurlencode($filterCat) : '') : null; $channelTitle = siteTitle() . ($filterCat !== '' ? ' — ' . $filterCat : ''); $channelDesc = $filterCat !== '' ? 'Articles de la catégorie « ' . $filterCat . ' »' : siteClaim(); // ─── lastBuildDate ─────────────────────────────────────────────────────────── $lastBuild = ''; foreach ($all as $a) { $ts = (int)strtotime((string)($a['updated_at'] ?? $a['published_at'] ?? '')); if ($ts > (int)strtotime($lastBuild ?: '1970-01-01')) { $lastBuild = date(DATE_RSS, $ts); } } if ($lastBuild === '') { $lastBuild = date(DATE_RSS); } header('Content-Type: application/rss+xml; charset=UTF-8'); header('X-Content-Type-Options: nosniff'); echo '' . "\n"; ?> <?= htmlspecialchars($channelTitle) ?> 0): ?>