Clicky by Yoast - Version 1.1

Version Description

  • Switched to the new asynchronous javascript.
  • Added tracking of category and author as custom variables.
  • Fixed the bug that caused tweeting of updated posts.
  • Some slight updates to the backend.
Download this release

Release Info

Developer joostdevalk
Plugin Icon 128x128 Clicky by Yoast
Version 1.1
Comparing to
See all releases

Code changes from version 1.0.6 to 1.1

clicky.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Clicky for WordPress
4
- Version: 1.0.6
5
  Plugin URI: http://getclicky.com/goodies/#wordpress
6
  Description: Integrates Clicky on your blog!
7
  Author: Joost de Valk
@@ -95,7 +95,7 @@ if ( ! class_exists( 'Clicky_Admin' ) ) {
95
  add_action('admin_print_styles', array(&$this,'config_page_styles'));
96
 
97
  add_action('admin_menu', array(&$this,'meta_box'));
98
- add_action('wp_insert_post', array(&$this,'clicky_insert_post'));
99
 
100
  $this->clicky_admin_warnings();
101
  }
@@ -166,7 +166,7 @@ if ( ! class_exists( 'Clicky_Admin' ) ) {
166
  }
167
  ?>
168
  <div class="wrap">
169
- <a href="http://getclicky.com/"><div id="clicky-icon" style="background: url(<?php echo plugins_url('',__FILE__); ?>/clicky-32x32.png) no-repeat;" class="icon32"><br /></div></a>
170
  <h2>Clicky <?php _e("Configuration",'clicky'); ?></h2>
171
  <div class="postbox-container" style="width:70%;">
172
  <div class="metabox-holder">
