PluginProbe ʕ •ᴥ•ʔ
Custom Twitter Feeds – A Tweets Widget or X Feed Widget / 2.7.0
Custom Twitter Feeds – A Tweets Widget or X Feed Widget v2.7.0
2.8.0 2.7.0 2.6.1 2.6.0 1.0 1.0.1 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.2 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3 1.4 1.4.1 1.5 1.5.1 1.6 1.6.1 1.7 1.8 1.8.1 1.8.2 1.8.3 1.8.4 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1 2.1.1 2.1.2 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.5.4 2.5.5 trunk
custom-twitter-feeds / inc / SmashTwitter / TweetFilterer.php
custom-twitter-feeds / inc / SmashTwitter Last commit date
Services 1 month ago AuthRoutine.php 1 month ago CronUpdaterManager.php 1 month ago ErrorReport.php 1 month ago Request.php 1 month ago SettingsFilter.php 1 month ago SinglePostCache.php 1 month ago TweetAggregator.php 1 month ago TweetFilterer.php 1 month ago TweetRepository.php 1 month ago TweetSetModifier.php 1 month ago
TweetFilterer.php
51 lines
1 <?php
2 /**
3 * Class TweetFilterer
4 *
5 * Filters Tweets.
6 *
7 * @since 2.2.2
8 */
9 namespace TwitterFeed\SmashTwitter;
10
11 use TwitterFeed\CTF_Parse;
12
13 class TweetFilterer {
14
15 public function maybe_filter_for_timeline( $tweets, $ctf_feed ) {
16
17 if ( empty( $tweets ) ) {
18 return $tweets;
19 }
20 if ( empty( $tweets[0] ) ) {
21 return $tweets;
22 }
23 if ( ! is_array( $tweets[0] ) ) {
24 return $tweets;
25 }
26 $types_and_terms = $ctf_feed->feed_options['feed_types_and_terms'];
27
28 $timelines_included = array();
29 foreach ( $types_and_terms as $type_and_term ) {
30 if ( $type_and_term[0] !== 'usertimeline' ) {
31 return $tweets;
32 } else {
33 $timelines_included[] = str_replace( '@', '', strtolower( $type_and_term[1] ) );
34 }
35 }
36
37 $returnable = array();
38 foreach ( $tweets as $tweet ) {
39 $user = trim( strtolower( CTF_Parse::get_user_name( $tweet ) ) );
40
41 if ( in_array( $user, $timelines_included, true ) ) {
42 $returnable[] = $tweet;
43 }
44 }
45 if ( empty( $returnable ) ) {
46 return $tweets;
47 }
48
49 return $returnable;
50 }
51 }