0 && $markdown > $html; } public static function vary_accept(): void { $vary = []; foreach (headers_list() as $header) { if (stripos($header, 'Vary:') === 0) { $vary = array_merge($vary, array_map('trim', explode(',', substr($header, 5)))); } } if (!in_array('*', $vary, true) && !in_array('accept', array_map('strtolower', $vary), true)) { $vary[] = 'Accept'; } header('Vary: ' . implode(', ', array_unique($vary))); } public static function has_header(string $name): bool { foreach (headers_list() as $header) { if (stripos($header, $name . ':') === 0) { return true; } } return false; } public static function has_noindex(): bool { foreach (headers_list() as $header) { if (stripos($header, 'X-Robots-Tag:') === 0 && preg_match('/\b(?:noindex|none)\b/i', substr($header, 13))) { return true; } } return false; } public static function no_store(): void { // Shared cache-plugin convention; this name must match the cache providers. // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound if (!defined('DONOTCACHEPAGE')) { define('DONOTCACHEPAGE', true); } nocache_headers(); header('Cache-Control: private, no-store, max-age=0'); foreach (['ETag', 'Last-Modified', 'Content-Length', 'Content-Encoding'] as $name) { header_remove($name); } } }