Cookie Consent - Version 2.3.0

Version Description

  • Added: GeoIP support (suggested by jeffrobbins)
Download this release

Release Info

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

Code changes from version 2.2.5 to 2.3.0

admin/class-ctcc-admin.php CHANGED
@@ -92,6 +92,14 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
92
  'ctcc_options_section'
93
  );
94
 
 
 
 
 
 
 
 
 
95
  add_settings_field (
96
  'duration',
97
  __( 'Notification Duration', 'uk-cookie-consent' ),
@@ -366,6 +374,7 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
366
  'scroll_height' => 200,
367
  'first_page' => 0,
368
  'enable_metafield' => 0,
 
369
  'duration' => 60,
370
  'cookie_expiry' => 30,
371
  'cookie_version' => 1
@@ -452,47 +461,66 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
452
  public function closure_render() {
453
  $options = get_option( 'ctcc_options_settings' ); ?>
454
  <select name='ctcc_options_settings[closure]'>
455
- <option value='click' <?php selected( $options['closure'], 'click' ); ?>><?php _e ( 'On Click', 'uk-cookie-consent' ); ?></option>
456
- <option value='scroll' <?php selected( $options['closure'], 'scroll' ); ?>><?php _e ( 'On Scroll', 'uk-cookie-consent' ); ?></option>
457
- <option value='timed' <?php selected( $options['closure'], 'timed' ); ?>><?php _e ( 'Timed', 'uk-cookie-consent' ); ?></option>
458
 
459
  </select>
460
- <p class="description"><?php _e ( 'How you want the user to close the notification', 'uk-cookie-consent' ); ?></p>
461
  <?php
462
  }
463
 
464
  public function first_page_render() {
465
  $options = get_option( 'ctcc_options_settings' ); ?>
466
- <input type='checkbox' name='ctcc_options_settings[first_page]' <?php checked ( ! empty ( $options['first_page'] ), 1 ); ?> value='1'>
467
- <p class="description"><?php _e ( 'Select this to show the notification only on the first page the user visits', 'uk-cookie-consent' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
468
  <?php
469
  }
470
 
471
  public function scroll_height_render() {
472
  $options = get_option( 'ctcc_options_settings' ); ?>
473
  <input type="number" min="1" name="ctcc_options_settings[scroll_height]" value="<?php echo esc_attr( $options['scroll_height'] ); ?>">
474
- <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>
475
  <?php
476
  }
477
 
478
  public function duration_render() {
479
  $options = get_option( 'ctcc_options_settings' ); ?>
480
  <input type="number" min="1" name="ctcc_options_settings[duration]" value="<?php echo esc_attr( $options['duration'] ); ?>">
481
- <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>
482
  <?php
483
  }
484
 
485
  public function cookie_expiry_render() {
486
  $options = get_option( 'ctcc_options_settings' ); ?>
487
  <input type="number" min="1" name="ctcc_options_settings[cookie_expiry]" value="<?php echo esc_attr( $options['cookie_expiry'] ); ?>">
488
- <p class="description"><?php _e ( 'The number of days that the cookie is set for', 'uk-cookie-consent' ); ?></p>
489
  <?php
490
  }
491
 
492
  public function cookie_version_render() {
493
  $options = get_option( 'ctcc_options_settings' ); ?>
494
  <input type="text" name="ctcc_options_settings[cookie_version]" value="<?php echo esc_attr( $options['cookie_version'] ); ?>">
495
- <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>
496
  <?php
497
  }
498
 
@@ -503,28 +531,28 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
503
  public function heading_text_render() {
504
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
505
  <input type="text" name="ctcc_content_settings[heading_text]" value="<?php echo esc_attr( $ctcc_content_settings['heading_text'] ); ?>">
506
- <p class="description"><?php _e ( 'The heading text - only applies if you are not using a top or bottom bar', 'uk-cookie-consent' ); ?></p>
507
  <?php
508
  }
509
 
510
  public function notification_text_render() {
511
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
512
  <input class="widefat" type="text" name="ctcc_content_settings[notification_text]" value="<?php echo esc_attr( $ctcc_content_settings['notification_text'] ); ?>">
513
- <p class="description"><?php _e ( 'The default text to indicate that your site uses cookies', 'uk-cookie-consent' ); ?></p>
514
  <?php
515
  }
516
 
517
  public function accept_text_render() {
518
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
519
  <input type="text" name="ctcc_content_settings[accept_text]" value="<?php echo esc_attr( $ctcc_content_settings['accept_text'] ); ?>">
520
- <p class="description"><?php _e ( 'The default text to dismiss the notification', 'uk-cookie-consent' ); ?></p>
521
  <?php
522
  }
523
 
524
  public function more_info_text_render() {
525
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
526
  <input type="text" name="ctcc_content_settings[more_info_text]" value="<?php echo esc_attr( $ctcc_content_settings['more_info_text'] ); ?>">
527
- <p class="description"><?php _e ( 'The default text to use to link to a page providing further information', 'uk-cookie-consent' ); ?></p>
528
  <?php
529
  }
530
 
@@ -540,24 +568,24 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
540
  <option value='<?php echo $page -> ID; ?>' <?php selected( $ctcc_content_settings['more_info_page'], $page -> ID ); ?>><?php echo $page -> post_title; ?></option>
541
  <?php } ?>
542
  </select>
543
- <p class="description"><?php _e ( 'The page containing further information about your cookie policy', 'discussion-board' ); ?></p>
544
  <?php }
545
  }
546
 
547
  public function more_info_url_render() {
548
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
549
  <input type="url" name="ctcc_content_settings[more_info_url]" value="<?php echo esc_url( $ctcc_content_settings['more_info_url'] ); ?>">
550
- <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>
551
  <?php
552
  }
553
 
554
  public function more_info_target_render() {
555
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
556
  <select name='ctcc_content_settings[more_info_target]'>
557
- <option value='_blank' <?php selected( $ctcc_content_settings['more_info_target'], '_blank' ); ?>><?php _e ( 'New Tab', 'uk-cookie-consent' ); ?></option>
558
- <option value='_self' <?php selected( $ctcc_content_settings['more_info_target'], '_self' ); ?>><?php _e ( 'Same Tab', 'uk-cookie-consent' ); ?></option>
559
  </select>
560
- <p class="description"><?php _e ( 'Open the More Information page in the same or new tab.', 'uk-cookie-consent' ); ?></p>
561
  <?php
562
  }
563
 
@@ -568,105 +596,105 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
568
  public function position_render() {
569
  $options = get_option( 'ctcc_styles_settings' ); ?>
570
  <select name='ctcc_styles_settings[position]'>
571
- <option value='top-bar' <?php selected( $options['position'], 'top-bar' ); ?>><?php _e ( 'Top Bar', 'uk-cookie-consent' ); ?></option>
572
- <option value='bottom-bar' <?php selected( $options['position'], 'bottom-bar' ); ?>><?php _e ( 'Bottom Bar', 'uk-cookie-consent' ); ?></option>
573
- <option value='top-left-block' <?php selected( $options['position'], 'top-left-block' ); ?>><?php _e ( 'Top Left Block', 'uk-cookie-consent' ); ?></option>
574
- <option value='top-right-block' <?php selected( $options['position'], 'top-right-block' ); ?>><?php _e ( 'Top Right Block', 'uk-cookie-consent' ); ?></option>
575
- <option value='bottom-left-block' <?php selected( $options['position'], 'bottom-left-block' ); ?>><?php _e ( 'Bottom Left Block', 'uk-cookie-consent' ); ?></option>
576
- <option value='bottom-right-block' <?php selected( $options['position'], 'bottom-right-block' ); ?>><?php _e ( 'Bottom Right Block', 'uk-cookie-consent' ); ?></option>
577
  </select>
578
- <p class="description"><?php _e ( 'Where the notification should appear', 'uk-cookie-consent' ); ?></p>
579
  <?php
580
  }
