Skip to content

Commit

Permalink
fixed title of downloaded doc
Browse files Browse the repository at this point in the history
  • Loading branch information
rlankhorst committed Mar 4, 2024
1 parent b6bcbdc commit 3db5e93
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 82 deletions.
14 changes: 14 additions & 0 deletions class-cookie-blocker.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,24 @@ public function delete_cookies(){
}
$count++;
unset($_COOKIE[$name]);
$name = $this->sanitize_cookie_name($name);
setcookie($name, "", -1, COMPLIANZ::$banner_loader->get_cookie_path() );
setcookie($name, "", -1, '/' );
}
}

/**
* Sanitize cookie name. Remove any characters that are not alphanumeric, underscore, or dash to prevent fatal errors in the setcookie function
*
* @param string $name
*
* @return string
*/

public function sanitize_cookie_name(string $name): string {
// Remove any characters that are not alphanumeric, underscore, or dash
return preg_replace('/[^a-zA-Z0-9_-]/', '', $name);
}

/**
* Add cookie data rest route
Expand Down
98 changes: 51 additions & 47 deletions cookiebanner/js/complianz.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ const cmplz_set_category_as_body_class = () => {
}
const cats = cmplz_accepted_categories();
Object.values(cats).forEach(category => {
classList.add('cmplz-' + category);
if (typeof category === 'string') {
classList.add('cmplz-' + category);
}
});
const services = cmplz_get_all_service_consents();
Object.entries(services).forEach(([service, consent]) => {
Expand Down Expand Up @@ -872,6 +874,54 @@ function cmplz_fire_before_categories_consent(categories){
document.dispatchEvent(event);
}

/*
* Deny all categories, and reload if needed.
*/
window.cmplz_deny_all = function(){
for (let key in cmplz_categories) {
if ( cmplz_categories.hasOwnProperty(key) ) {
cmplz_set_consent(cmplz_categories[key], 'deny');
}
}
let consentLevel = cmplz_highest_accepted_category();
let reload = false;

if (consentLevel !== 'functional' || cmplz_exists_service_consent() ) {
reload = true;
}
if ( cmplz_clear_cookies('cmplz_service') ) {
reload = true;
}

//has to be after the check if should be reloaded, otherwise that check won't work.
cmplz_clear_all_service_consents();
cmplz_integrations_revoke();
cmplz_fire_categories_event();
cmplz_track_status();

let event = new CustomEvent('cmplz_revoke', { detail: reload });
document.dispatchEvent(event);

//we need to let the iab extension handle the reload, otherwise the consent revoke might not be ready yet.
if ( !complianz.tcf_active && reload ) {
cmplz_reload_browser_compatible();
}
}

/*
* If current cookie policy has changed, reset cookie consent
*
* */

function cmplz_check_cookie_policy_id() {
let user_policy_id = cmplz_get_cookie('policy_id');
if (user_policy_id && (parseInt(complianz.current_policy_id) !== parseInt(user_policy_id) ) ) {
cmplz_deny_all();
cmplz_set_banner_status('show');
cmplz_clear_cookies('cmplz');
}
}

window.conditionally_show_banner = function() {
//merge userdata with complianz data, in case a b testing is used with user specific cookie banner data
//objects are merged so user_data will override data in complianz object
Expand Down Expand Up @@ -1458,39 +1508,7 @@ document.addEventListener('cmplz_consent_action', function (e) {
cmplz_track_status();
});

/*
* Deny all categories, and reload if needed.
*/
window.cmplz_deny_all = function(){
for (let key in cmplz_categories) {
if ( cmplz_categories.hasOwnProperty(key) ) {
cmplz_set_consent(cmplz_categories[key], 'deny');
}
}
let consentLevel = cmplz_highest_accepted_category();
let reload = false;

if (consentLevel !== 'functional' || cmplz_exists_service_consent() ) {
reload = true;
}
if ( cmplz_clear_cookies('cmplz_service') ) {
reload = true;
}

//has to be after the check if should be reloaded, otherwise that check won't work.
cmplz_clear_all_service_consents();
cmplz_integrations_revoke();
cmplz_fire_categories_event();
cmplz_track_status();

let event = new CustomEvent('cmplz_revoke', { detail: reload });
document.dispatchEvent(event);

//we need to let the iab extension handle the reload, otherwise the consent revoke might not be ready yet.
if ( !complianz.tcf_active && reload ) {
cmplz_reload_browser_compatible();
}
}

/*
* For both opt-in and opt-out, clicking cmplz-accept should result in accepting all categories
Expand Down Expand Up @@ -1870,20 +1888,6 @@ function cmplz_merge_object(userdata, ajax_data) {
return output;
}

/*
* If current cookie policy has changed, reset cookie consent
*
* */

function cmplz_check_cookie_policy_id() {
let user_policy_id = cmplz_get_cookie('policy_id');
if (user_policy_id && (parseInt(complianz.current_policy_id) !== parseInt(user_policy_id) ) ) {
cmplz_deny_all();
cmplz_set_banner_status('show');
cmplz_clear_cookies('cmplz');
}
}

/*
* Clear all our own cookies, to make sure path issues are resolved.
*
Expand Down
2 changes: 1 addition & 1 deletion cookiebanner/js/complianz.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cookiebanner/templates/cookiebanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="cmplz-header">
<div class="cmplz-logo">{logo}</div>
<div class="cmplz-title" id="cmplz-header-{id}-{consent_type}">{header}</div>
<div class="cmplz-close" tabindex="0" role="button" aria-label=" <?php __("close-dialog", "complianz-gdpr" ) ?>">
<div class="cmplz-close" tabindex="0" role="button" aria-label="<?php esc_html_e(__("Close dialog","complianz-gdpr")) ?>">
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg>
</div>
</div>
Expand Down
58 changes: 29 additions & 29 deletions languages/complianz-gdpr.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the Complianz Privacy Suite (GDPR/CCPA) premium plugin.
msgid ""
msgstr ""
"Project-Id-Version: Complianz Privacy Suite (GDPR/CCPA) premium 7.0.7\n"
"Project-Id-Version: Complianz Privacy Suite (GDPR/CCPA) premium 7.0.8\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/complianz-gdpr-premium\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-02-26T13:29:42+00:00\n"
"POT-Creation-Date: 2024-03-04T15:06:08+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.8.1\n"
"X-Domain: complianz-gdpr\n"
Expand Down Expand Up @@ -62,7 +62,7 @@ msgid "Upgrade to premium"
msgstr ""

#: class-admin.php:348
#: functions.php:1986
#: functions.php:1994
#: settings/build/2824.a852e0b3b03bb65e4f2f.js:1
#: settings/build/4816.d807cf547060ca8ad5dc.js:1
#: settings/build/6508.d9c28240127d75626688.js:1
Expand Down Expand Up @@ -2382,7 +2382,7 @@ msgid "On a cookie policy, the banner will be minimized by default"
msgstr ""

#: cookiebanner/class-banner-loader.php:828
#: functions.php:1989
#: functions.php:1997
msgid "Purpose pending investigation"
msgstr ""

Expand Down Expand Up @@ -2782,7 +2782,7 @@ msgid "Font size"
msgstr ""

#: cookiebanner/settings.php:474
#: functions.php:722
#: functions.php:726
#: settings/config/menu.php:21
#: settings/config/menu.php:183
#: settings/config/menu.php:196
Expand Down Expand Up @@ -2976,7 +2976,7 @@ msgid "Marketing description"
msgstr ""

#: cookiebanner/templates/cookiebanner.php:11
msgid "close-dialog"
msgid "Close dialog"
msgstr ""

#: cookiebanner/templates/cookiebanner.php:35
Expand Down Expand Up @@ -3256,46 +3256,46 @@ msgstr ""
msgid "No title"
msgstr ""

#: functions.php:345
#: functions.php:349
msgid "Based on your Analytics configuration you should fire Analytics on event cmplz_functional."
msgstr ""

#: functions.php:347
#: functions.php:351
msgid "Based on your Analytics configuration you should fire Analytics on event cmplz_statistics."
msgstr ""

#: functions.php:421
#: functions.php:425
msgid "Not found"
msgstr ""

#: functions.php:487
#: functions.php:491
#: settings/build/5104.cb6d60d9ced05b7efa96.js:1
#: settings/src/Settings/ChangeStatus.js:4
msgid "Revoke"
msgstr ""

#: functions.php:519
#: functions.php:522
#: functions.php:523
#: functions.php:526
msgid "Current status: %s"
msgstr ""

#: functions.php:520
#: functions.php:524
msgid "Accepted"
msgstr ""

#: functions.php:523
#: functions.php:527
msgid "Denied"
msgstr ""

#: functions.php:1068
#: functions.php:1072
msgid "the page source"
msgstr ""

#: functions.php:1071
#: functions.php:1075
msgid "%s on line %s of %s"
msgstr ""

#: functions.php:1408
#: functions.php:1416
#: settings/build/24.17b6c8ad5b87a258e68e.js:1
#: settings/build/2540.08bbb91d60be404ac81f.js:1
#: settings/build/2824.a852e0b3b03bb65e4f2f.js:1
Expand All @@ -3310,51 +3310,51 @@ msgstr ""
msgid "Upgrade"
msgstr ""

#: functions.php:1957
#: functions.php:1965
msgid "Miscellaneous"
msgstr ""

#: functions.php:1964
#: functions.php:1974
#: functions.php:1972
#: functions.php:1982
msgid "This data is not shared with third parties."
msgstr ""

#: functions.php:1966
#: functions.php:1971
#: functions.php:1974
#: functions.php:1979
msgid "For more information, please read the %s%s Privacy Statement%s."
msgstr ""

#: functions.php:1976
#: functions.php:1984
msgid "Sharing of data is pending investigation"
msgstr ""

#: functions.php:1979
#: functions.php:1987
msgctxt "Legal document cookie policy"
msgid "We use %s for %s."
msgstr ""

#: functions.php:2477
#: functions.php:2485
#: settings/build/7944.5a7e0e8f288115f88373.js:1
#: settings/src/Settings/RecordsOfConsent/RecordsOfConsentControl.js:167
msgid "Opt-in"
msgstr ""

#: functions.php:2479
#: functions.php:2487
#: pro/tcf/templates/vendorlist-us.php:13
#: settings/build/7944.5a7e0e8f288115f88373.js:1
#: settings/src/Settings/RecordsOfConsent/RecordsOfConsentControl.js:168
msgid "Opt-out"
msgstr ""

#: functions.php:2481
#: functions.php:2489
msgid "All consent types"
msgstr ""

#: functions.php:2845
#: functions.php:2853
msgid "In September 2023 the Quebec bill 64 will be enforced in Canada. In order to keep your site compliant, %sopt-in must be implemented for Canada%s. Please Navigate to the %sWizard%s and enable opt-in for Canada."
msgstr ""

#: functions.php:2846
#: functions.php:2854
msgid "Please be aware that this will activate opt-in for Canada, altering the banner and blocking non-functional scripts and cookies prior to consent. Please check the front-end of your site after activating opt-in."
msgstr ""

Expand Down
9 changes: 9 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ The Brazilian General Data Protection Law is similar to the GDPR, the UK-GDPR it
With some custom CSS this is possible, but we do not consider a cookie wall to be GDPR compliant, so it's not actively supported. We do, however, have the option to create a Soft Cookie Wall. Which blocks interaction with the website, but dismissing remains a possibility.

== Changelog ==
= 7.0.3 =
* March 5th, 2024
* Improvement: clean up MPDF temp directory after pdf generation
* Improvement: set aria label on x close button from banner
* Fix: deleting cookies with disallowed cookie names causing fatal error, props @baffled
* Fix: missing cmplz_deny_all() function for expired cookies with a changed cookie policy id.
* Fix: cmplz_set_category_as_body_class() also iterating over objects instead of just class names, when parsing the body classes, props @tomnoir
* Fix: due to changed setting usage, Complianz assumed TCF active in some situations, causing the banner editor not to function properly, props @vania2008, @jeanfrancois7

= 7.0.2 =
* February 28th, 2024
* Fix: force the 'wizard_completed_once' to be true for upgrades to 7.0.2, to prevent issues with banner not showing after upgrade, props @cometto, @riroweb2022, @katynen, @julianulmer, @iviadvagency
Expand Down
Loading

0 comments on commit 3db5e93

Please sign in to comment.