Twitter Widget Pro - Version 1.1.2

Version Description

Download this release

Release Info

Developer aaroncampbell
Plugin Icon wp plugin Twitter Widget Pro
Version 1.1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.1.2

Files changed (2) hide show
  1. readme.txt +1 -1
  2. wp-twitter-widget.php +24 -12
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal%4
4
  Tags: twitter, widget, feed
5
  Requires at least: 2.5
6
  Tested up to: 2.5.1
7
- Stable tag: 1.1.1
8
 
9
  A widget that properly handles twitter feeds (single user or including friends), including parsing @username and URLs into links. Requires PHP5.
10
 
4
  Tags: twitter, widget, feed
5
  Requires at least: 2.5
6
  Tested up to: 2.5.1
7
+ Stable tag: 1.1.2
8
 
9
  A widget that properly handles twitter feeds (single user or including friends), including parsing @username and URLs into links. Requires PHP5.
10
 
wp-twitter-widget.php CHANGED
@@ -3,13 +3,17 @@
3
  * Plugin Name: Twitter Widget Pro
4
  * Plugin URI: http://xavisys.com/wordpress-twitter-widget/
5
  * Description: A widget that properly handles twitter feeds, including @username and link parsing, feeds that include friends or just one user, and can even display profile images for the users. Requires PHP5.
6
- * Version: 1.1.1
7
  * Author: Aaron D. Campbell
8
  * Author URI: http://xavisys.com/
9
  */
10
 
11
  /**
12
  * Changelog:
 
 
 
 
13
  * 04/23/2008: 1.1.1
14
  * - Fixed issue with @username parsing of two names with one space between them (@test @ing)
15
  * - Fixed readme typo
@@ -245,24 +249,27 @@ class wpTwitterWidget
245
  $options[$number]['showts'] = 86400;
246
  }
247
 
 
248
  $options[$number]['avatar'] = (isset($options[$number]['avatar']) && $options[$number]['avatar']);
249
 
250
  $tweets = $this->_getTweets($options[$number]);
251
  $tweets = array_slice($tweets, 0, $options[$number]['items']);
252
 
253
  echo $before_widget;
254
- if ( file_exists(dirname(__FILE__) . '/rss.png') ) {
255
- $icon = str_replace(ABSPATH, get_option('siteurl').'/', dirname(__FILE__)) . '/rss.png';
256
- } else {
257
- $icon = get_option('siteurl').'/wp-includes/images/rss.png';
258
- }
259
- $feedUrl = $this->_getFeedUrl($options[$number], 'rss', false);
260
- $before_title .= "<a class='twitterwidget' href='{$feedUrl}' title='" . attribute_escape(__('Syndicate this content')) ."'><img style='background:orange;color:white;border:none;' width='14' height='14' src='{$icon}' alt='RSS' /></a>";
261
- if (!empty($tweets)) {
262
- $twitterLink = 'http://twitter.com/' . $tweets[0]->user->screen_name;
263
- $before_title .= " <a class='twitterwidget' href='$twitterLink' title='" . attribute_escape("Twitter: {$tweets[0]->user->name}") . "'>";
264
- $after_title = '</a>' . $after_title;
265
  }
 
 
 
266
  if (empty($options[$number]['title'])) {
267
  $options[$number]['title'] = "Twitter: {$options[$number]['username']}";
268
  }
@@ -397,6 +404,7 @@ profileImage;
397
  $options[$number]['number'] = $number;
398
  $options[$number]['title'] = attribute_escape($options[$number]['title']);
399
  $options[$number]['username'] = attribute_escape($options[$number]['username']);
 
400
  $options[$number]['avatar'] = (bool) $options[$number]['avatar'];
401
  if (!isset($options[$number]['feed']) || !in_array($options[$number]['feed'], array('user', 'friends'))) {
402
  $options[$number]['feed'] = 'user';
@@ -444,6 +452,7 @@ profileImage;
444
 
445
  $defaultArgs = array( 'title' => '',
446
  'username' => '',
 
447
  'avatar' => false,
448
  'feed' => 'user',
449
  'items' => 10,
@@ -487,6 +496,9 @@ profileImage;
487
  <label for="twitter-feed-<?php echo $number; ?>-user"><input class="checkbox" type="radio" id="twitter-feed-<?php echo $number; ?>-user" name="widget-twitter[<?php echo $number; ?>][feed]" value="user"<?php checked($feed, 'user'); ?> /> <?php _e('Just User'); ?></label><br />
488
  <label for="twitter-feed-<?php echo $number; ?>-friends"><input class="checkbox" type="radio" id="twitter-feed-<?php echo $number; ?>-friends" name="widget-twitter[<?php echo $number; ?>][feed]" value="friends"<?php checked($feed, 'friends'); ?> /> <?php _e('With Friends'); ?></label>
489
  </p>
 
 
 
490
  <p>
491
  <label for="twitter-avatar-<?php echo $number; ?>"><input class="checkbox" type="checkbox" id="twitter-avatar-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][avatar]"<?php checked($avatar, true); ?> /> <?php _e('Show Profile Image(s)'); ?></label>
492
  </p>
3
  * Plugin Name: Twitter Widget Pro
4
  * Plugin URI: http://xavisys.com/wordpress-twitter-widget/
5
  * Description: A widget that properly handles twitter feeds, including @username and link parsing, feeds that include friends or just one user, and can even display profile images for the users. Requires PHP5.
6
+ * Version: 1.1.2
7
  * Author: Aaron D. Campbell
8
  * Author URI: http://xavisys.com/
9
  */
10
 
11
  /**
12
  * Changelog:
13
+ * 04/29/2008: 1.1.2
14
+ * - Title link always links to correct username, rather than the last person to tweet on that feed
15
+ * - Added option to hide RSS icon/link
16
+ *
17
  * 04/23/2008: 1.1.1
18
  * - Fixed issue with @username parsing of two names with one space between them (@test @ing)
19
  * - Fixed readme typo
249
  $options[$number]['showts'] = 86400;
250
  }
251
 
252
+ $options[$number]['hiderss'] = (isset($options[$number]['hiderss']) && $options[$number]['hiderss']);
253
  $options[$number]['avatar'] = (isset($options[$number]['avatar']) && $options[$number]['avatar']);
254
 
255
  $tweets = $this->_getTweets($options[$number]);
256
  $tweets = array_slice($tweets, 0, $options[$number]['items']);
257
 
258
  echo $before_widget;
259
+
260
+ // If "hide rss" hasn't been checked, show the linked icon
261
+ if (!$options[$number]['hiderss']) {
262
+ if ( file_exists(dirname(__FILE__) . '/rss.png') ) {
263
+ $icon = str_replace(ABSPATH, get_option('siteurl').'/', dirname(__FILE__)) . '/rss.png';
264
+ } else {
265
+ $icon = get_option('siteurl').'/wp-includes/images/rss.png';
266
+ }
267
+ $feedUrl = $this->_getFeedUrl($options[$number], 'rss', false);
268
+ $before_title .= "<a class='twitterwidget' href='{$feedUrl}' title='" . attribute_escape(__('Syndicate this content')) ."'><img style='background:orange;color:white;border:none;' width='14' height='14' src='{$icon}' alt='RSS' /></a> ";
 
269
  }
270
+ $twitterLink = 'http://twitter.com/' . $options[$number]['username'];
271
+ $before_title .= "<a class='twitterwidget' href='{$twitterLink}' title='" . attribute_escape("Twitter: {$options[$number]['username']}") . "'>";
272
+ $after_title = '</a>' . $after_title;
273
  if (empty($options[$number]['title'])) {
274
  $options[$number]['title'] = "Twitter: {$options[$number]['username']}";
275
  }
404
  $options[$number]['number'] = $number;
405
  $options[$number]['title'] = attribute_escape($options[$number]['title']);
406
  $options[$number]['username'] = attribute_escape($options[$number]['username']);
407
+ $options[$number]['hiderss'] = (bool) $options[$number]['hiderss'];
408
  $options[$number]['avatar'] = (bool) $options[$number]['avatar'];
409
  if (!isset($options[$number]['feed']) || !in_array($options[$number]['feed'], array('user', 'friends'))) {
410
  $options[$number]['feed'] = 'user';
452
 
453
  $defaultArgs = array( 'title' => '',
454
  'username' => '',
455
+ 'hiderss' => false,
456
  'avatar' => false,
457
  'feed' => 'user',
458
  'items' => 10,
496
  <label for="twitter-feed-<?php echo $number; ?>-user"><input class="checkbox" type="radio" id="twitter-feed-<?php echo $number; ?>-user" name="widget-twitter[<?php echo $number; ?>][feed]" value="user"<?php checked($feed, 'user'); ?> /> <?php _e('Just User'); ?></label><br />
497
  <label for="twitter-feed-<?php echo $number; ?>-friends"><input class="checkbox" type="radio" id="twitter-feed-<?php echo $number; ?>-friends" name="widget-twitter[<?php echo $number; ?>][feed]" value="friends"<?php checked($feed, 'friends'); ?> /> <?php _e('With Friends'); ?></label>
498
  </p>
499
+ <p>
500
+ <label for="twitter-hiderss-<?php echo $number; ?>"><input class="checkbox" type="checkbox" id="twitter-hiderss-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][hiderss]"<?php checked($hiderss, true); ?> /> <?php _e('Hide RSS Icon and Link'); ?></label>
501
+ </p>
502
  <p>
503
  <label for="twitter-avatar-<?php echo $number; ?>"><input class="checkbox" type="checkbox" id="twitter-avatar-<?php echo $number; ?>" name="widget-twitter[<?php echo $number; ?>][avatar]"<?php checked($avatar, true); ?> /> <?php _e('Show Profile Image(s)'); ?></label>
504
  </p>