Cookie Consent - Version 2.1.0

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 Icon 128x128 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 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
- public function add_js() {
43
- ?>
44
- <script>
45
- jQuery(document).ready(function($){
46
- $('.cctc-color-field').wpColorPicker();
47
- });
48
- </script>
49
- <?php
50
- }
51
-
52
- // Add the menu item
53
- public function add_admin_menu( ) {
54
- add_options_page ( __('Cookie Consent', 'uk-cookie-consent'), __('Cookie Consent', 'uk-cookie-consent'), 'manage_options', 'ctcc', array ( $this, 'options_page' ) );
55
- }
56
-
57
- public function register_options_init( ) {
58
-
59
- register_setting ( 'ctcc_options', 'ctcc_options_settings' );
60
-
61
- add_settings_section (
62
- 'ctcc_options_section',
63
- __( 'General settings', 'uk-cookie-consent' ),
64
- array ( $this, 'settings_section_callback' ),
65
- 'ctcc_options'
66
- );
67
-
68
- add_settings_field (
69
- 'closure',
70
- __( 'Close', 'uk-cookie-consent' ),
71
- array ( $this, 'closure_render' ),
72
- 'ctcc_options',
73
- 'ctcc_options_section'
74
- );
75
-
76
- add_settings_field (
77
- 'first_page',
78
- __( 'First Page Only', 'uk-cookie-consent' ),
79
- array ( $this, 'first_page_render' ),
80
- 'ctcc_options',
81
- 'ctcc_options_section'
82
- );
83
-
84
- add_settings_field (
85
- 'duration',
86
- __( 'Notification Duration', 'uk-cookie-consent' ),
87
- array ( $this, 'duration_render' ),
88
- 'ctcc_options',
89
- 'ctcc_options_section'
90
- );
91
-
92
- add_settings_field (
93
- 'cookie_expiry',
94
- __( 'Cookie Expiry', 'uk-cookie-consent' ),
95
- array ( $this, 'cookie_expiry_render' ),
96
- 'ctcc_options',
97
- 'ctcc_options_section'
98
- );
99
-
100
- add_settings_field (
101
- 'cookie_version',
102
- __( 'Cookie Version', 'uk-cookie-consent' ),
103
- array ( $this, 'cookie_version_render' ),
104
- 'ctcc_options',
105
- 'ctcc_options_section'
106
- );
107
-
108
- // Set default options
109
- $options = get_option ( 'ctcc_options_settings' );
110
- if ( false === $options ) {
111
- // Get defaults
112
- $defaults = $this -> get_default_options_settings();
113
- update_option ( 'ctcc_options_settings', $defaults );
114
- }
115
-
116
- }
117
-
118
- public function register_content_init() {
119
-
120
- register_setting ( 'ctcc_content', 'ctcc_content_settings' );
121
-
122
- add_settings_section (
123
- 'ctcc_content_section',
124
- __( 'Content settings', 'uk-cookie-consent' ),
125
- array ( $this, 'content_settings_section_callback' ),
126
- 'ctcc_content'
127
- );
128
-
129
- add_settings_field (
130
- 'heading_text',
131
- __( 'Heading Text', 'uk-cookie-consent' ),
132
- array ( $this, 'heading_text_render' ),
133
- 'ctcc_content',
134
- 'ctcc_content_section'
135
- );
136
-
137
- add_settings_field (
138
- 'notification_text',
139
- __( 'Notification Text', 'uk-cookie-consent' ),
140
- array ( $this, 'notification_text_render' ),
141
- 'ctcc_content',
142
- 'ctcc_content_section'
143
- );
144
-
145
- add_settings_field (
146
- 'more_info_text',
147
- __( 'More Info Text', 'uk-cookie-consent' ),
148
- array ( $this, 'more_info_text_render' ),
149
- 'ctcc_content',
150
- 'ctcc_content_section'
151
- );
152
-
153
- add_settings_field (
154
- 'more_info_page',
155
- __( 'More Info Page', 'uk-cookie-consent' ),
156
- array ( $this, 'more_info_page_render' ),
157
- 'ctcc_content',
158
- 'ctcc_content_section'
159
- );
160
-
161
- add_settings_field (
162
- 'more_info_url',
163
- __( 'More Info URL', 'uk-cookie-consent' ),
164
- array ( $this, 'more_info_url_render' ),
165
- 'ctcc_content',
166
- 'ctcc_content_section'
167
- );
168
-
169
- add_settings_field (
170
- 'more_info_target',
171
- __( 'More Info Target', 'uk-cookie-consent' ),
172
- array ( $this, 'more_info_target_render' ),
173
- 'ctcc_content',
174
- 'ctcc_content_section'
175
- );
176
-
177
- add_settings_field (
178
- 'accept_text',
179
- __( 'Accept Text', 'uk-cookie-consent' ),
180
- array ( $this, 'accept_text_render' ),
181
- 'ctcc_content',
182
- 'ctcc_content_section'
183
- );
184
-
185
- // Set default options
186
- $options = get_option ( 'ctcc_content_settings' );
187
- if ( false === $options ) {
188
- // Get defaults
189
- $defaults = $this -> get_default_content_settings();
190
- update_option ( 'ctcc_content_settings', $defaults );
191
- }
192
-
193
- }
194
-
195
- public function register_styles_init( ) {
196
-
197
- register_setting ( 'ctcc_styles', 'ctcc_styles_settings' );
198
-
199
- add_settings_section (
200
- 'ctcc_styles_section',
201
- __( 'Styles settings', 'uk-cookie-consent' ),
202
- array ( $this, 'styles_settings_section_callback' ),
203
- 'ctcc_styles'
204
- );
205
-
206
- add_settings_field (
207
- 'position',
208
- __( 'Position', 'uk-cookie-consent' ),
209
- array ( $this, 'position_render' ),
210
- 'ctcc_styles',
211
- 'ctcc_styles_section'
212
- );
213
-
214
- add_settings_field (
215
- 'container_class',
216
- __( 'Container Class', 'uk-cookie-consent' ),
217
- array ( $this, 'container_class_render' ),
218
- 'ctcc_styles',
219
- 'ctcc_styles_section'
220
- );
221
-
222
- add_settings_field (
223
- 'enqueue_styles',
224
- __( 'Include Stylesheet', 'uk-cookie-consent' ),
225
- array ( $this, 'enqueue_styles_render' ),
226
- 'ctcc_styles',
227
- 'ctcc_styles_section'
228
- );
229
-
230
- add_settings_field (
231
- 'rounded_corners',
232
- __( 'Rounded Corners', 'uk-cookie-consent' ),
233
- array ( $this, 'rounded_corners_render' ),
234
- 'ctcc_styles',
235
- 'ctcc_styles_section'
236
- );
237
-
238
- add_settings_field (
239
- 'drop_shadow',
240
- __( 'Drop Shadow', 'uk-cookie-consent' ),
241
- array ( $this, 'drop_shadow_render' ),
242
- 'ctcc_styles',
243
- 'ctcc_styles_section'
244
- );
245
-
246
- add_settings_field (
247
- 'display_accept_with_text',
248
- __( 'Display Button With Text', 'uk-cookie-consent' ),
249
- array ( $this, 'display_accept_with_text_render' ),
250
- 'ctcc_styles',
251
- 'ctcc_styles_section'
252
- );
253
-
254
- add_settings_field (
255
- 'x_close',
256
- __( 'Use X Close', 'uk-cookie-consent' ),
257
- array ( $this, 'x_close_render' ),
258
- 'ctcc_styles',
259
- 'ctcc_styles_section'
260
- );
261
-
262
- add_settings_field (
263
- 'text_color',
264
- __( 'Text Color', 'uk-cookie-consent' ),
265
- array ( $this, 'text_color_render' ),
266
- 'ctcc_styles',
267
- 'ctcc_styles_section'
268
- );
269
-
270
- add_settings_field (
271
- 'bg_color',
272
- __( 'Background Color', 'uk-cookie-consent' ),
273
- array ( $this, 'bg_color_render' ),
274
- 'ctcc_styles',
275
- 'ctcc_styles_section'
276
- );
277
-
278
- add_settings_field (
279
- 'link_color',
280
- __( 'Link Color', 'uk-cookie-consent' ),
281
- array ( $this, 'link_color_render' ),
282
- 'ctcc_styles',
283
- 'ctcc_styles_section'
284
- );
285
-
286
- add_settings_field (
287
- 'button_color',
288
- __( 'Button Color', 'uk-cookie-consent' ),
289
- array ( $this, 'button_color_render' ),
290
- 'ctcc_styles',
291
- 'ctcc_styles_section'
292
- );
293
-
294
- add_settings_field (
295
- 'button_bg_color',
296
- __( 'Button Background', 'uk-cookie-consent' ),
297
- array ( $this, 'button_bg_color_render' ),
298
- 'ctcc_styles',
299
- 'ctcc_styles_section'
300
- );
301
-
302
- add_settings_field (
303
- 'bg_color',
304
- __( 'Background Color', 'uk-cookie-consent' ),
305
- array ( $this, 'bg_color_render' ),
306
- 'ctcc_styles',
307
- 'ctcc_styles_section'
308
- );
309
-
310
- add_settings_field (
311
- 'flat_button',
312
- __( 'Flat Button', 'uk-cookie-consent' ),
313
- array ( $this, 'flat_button_render' ),
314
- 'ctcc_styles',
315
- 'ctcc_styles_section'
316
- );
317
-
318
- // Set default options
319
- $options = get_option ( 'ctcc_styles_settings' );
320
- if ( false === $options ) {
321
- // Get defaults
322
- $defaults = $this -> get_default_styles_settings();
323
- update_option ( 'ctcc_styles_settings', $defaults );
324
- }
325
-
326
- }
327
-
328
- public function get_default_options_settings() {
329
- $defaults = array (
330
- 'closure' => 'click',
331
- 'first_page' => 0,
332
- 'duration' => 60,
333
- 'cookie_expiry' => 30,
334
- 'cookie_version' => 1
335
- );
336
- return $defaults;
337
- }
338
-
339
- public function get_default_content_settings() {
340
-
341
- $previous_settings = get_option ( 'catapult_cookie_options' );
342
- // Check for settings from previous version
343
- if ( ! empty ( $previous_settings ) ) {
344
- $defaults = array (
345
- 'heading_text' => __( 'Cookies', 'uk-cookie-consent' ),
346
- 'notification_text' => $previous_settings['catapult_cookie_text_settings'],
347
- 'accept_text' => $previous_settings['catapult_cookie_accept_settings'],
348
- 'more_info_text' => $previous_settings['catapult_cookie_more_settings'],
349
- 'more_info_page' => '',
350
- 'more_info_url' => site_url ( $previous_settings['catapult_cookie_link_settings'] ),
351
- 'more_info_target' => '_blank',
352
- );
353
- } else {
354
- $defaults = array (
355
- 'heading_text' => __( 'Cookies', 'uk-cookie-consent' ),
356
- 'notification_text' => __( 'This site uses cookies: ', 'uk-cookie-consent' ),
357
- 'accept_text' => __( 'Okay, thanks', 'uk-cookie-consent' ),
358
- 'more_info_text' => __( 'Find out more.', 'uk-cookie-consent' ),
359
- 'more_info_page' => get_option( 'ctcc_more_info_page', '' ),
360
- 'more_info_url' => '',
361
- 'more_info_target' => '_blank',
362
- );
363
- }
364
- return $defaults;
365
-
366
- }
367
-
368
- public function get_default_styles_settings() {
369
- $previous_settings = get_option ( 'catapult_cookie_options' );
370
- $defaults = array (
371
- 'position' => 'top-bar',
372
- 'container_class' => '',
373
- 'enqueue_styles' => 1,
374
- 'rounded_corners' => 1,
375
- 'drop_shadow' => 1,
376
- 'display_accept_with_text' => 1,
377
- 'x_close' => 0,
378
- 'text_color' => '#ddd',
379
- 'bg_color' => '#464646',
380
- 'link_color' => '#fff',
381
- 'button_color' => '',
382
- 'button_bg_color' => '',
383
- 'flat_button' => 1,
384
- );
385
- // Check for settings from previous version
386
-
387
- if ( ! empty ( $previous_settings['catapult_cookie_bar_position_settings'] ) ) {
388
- $defaults['position'] = $previous_settings['catapult_cookie_bar_position_settings'] . '-bar';
389
- }
390
-
391
- if ( ! empty ( $previous_settings['catapult_cookie_text_colour_settings'] ) ) {
392
- $defaults['text_color'] = $previous_settings['catapult_cookie_text_colour_settings'];
393
- }
394
-
395
- if ( ! empty ( $previous_settings['catapult_cookie_bg_colour_settings'] ) ) {
396
- $defaults['bg_color'] = $previous_settings['catapult_cookie_bg_colour_settings'];
397
- }
398
-
399
- if ( ! empty ( $previous_settings['catapult_cookie_link_colour_settings'] ) ) {
400
- $defaults['link_color'] = $previous_settings['catapult_cookie_link_colour_settings'];
401
- }
402
-
403
- if ( ! empty ( $previous_settings['catapult_cookie_link_colour_settings'] ) ) {
404
- $defaults['link_color'] = $previous_settings['catapult_cookie_link_colour_settings'];
405
- }
406
-
407
- if ( ! empty ( $previous_settings['catapult_cookie_button_colour_settings'] ) ) {
408
- $defaults['button_bg_color'] = $previous_settings['catapult_cookie_button_colour_settings'];
409
- }
410
-
411
- return $defaults;
412
-
413
- }
414
-
415
- public function closure_render() {
416
- $options = get_option( 'ctcc_options_settings' ); ?>
417
- <select name='ctcc_options_settings[closure]'>
418
- <option value='click' <?php selected( $options['closure'], 'click' ); ?>><?php _e ( 'On Click', 'uk-cookie-consent' ); ?></option>
419
- <option value='timed' <?php selected( $options['closure'], 'timed' ); ?>><?php _e ( 'Timed', 'uk-cookie-consent' ); ?></option>
420
- </select>
421
- <p class="description"><?php _e ( 'How you want the user to close the notification', 'uk-cookie-consent' ); ?></p>
422
- <?php
423
- }
424
-
425
- public function first_page_render() {
426
- $options = get_option( 'ctcc_options_settings' ); ?>
427
- <input type='checkbox' name='ctcc_options_settings[first_page]' <?php checked ( ! empty ( $options['first_page'] ), 1 ); ?> value='1'>
428
- <p class="description"><?php _e ( 'Select this to show the notification only on the first page the user visits', 'uk-cookie-consent' ); ?></p>
429
- <?php
430
- }
431
-
432
- public function duration_render() {
433
- $options = get_option( 'ctcc_options_settings' ); ?>
434
- <input type="number" min="1" name="ctcc_options_settings[duration]" value="<?php echo $options['duration']; ?>">
435
- <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>
436
- <?php
437
- }
438
-
439
- public function cookie_expiry_render() {
440
- $options = get_option( 'ctcc_options_settings' ); ?>
441
- <input type="number" min="1" name="ctcc_options_settings[cookie_expiry]" value="<?php echo $options['cookie_expiry']; ?>">
442
- <p class="description"><?php _e ( 'The number of days that the cookie is set for', 'uk-cookie-consent' ); ?></p>
443
- <?php
444
- }
445
-
446
- public function cookie_version_render() {
447
- $options = get_option( 'ctcc_options_settings' ); ?>
448
- <input type="text" name="ctcc_options_settings[cookie_version]" value="<?php echo $options['cookie_version']; ?>">
449
- <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>
450
- <?php
451
- }
452
-
453
- /*
454
- * Content renders
455
- */
456
-
457
- public function heading_text_render() {
458
- $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
459
- <input type="text" name="ctcc_content_settings[heading_text]" value="<?php echo $ctcc_content_settings['heading_text']; ?>">
460
- <p class="description"><?php _e ( 'The heading text - only applies if you are not using a top or bottom bar', 'uk-cookie-consent' ); ?></p>
461
- <?php
462
- }
463
-
464
- public function notification_text_render() {
465
- $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
466
- <input type="text" name="ctcc_content_settings[notification_text]" value="<?php echo $ctcc_content_settings['notification_text']; ?>">
467
- <p class="description"><?php _e ( 'The default text to indicate that your site uses cookies', 'uk-cookie-consent' ); ?></p>
468
- <?php
469
- }
470
-
471
- public function accept_text_render() {
472
- $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
473
- <input type="text" name="ctcc_content_settings[accept_text]" value="<?php echo $ctcc_content_settings['accept_text']; ?>">
474
- <p class="description"><?php _e ( 'The default text to dismiss the notification', 'uk-cookie-consent' ); ?></p>
475
- <?php
476
- }
477
-
478
- public function more_info_text_render() {
479
- $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
480
- <input type="text" name="ctcc_content_settings[more_info_text]" value="<?php echo $ctcc_content_settings['more_info_text']; ?>">
481
- <p class="description"><?php _e ( 'The default text to use to link to a page providing further information', 'uk-cookie-consent' ); ?></p>
482
- <?php
483
- }
484
-
485
- public function more_info_page_render() {
486
- $ctcc_content_settings = get_option( 'ctcc_content_settings' );
487
- // Get all pages
488
- $pages = get_pages();
489
- ?>
490
- <?php if ( $pages ) { ?>
491
- <select name='ctcc_content_settings[more_info_page]'>
492
- <option></option>
493
- <?php foreach ( $pages as $page ) { ?>
494
- <option value='<?php echo $page -> ID; ?>' <?php selected( $ctcc_content_settings['more_info_page'], $page -> ID ); ?>><?php echo $page -> post_title; ?></option>
495
- <?php } ?>
496
- </select>
497
- <p class="description"><?php _e ( 'The page containing further information about your cookie policy', 'discussion-board' ); ?></p>
498
- <?php }
499
- }
500
-
501
- public function more_info_url_render() {
502
- $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
503
- <input type="url" name="ctcc_content_settings[more_info_url]" value="<?php echo $ctcc_content_settings['more_info_url']; ?>">
504
- <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>
505
- <?php
506
- }
507
-
508
- public function more_info_target_render() {
509
- $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
510
- <select name='ctcc_content_settings[more_info_target]'>
511
- <option value='_blank' <?php selected( $ctcc_content_settings['more_info_target'], '_blank' ); ?>><?php _e ( 'New Tab', 'uk-cookie-consent' ); ?></option>
512
- <option value='_self' <?php selected( $ctcc_content_settings['more_info_target'], '_self' ); ?>><?php _e ( 'Same Tab', 'uk-cookie-consent' ); ?></option>
513
- </select>
514
- <p class="description"><?php _e ( 'Open the More Information page in the same or new tab.', 'uk-cookie-consent' ); ?></p>
515
- <?php
516
- }
517
-
518
- /*
519
- * Styles functions
520
- */
521
-
522
- public function position_render() {
523
- $options = get_option( 'ctcc_styles_settings' ); ?>
524
- <select name='ctcc_styles_settings[position]'>
525
- <option value='top-bar' <?php selected( $options['position'], 'top-bar' ); ?>><?php _e ( 'Top Bar', 'uk-cookie-consent' ); ?></option>
526
- <option value='bottom-bar' <?php selected( $options['position'], 'bottom-bar' ); ?>><?php _e ( 'Bottom Bar', 'uk-cookie-consent' ); ?></option>
527
- <option value='top-left-block' <?php selected( $options['position'], 'top-left-block' ); ?>><?php _e ( 'Top Left Block', 'uk-cookie-consent' ); ?></option>
528
- <option value='top-right-block' <?php selected( $options['position'], 'top-right-block' ); ?>><?php _e ( 'Top Right Block', 'uk-cookie-consent' ); ?></option>
529
- <option value='bottom-left-block' <?php selected( $options['position'], 'bottom-left-block' ); ?>><?php _e ( 'Bottom Left Block', 'uk-cookie-consent' ); ?></option>
530
- <option value='bottom-right-block' <?php selected( $options['position'], 'bottom-right-block' ); ?>><?php _e ( 'Bottom Right Block', 'uk-cookie-consent' ); ?></option>
531
- </select>
532
- <p class="description"><?php _e ( 'Where the notification should appear', 'uk-cookie-consent' ); ?></p>
533
- <?php
534
- }
535
-
536
- public function container_class_render() {
537
- $options = get_option( 'ctcc_styles_settings' ); ?>
538
- <input type="text" name="ctcc_styles_settings[container_class]" value="<?php echo $options['container_class']; ?>">
539
- <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>
540
- <?php
541
- }
542
-
543
- public function enqueue_styles_render() {
544
- $options = get_option( 'ctcc_styles_settings' ); ?>
545
- <input type='checkbox' name='ctcc_styles_settings[enqueue_styles]' <?php checked ( ! empty ( $options['enqueue_styles'] ), 1 ); ?> value='1'>
546
- <p class="description"><?php _e ( 'Deselect this to dequeue the plugin stylesheet', 'uk-cookie-consent' ); ?></p>
547
- <?php
548
- }
549
-
550
- public function rounded_corners_render() {
551
- $options = get_option( 'ctcc_styles_settings' ); ?>
552
- <input type='checkbox' name='ctcc_styles_settings[rounded_corners]' <?php checked ( ! empty ( $options['rounded_corners'] ), 1 ); ?> value='1'>
553
- <p class="description"><?php _e ( 'Round the corners on the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
554
- <?php
555
- }
556
-
557
- public function drop_shadow_render() {
558
- $options = get_option( 'ctcc_styles_settings' ); ?>
559
- <input type='checkbox' name='ctcc_styles_settings[drop_shadow]' <?php checked ( ! empty ( $options['drop_shadow'] ), 1 ); ?> value='1'>
560
- <p class="description"><?php _e ( 'Add drop shadow to the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
561
- <?php
562
- }
563
-
564
- public function display_accept_with_text_render() {
565
- $options = get_option( 'ctcc_styles_settings' ); ?>
566
- <input type='checkbox' name='ctcc_styles_settings[display_accept_with_text]' <?php checked ( ! empty ( $options['display_accept_with_text'] ), 1 ); ?> value='1'>
567
- <p class="description"><?php _e ( 'Display the confirmation button with notification text', 'uk-cookie-consent' ); ?></p>
568
- <?php
569
- }
570
-
571
- public function x_close_render() {
572
- $options = get_option( 'ctcc_styles_settings' ); ?>
573
- <input type='checkbox' name='ctcc_styles_settings[x_close]' <?php checked ( ! empty ( $options['x_close'] ), 1 ); ?> value='1'>
574
- <p class="description"><?php _e ( 'Remove confirmation button and use \'X\' icon instead', 'uk-cookie-consent' ); ?></p>
575
- <?php
576
- }
577
-
578
- public function text_color_render() {
579
- $options = get_option( 'ctcc_styles_settings' ); ?>
580
- <input type="text" class="cctc-color-field" name="ctcc_styles_settings[text_color]" value="<?php echo $options['text_color']; ?>">
581
- <p class="description"><?php _e ( 'The text color on the notification', 'uk-cookie-consent' ); ?></p>
582
- <?php
583
- }
584
-
585
- public function bg_color_render() {
586
- $options = get_option( 'ctcc_styles_settings' ); ?>
587
- <input type="text" class="cctc-color-field" name="ctcc_styles_settings[bg_color]" value="<?php echo $options['bg_color']; ?>">
588
- <p class="description"><?php _e ( 'The background color for the notification', 'uk-cookie-consent' ); ?></p>
589
- <?php
590
- }
591
-
592
- public function link_color_render() {
593
- $options = get_option( 'ctcc_styles_settings' ); ?>
594
- <input type="text" class="cctc-color-field" name="ctcc_styles_settings[link_color]" value="<?php echo $options['link_color']; ?>">
595
- <p class="description"><?php _e ( 'The link color on the notification', 'uk-cookie-consent' ); ?></p>
596
- <?php
597
- }
598
-
599
- public function button_color_render() {
600
- $options = get_option( 'ctcc_styles_settings' ); ?>
601
- <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_color]" value="<?php echo $options['button_color']; ?>">
602
- <p class="description"><?php _e ( 'The text color on the notification button', 'uk-cookie-consent' ); ?></p>
603
- <?php
604
- }
605
-
606
- public function button_bg_color_render() {
607
- $options = get_option( 'ctcc_styles_settings' ); ?>
608
- <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_bg_color]" value="<?php echo $options['button_bg_color']; ?>">
609
- <p class="description"><?php _e ( 'The background color on the notification button', 'uk-cookie-consent' ); ?></p>
610
- <?php
611
- }
612
-
613
- public function flat_button_render() {
614
- $options = get_option( 'ctcc_styles_settings' ); ?>
615
- <input type='checkbox' name='ctcc_styles_settings[flat_button]' <?php checked ( ! empty ( $options['flat_button'] ), 1 ); ?> value='1'>
616
- <p class="description"><?php _e ( 'Remove the border from the button', 'uk-cookie-consent' ); ?></p>
617
- <?php
618
- }
619
-
620
- public function settings_section_callback() {
621
- echo __( '<p>Basic settings</p>', 'uk-cookie-consent' );
622
- }
623
-
624
- public function content_settings_section_callback() {
625
- echo __( '<p>Update the content displayed to the user</p>', 'uk-cookie-consent' );
626
- }
627
-
628
- public function styles_settings_section_callback() {
629
- echo __( '<p>Change the styles here if you like - but it\'s better in the Customizer</p>', 'uk-cookie-consent' );
630
- }
631
-
632
- public function options_page() {
633
- $reset = isset ( $_GET['reset'] ) ? $_GET['reset'] : '';
634
- if ( isset ( $_POST['reset'] ) ) {
635
-
636
- $defaults = $this -> get_default_styles_settings();
637
- update_option ( 'ctcc_styles_settings', $defaults );
638
-
639
- $defaults = $this -> get_default_content_settings();
640
- update_option ( 'ctcc_content_settings', $defaults );
641
-
642
- }
643
- $current = isset ( $_GET['tab'] ) ? $_GET['tab'] : 'options';
644
- $title = __( 'Cookie Consent', 'uk-cookie-consent' );
645
- $tabs = array (
646
- 'options' => __( 'General', 'uk-cookie-consent' ),
647
- 'content' => __( 'Content', 'uk-cookie-consent' ),
648
- 'styles' => __( 'Styles', 'uk-cookie-consent' )
649
- );?>
650
-
651
- <div class="wrap">
652
- <h1><?php echo $title; ?></h1>
653
- <div class="ctdb-outer-wrap">
654
- <div class="ctdb-inner-wrap">
655
- <h2 class="nav-tab-wrapper">
656
- <?php foreach( $tabs as $tab => $name ) {
657
- $class = ( $tab == $current ) ? ' nav-tab-active' : '';
658
- echo "<a class='nav-tab$class' href='?page=ctcc&tab=$tab'>$name</a>";
659
- } ?>
660
- </h2>
661
- <form action='options.php' method='post'>
662
- <?php
663
- settings_fields( 'ctcc_' . strtolower ( $current ) );
664
- do_settings_sections( 'ctcc_' . strtolower ( $current ) );
665
- submit_button();
666
- ?>
667
- </form>
668
- <form method="post" action="">
669
- <p class="submit">
670
- <input name="reset" class="button button-secondary" type="submit" value="<?php _e ( 'Reset plugin defaults', 'uk-cookie-consent' ); ?>" >
671
- <input type="hidden" name="action" value="reset" />
672
- </p>
673
- </form>
674
- </div><!-- .ctdb-inner-wrap -->
675
- <div class="ctdb-banners">
676
- <div class="ctdb-banner">
677
- <a href="//catapultthemes.com/downloads/mode">
678
- <img src="<?php echo CTCC_PLUGIN_URL . 'assets/images/mode-3d-banner.jpg'; ?>" alt="" >
679
- </a>
680
- </div>
681
- <a href="//catapultthemes.com/downloads/hero">
682
- <img src="<?php echo CTCC_PLUGIN_URL . 'assets/images/hero-3d-banner.jpg'; ?>" alt="" >
683
- </a>
684
- </div>
685
- </div>
686
- </div><!-- .ctdb-outer-wrap -->
687
- </div><!-- .wrap -->
688
- <?php
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: -5px;
87
  top: 50%;
88
- top: calc(50% - 10px);
89
- }
90
- .use_x_close .x_close:after {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  position: absolute;
92
- top: 0;
93
- bottom: 0;
94
- left: 0;
95
- right: 0;
96
- content: "\274c";
97
- font-size: 10px;
98
- color: #fff;
99
- line-height: 20px;
100
- text-align: center;
101
- }
102
- .x_close:hover{
103
- transform: rotate(90deg);
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
- * Enqueue styles and scripts
22
- * @since 2.0.0
23
- */
24
- public function enqueue_scripts() {
25
- $ctcc_options_settings = get_option ( 'ctcc_options_settings' );
26
- $options = get_option ( 'ctcc_styles_settings' );
27
- if ( isset ( $options['enqueue_styles'] ) ) {
28
- wp_enqueue_style ( 'cookie-consent-style', CTCC_PLUGIN_URL . 'assets/css/style.css', '2.0.0' );
29
- }
30
- wp_enqueue_script ( 'cookie-consent', CTCC_PLUGIN_URL . 'assets/js/uk-cookie-consent-js.js', array ( 'jquery' ), '2.0.0', true );
31
- wp_localize_script (
32
- 'cookie-consent',
33
- 'ctcc_vars',
34
- array (
35
- 'expiry' => $ctcc_options_settings['cookie_expiry'],
36
- 'method' => isset ( $ctcc_options_settings['first_page'] ),
37
- 'version' => $ctcc_options_settings['cookie_version'],
38
- )
39
- );
40
- }
41
-
42
- /*
43
- * Add some CSS to the header
44
- * @since 2.0.0
45
- */
46
- public function add_css() {
47
- $options = get_option ( 'ctcc_options_settings' );
48
- $ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
49
- $position_css = 'position: fixed;
50
- left: 0;
51
- top: 0;
52
- width: 100%;';
53
- // Figure out the bar position
54
- if ( $ctcc_styles_settings['position'] == 'top-bar' ) {
55
- $position_css = 'position: fixed;
56
- left: 0;
57
- top: 0;
58
- width: 100%;';
59
- } else if ( $ctcc_styles_settings['position'] == 'bottom-bar' ) {
60
- $position_css = 'position: fixed;
61
- left: 0;
62
- bottom: 0;
63
- width: 100%;';
64
- } else if ( $ctcc_styles_settings['position'] == 'top-right-block' ) {
65
- $position_css = 'position: fixed;
66
- right: 20px;
67
- top: 6%;
68
- width: 300px;';
69
- } else if ( $ctcc_styles_settings['position'] == 'top-left-block' ) {
70
- $position_css = 'position: fixed;
71
- left: 20px;
72
- top: 6%;
73
- width: 300px;';
74
- } else if ( $ctcc_styles_settings['position'] == 'bottom-left-block' ) {
75
- $position_css = 'position: fixed;
76
- left: 20px;
77
- bottom: 6%;
78
- width: 300px;';
79
- } else if ( $ctcc_styles_settings['position'] == 'bottom-right-block' ) {
80
- $position_css = 'position: fixed;
81
- right: 20px;
82
- bottom: 6%;
83
- width: 300px;';
84
- }
85
- // Get our styles
86
- $text_color = $ctcc_styles_settings['text_color'];
87
- $position = 'top';
88
- $bg_color = $ctcc_styles_settings['bg_color'];
89
- $link_color = $ctcc_styles_settings['link_color'];
90
- $button_bg = $ctcc_styles_settings['button_bg_color'];
91
- $button_color = $ctcc_styles_settings['button_color'];
92
- if ( ! empty ( $ctcc_styles_settings['flat_button'] ) ){
93
- $button_style = 'border: 0; padding: 6px 9px; border-radius: 3px;';
94
- } else {
95
- $button_style = '';
96
- }
97
- // Build our CSS
98
- $css = '<style id="ctcc-css" type="text/css" media="screen">';
99
- $css .= '
100
- #catapult-cookie-bar {
101
- box-sizing: border-box;
102
- max-height: 0;
103
- opacity: 0;
104
- z-index: 99999;
105
- overflow: hidden;
106
- color: ' . $text_color . ';
107
- ' . $position_css . '
108
- background-color: ' . $bg_color . ';
109
- }
110
- #catapult-cookie-bar a {
111
- color: ' . $link_color . ';
112
- }
113
- button#catapultCookie {
114
- background:' . $button_bg . ';
115
- color: ' . $button_color . ';
116
- ' . $button_style . '
117
- }
118
- #catapult-cookie-bar h3 {
119
- color: ' . $text_color . ';
120
- }
121
- .has-cookie-bar #catapult-cookie-bar {
122
- opacity: 1;
123
- max-height: 999px;
124
- min-height: 30px;
125
- }';
126
- $css .= '</style>';
127
- echo $css;
128
- // Add it to the header
129
- }
130
-
131
- /*
132
- * Add some JS to the footer
133
- * @since 2.0.0
134
- */
135
- public function add_js() {
136
-
137
- $options = get_option( 'ctcc_options_settings' );
138
- $ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
139
-
140
- if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
141
- $type = 'bar';
142
- } else {
143
- $type = 'block';
144
- } ?>
145
-
146
- <script type="text/javascript">
147
- jQuery(document).ready(function($){
148
- <?php if ( isset ( $_GET['cookie'] ) ) { ?>
149
- catapultDeleteCookie('catAccCookies');
150
- <?php } ?>
151
- if(!catapultReadCookie("catAccCookies")){ // If the cookie has not been set then show the bar
152
- $("html").addClass("has-cookie-bar");
153
- $("html").addClass("cookie-bar-<?php echo $ctcc_styles_settings['position']; ?>");
154
- $("html").addClass("cookie-bar-<?php echo $type; ?>");
155
- <?php // Move the HTML down if the bar is at the top
156
- if ( $ctcc_styles_settings['position'] == 'top-bar' ) {
157
- ?>
158
- // Wait for the animation on the html to end before recalculating the required top margin
159
- $("html").on('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) {
160
- // code to execute after transition ends
161
- var barHeight = $('#catapult-cookie-bar').outerHeight();
162
- $("html").css("margin-top",barHeight);
163
- $("body.admin-bar").css("margin-top",barHeight-32); // Push the body down if the admin bar is active
164
- });
165
- <?php } ?>
166
- }
167
- <?php if ( $options['closure'] == 'timed' ) {
168
- // Add some script if it's on a timer
169
- $duration = absint($options['duration']) * 1000; ?>
170
- setTimeout(ctccCloseNotification, <?php echo $duration; ?>);
171
- <?php } ?>
172
- <?php if ( ! empty ( $options['first_page'] ) ) {
173
- // Add some script if the notification only displays on the first page ?>
174
- ctccFirstPage();
175
- <?php } ?>
176
- });
177
- </script>
178
-
179
- <?php }
180
-
181
- /*
182
- * Add the notification bar itself
183
- * @since 2.0.0
184
- */
185
- public function add_notification_bar() {
186
-
187
- $ctcc_options_settings = get_option ( 'ctcc_options_settings' );
188
- $ctcc_content_settings = get_option ( 'ctcc_content_settings' );
189
- $ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
190
-
191
- // Check if it's a block or a bar
192
- $is_block = true;
193
- if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
194
- $is_block = false; // It's a bar
195
- }
196
-
197
- // Add some classes to the block
198
- $classes = '';
199
- if ( $is_block ) {
200
- if ( ! empty ( $ctcc_styles_settings['rounded_corners'] ) ) {
201
- $classes .= ' rounded-corners';
202
- }
203
- if ( ! empty ( $ctcc_styles_settings['drop_shadow'] ) ) {
204
- $classes .= ' drop-shadow';
205
- }
206
- }
207
- if ( ! empty ( $ctcc_styles_settings['x_close'] ) ) {
208
- $classes .= ' use_x_close';
209
- }
210
- if ( empty ( $ctcc_styles_settings['display_accept_with_text'] ) ) {
211
- $classes .= ' float-accept';
212
- }
213
-
214
- // Allowed tags
215
- $allowed = array (
216
- 'a' => array (
217
- 'href' => array(),
218
- 'title' => array()
219
- ),
220
- 'br' => array(),
221
- 'em' => array(),
222
- 'strong' => array(),
223
- 'p' => array()
224
- );
225
-
226
- $content = '';
227
- $close_content = '';
228
-
229
- // Print the notification bar
230
- $content = '<div id="catapult-cookie-bar" class="' . $classes . '">';
231
-
232
- // Add a custom wrapper class if specified
233
- if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
234
- $content .= '<div class="ctcc-inner ' . esc_attr ( str_replace ( '.', '', $ctcc_styles_settings['container_class'] ) ) . '">';
235
- $close_content = '</div><!-- custom wrapper class -->';
236
- }
237
-
238
- // Add a title if it's a block
239
- if ( $ctcc_styles_settings['position'] != 'top-bar' && $ctcc_styles_settings['position'] != 'bottom-bar' ) {
240
- $content .= sprintf ( '<h3>%s</h3>',
241
- wp_kses ( $ctcc_content_settings['heading_text'], $allowed )
242
- );
243
- }
244
-
245
- // Make the Read More link
246
- $more_text = '';
247
- if ( $ctcc_content_settings['more_info_text'] ) {
248
- // Find what page we're linking to
249
- if ( ! empty ( $ctcc_content_settings['more_info_url'] ) ) {
250
- // Check the absolute URL first
251
- $link = $ctcc_content_settings['more_info_url'];
252
- } else {
253
- // Use the internal page
254
- $link = get_permalink ( $ctcc_content_settings['more_info_page'] );
255
- }
256
- $more_text = sprintf (
257
- '<a tabindex=1 target="%s" href="%s">%s</a>',
258
- esc_attr ( $ctcc_content_settings['more_info_target'] ),
259
- esc_url ( $link ),
260
- wp_kses ( $ctcc_content_settings['more_info_text'], $allowed )
261
- );
262
- }
263
-
264
- $button_text = '';
265
- if ( empty ( $ctcc_styles_settings['x_close'] ) ) {
266
- $button_text = sprintf (
267
- '<button id="catapultCookie" tabindex=1 onclick="catapultAcceptCookies();">%s</button>',
268
- wp_kses ( $ctcc_content_settings['accept_text'], $allowed )
269
- );
270
- }
271
-
272
- // The main bar content
273
- $content .= sprintf (
274
- '<span class="ctcc-left-side">%s %s</span><span class="ctcc-right-side">%s</span>',
275
- wp_kses ( $ctcc_content_settings['notification_text'], $allowed ),
276
- $more_text,
277
- $button_text
278
- );
279
-
280
- // X close button
281
- if ( ! empty ( $ctcc_styles_settings['x_close'] ) ) {
282
- $content .= '<div class="x_close"></div>';
283
- }
284
-
285
- // Close custom wrapper class if used
286
- $content .= $close_content;
287
-
288
- $content .= '</div><!-- #catapult-cookie-bar -->';
289
-
290
- echo apply_filters ( 'catapult_cookie_content', $content, $ctcc_content_settings );
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.5.2
7
- Stable tag: 2.0.12
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
- = 2.0.12 =
58
- * Fixed: added flex-shrink: 0 to prevent button overflowing container on mobile
59
- = 2.0.11 =
60
- * Fixed: syntax error in class-ctcc-public.php
61
- = 2.0.10 =
62
- * Added: priority on add_js
63
- = 2.0.9 =
64
- * Fixed: prevent JavaScript conflict by calling color picker script on non-plugin pages
65
- = 2.0.8 =
66
- * Updated: admin images in assets folder
67
- = 2.0.7 =
68
- * Added: Slovakian translation (thanks to lacike)
69
- = 2.0.6 =
70
- * Added: flat button option
71
- * Added: Russian translation
72
- = 2.0.5 =
73
- * Fixed: notification hides correctly when stylesheet is dequeued
74
- = 2.0.4 =
75
- * Added: Polish translation (thanks to jraczynski for all items in this update)
76
- * Updated: .pot file generated with l18n tool
77
- * Updated: correct text domain in customizer.php
78
- * Updated: removed spaces in translator functions
79
- * Updated: plugin name translatable
80
- = 2.0.3 =
81
- * Fixed: more_info_target option not saving
82
- * Fixed: button text getting cropped
83
- * Changed: default position of accept button with notification text
84
- = 2.0.2 =
85
- * Fixed: retain settings from previous version
86
- = 2.0.1 =
87
- * Fixed: admin formatting
88
- = 2.0.0 =
89
- * Major rewrite
90
- * Added: Choice of dismissal method - either on click by the user or timed
91
- * Added: Choice of dismissal element - either button or 'x' close
92
- * Added: Option to show the notification on the first page only - subsequent pages visited by the user will not display the message
93
- * Added: Choice of position - either top or bottom bar, or floating in one of the corners of the screen
94
- * Changed: Better translation support
95
- * Changed: Better responsive support
96
- * Changed: More customization options - including the ability to update styles from within the customizer
97
- * Changed: Inherits your theme styles where possible
98
- * Changed: The option to use an absolute or external URL to link to for further information
99
- * Added: Set the cookie duration
100
- * Added: Set the cookie version - updating a version will reset the cookie on all user sites
101
- = 1.8.2 =
102
- * Admin update
103
-
104
- = 1.8.1 =
105
- * Fixed empty space at top of screen when bar is located at the bottom of screen
106
- = 1.8 =
107
- * Move HTML down to accommodate notification bar rather than obscuring content
108
- * Enqueues JS in footer
109
- * Improved translation support
110
- = 1.7.1 =
111
- * Ready for WP 3.8
112
- = 1.7 =
113
- * Updates to settings page
114
- = 1.6 =
115
- * Moved JS to footer (thanks to Andreas Larsen for the suggestion)
116
- = 1.5 =
117
- * Switched the logic so that the bar is initially hidden on the page and only displays if user has not previously dismissed it.
118
- * Gives a slightly better performance.
119
- * Thanks to chrisHe for the suggestion.
120
- = 1.4.2. =
121
- * Policy page created on register_activation_hook now
122
- = 1.4.1 =
123
- * Tweak to ensure jQuery is a dependency
124
- = 1.4 =
125
- * 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.
126
- * Added configuration options for colour and position of bar.
127
- * Set notification button and link to first element in tab list.
128
- * Thanks to husobj for contributions and suggestions including localisation and enqueueing scripts and stylesheets
129
- = 1.3 =
130
- * Reinstated user-defined permalink field
131
- = 1.25 =
132
- * Minor admin update
133
- = 1.24 =
134
- * Fixed text alignment issue with Thesis framework (thanks to cavnit for pointing this one out)
135
- = 1.23 =
136
- * Minor admin update
137
- = 1.22 =
138
- * Minor admin update
139
-
140
- = 1.21 =
141
- * Added resources to Settings page
142
- = 1.2 =
143
- * Change title of Cookies page to Cookie Policy and removed option to change title
144
- * Added trailing slash to Cookie Policy url (thanks to mikeotgaar for spotting this)
145
- = 1.1 =
146
- * Added default text to messages
147
- == Upgrade Notice ==
 
 
 
 
 
 
 
 
 
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.12
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
- * Automatically create cookie policy page on activation
37
- *
38
- */
39
- function ctcc_create_policy_page() {
40
- //Check to see if the info page has been created
41
- $more_info_page = get_option ( 'ctcc_more_info_page' );
42
- if ( empty ( $more_info_page ) ) { // The page hasn't been set yet
43
- // Create the page parameters
44
- $pagename = __( 'Cookie Policy', 'uk-cookie-consent' );
45
- $cpage = get_page_by_title ( $pagename ); // Double check there's not already a Cookie Policy page
46
- if ( !$cpage ) {
47
- global $user_ID;
48
- $page['post_type'] = 'page';
49
- $page['post_content'] = $content;
50
- $page['post_parent'] = 0;
51
- $page['post_author'] = $user_ID;
52
- $page['post_status'] = 'publish';
53
- $page['post_title'] = $pagename;
54
- $pageid = wp_insert_post ( $page );
55
- } else {
56
- // There's already a page called Cookie Policy so we'll use that
57
- $pageid = $cpage -> ID;
58
- }
59
- // Update the option
60
- update_option ( 'ctcc_more_info_page', $pageid );
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' );