Version Description
- The pro version is now free (this is it!)
- New: allow the complete deactivation of the banner.
Download this release
Release Info
Developer | wp-buddy |
Plugin | Google Analytics Opt-Out |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 0.1.5 to 2.0.0
- classes/admin.php +0 -86
- classes/functions.php +0 -66
- classes/scripts.php +0 -60
- classes/settings.php +0 -117
- classes/shortcodes.php +0 -68
- google-analytics-opt-out.php +36 -18
- images/close-icon.png +0 -0
- images/info-icon.png +0 -0
- inc/admin.php +101 -0
- inc/frontend.php +171 -0
- inc/functions.php +99 -0
- inc/scripts.php +79 -0
- inc/settings.php +224 -0
- inc/shortcodes.php +88 -0
- js/editor-button.js +54 -54
- js/frontend.js +104 -0
- js/settings.js +42 -23
- languages/gaoo-de_DE.mo +0 -0
- languages/gaoo-de_DE.po +0 -102
- languages/gaoo-es_ES.mo +0 -0
- languages/gaoo-es_ES.po +0 -101
- languages/gaoo.mo +0 -0
- languages/gaoo.po +0 -87
- languages/gaoo.pot +152 -0
- readme.txt +12 -29
- uninstall.php +18 -0
classes/admin.php
DELETED
@@ -1,86 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
function gaoo_admin_notice() {
|
4 |
-
$code = gaoo_get_ua_code();
|
5 |
-
if ( ! empty( $code ) ) {
|
6 |
-
return;
|
7 |
-
}
|
8 |
-
|
9 |
-
$link = admin_url( 'options-general.php?page=gaoo-options' );
|
10 |
-
$message = __( 'To use the Google Analytics Opt-Out Plugin please enter an UA-Code on the settings page.', 'gaoo' );
|
11 |
-
|
12 |
-
if ( gaoo_yoast_plugin_active() ) {
|
13 |
-
$link = admin_url( 'options-general.php?page=google-analytics-for-wordpress' );
|
14 |
-
$message = __( 'To use the Google Analytics Opt-Out Plugin please enter an UA-Code on the settings page of "Google Analytics for WordPress" configuration page.', 'gaoo' );
|
15 |
-
}
|
16 |
-
?>
|
17 |
-
<div class="error">
|
18 |
-
<p>
|
19 |
-
<a href="<?php echo $link; ?>"><?php echo $message; ?></a>
|
20 |
-
</p>
|
21 |
-
</div>
|
22 |
-
<?php
|
23 |
-
}
|
24 |
-
|
25 |
-
add_action( 'admin_notices', 'gaoo_admin_notice' );
|
26 |
-
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Adds some action links to the plugin on the list of plugins page
|
30 |
-
*
|
31 |
-
* @param array $links
|
32 |
-
*
|
33 |
-
* @since 0.1
|
34 |
-
*
|
35 |
-
* @return array
|
36 |
-
*/
|
37 |
-
function gaoo_plugin_action_links( $links ) {
|
38 |
-
$links[] = '<a href="' . admin_url( 'options-general.php?page=gaoo-options' ) . '">' . __( 'Settings', 'gaoo' ) . '</a>';
|
39 |
-
$links[] = '<a target="_blank" href="http://wp-buddy.com">' . __( 'More by WP-Buddy', 'gaoo' ) . '</a>';
|
40 |
-
return $links;
|
41 |
-
}
|
42 |
-
|
43 |
-
add_filter( 'plugin_action_links_' . plugin_basename( GAOO_FILE ), 'gaoo_plugin_action_links' );
|
44 |
-
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Adds the editor button functions
|
48 |
-
* @since 0.1
|
49 |
-
* @return void
|
50 |
-
*/
|
51 |
-
function gaoo_editor_button() {
|
52 |
-
if ( get_user_option( 'rich_editing' ) == true ) {
|
53 |
-
add_filter( "mce_external_plugins", 'gaoo_add_mce_plugin' );
|
54 |
-
add_filter( 'mce_buttons', 'gaoo_register_mce_buttons' );
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
add_action( 'init', 'gaoo_editor_button' );
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Adds the plugin to tinymce
|
62 |
-
*
|
63 |
-
* @param array $plugin_array
|
64 |
-
*
|
65 |
-
* @since 0.1
|
66 |
-
*
|
67 |
-
* @return array
|
68 |
-
*/
|
69 |
-
function gaoo_add_mce_plugin( $plugin_array ) {
|
70 |
-
$plugin_array['wpb_analytics_opt_out'] = GAOO_URL . 'js/editor-button.js';
|
71 |
-
return $plugin_array;
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Adds the button
|
76 |
-
*
|
77 |
-
* @param array $buttons
|
78 |
-
*
|
79 |
-
* @since 0.1
|
80 |
-
*
|
81 |
-
* @return array
|
82 |
-
*/
|
83 |
-
function gaoo_register_mce_buttons( $buttons ) {
|
84 |
-
array_push( $buttons, "wpb_analytics_opt_out" );
|
85 |
-
return $buttons;
|
86 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/functions.php
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Checks if the Yoast Analytics Plugin is active
|
5 |
-
* @since 0.1
|
6 |
-
* @return bool
|
7 |
-
*/
|
8 |
-
function gaoo_yoast_plugin_active() {
|
9 |
-
return defined( 'GAWP_VERSION' );
|
10 |
-
}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Return the UA from Yoast settings, if Yoast Analytics plugin is installed
|
14 |
-
* If Yoast Analytics is not installed this will return an empty string
|
15 |
-
*
|
16 |
-
* @since 0.1
|
17 |
-
* @return string
|
18 |
-
*/
|
19 |
-
function gaoo_get_yoast_ua() {
|
20 |
-
|
21 |
-
if ( ! gaoo_yoast_plugin_active() ) {
|
22 |
-
return '';
|
23 |
-
}
|
24 |
-
|
25 |
-
$ua_code = '';
|
26 |
-
|
27 |
-
if ( is_admin() ) {
|
28 |
-
/**
|
29 |
-
* @var Yoast_GA_Admin $yoast_ga_admin
|
30 |
-
*/
|
31 |
-
global $yoast_ga_admin;
|
32 |
-
|
33 |
-
if ( isset( $yoast_ga_admin ) && method_exists( $yoast_ga_admin, 'get_tracking_code' ) ) {
|
34 |
-
$ua_code = $yoast_ga_admin->get_tracking_code();
|
35 |
-
}
|
36 |
-
|
37 |
-
} else {
|
38 |
-
|
39 |
-
if ( class_exists( 'Yoast_GA_Options' ) ) {
|
40 |
-
$yoast_ga_options = Yoast_GA_Options::instance();
|
41 |
-
|
42 |
-
if ( method_exists( $yoast_ga_options, 'get_tracking_code' ) ) {
|
43 |
-
$ua_code = $yoast_ga_options->get_tracking_code();
|
44 |
-
}
|
45 |
-
}
|
46 |
-
|
47 |
-
}
|
48 |
-
|
49 |
-
return $ua_code;
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Returns the UA-Code
|
54 |
-
* @since 0.1
|
55 |
-
* @return string
|
56 |
-
*/
|
57 |
-
function gaoo_get_ua_code() {
|
58 |
-
|
59 |
-
if ( gaoo_yoast_plugin_active() && (bool) get_option( 'gaoo_yoast', 0 ) ) {
|
60 |
-
return apply_filters( 'gaoo_get_ua_code', gaoo_get_yoast_ua() );
|
61 |
-
}
|
62 |
-
|
63 |
-
// if yoast returns an empty string OR if the checkbox was set to 0 return the textbox content
|
64 |
-
return apply_filters( 'gaoo_get_ua_code', esc_attr( get_option( 'gaoo_property', '' ) ) );
|
65 |
-
|
66 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/scripts.php
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Echos out the JavaScript for the opt-out
|
4 |
-
* @since 0.1
|
5 |
-
* @return void
|
6 |
-
*/
|
7 |
-
function gaoo_head_script() {
|
8 |
-
|
9 |
-
if ( apply_filters( 'gaoo_stop_head', false ) ) {
|
10 |
-
return;
|
11 |
-
}
|
12 |
-
|
13 |
-
gaoo_js();
|
14 |
-
}
|
15 |
-
|
16 |
-
// To call it before the Yoast Analytics Plugin (2) this has a priority of 1
|
17 |
-
add_action( 'wp_head', 'gaoo_head_script', 1 );
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Echos out the Javascript or returns it (if $echo is set to TRUE)
|
21 |
-
*
|
22 |
-
* @since 0.1
|
23 |
-
*
|
24 |
-
* @param bool $echo
|
25 |
-
*
|
26 |
-
* @return void|string
|
27 |
-
*/
|
28 |
-
function gaoo_js( $echo = true ) {
|
29 |
-
$ua_code = gaoo_get_ua_code();
|
30 |
-
if ( empty( $ua_code ) ) {
|
31 |
-
return '';
|
32 |
-
}
|
33 |
-
ob_start();
|
34 |
-
?>
|
35 |
-
<script type="text/javascript">
|
36 |
-
/* <![CDATA[ */
|
37 |
-
/* Google Analytics Opt-Out WordPress by WP-Buddy | http://wp-buddy.com/products/plugins/google-analytics-opt-out */
|
38 |
-
<?php do_action('gaoo_js_before_script'); ?>
|
39 |
-
var gaoo_property = '<?php echo $ua_code; ?>';
|
40 |
-
var gaoo_disable_str = 'ga-disable-' + gaoo_property;
|
41 |
-
if (document.cookie.indexOf(gaoo_disable_str + '=true') > -1) {
|
42 |
-
window[gaoo_disable_str] = true;
|
43 |
-
}
|
44 |
-
function gaoo_analytics_optout() {
|
45 |
-
document.cookie = gaoo_disable_str + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
|
46 |
-
window[gaoo_disable_str] = true;
|
47 |
-
<?php echo apply_filters( 'gaoo_', "alert('" . __( 'Thanks. We have set a cookie so that Google Analytics data collection will be disabled on your next visit.', 'gaoo' ) . "');" ); ?>
|
48 |
-
}
|
49 |
-
<?php do_action('gaoo_js_after_script'); ?>
|
50 |
-
/* ]]> */
|
51 |
-
</script>
|
52 |
-
<?php
|
53 |
-
$content = ob_get_clean();
|
54 |
-
if ( $echo ) {
|
55 |
-
echo $content;
|
56 |
-
}
|
57 |
-
else {
|
58 |
-
return $content;
|
59 |
-
}
|
60 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/settings.php
DELETED
@@ -1,117 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Creating the menu item
|
5 |
-
* @since 0.1
|
6 |
-
* @return void
|
7 |
-
*/
|
8 |
-
function gaoo_admin_menu() {
|
9 |
-
$hook = add_submenu_page( 'options-general.php', __( 'Analytics Opt-Out', 'gaoo' ), __( 'Analytics Opt-Out', 'gaoo' ), 'manage_options', 'gaoo-options', 'gaoo_settings_page' );
|
10 |
-
add_action( "load-$hook", 'gaoo_settings_scripts' );
|
11 |
-
}
|
12 |
-
|
13 |
-
add_action( 'admin_menu', 'gaoo_admin_menu' );
|
14 |
-
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Creating the settings page HTML output
|
18 |
-
* @since 0.1
|
19 |
-
* @return void
|
20 |
-
*/
|
21 |
-
function gaoo_settings_page() {
|
22 |
-
?>
|
23 |
-
<div class="wrap">
|
24 |
-
<div id="icon-options-general" class="icon32"></div>
|
25 |
-
<h2><?php _e( 'Google Analaytics Opt-Out', 'gaoo' ); ?> </h2>
|
26 |
-
|
27 |
-
<form action="options.php" method="post">
|
28 |
-
<?php
|
29 |
-
settings_fields( 'gaoo_options_page' );
|
30 |
-
do_settings_sections( 'gaoo_options_page' );
|
31 |
-
submit_button();
|
32 |
-
?>
|
33 |
-
</form>
|
34 |
-
</div>
|
35 |
-
<?php
|
36 |
-
}
|
37 |
-
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Enqueues the settings page scripts and styles
|
41 |
-
* @since 0.1
|
42 |
-
* @return void
|
43 |
-
*/
|
44 |
-
function gaoo_settings_scripts() {
|
45 |
-
wp_enqueue_script( 'equipment', GAOO_URL . '/js/settings.js', array( 'jquery' ), false, true );
|
46 |
-
}
|
47 |
-
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Registers Settings sections and fields
|
51 |
-
* @since 0.1
|
52 |
-
* @return void
|
53 |
-
*/
|
54 |
-
function gaoo_register_theme_options_section() {
|
55 |
-
|
56 |
-
add_settings_section( 'gaoo_settings_section', __( 'Analytics Opt-Out', 'gaoo' ), null, 'gaoo_options_page' );
|
57 |
-
|
58 |
-
add_settings_field( 'gaoo_yoast', __( 'Use Yoast Analytics Settings', 'gaoo' ), 'gaoo_options_yoast', 'gaoo_options_page', 'gaoo_settings_section', array( 'label_for' => 'gaoo_options_yoast' ) );
|
59 |
-
register_setting( 'gaoo_options_page', 'gaoo_yoast' );
|
60 |
-
|
61 |
-
add_settings_field( 'gaoo_property', __( 'UA-Code', 'gaoo' ), 'gaoo_options_property', 'gaoo_options_page', 'gaoo_settings_section', array( 'label_for' => 'gaoo_options_property' ) );
|
62 |
-
register_setting( 'gaoo_options_page', 'gaoo_property', 'sanitize_text_field' );
|
63 |
-
}
|
64 |
-
|
65 |
-
add_action( 'admin_init', 'gaoo_register_theme_options_section' );
|
66 |
-
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Settings field for the Yoast Checkbox
|
70 |
-
* @since 0.1
|
71 |
-
* @return void
|
72 |
-
*/
|
73 |
-
function gaoo_options_yoast() {
|
74 |
-
|
75 |
-
$yoast_active = gaoo_yoast_plugin_active();
|
76 |
-
|
77 |
-
$option = get_option( 'gaoo_yoast', null );
|
78 |
-
|
79 |
-
// if the plugin is used the first time it has the value of NULL. In this case we set the option to 1
|
80 |
-
if ( is_null( $option ) ) {
|
81 |
-
$option = 1;
|
82 |
-
}
|
83 |
-
|
84 |
-
if ( ! $yoast_active ) {
|
85 |
-
$option = 0;
|
86 |
-
}
|
87 |
-
|
88 |
-
echo '<input ' . disabled( ! $yoast_active, true, false ) . ' ' . checked( $option, 1, false ) . ' id="gaoo_options_yoast" type="checkbox" name="gaoo_yoast" value="1" />';
|
89 |
-
echo '<p class="description">';
|
90 |
-
if ( $yoast_active ) {
|
91 |
-
echo '<span style="color: #5EB95E;">' . __( 'Yoast Analytics Plugin has been detected.', 'gaoo' ) . '</span>';
|
92 |
-
}
|
93 |
-
else {
|
94 |
-
echo '<span style="color: #DD514C;">' . __( 'Yoast Analytics Plugin has NOT been detected. Please enter your UA code manually and then check the sourcode of your website. Make sure that Analytics code appears AFTER the opt-out code (which starts with <code>/* Google Analytics Opt-Out</code>).', 'gaoo' ) . '</span>';
|
95 |
-
}
|
96 |
-
echo '</p>';
|
97 |
-
}
|
98 |
-
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Settings field for the UA property
|
102 |
-
* @since 0.1
|
103 |
-
* @return void
|
104 |
-
*/
|
105 |
-
function gaoo_options_property() {
|
106 |
-
$yoast_active = gaoo_yoast_plugin_active();
|
107 |
-
|
108 |
-
if ( $yoast_active && (bool) get_option( 'gaoo_yoast', null ) ) {
|
109 |
-
$value = gaoo_get_yoast_ua();
|
110 |
-
}
|
111 |
-
else {
|
112 |
-
$value = sanitize_text_field( get_option( 'gaoo_property', '' ) );
|
113 |
-
}
|
114 |
-
|
115 |
-
echo '<input id="gaoo_options_property" placeholder="UA-XXXXXX-X" type="text" class="regular-text" value="' . $value . '" name="gaoo_property" /> ';
|
116 |
-
|
117 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/shortcodes.php
DELETED
@@ -1,68 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Exit if accessed directly
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
exit;
|
5 |
-
}
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Checks if a shortcode is used in a string
|
9 |
-
*
|
10 |
-
* @param string $shortcode
|
11 |
-
* @param string $content
|
12 |
-
*
|
13 |
-
* @return bool
|
14 |
-
*/
|
15 |
-
function gaoo_has_shortcode( $shortcode, $content = '' ) {
|
16 |
-
if ( stripos( $content, '[' . $shortcode ) !== false ) {
|
17 |
-
return true;
|
18 |
-
}
|
19 |
-
return false;
|
20 |
-
}
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Adds the shortcodes
|
24 |
-
*
|
25 |
-
* @since 0.1
|
26 |
-
* @return void
|
27 |
-
*/
|
28 |
-
function gaoo_init_shortcodes() {
|
29 |
-
add_shortcode( 'google_analytics_optout', 'gaoo_shortcode' );
|
30 |
-
}
|
31 |
-
|
32 |
-
add_action( 'init', 'gaoo_init_shortcodes' );
|
33 |
-
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Creating the shortcode content
|
37 |
-
*
|
38 |
-
* @param array $atts
|
39 |
-
* @param string $content
|
40 |
-
* @param string $shortcode_name
|
41 |
-
*
|
42 |
-
* @since 0.1
|
43 |
-
*
|
44 |
-
* @return string
|
45 |
-
*/
|
46 |
-
function gaoo_shortcode( $atts, $content = '', $shortcode_name ) {
|
47 |
-
//$atts = shortcode_atts( array(), $atts, $shortcode_name );
|
48 |
-
|
49 |
-
$ua_code = gaoo_get_ua_code();
|
50 |
-
|
51 |
-
if ( empty( $ua_code ) ) {
|
52 |
-
$message = __( 'No UA-Code has been entered. Please ask the admin to solve this issue!', 'gaoo' );
|
53 |
-
return '<span style="cursor: help; border: 0 none; border-bottom-width: 1px; border-style: dashed;" title="' . $message . '">' . $message . '</span>';
|
54 |
-
}
|
55 |
-
|
56 |
-
if ( empty( $content ) ) {
|
57 |
-
$content = __( 'Click here to opt out.', 'gaoo' );
|
58 |
-
}
|
59 |
-
|
60 |
-
return '<a class="gaoo-opt-out google-analytics-opt-out" href="javascript:gaoo_analytics_optout();">' . do_shortcode( $content ) . '</a>';
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Doing shortcodes in the text widget, too
|
65 |
-
*/
|
66 |
-
if ( false !== has_filter( 'widget_text', 'do_shortcode' ) ) {
|
67 |
-
add_filter( 'widget_text', 'do_shortcode' );
|
68 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
google-analytics-opt-out.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Google Analytics Opt-Out
|
4 |
-
Plugin URI:
|
5 |
Description: Provides an Opt-Out functionality for Google Analytics
|
6 |
-
Version: 0.
|
7 |
Author: WP-Buddy
|
8 |
-
Author URI:
|
9 |
License: GPL2
|
10 |
Text Domain: gaoo
|
11 |
Domain Path: /languages/
|
12 |
|
13 |
-
Copyright
|
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
|
@@ -26,27 +26,45 @@ along with this program; if not, write to the Free Software
|
|
26 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
|
|
29 |
// Exit if accessed directly
|
30 |
if ( ! defined( 'ABSPATH' ) ) {
|
31 |
exit;
|
32 |
}
|
33 |
|
34 |
-
//
|
35 |
-
__( 'Google Analytics Opt-Out', '
|
36 |
-
__( 'Provides an Opt-Out functionality for Google Analytics', '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
}
|
46 |
|
47 |
-
|
48 |
-
require_once GAOO_PATH . 'classes/admin.php';
|
49 |
-
require_once GAOO_PATH . 'classes/shortcodes.php';
|
50 |
-
require_once GAOO_PATH . 'classes/scripts.php';
|
51 |
-
require_once GAOO_PATH . 'classes/settings.php';
|
52 |
|
1 |
<?php
|
2 |
/*
|
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.0
|
7 |
Author: WP-Buddy
|
8 |
+
Author URI: https://wp-buddy.com
|
9 |
License: GPL2
|
10 |
Text Domain: gaoo
|
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
|
26 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
29 |
+
|
30 |
// Exit if accessed directly
|
31 |
if ( ! defined( 'ABSPATH' ) ) {
|
32 |
exit;
|
33 |
}
|
34 |
|
35 |
+
// For translation purposes
|
36 |
+
__( 'Google Analytics Opt-Out Pro', 'gaoop' );
|
37 |
+
__( 'Provides an Opt-Out functionality for Google Analytics', 'gaoop' );
|
38 |
+
|
39 |
+
define( 'GAOOP_FILE', __FILE__ );
|
40 |
+
define( 'GAOOP_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
|
41 |
+
define( 'GAOOP_URL', trailingslashit( plugins_url() ) . trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) );
|
42 |
+
|
43 |
+
add_action( 'init', function () {
|
44 |
+
load_plugin_textdomain( 'gaoop', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
|
45 |
+
} );
|
46 |
+
|
47 |
+
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
|
48 |
+
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.', 'gaoop' ), PHP_VERSION ) );
|
49 |
+
}
|
50 |
+
|
51 |
+
require_once GAOOP_PATH . 'inc/functions.php';
|
52 |
+
require_once GAOOP_PATH . 'inc/admin.php';
|
53 |
+
require_once GAOOP_PATH . 'inc/shortcodes.php';
|
54 |
+
require_once GAOOP_PATH . 'inc/scripts.php';
|
55 |
+
require_once GAOOP_PATH . 'inc/settings.php';
|
56 |
+
require_once GAOOP_PATH . 'inc/frontend.php';
|
57 |
+
|
58 |
|
59 |
+
function gaoop_activation() {
|
60 |
+
if ( ! function_exists( 'is_plugin_active' ) ) {
|
61 |
+
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
62 |
+
}
|
63 |
|
64 |
+
if ( is_plugin_active( 'google-analytics-opt-out/google-analytics-opt-out.php' ) ) {
|
65 |
+
wp_die( __( 'It seems that the free version of the Google Analytics Opt-Out is installed. Please deactivate the free version before activating the pro version. Thanks! ', 'gaoop' ) . '<br /><br /><a href="' . admin_url( 'plugins.php' ) . '">' . __( '← Go back', 'gaoop' ) . '</a>' );
|
66 |
+
}
|
67 |
}
|
68 |
|
69 |
+
register_activation_hook( GAOOP_FILE, 'gaoop_activation' );
|
|
|
|
|
|
|
|
|
70 |
|
images/close-icon.png
ADDED
Binary file
|
images/info-icon.png
ADDED
Binary file
|
inc/admin.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function gaoop_admin_notice() {
|
4 |
+
$code = gaoop_get_ua_code();
|
5 |
+
if ( ! empty( $code ) ) {
|
6 |
+
return;
|
7 |
+
}
|
8 |
+
?>
|
9 |
+
<div class="error">
|
10 |
+
<p>
|
11 |
+
<a href="<?php echo admin_url( 'options-general.php?page=gaoo-options' ); ?>"><?php _e( 'To use the Google Analytics Opt-Out Plugin please enter an UA-Code on the settings page.', 'gaoop' ); ?></a>
|
12 |
+
</p>
|
13 |
+
</div>
|
14 |
+
<?php
|
15 |
+
}
|
16 |
+
|
17 |
+
add_action( 'admin_notices', 'gaoop_admin_notice' );
|
18 |
+
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Adds some action links to the plugin on the list of plugins page
|
22 |
+
*
|
23 |
+
* @param array $links
|
24 |
+
*
|
25 |
+
* @since 1.0
|
26 |
+
*
|
27 |
+
* @return array
|
28 |
+
*/
|
29 |
+
function gaoop_plugin_action_links( $links ) {
|
30 |
+
$links[] = '<a href="' . admin_url( 'options-general.php?page=gaoo-options' ) . '">' . __( 'Settings', 'gaoop' ) . '</a>';
|
31 |
+
$links[] = '<a target="_blank" href="http://wp-buddy.com">' . __( 'More by WP-Buddy', 'gaoop' ) . '</a>';
|
32 |
+
|
33 |
+
return $links;
|
34 |
+
}
|
35 |
+
|
36 |
+
add_filter( 'plugin_action_links_' . plugin_basename( GAOOP_FILE ), 'gaoop_plugin_action_links' );
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Adds the editor button functions
|
41 |
+
*
|
42 |
+
* @since 1.0
|
43 |
+
* @return void
|
44 |
+
*/
|
45 |
+
function gaoop_editor_button() {
|
46 |
+
if ( get_user_option( 'rich_editing' ) == true ) {
|
47 |
+
add_filter( "mce_external_plugins", 'gaoop_add_mce_plugin' );
|
48 |
+
add_filter( 'mce_buttons', 'gaoop_register_mce_buttons' );
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
add_action( 'init', 'gaoop_editor_button' );
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Adds the plugin to tinymce
|
56 |
+
*
|
57 |
+
* @param array $plugin_array
|
58 |
+
*
|
59 |
+
* @since 1.0
|
60 |
+
*
|
61 |
+
* @return array
|
62 |
+
*/
|
63 |
+
function gaoop_add_mce_plugin( $plugin_array ) {
|
64 |
+
$plugin_array['wpb_analytics_opt_out'] = GAOOP_URL . 'js/editor-button.js';
|
65 |
+
|
66 |
+
return $plugin_array;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Adds the button
|
71 |
+
*
|
72 |
+
* @param array $buttons
|
73 |
+
*
|
74 |
+
* @since 1.0
|
75 |
+
*
|
76 |
+
* @return array
|
77 |
+
*/
|
78 |
+
function gaoop_register_mce_buttons( $buttons ) {
|
79 |
+
array_push( $buttons, "wpb_analytics_opt_out" );
|
80 |
+
|
81 |
+
return $buttons;
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Import settings from old version
|
87 |
+
*
|
88 |
+
* @since 2.0.0
|
89 |
+
*/
|
90 |
+
function gaoop_import_from_old_version() {
|
91 |
+
$ua_code = get_option( 'gaoo_property', '' );
|
92 |
+
if ( ! empty( $ua_code ) ) {
|
93 |
+
update_option( 'gaoop_property', $ua_code );
|
94 |
+
delete_option( 'gaoo_property' );
|
95 |
+
|
96 |
+
update_option( 'gaoop_yoast', (bool) get_option( 'gaoo_yoast', false ) );
|
97 |
+
delete_option( 'gaoo_yoast' );
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
add_action('admin_init', 'gaoop_import_from_old_version');
|
inc/frontend.php
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Adds a hidden div to the footer
|
5 |
+
*
|
6 |
+
* @since 1.0
|
7 |
+
* @return void
|
8 |
+
*/
|
9 |
+
function gaoop_footer() {
|
10 |
+
if ( ! get_option( 'gaoop_banner', false ) ) {
|
11 |
+
return;
|
12 |
+
}
|
13 |
+
|
14 |
+
$opt_out_text = apply_filters( 'gaoop_optout_text', '' );
|
15 |
+
if ( empty( $opt_out_text ) ) {
|
16 |
+
return;
|
17 |
+
}
|
18 |
+
echo '<div style="display: none;" data-gaoop_ua="' . gaoop_get_ua_code() . '" data-gaoop_hide="' . intval( get_option( 'gaoop_hide', 0 ) ) . '" class="gaoop">'
|
19 |
+
. '<a class="gaoop-info-icon" href="#" title="' . __( 'Google Analytics Opt-Out Information', 'gaoop' ) . '" ><img src="' . apply_filters( 'gaoop_info_icon', GAOOP_URL . 'images/info-icon.png' ) . '" alt="' . __( 'Close', 'gaoop' ) . '" /></a>'
|
20 |
+
. '<div class="gaoop-opt-out-content">' . $opt_out_text . '</div>'
|
21 |
+
. '<a class="gaoop-close-icon" href="#" title="' . __( 'Close this and do not ask me again', 'gaoop' ) . '"><img src="' . apply_filters( 'gaoop_close_icon', GAOOP_URL . 'images/close-icon.png' ) . '" alt="' . __( 'Close this and do not ask me again', 'gaoop' ) . '" /></a>'
|
22 |
+
. '</div>';
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
add_action( 'wp_footer', 'gaoop_footer' );
|
27 |
+
|
28 |
+
|
29 |
+
/**
|
30 |
+
* The opt-out text on the DIV on the footer
|
31 |
+
*
|
32 |
+
* @since 1.0
|
33 |
+
*/
|
34 |
+
function gaoop_optout_text() {
|
35 |
+
$opt_out_text = get_option( 'gaoop_opt_out_text', '' );
|
36 |
+
if ( empty( $opt_out_text ) ) {
|
37 |
+
$opt_out_text = __( 'This website is using Google Analytics. Please click here if you want to opt-out.', 'gaoop' );
|
38 |
+
}
|
39 |
+
|
40 |
+
if ( ! has_shortcode( $opt_out_text, 'google_analytics_optout' ) && (bool) get_option( 'gaoop_opt_out_shortcode_integration', 1 ) ) {
|
41 |
+
$opt_out_text .= sprintf( ' [google_analytics_optout]%s[/google_analytics_optout]', __( 'Click here to opt-out.', 'gaoop' ) );
|
42 |
+
}
|
43 |
+
|
44 |
+
return $opt_out_text;
|
45 |
+
}
|
46 |
+
|
47 |
+
add_filter( 'gaoop_optout_text', 'gaoop_optout_text', 5 );
|
48 |
+
|
49 |
+
add_filter( 'gaoop_optout_text', 'do_shortcode', 15 );
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Adds the custom styles to the header
|
53 |
+
*
|
54 |
+
* @since 1.0
|
55 |
+
* @return void
|
56 |
+
*/
|
57 |
+
function gaoop_wp_head() {
|
58 |
+
|
59 |
+
$box_shadow = '0 4px 15px rgba(0, 0, 0, 0.4)';
|
60 |
+
|
61 |
+
$standard_css_array = array(
|
62 |
+
'.gaoop' => array(
|
63 |
+
'color' => '#ffffff',
|
64 |
+
'line-height' => '2',
|
65 |
+
'position' => 'fixed',
|
66 |
+
'bottom' => 0,
|
67 |
+
'left' => 0,
|
68 |
+
'width' => '100%',
|
69 |
+
'-webkit-box-shadow' => $box_shadow,
|
70 |
+
'-moz-box-shadow' => $box_shadow,
|
71 |
+
'box-shadow' => $box_shadow,
|
72 |
+
'background-color' => '#0E90D2',
|
73 |
+
'padding' => 0,
|
74 |
+
'margin' => 0
|
75 |
+
),
|
76 |
+
'.gaoop a' => array(
|
77 |
+
'color' => '#67C2F0',
|
78 |
+
'text-decoration' => 'none'
|
79 |
+
),
|
80 |
+
'.gaoop a:hover' => array(
|
81 |
+
'color' => '#ffffff',
|
82 |
+
'text-decoration' => 'underline'
|
83 |
+
),
|
84 |
+
'.gaoop-info-icon' => array(
|
85 |
+
'position' => 'relative',
|
86 |
+
'margin' => '0',
|
87 |
+
'padding' => '0',
|
88 |
+
'text-align' => 'center',
|
89 |
+
'vertical-align' => 'top',
|
90 |
+
'display' => 'inline-block',
|
91 |
+
'width' => '5%',
|
92 |
+
),
|
93 |
+
'.gaoop-close-icon' => array(
|
94 |
+
'position' => 'relative',
|
95 |
+
'opacity' => '0.5',
|
96 |
+
'ms-filter' => '"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"',
|
97 |
+
'filter' => 'alpha(opacity=50)',
|
98 |
+
'-moz-opacity' => '0.5',
|
99 |
+
'-khtml-opacity' => '0.5',
|
100 |
+
'margin' => '0',
|
101 |
+
'padding' => '0',
|
102 |
+
'text-align' => 'center',
|
103 |
+
'vertical-align' => 'top',
|
104 |
+
'display' => 'inline-block',
|
105 |
+
'width' => '5%',
|
106 |
+
),
|
107 |
+
'.gaoop-close-icon:hover' => array(
|
108 |
+
'z-index' => '1',
|
109 |
+
'opacity' => '1',
|
110 |
+
'ms-filter' => '"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"',
|
111 |
+
'filter' => 'alpha(opacity=100)',
|
112 |
+
'-moz-opacity' => '1',
|
113 |
+
'-khtml-opacity' => '1'
|
114 |
+
),
|
115 |
+
'.gaoop_closed .gaoop-opt-out-link, .gaoop_closed .gaoop-close-icon' => array(
|
116 |
+
'display' => 'none'
|
117 |
+
),
|
118 |
+
'.gaoop_closed' => array(
|
119 |
+
'width' => '55px',
|
120 |
+
'right' => 0,
|
121 |
+
'left' => 'auto',
|
122 |
+
'opacity' => '0.5',
|
123 |
+
'ms-filter' => '"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"',
|
124 |
+
'filter' => 'alpha(opacity=50)',
|
125 |
+
'-moz-opacity' => '0.5',
|
126 |
+
'-khtml-opacity' => '0.5'
|
127 |
+
),
|
128 |
+
'.gaoop_closed:hover' => array(
|
129 |
+
'opacity' => '1',
|
130 |
+
'ms-filter' => '"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"',
|
131 |
+
'filter' => 'alpha(opacity=100)',
|
132 |
+
'-moz-opacity' => '1',
|
133 |
+
'-khtml-opacity' => '1'
|
134 |
+
),
|
135 |
+
'.gaoop_closed .gaoop-opt-out-content' => array(
|
136 |
+
'display' => 'none',
|
137 |
+
),
|
138 |
+
'.gaoop_closed .gaoop-info-icon' => array(
|
139 |
+
'width' => '100%',
|
140 |
+
),
|
141 |
+
'.gaoop-opt-out-content' => array(
|
142 |
+
'display' => 'inline-block',
|
143 |
+
'width' => '90%',
|
144 |
+
'vertical-align' => 'top',
|
145 |
+
),
|
146 |
+
);
|
147 |
+
|
148 |
+
$standard_css_array = apply_filters( 'gaoop_standard_styles_array', $standard_css_array );
|
149 |
+
|
150 |
+
$standard_css = '';
|
151 |
+
if ( is_array( $standard_css_array ) ) {
|
152 |
+
foreach ( $standard_css_array as $key => $options ) {
|
153 |
+
$standard_css .= $key . ' {';
|
154 |
+
if ( is_array( $options ) ) {
|
155 |
+
foreach ( $options as $option => $value ) {
|
156 |
+
$standard_css .= $option . ': ' . $value . '; ';
|
157 |
+
}
|
158 |
+
}
|
159 |
+
$standard_css .= '} ';
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
$standard_css = apply_filters( 'gaoop_standard_styles', $standard_css );
|
164 |
+
|
165 |
+
$custom_css = get_option( 'gaoop_custom_styles', '' );
|
166 |
+
$custom_css = apply_filters( 'gaoop_custom_styles', $custom_css );
|
167 |
+
|
168 |
+
echo '<style type="text/css">/** Google Analytics Opt Out Custom CSS */' . $standard_css . $custom_css . '</style>';
|
169 |
+
}
|
170 |
+
|
171 |
+
add_action( 'wp_head', 'gaoop_wp_head' );
|
inc/functions.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Checks if the Yoast Analytics Plugin is active
|
5 |
+
* @since 1.0
|
6 |
+
* @return bool
|
7 |
+
*/
|
8 |
+
function gaoop_yoast_plugin_active() {
|
9 |
+
return defined( 'GAWP_VERSION' );
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Return the UA from Yoast settings, if Yoast Analytics plugin is installed
|
14 |
+
* If Yoast Analytics is not installed this will return an empty string
|
15 |
+
*
|
16 |
+
* @since 1.0
|
17 |
+
* @return string
|
18 |
+
*/
|
19 |
+
function gaoop_get_yoast_ua() {
|
20 |
+
|
21 |
+
if ( ! gaoop_yoast_plugin_active() ) {
|
22 |
+
return '';
|
23 |
+
}
|
24 |
+
|
25 |
+
$ua_code = '';
|
26 |
+
|
27 |
+
if ( is_admin() ) {
|
28 |
+
global $yoast_ga_admin;
|
29 |
+
|
30 |
+
if ( method_exists( $yoast_ga_admin, 'get_tracking_code' ) ) {
|
31 |
+
$ua_code = $yoast_ga_admin->get_tracking_code();
|
32 |
+
}
|
33 |
+
|
34 |
+
} else {
|
35 |
+
|
36 |
+
if ( class_exists( 'Yoast_GA_Options' ) ) {
|
37 |
+
$yoast_ga_options = Yoast_GA_Options::instance();
|
38 |
+
|
39 |
+
if ( method_exists( $yoast_ga_options, 'get_tracking_code' ) ) {
|
40 |
+
$ua_code = $yoast_ga_options->get_tracking_code();
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
return $ua_code;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Returns the UA-Code
|
50 |
+
* @since 1.0
|
51 |
+
* @return string
|
52 |
+
*/
|
53 |
+
function gaoop_get_ua_code() {
|
54 |
+
|
55 |
+
$use_yoast = get_option( 'gaoop_yoast', null );
|
56 |
+
|
57 |
+
// if the plugin is used the first time, this value is NULL
|
58 |
+
if ( is_null( $use_yoast ) ) {
|
59 |
+
$use_yoast = 1;
|
60 |
+
}
|
61 |
+
|
62 |
+
// if yoast should be used, try to get the ua code from the plugin
|
63 |
+
if ( 1 == intval( $use_yoast ) && gaoop_yoast_plugin_active() ) {
|
64 |
+
|
65 |
+
$yoast_code = gaoop_get_yoast_ua();
|
66 |
+
|
67 |
+
if ( ! empty( $yoast_code ) ) {
|
68 |
+
return apply_filters( 'gaoop_get_ua_code', $yoast_code );
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
// if yoast returns an empty string OR if the checkbox was set to 0 return the textbox content
|
73 |
+
return apply_filters( 'gaoop_get_ua_code', esc_attr( get_option( 'gaoop_property', '' ) ) );
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Sets the message to show when cookie has set
|
79 |
+
* @since 1.0
|
80 |
+
*/
|
81 |
+
function gaoop_cookie_set() {
|
82 |
+
$message = apply_filters( 'gaoop_opt_out_cookie_set_text', '' );
|
83 |
+
|
84 |
+
return "alert('" . $message . "');";
|
85 |
+
}
|
86 |
+
|
87 |
+
add_filter( 'gaoop_cookie_set', 'gaoop_cookie_set' );
|
88 |
+
|
89 |
+
|
90 |
+
function gaoop_opt_out_cookie_set_text() {
|
91 |
+
$text = sanitize_text_field( get_option( 'gaoop_opt_out_cookie_set_text', '' ) );
|
92 |
+
if ( ! empty( $text ) ) {
|
93 |
+
return $text;
|
94 |
+
}
|
95 |
+
|
96 |
+
return __( 'Thanks. We have set a cookie so that Google Analytics data collection will be disabled on your next visit.', 'gaoop' );
|
97 |
+
}
|
98 |
+
|
99 |
+
add_filter( 'gaoop_opt_out_cookie_set_text', 'gaoop_opt_out_cookie_set_text' );
|
inc/scripts.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Echos out the JavaScript for the opt-out
|
4 |
+
*
|
5 |
+
* @since 1.0
|
6 |
+
* @return void
|
7 |
+
*/
|
8 |
+
function gaoop_head_script() {
|
9 |
+
|
10 |
+
if ( apply_filters( 'gaoop_stop_head', false ) ) {
|
11 |
+
return;
|
12 |
+
}
|
13 |
+
|
14 |
+
gaoop_js();
|
15 |
+
}
|
16 |
+
|
17 |
+
// To call it before the Yoast Analytics Plugin (2) this has a priority of 1
|
18 |
+
add_action( 'wp_head', 'gaoop_head_script', 1 );
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Echos out the Javascript or returns it (if $echo is set to TRUE)
|
22 |
+
*
|
23 |
+
* @since 1.0
|
24 |
+
*
|
25 |
+
* @param bool $echo
|
26 |
+
*
|
27 |
+
* @return void|string
|
28 |
+
*/
|
29 |
+
function gaoop_js( $echo = true ) {
|
30 |
+
$ua_code = gaoop_get_ua_code();
|
31 |
+
if ( empty( $ua_code ) ) {
|
32 |
+
return '';
|
33 |
+
}
|
34 |
+
ob_start();
|
35 |
+
?>
|
36 |
+
<script type="text/javascript">
|
37 |
+
/* <![CDATA[ */
|
38 |
+
/* Google Analytics Opt-Out WordPress by WP-Buddy | http://wp-buddy.com/products/plugins/google-analytics-opt-out */
|
39 |
+
<?php do_action('gaoop_js_before_script'); ?>
|
40 |
+
var gaoop_property = '<?php echo $ua_code; ?>';
|
41 |
+
var gaoop_disable_str = 'ga-disable-' + gaoop_property;
|
42 |
+
if ( document.cookie.indexOf( gaoop_disable_str + '=true' ) > -1 ) {
|
43 |
+
window[ gaoop_disable_str ] = true;
|
44 |
+
}
|
45 |
+
function gaoop_analytics_optout() {
|
46 |
+
document.cookie = gaoop_disable_str + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
|
47 |
+
window[ gaoop_disable_str ] = true;
|
48 |
+
<?php echo apply_filters( 'gaoop_cookie_set', '' ); ?>
|
49 |
+
}
|
50 |
+
<?php do_action('gaoop_js_after_script'); ?>
|
51 |
+
/* ]]> */
|
52 |
+
</script>
|
53 |
+
<?php
|
54 |
+
$content = ob_get_clean();
|
55 |
+
if ( $echo ) {
|
56 |
+
echo $content;
|
57 |
+
} else {
|
58 |
+
return $content;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Enqueue Frontend Scripts
|
64 |
+
*
|
65 |
+
* @since 1.0
|
66 |
+
*/
|
67 |
+
function gaoop_enqueue_scripts() {
|
68 |
+
wp_enqueue_script( 'gaoop', GAOOP_URL . 'js/frontend.js', array( 'jquery' ), false, true );
|
69 |
+
add_filter( 'script_loader_tag', function ( $tag, $handle ) {
|
70 |
+
if ( $handle === 'gaoop' ) {
|
71 |
+
return str_replace( '<script', '<script async ', $tag );
|
72 |
+
}
|
73 |
+
|
74 |
+
return $tag;
|
75 |
+
}, 10, 2 );
|
76 |
+
}
|
77 |
+
|
78 |
+
add_action( 'init', 'gaoop_enqueue_scripts' );
|
79 |
+
|
inc/settings.php
ADDED
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Creating the menu item
|
5 |
+
*
|
6 |
+
* @since 1.0
|
7 |
+
* @return void
|
8 |
+
*/
|
9 |
+
function gaoop_admin_menu() {
|
10 |
+
$hook = add_submenu_page( 'options-general.php', __( 'Analytics Opt-Out', 'gaoop' ), __( 'Analytics Opt-Out', 'gaoop' ), 'manage_options', 'gaoo-options', 'gaoop_settings_page' );
|
11 |
+
add_action( "load-$hook", 'gaoop_settings_scripts' );
|
12 |
+
|
13 |
+
$hook = add_submenu_page( 'yst_ga_dashboard', __( 'Analytics Opt-Out', 'gaoop' ), __( 'Opt-Out Settings', 'gaoop' ), 'manage_options', 'gaoo-options', 'gaoop_settings_page' );
|
14 |
+
add_action( "load-$hook", 'gaoop_settings_scripts' );
|
15 |
+
}
|
16 |
+
|
17 |
+
add_action( 'admin_menu', 'gaoop_admin_menu', 30 );
|
18 |
+
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Creating the settings page HTML output
|
22 |
+
*
|
23 |
+
* @since 1.0
|
24 |
+
* @return void
|
25 |
+
*/
|
26 |
+
function gaoop_settings_page() {
|
27 |
+
?>
|
28 |
+
<div class="wrap">
|
29 |
+
<div id="icon-options-general" class="icon32"></div>
|
30 |
+
<h2><?php _e( 'Google Analaytics Opt-Out Pro', 'gaoop' ); ?> </h2>
|
31 |
+
|
32 |
+
<form action="options.php" method="post">
|
33 |
+
<?php
|
34 |
+
settings_fields( 'gaoop_options_page' );
|
35 |
+
do_settings_sections( 'gaoop_options_page' );
|
36 |
+
submit_button();
|
37 |
+
?>
|
38 |
+
</form>
|
39 |
+
</div>
|
40 |
+
<?php
|
41 |
+
}
|
42 |
+
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Enqueues the settings page scripts and styles
|
46 |
+
*
|
47 |
+
* @since 1.0
|
48 |
+
* @return void
|
49 |
+
*/
|
50 |
+
function gaoop_settings_scripts() {
|
51 |
+
wp_enqueue_script( 'equipment', GAOOP_URL . '/js/settings.js', array( 'jquery' ), false, true );
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Registers Settings sections and fields
|
57 |
+
*
|
58 |
+
* @since 1.0
|
59 |
+
* @return void
|
60 |
+
*/
|
61 |
+
function gaoop_register_theme_options_section() {
|
62 |
+
|
63 |
+
add_settings_section( 'gaoop_settings_section', __( 'Analytics Opt-Out', 'gaoop' ), null, 'gaoop_options_page' );
|
64 |
+
|
65 |
+
add_settings_field( 'gaoop_yoast', __( 'Use Monster Insights Settings', 'gaoop' ), 'gaoop_options_yoast', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_yoast' ) );
|
66 |
+
register_setting( 'gaoop_options_page', 'gaoop_yoast', 'intval' );
|
67 |
+
|
68 |
+
add_settings_field( 'gaoop_property', __( 'UA-Code', 'gaoop' ), 'gaoop_options_property', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_property' ) );
|
69 |
+
register_setting( 'gaoop_options_page', 'gaoop_property', 'sanitize_text_field' );
|
70 |
+
|
71 |
+
add_settings_field( 'gaoop_banner', __( 'Use Banner', 'gaoop' ), 'gaoop_options_banner', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_banner' ) );
|
72 |
+
register_setting( 'gaoop_options_page', 'gaoop_banner', 'intval' );
|
73 |
+
|
74 |
+
add_settings_field( 'gaoop_opt_out_text', __( 'Opt-Out Banner-Text', 'gaoop' ), 'gaoop_options_opt_out_text', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_opt_out_text' ) );
|
75 |
+
register_setting( 'gaoop_options_page', 'gaoop_opt_out_text', 'wp_kses_post' );
|
76 |
+
|
77 |
+
add_settings_field( 'gaoop_opt_out_shortcode_integration', __( 'Integrate Shortcode', 'gaoop' ), 'gaoop_options_opt_out_shortcode_integration', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_opt_out_shortcode_integration' ) );
|
78 |
+
register_setting( 'gaoop_options_page', 'gaoop_opt_out_shortcode_integration', 'sanitize_text_field' );
|
79 |
+
|
80 |
+
add_settings_field( 'gaoop_opt_out_cookie_set_text', __( 'Opt-Out Successful', 'gaoop' ), 'gaoop_options_opt_out_cookie_set_text', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_opt_out_cookie_set_text' ) );
|
81 |
+
register_setting( 'gaoop_options_page', 'gaoop_opt_out_cookie_set_text', 'sanitize_text_field' );
|
82 |
+
|
83 |
+
add_settings_field( 'gaoop_hide', __( 'Hide banner after closing', 'gaoop' ), 'gaoop_options_hide', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_hide' ) );
|
84 |
+
register_setting( 'gaoop_options_page', 'gaoop_hide', 'intval' );
|
85 |
+
|
86 |
+
add_settings_field( 'gaoop_custom_styles', __( 'Custom CSS', 'gaoop' ), 'gaoop_options_custom_styles', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_custom_styles' ) );
|
87 |
+
register_setting( 'gaoop_options_page', 'gaoop_custom_styles' );
|
88 |
+
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
add_action( 'admin_init', 'gaoop_register_theme_options_section' );
|
93 |
+
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Settings field for the Yoast Checkbox
|
97 |
+
*
|
98 |
+
* @since 1.0
|
99 |
+
* @return void
|
100 |
+
*/
|
101 |
+
function gaoop_options_yoast() {
|
102 |
+
|
103 |
+
$yoast_active = gaoop_yoast_plugin_active();
|
104 |
+
|
105 |
+
$option = get_option( 'gaoop_yoast', null );
|
106 |
+
|
107 |
+
// if the plugin is used the first time it has the value of NULL. In this case we set the option to 1
|
108 |
+
if ( is_null( $option ) ) {
|
109 |
+
$option = 1;
|
110 |
+
}
|
111 |
+
|
112 |
+
if ( ! $yoast_active ) {
|
113 |
+
$option = 0;
|
114 |
+
}
|
115 |
+
|
116 |
+
echo '<input ' . disabled( ! $yoast_active, true, false ) . ' ' . checked( $option, 1, false ) . ' id="gaoop_options_yoast" type="checkbox" name="gaoop_yoast" value="1" />';
|
117 |
+
echo '<p class="description">';
|
118 |
+
if ( $yoast_active ) {
|
119 |
+
echo '<span style="color: #5EB95E;">' . __( 'Monster Insights Plugin has been detected.', 'gaoop' ) . '</span>';
|
120 |
+
} else {
|
121 |
+
echo '<span style="color: #DD514C;">' . __( 'Monster Insights Plugin has NOT been detected. Please enter your UA code manually and then check the sourcode of your website. Make sure that Analytics code appears AFTER the opt-out code (which starts with <code>/* Google Analytics Opt-Out</code>).', 'gaoop' ) . '</span>';
|
122 |
+
}
|
123 |
+
echo '</p>';
|
124 |
+
}
|
125 |
+
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Settings field for the UA property
|
129 |
+
*
|
130 |
+
* @since 1.0
|
131 |
+
* @return void
|
132 |
+
*/
|
133 |
+
function gaoop_options_property() {
|
134 |
+
$yoast_active = gaoop_yoast_plugin_active();
|
135 |
+
$option = get_option( 'gaoop_yoast', null );
|
136 |
+
|
137 |
+
if ( $yoast_active && 1 == $option ) {
|
138 |
+
$value = gaoop_get_yoast_ua();
|
139 |
+
} else {
|
140 |
+
$value = sanitize_text_field( get_option( 'gaoop_property', '' ) );
|
141 |
+
}
|
142 |
+
|
143 |
+
echo '<input id="gaoop_options_property" placeholder="UA-XXXXXX-X" type="text" class="regular-text" value="' . $value . '" name="gaoop_property" /> ';
|
144 |
+
|
145 |
+
}
|
146 |
+
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Settings field for the banner checkbox
|
150 |
+
*
|
151 |
+
* @since 2.0.0
|
152 |
+
* @return void
|
153 |
+
*/
|
154 |
+
function gaoop_options_banner() {
|
155 |
+
|
156 |
+
$banner_active = (bool) get_option( 'gaoop_banner', false );
|
157 |
+
|
158 |
+
echo '<input ' . checked( $banner_active, true, false ) . ' id="gaoop_options_banner" type="checkbox" name="gaoop_banner" value="1" />';
|
159 |
+
}
|
160 |
+
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Settings field for the UA property
|
164 |
+
*
|
165 |
+
* @since 1.0
|
166 |
+
* @return void
|
167 |
+
*/
|
168 |
+
function gaoop_options_opt_out_text() {
|
169 |
+
wp_editor(
|
170 |
+
get_option( 'gaoop_opt_out_text', '' ),
|
171 |
+
'gaoop_options_opt_out_text',
|
172 |
+
array(
|
173 |
+
'textarea_name' => 'gaoop_opt_out_text',
|
174 |
+
)
|
175 |
+
);
|
176 |
+
|
177 |
+
printf( '<p class="description">%s</p>', __( 'Please integrate the shortcode so that the user can opt-out.', 'gaoop' ) );
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Set if the shortcode should be integrated automatically when it's not there.
|
182 |
+
*
|
183 |
+
* @since 1.4
|
184 |
+
*/
|
185 |
+
function gaoop_options_opt_out_shortcode_integration() {
|
186 |
+
printf(
|
187 |
+
'<input type="checkbox" id="gaoop_options_opt_out_shortcode_integration" value="1" name="gaoop_opt_out_shortcode_integration" %s />',
|
188 |
+
checked( (bool) get_option( 'gaoop_opt_out_shortcode_integration', 1 ), true, false )
|
189 |
+
);
|
190 |
+
printf( '<p class="description">%s</p>', __( 'If the shortcode was not detected, it will be added automatically.', 'gaoop' ) );
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Successful Opt-Out Text
|
195 |
+
*
|
196 |
+
* @since 1.0
|
197 |
+
* @return void
|
198 |
+
*/
|
199 |
+
function gaoop_options_opt_out_cookie_set_text() {
|
200 |
+
echo '<input id="gaoop_options_opt_out_cookie_set_text" placeholder="' . __( 'Thanks. We have set a cookie so that Google Analytics data collection will be disabled on your next visit.', 'gaoop' ) . '" type="text" class="regular-text" value="' . sanitize_text_field( get_option( 'gaoop_opt_out_cookie_set_text', '' ) ) . '" name="gaoop_opt_out_cookie_set_text" /> ';
|
201 |
+
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Settings field for the Hide checkbox
|
206 |
+
*
|
207 |
+
* @since 1.0
|
208 |
+
* @return void
|
209 |
+
*/
|
210 |
+
function gaoop_options_hide() {
|
211 |
+
echo '<input type="checkbox" id="gaoop_options_hide" ' . checked( intval( get_option( 'gaoop_hide', 0 ) ), 1, false ) . ' value="1" name="gaoop_hide" /> ';
|
212 |
+
echo '<p class="description">' . __( 'This will hide the opt-out box after the user has clicked the close-button. Otherwise a little info-button will be fixed to the bottom-right.', 'gaoop' ) . '</p>';
|
213 |
+
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Settings field for the custom CSS textarea
|
218 |
+
*
|
219 |
+
* @since 1.0
|
220 |
+
* @return void
|
221 |
+
*/
|
222 |
+
function gaoop_options_custom_styles() {
|
223 |
+
echo '<textarea id="gaoop_options_custom_styles" style="width: 400px;" cols="30" rows="5" class="regular-text" name="gaoop_custom_styles">' . esc_textarea( get_option( 'gaoop_custom_styles', '' ) ) . '</textarea> ';
|
224 |
+
}
|
inc/shortcodes.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Exit if accessed directly
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Checks if a shortcode is used in a string
|
9 |
+
*
|
10 |
+
* @param string $shortcode
|
11 |
+
* @param string $content
|
12 |
+
*
|
13 |
+
* @return bool
|
14 |
+
*/
|
15 |
+
function gaoop_has_shortcode( $shortcode, $content = '' ) {
|
16 |
+
if ( stripos( $content, '[' . $shortcode ) !== false ) {
|
17 |
+
return true;
|
18 |
+
}
|
19 |
+
|
20 |
+
return false;
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Adds the shortcodes
|
25 |
+
*
|
26 |
+
* @since 1.0
|
27 |
+
* @return void
|
28 |
+
*/
|
29 |
+
function gaoop_init_shortcodes() {
|
30 |
+
add_shortcode( 'google_analytics_optout', 'gaoop_shortcode' );
|
31 |
+
add_shortcode( 'google_analytics_optout_close', 'gaoop_shortcode_close' );
|
32 |
+
}
|
33 |
+
|
34 |
+
add_action( 'init', 'gaoop_init_shortcodes' );
|
35 |
+
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Creating the shortcode content
|
39 |
+
*
|
40 |
+
* @param array $atts
|
41 |
+
* @param string $content
|
42 |
+
*
|
43 |
+
* @since 1.0
|
44 |
+
*
|
45 |
+
* @return string
|
46 |
+
*/
|
47 |
+
function gaoop_shortcode( $atts, $content = '' ) {
|
48 |
+
//$atts = shortcode_atts( array(), $atts );
|
49 |
+
|
50 |
+
if ( empty( $content ) ) {
|
51 |
+
$content = __( 'Click here to opt out.', 'gaoop' );
|
52 |
+
}
|
53 |
+
|
54 |
+
$ua_code = gaoop_get_ua_code();
|
55 |
+
|
56 |
+
if ( empty( $ua_code ) ) {
|
57 |
+
return '<span style="cursor: help; border: 0 none; border-bottom-width: 1px; border-style: dashed;" title="' . __( 'No UA-Code has been entered. Please ask the admin to solve this issue!', 'gaoop' ) . '">' . do_shortcode( $content ) . '</span>';
|
58 |
+
}
|
59 |
+
|
60 |
+
return '<a class="gaoo-opt-out google-analytics-opt-out" href="javascript:gaoop_analytics_optout();">' . do_shortcode( $content ) . '</a>';
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Close the banner button shortcode.
|
66 |
+
*
|
67 |
+
* @param array $atts
|
68 |
+
* @param string $content
|
69 |
+
* @param string $name
|
70 |
+
*
|
71 |
+
* @since 1.4.0
|
72 |
+
*
|
73 |
+
* @return string
|
74 |
+
*/
|
75 |
+
function gaoop_shortcode_close( $atts, $content, $name ) {
|
76 |
+
if ( empty( $content ) ) {
|
77 |
+
$content = __( 'OK', 'gaoop' );
|
78 |
+
}
|
79 |
+
|
80 |
+
return sprintf( '<a href="#" class="gaoop-close-link">%s</a>', $content );
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Doing shortcodes in the text widget, too
|
85 |
+
*/
|
86 |
+
if ( ! has_filter( 'widget_text', 'do_shortcode' ) ) {
|
87 |
+
add_filter( 'widget_text', 'do_shortcode' );
|
88 |
+
}
|
js/editor-button.js
CHANGED
@@ -1,60 +1,60 @@
|
|
1 |
-
(function ($) {
|
2 |
-
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
|
57 |
-
|
58 |
-
|
59 |
|
60 |
-
})(jQuery);
|
1 |
+
(function ( $ ) {
|
2 |
+
"use strict";
|
3 |
|
4 |
+
tinymce.create( 'tinymce.plugins.WPB_Analytics_Opt_Out', {
|
5 |
+
/**
|
6 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
7 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
8 |
+
* of the editor instance to intercept that event.
|
9 |
+
*
|
10 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
11 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
12 |
+
*/
|
13 |
+
init: function ( ed, url ) {
|
14 |
+
ed.addButton( 'wpb_analytics_opt_out', {
|
15 |
+
title: 'Analytics Opt-Out',
|
16 |
+
cmd: 'wpb_analytics_opt_out',
|
17 |
+
image: url + '/../images/optout-editor-icon.png'
|
18 |
+
} );
|
19 |
|
20 |
+
ed.addCommand( 'wpb_analytics_opt_out', function () {
|
21 |
+
var shortcode = '[google_analytics_optout]Click here to opt-out.[/google_analytics_optout]';
|
22 |
+
tinyMCE.activeEditor.execCommand( 'mceInsertContent', 0, shortcode + ' ' );
|
23 |
+
} )
|
24 |
+
},
|
25 |
|
26 |
+
/**
|
27 |
+
* Creates control instances based in the incomming name. This method is normally not
|
28 |
+
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
|
29 |
+
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
|
30 |
+
* method can be used to create those.
|
31 |
+
*
|
32 |
+
* @param {String} n Name of the control to create.
|
33 |
+
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
|
34 |
+
* @return {tinymce.ui.Control} New control instance or null if no control was created.
|
35 |
+
*/
|
36 |
+
createControl: function ( n, cm ) {
|
37 |
+
return null;
|
38 |
+
},
|
39 |
|
40 |
+
/**
|
41 |
+
* Returns information about the plugin as a name/value array.
|
42 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
43 |
+
*
|
44 |
+
* @return {Object} Name/value array containing information about the plugin.
|
45 |
+
*/
|
46 |
+
getInfo: function () {
|
47 |
+
return {
|
48 |
+
longname: 'Analytics Opt-Out',
|
49 |
+
author: 'WP-Buddy',
|
50 |
+
authorurl: 'http://wp-buddy.com',
|
51 |
+
infourl: 'http://wp-buddy.com',
|
52 |
+
version: "0.1"
|
53 |
+
};
|
54 |
+
}
|
55 |
+
} );
|
56 |
|
57 |
+
// Register plugin
|
58 |
+
tinymce.PluginManager.add( 'wpb_analytics_opt_out', tinymce.plugins.WPB_Analytics_Opt_Out );
|
59 |
|
60 |
+
})( jQuery );
|
js/frontend.js
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function ( $ ) {
|
2 |
+
"use strict";
|
3 |
+
jQuery( document ).ready( function () {
|
4 |
+
|
5 |
+
var $gaoop = jQuery( '.gaoop' );
|
6 |
+
var ua_code = $gaoop.data( 'gaoop_ua' );
|
7 |
+
|
8 |
+
|
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 ) {
|
15 |
+
/* yes, set */
|
16 |
+
if ( 1 != $gaoop.data( 'gaoop_hide' ) ) {
|
17 |
+
$gaoop.addClass( 'gaoop_closed' ).show();
|
18 |
+
}
|
19 |
+
} else {
|
20 |
+
/* not set */
|
21 |
+
$gaoop.show();
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Close banner
|
28 |
+
*/
|
29 |
+
function gaoop_close() {
|
30 |
+
|
31 |
+
if ( 1 == $gaoop.data( 'gaoop_hide' ) ) {
|
32 |
+
$gaoop.fadeOut( 500 );
|
33 |
+
} else {
|
34 |
+
$gaoop.css( 'left', 'auto' ).css( 'right', 0 );
|
35 |
+
$gaoop.find( '.gaoop-opt-out-content' ).hide();
|
36 |
+
$gaoop.find( '.gaoop-opt-out-link, .gaoop-close-icon' ).hide();
|
37 |
+
$gaoop.animate( { 'opacity': 0.5, 'width': '55px' }, 500 );
|
38 |
+
$gaoop.addClass( 'gaoop_closed' );
|
39 |
+
}
|
40 |
+
|
41 |
+
document.cookie = 'gaoop_hide_info=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Open banner
|
47 |
+
*/
|
48 |
+
function gaoop_open() {
|
49 |
+
/* destroy cookie */
|
50 |
+
document.cookie = 'gaoop_hide_info=true; expires=Thu, 31 Dec 1901 23:59:59 UTC; path=/';
|
51 |
+
|
52 |
+
$gaoop.removeClass( 'gaoop_closed' );
|
53 |
+
$gaoop.animate( { 'opacity': 1, 'width': '100%' }, 500, function () {
|
54 |
+
$gaoop.find( '.gaoop-opt-out-link, .gaoop-close-icon' ).fadeIn( 300 );
|
55 |
+
$gaoop.find( '.gaoop-opt-out-content' ).show();
|
56 |
+
} );
|
57 |
+
}
|
58 |
+
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Click Opt-Out Button
|
62 |
+
*/
|
63 |
+
$gaoop.find( 'a.gaoo-opt-out' ).click( function ( e ) {
|
64 |
+
e.preventDefault();
|
65 |
+
if ( jQuery.isFunction( window.gaoop_analytics_optout ) ) {
|
66 |
+
gaoop_analytics_optout();
|
67 |
+
$gaoop.fadeOut( 500 );
|
68 |
+
}
|
69 |
+
} );
|
70 |
+
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Click info icon
|
74 |
+
*/
|
75 |
+
$gaoop.find( '.gaoop-info-icon' ).click( function ( e ) {
|
76 |
+
e.preventDefault();
|
77 |
+
|
78 |
+
if ( $gaoop.hasClass( 'gaoop_closed' ) ) {
|
79 |
+
gaoop_open();
|
80 |
+
}
|
81 |
+
|
82 |
+
} );
|
83 |
+
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Click to close the window
|
87 |
+
*/
|
88 |
+
$gaoop.find( '.gaoop-close-icon' ).click( function ( e ) {
|
89 |
+
e.preventDefault();
|
90 |
+
gaoop_close();
|
91 |
+
} );
|
92 |
+
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Click to close the window
|
96 |
+
*/
|
97 |
+
|
98 |
+
jQuery( document ).on( 'click', '.gaoop-close-link', function ( e ) {
|
99 |
+
e.preventDefault();
|
100 |
+
gaoop_close();
|
101 |
+
} );
|
102 |
+
|
103 |
+
} );
|
104 |
+
})( jQuery );
|
js/settings.js
CHANGED
@@ -1,23 +1,42 @@
|
|
1 |
-
(function ($) {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 );
|
languages/gaoo-de_DE.mo
DELETED
Binary file
|
languages/gaoo-de_DE.po
DELETED
@@ -1,102 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Google Analytics Opt-Out\n"
|
4 |
-
"POT-Creation-Date: 2014-06-12 08:09+0100\n"
|
5 |
-
"PO-Revision-Date: 2014-06-12 08:11+0100\n"
|
6 |
-
"Last-Translator: WP-Buddy <info@wp-buddy.com>\n"
|
7 |
-
"Language-Team: WP-Buddy <info@wp-buddy.com>\n"
|
8 |
-
"Language: de_DE\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Textdomain-Support: yes\n"
|
13 |
-
"X-Generator: Poedit 1.6.5\n"
|
14 |
-
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
|
15 |
-
"_n_noop:1,2;_c;_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;"
|
16 |
-
"esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
|
17 |
-
"X-Poedit-Basepath: .\n"
|
18 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
19 |
-
"X-Poedit-SearchPath-0: ..\n"
|
20 |
-
|
21 |
-
#: ../classes/admin.php:10
|
22 |
-
msgid ""
|
23 |
-
"To use the Google Analytics Opt-Out Plugin please enter an UA-Code on the "
|
24 |
-
"settings page."
|
25 |
-
msgstr ""
|
26 |
-
"Um das Google Analytics Opt-Oput Plugin zu benutzen müssen Sie einen UA-Code "
|
27 |
-
"auf der Einstellungsseite eingeben."
|
28 |
-
|
29 |
-
#: ../classes/admin.php:14
|
30 |
-
msgid ""
|
31 |
-
"To use the Google Analytics Opt-Out Plugin please enter an UA-Code on the "
|
32 |
-
"settings page of \"Google Analytics for WordPress\" configuration page."
|
33 |
-
msgstr ""
|
34 |
-
"Um das Google Analytics Opt-Out Plugin nutzen zu können musst Du Deinen UA-"
|
35 |
-
"Code auf der Einstellungsseite des \"Google Analytics for WordPress\" "
|
36 |
-
"Konfigurationsseite eingeben."
|
37 |
-
|
38 |
-
#: ../classes/admin.php:38
|
39 |
-
msgid "Settings"
|
40 |
-
msgstr "Einstellungen"
|
41 |
-
|
42 |
-
#: ../classes/admin.php:39
|
43 |
-
msgid "More by WP-Buddy"
|
44 |
-
msgstr "Mehr von WP-Buddy"
|
45 |
-
|
46 |
-
#: ../classes/scripts.php:47
|
47 |
-
msgid ""
|
48 |
-
"Thanks. We have set a cookie so that Google Analytics data collection will "
|
49 |
-
"be disabled on your next visit."
|
50 |
-
msgstr ""
|
51 |
-
"Vielen Dank. Wir haben ein Cookie gesetzt damit Google Analytics bei Ihrem "
|
52 |
-
"nächsten Besuch keine Daten mehr sammeln kann."
|
53 |
-
|
54 |
-
#: ../classes/settings.php:9 ../classes/settings.php:56
|
55 |
-
msgid "Analytics Opt-Out"
|
56 |
-
msgstr "Analytics Opt-Out"
|
57 |
-
|
58 |
-
#: ../classes/settings.php:25
|
59 |
-
msgid "Google Analaytics Opt-Out"
|
60 |
-
msgstr "Google Analytics Opt-Out"
|
61 |
-
|
62 |
-
#: ../classes/settings.php:58
|
63 |
-
msgid "Use Yoast Analytics Settings"
|
64 |
-
msgstr "Yoast Analytics Einstellungen benutzen"
|
65 |
-
|
66 |
-
#: ../classes/settings.php:61
|
67 |
-
msgid "UA-Code"
|
68 |
-
msgstr "UA-Code"
|
69 |
-
|
70 |
-
#: ../classes/settings.php:91
|
71 |
-
msgid "Yoast Analytics Plugin has been detected."
|
72 |
-
msgstr "Yoast Analytics Plugin wurde gefunden."
|
73 |
-
|
74 |
-
#: ../classes/settings.php:94
|
75 |
-
msgid ""
|
76 |
-
"Yoast Analytics Plugin has NOT been detected. Please enter your UA code "
|
77 |
-
"manually and then check the sourcode of your website. Make sure that "
|
78 |
-
"Analytics code appears AFTER the opt-out code (which starts with <code>/* "
|
79 |
-
"Google Analytics Opt-Out</code>)."
|
80 |
-
msgstr ""
|
81 |
-
"Das Yoast Analytics Plugin wurde nicht gefunden. Bitte geben Sie Ihren UA-"
|
82 |
-
"Code manuell ein und prüfen Sie den Quellcode Ihrer Website. Stellen Sie "
|
83 |
-
"sicher, dass der Analytics Code NACH dem Opt-Out-Code eingebunden wird. Der "
|
84 |
-
"Opt-Out-Code beginnt mit <code>/* Google Analytics Opt-Out</code>."
|
85 |
-
|
86 |
-
#: ../classes/shortcodes.php:52
|
87 |
-
msgid "No UA-Code has been entered. Please ask the admin to solve this issue!"
|
88 |
-
msgstr ""
|
89 |
-
"Es wurde kein UA-Code eingegeben. Bitte Fragen Sie beim Administrator nach "
|
90 |
-
"um dieses Problem zu beheben!"
|
91 |
-
|
92 |
-
#: ../classes/shortcodes.php:56
|
93 |
-
msgid "Click here to opt out."
|
94 |
-
msgstr "Zum Opt-Out hier klicken."
|
95 |
-
|
96 |
-
#: ../google-analytics-opt-out.php:35
|
97 |
-
msgid "Google Analytics Opt-Out"
|
98 |
-
msgstr "Google Analytics Opt-Out"
|
99 |
-
|
100 |
-
#: ../google-analytics-opt-out.php:36
|
101 |
-
msgid "Provides an Opt-Out functionality for Google Analytics"
|
102 |
-
msgstr "Stellt eine Opt-Out-Funktion für Google Analytics bereit."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/gaoo-es_ES.mo
DELETED
Binary file
|
languages/gaoo-es_ES.po
DELETED
@@ -1,101 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Google Analytics Opt-Out\n"
|
4 |
-
"POT-Creation-Date: 2014-06-12 08:09+0100\n"
|
5 |
-
"PO-Revision-Date: 2015-06-29 12:51+0100\n"
|
6 |
-
"Last-Translator: Borisa Djuraskovic <borisad@webhostinghub.com>\n"
|
7 |
-
"Language-Team: \n"
|
8 |
-
"MIME-Version: 1.0\n"
|
9 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
-
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"X-Generator: Poedit 1.7.4\n"
|
12 |
-
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
|
13 |
-
"_n_noop:1,2;_c;_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;"
|
14 |
-
"esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
|
15 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
-
"X-Poedit-Basepath: .\n"
|
17 |
-
"Language: es_ES\n"
|
18 |
-
"X-Poedit-SearchPath-0: ..\n"
|
19 |
-
|
20 |
-
#: ../classes/admin.php:10
|
21 |
-
msgid ""
|
22 |
-
"To use the Google Analytics Opt-Out Plugin please enter an UA-Code on the "
|
23 |
-
"settings page."
|
24 |
-
msgstr ""
|
25 |
-
"Para usar el Plugin Google Analytics Opt-Out por favor entre un Código UA en "
|
26 |
-
"la página de ajustes."
|
27 |
-
|
28 |
-
#: ../classes/admin.php:14
|
29 |
-
msgid ""
|
30 |
-
"To use the Google Analytics Opt-Out Plugin please enter an UA-Code on the "
|
31 |
-
"settings page of \"Google Analytics for WordPress\" configuration page."
|
32 |
-
msgstr ""
|
33 |
-
"Para usar el Plugin Google Analytics Opt-Out por favor entre un Código UA en "
|
34 |
-
"la página de ajustes de la página de configuración de \"Google Analytics "
|
35 |
-
"para WordPress\" "
|
36 |
-
|
37 |
-
#: ../classes/admin.php:38
|
38 |
-
msgid "Settings"
|
39 |
-
msgstr "Ajustes"
|
40 |
-
|
41 |
-
#: ../classes/admin.php:39
|
42 |
-
msgid "More by WP-Buddy"
|
43 |
-
msgstr "Más por WP-Buddy"
|
44 |
-
|
45 |
-
#: ../classes/scripts.php:47
|
46 |
-
msgid ""
|
47 |
-
"Thanks. We have set a cookie so that Google Analytics data collection will "
|
48 |
-
"be disabled on your next visit."
|
49 |
-
msgstr ""
|
50 |
-
"Gracias. Hemos establecido una cookie para que la recolección de datos de "
|
51 |
-
"Google Analytics se deshabilite en su próxima visita."
|
52 |
-
|
53 |
-
#: ../classes/settings.php:9 ../classes/settings.php:56
|
54 |
-
msgid "Analytics Opt-Out"
|
55 |
-
msgstr "Analytics Opt-Out"
|
56 |
-
|
57 |
-
#: ../classes/settings.php:25
|
58 |
-
msgid "Google Analaytics Opt-Out"
|
59 |
-
msgstr "Google Analytics Opt-Out"
|
60 |
-
|
61 |
-
#: ../classes/settings.php:58
|
62 |
-
msgid "Use Yoast Analytics Settings"
|
63 |
-
msgstr "Usar Ajustes de Yoast Analytics "
|
64 |
-
|
65 |
-
#: ../classes/settings.php:61
|
66 |
-
msgid "UA-Code"
|
67 |
-
msgstr "Código UA"
|
68 |
-
|
69 |
-
#: ../classes/settings.php:91
|
70 |
-
msgid "Yoast Analytics Plugin has been detected."
|
71 |
-
msgstr "El Plugin de Yoast Analytics ha sido detectado."
|
72 |
-
|
73 |
-
#: ../classes/settings.php:94
|
74 |
-
msgid ""
|
75 |
-
"Yoast Analytics Plugin has NOT been detected. Please enter your UA code "
|
76 |
-
"manually and then check the sourcode of your website. Make sure that "
|
77 |
-
"Analytics code appears AFTER the opt-out code (which starts with <code>/* "
|
78 |
-
"Google Analytics Opt-Out</code>)."
|
79 |
-
msgstr ""
|
80 |
-
"El Plugin de Yoast Analytics NO ha sido detectado. Por favor entre su código "
|
81 |
-
"UA manualmente y luego chequee el código fuente de su sitio web. Esté seguro "
|
82 |
-
"que el código de Analytics aparece LUEGO del código opt-out (que comienza "
|
83 |
-
"con <code>/* Google Analytics Opt-Out</code>)."
|
84 |
-
|
85 |
-
#: ../classes/shortcodes.php:52
|
86 |
-
msgid "No UA-Code has been entered. Please ask the admin to solve this issue!"
|
87 |
-
msgstr ""
|
88 |
-
"No se ha entrado Código UA. ¡Por favor pida al admin de solucionar este "
|
89 |
-
"problema!"
|
90 |
-
|
91 |
-
#: ../classes/shortcodes.php:56
|
92 |
-
msgid "Click here to opt out."
|
93 |
-
msgstr "Haga clic aquí para opt out."
|
94 |
-
|
95 |
-
#: ../google-analytics-opt-out.php:35
|
96 |
-
msgid "Google Analytics Opt-Out"
|
97 |
-
msgstr "Google Analytics Opt-Out"
|
98 |
-
|
99 |
-
#: ../google-analytics-opt-out.php:36
|
100 |
-
msgid "Provides an Opt-Out functionality for Google Analytics"
|
101 |
-
msgstr "Provee una funcionalidad Opt-Out para Google Analytics"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/gaoo.mo
DELETED
Binary file
|
languages/gaoo.po
DELETED
@@ -1,87 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Google Analytics Opt-Out\n"
|
4 |
-
"POT-Creation-Date: 2014-06-12 08:09+0100\n"
|
5 |
-
"PO-Revision-Date: 2014-06-12 08:09+0100\n"
|
6 |
-
"Last-Translator: WP-Buddy <info@wp-buddy.com>\n"
|
7 |
-
"Language-Team: \n"
|
8 |
-
"MIME-Version: 1.0\n"
|
9 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
-
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"X-Generator: Poedit 1.6.5\n"
|
12 |
-
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
|
13 |
-
"_n_noop:1,2;_c;_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;"
|
14 |
-
"esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
|
15 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
-
"X-Poedit-Basepath: .\n"
|
17 |
-
"X-Poedit-SearchPath-0: ..\n"
|
18 |
-
|
19 |
-
#: ../classes/admin.php:10
|
20 |
-
msgid ""
|
21 |
-
"To use the Google Analytics Opt-Out Plugin please enter an UA-Code on the "
|
22 |
-
"settings page."
|
23 |
-
msgstr ""
|
24 |
-
|
25 |
-
#: ../classes/admin.php:14
|
26 |
-
msgid ""
|
27 |
-
"To use the Google Analytics Opt-Out Plugin please enter an UA-Code on the "
|
28 |
-
"settings page of \"Google Analytics for WordPress\" configuration page."
|
29 |
-
msgstr ""
|
30 |
-
|
31 |
-
#: ../classes/admin.php:38
|
32 |
-
msgid "Settings"
|
33 |
-
msgstr ""
|
34 |
-
|
35 |
-
#: ../classes/admin.php:39
|
36 |
-
msgid "More by WP-Buddy"
|
37 |
-
msgstr ""
|
38 |
-
|
39 |
-
#: ../classes/scripts.php:47
|
40 |
-
msgid ""
|
41 |
-
"Thanks. We have set a cookie so that Google Analytics data collection will "
|
42 |
-
"be disabled on your next visit."
|
43 |
-
msgstr ""
|
44 |
-
|
45 |
-
#: ../classes/settings.php:9 ../classes/settings.php:56
|
46 |
-
msgid "Analytics Opt-Out"
|
47 |
-
msgstr ""
|
48 |
-
|
49 |
-
#: ../classes/settings.php:25
|
50 |
-
msgid "Google Analaytics Opt-Out"
|
51 |
-
msgstr ""
|
52 |
-
|
53 |
-
#: ../classes/settings.php:58
|
54 |
-
msgid "Use Yoast Analytics Settings"
|
55 |
-
msgstr ""
|
56 |
-
|
57 |
-
#: ../classes/settings.php:61
|
58 |
-
msgid "UA-Code"
|
59 |
-
msgstr ""
|
60 |
-
|
61 |
-
#: ../classes/settings.php:91
|
62 |
-
msgid "Yoast Analytics Plugin has been detected."
|
63 |
-
msgstr ""
|
64 |
-
|
65 |
-
#: ../classes/settings.php:94
|
66 |
-
msgid ""
|
67 |
-
"Yoast Analytics Plugin has NOT been detected. Please enter your UA code "
|
68 |
-
"manually and then check the sourcode of your website. Make sure that "
|
69 |
-
"Analytics code appears AFTER the opt-out code (which starts with <code>/* "
|
70 |
-
"Google Analytics Opt-Out</code>)."
|
71 |
-
msgstr ""
|
72 |
-
|
73 |
-
#: ../classes/shortcodes.php:52
|
74 |
-
msgid "No UA-Code has been entered. Please ask the admin to solve this issue!"
|
75 |
-
msgstr ""
|
76 |
-
|
77 |
-
#: ../classes/shortcodes.php:56
|
78 |
-
msgid "Click here to opt out."
|
79 |
-
msgstr ""
|
80 |
-
|
81 |
-
#: ../google-analytics-opt-out.php:35
|
82 |
-
msgid "Google Analytics Opt-Out"
|
83 |
-
msgstr ""
|
84 |
-
|
85 |
-
#: ../google-analytics-opt-out.php:36
|
86 |
-
msgid "Provides an Opt-Out functionality for Google Analytics"
|
87 |
-
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/gaoo.pot
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Google Analytics Opt-Out Pro\n"
|
4 |
+
"POT-Creation-Date: 2013-11-12 09:04+0100\n"
|
5 |
+
"PO-Revision-Date: 2013-11-12 09:04+0100\n"
|
6 |
+
"Last-Translator: WP-Buddy <info@wp-buddy.com>\n"
|
7 |
+
"Language-Team: \n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"X-Generator: Poedit 1.5.7\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
|
13 |
+
"_n_noop:1,2;_c;_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;"
|
14 |
+
"esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
|
15 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
+
"X-Poedit-Basepath: .\n"
|
17 |
+
"X-Poedit-SearchPath-0: ..\n"
|
18 |
+
|
19 |
+
#: ../google-analytics-opt-out-pro.php:27
|
20 |
+
#, php-format
|
21 |
+
msgid ""
|
22 |
+
"You are using PHP in version %s. This version is outdated and cannot be used "
|
23 |
+
"with the Google Analytics Opt-Out plugin. Please update to the latest PHP "
|
24 |
+
"version in order to use this plugin. You can ask your provider on how to do "
|
25 |
+
"this."
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#: ../google-analytics-opt-out-pro.php:45
|
29 |
+
msgid ""
|
30 |
+
"It seems that the free version of the Google Analytics Opt-Out is installed. "
|
31 |
+
"Please deactivate the free version before activating the pro version. "
|
32 |
+
"Thanks! "
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: ../google-analytics-opt-out-pro.php:45
|
36 |
+
msgid "← Go back"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: ../inc/admin.php:11
|
40 |
+
msgid ""
|
41 |
+
"To use the Google Analytics Opt-Out Plugin please enter an UA-Code on the "
|
42 |
+
"settings page."
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: ../inc/admin.php:30
|
46 |
+
msgid "Settings"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: ../inc/admin.php:31
|
50 |
+
msgid "More by WP-Buddy"
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: ../inc/frontend.php:14
|
54 |
+
msgid "Google Analytics Opt-Out Information"
|
55 |
+
msgstr ""
|
56 |
+
|
57 |
+
#: ../inc/frontend.php:14
|
58 |
+
msgid "Close"
|
59 |
+
msgstr ""
|
60 |
+
|
61 |
+
#: ../inc/frontend.php:16
|
62 |
+
msgid "Close this and do not ask me again"
|
63 |
+
msgstr ""
|
64 |
+
|
65 |
+
#: ../inc/frontend.php:32 ../inc/settings.php:142
|
66 |
+
msgid ""
|
67 |
+
"This website is using Google Analytics. Please click here if you want to opt-"
|
68 |
+
"out."
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: ../inc/functions.php:95 ../inc/settings.php:148
|
72 |
+
msgid ""
|
73 |
+
"Thanks. We have set a cookie so that Google Analytics data collection will "
|
74 |
+
"be disabled on your next visit."
|
75 |
+
msgstr ""
|
76 |
+
|
77 |
+
#: ../inc/settings.php:9
|
78 |
+
msgid "Analytics Opt-Out Pro"
|
79 |
+
msgstr ""
|
80 |
+
|
81 |
+
#: ../inc/settings.php:25
|
82 |
+
msgid "Google Analaytics Opt-Out Pro"
|
83 |
+
msgstr ""
|
84 |
+
|
85 |
+
#: ../inc/settings.php:56
|
86 |
+
msgid "Analytics Opt-Out"
|
87 |
+
msgstr ""
|
88 |
+
|
89 |
+
#: ../inc/settings.php:58
|
90 |
+
msgid "Use Yoast Analytics Settings"
|
91 |
+
msgstr ""
|
92 |
+
|
93 |
+
#: ../inc/settings.php:61
|
94 |
+
msgid "UA-Code"
|
95 |
+
msgstr ""
|
96 |
+
|
97 |
+
#: ../inc/settings.php:64
|
98 |
+
msgid "Opt-Out Box-Text"
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: ../inc/settings.php:67
|
102 |
+
msgid "Opt-Out Successful"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: ../inc/settings.php:70
|
106 |
+
msgid "Hide banner after opt-out"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: ../inc/settings.php:73
|
110 |
+
msgid "Custom CSS"
|
111 |
+
msgstr ""
|
112 |
+
|
113 |
+
#: ../inc/settings.php:76
|
114 |
+
msgid "Purchase Code"
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: ../inc/settings.php:106
|
118 |
+
msgid "Yoast Analytics Plugin has been detected."
|
119 |
+
msgstr ""
|
120 |
+
|
121 |
+
#: ../inc/settings.php:109
|
122 |
+
msgid ""
|
123 |
+
"Yoast Analytics Plugin has NOT been detected. Please enter your UA code "
|
124 |
+
"manually and then check the sourcode of your website. Make sure that "
|
125 |
+
"Analytics code appears AFTER the opt-out code (which starts with <code>/* "
|
126 |
+
"Google Analytics Opt-Out</code>)."
|
127 |
+
msgstr ""
|
128 |
+
|
129 |
+
#: ../inc/settings.php:160
|
130 |
+
msgid ""
|
131 |
+
"This will hide the opt-out box after the user has opted-out. Otherwise a "
|
132 |
+
"little info-button will be fixed to the bottom-right."
|
133 |
+
msgstr ""
|
134 |
+
|
135 |
+
#: ../inc/settings.php:181
|
136 |
+
msgid ""
|
137 |
+
"If you enter your purchase code you get updates automatically via WordPress' "
|
138 |
+
"internal update functionality."
|
139 |
+
msgstr ""
|
140 |
+
|
141 |
+
#: ../inc/settings.php:181
|
142 |
+
msgid ""
|
143 |
+
"If you don' know where you can find your purchase code, please click here."
|
144 |
+
msgstr ""
|
145 |
+
|
146 |
+
#: ../inc/shortcodes.php:49
|
147 |
+
msgid "Click here to opt out."
|
148 |
+
msgstr ""
|
149 |
+
|
150 |
+
#: ../inc/shortcodes.php:55
|
151 |
+
msgid "No UA-Code has been entered. Please ask the admin to solve this issue!"
|
152 |
+
msgstr ""
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== Google Analytics Opt-Out ===
|
2 |
Contributors: wp-buddy, floriansimeth
|
3 |
-
Donate link:
|
4 |
-
Tags: google analytics, analytics, analytics opt-out, analytics opt out
|
5 |
-
Version: 0.
|
6 |
Requires at least: 3.7
|
7 |
-
Stable tag: 0.
|
8 |
-
Tested up to: 4.
|
9 |
License: GPLv2
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -16,40 +16,19 @@ Provides an Opt-Out functionality for Google Analytics
|
|
16 |
|
17 |
This plugin provides an Opt-Out functionality for Google Analytics by setting a cookie that prevents analytics.js to collect data.
|
18 |
|
19 |
-
Works perfectly together with the [
|
20 |
|
21 |
-
|
22 |
|
23 |
== Installation ==
|
24 |
|
25 |
* Install and activate the plugin via your WordPress Administration panel
|
26 |
-
* Go the "Settings" -> "Analytics Opt Out" and enter your UA-code (you don't need this step if
|
27 |
* IMPORTANT: Check the sourcecode of your website and make sure that the Analytics code is entered AFTER the opt-out code. Otherwise the Opt-Out feature will not work.
|
28 |
* Read the FAQ for more information.
|
29 |
|
30 |
== Frequently Asked Questions ==
|
31 |
|
32 |
-
= The opt-out code appears AFTER the Analytics code. What can I do? =
|
33 |
-
|
34 |
-
Use Yoasts Analytics plugin OR add the code manually:
|
35 |
-
|
36 |
-
add this code to your themes functions.php:
|
37 |
-
`<?php
|
38 |
-
// This stops the plugin to integrate the JS into the header
|
39 |
-
function my_gaoo_stop_head(){
|
40 |
-
return true;
|
41 |
-
}
|
42 |
-
add_filter('gaoo_stop_head', 'my_gaoo_stop_head');
|
43 |
-
?>`
|
44 |
-
|
45 |
-
Then open your themes header.php and add the following code BEFORE your Analytics code AND between `<head>` and `</head>`:
|
46 |
-
`<?php
|
47 |
-
if ( function_exists( 'gaoo_js' ) ) {
|
48 |
-
// echos out the Javascript
|
49 |
-
gaoo_js();
|
50 |
-
}
|
51 |
-
?>`
|
52 |
-
|
53 |
|
54 |
== Screenshots ==
|
55 |
|
@@ -61,6 +40,10 @@ if ( function_exists( 'gaoo_js' ) ) {
|
|
61 |
|
62 |
== Changelog ==
|
63 |
|
|
|
|
|
|
|
|
|
64 |
= 0.1.5 =
|
65 |
* Added Spanish translation
|
66 |
|
1 |
=== Google Analytics Opt-Out ===
|
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.0
|
6 |
Requires at least: 3.7
|
7 |
+
Stable tag: 2.0.0
|
8 |
+
Tested up to: 4.7
|
9 |
License: GPLv2
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
16 |
|
17 |
This plugin provides an Opt-Out functionality for Google Analytics by setting a cookie that prevents analytics.js to collect data.
|
18 |
|
19 |
+
Works perfectly together with the [Google Analytics by MonsterInsights Plugin](http://wordpress.org/plugins/google-analytics-for-wordpress/ "Google Analytics by MonsterInsights Plugin").
|
20 |
|
21 |
+
The free and the pro version have now been merged together. So you now can have the option to activate a banner, too! Enjoy!
|
22 |
|
23 |
== Installation ==
|
24 |
|
25 |
* Install and activate the plugin via your WordPress Administration panel
|
26 |
+
* Go the "Settings" -> "Analytics Opt Out" and enter your UA-code (you don't need this step if MonsterInsights plugin is active)
|
27 |
* IMPORTANT: Check the sourcecode of your website and make sure that the Analytics code is entered AFTER the opt-out code. Otherwise the Opt-Out feature will not work.
|
28 |
* Read the FAQ for more information.
|
29 |
|
30 |
== Frequently Asked Questions ==
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
== Screenshots ==
|
34 |
|
40 |
|
41 |
== Changelog ==
|
42 |
|
43 |
+
= 2.0.0 =
|
44 |
+
* The pro version is now free (this is it!)
|
45 |
+
* New: allow the complete deactivation of the banner.
|
46 |
+
|
47 |
= 0.1.5 =
|
48 |
* Added Spanish translation
|
49 |
|
uninstall.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
3 |
+
exit();
|
4 |
+
}
|
5 |
+
|
6 |
+
if ( ! WP_UNINSTALL_PLUGIN ) {
|
7 |
+
exit();
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var wpdb $wpdb
|
12 |
+
*/
|
13 |
+
global $wpdb;
|
14 |
+
|
15 |
+
if ( is_a( $wpdb, 'wpdb' ) ) {
|
16 |
+
// Delete options
|
17 |
+
$wpdb->query( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "gaoo_%"' );
|
18 |
+
}
|