Custom Twitter Feeds - Version 1.2.9

Version Description

  • Fix: Fixed a PHP warning which appeared under rare circumstances
  • Fix: AJAX load more not working when AJAX themes being used
Download this release

Release Info

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

Code changes from version 1.2.8 to 1.2.9

README.txt CHANGED
@@ -5,7 +5,7 @@ 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.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -237,6 +237,10 @@ Not many developers love providing support, but we're a rare breed here at Smash
237
  7. To display a feed just copy and paste the shortcode into a widget or page
238
 
239
  == Changelog ==
 
 
 
 
240
  = 1.2.8 =
241
  * Fix: "Preserve settings on uninstall" setting not working correctly
242
  * Fix: Clear cache button would not clear all caches in some situations
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.9
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
237
  7. To display a feed just copy and paste the shortcode into a widget or page
238
 
239
  == Changelog ==
240
+ = 1.2.9 =
241
+ * Fix: Fixed a PHP warning which appeared under rare circumstances
242
+ * Fix: AJAX load more not working when AJAX themes being used
243
+
244
  = 1.2.8 =
245
  * Fix: "Preserve settings on uninstall" setting not working correctly
246
  * Fix: Clear cache button would not clear all caches in some situations
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.8
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.8' );
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=' );
@@ -329,13 +329,25 @@ register_deactivation_hook( __FILE__, 'ctf_deactivate' );
329
  * Loads the javascript for the plugin front-end. Also localizes the admin-ajax file location for use in ajax calls
330
  */
331
  function ctf_scripts_and_styles() {
332
- wp_enqueue_style( 'ctf_styles', plugins_url( '/css/ctf-styles.css', __FILE__ ), array(), CTF_VERSION );
 
 
 
333
  wp_enqueue_script( 'ctf_twitter_intents', 'https://platform.twitter.com/widgets.js' );
334
- wp_enqueue_script( 'ctf_scripts', plugins_url( '/js/ctf-scripts.js', __FILE__ ), array( 'jquery' ), CTF_VERSION, true );
335
- wp_localize_script( 'ctf_scripts', 'ctf', array(
336
- 'ajax_url' => admin_url( 'admin-ajax.php' )
337
- )
338
- );
 
 
 
 
 
 
 
 
 
339
  }
340
  add_action( 'wp_enqueue_scripts', 'ctf_scripts_and_styles' );
341
 
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.9
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.9' );
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=' );
329
  * Loads the javascript for the plugin front-end. Also localizes the admin-ajax file location for use in ajax calls
330
  */
331
  function ctf_scripts_and_styles() {
332
+ $options = get_option( 'ctf_options' );
333
+ $not_ajax_theme = (! isset( $options['ajax_theme'] ) || ! $options['ajax_theme']);
334
+
335
+ wp_enqueue_style( 'ctf_styles', plugins_url( '/css/ctf-styles.css', __FILE__ ), array(), CTF_VERSION );
336
  wp_enqueue_script( 'ctf_twitter_intents', 'https://platform.twitter.com/widgets.js' );
337
+
338
+ if ( $not_ajax_theme ) {
339
+ wp_enqueue_script( 'ctf_scripts', plugins_url( '/js/ctf-scripts.js', __FILE__ ), array( 'jquery' ), CTF_VERSION, true );
340
+ wp_localize_script( 'ctf_scripts', 'ctf', array(
341
+ 'ajax_url' => admin_url( 'admin-ajax.php' )
342
+ )
343
+ );
344
+ } else {
345
+ wp_localize_script( 'jquery', 'ctf', array(
346
+ 'ajax_url' => admin_url( 'admin-ajax.php' )
347
+ )
348
+ );
349
+ }
350
+
351
  }
352
  add_action( 'wp_enqueue_scripts', 'ctf_scripts_and_styles' );
353
 
inc/CtfFeed.php CHANGED
@@ -155,12 +155,12 @@ class CtfFeed
155
  );
156
  $this->setStandardTextOptions( $standard_text, '' );
157
 
158
- $this->setStandardTextOptions( 'retweetedtext', 'Retweeted' );
159
 
160
  $this->setStandardTextOptions( 'multiplier', 1.25 );
161
  $this->setStandardTextOptions( 'twitterlinktext', 'Twitter' );
162
 
163
- $this->setStandardTextOptions( 'buttontext', 'Load More...' );
164
 
