Version Description
Fixes hashtag links, ignoring of retweets, and SSL verification
Download this release
Release Info
Developer | aaroncampbell |
Plugin | Twitter Widget Pro |
Version | 2.5.2 |
Comparing to | |
See all releases |
Code changes from version 2.5.1 to 2.5.2
- lib/wp-twitter.php +3 -2
- readme.txt +10 -1
- wp-twitter-widget.php +9 -26
lib/wp-twitter.php
CHANGED
@@ -59,8 +59,9 @@ class wpTwitter {
|
|
59 |
return $this->_token;
|
60 |
}
|
61 |
|
62 |
-
private function
|
63 |
$params = array(
|
|
|
64 |
'oauth_version' => '1.0',
|
65 |
'oauth_nonce' => md5( microtime() . mt_rand() ),
|
66 |
'oauth_timestamp' => time(),
|
@@ -96,7 +97,7 @@ class wpTwitter {
|
|
96 |
* Format and sign an OAuth / API request
|
97 |
*/
|
98 |
public function send_authed_request( $request_url, $method, $parameters = array() ) {
|
99 |
-
$parameters = wp_parse_args( $parameters, $this->
|
100 |
if ( ! filter_var( $request_url , FILTER_VALIDATE_URL ) )
|
101 |
$request_url = self::get_api_endpoint( $request_url );
|
102 |
$this->sign_request( $parameters, $request_url );
|
59 |
return $this->_token;
|
60 |
}
|
61 |
|
62 |
+
private function _get_request_defaults() {
|
63 |
$params = array(
|
64 |
+
'sslverify' => apply_filters( 'twp_sslverify', false ),
|
65 |
'oauth_version' => '1.0',
|
66 |
'oauth_nonce' => md5( microtime() . mt_rand() ),
|
67 |
'oauth_timestamp' => time(),
|
97 |
* Format and sign an OAuth / API request
|
98 |
*/
|
99 |
public function send_authed_request( $request_url, $method, $parameters = array() ) {
|
100 |
+
$parameters = wp_parse_args( $parameters, $this->_get_request_defaults() );
|
101 |
if ( ! filter_var( $request_url , FILTER_VALIDATE_URL ) )
|
102 |
$request_url = self::get_api_endpoint( $request_url );
|
103 |
$this->sign_request( $parameters, $request_url );
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: twitter, widget, feed
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.5
|
7 |
-
Stable tag: 2.5.
|
8 |
|
9 |
A widget that properly handles twitter feeds, including parsing @username, #hashtags, and URLs into links.
|
10 |
|
@@ -130,6 +130,9 @@ Aparently the database queries required to display the friends feed was causing
|
|
130 |
|
131 |
== Upgrade Notice ==
|
132 |
|
|
|
|
|
|
|
133 |
= 2.5.1 =
|
134 |
Fix potential conflict with other oAuth plugins
|
135 |
|
@@ -180,6 +183,12 @@ Fewer "could not connect to Twitter" messages, new links (reply, retweet, favori
|
|
180 |
|
181 |
== Changelog ==
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
= 2.5.1 =
|
184 |
* Rename OAuthUtil class to twpOAuthUtil
|
185 |
* Don't use 'account/verify_credentials' as it has a very low limit
|
4 |
Tags: twitter, widget, feed
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.5
|
7 |
+
Stable tag: 2.5.2
|
8 |
|
9 |
A widget that properly handles twitter feeds, including parsing @username, #hashtags, and URLs into links.
|
10 |
|
130 |
|
131 |
== Upgrade Notice ==
|
132 |
|
133 |
+
= 2.5.2 =
|
134 |
+
Fixes hashtag links, ignoring of retweets, and SSL verification
|
135 |
+
|
136 |
= 2.5.1 =
|
137 |
Fix potential conflict with other oAuth plugins
|
138 |
|
183 |
|
184 |
== Changelog ==
|
185 |
|
186 |
+
= 2.5.2 =
|
187 |
+
* Don't force verification of Twitter's SSL certificate
|
188 |
+
* Fix empty admin notice
|
189 |
+
* Fix bug with retweets not being ignored
|
190 |
+
* Fix hashtag links
|
191 |
+
|
192 |
= 2.5.1 =
|
193 |
* Rename OAuthUtil class to twpOAuthUtil
|
194 |
* Don't use 'account/verify_credentials' as it has a very low limit
|
wp-twitter-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Twitter Widget Pro
|
4 |
* Plugin URI: http://bluedogwebservices.com/wordpress-plugin/twitter-widget-pro/
|
5 |
* Description: A widget that properly handles twitter feeds, including @username, #hashtag, and link parsing. It can even display profile images for the users. Requires PHP5.
|
6 |
-
* Version: 2.5.
|
7 |
* Author: Aaron D. Campbell
|
8 |
* Author URI: http://ran.ge/
|
9 |
* License: GPLv2 or later
|
@@ -30,7 +30,7 @@
|
|
30 |
|
31 |
require_once( 'tlc-transients.php' );
|
32 |
require_once( 'range-plugin-framework.php' );
|
33 |
-
define( 'TWP_VERSION', '2.5.
|
34 |
|
35 |
/**
|
36 |
* WP_Widget_Twitter_Pro is the class that handles the main widget.
|
@@ -167,10 +167,6 @@ class WP_Widget_Twitter_Pro extends WP_Widget {
|
|
167 |
<label for="<?php echo $this->get_field_id( 'errmsg' ); ?>"><?php _e( 'What to display when Twitter is down ( optional ):', $this->_slug ); ?></label>
|
168 |
<input class="widefat" id="<?php echo $this->get_field_id( 'errmsg' ); ?>" name="<?php echo $this->get_field_name( 'errmsg' ); ?>" type="text" value="<?php esc_attr_e( $instance['errmsg'] ); ?>" />
|
169 |
</p>
|
170 |
-
<p>
|
171 |
-
<label for="<?php echo $this->get_field_id( 'fetchTimeOut' ); ?>"><?php _e( 'Number of seconds to wait for a response from Twitter ( default 2 ):', $this->_slug ); ?></label>
|
172 |
-
<input class="widefat" id="<?php echo $this->get_field_id( 'fetchTimeOut' ); ?>" name="<?php echo $this->get_field_name( 'fetchTimeOut' ); ?>" type="text" value="<?php esc_attr_e( $instance['fetchTimeOut'] ); ?>" />
|
173 |
-
</p>
|
174 |
<p>
|
175 |
<label for="<?php echo $this->get_field_id( 'showts' ); ?>"><?php _e( 'Show date/time of Tweet ( rather than 2 ____ ago ):', $this->_slug ); ?></label>
|
176 |
<select id="<?php echo $this->get_field_id( 'showts' ); ?>" name="<?php echo $this->get_field_name( 'showts' ); ?>">
|
@@ -363,7 +359,8 @@ class wpTwitterWidget extends RangePlugin {
|
|
363 |
else
|
364 |
$msg = __( 'There was a problem authorizing your account.', $this->_slug );
|
365 |
}
|
366 |
-
|
|
|
367 |
}
|
368 |
|
369 |
if ( empty( $this->_settings['twp']['consumer-key'] ) || empty( $this->_settings['twp']['consumer-secret'] ) ) {
|
@@ -631,14 +628,6 @@ class wpTwitterWidget extends RangePlugin {
|
|
631 |
<input id="twp_errmsg" name="twp[errmsg]" type="text" class="regular-text code" value="<?php esc_attr_e( $this->_settings['twp']['errmsg'] ); ?>" size="40" />
|
632 |
</td>
|
633 |
</tr>
|
634 |
-
<tr valign="top">
|
635 |
-
<th scope="row">
|
636 |
-
<label for="twp_fetchTimeOut"><?php _e( 'Number of seconds to wait for a response from Twitter ( default 2 ):', $this->_slug ); ?></label>
|
637 |
-
</th>
|
638 |
-
<td>
|
639 |
-
<input id="twp_fetchTimeOut" name="twp[fetchTimeOut]" type="text" class="regular-text code" value="<?php esc_attr_e( $this->_settings['twp']['fetchTimeOut'] ); ?>" size="40" />
|
640 |
-
</td>
|
641 |
-
</tr>
|
642 |
<tr valign="top">
|
643 |
<th scope="row">
|
644 |
<label for="twp_showts"><?php _e( 'Show date/time of Tweet ( rather than 2 ____ ago ):', $this->_slug ); ?></label>
|
@@ -721,7 +710,7 @@ class wpTwitterWidget extends RangePlugin {
|
|
721 |
}
|
722 |
|
723 |
/**
|
724 |
-
* Replace #hashtag with a link to
|
725 |
*
|
726 |
* @param string $text - Tweet text
|
727 |
* @return string - Tweet text with #hashtags linked
|
@@ -732,14 +721,14 @@ class wpTwitterWidget extends RangePlugin {
|
|
732 |
}
|
733 |
|
734 |
/**
|
735 |
-
* Replace #hashtag with a link to
|
736 |
*
|
737 |
* @param array $matches - Tweet text
|
738 |
* @return string - Tweet text with #hashtags linked
|
739 |
*/
|
740 |
private function _linkHashtagsCallback( $matches ) {
|
741 |
$linkAttrs = array(
|
742 |
-
'href' => 'http://
|
743 |
'class' => 'twitter-hashtag'
|
744 |
);
|
745 |
return $matches[1] . $this->_buildLink( $matches[2], $linkAttrs );
|
@@ -1094,8 +1083,8 @@ class wpTwitterWidget extends RangePlugin {
|
|
1094 |
if ( 'true' == $widgetOptions['hidereplies'] )
|
1095 |
$parameters['exclude_replies'] = 'true';
|
1096 |
|
1097 |
-
if ( 'true'
|
1098 |
-
$parameters['include_rts'] = '
|
1099 |
|
1100 |
return $parameters;
|
1101 |
|
@@ -1181,7 +1170,6 @@ class wpTwitterWidget extends RangePlugin {
|
|
1181 |
'after_title' => '</h2>',
|
1182 |
'title' => '',
|
1183 |
'errmsg' => '',
|
1184 |
-
'fetchTimeOut' => '2',
|
1185 |
'username' => '',
|
1186 |
'hidereplies' => 'false',
|
1187 |
'showretweets' => 'true',
|
@@ -1200,10 +1188,6 @@ class wpTwitterWidget extends RangePlugin {
|
|
1200 |
* Attribute names are strtolower'd, so we need to fix them to match
|
1201 |
* the names used through the rest of the plugin
|
1202 |
*/
|
1203 |
-
if ( array_key_exists( 'fetchtimeout', $attr ) ) {
|
1204 |
-
$attr['fetchTimeOut'] = $attr['fetchtimeout'];
|
1205 |
-
unset( $attr['fetchtimeout'] );
|
1206 |
-
}
|
1207 |
if ( array_key_exists( 'showxavisyslink', $attr ) ) {
|
1208 |
$attr['showXavisysLink'] = $attr['showxavisyslink'];
|
1209 |
unset( $attr['showxavisyslink'] );
|
@@ -1262,7 +1246,6 @@ class wpTwitterWidget extends RangePlugin {
|
|
1262 |
'consumer-secret' => '',
|
1263 |
'title' => '',
|
1264 |
'errmsg' => '',
|
1265 |
-
'fetchTimeOut' => '2',
|
1266 |
'username' => '',
|
1267 |
'list' => '',
|
1268 |
'http_vs_https' => 'https',
|
3 |
* Plugin Name: Twitter Widget Pro
|
4 |
* Plugin URI: http://bluedogwebservices.com/wordpress-plugin/twitter-widget-pro/
|
5 |
* Description: A widget that properly handles twitter feeds, including @username, #hashtag, and link parsing. It can even display profile images for the users. Requires PHP5.
|
6 |
+
* Version: 2.5.2
|
7 |
* Author: Aaron D. Campbell
|
8 |
* Author URI: http://ran.ge/
|
9 |
* License: GPLv2 or later
|
30 |
|
31 |
require_once( 'tlc-transients.php' );
|
32 |
require_once( 'range-plugin-framework.php' );
|
33 |
+
define( 'TWP_VERSION', '2.5.2' );
|
34 |
|
35 |
/**
|
36 |
* WP_Widget_Twitter_Pro is the class that handles the main widget.
|
167 |
<label for="<?php echo $this->get_field_id( 'errmsg' ); ?>"><?php _e( 'What to display when Twitter is down ( optional ):', $this->_slug ); ?></label>
|
168 |
<input class="widefat" id="<?php echo $this->get_field_id( 'errmsg' ); ?>" name="<?php echo $this->get_field_name( 'errmsg' ); ?>" type="text" value="<?php esc_attr_e( $instance['errmsg'] ); ?>" />
|
169 |
</p>
|
|
|
|
|
|
|
|
|
170 |
<p>
|
171 |
<label for="<?php echo $this->get_field_id( 'showts' ); ?>"><?php _e( 'Show date/time of Tweet ( rather than 2 ____ ago ):', $this->_slug ); ?></label>
|
172 |
<select id="<?php echo $this->get_field_id( 'showts' ); ?>" name="<?php echo $this->get_field_name( 'showts' ); ?>">
|
359 |
else
|
360 |
$msg = __( 'There was a problem authorizing your account.', $this->_slug );
|
361 |
}
|
362 |
+
if ( ! empty( $msg ) )
|
363 |
+
echo "<div class='updated'><p>" . esc_html( $msg ) . '</p></div>';
|
364 |
}
|
365 |
|
366 |
if ( empty( $this->_settings['twp']['consumer-key'] ) || empty( $this->_settings['twp']['consumer-secret'] ) ) {
|
628 |
<input id="twp_errmsg" name="twp[errmsg]" type="text" class="regular-text code" value="<?php esc_attr_e( $this->_settings['twp']['errmsg'] ); ?>" size="40" />
|
629 |
</td>
|
630 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
631 |
<tr valign="top">
|
632 |
<th scope="row">
|
633 |
<label for="twp_showts"><?php _e( 'Show date/time of Tweet ( rather than 2 ____ ago ):', $this->_slug ); ?></label>
|
710 |
}
|
711 |
|
712 |
/**
|
713 |
+
* Replace #hashtag with a link to twitter.com for that hashtag
|
714 |
*
|
715 |
* @param string $text - Tweet text
|
716 |
* @return string - Tweet text with #hashtags linked
|
721 |
}
|
722 |
|
723 |
/**
|
724 |
+
* Replace #hashtag with a link to twitter.com for that hashtag
|
725 |
*
|
726 |
* @param array $matches - Tweet text
|
727 |
* @return string - Tweet text with #hashtags linked
|
728 |
*/
|
729 |
private function _linkHashtagsCallback( $matches ) {
|
730 |
$linkAttrs = array(
|
731 |
+
'href' => 'http://twitter.com/search?q=' . urlencode( $matches[2] ),
|
732 |
'class' => 'twitter-hashtag'
|
733 |
);
|
734 |
return $matches[1] . $this->_buildLink( $matches[2], $linkAttrs );
|
1083 |
if ( 'true' == $widgetOptions['hidereplies'] )
|
1084 |
$parameters['exclude_replies'] = 'true';
|
1085 |
|
1086 |
+
if ( 'true' != $widgetOptions['showretweets'] )
|
1087 |
+
$parameters['include_rts'] = 'false';
|
1088 |
|
1089 |
return $parameters;
|
1090 |
|
1170 |
'after_title' => '</h2>',
|
1171 |
'title' => '',
|
1172 |
'errmsg' => '',
|
|
|
1173 |
'username' => '',
|
1174 |
'hidereplies' => 'false',
|
1175 |
'showretweets' => 'true',
|
1188 |
* Attribute names are strtolower'd, so we need to fix them to match
|
1189 |
* the names used through the rest of the plugin
|
1190 |
*/
|
|
|
|
|
|
|
|
|
1191 |
if ( array_key_exists( 'showxavisyslink', $attr ) ) {
|
1192 |
$attr['showXavisysLink'] = $attr['showxavisyslink'];
|
1193 |
unset( $attr['showxavisyslink'] );
|
1246 |
'consumer-secret' => '',
|
1247 |
'title' => '',
|
1248 |
'errmsg' => '',
|
|
|
1249 |
'username' => '',
|
1250 |
'list' => '',
|
1251 |
'http_vs_https' => 'https',
|