From fefd7b80229746bed493e03e6368ef5138494249 Mon Sep 17 00:00:00 2001 From: doggie Date: Fri, 3 Nov 2023 18:30:39 +0800 Subject: [PATCH] Fixed incompatibility with Mobile-Detect v2.8.43 --- src/Agent.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/Agent.php b/src/Agent.php index 6c47492..feb7196 100644 --- a/src/Agent.php +++ b/src/Agent.php @@ -106,6 +106,32 @@ public static function getDetectionRulesExtended() return $rules; } + + /** + * Method gets the mobile detection rules. This method is used for the magic methods $detect->is*(). + * + * Since this function should only return rules that can detect mobile devices, do not pollute it + * with non-mobile stuff. + * + * @return array All the rules (but not extended). + */ + public static function getMobileDetectionRules() + { + static $rules; + + if (!$rules) { + $rules = array_merge( + parent::getPhoneDevices(), + parent::getTabletDevices(), + parent::getOperatingSystems(), + parent::getBrowsers() + ); + } + + return $rules; + + } + public function getRules() { if ($this->detectionType === static::DETECTION_TYPE_EXTENDED) {