Skip to content

Commit c97e602

Browse files
committed
Upgraded UDD from version 6.1.0 to version 6.1.3
1 parent 2519c72 commit c97e602

File tree

15 files changed

+2075
-541
lines changed

15 files changed

+2075
-541
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
99
- Compatibility with WordPress 6.3.
1010

1111
### Changed
12+
- Upgraded UDD from version 6.1.0 to version 6.1.3: dozens of added and improved detections.
1213
- The color for `shmop` test in Site Health is now gray to not worry to much about it (was previously orange).
1314

1415
## [3.4.1] - 2023-03-02

includes/libraries/class-libraries.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static function init() {
6262
'name' => 'Universal Device Detection',
6363
'prefix' => 'UDD',
6464
'base' => PODD_VENDOR_DIR . 'udd/',
65-
'version' => '6.1.0',
65+
'version' => '6.1.3',
6666
// phpcs:ignore
6767
'author' => sprintf( esc_html__( '%s & contributors', 'device-detector' ), 'Matomo Analytics' ),
6868
'url' => 'https://github.com/matomo-org/device-detector',

includes/libraries/udd/DeviceDetector.php

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class DeviceDetector
6868
/**
6969
* Current version number of DeviceDetector
7070
*/
71-
public const VERSION = '6.1.0';
71+
public const VERSION = '6.1.3';
7272

7373
/**
7474
* Constant used as value for unknown browser / os
@@ -345,9 +345,10 @@ public function skipBotDetection(bool $skip = true): void
345345
/**
346346
* Returns if the parsed UA was identified as a Bot
347347
*
348+
* @return bool
349+
*
348350
* @see bots.yml for a list of detected bots
349351
*
350-
* @return bool
351352
*/
352353
public function isBot(): bool
353354
{
@@ -421,9 +422,10 @@ public function isMobile(): bool
421422
* Returns if the parsed UA was identified as desktop device
422423
* Desktop devices are all devices with an unknown type that are running a desktop os
423424
*
425+
* @return bool
426+
*
424427
* @see OperatingSystem::$desktopOsArray
425428
*
426-
* @return bool
427429
*/
428430
public function isDesktop(): bool
429431
{
@@ -480,9 +482,10 @@ public function getClient(string $attr = '')
480482
/**
481483
* Returns the device type extracted from the parsed UA
482484
*
485+
* @return int|null
486+
*
483487
* @see AbstractDeviceParser::$deviceTypes for available device types
484488
*
485-
* @return int|null
486489
*/
487490
public function getDevice(): ?int
488491
{
@@ -492,9 +495,10 @@ public function getDevice(): ?int
492495
/**
493496
* Returns the device type extracted from the parsed UA
494497
*
498+
* @return string
499+
*
495500
* @see AbstractDeviceParser::$deviceTypes for available device types
496501
*
497-
* @return string
498502
*/
499503
public function getDeviceName(): string
500504
{
@@ -508,10 +512,10 @@ public function getDeviceName(): string
508512
/**
509513
* Returns the device brand extracted from the parsed UA
510514
*
511-
* @see self::$deviceBrand for available device brands
512-
*
513515
* @return string
514516
*
517+
* @see self::$deviceBrand for available device brands
518+
*
515519
* @deprecated since 4.0 - short codes might be removed in next major release
516520
*/
517521
public function getBrand(): string
@@ -522,9 +526,10 @@ public function getBrand(): string
522526
/**
523527
* Returns the full device brand name extracted from the parsed UA
524528
*
529+
* @return string
530+
*
525531
* @see self::$deviceBrand for available device brands
526532
*
527-
* @return string
528533
*/
529534
public function getBrandName(): string
530535
{
@@ -624,14 +629,15 @@ public function parse(): void
624629
* To get fast results from DeviceDetector you need to make your own implementation,
625630
* that should use one of the caching mechanisms. See README.md for more information.
626631
*
627-
* @internal
628-
*
629-
* @deprecated
630-
*
631632
* @param string $ua UserAgent to parse
632633
* @param ?ClientHints $clientHints Client Hints to parse
633634
*
634635
* @return array
636+
*
637+
* @deprecated
638+
*
639+
* @internal
640+
*
635641
*/
636642
public static function getInfoFromUserAgent(string $ua, ?ClientHints $clientHints = null): array
637643
{
@@ -909,6 +915,15 @@ protected function parseDevice(): void
909915
$osVersion = $this->getOsAttribute('version');
910916
$clientName = $this->getClientAttribute('name');
911917

918+
/**
919+
* if it's fake UA then it's best not to identify it as Apple running Android OS
920+
*/
921+
if ('Android' === $osName && 'Apple' === $this->brand) {
922+
$this->device = null;
923+
$this->brand = '';
924+
$this->model = '';
925+
}
926+
912927
/**
913928
* Assume all devices running iOS / Mac OS are from Apple
914929
*/

includes/libraries/udd/Parser/Client/Browser.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use UDD\ClientHints;
1717
use UDD\Parser\Client\Browser\Engine;
1818
use UDD\Parser\Client\Hints\BrowserHints;
19+
use UDD\Yaml\ParserInterface as YamlParser;
1920

2021
/**
2122
* Class Browser
@@ -268,6 +269,7 @@ class Browser extends AbstractClientParser
268269
'I4' => 'IceCat',
269270
'ID' => 'IceDragon',
270271
'IV' => 'Isivioo',
272+
'I8' => 'IVVI Browser',
271273
'IW' => 'Iceweasel',
272274
'IN' => 'Inspect Browser',
273275
'IE' => 'Internet Explorer',
@@ -345,6 +347,7 @@ class Browser extends AbstractClientParser
345347
'NO' => 'Nokia OSS Browser',
346348
'NV' => 'Nokia Ovi Browser',
347349
'NX' => 'Nox Browser',
350+
'N1' => 'NOMone VR Browser',
348351
'NE' => 'NetSurf',
349352
'NF' => 'NetFront',
350353
'NL' => 'NetFront Life',
@@ -388,6 +391,7 @@ class Browser extends AbstractClientParser
388391
'PM' => 'Pale Moon',
389392
'PY' => 'Polypane',
390393
'PP' => 'Oppo Browser',
394+
'P6' => 'Opus Browser',
391395
'PR' => 'Palm Pre',
392396
'PU' => 'Puffin',
393397
'2P' => 'Puffin Web Browser',
@@ -431,6 +435,7 @@ class Browser extends AbstractClientParser
431435
'SO' => 'Sogou Mobile Browser',
432436
'RF' => 'SOTI Surf',
433437
'2S' => 'Soul Browser',
438+
'T0' => 'Soundy Browser',
434439
'SF' => 'Safari',
435440
'PV' => 'Safari Technology Preview',
436441
'S5' => 'Safe Exam Browser',
@@ -517,6 +522,7 @@ class Browser extends AbstractClientParser
517522
'WE' => 'WebPositive',
518523
'WF' => 'Waterfox',
519524
'WB' => 'Wave Browser',
525+
'WA' => 'Wavebox',
520526
'WH' => 'Whale Browser',
521527
'WO' => 'wOSBrowser',
522528
'WT' => 'WeTab Browser',
@@ -581,7 +587,7 @@ class Browser extends AbstractClientParser
581587
'XO', 'U0', 'B0', 'VA', 'X0', 'NX', 'O5', 'R1', 'I1',
582588
'HO', 'A5', 'X1', '18', 'B5', 'B6', 'TC', 'A6', '2X',
583589
'F4', 'YG', 'WR', 'NA', 'DM', '1M', 'A7', 'XN', 'XT',
584-
'XB', 'W1', 'HT', 'B8', 'F5', 'B9',
590+
'XB', 'W1', 'HT', 'B8', 'F5', 'B9', 'WA', 'T0', 'HC',
585591
],
586592
'Firefox' => [
587593
'AX', 'BI', 'BF', 'BH', 'BN', 'C0', 'CU', 'EI', 'F1',
@@ -619,7 +625,7 @@ class Browser extends AbstractClientParser
619625
'O4', 'XO', 'U0', 'B0', 'VA', 'X0', 'A5', 'X1', '18',
620626
'B5', 'B6', 'TC', 'A6', '2X', 'F4', 'YG', 'WR', 'NA',
621627
'DM', '1M', 'A7', 'XN', 'XT', 'XB', 'W1', 'HT', 'B7',
622-
'B9',
628+
'B9', 'T0', 'I8',
623629
];
624630

625631
/**
@@ -743,6 +749,17 @@ public static function isMobileOnlyBrowser(string $browser): bool
743749
&& \in_array(\array_search($browser, self::$availableBrowsers), self::$mobileOnlyBrowsers));
744750
}
745751

752+
/**
753+
* Sets the YamlParser class
754+
*
755+
* @param YamlParser $yamlParser
756+
*/
757+
public function setYamlParser(YamlParser $yamlParser): void
758+
{
759+
parent::setYamlParser($yamlParser);
760+
$this->browserHints->setYamlParser($this->getYamlParser());
761+
}
762+
746763
/**
747764
* @inheritdoc
748765
*/

includes/libraries/udd/Parser/Client/MobileApp.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use UDD\Cache\CacheInterface;
1616
use UDD\ClientHints;
1717
use UDD\Parser\Client\Hints\AppHints;
18+
use UDD\Yaml\ParserInterface as YamlParser;
1819

1920
/**
2021
* Class MobileApp
@@ -83,6 +84,17 @@ public function setCache(CacheInterface $cache): void
8384
$this->appHints->setCache($cache);
8485
}
8586

87+
/**
88+
* Sets the YamlParser class
89+
*
90+
* @param YamlParser $yamlParser
91+
*/
92+
public function setYamlParser(YamlParser $yamlParser): void
93+
{
94+
parent::setYamlParser($yamlParser);
95+
$this->appHints->setYamlParser($this->getYamlParser());
96+
}
97+
8698
/**
8799
* Parses the current UA and checks whether it contains any client information
88100
* See parent::parse() for more details.

0 commit comments

Comments
 (0)