581
 
582
  public function container_class_render() {
583
  $options = get_option( 'ctcc_styles_settings' ); ?>
584
  <input type="text" name="ctcc_styles_settings[container_class]" value="<?php echo esc_attr( $options['container_class'] ); ?>">
585
- <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>
586
  <?php
587
  }
588
 
589
  public function enqueue_styles_render() {
590
  $options = get_option( 'ctcc_styles_settings' ); ?>
591
  <input type='checkbox' name='ctcc_styles_settings[enqueue_styles]' <?php checked ( ! empty ( $options['enqueue_styles'] ), 1 ); ?> value='1'>
592
- <p class="description"><?php _e ( 'Deselect this to dequeue the plugin stylesheet', 'uk-cookie-consent' ); ?></p>
593
  <?php
594
  }
595
 
596
  public function rounded_corners_render() {
597
  $options = get_option( 'ctcc_styles_settings' ); ?>
598
  <input type='checkbox' name='ctcc_styles_settings[rounded_corners]' <?php checked ( ! empty ( $options['rounded_corners'] ), 1 ); ?> value='1'>
599
- <p class="description"><?php _e ( 'Round the corners on the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
600
  <?php
601
  }
602
 
603
  public function drop_shadow_render() {
604
  $options = get_option( 'ctcc_styles_settings' ); ?>
605
  <input type='checkbox' name='ctcc_styles_settings[drop_shadow]' <?php checked ( ! empty ( $options['drop_shadow'] ), 1 ); ?> value='1'>
606
- <p class="description"><?php _e ( 'Add drop shadow to the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
607
  <?php
608
  }
609
 
610
  public function display_accept_with_text_render() {
611
  $options = get_option( 'ctcc_styles_settings' ); ?>
612
  <input type='checkbox' name='ctcc_styles_settings[display_accept_with_text]' <?php checked ( ! empty ( $options['display_accept_with_text'] ), 1 ); ?> value='1'>
613
- <p class="description"><?php _e ( 'Display the confirmation button with notification text', 'uk-cookie-consent' ); ?></p>
614
  <?php
615
  }
616
 
617
  public function x_close_render() {
618
  $options = get_option( 'ctcc_styles_settings' ); ?>
619
  <input type='checkbox' name='ctcc_styles_settings[x_close]' <?php checked ( ! empty ( $options['x_close'] ), 1 ); ?> value='1'>
620
- <p class="description"><?php _e ( 'Remove confirmation button and use \'X\' icon instead', 'uk-cookie-consent' ); ?></p>
621
  <?php
622
  }
623
 
624
  public function text_color_render() {
625
  $options = get_option( 'ctcc_styles_settings' ); ?>
626
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[text_color]" value="<?php echo esc_attr( $options['text_color'] ); ?>">
627
- <p class="description"><?php _e ( 'The text color on the notification', 'uk-cookie-consent' ); ?></p>
628
  <?php
629
  }
630
 
631
  public function bg_color_render() {
632
  $options = get_option( 'ctcc_styles_settings' ); ?>
633
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[bg_color]" value="<?php echo esc_attr( $options['bg_color'] ); ?>">
634
- <p class="description"><?php _e ( 'The background color for the notification', 'uk-cookie-consent' ); ?></p>
635
  <?php
636
  }
637
 
638
  public function link_color_render() {
639
  $options = get_option( 'ctcc_styles_settings' ); ?>
640
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[link_color]" value="<?php echo esc_attr( $options['link_color'] ); ?>">
641
- <p class="description"><?php _e ( 'The link color on the notification', 'uk-cookie-consent' ); ?></p>
642
  <?php
643
  }
644
 
645
  public function button_color_render() {
646
  $options = get_option( 'ctcc_styles_settings' ); ?>
647
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_color]" value="<?php echo esc_attr( $options['button_color'] ); ?>">
648
- <p class="description"><?php _e ( 'The text color on the notification button', 'uk-cookie-consent' ); ?></p>
649
  <?php
650
  }
651
 
652
  public function button_bg_color_render() {
653
  $options = get_option( 'ctcc_styles_settings' ); ?>
654
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_bg_color]" value="<?php echo esc_attr( $options['button_bg_color'] ); ?>">
655
- <p class="description"><?php _e ( 'The background color on the notification button', 'uk-cookie-consent' ); ?></p>
656
  <?php
657
  }
658
 
659
  public function flat_button_render() {
660
  $options = get_option( 'ctcc_styles_settings' ); ?>
661
  <input type='checkbox' name='ctcc_styles_settings[flat_button]' <?php checked ( ! empty ( $options['flat_button'] ), 1 ); ?> value='1'>
662
- <p class="description"><?php _e ( 'Remove the border from the button', 'uk-cookie-consent' ); ?></p>
663
  <?php
664
  }
665
 
666
  public function enable_metafield_render() {
667
  $options = get_option( 'ctcc_options_settings' ); ?>
668
  <input type='checkbox' name='ctcc_options_settings[enable_metafield]' <?php checked ( ! empty ( $options['enable_metafield'] ), 1 ); ?> value='1'>
669
- <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>
670
  <?php
671
  }
672
 
@@ -724,7 +752,7 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
724
  </form>
725
  <form method="post" action="">
726
  <p class="submit">
727
- <input name="reset" class="button button-secondary" type="submit" value="<?php _e ( 'Reset plugin defaults', 'uk-cookie-consent' ); ?>" >
728
  <input type="hidden" name="action" value="reset" />
729
  </p>
730
  </form>
92
  'ctcc_options_section'
93
  );
94
 
