Google Analytics for WordPress by MonsterInsights - Version 2.6

Version Description

Download this release

Release Info

Developer joostdevalk
Plugin Icon 128x128 Google Analytics for WordPress by MonsterInsights
Version 2.6
Comparing to
See all releases

Code changes from version 2.5.6 to 2.6

Files changed (2) hide show
  1. googleanalytics.php +26 -29
  2. readme.txt +2 -1
googleanalytics.php CHANGED
@@ -4,14 +4,24 @@ Plugin Name: Google Analytics for WordPress
4
  Plugin URI: http://yoast.com/wordpress/analytics/
5
  Description: This plugin makes it simple to add Google Analytics with extra search engines and automatic clickout and download tracking to your WordPress blog.
6
  Author: Joost de Valk
7
- Version: 2.5.6
8
  Author URI: http://yoast.com/
9
  License: GPL
10
 
11
  Originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics
12
 
13
  */
14
- $gapppluginpath = str_replace(str_replace('\\', '/', ABSPATH), get_settings('siteurl').'/', str_replace('\\', '/', dirname(__FILE__))).'/';
 
 
 
 
 
 
 
 
 
 
15
  $uastring = "UA-00000-0";
16
 
17
  /*
@@ -54,13 +64,11 @@ if ( ! class_exists( 'GA_Admin' ) ) {
54
  $options['extrase'] = true;
55
  }
56
 
57
- $opt = serialize($options);
58
- update_option('GoogleAnalyticsPP', $opt);
59
  }
60
  $mulch = ($uastring=""?"##-#####-#":$uastring);
61
 
62
- $opt = get_option('GoogleAnalyticsPP');
63
- $options = unserialize($opt);
64
  ?>
65
  <div class="wrap">
66
  <script type="text/javascript">
@@ -256,8 +264,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
256
  $options['extrase'] = false;
257
  $options['imagese'] = false;
258
  $options['trackoutbound'] = true;
259
- $opt = serialize($options);
260
- update_option('GoogleAnalyticsPP',$opt);
261
  }
262
 
263
  function success() {
@@ -295,8 +302,7 @@ if ( ! class_exists( 'GA_Filter' ) ) {
295
  function spool_analytics() {
296
  global $gapppluginpath;
297
 
298
- $opt = get_option('GoogleAnalyticsPP');
299
- $options = unserialize($opt);
300
 
301
  if ($options["uastring"] != "" && (!current_user_can('edit_users') || $options["admintracking"]) && !is_preview() ) { ?>
302
  <!-- Google Analytics for WordPress | http://yoast.com/wordpress/google-analytics/ -->
@@ -350,8 +356,7 @@ if ( ! class_exists( 'GA_Filter' ) ) {
350
  function ga_parse_link($leaf, $matches){
351
  global $origin ;
352
 
353
- $opt = get_option('GoogleAnalyticsPP');
354
- $options = unserialize($opt);
355
 
356
  $target = GA_Filter::ga_get_domain($matches[3]);
357
  $coolbit = "";
@@ -372,14 +377,12 @@ if ( ! class_exists( 'GA_Filter' ) ) {
372
  }
373
 
374
  function ga_parse_article_link($matches){
375
- $opt = get_option('GoogleAnalyticsPP');
376
- $options = unserialize($opt);
377
  return GA_Filter::ga_parse_link($options['artprefix'],$matches);
378
  }
379
 
380
  function ga_parse_comment_link($matches){
381
- $opt = get_option('GoogleAnalyticsPP');
382
- $options = unserialize($opt);
383
  return GA_Filter::ga_parse_link($options['comprefix'],$matches);
384
  }
385
 
@@ -396,8 +399,7 @@ if ( ! class_exists( 'GA_Filter' ) ) {
396
  }
397
 
398
  function comment_author_link($text) {
399
- $opt = get_option('GoogleAnalyticsPP');
400
- $options = unserialize($opt);
401
 
402
  static $anchorPattern = '/(.*\s+.*?href\s*=\s*)["\'](.*?)["\'](.*)/';
403
  preg_match($anchorPattern, $text, $matches);
@@ -418,8 +420,7 @@ if ( ! class_exists( 'GA_Filter' ) ) {
418
 
419
  function bookmarks($bookmarks) {
420
  if (!is_admin() && (!current_user_can('edit_users') || $options['admintracking'] ) ) {
421
- $opt = get_option('GoogleAnalyticsPP');
422
- $options = unserialize($opt);
423
 
424
  foreach ( (array) $bookmarks as $bookmark ) {
425
  if ($options['domainorurl'] == "domain") {
@@ -440,8 +441,7 @@ $uakey = "analytics";
440
 
441
  if (function_exists("get_option")) {
442
  if ($wp_uastring_takes_precedence) {
443
- $opt = get_option('GoogleAnalyticsPP');
444
- $options = unserialize($opt);
445
  $uastring = $options['uastring'];
446
  }
447
  }
@@ -450,9 +450,9 @@ $mulch = ($uastring=""?"##-#####-#":$uastring);
450
  $gaf = new GA_Filter();
451
  $origin = $gaf->ga_get_domain($_SERVER["HTTP_HOST"]);
452
 
453
- $opt = get_option('GoogleAnalyticsPP',"");
454
 
455
- if ($opt == "") {
456
  $options['dlextensions'] = 'doc,exe,.js,pdf,ppt,tgz,zip,xls';
457
  $options['dlprefix'] = '/downloads';
458
  $options['artprefix'] = '/outbound/article';
@@ -465,11 +465,8 @@ if ($opt == "") {
465
  $options['extrase'] = false;
466
  $options['imagese'] = false;
467
  $options['trackoutbound'] = true;
468
- $opt = serialize($options);
469
- update_option('GoogleAnalyticsPP',$opt);
470
- } else {
471
- $options = unserialize($opt);
472
- }
473
 
474
  // adds the menu item to the admin interface
475
  add_action('admin_menu', array('GA_Admin','add_config_page'));
4
  Plugin URI: http://yoast.com/wordpress/analytics/
5
  Description: This plugin makes it simple to add Google Analytics with extra search engines and automatic clickout and download tracking to your WordPress blog.
6
  Author: Joost de Valk
7
+ Version: 2.6
8
  Author URI: http://yoast.com/
9
  License: GPL
10
 
11
  Originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics
12
 
13
  */
