Version Description
Fixes a serious problem with cacheing of different feeds
=
Download this release
Release Info
Developer | mpntod |
Plugin | Rotating Tweets (Twitter widget and shortcode) |
Version | 0.2 |
Comparing to | |
See all releases |
Code changes from version 0.1 to 0.2
- readme.txt +12 -5
- rotatingtweets.php +8 -6
readme.txt
CHANGED
@@ -4,14 +4,17 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: shortcode,widget,twitter,rotating,rotate
|
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 |
|
11 |
-
Replaces a shortcode such as [rotatingtweets screen_name='
|
12 |
|
13 |
== Description ==
|
14 |
-
* Replaces a [shortcode](http://codex.wordpress.org/Shortcode) such as `[rotatingtweets screen_name='
|
|
|
|
|
|
|
15 |
* Caches the most recent data from Twitter to avoid problems with rate limiting
|
16 |
* Uses [jQuery](http://jquery.com/) and [jQuery.Cycle](http://jquery.malsup.com/cycle/) to produce a nice smooth result.
|
17 |
|
@@ -23,7 +26,7 @@ If you'd like to see what it looks like in action, you can [see the plug-in work
|
|
23 |
|
24 |
Possible variables for the shortcode include:
|
25 |
|
26 |
-
* `screen_name` = Twitter user name
|
27 |
* `include_rts` = `'0'` or `'1'` - include retweets - optional
|
28 |
* `exclude_replies` = `'0'` or `'1'` - exclude replies - optional
|
29 |
* `tweet_count` = number of tweets to show - optional - default is 5
|
@@ -36,9 +39,13 @@ But you may just decide to use the 'Rotating Tweets' widget!
|
|
36 |
Not yet. Why not ask one?
|
37 |
|
38 |
== Upgrade notice ==
|
39 |
-
|
|
|
40 |
|
41 |
== Changelog ==
|
|
|
|
|
|
|
42 |
= 0.1 =
|
43 |
First published version
|
44 |
|
4 |
Tags: shortcode,widget,twitter,rotating,rotate
|
5 |
Requires at least: 2.6
|
6 |
Tested up to: 3.3.2
|
7 |
+
Stable tag: 0.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
+
Replaces a shortcode such as [rotatingtweets screen_name='your_twitter_name'], or a widget, with a rotating tweets display
|
12 |
|
13 |
== Description ==
|
14 |
+
* Replaces a [shortcode](http://codex.wordpress.org/Shortcode) such as `[rotatingtweets screen_name='your_twitter_name']`, or a [widget](http://codex.wordpress.org/WordPress_Widgets), with a rotating display of your most recent tweets
|
15 |
+
* Space efficient - instead of showing all your tweets at once, shows one at a time and then smoothly replaces it with the next one. After showing all your tweets, loops back to the beginning again.
|
16 |
+
* Customisable - you decide whose tweets to show, how many to show, whether to include retweets and replies, and whether to show a follow button
|
17 |
+
* Replaces t.co links with the original link
|
18 |
* Caches the most recent data from Twitter to avoid problems with rate limiting
|
19 |
* Uses [jQuery](http://jquery.com/) and [jQuery.Cycle](http://jquery.malsup.com/cycle/) to produce a nice smooth result.
|
20 |
|
26 |
|
27 |
Possible variables for the shortcode include:
|
28 |
|
29 |
+
* `screen_name` = Twitter user name - required
|
30 |
* `include_rts` = `'0'` or `'1'` - include retweets - optional
|
31 |
* `exclude_replies` = `'0'` or `'1'` - exclude replies - optional
|
32 |
* `tweet_count` = number of tweets to show - optional - default is 5
|
39 |
Not yet. Why not ask one?
|
40 |
|
41 |
== Upgrade notice ==
|
42 |
+
= 0.2 =
|
43 |
+
Fixes a serious problem with cacheing of different feeds
|
44 |
|
45 |
== Changelog ==
|
46 |
+
= 0.2 =
|
47 |
+
Fixed a problem with cacheing
|
48 |
+
|
49 |
= 0.1 =
|
50 |
First published version
|
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='mpntod'], 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
|
@@ -139,6 +139,7 @@ function rotatingtweets_display( $atts, $content=null, $code="" ) {
|
|
139 |
$exclude_replies :: [boolean] exclude replies - optional
|
140 |
$tweet_count :: [integer] number of tweets to show - optional - default 5
|
141 |
$show_follow :: [boolean] show follow button
|
|
|
142 |
*/
|
143 |
extract( shortcode_atts( array(
|
144 |
'screen_name' => 'twitter',
|
@@ -146,9 +147,10 @@ function rotatingtweets_display( $atts, $content=null, $code="" ) {
|
|
146 |
'exclude_replies' => FALSE,
|
147 |
'tweet_count' => 5,
|
148 |
'show_follow' => FALSE,
|
|
|
149 |
), $atts ) );
|
150 |
$tweets = rotatingtweets_get_tweets($screen_name,$include_rts,$exclude_replies,$tweet_count);
|
151 |
-
$returnstring = rotating_tweets_display($tweets,$tweet_count,$show_follow,FALSE);
|
152 |
return $returnstring;
|
153 |
}
|
154 |
add_shortcode( 'rotatingtweets', 'rotatingtweets_display' );
|
@@ -173,8 +175,8 @@ function rotatingtweets_get_tweets($tw_screen_name,$tw_include_rts,$tw_exclude_r
|
|
173 |
$stringname = $tw_screen_name.$tw_include_rts.$tw_exclude_replies;
|
174 |
$optionname = "rotatingtweets-cache";
|
175 |
$option = get_option($optionname);
|
176 |
-
$latest_json = $option[stringname][json];
|
177 |
-
$latest_json_date = $option[stringname][datetime];
|
178 |
$timegap = time()-$latest_json_date;
|
179 |
if($timegap > $cache_delay):
|
180 |
$callstring = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=".$tw_screen_name."&include_entities=1&count=20&include_rts=".$tw_include_rts."&exclude_replies=".$tw_exclude_replies;
|
@@ -183,8 +185,8 @@ function rotatingtweets_get_tweets($tw_screen_name,$tw_include_rts,$tw_exclude_r
|
|
183 |
endif;
|
184 |
if(!empty($twitterjson)):
|
185 |
$latest_json = $twitterjson;
|
186 |
-
$option[stringname][json]=$latest_json;
|
187 |
-
$option[stringname][datetime]=time();
|
188 |
update_option($optionname,$option);
|
189 |
endif;
|
190 |
return($latest_json);
|
2 |
/*
|
3 |
Plugin Name: Rotating Tweets widget & shortcode
|
4 |
Description: Replaces a shortcode such as [rotatingtweets userid='mpntod'], or a widget, with a rotating tweets display
|
5 |
+
Version: 0.2
|
6 |
Author: Martin Tod
|
7 |
Author URI: http://www.martintod.org.uk
|
8 |
License: GPL2
|
139 |
$exclude_replies :: [boolean] exclude replies - optional
|
140 |
$tweet_count :: [integer] number of tweets to show - optional - default 5
|
141 |
$show_follow :: [boolean] show follow button
|
142 |
+
$debug :: [boolean] Show extra variables
|
143 |
*/
|
144 |
extract( shortcode_atts( array(
|
145 |
'screen_name' => 'twitter',
|
147 |
'exclude_replies' => FALSE,
|
148 |
'tweet_count' => 5,
|
149 |
'show_follow' => FALSE,
|
150 |
+
'debug' => FALSE
|
151 |
), $atts ) );
|
152 |
$tweets = rotatingtweets_get_tweets($screen_name,$include_rts,$exclude_replies,$tweet_count);
|
153 |
+
$returnstring = rotating_tweets_display($tweets,$tweet_count,$show_follow,FALSE,$debug);
|
154 |
return $returnstring;
|
155 |
}
|
156 |
add_shortcode( 'rotatingtweets', 'rotatingtweets_display' );
|
175 |
$stringname = $tw_screen_name.$tw_include_rts.$tw_exclude_replies;
|
176 |
$optionname = "rotatingtweets-cache";
|
177 |
$option = get_option($optionname);
|
178 |
+
$latest_json = $option[$stringname][json];
|
179 |
+
$latest_json_date = $option[$stringname][datetime];
|
180 |
$timegap = time()-$latest_json_date;
|
181 |
if($timegap > $cache_delay):
|
182 |
$callstring = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=".$tw_screen_name."&include_entities=1&count=20&include_rts=".$tw_include_rts."&exclude_replies=".$tw_exclude_replies;
|
185 |
endif;
|
186 |
if(!empty($twitterjson)):
|
187 |
$latest_json = $twitterjson;
|
188 |
+
$option[$stringname][json]=$latest_json;
|
189 |
+
$option[$stringname][datetime]=time();
|
190 |
update_option($optionname,$option);
|
191 |
endif;
|
192 |
return($latest_json);
|