@@ -397,11 +397,11 @@ function clicky_script() {
397
  // Branding
398
  ?>
399
  <!-- Clicky Web Analytics - http://getclicky.com, WordPress Plugin by Yoast - http://yoast.com -->
400
- <?php
401
- // Track commenter name if track_names is true
402
- if( $options['track_names'] )
403
- { ?>
404
  <script type='text/javascript'>
 
 
 
 
405
  function clicky_gc( name ) {
406
  var ca = document.cookie.split(';');
407
  for( var i in ca ) {
@@ -410,9 +410,26 @@ function clicky_script() {
410
  }
411
  return '';
412
  }
413
- var clicky_custom_session = { username: clicky_gc( 'comment_author_<?php echo md5( get_option("siteurl") ); ?>' ) };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
414
  </script>
415
- <?php }
416
 
417
  // Goal tracking
418
  if (is_singular()) {
@@ -430,9 +447,18 @@ function clicky_script() {
430
 
431
  // Display the script
432
  ?>
433
- <script src="http://static.getclicky.com/js" type="text/javascript"></script>
434
- <script type="text/javascript">clicky.init(<?php echo $options['site_id']; ?>);</script>
435
- <noscript><p><img alt="Clicky" width="1" height="1" src="http://static.getclicky.com/<?php echo $options['site_id']; ?>ns.gif" /></p></noscript>
 
 
 
 
 
 
 
 
 
436
  <!-- End Clicky Tracking -->
437
  <?php
438
  }
1
  <?php
2
  /*
3
  Plugin Name: Clicky for WordPress
4
+ Version: 1.1
5
  Plugin URI: http://getclicky.com/goodies/#wordpress
6
  Description: Integrates Clicky on your blog!
7
  Author: Joost de Valk
95
  add_action('admin_print_styles', array(&$this,'config_page_styles'));
96
 
97
  add_action('admin_menu', array(&$this,'meta_box'));
98
+ add_action('publish_post', array(&$this,'clicky_insert_post'));
99
 
100
  $this->clicky_admin_warnings();
101
  }
166
  }
167
  ?>
168
  <div class="wrap">
169
+ <a href="http://getclicky.com/"><div id="clicky-icon" style="background: url(<?php echo plugins_url('',__FILE__); ?>/images/clicky-32x32.png) no-repeat;" class="icon32"><br /></div></a>
170
  <h2>Clicky <?php _e("Configuration",'clicky'); ?></h2>
171
  <div class="postbox-container" style="width:70%;">
172
  <div class="metabox-holder">
397
  // Branding
398
  ?>
399
  <!-- Clicky Web Analytics - http://getclicky.com, WordPress Plugin by Yoast - http://yoast.com -->
 
 
 
 
400
  <script type='text/javascript'>
401
+ <?php
402
+ // Track commenter name if track_names is true
403
+ if( $options['track_names'] ) {
404
+ ?>
405
  function clicky_gc( name ) {
406
  var ca = document.cookie.split(';');
407
  for( var i in ca ) {
410
  }
411
  return '';
412
  }
413
+ <?php
414
+ }
415
+ ?>
416
+ var clicky_custom_session = {
417
+ <?php
418
+ if( $options['track_names'] ) {
419
+ ?>
420
+ username: clicky_gc( 'comment_author_<?php echo md5( get_option("siteurl") ); ?>' ),
421
+ <?php
422
+ }
423
+ if ( is_single() ) {
424
+ ?>
425
+ author: '<?php the_author(); ?>',
426
+ category: '<?php $cat = get_the_category(); echo $cat[0]->name; ?>'
427
+ <?php
428
+ }
429
+ ?>
430
+ };
431
  </script>
432
+ <?php
433
 
434
  // Goal tracking
435
  if (is_singular()) {
447
 
448
  // Display the script
449
  ?>
450
+ <script type="text/javascript">
451
+ var clicky = { log: function(){ return; }, goal: function(){ return; }};
452
+ var clicky_site_id = <?php echo $options['site_id']; ?>;
453
+ (function() {
454
+ var s = document.createElement('script');
455
+ s.type = 'text/javascript';
456
+ s.async = true;
457
+ s.src = ( document.location.protocol == 'https:' ? 'https://static.getclicky.com' : 'http://static.getclicky.com' ) + '/js';
458
+ ( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s );
459
+ })();
460
+ </script>
461
+ <noscript><p><img alt="Clicky" width="1" height="1" src="http://in.getclicky.com/<?php echo $options['site_id']; ?>ns.gif" /></p></noscript>
462
  <!-- End Clicky Tracking -->
463
  <?php
464
  }
clicky-32x32.png → images/clicky-32x32.png RENAMED
File without changes
images/email_sub.png ADDED
Binary file
images/rss.png ADDED
Binary file
images/yoast-16x16.png ADDED
Binary file
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: joostdevalk
3
  Donate link: http://yoast.com/
4
  Tags: analytics, statistics, clicky
5
  Requires at least: 2.8
6
- Tested up to: 2.9
7
- Stable tag: 1.0.6
8
 
9
  Integrates the Clicky web analytics service and optionally the Clicky.me short URL service into your blog.
10
 
@@ -15,7 +15,7 @@ Integrates the Clicky web analytics service and optionally the Clicky.me short U
15
  * Automatically adding your Clicky tracking code everywhere.
16
  * Option to ignore admins.
17
  * Option to store names of commenters.
18
- * Option to track posts & pages as goals and assign a revenue to that page or post.
19
  * An overview of your site's statistics on your dashboard.
20
  * Integration with the [Clicky.me Short URL service](http://clicky.me/).
21
  * Automatically create a short link for each now post and page.
@@ -33,6 +33,12 @@ Integrates the Clicky web analytics service and optionally the Clicky.me short U
33
 
34
  == Changelog ==
35
 
 
 
 
 
 
 
36
  = 1.0.6 =
37
  * Auto-tweeting now only happens when a post is first published.
38
  * Made sure there are no spaces in site ID, site key and admin site key are always trimmed.
3
  Donate link: http://yoast.com/
4
  Tags: analytics, statistics, clicky
5
  Requires at least: 2.8
6
+ Tested up to: 3.0
7
+ Stable tag: 1.1
8
 
9
  Integrates the Clicky web analytics service and optionally the Clicky.me short URL service into your blog.
10
 
15
  * Automatically adding your Clicky tracking code everywhere.
16
  * Option to ignore admins.
17
  * Option to store names of commenters.
18
+ * Option to track posts &amp; pages as goals and assign a revenue to that page or post.
19
  * An overview of your site's statistics on your dashboard.
20
  * Integration with the [Clicky.me Short URL service](http://clicky.me/).
21
  * Automatically create a short link for each now post and page.
33
 
34
  == Changelog ==
35
 
36
+ = 1.1 =
37
+ * Switched to the new asynchronous javascript.
38
+ * Added tracking of category and author as custom variables.
39
+ * Fixed the bug that caused tweeting of updated posts.
40
+ * Some slight updates to the backend.
41
+
42
  = 1.0.6 =
43
  * Auto-tweeting now only happens when a post is first published.
44
  * Made sure there are no spaces in site ID, site key and admin site key are always trimmed.
yst_plugin_tools.css CHANGED
@@ -1,8 +1,18 @@
1
- small {
2
- font-weight:normal;
 
 
3
  color:#777;
4
  }
5
 
 
 
 
 
 
 
 
 
6
  div.inside ul {
7
  margin-left: 20px;
8
  }
@@ -12,18 +22,50 @@ div.inside ul li {
12
  line-height:16px;
13
  }
14
 
 
 
 
 
 
 
 
15
  div.inside ul li.rss {
16
- list-style-image: url(/wp-includes/images/rss.png);
17
  }
18
 
19
  div.inside ul li.email {
20
- list-style-image: url(http://cdn.yoast.com/email_sub.png);
21
  }
22
 
23
  div.inside ul li.yoast {
24
- list-style-image: url(http://cdn.yoast.com/theme/yoast-16x16.png);
25
  }
26
 
27
  .text {
28
  width: 250px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
1
+ td.yst_desc {
2
+ font-weight: normal;
3
+ font-size: 12px;
4
+ line-height: 12px;
5
  color:#777;
6
  }
7
 
8
+ tr.yst_row {
9
+ padding: 5px 0 0 0;
10
+ margin: 5px 0 0 0;
11
+ }
12
+ tr.yst_row.even {
13
+ background-color: #f6f6f6;
14
+ }
15
+
16
  div.inside ul {
17
  margin-left: 20px;
18
  }
22
  line-height:16px;
23
  }
24
 
25
+ div.inside a, div.inside a.rsswidget {
26
+ font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
27
+ text-decoration: none;
28
+ }
29
+ div.inside a:hover, div.inside a.rsswidget:hover {
30
+ text-decoration: underline;
31
+ }
32
  div.inside ul li.rss {
33
+ list-style-image: url(images/rss.png);
34
  }
35
 
36
  div.inside ul li.email {
37
+ list-style-image: url(images/email_sub.png);
38
  }
39
 
40
  div.inside ul li.yoast {
41
+ list-style-image: url(images/yoast-16x16.png);
42
  }
43
 
44
  .text {
45
  width: 250px;
46
+ }
47
+
48
+ .postbox p {
49
+ text-align:left;
50
+ margin: 0 10px 10px 10px;
51
+ font-size: 13px;
52
+ line-height: 150%;
53
+ }
54
+
55
+ .postbox pre {
56
+ margin: 5px 10px;
57
+ padding:4px;
58
+ background: lightyellow;
59
+ }
60
+
61
+ .side .postbox p, .side .postbox a, .side .postbox a.rsswidget {
62
+ font-size: 11px;
63
+ }
64
+
65
+ div.inside .button:hover, div.inside .button-primary:hover {
66
+ text-decoration: none;
67
+ }
68
+
69
+ .button, .button-primary {
70
+ margin-top: 10px;
71
  }
yst_plugin_tools.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /**
4
- * Backend Class for use in all Yoast plugins, modified for Clicky plugin
5
  * Version 0.2
6
  */
7
 
@@ -15,19 +15,18 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
15
  var $ozhicon = '';
16
  var $optionname = '';
17
  var $homepage = '';
 
18
  var $accesslvl = 'manage_options';
19
- var $feed = '';
20
 
21
- function Clicky_Base_Plugin_Admin() {
22
  add_action( 'admin_menu', array(&$this, 'register_settings_page') );
23
-
24
  add_filter( 'plugin_action_links', array(&$this, 'add_action_link'), 10, 2 );
25
  add_filter( 'ozh_adminmenu_icon', array(&$this, 'add_ozh_adminmenu_icon' ) );
26
 
27
- add_action( 'admin_print_scripts', array(&$this,'config_page_scripts') );
28
- add_action( 'admin_print_styles', array(&$this,'config_page_styles') );
29
 
30
- add_action('wp_dashboard_setup', array(&$this,'widget_setup') );
31
  }
32
 
33
  function add_ozh_adminmenu_icon( $hook ) {
@@ -42,7 +41,7 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
42
  wp_enqueue_style('thickbox');
43
  wp_enqueue_style('global');
44
  wp_enqueue_style('wp-admin');
45
- wp_enqueue_style('clicky-admin-css', WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)). '/yst_plugin_tools.css');
46
  }
47
  }
