Google Analytics for WordPress by MonsterInsights - Version 4.2.3

Version Description

  • Removed Dashboard widget.
  • Improvements to comment form tracking.
Download this release

Release Info

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

Code changes from version 4.2.2 to 4.2.3

Files changed (4) hide show
  1. googleanalytics.php +28 -33
  2. readme.txt +8 -8
  3. yst_plugin_tools.css +1 -1
  4. yst_plugin_tools.php +18 -51
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=v420
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.2.2
8
  Requires at least: 3.0
9
  Author URI: http://yoast.com/
10
  License: GPL
@@ -12,7 +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.2.2');
16
 
17
  /*
18
  * Admin User Interface
@@ -53,7 +53,7 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
53
  add_action( 'admin_menu', array(&$this, 'register_settings_page') );
54
 
55
  // Register the contextual help for the settings page
56
- add_action( 'contextual_help', array(&$this, 'plugin_help'), 10, 3 );
57
 
58
  // Give the settings page a nice icon in Ozh's menu
59
  add_filter( 'ozh_adminmenu_icon', array(&$this, 'add_ozh_adminmenu_icon' ) );
@@ -65,9 +65,6 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
65
  add_action('admin_print_scripts', array(&$this, 'config_page_scripts') );
66
  add_action('admin_print_styles', array(&$this, 'config_page_styles') );
67
 
68
- // Setup the dashboard news widget
69
- add_action('wp_dashboard_setup', array(&$this, 'widget_setup') );
70
-
71
  // Print stuff in the settings page's head
72
  add_action('admin_head', array(&$this, 'config_page_head') );
73
 
@@ -223,7 +220,7 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
223
  $options[$option_name] = '';
224
  }
225
 
226
- foreach (array('extrase', 'trackoutbound', 'admintracking', 'trackadsense', 'allowanchor', 'allowlinker', 'allowhash', 'rsslinktagging', 'advancedsettings', 'trackregistration', 'theme_updated', 'cv_loggedin', 'cv_authorname', 'cv_category', 'cv_all_categories', 'cv_tags', 'cv_year', 'cv_post_type', 'outboundpageview', 'downloadspageview', 'trackcrossdomain','gajslocalhosting', 'manual_uastring', 'taggfsubmit', 'wpec_tracking', 'shopp_tracking', 'anonymizeip', 'trackcommentform', 'debug','firebuglite', 'disable_pagespeed_tracking') as $option_name) {
227
  if (isset($_POST[$option_name]) && $_POST[$option_name] != 'off')
228
  $options[$option_name] = true;
229
  else
@@ -578,12 +575,6 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
578
  'desc' => 'All links to these domains will have the <a href="http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html#multipleDomains"><code>_link</code></a> code automatically attached. Separate domains/sub-domains with commas (eg. <code>dogs.example-petstore.com, cats.example-petstore.com</code>)',
579
  'content' => $this->textinput('othercrossdomains'),
580
  );
581
- $rows[] = array(
582
- 'id' => 'disable_pagespeed_tracking',
583
- 'label' => 'Disable Site Speed tracking',
584
- 'desc' => 'This disables the Site Speed tracking feature of Google Analytics that is enabled by default in this plugin.',
585
- 'content' => $this->checkbox('disable_pagespeed_tracking'),
586
- );
587
  $rows[] = array(
588
  'id' => 'customcode',
589
  'label' => 'Custom Code',
@@ -746,13 +737,19 @@ if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( '
746
  <?php
747
  if ( count($modules) > 0 )
748
  $this->postbox('toc','List of Available Modules',$this->toc($modules));
749
- $this->plugin_like();
750
- $this->postbox('donate','<strong class="red">Donate $10, $20 or $50!</strong>','<p>This plugin has cost me countless hours of work, if you use it, please donate a token of your appreciation!</p><br/><form style="margin-left:50px;" action="https://www.paypal.com/cgi-bin/webscr" method="post">
751
- <input type="hidden" name="cmd" value="_s-xclick">
752
- <input type="hidden" name="hosted_button_id" value="FW9FK4EBZ9FVJ">
753
- <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
754
- <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
755
- </form>');
 
 
 
 
 
 
756
  $this->plugin_support();
757
  $this->news();
758
  ?>
@@ -919,10 +916,10 @@ if ( ! class_exists( 'GA_Filter' ) ) {
919
  if ( isset($options['domain']) && $options['domain'] != "" )
920
  $push[] = "'_setDomainName','".$options['domain']."'";
921
 
922
- if ( $options['trackcrossdomain'] )
923
  $push[] = "'_setDomainName','".$options['primarycrossdomain']."'";
924
 
925
- if ( $options['allowhash'] )
926
  $push[] = "'_setAllowHash',false";
927
 
928
  if ( $options['cv_loggedin'] ) {
@@ -1018,10 +1015,6 @@ if ( ! class_exists( 'GA_Filter' ) ) {
1018
  $push[] = "'_trackPageview'";
1019
  }
1020
 
1021
- if ( !isset( $options['disable_pagespeed_tracking'] ) || !$options['disable_pagespeed_tracking'] ) {
1022
- $push[] = "'_trackPageLoadTime'";
1023
- }
1024
-
1025
  $push = apply_filters('yoast-ga-push-after-pageview',$push);
1026
 
1027
  if ( defined('WPSC_VERSION') && $options['wpec_tracking'] )
@@ -1151,9 +1144,11 @@ if ( $options['gajslocalhosting'] && !empty($options['gajsurl']) ) {
1151
  $trackBit = GA_Filter::ga_get_tracking_link('mailto', str_replace('mailto:','',$matches[3]),'');
1152
  } else if ( in_array($extension, $dlextensions) ) {
1153
  $trackBit = GA_Filter::ga_get_tracking_link('download', $matches[3],'');
1154
- } else if ( $target["domain"] != $origin["domain"] ){
1155
- $crossdomains = explode(',',str_replace(' ','',$options['othercrossdomains']));
1156
- if ( $options['trackcrossdomain'] && in_array($target["host"],$crossdomains) ) {
 
 
1157
  $trackBit = '_gaq.push([\'_link\', \'' . $matches[2] . '//' . $matches[3] . '\']); return false;"';
1158
  } else if ( $options['trackoutbound'] && in_array($options['domainorurl'], array('domain','url')) ) {
1159
  $url = $options['domainorurl'] == 'domain' ? $target["host"] : $matches[3];
@@ -1253,7 +1248,7 @@ if ( $options['gajslocalhosting'] && !empty($options['gajsurl']) ) {
1253
 
1254
  static $anchorPattern = '/(.*\s+.*?href\s*=\s*)["\'](.*?)["\'](.*)/';
1255
  preg_match($anchorPattern, $text, $matches);
1256
- if ($matches[2] == "") return $text;
1257
 
1258
  $trackBit = '';
1259
  $target = GA_Filter::ga_get_domain($matches[2]);
@@ -1460,7 +1455,7 @@ function track_comment_form_head() {
1460
  }
1461
  add_action('wp_print_scripts','track_comment_form_head');
1462
 
1463
- $comment_form_id = '';
1464
  function yoast_get_comment_form_id($args) {
1465
  global $comment_form_id;
1466
  $comment_form_id = $args['id_form'];
@@ -1478,7 +1473,7 @@ function yoast_track_comment_form() {
1478
  jQuery('#<?php echo $comment_form_id; ?>').submit(function() {
1479
  _gaq.push(
1480
  ['_setAccount','<?php echo $yoast_ga_options["uastring"]; ?>'],
1481
- ['_trackEvent','comment']
1482
  );
1483
  });
1484
  });
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=wpgaplugin&utm_content=v420
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.2.3
8
  Requires at least: 3.0
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.2.3');
16
 
17
  /*
18
  * Admin User Interface
53
  add_action( 'admin_menu', array(&$this, 'register_settings_page') );
54
 
55
  // Register the contextual help for the settings page
56
+ // add_action( 'contextual_help', array(&$this, 'plugin_help'), 10, 3 );
57
 
58
  // Give the settings page a nice icon in Ozh's menu
59
  add_filter( 'ozh_adminmenu_icon', array(&$this, 'add_ozh_adminmenu_icon' ) );
65
  add_action('admin_print_scripts', array(&$this, 'config_page_scripts') );
66
  add_action('admin_print_styles', array(&$this, 'config_page_styles') );
67
 
 
 
 
68
  // Print stuff in the settings page's head
69
  add_action('admin_head', array(&$this, 'config_page_head') );
70
 
220
  $options[$option_name] = '';
221
  }
222
 
223
+ foreach (array('extrase', 'trackoutbound', 'admintracking', 'trackadsense', 'allowanchor', 'allowlinker', 'allowhash', 'rsslinktagging', 'advancedsettings', 'trackregistration', 'theme_updated', 'cv_loggedin', 'cv_authorname', 'cv_category', 'cv_all_categories', 'cv_tags', 'cv_year', 'cv_post_type', 'outboundpageview', 'downloadspageview', 'trackcrossdomain','gajslocalhosting', 'manual_uastring', 'taggfsubmit', 'wpec_tracking', 'shopp_tracking', 'anonymizeip', 'trackcommentform', 'debug','firebuglite') as $option_name) {
224
  if (isset($_POST[$option_name]) && $_POST[$option_name] != 'off')
225
  $options[$option_name] = true;
226
  else
575
  'desc' => 'All links to these domains will have the <a href="http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html#multipleDomains"><code>_link</code></a> code automatically attached. Separate domains/sub-domains with commas (eg. <code>dogs.example-petstore.com, cats.example-petstore.com</code>)',
576
  'content' => $this->textinput('othercrossdomains'),
577
  );
 
 
 
 
 
 
578
  $rows[] = array(
579
  'id' => 'customcode',
580
  'label' => 'Custom Code',
737
  <?php
738
  if ( count($modules) > 0 )
739
  $this->postbox('toc','List of Available Modules',$this->toc($modules));
740
+ $this->postbox('donate','<strong class="red">'.__( 'Help Spread the Word!' ).'</strong>','<p><strong>'.__( 'Want to help make this plugin even better? All donations are used to improve this plugin, so donate $20, $50 or $100 now!' ).'</strong></p><form style="width:160px;margin:0 auto;" action="https://www.paypal.com/cgi-bin/webscr" method="post">
741
+ <input type="hidden" name="cmd" value="_s-xclick">
742
+ <input type="hidden" name="hosted_button_id" value="FW9FK4EBZ9FVJ">
743
+ <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit">
744
+ <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
745
+ </form>'
746
+ .'<p>'.__('Or you could:').'</p>'
747
+ .'<ul>'
748
+ .'<li><a href="http://wordpress.org/extend/plugins/google-analytics-for-wordpress/">'.__('Rate the plugin 5★ on WordPress.org').'</a></li>'
749
+ .'<li><a href="http://wordpress.org/tags/google-analytics-for-wordpress">'.__('Help out other users in the forums').'</a></li>'
750
+ .'<li>'.sprintf( __('Blog about it & link to the %1$splugin page%2$s'), '<a href="http://yoast.com/wordpress/google-analytics/#utm_source=wpadmin&utm_medium=sidebanner&utm_term=link&utm_campaign=wpgaplugin">', '</a>').'</li>');
751
+ $this->postbox('sitereview','<strong>'.__('Want to Improve your Site?').'</strong>','<p>'.sprintf( __('If you want to improve your site, but don\'t know where to start, you should order a %1$swebsite review%2$s from Yoast!'), '<a href="http://yoast.com/hire-me/website-review/#utm_source=wpadmin&utm_medium=sidebanner&utm_term=link&utm_campaign=wpgaplugin">', '</a>').'</p>'.'<p>'.__('The results of this review contain a full report of improvements for your site, encompassing my findings for improvements in different key areas such as SEO to Usability to Site Speed & more.').'</p>'.'<p><a class="button-secondary" href="http://yoast.com/hire-me/website-review/#utm_source=wpadmin&utm_medium=sidebanner&utm_term=button&utm_campaign=wpgaplugin">'.__('Click here to read more &raquo;').'</a></p>');
752
+
753
  $this->plugin_support();
754
  $this->news();
755
  ?>
916
  if ( isset($options['domain']) && $options['domain'] != "" )
917
  $push[] = "'_setDomainName','".$options['domain']."'";
918
 
919
+ if ( isset($options['trackcrossdomain']) && $options['trackcrossdomain'] )
920
  $push[] = "'_setDomainName','".$options['primarycrossdomain']."'";
921
 
922
+ if ( isset($options['allowhash']) && $options['allowhash'] )
923
  $push[] = "'_setAllowHash',false";
924
 
925
  if ( $options['cv_loggedin'] ) {
1015
  $push[] = "'_trackPageview'";
1016
  }
1017
 
 
 
 
 
1018
  $push = apply_filters('yoast-ga-push-after-pageview',$push);
1019
 
1020
  if ( defined('WPSC_VERSION') && $options['wpec_tracking'] )
1144
  $trackBit = GA_Filter::ga_get_tracking_link('mailto', str_replace('mailto:','',$matches[3]),'');
1145
  } else if ( in_array($extension, $dlextensions) ) {
1146
  $trackBit = GA_Filter::ga_get_tracking_link('download', $matches[3],'');
1147
+ } else if ( $target["domain"] != $origin["domain"] ){
1148
+ $crossdomains = array();
1149
+ if (isset($options['othercrossdomains']))
1150
+ $crossdomains = explode(',',str_replace(' ','',$options['othercrossdomains']));
1151
+ if ( isset($options['trackcrossdomain']) && $options['trackcrossdomain'] && in_array($target["host"],$crossdomains) ) {
1152
  $trackBit = '_gaq.push([\'_link\', \'' . $matches[2] . '//' . $matches[3] . '\']); return false;"';
1153
  } else if ( $options['trackoutbound'] && in_array($options['domainorurl'], array('domain','url')) ) {
1154
  $url = $options['domainorurl'] == 'domain' ? $target["host"] : $matches[3];
1248
 
1249
  static $anchorPattern = '/(.*\s+.*?href\s*=\s*)["\'](.*?)["\'](.*)/';
1250
  preg_match($anchorPattern, $text, $matches);
1251
+ if (!isset($matches[2]) || $matches[2] == "") return $text;
1252
 
1253
  $trackBit = '';
1254
  $target = GA_Filter::ga_get_domain($matches[2]);
1455
  }
1456
  add_action('wp_print_scripts','track_comment_form_head');
1457
 
1458
+ $comment_form_id = 'commentform';
1459
  function yoast_get_comment_form_id($args) {
1460
  global $comment_form_id;
1461
  $comment_form_id = $args['id_form'];
1473
  jQuery('#<?php echo $comment_form_id; ?>').submit(function() {
1474
  _gaq.push(
1475
  ['_setAccount','<?php echo $yoast_ga_options["uastring"]; ?>'],
1476
+ ['_trackEvent','comment','submit']
1477
  );
1478
  });
1479
  });
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.2.1
7
- Stable tag: 4.2.2
8
 
9
  Track your WordPress site easily and with lots of metadata: views per author & category, automatic tracking of outbound clicks and pageviews.
10
 
@@ -43,10 +43,9 @@ Full list of features:
43
 
44
  Other interesting stuff:
45
 
46
- * Check out the other [Wordpress plugins](http://yoast.com/wordpress/) by the same author.
47
  * Want to increase traffic to your WordPress blog? Check out the [WordPress SEO](http://yoast.com/articles/wordpress-seo/) Guide!
48
  * Check out the authors [WordPress Hosting](http://yoast.com/articles/wordpress-hosting/) experience. Good hosting is hard to come by, but it doesn't have to be expensive, Joost tells you why!
49
- * If you've still not seen enough, or you'd rather listen than read, check out the [WordPress Podcast](http://wp-community.org/), hosted by the author of this plugin and Frederick Townes, the creator of [W3 Total Cache](http://wordpress.org/extend/plugins/w3-total-cache/).
50
 
51
  == Installation ==
52
 
@@ -59,6 +58,11 @@ This section describes how to install the plugin and get it working.
59
 
60
  == Changelog ==
61
 
 
 
 
 
 
62
  = 4.2.2 =
63
 
64
  * Fix for OAuth issues, caused by other plugins that don't check for the existence of a class. Namespaced the whole thing to prevent it.
@@ -337,7 +341,3 @@ Because that's where it belongs. It makes the page load faster (yes, faster, due
337
  5. Screenshot of the debugging mode in action.
338
 
339
  == Upgrade Notice ==
340
-
341
- = 4.0.11 =
342
-
343
- You can now properly disable the comment form tracking, and the charset attribute on script tags is gone so you can validate as HTML5 too.
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.3
7
+ Stable tag: 4.2.3
8
 
9
  Track your WordPress site easily and with lots of metadata: views per author & category, automatic tracking of outbound clicks and pageviews.
10
 
43
 
44
  Other interesting stuff:
45
 
46
+ * Check out the other [WordPress Plugins](http://yoast.com/wordpress/) by the same author.
47
  * Want to increase traffic to your WordPress blog? Check out the [WordPress SEO](http://yoast.com/articles/wordpress-seo/) Guide!
48
  * Check out the authors [WordPress Hosting](http://yoast.com/articles/wordpress-hosting/) experience. Good hosting is hard to come by, but it doesn't have to be expensive, Joost tells you why!
 
49
 
50
  == Installation ==
51
 
58
 
59
  == Changelog ==
60
 
61
+ = 4.2.3 =
62
+
63
+ * Removed Dashboard widget.
64
+ * Improvements to comment form tracking.
65
+
66
  = 4.2.2 =
67
 
68
  * Fix for OAuth issues, caused by other plugins that don't check for the existence of a class. Namespaced the whole thing to prevent it.
341
  5. Screenshot of the debugging mode in action.
342
 
343
  == Upgrade Notice ==
 
 
 
 
yst_plugin_tools.css CHANGED
@@ -71,7 +71,7 @@ div.inside ul li.yoast {
71
  }
72
 
73
  .side .postbox p, .side .postbox a, .side .postbox a.rsswidget {
74
- font-size: 11px;
75
  }
76
 
77
  div.inside .button:hover, div.inside .button-primary:hover {
71
  }
72
 
73
  .side .postbox p, .side .postbox a, .side .postbox a.rsswidget {
74
+ font-size: 13px;
75
  }
76
 
77
  div.inside .button:hover, div.inside .button-primary:hover {
yst_plugin_tools.php CHANGED
@@ -82,16 +82,22 @@ if (!class_exists('Yoast_GA_Plugin_Admin')) {
82
  * Create a Checkbox input field
83
  */
