PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / 3.2.14
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar v3.2.14
3.3.1 3.3.0 3.2.14 3.2.13 3.2.12 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 trunk 0.2.5.5 0.2.5.6 0.2.5.7 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.2.1 All 156 releases
notificationx / includes / Types / GDPR.php

GDPR.php in NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar 3.2.14, at includes/Types/GDPR.php

495 lines 22.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Extension Abstract
5 *
6 * @package NotificationX\Extensions
7 */
8
9 namespace NotificationX\Types;
10
11 use NotificationX\Admin\InfoTooltipManager;
12 use NotificationX\Core\Rule;
13 use NotificationX\Core\Rules;
14 use NotificationX\Extensions\ExtensionFactory;
15 use NotificationX\Extensions\GlobalFields;
16 use NotificationX\GetInstance;
17 use NotificationX\Modules;
18
19 /**
20 * Extension Abstract for all Extension.
21 * @method static GDPR get_instance($args = null)
22 */
23 class GDPR extends Types {
24 /**
25 * Instance of GDPR
26 *
27 * @var GDPR
28 */
29 use GetInstance;
30
31 public $priority = 10;
32 public $themes = [];
33 public $module = [
34 'modules_gdpr',
35 ];
36 public $default_source = 'gdpr_notification';
37 public $nx_has_permission = true;
38
39 /**
40 * Initially Invoked when initialized.
41 */
42 public function __construct() {
43 parent::__construct();
44 $this->id = 'gdpr';
45 }
46
47 public function init()
48 {
49 parent::init();
50 $this->title = __('Cookie Notice', 'notificationx');
51 // nx_comment_colored_themes
52 $this->themes = [
53 'theme-light-one' => [
54 'source' => 'https://notificationx.com/wp-content/uploads/2025/01/gdpr-light-1.png',
55 'image_shape' => 'circle',
56 'template' => [
57 'first_param' => 'tag_name',
58 'custom_first_param' => __('Someone', 'notificationx'),
59 'second_param' => __('commented on', 'notificationx'),
60 'third_param' => 'tag_post_title',
61 'custom_third_param' => __('Anonymous Post', 'notificationx'),
62 'fourth_param' => 'tag_time',
63 'custom_fourth_param' => __('Some time ago', 'notificationx'),
64 ],
65 'rules' => Rules::is('gdpr_theme', false),
66 ],
67 'theme-light-two' => [
68 'source' => 'https://notificationx.com/wp-content/uploads/2025/01/gdpr-light-2.png',
69 'image_shape' => 'circle',
70 'template' => [
71 'first_param' => 'tag_name',
72 'custom_first_param' => __('Someone', 'notificationx'),
73 'second_param' => __('commented on', 'notificationx'),
74 'third_param' => 'tag_post_title',
75 'custom_third_param' => __('Anonymous Post', 'notificationx'),
76 'fourth_param' => 'tag_time',
77 'custom_fourth_param' => __('Some time ago', 'notificationx'),
78 ],
79 'rules' => Rules::is('gdpr_theme', false),
80 ],
81 'theme-light-three' => [
82 'source' => 'https://notificationx.com/wp-content/uploads/2025/01/gdpr-light-3.png',
83 'image_shape' => 'square',
84 'template' => [
85 'first_param' => 'tag_name',
86 'custom_first_param' => __('Someone', 'notificationx'),
87 'second_param' => __('commented on', 'notificationx'),
88 'third_param' => 'tag_post_title',
89 'custom_third_param' => __('Anonymous Post', 'notificationx'),
90 'fourth_param' => 'tag_time',
91 'custom_fourth_param' => __('Some time ago', 'notificationx'),
92 ],
93 'rules' => Rules::is('gdpr_theme', false),
94 ],
95 'theme-light-four' => [
96 'source' => 'https://notificationx.com/wp-content/uploads/2025/01/gdpr-light-4.png',
97 'image_shape' => 'rounded',
98 'template' => [
99 'first_param' => 'tag_name',
100 'custom_first_param' => __('Someone', 'notificationx'),
101 'second_param' => __('commented on', 'notificationx'),
102 'third_param' => 'tag_post_comment',
103 'custom_third_param' => __('Anonymous Post', 'notificationx'),
104 'fourth_param' => 'tag_time',
105 'custom_fourth_param' => __('Some time ago', 'notificationx'),
106 ],
107 'rules' => Rules::is('gdpr_theme', false),
108 ],
109 'theme-dark-one' => [
110 'source' => 'https://notificationx.com/wp-content/uploads/2025/01/gdpr-dark-1.png',
111 'image_shape' => 'rounded',
112 'template' => [
113 'first_param' => 'tag_name',
114 'custom_first_param' => __('Someone', 'notificationx'),
115 'second_param' => __('commented on', 'notificationx'),
116 'third_param' => 'tag_post_comment',
117 'custom_third_param' => __('Anonymous Post', 'notificationx'),
118 'fourth_param' => 'tag_time',
119 'custom_fourth_param' => __('Some time ago', 'notificationx'),
120 ],
121 'rules' => Rules::is('gdpr_theme', true),
122 ],
123 'theme-dark-two' => [
124 'source' => 'https://notificationx.com/wp-content/uploads/2025/01/gdpr-dark-2.png',
125 'image_shape' => 'rounded',
126 'template' => [
127 'first_param' => 'tag_name',
128 'custom_first_param' => __('Someone', 'notificationx'),
129 'second_param' => __('commented on', 'notificationx'),
130 'third_param' => 'tag_post_comment',
131 'custom_third_param' => __('Anonymous Post', 'notificationx'),
132 'fourth_param' => 'tag_time',
133 'custom_fourth_param' => __('Some time ago', 'notificationx'),
134 ],
135 'rules' => Rules::is('gdpr_theme', true),
136 ],
137 'theme-dark-three' => [
138 'source' => 'https://notificationx.com/wp-content/uploads/2025/01/gdpr-dark-3.png',
139 'image_shape' => 'rounded',
140 'template' => [
141 'first_param' => 'tag_name',
142 'custom_first_param' => __('Someone', 'notificationx'),
143 'second_param' => __('commented on', 'notificationx'),
144 'third_param' => 'tag_post_comment',
145 'custom_third_param' => __('Anonymous Post', 'notificationx'),
146 'fourth_param' => 'tag_time',
147 'custom_fourth_param' => __('Some time ago', 'notificationx'),
148 ],
149 'rules' => Rules::is('gdpr_theme', true),
150 ],
151 'theme-dark-four' => [
152 'source' => 'https://notificationx.com/wp-content/uploads/2025/01/gdpr-dark-4.png',
153 'image_shape' => 'rounded',
154 'template' => [
155 'first_param' => 'tag_name',
156 'custom_first_param' => __('Someone', 'notificationx'),
157 'second_param' => __('commented on', 'notificationx'),
158 'third_param' => 'tag_post_comment',
159 'custom_third_param' => __('Anonymous Post', 'notificationx'),
160 'fourth_param' => 'tag_time',
161 'custom_fourth_param' => __('Some time ago', 'notificationx'),
162 ],
163 'rules' => Rules::is('gdpr_theme', true),
164 ],
165 'theme-banner-light-one' => [
166 'source' => 'https://notificationx.com/wp-content/uploads/2025/01/gdpr-banner-light-1.png',
167 'image_shape' => 'circle',
168 'template' => [
169 'first_param' => 'tag_name',
170 'custom_first_param' => __('Someone', 'notificationx'),
171 'second_param' => __('commented on', 'notificationx'),
172 'third_param' => 'tag_post_comment',
173 'custom_third_param' => __('Anonymous Post', 'notificationx'),
174 'fourth_param' => 'tag_time',
175 'custom_fourth_param' => __('Some time ago', 'notificationx'),
176 ],
177 'rules' => Rules::is('gdpr_theme', false),
178 ],
179 'theme-banner-light-two' => [
180 'source' => 'https://notificationx.com/wp-content/uploads/2025/01/gdpr-banner-light-2.png',
181 'image_shape' => 'circle',
182 'template' => [
183 'first_param' => 'tag_name',
184 'custom_first_param' => __('Someone', 'notificationx'),
185 'second_param' => __('commented on', 'notificationx'),
186 'third_param' => 'tag_post_comment',
187 'custom_third_param' => __('Anonymous Post', 'notificationx'),
188 'fourth_param' => 'tag_time',
189 'custom_fourth_param' => __('Some time ago', 'notificationx'),
190 ],
191 'rules' => Rules::is('gdpr_theme', false),
192 ],
193 'theme-banner-dark-one' => [
194 'source' => 'https://notificationx.com/wp-content/uploads/2025/01/gdpr-banner-dark-1.png',
195 'image_shape' => 'circle',
196 'template' => [
197 'first_param' => 'tag_name',
198 'custom_first_param' => __('Someone', 'notificationx'),
199 'second_param' => __('commented on', 'notificationx'),
200 'third_param' => 'tag_post_comment',
201 'custom_third_param' => __('Anonymous Post', 'notificationx'),
202 'fourth_param' => 'tag_time',
203 'custom_fourth_param' => __('Some time ago', 'notificationx'),
204 ],
205 'rules' => Rules::is('gdpr_theme', true),
206 ],
207 'theme-banner-dark-two' => [
208 'source' => 'https://notificationx.com/wp-content/uploads/2025/01/gdpr-banner-dark-2.png',
209 'image_shape' => 'circle',
210 'template' => [
211 'first_param' => 'tag_name',
212 'custom_first_param' => __('Someone', 'notificationx'),
213 'second_param' => __('commented on', 'notificationx'),
214 'third_param' => 'tag_post_comment',
215 'custom_third_param' => __('Anonymous Post', 'notificationx'),
216 'fourth_param' => 'tag_time',
217 'custom_fourth_param' => __('Some time ago', 'notificationx'),
218 ],
219 'rules' => Rules::is('gdpr_theme', true),
220 ],
221 ];
222 }
223
224 /**
225 * Hooked to nx_before_metabox_load action.
226 *
227 * @return void
228 */
229 public function init_fields() {
230 parent::init_fields();
231 add_filter('nx_content_gdpr', [$this, 'add_content_fields'], 9);
232 add_filter('nx_content_fields', [$this, '__add_content_fields'], 9);
233 add_filter('nx_customize_fields', array($this, 'customize_fields'), 999);
234 }
235
236 public function customize_fields( $fields ) {
237 $fields[] = [
238 'label' => __("Visibility", 'notificationx'),
239 'name' => "visibility",
240 'type' => "section",
241 'rules' => Rules::is('type', 'gdpr'),
242 'priority'=> 10,
243 'fields' => [
244 [
245 'label' => __("Show On", 'notificationx'),
246 'name' => "cookie_visibility_show_on",
247 'type' => "select",
248 'default' => 'default',
249 'options' => [
250 'default' => [
251 'label' => __('Show Everywhere', 'notificationx'),
252 'value' => 'default',
253 'selected' => 'selected',
254 ],
255 ]
256 ],
257 [
258 'label' => __("Display For", 'notificationx'),
259 'name' => "cookie_visibility_display_for",
260 'type' => "select",
261 'default' => 'default',
262 'options' => [
263 'default' => [
264 'label' => __('Everyone', 'notificationx'),
265 'value' => 'default',
266 'selected' => 'selected',
267 ],
268 ]
269 ],
270 [
271 'label' => __("Delay Before Appearance", 'notificationx'),
272 'name' => "cookie_visibility_delay_before",
273 'type' => "text",
274 'default' => 5,
275 'description' => __("Seconds", "notificationx"),
276 'help' => __("Initial Delay", "notificationx"),
277 ],
278 ]
279 ];
280
281 return $fields;
282 }
283
284 public function __add_content_fields( $fields ) {
285 $_fields = &$fields;
286 $_fields['preference_center'] = [
287 'name' => "preference_center",
288 'type' => "section",
289 'priority' => 98,
290 'label' => 'Preference Center',
291 'rules' => Rules::is('type', 'gdpr'),
292 'fields' => [
293 [
294 'label' => __("Title", 'notificationx'),
295 'name' => "preference_title",
296 'type' => "text",
297 'placeholder' => __("Title", 'notificationx'),
298 'default' => __("Customized Cookie Preferences", 'notificationx'),
299 ],
300 [
301 'label' => __("Privacy Overview", 'notificationx'),
302 'name' => "preference_overview",
303 'type' => "textarea",
304 'placeholder' => __("Privacy Overview", 'notificationx'),
305 'default' => __("We use cookies and similar technologies to enhance your experience and analyze site usage. Manage your preferences to control which data is collected.", 'notificationx'),
306 ],
307 [
308 'label' => __("Show Google Privacy Policy", 'notificationx'),
309 'name' => "preference_google",
310 'type' => "toggle",
311 'default' => false,
312 'info' => __("If you use services offered by Google, such as AdSense, Firebase, and Analytics on your website, the Digital Markets Act (DMA) requires you to display Google's Privacy Policy on the second layer of your banner.", 'notificationx'),
313 ],
314 [
315 'label' => __("Message", 'notificationx'),
316 'name' => "preference_google_message",
317 'type' => "textarea",
318 'placeholder' => __("Message", 'notificationx'),
319 'default' => __("To learn more about how Google's third-party cookies function and manage your data, read from here.", 'notificationx'),
320 'rules' => Rules::logicalRule([
321 Rules::is('preference_google', true),
322 ]),
323 ],
324 [
325 'label' => __("Link text", 'notificationx'),
326 'name' => "preference_google_Link_text",
327 'type' => "text",
328 'default' => __("Google Privacy Policy", 'notificationx'),
329 'placeholder' => __("Google Privacy Policy", 'notificationx'),
330 'rules' => Rules::logicalRule([
331 Rules::is('preference_google', true),
332 ]),
333 ],
334 [
335 'label' => __("URL", 'notificationx'),
336 'name' => "preference_google_Link_url",
337 'type' => "text",
338 'placeholder' => __("Google Privacy Policy URL", 'notificationx'),
339 'default' => 'https://business.safety.google/privacy',
340 'rules' => Rules::logicalRule([
341 Rules::is('preference_google', true),
342 ]),
343 ],
344 [
345 'label' => __("Save My Preferences Button", 'notificationx'),
346 'name' => "preference_btn",
347 'type' => "text",
348 'default' => __("Save My Preferences", 'notificationx'),
349 'placeholder' => __("Button text", 'notificationx'),
350 ],
351 [
352 'label' => __("See more Button", 'notificationx'),
353 'name' => "preference_more_btn",
354 'type' => "text",
355 'default' => __("See more", 'notificationx'),
356 'placeholder' => __("Button text", 'notificationx'),
357 ],
358 [
359 'label' => __("See less Button", 'notificationx'),
360 'name' => "preference_less_btn",
361 'type' => "text",
362 'default' => __("See less", 'notificationx'),
363 'placeholder' => __("Button text", 'notificationx'),
364 ],
365 ]
366 ];
367
368 $_fields['cookies_list'] = [
369 'name' => "cookies_list",
370 'type' => "section",
371 'priority' => 100,
372 'label' => 'Cookies List',
373 'rules' => Rules::is('type', 'gdpr'),
374 'fields' => [
375 [
376 'label' => __("Show Cookie List", 'notificationx'),
377 'name' => "cookie_list_show_banner",
378 'type' => "toggle",
379 'default' => true,
380 ],
381 [
382 'label' => __("Enabled Label", 'notificationx'),
383 'name' => "cookie_list_active_label",
384 'type' => "text",
385 'default' => __("Enabled", 'notificationx'),
386 'placeholder' => __("Label text", 'notificationx'),
387 ],
388 [
389 'label' => __("No Cookies Available Label", 'notificationx'),
390 'name' => "cookie_list_no_cookies_label",
391 'type' => "text",
392 'placeholder' => __("Label text", 'notificationx'),
393 'default' => __("No Cookies Available", 'notificationx'),
394 ],
395 ]
396 ];
397
398 return $fields;
399 }
400
401 public function add_content_fields( $fields ) {
402 $_fields = &$fields['fields'];
403 $_fields['gdpr_title'] = [
404 'label' => __('Title', 'notificationx'),
405 'name' => 'gdpr_title',
406 'type' => 'text',
407 'priority' => 101,
408 'default' => __('We value your privacy', 'notificationx'),
409 'placeholder' => __('Cookie Notice Title', 'notificationx'),
410 ];
411 $_fields['gdpr_message'] = [
412 'label' => __('Message', 'notificationx'),
413 'name' => 'gdpr_message',
414 'type' => 'textarea',
415 'priority' => 102,
416 'default' => __('We use cookies to improve your experience. By continuing to use our site, you agree to our use of cookies and data collection. You can learn more in our Privacy Policy and change your preferences anytime.', 'notificationx'),
417 'placeholder' => __('Message', 'notificationx'),
418 ];
419 $_fields['gdpr_accept_btn'] = [
420 'label' => __('Accept All Button', 'notificationx'),
421 'name' => 'gdpr_accept_btn',
422 'type' => 'text',
423 'priority' => 103,
424 'placeholder' => __('Button Text', 'notificationx'),
425 'default' => __('Accept All', 'notificationx'),
426 ];
427 $_fields['gdpr_reject_btn'] = [
428 'label' => __('Reject All Button', 'notificationx'),
429 'name' => 'gdpr_reject_btn',
430 'type' => 'text',
431 'priority' => 104,
432 'placeholder' => __('Button Text', 'notificationx'),
433 'default' => __('Reject All', 'notificationx'),
434 ];
435 $_fields['gdpr_customize_btn'] = [
436 'label' => __('Customize Button', 'notificationx'),
437 'name' => 'gdpr_customize_btn',
438 'type' => 'text',
439 'priority' => 105,
440 'placeholder' => __('Button Text', 'notificationx'),
441 'default' => __('Customize', 'notificationx'),
442 ];
443 $_fields['gdpr_cookies_policy_toggle'] = [
444 'label' => __('Cookies Policy Link', 'notificationx'),
445 'name' => 'gdpr_cookies_policy_toggle',
446 'type' => 'toggle',
447 'priority' => 106,
448 'default' => true,
449 ];
450 $_fields['gdpr_cookies_policy_link_text'] = [
451 'label' => __('Cookies Policy Link Text', 'notificationx'),
452 'name' => 'gdpr_cookies_policy_link_text',
453 'type' => 'text',
454 'priority' => 107,
455 'placeholder' => __('Link Text', 'notificationx'),
456 'default' => __('Cookies Policy', 'notificationx'),
457 'rules' => Rules::logicalRule([
458 Rules::is('gdpr_cookies_policy_toggle', true),
459 ]),
460 ];
461 $_fields['gdpr_cookies_policy_link_url'] = [
462 'label' => __('Cookies Policy URL', 'notificationx'),
463 'name' => 'gdpr_cookies_policy_link_url',
464 'type' => 'text',
465 'priority' => 108,
466 'placeholder' => __('Cookies Policy URL', 'notificationx'),
467 'rules' => Rules::logicalRule([
468 Rules::is('gdpr_cookies_policy_toggle', true),
469 ]),
470 ];
471 $_fields['gdpr_custom_logo'] = [
472 'label' => __('Custom Logo', 'notificationx'),
473 'name' => 'gdpr_custom_logo',
474 'type' => 'media',
475 'priority' => 109,
476 'is_pro' => true,
477 'default' => [
478 'url' => 'https://notificationx.com/wp-content/uploads/2025/01/cookie-image.png',
479 ],
480 'info' => InfoTooltipManager::get_instance()->render('advanced_template'),
481 'rules' => Rules::logicalRule([
482 Rules::is('themes', 'gdpr_theme-banner-light-one', true),
483 Rules::is('themes', 'gdpr_theme-light-one', true),
484 Rules::is('themes', 'gdpr_theme-light-two', true),
485 Rules::is('themes', 'gdpr_theme-banner-dark-one', true),
486 Rules::is('themes', 'gdpr_theme-dark-one', true),
487 Rules::is('themes', 'gdpr_theme-dark-two', true),
488 ]),
489 ];
490 return $fields;
491 }
492
493
494 }
495