Version Description
- Fix: Prevented any duplicate Tweets from being shown
- Fix: Fixed a rare issue where a couple of settings weren't being saved successfully
Download this release
Release Info
Developer | smashballoon |
Plugin | Custom Twitter Feeds |
Version | 1.1.3 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.1.3
- README.txt +5 -1
- custom-twitter-feed.php +9 -8
- inc/CtfAdmin.php +15 -15
- inc/CtfFeed.php +52 -4
- js/ctf-scripts.js +15 -1
README.txt
CHANGED
@@ -5,7 +5,7 @@ Support Website: http://smashballoon/custom-twitter-feeds/
|
|
5 |
Tags: Twitter, Twitter feed, Custom Twitter Feed, Twitter feeds, Custom Twitter Feeds, Tweets, Custom Tweets, Tweets feed, Twitter widget, Custom Twitter widget, Twitter plugin, Twitter API, Twitter tweets
|
6 |
Requires at least: 3.0
|
7 |
Tested up to: 4.5.3
|
8 |
-
Stable tag: 1.1.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -146,6 +146,10 @@ If you're still having trouble displaying your Tweets after trying the common is
|
|
146 |
2. Custom Twitter Feeds plugin Settings pages
|
147 |
|
148 |
== Changelog ==
|
|
|
|
|
|
|
|
|
149 |
= 1.1.2 =
|
150 |
* New: Launched a [Pro version](http://smashballoon.com/custom-twitter-feeds/ 'Custom Twitter Feeds Pro') which includes some awesome additional features!
|
151 |
* Fix: Minor bug fixes
|
5 |
Tags: Twitter, Twitter feed, Custom Twitter Feed, Twitter feeds, Custom Twitter Feeds, Tweets, Custom Tweets, Tweets feed, Twitter widget, Custom Twitter widget, Twitter plugin, Twitter API, Twitter tweets
|
6 |
Requires at least: 3.0
|
7 |
Tested up to: 4.5.3
|
8 |
+
Stable tag: 1.1.3
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
146 |
2. Custom Twitter Feeds plugin Settings pages
|
147 |
|
148 |
== Changelog ==
|
149 |
+
= 1.1.3 =
|
150 |
+
* Fix: Prevented any duplicate Tweets from being shown
|
151 |
+
* Fix: Fixed a rare issue where a couple of settings weren't being saved successfully
|
152 |
+
|
153 |
= 1.1.2 =
|
154 |
* New: Launched a [Pro version](http://smashballoon.com/custom-twitter-feeds/ 'Custom Twitter Feeds Pro') which includes some awesome additional features!
|
155 |
* Fix: Minor bug fixes
|
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.1.
|
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.1.
|
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=' );
|
@@ -100,11 +100,12 @@ function ctf_get_more_posts() {
|
|
100 |
$shortcode_data = json_decode( str_replace( '\"', '"', sanitize_text_field( $_POST['shortcode_data'] ) ), true ); // necessary to unescape quotes
|
101 |
$last_id_data = isset( $_POST['last_id_data'] ) ? sanitize_text_field( $_POST['last_id_data'] ) : '';
|
102 |
$num_needed = isset( $_POST['num_needed'] ) ? (int)$_POST['num_needed'] : 0;
|
|
|
103 |
$is_pagination = empty( $last_id_data ) ? 0 : 1;
|
104 |
|
105 |
include_once( CTF_URL . '/inc/CtfFeed.php' );
|
106 |
|
107 |
-
$twitter_feed = CtfFeed::init( $shortcode_data, $last_id_data, $num_needed );
|
108 |
|
109 |
$twitter_feed->maybeCacheTweets();
|
110 |
|
@@ -145,7 +146,7 @@ function ctf_show( $part, $feed_options ) {
|
|
145 |
function ctf_get_formatted_date( $raw_date, $feed_options, $utc_offset ) {
|
146 |
include_once( CTF_URL . '/inc/CtfDateTime.php' );
|
147 |
|
148 |
-
$options = get_option( '
|
149 |
$timezone = isset( $options['timezone'] ) ? $options['timezone'] : 'default';
|
150 |
// use php DateTimeZone class to handle the date formatting and offsets
|
151 |
$date_obj = new CtfDateTime( $raw_date, new DateTimeZone( "UTC" ) );
|
@@ -219,11 +220,11 @@ function ctf_auto_save_tokens() {
|
|
219 |
if ( current_user_can( 'edit_posts' ) ) {
|
220 |
wp_verify_nonce( 'ctf-smash-balloon' );
|
221 |
|
222 |
-
$options = get_option( '
|
223 |
$options['access_token'] = sanitize_text_field( $_POST['access_token'] );
|
224 |
$options['access_token_secret'] = sanitize_text_field( $_POST['access_token_secret'] );
|
225 |
|
226 |
-
update_option( '
|
227 |
} else {
|
228 |
return false;
|
229 |
}
|
@@ -286,7 +287,7 @@ add_action( 'wp_enqueue_scripts', 'ctf_scripts_and_styles' );
|
|
286 |
* outputs the custom js from the "Customize" tab on the Settings page
|
287 |
*/
|
288 |
function ctf_custom_js() {
|
289 |
-
$options = get_option( '
|
290 |
$ctf_custom_js = isset( $options[ 'custom_js' ] ) ? $options[ 'custom_js' ] : '';
|
291 |
|
292 |
if ( ! empty( $ctf_custom_js ) ) {
|
@@ -304,7 +305,7 @@ add_action( 'wp_footer', 'ctf_custom_js' );
|
|
304 |
* outputs the custom css from the "Customize" tab on the Settings page
|
305 |
*/
|
306 |
function ctf_custom_css() {
|
307 |
-
$options = get_option( '
|
308 |
$ctf_custom_css = isset( $options[ 'custom_css' ] ) ? $options[ 'custom_css' ] : '';
|
309 |
|
310 |
if ( ! empty( $ctf_custom_css ) ) {
|
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.1.3
|
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.1.3' );
|
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=' );
|
100 |
$shortcode_data = json_decode( str_replace( '\"', '"', sanitize_text_field( $_POST['shortcode_data'] ) ), true ); // necessary to unescape quotes
|
101 |
$last_id_data = isset( $_POST['last_id_data'] ) ? sanitize_text_field( $_POST['last_id_data'] ) : '';
|
102 |
$num_needed = isset( $_POST['num_needed'] ) ? (int)$_POST['num_needed'] : 0;
|
103 |
+
$ids_to_remove = isset( $_POST['ids_to_remove'] ) ? $_POST['ids_to_remove'] : array();
|
104 |
$is_pagination = empty( $last_id_data ) ? 0 : 1;
|
105 |
|
106 |
include_once( CTF_URL . '/inc/CtfFeed.php' );
|
107 |
|
108 |
+
$twitter_feed = CtfFeed::init( $shortcode_data, $last_id_data, $num_needed, $ids_to_remove );
|
109 |
|
110 |
$twitter_feed->maybeCacheTweets();
|
111 |
|
146 |
function ctf_get_formatted_date( $raw_date, $feed_options, $utc_offset ) {
|
147 |
include_once( CTF_URL . '/inc/CtfDateTime.php' );
|
148 |
|
149 |
+
$options = get_option( 'ctf_options' );
|
150 |
$timezone = isset( $options['timezone'] ) ? $options['timezone'] : 'default';
|
151 |
// use php DateTimeZone class to handle the date formatting and offsets
|
152 |
$date_obj = new CtfDateTime( $raw_date, new DateTimeZone( "UTC" ) );
|
220 |
if ( current_user_can( 'edit_posts' ) ) {
|
221 |
wp_verify_nonce( 'ctf-smash-balloon' );
|
222 |
|
223 |
+
$options = get_option( 'ctf_options' );
|
224 |
$options['access_token'] = sanitize_text_field( $_POST['access_token'] );
|
225 |
$options['access_token_secret'] = sanitize_text_field( $_POST['access_token_secret'] );
|
226 |
|
227 |
+
update_option( 'ctf_options', $options );
|
228 |
} else {
|
229 |
return false;
|
230 |
}
|
287 |
* outputs the custom js from the "Customize" tab on the Settings page
|
288 |
*/
|
289 |
function ctf_custom_js() {
|
290 |
+
$options = get_option( 'ctf_options' );
|
291 |
$ctf_custom_js = isset( $options[ 'custom_js' ] ) ? $options[ 'custom_js' ] : '';
|
292 |
|
293 |
if ( ! empty( $ctf_custom_js ) ) {
|
305 |
* outputs the custom css from the "Customize" tab on the Settings page
|
306 |
*/
|
307 |
function ctf_custom_css() {
|
308 |
+
$options = get_option( 'ctf_options' );
|
309 |
$ctf_custom_css = isset( $options[ 'custom_css' ] ) ? $options[ 'custom_css' ] : '';
|
310 |
|
311 |
if ( ! empty( $ctf_custom_css ) ) {
|
inc/CtfAdmin.php
CHANGED
@@ -235,21 +235,6 @@ class CtfAdmin
|
|
235 |
'has_replies' => true
|
236 |
));
|
237 |
|
238 |
-
// Home Timeline Radio
|
239 |
-
$this->create_settings_field( array(
|
240 |
-
'name' => 'hometimeline',
|
241 |
-
'title' => '<label></label>', // label for the input field
|
242 |
-
'callback' => 'feed_settings_radio', // name of the function that outputs the html
|
243 |
-
'page' => 'ctf_options_feed_settings', // matches the section name
|
244 |
-
'section' => 'ctf_options_feed_settings', // matches the section name
|
245 |
-
'option' => 'ctf_options', // matches the options name
|
246 |
-
'class' => 'ctf-radio', // class for the wrapper and input field
|
247 |
-
'whatis' => 'Select this option to display tweets from yourself and those you follow', // what is this? text
|
248 |
-
'label' => "Home Timeline",
|
249 |
-
'has_input' => false,
|
250 |
-
'has_replies' => true
|
251 |
-
));
|
252 |
-
|
253 |
// Search Radio
|
254 |
$search_label = apply_filters( 'ctf_admin_search_label', '' );
|
255 |
$search_whatis = apply_filters( 'ctf_admin_search_whatis', '' );
|
@@ -267,6 +252,21 @@ class CtfAdmin
|
|
267 |
'extra' => true
|
268 |
) );
|
269 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
do_action( 'ctf_admin_endpoints', $this );
|
271 |
|
272 |
// Number of Tweets
|
235 |
'has_replies' => true
|
236 |
));
|
237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
// Search Radio
|
239 |
$search_label = apply_filters( 'ctf_admin_search_label', '' );
|
240 |
$search_whatis = apply_filters( 'ctf_admin_search_whatis', '' );
|
252 |
'extra' => true
|
253 |
) );
|
254 |
|
255 |
+
// Home Timeline Radio
|
256 |
+
$this->create_settings_field( array(
|
257 |
+
'name' => 'hometimeline',
|
258 |
+
'title' => '<label></label>', // label for the input field
|
259 |
+
'callback' => 'feed_settings_radio', // name of the function that outputs the html
|
260 |
+
'page' => 'ctf_options_feed_settings', // matches the section name
|
261 |
+
'section' => 'ctf_options_feed_settings', // matches the section name
|
262 |
+
'option' => 'ctf_options', // matches the options name
|
263 |
+
'class' => 'ctf-radio', // class for the wrapper and input field
|
264 |
+
'whatis' => 'Select this option to display tweets from yourself and those you follow', // what is this? text
|
265 |
+
'label' => "Home Timeline",
|
266 |
+
'has_input' => false,
|
267 |
+
'has_replies' => true
|
268 |
+
));
|
269 |
+
|
270 |
do_action( 'ctf_admin_endpoints', $this );
|
271 |
|
272 |
// Number of Tweets
|
inc/CtfFeed.php
CHANGED
@@ -59,6 +59,10 @@ class CtfFeed
|
|
59 |
*/
|
60 |
private $num_tweets_needed;
|
61 |
|
|
|
|
|
|
|
|
|
62 |
/**
|
63 |
* @var array
|
64 |
*/
|
@@ -81,11 +85,12 @@ class CtfFeed
|
|
81 |
* @param string $last_id_data the last visible tweet on the feed, empty string if first set
|
82 |
* @param int $num_needed_input this number represents the number left to retrieve after the first set
|
83 |
*/
|
84 |
-
public function __construct( $atts, $last_id_data, $num_needed_input )
|
85 |
{
|
86 |
$this->atts = $atts;
|
87 |
$this->last_id_data = $last_id_data;
|
88 |
$this->num_needed_input = $num_needed_input;
|
|
|
89 |
$this->db_options = get_option( 'ctf_options', array() );
|
90 |
}
|
91 |
|
@@ -97,9 +102,9 @@ class CtfFeed
|
|
97 |
* @param int $num_needed_input this number represents the number left to retrieve after the first set
|
98 |
* @return CtfFeed the complete object for the feed
|
99 |
*/
|
100 |
-
public static function init( $atts, $last_id_data = '', $num_needed_input = 0 )
|
101 |
{
|
102 |
-
$feed = new CtfFeed( $atts, $last_id_data, $num_needed_input );
|
103 |
$feed->setFeedOptions();
|
104 |
$feed->setTweetSet();
|
105 |
return $feed;
|
@@ -421,6 +426,7 @@ class CtfFeed
|
|
421 |
$this->feed_options['type'] = 'search';
|
422 |
$this->working_term = isset( $this->atts['hashtag'] ) ? $this->atts['hashtag'] : ( isset( $this->atts['search'] ) ? $this->atts['search'] : '' );
|
423 |
$this->feed_options['feed_term'] = isset( $this->working_term ) ? ctf_validate_search_text( $this->working_term ) : ( ( isset( $this->db_options['search_text'] ) ) ? $this->db_options['search_text'] : '' );
|
|
|
424 |
}
|
425 |
|
426 |
if ( $this->feed_options['type'] == '' ) {
|
@@ -434,6 +440,7 @@ class CtfFeed
|
|
434 |
break;
|
435 |
case 'search':
|
436 |
$this->feed_options['feed_term'] = isset( $this->db_options['search_text'] ) ? $this->db_options['search_text'] : '';
|
|
|
437 |
break;
|
438 |
}
|
439 |
}
|
@@ -526,6 +533,40 @@ class CtfFeed
|
|
526 |
}
|
527 |
}
|
528 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
529 |
/**
|
530 |
* will attempt to connect to the api to retrieve current tweets
|
531 |
*/
|
@@ -548,6 +589,10 @@ class CtfFeed
|
|
548 |
$this->errors['error_message'] = 'No Tweets returned';
|
549 |
$this->tweet_set = false;
|
550 |
}
|
|
|
|
|
|
|
|
|
551 |
}
|
552 |
|
553 |
|
@@ -778,6 +823,7 @@ class CtfFeed
|
|
778 |
$ctf_feed_classes = 'ctf ctf-type-' . $ctf_feed_type;
|
779 |
$ctf_feed_classes .= ' ' . $feed_options['class'] . ' ctf-styles';
|
780 |
$ctf_feed_classes .= $feed_options['width_mobile_no_fixed'] ? ' ctf-width-resp' : '';
|
|
|
781 |
$ctf_feed_classes = apply_filters( 'ctf_feed_classes', $ctf_feed_classes ); //add_filter( 'ctf_feed_classes', function( $ctf_feed_classes ) { return $ctf_feed_classes . ' new-class'; }, 10, 1 );
|
782 |
$ctf_feed_html = '';
|
783 |
|
@@ -936,11 +982,13 @@ class CtfFeed
|
|
936 |
$tweet_classes = apply_filters( 'ctf_tweet_classes', $tweet_classes ); // add_filter( 'ctf_tweet_classes', function( $tweet_classes ) { return $ctf_feed_classes . ' new-class'; }, 10, 1 );
|
937 |
|
938 |
// check for retweet
|
|
|
939 |
if ( isset( $post['retweeted_status'] ) ) {
|
940 |
$retweeter = array(
|
941 |
'name' => $post['user']['name'],
|
942 |
'screen_name' => $post['user']['screen_name']
|
943 |
);
|
|
|
944 |
$post = $post['retweeted_status'];
|
945 |
|
946 |
// temporary workaround for cached http images
|
@@ -959,7 +1007,7 @@ class CtfFeed
|
|
959 |
}
|
960 |
|
961 |
// include tweet view
|
962 |
-
$tweet_html .= '<div class="'. $tweet_classes . '" id="' . $post_id . '" style="' . $feed_options['tweetbgcolor'] .'">';
|
963 |
|
964 |
if ( isset( $retweeter ) && ctf_show( 'retweeter', $feed_options ) ) {
|
965 |
$tweet_html .= '<div class="ctf-context">';
|
59 |
*/
|
60 |
private $num_tweets_needed;
|
61 |
|
62 |
+
private $check_for_duplicates = false;
|
63 |
+
|
64 |
+
private $ids_to_remove = array();
|
65 |
+
|
66 |
/**
|
67 |
* @var array
|
68 |
*/
|
85 |
* @param string $last_id_data the last visible tweet on the feed, empty string if first set
|
86 |
* @param int $num_needed_input this number represents the number left to retrieve after the first set
|
87 |
*/
|
88 |
+
public function __construct( $atts, $last_id_data, $num_needed_input, $ids_to_remove )
|
89 |
{
|
90 |
$this->atts = $atts;
|
91 |
$this->last_id_data = $last_id_data;
|
92 |
$this->num_needed_input = $num_needed_input;
|
93 |
+
$this->ids_to_remove = $ids_to_remove;
|
94 |
$this->db_options = get_option( 'ctf_options', array() );
|
95 |
}
|
96 |
|
102 |
* @param int $num_needed_input this number represents the number left to retrieve after the first set
|
103 |
* @return CtfFeed the complete object for the feed
|
104 |
*/
|
105 |
+
public static function init( $atts, $last_id_data = '', $num_needed_input = 0, $ids_to_remove = array() )
|
106 |
{
|
107 |
+
$feed = new CtfFeed( $atts, $last_id_data, $num_needed_input, $ids_to_remove );
|
108 |
$feed->setFeedOptions();
|
109 |
$feed->setTweetSet();
|
110 |
return $feed;
|
426 |
$this->feed_options['type'] = 'search';
|
427 |
$this->working_term = isset( $this->atts['hashtag'] ) ? $this->atts['hashtag'] : ( isset( $this->atts['search'] ) ? $this->atts['search'] : '' );
|
428 |
$this->feed_options['feed_term'] = isset( $this->working_term ) ? ctf_validate_search_text( $this->working_term ) : ( ( isset( $this->db_options['search_text'] ) ) ? $this->db_options['search_text'] : '' );
|
429 |
+
$this->check_for_duplicates = true;
|
430 |
}
|
431 |
|
432 |
if ( $this->feed_options['type'] == '' ) {
|
440 |
break;
|
441 |
case 'search':
|
442 |
$this->feed_options['feed_term'] = isset( $this->db_options['search_text'] ) ? $this->db_options['search_text'] : '';
|
443 |
+
$this->check_for_duplicates = true;
|
444 |
break;
|
445 |
}
|
446 |
}
|
533 |
}
|
534 |
}
|
535 |
|
536 |
+
private function removeDuplicates()
|
537 |
+
{
|
538 |
+
$tweet_set = isset( $this->tweet_set['statuses'] ) ? $this->tweet_set['statuses'] : $this->tweet_set;
|
539 |
+
$usable_tweets = 0;
|
540 |
+
$tweets_needed = $this->feed_options['count'] + 1; // magic number here should be ADT
|
541 |
+
$ids_of_tweets_to_remove = $this->ids_to_remove;
|
542 |
+
|
543 |
+
$i = 0; // index of tweet_set
|
544 |
+
$still_setting_filtered_tweets = true;
|
545 |
+
while ( $still_setting_filtered_tweets ) { // stays true until the number to display is reached or out of tweets
|
546 |
+
if ( isset( $tweet_set[$i] ) ) {
|
547 |
+
$id = isset( $tweet_set[$i]['retweeted_status']['id_str'] ) ? $tweet_set[$i]['retweeted_status']['id_str'] : $tweet_set[$i]['id_str'];
|
548 |
+
if ( in_array( $id, $ids_of_tweets_to_remove ) ) {
|
549 |
+
unset( $tweet_set[$i] );
|
550 |
+
} else {
|
551 |
+
$usable_tweets++;
|
552 |
+
$ids_of_tweets_to_remove[] = $id;
|
553 |
+
}
|
554 |
+
} else {
|
555 |
+
$still_setting_filtered_tweets = false;
|
556 |
+
}
|
557 |
+
|
558 |
+
// if there are no more tweets needed
|
559 |
+
if ( $usable_tweets >= $tweets_needed ) {
|
560 |
+
$still_setting_filtered_tweets = false;
|
561 |
+
} else {
|
562 |
+
$i++;
|
563 |
+
}
|
564 |
+
|
565 |
+
}
|
566 |
+
|
567 |
+
$this->tweet_set = array_values( $tweet_set );
|
568 |
+
}
|
569 |
+
|
570 |
/**
|
571 |
* will attempt to connect to the api to retrieve current tweets
|
572 |
*/
|
589 |
$this->errors['error_message'] = 'No Tweets returned';
|
590 |
$this->tweet_set = false;
|
591 |
}
|
592 |
+
|
593 |
+
if ( $this->check_for_duplicates ) {
|
594 |
+
$this->removeDuplicates();
|
595 |
+
}
|
596 |
}
|
597 |
|
598 |
|
823 |
$ctf_feed_classes = 'ctf ctf-type-' . $ctf_feed_type;
|
824 |
$ctf_feed_classes .= ' ' . $feed_options['class'] . ' ctf-styles';
|
825 |
$ctf_feed_classes .= $feed_options['width_mobile_no_fixed'] ? ' ctf-width-resp' : '';
|
826 |
+
if ( $this->check_for_duplicates ) { $ctf_feed_classes .= ' ctf-no-duplicates'; }
|
827 |
$ctf_feed_classes = apply_filters( 'ctf_feed_classes', $ctf_feed_classes ); //add_filter( 'ctf_feed_classes', function( $ctf_feed_classes ) { return $ctf_feed_classes . ' new-class'; }, 10, 1 );
|
828 |
$ctf_feed_html = '';
|
829 |
|
982 |
$tweet_classes = apply_filters( 'ctf_tweet_classes', $tweet_classes ); // add_filter( 'ctf_tweet_classes', function( $tweet_classes ) { return $ctf_feed_classes . ' new-class'; }, 10, 1 );
|
983 |
|
984 |
// check for retweet
|
985 |
+
$retweet_data_att = '';
|
986 |
if ( isset( $post['retweeted_status'] ) ) {
|
987 |
$retweeter = array(
|
988 |
'name' => $post['user']['name'],
|
989 |
'screen_name' => $post['user']['screen_name']
|
990 |
);
|
991 |
+
$retweet_data_att = ( $this->check_for_duplicates ) ? ' data-ctfretweetid="'.$post['retweeted_status']['id_str'].'"' : '';
|
992 |
$post = $post['retweeted_status'];
|
993 |
|
994 |
// temporary workaround for cached http images
|
1007 |
}
|
1008 |
|
1009 |
// include tweet view
|
1010 |
+
$tweet_html .= '<div class="'. $tweet_classes . '" id="' . $post_id . '" style="' . $feed_options['tweetbgcolor'] . '"' . $retweet_data_att . '>';
|
1011 |
|
1012 |
if ( isset( $retweeter ) && ctf_show( 'retweeter', $feed_options ) ) {
|
1013 |
$tweet_html .= '<div class="ctf-context">';
|
js/ctf-scripts.js
CHANGED
@@ -96,6 +96,19 @@ if(!ctf_js_exists){
|
|
96 |
$ctfMore.addClass('ctf-loading').append('<div class="ctf-loader"></div>');
|
97 |
$ctfMore.find('.ctf-loader').css('background-color', $ctfMore.css('color'));
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
jQuery.ajax({
|
100 |
url : ctf.ajax_url,
|
101 |
type : 'post',
|
@@ -103,7 +116,8 @@ if(!ctf_js_exists){
|
|
103 |
action : 'ctf_get_more_posts',
|
104 |
last_id_data : lastIDData,
|
105 |
shortcode_data : shortcodeData,
|
106 |
-
num_needed : numNeeded
|
|
|
107 |
},
|
108 |
success : function(data) {
|
109 |
if(lastIDData !== '') {
|
96 |
$ctfMore.addClass('ctf-loading').append('<div class="ctf-loader"></div>');
|
97 |
$ctfMore.find('.ctf-loader').css('background-color', $ctfMore.css('color'));
|
98 |
|
99 |
+
var idsToRemove = [];
|
100 |
+
|
101 |
+
if($ctf.hasClass('ctf-no-duplicates')) {
|
102 |
+
$ctf.find('.ctf-item').each(function() {
|
103 |
+
if($(this).attr('data-ctfretweetid')) {
|
104 |
+
idsToRemove.push($(this).attr('data-ctfretweetid'));
|
105 |
+
}else{
|
106 |
+
var id = $(this).attr('id');
|
107 |
+
idsToRemove.push(id.replace('ctf_', ''));
|
108 |
+
}
|
109 |
+
});
|
110 |
+
}
|
111 |
+
|
112 |
jQuery.ajax({
|
113 |
url : ctf.ajax_url,
|
114 |
type : 'post',
|
116 |
action : 'ctf_get_more_posts',
|
117 |
last_id_data : lastIDData,
|
118 |
shortcode_data : shortcodeData,
|
119 |
+
num_needed : numNeeded,
|
120 |
+
ids_to_remove : idsToRemove
|
121 |
},
|
122 |
success : function(data) {
|
123 |
if(lastIDData !== '') {
|