95
+ add_settings_field (
96
+ 'exclude_zones',
97
+ __( 'Exclude Zones', 'uk-cookie-consent' ),
98
+ array ( $this, 'exclude_zones_render' ),
99
+ 'ctcc_options',
100
+ 'ctcc_options_section'
101
+ );
102
+
103
  add_settings_field (
104
  'duration',
105
  __( 'Notification Duration', 'uk-cookie-consent' ),
374
  'scroll_height' => 200,
375
  'first_page' => 0,
376
  'enable_metafield' => 0,
377
+ 'zones_only' => '',
378
  'duration' => 60,
379
  'cookie_expiry' => 30,
380
  'cookie_version' => 1
461
  public function closure_render() {
462
  $options = get_option( 'ctcc_options_settings' ); ?>
463
  <select name='ctcc_options_settings[closure]'>
464
+ <option value='click' <?php selected( $options['closure'], 'click' ); ?>><?php _e( 'On Click', 'uk-cookie-consent' ); ?></option>
465
+ <option value='scroll' <?php selected( $options['closure'], 'scroll' ); ?>><?php _e( 'On Scroll', 'uk-cookie-consent' ); ?></option>
466
+ <option value='timed' <?php selected( $options['closure'], 'timed' ); ?>><?php _e( 'Timed', 'uk-cookie-consent' ); ?></option>
467
 
468
  </select>
469
+ <p class="description"><?php _e( 'How you want the user to close the notification', 'uk-cookie-consent' ); ?></p>
470
  <?php
471
  }
472
 
473
  public function first_page_render() {
474
  $options = get_option( 'ctcc_options_settings' ); ?>
475
+ <input type='checkbox' name='ctcc_options_settings[first_page]' <?php checked ( ! empty ( $options['first_page'] ), 1 ); ?> value='1'>
476
+ <p class="description"><?php _e( 'Select this to show the notification only on the first page the user visits', 'uk-cookie-consent' ); ?></p>
477
+ <?php
478
+ }
479
+
480
+ public function exclude_zones_render() {
481
+ $options = get_option( 'ctcc_options_settings' );
482
+ $zones = array();
483
+ if( isset( $options['exclude_zones'] ) ) {
484
+ $zones = $options['exclude_zones'];
485
+ } ?>
486
+ <select multiple name='ctcc_options_settings[exclude_zones][]'>
487
+ <option value='AF' <?php selected( in_array( 'AF', $zones ) ); ?>><?php _e( 'Africa', 'uk-cookie-consent' ); ?></option>
488
+ <option value='AN' <?php selected( in_array( 'AN', $zones ) ); ?>><?php _e( 'Antarctica', 'uk-cookie-consent' ); ?></option>
489
+ <option value='AS' <?php selected( in_array( 'AS', $zones ) ); ?>><?php _e( 'Asia', 'uk-cookie-consent' ); ?></option>
490
+ <option value='EU' <?php selected( in_array( 'EU', $zones ) ); ?>><?php _e( 'Europe', 'uk-cookie-consent' ); ?></option>
491
+ <option value='NA' <?php selected( in_array( 'NA', $zones ) ); ?>><?php _e( 'North America', 'uk-cookie-consent' ); ?></option>
492
+ <option value='OC' <?php selected( in_array( 'OC', $zones ) ); ?>><?php _e( 'Oceania', 'uk-cookie-consent' ); ?></option>
493
+ <option value='SA' <?php selected( in_array( 'SA', $zones ) ); ?>><?php _e( 'South America', 'uk-cookie-consent' ); ?></option>
494
+ </select>
495
+ <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>
496
  <?php
497
  }
498
 
499
  public function scroll_height_render() {
500
  $options = get_option( 'ctcc_options_settings' ); ?>
501
  <input type="number" min="1" name="ctcc_options_settings[scroll_height]" value="<?php echo esc_attr( $options['scroll_height'] ); ?>">
502
+ <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>
503
  <?php
504
  }
505
 
506
  public function duration_render() {
507
  $options = get_option( 'ctcc_options_settings' ); ?>
508
  <input type="number" min="1" name="ctcc_options_settings[duration]" value="<?php echo esc_attr( $options['duration'] ); ?>">
509
+ <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>
510
  <?php
511
  }
512
 
513
  public function cookie_expiry_render() {
514
  $options = get_option( 'ctcc_options_settings' ); ?>
515
  <input type="number" min="1" name="ctcc_options_settings[cookie_expiry]" value="<?php echo esc_attr( $options['cookie_expiry'] ); ?>">
516
+ <p class="description"><?php _e( 'The number of days that the cookie is set for', 'uk-cookie-consent' ); ?></p>
517
  <?php
518
  }
519
 
520
  public function cookie_version_render() {
521
  $options = get_option( 'ctcc_options_settings' ); ?>
522
  <input type="text" name="ctcc_options_settings[cookie_version]" value="<?php echo esc_attr( $options['cookie_version'] ); ?>">
523
+ <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>
524
  <?php
525
  }
526
 
531
  public function heading_text_render() {
532
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
533
  <input type="text" name="ctcc_content_settings[heading_text]" value="<?php echo esc_attr( $ctcc_content_settings['heading_text'] ); ?>">
534
+ <p class="description"><?php _e( 'The heading text - only applies if you are not using a top or bottom bar', 'uk-cookie-consent' ); ?></p>
535
  <?php
536
  }
537
 
538
  public function notification_text_render() {
539
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
540
  <input class="widefat" type="text" name="ctcc_content_settings[notification_text]" value="<?php echo esc_attr( $ctcc_content_settings['notification_text'] ); ?>">
541
+ <p class="description"><?php _e( 'The default text to indicate that your site uses cookies', 'uk-cookie-consent' ); ?></p>
542
  <?php
543
  }
544
 
545
  public function accept_text_render() {
546
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
547
  <input type="text" name="ctcc_content_settings[accept_text]" value="<?php echo esc_attr( $ctcc_content_settings['accept_text'] ); ?>">
548
+ <p class="description"><?php _e( 'The default text to dismiss the notification', 'uk-cookie-consent' ); ?></p>
549
  <?php
550
  }
551
 
552
  public function more_info_text_render() {
553
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
554
  <input type="text" name="ctcc_content_settings[more_info_text]" value="<?php echo esc_attr( $ctcc_content_settings['more_info_text'] ); ?>">
555
+ <p class="description"><?php _e( 'The default text to use to link to a page providing further information', 'uk-cookie-consent' ); ?></p>
556
  <?php
557
  }
558
 
568
  <option value='<?php echo $page -> ID; ?>' <?php selected( $ctcc_content_settings['more_info_page'], $page -> ID ); ?>><?php echo $page -> post_title; ?></option>
569
  <?php } ?>
570
  </select>
571
+ <p class="description"><?php _e( 'The page containing further information about your cookie policy', 'discussion-board' ); ?></p>
572
  <?php }
573
  }
574
 
575
  public function more_info_url_render() {
576
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
577
  <input type="url" name="ctcc_content_settings[more_info_url]" value="<?php echo esc_url( $ctcc_content_settings['more_info_url'] ); ?>">
578
+ <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>
579
  <?php
580
  }
581
 
582
  public function more_info_target_render() {
583
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
584
  <select name='ctcc_content_settings[more_info_target]'>
585
+ <option value='_blank' <?php selected( $ctcc_content_settings['more_info_target'], '_blank' ); ?>><?php _e( 'New Tab', 'uk-cookie-consent' ); ?></option>
586
+ <option value='_self' <?php selected( $ctcc_content_settings['more_info_target'], '_self' ); ?>><?php _e( 'Same Tab', 'uk-cookie-consent' ); ?></option>
587
  </select>
588
+ <p class="description"><?php _e( 'Open the More Information page in the same or new tab.', 'uk-cookie-consent' ); ?></p>
589
  <?php
590
  }
591
 
596
  public function position_render() {
597
  $options = get_option( 'ctcc_styles_settings' ); ?>
598
  <select name='ctcc_styles_settings[position]'>
599
+ <option value='top-bar' <?php selected( $options['position'], 'top-bar' ); ?>><?php _e( 'Top Bar', 'uk-cookie-consent' ); ?></option>
600
+ <option value='bottom-bar' <?php selected( $options['position'], 'bottom-bar' ); ?>><?php _e( 'Bottom Bar', 'uk-cookie-consent' ); ?></option>
601
+ <option value='top-left-block' <?php selected( $options['position'], 'top-left-block' ); ?>><?php _e( 'Top Left Block', 'uk-cookie-consent' ); ?></option>
602
+ <option value='top-right-block' <?php selected( $options['position'], 'top-right-block' ); ?>><?php _e( 'Top Right Block', 'uk-cookie-consent' ); ?></option>
603
+ <option value='bottom-left-block' <?php selected( $options['position'], 'bottom-left-block' ); ?>><?php _e( 'Bottom Left Block', 'uk-cookie-consent' ); ?></option>
604
+ <option value='bottom-right-block' <?php selected( $options['position'], 'bottom-right-block' ); ?>><?php _e( 'Bottom Right Block', 'uk-cookie-consent' ); ?></option>
605
  </select>
606
+ <p class="description"><?php _e( 'Where the notification should appear', 'uk-cookie-consent' ); ?></p>
607
  <?php
608
  }
609
 
610
  public function container_class_render() {
611
  $options = get_option( 'ctcc_styles_settings' ); ?>
612
  <input type="text" name="ctcc_styles_settings[container_class]" value="<?php echo esc_attr( $options['container_class'] ); ?>">
613
+ <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>
614
  <?php
615
  }
616
 
