Rotating Tweets (Twitter widget and shortcode) - Version 1.8

Version Description

  • New option to hide CSS. Updated Twitter JavaScript. Fixed text encoding bug.

=

Download this release

Release Info

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

Code changes from version 1.7.18 to 1.8

js/rotating_tweet.js CHANGED
@@ -288,5 +288,19 @@ jQuery(document).ready(function() {
288
  });
289
  });
290
  /* And call the Twitter script while we're at it! */
291
- /* Standard script to call Twitter */
292
- !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  });
289
  });
290
  /* And call the Twitter script while we're at it! */
291
+ window.twttr = (function(d, s, id) {
292
+ var js, fjs = d.getElementsByTagName(s)[0],
293
+ t = window.twttr || {};
294
+ if (d.getElementById(id)) return t;
295
+ js = d.createElement(s);
296
+ js.id = id;
297
+ js.src = "https://platform.twitter.com/widgets.js";
298
+ fjs.parentNode.insertBefore(js, fjs);
299
+
300
+ t._e = [];
301
+ t.ready = function(f) {
302
+ t._e.push(f);
303
+ };
304
+
305
+ return t;
306
+ }(document, "script", "twitter-wjs"));
js/rotatingtweets_v2.js CHANGED
@@ -94,4 +94,19 @@ jQuery(document).ready(function() {
94
  });
95
  /* And call the Twitter script while we're at it! */
96
  /* Standard script to call Twitter */
97
- !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  });
95
  /* And call the Twitter script while we're at it! */
96
  /* Standard script to call Twitter */
97
+ window.twttr = (function(d, s, id) {
98
+ var js, fjs = d.getElementsByTagName(s)[0],
99
+ t = window.twttr || {};
100
+ if (d.getElementById(id)) return t;
101
+ js = d.createElement(s);
102
+ js.id = id;
103
+ js.src = "https://platform.twitter.com/widgets.js";
104
+ fjs.parentNode.insertBefore(js, fjs);
105
+
106
+ t._e = [];
107
+ t.ready = function(f) {
108
+ t._e.push(f);
109
+ };
110
+
111
+ return t;
112
+ }(document, "script", "twitter-wjs"));
languages/rotatingtweets-en_GB.mo DELETED
Binary file
languages/rotatingtweets-es_ES.mo DELETED
Binary file
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.3
7
- Stable tag: 1.7.18
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -15,9 +15,9 @@ Twitter widget and shortcode to show your latest tweets one at a time an animate
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
- * **Customisable** - 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.
19
  * **Responsive** - resizes as your page resizes
