From 3cd2b543fb51197189309ba9ec54c1a45eadee97 Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Fri, 3 Apr 2015 03:42:38 +0200 Subject: [PATCH] add preliminary support for Microsoft's Project Spartan and Edge engine --- include/classes/useragent.php-class | 14 ++++++++++++++ testbed/ua_list_raw.txt | 1 + 2 files changed, 15 insertions(+) diff --git a/include/classes/useragent.php-class b/include/classes/useragent.php-class index ee95543..f5a5f8d 100755 --- a/include/classes/useragent.php-class +++ b/include/classes/useragent.php-class @@ -359,6 +359,11 @@ class userAgent { $this->version = $regs[1]; $this->bot = false; } + elseif (preg_match('|Edge/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { + $this->brand = 'Project Spartan'; + $this->version = null; + $this->bot = false; + } elseif (preg_match('|Chromium/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { $this->brand = 'Chromium'; $this->version = $regs[1]; @@ -1055,6 +1060,10 @@ class userAgent { $this->uadata['eng_version'] = $regs[1]; } } + elseif (preg_match('|Edge/([0-9\.]+)|', $this->uastring, $regs)) { + $this->uadata['engine'] = 'edge'; + $this->uadata['eng_version'] = $regs[1]; + } elseif ((strpos($this->brand, 'Internet Explorer') !== false) || (strpos($this->brand, 'FrontPage') !== false)) { if ((strpos(strtolower($this->uastring), 'mac') !== false) && (intval($this->getVersion()) >= 5)) { $this->uadata['engine'] = 'tasman'; @@ -1225,6 +1234,11 @@ class userAgent { $this->uadata['eng_version'] = null; } } + elseif ($this->hasEngine('edge')) { + if (preg_match('#Mozilla/5.0 \(([^;]+); (WOW64|Win64); ([^\);]+)\)#', $this->uastring, $regs)) { + $this->uadata['os'] = $regs[1].' ('.$regs[2].')'; + } + } elseif ($this->hasEngine('trident') || $this->hasEngine('tasman')) { if (preg_match('/Mozilla\/[^\(]+ \((IE [^;]+[^\)]*; )?((?:Mac|Win)[^;]+); ?(Win64|WOW64); ?Trident\/([^;\)]+);/i', $this->uastring, $regs)) { $this->uadata['eng_version'] = $regs[4]; diff --git a/testbed/ua_list_raw.txt b/testbed/ua_list_raw.txt index 398c995..40c1c4d 100755 --- a/testbed/ua_list_raw.txt +++ b/testbed/ua_list_raw.txt @@ -116,6 +116,7 @@ Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040402 Galeon/1.3.14 Mozilla/5.0 (X11; U; Linux i686) Gecko/20040319 Galeon/1.3.7 Mozilla/5.0 Galeon/1.2.7 (X11; Linux i686; U;) Gecko/20021204 Galeon/1.3.7 (IE4 compatible; I; Windows XP) Galeon/1.3.7 Debian/1.3.7.20030803-1 +Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0 Microsoft Internet Explorer/4.0b1 (Windows 95) Mozilla/1.22 (compatible; MSIE 1.5; Windows NT) Mozilla/2.0 (compatible; MSIE 3.01; Windows 95) -- 2.43.0