Automattic\WooCommerce\Vendor\Detection
MobileDetect::isTablet
Check if the device is a tablet. Return true if any type of tablet device is detected.
Метод класса: MobileDetect{}
Хуков нет.
Возвращает
true|false.
Использование
$MobileDetect = new MobileDetect(); $MobileDetect->isTablet( ?string $userAgent, ?array $httpHeaders ): bool;
- ?string $userAgent
- .
По умолчанию: null - ?array $httpHeaders
- .
По умолчанию: null
Код MobileDetect::isTablet() MobileDetect::isTablet WC 10.3.6
public function isTablet(?string $userAgent = null, ?array $httpHeaders = null): bool
{
// Check specifically for cloudfront headers if the useragent === 'Amazon CloudFront'
if ($this->getUserAgent() === 'Amazon CloudFront') {
$cfHeaders = $this->getCfHeaders();
if (array_key_exists('HTTP_CLOUDFRONT_IS_TABLET_VIEWER', $cfHeaders) &&
$cfHeaders['HTTP_CLOUDFRONT_IS_TABLET_VIEWER'] === 'true'
) {
return true;
}
}
foreach (static::$tabletDevices as $_regex) {
if ($this->match($_regex, $userAgent)) {
return true;
}
}
return false;
}