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

Version Description

Download this release

Release Info

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

Code changes from version 2.9.7.1 to 2.9.8

admin/class-fts-facebook-options-page.php CHANGED
@@ -20,14 +20,17 @@ namespace feedthemsocial;
20
  */
21
  class FTS_Facebook_Options_Page {
22
 
 
 
23
  /** * Construct
24
  *
25
  * Facebook Style Options Page constructor.
26
  *
27
  * @since 1.9.6
28
  */
29
- public function __construct() {
30
-
 
31
  }
32
 
33
  /**
@@ -113,14 +116,30 @@ class FTS_Facebook_Options_Page {
113
  </div>
114
  <a href="<?php echo esc_url( 'mailto:support@slickremix.com' ); ?>" target="_blank" class="fts-admin-button-no-work"><?php esc_html_e( 'Button not working?', 'feed-them-social' ); ?></a>
115
  <?php
116
- $test_app_token_id = get_option( 'fts_facebook_custom_api_token' );
117
- $test_app_token_id_biz = get_option( 'fts_facebook_custom_api_token_biz' );
118
- if ( ! empty( $test_app_token_id ) || ! empty( $test_app_token_id_biz ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  $test_app_token_url = array(
120
- 'app_token_id' => 'https://graph.facebook.com/debug_token?input_token=' . $test_app_token_id . '&access_token=' . $test_app_token_id,
121
  );
122
  $test_app_token_url_biz = array(
123
- 'app_token_id_biz' => 'https://graph.facebook.com/debug_token?input_token=' . $test_app_token_id_biz . '&access_token=' . $test_app_token_id_biz . '&',
 
124
  );
125
  $test_app_token_response = $fts_functions->fts_get_feed_json( $test_app_token_url );
126
  $test_app_token_response = json_decode( $test_app_token_response['app_token_id'] );
@@ -140,7 +159,9 @@ class FTS_Facebook_Options_Page {
140
  <?php esc_html_e( 'Access Token Required', 'feed-them-social' ); ?>
141
  </div>
142
 
143
- <input type="text" name="fts_facebook_custom_api_token" class="feed-them-social-admin-input" id="fts_facebook_custom_api_token" value="<?php echo esc_attr( get_option( 'fts_facebook_custom_api_token' ) ); ?>"/>
 
 
144
  <div class="clear"></div>
145
 
146
  <input type="text" hidden name="fts_facebook_custom_api_token_user_name" class="feed-them-social-admin-input" id="fts_facebook_custom_api_token_user_name" value="<?php echo esc_attr( get_option( 'fts_facebook_custom_api_token_user_name' ) ); ?>"/>
@@ -148,14 +169,15 @@ class FTS_Facebook_Options_Page {
148
 
149
  <div class="clear"></div>
150
  <?php
151
- if ( ! empty( $test_app_token_response ) && ! empty( $test_app_token_id ) ) {
 
152
  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 ) {
153
  $fb_id = get_option( 'fts_facebook_custom_api_token_user_id' );
154
  $fb_name = get_option( 'fts_facebook_custom_api_token_user_name' );
155
  echo '<div class="fts-successful-api-token fts-special-working-wrap">';
156
 
157
- if ( ! empty( $fb_id ) && ! empty( $fb_name ) && ! empty( $test_app_token_id ) ) {
158
- echo '<a href="' . esc_url( 'https://www.facebook.com/' . get_option( 'fts_facebook_custom_api_token_user_id' ) ) . '" target="_blank"><img border="0" height="50" width="50" class="fts-fb-page-thumb" src="' . get_option( 'fts_facebook_custom_api_token_profile_image' ) . '"/></a><h3><a href="' . esc_url( 'https://www.facebook.com/' . get_option( 'fts_facebook_custom_api_token_user_id' ) ) . '" target="_blank">' . esc_html( $fb_name ) . '</a></h3>';
159
  }
160
 
161
  echo sprintf(
@@ -166,7 +188,7 @@ class FTS_Facebook_Options_Page {
166
 
167
  echo '</div>';
168
  }
169
- 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 ) {
170
  if ( isset( $test_app_token_response->data->error->message ) ) {
171
  echo sprintf(
172
  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' ),
@@ -184,7 +206,7 @@ class FTS_Facebook_Options_Page {
184
  );
185
  }
186
 
187
- 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 ) ) {
188
  echo sprintf(
189
  esc_html__( '%1$sTo get started, please click the button above to retrieve your Access Token.%2$s', 'feed-them-social' ),
190
  '<div class="fts-failed-api-token get-started-message">',
@@ -259,36 +281,36 @@ class FTS_Facebook_Options_Page {
259
  <div class="feed-them-social-admin-input-label fts-twitter-border-bottom-color-label">
260
  <?php esc_html_e( 'Page Reviews Access Token', 'feed-them-social' ); ?>
261
  </div>
262
- <input type="text" name="fts_facebook_custom_api_token_biz" class="feed-them-social-admin-input" id="fts_facebook_custom_api_token_biz" value="<?php echo esc_attr( get_option( 'fts_facebook_custom_api_token_biz' ) ); ?>"/>
263
  <input type="text" hidden name="fts_facebook_custom_api_token_user_name_biz" class="feed-them-social-admin-input" id="fts_facebook_custom_api_token_user_name_biz" value="<?php echo esc_attr( get_option( 'fts_facebook_custom_api_token_user_name_biz' ) ); ?>"/>
264
  <input type="text" hidden name="fts_facebook_custom_api_token_biz_profile_image" class="feed-them-social-admin-input" id="fts_facebook_custom_api_token_biz_profile_image" value="<?php echo esc_attr( get_option( 'fts_facebook_custom_api_token_biz_profile_image' ) ); ?>"/>
265
  <div class="clear"></div>
266
 
267
  <?php
268
- if ( ! empty( $test_app_token_response_biz ) && ! empty( $test_app_token_id_biz ) ) {
269
  $fb_name_biz = get_option( 'fts_facebook_custom_api_token_user_name_biz' );
270
  $fb_id_biz = get_option( 'fts_facebook_custom_api_token_user_id_biz' );
271
  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' ) {
272
  echo '<div class="fts-successful-api-token fts-special-working-wrap">';
273
 
274
  // https://graph.facebook.com/' . $fb_id_biz . '/picture
275
- if ( ! empty( $fb_id_biz ) && ! empty( $fb_name_biz ) && ! empty( $test_app_token_id_biz ) ) {
276
- echo '<img border="0" height="50" width="50" class="fts-fb-page-thumb" src="' . get_option( 'fts_facebook_custom_api_token_biz_profile_image' ) . '"/><h3><a href="https://facebook.com/' . $test_app_token_id_biz . '" target="_blank">' . $fb_name_biz . '</a></h3>';
277
  }
278
  echo __( 'Your Page Reviews Access Token is now working! Generate your shortcode on the <a href="admin.php?page=feed-them-settings-page#feed_type=facebook_reviews">settings page</a>.', 'feed-them-social' ) . '</div>';
279
 
280
  }
281
 
282
- 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' ) {
283
  if ( isset( $test_app_token_response_biz->data->error->message ) ) {
284
  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>';
285
  }
286
- if ( isset( $test_app_token_response_biz->error->message ) && ! empty( $test_app_token_id_biz ) && ! isset( $_GET['return_long_lived_token'] ) ) {
287
  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>';
288
  }
289
  }
290
  }
291
- if ( ! isset( $_GET['reviews_token'] ) && empty( $test_app_token_id_biz ) ) {
292
  echo '<div class="fts-failed-api-token get-started-message">' . __( 'To get started, please click the button above to retrieve your Page Reviews Access Token.', 'feed-them-social' ) . '</div>';
293
  }
294
 
20
  */
21
  class FTS_Facebook_Options_Page {
22
 
23
+ public $data_protection;
24
+
25
  /** * Construct
26
  *
27
  * Facebook Style Options Page constructor.
28
  *
29
  * @since 1.9.6
30
  */
31
+ public function __construct( ) {
32
+ // Data Protection
33
+ $this->data_protection = new Data_Protection();
34
  }
35
 
36
  /**
116
  </div>
117
  <a href="<?php echo esc_url( 'mailto:support@slickremix.com' ); ?>" target="_blank" class="fts-admin-button-no-work"><?php esc_html_e( 'Button not working?', 'feed-them-social' ); ?></a>
118
  <?php
119
+
120
+ //Facebook Business.
121
+ $fb_custom_api_token = get_option( 'fts_facebook_custom_api_token' );
122
+ $fb_custom_encrypted = $this->data_protection->decrypt( $fb_custom_api_token );
123
+ $check_custom_token_value = false !== $fb_custom_encrypted ? $fb_custom_encrypted : $fb_custom_api_token;
124
+ $check_custom_encrypted = false !== $fb_custom_encrypted ? 'encrypted' : '';
125
+
126
+ //Facebook Business Reviews.
127
+ $fb_custom_api_token_biz = get_option( 'fts_facebook_custom_api_token_biz' );
128
+ $fb_custom_biz_encrypted = $this->data_protection->decrypt( $fb_custom_api_token_biz );
129
+ $check_custom_token_biz_value = false !== $fb_custom_biz_encrypted ? $fb_custom_biz_encrypted : $fb_custom_api_token_biz;
130
+ $check_custom_biz_encrypted = false !== $fb_custom_biz_encrypted ? 'encrypted' : '';
131
+
132
+ if ( ! empty( $fb_custom_api_token ) || ! empty( $fb_custom_api_token_biz ) ) {
133
+
134
+ $fb_custom_api_token = $check_custom_token_value;
135
+ $fb_custom_api_token_biz = $check_custom_token_biz_value;
136
+
137
  $test_app_token_url = array(
138
+ 'app_token_id' => 'https://graph.facebook.com/debug_token?input_token=' . $fb_custom_api_token . '&access_token=' . $fb_custom_api_token,
139
  );
140
  $test_app_token_url_biz = array(
141
+ 'app_token_id_biz' => 'https://graph.facebook.com/debug_token?input_token=' . $fb_custom_api_token_biz . '&access_token=' . $fb_custom_api_token_biz . '&',
142
+ /*'app_token_id' => 'https://graph.facebook.com/oauth/access_token?client_id=7054444020102908771&client_secret=7016612gg8c6a7b5424856282a5358f47b&grant_type=fb_exchange_token&fb_exchange_token=CAAKBNkjL3G2MBAK5jVUp1ZBCYCiLB8ZAdALWTEI4CesM8h3DeI4Jotngv4TKUsQZBwnbw9jiZCgyg0eEmlpiVauTsReKJWBgHe31xWCsbug1Tv3JhXZBEZBOdOIaz8iSZC6JVs4uc9RVjmyUq5H52w7IJVnxzcMuZBx4PThN3CfgKC5E4acJ9RnblrbKB37TBa1yumiPXDt72yiISKci7sqds0WFR3XsnkwQZD'*/
143
  );
144
  $test_app_token_response = $fts_functions->fts_get_feed_json( $test_app_token_url );
145
  $test_app_token_response = json_decode( $test_app_token_response['app_token_id'] );
159
  <?php esc_html_e( 'Access Token Required', 'feed-them-social' ); ?>
160
  </div>
161
 
162
+ <input type="text" name="fts_facebook_custom_api_token" class="feed-them-social-admin-input" id="fts_facebook_custom_api_token" data-token="<?php echo $check_custom_encrypted ?>" value="<?php echo $check_custom_token_value ?>" />
163
+
164
+
165
  <div class="clear"></div>
166
 
167
  <input type="text" hidden name="fts_facebook_custom_api_token_user_name" class="feed-them-social-admin-input" id="fts_facebook_custom_api_token_user_name" value="<?php echo esc_attr( get_option( 'fts_facebook_custom_api_token_user_name' ) ); ?>"/>
169
 
170
  <div class="clear"></div>
171
  <?php
172
+
173
+ if ( ! empty( $test_app_token_response ) && ! empty( $fb_custom_api_token ) ) {
174
  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 ) {
175
  $fb_id = get_option( 'fts_facebook_custom_api_token_user_id' );
176
  $fb_name = get_option( 'fts_facebook_custom_api_token_user_name' );
177
  echo '<div class="fts-successful-api-token fts-special-working-wrap">';
178
 
179
+ if ( ! empty( $fb_id ) && ! empty( $fb_name ) && ! empty( $fb_custom_api_token ) ) {
180
+ echo '<h3><a href="' . esc_url( 'https://www.facebook.com/' . get_option( 'fts_facebook_custom_api_token_user_id' ) ) . '" target="_blank">' . esc_html( $fb_name ) . '</a></h3>';
181
  }
182
 
183
  echo sprintf(
188
 
189
  echo '</div>';
190
  }
191
+ if ( isset( $test_app_token_response->data->error->message ) && ! empty( $fb_custom_api_token ) || isset( $test_app_token_response->error->message ) && ! empty( $fb_custom_api_token ) && '(#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 ) {
192
  if ( isset( $test_app_token_response->data->error->message ) ) {
193
  echo sprintf(
194
  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' ),
206
  );
207
  }
208
 
209
+ if ( isset( $test_app_token_response->data->error->message ) && empty( $fb_custom_api_token ) || isset( $test_app_token_response->error->message ) && empty( $fb_custom_api_token ) ) {
210
  echo sprintf(
211
  esc_html__( '%1$sTo get started, please click the button above to retrieve your Access Token.%2$s', 'feed-them-social' ),
212
  '<div class="fts-failed-api-token get-started-message">',
281
  <div class="feed-them-social-admin-input-label fts-twitter-border-bottom-color-label">
282
  <?php esc_html_e( 'Page Reviews Access Token', 'feed-them-social' ); ?>
283
  </div>
284
+ <input type="text" name="fts_facebook_custom_api_token_biz" class="feed-them-social-admin-input" id="fts_facebook_custom_api_token_biz" data-token="<?php echo $check_custom_biz_encrypted ?>" value="<?php echo $check_custom_token_biz_value ?>" />
285
  <input type="text" hidden name="fts_facebook_custom_api_token_user_name_biz" class="feed-them-social-admin-input" id="fts_facebook_custom_api_token_user_name_biz" value="<?php echo esc_attr( get_option( 'fts_facebook_custom_api_token_user_name_biz' ) ); ?>"/>
286
  <input type="text" hidden name="fts_facebook_custom_api_token_biz_profile_image" class="feed-them-social-admin-input" id="fts_facebook_custom_api_token_biz_profile_image" value="<?php echo esc_attr( get_option( 'fts_facebook_custom_api_token_biz_profile_image' ) ); ?>"/>
287
  <div class="clear"></div>
288
 
289
  <?php
290
+ if ( ! empty( $test_app_token_response_biz ) && ! empty( $fb_custom_api_token_biz ) ) {
291
  $fb_name_biz = get_option( 'fts_facebook_custom_api_token_user_name_biz' );
292
  $fb_id_biz = get_option( 'fts_facebook_custom_api_token_user_id_biz' );
293
  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' ) {
294
  echo '<div class="fts-successful-api-token fts-special-working-wrap">';
295
 
296
  // https://graph.facebook.com/' . $fb_id_biz . '/picture
297
+ if ( ! empty( $fb_id_biz ) && ! empty( $fb_name_biz ) && ! empty( $fb_custom_api_token_biz ) ) {
298
+ echo '<h3><a href="https://facebook.com/' . $fb_custom_api_token_biz . '" target="_blank">' . $fb_name_biz . '</a></h3>';
299
  }
300
  echo __( 'Your Page Reviews Access Token is now working! Generate your shortcode on the <a href="admin.php?page=feed-them-settings-page#feed_type=facebook_reviews">settings page</a>.', 'feed-them-social' ) . '</div>';
301
 
302
  }
303
 
304
+ if ( isset( $test_app_token_response_biz->data->error->message ) && ! empty( $fb_custom_api_token_biz ) || isset( $test_app_token_response_biz->error->message ) && ! empty( $fb_custom_api_token ) && $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' ) {
305
  if ( isset( $test_app_token_response_biz->data->error->message ) ) {
306
  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>';
307
  }
308
+ if ( isset( $test_app_token_response_biz->error->message ) && ! empty( $fb_custom_api_token_biz ) && ! isset( $_GET['return_long_lived_token'] ) ) {
309
  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>';
310
  }
311
  }
312
  }
313
+ if ( ! isset( $_GET['reviews_token'] ) && empty( $fb_custom_api_token_biz ) ) {
314
  echo '<div class="fts-failed-api-token get-started-message">' . __( 'To get started, please click the button above to retrieve your Page Reviews Access Token.', 'feed-them-social' ) . '</div>';
315
  }
316
 
admin/class-fts-instagram-options-page.php CHANGED
@@ -20,6 +20,8 @@ namespace feedthemsocial;
20
  */
21
  class FTS_Instagram_Options_Page {
22
 
 
 
23
  /**
24
  * Construct
25
  *
@@ -28,6 +30,8 @@ class FTS_Instagram_Options_Page {
28
  * @since 1.9.6
29
  */
30
  public function __construct() {
 
 
31
  }
32
 
33
 
@@ -38,34 +42,40 @@ class FTS_Instagram_Options_Page {
38
  */
39
  public function feed_them_instagram_options_page() {
40
  $fts_functions = new feed_them_social_functions();
 
41
  $fts_instagram_access_token = get_option( 'fts_instagram_custom_api_token' );
42
  $fts_instagram_custom_id = get_option( 'fts_instagram_custom_id' );
43
  $fts_instagram_show_follow_btn = get_option( 'instagram_show_follow_btn' );
44
  $fts_instagram_show_follow_btn_where = get_option( 'instagram_show_follow_btn_where' );
45
  $user_id_basic = isset( $_GET['code'], $_GET['feed_type'] ) && 'instagram_basic' === $_GET['feed_type'] ? sanitize_text_field( $_GET['user_id'] ) : $fts_instagram_custom_id;
46
- $access_token_basic = isset( $_GET['code'], $_GET['feed_type'] ) && 'instagram_basic' === $_GET['feed_type'] ? sanitize_text_field( $_GET['code'] ) : get_option( 'fts_instagram_custom_api_token' );
47
  $access_token = isset( $_GET['code'], $_GET['feed_type'] ) && 'original_instagram' === $_GET['feed_type'] ? sanitize_text_field( $_GET['code'] ) : $access_token_basic;
48
 
49
- if ( isset( $_GET['code'] ) ) { ?>
50
- <script>
51
- jQuery(document).ready(function ($) {
52
-
53
- $('#fts_instagram_custom_api_token').val('');
54
- $('#fts_instagram_custom_api_token').val($('#fts_instagram_custom_api_token').val() + '<?php echo esc_js( $access_token ); ?>');
55
 
56
- <?php if ( 'original_instagram' === $_GET['feed_type'] ){ ?>
57
- $('#fts_instagram_custom_id').val('');
58
- var str = '<?php echo esc_js( $access_token ); ?>';
59
- $('#fts_instagram_custom_id').val($('#fts_instagram_custom_id').val() + str.split('.', 1));
60
- <?php }
61
- elseif ( 'instagram_basic' === $_GET['feed_type'] ){ ?>
62
 
63
- $('#fts_instagram_custom_id').val('');
64
- $('#fts_instagram_custom_id').val($('#fts_instagram_custom_id').val() + '<?php echo esc_js( $user_id_basic ); ?>');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  <?php } ?>
66
  });
67
  </script>
68
- <?php } ?>
69
  <div class="feed-them-social-admin-wrap">
70
  <h1>
71
  <?php esc_html_e( 'Instagram Feed Options', 'feed-them-social' ); ?>
@@ -96,7 +106,7 @@ class FTS_Instagram_Options_Page {
96
  settings_fields( 'fts-instagram-feed-style-options' );
97
  ?>
98
  <h3>
99
- <?php esc_html_e( 'Instagram Basic', 'feed-them-social' ); ?>
100
  </h3>
101
  <?php
102
 
@@ -131,7 +141,6 @@ class FTS_Instagram_Options_Page {
131
 
132
  ?>
133
 
134
-
135
  <a href="<?php echo esc_url( 'mailto:support@slickremix.com' ); ?>" class="fts-admin-button-no-work" style="margin-top: 14px; display: inline-block"><?php esc_html_e( 'Button not working?', 'feed-them-social' ); ?></a>
136
  </div>
137
  <div class="fts-clear"></div>
@@ -147,6 +156,11 @@ class FTS_Instagram_Options_Page {
147
  <div class="feed-them-social-admin-input-wrap">
148
  <div class="feed-them-social-admin-input-label fts-instagram-border-bottom-color-label">
149
  <?php
 
 
 
 
 
150
  esc_html_e( 'Access Token Required', 'feed-them-social' );
151
 
152
  if ( isset( $_GET['code'], $_GET['feed_type'] ) && 'original_instagram' === $_GET['feed_type'] || isset( $_GET['code'], $_GET['feed_type'] ) && 'instagram_basic' === $_GET['feed_type'] ) {
@@ -156,7 +170,7 @@ class FTS_Instagram_Options_Page {
156
  ?>
157
  </div>
158
 
159
- <input type="text" name="fts_instagram_custom_api_token" class="feed-them-social-admin-input" id="fts_instagram_custom_api_token" value="<?php echo esc_attr( $access_token ); ?>"/>
160
  <div class="fts-clear"></div>
161
  </div>
162
 
@@ -219,7 +233,7 @@ class FTS_Instagram_Options_Page {
219
  <div id="fb-token-master-wrap" class="feed-them-social-admin-input-wrap" >
220
  <div class="fts-title-description-settings-page">
221
  <h3>
222
- <?php esc_html_e( 'Instagram Business', 'feed-them-social' ); ?>
223
  </h3>
224
  <?php
225
  echo sprintf(
@@ -250,9 +264,15 @@ class FTS_Instagram_Options_Page {
250
  </div>
251
  <a href="<?php echo esc_url( 'mailto:support@slickremix.com' ); ?>" target="_blank" class="fts-admin-button-no-work"><?php esc_html_e( 'Button not working?', 'feed-them-social' ); ?></a>
252
  <?php
253
- $test_app_token_id = get_option( 'fts_facebook_instagram_custom_api_token' );
 
 
 
 
254
  if ( ! empty( $test_app_token_id ) || ! empty( $test_app_token_id_biz ) ) {
255
 
 
 
256
  $test_app_token_url = array(
257
  'app_token_id' => 'https://graph.facebook.com/debug_token?input_token=' . $test_app_token_id . '&access_token=' . $test_app_token_id,
258
  );
@@ -278,7 +298,7 @@ class FTS_Instagram_Options_Page {
278
  <?php esc_html_e( 'Access Token Required', 'feed-them-social' ); ?>
279
  </div>
280
 
281
- <input type="text" name="fts_facebook_instagram_custom_api_token" class="feed-them-social-admin-input" id="fts_facebook_instagram_custom_api_token" value="<?php echo esc_attr( get_option( 'fts_facebook_instagram_custom_api_token' ) ); ?>"/>
282
  <div class="clear"></div>
283
 
284
  <input type="text" hidden name="fts_facebook_instagram_custom_api_token_user_name" class="feed-them-social-admin-input" id="fts_facebook_instagram_custom_api_token_user_name" value="<?php echo esc_attr( get_option( 'fts_facebook_instagram_custom_api_token_user_name' ) ); ?>"/>
@@ -286,14 +306,15 @@ class FTS_Instagram_Options_Page {
286
 
287
  <div class="clear"></div>
288
  <?php
289
- if ( ! empty( $test_app_token_response ) && ! empty( $test_app_token_id ) ) {
 
290
  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 ) {
291
  $fb_id = get_option( 'fts_facebook_instagram_custom_api_token_user_id' );
292
  $fb_name = get_option( 'fts_facebook_instagram_custom_api_token_user_name' );
293
  echo '<div class="fts-successful-api-token fts-special-working-wrap">';
294
 
295
- if ( ! empty( $fb_id ) && ! empty( $fb_name ) && ! empty( $test_app_token_id ) ) {
296
- echo '<a href="' . esc_url( 'https://www.facebook.com/' . get_option( 'fts_facebook_instagram_custom_api_token_user_id' ) ) . '" target="_blank"><img border="0" height="50" width="50" class="fts-fb-page-thumb" src="' . get_option( 'fts_facebook_instagram_custom_api_token_profile_image' ) . '"/></a><h3><a href="' . esc_url( 'https://www.facebook.com/' . get_option( 'fts_facebook_custom_api_token_user_id' ) ) . '" target="_blank">' . wp_kses(
297
  $fb_name,
298
  array(
299
  'span' => array(
@@ -364,10 +385,6 @@ class FTS_Instagram_Options_Page {
364
  </div>
365
  <!--/fts-facebook-feed-styles-input-wrap-->
366
 
367
-
368
-
369
-
370
-
371
  <div class="feed-them-social-admin-input-wrap">
372
  <div class="fts-title-description-settings-page">
373
  <h3>
20
  */
21
  class FTS_Instagram_Options_Page {
22
 
23
+ public $data_protection;
24
+
25
  /**
26
  * Construct
27
  *
30
  * @since 1.9.6
31
  */
32
  public function __construct() {
33
+ // Data Protection
34
+ $this->data_protection = new Data_Protection();
35
  }
36
 
37
 
42
  */
43
  public function feed_them_instagram_options_page() {
44
  $fts_functions = new feed_them_social_functions();
45
+
46
  $fts_instagram_access_token = get_option( 'fts_instagram_custom_api_token' );
47
  $fts_instagram_custom_id = get_option( 'fts_instagram_custom_id' );
48
  $fts_instagram_show_follow_btn = get_option( 'instagram_show_follow_btn' );
49
  $fts_instagram_show_follow_btn_where = get_option( 'instagram_show_follow_btn_where' );
50
  $user_id_basic = isset( $_GET['code'], $_GET['feed_type'] ) && 'instagram_basic' === $_GET['feed_type'] ? sanitize_text_field( $_GET['user_id'] ) : $fts_instagram_custom_id;
51
+ $access_token_basic = isset( $_GET['code'], $_GET['feed_type'] ) && 'instagram_basic' === $_GET['feed_type'] ? sanitize_text_field( $_GET['code'] ) : $fts_instagram_access_token;
52
  $access_token = isset( $_GET['code'], $_GET['feed_type'] ) && 'original_instagram' === $_GET['feed_type'] ? sanitize_text_field( $_GET['code'] ) : $access_token_basic;
53
 
 
 
 
 
 
 
54
 
 
 
 
 
 
 
55
 
56
+ ?>
57
+ <script>
58
+ jQuery(document).ready(function ($) {
59
+ <?php if ( isset( $_GET['code'], $_GET['feed_type'] ) && 'instagram_basic' === $_GET['feed_type'] ) {
60
+ $code_token = sanitize_text_field( $_GET['code'] );
61
+ ?>
62
+ $('#fts_instagram_custom_api_token').val('');
63
+ $('#fts_instagram_custom_api_token').val($('#fts_instagram_custom_api_token').val() + '<?php echo esc_js( $code_token ); ?>');
64
+
65
+ <?php if ( 'original_instagram' === $_GET['feed_type'] ){ ?>
66
+ $('#fts_instagram_custom_id').val('');
67
+ var str = '<?php echo esc_js( $code_token ); ?>';
68
+ $('#fts_instagram_custom_id').val($('#fts_instagram_custom_id').val() + str.split('.', 1));
69
+ <?php }
70
+ elseif ( 'instagram_basic' === $_GET['feed_type'] ){ ?>
71
+
72
+ $('#fts_instagram_custom_id').val('');
73
+ $('#fts_instagram_custom_id').val($('#fts_instagram_custom_id').val() + '<?php echo esc_js( $user_id_basic ); ?>');
74
+ <?php } ?>
75
  <?php } ?>
76
  });
77
  </script>
78
+
79
  <div class="feed-them-social-admin-wrap">
80
  <h1>
81
  <?php esc_html_e( 'Instagram Feed Options', 'feed-them-social' ); ?>
106
  settings_fields( 'fts-instagram-feed-style-options' );
107
  ?>
108
  <h3>
109
+ <?php esc_html_e( 'Instagram Basic API Token', 'feed-them-social' ); ?>
110
  </h3>
111
  <?php
112
 
141
 
142
  ?>
143
 
 
144
  <a href="<?php echo esc_url( 'mailto:support@slickremix.com' ); ?>" class="fts-admin-button-no-work" style="margin-top: 14px; display: inline-block"><?php esc_html_e( 'Button not working?', 'feed-them-social' ); ?></a>
145
  </div>
146
  <div class="fts-clear"></div>
156
  <div class="feed-them-social-admin-input-wrap">
157
  <div class="feed-them-social-admin-input-label fts-instagram-border-bottom-color-label">
158
  <?php
159
+
160
+ $check_token = get_option( 'fts_instagram_custom_api_token' );
161
+ $check_basic_token_value = false !== $this->data_protection->decrypt( $check_token ) ? $this->data_protection->decrypt( $check_token ) : $check_token;
162
+ $check_basic_encrypted = false !== $this->data_protection->decrypt( $check_token ) ? 'encrypted' : '';
163
+
164
  esc_html_e( 'Access Token Required', 'feed-them-social' );
165
 
166
  if ( isset( $_GET['code'], $_GET['feed_type'] ) && 'original_instagram' === $_GET['feed_type'] || isset( $_GET['code'], $_GET['feed_type'] ) && 'instagram_basic' === $_GET['feed_type'] ) {
170
  ?>
171
  </div>
172
 
173
+ <input type="text" name="fts_instagram_custom_api_token" class="feed-them-social-admin-input" id="fts_instagram_custom_api_token" data-token="<?php echo $check_basic_encrypted ?>" value="<?php echo $check_basic_token_value ?>"/>
174
  <div class="fts-clear"></div>
175
  </div>
176
 
233
  <div id="fb-token-master-wrap" class="feed-them-social-admin-input-wrap" >
234
  <div class="fts-title-description-settings-page">
235
  <h3>
236
+ <?php esc_html_e( 'Instagram Business API Token', 'feed-them-social' ); ?>
237
  </h3>
238
  <?php
239
  echo sprintf(
264
  </div>
265
  <a href="<?php echo esc_url( 'mailto:support@slickremix.com' ); ?>" target="_blank" class="fts-admin-button-no-work"><?php esc_html_e( 'Button not working?', 'feed-them-social' ); ?></a>
266
  <?php
267
+
268
+ $test_app_token_id_biz = get_option( 'fts_facebook_instagram_custom_api_token' );
269
+ $check_biz_token_value = false !== $this->data_protection->decrypt( $test_app_token_id_biz ) ? $this->data_protection->decrypt( $test_app_token_id_biz ) : $test_app_token_id_biz;
270
+ $check_biz_encrypted = false !== $this->data_protection->decrypt( $test_app_token_id_biz ) ? 'encrypted' : '';
271
+
272
  if ( ! empty( $test_app_token_id ) || ! empty( $test_app_token_id_biz ) ) {
273
 
274
+ $test_app_token_id = $check_biz_token_value;
275
+
276
  $test_app_token_url = array(
277
  'app_token_id' => 'https://graph.facebook.com/debug_token?input_token=' . $test_app_token_id . '&access_token=' . $test_app_token_id,
278
  );
298
  <?php esc_html_e( 'Access Token Required', 'feed-them-social' ); ?>
299
  </div>
300
 
301
+ <input type="text" name="fts_facebook_instagram_custom_api_token" class="feed-them-social-admin-input" id="fts_facebook_instagram_custom_api_token" data-token="<?php echo $check_biz_encrypted ?>" value="<?php echo $check_biz_token_value ?>" />
302
  <div class="clear"></div>
303
 
304
  <input type="text" hidden name="fts_facebook_instagram_custom_api_token_user_name" class="feed-them-social-admin-input" id="fts_facebook_instagram_custom_api_token_user_name" value="<?php echo esc_attr( get_option( 'fts_facebook_instagram_custom_api_token_user_name' ) ); ?>"/>
306
 
307
  <div class="clear"></div>
308
  <?php
309
+ if ( ! empty( $test_app_token_response ) && ! empty( $test_app_token_id_biz ) ) {
310
+
311
  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 ) {
312
  $fb_id = get_option( 'fts_facebook_instagram_custom_api_token_user_id' );
313
  $fb_name = get_option( 'fts_facebook_instagram_custom_api_token_user_name' );
314
  echo '<div class="fts-successful-api-token fts-special-working-wrap">';
315
 
316
+ if ( ! empty( $fb_id ) && ! empty( $fb_name ) && ! empty( $test_app_token_id_biz ) ) {
317
+ echo '<h3><a href="' . esc_url( 'https://www.facebook.com/' . get_option( 'fts_facebook_custom_api_token_user_id' ) ) . '" target="_blank">' . wp_kses(
318
  $fb_name,
319
  array(
320
  'span' => array(
385
  </div>
386
  <!--/fts-facebook-feed-styles-input-wrap-->
387
 
 
 
 
 
388
  <div class="feed-them-social-admin-input-wrap">
389
  <div class="fts-title-description-settings-page">
390
  <h3>
admin/class-fts-settings-page.php CHANGED
@@ -20,6 +20,8 @@ namespace feedthemsocial;
20
  */
21
  class FTS_Settings_Page {
22
 
 
 
23
  /**
24
  * Construct
25
  *
@@ -28,7 +30,9 @@ class FTS_Settings_Page {
28
  * @since 1.9.6
29
  */
30
  public function __construct() {
31
- }
 
 
32
 
33
  /**
34
  * Feed Them Settings Page
@@ -47,8 +51,8 @@ class FTS_Settings_Page {
47
  $fts_fb_options_nonce = wp_create_nonce( 'fts-settings-page-nonce' );
48
 
49
  if ( wp_verify_nonce( $fts_fb_options_nonce, 'fts-settings-page-nonce' ) ) {
50
- ?>
51
 
 
52
  <div class="feed-them-social-admin-wrap">
53
  <div class="fts-backg"></div>
54
  <div class="fts-content">
@@ -191,6 +195,10 @@ class FTS_Settings_Page {
191
  echo '<div class="feed-them-clear-cache-text">' . esc_html( $fts_functions->feed_them_clear_cache() ) . '</div>';
192
  }
193
 
 
 
 
 
194
  $fts_dev_mode_cache = null !== get_option( 'fts_clear_cache_developer_mode' ) ? get_option( 'fts_clear_cache_developer_mode' ) : '900';
195
  $fts_admin_bar_menu = get_option( 'fts_admin_bar_menu' );
196
  ?>
@@ -198,6 +206,10 @@ class FTS_Settings_Page {
198
  <form method="post" action="?page=feed-them-settings-page&cache=clearcache&tab=global_options">
199
  <input class="feed-them-social-admin-submit-btn" type="submit" value="<?php echo esc_html__( 'Clear All FTS Feeds Cache', 'feed-them-social' ); ?>"/>
200
  </form>
 
 
 
 
201
  </div><!--/feed-them-clear-cache-->
202
  <!-- custom option for padding -->
203
  <form method="post" class="fts-color-settings-admin-form" action="options.php">
@@ -1067,22 +1079,33 @@ class FTS_Settings_Page {
1067
  );
1068
  }
1069
 
 
 
 
 
 
 
 
 
 
 
 
1070
  if (window.location.hash && getQueryString('feed_type') == 'instagram') {
1071
  jQuery('#feed-selector-form').find('option[value=instagram-shortcode-form]').attr('selected', 'selected');
1072
  jQuery('.shortcode-generator-form.instagram-shortcode-form').show();
1073
  jQuery('#instagram_id').val(jQuery('#instagram_id').val() + '<?php echo esc_js( get_option( 'fts_instagram_custom_id' ) ); ?>');
1074
- jQuery('#insta_access_token').val(jQuery('#insta_access_token').val() + '<?php echo esc_js( get_option( 'fts_instagram_custom_api_token' ) ); ?>');
1075
  }
1076
 
1077
  jQuery('#shortcode-form-selector, #instagram-messages-selector').bind('change', function (e) {
1078
  if (jQuery('#instagram-messages-selector').val() == 'basic') {
1079
  jQuery('#instagram_id, #insta_access_token').val('');
1080
  jQuery('#instagram_id').val(jQuery('#instagram_id').val() + '<?php echo esc_js( get_option( 'fts_instagram_custom_id' ) ); ?>');
1081
- jQuery('#insta_access_token').val(jQuery('#insta_access_token').val() + '<?php echo esc_js( get_option( 'fts_instagram_custom_api_token' ) ); ?>');
1082
  }
1083
  else if (jQuery('#instagram-messages-selector').val() == 'hashtag' || jQuery('#instagram-messages-selector').val() == 'business') {
1084
  jQuery('#instagram_id').val('<?php echo esc_js( get_option( 'fts_facebook_instagram_custom_api_token_user_id' ) ); ?>');
1085
- jQuery('#insta_access_token').val('<?php echo esc_js( get_option( 'fts_facebook_instagram_custom_api_token' ) ); ?>');
1086
  }
1087
  else {
1088
  jQuery('#instagram_id').val('');
@@ -1094,14 +1117,14 @@ class FTS_Settings_Page {
1094
  jQuery('#feed-selector-form').find('option[value=fts-fb-page-shortcode-form]').attr('selected', 'selected');
1095
  jQuery('#fts-tab-content1 .fts-fb-page-shortcode-form').show();
1096
  jQuery('#fb_page_id').val(jQuery('#fb_page_id').val() + '<?php echo esc_js( get_option( 'fts_facebook_custom_api_token_user_id' ) ); ?>');
1097
- jQuery('#fb_access_token').val(jQuery('#fb_access_token').val() + '<?php echo esc_js( get_option( 'fts_facebook_custom_api_token' ) ); ?>');
1098
  }
1099
 
1100
  jQuery('#shortcode-form-selector, #facebook-messages-selector').bind('change', function (e) {
1101
  if (jQuery('#facebook-messages-selector').val() == 'page' || jQuery('#facebook-messages-selector').val() == 'album_photos' || jQuery('#facebook-messages-selector').val() == 'albums' || jQuery('#facebook-messages-selector').val() == 'album_videos') {
1102
  jQuery('#fb_page_id, #fb_access_token').val('');
1103
  jQuery('#fb_page_id').val(jQuery('#fb_page_id').val() + '<?php echo esc_js( get_option( 'fts_facebook_custom_api_token_user_id' ) ); ?>');
1104
- jQuery('#fb_access_token').val(jQuery('#fb_access_token').val() + '<?php echo esc_js( get_option( 'fts_facebook_custom_api_token' ) ); ?>');
1105
  }
1106
  else {
1107
 
@@ -1119,14 +1142,14 @@ class FTS_Settings_Page {
1119
  jQuery('.align-images-wrap,.facebook-title-options-wrap, .facebook-popup-wrap, .fts-required-more-posts, .fts-required-more-posts, .inst-text-facebook-page').hide();
1120
 
1121
  jQuery('#fb_page_id').val(jQuery('#fb_page_id').val() + '<?php echo esc_js( get_option( 'fts_facebook_custom_api_token_user_id_biz' ) ); ?>');
1122
- jQuery('#fb_access_token').val(jQuery('#fb_access_token').val() + '<?php echo esc_js( get_option( 'fts_facebook_custom_api_token_biz' ) ); ?>');
1123
  }
1124
 
1125
  jQuery('#shortcode-form-selector, #facebook-messages-selector').bind('change', function (e) {
1126
  if (jQuery('#facebook-messages-selector').val() == 'reviews') {
1127
  jQuery('#fb_page_id, #fb_access_token').val('');
1128
  jQuery('#fb_page_id').val(jQuery('#fb_page_id').val() + '<?php echo esc_js( get_option( 'fts_facebook_custom_api_token_user_id_biz' ) ); ?>');
1129
- jQuery('#fb_access_token').val(jQuery('#fb_access_token').val() + '<?php echo esc_js( get_option( 'fts_facebook_custom_api_token_biz' ) ); ?>');
1130
  }
1131
  else {
1132
 
20
  */
21
  class FTS_Settings_Page {
22
 
23
+ public $data_protection;
24
+
25
  /**
26
  * Construct
27
  *
30
  * @since 1.9.6
31
  */
32
  public function __construct() {
33
+ // Data Protection
34
+ $this->data_protection = new Data_Protection();
35
+ }
36
 
37
  /**
38
  * Feed Them Settings Page
51
  $fts_fb_options_nonce = wp_create_nonce( 'fts-settings-page-nonce' );
52
 
53
  if ( wp_verify_nonce( $fts_fb_options_nonce, 'fts-settings-page-nonce' ) ) {
 
54
 
55
+ ?>
56
  <div class="feed-them-social-admin-wrap">
57
  <div class="fts-backg"></div>
58
  <div class="fts-content">
195
  echo '<div class="feed-them-clear-cache-text">' . esc_html( $fts_functions->feed_them_clear_cache() ) . '</div>';
196
  }
197
 
198
+ if ( isset( $_GET['cache'] ) && 'clearftsadmincache' === $_GET['cache'] ) {
199
+ echo '<div class="feed-them-clear-cache-text">' . esc_html( $fts_functions->feed_them_clear_admin_cache() ) . '</div>';
200
+ }
201
+
202
  $fts_dev_mode_cache = null !== get_option( 'fts_clear_cache_developer_mode' ) ? get_option( 'fts_clear_cache_developer_mode' ) : '900';
203
  $fts_admin_bar_menu = get_option( 'fts_admin_bar_menu' );
204
  ?>
206
  <form method="post" action="?page=feed-them-settings-page&cache=clearcache&tab=global_options">
207
  <input class="feed-them-social-admin-submit-btn" type="submit" value="<?php echo esc_html__( 'Clear All FTS Feeds Cache', 'feed-them-social' ); ?>"/>
208
  </form>
209
+
210
+ <form style="display: none" method="post" action="?page=feed-them-settings-page&cache=clearftsadmincache&tab=global_options">
211
+ <input class="feed-them-social-admin-submit-btn" type="submit" value="<?php echo esc_html__( 'Clear All FTS Admin Options Cache', 'feed-them-social' ); ?>"/>
212
+ </form>
213
  </div><!--/feed-them-clear-cache-->
214
  <!-- custom option for padding -->
215
  <form method="post" class="fts-color-settings-admin-form" action="options.php">
1079
  );
1080
  }
1081
 
1082
+ <?php
1083
+ // Instagram Access Token.
1084
+ $ig_custom_api_token = $fts_functions->get_fts_instagram_custom_api_token();
1085
+ // Facebook Access Token.
1086
+ $fb_custom_api_token = $fts_functions->get_fb_access_token();
1087
+ // Facebook BIZ Access Token.
1088
+ $fb_custom_api_token_biz = $fts_functions->get_fb_biz_access_token();
1089
+ // Facebook/Instagram biz token.
1090
+ $fb_ig_custom_api_token_biz = $fts_functions->get_ig_fb_biz_access_token();
1091
+
1092
+ ?>
1093
  if (window.location.hash && getQueryString('feed_type') == 'instagram') {
1094
  jQuery('#feed-selector-form').find('option[value=instagram-shortcode-form]').attr('selected', 'selected');
1095
  jQuery('.shortcode-generator-form.instagram-shortcode-form').show();
1096
  jQuery('#instagram_id').val(jQuery('#instagram_id').val() + '<?php echo esc_js( get_option( 'fts_instagram_custom_id' ) ); ?>');
1097
+ jQuery('#insta_access_token').val(jQuery('#insta_access_token').val() + '<?php echo esc_js( $ig_custom_api_token ); ?>');
1098
  }
1099
 
1100
  jQuery('#shortcode-form-selector, #instagram-messages-selector').bind('change', function (e) {
1101
  if (jQuery('#instagram-messages-selector').val() == 'basic') {
1102
  jQuery('#instagram_id, #insta_access_token').val('');
1103
  jQuery('#instagram_id').val(jQuery('#instagram_id').val() + '<?php echo esc_js( get_option( 'fts_instagram_custom_id' ) ); ?>');
1104
+ jQuery('#insta_access_token').val(jQuery('#insta_access_token').val() + '<?php echo esc_js( $ig_custom_api_token ); ?>');
1105
  }
1106
  else if (jQuery('#instagram-messages-selector').val() == 'hashtag' || jQuery('#instagram-messages-selector').val() == 'business') {
1107
  jQuery('#instagram_id').val('<?php echo esc_js( get_option( 'fts_facebook_instagram_custom_api_token_user_id' ) ); ?>');
1108
+ jQuery('#insta_access_token').val('<?php echo esc_js( $fb_ig_custom_api_token_biz ); ?>');
1109
  }
1110
  else {
1111
  jQuery('#instagram_id').val('');
1117
  jQuery('#feed-selector-form').find('option[value=fts-fb-page-shortcode-form]').attr('selected', 'selected');
1118
  jQuery('#fts-tab-content1 .fts-fb-page-shortcode-form').show();
1119
  jQuery('#fb_page_id').val(jQuery('#fb_page_id').val() + '<?php echo esc_js( get_option( 'fts_facebook_custom_api_token_user_id' ) ); ?>');
1120
+ jQuery('#fb_access_token').val(jQuery('#fb_access_token').val() + '<?php echo esc_js( $fb_custom_api_token ); ?>');
1121
  }
1122
 
1123
  jQuery('#shortcode-form-selector, #facebook-messages-selector').bind('change', function (e) {
1124
  if (jQuery('#facebook-messages-selector').val() == 'page' || jQuery('#facebook-messages-selector').val() == 'album_photos' || jQuery('#facebook-messages-selector').val() == 'albums' || jQuery('#facebook-messages-selector').val() == 'album_videos') {
1125
  jQuery('#fb_page_id, #fb_access_token').val('');
1126
  jQuery('#fb_page_id').val(jQuery('#fb_page_id').val() + '<?php echo esc_js( get_option( 'fts_facebook_custom_api_token_user_id' ) ); ?>');
1127
+ jQuery('#fb_access_token').val(jQuery('#fb_access_token').val() + '<?php echo esc_js( $fb_custom_api_token ); ?>');
1128
  }
1129
  else {
1130
 
1142
  jQuery('.align-images-wrap,.facebook-title-options-wrap, .facebook-popup-wrap, .fts-required-more-posts, .fts-required-more-posts, .inst-text-facebook-page').hide();
1143
 
1144
  jQuery('#fb_page_id').val(jQuery('#fb_page_id').val() + '<?php echo esc_js( get_option( 'fts_facebook_custom_api_token_user_id_biz' ) ); ?>');
1145
+ jQuery('#fb_access_token').val(jQuery('#fb_access_token').val() + '<?php echo esc_js( $fb_custom_api_token_biz ); ?>');
1146
  }
1147
 
1148
  jQuery('#shortcode-form-selector, #facebook-messages-selector').bind('change', function (e) {
1149
  if (jQuery('#facebook-messages-selector').val() == 'reviews') {
1150
  jQuery('#fb_page_id, #fb_access_token').val('');
1151
  jQuery('#fb_page_id').val(jQuery('#fb_page_id').val() + '<?php echo esc_js( get_option( 'fts_facebook_custom_api_token_user_id_biz' ) ); ?>');
1152
+ jQuery('#fb_access_token').val(jQuery('#fb_access_token').val() + '<?php echo esc_js( $fb_custom_api_token_biz ); ?>');
1153
  }
1154
  else {
1155
 
admin/class-fts-youtube-options-page.php CHANGED
@@ -216,15 +216,18 @@ class FTS_Youtube_Options_Page {
216
  $fts_functions->feed_them_youtube_refresh_token();
217
  }
218
 
219
- foreach ( $test_app_token_response as $user_id ) {
220
- if ( ! isset( $user_id->error->errors[0]->reason ) && ! empty( $youtube_api_key ) ) {
 
 
 
221
  $type_of_key = __( 'API key', 'feed-them-social' );
222
- } elseif ( ! isset( $user_id->error->errors[0]->reason ) && ! empty( $youtube_access_token ) ) {
223
  $type_of_key = __( 'Access Token', 'feed-them-social' );
224
  }
225
 
226
  // Error Check!
227
- if ( ! isset( $test_app_token_response->error->errors[0]->reason ) && ! empty( $youtube_api_key ) || ! isset( $test_app_token_response->error->errors[0]->reason ) && ! empty( $youtube_access_token ) && empty( $youtube_api_key ) ) {
228
  echo sprintf(
229
  esc_html__( '%1$s Your %2$s is working! Generate your shortcode on the %3$s settings page.%4$s %5$s', 'feed-them-social' ),
230
  '<div class="fts-successful-api-token">',
@@ -233,12 +236,12 @@ class FTS_Youtube_Options_Page {
233
  '</a>',
234
  '</div>'
235
  );
236
- } elseif ( isset( $user_id->error->errors[0]->reason ) && ! empty( $youtube_api_key ) || ! isset( $user_id->error->errors[0]->reason ) && ! empty( $youtube_access_token ) ) {
237
  echo sprintf(
238
  esc_html__( '%1$s This %2$s does not appear to be valid. YouTube responded with: %3$s %4$s ', 'feed-them-social' ),
239
  '<div class="fts-failed-api-token">',
240
  esc_html( $type_of_key ),
241
- esc_html( $user_id->errors[0]->reason ),
242
  '</div>'
243
  );
244
  }
@@ -249,8 +252,6 @@ class FTS_Youtube_Options_Page {
249
  '</div>'
250
  );
251
  }
252
- break;
253
- }
254
  ?>
255
 
256
 
216
  $fts_functions->feed_them_youtube_refresh_token();
217
  }
218
 
219
+ $user_id = $test_app_token_response;
220
+ $error_response = $test_app_token_response->error->errors[0]->message ? 'true' : 'false';
221
+ // print_r( $error_response );
222
+
223
+ if ( 'false' === $error_response && ! empty( $youtube_api_key ) ) {
224
  $type_of_key = __( 'API key', 'feed-them-social' );
225
+ } elseif ( 'false' === $error_response && ! empty( $youtube_access_token ) ) {
226
  $type_of_key = __( 'Access Token', 'feed-them-social' );
227
  }
228
 
229
  // Error Check!
230
+ if ( 'false' === $error_response && ! empty( $youtube_api_key ) || 'false' === $error_response && ! empty( $youtube_access_token ) && empty( $youtube_api_key ) ) {
231
  echo sprintf(
232
  esc_html__( '%1$s Your %2$s is working! Generate your shortcode on the %3$s settings page.%4$s %5$s', 'feed-them-social' ),
233
  '<div class="fts-successful-api-token">',
236
  '</a>',
237
  '</div>'
238
  );
239
+ } elseif ( 'true' === $error_response && ! empty( $youtube_api_key ) || 'true' === $error_response && ! empty( $youtube_access_token ) ) {
240
  echo sprintf(
241
  esc_html__( '%1$s This %2$s does not appear to be valid. YouTube responded with: %3$s %4$s ', 'feed-them-social' ),
242
  '<div class="fts-failed-api-token">',
243
  esc_html( $type_of_key ),
244
+ esc_html( $user_id->error->errors[0]->message ),
245
  '</div>'
246
  );
247
  }
252
  '</div>'
253
  );
254
  }
 
 
255
  ?>
256
 
257
 
admin/css/settings-page.css CHANGED
@@ -1 +1 @@
1
- .clear,.fts-clear{clear:both}.display{display:block!important}.facebook-message-generator,.final-instagram-user-id-textarea,.final-shortcode-textarea,.fts-facebook_group-shortcode-form .twitter_name,.fts-fb-event-option-wrap .twitter_name,.shortcode-generator-form,instagram-shortcode-form{display:none}.feed-them_page_fts-facebook-feed-styles-submenu-page .use-of-plugin{font-size:13px;font-weight:400;line-height:20px;max-width:740px;border-bottom:1px solid #ccc}.feed-them_page_fts-facebook-feed-styles-submenu-page .feed-them-social-admin-wrap h1,.feed-them_page_fts-facebook-feed-styles-submenu-page .feed-them-social-admin-wrap h2,.feed-them_page_fts-facebook-feed-styles-submenu-page .use-of-plugin,.feed-them_page_fts-instagram-feed-styles-submenu-page .feed-them-social-admin-wrap h1,.feed-them_page_fts-instagram-feed-styles-submenu-page .feed-them-social-admin-wrap h2,.feed-them_page_fts-instagram-feed-styles-submenu-page .use-of-plugin,.feed-them_page_fts-pinterest-feed-styles-submenu-page .feed-them-social-admin-wrap h1,.feed-them_page_fts-pinterest-feed-styles-submenu-page .use-of-plugin,.feed-them_page_fts-twitter-feed-styles-submenu-page .feed-them-social-admin-wrap h1,.feed-them_page_fts-twitter-feed-styles-submenu-page .feed-them-social-admin-wrap h2,.feed-them_page_fts-twitter-feed-styles-submenu-page .use-of-plugin,.feed-them_page_fts-youtube-feed-styles-submenu-page .feed-them-social-admin-wrap h1,.feed-them_page_fts-youtube-feed-styles-submenu-page .use-of-plugin{color:#333}.instagram-id-option-wrap{margin-top:25px}.feed-them_page_fts-facebook-feed-styles-submenu-page .feed-them-social-admin-wrap h2,.feed-them_page_fts-instagram-feed-styles-submenu-page .feed-them-social-admin-wrap h2{margin-top:45px}.fts-super-instagram-options-wrap{padding-top:0}.fts-empty-error input{background-color:#fdfdd3!important}.toplevel_page_feed-them-settings-page h1{font-size:32px}.feed-them_page_fts-twitter-feed-styles-submenu-page .feed-them-social-admin-wrap h2,.fts-youtube-feed-styles-submenu-page .feed-them-social-admin-wrap h2{margin-top:45px;color:#333}.feed-them-social-admin-wrap h1{color:#fff;margin:0 0 5px;line-height:30px;font-weight:700}.feed-them-social-admin-wrap h4{font-size:12px;font-weight:400;color:#000;margin:1px 0 8px}.feed-them-social-admin-wrap input[type=button],.feed-them-social-admin-wrap input[type=submit]{-webkit-appearance:none}.feed-them-social-admin-wrap input[type=text]{line-height:19px;max-width:100%;font-weight:400}.feed-them_page_fts-facebook-feed-styles-submenu-page .feed-them-social-admin-wrap,.feed-them_page_fts-instagram-feed-styles-submenu-page .feed-them-social-admin-wrap,.feed-them_page_fts-pinterest-feed-styles-submenu-page .feed-them-social-admin-wrap,.feed-them_page_fts-twitter-feed-styles-submenu-page .feed-them-social-admin-wrap,.feed-them_page_fts-youtube-feed-styles-submenu-page .feed-them-social-admin-wrap{max-width:100%;width:100%;min-height:auto;background:0 0;padding:0;-webkit-box-shadow:none;box-shadow:none;border-radius:1px;position:relative;margin:20px 20px 0 0;-webkit-text-size-adjust:none}.feed-them_page_fts-facebook-feed-styles-submenu-page .feed-them-social-admin-input-wrap,.feed-them_page_fts-pinterest-feed-styles-submenu-page .feed-them-social-admin-input-wrap,.feed-them_page_fts-twitter-feed-styles-submenu-page .feed-them-social-admin-input-wrap,.feed-them_page_fts-youtube-feed-styles-submenu-page .feed-them-social-admin-input-wrap{background:0 0}.feed-them-social-admin-wrap{max-width:806px;min-height:379px;padding:19px;margin:20px 10px 0 0;background-size:cover;-webkit-text-size-adjust:none;overflow:hidden;border-radius:2px}.feed-them_page_fts-youtube-feed-styles-submenu-page h2{color:#333!important;margin-top:45px!important}.feed-them-social-admin-form .feed-them-social-admin-wrap h2{color:#000;font-size:20px;font-weight:400;line-height:23px;margin:15px 0}.feed-them-social-admin-form{padding:5px 0 0;height:auto}.fts-facebook_group-shortcode-form:hover a{background-position:top right!important;background-size:34px!important;height:34px!important;width:34px!important}.feed-them-social-admin-input-wrap{padding:5px 0 10px;margin-bottom:10px;border-radius:2px;-webkit-border-radius:2px}.pinterest-gen-selection{margin-bottom:25px}.final-shortcode-textarea .feed-them-social-admin-input-label{color:#0361b8;width:auto;font-size:14px}.instagram-shortcode-form .final-shortcode-textarea .feed-them-social-admin-input-label{color:#0361b8}.final-shortcode-textarea{margin-top:25px}.final-shortcode-textarea input{width:100%;margin-top:2px}.feed-them-social-admin-input-label{float:left;width:230px;margin-right:10px;font-size:13px;padding-top:6px;font-weight:700}.feed-them_page_fts-facebook-feed-styles-submenu-page .feed-them-social-admin-input-label,.feed-them_page_fts-instagram-feed-styles-submenu-page .feed-them-social-admin-input-label,.feed-them_page_fts-twitter-feed-styles-submenu-page .feed-them-social-admin-input-label{float:left;width:230px;margin-right:10px;font-size:13px;text-transform:none;padding-top:6px}.feed-them-social-admin-input-label a{text-decoration:underline!important;cursor:pointer}.feed_them_social_id-answer a,.im-done{cursor:pointer!important}.feed-them-social-admin-input-example{float:left;font-weight:700;margin-left:10px;padding-top:4px}.feed-them-social-admin-input{float:left;width:305px;max-width:100%;font-weight:400}.feed-them-social-admin-input-default{float:left;width:290px;padding:4px 7px;border:1px solid #dfdfdf;background-color:#fff;font-size:12px}.fts-color-settings-admin-form .feed-them-social-admin-submit-btn{float:left;margin:0;padding:0 20px;height:37px;line-height:35px}.feed-them-social-admin-submit-btn{padding:10px 15px;border-radius:1px;background-color:#31ac45!important;color:#fff!important;font-weight:400;cursor:pointer!important;transition:all .3s ease-in-out;border:none;letter-spacing:1px;outline:0;font-size:12px}.feed-them-social-admin-submit-btn,.feed-them-social-admin-submit-btn:hover{-webkit-transition:background 2s;-moz-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out}.feed-them-social-admin-submit-btn:hover{background-color:#2bbe43!important;color:#fff!important;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;outline:0}.toplevel_page_feed-them-settings-page .feed-them-social-admin-slick-logo{right:5px;-webkit-border-radius:3px;border-radius:3px}.feed_them_social_id-answer{padding:15px 0;display:none;font-weight:700}.feed_them_social_id-answer div{padding-bottom:10px}.im-done{padding:10px;background-color:#cd1723!important;border:none!important;color:#fff!important;font-weight:700;text-shadow:1px 1px 3px #000;filter:dropshadow(color=#000000, offx=1, offy=1);-webkit-border-radius:3px;border-radius:3px}#shortcode-form-selector{margin-bottom:10px;height:40px;min-width:290px;line-height:40px}.feed-them-icon-wrap{position:absolute;right:27px;top:25px;width:234px;height:50px}.feed-them-social-admin-wrap,.fts-content,.fts-plugin-reviews{position:relative}.fts-facebook_group-shortcode-form:hover .feed-them-icon-wrap a.facebook-icon{background-position:top right!important;background-size:34px!important;height:34px!important;width:34px!important;display:none}.feed-them-icon-wrap a{opacity:1;float:right;margin-left:1px;margin-bottom:1px;display:block;height:38px;width:38px;cursor:default;outline:0;border:none;box-shadow:0 1px 1px #222;border-radius:0;transition:all .3s ease-in-out}.feed-them-icon-wrap a,.feed-them-icon-wrap a:hover{-webkit-transition:all .3s ease-in-out;-moz-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out}.feed-them-icon-wrap a:hover{opacity:.85;transition:all .3s ease-in-out}.feed-them-icon-wrap a.facebook-icon{background:url(../images/facebook-icon.png) no-repeat}.feed-them-icon-wrap a.twitter-icon{background:url(../images/twitter-icon.png) top right no-repeat}.feed-them-icon-wrap a.instagram-icon{background:url(../images/instagram-icon.png) top right no-repeat}.feed-them-icon-wrap .feed-them-icon-wrap a.youtube-icon{background:url(../images/youtube-icon.png) top right no-repeat}.feed-them-icon-wrap a.pinterest-icon{background:url(../images/pinterest-icon.png) top right no-repeat}a.icon-animate-small{background-position:top right!important;background-size:34px!important;height:34px!important;width:34px!important}.instructional-text{font-size:13px;line-height:19px;margin:0 0 15px;border-bottom:1px dotted #9c9c9c;color:#212121;padding:0 0 5px}.instructional-text a{color:#0073aa;text-decoration:none}.instructional-text a,.instructional-text a:hover{-moz-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out}.instructional-text a:hover{transition:all .3s ease-in-out}.feed-them-custom-css{padding-top:25px;padding-left:0}.feed-them-clear-cache input{background-color:#f11e2e!important;margin-bottom:10px}.feed-them-clear-cache input:hover{background-color:#f15d2e!important}.feed-them-clear-cache-text{color:#f11e2e!important;font-weight:700;background-color:rgba(255,255,255,.88);padding:10px 16px;margin-top:10px;margin-bottom:10px;border-radius:2px;-webkit-border-radius:2px;opacity:.9}.fts-get-premium-version{margin-right:1em;margin-top:15px;display:block;max-width:210px;text-align:center;text-decoration:none!important}textarea#fts-color-options-main-wrapper-css-input{max-width:100%;min-height:350px;clear:both;background:#f9f9f9;font-family:Consolas,Monaco,monospace;font-size:12px;width:100%;height:300px;outline:0}.fts-custom-css-text{margin-bottom:5px}label.toggle-custom-textarea-show:hover{background:#999}label.toggle-custom-textarea-show{max-width:435px;display:block;height:37px;line-height:35px;float:left;text-align:center;padding:0 15px;background:#818181;border-radius:1px;font-size:12px;clear:both;letter-spacing:1px;margin:5px 5px 10px 0;-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}#fts-color-options-main-wrapper-css-input,.fts-custom-css-text,.toggle-custom-textarea-hide{display:none}.fts-admin-wrap p input[type=checkbox],.fts-wp-header-custom input[type=checkbox]{margin:-1px 7px 0 2px!important}.fts-color-settings-admin-form p,.fts-powered-by-settings-admin-form p{color:#000;font-size:12px;-webkit-text-size-adjust:none}.fts-powered-by-settings-admin-form p{margin-bottom:0}.feed-them-custom-logo-css{margin-top:25px}#discount-for-review{clear:both;margin-bottom:1px;text-align:center;font-weight:700;color:#000;background:rgba(255,255,255,.53);float:right;width:195px;line-height:40px;cursor:pointer}.discount-review-text{clear:both;color:#333;background:rgba(255,255,255,.9);width:165px;float:right;padding:20px 15px;text-align:center;display:none}#discount-for-review a{display:inline-block;width:auto;height:auto;margin:0;padding:0;border:none;box-shadow:none;float:none;cursor:pointer;text-decoration:none;font-size:12px;font-weight:700;color:#0073aa}.fts-color-settings-admin-form label,.fts-color-settings-admin-form span{color:#060606}.fts-color-settings-admin-form p.example{color:#fff;padding-bottom:35px!important}.fts-color-settings-admin-form fieldset label{color:#fff;line-height:30px}.fts-color-settings-admin-form fieldset a{color:#fff;text-decoration:none}@media (max-width:800px){.toplevel_page_feed-them-settings-page .feed-them-social-admin-wrap h1{text-shadow:#fff!important;height:32px!important;width:280px!important;background-size:280px!important}.feed-them-icon-wrap{position:relative;margin:-20px 0 70px;left:0!important;height:auto;clear:both;text-align:left}.feed-them-social-admin-slick-logo{display:none}#fts-date-and-time-format{width:100%}}.fts-failed-api-token,.fts-successful-api-token{clear:both;float:left;padding:7px 14px 7px 10px;border:1px solid rgba(255,255,255,.45);color:#000;margin:10px 20px 0 0;max-width:715px;width:100%}.fts-failed-api-token{background:rgba(245,207,206,.78)}.fts-successful-api-token{background:rgba(220,253,205,.78)}.feed-them_page_fts-facebook-feed-styles-submenu-page .fts-failed-api-token,.feed-them_page_fts-facebook-feed-styles-submenu-page .fts-successful-api-token,.feed-them_page_fts-instagram-feed-styles-submenu-page .feed-them_page_fts-instagram-feed-styles-submenu-page .fts-successful-api-token,.feed-them_page_fts-instagram-feed-styles-submenu-page .fts-failed-api-token,instagram-failed-message{margin-top:0!important;padding:10px 15px;max-width:708px}.fts-special-working-wrap{padding:8px!important;max-width:722px!important}#fts_facebook_custom_api_token,#fts_facebook_custom_api_token_biz,#fts_facebook_instagram_custom_api_token{margin-bottom:20px!important}.fts-facebook-custom-api-token-label{display:block;margin:0 40px 4px 0}.fts-facebook-custom-api-token-label a{font-weight:700;color:#df1818}.twitter-api-wrap{margin:20px 0 0}.twitter-api-wrap .feed-them-social-admin-input-wrap{margin:0}.fts-facebook-custom-api-token-label,.fts-instagram-custom-api-token-label{max-width:700px;line-height:21px;font-size:13px}.fts-facebook-get-access-token,.fts-facebook-get-access-token:focus,.fts-instagram-get-access-token,.fts-instagram-get-access-token:focus,.fts-pinterest-get-access-token,.fts-pinterest-get-access-token:focus,.fts-twitter-get-access-token,.fts-twitter-get-access-token:focus,.fts-youtube-get-access-token,.fts-youtube-get-access-token:focus{border-radius:5px;box-shadow:0 1px 1px #999;display:block;clear:both;float:left;font-size:14px;margin-bottom:25px;margin-top:5px;text-decoration:none;font-weight:600}.fts-instagram-get-access-token,.fts-instagram-get-access-token:focus{padding:18px 16px 19px 188px;background:url(../images/instagram-logo-admin.png) 13px 12px no-repeat #fff;color:#252525}.fts-pinterest-get-access-token,.fts-pinterest-get-access-token:focus{padding:18px 16px 19px 188px;background:url(../images/pinterest-logo-admin.jpg) 13px 12px no-repeat #fff;color:#252525}.fts-facebook-get-access-token:hover,.fts-instagram-get-access-token:hover,.fts-pinterest-get-access-token:hover{color:#666}.fts-facebook-get-access-token,.fts-facebook-get-access-token:focus{padding:18px 16px 19px 182px;background:url(../images/facebook-logo-admin.jpg) 14px 12px no-repeat #fff;color:#252525}@font-face{margin:0 0 9px;font-size:19px}.fts-title-description-settings-page{padding:25px 0 15px;max-width:740px;border-top:1px solid #ccc}.fts-premium-options-message,.fts-premium-options-message2{font-size:13px;padding:20px 25px 25px;line-height:19px;background-color:#fff;margin:0}.fts-premium-options-message a:first-child,.fts-premium-options-message2 a:first-child{font-size:16px;display:inline-block;padding:0;margin:0 0 5px;text-decoration:none}.fts-plugin-reviews{max-width:789px;padding:25px 28px 31px;box-shadow:0 0 1px #d1d1d1;border-radius:1px;background:rgba(255,255,255,1);-webkit-text-size-adjust:none;font-size:13px;line-height:21px;margin-right:10px}.fts-plugin-reviews a{text-decoration:none}.fts-plugin-reviews-rate{margin-bottom:20px;padding-bottom:20px;border-bottom:1px solid #eee}h1.plugin-author-note{margin:50px 0 15px!important;font-size:22px;color:#222;z-index:1;position:relative}.toplevel_page_feed-them-settings-page .error{margin:20px 20px 20px 0;max-width:818px}.feed-them_page_fts-facebook-feed-styles-submenu-page .error,.feed-them_page_fts-instagram-feed-styles-submenu-page .error,.feed-them_page_fts-pinterest-feed-styles-submenu-page .error,.feed-them_page_fts-system-info-submenu-page .error,.feed-them_page_fts-system-info-submenu-page .notice,.feed-them_page_fts-twitter-feed-styles-submenu-page .error,.feed-them_page_fts-youtube-feed-styles-submenu-page .error{margin:20px 20px 20px 0!important}.feed-them_page_fts-bar-settings-page .error{margin:20px 20px 20px 5px!important;max-width:1005px}.hashtag-option-small-text,.twitter-hashtag-etc-wrap{display:none}.twitter-hashtag-etc-wrap{margin:15px 0 35px}.fts-content{background-color:rgba(241,241,241,.65);padding:30px;z-index:1;display:nonee;border-radius:2px;box-shadow:0 2px 10px rgba(41,41,41,.51);min-height:315px}.shortcode-generator-form{border-radius:3px;margin-top:15px}.instructional-text a:hover{color:#ea1616;text-decoration:underline;opacity:.8}.final-shortcode-textarea h4{border-bottom:1px solid #fff;padding:0 0 10px;font-size:13px;margin-bottom:15px}.toplevel_page_feed-them-settings-page .fts-content h1{color:#fbfbfb;margin:0 0 12px;line-height:30px;text-shadow:1px 1px 1px rgba(51,51,51,.06);font-weight:600;background:url(../images/feed-them-social-logo.png) no-repeat;height:40px;width:377px;font-size:0}.fb-options-wrap .feed-them-social-admin-submit-btn{margin-top:5px}#fts-social-selector,.twitter-gen-selection{margin-bottom:25px}.fts-text-align-center{text-align:center}.toplevel_page_feed-them-settings-page .feed-them-social-admin-slick-logo{background:url(../images/footer-logo.png) center no-repeat;width:110px;height:20px;padding:0;margin:20px 0 -20px;display:inline-block;position:relative;bottom:0;opacity:1}.fb-image,.fts-backg{width:100%;height:100%;}.feed-them-social-admin-wrap h3{color:#000;font-size:20px;font-weight:400;line-height:23px;margin:0 0 5px}.feed-them-social-admin-wrap .feed-them-social-admin-form h2{color:#000;font-size:23px;font-weight:400;line-height:23px;margin:15px 0 20px;padding:0}.instagram-id-option-wrap .feed-them-social-admin-submit-btn,.toplevel_page_feed-them-settings-page .feed-them-social-admin-submit-btn{margin-top:0;margin-left:0!important}.toplevel_page_feed-them-settings-page .instagram-id-option-wrap .feed-them-social-admin-submit-btn{margin-top:5px!important;margin-left:0!important}.feed-them-clear-cache .use-of-plugin{margin:0}.feed-them-clear-cache h2,.feed-them-custom-css h2,.feed-them-custom-logo-css h2{margin-bottom:10px;margin-top:5px;font-size:17px;padding-top:20px;border-top:1px dotted rgba(177,177,177,.88);color:#060606}.feed-them-clear-cache h2{border:none;margin-top:17px;padding-top:0}.feed-them-custom-css p,.feed-them-custom-logo-css p{margin:0 0 5px}#fts-date-and-time-format{margin-bottom:10px}.feed-them-social-admin-submit-btn{margin-top:15px!important}#fts_admin_bar_menu{margin-bottom:0;margin-left:31px}.fts-backg{position:absolute;top:0;right:0;z-index:0;opacity:1;-webkit-animation:ftsettings 5s;animation:ftsettings 5s;background:rgba(255,255,255,.8)}@-webkit-keyframes ftsettings{from{opacity:0}to{opacity:1}}@keyframes ftsettings{from{opacity:0}to{opacity:1}}.fb-reviews,.reviews-options{display:none}.fts-required-token-message{padding:15px;background:#fcfcfc;margin:12px 0 20px;border-left:4px solid #fb3939}.custom_time_ago_wrap{padding-top:10px}.custom_time_ago_wrap h2{margin-bottom:20px}.custom_time_ago_wrap label{color:#000;display:inline-block;min-width:75px;margin:0 10px 12px;font-size:13px}.slideshow-wrap{margin-top:18px}.fb-page-list{margin:0;display:block;max-width:740px}.fb-page-list li{background:#fff;padding:8px 10px 10px;margin:0;border-left:15px solid #3b5999;border-bottom:1px solid #e9ebee;cursor:pointer}.fb-page-list li .feed-them-social-admin-submit-btn{display:none;margin-top:9px!important;position:absolute;right:15px;top:7px}.fb-page-list li:hover{background:rgba(255,255,255,.57)}.fb-image{margin:0 15px 0 0;float:left;line-height:50px;text-align:center!important;max-width:50px;min-width:50px;vertical-align:baseline;min-height:50px;max-height: 50px;}.fb-image img{display:inline-block;vertical-align:middle;border-radius:50px}.fb-name{margin:0;display:inline-block;line-height:15px;color:#4c4c4c;font-weight:500;padding-top:10px}.board-name,.combine-instagram-hashtag-option-text,.combine_instagram_hashtag,.combine_instagram_hashtag_type,.fb-video-play-btn-options-content,.fb-video-play-btn-options-wrap,.fb_album_photos_id,.fts-facebook-grid-options-wrap,.fts-facebook-load-more-options-wrap,.fts-facebook-load-more-options2-wrap,.fts-fb-id,.fts-instagram-load-more-options-wrap,.fts-super-facebook-options-wrap,.fts-youtube-load-more-options-wrap,.fts-youtube-load-more-options2-wrap,.instagram-hashtag-option-text,.instagram-location-option-text,.instagram_hashtag_type,.page-token,.pinterest-board-and-name-text,.slider_options_wrap,.slideshow-wrap,.youtube_align_comments_wrap,.youtube_channelID2,.youtube_name,.youtube_name2,.youtube_playlistID,.youtube_playlistID2,.youtube_singleVideoID{display:none}.fts-pages-info{background:#3b5999;max-width:710px;padding:10px 15px 12px;color:#fff;margin-top:1px;letter-spacing:.5px}.fts-fb-page-thumb{float:left;margin-right:10px;border-radius:50px}.fts-successful-api-token h3{margin-bottom:0;margin-top:4px;font-weight:700}.use-of-plugin{color:#000;font-size:13px;font-weight:400;line-height:20px;max-width:60%;padding-bottom:12px;margin-bottom:0}.fts-admin-button-no-work{margin:0 0 0 25px;line-height:41px}.twitter_hashtag_etc_name{padding-top:0}.page.inst-text-facebook-page{display:block}.slider_options_wrap.not-active-premium-fields,.slideshow-wrap .feed-them-social-admin-input-default{display:block!important}.fts-premium-options-message a.not-active-title:first-child{font-size:16px!important;display:block!important;padding:0!important;margin:0 0 5px!important;text-decoration:none!important}.combine-facebook-wrap,.combine-grid-options-wrap,.combine-instagram-wrap,.combine-pinterest-wrap,.combine-twitter-wrap,.combine-youtube-wrap,.combine_board_id,.combine_playlist_id,.combine_youtube_name,.display-comments-wrap,.facebook-reviews-wrap,.fts-premium-options-message,.fts-twitter-grid-options-wrap,.fts-twitter-load-more-options-wrap,.fts-twitter-load-more-options2-wrap,.inst-text-facebook-reviews,.instagram-profile-options-wrap,.like-box-wrap{display:none}.sectioned-options-title{margin-top:15px!important;margin-bottom:15px!important;border-bottom:1px solid #f1f1f1;padding:10px 10px 10px 30px;font-size:18px!important;color:#060606!important;background:#fff;margin-left:-30px!important;box-shadow:0 1px 1px rgba(153,153,153,.59)}.facebook-image-animation-option-wrap,.multiple_facebook .facebook-loadmore-wrap,.multiple_facebook .facebook-title-options-wrap,.multiple_facebook .like-box-wrap,.multiple_facebook h2{display:none!important}.fts-fb-load-more,.fts-fb-spinner{text-align:center}.fts-fb-spinner>div{width:10px;height:10px;background-color:#999;border-radius:100%;display:inline-block;-webkit-animation:fts-fb-bouncedelay 1.4s infinite ease-in-out;animation:fts-fb-bouncedelay 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both}.fts-hide-me,.popup-gallery-fb .fts-fb-caption{display:none}.fb-social-btn-below-description,.fb-social-btn-bottom,.fb-social-btn-top{width:100%!important;overflow:hidden}.fts-fb-spinner .bounce1{-webkit-animation-delay:-.32s;animation-delay:-.32s}.fts-fb-spinner .bounce2{-webkit-animation-delay:-.16s;animation-delay:-.16s}@-webkit-keyframes fts-fb-bouncedelay{0%,100%,80%{-webkit-transform:scale(0)}40%{-webkit-transform:scale(1)}}@keyframes fts-fb-bouncedelay{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.fts-fluid-videoWrapper-html5 video{object-fit:inherit;margin-bottom:0!important}.fts-fb-album-view-link a{color:#fff}.fts-fb-album-view-link a:hover{color:#eee}.fts-fb-load-more{border-radius:1px;padding:0;line-height:37px!important;width:100%;min-height:37px!important;font-size:13px!important;background:#fff!important;cursor:pointer;color:#787a7b;-webkit-transition:all .3s ease-in-out;-moz-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out;transition:all .3s ease-in-out;max-width:740px!important;font-weight:700}.toggle-custom-textarea-show span,label.toggle-custom-textarea-show{color:#fffefe}.fts-logo-header{margin-bottom:20px!important}.fts-logo-subheader{margin-bottom:10px!important}.fts-color-settings-admin-form label{font-weight:700;min-width:100px}#fts_clear_cache_developer_mode{margin-left:28px}.toplevel_page_feed-them-settings-page .pane-active{display:block}.toplevel_page_feed-them-settings-page .fts-tabbed{display:block;float:left;color:#545454;font-weight:700;text-decoration:none;line-height:1.9;text-align:center;cursor:pointer;border-bottom:1px solid #ccc;padding:10px 38px!important;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;min-width:115px;background:#fff;margin-right:1px!important;font-size:13px;width:auto!important}.toplevel_page_feed-them-settings-page label.tab-active{background:#0073aa!important;color:#fff!important}.toplevel_page_feed-them-settings-page .fts-tab-content{clear:both;padding-top:15px}.feed-them-social-admin-input-label small{font-weight:400}.not-active-title:hover h3{color:#028fd2}.not-active-title h3{color:#0073aa}@media (max-width:797px){.toplevel_page_feed-them-settings-page #fts-tabs{margin-top:140px!important}}@media (max-width:450px){#shortcode-form-selector{min-width:270px!important}}@media (max-width:500px){.toplevel_page_feed-them-settings-page #fts-tab-content1 .use-of-plugin{max-width:100%!important}}#fts-timezone{max-width:300px}.fts-instagram-username-picker-wrap li{clear:both;background:#e6e6e6;padding:10px;margin-bottom:1px;display:block;width:100%;line-height:16px;float:left}.combine-twitter-hashtag-etc-wrap,.facebook_hide_date,.facebook_hide_name,.facebook_hide_thumbnail,.facebook_show_media,.fts-success,.youtube_video_single_info_display{display:none}.fts-instagram-username-picker-wrap li.fts-insta-id-active,.fts-instagram-username-picker-wrap li:hover{background:#0073aa;color:#fff}.ft-instagram-username-picker{clear:both;margin:0 0 1px;height:65px}.fts-insta-profile-picture-div img{float:left;max-width:65px;margin-right:15px;border-radius:100px}.fts-insta-fullname-div{padding:5px 0 2px}.fts-insta-id-div{font-style:italic;padding:5px 0 0}.fts-instagram-username-picker-wrap{padding-right:20px;max-height:310px;overflow:auto;margin:0}.fts-instagram-username-picker-wrap li:first-child{margin-top:10px}.fts-instagram-username-picker-wrap li:last-child{margin-bottom:10px}.fts-empty-error input,input.fts-empty-error{background:#ffffd8!important}.fts-instagram-username-picker-wrap li{color:#222}.fts-highlight{background:#0073aa;border-radius:20px;color:#fff;padding:0 5px}.fts-youtube-get-access-token,.fts-youtube-get-access-token:focus{padding:18px 16px 19px 188px;background: url(../images/google-logo-admin.jpg) 13px 12px no-repeat #fff;color:#252525;}.fts-twitter-get-access-token,.fts-twitter-get-access-token:focus{padding:18px 16px 19px 188px;background:url(../images/twitter-logo-admin.jpg) 13px 12px no-repeat #fff;color:#252525}.fts-twitter-add-all-keys-click-option,.fts-youtube-add-all-keys-click-option{margin:-10px 0 15px;text-align:left;clear:both}.twitter-extra-keys-text,.youtube-extra-keys-text{max-width:550px;margin-bottom:15px}.feed-them_page_fts-twitter-feed-styles-submenu-page .fts-successful-api-token{margin-top:0;margin-bottom:-10px}#fts-timer{padding:6px 0 0 1px;float:left}@font-face{font-family:FontAwesomeSlick;src:url(../../feeds/css/font/fontawesome-webfont.eot?v=3.2.1);src:url(../../feeds/css/font/fontawesome-webfont.eot?#iefix&v=3.2.1) format("embedded-opentype"),url(../../feeds/css/font/fontawesome-webfont.woff?v=3.2.1) format("woff"),url(../../feeds/css/font/fontawesome-webfont.ttf?v=3.2.1) format("truetype"),url(../../feeds/css/font/fontawesome-webfont.svg#fontawesomeregular?v=3.2.1) format("svg")}.fts-success:before{font-family:FontAwesomeSlick!important;content:"\f00c"!important;font-size:14px;position:relative;line-height:19px}.fts-success{margin:3px 6px 0;padding:2px 4px;color:#fff;background:#01a701;border-radius:20px;float:left;font-size:10px!important;width:auto;height:18px}#discount-for-review a:hover{color:#0073aa}.fb-sublist{border:none!important;overflow:auto;height:200px;background:#f7f7f7}.fb-sublist li{border:1px solid #f7f7f7!important;border-bottom:0;border-right:0}.fts-token-save{border-radius:100px}.fb-sublist .fb-name{letter-spacing:0!important;font-size:13px}.fts-fb-location-text-wrap{padding:8px;text-align:center;color:#f7f7f7;font-weight:700;background:#00a400;margin:10px 0 0}.fb-name small{display:block;line-height:0;letter-spacing:0;color:#969696}.fts-successful-api-token small{font-size:12px}.fb-page-list li{position:relative}.fts-successful-api-token h3 a{text-decoration:none!important;color:#262627;text-shadow:1px 1px 1px #fff;font-size:17px}.fts-successful-api-token h3 a:hover,.fts-successful-api-token img:hover{opacity:.8}.fb-page-list .fts-fb-load-more{color:#00a400}.feed-them-icon-wrap a.youtube-icon{background:url(../images/youtube-icon.png) top right no-repeat}.combine-instagram-wrap .fts-instagram-hashtag-location-options-message{margin-top:25px;margin-bottom:-25px}.fts-fb-token-wrap .dashicons-admin-links:before{font-size:20px;color:#3b5999}.fb-page-master-list .dashicons-admin-links:before{top:-3px;position:relative}.fts-successful-api-token .dashicons-admin-links:before{top:3px;position:relative}.fts-arrow-icon:before{content:'\f054';font-family:FontAwesomeSlick!important;color:#00a400;font-size:18px!important;position:relative;top:2px;padding:0 8px}.fts-fb-icon:before{content:'\f082';font-family:FontAwesomeSlick!important;color:#3a5899;font-size:20px!important;position:relative;top:2px;padding-right:5px}.fts-insta-icon:before{content:'\f16d';font-family:FontAwesomeSlick!important;color:#263232;font-size:22px!important;position:relative;top:3px;padding-right:5px}.fts-special-working-wrap .fts-arrow-icon:before{font-size:18px!important;top:1px}.fts-special-working-wrap .fts-fb-icon:before{top:1px}.fts-special-working-wrap .fts-insta-icon:before{top:2px}.instagram_hashtag{display:none}
1
+ .clear,.fts-clear{clear:both}.display{display:block!important}.facebook-message-generator,.final-instagram-user-id-textarea,.final-shortcode-textarea,.fts-facebook_group-shortcode-form .twitter_name,.fts-fb-event-option-wrap .twitter_name,.shortcode-generator-form,instagram-shortcode-form{display:none}.feed-them_page_fts-facebook-feed-styles-submenu-page .use-of-plugin{font-size:13px;font-weight:400;line-height:20px;max-width:740px;border-bottom:1px solid #ccc}.feed-them_page_fts-facebook-feed-styles-submenu-page .feed-them-social-admin-wrap h1,.feed-them_page_fts-facebook-feed-styles-submenu-page .feed-them-social-admin-wrap h2,.feed-them_page_fts-facebook-feed-styles-submenu-page .use-of-plugin,.feed-them_page_fts-instagram-feed-styles-submenu-page .feed-them-social-admin-wrap h1,.feed-them_page_fts-instagram-feed-styles-submenu-page .feed-them-social-admin-wrap h2,.feed-them_page_fts-instagram-feed-styles-submenu-page .use-of-plugin,.feed-them_page_fts-pinterest-feed-styles-submenu-page .feed-them-social-admin-wrap h1,.feed-them_page_fts-pinterest-feed-styles-submenu-page .use-of-plugin,.feed-them_page_fts-twitter-feed-styles-submenu-page .feed-them-social-admin-wrap h1,.feed-them_page_fts-twitter-feed-styles-submenu-page .feed-them-social-admin-wrap h2,.feed-them_page_fts-twitter-feed-styles-submenu-page .use-of-plugin,.feed-them_page_fts-youtube-feed-styles-submenu-page .feed-them-social-admin-wrap h1,.feed-them_page_fts-youtube-feed-styles-submenu-page .use-of-plugin{color:#333}.instagram-id-option-wrap{margin-top:25px}.feed-them_page_fts-facebook-feed-styles-submenu-page .feed-them-social-admin-wrap h2,.feed-them_page_fts-instagram-feed-styles-submenu-page .feed-them-social-admin-wrap h2{margin-top:45px}.fts-super-instagram-options-wrap{padding-top:0}.fts-empty-error input{background-color:#fdfdd3!important}.toplevel_page_feed-them-settings-page h1{font-size:32px}.feed-them_page_fts-twitter-feed-styles-submenu-page .feed-them-social-admin-wrap h2,.fts-youtube-feed-styles-submenu-page .feed-them-social-admin-wrap h2{margin-top:45px;color:#333}.feed-them-social-admin-wrap h1{color:#fff;margin:0 0 5px;line-height:30px;font-weight:700}.feed-them-social-admin-wrap h4{font-size:12px;font-weight:400;color:#000;margin:1px 0 8px}.feed-them-social-admin-wrap input[type=button],.feed-them-social-admin-wrap input[type=submit]{-webkit-appearance:none}.feed-them-social-admin-wrap input[type=text]{line-height:19px;max-width:100%;font-weight:400}.feed-them_page_fts-facebook-feed-styles-submenu-page .feed-them-social-admin-wrap,.feed-them_page_fts-instagram-feed-styles-submenu-page .feed-them-social-admin-wrap,.feed-them_page_fts-pinterest-feed-styles-submenu-page .feed-them-social-admin-wrap,.feed-them_page_fts-twitter-feed-styles-submenu-page .feed-them-social-admin-wrap,.feed-them_page_fts-youtube-feed-styles-submenu-page .feed-them-social-admin-wrap{max-width:100%;width:100%;min-height:auto;background:0 0;padding:0;-webkit-box-shadow:none;box-shadow:none;border-radius:1px;position:relative;margin:20px 20px 0 0;-webkit-text-size-adjust:none}.feed-them_page_fts-facebook-feed-styles-submenu-page .feed-them-social-admin-input-wrap,.feed-them_page_fts-pinterest-feed-styles-submenu-page .feed-them-social-admin-input-wrap,.feed-them_page_fts-twitter-feed-styles-submenu-page .feed-them-social-admin-input-wrap,.feed-them_page_fts-youtube-feed-styles-submenu-page .feed-them-social-admin-input-wrap{background:0 0}.feed-them-social-admin-wrap{max-width:806px;min-height:379px;padding:19px;margin:20px 10px 0 0;background-size:cover;-webkit-text-size-adjust:none;overflow:hidden;border-radius:2px}.feed-them_page_fts-youtube-feed-styles-submenu-page h2{color:#333!important;margin-top:45px!important}.feed-them-social-admin-form .feed-them-social-admin-wrap h2{color:#000;font-size:20px;font-weight:400;line-height:23px;margin:15px 0}.feed-them-social-admin-form{padding:5px 0 0;height:auto}.fts-facebook_group-shortcode-form:hover a{background-position:top right!important;background-size:34px!important;height:34px!important;width:34px!important}.feed-them-social-admin-input-wrap{padding:5px 0 10px;margin-bottom:10px;border-radius:2px;-webkit-border-radius:2px}.pinterest-gen-selection{margin-bottom:25px}.final-shortcode-textarea .feed-them-social-admin-input-label{color:#0361b8;width:auto;font-size:14px}.instagram-shortcode-form .final-shortcode-textarea .feed-them-social-admin-input-label{color:#0361b8}.final-shortcode-textarea{margin-top:25px}.final-shortcode-textarea input{width:100%;margin-top:2px}.feed-them-social-admin-input-label{float:left;width:230px;margin-right:10px;font-size:13px;padding-top:6px;font-weight:700}.feed-them_page_fts-facebook-feed-styles-submenu-page .feed-them-social-admin-input-label,.feed-them_page_fts-instagram-feed-styles-submenu-page .feed-them-social-admin-input-label,.feed-them_page_fts-twitter-feed-styles-submenu-page .feed-them-social-admin-input-label{float:left;width:230px;margin-right:10px;font-size:13px;text-transform:none;padding-top:6px}.feed-them-social-admin-input-label a{text-decoration:underline!important;cursor:pointer}.feed_them_social_id-answer a,.im-done{cursor:pointer!important}.feed-them-social-admin-input-example{float:left;font-weight:700;margin-left:10px;padding-top:4px}.feed-them-social-admin-input{float:left;width:305px;max-width:100%;font-weight:400}.feed-them-social-admin-input-default{float:left;width:290px;padding:4px 7px;border:1px solid #dfdfdf;background-color:#fff;font-size:12px}.fts-color-settings-admin-form .feed-them-social-admin-submit-btn{float:left;margin:0;padding:0 20px;height:37px;line-height:35px}.feed-them-social-admin-submit-btn{padding:10px 15px;border-radius:1px;background-color:#31ac45!important;color:#fff!important;font-weight:400;cursor:pointer!important;transition:all .3s ease-in-out;border:none;letter-spacing:1px;outline:0;font-size:12px}.feed-them-social-admin-submit-btn,.feed-them-social-admin-submit-btn:hover{-webkit-transition:background 2s;-moz-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out}.feed-them-social-admin-submit-btn:hover{background-color:#2bbe43!important;color:#fff!important;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;outline:0}.toplevel_page_feed-them-settings-page .feed-them-social-admin-slick-logo{right:5px;-webkit-border-radius:3px;border-radius:3px}.feed_them_social_id-answer{padding:15px 0;display:none;font-weight:700}.feed_them_social_id-answer div{padding-bottom:10px}.im-done{padding:10px;background-color:#cd1723!important;border:none!important;color:#fff!important;font-weight:700;text-shadow:1px 1px 3px #000;filter:dropshadow(color=#000000, offx=1, offy=1);-webkit-border-radius:3px;border-radius:3px}#shortcode-form-selector{margin-bottom:10px;height:40px;min-width:290px;line-height:40px}.feed-them-icon-wrap{position:absolute;right:27px;top:25px;width:234px;height:50px}.feed-them-social-admin-wrap,.fts-content,.fts-plugin-reviews{position:relative}.fts-facebook_group-shortcode-form:hover .feed-them-icon-wrap a.facebook-icon{background-position:top right!important;background-size:34px!important;height:34px!important;width:34px!important;display:none}.feed-them-icon-wrap a{opacity:1;float:right;margin-left:1px;margin-bottom:1px;display:block;height:38px;width:38px;cursor:default;outline:0;border:none;box-shadow:0 1px 1px #222;border-radius:0;transition:all .3s ease-in-out}.feed-them-icon-wrap a,.feed-them-icon-wrap a:hover{-webkit-transition:all .3s ease-in-out;-moz-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out}.feed-them-icon-wrap a:hover{opacity:.85;transition:all .3s ease-in-out}.feed-them-icon-wrap a.facebook-icon{background:url(../images/facebook-icon.png) no-repeat}.feed-them-icon-wrap a.twitter-icon{background:url(../images/twitter-icon.png) top right no-repeat}.feed-them-icon-wrap a.instagram-icon{background:url(../images/instagram-icon.png) top right no-repeat}.feed-them-icon-wrap .feed-them-icon-wrap a.youtube-icon{background:url(../images/youtube-icon.png) top right no-repeat}.feed-them-icon-wrap a.pinterest-icon{background:url(../images/pinterest-icon.png) top right no-repeat}a.icon-animate-small{background-position:top right!important;background-size:34px!important;height:34px!important;width:34px!important}.instructional-text{font-size:13px;line-height:19px;margin:0 0 15px;border-bottom:1px dotted #9c9c9c;color:#212121;padding:0 0 5px}.instructional-text a{color:#0073aa;text-decoration:none}.instructional-text a,.instructional-text a:hover{-moz-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out}.instructional-text a:hover{transition:all .3s ease-in-out}.feed-them-custom-css{padding-top:25px;padding-left:0}.feed-them-clear-cache input{background-color:#f11e2e!important;margin-bottom:10px}.feed-them-clear-cache input:hover{background-color:#f15d2e!important}.feed-them-clear-cache-text{color:#f11e2e!important;font-weight:700;background-color:rgba(255,255,255,.88);padding:10px 16px;margin-top:10px;margin-bottom:10px;border-radius:2px;-webkit-border-radius:2px;opacity:.9}.fts-get-premium-version{margin-right:1em;margin-top:15px;display:block;max-width:210px;text-align:center;text-decoration:none!important}textarea#fts-color-options-main-wrapper-css-input{max-width:100%;min-height:350px;clear:both;background:#f9f9f9;font-family:Consolas,Monaco,monospace;font-size:12px;width:100%;height:300px;outline:0}.fts-custom-css-text{margin-bottom:5px}label.toggle-custom-textarea-show:hover{background:#999}label.toggle-custom-textarea-show{max-width:435px;display:block;height:37px;line-height:35px;float:left;text-align:center;padding:0 15px;background:#818181;border-radius:1px;font-size:12px;clear:both;letter-spacing:1px;margin:5px 5px 10px 0;-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}#fts-color-options-main-wrapper-css-input,.fts-custom-css-text,.toggle-custom-textarea-hide{display:none}.fts-admin-wrap p input[type=checkbox],.fts-wp-header-custom input[type=checkbox]{margin:-1px 7px 0 2px!important}.fts-color-settings-admin-form p,.fts-powered-by-settings-admin-form p{color:#000;font-size:12px;-webkit-text-size-adjust:none}.fts-powered-by-settings-admin-form p{margin-bottom:0}.feed-them-custom-logo-css{margin-top:25px}#discount-for-review{clear:both;margin-bottom:1px;text-align:center;font-weight:700;color:#000;background:rgba(255,255,255,.53);float:right;width:195px;line-height:40px;cursor:pointer}.discount-review-text{clear:both;color:#333;background:rgba(255,255,255,.9);width:165px;float:right;padding:20px 15px;text-align:center;display:none}#discount-for-review a{display:inline-block;width:auto;height:auto;margin:0;padding:0;border:none;box-shadow:none;float:none;cursor:pointer;text-decoration:none;font-size:12px;font-weight:700;color:#0073aa}.fts-color-settings-admin-form label,.fts-color-settings-admin-form span{color:#060606}.fts-color-settings-admin-form p.example{color:#fff;padding-bottom:35px!important}.fts-color-settings-admin-form fieldset label{color:#fff;line-height:30px}.fts-color-settings-admin-form fieldset a{color:#fff;text-decoration:none}@media (max-width:800px){.toplevel_page_feed-them-settings-page .feed-them-social-admin-wrap h1{text-shadow:#fff!important;height:32px!important;width:280px!important;background-size:280px!important}.feed-them-icon-wrap{position:relative;margin:-20px 0 70px;left:0!important;height:auto;clear:both;text-align:left}.feed-them-social-admin-slick-logo{display:none}#fts-date-and-time-format{width:100%}}.fts-failed-api-token,.fts-successful-api-token{clear:both;float:left;padding:7px 14px 7px 10px;border:1px solid rgba(255,255,255,.45);color:#000;margin:10px 20px 0 0;max-width:715px;width:100%}.fts-failed-api-token{background:rgba(245,207,206,.78)}.fts-successful-api-token{background:rgba(220,253,205,.78)}.feed-them_page_fts-facebook-feed-styles-submenu-page .fts-failed-api-token,.feed-them_page_fts-facebook-feed-styles-submenu-page .fts-successful-api-token,.feed-them_page_fts-instagram-feed-styles-submenu-page .feed-them_page_fts-instagram-feed-styles-submenu-page .fts-successful-api-token,.feed-them_page_fts-instagram-feed-styles-submenu-page .fts-failed-api-token,instagram-failed-message{margin-top:0!important;padding:10px 15px;max-width:708px}.fts-special-working-wrap{padding: 8px 8px 15px 18px!important;max-width:722px!important}#fts_facebook_custom_api_token,#fts_facebook_custom_api_token_biz,#fts_facebook_instagram_custom_api_token{margin-bottom:20px!important}.fts-facebook-custom-api-token-label{display:block;margin:0 40px 4px 0}.fts-facebook-custom-api-token-label a{font-weight:700;color:#df1818}.twitter-api-wrap{margin:20px 0 0}.twitter-api-wrap .feed-them-social-admin-input-wrap{margin:0}.fts-facebook-custom-api-token-label,.fts-instagram-custom-api-token-label{max-width:700px;line-height:21px;font-size:13px}.fts-facebook-get-access-token,.fts-facebook-get-access-token:focus,.fts-instagram-get-access-token,.fts-instagram-get-access-token:focus,.fts-pinterest-get-access-token,.fts-pinterest-get-access-token:focus,.fts-twitter-get-access-token,.fts-twitter-get-access-token:focus,.fts-youtube-get-access-token,.fts-youtube-get-access-token:focus{border-radius:5px;box-shadow:0 1px 1px #999;display:block;clear:both;float:left;font-size:14px;margin-bottom:25px;margin-top:5px;text-decoration:none;font-weight:600}.fts-instagram-get-access-token,.fts-instagram-get-access-token:focus{padding:18px 16px 19px 188px;background:url(../images/instagram-logo-admin.png) 13px 12px no-repeat #fff;color:#252525}.fts-pinterest-get-access-token,.fts-pinterest-get-access-token:focus{padding:18px 16px 19px 188px;background:url(../images/pinterest-logo-admin.jpg) 13px 12px no-repeat #fff;color:#252525}.fts-facebook-get-access-token:hover,.fts-instagram-get-access-token:hover,.fts-pinterest-get-access-token:hover{color:#666}.fts-facebook-get-access-token,.fts-facebook-get-access-token:focus{padding:18px 16px 19px 182px;background:url(../images/facebook-logo-admin.jpg) 14px 12px no-repeat #fff;color:#252525}@font-face{margin:0 0 9px;font-size:19px}.fts-title-description-settings-page{padding:25px 0 15px;max-width:740px;border-top:1px solid #ccc}.fts-premium-options-message,.fts-premium-options-message2{font-size:13px;padding:20px 25px 25px;line-height:19px;background-color:#fff;margin:0}.fts-premium-options-message a:first-child,.fts-premium-options-message2 a:first-child{font-size:16px;display:inline-block;padding:0;margin:0 0 5px;text-decoration:none}.fts-plugin-reviews{max-width:789px;padding:25px 28px 31px;box-shadow:0 0 1px #d1d1d1;border-radius:1px;background:rgba(255,255,255,1);-webkit-text-size-adjust:none;font-size:13px;line-height:21px;margin-right:10px}.fts-plugin-reviews a{text-decoration:none}.fts-plugin-reviews-rate{margin-bottom:20px;padding-bottom:20px;border-bottom:1px solid #eee}h1.plugin-author-note{margin:50px 0 15px!important;font-size:22px;color:#222;z-index:1;position:relative}.toplevel_page_feed-them-settings-page .error{margin:20px 20px 20px 0;max-width:818px}.feed-them_page_fts-facebook-feed-styles-submenu-page .error,.feed-them_page_fts-instagram-feed-styles-submenu-page .error,.feed-them_page_fts-pinterest-feed-styles-submenu-page .error,.feed-them_page_fts-system-info-submenu-page .error,.feed-them_page_fts-system-info-submenu-page .notice,.feed-them_page_fts-twitter-feed-styles-submenu-page .error,.feed-them_page_fts-youtube-feed-styles-submenu-page .error{margin:20px 20px 20px 0!important}.feed-them_page_fts-bar-settings-page .error{margin:20px 20px 20px 5px!important;max-width:1005px}.hashtag-option-small-text,.twitter-hashtag-etc-wrap{display:none}.twitter-hashtag-etc-wrap{margin:15px 0 35px}.fts-content{background-color:rgba(241,241,241,.65);padding:30px;z-index:1;display:nonee;border-radius:2px;box-shadow:0 2px 10px rgba(41,41,41,.51);min-height:315px}.shortcode-generator-form{border-radius:3px;margin-top:15px}.instructional-text a:hover{color:#ea1616;text-decoration:underline;opacity:.8}.final-shortcode-textarea h4{border-bottom:1px solid #fff;padding:0 0 10px;font-size:13px;margin-bottom:15px}.toplevel_page_feed-them-settings-page .fts-content h1{color:#fbfbfb;margin:0 0 12px;line-height:30px;text-shadow:1px 1px 1px rgba(51,51,51,.06);font-weight:600;background:url(../images/feed-them-social-logo.png) no-repeat;height:40px;width:377px;font-size:0}.fb-options-wrap .feed-them-social-admin-submit-btn{margin-top:5px}#fts-social-selector,.twitter-gen-selection{margin-bottom:25px}.fts-text-align-center{text-align:center}.toplevel_page_feed-them-settings-page .feed-them-social-admin-slick-logo{background:url(../images/footer-logo.png) center no-repeat;width:110px;height:20px;padding:0;margin:20px 0 -20px;display:inline-block;position:relative;bottom:0;opacity:1}.fb-image,.fts-backg{width:100%;height:100%;}.feed-them-social-admin-wrap h3{color:#000;font-size:20px;font-weight:400;line-height:23px;margin:0 0 5px}.feed-them-social-admin-wrap .feed-them-social-admin-form h2{color:#000;font-size:23px;font-weight:400;line-height:23px;margin:15px 0 20px;padding:0}.instagram-id-option-wrap .feed-them-social-admin-submit-btn,.toplevel_page_feed-them-settings-page .feed-them-social-admin-submit-btn{margin-top:0;margin-left:0!important}.toplevel_page_feed-them-settings-page .instagram-id-option-wrap .feed-them-social-admin-submit-btn{margin-top:5px!important;margin-left:0!important}.feed-them-clear-cache .use-of-plugin{margin:0}.feed-them-clear-cache h2,.feed-them-custom-css h2,.feed-them-custom-logo-css h2{margin-bottom:10px;margin-top:5px;font-size:17px;padding-top:20px;border-top:1px dotted rgba(177,177,177,.88);color:#060606}.feed-them-clear-cache h2{border:none;margin-top:17px;padding-top:0}.feed-them-custom-css p,.feed-them-custom-logo-css p{margin:0 0 5px}#fts-date-and-time-format{margin-bottom:10px}.feed-them-social-admin-submit-btn{margin-top:15px!important}#fts_admin_bar_menu{margin-bottom:0;margin-left:31px}.fts-backg{position:absolute;top:0;right:0;z-index:0;opacity:1;-webkit-animation:ftsettings 5s;animation:ftsettings 5s;background:rgba(255,255,255,.8)}@-webkit-keyframes ftsettings{from{opacity:0}to{opacity:1}}@keyframes ftsettings{from{opacity:0}to{opacity:1}}.fb-reviews,.reviews-options{display:none}.fts-required-token-message{padding:15px;background:#fcfcfc;margin:12px 0 20px;border-left:4px solid #fb3939}.custom_time_ago_wrap{padding-top:10px}.custom_time_ago_wrap h2{margin-bottom:20px}.custom_time_ago_wrap label{color:#000;display:inline-block;min-width:75px;margin:0 10px 12px;font-size:13px}.slideshow-wrap{margin-top:18px}.fb-page-list{margin:0;display:block;max-width:740px}.fb-page-list li{background:#fff;padding:8px 10px 10px;margin:0;border-left:15px solid #3b5999;border-bottom:1px solid #e9ebee;cursor:pointer}.fb-page-list li .feed-them-social-admin-submit-btn{display:none;margin-top:9px!important;position:absolute;right:15px;top:7px}.fb-page-list li:hover{background:rgba(255,255,255,.57)}.fb-image{margin:0 15px 0 0;float:left;line-height:50px;text-align:center!important;max-width:50px;min-width:50px;vertical-align:baseline;min-height:50px;max-height: 50px;}.fb-image img{display:inline-block;vertical-align:middle;border-radius:50px}.fb-name{margin:0;display:inline-block;line-height:15px;color:#4c4c4c;font-weight:500;padding-top:10px}.board-name,.combine-instagram-hashtag-option-text,.combine_instagram_hashtag,.combine_instagram_hashtag_type,.fb-video-play-btn-options-content,.fb-video-play-btn-options-wrap,.fb_album_photos_id,.fts-facebook-grid-options-wrap,.fts-facebook-load-more-options-wrap,.fts-facebook-load-more-options2-wrap,.fts-fb-id,.fts-instagram-load-more-options-wrap,.fts-super-facebook-options-wrap,.fts-youtube-load-more-options-wrap,.fts-youtube-load-more-options2-wrap,.instagram-hashtag-option-text,.instagram-location-option-text,.instagram_hashtag_type,.page-token,.pinterest-board-and-name-text,.slider_options_wrap,.slideshow-wrap,.youtube_align_comments_wrap,.youtube_channelID2,.youtube_name,.youtube_name2,.youtube_playlistID,.youtube_playlistID2,.youtube_singleVideoID{display:none}.fts-pages-info{background:#3b5999;max-width:710px;padding:10px 15px 12px;color:#fff;margin-top:1px;letter-spacing:.5px}.fts-fb-page-thumb{float:left;margin-right:10px;border-radius:50px}.fts-successful-api-token h3{margin-bottom:0;margin-top:4px;font-weight:700}.use-of-plugin{color:#000;font-size:13px;font-weight:400;line-height:20px;max-width:60%;padding-bottom:12px;margin-bottom:0}.fts-admin-button-no-work{margin:0 0 0 25px;line-height:41px}.twitter_hashtag_etc_name{padding-top:0}.page.inst-text-facebook-page{display:block}.slider_options_wrap.not-active-premium-fields,.slideshow-wrap .feed-them-social-admin-input-default{display:block!important}.fts-premium-options-message a.not-active-title:first-child{font-size:16px!important;display:block!important;padding:0!important;margin:0 0 5px!important;text-decoration:none!important}.combine-facebook-wrap,.combine-grid-options-wrap,.combine-instagram-wrap,.combine-pinterest-wrap,.combine-twitter-wrap,.combine-youtube-wrap,.combine_board_id,.combine_playlist_id,.combine_youtube_name,.display-comments-wrap,.facebook-reviews-wrap,.fts-premium-options-message,.fts-twitter-grid-options-wrap,.fts-twitter-load-more-options-wrap,.fts-twitter-load-more-options2-wrap,.inst-text-facebook-reviews,.instagram-profile-options-wrap,.like-box-wrap{display:none}.sectioned-options-title{margin-top:15px!important;margin-bottom:15px!important;border-bottom:1px solid #f1f1f1;padding:10px 10px 10px 30px;font-size:18px!important;color:#060606!important;background:#fff;margin-left:-30px!important;box-shadow:0 1px 1px rgba(153,153,153,.59)}.facebook-image-animation-option-wrap,.multiple_facebook .facebook-loadmore-wrap,.multiple_facebook .facebook-title-options-wrap,.multiple_facebook .like-box-wrap,.multiple_facebook h2{display:none!important}.fts-fb-load-more,.fts-fb-spinner{text-align:center}.fts-fb-spinner>div{width:10px;height:10px;background-color:#999;border-radius:100%;display:inline-block;-webkit-animation:fts-fb-bouncedelay 1.4s infinite ease-in-out;animation:fts-fb-bouncedelay 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both}.fts-hide-me,.popup-gallery-fb .fts-fb-caption{display:none}.fb-social-btn-below-description,.fb-social-btn-bottom,.fb-social-btn-top{width:100%!important;overflow:hidden}.fts-fb-spinner .bounce1{-webkit-animation-delay:-.32s;animation-delay:-.32s}.fts-fb-spinner .bounce2{-webkit-animation-delay:-.16s;animation-delay:-.16s}@-webkit-keyframes fts-fb-bouncedelay{0%,100%,80%{-webkit-transform:scale(0)}40%{-webkit-transform:scale(1)}}@keyframes fts-fb-bouncedelay{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.fts-fluid-videoWrapper-html5 video{object-fit:inherit;margin-bottom:0!important}.fts-fb-album-view-link a{color:#fff}.fts-fb-album-view-link a:hover{color:#eee}.fts-fb-load-more{border-radius:1px;padding:0;line-height:37px!important;width:100%;min-height:37px!important;font-size:13px!important;background:#fff!important;cursor:pointer;color:#787a7b;-webkit-transition:all .3s ease-in-out;-moz-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out;transition:all .3s ease-in-out;max-width:740px!important;font-weight:700}.toggle-custom-textarea-show span,label.toggle-custom-textarea-show{color:#fffefe}.fts-logo-header{margin-bottom:20px!important}.fts-logo-subheader{margin-bottom:10px!important}.fts-color-settings-admin-form label{font-weight:700;min-width:100px}#fts_clear_cache_developer_mode{margin-left:28px}.toplevel_page_feed-them-settings-page .pane-active{display:block}.toplevel_page_feed-them-settings-page .fts-tabbed{display:block;float:left;color:#545454;font-weight:700;text-decoration:none;line-height:1.9;text-align:center;cursor:pointer;border-bottom:1px solid #ccc;padding:10px 38px!important;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;min-width:115px;background:#fff;margin-right:1px!important;font-size:13px;width:auto!important}.toplevel_page_feed-them-settings-page label.tab-active{background:#0073aa!important;color:#fff!important}.toplevel_page_feed-them-settings-page .fts-tab-content{clear:both;padding-top:15px}.feed-them-social-admin-input-label small{font-weight:400}.not-active-title:hover h3{color:#028fd2}.not-active-title h3{color:#0073aa}@media (max-width:797px){.toplevel_page_feed-them-settings-page #fts-tabs{margin-top:140px!important}}@media (max-width:450px){#shortcode-form-selector{min-width:270px!important}}@media (max-width:500px){.toplevel_page_feed-them-settings-page #fts-tab-content1 .use-of-plugin{max-width:100%!important}}#fts-timezone{max-width:300px}.fts-instagram-username-picker-wrap li{clear:both;background:#e6e6e6;padding:10px;margin-bottom:1px;display:block;width:100%;line-height:16px;float:left}.combine-twitter-hashtag-etc-wrap,.facebook_hide_date,.facebook_hide_name,.facebook_hide_thumbnail,.facebook_show_media,.fts-success,.youtube_video_single_info_display{display:none}.fts-instagram-username-picker-wrap li.fts-insta-id-active,.fts-instagram-username-picker-wrap li:hover{background:#0073aa;color:#fff}.ft-instagram-username-picker{clear:both;margin:0 0 1px;height:65px}.fts-insta-profile-picture-div img{float:left;max-width:65px;margin-right:15px;border-radius:100px}.fts-insta-fullname-div{padding:5px 0 2px}.fts-insta-id-div{font-style:italic;padding:5px 0 0}.fts-instagram-username-picker-wrap{padding-right:20px;max-height:310px;overflow:auto;margin:0}.fts-instagram-username-picker-wrap li:first-child{margin-top:10px}.fts-instagram-username-picker-wrap li:last-child{margin-bottom:10px}.fts-empty-error input,input.fts-empty-error{background:#ffffd8!important}.fts-instagram-username-picker-wrap li{color:#222}.fts-highlight{background:#0073aa;border-radius:20px;color:#fff;padding:0 5px}.fts-youtube-get-access-token,.fts-youtube-get-access-token:focus{padding:18px 16px 19px 188px;background: url(../images/google-logo-admin.jpg) 13px 12px no-repeat #fff;color:#252525;}.fts-twitter-get-access-token,.fts-twitter-get-access-token:focus{padding:18px 16px 19px 188px;background:url(../images/twitter-logo-admin.jpg) 13px 12px no-repeat #fff;color:#252525}.fts-twitter-add-all-keys-click-option,.fts-youtube-add-all-keys-click-option{margin:-10px 0 15px;text-align:left;clear:both}.twitter-extra-keys-text,.youtube-extra-keys-text{max-width:550px;margin-bottom:15px}.feed-them_page_fts-twitter-feed-styles-submenu-page .fts-successful-api-token{margin-top:0;margin-bottom:-10px}#fts-timer{padding:6px 0 0 1px;float:left}@font-face{font-family:FontAwesomeSlick;src:url(../../feeds/css/font/fontawesome-webfont.eot?v=3.2.1);src:url(../../feeds/css/font/fontawesome-webfont.eot?#iefix&v=3.2.1) format("embedded-opentype"),url(../../feeds/css/font/fontawesome-webfont.woff?v=3.2.1) format("woff"),url(../../feeds/css/font/fontawesome-webfont.ttf?v=3.2.1) format("truetype"),url(../../feeds/css/font/fontawesome-webfont.svg#fontawesomeregular?v=3.2.1) format("svg")}.fts-success:before{font-family:FontAwesomeSlick!important;content:"\f00c"!important;font-size:14px;position:relative;line-height:19px}.fts-success{margin:3px 6px 0;padding:2px 4px;color:#fff;background:#01a701;border-radius:20px;float:left;font-size:10px!important;width:auto;height:18px}#discount-for-review a:hover{color:#0073aa}.fb-sublist{border:none!important;overflow:auto;height:200px;background:#f7f7f7}.fb-sublist li{border:1px solid #f7f7f7!important;border-bottom:0;border-right:0}.fts-token-save{border-radius:100px}.fb-sublist .fb-name{letter-spacing:0!important;font-size:13px}.fts-fb-location-text-wrap{padding:8px;text-align:center;color:#f7f7f7;font-weight:700;background:#00a400;margin:10px 0 0}.fb-name small{display:block;line-height:0;letter-spacing:0;color:#969696}.fts-successful-api-token small{font-size:12px}.fb-page-list li{position:relative}.fts-successful-api-token h3 a{text-decoration:none!important;color:#262627;text-shadow:1px 1px 1px #fff;font-size:17px}.fts-successful-api-token h3 a:hover,.fts-successful-api-token img:hover{opacity:.8}.fb-page-list .fts-fb-load-more{color:#00a400}.feed-them-icon-wrap a.youtube-icon{background:url(../images/youtube-icon.png) top right no-repeat}.combine-instagram-wrap .fts-instagram-hashtag-location-options-message{margin-top:25px;margin-bottom:-25px}.fts-fb-token-wrap .dashicons-admin-links:before{font-size:20px;color:#3b5999}.fb-page-master-list .dashicons-admin-links:before{top:-3px;position:relative}.fts-successful-api-token .dashicons-admin-links:before{top:3px;position:relative}.fts-arrow-icon:before{content:'\f054';font-family:FontAwesomeSlick!important;color:#00a400;font-size:18px!important;position:relative;top:2px;padding:0 8px}.fts-fb-icon:before{content:'\f082';font-family:FontAwesomeSlick!important;color:#3a5899;font-size:20px!important;position:relative;top:2px;padding-right:5px}.fts-insta-icon:before{content:'\f16d';font-family:FontAwesomeSlick!important;color:#263232;font-size:22px!important;position:relative;top:3px;padding-right:5px}.fts-special-working-wrap .fts-arrow-icon:before{font-size:18px!important;top:1px}.fts-special-working-wrap .fts-fb-icon:before{top:1px}.fts-special-working-wrap .fts-insta-icon:before{top:2px}.instagram_hashtag{display:none}
admin/data-protection/data-protection.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php namespace feedthemsocial;
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) )
5
+ exit;
6
+
7
+ /**
8
+ * Class responsible for encrypting and decrypting data.
9
+ *
10
+ * @since 1.0.0
11
+ * @access private
12
+ * @ignore
13
+ */
14
+ class Data_Protection {
15
+
16
+ /**
17
+ * Key to use for encryption.
18
+ *
19
+ * @since 1.0.0
20
+ * @var string
21
+ */
22
+ private $key;
23
+
24
+ /**
25
+ * Salt to use for encryption.
26
+ *
27
+ * @since 1.0.0
28
+ * @var string
29
+ */
30
+ private $salt;
31
+
32
+ /**
33
+ * Constructor.
34
+ *
35
+ * @since 1.0.0
36
+ */
37
+ public function __construct() {
38
+ $this->key = $this->get_default_key();
39
+ $this->salt = $this->get_default_salt();
40
+ }
41
+
42
+ /**
43
+ * Encrypt.
44
+ *
45
+ * Encrypt the data.
46
+ *
47
+ * @param $value
48
+ * @return false|mixed|string
49
+ */
50
+ public function encrypt($value ) {
51
+
52
+ //error_log( print_r( 'json_decoded Value: '. json_decode($value), true ) );
53
+
54
+ if ( ! extension_loaded( 'openssl' ) || empty( $value ) ) {
55
+ return false;
56
+ }
57
+
58
+ $method = 'aes-256-ctr';
59
+ $ivlen = openssl_cipher_iv_length( $method );
60
+ $iv = openssl_random_pseudo_bytes( $ivlen );
61
+
62
+ if( is_object($value) ) {
63
+ $value = json_encode($value);
64
+ }
65
+
66
+ $encrypted_value = openssl_encrypt( $value . $this->salt, $method, $this->key, 0, $iv );
67
+ if ( ! $encrypted_value ) {
68
+ return false;
69
+ }
70
+
71
+ // print_r( $encrypted_value, true );
72
+
73
+ return base64_encode( $iv . $encrypted_value );
74
+ }
75
+
76
+ /**
77
+ * Decrypt.
78
+ *
79
+ * Decrypt the data.
80
+ *
81
+ * @param $encrypted_value
82
+ * @return false|mixed|string
83
+ */
84
+ public function decrypt( $encrypted_value ) {
85
+
86
+ if ( ! extension_loaded( 'openssl' ) || empty( $encrypted_value ) ) {
87
+ return false;
88
+ }
89
+ $encrypted_value = base64_decode( $encrypted_value, true );
90
+
91
+ $method = 'aes-256-ctr';
92
+ $ivlen = openssl_cipher_iv_length( $method );
93
+ $iv = substr( $encrypted_value, 0, $ivlen );
94
+
95
+ $encrypted_value = substr( $encrypted_value, $ivlen );
96
+
97
+ $decrypted_value = openssl_decrypt( $encrypted_value, $method, $this->key, 0, $iv );
98
+ if ( ! $decrypted_value || substr( $decrypted_value, - strlen( $this->salt ) ) !== $this->salt ) {
99
+ return false;
100
+ }
101
+
102
+ return substr( $decrypted_value, 0, - strlen( $this->salt ) );
103
+
104
+ }
105
+
106
+ /**
107
+ * Gets the default encryption key to use.
108
+ *
109
+ * @since 1.0.0
110
+ *
111
+ * @return string Default (not user-based) encryption key.
112
+ */
113
+ private function get_default_key() {
114
+ if ( defined( 'AUTH_KEY' ) && '' !== AUTH_KEY ) {
115
+ //error_log( print_r( AUTH_KEY, true ) );
116
+ return AUTH_KEY;
117
+
118
+
119
+ }
120
+ return 'das-ist-kein-geheimer-schluessel';
121
+ }
122
+
123
+ /**
124
+ * Gets the default encryption salt to use.
125
+ *
126
+ * @since 1.0.0
127
+ *
128
+ * @return string Encryption salt.
129
+ */
130
+ private function get_default_salt() {
131
+
132
+ if ( defined( 'AUTH_KEY' ) && '' !== AUTH_KEY ) {
133
+ return AUTH_KEY;
134
+ }
135
+
136
+ // If this is reached, you're either not on a live site or have a serious security issue.
137
+ return 'das-ist-kein-geheimes-salz';
138
+ }
139
+ }
admin/js/admin.js CHANGED
@@ -1,22 +1,125 @@
1
- jQuery(document).ready(function() {
2
-
3
- jQuery("#wp-admin-bar-feed_them_social_admin_bar-default li:first-child a").click(function() {
4
- //alert('etf');
5
- console.log('Click Clear Cache Function');
6
-
7
- jQuery.ajax({
8
- data: {action: "fts_clear_cache_ajax" },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  type: 'POST',
10
  url: ftsAjax.ajaxurl,
11
- success: function( response ) {
12
- // jQuery('body').hide();
13
- console.log('Well Done and got this from sever: ' + response);
14
- // alert and upon clicking refresh the page
15
- if(!alert('Cache for all FTS Feeds cleared!')){window.location.reload();}
16
-
17
- return false;
18
- }
19
  }); // end of ajax()
20
  return false;
21
- }); // end of document.ready
22
- }); // end of form.submit
1
+ function fts_ClearCache() {
2
+ console.log('Clicked Clear Cache Function');
3
+
4
+ jQuery.ajax({
5
+ data: {action: "fts_clear_cache_ajax"},
6
+ type: 'POST',
7
+ url: ftsAjax.ajaxurl,
8
+ success: function (response) {
9
+ // jQuery('body').hide();
10
+ console.log('Well Done and got this from sever: ' + response);
11
+ // alert and upon clicking refresh the page
12
+ if (!alert('Cache for all FTS Feeds cleared!')) {
13
+ window.location.reload();
14
+ }
15
+
16
+ return false;
17
+ }
18
+ }); // end of ajax()
19
+ return false;
20
+ }
21
+
22
+ jQuery(document).ready(function ($) {
23
+
24
+ // Grab the url so we can do stuff.
25
+ var url_string = window.location.href;
26
+ var url = new URL(url_string);
27
+
28
+ // Encrypt: Instagram Basic
29
+ if ( $('#fts_instagram_custom_api_token').length !== 0 ) {
30
+ // Do NOT run this if we are getting a token for Instagram, because we save the token via ajax. The Instagram Business and Facebook Business do not.
31
+ if (url_string.indexOf("code") === -1 && url_string.indexOf("feed_type") === -1) {
32
+
33
+ if ('' === $('#fts_instagram_custom_api_token').data('token')) {
34
+
35
+ if ('' === $('#fts_instagram_custom_api_token').val()) {
36
+ console.log('Instagram Basic: No token has been set.');
37
+ } else {
38
+ // User clicked enter or submit button.
39
+ console.log('Instagram Basic: Token set, now encrypting.');
40
+ fts_encrypt_token_ajax($('#fts_instagram_custom_api_token').val(), 'basic', '#fts_instagram_custom_api_token');
41
+ }
42
+ } else {
43
+ console.log('Instagram Basic: Token is already set & encrypted.');
44
+ }
45
+ }
46
+ }
47
+
48
+ // Encrypt: Instagram Business
49
+ if ( $('#fts_instagram_custom_api_token').length !== 0 ) {
50
+
51
+ if ('' === $('#fts_facebook_instagram_custom_api_token').data('token')) {
52
+
53
+ // If no value set then return message.
54
+ if ('' === $('#fts_facebook_instagram_custom_api_token').val()) {
55
+ console.log('Instagram Business: No token has been set.');
56
+ } else {
57
+ // User clicked enter or submit button.
58
+ console.log('Instagram Business: Token set, now encrypting.');
59
+ fts_encrypt_token_ajax($('#fts_facebook_instagram_custom_api_token').val(), 'business', '#fts_facebook_instagram_custom_api_token');
60
+ }
61
+ } else {
62
+ console.log('Instagram Business: Token is already set & encrypted.');
63
+ }
64
+ }
65
+
66
+ // Encrypt: Facebook Business
67
+ if ( $('#fts_facebook_custom_api_token').length !== 0 ) {
68
+
69
+ if ('' === $('#fts_facebook_custom_api_token').data('token')) {
70
+
71
+ // If no value set then return message.
72
+ if ('' === $('#fts_facebook_custom_api_token').val()) {
73
+ console.log('Facebook Business: No token has been set.');
74
+ } else {
75
+ // User clicked enter or submit button.
76
+ console.log('Facebook Business: Token set, now encrypting.');
77
+ fts_encrypt_token_ajax($('#fts_facebook_custom_api_token').val(), 'fbBusiness', '#fts_facebook_custom_api_token');
78
+ }
79
+ } else {
80
+ console.log('Facebook Business: Token is already set & encrypted.');
81
+ }
82
+ }
83
+
84
+ // Encrypt: Facebook Business Reviews
85
+ if ( $('#fts_facebook_custom_api_token_biz').length !== 0 ) {
86
+
87
+ if ('' === $('#fts_facebook_custom_api_token_biz').data('token')) {
88
+
89
+ // If no value set then return message.
90
+ if ('' === $('#fts_facebook_custom_api_token_biz').val()) {
91
+ console.log('Facebook Business: No token has been set.');
92
+ } else {
93
+ // User clicked enter or submit button.
94
+ console.log('Facebook Business Reviews: Token set, now encrypting.');
95
+ fts_encrypt_token_ajax($('#fts_facebook_custom_api_token_biz').val(), 'fbBusinessReviews', '#fts_facebook_custom_api_token_biz');
96
+ }
97
+ } else {
98
+ console.log('Facebook Business Reviews: Token is already set & encrypted.');
99
+ }
100
+ }
101
+
102
+ function fts_encrypt_token_ajax( access_token, token_type , id ) {
103
+
104
+ var token = access_token;
105
+
106
+ $.ajax({
107
+ data: {
108
+ action: 'fts_encrypt_token_ajax',
109
+ access_token: token,
110
+ token_type: token_type,
111
+ },
112
  type: 'POST',
113
  url: ftsAjax.ajaxurl,
114
+ success: function ( response ) {
115
+
116
+ var data = JSON.parse( response );
117
+ // Add the OG token to the input value and add the encrypted token to the data-attribute.
118
+ $( id ).attr('value', data.token).attr('data-token', 'encrypted');
119
+ console.log( id + ': OG Token and Encrypted Response: ' + response );
120
+ }
121
+
122
  }); // end of ajax()
123
  return false;
124
+ }
125
+ });
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.7.1
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.9
17
- * Stable tag: 2.9.7.1
18
  * License: GPLv2 or later
19
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
20
  *
21
- * @version 2.9.7.1
22
  * @package FeedThemSocial/Core
23
  * @copyright Copyright (c) 2012-2022 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.7.1' );
35
 
36
  define( 'FEED_THEM_SOCIAL_NOTICE_STATUS', get_option( 'rating_fts_slick_notice', false ) );
37
 
@@ -111,16 +111,17 @@ final class Feed_Them_Social {
111
  // Truncate HTML Class
112
  self::$instance->truncate_html = new FeedThemSocialTruncateHTML();
113
 
114
- // FTS Custom Post Type
115
- // self::$instance->fts_custom_post_type = new feedthemsocial\FTS_Custom_Post_Type();
 
116
  // Core (and load init)!
117
- self::$instance->core_functions = new feedthemsocial\feed_them_social_functions();
118
 
119
  // Free Plugin License page!
120
  self::$instance->updater = new feedthemsocial\updater_init();
121
 
122
  // Facebook!
123
- self::$instance->facebook_feed = new feedthemsocial\FTS_Facebook_Feed();
124
 
125
  // Twitter!
126
  self::$instance->twitter_feed = new feedthemsocial\FTS_Twitter_Feed();
@@ -304,9 +305,12 @@ final class Feed_Them_Social {
304
 
305
  include FEED_THEM_SOCIAL_PLUGIN_FOLDER_DIR . 'includes/error-handler.php';
306
 
 
 
 
307
  // Core classes!
308
  include FEED_THEM_SOCIAL_PLUGIN_FOLDER_DIR . 'includes/feed-them-functions.php';
309
- $load_fts = new feedthemsocial\feed_them_social_functions();
310
  $load_fts->init();
311
 
312
  // Admin Pages!
@@ -428,6 +432,7 @@ final class Feed_Them_Social {
428
  $activation_options = array(
429
  'fts-date-and-time-format' => 'one-day-ago',
430
  'fts_clear_cache_developer_mode' => '86400',
 
431
  );
432
 
433
  foreach ( $activation_options as $option_key => $option_value ) {
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.8
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.9.2
17
+ * Stable tag: 2.9.8
18
  * License: GPLv2 or later
19
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
20
  *
21
+ * @version 2.9.8
22
  * @package FeedThemSocial/Core
23
  * @copyright Copyright (c) 2012-2022 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.8' );
35
 
36
  define( 'FEED_THEM_SOCIAL_NOTICE_STATUS', get_option( 'rating_fts_slick_notice', false ) );
37
 
111
  // Truncate HTML Class
112
  self::$instance->truncate_html = new FeedThemSocialTruncateHTML();
113
 
114
+ // DATA PROTECTIOM
115
+ self::$instance->data_protection = new feedthemsocial\Data_Protection(); // Core (and load init)!
116
+
117
  // Core (and load init)!
118
+ self::$instance->core_functions = new feedthemsocial\feed_them_social_functions( );
119
 
120
  // Free Plugin License page!
121
  self::$instance->updater = new feedthemsocial\updater_init();
122
 
123
  // Facebook!
124
+ self::$instance->facebook_feed = new feedthemsocial\FTS_Facebook_Feed( );
125
 
126
  // Twitter!
127
  self::$instance->twitter_feed = new feedthemsocial\FTS_Twitter_Feed();
305
 
306
  include FEED_THEM_SOCIAL_PLUGIN_FOLDER_DIR . 'includes/error-handler.php';
307
 
308
+ //Data Protection
309
+ include FEED_THEM_SOCIAL_PLUGIN_FOLDER_DIR . 'admin/data-protection/data-protection.php';
310
+
311
  // Core classes!
312
  include FEED_THEM_SOCIAL_PLUGIN_FOLDER_DIR . 'includes/feed-them-functions.php';
313
+ $load_fts = new feedthemsocial\feed_them_social_functions( );
314
  $load_fts->init();
315
 
316
  // Admin Pages!
432
  $activation_options = array(
433
  'fts-date-and-time-format' => 'one-day-ago',
434
  'fts_clear_cache_developer_mode' => '86400',
435
+ 'fts_admin_bar_menu' => 'show-admin-bar-menu',
436
  );
437
 
438
  foreach ( $activation_options as $option_key => $option_value ) {
feeds/facebook/class-fts-facebook-feed.php CHANGED
@@ -7,6 +7,9 @@
7
  * @since 1.9.6
8
  */
9
  class FTS_Facebook_Feed extends feed_them_social_functions {
 
 
 
10
  /**
11
  * Construct
12
  *
@@ -14,7 +17,11 @@ class FTS_Facebook_Feed extends feed_them_social_functions {
14
  *
15
  * @since 1.9.6
16
  */
17
- public function __construct() {
 
 
 
 
18
  add_shortcode( 'fts_facebook_group', array( $this, 'fts_fb_func' ) );
19
  add_shortcode( 'fts_facebook_page', array( $this, 'fts_fb_func' ) );
20
  add_shortcode( 'fts_facebook_event', array( $this, 'fts_fb_func' ) );
@@ -162,12 +169,7 @@ class FTS_Facebook_Feed extends feed_them_social_functions {
162
  }
163
 
164
  // Get Access Token.
165
- $access_token = isset( $fb_shortcode['access_token'] ) ? $fb_shortcode['access_token'] : '';
166
- if ( ! empty( $access_token ) ) {
167
- $access_token = $fb_shortcode['access_token'];
168
- } else {
169
- $access_token = $this->get_access_token();
170
- }
171
 
172
  // UserName?.
173
  if ( ! $fb_shortcode['id'] ) {
@@ -283,6 +285,7 @@ class FTS_Facebook_Feed extends feed_them_social_functions {
283
  $fb_cache_name = $this->get_fb_cache_name( $fb_shortcode );
284
  // Get language.
285
  $language = $this->get_language( $fb_shortcode );
 
286
  if ( 'reviews' !== $fb_shortcode['type'] ) {
287
  // Get Response (AKA Page & Feed Information) ERROR CHECK inside this function.
288
  $response = $this->get_facebook_feed_response( $fb_shortcode, $fb_cache_name, $access_token, $language );
@@ -310,7 +313,7 @@ class FTS_Facebook_Feed extends feed_them_social_functions {
310
  } elseif ( ! empty( $fb_shortcode['access_token'] ) ) {
311
  $biz_access_token = $fb_shortcode['access_token'];
312
  } else {
313
- $biz_access_token = get_option( 'fts_facebook_custom_api_token_biz' );
314
  }
315
 
316
  // Get Response (AKA Page & Feed Information) ERROR CHECK inside this function.
@@ -1467,36 +1470,6 @@ style="margin:' . ( isset( $fb_shortcode['slider_margin'] ) && '' !== $fb_shortc
1467
  }
1468
  }
1469
 
1470
- /**
1471
- * Get Access Token
1472
- *
1473
- * @return mixed
1474
- * @since 1.9.6
1475
- */
1476
- public function get_access_token() {
1477
- // The API Access Token.
1478
- // $custom_access_token = get_option('fts_facebook_custom_api_token');
1479
- // if (!empty($custom_access_token)) {
1480
- // return $access_token;
1481
- // } else {
1482
- // Randomizer
1483
- // $values = array(
1484
- // '431287540548931|4A23YYIFqhd-gpz_E4Fy6U_Seo0',
1485
- // '1748446362151826|epVUmLiKT8QhLN63iRvvXXHwxqk',
1486
- // '1875381106044241|KmWz3mtzGye0M5HTdX0SK7rqpIU',
1487
- // '754106341419549|AMruxCJ_ly8825VXeLhBKo_kOfs',
1488
- // '438563519819257|1GJ8GLl1AQ7ZTvXV_Xpok_QpH6s',
1489
- // '753693994788276|xm_PXoNRWW8WPQdcQArRpBgWn5Q',
1490
- // '644818402385988|sABEvG0QiOaJRlNLC2NphfQLlfg',
1491
- // '292500071162951|9MA-kzWVs6HTEybpdxKjgF_gqeo',
1492
- // '263710677420086|Jpui2CFig7RbtdHaHPN_fiEa77U',
1493
- // '1850081601881384|u2JcPCn7TH40MY5BwC-i4PMHGm8',
1494
- // );
1495
- // $access_token = $values[array_rand($values, 1)];.
1496
- return get_option( 'fts_facebook_custom_api_token' );
1497
- // }
1498
- }
1499
-
1500
  /**
1501
  * Get View Link
1502
  *
@@ -1634,14 +1607,22 @@ style="margin:' . ( isset( $fb_shortcode['slider_margin'] ) && '' !== $fb_shortc
1634
  }
1635
 
1636
  if ( false !== $this->fts_check_feed_cache_exists( $fb_cache_name ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
 
 
 
 
 
 
1637
  $response = $this->fts_get_feed_cache( $fb_cache_name );
1638
  } else {
 
 
1639
  // Page.
1640
  if ( 'page' === $fb_shortcode['type'] && 'page_only' === $fb_shortcode['posts_displayed'] ) {
1641
  $mulit_data = array( 'page_data' => 'https://graph.facebook.com/' . $fb_shortcode['id'] . '?fields=id,name,description&access_token=' . $access_token . $language . '' );
1642
 
1643
  if ( isset( $_REQUEST['next_url'] ) ) {
1644
- $_REQUEST['next_url'] = str_replace( 'access_token=XXX', 'access_token=' . get_option( 'fts_facebook_custom_api_token' ), $_REQUEST['next_url'] );
1645
  }
1646
 
1647
  if ( ! $fts_count_ids >= 1 ) {
@@ -1655,7 +1636,7 @@ style="margin:' . ( isset( $fb_shortcode['slider_margin'] ) && '' !== $fb_shortc
1655
  'albums' === $fb_shortcode['type'] ) {
1656
  $mulit_data = array( 'page_data' => 'https://graph.facebook.com/' . $fb_shortcode['id'] . '?fields=id,name,description,link&access_token=' . $access_token . $language . '' );
1657
  if ( isset( $_REQUEST['next_url'] ) ) {
1658
- $_REQUEST['next_url'] = str_replace( 'access_token=XXX', 'access_token=' . get_option( 'fts_facebook_custom_api_token' ), $_REQUEST['next_url'] );
1659
  }
1660
  // Check If Ajax next URL needs to be used.
1661
  if ( ! $fts_count_ids >= 1 ) {
@@ -1670,7 +1651,7 @@ style="margin:' . ( isset( $fb_shortcode['slider_margin'] ) && '' !== $fb_shortc
1670
  'album_photos' === $fb_shortcode['type'] ) {
1671
  $mulit_data = array( 'page_data' => 'https://graph.facebook.com/' . $fb_shortcode['id'] . '?fields=id,name,description&access_token=' . $access_token . $language . '' );
1672
  if ( isset( $_REQUEST['next_url'] ) ) {
1673
- $_REQUEST['next_url'] = str_replace( 'access_token=XXX', 'access_token=' . get_option( 'fts_facebook_custom_api_token' ), $_REQUEST['next_url'] );
1674
  }
1675
  // Check If Ajax next URL needs to be used
1676
  // The reason I did not create a whole new else if for the video album is because I did not want to duplicate all the code required to make the video because the videos gallery comes from the photo albums on facebook.
@@ -1695,9 +1676,13 @@ style="margin:' . ( isset( $fb_shortcode['slider_margin'] ) && '' !== $fb_shortc
1695
  }
1696
  } elseif ( 'reviews' === $fb_shortcode['type'] ) {
1697
 
 
 
 
1698
  // Reviews.
1699
  if ( is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) ) {
1700
  $fts_facebook_reviews = new FTS_Facebook_Reviews();
 
1701
  $mulit_data = $fts_facebook_reviews->review_connection( $fb_shortcode, $access_token, $language );
1702
 
1703
  $mulit_data['ratings_data'] = esc_url_raw( 'https://graph.facebook.com/' . $fb_shortcode['id'] . '/?fields=overall_star_rating,rating_count&access_token=' . $access_token . '' );
@@ -1723,6 +1708,7 @@ style="margin:' . ( isset( $fb_shortcode['slider_margin'] ) && '' !== $fb_shortc
1723
  $feed_data = json_decode( $response['feed_data'] );
1724
  $fts_error_check = new fts_error_handler();
1725
  $fts_error_check_complete = $fts_error_check->facebook_error_check( $fb_shortcode, $feed_data );
 
1726
  if ( is_array( $fts_error_check_complete ) && true === $fts_error_check_complete[0] ) {
1727
 
1728
  // If old Cache exists use it instead of showing an error.
@@ -1757,7 +1743,16 @@ style="margin:' . ( isset( $fb_shortcode['slider_margin'] ) && '' !== $fb_shortc
1757
  // Make sure it's not ajaxing.
1758
  if ( ! empty( $response['feed_data'] ) ) {
1759
  // Create Cache.
 
 
 
 
 
 
 
1760
  $this->fts_create_feed_cache( $fb_cache_name, $response );
 
 
1761
  }
1762
  } // end main else.
1763
 
@@ -1834,9 +1829,14 @@ style="margin:' . ( isset( $fb_shortcode['slider_margin'] ) && '' !== $fb_shortc
1834
  $fb_type = isset( $counter->attachments->data[0]->type ) ? $counter->attachments->data[0]->type : '';
1835
  $post_data_key = isset( $counter->attachments->data[0]->object_id) ? $counter->attachments->data[0]->object_id: $counter->id;
1836
 
1837
- // Likes & Comments.
1838
- $fb_post_array[ $post_data_key . '_likes' ] = 'https://graph.facebook.com/' . $post_data_key . '/reactions?summary=1&access_token=' . $access_token;
1839
- $fb_post_array[ $post_data_key . '_comments' ] = 'https://graph.facebook.com/' . $post_data_key . '/comments?summary=1&access_token=' . $access_token;
 
 
 
 
 
1840
  // Video.
1841
  if ( 'video' === $fb_type ) {
1842
  $fb_post_array[ $post_data_key . '_video' ] = 'https://graph.facebook.com/' . $post_data_key;
@@ -2122,7 +2122,16 @@ style="margin:' . ( isset( $fb_shortcode['slider_margin'] ) && '' !== $fb_shortc
2122
  // we check to see if the loadmore count number is set and if so pass that as the new count number when fetching the next set of posts.
2123
  $_REQUEST['next_url'] = '' !== $loadmore_count ? str_replace( "limit=$posts", "limit=$loadmore_count", $next_url ) : $next_url;
2124
 
2125
- $access_token = is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) ? 'access_token=' . get_option( 'fts_facebook_custom_api_token_biz' ) : 'access_token=' . get_option( 'fts_facebook_custom_api_token' );
 
 
 
 
 
 
 
 
 
2126
  $_REQUEST['next_url'] = str_replace( $access_token, 'access_token=XXX', $next_url );
2127
 
2128
  echo '<script>';
@@ -2269,4 +2278,4 @@ style="margin:' . ( isset( $fb_shortcode['slider_margin'] ) && '' !== $fb_shortc
2269
 
2270
  return $random_string;
2271
  }
2272
- }//end class
7
  * @since 1.9.6
8
  */
9
  class FTS_Facebook_Feed extends feed_them_social_functions {
10
+
11
+ public $data_protection;
12
+
13
  /**
14
  * Construct
15
  *
17
  *
18
  * @since 1.9.6
19
  */
20
+ public function __construct( ) {
21
+
22
+ // Data Protection
23
+ $this->data_protection = new Data_Protection();
24
+
25
  add_shortcode( 'fts_facebook_group', array( $this, 'fts_fb_func' ) );
26
  add_shortcode( 'fts_facebook_page', array( $this, 'fts_fb_func' ) );
27
  add_shortcode( 'fts_facebook_event', array( $this, 'fts_fb_func' ) );
169
  }
170
 
171
  // Get Access Token.
172
+ $access_token = isset( $fb_shortcode['access_token'] ) && '' !== $fb_shortcode['access_token'] ? $fb_shortcode['access_token'] : $this->get_fb_access_token();
 
 
 
 
 
173
 
174
  // UserName?.
175
  if ( ! $fb_shortcode['id'] ) {
285
  $fb_cache_name = $this->get_fb_cache_name( $fb_shortcode );
286
  // Get language.
287
  $language = $this->get_language( $fb_shortcode );
288
+
289
  if ( 'reviews' !== $fb_shortcode['type'] ) {
290
  // Get Response (AKA Page & Feed Information) ERROR CHECK inside this function.
291
  $response = $this->get_facebook_feed_response( $fb_shortcode, $fb_cache_name, $access_token, $language );
313
  } elseif ( ! empty( $fb_shortcode['access_token'] ) ) {
314
  $biz_access_token = $fb_shortcode['access_token'];
315
  } else {
316
+ $biz_access_token = $this->get_fb_biz_access_token();
317
  }
318
 
319
  // Get Response (AKA Page & Feed Information) ERROR CHECK inside this function.
1470
  }
1471
  }
1472
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1473
  /**
1474
  * Get View Link
1475
  *
1607
  }
1608
 
1609
  if ( false !== $this->fts_check_feed_cache_exists( $fb_cache_name ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
1610
+
1611
+ // YO!
1612
+ // echo 'Cache Should Be Printing out here.<br/>';
1613
+ // echo $fb_cache_name;
1614
+ // print_r( $this->fts_get_feed_cache( $fb_cache_name ) );
1615
+
1616
  $response = $this->fts_get_feed_cache( $fb_cache_name );
1617
  } else {
1618
+
1619
+ // echo $access_token;
1620
  // Page.
1621
  if ( 'page' === $fb_shortcode['type'] && 'page_only' === $fb_shortcode['posts_displayed'] ) {
1622
  $mulit_data = array( 'page_data' => 'https://graph.facebook.com/' . $fb_shortcode['id'] . '?fields=id,name,description&access_token=' . $access_token . $language . '' );
1623
 
1624
  if ( isset( $_REQUEST['next_url'] ) ) {
1625
+ $_REQUEST['next_url'] = str_replace( 'access_token=XXX', 'access_token=' . $access_token, $_REQUEST['next_url'] );
1626
  }
1627
 
1628
  if ( ! $fts_count_ids >= 1 ) {
1636
  'albums' === $fb_shortcode['type'] ) {
1637
  $mulit_data = array( 'page_data' => 'https://graph.facebook.com/' . $fb_shortcode['id'] . '?fields=id,name,description,link&access_token=' . $access_token . $language . '' );
1638
  if ( isset( $_REQUEST['next_url'] ) ) {
1639
+ $_REQUEST['next_url'] = str_replace( 'access_token=XXX', 'access_token=' . $access_token, $_REQUEST['next_url'] );
1640
  }
1641
  // Check If Ajax next URL needs to be used.
1642
  if ( ! $fts_count_ids >= 1 ) {
1651
  'album_photos' === $fb_shortcode['type'] ) {
1652
  $mulit_data = array( 'page_data' => 'https://graph.facebook.com/' . $fb_shortcode['id'] . '?fields=id,name,description&access_token=' . $access_token . $language . '' );
1653
  if ( isset( $_REQUEST['next_url'] ) ) {
1654
+ $_REQUEST['next_url'] = str_replace( 'access_token=XXX', 'access_token=' . $access_token, $_REQUEST['next_url'] );
1655
  }
1656
  // Check If Ajax next URL needs to be used
1657
  // The reason I did not create a whole new else if for the video album is because I did not want to duplicate all the code required to make the video because the videos gallery comes from the photo albums on facebook.
1676
  }
1677
  } elseif ( 'reviews' === $fb_shortcode['type'] ) {
1678
 
1679
+ // YO!
1680
+ // echo 'myCacheName Ok so we are good to this point, but when you reload the page the cache is not decrypting somewhere.';
1681
+ // echo $fb_cache_name;
1682
  // Reviews.
1683
  if ( is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) ) {
1684
  $fts_facebook_reviews = new FTS_Facebook_Reviews();
1685
+
1686
  $mulit_data = $fts_facebook_reviews->review_connection( $fb_shortcode, $access_token, $language );
1687
 
1688
  $mulit_data['ratings_data'] = esc_url_raw( 'https://graph.facebook.com/' . $fb_shortcode['id'] . '/?fields=overall_star_rating,rating_count&access_token=' . $access_token . '' );
1708
  $feed_data = json_decode( $response['feed_data'] );
1709
  $fts_error_check = new fts_error_handler();
1710
  $fts_error_check_complete = $fts_error_check->facebook_error_check( $fb_shortcode, $feed_data );
1711
+
1712
  if ( is_array( $fts_error_check_complete ) && true === $fts_error_check_complete[0] ) {
1713
 
1714
  // If old Cache exists use it instead of showing an error.
1743
  // Make sure it's not ajaxing.
1744
  if ( ! empty( $response['feed_data'] ) ) {
1745
  // Create Cache.
1746
+
1747
+ // YO! LEAVING OFF HERE, ALMOST SEEING WHY THE CACHE IS NOT WORKING.
1748
+ // echo 'Caching Response:<br/>';
1749
+ // NOT using below $response just for testing.
1750
+ //$response = is_array( $response ) ? serialize( $response ) : $response ;
1751
+ //print_r($response);
1752
+
1753
  $this->fts_create_feed_cache( $fb_cache_name, $response );
1754
+
1755
+ // print_r( $response );
1756
  }
1757
  } // end main else.
1758
 
1829
  $fb_type = isset( $counter->attachments->data[0]->type ) ? $counter->attachments->data[0]->type : '';
1830
  $post_data_key = isset( $counter->attachments->data[0]->object_id) ? $counter->attachments->data[0]->object_id: $counter->id;
1831
 
1832
+
1833
+ // Don't run these if it's a review feed otherwise you will get an error response from facebook.
1834
+ if ( 'reviews' !== $fb_shortcode['type'] ) {
1835
+ // Likes & Comments.
1836
+ $fb_post_array[$post_data_key . '_likes'] = 'https://graph.facebook.com/' . $post_data_key . '/reactions?summary=1&access_token=' . $access_token;
1837
+ $fb_post_array[$post_data_key . '_comments'] = 'https://graph.facebook.com/' . $post_data_key . '/comments?summary=1&access_token=' . $access_token;
1838
+ }
1839
+
1840
  // Video.
1841
  if ( 'video' === $fb_type ) {
1842
  $fb_post_array[ $post_data_key . '_video' ] = 'https://graph.facebook.com/' . $post_data_key;
2122
  // we check to see if the loadmore count number is set and if so pass that as the new count number when fetching the next set of posts.
2123
  $_REQUEST['next_url'] = '' !== $loadmore_count ? str_replace( "limit=$posts", "limit=$loadmore_count", $next_url ) : $next_url;
2124
 
2125
+
2126
+ if( is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) && 'reviews' === $fb_shortcode['type'] ){
2127
+ $check_token = '' !== $fb_shortcode['access_token'] ? $fb_shortcode['access_token'] : $this->get_fb_biz_access_token();
2128
+ $access_token = 'access_token=' . $check_token;
2129
+ }
2130
+ else {
2131
+ $check_token = '' !== $fb_shortcode['access_token'] ? $fb_shortcode['access_token'] : $this->get_fb_access_token();
2132
+ $access_token = 'access_token=' . $check_token;
2133
+ }
2134
+
2135
  $_REQUEST['next_url'] = str_replace( $access_token, 'access_token=XXX', $next_url );
2136
 
2137
  echo '<script>';
2278
 
2279
  return $random_string;
2280
  }
2281
+ }//end class
feeds/instagram/class-fts-instagram-feed.php CHANGED
@@ -28,6 +28,9 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
28
  public function __construct() {
29
  add_shortcode( 'fts_instagram', array( $this, 'fts_instagram_func' ) );
30
  add_action( 'wp_enqueue_scripts', array( $this, 'fts_instagram_head' ) );
 
 
 
31
  }
32
 
33
  /**
@@ -36,7 +39,7 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
36
  * Takes our description and converts and links to a tags.
37
  *
38
  * @param string $bio The Bio.
39
- * @return null|string|string[]
40
  * @since 1.9.6
41
  */
42
  public function convert_instagram_description_links( $bio ) {
@@ -54,7 +57,7 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
54
  * Convert any link found in the description to a clickable one.
55
  *
56
  * @param string $instagram_caption_a_title Caption title.
57
- * @return null|string|string[]
58
  * @since 1.9.6
59
  */
60
  public function convert_instagram_links( $instagram_caption_a_title ) {
@@ -360,12 +363,11 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
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
 
367
- $fts_business_or_hashtag_check_token_type = '' === $access_token ? get_option( 'fts_facebook_instagram_custom_api_token' ) : $access_token;
368
- $fts_check_token_type = '' === $access_token ? get_option( 'fts_instagram_custom_api_token' ) : $access_token;
369
  $fts_instagram_access_token = 'hashtag' === $type || 'business' === $type ? $fts_business_or_hashtag_check_token_type : $fts_check_token_type;
370
  $fts_instagram_show_follow_btn = get_option( 'instagram_show_follow_btn' );
371
  $fts_instagram_show_follow_btn_where = get_option( 'instagram_show_follow_btn_where' );
@@ -408,8 +410,7 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
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.
@@ -419,16 +420,26 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
419
 
420
  $hashtag_error_check = json_decode( $hashtag_response['data'] );
421
 
 
 
 
 
422
  foreach ( $hashtag_error_check->data as $ht ) {
423
  $hashtag_id = $ht->id;
424
  }
425
 
426
- $this->fts_create_feed_cache( $cache_hashtag_id_array, $hashtag_response );
 
427
  } else {
 
428
  $response = $this->fts_get_feed_cache( $cache_hashtag_id_array );
429
- $hashtag_error_check = json_decode( $response['data'] );
430
 
431
- foreach ( $hashtag_error_check->data as $ht ) {
 
 
 
 
432
  $hashtag_id = $ht->id;
433
  }
434
 
@@ -445,7 +456,6 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
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
@@ -509,7 +519,10 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
509
  }
510
  }
511
  else {
512
- $insta_data = $this->fts_get_feed_cache( $hash_final_cache );
 
 
 
513
 
514
  // echo 'eeeeeeeeeeee';
515
  // Used for Testing Only.
@@ -534,7 +547,6 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
534
  // First we make sure the feed is not cached already before trying to run the Instagram API.
535
  if ( false === $this->fts_check_feed_cache_exists( $business_cache ) ) {
536
 
537
-
538
  $instagram_business_response = $this->fts_get_feed_json( $instagram_data_array );
539
 
540
  $instagram_business = json_decode( $instagram_business_response['data'] );
@@ -542,32 +554,16 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
542
  // 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.
543
  $instagram_business_output = (object) [ 'data' => [] ];
544
 
545
- /*echo 'bbbbb';
546
- echo '<br/><pre>';
547
- print_r( $instagram_business );
548
- echo '</pre>';*/
549
-
550
-
551
- foreach ( $instagram_business->data as $media ) {
552
- $media_id = $media->id;
553
- $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;
554
- $instagram_business_media_response = $this->fts_get_feed_json( $instagram_business_data_array );
555
- $instagram_business_media = json_decode( $instagram_business_media_response['data'] );
556
- $instagram_business_output->data[] = $instagram_business_media;
557
- }
558
  // 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
559
  $insta_data = (object) array_merge( (array) $instagram_business, (array) $instagram_business_output );
560
 
561
- /* echo 'rrrrrrrrrrrr';
562
- echo '<br/><pre>';
563
- print_r( $instagram_business_output );
564
- echo '</pre>';
565
-
566
- echo 'ssssssss';
567
- echo '<br/><pre>';
568
- print_r( $insta_data );
569
- echo '</pre>';*/
570
-
571
  if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
572
  $this->fts_create_feed_cache( $business_cache, $insta_data );
573
  }
@@ -576,7 +572,8 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
576
  else {
577
  $insta_data = $this->fts_get_feed_cache( $business_cache );
578
 
579
- // echo 'eeeeeeeeeeee';
 
580
  // Used for Testing Only.
581
  if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
582
  esc_html_e( 'Business Array Check Cached', 'feed-them-social' );
@@ -622,7 +619,8 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
622
  else {
623
  $insta_data = $this->fts_get_feed_cache( $basic_cache );
624
 
625
- // echo 'eeeeeeeeeeee';
 
626
  // Used for Testing Only.
627
  if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
628
  esc_html_e( 'Array Check Cached', 'feed-them-social' );
@@ -896,204 +894,205 @@ if ( isset( $profile_description, $type ) && 'yes' === $profile_description &&
896
  $set_zero = 0;
897
  } // END Make sure it's not ajaxing
898
 
899
- if ( ! isset( $insta_data->data ) ) {
900
  if ( ! function_exists( 'curl_init' ) ) {
901
  echo esc_html( 'cURL is not installed on this server. It is required to use this plugin. Please contact your host provider to install this.', 'feed-them-social' ) . '</div>';
902
  } else {
903
  echo esc_html( 'To see the Instagram feed you need to add your own API Token to the Instagram Options page of our plugin.', 'feed-them-social' ) . '</div>';
904
  }
 
 
905
  }
 
906
  // echo '<pre style="text-align: left;">asdfasdf ';
907
  // print_r( $insta_data );
908
  // echo '</pre>';
909
- foreach ( $insta_data->data as $post_data ) {
910
- if ( isset( $set_zero ) && $set_zero === $pics_count ) {
911
- break;
912
- }
913
 
914
- // Create Instagram Variables
915
- // tied to date function.
916
- $feed_type = 'instagram';
917
- $fb_api_time = isset( $post_data->timestamp ) ? $post_data->timestamp : '';
918
- $times = isset( $post_data->created_time ) ? $post_data->created_time : $fb_api_time;
919
- // call our function to get the date.
920
- $instagram_date = $this->fts_custom_date( $times, $feed_type );
921
-
922
- if ( 'hashtag' === $type || 'location' === $type ) {
923
- $username = isset( $post_data->user->username ) ? $post_data->user->username : '';
924
- $profile_picture = isset( $post_data->user->profile_picture ) ? $post_data->user->profile_picture : '';
925
- $full_name = isset( $post_data->user->full_name ) ? $post_data->user->full_name : '';
926
- $instagram_username = $username;
927
- } elseif ( 'basic' === $type ) {
928
- $instagram_username = $post_data->username;
929
- $username = $instagram_username;
930
- } elseif ( 'business' === $type ) {
931
- $instagram_username = $post_data->username;
932
- $username = $instagram_username;
933
- } else {
934
- $instagram_username = $instagram_user_info->data->username;
935
- }
936
- $instagram_caption_a_hashtag_title = isset( $post_data->caption ) ? $post_data->caption : '';
937
- $instagram_caption_a_title = isset( $post_data->caption->text ) ? $post_data->caption->text : $instagram_caption_a_hashtag_title;
938
- $instagram_caption_a_title = htmlspecialchars( $instagram_caption_a_title );
939
- $instagram_caption = $this->convert_instagram_links( $instagram_caption_a_title );
940
-
941
- $instagram_thumb_url = isset( $post_data->images->thumbnail->url ) ? $post_data->images->thumbnail->url : '';
942
- $instagram_lowrez_url = isset( $post_data->images->standard_resolution->url ) ? $post_data->images->standard_resolution->url : '';
943
- $instagram_video_standard_resolution = isset( $post_data->videos->standard_resolution->url ) ? $post_data->videos->standard_resolution->url : '';
944
-
945
- if ( isset( $_SERVER['HTTPS'] ) ) {
946
- $instagram_thumb_url = str_replace( 'http://', 'https://', $instagram_thumb_url );
947
- $instagram_lowrez_url = str_replace( 'http://', 'https://', $instagram_lowrez_url );
948
- }
949
-
950
- // Super Gallery If statement.
951
- if ( 'yes' === $super_gallery ) {
952
- ?>
953
- <div class='slicker-instagram-placeholder fts-instagram-wrapper' style='background-image:url(<?php echo esc_url( $this->fts_instagram_image_link( $post_data ) ); ?>);'>
954
- <?php
955
 
956
- if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup ) {
957
- ?>
958
- <div class="fts-instagram-popup-profile-wrap">
959
- <div class="fts-profile-pic"><?php $user_type = isset( $type ) && 'hashtag' === $type ? 'explore/tags/' . $hashtag : $username; ?>
960
- <a href="https://www.instagram.com/<?php echo esc_html( $user_type ); ?>" target="_blank" rel="noreferrer">
961
- <?php
962
- if ( 'user' === $type || 'business' === $type ) {
963
- ?>
964
- <img src="<?php echo esc_url( $profile_picture ); ?>" title="<?php echo esc_attr( $username ); ?>"/>
965
- <?php
966
- } else {
967
- ?>
968
- <span class="fts-instagram-icon" style="height:40px; width:40px; line-height:40px; font-size:40px;"></span><?php } ?>
969
- </a>
970
- </div>
971
- <div class="fts-profile-name-wrap">
972
-
973
- <div class="fts-isnta-full-name">
974
- <a href="https://www.instagram.com/<?php echo esc_html( $user_type ); ?>" target="_blank" rel="noreferrer" style="color: #000;">
975
- <?php
976
- if ( 'user' === $type ) {
977
- echo esc_html( $full_name );
978
- } elseif ( 'basic' === $type || 'business' === $type ) {
979
- echo esc_html( $instagram_username );
980
- } else {
981
- echo esc_html( '#' . $hashtag );
982
- }
983
- ?>
984
- </a>
985
- </div>
986
-
987
- <?php
988
- if ( isset( $instagram_username ) && 'yes' === $fts_instagram_show_follow_btn && 'instagram-follow-above' === $fts_instagram_show_follow_btn_where && 'hashtag' !== $type ) {
989
- echo '<div class="fts-follow-header-wrap">';
990
- echo $this->social_follow_button( 'instagram', $instagram_username );
991
- echo '</div>';
992
- }
993
- ?>
994
- </div>
995
- </div>
996
- <?php
997
- // this is already escaping in the function, re escaping will cause errors.
998
- echo $this->fts_instagram_popup_description( $post_data );
999
- }
1000
 
1001
- // We need to check the type now because hashtag feeds from facebooks API use all caps now.
1002
- $data_type_image = isset( $post_data->type ) && 'image' === $post_data->type ? 'image' : 'IMAGE';
1003
- $data_type_video = isset( $post_data->type ) && 'video' === $post_data->type ? 'video' : 'VIDEO';
1004
- $data_type_carousel = isset( $post_data->type ) && 'carousel' === $post_data->type ? 'carousel' : 'CAROUSEL_ALBUM';
1005
- $data_type_hashtag = isset( $post_data->media_type ) ? $post_data->media_type : '';
1006
- $data_type = isset( $post_data->type ) ? $post_data->type : $data_type_hashtag;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1007
 
1008
- // Check to see if a video is the first child if children are present
1009
- $instagram_basic_api_child_url = isset( $post_data->children->data[0]->media_url ) ? $post_data->children->data[0]->media_url : '';
1010
- $instagram_api_child_url = isset( $post_data->carousel_media ) ? $post_data->carousel_media[0]->videos->standard_resolution->url : $instagram_basic_api_child_url;
1011
- // $child url is the fb/instagram api
1012
- $child_url = isset( $post_data->children ) ? $post_data->children->data[0]->media_url : $instagram_api_child_url;
1013
- $data_type_child = ! empty( $child_url ) && false !== strpos( $child_url, 'mp4' ) ? 'VIDEO' : '';
1014
 
1015
- ?>
1016
- <a href='<?php
 
 
 
 
1017
 
1018
- if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup && $data_type_image === $data_type || is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && $data_type_carousel === $data_type && empty( $data_type_child ) ) {
 
1019
 
1020
- print esc_url( $this->fts_instagram_image_link( $post_data ) );
1021
 
1022
- } elseif ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && $data_type_video === $data_type || is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && ! empty( $data_type_child ) && 'VIDEO' === $data_type_child ) {
1023
 
1024
- // this statement below does not make sense, check later.
1025
- print $this->fts_instagram_video_link( $post_data ) ? esc_url( $this->fts_instagram_video_link( $post_data ) ) : esc_url( $post_data->permalink . 'media?size=l' );
1026
 
1027
- } else {
1028
- print esc_url( $this->fts_view_on_instagram_url( $post_data ) );
1029
- }
1030
- $fts_child = isset( $post_data->children ) || isset( $post_data->carousel_media ) ? 'fts-child-media ' : '';
1031
- ?>' title='<?php print esc_attr( $instagram_caption_a_title ); ?>' target="_blank" rel="noreferrer" class='<?php print $fts_child; ?>fts-instagram-link-target fts-slicker-backg
1032
- <?php
1033
- if ( $data_type_video === $data_type && isset( $popup ) && 'yes' === $popup && ! empty( $this->fts_instagram_video_link( $post_data ) ) || ! empty( $data_type_child ) && 'VIDEO' === $data_type_child && isset( $popup ) && 'yes' === $popup && ! empty( $this->fts_instagram_video_link( $post_data ) ) ) {
1034
- ?>
1035
- fts-instagram-video-link
1036
- <?php
1037
- } else {
1038
- ?>
1039
- fts-instagram-img-link<?php } ?>' style="height:<?php echo esc_attr( $icon_size ); ?> !important; width:<?php echo esc_attr( $icon_size ); ?>; line-height:<?php echo esc_attr( $icon_size ); ?>; font-size:<?php echo esc_attr( $icon_size ); ?>;"><span
1040
- class="fts-instagram-icon"
1041
- style="height:<?php echo esc_attr( $icon_size ); ?>; width:<?php echo esc_attr( $icon_size ); ?>; line-height:<?php echo esc_attr( $icon_size ); ?>; font-size:<?php echo esc_attr( $icon_size ); ?>;"></span></a>
1042
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1043
 
1044
- <?php
1045
- // Must use method where we use the link above which is visible with Instagram icon and then we use the child array below and skip the first child
1046
- // element so we don't have duplicated of the first child. We do this because we need to hide these other links with CSS. We have to have these links here
1047
- // because that is how the magnific popup works in order to get to the next image or video.
1048
- // NOTE: $post_data->childer is FB/Instagram API, $post_data->carousel_media is OG Instagram API.
1049
- if ( isset( $post_data->children ) || isset( $post_data->carousel_media ) ) {
 
 
 
 
 
1050
 
1051
- $carousel_media = isset( $post_data->children ) ? $post_data->children->data : $post_data->carousel_media;
1052
- ?>
1053
- <div class="fts-carousel-image-wrapper"><div class="fts-carousel-image" ></div></div>
1054
- <?php
1055
- foreach ( array_slice( $carousel_media, 1 ) as $child ) {
1056
-
1057
- // echo '<pre style="text-align: left;"> wwwqwqwq';
1058
- // print_r( $child );
1059
- // echo '</pre>';
1060
- $url_images = isset( $child->images->standard_resolution->url ) ? $child->images->standard_resolution->url : '';
1061
- $url = isset( $child->videos->standard_resolution->url ) ? $child->videos->standard_resolution->url : $url_images;
1062
- $url_final = isset( $child->media_url ) ? $child->media_url : $url;
1063
- $data_type_video_child = ! empty( $url_final ) && false != strpos( $url_final, 'mp4' ) ? 'video_media' : 'image_media';
1064
- ?>
1065
- <a href='
1066
- <?php
1067
- if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup && 'image_media' === $data_type_video_child ) {
1068
- print esc_url( $this->fts_instagram_image_link( $child ) );
1069
- } elseif ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && 'video_media' === $data_type_video_child ) {
1070
- print esc_url( $this->fts_instagram_video_link( $child ) );
1071
- } else {
1072
-
1073
- }
1074
- ?>
1075
- ' title='<?php print esc_attr( $instagram_caption_a_title ); ?>' target="_blank" rel="noreferrer" class='fts-child-media fts-child-media-hide fts-instagram-link-target fts-slicker-backg
1076
- <?php
1077
- if ( 'video_media' === $data_type_video_child && isset( $popup ) && 'yes' === $popup ) {
1078
- ?>
1079
- fts-instagram-video-link
1080
- <?php
1081
- } else {
1082
- ?>
1083
- fts-instagram-img-link<?php } ?>'></a>
1084
-
1085
-
1086
-
1087
- <?php
1088
- }
1089
- } elseif ( isset( $data_type ) && 'VIDEO' === $data_type || isset( $data_type ) && 'video' === $data_type ) {
1090
- ?>
1091
- <div class="fts-instagram-video-image-wrapper"><div class="fts-instagram-video-image"></div></div>
1092
- <?php
1093
- }
1094
- ?>
1095
 
1096
 
 
 
 
 
 
 
 
 
1097
 
1098
 
1099
 
@@ -1105,216 +1104,217 @@ if ( isset( $profile_description, $type ) && 'yes' === $profile_description &&
1105
 
1106
 
1107
 
1108
- <div class='slicker-date'>
1109
 
1110
- <div class="fts-insta-date-popup-grab">
1111
- <?php
1112
- if ( 'no' === $hide_date_likes_comments ) {
1113
- echo esc_html( $instagram_date );
1114
- } else {
1115
- echo '&nbsp;'; }
1116
- ?>
1117
- </div>
1118
- </div>
1119
- <div class='slicker-instaG-backg-link'>
1120
 
1121
- <div class='slicker-instaG-photoshadow'></div>
1122
- </div>
1123
- <?php if ( 'no' === $hide_date_likes_comments ) { ?>
1124
- <div class="fts-insta-likes-comments-grab-popup">
1125
- <?php
1126
-
1127
- // this is already escaping in the function, re escaping will cause errors.
1128
- echo $this->fts_share_option( $this->fts_view_on_instagram_url( $post_data ), $this->fts_instagram_description( $post_data ) );
1129
-
1130
- if ( 'basic' !== $type ) {
1131
- ?>
1132
- <div class="fts-instagram-reply-wrap-left">
1133
- <ul class='slicker-heart-comments-wrap'>
1134
- <li class='slicker-instagram-image-likes'><?php echo esc_html( $this->fts_instagram_likes_count( $post_data ) ); ?> </li>
1135
- <li class='slicker-instagram-image-comments'>
1136
- <span class="fts-comment-instagram"></span> <?php echo esc_html( $this->fts_instagram_comments_count( $post_data ) ); ?>
1137
- </li>
1138
- </ul>
1139
- </div>
1140
- <?php } ?>
1141
- </div>
1142
- <?php } ?>
1143
- </div>
1144
- <?php
1145
- } else {
1146
- // Classic Gallery If statement.
1147
- ?>
1148
- <div class='instagram-placeholder fts-instagram-wrapper' style='width:150px;'>
1149
- <?php
1150
- if ( isset( $popup ) && 'yes' === $popup ) {
1151
- print '<div class="fts-backg"></div>';
1152
- } else {
1153
- ?>
1154
- <a class='fts-backg' target='_blank' href='<?php echo esc_url( $this->fts_view_on_instagram_url( $post_data ) ); ?>'></a><?php }; ?>
1155
- <div class='date slicker-date'>
1156
- <div class="fts-insta-date-popup-grab"><?php echo esc_html( $instagram_date ); ?></div>
1157
- </div>
1158
 
 
 
 
 
 
 
 
 
 
 
1159
 
1160
- <?php if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup ) { ?>
 
 
 
 
1161
 
 
 
1162
 
1163
- <div class="fts-instagram-popup-profile-wrap">
1164
- <div class="fts-profile-pic">
1165
- <a href="https://www.instagram.com/<?php echo esc_attr( $username ); ?>" target="_blank" rel="noreferrer"><img
1166
- src="<?php echo esc_attr( $profile_picture ); ?>" title="<?php echo esc_attr( $username ); ?>"/></a>
1167
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1168
 
1169
- <div class="fts-profile-name-wrap">
1170
 
1171
- <div class="fts-isnta-full-name"><?php echo esc_attr( $full_name ); ?></div>
1172
- <?php
1173
- if ( $username && 'yes' === $fts_instagram_show_follow_btn && 'instagram-follow-above' === $fts_instagram_show_follow_btn_where ) {
1174
- echo '<div class="fts-follow-header-wrap">';
1175
- echo $this->social_follow_button( 'instagram', $username );
1176
- echo '</div>';
1177
- }
1178
- ?>
1179
- </div>
1180
- </div>
1181
 
1182
- <?php
1183
- // caption for our popup.
1184
- echo $this->fts_instagram_popup_description( $post_data );
1185
- ?>
1186
- <?php } ?>
1187
 
1188
- <a href="
1189
- <?php
1190
- // We need to check the type now because hashtag feeds from facebooks API use all caps now.
1191
- $data_type_image = isset( $post_data->type ) && 'image' === $post_data->type ? : 'IMAGE';
1192
- $data_type_video = isset( $post_data->type ) && 'video' === $post_data->type ? : 'VIDEO';
1193
- $data_type_carousel = isset( $post_data->type ) && 'carousel' === $post_data->type ? : 'CAROUSEL';
1194
- $data_type_hashtag = isset( $post_data->media_type ) ? $post_data->media_type : '';
1195
- $data_type = isset( $post_data->type ) ? $post_data->type : $data_type_hashtag;
1196
- if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup && ( $data_type_image === $data_type || $data_type_carousel === $data_type ) ) {
1197
- print esc_url( $this->fts_instagram_image_link( $post_data ) );
1198
- } elseif ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && $data_type_video === $data_type ) {
1199
- print esc_url( $this->fts_instagram_video_link( $post_data ) );
1200
- } else {
1201
- print esc_url( $this->fts_view_on_instagram_url( $post_data ) );
1202
- }
1203
- ?>
1204
- " class='fts-instagram-link-target instaG-backg-link
1205
- <?php
1206
- if ( 'video' === $post_data->type ) {
1207
- ?>
1208
- fts-instagram-video-link
1209
- <?php
1210
- } else {
1211
- ?>
1212
- fts-instagram-img-link<?php } ?>' target='_blank' rel="noreferrer" title='<?php echo esc_attr( $instagram_caption_a_title ); ?>'>
1213
- <img src="<?php echo esc_url( $instagram_thumb_url ); ?>" class="instagram-image"/>
1214
- <div class='instaG-photoshadow'></div>
1215
- </a>
1216
- <div class="fts-insta-likes-comments-grab-popup">
1217
- <?php echo $this->fts_instagram_likes_comments_wrap( $post_data ); ?>
1218
- </div>
1219
- </div>
1220
- <?php
1221
- }
1222
- if ( isset( $set_zero ) ) {
1223
- $set_zero++;
1224
- }
1225
- }
1226
 
1227
- if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && ! empty( $scroll_more ) ) {
1228
- // ******************
1229
- // Load More BUTTON Start
1230
- // Check to see if the next isset for the hashtag feed. If so then pass it down so it's used.
1231
- // ******************
1232
- $next_hashtag_url = isset( $insta_data->paging->next ) ? $insta_data->paging->next : '';
1233
- $next_url = isset( $insta_data->pagination->next_url ) ? $insta_data->pagination->next_url : $next_hashtag_url;
1234
- // fb api uses limit for the post count and instagram api uses count.
1235
- $the_count = 'hashtag' === $type || 'basic' === $type || 'business' === $type ? 'limit' : 'count';
1236
- // we check to see if the loadmore count number is set and if so pass that as the new count number when fetching the next set of posts.
1237
- $_REQUEST['next_url'] = '' !== $loadmore_count ? str_replace( "'.$the_count.'=$pics_count", "'.$the_count.'=$loadmore_count", $next_url ) : $next_url;
1238
- $access_token = 'access_token=' . $fts_instagram_access_token_final;
1239
- $_REQUEST['next_url'] = str_replace( $access_token, 'access_token=XXX', $next_url );
1240
 
1241
- ?>
1242
- <script>var nextURL_<?php echo esc_js( sanitize_text_field( wp_unslash( $_REQUEST['fts_dynamic_name'] ) ) ); ?>= "<?php echo esc_url_raw( $_REQUEST['next_url'] ); ?>";</script>
1243
- <?php
1244
- // Make sure it's not ajaxing.
1245
- if ( ! isset( $_GET['load_more_ajaxing'] ) && ! isset( $_REQUEST['fts_no_more_posts'] ) && ! empty( $loadmore ) ) {
1246
- $fts_dynamic_name = sanitize_text_field( wp_unslash( $_REQUEST['fts_dynamic_name'] ) );
1247
- $time = time();
1248
- $nonce = wp_create_nonce( $time . 'load-more-nonce' );
1249
- ?>
1250
- <script>jQuery(document).ready(function () {
1251
- <?php
1252
- // $scroll_more = load_more_posts_style shortcode att.
1253
- if ( 'autoscroll' === $scroll_more ) { // this is where we do SCROLL function to LOADMORE if = autoscroll in shortcode.
1254
- ?>
1255
- jQuery(".<?php echo esc_js( $fts_dynamic_class_name ); ?>instagram").bind("scroll", function () {
1256
- if (jQuery(this).scrollTop() + jQuery(this).innerHeight() >= jQuery(this)[0].scrollHeight) {
1257
- <?php
1258
- } else { // this is where we do CLICK function to LOADMORE if = button in shortcode.
1259
- ?>
1260
- jQuery("#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>").click(function () {
1261
- <?php } ?>
1262
- jQuery("#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>").addClass('fts-fb-spinner');
1263
- var button = jQuery('#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>').html('<div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div>');
1264
- console.log(button);
1265
-
1266
- var feed_name = "fts_instagram";
1267
- var loadmore_count = "pics_count=<?php echo esc_js( $loadmore_count ); ?>";
1268
- var feed_attributes = <?php echo wp_json_encode( $atts ); ?>;
1269
- var yes_ajax = "yes";
1270
- var fts_d_name = "<?php echo esc_js( $fts_dynamic_name ); ?>";
1271
- var fts_security = "<?php echo esc_js( $nonce ); ?>";
1272
- var fts_time = "<?php echo esc_js( $time ); ?>";
1273
- jQuery.ajax({
1274
- data: {
1275
- action: "my_fts_fb_load_more",
1276
- next_url: nextURL_<?php echo esc_js( $fts_dynamic_name ); ?>,
1277
- fts_dynamic_name: fts_d_name,
1278
- load_more_ajaxing: yes_ajax,
1279
- fts_security: fts_security,
1280
- fts_time: fts_time,
1281
- feed_name: feed_name,
1282
- loadmore_count: loadmore_count,
1283
- feed_attributes: feed_attributes
1284
- },
1285
- type: 'GET',
1286
- url: "<?php echo esc_js( admin_url( 'admin-ajax.php' ) ); ?>",
1287
- success: function (data) {
1288
- console.log('Well Done and got this from sever: ' + data);
1289
- jQuery('.<?php echo esc_js( $fts_dynamic_class_name ); ?>').append(data).filter('.<?php echo esc_js( $fts_dynamic_class_name ); ?>').html();
1290
- if (!nextURL_<?php echo esc_js( sanitize_key( $_REQUEST['fts_dynamic_name'] ) ); ?> || nextURL_<?php echo esc_js( sanitize_key( $_REQUEST['fts_dynamic_name'] ) ); ?> === 'no more') {
1291
- jQuery('#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>').replaceWith('<div class="fts-fb-load-more no-more-posts-fts-fb"><?php echo esc_js( $instagram_no_more_photos_text ); ?></div>');
1292
- jQuery('#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>').removeAttr('id');
1293
- jQuery(".<?php echo esc_js( $fts_dynamic_class_name ); ?>instagram").unbind('scroll');
1294
- }
1295
- jQuery('#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>').html('<?php echo esc_js( $instagram_load_more_text ); ?>');
1296
- jQuery("#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>").removeClass('fts-fb-spinner');
1297
- jQuery.fn.ftsShare(); // Reload the share each funcion otherwise you can't open share option
1298
- jQuery.fn.slickInstagramPopUpFunction(); // Reload this function again otherwise the popup won't work correctly for the newly loaded items
1299
- if (typeof outputSRmargin === "function") {
1300
- outputSRmargin(document.querySelector('#margin').value)
1301
- } // Reload our margin for the demo
1302
- slickremixImageResizing(); // Reload our imagesizing function so the images show up proper
1303
- }
1304
- }); // end of ajax()
1305
- return false;
1306
- <?php
1307
- // string $scroll_more is at top of this js script. exception for scroll option closing tag.
1308
- if ( 'autoscroll' === $scroll_more ) {
1309
- ?>
1310
- }; // end of scroll ajax load
1311
- <?php } ?>
1312
- }
1313
- ); // end of document.ready
1314
- }); // end of form.submit </script>
1315
- <?php
1316
- }//End Check.
1317
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1318
  // main closing div not included in ajax check so we can close the wrap at all times.
1319
  print '</div>'; // closing main div for photos and scroll wrap.
1320
 
28
  public function __construct() {
29
  add_shortcode( 'fts_instagram', array( $this, 'fts_instagram_func' ) );
30
  add_action( 'wp_enqueue_scripts', array( $this, 'fts_instagram_head' ) );
31
+
32
+ // Data Protection
33
+ $this->data_protection = new Data_Protection();
34
  }
35
 
36
  /**
39
  * Takes our description and converts and links to a tags.
40
  *
41
  * @param string $bio The Bio.
42
+ * @return null|string
43
  * @since 1.9.6
44
  */
45
  public function convert_instagram_description_links( $bio ) {
57
  * Convert any link found in the description to a clickable one.
58
  *
59
  * @param string $instagram_caption_a_title Caption title.
60
+ * @return null|string
61
  * @since 1.9.6
62
  */
63
  public function convert_instagram_links( $instagram_caption_a_title ) {
363
  $pics_count = '10';
364
  }
365
 
 
366
  wp_enqueue_script( 'fts-global', plugins_url( 'feed-them-social/feeds/js/fts-global.js' ), array( 'jquery' ), FTS_CURRENT_VERSION, false );
367
  $instagram_data_array = array();
368
 
369
+ $fts_business_or_hashtag_check_token_type = '' === $access_token ? $this->data_protection->decrypt( get_option( 'fts_facebook_instagram_custom_api_token' ) ) : $access_token;
370
+ $fts_check_token_type = '' === $access_token ? $this->data_protection->decrypt( get_option( 'fts_instagram_custom_api_token' ) ) : $access_token;
371
  $fts_instagram_access_token = 'hashtag' === $type || 'business' === $type ? $fts_business_or_hashtag_check_token_type : $fts_check_token_type;
372
  $fts_instagram_show_follow_btn = get_option( 'instagram_show_follow_btn' );
373
  $fts_instagram_show_follow_btn_where = get_option( 'instagram_show_follow_btn_where' );
410
  // https://developers.facebook.com/docs/instagram-api/reference/hashtag/recent-media
411
  // https://developers.facebook.com/docs/instagram-api/reference/hashtag/top-media
412
 
413
+ $cache_hashtag_id_array = 'instagram_hashtag_id_cache_' . $instagram_id . '_num' . $pics_count . '_search' . $search . '_hash' . $hashtag . '';
 
414
 
415
  if ( false === $this->fts_check_feed_cache_exists( $cache_hashtag_id_array ) ) {
416
  // 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.
420
 
421
  $hashtag_error_check = json_decode( $hashtag_response['data'] );
422
 
423
+ /* echo '<br/><pre>';
424
+ print_r( $hashtag_error_check );
425
+ echo '</pre>';*/
426
+
427
  foreach ( $hashtag_error_check->data as $ht ) {
428
  $hashtag_id = $ht->id;
429
  }
430
 
431
+ $this->fts_create_feed_cache( $cache_hashtag_id_array, $hashtag_error_check );
432
+
433
  } else {
434
+
435
  $response = $this->fts_get_feed_cache( $cache_hashtag_id_array );
436
+ $hashtag_error_check = json_decode( $response );
437
 
438
+ /* echo '<br/><pre>';
439
+ print_r( $hashtag_error_check);
440
+ echo '</pre>';*/
441
+
442
+ foreach ( $hashtag_error_check->data as $ht ) {
443
  $hashtag_id = $ht->id;
444
  }
445
 
456
  // whatever the first shortcodes hashtag making all the feeds have the same photos.
457
  $pics_count .= '?1=' . $hashtag;
458
 
 
459
  $hash_final_cache = 'instagram_final_cache_' . $instagram_id . '_num' . $pics_count . '_search' . $search . '_hash' . $hashtag . '';
460
 
461
  // The below needs to be cached and the hashtag ID above merged with like how we did below on line 493
519
  }
520
  }
521
  else {
522
+
523
+ $insta_data = $this->fts_get_feed_cache( $hash_final_cache );
524
+
525
+ $insta_data = json_decode( $insta_data );
526
 
527
  // echo 'eeeeeeeeeeee';
528
  // Used for Testing Only.
547
  // First we make sure the feed is not cached already before trying to run the Instagram API.
548
  if ( false === $this->fts_check_feed_cache_exists( $business_cache ) ) {
549
 
 
550
  $instagram_business_response = $this->fts_get_feed_json( $instagram_data_array );
551
 
552
  $instagram_business = json_decode( $instagram_business_response['data'] );
554
  // 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.
555
  $instagram_business_output = (object) [ 'data' => [] ];
556
 
557
+ foreach ( $instagram_business->data as $media ) {
558
+ $media_id = $media->id;
559
+ $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;
560
+ $instagram_business_media_response = $this->fts_get_feed_json( $instagram_business_data_array );
561
+ $instagram_business_media = json_decode( $instagram_business_media_response['data'] );
562
+ $instagram_business_output->data[] = $instagram_business_media;
563
+ }
 
 
 
 
 
 
564
  // 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
565
  $insta_data = (object) array_merge( (array) $instagram_business, (array) $instagram_business_output );
566
 
 
 
 
 
 
 
 
 
 
 
567
  if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
568
  $this->fts_create_feed_cache( $business_cache, $insta_data );
569
  }
572
  else {
573
  $insta_data = $this->fts_get_feed_cache( $business_cache );
574
 
575
+ $insta_data = json_decode( $insta_data );
576
+
577
  // Used for Testing Only.
578
  if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
579
  esc_html_e( 'Business Array Check Cached', 'feed-them-social' );
619
  else {
620
  $insta_data = $this->fts_get_feed_cache( $basic_cache );
621
 
622
+ $insta_data = json_decode( $insta_data );
623
+
624
  // Used for Testing Only.
625
  if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
626
  esc_html_e( 'Array Check Cached', 'feed-them-social' );
894
  $set_zero = 0;
895
  } // END Make sure it's not ajaxing
896
 
897
+ if ( ! isset( $insta_data->data ) || empty( $insta_data->data ) ) {
898
  if ( ! function_exists( 'curl_init' ) ) {
899
  echo esc_html( 'cURL is not installed on this server. It is required to use this plugin. Please contact your host provider to install this.', 'feed-them-social' ) . '</div>';
900
  } else {
901
  echo esc_html( 'To see the Instagram feed you need to add your own API Token to the Instagram Options page of our plugin.', 'feed-them-social' ) . '</div>';
902
  }
903
+ //If Instagram Fails show message!
904
+ echo esc_html( 'Oops, something is wrong. Instagram feed not loaded', 'feed-them-social' ) . '</div>';
905
  }
906
+
907
  // echo '<pre style="text-align: left;">asdfasdf ';
908
  // print_r( $insta_data );
909
  // echo '</pre>';
 
 
 
 
910
 
911
+ if ( $insta_data->data) {
912
+ foreach ( $insta_data->data as $post_data ) {
913
+ if ( isset( $set_zero ) && $set_zero === $pics_count ) {
914
+ break;
915
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
916
 
917
+ // Create Instagram Variables
918
+ // tied to date function.
919
+ $feed_type = 'instagram';
920
+ $fb_api_time = isset( $post_data->timestamp ) ? $post_data->timestamp : '';
921
+ $times = isset( $post_data->created_time ) ? $post_data->created_time : $fb_api_time;
922
+ // call our function to get the date.
923
+ $instagram_date = $this->fts_custom_date( $times, $feed_type );
924
+
925
+ if ( 'hashtag' === $type || 'location' === $type ) {
926
+ $username = isset( $post_data->user->username ) ? $post_data->user->username : '';
927
+ $profile_picture = isset( $post_data->user->profile_picture ) ? $post_data->user->profile_picture : '';
928
+ $full_name = isset( $post_data->user->full_name ) ? $post_data->user->full_name : '';
929
+ $instagram_username = $username;
930
+ } elseif ( 'basic' === $type ) {
931
+ $instagram_username = $post_data->username;
932
+ $username = $instagram_username;
933
+ } elseif ( 'business' === $type ) {
934
+ $instagram_username = $post_data->username;
935
+ $username = $instagram_username;
936
+ } else {
937
+ $instagram_username = $instagram_user_info->data->username;
938
+ }
939
+ $instagram_caption_a_hashtag_title = isset( $post_data->caption ) ? $post_data->caption : '';
940
+ $instagram_caption_a_title = isset( $post_data->caption->text ) ? $post_data->caption->text : $instagram_caption_a_hashtag_title;
941
+ $instagram_caption_a_title = htmlspecialchars( $instagram_caption_a_title );
942
+ $instagram_caption = $this->convert_instagram_links( $instagram_caption_a_title );
943
+
944
+ $instagram_thumb_url = isset( $post_data->images->thumbnail->url ) ? $post_data->images->thumbnail->url : '';
945
+ $instagram_lowrez_url = isset( $post_data->images->standard_resolution->url ) ? $post_data->images->standard_resolution->url : '';
946
+ $instagram_video_standard_resolution = isset( $post_data->videos->standard_resolution->url ) ? $post_data->videos->standard_resolution->url : '';
947
+
948
+ if ( isset( $_SERVER['HTTPS'] ) ) {
949
+ $instagram_thumb_url = str_replace( 'http://', 'https://', $instagram_thumb_url );
950
+ $instagram_lowrez_url = str_replace( 'http://', 'https://', $instagram_lowrez_url );
951
+ }
 
 
 
 
 
 
 
 
 
952
 
953
+ // Super Gallery If statement.
954
+ if ( 'yes' === $super_gallery ) {
955
+ ?>
956
+ <div class='slicker-instagram-placeholder fts-instagram-wrapper' style='background-image:url(<?php echo esc_url( $this->fts_instagram_image_link( $post_data ) ); ?>);'>
957
+ <?php
958
+
959
+ if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup ) {
960
+ ?>
961
+ <div class="fts-instagram-popup-profile-wrap">
962
+ <div class="fts-profile-pic"><?php $user_type = isset( $type ) && 'hashtag' === $type ? 'explore/tags/' . $hashtag : $username; ?>
963
+ <a href="https://www.instagram.com/<?php echo esc_html( $user_type ); ?>" target="_blank" rel="noreferrer">
964
+ <?php
965
+ if ( 'user' === $type || 'business' === $type ) {
966
+ ?>
967
+ <img src="<?php echo esc_url( $profile_picture ); ?>" title="<?php echo esc_attr( $username ); ?>"/>
968
+ <?php
969
+ } else {
970
+ ?>
971
+ <span class="fts-instagram-icon" style="height:40px; width:40px; line-height:40px; font-size:40px;"></span><?php } ?>
972
+ </a>
973
+ </div>
974
+ <div class="fts-profile-name-wrap">
975
+
976
+ <div class="fts-isnta-full-name">
977
+ <a href="https://www.instagram.com/<?php echo esc_html( $user_type ); ?>" target="_blank" rel="noreferrer" style="color: #000;">
978
+ <?php
979
+ if ( 'user' === $type ) {
980
+ echo esc_html( $full_name );
981
+ } elseif ( 'basic' === $type || 'business' === $type ) {
982
+ echo esc_html( $instagram_username );
983
+ } else {
984
+ echo esc_html( '#' . $hashtag );
985
+ }
986
+ ?>
987
+ </a>
988
+ </div>
989
+
990
+ <?php
991
+ if ( isset( $instagram_username ) && 'yes' === $fts_instagram_show_follow_btn && 'instagram-follow-above' === $fts_instagram_show_follow_btn_where && 'hashtag' !== $type ) {
992
+ echo '<div class="fts-follow-header-wrap">';
993
+ echo $this->social_follow_button( 'instagram', $instagram_username );
994
+ echo '</div>';
995
+ }
996
+ ?>
997
+ </div>
998
+ </div>
999
+ <?php
1000
+ // this is already escaping in the function, re escaping will cause errors.
1001
+ echo $this->fts_instagram_popup_description( $post_data );
1002
+ }
1003
 
1004
+ // We need to check the type now because hashtag feeds from facebooks API use all caps now.
1005
+ $data_type_image = isset( $post_data->type ) && 'image' === $post_data->type ? 'image' : 'IMAGE';
1006
+ $data_type_video = isset( $post_data->type ) && 'video' === $post_data->type ? 'video' : 'VIDEO';
1007
+ $data_type_carousel = isset( $post_data->type ) && 'carousel' === $post_data->type ? 'carousel' : 'CAROUSEL_ALBUM';
1008
+ $data_type_hashtag = isset( $post_data->media_type ) ? $post_data->media_type : '';
1009
+ $data_type = isset( $post_data->type ) ? $post_data->type : $data_type_hashtag;
1010
 
1011
+ // Check to see if a video is the first child if children are present
1012
+ $instagram_basic_api_child_url = isset( $post_data->children->data[0]->media_url ) ? $post_data->children->data[0]->media_url : '';
1013
+ $instagram_api_child_url = isset( $post_data->carousel_media ) ? $post_data->carousel_media[0]->videos->standard_resolution->url : $instagram_basic_api_child_url;
1014
+ // $child url is the fb/instagram api
1015
+ $child_url = isset( $post_data->children ) ? $post_data->children->data[0]->media_url : $instagram_api_child_url;
1016
+ $data_type_child = ! empty( $child_url ) && false !== strpos( $child_url, 'mp4' ) ? 'VIDEO' : '';
1017
 
1018
+ ?>
1019
+ <a href='<?php
1020
 
1021
+ if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup && $data_type_image === $data_type || is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && $data_type_carousel === $data_type && empty( $data_type_child ) ) {
1022
 
1023
+ print esc_url( $this->fts_instagram_image_link( $post_data ) );
1024
 
1025
+ } elseif ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && $data_type_video === $data_type || is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && ! empty( $data_type_child ) && 'VIDEO' === $data_type_child ) {
 
1026
 
1027
+ // this statement below does not make sense, check later.
1028
+ print $this->fts_instagram_video_link( $post_data ) ? esc_url( $this->fts_instagram_video_link( $post_data ) ) : esc_url( $post_data->permalink . 'media?size=l' );
 
 
 
 
 
 
 
 
 
 
 
 
 
1029
 
1030
+ } else {
1031
+ print esc_url( $this->fts_view_on_instagram_url( $post_data ) );
1032
+ }
1033
+ $fts_child = isset( $post_data->children ) || isset( $post_data->carousel_media ) ? 'fts-child-media ' : '';
1034
+ ?>' title='<?php print esc_attr( $instagram_caption_a_title ); ?>' target="_blank" rel="noreferrer" class='<?php print $fts_child; ?>fts-instagram-link-target fts-slicker-backg
1035
+ <?php
1036
+ if ( $data_type_video === $data_type && isset( $popup ) && 'yes' === $popup && ! empty( $this->fts_instagram_video_link( $post_data ) ) || ! empty( $data_type_child ) && 'VIDEO' === $data_type_child && isset( $popup ) && 'yes' === $popup && ! empty( $this->fts_instagram_video_link( $post_data ) ) ) {
1037
+ ?>
1038
+ fts-instagram-video-link
1039
+ <?php
1040
+ } else {
1041
+ ?>
1042
+ fts-instagram-img-link<?php } ?>' style="height:<?php echo esc_attr( $icon_size ); ?> !important; width:<?php echo esc_attr( $icon_size ); ?>; line-height:<?php echo esc_attr( $icon_size ); ?>; font-size:<?php echo esc_attr( $icon_size ); ?>;"><span
1043
+ class="fts-instagram-icon"
1044
+ style="height:<?php echo esc_attr( $icon_size ); ?>; width:<?php echo esc_attr( $icon_size ); ?>; line-height:<?php echo esc_attr( $icon_size ); ?>; font-size:<?php echo esc_attr( $icon_size ); ?>;"></span></a>
1045
+ <?php
1046
+ // Must use method where we use the link above which is visible with Instagram icon and then we use the child array below and skip the first child
1047
+ // element so we don't have duplicated of the first child. We do this because we need to hide these other links with CSS. We have to have these links here
1048
+ // because that is how the magnific popup works in order to get to the next image or video.
1049
+ // NOTE: $post_data->childer is FB/Instagram API, $post_data->carousel_media is OG Instagram API.
1050
+ if ( isset( $post_data->children ) || isset( $post_data->carousel_media ) ) {
1051
+
1052
+ $carousel_media = isset( $post_data->children ) ? $post_data->children->data : $post_data->carousel_media;
1053
+ ?>
1054
+ <div class="fts-carousel-image-wrapper"><div class="fts-carousel-image" ></div></div>
1055
+ <?php
1056
+ foreach ( array_slice( $carousel_media, 1 ) as $child ) {
1057
+
1058
+ // echo '<pre style="text-align: left;"> wwwqwqwq';
1059
+ // print_r( $child );
1060
+ // echo '</pre>';
1061
+ $url_images = isset( $child->images->standard_resolution->url ) ? $child->images->standard_resolution->url : '';
1062
+ $url = isset( $child->videos->standard_resolution->url ) ? $child->videos->standard_resolution->url : $url_images;
1063
+ $url_final = isset( $child->media_url ) ? $child->media_url : $url;
1064
+ $data_type_video_child = ! empty( $url_final ) && false != strpos( $url_final, 'mp4' ) ? 'video_media' : 'image_media';
1065
+ ?>
1066
+ <a href='
1067
+ <?php
1068
+ if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup && 'image_media' === $data_type_video_child ) {
1069
+ print esc_url( $this->fts_instagram_image_link( $child ) );
1070
+ } elseif ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && 'video_media' === $data_type_video_child ) {
1071
+ print esc_url( $this->fts_instagram_video_link( $child ) );
1072
+ } else {
1073
 
1074
+ }
1075
+ ?>
1076
+ ' title='<?php print esc_attr( $instagram_caption_a_title ); ?>' target="_blank" rel="noreferrer" class='fts-child-media fts-child-media-hide fts-instagram-link-target fts-slicker-backg
1077
+ <?php
1078
+ if ( 'video_media' === $data_type_video_child && isset( $popup ) && 'yes' === $popup ) {
1079
+ ?>
1080
+ fts-instagram-video-link
1081
+ <?php
1082
+ } else {
1083
+ ?>
1084
+ fts-instagram-img-link<?php } ?>'></a>
1085
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1086
 
1087
 
1088
+ <?php
1089
+ }
1090
+ } elseif ( isset( $data_type ) && 'VIDEO' === $data_type || isset( $data_type ) && 'video' === $data_type ) {
1091
+ ?>
1092
+ <div class="fts-instagram-video-image-wrapper"><div class="fts-instagram-video-image"></div></div>
1093
+ <?php
1094
+ }
1095
+ ?>
1096
 
1097
 
1098
 
1104
 
1105
 
1106
 
 
1107
 
 
 
 
 
 
 
 
 
 
 
1108
 
1109
+ <div class='slicker-date'>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1110
 
1111
+ <div class="fts-insta-date-popup-grab">
1112
+ <?php
1113
+ if ( 'no' === $hide_date_likes_comments ) {
1114
+ echo esc_html( $instagram_date );
1115
+ } else {
1116
+ echo '&nbsp;'; }
1117
+ ?>
1118
+ </div>
1119
+ </div>
1120
+ <div class='slicker-instaG-backg-link'>
1121
 
1122
+ <div class='slicker-instaG-photoshadow'></div>
1123
+ </div>
1124
+ <?php if ( 'no' === $hide_date_likes_comments ) { ?>
1125
+ <div class="fts-insta-likes-comments-grab-popup">
1126
+ <?php
1127
 
1128
+ // this is already escaping in the function, re escaping will cause errors.
1129
+ echo $this->fts_share_option( $this->fts_view_on_instagram_url( $post_data ), $this->fts_instagram_description( $post_data ) );
1130
 
1131
+ if ( 'basic' !== $type ) {
1132
+ ?>
1133
+ <div class="fts-instagram-reply-wrap-left">
1134
+ <ul class='slicker-heart-comments-wrap'>
1135
+ <li class='slicker-instagram-image-likes'><?php echo esc_html( $this->fts_instagram_likes_count( $post_data ) ); ?> </li>
1136
+ <li class='slicker-instagram-image-comments'>
1137
+ <span class="fts-comment-instagram"></span> <?php echo esc_html( $this->fts_instagram_comments_count( $post_data ) ); ?>
1138
+ </li>
1139
+ </ul>
1140
+ </div>
1141
+ <?php } ?>
1142
+ </div>
1143
+ <?php } ?>
1144
+ </div>
1145
+ <?php
1146
+ } else {
1147
+ // Classic Gallery If statement.
1148
+ ?>
1149
+ <div class='instagram-placeholder fts-instagram-wrapper' style='width:150px;'>
1150
+ <?php
1151
+ if ( isset( $popup ) && 'yes' === $popup ) {
1152
+ print '<div class="fts-backg"></div>';
1153
+ } else {
1154
+ ?>
1155
+ <a class='fts-backg' target='_blank' href='<?php echo esc_url( $this->fts_view_on_instagram_url( $post_data ) ); ?>'></a><?php }; ?>
1156
+ <div class='date slicker-date'>
1157
+ <div class="fts-insta-date-popup-grab"><?php echo esc_html( $instagram_date ); ?></div>
1158
+ </div>
1159
 
 
1160
 
1161
+ <?php if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup ) { ?>
 
 
 
 
 
 
 
 
 
1162
 
 
 
 
 
 
1163
 
1164
+ <div class="fts-instagram-popup-profile-wrap">
1165
+ <div class="fts-profile-pic">
1166
+ <a href="https://www.instagram.com/<?php echo esc_attr( $username ); ?>" target="_blank" rel="noreferrer"><img
1167
+ src="<?php echo esc_attr( $profile_picture ); ?>" title="<?php echo esc_attr( $username ); ?>"/></a>
1168
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1169
 
1170
+ <div class="fts-profile-name-wrap">
 
 
 
 
 
 
 
 
 
 
 
 
1171
 
1172
+ <div class="fts-isnta-full-name"><?php echo esc_attr( $full_name ); ?></div>
1173
+ <?php
1174
+ if ( $username && 'yes' === $fts_instagram_show_follow_btn && 'instagram-follow-above' === $fts_instagram_show_follow_btn_where ) {
1175
+ echo '<div class="fts-follow-header-wrap">';
1176
+ echo $this->social_follow_button( 'instagram', $username );
1177
+ echo '</div>';
1178
+ }
1179
+ ?>
1180
+ </div>
1181
+ </div>
1182
+
1183
+ <?php
1184
+ // caption for our popup.
1185
+ echo $this->fts_instagram_popup_description( $post_data );
1186
+ ?>
1187
+ <?php } ?>
1188
+
1189
+ <a href="<?php
1190
+ // We need to check the type now because hashtag feeds from facebooks API use all caps now.
1191
+ $data_type_image = isset( $post_data->type ) && 'image' === $post_data->type ? : 'IMAGE';
1192
+ $data_type_video = isset( $post_data->type ) && 'video' === $post_data->type ? : 'VIDEO';
1193
+ $data_type_carousel = isset( $post_data->type ) && 'carousel' === $post_data->type ? : 'CAROUSEL';
1194
+ $data_type_hashtag = isset( $post_data->media_type ) ? $post_data->media_type : '';
1195
+ $data_type = isset( $post_data->type ) ? $post_data->type : $data_type_hashtag;
1196
+ if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup && ( $data_type_image === $data_type || $data_type_carousel === $data_type ) ) {
1197
+ print esc_url( $this->fts_instagram_image_link( $post_data ) );
1198
+ } elseif ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && $data_type_video === $data_type ) {
1199
+ print esc_url( $this->fts_instagram_video_link( $post_data ) );
1200
+ } else {
1201
+ print esc_url( $this->fts_view_on_instagram_url( $post_data ) );
1202
+ }
1203
+ ?>" class='fts-instagram-link-target instaG-backg-link
1204
+ <?php
1205
+ if ( 'video' === $post_data->type ) {
1206
+ ?>
1207
+ fts-instagram-video-link
1208
+ <?php
1209
+ } else {
1210
+ ?>
1211
+ fts-instagram-img-link<?php } ?>' target='_blank' rel="noreferrer" title='<?php echo esc_attr( $instagram_caption_a_title ); ?>'>
1212
+ <img src="<?php echo esc_url( $instagram_thumb_url ); ?>" class="instagram-image"/>
1213
+ <div class='instaG-photoshadow'></div>
1214
+ </a>
1215
+ <div class="fts-insta-likes-comments-grab-popup">
1216
+ <?php echo $this->fts_instagram_likes_comments_wrap( $post_data ); ?>
1217
+ </div>
1218
+ </div>
1219
+ <?php
1220
+ }
1221
+ if ( isset( $set_zero ) ) {
1222
+ $set_zero++;
1223
+ }
1224
+ }
1225
+
1226
+ if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && ! empty( $scroll_more ) ) {
1227
+ // ******************
1228
+ // Load More BUTTON Start
1229
+ // Check to see if the next isset for the hashtag feed. If so then pass it down so it's used.
1230
+ // ******************
1231
+ $next_hashtag_url = isset( $insta_data->paging->next ) ? $insta_data->paging->next : '';
1232
+ $next_url = isset( $insta_data->pagination->next_url ) ? $insta_data->pagination->next_url : $next_hashtag_url;
1233
+ // fb api uses limit for the post count and instagram api uses count.
1234
+ $the_count = 'hashtag' === $type || 'basic' === $type || 'business' === $type ? 'limit' : 'count';
1235
+ // we check to see if the loadmore count number is set and if so pass that as the new count number when fetching the next set of posts.
1236
+ $_REQUEST['next_url'] = '' !== $loadmore_count ? str_replace( "'.$the_count.'=$pics_count", "'.$the_count.'=$loadmore_count", $next_url ) : $next_url;
1237
+ $access_token = 'access_token=' . $fts_instagram_access_token_final;
1238
+ $_REQUEST['next_url'] = str_replace( $access_token, 'access_token=XXX', $next_url );
1239
+
1240
+ ?>
1241
+ <script>var nextURL_<?php echo esc_js( sanitize_text_field( wp_unslash( $_REQUEST['fts_dynamic_name'] ) ) ); ?>= "<?php echo esc_url_raw( $_REQUEST['next_url'] ); ?>";</script>
1242
+ <?php
1243
+ // Make sure it's not ajaxing.
1244
+ if ( ! isset( $_GET['load_more_ajaxing'] ) && ! isset( $_REQUEST['fts_no_more_posts'] ) && ! empty( $loadmore ) ) {
1245
+ $fts_dynamic_name = sanitize_text_field( wp_unslash( $_REQUEST['fts_dynamic_name'] ) );
1246
+ $time = time();
1247
+ $nonce = wp_create_nonce( $time . 'load-more-nonce' );
1248
+ ?>
1249
+ <script>jQuery(document).ready(function () {
1250
+ <?php
1251
+ // $scroll_more = load_more_posts_style shortcode att.
1252
+ if ( 'autoscroll' === $scroll_more ) { // this is where we do SCROLL function to LOADMORE if = autoscroll in shortcode.
1253
+ ?>
1254
+ jQuery(".<?php echo esc_js( $fts_dynamic_class_name ); ?>instagram").bind("scroll", function () {
1255
+ if (jQuery(this).scrollTop() + jQuery(this).innerHeight() >= jQuery(this)[0].scrollHeight) {
1256
+ <?php
1257
+ } else { // this is where we do CLICK function to LOADMORE if = button in shortcode.
1258
+ ?>
1259
+ jQuery("#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>").click(function () {
1260
+ <?php } ?>
1261
+ jQuery("#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>").addClass('fts-fb-spinner');
1262
+ var button = jQuery('#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>').html('<div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div>');
1263
+ console.log(button);
1264
+
1265
+ var feed_name = "fts_instagram";
1266
+ var loadmore_count = "pics_count=<?php echo esc_js( $loadmore_count ); ?>";
1267
+ var feed_attributes = <?php echo wp_json_encode( $atts ); ?>;
1268
+ var yes_ajax = "yes";
1269
+ var fts_d_name = "<?php echo esc_js( $fts_dynamic_name ); ?>";
1270
+ var fts_security = "<?php echo esc_js( $nonce ); ?>";
1271
+ var fts_time = "<?php echo esc_js( $time ); ?>";
1272
+ jQuery.ajax({
1273
+ data: {
1274
+ action: "my_fts_fb_load_more",
1275
+ next_url: nextURL_<?php echo esc_js( $fts_dynamic_name ); ?>,
1276
+ fts_dynamic_name: fts_d_name,
1277
+ load_more_ajaxing: yes_ajax,
1278
+ fts_security: fts_security,
1279
+ fts_time: fts_time,
1280
+ feed_name: feed_name,
1281
+ loadmore_count: loadmore_count,
1282
+ feed_attributes: feed_attributes
1283
+ },
1284
+ type: 'GET',
1285
+ url: "<?php echo esc_js( admin_url( 'admin-ajax.php' ) ); ?>",
1286
+ success: function (data) {
1287
+ console.log('Well Done and got this from sever: ' + data);
1288
+ jQuery('.<?php echo esc_js( $fts_dynamic_class_name ); ?>').append(data).filter('.<?php echo esc_js( $fts_dynamic_class_name ); ?>').html();
1289
+ if (!nextURL_<?php echo esc_js( sanitize_key( $_REQUEST['fts_dynamic_name'] ) ); ?> || nextURL_<?php echo esc_js( sanitize_key( $_REQUEST['fts_dynamic_name'] ) ); ?> === 'no more') {
1290
+ jQuery('#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>').replaceWith('<div class="fts-fb-load-more no-more-posts-fts-fb"><?php echo esc_js( $instagram_no_more_photos_text ); ?></div>');
1291
+ jQuery('#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>').removeAttr('id');
1292
+ jQuery(".<?php echo esc_js( $fts_dynamic_class_name ); ?>instagram").unbind('scroll');
1293
+ }
1294
+ jQuery('#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>').html('<?php echo esc_js( $instagram_load_more_text ); ?>');
1295
+ jQuery("#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>").removeClass('fts-fb-spinner');
1296
+ jQuery.fn.ftsShare(); // Reload the share each funcion otherwise you can't open share option
1297
+ jQuery.fn.slickInstagramPopUpFunction(); // Reload this function again otherwise the popup won't work correctly for the newly loaded items
1298
+ if (typeof outputSRmargin === "function") {
1299
+ outputSRmargin(document.querySelector('#margin').value)
1300
+ } // Reload our margin for the demo
1301
+ slickremixImageResizing(); // Reload our imagesizing function so the images show up proper
1302
+ }
1303
+ }); // end of ajax()
1304
+ return false;
1305
+ <?php
1306
+ // string $scroll_more is at top of this js script. exception for scroll option closing tag.
1307
+ if ( 'autoscroll' === $scroll_more ) {
1308
+ ?>
1309
+ }; // end of scroll ajax load
1310
+ <?php } ?>
1311
+ }
1312
+ ); // end of document.ready
1313
+ }); // end of form.submit </script>
1314
+ <?php
1315
+ }//End Check.
1316
+ }
1317
+ }
1318
  // main closing div not included in ajax check so we can close the wrap at all times.
1319
  print '</div>'; // closing main div for photos and scroll wrap.
1320
 
feeds/twitter/class-fts-twitter-feed.php CHANGED
@@ -23,6 +23,10 @@ class FTS_Twitter_Feed extends feed_them_social_functions {
23
  * @since 1.9.6
24
  */
25
  public function __construct() {
 
 
 
 
26
  add_shortcode( 'fts_twitter', array( $this, 'fts_twitter_func' ) );
27
 
28
  add_action( 'wp_enqueue_scripts', array( $this, 'fts_twitter_head' ) );
@@ -277,12 +281,12 @@ class FTS_Twitter_Feed extends feed_them_social_functions {
277
  if( !empty( $html['data'] ) ){
278
  // Try curl
279
  $html = $html['data'];
280
- error_log( 'FTS: using curl to get external url, image, title & description');
281
  }
282
  elseif( ini_get('allow_url_fopen') ){
283
  // If curl fails try file get contents
284
  $html = file_get_contents( $twitter_external_url );
285
- error_log( 'FTS: using file_get_contents');
286
  }
287
 
288
  // The first 2 are preg_match_all with single quotes '', the second 2 are with double quotes "". We have to check for both.
@@ -707,9 +711,18 @@ class FTS_Twitter_Feed extends feed_them_social_functions {
707
  $fts_twitter_custom_access_token = get_option( 'fts_twitter_custom_access_token' );
708
  $fts_twitter_custom_access_token_secret = get_option( 'fts_twitter_custom_access_token_secret' );
709
 
 
 
 
 
 
710
  // Check Cache.
711
  if ( false !== $this->fts_check_feed_cache_exists( $data_cache ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
712
- $fetched_tweets = $this->fts_get_feed_cache( $data_cache );
 
 
 
 
713
  $cache_used = true;
714
  } else {
715
  include_once WP_PLUGIN_DIR . '/feed-them-social/feeds/twitter/twitteroauth/twitteroauth.php';
@@ -874,6 +887,7 @@ class FTS_Twitter_Feed extends feed_them_social_functions {
874
  // Cache It.
875
  if ( ! isset( $cache_used ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
876
  $this->fts_create_feed_cache( $data_cache, $fetched_tweets );
 
877
  }
878
 
879
  $protocol = isset( $_SERVER['HTTPS'] ) ? 'https://' : 'http://';
23
  * @since 1.9.6
24
  */
25
  public function __construct() {
26
+
27
+ // Data Protection
28
+ $this->data_protection = new Data_Protection();
29
+
30
  add_shortcode( 'fts_twitter', array( $this, 'fts_twitter_func' ) );
31
 
32
  add_action( 'wp_enqueue_scripts', array( $this, 'fts_twitter_head' ) );
281
  if( !empty( $html['data'] ) ){
282
  // Try curl
283
  $html = $html['data'];
284
+ // error_log( 'FTS: using curl to get external url, image, title & description');
285
  }
286
  elseif( ini_get('allow_url_fopen') ){
287
  // If curl fails try file get contents
288
  $html = file_get_contents( $twitter_external_url );
289
+ // error_log( 'FTS: using file_get_contents');
290
  }
291
 
292
  // The first 2 are preg_match_all with single quotes '', the second 2 are with double quotes "". We have to check for both.
711
  $fts_twitter_custom_access_token = get_option( 'fts_twitter_custom_access_token' );
712
  $fts_twitter_custom_access_token_secret = get_option( 'fts_twitter_custom_access_token_secret' );
713
 
714
+ // echo 'YO! NO Data Cache';
715
+ // print_r( $data_cache );
716
+ // echo $this->fts_check_feed_cache_exists( $data_cache );
717
+ //echo 'What is the data cache ';
718
+
719
  // Check Cache.
720
  if ( false !== $this->fts_check_feed_cache_exists( $data_cache ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
721
+
722
+ // echo 'YO! Data Cache';
723
+ // print_r( $data_cache );
724
+ $fetched_tweets = json_decode( $this->fts_get_feed_cache( $data_cache ) );
725
+
726
  $cache_used = true;
727
  } else {
728
  include_once WP_PLUGIN_DIR . '/feed-them-social/feeds/twitter/twitteroauth/twitteroauth.php';
887
  // Cache It.
888
  if ( ! isset( $cache_used ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
889
  $this->fts_create_feed_cache( $data_cache, $fetched_tweets );
890
+ // echo 'YO! cached twitter feed ';
891
  }
892
 
893
  $protocol = isset( $_SERVER['HTTPS'] ) ? 'https://' : 'http://';
feeds/youtube/class-youtube-feed-free.php CHANGED
@@ -27,6 +27,10 @@ class FTS_Youtube_Feed_Free extends feed_them_social_functions {
27
  * @since 2.3.2
28
  */
29
  public function __construct() {
 
 
 
 
30
  add_shortcode( 'fts_youtube', array( $this, 'fts_youtube_func' ) );
31
 
32
  add_action( 'wp_enqueue_scripts', array( $this, 'fts_youtube_head' ) );
@@ -196,7 +200,8 @@ class FTS_Youtube_Feed_Free extends feed_them_social_functions {
196
  }
197
 
198
  // $fts_functions_class->delete_permanent_feed_cache($user_cache_name);
199
-
 
200
  $user_returned = $this->use_cache_check( $youtube_user_id_data, $user_cache_name );
201
 
202
  // If the YT User returned is not empty and is an arary.
@@ -271,6 +276,10 @@ class FTS_Youtube_Feed_Free extends feed_them_social_functions {
271
  }
272
 
273
  if ( isset( $youtube_feed_api_url ) ) {
 
 
 
 
274
  // Call, fetch and Check data from API url!
275
  $feed_returned = $this->use_cache_check( $youtube_feed_api_url, $feed_cache_name );
276
 
@@ -804,9 +813,8 @@ class FTS_Youtube_Feed_Free extends feed_them_social_functions {
804
 
805
  // Youtube Use Comments Cache!
806
  if ( false !== $this->fts_check_feed_cache_exists( $youtube_comments_cache_url ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
807
- $comments = $this->fts_get_feed_cache( $youtube_comments_cache_url );
808
  } else {
809
-
810
  // https://developers.google.com/youtube/v3/docs/comments/list.
811
  $comments['items'] = 'https://www.googleapis.com/youtube/v3/commentThreads?' . $youtube_api_key_or_token . '&textFormat=plainText&part=snippet&videoId=' . $video_id . '&maxResults=' . $comments_count . '';
812
  $comments_returned = $this->fts_get_feed_json( $comments );
@@ -884,7 +892,7 @@ class FTS_Youtube_Feed_Free extends feed_them_social_functions {
884
 
885
  // Youtube Use Comments Cache.
886
  if ( ( false !== $this->fts_check_feed_cache_exists( $youtube_single_video_cache_url ) && ! isset( $_GET['load_more_ajaxing'] ) ) && empty( $youtube_access_token_new ) ) {
887
- $video = $this->fts_get_feed_cache( $youtube_single_video_cache_url );
888
  } else {
889
 
890
  $video_returned = $this->fts_get_feed_json( $video );
@@ -930,7 +938,6 @@ class FTS_Youtube_Feed_Free extends feed_them_social_functions {
930
  * Use Cache Check
931
  *
932
  * Checks to see if we need to use cache or not
933
- * n
934
  *
935
  * @param string|array $api_call API Call.
936
  * @param string $cache_name Cache name.
@@ -952,41 +959,16 @@ class FTS_Youtube_Feed_Free extends feed_them_social_functions {
952
  $feed_data = $this->fts_get_feed_json( $api_call );
953
 
954
  if ( ! empty( $feed_data ) && ! empty( $cache_name ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
 
955
  // Error Check.
956
  $fts_error_check = new fts_error_handler();
957
  $fts_error_check_complete = $fts_error_check->youtube_error_check( $feed_data );
958
 
959
- if ( is_array( $fts_error_check_complete ) && ( true === $fts_error_check_complete[0] || 1 === $fts_error_check_complete[0] ) ) {
960
-
961
- // If old Cache still exists use it instead of showing an error. This prevents feed from breaking if old cache is still there.
962
- if ( true === $this->fts_check_feed_cache_exists( $cache_name, true ) ) {
963
-
964
- // If Current user is Admin and Cache exists for use then still show Admin the error for debugging purposes.
965
- if ( current_user_can( 'administrator' ) ) {
966
- echo wp_kses(
967
- $fts_error_check_complete[1] . ' <em>**NOTE** This error is only shown to logged in Admins of this WordPress install</em>',
968
- array(
969
- 'a' => array(
970
- 'href' => array(),
971
- 'title' => array(),
972
- ),
973
- 'br' => array(),
974
- 'em' => array(),
975
- 'strong' => array(),
976
- )
977
- );
978
- }
979
-
980
- // Return Cache because it exists in Database. Better than showing nothing right?
981
- return $this->fts_get_feed_cache( $cache_name, true );
982
- }
983
- } elseif ( false !== $this->fts_check_feed_cache_exists( $cache_name ) ) {
984
-
985
- // Create Cache.
986
- $this->fts_create_feed_cache( $cache_name, $feed_data );
987
-
988
- return $feed_data;
989
  }
 
990
  }
991
 
992
  return $feed_data;
27
  * @since 2.3.2
28
  */
29
  public function __construct() {
30
+
31
+ // Data Protection
32
+ $this->data_protection = new Data_Protection();
33
+
34
  add_shortcode( 'fts_youtube', array( $this, 'fts_youtube_func' ) );
35
 
36
  add_action( 'wp_enqueue_scripts', array( $this, 'fts_youtube_head' ) );
200
  }
201
 
202
  // $fts_functions_class->delete_permanent_feed_cache($user_cache_name);
203
+ // YO!
204
+ // echo ' why you no use cache check ';
205
  $user_returned = $this->use_cache_check( $youtube_user_id_data, $user_cache_name );
206
 
207
  // If the YT User returned is not empty and is an arary.
276
  }
277
 
278
  if ( isset( $youtube_feed_api_url ) ) {
279
+ // YO!
280
+ // STOPPING HERE. SEEMS AS THOUGH THE URL OR SOMETHING IS NOT CACHING IDK
281
+ // echo ' why you no use cache check ';
282
+ // echo $youtube_feed_api_url;
283
  // Call, fetch and Check data from API url!
284
  $feed_returned = $this->use_cache_check( $youtube_feed_api_url, $feed_cache_name );
285
 
813
 
814
  // Youtube Use Comments Cache!
815
  if ( false !== $this->fts_check_feed_cache_exists( $youtube_comments_cache_url ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
816
+ $comments = json_decode( $this->fts_get_feed_cache( $youtube_comments_cache_url ) );
817
  } else {
 
818
  // https://developers.google.com/youtube/v3/docs/comments/list.
819
  $comments['items'] = 'https://www.googleapis.com/youtube/v3/commentThreads?' . $youtube_api_key_or_token . '&textFormat=plainText&part=snippet&videoId=' . $video_id . '&maxResults=' . $comments_count . '';
820
  $comments_returned = $this->fts_get_feed_json( $comments );
892
 
893
  // Youtube Use Comments Cache.
894
  if ( ( false !== $this->fts_check_feed_cache_exists( $youtube_single_video_cache_url ) && ! isset( $_GET['load_more_ajaxing'] ) ) && empty( $youtube_access_token_new ) ) {
895
+ $video = json_decode( $this->fts_get_feed_cache( $youtube_single_video_cache_url ) );
896
  } else {
897
 
898
  $video_returned = $this->fts_get_feed_json( $video );
938
  * Use Cache Check
939
  *
940
  * Checks to see if we need to use cache or not
 
941
  *
942
  * @param string|array $api_call API Call.
943
  * @param string $cache_name Cache name.
959
  $feed_data = $this->fts_get_feed_json( $api_call );
960
 
961
  if ( ! empty( $feed_data ) && ! empty( $cache_name ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
962
+
963
  // Error Check.
964
  $fts_error_check = new fts_error_handler();
965
  $fts_error_check_complete = $fts_error_check->youtube_error_check( $feed_data );
966
 
967
+ // YO! SRL: 4-15-22. added empty( $fts_error_check_complete ) because we are not getting a response if there is no error from our error handler. TODO: That function needs work.
968
+ if ( is_array( $fts_error_check_complete ) && ( true === $fts_error_check_complete[0] || 1 === $fts_error_check_complete[0] ) || empty( $fts_error_check_complete ) ) {
969
+ $this->fts_create_feed_cache( $cache_name, $feed_data );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
970
  }
971
+
972
  }
973
 
974
  return $feed_data;
includes/error-handler.php CHANGED
@@ -137,7 +137,7 @@ class fts_error_handler {
137
  * @since 1.9.6
138
  */
139
  public function facebook_error_check( $fb_shortcode, $feed_data ) {
140
- // return error if no data retreived!
141
  try {
142
  if ( ! isset( $feed_data->data ) || empty( $feed_data->data ) ) {
143
  // Solution Text!
@@ -211,16 +211,17 @@ class fts_error_handler {
211
  */
212
  public function youtube_error_check( $feed_data ) {
213
 
214
- $feed_data = json_decode( $feed_data['data'] );
215
-
216
 
217
  //error_log( print_r( $feed_data, true ) );
218
 
219
- // return error if no data retreived!
 
 
220
  try {
221
- if ( ! isset( $feed_data->data ) || empty( $feed_data->data ) ) {
222
 
223
- // Solution Text!
224
  $solution_text = 'Here are some possible solutions to fix the error.';
225
  if ( isset( $feed_data->error ) && 400 === $feed_data->error->code ) {
226
  throw new \Exception( '<div style="clear:both; padding:15px 0;">#' . $feed_data->error->code . ' - A VALID access token is required to request this resource. <a style="color:red !important;" href="https://www.slickremix.com/docs/facebook-error-messages/#error-access-token-required" target="_blank">' . $solution_text . '</a></div>' );
@@ -236,13 +237,12 @@ class fts_error_handler {
236
 
237
  throw new \Exception( '<div style="clear:both; padding:15px 0;" class="fts-error-m">' . $output . '</div>' );
238
  }
239
-
240
- //throw new \Exception( '<div style="clear:both; padding:15px 0;" class="fts-error-m">'.esc_html__('Oops, It appears something is wrong with this YouTube feed. Are there videos posted on the YouTube account?').'</div>' );
241
  }
242
  } catch ( \Exception $e ) {
243
  return array( true, $e->getMessage() );
244
  }
245
- return;
246
  }
247
  }
248
 
137
  * @since 1.9.6
138
  */
139
  public function facebook_error_check( $fb_shortcode, $feed_data ) {
140
+ // return error if no data retrieved!
141
  try {
142
  if ( ! isset( $feed_data->data ) || empty( $feed_data->data ) ) {
143
  // Solution Text!
211
  */
212
  public function youtube_error_check( $feed_data ) {
213
 
214
+ // print_r($feed_data);
215
+ $feed_data = json_decode( $feed_data['data'] );
216
 
217
  //error_log( print_r( $feed_data, true ) );
218
 
219
+ // return error if no data retrieved!
220
+ // print_r($feed_data);
221
+
222
  try {
223
+ if ( ! isset( $feed_data->data ) || empty( $feed_data->data ) ) {
224
 
 
225
  $solution_text = 'Here are some possible solutions to fix the error.';
226
  if ( isset( $feed_data->error ) && 400 === $feed_data->error->code ) {
227
  throw new \Exception( '<div style="clear:both; padding:15px 0;">#' . $feed_data->error->code . ' - A VALID access token is required to request this resource. <a style="color:red !important;" href="https://www.slickremix.com/docs/facebook-error-messages/#error-access-token-required" target="_blank">' . $solution_text . '</a></div>' );
237
 
238
  throw new \Exception( '<div style="clear:both; padding:15px 0;" class="fts-error-m">' . $output . '</div>' );
239
  }
240
+ // Below not being used.
241
+ // throw new \Exception( '<div style="clear:both; padding:15px 0;" class="fts-error-m">'.esc_html__('Oops, It appears something is wrong with this YouTube feed. Are there videos posted on the YouTube account?').'</div>' );
242
  }
243
  } catch ( \Exception $e ) {
244
  return array( true, $e->getMessage() );
245
  }
 
246
  }
247
  }
248
 
includes/feed-them-functions.php CHANGED
@@ -9,6 +9,8 @@ namespace feedthemsocial;
9
  */
10
  class feed_them_social_functions {
11
 
 
 
12
  /**
13
  * Construct
14
  *
@@ -16,12 +18,16 @@ class feed_them_social_functions {
16
  *
17
  * @since 1.9.6
18
  */
19
- public function __construct() {
 
20
  $root_file = plugin_dir_path( dirname( __FILE__ ) );
21
  $this->premium = str_replace( 'feed-them-social/', 'feed-them-premium/', $root_file );
22
  $this->facebook_carousel_premium = str_replace( 'feed-them-social/', 'feed-them-carousel-premium/', $root_file );
23
  $this->facebook_reviews = str_replace( 'feed-them-social/', 'feed-them-social-facebook-reviews/', $root_file );
24
 
 
 
 
25
  // FTS Activation Function. Commenting out for future use. SRL!
26
  register_deactivation_hook( __FILE__, array( $this, 'fts_get_check_plugin_version' ) );
27
  // Widget Code!
@@ -32,7 +38,8 @@ class feed_them_social_functions {
32
  add_action( 'wp_head', array( $this, 'my_fts_ajaxurl' ) );
33
  add_action( 'wp_ajax_fts_clear_cache_ajax', array( $this, 'fts_clear_cache_ajax' ) );
34
  }
35
- add_action( 'wp_ajax_fts_refresh_token_ajax', array( $this, 'fts_refresh_token_ajax' ) );
 
36
  add_action( 'wp_ajax_fts_instagram_token_ajax', array( $this, 'fts_instagram_token_ajax' ) );
37
 
38
  if ( is_admin() || is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) || is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) || is_plugin_active( 'fts-bar/fts-bar.php' ) ) {
@@ -53,6 +60,7 @@ class feed_them_social_functions {
53
  * @since 1.9.6
54
  */
55
  public function init() {
 
56
  if ( is_admin() ) {
57
  // Register Settings!
58
  add_action( 'admin_init', array( $this, 'fts_settings_page_register_settings' ) );
@@ -103,7 +111,64 @@ class feed_them_social_functions {
103
  }
104
  }
105
 
106
- /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  * FTS Instagram Token Ajax
108
  *
109
  * This will save the returned token to the database.
@@ -119,14 +184,56 @@ class feed_them_social_functions {
119
  if ( wp_verify_nonce( $fts_refresh_token_nonce, 'fts_token_nonce' ) ) {
120
  if ( isset( $access_token ) ) {
121
  update_option( 'fts_instagram_custom_api_token', sanitize_text_field( $access_token ) );
122
- // $insta_id = substr( $access_token, 0, strpos( $access_token, '.' ) );
123
  update_option( 'fts_instagram_custom_id', sanitize_text_field( $user_id ) );
124
  }
125
  }
126
  die;
127
  }
128
 
129
- /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  * Feed Them Instagram Save Token
131
  *
132
  * FTS Check and Save Instagram Token Validity.
@@ -139,16 +246,21 @@ class feed_them_social_functions {
139
  $fts_refresh_token_nonce = wp_create_nonce( 'access_token' );
140
 
141
  if ( wp_verify_nonce( $fts_refresh_token_nonce, 'access_token' ) ) {
 
 
 
142
 
143
- $auth_obj = $_GET['code'];
144
- $feed_type = $_GET['feed_type'];
145
- $user_id = $_GET['user_id'];
146
 
147
- if ( isset( $auth_obj ) && 'original_instagram' === $feed_type || isset( $auth_obj ) && 'instagram_basic' === $feed_type ) {
148
- ?>
 
 
 
 
149
  <script>
150
  jQuery(document).ready(function () {
151
- var access_token = '<?php echo sanitize_text_field( $auth_obj ); ?>';
 
152
  var user_id = '<?php echo sanitize_text_field( $user_id ); ?>';
153
 
154
  jQuery.ajax({
@@ -161,13 +273,9 @@ class feed_them_social_functions {
161
  url: ftsAjax.ajaxurl,
162
  success: function (response) {
163
  <?php
164
- $auth_obj = $_GET['code'];
165
- if ( 'instagram_basic' === $feed_type ) {
166
- $insta_url = esc_url_raw( 'https://graph.instagram.com/me?fields=id,username&access_token=' . $auth_obj );
167
- } else {
168
- $insta_url = esc_url( 'https://api.instagram.com/v1/users/self/?access_token=' . $auth_obj );
169
- }
170
- // Get Data for Instagram to check for errors
171
  $response = wp_remote_fopen( $insta_url );
172
  $test_app_token_response = json_decode( $response );
173
 
@@ -207,7 +315,7 @@ class feed_them_social_functions {
207
  <?php
208
  }
209
  ?>
210
- console.log( 'success saving instagram access token' );
211
  }
212
  }); // end of ajax()
213
  return false;
@@ -294,7 +402,7 @@ class feed_them_social_functions {
294
  ob_start();
295
 
296
  if ( ! isset( $_GET['locations'] ) ) {
297
- $fb_url = 'fts-facebook-feed-styles-submenu-page' == $_GET['page'] ? wp_remote_fopen( 'https://graph.facebook.com/me/accounts?fields=name,id,link,access_token&access_token=' . $_GET['code'] . '&limit=25' ) : wp_remote_fopen( 'https://graph.facebook.com/me/accounts?fields=instagram_business_account{id,username,profile_picture_url},name,id,link,access_token&access_token=' . $_GET['code'] . '&limit=25' );
298
  $fb_token_response = isset( $_REQUEST['next_url'] ) ? wp_remote_fopen( esc_url_raw( $_REQUEST['next_url'] ) ) : $fb_url;
299
  $test_fb_app_token_response = json_decode( $fb_token_response );
300
  $_REQUEST['next_url'] = isset( $test_fb_app_token_response->paging->next ) ? esc_url_raw( $test_fb_app_token_response->paging->next ) : '';
@@ -303,9 +411,9 @@ class feed_them_social_functions {
303
  $test_fb_app_token_response = json_decode( $fb_token_response );
304
  }
305
 
306
- /* echo '<pre>';
307
- print_r($test_fb_app_token_response);
308
- echo '</pre>';*/
309
  // Make sure it's not ajaxing!
310
  if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
311
  // ******************
@@ -359,7 +467,7 @@ class feed_them_social_functions {
359
  </div>
360
  <div class="page-token"><?php echo esc_attr( $data->access_token ); ?></div>
361
  <?php
362
- $facebook_input_token = get_option( 'fts_facebook_custom_api_token' );
363
  $facebook_access_token = $data->access_token;
364
  if ( $facebook_input_token === $facebook_access_token ) {
365
  ?>
@@ -426,7 +534,7 @@ class feed_them_social_functions {
426
 
427
  <div class="page-token"><?php echo esc_html( $location->access_token ); ?></div>
428
  <?php
429
- $facebook_input_token = get_option( 'fts_facebook_custom_api_token' );
430
  $facebook_access_token = $location->access_token;
431
  if ( $facebook_input_token === $facebook_access_token ) {
432
  ?>
@@ -615,8 +723,8 @@ class feed_them_social_functions {
615
  <?php if ( 'fts-facebook-feed-styles-submenu-page' === $_GET['page'] ) { ?>
616
  $("#fts-facebook-feed-options-form").submit();
617
  <?php
618
- } elseif ( 'fts-instagram-feed-styles-submenu-page' === $_GET['page'] ) {
619
- ?>
620
  $("#fts-instagram-feed-options-form").submit();
621
  <?php } ?>
622
  });
@@ -628,6 +736,7 @@ class feed_them_social_functions {
628
  $(fb).click(function () {
629
  var fb_page_id = $(this).find('.fts-api-facebook-id').html();
630
  var token = $(this).find('.page-token').html();
 
631
  // alert(token);
632
  var name = $(this).find('.fb-name').html();
633
  var profile_image = $(this).find('.fb-image img').attr('src');
@@ -887,7 +996,7 @@ class feed_them_social_functions {
887
  wp_enqueue_script( 'fts_clear_cache_script', plugins_url( 'feed-them-social/admin/js/developer-admin.js' ), array( 'jquery' ), FTS_CURRENT_VERSION, false );
888
  wp_localize_script( 'fts_clear_cache_script', 'ftsAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
889
  wp_enqueue_script( 'fts_clear_cache_script' );
890
- }
891
 
892
  // we delete this option if found so we only empty the cache once when the plugin is ever activated or updated!
893
  delete_option( 'Feed_Them_Social_Activated_Plugin' );
@@ -2101,11 +2210,11 @@ if ( ! empty( $youtube_loadmore_text_color ) ) {
2101
  $output = '<form class="feed-them-social-admin-form shortcode-generator-form fb-page-shortcode-form" id="fts-fb-page-form">';
2102
 
2103
  // Check to see if token is in place otherwise show a message letting person no what they need to do!
2104
- $facebook_options = get_option( 'fts_facebook_custom_api_token' ) ? 'Yes' : 'No';
2105
  $output .= isset( $facebook_options ) && 'No' !== $facebook_options ? '' . "\n" : '<div class="feed-them-social-admin-input-wrap fts-required-token-message">Please get your Access Token on our <a href="admin.php?page=fts-facebook-feed-styles-submenu-page">Facebook Options</a> page.</div>' . "\n";
2106
  // end custom message for requiring token!
2107
  if ( is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) ) {
2108
- $facebook_options2 = get_option( 'fts_facebook_custom_api_token_biz' ) ? 'Yes' : 'No';
2109
  // Check to see if token is in place otherwise show a message letting person no what they need to do
2110
  // $output .= isset($facebook_options2) && $facebook_options2 !== 'No' ? '' . "\n" : '<div class="feed-them-social-admin-input-wrap fts-required-token-message">Please add a Facebook Page Reviews API Token to our <a href="admin.php?page=fts-facebook-feed-styles-submenu-page">Facebook Options</a> page before trying to view your Facebook Reviews feed.</div>' . "\n";
2111
  // end custom message for requiring token!
@@ -2751,7 +2860,10 @@ if ( ! empty( $youtube_loadmore_text_color ) ) {
2751
  * @since 1.9.6
2752
  */
2753
  public function fts_get_feed_json( $feeds_mulit_data ) {
2754
- // Make Multiple Requests from array with more than 2 keys!
 
 
 
2755
  if ( is_array( $feeds_mulit_data ) && count( $feeds_mulit_data ) > 1 ) {
2756
  $new_feeds_mulit_data = array();
2757
 
@@ -2809,6 +2921,31 @@ if ( ! empty( $youtube_loadmore_text_color ) ) {
2809
  */
2810
  public function fts_create_feed_cache( $transient_name, $response ) {
2811
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2812
  // Is there old Cache? If so Delete it!
2813
  if ( true === $this->fts_check_feed_cache_exists( $transient_name ) ) {
2814
  // Make Sure to delete old permanent cache before setting up new cache!
@@ -2817,11 +2954,15 @@ if ( ! empty( $youtube_loadmore_text_color ) ) {
2817
  // Cache Time set on Settings Page under FTS Tab.
2818
  $cache_time_limit = true === get_option( 'fts_clear_cache_developer_mode' ) && '1' !== get_option( 'fts_clear_cache_developer_mode' ) ? get_option( 'fts_clear_cache_developer_mode' ) : '900';
2819
 
2820
- // Timed Cache.
2821
- set_transient( 'fts_t_' . $transient_name, $response, $cache_time_limit );
 
 
 
 
 
 
2822
 
2823
- // Permanent Feed cache. NOTE set to 0.
2824
- set_transient( 'fts_p_' . $transient_name, $response, 0 );
2825
  }
2826
 
2827
  /**
@@ -2836,11 +2977,46 @@ if ( ! empty( $youtube_loadmore_text_color ) ) {
2836
 
2837
  // If Error use Permanent Cache!
2838
  if ( true === $errored ) {
2839
- return get_transient( 'fts_p_' . $transient_name );
2840
- }
2841
-
2842
- // If no error use Timed Cache!
2843
- return get_transient( 'fts_t_' . $transient_name );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2844
  }
2845
 
2846
  /**
@@ -2891,16 +3067,50 @@ if ( ! empty( $youtube_loadmore_text_color ) ) {
2891
  * @return string
2892
  * @since 1.9.6
2893
  */
2894
- public function feed_them_clear_cache() {
2895
  global $wpdb;
2896
  // Clear UnExpired Timed Cache!
2897
- $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", '_transient_fts_t_%' ) );
2898
  // Clear Expired Timed Cache!
2899
- $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", '_transient_timeout_fts_t_%' ) );
2900
  wp_reset_query();
2901
- return 'Cache for ALL FTS Feeds cleared!';
2902
  }
2903
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2904
  /**
2905
  * Delete permanent feed Cache
2906
  *
@@ -2919,7 +3129,6 @@ if ( ! empty( $youtube_loadmore_text_color ) ) {
2919
  return 'Cache for this feed cleared!';
2920
  }
2921
 
2922
-
2923
  /**
2924
  * FTS Admin Bar Menu
2925
  *
@@ -2958,6 +3167,7 @@ if ( ! empty( $youtube_loadmore_text_color ) ) {
2958
  'parent' => 'feed_them_social_admin_bar',
2959
  'title' => __( 'Clear Cache', 'feed-them-social' ),
2960
  'href' => '#',
 
2961
  )
2962
  );
2963
  }
@@ -3345,49 +3555,43 @@ if ( ! empty( $youtube_loadmore_text_color ) ) {
3345
  console.log(response);
3346
  <?php
3347
  if ( isset( $_GET['page'] ) && 'fts-youtube-feed-styles-submenu-page' === $_GET['page'] ) {
3348
- foreach ( $auth_obj as $user_id ) {
3349
- if ( ! isset( $user_id->error->errors[0]->reason ) ) {
3350
- $type_of_key = __( 'API key', 'feed-them-social' );
3351
- } elseif ( ! isset( $user_id->error->errors[0]->reason ) && ! empty( $youtube_access_token ) ) {
3352
- $type_of_key = __( 'Access Token', 'feed-them-social' );
3353
- }
3354
-
3355
- // Error Check!
3356
- if ( ! isset( $auth_obj->error->errors[0]->reason ) ) {
3357
- $fts_youtube_message = sprintf(
3358
- esc_html( '%1$s Your %2$s is working! Generate your shortcode on the %3$s settings page.%4$s %5$s', 'feed-them-social' ),
3359
- '<div class="fts-successful-api-token">',
3360
- esc_html( $type_of_key ),
3361
- '<a href="' . esc_url( 'admin.php?page=feed-them-settings-page' ) . '">',
3362
- '</a>',
3363
- '</div><div class="clear"></div>'
3364
- );
3365
- } elseif ( isset( $user_id->error->errors[0]->reason ) ) {
3366
- $fts_youtube_message = sprintf(
3367
- esc_html( '%1$s This %2$s does not appear to be valid. YouTube responded with: %3$s %4$s ', 'feed-them-social' ),
3368
- '<div class="fts-failed-api-token">',
3369
- esc_html( $type_of_key ),
3370
- esc_html( $user_id->errors[0]->reason ),
3371
- '</div><div class="clear"></div>'
3372
- );
3373
- }
3374
 
3375
- break;
3376
- }
3377
-
3378
- ?>
3379
- jQuery('#youtube_custom_access_token, #youtube_custom_token_exp_time').val('');
3380
-
3381
- <?php if ( isset( $_GET['refresh_token'], $_GET['code'] ) && isset( $_GET['expires_in'] ) ) { ?>
3382
- jQuery('#youtube_custom_refresh_token').val(jQuery('#youtube_custom_refresh_token').val() + '<?php echo esc_js( $clienttoken_post['refresh_token'] ); ?>');
3383
- jQuery('.fts-failed-api-token').hide();
3384
-
3385
- if (!jQuery('.fts-successful-api-token').length) {
3386
- jQuery('.fts-youtube-last-row').append('<?php echo $fts_youtube_message; ?>');
3387
- }
3388
- <?php
3389
- } else {
3390
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3391
  if (jQuery('.fts-failed-api-token').length) {
3392
  jQuery('.fts-youtube-last-row').append('<?php echo $fts_youtube_message; ?>');
3393
  jQuery('.fts-failed-api-token').hide();
@@ -3410,7 +3614,6 @@ if ( ! empty( $youtube_loadmore_text_color ) ) {
3410
  }
3411
  }
3412
 
3413
-
3414
  /**
3415
  * FTS YouTube Link Filter
3416
  *
9
  */
10
  class feed_them_social_functions {
11
 
12
+ public $data_protection;
13
+
14
  /**
15
  * Construct
16
  *
18
  *
19
  * @since 1.9.6
20
  */
21
+ public function __construct( ) {
22
+
23
  $root_file = plugin_dir_path( dirname( __FILE__ ) );
24
  $this->premium = str_replace( 'feed-them-social/', 'feed-them-premium/', $root_file );
25
  $this->facebook_carousel_premium = str_replace( 'feed-them-social/', 'feed-them-carousel-premium/', $root_file );
26
  $this->facebook_reviews = str_replace( 'feed-them-social/', 'feed-them-social-facebook-reviews/', $root_file );
27
 
28
+ // Data Protection
29
+ $this->data_protection = new Data_Protection();
30
+
31
  // FTS Activation Function. Commenting out for future use. SRL!
32
  register_deactivation_hook( __FILE__, array( $this, 'fts_get_check_plugin_version' ) );
33
  // Widget Code!
38
  add_action( 'wp_head', array( $this, 'my_fts_ajaxurl' ) );
39
  add_action( 'wp_ajax_fts_clear_cache_ajax', array( $this, 'fts_clear_cache_ajax' ) );
40
  }
41
+ add_action( 'wp_ajax_fts_encrypt_token_ajax', array( $this, 'fts_encrypt_token_ajax' ) );
42
+ add_action( 'wp_ajax_fts_refresh_token_ajax', array( $this, 'fts_refresh_token_ajax' ) );
43
  add_action( 'wp_ajax_fts_instagram_token_ajax', array( $this, 'fts_instagram_token_ajax' ) );
44
 
45
  if ( is_admin() || is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) || is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) || is_plugin_active( 'fts-bar/fts-bar.php' ) ) {
60
  * @since 1.9.6
61
  */
62
  public function init() {
63
+
64
  if ( is_admin() ) {
65
  // Register Settings!
66
  add_action( 'admin_init', array( $this, 'fts_settings_page_register_settings' ) );
111
  }
112
  }
113
 
114
+ /**
115
+ * Get Facebook Custom API Access Token
116
+ *
117
+ * @return mixed
118
+ * @since 2.9.7.2
119
+ */
120
+ public function get_fb_access_token() {
121
+ //Facebook.
122
+ $token = get_option( 'fts_facebook_custom_api_token' );
123
+ $value = false !== $this->data_protection->decrypt( $token ) ? $this->data_protection->decrypt( $token ) : $token;
124
+
125
+ return $value;
126
+ }
127
+
128
+ /**
129
+ * Get Facebook Reviews API Access Token
130
+ *
131
+ * @return mixed
132
+ * @since 2.9.7.2
133
+ */
134
+ public function get_fb_biz_access_token() {
135
+ //Facebook Reviews.
136
+ $reviews_token = get_option( 'fts_facebook_custom_api_token_biz' );
137
+ $value = false !== $this->data_protection->decrypt( $reviews_token ) ? $this->data_protection->decrypt( $reviews_token ) : $reviews_token;
138
+
139
+ return $value;
140
+ }
141
+
142
+
143
+ /**
144
+ * Get Instagram Basic Access Token
145
+ *
146
+ * @return mixed
147
+ * @since 2.9.7.2
148
+ */
149
+ public function get_fts_instagram_custom_api_token() {
150
+ //Instagram Basic.
151
+ $basic_token = get_option( 'fts_instagram_custom_api_token' );
152
+ $value = false !== $this->data_protection->decrypt( $basic_token ) ? $this->data_protection->decrypt( $basic_token ) : $basic_token;
153
+
154
+ return $value;
155
+ }
156
+
157
+ /**
158
+ * Get Instagram Business API Access Token
159
+ *
160
+ * @return mixed
161
+ * @since 1.9.6
162
+ */
163
+ public function get_ig_fb_biz_access_token() {
164
+ //Instagram Business.
165
+ $business_token = get_option( 'fts_facebook_instagram_custom_api_token' );
166
+ $value = false !== $this->data_protection->decrypt( $business_token ) ? $this->data_protection->decrypt( $business_token ) : $business_token;
167
+
168
+ return $value;
169
+ }
170
+
171
+ /**
172
  * FTS Instagram Token Ajax
173
  *
174
  * This will save the returned token to the database.
184
  if ( wp_verify_nonce( $fts_refresh_token_nonce, 'fts_token_nonce' ) ) {
185
  if ( isset( $access_token ) ) {
186
  update_option( 'fts_instagram_custom_api_token', sanitize_text_field( $access_token ) );
 
187
  update_option( 'fts_instagram_custom_id', sanitize_text_field( $user_id ) );
188
  }
189
  }
190
  die;
191
  }
192
 
193
+ /**
194
+ * FTS Instagram Token Ajax
195
+ *
196
+ * SRL: This will save the encrypted version of the token to the database and return the original token to the input field upon page submit.
197
+ *
198
+ * @since 2.9.7.2
199
+ */
200
+ public function fts_encrypt_token_ajax() {
201
+
202
+ $fts_refresh_token_nonce = wp_create_nonce( 'fts_encrypt_token_nonce' );
203
+ $access_token = $_REQUEST['access_token'];
204
+ $encrypt = $this->data_protection->encrypt( $access_token );
205
+
206
+ if ( wp_verify_nonce( $fts_refresh_token_nonce, 'fts_encrypt_token_nonce' ) ) {
207
+ if( 'business' === $_REQUEST['token_type'] ){
208
+ // Now the encrypted version is saved to the DB.
209
+ update_option( 'fts_facebook_instagram_custom_api_token', sanitize_text_field( $encrypt ) );
210
+ }
211
+ elseif ( 'basic' === $_REQUEST['token_type'] ) {
212
+ // Now the encrypted version is saved to the DB.
213
+ update_option( 'fts_instagram_custom_api_token', sanitize_text_field( $encrypt ) );
214
+ }
215
+ elseif( 'fbBusiness' === $_REQUEST['token_type'] ){
216
+ // Now the encrypted version is saved to the DB.
217
+ update_option( 'fts_facebook_custom_api_token', sanitize_text_field( $encrypt ) );
218
+ }
219
+ elseif( 'fbBusinessReviews' === $_REQUEST['token_type'] ){
220
+ // Now the encrypted version is saved to the DB.
221
+ update_option( 'fts_facebook_custom_api_token_biz', sanitize_text_field( $encrypt ) );
222
+ }
223
+ }
224
+ $token_data = array (
225
+ 'token' => $access_token,
226
+ 'encrypted' => $encrypt,
227
+ );
228
+
229
+ // We pass the original access token back so we can add it to our input field.
230
+ // Also passing the encrypted token so we can see it in the console.
231
+ echo json_encode( $token_data );
232
+
233
+ wp_die();
234
+ }
235
+
236
+ /**
237
  * Feed Them Instagram Save Token
238
  *
239
  * FTS Check and Save Instagram Token Validity.
246
  $fts_refresh_token_nonce = wp_create_nonce( 'access_token' );
247
 
248
  if ( wp_verify_nonce( $fts_refresh_token_nonce, 'access_token' ) ) {
249
+ $raw_token = $_GET['code'];
250
+ $feed_type = $_GET['feed_type'];
251
+ $user_id = $_GET['user_id'];
252
 
 
 
 
253
 
254
+
255
+ if ( isset( $raw_token ) && 'original_instagram' === $feed_type || isset( $raw_token ) && 'instagram_basic' === $feed_type ) {
256
+ $encrypted_token = $this->data_protection->encrypt( $raw_token );
257
+ // error_log( print_r( $encrypted_token, true ) );
258
+
259
+ ?>
260
  <script>
261
  jQuery(document).ready(function () {
262
+
263
+ var access_token = '<?php echo sanitize_text_field( $encrypted_token ); ?>';
264
  var user_id = '<?php echo sanitize_text_field( $user_id ); ?>';
265
 
266
  jQuery.ajax({
273
  url: ftsAjax.ajaxurl,
274
  success: function (response) {
275
  <?php
276
+ $insta_url = 'instagram_basic' === $feed_type ? esc_url_raw( 'https://graph.instagram.com/me?fields=id,username&access_token=' . $raw_token ) : esc_url( 'https://api.instagram.com/v1/users/self/?access_token=' . $raw_token );
277
+
278
+ // Get Data for Instagram to check for errors!
 
 
 
 
279
  $response = wp_remote_fopen( $insta_url );
280
  $test_app_token_response = json_decode( $response );
281
 
315
  <?php
316
  }
317
  ?>
318
+ console.log( 'success saving instagram access token: Encrypted Token: <?php echo $encrypted_token ?>' );
319
  }
320
  }); // end of ajax()
321
  return false;
402
  ob_start();
403
 
404
  if ( ! isset( $_GET['locations'] ) ) {
405
+ $fb_url = 'fts-facebook-feed-styles-submenu-page' == $_GET['page'] ? wp_remote_fopen( 'https://graph.facebook.com/me/accounts?fields=locations{name,id,page_username,locations,store_number,store_location_descriptor,access_token},name,id,link,access_token&access_token=' . $_GET['code'] . '&limit=25' ) : wp_remote_fopen( 'https://graph.facebook.com/me/accounts?fields=instagram_business_account{id,username,profile_picture_url},locations{instagram_business_account{profile_picture_url,id,username},name,id,page_username,locations,store_number,store_location_descriptor,access_token},name,id,link,access_token&access_token=' . $_GET['code'] . '&limit=25' );
406
  $fb_token_response = isset( $_REQUEST['next_url'] ) ? wp_remote_fopen( esc_url_raw( $_REQUEST['next_url'] ) ) : $fb_url;
407
  $test_fb_app_token_response = json_decode( $fb_token_response );
408
  $_REQUEST['next_url'] = isset( $test_fb_app_token_response->paging->next ) ? esc_url_raw( $test_fb_app_token_response->paging->next ) : '';
411
  $test_fb_app_token_response = json_decode( $fb_token_response );
412
  }
413
 
414
+ // echo '<pre>';
415
+ // print_r($test_fb_app_token_response);
416
+ // echo '</pre>';
417
  // Make sure it's not ajaxing!
418
  if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
419
  // ******************
467
  </div>
468
  <div class="page-token"><?php echo esc_attr( $data->access_token ); ?></div>
469
  <?php
470
+ $facebook_input_token = $this->get_fb_access_token();
471
  $facebook_access_token = $data->access_token;
472
  if ( $facebook_input_token === $facebook_access_token ) {
473
  ?>
534
 
535
  <div class="page-token"><?php echo esc_html( $location->access_token ); ?></div>
536
  <?php
537
+ $facebook_input_token = $this->get_fb_access_token();
538
  $facebook_access_token = $location->access_token;
539
  if ( $facebook_input_token === $facebook_access_token ) {
540
  ?>
723
  <?php if ( 'fts-facebook-feed-styles-submenu-page' === $_GET['page'] ) { ?>
724
  $("#fts-facebook-feed-options-form").submit();
725
  <?php
726
+ } elseif ( 'fts-instagram-feed-styles-submenu-page' === $_GET['page'] ) {
727
+ ?>
728
  $("#fts-instagram-feed-options-form").submit();
729
  <?php } ?>
730
  });
736
  $(fb).click(function () {
737
  var fb_page_id = $(this).find('.fts-api-facebook-id').html();
738
  var token = $(this).find('.page-token').html();
739
+
740
  // alert(token);
741
  var name = $(this).find('.fb-name').html();
742
  var profile_image = $(this).find('.fb-image img').attr('src');
996
  wp_enqueue_script( 'fts_clear_cache_script', plugins_url( 'feed-them-social/admin/js/developer-admin.js' ), array( 'jquery' ), FTS_CURRENT_VERSION, false );
997
  wp_localize_script( 'fts_clear_cache_script', 'ftsAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
998
  wp_enqueue_script( 'fts_clear_cache_script' );
999
+ }
1000
 
1001
  // we delete this option if found so we only empty the cache once when the plugin is ever activated or updated!
1002
  delete_option( 'Feed_Them_Social_Activated_Plugin' );
2210
  $output = '<form class="feed-them-social-admin-form shortcode-generator-form fb-page-shortcode-form" id="fts-fb-page-form">';
2211
 
2212
  // Check to see if token is in place otherwise show a message letting person no what they need to do!
2213
+ $facebook_options = $this->get_fb_access_token() ? 'Yes' : 'No';
2214
  $output .= isset( $facebook_options ) && 'No' !== $facebook_options ? '' . "\n" : '<div class="feed-them-social-admin-input-wrap fts-required-token-message">Please get your Access Token on our <a href="admin.php?page=fts-facebook-feed-styles-submenu-page">Facebook Options</a> page.</div>' . "\n";
2215
  // end custom message for requiring token!
2216
  if ( is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) ) {
2217
+ $facebook_options2 = $this->get_fb_biz_access_token() ? 'Yes' : 'No';
2218
  // Check to see if token is in place otherwise show a message letting person no what they need to do
2219
  // $output .= isset($facebook_options2) && $facebook_options2 !== 'No' ? '' . "\n" : '<div class="feed-them-social-admin-input-wrap fts-required-token-message">Please add a Facebook Page Reviews API Token to our <a href="admin.php?page=fts-facebook-feed-styles-submenu-page">Facebook Options</a> page before trying to view your Facebook Reviews feed.</div>' . "\n";
2220
  // end custom message for requiring token!
2860
  * @since 1.9.6
2861
  */
2862
  public function fts_get_feed_json( $feeds_mulit_data ) {
2863
+
2864
+ // error_log( print_r( 'Encrypted Value: '. $feeds_mulit_data, true ) );
2865
+
2866
+ // Make Multiple Requests from array with more than 2 keys!
2867
  if ( is_array( $feeds_mulit_data ) && count( $feeds_mulit_data ) > 1 ) {
2868
  $new_feeds_mulit_data = array();
2869
 
2921
  */
2922
  public function fts_create_feed_cache( $transient_name, $response ) {
2923
 
2924
+ // YO!
2925
+ // echo '<br/><br/>Now we are in the create feed cache function. What is the response at this point just before we encrypt response.<br/>';
2926
+ // print_r($response);
2927
+
2928
+ if(is_array($response)){
2929
+ $encrypted_response = array();
2930
+ foreach ($response as $item_key => $item_value){
2931
+ $encrypted_response[ $item_key ] = $this->data_protection->encrypt( $item_value );
2932
+ }
2933
+
2934
+ $encrypted_response = serialize($encrypted_response);
2935
+
2936
+ // YO!
2937
+ // echo '<br/><br/> Serialized Array<br/>';
2938
+ // print_r($encrypted_response);
2939
+ }
2940
+ else{
2941
+ // YO!
2942
+ // echo '<br/><br/>#2 Now we have encrypted the data. What is the response at this point.<br/>';
2943
+ // print_r($encrypted_response);
2944
+
2945
+ $encrypted_response = $this->data_protection->encrypt( $response );
2946
+
2947
+ }
2948
+
2949
  // Is there old Cache? If so Delete it!
2950
  if ( true === $this->fts_check_feed_cache_exists( $transient_name ) ) {
2951
  // Make Sure to delete old permanent cache before setting up new cache!
2954
  // Cache Time set on Settings Page under FTS Tab.
2955
  $cache_time_limit = true === get_option( 'fts_clear_cache_developer_mode' ) && '1' !== get_option( 'fts_clear_cache_developer_mode' ) ? get_option( 'fts_clear_cache_developer_mode' ) : '900';
2956
 
2957
+ //Check an Encrypted Response was returned.
2958
+ if( $encrypted_response ){
2959
+ // Timed Cache.
2960
+ set_transient( 'fts_t_' . $transient_name, $encrypted_response, $cache_time_limit );
2961
+
2962
+ // Permanent Feed cache. NOTE set to 0.
2963
+ set_transient( 'fts_p_' . $transient_name, $encrypted_response, 0 );
2964
+ }
2965
 
 
 
2966
  }
2967
 
2968
  /**
2977
 
2978
  // If Error use Permanent Cache!
2979
  if ( true === $errored ) {
2980
+ $trans = get_transient( 'fts_p_' . $transient_name );
2981
+ }
2982
+ else{
2983
+ // If no error use Timed Cache!
2984
+ $trans = get_transient( 'fts_t_' . $transient_name );
2985
+ }
2986
+
2987
+ // YO!
2988
+ // echo '<br/>GET CACHE What is the response at this point:<br/>';
2989
+ // print_r($trans);
2990
+
2991
+ if ($trans){
2992
+
2993
+ //is the transient value serialized? If so, un-serialize it!
2994
+ $unserialized_value = \maybe_unserialize( $trans );
2995
+
2996
+ // echo '<br/><br/>UNSerialized Array<br/>';
2997
+ // print_r($unserialized_value);
2998
+
2999
+ // Is value an array?
3000
+ if(is_array($unserialized_value)){
3001
+ $decrypted_value = array();
3002
+ foreach ($unserialized_value as $item_key => $item_value){
3003
+ $decrypted_value[ $item_key ] = $this->data_protection->decrypt( $item_value );
3004
+ }
3005
+ }
3006
+ else{
3007
+ // YO!
3008
+ // echo '<br/><br/>Not an array so decrypt string.<br/>';
3009
+ // Not an array so decrypt string.
3010
+ $decrypted_value = false !== $this->data_protection->decrypt( $trans ) ? $this->data_protection->decrypt( $trans ) : $trans;
3011
+ }
3012
+
3013
+ // YO!
3014
+ // echo '<br/><br/>Decrypted!<br/>';
3015
+ // print_r($decrypted_value);
3016
+
3017
+ }
3018
+
3019
+ return $decrypted_value;
3020
  }
3021
 
3022
  /**
3067
  * @return string
3068
  * @since 1.9.6
3069
  */
3070
+ public function feed_them_clear_admin_cache() {
3071
  global $wpdb;
3072
  // Clear UnExpired Timed Cache!
3073
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", 'fts_facebook_%' ) );
3074
  // Clear Expired Timed Cache!
3075
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", 'fts_instagram_%' ) );
3076
  wp_reset_query();
3077
+ return 'Cache for ALL FTS Admin Options cleared!';
3078
  }
3079
 
3080
+ /**
3081
+ * Feed Them Clear Instagram Token.
3082
+ *
3083
+ * Clear ALL FTS Cache.
3084
+ *
3085
+ * @return string
3086
+ * @since 1.9.6
3087
+ */
3088
+ public function feed_them_clear_ig_token() {
3089
+ global $wpdb;
3090
+ // Clear Expired Timed Cache!
3091
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", 'fts_instagram_custom_api_token' ) );
3092
+ wp_reset_query();
3093
+ return 'Cache for ALL FTS Admin Options cleared!';
3094
+ }
3095
+
3096
+ /**
3097
+ * Feed Them Clear Cache
3098
+ *
3099
+ * Clear ALL FTS Cache.
3100
+ *
3101
+ * @return string
3102
+ * @since 1.9.6
3103
+ */
3104
+ public function feed_them_clear_cache() {
3105
+ global $wpdb;
3106
+ // Clear UnExpired Timed Cache!
3107
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", '_transient_fts_t_%' ) );
3108
+ // Clear Expired Timed Cache!
3109
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", '_transient_timeout_fts_t_%' ) );
3110
+ wp_reset_query();
3111
+ return 'Cache for ALL FTS Feeds cleared!';
3112
+ }
3113
+
3114
  /**
3115
  * Delete permanent feed Cache
3116
  *
3129
  return 'Cache for this feed cleared!';
3130
  }
3131
 
 
3132
  /**
3133
  * FTS Admin Bar Menu
3134
  *
3167
  'parent' => 'feed_them_social_admin_bar',
3168
  'title' => __( 'Clear Cache', 'feed-them-social' ),
3169
  'href' => '#',
3170
+ 'meta' => array('onclick' => 'fts_ClearCache();') //JavaScript function trigger just as an example.
3171
  )
3172
  );
3173
  }
3555
  console.log(response);
3556
  <?php
3557
  if ( isset( $_GET['page'] ) && 'fts-youtube-feed-styles-submenu-page' === $_GET['page'] ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3558
 
3559
+ $user_id = $auth_obj;
3560
+ $error_response = $user_id->error->errors[0]->message ? 'true' : 'false';
3561
+ $type_of_key = __( 'Access Token', 'feed-them-social' );
3562
+
3563
+ // Error Check!
3564
+ if ( 'true' === $error_response ) {
3565
+ $fts_youtube_message = sprintf(
3566
+ esc_html( '%1$s This %2$s does not appear to be valid. YouTube responded with: %3$s %4$s ', 'feed-them-social' ),
3567
+ '<div class="fts-failed-api-token">',
3568
+ esc_html( $type_of_key ),
3569
+ esc_html( $user_id->error->errors[0]->message ),
3570
+ '</div><div class="clear"></div>'
3571
+ );
3572
+ }
3573
+ else {
3574
+ $fts_youtube_message = sprintf(
3575
+ esc_html( '%1$s Your %2$s is working! Generate your shortcode on the %3$s settings page.%4$s %5$s', 'feed-them-social' ),
3576
+ '<div class="fts-successful-api-token">',
3577
+ esc_html( $type_of_key ),
3578
+ '<a href="' . esc_url( 'admin.php?page=feed-them-settings-page' ) . '">',
3579
+ '</a>',
3580
+ '</div><div class="clear"></div>'
3581
+ );
3582
+ } ?>
3583
+ jQuery('#youtube_custom_access_token, #youtube_custom_token_exp_time').val('');
3584
+
3585
+ <?php if ( isset( $_GET['refresh_token'], $_GET['code'] ) && isset( $_GET['expires_in'] ) ) { ?>
3586
+ jQuery('#youtube_custom_refresh_token').val(jQuery('#youtube_custom_refresh_token').val() + '<?php echo esc_js( $clienttoken_post['refresh_token'] ); ?>');
3587
+ jQuery('.fts-failed-api-token').hide();
3588
+
3589
+ if (!jQuery('.fts-successful-api-token').length) {
3590
+ jQuery('.fts-youtube-last-row').append('<?php echo $fts_youtube_message; ?>');
3591
+ }
3592
+ <?php
3593
+ } else {
3594
+ ?>
3595
  if (jQuery('.fts-failed-api-token').length) {
3596
  jQuery('.fts-youtube-last-row').append('<?php echo $fts_youtube_message; ?>');
3597
  jQuery('.fts-failed-api-token').hide();
3614
  }
3615
  }
3616
 
 
3617
  /**
3618
  * FTS YouTube Link Filter
3619
  *
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.9
6
- Stable tag: 2.9.7.1
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.7.1 Monday, January 31st, 2022 =
76
  * NOTE: Tested with WordPress Version 5.9
77
 
3
  Tags: Facebook, Instagram, Twitter, YouTube, Feed
4
  Requires at least: 3.6.0
5
  Tested up to: 5.9
6
+ Stable tag: 2.9.8
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.8 Thursday, March 17th, 2022 =
76
+ * NEW: All feeds are now encrypted before saving cache to the database. Just another way we are safeguarding your personal data.
77
+ * NEW: Facebook and Instagram Access Tokens are being encrypted before saving to the database. YouTube & Twitter will be updated in 3.0.
78
+ * FIX: YouTube Options: Error response for API Tokens.
79
+ * FIX: YouTube Feed caching.
80
+ * NOTE: Tested with WordPress Version 5.9.2
81
+
82
  = Version 2.9.7.1 Monday, January 31st, 2022 =
83
  * NOTE: Tested with WordPress Version 5.9
84