Version Description
Download this release
Release Info
Developer | aaroncampbell |
Plugin | Twitter Widget Pro |
Version | 1.3.5 |
Comparing to | |
See all releases |
Code changes from version 1.3.4 to 1.3.5
- readme.txt +1 -1
- wp-twitter-widget.php +34 -3
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.7
|
6 |
Tested up to: 2.8
|
7 |
-
Stable tag: 1.3.
|
8 |
|
9 |
A widget that properly handles twitter feeds, including parsing @username and URLs into links. Requires PHP5.
|
10 |
|
4 |
Tags: twitter, widget, feed
|
5 |
Requires at least: 2.7
|
6 |
Tested up to: 2.8
|
7 |
+
Stable tag: 1.3.5
|
8 |
|
9 |
A widget that properly handles twitter feeds, including parsing @username and URLs into links. Requires PHP5.
|
10 |
|
wp-twitter-widget.php
CHANGED
@@ -3,15 +3,22 @@
|
|
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, and can even display profile images for the users. Requires PHP5.
|
6 |
-
* Version: 1.3.
|
7 |
* Author: Aaron D. Campbell
|
8 |
* Author URI: http://xavisys.com/
|
9 |
*/
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
12 |
|
13 |
/**
|
14 |
* Changelog:
|
|
|
|
|
|
|
15 |
* 05/02/2009: 1.3.4
|
16 |
* - Added convert_chars filter to the tweet text to properly handle special characters
|
17 |
* - Fixed "in reply to" text which stopped working when Twitter changed their API
|
@@ -204,10 +211,33 @@ class wpTwitterWidget
|
|
204 |
* @return string - Tweet text with @replies linked
|
205 |
*/
|
206 |
public function linkTwitterUsers($text) {
|
207 |
-
$text = preg_replace('/(^|\s)@(\w*)/i', '$1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
return $text;
|
209 |
}
|
210 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
/**
|
212 |
* Turn URLs into links
|
213 |
*
|
@@ -709,6 +739,7 @@ add_action( 'admin_menu', array($wpTwitterWidget,'admin_menu') );
|
|
709 |
add_action( 'widgets_init', array($wpTwitterWidget, 'register') );
|
710 |
add_filter( 'widget_twitter_content', array($wpTwitterWidget, 'linkTwitterUsers') );
|
711 |
add_filter( 'widget_twitter_content', array($wpTwitterWidget, 'linkUrls') );
|
|
|
712 |
add_filter( 'widget_twitter_content', 'convert_chars' );
|
713 |
add_action( 'activate_twitter-widget-pro/wp-twitter-widget.php', array($wpTwitterWidget, 'activatePlugin') );
|
714 |
add_action( 'admin_footer', array($wpTwitterWidget, 'outputSendInfoForm') );
|
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, and can even display profile images for the users. Requires PHP5.
|
6 |
+
* Version: 1.3.5
|
7 |
* Author: Aaron D. Campbell
|
8 |
* Author URI: http://xavisys.com/
|
9 |
*/
|
10 |
|
11 |
+
/**
|
12 |
+
* @todo Clickable #hashtags
|
13 |
+
*/
|
14 |
+
|
15 |
+
define('TWP_VERSION', '1.3.5');
|
16 |
|
17 |
/**
|
18 |
* Changelog:
|
19 |
+
* 05/02/2009: 1.3.5
|
20 |
+
* - #Hashtags are now linked to twitter search
|
21 |
+
*
|
22 |
* 05/02/2009: 1.3.4
|
23 |
* - Added convert_chars filter to the tweet text to properly handle special characters
|
24 |
* - Fixed "in reply to" text which stopped working when Twitter changed their API
|
211 |
* @return string - Tweet text with @replies linked
|
212 |
*/
|
213 |
public function linkTwitterUsers($text) {
|
214 |
+
$text = preg_replace('/(^|\s)@(\w*)/i', '$1<a href="http://twitter.com/$2" class="twitter-user">@$2</a>', $text);
|
215 |
+
return $text;
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Replace #hashtag with a link to search.twitter.com for that hashtag
|
220 |
+
*
|
221 |
+
* @param string $text - Tweet text
|
222 |
+
* @return string - Tweet text with #hashtags linked
|
223 |
+
*/
|
224 |
+
public function linkHashtags($text) {
|
225 |
+
$text = preg_replace_callback('/(^|\s)(#\w*)/i', array($this, '_hashtagLink'), $text);
|
226 |
return $text;
|
227 |
}
|
228 |
|
229 |
+
/**
|
230 |
+
* Replace #hashtag with a link to search.twitter.com for that hashtag
|
231 |
+
*
|
232 |
+
* @param array $matches - Tweet text
|
233 |
+
* @return string - Tweet text with #hashtags linked
|
234 |
+
*/
|
235 |
+
private function _hashtagLink($matches) {
|
236 |
+
return "{$matches[1]}<a href='http://search.twitter.com/search?q="
|
237 |
+
. urlencode($matches[2])
|
238 |
+
. "' class='twitter-hashtag'>{$matches[2]}</a>";
|
239 |
+
}
|
240 |
+
|
241 |
/**
|
242 |
* Turn URLs into links
|
243 |
*
|
739 |
add_action( 'widgets_init', array($wpTwitterWidget, 'register') );
|
740 |
add_filter( 'widget_twitter_content', array($wpTwitterWidget, 'linkTwitterUsers') );
|
741 |
add_filter( 'widget_twitter_content', array($wpTwitterWidget, 'linkUrls') );
|
742 |
+
add_filter( 'widget_twitter_content', array($wpTwitterWidget, 'linkHashtags') );
|
743 |
add_filter( 'widget_twitter_content', 'convert_chars' );
|
744 |
add_action( 'activate_twitter-widget-pro/wp-twitter-widget.php', array($wpTwitterWidget, 'activatePlugin') );
|
745 |
add_action( 'admin_footer', array($wpTwitterWidget, 'outputSendInfoForm') );
|