Automattic\WooCommerce\Vendor\Detection
MobileDetect::setCfHeaders()
Set CloudFront headers http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/header-caching.html#header-caching-web-device
Method of the class: MobileDetect{}
No Hooks.
Return
true|false
. If there were CloudFront headers to be set
Usage
$MobileDetect = new MobileDetect(); $MobileDetect->setCfHeaders( $cfHeaders ): bool;
- $cfHeaders(array|null)
- List of HTTP headers
Default: null
MobileDetect::setCfHeaders() MobileDetect::setCfHeaders code WC 9.4.2
public function setCfHeaders(array $cfHeaders = null): bool { // use global _SERVER if $cfHeaders aren't defined if (!is_array($cfHeaders) || !count($cfHeaders)) { $cfHeaders = $_SERVER; } // clear existing headers $this->cloudfrontHeaders = array(); // Only save CLOUDFRONT headers. In PHP land, that means only _SERVER vars that // start with cloudfront-. $response = false; foreach ($cfHeaders as $key => $value) { if (substr(strtolower($key), 0, 16) === 'http_cloudfront_') { $this->cloudfrontHeaders[strtoupper($key)] = $value; $response = true; } } return $response; }