WP Google Analytics - Version 1.2.2

Version Description

Download this release

Release Info

Developer aaroncampbell
Plugin Icon wp plugin WP Google Analytics
Version 1.2.2
Comparing to
See all releases

Code changes from version 1.2.1 to 1.2.2

Files changed (2) hide show
  1. readme.txt +1 -1
  2. wp-google-analytics.php +9 -27
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal%4
4
  Tags: analytics, google, google analytics
5
  Requires at least: 1.5
6
  Tested up to: 2.5.1
7
- Stable tag: 1.2.1
8
 
9
  Lets you use <a href="http://analytics.google.com">Google Analytics</a> to track your WordPress site statistics
10
 
4
  Tags: analytics, google, google analytics
5
  Requires at least: 1.5
6
  Tested up to: 2.5.1
7
+ Stable tag: 1.2.2
8
 
9
  Lets you use <a href="http://analytics.google.com">Google Analytics</a> to track your WordPress site statistics
10
 
wp-google-analytics.php CHANGED
@@ -3,14 +3,17 @@
3
  * Plugin Name: WP Google Analytics
4
  * Plugin URI: http://xavisys.com/wordpress-google-analytics-plugin/
5
  * Description: Lets you use <a href="http://analytics.google.com">Google Analytics</a> to track your WordPress site statistics
6
- * Version: 1.2.1
7
  * Author: Aaron D. Campbell
8
  * Author URI: http://xavisys.com/
9
  */
10
 
11
- define('WGA_VERSION', '1.2.1');
12
  /**
13
  * Changelog:
 
 
 
14
  * 06/08/2008: 1.2.1
15
  * - Bug fix for the stats gathering
16
  *
@@ -148,7 +151,6 @@ class wpGoogleAnalytics {
148
  </form>
149
  </div>
150
  <?php
151
- wpGoogleAnalytics::outputSendInfoForm();
152
  }
153
 
154
  /**
@@ -188,8 +190,7 @@ class wpGoogleAnalytics {
188
  function insert_code($output=true) {
189
  //If $output is not a boolean false, set it to true (default)
190
  $output = ($output !== false);
191
- //This sets a static variable that says if the code has been inserted.
192
- wpGoogleAnalytics::code_inserted_static(true);
193
  //get our plugin options
194
  $wga = wpGoogleAnalytics::get_options();
195
  //If the user's role has wga_no_track set to true, return without inserting code
@@ -279,8 +280,8 @@ class wpGoogleAnalytics {
279
  */
280
  function start_ob() {
281
  $log_outgoing = wpGoogleAnalytics::get_options('log_outgoing');
282
- // Only start the output buffering if we care, and if it's NOT an XMLRPC REQUEST
283
- if (($log_outgoing == 'true' || $log_outgoing === false) && (!defined('XMLRPC_REQUEST') || !XMLRPC_REQUEST) && !is_admin()) {
284
  ob_start(array('wpGoogleAnalytics', 'get_links'));
285
  }
286
  }
@@ -307,10 +308,6 @@ class wpGoogleAnalytics {
307
  (?:\s[^>]*)? # other attibutes that we don't need
308
  \s*> #end of anchor tag
309
  /isUx", array('wpGoogleAnalytics', 'handle_link'), $b);
310
- //If the code hasn't been inserted, take drastic measures and add it here
311
- if (!wpGoogleAnalytics::code_inserted_static()) {
312
- $b = str_replace('</body>', wpGoogleAnalytics::insert_code(false).'</body>', $b);
313
- }
314
  return $b;
315
  }
316
 
@@ -352,22 +349,6 @@ class wpGoogleAnalytics {
352
  return $m[0];
353
  }
354
 
355
- /**
356
- * This is a lame PHP4 hack since PHP4 doesn't support static class variables.
357
- * One of these days I'm just going to say "screw people that won't upgrade"
358
- * and do ONLY PHP5
359
- *
360
- * @param mixed $set[optional] - What to set the static var to
361
- * @return mixed - value of static var
362
- */
363
- function code_inserted_static($set = null) {
364
- static $static = false;
365
- if (!is_null($set)) {
366
- $static = $set;
367
- }
368
- return $static;
369
- }
370
-
371
  function updateOption($oldValue, $newValue) {
372
  /**
373
  * @var WP_Roles
@@ -458,4 +439,5 @@ add_action('get_footer', array('wpGoogleAnalytics', 'insert_code'));
458
  add_action('init', array('wpGoogleAnalytics', 'start_ob'));
459
  add_action('update_option_wga-roles', array('wpGoogleAnalytics', 'updateOption'), null, 2);
460
  add_action('activate_wp-google-analytics/wp-google-analytics.php', array('wpGoogleAnalytics', 'activatePlugin'));
 
461
  ?>
3
  * Plugin Name: WP Google Analytics
4
  * Plugin URI: http://xavisys.com/wordpress-google-analytics-plugin/
5
  * Description: Lets you use <a href="http://analytics.google.com">Google Analytics</a> to track your WordPress site statistics
6
+ * Version: 1.2.2
7
  * Author: Aaron D. Campbell
8
  * Author URI: http://xavisys.com/
9
  */
10
 
11
+ define('WGA_VERSION', '1.2.2');
12
  /**
13
  * Changelog:
14
+ * 06/08/2008: 1.2.2
15
+ * - Fixed problem with code affecting Admin Javascript such as the TinyMCE editor
16
+ *
17
  * 06/08/2008: 1.2.1
18
  * - Bug fix for the stats gathering
19
  *
151
  </form>
152
  </div>
153
  <?php
 
154
  }
155
 
156
  /**
190
  function insert_code($output=true) {
191
  //If $output is not a boolean false, set it to true (default)
192
  $output = ($output !== false);
193
+
 
194
  //get our plugin options
195
  $wga = wpGoogleAnalytics::get_options();
196
  //If the user's role has wga_no_track set to true, return without inserting code
280
  */
281
  function start_ob() {
282
  $log_outgoing = wpGoogleAnalytics::get_options('log_outgoing');
283
+ // Only start the output buffering if we care, and if it's NOT an XMLRPC REQUEST & NOT a tinyMCE JS file & NOT in the admin section
284
+ if (($log_outgoing == 'true' || $log_outgoing === false) && (!defined('XMLRPC_REQUEST') || !XMLRPC_REQUEST) && !is_admin() && stripos($_SERVER['REQUEST_URI'], 'wp-includes/js/tinymce') === false) {
285
  ob_start(array('wpGoogleAnalytics', 'get_links'));
286
  }
287
  }
308
  (?:\s[^>]*)? # other attibutes that we don't need
309
  \s*> #end of anchor tag
310
  /isUx", array('wpGoogleAnalytics', 'handle_link'), $b);
 
 
 
 
311
  return $b;
312
  }
313
 
349
  return $m[0];
350
  }
351
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
352
  function updateOption($oldValue, $newValue) {
353
  /**
354
  * @var WP_Roles
439
  add_action('init', array('wpGoogleAnalytics', 'start_ob'));
440
  add_action('update_option_wga-roles', array('wpGoogleAnalytics', 'updateOption'), null, 2);
441
  add_action('activate_wp-google-analytics/wp-google-analytics.php', array('wpGoogleAnalytics', 'activatePlugin'));
442
+ add_action('admin_footer', array('wpGoogleAnalytics', 'outputSendInfoForm'));
443
  ?>