Cookie Consent - Version 2.3.10

Version Description

  • Fixed: fixed security vulnerability identified by James Boughey
Download this release

Release Info

Developer Catapult_Themes
Plugin Icon 128x128 Cookie Consent
Version 2.3.10
Comparing to
See all releases

Code changes from version 2.3.9 to 2.3.10

Files changed (3) hide show
  1. admin/class-ctcc-admin.php +263 -265
  2. readme.txt +9 -5
  3. uk-cookie-consent.php +1 -1
admin/class-ctcc-admin.php CHANGED
@@ -18,24 +18,24 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
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
  add_action( 'admin_init', array( $this, 'save_registered_setting' ) );
36
-
37
  }
38
-
39
  /**
40
  * We save this artificially to let the tracker know that we're allowed to export this option's data
41
  */
@@ -50,7 +50,7 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
50
  wp_enqueue_script ( 'wp-color-picker', false, array ( 'jquery' ) );
51
  wp_enqueue_style ( 'ctcc-admin-style', CTCC_PLUGIN_URL . 'assets/css/admin-style.css' );
52
  }
53
-
54
  public function add_js() {
55
  $screen = get_current_screen();
56
  if ( $screen -> id == 'settings_page_ctcc' ) {
@@ -62,95 +62,95 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
62
  </script>
63
  <?php }
64
  }
65
-
66
  // Add the menu item
67
- public function add_admin_menu( ) {
68
  add_options_page ( __('Cookie Consent', 'uk-cookie-consent'), __('Cookie Consent', 'uk-cookie-consent'), 'manage_options', 'ctcc', array ( $this, 'options_page' ) );
69
  }
70
-
71
  public function register_options_init( ) {
72
-
73
  register_setting ( 'ctcc_options', 'ctcc_options_settings' );
74
-
75
  add_settings_section (
76
- 'ctcc_options_section',
77
- __( 'General settings', 'uk-cookie-consent' ),
78
- array ( $this, 'settings_section_callback' ),
79
  'ctcc_options'
80
  );
81
-
82
- add_settings_field (
83
- 'closure',
84
- __( 'Close', 'uk-cookie-consent' ),
85
  array ( $this, 'closure_render' ),
86
- 'ctcc_options',
87
  'ctcc_options_section'
88
  );
89
-
90
- add_settings_field (
91
- 'first_page',
92
- __( 'First Page Only', 'uk-cookie-consent' ),
93
  array ( $this, 'first_page_render' ),
94
- 'ctcc_options',
95
  'ctcc_options_section'
96
  );
97
-
98
- add_settings_field (
99
- 'enable_metafield',
100
- __( 'Selectively Exclude Pages', 'uk-cookie-consent' ),
101
  array ( $this, 'enable_metafield_render' ),
102
- 'ctcc_options',
103
  'ctcc_options_section'
104
  );
105
-
106
- add_settings_field (
107
- 'exclude_zones',
108
- __( 'Exclude Zones', 'uk-cookie-consent' ),
109
  array ( $this, 'exclude_zones_render' ),
110
  'ctcc_options',
111
  'ctcc_options_section'
112
  );
113
-
114
- add_settings_field (
115
- 'duration',
116
- __( 'Notification Duration', 'uk-cookie-consent' ),
117
  array ( $this, 'duration_render' ),
118
- 'ctcc_options',
119
  'ctcc_options_section'
120
  );
121
-
122
- add_settings_field (
123
- 'scroll_height',
124
- __( 'Scroll Height', 'uk-cookie-consent' ),
125
  array ( $this, 'scroll_height_render' ),
126
- 'ctcc_options',
127
  'ctcc_options_section'
128
  );
129
-
130
- add_settings_field (
131
- 'cookie_expiry',
132
- __( 'Cookie Expiry', 'uk-cookie-consent' ),
133
  array ( $this, 'cookie_expiry_render' ),
134
- 'ctcc_options',
135
  'ctcc_options_section'
136
  );
137
-
138
- add_settings_field (
139
- 'cookie_version',
140
- __( 'Cookie Version', 'uk-cookie-consent' ),
141
  array ( $this, 'cookie_version_render' ),
142
- 'ctcc_options',
143
  'ctcc_options_section'
144
  );
145
-
146
- add_settings_field (
147
- 'wisdom_opt_out',
148
- __( 'Opt out of tracking', 'uk-cookie-consent' ),
149
  array ( $this, 'opt_out_render' ),
150
- 'ctcc_options',
151
  'ctcc_options_section'
152
  );
153
-
154
  // Set default options
155
  $options = get_option ( 'ctcc_options_settings' );
156
  if ( false === $options ) {
@@ -158,9 +158,9 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
158
  $defaults = $this -> get_default_options_settings();
159
  update_option ( 'ctcc_options_settings', $defaults );
160
  }
161
-
162
  }
163
-
164
  public function sanitize_content( $input ){
165
  $output = array();
166
  foreach( $input as $key=>$value ) {
@@ -176,74 +176,74 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
176
  }
177
  return $output;
178
  }
179
-
180
  public function register_content_init() {
181
-
182
  register_setting ( 'ctcc_content', 'ctcc_content_settings', array( $this, 'sanitize_content') );
183
-
184
  add_settings_section (
185
- 'ctcc_content_section',
186
- __( 'Content settings', 'uk-cookie-consent' ),
187
- array ( $this, 'content_settings_section_callback' ),
188
  'ctcc_content'
189
  );
190
-
191
- add_settings_field (
192
- 'heading_text',
193
- __( 'Heading Text', 'uk-cookie-consent' ),
194
  array ( $this, 'heading_text_render' ),
195
- 'ctcc_content',
196
  'ctcc_content_section'
197
  );
198
-
199
- add_settings_field (
200
- 'notification_text',
201
- __( 'Notification Text', 'uk-cookie-consent' ),
202
  array ( $this, 'notification_text_render' ),
203
- 'ctcc_content',
204
  'ctcc_content_section'
205
  );
206
-
207
- add_settings_field (
208
- 'more_info_text',
209
- __( 'More Info Text', 'uk-cookie-consent' ),
210
  array ( $this, 'more_info_text_render' ),
211
- 'ctcc_content',
212
  'ctcc_content_section'
213
  );
214
-
215
- add_settings_field (
216
- 'more_info_page',
217
- __( 'More Info Page', 'uk-cookie-consent' ),
218
  array ( $this, 'more_info_page_render' ),
219
- 'ctcc_content',
220
  'ctcc_content_section'
221
  );
222
-
223
- add_settings_field (
224
- 'more_info_url',
225
- __( 'More Info URL', 'uk-cookie-consent' ),
226
  array ( $this, 'more_info_url_render' ),
227
- 'ctcc_content',
228
  'ctcc_content_section'
229
  );
230
-
231
- add_settings_field (
232
- 'more_info_target',
233
- __( 'More Info Target', 'uk-cookie-consent' ),
234
  array ( $this, 'more_info_target_render' ),
235
  'ctcc_content',
236
  'ctcc_content_section'
237
  );
238
-
239
- add_settings_field (
240
- 'accept_text',
241
- __( 'Accept Text', 'uk-cookie-consent' ),
242
  array ( $this, 'accept_text_render' ),
243
- 'ctcc_content',
244
  'ctcc_content_section'
245
  );
246
-
247
  // Set default options
248
  $options = get_option ( 'ctcc_content_settings' );
249
  if ( false === $options ) {
@@ -251,132 +251,132 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
251
  $defaults = $this -> get_default_content_settings();
252
  update_option ( 'ctcc_content_settings', $defaults );
253
  }
254
-
255
  }
