blob: 3adf7da45c43e6e3eeab3a2f63c7d79c9f5c54ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\UserSettings;
use Piwik\Piwik;
use Piwik\Plugins\CoreVisualizations\Visualizations\Graph;
use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable;
/**
*
*/
class UserSettings extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
*/
public function getListHooksRegistered()
{
return array(
'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations',
'Live.getAllVisitorDetails' => 'extendVisitorDetails',
'Request.dispatch' => 'mapDeprecatedActions'
);
}
/**
* Maps the deprecated actions that were 'moved' to DevicesDetection plugin
*
* @deprecated
* @param $module
* @param $action
* @param $parameters
*/
public function mapDeprecatedActions(&$module, &$action, &$parameters)
{
$movedMethods = array(
'getBrowser' => 'getBrowsers',
'getBrowserVersion' => 'getBrowserVersions',
'getMobileVsDesktop' => 'getType',
'getOS' => 'getOsVersions',
'getOSFamily' => 'getOsFamilies',
'getBrowserType' => 'getBrowserEngines'
);
if ($module == 'UserSettings' && array_key_exists($action, $movedMethods)) {
$module = 'DevicesDetection';
$action = $movedMethods[$action];
}
}
public function extendVisitorDetails(&$visitor, $details)
{
$instance = new Visitor($details);
$visitor['screenType'] = $instance->getScreenType();
$visitor['resolution'] = $instance->getResolution();
$visitor['screenTypeIcon'] = $instance->getScreenTypeIcon();
$visitor['plugins'] = $instance->getPlugins();
$visitor['pluginsIcons'] = $instance->getPluginIcons();
}
public function addMetricTranslations(&$translations)
{
$metrics = array(
'nb_visits_percentage' => Piwik::translate('General_ColumnPercentageVisits')
);
$translations = array_merge($translations, $metrics);
}
}
|