165
  $text_size = array(
166
  'authortextsize',
@@ -292,10 +292,10 @@ class CtfFeed
292
  {
293
  if ( is_array( $options ) ) {
294
  foreach ( $options as $option ) {
295
- $this->feed_options[$option] = isset( $this->atts[$option] ) ? esc_attr( $this->atts[$option] ) : ( isset( $this->db_options[$option] ) ? esc_attr( $this->db_options[$option] ) : $default );
296
  }
297
  } else {
298
- $this->feed_options[$options] = isset( $this->atts[$options] ) ? esc_attr( $this->atts[$options] ) : ( isset( $this->db_options[$options] ) ? esc_attr( $this->db_options[$options] ) : $default );
299
  }
300
  }
301
 
@@ -942,7 +942,7 @@ class CtfFeed
942
  {
943
  $json_data = '{';
944
  $i = 0;
945
- $len = count( $this->atts );
946
 
947
  if ( ! empty( $this->atts ) ) {
948
  foreach ( $this->atts as $key => $value) {
@@ -1071,9 +1071,9 @@ class CtfFeed
1071
  $html = '';
1072
 
1073
  $html .= '<div class="ctf-out-of-tweets">';
1074
- $html .= '<p>That\'s all! No more Tweets to load</p>';
1075
  $html .= '<p>';
1076
- $html .= '<a class="twitter-share-button" href="https://twitter.com/share" target="_blank" data-size="large" data-url="<?php echo get_home_url(); ?>">Share</a>';
1077
  if ( !empty( $feed_options['screenname'] ) ) {
1078
  $html .= '<a class="twitter-follow-button" href="https://twitter.com/' . $feed_options['screenname'] . '" target="_blank" data-show-count="false" data-size="large" data-dnt="true">Follow</a>';
1079
  }
@@ -1332,7 +1332,7 @@ class CtfFeed
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" aria-hidden="true"></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
  }
@@ -1405,13 +1405,13 @@ class CtfFeed
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" aria-hidden="true"></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" aria-hidden="true"></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" aria-hidden="true"></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
  }
155
  );
156
  $this->setStandardTextOptions( $standard_text, '' );
157
 
158
+ $this->setStandardTextOptions( 'retweetedtext', __( 'Retweeted', 'custom-twitter-feeds' ) );
159
 
160
  $this->setStandardTextOptions( 'multiplier', 1.25 );
161
  $this->setStandardTextOptions( 'twitterlinktext', 'Twitter' );
162
 
163
+ $this->setStandardTextOptions( 'buttontext', __( 'Load More...', 'custom-twitter-feeds' ) );
164
 
165
  $text_size = array(
166
  'authortextsize',
292
  {
293
  if ( is_array( $options ) ) {
294
  foreach ( $options as $option ) {
295
+ $this->feed_options[$option] = isset( $this->atts[$option] ) ? esc_attr( __( $this->atts[$option], 'custom-twitter-feeds' ) ) : ( isset( $this->db_options[$option] ) ? esc_attr( $this->db_options[$option] ) : $default );
296
  }
297
  } else {
298
+ $this->feed_options[$options] = isset( $this->atts[$options] ) ? esc_attr( __( $this->atts[$options], 'custom-twitter-feeds' ) ) : ( isset( $this->db_options[$options] ) ? esc_attr( $this->db_options[$options] ) : $default );
299
  }
300
  }
301
 
942
  {
943
  $json_data = '{';
944
  $i = 0;
945
+ $len = is_array( $this->atts ) ? count( $this->atts ) : 0;
946
 
947
  if ( ! empty( $this->atts ) ) {
948
  foreach ( $this->atts as $key => $value) {
1071
  $html = '';
1072
 
1073
  $html .= '<div class="ctf-out-of-tweets">';
1074
+ $html .= '<p>' . __( "That's all! No more Tweets to load", 'custom-twitter-feeds' ) . '</p>';
1075
  $html .= '<p>';
1076
+ $html .= '<a class="twitter-share-button" href="https://twitter.com/share" target="_blank" data-size="large" data-url="'.get_home_url().'">Share</a>';
1077
  if ( !empty( $feed_options['screenname'] ) ) {
1078
  $html .= '<a class="twitter-follow-button" href="https://twitter.com/' . $feed_options['screenname'] . '" target="_blank" data-show-count="false" data-size="large" data-dnt="true">Follow</a>';
1079
  }
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" aria-hidden="true"></i><span class="ctf-screenreader">'.__( 'Retweet on Twitter', 'custom-twitter-feeds' ).'</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
  }
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" aria-hidden="true"></i><span class="ctf-screenreader">'.__( 'Reply on Twitter', 'custom-twitter-feeds' ).'</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" aria-hidden="true"></i><span class="ctf-screenreader">'.__( 'Retweet on Twitter', 'custom-twitter-feeds' ).'</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" aria-hidden="true"></i><span class="ctf-screenreader">'.__( 'Like on Twitter', 'custom-twitter-feeds' ).'</span><span class="ctf-action-count ctf-favorite-count">';
1415
  if ( $post['favorite_count'] > 0 ) {
1416
  $tweet_html .= $post['favorite_count'];
1417
  }
views/admin/display.php CHANGED
@@ -43,7 +43,7 @@
43
  <!-- <tr class="ctf_pro">
44
  <td>type</td>
45
  <td><?php _e( "Display tweets from multiple user accounts/Twitter handles<br />Display tweets from multiple hashtags/search terms<br />Display tweets that \"@\" mention your account", 'custom-twitter-feeds' ); ?></td>
46
- <td><code>[custom-twitter-feeds screenname="gopro, NBA"]</code><br /><code>[custom-twitter-feeds search="#awesome+@nba"]</code><br/><code>[custom-twitter-feeds mentions=true]</code></td>
47
  </tr>
48
  <tr class="ctf_pro">
49
  <td>user</td>
43
  <!-- <tr class="ctf_pro">
44
  <td>type</td>
45
  <td><?php _e( "Display tweets from multiple user accounts/Twitter handles<br />Display tweets from multiple hashtags/search terms<br />Display tweets that \"@\" mention your account", 'custom-twitter-feeds' ); ?></td>
46
+ <td><code>[custom-twitter-feeds screenname="gopro, NBA"]</code><br /><code>[custom-twitter-feeds search="#awesome OR @nba"]</code><br/><code>[custom-twitter-feeds mentions=true]</code></td>
47
  </tr>
48
  <tr class="ctf_pro">
49
  <td>user</td>