Custom Twitter Feeds - Version 1.2.7

Version Description

  • New: Added screen reader labels for improved accessibility
  • Fix: Bug with "persistent" cache duplicating tweets
Download this release

Release Info

Developer smashballoon
Plugin Icon 128x128 Custom Twitter Feeds
Version 1.2.7
Comparing to
See all releases

Code changes from version 1.2.6 to 1.2.7

Files changed (4) hide show
  1. README.txt +6 -2
  2. css/ctf-styles.css +11 -0
  3. custom-twitter-feed.php +2 -2
  4. inc/CtfFeed.php +38 -33
README.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: smashballoon, craig-at-smash-balloon
4
  Support Website: http://smashballoon/custom-twitter-feeds/
5
  Tags: Twitter, Twitter feed, Tweets, Twitter widget, Custom Twitter Feed
6
  Requires at least: 3.0
7
- Tested up to: 4.8
8
- Stable tag: 1.2.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -221,6 +221,10 @@ If you're still having trouble displaying your Tweets after trying the common is
221
  2. Custom Twitter Feeds plugin Settings pages
222
 
223
  == Changelog ==
 
 
 
 
224
  = 1.2.6 =
225
  * Fix: Hashtag feeds now work for hashtags beginning with a number e.g. #1august
226
  * Fix: Added a workaround for a minor formatting issue caused by some themes
4
  Support Website: http://smashballoon/custom-twitter-feeds/
5
  Tags: Twitter, Twitter feed, Tweets, Twitter widget, Custom Twitter Feed
6
  Requires at least: 3.0
7
+ Tested up to: 4.9
8
+ Stable tag: 1.2.7
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
221
  2. Custom Twitter Feeds plugin Settings pages
222
 
223
  == Changelog ==
224
+ = 1.2.7 =
225
+ * New: Added screen reader labels for improved accessibility
226
+ * Fix: Bug with "persistent" cache duplicating tweets
227
+
228
  = 1.2.6 =
229
  * Fix: Hashtag feeds now work for hashtags beginning with a number e.g. #1august
230
  * Fix: Added a workaround for a minor formatting issue caused by some themes
css/ctf-styles.css CHANGED
@@ -195,6 +195,17 @@
195
  font-size: 13px;
196
  line-height: 1.3;
197
  }
 
 
 
 
 
 
 
 
 
 
 
198
  /* No bio */
199
  #ctf .ctf-header-text.sbi-no-info .ctf-header-user{
200
  padding-top: 9px !important;
195
  font-size: 13px;
196
  line-height: 1.3;
197
  }
198
+
199
+ /* screenreader */
200
+
201
+ .ctf-screenreader{
202
+ text-indent: -9999px !important;
203
+ display: inline-block !important;
204
+ width: 0 !important;
205
+ height: 0 !important;
206
+ line-height: 0 !important;
207
+ }
208
+
209
  /* No bio */
210
  #ctf .ctf-header-text.sbi-no-info .ctf-header-user{
211
  padding-top: 9px !important;
custom-twitter-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Custom Twitter Feeds
4
  Plugin URI: http://smashballoon.com/custom-twitter-feeds
5
  Description: Customizable Twitter feeds for your website
6
- Version: 1.2.6
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  Text Domain: custom-twitter-feeds
@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
  */
25
 
26
  define( 'CTF_URL', plugin_dir_path( __FILE__ ) );
27
- define( 'CTF_VERSION', '1.2.6' );
28
  define( 'CTF_TITLE', 'Custom Twitter Feeds' );
29
  define( 'CTF_JS_URL', plugins_url( '/js/ctf-scripts.js?ver=' . CTF_VERSION , __FILE__ ) );
30
  define( 'OAUTH_PROCESSOR_URL', 'https://smashballoon.com/ctf-at-retriever/?return_uri=' );
3
  Plugin Name: Custom Twitter Feeds
4
  Plugin URI: http://smashballoon.com/custom-twitter-feeds
5
  Description: Customizable Twitter feeds for your website
6
+ Version: 1.2.7
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  Text Domain: custom-twitter-feeds
24
  */
25
 
26
  define( 'CTF_URL', plugin_dir_path( __FILE__ ) );
27
+ define( 'CTF_VERSION', '1.2.7' );
28
  define( 'CTF_TITLE', 'Custom Twitter Feeds' );
29
  define( 'CTF_JS_URL', plugins_url( '/js/ctf-scripts.js?ver=' . CTF_VERSION , __FILE__ ) );
30
  define( 'OAUTH_PROCESSOR_URL', 'https://smashballoon.com/ctf-at-retriever/?return_uri=' );
