|
Server : LiteSpeed System : Linux quebec.us.hostns.io 5.14.0-687.42.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Aug 27 11:55:12 EDT 2026 x86_64 User : gazetufm ( 1431) PHP Version : 8.1.35 Disable Function : NONE Directory : /home2/gazetufm/dumoshi.com/wp-content/plugins/wp-statistics/src/Components/ | |
|
Path: //home2/gazetufm/dumoshi.com/wp-content/plugins/wp-statistics/src/Components/TrackingResponse.php
Size: 950 B
Permissions: 0644
<?php
namespace WP_Statistics\Components;
/**
* Response headers shared by every tracking endpoint (custom event,
* hit record, REST /hit). Keeps the URLs out of search-engine indexes
* and out of reverse-proxy / CDN caches.
*
* @link https://wordpress.org/support/topic/request-for-cloudflare-html-caching-compatibility/
*/
class TrackingResponse
{
/**
* @return array<string,string>
*/
public static function getHeaders()
{
return [
'X-Robots-Tag' => 'noindex, nofollow',
'Cache-Control' => 'no-cache',
];
}
/**
* Emit headers via header(). For REST handlers, pass getHeaders()
* to $response->set_headers() instead.
*/
public static function sendHeaders()
{
if (headers_sent()) {
return;
}
foreach (self::getHeaders() as $name => $value) {
header($name . ': ' . $value, true);
}
}
}