Version Description
Better handling of retweets. No longer cuts off the end of the text on longer RTs.
=
Download this release
Release Info
Developer | mpntod |
Plugin | Rotating Tweets (Twitter widget and shortcode) |
Version | 0.29 |
Comparing to | |
See all releases |
Code changes from version 0.28 to 0.29
- readme.txt +8 -7
- rotatingtweets.php +22 -8
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Rotating Tweets widget and shortcode ===
|
2 |
Contributors: mpntod
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9XCNM4QSVHYT8
|
4 |
-
Tags: shortcode,widget,twitter,rotating,rotate,rotator,tweet,
|
5 |
Requires at least: 2.6
|
6 |
Tested up to: 3.3.2
|
7 |
-
Stable tag: 0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -36,15 +36,16 @@ But you may just decide to use the 'Rotating Tweets' widget!
|
|
36 |
|
37 |
== Frequently Asked Questions ==
|
38 |
= How often does the plug-in call Twitter =
|
39 |
-
In most cases, each use (or "instance") of this plug-in gets data from Twitter every 2 minutes.
|
40 |
-
|
41 |
-
The exception is when two or more instances share the same settings (screen name etc.), in which case they share the same data rather than each calling it separately.
|
42 |
|
43 |
== Upgrade notice ==
|
44 |
-
= 0.
|
45 |
-
|
46 |
|
47 |
== Changelog ==
|
|
|
|
|
|
|
48 |
= 0.28 =
|
49 |
Properly fixes flaw in how flags are handled.
|
50 |
|
1 |
=== Rotating Tweets widget and shortcode ===
|
2 |
Contributors: mpntod
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9XCNM4QSVHYT8
|
4 |
+
Tags: shortcode,widget,twitter,rotating,rotate,rotator,tweet,tweets
|
5 |
Requires at least: 2.6
|
6 |
Tested up to: 3.3.2
|
7 |
+
Stable tag: 0.29
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
36 |
|
37 |
== Frequently Asked Questions ==
|
38 |
= How often does the plug-in call Twitter =
|
39 |
+
In most cases, each use (or "instance") of this plug-in gets data from Twitter every 2 minutes. The exception is when two or more instances share the same settings (screen name etc.), in which case they share the same data rather than each calling it separately.
|
|
|
|
|
40 |
|
41 |
== Upgrade notice ==
|
42 |
+
= 0.29 =
|
43 |
+
Better handling of retweets. No longer cuts off the end of the text on longer RTs.
|
44 |
|
45 |
== Changelog ==
|
46 |
+
= 0.29 =
|
47 |
+
Better handling of retweets. No longer cuts off the end of the text on longer RTs.
|
48 |
+
|
49 |
= 0.28 =
|
50 |
Properly fixes flaw in how flags are handled.
|
51 |
|
rotatingtweets.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Rotating Tweets widget & shortcode
|
4 |
Description: Replaces a shortcode such as [rotatingtweets userid='your_twitter_name'], or a widget, with a rotating tweets display
|
5 |
-
Version: 0.
|
6 |
Author: Martin Tod
|
7 |
Author URI: http://www.martintod.org.uk
|
8 |
License: GPL2
|
@@ -202,22 +202,36 @@ function rotating_tweets_display($json,$tweet_count=5,$show_follow=FALSE,$print=
|
|
202 |
$user = $twitter_object->user;
|
203 |
# Now the substitutions
|
204 |
$entities = $twitter_object->entities;
|
205 |
-
|
206 |
-
# Fix up links, hashtags and use names
|
207 |
unset($before);
|
208 |
unset($after);
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
|
|
|
|
|
|
214 |
endif;
|
|
|
215 |
$user_mentions = $entities->user_mentions;
|
216 |
if(!empty($user_mentions)):
|
217 |
foreach($user_mentions as $user_mention):
|
218 |
$before[] = "*@".$user_mention->screen_name."*i";
|
219 |
$after[] = "<a href='http://twitter.com/".$user_mention->screen_name."' title='".$user_mention->name."'>@".$user_mention->screen_name."</a>";
|
220 |
endforeach;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
endif;
|
222 |
$media = $entities->media;
|
223 |
if(!empty($media)):
|
2 |
/*
|
3 |
Plugin Name: Rotating Tweets widget & shortcode
|
4 |
Description: Replaces a shortcode such as [rotatingtweets userid='your_twitter_name'], or a widget, with a rotating tweets display
|
5 |
+
Version: 0.29
|
6 |
Author: Martin Tod
|
7 |
Author URI: http://www.martintod.org.uk
|
8 |
License: GPL2
|
202 |
$user = $twitter_object->user;
|
203 |
# Now the substitutions
|
204 |
$entities = $twitter_object->entities;
|
205 |
+
# Fix up retweets, links, hashtags and use names
|
|
|
206 |
unset($before);
|
207 |
unset($after);
|
208 |
+
# First clean up the retweets
|
209 |
+
$rt_data = $twitter_object->retweeted_status;
|
210 |
+
if(!empty($rt_data)):
|
211 |
+
$rt_user = $rt_data->user;
|
212 |
+
$main_text = "RT @".$rt_user->screen_name . " " . $rt_data->text;
|
213 |
+
$before[] = "*@".$rt_user->screen_name."*i";
|
214 |
+
$after[] = "<a href='http://twitter.com/".$rt_user->screen_name."' title='".$rt_user->name."'>@".$rt_user->screen_name."</a>";
|
215 |
+
$entities = $rt_data->entities;
|
216 |
endif;
|
217 |
+
# First the user mentions
|
218 |
$user_mentions = $entities->user_mentions;
|
219 |
if(!empty($user_mentions)):
|
220 |
foreach($user_mentions as $user_mention):
|
221 |
$before[] = "*@".$user_mention->screen_name."*i";
|
222 |
$after[] = "<a href='http://twitter.com/".$user_mention->screen_name."' title='".$user_mention->name."'>@".$user_mention->screen_name."</a>";
|
223 |
endforeach;
|
224 |
+
# Clearing up duplicates to avoid strange result (possibly risky?)
|
225 |
+
$before = array_unique($before);
|
226 |
+
$after = array_unique($after);
|
227 |
+
endif;
|
228 |
+
# Now the URLs
|
229 |
+
$urls = $entities->urls;
|
230 |
+
if(!empty($urls)):
|
231 |
+
foreach($urls as $url):
|
232 |
+
$before[] = "*".$url->url."*";
|
233 |
+
$after[] = "<a href='".$url->expanded_url."'>".$url->display_url."</a>";
|
234 |
+
endforeach;
|
235 |
endif;
|
236 |
$media = $entities->media;
|
237 |
if(!empty($media)):
|