Feed Them Social – Facebook, Instagram, Twitter, YouTube, Pinterest - Version 2.9.3

Version Description

Download this release

Release Info

Developer slickremix
Plugin Icon 128x128 Feed Them Social – Facebook, Instagram, Twitter, YouTube, Pinterest
Version 2.9.3
Comparing to
See all releases

Code changes from version 2.9.2 to 2.9.3

admin/class-fts-facebook-options-page.php CHANGED
@@ -140,7 +140,7 @@ class FTS_Facebook_Options_Page {
140
  <div class="clear"></div>
141
  <?php
142
  if ( ! empty( $test_app_token_response ) && ! empty( $test_app_token_id ) ) {
143
- if ( isset( $test_app_token_response->data->is_valid ) || '(#100) You must provide an app access token or a user access token that is an owner or developer of the app' === $test_app_token_response->error->message ) {
144
  $fb_id = get_option( 'fts_facebook_custom_api_token_user_id' );
145
  $fb_name = get_option( 'fts_facebook_custom_api_token_user_name' );
146
  echo '<div class="fts-successful-api-token fts-special-working-wrap">';
@@ -157,7 +157,7 @@ class FTS_Facebook_Options_Page {
157
 
158
  echo '</div>';
159
  }
160
- if ( isset( $test_app_token_response->data->error->message ) && ! empty( $test_app_token_id ) || isset( $test_app_token_response->error->message ) && ! empty( $test_app_token_id ) && '(#100) You must provide an app access token or a user access token that is an owner or developer of the app' !== $test_app_token_response->error->message ) {
161
  if ( isset( $test_app_token_response->data->error->message ) ) {
162
  echo sprintf(
163
  esc_html__( '%1$sOh No something\'s wrong. %2$s. Please click the button above to retrieve a new Access Token.%3$s', 'feed-them-social' ),
@@ -251,7 +251,7 @@ class FTS_Facebook_Options_Page {
251
  if ( ! empty( $test_app_token_response_biz ) && ! empty( $test_app_token_id_biz ) ) {
252
  $fb_name_biz = get_option( 'fts_facebook_custom_api_token_user_name_biz' );
253
  $fb_id_biz = get_option( 'fts_facebook_custom_api_token_user_id_biz' );
254
- if ( isset( $test_app_token_response_biz->data->is_valid ) || $test_app_token_response_biz->error->message == '(#100) You must provide an app access token or a user access token that is an owner or developer of the app' ) {
255
  echo '<div class="fts-successful-api-token fts-special-working-wrap">';
256
 
257
  // https://graph.facebook.com/' . $fb_id_biz . '/picture
@@ -262,12 +262,12 @@ class FTS_Facebook_Options_Page {
262
 
263
  }
264
 
265
- if ( isset( $test_app_token_response_biz->data->error->message ) && ! empty( $test_app_token_id_biz ) || isset( $test_app_token_response_biz->error->message ) && ! empty( $test_app_token_id ) && $test_app_token_response_biz->error->message !== '(#100) You must provide an app access token or a user access token that is an owner or developer of the app' ) {
266
  if ( isset( $test_app_token_response_biz->data->error->message ) ) {
267
- echo '<div class="fts-failed-api-token">' . __( 'Oh No something\'s wrong.', 'feed-them-social' ) . ' ' . $test_app_token_response_biz->data->error->message . ' ' . __( 'Please click the button above to retreive a new Access Token.', 'feed-them-social' ) . '</div>';
268
  }
269
  if ( isset( $test_app_token_response_biz->error->message ) && ! empty( $test_app_token_id_biz ) && ! isset( $_GET['return_long_lived_token'] ) ) {
270
- echo '<div class="fts-failed-api-token">' . __( 'Oh No something\'s wrong.', 'feed-them-social' ) . ' ' . $test_app_token_response_biz->error->message . ' ' . __( 'Please click the button above to retreive a new Access Token.', 'feed-them-social' ) . '</div>';
271
  }
272
  }
273
  }
140
  <div class="clear"></div>
141
  <?php
142
  if ( ! empty( $test_app_token_response ) && ! empty( $test_app_token_id ) ) {
143
+ if ( isset( $test_app_token_response->data->is_valid ) || '(#100) You must provide an app access token, or a user access token that is an owner or developer of the app' === $test_app_token_response->error->message ) {
144
  $fb_id = get_option( 'fts_facebook_custom_api_token_user_id' );
145
  $fb_name = get_option( 'fts_facebook_custom_api_token_user_name' );
146
  echo '<div class="fts-successful-api-token fts-special-working-wrap">';
157
 
158
  echo '</div>';
159
  }
160
+ if ( isset( $test_app_token_response->data->error->message ) && ! empty( $test_app_token_id ) || isset( $test_app_token_response->error->message ) && ! empty( $test_app_token_id ) && '(#100) You must provide an app access token, or a user access token that is an owner or developer of the app' !== $test_app_token_response->error->message ) {
161
  if ( isset( $test_app_token_response->data->error->message ) ) {
162
  echo sprintf(
163
  esc_html__( '%1$sOh No something\'s wrong. %2$s. Please click the button above to retrieve a new Access Token.%3$s', 'feed-them-social' ),
251
  if ( ! empty( $test_app_token_response_biz ) && ! empty( $test_app_token_id_biz ) ) {
252
  $fb_name_biz = get_option( 'fts_facebook_custom_api_token_user_name_biz' );
253
  $fb_id_biz = get_option( 'fts_facebook_custom_api_token_user_id_biz' );
254
+ if ( isset( $test_app_token_response_biz->data->is_valid ) || $test_app_token_response_biz->error->message == '(#100) You must provide an app access token, or a user access token that is an owner or developer of the app' ) {
255
  echo '<div class="fts-successful-api-token fts-special-working-wrap">';
256
 
257
  // https://graph.facebook.com/' . $fb_id_biz . '/picture
262
 
263
  }
264
 
265
+ if ( isset( $test_app_token_response_biz->data->error->message ) && ! empty( $test_app_token_id_biz ) || isset( $test_app_token_response_biz->error->message ) && ! empty( $test_app_token_id ) && $test_app_token_response_biz->error->message !== '(#100) You must provide an app access token, or a user access token that is an owner or developer of the app' ) {
266
  if ( isset( $test_app_token_response_biz->data->error->message ) ) {
267
+ echo '<div class="fts-failed-api-token">' . __( 'Oh No something\'s wrong.', 'feed-them-social' ) . ' ' . $test_app_token_response_biz->data->error->message . ' ' . __( 'Please click the button above to retrieve a new Access Token.', 'feed-them-social' ) . '</div>';
268
  }
269
  if ( isset( $test_app_token_response_biz->error->message ) && ! empty( $test_app_token_id_biz ) && ! isset( $_GET['return_long_lived_token'] ) ) {
270
+ echo '<div class="fts-failed-api-token">' . __( 'Oh No something\'s wrong.', 'feed-them-social' ) . ' ' . $test_app_token_response_biz->error->message . ' ' . __( 'Please click the button above to retrieve a new Access Token.', 'feed-them-social' ) . '</div>';
271
  }
272
  }
273
  }
admin/class-fts-instagram-options-page.php CHANGED
@@ -274,7 +274,7 @@ class FTS_Instagram_Options_Page {
274
  <div class="clear"></div>
275
  <?php
276
  if ( ! empty( $test_app_token_response ) && ! empty( $test_app_token_id ) ) {
277
- if ( isset( $test_app_token_response->data->is_valid ) || '(#100) You must provide an app access token or a user access token that is an owner or developer of the app' === $test_app_token_response->error->message ) {
278
  $fb_id = get_option( 'fts_facebook_instagram_custom_api_token_user_id' );
279
  $fb_name = get_option( 'fts_facebook_instagram_custom_api_token_user_name' );
280
  echo '<div class="fts-successful-api-token fts-special-working-wrap">';
@@ -298,7 +298,7 @@ class FTS_Instagram_Options_Page {
298
 
299
  echo '</div>';
300
  }
301
- if ( isset( $test_app_token_response->data->error->message ) && ! empty( $test_app_token_id ) || isset( $test_app_token_response->error->message ) && ! empty( $test_app_token_id ) && '(#100) You must provide an app access token or a user access token that is an owner or developer of the app' !== $test_app_token_response->error->message ) {
302
  if ( isset( $test_app_token_response->data->error->message ) ) {
303
  echo sprintf(
304
  esc_html__( '%1$sOh No something\'s wrong. %2$s. Please click the button above to retrieve a new Access Token.%3$s', 'feed-them-social' ),
274
  <div class="clear"></div>
275
  <?php
276
  if ( ! empty( $test_app_token_response ) && ! empty( $test_app_token_id ) ) {
277
+ if ( isset( $test_app_token_response->data->is_valid ) || '(#100) You must provide an app access token, or a user access token that is an owner or developer of the app' === $test_app_token_response->error->message ) {
278
  $fb_id = get_option( 'fts_facebook_instagram_custom_api_token_user_id' );
279
  $fb_name = get_option( 'fts_facebook_instagram_custom_api_token_user_name' );
280
  echo '<div class="fts-successful-api-token fts-special-working-wrap">';
298
 
299
  echo '</div>';
300
  }
301
+ if ( isset( $test_app_token_response->data->error->message ) && ! empty( $test_app_token_id ) || isset( $test_app_token_response->error->message ) && ! empty( $test_app_token_id ) && '(#100) You must provide an app access token, or a user access token that is an owner or developer of the app' !== $test_app_token_response->error->message ) {
302
  if ( isset( $test_app_token_response->data->error->message ) ) {
303
  echo sprintf(
304
  esc_html__( '%1$sOh No something\'s wrong. %2$s. Please click the button above to retrieve a new Access Token.%3$s', 'feed-them-social' ),
admin/class-fts-settings-page.php CHANGED
@@ -237,7 +237,7 @@ class FTS_Settings_Page {
237
 
238
  ?>
239
  <div style="float:left; max-width:400px; margin-right:30px;">
240
- <h2><?php echo esc_html__( 'FaceBook & Twitter Date Format', 'feed-them-social' ); ?></h2>
241
 
242
  <fieldset>
243
  <select id="fts-date-and-time-format" name="fts-date-and-time-format">
237
 
238
  ?>
239
  <div style="float:left; max-width:400px; margin-right:30px;">
240
+ <h2><?php echo esc_html__( 'Date Format', 'feed-them-social' ); ?></h2>
241
 
242
  <fieldset>
243
  <select id="fts-date-and-time-format" name="fts-date-and-time-format">
feed-them.php CHANGED
@@ -7,18 +7,18 @@
7
  * Plugin Name: Feed Them Social - for Twitter feed, Youtube, and more
8
  * Plugin URI: https://feedthemsocial.com/
9
  * Description: Display a Custom Facebook feed, Instagram feed, Twitter feed and YouTube feed on pages, posts or widgets.
10
- * Version: 2.9.2
11
  * Author: SlickRemix
12
  * Author URI: https://www.slickremix.com/
13
  * Text Domain: feed-them-social
14
  * Domain Path: /languages
15
  * Requires at least: WordPress 4.0.0
16
  * Tested up to: WordPress 5.6.0
17
- * Stable tag: 2.9.2
18
  * License: GPLv2 or later
19
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
20
  *
21
- * @version 2.9.2
22
  * @package FeedThemSocial/Core
23
  * @copyright Copyright (c) 2012-2021 SlickRemix
24
  *
@@ -31,7 +31,7 @@
31
  *
32
  * Makes sure any js or css changes are reloaded properly. Added to enqued css and js files throughout!
33
  */
34
- define( 'FTS_CURRENT_VERSION', '2.9.2' );
35
 
36
  define( 'FEED_THEM_SOCIAL_NOTICE_STATUS', get_option( 'rating_fts_slick_notice', false ) );
37
 
7
  * Plugin Name: Feed Them Social - for Twitter feed, Youtube, and more
8
  * Plugin URI: https://feedthemsocial.com/
9
  * Description: Display a Custom Facebook feed, Instagram feed, Twitter feed and YouTube feed on pages, posts or widgets.
10
+ * Version: 2.9.3
11
  * Author: SlickRemix
12
  * Author URI: https://www.slickremix.com/
13
  * Text Domain: feed-them-social
14
  * Domain Path: /languages
15
  * Requires at least: WordPress 4.0.0
16
  * Tested up to: WordPress 5.6.0
17
+ * Stable tag: 2.9.3
18
  * License: GPLv2 or later
19
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
20
  *
21
+ * @version 2.9.3
22
  * @package FeedThemSocial/Core
23
  * @copyright Copyright (c) 2012-2021 SlickRemix
24
  *
31
  *
32
  * Makes sure any js or css changes are reloaded properly. Added to enqued css and js files throughout!
33
  */
34
+ define( 'FTS_CURRENT_VERSION', '2.9.3' );
35
 
36
  define( 'FEED_THEM_SOCIAL_NOTICE_STATUS', get_option( 'rating_fts_slick_notice', false ) );
37
 
feeds/instagram/class-fts-instagram-feed.php CHANGED
@@ -156,14 +156,15 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
156
  * @return string
157
  * @since 1.9.6
158
  */
159
- // One of these statements needs to be fixed so if the video is the first carousel post then we need to use the $post_data->permalink . 'media?size=l', it works ok for single post videos but not carousel ones.
160
  public function fts_instagram_image_link( $post_data ) {
161
 
 
 
162
  $hashtag_children = isset( $post_data->children ) ? $post_data->children->data[0]->media_url : '';
163
 
164
  $instagram_api_children = isset( $post_data->images ) ? $post_data->images->standard_resolution->url : $hashtag_children;
165
 
166
- $data_type_child = strpos( $hashtag_children, 'mp4' ) ? $post_data->media_url : $instagram_api_children;
167
 
168
  $hastag_media_url = isset( $post_data->media_url ) ? $post_data->media_url : $data_type_child;
169
 
@@ -359,6 +360,7 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
359
  $pics_count = '10';
360
  }
361
 
 
362
  wp_enqueue_script( 'fts-global', plugins_url( 'feed-them-social/feeds/js/fts-global.js' ), array( 'jquery' ), FTS_CURRENT_VERSION, false );
363
  $instagram_data_array = array();
364
 
@@ -395,7 +397,7 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
395
  $_REQUEST['next_url'] = str_replace( 'access_token=XXX', 'access_token=' . $fts_instagram_access_token_final, $_REQUEST['next_url'] );
396
  }
397
  // URL to get Feeds.
398
- // $debug = 'false';
399
  if ( 'hashtag' === $type ) {
400
  // cheezballs = 17843830210018045
401
  // sleepytime = 17841401899184039
@@ -405,7 +407,9 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
405
  // These are the 2 types of things you can search for after getting the id of the hashtag from the above 2 links.
406
  // https://developers.facebook.com/docs/instagram-api/reference/hashtag/recent-media
407
  // https://developers.facebook.com/docs/instagram-api/reference/hashtag/top-media
408
- $cache_hashtag_id_array = 'instagram_cache_' . $instagram_id . '_num' . $pics_count . '_search' . $search . '';
 
 
409
 
410
  if ( false === $this->fts_check_feed_cache_exists( $cache_hashtag_id_array ) ) {
411
  // This call is required because users enter a hashtag name, then we have to check the API to see if it exists and if it does return the ID number for that hashtag.
@@ -430,31 +434,90 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
430
 
431
  // Used for Testing Only.
432
  if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
433
- esc_html_e( 'Array Check Cached', 'feed-them-social' );
434
  echo '<br/><pre>';
435
  print_r( $hashtag_error_check );
436
  echo '</pre>';
437
  }
438
  }
439
 
 
 
 
 
 
 
 
 
440
  if ( 'recent-media' === $search || '' === $search ) {
441
  // Now that we have the Instagram ID we can do a search for the endpoint 'Recent Media'.
442
- $instagram_data_array['data'] = isset( $_REQUEST['next_url'] ) ? esc_url_raw( $_REQUEST['next_url'] ) : 'https://graph.facebook.com/v4.0/' . $hashtag_id . '/recent_media?user_id=' . $instagram_id . '&fields=media_url{id},caption,comments_count,permalink,like_count,media_type,id,children{media_url}&limit=' . $pics_count . '&access_token=' . $fts_instagram_access_token_final;
 
443
  } elseif ( 'top-media' === $search ) {
444
  // Now that we have the Instagram ID we can do a search for the endpoint 'Top Media'.
445
- $instagram_data_array['data'] = isset( $_REQUEST['next_url'] ) ? esc_url_raw( $_REQUEST['next_url'] ) : 'https://graph.facebook.com/' . $hashtag_id . '/top_media?user_id=' . $instagram_id . '&fields=media_url,caption,id,comments_count,permalink,like_count,media_type,children{media_url}&limit=' . $pics_count . '&access_token=' . $fts_instagram_access_token_final;
446
  }
447
- }
448
-
449
-
450
-
451
-
452
-
453
-
454
-
455
-
456
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
457
 
 
 
 
 
 
 
 
 
 
 
458
  elseif ( 'business' === $type ) {
459
 
460
  $business_cache = 'instagram_business_cache' . $instagram_id . '_num' . $pics_count . '';
@@ -475,6 +538,13 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
475
 
476
  // We loop through the media ids from the above $instagram_business_data_array['data'] and request the info for each to create an array we can cache.
477
  $instagram_business_output = (object) [ 'data' => [] ];
 
 
 
 
 
 
 
478
  foreach ( $instagram_business->data as $media ) {
479
  $media_id = $media->id;
480
  $instagram_business_data_array['data'] = 'https://graph.facebook.com/' . $media_id . '?fields=caption,comments_count,like_count,id,media_url,media_type,permalink,thumbnail_url,timestamp,username,children{media_url}&access_token=' . $fts_instagram_access_token_final;
@@ -482,12 +552,18 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
482
  $instagram_business_media = json_decode( $instagram_business_media_response['data'] );
483
  $instagram_business_output->data[] = $instagram_business_media;
484
  }
 
485
  $insta_data = (object) array_merge( (array) $instagram_business, (array) $instagram_business_output );
486
 
487
- // echo 'rrrrrrrrrrrr';
488
- // echo '<br/><pre>';
489
- // print_r( $insta_data );
490
- // echo '</pre>';
 
 
 
 
 
491
 
492
  if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
493
  $this->fts_create_feed_cache( $business_cache, $insta_data );
@@ -500,25 +576,13 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
500
  // echo 'eeeeeeeeeeee';
501
  // Used for Testing Only.
502
  if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
503
- esc_html_e( 'Array Check Cached', 'feed-them-social' );
504
  echo '<br/><pre>';
505
  print_r( $insta_data );
506
  echo '</pre>';
507
  }
508
  }
509
  }
510
-
511
-
512
-
513
-
514
-
515
-
516
-
517
-
518
-
519
-
520
-
521
-
522
  elseif ( 'basic' === $type ) {
523
  // We don't really need this right now, but leaving in case we find a need. This is a call to return basic user data but the only thing worth anything I can
524
  // think of right now would be making an option to show the media count. That would need to be a new option, worth adding in a future update. This call is duplicated and used to return info on the instagram options page though.
@@ -568,11 +632,10 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
568
  // echo '<br/>asdfasdfasdf<pre>';
569
  // print_r( $insta_data );
570
  // echo '</pre>zzzz';
571
- // $instagram_data_array['user_info'] = 'https://graph.instagram.com/me?fields=id,username,media_count,account_type&access_token=' . $fts_instagram_access_token_final;
572
  }
573
 
574
 
575
-
576
  $cache = 'instagram_cache_' . $instagram_id . '_num' . $pics_count . '';
577
  // First we make sure the feed is not cached already before trying to run the Instagram API.
578
  if ( false === $this->fts_check_feed_cache_exists( $cache ) ) {
@@ -583,22 +646,23 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
583
 
584
  // Used for Testing Only.
585
  if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
586
- esc_html_e( 'Array Check', 'feed-them-social' );
587
  echo '<br/><pre>';
588
  print_r( $error_check );
589
  echo '</pre>';
590
  }
591
  }
592
 
593
- //$spencer_testing = 'true';
594
  if ( 'hashtag' === $type || 'user' === $type || !isset( $type ) ) {
 
595
  // If the feed is NOT cached then we run the cached array to display the feed.
596
  // Legacy API depreciation as of March 31st, 2020. SO we add a check here to by pass the cache and show an error message
597
  // letting users know they need to reconnect there account generate a new shortcode.
598
  if ( false !== $this->fts_check_feed_cache_exists( $cache ) && ! isset( $_GET['load_more_ajaxing'] ) && 'user' !== $type ) {
599
  $response = $this->fts_get_feed_cache( $cache );
600
  $insta_data = isset( $type ) && 'basic' === $type || 'business' === $type ? $insta_fb_data : json_decode( $response['data'] );
601
- $note = esc_html__( 'Cached', 'feed-them-social' );
602
 
603
  } elseif ( isset( $error_check->error_message ) || isset( $error_check->meta->error_message ) || empty( $error_check ) || 'user' === $type || !isset( $type ) ) {
604
  // If the Instagram API array returns any error messages we check for them here and return the corresponding error message!
@@ -626,7 +690,7 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
626
  $note = esc_html__( 'Not Cached', 'feed-them-social' );
627
  }
628
  }
629
- }
630
 
631
  $instagram_user_info = ! empty( $response['user_info'] ) ? json_decode( $response['user_info'] ) : '';
632
  // URL to get Feeds.
@@ -656,7 +720,8 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
656
 
657
  // ->pagination->next_url.
658
  if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
659
- echo esc_html( $note ) . '<br/><pre>';
 
660
  print_r( $response );
661
  echo '</pre>';
662
  }
@@ -1043,7 +1108,7 @@ if ( isset( $profile_description, $type ) && 'yes' === $profile_description &&
1043
 
1044
  <div class="fts-insta-date-popup-grab">
1045
  <?php
1046
- if ( 'no' === $hide_date_likes_comments && 'hashtag' !== $type ) {
1047
  echo esc_html( $instagram_date );
1048
  } else {
1049
  echo '&nbsp;'; }
156
  * @return string
157
  * @since 1.9.6
158
  */
 
159
  public function fts_instagram_image_link( $post_data ) {
160
 
161
+ $hashtag_children_pic = isset( $post_data->children->data[0]->thumbnail_url ) ? $post_data->children->data[0]->thumbnail_url : '';
162
+
163
  $hashtag_children = isset( $post_data->children ) ? $post_data->children->data[0]->media_url : '';
164
 
165
  $instagram_api_children = isset( $post_data->images ) ? $post_data->images->standard_resolution->url : $hashtag_children;
166
 
167
+ $data_type_child = strpos( $hashtag_children, 'mp4' ) ? $hashtag_children_pic : $instagram_api_children;
168
 
169
  $hastag_media_url = isset( $post_data->media_url ) ? $post_data->media_url : $data_type_child;
170
 
360
  $pics_count = '10';
361
  }
362
 
363
+
364
  wp_enqueue_script( 'fts-global', plugins_url( 'feed-them-social/feeds/js/fts-global.js' ), array( 'jquery' ), FTS_CURRENT_VERSION, false );
365
  $instagram_data_array = array();
366
 
397
  $_REQUEST['next_url'] = str_replace( 'access_token=XXX', 'access_token=' . $fts_instagram_access_token_final, $_REQUEST['next_url'] );
398
  }
399
  // URL to get Feeds.
400
+ $debug = 'false';
401
  if ( 'hashtag' === $type ) {
402
  // cheezballs = 17843830210018045
403
  // sleepytime = 17841401899184039
407
  // These are the 2 types of things you can search for after getting the id of the hashtag from the above 2 links.
408
  // https://developers.facebook.com/docs/instagram-api/reference/hashtag/recent-media
409
  // https://developers.facebook.com/docs/instagram-api/reference/hashtag/top-media
410
+
411
+
412
+ $cache_hashtag_id_array = 'instagram_cache_' . $instagram_id . '_num' . $pics_count . '_search' . $search . '_hash' . $hashtag . '';
413
 
414
  if ( false === $this->fts_check_feed_cache_exists( $cache_hashtag_id_array ) ) {
415
  // This call is required because users enter a hashtag name, then we have to check the API to see if it exists and if it does return the ID number for that hashtag.
434
 
435
  // Used for Testing Only.
436
  if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
437
+ esc_html_e( 'Hash 1 Array Check Cached', 'feed-them-social' );
438
  echo '<br/><pre>';
439
  print_r( $hashtag_error_check );
440
  echo '</pre>';
441
  }
442
  }
443
 
444
+ // SRL: 01/19/21 Work around so we can load more than one hashtag shortcode on the same page that has the same user ID and pics_count otherwise it will be interpreted as
445
+ // whatever the first shortcodes hashtag making all the feeds have the same photos.
446
+ $pics_count .= '?1=' . $hashtag;
447
+
448
+
449
+ $hash_final_cache = 'instagram_final_cache_' . $instagram_id . '_num' . $pics_count . '_search' . $search . '_hash' . $hashtag . '';
450
+
451
+ // The below needs to be cached and the hashtag ID above merged with like how we did below on line 493
452
  if ( 'recent-media' === $search || '' === $search ) {
453
  // Now that we have the Instagram ID we can do a search for the endpoint 'Recent Media'.
454
+ $instagram_data_array['data'] = isset( $_REQUEST['next_url'] ) ? esc_url_raw( $_REQUEST['next_url'] ) : 'https://graph.facebook.com/v9.0/' . $hashtag_id . '/recent_media?user_id=' . $instagram_id . '&fields=timestamp,media_url,caption,comments_count,permalink,like_count,media_type,id,children{media_url,media_type,permalink}&limit=' . $pics_count . '&access_token=' . $fts_instagram_access_token_final;
455
+
456
  } elseif ( 'top-media' === $search ) {
457
  // Now that we have the Instagram ID we can do a search for the endpoint 'Top Media'.
458
+ $instagram_data_array['data'] = isset( $_REQUEST['next_url'] ) ? esc_url_raw( $_REQUEST['next_url'] ) : 'https://graph.facebook.com/v9.0/' . $hashtag_id . '/top_media?user_id=' . $instagram_id . '&fields=timestamp,media_url,caption,id,comments_count,permalink,like_count,media_type,children{media_url,media_type,permalink}&limit=' . $pics_count . '&access_token=' . $fts_instagram_access_token_final;
459
  }
 
 
 
 
 
 
 
 
 
460
 
461
+ // First we make sure the feed is not cached already before trying to run the Instagram API.
462
+ if ( false === $this->fts_check_feed_cache_exists( $hash_final_cache ) ) {
463
+
464
+ // https://developers.facebook.com/docs/instagram/oembed#oembed-product
465
+ $hashtag_response = $this->fts_get_feed_json( $instagram_data_array );
466
+
467
+ $hashtag_error_check = json_decode( $hashtag_response['data'] );
468
+
469
+ /* echo 'weeeeeee';
470
+ echo '<pre>';
471
+ print_r( $hashtag_error_check );
472
+ echo '</pre>';*/
473
+
474
+ foreach ( $hashtag_error_check->data as &$media ) {
475
+
476
+ if( 'VIDEO' === $media->media_type ){
477
+ $permalink = $media->permalink;
478
+ $instagram_business_data_array['data'] = 'https://graph.facebook.com/v9.0/instagram_oembed?url=' . $permalink . '&fields=thumbnail_url&access_token='.$fts_instagram_access_token_final;
479
+ $instagram_business_media_response = $this->fts_get_feed_json( $instagram_business_data_array );
480
+ $instagram_business_media = json_decode( $instagram_business_media_response['data'] );
481
+ $media->thumbnail_url = $instagram_business_media->thumbnail_url;
482
+
483
+ }
484
+
485
+ if( 'CAROUSEL_ALBUM' === $media->media_type ){
486
+
487
+ if( 'VIDEO' === $media->children->data[0]->media_type ){
488
+ $permalink_child = $media->children->data[0]->permalink;
489
+ $instagram_business_data_array_child['data'] = 'https://graph.facebook.com/v9.0/instagram_oembed?url=' . $permalink_child . '&fields=thumbnail_url&access_token='.$fts_instagram_access_token_final;
490
+ $instagram_business_media_response_child = $this->fts_get_feed_json( $instagram_business_data_array_child );
491
+ $instagram_business_media_child = json_decode( $instagram_business_media_response_child['data'] );
492
+ $media->children->data[0]->thumbnail_url = $instagram_business_media_child->thumbnail_url;
493
+ }
494
+ }
495
+ }
496
+ unset($media); // unset the reference
497
+ $insta_data = $hashtag_error_check;
498
+
499
+ /* echo 'hash weeeeeee';
500
+ echo '<pre>';
501
+ print_r( $insta_data );
502
+ echo '</pre>';*/
503
+
504
+ if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
505
+ $this->fts_create_feed_cache( $hash_final_cache, $insta_data );
506
+ }
507
+ }
508
+ else {
509
+ $insta_data = $this->fts_get_feed_cache( $hash_final_cache );
510
 
511
+ // echo 'eeeeeeeeeeee';
512
+ // Used for Testing Only.
513
+ if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
514
+ esc_html_e( 'Hash 2 Array Check Cached', 'feed-them-social' );
515
+ echo '<br/><pre>';
516
+ print_r( $insta_data );
517
+ echo '</pre>';
518
+ }
519
+ }
520
+ }
521
  elseif ( 'business' === $type ) {
522
 
523
  $business_cache = 'instagram_business_cache' . $instagram_id . '_num' . $pics_count . '';
538
 
539
  // We loop through the media ids from the above $instagram_business_data_array['data'] and request the info for each to create an array we can cache.
540
  $instagram_business_output = (object) [ 'data' => [] ];
541
+
542
+ /*echo 'bbbbb';
543
+ echo '<br/><pre>';
544
+ print_r( $instagram_business );
545
+ echo '</pre>';*/
546
+
547
+
548
  foreach ( $instagram_business->data as $media ) {
549
  $media_id = $media->id;
550
  $instagram_business_data_array['data'] = 'https://graph.facebook.com/' . $media_id . '?fields=caption,comments_count,like_count,id,media_url,media_type,permalink,thumbnail_url,timestamp,username,children{media_url}&access_token=' . $fts_instagram_access_token_final;
552
  $instagram_business_media = json_decode( $instagram_business_media_response['data'] );
553
  $instagram_business_output->data[] = $instagram_business_media;
554
  }
555
+ // The reason we array_merge the $instagram_business_output is because it contains the paging for next and previous links so we can loadmore posts
556
  $insta_data = (object) array_merge( (array) $instagram_business, (array) $instagram_business_output );
557
 
558
+ /* echo 'rrrrrrrrrrrr';
559
+ echo '<br/><pre>';
560
+ print_r( $instagram_business_output );
561
+ echo '</pre>';
562
+
563
+ echo 'ssssssss';
564
+ echo '<br/><pre>';
565
+ print_r( $insta_data );
566
+ echo '</pre>';*/
567
 
568
  if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
569
  $this->fts_create_feed_cache( $business_cache, $insta_data );
576
  // echo 'eeeeeeeeeeee';
577
  // Used for Testing Only.
578
  if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
579
+ esc_html_e( 'Business Array Check Cached', 'feed-them-social' );
580
  echo '<br/><pre>';
581
  print_r( $insta_data );
582
  echo '</pre>';
583
  }
584
  }
585
  }
 
 
 
 
 
 
 
 
 
 
 
 
586
  elseif ( 'basic' === $type ) {
587
  // We don't really need this right now, but leaving in case we find a need. This is a call to return basic user data but the only thing worth anything I can
588
  // think of right now would be making an option to show the media count. That would need to be a new option, worth adding in a future update. This call is duplicated and used to return info on the instagram options page though.
632
  // echo '<br/>asdfasdfasdf<pre>';
633
  // print_r( $insta_data );
634
  // echo '</pre>zzzz';
635
+ // $instagram_data_array['user_info'] = 'https://graph.instagram.com/me?fields=id,username,media_count,account_type&access_token=' . $fts_instagram_access_token_final;
636
  }
637
 
638
 
 
639
  $cache = 'instagram_cache_' . $instagram_id . '_num' . $pics_count . '';
640
  // First we make sure the feed is not cached already before trying to run the Instagram API.
641
  if ( false === $this->fts_check_feed_cache_exists( $cache ) ) {
646
 
647
  // Used for Testing Only.
648
  if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
649
+ esc_html_e( 'FINAL Array Check', 'feed-them-social' );
650
  echo '<br/><pre>';
651
  print_r( $error_check );
652
  echo '</pre>';
653
  }
654
  }
655
 
656
+ /*//$spencer_testing = 'true';
657
  if ( 'hashtag' === $type || 'user' === $type || !isset( $type ) ) {
658
+ echo $note = esc_html__( ' dddddddddCached', 'feed-them-social' );
659
  // If the feed is NOT cached then we run the cached array to display the feed.
660
  // Legacy API depreciation as of March 31st, 2020. SO we add a check here to by pass the cache and show an error message
661
  // letting users know they need to reconnect there account generate a new shortcode.
662
  if ( false !== $this->fts_check_feed_cache_exists( $cache ) && ! isset( $_GET['load_more_ajaxing'] ) && 'user' !== $type ) {
663
  $response = $this->fts_get_feed_cache( $cache );
664
  $insta_data = isset( $type ) && 'basic' === $type || 'business' === $type ? $insta_fb_data : json_decode( $response['data'] );
665
+ echo $note = esc_html__( ' dddddddddCached', 'feed-them-social' );
666
 
667
  } elseif ( isset( $error_check->error_message ) || isset( $error_check->meta->error_message ) || empty( $error_check ) || 'user' === $type || !isset( $type ) ) {
668
  // If the Instagram API array returns any error messages we check for them here and return the corresponding error message!
690
  $note = esc_html__( 'Not Cached', 'feed-them-social' );
691
  }
692
  }
693
+ }*/
694
 
695
  $instagram_user_info = ! empty( $response['user_info'] ) ? json_decode( $response['user_info'] ) : '';
696
  // URL to get Feeds.
720
 
721
  // ->pagination->next_url.
722
  if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
723
+ echo '888888888';
724
+ echo '<pre>';
725
  print_r( $response );
726
  echo '</pre>';
727
  }
1108
 
1109
  <div class="fts-insta-date-popup-grab">
1110
  <?php
1111
+ if ( 'no' === $hide_date_likes_comments ) {
1112
  echo esc_html( $instagram_date );
1113
  } else {
1114
  echo '&nbsp;'; }
includes/feed-them-functions.php CHANGED
@@ -3067,8 +3067,8 @@ if ( ! empty( $youtube_loadmore_text_color ) ) {
3067
  $fts_language_minute = esc_html__( 'minute', 'feed-them-social' );
3068
  }
3069
  $fts_language_minutes = get_option( 'fts_language_minutes' );
3070
- if ( empty( $fts_language_minute ) ) {
3071
- $fts_language_minute = esc_html__( 'minutes', 'feed-them-social' );
3072
  }
3073
  $fts_language_hour = get_option( 'fts_language_hour' );
3074
  if ( empty( $fts_language_hour ) ) {
@@ -3197,7 +3197,7 @@ if ( ! empty( $youtube_loadmore_text_color ) ) {
3197
  if ( 'one-day-ago' === $custom_date_check ) {
3198
  $u_time = $this->fts_ago( $created_time );
3199
  } else {
3200
- $u_time = ! empty( $custom_date_check ) ? date_i18n( $custom_date_check, $created_time ) : $this->fts_ago( $created_time );
3201
  }
3202
  }
3203
  // Youtube and Pinterest date time!
3067
  $fts_language_minute = esc_html__( 'minute', 'feed-them-social' );
3068
  }
3069
  $fts_language_minutes = get_option( 'fts_language_minutes' );
3070
+ if ( empty( $fts_language_minutes ) ) {
3071
+ $fts_language_minutes = esc_html__( 'minutes', 'feed-them-social' );
3072
  }
3073
  $fts_language_hour = get_option( 'fts_language_hour' );
3074
  if ( empty( $fts_language_hour ) ) {
3197
  if ( 'one-day-ago' === $custom_date_check ) {
3198
  $u_time = $this->fts_ago( $created_time );
3199
  } else {
3200
+ $u_time = ! empty( $custom_date_check ) ? date_i18n( $custom_date_check, strtotime( $created_time ) ) : $this->fts_ago( $created_time );
3201
  }
3202
  }
3203
  // Youtube and Pinterest date time!
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: slickremix, slickchris
3
  Tags: Facebook, Instagram, Twitter, YouTube, Feed
4
  Requires at least: 3.6.0
5
  Tested up to: 5.6.0
6
- Stable tag: 2.9.2
7
  License: GPLv2 or later
8
 
9
  Display a Custom Facebook feed, Instagram feed, Twitter feed, and YouTube feed on pages, posts or widgets.
@@ -72,6 +72,13 @@ Feed Them Social was Developed By SlickRemix --> [https://www.slickremix.com/](h
72
  * Log into WordPress dashboard then click **Plugins** > **Add new** > Then under the title "Install Plugins" click **Upload** > **choose the zip** > **Activate the plugin!**
73
 
74
  == Changelog ==
 
 
 
 
 
 
 
75
  = Version 2.9.2 Wednesday, January 6th, 2021 =
76
  * NOTE: Pinterest Feed: Removed options until Pinterest starts approving apps for the new API.
77
  * NEW: A feed-them-social.pot file is in the languages folder of our plugin along with our latest translatable strings.
3
  Tags: Facebook, Instagram, Twitter, YouTube, Feed
4
  Requires at least: 3.6.0
5
  Tested up to: 5.6.0
6
+ Stable tag: 2.9.3
7
  License: GPLv2 or later
8
 
9
  Display a Custom Facebook feed, Instagram feed, Twitter feed, and YouTube feed on pages, posts or widgets.
72
  * Log into WordPress dashboard then click **Plugins** > **Add new** > Then under the title "Install Plugins" click **Upload** > **choose the zip** > **Activate the plugin!**
73
 
74
  == Changelog ==
75
+ = Version 2.9.3 Wednesday, January 27th, 2021 =
76
+ * FIX: INSTAGRAM & FACEBOOK OPTIONS PAGE: #100 error was returning on tokens even though they were valid. FB changed the error text which resulted in the error message showing up instead of the success message.
77
+ * FIX: GLOBAL OPTIONS: Date Time was not working proper for Instagram if you chose something other than the 'One Day Ago' option. The text Minute or Minutes was not returning either for the 'One Day Ago' option.
78
+ * PREMIUM NEW: INSTAGRAM HASHTAG FEED: Timestamp is now added to media.
79
+ * PREMIUM FIX: INSTAGRAM HASHTAG FEED: Better caching.
80
+ * PREMIUM FIX: INSTAGRAM HASHTAG FEED: Video image was not displaying correctly.
81
+
82
  = Version 2.9.2 Wednesday, January 6th, 2021 =
83
  * NOTE: Pinterest Feed: Removed options until Pinterest starts approving apps for the new API.
84
  * NEW: A feed-them-social.pot file is in the languages folder of our plugin along with our latest translatable strings.