Cookie Consent - Version 2.2.0

Version Description

  • Added: optionally exclude pages and posts from displaying the cookie notification
  • Added: close notification on scroll option
  • Added: class name for more info link
  • Fixed: x-close responsive margin
  • Updated: allow shortcodes in notification text
  • Updated: better settings sanitization
Download this release

Release Info

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

Code changes from version 2.1.7 to 2.2.0

admin/class-ctcc-admin.php CHANGED
@@ -84,6 +84,14 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
84
  'ctcc_options_section'
85
  );
86
 
 
 
 
 
 
 
 
 
87
  add_settings_field (
88
  'duration',
89
  __( 'Notification Duration', 'uk-cookie-consent' ),
@@ -92,6 +100,14 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
92
  'ctcc_options_section'
93
  );
94
 
 
 
 
 
 
 
 
 
95
  add_settings_field (
96
  'cookie_expiry',
97
  __( 'Cookie Expiry', 'uk-cookie-consent' ),
@@ -118,9 +134,25 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
118
 
119
  }
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  public function register_content_init() {
122
 
123
- register_setting ( 'ctcc_content', 'ctcc_content_settings' );
124
 
125
  add_settings_section (
126
  'ctcc_content_section',
@@ -331,7 +363,9 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
331
  public function get_default_options_settings() {
332
  $defaults = array (
333
  'closure' => 'click',
 
334
  'first_page' => 0,
 
335
  'duration' => 60,
336
  'cookie_expiry' => 30,
337
  'cookie_version' => 1
@@ -419,7 +453,9 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
419
  $options = get_option( 'ctcc_options_settings' ); ?>
420
  <select name='ctcc_options_settings[closure]'>
421
  <option value='click' <?php selected( $options['closure'], 'click' ); ?>><?php _e ( 'On Click', 'uk-cookie-consent' ); ?></option>
 
422
  <option value='timed' <?php selected( $options['closure'], 'timed' ); ?>><?php _e ( 'Timed', 'uk-cookie-consent' ); ?></option>
 
423
  </select>
424
  <p class="description"><?php _e ( 'How you want the user to close the notification', 'uk-cookie-consent' ); ?></p>
425
  <?php
@@ -431,6 +467,13 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
431
  <p class="description"><?php _e ( 'Select this to show the notification only on the first page the user visits', 'uk-cookie-consent' ); ?></p>
432
  <?php
433
  }
 
 
 
 
 
 
 
434
 
435
  public function duration_render() {
436
  $options = get_option( 'ctcc_options_settings' ); ?>
@@ -466,7 +509,7 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
466
 
467
  public function notification_text_render() {
468
  $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
469
- <input type="text" name="ctcc_content_settings[notification_text]" value="<?php echo $ctcc_content_settings['notification_text']; ?>">
470
  <p class="description"><?php _e ( 'The default text to indicate that your site uses cookies', 'uk-cookie-consent' ); ?></p>
471
  <?php
472
  }
@@ -620,16 +663,27 @@ if ( ! class_exists ( 'CTCC_Admin' ) ) {
620
  <?php
621
  }
622
 
 
 
 
 
 
 
 
623
  public function settings_section_callback() {
624
- echo __( '<p>Basic settings</p>', 'uk-cookie-consent' );
625
  }
626
 
627
  public function content_settings_section_callback() {
628
- echo __( '<p>Update the content displayed to the user</p>', 'uk-cookie-consent' );
629
  }
630
 
631
  public function styles_settings_section_callback() {
632
- echo __( '<p>Change the styles here if you like - but it\'s better in the Customizer</p>', 'uk-cookie-consent' );
 
 
 
 
633
  }
634
 
635
  public function options_page() {
84
  'ctcc_options_section'
85
  );
86
 
87
+ add_settings_field (
88
+ 'enable_metafield',
89
+ __( 'Selectively Exclude Pages', 'uk-cookie-consent' ),
90
+ array ( $this, 'enable_metafield_render' ),
91
+ 'ctcc_options',
92
+ 'ctcc_options_section'
93
+ );
94
+
95
  add_settings_field (
96
  'duration',
97
  __( 'Notification Duration', 'uk-cookie-consent' ),
100
  'ctcc_options_section'
101
  );
102
 
103
+ add_settings_field (
104
+ 'scroll_height',
105
+ __( 'Scroll Height', 'uk-cookie-consent' ),
106
+ array ( $this, 'scroll_height_render' ),
107
+ 'ctcc_options',
108
+ 'ctcc_options_section'
109
+ );
110
+
111
  add_settings_field (
112
  'cookie_expiry',
113
  __( 'Cookie Expiry', 'uk-cookie-consent' ),
134
 
135
  }
136
 
137
+ public function sanitize_content( $input ){
138
+ $output = array();
139
+ foreach( $input as $key=>$value ) {
140
+ if( isset($input[$key] ) ) {
141
+ if( $key == 'notification_text' ) {
142
+ $output[$key] = esc_attr( $input[$key] );
143
+ } else if( $key == 'more_info_url' ) {
144
+ $output[$key] = esc_url( $input[$key] );
145
+ } else {
146
+ $output[$key] = sanitize_text_field( $input[$key] );
147
+ }
148
+ }
149
+ }
150
+ return $output;
151
+ }
152
+
153
  public function register_content_init() {
154
 
155
+ register_setting ( 'ctcc_content', 'ctcc_content_settings', array( $this, 'sanitize_content') );
156
 
157
  add_settings_section (
158
  'ctcc_content_section',
363
  public function get_default_options_settings() {
364
  $defaults = array (
365
  'closure' => 'click',
366
+ 'scroll_height' => 200,
367
  'first_page' => 0,
368
+ 'enable_metafield' => 0,
369
  'duration' => 60,
370
  'cookie_expiry' => 30,
371
  'cookie_version' => 1
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
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 $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' ); ?>
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 $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
  }
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
+
673
  public function settings_section_callback() {
674
+ echo '<p>' .__( 'Basic settings', 'uk-cookie-consent' ) . '</p>';
675
  }
676
 
677
  public function content_settings_section_callback() {
678
+ echo '<p>' .__( 'Update the content displayed to the user', 'uk-cookie-consent' ) . '</p>';
679
  }
680
 
681
  public function styles_settings_section_callback() {
682
+ echo '<p>' .__( 'Change the styles here if you like - but it\'s better in the Customizer', 'uk-cookie-consent' ) . '</p>';
683
+ }
684
+
685
+ public function pages_settings_section_callback() {
686
+ echo '<p>' . __( 'Use this section to set exclusion rules for pages and posts.', 'uk-cookie-consent' ) . '</p>';
687
  }
688
 
689
  public function options_page() {
admin/class-ctcc-metafield.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Cookie Consent metafield class
4
+ */
5
+
6
+ // Exit if accessed directly
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit;
9
+ }
10
+
11
+ if ( ! class_exists ( 'CTCC_Metafield' ) ) {
12
+
13
+ class CTCC_Metafield {
14
+
15
+ public function __construct() {
16
+ //
17
+ }
18
+
19
+ /*
20
+ * Initialize the class and start calling our hooks and filters
21
+ * @since 2.0.0
22
+ */
23
+ public function init() {
24
+
25
+ add_action( 'add_meta_boxes', array ( $this, 'add_meta_box' ) );
26
+ add_action( 'save_post', array ( $this, 'save_metabox_data' ) );
27
+
28
+ }
29
+
30
+ public function metaboxes() {
31
+
32
+ $metaboxes = array (
33
+ array (
34
+ 'ID' => 'ctcc_gallery_metabox',
35
+ 'title' => __( 'Cookie Consent', 'dm_work' ),
36
+ 'callback' => 'meta_box_callback',
37
+ 'screens' => array( 'page', 'post' ),
38
+ 'context' => 'side',
39
+ 'priority' => 'default',
40
+ 'fields' => array (
41
+ array (
42
+ 'ID' => 'ctcc_exclude',
43
+ 'name' => 'ctcc_exclude',
44
+ 'title' => __( 'Exclude from cookie notice', 'uk-cookie-consent' ),
45
+ 'type' => 'checkbox',
46
+ 'class' => ''
47
+ ),
48
+ ),
49
+ ),
50
+ );
51
+
52
+ return $metaboxes;
53
+
54
+ }
55
+
56
+ /*
57
+ * Register the metabox
58
+ * @since 1.0.0
59
+ */
60
+ public function add_meta_box() {
61
+
62
+ $metaboxes = $this->metaboxes();
63
+
64
+ foreach ( $metaboxes as $metabox ) {
65
+ add_meta_box (
66
+ $metabox['ID'],
67
+ $metabox['title'],
68
+ array ( $this, 'meta_box_callback' ),
69
+ $metabox['screens'],
70
+ $metabox['context'],
71
+ $metabox['priority'],
72
+ $metabox['fields']
73
+ );
74
+
75
+ }
76
+
77
+ }
78
+
79
+ /*
80
+ * Metabox callbacks
81
+ * @since 1.0.0
82
+ */
83
+ public function meta_box_callback ( $post, $fields ) {
84
+
85
+ wp_nonce_field ( 'save_metabox_data', 'ctcc_metabox_nonce' );
86
+
87
+ if ( $fields['args'] ) {
88
+
89
+ foreach ( $fields['args'] as $field ) {
90
+
91
+ switch ( $field['type'] ) {
92
+
93
+ case 'checkbox':
94
+ $this -> metabox_checkbox_output ( $post, $field );
95
+ break;
96
+
97
+ }
98
+
99
+ }
100
+
101
+ }
102
+
103
+ }
104
+
105
+ /*
106
+ * Metabox callback for checkbox
107
+ * @since 1.0.0
108
+ */
109
+ public function metabox_checkbox_output( $post, $field ) {
110
+
111
+ $field_value = 0;
112
+
113
+ // First check if we're on the post-new screen
114
+ global $pagenow;
115
+ if ( in_array ( $pagenow, array( 'post-new.php' ) ) ) {
116
+ // This is a new post screen so we can apply the default value
117
+ $field_value = $field['default'];
118
+ } else {
119
+ $custom = get_post_custom ( $post->ID );
120
+ if ( isset ( $custom[$field['ID']][0] ) ) {
121
+ $field_value = $custom[$field['ID']][0];
122
+ }
123
+ }
124
+ ?>
125
+ <div class="dm-work-metafield <?php echo $field['class']; ?>">
126
+
127
+ <input type="checkbox" id="<?php echo $field['name']; ?>" name="<?php echo $field['name']; ?>" value="1" <?php checked ( 1, $field_value ); ?>>
128
+ <label for="<?php echo $field['name']; ?>"><?php echo $field['title']; ?></label>
129
+ <?php if ( ! empty ( $field['label'] ) ) { ?>
130
+ <?php echo $field['label']; ?>
131
+ <?php } ?>
132
+ </div>
133
+ <?php
134
+ }
135
+
136
+ /*
137
+ * Save
138
+ * @since 1.0.0
139
+ */
140
+ public function save_metabox_data( $post_id ) {
141
+
142
+ // Check the nonce is set
143
+ if ( ! isset ( $_POST['ctcc_metabox_nonce'] ) ) {
144
+ return;
145
+ }
146
+
147
+ // Verify the nonce
148
+ if ( ! wp_verify_nonce ( $_POST['ctcc_metabox_nonce'], 'save_metabox_data' ) ) {
149
+ return;
150
+ }
151
+
152
+ // If this is an autosave, our form has not been submitted, so we don't want to do anything.
153
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
154
+ return;
155
+ }
156
+
157
+ // Check the user's permissions.
158
+ if ( ! current_user_can( 'edit_post', $post_id ) ) {
159
+ return;
160
+ }
161
+
162
+ // Save all our metaboxes
163
+ $metaboxes = $this -> metaboxes();
164
+ foreach ( $metaboxes as $metabox ) {
165
+ if ( $metabox['fields'] ) {
166
+ foreach ( $metabox['fields'] as $field ) {
167
+
168
+ if ( $field['type'] != 'divider' ) {
169
+
170
+ if ( isset ( $_POST[$field['name']] ) ) {
171
+ if ( $field['type'] == 'wysiwyg' ) {
172
+ $data = $_POST[$field['name']];
173
+ } else {
174
+ $data = sanitize_text_field ( $_POST[$field['name']] );
175
+ }
176
+ update_post_meta ( $post_id, $field['ID'], $data );
177
+ } else {
178
+ delete_post_meta ( $post_id, $field['ID'] );
179
+ }
180
+ }
181
+ }
182
+ }
183
+ }
184
+
185
+ }
186
+
187
+ }
188
+
189
+ }
assets/css/style.css CHANGED
@@ -64,6 +64,11 @@ button#catapultCookie {
64
  -webkit-justify-content: space-between;
65
  justify-content: space-between;
66
  }
 
 
 
 
 
67
  .ctcc-right-side {
68
  -webkit-flex-shrink: 0;
69
  flex-shrink: 0;
@@ -86,8 +91,6 @@ button#catapultCookie {
86
  -webkit-transform: translateY(-50%);
87
  transform: translateY(-50%);
88
  }
89
-
90
-
91
  .x_close {
92
  -webkit-backface-visibility: hidden;
93
  backface-visibility: hidden;
64
  -webkit-justify-content: space-between;
65
  justify-content: space-between;
66
  }
67
+ @media screen and (max-width: 991px) {
68
+ .ctcc-left-side {
69
+ margin-right: 1em;
70
+ }
71
+ }
72
  .ctcc-right-side {
73
  -webkit-flex-shrink: 0;
74
  flex-shrink: 0;
91
  -webkit-transform: translateY(-50%);
92
  transform: translateY(-50%);
93
  }
 
 
94
  .x_close {
95
  -webkit-backface-visibility: hidden;
96
  backface-visibility: hidden;
assets/images/dbpro-ad-view.png ADDED
Binary file
assets/images/themes-ad1.jpg ADDED
Binary file
public/class-ctcc-public.php CHANGED
@@ -12,10 +12,13 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  * Plugin public class
13
  **/
14
  if ( ! class_exists( 'CTCC_Public' ) ) { // Don't initialise if there's already a class activated
 
15
  class CTCC_Public {
 
16
  public function __construct() {
17
  //
18
  }
 
19
  /*
20
  * Initialize the class and start calling our hooks and filters
21
  * @since 2.0.0
@@ -32,21 +35,42 @@ if ( ! class_exists( 'CTCC_Public' ) ) { // Don't initialise if there's already
32
  * @since 2.0.0
33
  */
34
  public function enqueue_scripts() {
35
- $ctcc_options_settings = get_option ( 'ctcc_options_settings' );
36
- $options = get_option ( 'ctcc_styles_settings' );
37
- if ( isset ( $options['enqueue_styles'] ) ) {
38
- wp_enqueue_style ( 'cookie-consent-style', CTCC_PLUGIN_URL . 'assets/css/style.css', '2.0.0' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
40
- wp_enqueue_script ( 'cookie-consent', CTCC_PLUGIN_URL . 'assets/js/uk-cookie-consent-js.js', array ( 'jquery' ), '2.0.0', true );
41
- wp_localize_script (
42
- 'cookie-consent',
43
- 'ctcc_vars',
44
- array (
45
- 'expiry' => $ctcc_options_settings['cookie_expiry'],
46
- 'method' => isset ( $ctcc_options_settings['first_page'] ),
47
- 'version' => $ctcc_options_settings['cookie_version'],
48
- )
49
- );
50
  }
51
 
52
  /*
@@ -54,91 +78,95 @@ if ( ! class_exists( 'CTCC_Public' ) ) { // Don't initialise if there's already
54
  * @since 2.0.0
55
  */
56
  public function add_css() {
57
- $options = get_option ( 'ctcc_options_settings' );
58
- $ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
59
- $position_css = 'position: fixed;
60
- left: 0;
61
- top: 0;
62
- width: 100%;';
63
- // Figure out the bar position
64
- if ( $ctcc_styles_settings['position'] == 'top-bar' ) {
65
- $position_css = 'position: fixed;
66
- left: 0;
67
- top: 0;
68
- width: 100%;';
69
- } else if ( $ctcc_styles_settings['position'] == 'bottom-bar' ) {
70
- $position_css = 'position: fixed;
71
- left: 0;
72
- bottom: 0;
73
- width: 100%;';
74
- } else if ( $ctcc_styles_settings['position'] == 'top-right-block' ) {
75
- $position_css = 'position: fixed;
76
- right: 20px;
77
- top: 6%;
78
- width: 300px;';
79
- } else if ( $ctcc_styles_settings['position'] == 'top-left-block' ) {
80
- $position_css = 'position: fixed;
81
- left: 20px;
82
- top: 6%;
83
- width: 300px;';
84
- } else if ( $ctcc_styles_settings['position'] == 'bottom-left-block' ) {
85
  $position_css = 'position: fixed;
86
- left: 20px;
87
- bottom: 6%;
88
- width: 300px;';
89
- } else if ( $ctcc_styles_settings['position'] == 'bottom-right-block' ) {
90
- $position_css = 'position: fixed;
91
- right: 20px;
92
- bottom: 6%;
93
- width: 300px;';
94
- }
95
- // Get our styles
96
- $text_color = $ctcc_styles_settings['text_color'];
97
- $position = 'top';
98
- $bg_color = $ctcc_styles_settings['bg_color'];
99
- $link_color = $ctcc_styles_settings['link_color'];
100
- $button_bg = $ctcc_styles_settings['button_bg_color'];
101
- $button_color = $ctcc_styles_settings['button_color'];
102
- if ( ! empty ( $ctcc_styles_settings['flat_button'] ) ){
103
- $button_style = 'border: 0; padding: 6px 9px; border-radius: 3px;';
104
- } else {
105
- $button_style = '';
106
- }
107
- // Build our CSS
108
- $css = '<style id="ctcc-css" type="text/css" media="screen">';
109
- $css .= '
110
- #catapult-cookie-bar {
111
- box-sizing: border-box;
112
- max-height: 0;
113
- opacity: 0;
114
- z-index: 99999;
115
- overflow: hidden;
116
- color: ' . $text_color . ';
117
- ' . $position_css . '
118
- background-color: ' . $bg_color . ';
119
- }
120
- #catapult-cookie-bar a {
121
- color: ' . $link_color . ';
122
- }
123
- #catapult-cookie-bar .x_close span {
124
- background-color: ' . $button_color . ';
125
- }
126
- button#catapultCookie {
127
- background:' . $button_bg . ';
128
- color: ' . $button_color . ';
129
- ' . $button_style . '
130
- }
131
- #catapult-cookie-bar h3 {
132
- color: ' . $text_color . ';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  }
134
- .has-cookie-bar #catapult-cookie-bar {
135
- opacity: 1;
136
- max-height: 999px;
137
- min-height: 30px;
138
- }';
139
- $css .= '</style>';
140
- echo $css;
141
- // Add it to the header
142
  }
143
 
144
  /*
@@ -147,49 +175,67 @@ if ( ! class_exists( 'CTCC_Public' ) ) { // Don't initialise if there's already
147
  */
148
  public function add_js() {
149
 
150
- $options = get_option( 'ctcc_options_settings' );
151
- $ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
 
 
 
152
 
153
- if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
154
- $type = 'bar';
155
- } else {
156
- $type = 'block';
157
- } ?>
158
 
159
- <script type="text/javascript">
160
- jQuery(document).ready(function($){
161
- <?php if ( isset ( $_GET['cookie'] ) ) { ?>
162
- catapultDeleteCookie('catAccCookies');
163
- <?php } ?>
164
- if(!catapultReadCookie("catAccCookies")){ // If the cookie has not been set then show the bar
165
- $("html").addClass("has-cookie-bar");
166
- $("html").addClass("cookie-bar-<?php echo $ctcc_styles_settings['position']; ?>");
167
- $("html").addClass("cookie-bar-<?php echo $type; ?>");
168
- <?php // Move the HTML down if the bar is at the top
169
- if ( $ctcc_styles_settings['position'] == 'top-bar' ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  ?>
171
- // Wait for the animation on the html to end before recalculating the required top margin
172
- $("html").on('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) {
173
- // code to execute after transition ends
174
- var barHeight = $('#catapult-cookie-bar').outerHeight();
175
- $("html").css("margin-top",barHeight);
176
- $("body.admin-bar").css("margin-top",barHeight-32); // Push the body down if the admin bar is active
177
- });
178
  <?php } ?>
179
- }
180
- <?php if ( $options['closure'] == 'timed' ) {
181
- // Add some script if it's on a timer
182
- $duration = absint($options['duration']) * 1000; ?>
183
- setTimeout(ctccCloseNotification, <?php echo $duration; ?>);
184
- <?php } ?>
185
- <?php if ( ! empty ( $options['first_page'] ) ) {
186
- // Add some script if the notification only displays on the first page ?>
187
- ctccFirstPage();
188
- <?php } ?>
189
- });
190
- </script>
191
 
192
- <?php }
 
 
193
 
194
  /*
195
  * Add the notification bar itself
@@ -197,118 +243,124 @@ if ( ! class_exists( 'CTCC_Public' ) ) { // Don't initialise if there's already
197
  */
198
  public function add_notification_bar() {
199
 
200
- $ctcc_options_settings = get_option ( 'ctcc_options_settings' );
201
- $ctcc_content_settings = get_option ( 'ctcc_content_settings' );
202
- $ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
 
 
 
 
203
 
204
- // Check if it's a block or a bar
205
- $is_block = true;
206
- if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
207
- $is_block = false; // It's a bar
208
- }
209
 
210
- // Add some classes to the block
211
- $classes = '';
212
- if ( $is_block ) {
213
- if ( ! empty ( $ctcc_styles_settings['rounded_corners'] ) ) {
214
- $classes .= ' rounded-corners';
 
 
 
 
215
  }
216
- if ( ! empty ( $ctcc_styles_settings['drop_shadow'] ) ) {
217
- $classes .= ' drop-shadow';
 
 
 
218
  }
219
- }
220
- if ( ! empty ( $ctcc_styles_settings['x_close'] ) ) {
221
- $classes .= ' use_x_close';
222
- }
223
- if ( empty ( $ctcc_styles_settings['display_accept_with_text'] ) ) {
224
- $classes .= ' float-accept';
225
- }
226
 
227
- // Allowed tags
228
- $allowed = array (
229
- 'a' => array (
230
- 'href' => array(),
231
- 'title' => array()
232
- ),
233
- 'br' => array(),
234
- 'em' => array(),
235
- 'strong' => array(),
236
- 'p' => array()
237
- );
238
 
239
- $content = '';
240
- $close_content = '';
241
 
242
- // Print the notification bar
243
- $content = '<div id="catapult-cookie-bar" class="' . $classes . '">';
244
 
245
- // Add a custom wrapper class if specified
246
- if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
247
- $content .= '<div class="ctcc-inner ' . esc_attr ( str_replace ( '.', '', $ctcc_styles_settings['container_class'] ) ) . '">';
248
- $close_content = '</div><!-- custom wrapper class -->';
249
- }
250
 
251
- // Add a title if it's a block
252
- if ( $ctcc_styles_settings['position'] != 'top-bar' && $ctcc_styles_settings['position'] != 'bottom-bar' ) {
253
- $heading_text = wp_kses ( $ctcc_content_settings['heading_text'], $allowed );
254
- $heading_text = apply_filters( 'ctcc_heading_text', $heading_text );
255
- $content .= sprintf ( '<h3>%s</h3>',
256
- $heading_text
257
- );
258
- }
259
 
260
- // Make the Read More link
261
- $more_text = '';
262
- if ( $ctcc_content_settings['more_info_text'] ) {
263
- // Find what page we're linking to
264
- if ( ! empty ( $ctcc_content_settings['more_info_url'] ) ) {
265
- // Check the absolute URL first
266
- $link = $ctcc_content_settings['more_info_url'];
267
- } else {
268
- // Use the internal page
269
- $link = get_permalink ( $ctcc_content_settings['more_info_page'] );
 
 
 
 
 
 
 
 
 
270
  }
271
- $more_info_text = wp_kses ( $ctcc_content_settings['more_info_text'], $allowed );
272
- $more_info_text = apply_filters( 'ctcc_more_info_text', $more_info_text );
273
- $more_text = sprintf (
274
- '<a tabindex=0 target="%s" href="%s">%s</a>',
275
- esc_attr ( $ctcc_content_settings['more_info_target'] ),
276
- esc_url ( $link ),
277
- $more_info_text
278
- );
279
- }
280
 
281
- $button_text = '';
282
- if ( empty ( $ctcc_styles_settings['x_close'] ) ) {
283
- $accept_text = wp_kses ( $ctcc_content_settings['accept_text'], $allowed );
284
- $accept_text = apply_filters( 'ctcc_accept_text', $accept_text );
285
- $button_text = sprintf (
286
- '<button id="catapultCookie" tabindex=0 onclick="catapultAcceptCookies();">%s</button>',
287
- $accept_text
288
- );
289
- }
290
 
291
- // The main bar content
292
- $notification_text = wp_kses ( $ctcc_content_settings['notification_text'], $allowed );
293
- $notification_text = apply_filters( 'ctcc_notification_text', $notification_text );
294
- $content .= sprintf (
295
- '<span class="ctcc-left-side">%s %s</span><span class="ctcc-right-side">%s</span>',
296
- $notification_text,
297
- $more_text,
298
- $button_text
299
- );
300
 
301
- // X close button
302
- if ( ! empty ( $ctcc_styles_settings['x_close'] ) ) {
303
- $content .= '<div class="x_close"><span></span><span></span></div>';
304
- }
305
 
306
- // Close custom wrapper class if used
307
- $content .= $close_content;
308
 
309
- $content .= '</div><!-- #catapult-cookie-bar -->';
310
 
311
- echo apply_filters ( 'catapult_cookie_content', $content, $ctcc_content_settings );
 
 
312
 
313
  }
314
 
12
  * Plugin public class
13
  **/
14
  if ( ! class_exists( 'CTCC_Public' ) ) { // Don't initialise if there's already a class activated
15
+
16
  class CTCC_Public {
17
+
18
  public function __construct() {
19
  //
20
  }
21
+
22
  /*
23
  * Initialize the class and start calling our hooks and filters
24
  * @since 2.0.0
35
  * @since 2.0.0
36
  */
37
  public function enqueue_scripts() {
38
+ $exclude = $this->show_bar();
39
+ // Only do all this if post isn't excluded
40
+ if( ! empty( $exclude ) ) {
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.0.0', true );
47
+ wp_localize_script (
48
+ 'cookie-consent',
49
+ 'ctcc_vars',
50
+ array (
51
+ 'expiry' => $ctcc_options_settings['cookie_expiry'],
52
+ 'method' => isset ( $ctcc_options_settings['first_page'] ),
53
+ 'version' => $ctcc_options_settings['cookie_version'],
54
+ )
55
+ );
56
+ }
57
+ }
58
+
59
+ /*
60
+ * Check if post or page is excluded from displaying the bar
61
+ * @since 2.2.0
62
+ */
63
+ public function show_bar() {
64
+ global $post;
65
+ $options = get_option( 'ctcc_options_settings' );
66
+ if( isset( $post->ID) ) {
67
+ $post_id = $post->ID;
68
+ $excluded = get_post_meta( $post_id, 'ctcc_exclude', true );
69
+ if( $excluded == 1 && ! empty( $options['enable_metafield'] ) ) {
70
+ return false;
71
+ }
72
  }
73
+ return true;
 
 
 
 
 
 
 
 
 
74
  }
75
 
76
  /*
78
  * @since 2.0.0
79
  */
80
  public function add_css() {
81
+ $exclude = $this->show_bar();
82
+ // Only do all this if post isn't excluded
83
+ if( ! empty( $exclude ) ) {
84
+ $options = get_option ( 'ctcc_options_settings' );
85
+ $ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  $position_css = 'position: fixed;
87
+ left: 0;
88
+ top: 0;
89
+ width: 100%;';
90
+ // Figure out the bar position
91
+ if ( $ctcc_styles_settings['position'] == 'top-bar' ) {
92
+ $position_css = 'position: fixed;
93
+ left: 0;
94
+ top: 0;
95
+ width: 100%;';
96
+ } else if ( $ctcc_styles_settings['position'] == 'bottom-bar' ) {
97
+ $position_css = 'position: fixed;
98
+ left: 0;
99
+ bottom: 0;
100
+ width: 100%;';
101
+ } else if ( $ctcc_styles_settings['position'] == 'top-right-block' ) {
102
+ $position_css = 'position: fixed;
103
+ right: 20px;
104
+ top: 6%;
105
+ width: 300px;';
106
+ } else if ( $ctcc_styles_settings['position'] == 'top-left-block' ) {
107
+ $position_css = 'position: fixed;
108
+ left: 20px;
109
+ top: 6%;
110
+ width: 300px;';
111
+ } else if ( $ctcc_styles_settings['position'] == 'bottom-left-block' ) {
112
+ $position_css = 'position: fixed;
113
+ left: 20px;
114
+ bottom: 6%;
115
+ width: 300px;';
116
+ } else if ( $ctcc_styles_settings['position'] == 'bottom-right-block' ) {
117
+ $position_css = 'position: fixed;
118
+ right: 20px;
119
+ bottom: 6%;
120
+ width: 300px;';
121
+ }
122
+ // Get our styles
123
+ $text_color = $ctcc_styles_settings['text_color'];
124
+ $position = 'top';
125
+ $bg_color = $ctcc_styles_settings['bg_color'];
126
+ $link_color = $ctcc_styles_settings['link_color'];
127
+ $button_bg = $ctcc_styles_settings['button_bg_color'];
128
+ $button_color = $ctcc_styles_settings['button_color'];
129
+ if ( ! empty ( $ctcc_styles_settings['flat_button'] ) ){
130
+ $button_style = 'border: 0; padding: 6px 9px; border-radius: 3px;';
131
+ } else {
132
+ $button_style = '';
133
+ }
134
+ // Build our CSS
135
+ $css = '<style id="ctcc-css" type="text/css" media="screen">';
136
+ $css .= '
137
+ #catapult-cookie-bar {
138
+ box-sizing: border-box;
139
+ max-height: 0;
140
+ opacity: 0;
141
+ z-index: 99999;
142
+ overflow: hidden;
143
+ color: ' . $text_color . ';
144
+ ' . $position_css . '
145
+ background-color: ' . $bg_color . ';
146
+ }
147
+ #catapult-cookie-bar a {
148
+ color: ' . $link_color . ';
149
+ }
150
+ #catapult-cookie-bar .x_close span {
151
+ background-color: ' . $button_color . ';
152
+ }
153
+ button#catapultCookie {
154
+ background:' . $button_bg . ';
155
+ color: ' . $button_color . ';
156
+ ' . $button_style . '
157
+ }
158
+ #catapult-cookie-bar h3 {
159
+ color: ' . $text_color . ';
160
+ }
161
+ .has-cookie-bar #catapult-cookie-bar {
162
+ opacity: 1;
163
+ max-height: 999px;
164
+ min-height: 30px;
165
+ }';
166
+ $css .= '</style>';
167
+ echo $css;
168
+ // Add it to the header
169
  }
 
 
 
 
 
 
 
 
170
  }
171
 
172
  /*
175
  */
176
  public function add_js() {
177
 
178
+ $exclude = $this->show_bar();
179
+ // Only do all this if post isn't excluded
180
+ if( ! empty( $exclude ) ) {
181
+ $options = get_option( 'ctcc_options_settings' );
182
+ $ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
183
 
184
+ if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
185
+ $type = 'bar';
186
+ } else {
187
+ $type = 'block';
188
+ } ?>
189
 
190
+ <script type="text/javascript">
191
+ jQuery(document).ready(function($){
192
+ <?php if ( isset ( $_GET['cookie'] ) ) { ?>
193
+ catapultDeleteCookie('catAccCookies');
194
+ <?php } ?>
195
+ if(!catapultReadCookie("catAccCookies")){ // If the cookie has not been set then show the bar
196
+ $("html").addClass("has-cookie-bar");
197
+ $("html").addClass("cookie-bar-<?php echo $ctcc_styles_settings['position']; ?>");
198
+ $("html").addClass("cookie-bar-<?php echo $type; ?>");
199
+ <?php // Move the HTML down if the bar is at the top
200
+ if ( $ctcc_styles_settings['position'] == 'top-bar' ) {
201
+ ?>
202
+ // Wait for the animation on the html to end before recalculating the required top margin
203
+ $("html").on('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) {
204
+ // code to execute after transition ends
205
+ var barHeight = $('#catapult-cookie-bar').outerHeight();
206
+ $("html").css("margin-top",barHeight);
207
+ $("body.admin-bar").css("margin-top",barHeight-32); // Push the body down if the admin bar is active
208
+ });
209
+ <?php } ?>
210
+ }
211
+ <?php if ( $options['closure'] == 'timed' ) {
212
+ // Add some script if it's on a timer
213
+ $duration = absint($options['duration']) * 1000; ?>
214
+ setTimeout(ctccCloseNotification, <?php echo $duration; ?>);
215
+ <?php } else if( $options['closure'] == 'scroll' ) {
216
+ if( isset( $options['scroll_height'] ) && intval( $options['scroll_height'] ) > 0 ) {
217
+ $height = intval( $options['scroll_height'] );
218
+ } else {
219
+ $height = 200;
220
+ }
221
  ?>
222
+ $(window).scroll(function(){
223
+ var scroll = $(window).scrollTop();
224
+ if ( scroll > <?php echo $height; ?> ) {
225
+ ctccCloseNotification();
226
+ }
227
+ });
 
228
  <?php } ?>
229
+ <?php if ( ! empty ( $options['first_page'] ) ) {
230
+ // Add some script if the notification only displays on the first page ?>
231
+ ctccFirstPage();
232
+ <?php } ?>
233
+ });
234
+ </script>
 
 
 
 
 
 
235
 
236
+ <?php }
237
+
238
+ }
239
 
240
  /*
241
  * Add the notification bar itself
243
  */
244
  public function add_notification_bar() {
245
 
246
+ $exclude = $this->show_bar();
247
+ // Only do all this if post isn't excluded
248
+ if( ! empty( $exclude ) ) {
249
+
250
+ $ctcc_options_settings = get_option ( 'ctcc_options_settings' );
251
+ $ctcc_content_settings = get_option ( 'ctcc_content_settings' );
252
+ $ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
253
 
254
+ // Check if it's a block or a bar
255
+ $is_block = true;
256
+ if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
257
+ $is_block = false; // It's a bar
258
+ }
259
 
260
+ // Add some classes to the block
261
+ $classes = '';
262
+ if ( $is_block ) {
263
+ if ( ! empty ( $ctcc_styles_settings['rounded_corners'] ) ) {
264
+ $classes .= ' rounded-corners';
265
+ }
266
+ if ( ! empty ( $ctcc_styles_settings['drop_shadow'] ) ) {
267
+ $classes .= ' drop-shadow';
268
+ }
269
  }
270
+ if ( ! empty ( $ctcc_styles_settings['x_close'] ) ) {
271
+ $classes .= ' use_x_close';
272
+ }
273
+ if ( empty ( $ctcc_styles_settings['display_accept_with_text'] ) ) {
274
+ $classes .= ' float-accept';
275
  }
 
 
 
 
 
 
 
276
 
277
+ // Allowed tags
278
+ $allowed = array (
279
+ 'a' => array (
280
+ 'href' => array(),
281
+ 'title' => array()
282
+ ),
283
+ 'br' => array(),
284
+ 'em' => array(),
285
+ 'strong' => array(),
286
+ 'p' => array()
287
+ );
288
 
289
+ $content = '';
290
+ $close_content = '';
291
 
292
+ // Print the notification bar
293
+ $content = '<div id="catapult-cookie-bar" class="' . $classes . '">';
294
 
295
+ // Add a custom wrapper class if specified
296
+ if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
297
+ $content .= '<div class="ctcc-inner ' . esc_attr ( str_replace ( '.', '', $ctcc_styles_settings['container_class'] ) ) . '">';
298
+ $close_content = '</div><!-- custom wrapper class -->';
299
+ }
300
 
301
+ // Add a title if it's a block
302
+ if ( $ctcc_styles_settings['position'] != 'top-bar' && $ctcc_styles_settings['position'] != 'bottom-bar' ) {
303
+ $heading_text = wp_kses ( $ctcc_content_settings['heading_text'], $allowed );
304
+ $heading_text = apply_filters( 'ctcc_heading_text', $heading_text );
305
+ $content .= sprintf ( '<h3>%s</h3>',
306
+ $heading_text
307
+ );
308
+ }
309
 
310
+ // Make the Read More link
311
+ $more_text = '';
312
+ if ( $ctcc_content_settings['more_info_text'] ) {
313
+ // Find what page we're linking to
314
+ if ( ! empty ( $ctcc_content_settings['more_info_url'] ) ) {
315
+ // Check the absolute URL first
316
+ $link = $ctcc_content_settings['more_info_url'];
317
+ } else {
318
+ // Use the internal page
319
+ $link = get_permalink ( $ctcc_content_settings['more_info_page'] );
320
+ }
321
+ $more_info_text = wp_kses ( $ctcc_content_settings['more_info_text'], $allowed );
322
+ $more_info_text = apply_filters( 'ctcc_more_info_text', $more_info_text );
323
+ $more_text = sprintf (
324
+ '<a class="ctcc-more-info-link" tabindex=0 target="%s" href="%s">%s</a>',
325
+ esc_attr ( $ctcc_content_settings['more_info_target'] ),
326
+ esc_url ( $link ),
327
+ $more_info_text
328
+ );
329
  }
 
 
 
 
 
 
 
 
 
330
 
331
+ $button_text = '';
332
+ if ( empty ( $ctcc_styles_settings['x_close'] ) ) {
333
+ $accept_text = wp_kses ( $ctcc_content_settings['accept_text'], $allowed );
334
+ $accept_text = apply_filters( 'ctcc_accept_text', $accept_text );
335
+ $button_text = sprintf (
336
+ '<button id="catapultCookie" tabindex=0 onclick="catapultAcceptCookies();">%s</button>',
337
+ $accept_text
338
+ );
339
+ }
340
 
341
+ // The main bar content
342
+ $notification_text = wp_kses_post ( do_shortcode( $ctcc_content_settings['notification_text'] ) );
343
+ $notification_text = apply_filters( 'ctcc_notification_text', $notification_text );
344
+ $content .= sprintf (
345
+ '<span class="ctcc-left-side">%s %s</span><span class="ctcc-right-side">%s</span>',
346
+ $notification_text,
347
+ $more_text,
348
+ $button_text
349
+ );
350
 
351
+ // X close button
352
+ if ( ! empty ( $ctcc_styles_settings['x_close'] ) ) {
353
+ $content .= '<div class="x_close"><span></span><span></span></div>';
354
+ }
355
 
356
+ // Close custom wrapper class if used
357
+ $content .= $close_content;
358
 
