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

Version Description

Download this release

Release Info

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

Code changes from version 2.7.0 to 2.7.1

admin/class-fts-twitter-options-page.php CHANGED
@@ -32,12 +32,35 @@ class FTS_Twitter_Options_Page {
32
  public function __construct() {
33
  }
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  /**
36
  * Feed Them Twitter Options Page
37
  *
38
  * @since 1.9.6
39
  */
40
  public function feed_them_twitter_options_page() {
 
 
 
 
41
  ?>
42
  <div class="feed-them-social-admin-wrap">
43
  <h1>
@@ -228,6 +251,8 @@ class FTS_Twitter_Options_Page {
228
  '</div>'
229
  );
230
  }
 
 
231
  } else {
232
  echo sprintf(
233
  esc_html( '%1$sTo get started, please click the button above to retrieve your Access Token.%2$s', 'feed-them-social' ),
32
  public function __construct() {
33
  }
34
 
35
+
36
+ /**
37
+ * Set New Access Tokens
38
+ *
39
+ * Set the Tokens from Twitter on return.
40
+ *
41
+ * @since 2.7.1
42
+ */
43
+ public function set_new_access_tokens() {
44
+ // Set New Access Tokens!
45
+ if ( isset( $_GET['oauth_token'], $_GET['oauth_token_secret'] ) && ! empty( $_GET['oauth_token'] ) && ! empty( $_GET['oauth_token_secret'] ) ) {
46
+ $new_oath_token = sanitize_text_field( wp_unslash( $_GET['oauth_token'] ) );
47
+ $new_oauth_token_secret = sanitize_text_field( wp_unslash( $_GET['oauth_token_secret'] ) );
48
+ // Set Returned Access Tokens.
49
+ update_option( 'fts_twitter_custom_access_token', $new_oath_token );
50
+ update_option( 'fts_twitter_custom_access_token_secret', $new_oauth_token_secret );
51
+ }
52
+ }
53
+
54
  /**
55
  * Feed Them Twitter Options Page
56
  *
57
  * @since 1.9.6
58
  */
59
  public function feed_them_twitter_options_page() {
60
+
61
+ // Check if new tokens have been returned.
62
+ $this->set_new_access_tokens();
63
+
64
  ?>
65
  <div class="feed-them-social-admin-wrap">
66
  <h1>
251
  '</div>'
252
  );
253
  }
254
+ // Clear Cache!
255
+ do_action( 'wp_ajax_fts_clear_cache_ajax' );
256
  } else {
257
  echo sprintf(
258
  esc_html( '%1$sTo get started, please click the button above to retrieve your Access Token.%2$s', 'feed-them-social' ),
feed-them.php CHANGED
@@ -7,18 +7,18 @@
7
  * Plugin Name: Feed Them Social (Facebook, Instagram, Twitter, etc)
8
  * Plugin URI: https://feedthemsocial.com/
9
  * Description: Customize feeds for Facebook Pages, Album Photos, Videos & Covers, Instagram, Twitter, Pinterest & YouTube on pages, posts or widgets.
10
- * Version: 2.7.0
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.2
17
- * Stable tag: 2.7.0
18
  * License: GPLv2 or later
19
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
20
  *
21
- * @version 2.7.0
22
  * @package FeedThemSocial/Core
23
  * @copyright Copyright (c) 2012-2019 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.7.0' );
35
 
36
  define( 'FEED_THEM_SOCIAL_NOTICE_STATUS', get_option( 'rating_fts_slick_notice', false ) );
37
 
7
  * Plugin Name: Feed Them Social (Facebook, Instagram, Twitter, etc)
8
  * Plugin URI: https://feedthemsocial.com/
9
  * Description: Customize feeds for Facebook Pages, Album Photos, Videos & Covers, Instagram, Twitter, Pinterest & YouTube on pages, posts or widgets.
10
+ * Version: 2.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.2
17
+ * Stable tag: 2.7.1
18
  * License: GPLv2 or later
19
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
20
  *
21
+ * @version 2.7.1
22
  * @package FeedThemSocial/Core
23
  * @copyright Copyright (c) 2012-2019 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.7.1' );
35
 
36
  define( 'FEED_THEM_SOCIAL_NOTICE_STATUS', get_option( 'rating_fts_slick_notice', false ) );
37
 
feeds/twitter/class-fts-twitter-feed.php CHANGED
@@ -389,6 +389,10 @@ class FTS_Twitter_Feed extends feed_them_social_functions {
389
  } else {
390
  $data_cache = 'twitter_data_cache_' . $name . '_num' . $num_tweets . '';
391
  }
 
 
 
 
392
  // Check Cache.
393
  if ( false !== $this->fts_check_feed_cache_exists( $data_cache ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
394
  $fetched_tweets = $this->fts_get_feed_cache( $data_cache );
@@ -405,9 +409,6 @@ class FTS_Twitter_Feed extends feed_them_social_functions {
405
  $fts_twitter_custom_consumer_key = isset( $fts_twitter_custom_consumer_key ) && '' !== $fts_twitter_custom_consumer_key ? $fts_twitter_custom_consumer_key : $test_fts_twitter_custom_consumer_key;
406
  $fts_twitter_custom_consumer_secret = isset( $fts_twitter_custom_consumer_secret ) && '' !== $fts_twitter_custom_consumer_secret ? $fts_twitter_custom_consumer_secret : $test_fts_twitter_custom_consumer_secret;
407
 
408
- $fts_twitter_custom_access_token = get_option( 'fts_twitter_custom_access_token' );
409
- $fts_twitter_custom_access_token_secret = get_option( 'fts_twitter_custom_access_token_secret' );
410
-
411
  // Use custom api info.
412
  if ( ! empty( $fts_twitter_custom_access_token ) && ! empty( $fts_twitter_custom_access_token_secret ) ) {
413
  $connection = new TwitterOAuthFTS(
@@ -452,6 +453,8 @@ class FTS_Twitter_Feed extends feed_them_social_functions {
452
  $show_retweets = 'false';
453
  }
454
 
 
 
455
  // $url_of_status = !empty($url_of_status) ? $url_of_status : "";.
456
  // $widget_type_for_videos = !empty($widget_type_for_videos) ? $widget_type_for_videos : "";.
457
  if ( ! empty( $search ) ) {
@@ -530,12 +533,13 @@ class FTS_Twitter_Feed extends feed_them_social_functions {
530
  if ( '34' === $fetched_tweets->errors[0]->code ) {
531
  $error_check .= __( ' Please check the Twitter Username you have entered is correct in your shortcode for Feed Them Social.', 'feed-them-social' );
532
  }
 
 
 
533
  } elseif ( empty( $fetched_tweets ) && ! isset( $fetched_tweets->errors ) ) {
 
534
  $error_check = __( ' This account has no tweets. Please Tweet to see this feed. Feed Them Social.', 'feed-them-social' );
535
- } elseif ( null === $connection ) {
536
- $error_check = __( 'No Access Tokens have been set. Please retrieve Twitter API tokens on the Twitter Options page of Feed Them Social.', 'feed-them-social' );
537
  }
538
-
539
  ob_start();
540
 
541
  // IS RATE LIMIT REACHED?
@@ -544,9 +548,14 @@ class FTS_Twitter_Feed extends feed_them_social_functions {
544
  }
545
  // Did the fetch fail?
546
  if ( isset( $error_check ) ) {
547
- echo esc_html( $error_check );
 
 
 
 
 
548
  } else {
549
- if ( ! empty( $fetched_tweets ) ) {
550
 
551
  // Cache It.
552
  if ( ! isset( $cache_used ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
389
  } else {
390
  $data_cache = 'twitter_data_cache_' . $name . '_num' . $num_tweets . '';
391
  }
392
+
393
+ $fts_twitter_custom_access_token = get_option( 'fts_twitter_custom_access_token' );
394
+ $fts_twitter_custom_access_token_secret = get_option( 'fts_twitter_custom_access_token_secret' );
395
+
396
  // Check Cache.
397
  if ( false !== $this->fts_check_feed_cache_exists( $data_cache ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
398
  $fetched_tweets = $this->fts_get_feed_cache( $data_cache );
409
  $fts_twitter_custom_consumer_key = isset( $fts_twitter_custom_consumer_key ) && '' !== $fts_twitter_custom_consumer_key ? $fts_twitter_custom_consumer_key : $test_fts_twitter_custom_consumer_key;
410
  $fts_twitter_custom_consumer_secret = isset( $fts_twitter_custom_consumer_secret ) && '' !== $fts_twitter_custom_consumer_secret ? $fts_twitter_custom_consumer_secret : $test_fts_twitter_custom_consumer_secret;
411
 
 
 
 
412
  // Use custom api info.
413
  if ( ! empty( $fts_twitter_custom_access_token ) && ! empty( $fts_twitter_custom_access_token_secret ) ) {
414
  $connection = new TwitterOAuthFTS(
453
  $show_retweets = 'false';
454
  }
455
 
456
+ $fetched_tweets = array();
457
+
458
  // $url_of_status = !empty($url_of_status) ? $url_of_status : "";.
459
  // $widget_type_for_videos = !empty($widget_type_for_videos) ? $widget_type_for_videos : "";.
460
  if ( ! empty( $search ) ) {
533
  if ( '34' === $fetched_tweets->errors[0]->code ) {
534
  $error_check .= __( ' Please check the Twitter Username you have entered is correct in your shortcode for Feed Them Social.', 'feed-them-social' );
535
  }
536
+ } elseif ( empty( $fts_twitter_custom_access_token ) && empty( $fts_twitter_custom_access_token_secret ) ) {
537
+ // NO Access tokens found.
538
+ $error_check = __( 'No Access Tokens have been set. Please retrieve Twitter API tokens on the Twitter Options page of Feed Them Social.', 'feed-them-social' );
539
  } elseif ( empty( $fetched_tweets ) && ! isset( $fetched_tweets->errors ) ) {
540
+ // No Tweets Found!
541
  $error_check = __( ' This account has no tweets. Please Tweet to see this feed. Feed Them Social.', 'feed-them-social' );
 
 
542
  }
 
543
  ob_start();
544
 
545
  // IS RATE LIMIT REACHED?
548
  }
549
  // Did the fetch fail?
550
  if ( isset( $error_check ) ) {
551
+
552
+ if ( current_user_can( 'administrator' ) ) {
553
+ echo esc_html( $error_check );
554
+ } else {
555
+ echo esc_html__( 'No Tweets available. Login as Admin to see more details.', 'feed-them-social' );
556
+ }
557
  } else {
558
+ if ( isset( $fetched_tweets ) && ! empty( $fetched_tweets ) ) {
559
 
560
  // Cache It.
561
  if ( ! isset( $cache_used ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
includes/feed-them-functions.php CHANGED
@@ -7,1292 +7,1267 @@ namespace feedthemsocial;
7
  * @package feedthemsocial
8
  * @since 1.9.6
9
  */
10
- class feed_them_social_functions
11
- {
12
-
13
- /**
14
- * Construct
15
- *
16
- * Functions constructor.
17
- *
18
- * @since 1.9.6
19
- */
20
- public function __construct ()
21
- {
22
- $root_file = plugin_dir_path( dirname( __FILE__ ) );
23
- $this->premium = str_replace( 'feed-them-social/', 'feed-them-premium/', $root_file );
24
- $this->facebook_carousel_premium = str_replace( 'feed-them-social/', 'feed-them-carousel-premium/', $root_file );
25
- $this->facebook_reviews = str_replace( 'feed-them-social/', 'feed-them-social-facebook-reviews/', $root_file );
26
-
27
- // FTS Activation Function. Commenting out for future use. SRL!
28
- register_deactivation_hook( __FILE__, array($this, 'fts_get_check_plugin_version') );
29
- // Widget Code!
30
- add_filter( 'widget_text', 'do_shortcode' );
31
- // This is for the fts_clear_cache_ajax submission!
32
- if ( 'show-admin-bar-menu' === get_option( 'fts_admin_bar_menu' ) ) {
33
- add_action( 'init', array($this, 'fts_clear_cache_script') );
34
- add_action( 'wp_head', array($this, 'my_fts_ajaxurl') );
35
- add_action( 'wp_ajax_fts_clear_cache_ajax', array($this, 'fts_clear_cache_ajax') );
36
- }
37
- add_action( 'wp_ajax_fts_refresh_token_ajax', array($this, 'fts_refresh_token_ajax') );
38
- add_action( 'wp_ajax_fts_instagram_token_ajax', array($this, 'fts_instagram_token_ajax') );
39
-
40
- 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' ) ) {
41
- // Load More Options!
42
- add_action( 'wp_ajax_my_fts_fb_load_more', array($this, 'my_fts_fb_load_more') );
43
- add_action( 'wp_ajax_nopriv_my_fts_fb_load_more', array($this, 'my_fts_fb_load_more') );
44
- add_action( 'wp_ajax_my_fts_fb_options_page_load_more', array($this, 'my_fts_fb_options_page_load_more') );
45
- }
46
-
47
- add_shortcode( 'fts_fb_page_token', array($this, 'fts_fb_page_token_func') );
48
- }
49
-
50
- /**
51
- * Init
52
- *
53
- * For Loading in the Admin.
54
- *
55
- * @since 1.9.6
56
- */
57
- public function init ()
58
- {
59
- if ( is_admin() ) {
60
- // Register Settings!
61
- add_action( 'admin_init', array($this, 'fts_settings_page_register_settings') );
62
- add_action( 'admin_init', array($this, 'fts_facebook_style_options_page') );
63
- add_action( 'admin_init', array($this, 'fts_twitter_style_options_page') );
64
- add_action( 'admin_init', array($this, 'fts_instagram_style_options_page') );
65
- add_action( 'admin_init', array($this, 'fts_pinterest_style_options_page') );
66
- add_action( 'admin_init', array($this, 'fts_youtube_style_options_page') );
67
-
68
- // Adds setting page to FTS menu!
69
- add_action( 'admin_menu', array($this, 'feed_them_main_menu') );
70
- add_action( 'admin_menu', array($this, 'feed_them_submenu_pages') );
71
- // THIS GIVES US SOME OPTIONS FOR STYLING THE ADMIN AREA!
72
- add_action( 'admin_enqueue_scripts', array($this, 'feed_them_admin_css') );
73
- // Main Settings Page!
74
- if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-facebook-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-twitter-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-instagram-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-pinterest-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-youtube-feed-styles-submenu-page' === $_GET['page'] ) {
75
- add_action( 'admin_enqueue_scripts', array($this, 'feed_them_settings') );
76
- }
77
- // System Info Page!
78
- if ( isset( $_GET['page'] ) && 'fts-system-info-submenu-page' === $_GET['page'] ) {
79
- add_action( 'admin_enqueue_scripts', array($this, 'feed_them_system_info_css') );
80
- }
81
- // FTS License Page!
82
- if ( isset( $_GET['page'] ) && 'fts-license-page' === $_GET['page'] ) {
83
- add_action( 'admin_footer', array($this, 'fts_plugin_license') );
84
- }
85
- }
86
-
87
- // FTS Admin Bar!
88
- add_action( 'wp_before_admin_bar_render', array($this, 'fts_admin_bar_menu'), 999 );
89
- // Settings option. Add Custom CSS to the header of FTS pages only!
90
- $fts_include_custom_css_checked_css = get_option( 'fts-color-options-settings-custom-css' );
91
- if ( '1' === $fts_include_custom_css_checked_css ) {
92
- add_action( 'wp_enqueue_scripts', array($this, 'fts_color_options_head_css') );
93
- }
94
- // Facebook Settings option. Add Custom CSS to the header of FTS pages only!
95
- $fts_include_fb_custom_css_checked_css = '1';
96
- if ( '1' === $fts_include_fb_custom_css_checked_css ) {
97
- add_action( 'wp_enqueue_scripts', array($this, 'fts_fb_color_options_head_css') );
98
- }
99
- // Settings option. Custom Powered by Feed Them Social Option!
100
- $fts_powered_text_options_settings = get_option( 'fts-powered-text-options-settings' );
101
- if ( '1' !== $fts_powered_text_options_settings ) {
102
- add_action( 'wp_enqueue_scripts', array($this, 'fts_powered_by_js') );
103
- }
104
-
105
- if ( is_plugin_active( 'jetpack/jetpack.php' ) ) {
106
- add_filter( 'jetpack_photon_skip_image', array($this, 'fts_jetpack_photon_exception'), 10, 3 );
107
- }
108
- }
109
-
110
- /**
111
- * FTS Instagram Token Ajax
112
- *
113
- * This will save the returned token to the database.
114
- *
115
- * @since 2.3.3
116
- */
117
- public function fts_instagram_token_ajax ()
118
- {
119
-
120
- $fts_refresh_token_nonce = wp_create_nonce( 'fts_token_nonce' );
121
- $access_token = $_REQUEST['access_token'];
122
- if ( wp_verify_nonce( $fts_refresh_token_nonce, 'fts_token_nonce' ) ) {
123
- if ( isset( $access_token ) ) {
124
- update_option( 'fts_instagram_custom_api_token', sanitize_text_field( $access_token ) );
125
- $insta_id = substr( $access_token, 0, strpos( $access_token, "." ) );
126
- update_option( 'fts_instagram_custom_id', sanitize_text_field( $insta_id ) );
127
- }
128
- }
129
- die;
130
- }
131
-
132
- /**
133
- * Feed Them Instagram Save Token
134
- *
135
- * FTS Check and Save Instagram Token Validity.
136
- *
137
- * @return bool
138
- * @since 2.6.1
139
- */
140
- public function feed_them_instagram_save_token ()
141
- {
142
-
143
- $fts_refresh_token_nonce = wp_create_nonce( 'access_token' );
144
-
145
- if ( wp_verify_nonce( $fts_refresh_token_nonce, 'access_token' ) ) {
146
-
147
- $auth_obj = $_GET['access_token'];
148
-
149
- if ( isset( $auth_obj ) ) {
150
- ?>
151
- <script>
152
- jQuery(document).ready(function () {
153
- var access_token = '<?php echo sanitize_text_field( $auth_obj ) ?>';
154
- jQuery.ajax({
155
- data: {
156
- action: 'fts_instagram_token_ajax',
157
- access_token: access_token,
158
- },
159
- type: 'POST',
160
- url: ftsAjax.ajaxurl,
161
- success: function (response) {
162
- <?php
163
- $auth_obj = $_GET['access_token'];
164
- $insta_url = esc_url( 'https://api.instagram.com/v1/users/self/?access_token=' . $auth_obj );
165
- // Get Data for Instagram to check for errors
166
- $response = wp_remote_fopen( $insta_url );
167
- $test_app_token_response = json_decode( $response );
168
-
169
- // if the combined streams plugin is active we won't allow the settings page link to open up the Instagram Feed, instead we'll remove the #feed_type=instagram and just let the user manually select the combined streams or single instagram feed.
170
- if ( is_plugin_active( 'feed-them-social-combined-streams/feed-them-social-combined-streams.php' ) ) {
171
- $custom_instagram_link_hash = '';
172
- } else {
173
- $custom_instagram_link_hash = '#feed_type=instagram';
174
- }
175
- if ( !isset( $test_app_token_response->meta->error_message ) && !isset( $test_app_token_response->error_message ) || isset( $test_app_token_response->meta->error_message ) && 'This client has not been approved to access this resource.' === $test_app_token_response->meta->error_message ) {
176
- $fts_instagram_message = sprintf(
177
- esc_html( '%1$sYour access token is working! Generate your shortcode on the %2$sSettings Page%3$s', 'feed-them-social' ),
178
- '<div class="fts-successful-api-token">',
179
- '<a href="' . esc_url( 'admin.php?page=feed-them-settings-page' . $custom_instagram_link_hash ) . '">',
180
- '</a></div>'
181
- );
182
- ?>
183
- jQuery('.fts-failed-api-token').hide();
184
- if (!jQuery('.fts-successful-api-token').length) {
185
- jQuery('.fts-instagram-last-row').append('<?php echo $fts_instagram_message; ?>');
186
- }
187
- jQuery('.fts-success').show();
188
- <?php
189
- } elseif ( isset( $test_app_token_response->meta->error_message ) || isset( $test_app_token_response->error_message ) ) {
190
- $text = isset( $test_app_token_response->meta->error_message ) ? $test_app_token_response->meta->error_message : $test_app_token_response->error_message;
191
- $fts_instagram_message = sprintf(
192
- esc_html( '%1$sOh No something\'s wrong. %2$s. Please try clicking the button again to get a new access token. If you need additional assistance please email us at support@slickremix.com %3$s.', 'feed-them-social' ),
193
- '<div class="fts-failed-api-token">',
194
- esc_html( $text ),
195
- '</div>'
196
- );
197
- ?>
198
- if (jQuery('.fts-failed-api-token').length) {
199
- jQuery('.fts-failed-api-token').hide();
200
- jQuery('.fts-instagram-last-row').append('<?php echo $fts_instagram_message; ?>');
201
- }
202
- <?php
203
- }
204
- ?>
205
- }
206
- }); // end of ajax()
207
- return false;
208
- }); // end of document.ready
209
- </script>
210
- <?php
211
- }
212
- }
213
- }
214
-
215
- /**
216
- * FTS JetPack Photon Option Exception
217
- *
218
- * This function resolves issues with images and JetPack
219
- *
220
- * @param string $val value.
221
- * @param string $src source.
222
- * @param string $tag tag.
223
- * @return bool
224
- * @since @since 1.9.6
225
- */
226
- public function fts_jetpack_photon_exception ($val, $src, $tag)
227
- {
228
- if ( strpos( $src, 'fbcdn.net' ) ) {
229
- return true;
230
- }
231
- return $val;
232
- }
233
-
234
- /**
235
- * FTS Share Option
236
- *
237
- * @param string $fb_link link for social network.
238
- * @param string $description description field for some of the social networks.
239
- * @since
240
- */
241
- public function fts_share_option ($fb_link, $description)
242
- {
243
-
244
- $hide_share = get_option( 'fts_disable_share_button', true ) ? get_option( 'fts_disable_share_button', true ) : '';
245
-
246
- if ( isset( $hide_share ) && '1' !== $hide_share ) {
247
- // Social media sharing URLs
248
- $link = $fb_link;
249
- $description = wp_strip_all_tags( $description );
250
- $ft_gallery_share_linkedin = 'https://www.linkedin.com/shareArticle?mini=true&url=' . $link;
251
- $ft_gallery_share_email = 'mailto:?subject=Shared Link&body=' . $link . ' - ' . $description;
252
- $ft_gallery_share_facebook = 'https://www.facebook.com/sharer/sharer.php?u=' . $link;
253
- $ft_gallery_share_twitter = 'https://twitter.com/intent/tweet?text=' . $link . '+' . $description;
254
- $ft_gallery_share_google = 'https://plus.google.com/share?url=' . $link;
255
-
256
- // The share wrap and links
257
- $output = '<div class="fts-share-wrap">';
258
- $output .= '<a href="javascript:;" class="ft-gallery-link-popup">' . esc_html( '', 'feed-them-social' ) . '</a>';
259
- $output .= '<div class="ft-gallery-share-wrap">';
260
- $output .= '<a href="' . esc_attr( $ft_gallery_share_facebook ) . '" target="_blank" class="ft-galleryfacebook-icon"><i class="fa fa-facebook-square"></i></a>';
261
- $output .= '<a href="' . esc_attr( $ft_gallery_share_twitter ) . '" target="_blank" class="ft-gallerytwitter-icon"><i class="fa fa-twitter"></i></a>';
262
- $output .= '<a href="' . esc_attr( $ft_gallery_share_google ) . '" target="_blank" class="ft-gallerygoogle-icon"><i class="fa fa-google-plus"></i></a>';
263
- $output .= '<a href="' . esc_attr( $ft_gallery_share_linkedin ) . '" target="_blank" class="ft-gallerylinkedin-icon"><i class="fa fa-linkedin"></i></a>';
264
- $output .= '<a href="' . esc_attr( $ft_gallery_share_email ) . '" target="_blank" class="ft-galleryemail-icon"><i class="fa fa-envelope"></i></a>';
265
- $output .= '</div>';
266
- $output .= '</div>';
267
- return $output;
268
- }
269
- }
270
-
271
- /**
272
- * FTS FB Options Page Function
273
- *
274
- * Display FB Page tokens for users
275
- *
276
- * @return mixed
277
- * @since 2.1.4
278
- */
279
- public function fts_fb_page_token_func ()
280
- {
281
- $fts_fb_page_token_users_nonce = wp_create_nonce( 'fts-fb-page-token-users-nonce' );
282
-
283
- if ( wp_verify_nonce( $fts_fb_page_token_users_nonce, 'fts-fb-page-token-users-nonce' ) ) {
284
-
285
- // Make sure it's not ajaxing!
286
- if ( !isset( $_GET['load_more_ajaxing'] ) ) {
287
- $_REQUEST['fts_dynamic_name'] = sanitize_key( $this->feed_them_social_rand_string() );
288
- } //End make sure it's not ajaxing!
289
-
290
- ob_start();
291
-
292
- if ( !isset( $_GET['locations'] ) ) {
293
- $fb_token_response = isset( $_REQUEST['next_url'] ) ? wp_remote_fopen( esc_url_raw( $_REQUEST['next_url'] ) ) : 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['access_token'] . '&limit=25' );
294
- $test_fb_app_token_response = json_decode( $fb_token_response );
295
- $_REQUEST['next_url'] = isset( $test_fb_app_token_response->paging->next ) ? esc_url_raw( $test_fb_app_token_response->paging->next ) : '';
296
- } else {
297
- $fb_token_response = isset( $_REQUEST['next_location_url'] ) ? wp_remote_fopen( esc_url_raw( $_REQUEST['next_location_url'] ) ) : '';
298
- $test_fb_app_token_response = json_decode( $fb_token_response );
299
- }
300
-
301
- // echo '<pre>';
302
- // echo _r($test_fb_app_token_response);
303
- // echo '</pre>';
304
- // Make sure it's not ajaxing!
305
- if ( !isset( $_GET['load_more_ajaxing'] ) ) {
306
- // ******************
307
- // Load More BUTTON Start
308
- // ******************
309
- ?>
310
- <div class="fts-clear"></div>
311
- <?php
312
- } //End make sure it's not ajaxing!
313
-
314
- $build_shortcode = 'fts_fb_page_token';
315
-
316
- // Make sure it's not ajaxing!
317
- if (!isset( $_GET['load_more_ajaxing'] )) {
318
-
319
- $reviews_token = isset( $_GET['reviews_token'] ) ? 'yes' : 'no';
320
- ?>
321
- <div id="fb-list-wrap">
322
- <div class="fts-pages-info"> <?php echo esc_html( 'Click on a page in the list below and it will add the Page ID and Access Token above, then click save.', 'feed-them-social' ); ?></div>
323
- <ul class="fb-page-list fb-page-master-list">
324
- <?php
325
- } //End make sure it's not ajaxing!
326
-
327
- foreach ( $test_fb_app_token_response->data as $data ) {
328
- ?>
329
- <li class="fts-fb-main-page-li">
330
- <div class="fb-click-wrapper">
331
- <div class="fb-image">
332
- <img border="0" height="50" width="50"
333
- src="<?php echo esc_url( 'https://graph.facebook.com/' . $data->id . '/picture' ); ?>"/>
334
- </div>
335
- <div class="fb-name-wrap"><span class="fb-name">
336
- <?php
337
- echo esc_html( $data->name );
338
- if ( isset( $data->store_number, $data->store_location_descriptor ) ) {
339
- print '(' . $data->store_location_descriptor . ')';
340
- }
341
- ?>
342
  </span></div>
343
- <div class="fb-other-wrap">
344
- <small>
345
- <?php echo esc_html( 'ID: ', 'feed-them-social' ); ?>
346
- <span class="fts-api-facebook-id"><?php echo esc_html( $data->id ); ?></span>
347
- <?php echo isset( $data->store_number ) ? esc_html( '| Location: ' . $data->store_number, 'feed-them-social' ) : ''; ?>
348
- </small>
349
- </div>
350
- <div class="page-token"><?php echo esc_attr( $data->access_token ); ?></div>
351
- <?php
352
- $facebook_input_token = get_option( 'fts_facebook_custom_api_token' );
353
- $facebook_access_token = $data->access_token;
354
- if ( $facebook_input_token === $facebook_access_token ) {
355
- ?>
356
- <div class="feed-them-social-admin-submit-btn " style="display: block !important;">
357
- Active
358
- </div>
359
- <?php } else { ?>
360
- <div class="feed-them-social-admin-submit-btn fts-token-save">Save</div>
361
- <?php } ?>
362
- <div class="fts-clear"></div>
363
- </div>
364
- <?php
365
- $_REQUEST['next_location_url'] = isset( $data->locations->paging->next ) ? esc_url_raw( $data->locations->paging->next ) : '';
366
- $remove_class_or_not = isset( $data->locations->paging->next ) ? 'fb-sublist-page-id-' . esc_attr( $data->id ) : '';
367
- if ( isset( $data->locations->data ) ) {
368
- $location_count = count( $data->locations->data );
369
- $location_plus_sign = isset( $data->locations->paging->next ) ? '+' : '';
370
- $location_text = 1 === $location_count ? esc_html( $location_count . ' ' . esc_html( 'Location for', 'feed-them-social' ) ) : esc_html( $location_count . $location_plus_sign . ' ' . esc_html( 'Locations for', 'feed-them-social' ) );
371
- // if the locations equal 3 or less we will set the location container height to auto so the scroll loadmore does not fire.
372
- $location_scroll_loadmore_needed_check = $location_count <= 3 ? 'height:auto !important' : 'height: 200px !important;';
373
- }
374
-
375
- if ( !isset( $_GET['locations'] ) && isset( $data->locations->data ) ) {
376
- ?>
377
- <div class="fts-fb-location-text-wrap"><?php echo esc_html( $location_text . ' ' . $data->name ); ?></div>
378
- <ul class="fb-page-list fb-sublist <?php echo esc_attr( $remove_class_or_not ); ?>"
379
- style="<?php echo esc_attr( $location_scroll_loadmore_needed_check ); ?>">
380
- <?php foreach ( $data->locations->data as $location ) { ?>
381
- <li>
382
- <div class="fb-click-wrapper">
383
- <div class="fb-image">
384
- <img border="0" height="50" width="50"
385
- src="<?php echo esc_url( 'https://graph.facebook.com/' . $location->id . '/picture' ); ?>"/>
386
- </div>
387
- <div class="fb-name-wrap"><span
388
- class="fb-name"><?php echo esc_html( $location->name ); ?>
389
- <?php
390
- if ( isset( $location->store_location_descriptor ) ) {
391
- echo '(' . esc_html( $location->store_location_descriptor ) . ')';
392
- }
393
- ?>
394
  </span></div>
395
- <div class="fb-other-wrap">
396
- <small>
397
- <?php echo esc_html( 'ID: ', 'feed-them-social' ); ?>
398
- <span class="fts-api-facebook-id"><?php echo esc_html( $location->id ); ?></span>
399
- <?php
400
- if ( isset( $location->store_number ) ) {
401
- print '| ';
402
- esc_html( 'Location:', 'feed-them-social' );
403
- print ' ' . esc_html( $location->store_number );
404
- }
405
- ?>
406
- </small>
407
- </div>
408
-
409
- <div class="page-token"><?php echo esc_html( $location->access_token ); ?></div>
410
- <?php
411
- $facebook_input_token = get_option( 'fts_facebook_custom_api_token' );
412
- $facebook_access_token = $location->access_token;
413
- if ( $facebook_input_token === $facebook_access_token ) {
414
- ?>
415
- <div class="feed-them-social-admin-submit-btn "
416
- style="display: block !important;">Active
417
- </div>
418
- <?php } else { ?>
419
- <div class="feed-them-social-admin-submit-btn fts-token-save">Save
420
- </div>
421
- <?php } ?>
422
- <div class="fts-clear"></div>
423
- </div>
424
- </li>
425
- <?php } ?>
426
- </ul>
427
-
428
- <?php
429
- // Make sure it's not ajaxing locations!
430
- if ( !isset( $_GET['locations'] ) && isset( $data->locations->paging->next ) ) {
431
- echo '<div id="loadMore_' . esc_attr( $data->id ) . '_location" class="fts-fb-load-more" style="background:none !Important;">' . esc_html( 'Scroll to view more Locations', 'feed-them-instagram' ) . '</div>';
432
- }//End Check
433
-
434
- // Make sure it's not ajaxing locations!
435
- if (!isset( $_GET['locations'] )) {
436
- $time = time();
437
- $nonce = wp_create_nonce( $time . 'load-more-nonce' );
438
- $fb_page_id = $data->id;
439
- ?>
440
- <script>
441
- jQuery(document).ready(function () {
442
- jQuery(".fb-sublist-page-id-<?php echo esc_js( $fb_page_id ); ?>").bind("scroll", function () {
443
- if (jQuery(this).scrollTop() + jQuery(this).innerHeight() >= jQuery(this)[0].scrollHeight) {
444
- if (!jQuery('.fts-no-more-locations-<?php echo esc_js( $fb_page_id ); ?>').length) {
445
- jQuery("#loadMore_<?php echo esc_js( $fb_page_id ); ?>_location").addClass('fts-fb-spinner');
446
- var button = jQuery('#loadMore_<?php echo esc_js( $fb_page_id ); ?>_location').html('<div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div>');
447
- console.log(button);
448
- var build_shortcode = "<?php echo esc_js( $build_shortcode ); ?>";
449
- var yes_ajax = "yes";
450
- var fts_d_name = "<?php echo esc_js( $fb_page_id ); ?>";
451
- var fts_security = "<?php echo esc_js( $nonce ); ?>";
452
- var fts_time = "<?php echo esc_js( $time ); ?>";
453
- var fts_reviews_feed = "<?php echo esc_js( $reviews_token ); ?>";
454
- jQuery.ajax({
455
- data: {
456
- action: "my_fts_fb_load_more",
457
- next_location_url: nextURL_location_<?php echo esc_js( $fb_page_id ); ?>,
458
- fts_dynamic_name: fts_d_name,
459
- rebuilt_shortcode: build_shortcode,
460
- load_more_ajaxing: yes_ajax,
461
- fts_security: fts_security,
462
- fts_time: fts_time,
463
- feed_name: build_shortcode,
464
- fts_reviews_feed: fts_reviews_feed,
465
- locations: 'yes'
466
- },
467
- type: 'GET',
468
- url: ajaxurl,
469
- success: function (data) {
470
- console.log('Well Done and got this from sever: ' + data);
471
- jQuery('.fb-sublist-page-id-<?php echo esc_js( $fb_page_id ); ?>').append(data).filter('.fb-sublist-page-id-<?php echo esc_js( $fb_page_id ); ?>').html();
472
- jQuery('.fb-sublist-page-id-<?php echo esc_js( $fb_page_id ); ?>').animate({scrollTop: '+=100px'}, 800); // scroll down a 100px after new items are added
473
-
474
-
475
-
476
- <?php if ( isset( $data->locations->paging->next ) && $data->locations->paging->next === $_REQUEST['next_location_url'] ) { ?>
477
- jQuery('#loadMore_<?php echo esc_js( $fb_page_id ); ?>_location').replaceWith('<div class="fts-fb-load-more no-more-posts-fts-fb fts-no-more-locations-<?php echo esc_js( $fb_page_id ); ?>" style="background:none !important"><?php echo esc_html( 'All Locations loaded', 'feed-them-social' ); ?></div>');
478
- jQuery('#loadMore_<?php echo esc_js( $fb_page_id ); ?>_location').removeAttr('id');
479
- <?php } ?>
480
- jQuery("#loadMore_<?php echo esc_js( $fb_page_id ); ?>_location").removeClass('fts-fb-spinner');
481
- }
482
- }); // end of ajax()
483
- return false;
484
-
485
- } //stop ajax from submitting again if the fts-no-more-locations class is found
486
-
487
- }
488
- }); // end of form.submit
489
-
490
- }); // end of document.ready
491
- </script>
492
- <?php
493
- } //END Make sure it's not ajaxing locations
494
- ?>
495
- <script>var nextURL_location_<?php echo esc_js( $fb_page_id ); ?>= "<?php echo isset( $data->locations->paging->next ) ? esc_url_raw( $data->locations->paging->next ) : ''; ?>";</script>
496
- <?php } ?>
497
- </li>
498
-
499
- <?php
500
- } // foreach loop of locations
501
-
502
- // Make sure it's not ajaxing!
503
- if (!isset( $_GET['load_more_ajaxing'] )) {
504
- ?>
505
- </ul>
506
- <div class="fts-clear"></div>
507
- </div>
508
- <?php
509
- } //End make sure it's not ajaxing
510
-
511
- // Make sure it's not ajaxing!
512
- if ( !isset( $_GET['load_more_ajaxing'] ) && !isset( $_GET['locations'] ) ) {
513
- $fts_dynamic_name = isset( $_REQUEST['fts_dynamic_name'] ) ? sanitize_key( $_REQUEST['fts_dynamic_name'] ) : '';
514
- $time = time();
515
- $nonce = wp_create_nonce( $time . 'load-more-nonce' );
516
- ?>
517
- <script>
518
- jQuery(document).ready(function () {
519
-
520
- jQuery("#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>").click(function () {
521
-
522
- jQuery("#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>").addClass('fts-fb-spinner');
523
- var button = jQuery('#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>').html('<div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div>');
524
- console.log(button);
525
- var build_shortcode = "<?php echo esc_js( $build_shortcode ); ?>";
526
- var yes_ajax = "yes";
527
- var fts_d_name = "<?php echo esc_js( $fts_dynamic_name ); ?>";
528
- var fts_security = "<?php echo esc_js( $nonce ); ?>";
529
- var fts_time = "<?php echo esc_js( $time ); ?>";
530
- var fts_reviews_feed = "<?php echo esc_js( $reviews_token ); ?>";
531
- jQuery.ajax({
532
- data: {
533
- action: "my_fts_fb_load_more",
534
- next_url: nextURL_<?php echo esc_js( $fts_dynamic_name ); ?>,
535
- fts_dynamic_name: fts_d_name,
536
- rebuilt_shortcode: build_shortcode,
537
- load_more_ajaxing: yes_ajax,
538
- fts_security: fts_security,
539
- fts_time: fts_time,
540
- feed_name: build_shortcode,
541
- fts_reviews_feed: fts_reviews_feed
542
- },
543
- type: 'GET',
544
- url: ajaxurl,
545
- success: function (data) {
546
- console.log('Well Done and got this from sever: ' + data);
547
- jQuery('.fb-page-master-list').append(data).filter('.fb-page-list').html();
548
-
549
- if (!nextURL_<?php echo esc_js( sanitize_text_field( wp_unslash( $_REQUEST['fts_dynamic_name'] ) ) ); ?> || 'no more' === nextURL_<?php echo esc_js( sanitize_text_field( wp_unslash( $_REQUEST['fts_dynamic_name'] ) ) ); ?>) {
550
- 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( 'No More Pages', 'feed-them-social' ); ?></div>');
551
- jQuery('#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>').removeAttr('id');
552
- }
553
- jQuery('#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>').html('<?php echo esc_js( 'Load More', 'feed-them-social' ); ?>');
554
- // jQuery('#loadMore_< ?php echo $fts_dynamic_name ?>').removeClass('flip360-fts-load-more');
555
- jQuery("#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>").removeClass('fts-fb-spinner');
556
-
557
-
558
- }
559
- }); // end of ajax()
560
- return false;
561
- }); // end of form.submit
562
- }); // end of document.ready
563
- </script>
564
- <?php
565
-
566
- } //END Make sure it's not ajaxing
567
- ?>
568
- <script>
569
- <?php if ( !isset( $_GET['locations'] ) ) { ?>
570
- var nextURL_<?php echo esc_js( sanitize_text_field( wp_unslash( $_REQUEST['fts_dynamic_name'] ) ) ); ?>= "<?php echo esc_url_raw( $_REQUEST['next_url'] ); ?>";
571
- // alert('nextURL_<?php echo esc_js( sanitize_text_field( wp_unslash( $_REQUEST['fts_dynamic_name'] ) ) ); ?>');
572
- <?php } ?>
573
-
574
-
575
- if (document.querySelector('#fts-fb-token-wrap .fts-pages-info') !== null) {
576
- jQuery(".fts-successful-api-token.default-token").hide();
577
- }
578
- <?php if ( 'yes' === $reviews_token || isset( $_GET['fts_reviews_feed'] ) && 'yes' === $_GET['fts_reviews_feed'] ) { ?>
579
- if (document.querySelector('.default-token') !== null) {
580
- jQuery(".default-token").show();
581
- }
582
-
583
- <?php } ?>
584
-
585
- jQuery(document).ready(function ($) {
586
- $(".feed-them-social-admin-submit-btn").click(function () {
587
- // alert('test');
588
- var newUrl = "<?php echo esc_url( admin_url( 'admin.php?page=fts-facebook-feed-styles-submenu-page/' ) ); ?>";
589
- history.replaceState({}, null, newUrl);
590
- $("#fts-facebook-feed-options-form").submit();
591
- });
592
-
593
- var fb = ".fb-page-list .fb-click-wrapper";
594
- $('#fb-list-wrap').show();
595
- //alert("reviews_token");
596
-
597
- $(fb).click(function () {
598
- var fb_page_id = $(this).find('.fts-api-facebook-id').html();
599
- var token = $(this).find('.page-token').html();
600
- // alert(token);
601
- var name = $(this).find('.fb-name').html();
602
- <?php if ( 'no' === $reviews_token || isset( $_GET['fts_reviews_feed'] ) && 'no' === $_GET['fts_reviews_feed'] ) { ?>
603
- $("#fts_facebook_custom_api_token").val(token);
604
- $("#fts_facebook_custom_api_token_user_id").val(fb_page_id);
605
- $("#fts_facebook_custom_api_token_user_name").val(name);
606
- <?php } else { ?>
607
- $("#fts_facebook_custom_api_token_biz").val(token);
608
- $("#fts_facebook_custom_api_token_user_id_biz").val(fb_page_id);
609
- $("#fts_facebook_custom_api_token_user_name_biz").val(name);
610
- <?php } ?>
611
- $('.fb-page-list .feed-them-social-admin-submit-btn').hide();
612
- $(this).find('.feed-them-social-admin-submit-btn').toggle();
613
- // alert(name + token)
614
- })
615
- });
616
- </script>
617
- <?php
618
- // Make sure it's not ajaxing!
619
- if ( !isset( $_GET['load_more_ajaxing'] ) && isset( $test_fb_app_token_response->paging->next ) && !isset( $_GET['locations'] ) ) {
620
- $fts_dynamic_name = sanitize_key( $_REQUEST['fts_dynamic_name'] );
621
- echo '<div class="fts-clear"></div>';
622
-
623
- echo '<div id="loadMore_' . esc_attr( $fts_dynamic_name ) . '" class="fts-fb-load-more">' . esc_html( 'Load More', 'feed-them-social' ) . '</div>';
624
- }//End make sure it's not ajaxing
625
-
626
- // Lastly if we can't find a next url we unset the next url from the page to not let the loadmore button be active.
627
- if ( isset( $_GET['locations'] ) ) {
628
- unset( $_REQUEST['next_location_url'] );
629
- } else {
630
- unset( $_REQUEST['next_url'] );
631
- }
632
- return ob_get_clean();
633
- }
634
- exit;
635
- }
636
-
637
-
638
- /**
639
- * My FTS Plugin License
640
- *
641
- * Put in place to only show the Activate Plugin license if the input has a value
642
- *
643
- * @since 2.1.4
644
- */
645
- public function fts_plugin_license ()
646
- {
647
- wp_enqueue_script( 'jquery' );
648
- ?>
649
- <style>.fts-license-master-form th {
650
- background: #f9f9f9;
651
- padding: 14px;
652
- border-bottom: 1px solid #ccc;
653
- margin: -14px -14px 20px;
654
- width: 100%;
655
- display: block
656
- }
657
-
658
- .fts-license-master-form .form-table tr {
659
- float: left;
660
- margin: 0 15px 15px 0;
661
- background: #fff;
662
- border: 1px solid #ccc;
663
- width: 30.5%;
664
- max-width: 350px;
665
- padding: 14px;
666
- min-height: 220px;
667
- position: relative;
668
- box-sizing: border-box
669
- }
670
-
671
- .fts-license-master-form .form-table td {
672
- padding: 0;
673
- display: block
674
- }
675
-
676
- .fts-license-master-form td input.regular-text {
677
- margin: 0 0 8px;
678
- width: 100%
679
- }
680
-
681
- .fts-license-master-form .edd-license-data[class*=edd-license-] {
682
- position: absolute;
683
- background: #fafafa;
684
- padding: 14px;
685
- border-top: 1px solid #eee;
686
- margin: 20px -14px -14px;
687
- min-height: 67px;
688
- width: 100%;
689
- bottom: 14px;
690
- box-sizing: border-box
691
- }
692
-
693
- .fts-license-master-form .edd-license-data p {
694
- font-size: 13px;
695
- margin-top: 0
696
- }
697
-
698
- .fts-license-master-form tr {
699
- display: none
700
- }
701
-
702
- .fts-license-master-form tr.fts-license-wrap {
703
- display: block
704
- }
705
-
706
- .fts-license-master-form .edd-license-msg-error {
707
- background: rgba(255, 0, 0, 0.49)
708
- }
709
-
710
- .fts-license-master-form tr.fts-license-wrap {
711
- display: block
712
- }
713
-
714
- .fts-license-master-form .edd-license-msg-error {
715
- background: #e24e4e !important;
716
- color: #FFF
717
- }
718
-
719
- .fts-license-wrap .edd-license-data p {
720
- color: #1e981e
721
- }
722
-
723
- .edd-license-msg-error p {
724
- color: #FFF !important
725
- }
726
-
727
- .feed-them_page_fts-license-page .button-secondary {
728
- display: none;
729
- }</style>
730
- <script type="text/javascript">
731
- jQuery(document).ready(function () {
732
- if (jQuery('#feed_them_social_premium_license_key').val() !== '') {
733
- jQuery('#feed_them_social_premium_license_key').next('label').find('.button-secondary').show()
734
- }
735
- if (jQuery('#feed_them_social_combined_streams_license_key').val() !== '') {
736
- jQuery('#feed_them_social_combined_streams_license_key').next('label').find('.button-secondary').show()
737
- }
738
- if (jQuery('#feed-them-social-facebook-reviews_license_key').val() !== '') {
739
- jQuery('#feed-them-social-facebook-reviews_license_key').next('label').find('.button-secondary').show()
740
- }
741
- if (jQuery('#fts_bar_license_key').val() !== '') {
742
- jQuery('#fts_bar_license_key').next('label').find('.button-secondary').show()
743
- }
744
- if (jQuery('#feed_them_carousel_premium_license_key').val() !== '') {
745
- jQuery('#feed_them_carousel_premium_license_key').next('label').find('.button-secondary').show()
746
- }
747
- });
748
- </script>
749
- <?php
750
- }
751
-
752
- /**
753
- * My FTS Ajaxurl
754
- *
755
- * Ajax var on front end for twitter videos and loadmore button (if premium active.
756
- *
757
- * @since 1.9.6
758
- */
759
- public function my_fts_ajaxurl ()
760
- {
761
- wp_enqueue_script( 'jquery' );
762
- }
763
-
764
- /**
765
- * My FTS FB Load More
766
- *
767
- * This function is being called from the fb feed... it calls the ajax in this case.
768
- *
769
- * @since 1.9.6
770
- * @updated 2.1.4 (fts_fb_page_token)
771
- */
772
- public function my_fts_fb_load_more ()
773
- {
774
- if ( isset( $_REQUEST['fts_security'], $_REQUEST['fts_time'] ) && !wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['fts_security'] ) ), sanitize_text_field( wp_unslash( $_REQUEST['fts_time'] ) ) . 'load-more-nonce' ) ) {
775
- exit( 'Sorry, You can\'t do that!' );
776
- } else {
777
-
778
- if ( isset( $_REQUEST['feed_name'] ) && 'fts_fb_page_token' === $_REQUEST['feed_name'] ) {
779
- if ( isset( $_REQUEST['next_url'] ) && false === strpos( sanitize_text_field( wp_unslash( $_REQUEST['next_url'] ) ), 'https://graph.facebook.com/v3.1' ) ||
780
- isset( $_REQUEST['next_location_url'] ) && false === strpos( sanitize_text_field( wp_unslash( $_REQUEST['next_location_url'] ) ), 'https://graph.facebook.com/v3.1' ) ||
781
- isset( $_REQUEST['next_url'] ) && sanitize_text_field( wp_unslash( $_REQUEST['next_url'] ) ) !== sanitize_text_field( wp_unslash( $_REQUEST['next_url'] ) ) ||
782
- isset( $_REQUEST['next_location_url'] ) && sanitize_text_field( wp_unslash( $_REQUEST['next_location_url'] ) ) !== sanitize_text_field( wp_unslash( $_REQUEST['next_location_url'] ) ) ) {
783
-
784
- exit( 'That is not an FTS shortcode!' );
785
- }
786
- }
787
-
788
- if ( isset( $_REQUEST['feed_name'] ) && 'fts_fb_page_token' === $_REQUEST['feed_name'] ||
789
- isset( $_REQUEST['feed_name'] ) && 'fts_twitter' === $_REQUEST['feed_name'] ||
790
- isset( $_REQUEST['feed_name'] ) && 'fts_youtube' === $_REQUEST['feed_name'] ||
791
- isset( $_REQUEST['feed_name'] ) && 'fts_facebook' === $_REQUEST['feed_name'] ||
792
- isset( $_REQUEST['feed_name'] ) && 'fts_facebookbiz' === $_REQUEST['feed_name'] ||
793
- isset( $_REQUEST['feed_name'] ) && 'fts_instagram' === $_REQUEST['feed_name'] ) {
794
-
795
- $feed_atts = isset( $_REQUEST['feed_attributes'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['feed_attributes'] ) ) : '';
796
-
797
- $build_shortcode = '[' . sanitize_text_field( wp_unslash( $_REQUEST['feed_name'] ) ) . '';
798
- foreach ( $feed_atts as $attribute => $value ) {
799
- $build_shortcode .= ' ' . $attribute . '=' . $value;
800
- }
801
-
802
- if ( 'fts_twitter' === $_REQUEST['feed_name'] ) {
803
- $loadmore_count = isset( $_REQUEST['loadmore_count'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['loadmore_count'] ) ) : '';
804
- $build_shortcode .= ' ' . $loadmore_count . ']';
805
- } elseif ( 'fts_youtube' === $_REQUEST['feed_name'] ) {
806
- $loadmore_count = isset( $_REQUEST['loadmore_count'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['loadmore_count'] ) ) : '';
807
- $build_shortcode .= ' ' . $loadmore_count . ']';
808
- } else {
809
- $build_shortcode .= ' ]';
810
- }
811
-
812
- echo do_shortcode( $build_shortcode );
813
-
814
- } else {
815
- exit( esc_html( 'That is not an FTS shortcode!' ) );
816
- }
817
- }
818
- die();
819
- }
820
-
821
- /**
822
- * FTS Clear Cache Script
823
- *
824
- * This is for the fts_clear_cache_ajax submission.
825
- *
826
- * @since 1.9.6
827
- */
828
- public function fts_clear_cache_script ()
829
- {
830
-
831
- $fts_admin_activation_clear_cache = get_option( 'Feed_Them_Social_Activated_Plugin' );
832
- $fts_dev_mode_cache = get_option( 'fts_clear_cache_developer_mode' );
833
- if ( '1' === $fts_dev_mode_cache || 'feed-them-social' === $fts_admin_activation_clear_cache ) {
834
- wp_enqueue_script( 'fts_clear_cache_script', plugins_url( 'feed-them-social/admin/js/developer-admin.js' ), array('jquery'), FTS_CURRENT_VERSION, false );
835
- wp_localize_script( 'fts_clear_cache_script', 'ftsAjax', array('ajaxurl' => admin_url( 'admin-ajax.php' )) );
836
- wp_enqueue_script( 'jquery' );
837
- wp_enqueue_script( 'fts_clear_cache_script' );
838
- }
839
- if ( 'hide-admin-bar-menu' !== $fts_dev_mode_cache && '1' !== $fts_dev_mode_cache ) {
840
- wp_enqueue_script( 'jquery' );
841
- wp_enqueue_script( 'fts_clear_cache_script', plugins_url( 'feed-them-social/admin/js/admin.js' ), array(), FTS_CURRENT_VERSION, false );
842
- wp_enqueue_script( 'fts_clear_cache_script', plugins_url( 'feed-them-social/admin/js/developer-admin.js' ), array('jquery'), FTS_CURRENT_VERSION, false );
843
- wp_localize_script( 'fts_clear_cache_script', 'ftsAjax', array('ajaxurl' => admin_url( 'admin-ajax.php' )) );
844
- wp_enqueue_script( 'fts_clear_cache_script' );
845
- }
846
-
847
- // we delete this option if found so we only empty the cache once when the plugin is ever activated or updated!
848
- delete_option( 'Feed_Them_Social_Activated_Plugin' );
849
- }
850
-
851
- /**
852
- * Feed Them Main Menu
853
- *
854
- * Admin Submenu buttons // Add the word Settings in place of the default menu page name 'Feed Them'.
855
- *
856
- * @since 1.9.6
857
- */
858
- public function feed_them_main_menu ()
859
- {
860
- // Main Settings Page!
861
- $main_settings_page = new FTS_Settings_Page();
862
- add_menu_page( 'Feed Them Social', 'Feed Them', 'manage_options', 'feed-them-settings-page', array($main_settings_page, 'feed_them_settings_page'), '' );
863
- add_submenu_page( 'feed-them-settings-page', esc_html( 'Settings', 'feed-them-social' ), esc_html( 'Settings', 'feed-them-social' ), 'manage_options', 'feed-them-settings-page' );
864
- }
865
-
866
- /**
867
- * Feed Them Submenu Pages
868
- *
869
- * @since 1.9.6
870
- */
871
- public function feed_them_submenu_pages ()
872
- {
873
-
874
- // Facebook Options Page!
875
- $facebook_options_page = new FTS_Facebook_Options_Page();
876
- add_submenu_page(
877
- 'feed-them-settings-page',
878
- esc_html( 'Facebook Options', 'feed-them-social' ),
879
- esc_html( 'Facebook Options', 'feed-them-social' ),
880
- 'manage_options',
881
- 'fts-facebook-feed-styles-submenu-page',
882
- array($facebook_options_page, 'feed_them_facebook_options_page')
883
- );
884
- // Instagram Options Page!
885
- $instagram_options_page = new FTS_Instagram_Options_Page();
886
- add_submenu_page(
887
- 'feed-them-settings-page',
888
- esc_html( 'Instagram Options', 'feed-them-social' ),
889
- esc_html( 'Instagram Options', 'feed-them-social' ),
890
- 'manage_options',
891
- 'fts-instagram-feed-styles-submenu-page',
892
- array($instagram_options_page, 'feed_them_instagram_options_page')
893
- );
894
- // Twitter Options Page!
895
- $twitter_options_page = new FTS_Twitter_Options_Page();
896
- add_submenu_page(
897
- 'feed-them-settings-page',
898
- esc_html( 'Twitter Options', 'feed-them-social' ),
899
- esc_html( 'Twitter Options', 'feed-them-social' ),
900
- 'manage_options',
901
- 'fts-twitter-feed-styles-submenu-page',
902
- array($twitter_options_page, 'feed_them_twitter_options_page')
903
- );
904
- // Pinterest Options Page!
905
- $pinterest_options_page = new FTS_Pinterest_Options_Page();
906
- add_submenu_page(
907
- 'feed-them-settings-page',
908
- esc_html( 'Pinterest Options', 'feed-them-social' ),
909
- esc_html( 'Pinterest Options', 'feed-them-social' ),
910
- 'manage_options',
911
- 'fts-pinterest-feed-styles-submenu-page',
912
- array($pinterest_options_page, 'feed_them_pinterest_options_page')
913
- );
914
- // Youtube Options Page!
915
- $youtube_options_page = new FTS_Youtube_Options_Page();
916
- add_submenu_page(
917
- 'feed-them-settings-page',
918
- esc_html( 'YouTube Options', 'feed-them-social' ),
919
- esc_html( 'YouTube Options', 'feed-them-social' ),
920
- 'manage_options',
921
- 'fts-youtube-feed-styles-submenu-page',
922
- array($youtube_options_page, 'feed_them_youtube_options_page')
923
- );
924
- // System Info!
925
- $system_info_page = new FTS_System_Info_Page();
926
- add_submenu_page(
927
- 'feed-them-settings-page',
928
- esc_html( 'System Info', 'feed-them-social' ),
929
- esc_html( 'System Info', 'feed-them-social' ),
930
- 'manage_options',
931
- 'fts-system-info-submenu-page',
932
- array($system_info_page, 'feed_them_system_info_page')
933
- );
934
- }
935
-
936
- /**
937
- * Feed Them Admin CSS
938
- *
939
- * Admin CSS.
940
- *
941
- * @since 1.9.6
942
- */
943
- public function feed_them_admin_css ()
944
- {
945
- wp_register_style( 'feed_them_admin', plugins_url( 'admin/css/admin.css', dirname( __FILE__ ) ), array(), FTS_CURRENT_VERSION );
946
- wp_enqueue_style( 'feed_them_admin' );
947
- }
948
-
949
- /**
950
- * Feed Them System Info CSS
951
- *
952
- * Admin System Info CSS.
953
- *
954
- * @since 1.9.6
955
- */
956
- public function feed_them_system_info_css ()
957
- {
958
- wp_register_style( 'fts-settings-admin-css', plugins_url( 'admin/css/admin-settings.css', dirname( __FILE__ ) ), array(), FTS_CURRENT_VERSION );
959
- wp_enqueue_style( 'fts-settings-admin-css' );
960
- }
961
-
962
- /**
963
- * Feed Them Settings
964
- *
965
- * Admin Settings Scripts and CSS.
966
- *
967
- * @since 1.9.6
968
- */
969
- public function feed_them_settings ()
970
- {
971
- $fts_functions_load_settings_nonce = wp_create_nonce( 'fts-functions-load-settings-nonce' );
972
-
973
- if ( wp_verify_nonce( $fts_functions_load_settings_nonce, 'fts-functions-load-settings-nonce' ) ) {
974
- wp_register_style( 'feed_them_settings_css', plugins_url( 'admin/css/settings-page.css', dirname( __FILE__ ) ), array(), FTS_CURRENT_VERSION, false );
975
- wp_enqueue_style( 'feed_them_settings_css' );
976
- if ( isset( $_GET['page'] ) && 'fts-youtube-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-instagram-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-facebook-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-twitter-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-pinterest-feed-styles-submenu-page' === $_GET['page'] ) {
977
- wp_enqueue_script( 'feed_them_style_options_color_js', plugins_url( 'admin/js/jscolor/jscolor.js', dirname( __FILE__ ) ), array(), FTS_CURRENT_VERSION, false );
978
- }
979
- }
980
- }
981
-
982
- /**
983
- * Need FTS Premium Fields
984
- *
985
- * Admin Premium Settings Fields.
986
- *
987
- * @param array $fields settings fields to display premium notice for.
988
- * @since 1.9.6
989
- */
990
- public function need_fts_premium_fields ($fields)
991
- {
992
- foreach ( $fields as $key => $label ) {
993
- $output = '<div class="feed-them-social-admin-input-wrap">';
994
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( $label ) . '</div>';
995
- $output .= '<div class="feed-them-social-admin-input-default">';
996
- $output .= sprintf(
997
- esc_html( 'Must have %1$sPremium Extension%3$s to edit.', 'feed-them-social' ),
998
- '<a href="' . esc_url( 'https://www.slickremix.com/downloads/feed-them-social-premium-extension/' ) . '" target="_blank">',
999
- '</a>'
1000
- );
1001
- $output .= '</div>';
1002
- $output .= '<div class="fts-clear"></div>';
1003
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
1004
- }//END Foreach
1005
-
1006
- return $output;
1007
- }
1008
-
1009
-
1010
- /**
1011
- * Register Settings
1012
- *
1013
- * Generic Register Settings function.
1014
- *
1015
- * @param string $settings_name settings name.
1016
- * @param array $settings settings parameters.
1017
- * @since
1018
- */
1019
- public function register_settings ($settings_name, $settings)
1020
- {
1021
- foreach ( $settings as $key => $setting ) {
1022
- register_setting( $settings_name, $setting );
1023
- }
1024
- }
1025
-
1026
- /**
1027
- * FTS Facebook Style Options Page
1028
- *
1029
- * Register Facebook Style Options.
1030
- *
1031
- * @since 1.9.6
1032
- */
1033
- public function fts_facebook_style_options_page ()
1034
- {
1035
- $fb_style_options = array(
1036
- 'fb_like_btn_color',
1037
- 'fb_language',
1038
- 'fb_show_follow_btn',
1039
- 'fb_show_follow_like_box_cover',
1040
- 'fb_show_follow_btn_where',
1041
- 'fb_header_extra_text_color',
1042
- 'fb_text_color',
1043
- 'fb_link_color',
1044
- 'fb_link_color_hover',
1045
- 'fb_feed_width',
1046
- 'fb_feed_margin',
1047
- 'fb_feed_padding',
1048
- 'fb_feed_background_color',
1049
- 'fb_post_background_color',
1050
- 'fb_grid_border_bottom_color',
1051
- 'fb_grid_posts_background_color',
1052
- 'fb_border_bottom_color',
1053
- 'fts_facebook_custom_api_token',
1054
- 'fb_event_title_color',
1055
- 'fb_event_title_size',
1056
- 'fb_event_maplink_color',
1057
- 'fb_events_title_color',
1058
- 'fb_events_title_size',
1059
- 'fb_events_map_link_color',
1060
- 'fb_hide_shared_by_etc_text',
1061
- 'fts_facebook_custom_api_token_biz',
1062
- 'fb_reviews_text_color',
1063
- 'fb_reviews_backg_color',
1064
- 'fb_reviews_star_language',
1065
- 'fb_reviews_recommended_language',
1066
- 'fb_reviews_see_more_reviews_language',
1067
- 'fb_reviews_see_more_reviews_language',
1068
- 'fb_reviews_overall_rating_background_border_hide',
1069
- 'fb_reviews_overall_rating_background_color',
1070
- 'fb_reviews_overall_rating_border_color',
1071
- 'fb_reviews_overall_rating_text_color',
1072
- 'fb_reviews_overall_rating_background_padding',
1073
- 'fb_reviews_remove_see_reviews_link',
1074
- 'fb_reviews_overall_rating_of_5_stars_text',
1075
- 'fb_reviews_overall_rating_reviews_text',
1076
- 'fb_max_image_width',
1077
- 'fb_hide_images_in_posts',
1078
- 'fb_hide_error_handler_message',
1079
- 'fb_count_offset',
1080
- 'fb_hide_no_posts_message',
1081
- 'fts_facebook_custom_api_token_user_id',
1082
- 'fts_facebook_custom_api_token_user_name',
1083
- 'fts_facebook_custom_api_token_user_id_biz',
1084
- 'fts_facebook_custom_api_token_user_name_biz',
1085
- 'fb_loadmore_background_color',
1086
- 'fb_loadmore_text_color',
1087
- 'fb_load_more_text',
1088
- 'fb_no_more_posts_text',
1089
- 'fb_no_more_photos_text',
1090
- 'fb_no_more_videos_text',
1091
- 'fb_no_more_reviews_text',
1092
- 'fb_text_size',
1093
- 'fb_view_on_fb_fts',
1094
- );
1095
- $this->register_settings( 'fts-facebook-feed-style-options', $fb_style_options );
1096
- }
1097
-
1098
- /**
1099
- * FTS Twitter Style Options Page
1100
- *
1101
- * Register Twitter Style Options.
1102
- *
1103
- * @since 1.9.6
1104
- */
1105
- public function fts_twitter_style_options_page ()
1106
- {
1107
- $twitter_style_options = array(
1108
- 'twitter_show_follow_btn',
1109
- 'twitter_show_follow_count',
1110
- 'twitter_show_follow_btn_where',
1111
- 'twitter_allow_videos',
1112
- 'twitter_allow_shortlink_conversion',
1113
- 'twitter_full_width',
1114
- 'twitter_text_color',
1115
- 'twitter_link_color',
1116
- 'twitter_link_color_hover',
1117
- 'twitter_feed_width',
1118
- 'twitter_feed_margin',
1119
- 'twitter_feed_padding',
1120
- 'twitter_feed_background_color',
1121
- 'twitter_border_bottom_color',
1122
- 'twitter_grid_posts_background_color',
1123
- 'twitter_grid_border_bottom_color',
1124
- 'fts_twitter_custom_consumer_key',
1125
- 'fts_twitter_custom_consumer_secret',
1126
- 'fts_twitter_custom_access_token',
1127
- 'fts_twitter_custom_access_token_secret',
1128
- 'fts_twitter_hide_images_in_posts',
1129
- 'twitter_max_image_width',
1130
- 'twitter_loadmore_background_color',
1131
- 'twitter_loadmore_text_color',
1132
- 'twitter_load_more_text',
1133
- 'twitter_no_more_tweets_text',
1134
- 'twitter_text_size',
1135
- 'twitter_load_more_text',
1136
- 'fts_twitter_custom_tokens',
1137
- );
1138
- $this->register_settings( 'fts-twitter-feed-style-options', $twitter_style_options );
1139
- }
1140
-
1141
- /**
1142
- * FTS Instagram Style Options Page
1143
- *
1144
- * Register Instagram Options.
1145
- *
1146
- * @since 1.9.6
1147
- */
1148
- public function fts_instagram_style_options_page ()
1149
- {
1150
- $instagram_style_options = array(
1151
- 'fts_instagram_custom_api_token',
1152
- 'fts_instagram_custom_id',
1153
- 'instagram_show_follow_btn',
1154
- 'instagram_show_follow_btn_where',
1155
- 'instagram_loadmore_background_color',
1156
- 'instagram_loadmore_text_color',
1157
- 'instagram_load_more_text',
1158
- 'instagram_no_more_photos_text',
1159
- );
1160
- $this->register_settings( 'fts-instagram-feed-style-options', $instagram_style_options );
1161
- }
1162
-
1163
- /**
1164
- * FTS Pinterest Style Options Page
1165
- *
1166
- * Register Pinterest Options.
1167
- *
1168
- * @since 1.9.6
1169
- */
1170
- public function fts_pinterest_style_options_page ()
1171
- {
1172
- $pinterest_style_options = array(
1173
- 'fts_pinterest_custom_api_token',
1174
- 'pinterest_show_follow_btn',
1175
- 'pinterest_show_follow_btn_where',
1176
- 'pinterest_board_title_color',
1177
- 'pinterest_board_title_size',
1178
- 'pinterest_board_backg_hover_color',
1179
- );
1180
- $this->register_settings( 'fts-pinterest-feed-style-options', $pinterest_style_options );
1181
- }
1182
-
1183
- /**
1184
- * FTS Youtube Style Options Page
1185
- *
1186
- * Register YouTube Options.
1187
- *
1188
- * @since 1.9.6
1189
- */
1190
- public function fts_youtube_style_options_page ()
1191
- {
1192
- $youtube_style_options = array(
1193
- 'youtube_show_follow_btn',
1194
- 'youtube_show_follow_btn_where',
1195
- 'youtube_custom_api_token',
1196
- 'youtube_loadmore_background_color',
1197
- 'youtube_loadmore_text_color',
1198
- 'youtube_load_more_text',
1199
- 'youtube_no_more_videos_text',
1200
- 'youtube_custom_refresh_token',
1201
- 'youtube_custom_access_token',
1202
- 'youtube_custom_token_exp_time',
1203
- );
1204
- $this->register_settings( 'fts-youtube-feed-style-options', $youtube_style_options );
1205
- }
1206
-
1207
- /**
1208
- * FTS Settings Page Register Settings
1209
- *
1210
- * Register Free Version Settings.
1211
- *
1212
- * @since 1.9.6
1213
- */
1214
- public function fts_settings_page_register_settings ()
1215
- {
1216
- $settings = array(
1217
- 'fts_admin_bar_menu',
1218
- 'fts_clear_cache_developer_mode',
1219
- 'fts-date-and-time-format',
1220
- 'fts-timezone',
1221
- 'fts_fix_magnific',
1222
- 'fts-color-options-settings-custom-css',
1223
- 'fts-color-options-main-wrapper-css-input',
1224
- 'fts-powered-text-options-settings',
1225
- 'fts-slicker-instagram-icon-center',
1226
- 'fts-slicker-instagram-container-image-size',
1227
- 'fts-slicker-instagram-container-hide-date-likes-comments',
1228
- 'fts-slicker-instagram-container-position',
1229
- 'fts-slicker-instagram-container-animation',
1230
- 'fts-slicker-instagram-container-margin',
1231
- 'fts_fix_loadmore',
1232
- 'fts_curl_option',
1233
- 'fts-custom-date',
1234
- 'fts-custom-time',
1235
- 'fts_twitter_time_offset',
1236
- 'fts_language_second',
1237
- 'fts_language_seconds',
1238
- 'fts_language_minute',
1239
- 'fts_language_minutes',
1240
- 'fts_language_hour',
1241
- 'fts_language_hours',
1242
- 'fts_language_day',
1243
- 'fts_language_days',
1244
- 'fts_language_week',
1245
- 'fts_language_weeks',
1246
- 'fts_language_month',
1247
- 'fts_language_months',
1248
- 'fts_language_year',
1249
- 'fts_language_years',
1250
- 'fts_language_ago',
1251
- 'fts_disable_share_button',
1252
- 'fts_social_icons_color',
1253
- 'fts_social_icons_hover_color',
1254
- 'fts_social_icons_back_color',
1255
- 'fts_slick_rating_notice_waiting',
1256
- 'fts_slick_rating_notice',
1257
- 'fts_slick_ignore_rating_notice_nag',
1258
- );
1259
- $this->register_settings( 'feed-them-social-settings', $settings );
1260
- }
1261
-
1262
- /**
1263
- * Social Follow Buttons
1264
- *
1265
- * @param string $feed feed type.
1266
- * @param string $user_id user id.
1267
- * @param null $access_token access token.
1268
- * @param null $fb_shortcode shortcode attribute.
1269
- * @since 1.9.6
1270
- */
1271
- public function social_follow_button ($feed, $user_id, $access_token = null, $fb_shortcode = null)
1272
- {
1273
- $fts_social_follow_nonce = wp_create_nonce( 'fts-social-follow-nonce' );
1274
-
1275
- if ( wp_verify_nonce( $fts_social_follow_nonce, 'fts-social-follow-nonce' ) ) {
1276
-
1277
- global $channel_id, $playlist_id, $username_subscribe_btn, $username;
1278
- switch ($feed) {
1279
- case 'facebook':
1280
- // Facebook settings options for follow button!
1281
- $fb_show_follow_btn = get_option( 'fb_show_follow_btn' );
1282
- $fb_show_follow_like_box_cover = get_option( 'fb_show_follow_like_box_cover' );
1283
- $language_option_check = get_option( 'fb_language' );
1284
-
1285
- if ( isset( $language_option_check ) && 'Please Select Option' !== $language_option_check ) {
1286
- $language_option = get_option( 'fb_language', 'en_US' );
1287
- } else {
1288
- $language_option = 'en_US';
1289
- }
1290
- $fb_like_btn_color = get_option( 'fb_like_btn_color', 'light' );
1291
- $show_faces = 'like-button-share-faces' === $fb_show_follow_btn || 'like-button-faces' === $fb_show_follow_btn || 'like-box-faces' === $fb_show_follow_btn ? 'true' : 'false';
1292
- $share_button = 'like-button-share-faces' === $fb_show_follow_btn || 'like-button-share' === $fb_show_follow_btn ? 'true' : 'false';
1293
- $page_cover = 'fb_like_box_cover-yes' === $fb_show_follow_like_box_cover ? 'true' : 'false';
1294
- if ( !isset( $_POST['fts_facebook_script_loaded'] ) ) {
1295
- echo '<div id="fb-root"></div>
1296
  <script>jQuery(".fb-page").hide(); (function(d, s, id) {
1297
  var js, fjs = d.getElementsByTagName(s)[0];
1298
  if (d.getElementById(id)) return;
@@ -1300,2129 +1275,2098 @@ class feed_them_social_functions
1300
  js.src = "//connect.facebook.net/' . esc_html( $language_option ) . '/sdk.js#xfbml=1&appId=&version=v3.1";
1301
  fjs.parentNode.insertBefore(js, fjs);
1302
  }(document, "script", "facebook-jssd"));</script>';
1303
- $_POST['fts_facebook_script_loaded'] = 'yes';
1304
- }
1305
-
1306
- // Page Box!
1307
- if ( 'like-box' === $fb_show_follow_btn || 'like-box-faces' === $fb_show_follow_btn ) {
1308
-
1309
- $like_box_width = isset( $fb_shortcode['like_box_width'] ) && '' !== $fb_shortcode['like_box_width'] ? $fb_shortcode['like_box_width'] : '500px';
1310
-
1311
- echo '<div class="fb-page" data-href="' . esc_url( 'https://www.facebook.com/' . $user_id ) . '" data-hide-cover="' . esc_html( $page_cover ) . '" data-width="' . esc_html( $like_box_width ) . '" data-show-facepile="' . esc_html( $show_faces ) . '" data-show-posts="false"></div>';
1312
- } else {
1313
- echo '<div class="fb-like" data-href="' . esc_url( 'https://www.facebook.com/' . $user_id ) . '" data-layout="standard" data-action="like" data-colorscheme="' . esc_html( $fb_like_btn_color ) . '" data-show-faces="' . esc_html( $show_faces ) . '" data-share="' . esc_html( $share_button ) . '" data-width:"100%"></div>';
1314
- }
1315
- break;
1316
- case 'instagram':
1317
- echo '<a href="' . esc_url( 'https://instagram.com/' . $user_id . '/' ) . '" target="_blank">' . esc_html( 'Follow on Instagram', 'feed-them-social' ) . '</a>';
1318
- break;
1319
- case 'twitter':
1320
- if ( !isset( $_POST['fts_twitter_script_loaded'] ) ) {
1321
- echo "<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>";
1322
- $_POST['fts_twitter_script_loaded'] = 'yes';
1323
- }
1324
- // CAN't ESCAPE Twitter link because then JS doesn't work!
1325
- echo '<a class="twitter-follow-button" href="' . ' https://twitter.com/' . $user_id . ' " data-show-count="false" data-lang="en"> Follow @' . esc_html( $user_id ) . '</a>';
1326
- break;
1327
- case 'pinterest':
1328
- if ( !isset( $_POST['fts_pinterest_script_loaded'] ) ) {
1329
- echo '<script>jQuery(function () {jQuery.getScript("//assets.pinterest.com/js/pinit.js");});</script>';
1330
- $_POST['fts_pinterest_script_loaded'] = 'yes';
1331
- }
1332
- // we return this one until we echo out the pinterest feed instead of $output.=.
1333
- return '<a data-pin-do="buttonFollow" href="https://www.pinterest.com/' . esc_html( $user_id ) . '/">' . esc_html( $user_id ) . '</a>';
1334
- break;
1335
- case 'youtube':
1336
- if ( !isset( $_POST['fts_youtube_script_loaded'] ) ) {
1337
- echo '<script src="' . esc_url( 'https://apis.google.com/js/platform.js' ) . '"></script>';
1338
- $_POST['fts_youtube_script_loaded'] = 'yes';
1339
- }
1340
- if ( '' === $channel_id && '' === $playlist_id && '' !== $username || '' !== $playlist_id && '' !== $username_subscribe_btn ) {
1341
-
1342
- if ( '' !== $username_subscribe_btn ) {
1343
- echo '<div class="g-ytsubscribe" data-channel="' . esc_html( $username_subscribe_btn ) . '" data-layout="full" data-count="default"></div>';
1344
- } else {
1345
- echo '<div class="g-ytsubscribe" data-channel="' . esc_html( $user_id ) . '" data-layout="full" data-count="default"></div>';
1346
- }
1347
- } elseif ( '' !== $channel_id && '' !== $playlist_id || '' !== $channel_id ) {
1348
- echo '<div class="g-ytsubscribe" data-channelid="' . esc_html( $channel_id ) . '" data-layout="full" data-count="default"></div>';
1349
- }
1350
- break;
1351
- }
1352
- }
1353
- }
1354
-
1355
- /**
1356
- * FTS Color Options Head CSS
1357
- *
1358
- * @since 1.9.6
1359
- */
1360
- public function fts_color_options_head_css ()
1361
- {
1362
- ?>
1363
- <style type="text/css"><?php echo get_option( 'fts-color-options-main-wrapper-css-input' ); ?></style>
1364
- <?php
1365
- }
1366
-
1367
- /**
1368
- * FTS FB Color Options Head CSS
1369
- *
1370
- * Color Options CSS for Facebook.
1371
- *
1372
- * @since 1.9.6
1373
- */
1374
- public function fts_fb_color_options_head_css ()
1375
- {
1376
- $fb_hide_no_posts_message = get_option( 'fb_hide_no_posts_message' );
1377
- $fb_header_extra_text_color = get_option( 'fb_header_extra_text_color' );
1378
- $fb_text_color = get_option( 'fb_text_color' );
1379
- $fb_link_color = get_option( 'fb_link_color' );
1380
- $fb_link_color_hover = get_option( 'fb_link_color_hover' );
1381
- $fb_feed_width = get_option( 'fb_feed_width' );
1382
- $fb_feed_margin = get_option( 'fb_feed_margin' );
1383
- $fb_feed_padding = get_option( 'fb_feed_padding' );
1384
- $fb_feed_background_color = get_option( 'fb_feed_background_color' );
1385
- $fb_post_background_color = get_option( 'fb_post_background_color' );
1386
- $fb_grid_posts_background_color = get_option( 'fb_grid_posts_background_color' );
1387
- $fb_grid_border_bottom_color = get_option( 'fb_grid_border_bottom_color' );
1388
- $fb_loadmore_background_color = get_option( 'fb_loadmore_background_color' );
1389
- $fb_loadmore_text_color = get_option( 'fb_loadmore_text_color' );
1390
- $fb_border_bottom_color = get_option( 'fb_border_bottom_color' );
1391
- $fb_grid_posts_background_color = get_option( 'fb_grid_posts_background_color' );
1392
- $fb_reviews_backg_color = get_option( 'fb_reviews_backg_color' );
1393
- $fb_reviews_text_color = get_option( 'fb_reviews_text_color' );
1394
-
1395
- $fb_reviews_overall_rating_background_color = get_option( 'fb_reviews_overall_rating_background_color' );
1396
- $fb_reviews_overall_rating_border_color = get_option( 'fb_reviews_overall_rating_border_color' );
1397
- $fb_reviews_overall_rating_text_color = get_option( 'fb_reviews_overall_rating_text_color' );
1398
- $fb_reviews_overall_rating_background_padding = get_option( 'fb_reviews_overall_rating_background_padding' );
1399
-
1400
- $fb_max_image_width = get_option( 'fb_max_image_width' );
1401
-
1402
- $fb_events_title_color = get_option( 'fb_events_title_color' );
1403
- $fb_events_title_size = get_option( 'fb_events_title_size' );
1404
- $fb_events_maplink_color = get_option( 'fb_events_map_link_color' );
1405
-
1406
- $twitter_hide_profile_photo = get_option( 'twitter_hide_profile_photo' );
1407
- $twitter_text_color = get_option( 'twitter_text_color' );
1408
- $twitter_link_color = get_option( 'twitter_link_color' );
1409
- $twitter_link_color_hover = get_option( 'twitter_link_color_hover' );
1410
- $twitter_feed_width = get_option( 'twitter_feed_width' );
1411
- $twitter_feed_margin = get_option( 'twitter_feed_margin' );
1412
- $twitter_feed_padding = get_option( 'twitter_feed_padding' );
1413
- $twitter_feed_background_color = get_option( 'twitter_feed_background_color' );
1414
- $twitter_border_bottom_color = get_option( 'twitter_border_bottom_color' );
1415
- $twitter_max_image_width = get_option( 'twitter_max_image_width' );
1416
- $twitter_grid_border_bottom_color = get_option( 'twitter_grid_border_bottom_color' );
1417
- $twitter_grid_posts_background_color = get_option( 'twitter_grid_posts_background_color' );
1418
- $twitter_loadmore_background_color = get_option( 'twitter_loadmore_background_color' );
1419
- $twitter_loadmore_text_color = get_option( 'twitter_loadmore_text_color' );
1420
-
1421
- $instagram_loadmore_background_color = get_option( 'instagram_loadmore_background_color' );
1422
- $instagram_loadmore_text_color = get_option( 'instagram_loadmore_text_color' );
1423
-
1424
- $pinterest_board_title_color = get_option( 'pinterest_board_title_color' );
1425
- $pinterest_board_title_size = get_option( 'pinterest_board_title_size' );
1426
- $pinterest_board_backg_hover_color = get_option( 'pinterest_board_backg_hover_color' );
1427
-
1428
- $fts_social_icons_color = get_option( 'fts_social_icons_color' );
1429
- $fts_social_icons_hover_color = get_option( 'fts_social_icons_hover_color' );
1430
- $fts_social_icons_back_color = get_option( 'fts_social_icons_back_color' );
1431
-
1432
- $youtube_loadmore_background_color = get_option( 'youtube_loadmore_background_color' );
1433
- $youtube_loadmore_text_color = get_option( 'youtube_loadmore_text_color' );
1434
-
1435
- $fb_text_size = get_option( 'fb_text_size' );
1436
- $twitter_text_size = get_option( 'twitter_text_size' );
1437
- ?>
1438
- <style type="text/css"><?php if ( ! empty( $fb_header_extra_text_color ) ) { ?>
1439
-
1440
- <?php }if ( ! empty( $fb_hide_no_posts_message ) && 'yes' === $fb_hide_no_posts_message ) { ?>
1441
- .fts-facebook-add-more-posts-notice {
1442
- display: none !important;
1443
- }
1444
-
1445
- .fts-jal-single-fb-post .fts-jal-fb-user-name {
1446
- color: <?php echo esc_html( $fb_header_extra_text_color ); ?> !important;
1447
- }
1448
-
1449
- <?php }if ( ! empty( $fb_loadmore_background_color ) ) { ?>
1450
- .fts-fb-load-more-wrapper .fts-fb-load-more {
1451
- background: <?php echo esc_html( $fb_loadmore_background_color ); ?> !important;
1452
- }
1453
-
1454
- <?php }if ( ! empty( $fb_loadmore_text_color ) ) { ?>
1455
- .fts-fb-load-more-wrapper .fts-fb-load-more {
1456
- color: <?php echo esc_html( $fb_loadmore_text_color ); ?> !important;
1457
- }
1458
-
1459
- <?php }if ( ! empty( $fb_loadmore_text_color ) ) { ?>
1460
- .fts-fb-load-more-wrapper .fts-fb-spinner > div {
1461
- background: <?php echo esc_html( $fb_loadmore_text_color ); ?> !important;
1462
- }
1463
-
1464
- <?php }if ( ! empty( $fb_text_color ) ) { ?>
1465
- .fts-simple-fb-wrapper .fts-jal-single-fb-post,
1466
- .fts-simple-fb-wrapper .fts-jal-fb-description-wrap,
1467
- .fts-simple-fb-wrapper .fts-jal-fb-post-time,
1468
- .fts-slicker-facebook-posts .fts-jal-single-fb-post,
1469
- .fts-slicker-facebook-posts .fts-jal-fb-description-wrap,
1470
- .fts-slicker-facebook-posts .fts-jal-fb-post-time {
1471
- color: <?php echo esc_html( $fb_text_color ); ?> !important;
1472
- }
1473
-
1474
- <?php }if ( ! empty( $fb_link_color ) ) { ?>
1475
- .fts-simple-fb-wrapper .fts-jal-single-fb-post .fts-review-name,
1476
- .fts-simple-fb-wrapper .fts-jal-single-fb-post a,
1477
- .fts-slicker-facebook-posts .fts-jal-single-fb-post a,
1478
- .fts-jal-fb-group-header-desc a {
1479
- color: <?php echo esc_html( $fb_link_color ); ?> !important;
1480
- }
1481
-
1482
- <?php }if ( ! empty( $fb_link_color_hover ) ) { ?>
1483
- .fts-simple-fb-wrapper .fts-jal-single-fb-post a:hover,
1484
- .fts-simple-fb-wrapper .fts-fb-load-more:hover,
1485
- .fts-slicker-facebook-posts .fts-jal-single-fb-post a:hover,
1486
- .fts-slicker-facebook-posts .fts-fb-load-more:hover,
1487
- .fts-jal-fb-group-header-desc a:hover {
1488
- color: <?php echo esc_html( $fb_link_color_hover ); ?> !important;
1489
- }
1490
-
1491
- <?php }if ( ! empty( $fb_feed_width ) ) { ?>
1492
- .fts-simple-fb-wrapper, .fts-fb-header-wrapper, .fts-fb-load-more-wrapper, .fts-jal-fb-header, .fb-social-btn-top, .fb-social-btn-bottom, .fb-social-btn-below-description {
1493
- max-width: <?php echo esc_html( $fb_feed_width ); ?> !important;
1494
- }
1495
-
1496
- <?php }if ( ! empty( $fb_max_image_width ) ) { ?>
1497
- .fts-fb-large-photo, .fts-jal-fb-vid-picture, .fts-jal-fb-picture, .fts-fluid-videoWrapper-html5 {
1498
- max-width: <?php echo esc_html( $fb_max_image_width ); ?> !important;
1499
- float: left;
1500
- }
1501
-
1502
- <?php }if ( ! empty( $fb_events_title_color ) ) { ?>
1503
- .fts-simple-fb-wrapper .fts-events-list-wrap a.fts-jal-fb-name {
1504
- color: <?php echo esc_html( $fb_events_title_color ); ?> !important;
1505
- }
1506
-
1507
- <?php }if ( ! empty( $fb_events_title_size ) ) { ?>
1508
- .fts-simple-fb-wrapper .fts-events-list-wrap a.fts-jal-fb-name {
1509
- font-size: <?php echo esc_html( $fb_events_title_size ); ?> !important;
1510
- line-height: <?php echo esc_html( $fb_events_title_size ); ?> !important;
1511
- }
1512
-
1513
- <?php }if ( ! empty( $fb_events_maplink_color ) ) { ?>
1514
- .fts-simple-fb-wrapper a.fts-fb-get-directions {
1515
- color: <?php echo esc_html( $fb_events_maplink_color ); ?> !important;
1516
- }
1517
-
1518
- <?php }if ( ! empty( $fb_feed_margin ) ) { ?>
1519
- .fts-simple-fb-wrapper, .fts-fb-header-wrapper, .fts-fb-load-more-wrapper, .fts-jal-fb-header, .fb-social-btn-top, .fb-social-btn-bottom, .fb-social-btn-below-description {
1520
- margin: <?php echo esc_html( $fb_feed_margin ); ?> !important;
1521
- }
1522
-
1523
- <?php }if ( ! empty( $fb_feed_padding ) ) { ?>
1524
- .fts-simple-fb-wrapper {
1525
- padding: <?php echo esc_html( $fb_feed_padding ); ?> !important;
1526
- }
1527
-
1528
- <?php }if ( ! empty( $fb_feed_background_color ) ) { ?>
1529
- .fts-simple-fb-wrapper, .fts-fb-load-more-wrapper .fts-fb-load-more {
1530
- background: <?php echo esc_html( $fb_feed_background_color ); ?> !important;
1531
- }
1532
-
1533
- <?php }if ( ! empty( $fb_post_background_color ) ) { ?>
1534
- .fts-mashup-media-top .fts-jal-single-fb-post {
1535
- background: <?php echo esc_html( $fb_post_background_color ); ?> !important;
1536
- }
1537
-
1538
- <?php }if ( ! empty( $fb_grid_posts_background_color ) ) { ?>
1539
- .fts-slicker-facebook-posts .fts-jal-single-fb-post {
1540
- background: <?php echo esc_html( $fb_grid_posts_background_color ); ?> !important;
1541
- }
1542
-
1543
- <?php }if ( ! empty( $fb_border_bottom_color ) ) { ?>
1544
- .fts-jal-single-fb-post {
1545
- border-bottom-color: <?php echo esc_html( $fb_border_bottom_color ); ?> !important;
1546
- }
1547
-
1548
- <?php }if ( ! empty( $fb_grid_border_bottom_color ) ) { ?>
1549
- .fts-slicker-facebook-posts .fts-jal-single-fb-post {
1550
- border-bottom-color: <?php echo esc_html( $fb_grid_border_bottom_color ); ?> !important;
1551
- }
1552
-
1553
- <?php }if ( ! empty( $twitter_grid_posts_background_color ) ) { ?>
1554
- .fts-slicker-twitter-posts .fts-tweeter-wrap {
1555
- background: <?php echo esc_html( $twitter_grid_posts_background_color ); ?> !important;
1556
- }
1557
-
1558
- <?php }if ( ! empty( $twitter_grid_border_bottom_color ) ) { ?>
1559
- .fts-slicker-twitter-posts .fts-tweeter-wrap {
1560
- border-bottom-color: <?php echo esc_html( $twitter_grid_border_bottom_color ); ?> !important;
1561
- }
1562
-
1563
- <?php }if ( ! empty( $twitter_loadmore_background_color ) ) { ?>
1564
- .fts-twitter-load-more-wrapper .fts-fb-load-more {
1565
- background: <?php echo esc_html( $twitter_loadmore_background_color ); ?> !important;
1566
- }
1567
-
1568
- <?php }if ( ! empty( $twitter_loadmore_text_color ) ) { ?>
1569
- .fts-twitter-load-more-wrapper .fts-fb-load-more {
1570
- color: <?php echo esc_html( $twitter_loadmore_text_color ); ?> !important;
1571
- }
1572
-
1573
- <?php }if ( ! empty( $twitter_loadmore_text_color ) ) { ?>
1574
- .fts-twitter-load-more-wrapper .fts-fb-spinner > div {
1575
- background: <?php echo esc_html( $twitter_loadmore_text_color ); ?> !important;
1576
- }
1577
-
1578
- <?php }if ( ! empty( $fb_reviews_backg_color ) ) { ?>
1579
- .fts-review-star {
1580
- background: <?php echo esc_html( $fb_reviews_backg_color ); ?> !important;
1581
- }
1582
-
1583
- <?php }if ( ! empty( $fb_reviews_overall_rating_background_color ) ) { ?>
1584
- .fts-review-details-master-wrap {
1585
- background: <?php echo esc_html( $fb_reviews_overall_rating_background_color ); ?> !important;
1586
- }
1587
-
1588
- <?php }if ( ! empty( $fb_reviews_overall_rating_border_color ) ) { ?>
1589
- .fts-review-details-master-wrap {
1590
- border-bottom-color: <?php echo esc_html( $fb_reviews_overall_rating_border_color ); ?> !important;
1591
- }
1592
-
1593
- <?php }if ( ! empty( $fb_reviews_overall_rating_background_padding ) ) { ?>
1594
- .fts-review-details-master-wrap {
1595
- padding: <?php echo esc_html( $fb_reviews_overall_rating_background_padding ); ?> !important;
1596
- }
1597
-
1598
- <?php }if ( ! empty( $fb_reviews_overall_rating_text_color ) ) { ?>
1599
- .fts-review-details-master-wrap {
1600
- color: <?php echo esc_html( $fb_reviews_overall_rating_text_color ); ?> !important;
1601
- }
1602
-
1603
- <?php }if ( ! empty( $fb_reviews_text_color ) ) { ?>
1604
- .fts-review-star {
1605
- color: <?php echo esc_html( $fb_reviews_text_color ); ?> !important;
1606
- }
1607
-
1608
- <?php }if ( ! empty( $twitter_text_color ) ) { ?>
1609
- .tweeter-info .fts-twitter-text, .fts-twitter-reply-wrap:before, a span.fts-video-loading-notice {
1610
- color: <?php echo esc_html( $twitter_text_color ); ?> !important;
1611
- }
1612
-
1613
- <?php }if ( ! empty( $twitter_link_color ) ) { ?>
1614
- .tweeter-info .fts-twitter-text a, .tweeter-info .fts-twitter-text .time a, .fts-twitter-reply-wrap a, .tweeter-info a, .twitter-followers-fts a, body.fts-twitter-reply-wrap a {
1615
- color: <?php echo esc_html( $twitter_link_color ); ?> !important;
1616
- }
1617
-
1618
- <?php }if ( ! empty( $twitter_link_color_hover ) ) { ?>
1619
- .tweeter-info a:hover, .tweeter-info:hover .fts-twitter-reply, body.fts-twitter-reply-wrap a:hover {
1620
- color: <?php echo esc_html( $twitter_link_color_hover ); ?> !important;
1621
- }
1622
-
1623
- <?php }if ( ! empty( $twitter_feed_width ) ) { ?>
1624
- .fts-twitter-div {
1625
- max-width: <?php echo esc_html( $twitter_feed_width ); ?> !important;
1626
- }
1627
-
1628
- <?php }if ( ! empty( $twitter_feed_margin ) ) { ?>
1629
- .fts-twitter-div {
1630
- margin: <?php echo esc_html( $twitter_feed_margin ); ?> !important;
1631
- }
1632
-
1633
- <?php }if ( ! empty( $twitter_feed_padding ) ) { ?>
1634
- .fts-twitter-div {
1635
- padding: <?php echo esc_html( $twitter_feed_padding ); ?> !important;
1636
- }
1637
-
1638
- <?php }if ( ! empty( $twitter_feed_background_color ) ) { ?>
1639
- .fts-twitter-div {
1640
- background: <?php echo esc_html( $twitter_feed_background_color ); ?> !important;
1641
- }
1642
-
1643
- <?php }if ( ! empty( $twitter_border_bottom_color ) ) { ?>
1644
- .tweeter-info {
1645
- border-bottom: 1px solid <?php echo esc_html( $twitter_border_bottom_color ); ?> !important;
1646
- }
1647
-
1648
- <?php }if ( ! empty( $twitter_max_image_width ) ) { ?>
1649
- .fts-twitter-link-image {
1650
- max-width: <?php echo esc_html( $twitter_max_image_width ); ?> !important;
1651
- display: block;
1652
- }
1653
-
1654
- <?php }if ( ! empty( $instagram_loadmore_background_color ) ) { ?>
1655
- .fts-instagram-load-more-wrapper .fts-fb-load-more {
1656
- background: <?php echo esc_html( $instagram_loadmore_background_color ); ?> !important;
1657
- }
1658
-
1659
- <?php }if ( ! empty( $instagram_loadmore_text_color ) ) { ?>
1660
- .fts-instagram-load-more-wrapper .fts-fb-load-more {
1661
- color: <?php echo esc_html( $instagram_loadmore_text_color ); ?> !important;
1662
- }
1663
-
1664
- <?php }if ( ! empty( $instagram_loadmore_text_color ) ) { ?>
1665
- .fts-instagram-load-more-wrapper .fts-fb-spinner > div {
1666
- background: <?php echo esc_html( $instagram_loadmore_text_color ); ?> !important;
1667
- }
1668
-
1669
- <?php } if ( ! empty( $pinterest_board_backg_hover_color ) ) { ?>
1670
- a.fts-pin-board-wrap:hover {
1671
- background: <?php echo esc_html( $pinterest_board_backg_hover_color ); ?> !important;
1672
- }
1673
-
1674
- <?php } if ( ! empty( $pinterest_board_title_color ) ) { ?>
1675
- body h3.fts-pin-board-board_title {
1676
- color: <?php echo esc_html( $pinterest_board_title_color ); ?> !important;
1677
- }
1678
-
1679
- <?php } if ( ! empty( $pinterest_board_title_size ) ) { ?>
1680
- body h3.fts-pin-board-board_title {
1681
- font-size: <?php echo esc_html( $pinterest_board_title_size ); ?> !important;
1682
- }
1683
-
1684
- <?php
1685
  }
1686
  if ( ! empty( $fts_social_icons_color ) ) {
1687
  ?>
1688
- .ft-gallery-share-wrap a.ft-galleryfacebook-icon, .ft-gallery-share-wrap a.ft-gallerytwitter-icon, .ft-gallery-share-wrap a.ft-gallerygoogle-icon, .ft-gallery-share-wrap a.ft-gallerylinkedin-icon, .ft-gallery-share-wrap a.ft-galleryemail-icon {
1689
- color: <?php echo esc_html( $fts_social_icons_color ); ?> !important;
1690
- }
1691
 
1692
- <?php
1693
  }
1694
  if ( ! empty( $fts_social_icons_hover_color ) ) {
1695
  ?>
1696
- .ft-gallery-share-wrap a.ft-galleryfacebook-icon:hover, .ft-gallery-share-wrap a.ft-gallerytwitter-icon:hover, .ft-gallery-share-wrap a.ft-gallerygoogle-icon:hover, .ft-gallery-share-wrap a.ft-gallerylinkedin-icon:hover, .ft-gallery-share-wrap a.ft-galleryemail-icon:hover {
1697
- color: <?php echo esc_html( $fts_social_icons_hover_color ); ?> !important;
1698
- }
1699
 
1700
- <?php
1701
  }
1702
  if ( ! empty( $fts_social_icons_back_color ) ) {
1703
  ?>
1704
- .ft-gallery-share-wrap {
1705
- background: <?php echo esc_html( $fts_social_icons_back_color ); ?> !important;
1706
- }
1707
 
1708
- <?php
1709
  }
1710
  if ( ! empty( $twitter_text_size ) ) {
1711
  ?>
1712
- span.fts-twitter-text {
1713
- font-size: <?php echo esc_html( $twitter_text_size ); ?> !important;
1714
- }
1715
 
1716
- <?php
1717
  }
1718
  if ( ! empty( $fb_text_size ) ) {
1719
  ?>
1720
- .fts-jal-fb-group-display .fts-jal-fb-message, .fts-jal-fb-group-display .fts-jal-fb-message p, .fts-jal-fb-group-header-desc, .fts-jal-fb-group-header-desc p, .fts-jal-fb-group-header-desc a {
1721
- font-size: <?php echo esc_html( $fb_text_size ); ?> !important;
1722
- }
1723
 
1724
- <?php
1725
  }
1726
  if ( ! empty( $youtube_loadmore_background_color ) ) {
1727
  ?>
1728
- .fts-youtube-load-more-wrapper .fts-fb-load-more {
1729
- background: <?php echo esc_html( $youtube_loadmore_background_color ); ?> !important;
1730
- }
1731
 
1732
- <?php }if ( ! empty( $youtube_loadmore_text_color ) ) { ?>
1733
- .fts-youtube-load-more-wrapper .fts-fb-load-more {
1734
- color: <?php echo esc_html( $youtube_loadmore_text_color ); ?> !important;
1735
- }
1736
 
1737
- <?php
1738
  }
1739
  if ( ! empty( $youtube_loadmore_text_color ) ) {
1740
  ?>
1741
- .fts-youtube-load-more-wrapper .fts-fb-spinner > div {
1742
- background: <?php echo esc_html( $youtube_loadmore_text_color ); ?> !important;
1743
- }
1744
-
1745
- <?php } ?>
1746
-
1747
- </style>
1748
- <?php
1749
- }
1750
-
1751
- /**
1752
- * FTS Powered By JS
1753
- *
1754
- * @since 1.9.6
1755
- */
1756
- public function fts_powered_by_js ()
1757
- {
1758
- wp_enqueue_script( 'fts_powered_by_js', plugins_url( 'feeds/js/powered-by.js', dirname( __FILE__ ) ), array('jquery'), FTS_CURRENT_VERSION, false );
1759
- }
1760
-
1761
- /**
1762
- * Required Premium Field
1763
- *
1764
- * Admin Required Premium Settings Fields.
1765
- *
1766
- * @param array $fields_info fields info.
1767
- * @since 2.0.7
1768
- */
1769
- public function need_fts_premium_plugin_field ($fields_info)
1770
- {
1771
- $output = '<div class="feed-them-social-admin-input-default">' . wp_kses(
1772
- $fields_info['no_active_msg'],
1773
- array(
1774
- 'a' => array(
1775
- 'href' => array(),
1776
- 'title' => array(),
1777
- 'target' => array(),
1778
- ),
1779
- 'br' => array(),
1780
- 'em' => array(),
1781
- 'strong' => array(),
1782
- )
1783
- ) . '</div>';
1784
-
1785
- return $output;
1786
- }
1787
-
1788
- /**
1789
- * Settings Form Fields Output
1790
- *
1791
- * @param bool $save_options save options.
1792
- * @param array $feed_settings_array feed settings information.
1793
- * @param array $required_plugins The plugins that are required for this form.
1794
- * @since 2.0.8
1795
- */
1796
- public function fts_settings_html_form ($save_options = false, $feed_settings_array, $required_plugins)
1797
- {
1798
-
1799
- $output = '';
1800
-
1801
- // Start creation of fields for each Feed!
1802
- foreach ( $feed_settings_array as $section => $section_info ) {
1803
- $output .= '<div class="' . esc_attr( $section_info['section_wrap_class'] ) . '">';
1804
- $output .= '<form class="feed-them-social-admin-form shortcode-generator-form ' . esc_attr( $section_info['form_wrap_classes'] ) . '" id="' . esc_attr( $section_info['form_wrap_id'] ) . '">';
1805
-
1806
- // Check to see if token is in place otherwise show a message letting person no what they need to do!
1807
- if ( isset( $section_info['token_check'] ) ) {
1808
- foreach ( $section_info['token_check'] as $token_key => $token_info ) {
1809
- if ( !isset( $token_info['req_plugin'] ) || isset( $token_info['req_plugin'] ) && is_plugin_active( $required_plugins[$token_info['req_plugin']]['plugin_url'] ) ) {
1810
- $token_check = get_option( $token_info['option_name'] ) ? 'Yes' : 'No';
1811
- $output .= isset( $token_check ) && 'No' !== $token_check ? "\n" : '<div class="feed-them-social-admin-input-wrap fts-required-token-message">' . wp_kses(
1812
- $token_info['no_token_msg'],
1813
- array(
1814
- 'a' => array(
1815
- 'href' => array(),
1816
- 'title' => array(),
1817
- 'target' => array(),
1818
- ),
1819
- 'br' => array(),
1820
- 'em' => array(),
1821
- 'strong' => array(),
1822
- 'small' => array(),
1823
- )
1824
- ) . '</div>' . "\n";
1825
- }
1826
- }
1827
- }
1828
- // Section Title!
1829
- $output .= isset( $section_info['section_title'] ) ? '<h2>' . esc_html( $section_info['section_title'] ) . '</h2>' : '';
1830
- // Feed Types select!
1831
- if ( isset( $section_info['feeds_types'] ) ) {
1832
- $output .= '<div class="feed-them-social-admin-input-wrap ' . esc_attr( $section_info['feed_type_select']['select_wrap_classes'] ) . '">';
1833
- $output .= '<div class="feed-them-social-admin-input-label">' . wp_kses(
1834
- $section_info['feed_type_select']['label'],
1835
- array(
1836
- 'a' => array(
1837
- 'href' => array(),
1838
- 'title' => array(),
1839
- 'target' => array(),
1840
- ),
1841
- 'br' => array(),
1842
- 'em' => array(),
1843
- 'strong' => array(),
1844
- )
1845
- ) . '</div>';
1846
- $output .= '<select name="' . esc_attr( $section_info['feed_type_select']['select_name'] ) . '" id="' . esc_attr( $section_info['feed_type_select']['select_id'] ) . '" class="feed-them-social-admin-input ' . esc_attr( $section_info['feed_type_select']['select_classes'] ) . '">';
1847
- foreach ( $section_info['feeds_types'] as $feed_type_name => $feed_type ) {
1848
- if ( 'main_options' !== $feed_type_name ) {
1849
- $output .= '<option value="' . esc_attr( $feed_type['value'] ) . '">' . esc_html( $feed_type['title'] ) . '</option>';
1850
- }
1851
- }
1852
- $output .= '</select>';
1853
- $output .= '<div class="fts-clear"></div>';
1854
- $output .= '</div><!--/Feed Types Select Div Wrap-->';
1855
- }
1856
-
1857
- // Conversion Input!
1858
- if ( isset( $section_info['conversion_input'] ) ) {
1859
- $output .= '<div class="' . esc_attr( $section_info['conversion_input']['main_wrap_class'] ) . '">';
1860
- $output .= '<h2>' . esc_html( $section_info['conversion_input']['conv_section_title'] ) . '</h2>';
1861
- $output .= '<div class="feed-them-social-admin-input-wrap ' . esc_attr( $section_info['conversion_input']['input_wrap_class'] ) . '">';
1862
- // Instructional Text!
1863
- $output .= '<div class="instructional-text">' . esc_html( $section_info['conversion_input']['instructional-text'] ) . '</div>';
1864
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( $section_info['conversion_input']['label'] ) . '</div>';
1865
- // Input!
1866
- $output .= '<input type="input" name="' . esc_attr( $section_info['conversion_input']['name'] ) . '" id="' . esc_attr( $section_info['conversion_input']['id'] ) . '" class="feed-them-social-admin-input ' . (isset( $section_info['conversion_input']['class'] ) ? esc_attr( $section_info['conversion_input']['class'] ) : '') . '" value="" />';
1867
- $output .= '<div class="fts-clear"></div>';
1868
- $output .= '</div><!--/Conversion Input Wrap-->';
1869
-
1870
- $output .= '<input type="button" class="feed-them-social-admin-submit-btn" value="' . esc_attr( $section_info['conversion_input']['btn-value'] ) . '" onclick="' . esc_js( $section_info['conversion_input']['onclick'] ) . '" tabindex="4" style="margin-right:1em;" />';
1871
- $output .= '</div>';
1872
-
1873
- }
1874
-
1875
- $output .= '</form>';
1876
-
1877
- // Feed Options!
1878
- $output .= '<form class="feed-them-social-admin-form shortcode-generator-form ' . esc_attr( $section_info['form_wrap_classes'] ) . ' ' . esc_attr( $section ) . '_options_wrap">';
1879
-
1880
- // Create settings fields for Feed OPTIONS!
1881
- foreach ( $section_info['main_options'] as $option ) {
1882
- if ( !isset( $option['no_html'] ) || isset( $option['no_html'] ) && 'yes' !== $option['no_html'] ) {
1883
-
1884
- // Is a premium extension required?
1885
- $required_plugin = (!isset( $option['req_plugin'] ) || isset( $option['req_plugin'] ) && is_plugin_active( $required_plugins[$option['req_plugin']]['plugin_url'] ));
1886
- $or_required_plugin = (isset( $option['or_req_plugin'] ) && is_plugin_active( $required_plugins[$option['or_req_plugin']]['plugin_url'] ));
1887
- $or_required_plugin_three = (isset( $option['or_req_plugin_three'] ) && is_plugin_active( $required_plugins[$option['or_req_plugin_three']]['plugin_url'] ));
1888
-
1889
- // Sub option output START?
1890
- $output .= isset( $option['sub_options'] ) ? '<div class="' . esc_attr( $option['sub_options']['sub_options_wrap_class'] ) . (!$required_plugin ? ' not-active-premium-fields' : '') . '">' . (isset( $option['sub_options']['sub_options_title'] ) ? '<h3>' . esc_html( $option['sub_options']['sub_options_title'] ) . '</h3>' : '') . (isset( $option['sub_options']['sub_options_instructional_txt'] ) ? '<div class="instructional-text">' . esc_html( $option['sub_options']['sub_options_instructional_txt'] ) . '</div>' : '') : '';
1891
-
1892
- $output .= isset( $option['grouped_options_title'] ) ? '<h3 class="sectioned-options-title">' . esc_html( $option['grouped_options_title'] ) . '</h3>' : '';
1893
-
1894
- // Only on a few options generally!
1895
- $output .= isset( $option['outer_wrap_class'] ) || isset( $option['outer_wrap_display'] ) ? '<div ' . (isset( $option['outer_wrap_class'] ) ? 'class="' . esc_attr( $option['outer_wrap_class'] ) . '"' : '') . ' ' . (isset( $option['outer_wrap_display'] ) && !empty( $option['outer_wrap_display'] ) ? 'style="display:' . esc_attr( $option['outer_wrap_display'] ) . '"' : '') . '>' : '';
1896
- // Main Input Wrap!
1897
- $output .= '<div class="feed-them-social-admin-input-wrap ' . (isset( $option['input_wrap_class'] ) ? esc_attr( $option['input_wrap_class'] ) : '') . '" ' . (isset( $section_info['input_wrap_id'] ) ? 'id="' . esc_attr( $section_info['input_wrap_id'] ) . '"' : '') . '>';
1898
- // Instructional Text!
1899
- $output .= !empty( $option['instructional-text'] ) && !is_array( $option['instructional-text'] ) ? '<div class="instructional-text ' . (isset( $option['instructional-class'] ) ? esc_attr( $option['instructional-class'] ) : '') . '">' . wp_kses(
1900
- $option['instructional-text'],
1901
- array(
1902
- 'a' => array(
1903
- 'href' => array(),
1904
- 'title' => array(),
1905
- 'target' => array(),
1906
- ),
1907
- 'br' => array(),
1908
- 'em' => array(),
1909
- 'strong' => array(),
1910
- )
1911
- ) . '</div>' : '';
1912
-
1913
- if ( !empty( $option['instructional-text'] ) && is_array( $option['instructional-text'] ) ) {
1914
- foreach ( $option['instructional-text'] as $instructional_txt ) {
1915
- // Instructional Text!
1916
- $output .= '<div class="instructional-text ' . (isset( $instructional_txt['class'] ) ? esc_attr( $instructional_txt['class'] ) : '') . '">' . wp_kses(
1917
- $instructional_txt['text'],
1918
- array(
1919
- 'a' => array(
1920
- 'href' => array(),
1921
- 'title' => array(),
1922
- 'target' => array(),
1923
- ),
1924
- 'br' => array(),
1925
- 'em' => array(),
1926
- 'strong' => array(),
1927
- )
1928
- ) . '</div>';
1929
- }
1930
- }
1931
-
1932
- // Label Text!
1933
- $output .= isset( $option['label'] ) && !is_array( $option['label'] ) ? '<div class="feed-them-social-admin-input-label ' . (isset( $option['label_class'] ) ? esc_attr( $option['label_class'] ) : '') . '">' . wp_kses(
1934
- $option['label'],
1935
- array(
1936
- 'a' => array(
1937
- 'href' => array(),
1938
- 'title' => array(),
1939
- 'target' => array(),
1940
- ),
1941
- 'br' => array(),
1942
- 'em' => array(),
1943
- 'strong' => array(),
1944
- 'small' => array(),
1945
- )
1946
- ) . '</div>' : '';
1947
-
1948
- if ( !empty( $option['label'] ) && is_array( $option['label'] ) ) {
1949
- foreach ( $option['label'] as $label_txt ) {
1950
- // Label Text!
1951
- $output .= '<div class="feed-them-social-admin-input-label ' . (isset( $label_txt['class'] ) ? esc_attr( $label_txt['class'] ) : '') . '">' . wp_kses(
1952
- $label_txt['text'],
1953
- array(
1954
- 'a' => array(
1955
- 'href' => array(),
1956
- 'title' => array(),
1957
- 'target' => array(),
1958
- ),
1959
- 'br' => array(),
1960
- 'em' => array(),
1961
- 'strong' => array(),
1962
- 'small' => array(),
1963
- )
1964
- ) . '</div>';
1965
- }
1966
- }
1967
-
1968
- if ( $required_plugin || $or_required_plugin || $or_required_plugin_three ) {
1969
- // Option_Type = INPUT!
1970
- $output .= isset( $option['option_type'] ) && 'input' === $option['option_type'] ? '<input type="' . esc_attr( $option['type'] ) . '" name="' . esc_attr( $option['name'] ) . '" id="' . esc_attr( $option['id'] ) . '" class="' . (isset( $option['color_picker'] ) && 'yes' === $option['color_picker'] ? 'color {hash:true,caps:false,required:false,adjust:false,pickerFaceColor:\'#eee\',pickerFace:3,pickerBorder:0,pickerInsetColor:\'white\'} ' : '') . 'feed-them-social-admin-input ' . (isset( $option['class'] ) ? esc_attr( $option['class'] ) : '') . '" placeholder="' . (isset( $option['placeholder'] ) ? esc_attr( $option['placeholder'] ) : '') . '" value="' . (isset( $option['value'] ) ? '' . esc_html( $option['value'] ) : '') . '" />' : '';
1971
-
1972
- // Option_Type = Select!
1973
- if ( isset( $option['option_type'] ) && 'select' === $option['option_type'] ) {
1974
- $output .= '<select name="' . esc_attr( $option['name'] ) . '" id="' . esc_attr( $option['id'] ) . '" class="feed-them-social-admin-input">';
1975
- foreach ( $option['options'] as $select_option ) {
1976
- $output .= '<option value="' . esc_html( $select_option['value'] ) . '"' . (isset( $option['default_value'] ) && $option['default_value'] === $select_option['value'] ? ' selected' : '') . '>' . esc_html( $select_option['label'] ) . '</option>';
1977
- }
1978
- $output .= '</select>';
1979
- }
1980
- } else {
1981
- // Create Required Plugin fields!
1982
- $output .= $this->need_fts_premium_plugin_field( $required_plugins[$option['req_plugin']] );
1983
- }
1984
- $output .= '<div class="fts-clear"></div>';
1985
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
1986
-
1987
- $output .= isset( $option['outer_wrap_class'] ) || isset( $option['outer_wrap_display'] ) ? '</div>' : '';
1988
-
1989
- // Sub option output END?
1990
- if ( isset( $option['sub_options_end'] ) ) {
1991
- $output .= !is_numeric( $option['sub_options_end'] ) ? '</div>' : '';
1992
- // Multiple Div needed?
1993
- if ( is_numeric( $option['sub_options_end'] ) ) {
1994
- $x = 1;
1995
- while ($x <= $option['sub_options_end']) {
1996
- $output .= '</div>';
1997
- $x++;
1998
- }
1999
- }
2000
- }
2001
- }
2002
- }
2003
- $output .= $this->generate_shortcode( 'updateTextArea_' . $section . '();', $section_info['generator_title'], $section_info['generator_class'] );
2004
- $output .= '</form>';
2005
-
2006
- $output .= '</div> <!--/Section Wrap Class END (Main-Section-Div)-->';
2007
-
2008
- // Premium Message Boxes!
2009
- if ( isset( $section_info['premium_msg_boxes'] ) ) {
2010
- foreach ( $section_info['premium_msg_boxes'] as $key => $premium_msg ) {
2011
- if ( !is_plugin_active( $required_plugins[$premium_msg['req_plugin']]['plugin_url'] ) ) {
2012
- $output .= '<div class="feed-them-social-admin-input-wrap fts-premium-options-message" id="not_active_' . esc_attr( $key ) . '"><a class="not-active-title" href="' . esc_url( $required_plugins[$premium_msg['req_plugin']]['slick_url'] ) . '" target="_blank">' .
2013
-
2014
- wp_kses(
2015
- $required_plugins[$premium_msg['req_plugin']]['name'],
2016
- array(
2017
- 'h3' => array(),
2018
- )
2019
- ) .
2020
-
2021
- '</a>' . wp_kses(
2022
- $premium_msg['msg'],
2023
- array(
2024
- 'a' => array(
2025
- 'href' => array(),
2026
- 'title' => array(),
2027
- 'target' => array(),
2028
- ),
2029
- 'br' => array(),
2030
- 'em' => array(),
2031
- 'strong' => array(),
2032
- 'small' => array(),
2033
- )
2034
- ) . '</div>';
2035
- }
2036
- }
2037
- }
2038
- }
2039
- return $output;
2040
- }
2041
-
2042
- /**
2043
- * FTS Facebook Page Form
2044
- *
2045
- * @param bool $save_options save options.
2046
- * @since 1.9.6
2047
- */
2048
- public function fts_facebook_page_form ($save_options = false)
2049
- {
2050
- $fts_fb_page_form_nonce = wp_create_nonce( 'fts-facebook-page-form-nonce' );
2051
-
2052
- if ( wp_verify_nonce( $fts_fb_page_form_nonce, 'fts-facebook-page-form-nonce' ) ) {
2053
- if ( $save_options ) {
2054
- $fb_page_id_option = get_option( 'fb_page_id' );
2055
- $fb_page_posts_displayed_option = get_option( 'fb_page_posts_displayed' );
2056
- $fb_page_post_count_option = get_option( 'fb_page_post_count' );
2057
- $fb_page_title_option = get_option( 'fb_page_title_option' );
2058
- $fb_page_description_option = get_option( 'fb_page_description_option' );
2059
- $fb_page_word_count_option = get_option( 'fb_page_word_count_option' );
2060
- $fts_bar_fb_prefix = 'fb_page_';
2061
- $fb_load_more_option = get_option( 'fb_page_fb_load_more_option' );
2062
- $fb_load_more_style = get_option( 'fb_page_fb_load_more_style' );
2063
- $facebook_popup = get_option( 'fb_page_facebook_popup' );
2064
- }
2065
- $output = '<div class="fts-facebook_page-shortcode-form">';
2066
- if ( false === $save_options ) {
2067
- $output = '<form class="feed-them-social-admin-form shortcode-generator-form fb-page-shortcode-form" id="fts-fb-page-form">';
2068
-
2069
- // Check to see if token is in place otherwise show a message letting person no what they need to do!
2070
- $facebook_options = get_option( 'fts_facebook_custom_api_token' ) ? 'Yes' : 'No';
2071
- $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";
2072
- // end custom message for requiring token!
2073
- if ( is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) ) {
2074
- $facebook_options2 = get_option( 'fts_facebook_custom_api_token_biz' ) ? 'Yes' : 'No';
2075
- // Check to see if token is in place otherwise show a message letting person no what they need to do
2076
- // $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";
2077
- // end custom message for requiring token!
2078
- }
2079
-
2080
- $output .= '<h2>' . esc_html( 'Facebook Page Shortcode Generator', 'feed-them-social' ) . '</h2>';
2081
- }
2082
- $fb_page_id_option = isset( $fb_page_id_option ) ? $fb_page_id_option : '';
2083
- // ONLY SHOW SUPER GALLERY OPTIONS ON FTS SETTINGS PAGE FOR NOW, NOT FTS BAR!
2084
- if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2085
- // FACEBOOK FEED TYPE!
2086
- $output .= '<div class="feed-them-social-admin-input-wrap" id="fts-social-selector">';
2087
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Feed Type', 'feed-them-social' ) . '</div>';
2088
- $output .= '<select name="facebook-messages-selector" id="facebook-messages-selector" class="feed-them-social-admin-input">';
2089
- $output .= '<option value="page">' . esc_html( 'Facebook Page', 'feed-them-social' ) . '</option>';
2090
- $output .= '<option value="events">' . esc_html( 'Facebook Page List of Events', 'feed-them-social' ) . '</option>';
2091
- $output .= '<option value="event">' . esc_html( 'Facebook Page Single Event Posts', 'feed-them-social' ) . '</option>';
2092
- $output .= '<option value="group">' . esc_html( 'Facebook Group', 'feed-them-social' ) . '</option>';
2093
- $output .= '<option value="album_photos">' . esc_html( 'Facebook Album Photos', 'feed-them-social' ) . '</option>';
2094
- $output .= '<option value="albums">' . esc_html( 'Facebook Album Covers', 'feed-them-social' ) . '</option>';
2095
- $output .= '<option value="album_videos">' . esc_html( 'Facebook Videos', 'feed-them-social' ) . '</option>';
2096
- $output .= '<option value="reviews">' . esc_html( 'Facebook Page Reviews', 'feed-them-social' ) . '</option>';
2097
- $output .= '</select>';
2098
- $output .= '<div class="fts-clear"></div>';
2099
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2100
- };
2101
- // INSTRUCTIONAL TEXT FOR FACEBOOK TYPE SELECTION. PAGE, GROUP, EVENT, ALBUMS, ALBUM COVERS AND HASH TAGS!
2102
- $output .= '<div class="instructional-text facebook-message-generator page inst-text-facebook-page" style="display:block;">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-facebook-page-vanity-url/" target="_blank">' . esc_html( 'Facebook Page ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below. You cannot use Personal Profiles it must be a Facebook Page. If your page ID looks something like, My-Page-Name-50043151918, only use the number portion, 50043151918.', 'feed-them-social' ) . ' <a href="https://feedthemsocial.com/?feedID=50043151918" target="_blank">' . esc_html( 'Test your Page ID on our demo', 'feed-them-social' ) . '</a></div>
2103
  <div class="instructional-text facebook-message-generator group inst-text-facebook-group">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-facebook-group-id/" target="_blank">' . esc_html( 'Facebook Group ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below.', 'feed-them-social' ) . '</div>
2104
  <div class="instructional-text facebook-message-generator event-list inst-text-facebook-event-list">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-facebook-event-id/" target="_blank">' . esc_html( 'Facebook Event ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below. PLEASE NOTE: This will only work with Facebook Page Events and you cannot have more than 25 events on Facebook.', 'feed-them-social' ) . '</div>
2105
  <div class="instructional-text facebook-message-generator event inst-text-facebook-event">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-facebook-event-id/" target="_blank">' . esc_html( 'Facebook Event ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below.', 'feed-them-social' ) . '</div>
2106
  <div class="instructional-text facebook-message-generator album_photos inst-text-facebook-album-photos">' . esc_html( 'To show a specific Album copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/docs/how-to-get-your-facebook-photo-gallery-id/" target="_blank">' . esc_html( 'Facebook Album ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the second input below. If you want to show all your uploaded photos leave the Album ID input blank.', 'feed-them-social' ) . '</div>
2107
  <div class="instructional-text facebook-message-generator albums inst-text-facebook-albums">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/docs/how-to-get-your-facebook-photo-gallery-id/" target="_blank">' . esc_html( 'Facebook Album Covers ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below.', 'feed-them-social' ) . '</div>
2108
  <div class="instructional-text facebook-message-generator video inst-text-facebook-video">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/docs/how-to-get-your-facebook-id-and-video-gallery-id" target="_blank">' . esc_html( 'Facebook ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below.', 'feed-them-social' ) . '</div>';
2109
- if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2110
- // this is for the facebook videos!
2111
- $output .= '<div class="feed-them-social-admin-input-wrap fts-premium-options-message" style="display:none;"><a target="_blank" href="http://www.slickremix.com/downloads/feed-them-social-premium-extension/">Premium Version Required</a><br/>The Facebook video feed allows you to view your uploaded videos from facebook. See these great examples and options of all the different ways you can bring new life to your WordPress site!<br/><a href="https://feedthemsocial.com/facebook-videos-demo/" target="_blank">View Demo</a><br/><br/>Additionally if you purchase the Carousel Plugin you can showcase your videos in a slideshow or carousel. Works with your Facebook Photos too!<br/><a href="https://feedthemsocial.com/facebook-carousels/" target="_blank">View Carousel Demo</a> </div>';
2112
- // this is for the facebook reviews!
2113
- $output .= '<div class="feed-them-social-admin-input-wrap fts-premium-options-message2" style="display:none;"><a target="_blank" href="http://www.slickremix.com/downloads/feed-them-social-facebook-reviews/">Facebook Reviews Required</a><br/>The Facebook Reviews feed allows you to view all of the reviews people have made on your Facebook Page. See these great examples and options of all the different ways you can display your Facebook Page Reviews on your website. <a href="https://feedthemsocial.com/facebook-page-reviews-demo/" target="_blank">View Demo</a></div>';
2114
- }
2115
- // FACEBOOK PAGE ID!
2116
- if ( isset( $_GET['page'] ) && 'fts-bar-settings-page' !== $_GET['page'] ) {
2117
- $output .= '<div class="fb-options-wrap">';
2118
- }
2119
- $output .= '<div class="feed-them-social-admin-input-wrap fb_page_id ">';
2120
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Facebook ID (required)', 'feed-them-social' ) . '</div>';
2121
- $output .= '<input type="text" name="fb_page_id" id="fb_page_id" class="feed-them-social-admin-input" value="' . esc_html( $fb_page_id_option ) . '" />';
2122
- $output .= '<div class="fts-clear"></div>';
2123
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2124
- // FACEBOOK ALBUM PHOTOS ID!
2125
- $output .= '<div class="feed-them-social-admin-input-wrap fb_album_photos_id" style="display:none;">';
2126
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Album ID ', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Leave blank to show all uploaded photos', 'feed-them-social' ) . '</small></div>';
2127
- $output .= '<input type="text" name="fb_album_id" id="fb_album_id" class="feed-them-social-admin-input" value="" />';
2128
- $output .= '<div class="fts-clear"></div>';
2129
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2130
- $fb_page_posts_displayed_option = isset( $fb_page_posts_displayed_option ) ? $fb_page_posts_displayed_option : '';
2131
- // FACEBOOK PAGE POST TYPE VISIBLE!
2132
- $output .= '<div class="feed-them-social-admin-input-wrap facebook-post-type-visible">';
2133
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Post Type Visible', 'feed-them-social' ) . '</div>';
2134
- $output .= '<select name="fb_page_posts_displayed" id="fb_page_posts_displayed" class="feed-them-social-admin-input">';
2135
- $output .= '<option ' . selected( $fb_page_posts_displayed_option, 'page_only', false ) . ' value="page_only">' . esc_html( 'Display Posts made by Page only', 'feed-them-social' ) . '</option>';
2136
- $output .= '<option ' . selected( $fb_page_posts_displayed_option, 'page_and_others', false ) . ' value="page_and_others">' . esc_html( 'Display Posts made by Page and Others', 'feed-them-social' ) . '</option>';
2137
- $output .= '</select>';
2138
- $output .= '<div class="fts-clear"></div>';
2139
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2140
-
2141
- $fb_page_post_count_option = isset( $fb_page_post_count_option ) ? $fb_page_post_count_option : '';
2142
- $output .= '<div class="feed-them-social-admin-input-wrap">';
2143
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( '# of Posts', 'feed-them-premium' );
2144
-
2145
- if ( !is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) || !is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) ) {
2146
- $output .= '<br/><small>' . esc_html( 'More than 6 Requires <a target="_blank" href="http://www.slickremix.com/downloads/feed-them-social-premium-extension/">Premium version</a>', 'feed-them-premium' ) . '</small>';
2147
- }
2148
- $output .= '</div>';
2149
- $output .= '<input type="text" name="fb_page_post_count" id="fb_page_post_count" class="feed-them-social-admin-input" value="' . esc_html( $fb_page_post_count_option ) . '" placeholder="5 ' . esc_html( 'is the default number', 'feed-them-premium' ) . '" />';
2150
- $output .= '<div class="fts-clear"></div>';
2151
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2152
-
2153
- // ONLY SHOW SUPER GALLERY OPTIONS ON FTS SETTINGS PAGE FOR NOW, NOT FTS BAR!
2154
- if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2155
- // FACEBOOK HEIGHT OPTION!
2156
- $output .= '<div class="feed-them-social-admin-input-wrap twitter_name fixed_height_option">';
2157
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Facebook Fixed Height', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Leave blank for auto height', 'feed-them-social' ) . '</small></div>';
2158
- $output .= '<input type="text" name="facebook_page_height" id="facebook_page_height" class="feed-them-social-admin-input" value="" placeholder="450px ' . esc_html( 'for example', 'feed-them-social' ) . '" />';
2159
- $output .= '<div class="fts-clear"></div>';
2160
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2161
- }
2162
-
2163
- if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && !is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) ) {
2164
-
2165
- include $this->premium . 'admin/facebook-page-settings-fields.php';
2166
- if ( isset( $_GET['page'] ) && 'fts-bar-settings-page' === $_GET['page'] ) {
2167
- // PREMIUM LOAD MORE SETTINGS & LOADS in FTS BAR!
2168
- include $this->premium . 'admin/facebook-loadmore-settings-fields.php';
2169
- }
2170
- } elseif ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) ) {
2171
-
2172
- // these are the new options for reviews only!
2173
- include $this->facebook_reviews . 'admin/facebook-review-settings-fields.php';
2174
-
2175
- include $this->premium . 'admin/facebook-page-settings-fields.php';
2176
- if ( isset( $_GET['page'] ) && 'fts-bar-settings-page' === $_GET['page'] ) {
2177
- // PREMIUM LOAD MORE SETTINGS & LOADS in FTS BAR!
2178
- include $this->premium . 'admin/facebook-loadmore-settings-fields.php';
2179
- }
2180
- } elseif ( is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) && !is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2181
- // include($this->facebook_reviews.'admin/facebook-page-settings-fields.php');
2182
- // these are the new options for reviews only!
2183
- include $this->facebook_reviews . 'admin/facebook-review-settings-fields.php';
2184
-
2185
- // these are the additional options only for reviews from premium!
2186
- include $this->facebook_reviews . 'admin/facebook-loadmore-settings-fields.php';
2187
-
2188
- // Create Need Premium Fields!
2189
- $fields = array(
2190
- esc_html( 'Show the Page Title', 'feed-them-social' ),
2191
- esc_html( 'Align Title', 'feed-them-social' ),
2192
- esc_html( 'Show the Page Description', 'feed-them-social' ),
2193
- esc_html( 'Amount of words per post', 'feed-them-social' ),
2194
- esc_html( 'Load More Posts', 'feed-them-social' ),
2195
- esc_html( 'Display Photos in Popup', 'feed-them-social' ),
2196
- esc_html( 'Display Posts in Grid', 'feed-them-social' ),
2197
- esc_html( 'Center Grid', 'feed-them-social' ),
2198
- esc_html( 'Grid Stack Animation', 'feed-them-social' ),
2199
- esc_html( 'Hide Like Button or Box', 'feed-them-social' ),
2200
- esc_html( 'Like Box Width', 'feed-them-social' ),
2201
- esc_html( 'Position Like Box', 'feed-them-social' ),
2202
- esc_html( 'Align Like Button or Box', 'feed-them-social' ),
2203
- );
2204
- $output .= '<div class="need-for-premium-fields-wrap">';
2205
- $output .= $this->need_fts_premium_fields( $fields );
2206
- $output .= '</div>';
2207
- } else {
2208
-
2209
- // Create Need Premium Fields!
2210
- $fields = array(
2211
- esc_html( 'Show the Page Title', 'feed-them-social' ),
2212
- esc_html( 'Align Title', 'feed-them-social' ),
2213
- esc_html( 'Show the Page Description', 'feed-them-social' ),
2214
- esc_html( 'Amount of words per post', 'feed-them-social' ),
2215
- esc_html( 'Load More Posts', 'feed-them-social' ),
2216
- esc_html( 'Display Photos in Popup', 'feed-them-social' ),
2217
- esc_html( 'Display Posts in Grid', 'feed-them-social' ),
2218
- esc_html( 'Center Grid', 'feed-them-social' ),
2219
- esc_html( 'Grid Stack Animation', 'feed-them-social' ),
2220
- esc_html( 'Hide Like Button or Box', 'feed-them-social' ),
2221
- esc_html( 'Like Box Width', 'feed-them-social' ),
2222
- esc_html( 'Position Like Box', 'feed-them-social' ),
2223
- esc_html( 'Align Like Button or Box', 'feed-them-social' ),
2224
- );
2225
- $output .= $this->need_fts_premium_fields( $fields );
2226
- }
2227
- // ONLY SHOW SUPER GALLERY OPTIONS ON FTS SETTINGS PAGE FOR NOW, NOT FTS BAR!
2228
- if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2229
- // SUPER FACEBOOK GALLERY OPTIONS!
2230
- $output .= '<div class="fts-super-facebook-options-wrap" style="display:none">';
2231
- // FACEBOOK IMAGE HEIGHT!
2232
- $output .= '<div class="feed-them-social-admin-input-wrap facebook_name"><div class="feed-them-social-admin-input-label">' . esc_html( 'Facebook Image Width', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Max width is 640px', 'feed-them-social' ) . '</small></div>
2233
  <input type="text" name="fts-slicker-instagram-container-image-width" id="fts-slicker-facebook-container-image-width" class="feed-them-social-admin-input" value="250px" placeholder="">
2234
  <div class="fts-clear"></div> </div>';
2235
- // FACEBOOK IMAGE WIDTH!
2236
- $output .= '<div class="feed-them-social-admin-input-wrap facebook_name"><div class="feed-them-social-admin-input-label">' . esc_html( 'Facebook Image Height', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Max width is 640px', 'feed-them-social' ) . '</small></div>
2237
  <input type="text" name="fts-slicker-instagram-container-image-height" id="fts-slicker-facebook-container-image-height" class="feed-them-social-admin-input" value="250px" placeholder="">
2238
  <div class="fts-clear"></div> </div>';
2239
- // FACEBOOK SPACE BETWEEN PHOTOS!
2240
- $output .= '<div class="feed-them-social-admin-input-wrap facebook_name"><div class="feed-them-social-admin-input-label">' . esc_html( 'The space between photos', 'feed-them-social' ) . '</div>
2241
  <input type="text" name="fts-slicker-facebook-container-margin" id="fts-slicker-facebook-container-margin" class="feed-them-social-admin-input" value="1px" placeholder="">
2242
  <div class="fts-clear"></div></div>';
2243
- // HIDE DATES, LIKES AND COMMENTS ETC!
2244
- $output .= '<div class="feed-them-social-admin-input-wrap facebook_name"><div class="feed-them-social-admin-input-label">' . esc_html( 'Hide Date, Likes and Comments', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Good for image sizes under 120px', 'feed-them-social' ) . '</small></div>
2245
  <select id="fts-slicker-facebook-container-hide-date-likes-comments" name="fts-slicker-facebook-container-hide-date-likes-comments" class="feed-them-social-admin-input">
2246
  <option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option><option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option></select><div class="fts-clear"></div></div>';
2247
 
2248
- // CENTER THE FACEBOOK CONTAINER!
2249
- $output .= '<div class="feed-them-social-admin-input-wrap" id="facebook_super_gallery_container"><div class="feed-them-social-admin-input-label">' . esc_html( 'Center Facebook Container', 'feed-them-social' ) . '</div>
2250
  <select id="fts-slicker-facebook-container-position" name="fts-slicker-facebook-container-position" class="feed-them-social-admin-input"><option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option><option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option></select><div class="fts-clear"></div></div>';
2251
- // ANIMATE PHOTO POSITIONING!
2252
- $output .= ' <div class="feed-them-social-admin-input-wrap" id="facebook_super_gallery_animate"><div class="feed-them-social-admin-input-label">' . esc_html( 'Image Stacking Animation On', 'feed-them-social' ) . '<br/><small>' . esc_html( 'This happens when resizing browsert', 'feed-them-social' ) . '</small></div>
2253
  <select id="fts-slicker-facebook-container-animation" name="fts-slicker-facebook-container-animation" class="feed-them-social-admin-input"><option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option><option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option></select><div class="fts-clear"></div></div>';
2254
- // POSITION IMAGE LEFT RIGHT!
2255
- $output .= '<div class="instructional-text" style="display: block;">' . esc_html( 'These options allow you to make the thumbnail larger if you do not want to see black bars above or below your photos.', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/docs/fit-thumbnail-on-facebook-galleries/" target="_blank">' . esc_html( 'View Examples', 'feed-them-social' ) . '</a> ' . esc_html( 'and simple details or leave default options.', 'feed-them-social' ) . '</div>
2256
  <div class="feed-them-social-admin-input-wrap facebook_name"><div class="feed-them-social-admin-input-label">' . esc_html( 'Make photo larger', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Helps with blackspace', 'feed-them-social' ) . '</small></div>
2257
  <input type="text" id="fts-slicker-facebook-image-position-lr" name="fts-slicker-facebook-image-position-lr" class="feed-them-social-admin-input" value="-0%" placeholder="eg. -50%. -0% ' . esc_html( 'is default', 'feed-them-social' ) . '">
2258
  <div class="fts-clear"></div></div>';
2259
- // POSITION IMAGE TOP!
2260
- $output .= ' <div class="feed-them-social-admin-input-wrap facebook_name"><div class="feed-them-social-admin-input-label">' . esc_html( 'Image Position Top', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Helps center image', 'feed-them-social' ) . '</small></div>
2261
  <input type="text" id="fts-slicker-facebook-image-position-top" name="fts-slicker-facebook-image-position-top" class="feed-them-social-admin-input" value="-0%" placeholder="eg. -10%. -0% ' . esc_html( 'is default', 'feed-them-social' ) . '">
2262
  <div class="fts-clear"></div></div>';
2263
- $output .= '</div><!--fts-super-facebook-options-wrap-->';
2264
-
2265
- if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2266
- // PREMIUM LOAD MORE SETTINGS!
2267
- include $this->premium . 'admin/facebook-loadmore-settings-fields.php';
2268
- }
2269
-
2270
- // Slideshow Carousel Options!
2271
- $output .= '<div class="slideshow-wrap" style="display: none;">';
2272
- $output .= '<div class="instructional-text" style="display: block;">' . esc_html( 'Create a Carousel or Slideshow with these options.', 'feed-them-social' ) . ' <a href="https://feedthemsocial.com/facebook-carousels-or-sliders/" target="_blank">' . esc_html( 'View Demos', 'feed-them-social' ) . '</a> ' . esc_html( 'and copy easy to use shortcode examples.', 'feed-them-social' ) . '</div>';
2273
-
2274
- if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && is_plugin_active( 'feed-them-carousel-premium/feed-them-carousel-premium.php' ) ) {
2275
- include $this->facebook_carousel_premium . 'admin/facebook-carousel-options-settings-page.php';
2276
- } else {
2277
- // if slider plugin is active!
2278
- $output .= '<div class="feed-them-social-admin-input-wrap facebook_name"><div class="feed-them-social-admin-input-label">' . esc_html( 'Carousel or Slideshow', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Many more options when active', 'feed-them-social' ) . '</small></div>
2279
  <div class="feed-them-social-admin-input-default" style="display: block !important;">' . esc_html( 'Must have ', 'feed-them-social' ) . ' <a target="_blank" href="http://www.slickremix.com/downloads/feed-them-social-premium-extension/">' . esc_html( 'premium', 'feed-them-social' ) . '</a> ' . esc_html( 'and', 'feed-them-social' ) . ' <a target="_blank" href="http://www.slickremix.com/downloads/feed-them-carousel-premium/">' . esc_html( 'carousel', 'feed-them-social' ) . '</a> ' . esc_html( 'plugin ', 'feed-them-social' ) . '</a> ' . esc_html( 'to edit.', 'feed-them-social' ) . '</div> <div class="fts-clear"></div></div>';
2280
- }
2281
-
2282
- // end slideshow wrap!
2283
- $output .= '</div>';
2284
-
2285
- }
2286
- if ( $save_options ) {
2287
- $output .= '<input type="submit" class="feed-them-social-admin-submit-btn" value="Save Changes" />';
2288
- } else {
2289
- $output .= $this->generate_shortcode( 'updateTextArea_fb_page();', 'Facebook Page Feed Shortcode', 'facebook-page-final-shortcode' );
2290
- if ( isset( $_GET['page'] ) && 'fts-bar-settings-page' !== $_GET['page'] ) {
2291
- $output .= '</div>';
2292
- // END fb-options-wrap!
2293
- }
2294
- $output .= '</form>';
2295
- }
2296
- $output .= '</div><!--/fts-facebook_page-shortcode-form-->';
2297
- }
2298
- return $output;
2299
- }
2300
-
2301
- /**
2302
- * FTS Twitter Form
2303
- *
2304
- * @param bool $save_options save options.
2305
- * @since 1.9.6
2306
- */
2307
- public function fts_twitter_form ($save_options = false)
2308
- {
2309
- $fts_twitter_form_nonce = wp_create_nonce( 'fts-twitter-form-nonce' );
2310
-
2311
- if ( wp_verify_nonce( $fts_twitter_form_nonce, 'fts-twitter-form-nonce' ) ) {
2312
-
2313
- if ( $save_options ) {
2314
- $twitter_name_option = get_option( 'twitter_name' );
2315
- $tweets_count_option = get_option( 'tweets_count' );
2316
- $twitter_popup_option = get_option( 'twitter_popup_option' );
2317
- $twitter_hashtag_etc_name = get_option( 'twitter_hashtag_etc_name' );
2318
- $twitter_load_more_option = get_option( 'twitter_load_more_option' );
2319
- }
2320
-
2321
- $twitter_name_option = isset( $twitter_name_option ) ? $twitter_name_option : '';
2322
- $tweets_count_option = isset( $tweets_count_option ) ? $tweets_count_option : '';
2323
- $twitter_hashtag_etc_name = isset( $twitter_hashtag_etc_name ) ? $twitter_hashtag_etc_name : '';
2324
- $output = '<div class="fts-twitter-shortcode-form">';
2325
- if ( false === $save_options ) {
2326
- $output .= '<form class="feed-them-social-admin-form shortcode-generator-form twitter-shortcode-form" id="fts-twitter-form">';
2327
-
2328
- // Check to see if token is in place otherwise show a message letting person no what they need to do!
2329
- $twitter_options4 = get_option( 'fts_twitter_custom_access_token_secret' ) ? 'Yes' : 'No';
2330
- $output .= isset( $twitter_options4 ) && 'No' !== $twitter_options4 ? '' . "\n" : '<div class="feed-them-social-admin-input-wrap fts-required-token-message">Please add Twitter API Tokens to our <a href="admin.php?page=fts-twitter-feed-styles-submenu-page">Twitter Options</a> page before trying to view your feed.</div>' . "\n";
2331
- // end custom message for requiring token!
2332
- $output .= '<h2>' . esc_html( 'Twitter Shortcode Generator', 'feed-them-social' ) . '</h2>';
2333
- }
2334
-
2335
- // TWITTER FEED TYPE!
2336
- $output .= '<div class="feed-them-social-admin-input-wrap twitter-gen-selection">';
2337
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Feed Type', 'feed-them-social' ) . '</div>';
2338
- $output .= '<select name="twitter-messages-selector" id="twitter-messages-selector" class="feed-them-social-admin-input">';
2339
- $output .= '<option value="user">' . esc_html( 'User Feed', 'feed-them-social' ) . '</option>';
2340
- $output .= '<option value="hashtag">' . esc_html( '#hashtag, @person, or single words', 'feed-them-social' ) . '</option>';
2341
- $output .= '</select>';
2342
- $output .= '<div class="fts-clear"></div>';
2343
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2344
-
2345
- $output .= '<div class="twitter-hashtag-etc-wrap">';
2346
- $output .= '<h3>' . esc_html( 'Twitter Search', 'feed-them-social' ) . '</h3>';
2347
- $output .= '<div class="instructional-text">';
2348
- $output .= sprintf(
2349
- esc_html( 'You can use #hashtag, @person, or single words. For example, weather or weather-channel.%1$sIf you want to filter a specific users hashtag copy this example into the first input below and replace the user_name and YourHashtag name. DO NOT remove the from: or %# characters. NOTE: Only displays last 7 days worth of Tweets. %2$sfrom:user_name%#YourHashtag%3$s', 'feed-them-social' ),
2350
- '<br/><br/>',
2351
- '<strong style="color:#225DE2;">',
2352
- '</strong>'
2353
- );
2354
- $output .= '</div>';
2355
- $output .= '<div class="feed-them-social-admin-input-wrap twitter_hashtag_etc_name">';
2356
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Twitter Search Name (required)', 'feed-them-social' ) . '</div>';
2357
- $output .= '<input type="text" name="twitter_hashtag_etc_name" id="twitter_hashtag_etc_name" class="feed-them-social-admin-input" value="' . esc_html( $twitter_hashtag_etc_name ) . '" />';
2358
- $output .= '<div class="fts-clear"></div>';
2359
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2360
- $output .= '</div><!--/twitter-hashtag-etc-wrap-->';
2361
-
2362
- $output .= '<div class="instructional-text"><span class="hashtag-option-small-text">' . esc_html( 'Twitter Name is only required if you want to show a', 'feed-them-social' ) . ' <a href="admin.php?page=fts-twitter-feed-styles-submenu-page">' . esc_html( 'Follow Button', 'feed-them-social' ) . '</a>.</span><span class="must-copy-twitter-name">' . esc_html( 'You must copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-twitter-name/" target="_blank">' . esc_html( 'Twitter Name', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below.', 'feed-them-social' ) . '</span></div>';
2363
- $output .= '<div class="feed-them-social-admin-input-wrap twitter_name">';
2364
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Twitter Name', 'feed-them-social' ) . ' <span class="hashtag-option-not-required">' . esc_html( '(required)', 'feed-them-social' ) . '</span></div>';
2365
- $output .= '<input type="text" name="twitter_name" id="twitter_name" class="feed-them-social-admin-input" value="' . esc_html( $twitter_name_option ) . '" />';
2366
- $output .= '<div class="fts-clear"></div>';
2367
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2368
-
2369
- $output .= '<div class="feed-them-social-admin-input-wrap">';
2370
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( '# of Tweets (optional)', 'feed-them-premium' );
2371
- if ( !is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2372
- $output .= sprintf(
2373
- esc_html( '%1$s More than 6 Requires the %2$sPremium Extension%3$s', 'feed-them-social' ),
2374
- '<br/><small>',
2375
- '<a target="_blank" href="' . esc_url( 'http://www.slickremix.com/downloads/feed-them-social-premium-extension/' ) . '">',
2376
- '</a></small>'
2377
- );
2378
- }
2379
- $output .= '</div>';
2380
- $output .= '<input type="text" name="tweets_count" id="tweets_count" placeholder="5 is the default number" class="feed-them-social-admin-input" value="' . esc_html( $tweets_count_option ) . '" />';
2381
- $output .= '<div class="fts-clear"></div>';
2382
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2383
-
2384
- if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2385
- $output .= '<div class="feed-them-social-admin-input-wrap">';
2386
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Twitter Fixed Height', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Leave blank for auto height', 'feed-them-social' ) . '</small></div>';
2387
- $output .= '<input type="text" name="twitter_height" id="twitter_height" class="feed-them-social-admin-input" value="" placeholder="450px ' . esc_html( 'for example', 'feed-them-social' ) . '" />';
2388
- $output .= '<div class="fts-clear"></div>';
2389
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2390
- }
2391
-
2392
- $output .= '<div class="feed-them-social-admin-input-wrap">';
2393
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Show Retweets', 'feed-them-social' ) . '</div>';
2394
- $output .= '<select name="twitter-show-retweets" id="twitter-show-retweets" class="feed-them-social-admin-input">';
2395
- $output .= '<option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option>';
2396
- $output .= '<option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option>';
2397
- $output .= '</select>';
2398
- $output .= '<div class="fts-clear"></div>';
2399
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2400
-
2401
- if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2402
- include $this->premium . 'admin/twitter-settings-fields.php';
2403
- } else {
2404
- // Create Need Premium Fields!
2405
- $fields = array(
2406
- __( 'Display Photos in Popup', 'feed-them-social' ),
2407
- );
2408
- $output .= $this->need_fts_premium_fields( $fields );
2409
- }
2410
- if ( $save_options ) {
2411
- $output .= '<input type="submit" class="feed-them-social-admin-submit-btn" value="' . esc_html( 'Save Changes', 'feed-them-social' ) . '" />';
2412
- } else {
2413
- $output .= $this->generate_shortcode( 'updateTextArea_twitter();', 'Twitter Feed Shortcode', 'twitter-final-shortcode' );
2414
- $output .= '</form>';
2415
- }
2416
- $output .= '</div><!--/fts-twitter-shortcode-form-->';
2417
- }
2418
-
2419
- return $output;
2420
- }
2421
-
2422
- /**
2423
- * FTS Instagram Form
2424
- *
2425
- * @param bool $save_options save options.
2426
- * @since 1.9.7
2427
- */
2428
- public function fts_instagram_form ($save_options = false)
2429
- {
2430
- $fts_instagram_form_nonce = wp_create_nonce( 'fts-instagram-form-nonce' );
2431
-
2432
- if ( wp_verify_nonce( $fts_instagram_form_nonce, 'fts-instagram-form-nonce' ) ) {
2433
-
2434
- if ( $save_options ) {
2435
- $instagram_name_option = get_option( 'convert_instagram_username' );
2436
- $instagram_id_option = get_option( 'instagram_id' );
2437
- $pics_count_option = get_option( 'pics_count' );
2438
- $instagram_popup_option = get_option( 'instagram_popup_option' );
2439
- $instagram_load_more_option = get_option( 'instagram_load_more_option' );
2440
- }
2441
- $output = '<div class="fts-instagram-shortcode-form">';
2442
- if ( false === $save_options ) {
2443
- $output .= '<form class="feed-them-social-admin-form shortcode-generator-form instagram-shortcode-form" id="fts-instagram-form">';
2444
-
2445
- // Check to see if token is in place otherwise show a message letting person no what they need to do!
2446
- $instagram_options = get_option( 'fts_instagram_custom_api_token' ) ? 'Yes' : 'No';
2447
- $output .= isset( $instagram_options ) && 'No' !== $instagram_options ? '' . "\n" : '<div class="feed-them-social-admin-input-wrap fts-required-token-message">Please get your Access Token on the <a href="admin.php?page=fts-instagram-feed-styles-submenu-page">Instagram Options</a> page or you won\'t be able to view your photos.</div>' . "\n";
2448
- // end custom message for requiring token!
2449
- // ONLY SHOW SUPER GALLERY OPTIONS ON FTS SETTINGS PAGE FOR NOW, NOT FTS BAR!
2450
- if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2451
- // INSTAGRAM FEED TYPE!
2452
- $output .= '<h2>' . esc_html( 'Instagram Shortcode Generator', 'feed-them-social' ) . '</h2><div class="feed-them-social-admin-input-wrap instagram-gen-selection">';
2453
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Feed Type', 'feed-them-social' ) . '</div>';
2454
- $output .= '<select name="instagram-messages-selector" id="instagram-messages-selector" class="feed-them-social-admin-input">';
2455
- $output .= '<option value="user">' . esc_html( 'User Feed', 'feed-them-social' ) . '</option>';
2456
- $output .= '<option value="hashtag">' . esc_html( 'Hashtag Feed', 'feed-them-social' ) . '</option>';
2457
- $output .= '</select>';
2458
- $output .= '<div class="fts-clear"></div>';
2459
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2460
- };
2461
- $output .= '<div class="instagram-id-option-wrap">';
2462
- $output .= '<h3>' . esc_html( 'Convert Instagram Name to ID', 'feed-them-social' ) . '</h3>';
2463
- }
2464
- $instagram_name_option = isset( $instagram_name_option ) ? $instagram_name_option : '';
2465
- $instagram_id_option = isset( $instagram_id_option ) ? $instagram_id_option : '';
2466
- $output .= '<div class="instructional-text">' . esc_html( 'You must copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-instagram-name-and-convert-to-id/" target="_blank">' . esc_html( 'Instagram Name', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below', 'feed-them-social' ) . '</div>';
2467
- $output .= '<div class="feed-them-social-admin-input-wrap convert_instagram_username">';
2468
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Instagram Name (required)', 'feed-them-social' ) . '</div>';
2469
- $output .= '<input type="text" id="convert_instagram_username" name="convert_instagram_username" class="feed-them-social-admin-input" value="' . esc_html( $instagram_name_option ) . '" />';
2470
- $output .= '<div class="fts-clear"></div>';
2471
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2472
- $output .= '<input type="button" class="feed-them-social-admin-submit-btn" value="' . esc_html( 'Convert Instagram Username', 'feed-them-social' ) . '" onclick="converter_instagram_username();" tabindex="4" style="margin-right:1em;" />';
2473
- // ONLY THIS DIV IF ON OUR SETTINGS PAGE!
2474
- if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2475
- $output .= '</div><!--instagram-id-option-wrap-->';
2476
- };
2477
- if ( false === $save_options ) {
2478
- $output .= '</form>';
2479
- }
2480
- if ( false === $save_options ) {
2481
- $output .= '<form class="feed-them-social-admin-form shortcode-generator-form instagram-shortcode-form">';
2482
- }
2483
- $output .= '<div class="instructional-text instagram-user-option-text" style="margin-top:12px;"><div class="fts-insta-info-plus-wrapper">' . esc_html( 'Choose a different ID if yours is not the first name below after clicking Convert Instagram Username button.', 'feed-them-social' ) . '</div><!-- the li list comes from an ajax call after looking up the user ID --><ul id="fts-instagram-username-picker-wrap" class="fts-instagram-username-picker-wrap"></ul></div>';
2484
- $output .= '<div class="instructional-text instagram-hashtag-option-text" style="display:none;margin-top:12px;">' . esc_html( 'Add your Hashtag below. Do not add the #, just the name.', 'feed-them-social' ) . '</div>';
2485
- $output .= '<div class="feed-them-social-admin-input-wrap instagram_name">';
2486
- $output .= '<div class="feed-them-social-admin-input-label instagram-user-option-text">' . esc_html( 'Instagram ID # (required)', 'feed-them-social' ) . '</div>';
2487
- $output .= '<div class="feed-them-social-admin-input-label instagram-hashtag-option-text" style="display:none;">' . esc_html( 'Hashtag (required)', 'feed-them-social' ) . '</div>';
2488
- $output .= '<input type="text" name="instagram_id" id="instagram_id" class="feed-them-social-admin-input" value="' . esc_html( $instagram_id_option ) . '" />';
2489
- $output .= '<div class="fts-clear"></div>';
2490
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2491
- // Super Instagram Options!
2492
- $pics_count_option = isset( $pics_count_option ) ? $pics_count_option : '';
2493
- // Pic Count Option!
2494
- $output .= '<div class="feed-them-social-admin-input-wrap">';
2495
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( '# of Pics (optional)', 'feed-them-premium' );
2496
- if ( !is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2497
- $output .= sprintf(
2498
- esc_html( '%1$s More than 6 Requires the %2$sPremium Extension%3$s', 'feed-them-social' ),
2499
- '<br/><small>',
2500
- '<a target="_blank" href="' . esc_url( 'http://www.slickremix.com/downloads/feed-them-social-premium-extension/' ) . '">',
2501
- '</a></small>'
2502
- );
2503
- }
2504
- $output .= '</div>';
2505
- $output .= '<input type="text" name="pics_count" id="pics_count" class="feed-them-social-admin-input" value="' . esc_html( $pics_count_option ) . '" placeholder="6 is the default number" />';
2506
- $output .= '<div class="fts-clear"></div>';
2507
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2508
-
2509
- if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2510
-
2511
- $output .= '<div class="feed-them-social-admin-input-wrap">';
2512
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Super Instagram Gallery', 'feed-them-social' ) . '</div>';
2513
- $output .= '<select id="instagram-custom-gallery" name="instagram-custom-gallery" class="feed-them-social-admin-input"><option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option><option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option></select>';
2514
- $output .= '<div class="fts-clear"></div>';
2515
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2516
- $output .= '<div class="feed-them-social-admin-input-wrap"><div class="feed-them-social-admin-input-label">' . esc_html( 'Instagram Image Size', 'feed-them-social' ) . '<br/><small><a href="https://feedthemsocial.com/instagram-feed-demo/" target="_blank">' . esc_html( 'View demo', 'feed-them-social' ) . '</a></small></div>
2517
  <input type="text" name="fts-slicker-instagram-container-image-size" id="fts-slicker-instagram-container-image-size" class="feed-them-social-admin-input" value="250px" placeholder="">
2518
  <div class="fts-clear"></div> </div>';
2519
- $output .= '<div class="feed-them-social-admin-input-wrap"><div class="feed-them-social-admin-input-label">' . esc_html( 'Size of the Instagram Icon', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Visible when you hover over photo', 'feed-them-social' ) . '</small></div>
2520
  <input type="text" name="fts-slicker-instagram-icon-center" id="fts-slicker-instagram-icon-center" class="feed-them-social-admin-input" value="65px" placeholder="">
2521
  <div class="fts-clear"></div></div>';
2522
- $output .= '<div class="feed-them-social-admin-input-wrap"><div class="feed-them-social-admin-input-label">' . esc_html( 'The space between photos', 'feed-them-social' ) . '</div>
2523
  <input type="text" name="fts-slicker-instagram-container-margin" id="fts-slicker-instagram-container-margin" class="feed-them-social-admin-input" value="1px" placeholder="">
2524
  <div class="fts-clear"></div></div>';
2525
- $output .= '<div class="feed-them-social-admin-input-wrap"><div class="feed-them-social-admin-input-label">' . esc_html( 'Hide Date, Likes and comments', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Good for image sizes under 120px', 'feed-them-social' ) . '</small></div>
2526
  <select id="fts-slicker-instagram-container-hide-date-likes-comments" name="fts-slicker-instagram-container-hide-date-likes-comments" class="feed-them-social-admin-input">
2527
  <option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option><option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option></select><div class="fts-clear"></div></div>';
2528
- $output .= '<div class="feed-them-social-admin-input-wrap"><div class="feed-them-social-admin-input-label">' . esc_html( 'Center Instagram Container', 'feed-them-social' ) . '</div>
2529
  <select id="fts-slicker-instagram-container-position" name="fts-slicker-instagram-container-position" class="feed-them-social-admin-input"><option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option><option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option></select>
2530
  <div class="fts-clear"></div></div>';
2531
- $output .= ' <div class="feed-them-social-admin-input-wrap"><div class="feed-them-social-admin-input-label">' . esc_html( 'Image Stacking Animation On', 'feed-them-social' ) . '<br/><small>' . esc_html( 'This happens when resizing browser', 'feed-them-social' ) . '</small></div>
2532
  <select id="fts-slicker-instagram-container-animation" name="fts-slicker-instagram-container-animation" class="feed-them-social-admin-input"><option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option><option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option></select><div class="fts-clear"></div></div>';
2533
 
2534
- // INSTAGRAM HEIGHT OPTION!
2535
- $output .= '<div class="feed-them-social-admin-input-wrap instagram_fixed_height_option">';
2536
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Instagram Fixed Height', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Leave blank for auto height', 'feed-them-social' ) . '</small></div>';
2537
- $output .= '<input type="text" name="instagram_page_height" id="instagram_page_height" class="feed-them-social-admin-input" value="" placeholder="450px ' . esc_html( 'for example', 'feed-them-social' ) . '" />';
2538
- $output .= '<div class="fts-clear"></div>';
2539
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2540
-
2541
- $output .= '</div><!--fts-super-instagram-options-wrap-->';
2542
-
2543
- }
2544
-
2545
- if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2546
-
2547
- include $this->premium . 'admin/instagram-settings-fields.php';
2548
-
2549
- } else {
2550
- // Create Need Premium Fields!
2551
- $fields = array(
2552
- __( 'Display Photos & Videos in Popup', 'feed-them-social' ),
2553
- __( 'Load More Posts', 'feed-them-social' ),
2554
- );
2555
- $output .= $this->need_fts_premium_fields( $fields );
2556
- }
2557
- if ( $save_options ) {
2558
- $output .= '<input type="submit" class="feed-them-social-admin-submit-btn instagram-submit" value="' . esc_html( 'Save Changes', 'feed-them-social' ) . '" />';
2559
- } else {
2560
- $output .= $this->generate_shortcode( 'updateTextArea_instagram();', 'Instagram Feed Shortcode', 'instagram-final-shortcode' );
2561
- $output .= '</form>';
2562
- }
2563
- $output .= '</div> <!--/fts-instagram-shortcode-form-->';
2564
- }
2565
- return $output;
2566
- }
2567
-
2568
- /**
2569
- * FTS Youtube Form
2570
- *
2571
- * @param bool $save_options save options.
2572
- * @since 1.9.6
2573
- */
2574
- public function fts_youtube_form ($save_options = false)
2575
- {
2576
- $fts_youtube_form_nonce = wp_create_nonce( 'fts-youtube-form-nonce' );
2577
-
2578
- if ( wp_verify_nonce( $fts_youtube_form_nonce, 'fts-youtube-form-nonce' ) ) {
2579
- if ( $save_options ) {
2580
- $youtube_name_option = get_option( 'youtube_name' );
2581
- $youtube_vid_count_option = get_option( 'youtube_vid_count' );
2582
- $youtube_columns_option = get_option( 'youtube_columns' );
2583
- $youtube_first_video_option = get_option( 'youtube_first_video' );
2584
- }
2585
- $output = '<div class="fts-youtube-shortcode-form">';
2586
- if ( false === $save_options ) {
2587
- $output .= '<form class="feed-them-social-admin-form shortcode-generator-form youtube-shortcode-form" id="fts-youtube-form">';
2588
-
2589
- // Check to see if token is in place otherwise show a message letting person no what they need to do!
2590
- $youtube_options = get_option( 'youtube_custom_api_token' ) || get_option( 'youtube_custom_access_token' ) && get_option( 'youtube_custom_refresh_token' ) && get_option( 'youtube_custom_token_exp_time' ) ? 'Yes' : 'No';
2591
- $output .= isset( $youtube_options ) && 'No' !== $youtube_options ? '' . "\n" : '<div class="feed-them-social-admin-input-wrap fts-required-token-message">Please add a YouTube API Key to our <a href="admin.php?page=fts-youtube-feed-styles-submenu-page">YouTube Options</a> page before trying to view your feed.</div>' . "\n";
2592
- // end custom message for requiring token!
2593
- $output .= '<h2>' . esc_html( 'YouTube Shortcode Generator', 'feed-them-social' ) . '</h2>';
2594
- }
2595
- $output .= '<div class="instructional-text">' . esc_html( 'You must copy your YouTube ', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-youtube-name/" target="_blank">' . esc_html( 'Username, Channel ID and or Playlist ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it below.', 'feed-them-social' ) . '</div>';
2596
- if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2597
- include $this->premium . 'admin/youtube-settings-fields.php';
2598
- } else {
2599
- // Create Need Premium Fields!
2600
- $fields = array(
2601
- __( 'YouTube Name', 'feed-them-social' ),
2602
- __( '# of videos', 'feed-them-social' ),
2603
- __( '# of videos in each row', 'feed-them-social' ),
2604
- __( 'Display First video full size', 'feed-them-social' ),
2605
- );
2606
- $output .= $this->need_fts_premium_fields( $fields );
2607
- $output .= '<a href="http://www.slickremix.com/downloads/feed-them-social-premium-extension/" target="_blank" class="feed-them-social-admin-submit-btn" style="margin-right:1em; margin-top: 15px; display:inline-block; text-decoration:none !important;">' . esc_html( 'Click to see Premium Version', 'feed-them-social' ) . '</a>';
2608
- $output .= '</form>';
2609
- }
2610
- $output .= '</div><!--/fts-youtube-shortcode-form-->';
2611
- }
2612
- return $output;
2613
- }
2614
-
2615
- /**
2616
- * FTS Pinterest Form
2617
- *
2618
- * @param bool $save_options save options.
2619
- * @since 1.9.6
2620
- */
2621
- public function fts_pinterest_form ($save_options = false)
2622
- {
2623
- $fts_pinterest_form_nonce = wp_create_nonce( 'fts-pinterest-form-nonce' );
2624
-
2625
- if ( wp_verify_nonce( $fts_pinterest_form_nonce, 'fts-pinterest-form-nonce' ) ) {
2626
- if ( $save_options ) {
2627
- $pinterest_name_option = get_option( 'pinterest_name' );
2628
- $boards_count_option = get_option( 'boards_count' );
2629
- }
2630
- $output = '<div class="fts-pinterest-shortcode-form">';
2631
- if ( false === $save_options ) {
2632
- $output = '<form class="feed-them-social-admin-form shortcode-generator-form pinterest-shortcode-form" id="fts-pinterest-form">';
2633
- }
2634
- // Pinterest FEED TYPE!
2635
- $output .= '<h2>' . esc_html( 'Pinterest Shortcode Generator', 'feed-them-social' ) . '</h2><div class="feed-them-social-admin-input-wrap pinterest-gen-selection">';
2636
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Feed Type', 'feed-them-social' ) . '</div>';
2637
- $output .= '<select name="pinterest-messages-selector" id="pinterest-messages-selector" class="feed-them-social-admin-input">';
2638
- $output .= '<option value="boards_list">' . esc_html( 'Board List', 'feed-them-social' ) . '</option>';
2639
- $output .= '<option value="single_board_pins">' . esc_html( 'Pins From a Specific Board', 'feed-them-social' ) . '</option>';
2640
- $output .= '<option value="pins_from_user">' . esc_html( 'Latest Pins from a User', 'feed-them-social' ) . '</option>';
2641
- $output .= '</select>';
2642
- $output .= '<div class="fts-clear"></div>';
2643
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2644
- $output .= '<h3>' . esc_html( 'Pinterest Feed', 'feed-them-social' ) . '</h3><div class="instructional-text pinterest-name-text">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-pinterest-name/" target="_blank">' . esc_html( 'Pinterest Name', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below.', 'feed-them-social' ) . '</div>';
2645
- $output .= '<div class="instructional-text pinterest-board-and-name-text" style="display:none;">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-pinterest-name/" target="_blank">' . esc_html( 'Pinterest and Board Name', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste them below.', 'feed-them-social' ) . '</div>';
2646
- $pinterest_name_option = isset( $pinterest_name_option ) ? $pinterest_name_option : '';
2647
- $boards_count_option = isset( $boards_count_option ) ? $boards_count_option : '';
2648
- $output .= '<div class="feed-them-social-admin-input-wrap pinterest_name">';
2649
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Pinterest Username (required)', 'feed-them-social' ) . '</div>';
2650
- $output .= '<input type="text" name="pinterest_name" id="pinterest_name" class="feed-them-social-admin-input" value="' . esc_html( $pinterest_name_option ) . '" />';
2651
- $output .= '<div class="fts-clear"></div>';
2652
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2653
- $output .= '<div class="feed-them-social-admin-input-wrap board-name" style="display:none;">';
2654
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Pinterest Board Name (required)', 'feed-them-premium' ) . '</div>';
2655
- $output .= '<input type="text" name="pinterest_board_name" id="pinterest_board_name" class="feed-them-social-admin-input" value="' . esc_html( $pinterest_name_option ) . '" />';
2656
- $output .= '<div class="fts-clear"></div>';
2657
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2658
- if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2659
- include $this->premium . 'admin/pinterest-settings-fields.php';
2660
- } else {
2661
- // Create Need Premium Fields!
2662
- $fields = array(
2663
- esc_html( '# of Boards (default 6)', 'feed-them-social' ),
2664
- esc_html( '# of Pins (default 6)', 'feed-them-social' ),
2665
- );
2666
- $output .= $this->need_fts_premium_fields( $fields );
2667
- }
2668
- if ( $save_options ) {
2669
- $output .= '<input type="submit" class="feed-them-social-admin-submit-btn" value="' . esc_html( 'Save Changes', 'feed-them-social' ) . '" />';
2670
- } else {
2671
- $output .= $this->generate_shortcode( 'updateTextArea_pinterest();', '' . esc_html( 'Pinterest Feed Shortcode', 'feed-them-social' ) . '', 'pinterest-final-shortcode' );
2672
- $output .= '</form>';
2673
- }
2674
- $output .= '</div><!--/fts-pinterest-shortcode-form-->';
2675
- }
2676
- return $output;
2677
- }
2678
-
2679
- /**
2680
- * Generate Shortcode
2681
- *
2682
- * Generate Shortcode Button and Input for FTS settings Page.
2683
- *
2684
- * @param string $onclick onclick.
2685
- * @param string $label label.
2686
- * @param string $input_class input class.
2687
- * @since 1.9.6
2688
- */
2689
- public function generate_shortcode ($onclick, $label, $input_class)
2690
- {
2691
- $output = '<input type="button" class="feed-them-social-admin-submit-btn" value="' . esc_html( 'Generate Shortcode', 'feed-them-social' ) . '" onclick="' . esc_js( $onclick ) . '" tabindex="4" style="margin-right:1em;" />';
2692
- $output .= '<div class="feed-them-social-admin-input-wrap final-shortcode-textarea">';
2693
- $output .= '<h4>' . esc_html( 'Copy the ShortCode below and paste it on a page or post that you want to display your feed.', 'feed-them-social' ) . '</h4>';
2694
- $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( $label ) . '</div>';
2695
- $output .= '<input class="copyme ' . esc_html( $input_class ) . ' feed-them-social-admin-input" value="" />';
2696
- $output .= '<div class="fts-clear"></div>';
2697
- $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2698
- return $output;
2699
- }
2700
-
2701
- /**
2702
- * FTS Get Feed json
2703
- *
2704
- * Generate Get Json (includes MultiCurl).
2705
- *
2706
- * @param array $feeds_mulit_data feeds data info.
2707
- * @return array
2708
- * @since 1.9.6
2709
- */
2710
- public function fts_get_feed_json ($feeds_mulit_data)
2711
- {
2712
- // Make Multiple Requests from array with more than 2 keys!
2713
- if ( is_array( $feeds_mulit_data ) && count( $feeds_mulit_data ) > 1 ) {
2714
- $new_feeds_mulit_data = array();
2715
-
2716
- foreach ( $feeds_mulit_data as $key => $url ) {
2717
- $new_feeds_mulit_data[$key]['url'] = $url;
2718
- $new_feeds_mulit_data[$key]['type'] = 'GET';
2719
- }
2720
- // Fetch Multiple Requests!
2721
- $responses = \Requests::request_multiple( $new_feeds_mulit_data );
2722
-
2723
- $data = array();
2724
- foreach ( $responses as $key => $response ) {
2725
-
2726
- if ( is_a( $response, 'Requests_Response' ) ) {
2727
- $data[$key] = $response->body;
2728
- }
2729
- }
2730
- } else {
2731
- // Make Single Requests from array with 1 keys!
2732
- if ( is_array( $feeds_mulit_data ) ) {
2733
- foreach ( $feeds_mulit_data as $key => $url ) {
2734
-
2735
- $single_response = \Requests::get( $url );
2736
-
2737
- $data = array();
2738
- if ( is_a( $single_response, 'Requests_Response' ) ) {
2739
- $data[$key] = $single_response->body;
2740
- }
2741
- }
2742
- } else {
2743
- // Make Single request from just url!
2744
- $single_response_url = $feeds_mulit_data;
2745
-
2746
- if ( !empty( $single_response_url ) ) {
2747
- $single_response = \Requests::get( $single_response_url );
2748
-
2749
- if ( is_a( $single_response, 'Requests_Response' ) ) {
2750
- $data['data'] = $single_response->body;
2751
- }
2752
- }
2753
- }
2754
- }
2755
- // Do nothing if Curl was Successful!
2756
- return $data;
2757
- }
2758
-
2759
- /**
2760
- * FTS Create Feed Cache
2761
- *
2762
- * @param string $transient_name transient name.
2763
- * @param array $response Data returned from response.
2764
- * @since 1.9.6
2765
- */
2766
- public function fts_create_feed_cache ($transient_name, $response)
2767
- {
2768
- $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';
2769
- set_transient( 'fts_' . $transient_name, $response, $cache_time_limit );
2770
- }
2771
-
2772
- /**
2773
- * FTS Get Feed Cache
2774
- *
2775
- * @param string $transient_name transient name.
2776
- * @return mixed
2777
- * @since 1.9.6
2778
- */
2779
- public function fts_get_feed_cache ($transient_name)
2780
- {
2781
- $returned_cache_data = get_transient( 'fts_' . $transient_name );
2782
- return $returned_cache_data;
2783
- }
2784
-
2785
- /**
2786
- * FTS Check Feed Cache Exists
2787
- *
2788
- * @param string $transient_name transient name.
2789
- * @return bool
2790
- * @since 1.9.6
2791
- */
2792
- public function fts_check_feed_cache_exists ($transient_name)
2793
- {
2794
- if ( false === get_transient( 'fts_' . $transient_name ) ) {
2795
- return false;
2796
- }
2797
- return true;
2798
- }
2799
-
2800
- /**
2801
- * FTS Clear Cache Ajax
2802
- *
2803
- * @since 1.9.6
2804
- */
2805
- public function fts_clear_cache_ajax ()
2806
- {
2807
- global $wpdb;
2808
- // Clear UnExpired!
2809
- $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", '_transient_fts_%' ) );
2810
- // Clear Exired Transients!
2811
- $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", '_transient_timeout_fts_%' ) );
2812
- wp_reset_query();
2813
- }
2814
-
2815
- /**
2816
- * Feed Them Clear Cache
2817
- *
2818
- * Clear Cache Folder.
2819
- *
2820
- * @return string
2821
- * @since 1.9.6
2822
- */
2823
- public function feed_them_clear_cache ()
2824
- {
2825
- global $wpdb;
2826
- // Clear UnExpired!
2827
- $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", '_transient_fts_%' ) );
2828
- // Clear Exired Transients!
2829
- $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", '_transient_timeout_fts_%' ) );
2830
- wp_reset_query();
2831
- return 'Cache for all FTS Feeds cleared!';
2832
- }
2833
-
2834
- /**
2835
- * FTS Admin Bar Menu
2836
- *
2837
- * Create our custom menu in the admin bar.
2838
- *
2839
- * @since 1.9.6
2840
- */
2841
- public function fts_admin_bar_menu ()
2842
- {
2843
- global $wp_admin_bar;
2844
-
2845
- $fts_admin_bar_menu = get_option( 'fts_admin_bar_menu' );
2846
- $fts_dev_mode_cache = get_option( 'fts_clear_cache_developer_mode' );
2847
- if ( !is_super_admin() || !is_admin_bar_showing() || 'hide-admin-bar-menu' === $fts_admin_bar_menu ) {
2848
- return;
2849
- }
2850
- $wp_admin_bar->add_menu(
2851
- array(
2852
- 'id' => 'feed_them_social_admin_bar',
2853
- 'title' => __( 'Feed Them Social', 'feed-them-social' ),
2854
- 'href' => false,
2855
- )
2856
- );
2857
- if ( '1' === $fts_dev_mode_cache ) {
2858
- $wp_admin_bar->add_menu(
2859
- array(
2860
- 'id' => 'feed_them_social_admin_bar_clear_cache',
2861
- 'parent' => 'feed_them_social_admin_bar',
2862
- 'title' => __( 'Cache clears on page refresh now', 'feed-them-social' ),
2863
- 'href' => false,
2864
- )
2865
- );
2866
- } else {
2867
- $wp_admin_bar->add_menu(
2868
- array(
2869
- 'id' => 'feed_them_social_admin_set_cache',
2870
- 'parent' => 'feed_them_social_admin_bar',
2871
- 'title' => __( 'Clear Cache', 'feed-them-social' ),
2872
- 'href' => '#',
2873
- )
2874
- );
2875
- }
2876
- $wp_admin_bar->add_menu(
2877
- array(
2878
- 'id' => 'feed_them_social_admin_bar_set_cache',
2879
- 'parent' => 'feed_them_social_admin_bar',
2880
- 'title' => sprintf(
2881
- __( 'Set Cache Time %1$s%2$s%3$s', 'feed-them-social' ),
2882
- '<span>',
2883
- $this->fts_cachetime_amount( get_option( 'fts_clear_cache_developer_mode' ) ),
2884
- '</span>'
2885
- ),
2886
- 'href' => admin_url( 'admin.php?page=feed-them-settings-page&tab=global_options' ),
2887
-
2888
- )
2889
- );
2890
- $wp_admin_bar->add_menu(
2891
- array(
2892
- 'id' => 'feed_them_social_admin_bar_settings',
2893
- 'parent' => 'feed_them_social_admin_bar',
2894
- 'title' => __( 'Settings', 'feed-them-social' ),
2895
- 'href' => admin_url( 'admin.php?page=feed-them-settings-page' ),
2896
- )
2897
- );
2898
- $wp_admin_bar->add_menu(
2899
- array(
2900
- 'id' => 'feed_them_social_admin_bar_global_options',
2901
- 'parent' => 'feed_them_social_admin_bar',
2902
- 'title' => __( 'Global Options', 'feed-them-social' ),
2903
- 'href' => admin_url( 'admin.php?page=feed-them-settings-page&tab=global_options' ),
2904
- )
2905
- );
2906
- }
2907
-
2908
- /**
2909
- * FTS Cachetime amount
2910
- *
2911
- * @param string $fts_cachetime Cache time.
2912
- * @return mixed
2913
- * @since
2914
- */
2915
- public function fts_cachetime_amount ($fts_cachetime)
2916
- {
2917
- switch ($fts_cachetime) {
2918
- case '1':
2919
- $fts_display_cache_time = __( 'Clear cache on every page load', 'feed-them-social' );
2920
- break;
2921
- default:
2922
- case '86400':
2923
- $fts_display_cache_time = __( '1 Day (Default)', 'feed-them-social' );
2924
- break;
2925
- case '172800':
2926
- $fts_display_cache_time = __( '2 Days', 'feed-them-social' );
2927
- break;
2928
- case '259200':
2929
- $fts_display_cache_time = __( '3 Days', 'feed-them-social' );
2930
- break;
2931
- case '604800':
2932
- $fts_display_cache_time = __( '1 Week', 'feed-them-social' );
2933
- break;
2934
- case '1209600':
2935
- $fts_display_cache_time = __( '2 Weeks', 'feed-them-social' );
2936
- break;
2937
- }
2938
- return $fts_display_cache_time;
2939
- }
2940
-
2941
- /**
2942
- * XML json Parse
2943
- *
2944
- * @param string $url string to parse the content for.
2945
- * @return mixed
2946
- * @since 1.9.6
2947
- */
2948
- public function xml_json_parse ($url)
2949
- {
2950
- $url_to_get['url'] = $url;
2951
- $file_contents_returned = $this->fts_get_feed_json( $url_to_get );
2952
- $file_contents = $file_contents_returned['url'];
2953
- $file_contents = str_replace( array("\n", "\r", "\t"), '', $file_contents );
2954
- $file_contents = trim( str_replace( '"', "'", $file_contents ) );
2955
- $simple_xml = simplexml_load_string( $file_contents );
2956
- $encoded_json = json_encode( $simple_xml );
2957
-
2958
- return $encoded_json;
2959
- }
2960
-
2961
- /**
2962
- * FTS Ago
2963
- *
2964
- * Create date format like fb and twitter. Thanks: http://php.quicoto.com/how-to-calculate-relative-time-like-facebook/ .
2965
- *
2966
- * @param string $timestamp Timestamp!
2967
- * @return string
2968
- * @since 1.9.6
2969
- */
2970
- function fts_ago ($timestamp)
2971
- {
2972
- // not setting isset'ing anything because you have to save the settings page to even enable this feature
2973
- $fts_language_second = get_option( 'fts_language_second' );
2974
- if ( empty( $fts_language_second ) ) {
2975
- $fts_language_second = 'second';
2976
- }
2977
- $fts_language_seconds = get_option( 'fts_language_seconds' );
2978
- if ( empty( $fts_language_seconds ) ) {
2979
- $fts_language_seconds = 'seconds';
2980
- }
2981
- $fts_language_minute = get_option( 'fts_language_minute' );
2982
- if ( empty( $fts_language_minute ) ) {
2983
- $fts_language_minute = 'minute';
2984
- }
2985
- $fts_language_minutes = get_option( 'fts_language_minutes' );
2986
- if ( empty( $fts_language_minute ) ) {
2987
- $fts_language_minute = 'minutes';
2988
- }
2989
- $fts_language_hour = get_option( 'fts_language_hour' );
2990
- if ( empty( $fts_language_hour ) ) {
2991
- $fts_language_hour = 'hour';
2992
- }
2993
- $fts_language_hours = get_option( 'fts_language_hours' );
2994
- if ( empty( $fts_language_hours ) ) {
2995
- $fts_language_hours = 'hours';
2996
- }
2997
- $fts_language_day = get_option( 'fts_language_day' );
2998
- if ( empty( $fts_language_day ) ) {
2999
- $fts_language_day = 'day';
3000
- }
3001
- $fts_language_days = get_option( 'fts_language_days' );
3002
- if ( empty( $fts_language_days ) ) {
3003
- $fts_language_days = 'days';
3004
- }
3005
- $fts_language_week = get_option( 'fts_language_week' );
3006
- if ( empty( $fts_language_week ) ) {
3007
- $fts_language_week = 'week';
3008
- }
3009
- $fts_language_weeks = get_option( 'fts_language_weeks' );
3010
- if ( empty( $fts_language_weeks ) ) {
3011
- $fts_language_weeks = 'weeks';
3012
- }
3013
- $fts_language_month = get_option( 'fts_language_month' );
3014
- if ( empty( $fts_language_month ) ) {
3015
- $fts_language_month = 'month';
3016
- }
3017
- $fts_language_months = get_option( 'fts_language_months' );
3018
- if ( empty( $fts_language_months ) ) {
3019
- $fts_language_months = 'months';
3020
- }
3021
- $fts_language_year = get_option( 'fts_language_year' );
3022
- if ( empty( $fts_language_year ) ) {
3023
- $fts_language_year = 'year';
3024
- }
3025
- $fts_language_years = get_option( 'fts_language_years' );
3026
- if ( empty( $fts_language_years ) ) {
3027
- $fts_language_years = 'years';
3028
- }
3029
- $fts_language_ago = get_option( 'fts_language_ago' );
3030
- if ( empty( $fts_language_ago ) ) {
3031
- $fts_language_ago = 'ago';
3032
- }
3033
-
3034
- // $periods = array( "sec", "min", "hour", "day", "week", "month", "years", "decade" );.
3035
- $periods = array($fts_language_second, $fts_language_minute, $fts_language_hour, $fts_language_day, $fts_language_week, $fts_language_month, $fts_language_year, 'decade');
3036
- $periods_plural = array($fts_language_seconds, $fts_language_minutes, $fts_language_hours, $fts_language_days, $fts_language_weeks, $fts_language_months, $fts_language_years, 'decades');
3037
-
3038
- if ( !is_numeric( $timestamp ) ) {
3039
- $timestamp = strtotime( $timestamp );
3040
- if ( !is_numeric( $timestamp ) ) {
3041
- return '';
3042
- }
3043
- }
3044
- $difference = time() - $timestamp;
3045
- // Customize in your own language. Why thank-you I will.
3046
- $lengths = array('60', '60', '24', '7', '4.35', '12', '10');
3047
-
3048
- if ( $difference > 0 ) {
3049
- // this was in the past
3050
- $ending = $fts_language_ago;
3051
- } else {
3052
- // this was in the future
3053
- $difference = -$difference;
3054
- // not doing dates in the future for posts
3055
- $ending = 'to go';
3056
- }
3057
- for ( $j = 0; $difference >= $lengths[$j] && $j < count( $lengths ) - 1; $j++ ) {
3058
- $difference /= $lengths[$j];
3059
- }
3060
-
3061
- $difference = round( $difference );
3062
-
3063
- if ( $difference > 1 ) {
3064
- $periods[$j] = $periods_plural[$j];
3065
- }
3066
-
3067
- return "$difference $periods[$j] $ending";
3068
- }
3069
-
3070
- /**
3071
- * FTS Custom Date
3072
- *
3073
- * @param string $created_time Created time.
3074
- * @param string $feed_type Feed type.
3075
- * @return string
3076
- * @since 1.9.6
3077
- */
3078
- public function fts_custom_date ($created_time, $feed_type)
3079
- {
3080
- $fts_custom_date = get_option( 'fts-custom-date' );
3081
- $fts_custom_time = get_option( 'fts-custom-time' );
3082
- $custom_date_check = get_option( 'fts-date-and-time-format' );
3083
- $fts_twitter_offset_time = get_option( 'fts_twitter_time_offset' );
3084
- $fts_timezone = get_option( 'fts-timezone' );
3085
-
3086
- if ( '' === $fts_custom_date && '' === $fts_custom_time ) {
3087
- $custom_date_check = $custom_date_check;
3088
- } elseif ( '' !== $fts_custom_date || '' !== $fts_custom_time ) {
3089
- $custom_date_check = $fts_custom_date . ' ' . $fts_custom_time;
3090
- } else {
3091
- $custom_date_check = 'F jS, Y \a\t g:ia';
3092
- }
3093
-
3094
- // Always store the current timezone so that it can be restored later
3095
- $fts_old_timezone = date_default_timezone_get();
3096
- if ( !empty( $fts_timezone ) ) {
3097
- date_default_timezone_set( $fts_timezone );
3098
- }
3099
- // Twitter date time!
3100
- if ( 'twitter' === $feed_type ) {
3101
-
3102
- $fts_twitter_offset_time_final = 1 === $fts_twitter_offset_time ? strtotime( $created_time ) : strtotime( $created_time ) - 3 * 3600;
3103
-
3104
- if ( 'one-day-ago' === $custom_date_check ) {
3105
- $u_time = $this->fts_ago( $created_time );
3106
- } else {
3107
- $u_time = !empty( $custom_date_check ) ? date_i18n( $custom_date_check, $fts_twitter_offset_time_final ) : $this->fts_ago( $created_time );
3108
- }
3109
- }
3110
-
3111
- // Instagram date time!
3112
- if ( 'instagram' === $feed_type ) {
3113
- if ( 'one-day-ago' === $custom_date_check ) {
3114
- $u_time = $this->fts_ago( $created_time );
3115
- } else {
3116
- $u_time = !empty( $custom_date_check ) ? date_i18n( $custom_date_check, $created_time ) : $this->fts_ago( $created_time );
3117
- }
3118
- }
3119
- // Youtube and Pinterest date time!
3120
- if ( 'pinterest' === $feed_type ) {
3121
- if ( 'one-day-ago' === $custom_date_check ) {
3122
- $u_time = $this->fts_ago( $created_time );
3123
- } else {
3124
- $u_time = !empty( $custom_date_check ) ? date_i18n( $custom_date_check, strtotime( $created_time ) ) : $this->fts_ago( $created_time );
3125
- }
3126
- }
3127
- // WP Gallery and Pinterest date time!
3128
- if ( 'wp_gallery' === $feed_type ) {
3129
- if ( 'one-day-ago' === $custom_date_check ) {
3130
- $u_time = $this->fts_ago( $created_time );
3131
- } else {
3132
- $u_time = !empty( $custom_date_check ) ? date_i18n( $custom_date_check, strtotime( $created_time ) ) : $this->fts_ago( $created_time );
3133
- }
3134
- }
3135
- // Facebook date time!
3136
- if ( 'facebook' === $feed_type ) {
3137
- $time_set = $fts_timezone;
3138
- $time_set_check = isset( $time_set ) ? $time_set : 'America/New_York';
3139
- date_default_timezone_set( $time_set_check );
3140
-
3141
- if ( 'one-day-ago' === $custom_date_check ) {
3142
- $u_time = $this->fts_ago( $created_time );
3143
- } else {
3144
- $u_time = !empty( $custom_date_check ) ? date_i18n( $custom_date_check, $created_time ) : $this->fts_ago( $created_time );
3145
- }
3146
- }
3147
- // Instagram date time!
3148
- if ( 'youtube' === $feed_type ) {
3149
- if ( 'one-day-ago' === $custom_date_check ) {
3150
- $u_time = $this->fts_ago( $created_time );
3151
- } else {
3152
- $u_time = !empty( $custom_date_check ) ? date_i18n( $custom_date_check, strtotime( $created_time ) ) : $this->fts_ago( $created_time );
3153
- }
3154
- }
3155
-
3156
- // Restore the timezone to its value when entering this function to avoid side-effects
3157
- date_default_timezone_set( $fts_old_timezone );
3158
-
3159
- // Return the time!
3160
- return $u_time;
3161
- }
3162
-
3163
- /**
3164
- * Random String generator For All Feeds
3165
- *
3166
- * @param int $length Random string length.
3167
- * @return string
3168
- * @since 2.0.7
3169
- */
3170
- public function feed_them_social_rand_string ($length = 10)
3171
- {
3172
- $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
3173
- $characters_length = strlen( $characters );
3174
- $random_string = '';
3175
- for ( $i = 0; $i < $length; $i++ ) {
3176
- $random_string .= $characters[wp_rand( 0, $characters_length - 1 )];
3177
- }
3178
- return $random_string;
3179
- }
3180
-
3181
-
3182
- /**
3183
- * FTS Refresh YouTube Token
3184
- *
3185
- * @since 2.3.3
3186
- */
3187
- public function fts_refresh_token_ajax ()
3188
- {
3189
-
3190
- $fts_refresh_token_nonce = wp_create_nonce( 'fts_refresh_token_nonce' );
3191
-
3192
- if ( wp_verify_nonce( $fts_refresh_token_nonce, 'fts_refresh_token_nonce' ) ) {
3193
- if ( isset( $_REQUEST['refresh_token'], $_REQUEST['button_pushed'] ) && 'yes' === $_REQUEST['button_pushed'] ) {
3194
- update_option( 'youtube_custom_refresh_token', sanitize_text_field( wp_unslash( $_REQUEST['refresh_token'] ) ) );
3195
- }
3196
- if ( isset( $_REQUEST['access_token'] ) ) {
3197
- update_option( 'youtube_custom_access_token', sanitize_text_field( wp_unslash( $_REQUEST['access_token'] ) ) );
3198
- }
3199
- $startoftime = isset( $_REQUEST['expires_in'] ) ? strtotime( '+' . sanitize_text_field( wp_unslash( $_REQUEST['expires_in'] ) ) . ' seconds' ) : '';
3200
- $start_of_time_final = false !== $startoftime ? sanitize_key( $startoftime ) : '';
3201
- update_option( 'youtube_custom_token_exp_time', $start_of_time_final );
3202
-
3203
- // This only happens if the token is expired on the YouTube Options page and you go to re-save or refresh the page for some reason. It will also run this function if the cache is emptied and the token is found to be expired.
3204
- if ( 'no' === $_REQUEST['button_pushed'] ) {
3205
- return 'Token Refreshed';
3206
- // $output .= do_shortcode('[fts _youtube vid_count=3 large_vid=no large_vid_title=no large_vid_description=no thumbs_play_in_iframe=popup vids_in_row=3 space_between_videos=1px force_columns=yes maxres_thumbnail_images=yes thumbs_wrap_color=#000 wrap=none video_wrap_display=none comments_count=12 channel_id=UCqhnX4jA0A5paNd1v-zEysw loadmore=button loadmore_count=5 loadmore_btn_maxwidth=300px loadmore_btn_margin=10px]');
3207
- }
3208
- }
3209
-
3210
- }
3211
-
3212
- /**
3213
- * FTS Check YouTube Token Validity
3214
- *
3215
- * @since 2.3.3
3216
- */
3217
- public function feed_them_youtube_refresh_token ()
3218
- {
3219
-
3220
- $fts_refresh_token_nonce = wp_create_nonce( 'fts_refresh_token_nonce' );
3221
-
3222
- if ( wp_verify_nonce( $fts_refresh_token_nonce, 'fts_refresh_token_nonce' ) ) {
3223
-
3224
- // Used some methods from this link http://ieg.wnet.org/2015/09/using-oauth-in-wordpress-plugins-part-2-persistence/
3225
- // save all 3 get options: happens when clicking the get access token button on the youtube options page!
3226
- if ( isset( $_GET['refresh_token'], $_GET['access_token'] ) && isset( $_GET['expires_in'] ) ) {
3227
- $button_pushed = 'yes';
3228
- $clienttoken_post['refresh_token'] = sanitize_text_field( wp_unslash( $_GET['refresh_token'] ) );
3229
- $auth_obj['access_token'] = sanitize_text_field( wp_unslash( $_GET['access_token'] ) );
3230
- $auth_obj['expires_in'] = sanitize_key( wp_unslash( $_GET['expires_in'] ) );
3231
- } else {
3232
- // refresh token!
3233
- $button_pushed = 'no';
3234
- $oauth2token_url = 'https://accounts.google.com/o/oauth2/token';
3235
- $clienttoken_post = array(
3236
- 'client_id' => '802796800957-6nannpdq8h8l720ls430ahnnq063n22u.apps.googleusercontent.com',
3237
- 'client_secret' => 'CbieVhgOudjrpya1IDpv3uRa',
3238
- );
3239
- // The "refresh token" grant type is to use a refresh token to get a new access token!
3240
- $clienttoken_post['refresh_token'] = get_option( 'youtube_custom_refresh_token' );
3241
- $clienttoken_post['grant_type'] = 'refresh_token';
3242
-
3243
- $postargs = array(
3244
- 'body' => $clienttoken_post,
3245
- );
3246
- $response = wp_remote_post( $oauth2token_url, $postargs );
3247
- $auth_obj = json_decode( wp_remote_retrieve_body( $response ), true );
3248
- }
3249
- ?>
3250
- <script>
3251
- jQuery(document).ready(function () {
3252
- jQuery.ajax({
3253
- data: {
3254
- action: "fts_refresh_token_ajax",
3255
- refresh_token: '<?php echo esc_js( $clienttoken_post['refresh_token'] ); ?>',
3256
- access_token: '<?php echo esc_js( $auth_obj['access_token'] ); ?>',
3257
- expires_in: '<?php echo esc_js( $auth_obj['expires_in'] ); ?>',
3258
- button_pushed: '<?php echo esc_js( $button_pushed ); ?>'
3259
- },
3260
- type: 'POST',
3261
- url: ftsAjax.ajaxurl,
3262
- success: function (response) {
3263
- console.log(response);
3264
- <?php
3265
- if ( isset( $_GET['page'] ) && 'fts-youtube-feed-styles-submenu-page' === $_GET['page'] ) {
3266
- foreach ( $auth_obj as $user_id ) {
3267
- if ( !isset( $user_id->error->errors[0]->reason ) ) {
3268
- $type_of_key = __( 'API key', 'feed-them-social' );
3269
- } elseif ( !isset( $user_id->error->errors[0]->reason ) && !empty( $youtube_access_token ) ) {
3270
- $type_of_key = __( 'Access Token', 'feed-them-social' );
3271
- }
3272
-
3273
- // Error Check!
3274
- if ( !isset( $auth_obj->error->errors[0]->reason ) ) {
3275
- $fts_youtube_message = sprintf(
3276
- 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' ),
3277
- '<div class="fts-successful-api-token">',
3278
- esc_html( $type_of_key ),
3279
- '<a href="' . esc_url( 'admin.php?page=feed-them-settings-page' ) . '">',
3280
- '</a>',
3281
- '</div><div class="clear"></div>'
3282
- );
3283
- } elseif ( isset( $user_id->error->errors[0]->reason ) ) {
3284
- $fts_youtube_message = sprintf(
3285
- esc_html( '%1$s This %2$s does not appear to be valid. YouTube responded with: %3$s %4$s ', 'feed-them-social' ),
3286
- '<div class="fts-failed-api-token">',
3287
- esc_html( $type_of_key ),
3288
- esc_html( $user_id->errors[0]->reason ),
3289
- '</div><div class="clear"></div>'
3290
- );
3291
- }
3292
-
3293
- break;
3294
- }
3295
-
3296
- ?>
3297
- jQuery('#youtube_custom_access_token, #youtube_custom_token_exp_time').val('');
3298
-
3299
- <?php if ( isset( $_GET['refresh_token'], $_GET['access_token'] ) && isset( $_GET['expires_in'] ) ) { ?>
3300
- jQuery('#youtube_custom_refresh_token').val(jQuery('#youtube_custom_refresh_token').val() + '<?php echo esc_js( $clienttoken_post['refresh_token'] ); ?>');
3301
- jQuery('.fts-failed-api-token').hide();
3302
-
3303
- if (!jQuery('.fts-successful-api-token').length) {
3304
- jQuery('.fts-youtube-last-row').append('<?php echo $fts_youtube_message; ?>');
3305
- }
3306
- <?php
3307
- } else {
3308
- ?>
3309
- if (jQuery('.fts-failed-api-token').length) {
3310
- jQuery('.fts-youtube-last-row').append('<?php echo $fts_youtube_message; ?>');
3311
- jQuery('.fts-failed-api-token').hide();
3312
- }
3313
- <?php } ?>
3314
-
3315
- jQuery('#youtube_custom_access_token').val(jQuery('#youtube_custom_access_token').val() + '<?php echo esc_js( $auth_obj['access_token'] ); ?>');
3316
- jQuery('#youtube_custom_token_exp_time').val(jQuery('#youtube_custom_token_exp_time').val() + '<?php echo esc_js( strtotime( '+' . $auth_obj['expires_in'] . ' seconds' ) ); ?>');
3317
- jQuery('<div class="fa fa-check-circle fa-3x fa-fw fts-success"></div>').insertBefore('.hide-button-tokens-options .feed-them-social-admin-input-wrap .fts-clear');
3318
- jQuery('.fts-success').fadeIn('slow');
3319
- <?php } ?>
3320
- return false;
3321
- }
3322
- }); // end of ajax()
3323
- return false;
3324
- }); // end of document.ready
3325
- </script>
3326
- <?php
3327
- return $auth_obj['access_token'];
3328
- }
3329
- }
3330
-
3331
-
3332
- /**
3333
- * FTS YouTube Link Filter
3334
- *
3335
- * @param string $youtube_description youtube description.
3336
- * @return string
3337
- * @since 1.9.6
3338
- */
3339
- public function fts_youtube_link_filter ($youtube_description)
3340
- {
3341
- // Converts URLs to Links!
3342
- $youtube_description = preg_replace( '@(?!(?!.*?<a)[^<]*<\/a>)(?:(?:https?|ftp|file)://|www\.|ftp\.)[-A-‌​Z0-9+&#/%=~_|$?!:,.]*[A-Z0-9+&#/%=~_|$]@i', '<a href="\0" target="_blank">\0</a>', $youtube_description );
3343
-
3344
- $splitano = explode( 'www', $youtube_description );
3345
- $count = count( $splitano );
3346
- $return_value = '';
3347
-
3348
- for ( $i = 0; $i < $count; $i++ ) {
3349
- if ( 'href=' === substr( $splitano[$i], -6, 5 ) ) {
3350
- $return_value .= $splitano[$i] . 'http://www';
3351
- } elseif ( $i < $count - 1 ) {
3352
- $return_value .= $splitano[$i] . 'www';
3353
- } else {
3354
- $return_value .= $splitano[$i];
3355
- }
3356
- }
3357
- return $return_value;
3358
- }
3359
-
3360
- /**
3361
- * FTS Youtube Video and Wrap
3362
- *
3363
- * @param object $post_data post data.
3364
- * @param string $username username.
3365
- * @param string $playlist_id playlist id.
3366
- * @since 1.9.6
3367
- */
3368
- public function fts_youtube_video_and_wrap ($post_data, $username, $playlist_id)
3369
- {
3370
- $ssl = is_ssl() ? 'https' : 'http';
3371
- $youtube_video_user_or_playlist_url = isset( $post_data->snippet->resourceId->videoId ) ? $post_data->snippet->resourceId->videoId : '';
3372
- $youtube_video_channel_url = isset( $post_data->id->videoId ) ? $post_data->id->videoId : '';
3373
-
3374
- if ( '' !== $username || '' !== $playlist_id ) {
3375
- $youtube_video_iframe = '<div class="fts-fluid-videoWrapper"><iframe src="' . esc_url( $ssl . '://www.youtube.com/embed/' . $youtube_video_user_or_playlist_url ) . '?wmode=transparent&HD=0&rel=0&showinfo=0&controls=1&autoplay=0" frameborder="0" allowfullscreen></iframe></div>';
3376
-
3377
- } else {
3378
- $youtube_video_iframe = '<div class="fts-fluid-videoWrapper"><iframe src="' . esc_url( $ssl . '://www.youtube.com/embed/' . $youtube_video_channel_url ) . '?wmode=transparent&HD=0&rel=0&showinfo=0&controls=1&autoplay=0" frameborder="0" allowfullscreen></iframe></div>';
3379
- }
3380
- return $youtube_video_iframe;
3381
- }
3382
-
3383
-
3384
- /**
3385
- * Youtube Description
3386
- *
3387
- * @param object $post_data post data.
3388
- * @return string
3389
- * @since 1.9.6
3390
- */
3391
- public function fts_youtube_description ($post_data)
3392
- {
3393
-
3394
- $pinterest_description = isset( $post_data->snippet->description ) ? $post_data->snippet->description : '';
3395
- return $pinterest_description;
3396
- }
3397
-
3398
- /**
3399
- * Youtube Title
3400
- *
3401
- * @param object $post_data post data.
3402
- * @return string
3403
- * @since 1.9.6
3404
- */
3405
- public function fts_youtube_title ($post_data)
3406
- {
3407
- $youtube_post_title = isset( $post_data->snippet->title ) ? $post_data->snippet->title : '';
3408
- return $youtube_post_title;
3409
- }
3410
-
3411
- /**
3412
- * FTS Facebook Group Form
3413
- *
3414
- * @param bool $save_options Save Options.
3415
- * @since 1.9.6
3416
- */
3417
- public function fts_facebook_group_form ($save_options = false)
3418
- {
3419
- // DEPRECIATED!
3420
- }
3421
-
3422
- public function fts_facebook_event_form ($save_options = false)
3423
- {
3424
- // DEPRECIATED!
3425
- }
3426
 
3427
  } // end class
3428
- ?>
7
  * @package feedthemsocial
8
  * @since 1.9.6
9
  */
10
+ class feed_them_social_functions {
11
+
12
+
13
+ /**
14
+ * Construct
15
+ *
16
+ * Functions constructor.
17
+ *
18
+ * @since 1.9.6
19
+ */
20
+ public function __construct() {
21
+ $root_file = plugin_dir_path( dirname( __FILE__ ) );
22
+ $this->premium = str_replace( 'feed-them-social/', 'feed-them-premium/', $root_file );
23
+ $this->facebook_carousel_premium = str_replace( 'feed-them-social/', 'feed-them-carousel-premium/', $root_file );
24
+ $this->facebook_reviews = str_replace( 'feed-them-social/', 'feed-them-social-facebook-reviews/', $root_file );
25
+
26
+ // FTS Activation Function. Commenting out for future use. SRL!
27
+ register_deactivation_hook( __FILE__, array( $this, 'fts_get_check_plugin_version' ) );
28
+ // Widget Code!
29
+ add_filter( 'widget_text', 'do_shortcode' );
30
+ // This is for the fts_clear_cache_ajax submission!
31
+ if ( 'show-admin-bar-menu' === get_option( 'fts_admin_bar_menu' ) ) {
32
+ add_action( 'init', array( $this, 'fts_clear_cache_script' ) );
33
+ add_action( 'wp_head', array( $this, 'my_fts_ajaxurl' ) );
34
+ add_action( 'wp_ajax_fts_clear_cache_ajax', array( $this, 'fts_clear_cache_ajax' ) );
35
+ }
36
+ add_action( 'wp_ajax_fts_refresh_token_ajax', array( $this, 'fts_refresh_token_ajax' ) );
37
+ add_action( 'wp_ajax_fts_instagram_token_ajax', array( $this, 'fts_instagram_token_ajax' ) );
38
+
39
+ 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' ) ) {
40
+ // Load More Options!
41
+ add_action( 'wp_ajax_my_fts_fb_load_more', array( $this, 'my_fts_fb_load_more' ) );
42
+ add_action( 'wp_ajax_nopriv_my_fts_fb_load_more', array( $this, 'my_fts_fb_load_more' ) );
43
+ add_action( 'wp_ajax_my_fts_fb_options_page_load_more', array( $this, 'my_fts_fb_options_page_load_more' ) );
44
+ }
45
+
46
+ add_shortcode( 'fts_fb_page_token', array( $this, 'fts_fb_page_token_func' ) );
47
+ }
48
+
49
+ /**
50
+ * Init
51
+ *
52
+ * For Loading in the Admin.
53
+ *
54
+ * @since 1.9.6
55
+ */
56
+ public function init() {
57
+ if ( is_admin() ) {
58
+ // Register Settings!
59
+ add_action( 'admin_init', array( $this, 'fts_settings_page_register_settings' ) );
60
+ add_action( 'admin_init', array( $this, 'fts_facebook_style_options_page' ) );
61
+ add_action( 'admin_init', array( $this, 'fts_twitter_style_options_page' ) );
62
+ add_action( 'admin_init', array( $this, 'fts_instagram_style_options_page' ) );
63
+ add_action( 'admin_init', array( $this, 'fts_pinterest_style_options_page' ) );
64
+ add_action( 'admin_init', array( $this, 'fts_youtube_style_options_page' ) );
65
+
66
+ // Adds setting page to FTS menu!
67
+ add_action( 'admin_menu', array( $this, 'feed_them_main_menu' ) );
68
+ add_action( 'admin_menu', array( $this, 'feed_them_submenu_pages' ) );
69
+ // THIS GIVES US SOME OPTIONS FOR STYLING THE ADMIN AREA!
70
+ add_action( 'admin_enqueue_scripts', array( $this, 'feed_them_admin_css' ) );
71
+ // Main Settings Page!
72
+ if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-facebook-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-twitter-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-instagram-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-pinterest-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-youtube-feed-styles-submenu-page' === $_GET['page'] ) {
73
+ add_action( 'admin_enqueue_scripts', array( $this, 'feed_them_settings' ) );
74
+ }
75
+ // System Info Page!
76
+ if ( isset( $_GET['page'] ) && 'fts-system-info-submenu-page' === $_GET['page'] ) {
77
+ add_action( 'admin_enqueue_scripts', array( $this, 'feed_them_system_info_css' ) );
78
+ }
79
+ // FTS License Page!
80
+ if ( isset( $_GET['page'] ) && 'fts-license-page' === $_GET['page'] ) {
81
+ add_action( 'admin_footer', array( $this, 'fts_plugin_license' ) );
82
+ }
83
+ }
84
+
85
+ // FTS Admin Bar!
86
+ add_action( 'wp_before_admin_bar_render', array( $this, 'fts_admin_bar_menu' ), 999 );
87
+ // Settings option. Add Custom CSS to the header of FTS pages only!
88
+ $fts_include_custom_css_checked_css = get_option( 'fts-color-options-settings-custom-css' );
89
+ if ( '1' === $fts_include_custom_css_checked_css ) {
90
+ add_action( 'wp_enqueue_scripts', array( $this, 'fts_color_options_head_css' ) );
91
+ }
92
+ // Facebook Settings option. Add Custom CSS to the header of FTS pages only!
93
+ $fts_include_fb_custom_css_checked_css = '1';
94
+ if ( '1' === $fts_include_fb_custom_css_checked_css ) {
95
+ add_action( 'wp_enqueue_scripts', array( $this, 'fts_fb_color_options_head_css' ) );
96
+ }
97
+ // Settings option. Custom Powered by Feed Them Social Option!
98
+ $fts_powered_text_options_settings = get_option( 'fts-powered-text-options-settings' );
99
+ if ( '1' !== $fts_powered_text_options_settings ) {
100
+ add_action( 'wp_enqueue_scripts', array( $this, 'fts_powered_by_js' ) );
101
+ }
102
+
103
+ if ( is_plugin_active( 'jetpack/jetpack.php' ) ) {
104
+ add_filter( 'jetpack_photon_skip_image', array( $this, 'fts_jetpack_photon_exception' ), 10, 3 );
105
+ }
106
+ }
107
+
108
+ /**
109
+ * FTS Instagram Token Ajax
110
+ *
111
+ * This will save the returned token to the database.
112
+ *
113
+ * @since 2.3.3
114
+ */
115
+ public function fts_instagram_token_ajax() {
116
+
117
+ $fts_refresh_token_nonce = wp_create_nonce( 'fts_token_nonce' );
118
+ $access_token = $_REQUEST['access_token'];
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( $insta_id ) );
124
+ }
125
+ }
126
+ die;
127
+ }
128
+
129
+ /**
130
+ * Feed Them Instagram Save Token
131
+ *
132
+ * FTS Check and Save Instagram Token Validity.
133
+ *
134
+ * @return bool
135
+ * @since 2.6.1
136
+ */
137
+ public function feed_them_instagram_save_token() {
138
+
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['access_token'];
144
+
145
+ if ( isset( $auth_obj ) ) {
146
+ ?>
147
+ <script>
148
+ jQuery(document).ready(function () {
149
+ var access_token = '<?php echo sanitize_text_field( $auth_obj ); ?>';
150
+ jQuery.ajax({
151
+ data: {
152
+ action: 'fts_instagram_token_ajax',
153
+ access_token: access_token,
154
+ },
155
+ type: 'POST',
156
+ url: ftsAjax.ajaxurl,
157
+ success: function (response) {
158
+ <?php
159
+ $auth_obj = $_GET['access_token'];
160
+ $insta_url = esc_url( 'https://api.instagram.com/v1/users/self/?access_token=' . $auth_obj );
161
+ // Get Data for Instagram to check for errors
162
+ $response = wp_remote_fopen( $insta_url );
163
+ $test_app_token_response = json_decode( $response );
164
+
165
+ // if the combined streams plugin is active we won't allow the settings page link to open up the Instagram Feed, instead we'll remove the #feed_type=instagram and just let the user manually select the combined streams or single instagram feed.
166
+ if ( is_plugin_active( 'feed-them-social-combined-streams/feed-them-social-combined-streams.php' ) ) {
167
+ $custom_instagram_link_hash = '';
168
+ } else {
169
+ $custom_instagram_link_hash = '#feed_type=instagram';
170
+ }
171
+ if ( ! isset( $test_app_token_response->meta->error_message ) && ! isset( $test_app_token_response->error_message ) || isset( $test_app_token_response->meta->error_message ) && 'This client has not been approved to access this resource.' === $test_app_token_response->meta->error_message ) {
172
+ $fts_instagram_message = sprintf(
173
+ esc_html( '%1$sYour access token is working! Generate your shortcode on the %2$sSettings Page%3$s', 'feed-them-social' ),
174
+ '<div class="fts-successful-api-token">',
175
+ '<a href="' . esc_url( 'admin.php?page=feed-them-settings-page' . $custom_instagram_link_hash ) . '">',
176
+ '</a></div>'
177
+ );
178
+ ?>
179
+ jQuery('.fts-failed-api-token').hide();
180
+ if (!jQuery('.fts-successful-api-token').length) {
181
+ jQuery('.fts-instagram-last-row').append('<?php echo $fts_instagram_message; ?>');
182
+ }
183
+ jQuery('.fts-success').show();
184
+ <?php
185
+ } elseif ( isset( $test_app_token_response->meta->error_message ) || isset( $test_app_token_response->error_message ) ) {
186
+ $text = isset( $test_app_token_response->meta->error_message ) ? $test_app_token_response->meta->error_message : $test_app_token_response->error_message;
187
+ $fts_instagram_message = sprintf(
188
+ esc_html( '%1$sOh No something\'s wrong. %2$s. Please try clicking the button again to get a new access token. If you need additional assistance please email us at support@slickremix.com %3$s.', 'feed-them-social' ),
189
+ '<div class="fts-failed-api-token">',
190
+ esc_html( $text ),
191
+ '</div>'
192
+ );
193
+ ?>
194
+ if (jQuery('.fts-failed-api-token').length) {
195
+ jQuery('.fts-failed-api-token').hide();
196
+ jQuery('.fts-instagram-last-row').append('<?php echo $fts_instagram_message; ?>');
197
+ }
198
+ <?php
199
+ }
200
+ ?>
201
+ }
202
+ }); // end of ajax()
203
+ return false;
204
+ }); // end of document.ready
205
+ </script>
206
+ <?php
207
+ }
208
+ }
209
+ }
210
+
211
+ /**
212
+ * FTS JetPack Photon Option Exception
213
+ *
214
+ * This function resolves issues with images and JetPack
215
+ *
216
+ * @param string $val value.
217
+ * @param string $src source.
218
+ * @param string $tag tag.
219
+ * @return bool
220
+ * @since @since 1.9.6
221
+ */
222
+ public function fts_jetpack_photon_exception( $val, $src, $tag ) {
223
+ if ( strpos( $src, 'fbcdn.net' ) ) {
224
+ return true;
225
+ }
226
+ return $val;
227
+ }
228
+
229
+ /**
230
+ * FTS Share Option
231
+ *
232
+ * @param string $fb_link link for social network.
233
+ * @param string $description description field for some of the social networks.
234
+ * @since
235
+ */
236
+ public function fts_share_option( $fb_link, $description ) {
237
+
238
+ $hide_share = get_option( 'fts_disable_share_button', true ) ? get_option( 'fts_disable_share_button', true ) : '';
239
+
240
+ if ( isset( $hide_share ) && '1' !== $hide_share ) {
241
+ // Social media sharing URLs
242
+ $link = $fb_link;
243
+ $description = wp_strip_all_tags( $description );
244
+ $ft_gallery_share_linkedin = 'https://www.linkedin.com/shareArticle?mini=true&url=' . $link;
245
+ $ft_gallery_share_email = 'mailto:?subject=Shared Link&body=' . $link . ' - ' . $description;
246
+ $ft_gallery_share_facebook = 'https://www.facebook.com/sharer/sharer.php?u=' . $link;
247
+ $ft_gallery_share_twitter = 'https://twitter.com/intent/tweet?text=' . $link . '+' . $description;
248
+ $ft_gallery_share_google = 'https://plus.google.com/share?url=' . $link;
249
+
250
+ // The share wrap and links
251
+ $output = '<div class="fts-share-wrap">';
252
+ $output .= '<a href="javascript:;" class="ft-gallery-link-popup">' . esc_html( '', 'feed-them-social' ) . '</a>';
253
+ $output .= '<div class="ft-gallery-share-wrap">';
254
+ $output .= '<a href="' . esc_attr( $ft_gallery_share_facebook ) . '" target="_blank" class="ft-galleryfacebook-icon"><i class="fa fa-facebook-square"></i></a>';
255
+ $output .= '<a href="' . esc_attr( $ft_gallery_share_twitter ) . '" target="_blank" class="ft-gallerytwitter-icon"><i class="fa fa-twitter"></i></a>';
256
+ $output .= '<a href="' . esc_attr( $ft_gallery_share_google ) . '" target="_blank" class="ft-gallerygoogle-icon"><i class="fa fa-google-plus"></i></a>';
257
+ $output .= '<a href="' . esc_attr( $ft_gallery_share_linkedin ) . '" target="_blank" class="ft-gallerylinkedin-icon"><i class="fa fa-linkedin"></i></a>';
258
+ $output .= '<a href="' . esc_attr( $ft_gallery_share_email ) . '" target="_blank" class="ft-galleryemail-icon"><i class="fa fa-envelope"></i></a>';
259
+ $output .= '</div>';
260
+ $output .= '</div>';
261
+ return $output;
262
+ }
263
+ }
264
+
265
+ /**
266
+ * FTS FB Options Page Function
267
+ *
268
+ * Display FB Page tokens for users
269
+ *
270
+ * @return mixed
271
+ * @since 2.1.4
272
+ */
273
+ public function fts_fb_page_token_func() {
274
+ $fts_fb_page_token_users_nonce = wp_create_nonce( 'fts-fb-page-token-users-nonce' );
275
+
276
+ if ( wp_verify_nonce( $fts_fb_page_token_users_nonce, 'fts-fb-page-token-users-nonce' ) ) {
277
+
278
+ // Make sure it's not ajaxing!
279
+ if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
280
+ $_REQUEST['fts_dynamic_name'] = sanitize_key( $this->feed_them_social_rand_string() );
281
+ } //End make sure it's not ajaxing!
282
+
283
+ ob_start();
284
+
285
+ if ( ! isset( $_GET['locations'] ) ) {
286
+ $fb_token_response = isset( $_REQUEST['next_url'] ) ? wp_remote_fopen( esc_url_raw( $_REQUEST['next_url'] ) ) : 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['access_token'] . '&limit=25' );
287
+ $test_fb_app_token_response = json_decode( $fb_token_response );
288
+ $_REQUEST['next_url'] = isset( $test_fb_app_token_response->paging->next ) ? esc_url_raw( $test_fb_app_token_response->paging->next ) : '';
289
+ } else {
290
+ $fb_token_response = isset( $_REQUEST['next_location_url'] ) ? wp_remote_fopen( esc_url_raw( $_REQUEST['next_location_url'] ) ) : '';
291
+ $test_fb_app_token_response = json_decode( $fb_token_response );
292
+ }
293
+
294
+ // echo '<pre>';
295
+ // echo _r($test_fb_app_token_response);
296
+ // echo '</pre>';
297
+ // Make sure it's not ajaxing!
298
+ if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
299
+ // ******************
300
+ // Load More BUTTON Start
301
+ // ******************
302
+ ?>
303
+ <div class="fts-clear"></div>
304
+ <?php
305
+ } //End make sure it's not ajaxing!
306
+
307
+ $build_shortcode = 'fts_fb_page_token';
308
+
309
+ // Make sure it's not ajaxing!
310
+ if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
311
+
312
+ $reviews_token = isset( $_GET['reviews_token'] ) ? 'yes' : 'no';
313
+ ?>
314
+ <div id="fb-list-wrap">
315
+ <div class="fts-pages-info"> <?php echo esc_html( 'Click on a page in the list below and it will add the Page ID and Access Token above, then click save.', 'feed-them-social' ); ?></div>
316
+ <ul class="fb-page-list fb-page-master-list">
317
+ <?php
318
+ } //End make sure it's not ajaxing!
319
+
320
+ foreach ( $test_fb_app_token_response->data as $data ) {
321
+ ?>
322
+ <li class="fts-fb-main-page-li">
323
+ <div class="fb-click-wrapper">
324
+ <div class="fb-image">
325
+ <img border="0" height="50" width="50"
326
+ src="<?php echo esc_url( 'https://graph.facebook.com/' . $data->id . '/picture' ); ?>"/>
327
+ </div>
328
+ <div class="fb-name-wrap"><span class="fb-name">
329
+ <?php
330
+ echo esc_html( $data->name );
331
+ if ( isset( $data->store_number, $data->store_location_descriptor ) ) {
332
+ print '(' . $data->store_location_descriptor . ')';
333
+ }
334
+ ?>
 
 
 
 
 
 
 
335
  </span></div>
336
+ <div class="fb-other-wrap">
337
+ <small>
338
+ <?php echo esc_html( 'ID: ', 'feed-them-social' ); ?>
339
+ <span class="fts-api-facebook-id"><?php echo esc_html( $data->id ); ?></span>
340
+ <?php echo isset( $data->store_number ) ? esc_html( '| Location: ' . $data->store_number, 'feed-them-social' ) : ''; ?>
341
+ </small>
342
+ </div>
343
+ <div class="page-token"><?php echo esc_attr( $data->access_token ); ?></div>
344
+ <?php
345
+ $facebook_input_token = get_option( 'fts_facebook_custom_api_token' );
346
+ $facebook_access_token = $data->access_token;
347
+ if ( $facebook_input_token === $facebook_access_token ) {
348
+ ?>
349
+ <div class="feed-them-social-admin-submit-btn " style="display: block !important;">
350
+ Active
351
+ </div>
352
+ <?php } else { ?>
353
+ <div class="feed-them-social-admin-submit-btn fts-token-save">Save</div>
354
+ <?php } ?>
355
+ <div class="fts-clear"></div>
356
+ </div>
357
+ <?php
358
+ $_REQUEST['next_location_url'] = isset( $data->locations->paging->next ) ? esc_url_raw( $data->locations->paging->next ) : '';
359
+ $remove_class_or_not = isset( $data->locations->paging->next ) ? 'fb-sublist-page-id-' . esc_attr( $data->id ) : '';
360
+ if ( isset( $data->locations->data ) ) {
361
+ $location_count = count( $data->locations->data );
362
+ $location_plus_sign = isset( $data->locations->paging->next ) ? '+' : '';
363
+ $location_text = 1 === $location_count ? esc_html( $location_count . ' ' . esc_html( 'Location for', 'feed-them-social' ) ) : esc_html( $location_count . $location_plus_sign . ' ' . esc_html( 'Locations for', 'feed-them-social' ) );
364
+ // if the locations equal 3 or less we will set the location container height to auto so the scroll loadmore does not fire.
365
+ $location_scroll_loadmore_needed_check = $location_count <= 3 ? 'height:auto !important' : 'height: 200px !important;';
366
+ }
367
+
368
+ if ( ! isset( $_GET['locations'] ) && isset( $data->locations->data ) ) {
369
+ ?>
370
+ <div class="fts-fb-location-text-wrap"><?php echo esc_html( $location_text . ' ' . $data->name ); ?></div>
371
+ <ul class="fb-page-list fb-sublist <?php echo esc_attr( $remove_class_or_not ); ?>"
372
+ style="<?php echo esc_attr( $location_scroll_loadmore_needed_check ); ?>">
373
+ <?php foreach ( $data->locations->data as $location ) { ?>
374
+ <li>
375
+ <div class="fb-click-wrapper">
376
+ <div class="fb-image">
377
+ <img border="0" height="50" width="50"
378
+ src="<?php echo esc_url( 'https://graph.facebook.com/' . $location->id . '/picture' ); ?>"/>
379
+ </div>
380
+ <div class="fb-name-wrap"><span
381
+ class="fb-name"><?php echo esc_html( $location->name ); ?>
382
+ <?php
383
+ if ( isset( $location->store_location_descriptor ) ) {
384
+ echo '(' . esc_html( $location->store_location_descriptor ) . ')';
385
+ }
386
+ ?>
387
  </span></div>
388
+ <div class="fb-other-wrap">
389
+ <small>
390
+ <?php echo esc_html( 'ID: ', 'feed-them-social' ); ?>
391
+ <span class="fts-api-facebook-id"><?php echo esc_html( $location->id ); ?></span>
392
+ <?php
393
+ if ( isset( $location->store_number ) ) {
394
+ print '| ';
395
+ esc_html( 'Location:', 'feed-them-social' );
396
+ print ' ' . esc_html( $location->store_number );
397
+ }
398
+ ?>
399
+ </small>
400
+ </div>
401
+
402
+ <div class="page-token"><?php echo esc_html( $location->access_token ); ?></div>
403
+ <?php
404
+ $facebook_input_token = get_option( 'fts_facebook_custom_api_token' );
405
+ $facebook_access_token = $location->access_token;
406
+ if ( $facebook_input_token === $facebook_access_token ) {
407
+ ?>
408
+ <div class="feed-them-social-admin-submit-btn "
409
+ style="display: block !important;">Active
410
+ </div>
411
+ <?php } else { ?>
412
+ <div class="feed-them-social-admin-submit-btn fts-token-save">Save
413
+ </div>
414
+ <?php } ?>
415
+ <div class="fts-clear"></div>
416
+ </div>
417
+ </li>
418
+ <?php } ?>
419
+ </ul>
420
+
421
+ <?php
422
+ // Make sure it's not ajaxing locations!
423
+ if ( ! isset( $_GET['locations'] ) && isset( $data->locations->paging->next ) ) {
424
+ echo '<div id="loadMore_' . esc_attr( $data->id ) . '_location" class="fts-fb-load-more" style="background:none !Important;">' . esc_html( 'Scroll to view more Locations', 'feed-them-instagram' ) . '</div>';
425
+ }//End Check
426
+
427
+ // Make sure it's not ajaxing locations!
428
+ if ( ! isset( $_GET['locations'] ) ) {
429
+ $time = time();
430
+ $nonce = wp_create_nonce( $time . 'load-more-nonce' );
431
+ $fb_page_id = $data->id;
432
+ ?>
433
+ <script>
434
+ jQuery(document).ready(function () {
435
+ jQuery(".fb-sublist-page-id-<?php echo esc_js( $fb_page_id ); ?>").bind("scroll", function () {
436
+ if (jQuery(this).scrollTop() + jQuery(this).innerHeight() >= jQuery(this)[0].scrollHeight) {
437
+ if (!jQuery('.fts-no-more-locations-<?php echo esc_js( $fb_page_id ); ?>').length) {
438
+ jQuery("#loadMore_<?php echo esc_js( $fb_page_id ); ?>_location").addClass('fts-fb-spinner');
439
+ var button = jQuery('#loadMore_<?php echo esc_js( $fb_page_id ); ?>_location').html('<div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div>');
440
+ console.log(button);
441
+ var build_shortcode = "<?php echo esc_js( $build_shortcode ); ?>";
442
+ var yes_ajax = "yes";
443
+ var fts_d_name = "<?php echo esc_js( $fb_page_id ); ?>";
444
+ var fts_security = "<?php echo esc_js( $nonce ); ?>";
445
+ var fts_time = "<?php echo esc_js( $time ); ?>";
446
+ var fts_reviews_feed = "<?php echo esc_js( $reviews_token ); ?>";
447
+ jQuery.ajax({
448
+ data: {
449
+ action: "my_fts_fb_load_more",
450
+ next_location_url: nextURL_location_<?php echo esc_js( $fb_page_id ); ?>,
451
+ fts_dynamic_name: fts_d_name,
452
+ rebuilt_shortcode: build_shortcode,
453
+ load_more_ajaxing: yes_ajax,
454
+ fts_security: fts_security,
455
+ fts_time: fts_time,
456
+ feed_name: build_shortcode,
457
+ fts_reviews_feed: fts_reviews_feed,
458
+ locations: 'yes'
459
+ },
460
+ type: 'GET',
461
+ url: ajaxurl,
462
+ success: function (data) {
463
+ console.log('Well Done and got this from sever: ' + data);
464
+ jQuery('.fb-sublist-page-id-<?php echo esc_js( $fb_page_id ); ?>').append(data).filter('.fb-sublist-page-id-<?php echo esc_js( $fb_page_id ); ?>').html();
465
+ jQuery('.fb-sublist-page-id-<?php echo esc_js( $fb_page_id ); ?>').animate({scrollTop: '+=100px'}, 800); // scroll down a 100px after new items are added
466
+
467
+
468
+
469
+ <?php if ( isset( $data->locations->paging->next ) && $data->locations->paging->next === $_REQUEST['next_location_url'] ) { ?>
470
+ jQuery('#loadMore_<?php echo esc_js( $fb_page_id ); ?>_location').replaceWith('<div class="fts-fb-load-more no-more-posts-fts-fb fts-no-more-locations-<?php echo esc_js( $fb_page_id ); ?>" style="background:none !important"><?php echo esc_html( 'All Locations loaded', 'feed-them-social' ); ?></div>');
471
+ jQuery('#loadMore_<?php echo esc_js( $fb_page_id ); ?>_location').removeAttr('id');
472
+ <?php } ?>
473
+ jQuery("#loadMore_<?php echo esc_js( $fb_page_id ); ?>_location").removeClass('fts-fb-spinner');
474
+ }
475
+ }); // end of ajax()
476
+ return false;
477
+
478
+ } //stop ajax from submitting again if the fts-no-more-locations class is found
479
+
480
+ }
481
+ }); // end of form.submit
482
+
483
+ }); // end of document.ready
484
+ </script>
485
+ <?php
486
+ } //END Make sure it's not ajaxing locations
487
+ ?>
488
+ <script>var nextURL_location_<?php echo esc_js( $fb_page_id ); ?>= "<?php echo isset( $data->locations->paging->next ) ? esc_url_raw( $data->locations->paging->next ) : ''; ?>";</script>
489
+ <?php } ?>
490
+ </li>
491
+
492
+ <?php
493
+ } // foreach loop of locations
494
+
495
+ // Make sure it's not ajaxing!
496
+ if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
497
+ ?>
498
+ </ul>
499
+ <div class="fts-clear"></div>
500
+ </div>
501
+ <?php
502
+ } //End make sure it's not ajaxing
503
+
504
+ // Make sure it's not ajaxing!
505
+ if ( ! isset( $_GET['load_more_ajaxing'] ) && ! isset( $_GET['locations'] ) ) {
506
+ $fts_dynamic_name = isset( $_REQUEST['fts_dynamic_name'] ) ? sanitize_key( $_REQUEST['fts_dynamic_name'] ) : '';
507
+ $time = time();
508
+ $nonce = wp_create_nonce( $time . 'load-more-nonce' );
509
+ ?>
510
+ <script>
511
+ jQuery(document).ready(function () {
512
+
513
+ jQuery("#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>").click(function () {
514
+
515
+ jQuery("#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>").addClass('fts-fb-spinner');
516
+ var button = jQuery('#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>').html('<div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div>');
517
+ console.log(button);
518
+ var build_shortcode = "<?php echo esc_js( $build_shortcode ); ?>";
519
+ var yes_ajax = "yes";
520
+ var fts_d_name = "<?php echo esc_js( $fts_dynamic_name ); ?>";
521
+ var fts_security = "<?php echo esc_js( $nonce ); ?>";
522
+ var fts_time = "<?php echo esc_js( $time ); ?>";
523
+ var fts_reviews_feed = "<?php echo esc_js( $reviews_token ); ?>";
524
+ jQuery.ajax({
525
+ data: {
526
+ action: "my_fts_fb_load_more",
527
+ next_url: nextURL_<?php echo esc_js( $fts_dynamic_name ); ?>,
528
+ fts_dynamic_name: fts_d_name,
529
+ rebuilt_shortcode: build_shortcode,
530
+ load_more_ajaxing: yes_ajax,
531
+ fts_security: fts_security,
532
+ fts_time: fts_time,
533
+ feed_name: build_shortcode,
534
+ fts_reviews_feed: fts_reviews_feed
535
+ },
536
+ type: 'GET',
537
+ url: ajaxurl,
538
+ success: function (data) {
539
+ console.log('Well Done and got this from sever: ' + data);
540
+ jQuery('.fb-page-master-list').append(data).filter('.fb-page-list').html();
541
+
542
+ if (!nextURL_<?php echo esc_js( sanitize_text_field( wp_unslash( $_REQUEST['fts_dynamic_name'] ) ) ); ?> || 'no more' === nextURL_<?php echo esc_js( sanitize_text_field( wp_unslash( $_REQUEST['fts_dynamic_name'] ) ) ); ?>) {
543
+ 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( 'No More Pages', 'feed-them-social' ); ?></div>');
544
+ jQuery('#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>').removeAttr('id');
545
+ }
546
+ jQuery('#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>').html('<?php echo esc_js( 'Load More', 'feed-them-social' ); ?>');
547
+ // jQuery('#loadMore_< ?php echo $fts_dynamic_name ?>').removeClass('flip360-fts-load-more');
548
+ jQuery("#loadMore_<?php echo esc_js( $fts_dynamic_name ); ?>").removeClass('fts-fb-spinner');
549
+
550
+
551
+ }
552
+ }); // end of ajax()
553
+ return false;
554
+ }); // end of form.submit
555
+ }); // end of document.ready
556
+ </script>
557
+ <?php
558
+
559
+ } //END Make sure it's not ajaxing
560
+ ?>
561
+ <script>
562
+ <?php if ( ! isset( $_GET['locations'] ) ) { ?>
563
+ var nextURL_<?php echo esc_js( sanitize_text_field( wp_unslash( $_REQUEST['fts_dynamic_name'] ) ) ); ?>= "<?php echo esc_url_raw( $_REQUEST['next_url'] ); ?>";
564
+ // alert('nextURL_<?php echo esc_js( sanitize_text_field( wp_unslash( $_REQUEST['fts_dynamic_name'] ) ) ); ?>');
565
+ <?php } ?>
566
+
567
+
568
+ if (document.querySelector('#fts-fb-token-wrap .fts-pages-info') !== null) {
569
+ jQuery(".fts-successful-api-token.default-token").hide();
570
+ }
571
+ <?php if ( 'yes' === $reviews_token || isset( $_GET['fts_reviews_feed'] ) && 'yes' === $_GET['fts_reviews_feed'] ) { ?>
572
+ if (document.querySelector('.default-token') !== null) {
573
+ jQuery(".default-token").show();
574
+ }
575
+
576
+ <?php } ?>
577
+
578
+ jQuery(document).ready(function ($) {
579
+ $(".feed-them-social-admin-submit-btn").click(function () {
580
+ // alert('test');
581
+ var newUrl = "<?php echo esc_url( admin_url( 'admin.php?page=fts-facebook-feed-styles-submenu-page/' ) ); ?>";
582
+ history.replaceState({}, null, newUrl);
583
+ $("#fts-facebook-feed-options-form").submit();
584
+ });
585
+
586
+ var fb = ".fb-page-list .fb-click-wrapper";
587
+ $('#fb-list-wrap').show();
588
+ //alert("reviews_token");
589
+
590
+ $(fb).click(function () {
591
+ var fb_page_id = $(this).find('.fts-api-facebook-id').html();
592
+ var token = $(this).find('.page-token').html();
593
+ // alert(token);
594
+ var name = $(this).find('.fb-name').html();
595
+ <?php if ( 'no' === $reviews_token || isset( $_GET['fts_reviews_feed'] ) && 'no' === $_GET['fts_reviews_feed'] ) { ?>
596
+ $("#fts_facebook_custom_api_token").val(token);
597
+ $("#fts_facebook_custom_api_token_user_id").val(fb_page_id);
598
+ $("#fts_facebook_custom_api_token_user_name").val(name);
599
+ <?php } else { ?>
600
+ $("#fts_facebook_custom_api_token_biz").val(token);
601
+ $("#fts_facebook_custom_api_token_user_id_biz").val(fb_page_id);
602
+ $("#fts_facebook_custom_api_token_user_name_biz").val(name);
603
+ <?php } ?>
604
+ $('.fb-page-list .feed-them-social-admin-submit-btn').hide();
605
+ $(this).find('.feed-them-social-admin-submit-btn').toggle();
606
+ // alert(name + token)
607
+ })
608
+ });
609
+ </script>
610
+ <?php
611
+ // Make sure it's not ajaxing!
612
+ if ( ! isset( $_GET['load_more_ajaxing'] ) && isset( $test_fb_app_token_response->paging->next ) && ! isset( $_GET['locations'] ) ) {
613
+ $fts_dynamic_name = sanitize_key( $_REQUEST['fts_dynamic_name'] );
614
+ echo '<div class="fts-clear"></div>';
615
+
616
+ echo '<div id="loadMore_' . esc_attr( $fts_dynamic_name ) . '" class="fts-fb-load-more">' . esc_html( 'Load More', 'feed-them-social' ) . '</div>';
617
+ }//End make sure it's not ajaxing
618
+
619
+ // Lastly if we can't find a next url we unset the next url from the page to not let the loadmore button be active.
620
+ if ( isset( $_GET['locations'] ) ) {
621
+ unset( $_REQUEST['next_location_url'] );
622
+ } else {
623
+ unset( $_REQUEST['next_url'] );
624
+ }
625
+ return ob_get_clean();
626
+ }
627
+ exit;
628
+ }
629
+
630
+
631
+ /**
632
+ * My FTS Plugin License
633
+ *
634
+ * Put in place to only show the Activate Plugin license if the input has a value
635
+ *
636
+ * @since 2.1.4
637
+ */
638
+ public function fts_plugin_license() {
639
+ wp_enqueue_script( 'jquery' );
640
+ ?>
641
+ <style>.fts-license-master-form th {
642
+ background: #f9f9f9;
643
+ padding: 14px;
644
+ border-bottom: 1px solid #ccc;
645
+ margin: -14px -14px 20px;
646
+ width: 100%;
647
+ display: block
648
+ }
649
+
650
+ .fts-license-master-form .form-table tr {
651
+ float: left;
652
+ margin: 0 15px 15px 0;
653
+ background: #fff;
654
+ border: 1px solid #ccc;
655
+ width: 30.5%;
656
+ max-width: 350px;
657
+ padding: 14px;
658
+ min-height: 220px;
659
+ position: relative;
660
+ box-sizing: border-box
661
+ }
662
+
663
+ .fts-license-master-form .form-table td {
664
+ padding: 0;
665
+ display: block
666
+ }
667
+
668
+ .fts-license-master-form td input.regular-text {
669
+ margin: 0 0 8px;
670
+ width: 100%
671
+ }
672
+
673
+ .fts-license-master-form .edd-license-data[class*=edd-license-] {
674
+ position: absolute;
675
+ background: #fafafa;
676
+ padding: 14px;
677
+ border-top: 1px solid #eee;
678
+ margin: 20px -14px -14px;
679
+ min-height: 67px;
680
+ width: 100%;
681
+ bottom: 14px;
682
+ box-sizing: border-box
683
+ }
684
+
685
+ .fts-license-master-form .edd-license-data p {
686
+ font-size: 13px;
687
+ margin-top: 0
688
+ }
689
+
690
+ .fts-license-master-form tr {
691
+ display: none
692
+ }
693
+
694
+ .fts-license-master-form tr.fts-license-wrap {
695
+ display: block
696
+ }
697
+
698
+ .fts-license-master-form .edd-license-msg-error {
699
+ background: rgba(255, 0, 0, 0.49)
700
+ }
701
+
702
+ .fts-license-master-form tr.fts-license-wrap {
703
+ display: block
704
+ }
705
+
706
+ .fts-license-master-form .edd-license-msg-error {
707
+ background: #e24e4e !important;
708
+ color: #FFF
709
+ }
710
+
711
+ .fts-license-wrap .edd-license-data p {
712
+ color: #1e981e
713
+ }
714
+
715
+ .edd-license-msg-error p {
716
+ color: #FFF !important
717
+ }
718
+
719
+ .feed-them_page_fts-license-page .button-secondary {
720
+ display: none;
721
+ }</style>
722
+ <script type="text/javascript">
723
+ jQuery(document).ready(function () {
724
+ if (jQuery('#feed_them_social_premium_license_key').val() !== '') {
725
+ jQuery('#feed_them_social_premium_license_key').next('label').find('.button-secondary').show()
726
+ }
727
+ if (jQuery('#feed_them_social_combined_streams_license_key').val() !== '') {
728
+ jQuery('#feed_them_social_combined_streams_license_key').next('label').find('.button-secondary').show()
729
+ }
730
+ if (jQuery('#feed-them-social-facebook-reviews_license_key').val() !== '') {
731
+ jQuery('#feed-them-social-facebook-reviews_license_key').next('label').find('.button-secondary').show()
732
+ }
733
+ if (jQuery('#fts_bar_license_key').val() !== '') {
734
+ jQuery('#fts_bar_license_key').next('label').find('.button-secondary').show()
735
+ }
736
+ if (jQuery('#feed_them_carousel_premium_license_key').val() !== '') {
737
+ jQuery('#feed_them_carousel_premium_license_key').next('label').find('.button-secondary').show()
738
+ }
739
+ });
740
+ </script>
741
+ <?php
742
+ }
743
+
744
+ /**
745
+ * My FTS Ajaxurl
746
+ *
747
+ * Ajax var on front end for twitter videos and loadmore button (if premium active.
748
+ *
749
+ * @since 1.9.6
750
+ */
751
+ public function my_fts_ajaxurl() {
752
+ wp_enqueue_script( 'jquery' );
753
+ }
754
+
755
+ /**
756
+ * My FTS FB Load More
757
+ *
758
+ * This function is being called from the fb feed... it calls the ajax in this case.
759
+ *
760
+ * @since 1.9.6
761
+ * @updated 2.1.4 (fts_fb_page_token)
762
+ */
763
+ public function my_fts_fb_load_more() {
764
+ if ( isset( $_REQUEST['fts_security'], $_REQUEST['fts_time'] ) && ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['fts_security'] ) ), sanitize_text_field( wp_unslash( $_REQUEST['fts_time'] ) ) . 'load-more-nonce' ) ) {
765
+ exit( 'Sorry, You can\'t do that!' );
766
+ } else {
767
+
768
+ if ( isset( $_REQUEST['feed_name'] ) && 'fts_fb_page_token' === $_REQUEST['feed_name'] ) {
769
+ if ( isset( $_REQUEST['next_url'] ) && false === strpos( sanitize_text_field( wp_unslash( $_REQUEST['next_url'] ) ), 'https://graph.facebook.com/v3.1' ) ||
770
+ isset( $_REQUEST['next_location_url'] ) && false === strpos( sanitize_text_field( wp_unslash( $_REQUEST['next_location_url'] ) ), 'https://graph.facebook.com/v3.1' ) ||
771
+ isset( $_REQUEST['next_url'] ) && sanitize_text_field( wp_unslash( $_REQUEST['next_url'] ) ) !== sanitize_text_field( wp_unslash( $_REQUEST['next_url'] ) ) ||
772
+ isset( $_REQUEST['next_location_url'] ) && sanitize_text_field( wp_unslash( $_REQUEST['next_location_url'] ) ) !== sanitize_text_field( wp_unslash( $_REQUEST['next_location_url'] ) ) ) {
773
+
774
+ exit( 'That is not an FTS shortcode!' );
775
+ }
776
+ }
777
+
778
+ if ( isset( $_REQUEST['feed_name'] ) && 'fts_fb_page_token' === $_REQUEST['feed_name'] ||
779
+ isset( $_REQUEST['feed_name'] ) && 'fts_twitter' === $_REQUEST['feed_name'] ||
780
+ isset( $_REQUEST['feed_name'] ) && 'fts_youtube' === $_REQUEST['feed_name'] ||
781
+ isset( $_REQUEST['feed_name'] ) && 'fts_facebook' === $_REQUEST['feed_name'] ||
782
+ isset( $_REQUEST['feed_name'] ) && 'fts_facebookbiz' === $_REQUEST['feed_name'] ||
783
+ isset( $_REQUEST['feed_name'] ) && 'fts_instagram' === $_REQUEST['feed_name'] ) {
784
+
785
+ $feed_atts = isset( $_REQUEST['feed_attributes'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['feed_attributes'] ) ) : '';
786
+
787
+ $build_shortcode = '[' . sanitize_text_field( wp_unslash( $_REQUEST['feed_name'] ) ) . '';
788
+ foreach ( $feed_atts as $attribute => $value ) {
789
+ $build_shortcode .= ' ' . $attribute . '=' . $value;
790
+ }
791
+
792
+ if ( 'fts_twitter' === $_REQUEST['feed_name'] ) {
793
+ $loadmore_count = isset( $_REQUEST['loadmore_count'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['loadmore_count'] ) ) : '';
794
+ $build_shortcode .= ' ' . $loadmore_count . ']';
795
+ } elseif ( 'fts_youtube' === $_REQUEST['feed_name'] ) {
796
+ $loadmore_count = isset( $_REQUEST['loadmore_count'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['loadmore_count'] ) ) : '';
797
+ $build_shortcode .= ' ' . $loadmore_count . ']';
798
+ } else {
799
+ $build_shortcode .= ' ]';
800
+ }
801
+
802
+ echo do_shortcode( $build_shortcode );
803
+
804
+ } else {
805
+ exit( esc_html( 'That is not an FTS shortcode!' ) );
806
+ }
807
+ }
808
+ die();
809
+ }
810
+
811
+ /**
812
+ * FTS Clear Cache Script
813
+ *
814
+ * This is for the fts_clear_cache_ajax submission.
815
+ *
816
+ * @since 1.9.6
817
+ */
818
+ public function fts_clear_cache_script() {
819
+
820
+ $fts_admin_activation_clear_cache = get_option( 'Feed_Them_Social_Activated_Plugin' );
821
+ $fts_dev_mode_cache = get_option( 'fts_clear_cache_developer_mode' );
822
+ if ( '1' === $fts_dev_mode_cache || 'feed-them-social' === $fts_admin_activation_clear_cache ) {
823
+ wp_enqueue_script( 'fts_clear_cache_script', plugins_url( 'feed-them-social/admin/js/developer-admin.js' ), array( 'jquery' ), FTS_CURRENT_VERSION, false );
824
+ wp_localize_script( 'fts_clear_cache_script', 'ftsAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
825
+ wp_enqueue_script( 'jquery' );
826
+ wp_enqueue_script( 'fts_clear_cache_script' );
827
+ }
828
+ if ( 'hide-admin-bar-menu' !== $fts_dev_mode_cache && '1' !== $fts_dev_mode_cache ) {
829
+ wp_enqueue_script( 'jquery' );
830
+ wp_enqueue_script( 'fts_clear_cache_script', plugins_url( 'feed-them-social/admin/js/admin.js' ), array(), FTS_CURRENT_VERSION, false );
831
+ wp_enqueue_script( 'fts_clear_cache_script', plugins_url( 'feed-them-social/admin/js/developer-admin.js' ), array( 'jquery' ), FTS_CURRENT_VERSION, false );
832
+ wp_localize_script( 'fts_clear_cache_script', 'ftsAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
833
+ wp_enqueue_script( 'fts_clear_cache_script' );
834
+ }
835
+
836
+ // we delete this option if found so we only empty the cache once when the plugin is ever activated or updated!
837
+ delete_option( 'Feed_Them_Social_Activated_Plugin' );
838
+ }
839
+
840
+ /**
841
+ * Feed Them Main Menu
842
+ *
843
+ * Admin Submenu buttons // Add the word Settings in place of the default menu page name 'Feed Them'.
844
+ *
845
+ * @since 1.9.6
846
+ */
847
+ public function feed_them_main_menu() {
848
+ // Main Settings Page!
849
+ $main_settings_page = new FTS_Settings_Page();
850
+ add_menu_page( 'Feed Them Social', 'Feed Them', 'manage_options', 'feed-them-settings-page', array( $main_settings_page, 'feed_them_settings_page' ), '' );
851
+ add_submenu_page( 'feed-them-settings-page', esc_html( 'Settings', 'feed-them-social' ), esc_html( 'Settings', 'feed-them-social' ), 'manage_options', 'feed-them-settings-page' );
852
+ }
853
+
854
+ /**
855
+ * Feed Them Submenu Pages
856
+ *
857
+ * @since 1.9.6
858
+ */
859
+ public function feed_them_submenu_pages() {
860
+
861
+ // Facebook Options Page!
862
+ $facebook_options_page = new FTS_Facebook_Options_Page();
863
+ add_submenu_page(
864
+ 'feed-them-settings-page',
865
+ esc_html( 'Facebook Options', 'feed-them-social' ),
866
+ esc_html( 'Facebook Options', 'feed-them-social' ),
867
+ 'manage_options',
868
+ 'fts-facebook-feed-styles-submenu-page',
869
+ array( $facebook_options_page, 'feed_them_facebook_options_page' )
870
+ );
871
+ // Instagram Options Page!
872
+ $instagram_options_page = new FTS_Instagram_Options_Page();
873
+ add_submenu_page(
874
+ 'feed-them-settings-page',
875
+ esc_html( 'Instagram Options', 'feed-them-social' ),
876
+ esc_html( 'Instagram Options', 'feed-them-social' ),
877
+ 'manage_options',
878
+ 'fts-instagram-feed-styles-submenu-page',
879
+ array( $instagram_options_page, 'feed_them_instagram_options_page' )
880
+ );
881
+ // Twitter Options Page!
882
+ $twitter_options_page = new FTS_Twitter_Options_Page();
883
+ add_submenu_page(
884
+ 'feed-them-settings-page',
885
+ esc_html( 'Twitter Options', 'feed-them-social' ),
886
+ esc_html( 'Twitter Options', 'feed-them-social' ),
887
+ 'manage_options',
888
+ 'fts-twitter-feed-styles-submenu-page',
889
+ array( $twitter_options_page, 'feed_them_twitter_options_page' )
890
+ );
891
+ // Pinterest Options Page!
892
+ $pinterest_options_page = new FTS_Pinterest_Options_Page();
893
+ add_submenu_page(
894
+ 'feed-them-settings-page',
895
+ esc_html( 'Pinterest Options', 'feed-them-social' ),
896
+ esc_html( 'Pinterest Options', 'feed-them-social' ),
897
+ 'manage_options',
898
+ 'fts-pinterest-feed-styles-submenu-page',
899
+ array( $pinterest_options_page, 'feed_them_pinterest_options_page' )
900
+ );
901
+ // Youtube Options Page!
902
+ $youtube_options_page = new FTS_Youtube_Options_Page();
903
+ add_submenu_page(
904
+ 'feed-them-settings-page',
905
+ esc_html( 'YouTube Options', 'feed-them-social' ),
906
+ esc_html( 'YouTube Options', 'feed-them-social' ),
907
+ 'manage_options',
908
+ 'fts-youtube-feed-styles-submenu-page',
909
+ array( $youtube_options_page, 'feed_them_youtube_options_page' )
910
+ );
911
+ // System Info!
912
+ $system_info_page = new FTS_System_Info_Page();
913
+ add_submenu_page(
914
+ 'feed-them-settings-page',
915
+ esc_html( 'System Info', 'feed-them-social' ),
916
+ esc_html( 'System Info', 'feed-them-social' ),
917
+ 'manage_options',
918
+ 'fts-system-info-submenu-page',
919
+ array( $system_info_page, 'feed_them_system_info_page' )
920
+ );
921
+ }
922
+
923
+ /**
924
+ * Feed Them Admin CSS
925
+ *
926
+ * Admin CSS.
927
+ *
928
+ * @since 1.9.6
929
+ */
930
+ public function feed_them_admin_css() {
931
+ wp_register_style( 'feed_them_admin', plugins_url( 'admin/css/admin.css', dirname( __FILE__ ) ), array(), FTS_CURRENT_VERSION );
932
+ wp_enqueue_style( 'feed_them_admin' );
933
+ }
934
+
935
+ /**
936
+ * Feed Them System Info CSS
937
+ *
938
+ * Admin System Info CSS.
939
+ *
940
+ * @since 1.9.6
941
+ */
942
+ public function feed_them_system_info_css() {
943
+ wp_register_style( 'fts-settings-admin-css', plugins_url( 'admin/css/admin-settings.css', dirname( __FILE__ ) ), array(), FTS_CURRENT_VERSION );
944
+ wp_enqueue_style( 'fts-settings-admin-css' );
945
+ }
946
+
947
+ /**
948
+ * Feed Them Settings
949
+ *
950
+ * Admin Settings Scripts and CSS.
951
+ *
952
+ * @since 1.9.6
953
+ */
954
+ public function feed_them_settings() {
955
+ $fts_functions_load_settings_nonce = wp_create_nonce( 'fts-functions-load-settings-nonce' );
956
+
957
+ if ( wp_verify_nonce( $fts_functions_load_settings_nonce, 'fts-functions-load-settings-nonce' ) ) {
958
+ wp_register_style( 'feed_them_settings_css', plugins_url( 'admin/css/settings-page.css', dirname( __FILE__ ) ), array(), FTS_CURRENT_VERSION, false );
959
+ wp_enqueue_style( 'feed_them_settings_css' );
960
+ if ( isset( $_GET['page'] ) && 'fts-youtube-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-instagram-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-facebook-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-twitter-feed-styles-submenu-page' === $_GET['page'] || isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] || isset( $_GET['page'] ) && 'fts-pinterest-feed-styles-submenu-page' === $_GET['page'] ) {
961
+ wp_enqueue_script( 'feed_them_style_options_color_js', plugins_url( 'admin/js/jscolor/jscolor.js', dirname( __FILE__ ) ), array(), FTS_CURRENT_VERSION, false );
962
+ }
963
+ }
964
+ }
965
+
966
+ /**
967
+ * Need FTS Premium Fields
968
+ *
969
+ * Admin Premium Settings Fields.
970
+ *
971
+ * @param array $fields settings fields to display premium notice for.
972
+ * @since 1.9.6
973
+ */
974
+ public function need_fts_premium_fields( $fields ) {
975
+ foreach ( $fields as $key => $label ) {
976
+ $output = '<div class="feed-them-social-admin-input-wrap">';
977
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( $label ) . '</div>';
978
+ $output .= '<div class="feed-them-social-admin-input-default">';
979
+ $output .= sprintf(
980
+ esc_html( 'Must have %1$sPremium Extension%3$s to edit.', 'feed-them-social' ),
981
+ '<a href="' . esc_url( 'https://www.slickremix.com/downloads/feed-them-social-premium-extension/' ) . '" target="_blank">',
982
+ '</a>'
983
+ );
984
+ $output .= '</div>';
985
+ $output .= '<div class="fts-clear"></div>';
986
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
987
+ }//END Foreach
988
+
989
+ return $output;
990
+ }
991
+
992
+
993
+ /**
994
+ * Register Settings
995
+ *
996
+ * Generic Register Settings function.
997
+ *
998
+ * @param string $settings_name settings name.
999
+ * @param array $settings settings parameters.
1000
+ * @since
1001
+ */
1002
+ public function register_settings( $settings_name, $settings ) {
1003
+ foreach ( $settings as $key => $setting ) {
1004
+ register_setting( $settings_name, $setting );
1005
+ }
1006
+ }
1007
+
1008
+ /**
1009
+ * FTS Facebook Style Options Page
1010
+ *
1011
+ * Register Facebook Style Options.
1012
+ *
1013
+ * @since 1.9.6
1014
+ */
1015
+ public function fts_facebook_style_options_page() {
1016
+ $fb_style_options = array(
1017
+ 'fb_like_btn_color',
1018
+ 'fb_language',
1019
+ 'fb_show_follow_btn',
1020
+ 'fb_show_follow_like_box_cover',
1021
+ 'fb_show_follow_btn_where',
1022
+ 'fb_header_extra_text_color',
1023
+ 'fb_text_color',
1024
+ 'fb_link_color',
1025
+ 'fb_link_color_hover',
1026
+ 'fb_feed_width',
1027
+ 'fb_feed_margin',
1028
+ 'fb_feed_padding',
1029
+ 'fb_feed_background_color',
1030
+ 'fb_post_background_color',
1031
+ 'fb_grid_border_bottom_color',
1032
+ 'fb_grid_posts_background_color',
1033
+ 'fb_border_bottom_color',
1034
+ 'fts_facebook_custom_api_token',
1035
+ 'fb_event_title_color',
1036
+ 'fb_event_title_size',
1037
+ 'fb_event_maplink_color',
1038
+ 'fb_events_title_color',
1039
+ 'fb_events_title_size',
1040
+ 'fb_events_map_link_color',
1041
+ 'fb_hide_shared_by_etc_text',
1042
+ 'fts_facebook_custom_api_token_biz',
1043
+ 'fb_reviews_text_color',
1044
+ 'fb_reviews_backg_color',
1045
+ 'fb_reviews_star_language',
1046
+ 'fb_reviews_recommended_language',
1047
+ 'fb_reviews_see_more_reviews_language',
1048
+ 'fb_reviews_see_more_reviews_language',
1049
+ 'fb_reviews_overall_rating_background_border_hide',
1050
+ 'fb_reviews_overall_rating_background_color',
1051
+ 'fb_reviews_overall_rating_border_color',
1052
+ 'fb_reviews_overall_rating_text_color',
1053
+ 'fb_reviews_overall_rating_background_padding',
1054
+ 'fb_reviews_remove_see_reviews_link',
1055
+ 'fb_reviews_overall_rating_of_5_stars_text',
1056
+ 'fb_reviews_overall_rating_reviews_text',
1057
+ 'fb_max_image_width',
1058
+ 'fb_hide_images_in_posts',
1059
+ 'fb_hide_error_handler_message',
1060
+ 'fb_count_offset',
1061
+ 'fb_hide_no_posts_message',
1062
+ 'fts_facebook_custom_api_token_user_id',
1063
+ 'fts_facebook_custom_api_token_user_name',
1064
+ 'fts_facebook_custom_api_token_user_id_biz',
1065
+ 'fts_facebook_custom_api_token_user_name_biz',
1066
+ 'fb_loadmore_background_color',
1067
+ 'fb_loadmore_text_color',
1068
+ 'fb_load_more_text',
1069
+ 'fb_no_more_posts_text',
1070
+ 'fb_no_more_photos_text',
1071
+ 'fb_no_more_videos_text',
1072
+ 'fb_no_more_reviews_text',
1073
+ 'fb_text_size',
1074
+ 'fb_view_on_fb_fts',
1075
+ );
1076
+ $this->register_settings( 'fts-facebook-feed-style-options', $fb_style_options );
1077
+ }
1078
+
1079
+ /**
1080
+ * FTS Twitter Style Options Page
1081
+ *
1082
+ * Register Twitter Style Options.
1083
+ *
1084
+ * @since 1.9.6
1085
+ */
1086
+ public function fts_twitter_style_options_page() {
1087
+ $twitter_style_options = array(
1088
+ 'twitter_show_follow_btn',
1089
+ 'twitter_show_follow_count',
1090
+ 'twitter_show_follow_btn_where',
1091
+ 'twitter_allow_videos',
1092
+ 'twitter_allow_shortlink_conversion',
1093
+ 'twitter_full_width',
1094
+ 'twitter_text_color',
1095
+ 'twitter_link_color',
1096
+ 'twitter_link_color_hover',
1097
+ 'twitter_feed_width',
1098
+ 'twitter_feed_margin',
1099
+ 'twitter_feed_padding',
1100
+ 'twitter_feed_background_color',
1101
+ 'twitter_border_bottom_color',
1102
+ 'twitter_grid_posts_background_color',
1103
+ 'twitter_grid_border_bottom_color',
1104
+ 'fts_twitter_custom_consumer_key',
1105
+ 'fts_twitter_custom_consumer_secret',
1106
+ 'fts_twitter_custom_access_token',
1107
+ 'fts_twitter_custom_access_token_secret',
1108
+ 'fts_twitter_hide_images_in_posts',
1109
+ 'twitter_max_image_width',
1110
+ 'twitter_loadmore_background_color',
1111
+ 'twitter_loadmore_text_color',
1112
+ 'twitter_load_more_text',
1113
+ 'twitter_no_more_tweets_text',
1114
+ 'twitter_text_size',
1115
+ 'twitter_load_more_text',
1116
+ 'fts_twitter_custom_tokens',
1117
+ );
1118
+ $this->register_settings( 'fts-twitter-feed-style-options', $twitter_style_options );
1119
+ }
1120
+
1121
+ /**
1122
+ * FTS Instagram Style Options Page
1123
+ *
1124
+ * Register Instagram Options.
1125
+ *
1126
+ * @since 1.9.6
1127
+ */
1128
+ public function fts_instagram_style_options_page() {
1129
+ $instagram_style_options = array(
1130
+ 'fts_instagram_custom_api_token',
1131
+ 'fts_instagram_custom_id',
1132
+ 'instagram_show_follow_btn',
1133
+ 'instagram_show_follow_btn_where',
1134
+ 'instagram_loadmore_background_color',
1135
+ 'instagram_loadmore_text_color',
1136
+ 'instagram_load_more_text',
1137
+ 'instagram_no_more_photos_text',
1138
+ );
1139
+ $this->register_settings( 'fts-instagram-feed-style-options', $instagram_style_options );
1140
+ }
1141
+
1142
+ /**
1143
+ * FTS Pinterest Style Options Page
1144
+ *
1145
+ * Register Pinterest Options.
1146
+ *
1147
+ * @since 1.9.6
1148
+ */
1149
+ public function fts_pinterest_style_options_page() {
1150
+ $pinterest_style_options = array(
1151
+ 'fts_pinterest_custom_api_token',
1152
+ 'pinterest_show_follow_btn',
1153
+ 'pinterest_show_follow_btn_where',
1154
+ 'pinterest_board_title_color',
1155
+ 'pinterest_board_title_size',
1156
+ 'pinterest_board_backg_hover_color',
1157
+ );
1158
+ $this->register_settings( 'fts-pinterest-feed-style-options', $pinterest_style_options );
1159
+ }
1160
+
1161
+ /**
1162
+ * FTS Youtube Style Options Page
1163
+ *
1164
+ * Register YouTube Options.
1165
+ *
1166
+ * @since 1.9.6
1167
+ */
1168
+ public function fts_youtube_style_options_page() {
1169
+ $youtube_style_options = array(
1170
+ 'youtube_show_follow_btn',
1171
+ 'youtube_show_follow_btn_where',
1172
+ 'youtube_custom_api_token',
1173
+ 'youtube_loadmore_background_color',
1174
+ 'youtube_loadmore_text_color',
1175
+ 'youtube_load_more_text',
1176
+ 'youtube_no_more_videos_text',
1177
+ 'youtube_custom_refresh_token',
1178
+ 'youtube_custom_access_token',
1179
+ 'youtube_custom_token_exp_time',
1180
+ );
1181
+ $this->register_settings( 'fts-youtube-feed-style-options', $youtube_style_options );
1182
+ }
1183
+
1184
+ /**
1185
+ * FTS Settings Page Register Settings
1186
+ *
1187
+ * Register Free Version Settings.
1188
+ *
1189
+ * @since 1.9.6
1190
+ */
1191
+ public function fts_settings_page_register_settings() {
1192
+ $settings = array(
1193
+ 'fts_admin_bar_menu',
1194
+ 'fts_clear_cache_developer_mode',
1195
+ 'fts-date-and-time-format',
1196
+ 'fts-timezone',
1197
+ 'fts_fix_magnific',
1198
+ 'fts-color-options-settings-custom-css',
1199
+ 'fts-color-options-main-wrapper-css-input',
1200
+ 'fts-powered-text-options-settings',
1201
+ 'fts-slicker-instagram-icon-center',
1202
+ 'fts-slicker-instagram-container-image-size',
1203
+ 'fts-slicker-instagram-container-hide-date-likes-comments',
1204
+ 'fts-slicker-instagram-container-position',
1205
+ 'fts-slicker-instagram-container-animation',
1206
+ 'fts-slicker-instagram-container-margin',
1207
+ 'fts_fix_loadmore',
1208
+ 'fts_curl_option',
1209
+ 'fts-custom-date',
1210
+ 'fts-custom-time',
1211
+ 'fts_twitter_time_offset',
1212
+ 'fts_language_second',
1213
+ 'fts_language_seconds',
1214
+ 'fts_language_minute',
1215
+ 'fts_language_minutes',
1216
+ 'fts_language_hour',
1217
+ 'fts_language_hours',
1218
+ 'fts_language_day',
1219
+ 'fts_language_days',
1220
+ 'fts_language_week',
1221
+ 'fts_language_weeks',
1222
+ 'fts_language_month',
1223
+ 'fts_language_months',
1224
+ 'fts_language_year',
1225
+ 'fts_language_years',
1226
+ 'fts_language_ago',
1227
+ 'fts_disable_share_button',
1228
+ 'fts_social_icons_color',
1229
+ 'fts_social_icons_hover_color',
1230
+ 'fts_social_icons_back_color',
1231
+ 'fts_slick_rating_notice_waiting',
1232
+ 'fts_slick_rating_notice',
1233
+ 'fts_slick_ignore_rating_notice_nag',
1234
+ );
1235
+ $this->register_settings( 'feed-them-social-settings', $settings );
1236
+ }
1237
+
1238
+ /**
1239
+ * Social Follow Buttons
1240
+ *
1241
+ * @param string $feed feed type.
1242
+ * @param string $user_id user id.
1243
+ * @param null $access_token access token.
1244
+ * @param null $fb_shortcode shortcode attribute.
1245
+ * @since 1.9.6
1246
+ */
1247
+ public function social_follow_button( $feed, $user_id, $access_token = null, $fb_shortcode = null ) {
1248
+ $fts_social_follow_nonce = wp_create_nonce( 'fts-social-follow-nonce' );
1249
+
1250
+ if ( wp_verify_nonce( $fts_social_follow_nonce, 'fts-social-follow-nonce' ) ) {
1251
+
1252
+ global $channel_id, $playlist_id, $username_subscribe_btn, $username;
1253
+ switch ( $feed ) {
1254
+ case 'facebook':
1255
+ // Facebook settings options for follow button!
1256
+ $fb_show_follow_btn = get_option( 'fb_show_follow_btn' );
1257
+ $fb_show_follow_like_box_cover = get_option( 'fb_show_follow_like_box_cover' );
1258
+ $language_option_check = get_option( 'fb_language' );
1259
+
1260
+ if ( isset( $language_option_check ) && 'Please Select Option' !== $language_option_check ) {
1261
+ $language_option = get_option( 'fb_language', 'en_US' );
1262
+ } else {
1263
+ $language_option = 'en_US';
1264
+ }
1265
+ $fb_like_btn_color = get_option( 'fb_like_btn_color', 'light' );
1266
+ $show_faces = 'like-button-share-faces' === $fb_show_follow_btn || 'like-button-faces' === $fb_show_follow_btn || 'like-box-faces' === $fb_show_follow_btn ? 'true' : 'false';
1267
+ $share_button = 'like-button-share-faces' === $fb_show_follow_btn || 'like-button-share' === $fb_show_follow_btn ? 'true' : 'false';
1268
+ $page_cover = 'fb_like_box_cover-yes' === $fb_show_follow_like_box_cover ? 'true' : 'false';
1269
+ if ( ! isset( $_POST['fts_facebook_script_loaded'] ) ) {
1270
+ echo '<div id="fb-root"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1271
  <script>jQuery(".fb-page").hide(); (function(d, s, id) {
1272
  var js, fjs = d.getElementsByTagName(s)[0];
1273
  if (d.getElementById(id)) return;
1275
  js.src = "//connect.facebook.net/' . esc_html( $language_option ) . '/sdk.js#xfbml=1&appId=&version=v3.1";
1276
  fjs.parentNode.insertBefore(js, fjs);
1277
  }(document, "script", "facebook-jssd"));</script>';
1278
+ $_POST['fts_facebook_script_loaded'] = 'yes';
1279
+ }
1280
+
1281
+ // Page Box!
1282
+ if ( 'like-box' === $fb_show_follow_btn || 'like-box-faces' === $fb_show_follow_btn ) {
1283
+
1284
+ $like_box_width = isset( $fb_shortcode['like_box_width'] ) && '' !== $fb_shortcode['like_box_width'] ? $fb_shortcode['like_box_width'] : '500px';
1285
+
1286
+ echo '<div class="fb-page" data-href="' . esc_url( 'https://www.facebook.com/' . $user_id ) . '" data-hide-cover="' . esc_html( $page_cover ) . '" data-width="' . esc_html( $like_box_width ) . '" data-show-facepile="' . esc_html( $show_faces ) . '" data-show-posts="false"></div>';
1287
+ } else {
1288
+ echo '<div class="fb-like" data-href="' . esc_url( 'https://www.facebook.com/' . $user_id ) . '" data-layout="standard" data-action="like" data-colorscheme="' . esc_html( $fb_like_btn_color ) . '" data-show-faces="' . esc_html( $show_faces ) . '" data-share="' . esc_html( $share_button ) . '" data-width:"100%"></div>';
1289
+ }
1290
+ break;
1291
+ case 'instagram':
1292
+ echo '<a href="' . esc_url( 'https://instagram.com/' . $user_id . '/' ) . '" target="_blank">' . esc_html( 'Follow on Instagram', 'feed-them-social' ) . '</a>';
1293
+ break;
1294
+ case 'twitter':
1295
+ if ( ! isset( $_POST['fts_twitter_script_loaded'] ) ) {
1296
+ echo "<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>";
1297
+ $_POST['fts_twitter_script_loaded'] = 'yes';
1298
+ }
1299
+ // CAN't ESCAPE Twitter link because then JS doesn't work!
1300
+ echo '<a class="twitter-follow-button" href="' . ' https://twitter.com/' . $user_id . ' " data-show-count="false" data-lang="en"> Follow @' . esc_html( $user_id ) . '</a>';
1301
+ break;
1302
+ case 'pinterest':
1303
+ if ( ! isset( $_POST['fts_pinterest_script_loaded'] ) ) {
1304
+ echo '<script>jQuery(function () {jQuery.getScript("//assets.pinterest.com/js/pinit.js");});</script>';
1305
+ $_POST['fts_pinterest_script_loaded'] = 'yes';
1306
+ }
1307
+ // we return this one until we echo out the pinterest feed instead of $output.=.
1308
+ return '<a data-pin-do="buttonFollow" href="https://www.pinterest.com/' . esc_html( $user_id ) . '/">' . esc_html( $user_id ) . '</a>';
1309
+ break;
1310
+ case 'youtube':
1311
+ if ( ! isset( $_POST['fts_youtube_script_loaded'] ) ) {
1312
+ echo '<script src="' . esc_url( 'https://apis.google.com/js/platform.js' ) . '"></script>';
1313
+ $_POST['fts_youtube_script_loaded'] = 'yes';
1314
+ }
1315
+ if ( '' === $channel_id && '' === $playlist_id && '' !== $username || '' !== $playlist_id && '' !== $username_subscribe_btn ) {
1316
+
1317
+ if ( '' !== $username_subscribe_btn ) {
1318
+ echo '<div class="g-ytsubscribe" data-channel="' . esc_html( $username_subscribe_btn ) . '" data-layout="full" data-count="default"></div>';
1319
+ } else {
1320
+ echo '<div class="g-ytsubscribe" data-channel="' . esc_html( $user_id ) . '" data-layout="full" data-count="default"></div>';
1321
+ }
1322
+ } elseif ( '' !== $channel_id && '' !== $playlist_id || '' !== $channel_id ) {
1323
+ echo '<div class="g-ytsubscribe" data-channelid="' . esc_html( $channel_id ) . '" data-layout="full" data-count="default"></div>';
1324
+ }
1325
+ break;
1326
+ }
1327
+ }
1328
+ }
1329
+
1330
+ /**
1331
+ * FTS Color Options Head CSS
1332
+ *
1333
+ * @since 1.9.6
1334
+ */
1335
+ public function fts_color_options_head_css() {
1336
+ ?>
1337
+ <style type="text/css"><?php echo get_option( 'fts-color-options-main-wrapper-css-input' ); ?></style>
1338
+ <?php
1339
+ }
1340
+
1341
+ /**
1342
+ * FTS FB Color Options Head CSS
1343
+ *
1344
+ * Color Options CSS for Facebook.
1345
+ *
1346
+ * @since 1.9.6
1347
+ */
1348
+ public function fts_fb_color_options_head_css() {
1349
+ $fb_hide_no_posts_message = get_option( 'fb_hide_no_posts_message' );
1350
+ $fb_header_extra_text_color = get_option( 'fb_header_extra_text_color' );
1351
+ $fb_text_color = get_option( 'fb_text_color' );
1352
+ $fb_link_color = get_option( 'fb_link_color' );
1353
+ $fb_link_color_hover = get_option( 'fb_link_color_hover' );
1354
+ $fb_feed_width = get_option( 'fb_feed_width' );
1355
+ $fb_feed_margin = get_option( 'fb_feed_margin' );
1356
+ $fb_feed_padding = get_option( 'fb_feed_padding' );
1357
+ $fb_feed_background_color = get_option( 'fb_feed_background_color' );
1358
+ $fb_post_background_color = get_option( 'fb_post_background_color' );
1359
+ $fb_grid_posts_background_color = get_option( 'fb_grid_posts_background_color' );
1360
+ $fb_grid_border_bottom_color = get_option( 'fb_grid_border_bottom_color' );
1361
+ $fb_loadmore_background_color = get_option( 'fb_loadmore_background_color' );
1362
+ $fb_loadmore_text_color = get_option( 'fb_loadmore_text_color' );
1363
+ $fb_border_bottom_color = get_option( 'fb_border_bottom_color' );
1364
+ $fb_grid_posts_background_color = get_option( 'fb_grid_posts_background_color' );
1365
+ $fb_reviews_backg_color = get_option( 'fb_reviews_backg_color' );
1366
+ $fb_reviews_text_color = get_option( 'fb_reviews_text_color' );
1367
+
1368
+ $fb_reviews_overall_rating_background_color = get_option( 'fb_reviews_overall_rating_background_color' );
1369
+ $fb_reviews_overall_rating_border_color = get_option( 'fb_reviews_overall_rating_border_color' );
1370
+ $fb_reviews_overall_rating_text_color = get_option( 'fb_reviews_overall_rating_text_color' );
1371
+ $fb_reviews_overall_rating_background_padding = get_option( 'fb_reviews_overall_rating_background_padding' );
1372
+
1373
+ $fb_max_image_width = get_option( 'fb_max_image_width' );
1374
+
1375
+ $fb_events_title_color = get_option( 'fb_events_title_color' );
1376
+ $fb_events_title_size = get_option( 'fb_events_title_size' );
1377
+ $fb_events_maplink_color = get_option( 'fb_events_map_link_color' );
1378
+
1379
+ $twitter_hide_profile_photo = get_option( 'twitter_hide_profile_photo' );
1380
+ $twitter_text_color = get_option( 'twitter_text_color' );
1381
+ $twitter_link_color = get_option( 'twitter_link_color' );
1382
+ $twitter_link_color_hover = get_option( 'twitter_link_color_hover' );
1383
+ $twitter_feed_width = get_option( 'twitter_feed_width' );
1384
+ $twitter_feed_margin = get_option( 'twitter_feed_margin' );
1385
+ $twitter_feed_padding = get_option( 'twitter_feed_padding' );
1386
+ $twitter_feed_background_color = get_option( 'twitter_feed_background_color' );
1387
+ $twitter_border_bottom_color = get_option( 'twitter_border_bottom_color' );
1388
+ $twitter_max_image_width = get_option( 'twitter_max_image_width' );
1389
+ $twitter_grid_border_bottom_color = get_option( 'twitter_grid_border_bottom_color' );
1390
+ $twitter_grid_posts_background_color = get_option( 'twitter_grid_posts_background_color' );
1391
+ $twitter_loadmore_background_color = get_option( 'twitter_loadmore_background_color' );
1392
+ $twitter_loadmore_text_color = get_option( 'twitter_loadmore_text_color' );
1393
+
1394
+ $instagram_loadmore_background_color = get_option( 'instagram_loadmore_background_color' );
1395
+ $instagram_loadmore_text_color = get_option( 'instagram_loadmore_text_color' );
1396
+
1397
+ $pinterest_board_title_color = get_option( 'pinterest_board_title_color' );
1398
+ $pinterest_board_title_size = get_option( 'pinterest_board_title_size' );
1399
+ $pinterest_board_backg_hover_color = get_option( 'pinterest_board_backg_hover_color' );
1400
+
1401
+ $fts_social_icons_color = get_option( 'fts_social_icons_color' );
1402
+ $fts_social_icons_hover_color = get_option( 'fts_social_icons_hover_color' );
1403
+ $fts_social_icons_back_color = get_option( 'fts_social_icons_back_color' );
1404
+
1405
+ $youtube_loadmore_background_color = get_option( 'youtube_loadmore_background_color' );
1406
+ $youtube_loadmore_text_color = get_option( 'youtube_loadmore_text_color' );
1407
+
1408
+ $fb_text_size = get_option( 'fb_text_size' );
1409
+ $twitter_text_size = get_option( 'twitter_text_size' );
1410
+ ?>
1411
+ <style type="text/css"><?php if ( ! empty( $fb_header_extra_text_color ) ) { ?>
1412
+
1413
+ <?php }if ( ! empty( $fb_hide_no_posts_message ) && 'yes' === $fb_hide_no_posts_message ) { ?>
1414
+ .fts-facebook-add-more-posts-notice {
1415
+ display: none !important;
1416
+ }
1417
+
1418
+ .fts-jal-single-fb-post .fts-jal-fb-user-name {
1419
+ color: <?php echo esc_html( $fb_header_extra_text_color ); ?> !important;
1420
+ }
1421
+
1422
+ <?php }if ( ! empty( $fb_loadmore_background_color ) ) { ?>
1423
+ .fts-fb-load-more-wrapper .fts-fb-load-more {
1424
+ background: <?php echo esc_html( $fb_loadmore_background_color ); ?> !important;
1425
+ }
1426
+
1427
+ <?php }if ( ! empty( $fb_loadmore_text_color ) ) { ?>
1428
+ .fts-fb-load-more-wrapper .fts-fb-load-more {
1429
+ color: <?php echo esc_html( $fb_loadmore_text_color ); ?> !important;
1430
+ }
1431
+
1432
+ <?php }if ( ! empty( $fb_loadmore_text_color ) ) { ?>
1433
+ .fts-fb-load-more-wrapper .fts-fb-spinner > div {
1434
+ background: <?php echo esc_html( $fb_loadmore_text_color ); ?> !important;
1435
+ }
1436
+
1437
+ <?php }if ( ! empty( $fb_text_color ) ) { ?>
1438
+ .fts-simple-fb-wrapper .fts-jal-single-fb-post,
1439
+ .fts-simple-fb-wrapper .fts-jal-fb-description-wrap,
1440
+ .fts-simple-fb-wrapper .fts-jal-fb-post-time,
1441
+ .fts-slicker-facebook-posts .fts-jal-single-fb-post,
1442
+ .fts-slicker-facebook-posts .fts-jal-fb-description-wrap,
1443
+ .fts-slicker-facebook-posts .fts-jal-fb-post-time {
1444
+ color: <?php echo esc_html( $fb_text_color ); ?> !important;
1445
+ }
1446
+
1447
+ <?php }if ( ! empty( $fb_link_color ) ) { ?>
1448
+ .fts-simple-fb-wrapper .fts-jal-single-fb-post .fts-review-name,
1449
+ .fts-simple-fb-wrapper .fts-jal-single-fb-post a,
1450
+ .fts-slicker-facebook-posts .fts-jal-single-fb-post a,
1451
+ .fts-jal-fb-group-header-desc a {
1452
+ color: <?php echo esc_html( $fb_link_color ); ?> !important;
1453
+ }
1454
+
1455
+ <?php }if ( ! empty( $fb_link_color_hover ) ) { ?>
1456
+ .fts-simple-fb-wrapper .fts-jal-single-fb-post a:hover,
1457
+ .fts-simple-fb-wrapper .fts-fb-load-more:hover,
1458
+ .fts-slicker-facebook-posts .fts-jal-single-fb-post a:hover,
1459
+ .fts-slicker-facebook-posts .fts-fb-load-more:hover,
1460
+ .fts-jal-fb-group-header-desc a:hover {
1461
+ color: <?php echo esc_html( $fb_link_color_hover ); ?> !important;
1462
+ }
1463
+
1464
+ <?php }if ( ! empty( $fb_feed_width ) ) { ?>
1465
+ .fts-simple-fb-wrapper, .fts-fb-header-wrapper, .fts-fb-load-more-wrapper, .fts-jal-fb-header, .fb-social-btn-top, .fb-social-btn-bottom, .fb-social-btn-below-description {
1466
+ max-width: <?php echo esc_html( $fb_feed_width ); ?> !important;
1467
+ }
1468
+
1469
+ <?php }if ( ! empty( $fb_max_image_width ) ) { ?>
1470
+ .fts-fb-large-photo, .fts-jal-fb-vid-picture, .fts-jal-fb-picture, .fts-fluid-videoWrapper-html5 {
1471
+ max-width: <?php echo esc_html( $fb_max_image_width ); ?> !important;
1472
+ float: left;
1473
+ }
1474
+
1475
+ <?php }if ( ! empty( $fb_events_title_color ) ) { ?>
1476
+ .fts-simple-fb-wrapper .fts-events-list-wrap a.fts-jal-fb-name {
1477
+ color: <?php echo esc_html( $fb_events_title_color ); ?> !important;
1478
+ }
1479
+
1480
+ <?php }if ( ! empty( $fb_events_title_size ) ) { ?>
1481
+ .fts-simple-fb-wrapper .fts-events-list-wrap a.fts-jal-fb-name {
1482
+ font-size: <?php echo esc_html( $fb_events_title_size ); ?> !important;
1483
+ line-height: <?php echo esc_html( $fb_events_title_size ); ?> !important;
1484
+ }
1485
+
1486
+ <?php }if ( ! empty( $fb_events_maplink_color ) ) { ?>
1487
+ .fts-simple-fb-wrapper a.fts-fb-get-directions {
1488
+ color: <?php echo esc_html( $fb_events_maplink_color ); ?> !important;
1489
+ }
1490
+
1491
+ <?php }if ( ! empty( $fb_feed_margin ) ) { ?>
1492
+ .fts-simple-fb-wrapper, .fts-fb-header-wrapper, .fts-fb-load-more-wrapper, .fts-jal-fb-header, .fb-social-btn-top, .fb-social-btn-bottom, .fb-social-btn-below-description {
1493
+ margin: <?php echo esc_html( $fb_feed_margin ); ?> !important;
1494
+ }
1495
+
1496
+ <?php }if ( ! empty( $fb_feed_padding ) ) { ?>
1497
+ .fts-simple-fb-wrapper {
1498
+ padding: <?php echo esc_html( $fb_feed_padding ); ?> !important;
1499
+ }
1500
+
1501
+ <?php }if ( ! empty( $fb_feed_background_color ) ) { ?>
1502
+ .fts-simple-fb-wrapper, .fts-fb-load-more-wrapper .fts-fb-load-more {
1503
+ background: <?php echo esc_html( $fb_feed_background_color ); ?> !important;
1504
+ }
1505
+
1506
+ <?php }if ( ! empty( $fb_post_background_color ) ) { ?>
1507
+ .fts-mashup-media-top .fts-jal-single-fb-post {
1508
+ background: <?php echo esc_html( $fb_post_background_color ); ?> !important;
1509
+ }
1510
+
1511
+ <?php }if ( ! empty( $fb_grid_posts_background_color ) ) { ?>
1512
+ .fts-slicker-facebook-posts .fts-jal-single-fb-post {
1513
+ background: <?php echo esc_html( $fb_grid_posts_background_color ); ?> !important;
1514
+ }
1515
+
1516
+ <?php }if ( ! empty( $fb_border_bottom_color ) ) { ?>
1517
+ .fts-jal-single-fb-post {
1518
+ border-bottom-color: <?php echo esc_html( $fb_border_bottom_color ); ?> !important;
1519
+ }
1520
+
1521
+ <?php }if ( ! empty( $fb_grid_border_bottom_color ) ) { ?>
1522
+ .fts-slicker-facebook-posts .fts-jal-single-fb-post {
1523
+ border-bottom-color: <?php echo esc_html( $fb_grid_border_bottom_color ); ?> !important;
1524
+ }
1525
+
1526
+ <?php }if ( ! empty( $twitter_grid_posts_background_color ) ) { ?>
1527
+ .fts-slicker-twitter-posts .fts-tweeter-wrap {
1528
+ background: <?php echo esc_html( $twitter_grid_posts_background_color ); ?> !important;
1529
+ }
1530
+
1531
+ <?php }if ( ! empty( $twitter_grid_border_bottom_color ) ) { ?>
1532
+ .fts-slicker-twitter-posts .fts-tweeter-wrap {
1533
+ border-bottom-color: <?php echo esc_html( $twitter_grid_border_bottom_color ); ?> !important;
1534
+ }
1535
+
1536
+ <?php }if ( ! empty( $twitter_loadmore_background_color ) ) { ?>
1537
+ .fts-twitter-load-more-wrapper .fts-fb-load-more {
1538
+ background: <?php echo esc_html( $twitter_loadmore_background_color ); ?> !important;
1539
+ }
1540
+
1541
+ <?php }if ( ! empty( $twitter_loadmore_text_color ) ) { ?>
1542
+ .fts-twitter-load-more-wrapper .fts-fb-load-more {
1543
+ color: <?php echo esc_html( $twitter_loadmore_text_color ); ?> !important;
1544
+ }
1545
+
1546
+ <?php }if ( ! empty( $twitter_loadmore_text_color ) ) { ?>
1547
+ .fts-twitter-load-more-wrapper .fts-fb-spinner > div {
1548
+ background: <?php echo esc_html( $twitter_loadmore_text_color ); ?> !important;
1549
+ }
1550
+
1551
+ <?php }if ( ! empty( $fb_reviews_backg_color ) ) { ?>
1552
+ .fts-review-star {
1553
+ background: <?php echo esc_html( $fb_reviews_backg_color ); ?> !important;
1554
+ }
1555
+
1556
+ <?php }if ( ! empty( $fb_reviews_overall_rating_background_color ) ) { ?>
1557
+ .fts-review-details-master-wrap {
1558
+ background: <?php echo esc_html( $fb_reviews_overall_rating_background_color ); ?> !important;
1559
+ }
1560
+
1561
+ <?php }if ( ! empty( $fb_reviews_overall_rating_border_color ) ) { ?>
1562
+ .fts-review-details-master-wrap {
1563
+ border-bottom-color: <?php echo esc_html( $fb_reviews_overall_rating_border_color ); ?> !important;
1564
+ }
1565
+
1566
+ <?php }if ( ! empty( $fb_reviews_overall_rating_background_padding ) ) { ?>
1567
+ .fts-review-details-master-wrap {
1568
+ padding: <?php echo esc_html( $fb_reviews_overall_rating_background_padding ); ?> !important;
1569
+ }
1570
+
1571
+ <?php }if ( ! empty( $fb_reviews_overall_rating_text_color ) ) { ?>
1572
+ .fts-review-details-master-wrap {
1573
+ color: <?php echo esc_html( $fb_reviews_overall_rating_text_color ); ?> !important;
1574
+ }
1575
+
1576
+ <?php }if ( ! empty( $fb_reviews_text_color ) ) { ?>
1577
+ .fts-review-star {
1578
+ color: <?php echo esc_html( $fb_reviews_text_color ); ?> !important;
1579
+ }
1580
+
1581
+ <?php }if ( ! empty( $twitter_text_color ) ) { ?>
1582
+ .tweeter-info .fts-twitter-text, .fts-twitter-reply-wrap:before, a span.fts-video-loading-notice {
1583
+ color: <?php echo esc_html( $twitter_text_color ); ?> !important;
1584
+ }
1585
+
1586
+ <?php }if ( ! empty( $twitter_link_color ) ) { ?>
1587
+ .tweeter-info .fts-twitter-text a, .tweeter-info .fts-twitter-text .time a, .fts-twitter-reply-wrap a, .tweeter-info a, .twitter-followers-fts a, body.fts-twitter-reply-wrap a {
1588
+ color: <?php echo esc_html( $twitter_link_color ); ?> !important;
1589
+ }
1590
+
1591
+ <?php }if ( ! empty( $twitter_link_color_hover ) ) { ?>
1592
+ .tweeter-info a:hover, .tweeter-info:hover .fts-twitter-reply, body.fts-twitter-reply-wrap a:hover {
1593
+ color: <?php echo esc_html( $twitter_link_color_hover ); ?> !important;
1594
+ }
1595
+
1596
+ <?php }if ( ! empty( $twitter_feed_width ) ) { ?>
1597
+ .fts-twitter-div {
1598
+ max-width: <?php echo esc_html( $twitter_feed_width ); ?> !important;
1599
+ }
1600
+
1601
+ <?php }if ( ! empty( $twitter_feed_margin ) ) { ?>
1602
+ .fts-twitter-div {
1603
+ margin: <?php echo esc_html( $twitter_feed_margin ); ?> !important;
1604
+ }
1605
+
1606
+ <?php }if ( ! empty( $twitter_feed_padding ) ) { ?>
1607
+ .fts-twitter-div {
1608
+ padding: <?php echo esc_html( $twitter_feed_padding ); ?> !important;
1609
+ }
1610
+
1611
+ <?php }if ( ! empty( $twitter_feed_background_color ) ) { ?>
1612
+ .fts-twitter-div {
1613
+ background: <?php echo esc_html( $twitter_feed_background_color ); ?> !important;
1614
+ }
1615
+
1616
+ <?php }if ( ! empty( $twitter_border_bottom_color ) ) { ?>
1617
+ .tweeter-info {
1618
+ border-bottom: 1px solid <?php echo esc_html( $twitter_border_bottom_color ); ?> !important;
1619
+ }
1620
+
1621
+ <?php }if ( ! empty( $twitter_max_image_width ) ) { ?>
1622
+ .fts-twitter-link-image {
1623
+ max-width: <?php echo esc_html( $twitter_max_image_width ); ?> !important;
1624
+ display: block;
1625
+ }
1626
+
1627
+ <?php }if ( ! empty( $instagram_loadmore_background_color ) ) { ?>
1628
+ .fts-instagram-load-more-wrapper .fts-fb-load-more {
1629
+ background: <?php echo esc_html( $instagram_loadmore_background_color ); ?> !important;
1630
+ }
1631
+
1632
+ <?php }if ( ! empty( $instagram_loadmore_text_color ) ) { ?>
1633
+ .fts-instagram-load-more-wrapper .fts-fb-load-more {
1634
+ color: <?php echo esc_html( $instagram_loadmore_text_color ); ?> !important;
1635
+ }
1636
+
1637
+ <?php }if ( ! empty( $instagram_loadmore_text_color ) ) { ?>
1638
+ .fts-instagram-load-more-wrapper .fts-fb-spinner > div {
1639
+ background: <?php echo esc_html( $instagram_loadmore_text_color ); ?> !important;
1640
+ }
1641
+
1642
+ <?php } if ( ! empty( $pinterest_board_backg_hover_color ) ) { ?>
1643
+ a.fts-pin-board-wrap:hover {
1644
+ background: <?php echo esc_html( $pinterest_board_backg_hover_color ); ?> !important;
1645
+ }
1646
+
1647
+ <?php } if ( ! empty( $pinterest_board_title_color ) ) { ?>
1648
+ body h3.fts-pin-board-board_title {
1649
+ color: <?php echo esc_html( $pinterest_board_title_color ); ?> !important;
1650
+ }
1651
+
1652
+ <?php } if ( ! empty( $pinterest_board_title_size ) ) { ?>
1653
+ body h3.fts-pin-board-board_title {
1654
+ font-size: <?php echo esc_html( $pinterest_board_title_size ); ?> !important;
1655
+ }
1656
+
1657
+ <?php
 
 
1658
  }
1659
  if ( ! empty( $fts_social_icons_color ) ) {
1660
  ?>
1661
+ .ft-gallery-share-wrap a.ft-galleryfacebook-icon, .ft-gallery-share-wrap a.ft-gallerytwitter-icon, .ft-gallery-share-wrap a.ft-gallerygoogle-icon, .ft-gallery-share-wrap a.ft-gallerylinkedin-icon, .ft-gallery-share-wrap a.ft-galleryemail-icon {
1662
+ color: <?php echo esc_html( $fts_social_icons_color ); ?> !important;
1663
+ }
1664
 
1665
+ <?php
1666
  }
1667
  if ( ! empty( $fts_social_icons_hover_color ) ) {
1668
  ?>
1669
+ .ft-gallery-share-wrap a.ft-galleryfacebook-icon:hover, .ft-gallery-share-wrap a.ft-gallerytwitter-icon:hover, .ft-gallery-share-wrap a.ft-gallerygoogle-icon:hover, .ft-gallery-share-wrap a.ft-gallerylinkedin-icon:hover, .ft-gallery-share-wrap a.ft-galleryemail-icon:hover {
1670
+ color: <?php echo esc_html( $fts_social_icons_hover_color ); ?> !important;
1671
+ }
1672
 
1673
+ <?php
1674
  }
1675
  if ( ! empty( $fts_social_icons_back_color ) ) {
1676
  ?>
1677
+ .ft-gallery-share-wrap {
1678
+ background: <?php echo esc_html( $fts_social_icons_back_color ); ?> !important;
1679
+ }
1680
 
1681
+ <?php
1682
  }
1683
  if ( ! empty( $twitter_text_size ) ) {
1684
  ?>
1685
+ span.fts-twitter-text {
1686
+ font-size: <?php echo esc_html( $twitter_text_size ); ?> !important;
1687
+ }
1688
 
1689
+ <?php
1690
  }
1691
  if ( ! empty( $fb_text_size ) ) {
1692
  ?>
1693
+ .fts-jal-fb-group-display .fts-jal-fb-message, .fts-jal-fb-group-display .fts-jal-fb-message p, .fts-jal-fb-group-header-desc, .fts-jal-fb-group-header-desc p, .fts-jal-fb-group-header-desc a {
1694
+ font-size: <?php echo esc_html( $fb_text_size ); ?> !important;
1695
+ }
1696
 
1697
+ <?php
1698
  }
1699
  if ( ! empty( $youtube_loadmore_background_color ) ) {
1700
  ?>
1701
+ .fts-youtube-load-more-wrapper .fts-fb-load-more {
1702
+ background: <?php echo esc_html( $youtube_loadmore_background_color ); ?> !important;
1703
+ }
1704
 
1705
+ <?php }if ( ! empty( $youtube_loadmore_text_color ) ) { ?>
1706
+ .fts-youtube-load-more-wrapper .fts-fb-load-more {
1707
+ color: <?php echo esc_html( $youtube_loadmore_text_color ); ?> !important;
1708
+ }
1709
 
1710
+ <?php
1711
  }
1712
  if ( ! empty( $youtube_loadmore_text_color ) ) {
1713
  ?>
1714
+ .fts-youtube-load-more-wrapper .fts-fb-spinner > div {
1715
+ background: <?php echo esc_html( $youtube_loadmore_text_color ); ?> !important;
1716
+ }
1717
+
1718
+ <?php } ?>
1719
+
1720
+ </style>
1721
+ <?php
1722
+ }
1723
+
1724
+ /**
1725
+ * FTS Powered By JS
1726
+ *
1727
+ * @since 1.9.6
1728
+ */
1729
+ public function fts_powered_by_js() {
1730
+ wp_enqueue_script( 'fts_powered_by_js', plugins_url( 'feeds/js/powered-by.js', dirname( __FILE__ ) ), array( 'jquery' ), FTS_CURRENT_VERSION, false );
1731
+ }
1732
+
1733
+ /**
1734
+ * Required Premium Field
1735
+ *
1736
+ * Admin Required Premium Settings Fields.
1737
+ *
1738
+ * @param array $fields_info fields info.
1739
+ * @since 2.0.7
1740
+ */
1741
+ public function need_fts_premium_plugin_field( $fields_info ) {
1742
+ $output = '<div class="feed-them-social-admin-input-default">' . wp_kses(
1743
+ $fields_info['no_active_msg'],
1744
+ array(
1745
+ 'a' => array(
1746
+ 'href' => array(),
1747
+ 'title' => array(),
1748
+ 'target' => array(),
1749
+ ),
1750
+ 'br' => array(),
1751
+ 'em' => array(),
1752
+ 'strong' => array(),
1753
+ )
1754
+ ) . '</div>';
1755
+
1756
+ return $output;
1757
+ }
1758
+
1759
+ /**
1760
+ * Settings Form Fields Output
1761
+ *
1762
+ * @param bool $save_options save options.
1763
+ * @param array $feed_settings_array feed settings information.
1764
+ * @param array $required_plugins The plugins that are required for this form.
1765
+ * @since 2.0.8
1766
+ */
1767
+ public function fts_settings_html_form( $save_options = false, $feed_settings_array, $required_plugins ) {
1768
+
1769
+ $output = '';
1770
+
1771
+ // Start creation of fields for each Feed!
1772
+ foreach ( $feed_settings_array as $section => $section_info ) {
1773
+ $output .= '<div class="' . esc_attr( $section_info['section_wrap_class'] ) . '">';
1774
+ $output .= '<form class="feed-them-social-admin-form shortcode-generator-form ' . esc_attr( $section_info['form_wrap_classes'] ) . '" id="' . esc_attr( $section_info['form_wrap_id'] ) . '">';
1775
+
1776
+ // Check to see if token is in place otherwise show a message letting person no what they need to do!
1777
+ if ( isset( $section_info['token_check'] ) ) {
1778
+ foreach ( $section_info['token_check'] as $token_key => $token_info ) {
1779
+ if ( ! isset( $token_info['req_plugin'] ) || isset( $token_info['req_plugin'] ) && is_plugin_active( $required_plugins[ $token_info['req_plugin'] ]['plugin_url'] ) ) {
1780
+ $token_check = get_option( $token_info['option_name'] ) ? 'Yes' : 'No';
1781
+ $output .= isset( $token_check ) && 'No' !== $token_check ? "\n" : '<div class="feed-them-social-admin-input-wrap fts-required-token-message">' . wp_kses(
1782
+ $token_info['no_token_msg'],
1783
+ array(
1784
+ 'a' => array(
1785
+ 'href' => array(),
1786
+ 'title' => array(),
1787
+ 'target' => array(),
1788
+ ),
1789
+ 'br' => array(),
1790
+ 'em' => array(),
1791
+ 'strong' => array(),
1792
+ 'small' => array(),
1793
+ )
1794
+ ) . '</div>' . "\n";
1795
+ }
1796
+ }
1797
+ }
1798
+ // Section Title!
1799
+ $output .= isset( $section_info['section_title'] ) ? '<h2>' . esc_html( $section_info['section_title'] ) . '</h2>' : '';
1800
+ // Feed Types select!
1801
+ if ( isset( $section_info['feeds_types'] ) ) {
1802
+ $output .= '<div class="feed-them-social-admin-input-wrap ' . esc_attr( $section_info['feed_type_select']['select_wrap_classes'] ) . '">';
1803
+ $output .= '<div class="feed-them-social-admin-input-label">' . wp_kses(
1804
+ $section_info['feed_type_select']['label'],
1805
+ array(
1806
+ 'a' => array(
1807
+ 'href' => array(),
1808
+ 'title' => array(),
1809
+ 'target' => array(),
1810
+ ),
1811
+ 'br' => array(),
1812
+ 'em' => array(),
1813
+ 'strong' => array(),
1814
+ )
1815
+ ) . '</div>';
1816
+ $output .= '<select name="' . esc_attr( $section_info['feed_type_select']['select_name'] ) . '" id="' . esc_attr( $section_info['feed_type_select']['select_id'] ) . '" class="feed-them-social-admin-input ' . esc_attr( $section_info['feed_type_select']['select_classes'] ) . '">';
1817
+ foreach ( $section_info['feeds_types'] as $feed_type_name => $feed_type ) {
1818
+ if ( 'main_options' !== $feed_type_name ) {
1819
+ $output .= '<option value="' . esc_attr( $feed_type['value'] ) . '">' . esc_html( $feed_type['title'] ) . '</option>';
1820
+ }
1821
+ }
1822
+ $output .= '</select>';
1823
+ $output .= '<div class="fts-clear"></div>';
1824
+ $output .= '</div><!--/Feed Types Select Div Wrap-->';
1825
+ }
1826
+
1827
+ // Conversion Input!
1828
+ if ( isset( $section_info['conversion_input'] ) ) {
1829
+ $output .= '<div class="' . esc_attr( $section_info['conversion_input']['main_wrap_class'] ) . '">';
1830
+ $output .= '<h2>' . esc_html( $section_info['conversion_input']['conv_section_title'] ) . '</h2>';
1831
+ $output .= '<div class="feed-them-social-admin-input-wrap ' . esc_attr( $section_info['conversion_input']['input_wrap_class'] ) . '">';
1832
+ // Instructional Text!
1833
+ $output .= '<div class="instructional-text">' . esc_html( $section_info['conversion_input']['instructional-text'] ) . '</div>';
1834
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( $section_info['conversion_input']['label'] ) . '</div>';
1835
+ // Input!
1836
+ $output .= '<input type="input" name="' . esc_attr( $section_info['conversion_input']['name'] ) . '" id="' . esc_attr( $section_info['conversion_input']['id'] ) . '" class="feed-them-social-admin-input ' . ( isset( $section_info['conversion_input']['class'] ) ? esc_attr( $section_info['conversion_input']['class'] ) : '' ) . '" value="" />';
1837
+ $output .= '<div class="fts-clear"></div>';
1838
+ $output .= '</div><!--/Conversion Input Wrap-->';
1839
+
1840
+ $output .= '<input type="button" class="feed-them-social-admin-submit-btn" value="' . esc_attr( $section_info['conversion_input']['btn-value'] ) . '" onclick="' . esc_js( $section_info['conversion_input']['onclick'] ) . '" tabindex="4" style="margin-right:1em;" />';
1841
+ $output .= '</div>';
1842
+
1843
+ }
1844
+
1845
+ $output .= '</form>';
1846
+
1847
+ // Feed Options!
1848
+ $output .= '<form class="feed-them-social-admin-form shortcode-generator-form ' . esc_attr( $section_info['form_wrap_classes'] ) . ' ' . esc_attr( $section ) . '_options_wrap">';
1849
+
1850
+ // Create settings fields for Feed OPTIONS!
1851
+ foreach ( $section_info['main_options'] as $option ) {
1852
+ if ( ! isset( $option['no_html'] ) || isset( $option['no_html'] ) && 'yes' !== $option['no_html'] ) {
1853
+
1854
+ // Is a premium extension required?
1855
+ $required_plugin = ( ! isset( $option['req_plugin'] ) || isset( $option['req_plugin'] ) && is_plugin_active( $required_plugins[ $option['req_plugin'] ]['plugin_url'] ) );
1856
+ $or_required_plugin = ( isset( $option['or_req_plugin'] ) && is_plugin_active( $required_plugins[ $option['or_req_plugin'] ]['plugin_url'] ) );
1857
+ $or_required_plugin_three = ( isset( $option['or_req_plugin_three'] ) && is_plugin_active( $required_plugins[ $option['or_req_plugin_three'] ]['plugin_url'] ) );
1858
+
1859
+ // Sub option output START?
1860
+ $output .= isset( $option['sub_options'] ) ? '<div class="' . esc_attr( $option['sub_options']['sub_options_wrap_class'] ) . ( ! $required_plugin ? ' not-active-premium-fields' : '' ) . '">' . ( isset( $option['sub_options']['sub_options_title'] ) ? '<h3>' . esc_html( $option['sub_options']['sub_options_title'] ) . '</h3>' : '' ) . ( isset( $option['sub_options']['sub_options_instructional_txt'] ) ? '<div class="instructional-text">' . esc_html( $option['sub_options']['sub_options_instructional_txt'] ) . '</div>' : '' ) : '';
1861
+
1862
+ $output .= isset( $option['grouped_options_title'] ) ? '<h3 class="sectioned-options-title">' . esc_html( $option['grouped_options_title'] ) . '</h3>' : '';
1863
+
1864
+ // Only on a few options generally!
1865
+ $output .= isset( $option['outer_wrap_class'] ) || isset( $option['outer_wrap_display'] ) ? '<div ' . ( isset( $option['outer_wrap_class'] ) ? 'class="' . esc_attr( $option['outer_wrap_class'] ) . '"' : '' ) . ' ' . ( isset( $option['outer_wrap_display'] ) && ! empty( $option['outer_wrap_display'] ) ? 'style="display:' . esc_attr( $option['outer_wrap_display'] ) . '"' : '' ) . '>' : '';
1866
+ // Main Input Wrap!
1867
+ $output .= '<div class="feed-them-social-admin-input-wrap ' . ( isset( $option['input_wrap_class'] ) ? esc_attr( $option['input_wrap_class'] ) : '' ) . '" ' . ( isset( $section_info['input_wrap_id'] ) ? 'id="' . esc_attr( $section_info['input_wrap_id'] ) . '"' : '' ) . '>';
1868
+ // Instructional Text!
1869
+ $output .= ! empty( $option['instructional-text'] ) && ! is_array( $option['instructional-text'] ) ? '<div class="instructional-text ' . ( isset( $option['instructional-class'] ) ? esc_attr( $option['instructional-class'] ) : '' ) . '">' . wp_kses(
1870
+ $option['instructional-text'],
1871
+ array(
1872
+ 'a' => array(
1873
+ 'href' => array(),
1874
+ 'title' => array(),
1875
+ 'target' => array(),
1876
+ ),
1877
+ 'br' => array(),
1878
+ 'em' => array(),
1879
+ 'strong' => array(),
1880
+ )
1881
+ ) . '</div>' : '';
1882
+
1883
+ if ( ! empty( $option['instructional-text'] ) && is_array( $option['instructional-text'] ) ) {
1884
+ foreach ( $option['instructional-text'] as $instructional_txt ) {
1885
+ // Instructional Text!
1886
+ $output .= '<div class="instructional-text ' . ( isset( $instructional_txt['class'] ) ? esc_attr( $instructional_txt['class'] ) : '' ) . '">' . wp_kses(
1887
+ $instructional_txt['text'],
1888
+ array(
1889
+ 'a' => array(
1890
+ 'href' => array(),
1891
+ 'title' => array(),
1892
+ 'target' => array(),
1893
+ ),
1894
+ 'br' => array(),
1895
+ 'em' => array(),
1896
+ 'strong' => array(),
1897
+ )
1898
+ ) . '</div>';
1899
+ }
1900
+ }
1901
+
1902
+ // Label Text!
1903
+ $output .= isset( $option['label'] ) && ! is_array( $option['label'] ) ? '<div class="feed-them-social-admin-input-label ' . ( isset( $option['label_class'] ) ? esc_attr( $option['label_class'] ) : '' ) . '">' . wp_kses(
1904
+ $option['label'],
1905
+ array(
1906
+ 'a' => array(
1907
+ 'href' => array(),
1908
+ 'title' => array(),
1909
+ 'target' => array(),
1910
+ ),
1911
+ 'br' => array(),
1912
+ 'em' => array(),
1913
+ 'strong' => array(),
1914
+ 'small' => array(),
1915
+ )
1916
+ ) . '</div>' : '';
1917
+
1918
+ if ( ! empty( $option['label'] ) && is_array( $option['label'] ) ) {
1919
+ foreach ( $option['label'] as $label_txt ) {
1920
+ // Label Text!
1921
+ $output .= '<div class="feed-them-social-admin-input-label ' . ( isset( $label_txt['class'] ) ? esc_attr( $label_txt['class'] ) : '' ) . '">' . wp_kses(
1922
+ $label_txt['text'],
1923
+ array(
1924
+ 'a' => array(
1925
+ 'href' => array(),
1926
+ 'title' => array(),
1927
+ 'target' => array(),
1928
+ ),
1929
+ 'br' => array(),
1930
+ 'em' => array(),
1931
+ 'strong' => array(),
1932
+ 'small' => array(),
1933
+ )
1934
+ ) . '</div>';
1935
+ }
1936
+ }
1937
+
1938
+ if ( $required_plugin || $or_required_plugin || $or_required_plugin_three ) {
1939
+ // Option_Type = INPUT!
1940
+ $output .= isset( $option['option_type'] ) && 'input' === $option['option_type'] ? '<input type="' . esc_attr( $option['type'] ) . '" name="' . esc_attr( $option['name'] ) . '" id="' . esc_attr( $option['id'] ) . '" class="' . ( isset( $option['color_picker'] ) && 'yes' === $option['color_picker'] ? 'color {hash:true,caps:false,required:false,adjust:false,pickerFaceColor:\'#eee\',pickerFace:3,pickerBorder:0,pickerInsetColor:\'white\'} ' : '' ) . 'feed-them-social-admin-input ' . ( isset( $option['class'] ) ? esc_attr( $option['class'] ) : '' ) . '" placeholder="' . ( isset( $option['placeholder'] ) ? esc_attr( $option['placeholder'] ) : '' ) . '" value="' . ( isset( $option['value'] ) ? '' . esc_html( $option['value'] ) : '' ) . '" />' : '';
1941
+
1942
+ // Option_Type = Select!
1943
+ if ( isset( $option['option_type'] ) && 'select' === $option['option_type'] ) {
1944
+ $output .= '<select name="' . esc_attr( $option['name'] ) . '" id="' . esc_attr( $option['id'] ) . '" class="feed-them-social-admin-input">';
1945
+ foreach ( $option['options'] as $select_option ) {
1946
+ $output .= '<option value="' . esc_html( $select_option['value'] ) . '"' . ( isset( $option['default_value'] ) && $option['default_value'] === $select_option['value'] ? ' selected' : '' ) . '>' . esc_html( $select_option['label'] ) . '</option>';
1947
+ }
1948
+ $output .= '</select>';
1949
+ }
1950
+ } else {
1951
+ // Create Required Plugin fields!
1952
+ $output .= $this->need_fts_premium_plugin_field( $required_plugins[ $option['req_plugin'] ] );
1953
+ }
1954
+ $output .= '<div class="fts-clear"></div>';
1955
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
1956
+
1957
+ $output .= isset( $option['outer_wrap_class'] ) || isset( $option['outer_wrap_display'] ) ? '</div>' : '';
1958
+
1959
+ // Sub option output END?
1960
+ if ( isset( $option['sub_options_end'] ) ) {
1961
+ $output .= ! is_numeric( $option['sub_options_end'] ) ? '</div>' : '';
1962
+ // Multiple Div needed?
1963
+ if ( is_numeric( $option['sub_options_end'] ) ) {
1964
+ $x = 1;
1965
+ while ( $x <= $option['sub_options_end'] ) {
1966
+ $output .= '</div>';
1967
+ $x++;
1968
+ }
1969
+ }
1970
+ }
1971
+ }
1972
+ }
1973
+ $output .= $this->generate_shortcode( 'updateTextArea_' . $section . '();', $section_info['generator_title'], $section_info['generator_class'] );
1974
+ $output .= '</form>';
1975
+
1976
+ $output .= '</div> <!--/Section Wrap Class END (Main-Section-Div)-->';
1977
+
1978
+ // Premium Message Boxes!
1979
+ if ( isset( $section_info['premium_msg_boxes'] ) ) {
1980
+ foreach ( $section_info['premium_msg_boxes'] as $key => $premium_msg ) {
1981
+ if ( ! is_plugin_active( $required_plugins[ $premium_msg['req_plugin'] ]['plugin_url'] ) ) {
1982
+ $output .= '<div class="feed-them-social-admin-input-wrap fts-premium-options-message" id="not_active_' . esc_attr( $key ) . '"><a class="not-active-title" href="' . esc_url( $required_plugins[ $premium_msg['req_plugin'] ]['slick_url'] ) . '" target="_blank">' .
1983
+
1984
+ wp_kses(
1985
+ $required_plugins[ $premium_msg['req_plugin'] ]['name'],
1986
+ array(
1987
+ 'h3' => array(),
1988
+ )
1989
+ ) .
1990
+
1991
+ '</a>' . wp_kses(
1992
+ $premium_msg['msg'],
1993
+ array(
1994
+ 'a' => array(
1995
+ 'href' => array(),
1996
+ 'title' => array(),
1997
+ 'target' => array(),
1998
+ ),
1999
+ 'br' => array(),
2000
+ 'em' => array(),
2001
+ 'strong' => array(),
2002
+ 'small' => array(),
2003
+ )
2004
+ ) . '</div>';
2005
+ }
2006
+ }
2007
+ }
2008
+ }
2009
+ return $output;
2010
+ }
2011
+
2012
+ /**
2013
+ * FTS Facebook Page Form
2014
+ *
2015
+ * @param bool $save_options save options.
2016
+ * @since 1.9.6
2017
+ */
2018
+ public function fts_facebook_page_form( $save_options = false ) {
2019
+ $fts_fb_page_form_nonce = wp_create_nonce( 'fts-facebook-page-form-nonce' );
2020
+
2021
+ if ( wp_verify_nonce( $fts_fb_page_form_nonce, 'fts-facebook-page-form-nonce' ) ) {
2022
+ if ( $save_options ) {
2023
+ $fb_page_id_option = get_option( 'fb_page_id' );
2024
+ $fb_page_posts_displayed_option = get_option( 'fb_page_posts_displayed' );
2025
+ $fb_page_post_count_option = get_option( 'fb_page_post_count' );
2026
+ $fb_page_title_option = get_option( 'fb_page_title_option' );
2027
+ $fb_page_description_option = get_option( 'fb_page_description_option' );
2028
+ $fb_page_word_count_option = get_option( 'fb_page_word_count_option' );
2029
+ $fts_bar_fb_prefix = 'fb_page_';
2030
+ $fb_load_more_option = get_option( 'fb_page_fb_load_more_option' );
2031
+ $fb_load_more_style = get_option( 'fb_page_fb_load_more_style' );
2032
+ $facebook_popup = get_option( 'fb_page_facebook_popup' );
2033
+ }
2034
+ $output = '<div class="fts-facebook_page-shortcode-form">';
2035
+ if ( false === $save_options ) {
2036
+ $output = '<form class="feed-them-social-admin-form shortcode-generator-form fb-page-shortcode-form" id="fts-fb-page-form">';
2037
+
2038
+ // Check to see if token is in place otherwise show a message letting person no what they need to do!
2039
+ $facebook_options = get_option( 'fts_facebook_custom_api_token' ) ? 'Yes' : 'No';
2040
+ $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";
2041
+ // end custom message for requiring token!
2042
+ if ( is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) ) {
2043
+ $facebook_options2 = get_option( 'fts_facebook_custom_api_token_biz' ) ? 'Yes' : 'No';
2044
+ // Check to see if token is in place otherwise show a message letting person no what they need to do
2045
+ // $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";
2046
+ // end custom message for requiring token!
2047
+ }
2048
+
2049
+ $output .= '<h2>' . esc_html( 'Facebook Page Shortcode Generator', 'feed-them-social' ) . '</h2>';
2050
+ }
2051
+ $fb_page_id_option = isset( $fb_page_id_option ) ? $fb_page_id_option : '';
2052
+ // ONLY SHOW SUPER GALLERY OPTIONS ON FTS SETTINGS PAGE FOR NOW, NOT FTS BAR!
2053
+ if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2054
+ // FACEBOOK FEED TYPE!
2055
+ $output .= '<div class="feed-them-social-admin-input-wrap" id="fts-social-selector">';
2056
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Feed Type', 'feed-them-social' ) . '</div>';
2057
+ $output .= '<select name="facebook-messages-selector" id="facebook-messages-selector" class="feed-them-social-admin-input">';
2058
+ $output .= '<option value="page">' . esc_html( 'Facebook Page', 'feed-them-social' ) . '</option>';
2059
+ $output .= '<option value="events">' . esc_html( 'Facebook Page List of Events', 'feed-them-social' ) . '</option>';
2060
+ $output .= '<option value="event">' . esc_html( 'Facebook Page Single Event Posts', 'feed-them-social' ) . '</option>';
2061
+ $output .= '<option value="group">' . esc_html( 'Facebook Group', 'feed-them-social' ) . '</option>';
2062
+ $output .= '<option value="album_photos">' . esc_html( 'Facebook Album Photos', 'feed-them-social' ) . '</option>';
2063
+ $output .= '<option value="albums">' . esc_html( 'Facebook Album Covers', 'feed-them-social' ) . '</option>';
2064
+ $output .= '<option value="album_videos">' . esc_html( 'Facebook Videos', 'feed-them-social' ) . '</option>';
2065
+ $output .= '<option value="reviews">' . esc_html( 'Facebook Page Reviews', 'feed-them-social' ) . '</option>';
2066
+ $output .= '</select>';
2067
+ $output .= '<div class="fts-clear"></div>';
2068
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2069
+ };
2070
+ // INSTRUCTIONAL TEXT FOR FACEBOOK TYPE SELECTION. PAGE, GROUP, EVENT, ALBUMS, ALBUM COVERS AND HASH TAGS!
2071
+ $output .= '<div class="instructional-text facebook-message-generator page inst-text-facebook-page" style="display:block;">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-facebook-page-vanity-url/" target="_blank">' . esc_html( 'Facebook Page ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below. You cannot use Personal Profiles it must be a Facebook Page. If your page ID looks something like, My-Page-Name-50043151918, only use the number portion, 50043151918.', 'feed-them-social' ) . ' <a href="https://feedthemsocial.com/?feedID=50043151918" target="_blank">' . esc_html( 'Test your Page ID on our demo', 'feed-them-social' ) . '</a></div>
 
 
 
 
2072
  <div class="instructional-text facebook-message-generator group inst-text-facebook-group">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-facebook-group-id/" target="_blank">' . esc_html( 'Facebook Group ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below.', 'feed-them-social' ) . '</div>
2073
  <div class="instructional-text facebook-message-generator event-list inst-text-facebook-event-list">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-facebook-event-id/" target="_blank">' . esc_html( 'Facebook Event ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below. PLEASE NOTE: This will only work with Facebook Page Events and you cannot have more than 25 events on Facebook.', 'feed-them-social' ) . '</div>
2074
  <div class="instructional-text facebook-message-generator event inst-text-facebook-event">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-facebook-event-id/" target="_blank">' . esc_html( 'Facebook Event ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below.', 'feed-them-social' ) . '</div>
2075
  <div class="instructional-text facebook-message-generator album_photos inst-text-facebook-album-photos">' . esc_html( 'To show a specific Album copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/docs/how-to-get-your-facebook-photo-gallery-id/" target="_blank">' . esc_html( 'Facebook Album ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the second input below. If you want to show all your uploaded photos leave the Album ID input blank.', 'feed-them-social' ) . '</div>
2076
  <div class="instructional-text facebook-message-generator albums inst-text-facebook-albums">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/docs/how-to-get-your-facebook-photo-gallery-id/" target="_blank">' . esc_html( 'Facebook Album Covers ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below.', 'feed-them-social' ) . '</div>
2077
  <div class="instructional-text facebook-message-generator video inst-text-facebook-video">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/docs/how-to-get-your-facebook-id-and-video-gallery-id" target="_blank">' . esc_html( 'Facebook ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below.', 'feed-them-social' ) . '</div>';
2078
+ if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2079
+ // this is for the facebook videos!
2080
+ $output .= '<div class="feed-them-social-admin-input-wrap fts-premium-options-message" style="display:none;"><a target="_blank" href="http://www.slickremix.com/downloads/feed-them-social-premium-extension/">Premium Version Required</a><br/>The Facebook video feed allows you to view your uploaded videos from facebook. See these great examples and options of all the different ways you can bring new life to your WordPress site!<br/><a href="https://feedthemsocial.com/facebook-videos-demo/" target="_blank">View Demo</a><br/><br/>Additionally if you purchase the Carousel Plugin you can showcase your videos in a slideshow or carousel. Works with your Facebook Photos too!<br/><a href="https://feedthemsocial.com/facebook-carousels/" target="_blank">View Carousel Demo</a> </div>';
2081
+ // this is for the facebook reviews!
2082
+ $output .= '<div class="feed-them-social-admin-input-wrap fts-premium-options-message2" style="display:none;"><a target="_blank" href="http://www.slickremix.com/downloads/feed-them-social-facebook-reviews/">Facebook Reviews Required</a><br/>The Facebook Reviews feed allows you to view all of the reviews people have made on your Facebook Page. See these great examples and options of all the different ways you can display your Facebook Page Reviews on your website. <a href="https://feedthemsocial.com/facebook-page-reviews-demo/" target="_blank">View Demo</a></div>';
2083
+ }
2084
+ // FACEBOOK PAGE ID!
2085
+ if ( isset( $_GET['page'] ) && 'fts-bar-settings-page' !== $_GET['page'] ) {
2086
+ $output .= '<div class="fb-options-wrap">';
2087
+ }
2088
+ $output .= '<div class="feed-them-social-admin-input-wrap fb_page_id ">';
2089
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Facebook ID (required)', 'feed-them-social' ) . '</div>';
2090
+ $output .= '<input type="text" name="fb_page_id" id="fb_page_id" class="feed-them-social-admin-input" value="' . esc_html( $fb_page_id_option ) . '" />';
2091
+ $output .= '<div class="fts-clear"></div>';
2092
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2093
+ // FACEBOOK ALBUM PHOTOS ID!
2094
+ $output .= '<div class="feed-them-social-admin-input-wrap fb_album_photos_id" style="display:none;">';
2095
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Album ID ', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Leave blank to show all uploaded photos', 'feed-them-social' ) . '</small></div>';
2096
+ $output .= '<input type="text" name="fb_album_id" id="fb_album_id" class="feed-them-social-admin-input" value="" />';
2097
+ $output .= '<div class="fts-clear"></div>';
2098
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2099
+ $fb_page_posts_displayed_option = isset( $fb_page_posts_displayed_option ) ? $fb_page_posts_displayed_option : '';
2100
+ // FACEBOOK PAGE POST TYPE VISIBLE!
2101
+ $output .= '<div class="feed-them-social-admin-input-wrap facebook-post-type-visible">';
2102
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Post Type Visible', 'feed-them-social' ) . '</div>';
2103
+ $output .= '<select name="fb_page_posts_displayed" id="fb_page_posts_displayed" class="feed-them-social-admin-input">';
2104
+ $output .= '<option ' . selected( $fb_page_posts_displayed_option, 'page_only', false ) . ' value="page_only">' . esc_html( 'Display Posts made by Page only', 'feed-them-social' ) . '</option>';
2105
+ $output .= '<option ' . selected( $fb_page_posts_displayed_option, 'page_and_others', false ) . ' value="page_and_others">' . esc_html( 'Display Posts made by Page and Others', 'feed-them-social' ) . '</option>';
2106
+ $output .= '</select>';
2107
+ $output .= '<div class="fts-clear"></div>';
2108
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2109
+
2110
+ $fb_page_post_count_option = isset( $fb_page_post_count_option ) ? $fb_page_post_count_option : '';
2111
+ $output .= '<div class="feed-them-social-admin-input-wrap">';
2112
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( '# of Posts', 'feed-them-premium' );
2113
+
2114
+ if ( ! is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) || ! is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) ) {
2115
+ $output .= '<br/><small>' . esc_html( 'More than 6 Requires <a target="_blank" href="http://www.slickremix.com/downloads/feed-them-social-premium-extension/">Premium version</a>', 'feed-them-premium' ) . '</small>';
2116
+ }
2117
+ $output .= '</div>';
2118
+ $output .= '<input type="text" name="fb_page_post_count" id="fb_page_post_count" class="feed-them-social-admin-input" value="' . esc_html( $fb_page_post_count_option ) . '" placeholder="5 ' . esc_html( 'is the default number', 'feed-them-premium' ) . '" />';
2119
+ $output .= '<div class="fts-clear"></div>';
2120
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2121
+
2122
+ // ONLY SHOW SUPER GALLERY OPTIONS ON FTS SETTINGS PAGE FOR NOW, NOT FTS BAR!
2123
+ if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2124
+ // FACEBOOK HEIGHT OPTION!
2125
+ $output .= '<div class="feed-them-social-admin-input-wrap twitter_name fixed_height_option">';
2126
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Facebook Fixed Height', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Leave blank for auto height', 'feed-them-social' ) . '</small></div>';
2127
+ $output .= '<input type="text" name="facebook_page_height" id="facebook_page_height" class="feed-them-social-admin-input" value="" placeholder="450px ' . esc_html( 'for example', 'feed-them-social' ) . '" />';
2128
+ $output .= '<div class="fts-clear"></div>';
2129
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2130
+ }
2131
+
2132
+ if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && ! is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) ) {
2133
+
2134
+ include $this->premium . 'admin/facebook-page-settings-fields.php';
2135
+ if ( isset( $_GET['page'] ) && 'fts-bar-settings-page' === $_GET['page'] ) {
2136
+ // PREMIUM LOAD MORE SETTINGS & LOADS in FTS BAR!
2137
+ include $this->premium . 'admin/facebook-loadmore-settings-fields.php';
2138
+ }
2139
+ } elseif ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) ) {
2140
+
2141
+ // these are the new options for reviews only!
2142
+ include $this->facebook_reviews . 'admin/facebook-review-settings-fields.php';
2143
+
2144
+ include $this->premium . 'admin/facebook-page-settings-fields.php';
2145
+ if ( isset( $_GET['page'] ) && 'fts-bar-settings-page' === $_GET['page'] ) {
2146
+ // PREMIUM LOAD MORE SETTINGS & LOADS in FTS BAR!
2147
+ include $this->premium . 'admin/facebook-loadmore-settings-fields.php';
2148
+ }
2149
+ } elseif ( is_plugin_active( 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php' ) && ! is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2150
+ // include($this->facebook_reviews.'admin/facebook-page-settings-fields.php');
2151
+ // these are the new options for reviews only!
2152
+ include $this->facebook_reviews . 'admin/facebook-review-settings-fields.php';
2153
+
2154
+ // these are the additional options only for reviews from premium!
2155
+ include $this->facebook_reviews . 'admin/facebook-loadmore-settings-fields.php';
2156
+
2157
+ // Create Need Premium Fields!
2158
+ $fields = array(
2159
+ esc_html( 'Show the Page Title', 'feed-them-social' ),
2160
+ esc_html( 'Align Title', 'feed-them-social' ),
2161
+ esc_html( 'Show the Page Description', 'feed-them-social' ),
2162
+ esc_html( 'Amount of words per post', 'feed-them-social' ),
2163
+ esc_html( 'Load More Posts', 'feed-them-social' ),
2164
+ esc_html( 'Display Photos in Popup', 'feed-them-social' ),
2165
+ esc_html( 'Display Posts in Grid', 'feed-them-social' ),
2166
+ esc_html( 'Center Grid', 'feed-them-social' ),
2167
+ esc_html( 'Grid Stack Animation', 'feed-them-social' ),
2168
+ esc_html( 'Hide Like Button or Box', 'feed-them-social' ),
2169
+ esc_html( 'Like Box Width', 'feed-them-social' ),
2170
+ esc_html( 'Position Like Box', 'feed-them-social' ),
2171
+ esc_html( 'Align Like Button or Box', 'feed-them-social' ),
2172
+ );
2173
+ $output .= '<div class="need-for-premium-fields-wrap">';
2174
+ $output .= $this->need_fts_premium_fields( $fields );
2175
+ $output .= '</div>';
2176
+ } else {
2177
+
2178
+ // Create Need Premium Fields!
2179
+ $fields = array(
2180
+ esc_html( 'Show the Page Title', 'feed-them-social' ),
2181
+ esc_html( 'Align Title', 'feed-them-social' ),
2182
+ esc_html( 'Show the Page Description', 'feed-them-social' ),
2183
+ esc_html( 'Amount of words per post', 'feed-them-social' ),
2184
+ esc_html( 'Load More Posts', 'feed-them-social' ),
2185
+ esc_html( 'Display Photos in Popup', 'feed-them-social' ),
2186
+ esc_html( 'Display Posts in Grid', 'feed-them-social' ),
2187
+ esc_html( 'Center Grid', 'feed-them-social' ),
2188
+ esc_html( 'Grid Stack Animation', 'feed-them-social' ),
2189
+ esc_html( 'Hide Like Button or Box', 'feed-them-social' ),
2190
+ esc_html( 'Like Box Width', 'feed-them-social' ),
2191
+ esc_html( 'Position Like Box', 'feed-them-social' ),
2192
+ esc_html( 'Align Like Button or Box', 'feed-them-social' ),
2193
+ );
2194
+ $output .= $this->need_fts_premium_fields( $fields );
2195
+ }
2196
+ // ONLY SHOW SUPER GALLERY OPTIONS ON FTS SETTINGS PAGE FOR NOW, NOT FTS BAR!
2197
+ if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2198
+ // SUPER FACEBOOK GALLERY OPTIONS!
2199
+ $output .= '<div class="fts-super-facebook-options-wrap" style="display:none">';
2200
+ // FACEBOOK IMAGE HEIGHT!
2201
+ $output .= '<div class="feed-them-social-admin-input-wrap facebook_name"><div class="feed-them-social-admin-input-label">' . esc_html( 'Facebook Image Width', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Max width is 640px', 'feed-them-social' ) . '</small></div>
2202
  <input type="text" name="fts-slicker-instagram-container-image-width" id="fts-slicker-facebook-container-image-width" class="feed-them-social-admin-input" value="250px" placeholder="">
2203
  <div class="fts-clear"></div> </div>';
2204
+ // FACEBOOK IMAGE WIDTH!
2205
+ $output .= '<div class="feed-them-social-admin-input-wrap facebook_name"><div class="feed-them-social-admin-input-label">' . esc_html( 'Facebook Image Height', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Max width is 640px', 'feed-them-social' ) . '</small></div>
2206
  <input type="text" name="fts-slicker-instagram-container-image-height" id="fts-slicker-facebook-container-image-height" class="feed-them-social-admin-input" value="250px" placeholder="">
2207
  <div class="fts-clear"></div> </div>';
2208
+ // FACEBOOK SPACE BETWEEN PHOTOS!
2209
+ $output .= '<div class="feed-them-social-admin-input-wrap facebook_name"><div class="feed-them-social-admin-input-label">' . esc_html( 'The space between photos', 'feed-them-social' ) . '</div>
2210
  <input type="text" name="fts-slicker-facebook-container-margin" id="fts-slicker-facebook-container-margin" class="feed-them-social-admin-input" value="1px" placeholder="">
2211
  <div class="fts-clear"></div></div>';
2212
+ // HIDE DATES, LIKES AND COMMENTS ETC!
2213
+ $output .= '<div class="feed-them-social-admin-input-wrap facebook_name"><div class="feed-them-social-admin-input-label">' . esc_html( 'Hide Date, Likes and Comments', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Good for image sizes under 120px', 'feed-them-social' ) . '</small></div>
2214
  <select id="fts-slicker-facebook-container-hide-date-likes-comments" name="fts-slicker-facebook-container-hide-date-likes-comments" class="feed-them-social-admin-input">
2215
  <option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option><option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option></select><div class="fts-clear"></div></div>';
2216
 
2217
+ // CENTER THE FACEBOOK CONTAINER!
2218
+ $output .= '<div class="feed-them-social-admin-input-wrap" id="facebook_super_gallery_container"><div class="feed-them-social-admin-input-label">' . esc_html( 'Center Facebook Container', 'feed-them-social' ) . '</div>
2219
  <select id="fts-slicker-facebook-container-position" name="fts-slicker-facebook-container-position" class="feed-them-social-admin-input"><option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option><option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option></select><div class="fts-clear"></div></div>';
2220
+ // ANIMATE PHOTO POSITIONING!
2221
+ $output .= ' <div class="feed-them-social-admin-input-wrap" id="facebook_super_gallery_animate"><div class="feed-them-social-admin-input-label">' . esc_html( 'Image Stacking Animation On', 'feed-them-social' ) . '<br/><small>' . esc_html( 'This happens when resizing browsert', 'feed-them-social' ) . '</small></div>
2222
  <select id="fts-slicker-facebook-container-animation" name="fts-slicker-facebook-container-animation" class="feed-them-social-admin-input"><option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option><option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option></select><div class="fts-clear"></div></div>';
2223
+ // POSITION IMAGE LEFT RIGHT!
2224
+ $output .= '<div class="instructional-text" style="display: block;">' . esc_html( 'These options allow you to make the thumbnail larger if you do not want to see black bars above or below your photos.', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/docs/fit-thumbnail-on-facebook-galleries/" target="_blank">' . esc_html( 'View Examples', 'feed-them-social' ) . '</a> ' . esc_html( 'and simple details or leave default options.', 'feed-them-social' ) . '</div>
2225
  <div class="feed-them-social-admin-input-wrap facebook_name"><div class="feed-them-social-admin-input-label">' . esc_html( 'Make photo larger', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Helps with blackspace', 'feed-them-social' ) . '</small></div>
2226
  <input type="text" id="fts-slicker-facebook-image-position-lr" name="fts-slicker-facebook-image-position-lr" class="feed-them-social-admin-input" value="-0%" placeholder="eg. -50%. -0% ' . esc_html( 'is default', 'feed-them-social' ) . '">
2227
  <div class="fts-clear"></div></div>';
2228
+ // POSITION IMAGE TOP!
2229
+ $output .= ' <div class="feed-them-social-admin-input-wrap facebook_name"><div class="feed-them-social-admin-input-label">' . esc_html( 'Image Position Top', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Helps center image', 'feed-them-social' ) . '</small></div>
2230
  <input type="text" id="fts-slicker-facebook-image-position-top" name="fts-slicker-facebook-image-position-top" class="feed-them-social-admin-input" value="-0%" placeholder="eg. -10%. -0% ' . esc_html( 'is default', 'feed-them-social' ) . '">
2231
  <div class="fts-clear"></div></div>';
2232
+ $output .= '</div><!--fts-super-facebook-options-wrap-->';
2233
+
2234
+ if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2235
+ // PREMIUM LOAD MORE SETTINGS!
2236
+ include $this->premium . 'admin/facebook-loadmore-settings-fields.php';
2237
+ }
2238
+
2239
+ // Slideshow Carousel Options!
2240
+ $output .= '<div class="slideshow-wrap" style="display: none;">';
2241
+ $output .= '<div class="instructional-text" style="display: block;">' . esc_html( 'Create a Carousel or Slideshow with these options.', 'feed-them-social' ) . ' <a href="https://feedthemsocial.com/facebook-carousels-or-sliders/" target="_blank">' . esc_html( 'View Demos', 'feed-them-social' ) . '</a> ' . esc_html( 'and copy easy to use shortcode examples.', 'feed-them-social' ) . '</div>';
2242
+
2243
+ if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && is_plugin_active( 'feed-them-carousel-premium/feed-them-carousel-premium.php' ) ) {
2244
+ include $this->facebook_carousel_premium . 'admin/facebook-carousel-options-settings-page.php';
2245
+ } else {
2246
+ // if slider plugin is active!
2247
+ $output .= '<div class="feed-them-social-admin-input-wrap facebook_name"><div class="feed-them-social-admin-input-label">' . esc_html( 'Carousel or Slideshow', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Many more options when active', 'feed-them-social' ) . '</small></div>
2248
  <div class="feed-them-social-admin-input-default" style="display: block !important;">' . esc_html( 'Must have ', 'feed-them-social' ) . ' <a target="_blank" href="http://www.slickremix.com/downloads/feed-them-social-premium-extension/">' . esc_html( 'premium', 'feed-them-social' ) . '</a> ' . esc_html( 'and', 'feed-them-social' ) . ' <a target="_blank" href="http://www.slickremix.com/downloads/feed-them-carousel-premium/">' . esc_html( 'carousel', 'feed-them-social' ) . '</a> ' . esc_html( 'plugin ', 'feed-them-social' ) . '</a> ' . esc_html( 'to edit.', 'feed-them-social' ) . '</div> <div class="fts-clear"></div></div>';
2249
+ }
2250
+
2251
+ // end slideshow wrap!
2252
+ $output .= '</div>';
2253
+
2254
+ }
2255
+ if ( $save_options ) {
2256
+ $output .= '<input type="submit" class="feed-them-social-admin-submit-btn" value="Save Changes" />';
2257
+ } else {
2258
+ $output .= $this->generate_shortcode( 'updateTextArea_fb_page();', 'Facebook Page Feed Shortcode', 'facebook-page-final-shortcode' );
2259
+ if ( isset( $_GET['page'] ) && 'fts-bar-settings-page' !== $_GET['page'] ) {
2260
+ $output .= '</div>';
2261
+ // END fb-options-wrap!
2262
+ }
2263
+ $output .= '</form>';
2264
+ }
2265
+ $output .= '</div><!--/fts-facebook_page-shortcode-form-->';
2266
+ }
2267
+ return $output;
2268
+ }
2269
+
2270
+ /**
2271
+ * FTS Twitter Form
2272
+ *
2273
+ * @param bool $save_options save options.
2274
+ * @since 1.9.6
2275
+ */
2276
+ public function fts_twitter_form( $save_options = false ) {
2277
+ $fts_twitter_form_nonce = wp_create_nonce( 'fts-twitter-form-nonce' );
2278
+
2279
+ if ( wp_verify_nonce( $fts_twitter_form_nonce, 'fts-twitter-form-nonce' ) ) {
2280
+
2281
+ if ( $save_options ) {
2282
+ $twitter_name_option = get_option( 'twitter_name' );
2283
+ $tweets_count_option = get_option( 'tweets_count' );
2284
+ $twitter_popup_option = get_option( 'twitter_popup_option' );
2285
+ $twitter_hashtag_etc_name = get_option( 'twitter_hashtag_etc_name' );
2286
+ $twitter_load_more_option = get_option( 'twitter_load_more_option' );
2287
+ }
2288
+
2289
+ $twitter_name_option = isset( $twitter_name_option ) ? $twitter_name_option : '';
2290
+ $tweets_count_option = isset( $tweets_count_option ) ? $tweets_count_option : '';
2291
+ $twitter_hashtag_etc_name = isset( $twitter_hashtag_etc_name ) ? $twitter_hashtag_etc_name : '';
2292
+ $output = '<div class="fts-twitter-shortcode-form">';
2293
+ if ( false === $save_options ) {
2294
+ $output .= '<form class="feed-them-social-admin-form shortcode-generator-form twitter-shortcode-form" id="fts-twitter-form">';
2295
+
2296
+ // Check to see if token is in place otherwise show a message letting person no what they need to do!
2297
+ $twitter_options4 = get_option( 'fts_twitter_custom_access_token_secret' ) ? 'Yes' : 'No';
2298
+ $output .= isset( $twitter_options4 ) && 'No' !== $twitter_options4 ? '' . "\n" : '<div class="feed-them-social-admin-input-wrap fts-required-token-message">Please add Twitter API Tokens to our <a href="admin.php?page=fts-twitter-feed-styles-submenu-page">Twitter Options</a> page before trying to view your feed.</div>' . "\n";
2299
+ // end custom message for requiring token!
2300
+ $output .= '<h2>' . esc_html( 'Twitter Shortcode Generator', 'feed-them-social' ) . '</h2>';
2301
+ }
2302
+
2303
+ // TWITTER FEED TYPE!
2304
+ $output .= '<div class="feed-them-social-admin-input-wrap twitter-gen-selection">';
2305
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Feed Type', 'feed-them-social' ) . '</div>';
2306
+ $output .= '<select name="twitter-messages-selector" id="twitter-messages-selector" class="feed-them-social-admin-input">';
2307
+ $output .= '<option value="user">' . esc_html( 'User Feed', 'feed-them-social' ) . '</option>';
2308
+ $output .= '<option value="hashtag">' . esc_html( '#hashtag, @person, or single words', 'feed-them-social' ) . '</option>';
2309
+ $output .= '</select>';
2310
+ $output .= '<div class="fts-clear"></div>';
2311
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2312
+
2313
+ $output .= '<div class="twitter-hashtag-etc-wrap">';
2314
+ $output .= '<h3>' . esc_html( 'Twitter Search', 'feed-them-social' ) . '</h3>';
2315
+ $output .= '<div class="instructional-text">';
2316
+ $output .= sprintf(
2317
+ esc_html( 'You can use #hashtag, @person, or single words. For example, weather or weather-channel.%1$sIf you want to filter a specific users hashtag copy this example into the first input below and replace the user_name and YourHashtag name. DO NOT remove the from: or %# characters. NOTE: Only displays last 7 days worth of Tweets. %2$sfrom:user_name%#YourHashtag%3$s', 'feed-them-social' ),
2318
+ '<br/><br/>',
2319
+ '<strong style="color:#225DE2;">',
2320
+ '</strong>'
2321
+ );
2322
+ $output .= '</div>';
2323
+ $output .= '<div class="feed-them-social-admin-input-wrap twitter_hashtag_etc_name">';
2324
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Twitter Search Name (required)', 'feed-them-social' ) . '</div>';
2325
+ $output .= '<input type="text" name="twitter_hashtag_etc_name" id="twitter_hashtag_etc_name" class="feed-them-social-admin-input" value="' . esc_html( $twitter_hashtag_etc_name ) . '" />';
2326
+ $output .= '<div class="fts-clear"></div>';
2327
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2328
+ $output .= '</div><!--/twitter-hashtag-etc-wrap-->';
2329
+
2330
+ $output .= '<div class="instructional-text"><span class="hashtag-option-small-text">' . esc_html( 'Twitter Name is only required if you want to show a', 'feed-them-social' ) . ' <a href="admin.php?page=fts-twitter-feed-styles-submenu-page">' . esc_html( 'Follow Button', 'feed-them-social' ) . '</a>.</span><span class="must-copy-twitter-name">' . esc_html( 'You must copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-twitter-name/" target="_blank">' . esc_html( 'Twitter Name', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below.', 'feed-them-social' ) . '</span></div>';
2331
+ $output .= '<div class="feed-them-social-admin-input-wrap twitter_name">';
2332
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Twitter Name', 'feed-them-social' ) . ' <span class="hashtag-option-not-required">' . esc_html( '(required)', 'feed-them-social' ) . '</span></div>';
2333
+ $output .= '<input type="text" name="twitter_name" id="twitter_name" class="feed-them-social-admin-input" value="' . esc_html( $twitter_name_option ) . '" />';
2334
+ $output .= '<div class="fts-clear"></div>';
2335
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2336
+
2337
+ $output .= '<div class="feed-them-social-admin-input-wrap">';
2338
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( '# of Tweets (optional)', 'feed-them-premium' );
2339
+ if ( ! is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2340
+ $output .= sprintf(
2341
+ esc_html( '%1$s More than 6 Requires the %2$sPremium Extension%3$s', 'feed-them-social' ),
2342
+ '<br/><small>',
2343
+ '<a target="_blank" href="' . esc_url( 'http://www.slickremix.com/downloads/feed-them-social-premium-extension/' ) . '">',
2344
+ '</a></small>'
2345
+ );
2346
+ }
2347
+ $output .= '</div>';
2348
+ $output .= '<input type="text" name="tweets_count" id="tweets_count" placeholder="5 is the default number" class="feed-them-social-admin-input" value="' . esc_html( $tweets_count_option ) . '" />';
2349
+ $output .= '<div class="fts-clear"></div>';
2350
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2351
+
2352
+ if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2353
+ $output .= '<div class="feed-them-social-admin-input-wrap">';
2354
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Twitter Fixed Height', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Leave blank for auto height', 'feed-them-social' ) . '</small></div>';
2355
+ $output .= '<input type="text" name="twitter_height" id="twitter_height" class="feed-them-social-admin-input" value="" placeholder="450px ' . esc_html( 'for example', 'feed-them-social' ) . '" />';
2356
+ $output .= '<div class="fts-clear"></div>';
2357
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2358
+ }
2359
+
2360
+ $output .= '<div class="feed-them-social-admin-input-wrap">';
2361
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Show Retweets', 'feed-them-social' ) . '</div>';
2362
+ $output .= '<select name="twitter-show-retweets" id="twitter-show-retweets" class="feed-them-social-admin-input">';
2363
+ $output .= '<option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option>';
2364
+ $output .= '<option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option>';
2365
+ $output .= '</select>';
2366
+ $output .= '<div class="fts-clear"></div>';
2367
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2368
+
2369
+ if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2370
+ include $this->premium . 'admin/twitter-settings-fields.php';
2371
+ } else {
2372
+ // Create Need Premium Fields!
2373
+ $fields = array(
2374
+ __( 'Display Photos in Popup', 'feed-them-social' ),
2375
+ );
2376
+ $output .= $this->need_fts_premium_fields( $fields );
2377
+ }
2378
+ if ( $save_options ) {
2379
+ $output .= '<input type="submit" class="feed-them-social-admin-submit-btn" value="' . esc_html( 'Save Changes', 'feed-them-social' ) . '" />';
2380
+ } else {
2381
+ $output .= $this->generate_shortcode( 'updateTextArea_twitter();', 'Twitter Feed Shortcode', 'twitter-final-shortcode' );
2382
+ $output .= '</form>';
2383
+ }
2384
+ $output .= '</div><!--/fts-twitter-shortcode-form-->';
2385
+ }
2386
+
2387
+ return $output;
2388
+ }
2389
+
2390
+ /**
2391
+ * FTS Instagram Form
2392
+ *
2393
+ * @param bool $save_options save options.
2394
+ * @since 1.9.7
2395
+ */
2396
+ public function fts_instagram_form( $save_options = false ) {
2397
+ $fts_instagram_form_nonce = wp_create_nonce( 'fts-instagram-form-nonce' );
2398
+
2399
+ if ( wp_verify_nonce( $fts_instagram_form_nonce, 'fts-instagram-form-nonce' ) ) {
2400
+
2401
+ if ( $save_options ) {
2402
+ $instagram_name_option = get_option( 'convert_instagram_username' );
2403
+ $instagram_id_option = get_option( 'instagram_id' );
2404
+ $pics_count_option = get_option( 'pics_count' );
2405
+ $instagram_popup_option = get_option( 'instagram_popup_option' );
2406
+ $instagram_load_more_option = get_option( 'instagram_load_more_option' );
2407
+ }
2408
+ $output = '<div class="fts-instagram-shortcode-form">';
2409
+ if ( false === $save_options ) {
2410
+ $output .= '<form class="feed-them-social-admin-form shortcode-generator-form instagram-shortcode-form" id="fts-instagram-form">';
2411
+
2412
+ // Check to see if token is in place otherwise show a message letting person no what they need to do!
2413
+ $instagram_options = get_option( 'fts_instagram_custom_api_token' ) ? 'Yes' : 'No';
2414
+ $output .= isset( $instagram_options ) && 'No' !== $instagram_options ? '' . "\n" : '<div class="feed-them-social-admin-input-wrap fts-required-token-message">Please get your Access Token on the <a href="admin.php?page=fts-instagram-feed-styles-submenu-page">Instagram Options</a> page or you won\'t be able to view your photos.</div>' . "\n";
2415
+ // end custom message for requiring token!
2416
+ // ONLY SHOW SUPER GALLERY OPTIONS ON FTS SETTINGS PAGE FOR NOW, NOT FTS BAR!
2417
+ if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2418
+ // INSTAGRAM FEED TYPE!
2419
+ $output .= '<h2>' . esc_html( 'Instagram Shortcode Generator', 'feed-them-social' ) . '</h2><div class="feed-them-social-admin-input-wrap instagram-gen-selection">';
2420
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Feed Type', 'feed-them-social' ) . '</div>';
2421
+ $output .= '<select name="instagram-messages-selector" id="instagram-messages-selector" class="feed-them-social-admin-input">';
2422
+ $output .= '<option value="user">' . esc_html( 'User Feed', 'feed-them-social' ) . '</option>';
2423
+ $output .= '<option value="hashtag">' . esc_html( 'Hashtag Feed', 'feed-them-social' ) . '</option>';
2424
+ $output .= '</select>';
2425
+ $output .= '<div class="fts-clear"></div>';
2426
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2427
+ };
2428
+ $output .= '<div class="instagram-id-option-wrap">';
2429
+ $output .= '<h3>' . esc_html( 'Convert Instagram Name to ID', 'feed-them-social' ) . '</h3>';
2430
+ }
2431
+ $instagram_name_option = isset( $instagram_name_option ) ? $instagram_name_option : '';
2432
+ $instagram_id_option = isset( $instagram_id_option ) ? $instagram_id_option : '';
2433
+ $output .= '<div class="instructional-text">' . esc_html( 'You must copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-instagram-name-and-convert-to-id/" target="_blank">' . esc_html( 'Instagram Name', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below', 'feed-them-social' ) . '</div>';
2434
+ $output .= '<div class="feed-them-social-admin-input-wrap convert_instagram_username">';
2435
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Instagram Name (required)', 'feed-them-social' ) . '</div>';
2436
+ $output .= '<input type="text" id="convert_instagram_username" name="convert_instagram_username" class="feed-them-social-admin-input" value="' . esc_html( $instagram_name_option ) . '" />';
2437
+ $output .= '<div class="fts-clear"></div>';
2438
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2439
+ $output .= '<input type="button" class="feed-them-social-admin-submit-btn" value="' . esc_html( 'Convert Instagram Username', 'feed-them-social' ) . '" onclick="converter_instagram_username();" tabindex="4" style="margin-right:1em;" />';
2440
+ // ONLY THIS DIV IF ON OUR SETTINGS PAGE!
2441
+ if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2442
+ $output .= '</div><!--instagram-id-option-wrap-->';
2443
+ };
2444
+ if ( false === $save_options ) {
2445
+ $output .= '</form>';
2446
+ }
2447
+ if ( false === $save_options ) {
2448
+ $output .= '<form class="feed-them-social-admin-form shortcode-generator-form instagram-shortcode-form">';
2449
+ }
2450
+ $output .= '<div class="instructional-text instagram-user-option-text" style="margin-top:12px;"><div class="fts-insta-info-plus-wrapper">' . esc_html( 'Choose a different ID if yours is not the first name below after clicking Convert Instagram Username button.', 'feed-them-social' ) . '</div><!-- the li list comes from an ajax call after looking up the user ID --><ul id="fts-instagram-username-picker-wrap" class="fts-instagram-username-picker-wrap"></ul></div>';
2451
+ $output .= '<div class="instructional-text instagram-hashtag-option-text" style="display:none;margin-top:12px;">' . esc_html( 'Add your Hashtag below. Do not add the #, just the name.', 'feed-them-social' ) . '</div>';
2452
+ $output .= '<div class="feed-them-social-admin-input-wrap instagram_name">';
2453
+ $output .= '<div class="feed-them-social-admin-input-label instagram-user-option-text">' . esc_html( 'Instagram ID # (required)', 'feed-them-social' ) . '</div>';
2454
+ $output .= '<div class="feed-them-social-admin-input-label instagram-hashtag-option-text" style="display:none;">' . esc_html( 'Hashtag (required)', 'feed-them-social' ) . '</div>';
2455
+ $output .= '<input type="text" name="instagram_id" id="instagram_id" class="feed-them-social-admin-input" value="' . esc_html( $instagram_id_option ) . '" />';
2456
+ $output .= '<div class="fts-clear"></div>';
2457
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2458
+ // Super Instagram Options!
2459
+ $pics_count_option = isset( $pics_count_option ) ? $pics_count_option : '';
2460
+ // Pic Count Option!
2461
+ $output .= '<div class="feed-them-social-admin-input-wrap">';
2462
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( '# of Pics (optional)', 'feed-them-premium' );
2463
+ if ( ! is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2464
+ $output .= sprintf(
2465
+ esc_html( '%1$s More than 6 Requires the %2$sPremium Extension%3$s', 'feed-them-social' ),
2466
+ '<br/><small>',
2467
+ '<a target="_blank" href="' . esc_url( 'http://www.slickremix.com/downloads/feed-them-social-premium-extension/' ) . '">',
2468
+ '</a></small>'
2469
+ );
2470
+ }
2471
+ $output .= '</div>';
2472
+ $output .= '<input type="text" name="pics_count" id="pics_count" class="feed-them-social-admin-input" value="' . esc_html( $pics_count_option ) . '" placeholder="6 is the default number" />';
2473
+ $output .= '<div class="fts-clear"></div>';
2474
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2475
+
2476
+ if ( isset( $_GET['page'] ) && 'feed-them-settings-page' === $_GET['page'] ) {
2477
+
2478
+ $output .= '<div class="feed-them-social-admin-input-wrap">';
2479
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Super Instagram Gallery', 'feed-them-social' ) . '</div>';
2480
+ $output .= '<select id="instagram-custom-gallery" name="instagram-custom-gallery" class="feed-them-social-admin-input"><option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option><option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option></select>';
2481
+ $output .= '<div class="fts-clear"></div>';
2482
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2483
+ $output .= '<div class="feed-them-social-admin-input-wrap"><div class="feed-them-social-admin-input-label">' . esc_html( 'Instagram Image Size', 'feed-them-social' ) . '<br/><small><a href="https://feedthemsocial.com/instagram-feed-demo/" target="_blank">' . esc_html( 'View demo', 'feed-them-social' ) . '</a></small></div>
 
 
2484
  <input type="text" name="fts-slicker-instagram-container-image-size" id="fts-slicker-instagram-container-image-size" class="feed-them-social-admin-input" value="250px" placeholder="">
2485
  <div class="fts-clear"></div> </div>';
2486
+ $output .= '<div class="feed-them-social-admin-input-wrap"><div class="feed-them-social-admin-input-label">' . esc_html( 'Size of the Instagram Icon', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Visible when you hover over photo', 'feed-them-social' ) . '</small></div>
2487
  <input type="text" name="fts-slicker-instagram-icon-center" id="fts-slicker-instagram-icon-center" class="feed-them-social-admin-input" value="65px" placeholder="">
2488
  <div class="fts-clear"></div></div>';
2489
+ $output .= '<div class="feed-them-social-admin-input-wrap"><div class="feed-them-social-admin-input-label">' . esc_html( 'The space between photos', 'feed-them-social' ) . '</div>
2490
  <input type="text" name="fts-slicker-instagram-container-margin" id="fts-slicker-instagram-container-margin" class="feed-them-social-admin-input" value="1px" placeholder="">
2491
  <div class="fts-clear"></div></div>';
2492
+ $output .= '<div class="feed-them-social-admin-input-wrap"><div class="feed-them-social-admin-input-label">' . esc_html( 'Hide Date, Likes and comments', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Good for image sizes under 120px', 'feed-them-social' ) . '</small></div>
2493
  <select id="fts-slicker-instagram-container-hide-date-likes-comments" name="fts-slicker-instagram-container-hide-date-likes-comments" class="feed-them-social-admin-input">
2494
  <option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option><option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option></select><div class="fts-clear"></div></div>';
2495
+ $output .= '<div class="feed-them-social-admin-input-wrap"><div class="feed-them-social-admin-input-label">' . esc_html( 'Center Instagram Container', 'feed-them-social' ) . '</div>
2496
  <select id="fts-slicker-instagram-container-position" name="fts-slicker-instagram-container-position" class="feed-them-social-admin-input"><option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option><option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option></select>
2497
  <div class="fts-clear"></div></div>';
2498
+ $output .= ' <div class="feed-them-social-admin-input-wrap"><div class="feed-them-social-admin-input-label">' . esc_html( 'Image Stacking Animation On', 'feed-them-social' ) . '<br/><small>' . esc_html( 'This happens when resizing browser', 'feed-them-social' ) . '</small></div>
2499
  <select id="fts-slicker-instagram-container-animation" name="fts-slicker-instagram-container-animation" class="feed-them-social-admin-input"><option value="no">' . esc_html( 'No', 'feed-them-social' ) . '</option><option value="yes">' . esc_html( 'Yes', 'feed-them-social' ) . '</option></select><div class="fts-clear"></div></div>';
2500
 
2501
+ // INSTAGRAM HEIGHT OPTION!
2502
+ $output .= '<div class="feed-them-social-admin-input-wrap instagram_fixed_height_option">';
2503
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Instagram Fixed Height', 'feed-them-social' ) . '<br/><small>' . esc_html( 'Leave blank for auto height', 'feed-them-social' ) . '</small></div>';
2504
+ $output .= '<input type="text" name="instagram_page_height" id="instagram_page_height" class="feed-them-social-admin-input" value="" placeholder="450px ' . esc_html( 'for example', 'feed-them-social' ) . '" />';
2505
+ $output .= '<div class="fts-clear"></div>';
2506
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2507
+
2508
+ $output .= '</div><!--fts-super-instagram-options-wrap-->';
2509
+
2510
+ }
2511
+
2512
+ if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2513
+
2514
+ include $this->premium . 'admin/instagram-settings-fields.php';
2515
+
2516
+ } else {
2517
+ // Create Need Premium Fields!
2518
+ $fields = array(
2519
+ __( 'Display Photos & Videos in Popup', 'feed-them-social' ),
2520
+ __( 'Load More Posts', 'feed-them-social' ),
2521
+ );
2522
+ $output .= $this->need_fts_premium_fields( $fields );
2523
+ }
2524
+ if ( $save_options ) {
2525
+ $output .= '<input type="submit" class="feed-them-social-admin-submit-btn instagram-submit" value="' . esc_html( 'Save Changes', 'feed-them-social' ) . '" />';
2526
+ } else {
2527
+ $output .= $this->generate_shortcode( 'updateTextArea_instagram();', 'Instagram Feed Shortcode', 'instagram-final-shortcode' );
2528
+ $output .= '</form>';
2529
+ }
2530
+ $output .= '</div> <!--/fts-instagram-shortcode-form-->';
2531
+ }
2532
+ return $output;
2533
+ }
2534
+
2535
+ /**
2536
+ * FTS Youtube Form
2537
+ *
2538
+ * @param bool $save_options save options.
2539
+ * @since 1.9.6
2540
+ */
2541
+ public function fts_youtube_form( $save_options = false ) {
2542
+ $fts_youtube_form_nonce = wp_create_nonce( 'fts-youtube-form-nonce' );
2543
+
2544
+ if ( wp_verify_nonce( $fts_youtube_form_nonce, 'fts-youtube-form-nonce' ) ) {
2545
+ if ( $save_options ) {
2546
+ $youtube_name_option = get_option( 'youtube_name' );
2547
+ $youtube_vid_count_option = get_option( 'youtube_vid_count' );
2548
+ $youtube_columns_option = get_option( 'youtube_columns' );
2549
+ $youtube_first_video_option = get_option( 'youtube_first_video' );
2550
+ }
2551
+ $output = '<div class="fts-youtube-shortcode-form">';
2552
+ if ( false === $save_options ) {
2553
+ $output .= '<form class="feed-them-social-admin-form shortcode-generator-form youtube-shortcode-form" id="fts-youtube-form">';
2554
+
2555
+ // Check to see if token is in place otherwise show a message letting person no what they need to do!
2556
+ $youtube_options = get_option( 'youtube_custom_api_token' ) || get_option( 'youtube_custom_access_token' ) && get_option( 'youtube_custom_refresh_token' ) && get_option( 'youtube_custom_token_exp_time' ) ? 'Yes' : 'No';
2557
+ $output .= isset( $youtube_options ) && 'No' !== $youtube_options ? '' . "\n" : '<div class="feed-them-social-admin-input-wrap fts-required-token-message">Please add a YouTube API Key to our <a href="admin.php?page=fts-youtube-feed-styles-submenu-page">YouTube Options</a> page before trying to view your feed.</div>' . "\n";
2558
+ // end custom message for requiring token!
2559
+ $output .= '<h2>' . esc_html( 'YouTube Shortcode Generator', 'feed-them-social' ) . '</h2>';
2560
+ }
2561
+ $output .= '<div class="instructional-text">' . esc_html( 'You must copy your YouTube ', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-youtube-name/" target="_blank">' . esc_html( 'Username, Channel ID and or Playlist ID', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it below.', 'feed-them-social' ) . '</div>';
2562
+ if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2563
+ include $this->premium . 'admin/youtube-settings-fields.php';
2564
+ } else {
2565
+ // Create Need Premium Fields!
2566
+ $fields = array(
2567
+ __( 'YouTube Name', 'feed-them-social' ),
2568
+ __( '# of videos', 'feed-them-social' ),
2569
+ __( '# of videos in each row', 'feed-them-social' ),
2570
+ __( 'Display First video full size', 'feed-them-social' ),
2571
+ );
2572
+ $output .= $this->need_fts_premium_fields( $fields );
2573
+ $output .= '<a href="http://www.slickremix.com/downloads/feed-them-social-premium-extension/" target="_blank" class="feed-them-social-admin-submit-btn" style="margin-right:1em; margin-top: 15px; display:inline-block; text-decoration:none !important;">' . esc_html( 'Click to see Premium Version', 'feed-them-social' ) . '</a>';
2574
+ $output .= '</form>';
2575
+ }
2576
+ $output .= '</div><!--/fts-youtube-shortcode-form-->';
2577
+ }
2578
+ return $output;
2579
+ }
2580
+
2581
+ /**
2582
+ * FTS Pinterest Form
2583
+ *
2584
+ * @param bool $save_options save options.
2585
+ * @since 1.9.6
2586
+ */
2587
+ public function fts_pinterest_form( $save_options = false ) {
2588
+ $fts_pinterest_form_nonce = wp_create_nonce( 'fts-pinterest-form-nonce' );
2589
+
2590
+ if ( wp_verify_nonce( $fts_pinterest_form_nonce, 'fts-pinterest-form-nonce' ) ) {
2591
+ if ( $save_options ) {
2592
+ $pinterest_name_option = get_option( 'pinterest_name' );
2593
+ $boards_count_option = get_option( 'boards_count' );
2594
+ }
2595
+ $output = '<div class="fts-pinterest-shortcode-form">';
2596
+ if ( false === $save_options ) {
2597
+ $output = '<form class="feed-them-social-admin-form shortcode-generator-form pinterest-shortcode-form" id="fts-pinterest-form">';
2598
+ }
2599
+ // Pinterest FEED TYPE!
2600
+ $output .= '<h2>' . esc_html( 'Pinterest Shortcode Generator', 'feed-them-social' ) . '</h2><div class="feed-them-social-admin-input-wrap pinterest-gen-selection">';
2601
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Feed Type', 'feed-them-social' ) . '</div>';
2602
+ $output .= '<select name="pinterest-messages-selector" id="pinterest-messages-selector" class="feed-them-social-admin-input">';
2603
+ $output .= '<option value="boards_list">' . esc_html( 'Board List', 'feed-them-social' ) . '</option>';
2604
+ $output .= '<option value="single_board_pins">' . esc_html( 'Pins From a Specific Board', 'feed-them-social' ) . '</option>';
2605
+ $output .= '<option value="pins_from_user">' . esc_html( 'Latest Pins from a User', 'feed-them-social' ) . '</option>';
2606
+ $output .= '</select>';
2607
+ $output .= '<div class="fts-clear"></div>';
2608
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2609
+ $output .= '<h3>' . esc_html( 'Pinterest Feed', 'feed-them-social' ) . '</h3><div class="instructional-text pinterest-name-text">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-pinterest-name/" target="_blank">' . esc_html( 'Pinterest Name', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste it in the first input below.', 'feed-them-social' ) . '</div>';
2610
+ $output .= '<div class="instructional-text pinterest-board-and-name-text" style="display:none;">' . esc_html( 'Copy your', 'feed-them-social' ) . ' <a href="http://www.slickremix.com/how-to-get-your-pinterest-name/" target="_blank">' . esc_html( 'Pinterest and Board Name', 'feed-them-social' ) . '</a> ' . esc_html( 'and paste them below.', 'feed-them-social' ) . '</div>';
2611
+ $pinterest_name_option = isset( $pinterest_name_option ) ? $pinterest_name_option : '';
2612
+ $boards_count_option = isset( $boards_count_option ) ? $boards_count_option : '';
2613
+ $output .= '<div class="feed-them-social-admin-input-wrap pinterest_name">';
2614
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Pinterest Username (required)', 'feed-them-social' ) . '</div>';
2615
+ $output .= '<input type="text" name="pinterest_name" id="pinterest_name" class="feed-them-social-admin-input" value="' . esc_html( $pinterest_name_option ) . '" />';
2616
+ $output .= '<div class="fts-clear"></div>';
2617
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2618
+ $output .= '<div class="feed-them-social-admin-input-wrap board-name" style="display:none;">';
2619
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( 'Pinterest Board Name (required)', 'feed-them-premium' ) . '</div>';
2620
+ $output .= '<input type="text" name="pinterest_board_name" id="pinterest_board_name" class="feed-them-social-admin-input" value="' . esc_html( $pinterest_name_option ) . '" />';
2621
+ $output .= '<div class="fts-clear"></div>';
2622
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2623
+ if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
2624
+ include $this->premium . 'admin/pinterest-settings-fields.php';
2625
+ } else {
2626
+ // Create Need Premium Fields!
2627
+ $fields = array(
2628
+ esc_html( '# of Boards (default 6)', 'feed-them-social' ),
2629
+ esc_html( '# of Pins (default 6)', 'feed-them-social' ),
2630
+ );
2631
+ $output .= $this->need_fts_premium_fields( $fields );
2632
+ }
2633
+ if ( $save_options ) {
2634
+ $output .= '<input type="submit" class="feed-them-social-admin-submit-btn" value="' . esc_html( 'Save Changes', 'feed-them-social' ) . '" />';
2635
+ } else {
2636
+ $output .= $this->generate_shortcode( 'updateTextArea_pinterest();', '' . esc_html( 'Pinterest Feed Shortcode', 'feed-them-social' ) . '', 'pinterest-final-shortcode' );
2637
+ $output .= '</form>';
2638
+ }
2639
+ $output .= '</div><!--/fts-pinterest-shortcode-form-->';
2640
+ }
2641
+ return $output;
2642
+ }
2643
+
2644
+ /**
2645
+ * Generate Shortcode
2646
+ *
2647
+ * Generate Shortcode Button and Input for FTS settings Page.
2648
+ *
2649
+ * @param string $onclick onclick.
2650
+ * @param string $label label.
2651
+ * @param string $input_class input class.
2652
+ * @since 1.9.6
2653
+ */
2654
+ public function generate_shortcode( $onclick, $label, $input_class ) {
2655
+ $output = '<input type="button" class="feed-them-social-admin-submit-btn" value="' . esc_html( 'Generate Shortcode', 'feed-them-social' ) . '" onclick="' . esc_js( $onclick ) . '" tabindex="4" style="margin-right:1em;" />';
2656
+ $output .= '<div class="feed-them-social-admin-input-wrap final-shortcode-textarea">';
2657
+ $output .= '<h4>' . esc_html( 'Copy the ShortCode below and paste it on a page or post that you want to display your feed.', 'feed-them-social' ) . '</h4>';
2658
+ $output .= '<div class="feed-them-social-admin-input-label">' . esc_html( $label ) . '</div>';
2659
+ $output .= '<input class="copyme ' . esc_html( $input_class ) . ' feed-them-social-admin-input" value="" />';
2660
+ $output .= '<div class="fts-clear"></div>';
2661
+ $output .= '</div><!--/feed-them-social-admin-input-wrap-->';
2662
+ return $output;
2663
+ }
2664
+
2665
+ /**
2666
+ * FTS Get Feed json
2667
+ *
2668
+ * Generate Get Json (includes MultiCurl).
2669
+ *
2670
+ * @param array $feeds_mulit_data feeds data info.
2671
+ * @return array
2672
+ * @since 1.9.6
2673
+ */
2674
+ public function fts_get_feed_json( $feeds_mulit_data ) {
2675
+ // Make Multiple Requests from array with more than 2 keys!
2676
+ if ( is_array( $feeds_mulit_data ) && count( $feeds_mulit_data ) > 1 ) {
2677
+ $new_feeds_mulit_data = array();
2678
+
2679
+ foreach ( $feeds_mulit_data as $key => $url ) {
2680
+ $new_feeds_mulit_data[ $key ]['url'] = $url;
2681
+ $new_feeds_mulit_data[ $key ]['type'] = 'GET';
2682
+ }
2683
+ // Fetch Multiple Requests!
2684
+ $responses = \Requests::request_multiple( $new_feeds_mulit_data );
2685
+
2686
+ $data = array();
2687
+ foreach ( $responses as $key => $response ) {
2688
+
2689
+ if ( is_a( $response, 'Requests_Response' ) ) {
2690
+ $data[ $key ] = $response->body;
2691
+ }
2692
+ }
2693
+ } else {
2694
+ // Make Single Requests from array with 1 keys!
2695
+ if ( is_array( $feeds_mulit_data ) ) {
2696
+ foreach ( $feeds_mulit_data as $key => $url ) {
2697
+
2698
+ $single_response = \Requests::get( $url );
2699
+
2700
+ $data = array();
2701
+ if ( is_a( $single_response, 'Requests_Response' ) ) {
2702
+ $data[ $key ] = $single_response->body;
2703
+ }
2704
+ }
2705
+ } else {
2706
+ // Make Single request from just url!
2707
+ $single_response_url = $feeds_mulit_data;
2708
+
2709
+ if ( ! empty( $single_response_url ) ) {
2710
+ $single_response = \Requests::get( $single_response_url );
2711
+
2712
+ if ( is_a( $single_response, 'Requests_Response' ) ) {
2713
+ $data['data'] = $single_response->body;
2714
+ }
2715
+ }
2716
+ }
2717
+ }
2718
+ // Do nothing if Curl was Successful!
2719
+ return $data;
2720
+ }
2721
+
2722
+ /**
2723
+ * FTS Create Feed Cache
2724
+ *
2725
+ * @param string $transient_name transient name.
2726
+ * @param array $response Data returned from response.
2727
+ * @since 1.9.6
2728
+ */
2729
+ public function fts_create_feed_cache( $transient_name, $response ) {
2730
+ $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';
2731
+ set_transient( 'fts_' . $transient_name, $response, $cache_time_limit );
2732
+ }
2733
+
2734
+ /**
2735
+ * FTS Get Feed Cache
2736
+ *
2737
+ * @param string $transient_name transient name.
2738
+ * @return mixed
2739
+ * @since 1.9.6
2740
+ */
2741
+ public function fts_get_feed_cache( $transient_name ) {
2742
+ $returned_cache_data = get_transient( 'fts_' . $transient_name );
2743
+ return $returned_cache_data;
2744
+ }
2745
+
2746
+ /**
2747
+ * FTS Check Feed Cache Exists
2748
+ *
2749
+ * @param string $transient_name transient name.
2750
+ * @return bool
2751
+ * @since 1.9.6
2752
+ */
2753
+ public function fts_check_feed_cache_exists( $transient_name ) {
2754
+ if ( false === get_transient( 'fts_' . $transient_name ) ) {
2755
+ return false;
2756
+ }
2757
+ return true;
2758
+ }
2759
+
2760
+ /**
2761
+ * FTS Clear Cache Ajax
2762
+ *
2763
+ * @since 1.9.6
2764
+ */
2765
+ public function fts_clear_cache_ajax() {
2766
+ global $wpdb;
2767
+ // Clear UnExpired!
2768
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", '_transient_fts_%' ) );
2769
+ // Clear Exired Transients!
2770
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", '_transient_timeout_fts_%' ) );
2771
+ wp_reset_query();
2772
+ }
2773
+
2774
+ /**
2775
+ * Feed Them Clear Cache
2776
+ *
2777
+ * Clear Cache Folder.
2778
+ *
2779
+ * @return string
2780
+ * @since 1.9.6
2781
+ */
2782
+ public function feed_them_clear_cache() {
2783
+ global $wpdb;
2784
+ // Clear UnExpired!
2785
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", '_transient_fts_%' ) );
2786
+ // Clear Exired Transients!
2787
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s ", '_transient_timeout_fts_%' ) );
2788
+ wp_reset_query();
2789
+ return 'Cache for all FTS Feeds cleared!';
2790
+ }
2791
+
2792
+ /**
2793
+ * FTS Admin Bar Menu
2794
+ *
2795
+ * Create our custom menu in the admin bar.
2796
+ *
2797
+ * @since 1.9.6
2798
+ */
2799
+ public function fts_admin_bar_menu() {
2800
+ global $wp_admin_bar;
2801
+
2802
+ $fts_admin_bar_menu = get_option( 'fts_admin_bar_menu' );
2803
+ $fts_dev_mode_cache = get_option( 'fts_clear_cache_developer_mode' );
2804
+ if ( ! is_super_admin() || ! is_admin_bar_showing() || 'hide-admin-bar-menu' === $fts_admin_bar_menu ) {
2805
+ return;
2806
+ }
2807
+ $wp_admin_bar->add_menu(
2808
+ array(
2809
+ 'id' => 'feed_them_social_admin_bar',
2810
+ 'title' => __( 'Feed Them Social', 'feed-them-social' ),
2811
+ 'href' => false,
2812
+ )
2813
+ );
2814
+ if ( '1' === $fts_dev_mode_cache ) {
2815
+ $wp_admin_bar->add_menu(
2816
+ array(
2817
+ 'id' => 'feed_them_social_admin_bar_clear_cache',
2818
+ 'parent' => 'feed_them_social_admin_bar',
2819
+ 'title' => __( 'Cache clears on page refresh now', 'feed-them-social' ),
2820
+ 'href' => false,
2821
+ )
2822
+ );
2823
+ } else {
2824
+ $wp_admin_bar->add_menu(
2825
+ array(
2826
+ 'id' => 'feed_them_social_admin_set_cache',
2827
+ 'parent' => 'feed_them_social_admin_bar',
2828
+ 'title' => __( 'Clear Cache', 'feed-them-social' ),
2829
+ 'href' => '#',
2830
+ )
2831
+ );
2832
+ }
2833
+ $wp_admin_bar->add_menu(
2834
+ array(
2835
+ 'id' => 'feed_them_social_admin_bar_set_cache',
2836
+ 'parent' => 'feed_them_social_admin_bar',
2837
+ 'title' => sprintf(
2838
+ __( 'Set Cache Time %1$s%2$s%3$s', 'feed-them-social' ),
2839
+ '<span>',
2840
+ $this->fts_cachetime_amount( get_option( 'fts_clear_cache_developer_mode' ) ),
2841
+ '</span>'
2842
+ ),
2843
+ 'href' => admin_url( 'admin.php?page=feed-them-settings-page&tab=global_options' ),
2844
+
2845
+ )
2846
+ );
2847
+ $wp_admin_bar->add_menu(
2848
+ array(
2849
+ 'id' => 'feed_them_social_admin_bar_settings',
2850
+ 'parent' => 'feed_them_social_admin_bar',
2851
+ 'title' => __( 'Settings', 'feed-them-social' ),
2852
+ 'href' => admin_url( 'admin.php?page=feed-them-settings-page' ),
2853
+ )
2854
+ );
2855
+ $wp_admin_bar->add_menu(
2856
+ array(
2857
+ 'id' => 'feed_them_social_admin_bar_global_options',
2858
+ 'parent' => 'feed_them_social_admin_bar',
2859
+ 'title' => __( 'Global Options', 'feed-them-social' ),
2860
+ 'href' => admin_url( 'admin.php?page=feed-them-settings-page&tab=global_options' ),
2861
+ )
2862
+ );
2863
+ }
2864
+
2865
+ /**
2866
+ * FTS Cachetime amount
2867
+ *
2868
+ * @param string $fts_cachetime Cache time.
2869
+ * @return mixed
2870
+ * @since
2871
+ */
2872
+ public function fts_cachetime_amount( $fts_cachetime ) {
2873
+ switch ( $fts_cachetime ) {
2874
+ case '1':
2875
+ $fts_display_cache_time = __( 'Clear cache on every page load', 'feed-them-social' );
2876
+ break;
2877
+ default:
2878
+ case '86400':
2879
+ $fts_display_cache_time = __( '1 Day (Default)', 'feed-them-social' );
2880
+ break;
2881
+ case '172800':
2882
+ $fts_display_cache_time = __( '2 Days', 'feed-them-social' );
2883
+ break;
2884
+ case '259200':
2885
+ $fts_display_cache_time = __( '3 Days', 'feed-them-social' );
2886
+ break;
2887
+ case '604800':
2888
+ $fts_display_cache_time = __( '1 Week', 'feed-them-social' );
2889
+ break;
2890
+ case '1209600':
2891
+ $fts_display_cache_time = __( '2 Weeks', 'feed-them-social' );
2892
+ break;
2893
+ }
2894
+ return $fts_display_cache_time;
2895
+ }
2896
+
2897
+ /**
2898
+ * XML json Parse
2899
+ *
2900
+ * @param string $url string to parse the content for.
2901
+ * @return mixed
2902
+ * @since 1.9.6
2903
+ */
2904
+ public function xml_json_parse( $url ) {
2905
+ $url_to_get['url'] = $url;
2906
+ $file_contents_returned = $this->fts_get_feed_json( $url_to_get );
2907
+ $file_contents = $file_contents_returned['url'];
2908
+ $file_contents = str_replace( array( "\n", "\r", "\t" ), '', $file_contents );
2909
+ $file_contents = trim( str_replace( '"', "'", $file_contents ) );
2910
+ $simple_xml = simplexml_load_string( $file_contents );
2911
+ $encoded_json = json_encode( $simple_xml );
2912
+
2913
+ return $encoded_json;
2914
+ }
2915
+
2916
+ /**
2917
+ * FTS Ago
2918
+ *
2919
+ * Create date format like fb and twitter. Thanks: http://php.quicoto.com/how-to-calculate-relative-time-like-facebook/ .
2920
+ *
2921
+ * @param string $timestamp Timestamp!
2922
+ * @return string
2923
+ * @since 1.9.6
2924
+ */
2925
+ function fts_ago( $timestamp ) {
2926
+ // not setting isset'ing anything because you have to save the settings page to even enable this feature
2927
+ $fts_language_second = get_option( 'fts_language_second' );
2928
+ if ( empty( $fts_language_second ) ) {
2929
+ $fts_language_second = 'second';
2930
+ }
2931
+ $fts_language_seconds = get_option( 'fts_language_seconds' );
2932
+ if ( empty( $fts_language_seconds ) ) {
2933
+ $fts_language_seconds = 'seconds';
2934
+ }
2935
+ $fts_language_minute = get_option( 'fts_language_minute' );
2936
+ if ( empty( $fts_language_minute ) ) {
2937
+ $fts_language_minute = 'minute';
2938
+ }
2939
+ $fts_language_minutes = get_option( 'fts_language_minutes' );
2940
+ if ( empty( $fts_language_minute ) ) {
2941
+ $fts_language_minute = 'minutes';
2942
+ }
2943
+ $fts_language_hour = get_option( 'fts_language_hour' );
2944
+ if ( empty( $fts_language_hour ) ) {
2945
+ $fts_language_hour = 'hour';
2946
+ }
2947
+ $fts_language_hours = get_option( 'fts_language_hours' );
2948
+ if ( empty( $fts_language_hours ) ) {
2949
+ $fts_language_hours = 'hours';
2950
+ }
2951
+ $fts_language_day = get_option( 'fts_language_day' );
2952
+ if ( empty( $fts_language_day ) ) {
2953
+ $fts_language_day = 'day';
2954
+ }
2955
+ $fts_language_days = get_option( 'fts_language_days' );
2956
+ if ( empty( $fts_language_days ) ) {
2957
+ $fts_language_days = 'days';
2958
+ }
2959
+ $fts_language_week = get_option( 'fts_language_week' );
2960
+ if ( empty( $fts_language_week ) ) {
2961
+ $fts_language_week = 'week';
2962
+ }
2963
+ $fts_language_weeks = get_option( 'fts_language_weeks' );
2964
+ if ( empty( $fts_language_weeks ) ) {
2965
+ $fts_language_weeks = 'weeks';
2966
+ }
2967
+ $fts_language_month = get_option( 'fts_language_month' );
2968
+ if ( empty( $fts_language_month ) ) {
2969
+ $fts_language_month = 'month';
2970
+ }
2971
+ $fts_language_months = get_option( 'fts_language_months' );
2972
+ if ( empty( $fts_language_months ) ) {
2973
+ $fts_language_months = 'months';
2974
+ }
2975
+ $fts_language_year = get_option( 'fts_language_year' );
2976
+ if ( empty( $fts_language_year ) ) {
2977
+ $fts_language_year = 'year';
2978
+ }
2979
+ $fts_language_years = get_option( 'fts_language_years' );
2980
+ if ( empty( $fts_language_years ) ) {
2981
+ $fts_language_years = 'years';
2982
+ }
2983
+ $fts_language_ago = get_option( 'fts_language_ago' );
2984
+ if ( empty( $fts_language_ago ) ) {
2985
+ $fts_language_ago = 'ago';
2986
+ }
2987
+
2988
+ // $periods = array( "sec", "min", "hour", "day", "week", "month", "years", "decade" );.
2989
+ $periods = array( $fts_language_second, $fts_language_minute, $fts_language_hour, $fts_language_day, $fts_language_week, $fts_language_month, $fts_language_year, 'decade' );
2990
+ $periods_plural = array( $fts_language_seconds, $fts_language_minutes, $fts_language_hours, $fts_language_days, $fts_language_weeks, $fts_language_months, $fts_language_years, 'decades' );
2991
+
2992
+ if ( ! is_numeric( $timestamp ) ) {
2993
+ $timestamp = strtotime( $timestamp );
2994
+ if ( ! is_numeric( $timestamp ) ) {
2995
+ return '';
2996
+ }
2997
+ }
2998
+ $difference = time() - $timestamp;
2999
+ // Customize in your own language. Why thank-you I will.
3000
+ $lengths = array( '60', '60', '24', '7', '4.35', '12', '10' );
3001
+
3002
+ if ( $difference > 0 ) {
3003
+ // this was in the past
3004
+ $ending = $fts_language_ago;
3005
+ } else {
3006
+ // this was in the future
3007
+ $difference = -$difference;
3008
+ // not doing dates in the future for posts
3009
+ $ending = 'to go';
3010
+ }
3011
+ for ( $j = 0; $difference >= $lengths[ $j ] && $j < count( $lengths ) - 1; $j++ ) {
3012
+ $difference /= $lengths[ $j ];
3013
+ }
3014
+
3015
+ $difference = round( $difference );
3016
+
3017
+ if ( $difference > 1 ) {
3018
+ $periods[ $j ] = $periods_plural[ $j ];
3019
+ }
3020
+
3021
+ return "$difference $periods[$j] $ending";
3022
+ }
3023
+
3024
+ /**
3025
+ * FTS Custom Date
3026
+ *
3027
+ * @param string $created_time Created time.
3028
+ * @param string $feed_type Feed type.
3029
+ * @return string
3030
+ * @since 1.9.6
3031
+ */
3032
+ public function fts_custom_date( $created_time, $feed_type ) {
3033
+ $fts_custom_date = get_option( 'fts-custom-date' );
3034
+ $fts_custom_time = get_option( 'fts-custom-time' );
3035
+ $custom_date_check = get_option( 'fts-date-and-time-format' );
3036
+ $fts_twitter_offset_time = get_option( 'fts_twitter_time_offset' );
3037
+ $fts_timezone = get_option( 'fts-timezone' );
3038
+
3039
+ if ( '' === $fts_custom_date && '' === $fts_custom_time ) {
3040
+ $custom_date_check = $custom_date_check;
3041
+ } elseif ( '' !== $fts_custom_date || '' !== $fts_custom_time ) {
3042
+ $custom_date_check = $fts_custom_date . ' ' . $fts_custom_time;
3043
+ } else {
3044
+ $custom_date_check = 'F jS, Y \a\t g:ia';
3045
+ }
3046
+
3047
+ // Always store the current timezone so that it can be restored later
3048
+ $fts_old_timezone = date_default_timezone_get();
3049
+ if ( ! empty( $fts_timezone ) ) {
3050
+ date_default_timezone_set( $fts_timezone );
3051
+ }
3052
+ // Twitter date time!
3053
+ if ( 'twitter' === $feed_type ) {
3054
+
3055
+ $fts_twitter_offset_time_final = 1 === $fts_twitter_offset_time ? strtotime( $created_time ) : strtotime( $created_time ) - 3 * 3600;
3056
+
3057
+ if ( 'one-day-ago' === $custom_date_check ) {
3058
+ $u_time = $this->fts_ago( $created_time );
3059
+ } else {
3060
+ $u_time = ! empty( $custom_date_check ) ? date_i18n( $custom_date_check, $fts_twitter_offset_time_final ) : $this->fts_ago( $created_time );
3061
+ }
3062
+ }
3063
+
3064
+ // Instagram date time!
3065
+ if ( 'instagram' === $feed_type ) {
3066
+ if ( 'one-day-ago' === $custom_date_check ) {
3067
+ $u_time = $this->fts_ago( $created_time );
3068
+ } else {
3069
+ $u_time = ! empty( $custom_date_check ) ? date_i18n( $custom_date_check, $created_time ) : $this->fts_ago( $created_time );
3070
+ }
3071
+ }
3072
+ // Youtube and Pinterest date time!
3073
+ if ( 'pinterest' === $feed_type ) {
3074
+ if ( 'one-day-ago' === $custom_date_check ) {
3075
+ $u_time = $this->fts_ago( $created_time );
3076
+ } else {
3077
+ $u_time = ! empty( $custom_date_check ) ? date_i18n( $custom_date_check, strtotime( $created_time ) ) : $this->fts_ago( $created_time );
3078
+ }
3079
+ }
3080
+ // WP Gallery and Pinterest date time!
3081
+ if ( 'wp_gallery' === $feed_type ) {
3082
+ if ( 'one-day-ago' === $custom_date_check ) {
3083
+ $u_time = $this->fts_ago( $created_time );
3084
+ } else {
3085
+ $u_time = ! empty( $custom_date_check ) ? date_i18n( $custom_date_check, strtotime( $created_time ) ) : $this->fts_ago( $created_time );
3086
+ }
3087
+ }
3088
+ // Facebook date time!
3089
+ if ( 'facebook' === $feed_type ) {
3090
+ $time_set = $fts_timezone;
3091
+ $time_set_check = isset( $time_set ) ? $time_set : 'America/New_York';
3092
+ date_default_timezone_set( $time_set_check );
3093
+
3094
+ if ( 'one-day-ago' === $custom_date_check ) {
3095
+ $u_time = $this->fts_ago( $created_time );
3096
+ } else {
3097
+ $u_time = ! empty( $custom_date_check ) ? date_i18n( $custom_date_check, $created_time ) : $this->fts_ago( $created_time );
3098
+ }
3099
+ }
3100
+ // Instagram date time!
3101
+ if ( 'youtube' === $feed_type ) {
3102
+ if ( 'one-day-ago' === $custom_date_check ) {
3103
+ $u_time = $this->fts_ago( $created_time );
3104
+ } else {
3105
+ $u_time = ! empty( $custom_date_check ) ? date_i18n( $custom_date_check, strtotime( $created_time ) ) : $this->fts_ago( $created_time );
3106
+ }
3107
+ }
3108
+
3109
+ // Restore the timezone to its value when entering this function to avoid side-effects
3110
+ date_default_timezone_set( $fts_old_timezone );
3111
+
3112
+ // Return the time!
3113
+ return $u_time;
3114
+ }
3115
+
3116
+ /**
3117
+ * Random String generator For All Feeds
3118
+ *
3119
+ * @param int $length Random string length.
3120
+ * @return string
3121
+ * @since 2.0.7
3122
+ */
3123
+ public function feed_them_social_rand_string( $length = 10 ) {
3124
+ $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
3125
+ $characters_length = strlen( $characters );
3126
+ $random_string = '';
3127
+ for ( $i = 0; $i < $length; $i++ ) {
3128
+ $random_string .= $characters[ wp_rand( 0, $characters_length - 1 ) ];
3129
+ }
3130
+ return $random_string;
3131
+ }
3132
+
3133
+
3134
+ /**
3135
+ * FTS Refresh YouTube Token
3136
+ *
3137
+ * @since 2.3.3
3138
+ */
3139
+ public function fts_refresh_token_ajax() {
3140
+
3141
+ $fts_refresh_token_nonce = wp_create_nonce( 'fts_refresh_token_nonce' );
3142
+
3143
+ if ( wp_verify_nonce( $fts_refresh_token_nonce, 'fts_refresh_token_nonce' ) ) {
3144
+ if ( isset( $_REQUEST['refresh_token'], $_REQUEST['button_pushed'] ) && 'yes' === $_REQUEST['button_pushed'] ) {
3145
+ update_option( 'youtube_custom_refresh_token', sanitize_text_field( wp_unslash( $_REQUEST['refresh_token'] ) ) );
3146
+ }
3147
+ if ( isset( $_REQUEST['access_token'] ) ) {
3148
+ update_option( 'youtube_custom_access_token', sanitize_text_field( wp_unslash( $_REQUEST['access_token'] ) ) );
3149
+ }
3150
+ $startoftime = isset( $_REQUEST['expires_in'] ) ? strtotime( '+' . sanitize_text_field( wp_unslash( $_REQUEST['expires_in'] ) ) . ' seconds' ) : '';
3151
+ $start_of_time_final = false !== $startoftime ? sanitize_key( $startoftime ) : '';
3152
+ update_option( 'youtube_custom_token_exp_time', $start_of_time_final );
3153
+
3154
+ // This only happens if the token is expired on the YouTube Options page and you go to re-save or refresh the page for some reason. It will also run this function if the cache is emptied and the token is found to be expired.
3155
+ if ( 'no' === $_REQUEST['button_pushed'] ) {
3156
+ return 'Token Refreshed';
3157
+ // $output .= do_shortcode('[fts _youtube vid_count=3 large_vid=no large_vid_title=no large_vid_description=no thumbs_play_in_iframe=popup vids_in_row=3 space_between_videos=1px force_columns=yes maxres_thumbnail_images=yes thumbs_wrap_color=#000 wrap=none video_wrap_display=none comments_count=12 channel_id=UCqhnX4jA0A5paNd1v-zEysw loadmore=button loadmore_count=5 loadmore_btn_maxwidth=300px loadmore_btn_margin=10px]');
3158
+ }
3159
+ }
3160
+
3161
+ }
3162
+
3163
+ /**
3164
+ * FTS Check YouTube Token Validity
3165
+ *
3166
+ * @since 2.3.3
3167
+ */
3168
+ public function feed_them_youtube_refresh_token() {
3169
+
3170
+ $fts_refresh_token_nonce = wp_create_nonce( 'fts_refresh_token_nonce' );
3171
+
3172
+ if ( wp_verify_nonce( $fts_refresh_token_nonce, 'fts_refresh_token_nonce' ) ) {
3173
+
3174
+ // Used some methods from this link http://ieg.wnet.org/2015/09/using-oauth-in-wordpress-plugins-part-2-persistence/
3175
+ // save all 3 get options: happens when clicking the get access token button on the youtube options page!
3176
+ if ( isset( $_GET['refresh_token'], $_GET['access_token'] ) && isset( $_GET['expires_in'] ) ) {
3177
+ $button_pushed = 'yes';
3178
+ $clienttoken_post['refresh_token'] = sanitize_text_field( wp_unslash( $_GET['refresh_token'] ) );
3179
+ $auth_obj['access_token'] = sanitize_text_field( wp_unslash( $_GET['access_token'] ) );
3180
+ $auth_obj['expires_in'] = sanitize_key( wp_unslash( $_GET['expires_in'] ) );
3181
+ } else {
3182
+ // refresh token!
3183
+ $button_pushed = 'no';
3184
+ $oauth2token_url = 'https://accounts.google.com/o/oauth2/token';
3185
+ $clienttoken_post = array(
3186
+ 'client_id' => '802796800957-6nannpdq8h8l720ls430ahnnq063n22u.apps.googleusercontent.com',
3187
+ 'client_secret' => 'CbieVhgOudjrpya1IDpv3uRa',
3188
+ );
3189
+ // The "refresh token" grant type is to use a refresh token to get a new access token!
3190
+ $clienttoken_post['refresh_token'] = get_option( 'youtube_custom_refresh_token' );
3191
+ $clienttoken_post['grant_type'] = 'refresh_token';
3192
+
3193
+ $postargs = array(
3194
+ 'body' => $clienttoken_post,
3195
+ );
3196
+ $response = wp_remote_post( $oauth2token_url, $postargs );
3197
+ $auth_obj = json_decode( wp_remote_retrieve_body( $response ), true );
3198
+ }
3199
+ ?>
3200
+ <script>
3201
+ jQuery(document).ready(function () {
3202
+ jQuery.ajax({
3203
+ data: {
3204
+ action: "fts_refresh_token_ajax",
3205
+ refresh_token: '<?php echo esc_js( $clienttoken_post['refresh_token'] ); ?>',
3206
+ access_token: '<?php echo esc_js( $auth_obj['access_token'] ); ?>',
3207
+ expires_in: '<?php echo esc_js( $auth_obj['expires_in'] ); ?>',
3208
+ button_pushed: '<?php echo esc_js( $button_pushed ); ?>'
3209
+ },
3210
+ type: 'POST',
3211
+ url: ftsAjax.ajaxurl,
3212
+ success: function (response) {
3213
+ console.log(response);
3214
+ <?php
3215
+ if ( isset( $_GET['page'] ) && 'fts-youtube-feed-styles-submenu-page' === $_GET['page'] ) {
3216
+ foreach ( $auth_obj as $user_id ) {
3217
+ if ( ! isset( $user_id->error->errors[0]->reason ) ) {
3218
+ $type_of_key = __( 'API key', 'feed-them-social' );
3219
+ } elseif ( ! isset( $user_id->error->errors[0]->reason ) && ! empty( $youtube_access_token ) ) {
3220
+ $type_of_key = __( 'Access Token', 'feed-them-social' );
3221
+ }
3222
+
3223
+ // Error Check!
3224
+ if ( ! isset( $auth_obj->error->errors[0]->reason ) ) {
3225
+ $fts_youtube_message = sprintf(
3226
+ 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' ),
3227
+ '<div class="fts-successful-api-token">',
3228
+ esc_html( $type_of_key ),
3229
+ '<a href="' . esc_url( 'admin.php?page=feed-them-settings-page' ) . '">',
3230
+ '</a>',
3231
+ '</div><div class="clear"></div>'
3232
+ );
3233
+ } elseif ( isset( $user_id->error->errors[0]->reason ) ) {
3234
+ $fts_youtube_message = sprintf(
3235
+ esc_html( '%1$s This %2$s does not appear to be valid. YouTube responded with: %3$s %4$s ', 'feed-them-social' ),
3236
+ '<div class="fts-failed-api-token">',
3237
+ esc_html( $type_of_key ),
3238
+ esc_html( $user_id->errors[0]->reason ),
3239
+ '</div><div class="clear"></div>'
3240
+ );
3241
+ }
3242
+
3243
+ break;
3244
+ }
3245
+
3246
+ ?>
3247
+ jQuery('#youtube_custom_access_token, #youtube_custom_token_exp_time').val('');
3248
+
3249
+ <?php if ( isset( $_GET['refresh_token'], $_GET['access_token'] ) && isset( $_GET['expires_in'] ) ) { ?>
3250
+ jQuery('#youtube_custom_refresh_token').val(jQuery('#youtube_custom_refresh_token').val() + '<?php echo esc_js( $clienttoken_post['refresh_token'] ); ?>');
3251
+ jQuery('.fts-failed-api-token').hide();
3252
+
3253
+ if (!jQuery('.fts-successful-api-token').length) {
3254
+ jQuery('.fts-youtube-last-row').append('<?php echo $fts_youtube_message; ?>');
3255
+ }
3256
+ <?php
3257
+ } else {
3258
+ ?>
3259
+ if (jQuery('.fts-failed-api-token').length) {
3260
+ jQuery('.fts-youtube-last-row').append('<?php echo $fts_youtube_message; ?>');
3261
+ jQuery('.fts-failed-api-token').hide();
3262
+ }
3263
+ <?php } ?>
3264
+
3265
+ jQuery('#youtube_custom_access_token').val(jQuery('#youtube_custom_access_token').val() + '<?php echo esc_js( $auth_obj['access_token'] ); ?>');
3266
+ jQuery('#youtube_custom_token_exp_time').val(jQuery('#youtube_custom_token_exp_time').val() + '<?php echo esc_js( strtotime( '+' . $auth_obj['expires_in'] . ' seconds' ) ); ?>');
3267
+ jQuery('<div class="fa fa-check-circle fa-3x fa-fw fts-success"></div>').insertBefore('.hide-button-tokens-options .feed-them-social-admin-input-wrap .fts-clear');
3268
+ jQuery('.fts-success').fadeIn('slow');
3269
+ <?php } ?>
3270
+ return false;
3271
+ }
3272
+ }); // end of ajax()
3273
+ return false;
3274
+ }); // end of document.ready
3275
+ </script>
3276
+ <?php
3277
+ return $auth_obj['access_token'];
3278
+ }
3279
+ }
3280
+
3281
+
3282
+ /**
3283
+ * FTS YouTube Link Filter
3284
+ *
3285
+ * @param string $youtube_description youtube description.
3286
+ * @return string
3287
+ * @since 1.9.6
3288
+ */
3289
+ public function fts_youtube_link_filter( $youtube_description ) {
3290
+ // Converts URLs to Links!
3291
+ $youtube_description = preg_replace( '@(?!(?!.*?<a)[^<]*<\/a>)(?:(?:https?|ftp|file)://|www\.|ftp\.)[-A-‌​Z0-9+&#/%=~_|$?!:,.]*[A-Z0-9+&#/%=~_|$]@i', '<a href="\0" target="_blank">\0</a>', $youtube_description );
3292
+
3293
+ $splitano = explode( 'www', $youtube_description );
3294
+ $count = count( $splitano );
3295
+ $return_value = '';
3296
+
3297
+ for ( $i = 0; $i < $count; $i++ ) {
3298
+ if ( 'href=' === substr( $splitano[ $i ], -6, 5 ) ) {
3299
+ $return_value .= $splitano[ $i ] . 'http://www';
3300
+ } elseif ( $i < $count - 1 ) {
3301
+ $return_value .= $splitano[ $i ] . 'www';
3302
+ } else {
3303
+ $return_value .= $splitano[ $i ];
3304
+ }
3305
+ }
3306
+ return $return_value;
3307
+ }
3308
+
3309
+ /**
3310
+ * FTS Youtube Video and Wrap
3311
+ *
3312
+ * @param object $post_data post data.
3313
+ * @param string $username username.
3314
+ * @param string $playlist_id playlist id.
3315
+ * @since 1.9.6
3316
+ */
3317
+ public function fts_youtube_video_and_wrap( $post_data, $username, $playlist_id ) {
3318
+ $ssl = is_ssl() ? 'https' : 'http';
3319
+ $youtube_video_user_or_playlist_url = isset( $post_data->snippet->resourceId->videoId ) ? $post_data->snippet->resourceId->videoId : '';
3320
+ $youtube_video_channel_url = isset( $post_data->id->videoId ) ? $post_data->id->videoId : '';
3321
+
3322
+ if ( '' !== $username || '' !== $playlist_id ) {
3323
+ $youtube_video_iframe = '<div class="fts-fluid-videoWrapper"><iframe src="' . esc_url( $ssl . '://www.youtube.com/embed/' . $youtube_video_user_or_playlist_url ) . '?wmode=transparent&HD=0&rel=0&showinfo=0&controls=1&autoplay=0" frameborder="0" allowfullscreen></iframe></div>';
3324
+
3325
+ } else {
3326
+ $youtube_video_iframe = '<div class="fts-fluid-videoWrapper"><iframe src="' . esc_url( $ssl . '://www.youtube.com/embed/' . $youtube_video_channel_url ) . '?wmode=transparent&HD=0&rel=0&showinfo=0&controls=1&autoplay=0" frameborder="0" allowfullscreen></iframe></div>';
3327
+ }
3328
+ return $youtube_video_iframe;
3329
+ }
3330
+
3331
+
3332
+ /**
3333
+ * Youtube Description
3334
+ *
3335
+ * @param object $post_data post data.
3336
+ * @return string
3337
+ * @since 1.9.6
3338
+ */
3339
+ public function fts_youtube_description( $post_data ) {
3340
+
3341
+ $pinterest_description = isset( $post_data->snippet->description ) ? $post_data->snippet->description : '';
3342
+ return $pinterest_description;
3343
+ }
3344
+
3345
+ /**
3346
+ * Youtube Title
3347
+ *
3348
+ * @param object $post_data post data.
3349
+ * @return string
3350
+ * @since 1.9.6
3351
+ */
3352
+ public function fts_youtube_title( $post_data ) {
3353
+ $youtube_post_title = isset( $post_data->snippet->title ) ? $post_data->snippet->title : '';
3354
+ return $youtube_post_title;
3355
+ }
3356
+
3357
+ /**
3358
+ * FTS Facebook Group Form
3359
+ *
3360
+ * @param bool $save_options Save Options.
3361
+ * @since 1.9.6
3362
+ */
3363
+ public function fts_facebook_group_form( $save_options = false ) {
3364
+ // DEPRECIATED!
3365
+ }
3366
+
3367
+ public function fts_facebook_event_form( $save_options = false ) {
3368
+ // DEPRECIATED!
3369
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3370
 
3371
  } // end class
3372
+ ?>
readme.txt CHANGED
@@ -75,6 +75,11 @@ Feed Them Social was Developed By SlickRemix --> [https://www.slickremix.com/](h
75
  * Log into WordPress dashboard then click **Plugins** > **Add new** > Then under the title "Install Plugins" click **Upload** > **choose the zip** > **Activate the plugin!**
76
 
77
  == Changelog ==
 
 
 
 
 
78
  = Version 2.7.0 Thursday, July 11th, 2019 =
79
  * REMOVE: Remove Twitter Feed default options. This change will break all users trying to use Feed Them Socials past default tokens which are no longer available. You must retrieve your own tokens for the plugin to work.
80
  * ADD: Message to Twitter options if no token is set.
75
  * Log into WordPress dashboard then click **Plugins** > **Add new** > Then under the title "Install Plugins" click **Upload** > **choose the zip** > **Activate the plugin!**
76
 
77
  == Changelog ==
78
+ = Version 2.7.1 Monday, July 16th, 2019 =
79
+ * ADD: Twitter Error messages only show for Logged in Admins now.
80
+ * FIX: Twitter Access Tokens Error message and check.
81
+ * FIX: Twitter Access Tokens now save on Option Page in the admin automatically when returned from Twitter Authorization page instead of having to click the "Save" button after return. This prevents confusion with Access token check.
82
+
83
  = Version 2.7.0 Thursday, July 11th, 2019 =
84
  * REMOVE: Remove Twitter Feed default options. This change will break all users trying to use Feed Them Socials past default tokens which are no longer available. You must retrieve your own tokens for the plugin to work.
85
  * ADD: Message to Twitter options if no token is set.