48
 
@@ -61,7 +60,7 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
61
  static $this_plugin;
62
  if( empty($this_plugin) ) $this_plugin = $this->filename;
63
  if ( $file == $this_plugin ) {
64
- $settings_link = '<a href="' . $this->plugin_options_url() . '">' . __('Settings', 'clicky') . '</a>';
65
  array_unshift( $links, $settings_link );
66
  }
67
  return $links;
@@ -75,6 +74,8 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
75
  if (isset($_GET['page']) && $_GET['page'] == $this->hook) {
76
  wp_enqueue_script('postbox');
77
  wp_enqueue_script('dashboard');
 
 
78
  }
79
  }
80
 
@@ -107,6 +108,7 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
107
  </div>
108
  </div>
109
  <?php
 
110
  }
111
 
112
 
@@ -115,17 +117,28 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
115
  */
116
  function form_table($rows) {
117
  $content = '<table class="form-table">';
 
118
  foreach ($rows as $row) {
119
- $content .= '<tr><th valign="top" scrope="row">';
 
 
 
 
 
 
 
120
  if (isset($row['id']) && $row['id'] != '')
121
  $content .= '<label for="'.$row['id'].'">'.$row['label'].':</label>';
122
  else
123
  $content .= $row['label'];
124
- if (isset($row['desc']) && $row['desc'] != '')
125
- $content .= '<br/><small>'.$row['desc'].'</small>';
126
  $content .= '</th><td valign="top">';
127
  $content .= $row['content'];
128
  $content .= '</td></tr>';
 
 
 
 
 
129
  }
130
  $content .= '</table>';
131
  return $content;
@@ -134,28 +147,34 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
134
  /**
135
  * Create a "plugin like" box.
136
  */
137
- function plugin_like() {
138
- $content = '<p>'.__('Why not do any or all of the following:','clicky').'</p>';
 
 
 
139
  $content .= '<ul>';
140
- $content .= '<li><a href="'.$this->homepage.'">'.__('Link to it so other folks can find out about it.','clicky').'</a></li>';
141
- $content .= '<li><a href="http://wordpress.org/extend/plugins/'.$this->hook.'/">'.__('Give it a good rating on WordPress.org.','clicky').'</a></li>';
142
- $content .= '<li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=2017947">'.__('Donate a token of your appreciation.','clicky').'</a></li>';
143
  $content .= '</ul>';
144
- $this->postbox($this->hook.'like', __('Like this plugin?','clicky'), $content);
145
  }
146
 
147
  /**
148
- * Info box with link to the support forums.
149
  */
150
- function plugin_support() {
151
- $content = '<p>'.__('If you have any problems with this plugin or good ideas for improvements or new features, please talk about them in the','clicky').' <a href="http://wordpress.org/tags/'.$this->hook.'">'.__("Support forums",'clicky').'</a>.</p>';
152
- $this->postbox($this->hook.'support', __('Need support?','clicky'), $content);
 
 
 
153
  }
154
 
155
  /**
156
- * Box with latest news from getclicky.com
157
  */
158
- function news() {
159
  require_once(ABSPATH.WPINC.'/rss.php');
160
  if ( $rss = fetch_rss( $this->feed ) ) {
161
  $content = '<ul>';
@@ -165,10 +184,11 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
165
  $content .= '<a class="rsswidget" href="'.clean_url( $item['link'], $protocolls=null, 'display' ).'">'. htmlentities($item['title']) .'</a> ';
166
  $content .= '</li>';
167
  }
168
- $content .= '<li class="rss"><a href="'.$this->feed.'">'.__('Subscribe','clicky').'</a></li>';
169
- $this->postbox('clickylatest', __('Latest news from Clicky','clicky'), $content);
 
170
  } else {
171
- $this->postbox('clickylatest', __('Latest news from Clicky','clicky'), __('Nothing to say...','clicky'));
172
  }
173
  }
