Rotating Tweets (Twitter widget and shortcode) - Version 1.9

Version Description

  • Supports the new longer Tweet format

=

Download this release

Release Info

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

Code changes from version 1.8.7 to 1.9

Files changed (2) hide show
  1. readme.txt +12 -7
  2. rotatingtweets.php +68 -13
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Rotating Tweets (Twitter widget and shortcode) ===
2
  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.6.1
7
- Stable tag: 1.8.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,7 +12,8 @@ Twitter widget and shortcode to show your latest tweets one at a time an animate
12
 
13
  == Description ==
14
  * **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**
15
- * **Supports v 1.1 of the Twitter API** ([i.e. it still works](https://blog.twitter.com/2013/api-v1-is-retired))
 
16
  * **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.
17
  * **Reliable** - keeps showing your latest Tweets even if the Twitter website is down.
18
  * **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,6 +23,7 @@ Twitter widget and shortcode to show your latest tweets one at a time an animate
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/).
@@ -184,12 +186,15 @@ into your CSS - changing `123px;` to the width you're aiming at - either via put
184
  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.
185
 
186
  == Upgrade notice ==
187
- = 1.8.7 =
188
- * Support for 'Do Not Track'. Fix minor bug with Selective Refresh.
189
 
190
  == Changelog ==
 
 
 
191
  = 1.8.7 =
192
- * De-activates Twitter JavaScript if 'Do Not Track' is enabled.
193
  * Fix minor bug with Selective Refresh.
194
 
195
  = 1.8.6 =
1
  === Rotating Tweets (Twitter widget and shortcode) ===
2
  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: 4.7
7
+ Stable tag: 1.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
12
 
13
  == Description ==
14
  * **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**
15
+ * **Supports v 1.1 of the Twitter API** ([i.e. it works](https://blog.twitter.com/2013/api-v1-is-retired))
16
+ * **Supports the [new longer tweet format](https://dev.twitter.com/overview/api/upcoming-changes-to-tweets)**
17
  * **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.
18
  * **Reliable** - keeps showing your latest Tweets even if the Twitter website is down.
19
  * **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.
23
  * Caches the most recent data from Twitter to avoid problems with rate limiting
24
  * 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.
25
  * Compatible with [W3 Total Cache](/plugins/w3-total-cache/).
26
+ * Supports Do Not Track (DNT)
27
  * **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).
28
 
29
  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/).
186
  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.
187
 
188
  == Upgrade notice ==
189
+ = 1.9 =
190
+ * Supports the [new longer Tweet format](https://dev.twitter.com/overview/api/upcoming-changes-to-tweets)
191
 
192
  == Changelog ==
193
+ = 1.9 =
194
+ * Supports the [new longer Tweet format](https://dev.twitter.com/overview/api/upcoming-changes-to-tweets)
195
+
196
  = 1.8.7 =
197
+ * Switches off Twitter JavaScript if 'Do Not Track' is enabled.
198
  * Fix minor bug with Selective Refresh.
199
 
200
  = 1.8.6 =
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.8.7
6
  Text Domain: rotatingtweets
7
  Domain Path: /languages
8
  Author: Martin Tod
@@ -1182,6 +1182,8 @@ function rotatingtweets_get_tweets_sf($tw_screen_name,$tw_include_rts,$tw_exclud
1182
  # Checks if it is time to call Twitter directly yet or if it should use the cache
1183
  if($timegap > $cache_delay):
1184
  $apioptions = array('screen_name'=>$tw_screen_name,'include_entities'=>1,'count'=>60,'include_rts'=>$tw_include_rts,'exclude_replies'=>$tw_exclude_replies);
 
 
1185
  $twitterusers = FALSE;
1186
  if($tw_search) {
1187
  $apioptions['q']=$tw_search;
@@ -1209,6 +1211,7 @@ function rotatingtweets_get_tweets_sf($tw_screen_name,$tw_include_rts,$tw_exclud
1209
  if(WP_DEBUG):
1210
  $rt_time_taken = number_format(microtime(true)-$rt_starttime,4);
1211
  echo "<!-- Rotating Tweets - got new data - time taken: $rt_time_taken seconds -->";
 
1212
  endif;
1213
  else:
1214
  rotatingtweets_set_transient('rotatingtweets_wp_error',$twitterdata->get_error_messages(), 120);
@@ -1220,7 +1223,11 @@ function rotatingtweets_get_tweets_sf($tw_screen_name,$tw_include_rts,$tw_exclud
1220
  # Checks for errors in the reply
1221
  if(!empty($twitterjson['errors'])):
1222
  # If there's an error, reset the cache timer to make sure we don't hit Twitter too hard and get rate limited.
1223
- // print_r($twitterjson);
 
 
 
 
1224
  if( $twitterjson['errors'][0]['code'] == 88 ):
1225
  $rate = rotatingtweets_get_rate_data();
1226
  if($rate && $rate['remaining_hits'] == 0):
@@ -1254,11 +1261,19 @@ function rotatingtweets_get_tweets_sf($tw_screen_name,$tw_include_rts,$tw_exclud
1254
  echo "<!-- using [results] -->";
1255
  endif;
1256
  $twitterjson = $twitterjson['results'];
 
 
 
 
1257
  endif;
1258
  if(isset($twitterjson) && is_array($twitterjson) && isset($twitterjson[0] )) $firstentry = $twitterjson[0];
1259
- if(!empty($firstentry['text']) ):
1260
  $number_returned_tweets = count($twitterjson);
1261
- if(WP_DEBUG) echo "<!-- ".$number_returned_tweets." tweets returned -->";
 
 
 
 
1262
  if( $tw_search && $tw_merge && $number_returned_tweets < 60 && isset($latest_json) && is_array($latest_json) && count($latest_json)>0 ):
1263
  if(WP_DEBUG) echo "<!-- ".count($latest_json)." tweets in cache -->";
1264
  $twitterjson = rotatingtweet_combine_jsons($twitterjson,$latest_json);
@@ -1359,7 +1374,7 @@ function rotatingtweets_shrink_json($json) {
1359
  }
1360
  function rotatingtweets_shrink_element($json,$no_emoji=0) {
1361
  global $args;
1362
- $rt_top_elements = array('text','retweeted_status','user','entities','source','id_str','created_at','coordinates');
1363
  $return = array();
1364
  foreach($rt_top_elements as $rt_element):
1365
  if(isset($json[$rt_element])):
@@ -1368,12 +1383,15 @@ function rotatingtweets_shrink_element($json,$no_emoji=0) {
1368
  $return[$rt_element]=rotatingtweets_shrink_user($json[$rt_element]);
1369
  break;
1370
  case "entities":
 
1371
  $return[$rt_element]=rotatingtweets_shrink_entities($json[$rt_element]);
1372
  break;
1373
  case "retweeted_status":
 
1374
  $return[$rt_element]=rotatingtweets_shrink_element($json[$rt_element]);
1375
  break;
1376
  case "text":
 
1377
  $json[$rt_element] = rotatingtweets_convert_charset($json[$rt_element]);
1378
  default:
1379
  if($no_emoji):
@@ -1713,9 +1731,29 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1713
  shuffle($json);
1714
  endif;
1715
  foreach($json as $twitter_object):
 
 
 
 
 
 
 
 
1716
  if ((isset($args['only_rts']) && $args['only_rts'] && isset($twitter_object['retweeted_status'] )) || ((!isset($args['only_rts']) || !$args['only_rts']) && ( ! ( ($args['exclude_replies'] && isset($twitter_object['text']) && substr($twitter_object['text'],0,1)=='@') || (!$args['include_rts'] && isset($twitter_object['retweeted_status'])) ) ))):
1717
- // if (! ($args['exclude_replies'] && isset($twitter_object['text']) && substr($twitter_object['text'],0,1)=='@')): // This works to exlude replies
1718
- // if (! (!$args['include_rts'] && isset($twitter_object['retweeted_status'])) ) : // This works to exclude retweets
 
 
 
 
 
 
 
 
 
 
 
 
1719
  $tweet_counter++;
1720
  if($tweet_counter <= $tweet_count):
1721
  if($tweet_counter == 1 || ( isset($args['no_rotate']) && $args['no_rotate'] ) || $rotation_type == 'carousel' ):
@@ -1724,8 +1762,12 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1724
  $result .= "\n\t<div class = 'rotatingtweet' style='display:none'>";
1725
  endif;
1726
  # Now to process the text
1727
- // print_r($twitter_object);
1728
- $main_text = $twitter_object['text'];
 
 
 
 
1729
  if(!empty($main_text)):
1730
  $user = $twitter_object['user'];
1731
  $tweetuser = $user;
@@ -1742,15 +1784,28 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1742
  unset($rt_data);
1743
  endif;
1744
  if(!empty($rt_data)):
 
 
 
 
 
 
 
1745
  $rt_user = $rt_data['user'];
 
 
 
 
 
 
1746
  // The version numbers in this array remove RT and use the original text
1747
  $rt_replace_array = array(1,2,3);
1748
  if(in_array($args['official_format'],$rt_replace_array) || $args['official_format'] === 'custom' ):
1749
- $main_text = $rt_data['text'];
1750
  $retweeter = $user;
1751
  $tweetuser = $rt_user;
1752
  else:
1753
- $main_text = "RT @".$rt_user['screen_name'] . " " . $rt_data['text'];
1754
  endif;
1755
  $before[] = "*@".$rt_user['screen_name']."\b*i";
1756
  $after[] = rotatingtweets_user_intent($rt_user,$twitterlocale,'screen_name',$targetvalue);
@@ -1803,7 +1858,7 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1803
  if(strlen($displayurl)>$urllength):
1804
  # PHP sometimes has a really hard time with unicode characters - this one removes the ellipsis
1805
  $displayurl = str_replace(json_decode('"\u2026"'),"",$displayurl);
1806
- $displayurl = substr($displayurl,0,$urllength)."&hellip;";
1807
  endif;
1808
  if(isset($args['show_tco_link']) && $args['show_tco_link']):
1809
  $after[] = "<a href='".$url['url']."' title='".$url['expanded_url']."'".$targetvalue." class='rtw_url_link'>".esc_html($url['url'])."</a>";
@@ -1831,7 +1886,7 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1831
  $displayurl = $medium['display_url'];
1832
  if(strlen($displayurl)>$urllength):
1833
  $displayurl = str_replace(json_decode('"\u2026"'),"",$displayurl);
1834
- $displayurl = substr($displayurl,0,$urllength)."&hellip;";
1835
  endif;
1836
  $after[] = "<a href='".$medium['url']."' title='".$medium['expanded_url']."'".$targetvalue." class='rtw_media_link'>".esc_html($displayurl)."</a>";
1837
  endforeach;
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
6
  Text Domain: rotatingtweets
7
  Domain Path: /languages
8
  Author: Martin Tod
1182
  # Checks if it is time to call Twitter directly yet or if it should use the cache
1183
  if($timegap > $cache_delay):
1184
  $apioptions = array('screen_name'=>$tw_screen_name,'include_entities'=>1,'count'=>60,'include_rts'=>$tw_include_rts,'exclude_replies'=>$tw_exclude_replies);
1185
+ // New option to support extended Tweets
1186
+ $apioptions['tweet_mode']='extended';
1187
  $twitterusers = FALSE;
1188
  if($tw_search) {
1189
  $apioptions['q']=$tw_search;
1211
  if(WP_DEBUG):
1212
  $rt_time_taken = number_format(microtime(true)-$rt_starttime,4);
1213
  echo "<!-- Rotating Tweets - got new data - time taken: $rt_time_taken seconds -->";
1214
+ // echo "\n<!-- Data received from Twitter: \n";print_r($twitterjson);echo "\n-->\n";
1215
  endif;
1216
  else:
1217
  rotatingtweets_set_transient('rotatingtweets_wp_error',$twitterdata->get_error_messages(), 120);
1223
  # Checks for errors in the reply
1224
  if(!empty($twitterjson['errors'])):
1225
  # If there's an error, reset the cache timer to make sure we don't hit Twitter too hard and get rate limited.
1226
+ if(WP_DEBUG):
1227
+ echo "<!-- \n";
1228
+ print_r($twitterjson);
1229
+ echo "\n-->";
1230
+ endif;
1231
  if( $twitterjson['errors'][0]['code'] == 88 ):
1232
  $rate = rotatingtweets_get_rate_data();
1233
  if($rate && $rate['remaining_hits'] == 0):
1261
  echo "<!-- using [results] -->";
1262
  endif;
1263
  $twitterjson = $twitterjson['results'];
1264
+ else:
1265
+ if(WP_DEBUG):
1266
+ echo "<!-- neither statuses nor results - pull in full data -->";
1267
+ endif;
1268
  endif;
1269
  if(isset($twitterjson) && is_array($twitterjson) && isset($twitterjson[0] )) $firstentry = $twitterjson[0];
1270
+ if(!empty($firstentry['text']) || !empty($firstentry['full_text']) ):
1271
  $number_returned_tweets = count($twitterjson);
1272
+ if(WP_DEBUG):
1273
+ echo "<!-- ".$number_returned_tweets." tweets returned -->\n<!-- \n";
1274
+ // print_r($twitterjson);
1275
+ echo "\n-->";
1276
+ endif;
1277
  if( $tw_search && $tw_merge && $number_returned_tweets < 60 && isset($latest_json) && is_array($latest_json) && count($latest_json)>0 ):
1278
  if(WP_DEBUG) echo "<!-- ".count($latest_json)." tweets in cache -->";
1279
  $twitterjson = rotatingtweet_combine_jsons($twitterjson,$latest_json);
1374
  }
1375
  function rotatingtweets_shrink_element($json,$no_emoji=0) {
1376
  global $args;
1377
+ $rt_top_elements = array('text','full_text','retweeted_status','quoted_status','user','entities','source','id_str','created_at','coordinates','display_text_range','in_reply_to_status_id_str','in_reply_to_user_id','in_reply_to_user_id_str','in_reply_to_screen_name');
1378
  $return = array();
1379
  foreach($rt_top_elements as $rt_element):
1380
  if(isset($json[$rt_element])):
1383
  $return[$rt_element]=rotatingtweets_shrink_user($json[$rt_element]);
1384
  break;
1385
  case "entities":
1386
+ case "extended_entities":
1387
  $return[$rt_element]=rotatingtweets_shrink_entities($json[$rt_element]);
1388
  break;
1389
  case "retweeted_status":
1390
+ case "quoted_status":
1391
  $return[$rt_element]=rotatingtweets_shrink_element($json[$rt_element]);
1392
  break;
1393
  case "text":
1394
+ case "full_text":
1395
  $json[$rt_element] = rotatingtweets_convert_charset($json[$rt_element]);
1396
  default:
1397
  if($no_emoji):
1731
  shuffle($json);
1732
  endif;
1733
  foreach($json as $twitter_object):
1734
+ /*
1735
+ if(WP_DEBUG):
1736
+ echo "\n<!-- Twitter object in json ";
1737
+ print_r($twitter_object);
1738
+ echo "\n-->";
1739
+ endif;
1740
+ */
1741
+ /* Old if statement to include retweets (if wanted) and exclude replies
1742
  if ((isset($args['only_rts']) && $args['only_rts'] && isset($twitter_object['retweeted_status'] )) || ((!isset($args['only_rts']) || !$args['only_rts']) && ( ! ( ($args['exclude_replies'] && isset($twitter_object['text']) && substr($twitter_object['text'],0,1)=='@') || (!$args['include_rts'] && isset($twitter_object['retweeted_status'])) ) ))):
1743
+ */
1744
+ if(
1745
+ (isset($args['only_rts']) && $args['only_rts'] && isset($twitter_object['retweeted_status'] )) // If it's only RTs then include RTs
1746
+ ||
1747
+ (
1748
+ (!isset($args['only_rts']) || !$args['only_rts']) // If it's not 'only RTs'
1749
+ &&
1750
+ !(
1751
+ ($args['exclude_replies'] && isset($twitter_object['in_reply_to_status_id_str'])) // And it's not a reply that needs to be excluded
1752
+ ||
1753
+ ( !$args['include_rts'] && isset($twitter_object['retweeted_status'])) // And it's not a rt that needs to be excluded
1754
+ )
1755
+ )
1756
+ ):
1757
  $tweet_counter++;
1758
  if($tweet_counter <= $tweet_count):
1759
  if($tweet_counter == 1 || ( isset($args['no_rotate']) && $args['no_rotate'] ) || $rotation_type == 'carousel' ):
1762
  $result .= "\n\t<div class = 'rotatingtweet' style='display:none'>";
1763
  endif;
1764
  # Now to process the text
1765
+ if(isset($twitter_object['text'])):
1766
+ $main_text = $twitter_object['text'];
1767
+ else:
1768
+ $main_official_display_text = mb_substr($twitter_object['full_text'],$twitter_object['display_text_range'][0],$twitter_object['display_text_range'][1]-$twitter_object['display_text_range'][0]);
1769
+ $main_text = $twitter_object['full_text'];
1770
+ endif;
1771
  if(!empty($main_text)):
1772
  $user = $twitter_object['user'];
1773
  $tweetuser = $user;
1784
  unset($rt_data);
1785
  endif;
1786
  if(!empty($rt_data)):
1787
+ /*
1788
+ if(WP_DEBUG):
1789
+ echo "<!-- Print RT details: \n";
1790
+ print_r($rt_data);
1791
+ echo "\n-->";
1792
+ endif;
1793
+ */
1794
  $rt_user = $rt_data['user'];
1795
+ if(isset($rt_data['text'])):
1796
+ $rt_text = $rt_data['text'];
1797
+ else:
1798
+ $rt_official_display_text = mb_substr($rt_data['full_text'],$rt_data['display_text_range'][0],$rt_data['display_text_range'][1]-$rt_data['display_text_range'][0]);
1799
+ $rt_text = $rt_data['full_text'];
1800
+ endif;
1801
  // The version numbers in this array remove RT and use the original text
1802
  $rt_replace_array = array(1,2,3);
1803
  if(in_array($args['official_format'],$rt_replace_array) || $args['official_format'] === 'custom' ):
1804
+ $main_text = $rt_text;
1805
  $retweeter = $user;
1806
  $tweetuser = $rt_user;
1807
  else:
1808
+ $main_text = "RT @".$rt_user['screen_name'] . " " . $rt_text;
1809
  endif;
1810
  $before[] = "*@".$rt_user['screen_name']."\b*i";
1811
  $after[] = rotatingtweets_user_intent($rt_user,$twitterlocale,'screen_name',$targetvalue);
1858
  if(strlen($displayurl)>$urllength):
1859
  # PHP sometimes has a really hard time with unicode characters - this one removes the ellipsis
1860
  $displayurl = str_replace(json_decode('"\u2026"'),"",$displayurl);
1861
+ $displayurl = mb_substr($displayurl,0,$urllength)."&hellip;";
1862
  endif;
1863
  if(isset($args['show_tco_link']) && $args['show_tco_link']):
1864
  $after[] = "<a href='".$url['url']."' title='".$url['expanded_url']."'".$targetvalue." class='rtw_url_link'>".esc_html($url['url'])."</a>";
1886
  $displayurl = $medium['display_url'];
1887
  if(strlen($displayurl)>$urllength):
1888
  $displayurl = str_replace(json_decode('"\u2026"'),"",$displayurl);
1889
+ $displayurl = mb_substr($displayurl,0,$urllength)."&hellip;";
1890
  endif;
1891
  $after[] = "<a href='".$medium['url']."' title='".$medium['expanded_url']."'".$targetvalue." class='rtw_media_link'>".esc_html($displayurl)."</a>";
1892
  endforeach;