84
  function checkbox($id) {
85
- $options = get_option( $this->optionname );
86
- return '<input type="checkbox" id="'.$id.'" name="'.$id.'"'. checked($options[$id],true,false).'/>';
 
 
 
87
  }
88
 
89
  /**
90
  * Create a Text input field
91
  */
92
  function textinput($id) {
93
- $options = get_option( $this->optionname );
94
- return '<input class="text" type="text" id="'.$id.'" name="'.$id.'" size="30" value="'.$options[$id].'"/>';
 
 
 
95
  }
96
 
97
  /**
@@ -183,7 +189,7 @@ if (!class_exists('Yoast_GA_Plugin_Admin')) {
183
  if (empty($hook)) {
184
  $hook = $this->hook;
185
  }
186
- $content = '<p>'.sprintf( __( 'If you\'ve found a bug in this plugin, please submit it in the <a href="%s">Yoast Bug Tracker</a> with a clear description.', 'gawp_yoast' ), 'http://yoast.com/mantis/bug_report_page.php').'</p>';
187
  $this->postbox($this->hook.'support', __('Found a bug?', 'gawp_yoast' ), $content);
188
  }
189
 
@@ -198,17 +204,18 @@ if (!class_exists('Yoast_GA_Plugin_Admin')) {
198
  if ( !$rss_items ) {
199
  $content .= '<li class="yoast">'.__( 'No news items, feed might be broken...', 'gawp_yoast' ).'</li>';
200
  } else {
201
- foreach ( $rss_items as $item ) {
202
- $content .= '<li class="yoast">';
203
- $content .= '<a class="rsswidget" href="'.esc_url( $item->get_permalink(), $protocolls=null, 'display' ).'">'. esc_html($item->get_title()) .'</a> ';
204
- $content .= '</li>';
205
- }
 
206
  }
207
  $content .= '<li class="facebook"><a href="https://www.facebook.com/yoastcom">'.__( 'Like Yoast on Facebook', 'gawp_yoast' ).'</a></li>';
208
  $content .= '<li class="twitter"><a href="http://twitter.com/yoast">'.__( 'Follow Yoast on Twitter', 'gawp_yoast' ).'</a></li>';
209
  $content .= '<li class="googleplus"><a href="https://plus.google.com/115369062315673853712/posts">'.__( 'Circle Yoast on Google+', 'gawp_yoast' ).'</a></li>';
210
  $content .= '<li class="rss"><a href="http://yoast.com/feed/">'.__( 'Subscribe with RSS', 'gawp_yoast' ).'</a></li>';
211
- $content .= '<li class="email"><a href="http://yoast.com/email-blog-updates/">'.__( 'Subscribe by email', 'gawp_yoast' ).'</a></li>';
212
  $content .= '</ul>';
213
  $this->postbox('yoastlatest', __( 'Latest news from Yoast', 'gawp_yoast' ), $content);
214
  }
@@ -222,46 +229,6 @@ if (!class_exists('Yoast_GA_Plugin_Admin')) {
222
  return $text;
223
  }
224
 
225
- function db_widget() {
226
- $options = get_option('yoastdbwidget');
227
- if (isset($_POST['yoast_removedbwidget'])) {
228
- $options['removedbwidget'] = true;
229
- update_option('yoastdbwidget',$options);
230
- }
231
- if ($options['removedbwidget']) {
232
- _e( "If you reload, this widget will be gone and never appear again, unless you decide to delete the database option 'yoastdbwidget'.", 'gawp_yoast' );
233
- return;
234
- }
235
- require_once(ABSPATH.WPINC.'/rss.php');
236
- if ( $rss = fetch_rss( 'http://yoast.com/feed/' ) ) {
237
- echo '<div class="rss-widget">';
238
- echo '<a href="http://yoast.com/" title="Go to Yoast.com"><img src="'.plugin_dir_url( __FILE__ ).'images/yoast-logo-rss.png" class="alignright" alt="Yoast"/></a>';
239
- echo '<ul>';
240
- $rss->items = array_slice( $rss->items, 0, 3 );
241
- foreach ( (array) $rss->items as $item ) {
242
- echo '<li>';
243
- echo '<a class="rsswidget" href="'.clean_url( $item['link'], $protocolls=null, 'display' ).'">'. esc_html($item['title']) .'</a> ';
244
- echo '<span class="rss-date">'. date('F j, Y', strtotime($item['pubdate'])) .'</span>';
245
- echo '<div class="rssSummary">'. $this->text_limit($item['summary'],250) .'</div>';
246
- echo '</li>';
247
- }
248
- echo '</ul>';
249
- echo '<div style="border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">';
250
- echo '<a href="http://feeds2.feedburner.com/joostdevalk"><img src="'.get_bloginfo('wpurl').'/wp-includes/images/rss.png" alt=""/> Subscribe with RSS</a>';
251
- echo ' &nbsp; &nbsp; &nbsp; ';
252
- echo '<a href="http://yoast.com/email-blog-updates/"><img src="'.plugin_dir_url( __FILE__ ).'images/email_sub.png" alt=""/> '.__( 'Subscribe by email', 'gawp_yoast' ).'</a>';
253
- echo '<form class="alignright" method="post"><input type="hidden" name="yoast_removedbwidget" value="true"/><input title="'.__( 'Remove this widget from all users dashboards', 'gawp_yoast' ).'" type="submit" value="X"/></form>';
254
- echo '</div>';
255
- echo '</div>';
256
- }
257
- }
258
-
259
- function widget_setup() {
260
- $options = get_option('yoastdbwidget');
261
- if (!$options['removedbwidget'])
262
- wp_add_dashboard_widget( 'yoast_db_widget' , __( 'The Latest news from Yoast', 'gawp_yoast' ) , array(&$this, 'db_widget'));
263
- }
264
  }
265
  }
266
 
267
- ?>
82
  * Create a Checkbox input field
83
  */
