Simple Twitter Tweets - Version 4.0

Version Description

  • [Added] Multiple Widget ready - you can now use multiple versions in widget ready areas as requested
  • [Added] Internationalisation (i18n) - Ready for impending WP [theme and plugin] Language packs. All interface text marked up ready for translations
  • [Fixed] Redeclared Function Error Fixed
Download this release

Release Info

Developer Planet Interactive
Plugin Icon 128x128 Simple Twitter Tweets
Version 4.0
Comparing to
See all releases

Code changes from version 3.3 to 4.0

Files changed (3) hide show
  1. README.txt +6 -1
  2. js/sttAdmin.js +6 -5
  3. simple-twitter-tweets.php +91 -78
README.txt CHANGED
@@ -4,7 +4,7 @@ Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A94
4
  Tags: Twitter, Stream, Tweets, Twitter OAuth, social
5
  Requires at least: 3.0
6
  Tested up to: 4.3
7
- Stable tag: 3.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -129,6 +129,11 @@ We've tested it and as far as we know it works great! Phew, but if you have an i
129
  9. Style how you like, "Your Tweets your way"
130
 
131
  == Changelog ==
 
 
 
 
 
132
  = 3.3 =
133
  * [Fixed] PHP deprecated functions (notice) added PHP 5 construction references
134
 
4
  Tags: Twitter, Stream, Tweets, Twitter OAuth, social
5
  Requires at least: 3.0
6
  Tested up to: 4.3
7
+ Stable tag: 4.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
129
  9. Style how you like, "Your Tweets your way"
130
 
131
  == Changelog ==
132
+ = 4.0 =
133
+ * [Added] Multiple Widget ready - you can now use multiple versions in widget ready areas as requested
134
+ * [Added] Internationalisation (i18n) - Ready for impending WP [theme and plugin] Language packs. All interface text marked up ready for translations
135
+ * [Fixed] Redeclared Function Error Fixed
136
+
137
  = 3.3 =
138
  * [Fixed] PHP deprecated functions (notice) added PHP 5 construction references
139
 
js/sttAdmin.js CHANGED
@@ -1,6 +1,7 @@
 
1
  jQuery(document).ready(function($) {
2
 
3
- "use strict";
4
 
5
  // USe function so we can recall on save
6
  function updateColorPicker(){
@@ -34,10 +35,10 @@ jQuery(document).ready(function($) {
34
  $(document).on('click', '.secrets h4, .avatar h4, .twitterFollow h4, .modTime h4, .twitterIntents h4', function() {
35
  // var tFollow = $(this).next('div');
36
  $(this).next('div').slideToggle('fast', function() {
37
- if(!$(this).is(":hidden")) {
38
- $(this).siblings('h4').children('span').html("▲");
39
  }else{
40
- $(this).siblings('h4').children('span').html("▼");
41
  }
42
  });
43
  });
@@ -46,7 +47,7 @@ jQuery(document).ready(function($) {
46
  $(document).ajaxSuccess(function(e, xhr, settings) {
47
  // reset toggles - clean view
48
  $('.secrets > div, .avatar > div, .twitterFollow > div, .modTime > div, .twitterIntents > div').slideUp();
49
- $('.secrets h4 > span, .avatar h4 > span, .twitterFollow h4 > span, .modTime h4 > span, .twitterIntents h4 > span').html("▼");
50
 
51
  // re-initiate the colour picker
52
  if(settings.data.search('action=save-widget') != -1 ) {
1
+ /*global jQuery:false */
2
  jQuery(document).ready(function($) {
3
 
4
+ 'use strict';
5
 
6
  // USe function so we can recall on save
7
  function updateColorPicker(){
35
  $(document).on('click', '.secrets h4, .avatar h4, .twitterFollow h4, .modTime h4, .twitterIntents h4', function() {
36
  // var tFollow = $(this).next('div');
37
  $(this).next('div').slideToggle('fast', function() {
38
+ if(!$(this).is(':hidden')) {
39
+ $(this).siblings('h4').children('span').html('▲');
40
  }else{
41
+ $(this).siblings('h4').children('span').html('▼');
42
  }
43
  });
44
  });
47
  $(document).ajaxSuccess(function(e, xhr, settings) {
48
  // reset toggles - clean view
49
  $('.secrets > div, .avatar > div, .twitterFollow > div, .modTime > div, .twitterIntents > div').slideUp();
50
+ $('.secrets h4 > span, .avatar h4 > span, .twitterFollow h4 > span, .modTime h4 > span, .twitterIntents h4 > span').html('▼');
51
 
52
  // re-initiate the colour picker
53
  if(settings.data.search('action=save-widget') != -1 ) {
simple-twitter-tweets.php CHANGED
@@ -4,8 +4,9 @@ Plugin Name: Simple Twitter Tweets
4
  Plugin URI: http://www.planet-interactive.co.uk/simple-twitter-tweets
5
  Description: Display last x number tweets from Twitter API stream, store locally in database to present past tweets when failure to access Twitters restrictive API occurs
6
  Author: Ashley Sheinwald
7
- Version: 3.3
8
  Author URI: http://www.planet-interactive.co.uk/
 
9
  */
10
 
11
  /* Copyright 2014-2015 Ashley Sheinwald (email : ashley@planet-interactive.co.uk)
@@ -118,19 +119,19 @@ class PI_SimpleTwitterTweets extends WP_Widget{
118
 
119
  //Set up some default widget settings.
120
  $defaults = array(
121
- 'title' => __('Recent Tweets', 'pi-tweet')
122
- , 'name' => __('iPlanetUK', 'pi-tweet')
123
- , 'numTweets' => __(4, 'pi-tweet') // How many to display
124
- , 'cacheTime' => __(5, 'pi-tweet') // Time in minutes between updates
125
- , 'consumerKey' => __('xxxxxxxxxxxx', 'pi-tweet') // Consumer key
126
- , 'consumerSecret' => __('xxxxxxxxxxxx', 'pi-tweet') // Consumer secret
127
- , 'accessToken' => __('xxxxxxxxxxxx', 'pi-tweet') // Access token
128
- , 'accessTokenSecret' => __('xxxxxxxxxxxx', 'pi-tweet') // Access token secret
129
  , 'exclude_replies' => true
130
- , 'twitterFollow' => false
131
  , 'dataShowCount' => false
132
  , 'dataShowScreenName' => false
133
- , 'dataLang' => __('en', 'pi-tweet') // Language reference
134
  // STARTING NEW FOR 2.0
135
  // Time
136
  , 'timeRef' => false // false = use old full hour ref, true if selected will use hour ref as h (twitter style)
@@ -149,7 +150,7 @@ class PI_SimpleTwitterTweets extends WP_Widget{
149
  $name = $instance['name'];
150
  $numTweets = $instance['numTweets'];
151
  $cacheTime = $instance['cacheTime'];
152
- $consumerKey = trim($instance['consumerKey']);
153
  $consumerSecret = trim($instance['consumerSecret']);
154
  $accessToken = trim($instance['accessToken']);
155
  $accessTokenSecret = trim($instance['accessTokenSecret']);
@@ -165,50 +166,54 @@ class PI_SimpleTwitterTweets extends WP_Widget{
165
  $twitterIntentsText = $instance['twitterIntentsText'];
166
  $intentColor = $instance['intentColor'];
167
  $showAvatar = $instance['showAvatar'];
168
- $roundCorners = $instance['roundCorners'];
169
- $avatarSize = $instance['avatarSize'];
170
  ?>
171
 
172
  <?php
173
  // Show error if cURL not installed - extension required for Twitter API calls
174
  if (!in_array('curl', get_loaded_extensions())) {
175
- echo '<p style="background-color:pink;padding:10px;border:1px solid red;"><strong>You do not have cURL installed! This is a required PHP extension to use the Twitter API: <a href="http://curl.haxx.se/docs/install.html" taget="_blank">cURL install</a></strong></p>';
 
 
 
 
176
  }
177
  ?>
178
 
179
  <p>
180
- <label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label>
181
  </p>
182
  <p>
183
- <label for="<?php echo $this->get_field_id('name'); ?>">Twitter Name (without @ symbol): <input class="widefat" id="<?php echo $this->get_field_id('name'); ?>" name="<?php echo $this->get_field_name('name'); ?>" type="text" value="<?php echo esc_attr($name); ?>" /></label>
184
  </p>
185
  <p>
186
- <label for="<?php echo $this->get_field_id('numTweets'); ?>">Number of Tweets: <input class="widefat" id="<?php echo $this->get_field_id('numTweets'); ?>" name="<?php echo $this->get_field_name('numTweets'); ?>" type="text" value="<?php echo esc_attr($numTweets); ?>" /></label>
187
  </p>
188
  <p>
189
- <label for="<?php echo $this->get_field_id('cacheTime'); ?>">Time in Minutes between updates: <input class="widefat" id="<?php echo $this->get_field_id('cacheTime'); ?>" name="<?php echo $this->get_field_name('cacheTime'); ?>" type="text" value="<?php echo esc_attr($cacheTime); ?>" /></label>
190
  </p>
191
 
192
  <?php // NEW FOR 2.0 ?>
193
  <?php // Time display options ?>
194
  <div class="secrets" style="background:#d6eef9; margin-bottom:10px;">
195
- <h4 class="button-secondary" style="width:100%; text-align:center;">Twitter API settings <span style="font-size:75%;">&#9660;</span></h4>
196
  <div style="padding:10px;">
197
  <p>
198
- <label for="<?php echo $this->get_field_id('consumerKey'); ?>">Consumer Key: <input class="widefat" id="<?php echo $this->get_field_id('consumerKey'); ?>" name="<?php echo $this->get_field_name('consumerKey'); ?>" type="text" value="<?php echo esc_attr($consumerKey); ?>" /></label>
199
  </p>
200
  <p>
201
- <label for="<?php echo $this->get_field_id('consumerSecret'); ?>">Consumer Secret: <input class="widefat" id="<?php echo $this->get_field_id('consumerSecret'); ?>" name="<?php echo $this->get_field_name('consumerSecret'); ?>" type="text" value="<?php echo esc_attr($consumerSecret); ?>" /></label>
202
  </p>
203
  <p>
204
- <label for="<?php echo $this->get_field_id('accessToken'); ?>">Access Token: <input class="widefat" id="<?php echo $this->get_field_id('accessToken'); ?>" name="<?php echo $this->get_field_name('accessToken'); ?>" type="text" value="<?php echo esc_attr($accessToken); ?>" /></label>
205
  </p>
206
  <p>
207
- <label for="<?php echo $this->get_field_id('accessTokenSecret'); ?>">Access Token Secret: <input class="widefat" id="<?php echo $this->get_field_id('accessTokenSecret'); ?>" name="<?php echo $this->get_field_name('accessTokenSecret'); ?>" type="text" value="<?php echo esc_attr($accessTokenSecret); ?>" /></label>
208
  </p>
209
  <p>
210
  <input class="checkbox" type="checkbox" <?php checked( isset( $instance['exclude_replies']), true ); ?> id="<?php echo $this->get_field_id( 'exclude_replies' ); ?>" name="<?php echo $this->get_field_name( 'exclude_replies' ); ?>" />
211
- <label for="<?php echo $this->get_field_id( 'exclude_replies' ); ?>"><?php _e('Exclude_@replies', 'pi-tweet'); ?></label>
212
  </p>
213
  </div>
214
  </div>
@@ -216,19 +221,19 @@ class PI_SimpleTwitterTweets extends WP_Widget{
216
  <?php // NEW FOR 2.0 ?>
217
  <?php // Avatar display options ?>
218
  <div class="avatar" style="background:#d6eef9; margin-bottom:10px;">
219
- <h4 class="button-secondary" style="width:100%; text-align:center;">Twitter Avatar settings <span style="font-size:75%;">&#9660;</span></h4>
220
  <div style="padding:10px;">
221
- <p>Display your Twitter Avatar: image</p>
222
  <p>
223
  <input class="checkbox" type="checkbox" value="true" <?php checked( ( isset( $instance['showAvatar']) && ($instance['showAvatar'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'showAvatar' ); ?>" name="<?php echo $this->get_field_name( 'showAvatar' ); ?>" />
224
- <label for="<?php echo $this->get_field_id( 'showAvatar' ); ?>"><?php _e('Show your avatar image', 'pi-tweet'); ?></label>
225
  </p>
226
  <p>
227
  <input class="checkbox" type="checkbox" value="true" <?php checked( ( isset( $instance['roundCorners']) && ($instance['showAvatar'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'roundCorners' ); ?>" name="<?php echo $this->get_field_name( 'roundCorners' ); ?>" />
228
- <label for="<?php echo $this->get_field_id( 'roundCorners' ); ?>"><?php _e('Round avatar corners (5px)', 'pi-tweet'); ?></label>
229
  </p>
230
  <p>
231
- <label for="<?php echo $this->get_field_id('avatarSize'); ?>">Size of Avatar (default: 48): <input class="widefat" id="<?php echo $this->get_field_id('avatarSize'); ?>" name="<?php echo $this->get_field_name('avatarSize'); ?>" type="text" value="<?php echo esc_attr($avatarSize); ?>" /><br><em>input number only</em></label>
232
  </p>
233
  </div>
234
  </div>
@@ -236,15 +241,15 @@ class PI_SimpleTwitterTweets extends WP_Widget{
236
  <?php // NEW FOR 2.0 ?>
237
  <?php // Time display options ?>
238
  <div class="modTime" style="background:#d6eef9; margin-bottom:10px;">
239
- <h4 class="button-secondary" style="width:100%; text-align:center;">Time Display Options <span style="font-size:75%;">&#9660;</span></h4>
240
  <div style="padding:10px;">
241
  <p>
242
  <input class="checkbox" type="checkbox" value="true" <?php checked( (isset( $instance['timeRef']) && ($instance['timeRef'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'timeRef' ); ?>" name="<?php echo $this->get_field_name( 'timeRef' ); ?>" />
243
- <label for="<?php echo $this->get_field_id( 'timeRef' ); ?>"><?php _e('Change to short time reference <br><em>h for Hour(s), d for Day(s) ... <strong>Twitter style</strong></em>', 'pi-tweet'); ?></label>
244
  </p>
245
  <p>
246
  <input class="checkbox" type="checkbox" value="true" <?php checked( (isset( $instance['timeAgo']) && ($instance['timeAgo'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'timeAgo' ); ?>" name="<?php echo $this->get_field_name( 'timeAgo' ); ?>" value="true" />
247
- <label for="<?php echo $this->get_field_id( 'timeAgo' ); ?>"><?php _e('Show "ago" after the time', 'pi-tweet'); ?></label>
248
  </p>
249
  </div>
250
  </div>
@@ -252,40 +257,40 @@ class PI_SimpleTwitterTweets extends WP_Widget{
252
  <?php // NEW FOR 2.0 ?>
253
  <?php // Twitter Intents and Display Options ?>
254
  <div class="twitterIntents" style="background:#d6eef9; margin-bottom:10px;">
255
- <h4 class="button-secondary" style="width:100%; text-align:center;">Twitter Intents <span style="font-size:75%;">&#9660;</span></h4>
256
  <div style="padding:10px;">
257
  <p>
258
  <input class="checkbox" type="checkbox" value="true" <?php checked( (isset( $instance['twitterIntents']) && ($instance['twitterIntents'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'twitterIntents' ); ?>" name="<?php echo $this->get_field_name( 'twitterIntents' ); ?>" />
259
- <label for="<?php echo $this->get_field_id( 'twitterIntents' ); ?>"><?php _e('Show Twitter Intents', 'pi-tweet'); ?></label>
260
  </p>
261
  <p>
262
  <input class="checkbox" type="checkbox" value="true" <?php checked( (isset( $instance['twitterIntentsText']) && ($instance['twitterIntentsText'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'twitterIntentsText' ); ?>" name="<?php echo $this->get_field_name( 'twitterIntentsText' ); ?>" />
263
- <label for="<?php echo $this->get_field_id( 'twitterIntentsText' ); ?>"><?php _e('Hide Twitter Intents Text <br><em>e.g. just use icons</em>', 'pi-tweet'); ?></label>
264
  </p>
265
  <p>
266
- <label for="<?php echo $this->get_field_id('intentColor'); ?>">Intent icons colour: <input class="intentColor" id="<?php echo $this->get_field_id('intentColor'); ?>" name="<?php echo $this->get_field_name('intentColor'); ?>" type="text" value="<?php echo esc_attr($intentColor); ?>" /></label>
267
  <div id="colorpicker"></div>
268
  </p>
269
  </div>
270
  </div>
271
 
272
  <div class="twitterFollow" style="background:#d6eef9;">
273
- <h4 class="button-secondary" style="width:100%; text-align:center;">Twitter Follow Button <span style="font-size:75%;">&#9660;</span></h4>
274
  <div style="padding:10px;">
275
  <p>
276
  <input class="checkbox" type="checkbox" <?php checked( (isset( $instance['twitterFollow']) && ($instance['twitterFollow'] == "on") ), true ); ?> id="<?php echo $this->get_field_id( 'twitterFollow' ); ?>" name="<?php echo $this->get_field_name( 'twitterFollow' ); ?>" />
277
- <label for="<?php echo $this->get_field_id( 'twitterFollow' ); ?>"><?php _e('Show Twitter Follow Button', 'pi-tweet'); ?></label>
278
  </p>
279
  <p>
280
  <input class="checkbox" type="checkbox" <?php checked( (isset( $instance['dataShowScreenName']) && ($instance['dataShowScreenName'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'dataShowScreenName' ); ?>" name="<?php echo $this->get_field_name( 'dataShowScreenName' ); ?>" value="true" />
281
- <label for="<?php echo $this->get_field_id( 'dataShowScreenName' ); ?>"><?php _e('Show Twitter Screen Name', 'pi-tweet'); ?></label>
282
  </p>
283
  <p>
284
  <input class="checkbox" type="checkbox" <?php checked( (isset( $instance['dataShowCount']) && ($instance['dataShowCount'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'dataShowCount' ); ?>" name="<?php echo $this->get_field_name( 'dataShowCount' ); ?>" value="true" />
285
- <label for="<?php echo $this->get_field_id( 'dataShowCount' ); ?>"><?php _e('Show Twitter Followers Count', 'pi-tweet'); ?></label>
286
  </p>
287
  <p>
288
- <label for="<?php echo $this->get_field_id('dataLang'); ?>">Language: <input class="widefat" id="<?php echo $this->get_field_id('dataLang'); ?>" name="<?php echo $this->get_field_name('dataLang'); ?>" type="text" value="<?php echo esc_attr($dataLang); ?>" /></label>
289
  </p>
290
  </div>
291
  </div>
@@ -299,12 +304,12 @@ class PI_SimpleTwitterTweets extends WP_Widget{
299
  $instance['title'] = strip_tags( $new_instance['title'] );
300
  $instance['name'] = strip_tags( $new_instance['name'] );
301
  $instance['numTweets'] = $new_instance['numTweets'];
302
- $instance['cacheTime'] = $new_instance['cacheTime'];
303
  $instance['consumerKey'] = trim($new_instance['consumerKey']);
304
  $instance['consumerSecret'] = trim($new_instance['consumerSecret']);
305
  $instance['accessToken'] = trim($new_instance['accessToken']);
306
- $instance['accessTokenSecret'] = trim($new_instance['accessTokenSecret']);
307
- $instance['exclude_replies'] = $new_instance['exclude_replies'];
308
  $instance['twitterFollow'] = $new_instance['twitterFollow'];
309
  $instance['dataShowCount'] = $new_instance['dataShowCount'];
310
  $instance['dataShowScreenName'] = $new_instance['dataShowScreenName'];
@@ -314,7 +319,7 @@ class PI_SimpleTwitterTweets extends WP_Widget{
314
  $instance['timeAgo'] = $new_instance['timeAgo'];
315
  $instance['twitterIntents'] = $new_instance['twitterIntents'];
316
  $instance['twitterIntentsText'] = $new_instance['twitterIntentsText'];
317
- $instance['intentColor'] = strip_tags( $new_instance['intentColor'] );
318
  $instance['showAvatar'] = $new_instance['showAvatar'];
319
  $instance['roundCorners'] = $new_instance['roundCorners'];
320
  $instance['avatarSize'] = strip_tags( $new_instance['avatarSize'] );
@@ -332,7 +337,7 @@ class PI_SimpleTwitterTweets extends WP_Widget{
332
  $PI_title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
333
  $PI_name = $instance['name'];
334
  $PI_numTweets = $instance['numTweets'];
335
- $PI_cacheTime = $instance['cacheTime'];
336
 
337
  //Setup Twitter API OAuth tokens
338
  $PI_consumerKey = trim($instance['consumerKey']);
@@ -352,7 +357,7 @@ class PI_SimpleTwitterTweets extends WP_Widget{
352
  $PI_timeAgo = isset( $instance['timeAgo'] ) ? $instance['timeAgo'] : false;
353
  $PI_twitterIntents = isset( $instance['twitterIntents'] ) ? $instance['twitterIntents'] : false;
354
  $PI_twitterIntentsText = isset( $instance['twitterIntentsText'] ) ? $instance['twitterIntentsText'] : false;
355
- $PI_intentColor = $instance['intentColor'];
356
 
357
  // Avatar
358
  $PI_showAvatar = isset( $instance['showAvatar'] ) ? $instance['showAvatar'] : false;
@@ -384,7 +389,7 @@ class PI_SimpleTwitterTweets extends WP_Widget{
384
 
385
  // Get from https://dev.twitter.com/
386
  // Login - Create New Application, fill in details and use required data below
387
- $consumerKey = trim($PI_consumerKey); // OAuth Key
388
  $consumerSecret = trim($PI_consumerSecret); // OAuth Secret
389
  $accessToken = trim($PI_accessToken); // OAuth Access Token
390
  $accessTokenSecret = trim($PI_accessTokenSecret); // OAuth Token Secret
@@ -399,12 +404,12 @@ class PI_SimpleTwitterTweets extends WP_Widget{
399
  $timeRef = $PI_timeRef; // Time ref: hours or short h
400
  $timeAgo = $PI_timeAgo; // Human Time: ago ref or not
401
  $twitterIntents = $PI_twitterIntents; // Intent on/off
402
- $twitterIntentsText = $PI_twitterIntentsText; // Intents Text on/off
403
  $intentColor = $PI_intentColor; // Intent icons colour
404
 
405
  $showAvatar = $PI_showAvatar;
406
- $roundCorners = $PI_roundCorners;
407
- $avatarSize = $PI_avatarSize;
408
 
409
  // COMMUNITY REQUEST! (1)
410
  $transName = 'list-tweets-'.$name; // Name of value in database. [added $name for multiple account use]
@@ -500,22 +505,23 @@ class PI_SimpleTwitterTweets extends WP_Widget{
500
  endif;
501
  endif;
502
 
503
- // Thanks to Andrew Tibbetts - http://wordpress.org/support/profile/andrewgtibbetts
504
- function twitter_time_diff( $from, $to = '' ) {
505
- $diff = human_time_diff($from,$to);
506
- $replace = array(
507
- ' hour' => 'h',
508
- ' hours' => 'h',
509
- ' day' => 'd',
510
- ' days' => 'd',
511
- ' minute' => 'm',
512
- ' minutes' => 'm',
513
- ' second' => 's',
514
- ' seconds' => 's',
515
- );
516
- return strtr($diff,$replace);
 
 
517
  }
518
-
519
  // Now display the tweets, if we can.
520
  if($tweets) : ?>
521
  <?php foreach( (array) $tweets as $t) : // casting array to array just in case it's empty - then prevents PHP warning ?>
@@ -525,7 +531,9 @@ class PI_SimpleTwitterTweets extends WP_Widget{
525
  echo '<img ';
526
  echo ($avatarSize) ? ' style="margin-left:-'.($avatarSize+5).'px"':"";
527
  echo ($avatarSize) ? 'width="'.$avatarSize.'px" height="'.$avatarSize.'px"' : 'width="48px" height="48px"';
528
- echo 'src="'.$t['image'].'" alt="Tweet Avatar" class="';
 
 
529
  echo ($roundCorners) ? 'a-corn':'';
530
  echo '"/>';
531
  }
@@ -533,7 +541,12 @@ class PI_SimpleTwitterTweets extends WP_Widget{
533
  <?php echo $t['text']; ?>
534
  <br/><em>
535
  <?php if(!isset($screen_name)){ $screen_name = $name; }?>
536
- <a href="http://www.twitter.com/<?php echo $screen_name; ?>" target="_blank" title="Follow <?php echo $name; ?> on Twitter [Opens new window]">
 
 
 
 
 
537
  <?php
538
 
539
  // Original - long time ref: hours...
@@ -545,7 +558,7 @@ class PI_SimpleTwitterTweets extends WP_Widget{
545
  }
546
  // Ago - to show?
547
  if($timeAgo == "true"){
548
- $displayAgo = " ago";
549
  }else{
550
  // Added to counter 'no ago var' setting undefined variable warning
551
  $displayAgo = "";
@@ -561,15 +574,15 @@ class PI_SimpleTwitterTweets extends WP_Widget{
561
  if($twitterIntents == "true"){
562
  ?>
563
  <div class="intent-meta">
564
- <a href="http://twitter.com/intent/tweet?in_reply_to=<?php echo $t['tweet_id']; ?>" data-lang="en" class="in-reply-to" title="Reply" target="_blank">
565
  <span aria-hidden="true" data-icon="&#xf079;" <?php echo ($intentColor) ? 'style="color:'.$intentColor.';"' :''; ?>></span>
566
- <span <?php echo ($twitterIntentsText) ? 'class="pi-visuallyhidden"':''; ?>>Reply</span></a>
567
- <a href="http://twitter.com/intent/retweet?tweet_id=<?php echo $t['tweet_id']; ?>" data-lang="en" class="retweet" title="Retweet" target="_blank">
568
  <span aria-hidden="true" data-icon="&#xf112;" <?php echo ($intentColor) ? 'style="color:'.$intentColor.';"' :''; ?>></span>
569
- <span <?php echo ($twitterIntentsText) ? 'class="pi-visuallyhidden"':''; ?>>Retweet</span></a>
570
- <a href="http://twitter.com/intent/favorite?tweet_id=<?php echo $t['tweet_id']; ?>" data-lang="en" class="favorite" title="Favorite" target="_blank">
571
  <span aria-hidden="true" data-icon="&#xf005;" <?php echo ($intentColor) ? 'style="color:'.$intentColor.';"' :''; ?>></span>
572
- <span <?php echo ($twitterIntentsText) ? 'class="pi-visuallyhidden"':''; ?>>Favorite</span></a>
573
  </div>
574
  <?php } ?>
575
 
@@ -577,7 +590,7 @@ class PI_SimpleTwitterTweets extends WP_Widget{
577
  <?php endforeach; ?>
578
 
579
  <?php else : ?>
580
- <li>Waiting for Twitter... Once Twitter is ready they will display my Tweets again.</li>
581
  <?php endif; ?>
582
  </ul>
583
 
@@ -585,7 +598,7 @@ class PI_SimpleTwitterTweets extends WP_Widget{
585
  // ADD Twitter follow button - to increase engagement
586
  // Make it an options choice though
587
  if($twitterFollow){ ?>
588
- <a href="https://twitter.com/<?php echo $PI_name; ?>" class="twitter-follow-button" data-show-count="<?php echo $dataShowCount; ?>" data-show-screen-name="<?php echo $dataShowScreenName; ?>" data-lang="<?php echo $dataLang; ?>">Follow @<?php echo $PI_name; ?></a>
589
  <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
590
  <?php
591
  }
4
  Plugin URI: http://www.planet-interactive.co.uk/simple-twitter-tweets
5
  Description: Display last x number tweets from Twitter API stream, store locally in database to present past tweets when failure to access Twitters restrictive API occurs
6
  Author: Ashley Sheinwald
7
+ Version: 4.0
8
  Author URI: http://www.planet-interactive.co.uk/
9
+ Text Domain: simple-twitter-tweets
10
  */
11
 
12
  /* Copyright 2014-2015 Ashley Sheinwald (email : ashley@planet-interactive.co.uk)
119
 
120
  //Set up some default widget settings.
121
  $defaults = array(
122
+ 'title' => __('Recent Tweets', 'simple-twitter-tweets')
123
+ , 'name' => __('iPlanetUK', 'simple-twitter-tweets')
124
+ , 'numTweets' => __(4, 'simple-twitter-tweets') // How many to display
125
+ , 'cacheTime' => __(5, 'simple-twitter-tweets') // Time in minutes between updates
126
+ , 'consumerKey' => __('xxxxxxxxxxxx', 'simple-twitter-tweets') // Consumer key
127
+ , 'consumerSecret' => __('xxxxxxxxxxxx', 'simple-twitter-tweets') // Consumer secret
128
+ , 'accessToken' => __('xxxxxxxxxxxx', 'simple-twitter-tweets') // Access token
129
+ , 'accessTokenSecret' => __('xxxxxxxxxxxx', 'simple-twitter-tweets') // Access token secret
130
  , 'exclude_replies' => true
131
+ , 'twitterFollow' => false
132
  , 'dataShowCount' => false
133
  , 'dataShowScreenName' => false
134
+ , 'dataLang' => __('en', 'simple-twitter-tweets') // Language reference
135
  // STARTING NEW FOR 2.0
136
  // Time
137
  , 'timeRef' => false // false = use old full hour ref, true if selected will use hour ref as h (twitter style)
150
  $name = $instance['name'];
151
  $numTweets = $instance['numTweets'];
152
  $cacheTime = $instance['cacheTime'];
153
+ $consumerKey = trim($instance['consumerKey']);
154
  $consumerSecret = trim($instance['consumerSecret']);
155
  $accessToken = trim($instance['accessToken']);
156
  $accessTokenSecret = trim($instance['accessTokenSecret']);
166
  $twitterIntentsText = $instance['twitterIntentsText'];
167
  $intentColor = $instance['intentColor'];
168
  $showAvatar = $instance['showAvatar'];
169
+ $roundCorners = $instance['roundCorners'];
170
+ $avatarSize = $instance['avatarSize'];
171
  ?>
172
 
173
  <?php
174
  // Show error if cURL not installed - extension required for Twitter API calls
175
  if (!in_array('curl', get_loaded_extensions())) {
176
+ echo '<p style="background-color:pink;padding:10px;border:1px solid red;"><strong>';
177
+ _e('You do not have cURL installed! This is a required PHP extension to use the Twitter API:', 'simple-twitter-tweets');
178
+ echo ' <a href="http://curl.haxx.se/docs/install.html" taget="_blank">';
179
+ _e('cURL install', 'simple-twitter-tweets');
180
+ echo '</a></strong></p>';
181
  }
182
  ?>
183
 
184
  <p>
185
+ <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'simple-twitter-tweets') ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label>
186
  </p>
187
  <p>
188
+ <label for="<?php echo $this->get_field_id('name'); ?>"><?php _e('Twitter Name (without @ symbol):', 'simple-twitter-tweets') ?> <input class="widefat" id="<?php echo $this->get_field_id('name'); ?>" name="<?php echo $this->get_field_name('name'); ?>" type="text" value="<?php echo esc_attr($name); ?>" /></label>
189
  </p>
190
  <p>
191
+ <label for="<?php echo $this->get_field_id('numTweets'); ?>"><?php _e('Number of Tweets:', 'simple-twitter-tweets') ?> <input class="widefat" id="<?php echo $this->get_field_id('numTweets'); ?>" name="<?php echo $this->get_field_name('numTweets'); ?>" type="text" value="<?php echo esc_attr($numTweets); ?>" /></label>
192
  </p>
193
  <p>
194
+ <label for="<?php echo $this->get_field_id('cacheTime'); ?>"><?php _e('Time in Minutes between updates:', 'simple-twitter-tweets') ?> <input class="widefat" id="<?php echo $this->get_field_id('cacheTime'); ?>" name="<?php echo $this->get_field_name('cacheTime'); ?>" type="text" value="<?php echo esc_attr($cacheTime); ?>" /></label>
195
  </p>
196
 
197
  <?php // NEW FOR 2.0 ?>
198
  <?php // Time display options ?>
199
  <div class="secrets" style="background:#d6eef9; margin-bottom:10px;">
200
+ <h4 class="button-secondary" style="width:100%; text-align:center;"><?php _e('Twitter API settings', 'simple-twitter-tweets') ?> <span style="font-size:75%;">&#9660;</span></h4>
201
  <div style="padding:10px;">
202
  <p>
203
+ <label for="<?php echo $this->get_field_id('consumerKey'); ?>"><?php _e('Consumer Key:', 'simple-twitter-tweets') ?> <input class="widefat" id="<?php echo $this->get_field_id('consumerKey'); ?>" name="<?php echo $this->get_field_name('consumerKey'); ?>" type="text" value="<?php echo esc_attr($consumerKey); ?>" /></label>
204
  </p>
205
  <p>
206
+ <label for="<?php echo $this->get_field_id('consumerSecret'); ?>"><?php _e('Consumer Secret:', 'simple-twitter-tweets') ?> <input class="widefat" id="<?php echo $this->get_field_id('consumerSecret'); ?>" name="<?php echo $this->get_field_name('consumerSecret'); ?>" type="text" value="<?php echo esc_attr($consumerSecret); ?>" /></label>
207
  </p>
208
  <p>
209
+ <label for="<?php echo $this->get_field_id('accessToken'); ?>"><?php _e('Access Token:', 'simple-twitter-tweets') ?> <input class="widefat" id="<?php echo $this->get_field_id('accessToken'); ?>" name="<?php echo $this->get_field_name('accessToken'); ?>" type="text" value="<?php echo esc_attr($accessToken); ?>" /></label>
210
  </p>
211
  <p>
212
+ <label for="<?php echo $this->get_field_id('accessTokenSecret'); ?>"><?php _e('Access Token Secret:', 'simple-twitter-tweets') ?> <input class="widefat" id="<?php echo $this->get_field_id('accessTokenSecret'); ?>" name="<?php echo $this->get_field_name('accessTokenSecret'); ?>" type="text" value="<?php echo esc_attr($accessTokenSecret); ?>" /></label>
213
  </p>
214
  <p>
215
  <input class="checkbox" type="checkbox" <?php checked( isset( $instance['exclude_replies']), true ); ?> id="<?php echo $this->get_field_id( 'exclude_replies' ); ?>" name="<?php echo $this->get_field_name( 'exclude_replies' ); ?>" />
216
+ <label for="<?php echo $this->get_field_id( 'exclude_replies' ); ?>"><?php _e('Exclude_@replies', 'simple-twitter-tweets'); ?></label>
217
  </p>
218
  </div>
219
  </div>
221
  <?php // NEW FOR 2.0 ?>
222
  <?php // Avatar display options ?>
223
  <div class="avatar" style="background:#d6eef9; margin-bottom:10px;">
224
+ <h4 class="button-secondary" style="width:100%; text-align:center;"><?php _e('Twitter Avatar settings', 'simple-twitter-tweets'); ?> <span style="font-size:75%;">&#9660;</span></h4>
225
  <div style="padding:10px;">
226
+ <p><?php _e('Display your Twitter Avatar: image', 'simple-twitter-tweets'); ?></p>
227
  <p>
228
  <input class="checkbox" type="checkbox" value="true" <?php checked( ( isset( $instance['showAvatar']) && ($instance['showAvatar'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'showAvatar' ); ?>" name="<?php echo $this->get_field_name( 'showAvatar' ); ?>" />
229
+ <label for="<?php echo $this->get_field_id( 'showAvatar' ); ?>"><?php _e('Show your avatar image', 'simple-twitter-tweets'); ?></label>
230
  </p>
231
  <p>
232
  <input class="checkbox" type="checkbox" value="true" <?php checked( ( isset( $instance['roundCorners']) && ($instance['showAvatar'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'roundCorners' ); ?>" name="<?php echo $this->get_field_name( 'roundCorners' ); ?>" />
233
+ <label for="<?php echo $this->get_field_id( 'roundCorners' ); ?>"><?php _e('Round avatar corners (5px)', 'simple-twitter-tweets'); ?></label>
234
  </p>
235
  <p>
236
+ <label for="<?php echo $this->get_field_id('avatarSize'); ?>"><?php _e('Size of Avatar (default: 48):', 'simple-twitter-tweets'); ?> <input class="widefat" id="<?php echo $this->get_field_id('avatarSize'); ?>" name="<?php echo $this->get_field_name('avatarSize'); ?>" type="text" value="<?php echo esc_attr($avatarSize); ?>" /><br><em><?php _e('input number only', 'simple-twitter-tweets'); ?></em></label>
237
  </p>
238
  </div>
239
  </div>
241
  <?php // NEW FOR 2.0 ?>
242
  <?php // Time display options ?>
243
  <div class="modTime" style="background:#d6eef9; margin-bottom:10px;">
244
+ <h4 class="button-secondary" style="width:100%; text-align:center;"><?php _e('Time Display Options', 'simple-twitter-tweets'); ?> <span style="font-size:75%;">&#9660;</span></h4>
245
  <div style="padding:10px;">
246
  <p>
247
  <input class="checkbox" type="checkbox" value="true" <?php checked( (isset( $instance['timeRef']) && ($instance['timeRef'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'timeRef' ); ?>" name="<?php echo $this->get_field_name( 'timeRef' ); ?>" />
248
+ <label for="<?php echo $this->get_field_id( 'timeRef' ); ?>"><?php _e('Change to short time reference <br><em>h for Hour(s), d for Day(s) ... <strong>Twitter style</strong></em>', 'simple-twitter-tweets'); ?></label>
249
  </p>
250
  <p>
251
  <input class="checkbox" type="checkbox" value="true" <?php checked( (isset( $instance['timeAgo']) && ($instance['timeAgo'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'timeAgo' ); ?>" name="<?php echo $this->get_field_name( 'timeAgo' ); ?>" value="true" />
252
+ <label for="<?php echo $this->get_field_id( 'timeAgo' ); ?>"><?php _e('Show "ago" after the time', 'simple-twitter-tweets'); ?></label>
253
  </p>
254
  </div>
255
  </div>
257
  <?php // NEW FOR 2.0 ?>
258
  <?php // Twitter Intents and Display Options ?>
259
  <div class="twitterIntents" style="background:#d6eef9; margin-bottom:10px;">
260
+ <h4 class="button-secondary" style="width:100%; text-align:center;"><?php _e('Twitter Intents', 'simple-twitter-tweets'); ?> <span style="font-size:75%;">&#9660;</span></h4>
261
  <div style="padding:10px;">
262
  <p>
263
  <input class="checkbox" type="checkbox" value="true" <?php checked( (isset( $instance['twitterIntents']) && ($instance['twitterIntents'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'twitterIntents' ); ?>" name="<?php echo $this->get_field_name( 'twitterIntents' ); ?>" />
264
+ <label for="<?php echo $this->get_field_id( 'twitterIntents' ); ?>"><?php _e('Show Twitter Intents', 'simple-twitter-tweets'); ?></label>
265
  </p>
266
  <p>
267
  <input class="checkbox" type="checkbox" value="true" <?php checked( (isset( $instance['twitterIntentsText']) && ($instance['twitterIntentsText'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'twitterIntentsText' ); ?>" name="<?php echo $this->get_field_name( 'twitterIntentsText' ); ?>" />
268
+ <label for="<?php echo $this->get_field_id( 'twitterIntentsText' ); ?>"><?php _e('Hide Twitter Intents Text <br><em>e.g. just use icons</em>', 'simple-twitter-tweets'); ?></label>
269
  </p>
270
  <p>
271
+ <label for="<?php echo $this->get_field_id('intentColor'); ?>"><?php _e('Intent icons colour:', 'simple-twitter-tweets'); ?> <input class="intentColor" id="<?php echo $this->get_field_id('intentColor'); ?>" name="<?php echo $this->get_field_name('intentColor'); ?>" type="text" value="<?php echo esc_attr($intentColor); ?>" /></label>
272
  <div id="colorpicker"></div>
273
  </p>
274
  </div>
275
  </div>
276
 
277
  <div class="twitterFollow" style="background:#d6eef9;">
278
+ <h4 class="button-secondary" style="width:100%; text-align:center;"><?php _e('Twitter Follow Button', 'simple-twitter-tweets'); ?> <span style="font-size:75%;">&#9660;</span></h4>
279
  <div style="padding:10px;">
280
  <p>
281
  <input class="checkbox" type="checkbox" <?php checked( (isset( $instance['twitterFollow']) && ($instance['twitterFollow'] == "on") ), true ); ?> id="<?php echo $this->get_field_id( 'twitterFollow' ); ?>" name="<?php echo $this->get_field_name( 'twitterFollow' ); ?>" />
282
+ <label for="<?php echo $this->get_field_id( 'twitterFollow' ); ?>"><?php _e('Show Twitter Follow Button', 'simple-twitter-tweets'); ?></label>
283
  </p>
284
  <p>
285
  <input class="checkbox" type="checkbox" <?php checked( (isset( $instance['dataShowScreenName']) && ($instance['dataShowScreenName'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'dataShowScreenName' ); ?>" name="<?php echo $this->get_field_name( 'dataShowScreenName' ); ?>" value="true" />
286
+ <label for="<?php echo $this->get_field_id( 'dataShowScreenName' ); ?>"><?php _e('Show Twitter Screen Name', 'simple-twitter-tweets'); ?></label>
287
  </p>
288
  <p>
289
  <input class="checkbox" type="checkbox" <?php checked( (isset( $instance['dataShowCount']) && ($instance['dataShowCount'] == "true") ), true ); ?> id="<?php echo $this->get_field_id( 'dataShowCount' ); ?>" name="<?php echo $this->get_field_name( 'dataShowCount' ); ?>" value="true" />
290
+ <label for="<?php echo $this->get_field_id( 'dataShowCount' ); ?>"><?php _e('Show Twitter Followers Count', 'simple-twitter-tweets'); ?></label>
291
  </p>
292
  <p>
293
+ <label for="<?php echo $this->get_field_id('dataLang'); ?>"><?php _e('Language:', 'simple-twitter-tweets'); ?> <input class="widefat" id="<?php echo $this->get_field_id('dataLang'); ?>" name="<?php echo $this->get_field_name('dataLang'); ?>" type="text" value="<?php echo esc_attr($dataLang); ?>" /></label>
294
  </p>
295
  </div>
296
  </div>
304
  $instance['title'] = strip_tags( $new_instance['title'] );
305
  $instance['name'] = strip_tags( $new_instance['name'] );
306
  $instance['numTweets'] = $new_instance['numTweets'];
307
+ $instance['cacheTime'] = $new_instance['cacheTime'];
308
  $instance['consumerKey'] = trim($new_instance['consumerKey']);
309
  $instance['consumerSecret'] = trim($new_instance['consumerSecret']);
310
  $instance['accessToken'] = trim($new_instance['accessToken']);
311
+ $instance['accessTokenSecret'] = trim($new_instance['accessTokenSecret']);
312
+ $instance['exclude_replies'] = $new_instance['exclude_replies'];
313
  $instance['twitterFollow'] = $new_instance['twitterFollow'];
314
  $instance['dataShowCount'] = $new_instance['dataShowCount'];
315
  $instance['dataShowScreenName'] = $new_instance['dataShowScreenName'];
319
  $instance['timeAgo'] = $new_instance['timeAgo'];
320
  $instance['twitterIntents'] = $new_instance['twitterIntents'];
321
  $instance['twitterIntentsText'] = $new_instance['twitterIntentsText'];
322
+ $instance['intentColor'] = strip_tags( $new_instance['intentColor'] );
323
  $instance['showAvatar'] = $new_instance['showAvatar'];
324
  $instance['roundCorners'] = $new_instance['roundCorners'];
325
  $instance['avatarSize'] = strip_tags( $new_instance['avatarSize'] );
337
  $PI_title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
338
  $PI_name = $instance['name'];
339
  $PI_numTweets = $instance['numTweets'];
340
+ $PI_cacheTime = $instance['cacheTime'];
341
 
342
  //Setup Twitter API OAuth tokens
343
  $PI_consumerKey = trim($instance['consumerKey']);
357
  $PI_timeAgo = isset( $instance['timeAgo'] ) ? $instance['timeAgo'] : false;
358
  $PI_twitterIntents = isset( $instance['twitterIntents'] ) ? $instance['twitterIntents'] : false;
359
  $PI_twitterIntentsText = isset( $instance['twitterIntentsText'] ) ? $instance['twitterIntentsText'] : false;
360
+ $PI_intentColor = $instance['intentColor'];
361
 
362
  // Avatar
363
  $PI_showAvatar = isset( $instance['showAvatar'] ) ? $instance['showAvatar'] : false;
389
 
390
  // Get from https://dev.twitter.com/
391
  // Login - Create New Application, fill in details and use required data below
392
+ $consumerKey = trim($PI_consumerKey); // OAuth Key
393
  $consumerSecret = trim($PI_consumerSecret); // OAuth Secret
394
  $accessToken = trim($PI_accessToken); // OAuth Access Token
395
  $accessTokenSecret = trim($PI_accessTokenSecret); // OAuth Token Secret
404
  $timeRef = $PI_timeRef; // Time ref: hours or short h
405
  $timeAgo = $PI_timeAgo; // Human Time: ago ref or not
406
  $twitterIntents = $PI_twitterIntents; // Intent on/off
407
+ $twitterIntentsText = $PI_twitterIntentsText; // Intents Text on/off
408
  $intentColor = $PI_intentColor; // Intent icons colour
409
 
410
  $showAvatar = $PI_showAvatar;
411
+ $roundCorners = $PI_roundCorners;
412
+ $avatarSize = $PI_avatarSize;
413
 
414
  // COMMUNITY REQUEST! (1)
415
  $transName = 'list-tweets-'.$name; // Name of value in database. [added $name for multiple account use]
505
  endif;
506
  endif;
507
 
508
+ if(!function_exists('twitter_time_diff'))
509
+ {
510
+ function twitter_time_diff( $from, $to = '' ) {
511
+ $diff = human_time_diff($from,$to);
512
+ $replace = array(
513
+ ' hour' => 'h',
514
+ ' hours' => 'h',
515
+ ' day' => 'd',
516
+ ' days' => 'd',
517
+ ' minute' => 'm',
518
+ ' minutes' => 'm',
519
+ ' second' => 's',
520
+ ' seconds' => 's',
521
+ );
522
+ return strtr($diff,$replace);
523
+ }
524
  }
 
525
  // Now display the tweets, if we can.
526
  if($tweets) : ?>
527
  <?php foreach( (array) $tweets as $t) : // casting array to array just in case it's empty - then prevents PHP warning ?>
531
  echo '<img ';
532
  echo ($avatarSize) ? ' style="margin-left:-'.($avatarSize+5).'px"':"";
533
  echo ($avatarSize) ? 'width="'.$avatarSize.'px" height="'.$avatarSize.'px"' : 'width="48px" height="48px"';
534
+ echo 'src="'.$t['image'].'" alt="';
535
+ _e('Tweet Avatar', 'simple-twitter-tweets');
536
+ echo '" class="';
537
  echo ($roundCorners) ? 'a-corn':'';
538
  echo '"/>';
539
  }
541
  <?php echo $t['text']; ?>
542
  <br/><em>
543
  <?php if(!isset($screen_name)){ $screen_name = $name; }?>
544
+ <a href="http://www.twitter.com/<?php echo $screen_name; ?>" target="_blank" title="<?php
545
+ printf(
546
+ /* translators: %s: Twitter user name to follow */
547
+ __( 'Follow %s on Twitter [Opens a new window]', 'simple-twitter-tweets' ),
548
+ $name
549
+ ); ?>">
550
  <?php
551
 
552
  // Original - long time ref: hours...
558
  }
559
  // Ago - to show?
560
  if($timeAgo == "true"){
561
+ $displayAgo = _x(' ago', 'leading space is required to keep gap from date', 'simple-twitter-tweets');
562
  }else{
563
  // Added to counter 'no ago var' setting undefined variable warning
564
  $displayAgo = "";
574
  if($twitterIntents == "true"){
575
  ?>
576
  <div class="intent-meta">
577
+ <a href="http://twitter.com/intent/tweet?in_reply_to=<?php echo $t['tweet_id']; ?>" data-lang="en" class="in-reply-to" title="<?php _e('Reply','simple-twitter-tweets'); ?>" target="_blank">
578
  <span aria-hidden="true" data-icon="&#xf079;" <?php echo ($intentColor) ? 'style="color:'.$intentColor.';"' :''; ?>></span>
579
+ <span <?php echo ($twitterIntentsText) ? 'class="pi-visuallyhidden"':''; ?>><?php _e('Reply','simple-twitter-tweets'); ?></span></a>
580
+ <a href="http://twitter.com/intent/retweet?tweet_id=<?php echo $t['tweet_id']; ?>" data-lang="en" class="retweet" title="<?php _e('Retweet','simple-twitter-tweets'); ?>" target="_blank">
581
  <span aria-hidden="true" data-icon="&#xf112;" <?php echo ($intentColor) ? 'style="color:'.$intentColor.';"' :''; ?>></span>
582
+ <span <?php echo ($twitterIntentsText) ? 'class="pi-visuallyhidden"':''; ?>><?php _e('Retweet','simple-twitter-tweets'); ?></span></a>
583
+ <a href="http://twitter.com/intent/favorite?tweet_id=<?php echo $t['tweet_id']; ?>" data-lang="en" class="favorite" title="<?php _e('Favourite','simple-twitter-tweets'); ?>" target="_blank">
584
  <span aria-hidden="true" data-icon="&#xf005;" <?php echo ($intentColor) ? 'style="color:'.$intentColor.';"' :''; ?>></span>
585
+ <span <?php echo ($twitterIntentsText) ? 'class="pi-visuallyhidden"':''; ?>><?php _e('Favourite','simple-twitter-tweets'); ?></span></a>
586
  </div>
587
  <?php } ?>
588
 
590
  <?php endforeach; ?>
591
 
592
  <?php else : ?>
593
+ <li><?php _e('Waiting for Twitter... Once Twitter is ready they will display my Tweets again.','simple-twitter-tweets'); ?></li>
594
  <?php endif; ?>
595
  </ul>
596
 
598
  // ADD Twitter follow button - to increase engagement
599
  // Make it an options choice though
600
  if($twitterFollow){ ?>
601
+ <a href="https://twitter.com/<?php echo $PI_name; ?>" class="twitter-follow-button" data-show-count="<?php echo $dataShowCount; ?>" data-show-screen-name="<?php echo $dataShowScreenName; ?>" data-lang="<?php echo $dataLang; ?>"><?php _e('Follow','simple-twitter-tweets'); ?> @<?php echo $PI_name; ?></a>
602
  <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
603
  <?php
604
  }