Automattic\WooCommerce\Vendor\Detection

MobileDetect::isTablet()publicWC 1.0

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( $userAgent, $httpHeaders ): bool;
$userAgent(строка|null)
deprecated
По умолчанию: null
$httpHeaders(массив|null)
deprecated
По умолчанию: null

Код MobileDetect::isTablet() WC 9.4.2

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;
}