20
- * Gives you the option to show a fully customisable Twitter 'follow' button
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.
@@ -106,7 +106,7 @@ Most of this is my own work, but special thanks are owed to:
106
  * [Mike Alsup](http://jquery.malsup.com/cycle/) for [jQuery.Cycle](http://jquery.malsup.com/cycle/) and [jQuery.Cycle2](http://jquery.malsup.com/cycle2/)
107
  * [Syd Lawrence](http://sydlawrence.com/) for introducing me to jQuery and jQuery.Cycle
108
  * [Abraham Williams](http://abrah.am) for [TwitterOAuth](https://github.com/abraham/twitteroauth)
109
- * [Liam Gaddy](http://profiles.wordpress.org/lgladdy/) at [Storm Consultancy](http://www.stormconsultancy.co.uk/) for [his work](http://www.stormconsultancy.co.uk/blog/development/tools-plugins/oauth-twitter-feed-for-developers-library-and-wordpress-plugin/) on [oAuth Twitter Feed for Developers](http://wordpress.org/extend/plugins/oauth-twitter-feed-for-developers/) (although I ended up using it for inspiration rather than plugging it in directly).
110
  * All the people who have given advice and suggested improvements
111
 
112
  Thank you to the people who did the original translation work for the following packs:
@@ -121,7 +121,7 @@ Thank you to the people who did the original translation work for the following
121
 
122
  == Frequently Asked Questions ==
123
  = What options can I use for the shortcode? =
124
- All the options are listed on the [Rotating Tweets installation page](http://wordpress.org/extend/plugins/rotatingtweets/installation/).
125
 
126
  = How can I include Rotating Tweets in my template? =
127
  Try something like:
@@ -166,7 +166,7 @@ If there is only one copy of `jquery` and of `jquery.cycle` on your page, the be
166
  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.
167
 
168
  = What can I do if I get the WordPress error code: `http_request_failed - name lookup timed out`? =
169
- Try installing the [Core Control plug-in](http://wordpress.org/extend/plugins/core-control/) and disabling cURL. You can read more about the problem via [this support page](http://wordpress.org/support/topic/wp-351-wordpress-error-code-http_request_failed-name-lookup-timed-out).
170
 
171
  Thank you to [darkiko](http://wordpress.org/support/profile/darkiko) for sharing their solution to this problem.
172
 
@@ -183,10 +183,18 @@ 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.7.18 =
187
- * Reinstalling translation packs.
188
 
189
  == Changelog ==
 
 
 
 
 
 
 
 
190
  = 1.7.18 =
191
  * Reinstalling translation packs. Turns out that incomplete packs aren't loaded - which breaks some of the available translations.
192
 
@@ -202,7 +210,7 @@ You can do this by going to the `rotatingtweets/css` directory and renaming `rot
202
  * Enabling sorting of display elements via `rtw_display_order` shortcode
203
 
204
  = 1.7.14 =
205
- * Works with [Page Builder by SiteOrigin](https://wordpress.org/plugins/siteorigin-panels/).
206
  * Adds new shortcode variable `only_rts`
207
 
208
  = 1.7.13 =
@@ -270,7 +278,7 @@ You can do this by going to the `rotatingtweets/css` directory and renaming `rot
270
 
271
  = 1.7.0 =
272
  * Adding `offset`, `speed`, `tweet_length`, `no_emoji` and `show_media` options to the shortcode
273
- * Solves clash with [Cyclone Slider 2](http://wordpress.org/plugins/cyclone-slider-2/)
274
  * Adds script version details to the JavaScript
275
  * Removal of excess spaces from `middot` shortcode option
276
  * Adds option for 'custom' display layoot with user-defined display function `rotatingtweets_display_override()`
@@ -301,7 +309,7 @@ You can do this by going to the `rotatingtweets/css` directory and renaming `rot
301
  * Language update including new Serbian translation. Solved an unusual styling problem.
302
 
303
  = 1.6.4 =
304
- * Bug fix when user name not recognised.
305
 
306
  = 1.6.3 =
307
  * Add option to shorten default link length to 20 characters
@@ -328,7 +336,7 @@ You can do this by going to the `rotatingtweets/css` directory and renaming `rot
328
 
329
  = 1.5.1 =
330
  * Enforce rules on replies and retweets even if the Twitter API doesn't
331
- * Fixed problem with [Magazino template](http://wordpress.org/themes/magazino)
332
  * Fixed incorrect message on settings page
333
 
334
  = 1.5.0 =
@@ -351,7 +359,7 @@ You can do this by going to the `rotatingtweets/css` directory and renaming `rot
351
 
352
  = 1.4.5 =
353
  * Deletes old cache entries if unused for more than 30 days
354
- * Fixes a jQuery cycle clash with the [Oxygen theme](http://wordpress.org/extend/themes/oxygen/).
355
  * Added `readme.txt` instructions for dealing with the WordPress error code: `http_request_failed - name lookup timed out`.
356
 
357
  = 1.4.4 =
@@ -368,7 +376,7 @@ You can do this by going to the `rotatingtweets/css` directory and renaming `rot
368
  = 1.4.1 =
369
  * Now works with responsive formats
370
  * Adjusted width overflow issues
371
- * Added [instructions on how to deal with width issues](http://wordpress.org/extend/plugins/rotatingtweets/faq/)
372
 
373
  = 1.4.0 =
374
  * Support for search, favorites and lists via Rotating Tweets widgets.
@@ -477,7 +485,7 @@ You can do this by going to the `rotatingtweets/css` directory and renaming `rot
477
  * Tidied up code.
478
 
479
  = 0.505 (1.0.0) =
480
- * Minimised Javascript.
481
  * Set-up for I18n.
482
 
483
  = 0.502 (0.4.1) =
@@ -490,7 +498,7 @@ You can do this by going to the `rotatingtweets/css` directory and renaming `rot
490
  * Solves `Cannot use string offset as an array` error on line 232
491
 
492
  = 0.491 (0.3.0) =
493
- * Lets you customise the Twitter 'follow' button.
494
  * Fixes problem with media links.
495
  * Sorts problem of overlong links reshaping widgets.
496
 
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
 
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.
19
  * **Responsive** - resizes as your page resizes
20
+ * Gives you the option to show a fully customizable Twitter 'follow' button
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.
106
  * [Mike Alsup](http://jquery.malsup.com/cycle/) for [jQuery.Cycle](http://jquery.malsup.com/cycle/) and [jQuery.Cycle2](http://jquery.malsup.com/cycle2/)
107
  * [Syd Lawrence](http://sydlawrence.com/) for introducing me to jQuery and jQuery.Cycle
108
  * [Abraham Williams](http://abrah.am) for [TwitterOAuth](https://github.com/abraham/twitteroauth)
109
+ * [Liam Gaddy](http://profiles.wordpress.org/lgladdy/) at [Storm Consultancy](http://www.stormconsultancy.co.uk/) for [his work](http://www.stormconsultancy.co.uk/blog/development/tools-plugins/oauth-twitter-feed-for-developers-library-and-wordpress-plugin/) on [oAuth Twitter Feed for Developers](/plugins/oauth-twitter-feed-for-developers/) (although I ended up using it for inspiration rather than plugging it in directly).
110
  * All the people who have given advice and suggested improvements
111
 
112
  Thank you to the people who did the original translation work for the following packs:
121
 
122
  == Frequently Asked Questions ==
123
  = What options can I use for the shortcode? =
124
+ All the options are listed on the [Rotating Tweets installation page](/plugins/rotatingtweets/installation/).
125
 
126
  = How can I include Rotating Tweets in my template? =
127
  Try something like:
166
  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.
167
 
168
  = What can I do if I get the WordPress error code: `http_request_failed - name lookup timed out`? =
169
+ Try installing the [Core Control plug-in](/plugins/core-control/) and disabling cURL. You can read more about the problem via [this support page](http://wordpress.org/support/topic/wp-351-wordpress-error-code-http_request_failed-name-lookup-timed-out).
170
 
171
  Thank you to [darkiko](http://wordpress.org/support/profile/darkiko) for sharing their solution to this problem.
172
 
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
194
+ * Handled bug with `UTF8MB4` text encoding
195
+ * Tidier date management code with better error handling
196
+ * Made links in the `readme.txt` language independent
197
+
198
  = 1.7.18 =
199
  * Reinstalling translation packs. Turns out that incomplete packs aren't loaded - which breaks some of the available translations.
200
 
210
  * Enabling sorting of display elements via `rtw_display_order` shortcode
211
 
212
  = 1.7.14 =
213
+ * Works with [Page Builder by SiteOrigin](/plugins/siteorigin-panels/).
214
  * Adds new shortcode variable `only_rts`
215
 
216
  = 1.7.13 =
278
 
279
  = 1.7.0 =
280
  * Adding `offset`, `speed`, `tweet_length`, `no_emoji` and `show_media` options to the shortcode
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()`
309
  * Language update including new Serbian translation. Solved an unusual styling problem.
310
 
311
  = 1.6.4 =
312
+ * Bug fix when user name not recognized.
313
 
314
  = 1.6.3 =
315
  * Add option to shorten default link length to 20 characters
336
 
337
  = 1.5.1 =
338
  * Enforce rules on replies and retweets even if the Twitter API doesn't
339
+ * Fixed problem with [Magazino template](/themes/magazino)
340
  * Fixed incorrect message on settings page
341
 
342
  = 1.5.0 =
359
 
360
  = 1.4.5 =
361
  * Deletes old cache entries if unused for more than 30 days
362
+ * Fixes a jQuery cycle clash with the [Oxygen theme](/themes/oxygen/).
363
  * Added `readme.txt` instructions for dealing with the WordPress error code: `http_request_failed - name lookup timed out`.
364
 
365
  = 1.4.4 =
376
  = 1.4.1 =
377
  * Now works with responsive formats
378
  * Adjusted width overflow issues
379
+ * Added [instructions on how to deal with width issues](/plugins/rotatingtweets/faq/)
380
 
381
  = 1.4.0 =
382
  * Support for search, favorites and lists via Rotating Tweets widgets.
485
  * Tidied up code.
486
 
487
  = 0.505 (1.0.0) =
488
+ * Minimized Javascript.
489
  * Set-up for I18n.
490
 
491
  = 0.502 (0.4.1) =
498
  * Solves `Cannot use string offset as an array` error on line 232
499
 
500
  = 0.491 (0.3.0) =
501
+ * Lets you customize the Twitter 'follow' button.
502
  * Fixes problem with media links.
503
  * Sorts problem of overlong links reshaping widgets.
504
 
rotatingtweets.php CHANGED
@@ -3,7 +3,7 @@
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.7.18
7
  Text Domain: rotatingtweets
8
  Domain Path: /languages
9
  Author: Martin Tod
@@ -509,7 +509,23 @@ function rotatingtweets_timestamp_link($twitter_object,$timetype = 'default',$ta
509
  $string .= rotatingtweets_contextualtime_short($tweettimestamp);
510
  break;
511
  case 'long':
512
- $string .= date_i18n(get_option('time_format'),$tweettimestamp )." · ".date_i18n(get_option('date_format') ,$tweettimestamp );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
513
  break;
514
  default:
515
  $string .= ucfirst(rotatingtweets_contextualtime($tweettimestamp));
@@ -700,6 +716,9 @@ function rotatingtweets_admin_init(){
700
  add_settings_section('rotatingtweets_jquery_main', __('JavaScript Settings','rotatingtweets'), 'rotatingtweets_jquery_explanation', 'rotatingtweets_api_settings');
701
  add_settings_field('rotatingtweets_jquery_cycle_version', __('Version of JQuery Cycle','rotatingtweets'), 'rotatingtweets_option_show_cycle_version','rotatingtweets_api_settings','rotatingtweets_jquery_main');
702
  add_settings_field('rotatingtweets_js_in_footer', __('Where to load Rotating Tweets JavaScript','rotatingtweets'), 'rotatingtweets_option_show_in_footer','rotatingtweets_api_settings','rotatingtweets_jquery_main');
 
 
 
703
  }
704
  function rotatingtweets_option_show_key() {
705
  $options = get_option('rotatingtweets-api-settings');
@@ -813,6 +832,26 @@ function rotatingtweets_option_show_in_footer() {
813
  }
814
  echo "\n</select>";
815
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
816
  // Explanatory text
817
  function rotatingtweets_api_explanation() {
818
 
@@ -823,8 +862,11 @@ function rotatingtweets_connection_explanation() {
823
  };
824
  // Explanatory text
825
  function rotatingtweets_jquery_explanation() {
826
- // _e('This section is experimental and currently only displays if WP_DEBUG is set','rotatingtweets');
827
  };
 
 
 
 
828
  // validate our options
829
  function rotatingtweets_api_validate($input) {
830
  $options = get_option('rotatingtweets-api-settings');
@@ -885,6 +927,13 @@ function rotatingtweets_api_validate($input) {
885
  else:
886
  $options['js_in_footer'] = FALSE;
887
  endif;
 
 
 
 
 
 
 
888
  // Now a proper test
889
  if(empty($error)):
890
  $transientname = 'rotatingtweets_check_wp_remote_request'; // This whole code is to help someone who has a problem with wp_remote_request
@@ -1004,23 +1053,36 @@ function rotatingtweets_get_cache_delay() {
1004
  }
1005
  # Get the latest data from Twitter (or from a cache if it's been less than 2 minutes since the last load)
1006
  function rotatingtweets_get_tweets($tw_screen_name,$tw_include_rts,$tw_exclude_replies,$tw_get_favorites = FALSE,$tw_search = FALSE,$tw_list = FALSE, $tw_merge = TRUE, $tw_collection = FALSE ) {
1007
- # Set timer
1008
- $rt_starttime = microtime(true);
1009
- # Clear up variables
1010
- $tw_screen_name = trim(remove_accents(str_replace('@','',$tw_screen_name)));
1011
- if($tw_list):
1012
- $tw_list = strtolower(sanitize_file_name( $tw_list ));
1013
- endif;
1014
  if(empty($tw_search)):
1015
  $possibledividers = array(' ',';',',');
1016
- $rt_namesarray = false;
1017
  foreach($possibledividers as $possibledivider):
1018
  if(strpos($tw_screen_name,$possibledivider) !== false ):
1019
  $rt_namesarray = explode($possibledivider,$tw_screen_name);
1020
- $tw_search = 'from:'.implode(' OR from:',$rt_namesarray);
1021
  endif;
1022
  endforeach;
 
 
 
1023
  else:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1024
  $tw_search = trim($tw_search);
1025
  endif;
1026
  if($tw_collection):
@@ -1398,7 +1460,7 @@ function rotatingtweets_trigger_rate_limiting() {
1398
  }
1399
  }
1400
  function rotatingtweets_convert_charset($string) {
1401
- if( defined('DB_CHARSET') && strtoupper(DB_CHARSET) !='UTF-8' && strtoupper(DB_CHARSET)!= 'UTF8' && strtoupper(DB_CHARSET)!= '' ):
1402
  $new_string = iconv("UTF-8",DB_CHARSET . '//TRANSLIT',$string);
1403
  if(empty($new_string)):
1404
  if(WP_DEBUG):
@@ -1732,7 +1794,7 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1732
  // $before[]="%#([0-9]*[\p{L}a-zA-Z_]+\w*)%";
1733
  # This is designed to find hashtags and turn them into links...
1734
  $before[]="%#\b(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%u";
1735
- $after[]='<a href="http://twitter.com/search?q=%23$1&amp;src=hash" title="#$1"'.$targetvalue.' class="rtw_hashtag_link">#$1</a>';
1736
  # Attempts to remove emoji - see http://www.regular-expressions.info/unicode.html https://en.wikipedia.org/wiki/Emoji
1737
  if(isset($args['no_emoji']) && $args['no_emoji']):
1738
  // $before[]='/\\p{InGreek_Extended}/u'; #Not supported by PCRE http://php.net/manual/en/regexp.reference.unicode.php
@@ -1847,6 +1909,7 @@ function rotating_tweets_display($json,$args,$print=FALSE) {
1847
  endif;
1848
  if(isset($args['show_meta_tweet_counter']) && $args['show_meta_tweet_counter']):
1849
  if(!empty($meta)) $meta .= ' &middot; ';
 
1850
  $meta .= sprintf(__('%1$s of %2$s','rotatingtweets'),$tweet_counter,$tweet_count);
1851
  endif;
1852
  if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && $args['np_pos']=='tweets'):
@@ -2287,6 +2350,8 @@ function rotatingtweets_enqueue_scripts() {
2287
  */
2288
  }
2289
  function rotatingtweets_enqueue_style() {
 
 
2290
  wp_enqueue_style( 'rotatingtweets', plugins_url('css/style.css', __FILE__));
2291
  $uploads = wp_upload_dir();
2292
  $personalstyle = array(
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
509
  $string .= rotatingtweets_contextualtime_short($tweettimestamp);
510
  break;
511
  case 'long':
512
+ $timezone_string = get_option('timezone_string');
513
+ if(WP_DEBUG) {
514
+ echo "\n<!-- Timezone debug";
515
+ echo "\n- Default timezone used in this script: ".date_default_timezone_get();
516
+ echo "\n- Wordpress timezone setting: ".$timezone_string;
517
+ };
518
+ if(!empty($timezone_string)):
519
+ date_default_timezone_set( get_option('timezone_string') );
520
+ endif;
521
+ if(WP_DEBUG) {
522
+ echo "\n- Reset timezone used in this script: ".date_default_timezone_get();
523
+ echo "\n- Tweet timestamp: ".$tweettimestamp;
524
+ echo "\n- Time format: ".get_option('time_format');
525
+ echo "\n- Display time: ".date_i18n(get_option('time_format'),$tweettimestamp );
526
+ echo "\n-->";
527
+ }
528
+ $string .= date_i18n(get_option('time_format'),$tweettimestamp )." &middot; ".date_i18n(get_option('date_format') ,$tweettimestamp );
529
  break;
530
  default:
531
  $string .= ucfirst(rotatingtweets_contextualtime($tweettimestamp));
716
  add_settings_section('rotatingtweets_jquery_main', __('JavaScript Settings','rotatingtweets'), 'rotatingtweets_jquery_explanation', 'rotatingtweets_api_settings');
717
  add_settings_field('rotatingtweets_jquery_cycle_version', __('Version of JQuery Cycle','rotatingtweets'), 'rotatingtweets_option_show_cycle_version','rotatingtweets_api_settings','rotatingtweets_jquery_main');
718
  add_settings_field('rotatingtweets_js_in_footer', __('Where to load Rotating Tweets JavaScript','rotatingtweets'), 'rotatingtweets_option_show_in_footer','rotatingtweets_api_settings','rotatingtweets_jquery_main');
719
+ // CSS settings
720
+ add_settings_section('rotatingtweets_css_main', __('CSS Settings','rotatingtweets'), 'rotatingtweets_css_explanation', 'rotatingtweets_api_settings');
721
+ add_settings_field('rotatingtweets_show_css', __('Use Rotating Tweets CSS Stylesheet','rotatingtweets'), 'rotatingtweets_option_show_css','rotatingtweets_api_settings','rotatingtweets_css_main');
722
  }
723
  function rotatingtweets_option_show_key() {
724
  $options = get_option('rotatingtweets-api-settings');
832
  }
833
  echo "\n</select>";
834
  }
835
+
836
+ function rotatingtweets_option_show_css() {
837
+ $options = get_option('rotatingtweets-api-settings');
838
+ $choice = array(
839
+ 0 => _x('Show CSS stylesheet (default)','Whether to show CSS stylesheet','rotatingtweets'),
840
+ 1 => _x('Hide CSS stylesheet','Whether to show CSS stylesheet','rotatingtweets')
841
+ );
842
+ echo "\n<select id='rotatingtweets_api_show_css_input' name='rotatingtweets-api-settings[hide_css]'>";
843
+ if(!isset($options['hide_css'])) $options['hide_css'] = FALSE;
844
+ foreach($choice as $value => $text) {
845
+ if($options['hide_css'] == $value ) {
846
+ $selected = ' selected = "selected"';
847
+ } else {
848
+ $selected = '';
849
+ }
850
+ echo "\n\t<option value='".$value."'".$selected.">".$text."</option>";
851
+ }
852
+ echo "\n</select>";
853
+ }
854
+
855
  // Explanatory text
856
  function rotatingtweets_api_explanation() {
857
 
862
  };
863
  // Explanatory text
864
  function rotatingtweets_jquery_explanation() {
 
865
  };
866
+ // Explanatory text
867
+ function rotatingtweets_css_explanation() {
868
+ };
869
+
870
  // validate our options
871
  function rotatingtweets_api_validate($input) {
872
  $options = get_option('rotatingtweets-api-settings');
927
  else:
928
  $options['js_in_footer'] = FALSE;
929
  endif;
930
+ // Check CSS
931
+ if(isset($input['hide_css'])):
932
+ $options['hide_css'] = (bool) $input['hide_css'];
933
+ else:
934
+ $options['hide_css'] = FALSE;
935
+ endif;
936
+
937
  // Now a proper test
938
  if(empty($error)):
939
  $transientname = 'rotatingtweets_check_wp_remote_request'; // This whole code is to help someone who has a problem with wp_remote_request
1053
  }
1054
  # Get the latest data from Twitter (or from a cache if it's been less than 2 minutes since the last load)
1055
  function rotatingtweets_get_tweets($tw_screen_name,$tw_include_rts,$tw_exclude_replies,$tw_get_favorites = FALSE,$tw_search = FALSE,$tw_list = FALSE, $tw_merge = TRUE, $tw_collection = FALSE ) {
1056
+ $rt_namesarray = array();
 
 
 
 
 
 
1057
  if(empty($tw_search)):
1058
  $possibledividers = array(' ',';',',');
 
1059
  foreach($possibledividers as $possibledivider):
1060
  if(strpos($tw_screen_name,$possibledivider) !== false ):
1061
  $rt_namesarray = explode($possibledivider,$tw_screen_name);
 
1062
  endif;
1063
  endforeach;
1064
+ endif;
1065
+ if(empty($rt_namesarray)):
1066
+ return rotatingtweets_get_tweets_sf($tw_screen_name,$tw_include_rts,$tw_exclude_replies,$tw_get_favorites,$tw_search,$tw_list, $tw_merge, $tw_collection );
1067
  else:
1068
+ $rt_return = array();
1069
+ foreach($rt_namesarray as $rt_name):
1070
+ $rt_return = rotatingtweet_combine_jsons($rt_return,rotatingtweets_get_tweets_sf($rt_name,$tw_include_rts,$tw_exclude_replies,$tw_get_favorites,$tw_search,$tw_list, $tw_merge, $tw_collection ));
1071
+ if(WP_DEBUG) echo "<!-- Adding data from ".esc_html($rt_name)." -->";
1072
+ endforeach;
1073
+ return($rt_return);
1074
+ endif;
1075
+ }
1076
+ # Old rotatingtweets_get_tweets function - now used as subfunction
1077
+ function rotatingtweets_get_tweets_sf($tw_screen_name,$tw_include_rts,$tw_exclude_replies,$tw_get_favorites = FALSE,$tw_search = FALSE,$tw_list = FALSE, $tw_merge = TRUE, $tw_collection = FALSE ) {
1078
+ # Set timer
1079
+ $rt_starttime = microtime(true);
1080
+ # Clear up variables
1081
+ $tw_screen_name = trim(remove_accents(str_replace('@','',$tw_screen_name)));
1082
+ if($tw_list):
1083
+ $tw_list = strtolower(sanitize_file_name( $tw_list ));
1084
+ endif;
1085
+ if(!empty($tw_search)):
1086
  $tw_search = trim($tw_search);
1087
  endif;
1088
  if($tw_collection):
1460
  }
1461
  }
1462
  function rotatingtweets_convert_charset($string) {
1463
+ if( defined('DB_CHARSET') && strtoupper(DB_CHARSET) !='UTF-8' && strtoupper(DB_CHARSET)!= 'UTF8' && strtoupper(DB_CHARSET)!= 'UTF8MB4' && strtoupper(DB_CHARSET)!= '' ):
1464
  $new_string = iconv("UTF-8",DB_CHARSET . '//TRANSLIT',$string);
1465
  if(empty($new_string)):
1466
  if(WP_DEBUG):
1794
  // $before[]="%#([0-9]*[\p{L}a-zA-Z_]+\w*)%";
1795
  # This is designed to find hashtags and turn them into links...
1796
  $before[]="%#\b(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%u";
1797
+ $after[]='<a href="https://twitter.com/search?q=%23$1&amp;src=hash" title="#$1"'.$targetvalue.' class="rtw_hashtag_link">#$1</a>';
1798
  # Attempts to remove emoji - see http://www.regular-expressions.info/unicode.html https://en.wikipedia.org/wiki/Emoji
1799
  if(isset($args['no_emoji']) && $args['no_emoji']):
1800
  // $before[]='/\\p{InGreek_Extended}/u'; #Not supported by PCRE http://php.net/manual/en/regexp.reference.unicode.php
1909
  endif;
1910
  if(isset($args['show_meta_tweet_counter']) && $args['show_meta_tweet_counter']):
1911
  if(!empty($meta)) $meta .= ' &middot; ';
1912
+ /* translators: used for the tweet counter - e.g. 1 of 23, 3 of 34 */
1913
  $meta .= sprintf(__('%1$s of %2$s','rotatingtweets'),$tweet_counter,$tweet_count);
1914
  endif;
1915
  if(isset($args['show_meta_prev_next']) && $args['show_meta_prev_next'] && $args['np_pos']=='tweets'):
2350
  */
2351
  }
2352
  function rotatingtweets_enqueue_style() {
2353
+ $api = get_option('rotatingtweets-api-settings');
2354
+ if(isset($api['hide_css']) && $api['hide_css']==1) return;
2355
  wp_enqueue_style( 'rotatingtweets', plugins_url('css/style.css', __FILE__));
2356
  $uploads = wp_upload_dir();
2357
  $personalstyle = array(