256
-
257
  public function register_styles_init( ) {
258
-
259
  register_setting ( 'ctcc_styles', 'ctcc_styles_settings' );
260
-
261
  add_settings_section (
262
- 'ctcc_styles_section',
263
- __( 'Styles settings', 'uk-cookie-consent' ),
264
- array ( $this, 'styles_settings_section_callback' ),
265
  'ctcc_styles'
266
  );
267
-
268
- add_settings_field (
269
- 'position',
270
- __( 'Position', 'uk-cookie-consent' ),
271
  array ( $this, 'position_render' ),
272
- 'ctcc_styles',
273
  'ctcc_styles_section'
274
  );
275
-
276
- add_settings_field (
277
- 'container_class',
278
- __( 'Container Class', 'uk-cookie-consent' ),
279
  array ( $this, 'container_class_render' ),
280
- 'ctcc_styles',
281
  'ctcc_styles_section'
282
  );
283
-
284
- add_settings_field (
285
- 'enqueue_styles',
286
- __( 'Include Stylesheet', 'uk-cookie-consent' ),
287
  array ( $this, 'enqueue_styles_render' ),
288
- 'ctcc_styles',
289
  'ctcc_styles_section'
290
  );
291
-
292
- add_settings_field (
293
- 'rounded_corners',
294
- __( 'Rounded Corners', 'uk-cookie-consent' ),
295
  array ( $this, 'rounded_corners_render' ),
296
- 'ctcc_styles',
297
  'ctcc_styles_section'
298
  );
299
-
300
- add_settings_field (
301
- 'drop_shadow',
302
- __( 'Drop Shadow', 'uk-cookie-consent' ),
303
  array ( $this, 'drop_shadow_render' ),
304
- 'ctcc_styles',
305
  'ctcc_styles_section'
306
  );
307
-
308
- add_settings_field (
309
- 'display_accept_with_text',
310
- __( 'Display Button With Text', 'uk-cookie-consent' ),
311
  array ( $this, 'display_accept_with_text_render' ),
312
- 'ctcc_styles',
313
  'ctcc_styles_section'
314
  );
315
-
316
- add_settings_field (
317
- 'x_close',
318
- __( 'Use X Close', 'uk-cookie-consent' ),
319
  array ( $this, 'x_close_render' ),
320
- 'ctcc_styles',
321
  'ctcc_styles_section'
322
  );
323
-
324
- add_settings_field (
325
- 'text_color',
326
- __( 'Text Color', 'uk-cookie-consent' ),
327
  array ( $this, 'text_color_render' ),
328
- 'ctcc_styles',
329
  'ctcc_styles_section'
330
  );
331
-
332
- add_settings_field (
333
- 'bg_color',
334
- __( 'Background Color', 'uk-cookie-consent' ),
335
  array ( $this, 'bg_color_render' ),
336
- 'ctcc_styles',
337
  'ctcc_styles_section'
338
  );
339
-
340
- add_settings_field (
341
- 'link_color',
342
- __( 'Link Color', 'uk-cookie-consent' ),
343
  array ( $this, 'link_color_render' ),
344
- 'ctcc_styles',
345
  'ctcc_styles_section'
346
  );
347
-
348
- add_settings_field (
349
- 'button_color',
350
- __( 'Button Color', 'uk-cookie-consent' ),
351
  array ( $this, 'button_color_render' ),
352
- 'ctcc_styles',
353
  'ctcc_styles_section'
354
  );
355
-
356
- add_settings_field (
357
- 'button_bg_color',
358
- __( 'Button Background', 'uk-cookie-consent' ),
359
  array ( $this, 'button_bg_color_render' ),
360
- 'ctcc_styles',
361
  'ctcc_styles_section'
362
  );
363
-
364
- add_settings_field (
365
- 'bg_color',
366
- __( 'Background Color', 'uk-cookie-consent' ),
367
  array ( $this, 'bg_color_render' ),
368
- 'ctcc_styles',
369
  'ctcc_styles_section'
370
  );
371
-
372
- add_settings_field (
373
- 'flat_button',
374
- __( 'Flat Button', 'uk-cookie-consent' ),
375
  array ( $this, 'flat_button_render' ),
376
- 'ctcc_styles',
377
  'ctcc_styles_section'
378
  );
379
-
380
  // Set default options
381
  $options = get_option ( 'ctcc_styles_settings' );
382
  if ( false === $options ) {
@@ -384,9 +384,9 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
384
  $defaults = $this -> get_default_styles_settings();
385
  update_option ( 'ctcc_styles_settings', $defaults );
386
  }
387
-
388
  }
389
-
390
  public function get_default_options_settings() {
391
  $defaults = array (
392
  'closure' => 'click',
@@ -400,9 +400,9 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
400
  );
401
  return $defaults;
402
  }
403
-
404
  public function get_default_content_settings() {
405
-
406
  $previous_settings = get_option ( 'catapult_cookie_options' );
407
  // Check for settings from previous version
408
  if ( ! empty ( $previous_settings ) ) {
@@ -427,9 +427,9 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
427
  );
428
  }
429
  return $defaults;
430
-
431
  }
432
-
433
  public function get_default_styles_settings() {
434
  $previous_settings = get_option ( 'catapult_cookie_options' );
435
  $defaults = array (
@@ -448,55 +448,55 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
448
  'flat_button' => 1,
449
  );
450
  // Check for settings from previous version
451
-
452
  if ( ! empty ( $previous_settings['catapult_cookie_bar_position_settings'] ) ) {
453
  $defaults['position'] = $previous_settings['catapult_cookie_bar_position_settings'] . '-bar';
454
  }
455
-
456
  if ( ! empty ( $previous_settings['catapult_cookie_text_colour_settings'] ) ) {
457
  $defaults['text_color'] = $previous_settings['catapult_cookie_text_colour_settings'];
458
  }
459
-
460
  if ( ! empty ( $previous_settings['catapult_cookie_bg_colour_settings'] ) ) {
461
  $defaults['bg_color'] = $previous_settings['catapult_cookie_bg_colour_settings'];
462
  }
463
-
464
  if ( ! empty ( $previous_settings['catapult_cookie_link_colour_settings'] ) ) {
465
  $defaults['link_color'] = $previous_settings['catapult_cookie_link_colour_settings'];
466
  }
467
-
468
  if ( ! empty ( $previous_settings['catapult_cookie_link_colour_settings'] ) ) {
469
  $defaults['link_color'] = $previous_settings['catapult_cookie_link_colour_settings'];
470
  }
471
-
472
  if ( ! empty ( $previous_settings['catapult_cookie_button_colour_settings'] ) ) {
473
  $defaults['button_bg_color'] = $previous_settings['catapult_cookie_button_colour_settings'];
474
  }
475
-
476
  return $defaults;
477
-
478
  }
479
-
480
- public function closure_render() {
481
  $options = get_option( 'ctcc_options_settings' ); ?>
482
  <select name='ctcc_options_settings[closure]'>
483
  <option value='click' <?php selected( $options['closure'], 'click' ); ?>><?php _e( 'On Click', 'uk-cookie-consent' ); ?></option>
484
  <option value='scroll' <?php selected( $options['closure'], 'scroll' ); ?>><?php _e( 'On Scroll', 'uk-cookie-consent' ); ?></option>
485
  <option value='timed' <?php selected( $options['closure'], 'timed' ); ?>><?php _e( 'Timed', 'uk-cookie-consent' ); ?></option>
486
-
487
  </select>
488
  <p class="description"><?php _e( 'How you want the user to close the notification', 'uk-cookie-consent' ); ?></p>
489
  <?php
490
  }
491
-
492
- public function first_page_render() {
493
  $options = get_option( 'ctcc_options_settings' ); ?>
494
  <input type='checkbox' name='ctcc_options_settings[first_page]' <?php checked ( ! empty ( $options['first_page'] ), 1 ); ?> value='1'>
495
  <p class="description"><?php _e( 'Select this to show the notification only on the first page the user visits', 'uk-cookie-consent' ); ?></p>
496
  <?php
497
  }
