Version Description
- Fix: Removed extract() function from the shortcodes module to improve security.
Download this release
Release Info
Developer | webtoffee |
Plugin | Cookie Law / GDPR Info |
Version | 2.0.6 |
Comparing to | |
See all releases |
Code changes from version 2.0.5 to 2.0.6
admin/modules/cookie-scaner/cookie-scaner.php
CHANGED
@@ -902,7 +902,7 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
902 |
/**
|
903 |
* Return the identified cookies after the scanning
|
904 |
*
|
905 |
-
* @param
|
906 |
* @param integer $offset offset number.
|
907 |
* @param integer $limit page limit if pagination is used.
|
908 |
* @return array
|
@@ -1120,7 +1120,7 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
1120 |
*/
|
1121 |
public function validate_scan_instance( $instance ) {
|
1122 |
$last_instance = $this->get_ckyes_scan_instance();
|
1123 |
-
if ( ( 0 !== $instance ) && ( $instance === $last_instance ) ) {
|
1124 |
return true;
|
1125 |
}
|
1126 |
return false;
|
902 |
/**
|
903 |
* Return the identified cookies after the scanning
|
904 |
*
|
905 |
+
* @param integer $scan_id scan ID.
|
906 |
* @param integer $offset offset number.
|
907 |
* @param integer $limit page limit if pagination is used.
|
908 |
* @return array
|
1120 |
*/
|
1121 |
public function validate_scan_instance( $instance ) {
|
1122 |
$last_instance = $this->get_ckyes_scan_instance();
|
1123 |
+
if ( ( 0 !== $instance ) && !empty( $instance ) && ( $instance === $last_instance ) ) {
|
1124 |
return true;
|
1125 |
}
|
1126 |
return false;
|
cookie-law-info.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
* Plugin Name: GDPR Cookie Consent
|
17 |
* Plugin URI: https://www.webtoffee.com/product/gdpr-cookie-consent/
|
18 |
* Description: A simple way to show your website complies with the EU Cookie Law / GDPR.
|
19 |
-
* Version: 2.0.
|
20 |
* Author: WebToffee
|
21 |
* Author URI: https://www.webtoffee.com/
|
22 |
* License: GPLv3
|
@@ -69,7 +69,7 @@ define ( 'CLI_ACTIVATION_ID','wtgdprcookieconsent');
|
|
69 |
* Currently plugin version.
|
70 |
* Rename this for your plugin and update it as you release new versions.
|
71 |
*/
|
72 |
-
define( 'CLI_VERSION', '2.0.
|
73 |
|
74 |
function wt_cookie_law_info_update_message( $data, $response )
|
75 |
{
|
16 |
* Plugin Name: GDPR Cookie Consent
|
17 |
* Plugin URI: https://www.webtoffee.com/product/gdpr-cookie-consent/
|
18 |
* Description: A simple way to show your website complies with the EU Cookie Law / GDPR.
|
19 |
+
* Version: 2.0.6
|
20 |
* Author: WebToffee
|
21 |
* Author URI: https://www.webtoffee.com/
|
22 |
* License: GPLv3
|
69 |
* Currently plugin version.
|
70 |
* Rename this for your plugin and update it as you release new versions.
|
71 |
*/
|
72 |
+
define( 'CLI_VERSION', '2.0.6' );
|
73 |
|
74 |
function wt_cookie_law_info_update_message( $data, $response )
|
75 |
{
|
includes/class-cookie-law-info.php
CHANGED
@@ -78,7 +78,7 @@ class Cookie_Law_Info {
|
|
78 |
}
|
79 |
else
|
80 |
{
|
81 |
-
$this->version = '2.0.
|
82 |
}
|
83 |
$this->plugin_name = 'cookie-law-info';
|
84 |
|
78 |
}
|
79 |
else
|
80 |
{
|
81 |
+
$this->version = '2.0.6';
|
82 |
}
|
83 |
$this->plugin_name = 'cookie-law-info';
|
84 |
|
public/modules/script-blocker/script-blocker.php
CHANGED
@@ -72,8 +72,6 @@ if (!class_exists('Cookie_Law_Info_Script_Blocker')) {
|
|
72 |
add_action( 'wt_cli_after_advanced_settings', array( $this, 'add_blocking_control'));
|
73 |
add_action( 'wt_cli_ajax_settings_update', array( $this, 'update_js_blocking_status'),10,1);
|
74 |
|
75 |
-
// add_action('admin_notices', array( $this, 'wt_cli_admin_notices' ),10);
|
76 |
-
// add_action('admin_init', array($this,'save_notice_link'));
|
77 |
|
78 |
// @since 1.9.6 for changing the category of each script blocker
|
79 |
add_action('wp_ajax_cli_change_script_category', array($this, 'cli_change_script_category'));
|
@@ -646,42 +644,7 @@ if (!class_exists('Cookie_Law_Info_Script_Blocker')) {
|
|
646 |
}
|
647 |
return $script;
|
648 |
}
|
649 |
-
/**
|
650 |
-
* Display admin notice for script blocker warning
|
651 |
-
*
|
652 |
-
* @version 1.9.6
|
653 |
-
* @since 1.9.6
|
654 |
-
*/
|
655 |
-
public function wt_cli_admin_notices() {
|
656 |
|
657 |
-
if( $this-> show_admin_notice_warning() === false ) {
|
658 |
-
return false;
|
659 |
-
}
|
660 |
-
$dismiss_url = add_query_arg( array( 'wt-cli-dismiss-notice' => 'true' ) );
|
661 |
-
|
662 |
-
echo '<div class="notice notice-warning wt-cli-script-blocker-notices" style="padding-right: 15px; display: flex; align-items: center; margin-left: 0;background: #fff8e5; border-color: #ffb900;">
|
663 |
-
<p><span style="font-weight:bold;display:inline-block;margin-bottom:4px;">'.__('GDPR Cookie Consent','cookie-law-info').'</span></br>'.__('The script blocker within the plugin will block the pre-defined plugins such as Instagram, Facebook, Twitter etc. Hence activating our plugin may affect its web layout. Therefore you may want to review the website w.r.t the blocked plugins. <a href="edit.php?post_type='.CLI_POST_TYPE.'&page=cli-script-settings">view script blocker.</a>', 'cookie-law-info' ).'</p>
|
664 |
-
<a href="' . $dismiss_url . '" class="notice-dismiss" style="position: relative; text-decoration: none;"></a>
|
665 |
-
</div>';
|
666 |
-
}
|
667 |
-
public function save_notice_link() {
|
668 |
-
if( isset( $_GET['wt-cli-dismiss-notice'] ) && $_GET['wt-cli-dismiss-notice'] == 'true') {
|
669 |
-
delete_transient( 'wt_cli_script_blocker_notice' );
|
670 |
-
}
|
671 |
-
}
|
672 |
-
public function show_admin_notice_warning() {
|
673 |
-
|
674 |
-
$screen = get_current_screen();
|
675 |
-
if ( isset( $screen->id ) && in_array( $screen->id, array( 'plugins', 'cookielawinfo_page_cookie-law-info', 'cookielawinfo_page_cli-script-settings' ) ) )
|
676 |
-
{
|
677 |
-
$option = get_transient( 'wt_cli_script_blocker_notice');;
|
678 |
-
if( $option ) {
|
679 |
-
return true;
|
680 |
-
}
|
681 |
-
}
|
682 |
-
return false;
|
683 |
-
|
684 |
-
}
|
685 |
/* change category of item on list page (ajax) */
|
686 |
public function cli_change_script_category()
|
687 |
{
|
72 |
add_action( 'wt_cli_after_advanced_settings', array( $this, 'add_blocking_control'));
|
73 |
add_action( 'wt_cli_ajax_settings_update', array( $this, 'update_js_blocking_status'),10,1);
|
74 |
|
|
|
|
|
75 |
|
76 |
// @since 1.9.6 for changing the category of each script blocker
|
77 |
add_action('wp_ajax_cli_change_script_category', array($this, 'cli_change_script_category'));
|
644 |
}
|
645 |
return $script;
|
646 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
647 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
648 |
/* change category of item on list page (ajax) */
|
649 |
public function cli_change_script_category()
|
650 |
{
|
public/modules/shortcode/shortcode.php
CHANGED
@@ -1,277 +1,260 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
3 |
if ( ! defined( 'WPINC' ) ) {
|
4 |
die;
|
5 |
}
|
6 |
/*
|
7 |
-
|
8 |
|
9 |
-
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
*/
|
25 |
class Cookie_Law_Info_Shortcode {
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
public function __construct($parent_obj)
|
38 |
-
|
39 |
-
$this->
|
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 |
-
}else
|
231 |
-
{
|
232 |
-
$term=get_term_by('slug',$category,'cookielawinfo-category');
|
233 |
-
}
|
234 |
-
if($term) //corresponding term available with the provided slug
|
235 |
-
{
|
236 |
-
$args['tax_query'][]=array(
|
237 |
-
'taxonomy' => 'cookielawinfo-category',
|
238 |
-
'terms' =>$term->term_id,
|
239 |
-
'include_children' => false
|
240 |
-
);
|
241 |
-
$posts = get_posts($args); //only return posts if term available
|
242 |
-
}
|
243 |
-
}else
|
244 |
-
{
|
245 |
-
$posts = get_posts($args);
|
246 |
-
}
|
247 |
-
$ret = '<table class="cookielawinfo-row-cat-table cookielawinfo-' . $style . '"><thead><tr>';
|
248 |
-
if(in_array('cookie',$columns))
|
249 |
-
{
|
250 |
-
$ret .= '<th class="cookielawinfo-column-1">'.__('Cookie', 'cookie-law-info').'</th>';
|
251 |
-
}
|
252 |
-
if(in_array('type',$columns))
|
253 |
-
{
|
254 |
-
$ret .= '<th class="cookielawinfo-column-2">'.__('Type', 'cookie-law-info').'</th>';
|
255 |
-
}
|
256 |
-
if(in_array('duration',$columns))
|
257 |
-
{
|
258 |
-
$ret .= '<th class="cookielawinfo-column-3">'.__('Duration', 'cookie-law-info').'</th>';
|
259 |
-
}
|
260 |
-
if(in_array('description',$columns))
|
261 |
-
{
|
262 |
-
$ret .= '<th class="cookielawinfo-column-4">'.__('Description', 'cookie-law-info').'</th>';
|
263 |
-
}
|
264 |
-
$ret = apply_filters('cli_new_columns_to_audit_table',$ret);
|
265 |
-
$ret .= '</tr>';
|
266 |
-
$ret .= '</thead><tbody>';
|
267 |
-
|
268 |
-
if(!$posts)
|
269 |
-
{
|
270 |
-
$ret .= '<tr class="cookielawinfo-row"><td colspan="4" class="cookielawinfo-column-empty">' . $not_shown_message . '</td></tr>';
|
271 |
-
}
|
272 |
-
|
273 |
-
// Get custom fields:
|
274 |
-
if ( $posts ) {
|
275 |
foreach ( $posts as $post ) {
|
276 |
$custom = get_post_custom( $post->ID );
|
277 |
$cookie_type = ( isset( $custom['_cli_cookie_type'][0] ) ) ? esc_html( sanitize_text_field( $custom['_cli_cookie_type'][0] ) ) : '';
|
@@ -281,10 +264,10 @@ class Cookie_Law_Info_Shortcode {
|
|
281 |
$ret .= '<td class="cookielawinfo-column-1">' . esc_html( sanitize_text_field( $post->post_title ) ) . '</td>';
|
282 |
}
|
283 |
if ( in_array( 'type', $columns ) ) {
|
284 |
-
$ret .= '<td class="cookielawinfo-column-2">' . $cookie_type . '</td>';
|
285 |
}
|
286 |
if ( in_array( 'duration', $columns ) ) {
|
287 |
-
$ret .= '<td class="cookielawinfo-column-3">' . $cookie_duration . '</td>';
|
288 |
}
|
289 |
if ( in_array( 'description', $columns ) ) {
|
290 |
$ret .= '<td class="cookielawinfo-column-4">' . wp_kses_post( $post->post_content ). '</td>';
|
@@ -293,303 +276,289 @@ class Cookie_Law_Info_Shortcode {
|
|
293 |
$ret .= '</tr>';
|
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 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
$class = '';
|
581 |
-
if ( $settings['button_7_as_button'] ) {
|
582 |
-
$class = ' class="wt-cli-element' . ' ' . $settings['button_7_button_size'] . ' cli-plugin-button wt-cli-accept-all-btn cookie_action_close_header cli_action_button"';
|
583 |
-
} else {
|
584 |
-
$class = ' class="wt-cli-element cli-plugin-main-button wt-cli-accept-all-btn cookie_action_close_header cli_action_button" ';
|
585 |
-
}
|
586 |
-
$url = ( $settings['button_7_action'] == 'CONSTANT_OPEN_URL' && $settings['button_7_url'] != '#' ) ? "href='$settings[button_7_url]'" : "role='button'";
|
587 |
-
|
588 |
-
$link_tag = '<a id="wt-cli-accept-all-btn" tabindex="0" ' . $url . ' data-cli_action="accept_all" ';
|
589 |
-
$link_tag .= ( $settings['button_7_new_win'] ) ? ' target="_blank" ' : '';
|
590 |
-
$link_tag .= $class . ' >' . stripslashes( $settings['button_7_text'] ) . '</a>';
|
591 |
-
return $link_tag;
|
592 |
-
}
|
593 |
-
|
594 |
}
|
595 |
-
new Cookie_Law_Info_Shortcode($this);
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* If this file is called directly, abort.
|
4 |
+
* */
|
5 |
if ( ! defined( 'WPINC' ) ) {
|
6 |
die;
|
7 |
}
|
8 |
/*
|
9 |
+
===============================================================================
|
10 |
|
11 |
+
Copyright 2018 @ WebToffee
|
12 |
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License, version 2, as
|
15 |
+
published by the Free Software Foundation.
|
16 |
|
17 |
+
This program is distributed in the hope that it will be useful,
|
18 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
+
GNU General Public License for more details.
|
21 |
|
22 |
+
You should have received a copy of the GNU General Public License
|
23 |
+
along with this program; if not, write to the Free Software
|
24 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
+
*/
|
|
|
26 |
class Cookie_Law_Info_Shortcode {
|
27 |
|
28 |
+
public $version;
|
29 |
+
|
30 |
+
public $parent_obj; // instance of the class that includes this class
|
31 |
+
|
32 |
+
public $plugin_obj;
|
33 |
+
|
34 |
+
public $plugin_name;
|
35 |
+
|
36 |
+
public $cookie_options;
|
37 |
+
|
38 |
+
public function __construct( $parent_obj ) {
|
39 |
+
$this->version = $parent_obj->version;
|
40 |
+
$this->parent_obj = $parent_obj;
|
41 |
+
$this->plugin_obj = $parent_obj->plugin_obj;
|
42 |
+
$this->plugin_name = $parent_obj->plugin_name;
|
43 |
+
// Shortcodes:
|
44 |
+
add_shortcode( 'delete_cookies', array( $this, 'cookielawinfo_delete_cookies_shortcode' ) ); // a shortcode [delete_cookies (text="Delete Cookies")]
|
45 |
+
add_shortcode( 'cookie_audit', array( $this, 'cookielawinfo_table_shortcode' ) ); // a shortcode [cookie_audit style="winter"]
|
46 |
+
add_shortcode( 'cookie_accept', array( $this, 'cookielawinfo_shortcode_accept_button' ) ); // a shortcode [cookie_accept (colour="red")]
|
47 |
+
add_shortcode( 'cookie_reject', array( $this, 'cookielawinfo_shortcode_reject_button' ) ); // a shortcode [cookie_reject (colour="red")]
|
48 |
+
add_shortcode( 'cookie_settings', array( $this, 'cookielawinfo_shortcode_settings_button' ) ); // a shortcode [cookie_settings]
|
49 |
+
add_shortcode( 'cookie_link', array( $this, 'cookielawinfo_shortcode_more_link' ) ); // a shortcode [cookie_link]
|
50 |
+
add_shortcode( 'cookie_button', array( $this, 'cookielawinfo_shortcode_main_button' ) ); // a shortcode [cookie_button]
|
51 |
+
add_shortcode( 'cookie_after_accept', array( $this, 'cookie_after_accept_shortcode' ) );
|
52 |
+
add_shortcode( 'user_consent_state', array( $this, 'user_consent_state_shortcode' ) );
|
53 |
+
add_shortcode( 'webtoffee_powered_by', array( $this, 'wf_powered_by' ) );
|
54 |
+
add_shortcode( 'cookie_close', array( $this, 'cookielawinfo_shortcode_close_button' ) ); // a shortcode [close_button]
|
55 |
+
add_shortcode( 'wt_cli_manage_consent', array( $this, 'manage_consent' ) );
|
56 |
+
add_shortcode( 'cookie_accept_all', array( $this, 'accept_all_button' ) ); // a shortcode [cookie_button]
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
/*
|
61 |
+
* Powered by WebToffe
|
62 |
+
* @since 1.7.4
|
63 |
+
*/
|
64 |
+
public function wf_powered_by() {
|
65 |
+
return '<p class="powered_by_p" style="width:100% !important; display:block !important; color:#333; clear:both; font-style:italic !important; font-size:12px !important; margin-top:15px !important;">Powered By <a href="https://www.webtoffee.com/" class="powered_by_a" style="color:#333; font-weight:600 !important; font-size:12px !important;">WebToffee</a></p>';
|
66 |
+
}
|
67 |
|
68 |
+
/*
|
69 |
+
* User can manage his current consent. This function is used in [user_consent_state] shortcode
|
70 |
+
* @since 1.7.4
|
71 |
+
*/
|
72 |
+
public function manage_user_consent_jsblock() {
|
73 |
+
?>
|
74 |
+
<script type="text/javascript">
|
75 |
+
jQuery(document).ready(function(){
|
76 |
+
jQuery('.cli_manage_current_consent').click(function(){
|
77 |
+
jQuery('#cookie-law-info-again').click();
|
78 |
+
setTimeout(function(){
|
79 |
+
if( jQuery('#cookie-law-info-bar').length > 0) {
|
80 |
+
jQuery(window).scrollTop(jQuery('#cookie-law-info-bar').offset().top);
|
81 |
+
}
|
82 |
+
},1000);
|
83 |
+
});
|
84 |
+
});
|
85 |
+
</script>
|
86 |
+
<?php
|
87 |
}
|
88 |
|
89 |
+
/*
|
90 |
+
* Show current user's consent state
|
91 |
+
* @since 1.7.4
|
92 |
+
*/
|
93 |
+
public function user_consent_state_shortcode( $atts = array() ) {
|
94 |
+
add_action( 'wp_footer', array( $this, 'manage_user_consent_jsblock' ), 15 );
|
95 |
+
|
96 |
+
$html = '<div class="cli_user_consent_state">' . __( 'Your current state:', 'cookie-law-info' );
|
97 |
+
if ( isset( $_COOKIE['viewed_cookie_policy'] ) ) {
|
98 |
+
if ( $_COOKIE['viewed_cookie_policy'] == 'yes' ) {
|
99 |
+
$html .= ' ' . __( 'Consent accepted.', 'cookie-law-info' );
|
100 |
+
} else {
|
101 |
+
$html .= ' ' . __( 'Consent rejected.', 'cookie-law-info' );
|
102 |
+
}
|
103 |
+
} else // no conset given
|
104 |
+
{
|
105 |
+
$html .= ' ' . __( 'No consent given.', 'cookie-law-info' );
|
106 |
+
}
|
107 |
+
$html .= ' <a class="cli_manage_current_consent" style="cursor:pointer;">' . __( 'Manage your consent.', 'cookie-law-info' ) . '</a> </div>';
|
108 |
+
return $html;
|
109 |
+
}
|
110 |
+
|
111 |
+
/*
|
112 |
+
* Add content after accepting the cookie notice.
|
113 |
+
* Usage :
|
114 |
+
* Inside post editor
|
115 |
+
* [cookie_after_accept] ...Your content goes here... [/cookie_after_accept]
|
116 |
+
* Inside template
|
117 |
+
* <?php echo do_shortcode('...shortcode goes here...'); ?>
|
118 |
+
*/
|
119 |
+
public function cookie_after_accept_shortcode( $atts = array(), $content = '' ) {
|
120 |
+
if ( isset( $_COOKIE['viewed_cookie_policy'] ) && $_COOKIE['viewed_cookie_policy'] == 'yes' ) {
|
121 |
+
return $content;
|
122 |
+
} else {
|
123 |
+
return '';
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
|
128 |
+
/*
|
129 |
+
A shortcode that outputs a link which will delete the cookie used to track
|
130 |
+
whether or not a vistor has dismissed the header message (i.e. so it doesn't
|
131 |
+
keep on showing on all pages)
|
132 |
+
|
133 |
+
Usage: [delete_cookies]
|
134 |
+
[delete_cookies linktext="delete cookies"]
|
135 |
+
|
136 |
+
N.B. This shortcut does not block cookies, or delete any other cookies!
|
137 |
+
*/
|
138 |
+
public function cookielawinfo_delete_cookies_shortcode( $atts ) {
|
139 |
+
|
140 |
+
$atts = shortcode_atts(
|
141 |
+
array(
|
142 |
+
'text' => __( 'Delete Cookies', 'cookie-law-info' ),
|
143 |
+
),
|
144 |
+
$atts,
|
145 |
+
'delete_cookies'
|
146 |
+
);
|
147 |
+
return '<a href="" class="cookielawinfo-cookie-delete">' . esc_attr( $atts['text'] ) . '</a>';
|
148 |
+
}
|
149 |
+
|
150 |
+
|
151 |
+
/**
|
152 |
+
* A nice shortcode to output a table of cookies you have saved, output in ascending
|
153 |
+
* alphabetical order. If there are no cookie records found a single empty row is shown.
|
154 |
+
* You can customise the 'not shown' message (see commented code below)
|
155 |
+
* N.B. This only shows the information you entered on the "cookie" admin page, it
|
156 |
+
* does not necessarily mean you comply with the cookie law. It is up to you, or
|
157 |
+
* the website owner, to make sure you have conducted an appropriate cookie audit
|
158 |
+
* and are informing website visitors of the actual cookies that are being stored.
|
159 |
+
*
|
160 |
+
* Usage: [cookie_audit]
|
161 |
+
* [cookie_audit style="winter"]
|
162 |
+
* [cookie_audit not_shown_message="No records found"]
|
163 |
+
* [cookie_audit style="winter" not_shown_message="Not found"]
|
164 |
+
*
|
165 |
+
* Styles included: simple, classic, modern, rounded, elegant, winter.
|
166 |
+
* Default style applied: classic.
|
167 |
+
*
|
168 |
+
* *Additional styles: You can customise the CSS by editing the CSS file itself,
|
169 |
+
* included with plugin.
|
170 |
+
*/
|
171 |
+
public function cookielawinfo_table_shortcode( $atts ) {
|
172 |
+
|
173 |
+
/** RICHARDASHBY EDIT: only add CSS if table is being used */
|
174 |
+
wp_enqueue_style( $this->plugin_name . '-table' );
|
175 |
+
/** END EDIT */
|
176 |
+
$atts = shortcode_atts(
|
177 |
+
array(
|
178 |
+
'style' => 'classic',
|
179 |
+
'not_shown_message' => '',
|
180 |
+
'columns' => 'cookie,type,duration,description',
|
181 |
+
'heading' => '',
|
182 |
+
'category' => '',
|
183 |
+
),
|
184 |
+
$atts,
|
185 |
+
'cookie_audit'
|
186 |
+
);
|
187 |
+
$columns = array_filter( array_map( 'trim', explode( ',', $atts['columns'] ) ) );
|
188 |
+
$posts = array();
|
189 |
+
$args = array(
|
190 |
+
'post_type' => CLI_POST_TYPE,
|
191 |
+
/** 28/05/2013: Changing from 10 to 50 to allow longer tables of cookie data */
|
192 |
+
'posts_per_page' => 50,
|
193 |
+
'tax_query' => array(),
|
194 |
+
'order' => 'ASC',
|
195 |
+
'orderby' => 'title',
|
196 |
+
);
|
197 |
+
global $sitepress;
|
198 |
+
$is_wpml_enabled = false;
|
199 |
+
if ( function_exists( 'icl_object_id' ) && $sitepress ) {
|
200 |
+
$args['suppress_filters'] = false;
|
201 |
+
$is_wpml_enabled = true;
|
202 |
+
}
|
203 |
+
$category = isset( $atts['category'] ) ? $atts['category'] : '';
|
204 |
+
if ( isset( $category ) && $category != '' ) {
|
205 |
+
$wpml_default_lang = 'en';
|
206 |
+
$wpml_current_lang = 'en';
|
207 |
+
$term = false;
|
208 |
+
if ( $is_wpml_enabled ) {
|
209 |
+
$wpml_default_lang = $sitepress->get_default_language();
|
210 |
+
$wpml_current_lang = ICL_LANGUAGE_CODE;
|
211 |
+
if ( $wpml_default_lang != $wpml_current_lang ) {
|
212 |
+
$sitepress->switch_lang( $wpml_default_lang ); // switching to default lang
|
213 |
+
$term = get_term_by( 'slug', $category, 'cookielawinfo-category' ); // original term
|
214 |
+
$sitepress->switch_lang( $wpml_current_lang ); // revert back to current lang
|
215 |
+
if ( ! $term ) {
|
216 |
+
$term = get_term_by( 'slug', $category, 'cookielawinfo-category' ); // current lang term
|
217 |
+
}
|
218 |
+
} else {
|
219 |
+
$term = get_term_by( 'slug', $category, 'cookielawinfo-category' );
|
220 |
+
}
|
221 |
+
} else {
|
222 |
+
$term = get_term_by( 'slug', $category, 'cookielawinfo-category' );
|
223 |
+
}
|
224 |
+
if ( $term ) {
|
225 |
+
$args['tax_query'][] = array(
|
226 |
+
'taxonomy' => 'cookielawinfo-category',
|
227 |
+
'terms' => $term->term_id,
|
228 |
+
'include_children' => false,
|
229 |
+
);
|
230 |
+
$posts = get_posts( $args ); // only return posts if term available
|
231 |
+
}
|
232 |
+
} else {
|
233 |
+
$posts = get_posts( $args );
|
234 |
+
}
|
235 |
+
$ret = '<table class="cookielawinfo-row-cat-table cookielawinfo-' . esc_attr( $atts['style'] ) . '"><thead><tr>';
|
236 |
+
if ( in_array( 'cookie', $columns ) ) {
|
237 |
+
$ret .= '<th class="cookielawinfo-column-1">' . __( 'Cookie', 'cookie-law-info' ) . '</th>';
|
238 |
+
}
|
239 |
+
if ( in_array( 'type', $columns ) ) {
|
240 |
+
$ret .= '<th class="cookielawinfo-column-2">' . __( 'Type', 'cookie-law-info' ) . '</th>';
|
241 |
+
}
|
242 |
+
if ( in_array( 'duration', $columns ) ) {
|
243 |
+
$ret .= '<th class="cookielawinfo-column-3">' . __( 'Duration', 'cookie-law-info' ) . '</th>';
|
244 |
+
}
|
245 |
+
if ( in_array( 'description', $columns ) ) {
|
246 |
+
$ret .= '<th class="cookielawinfo-column-4">' . __( 'Description', 'cookie-law-info' ) . '</th>';
|
247 |
+
}
|
248 |
+
$ret = apply_filters( 'cli_new_columns_to_audit_table', $ret );
|
249 |
+
$ret .= '</tr>';
|
250 |
+
$ret .= '</thead><tbody>';
|
251 |
+
|
252 |
+
if ( ! $posts ) {
|
253 |
+
$ret .= '<tr class="cookielawinfo-row"><td colspan="4" class="cookielawinfo-column-empty">' . esc_html( $atts['not_shown_message'] ) . '</td></tr>';
|
254 |
+
}
|
255 |
+
|
256 |
+
// Get custom fields:
|
257 |
+
if ( $posts ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
foreach ( $posts as $post ) {
|
259 |
$custom = get_post_custom( $post->ID );
|
260 |
$cookie_type = ( isset( $custom['_cli_cookie_type'][0] ) ) ? esc_html( sanitize_text_field( $custom['_cli_cookie_type'][0] ) ) : '';
|
264 |
$ret .= '<td class="cookielawinfo-column-1">' . esc_html( sanitize_text_field( $post->post_title ) ) . '</td>';
|
265 |
}
|
266 |
if ( in_array( 'type', $columns ) ) {
|
267 |
+
$ret .= '<td class="cookielawinfo-column-2">' . esc_html( $cookie_type ) . '</td>';
|
268 |
}
|
269 |
if ( in_array( 'duration', $columns ) ) {
|
270 |
+
$ret .= '<td class="cookielawinfo-column-3">' . esc_html( $cookie_duration ) . '</td>';
|
271 |
}
|
272 |
if ( in_array( 'description', $columns ) ) {
|
273 |
$ret .= '<td class="cookielawinfo-column-4">' . wp_kses_post( $post->post_content ). '</td>';
|
276 |
$ret .= '</tr>';
|
277 |
}
|
278 |
}
|
279 |
+
$ret .= '</tbody></table>';
|
280 |
+
if ( count( $posts ) > 0 ) {
|
281 |
+
if ( $atts['heading'] != '' ) {
|
282 |
+
$ret = '<p>' . esc_html( __( $atts['heading'], 'cookie-law-info' ) ) . '</p>' . $ret;
|
283 |
+
}
|
284 |
+
}
|
285 |
+
if ( '' === $atts['not_shown_message'] && empty( $posts ) ) {
|
286 |
+
$ret = '';
|
287 |
+
}
|
288 |
+
return $ret;
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Returns HTML for a standard (green, medium sized) 'Accept' button
|
293 |
+
*/
|
294 |
+
public function cookielawinfo_shortcode_accept_button( $atts ) {
|
295 |
+
$atts = shortcode_atts(
|
296 |
+
array(
|
297 |
+
'colour' => 'green',
|
298 |
+
'margin' => '',
|
299 |
+
),
|
300 |
+
$atts,
|
301 |
+
'cookie_accept'
|
302 |
+
);
|
303 |
+
$defaults = Cookie_Law_Info::get_default_settings( 'button_1_text' );
|
304 |
+
$settings = wp_parse_args( Cookie_Law_Info::get_settings(), $defaults );
|
305 |
+
$button_1_text = __( $settings['button_1_text'], 'cookie-law-info' );
|
306 |
+
$margin_style = $atts['margin'] != '' ? ' style="margin:' . esc_attr( $atts['margin'] ) . ';" ' : '';
|
307 |
+
return '<a role="button" tabindex="0" class="cli_action_button cli-accept-button medium cli-plugin-button ' . esc_attr( $atts['colour'] ) . '" data-cli_action="accept"' . $margin_style . '>' . esc_html( stripslashes( $button_1_text ) ) . '</a>';
|
308 |
+
}
|
309 |
+
|
310 |
+
/** Returns HTML for a standard (green, medium sized) 'Reject' button */
|
311 |
+
public function cookielawinfo_shortcode_reject_button( $atts ) {
|
312 |
+
$atts = shortcode_atts(
|
313 |
+
array(
|
314 |
+
'margin' => '',
|
315 |
+
),
|
316 |
+
$atts,
|
317 |
+
'cookie_reject'
|
318 |
+
);
|
319 |
+
|
320 |
+
$margin_style = $atts['margin'] != '' ? ' style="margin:' . esc_attr( $atts['margin'] ) . ';" ' : '';
|
321 |
+
|
322 |
+
$defaults = Cookie_Law_Info::get_default_settings();
|
323 |
+
$settings = wp_parse_args( Cookie_Law_Info::get_settings(), $defaults );
|
324 |
+
|
325 |
+
$classr = '';
|
326 |
+
if ( $settings['button_3_as_button'] ) {
|
327 |
+
$classr = ' class="' . esc_attr( $settings['button_3_button_size'] ) . ' cli-plugin-button cli-plugin-main-button cookie_action_close_header_reject cli_action_button"';
|
328 |
+
} else {
|
329 |
+
$classr = ' class="cookie_action_close_header_reject cli_action_button" ';
|
330 |
+
}
|
331 |
+
$url_reject = ( $settings['button_3_action'] == 'CONSTANT_OPEN_URL' && $settings['button_3_url'] != '#' ) ? 'href="' . esc_url( $settings['button_3_url'] ) . '"' : "role='button' tabindex='0'";
|
332 |
+
$link_tag = '';
|
333 |
+
$link_tag .= '<a ' . $url_reject . ' id="' . esc_attr( Cookie_Law_Info_Public::cookielawinfo_remove_hash( $settings['button_3_action'] ) ) . '" ';
|
334 |
+
$link_tag .= ( $settings['button_3_new_win'] ) ? 'target="_blank" ' : '';
|
335 |
+
$link_tag .= $classr . ' data-cli_action="reject"' . $margin_style . '>' . esc_html( stripslashes( __( $settings['button_3_text'], 'cookie-law-info' ) ) ) . '</a>';
|
336 |
+
return $link_tag;
|
337 |
+
}
|
338 |
+
/*
|
339 |
+
* Cookie Settings Button Shortcode
|
340 |
+
* @since 1.7.7
|
341 |
+
*/
|
342 |
+
public function cookielawinfo_shortcode_settings_button( $atts ) {
|
343 |
+
$atts = shortcode_atts(
|
344 |
+
array(
|
345 |
+
'margin' => '',
|
346 |
+
),
|
347 |
+
$atts,
|
348 |
+
'cookie_settings'
|
349 |
+
);
|
350 |
+
$margin_style = $atts['margin'] != '' ? ' style="margin:' . esc_attr( $atts['margin'] ) . ';" ' : '';
|
351 |
+
$defaults = Cookie_Law_Info::get_default_settings();
|
352 |
+
$settings = wp_parse_args( Cookie_Law_Info::get_settings(), $defaults );
|
353 |
+
$settings['button_4_url'] = '#';
|
354 |
+
$settings['button_4_action'] = '#cookie_action_settings';
|
355 |
+
$settings['button_4_new_win'] = false;
|
356 |
+
$classr = '';
|
357 |
+
if ( $settings['button_4_as_button'] ) {
|
358 |
+
$classr = ' class="' . esc_attr( $settings['button_4_button_size'] ) . ' cli-plugin-button cli-plugin-main-button cli_settings_button"';
|
359 |
+
} else {
|
360 |
+
$classr = ' class="cli_settings_button"';
|
361 |
+
}
|
362 |
+
|
363 |
+
// adding custom style
|
364 |
+
$url_s = ( $settings['button_4_action'] == 'CONSTANT_OPEN_URL' && $settings['button_4_url'] != '#' ) ? 'href="' . esc_url( $settings['button_4_url'] ) . '"' : "role='button' tabindex='0'";
|
365 |
+
$link_tag = '';
|
366 |
+
$link_tag .= '<a ' . $url_s;
|
367 |
+
$link_tag .= ( $settings['button_4_new_win'] ) ? ' target="_blank" ' : '';
|
368 |
+
$link_tag .= $classr . '' . $margin_style . '>' . esc_html( stripslashes( $settings['button_4_text'] ) ) . '</a>';
|
369 |
+
return $link_tag;
|
370 |
+
}
|
371 |
+
/** Returns HTML for a generic button */
|
372 |
+
public function cookielawinfo_shortcode_more_link( $atts ) {
|
373 |
+
return $this->cookielawinfo_shortcode_button_DRY_code( 'button_2', $atts );
|
374 |
+
}
|
375 |
+
|
376 |
+
|
377 |
+
/** Returns HTML for a generic button */
|
378 |
+
public function cookielawinfo_shortcode_main_button( $atts ) {
|
379 |
+
$atts = shortcode_atts(
|
380 |
+
array(
|
381 |
+
'margin' => '',
|
382 |
+
),
|
383 |
+
$atts,
|
384 |
+
'cookie_button'
|
385 |
+
);
|
386 |
+
$margin_style = $atts['margin'] != '' ? ' margin:' . esc_attr( $atts['margin'] ) . '; ' : '';
|
387 |
+
|
388 |
+
$defaults = Cookie_Law_Info::get_default_settings();
|
389 |
+
$settings = wp_parse_args( Cookie_Law_Info::get_settings(), $defaults );
|
390 |
+
$class = '';
|
391 |
+
if ( $settings['button_1_as_button'] ) {
|
392 |
+
$class = ' class="' . esc_attr( $settings['button_1_button_size'] ) . ' cli-plugin-button cli-plugin-main-button cookie_action_close_header cli_action_button"';
|
393 |
+
} else {
|
394 |
+
$class = ' class="cli-plugin-main-button cookie_action_close_header cli_action_button" ';
|
395 |
+
}
|
396 |
+
|
397 |
+
// If is action not URL then don't use URL!
|
398 |
+
$url = ( $settings['button_1_action'] == 'CONSTANT_OPEN_URL' && $settings['button_1_url'] != '#' ) ? 'href="' . esc_url( $settings['button_1_url'] ) . '"' : "role='button' tabindex='0'";
|
399 |
+
$link_tag = '<a ' . $url . ' data-cli_action="accept" id="' . esc_attr( Cookie_Law_Info_Public::cookielawinfo_remove_hash( $settings['button_1_action'] ) ) . '" ';
|
400 |
+
$link_tag .= ( $settings['button_1_new_win'] ) ? 'target="_blank" ' : '';
|
401 |
+
$link_tag .= $class . ' style="display:inline-block; ' . $margin_style . '">' . esc_html( stripslashes( __( $settings['button_1_text'], 'cookie-law-info' ) ) ) . '</a>';
|
402 |
+
|
403 |
+
return $link_tag;
|
404 |
+
}
|
405 |
+
|
406 |
+
|
407 |
+
/** Returns HTML for a generic button */
|
408 |
+
public function cookielawinfo_shortcode_button_DRY_code( $name, $atts = array() ) {
|
409 |
+
$atts = shortcode_atts(
|
410 |
+
array(
|
411 |
+
'margin' => '',
|
412 |
+
),
|
413 |
+
$atts,
|
414 |
+
'cookie_link'
|
415 |
+
);
|
416 |
+
$margin_style = $atts['margin'] != '' ? ' margin:' . esc_attr( $atts['margin'] ) . '; ' : '';
|
417 |
+
|
418 |
+
$arr = Cookie_Law_Info::get_settings();
|
419 |
+
$settings = array();
|
420 |
+
$class_name = '';
|
421 |
+
|
422 |
+
if ( $name == 'button_1' ) {
|
423 |
+
$settings = array(
|
424 |
+
'button_x_text' => stripslashes( $arr['button_1_text'] ),
|
425 |
+
'button_x_url' => $arr['button_1_url'],
|
426 |
+
'button_x_action' => $arr['button_1_action'],
|
427 |
+
|
428 |
+
'button_x_link_colour' => $arr['button_1_link_colour'],
|
429 |
+
'button_x_new_win' => $arr['button_1_new_win'],
|
430 |
+
'button_x_as_button' => $arr['button_1_as_button'],
|
431 |
+
'button_x_button_colour' => $arr['button_1_button_colour'],
|
432 |
+
'button_x_button_size' => $arr['button_1_button_size'],
|
433 |
+
);
|
434 |
+
$class_name = 'cli-plugin-main-button';
|
435 |
+
} elseif ( $name == 'button_2' ) {
|
436 |
+
$settings = array(
|
437 |
+
'button_x_text' => stripslashes( $arr['button_2_text'] ),
|
438 |
+
'button_x_action' => $arr['button_2_action'],
|
439 |
+
|
440 |
+
'button_x_link_colour' => $arr['button_2_link_colour'],
|
441 |
+
'button_x_new_win' => $arr['button_2_new_win'],
|
442 |
+
'button_x_as_button' => $arr['button_2_as_button'],
|
443 |
+
'button_x_button_colour' => $arr['button_2_button_colour'],
|
444 |
+
'button_x_button_size' => $arr['button_2_button_size'],
|
445 |
+
);
|
446 |
+
$class_name = 'cli-plugin-main-link';
|
447 |
+
if ( $arr['button_2_url_type'] == 'url' ) {
|
448 |
+
$settings['button_x_url'] = $arr['button_2_url'];
|
449 |
+
|
450 |
+
/*
|
451 |
+
* @since 1.7.4
|
452 |
+
* Checks if user enabled minify bar in the current page
|
453 |
+
*/
|
454 |
+
if ( $arr['button_2_hidebar'] === true ) {
|
455 |
+
global $wp;
|
456 |
+
$current_url = home_url( add_query_arg( array(), $wp->request ) );
|
457 |
+
$btn2_url = $current_url[ strlen( $current_url ) - 1 ] == '/' ? substr( $current_url, 0, -1 ) : $current_url;
|
458 |
+
$btn2_url = $arr['button_2_url'][ strlen( $arr['button_2_url'] ) - 1 ] == '/' ? substr( $arr['button_2_url'], 0, -1 ) : $arr['button_2_url'];
|
459 |
+
if ( strpos( $btn2_url, $current_url ) !== false ) {
|
460 |
+
if ( $btn2_url != $current_url ) {
|
461 |
+
$qry_var_arr = explode( '?', $current_url );
|
462 |
+
$hash_var_arr = explode( '#', $current_url );
|
463 |
+
if ( $qry_var_arr[0] == $btn2_url || $hash_var_arr[0] == $btn2_url ) {
|
464 |
+
$class_name .= ' cli-minimize-bar';
|
465 |
+
}
|
466 |
+
} else {
|
467 |
+
$class_name .= ' cli-minimize-bar';
|
468 |
+
}
|
469 |
+
}
|
470 |
+
}
|
471 |
+
} else {
|
472 |
+
$privacy_page_exists = 0;
|
473 |
+
if ( $arr['button_2_page'] > 0 ) {
|
474 |
+
$privacy_policy_page = get_post( $arr['button_2_page'] );
|
475 |
+
if ( $privacy_policy_page instanceof WP_Post ) {
|
476 |
+
if ( $privacy_policy_page->post_status === 'publish' ) {
|
477 |
+
$privacy_page_exists = 1;
|
478 |
+
$settings['button_x_url'] = get_page_link( $privacy_policy_page );
|
479 |
+
|
480 |
+
/*
|
481 |
+
* @since 1.7.4
|
482 |
+
* Checks if user enabled minify bar in the current page
|
483 |
+
*/
|
484 |
+
if ( $arr['button_2_hidebar'] === true ) {
|
485 |
+
if ( is_page( $arr['button_2_page'] ) ) {
|
486 |
+
$class_name .= ' cli-minimize-bar';
|
487 |
+
}
|
488 |
+
}
|
489 |
+
}
|
490 |
+
}
|
491 |
+
}
|
492 |
+
if ( $privacy_page_exists == 0 ) {
|
493 |
+
return '';
|
494 |
+
}
|
495 |
+
}
|
496 |
+
}
|
497 |
+
|
498 |
+
$settings = apply_filters( 'wt_readmore_link_settings', $settings );
|
499 |
+
$class = '';
|
500 |
+
if ( $settings['button_x_as_button'] ) {
|
501 |
+
$class .= ' class="' . esc_attr( $settings['button_x_button_size'] ) . ' cli-plugin-button ' . esc_attr( $class_name ) . '"';
|
502 |
+
} else {
|
503 |
+
$class .= ' class="' . esc_attr( $class_name ) . '" ';
|
504 |
+
}
|
505 |
+
|
506 |
+
// If is action not URL then don't use URL!
|
507 |
+
$url = ( $settings['button_x_action'] == 'CONSTANT_OPEN_URL' && $settings['button_x_url'] != '#' ) ? 'href="' . esc_url( $settings['button_x_url'] ) . '"' : "role='button' tabindex='0'";
|
508 |
+
$link_tag = '<a ' . $url . ' id="' . esc_attr( Cookie_Law_Info_Public::cookielawinfo_remove_hash( $settings['button_x_action'] ) ) . '" ';
|
509 |
+
$link_tag .= ( $settings['button_x_new_win'] ) ? 'target="_blank" ' : '';
|
510 |
+
$link_tag .= $class . ' style="display:inline-block;' . $margin_style . '" >' . esc_html( $settings['button_x_text'] ) . '</a>';
|
511 |
+
return $link_tag;
|
512 |
+
}
|
513 |
+
/**
|
514 |
+
* Shortcode for adding close button
|
515 |
+
*
|
516 |
+
* @since 1.8.9
|
517 |
+
* @return string
|
518 |
+
*/
|
519 |
+
public function cookielawinfo_shortcode_close_button() {
|
520 |
+
$styles = '';
|
521 |
+
return '<a style="' . esc_attr( $styles ) . '" aria-label="' . __( 'Close the cookie bar', 'cookie-law-info' ) . '" data-cli_action="accept" class="wt-cli-element cli_cookie_close_button" title="' . __( 'Close and Accept', 'cookie-law-info' ) . '">×</a>';
|
522 |
+
}
|
523 |
+
/**
|
524 |
+
* Add a link that allows the user the revisit their consent
|
525 |
+
*
|
526 |
+
* @since 1.9.4
|
527 |
+
* @access public
|
528 |
+
* @return string
|
529 |
+
*/
|
530 |
+
public function manage_consent() {
|
531 |
+
if ( ! $this->cookie_options ) {
|
532 |
+
$this->cookie_options = Cookie_Law_Info::get_settings();
|
533 |
+
}
|
534 |
+
$manage_consent_link = '';
|
535 |
+
$manage_consent_text = ( isset( $this->cookie_options['showagain_text'] ) ? $this->cookie_options['showagain_text'] : '' );
|
536 |
+
$manage_consent_link = '<a href="javascript:void(0)" class="wt-cli-manage-consent-link">' . esc_html( $manage_consent_text ) . '</a>';
|
537 |
+
|
538 |
+
return $manage_consent_link;
|
539 |
+
}
|
540 |
+
/**
|
541 |
+
* Creates accept all button
|
542 |
+
*
|
543 |
+
* @return void
|
544 |
+
*/
|
545 |
+
public function accept_all_button() {
|
546 |
+
|
547 |
+
$defaults = Cookie_Law_Info::get_default_settings();
|
548 |
+
$settings = wp_parse_args( Cookie_Law_Info::get_settings(), $defaults );
|
549 |
+
$class = '';
|
550 |
+
if ( $settings['button_7_as_button'] ) {
|
551 |
+
$class = ' class="wt-cli-element' . ' ' . esc_attr( $settings['button_7_button_size'] ) . ' cli-plugin-button wt-cli-accept-all-btn cookie_action_close_header cli_action_button"';
|
552 |
+
} else {
|
553 |
+
$class = ' class="wt-cli-element cli-plugin-main-button wt-cli-accept-all-btn cookie_action_close_header cli_action_button" ';
|
554 |
+
}
|
555 |
+
$url = ( $settings['button_7_action'] == 'CONSTANT_OPEN_URL' && $settings['button_7_url'] != '#' ) ? 'href="' . esc_url( $settings['button_7_url'] ) . '"': "role='button'";
|
556 |
+
|
557 |
+
$link_tag = '<a id="wt-cli-accept-all-btn" tabindex="0" ' . $url . ' data-cli_action="accept_all" ';
|
558 |
+
$link_tag .= ( $settings['button_7_new_win'] ) ? ' target="_blank" ' : '';
|
559 |
+
$link_tag .= $class . ' >' . esc_html( stripslashes( $settings['button_7_text'] ) ) . '</a>';
|
560 |
+
return $link_tag;
|
561 |
+
}
|
562 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
}
|
564 |
+
new Cookie_Law_Info_Shortcode( $this );
|
public/views/cookie-law-info_popup_content.php
CHANGED
File without changes
|
readme.txt
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
=== CookieYes | GDPR Cookie Consent & Compliance Notice (CCPA Ready) ===
|
2 |
Contributors: webtoffee, cookieyesdev
|
3 |
Donate link: https://www.webtoffee.com/plugins/
|
4 |
-
Tags: GDPR, CCPA, cookie notice, DSGVO, RGPD, LGPD, PIPEDA, cookies , cookie law, cookie consent, Opt-in, cookie policy, privacy, compliance
|
5 |
Requires at least: 4.4.0
|
6 |
Tested up to: 5.8
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 2.0.
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
12 |
-
Easily set up cookie notice, cookie policy and get GDPR cookie compliance
|
13 |
|
14 |
GDPR CookieConsent' plugin is getting renamed as ‘CookieYes - GDPR Cookie Consent & Compliance Notice' plugin. WebToffee will continue to develop and maintain this plugin. In addition to the current features, we have integrated a free Automatic Cookie Scan service into the plugin. You need an account with CookieYes in order to use the scan service, but no worries, we will automatically create an account for you when you initiate the scan.
|
15 |
|
@@ -37,7 +37,9 @@ The plugin is one of the best WordPress GDPR compliance plugins as it comes with
|
|
37 |
|
38 |
- The plugin can be configured to have a CCPA 'Do Not Sell My Personal Information' control to the cookie notice.
|
39 |
|
40 |
-
- Assists in compliance
|
|
|
|
|
41 |
|
42 |
- Integrates seamlessly with Official Facebook Pixel, Smash Balloon Instagram Feed & Twitter Feed.
|
43 |
|
@@ -189,6 +191,10 @@ For every update of the plugin, you will be notified of the installed plugins pa
|
|
189 |
|
190 |
== Changelog ==
|
191 |
|
|
|
|
|
|
|
|
|
192 |
= 2.0.5 =
|
193 |
|
194 |
* Enhancement: Disable cookie bar on page builders.
|
@@ -524,7 +530,6 @@ For every update of the plugin, you will be notified of the installed plugins pa
|
|
524 |
|
525 |
== Upgrade Notice ==
|
526 |
|
527 |
-
= 2.0.
|
528 |
|
529 |
-
*
|
530 |
-
* Tested ok with Wordpress version 5.8
|
1 |
=== CookieYes | GDPR Cookie Consent & Compliance Notice (CCPA Ready) ===
|
2 |
Contributors: webtoffee, cookieyesdev
|
3 |
Donate link: https://www.webtoffee.com/plugins/
|
4 |
+
Tags: GDPR, CCPA, cookie notice, DSGVO, RGPD, LGPD, PIPEDA, POPIA, cookies , cookie law, cookie consent, Opt-in, cookie policy, privacy, compliance
|
5 |
Requires at least: 4.4.0
|
6 |
Tested up to: 5.8
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 2.0.6
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
12 |
+
Easily set up cookie notice, cookie policy and get GDPR cookie compliance. Supports GDPR (DSGVO, RGPD), LGPD, CCPA, CNIL, and POPIA.
|
13 |
|
14 |
GDPR CookieConsent' plugin is getting renamed as ‘CookieYes - GDPR Cookie Consent & Compliance Notice' plugin. WebToffee will continue to develop and maintain this plugin. In addition to the current features, we have integrated a free Automatic Cookie Scan service into the plugin. You need an account with CookieYes in order to use the scan service, but no worries, we will automatically create an account for you when you initiate the scan.
|
15 |
|
37 |
|
38 |
- The plugin can be configured to have a CCPA 'Do Not Sell My Personal Information' control to the cookie notice.
|
39 |
|
40 |
+
- Assists in compliance of CNIL - A french administrative regulatory body
|
41 |
+
|
42 |
+
- Helps in compliance with POPIA (Protection of Personal Information Act) - South Africa's data protection law
|
43 |
|
44 |
- Integrates seamlessly with Official Facebook Pixel, Smash Balloon Instagram Feed & Twitter Feed.
|
45 |
|
191 |
|
192 |
== Changelog ==
|
193 |
|
194 |
+
= 2.0.6 =
|
195 |
+
|
196 |
+
* Fix: Removed extract() function from the shortcodes module to improve security.
|
197 |
+
|
198 |
= 2.0.5 =
|
199 |
|
200 |
* Enhancement: Disable cookie bar on page builders.
|
530 |
|
531 |
== Upgrade Notice ==
|
532 |
|
533 |
+
= 2.0.6 =
|
534 |
|
535 |
+
* Fix: Removed extract() function from the shortcodes module to improve security.
|
|