Rotating Tweets (Twitter widget and shortcode) - Version 0.703

Version Description

Important upgrade needed for Rotating Tweets to keep working after March 2013. Supports version 1.1 of the Twitter API.

=

Download this release

Release Info

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

Code changes from version 0.702 to 0.703

Files changed (2) hide show
  1. readme.txt +5 -2
  2. rotatingtweets.php +17 -3
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: shortcode,widget,twitter,rotating,rotate,rotator,tweet,tweets,animation,jquery,jquery cycle,cycle,multilingual
5
  Requires at least: 2.6
6
  Tested up to: 3.5
7
- Stable tag: 0.702
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -82,10 +82,13 @@ In most cases, each use (or "instance") of this plug-in gets data from Twitter e
82
  You can do this by going to the `rotatingtweets/css` directory and renaming `yourstyle-sample.css` to `yourstyle.css`. This displays a Twitter bird to the left of your tweets. Any CSS you put into `yourstyle.css` won't be overwritten when the plug-in is upgraded to the latest version.
83
 
84
  == Upgrade notice ==
85
- = 0.702 =
86
  Important upgrade needed for Rotating Tweets to keep working after March 2013. Supports version 1.1 of the Twitter API.
87
 
88
  == Changelog ==
 
 
 
89
  = 0.702 =
90
  Adjustment to javascript and CSS to cope with long links or long words
91
 
4
  Tags: shortcode,widget,twitter,rotating,rotate,rotator,tweet,tweets,animation,jquery,jquery cycle,cycle,multilingual
5
  Requires at least: 2.6
6
  Tested up to: 3.5
7
+ Stable tag: 0.703
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
82
  You can do this by going to the `rotatingtweets/css` directory and renaming `yourstyle-sample.css` to `yourstyle.css`. This displays a Twitter bird to the left of your tweets. Any CSS you put into `yourstyle.css` won't be overwritten when the plug-in is upgraded to the latest version.
83
 
84
  == Upgrade notice ==
85
+ = 0.703 =
86
  Important upgrade needed for Rotating Tweets to keep working after March 2013. Supports version 1.1 of the Twitter API.
87
 
88
  == Changelog ==
89
+ = 0.703 =
90
+ Minor code tidying to improve debugging and increase speed!
91
+
92
  = 0.702 =
93
  Adjustment to javascript and CSS to cope with long links or long words
94
 
rotatingtweets.php CHANGED
@@ -2,7 +2,7 @@
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: 0.702
6
  Text Domain: rotatingtweets
7
  Author: Martin Tod
8
  Author URI: http://www.martintod.org.uk