498
-
499
- public function exclude_zones_render() {
500
  $options = get_option( 'ctcc_options_settings' );
501
  $zones = array();
502
  if( isset( $options['exclude_zones'] ) ) {
@@ -514,75 +514,75 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
514
  <p class="description"><?php _e( 'If you have the <a href="https://wordpress.org/plugins/geoip-detect/" target="_blank">GeoIP Detect</a> plugin activated, you can specify which areas of the world to exclude from displaying the notification.', 'uk-cookie-consent' ); ?></p>
515
  <?php
516
  }
517
-
518
- public function scroll_height_render() {
519
  $options = get_option( 'ctcc_options_settings' ); ?>
520
  <input type="number" min="1" name="ctcc_options_settings[scroll_height]" value="<?php echo esc_attr( $options['scroll_height'] ); ?>">
521
  <p class="description"><?php _e( 'If you chose Scroll as the close method, enter the distance in pixels the user should scroll before the notification closes', 'uk-cookie-consent' ); ?></p>
522
  <?php
523
  }
524
 
525
- public function duration_render() {
526
  $options = get_option( 'ctcc_options_settings' ); ?>
527
  <input type="number" min="1" name="ctcc_options_settings[duration]" value="<?php echo esc_attr( $options['duration'] ); ?>">
528
  <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>
529
  <?php
530
  }
531
-
532
- public function cookie_expiry_render() {
533
  $options = get_option( 'ctcc_options_settings' ); ?>
534
  <input type="number" min="1" name="ctcc_options_settings[cookie_expiry]" value="<?php echo esc_attr( $options['cookie_expiry'] ); ?>">
535
  <p class="description"><?php _e( 'The number of days that the cookie is set for', 'uk-cookie-consent' ); ?></p>
536
  <?php
537
  }
538
-
539
- public function cookie_version_render() {
540
  $options = get_option( 'ctcc_options_settings' ); ?>
541
  <input type="text" name="ctcc_options_settings[cookie_version]" value="<?php echo esc_attr( $options['cookie_version'] ); ?>">
542
  <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>
543
  <?php
544
  }
545
-
546
- public function opt_out_render() {
547
  $options = get_option( 'ctcc_options_settings' ); ?>
548
  <input type='checkbox' name='ctcc_options_settings[wisdom_opt_out]' <?php checked ( ! empty ( $options['wisdom_opt_out'] ), 1 ); ?> value='1'>
549
  <p class="description"><?php _e( 'If you previously opted into allowing this plugin to track non-sensitive data, you can opt out here', 'uk-cookie-consent' ); ?></p>
550
  <?php
551
  }
552
-
553
  /*
554
  * Content renders
555
  */
556
 
557
- public function heading_text_render() {
558
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
559
  <input type="text" name="ctcc_content_settings[heading_text]" value="<?php echo esc_attr( $ctcc_content_settings['heading_text'] ); ?>">
560
  <p class="description"><?php _e( 'The heading text - only applies if you are not using a top or bottom bar', 'uk-cookie-consent' ); ?></p>
561
  <?php
562
  }
563
-
564
- public function notification_text_render() {
565
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
566
  <input class="widefat" type="text" name="ctcc_content_settings[notification_text]" value="<?php echo esc_attr( $ctcc_content_settings['notification_text'] ); ?>">
567
  <p class="description"><?php _e( 'The default text to indicate that your site uses cookies', 'uk-cookie-consent' ); ?></p>
568
  <?php
569
  }
570
-
571
- public function accept_text_render() {
572
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
573
  <input type="text" name="ctcc_content_settings[accept_text]" value="<?php echo esc_attr( $ctcc_content_settings['accept_text'] ); ?>">
574
  <p class="description"><?php _e( 'The default text to dismiss the notification', 'uk-cookie-consent' ); ?></p>
575
  <?php
576
  }
577
-
578
- public function more_info_text_render() {
579
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
580
  <input type="text" name="ctcc_content_settings[more_info_text]" value="<?php echo esc_attr( $ctcc_content_settings['more_info_text'] ); ?>">
581
  <p class="description"><?php _e( 'The default text to use to link to a page providing further information', 'uk-cookie-consent' ); ?></p>
582
  <?php
583
  }
584
-
585
- public function more_info_page_render() {
586
  $ctcc_content_settings = get_option( 'ctcc_content_settings' );
587
  // Get all pages
588
  $pages = get_pages();
@@ -591,21 +591,21 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
591
  <select name='ctcc_content_settings[more_info_page]'>
592
  <option></option>
593
  <?php foreach ( $pages as $page ) { ?>
594
- <option value='<?php echo $page -> ID; ?>' <?php selected( $ctcc_content_settings['more_info_page'], $page -> ID ); ?>><?php echo $page -> post_title; ?></option>
595
  <?php } ?>
596
  </select>
597
  <p class="description"><?php _e( 'The page containing further information about your cookie policy', 'uk-cookie-consent' ); ?></p>
598
  <?php }
599
  }
600
 
601
- public function more_info_url_render() {
602
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
603
  <input type="url" name="ctcc_content_settings[more_info_url]" value="<?php echo esc_url( $ctcc_content_settings['more_info_url'] ); ?>">
604
  <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>
605
  <?php
606
  }
607
-
608
- public function more_info_target_render() {
609
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
610
  <select name='ctcc_content_settings[more_info_target]'>
611
  <option value='_blank' <?php selected( $ctcc_content_settings['more_info_target'], '_blank' ); ?>><?php _e( 'New Tab', 'uk-cookie-consent' ); ?></option>
@@ -614,12 +614,12 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
614
  <p class="description"><?php _e( 'Open the More Information page in the same or new tab.', 'uk-cookie-consent' ); ?></p>
615
  <?php
616
  }
617
-
618
- /*
619
  * Styles functions
620
  */
621
-
622
- public function position_render() {
623
  $options = get_option( 'ctcc_styles_settings' ); ?>
624
  <select name='ctcc_styles_settings[position]'>
625
  <option value='top-bar' <?php selected( $options['position'], 'top-bar' ); ?>><?php _e( 'Top Bar', 'uk-cookie-consent' ); ?></option>
@@ -633,127 +633,127 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
633
  <?php
634
  }
635
 
636
- public function container_class_render() {
637
  $options = get_option( 'ctcc_styles_settings' ); ?>
638
  <input type="text" name="ctcc_styles_settings[container_class]" value="<?php echo esc_attr( $options['container_class'] ); ?>">
639
  <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>
640
  <?php
641
  }
642
 
643
- public function enqueue_styles_render() {
644
  $options = get_option( 'ctcc_styles_settings' ); ?>
645
  <input type='checkbox' name='ctcc_styles_settings[enqueue_styles]' <?php checked ( ! empty ( $options['enqueue_styles'] ), 1 ); ?> value='1'>
646
  <p class="description"><?php _e( 'Deselect this to dequeue the plugin stylesheet', 'uk-cookie-consent' ); ?></p>
647
  <?php
648
  }
649
 