617
  public function enqueue_styles_render() {
618
  $options = get_option( 'ctcc_styles_settings' ); ?>
619
  <input type='checkbox' name='ctcc_styles_settings[enqueue_styles]' <?php checked ( ! empty ( $options['enqueue_styles'] ), 1 ); ?> value='1'>
620
+ <p class="description"><?php _e( 'Deselect this to dequeue the plugin stylesheet', 'uk-cookie-consent' ); ?></p>
621
  <?php
622
  }
623
 
624
  public function rounded_corners_render() {
625
  $options = get_option( 'ctcc_styles_settings' ); ?>
626
  <input type='checkbox' name='ctcc_styles_settings[rounded_corners]' <?php checked ( ! empty ( $options['rounded_corners'] ), 1 ); ?> value='1'>
627
+ <p class="description"><?php _e( 'Round the corners on the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
628
  <?php
629
  }
630
 
631
  public function drop_shadow_render() {
632
  $options = get_option( 'ctcc_styles_settings' ); ?>
633
  <input type='checkbox' name='ctcc_styles_settings[drop_shadow]' <?php checked ( ! empty ( $options['drop_shadow'] ), 1 ); ?> value='1'>
634
+ <p class="description"><?php _e( 'Add drop shadow to the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
635
  <?php
636
  }
637
 
638
  public function display_accept_with_text_render() {
639
  $options = get_option( 'ctcc_styles_settings' ); ?>
640
  <input type='checkbox' name='ctcc_styles_settings[display_accept_with_text]' <?php checked ( ! empty ( $options['display_accept_with_text'] ), 1 ); ?> value='1'>
641
+ <p class="description"><?php _e( 'Display the confirmation button with notification text', 'uk-cookie-consent' ); ?></p>
642
  <?php
643
  }
644
 
645
  public function x_close_render() {
646
  $options = get_option( 'ctcc_styles_settings' ); ?>
647
  <input type='checkbox' name='ctcc_styles_settings[x_close]' <?php checked ( ! empty ( $options['x_close'] ), 1 ); ?> value='1'>
648
+ <p class="description"><?php _e( 'Remove confirmation button and use \'X\' icon instead', 'uk-cookie-consent' ); ?></p>
649
  <?php
650
  }
651
 
652
  public function text_color_render() {
653
  $options = get_option( 'ctcc_styles_settings' ); ?>
654
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[text_color]" value="<?php echo esc_attr( $options['text_color'] ); ?>">
655
+ <p class="description"><?php _e( 'The text color on the notification', 'uk-cookie-consent' ); ?></p>
656
  <?php
657
  }
658
 
659
  public function bg_color_render() {
660
  $options = get_option( 'ctcc_styles_settings' ); ?>
661
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[bg_color]" value="<?php echo esc_attr( $options['bg_color'] ); ?>">
662
+ <p class="description"><?php _e( 'The background color for the notification', 'uk-cookie-consent' ); ?></p>
663
  <?php
664
  }
665
 
666
  public function link_color_render() {
667
  $options = get_option( 'ctcc_styles_settings' ); ?>
668
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[link_color]" value="<?php echo esc_attr( $options['link_color'] ); ?>">
669
+ <p class="description"><?php _e( 'The link color on the notification', 'uk-cookie-consent' ); ?></p>
670
  <?php
671
  }
672
 
673
  public function button_color_render() {
674
  $options = get_option( 'ctcc_styles_settings' ); ?>
675
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_color]" value="<?php echo esc_attr( $options['button_color'] ); ?>">
676
+ <p class="description"><?php _e( 'The text color on the notification button', 'uk-cookie-consent' ); ?></p>
677
  <?php
678
  }
679
 
680
  public function button_bg_color_render() {
681
  $options = get_option( 'ctcc_styles_settings' ); ?>
682
  <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_bg_color]" value="<?php echo esc_attr( $options['button_bg_color'] ); ?>">
683
+ <p class="description"><?php _e( 'The background color on the notification button', 'uk-cookie-consent' ); ?></p>
684
  <?php
685
  }
686
 
687
  public function flat_button_render() {
688
  $options = get_option( 'ctcc_styles_settings' ); ?>
689
  <input type='checkbox' name='ctcc_styles_settings[flat_button]' <?php checked ( ! empty ( $options['flat_button'] ), 1 ); ?> value='1'>
690
+ <p class="description"><?php _e( 'Remove the border from the button', 'uk-cookie-consent' ); ?></p>
691
  <?php
692
  }
693
 
694
  public function enable_metafield_render() {
695
  $options = get_option( 'ctcc_options_settings' ); ?>
696
  <input type='checkbox' name='ctcc_options_settings[enable_metafield]' <?php checked ( ! empty ( $options['enable_metafield'] ), 1 ); ?> value='1'>
697
+ <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>
698
  <?php
699
  }
700
 
752
  </form>
753
  <form method="post" action="">
754
  <p class="submit">
755
+ <input name="reset" class="button button-secondary" type="submit" value="<?php _e( 'Reset plugin defaults', 'uk-cookie-consent' ); ?>" >
756
  <input type="hidden" name="action" value="reset" />
757
  </p>
758
  </form>
assets/css/style.css CHANGED
@@ -17,6 +17,15 @@ html.has-cookie-bar.cookie-bar-top-bar {
17
  -moz-transition: all 0.25s;
18
  transition: all 0.25s;
19
  }
 
 
 
 
 
 
 
 
 
20
  #catapult-cookie-bar.rounded-corners {
21
  border-radius: 3px;
22
  }
17
  -moz-transition: all 0.25s;
18
  transition: all 0.25s;
19
  }
20
+ .ctcc-exclude-AF.geoip-continent-AF #catapult-cookie-bar,
21
+ .ctcc-exclude-AN.geoip-continent-AN #catapult-cookie-bar,
22
+ .ctcc-exclude-AS.geoip-continent-AS #catapult-cookie-bar,
23
+ .ctcc-exclude-EU.geoip-continent-EU #catapult-cookie-bar,
24
+ .ctcc-exclude-NA.geoip-continent-NA #catapult-cookie-bar,
25
+ .ctcc-exclude-OC.geoip-continent-OC #catapult-cookie-bar,
26
+ .ctcc-exclude-SA.geoip-continent-SA #catapult-cookie-bar {
27
+ display: none;
28
+ }
29
  #catapult-cookie-bar.rounded-corners {
30
  border-radius: 3px;
31
  }
