Automattic\WooCommerce\Vendor\Detection
MobileDetect::matchDetectionRulesAgainstUA
Find a detection rule that matches the current User-agent.
Method of the class: MobileDetect{}
No Hooks.
Returns
true|false.
Usage
// protected - for code of main (parent) or child class $result = $this->matchDetectionRulesAgainstUA( ?string $userAgent ): bool;
- ?string $userAgent
- .
Default:null
MobileDetect::matchDetectionRulesAgainstUA() MobileDetect::matchDetectionRulesAgainstUA code WC 10.5.0
protected function matchDetectionRulesAgainstUA(?string $userAgent = null): bool
{
// Begin general search.
foreach ($this->getRules() as $_regex) {
if (empty($_regex)) {
continue;
}
if ($this->match($_regex, $userAgent)) {
return true;
}
}
return false;
}