Version Description
- Fix: Security bug related to compliance caching
Download this release
Release Info
Developer | dfactory |
Plugin | Cookie Notice by dFactory |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.1.1
- cookie-notice.php +3 -3
- includes/frontend.php +1 -63
- includes/welcome-api.php +1 -1
- js/front-compliance.js +0 -45
- readme.txt +7 -4
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.
|
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.
|
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.
|
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.1
|
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.1
|
33 |
*/
|
34 |
class Cookie_Notice {
|
35 |
|
85 |
'update_notice' => true,
|
86 |
'update_delay_date' => 0
|
87 |
),
|
88 |
+
'version' => '2.1.1'
|
89 |
);
|
90 |
|
91 |
private static $_instance;
|
includes/frontend.php
CHANGED
@@ -39,10 +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 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_compliance_scripts' ) );
|
44 |
-
add_action( 'wp_ajax_cn_save_config', array( $this, 'ajax_save_config' ) );
|
45 |
-
add_action( 'wp_ajax_nopriv_cn_save_config', array( $this, 'ajax_save_config' ) );
|
46 |
// init cookie notice
|
47 |
} else {
|
48 |
// actions
|
@@ -86,18 +83,6 @@ class Cookie_Notice_Frontend {
|
|
86 |
'currentLanguage' => $locale_code[0],
|
87 |
'blocking' => (bool) ( ! is_user_logged_in() ? Cookie_Notice()->options['general']['app_blocking'] : false )
|
88 |
);
|
89 |
-
|
90 |
-
$cached_config = get_transient( 'cookie_notice_compliance_cache' );
|
91 |
-
|
92 |
-
if ( ! empty( $cached_config ) && is_array( $cached_config ) ) {
|
93 |
-
$options = array_merge( $options, array(
|
94 |
-
'cache' => true,
|
95 |
-
'cacheType' => 'db',
|
96 |
-
'cacheData' => $cached_config
|
97 |
-
) );
|
98 |
-
}
|
99 |
-
|
100 |
-
// print_r( $options ); exit;
|
101 |
|
102 |
echo '
|
103 |
<!-- Hu Banner -->
|
@@ -107,29 +92,6 @@ class Cookie_Notice_Frontend {
|
|
107 |
<script type="text/javascript" src="' . $this->widget_url . '"></script>';
|
108 |
}
|
109 |
|
110 |
-
/**
|
111 |
-
* Load compliance scripts and styles - frontend.
|
112 |
-
*/
|
113 |
-
public function wp_enqueue_compliance_scripts() {
|
114 |
-
wp_enqueue_script(
|
115 |
-
'cookie-notice-compliance',
|
116 |
-
plugins_url( '../js/front-compliance.js', __FILE__ ),
|
117 |
-
array(),
|
118 |
-
Cookie_Notice()->defaults['version'],
|
119 |
-
isset( Cookie_Notice()->options['general']['script_placement'] ) && Cookie_Notice()->options['general']['script_placement'] === 'footer'
|
120 |
-
);
|
121 |
-
|
122 |
-
wp_localize_script(
|
123 |
-
'cookie-notice-compliance',
|
124 |
-
'cnComplianceArgs',
|
125 |
-
array(
|
126 |
-
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
|
127 |
-
'nonce' => wp_create_nonce( 'cn_save_config' ),
|
128 |
-
'secure' => (int) is_ssl()
|
129 |
-
)
|
130 |
-
);
|
131 |
-
}
|
132 |
-
|
133 |
/**
|
134 |
* Cookie notice output.
|
135 |
*
|
@@ -312,30 +274,6 @@ class Cookie_Notice_Frontend {
|
|
312 |
return $classes;
|
313 |
}
|
314 |
|
315 |
-
/**
|
316 |
-
* Save compliance config caching.
|
317 |
-
*/
|
318 |
-
public function ajax_save_config() {
|
319 |
-
if ( Cookie_Notice()->get_status() !== 'active' )
|
320 |
-
return;
|
321 |
-
|
322 |
-
if ( ! wp_verify_nonce( esc_attr( $_REQUEST['nonce'] ), 'cn_save_config' ) )
|
323 |
-
return;
|
324 |
-
|
325 |
-
$json_data = ! empty( $_REQUEST['data'] ) ? esc_attr( $_REQUEST['data'] ) : false;
|
326 |
-
$config_data = array();
|
327 |
-
|
328 |
-
if ( ! empty( $json_data ) )
|
329 |
-
$config_data = json_decode( stripslashes( html_entity_decode( $json_data ) ), true );
|
330 |
-
|
331 |
-
// save data
|
332 |
-
if ( $config_data && is_array( $config_data ) )
|
333 |
-
set_transient( 'cookie_notice_compliance_cache', $config_data, 24 * HOUR_IN_SECONDS );
|
334 |
-
|
335 |
-
return true;
|
336 |
-
exit;
|
337 |
-
}
|
338 |
-
|
339 |
/**
|
340 |
* Purge config cache.
|
341 |
*/
|
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
|
83 |
'currentLanguage' => $locale_code[0],
|
84 |
'blocking' => (bool) ( ! is_user_logged_in() ? Cookie_Notice()->options['general']['app_blocking'] : false )
|
85 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
echo '
|
88 |
<!-- Hu Banner -->
|
92 |
<script type="text/javascript" src="' . $this->widget_url . '"></script>';
|
93 |
}
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
/**
|
96 |
* Cookie notice output.
|
97 |
*
|
274 |
return $classes;
|
275 |
}
|
276 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
/**
|
278 |
* Purge config cache.
|
279 |
*/
|
includes/welcome-api.php
CHANGED
@@ -588,7 +588,7 @@ class Cookie_Notice_Welcome_API {
|
|
588 |
}
|
589 |
|
590 |
/**
|
591 |
-
*
|
592 |
*
|
593 |
* @param string $action The requested action.
|
594 |
* @param array $_data Parameters for the API action.
|
588 |
}
|
589 |
|
590 |
/**
|
591 |
+
* API request.
|
592 |
*
|
593 |
* @param string $action The requested action.
|
594 |
* @param array $_data Parameters for the API action.
|
js/front-compliance.js
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
// cookieNotice
|
2 |
-
( function ( window, document, undefined ) {
|
3 |
-
|
4 |
-
var cookieCompliance = new function () {
|
5 |
-
|
6 |
-
// initialize
|
7 |
-
this.init = function () {
|
8 |
-
var _this = this;
|
9 |
-
|
10 |
-
// on save data
|
11 |
-
document.addEventListener( 'load-config.hu', function( event ) {
|
12 |
-
|
13 |
-
// console.log( event );
|
14 |
-
|
15 |
-
var config = event.detail;
|
16 |
-
|
17 |
-
if ( config !== null ) {
|
18 |
-
// alpha JS request // no jQuery
|
19 |
-
var request = new XMLHttpRequest();
|
20 |
-
|
21 |
-
request.open( 'POST', cnComplianceArgs.ajaxUrl, true );
|
22 |
-
request.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded;' );
|
23 |
-
request.onload = function () {
|
24 |
-
if ( this.status >= 200 && this.status < 400 ) {
|
25 |
-
// ff successful
|
26 |
-
} else {
|
27 |
-
// if fail
|
28 |
-
}
|
29 |
-
};
|
30 |
-
request.onerror = function () {
|
31 |
-
// connection error
|
32 |
-
};
|
33 |
-
request.send( 'action=cn_save_config&nonce=' + cnComplianceArgs.nonce + '&data=' + JSON.stringify( config ) );
|
34 |
-
}
|
35 |
-
|
36 |
-
} );
|
37 |
-
};
|
38 |
-
}
|
39 |
-
|
40 |
-
// initialize plugin
|
41 |
-
window.addEventListener( 'load', function () {
|
42 |
-
cookieCompliance.init();
|
43 |
-
}, false );
|
44 |
-
|
45 |
-
} )( window, document, undefined );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: humanityco
|
|
3 |
Tags: gdpr, ccpa, cookies, consent, compliance
|
4 |
Requires at least: 4.3
|
5 |
Requires PHP: 5.3
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 2.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.0 =
|
62 |
* New: Introducing Cookie Compliance Free plan
|
63 |
|
@@ -318,5 +321,5 @@ Initial release
|
|
318 |
|
319 |
== Upgrade Notice ==
|
320 |
|
321 |
-
= 2.1.
|
322 |
-
*
|
3 |
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 |
|
59 |
== Changelog ==
|
60 |
|
61 |
+
= 2.1.1 =
|
62 |
+
* Fix: Security bug related to compliance caching
|
63 |
+
|
64 |
= 2.1.0 =
|
65 |
* New: Introducing Cookie Compliance Free plan
|
66 |
|
321 |
|
322 |
== Upgrade Notice ==
|
323 |
|
324 |
+
= 2.1.1 =
|
325 |
+
* Fix: Security bug related to compliance caching
|