Automattic\WooCommerce\Vendor\Detection
MobileDetect::isTablet()
Check if the device is a tablet. Return true if any type of tablet device is detected.
Method of the class: MobileDetect{}
No Hooks.
Return
true|false
.
Usage
$MobileDetect = new MobileDetect(); $MobileDetect->isTablet( ?string $userAgent, ?array $httpHeaders ): bool;
- ?string $userAgent **
- -
Default: null - ?array $httpHeaders **
- -
Default: null
MobileDetect::isTablet() MobileDetect::isTablet code WC 9.7.1
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; }