From 0536a9d6cf956b8a19302fe01ca18058db3613fa Mon Sep 17 00:00:00 2001
From: stodorovic
Date: Fri, 21 Sep 2018 09:05:34 +0200
Subject: [PATCH 1/2] [Testing] Support for plugin GDPR
---
plugins/gdpr.php | 110 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 110 insertions(+)
create mode 100644 plugins/gdpr.php
diff --git a/plugins/gdpr.php b/plugins/gdpr.php
new file mode 100644
index 00000000..94152996
--- /dev/null
+++ b/plugins/gdpr.php
@@ -0,0 +1,110 @@
+
+
';
+
+ if ( $changed ) {
+ echo '' . sprintf(
+ esc_html__( 'GDPR support is now %s', 'wp-super-cache' ),
+ esc_html( $cache_gdpr ? __( 'enabled', 'wp-super-cache' ) : __( 'disabled', 'wp-super-cache' ) )
+ ) . '
';
+ }
+
+ echo '';
+ wp_nonce_field( 'wp-cache' );
+ ?>
+
+
+
+ 'gdpr',
+ 'url' => 'https://wordpress.org/plugins/gdpr/',
+ 'title' => esc_html__( 'GDPR', 'wp-super-cache' ),
+ 'desc' => esc_html__( 'Provides support for GDPR plugin', 'wp-super-cache' ),
+ );
+ return $list;
+}
+add_cacheaction( 'wpsc_filter_list', 'wpsc_gdpr_list' );
From 1268566d1941e538276c811ed735b31cb265cf04 Mon Sep 17 00:00:00 2001
From: stodorovic
Date: Fri, 21 Sep 2018 14:22:07 +0200
Subject: [PATCH 2/2] Adds support for wp-gdpr-compliance
---
plugins/gdpr.php | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/plugins/gdpr.php b/plugins/gdpr.php
index 94152996..de710726 100644
--- a/plugins/gdpr.php
+++ b/plugins/gdpr.php
@@ -9,7 +9,7 @@
* Forces caching (for "known" users) because it doesn't work if get_cookies returns non-empty string.
* PR #616 fixes this issue. It's temporary workaround for testing purpose.
*/
- if ( ! is_admin() && isset( $_COOKIE['gdpr'] ) ) {
+ if ( ! is_admin() && ( isset( $_COOKIE['gdpr'] ) || isset( $_COOKIE['wpgdprc-consent'] ) ) ) {
$wp_cache_saved_not_logged_in = $wp_cache_not_logged_in;
$wp_cache_not_logged_in = 0;
}
@@ -37,7 +37,7 @@ function wpsc_gdpr_get_cookies_values( $string ) {
$cookie_consents = (array) json_decode( stripslashes( $_COOKIE['gdpr']['consent_types'] ) ); // WPCS: Input var ok, sanitization ok.
if ( ! empty( $cookie_consents ) ) {
- $string .= 'gdpr_consents_types=' . implode( '|', $cookie_consents );
+ $string .= 'gdpr_consents_types=' . implode( '|', $cookie_consents ) . ',';
$super_cache_enabled = false; // Create only wp-cache file.
}
}
@@ -47,7 +47,17 @@ function wpsc_gdpr_get_cookies_values( $string ) {
$allowed_cookies = (array) json_decode( stripslashes( $_COOKIE['gdpr']['allowed_cookies'] ) ); // WPCS: Input var ok, sanitization ok.
if ( ! empty( $allowed_cookies ) ) {
- $string .= 'gdpr_allowed_cookies =' . implode( '|', $allowed_cookies );
+ $string .= 'gdpr_allowed_cookies=' . implode( '|', $allowed_cookies ) . ',';
+ $super_cache_enabled = false; // Create only wp-cache file.
+ }
+ }
+
+ // Extracts wpgdprc-consent.
+ if ( isset( $_COOKIE['wpgdprc-consent'] ) ) {
+ $consents = is_string( $_COOKIE['wpgdprc-consent'] ) ? stripslashes( $_COOKIE['wpgdprc-consent'] ) : ''; // WPCS: Input var ok, sanitization ok.
+
+ if ( ! empty( $consents ) ) {
+ $string .= 'gdpr_consents=' . $consents . ',';
$super_cache_enabled = false; // Create only wp-cache file.
}
}