Plugin Directory

Changeset 2456545


Ignore:
Timestamp:
01/14/2021 07:59:26 PM (5 years ago)
Author:
stremovsky
Message:

Use standard method

Location:
better-gdpr/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • better-gdpr/trunk/better-gdpr.js

    r2407095 r2456545  
    1 const bettergdpr_js_url = document.getElementById("bettergdpr_js").src;
    21var bettergdpr_tenant;
    32var bettergdpr_full_domain;
    43var bettergdpr_full_url_dir;
    5 if (bettergdpr_js_url) {
    6   var bettergdpr_url = new URL(bettergdpr_js_url);
    7   if (bettergdpr_url) {
    8     bettergdpr_tenant = bettergdpr_url.searchParams.get('tenant');
    9     if (bettergdpr_tenant) {
    10       bettergdpr_full_domain = "https://"+bettergdpr_tenant+".privacybunker.cloud/";
    11       bettergdpr_full_url_dir = bettergdpr_url.protocol + '//' + bettergdpr_url.host;
    12       if ( bettergdpr_url.port ) {
    13         bettergdpr_full_url_dir = bettergdpr_full_url_dir + ':' + bettergdpr_url.port;
     4
     5const bettergdpr_temp_scripts = document.getElementsByTagName('script');
     6for (var index = 0; index < bettergdpr_temp_scripts.length; index++) {
     7  if (bettergdpr_temp_scripts[index].src &&
     8      bettergdpr_temp_scripts[index].src.includes('/better-gdpr.js?')) {
     9    var bettergdpr_url = new URL(bettergdpr_temp_scripts[index].src);
     10    if (bettergdpr_url) {
     11      bettergdpr_tenant = bettergdpr_url.searchParams.get('tenant');
     12      if (bettergdpr_tenant) {
     13        bettergdpr_full_domain = "https://"+bettergdpr_tenant+".privacybunker.cloud/";
     14        bettergdpr_full_url_dir = bettergdpr_url.protocol + '//' + bettergdpr_url.host;
     15        if ( bettergdpr_url.port ) {
     16          bettergdpr_full_url_dir = bettergdpr_full_url_dir + ':' + bettergdpr_url.port;
     17        }
     18        bettergdpr_full_url_dir = bettergdpr_full_url_dir + bettergdpr_url.pathname.replace('/better-gdpr.js', '/');
     19    alert('good');
    1420      }
    15       bettergdpr_full_url_dir = bettergdpr_full_url_dir + bettergdpr_url.pathname.replace('/better-gdpr.js', '/');
    16     }
    17    
     21    }
    1822  }
    1923}
  • better-gdpr/trunk/better-gdpr.php

    r2456392 r2456545  
    1212 * Plugin URI:  https:/privacybunker.io
    1313 * Description: GDPR & Cookie Consent plugin built by PrivacyBunker.io team.
    14  * Version:     0.2.4
     14 * Version:     0.2.5
    1515 * Author:      Yuli Stremovsky
    1616 * Author URI:  https://securitybunker.io
     
    390390  $subdomain = get_option( 'bettergdpr_subdomain', '' );
    391391  if ($subdomain == '') {
    392     print("<!-- bettergdpr_subdomain empty -->");
    393392    return;
    394393  }
    395394  $srv = "https://".$subdomain.".privacybunker.cloud/";
    396   $css_file = plugin_dir_url( dirname( __FILE__ ) ) . 'better-gdpr/better-gdpr.css';
    397   print("<script id='bettergdpr_js' src='".plugin_dir_url( dirname( __FILE__ ) ) ."better-gdpr/better-gdpr.js?tenant=".$subdomain."' type='text/javascript'></script>");
    398   #wp_enqueue_script( 'bettergdpr_js', plugin_dir_url( dirname( __FILE__ ) ) . 'better-gdpr/better-gdpr.js?tenant=' . $subdomain );
     395  //print("<script id='bettergdpr_js' src='".plugin_dir_url( dirname( __FILE__ ) ) ."better-gdpr/better-gdpr.js?tenant=".$subdomain."' type='text/javascript'></script>");
     396  wp_enqueue_script( 'bettergdpr_js', plugin_dir_url( dirname( __FILE__ ) ) . 'better-gdpr/better-gdpr.js?tenant=' . $subdomain );
    399397}
    400398
     
    404402add_action( 'registration_errors', 'bettergdpr_registration_check', 10, 3);
    405403add_action( 'user_register', 'bettergdpr_registration_save');
    406 //add_action( 'wp_enqueue_scripts', 'bettergdpr_cookie_consent', 1);
    407 add_action( 'wp_footer', 'bettergdpr_cookie_consent');
     404add_action( 'wp_enqueue_scripts', 'bettergdpr_cookie_consent', 1);
     405//add_action( 'wp_footer', 'bettergdpr_cookie_consent');
    408406
    409407if ( 'yes' === get_option( 'woocommerce_enable_myaccount_registration' ) ) {
  • better-gdpr/trunk/readme.txt

    r2456392 r2456545  
    44Tags: gdpr, privacy, privacy-tools, compliance, cookie-consent, security, cookie-banner, GDPR-compliance, general-data-protection-regulation, law, saas, regulations
    55Requires at least: 4.7
    6 Tested up to: 5.5
     6Tested up to: 5.6
    77Stable tag: 4.3
    88Requires PHP: 7.0
     
    5959Under the hood, user consent categories are saved in a special cookie called: "BETTERGDPR". So, when the page loads, the plugin checks the value of the "BETTERGDPR" cookie and injects the approved JavaScript code. If it is a new site visitor, we will show the user our cookie consent popup.
    6060
     61= Free takeaway =
     62
     63We run a privacy training for startup founders and architects. It is available completely for FREE:
     64https://basebunker.com/
    6165
    6266== Frequently Asked Questions ==
     
    7579
    7680== Changelog ==
     81
     82= 0.2.5 =
     83* Use standard callback to place javascript.
    7784
    7885= 0.2.4 =
Note: See TracChangeset for help on using the changeset viewer.