650
- public function rounded_corners_render() {
651
  $options = get_option( 'ctcc_styles_settings' ); ?>
652
  <input type='checkbox' name='ctcc_styles_settings[rounded_corners]' <?php checked ( ! empty ( $options['rounded_corners'] ), 1 ); ?> value='1'>
653
  <p class="description"><?php _e( 'Round the corners on the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
654
  <?php
655
  }
656
 
657
- public function drop_shadow_render() {
658
  $options = get_option( 'ctcc_styles_settings' ); ?>
659
  <input type='checkbox' name='ctcc_styles_settings[drop_shadow]' <?php checked ( ! empty ( $options['drop_shadow'] ), 1 ); ?> value='1'>
660
  <p class="description"><?php _e( 'Add drop shadow to the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
661
  <?php
662
  }
663
 
664
- public function display_accept_with_text_render() {
665
  $options = get_option( 'ctcc_styles_settings' ); ?>
666
  <input type='checkbox' name='ctcc_styles_settings[display_accept_with_text]' <?php checked ( ! empty ( $options['display_accept_with_text'] ), 1 ); ?> value='1'>
667
  <p class="description"><?php _e( 'Display the confirmation button with notification text', 'uk-cookie-consent' ); ?></p>
668
  <?php
669
  }
670
 
671
- public function x_close_render() {
672
  $options = get_option( 'ctcc_styles_settings' ); ?>
673
  <input type='checkbox' name='ctcc_styles_settings[x_close]' <?php checked ( ! empty ( $options['x_close'] ), 1 ); ?> value='1'>
674
  <p class="description"><?php _e( 'Remove confirmation button and use \'X\' icon instead', 'uk-cookie-consent' ); ?></p>
675
  <?php
676
  }
677
 
678
- public function text_color_render() {
679
  $options = get_option( 'ctcc_styles_settings' ); ?>
680
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[text_color]" value="<?php echo esc_attr( $options['text_color'] ); ?>">
681
  <p class="description"><?php _e( 'The text color on the notification', 'uk-cookie-consent' ); ?></p>
682
  <?php
683
  }
684
-
685
- public function bg_color_render() {
686
  $options = get_option( 'ctcc_styles_settings' ); ?>
687
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[bg_color]" value="<?php echo esc_attr( $options['bg_color'] ); ?>">
688
  <p class="description"><?php _e( 'The background color for the notification', 'uk-cookie-consent' ); ?></p>
689
  <?php
690
  }
691
-
692
- public function link_color_render() {
693
  $options = get_option( 'ctcc_styles_settings' ); ?>
694
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[link_color]" value="<?php echo esc_attr( $options['link_color'] ); ?>">
695
  <p class="description"><?php _e( 'The link color on the notification', 'uk-cookie-consent' ); ?></p>
696
  <?php
697
  }
698
-
699
- public function button_color_render() {
700
  $options = get_option( 'ctcc_styles_settings' ); ?>
701
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_color]" value="<?php echo esc_attr( $options['button_color'] ); ?>">
702
  <p class="description"><?php _e( 'The text color on the notification button', 'uk-cookie-consent' ); ?></p>
703
  <?php
704
  }
705
-
706
- public function button_bg_color_render() {
707
  $options = get_option( 'ctcc_styles_settings' ); ?>
708
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_bg_color]" value="<?php echo esc_attr( $options['button_bg_color'] ); ?>">
709
  <p class="description"><?php _e( 'The background color on the notification button', 'uk-cookie-consent' ); ?></p>
710
  <?php
711
  }
712
-
713
- public function flat_button_render() {
714
  $options = get_option( 'ctcc_styles_settings' ); ?>
715
  <input type='checkbox' name='ctcc_styles_settings[flat_button]' <?php checked ( ! empty ( $options['flat_button'] ), 1 ); ?> value='1'>
716
  <p class="description"><?php _e( 'Remove the border from the button', 'uk-cookie-consent' ); ?></p>
717
  <?php
718
  }
719
-
720
- public function enable_metafield_render() {
721
  $options = get_option( 'ctcc_options_settings' ); ?>
722
  <input type='checkbox' name='ctcc_options_settings[enable_metafield]' <?php checked ( ! empty ( $options['enable_metafield'] ), 1 ); ?> value='1'>
723
  <p class="description"><?php _e( 'Select this to enable a metafield on pages and posts. Checking the metafield on a page or post will exclude that page from displaying the notification.', 'uk-cookie-consent' ); ?></p>
724
  <?php
725
  }
726
-
727
  public function settings_section_callback() {
728
  echo '<p>' . __( 'Basic settings', 'uk-cookie-consent' ) . '</p>';
729
  echo '<p><a href="http://iubenda.refr.cc/JKNZ55D" target="_blank">' . __( 'Create your own privacy policy here') . '</a></p>';
730
  }
731
-
732
- public function content_settings_section_callback() {
733
  echo '<p>' .__( 'Update the content displayed to the user', 'uk-cookie-consent' ) . '</p>';
734
  echo '<p><a href="http://iubenda.refr.cc/JKNZ55D" target="_blank">' . __( 'Create your own privacy policy here') . '</a></p>';
735
  }
736
-
737
- public function styles_settings_section_callback() {
738
  echo '<p>' .__( 'Change the styles here if you like - but it\'s better in the Customizer', 'uk-cookie-consent' ) . '</p>';
739
  echo '<p><a href="http://iubenda.refr.cc/JKNZ55D" target="_blank">' . __( 'Create your own privacy policy here') . '</a></p>';
740
  }
741
-
742
- public function pages_settings_section_callback() {
743
  echo '<p>' . __( 'Use this section to set exclusion rules for pages and posts.', 'uk-cookie-consent' ) . '</p>';
744
  echo '<p><a href="http://iubenda.refr.cc/JKNZ55D" target="_blank">' . __( 'Create your own privacy policy here') . '</a></p>';
745
  }
746
-
747
  public function options_page() {
748
  $reset = isset ( $_GET['reset'] ) ? $_GET['reset'] : '';
749
  if ( isset ( $_POST['reset'] ) ) {
750
-
751
  $defaults = $this -> get_default_styles_settings();
752
  update_option ( 'ctcc_styles_settings', $defaults );
753
 
754
  $defaults = $this -> get_default_content_settings();
755
  update_option ( 'ctcc_content_settings', $defaults );
756
-
757
  }
758
  $current = isset ( $_GET['tab'] ) ? $_GET['tab'] : 'options';
759
  $title = __( 'Cookie Consent', 'uk-cookie-consent' );
@@ -762,7 +762,7 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
762
  'content' => __( 'Content', 'uk-cookie-consent' ),
763
  'styles' => __( 'Styles', 'uk-cookie-consent' )
764
  );?>
765
-
766
  <div class="wrap">
767
  <h1><?php echo $title; ?></h1>
768
  <div class="ctdb-outer-wrap">
@@ -787,7 +787,7 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
787
  </p>
788
  </form>
789
  </div><!-- .ctdb-inner-wrap -->
790
-
791
  <div class="ctdb-banners">
792
  <div class="ctdb-banner">
793
  <a href="https://catapultthemes.com/downloads/showcase/?utm_source=plugin_ad&utm_medium=wp_plugin&utm_content=cookieconsent&utm_campaign=themes"><img src="<?php echo CTCC_PLUGIN_URL . 'assets/images/showcase-banner-ad.jpg'; ?>" alt="" ></a>
@@ -800,17 +800,15 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
800
  </div>
801
  <div class="ctdb-banner">
802
  <a href="http://superheroslider.catapultthemes.com/?utm_source=plugin_ad&utm_medium=wp_plugin&utm_content=cookieconsent&utm_campaign=superhero"><img src="<?php echo CTCC_PLUGIN_URL . 'assets/images/superhero-ad1.png'; ?>" alt="" ></a>
803
- </div>
804
  </div>
805
-
806
  </div><!-- .ctdb-outer-wrap -->
807
  </div><!-- .wrap -->
808
  <?php
809
  }
810
 
811
-
812
- }
813
-
814
- }
815
 
 
816
 
 
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
  add_action( 'admin_init', array( $this, 'save_registered_setting' ) );
36
+
37
  }
38
+
39
  /**
40
  * We save this artificially to let the tracker know that we're allowed to export this option's data
41
  */
50
  wp_enqueue_script ( 'wp-color-picker', false, array ( 'jquery' ) );
51
  wp_enqueue_style ( 'ctcc-admin-style', CTCC_PLUGIN_URL . 'assets/css/admin-style.css' );
52
  }
53
+
54
  public function add_js() {
55
  $screen = get_current_screen();
56
  if ( $screen -> id == 'settings_page_ctcc' ) {
62
  </script>
63
  <?php }
64
  }
65
+
66
  // Add the menu item
67
+ public function add_admin_menu( ) {
68
  add_options_page ( __('Cookie Consent', 'uk-cookie-consent'), __('Cookie Consent', 'uk-cookie-consent'), 'manage_options', 'ctcc', array ( $this, 'options_page' ) );
69
  }
70
+
71
  public function register_options_init( ) {
72
+
73
  register_setting ( 'ctcc_options', 'ctcc_options_settings' );
74
+
75
  add_settings_section (
76
+ 'ctcc_options_section',
77
+ __( 'General settings', 'uk-cookie-consent' ),
78
+ array ( $this, 'settings_section_callback' ),
79
  'ctcc_options'
80
  );
81
+
82
+ add_settings_field (
83
+ 'closure',
84
+ __( 'Close', 'uk-cookie-consent' ),
85
  array ( $this, 'closure_render' ),
86
+ 'ctcc_options',
87
  'ctcc_options_section'
88
  );
89
+
90
+ add_settings_field (
91
+ 'first_page',
92
+ __( 'First Page Only', 'uk-cookie-consent' ),
93
  array ( $this, 'first_page_render' ),
94
+ 'ctcc_options',
95
  'ctcc_options_section'
96
  );
97
+
98
+ add_settings_field (
99
+ 'enable_metafield',
100
+ __( 'Selectively Exclude Pages', 'uk-cookie-consent' ),
101
  array ( $this, 'enable_metafield_render' ),
102
+ 'ctcc_options',
103
  'ctcc_options_section'
104
  );
105
+
106
+ add_settings_field (
107
+ 'exclude_zones',
108
+ __( 'Exclude Zones', 'uk-cookie-consent' ),
109
  array ( $this, 'exclude_zones_render' ),
110
  'ctcc_options',
111
  'ctcc_options_section'
112
  );
113
+
114
+ add_settings_field (
115
+ 'duration',
116
+ __( 'Notification Duration', 'uk-cookie-consent' ),
117
  array ( $this, 'duration_render' ),
118
+ 'ctcc_options',
119
  'ctcc_options_section'
120
  );
121
+
122
+ add_settings_field (
123
+ 'scroll_height',
124
+ __( 'Scroll Height', 'uk-cookie-consent' ),
125
  array ( $this, 'scroll_height_render' ),
126
+ 'ctcc_options',
127
  'ctcc_options_section'
128
  );
129
+
130
+ add_settings_field (
131
+ 'cookie_expiry',
132
+ __( 'Cookie Expiry', 'uk-cookie-consent' ),
133
  array ( $this, 'cookie_expiry_render' ),
134
+ 'ctcc_options',
135
  'ctcc_options_section'
136
  );
137
+
138
+ add_settings_field (
139
+ 'cookie_version',
140
+ __( 'Cookie Version', 'uk-cookie-consent' ),
141
  array ( $this, 'cookie_version_render' ),
142
+ 'ctcc_options',
143
  'ctcc_options_section'
144
  );
145
+
146
+ add_settings_field (
147
+ 'wisdom_opt_out',
148
+ __( 'Opt out of tracking', 'uk-cookie-consent' ),
149
  array ( $this, 'opt_out_render' ),
150
+ 'ctcc_options',
151
  'ctcc_options_section'
152
  );
153
+
154
  // Set default options
155
  $options = get_option ( 'ctcc_options_settings' );
156
  if ( false === $options ) {
158
  $defaults = $this -> get_default_options_settings();
159
  update_option ( 'ctcc_options_settings', $defaults );
160
  }
161
+
162
  }
163
+
164
  public function sanitize_content( $input ){
165
  $output = array();
166
  foreach( $input as $key=>$value ) {
176
  }
177
  return $output;
178
  }
179
+
180
  public function register_content_init() {
181
+
182
  register_setting ( 'ctcc_content', 'ctcc_content_settings', array( $this, 'sanitize_content') );
183
+
184
  add_settings_section (
185
+ 'ctcc_content_section',
186
+ __( 'Content settings', 'uk-cookie-consent' ),
187
+ array ( $this, 'content_settings_section_callback' ),
188
  'ctcc_content'
189
  );
190
+
191
+ add_settings_field (
192
+ 'heading_text',
193
+ __( 'Heading Text', 'uk-cookie-consent' ),
194
  array ( $this, 'heading_text_render' ),
195
+ 'ctcc_content',
196
  'ctcc_content_section'
197
  );
198
+
199
+ add_settings_field (
200
+ 'notification_text',
201
+ __( 'Notification Text', 'uk-cookie-consent' ),
202
  array ( $this, 'notification_text_render' ),
203
+ 'ctcc_content',
204
  'ctcc_content_section'
205
  );
206
+
207
+ add_settings_field (
208
+ 'more_info_text',
209
+ __( 'More Info Text', 'uk-cookie-consent' ),
210
  array ( $this, 'more_info_text_render' ),
211
+ 'ctcc_content',
212
  'ctcc_content_section'
213
  );
214
+
215
+ add_settings_field (
216
+ 'more_info_page',
217
+ __( 'More Info Page', 'uk-cookie-consent' ),
218
  array ( $this, 'more_info_page_render' ),
219
+ 'ctcc_content',
220
  'ctcc_content_section'
221
  );
222
+
223
+ add_settings_field (
224
+ 'more_info_url',
225
+ __( 'More Info URL', 'uk-cookie-consent' ),
226
  array ( $this, 'more_info_url_render' ),
227
+ 'ctcc_content',
228
  'ctcc_content_section'
229
  );
230
+
231
+ add_settings_field (
232
+ 'more_info_target',
233
+ __( 'More Info Target', 'uk-cookie-consent' ),
234
  array ( $this, 'more_info_target_render' ),
235
  'ctcc_content',
236
  'ctcc_content_section'
237
  );
238
+
239
+ add_settings_field (
240
+ 'accept_text',
241
+ __( 'Accept Text', 'uk-cookie-consent' ),
242
  array ( $this, 'accept_text_render' ),
243
+ 'ctcc_content',
244
  'ctcc_content_section'
245
  );
246
+
247
  // Set default options
248
  $options = get_option ( 'ctcc_content_settings' );
249
  if ( false === $options ) {
251
  $defaults = $this -> get_default_content_settings();
252
  update_option ( 'ctcc_content_settings', $defaults );
253
  }
254
+
255
  }
256
+
257
  public function register_styles_init( ) {
258
+
259
  register_setting ( 'ctcc_styles', 'ctcc_styles_settings' );
260
+
261
  add_settings_section (
262
+ 'ctcc_styles_section',
263
+ __( 'Styles settings', 'uk-cookie-consent' ),
264
+ array ( $this, 'styles_settings_section_callback' ),
265
  'ctcc_styles'
266
  );
267
+
268
+ add_settings_field (
269
+ 'position',
270
+ __( 'Position', 'uk-cookie-consent' ),
271
  array ( $this, 'position_render' ),
272
+ 'ctcc_styles',
273
  'ctcc_styles_section'
274
  );
275
+
276
+ add_settings_field (
277
+ 'container_class',
278
+ __( 'Container Class', 'uk-cookie-consent' ),
279
  array ( $this, 'container_class_render' ),
280
+ 'ctcc_styles',
281
  'ctcc_styles_section'
282
  );
283
+
284
+ add_settings_field (
285
+ 'enqueue_styles',
286
+ __( 'Include Stylesheet', 'uk-cookie-consent' ),
287
  array ( $this, 'enqueue_styles_render' ),
288
+ 'ctcc_styles',
289
  'ctcc_styles_section'
290
  );
291
+
292
+ add_settings_field (
293
+ 'rounded_corners',
294
+ __( 'Rounded Corners', 'uk-cookie-consent' ),
295
  array ( $this, 'rounded_corners_render' ),
296
+ 'ctcc_styles',
297
  'ctcc_styles_section'
298
  );
299
+
300
+ add_settings_field (
301
+ 'drop_shadow',
302
+ __( 'Drop Shadow', 'uk-cookie-consent' ),
303
  array ( $this, 'drop_shadow_render' ),
304
+ 'ctcc_styles',
305
  'ctcc_styles_section'
306
  );
307
+
308
+ add_settings_field (
309
+ 'display_accept_with_text',
310
+ __( 'Display Button With Text', 'uk-cookie-consent' ),
311
  array ( $this, 'display_accept_with_text_render' ),
312
+ 'ctcc_styles',
313
  'ctcc_styles_section'
314
  );
315
+
316
+ add_settings_field (
317
+ 'x_close',
318
+ __( 'Use X Close', 'uk-cookie-consent' ),
319
  array ( $this, 'x_close_render' ),
320
+ 'ctcc_styles',
321
  'ctcc_styles_section'
322
  );
323
+
324
+ add_settings_field (
325
+ 'text_color',
326
+ __( 'Text Color', 'uk-cookie-consent' ),
327
  array ( $this, 'text_color_render' ),
328
+ 'ctcc_styles',
329
  'ctcc_styles_section'
330
  );
331
+
332
+ add_settings_field (
333
+ 'bg_color',
334
+ __( 'Background Color', 'uk-cookie-consent' ),
335
  array ( $this, 'bg_color_render' ),
336
+ 'ctcc_styles',
337
  'ctcc_styles_section'
338
  );
339
+
340
+ add_settings_field (
341
+ 'link_color',
342
+ __( 'Link Color', 'uk-cookie-consent' ),
343
  array ( $this, 'link_color_render' ),
344
+ 'ctcc_styles',
345
  'ctcc_styles_section'
346
  );
347
+
348
+ add_settings_field (
349
+ 'button_color',
350
+ __( 'Button Color', 'uk-cookie-consent' ),
351
  array ( $this, 'button_color_render' ),
352
+ 'ctcc_styles',
353
  'ctcc_styles_section'
354
  );
355
+
356
+ add_settings_field (
357
+ 'button_bg_color',
358
+ __( 'Button Background', 'uk-cookie-consent' ),
359
  array ( $this, 'button_bg_color_render' ),
360
+ 'ctcc_styles',
361
  'ctcc_styles_section'
362
  );
363
+
364
+ add_settings_field (
365
+ 'bg_color',
366
+ __( 'Background Color', 'uk-cookie-consent' ),
367
  array ( $this, 'bg_color_render' ),
368
+ 'ctcc_styles',
369
  'ctcc_styles_section'
370
  );
371
+
372
+ add_settings_field (
373
+ 'flat_button',
374
+ __( 'Flat Button', 'uk-cookie-consent' ),
375
  array ( $this, 'flat_button_render' ),
376
+ 'ctcc_styles',
377
  'ctcc_styles_section'
378
  );
379
+
380
  // Set default options
381
  $options = get_option ( 'ctcc_styles_settings' );
382
  if ( false === $options ) {
384
  $defaults = $this -> get_default_styles_settings();
385
  update_option ( 'ctcc_styles_settings', $defaults );
386
  }
387
+
388
  }
389
+
390
  public function get_default_options_settings() {
391
  $defaults = array (
392
  'closure' => 'click',
400
  );
401
  return $defaults;
402
  }
403
+
404
  public function get_default_content_settings() {
405
+
406
  $previous_settings = get_option ( 'catapult_cookie_options' );
407
  // Check for settings from previous version
408
  if ( ! empty ( $previous_settings ) ) {
427
  );
428
  }
429
  return $defaults;
430
+
431
  }
432
+
433
  public function get_default_styles_settings() {
434
  $previous_settings = get_option ( 'catapult_cookie_options' );
435
  $defaults = array (
448
  'flat_button' => 1,
449
  );
450
  // Check for settings from previous version
451
+
452
  if ( ! empty ( $previous_settings['catapult_cookie_bar_position_settings'] ) ) {
453
  $defaults['position'] = $previous_settings['catapult_cookie_bar_position_settings'] . '-bar';
454
  }
455
+
456
  if ( ! empty ( $previous_settings['catapult_cookie_text_colour_settings'] ) ) {
457
  $defaults['text_color'] = $previous_settings['catapult_cookie_text_colour_settings'];
458
  }
459
+
460
  if ( ! empty ( $previous_settings['catapult_cookie_bg_colour_settings'] ) ) {
461
  $defaults['bg_color'] = $previous_settings['catapult_cookie_bg_colour_settings'];
462
  }
463
+
464
  if ( ! empty ( $previous_settings['catapult_cookie_link_colour_settings'] ) ) {
465
  $defaults['link_color'] = $previous_settings['catapult_cookie_link_colour_settings'];
466
  }
467
+
468
  if ( ! empty ( $previous_settings['catapult_cookie_link_colour_settings'] ) ) {
469
  $defaults['link_color'] = $previous_settings['catapult_cookie_link_colour_settings'];
470
  }
471
+
472
  if ( ! empty ( $previous_settings['catapult_cookie_button_colour_settings'] ) ) {
473
  $defaults['button_bg_color'] = $previous_settings['catapult_cookie_button_colour_settings'];
474
  }
475
+
476
  return $defaults;
477
+
478
  }
479
+
480
+ public function closure_render() {
481
  $options = get_option( 'ctcc_options_settings' ); ?>
482
  <select name='ctcc_options_settings[closure]'>
483
  <option value='click' <?php selected( $options['closure'], 'click' ); ?>><?php _e( 'On Click', 'uk-cookie-consent' ); ?></option>
484
  <option value='scroll' <?php selected( $options['closure'], 'scroll' ); ?>><?php _e( 'On Scroll', 'uk-cookie-consent' ); ?></option>
485
  <option value='timed' <?php selected( $options['closure'], 'timed' ); ?>><?php _e( 'Timed', 'uk-cookie-consent' ); ?></option>
486
+
487
  </select>
488
  <p class="description"><?php _e( 'How you want the user to close the notification', 'uk-cookie-consent' ); ?></p>
489
  <?php
490
  }
491
+
492
+ public function first_page_render() {
493
  $options = get_option( 'ctcc_options_settings' ); ?>
494
  <input type='checkbox' name='ctcc_options_settings[first_page]' <?php checked ( ! empty ( $options['first_page'] ), 1 ); ?> value='1'>
495
  <p class="description"><?php _e( 'Select this to show the notification only on the first page the user visits', 'uk-cookie-consent' ); ?></p>
496
  <?php
497
  }
498
+
499
+ public function exclude_zones_render() {
500
  $options = get_option( 'ctcc_options_settings' );
501
  $zones = array();
502
  if( isset( $options['exclude_zones'] ) ) {
514
  <p class="description"><?php _e( 'If you have the <a href="https://wordpress.org/plugins/geoip-detect/" target="_blank">GeoIP Detect</a> plugin activated, you can specify which areas of the world to exclude from displaying the notification.', 'uk-cookie-consent' ); ?></p>
515
  <?php
516
  }
517
+
518
+ public function scroll_height_render() {
519
  $options = get_option( 'ctcc_options_settings' ); ?>
520
  <input type="number" min="1" name="ctcc_options_settings[scroll_height]" value="<?php echo esc_attr( $options['scroll_height'] ); ?>">
521
  <p class="description"><?php _e( 'If you chose Scroll as the close method, enter the distance in pixels the user should scroll before the notification closes', 'uk-cookie-consent' ); ?></p>
522
  <?php
523
  }
524
 
525
+ public function duration_render() {
526
  $options = get_option( 'ctcc_options_settings' ); ?>
527
  <input type="number" min="1" name="ctcc_options_settings[duration]" value="<?php echo esc_attr( $options['duration'] ); ?>">
528
  <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>
529
  <?php
530
  }
531
+
532
+ public function cookie_expiry_render() {
533
  $options = get_option( 'ctcc_options_settings' ); ?>
534
  <input type="number" min="1" name="ctcc_options_settings[cookie_expiry]" value="<?php echo esc_attr( $options['cookie_expiry'] ); ?>">
535
  <p class="description"><?php _e( 'The number of days that the cookie is set for', 'uk-cookie-consent' ); ?></p>
536
  <?php
537
  }
538
+
539
+ public function cookie_version_render() {
540
  $options = get_option( 'ctcc_options_settings' ); ?>
541
  <input type="text" name="ctcc_options_settings[cookie_version]" value="<?php echo esc_attr( $options['cookie_version'] ); ?>">
542
  <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>
543
  <?php
544
  }
545
+
546
+ public function opt_out_render() {
547
  $options = get_option( 'ctcc_options_settings' ); ?>
548
  <input type='checkbox' name='ctcc_options_settings[wisdom_opt_out]' <?php checked ( ! empty ( $options['wisdom_opt_out'] ), 1 ); ?> value='1'>
549
  <p class="description"><?php _e( 'If you previously opted into allowing this plugin to track non-sensitive data, you can opt out here', 'uk-cookie-consent' ); ?></p>
550
  <?php
551
  }
552
+
553
  /*
554
  * Content renders
555
  */
556
 
557
+ public function heading_text_render() {
558
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
559
  <input type="text" name="ctcc_content_settings[heading_text]" value="<?php echo esc_attr( $ctcc_content_settings['heading_text'] ); ?>">
560
  <p class="description"><?php _e( 'The heading text - only applies if you are not using a top or bottom bar', 'uk-cookie-consent' ); ?></p>
561
  <?php
562
  }
563
+
564
+ public function notification_text_render() {
565
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
566
  <input class="widefat" type="text" name="ctcc_content_settings[notification_text]" value="<?php echo esc_attr( $ctcc_content_settings['notification_text'] ); ?>">
567
  <p class="description"><?php _e( 'The default text to indicate that your site uses cookies', 'uk-cookie-consent' ); ?></p>
568
  <?php
569
  }
570
+
571
+ public function accept_text_render() {
572
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
573
  <input type="text" name="ctcc_content_settings[accept_text]" value="<?php echo esc_attr( $ctcc_content_settings['accept_text'] ); ?>">
574
  <p class="description"><?php _e( 'The default text to dismiss the notification', 'uk-cookie-consent' ); ?></p>
575
  <?php
576
  }
577
+
578
+ public function more_info_text_render() {
579
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
580
  <input type="text" name="ctcc_content_settings[more_info_text]" value="<?php echo esc_attr( $ctcc_content_settings['more_info_text'] ); ?>">
581
  <p class="description"><?php _e( 'The default text to use to link to a page providing further information', 'uk-cookie-consent' ); ?></p>
582
  <?php
583
  }
584
+
585
+ public function more_info_page_render() {
586
  $ctcc_content_settings = get_option( 'ctcc_content_settings' );
587
  // Get all pages
588
  $pages = get_pages();
591
  <select name='ctcc_content_settings[more_info_page]'>
592
  <option></option>
593
  <?php foreach ( $pages as $page ) { ?>
594
+ <option value='<?php echo esc_attr( $page->ID ); ?>' <?php selected( $ctcc_content_settings['more_info_page'], $page -> ID ); ?>><?php echo esc_html( $page -> post_title ); ?></option>
595
  <?php } ?>
596
  </select>
597
  <p class="description"><?php _e( 'The page containing further information about your cookie policy', 'uk-cookie-consent' ); ?></p>
598
  <?php }
599
  }
600
 
601
+ public function more_info_url_render() {
602
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
603
  <input type="url" name="ctcc_content_settings[more_info_url]" value="<?php echo esc_url( $ctcc_content_settings['more_info_url'] ); ?>">
604
  <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>
605
  <?php
606
  }
607
+
608
+ public function more_info_target_render() {
609
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
610
  <select name='ctcc_content_settings[more_info_target]'>
611
  <option value='_blank' <?php selected( $ctcc_content_settings['more_info_target'], '_blank' ); ?>><?php _e( 'New Tab', 'uk-cookie-consent' ); ?></option>
614
  <p class="description"><?php _e( 'Open the More Information page in the same or new tab.', 'uk-cookie-consent' ); ?></p>
615
  <?php
616
  }
617
+
618
+ /*
619
  * Styles functions
620
  */
621
+
622
+ public function position_render() {
623
  $options = get_option( 'ctcc_styles_settings' ); ?>
624
  <select name='ctcc_styles_settings[position]'>
625
  <option value='top-bar' <?php selected( $options['position'], 'top-bar' ); ?>><?php _e( 'Top Bar', 'uk-cookie-consent' ); ?></option>
633
  <?php
634
  }
635
 
636
+ public function container_class_render() {
637
  $options = get_option( 'ctcc_styles_settings' ); ?>
638
  <input type="text" name="ctcc_styles_settings[container_class]" value="<?php echo esc_attr( $options['container_class'] ); ?>">
639
  <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>
640
  <?php
641
  }
642
 
643
+ public function enqueue_styles_render() {
644
  $options = get_option( 'ctcc_styles_settings' ); ?>
645
  <input type='checkbox' name='ctcc_styles_settings[enqueue_styles]' <?php checked ( ! empty ( $options['enqueue_styles'] ), 1 ); ?> value='1'>
646
  <p class="description"><?php _e( 'Deselect this to dequeue the plugin stylesheet', 'uk-cookie-consent' ); ?></p>
647
  <?php
648
  }
649
 
650
+ public function rounded_corners_render() {
651
  $options = get_option( 'ctcc_styles_settings' ); ?>
652
  <input type='checkbox' name='ctcc_styles_settings[rounded_corners]' <?php checked ( ! empty ( $options['rounded_corners'] ), 1 ); ?> value='1'>
653
  <p class="description"><?php _e( 'Round the corners on the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
654
  <?php
655
  }
656
 
657
+ public function drop_shadow_render() {
658
  $options = get_option( 'ctcc_styles_settings' ); ?>
659
  <input type='checkbox' name='ctcc_styles_settings[drop_shadow]' <?php checked ( ! empty ( $options['drop_shadow'] ), 1 ); ?> value='1'>
660
  <p class="description"><?php _e( 'Add drop shadow to the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
661
  <?php
662
  }
663
 
664
+ public function display_accept_with_text_render() {
665
  $options = get_option( 'ctcc_styles_settings' ); ?>
666
  <input type='checkbox' name='ctcc_styles_settings[display_accept_with_text]' <?php checked ( ! empty ( $options['display_accept_with_text'] ), 1 ); ?> value='1'>
667
  <p class="description"><?php _e( 'Display the confirmation button with notification text', 'uk-cookie-consent' ); ?></p>
668
  <?php
669
  }
670
 
671
+ public function x_close_render() {
672
  $options = get_option( 'ctcc_styles_settings' ); ?>
673
  <input type='checkbox' name='ctcc_styles_settings[x_close]' <?php checked ( ! empty ( $options['x_close'] ), 1 ); ?> value='1'>
674
  <p class="description"><?php _e( 'Remove confirmation button and use \'X\' icon instead', 'uk-cookie-consent' ); ?></p>
675
  <?php
676
  }
677
 
678
+ public function text_color_render() {
679
  $options = get_option( 'ctcc_styles_settings' ); ?>
680
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[text_color]" value="<?php echo esc_attr( $options['text_color'] ); ?>">
681
  <p class="description"><?php _e( 'The text color on the notification', 'uk-cookie-consent' ); ?></p>
682
  <?php
683
  }
684
+
685
+ public function bg_color_render() {
686
  $options = get_option( 'ctcc_styles_settings' ); ?>
687
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[bg_color]" value="<?php echo esc_attr( $options['bg_color'] ); ?>">
688
  <p class="description"><?php _e( 'The background color for the notification', 'uk-cookie-consent' ); ?></p>
689
  <?php
690
  }
691
+
692
+ public function link_color_render() {
693
  $options = get_option( 'ctcc_styles_settings' ); ?>
694
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[link_color]" value="<?php echo esc_attr( $options['link_color'] ); ?>">
695
  <p class="description"><?php _e( 'The link color on the notification', 'uk-cookie-consent' ); ?></p>
696
  <?php
697
  }
698
+
699
+ public function button_color_render() {
700
  $options = get_option( 'ctcc_styles_settings' ); ?>
701
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_color]" value="<?php echo esc_attr( $options['button_color'] ); ?>">
702
  <p class="description"><?php _e( 'The text color on the notification button', 'uk-cookie-consent' ); ?></p>
703
  <?php
704
  }
705
+
706
+ public function button_bg_color_render() {
707
  $options = get_option( 'ctcc_styles_settings' ); ?>
708
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_bg_color]" value="<?php echo esc_attr( $options['button_bg_color'] ); ?>">
709
  <p class="description"><?php _e( 'The background color on the notification button', 'uk-cookie-consent' ); ?></p>
710
  <?php
711
  }