public/class-ctcc-public.php CHANGED
@@ -24,12 +24,27 @@ if ( ! class_exists( 'CTCC_Public' ) ) { // Don't initialise if there's already
24
  * @since 2.0.0
25
  */
26
  public function init() {
 
27
  add_action ( 'wp_enqueue_scripts', array ( $this, 'enqueue_scripts' ) );
28
  add_action ( 'wp_head', array ( $this, 'add_css' ) );
29
  add_action ( 'wp_footer', array ( $this, 'add_js' ), 1000 );
30
  add_action ( 'wp_footer', array ( $this, 'add_notification_bar' ), 1000 );
31
  }
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  /*
34
  * Enqueue styles and scripts
35
  * @since 2.0.0
@@ -41,9 +56,9 @@ if ( ! class_exists( 'CTCC_Public' ) ) { // Don't initialise if there's already
41
  $ctcc_options_settings = get_option ( 'ctcc_options_settings' );
42
  $options = get_option ( 'ctcc_styles_settings' );
43
  if ( isset ( $options['enqueue_styles'] ) ) {
44
- wp_enqueue_style ( 'cookie-consent-style', CTCC_PLUGIN_URL . 'assets/css/style.css', '2.0.0' );
45
  }
46
- wp_enqueue_script ( 'cookie-consent', CTCC_PLUGIN_URL . 'assets/js/uk-cookie-consent-js.js', array ( 'jquery' ), '2.2.5', true );
47
  wp_localize_script (
48
  'cookie-consent',
49
  'ctcc_vars',
24
  * @since 2.0.0
25
  */
26
  public function init() {
27
+ add_filter( 'body_class', array ( $this, 'body_class' ) );
28
  add_action ( 'wp_enqueue_scripts', array ( $this, 'enqueue_scripts' ) );
29
  add_action ( 'wp_head', array ( $this, 'add_css' ) );
30
  add_action ( 'wp_footer', array ( $this, 'add_js' ), 1000 );
31
  add_action ( 'wp_footer', array ( $this, 'add_notification_bar' ), 1000 );
32
  }
33
 
34
+ /*
35
+ * Initialize the class and start calling our hooks and filters
36
+ * @since 2.0.0
37
+ */
38
+ public function body_class( $classes ) {
39
+ $options = get_option( 'ctcc_options_settings' );
40
+ if( isset( $options['exclude_zones'] ) && is_array( $options['exclude_zones'] ) ) {
41
+ foreach( $options['exclude_zones'] as $zone ) {
42
+ $classes[] = 'ctcc-exclude-' . $zone;
43
+ }
44
+ }
45
+ return $classes;
46
+ }
47
+
48
  /*
49
  * Enqueue styles and scripts
50
  * @since 2.0.0
56
  $ctcc_options_settings = get_option ( 'ctcc_options_settings' );
57
  $options = get_option ( 'ctcc_styles_settings' );
58
  if ( isset ( $options['enqueue_styles'] ) ) {
59
+ wp_enqueue_style ( 'cookie-consent-style', CTCC_PLUGIN_URL . 'assets/css/style.css', '2.3.0' );
60
  }
61
+ wp_enqueue_script ( 'cookie-consent', CTCC_PLUGIN_URL . 'assets/js/uk-cookie-consent-js.js', array ( 'jquery' ), '2.3.0', true );
62
  wp_localize_script (
63
  'cookie-consent',
64
  'ctcc_vars',
public/customizer.php CHANGED
@@ -1,238 +1,238 @@
1
- <?php
2
- /*
3
- * Customizer
4
- */
5
-
6
- // Exit if accessed directly
7
- if ( ! defined( 'ABSPATH' ) ) {
8
- exit;
9
- }
10
-
11
- function ctcc_customize_register( $wp_customize ) {
12
- // Do stuff with $wp_customize, the WP_Customize_Manager object.
13
- //$options = get_option( 'ctcc_styles_settings' );
14
- //echo $options['text_color'];
15
-
16
- $wp_customize -> add_section ( 'cctc', array (
17
- 'title' => __( 'Cookie Consent', 'uk-cookie-consent' ),
18
- 'priority' => 999
19
- ) );
20
-
21
- $wp_customize -> add_setting( 'ctcc_styles_settings[position]', array(
22
- 'type' => 'option', // or 'option'
23
- 'capability' => 'edit_theme_options',
24
- 'theme_supports' => '', // Rarely needed.
25
- 'default' => '',
26
- 'transport' => 'refresh', // or postMessage
27
- 'sanitize_callback' => '',
28
- 'sanitize_js_callback' => '', // Basically to_json.
29
- ) );
30
- $wp_customize -> add_control( 'ctcc_styles_settings[position]', array(
31
- 'type' => 'select',
32
- 'priority' => 1, // Within the section.
33
- 'section' => 'cctc', // Required, core or custom.
34
- 'label' => __( 'Position', 'uk-cookie-consent' ),
35
- 'choices' => array (
36
- 'top-bar' => __( 'Top Bar', 'uk-cookie-consent' ),
37
- 'bottom-bar' => __( 'Bottom Bar', 'uk-cookie-consent' ),
38
- 'top-left-block' => __( 'Top Left Block', 'uk-cookie-consent' ),
39
- 'top-right-block' => __( 'Top Right Block', 'uk-cookie-consent' ),
40
- 'bottom-left-block' => __( 'Bottom Left Block', 'uk-cookie-consent' ),
41
- 'bottom-right-block' => __( 'Bottom Right Block', 'uk-cookie-consent' ),
42
- ),
43
- 'description' => __( 'Position and placement.', 'uk-cookie-consent' )
44
- ) );
45
- $wp_customize -> add_setting( 'ctcc_styles_settings[container_class]', array(
46
- 'type' => 'option', // or 'option'
47
- 'capability' => 'edit_theme_options',
48
- 'theme_supports' => '', // Rarely needed.
49
- 'default' => '',
50
- 'transport' => 'refresh', // or postMessage
51
- 'sanitize_callback' => '',
52
- 'sanitize_js_callback' => '', // Basically to_json.
53
- ) );
54
- $wp_customize -> add_control( 'ctcc_styles_settings[container_class]', array(
55
- 'type' => 'text',
56
- 'priority' => 2, // Within the section.
57
- 'section' => 'cctc', // Required, core or custom.
58
- 'label' => __( 'Container Class', 'uk-cookie-consent' ),
59
- 'description' => __( 'Optional wrapper class.', 'uk-cookie-consent' )
60
- ) );
61
- $wp_customize -> add_setting( 'ctcc_styles_settings[enqueue_styles]', array(
62
- 'type' => 'option', // or 'option'
63
- 'capability' => 'edit_theme_options',
64
- 'theme_supports' => '', // Rarely needed.
65
- 'default' => '',
66
- 'transport' => 'refresh', // or postMessage
67
- 'sanitize_callback' => '',
68
- 'sanitize_js_callback' => '', // Basically to_json.
69
- ) );
70
- $wp_customize -> add_control( 'ctcc_styles_settings[enqueue_styles]', array(
71
- 'type' => 'checkbox',
72
- 'priority' => 4, // Within the section.
73
- 'section' => 'cctc', // Required, core or custom.
74
- 'label' => __( 'Enqueue Styles', 'uk-cookie-consent' ),
75
- 'description' => __( 'Deselect this to dequeue the plugin stylesheet.', 'uk-cookie-consent' )
76
- ) );
77
- $wp_customize -> add_setting( 'ctcc_styles_settings[rounded_corners]', array(
78
- 'type' => 'option', // or 'option'
79
- 'capability' => 'edit_theme_options',
80
- 'theme_supports' => '', // Rarely needed.
81
- 'default' => '',
82
- 'transport' => 'refresh', // or postMessage
83
- 'sanitize_callback' => '',
84
- 'sanitize_js_callback' => '', // Basically to_json.
85
- ) );
86
- $wp_customize -> add_control( 'ctcc_styles_settings[rounded_corners]', array(
87
- 'type' => 'checkbox',
88
- 'priority' => 6, // Within the section.
89
- 'section' => 'cctc', // Required, core or custom.
90
- 'label' => __( 'Rounded Corners', 'uk-cookie-consent' ),
91
- 'description' => __( 'Round the corners on the block.', 'uk-cookie-consent' )
92
- ) );
93
- $wp_customize -> add_setting( 'ctcc_styles_settings[drop_shadow]', array(
94
- 'type' => 'option', // or 'option'
95
- 'capability' => 'edit_theme_options',
96
- 'theme_supports' => '', // Rarely needed.
97
- 'default' => '',
98
- 'transport' => 'refresh', // or postMessage
99
- 'sanitize_callback' => '',
100
- 'sanitize_js_callback' => '', // Basically to_json.
101
- ) );
102
- $wp_customize -> add_control( 'ctcc_styles_settings[drop_shadow]', array(
103
- 'type' => 'checkbox',
104
- 'priority' => 8, // Within the section.
105
- 'section' => 'cctc', // Required, core or custom.
106
- 'label' => __( 'Drop Shadow', 'uk-cookie-consent' ),
107
- 'description' => __( 'Add drop shadow to the block.', 'uk-cookie-consent' )
108
- ) );
109
- $wp_customize -> add_setting( 'ctcc_styles_settings[display_accept_with_text]', array(
110
- 'type' => 'option', // or 'option'
111
- 'capability' => 'edit_theme_options',
112
- 'theme_supports' => '', // Rarely needed.
113
- 'default' => '',
114
- 'transport' => 'refresh', // or postMessage
115
- 'sanitize_callback' => '',
116
- 'sanitize_js_callback' => '', // Basically to_json.
117
- ) );
118
- $wp_customize -> add_control( 'ctcc_styles_settings[display_accept_with_text]', array(
119
- 'type' => 'checkbox',
120
- 'priority' => 9, // Within the section.
121
- 'section' => 'cctc', // Required, core or custom.
122
- 'label' => __( 'Display Button With Text', 'uk-cookie-consent' ),
123
- 'description' => __( 'Deselect to float button to right.', 'uk-cookie-consent' )
124
- ) );
125
- $wp_customize -> add_setting( 'ctcc_styles_settings[x_close]', array(
126
- 'type' => 'option', // or 'option'
127
- 'capability' => 'edit_theme_options',
128
- 'theme_supports' => '', // Rarely needed.
129
- 'default' => '',
130
- 'transport' => 'refresh', // or postMessage
131
- 'sanitize_callback' => '',
132
- 'sanitize_js_callback' => '', // Basically to_json.
133
- ) );
134
- $wp_customize -> add_control( 'ctcc_styles_settings[x_close]', array(
135
- 'type' => 'checkbox',
136
- 'priority' => 10, // Within the section.
137
- 'section' => 'cctc', // Required, core or custom.
138
- 'label' => __( 'Use X Close', 'uk-cookie-consent' ),
139
- 'description' => __( 'Replace confirmation button with \'X\' icon.', 'uk-cookie-consent' )
140
- ) );
141
- $wp_customize -> add_setting( 'ctcc_styles_settings[text_color]', array(
142
- 'type' => 'option', // or 'option'
143
- 'capability' => 'edit_theme_options',
144
- 'theme_supports' => '', // Rarely needed.
145
- 'default' => '',
146
- 'transport' => 'refresh', // or postMessage
147
- 'sanitize_callback' => '',
148
- 'sanitize_js_callback' => '', // Basically to_json.
149
- ) );
150
- $wp_customize -> add_control( 'ctcc_styles_settings[text_color]', array(
151
- 'type' => 'color',
152
- 'priority' => 15, // Within the section.
153
- 'section' => 'cctc', // Required, core or custom.
154
- 'label' => __( 'Text Color', 'uk-cookie-consent' ),
155
- 'description' => __( 'Text color for your notification bar.', 'uk-cookie-consent' )
156
- ) );
157
- $wp_customize -> add_setting( 'ctcc_styles_settings[bg_color]', array(
158
- 'type' => 'option', // or 'option'
159
- 'capability' => 'edit_theme_options',
160
- 'theme_supports' => '', // Rarely needed.
161
- 'default' => '',
162
- 'transport' => 'refresh', // or postMessage
163
- 'sanitize_callback' => '',
164
- 'sanitize_js_callback' => '', // Basically to_json.
165
- ) );
166
- $wp_customize -> add_control( 'ctcc_styles_settings[bg_color]', array(
167
- 'type' => 'color',
168
- 'priority' => 20, // Within the section.
169
- 'section' => 'cctc', // Required, core or custom.
170
- 'label' => __( 'Background Color', 'uk-cookie-consent' ),
171
- 'description' => __( 'Background color for your notification bar.', 'uk-cookie-consent' )
172
- ) );
173
- $wp_customize -> add_setting( 'ctcc_styles_settings[link_color]', array(
174
- 'type' => 'option', // or 'option'
175
- 'capability' => 'edit_theme_options',
176
- 'theme_supports' => '', // Rarely needed.
177
- 'default' => '',
178
- 'transport' => 'refresh', // or postMessage
179
- 'sanitize_callback' => '',
180
- 'sanitize_js_callback' => '', // Basically to_json.
181
- ) );
182
- $wp_customize -> add_control( 'ctcc_styles_settings[link_color]', array(
183
- 'type' => 'color',
184
- 'priority' => 30, // Within the section.
185
- 'section' => 'cctc', // Required, core or custom.
186
- 'label' => __( 'Link Color', 'uk-cookie-consent' ),
187
- 'description' => __( 'Link color for your notification bar.', 'uk-cookie-consent' )
188
- ) );
189
- $wp_customize -> add_setting( 'ctcc_styles_settings[button_color]', array(
190
- 'type' => 'option', // or 'option'
191
- 'capability' => 'edit_theme_options',
192
- 'theme_supports' => '', // Rarely needed.
193
- 'default' => '',
194
- 'transport' => 'refresh', // or postMessage
195
- 'sanitize_callback' => '',
196
- 'sanitize_js_callback' => '', // Basically to_json.
197
- ) );
198
- $wp_customize -> add_control( 'ctcc_styles_settings[button_color]', array(
199
- 'type' => 'color',
200
- 'priority' => 40, // Within the section.
201
- 'section' => 'cctc', // Required, core or custom.
202
- 'label' => __( 'Button Color', 'uk-cookie-consent' ),
203
- 'description' => __( 'Text color for your notification bar button.', 'uk-cookie-consent' )
204
- ) );
205
- $wp_customize -> add_setting( 'ctcc_styles_settings[button_bg_color]', array(
206
- 'type' => 'option', // or 'option'
207
- 'capability' => 'edit_theme_options',
208
- 'theme_supports' => '', // Rarely needed.
209
- 'default' => '',
210
- 'transport' => 'refresh', // or postMessage
211
- 'sanitize_callback' => '',
212
- 'sanitize_js_callback' => '', // Basically to_json.
213
- ) );
214
- $wp_customize -> add_control( 'ctcc_styles_settings[button_bg_color]', array(
215
- 'type' => 'color',
216
- 'priority' => 50, // Within the section.
217
- 'section' => 'cctc', // Required, core or custom.
218
- 'label' => __( 'Button Background', 'uk-cookie-consent' ),
219
- 'description' => __( 'Background color for your notification bar button.', 'uk-cookie-consent' )
220
- ) );
221
- $wp_customize -> add_setting( 'ctcc_styles_settings[flat_button]', array(
222
- 'type' => 'option', // or 'option'
223
- 'capability' => 'edit_theme_options',
224
- 'theme_supports' => '', // Rarely needed.
225
- 'default' => '',
226
- 'transport' => 'refresh', // or postMessage
227
- 'sanitize_callback' => '',
228
- 'sanitize_js_callback' => '', // Basically to_json.
229
- ) );
230
- $wp_customize -> add_control( 'ctcc_styles_settings[flat_button]', array(
231
- 'type' => 'checkbox',
232
- 'priority' => 60, // Within the section.
233
- 'section' => 'cctc', // Required, core or custom.
234
- 'label' => __( 'Flat Button', 'uk-cookie-consent' ),
235
- 'description' => __( 'Deselect to inherit button styles from the theme.', 'uk-cookie-consent' )
236
- ) );
237
- }
238
  add_action( 'customize_register', 'ctcc_customize_register' );
1
+ <?php
2
+ /*
3
+ * Customizer
4
+ */
5
+
6
+ // Exit if accessed directly
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit;
9
+ }
10
+
11
+ function ctcc_customize_register( $wp_customize ) {
12
+ // Do stuff with $wp_customize, the WP_Customize_Manager object.
13
+ //$options = get_option( 'ctcc_styles_settings' );
14
+ //echo $options['text_color'];
15
+
16
+ $wp_customize -> add_section ( 'cctc', array (
17
+ 'title' => __( 'Cookie Consent', 'uk-cookie-consent' ),
18
+ 'priority' => 999
19
+ ) );
20
+
21
+ $wp_customize -> add_setting( 'ctcc_styles_settings[position]', array(
22
+ 'type' => 'option', // or 'option'
23
+ 'capability' => 'edit_theme_options',
24
+ 'theme_supports' => '', // Rarely needed.
25
+ 'default' => '',
26
+ 'transport' => 'refresh', // or postMessage
27
+ 'sanitize_callback' => '',
28
+ 'sanitize_js_callback' => '', // Basically to_json.
29
+ ) );
30
+ $wp_customize -> add_control( 'ctcc_styles_settings[position]', array(
31
+ 'type' => 'select',
32
+ 'priority' => 1, // Within the section.
33
+ 'section' => 'cctc', // Required, core or custom.
34
+ 'label' => __( 'Position', 'uk-cookie-consent' ),
35
+ 'choices' => array (
36
+ 'top-bar' => __( 'Top Bar', 'uk-cookie-consent' ),
37
+ 'bottom-bar' => __( 'Bottom Bar', 'uk-cookie-consent' ),
38
+ 'top-left-block' => __( 'Top Left Block', 'uk-cookie-consent' ),
39
+ 'top-right-block' => __( 'Top Right Block', 'uk-cookie-consent' ),
40
+ 'bottom-left-block' => __( 'Bottom Left Block', 'uk-cookie-consent' ),
41
+ 'bottom-right-block' => __( 'Bottom Right Block', 'uk-cookie-consent' ),
42
+ ),
43
+ 'description' => __( 'Position and placement.', 'uk-cookie-consent' )
44
+ ) );
45
+ $wp_customize -> add_setting( 'ctcc_styles_settings[container_class]', array(
46
+ 'type' => 'option', // or 'option'
47
+ 'capability' => 'edit_theme_options',
48
+ 'theme_supports' => '', // Rarely needed.
49
+ 'default' => '',
50
+ 'transport' => 'refresh', // or postMessage
51
+ 'sanitize_callback' => '',
52
+ 'sanitize_js_callback' => '', // Basically to_json.
53
+ ) );
54
+ $wp_customize -> add_control( 'ctcc_styles_settings[container_class]', array(
55
+ 'type' => 'text',
56
+ 'priority' => 2, // Within the section.
57
+ 'section' => 'cctc', // Required, core or custom.
58
+ 'label' => __( 'Container Class', 'uk-cookie-consent' ),
59
+ 'description' => __( 'Optional wrapper class.', 'uk-cookie-consent' )
60
+ ) );
61
+ $wp_customize -> add_setting( 'ctcc_styles_settings[enqueue_styles]', array(
62
+ 'type' => 'option', // or 'option'
63
+ 'capability' => 'edit_theme_options',
64
+ 'theme_supports' => '', // Rarely needed.
65
+ 'default' => '',
66
+ 'transport' => 'refresh', // or postMessage
67
+ 'sanitize_callback' => '',
68
+ 'sanitize_js_callback' => '', // Basically to_json.
69
+ ) );
70
+ $wp_customize -> add_control( 'ctcc_styles_settings[enqueue_styles]', array(
71
+ 'type' => 'checkbox',
72
+ 'priority' => 4, // Within the section.
73
+ 'section' => 'cctc', // Required, core or custom.
74
+ 'label' => __( 'Enqueue Styles', 'uk-cookie-consent' ),
75
+ 'description' => __( 'Deselect this to dequeue the plugin stylesheet.', 'uk-cookie-consent' )
76
+ ) );
77
+ $wp_customize -> add_setting( 'ctcc_styles_settings[rounded_corners]', array(
78
+ 'type' => 'option', // or 'option'
79
+ 'capability' => 'edit_theme_options',
80
+ 'theme_supports' => '', // Rarely needed.
81
+ 'default' => '',
82
+ 'transport' => 'refresh', // or postMessage
83
+ 'sanitize_callback' => '',
84
+ 'sanitize_js_callback' => '', // Basically to_json.
85
+ ) );
86
+ $wp_customize -> add_control( 'ctcc_styles_settings[rounded_corners]', array(
87
+ 'type' => 'checkbox',
88
+ 'priority' => 6, // Within the section.
89
+ 'section' => 'cctc', // Required, core or custom.
90
+ 'label' => __( 'Rounded Corners', 'uk-cookie-consent' ),
91
+ 'description' => __( 'Round the corners on the block.', 'uk-cookie-consent' )
92
+ ) );
93
+ $wp_customize -> add_setting( 'ctcc_styles_settings[drop_shadow]', array(
94
+ 'type' => 'option', // or 'option'
95
+ 'capability' => 'edit_theme_options',
96
+ 'theme_supports' => '', // Rarely needed.
97
+ 'default' => '',
98
+ 'transport' => 'refresh', // or postMessage
99
+ 'sanitize_callback' => '',
100
+ 'sanitize_js_callback' => '', // Basically to_json.
101
+ ) );
102
+ $wp_customize -> add_control( 'ctcc_styles_settings[drop_shadow]', array(
103
+ 'type' => 'checkbox',
104
+ 'priority' => 8, // Within the section.
105
+ 'section' => 'cctc', // Required, core or custom.
106
+ 'label' => __( 'Drop Shadow', 'uk-cookie-consent' ),
107
+ 'description' => __( 'Add drop shadow to the block.', 'uk-cookie-consent' )
108
+ ) );
109
+ $wp_customize -> add_setting( 'ctcc_styles_settings[display_accept_with_text]', array(
110
+ 'type' => 'option', // or 'option'
111
+ 'capability' => 'edit_theme_options',
112
+ 'theme_supports' => '', // Rarely needed.
113
+ 'default' => '',
114
+ 'transport' => 'refresh', // or postMessage
115
+ 'sanitize_callback' => '',
116
+ 'sanitize_js_callback' => '', // Basically to_json.
117
+ ) );
118
+ $wp_customize -> add_control( 'ctcc_styles_settings[display_accept_with_text]', array(
119
+ 'type' => 'checkbox',
120
+ 'priority' => 9, // Within the section.
121
+ 'section' => 'cctc', // Required, core or custom.
122
+ 'label' => __( 'Display Button With Text', 'uk-cookie-consent' ),
123
+ 'description' => __( 'Deselect to float button to right.', 'uk-cookie-consent' )
124
+ ) );
125
+ $wp_customize -> add_setting( 'ctcc_styles_settings[x_close]', array(
126
+ 'type' => 'option', // or 'option'
127
+ 'capability' => 'edit_theme_options',
128
+ 'theme_supports' => '', // Rarely needed.
129
+ 'default' => '',
130
+ 'transport' => 'refresh', // or postMessage
131
+ 'sanitize_callback' => '',
132
+ 'sanitize_js_callback' => '', // Basically to_json.
133
+ ) );
134
+ $wp_customize -> add_control( 'ctcc_styles_settings[x_close]', array(
135
+ 'type' => 'checkbox',
136
+ 'priority' => 10, // Within the section.
137
+ 'section' => 'cctc', // Required, core or custom.
138
+ 'label' => __( 'Use X Close', 'uk-cookie-consent' ),
139
+ 'description' => __( 'Replace confirmation button with \'X\' icon.', 'uk-cookie-consent' )
140
+ ) );
141
+ $wp_customize -> add_setting( 'ctcc_styles_settings[text_color]', array(
142
+ 'type' => 'option', // or 'option'
143
+ 'capability' => 'edit_theme_options',
144
+ 'theme_supports' => '', // Rarely needed.
145
+ 'default' => '',
146
+ 'transport' => 'refresh', // or postMessage
147
+ 'sanitize_callback' => '',
148
+ 'sanitize_js_callback' => '', // Basically to_json.
149
+ ) );
150
+ $wp_customize -> add_control( 'ctcc_styles_settings[text_color]', array(
151
+ 'type' => 'color',
152
+ 'priority' => 15, // Within the section.
153
+ 'section' => 'cctc', // Required, core or custom.
154
+ 'label' => __( 'Text Color', 'uk-cookie-consent' ),
155
+ 'description' => __( 'Text color for your notification bar.', 'uk-cookie-consent' )
156
+ ) );
157
+ $wp_customize -> add_setting( 'ctcc_styles_settings[bg_color]', array(
158
+ 'type' => 'option', // or 'option'
159
+ 'capability' => 'edit_theme_options',
160
+ 'theme_supports' => '', // Rarely needed.
161
+ 'default' => '',
162
+ 'transport' => 'refresh', // or postMessage
163
+ 'sanitize_callback' => '',
164
+ 'sanitize_js_callback' => '', // Basically to_json.
165
+ ) );
166
+ $wp_customize -> add_control( 'ctcc_styles_settings[bg_color]', array(
167
+ 'type' => 'color',
168
+ 'priority' => 20, // Within the section.
169
+ 'section' => 'cctc', // Required, core or custom.
170
+ 'label' => __( 'Background Color', 'uk-cookie-consent' ),
171
+ 'description' => __( 'Background color for your notification bar.', 'uk-cookie-consent' )
172
+ ) );
173
+ $wp_customize -> add_setting( 'ctcc_styles_settings[link_color]', array(
174
+ 'type' => 'option', // or 'option'
175
+ 'capability' => 'edit_theme_options',
176
+ 'theme_supports' => '', // Rarely needed.
177
+ 'default' => '',
178
+ 'transport' => 'refresh', // or postMessage
179
+ 'sanitize_callback' => '',
180
+ 'sanitize_js_callback' => '', // Basically to_json.
181
+ ) );
182
+ $wp_customize -> add_control( 'ctcc_styles_settings[link_color]', array(
183
+ 'type' => 'color',
184
+ 'priority' => 30, // Within the section.
185
+ 'section' => 'cctc', // Required, core or custom.
186
+ 'label' => __( 'Link Color', 'uk-cookie-consent' ),
187
+ 'description' => __( 'Link color for your notification bar.', 'uk-cookie-consent' )
188
+ ) );
189
+ $wp_customize -> add_setting( 'ctcc_styles_settings[button_color]', array(
190
+ 'type' => 'option', // or 'option'
191
+ 'capability' => 'edit_theme_options',
192
+ 'theme_supports' => '', // Rarely needed.
193
+ 'default' => '',
194
+ 'transport' => 'refresh', // or postMessage
195
+ 'sanitize_callback' => '',
196
+ 'sanitize_js_callback' => '', // Basically to_json.
197
+ ) );
198
+ $wp_customize -> add_control( 'ctcc_styles_settings[button_color]', array(
199
+ 'type' => 'color',
200
+ 'priority' => 40, // Within the section.
201
+ 'section' => 'cctc', // Required, core or custom.
202
+ 'label' => __( 'Button Color', 'uk-cookie-consent' ),
203
+ 'description' => __( 'Text color for your notification bar button.', 'uk-cookie-consent' )
204
+ ) );
205
+ $wp_customize -> add_setting( 'ctcc_styles_settings[button_bg_color]', array(
206
+ 'type' => 'option', // or 'option'
207
+ 'capability' => 'edit_theme_options',
208
+ 'theme_supports' => '', // Rarely needed.
209
+ 'default' => '',
210
+ 'transport' => 'refresh', // or postMessage
211
+ 'sanitize_callback' => '',
212
+ 'sanitize_js_callback' => '', // Basically to_json.
213
+ ) );
214
+ $wp_customize -> add_control( 'ctcc_styles_settings[button_bg_color]', array(
215
+ 'type' => 'color',
216
+ 'priority' => 50, // Within the section.
217
+ 'section' => 'cctc', // Required, core or custom.
218
+ 'label' => __( 'Button Background', 'uk-cookie-consent' ),
219
+ 'description' => __( 'Background color for your notification bar button.', 'uk-cookie-consent' )
220
+ ) );
221
+ $wp_customize -> add_setting( 'ctcc_styles_settings[flat_button]', array(
222
+ 'type' => 'option', // or 'option'
223
+ 'capability' => 'edit_theme_options',
224
+ 'theme_supports' => '', // Rarely needed.
225
+ 'default' => '',
226
+ 'transport' => 'refresh', // or postMessage
227
+ 'sanitize_callback' => '',
228
+ 'sanitize_js_callback' => '', // Basically to_json.
229
+ ) );
230
+ $wp_customize -> add_control( 'ctcc_styles_settings[flat_button]', array(
231
+ 'type' => 'checkbox',
232
+ 'priority' => 60, // Within the section.
233
+ 'section' => 'cctc', // Required, core or custom.
234
+ 'label' => __( 'Flat Button', 'uk-cookie-consent' ),
235
+ 'description' => __( 'Deselect to inherit button styles from the theme.', 'uk-cookie-consent' )
236
+ ) );
237
+ }
238
  add_action( 'customize_register', 'ctcc_customize_register' );