14
+
15
+ // Pre-2.6 compatibility
16
+ if ( !defined('WP_CONTENT_URL') )
17
+ define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
18
+ if ( !defined('WP_CONTENT_DIR') )
19
+ define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
20
+
21
+ // Guess the location
22
+ $gapppluginpath = WP_CONTENT_DIR.'/plugins/'.plugin_basename(dirname(__FILE__));
23
+ $plugin_url = WP_CONTENT_URL.'/plugins/'.plugin_basename(dirname(__FILE__));
24
+
25
  $uastring = "UA-00000-0";
26
 
27
  /*
64
  $options['extrase'] = true;
65
  }
66
 
67
+ update_option('GoogleAnalyticsPP', $options);
 
68
  }
69
  $mulch = ($uastring=""?"##-#####-#":$uastring);
70
 
71
+ $options = get_option('GoogleAnalyticsPP');
 
72
  ?>
73
  <div class="wrap">
74
  <script type="text/javascript">
264
  $options['extrase'] = false;
265
  $options['imagese'] = false;
266
  $options['trackoutbound'] = true;
267
+ update_option('GoogleAnalyticsPP',$options);
 
268
  }
269
 
270
  function success() {
302
  function spool_analytics() {
303
  global $gapppluginpath;
304
 
305
+ $options = get_option('GoogleAnalyticsPP');
 
306
 
307
  if ($options["uastring"] != "" && (!current_user_can('edit_users') || $options["admintracking"]) && !is_preview() ) { ?>
308
  <!-- Google Analytics for WordPress | http://yoast.com/wordpress/google-analytics/ -->
356
  function ga_parse_link($leaf, $matches){
357
  global $origin ;
358
 
359
+ $options = get_option('GoogleAnalyticsPP');
 
360
 
361
  $target = GA_Filter::ga_get_domain($matches[3]);
362
  $coolbit = "";
377
  }
378
 
379
  function ga_parse_article_link($matches){
380
+ $options = get_option('GoogleAnalyticsPP');
 
381
  return GA_Filter::ga_parse_link($options['artprefix'],$matches);
382
  }
383
 
384
  function ga_parse_comment_link($matches){
385
+ $options = get_option('GoogleAnalyticsPP');
 
386
  return GA_Filter::ga_parse_link($options['comprefix'],$matches);
387
  }
388
 
399
  }
400
 
401
  function comment_author_link($text) {
402
+ $options = get_option('GoogleAnalyticsPP');
 
403
 
404
  static $anchorPattern = '/(.*\s+.*?href\s*=\s*)["\'](.*?)["\'](.*)/';
405
  preg_match($anchorPattern, $text, $matches);
420
 
421
  function bookmarks($bookmarks) {
422
  if (!is_admin() && (!current_user_can('edit_users') || $options['admintracking'] ) ) {
423
+ $options = get_option('GoogleAnalyticsPP');
 
424
 
425
  foreach ( (array) $bookmarks as $bookmark ) {
426
  if ($options['domainorurl'] == "domain") {
441
 
442
  if (function_exists("get_option")) {
443
  if ($wp_uastring_takes_precedence) {
444
+ $options = get_option('GoogleAnalyticsPP');
 
445
  $uastring = $options['uastring'];
446
  }
447
  }
450
  $gaf = new GA_Filter();
451
  $origin = $gaf->ga_get_domain($_SERVER["HTTP_HOST"]);
452
 
453
+ $options = get_option('GoogleAnalyticsPP',"");
454
 
455
+ if ($options == "") {
456
  $options['dlextensions'] = 'doc,exe,.js,pdf,ppt,tgz,zip,xls';
457
  $options['dlprefix'] = '/downloads';
458
  $options['artprefix'] = '/outbound/article';
465
  $options['extrase'] = false;
466
  $options['imagese'] = false;
467
  $options['trackoutbound'] = true;
468
+ update_option('GoogleAnalyticsPP',$options);
469
+ }
 
 
 
470
 
471
  // adds the menu item to the admin interface
472
  add_action('admin_menu', array('GA_Admin','add_config_page'));
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://yoast.com/donate/
4
  Tags: analytics, google analytics, statistics
5
  Requires at least: 2.2
6
  Tested up to: 2.5.1
7
- Stable tag: 2.5.6
8
 
9
  The Google Analytics for WordPress plugin automatically tracks and segments all outbound links from within posts, comment author links, links within comments, blogroll links and downloads. It also allows you to track AdSense clicks, add extra search engines, track image search queries and it will even work together with Urchin.
10
 
@@ -29,6 +29,7 @@ This section describes how to install the plugin and get it working.
29
 
30
  == Changelog ==
31
 
 
32
  1. 2.5.4: fixed an issue with pluginpath being used globally, and changed links to new domain.
33
  1. 2.2: switched to the new tracking code
34
  1. 2.1: made sure tracking was disabled on preview pages
4
  Tags: analytics, google analytics, statistics
5
  Requires at least: 2.2
6
  Tested up to: 2.5.1
7
+ Stable tag: 2.6
8
 
9
  The Google Analytics for WordPress plugin automatically tracks and segments all outbound links from within posts, comment author links, links within comments, blogroll links and downloads. It also allows you to track AdSense clicks, add extra search engines, track image search queries and it will even work together with Urchin.
10
 
29
 
30
  == Changelog ==
31
 
32
+ 1. 2.6: fixed incompatibility with WP 2.6
33
  1. 2.5.4: fixed an issue with pluginpath being used globally, and changed links to new domain.
34
  1. 2.2: switched to the new tracking code
35
  1. 2.1: made sure tracking was disabled on preview pages