update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
72
www/analytics/vendor/piwik/device-detector/Parser/Bot.php
vendored
Normal file
72
www/analytics/vendor/piwik/device-detector/Parser/Bot.php
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser;
|
||||
|
||||
/**
|
||||
* Class Bot
|
||||
*
|
||||
* Parses a user agent for bot information
|
||||
*
|
||||
* Detected bots are defined in regexes/bots.yml
|
||||
*
|
||||
* @package DeviceDetector\Parser
|
||||
*/
|
||||
class Bot extends ParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/bots.yml';
|
||||
protected $parserName = 'bot';
|
||||
protected $discardDetails = false;
|
||||
|
||||
/**
|
||||
* Enables information discarding
|
||||
*/
|
||||
public function discardDetails()
|
||||
{
|
||||
$this->discardDetails = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the current UA and checks whether it contains bot information
|
||||
*
|
||||
* @see bots.yml for list of detected bots
|
||||
*
|
||||
* Step 1: Build a big regex containing all regexes and match UA against it
|
||||
* -> If no matches found: return
|
||||
* -> Otherwise:
|
||||
* Step 2: Walk through the list of regexes in bots.yml and try to match every one
|
||||
* -> Return the matched data
|
||||
*
|
||||
* If $discardDetails is set to TRUE, the Step 2 will be skipped
|
||||
* $bot will be set to TRUE instead
|
||||
*
|
||||
* NOTE: Doing the big match before matching every single regex speeds up the detection
|
||||
*/
|
||||
public function parse()
|
||||
{
|
||||
$result = null;
|
||||
|
||||
if ($this->preMatchOverall()) {
|
||||
foreach ($this->getRegexes() as $regex) {
|
||||
$matches = $this->matchUserAgent($regex['regex']);
|
||||
|
||||
if ($matches) {
|
||||
if ($this->discardDetails) {
|
||||
$result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
unset($regex['regex']);
|
||||
$result = $regex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
263
www/analytics/vendor/piwik/device-detector/Parser/Client/Browser.php
vendored
Normal file
263
www/analytics/vendor/piwik/device-detector/Parser/Client/Browser.php
vendored
Normal file
|
|
@ -0,0 +1,263 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Client;
|
||||
|
||||
use DeviceDetector\Parser\Client\Browser\Engine;
|
||||
|
||||
/**
|
||||
* Class Browser
|
||||
*
|
||||
* Client parser for browser detection
|
||||
*
|
||||
* @package DeviceDetector\Parser\Client
|
||||
*/
|
||||
class Browser extends ClientParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/client/browsers.yml';
|
||||
protected $parserName = 'browser';
|
||||
|
||||
/**
|
||||
* Known browsers mapped to their internal short codes
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $availableBrowsers = array(
|
||||
'36' => '360 Phone Browser',
|
||||
'3B' => '360 Browser',
|
||||
'AA' => 'Avant Browser',
|
||||
'AB' => 'ABrowse',
|
||||
'AG' => 'ANTGalio',
|
||||
'AM' => 'Amaya',
|
||||
'AO' => 'Amigo',
|
||||
'AN' => 'Android Browser',
|
||||
'AR' => 'Arora',
|
||||
'AV' => 'Amiga Voyager',
|
||||
'AW' => 'Amiga Aweb',
|
||||
'BB' => 'BlackBerry Browser',
|
||||
'BD' => 'Baidu Browser',
|
||||
'BS' => 'Baidu Spark',
|
||||
'BE' => 'Beonex',
|
||||
'BJ' => 'Bunjalloo',
|
||||
'BX' => 'BrowseX',
|
||||
'CA' => 'Camino',
|
||||
'CC' => 'Coc Coc',
|
||||
'CD' => 'Comodo Dragon',
|
||||
'CX' => 'Charon',
|
||||
'CF' => 'Chrome Frame',
|
||||
'CH' => 'Chrome',
|
||||
'CI' => 'Chrome Mobile iOS',
|
||||
'CK' => 'Conkeror',
|
||||
'CM' => 'Chrome Mobile',
|
||||
'CN' => 'CoolNovo',
|
||||
'CO' => 'CometBird',
|
||||
'CP' => 'ChromePlus',
|
||||
'CR' => 'Chromium',
|
||||
'CS' => 'Cheshire',
|
||||
'DE' => 'Deepnet Explorer',
|
||||
'DF' => 'Dolphin',
|
||||
'DI' => 'Dillo',
|
||||
'EL' => 'Elinks',
|
||||
'EP' => 'Epiphany',
|
||||
'ES' => 'Espial TV Browser',
|
||||
'FB' => 'Firebird',
|
||||
'FD' => 'Fluid',
|
||||
'FE' => 'Fennec',
|
||||
'FF' => 'Firefox',
|
||||
'FL' => 'Flock',
|
||||
'FN' => 'Fireweb Navigator',
|
||||
'GA' => 'Galeon',
|
||||
'GE' => 'Google Earth',
|
||||
'HJ' => 'HotJava',
|
||||
'IA' => 'Iceape',
|
||||
'IB' => 'IBrowse',
|
||||
'IC' => 'iCab',
|
||||
'ID' => 'IceDragon',
|
||||
'IW' => 'Iceweasel',
|
||||
'IE' => 'Internet Explorer',
|
||||
'IM' => 'IE Mobile',
|
||||
'IR' => 'Iron',
|
||||
'JS' => 'Jasmine',
|
||||
'KI' => 'Kindle Browser',
|
||||
'KM' => 'K-meleon',
|
||||
'KO' => 'Konqueror',
|
||||
'KP' => 'Kapiko',
|
||||
'KY' => 'Kylo',
|
||||
'KZ' => 'Kazehakase',
|
||||
'LB' => 'Liebao',
|
||||
'LI' => 'Links',
|
||||
'LS' => 'Lunascape',
|
||||
'LX' => 'Lynx',
|
||||
'MB' => 'MicroB',
|
||||
'MC' => 'NCSA Mosaic',
|
||||
'ME' => 'Mercury',
|
||||
'MF' => 'Mobile Safari',
|
||||
'MI' => 'Midori',
|
||||
'MU' => 'MIUI Browser',
|
||||
'MS' => 'Mobile Silk',
|
||||
'MX' => 'Maxthon',
|
||||
'NB' => 'Nokia Browser',
|
||||
'NO' => 'Nokia OSS Browser',
|
||||
'NV' => 'Nokia Ovi Browser',
|
||||
'NF' => 'NetFront',
|
||||
'NL' => 'NetFront Life',
|
||||
'NP' => 'NetPositive',
|
||||
'NS' => 'Netscape',
|
||||
'OB' => 'Obigo',
|
||||
'OD' => 'Odyssey Web Browser',
|
||||
'OF' => 'Off By One',
|
||||
'OE' => 'ONE Browser',
|
||||
'OI' => 'Opera Mini',
|
||||
'OM' => 'Opera Mobile',
|
||||
'OP' => 'Opera',
|
||||
'ON' => 'Opera Next',
|
||||
'OR' => 'Oregano',
|
||||
'OV' => 'Openwave Mobile Browser',
|
||||
'OW' => 'OmniWeb',
|
||||
'PL' => 'Palm Blazer',
|
||||
'PM' => 'Pale Moon',
|
||||
'PR' => 'Palm Pre',
|
||||
'PU' => 'Puffin',
|
||||
'PW' => 'Palm WebPro',
|
||||
'PX' => 'Phoenix',
|
||||
'PO' => 'Polaris',
|
||||
'PS' => 'Microsoft Edge',
|
||||
'QQ' => 'QQ Browser',
|
||||
'RK' => 'Rekonq',
|
||||
'RM' => 'RockMelt',
|
||||
'SA' => 'Sailfish Browser',
|
||||
'SC' => 'SEMC-Browser',
|
||||
'SE' => 'Sogou Explorer',
|
||||
'SF' => 'Safari',
|
||||
'SH' => 'Shiira',
|
||||
'SL' => 'Sleipnir',
|
||||
'SM' => 'SeaMonkey',
|
||||
'SN' => 'Snowshoe',
|
||||
'SR' => 'Sunrise',
|
||||
'SX' => 'Swiftfox',
|
||||
'TZ' => 'Tizen Browser',
|
||||
'UC' => 'UC Browser',
|
||||
'VI' => 'Vivaldi',
|
||||
'WE' => 'WebPositive',
|
||||
'WO' => 'wOSBrowser',
|
||||
'WT' => 'WeTab Browser',
|
||||
'YA' => 'Yandex Browser',
|
||||
'XI' => 'Xiino'
|
||||
);
|
||||
|
||||
/**
|
||||
* Browser families mapped to the short codes of the associated browsers
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $browserFamilies = array(
|
||||
'Android Browser' => array('AN', 'MU'),
|
||||
'BlackBerry Browser' => array('BB'),
|
||||
'Baidu' => array('BD', 'BS'),
|
||||
'Amiga' => array('AV', 'AW'),
|
||||
'Chrome' => array('CH', 'CC', 'CD', 'CM', 'CI', 'CF', 'CN', 'CR', 'CP', 'IR', 'RM', 'AO', 'VI'),
|
||||
'Firefox' => array('FF', 'FE', 'SX', 'FB', 'PX', 'MB'),
|
||||
'Internet Explorer' => array('IE', 'IM', 'PS'),
|
||||
'Konqueror' => array('KO'),
|
||||
'NetFront' => array('NF'),
|
||||
'Nokia Browser' => array('NB', 'NO', 'NV'),
|
||||
'Opera' => array('OP', 'OM', 'OI', 'ON'),
|
||||
'Safari' => array('SF', 'MF'),
|
||||
'Sailfish Browser' => array('SA')
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns list of all available browsers
|
||||
* @return array
|
||||
*/
|
||||
public static function getAvailableBrowsers()
|
||||
{
|
||||
return self::$availableBrowsers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available browser families
|
||||
* @return array
|
||||
*/
|
||||
public static function getAvailableBrowserFamilies()
|
||||
{
|
||||
return self::$browserFamilies;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $browserLabel
|
||||
* @return bool|string If false, "Unknown"
|
||||
*/
|
||||
public static function getBrowserFamily($browserLabel)
|
||||
{
|
||||
foreach (self::$browserFamilies as $browserFamily => $browserLabels) {
|
||||
if (in_array($browserLabel, $browserLabels)) {
|
||||
return $browserFamily;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function parse()
|
||||
{
|
||||
foreach ($this->getRegexes() as $regex) {
|
||||
$matches = $this->matchUserAgent($regex['regex']);
|
||||
if ($matches) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$matches) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$name = $this->buildByMatch($regex['name'], $matches);
|
||||
|
||||
foreach (self::getAvailableBrowsers() as $browserShort => $browserName) {
|
||||
if (strtolower($name) == strtolower($browserName)) {
|
||||
$version = (string) $this->buildVersion($regex['version'], $matches);
|
||||
$engine = $this->buildEngine(isset($regex['engine']) ? $regex['engine'] : array(), $version);
|
||||
return array(
|
||||
'type' => 'browser',
|
||||
'name' => $browserName,
|
||||
'short_name' => $browserShort,
|
||||
'version' => $version,
|
||||
'engine' => $engine
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// This Exception should never be thrown. If so a defined browser name is missing in $availableBrowsers
|
||||
throw new \Exception('Detected browser name was not found in $availableBrowsers'); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
protected function buildEngine($engineData, $browserVersion)
|
||||
{
|
||||
$engine = '';
|
||||
// if an engine is set as default
|
||||
if (isset($engineData['default'])) {
|
||||
$engine = $engineData['default'];
|
||||
}
|
||||
// check if engine is set for browser version
|
||||
if (array_key_exists('versions', $engineData) && is_array($engineData['versions'])) {
|
||||
foreach ($engineData['versions'] as $version => $versionEngine) {
|
||||
if (version_compare($browserVersion, $version) >= 0) {
|
||||
$engine = $versionEngine;
|
||||
}
|
||||
}
|
||||
}
|
||||
// try to detect the engine using the regexes
|
||||
if (empty($engine)) {
|
||||
$engineParser = new Engine();
|
||||
$engineParser->setUserAgent($this->userAgent);
|
||||
$engine = $engineParser->parse();
|
||||
}
|
||||
|
||||
return $engine;
|
||||
}
|
||||
}
|
||||
76
www/analytics/vendor/piwik/device-detector/Parser/Client/Browser/Engine.php
vendored
Normal file
76
www/analytics/vendor/piwik/device-detector/Parser/Client/Browser/Engine.php
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Client\Browser;
|
||||
|
||||
use DeviceDetector\Parser\Client\ClientParserAbstract;
|
||||
|
||||
/**
|
||||
* Class Engine
|
||||
*
|
||||
* Client parser for browser engine detection
|
||||
*
|
||||
* @package DeviceDetector\Parser\Client\Browser
|
||||
*/
|
||||
class Engine extends ClientParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/client/browser_engine.yml';
|
||||
protected $parserName = 'browserengine';
|
||||
|
||||
/**
|
||||
* Known browser engines mapped to their internal short codes
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $availableEngines = array(
|
||||
'WebKit',
|
||||
'Blink',
|
||||
'Trident',
|
||||
'Text-based',
|
||||
'Dillo',
|
||||
'iCab',
|
||||
'Presto',
|
||||
'Gecko',
|
||||
'KHTML',
|
||||
'NetFront',
|
||||
'Edge'
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns list of all available browser engines
|
||||
* @return array
|
||||
*/
|
||||
public static function getAvailableEngines()
|
||||
{
|
||||
return self::$availableEngines;
|
||||
}
|
||||
|
||||
public function parse()
|
||||
{
|
||||
foreach ($this->getRegexes() as $regex) {
|
||||
$matches = $this->matchUserAgent($regex['regex']);
|
||||
if ($matches) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$matches) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$name = $this->buildByMatch($regex['name'], $matches);
|
||||
|
||||
foreach (self::getAvailableEngines() as $engineName) {
|
||||
if (strtolower($name) == strtolower($engineName)) {
|
||||
return $engineName;
|
||||
}
|
||||
}
|
||||
|
||||
// This Exception should never be thrown. If so a defined browser name is missing in $availableEngines
|
||||
throw new \Exception('Detected browser engine was not found in $availableEngines'); // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
74
www/analytics/vendor/piwik/device-detector/Parser/Client/ClientParserAbstract.php
vendored
Normal file
74
www/analytics/vendor/piwik/device-detector/Parser/Client/ClientParserAbstract.php
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Client;
|
||||
|
||||
use DeviceDetector\Parser\ParserAbstract;
|
||||
|
||||
abstract class ClientParserAbstract extends ParserAbstract
|
||||
{
|
||||
protected $fixtureFile = '';
|
||||
protected $parserName = '';
|
||||
|
||||
/**
|
||||
* Parses the current UA and checks whether it contains any client information
|
||||
*
|
||||
* @see $fixtureFile for file with list of detected clients
|
||||
*
|
||||
* Step 1: Build a big regex containing all regexes and match UA against it
|
||||
* -> If no matches found: return
|
||||
* -> Otherwise:
|
||||
* Step 2: Walk through the list of regexes in feed_readers.yml and try to match every one
|
||||
* -> Return the matched feed reader
|
||||
*
|
||||
* NOTE: Doing the big match before matching every single regex speeds up the detection
|
||||
*/
|
||||
public function parse()
|
||||
{
|
||||
$result = null;
|
||||
|
||||
if ($this->preMatchOverall()) {
|
||||
foreach ($this->getRegexes() as $regex) {
|
||||
$matches = $this->matchUserAgent($regex['regex']);
|
||||
|
||||
if ($matches) {
|
||||
$result = array(
|
||||
'type' => $this->parserName,
|
||||
'name' => $this->buildByMatch($regex['name'], $matches),
|
||||
'version' => $this->buildVersion($regex['version'], $matches)
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all names defined in the regexes
|
||||
*
|
||||
* Attention: This method might not return all names of detected clients
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAvailableClients()
|
||||
{
|
||||
$instance = new static();
|
||||
$regexes = $instance->getRegexes();
|
||||
$names = array();
|
||||
foreach ($regexes as $regex) {
|
||||
if ($regex['name'] != '$1') {
|
||||
$names[] = $regex['name'];
|
||||
}
|
||||
}
|
||||
|
||||
natcasesort($names);
|
||||
|
||||
return array_unique($names);
|
||||
}
|
||||
}
|
||||
21
www/analytics/vendor/piwik/device-detector/Parser/Client/FeedReader.php
vendored
Normal file
21
www/analytics/vendor/piwik/device-detector/Parser/Client/FeedReader.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Client;
|
||||
|
||||
/**
|
||||
* Class FeedReader
|
||||
*
|
||||
* Client parser for feed reader detection
|
||||
*
|
||||
* @package DeviceDetector\Parser\Client
|
||||
*/
|
||||
class FeedReader extends ClientParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/client/feed_readers.yml';
|
||||
protected $parserName = 'feed reader';
|
||||
}
|
||||
21
www/analytics/vendor/piwik/device-detector/Parser/Client/Library.php
vendored
Normal file
21
www/analytics/vendor/piwik/device-detector/Parser/Client/Library.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Client;
|
||||
|
||||
/**
|
||||
* Class Library
|
||||
*
|
||||
* Client parser for tool & software detection
|
||||
*
|
||||
* @package DeviceDetector\Parser\Client
|
||||
*/
|
||||
class Library extends ClientParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/client/libraries.yml';
|
||||
protected $parserName = 'library';
|
||||
}
|
||||
21
www/analytics/vendor/piwik/device-detector/Parser/Client/MediaPlayer.php
vendored
Normal file
21
www/analytics/vendor/piwik/device-detector/Parser/Client/MediaPlayer.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Client;
|
||||
|
||||
/**
|
||||
* Class MediaPlayer
|
||||
*
|
||||
* Client parser for mediaplayer detection
|
||||
*
|
||||
* @package DeviceDetector\Parser\Client
|
||||
*/
|
||||
class MediaPlayer extends ClientParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/client/mediaplayers.yml';
|
||||
protected $parserName = 'mediaplayer';
|
||||
}
|
||||
21
www/analytics/vendor/piwik/device-detector/Parser/Client/MobileApp.php
vendored
Normal file
21
www/analytics/vendor/piwik/device-detector/Parser/Client/MobileApp.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Client;
|
||||
|
||||
/**
|
||||
* Class MobileApp
|
||||
*
|
||||
* Client parser for mobile app detection
|
||||
*
|
||||
* @package DeviceDetector\Parser\Client
|
||||
*/
|
||||
class MobileApp extends ClientParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/client/mobile_apps.yml';
|
||||
protected $parserName = 'mobile app';
|
||||
}
|
||||
21
www/analytics/vendor/piwik/device-detector/Parser/Client/PIM.php
vendored
Normal file
21
www/analytics/vendor/piwik/device-detector/Parser/Client/PIM.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Client;
|
||||
|
||||
/**
|
||||
* Class PIM
|
||||
*
|
||||
* Client parser for pim (personal information manager) detection
|
||||
*
|
||||
* @package DeviceDetector\Parser\Client
|
||||
*/
|
||||
class PIM extends ClientParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/client/pim.yml';
|
||||
protected $parserName = 'pim';
|
||||
}
|
||||
30
www/analytics/vendor/piwik/device-detector/Parser/Device/Camera.php
vendored
Normal file
30
www/analytics/vendor/piwik/device-detector/Parser/Device/Camera.php
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Device;
|
||||
|
||||
/**
|
||||
* Class Camera
|
||||
*
|
||||
* Device parser for camera detection
|
||||
*
|
||||
* @package DeviceDetector\Parser\Device
|
||||
*/
|
||||
class Camera extends DeviceParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/device/cameras.yml';
|
||||
protected $parserName = 'camera';
|
||||
|
||||
public function parse()
|
||||
{
|
||||
if (!$this->preMatchOverall()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return parent::parse();
|
||||
}
|
||||
}
|
||||
30
www/analytics/vendor/piwik/device-detector/Parser/Device/CarBrowser.php
vendored
Normal file
30
www/analytics/vendor/piwik/device-detector/Parser/Device/CarBrowser.php
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Device;
|
||||
|
||||
/**
|
||||
* Class CarBrowser
|
||||
*
|
||||
* Device parser for car browser detection
|
||||
*
|
||||
* @package DeviceDetector\Parser\Device
|
||||
*/
|
||||
class CarBrowser extends DeviceParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/device/car_browsers.yml';
|
||||
protected $parserName = 'car browser';
|
||||
|
||||
public function parse()
|
||||
{
|
||||
if (!$this->preMatchOverall()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return parent::parse();
|
||||
}
|
||||
}
|
||||
30
www/analytics/vendor/piwik/device-detector/Parser/Device/Console.php
vendored
Normal file
30
www/analytics/vendor/piwik/device-detector/Parser/Device/Console.php
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Device;
|
||||
|
||||
/**
|
||||
* Class Console
|
||||
*
|
||||
* Device parser for console detection
|
||||
*
|
||||
* @package DeviceDetector\Parser\Device
|
||||
*/
|
||||
class Console extends DeviceParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/device/consoles.yml';
|
||||
protected $parserName = 'console';
|
||||
|
||||
public function parse()
|
||||
{
|
||||
if (!$this->preMatchOverall()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return parent::parse();
|
||||
}
|
||||
}
|
||||
504
www/analytics/vendor/piwik/device-detector/Parser/Device/DeviceParserAbstract.php
vendored
Normal file
504
www/analytics/vendor/piwik/device-detector/Parser/Device/DeviceParserAbstract.php
vendored
Normal file
|
|
@ -0,0 +1,504 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Device;
|
||||
|
||||
use DeviceDetector\Parser\ParserAbstract;
|
||||
|
||||
/**
|
||||
* Class DeviceParserAbstract
|
||||
*
|
||||
* Abstract class for all device parsers
|
||||
*
|
||||
* @package DeviceDetector\Parser\Device
|
||||
*/
|
||||
abstract class DeviceParserAbstract extends ParserAbstract
|
||||
{
|
||||
protected $deviceType = null;
|
||||
protected $model = null;
|
||||
protected $brand = null;
|
||||
|
||||
const DEVICE_TYPE_DESKTOP = 0;
|
||||
const DEVICE_TYPE_SMARTPHONE = 1;
|
||||
const DEVICE_TYPE_TABLET = 2;
|
||||
const DEVICE_TYPE_FEATURE_PHONE = 3;
|
||||
const DEVICE_TYPE_CONSOLE = 4;
|
||||
const DEVICE_TYPE_TV = 5; // including set top boxes, blu-ray players,...
|
||||
const DEVICE_TYPE_CAR_BROWSER = 6;
|
||||
const DEVICE_TYPE_SMART_DISPLAY = 7;
|
||||
const DEVICE_TYPE_CAMERA = 8;
|
||||
const DEVICE_TYPE_PORTABLE_MEDIA_PAYER = 9;
|
||||
const DEVICE_TYPE_PHABLET = 10;
|
||||
|
||||
/**
|
||||
* Detectable device types
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $deviceTypes = array(
|
||||
'desktop' => self::DEVICE_TYPE_DESKTOP,
|
||||
'smartphone' => self::DEVICE_TYPE_SMARTPHONE,
|
||||
'tablet' => self::DEVICE_TYPE_TABLET,
|
||||
'feature phone' => self::DEVICE_TYPE_FEATURE_PHONE,
|
||||
'console' => self::DEVICE_TYPE_CONSOLE,
|
||||
'tv' => self::DEVICE_TYPE_TV,
|
||||
'car browser' => self::DEVICE_TYPE_CAR_BROWSER,
|
||||
'smart display' => self::DEVICE_TYPE_SMART_DISPLAY,
|
||||
'camera' => self::DEVICE_TYPE_CAMERA,
|
||||
'portable media player' => self::DEVICE_TYPE_PORTABLE_MEDIA_PAYER,
|
||||
'phablet' => self::DEVICE_TYPE_PHABLET
|
||||
);
|
||||
|
||||
/**
|
||||
* Known device brands
|
||||
*
|
||||
* Note: Before using a new brand in on of the regex files, it needs to be added here
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $deviceBrands = array(
|
||||
'3Q' => '3Q',
|
||||
'AC' => 'Acer',
|
||||
'AZ' => 'Ainol',
|
||||
'AI' => 'Airness',
|
||||
'AL' => 'Alcatel',
|
||||
'A2' => 'Allview',
|
||||
'A1' => 'Altech UEC',
|
||||
'AN' => 'Arnova',
|
||||
'KN' => 'Amazon',
|
||||
'AO' => 'Amoi',
|
||||
'AP' => 'Apple',
|
||||
'AR' => 'Archos',
|
||||
'AS' => 'ARRIS',
|
||||
'AT' => 'Airties',
|
||||
'AU' => 'Asus',
|
||||
'AV' => 'Avvio',
|
||||
'AX' => 'Audiovox',
|
||||
'AY' => 'Axxion',
|
||||
'BB' => 'BBK',
|
||||
'BE' => 'Becker',
|
||||
'BI' => 'Bird',
|
||||
'BL' => 'Beetel',
|
||||
'BM' => 'Bmobile',
|
||||
'BN' => 'Barnes & Noble',
|
||||
'BO' => 'BangOlufsen',
|
||||
'BQ' => 'BenQ',
|
||||
'BS' => 'BenQ-Siemens',
|
||||
'BU' => 'Blu',
|
||||
'BW' => 'Boway',
|
||||
'BX' => 'bq',
|
||||
'BR' => 'Brondi',
|
||||
'B1' => 'Bush',
|
||||
'CB' => 'CUBOT',
|
||||
'CF' => 'Carrefour',
|
||||
'CP' => 'Captiva',
|
||||
'CS' => 'Casio',
|
||||
'CA' => 'Cat',
|
||||
'CE' => 'Celkon',
|
||||
'CC' => 'ConCorde',
|
||||
'C2' => 'Changhong',
|
||||
'CH' => 'Cherry Mobile',
|
||||
'CK' => 'Cricket',
|
||||
'C1' => 'Crosscall',
|
||||
'CL' => 'Compal',
|
||||
'CN' => 'CnM',
|
||||
'CM' => 'Crius Mea',
|
||||
'CR' => 'CreNova',
|
||||
'CT' => 'Capitel',
|
||||
'CQ' => 'Compaq',
|
||||
'CO' => 'Coolpad',
|
||||
'CW' => 'Cowon',
|
||||
'CU' => 'Cube',
|
||||
'CY' => 'Coby Kyros',
|
||||
'DA' => 'Danew',
|
||||
'DT' => 'Datang',
|
||||
'DE' => 'Denver',
|
||||
'DS' => 'Desay',
|
||||
'DB' => 'Dbtel',
|
||||
'DC' => 'DoCoMo',
|
||||
'DI' => 'Dicam',
|
||||
'DL' => 'Dell',
|
||||
'DM' => 'DMM',
|
||||
'DO' => 'Doogee',
|
||||
'DV' => 'Doov',
|
||||
'DP' => 'Dopod',
|
||||
'DU' => 'Dune HD',
|
||||
'EB' => 'E-Boda',
|
||||
'EA' => 'EBEST',
|
||||
'EC' => 'Ericsson',
|
||||
'ES' => 'ECS',
|
||||
'EI' => 'Ezio',
|
||||
'EL' => 'Elephone',
|
||||
'EP' => 'Easypix',
|
||||
'E1' => 'Energy Sistem',
|
||||
'ER' => 'Ericy',
|
||||
'EN' => 'Eton',
|
||||
'ET' => 'eTouch',
|
||||
'EV' => 'Evertek',
|
||||
'EZ' => 'Ezze',
|
||||
'FL' => 'Fly',
|
||||
'FO' => 'Foxconn',
|
||||
'FU' => 'Fujitsu',
|
||||
'GM' => 'Garmin-Asus',
|
||||
'GA' => 'Gateway',
|
||||
'GD' => 'Gemini',
|
||||
'GI' => 'Gionee',
|
||||
'GG' => 'Gigabyte',
|
||||
'GS' => 'Gigaset',
|
||||
'GC' => 'GOCLEVER',
|
||||
'GL' => 'Goly',
|
||||
'GO' => 'Google',
|
||||
'GR' => 'Gradiente',
|
||||
'GU' => 'Grundig',
|
||||
'HA' => 'Haier',
|
||||
'HS' => 'Hasee',
|
||||
'HI' => 'Hisense',
|
||||
'HL' => 'Hi-Level',
|
||||
'HO' => 'Hosin',
|
||||
'HP' => 'HP',
|
||||
'HT' => 'HTC',
|
||||
'HU' => 'Huawei',
|
||||
'HX' => 'Humax',
|
||||
'HY' => 'Hyrican',
|
||||
'HN' => 'Hyundai',
|
||||
'IA' => 'Ikea',
|
||||
'IB' => 'iBall',
|
||||
'IJ' => 'i-Joy',
|
||||
'IY' => 'iBerry',
|
||||
'IK' => 'iKoMo',
|
||||
'IM' => 'i-mate',
|
||||
'I1' => 'iOcean',
|
||||
'IF' => 'Infinix',
|
||||
'IN' => 'Innostream',
|
||||
'II' => 'Inkti',
|
||||
'IX' => 'Intex',
|
||||
'IO' => 'i-mobile',
|
||||
'IQ' => 'INQ',
|
||||
'IT' => 'Intek',
|
||||
'IV' => 'Inverto',
|
||||
'IZ' => 'iTel',
|
||||
'JI' => 'Jiayu',
|
||||
'JO' => 'Jolla',
|
||||
'KA' => 'Karbonn',
|
||||
'KD' => 'KDDI',
|
||||
'KI' => 'Kingsun',
|
||||
'KO' => 'Konka',
|
||||
'KM' => 'Komu',
|
||||
'KB' => 'Koobee',
|
||||
'KT' => 'K-Touch',
|
||||
'KH' => 'KT-Tech',
|
||||
'KP' => 'KOPO',
|
||||
'KR' => 'Koridy',
|
||||
'KU' => 'Kumai',
|
||||
'KY' => 'Kyocera',
|
||||
'KZ' => 'Kazam',
|
||||
'LV' => 'Lava',
|
||||
'LA' => 'Lanix',
|
||||
'LC' => 'LCT',
|
||||
'LE' => 'Lenovo',
|
||||
'LN' => 'Lenco',
|
||||
'LP' => 'Le Pan',
|
||||
'LG' => 'LG',
|
||||
'LI' => 'Lingwin',
|
||||
'LO' => 'Loewe',
|
||||
'LM' => 'Logicom',
|
||||
'LX' => 'Lexibook',
|
||||
'MJ' => 'Majestic',
|
||||
'MA' => 'Manta Multimedia',
|
||||
'MB' => 'Mobistel',
|
||||
'M3' => 'Mecer',
|
||||
'MD' => 'Medion',
|
||||
'M2' => 'MEEG',
|
||||
'M1' => 'Meizu',
|
||||
'ME' => 'Metz',
|
||||
'MX' => 'MEU',
|
||||
'MI' => 'MicroMax',
|
||||
'MC' => 'Mediacom',
|
||||
'MK' => 'MediaTek',
|
||||
'MO' => 'Mio',
|
||||
'MM' => 'Mpman',
|
||||
'MF' => 'Mofut',
|
||||
'MR' => 'Motorola',
|
||||
'MS' => 'Microsoft',
|
||||
'MZ' => 'MSI',
|
||||
'MU' => 'Memup',
|
||||
'MT' => 'Mitsubishi',
|
||||
'ML' => 'MLLED',
|
||||
'MQ' => 'M.T.T.',
|
||||
'MY' => 'MyPhone',
|
||||
'NE' => 'NEC',
|
||||
'NA' => 'Netgear',
|
||||
'NG' => 'NGM',
|
||||
'NI' => 'Nintendo',
|
||||
'N1' => 'Noain',
|
||||
'NK' => 'Nokia',
|
||||
'NM' => 'Nomi',
|
||||
'NN' => 'Nikon',
|
||||
'NW' => 'Newgen',
|
||||
'NX' => 'Nexian',
|
||||
'NT' => 'NextBook',
|
||||
'OD' => 'Onda',
|
||||
'ON' => 'OnePlus',
|
||||
'OP' => 'OPPO',
|
||||
'OR' => 'Orange',
|
||||
'OT' => 'O2',
|
||||
'OK' => 'Ouki',
|
||||
'OU' => 'OUYA',
|
||||
'OO' => 'Opsson',
|
||||
'PA' => 'Panasonic',
|
||||
'PE' => 'PEAQ',
|
||||
'PH' => 'Philips',
|
||||
'PL' => 'Polaroid',
|
||||
'PM' => 'Palm',
|
||||
'PO' => 'phoneOne',
|
||||
'PT' => 'Pantech',
|
||||
'PV' => 'Point of View',
|
||||
'PP' => 'PolyPad',
|
||||
'P2' => 'Pomp',
|
||||
'PS' => 'Positivo',
|
||||
'PR' => 'Prestigio',
|
||||
'P1' => 'ProScan',
|
||||
'PU' => 'PULID',
|
||||
'QI' => 'Qilive',
|
||||
'QT' => 'Qtek',
|
||||
'QM' => 'QMobile',
|
||||
'QU' => 'Quechua',
|
||||
'OV' => 'Overmax',
|
||||
'OY' => 'Oysters',
|
||||
'RA' => 'Ramos',
|
||||
'RC' => 'RCA Tablets',
|
||||
'RB' => 'Readboy',
|
||||
'RI' => 'Rikomagic',
|
||||
'RM' => 'RIM',
|
||||
'RK' => 'Roku',
|
||||
'RO' => 'Rover',
|
||||
'SA' => 'Samsung',
|
||||
'SD' => 'Sega',
|
||||
'SE' => 'Sony Ericsson',
|
||||
'S1' => 'Sencor',
|
||||
'SF' => 'Softbank',
|
||||
'SX' => 'SFR',
|
||||
'SG' => 'Sagem',
|
||||
'SH' => 'Sharp',
|
||||
'SI' => 'Siemens',
|
||||
'SN' => 'Sendo',
|
||||
'SK' => 'Skyworth',
|
||||
'SC' => 'Smartfren',
|
||||
'SO' => 'Sony',
|
||||
'SP' => 'Spice',
|
||||
'SU' => 'SuperSonic',
|
||||
'SV' => 'Selevision',
|
||||
'SY' => 'Sanyo',
|
||||
'SM' => 'Symphony',
|
||||
'SR' => 'Smart',
|
||||
'S4' => 'Star',
|
||||
'ST' => 'Storex',
|
||||
'S2' => 'Stonex',
|
||||
'S3' => 'SunVan',
|
||||
'SZ' => 'Sumvision',
|
||||
'TA' => 'Tesla',
|
||||
'TC' => 'TCL',
|
||||
'TE' => 'Telit',
|
||||
'T4' => 'ThL',
|
||||
'TH' => 'TiPhone',
|
||||
'TB' => 'Tecno Mobile',
|
||||
'TD' => 'Tesco',
|
||||
'TI' => 'TIANYU',
|
||||
'TL' => 'Telefunken',
|
||||
'T2' => 'Telenor',
|
||||
'TM' => 'T-Mobile',
|
||||
'TN' => 'Thomson',
|
||||
'T1' => 'Tolino',
|
||||
'TO' => 'Toplux',
|
||||
'TS' => 'Toshiba',
|
||||
'TT' => 'TechnoTrend',
|
||||
'T3' => 'Trevi',
|
||||
'TU' => 'Tunisie Telecom',
|
||||
'TR' => 'Turbo-X',
|
||||
'TV' => 'TVC',
|
||||
'TX' => 'TechniSat',
|
||||
'TZ' => 'teXet',
|
||||
'UN' => 'Unowhy',
|
||||
'US' => 'Uniscope',
|
||||
'UT' => 'UTStarcom',
|
||||
'VA' => 'Vastking',
|
||||
'VD' => 'Videocon',
|
||||
'VE' => 'Vertu',
|
||||
'VI' => 'Vitelcom',
|
||||
'VK' => 'VK Mobile',
|
||||
'VS' => 'ViewSonic',
|
||||
'VT' => 'Vestel',
|
||||
'VV' => 'Vivo',
|
||||
'V1' => 'Voto',
|
||||
'VO' => 'Voxtel',
|
||||
'VF' => 'Vodafone',
|
||||
'VZ' => 'Vizio',
|
||||
'VW' => 'Videoweb',
|
||||
'WA' => 'Walton',
|
||||
'WB' => 'Web TV',
|
||||
'WE' => 'WellcoM',
|
||||
'WY' => 'Wexler',
|
||||
'WI' => 'Wiko',
|
||||
'WL' => 'Wolder',
|
||||
'WO' => 'Wonu',
|
||||
'WX' => 'Woxter',
|
||||
'XI' => 'Xiaomi',
|
||||
'XO' => 'Xolo',
|
||||
'XX' => 'Unknown',
|
||||
'YA' => 'Yarvik',
|
||||
'YU' => 'Yuandao',
|
||||
'YS' => 'Yusun',
|
||||
'YT' => 'Ytone',
|
||||
'ZE' => 'Zeemi',
|
||||
'ZO' => 'Zonda',
|
||||
'ZP' => 'Zopo',
|
||||
'ZT' => 'ZTE',
|
||||
);
|
||||
|
||||
public function getDeviceType()
|
||||
{
|
||||
return $this->deviceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns available device types
|
||||
*
|
||||
* @see $deviceTypes
|
||||
* @return array
|
||||
*/
|
||||
public static function getAvailableDeviceTypes()
|
||||
{
|
||||
return self::$deviceTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns names of all available device types
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAvailableDeviceTypeNames()
|
||||
{
|
||||
return array_keys(self::$deviceTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the given device type
|
||||
*
|
||||
* @param int $deviceType one of the DEVICE_TYPE_* constants
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getDeviceName($deviceType)
|
||||
{
|
||||
return array_search($deviceType, self::$deviceTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the detected device model
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModel()
|
||||
{
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the detected device brand
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBrand()
|
||||
{
|
||||
return $this->brand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full brand name for the given short name
|
||||
*
|
||||
* @param string $brandId short brand name
|
||||
* @return string
|
||||
*/
|
||||
public static function getFullName($brandId)
|
||||
{
|
||||
if (array_key_exists($brandId, self::$deviceBrands)) {
|
||||
return self::$deviceBrands[$brandId];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function parse()
|
||||
{
|
||||
$regexes = $this->getRegexes();
|
||||
foreach ($regexes as $brand => $regex) {
|
||||
$matches = $this->matchUserAgent($regex['regex']);
|
||||
if ($matches) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($matches)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$brandId = array_search($brand, self::$deviceBrands);
|
||||
if ($brandId === false) {
|
||||
// This Exception should never be thrown. If so a defined brand name is missing in $deviceBrands
|
||||
throw new \Exception("The brand with name '$brand' should be listed in the deviceBrands array."); // @codeCoverageIgnore
|
||||
}
|
||||
$this->brand = $brandId;
|
||||
|
||||
if (isset($regex['device']) && in_array($regex['device'], self::$deviceTypes)) {
|
||||
$this->deviceType = self::$deviceTypes[$regex['device']];
|
||||
}
|
||||
|
||||
if (isset($regex['model'])) {
|
||||
$this->model = $this->buildModel($regex['model'], $matches);
|
||||
}
|
||||
|
||||
if (isset($regex['models'])) {
|
||||
foreach ($regex['models'] as $modelRegex) {
|
||||
$modelMatches = $this->matchUserAgent($modelRegex['regex']);
|
||||
if ($modelMatches) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($modelMatches)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->model = trim($this->buildModel($modelRegex['model'], $modelMatches));
|
||||
|
||||
if (isset($modelRegex['brand']) && $brandId = array_search($modelRegex['brand'], self::$deviceBrands)) {
|
||||
$this->brand = $brandId;
|
||||
}
|
||||
|
||||
if (isset($modelRegex['device']) && in_array($modelRegex['device'], self::$deviceTypes)) {
|
||||
$this->deviceType = self::$deviceTypes[$modelRegex['device']];
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function buildModel($model, $matches)
|
||||
{
|
||||
$model = $this->buildByMatch($model, $matches);
|
||||
|
||||
$model = str_replace('_', ' ', $model);
|
||||
|
||||
$model = preg_replace('/ TD$/i', '', $model);
|
||||
|
||||
if ($model === 'Build') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
53
www/analytics/vendor/piwik/device-detector/Parser/Device/HbbTv.php
vendored
Normal file
53
www/analytics/vendor/piwik/device-detector/Parser/Device/HbbTv.php
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Device;
|
||||
|
||||
/**
|
||||
* Class HbbTv
|
||||
*
|
||||
* Device parser for hbbtv detection
|
||||
*
|
||||
* @package DeviceDetector\Parser\Device
|
||||
*/
|
||||
class HbbTv extends DeviceParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/device/televisions.yml';
|
||||
protected $parserName = 'tv';
|
||||
|
||||
/**
|
||||
* Parses the current UA and checks whether it contains HbbTv information
|
||||
*
|
||||
* @see televisions.yml for list of detected televisions
|
||||
*/
|
||||
public function parse()
|
||||
{
|
||||
// only parse user agents containing hbbtv fragment
|
||||
if (!$this->isHbbTv()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
parent::parse();
|
||||
|
||||
// always set device type to tv, even if no model/brand could be found
|
||||
$this->deviceType = self::DEVICE_TYPE_TV;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the parsed UA was identified as a HbbTV device
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isHbbTv()
|
||||
{
|
||||
$regex = 'HbbTV/([1-9]{1}(?:\.[0-9]{1}){1,2})';
|
||||
$match = $this->matchUserAgent($regex);
|
||||
return $match ? $match[1] : false;
|
||||
}
|
||||
}
|
||||
21
www/analytics/vendor/piwik/device-detector/Parser/Device/Mobile.php
vendored
Normal file
21
www/analytics/vendor/piwik/device-detector/Parser/Device/Mobile.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Device;
|
||||
|
||||
/**
|
||||
* Class Mobile
|
||||
*
|
||||
* Device parser for mobile detection
|
||||
*
|
||||
* @package DeviceDetector\Parser\Device
|
||||
*/
|
||||
class Mobile extends DeviceParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/device/mobiles.yml';
|
||||
protected $parserName = 'mobile';
|
||||
}
|
||||
30
www/analytics/vendor/piwik/device-detector/Parser/Device/PortableMediaPlayer.php
vendored
Normal file
30
www/analytics/vendor/piwik/device-detector/Parser/Device/PortableMediaPlayer.php
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser\Device;
|
||||
|
||||
/**
|
||||
* Class PortableMediaPlayer
|
||||
*
|
||||
* Device parser for portable media player detection
|
||||
*
|
||||
* @package DeviceDetector\Parser\Device
|
||||
*/
|
||||
class PortableMediaPlayer extends DeviceParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/device/portable_media_player.yml';
|
||||
protected $parserName = 'portablemediaplayer';
|
||||
|
||||
public function parse()
|
||||
{
|
||||
if (!$this->preMatchOverall()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return parent::parse();
|
||||
}
|
||||
}
|
||||
245
www/analytics/vendor/piwik/device-detector/Parser/OperatingSystem.php
vendored
Normal file
245
www/analytics/vendor/piwik/device-detector/Parser/OperatingSystem.php
vendored
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser;
|
||||
|
||||
/**
|
||||
* Class OperatingSystem
|
||||
*
|
||||
* Parses the useragent for operating system information
|
||||
*
|
||||
* Detected operating systems can be found in self::$operatingSystems and /regexes/oss.yml
|
||||
* This class also defined some operating system families and methods to get the family for a specific os
|
||||
*
|
||||
* @package DeviceDetector\Parser
|
||||
*/
|
||||
class OperatingSystem extends ParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/oss.yml';
|
||||
protected $parserName = 'os';
|
||||
|
||||
/**
|
||||
* Known operating systems mapped to their internal short codes
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $operatingSystems = array(
|
||||
'AIX' => 'AIX',
|
||||
'AND' => 'Android',
|
||||
'AMG' => 'AmigaOS',
|
||||
'ATV' => 'Apple TV',
|
||||
'ARL' => 'Arch Linux',
|
||||
'BTR' => 'BackTrack',
|
||||
'SBA' => 'Bada',
|
||||
'BEO' => 'BeOS',
|
||||
'BLB' => 'BlackBerry OS',
|
||||
'QNX' => 'BlackBerry Tablet OS',
|
||||
'BMP' => 'Brew',
|
||||
'CES' => 'CentOS',
|
||||
'COS' => 'Chrome OS',
|
||||
'CYN' => 'CyanogenMod',
|
||||
'DEB' => 'Debian',
|
||||
'DFB' => 'DragonFly',
|
||||
'FED' => 'Fedora',
|
||||
'FOS' => 'Firefox OS',
|
||||
'BSD' => 'FreeBSD',
|
||||
'GNT' => 'Gentoo',
|
||||
'GTV' => 'Google TV',
|
||||
'HPX' => 'HP-UX',
|
||||
'HAI' => 'Haiku OS',
|
||||
'IRI' => 'IRIX',
|
||||
'INF' => 'Inferno',
|
||||
'KNO' => 'Knoppix',
|
||||
'KBT' => 'Kubuntu',
|
||||
'LIN' => 'GNU/Linux',
|
||||
'LBT' => 'Lubuntu',
|
||||
'VLN' => 'VectorLinux',
|
||||
'MAC' => 'Mac',
|
||||
'MAE' => 'Maemo',
|
||||
'MDR' => 'Mandriva',
|
||||
'SMG' => 'MeeGo',
|
||||
'MCD' => 'MocorDroid',
|
||||
'MIN' => 'Mint',
|
||||
'MLD' => 'MildWild',
|
||||
'MOR' => 'MorphOS',
|
||||
'NBS' => 'NetBSD',
|
||||
'MTK' => 'MTK / Nucleus',
|
||||
'WII' => 'Nintendo',
|
||||
'NDS' => 'Nintendo Mobile',
|
||||
'OS2' => 'OS/2',
|
||||
'T64' => 'OSF1',
|
||||
'OBS' => 'OpenBSD',
|
||||
'PSP' => 'PlayStation Portable',
|
||||
'PS3' => 'PlayStation',
|
||||
'RHT' => 'Red Hat',
|
||||
'ROS' => 'RISC OS',
|
||||
'RZD' => 'RazoDroiD',
|
||||
'SAB' => 'Sabayon',
|
||||
'SSE' => 'SUSE',
|
||||
'SAF' => 'Sailfish OS',
|
||||
'SLW' => 'Slackware',
|
||||
'SOS' => 'Solaris',
|
||||
'SYL' => 'Syllable',
|
||||
'SYM' => 'Symbian',
|
||||
'SYS' => 'Symbian OS',
|
||||
'S40' => 'Symbian OS Series 40',
|
||||
'S60' => 'Symbian OS Series 60',
|
||||
'SY3' => 'Symbian^3',
|
||||
'TDX' => 'ThreadX',
|
||||
'TIZ' => 'Tizen',
|
||||
'UBT' => 'Ubuntu',
|
||||
'WTV' => 'WebTV',
|
||||
'WIN' => 'Windows',
|
||||
'WCE' => 'Windows CE',
|
||||
'WMO' => 'Windows Mobile',
|
||||
'WPH' => 'Windows Phone',
|
||||
'WRT' => 'Windows RT',
|
||||
'XBX' => 'Xbox',
|
||||
'XBT' => 'Xubuntu',
|
||||
'YNS' => 'YunOs',
|
||||
'IOS' => 'iOS',
|
||||
'POS' => 'palmOS',
|
||||
'WOS' => 'webOS'
|
||||
);
|
||||
|
||||
/**
|
||||
* Operating system families mapped to the short codes of the associated operating systems
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $osFamilies = array(
|
||||
'Android' => array('AND', 'CYN', 'RZD', 'MLD', 'MCD'),
|
||||
'AmigaOS' => array('AMG', 'MOR'),
|
||||
'Apple TV' => array('ATV'),
|
||||
'BlackBerry' => array('BLB', 'QNX'),
|
||||
'Brew' => array('BMP'),
|
||||
'BeOS' => array('BEO', 'HAI'),
|
||||
'Chrome OS' => array('COS'),
|
||||
'Firefox OS' => array('FOS'),
|
||||
'Gaming Console' => array('WII', 'PS3'),
|
||||
'Google TV' => array('GTV'),
|
||||
'IBM' => array('OS2'),
|
||||
'iOS' => array('IOS'),
|
||||
'RISC OS' => array('ROS'),
|
||||
'GNU/Linux' => array('LIN', 'ARL', 'DEB', 'KNO', 'MIN', 'UBT', 'KBT', 'XBT', 'LBT', 'FED', 'RHT', 'VLN', 'MDR', 'GNT', 'SAB', 'SLW', 'SSE', 'CES', 'BTR', 'YNS', 'SAF'),
|
||||
'Mac' => array('MAC'),
|
||||
'Mobile Gaming Console' => array('PSP', 'NDS', 'XBX'),
|
||||
'Real-time OS' => array('MTK', 'TDX'),
|
||||
'Other Mobile' => array('WOS', 'POS', 'SBA', 'TIZ', 'SMG', 'MAE'),
|
||||
'Symbian' => array('SYM', 'SYS', 'SY3', 'S60', 'S40'),
|
||||
'Unix' => array('SOS', 'AIX', 'HPX', 'BSD', 'NBS', 'OBS', 'DFB', 'SYL', 'IRI', 'T64', 'INF'),
|
||||
'WebTV' => array('WTV'),
|
||||
'Windows' => array('WIN'),
|
||||
'Windows Mobile' => array('WPH', 'WMO', 'WCE', 'WRT')
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns all available operating systems
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAvailableOperatingSystems()
|
||||
{
|
||||
return self::$operatingSystems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all available operating system families
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAvailableOperatingSystemFamilies()
|
||||
{
|
||||
return self::$osFamilies;
|
||||
}
|
||||
|
||||
public function parse()
|
||||
{
|
||||
$return = array();
|
||||
|
||||
foreach ($this->getRegexes() as $osRegex) {
|
||||
$matches = $this->matchUserAgent($osRegex['regex']);
|
||||
if ($matches) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$matches) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
$name = $this->buildByMatch($osRegex['name'], $matches);
|
||||
$short = 'UNK';
|
||||
|
||||
foreach (self::$operatingSystems as $osShort => $osName) {
|
||||
if (strtolower($name) == strtolower($osName)) {
|
||||
$name = $osName;
|
||||
$short = $osShort;
|
||||
}
|
||||
}
|
||||
|
||||
$return = array(
|
||||
'name' => $name,
|
||||
'short_name' => $short,
|
||||
'version' => $this->buildVersion($osRegex['version'], $matches),
|
||||
'platform' => $this->parsePlatform()
|
||||
);
|
||||
|
||||
if (in_array($return['name'], self::$operatingSystems)) {
|
||||
$return['short_name'] = array_search($return['name'], self::$operatingSystems);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
protected function parsePlatform()
|
||||
{
|
||||
if ($this->matchUserAgent('arm')) {
|
||||
return 'ARM';
|
||||
} elseif ($this->matchUserAgent('WOW64|x64|win64|amd64|x86_64')) {
|
||||
return 'x64';
|
||||
} elseif ($this->matchUserAgent('i[0-9]86|i86pc')) {
|
||||
return 'x86';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the operating system family for the given operating system
|
||||
*
|
||||
* @param $osLabel
|
||||
* @return bool|string If false, "Unknown"
|
||||
*/
|
||||
public static function getOsFamily($osLabel)
|
||||
{
|
||||
foreach (self::$osFamilies as $family => $labels) {
|
||||
if (in_array($osLabel, $labels)) {
|
||||
return $family;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full name for the given short name
|
||||
*
|
||||
* @param $os
|
||||
* @param bool $ver
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
public static function getNameFromId($os, $ver = false)
|
||||
{
|
||||
if (array_key_exists($os, self::$operatingSystems)) {
|
||||
$osFullName = self::$operatingSystems[$os];
|
||||
return trim($osFullName . " " . $ver);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
283
www/analytics/vendor/piwik/device-detector/Parser/ParserAbstract.php
vendored
Normal file
283
www/analytics/vendor/piwik/device-detector/Parser/ParserAbstract.php
vendored
Normal file
|
|
@ -0,0 +1,283 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser;
|
||||
|
||||
use DeviceDetector\Cache\StaticCache;
|
||||
use DeviceDetector\DeviceDetector;
|
||||
use DeviceDetector\Cache\Cache;
|
||||
use \Spyc;
|
||||
|
||||
/**
|
||||
* Class ParserAbstract
|
||||
*
|
||||
* @package DeviceDetector\Parser
|
||||
*/
|
||||
abstract class ParserAbstract
|
||||
{
|
||||
/**
|
||||
* Holds the path to the yml file containing regexes
|
||||
* @var string
|
||||
*/
|
||||
protected $fixtureFile;
|
||||
/**
|
||||
* Holds the internal name of the parser
|
||||
* Used for caching
|
||||
* @var string
|
||||
*/
|
||||
protected $parserName;
|
||||
|
||||
/**
|
||||
* Holds the user agent the should be parsed
|
||||
* @var string
|
||||
*/
|
||||
protected $userAgent;
|
||||
|
||||
/**
|
||||
* Holds an array with method that should be available global
|
||||
* @var array
|
||||
*/
|
||||
protected $globalMethods;
|
||||
|
||||
/**
|
||||
* Holds an array with regexes to parse, if already loaded
|
||||
* @var array
|
||||
*/
|
||||
protected $regexList;
|
||||
|
||||
/**
|
||||
* Indicates how deep versioning will be detected
|
||||
* if $maxMinorParts is 0 only the major version will be returned
|
||||
* @var int
|
||||
*/
|
||||
protected static $maxMinorParts = 1;
|
||||
|
||||
/**
|
||||
* Versioning constant used to set max versioning to major version only
|
||||
* Version examples are: 3, 5, 6, 200, 123, ...
|
||||
*/
|
||||
|
||||
const VERSION_TRUNCATION_MAJOR = 0;
|
||||
|
||||
/**
|
||||
* Versioning constant used to set max versioning to minor version
|
||||
* Version examples are: 3.4, 5.6, 6.234, 0.200, 1.23, ...
|
||||
*/
|
||||
const VERSION_TRUNCATION_MINOR = 1;
|
||||
|
||||
/**
|
||||
* Versioning constant used to set max versioning to path level
|
||||
* Version examples are: 3.4.0, 5.6.344, 6.234.2, 0.200.3, 1.2.3, ...
|
||||
*/
|
||||
const VERSION_TRUNCATION_PATCH = 2;
|
||||
|
||||
/**
|
||||
* Versioning constant used to set versioning to build number
|
||||
* Version examples are: 3.4.0.12, 5.6.334.0, 6.234.2.3, 0.200.3.1, 1.2.3.0, ...
|
||||
*/
|
||||
const VERSION_TRUNCATION_BUILD = 3;
|
||||
|
||||
/**
|
||||
* Versioning constant used to set versioning to unlimited (no truncation)
|
||||
*/
|
||||
const VERSION_TRUNCATION_NONE = null;
|
||||
|
||||
/**
|
||||
* @var Cache|\Doctrine\Common\Cache\Cache
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
abstract public function parse();
|
||||
|
||||
public function __construct($ua='')
|
||||
{
|
||||
$this->setUserAgent($ua);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set how DeviceDetector should return versions
|
||||
* @param int|null $type Any of the VERSION_TRUNCATION_* constants
|
||||
*/
|
||||
public static function setVersionTruncation($type)
|
||||
{
|
||||
if (in_array($type, array(self::VERSION_TRUNCATION_BUILD,
|
||||
self::VERSION_TRUNCATION_NONE,
|
||||
self::VERSION_TRUNCATION_MAJOR,
|
||||
self::VERSION_TRUNCATION_MINOR,
|
||||
self::VERSION_TRUNCATION_PATCH))) {
|
||||
self::$maxMinorParts = $type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user agent to parse
|
||||
*
|
||||
* @param string $ua user agent
|
||||
*/
|
||||
public function setUserAgent($ua)
|
||||
{
|
||||
$this->userAgent = $ua;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the internal name of the parser
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->parserName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result of the parsed yml file defined in $fixtureFile
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getRegexes()
|
||||
{
|
||||
if (empty($this->regexList)) {
|
||||
$cacheKey = 'DeviceDetector-'.DeviceDetector::VERSION.'regexes-'.$this->getName();
|
||||
$cacheKey = preg_replace('/([^a-z0-9_-]+)/i', '', $cacheKey);
|
||||
$this->regexList = $this->getCache()->fetch($cacheKey);
|
||||
if (empty($this->regexList)) {
|
||||
$this->regexList = Spyc::YAMLLoad(dirname(__DIR__).DIRECTORY_SEPARATOR.$this->fixtureFile);
|
||||
$this->getCache()->save($cacheKey, $this->regexList);
|
||||
}
|
||||
}
|
||||
return $this->regexList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches the useragent against the given regex
|
||||
*
|
||||
* @param $regex
|
||||
* @return array|bool
|
||||
*/
|
||||
protected function matchUserAgent($regex)
|
||||
{
|
||||
// only match if useragent begins with given regex or there is no letter before it
|
||||
$regex = '/(?:^|[^A-Z0-9\_\-]|sprd-)(?:' . str_replace('/', '\/', $regex) . ')/i';
|
||||
|
||||
if (preg_match($regex, $this->userAgent, $matches)) {
|
||||
return $matches;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $item
|
||||
* @param array $matches
|
||||
* @return string type
|
||||
*/
|
||||
protected function buildByMatch($item, $matches)
|
||||
{
|
||||
for ($nb=1;$nb<=3;$nb++) {
|
||||
if (strpos($item, '$' . $nb) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$replace = isset($matches[$nb]) ? $matches[$nb] : '';
|
||||
$item = trim(str_replace('$' . $nb, $replace, $item));
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the version with the given $versionString and $matches
|
||||
*
|
||||
* Example:
|
||||
* $versionString = 'v$2'
|
||||
* $matches = array('version_1_0_1', '1_0_1')
|
||||
* return value would be v1.0.1
|
||||
*
|
||||
* @param $versionString
|
||||
* @param $matches
|
||||
* @return mixed|string
|
||||
*/
|
||||
protected function buildVersion($versionString, $matches)
|
||||
{
|
||||
$versionString = $this->buildByMatch($versionString, $matches);
|
||||
$versionString = str_replace('_', '.', $versionString);
|
||||
if (null !== self::$maxMinorParts && substr_count($versionString, '.') > self::$maxMinorParts) {
|
||||
$versionParts = explode('.', $versionString);
|
||||
$versionParts = array_slice($versionParts, 0, 1+self::$maxMinorParts);
|
||||
$versionString = implode('.', $versionParts);
|
||||
}
|
||||
return trim($versionString, ' .');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the useragent against a combination of all regexes
|
||||
*
|
||||
* All regexes returned by getRegexes() will be reversed and concated with '|'
|
||||
* Afterwards the big regex will be tested against the user agent
|
||||
*
|
||||
* Method can be used to speed up detections by making a big check before doing checks for every single regex
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function preMatchOverall()
|
||||
{
|
||||
$regexes = $this->getRegexes();
|
||||
|
||||
static $overAllMatch;
|
||||
|
||||
$cacheKey = $this->parserName.DeviceDetector::VERSION.'-all';
|
||||
$cacheKey = preg_replace('/([^a-z0-9_-]+)/i', '', $cacheKey);
|
||||
|
||||
if (empty($overAllMatch)) {
|
||||
$overAllMatch = $this->getCache()->fetch($cacheKey);
|
||||
}
|
||||
|
||||
if (empty($overAllMatch)) {
|
||||
// reverse all regexes, so we have the generic one first, which already matches most patterns
|
||||
$overAllMatch = array_reduce(array_reverse($regexes), function ($val1, $val2) {
|
||||
if (!empty($val1)) {
|
||||
return $val1.'|'.$val2['regex'];
|
||||
} else {
|
||||
return $val2['regex'];
|
||||
}
|
||||
});
|
||||
$this->getCache()->save($cacheKey, $overAllMatch);
|
||||
}
|
||||
|
||||
return $this->matchUserAgent($overAllMatch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Cache class
|
||||
*
|
||||
* @param Cache|\Doctrine\Common\Cache\CacheProvider $cache
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function setCache($cache)
|
||||
{
|
||||
if ($cache instanceof Cache ||
|
||||
(class_exists('\Doctrine\Common\Cache\CacheProvider') && $cache instanceof \Doctrine\Common\Cache\CacheProvider)) {
|
||||
$this->cache = $cache;
|
||||
return;
|
||||
}
|
||||
|
||||
throw new \Exception('Cache not supported');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Cache object
|
||||
*
|
||||
* @return Cache|\Doctrine\Common\Cache\CacheProvider
|
||||
*/
|
||||
public function getCache()
|
||||
{
|
||||
if (!empty($this->cache)) {
|
||||
return $this->cache;
|
||||
}
|
||||
|
||||
return new StaticCache();
|
||||
}
|
||||
}
|
||||
44
www/analytics/vendor/piwik/device-detector/Parser/VendorFragment.php
vendored
Normal file
44
www/analytics/vendor/piwik/device-detector/Parser/VendorFragment.php
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
/**
|
||||
* Device Detector - The Universal Device Detection library for parsing User Agents
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
|
||||
*/
|
||||
namespace DeviceDetector\Parser;
|
||||
|
||||
use DeviceDetector\Parser\Device\DeviceParserAbstract;
|
||||
|
||||
/**
|
||||
* Class VendorFragments
|
||||
*
|
||||
* Device parser for vendor fragment detection
|
||||
*
|
||||
* @package DeviceDetector\Parser\Device
|
||||
*/
|
||||
class VendorFragment extends ParserAbstract
|
||||
{
|
||||
protected $fixtureFile = 'regexes/vendorfragments.yml';
|
||||
protected $parserName = 'vendorfragments';
|
||||
|
||||
protected $matchedRegex = null;
|
||||
|
||||
public function parse()
|
||||
{
|
||||
foreach ($this->getRegexes() as $brand => $regexes) {
|
||||
foreach ($regexes as $regex) {
|
||||
if ($this->matchUserAgent($regex.'[^a-z0-9]+')) {
|
||||
$this->matchedRegex = $regex;
|
||||
return array_search($brand, DeviceParserAbstract::$deviceBrands);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getMatchedRegex()
|
||||
{
|
||||
return $this->matchedRegex;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue