Cookie Notice by dFactory - Version 2.1.2

Version Description

  • Tweak: Improved escaping of button labels
Download this release

Release Info

Developer dfactory
Plugin Icon 128x128 Cookie Notice by dFactory
Version 2.1.2
Comparing to
See all releases

Code changes from version 2.1.1 to 2.1.2

Files changed (3) hide show
  1. cookie-notice.php +3 -3
  2. includes/frontend.php +18 -17
  3. readme.txt +6 -3
cookie-notice.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Cookie Notice & Compliance for GDPR / CCPA
4
  Description: Cookie Notice allows you to you elegantly inform users that your site uses cookies and helps you comply with GDPR, CCPA and other data privacy laws.
5
- Version: 2.1.1
6
  Author: Hu-manity.co
7
  Author URI: https://hu-manity.co/
8
  Plugin URI: https://hu-manity.co/
@@ -29,7 +29,7 @@ if ( ! defined( 'ABSPATH' ) )
29
  * Cookie Notice class.
30
  *
31
  * @class Cookie_Notice
32
- * @version 2.1.1
33
  */
34
  class Cookie_Notice {
35
 
@@ -85,7 +85,7 @@ class Cookie_Notice {
85
  'update_notice' => true,
86
  'update_delay_date' => 0
87
  ),
88
- 'version' => '2.1.1'
89
  );
90
 
91
  private static $_instance;
2
  /*
3
  Plugin Name: Cookie Notice & Compliance for GDPR / CCPA
4
  Description: Cookie Notice allows you to you elegantly inform users that your site uses cookies and helps you comply with GDPR, CCPA and other data privacy laws.
5
+ Version: 2.1.2
6
  Author: Hu-manity.co
7
  Author URI: https://hu-manity.co/
8
  Plugin URI: https://hu-manity.co/
29
  * Cookie Notice class.
30
  *
31
  * @class Cookie_Notice
32
+ * @version 2.1.2
33
  */
34
  class Cookie_Notice {
35
 
85
  'update_notice' => true,
86
  'update_delay_date' => 0
87
  ),
88
+ 'version' => '2.1.2'
89
  );
90
 
91
  private static $_instance;