359
+ $content .= '</div><!-- #catapult-cookie-bar -->';
360
 
361
+ echo apply_filters ( 'catapult_cookie_content', $content, $ctcc_content_settings );
362
+
363
+ }
364
 
365
  }
366
 
readme.txt CHANGED
@@ -4,26 +4,28 @@ 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.6.1
7
- Stable tag: 2.1.7
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 2.0 is a major rewrite of the popular Cookie Consent plugin. We've retained all the features that originally made the plugin so popular, such as speed of set-up, but added new features based on feedback and requests.
14
 
15
- = Activation =
16
- One of the most popular aspects of the plugin is its simplicity of use. The new version is no different - simply install and activate the plugin to automatically add the cookie consent notification bar without any need to configure it. On activation, the plugin creates and populates a page on your site with information about your cookie policy and automatically links to the page from the notification bar. So if you're using the default settings, it's a matter of seconds to get up and running.
17
 
18
- = New Features =
19
- We've extended the options with the plugin and in version 2.0, we've added many new features, including:
20
- * Choice of dismissal method - either on click by the user or timed
 
 
21
  * Choice of dismissal element - either button or 'x' close
22
  * Option to show the notification on the first page only - subsequent pages visited by the user will not display the message
 
23
  * Choice of position - either top or bottom bar, or floating in one of the corners of the screen
