-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettings.php
71 lines (59 loc) · 2.27 KB
/
Settings.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
<?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\NewspaperReporting;
use Piwik\Settings\SystemSetting;
use Piwik\Settings\UserSetting;
/**
* Defines Settings for NewspaperReporting.
*
* Usage like this:
* $settings = new Settings('NewspaperReporting');
* $settings->autoRefresh->getValue();
* $settings->metric->getValue();
*/
class Settings extends \Piwik\Plugin\Settings
{
/** @var SystemSetting */
public $paywallId;
/** @var SystemSetting */
public $articleId;
protected function init()
{
$this->setIntroduction('Here you can specify the settings for this plugin.');
$this->createPayWallSettings();
$this->createArticleSettings();
}
private function createPayWallSettings()
{
$this->paywallId = new SystemSetting('paywallCvarId', 'PayWall custom_var id');
$this->paywallId->readableByCurrentUser = true;
$this->paywallId->uiControlType = static::CONTROL_TEXT;
$this->paywallId->introduction = 'Insert numeric id of custom var, where PayWall id will be stored';
$this->paywallId->inlineHelp = 'Just a number between 1 and 5';
$this->paywallId->description = 'Custom variable id for PayWall identification';
$this->paywallId->defaultValue = "2";
$this->paywallId->transform = function ($value) {
return intval($value);
};
$this->addSetting($this->paywallId);
}
private function createArticleSettings()
{
$this->articleId = new SystemSetting('articleCvarId', 'Article custom_var id');
$this->articleId->readableByCurrentUser = true;
$this->articleId->uiControlType = static::CONTROL_TEXT;
$this->articleId->introduction = 'Insert numeric id of custom var, where Article id will be stored';
$this->articleId->inlineHelp = 'Just a number between 1 and 5';
$this->articleId->description = 'Custom variable id for Article identification';
$this->articleId->defaultValue = "1";
$this->articleId->transform = function ($value) {
return intval($value);
};
$this->addSetting($this->articleId);
}
}