Automattic\WooCommerce\Vendor\Detection

MobileDetect::checkHttpHeadersForMobilepublicWC 1.0

Check the HTTP headers for signs of mobile. This is the fastest mobile check possible; it's used inside isMobile() method.

Метод класса: MobileDetect{}

Хуков нет.

Возвращает

true|false.

Использование

$MobileDetect = new MobileDetect();
$MobileDetect->checkHttpHeadersForMobile(): bool;

Код MobileDetect::checkHttpHeadersForMobile() WC 10.0.2

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