Google Analytics Opt-Out - Version 0.1.2

Version Description

  • Works again with the Google Analytics plugin by Yoast
Download this release

Release Info

Developer wp-buddy
Plugin Icon 128x128 Google Analytics Opt-Out
Version 0.1.2
Comparing to
See all releases

Code changes from version 0.1.1 to 0.1.2

classes/functions.php CHANGED
@@ -6,13 +6,66 @@
6
  * @return bool
7
  */
8
  function gaoo_yoast_plugin_active() {
9
- global $ga_admin, $yoast_ga;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
- if ( ( isset( $ga_admin ) && is_a( $ga_admin, 'GA_Admin' ) ) OR ( isset( $yoast_ga ) && is_a( $yoast_ga, 'GA_Filter' ) ) ) {
12
  return true;
13
  }
 
 
 
 
 
 
 
 
 
 
14
 
15
- return true;
 
16
  }
17
 
18
  /**
@@ -24,7 +77,7 @@ function gaoo_yoast_plugin_active() {
24
  */
25
  function gaoo_get_yoast_ua() {
26
 
27
- if ( ! gaoo_yoast_plugin_active() ) {
28
  return '';
29
  }
30
 
@@ -36,21 +89,24 @@ function gaoo_get_yoast_ua() {
36
  }
37
 
38
  $yoast_settings = get_option( $ga_admin->optionname );
 
 
 
39
 
40
- if ( ! isset( $yoast_settings['uastring'] ) ) {
41
  return '';
42
  }
43
 
44
- return $yoast_settings['uastring'];
 
45
  }
46
 
47
- global $yoast_ga;
48
 
49
- if ( ! isset( $yoast_ga->options['uastring'] ) ) {
50
  return '';
51
  }
52
 
53
- return $yoast_ga->options['uastring'];
54
 
55
  }
56
 
6
  * @return bool
7
  */
8
  function gaoo_yoast_plugin_active() {
9
+ if ( is_admin() ) {
10
+ global $ga_admin;
11
+
12
+ if ( ! isset( $ga_admin ) ) {
13
+ return false;
14
+ }
15
+
16
+ if ( ! $ga_admin instanceof GA_Admin ) {
17
+ return false;
18
+ }
19
+
20
+ return true;
21
+ }
22
+ else {
23
+ global $yoast_ga;
24
+
25
+ if ( ! isset( $yoast_ga ) ) {
26
+ return false;
27
+ }
28
+
29
+ if ( ! $yoast_ga instanceof GA_Filter ) {
30
+ return false;
31
+ }
32
+
33
+ return true;
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Checks if the Yoast Analytics Plugin is active
39
+ * @since 0.1.2
40
+ * @return bool
41
+ */
42
+ function gaoop_yoast_plugin_active() {
43
+ if ( is_admin() ) {
44
+ global $ga_admin;
45
+
46
+ if ( ! isset( $ga_admin ) ) {
47
+ return false;
48
+ }
49
+
50
+ if ( ! $ga_admin instanceof GA_Admin ) {
51
+ return false;
52
+ }
53
 
 
54
  return true;
55
  }
56
+ else {
57
+ global $yoast_ga;
58
+
59
+ if ( ! isset( $yoast_ga ) ) {
60
+ return false;
61
+ }
62
+
63
+ if ( ! $yoast_ga instanceof GA_Filter ) {
64
+ return false;
65
+ }
66
 
67
+ return true;
68
+ }
69
  }
70
 
71
  /**
77
  */
78
  function gaoo_get_yoast_ua() {
79
 
80
+ if ( ! gaoop_yoast_plugin_active() ) {
81
  return '';
82
  }
83
 
89
  }
90
 
91
  $yoast_settings = get_option( $ga_admin->optionname );
92
+ }
93
+ else {
94
+ global $yoast_ga;
95
 
96
+ if ( ! isset( $yoast_ga->options ) ) {
97
  return '';
98
  }
99
 
100
+ $yoast_settings = $yoast_ga->options;
101
+
102
  }
103
 
 
104
 
105
+ if ( ! isset( $yoast_settings['uastring'] ) ) {
106
  return '';
107
  }
108
 
109
+ return $yoast_settings['uastring'];
110
 
111
  }
112
 
google-analytics-opt-out.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Google Analytics Opt-Out
4
  Plugin URI: http://wp-buddy.com/products/plugins/google-analytics-opt-out
5
  Description: Provides an Opt-Out functionality for Google Analytics
6
- Version: 0.1.1
7
  Author: WP-Buddy
8
  Author URI: http://wp-buddy.com
9
  License: GPL2
3
  Plugin Name: Google Analytics Opt-Out
4
  Plugin URI: http://wp-buddy.com/products/plugins/google-analytics-opt-out
5
  Description: Provides an Opt-Out functionality for Google Analytics
6
+ Version: 0.1.2
7
  Author: WP-Buddy
8
  Author URI: http://wp-buddy.com
9
  License: GPL2
readme.txt CHANGED
@@ -2,10 +2,10 @@
2
  Contributors: wp-buddy
3
  Donate link: http://wp-buddy.com/products/plugins/google-analytics-opt-out/
4
  Tags: google analytics, analytics, analytics opt-out, analytics opt out
5
- Version: 0.1.1
6
  Requires at least: 3.7
7
- Stable tag: 0.1.1
8
- Tested up to: 3.9.1
9
  License: GPLv2
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -62,7 +62,10 @@ if ( function_exists( 'gaoo_js' ) ) {
62
 
63
  == Changelog ==
64
 
65
- = 0.2 =
 
 
 
66
  * Fixed the issue that error message still shows shows up
67
  * Added/replaced some translations
68
  * Fixed an issue that Yoasts Analytics for WordPress plugin has changed the option name
2
  Contributors: wp-buddy
3
  Donate link: http://wp-buddy.com/products/plugins/google-analytics-opt-out/
4
  Tags: google analytics, analytics, analytics opt-out, analytics opt out
5
+ Version: 0.1.2
6
  Requires at least: 3.7
7
+ Stable tag: 0.1.2
8
+ Tested up to: 4.0
9
  License: GPLv2
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
62
 
63
  == Changelog ==
64
 
65
+ = 0.1.2 =
66
+ * Works again with the Google Analytics plugin by Yoast
67
+
68
+ = 0.1.1 =
69
  * Fixed the issue that error message still shows shows up
70
  * Added/replaced some translations
71
  * Fixed an issue that Yoasts Analytics for WordPress plugin has changed the option name