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
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';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue