-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclass.stomtfeedback.plugin.php
150 lines (128 loc) · 4.93 KB
/
class.stomtfeedback.plugin.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php if (!defined('APPLICATION')) exit();
/**
* Stomt Feedback plugin.
*
* @copyright STOMT Gmbh
* @license http://www.opensource.org/licenses/gpl-2.0.php GNU GPL v2
*/
$PluginInfo['StomtFeedback'] =
array(
'Name' => 'Stomt Feedback',
'Description' => 'STOMT makes it easy for anyone to provide instant feedback. This plugin allows you to customize the STOMT feedback button and add it to your wordpress site.Installation is simple and only takes seconds.',
'License' => 'GNU GPL2',
'Version' => '1.1',
'Date' => 'April 25, 2018',
'Author' => 'Mariem Bader',
'AuthorEmail' => 'bader.mariem1@gmail.com',
'AuthorUrl' => 'https://open.vanillaforums.com/profile/mariem_bader122',
'SettingsUrl' => 'settings/StomtFeedback',
'RequiredApplications' => array('Dashboard' => '>=2.0.0'));
/*
*/
/**
* Class StomtFeedbackPlugin
*/
class StomtFeedbackPlugin implements Gdn_IPlugin {
public function SettingsController_StomtFeedback_Create($Sender) {
$Sender->Permission('Garden.Plugins.Manage');
$Sender->AddSideMenu();
$Sender->Title('Stomt Feedback');
$ConfigurationModule = new ConfigurationModule($Sender);
$ConfigurationModule->RenderAll = True;
$items = [
'left' => 'left',
'right' => 'right'
];
$options = [
'true' => 'true',
'false' => 'false'
];
$Schema =
array(
'Plugins.StomtFeedback.TrackerId' =>
array(
'LabelCode' => 'App',
'Control' => 'TextBox',
'Default' => C('Plugins.StomtFeedback.TrackerId', '')
),'Plugins.StomtFeedback.position' =>
array(
'LabelCode' => 'Position',
'Control' => 'radiolist',
'Items' => $items,
'Default' => C('Plugins.StomtFeedback.position', 'right')
),'Plugins.StomtFeedback.label' =>
array(
'LabelCode' => 'Label',
'Control' => 'TextBox',
'Default' => C('Plugins.StomtFeedback.label', 'Feedback')
),'Plugins.StomtFeedback.colortext' =>
array(
'LabelCode' => 'TextColor',
'Control' => 'TextBox',
'Default' => C('Plugins.StomtFeedback.colortext', '#FFFFFF')
),'Plugins.StomtFeedback.colorbackg' =>
array(
'LabelCode' => 'Background-Color',
'Control' => 'TextBox',
'Default' => C('Plugins.StomtFeedback.colorbackg', '#0091C9')
),'Plugins.StomtFeedback.colorhover' =>
array(
'LabelCode' => 'Hover-Color',
'Control' => 'TextBox',
'Default' => C('Plugins.StomtFeedback.colorhover', '#04729E')
),'Plugins.StomtFeedback.preload' =>
array(
'LabelCode' => 'Preload',
'Control' => 'radiolist',
'Items' => $options,
'Default' => C('Plugins.StomtFeedback.preload',
'true')
)
);
$ConfigurationModule->Schema($Schema);
$ConfigurationModule->Initialize();
$Sender->View = dirname(__FILE__) . DS . 'views' . DS . 'settings.php';
$Sender->ConfigurationModule = $ConfigurationModule;
$Sender->Render();
}
public function Base_AfterBody_Handler($Sender) {
if ($Sender->MasterView == 'admin')
return;
$appId = C('Plugins.StomtFeedback.TrackerId');
$position = C('Plugins.StomtFeedback.position');
$label = C('Plugins.StomtFeedback.label');
$TextColor = C('Plugins.StomtFeedback.colortext');
$backgColor = C('Plugins.StomtFeedback.colorbackg');
$hoverColor = C('Plugins.StomtFeedback.colorhover');
$preload = C('Plugins.StomtFeedback.preload');
echo "
<script>
var options = {
appId: '".$appId."',
position: '".$position."',
label: '".$label."',
colorText: ' ".$TextColor."',
colorBackground: ' ".$backgColor."',
colorHover: ' ".$hoverColor."' ,
preload:' ".$preload."' ,
ShowClose:true
};
// Include the STOMT JavaScript SDK
(function(w, d, n, r, t, s){
w.Stomt = w.Stomt||[];
t = d.createElement(n);
s = d.getElementsByTagName(n)[0];
t.async=1;
t.src=r;
s.parentNode.insertBefore(t,s);
})(window, document, 'script', 'https://www.stomt.com/widget.js');
// Adjust the 'APP_ID' to your application id
// you can find it here: https://www.stomt.com/YOUR_PAGE/apps
Stomt.push(['addTab', options]);
Stomt.push(['addCreate', options]);
Stomt.push(['addFeed', options]);
</script>";
}
public function Setup() {
}
}