Hello,
Thank you for releasing version 2.2.0.
However, as much as I hate being the bearer of bad news, unfortunately I have to let you know that version 2.2.0 did not solve the issue.
If I could make a quick suggestion (without implying that it is the optimal one), this would be the following:
File: gdpr-cookie-consent/public/templates/skins/default.php
Line 21:
Current code:
<div class="group-description" tabindex="0"><p class="gdpr"><?php echo esc_html__( $the_options['gdpr_str'], 'gdpr-cookie-consent' ); ?>
Suggested modification:
<div class="group-description" tabindex="0"><p class="gdpr"><?php echo strip_tags($the_options['gdpr_str'],"<a><br><em><strong>"); ?>
File: gdpr-cookie-consent/admin/class-gdpr-cookie-consent-admin.php
Line 1107:
Current code:
$the_options['notify_message'] = isset( $_POST['gcc-gdpr-msg'] ) ? sanitize_text_field( wp_unslash( $_POST['gcc-gdpr-msg'] ) ) : "This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.";
Suggested modification:
$the_options['notify_message'] = isset( $_POST['gcc-gdpr-msg'] ) ? wp_kses( wp_unslash( $_POST['gcc-gdpr-msg'] ),
array(
'a' => array(
'href' => array(),
'title' => array(),
'target' => array(),
'rel' => array(),
'class' => array(),
'id' => array(),
'style' => array()
),
'br' => array(),
'em' => array(),
'strong' => array(),
)
) : "This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.";
In this way, function esc_html__()
is replaced by function strip_tags()
which is configured escape all HTML tags, except the ones that are allowed. This solves the issue on frontend. To address the issue on backend, function sanitize_text_field()
is replaced by wp_kses()
which does filter the user’s input but also allows the HTML tags of the provided array to be used.
Best regards,
George