@@ -49,7 +49,7 @@ class rotatingtweets_Widget extends WP_Widget {
49
  $title = apply_filters('widget_title', $instance['title']);
50
  $positive_variables = array('screen_name','include_rts','exclude_replies','links_in_new_window','tweet_count','show_follow','timeout','rotation_type','show_meta_reply_retweet_favorite','official_format');
51
  foreach($positive_variables as $var) {
52
- $newargs[$var] = $instance['tw_'.$var];
53
  }
54
  $negative_variables = array('meta_timestamp','meta_screen_name','meta_via');
55
  foreach($negative_variables as $var) {
@@ -494,7 +494,9 @@ function rotatingtweets_call_twitter_API($command,$options = NULL,$api = NULL )
494
  if(!empty($api)):
495
  $connection = new wp_TwitterOAuth($api['key'], $api['secret'], $api['token'], $api['token_secret'] );
496
  // $result = $connection->get('statuses/user_timeline', $options);
497
- if(WP_DEBUG) echo "\n<!-- Using OAuth - version 1.1 of API -->\n";
 
 
498
  $result = $connection->get($command , $options);
499
  else:
500
  // Construct old style API command
@@ -549,9 +551,14 @@ function rotatingtweets_get_tweets($tw_screen_name,$tw_include_rts,$tw_exclude_r
549
  $twitterdata = rotatingtweets_call_twitter_API('statuses/user_timeline',$apioptions);
550
  if(!is_wp_error($twitterdata)):
551
  $twitterjson = json_decode($twitterdata['body'],TRUE);
 
 
 
552
  else:
553
  set_transient('rotatingtweets_wp_error',$twitterdata->get_error_messages(), 120);
554
  endif;
 
 
555
  endif;
556
  # Checks for errors in the reply
557
  if(!empty($twitterjson['errors'])):
@@ -651,6 +658,11 @@ function rotatingtweets_get_twitter_language() {
651
  endif;
652
  endif;
653
  if(empty($latest_languages)) $latest_languages = $fallback;
 
 
 
 
 
654
  return($latest_languages);
655
  }
656
 
@@ -721,6 +733,7 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
721
  endif;
722
  else:
723
  $tweet_counter = 0;
 
724
  $rate = rotatingtweets_get_rate_data();
725
  # Check if the problem is rate limiting
726
  if($rate['hourly_limit']>0 && $rate['remaining_hits'] == 0):
@@ -728,6 +741,7 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
728
  $result .= "<!-- Rate limited -- ";
729
  $result .= sprintf(_n('Next attempt to get data will be in %d minute','Next attempt to get data will be in %d minutes',$waittimevalue,'rotatingtweets'),$waittimevalue)." -->";
730
  endif;
 
731
  # Set up the link treatment
732
  if(isset($args['links_in_new_window']) && !empty($args['links_in_new_window']) ) {
733
  $targetvalue = ' target="_blank" ';
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: 0.703
6
  Text Domain: rotatingtweets
7
  Author: Martin Tod
8
  Author URI: http://www.martintod.org.uk
49
  $title = apply_filters('widget_title', $instance['title']);
50
  $positive_variables = array('screen_name','include_rts','exclude_replies','links_in_new_window','tweet_count','show_follow','timeout','rotation_type','show_meta_reply_retweet_favorite','official_format');
51
  foreach($positive_variables as $var) {
52
+ $newargs[$var] = @$instance['tw_'.$var];
53
  }
54
  $negative_variables = array('meta_timestamp','meta_screen_name','meta_via');
55
  foreach($negative_variables as $var) {
494
  if(!empty($api)):
495
  $connection = new wp_TwitterOAuth($api['key'], $api['secret'], $api['token'], $api['token_secret'] );
496
  // $result = $connection->get('statuses/user_timeline', $options);
497
+ if(WP_DEBUG):
498
+ echo "\n<!-- Using OAuth - version 1.1 of API -- $command -->\n";
499
+ endif;
500
  $result = $connection->get($command , $options);
501
  else:
502
  // Construct old style API command
551
  $twitterdata = rotatingtweets_call_twitter_API('statuses/user_timeline',$apioptions);
552
  if(!is_wp_error($twitterdata)):
553
  $twitterjson = json_decode($twitterdata['body'],TRUE);
554
+ if(WP_DEBUG):
555
+ echo "<!-- Rotating Tweets - got new data -->";
556
+ endif;
557
  else:
558
  set_transient('rotatingtweets_wp_error',$twitterdata->get_error_messages(), 120);
559
  endif;
560
+ elseif(WP_DEBUG):
561
+ echo "<!-- Rotating Tweets - used cache -->";
562
  endif;
563
  # Checks for errors in the reply
564
  if(!empty($twitterjson['errors'])):
658
  endif;
659
  endif;
660
  if(empty($latest_languages)) $latest_languages = $fallback;
661
+ if(WP_DEBUG):
662
+ echo "<!-- \n";
663
+ print_r($option);
664
+ echo "\n-->";
665
+ endif;
666
  return($latest_languages);
667
  }
668
 
733
  endif;
734
  else:
735
  $tweet_counter = 0;
736
+ /*
737
  $rate = rotatingtweets_get_rate_data();
738
  # Check if the problem is rate limiting
739
  if($rate['hourly_limit']>0 && $rate['remaining_hits'] == 0):
741
  $result .= "<!-- Rate limited -- ";
742
  $result .= sprintf(_n('Next attempt to get data will be in %d minute','Next attempt to get data will be in %d minutes',$waittimevalue,'rotatingtweets'),$waittimevalue)." -->";
743
  endif;
744
+ */
745
  # Set up the link treatment
746
  if(isset($args['links_in_new_window']) && !empty($args['links_in_new_window']) ) {
747
  $targetvalue = ' target="_blank" ';