forked from loadavg/loadavg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass.Plugins.php
executable file
·132 lines (92 loc) · 2.65 KB
/
class.Plugins.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
/**
* LoadAvg - Server Monitoring & Analytics
* http://www.loadavg.com
*
* Main controller class for LoadAvg 2.0
*
* @link https://github.com/loadavg/loadavg
* @author Karsten Becker
* @copyright 2014 Sputnik7
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
class loadPlugins
{
public static $settings_ini; //location of settings.ini file
public static $_settings; // storing standard settings and/or loaded modules settings
public static $_classes; // storing loaded modules classes
public static $_plugins; // storing and managing plugins
public static $date_range; // range of data to be charted
/**
* setSettings
*
* Stores the standard settings
*
* @param string $module name of the module
* @param array $args array of module settings
*/
public static function setSettings($module, $args)
{
@self::$_settings->$module = $args;
}
/**
* __construct
*
* Class constructor
*
*/
public function __construct()
{
//set timezone and load in settings
self::$settings_ini = "settings.ini.php";
$this->setSettings('general',
parse_ini_file(APP_PATH . '/config/' . self::$settings_ini, true)
);
//generate list of all plugins
LoadUtility::generateExtensionList( 'plugins', self::$_plugins );
//load all plugins that are enabled
LoadUtility::loadExtensions( 'plugins', self::$_settings, self::$_classes, self::$_plugins);
//echo '<pre>'; var_dump(self::$_plugins); echo '</pre>';
}
/**
* updateModuleSettings
*
* Called by modulesettings to read settings back in after changes...
*
*/
public static function updateModuleSettings()
{
LoadModules::setSettings('general',
parse_ini_file(APP_PATH . '/config/' . self::$settings_ini, true)
);
//generate list of all modules
LoadUtility::generateExtensionList( 'plugins', self::$_plugins );
//load all charting modules that are enabled
LoadUtility::loadExtensions( 'plugins', self::$_settings, self::$_classes, self::$_plugins);
}
public function buildPluginMenu( ) {
//if module is true in settings.ini file then we load it in
foreach ( self::$_settings->general['plugins'] as $key => &$value ) {
//echo 'VALUE: ' . $value . ' ' . 'KEY: ' . $key . '<br>';
//if value is true plugin is active
if ( $value == "true" ) {
$pluginClass = LoadPlugins::$_classes[$key];
$pluginData = $pluginClass->getPluginData();
//var_dump ($pluginData);
}
}
}
/**
* setDateRange
*
* Sets the range for which we want data to be charted
*
* @param dateRange array of dates and times
*/
public function setDateRange($dateRange)
{
@self::$date_range = $dateRange;
}
}