$newestTimestamp) { $newestTimestamp = $ts; } } if ($newestTimestamp === 0) { $newestTimestamp = time(); } $etag = '"' . md5((string) $newestTimestamp) . '"'; $lastModified = gmdate('D, d M Y H:i:s', $newestTimestamp) . ' GMT'; // Return 304 if the client's cached copy is still fresh. $ifNoneMatch = trim($_SERVER['HTTP_IF_NONE_MATCH'] ?? ''); $ifModSince = trim($_SERVER['HTTP_IF_MODIFIED_SINCE'] ?? ''); $clientFresh = ($ifNoneMatch !== '' && $ifNoneMatch === $etag) || ($ifModSince !== '' && (strtotime($ifModSince) ?: 0) >= $newestTimestamp); if ($clientFresh) { http_response_code(304); exit; } header('Content-Type: application/rss+xml; charset=UTF-8'); header('Cache-Control: public, max-age=' . $feedTtl); header('Last-Modified: ' . $lastModified); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $feedTtl) . ' GMT'); header('ETag: ' . $etag); // Serve from server-side cache if available. if ($feedCacheEnabled) { $cachedXml = cache_read('__feed__', $feedTtl, 'xml'); if ($cachedXml !== null) { echo $cachedXml; exit; } ob_start(); } echo ''; ?> <?= e($siteTitle) ?> (string) ($post['title'] ?? '')]); $content = absolutize_feed_html($content, $baseUrl, $postUrl); $content = preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]/u', '', $content); ?> <?= e($post['title']) ?> ]]>