inc/CtfFeed.php CHANGED
@@ -600,20 +600,21 @@ class CtfFeed
600
  return $existing_cache;
601
  }
602
  } else {
603
- $this->tweet_set = $this->reduceTweetSetData( $tweets, false );
604
  }
605
- $this->tweet_set = $this->appendPersistentCacheTweets( $existing_cache );
606
- $tweet_set = json_encode( $this->appendPersistentCacheTweets( $this->tweet_set ) );
607
 
608
- update_option( $cache_name, $tweet_set );
609
 
610
- return $this->tweet_set;
611
  // else if cached data doesn't exist
612
  } else {
613
  // make a request for last 200 tweets
614
  $api_obj = $this->apiConnectionResponse( 'search', $this->feed_options['feed_term'] );
615
  // cache them in a regular option
616
  $this->tweet_set = json_decode( $api_obj->json , $assoc = true );
 
617
  // check for errors/tweets present
618
  if ( isset( $this->tweet_set['errors'][0] ) ) {
619
  if ( empty( $this->api_obj ) ) {
@@ -636,7 +637,7 @@ class CtfFeed
636
 
637
  // create a new persistent cache
638
  if ( $this->tweet_set && isset( $this->tweet_set[0] ) ) {
639
- $tweet_set = json_encode( $this->appendPersistentCacheTweets( $this->tweet_set ) );
640
 
641
  update_option( $cache_name, $tweet_set );
642
 
@@ -1331,36 +1332,40 @@ class CtfFeed
1331
 
1332
  if ( isset( $retweeter ) && ctf_show( 'retweeter', $feed_options ) ) {
1333
  $tweet_html .= '<div class="ctf-context">';
1334
- $tweet_html .= '<a href="https://twitter.com/intent/user?screen_name=' . $retweeter['screen_name'] . '" target="_blank" class="ctf-retweet-icon"><i class="fa fa-retweet"></i></a>';
1335
  $tweet_html .= '<a href="https://twitter.com/' . $retweeter['screen_name'] . '" target="_blank" class="ctf-retweet-text" style="' . $feed_options['authortextsize'] . $feed_options['authortextweight'] . $feed_options['textcolor'] . '">' . $retweeter['name'] . ' ' . $feed_options['retweetedtext'] . '</a>';
1336
  $tweet_html .= '</div>';
1337
  }
1338
 
1339
- $tweet_html .= '<div class="ctf-author-box">';
1340
- $tweet_html .= '<div class="ctf-author-box-link" target="_blank" style="' . $feed_options['authortextsize'] . $feed_options['authortextweight'] . $feed_options['textcolor'] . '">';
1341
- if ( ctf_show( 'avatar', $feed_options ) ) {
1342
- $tweet_html .= '<a href="https://twitter.com/' . $post['user']['screen_name'] .'" class="ctf-author-avatar" target="_blank" style="' . $feed_options['authortextsize'] . $feed_options['authortextweight'] . $feed_options['textcolor'] . '">';
1343
- $tweet_html .= '<img src="' . $post['user']['profile_image_url_https'] . '" alt="' . $post['user']['screen_name'] . '" width="48" height="48">';
1344
- $tweet_html .= '</a>';
1345
- }
1346
 
1347
- if ( ctf_show( 'author', $feed_options ) ) {
1348
- $tweet_html .= '<a href="https://twitter.com/' . $post['user']['screen_name'] . '" target="_blank" class="ctf-author-name" style="' . $feed_options['authortextsize'] . $feed_options['authortextweight'] . $feed_options['textcolor'] . '">' . $post['user']['name'] . '</a>';
1349
- if ( $post['user']['verified'] == 1 ) {
1350
- $tweet_html .= '<span class="ctf-verified" ><i class="fa fa-check-circle" ></i ></span>';
1351
- }
1352
- $tweet_html .= '<a href="https://twitter.com/' . $post['user']['screen_name'] . '" class="ctf-author-screenname" target="_blank" style="' . $feed_options['authortextsize'] . $feed_options['authortextweight'] . $feed_options['textcolor'] . '">@' . $post['user']['screen_name'] . '</a>';
1353
- $tweet_html .= '<span class="ctf-screename-sep">&middot;</span>';
1354
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1355
 
1356
- if ( ctf_show( 'date', $feed_options ) ) {
1357
- $tweet_html .= '<div class="ctf-tweet-meta">';
1358
- //https://twitter.com/EnterLaw/status/869452491041243137
1359
- $tweet_html .= '<a href="https://twitter.com/' .$post['user']['screen_name'] . '/status/' . $post['id_str'] . '" class="ctf-tweet-date" target="_blank" style="' . $feed_options['datetextsize'] . $feed_options['datetextweight'] . $feed_options['textcolor'] . '">' . ctf_get_formatted_date( $post['created_at'] , $feed_options, $post['user']['utc_offset'] ) . '</a>';
1360
- $tweet_html .= '</div>';
1361
- } // show date
1362
- $tweet_html .= '</div>';
1363
- $tweet_html .= '</div>';
1364
 
1365
  if ( ctf_show( 'text', $feed_options ) ) {
1366
  $tweet_html .= '<div class="ctf-tweet-content">';
@@ -1400,13 +1405,13 @@ class CtfFeed
1400
 
1401
  $tweet_html .= '<div class="ctf-tweet-actions">';
1402
  if ( ctf_show( 'actions', $feed_options ) ) {
1403
- $tweet_html .= '<a href="https://twitter.com/intent/tweet?in_reply_to=' . $post['id_str'] . '&related=' . $post['user']['screen_name'] . '" class="ctf-reply" target="_blank" style="' . $feed_options['iconsize'] . $feed_options['iconcolor'] . '"><i class="fa fa-reply"></i></a>';
1404
- $tweet_html .= '<a href="https://twitter.com/intent/retweet?tweet_id=' . $post['id_str'] . '&related=' . $post['user']['screen_name'] . '" class="ctf-retweet" target="_blank" style="' . $feed_options['iconsize'] . $feed_options['iconcolor'] . '"><i class="fa fa-retweet"></i><span class="ctf-action-count ctf-retweet-count">';
1405
  if ( $post['retweet_count'] > 0 ) {
1406
  $tweet_html .= $post['retweet_count'];
1407
  }
1408
  $tweet_html .= '</span></a>';
1409
- $tweet_html .= '<a href="https://twitter.com/intent/like?tweet_id=' . $post['id_str'] . '&related=' . $post['user']['screen_name'] . '" class="ctf-like" target="_blank" style="' . $feed_options['iconsize'] . $feed_options['iconcolor'] . '"><i class="fa fa-heart"></i><span class="ctf-action-count ctf-favorite-count">';
1410
  if ( $post['favorite_count'] > 0 ) {
1411
  $tweet_html .= $post['favorite_count'];
1412
  }
600
  return $existing_cache;
601
  }
602
  } else {
603
+ $tweet_set = $this->reduceTweetSetData( $tweets, false );
604
  }
605
+ $tweet_set = $this->appendPersistentCacheTweets( $existing_cache, $tweet_set );
606
+ $cache_set = json_encode( $tweet_set );
607
 
608
+ update_option( $cache_name, $cache_set );
609
 
610
+ return $tweet_set;
611
  // else if cached data doesn't exist
612
  } else {
613
  // make a request for last 200 tweets
614
  $api_obj = $this->apiConnectionResponse( 'search', $this->feed_options['feed_term'] );
615
  // cache them in a regular option
616
  $this->tweet_set = json_decode( $api_obj->json , $assoc = true );
617
+ //var_dump($this->tweet_set);
618
  // check for errors/tweets present
619
  if ( isset( $this->tweet_set['errors'][0] ) ) {
620
  if ( empty( $this->api_obj ) ) {
637
 
638
  // create a new persistent cache
639
  if ( $this->tweet_set && isset( $this->tweet_set[0] ) ) {
640
+ $tweet_set = json_encode( $this->tweet_set );
641
 
642
  update_option( $cache_name, $tweet_set );
643
 
1332
 
1333
  if ( isset( $retweeter ) && ctf_show( 'retweeter', $feed_options ) ) {
1334
  $tweet_html .= '<div class="ctf-context">';
1335
+ $tweet_html .= '<a href="https://twitter.com/intent/user?screen_name=' . $retweeter['screen_name'] . '" target="_blank" class="ctf-retweet-icon"><i class="fa fa-retweet"></i><span class="ctf-screenreader">Retweet on Twitter</span></a>';
1336
  $tweet_html .= '<a href="https://twitter.com/' . $retweeter['screen_name'] . '" target="_blank" class="ctf-retweet-text" style="' . $feed_options['authortextsize'] . $feed_options['authortextweight'] . $feed_options['textcolor'] . '">' . $retweeter['name'] . ' ' . $feed_options['retweetedtext'] . '</a>';
1337
  $tweet_html .= '</div>';
1338
  }
1339
 
1340
+ if ( ctf_show( 'avatar', $feed_options ) || ctf_show( 'author', $feed_options ) || ctf_show( 'date', $feed_options ) ) {
 
 
 
 
 
 
1341
 
1342
+ $tweet_html .= '<div class="ctf-author-box">';
1343
+ $tweet_html .= '<div class="ctf-author-box-link" target="_blank" style="' . $feed_options['authortextsize'] . $feed_options['authortextweight'] . $feed_options['textcolor'] . '">';
1344
+ if ( ctf_show( 'avatar', $feed_options ) ) {
1345
+ $tweet_html .= '<a href="https://twitter.com/' . $post['user']['screen_name'] . '" class="ctf-author-avatar" target="_blank" style="' . $feed_options['authortextsize'] . $feed_options['authortextweight'] . $feed_options['textcolor'] . '">';
1346
+ $tweet_html .= '<img src="' . $post['user']['profile_image_url_https'] . '" alt="' . $post['user']['screen_name'] . '" width="48" height="48">';
1347
+ $tweet_html .= '</a>';
1348
+ }
1349
+
1350
+ if ( ctf_show( 'author', $feed_options ) ) {
1351
+ $tweet_html .= '<a href="https://twitter.com/' . $post['user']['screen_name'] . '" target="_blank" class="ctf-author-name" style="' . $feed_options['authortextsize'] . $feed_options['authortextweight'] . $feed_options['textcolor'] . '">' . $post['user']['name'] . '</a>';
1352
+ if ( $post['user']['verified'] == 1 ) {
1353
+ $tweet_html .= '<span class="ctf-verified" ><i class="fa fa-check-circle" ></i ></span>';
1354
+ }
1355
+ $tweet_html .= '<a href="https://twitter.com/' . $post['user']['screen_name'] . '" class="ctf-author-screenname" target="_blank" style="' . $feed_options['authortextsize'] . $feed_options['authortextweight'] . $feed_options['textcolor'] . '">@' . $post['user']['screen_name'] . '</a>';
1356
+ $tweet_html .= '<span class="ctf-screename-sep">&middot;</span>';
1357
+ }
1358
+
1359
+ if ( ctf_show( 'date', $feed_options ) ) {
1360
+ $tweet_html .= '<div class="ctf-tweet-meta">';
1361
+ //https://twitter.com/EnterLaw/status/869452491041243137
1362
+ $tweet_html .= '<a href="https://twitter.com/' . $post['user']['screen_name'] . '/status/' . $post['id_str'] . '" class="ctf-tweet-date" target="_blank" style="' . $feed_options['datetextsize'] . $feed_options['datetextweight'] . $feed_options['textcolor'] . '">' . ctf_get_formatted_date( $post['created_at'], $feed_options, $post['user']['utc_offset'] ) . '</a>';
1363
+ $tweet_html .= '</div>';
1364
+ } // show date
1365
+ $tweet_html .= '</div> <!-- end .ctf-author-box-link -->';
1366
+ $tweet_html .= '</div>';
1367
+ }
1368
 
 
 
 
 
 
 
 
 
1369
 
1370
  if ( ctf_show( 'text', $feed_options ) ) {
1371
  $tweet_html .= '<div class="ctf-tweet-content">';
1405
 
1406
  $tweet_html .= '<div class="ctf-tweet-actions">';
1407
  if ( ctf_show( 'actions', $feed_options ) ) {
1408
+ $tweet_html .= '<a href="https://twitter.com/intent/tweet?in_reply_to=' . $post['id_str'] . '&related=' . $post['user']['screen_name'] . '" class="ctf-reply" target="_blank" style="' . $feed_options['iconsize'] . $feed_options['iconcolor'] . '"><i class="fa fa-reply"></i><span class="ctf-screenreader">Reply on Twitter</span></a>';
1409
+ $tweet_html .= '<a href="https://twitter.com/intent/retweet?tweet_id=' . $post['id_str'] . '&related=' . $post['user']['screen_name'] . '" class="ctf-retweet" target="_blank" style="' . $feed_options['iconsize'] . $feed_options['iconcolor'] . '"><i class="fa fa-retweet"></i><span class="ctf-screenreader">Retweet on Twitter</span><span class="ctf-action-count ctf-retweet-count">';
1410
  if ( $post['retweet_count'] > 0 ) {
1411
  $tweet_html .= $post['retweet_count'];
1412
  }
1413
  $tweet_html .= '</span></a>';
1414
+ $tweet_html .= '<a href="https://twitter.com/intent/like?tweet_id=' . $post['id_str'] . '&related=' . $post['user']['screen_name'] . '" class="ctf-like" target="_blank" style="' . $feed_options['iconsize'] . $feed_options['iconcolor'] . '"><i class="fa fa-heart"></i><span class="ctf-screenreader">Like on Twitter</span><span class="ctf-action-count ctf-favorite-count">';
1415
  if ( $post['favorite_count'] > 0 ) {
1416
  $tweet_html .= $post['favorite_count'];
1417
  }