24
- * Better translation support
25
- * Better responsive support
26
- * More customization options - including the ability to update styles from within the customizer
27
  * Inherits your theme styles where possible
28
  * The option to use an absolute or external URL to link to for further information
29
  * Set the cookie duration
@@ -68,12 +70,19 @@ You will find more details of the regulations on the [Information Commissioner's
68
 
69
  == Changelog ==
70
 
 
 
 
 
 
 
 
71
 
72
  = 2.1.7 =
73
  * Updated: admin styles
74
 
75
  = 2.1.6 =
76
- * Updated: wpml-config.xml file
77
 
78
  = 2.1.5 =
79
  * Fixed: added missing Italian translation files
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.6.1
7
+ Stable tag: 2.2.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  The only cookie consent plugin you'll ever need.
11
 
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 =
18
+ 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.
19
+
20
+ = Features =
21
+ * Choice of dismissal method - on click, on scroll, or timed
22
  * Choice of dismissal element - either button or 'x' close
23
  * Option to show the notification on the first page only - subsequent pages visited by the user will not display the message
24
+ * Option to exclude selected pages and posts from displaying the notification
25
  * Choice of position - either top or bottom bar, or floating in one of the corners of the screen
26
+ * Translation support
27
+ * Responsive
28
+ * Customization options - including the ability to update styles from within the customizer
29
  * Inherits your theme styles where possible
30
  * The option to use an absolute or external URL to link to for further information
31
  * Set the cookie duration
70
 
71
  == Changelog ==
72
 
73
+ = 2.2.0 =
74
+ * Added: optionally exclude pages and posts from displaying the cookie notification
75
+ * Added: close notification on scroll option
76
+ * Added: class name for more info link
77
+ * Fixed: x-close responsive margin
78
+ * Updated: allow shortcodes in notification text
79
+ * Updated: better settings sanitization
80
 
81
  = 2.1.7 =
82
  * Updated: admin styles
83
 
84
  = 2.1.6 =
85
+ * Updated: wpml-config.xml file (thanks to vukvukovich)
86
 
87
  = 2.1.5 =
88
  * Fixed: added missing Italian translation files
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.1.7
7
  Author: Catapult_Themes
8
  Author URI: http://catapultthemes.com/
9
  Text Domain: uk-cookie-consent
@@ -19,15 +19,27 @@ if ( ! defined( 'ABSPATH' ) ) {
19
  if ( ! defined( 'CTCC_PLUGIN_URL' ) ) {
20
  define( 'CTCC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
21
  }
 
22
  if ( is_admin() ) {
23
  require_once dirname( __FILE__ ) . '/admin/class-ctcc-admin.php';
24
  $CTCC_Admin = new CTCC_Admin();
25
  $CTCC_Admin -> init();
 
 
 
 
 
 
 
 
 
 
 
 
26
  }
27
- require_once dirname( __FILE__ ) . '/public/class-ctcc-public.php';
28
- $CTCC_Public = new CTCC_Public();
29
- $CTCC_Public -> init();
30
  require_once dirname( __FILE__ ) . '/public/customizer.php';
 
 
31
  function ctcc_load_plugin_textdomain() {
32
  load_plugin_textdomain( 'uk-cookie-consent', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
33
  }
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.0
7
  Author: Catapult_Themes
8
  Author URI: http://catapultthemes.com/
9
  Text Domain: uk-cookie-consent
19
  if ( ! defined( 'CTCC_PLUGIN_URL' ) ) {
20
  define( 'CTCC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
21
  }
22
+
23
  if ( is_admin() ) {
24
  require_once dirname( __FILE__ ) . '/admin/class-ctcc-admin.php';
25
  $CTCC_Admin = new CTCC_Admin();
26
  $CTCC_Admin -> init();
27
+
28
+ $options = get_option( 'ctcc_options_settings' );
29
+ // Add the metafield if enabled
30
+ if( ! empty( $options['enable_metafield'] ) ) {
31
+ require_once dirname( __FILE__ ) . '/admin/class-ctcc-metafield.php';
32
+ $CTCC_Metafield = new CTCC_Metafield();
33
+ $CTCC_Metafield -> init();
34
+ }
35
+ } else {
36
+ require_once dirname( __FILE__ ) . '/public/class-ctcc-public.php';
37
+ $CTCC_Public = new CTCC_Public();
38
+ $CTCC_Public -> init();
39
  }
 
 
 
40
  require_once dirname( __FILE__ ) . '/public/customizer.php';
41
+
42
+
43
  function ctcc_load_plugin_textdomain() {
44
  load_plugin_textdomain( 'uk-cookie-consent', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
45
  }