Rotating Tweets (Twitter widget and shortcode) - Version 1.8.1

Version Description

  • Fixed "no updating" caching bug

=

Download this release

Release Info

Developer mpntod
Plugin Icon wp plugin Rotating Tweets (Twitter widget and shortcode)
Version 1.8.1
Comparing to
See all releases

Code changes from version 1.8 to 1.8.1

Files changed (2) hide show
  1. readme.txt +16 -12
  2. rotatingtweets.php +20 -4
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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,animation,jquery,jquery cycle,cycle,multilingual,responsive,page builder
5
  Requires at least: 3.2
6
- Tested up to: 4.4
7
- Stable tag: 1.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -21,7 +21,7 @@ Twitter widget and shortcode to show your latest tweets one at a time an animate
21
  * Replaces [t.co](http://t.co) links with the original link
22
  * Caches the most recent data from Twitter to avoid problems with rate limiting
23
  * Uses [jQuery](http://jquery.com/), [jQuery.Cycle](http://jquery.malsup.com/cycle/) and [jQuery.Cycle2](http://jquery.malsup.com/cycle2/) to produce a nice smooth result.
24
- * Compatible with [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/).
25
  * **Multi-lingual** - now set up to be multi-lingual. The Twitter 'follow' button is automatically translated to match your site's language setting [if Twitter has made the appropriate language available](https://dev.twitter.com/docs/api/1.1/get/help/languages). Also uses [Wordpress's multi-lingual capability](http://codex.wordpress.org/I18n_for_WordPress_Developers) to enable translation of all the other text used by the plug-in via [language packs](https://translate.wordpress.org/projects/wp-plugins/rotatingtweets).
26
 
27
  If you'd like to see what the plug-in looks like in action, you can [see the plug-in working here](http://www.martintod.org.uk/2012/05/29/new-twitter-plugin-to-show-tweets-in-rotation/).
@@ -89,10 +89,10 @@ Possible variables for the shortcode include:
89
  * `official_format_override` = `'0'` or `'1'` - enables you to change the settings for `show_meta_reply_retweet_favorite` and `show_meta_timestamp` on the 'official formats'.
90
  * `profile_image_size` = `'normal'`, `'bigger'`, `'mini'` or `'original'` - lets you change the size of profile images - default is `'normal'`
91
  * `shuffle` = `'0'` or `'1'` - shuffle the order that Tweets display - default is `'0'`
92
- * `merge_cache` = `'0'` or `'1'` - switches cacheing of searches on or off - default is `'1'` (i.e. on)
93
 
94
  * **Caching**
95
- * `w3tc_render_to` = 'your_choice_of_random_string' - used to support 'fragment caching' by [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/). For this to work, you also need to ensure that `W3TC_DYNAMIC_SECURITY` is defined in your `wp-config.php` file and that you not using 'HTTP Compression' on the W3 Total Cache 'Browser Cache' settings page or 'Enhanced Disk caching' on the W3 Total Cache 'Page Cache' settings page.
96
 
97
  * **Twitter follow button**
98
  * `show_follow` = `'0'` or `'1'` - show follow button - default is `'0'`
@@ -183,11 +183,15 @@ into your CSS - changing `123px;` to the width you're aiming at - either via put
183
  You can do this by going to the `rotatingtweets/css` directory and renaming `rotatingtweets-sample.css` to `rotatingtweets.css` and putting it in the `wp-content/uploads/` directory. This displays a Twitter bird to the left of your tweets. Any CSS you put into `rotatingtweets.css` won't be overwritten when the plug-in is upgraded to the latest version.
184
 
185
  == Upgrade notice ==
186
- = 1.8 =
187
- * New option to hide CSS. Updated Twitter JavaScript. Fixed text encoding bug.
188
 
189
  == Changelog ==
 
 
 
190
  = 1.8 =
 
191
  * Addition of new option to hide CSS
192
  * Updated Twitter JavaScript
193
  * Translated the base readme file into US English
@@ -281,7 +285,7 @@ You can do this by going to the `rotatingtweets/css` directory and renaming `rot
281
  * Solves clash with [Cyclone Slider 2](/plugins/cyclone-slider-2/)
282
  * Adds script version details to the JavaScript
283
  * Removal of excess spaces from `middot` shortcode option
284
- * Adds option for 'custom' display layoot with user-defined display function `rotatingtweets_display_override()`
285
 
286
  = 1.6.11 =
287
  * Fixing cache bug with 'user_mentions'
@@ -423,7 +427,7 @@ You can do this by going to the `rotatingtweets/css` directory and renaming `rot
423
  * Fixed bug with `console.log` javascript on IE.
424
 
425
  = 0.711 (1.3.7) =
426
- * Fixed up a significant problem with cacheing.
427
 
428
  = 0.709 (1.3.6) =
429
  * Tidying up error reporting.
@@ -538,16 +542,16 @@ You can do this by going to the `rotatingtweets/css` directory and renaming `rot
538
  * Fixed flaw in how flags are handled.
539
 
540
  = 0.26 (0.1.4) =
541
- * Stops display and cacheing of non-existent twitter feeds
542
 
543
  = 0.25 (0.1.3) =
544
- * Stops display and cacheing of faulty twitter feeds
545
 
546
  = 0.21 (0.1.2) =
547
  * Replaced a missing `</div>` in the follow-button code (with thanks to [jacobp](http://wordpress.org/support/profile/jacobp) for spotting it and suggesting a fix)
548
 
549
  = 0.2 (0.1.1) =
550
- * Fixed a problem with cacheing
551
 
552
  = 0.1 (0.1.0) =
553
  * First published version
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,animation,jquery,jquery cycle,cycle,multilingual,responsive,page builder
5
  Requires at least: 3.2
6
+ Tested up to: 4.4.1
7
+ Stable tag: 1.8.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
21
  * Replaces [t.co](http://t.co) links with the original link
22
  * Caches the most recent data from Twitter to avoid problems with rate limiting
23
  * Uses [jQuery](http://jquery.com/), [jQuery.Cycle](http://jquery.malsup.com/cycle/) and [jQuery.Cycle2](http://jquery.malsup.com/cycle2/) to produce a nice smooth result.
24
+ * Compatible with [W3 Total Cache](/plugins/w3-total-cache/).
25
  * **Multi-lingual** - now set up to be multi-lingual. The Twitter 'follow' button is automatically translated to match your site's language setting [if Twitter has made the appropriate language available](https://dev.twitter.com/docs/api/1.1/get/help/languages). Also uses [Wordpress's multi-lingual capability](http://codex.wordpress.org/I18n_for_WordPress_Developers) to enable translation of all the other text used by the plug-in via [language packs](https://translate.wordpress.org/projects/wp-plugins/rotatingtweets).
26
 
27
  If you'd like to see what the plug-in looks like in action, you can [see the plug-in working here](http://www.martintod.org.uk/2012/05/29/new-twitter-plugin-to-show-tweets-in-rotation/).
89
  * `official_format_override` = `'0'` or `'1'` - enables you to change the settings for `show_meta_reply_retweet_favorite` and `show_meta_timestamp` on the 'official formats'.
90
  * `profile_image_size` = `'normal'`, `'bigger'`, `'mini'` or `'original'` - lets you change the size of profile images - default is `'normal'`
91
  * `shuffle` = `'0'` or `'1'` - shuffle the order that Tweets display - default is `'0'`
92
+ * `merge_cache` = `'0'` or `'1'` - switches caching of searches on or off - default is `'1'` (i.e. on)
93
 
94
  * **Caching**
95
+ * `w3tc_render_to` = 'your_choice_of_random_string' - used to support 'fragment caching' by [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/). For this to work, you also need to ensure that `W3TC_DYNAMIC_SECURITY` is defined in your `wp-config.php` file and that you are not using 'HTTP Compression' on the W3 Total Cache 'Browser Cache' settings page or 'Enhanced Disk caching' on the W3 Total Cache 'Page Cache' settings page.
96
 
97
  * **Twitter follow button**
98
  * `show_follow` = `'0'` or `'1'` - show follow button - default is `'0'`
183
  You can do this by going to the `rotatingtweets/css` directory and renaming `rotatingtweets-sample.css` to `rotatingtweets.css` and putting it in the `wp-content/uploads/` directory. This displays a Twitter bird to the left of your tweets. Any CSS you put into `rotatingtweets.css` won't be overwritten when the plug-in is upgraded to the latest version.
184
 
185
  == Upgrade notice ==
186
+ = 1.8.1 =
187
+ * Fixed "no updating" caching bug
188
 
189
  == Changelog ==
190
+ = 1.8.1 =
191
+ * Fixed "no updating" caching bug
192
+
193
  = 1.8 =
194
+ * Better handling of multiple screen names in a single widget or shortcode
195
  * Addition of new option to hide CSS
196
  * Updated Twitter JavaScript
197
  * Translated the base readme file into US English
285
  * Solves clash with [Cyclone Slider 2](/plugins/cyclone-slider-2/)
286
  * Adds script version details to the JavaScript
287
  * Removal of excess spaces from `middot` shortcode option
288
+ * Adds option for 'custom' display layout with user-defined display function `rotatingtweets_display_override()`
289
 
290
  = 1.6.11 =
291
  * Fixing cache bug with 'user_mentions'
427
  * Fixed bug with `console.log` javascript on IE.
428
 
429
  = 0.711 (1.3.7) =
430
+ * Fixed up a significant problem with caching.
431
 
432
  = 0.709 (1.3.6) =
433
  * Tidying up error reporting.
542
  * Fixed flaw in how flags are handled.
543
 
544
  = 0.26 (0.1.4) =
545
+ * Stops display and caching of non-existent twitter feeds
546
 
547
  = 0.25 (0.1.3) =
548
+ * Stops display and caching of faulty twitter feeds
549
 
550
  = 0.21 (0.1.2) =
551
  * Replaced a missing `</div>` in the follow-button code (with thanks to [jacobp](http://wordpress.org/support/profile/jacobp) for spotting it and suggesting a fix)
552
 
553
  = 0.2 (0.1.1) =
554
+ * Fixed a problem with caching
555
 
556
  = 0.1 (0.1.0) =
557
  * First published version
rotatingtweets.php CHANGED
@@ -1,9 +1,8 @@
1
  <?php
2
  /*
3
  Plugin Name: Rotating Tweets (Twitter widget & shortcode)
4
- Plugin Name: Rotating Tweets (Twitter widget & shortcode)
5
  Description: Replaces a shortcode such as [rotatingtweets screen_name='your_twitter_name'], or a widget, with a rotating tweets display
6
- Version: 1.8
7
  Text Domain: rotatingtweets
8
  Domain Path: /languages
9
  Author: Martin Tod
@@ -105,7 +104,16 @@ class rotatingtweets_Widget extends WP_Widget {
105
  }
106
  if(empty($newargs['timeout'])) $newargs['timeout'] = 4000;
107
  $newargs['text_cache_id'] = "rt-wg-".md5(serialize($newargs));
108
- $rt_tweet_string = rotatingtweets_get_transient($newargs['text_cache_id']);
 
 
 
 
 
 
 
 
 
109
  echo $before_widget;
110
  if ( $title ):
111
  echo $before_title . $title . $after_title;
@@ -628,7 +636,15 @@ function rotatingtweets_display_shortcode( $atts, $content=null, $code="", $prin
628
  if(empty($screen_name)) $screen_name = 'twitter';
629
  # Makes sure the scripts are listed
630
  rotatingtweets_enqueue_scripts();
631
- $returnstring = rotatingtweets_get_transient($args['text_cache_id']);
 
 
 
 
 
 
 
 
632
  if(strlen($returnstring)==0):
633
  $tweets = rotatingtweets_get_tweets($screen_name,$include_rts,$exclude_replies,$get_favorites,$search,$list,$args['merge_cache'],$collection);
634
  $returnstring = rotating_tweets_display($tweets,$args,$print);
1
  <?php
2
  /*
3
  Plugin Name: Rotating Tweets (Twitter widget & shortcode)
 
4
  Description: Replaces a shortcode such as [rotatingtweets screen_name='your_twitter_name'], or a widget, with a rotating tweets display
5
+ Version: 1.8.1
6
  Text Domain: rotatingtweets
7
  Domain Path: /languages
8
  Author: Martin Tod
104
  }
105
  if(empty($newargs['timeout'])) $newargs['timeout'] = 4000;
106
  $newargs['text_cache_id'] = "rt-wg-".md5(serialize($newargs));
107
+ // $rt_tweet_string = rotatingtweets_get_transient($newargs['text_cache_id']);
108
+ $rotatingtweets_otk = rotatingtweets_get_transient($newargs['text_cache_id']&'-otk');
109
+ if($rotatingtweets_otk):
110
+ $rt_tweet_string = rotatingtweets_get_transient($newargs['text_cache_id']);
111
+ else:
112
+ // Automatically delete text cache every 10 minutes
113
+ rotatingtweets_set_transient($newargs['text_cache_id']&'-otk',1,10*60);
114
+ delete_transient($newargs['text_cache_id']);
115
+ endif;
116
+
117
  echo $before_widget;
118
  if ( $title ):
119
  echo $before_title . $title . $after_title;
636
  if(empty($screen_name)) $screen_name = 'twitter';
637
  # Makes sure the scripts are listed
638
  rotatingtweets_enqueue_scripts();
639
+ # Kill old transients
640
+ $rotatingtweets_otk = rotatingtweets_get_transient($args['text_cache_id']&'-otk');
641
+ if($rotatingtweets_otk):
642
+ $returnstring = rotatingtweets_get_transient($args['text_cache_id']);
643
+ else:
644
+ // Automatically delete text cache every 10 minutes
645
+ rotatingtweets_set_transient($args['text_cache_id']&'-otk',1,10*60);
646
+ delete_transient($args['text_cache_id']);
647
+ endif;
648
  if(strlen($returnstring)==0):
649
  $tweets = rotatingtweets_get_tweets($screen_name,$include_rts,$exclude_replies,$get_favorites,$search,$list,$args['merge_cache'],$collection);
650
  $returnstring = rotating_tweets_display($tweets,$args,$print);