Automattic\WooCommerce\Vendor\Detection
MobileDetect::checkHttpHeadersForMobile
Check the HTTP headers for signs of mobile. This is the fastest mobile check possible; it's used inside isMobile() method.
Method of the class: MobileDetect{}
No Hooks.
Returns
true|false.
Usage
$MobileDetect = new MobileDetect(); $MobileDetect->checkHttpHeadersForMobile(): bool;
MobileDetect::checkHttpHeadersForMobile() MobileDetect::checkHttpHeadersForMobile code WC 10.9.1
public function checkHttpHeadersForMobile(): bool
{
foreach ($this->getMobileHeaders() as $mobileHeader => $matchType) {
if (isset($this->httpHeaders[$mobileHeader])) {
if (isset($matchType['matches']) && is_array($matchType['matches'])) {
foreach ($matchType['matches'] as $_match) {
if (strpos($this->httpHeaders[$mobileHeader], $_match) !== false) {
return true;
}
}
return false;
} else {
return true;
}
}
}
return false;
}