Google Analytics Opt-Out - Version 2.1.0

Version Description

Download this release

Release Info

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

Code changes from version 2.0.2 to 2.1.0

google-analytics-opt-out.php CHANGED
@@ -3,14 +3,14 @@
3
  Plugin Name: Google Analytics Opt-Out
4
  Plugin URI: https://wp-buddy.com/products/plugins/google-analytics-opt-out
5
  Description: Provides an Opt-Out functionality for Google Analytics
6
- Version: 2.0.2
7
  Author: WP-Buddy
8
  Author URI: https://wp-buddy.com
9
  License: GPL2
10
  Text Domain: google-analytics-opt-out
11
  Domain Path: /languages/
12
 
13
- Copyright 2016 WP-Buddy (email : info@wp-buddy.com)
14
 
15
  This program is free software; you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License, version 2, as
@@ -40,7 +40,7 @@ add_action( 'init', function () {
40
 
41
  define( 'GAOOP_FILE', __FILE__ );
42
  define( 'GAOOP_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
43
- define( 'GAOOP_URL', trailingslashit( plugins_url() ) . trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) );
44
 
45
  if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
46
  wp_die( sprintf( __( 'You are using PHP in version %s. This version is outdated and cannot be used with the Google Analytics Opt-Out plugin. Please update to the latest PHP version in order to use this plugin. You can ask your provider on how to do this.', 'google-analytics-opt-out' ), PHP_VERSION ) );
3
  Plugin Name: Google Analytics Opt-Out
4
  Plugin URI: https://wp-buddy.com/products/plugins/google-analytics-opt-out
5
  Description: Provides an Opt-Out functionality for Google Analytics
6
+ Version: 2.1.0
7
  Author: WP-Buddy
8
  Author URI: https://wp-buddy.com
9
  License: GPL2
10
  Text Domain: google-analytics-opt-out
11
  Domain Path: /languages/
12
 
13
+ Copyright 2017 WP-Buddy (email : info@wp-buddy.com)
14
 
15
  This program is free software; you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License, version 2, as
40
 
41
  define( 'GAOOP_FILE', __FILE__ );
42
  define( 'GAOOP_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
43
+ define( 'GAOOP_URL', trailingslashit( plugins_url( '', __FILE__ ) ) );
44
 
45
  if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
46
  wp_die( sprintf( __( 'You are using PHP in version %s. This version is outdated and cannot be used with the Google Analytics Opt-Out plugin. Please update to the latest PHP version in order to use this plugin. You can ask your provider on how to do this.', 'google-analytics-opt-out' ), PHP_VERSION ) );
inc/admin.php CHANGED
@@ -65,6 +65,12 @@ add_action( 'init', 'gaoop_editor_button' );
65
  */
66
  function gaoop_add_mce_plugin( $plugin_array ) {
67
 
 
 
 
 
 
 
68
  $plugin_array['wpb_analytics_opt_out'] = GAOOP_URL . 'js/editor-button.js';
69
 
70
  return $plugin_array;
65
  */
66
  function gaoop_add_mce_plugin( $plugin_array ) {
67
 
68
+ $editor_button_active = (bool) get_option( 'gaoop_editor_button', false );
69
+
70
+ if ( ! $editor_button_active ) {
71
+ return $plugin_array;
72
+ }
73
+
74
  $plugin_array['wpb_analytics_opt_out'] = GAOOP_URL . 'js/editor-button.js';
75
 
76
  return $plugin_array;
inc/settings.php CHANGED
@@ -71,6 +71,9 @@ function gaoop_register_theme_options_section() {
71
  add_settings_field( 'gaoop_property', __( 'UA-Code', 'google-analytics-opt-out' ), 'gaoop_options_property', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_property' ) );
72
  register_setting( 'gaoop_options_page', 'gaoop_property', 'sanitize_text_field' );
73
 
 
 
 
74
  add_settings_field( 'gaoop_banner', __( 'Use Banner', 'google-analytics-opt-out' ), 'gaoop_options_banner', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_banner' ) );
75
  register_setting( 'gaoop_options_page', 'gaoop_banner', 'intval' );
76
 
@@ -136,7 +139,7 @@ function gaoop_options_yoast() {
136
  function gaoop_options_property() {
137
 
138
  $monster_insights_active = gaoop_monster_insights_plugin_active();
139
- $option = get_option( 'gaoop_yoast', null );
140
 
141
  if ( $monster_insights_active && 1 == $option ) {
142
  $value = gaoop_get_monster_insights_ua();
@@ -163,6 +166,20 @@ function gaoop_options_banner() {
163
  }
164
 
165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  /**
167
  * Settings field for the UA property
168
  *
71
  add_settings_field( 'gaoop_property', __( 'UA-Code', 'google-analytics-opt-out' ), 'gaoop_options_property', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_property' ) );
72
  register_setting( 'gaoop_options_page', 'gaoop_property', 'sanitize_text_field' );
73
 
74
+ add_settings_field( 'gaoop_editor_button', __( 'Show Editor button', 'google-analytics-opt-out' ), 'gaoop_options_editor_button', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_editor_button' ) );
75
+ register_setting( 'gaoop_options_page', 'gaoop_editor_button', 'intval' );
76
+
77
  add_settings_field( 'gaoop_banner', __( 'Use Banner', 'google-analytics-opt-out' ), 'gaoop_options_banner', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_banner' ) );
78
  register_setting( 'gaoop_options_page', 'gaoop_banner', 'intval' );
79
 
139
  function gaoop_options_property() {
140
 
141
  $monster_insights_active = gaoop_monster_insights_plugin_active();
142
+ $option = get_option( 'gaoop_yoast', null );
143
 
144
  if ( $monster_insights_active && 1 == $option ) {
145
  $value = gaoop_get_monster_insights_ua();
166
  }
167
 
168
 
169
+ /**
170
+ * Settings field for the banner checkbox
171
+ *
172
+ * @since 2.1.0
173
+ * @return void
174
+ */
175
+ function gaoop_options_editor_button() {
176
+
177
+ $editor_button_active = (bool) get_option( 'gaoop_editor_button', false );
178
+
179
+ echo '<input ' . checked( $editor_button_active, true, false ) . ' id="gaoop_options_editor_banner" type="checkbox" name="gaoop_editor_button" value="1" />';
180
+ }
181
+
182
+
183
  /**
184
  * Settings field for the UA property
185
  *
js/frontend.js CHANGED
@@ -9,7 +9,6 @@
9
  /**
10
  * Check if opt-out cookie has NOT been set already
11
  */
12
- console.log(document.cookie);
13
  if ( document.cookie.indexOf( 'ga-disable-' + ua_code + '=true' ) <= -1 && jQuery.isFunction( window.gaoop_analytics_optout ) ) {
14
  /** Check if hide-info cookie was checked **/
15
  if ( document.cookie.indexOf( 'gaoop_hide_info=true' ) > -1 ) {
9
  /**
10
  * Check if opt-out cookie has NOT been set already
11
  */
 
12
  if ( document.cookie.indexOf( 'ga-disable-' + ua_code + '=true' ) <= -1 && jQuery.isFunction( window.gaoop_analytics_optout ) ) {
13
  /** Check if hide-info cookie was checked **/
14
  if ( document.cookie.indexOf( 'gaoop_hide_info=true' ) > -1 ) {
js/settings.js CHANGED
@@ -1,42 +1,45 @@
1
- (function ( $ ) {
2
- "use strict";
3
- jQuery( document ).ready( function () {
4
-
5
- var $yoast = jQuery( '#gaoop_options_yoast' ),
6
- $banner = jQuery( '#gaoop_options_banner' );
7
-
8
- jQuery( '#gaoop_options_property' ).focus();
9
-
10
- if ( $yoast.is( ':checked' ) ) {
11
- jQuery( '.form-table tr:eq(1)' ).hide();
12
- } else {
13
- jQuery( '.form-table tr:eq(1)' ).show();
14
- }
15
-
16
- $yoast.click( function () {
17
- if ( jQuery( this ).is( ':checked' ) ) {
18
- jQuery( '.form-table tr:eq(1)' ).hide();
19
- } else {
20
- jQuery( '.form-table tr:eq(1)' ).show();
21
- jQuery( '#gaoop_options_property' ).focus();
22
- }
23
- } );
24
-
25
- function show_hide_banner_fields() {
26
- var use_banner = $banner.is( ':checked' );
27
-
28
- if ( use_banner ) {
29
- jQuery( '.form-table tr:gt(2)' ).show();
30
- } else {
31
- jQuery( '.form-table tr:gt(2)' ).hide();
32
- }
33
- }
34
-
35
- show_hide_banner_fields();
36
-
37
- $banner.click( function () {
38
- show_hide_banner_fields();
39
- } );
40
-
41
- } );
 
 
 
42
  })( jQuery );
1
+ (function () {
2
+ "use strict";
3
+ jQuery( document ).ready( function () {
4
+
5
+ var $yoast = jQuery( '#gaoop_options_yoast' ),
6
+ $banner = jQuery( '#gaoop_options_banner' );
7
+
8
+ jQuery( '#gaoop_options_property' ).focus();
9
+
10
+ if ( $yoast.is( ':checked' ) ) {
11
+ jQuery( '.form-table tr:eq(1)' ).hide();
12
+ } else {
13
+ jQuery( '.form-table tr:eq(1)' ).show();
14
+ }
15
+
16
+ $yoast.click( function () {
17
+ if ( jQuery( this ).is( ':checked' ) ) {
18
+ jQuery( '.form-table tr:eq(1)' ).hide();
19
+ } else {
20
+ jQuery( '.form-table tr:eq(1)' ).show();
21
+ jQuery( '#gaoop_options_property' ).focus();
22
+ }
23
+ } );
24
+
25
+ function show_hide_banner_fields() {
26
+ var use_banner = $banner.is( ':checked' );
27
+
28
+ var $tr = $banner.closest( 'tr' );
29
+ var $trs = $tr.nextAll();
30
+
31
+ if ( use_banner ) {
32
+ $trs.show();
33
+ } else {
34
+ $trs.hide();
35
+ }
36
+ }
37
+
38
+ show_hide_banner_fields();
39
+
40
+ $banner.click( function () {
41
+ show_hide_banner_fields();
42
+ } );
43
+
44
+ } );
45
  })( jQuery );
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: wp-buddy, floriansimeth
3
  Donate link: https://wp-buddy.com/products/plugins/google-analytics-opt-out/
4
  Tags: google analytics, analytics, analytics opt-out, analytics opt out, monster insights, monster insight, yoast analytics
5
- Version: 2.0.2
6
  Requires at least: 3.7
7
- Stable tag: 2.0.2
8
  Requires PHP: 5.6.0
9
  Tested up to: 4.9
10
  License: GPLv2
2
  Contributors: wp-buddy, floriansimeth
3
  Donate link: https://wp-buddy.com/products/plugins/google-analytics-opt-out/
4
  Tags: google analytics, analytics, analytics opt-out, analytics opt out, monster insights, monster insight, yoast analytics
5
+ Version: 2.1.0
6
  Requires at least: 3.7
7
+ Stable tag: 2.1.0
8
  Requires PHP: 5.6.0
9
  Tested up to: 4.9
10
  License: GPLv2