Rotating Tweets (Twitter widget and shortcode) - Version 1.9.9

Version Description

  • [Security Update] Adds rel='noopener' to _blank links

=

Download this release

Release Info

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

Code changes from version 1.9.8 to 1.9.9

Files changed (2) hide show
  1. readme.txt +9 -6
  2. rotatingtweets.php +30 -13
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,do not track,dnt
5
  Requires at least: 3.2
6
- Tested up to: 5.0
7
- Stable tag: 1.9.8
8
  Requires PHP: 5.2.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -13,7 +13,6 @@ Twitter widget and shortcode to show your latest tweets one at a time an animate
13
 
14
  == Description ==
15
  * **Replaces a [shortcode](http://codex.wordpress.org/Shortcode) such as `[rotatingtweets screen_name='your_twitter']`, or a [widget](http://codex.wordpress.org/WordPress_Widgets), with a rotating display of your most recent tweets**
16
- * **Supports v 1.1 of the Twitter API** ([i.e. it works](https://blog.twitter.com/2013/api-v1-is-retired))
17
  * **Supports the [new longer tweet format](https://dev.twitter.com/overview/api/upcoming-changes-to-tweets)**
18
  * **Supports [280 characters](https://blog.twitter.com/official/en_us/topics/product/2017/tweetingmadeeasier.html)**
19
  * **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.
@@ -21,7 +20,7 @@ Twitter widget and shortcode to show your latest tweets one at a time an animate
21
  * **Customizable** - you decide whose tweets to show, how many to show, whether to include retweets and replies, and whether to show a follow button. You can also decide how quickly the tweets rotate and what type of animation to use.
22
  * **Responsive** - resizes as your page resizes
23
  * **GDPR-friendly** - with default settings, collects no user data and shares no user data (including IP addresses) with anyone else. Supports 'Do Not Track' (DNT).
24
- * Gives you the option to show a fully customizable Twitter 'follow' button. *For note, because of the way Twitter's code for the Twitter button works, the button will display as a regular text link to site visitors who have set 'Do Not Track'.*
25
  * Replaces [t.co](http://t.co) links with the original link
26
  * Caches the most recent data from Twitter to avoid problems with rate limiting
27
  * 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.
@@ -95,6 +94,7 @@ Possible variables for the shortcode include:
95
  * `shuffle` = `'0'` or `'1'` - shuffle the order that Tweets display - default is `'0'`
96
  * `merge_cache` = `'0'` or `'1'` - switches caching of searches on or off - default is `'1'` (i.e. on)
97
  * `auto_height` = `'0'` or `'1'` - switches auto-height calculation of the Rotating Tweets container on or off - default is `'1'` (i.e. on)
 
98
 
99
  * **Caching**
100
  * `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.
@@ -192,10 +192,13 @@ into your CSS - changing `123px;` to the width you're aiming at - either via [ad
192
  You can do this by going to the `rotatingtweets/css` directory, opening `rotatingtweets-sample.css` and copying its contents (modifying the link to the bird graphic to match your site) into [additional CSS](https://codex.wordpress.org/CSS#Custom_CSS_in_WordPress) (the preferred approach from Wordpress 4.7 onwards) on the [Appearance Customize Screen](https://codex.wordpress.org/Appearance_Customize_Screen) page. Alternatively rename `rotatingtweets-sample.css` to `rotatingtweets.css` and put it in the `wp-content/uploads/` directory. Or copy the CSS into your own template files. Any of these approaches will display a Twitter bird to the left of your tweets.
193
 
194
  == Upgrade notice ==
195
- = 1.9.8 =
196
- * Fixes problem with Twitter intents for users with a high number user ID
197
 
198
  == Changelog ==
 
 
 
199
  = 1.9.8 =
200
  * Fixes problem with Twitter intents for users with a high number user ID
201
 
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,do not track,dnt
5
  Requires at least: 3.2
6
+ Tested up to: 5.2
7
+ Stable tag: 1.9.9
8
  Requires PHP: 5.2.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
14
  == Description ==
15
  * **Replaces a [shortcode](http://codex.wordpress.org/Shortcode) such as `[rotatingtweets screen_name='your_twitter']`, or a [widget](http://codex.wordpress.org/WordPress_Widgets), with a rotating display of your most recent tweets**
 
16
  * **Supports the [new longer tweet format](https://dev.twitter.com/overview/api/upcoming-changes-to-tweets)**
17
  * **Supports [280 characters](https://blog.twitter.com/official/en_us/topics/product/2017/tweetingmadeeasier.html)**
18
  * **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.
20
  * **Customizable** - you decide whose tweets to show, how many to show, whether to include retweets and replies, and whether to show a follow button. You can also decide how quickly the tweets rotate and what type of animation to use.
21
  * **Responsive** - resizes as your page resizes
22
  * **GDPR-friendly** - with default settings, collects no user data and shares no user data (including IP addresses) with anyone else. Supports 'Do Not Track' (DNT).
23
+ * Gives you the option to show a fully customizable Twitter 'follow' button. *For note, because of the way Twitter's code for the Twitter button works, the button will display as a regular text link to site visitors who have set 'Do Not Track'.*
24
  * Replaces [t.co](http://t.co) links with the original link
25
  * Caches the most recent data from Twitter to avoid problems with rate limiting
26
  * 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.
94
  * `shuffle` = `'0'` or `'1'` - shuffle the order that Tweets display - default is `'0'`
95
  * `merge_cache` = `'0'` or `'1'` - switches caching of searches on or off - default is `'1'` (i.e. on)
96
  * `auto_height` = `'0'` or `'1'` - switches auto-height calculation of the Rotating Tweets container on or off - default is `'1'` (i.e. on)
97
+ * `show_line_breaks` = `'0'` or `'1'` - displays line breaks in the tweet - default is `'0'` (i.e. off)
98
 
99
  * **Caching**
100
  * `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.
192
  You can do this by going to the `rotatingtweets/css` directory, opening `rotatingtweets-sample.css` and copying its contents (modifying the link to the bird graphic to match your site) into [additional CSS](https://codex.wordpress.org/CSS#Custom_CSS_in_WordPress) (the preferred approach from Wordpress 4.7 onwards) on the [Appearance Customize Screen](https://codex.wordpress.org/Appearance_Customize_Screen) page. Alternatively rename `rotatingtweets-sample.css` to `rotatingtweets.css` and put it in the `wp-content/uploads/` directory. Or copy the CSS into your own template files. Any of these approaches will display a Twitter bird to the left of your tweets.
193
 
194
  == Upgrade notice ==
195
+ = 1.9.9 =
196
+ * [Security Update] Adds `rel='noopener'` to `_blank` links
197
 
198
  == Changelog ==
199
+ = 1.9.9 =
200
+ * [Security Update] Adds `rel='noopener'` to `_blank` links
201
+
202
  = 1.9.8 =
203
  * Fixes problem with Twitter intents for users with a high number user ID
204
 
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.9.8
6
  Text Domain: rotatingtweets
7
  Domain Path: /languages
8
  Author: Martin Tod
@@ -72,11 +72,12 @@ class rotatingtweets_Widget extends WP_Widget {
72
  'tw_hide_meta_timestamp' => FALSE,
73
  'tw_hide_meta_screen_name' => FALSE,
74
  'tw_hide_meta_via' => FALSE,
75
- 'tw_show_meta_reply_retweet_favorite' => FALSE
 
76
  );
77
  endif;
78
  $title = apply_filters('widget_title', $instance['title']);
79
- $positive_variables = array('screen_name','shorten_links','include_rts','exclude_replies','links_in_new_window','tweet_count','show_follow','timeout','rotation_type','show_meta_reply_retweet_favorite','official_format','show_type','list_tag','search');
80
  $newargs['displaytype']='widget';
81
  $newargs['w3tc_render_to']=$args['widget_id'];
82
  foreach($positive_variables as $var) {
@@ -181,6 +182,7 @@ class rotatingtweets_Widget extends WP_Widget {
181
  $instance['tw_tweet_count'] = max(1,intval($new_instance['tw_tweet_count']));
182
  $instance['tw_show_follow'] = absint($new_instance['tw_show_follow']);
183
  $instance['tw_show_type'] = absint($new_instance['tw_show_type']);
 
184
  # Complicated way to ensure the defaults remain as they were before the 0.500 upgrade - i.e. showing meta timestamp, screen name and via, but not reply, retweet, favorite
185
  $instance['tw_hide_meta_timestamp'] = !$new_instance['tw_show_meta_timestamp'];
186
  $instance['tw_hide_meta_screen_name'] = !$new_instance['tw_show_meta_screen_name'];
@@ -205,6 +207,7 @@ class rotatingtweets_Widget extends WP_Widget {
205
  'tw_official_format' => array('tw_official_format',0,'format'),
206
  'tw_show_type' => array('tw_show_type',0,'number'),
207
  'tw_links_in_new_window' => array('tw_links_in_new_window',false, 'boolean'),
 
208
  'tw_hide_meta_timestamp' => array('tw_show_meta_timestamp',true, 'notboolean',true),
209
  'tw_hide_meta_screen_name' => array('tw_show_meta_screen_name',true, 'notboolean',true),
210
  'tw_hide_meta_via'=> array('tw_show_meta_via',true,'notboolean',true),
@@ -277,10 +280,11 @@ class rotatingtweets_Widget extends WP_Widget {
277
  echo " class='rtw_ad_type'><label for='".$this->get_field_id('tw_show_type_'.$val)."'> $html</label><br />";
278
  };
279
  ?></p>
280
- <p><input id="<?php echo $this->get_field_id('tw_include_rts'); ?>" name="<?php echo $this->get_field_name('tw_include_rts'); ?>" type="checkbox" value="1" <?php if($tw_include_rts==1): ?>checked="checked" <?php endif; ?>/><label for="<?php echo $this->get_field_id('tw_include_rts'); ?>"> <?php _e('Include retweets?','rotatingtweets'); ?></label></p>
281
- <p><input id="<?php echo $this->get_field_id('tw_exclude_replies'); ?>" name="<?php echo $this->get_field_name('tw_exclude_replies'); ?>" type="checkbox" value="1" <?php if($tw_exclude_replies==1): ?>checked="checked" <?php endif; ?>/><label for="<?php echo $this->get_field_id('tw_exclude_replies'); ?>"> <?php _e('Exclude replies?','rotatingtweets'); ?></label></p>
282
- <p><input id="<?php echo $this->get_field_id('tw_shorten_links'); ?>" name="<?php echo $this->get_field_name('tw_shorten_links'); ?>" type="checkbox" value="1" <?php if(!empty($tw_shorten_links)): ?>checked="checked" <?php endif; ?>/><label for="<?php echo $this->get_field_id('tw_shorten_links'); ?>"> <?php _e('Shorten links?','rotatingtweets'); ?></label></p>
283
- <p><input id="<?php echo $this->get_field_id('tw_links_in_new_window'); ?>" name="<?php echo $this->get_field_name('tw_links_in_new_window'); ?>" type="checkbox" value="1" <?php if($tw_links_in_new_window==1): ?>checked="checked" <?php endif; ?>/><label for="<?php echo $this->get_field_id('tw_links_in_new_window'); ?>"> <?php _e('Open all links in new window or tab?','rotatingtweets'); ?></label></p>
 
284
  <p><label for="<?php echo $this->get_field_id('tw_tweet_count'); ?>"><?php _e('How many tweets?','rotatingtweets'); ?> <select id="<?php echo $this->get_field_id('tw_tweet_count'); ?>" name="<?php echo $this->get_field_name('tw_tweet_count');?>">
285
  <?php
286
  for ($i=1; $i<61; $i++) {
@@ -323,8 +327,8 @@ class rotatingtweets_Widget extends WP_Widget {
323
  <?php
324
  $officialoptions = array (
325
  0 => __('Original rotating tweets layout','rotatingtweets'),
326
- 1 => sprintf(__("<a target='_blank' href='%s'>Official Twitter guidelines</a> (regular)",'rotatingtweets'),'https://dev.twitter.com/overview/terms/display-requirements'),
327
- 2 => sprintf(__("<a target='_blank' href='%s'>Official Twitter guidelines</a> (wide)",'rotatingtweets'),'https://dev.twitter.com/overview/terms/display-requirements'),
328
  );
329
  if (function_exists('rotatingtweets_display_override')) {
330
  $officialoptions['custom'] = __('Custom display layout','rotatingtweets');
@@ -630,7 +634,9 @@ function rotatingtweets_display_shortcode( $atts, $content=null, $code="", $prin
630
  'merge_cache'=>TRUE,
631
  'rtw_display_order'=>'info,main,media,meta',
632
  'collection' => FALSE,
633
- 'auto_height' => 'calc'
 
 
634
  ), $atts, 'rotatingtweets' ) ;
635
  extract($args);
636
  if(empty($screen_name) && empty($search) && !empty($url) && empty($collection)):
@@ -1668,8 +1674,9 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1668
  $result .= "\n<!-- ".esc_html($error[0]['type'])." error: ".esc_html($error[0]['code'])." - ".esc_html($error[0]['message'])." -->";
1669
  endif;
1670
  if(empty($json)):
1671
- $result .= "\n\t<div class = 'rotatingtweet'><p class='rtw_main'>". __('Problem retrieving data from Twitter','rotatingtweets'). "</p></div>";
1672
  if(!empty($error)):
 
1673
  $result .= "\n<div class = 'rotatingtweet' style='display:none'><p class='rtw_main'>".sprintf(__('%3$s error code: %1$s - %2$s','rotatingtweets'), esc_html($error[0]['code']), esc_html($error[0]['message']),esc_html($error[0]['type'])). "</p></div>";
1674
  $rt_cache_delay = 10;
1675
  switch($error[0]['code']) {
@@ -1706,7 +1713,10 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1706
  break;
1707
  }
1708
  elseif(!empty($args['search'])):
1709
- $result .= "\n<div class = 'rotatingtweet' style='display:none'><p class='rtw_main'>".sprintf(__('No Tweet results for search <a href="%2$s"><strong>%1$s</strong></a>','rotatingtweets'),esc_html($args['search']),esc_url('https://twitter.com/search?q='.urlencode($args['search']))). "</p></div>";
 
 
 
1710
  endif;
1711
  else:
1712
  $tweet_counter = 0;
@@ -1721,7 +1731,7 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1721
  */
1722
  # Set up the link treatment
1723
  if(isset($args['links_in_new_window']) && !empty($args['links_in_new_window']) ) {
1724
- $targetvalue = ' target="_blank" ';
1725
  } else {
1726
  $targetvalue = '';
1727
  }
@@ -1905,6 +1915,13 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1905
  # This is designed to find hashtags and turn them into links...
1906
  $before[]="%#\b(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%u";
1907
  $after[]='<a href="https://twitter.com/search?q=%23$1&amp;src=hash" title="#$1"'.$targetvalue.' class="rtw_hashtag_link">#$1</a>';
 
 
 
 
 
 
 
1908
  # Attempts to remove emoji - see http://www.regular-expressions.info/unicode.html https://en.wikipedia.org/wiki/Emoji
1909
  if(isset($args['no_emoji']) && $args['no_emoji']):
1910
  // $before[]='/\\p{InGreek_Extended}/u'; #Not supported by PCRE http://php.net/manual/en/regexp.reference.unicode.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.9.9
6
  Text Domain: rotatingtweets
7
  Domain Path: /languages
8
  Author: Martin Tod
72
  'tw_hide_meta_timestamp' => FALSE,
73
  'tw_hide_meta_screen_name' => FALSE,
74
  'tw_hide_meta_via' => FALSE,
75
+ 'tw_show_meta_reply_retweet_favorite' => FALSE,
76
+ 'tw_show_line_breaks' => FALSE
77
  );
78
  endif;
79
  $title = apply_filters('widget_title', $instance['title']);
80
+ $positive_variables = array('screen_name','shorten_links','include_rts','exclude_replies','links_in_new_window','tweet_count','show_follow','timeout','rotation_type','show_meta_reply_retweet_favorite','official_format','show_type','list_tag','search','show_line_breaks');
81
  $newargs['displaytype']='widget';
82
  $newargs['w3tc_render_to']=$args['widget_id'];
83
  foreach($positive_variables as $var) {
182
  $instance['tw_tweet_count'] = max(1,intval($new_instance['tw_tweet_count']));
183
  $instance['tw_show_follow'] = absint($new_instance['tw_show_follow']);
184
  $instance['tw_show_type'] = absint($new_instance['tw_show_type']);
185
+ $instance['tw_show_line_breaks'] = absint($new_instance['tw_show_line_breaks']);
186
  # Complicated way to ensure the defaults remain as they were before the 0.500 upgrade - i.e. showing meta timestamp, screen name and via, but not reply, retweet, favorite
187
  $instance['tw_hide_meta_timestamp'] = !$new_instance['tw_show_meta_timestamp'];
188
  $instance['tw_hide_meta_screen_name'] = !$new_instance['tw_show_meta_screen_name'];
207
  'tw_official_format' => array('tw_official_format',0,'format'),
208
  'tw_show_type' => array('tw_show_type',0,'number'),
209
  'tw_links_in_new_window' => array('tw_links_in_new_window',false, 'boolean'),
210
+ 'tw_show_line_breaks' => array('tw_show_line_breaks',false, 'boolean'),
211
  'tw_hide_meta_timestamp' => array('tw_show_meta_timestamp',true, 'notboolean',true),
212
  'tw_hide_meta_screen_name' => array('tw_show_meta_screen_name',true, 'notboolean',true),
213
  'tw_hide_meta_via'=> array('tw_show_meta_via',true,'notboolean',true),
280
  echo " class='rtw_ad_type'><label for='".$this->get_field_id('tw_show_type_'.$val)."'> $html</label><br />";
281
  };
282
  ?></p>
283
+ <p><input id="<?php echo $this->get_field_id('tw_include_rts'); ?>" name="<?php echo $this->get_field_name('tw_include_rts'); ?>" type="checkbox" value="1" <?php if($tw_include_rts==1): ?>checked="checked" <?php endif; ?>/><label for="<?php echo $this->get_field_id('tw_include_rts'); ?>"> <?php _e('Include retweets?','rotatingtweets'); ?></label>
284
+ <br /><input id="<?php echo $this->get_field_id('tw_exclude_replies'); ?>" name="<?php echo $this->get_field_name('tw_exclude_replies'); ?>" type="checkbox" value="1" <?php if($tw_exclude_replies==1): ?>checked="checked" <?php endif; ?>/><label for="<?php echo $this->get_field_id('tw_exclude_replies'); ?>"> <?php _e('Exclude replies?','rotatingtweets'); ?></label>
285
+ <br /><input id="<?php echo $this->get_field_id('tw_shorten_links'); ?>" name="<?php echo $this->get_field_name('tw_shorten_links'); ?>" type="checkbox" value="1" <?php if(!empty($tw_shorten_links)): ?>checked="checked" <?php endif; ?>/><label for="<?php echo $this->get_field_id('tw_shorten_links'); ?>"> <?php _e('Shorten links?','rotatingtweets'); ?></label>
286
+ <br /><input id="<?php echo $this->get_field_id('tw_show_line_breaks'); ?>" name="<?php echo $this->get_field_name('tw_show_line_breaks'); ?>" type="checkbox" value="1" <?php if(!empty($tw_show_line_breaks)): ?>checked="checked" <?php endif; ?>/><label for="<?php echo $this->get_field_id('tw_show_line_breaks'); ?>"> <?php _e('Show line breaks?','rotatingtweets'); ?></label>
287
+ <br /><input id="<?php echo $this->get_field_id('tw_links_in_new_window'); ?>" name="<?php echo $this->get_field_name('tw_links_in_new_window'); ?>" type="checkbox" value="1" <?php if($tw_links_in_new_window==1): ?>checked="checked" <?php endif; ?>/><label for="<?php echo $this->get_field_id('tw_links_in_new_window'); ?>"> <?php _e('Open all links in new window or tab?','rotatingtweets'); ?></label></p>
288
  <p><label for="<?php echo $this->get_field_id('tw_tweet_count'); ?>"><?php _e('How many tweets?','rotatingtweets'); ?> <select id="<?php echo $this->get_field_id('tw_tweet_count'); ?>" name="<?php echo $this->get_field_name('tw_tweet_count');?>">
289
  <?php
290
  for ($i=1; $i<61; $i++) {
327
  <?php
328
  $officialoptions = array (
329
  0 => __('Original rotating tweets layout','rotatingtweets'),
330
+ 1 => sprintf(__("<a target='_blank' rel='noopener' href='%s'>Official Twitter guidelines</a> (regular)",'rotatingtweets'),'https://dev.twitter.com/overview/terms/display-requirements'),
331
+ 2 => sprintf(__("<a target='_blank' rel='noopener' href='%s'>Official Twitter guidelines</a> (wide)",'rotatingtweets'),'https://dev.twitter.com/overview/terms/display-requirements'),
332
  );
333
  if (function_exists('rotatingtweets_display_override')) {
334
  $officialoptions['custom'] = __('Custom display layout','rotatingtweets');
634
  'merge_cache'=>TRUE,
635
  'rtw_display_order'=>'info,main,media,meta',
636
  'collection' => FALSE,
637
+ 'auto_height' => 'calc',
638
+ 'msg_no_tweets' => __('No Tweets found','rotatingtweets'),
639
+ 'show_line_breaks'=>FALSE
640
  ), $atts, 'rotatingtweets' ) ;
641
  extract($args);
642
  if(empty($screen_name) && empty($search) && !empty($url) && empty($collection)):
1674
  $result .= "\n<!-- ".esc_html($error[0]['type'])." error: ".esc_html($error[0]['code'])." - ".esc_html($error[0]['message'])." -->";
1675
  endif;
1676
  if(empty($json)):
1677
+ # $result .= "\n\t<div class = 'rotatingtweet'><p class='rtw_main'>". __('Problem retrieving data from Twitter','rotatingtweets'). "</p></div>";
1678
  if(!empty($error)):
1679
+ $result .= "\n\t<div class = 'rotatingtweet'><p class='rtw_main'>". __('Problem retrieving data from Twitter','rotatingtweets'). "</p></div>";
1680
  $result .= "\n<div class = 'rotatingtweet' style='display:none'><p class='rtw_main'>".sprintf(__('%3$s error code: %1$s - %2$s','rotatingtweets'), esc_html($error[0]['code']), esc_html($error[0]['message']),esc_html($error[0]['type'])). "</p></div>";
1681
  $rt_cache_delay = 10;
1682
  switch($error[0]['code']) {
1713
  break;
1714
  }
1715
  elseif(!empty($args['search'])):
1716
+ $result .= "\n\t<div class = 'rotatingtweet'><p class='rtw_main'>". __('Problem retrieving data from Twitter','rotatingtweets'). "</p></div>";
1717
+ $result .= "\n\t<div class = 'rotatingtweet' style='display:none'><p class='rtw_main'>".sprintf(__('No Tweet results for search <a href="%2$s"><strong>%1$s</strong></a>','rotatingtweets'),esc_html($args['search']),esc_url('https://twitter.com/search?q='.urlencode($args['search']))). "</p></div>";
1718
+ else:
1719
+ $result .= "\n\t<div class = 'rotatingtweet' style='display:none'><p class='rtw_main'>".$args['msg_no_tweets']. "</p></div>";
1720
  endif;
1721
  else:
1722
  $tweet_counter = 0;
1731
  */
1732
  # Set up the link treatment
1733
  if(isset($args['links_in_new_window']) && !empty($args['links_in_new_window']) ) {
1734
+ $targetvalue = ' target="_blank" rel="noopener" ';
1735
  } else {
1736
  $targetvalue = '';
1737
  }
1915
  # This is designed to find hashtags and turn them into links...
1916
  $before[]="%#\b(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%u";
1917
  $after[]='<a href="https://twitter.com/search?q=%23$1&amp;src=hash" title="#$1"'.$targetvalue.' class="rtw_hashtag_link">#$1</a>';
1918
+
1919
+ # Put line feeds in
1920
+ if(isset($args['show_line_breaks']) && $args['show_line_breaks']):
1921
+ $before[]="%[\r\n]%m";
1922
+ $after[]="<br />";
1923
+ endif;
1924
+
1925
  # Attempts to remove emoji - see http://www.regular-expressions.info/unicode.html https://en.wikipedia.org/wiki/Emoji
1926
  if(isset($args['no_emoji']) && $args['no_emoji']):
1927
  // $before[]='/\\p{InGreek_Extended}/u'; #Not supported by PCRE http://php.net/manual/en/regexp.reference.unicode.php