51, 'IE' => 11, 'SF' => 10, 'CH' => 48, 'OP' => 72, 'PS' => 17, ]; public static function checkIfBrowserSupported() { $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; if ($userAgent === '') { return; } $ddFactory = StaticContainer::get(DeviceDetectorFactory::class); /** @var \DeviceDetector\DeviceDetector */ $deviceDetector = $ddFactory->makeInstance($userAgent); $deviceDetector->parse(); $client = $deviceDetector->getClient(); if (!empty($client) && $client['type'] === 'browser' && self::browserNotSupported($client['short_name'], (int)$client['version'])) { self::throwException($client); } } private static function browserNotSupported($shortName, $version) { return array_key_exists($shortName, self::$notSupportedBrowsers) && $version > 0 && $version <= self::$notSupportedBrowsers[$shortName]; } private static function throwException($client) { $message = "

" . Piwik::translate('General_ExceptionNotSupportedBrowserTitle') . "

"; $message .= "

" . Piwik::translate('General_ExceptionNotSupportedBrowserText') . "

"; $exception = new NotSupportedBrowserException($message); $exception->setIsHtmlMessage(); throw $exception; } }