Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/custom-t.../inc/SmashTwi...
File: TweetSetModifier.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Class TweetSetModifier
[2] Fix | Delete
*
[3] Fix | Delete
*
[4] Fix | Delete
*
[5] Fix | Delete
* @since 2.1
[6] Fix | Delete
*/
[7] Fix | Delete
namespace TwitterFeed\SmashTwitter;
[8] Fix | Delete
[9] Fix | Delete
use TwitterFeed\CTF_Parse;
[10] Fix | Delete
[11] Fix | Delete
class TweetSetModifier
[12] Fix | Delete
{
[13] Fix | Delete
private $tweet_set;
[14] Fix | Delete
[15] Fix | Delete
[16] Fix | Delete
private $hydrated_tweet_set;
[17] Fix | Delete
[18] Fix | Delete
public function set_tweet_set( $tweet_set ) {
[19] Fix | Delete
$this->tweet_set = $tweet_set;
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
public function get_hydrated_tweet_set() {
[23] Fix | Delete
return $this->hydrated_tweet_set;
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
public function hydrate_tweet_set() {
[27] Fix | Delete
if ( empty( $this->tweet_set ) ) {
[28] Fix | Delete
return;
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
$referenceable_tweet_set = array();
[32] Fix | Delete
foreach ( $this->tweet_set as $tweet ) {
[33] Fix | Delete
$referenceable_tweet_set[ CTF_Parse::get_post_id( $tweet ) ] = $tweet;
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
$flagged_quoted_tweets = array();
[37] Fix | Delete
$flagged_retweeted_quoted_tweets = array();
[38] Fix | Delete
$flagged_retweets = array();
[39] Fix | Delete
[40] Fix | Delete
$this->hydrated_tweet_set = array();
[41] Fix | Delete
foreach ( $referenceable_tweet_set as $id => $tweet ) {
[42] Fix | Delete
// if this is a tweet that was quoted we want to remove it from the feed (unless quoted by the same author)
[43] Fix | Delete
// Quoted tweets are instead added to the tweet that is doing the quoting through this hydration process
[44] Fix | Delete
$does_not_belong = in_array( (string)$id, $flagged_quoted_tweets, true ) && CTF_Parse::get_author_screen_name( $tweet ) !== CTF_Parse::get_author_screen_name( $referenceable_tweet_set[ $id ] );
[45] Fix | Delete
if ( ! $does_not_belong ) {
[46] Fix | Delete
$does_not_belong = in_array( (string)$id, $flagged_retweets, true );
[47] Fix | Delete
}
[48] Fix | Delete
if ( ! $does_not_belong ) {
[49] Fix | Delete
$does_not_belong = in_array( (string)$id, $flagged_retweeted_quoted_tweets, true );
[50] Fix | Delete
}
[51] Fix | Delete
if ( ! $does_not_belong ) {
[52] Fix | Delete
$hydrated_tweet = $tweet;
[53] Fix | Delete
if ( ! empty( $tweet['is_quote_status'] )
[54] Fix | Delete
&& ! empty( $tweet['quoted_status_id_str'] )
[55] Fix | Delete
&& ! empty( $referenceable_tweet_set[ $tweet['quoted_status_id_str'] ] ) ) {
[56] Fix | Delete
$flagged_quoted_tweets[] = $tweet['quoted_status_id_str'];
[57] Fix | Delete
$hydrated_tweet['quoted_status'] = $referenceable_tweet_set[ $tweet['quoted_status_id_str'] ];
[58] Fix | Delete
}
[59] Fix | Delete
if ( ! empty( $tweet['retweeted_status_id_str'] )
[60] Fix | Delete
&& ! empty( $tweet['retweeted_status_id_str'] )
[61] Fix | Delete
&& ! empty( $referenceable_tweet_set[ $tweet['retweeted_status_id_str'] ] ) ) {
[62] Fix | Delete
$flagged_retweets[] = $tweet['retweeted_status_id_str'];
[63] Fix | Delete
$hydrated_tweet['retweeted_status'] = $referenceable_tweet_set[ $tweet['retweeted_status_id_str'] ];
[64] Fix | Delete
if ( strpos( $hydrated_tweet['text'], 'RT ' ) === 0 ) {
[65] Fix | Delete
$hydrated_tweet['text'] = str_replace( 'RT ', '', $hydrated_tweet['text'] );
[66] Fix | Delete
$hydrated_tweet['full_text'] = str_replace( 'RT ', '', $hydrated_tweet['full_text'] );
[67] Fix | Delete
}
[68] Fix | Delete
if ( ! empty( $hydrated_tweet['retweeted_status']['is_quote_status'] )
[69] Fix | Delete
&& ! empty( $hydrated_tweet['retweeted_status']['quoted_status_id_str'] )
[70] Fix | Delete
&& ! empty( $referenceable_tweet_set[ $hydrated_tweet['retweeted_status']['quoted_status_id_str'] ] ) ) {
[71] Fix | Delete
$flagged_retweeted_quoted_tweets[] = $hydrated_tweet['retweeted_status']['quoted_status_id_str'];
[72] Fix | Delete
[73] Fix | Delete
$hydrated_tweet['retweeted_status']['quoted_status'] = $referenceable_tweet_set[ $tweet['quoted_status_id_str'] ];
[74] Fix | Delete
}
[75] Fix | Delete
}
[76] Fix | Delete
$this->hydrated_tweet_set[] = $hydrated_tweet;
[77] Fix | Delete
}
[78] Fix | Delete
}
[79] Fix | Delete
}
[80] Fix | Delete
}
[81] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function