includes/frontend.php CHANGED
@@ -39,7 +39,7 @@ class Cookie_Notice_Frontend {
39
  // init cookie compliance
40
  if ( Cookie_Notice()->get_status() === 'active' ) {
41
  add_action( 'send_headers', array( $this, 'add_cors_http_header' ) );
42
- add_action( 'wp_head', array( $this, 'wp_head_scripts' ), 0 );;
43
  // init cookie notice
44
  } else {
45
  // actions
@@ -72,12 +72,11 @@ class Cookie_Notice_Frontend {
72
  // get site language
73
  $locale = get_locale();
74
  $locale_code = explode( '_', $locale );
75
-
76
  // exceptions, norwegian
77
- if ( in_array( $locale_code, array( 'nb', 'nn' ) ) ) {
78
  $locale_code = 'no';
79
- }
80
-
81
  $options = array(
82
  'appID' => Cookie_Notice()->options['general']['app_id'],
83
  'currentLanguage' => $locale_code[0],
@@ -91,7 +90,7 @@ class Cookie_Notice_Frontend {
91
  </script>
92
  <script type="text/javascript" src="' . $this->widget_url . '"></script>';
93
  }
94
-
95
  /**
96
  * Cookie notice output.
97
  *
@@ -150,23 +149,25 @@ class Cookie_Notice_Frontend {
150
  else
151
  $options['message_text'] = wp_kses_post( $options['message_text'] );
152
 
 
153
  $options['css_class'] = esc_attr( $options['css_class'] );
 
154
 
155
  // message output
156
  $output = '
157
  <!-- Cookie Notice plugin v' . Cookie_Notice()->defaults['version'] . ' by Hu-manity.co https://hu-manity.co/ -->
158
- <div id="cookie-notice" role="banner" class="cookie-notice-hidden cookie-revoke-hidden cn-position-' . $options['position'] . '" aria-label="' . $options['aria_label'] . '" style="background-color: rgba(' . implode( ',', Cookie_Notice()->hex2rgb( $options['colors']['bar'] ) ) . ',' . $options['colors']['bar_opacity'] * 0.01 . ');">'
159
- . '<div class="cookie-notice-container" style="color: ' . $options['colors']['text'] . ';">'
160
- . '<span id="cn-notice-text" class="cn-text-container">'. $options['message_text'] . '</span>'
161
- . '<span id="cn-notice-buttons" class="cn-buttons-container"><a href="#" id="cn-accept-cookie" data-cookie-set="accept" class="cn-set-cookie ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . $options['accept_text'] . '">' . $options['accept_text'] . '</a>'
162
- . ( $options['refuse_opt'] === true ? '<a href="#" id="cn-refuse-cookie" data-cookie-set="refuse" class="cn-set-cookie ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . $options['refuse_text'] . '">' . $options['refuse_text'] . '</a>' : '' )
163
- . ( $options['see_more'] === true && $options['link_position'] === 'banner' ? '<a href="' . ( $options['see_more_opt']['link_type'] === 'custom' ? $options['see_more_opt']['link'] : get_permalink( $options['see_more_opt']['id'] ) ) . '" target="' . $options['link_target'] . '" id="cn-more-info" class="cn-more-info ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . $options['see_more_opt']['text'] . '">' . $options['see_more_opt']['text'] . '</a>' : '' )
164
- . '</span><a href="javascript:void(0);" id="cn-close-notice" data-cookie-set="accept" class="cn-close-icon" aria-label="' . $options['accept_text'] . '"></a>'
165
  . '</div>
166
  ' . ( $options['refuse_opt'] === true && $options['revoke_cookies'] == true ?
167
- '<div class="cookie-revoke-container" style="color: ' . $options['colors']['text'] . ';">'
168
- . ( ! empty( $options['revoke_message_text'] ) ? '<span id="cn-revoke-text" class="cn-text-container">'. $options['revoke_message_text'] . '</span>' : '' )
169
- . '<span id="cn-revoke-buttons" class="cn-buttons-container"><a href="#" class="cn-revoke-cookie ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . $options['revoke_text'] . '">' . esc_html( $options['revoke_text'] ) . '</a></span>
170
  </div>' : '' ) . '
171
  </div>
172
  <!-- / Cookie Notice plugin -->';
@@ -273,7 +274,7 @@ class Cookie_Notice_Frontend {
273
 
274
  return $classes;
275
  }
276
-
277
  /**
278
  * Purge config cache.
279
  */
39
  // init cookie compliance
40
  if ( Cookie_Notice()->get_status() === 'active' ) {
41
  add_action( 'send_headers', array( $this, 'add_cors_http_header' ) );
42
+ add_action( 'wp_head', array( $this, 'wp_head_scripts' ), 0 );
43
  // init cookie notice
44
  } else {
45
  // actions
72
  // get site language
73
  $locale = get_locale();
74
  $locale_code = explode( '_', $locale );
75
+
76
  // exceptions, norwegian
77
+ if ( in_array( $locale_code, array( 'nb', 'nn' ) ) )
78
  $locale_code = 'no';
79
+
 
80
  $options = array(
81
  'appID' => Cookie_Notice()->options['general']['app_id'],
82
  'currentLanguage' => $locale_code[0],
90
  </script>
91
  <script type="text/javascript" src="' . $this->widget_url . '"></script>';
92
  }
93
+
94
  /**
95
  * Cookie notice output.
96
  *
149
  else
150
  $options['message_text'] = wp_kses_post( $options['message_text'] );
151
 
152
+ // escape css classes
153
  $options['css_class'] = esc_attr( $options['css_class'] );
154
+ $options['button_class'] = esc_attr( $options['button_class'] );
155
 
156
  // message output
157
  $output = '
158
  <!-- Cookie Notice plugin v' . Cookie_Notice()->defaults['version'] . ' by Hu-manity.co https://hu-manity.co/ -->
159
+ <div id="cookie-notice" role="banner" class="cookie-notice-hidden cookie-revoke-hidden cn-position-' . esc_attr( $options['position'] ) . '" aria-label="' . esc_attr( $options['aria_label'] ) . '" style="background-color: rgba(' . implode( ',', Cookie_Notice()->hex2rgb( $options['colors']['bar'] ) ) . ',' . ( (int) $options['colors']['bar_opacity'] ) * 0.01 . ');">'
160
+ . '<div class="cookie-notice-container" style="color: ' . esc_attr( $options['colors']['text'] ) . ';">'
161
+ . '<span id="cn-notice-text" class="cn-text-container">'. esc_html( $options['message_text'] ) . '</span>'
162
+ . '<span id="cn-notice-buttons" class="cn-buttons-container"><a href="#" id="cn-accept-cookie" data-cookie-set="accept" class="cn-set-cookie ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['accept_text'] ) . '">' . esc_html( $options['accept_text'] ) . '</a>'
163
+ . ( $options['refuse_opt'] === true ? '<a href="#" id="cn-refuse-cookie" data-cookie-set="refuse" class="cn-set-cookie ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['refuse_text'] ) . '">' . esc_html( $options['refuse_text'] ) . '</a>' : '' )
164
+ . ( $options['see_more'] === true && $options['link_position'] === 'banner' ? '<a href="' . ( $options['see_more_opt']['link_type'] === 'custom' ? esc_url( $options['see_more_opt']['link'] ) : get_permalink( $options['see_more_opt']['id'] ) ) . '" target="' . esc_attr( $options['link_target'] ) . '" id="cn-more-info" class="cn-more-info ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['see_more_opt']['text'] ) . '">' . esc_html( $options['see_more_opt']['text'] ) . '</a>' : '' )
165
+ . '</span><a href="javascript:void(0);" id="cn-close-notice" data-cookie-set="accept" class="cn-close-icon" aria-label="' . esc_attr( $options['accept_text'] ) . '"></a>'
166
  . '</div>
167
  ' . ( $options['refuse_opt'] === true && $options['revoke_cookies'] == true ?
168
+ '<div class="cookie-revoke-container" style="color: ' . esc_attr( $options['colors']['text'] ) . ';">'
169
+ . ( ! empty( $options['revoke_message_text'] ) ? '<span id="cn-revoke-text" class="cn-text-container">'. esc_html( $options['revoke_message_text'] ) . '</span>' : '' )
170
+ . '<span id="cn-revoke-buttons" class="cn-buttons-container"><a href="#" class="cn-revoke-cookie ' . $options['button_class'] . ( $options['css_style'] !== 'none' ? ' ' . $options['css_style'] : '' ) . ( $options['css_class'] !== '' ? ' ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['revoke_text'] ) . '">' . esc_html( $options['revoke_text'] ) . '</a></span>
171
  </div>' : '' ) . '
172
  </div>
173
  <!-- / Cookie Notice plugin -->';
274
 
275
  return $classes;
276
  }
277
+
278
  /**
279
  * Purge config cache.
280
  */
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: gdpr, ccpa, cookies, consent, compliance
4
  Requires at least: 4.3
5
  Requires PHP: 5.3
6
  Tested up to: 5.8
7
- Stable tag: 2.1.1
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -58,6 +58,9 @@ No questions yet.
58
 
59
  == Changelog ==
60
 
 
 
 
61
  = 2.1.1 =
62
  * Fix: Security bug related to compliance caching
63
 
@@ -321,5 +324,5 @@ Initial release
321
 
322
  == Upgrade Notice ==
323
 
324
- = 2.1.1 =
325
- * Fix: Security bug related to compliance caching
4
  Requires at least: 4.3
5
  Requires PHP: 5.3
6
  Tested up to: 5.8
7
+ Stable tag: 2.1.2
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
58
 
59
  == Changelog ==
60
 
61
+ = 2.1.2 =
62
+ * Tweak: Improved escaping of button labels
63
+
64
  = 2.1.1 =
65
  * Fix: Security bug related to compliance caching
66
 
324
 
325
  == Upgrade Notice ==
326
 
327
+ = 2.1.2 =
328
+ * Tweak: Improved escaping of button labels