diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-11-02 11:04:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-02 11:04:33 +0300 |
commit | b123a03f4c1e14afaebe3696b15b1f28cc06c728 (patch) | |
tree | c9976aaa10de41d725d8e5a842ae3ed352255179 /plugins/DevicesDetection | |
parent | 55753101ad1ebcfaa48ba1c94466c4499650fcf8 (diff) |
Require new major release of matomo/device-detector (#16636)
* Require new major release of matomo/device-detector (instead of piwik/device-detector)
* Adjust classname
* fix cache class
* update test files
* some more code adjustments
* update submodule
Diffstat (limited to 'plugins/DevicesDetection')
-rw-r--r-- | plugins/DevicesDetection/API.php | 6 | ||||
-rw-r--r-- | plugins/DevicesDetection/Columns/DeviceBrand.php | 4 | ||||
-rw-r--r-- | plugins/DevicesDetection/Columns/DeviceType.php | 2 | ||||
-rw-r--r-- | plugins/DevicesDetection/Columns/Os.php | 2 | ||||
-rw-r--r-- | plugins/DevicesDetection/Controller.php | 8 | ||||
-rw-r--r-- | plugins/DevicesDetection/functions.php | 8 |
6 files changed, 15 insertions, 15 deletions
diff --git a/plugins/DevicesDetection/API.php b/plugins/DevicesDetection/API.php index f3031fa274..e7fb7027f5 100644 --- a/plugins/DevicesDetection/API.php +++ b/plugins/DevicesDetection/API.php @@ -9,7 +9,7 @@ namespace Piwik\Plugins\DevicesDetection; -use DeviceDetector\Parser\Device\DeviceParserAbstract; +use DeviceDetector\Parser\Device\AbstractDeviceParser; use Piwik\Archive; use Piwik\DataTable; use Piwik\Metrics; @@ -54,7 +54,7 @@ class API extends \Piwik\Plugin\API // ensure all device types are in the list $this->ensureDefaultRowsInTable($dataTable); - $mapping = DeviceParserAbstract::getAvailableDeviceTypeNames(); + $mapping = AbstractDeviceParser::getAvailableDeviceTypeNames(); $dataTable->filter('AddSegmentByLabelMapping', array('deviceType', $mapping)); $dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', __NAMESPACE__ . '\getDeviceTypeLogo')); $dataTable->filter('GroupBy', array('label', __NAMESPACE__ . '\getDeviceTypeLabel')); @@ -63,7 +63,7 @@ class API extends \Piwik\Plugin\API protected function ensureDefaultRowsInTable($dataTable) { - $requiredRows = array_fill(0, count(DeviceParserAbstract::getAvailableDeviceTypes()), Metrics::INDEX_NB_VISITS); + $requiredRows = array_fill(0, count(AbstractDeviceParser::getAvailableDeviceTypes()), Metrics::INDEX_NB_VISITS); $dataTables = array($dataTable); diff --git a/plugins/DevicesDetection/Columns/DeviceBrand.php b/plugins/DevicesDetection/Columns/DeviceBrand.php index 5de1301718..befb4dc75b 100644 --- a/plugins/DevicesDetection/Columns/DeviceBrand.php +++ b/plugins/DevicesDetection/Columns/DeviceBrand.php @@ -8,7 +8,7 @@ */ namespace Piwik\Plugins\DevicesDetection\Columns; -use DeviceDetector\Parser\Device\DeviceParserAbstract; +use DeviceDetector\Parser\Device\AbstractDeviceParser; use Piwik\Metrics\Formatter; use Piwik\Piwik; use Piwik\Tracker\Request; @@ -32,7 +32,7 @@ class DeviceBrand extends Base public function __construct() { - $brands = DeviceParserAbstract::$deviceBrands; + $brands = AbstractDeviceParser::$deviceBrands; natcasesort ($brands); $brandList = implode(", ", $brands); $this->acceptValues = $brandList; diff --git a/plugins/DevicesDetection/Columns/DeviceType.php b/plugins/DevicesDetection/Columns/DeviceType.php index f42a1d5654..30cdb476ba 100644 --- a/plugins/DevicesDetection/Columns/DeviceType.php +++ b/plugins/DevicesDetection/Columns/DeviceType.php @@ -13,7 +13,7 @@ use Piwik\Tracker\Request; use Exception; use Piwik\Tracker\Visitor; use Piwik\Tracker\Action; -use DeviceDetector\Parser\Device\DeviceParserAbstract as DeviceParser; +use DeviceDetector\Parser\Device\AbstractDeviceParser as DeviceParser; class DeviceType extends Base { diff --git a/plugins/DevicesDetection/Columns/Os.php b/plugins/DevicesDetection/Columns/Os.php index 8f51f00ee1..f5ba2bf36d 100644 --- a/plugins/DevicesDetection/Columns/Os.php +++ b/plugins/DevicesDetection/Columns/Os.php @@ -84,7 +84,7 @@ class Os extends Base $os = Settings::OS_BOT; } else { $os = $parser->getOS(); - $os = empty($os['short_name']) ? 'UNK' : $os['short_name']; + $os = $os['short_name'] ?? 'UNK'; } return $os; diff --git a/plugins/DevicesDetection/Controller.php b/plugins/DevicesDetection/Controller.php index a582bffed0..de5424908e 100644 --- a/plugins/DevicesDetection/Controller.php +++ b/plugins/DevicesDetection/Controller.php @@ -37,12 +37,12 @@ class Controller extends \Piwik\Plugin\Controller $view->browser_short_name = $uaParser->getClient('short_name'); $view->browser_version = $uaParser->getClient('version'); $view->browser_logo = getBrowserLogo($uaParser->getClient('short_name')); - $view->browser_family = \DeviceDetector\Parser\Client\Browser::getBrowserFamily($uaParser->getClient('short_name')); + $view->browser_family = \DeviceDetector\Parser\Client\Browser::getBrowserFamily($uaParser->getClient('name')); $view->browser_family_logo = getBrowserFamilyLogo($view->browser_family); $view->os_name = $uaParser->getOs('name'); $view->os_logo = getOsLogo($uaParser->getOs('short_name')); $view->os_short_name = $uaParser->getOs('short_name'); - $view->os_family = \DeviceDetector\Parser\OperatingSystem::getOsFamily($uaParser->getOs('short_name')); + $view->os_family = \DeviceDetector\Parser\OperatingSystem::getOsFamily($uaParser->getOs('name')); $view->os_family_logo = getOsFamilyLogo($view->os_family); $view->os_version = $uaParser->getOs('version'); $view->device_type = getDeviceTypeLabel($uaParser->getDeviceName()); @@ -66,7 +66,7 @@ class Controller extends \Piwik\Plugin\Controller switch ($type) { case 'brands': - $availableBrands = \DeviceDetector\Parser\Device\DeviceParserAbstract::$deviceBrands; + $availableBrands = \DeviceDetector\Parser\Device\AbstractDeviceParser::$deviceBrands; foreach ($availableBrands as $short => $name) { if ($name != 'Unknown') { @@ -108,7 +108,7 @@ class Controller extends \Piwik\Plugin\Controller break; case 'devicetypes': - $deviceTypes = \DeviceDetector\Parser\Device\DeviceParserAbstract::getAvailableDeviceTypes(); + $deviceTypes = \DeviceDetector\Parser\Device\AbstractDeviceParser::getAvailableDeviceTypes(); foreach ($deviceTypes as $name => $id) { $list[$name] = getDeviceTypeLogo($name); diff --git a/plugins/DevicesDetection/functions.php b/plugins/DevicesDetection/functions.php index 877f426724..e509123721 100644 --- a/plugins/DevicesDetection/functions.php +++ b/plugins/DevicesDetection/functions.php @@ -11,7 +11,7 @@ namespace Piwik\Plugins\DevicesDetection; use Piwik\Piwik; use DeviceDetector\Parser\OperatingSystem AS OperatingSystemParser; -use DeviceDetector\Parser\Device\DeviceParserAbstract AS DeviceParser; +use DeviceDetector\Parser\Device\AbstractDeviceParser AS DeviceParser; use DeviceDetector\Parser\Client\Browser AS BrowserParser; function getBrandLogo($label) @@ -251,7 +251,7 @@ function getOSFamilyFullName($label) $label = Piwik::translate('DevicesDetection_Console'); } - if ($label !== false) { + if ($label !== null) { return $label; } return Piwik::translate('General_Unknown'); @@ -283,7 +283,7 @@ function getOsFullName($label) return Piwik::translate('General_Unknown'); } -function _mapLegacyOsShortCodes($shortCode) +function _mapLegacyOsShortCodes($shortCode): string { $legacyShortCodes = array( 'IPA' => 'IOS', // iPad => iOS @@ -309,7 +309,7 @@ function _mapLegacyOsShortCodes($shortCode) 'WXP' => 'WIN', //'VMS' => '', // OpenVMS => ?? ); - return ($shortCode && array_key_exists($shortCode, $legacyShortCodes)) ? $legacyShortCodes[$shortCode] : $shortCode; + return ($shortCode && array_key_exists($shortCode, $legacyShortCodes)) ? $legacyShortCodes[$shortCode] : (string) $shortCode; } /** |