Version Description
Fix lists and add ability to remove accounts, as well as plenty of minor bug fixes.
Download this release
Release Info
Developer | aaroncampbell |
Plugin | Twitter Widget Pro |
Version | 2.6.0 |
Comparing to | |
See all releases |
Code changes from version 2.5.4 to 2.6.0
- lib/wp-twitter.php +13 -1
- readme.txt +10 -43
- wp-twitter-widget.php +49 -11
lib/wp-twitter.php
CHANGED
@@ -117,7 +117,19 @@ class wpTwitter {
|
|
117 |
|
118 |
if ( !is_wp_error( $resp ) && $resp['response']['code'] >= 200 && $resp['response']['code'] < 300 ) {
|
119 |
$decoded_response = json_decode( $resp['body'] );
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
$decoded_response = wp_parse_args( $resp['body'] );
|
122 |
return $decoded_response;
|
123 |
} else {
|
117 |
|
118 |
if ( !is_wp_error( $resp ) && $resp['response']['code'] >= 200 && $resp['response']['code'] < 300 ) {
|
119 |
$decoded_response = json_decode( $resp['body'] );
|
120 |
+
/**
|
121 |
+
* There is a problem with some versions of PHP that will cause
|
122 |
+
* json_decode to return the string passed to it in certain cases
|
123 |
+
* when the string isn't valid JSON. This is causing me all sorts
|
124 |
+
* of pain. The solution so far is to check if the return isset()
|
125 |
+
* which is the correct response if the string isn't JSON. Then
|
126 |
+
* also check if a string is returned that has an = in it and if
|
127 |
+
* that's the case assume it's a string that needs to fall back to
|
128 |
+
* using wp_parse_args()
|
129 |
+
* @see https://bugs.php.net/bug.php?id=45989
|
130 |
+
* @see https://github.com/OpenRange/twitter-widget-pro/pull/8
|
131 |
+
*/
|
132 |
+
if ( ( ! isset( $decoded_response ) && ! empty( $resp['body'] ) ) || ( is_string( $decoded_response ) && false !== strpos( $resp['body'], '=' ) ) )
|
133 |
$decoded_response = wp_parse_args( $resp['body'] );
|
134 |
return $decoded_response;
|
135 |
} else {
|
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.6
|
7 |
-
Stable tag: 2.
|
8 |
|
9 |
A widget that properly handles twitter feeds, including parsing @username, #hashtags, and URLs into links.
|
10 |
|
@@ -131,6 +131,9 @@ Aparently the database queries required to display the friends feed was causing
|
|
131 |
|
132 |
== Upgrade Notice ==
|
133 |
|
|
|
|
|
|
|
134 |
= 2.5.4 =
|
135 |
Minor fix for a strict PHP notice
|
136 |
|
@@ -146,50 +149,14 @@ Fix potential conflict with other oAuth plugins
|
|
146 |
= 2.5.0 =
|
147 |
Upgrade to the new Twitter API and add support for lists
|
148 |
|
149 |
-
= 2.4.1 =
|
150 |
-
Better support for hashtags with international characters & new German translation
|
151 |
-
|
152 |
-
= 2.4.0 =
|
153 |
-
Better linking to fix issues with links followed by punctuation plus support for extended characters in hashtags
|
154 |
-
|
155 |
-
= 2.3.11 =
|
156 |
-
Fix issue with "Include Retweets" not unchecking
|
157 |
-
|
158 |
-
= 2.3.10 =
|
159 |
-
Update feeds and links to Ran.ge, moves screenshots outside of plugin zip
|
160 |
-
|
161 |
-
= 2.3.9 =
|
162 |
-
Display dates based on your WordPress timezone setting
|
163 |
-
|
164 |
-
= 2.3.8 =
|
165 |
-
Fix issue with mixed content warning on HTTPS pages
|
166 |
-
|
167 |
-
= 2.3.7 =
|
168 |
-
Adds an option to clear update locks, which may fix the updating issue some people are having
|
169 |
-
|
170 |
-
= 2.3.6 =
|
171 |
-
Small fix for "invalid argument supplied for foreach" error that some people are getting
|
172 |
-
|
173 |
-
= 2.3.5 =
|
174 |
-
Added HTTP & HTTPS API setting and fixed support forum links
|
175 |
-
|
176 |
-
= 2.3.4 =
|
177 |
-
Fixed the conflict with Jetpack! Also a new Arabic translation
|
178 |
-
|
179 |
-
= 2.3.3 =
|
180 |
-
Fixed issue with updates getting stuck, and add data-lang support for Twitter intents
|
181 |
-
|
182 |
-
= 2.3.2 =
|
183 |
-
Fixes some strings that were not translatable
|
184 |
-
|
185 |
-
= 2.3.1 =
|
186 |
-
Fixes an issue with the intents and follow settings not being saved
|
187 |
-
|
188 |
-
= 2.3.0 =
|
189 |
-
Fewer "could not connect to Twitter" messages, new links (reply, retweet, favorite), new follow button, and avatar fixes
|
190 |
-
|
191 |
== Changelog ==
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
= 2.5.4 =
|
194 |
* Minor fix for a strict PHP notice
|
195 |
|
4 |
Tags: twitter, widget, feed
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.6
|
7 |
+
Stable tag: 2.6.0
|
8 |
|
9 |
A widget that properly handles twitter feeds, including parsing @username, #hashtags, and URLs into links.
|
10 |
|
131 |
|
132 |
== Upgrade Notice ==
|
133 |
|
134 |
+
= 2.6.0 =
|
135 |
+
Fix lists and add ability to remove accounts, as well as plenty of minor bug fixes.
|
136 |
+
|
137 |
= 2.5.4 =
|
138 |
Minor fix for a strict PHP notice
|
139 |
|
149 |
= 2.5.0 =
|
150 |
Upgrade to the new Twitter API and add support for lists
|
151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
== Changelog ==
|
153 |
|
154 |
+
= 2.6.0 =
|
155 |
+
* Add ability to remove accounts
|
156 |
+
* Fix bug that made lists not work
|
157 |
+
* Work around PHP bug in json_decode() - https://bugs.php.net/bug.php?id=45989
|
158 |
+
* Fix some strict standards warnings
|
159 |
+
|
160 |
= 2.5.4 =
|
161 |
* Minor fix for a strict PHP notice
|
162 |
|
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.
|
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.
|
34 |
|
35 |
/**
|
36 |
* WP_Widget_Twitter_Pro is the class that handles the main widget.
|
@@ -194,6 +194,14 @@ class WP_Widget_Twitter_Pro extends WP_Widget {
|
|
194 |
<label for="<?php echo $this->get_field_id( 'showXavisysLink' ); ?>"><?php _e( 'Show Link to Twitter Widget Pro', $this->_slug ); ?></label>
|
195 |
</p>
|
196 |
<p><?php echo $wpTwitterWidget->get_support_forum_link(); ?></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
<?php
|
198 |
return;
|
199 |
}
|
@@ -314,6 +322,20 @@ class wpTwitterWidget extends RangePlugin {
|
|
314 |
exit;
|
315 |
}
|
316 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
if ( 'authorize' == $_GET['action'] ) {
|
318 |
check_admin_referer( 'authorize' );
|
319 |
$auth_redirect = add_query_arg( array( 'action' => 'authorized' ), $this->get_options_url() );
|
@@ -339,10 +361,12 @@ class wpTwitterWidget extends RangePlugin {
|
|
339 |
delete_option( '_twp_request_token_'.$_GET['nonce'] );
|
340 |
|
341 |
$token = $this->_wp_twitter_oauth->get_access_token( $_GET['oauth_verifier'] );
|
342 |
-
|
343 |
-
|
|
|
344 |
|
345 |
-
|
|
|
346 |
wp_safe_redirect( add_query_arg( $redirect_args, $this->get_options_url() ) );
|
347 |
exit;
|
348 |
}
|
@@ -360,6 +384,11 @@ class wpTwitterWidget extends RangePlugin {
|
|
360 |
$msg = sprintf( __( 'Successfully authorized @%s', $this->_slug ), $_GET['authorized'] );
|
361 |
else
|
362 |
$msg = __( 'There was a problem authorizing your account.', $this->_slug );
|
|
|
|
|
|
|
|
|
|
|
363 |
}
|
364 |
if ( ! empty( $msg ) )
|
365 |
echo "<div class='updated'><p>" . esc_html( $msg ) . '</p></div>';
|
@@ -419,10 +448,16 @@ class wpTwitterWidget extends RangePlugin {
|
|
419 |
$style = 'color:red;';
|
420 |
$auth_link = ' - <a href="' . esc_url( $authorize_user_url ) . '">' . __( 'Reauthorize', $this->_slug ) . '</a>';
|
421 |
}
|
|
|
|
|
|
|
|
|
|
|
422 |
?>
|
423 |
<tr valign="top">
|
424 |
<th scope="row" style="<?php echo esc_attr( $style ); ?>">
|
425 |
-
<strong>@<?php echo esc_html( $u['screen_name'] ) . $auth_link
|
|
|
426 |
</th>
|
427 |
<?php
|
428 |
if ( ! is_wp_error( $rates ) ) {
|
@@ -1044,10 +1079,11 @@ class wpTwitterWidget extends RangePlugin {
|
|
1044 |
return $response;
|
1045 |
}
|
1046 |
} elseif ( ! empty( $parameters['list_id'] ) ) {
|
1047 |
-
$
|
|
|
1048 |
$this->_wp_twitter_oauth->set_token( $this->_settings['twp-authed-users'][strtolower( $user )] );
|
1049 |
|
1050 |
-
$response = $this->_wp_twitter_oauth->send_authed_request( 'statuses
|
1051 |
if ( ! is_wp_error( $response ) )
|
1052 |
return $response;
|
1053 |
}
|
@@ -1083,10 +1119,12 @@ class wpTwitterWidget extends RangePlugin {
|
|
1083 |
'count' => $widgetOptions['items'],
|
1084 |
);
|
1085 |
|
1086 |
-
if ( ! empty( $widgetOptions['username'] ) )
|
1087 |
$parameters['screen_name'] = $widgetOptions['username'];
|
1088 |
-
elseif ( ! empty( $widgetOptions['list'] ) )
|
1089 |
-
$
|
|
|
|
|
1090 |
|
1091 |
if ( 'true' == $widgetOptions['hidereplies'] )
|
1092 |
$parameters['exclude_replies'] = 'true';
|
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.6.0
|
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.6.0' );
|
34 |
|
35 |
/**
|
36 |
* WP_Widget_Twitter_Pro is the class that handles the main widget.
|
194 |
<label for="<?php echo $this->get_field_id( 'showXavisysLink' ); ?>"><?php _e( 'Show Link to Twitter Widget Pro', $this->_slug ); ?></label>
|
195 |
</p>
|
196 |
<p><?php echo $wpTwitterWidget->get_support_forum_link(); ?></p>
|
197 |
+
<script type="text/javascript">
|
198 |
+
jQuery( '#<?php echo $this->get_field_id( 'username' ) ?>' ).on( 'change', function() {
|
199 |
+
jQuery('#<?php echo $this->get_field_id( 'list' ) ?>' ).val(0);
|
200 |
+
});
|
201 |
+
jQuery( '#<?php echo $this->get_field_id( 'list' ) ?>' ).on( 'change', function() {
|
202 |
+
jQuery('#<?php echo $this->get_field_id( 'username' ) ?>' ).val(0);
|
203 |
+
});
|
204 |
+
</script>
|
205 |
<?php
|
206 |
return;
|
207 |
}
|
322 |
exit;
|
323 |
}
|
324 |
|
325 |
+
if ( 'remove' == $_GET['action'] ) {
|
326 |
+
check_admin_referer( 'remove-' . $_GET['screen_name'] );
|
327 |
+
|
328 |
+
$redirect_args = array(
|
329 |
+
'message' => 'removed',
|
330 |
+
'removed' => '',
|
331 |
+
);
|
332 |
+
unset( $this->_settings['twp-authed-users'][strtolower($_GET['screen_name'])] );
|
333 |
+
if ( update_option( 'twp-authed-users', $this->_settings['twp-authed-users'] ) );
|
334 |
+
$redirect_args['removed'] = $_GET['screen_name'];
|
335 |
+
|
336 |
+
wp_safe_redirect( add_query_arg( $redirect_args, $this->get_options_url() ) );
|
337 |
+
exit;
|
338 |
+
}
|
339 |
if ( 'authorize' == $_GET['action'] ) {
|
340 |
check_admin_referer( 'authorize' );
|
341 |
$auth_redirect = add_query_arg( array( 'action' => 'authorized' ), $this->get_options_url() );
|
361 |
delete_option( '_twp_request_token_'.$_GET['nonce'] );
|
362 |
|
363 |
$token = $this->_wp_twitter_oauth->get_access_token( $_GET['oauth_verifier'] );
|
364 |
+
if ( ! is_wp_error( $token ) ) {
|
365 |
+
$this->_settings['twp-authed-users'][strtolower($token['screen_name'])] = $token;
|
366 |
+
update_option( 'twp-authed-users', $this->_settings['twp-authed-users'] );
|
367 |
|
368 |
+
$redirect_args['authorized'] = $token['screen_name'];
|
369 |
+
}
|
370 |
wp_safe_redirect( add_query_arg( $redirect_args, $this->get_options_url() ) );
|
371 |
exit;
|
372 |
}
|
384 |
$msg = sprintf( __( 'Successfully authorized @%s', $this->_slug ), $_GET['authorized'] );
|
385 |
else
|
386 |
$msg = __( 'There was a problem authorizing your account.', $this->_slug );
|
387 |
+
} elseif ( 'removed' == $_GET['message'] ) {
|
388 |
+
if ( ! empty( $_GET['removed'] ) )
|
389 |
+
$msg = sprintf( __( 'Successfully removed @%s', $this->_slug ), $_GET['removed'] );
|
390 |
+
else
|
391 |
+
$msg = __( 'There was a problem removing your account.', $this->_slug );
|
392 |
}
|
393 |
if ( ! empty( $msg ) )
|
394 |
echo "<div class='updated'><p>" . esc_html( $msg ) . '</p></div>';
|
448 |
$style = 'color:red;';
|
449 |
$auth_link = ' - <a href="' . esc_url( $authorize_user_url ) . '">' . __( 'Reauthorize', $this->_slug ) . '</a>';
|
450 |
}
|
451 |
+
$query_args = array(
|
452 |
+
'action' => 'remove',
|
453 |
+
'screen_name' => $u['screen_name'],
|
454 |
+
);
|
455 |
+
$remove_user_url = wp_nonce_url( add_query_arg( $query_args ), 'remove-' . $u['screen_name'] );
|
456 |
?>
|
457 |
<tr valign="top">
|
458 |
<th scope="row" style="<?php echo esc_attr( $style ); ?>">
|
459 |
+
<strong>@<?php echo esc_html( $u['screen_name'] ) . $auth_link;?></strong>
|
460 |
+
<br /><a href="<?php echo esc_url( $remove_user_url ) ?>"><?php _e( 'Remove', $this->_slug ) ?></a>
|
461 |
</th>
|
462 |
<?php
|
463 |
if ( ! is_wp_error( $rates ) ) {
|
1079 |
return $response;
|
1080 |
}
|
1081 |
} elseif ( ! empty( $parameters['list_id'] ) ) {
|
1082 |
+
$list_info = explode( '::', $widgetOptions['list'] );
|
1083 |
+
$user = array_shift( $list_info );
|
1084 |
$this->_wp_twitter_oauth->set_token( $this->_settings['twp-authed-users'][strtolower( $user )] );
|
1085 |
|
1086 |
+
$response = $this->_wp_twitter_oauth->send_authed_request( 'lists/statuses', 'GET', $parameters );
|
1087 |
if ( ! is_wp_error( $response ) )
|
1088 |
return $response;
|
1089 |
}
|
1119 |
'count' => $widgetOptions['items'],
|
1120 |
);
|
1121 |
|
1122 |
+
if ( ! empty( $widgetOptions['username'] ) ) {
|
1123 |
$parameters['screen_name'] = $widgetOptions['username'];
|
1124 |
+
} elseif ( ! empty( $widgetOptions['list'] ) ) {
|
1125 |
+
$list_info = explode( '::', $widgetOptions['list'] );
|
1126 |
+
$parameters['list_id'] = array_pop( $list_info );
|
1127 |
+
}
|
1128 |
|
1129 |
if ( 'true' == $widgetOptions['hidereplies'] )
|
1130 |
$parameters['exclude_replies'] = 'true';
|