Cookie Consent - Version 2.3.5

Version Description

  • Fixed: removed debug code from main file
  • Updated: tracking class
Download this release

Release Info

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

Code changes from version 2.3.4 to 2.3.5

assets/images/dbpro-ad-view.png CHANGED
Binary file
assets/images/sellastic-ad1.jpg DELETED
Binary file
assets/images/themes-ad1.jpg DELETED
Binary file
assets/images/themes-ad1.png DELETED
Binary file
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Catapult_Themes, husobj, jraczynski
3
  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.8
7
- Stable tag: 2.3.4
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,10 @@ You will find more details of the regulations on the [Information Commissioner's
71
 
72
  == Changelog ==
73
 
 
 
 
 
74
  = 2.3.4 =
75
  * Updated: minor admin error
76
 
3
  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.5
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.5 =
75
+ * Fixed: removed debug code from main file
76
+ * Updated: tracking class
77
+
78
  = 2.3.4 =
79
  * Updated: minor admin error
80
 
tracking/class-plugin-usage-tracker.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * This is the class that sends all the data back to the home site
4
  * It also handles opting in and deactivation
5
- * @version 1.1.1
6
  */
7
 
8
  // Exit if accessed directly
@@ -10,11 +10,13 @@ if ( ! defined( 'ABSPATH' ) ) {
10
  exit;
11
  }
12
 
 
 
13
  if( ! class_exists( 'Plugin_Usage_Tracker') ) {
14
 
15
  class Plugin_Usage_Tracker {
16
 
17
- private $wisdom_version = '1.1.1';
18
  private $home_url = '';
19
  private $plugin_file = '';
20
  private $plugin_name = '';
@@ -69,6 +71,8 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
69
  $this->set_can_collect_email( true, $this->plugin_name );
70
  }
71
 
 
 
72
  // Check whether opt-in is required
73
  // If not, then tracking is allowed
74
  if( ! $this->require_optin ) {
@@ -78,7 +82,6 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
78
  }
79
 
80
  // Hook our do_tracking function to the daily action
81
- // add_filter( 'cron_schedules', array( $this, 'add_weekly_cron_schedule' ) );
82
  add_action( 'put_do_weekly_action', array( $this, 'do_tracking' ) );
83
 
84
  // Use this action for local testing
@@ -95,19 +98,6 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
95
 
96
  }
97
 
98
- /**
99
- * Add weekly option to the cron schedule
100
- *
101
- * @since 1.1.2
102
- */
103
- public function add_weekly_cron_schedule( $schedules ) {
104
- $schedules['weekly'] = array(
105
- 'interval' => 604800,
106
- 'display' => __( 'Once weekly', 'put-usage-tracker' )
107
- );
108
- return $schedules;
109
- }
110
-
111
  /**
112
  * When the plugin is activated
113
  * Create scheduled event
@@ -121,7 +111,8 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
121
  wp_schedule_event( time(), 'daily', 'put_do_weekly_action' );
122
  }
123
  // Run tracking here in case plugin has been reactivated
124
- $this->do_tracking();
 
125
  }
126
 
127
  /**
@@ -212,7 +203,7 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
212
 
213
  // Collect the email if the correct option has been set
214
  if( $this->get_can_collect_email() ) {
215
- $body['email'] = get_bloginfo( 'admin_email' );
216
  }
217
  $body['marketing_method'] = $this->marketing;
218
 
@@ -517,6 +508,53 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
517
  update_option( 'wisdom_collect_email', $collect_email );
518
  }
519
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
  /**
521
  * Display the admin notice to users to allow them to opt in
522
  *
@@ -549,9 +587,9 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
549
 
550
  // @credit EDD
551
  // Don't bother asking user to opt in if they're in local dev
552
- if ( stristr( network_site_url( '/' ), 'dev' ) !== false || stristr( network_site_url( '/' ), 'localhost' ) !== false || stristr( network_site_url( '/' ), ':8888' ) !== false ) {
553
- $this->update_block_notice();
554
- } else {
555
 
556
  // Display the notice requesting permission to track
557
  // Retrieve current plugin information
@@ -598,7 +636,7 @@ if( ! class_exists( 'Plugin_Usage_Tracker') ) {
598
  </p>
599
  </div>
600
  <?php
601
- }
602
 
603
  }
604
 
2
  /**
3
  * This is the class that sends all the data back to the home site
4
  * It also handles opting in and deactivation
5
+ * @version 1.1.2
6
  */
7
 
8
  // Exit if accessed directly
10
  exit;
11
  }
