Skip to content
Extraits de code Groupes Projets
Valider 6804733d rédigé par mattab's avatar mattab
Parcourir les fichiers

Adding new DevicesDetection plugin, developed by Clearcode and sponsored by a...

Adding new DevicesDetection plugin, developed by Clearcode and sponsored by a client of Piwik Professional Services. A beautiful work of engineering, all released under GNU/GPL license!

Fixes #3612
 * when enabled, the plugin will add a new submenu: Visitors> Devices
 * the new devices report contains NEW reports:
  * Much improved Device type (tracking 'car browser', 'console', 'desktop', 'feature phone', 'smartphone', 'tablet', 'tv')
  * Device brand (tracking more than 100 brands such as Nokia, Nintendo, Lenovo or Apple.
  * Device model (tracking hundreds of phone/console models)
  * Operating System versions (tracking 70 variations of operating systems including Ubuntu vs Kubuntu vs Debian vs Lubuntu vs Xubuntu)
  * Operating System families (Android vs Google TV vs Windows vs Windows mobile vs Mobile gaming consoles)
  * Browser versions
  * Browser families

Refs #3505 There is some basic TV detection included and maybe you can help contribute better detections (see the .yml data files containing the regular expressions in YAML format)

HOW DOES IT WORK

This is quite beautiful system. It is a plugin that disabled by default. when enabled, it will create additional columns in the DB. Also at tracking, it will look at the user agent, and try to match it against one browser we know in the databases. The databases of user agent matching are composed by 3 YML files, parsed by spyc.php into php array.

These 3 YML took dozens of hours of work and testing with dozens of mobile phones and devices for accuracy. We are happy with the result as they should cover > 80% of the devices commonly used. We hope the community will help us build up these YML files and make them better, so we can track accurately 90% or 95% of requests.

The performance overhead is pretty small, but parsing the YML files + running dozens of regex will add some overhead. This is why it is still disabled by default. We will think about how to integrate it in core, in the next few months.

Please let me know if you find any problem with this new awesome code!
parent 2bd91ecb
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 4373 ajouts et 0 suppression
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @category Piwik_Plugins
* @package Piwik_DevicesDetection
*/
require_once PIWIK_INCLUDE_PATH . '/plugins/DevicesDetection/functions.php';
require_once PIWIK_INCLUDE_PATH . '/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php';
class Piwik_DevicesDetection_API
{
static private $instance = null;
/**
*
* @return Piwik_DevicesDetection_API
*/
static public function getInstance()
{
if (self::$instance == null) {
self::$instance = new self;
}
return self::$instance;
}
/**
* @param string $name
* @param int $idSite
* @param string $period
* @param string $date
* @param string $segment
* @return DataTable
*/
protected function getDataTable($name, $idSite, $period, $date, $segment)
{
Piwik::checkUserHasViewAccess($idSite);
$archive = Piwik_Archive::build($idSite, $period, $date, $segment);
$dataTable = $archive->getDataTable($name);
$dataTable->filter('Sort', array(Piwik_Archive::INDEX_NB_VISITS));
$dataTable->queueFilter('ReplaceColumnNames');
$dataTable->queueFilter('ReplaceSummaryRowLabel');
return $dataTable;
}
/**
* Gets datatable displaying number of visits by device type (eg. desktop, smartphone, tablet)
* @param int $idSite
* @param string $period
* @param string $date
* @param string $segment
* @return DataTable
*/
public function getType($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable('DevicesDetection_types', $idSite, $period, $date, $segment);
$dataTable->filter('ColumnCallbackReplace', array('label', 'Piwik_getDeviceTypeLabel'));
$dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getDeviceTypeLogo'));
return $dataTable;
}
/**
* Gets datatable displaying number of visits by device manufacturer name
* @param int $idSite
* @param string $period
* @param string $date
* @param string $segment
* @return DataTable
*/
public function getBrand($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable('DevicesDetection_brands', $idSite, $period, $date, $segment);
$dataTable->filter('ColumnCallbackReplace', array('label', 'Piwik_getDeviceBrandLabel'));
$dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_GetBrandLogo'));
return $dataTable;
}
/**
* Gets datatable displaying number of visits by device model
* @param int $idSite
* @param string $period
* @param string $date
* @param string $segment
* @return DataTable
*/
public function getModel($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable('DevicesDetection_models', $idSite, $period, $date, $segment);
$dataTable->filter('ColumnCallbackReplace', array('label', 'Piwik_getModelName'));
return $dataTable;
}
/**
* Gets datatable displaying number of visits by OS family (eg. Windows, Android, Linux)
* @param int $idSite
* @param string $period
* @param string $date
* @param string $segment
* @return DataTable
*/
public function getOsFamilies($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable('DevicesDetection_os', $idSite, $period, $date, $segment);
$dataTable->filter('GroupBy', array('label', 'Piwik_getOSFamilyFullNameExtended'));
$dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getOsFamilyLogoExtended'));
return $dataTable;
}
/**
* Gets datatable displaying number of visits by OS version (eg. Android 4.0, Windows 7)
* @param int $idSite
* @param string $period
* @param string $date
* @param string $segment
* @return DataTable
*/
public function getOsVersions($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable('DevicesDetection_osVersions', $idSite, $period, $date, $segment);
$dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getOsLogoExtended'));
$dataTable->filter('ColumnCallbackReplace', array('label', 'Piwik_getOsFullNameExtended'));
return $dataTable;
}
/**
* Gets datatable displaying number of visits by Browser family (eg. Firefox, InternetExplorer)
* @param int $idSite
* @param string $period
* @param string $date
* @param string $segment
* @return DataTable
*/
public function getBrowserFamilies($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable('DevicesDetection_browsers', $idSite, $period, $date, $segment);
$dataTable->filter('GroupBy', array('label', 'Piwik_getBrowserFamilyFullNameExtended'));
$dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getBrowserFamilyLogoExtended'));
return $dataTable;
}
/**
* Gets datatable displaying number of visits by Browser version (eg. Firefox 20, Safari 6.0)
* @param int $idSite
* @param string $period
* @param string $date
* @param string $segment
* @return DataTable
*/
public function getBrowserVersions($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable('DevicesDetection_browserVersions', $idSite, $period, $date, $segment);
$dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getBrowserLogoExtended'));
$dataTable->filter('ColumnCallbackReplace', array('label', 'Piwik_getBrowserNameExtended'));
return $dataTable;
}
}
\ No newline at end of file
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @category Piwik_Plugins
* @package Piwik_DevicesDetection
*/
class Piwik_DevicesDetection_Controller extends Piwik_Controller
{
/** The set of related reports displayed under the 'Operating Systems' header. */
private $osRelatedReports = null;
private $browserRelatedReports = null;
public function __construct()
{
parent::__construct();
$this->osRelatedReports = array(
'DevicesDetection.getOsFamilies' => Piwik_Translate('DeviceDetection_OperatingSystemFamilies'),
'DevicesDetection.getOsVersions' => Piwik_Translate('DeviceDetection_OperatingSystemVersions')
);
$this->browserRelatedReports = array(
'DevicesDetection.getBrowserFamilies' => Piwik_Translate('DevicesDetection_BrowsersFamily'),
'DevicesDetection.getBrowserVersions' => Piwik_Translate('DevicesDetection_BrowserVersions')
);
}
public function index($fetch = false)
{
$view = Piwik_View::factory('index');
$view->deviceTypes = $view->deviceModels = $view->deviceBrands = $view->osReport = $view->browserReport = "blank";
$view->deviceTypes = $this->getType(true);
$view->deviceBrands = $this->getBrand(true);
$view->deviceModels = $this->getModel(true);
$view->osReport = $this->getOsFamilies(true);
$view->browserReport = $this->getBrowserFamilies(true);
echo $view->render();
}
public function getType($fetch = false)
{
$view = $this->getStandardDataTableUserSettings(
__FUNCTION__, 'DevicesDetection.getType'
);
$view->setColumnTranslation('label', Piwik_Translate("DevicesDetection_dataTableLabelTypes"));
return $this->renderView($view, $fetch);
}
public function getBrand($fetch = false)
{
$view = $this->getStandardDataTableUserSettings(
__FUNCTION__, 'DevicesDetection.getBrand'
);
$view->setColumnTranslation('label', Piwik_Translate("DevicesDetection_dataTableLabelBrands"));
return $this->renderView($view, $fetch);
}
public function getModel($fetch = false)
{
$view = $this->getStandardDataTableUserSettings(
__FUNCTION__, 'DevicesDetection.getModel'
);
$view->setColumnTranslation('label', Piwik_Translate("DevicesDetection_dataTableLabelModels"));
return $this->renderView($view, $fetch);
}
public function getOsFamilies($fetch = false)
{
$view = $this->getStandardDataTableUserSettings(
__FUNCTION__, 'DevicesDetection.getOsFamilies'
);
$view->setColumnTranslation('label', Piwik_Translate("DevicesDetection_dataTableLabelSystemFamily"));
$view->addRelatedReports(Piwik_Translate('DeviceDetection_OperatingSystemFamilies'), $this->osRelatedReports);
return $this->renderView($view, $fetch);
}
public function getOsVersions($fetch = false)
{
$view = $this->getStandardDataTableUserSettings(
__FUNCTION__, 'DevicesDetection.getOsVersions'
);
$view->setColumnTranslation('label', Piwik_Translate("DevicesDetection_dataTableLabelSystemVersion"));
$view->addRelatedReports(Piwik_Translate('DeviceDetection_OperatingSystemVersions'), $this->osRelatedReports);
return $this->renderView($view, $fetch);
}
public function getBrowserFamilies($fetch = false)
{
$view = $this->getStandardDataTableUserSettings(
__FUNCTION__, 'DevicesDetection.getBrowserFamilies'
);
$view->setColumnTranslation('label', Piwik_Translate("DevicesDetection_dataTableLabelBrowserFamily"));
$view->addRelatedReports(Piwik_Translate('DevicesDetection_BrowsersFamily'), $this->browserRelatedReports);
return $this->renderView($view, $fetch);
}
public function getBrowserVersions($fetch = false)
{
$view = $this->getStandardDataTableUserSettings(
__FUNCTION__, 'DevicesDetection.getBrowserVersions'
);
$view->setColumnTranslation('label', Piwik_Translate("DevicesDetection_dataTableLabelBrowserVersion"));
$view->addRelatedReports(Piwik_Translate('DevicesDetection_BrowserVersions'), $this->browserRelatedReports);
return $this->renderView($view, $fetch);
}
protected function getStandardDataTableUserSettings($currentControllerAction, $APItoCall, $defaultDatatableType = null)
{
$view = Piwik_ViewDataTable::factory($defaultDatatableType);
$view->init($this->pluginName, $currentControllerAction, $APItoCall);
$view->disableSearchBox();
$view->disableExcludeLowPopulation();
$this->setPeriodVariablesView($view);
$this->setMetricsVariablesView($view);
return $view;
}
/**
* You may manually call this controller action to force re-processing of past user agents
*/
public function refreshParsedUserAgents()
{
$q = "SELECT idvisit, config_debug_ua FROM " . Piwik_Common::prefixTable("log_visit");
$res = Piwik_FetchAll($q);
foreach ($res as $rec) {
$UAParser = new UserAgentParserEnhanced($rec['config_debug_ua']);
$UAParser->parse();
echo "Processing idvisit = " . $rec['idvisit'] . "<br/>";
echo "UserAgent string: " . $rec['config_debug_ua'] . "<br/> Decoded values:";
$uaDetails = $this->getArray($UAParser);
var_dump($uaDetails);
echo "<hr/>";
$this->updateVisit($rec['idvisit'], $uaDetails);
unset($UAParser);
}
echo "Please remember to truncate your archives !";
}
private function getArray(UserAgentParserEnhanced $UAParser)
{
$UADetails['config_browser_name'] = $UAParser->getBrowser("short_name");
$UADetails['config_browser_version'] = $UAParser->getBrowser("version");
$UADetails['config_os'] = $UAParser->getOs("short_name");
$UADetails['config_os_version'] = $UAParser->getOs("version");
$UADetails['config_device_type'] = $UAParser->getDevice();
$UADetails['config_device_model'] = $UAParser->getModel();
$UADetails['config_device_brand'] = $UAParser->getBrand();
return $UADetails;
}
private function updateVisit($idVisit, $uaDetails)
{
$q = "UPDATE " . Piwik_Common::prefixTable("log_visit") . " SET " .
"config_browser_name = '" . $uaDetails['config_browser_name'] . "' ," .
"config_browser_version = '" . $uaDetails['config_browser_version'] . "' ," .
"config_os = '" . $uaDetails['config_os'] . "' ," .
"config_os_version = '" . $uaDetails['config_os_version'] . "' ," .
"config_device_type = " . (isset($uaDetails['config_device_type']) ? "'" . $uaDetails['config_device_type'] . "'" : "NULL") . " ," .
"config_device_model = " . (isset($uaDetails['config_device_model']) ? "'" . $uaDetails['config_device_model'] . "'" : "NULL") . " ," .
"config_device_brand = " . (isset($uaDetails['config_device_brand']) ? "'" . $uaDetails['config_device_brand'] . "'" : "NULL") . "
WHERE idvisit = " . $idVisit;
Piwik_Query($q);
}
}
\ No newline at end of file
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @category Piwik_Plugins
* @package Piwik_DevicesDetection
*/
require_once "UserAgentParserEnhanced/UserAgentParserEnhanced.php";
class Piwik_DevicesDetection extends Piwik_Plugin
{
/**
* Return information about this plugin.
* @return array
*/
public function getInformation()
{
return array(
'description' => Piwik_Translate("DevicesDetection_description"),
'author' => 'Clearcode.cc',
'author_homepage' => 'http://clearcode.cc',
'version' => '1.12-b6',
'TrackerPlugin' => true,
'translationAvailable' => true,
);
}
/*
* Defines API reports.
* Also used to define Widgets.
*
* @array Category, Report Name, API Module, API action, Translated column name,
* W
*/
protected $reportMetadata = array(
// device types report
array(
'DevicesDetection_DevicesDetection',
'DevicesDetection_DeviceType',
'DevicesDetection',
'getType',
'DevicesDetection_DeviceType',
),
// device brands report
array(
'DevicesDetection_DevicesDetection',
'DevicesDetection_DeviceBrand',
'DevicesDetection',
'getBrand',
'DevicesDetection_DeviceBrand',
),
// device model report
array(
'DevicesDetection_DevicesDetection',
'DevicesDetection_DeviceModel',
'DevicesDetection',
'getModel',
'DevicesDetection_DeviceModel',
),
// device OS family report
array(
'DevicesDetection_DevicesDetection',
'DeviceDetection_OperatingSystemFamilies',
'DevicesDetection',
'getOsFamilies',
'DeviceDetection_OperatingSystemFamilies',
),
// device OS version report
array(
'DevicesDetection_DevicesDetection',
'DeviceDetection_OperatingSystemVersions',
'DevicesDetection',
'getOsVersions',
'DeviceDetection_OperatingSystemVersions',
),
// Browser family report
array(
'DevicesDetection_DevicesDetection',
'DevicesDetection_BrowsersFamily',
'DevicesDetection',
'getBrowserFamilies',
'DevicesDetection_BrowsersFamily',
),
// Browser versions report
array(
'DevicesDetection_DevicesDetection',
'DevicesDetection_BrowserVersions',
'DevicesDetection',
'getBrowserVersions',
'DevicesDetection_BrowserVersions',
),
);
public function getListHooksRegistered()
{
return array(
'ArchiveProcessing_Day.compute' => "archiveDay",
'ArchiveProcessing_Period.compute' => 'archivePeriod',
'Menu.add' => 'addMenu',
'Tracker.newVisitorInformation' => 'parseMobileVisitData',
'WidgetsList.add' => 'addWidgets',
'API.getReportMetadata' => 'getReportMetadata',
);
}
public function addWidgets()
{
foreach ($this->reportMetadata as $report) {
list($category, $name, $controllerName, $controllerAction) = $report;
if ($category == false)
continue;
Piwik_AddWidget($category, $name, $controllerName, $controllerAction);
}
}
/**
* @param Piwik_Event_Notification $notification notification object
*/
public function getReportMetadata($notification)
{
$reports = & $notification->getNotificationObject();
$i = 0;
foreach ($this->reportMetadata as $report) {
list($category, $name, $apiModule, $apiAction, $columnName) = $report;
if ($category == false)
continue;
$report = array(
'category' => Piwik_Translate($category),
'name' => Piwik_Translate($name),
'module' => $apiModule,
'action' => $apiAction,
'dimension' => Piwik_Translate($columnName),
'order' => $i++
);
$translation = $name . 'Documentation';
$translated = Piwik_Translate($translation, '<br />');
if ($translated != $translation) {
$report['documentation'] = $translated;
}
$reports[] = $report;
}
}
public function install()
{
// we catch the exception
try {
$q1 = "ALTER TABLE `" . Piwik_Common::prefixTable("log_visit") . "`
ADD `config_os_version` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `config_os` ,
ADD `config_device_type` TINYINT( 10 ) NULL DEFAULT NULL AFTER `config_browser_version` ,
ADD `config_device_brand` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `config_device_type` ,
ADD `config_device_model` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `config_device_brand`";
Piwik_Exec($q1);
// conditionaly add this column
if (@Piwik_Config::getInstance()->Debug['store_user_agent_in_visit']) {
$q2 = "ALTER TABLE `" . Piwik_Common::prefixTable("log_visit") . "`
ADD `config_debug_ua` VARCHAR( 512 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `config_device_model`";
Piwik_Exec($q2);
}
} catch (Exception $e) {
throw $e;
}
}
public function parseMobileVisitData($notification)
{
$visitorInfo = &$notification->getNotificationObject();
$extraInfo = $notification->getNotificationInfo();
$userAgent = $extraInfo['UserAgent'];
$UAParser = new UserAgentParserEnhanced($userAgent);
$UAParser->parse();
$deviceInfo['config_browser_name'] = $UAParser->getBrowser("short_name");
$deviceInfo['config_browser_version'] = $UAParser->getBrowser("version");
$deviceInfo['config_os'] = $UAParser->getOs("short_name");
$deviceInfo['config_os_version'] = $UAParser->getOs("version");
$deviceInfo['config_device_type'] = $UAParser->getDevice();
$deviceInfo['config_device_model'] = $UAParser->getModel();
$deviceInfo['config_device_brand'] = $UAParser->getBrand();
if (@Piwik_Config::getInstance()->Debug['store_user_agent_in_visit']) {
$deviceInfo['config_debug_ua'] = $userAgent;
}
$visitorInfo = array_merge($visitorInfo, $deviceInfo);
printDebug("Device Detection:");
printDebug($deviceInfo);
}
private function archiveDayDeviceTypes($archiveProcessing)
{
$recordName = 'DevicesDetection_types';
$labelSQL = "log_visit.config_device_type";
$interestByType = $archiveProcessing->getArrayInterestForLabel($labelSQL);
$tableType = $archiveProcessing->getDataTableFromArray($interestByType);
$archiveProcessing->insertBlobRecord($recordName, $tableType->getSerialized($this->maximumRowsInDataTable, null, $this->columnToSortByBeforeTruncation));
destroy($tableType);
}
private function archiveDayDeviceBrands($archiveProcessing)
{
$recordName = 'DevicesDetection_brands';
$labelSQL = "log_visit.config_device_brand";
$interestByBrand = $archiveProcessing->getArrayInterestForLabel($labelSQL);
$tableBrand = $archiveProcessing->getDataTableFromArray($interestByBrand);
$archiveProcessing->insertBlobRecord($recordName, $tableBrand->getSerialized($this->maximumRowsInDataTable, null, $this->columnToSortByBeforeTruncation));
destroy($tableBrand);
}
private function archiveDayDeviceModels($archiveProcessing)
{
$recordName = 'DevicesDetection_models';
$labelSQL = "log_visit.config_device_model";
$interestByModel = $archiveProcessing->getArrayInterestForLabel($labelSQL);
$tableModel = $archiveProcessing->getDataTableFromArray($interestByModel);
$archiveProcessing->insertBlobRecord($recordName, $tableModel->getSerialized($this->maximumRowsInDataTable, null, $this->columnToSortByBeforeTruncation));
destroy($tableModel);
}
private function archiveDayOs($archiveProcessing)
{
$recordName = 'DevicesDetection_os';
$labelSQL = "log_visit.config_os";
$interestByOs = $archiveProcessing->getArrayInterestForLabel($labelSQL);
$tableOs = $archiveProcessing->getDataTableFromArray($interestByOs);
$archiveProcessing->insertBlobRecord($recordName, $tableOs->getSerialized($this->maximumRowsInDataTable, null, $this->columnToSortByBeforeTruncation));
destroy($tableOs);
}
private function archiveDayBrowserFamilies($archiveProcessing)
{
$recordName = 'DevicesDetection_browsers';
$labelSQL = "log_visit.config_browser_name";
$interestByBrowser = $archiveProcessing->getArrayInterestForLabel($labelSQL);
$tableBrowser = $archiveProcessing->getDataTableFromArray($interestByBrowser);
$archiveProcessing->insertBlobRecord($recordName, $tableBrowser->getSerialized($this->maximumRowsInDataTable, null, $this->columnToSortByBeforeTruncation));
destroy($tableBrowser);
}
private function archiveDayBrowsersVersions($archiveProcessing)
{
$recordName = 'DevicesDetection_browserVersions';
$labelSQL = "CONCAT(log_visit.config_browser_name, ';', log_visit.config_browser_version)";
$interestByBrowserVersion = $archiveProcessing->getArrayInterestForLabel($labelSQL);
$tableBrowserVersion = $archiveProcessing->getDataTableFromArray($interestByBrowserVersion);
$archiveProcessing->insertBlobRecord($recordName, $tableBrowserVersion->getSerialized($this->maximumRowsInDataTable, null, $this->columnToSortByBeforeTruncation));
destroy($tableBrowserVersion);
}
private function archiveDayOsVersions($archiveProcessing)
{
$recordName = 'DevicesDetection_osVersions';
$labelSQL = "CONCAT(log_visit.config_os, ';', log_visit.config_os_version)";
$interestByBrowserVersion = $archiveProcessing->getArrayInterestForLabel($labelSQL);
$tableOsVersion = $archiveProcessing->getDataTableFromArray($interestByBrowserVersion);
$archiveProcessing->insertBlobRecord($recordName, $tableOsVersion->getSerialized($this->maximumRowsInDataTable, null, $this->columnToSortByBeforeTruncation));
destroy($tableOsVersion);
}
public function archiveDay($notification)
{
$archiveProcessing = $notification->getNotificationObject();
if (!$archiveProcessing->shouldProcessReportsForPlugin($this->getPluginName()))
return;
$this->maximumRowsInDataTable = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_standard'];
$this->columnToSortByBeforeTruncation = Piwik_Archive::INDEX_NB_VISITS;
$this->archiveDayDeviceTypes($archiveProcessing);
$this->archiveDayDeviceBrands($archiveProcessing);
$this->archiveDayDeviceModels($archiveProcessing);
$this->archiveDayOs($archiveProcessing);
$this->archiveDayOsVersions($archiveProcessing);
$this->archiveDayBrowserFamilies($archiveProcessing);
$this->archiveDayBrowsersVersions($archiveProcessing);
}
public function archivePeriod($notification)
{
$this->maximumRowsInDataTableLevelZero = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_referers'];
$this->maximumRowsInSubDataTable = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_subtable_referers'];
$archiveProcessing = $notification->getNotificationObject();
if (!$archiveProcessing->shouldProcessReportsForPlugin($this->getPluginName()))
return;
$dataTablesToSum[] = 'DevicesDetection_types';
$dataTablesToSum[] = 'DevicesDetection_brands';
$dataTablesToSum[] = "DevicesDetection_models";
$dataTablesToSum[] = "DevicesDetection_os";
$dataTablesToSum[] = "DevicesDetection_osVersions";
$dataTablesToSum[] = "DevicesDetection_browsers";
$dataTablesToSum[] = "DevicesDetection_browserVersions";
foreach ($dataTablesToSum as $dt) {
$archiveProcessing->archiveDataTable(
$dt, null, $this->maximumRowsInDataTableLevelZero, $this->maximumRowsInSubDataTable, $columnToSort = "nb_visits");
}
}
public function addMenu()
{
Piwik_AddMenu('General_Visitors', 'DevicesDetection_submenu', array('module' => 'DevicesDetection', 'action' => 'index'));
}
}
\ No newline at end of file
###############
# Piwik - Open source web analytics
#
# @link http://piwik.org
# @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
#
# @category Piwik_Plugins
# @package Piwik_DevicesDetection
###############
# SeaMonkey
- regex: '(Iceape|SeaMonkey)/(\d+\.\d+)'
name: $1
version: '$2'
# Camino
- regex: 'Camino/(\d+\.\d+)'
name: Camino
version: '$1'
#Fennec (Firefox for mobile)
- regex: 'Fennec/(\d+\.\d+)'
name: Fennec
version: '$1'
#MicroB
- regex: 'Firefox.*Tablet browser (\d+\.\d+)'
name: MicroB
version: '$1'
#Firefox
- regex: 'Firefox/(\d+\.\d+)'
name: Firefox
version: '$1'
- regex: '(BonEcho|GranParadiso|Lorentz|Minefield|Namoroka|Shiretoko)/(\d+\.\d+)'
name: Firefox '$1'
version: '$2'
#Flock
- regex: 'Flock/(\d+\.\d+)'
name: Flock
version: '$1'
#RockMelt
- regex: 'RockMelt/(\d+\.\d+)'
name: RockMelt
version: '$1'
#Netscape
- regex: '(?:Navigator|Netscape6)/(\d+\.\d+)'
name: Netscape
version: '$1'
#Opera
- regex: '(:?Opera Tablet.*Version|Opera/.+Opera Mobi.+Version|Safari.*OPR)/(\d+\.\d+)'
name: Opera Mobile
version: '$2'
- regex: 'Opera Mini/(:?att/)?(\d+\.\d+)'
name: Opera Mini
version: '$2'
- regex: 'Opera[/ ](?:9.80.*Version/)?(\d+\.\d+)'
name: Opera
version: '$1'
#wOSBrowser
- regex: '(?:hpw|web)OS/(\d+\.\d+)'
name: wOSBrowser
version: '$1'
#Swiftfox
- regex: 'Firefox/(\d+\.\d+).*\(Swiftfox\)'
name: Swiftfox
version: '$1'
#Rekonq
- regex: 'rekonq'
name: Rekonq
version: ''
#Conkeror
- regex: 'Conkeror/(\d+\.\d+)'
name: Conkeror
version: '$1'
#Konqueror
- regex: 'Konqueror/(\d+\.\d+)'
name: Konqueror
version: '$1'
#Baidu Browser
- regex: 'baidubrowser[/ ](\d+)'
name: Baidu Browser
version: '$1'
#Yandex Browser
- regex: 'YaBrowser/(\d+)'
name: Yandex Browser
version: '$1'
#Chrome
- regex: 'CrMo/(\d+\.\d+)'
name: Chrome Mobile
version: '$1'
- regex: 'CriOS/(\d+\.\d+)'
name: Chrome Mobile iOS
version: '$1'
- regex: 'Chrome/(\d+\.\d+).*Mobile'
name: Chrome Mobile
version: '$1'
- regex: 'chromeframe/(\d+\.\d+)'
name: Chrome Frame
version: '$1'
- regex: 'Chrome/(\d+\.\d+)'
name: Chrome
version: '$1'
- regex: 'Chromium/(\d+\.\d+)'
name: Chromium
version: '$1'
#UC Browser
- regex: 'UC[ ]?Browser[ /](\d+\.\d+)'
name: UC Browser
version: '$1'
- regex: '(?:UC Browser|UCBrowser|UCWEB)(\d+\.\d+)'
name: UC Browser
version: '$1'
#Tizen Browser
- regex: '(?:Tizen|SLP) Browser/(\d+\.\d+)'
name: Tizen Browser
version: '$1'
#Epiphany
- regex: 'Epiphany/(\d+\.\d+)'
name: Epiphany
version: '$1'
#Fireweb Navigator
- regex: 'Fireweb Navigator/(\d+\.\d+)'
name: Fireweb Navigator
version: '$1'
#Jasmine
- regex: 'Jasmine[ /](\d+\.\d+)'
name: Jasmine
version: '$1'
#Lynx
- regex: 'Lynx/(\d+\.\d+)'
name: Lynx
version: '$1'
#Midori
- regex: 'Midori/(\d+\.\d+)'
name: Midori
version: '$1'
#NCSA Mosaic
- regex: 'NCSA_Mosaic/(\d+\.\d+)'
name: NCSA Mosaic
version: '$1'
#ABrowse
- regex: 'ABrowse (\d+\.\d+)'
name: ABrowse
version: '$1'
#Amaya
- regex: 'amaya/(\d+\.\d+)'
name: Amaya
version: '$1'
#Amiga Voyager
- regex: 'AmigaVoyager/(\d+\.\d+)'
name: Amiga Voyager
version: '$1'
#Amiga Aweb
- regex: 'Amiga-Aweb/(\d+\.\d+)'
name: Amiga Aweb
version: '$1'
#Arora
- regex: 'Arora/(\d+\.\d+)'
name: Arora
version: '$1'
#Beonex
- regex: 'Beonex/(\d+\.\d+)'
name: Beonex
version: '$1'
#BlackBerry Browser
- regex: 'Black[bB]erry|PlayBook|BB10'
name: BlackBerry Browser
version: ''
#BrowseX
- regex: 'BrowseX \((\d+\.\d+)'
name: BrowseX
version: '$1'
#Cheshire
- regex: 'Cheshire/(\d+\.\d+)'
name: Cheshire
version: '$1'
#CometBird
- regex: 'CometBird/(\d+\.\d+)'
name: CometBird
version: '$1'
#Dillo
- regex: 'Dillo/(\d+\.\d+)'
name: Dillo
version: '$1'
#Dolphin
- regex: 'Dolfin/(\d+\.\d+)|dolphin'
name: Dolphin
version: '$1'
#Elinks
- regex: 'Elinks/(\d+\.\d+)'
name: Elinks
version: '$1'
#Firebird
- regex: 'Firebird/(\d+\.\d+)'
name: Firebird
version: '$1'
#Fluid
- regex: 'Fluid/(\d+\.\d+)'
name: Fluid
version: '$1'
#Galeon
- regex: 'Galeon/(\d+\.\d+)'
name: Galeon
version: '$1'
#Google Earth
- regex: 'Google Earth/(\d+\.\d+)'
name: Google Earth
version: '$1'
#HotJava
- regex: 'HotJava/(\d+\.\d+)'
name: HotJava
version: '$1'
#IBrowse
- regex: 'IBrowse[ /](\d+\.\d+)'
name: IBrowse
version: '$1'
#iCab
- regex: 'iCab[ /](\d+\.\d+)'
name: iCab
version: '$1'
#Internet Explorer
- regex: 'IEMobile[ /](\d+\.\d+)'
name: IE Mobile
version: '$1'
- regex: 'MSIE (\d+\.\d+).*XBLWP7'
name: IE Mobile
version: '$1'
- regex: 'MSIE (\d+\.\d+)'
name: Internet Explorer
version: '$1'
#Iron
- regex: 'Iron/(\d+\.\d+)'
name: Iron
version: '$1'
#Kapiko
- regex: 'Kapiko/(\d+\.\d+)'
name: Kapiko
version: '$1'
#Kazehakase
- regex: 'Kazehakase/(\d+\.\d+)'
name: Kazehakase
version: '$1'
#Kindle Browser
- regex: 'Kindle/(\d+\.\d+)'
name: Kindle Browser
version: '$1'
#K-meleon
- regex: 'K-meleon/(\d+\.\d+)'
name: K-meleon
version: '$1'
#Lightning
- regex: 'Lightning/(\d+\.\d+)'
name: Lightning
version: '$1'
#Links
- regex: 'Links \((\d+\.\d+)'
name: Links
version: '$1'
#Maxthon
- regex: 'Maxthon (\d+\.\d+)'
name: Maxthon
version: '$1'
- regex: '(?:Maxthon|MyIE2|Uzbl|Shiira)'
name: Maxthon
version: ''
#Openwave Mobile Browser
- regex: 'UP.Browser/(\d+\.\d+)'
name: Openwave Mobile Browser
version: '$1'
#OmniWeb
- regex: 'OmniWeb/[v]?(\d+\.\d+)'
name: OmniWeb
version: '$1'
#Phoenix
- regex: 'Phoenix/(\d+\.\d+)'
name: Phoenix
version: '$1'
#Mobile Silk
- regex: 'Silk/(\d+\.\d+)'
name: Mobile Silk
version: '$1'
#Nokia Browser
- regex: '(?:NokiaBrowser|BrowserNG)/(\d+\.\d+)'
name: Nokia Browser
version: '$1'
- regex: 'Series60/5\.0'
name: Nokia Browser
version: '7.0'
- regex: 'Series60/(\d+\.\d+)'
name: Nokia OSS Browser
version: '$1'
- regex: 'S40OviBrowser/(\d+\.\d+)'
name: Nokia Ovi Browser
version: '$1'
- regex: '^Nokia|Nokia[EN]?\d+'
name: Nokia Browser
version: ''
#NetFront
- regex: 'NetFrontLifeBrowser/(\d+\.\d+)'
name: NetFront Life
version: '$1'
- regex: 'NetFront/(\d+\.\d+)'
name: NetFront
version: '$1'
- regex: 'PLAYSTATION|NINTENDO 3|AppleWebKit.+ NX/\d+\.\d+\.\d+'
name: NetFront
version: ''
#Obigo
- regex: 'Obigo[ ]?(?:InternetBrowser|Browser)?[ /]([A-Za-z0-9]*)'
name: Obigo
version: '$1'
- regex: 'Obigo|Teleca'
name: Obigo
version: ''
#Palm Blazer
- regex: 'Blazer/(\d+\.\d+)'
name: Palm Blazer
version: '$1'
- regex: 'Pre/(\d+\.\d+)'
name: Palm Pre
version: '$1'
#Polaris
- regex: '(?:Polaris|Embider)/(\d+\.\d+)'
name: Polaris
version: '$1'
#Snowshoe
- regex: 'Snowshoe/(\d+\.\d+)'
name: Snowshoe
version: '$1'
#Safari
- regex: '(?:iPod|iPad|iPhone).+Version/(\d+\.\d+)'
name: Mobile Safari
version: '$1'
- regex: 'Version/(\d+\.\d+).*Mobile.*Safari/'
name: Mobile Safari
version: '$1'
- regex: '(?:iPod|iPhone|iPad)'
name: Mobile Safari
version: ''
- regex: 'Version/(\d+\.\d+).*Safari/|Safari/\d+'
name: Safari
version: '$1'
#Android Browser
- regex: 'Android'
name: Android Browser
version: ''
\ No newline at end of file
Ce diff est replié.
###############
# Piwik - Open source web analytics
#
# @link http://piwik.org
# @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
#
# @category Piwik_Plugins
# @package Piwik_DevicesDetection
###############
##########
# Tizen
##########
- regex: 'Tizen'
name: 'Tizen'
version: ''
##########
# Android
##########
- regex: 'Android[ /](\d+\.\d+)'
name: 'Android'
version: '$1'
- regex: 'Android|Silk-Accelerated=[a-z]{4,5}'
name: 'Android'
version: ''
##########
# Linux
##########
- regex: 'Linux; .*((?:Arch Linux|Debian|Knoppix|Mint|Ubuntu|Kubuntu|Xubuntu|Lubuntu|Fedora|Red Hat|Mandriva|Gentoo|Slackware|SUSE|Puppy|CentOS|BackTrack|YunOs|Presto))[ /](\d+\.\d+)'
name: '$1'
version: '$2'
- regex: '((?:Arch Linux|Debian|Knoppix|Mint|Ubuntu|Kubuntu|Xubuntu|Lubuntu|Fedora|Red Hat|Mandriva|Gentoo|Slackware|SUSE|Puppy|CentOS|BackTrack|YunOs|Presto));.*Linux'
name: '$1'
version: ''
- regex: 'Linux; |Linux (?:x86_64|zbov|i686)'
name: 'Linux'
version: ''
##########
# Windows Mobile
##########
- regex: 'Windows Phone (?:OS)?[ ]?(\d+\.\d+)'
name: 'Windows Phone'
version: '$1'
- regex: 'XBLWP7|Windows Phone'
name: 'Windows Phone'
version: ''
- regex: 'Windows CE'
name: 'Windows CE'
version: ''
- regex: '(?:IEMobile|Windows Mobile)(?: (\d+\.\d+))?'
name: 'Windows Mobile'
version: '$1'
- regex: 'Windows NT 6.2; ARM;'
name: 'Windows RT'
version: ''
##########
# Windows
##########
- regex: 'CYGWIN_NT-6.2|Windows NT 6.2|Windows 8'
name: 'Windows 8'
version: '8'
- regex: 'CYGWIN_NT-6.1|Windows NT 6.1|Windows 7'
name: 'Windows 7'
version: '7'
- regex: 'CYGWIN_NT-6.0|Windows NT 6.0|Windows Vista'
name: 'Windows Vista'
version: 'Vista'
- regex: 'CYGWIN_NT-5.2|Windows NT 5.2|Windows Server 2003 / XP x64'
name: 'Windows Server 2003'
version: 'Server 2003'
- regex: 'CYGWIN_NT-5.1|Windows NT 5.1|Windows XP'
name: 'Windows XP'
version: 'XP'
- regex: 'CYGWIN_NT-5.0|Windows NT 5.0|Windows 2000'
name: 'Windows 2000'
version: '2000'
- regex: 'CYGWIN_NT-4.0|Windows NT 4.0|WinNT|Windows NT'
name: 'Windows NT'
version: 'NT'
- regex: 'CYGWIN_ME-4.90|Win 9x 4.90|Windows ME'
name: 'Windows ME'
version: 'ME'
- regex: 'CYGWIN_98-4.10|Win98|Windows 98'
name: 'Windows 98'
version: '98'
- regex: 'CYGWIN_95-4.0|Win32|Win95|Windows 95|Windows_95'
name: 'Windows 95'
version: '95'
- regex: 'Windows 3.1'
name: 'Windows 3.1'
version: '3.1'
- regex: 'Windows'
name: 'Windows'
version: ''
##########
# Mac
##########
- regex: 'Mac OS X (\d+[_.]\d+)'
name: 'Mac'
version: '$1'
- regex: 'Darwin|Macintosh|Mac_PowerPC|PPC|Mac PowerPC'
name: 'Mac'
version: ''
##########
# iOS
##########
- regex: '(?:CPU OS|iPhone OS) (\d+_\d+)'
name: 'iOS'
version: '$1'
- regex: '(?:iPhone|iPad|iPod)(?:.*Mac OS X.*Version/(\d+\.\d+)|; Opera)'
name: 'iOS'
version: '$1'
##########
# webOS
##########
- regex: '(?:webOS|Palm webOS)(?:/(\d+\.\d+))?'
name: 'webOS'
version: '$1'
- regex: '(?:PalmOS|Palm OS)(?:/(\d+\.\d+))?'
name: 'PalmOS'
version: ''
##########
# ChromeOS
##########
- regex: 'CrOS [a-z0-9_]+ (\d+\.\d+)'
name: 'Chrome OS'
version: '$1'
##########
# BlackBerry
##########
- regex: '(?:BB10;.+Version|Black[Bb]erry[0-9a-z]+|Black[Bb]erry.+Version)/(\d+\.\d+)'
name: 'BlackBerry OS'
version: '$1'
- regex: 'RIM Tablet OS (\d+\.\d+)'
name: 'BlackBerry Tablet OS'
version: '$1'
- regex: 'RIM Tablet OS|QNX|Play[Bb]ook'
name: 'BlackBerry Tablet OS'
version: ''
- regex: 'Black[Bb]erry'
name: 'BlackBerry OS'
version: ''
##########
# Symbian
##########
- regex: 'Symbian[Oo][Ss]/(\d+\.\d+)'
name: 'Symbian OS'
version: '$1'
- regex: 'Symbian/3.+NokiaBrowser/7\.3'
name: 'Symbian'
version: '^3 Anna'
- regex: 'Symbian/3.+NokiaBrowser/7\.4'
name: 'Symbian'
version: '^3 Belle'
- regex: 'Symbian[/]?3'
name: 'Symbian^3'
version: '^3'
- regex: '(?:Series 60|SymbOS|S60)(?:[ /]?(\d+\.\d+|V\d+))?'
name: 'Symbian OS Series 60'
version: '$1'
- regex: 'Series40'
name: 'Symbian OS Series 40'
version: ''
- regex: 'MeeGo|WeTab'
name: 'MeeGo'
version: ''
- regex: 'Symbian [Oo][Ss]|SymbOS'
name: 'Symbian OS'
version: ''
- regex: 'Nokia'
name: 'Symbian'
version: ''
##########
# Firefox OS
##########
- regex: '(?:Mobile|Tablet);.+Firefox/\d+\.\d+'
name: 'Firefox OS'
version: ''
##########
# Bada
##########
- regex: 'bada'
name: 'Bada'
version: ''
##########
# Brew
##########
- regex: '(?:Brew MP|BREW|BMP)(?:[ /](\d+\.\d+))?'
name: 'Brew'
version: '$1'
##########
# Web TV
##########
- regex: 'GoogleTV[ /](\d+\.\d+)|GoogleTV'
name: 'Google TV'
version: '$1'
- regex: 'AppleTV/(\d+\.\d+)'
name: 'Apple TV'
version: '$1'
- regex: 'WebTV/(\d+\.\d+)'
name: 'WebTV'
version: '$1'
##########
# Unix
##########
- regex: 'SunOS'
name: 'Solaris'
version: ''
- regex: 'AIX'
name: 'AIX'
version: ''
- regex: 'HP-UX'
name: 'HP-UX'
version: ''
- regex: 'FreeBSD'
name: 'FreeBSD'
version: ''
- regex: 'NetBSD'
name: 'NetBSD'
version: ''
- regex: 'OpenBSD'
name: 'OpenBSD'
version: ''
- regex: 'DragonFly'
name: 'DragonFly'
version: ''
- regex: 'Syllable'
name: 'Syllable'
version: ''
- regex: 'IRIX'
name: 'IRIX'
version: ''
- regex: 'OSF1'
name: 'OSF1'
version: ''
##########
# Gaming Console
##########
- regex: 'Nintendo Wii'
name: 'Nintendo'
version: 'Wii'
- regex: 'PlayStation 3|PlayStation3'
name: 'PlayStation'
version: '3'
- regex: 'Xbox|KIN\.(?:One|Two)'
name: 'Xbox'
version: '360'
##########
# Mobile Gaming Console
##########
- regex: 'Nitro|Nintendo ([3]?DS[i]?)'
name: 'Nintendo Mobile'
version: '$1'
- regex: 'PlayStation ((?:Portable|Vita))'
name: 'PlayStation'
version: '$1'
##########
# IBM
##########
- regex: 'OS/2'
name: 'OS/2'
version: ''
##########
# Simulators
##########
- regex: '(Talkatone|WinWAP)'
name: '$1'
version: ''
##########
# Bot
##########
- regex: '(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves/Teoma|ia_archiver|ScoutJet|Gulper Web Bot|EmailWolf|grub-client|Download Demon|OmniWeb|SearchExpress|Microsoft URL Control|bot|borg|yahoo|slurp|msnbot|msrbot|openbot|archiver|netresearch|transcoder|crawler|lycos|scooter|altavista|teoma|gigabot|baiduspider|blitzbot|oegp|charlotte|furlbot|http%20client|polybot|htdig|ichiro|mogimogi|larbin|pompos|scrubby|searchsight|seekbot|semanticdiscovery|silk|snappy|speedy|spider|voila|vortex|voyager|zao|zeal|fast-webcrawler|converacrawler|dataparksearch|findlinksYottaaMonitor|BrowserMob|HttpMonitor|YandexBot|Slurp|BingPreview|PagePeeker|ThumbShotsBot|WebThumb|URL2PNG|ZooShot|GomezA|Catchpoint bot|Willow Internet Crawler|Google SketchUp|Read%20Later|Minimo|Pingdom.com|facebookexternalhit|Twitterbot|RackspaceBot)'
name: 'Bot '
version: ''
\ No newline at end of file
Ce diff est replié.
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @category Piwik_Plugins
* @package Piwik_DevicesDetection
*/
function Piwik_GetBrandLogo($label)
{
$path = __DIR__ . '/images/brand/' . $label . '.ico';
if (file_exists($path)) {
return 'plugins/DevicesDetection/images/brand/' . $label . '.ico';
} else {
return 'plugins/DevicesDetection/images/brand/unknown.ico';
}
}
function Piwik_getBrowserFamilyFullNameExtended($label)
{
foreach (UserAgentParserEnhanced::$browserFamilies as $name => $family) {
if (in_array($label, $family)) {
return $name;
}
}
return "Unknown";
}
function Piwik_getBrowserFamilyLogoExtended($label)
{
if (array_key_exists($label, UserAgentParserEnhanced::$browserFamilies)) {
$path = 'plugins/UserSettings/images/browsers/' . UserAgentParserEnhanced::$browserFamilies[$label][0] . '.gif';
} else {
$path = 'plugins/UserSettings/images/browsers/UNK.gif';
}
return $path;
}
function Piwik_getBrowserNameExtended($label)
{
$short = substr($label, 0, 2);
$ver = substr($label, 3, 10);
if (array_key_exists($short, UserAgentParserEnhanced::$browsers)) {
return trim(ucfirst(UserAgentParserEnhanced::$browsers[$short]) . ' ' . $ver);
} else {
return "Unknown";
}
}
function Piwik_getBrowserLogoExtended($label)
{
$short = substr($label, 0, 2);
$familyName = Piwik_getBrowserFamilyFullNameExtended($short);
$path = Piwik_getBrowserFamilyLogoExtended($familyName);
return $path;
}
function Piwik_getDeviceBrandLabel($label)
{
if (array_key_exists($label, UserAgentParserEnhanced::$deviceBrands)) {
return ucfirst(UserAgentParserEnhanced::$deviceBrands[$label]);
} else {
return "Unknown";
}
}
function Piwik_getDeviceTypeLabel($label)
{
if (isset(UserAgentParserEnhanced::$deviceTypes[$label])) {
return ucfirst(UserAgentParserEnhanced::$deviceTypes[$label]);
} else {
return "Unknown";
}
}
function Piwik_getDeviceTypeLogo($label)
{
$deviceTypeLogos = Array(
"Desktop" => "normal.gif",
"Smartphone" => "smartphone.png",
"Tablet" => "tablet.png",
"Tv" => "tv.png",
"Feature phone" => "mobile.gif",
"Console" => "console.gif");
if (!array_key_exists($label, $deviceTypeLogos) || $label == "Unknown") {
$label = 'unknown.gif';
} else {
$label = $deviceTypeLogos[$label];
}
$path = 'plugins/DevicesDetection/images/screens/' . $label;
return $path;
}
function Piwik_getModelName($label)
{
if (!$label)
return "Unknown";
else
return $label;
}
function Piwik_getOSFamilyFullNameExtended($label)
{
foreach (UserAgentParserEnhanced::$osFamilies as $name => $family) {
if (in_array($label, $family)) {
return $name;
}
}
return "Unknown";
}
function Piwik_getOsFamilyLogoExtended($label)
{
if (array_key_exists($label, UserAgentParserEnhanced::$osFamilies)) {
$path = 'plugins/UserSettings/images/os/' . UserAgentParserEnhanced::$osFamilies[$label][0] . ".gif";
} else {
$path = 'plugins/UserSettings/images/os/UNK.gif';
}
return $path;
}
function Piwik_getOsFullNameExtended($label)
{
if ($label != "" && $label != ";") {
$os = substr($label, 0, 3);
$ver = substr($label, 4, 15);
$osFullName = array_search($os, UserAgentParserEnhanced::$osShorts);
if ($osFullName) {
if (in_array($os, UserAgentParserEnhanced::$osFamilies['Windows'])) {
return $osFullName;
} else {
return trim($osFullName . " " . $ver);
}
}
} else {
return "Unknown";
}
}
function Piwik_getOsLogoExtended($label)
{
$short = substr($label, 0, 3);
$familyName = Piwik_getOsFamilyFullNameExtended($short);
$path = Piwik_getOsFamilyLogoExtended($familyName);
return $path;
}
\ No newline at end of file
Le fichier a été supprimé par une entrée .gitattributes, ou son encodage n'est pas pris en charge.
Le fichier a été supprimé par une entrée .gitattributes, ou son encodage n'est pas pris en charge.
Le fichier a été supprimé par une entrée .gitattributes, ou son encodage n'est pas pris en charge.
Le fichier a été supprimé par une entrée .gitattributes, ou son encodage n'est pas pris en charge.
Le fichier a été supprimé par une entrée .gitattributes, ou son encodage n'est pas pris en charge.
Le fichier a été supprimé par une entrée .gitattributes, ou son encodage n'est pas pris en charge.
Le fichier a été supprimé par une entrée .gitattributes, ou son encodage n'est pas pris en charge.
Le fichier a été supprimé par une entrée .gitattributes, ou son encodage n'est pas pris en charge.
Le fichier a été supprimé par une entrée .gitattributes, ou son encodage n'est pas pris en charge.
Le fichier a été supprimé par une entrée .gitattributes, ou son encodage n'est pas pris en charge.
Le fichier a été supprimé par une entrée .gitattributes, ou son encodage n'est pas pris en charge.
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter