Cookie Consent - Version 2.3.7

Version Description

  • Updated: tracking class
Download this release

Release Info

Developer Catapult_Themes
Plugin Icon 128x128 Cookie Consent
Version 2.3.7
Comparing to
See all releases

Code changes from version 2.3.6 to 2.3.7

readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate Link: https://www.paypal.me/catapultthemes
4
  Tags: cookie law, cookies, eu cookie law, eu privacy directive, cookie compliance, cookie law, cookie notice, cookie notification, wpml, geo ip
5
  Requires at least: 4.3
6
  Tested up to: 4.9.1
7
- Stable tag: 2.3.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  The only cookie consent plugin you'll ever need.
@@ -71,6 +71,9 @@ You will find more details of the regulations on the [Information Commissioner's
71
 
72
  == Changelog ==
73
 
 
 
 
74
  = 2.3.6 =
75
  * Updated: tracking class
76
 
4
  Tags: cookie law, cookies, eu cookie law, eu privacy directive, cookie compliance, cookie law, cookie notice, cookie notification, wpml, geo ip
5
  Requires at least: 4.3
6
  Tested up to: 4.9.1
7
+ Stable tag: 2.3.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  The only cookie consent plugin you'll ever need.
71
 
72
  == Changelog ==
73
 
74
+ = 2.3.7 =
75
+ * Updated: tracking class
76
+
77
  = 2.3.6 =
78
  * Updated: tracking class
79
 
tracking/class-plugin-usage-tracker.php CHANGED
@@ -11,7 +11,6 @@ if ( ! defined( 'ABSPATH' ) ) {
11
  }
12
 
13
 
14
-
15
  if( ! class_exists( 'Plugin_Usage_Tracker') ) {
16
 
17
  class Plugin_Usage_Tracker {
@@ -74,9 +73,10 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
74
  // Check whether opt-in is required
75
  // If not, then tracking is allowed
76
  if( ! $this->require_optin ) {
 
77
  $this->set_is_tracking_allowed( true );
78
  $this->update_block_notice();
79
- $this->do_tracking();
80
  }
81
 
82
  // Hook our do_tracking function to the daily action
@@ -108,9 +108,6 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
108
  if ( ! wp_next_scheduled( 'put_do_weekly_action' ) ) {
109
  wp_schedule_event( time(), 'daily', 'put_do_weekly_action' );
110
  }
111
- // Run tracking here in case plugin has been reactivated
112
- // Hooked to admin_init to ensure user object is ready
113
- add_action( 'admin_init', array( $this, 'do_tracking' ) );
114
  }
115
 
116
  /**
@@ -120,8 +117,9 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
120
  * Then send it back
121
  *
122
  * @since 1.0.0
 
123
  */
124
- public function do_tracking() {
125
  // If the home site hasn't been defined, we just drop out. Nothing much we can do.
126
  if ( ! $this->home_url ) {
127
  return;
@@ -135,7 +133,7 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
135
 
136
  // Check to see if it's time to track
137
  $track_time = $this->get_is_time_to_track();
138
- if( ! $track_time ) {
139
  return;
140
  }
141
 
@@ -543,7 +541,7 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
543
  $email = $current_user->user_email;
544
  }
545
  }
546
- // The wisdom_admin_email option is an array of admin email addresses
547
  $admin_emails = get_option( 'wisdom_admin_emails' );
548
  if( empty( $admin_emails ) || ! is_array( $admin_emails ) ) {
549
  // If nothing exists in the option yet, start a new array with the plugin name
@@ -567,7 +565,7 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
567
  $action = sanitize_text_field( $_GET['plugin_action'] );
568
  if( $action == 'yes' ) {
569
  $this->set_is_tracking_allowed( true, $plugin );
570
- $this->do_tracking(); // Run this straightaway
571
  } else {
572
  $this->set_is_tracking_allowed( false, $plugin );
573
  }
@@ -652,7 +650,7 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
652
  // Set marketing optin
653
  $this->set_can_collect_email( sanitize_text_field( $_GET['marketing_optin'] ), $this->plugin_name );
654
  // Do tracking
655
- $this->do_tracking();
656
  } else if( isset( $_GET['marketing'] ) && $_GET['marketing']=='yes' ) {
657
  // Display the notice requesting permission to collect email address
658
  // Retrieve current plugin information
11
  }
12
 
13
 
 
14
  if( ! class_exists( 'Plugin_Usage_Tracker') ) {
15
 
16
  class Plugin_Usage_Tracker {
73
  // Check whether opt-in is required
74
  // If not, then tracking is allowed
75
  if( ! $this->require_optin ) {
76
+ $this->set_can_collect_email( true, $this->plugin_name );
77
  $this->set_is_tracking_allowed( true );
78
  $this->update_block_notice();
79
+ $this->do_tracking( true );
80
  }
81
 
82
  // Hook our do_tracking function to the daily action
108
  if ( ! wp_next_scheduled( 'put_do_weekly_action' ) ) {
109
  wp_schedule_event( time(), 'daily', 'put_do_weekly_action' );
110
  }
 
 
 
111
  }
112
 
113
  /**
117
  * Then send it back
118
  *
119
  * @since 1.0.0
120
+ * @param $force Force tracking if it's not time
121
  */
122
+ public function do_tracking( $force=false ) {
123
  // If the home site hasn't been defined, we just drop out. Nothing much we can do.
124
  if ( ! $this->home_url ) {
125
  return;
133
 
134
  // Check to see if it's time to track
135
  $track_time = $this->get_is_time_to_track();
136
+ if( ! $track_time && ! $force ) {
137
  return;
138
  }
139
 
541
  $email = $current_user->user_email;
542
  }
543
  }
544
+ // The wisdom_admin_emails option is an array of admin email addresses
545
  $admin_emails = get_option( 'wisdom_admin_emails' );
546
  if( empty( $admin_emails ) || ! is_array( $admin_emails ) ) {
547
  // If nothing exists in the option yet, start a new array with the plugin name
565
  $action = sanitize_text_field( $_GET['plugin_action'] );
566
  if( $action == 'yes' ) {
567
  $this->set_is_tracking_allowed( true, $plugin );
568
+ $this->do_tracking( true ); // Run this straightaway
569
  } else {
570
  $this->set_is_tracking_allowed( false, $plugin );
571
  }
650
  // Set marketing optin
651
  $this->set_can_collect_email( sanitize_text_field( $_GET['marketing_optin'] ), $this->plugin_name );
652
  // Do tracking
653
+ $this->do_tracking( true );
654
  } else if( isset( $_GET['marketing'] ) && $_GET['marketing']=='yes' ) {
655
  // Display the notice requesting permission to collect email address
656
  // Retrieve current plugin information
uk-cookie-consent.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /*
3
  Plugin Name: Cookie Consent
4
- Plugin URI: http://catapultthemes.com/cookie-consent/
5
  Description: The only cookie consent plugin you'll ever need.
6
- Version: 2.3.6
7
  Author: Catapult_Themes
8
- Author URI: http://catapultthemes.com/
9
  Text Domain: uk-cookie-consent
10
  Domain Path: /languages
11
  */
1
  <?php
2
  /*
3
  Plugin Name: Cookie Consent
4
+ Plugin URI: https://catapultthemes.com/cookie-consent/
5
  Description: The only cookie consent plugin you'll ever need.
6
+ Version: 2.3.7
7
  Author: Catapult_Themes
8
+ Author URI: https://catapultthemes.com/
9
  Text Domain: uk-cookie-consent
10
  Domain Path: /languages
11
  */