84
  function checkbox($id) {
85
+ $options = get_option( $this->optionname );
86
+ $checked = false;
87
+ if ( isset($options[$id]) )
88
+ $checked = true;
89
+ return '<input type="checkbox" id="'.$id.'" name="'.$id.'"'. checked($checked,true,false).'/>';
90
  }
91
 
92
  /**
93
  * Create a Text input field
94
  */
95
  function textinput($id) {
96
+ $options = get_option( $this->optionname );
97
+ $val = '';
98
+ if ( isset( $options[$id] ) )
99
+ $val = $options[$id];
100
+ return '<input class="text" type="text" id="'.$id.'" name="'.$id.'" size="30" value="'.$val.'"/>';
101
  }
102
 
103
  /**
189
  if (empty($hook)) {
190
  $hook = $this->hook;
191
  }
192
+ $content = '<p>'.sprintf( __( 'If you\'ve found a bug in this plugin, please submit it in the <a href="%s">Yoast Bug Tracker</a> with a clear description.', 'gawp_yoast' ), 'http://yoast.com/bugs/google-analytics/').'</p>';
193
  $this->postbox($this->hook.'support', __('Found a bug?', 'gawp_yoast' ), $content);
194
  }
195
 
204
  if ( !$rss_items ) {
205
  $content .= '<li class="yoast">'.__( 'No news items, feed might be broken...', 'gawp_yoast' ).'</li>';
206
  } else {
207
+ foreach ( $rss_items as $item ) {
208
+ $url = preg_replace( '/#.*/', '', esc_url( $item->get_permalink(), $protocolls=null, 'display' ) );
209
+ $content .= '<li class="yoast">';
210
+ $content .= '<a class="rsswidget" href="'.$url.'#utm_source=wpadmin&utm_medium=sidebarwidget&utm_term=newsitem&utm_campaign=wpgaplugin">'. esc_html( $item->get_title() ) .'</a> ';
211
+ $content .= '</li>';
212
+ }
213
  }
214
  $content .= '<li class="facebook"><a href="https://www.facebook.com/yoastcom">'.__( 'Like Yoast on Facebook', 'gawp_yoast' ).'</a></li>';
215
  $content .= '<li class="twitter"><a href="http://twitter.com/yoast">'.__( 'Follow Yoast on Twitter', 'gawp_yoast' ).'</a></li>';
216
  $content .= '<li class="googleplus"><a href="https://plus.google.com/115369062315673853712/posts">'.__( 'Circle Yoast on Google+', 'gawp_yoast' ).'</a></li>';
217
  $content .= '<li class="rss"><a href="http://yoast.com/feed/">'.__( 'Subscribe with RSS', 'gawp_yoast' ).'</a></li>';
218
+ $content .= '<li class="email"><a href="http://yoast.com/email-blog-updates/#utm_source=wpadmin&utm_medium=sidebarwidget&utm_term=emailsubscribe&utm_campaign=wpgaplugin">'.__( 'Subscribe by email', 'gawp_yoast' ).'</a></li>';
219
  $content .= '</ul>';
220
  $this->postbox('yoastlatest', __( 'Latest news from Yoast', 'gawp_yoast' ), $content);
221
  }
229
  return $text;
230
  }
231
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  }
233
  }
234