readme.txt CHANGED
@@ -1,10 +1,10 @@
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, cookie bar, cookie notification bar
5
  Requires at least: 4.3
6
- Tested up to: 4.7
7
- Stable tag: 2.2.5
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.
@@ -12,6 +12,7 @@ The only cookie consent plugin you'll ever need.
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.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.
16
 
17
  = Simple set up =
@@ -70,6 +71,9 @@ You will find more details of the regulations on the [Information Commissioner's
70
 
71
  == Changelog ==
72
 
 
 
 
73
  = 2.2.5 =
74
  * Fixed: dismissed notification bar obscuring content
75
 
@@ -83,7 +87,7 @@ You will find more details of the regulations on the [Information Commissioner's
83
  * Fixed: text domain in class-ctcc-metafield (spotted by mmmisiek)
84
 
85
  = 2.2.1 =
86
- * Updated: better escapingn (suggested by djpaul)
87
 
88
  = 2.2.0 =
89
  * Added: optionally exclude pages and posts from displaying the cookie notification (suggested by jeffrobbins)
1
  === Cookie Consent ===
2
  Contributors: Catapult_Themes, husobj, jraczynski
3
  Donate Link: https://paypal.com
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.7.1
7
+ Stable tag: 2.3.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.
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)
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 =
71
 
72
  == Changelog ==
73
 
74
+ = 2.3.0 =
75
+ * Added: GeoIP support (suggested by jeffrobbins)
76
+
77
  = 2.2.5 =
78
  * Fixed: dismissed notification bar obscuring content
79
 
87
  * Fixed: text domain in class-ctcc-metafield (spotted by mmmisiek)
88
 
89
  = 2.2.1 =
90
+ * Updated: better escaping (suggested by djpaul)
91
 
92
  = 2.2.0 =
93
  * Added: optionally exclude pages and posts from displaying the cookie notification (suggested by jeffrobbins)
uk-cookie-consent.php CHANGED
@@ -3,7 +3,7 @@
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.2.5
7
  Author: Catapult_Themes
8
  Author URI: http://catapultthemes.com/
9
  Text Domain: uk-cookie-consent
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.3.0
7
  Author: Catapult_Themes
8
  Author URI: http://catapultthemes.com/
9
  Text Domain: uk-cookie-consent