Version Description
- Made plugin admin work with jQuery 1.6 and jQuery 1.4.
- Added contextual help.
- Improved cache flushing when using W3TC.
- Fixed various minor other notices.
- First stab at getting ready for full i18n compatibility.
Download this release
Release Info
| Developer | joostdevalk |
| Plugin | |
| Version | 4.1.1 |
| Comparing to | |
| See all releases | |
Code changes from version 4.1 to 4.1.1
- googleanalytics.php +65 -66
- readme.txt +10 -2
- yst_plugin_tools.php +17 -24
googleanalytics.php
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
Plugin Name: Google Analytics for WordPress
|
| 4 |
-
Plugin URI: http://yoast.com/wordpress/google-analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=google-analytics-for-wordpress&utm_content=
|
| 5 |
Description: This plugin makes it simple to add Google Analytics to your WordPress blog, adding lots of features, eg. custom variables and automatic clickout and download tracking.
|
| 6 |
Author: Joost de Valk
|
| 7 |
-
Version: 4.1
|
| 8 |
Requires at least: 2.8
|
| 9 |
Author URI: http://yoast.com/
|
| 10 |
License: GPL
|
|
@@ -12,12 +12,7 @@ License: GPL
|
|
| 12 |
|
| 13 |
// This plugin was originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics
|
| 14 |
|
| 15 |
-
define('GAWP_VERSION', '4.1');
|
| 16 |
-
|
| 17 |
-
// Determine the location
|
| 18 |
-
function gapp_plugin_path() {
|
| 19 |
-
return plugins_url('', __FILE__).'/';
|
| 20 |
-
}
|
| 21 |
|
| 22 |
/*
|
| 23 |
* Admin User Interface
|
|
@@ -38,56 +33,75 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
|
|
| 38 |
var $homepage = 'http://yoast.com/wordpress/google-analytics/';
|
| 39 |
var $toc = '';
|
| 40 |
|
|
|
|
|
|
|
|
|
|
| 41 |
function GA_Admin() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
$this->upgrade();
|
| 43 |
|
| 44 |
-
|
| 45 |
-
add_filter( 'plugin_action_links', array(&$this, 'add_action_link'), 10, 2 );
|
| 46 |
-
add_filter( 'ozh_adminmenu_icon', array(&$this, 'add_ozh_adminmenu_icon' ) );
|
| 47 |
-
|
| 48 |
-
add_action('admin_print_scripts', array(&$this,'config_page_scripts'));
|
| 49 |
-
add_action('admin_print_styles', array(&$this,'config_page_styles'));
|
| 50 |
|
| 51 |
-
|
|
|
|
| 52 |
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
-
|
|
|
|
| 56 |
|
| 57 |
-
|
|
|
|
|
|
|
| 58 |
|
| 59 |
-
|
|
|
|
| 60 |
|
| 61 |
-
|
|
|
|
| 62 |
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
}
|
| 65 |
|
| 66 |
function config_page_head() {
|
| 67 |
-
|
| 68 |
-
|
|
|
|
| 69 |
if (!empty($options['uastring'])) {
|
| 70 |
$uastring = $options['uastring'];
|
| 71 |
} else {
|
| 72 |
$uastring = '';
|
| 73 |
}
|
| 74 |
-
wp_enqueue_script('jquery');
|
| 75 |
|
| 76 |
?>
|
| 77 |
<script type="text/javascript">
|
| 78 |
-
function makeSublist(parent,child,childVal)
|
| 79 |
-
{
|
| 80 |
jQuery("body").append("<select style='display:none' id='"+parent+child+"'></select>");
|
| 81 |
jQuery('#'+parent+child).html(jQuery("#"+child+" option"));
|
| 82 |
|
| 83 |
-
var parentValue = jQuery('#'+parent).
|
| 84 |
jQuery('#'+child).html(jQuery("#"+parent+child+" .sub_"+parentValue).clone());
|
| 85 |
|
| 86 |
childVal = (typeof childVal == "undefined")? "" : childVal ;
|
| 87 |
jQuery("#"+child).val(childVal).attr('selected','selected');
|
| 88 |
|
| 89 |
jQuery('#'+parent).change(function(){
|
| 90 |
-
var parentValue = jQuery('#'+parent).
|
| 91 |
jQuery('#'+child).html(jQuery("#"+parent+child+" .sub_"+parentValue).clone());
|
| 92 |
jQuery('#'+child).trigger("change");
|
| 93 |
jQuery('#'+child).focus();
|
|
@@ -105,7 +119,7 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
|
|
| 105 |
}
|
| 106 |
}).change();
|
| 107 |
jQuery('#switchtomanual').change(function() {
|
| 108 |
-
if (
|
| 109 |
jQuery('#uastring_manual').css('display','block');
|
| 110 |
jQuery('#uastring_automatic').css('display','none');
|
| 111 |
} else {
|
|
@@ -114,7 +128,7 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
|
|
| 114 |
}
|
| 115 |
}).change();
|
| 116 |
jQuery('#trackoutbound').change(function(){
|
| 117 |
-
if (
|
| 118 |
jQuery('#internallinktracking').css("display","block");
|
| 119 |
jQuery('.internallinktracking').css("display","list-item");
|
| 120 |
} else {
|
|
@@ -123,7 +137,7 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
|
|
| 123 |
}
|
| 124 |
}).change();
|
| 125 |
jQuery('#advancedsettings').change(function(){
|
| 126 |
-
if (
|
| 127 |
jQuery('#advancedgasettings').css("display","block");
|
| 128 |
jQuery('#customvarsettings').css("display","block");
|
| 129 |
jQuery('.advancedgasettings').css("display","list-item");
|
|
@@ -136,14 +150,14 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
|
|
| 136 |
}
|
| 137 |
}).change();
|
| 138 |
jQuery('#extrase').change(function(){
|
| 139 |
-
if (
|
| 140 |
jQuery('#extrasebox').css("display","block");
|
| 141 |
} else {
|
| 142 |
jQuery('#extrasebox').css("display","none");
|
| 143 |
}
|
| 144 |
}).change();
|
| 145 |
jQuery('#gajslocalhosting').change(function(){
|
| 146 |
-
if (
|
| 147 |
jQuery('#localhostingbox').css("display","block");
|
| 148 |
} else {
|
| 149 |
jQuery('#localhostingbox').css("display","none");
|
|
@@ -151,53 +165,34 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
|
|
| 151 |
}).change();
|
| 152 |
jQuery('#customvarsettings :input').change(function() {
|
| 153 |
if (jQuery("#customvarsettings :input:checked").size() > 5) {
|
| 154 |
-
alert('The maximum number of allowed custom variables in Google Analytics is 5, please unselect one of the other custom variables before selecting this one.')
|
| 155 |
jQuery(this).attr('checked', false);
|
| 156 |
};
|
| 157 |
});
|
| 158 |
jQuery('#uastring').change(function(){
|
| 159 |
-
if (
|
| 160 |
if (!jQuery(this).val().match(/^UA-[\d-]+$/)) {
|
| 161 |
-
alert("That's not a valid UA ID, please make sure it matches the expected pattern of: UA-XXXXXX-X, and that there are no spaces or other characters in the input field.");
|
| 162 |
jQuery(this).focus();
|
| 163 |
}
|
| 164 |
}
|
| 165 |
});
|
| 166 |
});
|
| 167 |
</script>
|
| 168 |
-
<link rel="shortcut icon" href="<?php echo
|
| 169 |
<?php
|
| 170 |
}
|
| 171 |
}
|
| 172 |
|
| 173 |
function plugin_help($contextual_help, $screen_id, $screen) {
|
| 174 |
-
if ($screen_id ==
|
| 175 |
-
|
| 176 |
-
$contextual_help = '<
|
| 177 |
-
|
| 178 |
-
<li><strong>Option 1:</strong> This is Option 1 features.</li>
|
| 179 |
-
<li><strong>Option 2:</strong> This is Option 2 features.</li>
|
| 180 |
-
<li><strong>Option 3:</strong> This is Option 3 features.</li>
|
| 181 |
-
</ul>
|
| 182 |
-
<p>When you have made your choice, click apply.</p>';
|
| 183 |
}
|
| 184 |
return $contextual_help;
|
| 185 |
}
|
| 186 |
|
| 187 |
-
function theme_switch_warning() {
|
| 188 |
-
$options = get_option( $this->optionname );
|
| 189 |
-
if ($options['theme_updated']) {
|
| 190 |
-
echo "<div id='message' class='error'><p>You have updated your theme, please check your <a href='".$this->plugin_options_url()."'><strong>Google Analytics settings</strong></a> to make sure Google Analytics can still function correctly.</p></div>";
|
| 191 |
-
}
|
| 192 |
-
}
|
| 193 |
-
|
| 194 |
-
function switch_theme( $theme ) {
|
| 195 |
-
$options = get_option( $this->optionname );
|
| 196 |
-
$options['theme_updated'] = 1;
|
| 197 |
-
$options['position'] = 'header';
|
| 198 |
-
update_option( $this->optionname, $options );
|
| 199 |
-
}
|
| 200 |
-
|
| 201 |
function toc( $modules ) {
|
| 202 |
$output = '<ul>';
|
| 203 |
foreach ($modules as $module => $key) {
|
|
@@ -212,7 +207,7 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
|
|
| 212 |
|
| 213 |
if ( isset($_REQUEST['reset']) && $_REQUEST['reset'] == "true" && isset($_REQUEST['plugin']) && $_REQUEST['plugin'] == 'google-analytics-for-wordpress') {
|
| 214 |
$options = $this->set_defaults();
|
| 215 |
-
$options['msg'] = "<div class=\"updated\"><p>Google Analytics settings reset
|
| 216 |
} elseif ( isset($_POST['submit']) && isset($_POST['plugin']) && $_POST['plugin'] == 'google-analytics-for-wordpress') {
|
| 217 |
if (!current_user_can('manage_options')) die(__('You cannot edit the Google Analytics for WordPress options.'));
|
| 218 |
check_admin_referer('analyticspp-config');
|
|
@@ -238,7 +233,10 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
|
|
| 238 |
$cache = '';
|
| 239 |
if ( function_exists('w3tc_pgcache_flush') ) {
|
| 240 |
w3tc_pgcache_flush();
|
| 241 |
-
|
|
|
|
|
|
|
|
|
|
| 242 |
} else if ( function_exists('wp_cache_clear_cache') ) {
|
| 243 |
wp_cache_clear_cache();
|
| 244 |
$cache = ' and <strong>WP Super Cache cleared</strong>';
|
|
@@ -251,7 +249,7 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
|
|
| 251 |
}
|
| 252 |
|
| 253 |
function save_button() {
|
| 254 |
-
return '<div class="alignright"><input type="submit" class="button-primary" name="submit" value="Update Google Analytics Settings »" /></div><br class="clear"/>';
|
| 255 |
}
|
| 256 |
|
| 257 |
function upgrade() {
|
|
@@ -279,8 +277,8 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
|
|
| 279 |
|
| 280 |
?>
|
| 281 |
<div class="wrap">
|
| 282 |
-
<a href="http://yoast.com/"><div id="yoast-icon" style="background: url(<?php echo
|
| 283 |
-
<h2
|
| 284 |
<div class="postbox-container" style="width:65%;">
|
| 285 |
<div class="metabox-holder">
|
| 286 |
<div class="meta-box-sortables">
|
|
@@ -985,7 +983,7 @@ if ( ! class_exists( 'GA_Filter' ) ) {
|
|
| 985 |
if ( !empty($options["extraseurl"]) ) {
|
| 986 |
$url = $options["extraseurl"];
|
| 987 |
} else {
|
| 988 |
-
$url =
|
| 989 |
}
|
| 990 |
echo '</script><script src="'.$url.'" type="text/javascript"></script>'."\n".'<script type="text/javascript">';
|
| 991 |
}
|
|
@@ -1169,6 +1167,7 @@ if ( $options['gajslocalhosting'] && !empty($options['gajsurl']) ) {
|
|
| 1169 |
preg_match($anchorPattern, $text, $matches);
|
| 1170 |
if ($matches[2] == "") return $text;
|
| 1171 |
|
|
|
|
| 1172 |
$target = GA_Filter::ga_get_domain($matches[2]);
|
| 1173 |
$origin = GA_Filter::ga_get_domain($_SERVER["HTTP_HOST"]);
|
| 1174 |
if ( $target["domain"] != $origin["domain"] ){
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
Plugin Name: Google Analytics for WordPress
|
| 4 |
+
Plugin URI: http://yoast.com/wordpress/google-analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=google-analytics-for-wordpress&utm_content=v411
|
| 5 |
Description: This plugin makes it simple to add Google Analytics to your WordPress blog, adding lots of features, eg. custom variables and automatic clickout and download tracking.
|
| 6 |
Author: Joost de Valk
|
| 7 |
+
Version: 4.1.1
|
| 8 |
Requires at least: 2.8
|
| 9 |
Author URI: http://yoast.com/
|
| 10 |
License: GPL
|
| 12 |
|
| 13 |
// This plugin was originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics
|
| 14 |
|
| 15 |
+
define('GAWP_VERSION', '4.1.1');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
/*
|
| 18 |
* Admin User Interface
|
| 33 |
var $homepage = 'http://yoast.com/wordpress/google-analytics/';
|
| 34 |
var $toc = '';
|
| 35 |
|
| 36 |
+
/**
|
| 37 |
+
* PHP4 Constructor
|
| 38 |
+
*/
|
| 39 |
function GA_Admin() {
|
| 40 |
+
$this->__construct();
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Constructur, load all required stuff.
|
| 45 |
+
*/
|
| 46 |
+
function __construct() {
|
| 47 |
$this->upgrade();
|
| 48 |
|
| 49 |
+
$this->plugin_url = plugins_url( '', __FILE__ ).'/';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
+
// Register the settings page
|
| 52 |
+
add_action( 'admin_menu', array(&$this, 'register_settings_page') );
|
| 53 |
|
| 54 |
+
// Register the contextual help for the settings page
|
| 55 |
+
add_action( 'contextual_help', array(&$this, 'plugin_help'), 10, 3 );
|
| 56 |
+
|
| 57 |
+
// Give the settings page a nice icon in Ozh's menu
|
| 58 |
+
add_filter( 'ozh_adminmenu_icon', array(&$this, 'add_ozh_adminmenu_icon' ) );
|
| 59 |
|
| 60 |
+
// Give the plugin a settings link in the plugin overview
|
| 61 |
+
add_filter( 'plugin_action_links', array(&$this, 'add_action_link'), 10, 2 );
|
| 62 |
|
| 63 |
+
// Print Scripts and Styles
|
| 64 |
+
add_action('admin_print_scripts', array(&$this, 'config_page_scripts') );
|
| 65 |
+
add_action('admin_print_styles', array(&$this, 'config_page_styles') );
|
| 66 |
|
| 67 |
+
// Setup the dashboard news widget
|
| 68 |
+
add_action('wp_dashboard_setup', array(&$this, 'widget_setup') );
|
| 69 |
|
| 70 |
+
// Print stuff in the settings page's head
|
| 71 |
+
add_action('admin_head', array(&$this, 'config_page_head') );
|
| 72 |
|
| 73 |
+
// Drop a warning on each page of the admin when Google Analytics hasn't been configured
|
| 74 |
+
add_action('admin_footer', array(&$this, 'warning') );
|
| 75 |
+
|
| 76 |
+
// Save settings
|
| 77 |
+
// TODO: replace with Options API
|
| 78 |
+
add_action('admin_init', array(&$this, 'save_settings') );
|
| 79 |
}
|
| 80 |
|
| 81 |
function config_page_head() {
|
| 82 |
+
global $current_screen;
|
| 83 |
+
if ( 'settings_page_'.$this->hook == $current_screen->id ) {
|
| 84 |
+
$options = get_option( $this->optionname );
|
| 85 |
if (!empty($options['uastring'])) {
|
| 86 |
$uastring = $options['uastring'];
|
| 87 |
} else {
|
| 88 |
$uastring = '';
|
| 89 |
}
|
|
|
|
| 90 |
|
| 91 |
?>
|
| 92 |
<script type="text/javascript">
|
| 93 |
+
function makeSublist(parent,child,childVal) {
|
|
|
|
| 94 |
jQuery("body").append("<select style='display:none' id='"+parent+child+"'></select>");
|
| 95 |
jQuery('#'+parent+child).html(jQuery("#"+child+" option"));
|
| 96 |
|
| 97 |
+
var parentValue = jQuery('#'+parent).val();
|
| 98 |
jQuery('#'+child).html(jQuery("#"+parent+child+" .sub_"+parentValue).clone());
|
| 99 |
|
| 100 |
childVal = (typeof childVal == "undefined")? "" : childVal ;
|
| 101 |
jQuery("#"+child).val(childVal).attr('selected','selected');
|
| 102 |
|
| 103 |
jQuery('#'+parent).change(function(){
|
| 104 |
+
var parentValue = jQuery('#'+parent).val();
|
| 105 |
jQuery('#'+child).html(jQuery("#"+parent+child+" .sub_"+parentValue).clone());
|
| 106 |
jQuery('#'+child).trigger("change");
|
| 107 |
jQuery('#'+child).focus();
|
| 119 |
}
|
| 120 |
}).change();
|
| 121 |
jQuery('#switchtomanual').change(function() {
|
| 122 |
+
if ( jQuery('#switchtomanual').is(':checked') ) {
|
| 123 |
jQuery('#uastring_manual').css('display','block');
|
| 124 |
jQuery('#uastring_automatic').css('display','none');
|
| 125 |
} else {
|
| 128 |
}
|
| 129 |
}).change();
|
| 130 |
jQuery('#trackoutbound').change(function(){
|
| 131 |
+
if ( jQuery('#trackoutbound').is(':checked') ) {
|
| 132 |
jQuery('#internallinktracking').css("display","block");
|
| 133 |
jQuery('.internallinktracking').css("display","list-item");
|
| 134 |
} else {
|
| 137 |
}
|
| 138 |
}).change();
|
| 139 |
jQuery('#advancedsettings').change(function(){
|
| 140 |
+
if ( jQuery('#advancedsettings').is(':checked') ) {
|
| 141 |
jQuery('#advancedgasettings').css("display","block");
|
| 142 |
jQuery('#customvarsettings').css("display","block");
|
| 143 |
jQuery('.advancedgasettings').css("display","list-item");
|
| 150 |
}
|
| 151 |
}).change();
|
| 152 |
jQuery('#extrase').change(function(){
|
| 153 |
+
if ( jQuery('#extrase').is(':checked') ) {
|
| 154 |
jQuery('#extrasebox').css("display","block");
|
| 155 |
} else {
|
| 156 |
jQuery('#extrasebox').css("display","none");
|
| 157 |
}
|
| 158 |
}).change();
|
| 159 |
jQuery('#gajslocalhosting').change(function(){
|
| 160 |
+
if ( jQuery('#gajslocalhosting').is(':checked') ) {
|
| 161 |
jQuery('#localhostingbox').css("display","block");
|
| 162 |
} else {
|
| 163 |
jQuery('#localhostingbox').css("display","none");
|
| 165 |
}).change();
|
| 166 |
jQuery('#customvarsettings :input').change(function() {
|
| 167 |
if (jQuery("#customvarsettings :input:checked").size() > 5) {
|
| 168 |
+
alert("<?php _e('The maximum number of allowed custom variables in Google Analytics is 5, please unselect one of the other custom variables before selecting this one.'); ?>");
|
| 169 |
jQuery(this).attr('checked', false);
|
| 170 |
};
|
| 171 |
});
|
| 172 |
jQuery('#uastring').change(function(){
|
| 173 |
+
if ( jQuery('#switchtomanual').is(':checked') ) {
|
| 174 |
if (!jQuery(this).val().match(/^UA-[\d-]+$/)) {
|
| 175 |
+
alert("<?php _e('That\'s not a valid UA ID, please make sure it matches the expected pattern of: UA-XXXXXX-X, and that there are no spaces or other characters in the input field.'); ?>");
|
| 176 |
jQuery(this).focus();
|
| 177 |
}
|
| 178 |
}
|
| 179 |
});
|
| 180 |
});
|
| 181 |
</script>
|
| 182 |
+
<link rel="shortcut icon" href="<?php echo $this->plugin_url; ?>images/favicon.ico" />
|
| 183 |
<?php
|
| 184 |
}
|
| 185 |
}
|
| 186 |
|
| 187 |
function plugin_help($contextual_help, $screen_id, $screen) {
|
| 188 |
+
if ( $screen_id == 'settings_page_'.$this->hook ) {
|
| 189 |
+
|
| 190 |
+
$contextual_help = '<h2>'.__('Having problems?').'</h2>'.
|
| 191 |
+
'<p>'.sprintf( __("If you're having problems with this plugin, please refer to its <a href='%s'>FAQ page</a>."), 'http://yoast.com/wordpress/google-analytics/ga-wp-faq/' ).'</p>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
}
|
| 193 |
return $contextual_help;
|
| 194 |
}
|
| 195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
function toc( $modules ) {
|
| 197 |
$output = '<ul>';
|
| 198 |
foreach ($modules as $module => $key) {
|
| 207 |
|
| 208 |
if ( isset($_REQUEST['reset']) && $_REQUEST['reset'] == "true" && isset($_REQUEST['plugin']) && $_REQUEST['plugin'] == 'google-analytics-for-wordpress') {
|
| 209 |
$options = $this->set_defaults();
|
| 210 |
+
$options['msg'] = "<div class=\"updated\"><p>".__('Google Analytics settings reset.')."</p></div>\n";
|
| 211 |
} elseif ( isset($_POST['submit']) && isset($_POST['plugin']) && $_POST['plugin'] == 'google-analytics-for-wordpress') {
|
| 212 |
if (!current_user_can('manage_options')) die(__('You cannot edit the Google Analytics for WordPress options.'));
|
| 213 |
check_admin_referer('analyticspp-config');
|
| 233 |
$cache = '';
|
| 234 |
if ( function_exists('w3tc_pgcache_flush') ) {
|
| 235 |
w3tc_pgcache_flush();
|
| 236 |
+
w3tc_dbcache_flush();
|
| 237 |
+
w3tc_minify_flush();
|
| 238 |
+
w3tc_objectcache_flush();
|
| 239 |
+
$cache = ' and <strong>W3TC Caches cleared</strong>';
|
| 240 |
} else if ( function_exists('wp_cache_clear_cache') ) {
|
| 241 |
wp_cache_clear_cache();
|
| 242 |
$cache = ' and <strong>WP Super Cache cleared</strong>';
|
| 249 |
}
|
| 250 |
|
| 251 |
function save_button() {
|
| 252 |
+
return '<div class="alignright"><input type="submit" class="button-primary" name="submit" value="'.__('Update Google Analytics Settings »').'" /></div><br class="clear"/>';
|
| 253 |
}
|
| 254 |
|
| 255 |
function upgrade() {
|
| 277 |
|
| 278 |
?>
|
| 279 |
<div class="wrap">
|
| 280 |
+
<a href="http://yoast.com/"><div id="yoast-icon" style="background: url(<?php echo $this->plugin_url; ?>images/ga-icon-32x32.png) no-repeat;" class="icon32"><br /></div></a>
|
| 281 |
+
<h2><?php _e("Google Analytics for WordPress Configuration") ?></h2>
|
| 282 |
<div class="postbox-container" style="width:65%;">
|
| 283 |
<div class="metabox-holder">
|
| 284 |
<div class="meta-box-sortables">
|
| 983 |
if ( !empty($options["extraseurl"]) ) {
|
| 984 |
$url = $options["extraseurl"];
|
| 985 |
} else {
|
| 986 |
+
$url = $this->plugin_url.'custom_se_async.js';
|
| 987 |
}
|
| 988 |
echo '</script><script src="'.$url.'" type="text/javascript"></script>'."\n".'<script type="text/javascript">';
|
| 989 |
}
|
| 1167 |
preg_match($anchorPattern, $text, $matches);
|
| 1168 |
if ($matches[2] == "") return $text;
|
| 1169 |
|
| 1170 |
+
$trackBit = '';
|
| 1171 |
$target = GA_Filter::ga_get_domain($matches[2]);
|
| 1172 |
$origin = GA_Filter::ga_get_domain($_SERVER["HTTP_HOST"]);
|
| 1173 |
if ( $target["domain"] != $origin["domain"] ){
|
readme.txt
CHANGED
|
@@ -3,8 +3,8 @@ Contributors: joostdevalk
|
|
| 3 |
Donate link: http://yoast.com/donate/
|
| 4 |
Tags: analytics, google analytics, statistics, tracking, stats, google
|
| 5 |
Requires at least: 2.8
|
| 6 |
-
Tested up to: 3.
|
| 7 |
-
Stable tag: 4.1
|
| 8 |
|
| 9 |
Track your WordPress site easily and with lots of metadata: views per author & category, automatic tracking of outbound clicks and pageviews.
|
| 10 |
|
|
@@ -59,6 +59,14 @@ This section describes how to install the plugin and get it working.
|
|
| 59 |
|
| 60 |
== Changelog ==
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
= 4.1 =
|
| 63 |
|
| 64 |
* Added:
|
| 3 |
Donate link: http://yoast.com/donate/
|
| 4 |
Tags: analytics, google analytics, statistics, tracking, stats, google
|
| 5 |
Requires at least: 2.8
|
| 6 |
+
Tested up to: 3.2
|
| 7 |
+
Stable tag: 4.1.1
|
| 8 |
|
| 9 |
Track your WordPress site easily and with lots of metadata: views per author & category, automatic tracking of outbound clicks and pageviews.
|
| 10 |
|
| 59 |
|
| 60 |
== Changelog ==
|
| 61 |
|
| 62 |
+
= 4.1.1 =
|
| 63 |
+
|
| 64 |
+
* Made plugin admin work with jQuery 1.6 and jQuery 1.4.
|
| 65 |
+
* Added contextual help.
|
| 66 |
+
* Improved cache flushing when using W3TC.
|
| 67 |
+
* Fixed various minor other notices.
|
| 68 |
+
* First stab at getting ready for full i18n compatibility.
|
| 69 |
+
|
| 70 |
= 4.1 =
|
| 71 |
|
| 72 |
* Added:
|
yst_plugin_tools.php
CHANGED
|
@@ -8,6 +8,7 @@
|
|
| 8 |
if (!class_exists('Yoast_GA_Plugin_Admin')) {
|
| 9 |
class Yoast_GA_Plugin_Admin {
|
| 10 |
|
|
|
|
| 11 |
var $hook = '';
|
| 12 |
var $filename = '';
|
| 13 |
var $longname = '';
|
|
@@ -17,20 +18,12 @@ if (!class_exists('Yoast_GA_Plugin_Admin')) {
|
|
| 17 |
var $homepage = '';
|
| 18 |
var $accesslvl = 'edit_users';
|
| 19 |
|
| 20 |
-
function
|
| 21 |
-
add_action( 'admin_menu', array(&$this, 'register_settings_page') );
|
| 22 |
-
add_filter( 'plugin_action_links', array(&$this, 'add_action_link'), 10, 2 );
|
| 23 |
-
add_filter( 'ozh_adminmenu_icon', array(&$this, 'add_ozh_adminmenu_icon' ) );
|
| 24 |
-
|
| 25 |
-
add_action('admin_print_scripts', array(&$this,'config_page_scripts'));
|
| 26 |
-
add_action('admin_print_styles', array(&$this,'config_page_styles'));
|
| 27 |
-
|
| 28 |
-
add_action('wp_dashboard_setup', array(&$this,'widget_setup'));
|
| 29 |
}
|
| 30 |
|
| 31 |
function add_ozh_adminmenu_icon( $hook ) {
|
| 32 |
if ($hook == $this->hook)
|
| 33 |
-
return
|
| 34 |
return $hook;
|
| 35 |
}
|
| 36 |
|
|
@@ -40,7 +33,7 @@ if (!class_exists('Yoast_GA_Plugin_Admin')) {
|
|
| 40 |
wp_enqueue_style('thickbox');
|
| 41 |
wp_enqueue_style('global');
|
| 42 |
wp_enqueue_style('wp-admin');
|
| 43 |
-
wp_enqueue_style('
|
| 44 |
}
|
| 45 |
}
|
| 46 |
|
|
@@ -192,11 +185,11 @@ if (!class_exists('Yoast_GA_Plugin_Admin')) {
|
|
| 192 |
*/
|
| 193 |
function news() {
|
| 194 |
include_once(ABSPATH . WPINC . '/feed.php');
|
| 195 |
-
$rss = fetch_feed(
|
| 196 |
$rss_items = $rss->get_items( 0, $rss->get_item_quantity(5) );
|
| 197 |
$content = '<ul>';
|
| 198 |
if ( !$rss_items ) {
|
| 199 |
-
$content .= '<li class="yoast">
|
| 200 |
} else {
|
| 201 |
foreach ( $rss_items as $item ) {
|
| 202 |
$content .= '<li class="yoast">';
|
|
@@ -204,10 +197,10 @@ if (!class_exists('Yoast_GA_Plugin_Admin')) {
|
|
| 204 |
$content .= '</li>';
|
| 205 |
}
|
| 206 |
}
|
| 207 |
-
$content .= '<li class="rss"><a href="http://yoast.com/feed/">Subscribe with RSS</a></li>';
|
| 208 |
-
$content .= '<li class="email"><a href="http://yoast.com/email-blog-updates/">Subscribe by email</a></li>';
|
| 209 |
$content .= '</ul>';
|
| 210 |
-
$this->postbox('yoastlatest', 'Latest news from Yoast', $content);
|
| 211 |
}
|
| 212 |
|
| 213 |
function text_limit( $text, $limit, $finish = ' […]') {
|
|
@@ -226,13 +219,13 @@ if (!class_exists('Yoast_GA_Plugin_Admin')) {
|
|
| 226 |
update_option('yoastdbwidget',$options);
|
| 227 |
}
|
| 228 |
if ($options['removedbwidget']) {
|
| 229 |
-
|
| 230 |
return;
|
| 231 |
}
|
| 232 |
-
require_once(ABSPATH.WPINC.'/rss.php');
|
| 233 |
-
if ( $rss = fetch_rss(
|
| 234 |
echo '<div class="rss-widget">';
|
| 235 |
-
echo '<a href="http://yoast.com/" title="Go to Yoast.com"><img src="
|
| 236 |
echo '<ul>';
|
| 237 |
$rss->items = array_slice( $rss->items, 0, 3 );
|
| 238 |
foreach ( (array) $rss->items as $item ) {
|
|
@@ -244,10 +237,10 @@ if (!class_exists('Yoast_GA_Plugin_Admin')) {
|
|
| 244 |
}
|
| 245 |
echo '</ul>';
|
| 246 |
echo '<div style="border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">';
|
| 247 |
-
echo '<a href="http://feeds2.feedburner.com/joostdevalk"><img src="'.get_bloginfo('wpurl').'/wp-includes/images/rss.png" alt=""/> Subscribe with RSS</a>';
|
| 248 |
echo ' ';
|
| 249 |
-
echo '<a href="http://yoast.com/email-blog-updates/"><img src="
|
| 250 |
-
echo '<form class="alignright" method="post"><input type="hidden" name="yoast_removedbwidget" value="true"/><input title="Remove this widget from all users dashboards" type="submit" value="X"/></form>';
|
| 251 |
echo '</div>';
|
| 252 |
echo '</div>';
|
| 253 |
}
|
|
@@ -256,7 +249,7 @@ if (!class_exists('Yoast_GA_Plugin_Admin')) {
|
|
| 256 |
function widget_setup() {
|
| 257 |
$options = get_option('yoastdbwidget');
|
| 258 |
if (!$options['removedbwidget'])
|
| 259 |
-
wp_add_dashboard_widget( 'yoast_db_widget' , 'The Latest news from Yoast' , array(&$this, 'db_widget'));
|
| 260 |
}
|
| 261 |
}
|
| 262 |
}
|
| 8 |
if (!class_exists('Yoast_GA_Plugin_Admin')) {
|
| 9 |
class Yoast_GA_Plugin_Admin {
|
| 10 |
|
| 11 |
+
var $feed = 'http://yoast.com/feed/';
|
| 12 |
var $hook = '';
|
| 13 |
var $filename = '';
|
| 14 |
var $longname = '';
|
| 18 |
var $homepage = '';
|
| 19 |
var $accesslvl = 'edit_users';
|
| 20 |
|
| 21 |
+
function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
}
|
| 23 |
|
| 24 |
function add_ozh_adminmenu_icon( $hook ) {
|
| 25 |
if ($hook == $this->hook)
|
| 26 |
+
return $this->plugin_url.$this->ozhicon;
|
| 27 |
return $hook;
|
| 28 |
}
|
| 29 |
|
| 33 |
wp_enqueue_style('thickbox');
|
| 34 |
wp_enqueue_style('global');
|
| 35 |
wp_enqueue_style('wp-admin');
|
| 36 |
+
wp_enqueue_style('ga-admin-css', $this->plugin_url . 'yst_plugin_tools.css');
|
| 37 |
}
|
| 38 |
}
|
| 39 |
|
| 185 |
*/
|
| 186 |
function news() {
|
| 187 |
include_once(ABSPATH . WPINC . '/feed.php');
|
| 188 |
+
$rss = fetch_feed( $this->feed );
|
| 189 |
$rss_items = $rss->get_items( 0, $rss->get_item_quantity(5) );
|
| 190 |
$content = '<ul>';
|
| 191 |
if ( !$rss_items ) {
|
| 192 |
+
$content .= '<li class="yoast">'.__('No news items, feed might be broken...').'</li>';
|
| 193 |
} else {
|
| 194 |
foreach ( $rss_items as $item ) {
|
| 195 |
$content .= '<li class="yoast">';
|
| 197 |
$content .= '</li>';
|
| 198 |
}
|
| 199 |
}
|
| 200 |
+
$content .= '<li class="rss"><a href="http://yoast.com/feed/">'.__('Subscribe with RSS').'</a></li>';
|
| 201 |
+
$content .= '<li class="email"><a href="http://yoast.com/email-blog-updates/">'.__('Subscribe by email').'</a></li>';
|
| 202 |
$content .= '</ul>';
|
| 203 |
+
$this->postbox('yoastlatest', __('Latest news from Yoast'), $content);
|
| 204 |
}
|
| 205 |
|
| 206 |
function text_limit( $text, $limit, $finish = ' […]') {
|
| 219 |
update_option('yoastdbwidget',$options);
|
| 220 |
}
|
| 221 |
if ($options['removedbwidget']) {
|
| 222 |
+
_e("If you reload, this widget will be gone and never appear again, unless you decide to delete the database option 'yoastdbwidget'.");
|
| 223 |
return;
|
| 224 |
}
|
| 225 |
+
require_once( ABSPATH . WPINC .'/rss.php' );
|
| 226 |
+
if ( $rss = fetch_rss( $this->feed ) ) {
|
| 227 |
echo '<div class="rss-widget">';
|
| 228 |
+
echo '<a href="http://yoast.com/" title="'.__('Go to Yoast.com').'"><img src="'.$this->plugin_url.'images/yoast-logo-rss.png" class="alignright" alt="Yoast"/></a>';
|
| 229 |
echo '<ul>';
|
| 230 |
$rss->items = array_slice( $rss->items, 0, 3 );
|
| 231 |
foreach ( (array) $rss->items as $item ) {
|
| 237 |
}
|
| 238 |
echo '</ul>';
|
| 239 |
echo '<div style="border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">';
|
| 240 |
+
echo '<a href="http://feeds2.feedburner.com/joostdevalk"><img src="'.get_bloginfo('wpurl').'/wp-includes/images/rss.png" alt=""/> '.__('Subscribe with RSS').'</a>';
|
| 241 |
echo ' ';
|
| 242 |
+
echo '<a href="http://yoast.com/email-blog-updates/"><img src="'.$this->plugin_url.'images/email_sub.png" alt=""/> '.__('Subscribe by email').'</a>';
|
| 243 |
+
echo '<form class="alignright" method="post"><input type="hidden" name="yoast_removedbwidget" value="true"/><input title="'.__('Remove this widget from all users dashboards').'" type="submit" value="X"/></form>';
|
| 244 |
echo '</div>';
|
| 245 |
echo '</div>';
|
| 246 |
}
|
| 249 |
function widget_setup() {
|
| 250 |
$options = get_option('yoastdbwidget');
|
| 251 |
if (!$options['removedbwidget'])
|
| 252 |
+
wp_add_dashboard_widget( 'yoast_db_widget' , __('The Latest news from Yoast') , array(&$this, 'db_widget'));
|
| 253 |
}
|
| 254 |
}
|
| 255 |
}
|
