Version Description
- Added: Italian translation (thanks to wocmultimedia)
- Added: wpml-config.xml file
- Added: filters on all content
- Fixed: x button colour set by button colour
- Updated: changed button and 'read more' elements' tabindex to 0
- Updated: x button now CSS to avoid missing Unicode character
Download this release
Release Info
Developer | Catapult_Themes |
Plugin | Cookie Consent |
Version | 2.1.0 |
Comparing to | |
See all releases |
Code changes from version 2.0.12 to 2.1.0
- admin/class-ctcc-admin.php +699 -696
- assets/css/admin-style.css +6 -0
- assets/css/style.css +72 -19
- public/class-ctcc-public.php +316 -295
- readme.txt +156 -147
- uk-cookie-consent.php +64 -62
admin/class-ctcc-admin.php
CHANGED
@@ -1,696 +1,699 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Cookie Consent admin class
|
4 |
-
*/
|
5 |
-
|
6 |
-
// Exit if accessed directly
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
-
exit;
|
9 |
-
}
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Plugin admin class
|
13 |
-
**/
|
14 |
-
if ( ! class_exists ( 'CTCC_Admin' ) ) {
|
15 |
-
|
16 |
-
class CTCC_Admin {
|
17 |
-
|
18 |
-
public function __construct() {
|
19 |
-
//
|
20 |
-
}
|
21 |
-
|
22 |
-
/*
|
23 |
-
* Initialize the class and start calling our hooks and filters
|
24 |
-
* @since 2.0.0
|
25 |
-
*/
|
26 |
-
public function init() {
|
27 |
-
|
28 |
-
add_action ( 'admin_menu', array ( $this, 'add_admin_menu' ) );
|
29 |
-
add_action ( 'admin_init', array ( $this, 'register_options_init' ) );
|
30 |
-
add_action ( 'admin_init', array ( $this, 'register_content_init' ) );
|
31 |
-
add_action ( 'admin_init', array ( $this, 'register_styles_init' ) );
|
32 |
-
add_action ( 'admin_enqueue_scripts', array ( $this, 'enqueue_scripts' ) );
|
33 |
-
add_action ( 'admin_footer', array ( $this, 'add_js' ) );
|
34 |
-
|
35 |
-
}
|
36 |
-
|
37 |
-
public function enqueue_scripts() {
|
38 |
-
wp_enqueue_style ( 'wp-color-picker' );
|
39 |
-
wp_enqueue_script ( 'wp-color-picker', false, array ( 'jquery' ) );
|
40 |
-
wp_enqueue_style ( 'ctcc-admin-style', CTCC_PLUGIN_URL . 'assets/css/admin-style.css' );
|
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 |
-
|
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 |
-
<option value='top-
|
529 |
-
<option value='bottom-
|
530 |
-
<option value='
|
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 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
$defaults = $this ->
|
640 |
-
update_option ( '
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
</div>
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Cookie Consent admin class
|
4 |
+
*/
|
5 |
+
|
6 |
+
// Exit if accessed directly
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
+
exit;
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Plugin admin class
|
13 |
+
**/
|
14 |
+
if ( ! class_exists ( 'CTCC_Admin' ) ) {
|
15 |
+
|
16 |
+
class CTCC_Admin {
|
17 |
+
|
18 |
+
public function __construct() {
|
19 |
+
//
|
20 |
+
}
|
21 |
+
|
22 |
+
/*
|
23 |
+
* Initialize the class and start calling our hooks and filters
|
24 |
+
* @since 2.0.0
|
25 |
+
*/
|
26 |
+
public function init() {
|
27 |
+
|
28 |
+
add_action ( 'admin_menu', array ( $this, 'add_admin_menu' ) );
|
29 |
+
add_action ( 'admin_init', array ( $this, 'register_options_init' ) );
|
30 |
+
add_action ( 'admin_init', array ( $this, 'register_content_init' ) );
|
31 |
+
add_action ( 'admin_init', array ( $this, 'register_styles_init' ) );
|
32 |
+
add_action ( 'admin_enqueue_scripts', array ( $this, 'enqueue_scripts' ) );
|
33 |
+
add_action ( 'admin_footer', array ( $this, 'add_js' ) );
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
public function enqueue_scripts() {
|
38 |
+
wp_enqueue_style ( 'wp-color-picker' );
|
39 |
+
wp_enqueue_script ( 'wp-color-picker', false, array ( 'jquery' ) );
|
40 |
+
wp_enqueue_style ( 'ctcc-admin-style', CTCC_PLUGIN_URL . 'assets/css/admin-style.css' );
|
41 |
+
}
|
42 |
+
|
43 |
+
public function add_js() {
|
44 |
+
$screen = get_current_screen();
|
45 |
+
if ( $screen -> id == 'settings_page_ctcc' ) {
|
46 |
+
?>
|
47 |
+
<script>
|
48 |
+
jQuery(document).ready(function($){
|
49 |
+
$('.cctc-color-field').wpColorPicker();
|
50 |
+
});
|
51 |
+
</script>
|
52 |
+
<?php }
|
53 |
+
}
|
54 |
+
|
55 |
+
// Add the menu item
|
56 |
+
public function add_admin_menu( ) {
|
57 |
+
add_options_page ( __('Cookie Consent', 'uk-cookie-consent'), __('Cookie Consent', 'uk-cookie-consent'), 'manage_options', 'ctcc', array ( $this, 'options_page' ) );
|
58 |
+
}
|
59 |
+
|
60 |
+
public function register_options_init( ) {
|
61 |
+
|
62 |
+
register_setting ( 'ctcc_options', 'ctcc_options_settings' );
|
63 |
+
|
64 |
+
add_settings_section (
|
65 |
+
'ctcc_options_section',
|
66 |
+
__( 'General settings', 'uk-cookie-consent' ),
|
67 |
+
array ( $this, 'settings_section_callback' ),
|
68 |
+
'ctcc_options'
|
69 |
+
);
|
70 |
+
|
71 |
+
add_settings_field (
|
72 |
+
'closure',
|
73 |
+
__( 'Close', 'uk-cookie-consent' ),
|
74 |
+
array ( $this, 'closure_render' ),
|
75 |
+
'ctcc_options',
|
76 |
+
'ctcc_options_section'
|
77 |
+
);
|
78 |
+
|
79 |
+
add_settings_field (
|
80 |
+
'first_page',
|
81 |
+
__( 'First Page Only', 'uk-cookie-consent' ),
|
82 |
+
array ( $this, 'first_page_render' ),
|
83 |
+
'ctcc_options',
|
84 |
+
'ctcc_options_section'
|
85 |
+
);
|
86 |
+
|
87 |
+
add_settings_field (
|
88 |
+
'duration',
|
89 |
+
__( 'Notification Duration', 'uk-cookie-consent' ),
|
90 |
+
array ( $this, 'duration_render' ),
|
91 |
+
'ctcc_options',
|
92 |
+
'ctcc_options_section'
|
93 |
+
);
|
94 |
+
|
95 |
+
add_settings_field (
|
96 |
+
'cookie_expiry',
|
97 |
+
__( 'Cookie Expiry', 'uk-cookie-consent' ),
|
98 |
+
array ( $this, 'cookie_expiry_render' ),
|
99 |
+
'ctcc_options',
|
100 |
+
'ctcc_options_section'
|
101 |
+
);
|
102 |
+
|
103 |
+
add_settings_field (
|
104 |
+
'cookie_version',
|
105 |
+
__( 'Cookie Version', 'uk-cookie-consent' ),
|
106 |
+
array ( $this, 'cookie_version_render' ),
|
107 |
+
'ctcc_options',
|
108 |
+
'ctcc_options_section'
|
109 |
+
);
|
110 |
+
|
111 |
+
// Set default options
|
112 |
+
$options = get_option ( 'ctcc_options_settings' );
|
113 |
+
if ( false === $options ) {
|
114 |
+
// Get defaults
|
115 |
+
$defaults = $this -> get_default_options_settings();
|
116 |
+
update_option ( 'ctcc_options_settings', $defaults );
|
117 |
+
}
|
118 |
+
|
119 |
+
}
|
120 |
+
|
121 |
+
public function register_content_init() {
|
122 |
+
|
123 |
+
register_setting ( 'ctcc_content', 'ctcc_content_settings' );
|
124 |
+
|
125 |
+
add_settings_section (
|
126 |
+
'ctcc_content_section',
|
127 |
+
__( 'Content settings', 'uk-cookie-consent' ),
|
128 |
+
array ( $this, 'content_settings_section_callback' ),
|
129 |
+
'ctcc_content'
|
130 |
+
);
|
131 |
+
|
132 |
+
add_settings_field (
|
133 |
+
'heading_text',
|
134 |
+
__( 'Heading Text', 'uk-cookie-consent' ),
|
135 |
+
array ( $this, 'heading_text_render' ),
|
136 |
+
'ctcc_content',
|
137 |
+
'ctcc_content_section'
|
138 |
+
);
|
139 |
+
|
140 |
+
add_settings_field (
|
141 |
+
'notification_text',
|
142 |
+
__( 'Notification Text', 'uk-cookie-consent' ),
|
143 |
+
array ( $this, 'notification_text_render' ),
|
144 |
+
'ctcc_content',
|
145 |
+
'ctcc_content_section'
|
146 |
+
);
|
147 |
+
|
148 |
+
add_settings_field (
|
149 |
+
'more_info_text',
|
150 |
+
__( 'More Info Text', 'uk-cookie-consent' ),
|
151 |
+
array ( $this, 'more_info_text_render' ),
|
152 |
+
'ctcc_content',
|
153 |
+
'ctcc_content_section'
|
154 |
+
);
|
155 |
+
|
156 |
+
add_settings_field (
|
157 |
+
'more_info_page',
|
158 |
+
__( 'More Info Page', 'uk-cookie-consent' ),
|
159 |
+
array ( $this, 'more_info_page_render' ),
|
160 |
+
'ctcc_content',
|
161 |
+
'ctcc_content_section'
|
162 |
+
);
|
163 |
+
|
164 |
+
add_settings_field (
|
165 |
+
'more_info_url',
|
166 |
+
__( 'More Info URL', 'uk-cookie-consent' ),
|
167 |
+
array ( $this, 'more_info_url_render' ),
|
168 |
+
'ctcc_content',
|
169 |
+
'ctcc_content_section'
|
170 |
+
);
|
171 |
+
|
172 |
+
add_settings_field (
|
173 |
+
'more_info_target',
|
174 |
+
__( 'More Info Target', 'uk-cookie-consent' ),
|
175 |
+
array ( $this, 'more_info_target_render' ),
|
176 |
+
'ctcc_content',
|
177 |
+
'ctcc_content_section'
|
178 |
+
);
|
179 |
+
|
180 |
+
add_settings_field (
|
181 |
+
'accept_text',
|
182 |
+
__( 'Accept Text', 'uk-cookie-consent' ),
|
183 |
+
array ( $this, 'accept_text_render' ),
|
184 |
+
'ctcc_content',
|
185 |
+
'ctcc_content_section'
|
186 |
+
);
|
187 |
+
|
188 |
+
// Set default options
|
189 |
+
$options = get_option ( 'ctcc_content_settings' );
|
190 |
+
if ( false === $options ) {
|
191 |
+
// Get defaults
|
192 |
+
$defaults = $this -> get_default_content_settings();
|
193 |
+
update_option ( 'ctcc_content_settings', $defaults );
|
194 |
+
}
|
195 |
+
|
196 |
+
}
|
197 |
+
|
198 |
+
public function register_styles_init( ) {
|
199 |
+
|
200 |
+
register_setting ( 'ctcc_styles', 'ctcc_styles_settings' );
|
201 |
+
|
202 |
+
add_settings_section (
|
203 |
+
'ctcc_styles_section',
|
204 |
+
__( 'Styles settings', 'uk-cookie-consent' ),
|
205 |
+
array ( $this, 'styles_settings_section_callback' ),
|
206 |
+
'ctcc_styles'
|
207 |
+
);
|
208 |
+
|
209 |
+
add_settings_field (
|
210 |
+
'position',
|
211 |
+
__( 'Position', 'uk-cookie-consent' ),
|
212 |
+
array ( $this, 'position_render' ),
|
213 |
+
'ctcc_styles',
|
214 |
+
'ctcc_styles_section'
|
215 |
+
);
|
216 |
+
|
217 |
+
add_settings_field (
|
218 |
+
'container_class',
|
219 |
+
__( 'Container Class', 'uk-cookie-consent' ),
|
220 |
+
array ( $this, 'container_class_render' ),
|
221 |
+
'ctcc_styles',
|
222 |
+
'ctcc_styles_section'
|
223 |
+
);
|
224 |
+
|
225 |
+
add_settings_field (
|
226 |
+
'enqueue_styles',
|
227 |
+
__( 'Include Stylesheet', 'uk-cookie-consent' ),
|
228 |
+
array ( $this, 'enqueue_styles_render' ),
|
229 |
+
'ctcc_styles',
|
230 |
+
'ctcc_styles_section'
|
231 |
+
);
|
232 |
+
|
233 |
+
add_settings_field (
|
234 |
+
'rounded_corners',
|
235 |
+
__( 'Rounded Corners', 'uk-cookie-consent' ),
|
236 |
+
array ( $this, 'rounded_corners_render' ),
|
237 |
+
'ctcc_styles',
|
238 |
+
'ctcc_styles_section'
|
239 |
+
);
|
240 |
+
|
241 |
+
add_settings_field (
|
242 |
+
'drop_shadow',
|
243 |
+
__( 'Drop Shadow', 'uk-cookie-consent' ),
|
244 |
+
array ( $this, 'drop_shadow_render' ),
|
245 |
+
'ctcc_styles',
|
246 |
+
'ctcc_styles_section'
|
247 |
+
);
|
248 |
+
|
249 |
+
add_settings_field (
|
250 |
+
'display_accept_with_text',
|
251 |
+
__( 'Display Button With Text', 'uk-cookie-consent' ),
|
252 |
+
array ( $this, 'display_accept_with_text_render' ),
|
253 |
+
'ctcc_styles',
|
254 |
+
'ctcc_styles_section'
|
255 |
+
);
|
256 |
+
|
257 |
+
add_settings_field (
|
258 |
+
'x_close',
|
259 |
+
__( 'Use X Close', 'uk-cookie-consent' ),
|
260 |
+
array ( $this, 'x_close_render' ),
|
261 |
+
'ctcc_styles',
|
262 |
+
'ctcc_styles_section'
|
263 |
+
);
|
264 |
+
|
265 |
+
add_settings_field (
|
266 |
+
'text_color',
|
267 |
+
__( 'Text Color', 'uk-cookie-consent' ),
|
268 |
+
array ( $this, 'text_color_render' ),
|
269 |
+
'ctcc_styles',
|
270 |
+
'ctcc_styles_section'
|
271 |
+
);
|
272 |
+
|
273 |
+
add_settings_field (
|
274 |
+
'bg_color',
|
275 |
+
__( 'Background Color', 'uk-cookie-consent' ),
|
276 |
+
array ( $this, 'bg_color_render' ),
|
277 |
+
'ctcc_styles',
|
278 |
+
'ctcc_styles_section'
|
279 |
+
);
|
280 |
+
|
281 |
+
add_settings_field (
|
282 |
+
'link_color',
|
283 |
+
__( 'Link Color', 'uk-cookie-consent' ),
|
284 |
+
array ( $this, 'link_color_render' ),
|
285 |
+
'ctcc_styles',
|
286 |
+
'ctcc_styles_section'
|
287 |
+
);
|
288 |
+
|
289 |
+
add_settings_field (
|
290 |
+
'button_color',
|
291 |
+
__( 'Button Color', 'uk-cookie-consent' ),
|
292 |
+
array ( $this, 'button_color_render' ),
|
293 |
+
'ctcc_styles',
|
294 |
+
'ctcc_styles_section'
|
295 |
+
);
|
296 |
+
|
297 |
+
add_settings_field (
|
298 |
+
'button_bg_color',
|
299 |
+
__( 'Button Background', 'uk-cookie-consent' ),
|
300 |
+
array ( $this, 'button_bg_color_render' ),
|
301 |
+
'ctcc_styles',
|
302 |
+
'ctcc_styles_section'
|
303 |
+
);
|
304 |
+
|
305 |
+
add_settings_field (
|
306 |
+
'bg_color',
|
307 |
+
__( 'Background Color', 'uk-cookie-consent' ),
|
308 |
+
array ( $this, 'bg_color_render' ),
|
309 |
+
'ctcc_styles',
|
310 |
+
'ctcc_styles_section'
|
311 |
+
);
|
312 |
+
|
313 |
+
add_settings_field (
|
314 |
+
'flat_button',
|
315 |
+
__( 'Flat Button', 'uk-cookie-consent' ),
|
316 |
+
array ( $this, 'flat_button_render' ),
|
317 |
+
'ctcc_styles',
|
318 |
+
'ctcc_styles_section'
|
319 |
+
);
|
320 |
+
|
321 |
+
// Set default options
|
322 |
+
$options = get_option ( 'ctcc_styles_settings' );
|
323 |
+
if ( false === $options ) {
|
324 |
+
// Get defaults
|
325 |
+
$defaults = $this -> get_default_styles_settings();
|
326 |
+
update_option ( 'ctcc_styles_settings', $defaults );
|
327 |
+
}
|
328 |
+
|
329 |
+
}
|
330 |
+
|
331 |
+
public function get_default_options_settings() {
|
332 |
+
$defaults = array (
|
333 |
+
'closure' => 'click',
|
334 |
+
'first_page' => 0,
|
335 |
+
'duration' => 60,
|
336 |
+
'cookie_expiry' => 30,
|
337 |
+
'cookie_version' => 1
|
338 |
+
);
|
339 |
+
return $defaults;
|
340 |
+
}
|
341 |
+
|
342 |
+
public function get_default_content_settings() {
|
343 |
+
|
344 |
+
$previous_settings = get_option ( 'catapult_cookie_options' );
|
345 |
+
// Check for settings from previous version
|
346 |
+
if ( ! empty ( $previous_settings ) ) {
|
347 |
+
$defaults = array (
|
348 |
+
'heading_text' => __( 'Cookies', 'uk-cookie-consent' ),
|
349 |
+
'notification_text' => $previous_settings['catapult_cookie_text_settings'],
|
350 |
+
'accept_text' => $previous_settings['catapult_cookie_accept_settings'],
|
351 |
+
'more_info_text' => $previous_settings['catapult_cookie_more_settings'],
|
352 |
+
'more_info_page' => '',
|
353 |
+
'more_info_url' => site_url ( $previous_settings['catapult_cookie_link_settings'] ),
|
354 |
+
'more_info_target' => '_blank',
|
355 |
+
);
|
356 |
+
} else {
|
357 |
+
$defaults = array (
|
358 |
+
'heading_text' => __( 'Cookies', 'uk-cookie-consent' ),
|
359 |
+
'notification_text' => __( 'This site uses cookies: ', 'uk-cookie-consent' ),
|
360 |
+
'accept_text' => __( 'Okay, thanks', 'uk-cookie-consent' ),
|
361 |
+
'more_info_text' => __( 'Find out more.', 'uk-cookie-consent' ),
|
362 |
+
'more_info_page' => get_option( 'ctcc_more_info_page', '' ),
|
363 |
+
'more_info_url' => '',
|
364 |
+
'more_info_target' => '_blank',
|
365 |
+
);
|
366 |
+
}
|
367 |
+
return $defaults;
|
368 |
+
|
369 |
+
}
|
370 |
+
|
371 |
+
public function get_default_styles_settings() {
|
372 |
+
$previous_settings = get_option ( 'catapult_cookie_options' );
|
373 |
+
$defaults = array (
|
374 |
+
'position' => 'top-bar',
|
375 |
+
'container_class' => '',
|
376 |
+
'enqueue_styles' => 1,
|
377 |
+
'rounded_corners' => 1,
|
378 |
+
'drop_shadow' => 1,
|
379 |
+
'display_accept_with_text' => 1,
|
380 |
+
'x_close' => 0,
|
381 |
+
'text_color' => '#ddd',
|
382 |
+
'bg_color' => '#464646',
|
383 |
+
'link_color' => '#fff',
|
384 |
+
'button_color' => '',
|
385 |
+
'button_bg_color' => '',
|
386 |
+
'flat_button' => 1,
|
387 |
+
);
|
388 |
+
// Check for settings from previous version
|
389 |
+
|
390 |
+
if ( ! empty ( $previous_settings['catapult_cookie_bar_position_settings'] ) ) {
|
391 |
+
$defaults['position'] = $previous_settings['catapult_cookie_bar_position_settings'] . '-bar';
|
392 |
+
}
|
393 |
+
|
394 |
+
if ( ! empty ( $previous_settings['catapult_cookie_text_colour_settings'] ) ) {
|
395 |
+
$defaults['text_color'] = $previous_settings['catapult_cookie_text_colour_settings'];
|
396 |
+
}
|
397 |
+
|
398 |
+
if ( ! empty ( $previous_settings['catapult_cookie_bg_colour_settings'] ) ) {
|
399 |
+
$defaults['bg_color'] = $previous_settings['catapult_cookie_bg_colour_settings'];
|
400 |
+
}
|
401 |
+
|
402 |
+
if ( ! empty ( $previous_settings['catapult_cookie_link_colour_settings'] ) ) {
|
403 |
+
$defaults['link_color'] = $previous_settings['catapult_cookie_link_colour_settings'];
|
404 |
+
}
|
405 |
+
|
406 |
+
if ( ! empty ( $previous_settings['catapult_cookie_link_colour_settings'] ) ) {
|
407 |
+
$defaults['link_color'] = $previous_settings['catapult_cookie_link_colour_settings'];
|
408 |
+
}
|
409 |
+
|
410 |
+
if ( ! empty ( $previous_settings['catapult_cookie_button_colour_settings'] ) ) {
|
411 |
+
$defaults['button_bg_color'] = $previous_settings['catapult_cookie_button_colour_settings'];
|
412 |
+
}
|
413 |
+
|
414 |
+
return $defaults;
|
415 |
+
|
416 |
+
}
|
417 |
+
|
418 |
+
public function closure_render() {
|
419 |
+
$options = get_option( 'ctcc_options_settings' ); ?>
|
420 |
+
<select name='ctcc_options_settings[closure]'>
|
421 |
+
<option value='click' <?php selected( $options['closure'], 'click' ); ?>><?php _e ( 'On Click', 'uk-cookie-consent' ); ?></option>
|
422 |
+
<option value='timed' <?php selected( $options['closure'], 'timed' ); ?>><?php _e ( 'Timed', 'uk-cookie-consent' ); ?></option>
|
423 |
+
</select>
|
424 |
+
<p class="description"><?php _e ( 'How you want the user to close the notification', 'uk-cookie-consent' ); ?></p>
|
425 |
+
<?php
|
426 |
+
}
|
427 |
+
|
428 |
+
public function first_page_render() {
|
429 |
+
$options = get_option( 'ctcc_options_settings' ); ?>
|
430 |
+
<input type='checkbox' name='ctcc_options_settings[first_page]' <?php checked ( ! empty ( $options['first_page'] ), 1 ); ?> value='1'>
|
431 |
+
<p class="description"><?php _e ( 'Select this to show the notification only on the first page the user visits', 'uk-cookie-consent' ); ?></p>
|
432 |
+
<?php
|
433 |
+
}
|
434 |
+
|
435 |
+
public function duration_render() {
|
436 |
+
$options = get_option( 'ctcc_options_settings' ); ?>
|
437 |
+
<input type="number" min="1" name="ctcc_options_settings[duration]" value="<?php echo $options['duration']; ?>">
|
438 |
+
<p class="description"><?php _e ( 'If you chose Timer as the close method, enter how many seconds the notification should display for', 'uk-cookie-consent' ); ?></p>
|
439 |
+
<?php
|
440 |
+
}
|
441 |
+
|
442 |
+
public function cookie_expiry_render() {
|
443 |
+
$options = get_option( 'ctcc_options_settings' ); ?>
|
444 |
+
<input type="number" min="1" name="ctcc_options_settings[cookie_expiry]" value="<?php echo $options['cookie_expiry']; ?>">
|
445 |
+
<p class="description"><?php _e ( 'The number of days that the cookie is set for', 'uk-cookie-consent' ); ?></p>
|
446 |
+
<?php
|
447 |
+
}
|
448 |
+
|
449 |
+
public function cookie_version_render() {
|
450 |
+
$options = get_option( 'ctcc_options_settings' ); ?>
|
451 |
+
<input type="text" name="ctcc_options_settings[cookie_version]" value="<?php echo $options['cookie_version']; ?>">
|
452 |
+
<p class="description"><?php _e ( 'A version number for the cookie - update this to invalidate the cookie and force all users to view the notification again', 'uk-cookie-consent' ); ?></p>
|
453 |
+
<?php
|
454 |
+
}
|
455 |
+
|
456 |
+
/*
|
457 |
+
* Content renders
|
458 |
+
*/
|
459 |
+
|
460 |
+
public function heading_text_render() {
|
461 |
+
$ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
|
462 |
+
<input type="text" name="ctcc_content_settings[heading_text]" value="<?php echo $ctcc_content_settings['heading_text']; ?>">
|
463 |
+
<p class="description"><?php _e ( 'The heading text - only applies if you are not using a top or bottom bar', 'uk-cookie-consent' ); ?></p>
|
464 |
+
<?php
|
465 |
+
}
|
466 |
+
|
467 |
+
public function notification_text_render() {
|
468 |
+
$ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
|
469 |
+
<input type="text" name="ctcc_content_settings[notification_text]" value="<?php echo $ctcc_content_settings['notification_text']; ?>">
|
470 |
+
<p class="description"><?php _e ( 'The default text to indicate that your site uses cookies', 'uk-cookie-consent' ); ?></p>
|
471 |
+
<?php
|
472 |
+
}
|
473 |
+
|
474 |
+
public function accept_text_render() {
|
475 |
+
$ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
|
476 |
+
<input type="text" name="ctcc_content_settings[accept_text]" value="<?php echo $ctcc_content_settings['accept_text']; ?>">
|
477 |
+
<p class="description"><?php _e ( 'The default text to dismiss the notification', 'uk-cookie-consent' ); ?></p>
|
478 |
+
<?php
|
479 |
+
}
|
480 |
+
|
481 |
+
public function more_info_text_render() {
|
482 |
+
$ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
|
483 |
+
<input type="text" name="ctcc_content_settings[more_info_text]" value="<?php echo $ctcc_content_settings['more_info_text']; ?>">
|
484 |
+
<p class="description"><?php _e ( 'The default text to use to link to a page providing further information', 'uk-cookie-consent' ); ?></p>
|
485 |
+
<?php
|
486 |
+
}
|
487 |
+
|
488 |
+
public function more_info_page_render() {
|
489 |
+
$ctcc_content_settings = get_option( 'ctcc_content_settings' );
|
490 |
+
// Get all pages
|
491 |
+
$pages = get_pages();
|
492 |
+
?>
|
493 |
+
<?php if ( $pages ) { ?>
|
494 |
+
<select name='ctcc_content_settings[more_info_page]'>
|
495 |
+
<option></option>
|
496 |
+
<?php foreach ( $pages as $page ) { ?>
|
497 |
+
<option value='<?php echo $page -> ID; ?>' <?php selected( $ctcc_content_settings['more_info_page'], $page -> ID ); ?>><?php echo $page -> post_title; ?></option>
|
498 |
+
<?php } ?>
|
499 |
+
</select>
|
500 |
+
<p class="description"><?php _e ( 'The page containing further information about your cookie policy', 'discussion-board' ); ?></p>
|
501 |
+
<?php }
|
502 |
+
}
|
503 |
+
|
504 |
+
public function more_info_url_render() {
|
505 |
+
$ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
|
506 |
+
<input type="url" name="ctcc_content_settings[more_info_url]" value="<?php echo $ctcc_content_settings['more_info_url']; ?>">
|
507 |
+
<p class="description"><?php _e ( 'You can add an absolute URL here to override the More Info Page setting above. Use this to link to an external website for further information about cookies.', 'uk-cookie-consent' ); ?></p>
|
508 |
+
<?php
|
509 |
+
}
|
510 |
+
|
511 |
+
public function more_info_target_render() {
|
512 |
+
$ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
|
513 |
+
<select name='ctcc_content_settings[more_info_target]'>
|
514 |
+
<option value='_blank' <?php selected( $ctcc_content_settings['more_info_target'], '_blank' ); ?>><?php _e ( 'New Tab', 'uk-cookie-consent' ); ?></option>
|
515 |
+
<option value='_self' <?php selected( $ctcc_content_settings['more_info_target'], '_self' ); ?>><?php _e ( 'Same Tab', 'uk-cookie-consent' ); ?></option>
|
516 |
+
</select>
|
517 |
+
<p class="description"><?php _e ( 'Open the More Information page in the same or new tab.', 'uk-cookie-consent' ); ?></p>
|
518 |
+
<?php
|
519 |
+
}
|
520 |
+
|
521 |
+
/*
|
522 |
+
* Styles functions
|
523 |
+
*/
|
524 |
+
|
525 |
+
public function position_render() {
|
526 |
+
$options = get_option( 'ctcc_styles_settings' ); ?>
|
527 |
+
<select name='ctcc_styles_settings[position]'>
|
528 |
+
<option value='top-bar' <?php selected( $options['position'], 'top-bar' ); ?>><?php _e ( 'Top Bar', 'uk-cookie-consent' ); ?></option>
|
529 |
+
<option value='bottom-bar' <?php selected( $options['position'], 'bottom-bar' ); ?>><?php _e ( 'Bottom Bar', 'uk-cookie-consent' ); ?></option>
|
530 |
+
<option value='top-left-block' <?php selected( $options['position'], 'top-left-block' ); ?>><?php _e ( 'Top Left Block', 'uk-cookie-consent' ); ?></option>
|
531 |
+
<option value='top-right-block' <?php selected( $options['position'], 'top-right-block' ); ?>><?php _e ( 'Top Right Block', 'uk-cookie-consent' ); ?></option>
|
532 |
+
<option value='bottom-left-block' <?php selected( $options['position'], 'bottom-left-block' ); ?>><?php _e ( 'Bottom Left Block', 'uk-cookie-consent' ); ?></option>
|
533 |
+
<option value='bottom-right-block' <?php selected( $options['position'], 'bottom-right-block' ); ?>><?php _e ( 'Bottom Right Block', 'uk-cookie-consent' ); ?></option>
|
534 |
+
</select>
|
535 |
+
<p class="description"><?php _e ( 'Where the notification should appear', 'uk-cookie-consent' ); ?></p>
|
536 |
+
<?php
|
537 |
+
}
|
538 |
+
|
539 |
+
public function container_class_render() {
|
540 |
+
$options = get_option( 'ctcc_styles_settings' ); ?>
|
541 |
+
<input type="text" name="ctcc_styles_settings[container_class]" value="<?php echo $options['container_class']; ?>">
|
542 |
+
<p class="description"><?php _e ( 'You can add an optional wrapper class, eg container, here to align the notification text with the rest of your content', 'uk-cookie-consent' ); ?></p>
|
543 |
+
<?php
|
544 |
+
}
|
545 |
+
|
546 |
+
public function enqueue_styles_render() {
|
547 |
+
$options = get_option( 'ctcc_styles_settings' ); ?>
|
548 |
+
<input type='checkbox' name='ctcc_styles_settings[enqueue_styles]' <?php checked ( ! empty ( $options['enqueue_styles'] ), 1 ); ?> value='1'>
|
549 |
+
<p class="description"><?php _e ( 'Deselect this to dequeue the plugin stylesheet', 'uk-cookie-consent' ); ?></p>
|
550 |
+
<?php
|
551 |
+
}
|
552 |
+
|
553 |
+
public function rounded_corners_render() {
|
554 |
+
$options = get_option( 'ctcc_styles_settings' ); ?>
|
555 |
+
<input type='checkbox' name='ctcc_styles_settings[rounded_corners]' <?php checked ( ! empty ( $options['rounded_corners'] ), 1 ); ?> value='1'>
|
556 |
+
<p class="description"><?php _e ( 'Round the corners on the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
|
557 |
+
<?php
|
558 |
+
}
|
559 |
+
|
560 |
+
public function drop_shadow_render() {
|
561 |
+
$options = get_option( 'ctcc_styles_settings' ); ?>
|
562 |
+
<input type='checkbox' name='ctcc_styles_settings[drop_shadow]' <?php checked ( ! empty ( $options['drop_shadow'] ), 1 ); ?> value='1'>
|
563 |
+
<p class="description"><?php _e ( 'Add drop shadow to the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
|
564 |
+
<?php
|
565 |
+
}
|
566 |
+
|
567 |
+
public function display_accept_with_text_render() {
|
568 |
+
$options = get_option( 'ctcc_styles_settings' ); ?>
|
569 |
+
<input type='checkbox' name='ctcc_styles_settings[display_accept_with_text]' <?php checked ( ! empty ( $options['display_accept_with_text'] ), 1 ); ?> value='1'>
|
570 |
+
<p class="description"><?php _e ( 'Display the confirmation button with notification text', 'uk-cookie-consent' ); ?></p>
|
571 |
+
<?php
|
572 |
+
}
|
573 |
+
|
574 |
+
public function x_close_render() {
|
575 |
+
$options = get_option( 'ctcc_styles_settings' ); ?>
|
576 |
+
<input type='checkbox' name='ctcc_styles_settings[x_close]' <?php checked ( ! empty ( $options['x_close'] ), 1 ); ?> value='1'>
|
577 |
+
<p class="description"><?php _e ( 'Remove confirmation button and use \'X\' icon instead', 'uk-cookie-consent' ); ?></p>
|
578 |
+
<?php
|
579 |
+
}
|
580 |
+
|
581 |
+
public function text_color_render() {
|
582 |
+
$options = get_option( 'ctcc_styles_settings' ); ?>
|
583 |
+
<input type="text" class="cctc-color-field" name="ctcc_styles_settings[text_color]" value="<?php echo $options['text_color']; ?>">
|
584 |
+
<p class="description"><?php _e ( 'The text color on the notification', 'uk-cookie-consent' ); ?></p>
|
585 |
+
<?php
|
586 |
+
}
|
587 |
+
|
588 |
+
public function bg_color_render() {
|
589 |
+
$options = get_option( 'ctcc_styles_settings' ); ?>
|
590 |
+
<input type="text" class="cctc-color-field" name="ctcc_styles_settings[bg_color]" value="<?php echo $options['bg_color']; ?>">
|
591 |
+
<p class="description"><?php _e ( 'The background color for the notification', 'uk-cookie-consent' ); ?></p>
|
592 |
+
<?php
|
593 |
+
}
|
594 |
+
|
595 |
+
public function link_color_render() {
|
596 |
+
$options = get_option( 'ctcc_styles_settings' ); ?>
|
597 |
+
<input type="text" class="cctc-color-field" name="ctcc_styles_settings[link_color]" value="<?php echo $options['link_color']; ?>">
|
598 |
+
<p class="description"><?php _e ( 'The link color on the notification', 'uk-cookie-consent' ); ?></p>
|
599 |
+
<?php
|
600 |
+
}
|
601 |
+
|
602 |
+
public function button_color_render() {
|
603 |
+
$options = get_option( 'ctcc_styles_settings' ); ?>
|
604 |
+
<input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_color]" value="<?php echo $options['button_color']; ?>">
|
605 |
+
<p class="description"><?php _e ( 'The text color on the notification button', 'uk-cookie-consent' ); ?></p>
|
606 |
+
<?php
|
607 |
+
}
|
608 |
+
|
609 |
+
public function button_bg_color_render() {
|
610 |
+
$options = get_option( 'ctcc_styles_settings' ); ?>
|
611 |
+
<input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_bg_color]" value="<?php echo $options['button_bg_color']; ?>">
|
612 |
+
<p class="description"><?php _e ( 'The background color on the notification button', 'uk-cookie-consent' ); ?></p>
|
613 |
+
<?php
|
614 |
+
}
|
615 |
+
|
616 |
+
public function flat_button_render() {
|
617 |
+
$options = get_option( 'ctcc_styles_settings' ); ?>
|
618 |
+
<input type='checkbox' name='ctcc_styles_settings[flat_button]' <?php checked ( ! empty ( $options['flat_button'] ), 1 ); ?> value='1'>
|
619 |
+
<p class="description"><?php _e ( 'Remove the border from the button', 'uk-cookie-consent' ); ?></p>
|
620 |
+
<?php
|
621 |
+
}
|
622 |
+
|
623 |
+
public function settings_section_callback() {
|
624 |
+
echo __( '<p>Basic settings</p>', 'uk-cookie-consent' );
|
625 |
+
}
|
626 |
+
|
627 |
+
public function content_settings_section_callback() {
|
628 |
+
echo __( '<p>Update the content displayed to the user</p>', 'uk-cookie-consent' );
|
629 |
+
}
|
630 |
+
|
631 |
+
public function styles_settings_section_callback() {
|
632 |
+
echo __( '<p>Change the styles here if you like - but it\'s better in the Customizer</p>', 'uk-cookie-consent' );
|
633 |
+
}
|
634 |
+
|
635 |
+
public function options_page() {
|
636 |
+
$reset = isset ( $_GET['reset'] ) ? $_GET['reset'] : '';
|
637 |
+
if ( isset ( $_POST['reset'] ) ) {
|
638 |
+
|
639 |
+
$defaults = $this -> get_default_styles_settings();
|
640 |
+
update_option ( 'ctcc_styles_settings', $defaults );
|
641 |
+
|
642 |
+
$defaults = $this -> get_default_content_settings();
|
643 |
+
update_option ( 'ctcc_content_settings', $defaults );
|
644 |
+
|
645 |
+
}
|
646 |
+
$current = isset ( $_GET['tab'] ) ? $_GET['tab'] : 'options';
|
647 |
+
$title = __( 'Cookie Consent', 'uk-cookie-consent' );
|
648 |
+
$tabs = array (
|
649 |
+
'options' => __( 'General', 'uk-cookie-consent' ),
|
650 |
+
'content' => __( 'Content', 'uk-cookie-consent' ),
|
651 |
+
'styles' => __( 'Styles', 'uk-cookie-consent' )
|
652 |
+
);?>
|
653 |
+
|
654 |
+
<div class="wrap">
|
655 |
+
<h1><?php echo $title; ?></h1>
|
656 |
+
<div class="ctdb-outer-wrap">
|
657 |
+
<div class="ctdb-inner-wrap">
|
658 |
+
<h2 class="nav-tab-wrapper">
|
659 |
+
<?php foreach( $tabs as $tab => $name ) {
|
660 |
+
$class = ( $tab == $current ) ? ' nav-tab-active' : '';
|
661 |
+
echo "<a class='nav-tab$class' href='?page=ctcc&tab=$tab'>$name</a>";
|
662 |
+
} ?>
|
663 |
+
</h2>
|
664 |
+
<form action='options.php' method='post'>
|
665 |
+
<?php
|
666 |
+
settings_fields( 'ctcc_' . strtolower ( $current ) );
|
667 |
+
do_settings_sections( 'ctcc_' . strtolower ( $current ) );
|
668 |
+
submit_button();
|
669 |
+
?>
|
670 |
+
</form>
|
671 |
+
<form method="post" action="">
|
672 |
+
<p class="submit">
|
673 |
+
<input name="reset" class="button button-secondary" type="submit" value="<?php _e ( 'Reset plugin defaults', 'uk-cookie-consent' ); ?>" >
|
674 |
+
<input type="hidden" name="action" value="reset" />
|
675 |
+
</p>
|
676 |
+
</form>
|
677 |
+
</div><!-- .ctdb-inner-wrap -->
|
678 |
+
<div class="ctdb-banners">
|
679 |
+
<div class="ctdb-banner">
|
680 |
+
<a href="https://catapultthemes.com/downloads/super-hero-slider-pro/?utm_source=plugin_ad&utm_medium=wp_plugin&utm_content=bcd&utm_campaign=campaign"><img src="<?php echo CTCC_PLUGIN_URL . 'assets/images/superhero-ad.png'; ?>" alt="" ></a>
|
681 |
+
</div>
|
682 |
+
<div class="ctdb-banner">
|
683 |
+
<a href="https://sellastic.com/?ref=1&utm_source=plugin_ad&utm_medium=wp_plugin&utm_content=cookieconsent&utm_campaign=sellastic"><img src="<?php echo CTCC_PLUGIN_URL . 'assets/images/sellastic-ad.jpg'; ?>" alt="" ></a>
|
684 |
+
</div>
|
685 |
+
<div class="ctdb-banner">
|
686 |
+
<a href="https://catapultthemes.com/downloads/category/themes/?utm_source=plugin_ad&utm_medium=wp_plugin&utm_content=cookieconsent&utm_campaign=campaign"><img src="<?php echo CTCC_PLUGIN_URL . 'assets/images/themes-ad.png'; ?>" alt="" ></a>
|
687 |
+
</div>
|
688 |
+
</div>
|
689 |
+
</div><!-- .ctdb-outer-wrap -->
|
690 |
+
</div><!-- .wrap -->
|
691 |
+
<?php
|
692 |
+
}
|
693 |
+
|
694 |
+
|
695 |
+
}
|
696 |
+
|
697 |
+
}
|
698 |
+
|
699 |
+
|
assets/css/admin-style.css
CHANGED
@@ -13,6 +13,12 @@
|
|
13 |
margin-right: -300px;
|
14 |
width: 280px;
|
15 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
@media only screen and (max-width: 850px) {
|
17 |
.ctdb-outer-wrap {
|
18 |
margin-right: 0;
|
13 |
margin-right: -300px;
|
14 |
width: 280px;
|
15 |
}
|
16 |
+
.ctdb-banners img {
|
17 |
+
max-width: 100%;
|
18 |
+
}
|
19 |
+
.ctdb-banner {
|
20 |
+
margin-bottom: 1.5em;
|
21 |
+
}
|
22 |
@media only screen and (max-width: 850px) {
|
23 |
.ctdb-outer-wrap {
|
24 |
margin-right: 0;
|
assets/css/style.css
CHANGED
@@ -72,8 +72,6 @@ button#catapultCookie {
|
|
72 |
margin: 0.5em 0 0;
|
73 |
}
|
74 |
.use_x_close .x_close {
|
75 |
-
height: 20px;
|
76 |
-
width: 20px;
|
77 |
position: absolute;
|
78 |
top: 10px;
|
79 |
right: 10px;
|
@@ -83,22 +81,77 @@ button#catapultCookie {
|
|
83 |
transition-duration:0.5s;
|
84 |
}
|
85 |
.cookie-bar-bar .use_x_close .x_close {
|
86 |
-
right:
|
87 |
top: 50%;
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
position: absolute;
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
.
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
margin: 0.5em 0 0;
|
73 |
}
|
74 |
.use_x_close .x_close {
|
|
|
|
|
75 |
position: absolute;
|
76 |
top: 10px;
|
77 |
right: 10px;
|
81 |
transition-duration:0.5s;
|
82 |
}
|
83 |
.cookie-bar-bar .use_x_close .x_close {
|
84 |
+
right: 0;
|
85 |
top: 50%;
|
86 |
+
-webkit-transform: translateY(-50%);
|
87 |
+
transform: translateY(-50%);
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
.x_close {
|
92 |
+
-webkit-backface-visibility: hidden;
|
93 |
+
backface-visibility: hidden;
|
94 |
+
-webkit-transform: translate3d(0px,0px,0px);
|
95 |
+
width: 14px;
|
96 |
+
height: 30px;
|
97 |
+
position: relative;
|
98 |
+
margin: 0 auto;
|
99 |
+
-webkit-transform: rotate(0deg);
|
100 |
+
-moz-transform: rotate(0deg);
|
101 |
+
-o-transform: rotate(0deg);
|
102 |
+
transform: rotate(0deg);
|
103 |
+
-webkit-transition: .5s ease-in-out;
|
104 |
+
-moz-transition: .5s ease-in-out;
|
105 |
+
-o-transition: .5s ease-in-out;
|
106 |
+
transition: .5s ease-in-out;
|
107 |
+
cursor: pointer;
|
108 |
+
}
|
109 |
+
.x_close span {
|
110 |
+
display: block;
|
111 |
position: absolute;
|
112 |
+
height: 3px;
|
113 |
+
width: 14px;
|
114 |
+
background: #111;
|
115 |
+
border-radius: 6px;
|
116 |
+
opacity: 1;
|
117 |
+
left: 0;
|
118 |
+
-webkit-transform: rotate(0deg);
|
119 |
+
-moz-transform: rotate(0deg);
|
120 |
+
-o-transform: rotate(0deg);
|
121 |
+
transform: rotate(0deg);
|
122 |
+
-webkit-transition: .25s ease-in-out;
|
123 |
+
-moz-transition: .25s ease-in-out;
|
124 |
+
-o-transition: .25s ease-in-out;
|
125 |
+
transition: .25s ease-in-out;
|
126 |
+
transition-delay: .14s;
|
127 |
+
-webkit-transition-delay: .14s;
|
128 |
+
-moz-transition-delay: .14s;
|
129 |
+
}
|
130 |
+
.x_close span:nth-child(1),
|
131 |
+
.x_close span:nth-child(2) {
|
132 |
+
top: 14px;
|
133 |
+
}
|
134 |
+
.x_close span:nth-child(1) {
|
135 |
+
-webkit-transform: rotate(45deg);
|
136 |
+
-moz-transform: rotate(45deg);
|
137 |
+
-o-transform: rotate(45deg);
|
138 |
+
transform: rotate(45deg);
|
139 |
+
}
|
140 |
+
.x_close span:nth-child(2) {
|
141 |
+
-webkit-transform: rotate(-45deg);
|
142 |
+
-moz-transform: rotate(-45deg);
|
143 |
+
-o-transform: rotate(-45deg);
|
144 |
+
transform: rotate(-45deg);
|
145 |
+
}
|
146 |
+
.x_close:hover span:nth-child(1) {
|
147 |
+
-webkit-transform: rotate(0);
|
148 |
+
-moz-transform: rotate(0);
|
149 |
+
-o-transform: rotate(0);
|
150 |
+
transform: rotate(0);
|
151 |
+
}
|
152 |
+
.x_close:hover span:nth-child(2) {
|
153 |
+
-webkit-transform: rotate(0);
|
154 |
+
-moz-transform: rotate(0);
|
155 |
+
-o-transform: rotate(0);
|
156 |
+
transform: rotate(0);
|
157 |
+
}
|
public/class-ctcc-public.php
CHANGED
@@ -1,296 +1,317 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Public class
|
4 |
-
*/
|
5 |
-
|
6 |
-
// Exit if accessed directly
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
-
exit;
|
9 |
-
}
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Plugin public class
|
13 |
-
**/
|
14 |
-
if ( ! class_exists( 'CTCC_Public' ) ) { // Don't initialise if there's already a class activated
|
15 |
-
class CTCC_Public {
|
16 |
-
public function __construct() {
|
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 |
-
$position_css = 'position: fixed;
|
66 |
-
|
67 |
-
top:
|
68 |
-
width:
|
69 |
-
} else if ( $ctcc_styles_settings['position'] == '
|
70 |
-
$position_css = 'position: fixed;
|
71 |
-
left:
|
72 |
-
|
73 |
-
width:
|
74 |
-
} else if ( $ctcc_styles_settings['position'] == '
|
75 |
-
$position_css = 'position: fixed;
|
76 |
-
|
77 |
-
|
78 |
-
width: 300px;';
|
79 |
-
} else if ( $ctcc_styles_settings['position'] == '
|
80 |
-
$position_css = 'position: fixed;
|
81 |
-
|
82 |
-
|
83 |
-
width: 300px;';
|
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 |
-
#catapult-cookie-bar
|
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 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Public class
|
4 |
+
*/
|
5 |
+
|
6 |
+
// Exit if accessed directly
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
+
exit;
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Plugin public class
|
13 |
+
**/
|
14 |
+
if ( ! class_exists( 'CTCC_Public' ) ) { // Don't initialise if there's already a class activated
|
15 |
+
class CTCC_Public {
|
16 |
+
public function __construct() {
|
17 |
+
//
|
18 |
+
}
|
19 |
+
/*
|
20 |
+
* Initialize the class and start calling our hooks and filters
|
21 |
+
* @since 2.0.0
|
22 |
+
*/
|
23 |
+
public function init() {
|
24 |
+
add_action ( 'wp_enqueue_scripts', array ( $this, 'enqueue_scripts' ) );
|
25 |
+
add_action ( 'wp_head', array ( $this, 'add_css' ) );
|
26 |
+
add_action ( 'wp_footer', array ( $this, 'add_js' ), 1000 );
|
27 |
+
add_action ( 'wp_footer', array ( $this, 'add_notification_bar' ), 1000 );
|
28 |
+
}
|
29 |
+
|
30 |
+
/*
|
31 |
+
* Enqueue styles and scripts
|
32 |
+
* @since 2.0.0
|
33 |
+
*/
|
34 |
+
public function enqueue_scripts() {
|
35 |
+
$ctcc_options_settings = get_option ( 'ctcc_options_settings' );
|
36 |
+
$options = get_option ( 'ctcc_styles_settings' );
|
37 |
+
if ( isset ( $options['enqueue_styles'] ) ) {
|
38 |
+
wp_enqueue_style ( 'cookie-consent-style', CTCC_PLUGIN_URL . 'assets/css/style.css', '2.0.0' );
|
39 |
+
}
|
40 |
+
wp_enqueue_script ( 'cookie-consent', CTCC_PLUGIN_URL . 'assets/js/uk-cookie-consent-js.js', array ( 'jquery' ), '2.0.0', true );
|
41 |
+
wp_localize_script (
|
42 |
+
'cookie-consent',
|
43 |
+
'ctcc_vars',
|
44 |
+
array (
|
45 |
+
'expiry' => $ctcc_options_settings['cookie_expiry'],
|
46 |
+
'method' => isset ( $ctcc_options_settings['first_page'] ),
|
47 |
+
'version' => $ctcc_options_settings['cookie_version'],
|
48 |
+
)
|
49 |
+
);
|
50 |
+
}
|
51 |
+
|
52 |
+
/*
|
53 |
+
* Add some CSS to the header
|
54 |
+
* @since 2.0.0
|
55 |
+
*/
|
56 |
+
public function add_css() {
|
57 |
+
$options = get_option ( 'ctcc_options_settings' );
|
58 |
+
$ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
|
59 |
+
$position_css = 'position: fixed;
|
60 |
+
left: 0;
|
61 |
+
top: 0;
|
62 |
+
width: 100%;';
|
63 |
+
// Figure out the bar position
|
64 |
+
if ( $ctcc_styles_settings['position'] == 'top-bar' ) {
|
65 |
+
$position_css = 'position: fixed;
|
66 |
+
left: 0;
|
67 |
+
top: 0;
|
68 |
+
width: 100%;';
|
69 |
+
} else if ( $ctcc_styles_settings['position'] == 'bottom-bar' ) {
|
70 |
+
$position_css = 'position: fixed;
|
71 |
+
left: 0;
|
72 |
+
bottom: 0;
|
73 |
+
width: 100%;';
|
74 |
+
} else if ( $ctcc_styles_settings['position'] == 'top-right-block' ) {
|
75 |
+
$position_css = 'position: fixed;
|
76 |
+
right: 20px;
|
77 |
+
top: 6%;
|
78 |
+
width: 300px;';
|
79 |
+
} else if ( $ctcc_styles_settings['position'] == 'top-left-block' ) {
|
80 |
+
$position_css = 'position: fixed;
|
81 |
+
left: 20px;
|
82 |
+
top: 6%;
|
83 |
+
width: 300px;';
|
84 |
+
} else if ( $ctcc_styles_settings['position'] == 'bottom-left-block' ) {
|
85 |
+
$position_css = 'position: fixed;
|
86 |
+
left: 20px;
|
87 |
+
bottom: 6%;
|
88 |
+
width: 300px;';
|
89 |
+
} else if ( $ctcc_styles_settings['position'] == 'bottom-right-block' ) {
|
90 |
+
$position_css = 'position: fixed;
|
91 |
+
right: 20px;
|
92 |
+
bottom: 6%;
|
93 |
+
width: 300px;';
|
94 |
+
}
|
95 |
+
// Get our styles
|
96 |
+
$text_color = $ctcc_styles_settings['text_color'];
|
97 |
+
$position = 'top';
|
98 |
+
$bg_color = $ctcc_styles_settings['bg_color'];
|
99 |
+
$link_color = $ctcc_styles_settings['link_color'];
|
100 |
+
$button_bg = $ctcc_styles_settings['button_bg_color'];
|
101 |
+
$button_color = $ctcc_styles_settings['button_color'];
|
102 |
+
if ( ! empty ( $ctcc_styles_settings['flat_button'] ) ){
|
103 |
+
$button_style = 'border: 0; padding: 6px 9px; border-radius: 3px;';
|
104 |
+
} else {
|
105 |
+
$button_style = '';
|
106 |
+
}
|
107 |
+
// Build our CSS
|
108 |
+
$css = '<style id="ctcc-css" type="text/css" media="screen">';
|
109 |
+
$css .= '
|
110 |
+
#catapult-cookie-bar {
|
111 |
+
box-sizing: border-box;
|
112 |
+
max-height: 0;
|
113 |
+
opacity: 0;
|
114 |
+
z-index: 99999;
|
115 |
+
overflow: hidden;
|
116 |
+
color: ' . $text_color . ';
|
117 |
+
' . $position_css . '
|
118 |
+
background-color: ' . $bg_color . ';
|
119 |
+
}
|
120 |
+
#catapult-cookie-bar a {
|
121 |
+
color: ' . $link_color . ';
|
122 |
+
}
|
123 |
+
#catapult-cookie-bar .x_close span {
|
124 |
+
background-color: ' . $button_color . ';
|
125 |
+
}
|
126 |
+
button#catapultCookie {
|
127 |
+
background:' . $button_bg . ';
|
128 |
+
color: ' . $button_color . ';
|
129 |
+
' . $button_style . '
|
130 |
+
}
|
131 |
+
#catapult-cookie-bar h3 {
|
132 |
+
color: ' . $text_color . ';
|
133 |
+
}
|
134 |
+
.has-cookie-bar #catapult-cookie-bar {
|
135 |
+
opacity: 1;
|
136 |
+
max-height: 999px;
|
137 |
+
min-height: 30px;
|
138 |
+
}';
|
139 |
+
$css .= '</style>';
|
140 |
+
echo $css;
|
141 |
+
// Add it to the header
|
142 |
+
}
|
143 |
+
|
144 |
+
/*
|
145 |
+
* Add some JS to the footer
|
146 |
+
* @since 2.0.0
|
147 |
+
*/
|
148 |
+
public function add_js() {
|
149 |
+
|
150 |
+
$options = get_option( 'ctcc_options_settings' );
|
151 |
+
$ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
|
152 |
+
|
153 |
+
if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
|
154 |
+
$type = 'bar';
|
155 |
+
} else {
|
156 |
+
$type = 'block';
|
157 |
+
} ?>
|
158 |
+
|
159 |
+
<script type="text/javascript">
|
160 |
+
jQuery(document).ready(function($){
|
161 |
+
<?php if ( isset ( $_GET['cookie'] ) ) { ?>
|
162 |
+
catapultDeleteCookie('catAccCookies');
|
163 |
+
<?php } ?>
|
164 |
+
if(!catapultReadCookie("catAccCookies")){ // If the cookie has not been set then show the bar
|
165 |
+
$("html").addClass("has-cookie-bar");
|
166 |
+
$("html").addClass("cookie-bar-<?php echo $ctcc_styles_settings['position']; ?>");
|
167 |
+
$("html").addClass("cookie-bar-<?php echo $type; ?>");
|
168 |
+
<?php // Move the HTML down if the bar is at the top
|
169 |
+
if ( $ctcc_styles_settings['position'] == 'top-bar' ) {
|
170 |
+
?>
|
171 |
+
// Wait for the animation on the html to end before recalculating the required top margin
|
172 |
+
$("html").on('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) {
|
173 |
+
// code to execute after transition ends
|
174 |
+
var barHeight = $('#catapult-cookie-bar').outerHeight();
|
175 |
+
$("html").css("margin-top",barHeight);
|
176 |
+
$("body.admin-bar").css("margin-top",barHeight-32); // Push the body down if the admin bar is active
|
177 |
+
});
|
178 |
+
<?php } ?>
|
179 |
+
}
|
180 |
+
<?php if ( $options['closure'] == 'timed' ) {
|
181 |
+
// Add some script if it's on a timer
|
182 |
+
$duration = absint($options['duration']) * 1000; ?>
|
183 |
+
setTimeout(ctccCloseNotification, <?php echo $duration; ?>);
|
184 |
+
<?php } ?>
|
185 |
+
<?php if ( ! empty ( $options['first_page'] ) ) {
|
186 |
+
// Add some script if the notification only displays on the first page ?>
|
187 |
+
ctccFirstPage();
|
188 |
+
<?php } ?>
|
189 |
+
});
|
190 |
+
</script>
|
191 |
+
|
192 |
+
<?php }
|
193 |
+
|
194 |
+
/*
|
195 |
+
* Add the notification bar itself
|
196 |
+
* @since 2.0.0
|
197 |
+
*/
|
198 |
+
public function add_notification_bar() {
|
199 |
+
|
200 |
+
$ctcc_options_settings = get_option ( 'ctcc_options_settings' );
|
201 |
+
$ctcc_content_settings = get_option ( 'ctcc_content_settings' );
|
202 |
+
$ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
|
203 |
+
|
204 |
+
// Check if it's a block or a bar
|
205 |
+
$is_block = true;
|
206 |
+
if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
|
207 |
+
$is_block = false; // It's a bar
|
208 |
+
}
|
209 |
+
|
210 |
+
// Add some classes to the block
|
211 |
+
$classes = '';
|
212 |
+
if ( $is_block ) {
|
213 |
+
if ( ! empty ( $ctcc_styles_settings['rounded_corners'] ) ) {
|
214 |
+
$classes .= ' rounded-corners';
|
215 |
+
}
|
216 |
+
if ( ! empty ( $ctcc_styles_settings['drop_shadow'] ) ) {
|
217 |
+
$classes .= ' drop-shadow';
|
218 |
+
}
|
219 |
+
}
|
220 |
+
if ( ! empty ( $ctcc_styles_settings['x_close'] ) ) {
|
221 |
+
$classes .= ' use_x_close';
|
222 |
+
}
|
223 |
+
if ( empty ( $ctcc_styles_settings['display_accept_with_text'] ) ) {
|
224 |
+
$classes .= ' float-accept';
|
225 |
+
}
|
226 |
+
|
227 |
+
// Allowed tags
|
228 |
+
$allowed = array (
|
229 |
+
'a' => array (
|
230 |
+
'href' => array(),
|
231 |
+
'title' => array()
|
232 |
+
),
|
233 |
+
'br' => array(),
|
234 |
+
'em' => array(),
|
235 |
+
'strong' => array(),
|
236 |
+
'p' => array()
|
237 |
+
);
|
238 |
+
|
239 |
+
$content = '';
|
240 |
+
$close_content = '';
|
241 |
+
|
242 |
+
// Print the notification bar
|
243 |
+
$content = '<div id="catapult-cookie-bar" class="' . $classes . '">';
|
244 |
+
|
245 |
+
// Add a custom wrapper class if specified
|
246 |
+
if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
|
247 |
+
$content .= '<div class="ctcc-inner ' . esc_attr ( str_replace ( '.', '', $ctcc_styles_settings['container_class'] ) ) . '">';
|
248 |
+
$close_content = '</div><!-- custom wrapper class -->';
|
249 |
+
}
|
250 |
+
|
251 |
+
// Add a title if it's a block
|
252 |
+
if ( $ctcc_styles_settings['position'] != 'top-bar' && $ctcc_styles_settings['position'] != 'bottom-bar' ) {
|
253 |
+
$heading_text = wp_kses ( $ctcc_content_settings['heading_text'], $allowed );
|
254 |
+
$heading_text = apply_filters( 'ctcc_heading_text', $heading_text );
|
255 |
+
$content .= sprintf ( '<h3>%s</h3>',
|
256 |
+
$heading_text
|
257 |
+
);
|
258 |
+
}
|
259 |
+
|
260 |
+
// Make the Read More link
|
261 |
+
$more_text = '';
|
262 |
+
if ( $ctcc_content_settings['more_info_text'] ) {
|
263 |
+
// Find what page we're linking to
|
264 |
+
if ( ! empty ( $ctcc_content_settings['more_info_url'] ) ) {
|
265 |
+
// Check the absolute URL first
|
266 |
+
$link = $ctcc_content_settings['more_info_url'];
|
267 |
+
} else {
|
268 |
+
// Use the internal page
|
269 |
+
$link = get_permalink ( $ctcc_content_settings['more_info_page'] );
|
270 |
+
}
|
271 |
+
$more_info_text = wp_kses ( $ctcc_content_settings['more_info_text'], $allowed );
|
272 |
+
$more_info_text = apply_filters( 'ctcc_more_info_text', $more_info_text );
|
273 |
+
$more_text = sprintf (
|
274 |
+
'<a tabindex=0 target="%s" href="%s">%s</a>',
|
275 |
+
esc_attr ( $ctcc_content_settings['more_info_target'] ),
|
276 |
+
esc_url ( $link ),
|
277 |
+
$more_info_text
|
278 |
+
);
|
279 |
+
}
|
280 |
+
|
281 |
+
$button_text = '';
|
282 |
+
if ( empty ( $ctcc_styles_settings['x_close'] ) ) {
|
283 |
+
$accept_text = wp_kses ( $ctcc_content_settings['accept_text'], $allowed );
|
284 |
+
$accept_text = apply_filters( 'ctcc_accept_text', $accept_text );
|
285 |
+
$button_text = sprintf (
|
286 |
+
'<button id="catapultCookie" tabindex=0 onclick="catapultAcceptCookies();">%s</button>',
|
287 |
+
$accept_text
|
288 |
+
);
|
289 |
+
}
|
290 |
+
|
291 |
+
// The main bar content
|
292 |
+
$notification_text = wp_kses ( $ctcc_content_settings['notification_text'], $allowed );
|
293 |
+
$notification_text = apply_filters( 'ctcc_notification_text', $notification_text );
|
294 |
+
$content .= sprintf (
|
295 |
+
'<span class="ctcc-left-side">%s %s</span><span class="ctcc-right-side">%s</span>',
|
296 |
+
$notification_text,
|
297 |
+
$more_text,
|
298 |
+
$button_text
|
299 |
+
);
|
300 |
+
|
301 |
+
// X close button
|
302 |
+
if ( ! empty ( $ctcc_styles_settings['x_close'] ) ) {
|
303 |
+
$content .= '<div class="x_close"><span></span><span></span></div>';
|
304 |
+
}
|
305 |
+
|
306 |
+
// Close custom wrapper class if used
|
307 |
+
$content .= $close_content;
|
308 |
+
|
309 |
+
$content .= '</div><!-- #catapult-cookie-bar -->';
|
310 |
+
|
311 |
+
echo apply_filters ( 'catapult_cookie_content', $content, $ctcc_content_settings );
|
312 |
+
|
313 |
+
}
|
314 |
+
|
315 |
+
}
|
316 |
+
|
317 |
}
|
readme.txt
CHANGED
@@ -1,148 +1,157 @@
|
|
1 |
-
=== Cookie Consent ===
|
2 |
-
Contributors: Catapult_Themes, husobj, jraczynski
|
3 |
-
Donate Link: https://paypal.com
|
4 |
-
Tags: cookie law, cookies, EU, implied consent, uk cookie consent, compliance, eu cookie law, eu privacy directive, privacy, privacy directive, consent, cookie, cookie compliance, cookie law, eu cookie, notice, notification, notify, cookie notice, cookie notification, cookie notify
|
5 |
-
Requires at least: 4.3
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 2.0
|
8 |
-
License: GPLv2 or later
|
9 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
-
The only cookie consent plugin you'll ever need.
|
11 |
-
== Description ==
|
12 |
-
Cookie Consent 2.0 is a major rewrite of the popular Cookie Consent plugin. We've retained all the features that originally made the plugin so popular, such as speed of set-up, but added new features based on feedback and requests.
|
13 |
-
= Activation =
|
14 |
-
One of the most popular aspects of the plugin is its simplicity of use. The new version is no different - simply install and activate the plugin to automatically add the cookie consent notification bar without any need to configure it. On activation, the plugin creates and populates a page on your site with information about your cookie policy and automatically links to the page from the notification bar. So if you're using the default settings, it's a matter of seconds to get up and running.
|
15 |
-
= New Features =
|
16 |
-
We've extended the options with the plugin and in version 2.0, we've added many new features, including:
|
17 |
-
* Choice of dismissal method - either on click by the user or timed
|
18 |
-
* Choice of dismissal element - either button or 'x' close
|
19 |
-
* Option to show the notification on the first page only - subsequent pages visited by the user will not display the message
|
20 |
-
* Choice of position - either top or bottom bar, or floating in one of the corners of the screen
|
21 |
-
* Better translation support
|
22 |
-
* Better responsive support
|
23 |
-
* More customization options - including the ability to update styles from within the customizer
|
24 |
-
* Inherits your theme styles where possible
|
25 |
-
* The option to use an absolute or external URL to link to for further information
|
26 |
-
* Set the cookie duration
|
27 |
-
* Set the cookie version - updating a version will reset the cookie on all user sites
|
28 |
-
= Translations =
|
29 |
-
* Polish
|
30 |
-
* Russian
|
31 |
-
* Slovakian
|
32 |
-
= EU Directive =
|
33 |
-
We think this is the simplest but most effective method of dealing with the legislation.
|
34 |
-
The plug-in is a straightforward approach to help you comply with the EU regulations regarding usage of website cookies. It follows the notion of "implied consent" as described by the UK's Information Commissioner and makes the assumption that most users who choose not to accept cookies will do so for all websites. A user to your site is presented with a clear yet unobtrusive notification that the site is using cookies and may then acknowledge and dismiss the notification or click to find out more. The plug-in automatically creates a new page with pre-populated information on cookies and how to disable them, which you may edit further if you wish.
|
35 |
-
Importantly, the plug-in does not disable cookies on your site or prevent the user from continuing to browse the site. Several plug-ins have adopted the "explicit consent" approach which obliges users to opt in to cookies on your site. This is likely to deter visitors.
|
36 |
-
== Installation ==
|
37 |
-
1. Upload the `uk-cookie-consent` folder to the `/wp-content/plugins/` directory
|
38 |
-
1. Activate the plugin through the 'Plugins' menu in WordPress
|
39 |
-
1. Browse to the Cookie Consent option page in Settings to configure
|
40 |
-
== Frequently Asked Questions ==
|
41 |
-
|
42 |
-
= Where can I find out more about this plug-in? =
|
43 |
-
You can find out more about the plug-in on [its plug-in page](http://catapultthemes.com/cookie-consent/).
|
44 |
-
= Is there a demo? =
|
45 |
-
Yep. Take a look at [the demo](http://cookieconsent.catapultthemes.com/). Reset the cookie by [going to this URL](http://cookieconsent.catapultthemes.com/?cookie=delete).
|
46 |
-
= Does this definitely cover me under the legislation? =
|
47 |
-
You have to make up your own mind about that or consult a legal expert.
|
48 |
-
= Where can I find out more about the UK laws regarding cookies? =
|
49 |
-
You will find more details of the regulations on the [Information Commissioner's Office site](http://www.ico.gov.uk/for_organisations/privacy_and_electronic_communications/the_guide/cookies.aspx).
|
50 |
-
== Screenshots ==
|
51 |
-
1. Notification bar along the top of the screen
|
52 |
-
2. Detail of notification bar on the bottom of the screen
|
53 |
-
3. Notification box in corner
|
54 |
-
4. Customization panel
|
55 |
-
5. Example settings page
|
56 |
-
== Changelog ==
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
*
|
61 |
-
|
62 |
-
*
|
63 |
-
|
64 |
-
*
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
* Added:
|
72 |
-
= 2.0.
|
73 |
-
* Fixed:
|
74 |
-
= 2.0.
|
75 |
-
*
|
76 |
-
|
77 |
-
*
|
78 |
-
|
79 |
-
*
|
80 |
-
|
81 |
-
|
82 |
-
* Fixed:
|
83 |
-
|
84 |
-
|
85 |
-
*
|
86 |
-
|
87 |
-
*
|
88 |
-
|
89 |
-
|
90 |
-
*
|
91 |
-
*
|
92 |
-
*
|
93 |
-
|
94 |
-
*
|
95 |
-
|
96 |
-
*
|
97 |
-
|
98 |
-
*
|
99 |
-
* Added:
|
100 |
-
* Added:
|
101 |
-
|
102 |
-
*
|
103 |
-
|
104 |
-
|
105 |
-
*
|
106 |
-
|
107 |
-
*
|
108 |
-
*
|
109 |
-
*
|
110 |
-
= 1.
|
111 |
-
*
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
*
|
118 |
-
*
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
*
|
127 |
-
*
|
128 |
-
* Thanks to
|
129 |
-
= 1.
|
130 |
-
*
|
131 |
-
= 1.
|
132 |
-
*
|
133 |
-
= 1.
|
134 |
-
*
|
135 |
-
|
136 |
-
*
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
= 1.
|
141 |
-
*
|
142 |
-
= 1.
|
143 |
-
*
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
Please note that the upgrade to version 2.x is significant. Although we've made every effort to ensure your settings are retained from previous versions, you may notice minor design differences to the notification bar.
|
1 |
+
=== Cookie Consent ===
|
2 |
+
Contributors: Catapult_Themes, husobj, jraczynski
|
3 |
+
Donate Link: https://paypal.com
|
4 |
+
Tags: cookie law, cookies, EU, implied consent, uk cookie consent, compliance, eu cookie law, eu privacy directive, privacy, privacy directive, consent, cookie, cookie compliance, cookie law, eu cookie, notice, notification, notify, cookie notice, cookie notification, cookie notify, wpml
|
5 |
+
Requires at least: 4.3
|
6 |
+
Tested up to: 4.6.1
|
7 |
+
Stable tag: 2.1.0
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
The only cookie consent plugin you'll ever need.
|
11 |
+
== Description ==
|
12 |
+
Cookie Consent 2.0 is a major rewrite of the popular Cookie Consent plugin. We've retained all the features that originally made the plugin so popular, such as speed of set-up, but added new features based on feedback and requests.
|
13 |
+
= Activation =
|
14 |
+
One of the most popular aspects of the plugin is its simplicity of use. The new version is no different - simply install and activate the plugin to automatically add the cookie consent notification bar without any need to configure it. On activation, the plugin creates and populates a page on your site with information about your cookie policy and automatically links to the page from the notification bar. So if you're using the default settings, it's a matter of seconds to get up and running.
|
15 |
+
= New Features =
|
16 |
+
We've extended the options with the plugin and in version 2.0, we've added many new features, including:
|
17 |
+
* Choice of dismissal method - either on click by the user or timed
|
18 |
+
* Choice of dismissal element - either button or 'x' close
|
19 |
+
* Option to show the notification on the first page only - subsequent pages visited by the user will not display the message
|
20 |
+
* Choice of position - either top or bottom bar, or floating in one of the corners of the screen
|
21 |
+
* Better translation support
|
22 |
+
* Better responsive support
|
23 |
+
* More customization options - including the ability to update styles from within the customizer
|
24 |
+
* Inherits your theme styles where possible
|
25 |
+
* The option to use an absolute or external URL to link to for further information
|
26 |
+
* Set the cookie duration
|
27 |
+
* Set the cookie version - updating a version will reset the cookie on all user sites
|
28 |
+
= Translations =
|
29 |
+
* Polish
|
30 |
+
* Russian
|
31 |
+
* Slovakian
|
32 |
+
= EU Directive =
|
33 |
+
We think this is the simplest but most effective method of dealing with the legislation.
|
34 |
+
The plug-in is a straightforward approach to help you comply with the EU regulations regarding usage of website cookies. It follows the notion of "implied consent" as described by the UK's Information Commissioner and makes the assumption that most users who choose not to accept cookies will do so for all websites. A user to your site is presented with a clear yet unobtrusive notification that the site is using cookies and may then acknowledge and dismiss the notification or click to find out more. The plug-in automatically creates a new page with pre-populated information on cookies and how to disable them, which you may edit further if you wish.
|
35 |
+
Importantly, the plug-in does not disable cookies on your site or prevent the user from continuing to browse the site. Several plug-ins have adopted the "explicit consent" approach which obliges users to opt in to cookies on your site. This is likely to deter visitors.
|
36 |
+
== Installation ==
|
37 |
+
1. Upload the `uk-cookie-consent` folder to the `/wp-content/plugins/` directory
|
38 |
+
1. Activate the plugin through the 'Plugins' menu in WordPress
|
39 |
+
1. Browse to the Cookie Consent option page in Settings to configure
|
40 |
+
== Frequently Asked Questions ==
|
41 |
+
|
42 |
+
= Where can I find out more about this plug-in? =
|
43 |
+
You can find out more about the plug-in on [its plug-in page](http://catapultthemes.com/cookie-consent/).
|
44 |
+
= Is there a demo? =
|
45 |
+
Yep. Take a look at [the demo](http://cookieconsent.catapultthemes.com/). Reset the cookie by [going to this URL](http://cookieconsent.catapultthemes.com/?cookie=delete).
|
46 |
+
= Does this definitely cover me under the legislation? =
|
47 |
+
You have to make up your own mind about that or consult a legal expert.
|
48 |
+
= Where can I find out more about the UK laws regarding cookies? =
|
49 |
+
You will find more details of the regulations on the [Information Commissioner's Office site](http://www.ico.gov.uk/for_organisations/privacy_and_electronic_communications/the_guide/cookies.aspx).
|
50 |
+
== Screenshots ==
|
51 |
+
1. Notification bar along the top of the screen
|
52 |
+
2. Detail of notification bar on the bottom of the screen
|
53 |
+
3. Notification box in corner
|
54 |
+
4. Customization panel
|
55 |
+
5. Example settings page
|
56 |
+
== Changelog ==
|
57 |
+
|
58 |
+
= 2.1.0 =
|
59 |
+
* Added: Italian translation (thanks to wocmultimedia)
|
60 |
+
* Added: wpml-config.xml file
|
61 |
+
* Added: filters on all content
|
62 |
+
* Fixed: x button colour set by button colour
|
63 |
+
* Updated: changed button and 'read more' elements' tabindex to 0
|
64 |
+
* Updated: x button now CSS to avoid missing Unicode character
|
65 |
+
|
66 |
+
= 2.0.12 =
|
67 |
+
* Fixed: added flex-shrink: 0 to prevent button overflowing container on mobile
|
68 |
+
= 2.0.11 =
|
69 |
+
* Fixed: syntax error in class-ctcc-public.php
|
70 |
+
= 2.0.10 =
|
71 |
+
* Added: priority on add_js
|
72 |
+
= 2.0.9 =
|
73 |
+
* Fixed: prevent JavaScript conflict by calling color picker script on non-plugin pages
|
74 |
+
= 2.0.8 =
|
75 |
+
* Updated: admin images in assets folder
|
76 |
+
= 2.0.7 =
|
77 |
+
* Added: Slovakian translation (thanks to lacike)
|
78 |
+
= 2.0.6 =
|
79 |
+
* Added: flat button option
|
80 |
+
* Added: Russian translation
|
81 |
+
= 2.0.5 =
|
82 |
+
* Fixed: notification hides correctly when stylesheet is dequeued
|
83 |
+
= 2.0.4 =
|
84 |
+
* Added: Polish translation (thanks to jraczynski for all items in this update)
|
85 |
+
* Updated: .pot file generated with l18n tool
|
86 |
+
* Updated: correct text domain in customizer.php
|
87 |
+
* Updated: removed spaces in translator functions
|
88 |
+
* Updated: plugin name translatable
|
89 |
+
= 2.0.3 =
|
90 |
+
* Fixed: more_info_target option not saving
|
91 |
+
* Fixed: button text getting cropped
|
92 |
+
* Changed: default position of accept button with notification text
|
93 |
+
= 2.0.2 =
|
94 |
+
* Fixed: retain settings from previous version
|
95 |
+
= 2.0.1 =
|
96 |
+
* Fixed: admin formatting
|
97 |
+
= 2.0.0 =
|
98 |
+
* Major rewrite
|
99 |
+
* Added: Choice of dismissal method - either on click by the user or timed
|
100 |
+
* Added: Choice of dismissal element - either button or 'x' close
|
101 |
+
* Added: Option to show the notification on the first page only - subsequent pages visited by the user will not display the message
|
102 |
+
* Added: Choice of position - either top or bottom bar, or floating in one of the corners of the screen
|
103 |
+
* Changed: Better translation support
|
104 |
+
* Changed: Better responsive support
|
105 |
+
* Changed: More customization options - including the ability to update styles from within the customizer
|
106 |
+
* Changed: Inherits your theme styles where possible
|
107 |
+
* Changed: The option to use an absolute or external URL to link to for further information
|
108 |
+
* Added: Set the cookie duration
|
109 |
+
* Added: Set the cookie version - updating a version will reset the cookie on all user sites
|
110 |
+
= 1.8.2 =
|
111 |
+
* Admin update
|
112 |
+
|
113 |
+
= 1.8.1 =
|
114 |
+
* Fixed empty space at top of screen when bar is located at the bottom of screen
|
115 |
+
= 1.8 =
|
116 |
+
* Move HTML down to accommodate notification bar rather than obscuring content
|
117 |
+
* Enqueues JS in footer
|
118 |
+
* Improved translation support
|
119 |
+
= 1.7.1 =
|
120 |
+
* Ready for WP 3.8
|
121 |
+
= 1.7 =
|
122 |
+
* Updates to settings page
|
123 |
+
= 1.6 =
|
124 |
+
* Moved JS to footer (thanks to Andreas Larsen for the suggestion)
|
125 |
+
= 1.5 =
|
126 |
+
* Switched the logic so that the bar is initially hidden on the page and only displays if user has not previously dismissed it.
|
127 |
+
* Gives a slightly better performance.
|
128 |
+
* Thanks to chrisHe for the suggestion.
|
129 |
+
= 1.4.2. =
|
130 |
+
* Policy page created on register_activation_hook now
|
131 |
+
= 1.4.1 =
|
132 |
+
* Tweak to ensure jQuery is a dependency
|
133 |
+
= 1.4 =
|
134 |
+
* This plug-in now uses JavaScript to test whether the user has dismissed the front-end notification in order to solve issues with caching plug-ins.
|
135 |
+
* Added configuration options for colour and position of bar.
|
136 |
+
* Set notification button and link to first element in tab list.
|
137 |
+
* Thanks to husobj for contributions and suggestions including localisation and enqueueing scripts and stylesheets
|
138 |
+
= 1.3 =
|
139 |
+
* Reinstated user-defined permalink field
|
140 |
+
= 1.25 =
|
141 |
+
* Minor admin update
|
142 |
+
= 1.24 =
|
143 |
+
* Fixed text alignment issue with Thesis framework (thanks to cavnit for pointing this one out)
|
144 |
+
= 1.23 =
|
145 |
+
* Minor admin update
|
146 |
+
= 1.22 =
|
147 |
+
* Minor admin update
|
148 |
+
|
149 |
+
= 1.21 =
|
150 |
+
* Added resources to Settings page
|
151 |
+
= 1.2 =
|
152 |
+
* Change title of Cookies page to Cookie Policy and removed option to change title
|
153 |
+
* Added trailing slash to Cookie Policy url (thanks to mikeotgaar for spotting this)
|
154 |
+
= 1.1 =
|
155 |
+
* Added default text to messages
|
156 |
+
== Upgrade Notice ==
|
157 |
Please note that the upgrade to version 2.x is significant. Although we've made every effort to ensure your settings are retained from previous versions, you may notice minor design differences to the notification bar.
|
uk-cookie-consent.php
CHANGED
@@ -1,63 +1,65 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Cookie Consent
|
4 |
-
Plugin URI: http://catapultthemes.com/cookie-consent/
|
5 |
-
Description: The only cookie consent plugin you'll ever need.
|
6 |
-
Version: 2.0
|
7 |
-
Author: Catapult_Themes
|
8 |
-
Author URI: http://catapultthemes.com/
|
9 |
-
Text Domain: uk-cookie-consent
|
10 |
-
Domain Path: /languages
|
11 |
-
*/
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
/**
|
17 |
-
* Define constants
|
18 |
-
**/
|
19 |
-
if ( ! defined( 'CTCC_PLUGIN_URL' ) ) {
|
20 |
-
define( 'CTCC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
21 |
-
}
|
22 |
-
if ( is_admin() ) {
|
23 |
-
require_once dirname( __FILE__ ) . '/admin/class-ctcc-admin.php';
|
24 |
-
$CTCC_Admin = new CTCC_Admin();
|
25 |
-
$CTCC_Admin -> init();
|
26 |
-
}
|
27 |
-
require_once dirname( __FILE__ ) . '/public/class-ctcc-public.php';
|
28 |
-
$CTCC_Public = new CTCC_Public();
|
29 |
-
$CTCC_Public -> init();
|
30 |
-
require_once dirname( __FILE__ ) . '/public/customizer.php';
|
31 |
-
function ctcc_load_plugin_textdomain() {
|
32 |
-
load_plugin_textdomain( 'uk-cookie-consent', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
|
33 |
-
}
|
34 |
-
add_action( 'plugins_loaded', 'ctcc_load_plugin_textdomain' );
|
35 |
-
|
36 |
-
|
37 |
-
*
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
$
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
$page['
|
51 |
-
$page['
|
52 |
-
$page['
|
53 |
-
$page['
|
54 |
-
$
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
63 |
register_activation_hook ( __FILE__, 'ctcc_create_policy_page' );
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Cookie Consent
|
4 |
+
Plugin URI: http://catapultthemes.com/cookie-consent/
|
5 |
+
Description: The only cookie consent plugin you'll ever need.
|
6 |
+
Version: 2.1.0
|
7 |
+
Author: Catapult_Themes
|
8 |
+
Author URI: http://catapultthemes.com/
|
9 |
+
Text Domain: uk-cookie-consent
|
10 |
+
Domain Path: /languages
|
11 |
+
*/
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
/**
|
17 |
+
* Define constants
|
18 |
+
**/
|
19 |
+
if ( ! defined( 'CTCC_PLUGIN_URL' ) ) {
|
20 |
+
define( 'CTCC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
21 |
+
}
|
22 |
+
if ( is_admin() ) {
|
23 |
+
require_once dirname( __FILE__ ) . '/admin/class-ctcc-admin.php';
|
24 |
+
$CTCC_Admin = new CTCC_Admin();
|
25 |
+
$CTCC_Admin -> init();
|
26 |
+
}
|
27 |
+
require_once dirname( __FILE__ ) . '/public/class-ctcc-public.php';
|
28 |
+
$CTCC_Public = new CTCC_Public();
|
29 |
+
$CTCC_Public -> init();
|
30 |
+
require_once dirname( __FILE__ ) . '/public/customizer.php';
|
31 |
+
function ctcc_load_plugin_textdomain() {
|
32 |
+
load_plugin_textdomain( 'uk-cookie-consent', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
|
33 |
+
}
|
34 |
+
add_action( 'plugins_loaded', 'ctcc_load_plugin_textdomain' );
|
35 |
+
|
36 |
+
/*
|
37 |
+
* Automatically create cookie policy page on activation
|
38 |
+
*
|
39 |
+
*/
|
40 |
+
function ctcc_create_policy_page() {
|
41 |
+
//Check to see if the info page has been created
|
42 |
+
$more_info_page = get_option ( 'ctcc_more_info_page' );
|
43 |
+
if ( empty ( $more_info_page ) ) { // The page hasn't been set yet
|
44 |
+
// Create the page parameters
|
45 |
+
$pagename = __( 'Cookie Policy', 'uk-cookie-consent' );
|
46 |
+
$content = __( 'This site uses cookies - small text files that are placed on your machine to help the site provide a better user experience. In general, cookies are used to retain user preferences, store information for things like shopping carts, and provide anonymised tracking data to third party applications like Google Analytics. As a rule, cookies will make your browsing experience better. However, you may prefer to disable cookies on this site and on others. The most effective way to do this is to disable cookies in your browser. We suggest consulting the Help section of your browser or taking a look at <a href="http://www.aboutcookies.org">the About Cookies website</a> which offers guidance for all modern browsers', 'uk-cookie-consent' );
|
47 |
+
$cpage = get_page_by_title ( $pagename ); // Double check there's not already a Cookie Policy page
|
48 |
+
if ( !$cpage ) {
|
49 |
+
global $user_ID;
|
50 |
+
$page['post_type'] = 'page';
|
51 |
+
$page['post_content'] = $content;
|
52 |
+
$page['post_parent'] = 0;
|
53 |
+
$page['post_author'] = $user_ID;
|
54 |
+
$page['post_status'] = 'publish';
|
55 |
+
$page['post_title'] = $pagename;
|
56 |
+
$pageid = wp_insert_post ( $page );
|
57 |
+
} else {
|
58 |
+
// There's already a page called Cookie Policy so we'll use that
|
59 |
+
$pageid = $cpage -> ID;
|
60 |
+
}
|
61 |
+
// Update the option
|
62 |
+
update_option ( 'ctcc_more_info_page', $pageid );
|
63 |
+
}
|
64 |
+
}
|
65 |
register_activation_hook ( __FILE__, 'ctcc_create_policy_page' );
|