From c7691ae868d9418851e9ca55a53e01c15fcfb45b Mon Sep 17 00:00:00 2001 From: Jesse Norell Date: Fri, 26 Oct 2018 13:59:12 -0600 Subject: [PATCH 1/3] add gdpr_allowed_html filter --- admin/class-gdpr-admin.php | 15 +++++++++------ admin/partials/settings.php | 2 +- public/class-gdpr-public.php | 14 ++++++++------ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/admin/class-gdpr-admin.php b/admin/class-gdpr-admin.php index d25b162d..af7f39e5 100755 --- a/admin/class-gdpr-admin.php +++ b/admin/class-gdpr-admin.php @@ -60,12 +60,15 @@ class GDPR_Admin { public function __construct( $plugin_name, $version ) { $this->plugin_name = $plugin_name; $this->version = $version; - $this->allowed_html = array( - 'a' => array( - 'href' => true, - 'title' => true, - 'target' => true, - ), + $tabs = apply_filters( 'gdpr_tools_tabs', $tabs ); + $this->allowed_html = apply_filters( 'gdpr_allowed_html', + array( + 'a' => array( + 'href' => true, + 'title' => true, + 'target' => true, + ), + ) ); } diff --git a/admin/partials/settings.php b/admin/partials/settings.php index 92766e58..7f16473b 100755 --- a/admin/partials/settings.php +++ b/admin/partials/settings.php @@ -132,7 +132,7 @@ - + diff --git a/public/class-gdpr-public.php b/public/class-gdpr-public.php index 723ae978..7e09ae36 100755 --- a/public/class-gdpr-public.php +++ b/public/class-gdpr-public.php @@ -64,12 +64,14 @@ class GDPR_Public { public function __construct( $plugin_name, $version ) { $this->plugin_name = $plugin_name; $this->version = $version; - $this->allowed_html = array( - 'a' => array( - 'href' => true, - 'title' => true, - 'target' => true, - ), + $this->allowed_html = apply_filters( 'gdpr_allowed_html', + array( + 'a' => array( + 'href' => true, + 'title' => true, + 'target' => true, + ), + ) ); } From 66e4f38a49fa4a4340680617c0cc34eabd273d3f Mon Sep 17 00:00:00 2001 From: Jesse Norell Date: Fri, 26 Oct 2018 18:01:47 -0600 Subject: [PATCH 2/3] allow html in textarea fields --- admin/class-gdpr-admin.php | 105 +++++++++++++++++++++++- admin/partials/settings.php | 2 +- public/class-gdpr-public.php | 104 ++++++++++++++++++++++- templates/privacy-bar.php | 2 +- templates/privacy-preferences-modal.php | 2 +- 5 files changed, 205 insertions(+), 10 deletions(-) diff --git a/admin/class-gdpr-admin.php b/admin/class-gdpr-admin.php index af7f39e5..9e110d2c 100755 --- a/admin/class-gdpr-admin.php +++ b/admin/class-gdpr-admin.php @@ -64,9 +64,106 @@ public function __construct( $plugin_name, $version ) { $this->allowed_html = apply_filters( 'gdpr_allowed_html', array( 'a' => array( - 'href' => true, - 'title' => true, - 'target' => true, + 'id' => array(), + 'class' => array(), + 'href' => array(), + 'rel' => array(), + 'rev' => array(), + 'name' => array(), + 'title' => array(), + 'target' => array(), + ), + 'div' => array( + 'id' => array(), + 'class' => array(), + ), + 'span' => array( + 'id' => array(), + 'class' => array(), + ), + 'i' => array( + 'id' => array(), + 'class' => array(), + ), + 'p' => array( + 'id' => array(), + 'class' => array(), + ), + 'br' => array(), + 'hr' => array( + 'class' => array(), + ), + 'em' => array(), + 'strong' => array(), + 'small' => array(), + 'strike' => array(), + 'ul' => array( + 'id' => array(), + 'class' => array(), + ), + 'ol' => array( + 'id' => array(), + 'class' => array(), + 'start' => array(), + ), + 'li' => array( + 'id' => array(), + 'class' => array(), + 'value' => array(), + ), + 'img' => array( + 'id' => array(), + 'class' => array(), + 'alt' => array(), + 'height' => array(), + 'src' => array(), + 'width' => array(), + 'title' => array(), + ), + 'h1' => array( + 'id' => array(), + 'class' => array(), + ), + 'h2' => array( + 'id' => array(), + 'class' => array(), + ), + 'h3' => array( + 'id' => array(), + 'class' => array(), + ), + 'h4' => array( + 'id' => array(), + 'class' => array(), + ), + 'h5' => array( + 'id' => array(), + 'class' => array(), + ), + 'h6' => array( + 'id' => array(), + 'class' => array(), + ), + 'label' => array( + 'id' => array(), + 'class' => array(), + 'for' => array(), + ), + 'code' => array( + 'id' => array(), + 'class' => array(), + ), + 'button' => array( + 'id' => array(), + 'class' => array(), + 'name' => array(), + 'value' => array(), + 'disabled' => array(), + ), + 'abbr' => array( + 'id' => array(), + 'class' => array(), + 'title' => array(), ), ) ); @@ -188,7 +285,7 @@ public function sanitize_cookie_categories( $cookie_categories ) { public function register_settings() { $settings = array( 'gdpr_cookie_banner_content' => array( $this, 'sanitize_with_links' ), - 'gdpr_cookie_privacy_excerpt' => 'sanitize_textarea_field', + 'gdpr_cookie_privacy_excerpt' => array( $this, 'sanitize_with_links' ), 'gdpr_cookie_popup_content' => array( $this, 'sanitize_cookie_categories' ), 'gdpr_email_limit' => 'intval', 'gdpr_consent_types' => array( $this, 'sanitize_consents' ), diff --git a/admin/partials/settings.php b/admin/partials/settings.php index 7f16473b..14a78999 100755 --- a/admin/partials/settings.php +++ b/admin/partials/settings.php @@ -145,7 +145,7 @@ - +

diff --git a/public/class-gdpr-public.php b/public/class-gdpr-public.php index 7e09ae36..9d52689d 100755 --- a/public/class-gdpr-public.php +++ b/public/class-gdpr-public.php @@ -67,9 +67,106 @@ public function __construct( $plugin_name, $version ) { $this->allowed_html = apply_filters( 'gdpr_allowed_html', array( 'a' => array( - 'href' => true, - 'title' => true, - 'target' => true, + 'id' => array(), + 'class' => array(), + 'href' => array(), + 'rel' => array(), + 'rev' => array(), + 'name' => array(), + 'title' => array(), + 'target' => array(), + ), + 'div' => array( + 'id' => array(), + 'class' => array(), + ), + 'span' => array( + 'id' => array(), + 'class' => array(), + ), + 'i' => array( + 'id' => array(), + 'class' => array(), + ), + 'p' => array( + 'id' => array(), + 'class' => array(), + ), + 'br' => array(), + 'hr' => array( + 'class' => array(), + ), + 'em' => array(), + 'strong' => array(), + 'small' => array(), + 'strike' => array(), + 'ul' => array( + 'id' => array(), + 'class' => array(), + ), + 'ol' => array( + 'id' => array(), + 'class' => array(), + 'start' => array(), + ), + 'li' => array( + 'id' => array(), + 'class' => array(), + 'value' => array(), + ), + 'img' => array( + 'id' => array(), + 'class' => array(), + 'alt' => array(), + 'height' => array(), + 'src' => array(), + 'width' => array(), + 'title' => array(), + ), + 'h1' => array( + 'id' => array(), + 'class' => array(), + ), + 'h2' => array( + 'id' => array(), + 'class' => array(), + ), + 'h3' => array( + 'id' => array(), + 'class' => array(), + ), + 'h4' => array( + 'id' => array(), + 'class' => array(), + ), + 'h5' => array( + 'id' => array(), + 'class' => array(), + ), + 'h6' => array( + 'id' => array(), + 'class' => array(), + ), + 'label' => array( + 'id' => array(), + 'class' => array(), + 'for' => array(), + ), + 'code' => array( + 'id' => array(), + 'class' => array(), + ), + 'button' => array( + 'id' => array(), + 'class' => array(), + 'name' => array(), + 'value' => array(), + 'disabled' => array(), + ), + 'abbr' => array( + 'id' => array(), + 'class' => array(), + 'title' => array(), ), ) ); @@ -168,6 +265,7 @@ public function privacy_bar() { 'registered_cookies' => $registered_cookies, 'show_cookie_cat_checkboxes' => $show_cookie_cat_checkboxes, 'button_text' => $button_text, + 'allowed_html' => $this->allowed_html, ) ); } diff --git a/templates/privacy-bar.php b/templates/privacy-bar.php index fcf948da..42f8512c 100755 --- a/templates/privacy-bar.php +++ b/templates/privacy-bar.php @@ -15,7 +15,7 @@