174
 
@@ -180,6 +200,46 @@ if (!class_exists('Clicky_Base_Plugin_Admin')) {
180
  }
181
  return $text;
182
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  }
184
  }
185
 
1
  <?php
2
 
3
  /**
4
+ * Backend Class for use in all Yoast plugins
5
  * Version 0.2
6
  */
7
 
15
  var $ozhicon = '';
16
  var $optionname = '';
17
  var $homepage = '';
18
+ var $feed = 'http://getclicky.com/blog/rss';
19
  var $accesslvl = 'manage_options';
 
20
 
21
+ function Yoast_Plugin_Admin() {
22
  add_action( 'admin_menu', array(&$this, 'register_settings_page') );
 
23
  add_filter( 'plugin_action_links', array(&$this, 'add_action_link'), 10, 2 );
24
  add_filter( 'ozh_adminmenu_icon', array(&$this, 'add_ozh_adminmenu_icon' ) );
25
 
26
+ add_action('admin_print_scripts', array(&$this,'config_page_scripts'));
27
+ add_action('admin_print_styles', array(&$this,'config_page_styles'));
28
 
29
+ add_action('wp_dashboard_setup', array(&$this,'widget_setup'));
30
  }
31
 
32
  function add_ozh_adminmenu_icon( $hook ) {
41
  wp_enqueue_style('thickbox');
42
  wp_enqueue_style('global');
43
  wp_enqueue_style('wp-admin');
44
+ wp_enqueue_style('blogicons-admin-css', WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)). '/yst_plugin_tools.css');
45
  }
46
  }
47
 
60
  static $this_plugin;
61
  if( empty($this_plugin) ) $this_plugin = $this->filename;
62
  if ( $file == $this_plugin ) {
63
+ $settings_link = '<a href="' . $this->plugin_options_url() . '">' . __('Settings') . '</a>';
64
  array_unshift( $links, $settings_link );
65
  }
66
  return $links;
74
  if (isset($_GET['page']) && $_GET['page'] == $this->hook) {
75
  wp_enqueue_script('postbox');
76
  wp_enqueue_script('dashboard');
77
+ wp_enqueue_script('thickbox');
78
+ wp_enqueue_script('media-upload');
79
  }
80
  }
81
 
108
  </div>
109
  </div>
110
  <?php
111
+ $this->toc .= '<li><a href="#'.$id.'">'.$title.'</a></li>';
112
  }
113
 
114
 
117
  */
118
  function form_table($rows) {
119
  $content = '<table class="form-table">';
120
+ $i = 1;
121
  foreach ($rows as $row) {
122
+ $class = '';
123
+ if ($i > 1) {
124
+ $class .= 'yst_row';
125
+ }
126
+ if ($i % 2 == 0) {
127
+ $class .= ' even';
128
+ }
129
+ $content .= '<tr class="'.$row['id'].'_row '.$class.'"><th valign="top" scrope="row">';
130
  if (isset($row['id']) && $row['id'] != '')
131
  $content .= '<label for="'.$row['id'].'">'.$row['label'].':</label>';
132
  else
133
  $content .= $row['label'];
 
 
134
  $content .= '</th><td valign="top">';
135
  $content .= $row['content'];
136
  $content .= '</td></tr>';
137
+ if ( isset($row['desc']) && !empty($row['desc']) ) {
138
+ $content .= '<tr class="'.$row['id'].'_row '.$class.'"><td colspan="2" class="yst_desc"><small>'.$row['desc'].'</small></td></tr>';
139
+ }
140
+
141
+ $i++;
142
  }
143
  $content .= '</table>';
144
  return $content;
147
  /**
148
  * Create a "plugin like" box.
149
  */
150
+ function plugin_like($hook = '') {
151
+ if (empty($hook)) {
152
+ $hook = $this->hook;
153
+ }
154
+ $content = '<p>'.__('Why not do any or all of the following:','ystplugin').'</p>';
155
  $content .= '<ul>';
156
+ $content .= '<li><a href="'.$this->homepage.'">'.__('Link to it so other folks can find out about it.','ystplugin').'</a></li>';
157
+ $content .= '<li><a href="http://wordpress.org/extend/plugins/'.$hook.'/">'.__('Give it a good rating on WordPress.org.','ystplugin').'</a></li>';
158
+ $content .= '<li><a href="http://wordpress.org/extend/plugins/'.$hook.'/">'.__('Let other people know that it works with your WordPress setup.','ystplugin').'</a></li>';
159
  $content .= '</ul>';
160
+ $this->postbox($hook.'like', 'Like this plugin?', $content);
161
  }
162
 
163
  /**
164
+ * Info box with link to the bug tracker.
165
  */
166
+ function plugin_support($hook = '') {
167
+ if (empty($hook)) {
168
+ $hook = $this->hook;
169
+ }
170
+ $content = '<p>If you\'ve found a bug in this plugin, please submit it in the <a href="http://yoast.com/mantis/bug_report_page.php">Yoast Bug Tracker</a> with a clear description.</p>';
171
+ $this->postbox($this->hook.'support', __('Found a bug?','ystplugin'), $content);
172
  }
173
 
174
  /**
175
+ * Box with latest news from GetClicky
176
  */
177
+ function news( ) {
178
  require_once(ABSPATH.WPINC.'/rss.php');
179
  if ( $rss = fetch_rss( $this->feed ) ) {
180
  $content = '<ul>';
184
  $content .= '<a class="rsswidget" href="'.clean_url( $item['link'], $protocolls=null, 'display' ).'">'. htmlentities($item['title']) .'</a> ';
185
  $content .= '</li>';
186
  }
187
+ $content .= '<li class="rss"><a href="http://yoast.com/feed/">Subscribe with RSS</a></li>';
188
+ $content .= '<li class="email"><a href="http://yoast.com/email-blog-updates/">Subscribe by email</a></li>';
189
+ $this->postbox('yoastlatest', 'Latest news from Clicky', $content);
190
  } else {
191
+ $this->postbox('yoastlatest', 'Latest news from Clicky', 'Nothing to say...');
192
  }
193
  }
194
 
200
  }
201
  return $text;
202
  }
203
+
204
+ function db_widget() {
205
+ $options = get_option('yoastdbwidget');
206
+ if (isset($_POST['yoast_removedbwidget'])) {
207
+ $options['removedbwidget'] = true;
208
+ update_option('yoastdbwidget',$options);
209
+ }
210
+ if ($options['removedbwidget']) {
211
+ echo "If you reload, this widget will be gone and never appear again, unless you decide to delete the database option 'yoastdbwidget'.";
212
+ return;
213
+ }
214
+ require_once(ABSPATH.WPINC.'/rss.php');
215
+ if ( $rss = fetch_rss( 'http://yoast.com/feed/' ) ) {
216
+ echo '<div class="rss-widget">';
217
+ echo '<a href="http://yoast.com/" title="Go to Yoast.com"><img src="http://netdna.yoast.com/yoast-logo-rss.png" class="alignright" alt="Yoast"/></a>';
218
+ echo '<ul>';
219
+ $rss->items = array_slice( $rss->items, 0, 3 );
220
+ foreach ( (array) $rss->items as $item ) {
221
+ echo '<li>';
222
+ echo '<a class="rsswidget" href="'.clean_url( $item['link'], $protocolls=null, 'display' ).'">'. htmlentities($item['title']) .'</a> ';
223
+ echo '<span class="rss-date">'. date('F j, Y', strtotime($item['pubdate'])) .'</span>';
224
+ echo '<div class="rssSummary">'. $this->text_limit($item['summary'],250) .'</div>';
225
+ echo '</li>';
226
+ }
227
+ echo '</ul>';
228
+ echo '<div style="border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">';
229
+ echo '<a href="http://feeds2.feedburner.com/joostdevalk"><img src="'.get_bloginfo('wpurl').'/wp-includes/images/rss.png" alt=""/> Subscribe with RSS</a>';
230
+ echo ' &nbsp; &nbsp; &nbsp; ';
231
+ echo '<a href="http://yoast.com/email-blog-updates/"><img src="http://netdna.yoast.com/email_sub.png" alt=""/> Subscribe by email</a>';
232
+ 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>';
233
+ echo '</div>';
234
+ echo '</div>';
235
+ }
236
+ }
237
+
238
+ function widget_setup() {
239
+ $options = get_option('yoastdbwidget');
240
+ if (!$options['removedbwidget'])
241
+ wp_add_dashboard_widget( 'yoast_db_widget' , 'The Latest news from Yoast' , array(&$this, 'db_widget'));
242
+ }
243
  }
244
  }
245