Rotating Tweets (Twitter widget and shortcode) - Version 1.3.16

Version Description

Includes an important upgrade needed for Rotating Tweets to keep working after March 2013. Fixed problem with hashtags.

=

Download this release

Release Info

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

Code changes from version 1.3.15 to 1.3.16

Files changed (2) hide show
  1. readme.txt +5 -2
  2. rotatingtweets.php +10 -5
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: 1.3.15
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -118,10 +118,13 @@ If there is only one copy of `jquery` and of `jquery.cycle` on your page, the be
118
  1. Read the diagnostics and look for any problems that relate to JavaScript. This will normally tell you which JavaScript (if any) is having problems.
119
 
120
  == Upgrade notice ==
121
- = 1.3.15 =
122
  Includes an important upgrade needed for Rotating Tweets to keep working after March 2013. Fixed problem with hashtags.
123
 
124
  == Changelog ==
 
 
 
125
  = 1.3.15 =
126
  Minor correction to hashtag code
127
 
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: 1.3.16
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
118
  1. Read the diagnostics and look for any problems that relate to JavaScript. This will normally tell you which JavaScript (if any) is having problems.
119
 
120
  == Upgrade notice ==
121
+ = 1.3.16 =
122
  Includes an important upgrade needed for Rotating Tweets to keep working after March 2013. Fixed problem with hashtags.
123
 
124
  == Changelog ==
125
+ = 1.3.16 =
126
+ Making sure hashtags have a space or the start of a line before them. Tidying up errors found when running plug-in with `wp_debug` set to `true`
127
+
128
  = 1.3.15 =
129
  Minor correction to hashtag code
130
 
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: 1.3.15
6
  Text Domain: rotatingtweets
7
  Author: Martin Tod
8
  Author URI: http://www.martintod.org.uk
@@ -188,7 +188,7 @@ class rotatingtweets_Widget extends WP_Widget {
188
  if($tw_official_format==$val): ?> checked="checked" <?php endif;
189
  echo " class='rtw_ad_official'><label for='".$this->get_field_id('tw_official_format_'.$val)."'> $html</label><br />";
190
  };
191
- unset($hideStr);
192
  if($tw_official_format > 0) $hideStr = ' style = "display:none;" ';
193
  ?>
194
  <p /><div class='rtw_ad_tw_det' <?=$hideStr;?>><p><?php _e('Show tweet details?','rotatingtweets'); ?></p><p>
@@ -598,7 +598,7 @@ function rotatingtweets_get_tweets($tw_screen_name,$tw_include_rts,$tw_exclude_r
598
  if(WP_DEBUG):
599
  echo "<!-- var option is an array -->";
600
  endif;
601
- if(isset($option[$stringname])):
602
  if(WP_DEBUG) echo "<!-- option[$stringname] exists -->";
603
  if(is_array($option[$stringname]['json'][0])):
604
  if(WP_DEBUG) echo "<!-- option[$stringname]['json'][0] is an array -->";
@@ -669,7 +669,11 @@ function rotatingtweets_get_tweets($tw_screen_name,$tw_include_rts,$tw_exclude_r
669
  update_option($optionname,$option);
670
  endif;
671
  endif;
672
- return($latest_json);
 
 
 
 
673
  }
674
 
675
  # Gets the rate limiting data to see how long it will be before we can tweet again
@@ -924,7 +928,8 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
924
  endforeach;
925
  endif;
926
  // $before[]="%#([0-9]*[\p{L}a-zA-Z_]+\w*)%";
927
- $before[]="%#(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%";
 
928
  $after[]='<a href="http://twitter.com/search?q=%23$1&src=hash" title="#$1"'.$targetvalue.'>#$1</a>';
929
  $main_text = preg_replace($before,$after,$main_text);
930
 
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.3.16
6
  Text Domain: rotatingtweets
7
  Author: Martin Tod
8
  Author URI: http://www.martintod.org.uk
188
  if($tw_official_format==$val): ?> checked="checked" <?php endif;
189
  echo " class='rtw_ad_official'><label for='".$this->get_field_id('tw_official_format_'.$val)."'> $html</label><br />";
190
  };
191
+ $hideStr='';
192
  if($tw_official_format > 0) $hideStr = ' style = "display:none;" ';
193
  ?>
194
  <p /><div class='rtw_ad_tw_det' <?=$hideStr;?>><p><?php _e('Show tweet details?','rotatingtweets'); ?></p><p>
598
  if(WP_DEBUG):
599
  echo "<!-- var option is an array -->";
600
  endif;
601
+ if(isset($option[$stringname]['json'][0])):
602
  if(WP_DEBUG) echo "<!-- option[$stringname] exists -->";
603
  if(is_array($option[$stringname]['json'][0])):
604
  if(WP_DEBUG) echo "<!-- option[$stringname]['json'][0] is an array -->";
669
  update_option($optionname,$option);
670
  endif;
671
  endif;
672
+ if(isset($latest_json)):
673
+ return($latest_json);
674
+ else:
675
+ return;
676
+ endif;
677
  }
678
 
679
  # Gets the rate limiting data to see how long it will be before we can tweet again
928
  endforeach;
929
  endif;
930
  // $before[]="%#([0-9]*[\p{L}a-zA-Z_]+\w*)%";
931
+ # This is designed to find hashtags and turn them into links...
932
+ $before[]="%#\b(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%";
933
  $after[]='<a href="http://twitter.com/search?q=%23$1&src=hash" title="#$1"'.$targetvalue.'>#$1</a>';
934
  $main_text = preg_replace($before,$after,$main_text);
935