12
 
13
+
14
+
15
  if( ! class_exists( 'Plugin_Usage_Tracker') ) {
16
 
17
  class Plugin_Usage_Tracker {
18
 
19
+ private $wisdom_version = '1.1.2';
20
  private $home_url = '';
21
  private $plugin_file = '';
22
  private $plugin_name = '';
71
  $this->set_can_collect_email( true, $this->plugin_name );
72
  }
73
 
74
+ $this->set_admin_email();
75
+
76
  // Check whether opt-in is required
77
  // If not, then tracking is allowed
78
  if( ! $this->require_optin ) {
82
  }
83
 
84
  // Hook our do_tracking function to the daily action
 
85
  add_action( 'put_do_weekly_action', array( $this, 'do_tracking' ) );
86
 
87
  // Use this action for local testing
98
 
99
  }
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  /**
102
  * When the plugin is activated
103
  * Create scheduled event
111
  wp_schedule_event( time(), 'daily', 'put_do_weekly_action' );
112
  }
113
  // Run tracking here in case plugin has been reactivated
114
+ // Hooked to admin_init to ensure user object is ready
115
+ add_action( 'admin_init', array( $this, 'do_tracking' ) );
116
  }
117
 
118
  /**
203
 
204
  // Collect the email if the correct option has been set
205
  if( $this->get_can_collect_email() ) {
206
+ $body['email'] = $this->get_admin_email();
207
  }
208
  $body['marketing_method'] = $this->marketing;
209
 
508
  update_option( 'wisdom_collect_email', $collect_email );
509
  }
510
 
511
+ /**
512
+ * Get the correct email address to use
513
+ * @since 1.1.2
514
+ * @return Email address
515
+ */
516
+ public function get_admin_email() {
517
+ // The wisdom_collect_email option is an array of plugins that are being tracked
518
+ $email = get_option( 'wisdom_admin_emails' );
519
+ // If this plugin is in the array, then we can collect the email address
520
+ if( isset( $email[$this->plugin_name] ) ) {
521
+ return $email[$this->plugin_name];
522
+ }
523
+ return false;
524
+ }
525
+
526
+ /**
527
+ * Set the correct email address to use
528
+ * There might be more than one admin on the site
529
+ * So we only use the first admin's email address
530
+ * @param $email Email address to set
531
+ * @param $plugin Plugin name to set email address for
532
+ * @since 1.1.2
533
+ */
534
+ public function set_admin_email( $email=null, $plugin=null ) {
535
+ if( empty( $plugin ) ) {
536
+ $plugin = $this->plugin_name;
537
+ }
538
+ // If no email address passed, try to get the current user's email
539
+ if( empty( $email ) ) {
540
+ // Have to check that current user object is available
541
+ if( function_exists( 'wp_get_current_user' ) ) {
542
+ $current_user = wp_get_current_user();
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
550
+ $admin_emails = array( $plugin => sanitize_email( $email ) );
551
+ } else if( empty( $admin_emails[$plugin] ) ) {
552
+ // Else add the email address to the array, if not already set
553
+ $admin_emails[$plugin] = sanitize_email( $email );
554
+ }
555
+ update_option( 'wisdom_admin_emails', $admin_emails );
556
+ }
557
+
558
  /**
559
  * Display the admin notice to users to allow them to opt in
560
  *
587
 
588
  // @credit EDD
589
  // Don't bother asking user to opt in if they're in local dev
590
+ // if ( stristr( network_site_url( '/' ), 'dev' ) !== false || stristr( network_site_url( '/' ), 'localhost' ) !== false || stristr( network_site_url( '/' ), ':8888' ) !== false ) {
591
+ // $this->update_block_notice();
592
+ // } else {
593
 
594
  // Display the notice requesting permission to track
595
  // Retrieve current plugin information
636
  </p>
637
  </div>
638
  <?php
639
+ //}
640
 
641
  }
642
 
uk-cookie-consent.php CHANGED
@@ -3,7 +3,7 @@
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.4
7
  Author: Catapult_Themes
8
  Author URI: http://catapultthemes.com/
9
  Text Domain: uk-cookie-consent
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.5
7
  Author: Catapult_Themes
8
  Author URI: http://catapultthemes.com/
9
  Text Domain: uk-cookie-consent