712
+
713
+ public function flat_button_render() {
714
  $options = get_option( 'ctcc_styles_settings' ); ?>
715
  <input type='checkbox' name='ctcc_styles_settings[flat_button]' <?php checked ( ! empty ( $options['flat_button'] ), 1 ); ?> value='1'>
716
  <p class="description"><?php _e( 'Remove the border from the button', 'uk-cookie-consent' ); ?></p>
717
  <?php
718
  }
719
+
720
+ public function enable_metafield_render() {
721
  $options = get_option( 'ctcc_options_settings' ); ?>
722
  <input type='checkbox' name='ctcc_options_settings[enable_metafield]' <?php checked ( ! empty ( $options['enable_metafield'] ), 1 ); ?> value='1'>
723
  <p class="description"><?php _e( 'Select this to enable a metafield on pages and posts. Checking the metafield on a page or post will exclude that page from displaying the notification.', 'uk-cookie-consent' ); ?></p>
724
  <?php
725
  }
726
+
727
  public function settings_section_callback() {
728
  echo '<p>' . __( 'Basic settings', 'uk-cookie-consent' ) . '</p>';
729
  echo '<p><a href="http://iubenda.refr.cc/JKNZ55D" target="_blank">' . __( 'Create your own privacy policy here') . '</a></p>';
730
  }
731
+
732
+ public function content_settings_section_callback() {
733
  echo '<p>' .__( 'Update the content displayed to the user', 'uk-cookie-consent' ) . '</p>';
734
  echo '<p><a href="http://iubenda.refr.cc/JKNZ55D" target="_blank">' . __( 'Create your own privacy policy here') . '</a></p>';
735
  }
736
+
737
+ public function styles_settings_section_callback() {
738
  echo '<p>' .__( 'Change the styles here if you like - but it\'s better in the Customizer', 'uk-cookie-consent' ) . '</p>';
739
  echo '<p><a href="http://iubenda.refr.cc/JKNZ55D" target="_blank">' . __( 'Create your own privacy policy here') . '</a></p>';
740
  }
741
+
742
+ public function pages_settings_section_callback() {
743
  echo '<p>' . __( 'Use this section to set exclusion rules for pages and posts.', 'uk-cookie-consent' ) . '</p>';
744
  echo '<p><a href="http://iubenda.refr.cc/JKNZ55D" target="_blank">' . __( 'Create your own privacy policy here') . '</a></p>';
745
  }
746
+
747
  public function options_page() {
748
  $reset = isset ( $_GET['reset'] ) ? $_GET['reset'] : '';
749
  if ( isset ( $_POST['reset'] ) ) {
750
+
751
  $defaults = $this -> get_default_styles_settings();
752
  update_option ( 'ctcc_styles_settings', $defaults );
753
 
754
  $defaults = $this -> get_default_content_settings();
755
  update_option ( 'ctcc_content_settings', $defaults );
756
+
757
  }
758
  $current = isset ( $_GET['tab'] ) ? $_GET['tab'] : 'options';
759
  $title = __( 'Cookie Consent', 'uk-cookie-consent' );
762
  'content' => __( 'Content', 'uk-cookie-consent' ),
763
  'styles' => __( 'Styles', 'uk-cookie-consent' )
764
  );?>
765
+
766
  <div class="wrap">
767
  <h1><?php echo $title; ?></h1>
768
  <div class="ctdb-outer-wrap">
787
  </p>
788
  </form>
789
  </div><!-- .ctdb-inner-wrap -->
790
+
791
  <div class="ctdb-banners">
792
  <div class="ctdb-banner">
793
  <a href="https://catapultthemes.com/downloads/showcase/?utm_source=plugin_ad&utm_medium=wp_plugin&utm_content=cookieconsent&utm_campaign=themes"><img src="<?php echo CTCC_PLUGIN_URL . 'assets/images/showcase-banner-ad.jpg'; ?>" alt="" ></a>
800
  </div>
801
  <div class="ctdb-banner">
802
  <a href="http://superheroslider.catapultthemes.com/?utm_source=plugin_ad&utm_medium=wp_plugin&utm_content=cookieconsent&utm_campaign=superhero"><img src="<?php echo CTCC_PLUGIN_URL . 'assets/images/superhero-ad1.png'; ?>" alt="" ></a>
803
+ </div>
804
  </div>
805
+
806
  </div><!-- .ctdb-outer-wrap -->
807
  </div><!-- .wrap -->
808
  <?php
809
  }
810
 
 
 
 
 
811
 
812
+ }
813
 
814
+ }
readme.txt CHANGED
@@ -3,17 +3,18 @@ Contributors: Catapult_Themes, husobj, jraczynski
3
  Donate Link: https://www.paypal.me/catapultthemes
4
  Tags: cookie law, cookies, eu cookie law, eu privacy directive, cookie compliance, cookie law, cookie notice, cookie notification, wpml, geo ip
5
  Requires at least: 4.3
6
- Tested up to: 4.9.3
7
- Stable tag: 2.3.9
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
 
12
  == Description ==
13
- Cookie Consent is one of the simplest and most popular cookie notification plugins out there. It's been actively developed and supported since 2012 and has over 100 5 star reviews.
14
 
15
- > <strong>New in 2.3.0:</strong><br>Geo IP support - choose which continents to display notifications (requires GeoIP Detect plugin to be installed)<br>
16
- > <strong>New in 2.2.0:</strong><br>Easily select pages or posts where the cookie notification doesn't display. You now have complete control over which pages display a notification and which don't.<br>Close on scroll - optionally choose scrolling as closure method.
 
 
17
 
18
  = Simple set up =
19
  One of the most popular aspects of the plugin is its simplicity of use - simply install and activate the plugin to automatically add the cookie consent notification bar. There is no 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.
@@ -71,6 +72,9 @@ You will find more details of the regulations on the [Information Commissioner's
71
 
72
  == Changelog ==
73
 
 
 
 
74
  = 2.3.9 =
75
  * Updated: removed tracking
76
 
3
  Donate Link: https://www.paypal.me/catapultthemes
4
  Tags: cookie law, cookies, eu cookie law, eu privacy directive, cookie compliance, cookie law, cookie notice, cookie notification, wpml, geo ip
5
  Requires at least: 4.3
6
+ Tested up to: 4.9.6
7
+ Stable tag: 2.3.10
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
 
12
  == Description ==
 
13
 
14
+ > <strong>Cookie Consent and GDPR</strong><br>Please refer to this [support ticket regarding this plugin and GDPR](https://wordpress.org/support/topic/cookie-consent-and-gdpr/). Note that I'm not qualified to tell you whether this plugin meets your GDPR requirements - you'll need to decide that for yourself.<br><br>
15
+ > <strong>The wording below was written when this plugin was first released and refers to an earlier EU directive regarding cookies. It does not refer to GDPR in any way.</strong><br>
16
+
17
+ Cookie Consent is one of the simplest and most popular cookie notification plugins out there. It's been actively developed and supported since 2012 and has over 100 5 star reviews.
18
 
19
  = Simple set up =
20
  One of the most popular aspects of the plugin is its simplicity of use - simply install and activate the plugin to automatically add the cookie consent notification bar. There is no 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.
72
 
73
  == Changelog ==
74
 
75
+ = 2.3.10 =
76
+ * Fixed: fixed security vulnerability identified by James Boughey
77
+
78
  = 2.3.9 =
79
  * Updated: removed tracking
80
 
uk-cookie-consent.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Cookie Consent
4
  Plugin URI: https://catapultthemes.com/cookie-consent/
5
  Description: The only cookie consent plugin you'll ever need.
6
- Version: 2.3.9
7
  Author: Catapult_Themes
8
  Author URI: https://catapultthemes.com/
9
  Text Domain: uk-cookie-consent
3
  Plugin Name: Cookie Consent
4
  Plugin URI: https://catapultthemes.com/cookie-consent/
5
  Description: The only cookie consent plugin you'll ever need.
6
+ Version: 2.3.10
7
  Author: Catapult_Themes
8
  Author URI: https://catapultthemes.com/
9
  Text Domain: uk-cookie-consent