Added detection for Chromium based Edge browser
authorSascha Greuel <sascha@softcreatr.de>
Sun, 26 Jul 2020 15:19:00 +0000 (17:19 +0200)
committerSascha Greuel <sascha@softcreatr.de>
Mon, 3 Aug 2020 19:29:54 +0000 (21:29 +0200)
wcfsetup/install/files/lib/data/user/online/UserOnline.class.php

index e24e71c671688c78841697ad5534f14b0f734daf..32e52b30012d612dfd4f31fb8094352ac1e87cbf 100644 (file)
@@ -215,10 +215,15 @@ class UserOnline extends UserProfile {
                }
                
                // edge
-               if (preg_match('~edge/(\d{2}\.\d+)~i', $this->userAgent, $match)) {
+               if (preg_match('~edge?/([\d\.]+)~i', $this->userAgent, $match)) {
                        return 'Microsoft Edge '.$match[1];
                }
                
+               // edge mobile
+               if (preg_match('~edga/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Microsoft Edge Mobile '.$match[1];
+               }
+               
                // vivaldi
                if (preg_match('~vivaldi/([\d\.]+)~i', $this->userAgent, $match)) {
                        return 'Vivaldi '.$match[1];
@@ -254,11 +259,6 @@ class UserOnline extends UserProfile {
                        return 'Chrome Mobile '.(isset($match[2]) ? $match[2] : $match[1]);
                }
                
-               // chrome
-               if (preg_match('~(?:chromium|chrome)/([\d\.]+)~i', $this->userAgent, $match)) {
-                       return 'Chrome '.$match[1];
-               }
-               
                // kindle
                if (preg_match('~kindle/([\d\.]+)~i', $this->userAgent, $match)) {
                        return 'Kindle '.$match[1];
@@ -279,6 +279,11 @@ class UserOnline extends UserProfile {
                        return 'Safari Mobile '.$match[1];
                }
                
+               // chrome
+               if (preg_match('~(?:chromium|chrome)/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Chrome '.$match[1];
+               }
+               
                // safari
                if (preg_match('~([\d\.]+) safari~i', $this->userAgent, $match)) {
                        return 'Safari '.$match[1];