-
Notifications
You must be signed in to change notification settings - Fork 13
/
PrivacyWireConfig.php
414 lines (411 loc) · 23.5 KB
/
PrivacyWireConfig.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
<?php namespace ProcessWire;
class PrivacyWireConfig extends ModuleConfig
{
public function __construct()
{
$textarea_type = 'textarea';
if ($this->wire()->modules->isInstalled('InputfieldTinyMCE')) {
$textarea_type = 'tinymce';
} elseif ($this->wire()->modules->isInstalled('InputfieldCkeditor')) {
$textarea_type = 'ckeditor';
}
$this->add([
[ // general config
'name' => 'privacywire-general',
'type' => 'fieldset',
'label' => 'General Options',
'children' => [
[
'name' => 'is_active',
'type' => 'checkbox',
'label' => $this->_('Do you want to activate PrivacyWire?')
],
[ // opt-in type
'name' => 'cookie_groups',
'type' => 'asmselect',
'label' => $this->_('Available Cookie Groups'),
'description' => sprintf($this->_("Select the cookie groups displayed to the user. If more than the two default groups ('%s' and '%s') are allowed, the option window will be shown to the user."), $this->_("All Cookies"), $this->_("Necessary Cookies")),
'options' => [
"all" => $this->_("All Cookies"),
"necessary" => $this->_("Necessary Cookies"),
"functional" => $this->_("Functional Cookies"),
"statistics" => $this->_("Statistics Cookies"),
'marketing' => $this->_("Marketing Cookies"),
'external_media' => $this->_("External Media Cookies")
],
],
[ // version, integer
'name' => 'version',
'type' => 'integer',
'label' => $this->_('Versioning'),
'description' => $this->_("When you increase the version number, all users have to opt-in again. This version number is saved with the users consent in the cookie."),
'min' => 1,
'columnWidth' => 25,
],
[ // respect "do not track"
'name' => 'respectDNT',
'type' => 'checkbox',
'label' => $this->_('DNT: Do Not Track'),
'description' => $this->_("If enabled, PrivacyWire checks if the users browser sends the DNT-Header. If so, no cookie banner will be shown and the user will be handled like 'Only Necessary Cookies' would be chosen."),
'checkboxLabel' => $this->_('Respect "Do Not Track" Settings from the browser'),
'columnWidth' => 25,
],
[ // handle bots as only necessary
'name' => 'checkForBots',
'type' => 'checkbox',
'label' => $this->_('Bots: Hide Banner'),
'description' => $this->_("If enabled, PrivacyWire checks if the user-agent is some kind of bot. If so, no cookie banner will be shown and the user will be handled like 'Only Necessary Cookies' would be chosen. This im"),
'checkboxLabel' => $this->_('Treat bots as "only necessary" is chosen'),
'columnWidth' => 25,
],
[ // Message Timeout
'name' => 'messageTimeout',
'type' => 'integer',
'label' => $this->_('Consent Saving Confirmation Duration'),
'description' => $this->_("How many milliseconds should the consent saving confirmation be visible after the user makes a choice."),
'columnWidth' => 25,
],
],
],
[ // groups labels
'name' => 'privacywire-group-labels',
'type' => 'fieldset',
'label' => 'Cookie Groups Labels',
'children' => [
[ // label for cookie group: necessary
'name' => 'cookies_necessary_label',
'type' => 'text',
'label' => $this->_('Necessary Cookies'),
'useLanguages' => true,
'columnWidth' => 50,
'value' => $this->_("Necessary Cookies"),
],
[ // label for cookie group: functional
'name' => 'cookies_functional_label',
'type' => 'text',
'label' => $this->_('Functional Cookies'),
'showIf' => 'cookie_groups=functional',
'useLanguages' => true,
'columnWidth' => 50,
'value' => $this->_("Functional Cookies"),
],
[ // label for cookie group: statistics
'name' => 'cookies_statistics_label',
'type' => 'text',
'label' => $this->_('Statistics Cookies'),
'showIf' => 'cookie_groups=statistics',
'useLanguages' => true,
'columnWidth' => 50,
'value' => $this->_("Statistics Cookies"),
],
[ // label for cookie group: marketing
'name' => 'cookies_marketing_label',
'type' => 'text',
'label' => $this->_('Marketing Cookies'),
'showIf' => 'cookie_groups=marketing',
'useLanguages' => true,
'columnWidth' => 50,
'value' => $this->_("Statistics Cookies"),
],
[ // label for cookie group: external media
'name' => 'cookies_external_media_label',
'type' => 'text',
'label' => $this->_('External Media Cookies'),
'showIf' => 'cookie_groups=external_media',
'useLanguages' => true,
'columnWidth' => 50,
'value' => $this->_("External Media Cookies")
],
],
],
[ // banner
'name' => 'privacywire-banner',
'type' => 'fieldset',
'label' => 'Banner Options',
'children' => [
[ // banner headline (optional)
'name' => 'content_banner_title',
'type' => 'text',
'label' => $this->_('Title'),
'description' => $this->_("Optional: If empty, no headline will be shown in the banner."),
'useLanguages' => true,
'columnWidth' => 100,
],
[ // banner body copy
'name' => 'content_banner_text',
'type' => $textarea_type,
'label' => $this->_('Text'),
//'toolbar' => 'Bold, Italic, NumberedList, BulletedList, PWLink, Unlink, PWImage, Table',
'useLanguages' => true,
'columnWidth' => 100,
],
[ // banner show details
'name' => 'content_banner_details_show',
'type' => 'checkbox',
'label' => $this->_('Additional details in the options banner'),
'description' => $this->_("If enabled, you will have the possibility to display additional headline and text elements within the options banner where the user can select the cookies allowed."),
'checkboxLabel' => $this->_('Display additional details in the options banner'),
'columnWidth' => 100,
],
[ // banner details headline (optional)
'name' => 'content_banner_details_title',
'type' => 'text',
'label' => $this->_('Details Headline'),
'description' => $this->_("Optional: If empty, no headline will be shown in the banner."),
'showIf' => "content_banner_details_show=1",
'useLanguages' => true,
'columnWidth' => 100,
],
[ // banner details text
'name' => 'content_banner_details_text',
'type' => $textarea_type,
'label' => $this->_('Details Text'),
//'toolbar' => 'Bold, Italic, NumberedList, BulletedList, PWLink, Unlink, PWImage, Table',
'showIf' => "content_banner_details_show=1",
'useLanguages' => true,
'columnWidth' => 100,
],
],
],
[ // links
'name' => 'privacywire-links',
'type' => 'fieldset',
'label' => 'Links Options',
'children' => [
[ // privacy policy url
'name' => 'content_banner_privacy_link',
'type' => 'url',
'label' => $this->_('Privacy Policy URL'),
'description' => $this->_("If you want to output a link to your privacy policy page, add the URL to this page here."),
'useLanguages' => true,
'columnWidth' => 50,
],
[ // privacy policy link title
'name' => 'content_banner_privacy_title',
'type' => 'text',
'label' => $this->_('Privacy Policy link title'),
'description' => $this->_("The text of the link to your privacy policy page."),
//'showIf' => "content_banner_privacy_link!=''",
'useLanguages' => true,
'columnWidth' => 50,
],
[ // imprint url
'name' => 'content_banner_imprint_link',
'type' => 'url',
'label' => $this->_('Imprint URL'),
'description' => $this->_("If you want to output a link to your imprint page, add the URL to this page here."),
'useLanguages' => true,
'columnWidth' => 50,
],
[ // imprint link title
'name' => 'content_banner_imprint_title',
'type' => 'text',
'label' => $this->_('Imprint link title'),
'description' => $this->_("The text of the link to your imprint page."),
//'showIf' => "content_banner_imprint_link!=''",
'useLanguages' => true,
'columnWidth' => 50,
],
],
],
[ // buttons
'name' => 'privacywire-buttons',
'type' => 'fieldset',
'label' => 'Buttons Options',
'children' => [
[ // Button Label: Allow All
'name' => 'content_banner_button_allow_all',
'type' => 'text',
'label' => $this->_('Button Label: Allow All Cookies'),
'useLanguages' => true,
'columnWidth' => 33,
],
[ // Button Label: Allow Necessary
'name' => 'content_banner_button_allow_necessary',
'type' => 'text',
'label' => $this->_('Button Label: Allow Necessary Cookies'),
'useLanguages' => true,
'columnWidth' => 33,
],
[ // Button Label: Choose Cookies
'name' => 'content_banner_button_choose',
'type' => 'text',
'label' => $this->_('Button Label: Choose Cookies'),
'useLanguages' => true,
'columnWidth' => 34,
],
[ // Button Label: Toggle Cookies Options
'name' => 'content_banner_button_toggle',
'type' => 'text',
'label' => $this->_('Button Label: Toggle Cookie Options'),
'useLanguages' => true,
'columnWidth' => 33,
],
[ // Show another "Accept all" instead of the "Toggle" Button
'name' => 'content_banner_button_all_instead_toggle',
'type' => 'checkbox',
'label' => $this->_('Choose Window: "Accept all" instead of "Toggle"'),
'checkboxLabel' => $this->_('Show "Accept all" Button instead of "Toggle" Button'),
'columnWidth' => 33,
],
[ // Button Label: Save Preferences
'name' => 'content_banner_button_save',
'type' => 'text',
'label' => $this->_('Button Label: Save Preferences'),
'useLanguages' => true,
'columnWidth' => 34,
'value' => "",
],
[ // Saved Message Text
'name' => 'content_banner_save_message',
'type' => 'text',
'label' => $this->_('Message: Save Confirmation'),
'useLanguages' => true,
'columnWidth' => 33,
],
[ // Textformatter Button Label
'name' => 'textformatter_choose_label',
'type' => 'text',
'label' => $this->_('Textformatter Button label'),
'useLanguages' => true,
'columnWidth' => 33,
],
[ // Ask for consent Button label
'name' => 'ask_content_button_label',
'type' => 'text',
'label' => $this->_('Button Label: Ask for consent'),
'description' => $this->_("You can insert the current cookie category name by using the placeholder {category}."),
'useLanguages' => true,
'columnWidth' => 34,
],
[ // ask for consent text field
'name' => 'ask_consent_message',
'type' => $textarea_type,
'label' => $this->_('Text above button: Ask for consent'),
'description' => $this->_("You can insert the current cookie category name by using the placeholder {category}."),
//'toolbar' => 'Bold, Italic, NumberedList, BulletedList, PWLink, Unlink, PWImage, Table',
'useLanguages' => true,
'columnWidth' => 100,
],
],
],
[ // advanced options
'name' => 'privacywire-advanced',
'type' => 'fieldset',
'label' => 'Advanced Options',
'children' => [
[ // Output mode
'name' => 'output_mode',
'type' => 'select',
'label' => $this->_('Output mode of PrivacyWire JS Core'),
'description' => $this->_("Choose if you want to render the PrivacyWire JS Core as inline script or regular script tag."),
'options' => [
"regular" => $this->_("Regular script tag"),
"inline" => $this->_("Inline script"),
],
'columnWidth' => 50,
],
[ // banner header tag
'name' => 'banner_header_tag',
'type' => 'select',
'label' => $this->_('Banner Header Tag'),
'description' => $this->_("Choose between <header> and <div>."),
'options' => [
"div" => $this->_("<div>"),
"header" => $this->_("<header>"),
],
'columnWidth' => 50,
],
[ // add basic css styles or not
'name' => 'add_basic_css_styling',
'type' => 'checkbox',
'label' => $this->_('CSS: Add basic CSS Styling'),
'description' => $this->_("If enabled, PrivacyWire will automatically include some very basic css styles to the output."),
'checkboxLabel' => $this->_('Add basic CSS Styling'),
'columnWidth' => 50,
],
[ // use consent detection by class?
'name' => 'detect_consents_by_class',
'type' => 'checkbox',
'label' => $this->_('Detect consent windows by class `require-consent` instead of data-attribute.'),
'description' => $this->_("If enabled, PrivacyWire will use a class selector instead of data-attribute selector to detect elements which require consent. This is more performant."),
'checkboxLabel' => $this->_('Use consent detection by class instead of data-attribute'),
'columnWidth' => 50,
],
[ // alternate banner template
'name' => 'alternate_banner_template',
'type' => 'text',
'label' => $this->_('Alternate Banner Template'),
'description' => $this->_("If you want to replace the original banner template (located in site/modules/PrivacyWire/PrivacyWireBanner.php ) insert the alternative file path here (starting from webroot without leading slash )"),
'columnWidth' => 50,
],
[ // alternate inline consent template
'name' => 'alternate_inline_consent_template',
'type' => 'text',
'label' => $this->_('Alternate Inline Consent Template'),
'description' => $this->_("If you want to replace the original inline consent template (located in site/modules/PrivacyWire/PrivacyWireConsentBlueprint.php ) insert the alternative file path here (starting from webroot without leading slash )"),
'columnWidth' => 50,
],
[ // Trigger a custom js function
'name' => 'trigger_custom_js_function',
'type' => 'text',
'label' => $this->_('Trigger a custom js function'),
'description' => $this->_("If you want to trigger a custom js function after saving the cookie banner, insert the name of the function here"),
'columnWidth' => 50,
],
[ // render manually
'name' => 'render_manually',
'type' => 'checkbox',
'label' => $this->_('Render Banner and Header Content Manually'),
'description' => $this->_("If you want to render PrivacyWire header and banner content manually instead of letting the module render them for you, check this option."),
'notes' => $this->_("Use \n`\$modules->get('PrivacyWire')->headContent` to render header tags and \n`\$modules->get('PrivacyWire')->bodyContent` to render body content. \n**OR** if you want to have the total flexibility where and how you embed the required scripts and markup, have a look into the PrivacyWire.module and read the comments ;-)"),
'columnWidth' => 50,
],
],
],
]);
}
public function getDefaults()
{
return [
'is_active' => true,
'version' => 1,
'cookie_groups' => ["all", "necessary"],
'respectDNT' => false,
'checkForBots' => false,
'cookies_necessary_label' => $this->_('Necessary'),
'cookies_functional_label' => $this->_('Functional'),
'cookies_statistics_label' => $this->_('Statistics'),
'cookies_marketing_label' => $this->_('Marketing'),
'cookies_external_media_label' => $this->_('External Media'),
'content_banner_title' => $this->_("This website is using cookies to provide a good browsing experience"),
'content_banner_text' => $this->_("These include essential cookies that are necessary for the operation of the site, as well as others that are used only for anonymous statistical purposes, for comfort settings or to display personalized content. You can decide for yourself which categories you want to allow. Please note that based on your settings, not all functions of the website may be available."),
'content_banner_details_show' => false,
'content_banner_details_title' => $this->_("This is how and why we use cookies"),
'content_banner_details_text' => $this->_("Here you can store more detailed information on the cookies used or describe individual cookies in depth."),
'content_banner_privacy_link' => null,
'content_banner_privacy_title' => $this->_("Privacy Policy"),
'content_banner_imprint_link' => null,
'content_banner_imprint_title' => $this->_("Imprint"),
'content_banner_button_allow_all' => $this->_("Accept all"),
'content_banner_button_allow_necessary' => $this->_("Accept necessary cookies only"),
'content_banner_button_choose' => $this->_("Choose cookies"),
'content_banner_button_save' => $this->_("Save preferences"),
'content_banner_button_toggle' => $this->_("Toggle options"),
'content_banner_save_message' => $this->_("Your cookie preferences have been saved."),
'content_banner_button_all_instead_toggle' => false,
'textformatter_choose_label' => $this->_("Show or edit my Cookie Consent"),
'trigger_custom_js_function' => "",
'messageTimeout' => 1500,
'add_basic_css_styling' => true,
'ask_consent_message' => $this->_("To load this element, it is required to consent to the following cookie category: {category}."),
'ask_content_button_label' => $this->_("Load {category} cookies"),
'banner_header_tag' => 'div',
'alternate_banner_template' => '',
'alternate_inline_consent_template' => '',
'render_manually' => false,
'detect_consents_by_class' => false,
'output_mode' => 'regular'
];
}
}