blob: 6010391fdf8ded8d90db9c1fd834a868e9d76c69 (
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
78
79
80
81
82
83
84
85
86
87
|
<?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\CoreAdminHome;
use Piwik\Db;
use Piwik\Piwik;
use Piwik\ProxyHttp;
use Piwik\Settings\Plugin\UserSetting;
use Piwik\Settings\Storage\Backend\PluginSettingsTable;
/**
*
*/
class CoreAdminHome extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::registerEvents
*/
public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
'UsersManager.deleteUser' => 'cleanupUser',
'API.DocumentationGenerator.@hideExceptForSuperUser' => 'displayOnlyForSuperUser',
'Template.jsGlobalVariables' => 'addJsGlobalVariables',
'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys'
);
}
public function cleanupUser($userLogin)
{
PluginSettingsTable::removeAllUserSettingsForUser($userLogin);
}
public function getStylesheetFiles(&$stylesheets)
{
$stylesheets[] = "libs/jquery/themes/base/jquery-ui.min.css";
$stylesheets[] = "plugins/Morpheus/stylesheets/base.less";
$stylesheets[] = "plugins/Morpheus/stylesheets/main.less";
$stylesheets[] = "plugins/CoreAdminHome/stylesheets/generalSettings.less";
}
public function getJsFiles(&$jsFiles)
{
$jsFiles[] = "libs/bower_components/jquery/dist/jquery.min.js";
$jsFiles[] = "libs/bower_components/jquery-ui/ui/minified/jquery-ui.min.js";
$jsFiles[] = "libs/jquery/jquery.browser.js";
$jsFiles[] = "libs/bower_components/sprintf/dist/sprintf.min.js";
$jsFiles[] = "plugins/Morpheus/javascripts/piwikHelper.js";
$jsFiles[] = "plugins/Morpheus/javascripts/ajaxHelper.js";
$jsFiles[] = "plugins/Morpheus/javascripts/jquery.icheck.min.js";
$jsFiles[] = "plugins/Morpheus/javascripts/morpheus.js";
$jsFiles[] = "plugins/CoreHome/javascripts/broadcast.js";
$jsFiles[] = "plugins/CoreAdminHome/javascripts/generalSettings.js";
$jsFiles[] = "plugins/CoreHome/javascripts/donate.js";
$jsFiles[] = "plugins/CoreAdminHome/javascripts/protocolCheck.js";
}
public function displayOnlyForSuperUser(&$hide)
{
$hide = !Piwik::hasUserSuperUserAccess();
}
public function addJsGlobalVariables(&$out)
{
if (ProxyHttp::isHttps()) {
$isHttps = 'true';
} else {
$isHttps = 'false';
}
$out .= "piwik.hasServerDetectedHttps = $isHttps;\n";
}
public function getClientSideTranslationKeys(&$translationKeys)
{
$translationKeys[] = 'CoreAdminHome_ProtocolNotDetectedCorrectly';
$translationKeys[] = 'CoreAdminHome_ProtocolNotDetectedCorrectlySolution';
}
}
|