Changeset 2782403
- Timestamp:
- 09/09/2022 11:28:23 AM (4 years ago)
- Location:
- gdpr-helper
- Files:
-
- 28 added
- 1 deleted
- 6 edited
-
tags/1.2.0 (added)
-
tags/1.2.0/README.md (added)
-
tags/1.2.0/ToDo.md (added)
-
tags/1.2.0/assets (added)
-
tags/1.2.0/assets/map_default_placeholder.jpg (added)
-
tags/1.2.0/css (added)
-
tags/1.2.0/css/backend_style.css (added)
-
tags/1.2.0/css/frontend_style.css (added)
-
tags/1.2.0/gdpr-helper.php (added)
-
tags/1.2.0/includes (added)
-
tags/1.2.0/includes/backendPage.php (added)
-
tags/1.2.0/includes/elementor (added)
-
tags/1.2.0/includes/elementor/helper.php (added)
-
tags/1.2.0/includes/elementor/mapHandler.php (added)
-
tags/1.2.0/includes/elementor/widgetShortcode.php (added)
-
tags/1.2.0/includes/ghMain.php (added)
-
tags/1.2.0/includes/magicStrings.php (added)
-
tags/1.2.0/js (added)
-
tags/1.2.0/js/backend_script.js (added)
-
tags/1.2.0/js/frontend_script.js (added)
-
tags/1.2.0/languages (added)
-
tags/1.2.0/languages/README.md (added)
-
tags/1.2.0/uninstall.php (added)
-
trunk/README.md (modified) (2 diffs)
-
trunk/ToDo.md (added)
-
trunk/css/frontend_style.css (modified) (5 diffs)
-
trunk/includes/backendPage.php (modified) (5 diffs)
-
trunk/includes/elementor (added)
-
trunk/includes/elementor/helper.php (added)
-
trunk/includes/elementor/mapHandler.php (added)
-
trunk/includes/elementor/widgetShortcode.php (added)
-
trunk/includes/ghMain.php (modified) (3 diffs)
-
trunk/includes/magicStrings.php (modified) (2 diffs)
-
trunk/includes/mapHandler.php (deleted)
-
trunk/js/frontend_script.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
gdpr-helper/trunk/README.md
r2779731 r2782403 5 5 Requires at least: 4.7 6 6 Tested up to: 6.0.2 7 Stable tag: 1. 1.17 Stable tag: 1.2.0 8 8 Requires PHP: 7.0 9 9 License: GPLv3 … … 24 24 == Changelog == 25 25 26 = 1.2.0 = 27 28 - add custom Elementor widget: 2-click shortcode (Requires consent from users before showing the shortcode) 26 29 27 30 = 1.1.1 = 28 31 29 32 - fix bug that prevented the plugin to be uninstalled 30 31 33 32 34 = 1.1.0 = -
gdpr-helper/trunk/css/frontend_style.css
r2779727 r2782403 1 .gh__ map-container {1 .gh__widget_placeholder-container { 2 2 display: flex; 3 3 align-items: center; … … 8 8 } 9 9 10 .gh__ map-container img {10 .gh__widget_placeholder-container img { 11 11 object-fit: cover; 12 12 } 13 13 14 .gh__ map-container .gh__show-tooltip-button {14 .gh__widget_placeholder-container .gh__show-tooltip-button { 15 15 position: absolute; 16 16 bottom: 20%; … … 21 21 } 22 22 23 .gh__ map-container .gh__show-tooltip-button:hover {23 .gh__widget_placeholder-container .gh__show-tooltip-button:hover { 24 24 background: #efefef; 25 25 color: black; 26 26 } 27 27 28 .gh__ map-container .gh__tooltip-container {28 .gh__widget_placeholder-container .gh__tooltip-container { 29 29 display: none; 30 30 flex-direction: column; … … 36 36 } 37 37 38 .gh__ map-container .gh__tooltip-container .gh__buttons-container {38 .gh__widget_placeholder-container .gh__tooltip-container .gh__buttons-container { 39 39 display: flex; 40 40 justify-content: space-evenly; 41 41 } 42 42 43 .gh__ map-container43 .gh__widget_placeholder-container 44 44 .gh__tooltip-container 45 45 .gh__buttons-container 46 46 .gh__hide-tooltip-button, 47 .gh__ map-container47 .gh__widget_placeholder-container 48 48 .gh__tooltip-container 49 49 .gh__buttons-container … … 57 57 } 58 58 59 .gh__ map-container59 .gh__widget_placeholder-container 60 60 .gh__tooltip-container 61 61 .gh__buttons-container -
gdpr-helper/trunk/includes/backendPage.php
r2779727 r2782403 54 54 wp_enqueue_media(); 55 55 56 wp_enqueue_script('gh__backend_js', GH__PLUGIN_URL . '/js/backend_script.js', [], GH__CURRENT_VERSION, true);56 wp_enqueue_script('gh__backend_js', GH__PLUGIN_URL . '/js/backend_script.js', array('jquery'), GH__CURRENT_VERSION, true); 57 57 wp_enqueue_style('gh__backend_css', GH__PLUGIN_URL . '/css/backend_style.css', [], GH__CURRENT_VERSION); 58 58 } … … 191 191 { 192 192 foreach ($new_value as $key => $value) { 193 $sanitized_value = preg_replace('/\R/u', ' ', $value); 194 195 // Sanitize directive value, see https://www.w3.org/TR/CSP3/#framework-directives 196 $regex = '/[^\x21-\x2B\x2D-\x3A\x3C-\x7E\x09\x20]/u'; 197 $sanitized_value = preg_replace($regex, '', $sanitized_value); 198 193 $sanitized_value = $value; 194 195 if ($key == GH__SETTINGS_FIELDS__CSP_STRING) { 196 // Sanitize directive value, see https://www.w3.org/TR/CSP3/#framework-directives 197 $regex = '/[^\x21-\x2B\x2D-\x3A\x3C-\x7E\x09\x20\n;]/u'; 198 $sanitized_value = preg_replace($regex, '', $value); 199 // The newlines will be stripped before setting the http header. Leaving the in here will make it more readable for the user inside the texarea 200 } 199 201 $new_value[$key] = $sanitized_value; 200 202 } … … 276 278 </td> 277 279 <td> 278 <code>default-src 'self' 'unsafe-inline'data:</code>280 <code>default-src 'self' data:</code> 279 281 </td> 280 282 </tr> … … 300 302 connect-src 'self';<br /> 301 303 frame-src 'none';<br /> 302 img-src https://openlayers.org https://tile.openstreetmap.org http://a.tile.openstreetmap.org http://b.tile.openstreetmap.org http://c.tile.openstreetmap.org;<br />303 script-src ' unsafe-eval' 'unsafe-inline' https://openlayers.org;<br />304 style-src ' unsafe-inline' https://openlayers.org;304 img-src 'self' https://openlayers.org https://tile.openstreetmap.org http://a.tile.openstreetmap.org http://b.tile.openstreetmap.org http://c.tile.openstreetmap.org;<br /> 305 script-src 'self' 'unsafe-eval' 'unsafe-inline' https://openlayers.org;<br /> 306 style-src 'self' 'unsafe-inline' https://openlayers.org; 305 307 </code> 306 308 </td> … … 404 406 405 407 ?> 406 <textarea id='id__<?php echo $field_name; ?>' name='<?php echo $name ?>' rows=' 5' cols='50'><?php echo $value; ?></textarea>408 <textarea id='id__<?php echo $field_name; ?>' name='<?php echo $name ?>' rows='10' cols='100'><?php echo $value; ?></textarea> 407 409 <br /> 408 410 <label for='id__<?php echo $field_name; ?>'><?php echo $label_text; ?></label> -
gdpr-helper/trunk/includes/ghMain.php
r2779727 r2782403 9 9 { 10 10 require_once(GH__PLUGIN_INCLUDES_PATH . '/includes/magicStrings.php'); 11 require_once(GH__PLUGIN_INCLUDES_PATH . '/includes/elementor/helper.php'); 11 12 12 13 add_action('init', 'gdprhelper__load_language_domain'); 13 14 14 $option = get_option(GH__SETTINGS_PAGE__ID); 15 add_action('init', 'gdprhelper__set_cookies'); 16 15 17 $is_backend = is_admin() && !wp_doing_ajax(); 16 18 … … 19 21 gdprhelper__main_backend($pluginfile); 20 22 } else { 21 wp_enqueue_script('gh__frontend_js', GH__PLUGIN_URL . '/js/frontend_script.js', [], GH__CURRENT_VERSION, true);23 wp_enqueue_script('gh__frontend_js', GH__PLUGIN_URL . '/js/frontend_script.js', array('jquery'), GH__CURRENT_VERSION, true); 22 24 wp_enqueue_style('gh__frontend_css', GH__PLUGIN_URL . '/css/frontend_style.css', [], GH__CURRENT_VERSION); 23 24 } 25 26 // Check for additional settings 27 if (gdprhelper__option_equals_value($option, GH__SETTINGS_FIELDS__MAPS_HELPER_ENABLED, true)) { 28 require_once(GH__PLUGIN_INCLUDES_PATH . '/includes/mapHandler.php'); 29 gdprhelper__map_handler__entry($pluginfile); 30 } 25 } 26 27 add_action('init', 'gdprhelper__load_in_init'); 31 28 32 29 // Lastly set the correct CSP header 33 30 add_action('init', 'gdprhelper__setHeader'); 31 } 32 33 function gdprhelper__load_in_init() 34 { 35 if (gdprhelper__helper__is_elementor_installed_and_active()) { 36 // Load map placeholder if enabled 37 $option = get_option(GH__SETTINGS_PAGE__ID); 38 if (gdprhelper__option_equals_value($option, GH__SETTINGS_FIELDS__MAPS_HELPER_ENABLED, true)) { 39 require_once(GH__PLUGIN_INCLUDES_PATH . '/includes/elementor/mapHandler.php'); 40 gdprhelper__map_handler__entry(); 41 } 42 43 // Add custom Elementor widgets 44 require_once(GH__PLUGIN_INCLUDES_PATH . '/includes/elementor/widgetShortcode.php'); 45 gdprhelper__custom_elementor__entry(); 46 } 47 } 48 49 function gdprhelper__set_cookies() 50 { 51 if (isset($_GET[GH__COOKIES__PRIVACY_POLICY_ACCEPTED]) && ($_GET[GH__COOKIES__PRIVACY_POLICY_ACCEPTED] == 'true')) { 52 $id = (int) $_GET['id']; 53 check_admin_referer(GH__COOKIES__PRIVACY_POLICY_ACCEPTED . $id); 54 55 setcookie(GH__COOKIES__PRIVACY_POLICY_ACCEPTED, 'yes', 0, COOKIEPATH, COOKIE_DOMAIN); // Session cookie 56 57 $url = $_SERVER['REQUEST_URI']; 58 $scrollto = $_REQUEST['scrollto']; 59 $url = remove_query_arg(array(GH__COOKIES__PRIVACY_POLICY_ACCEPTED, 'scrollto', 'id', '_wpnonce'), $url); 60 $url = add_query_arg('clearcache', $id . '#' . $scrollto, $url); 61 wp_redirect($url); 62 63 die(); 64 } 34 65 } 35 66 … … 72 103 73 104 // Checks 74 if ($_COOKIE[GH__COOKIES__ ALLOW_MAP]) {105 if ($_COOKIE[GH__COOKIES__PRIVACY_POLICY_ACCEPTED]) { 75 106 $maps_enabled = true; 76 107 } -
gdpr-helper/trunk/includes/magicStrings.php
r2779731 r2782403 3 3 defined('ABSPATH') || die('error'); 4 4 5 const GH__CURRENT_VERSION = '1. 1.1';5 const GH__CURRENT_VERSION = '1.2.0'; 6 6 const GH__TEXT_DOMAIN = 'gdpr-helper'; 7 7 … … 21 21 22 22 // Cookies 23 const GH__COOKIES__ALLOW_MAP = 'gh_cookies_allow_map'; 23 const GH__COOKIES__PRIVACY_POLICY_ACCEPTED = 'gh_cookies_privacy_policy_accepted'; 24 25 // Elementor 26 const GH__ELEMENTOR__SHORTCODE__NAME = 'gh_shortcode'; 27 const GH__ELEMENTOR__SHORTCODE__CONTROL_SHORTCODE = 'gh_shortcode_control_shortcode'; 28 const GH__ELEMENTOR__SHORTCODE__CONTROL_TEXT = 'gh_shortcode_control_text'; 29 const GH__ELEMENTOR__SHORTCODE__CONTROL_HEIGHT = 'gh_shortcode_control_height'; 30 const GH__ELEMENTOR__SHORTCODE__CONTROL_IMAGE = 'gh_shortcode_control_image'; -
gdpr-helper/trunk/js/frontend_script.js
r2779727 r2782403 1 1 jQuery(document).ready(function (e) { 2 jQuery('.gh__map-container button.gh__show-tooltip-button').on('click', function () { 3 jQuery('.gh__map-container .gh__tooltip-container').css('display', 'flex'); 2 jQuery('.gh__widget_placeholder-container button.gh__show-tooltip-button').on('click', function () { 3 jQuery(this).parent().find('.gh__tooltip-container').css('display', 'flex'); 4 jQuery(this).parent().find('button.gh__show-tooltip-button').css('display', 'none'); 4 5 }); 5 6 6 jQuery('.gh__map-container .gh__tooltip-container .gh__hide-tooltip-button').on('click', function () { 7 jQuery('.gh__map-container .gh__tooltip-container').css('display', 'none'); 7 jQuery('.gh__widget_placeholder-container .gh__tooltip-container .gh__hide-tooltip-button').on('click', function () { 8 jQuery(this).parents('.gh__tooltip-container').css('display', 'none'); 9 jQuery(this).parents('.gh__widget_placeholder-container').find('button.gh__show-tooltip-button').css('display', 'block'); 8 10 }); 9 11 });
Note: See TracChangeset
for help on using the changeset viewer.