-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
ReferrersManager.php
executable file
·107 lines (98 loc) · 3.82 KB
/
ReferrersManager.php
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\ReferrersManager;
use Piwik\Plugin;
/**
*
*/
class ReferrersManager extends Plugin
{
/**
* @see \Piwik\Plugin::registerEvents
*/
public function registerEvents()
{
return array(
'Referrer.addSearchEngineUrls' => 'addSearchEngineUrls',
'Referrer.addSocialUrls' => 'addSocialUrls',
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys',
);
}
/**
* Adds required CSS files
* @param $stylesheets
*/
public function getStylesheetFiles(&$stylesheets)
{
$stylesheets[] = "plugins/ReferrersManager/stylesheets/styles.less";
}
public function isTrackerPlugin()
{
return true;
}
/**
* Adds the user defined search engines
* @param $searchEngines
*/
public function addSearchEngineUrls(&$searchEngines)
{
try {
$userEngines = Model::getInstance()->getUserDefinedSearchEngines();
$searchEngines = array_merge($searchEngines, $userEngines);
} catch (\Exception $e) {}
}
/**
* Adds the user defined social networks
* @param $socials
*/
public function addSocialUrls(&$socials)
{
try {
if(Model::getInstance()->areDefaultSocialsDisabled()) {
$socials = array();
}
$userSocials = Model::getInstance()->getUserDefinedSocials();
$socials = array_merge($socials, $userSocials);
} catch (\Exception $e) {}
}
public function getClientSideTranslationKeys(&$translationKeys)
{
$translationKeys[] = "ReferrersManager_PluginDescription";
$translationKeys[] = "ReferrersManager_SearchEnginesAndSocialNetworks";
$translationKeys[] = "ReferrersManager_AddSocial";
$translationKeys[] = "ReferrersManager_Hostname";
$translationKeys[] = "ReferrersManager_SearchEnginesList";
$translationKeys[] = "ReferrersManager_SocialsList";
$translationKeys[] = "ReferrersManager_ManageSocialsAndEngines";
$translationKeys[] = "ReferrersManager_ConfirmRemove";
$translationKeys[] = "ReferrersManager_ManageSearchEngines";
$translationKeys[] = "ReferrersManager_ManageSocials";
$translationKeys[] = "ReferrersManager_DetectedEngine";
$translationKeys[] = "ReferrersManager_DetectedKeywords";
$translationKeys[] = "ReferrersManager_DetectedSocial";
$translationKeys[] = "ReferrersManager_CheckUrl";
$translationKeys[] = "ReferrersManager_CheckUrlDesc";
$translationKeys[] = "ReferrersManager_CheckUrlSend";
$translationKeys[] = "ReferrersManager_AddSearchEngine";
$translationKeys[] = "ReferrersManager_Parameters";
$translationKeys[] = "ReferrersManager_BacklinkPattern";
$translationKeys[] = "ReferrersManager_Charset";
$translationKeys[] = "ReferrersManager_AddEngineError";
$translationKeys[] = "ReferrersManager_CommaSeparated";
$translationKeys[] = "ReferrersManager_AddSocialError";
$translationKeys[] = "ReferrersManager_SocialListDisabled";
$translationKeys[] = "ReferrersManager_EnableSocialList";
$translationKeys[] = "ReferrersManager_DisableSocialList";
$translationKeys[] = "ReferrersManager_UsingDefaultSocials";
$translationKeys[] = "ReferrersManager_ProvideSocialData";
$translationKeys[] = "ReferrersManager_DuplicateHostnameInfo";
$translationKeys[] = "ReferrersManager_ProvideEngineData";
$translationKeys[] = "ReferrersManager_HostnameWildcardDesc";
}
}