forked from hoamer/IceCast-Statistics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SystemSettings.php
112 lines (92 loc) · 3.73 KB
/
SystemSettings.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
<?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\IceCastStatistics;
use Piwik\Settings\Setting;
use Piwik\Settings\FieldConfig;
/**
* Defines Settings for IceCastStatistics.
*
* Usage like this:
* $settings = new SystemSettings();
* $settings->metric->getValue();
* $settings->description->getValue();
*/
class SystemSettings extends \Piwik\Settings\Plugin\SystemSettings
{
/** @var SystemSetting */
public $host;
/** @var SystemSetting */
public $browsers;
/** @var SystemSetting */
public $description;
/** @var SystemSetting */
public $password;
protected function init()
{
$this->protocol = $this->createProtocolSetting();
$this->hostname = $this->createHostSetting();
$this->port = $this->createPortSetting();
$this->username = $this->createUsernameSetting();
$this->password = $this->createPasswordSetting();
$this->mountpoint = $this->createMountpointSetting();
}
private function createPasswordSetting()
{
$default = "ThisIsAPassword";
return $this->makeSetting('password', $default, FieldConfig::TYPE_STRING, function (FieldConfig $field) {
$field->title = 'IceCast Password';
$field->uiControl = FieldConfig::UI_CONTROL_TEXT; //VIELLEICHT FALSCHER TYPE!! "_TEXTAREA"
$field->description = 'This is the Passowrd of the IceCast Server.';
});
}
private function createProtocolSetting()
{
$default = "https";
return $this->makeSetting('protocol', $default, FieldConfig::TYPE_STRING, function (FieldConfig $field) {
$field->title = 'Protocol';
$field->uiControl = FieldConfig::UI_CONTROL_TEXT;
$field->description = 'This is the protocol used to connect to your IceCast-Server. Either http, oder https.';
});
}
private function createHostSetting()
{
$default = "localhost";
return $this->makeSetting('hostname', $default, FieldConfig::TYPE_STRING, function (FieldConfig $field) {
$field->title = 'Hostname';
$field->uiControl = FieldConfig::UI_CONTROL_TEXT; //VIELLEICHT FALSCHER TYPE!! "_TEXTAREA"
$field->description = 'This is the hostname of the IceCast Server. e.g. localhost, technoac.de, or 8.8.8.8';
});
}
private function createUsernameSetting()
{
$default = "admin";
return $this->makeSetting('username', $default, FieldConfig::TYPE_STRING, function (FieldConfig $field) {
$field->title = 'Username';
$field->uiControl = FieldConfig::UI_CONTROL_TEXT; //VIELLEICHT FALSCHER TYPE!! "_TEXTAREA"
$field->description = 'This is the Username of the IceCast Server';
});
}
private function createPortSetting()
{
$default = "8000";
return $this->makeSetting('port', $default, FieldConfig::TYPE_STRING, function (FieldConfig $field) {
$field->title = 'Port';
$field->uiControl = FieldConfig::UI_CONTROL_TEXT; //VIELLEICHT FALSCHER TYPE!! "_TEXTAREA"
$field->description = 'Port on which the IceCast Server is Screaming. e.g. 8000';
});
}
private function createMountpointSetting()
{
$default = "/stream.ogg";
return $this->makeSetting('mountpoint', $default, FieldConfig::TYPE_STRING, function (FieldConfig $field) {
$field->title = 'Mountpoint';
$field->uiControl = FieldConfig::UI_CONTROL_TEXT; //VIELLEICHT FALSCHER TYPE!! "_TEXTAREA"
$field->description = 'This is the Mountpoint you want to read. e.g. /stream.ogg';
});
}
}