Version Description
Download this release
Release Info
Developer | slickremix |
Plugin | Feed Them Social – Facebook, Instagram, Twitter, YouTube, Pinterest |
Version | 2.8.3.1 |
Comparing to | |
See all releases |
Code changes from version 2.8.2 to 2.8.3.1
- admin/class-fts-instagram-options-page.php +214 -189
- admin/class-fts-pinterest-options-page.php +1 -1
- admin/class-fts-settings-page-options.php +28 -16
- admin/class-fts-settings-page.php +16 -14
- feed-them.php +4 -4
- feeds/instagram/class-fts-instagram-feed.php +230 -78
- includes/feed-them-functions.php +16 -4
- readme.txt +4 -1
admin/class-fts-instagram-options-page.php
CHANGED
@@ -37,12 +37,14 @@ class FTS_Instagram_Options_Page {
|
|
37 |
* @since 1.9.6
|
38 |
*/
|
39 |
public function feed_them_instagram_options_page() {
|
40 |
-
|
41 |
$fts_instagram_access_token = get_option( 'fts_instagram_custom_api_token' );
|
42 |
$fts_instagram_custom_id = get_option( 'fts_instagram_custom_id' );
|
43 |
$fts_instagram_show_follow_btn = get_option( 'instagram_show_follow_btn' );
|
44 |
$fts_instagram_show_follow_btn_where = get_option( 'instagram_show_follow_btn_where' );
|
45 |
-
|
|
|
|
|
46 |
|
47 |
if ( isset( $_GET['access_token'] ) ) { ?>
|
48 |
<script>
|
@@ -51,10 +53,16 @@ class FTS_Instagram_Options_Page {
|
|
51 |
$('#fts_instagram_custom_api_token').val('');
|
52 |
$('#fts_instagram_custom_api_token').val($('#fts_instagram_custom_api_token').val() + '<?php echo esc_js( $access_token ); ?>');
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
});
|
59 |
</script>
|
60 |
<?php } ?>
|
@@ -80,28 +88,36 @@ class FTS_Instagram_Options_Page {
|
|
80 |
settings_fields( 'fts-instagram-feed-style-options' );
|
81 |
?>
|
82 |
<h3>
|
83 |
-
<?php esc_html_e( 'Instagram API Token', 'feed-them-social' ); ?>
|
84 |
</h3>
|
85 |
<?php
|
86 |
|
87 |
|
88 |
-
|
|
|
|
|
|
|
89 |
// Get Data for Instagram!
|
90 |
$response = wp_remote_fopen( $insta_url );
|
91 |
// Error Check!
|
92 |
$test_app_token_response = json_decode( $response );
|
|
|
|
|
|
|
|
|
|
|
93 |
?>
|
94 |
<p>
|
95 |
<?php
|
96 |
-
echo esc_html( 'This is required to make the Instagram Feed work. Click the button below and it will connect to your Instagram Account to get an access token. It will then return to this page and save it in the inputs below. After it finishes you will be able to generate your Instagram feed.', 'feed-them-social' );
|
97 |
-
|
98 |
</p>
|
99 |
<p>
|
100 |
<?php
|
101 |
-
|
102 |
-
|
103 |
esc_html( '%1$sLogin and get my Access Token%2$s', 'feed-them-social' ),
|
104 |
-
'<a href="' . esc_url( 'https://instagram.com/oauth/authorize
|
105 |
'</a>'
|
106 |
);
|
107 |
?>
|
@@ -121,210 +137,219 @@ class FTS_Instagram_Options_Page {
|
|
121 |
|
122 |
<div class="feed-them-social-admin-input-wrap">
|
123 |
<div class="feed-them-social-admin-input-label fts-instagram-border-bottom-color-label">
|
124 |
-
<?php
|
125 |
-
|
126 |
|
127 |
-
|
128 |
-
|
129 |
$fts_functions->feed_them_instagram_save_token();
|
130 |
-
|
131 |
-
|
132 |
</div>
|
133 |
|
134 |
<input type="text" name="fts_instagram_custom_api_token" class="feed-them-social-admin-input" id="fts_instagram_custom_api_token" value="<?php echo esc_attr( $access_token ); ?>"/>
|
135 |
<div class="fts-clear"></div>
|
136 |
</div>
|
137 |
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
if ( ! isset( $test_app_token_response->meta->error_message ) && ! isset( $test_app_token_response->error_message ) && ! empty( $fts_instagram_access_token ) || 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 ) {
|
148 |
-
echo sprintf(
|
149 |
-
esc_html( '%1$sYour access token is working! Generate your shortcode on the %2$sSettings Page%3$s', 'feed-them-social' ),
|
150 |
-
'<div class="fts-successful-api-token">',
|
151 |
-
'<a href="' . esc_url( 'admin.php?page=feed-them-settings-page' . $custom_instagram_link_hash ) . '">',
|
152 |
-
'</a></div>'
|
153 |
-
);
|
154 |
-
} elseif ( isset( $test_app_token_response->meta->error_message ) && ! empty( $fts_instagram_access_token ) || isset( $test_app_token_response->error_message ) && ! empty( $fts_instagram_access_token ) ) {
|
155 |
-
$text = isset( $test_app_token_response->meta->error_message ) ? $test_app_token_response->meta->error_message : $test_app_token_response->error_message;
|
156 |
-
echo sprintf(
|
157 |
-
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' ),
|
158 |
-
'<div class="fts-failed-api-token instagram-failed-message">',
|
159 |
-
esc_html( $text ),
|
160 |
-
'</div>'
|
161 |
-
);
|
162 |
-
}
|
163 |
|
164 |
-
|
165 |
|
166 |
-
|
167 |
echo sprintf(
|
168 |
-
esc_html( '%1$
|
169 |
'<div class="fts-failed-api-token instagram-failed-message">',
|
|
|
|
|
170 |
'</div>'
|
171 |
);
|
172 |
}
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
<div class="fts-clear"></div>
|
176 |
</div>
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
-
<?php
|
182 |
-
if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) || is_plugin_active( 'feed-them-social-combined-streams/feed-them-social-combined-streams.php' ) ) { ?>
|
183 |
-
<div id="fb-token-master-wrap" class="feed-them-social-admin-input-wrap" >
|
184 |
-
<div class="fts-title-description-settings-page">
|
185 |
-
<h3>
|
186 |
-
<?php esc_html_e( 'Instagram Hashtag API Token', 'feed-them-social' ); ?>
|
187 |
-
</h3>
|
188 |
-
<?php
|
189 |
-
echo sprintf(
|
190 |
-
esc_html( 'You must have your Instagram Account linked to a Facebook Business Page, this is required to make the Instagram Hashtag Feed work. %1$sRead Instructions%2$s. Once you have completed the instructions you can click the button below and it will connect to your Facebook Account to get an access token. It should return a Facebook page or list of pages you are admin of and display which ones are connected to Instagram. Choose one, then click save.', 'feed-them-social' ),
|
191 |
-
'<a target="_blank" href="' . esc_url( 'https://www.slickremix.com/docs/link-instagram-account-to-facebook/' ) . '">',
|
192 |
-
'</a>'
|
193 |
-
); ?>
|
194 |
-
<p>
|
195 |
-
<?php
|
196 |
-
|
197 |
-
// call to get instagram account attached to the facebook page
|
198 |
-
// 1844222799032692 = slicktest fb page (dev user)
|
199 |
-
// 1844222799032692?fields=instagram_business_account&access_token=
|
200 |
-
// This redirect url must have an &state= instead of a ?state= otherwise it will not work proper with the fb app. https://www.slickremix.com/instagram-token/&state=.
|
201 |
-
echo sprintf(
|
202 |
-
esc_html( '%1$sLogin and get my Access Token%2$s', 'feed-them-social' ),
|
203 |
-
'<a href="' . esc_url( 'https://www.facebook.com/dialog/oauth?client_id=1123168491105924&redirect_uri=https://www.slickremix.com/instagram-token/&state=' . admin_url( 'admin.php?page=fts-instagram-feed-styles-submenu-page' ) . '&scope=manage_pages,instagram_basic' ) . '" class="fts-facebook-get-access-token">',
|
204 |
-
'</a>'
|
205 |
-
);
|
206 |
-
?>
|
207 |
-
</p>
|
208 |
-
|
209 |
-
</div>
|
210 |
-
<a href="<?php echo esc_url( 'mailto:support@slickremix.com' ); ?>" target="_blank" class="fts-admin-button-no-work"><?php esc_html_e( 'Button not working?', 'feed-them-social' ); ?></a>
|
211 |
-
<?php
|
212 |
-
$test_app_token_id = get_option( 'fts_facebook_instagram_custom_api_token' );
|
213 |
-
if ( ! empty( $test_app_token_id ) || ! empty( $test_app_token_id_biz ) ) {
|
214 |
-
|
215 |
-
$test_app_token_url = array(
|
216 |
-
'app_token_id' => 'https://graph.facebook.com/debug_token?input_token=' . $test_app_token_id . '&access_token=' . $test_app_token_id,
|
217 |
-
);
|
218 |
-
|
219 |
-
// Test App ID
|
220 |
-
$test_app_token_response = $fts_functions->fts_get_feed_json( $test_app_token_url );
|
221 |
-
$test_app_token_response = json_decode( $test_app_token_response['app_token_id'] );
|
222 |
-
|
223 |
-
// echo '<pre>';
|
224 |
-
// print_r($test_app_token_response);
|
225 |
-
// echo '</pre>';
|
226 |
-
}
|
227 |
-
?>
|
228 |
-
<div class="clear"></div>
|
229 |
-
<div class="feed-them-social-admin-input-wrap fts-fb-token-wrap" id="fts-fb-token-wrap" style="margin-bottom:0px;">
|
230 |
-
<div class="feed-them-social-admin-input-label fts-twitter-border-bottom-color-label">
|
231 |
-
<?php esc_html_e( 'Instagram ID', 'feed-them-social' ); ?>
|
232 |
-
</div>
|
233 |
-
|
234 |
-
<input type="text" name="fts_facebook_instagram_custom_api_token_user_id" class="feed-them-social-admin-input" id="fts_facebook_instagram_custom_api_token_user_id" value="<?php echo esc_attr( get_option( 'fts_facebook_instagram_custom_api_token_user_id' ) ); ?>"/>
|
235 |
-
<div class="clear" style="margin-bottom:10px;"></div>
|
236 |
-
<div class="feed-them-social-admin-input-label fts-twitter-border-bottom-color-label">
|
237 |
-
<?php esc_html_e( 'Access Token Required', 'feed-them-social' ); ?>
|
238 |
-
</div>
|
239 |
-
|
240 |
-
<input type="text" name="fts_facebook_instagram_custom_api_token" class="feed-them-social-admin-input" id="fts_facebook_instagram_custom_api_token" value="<?php echo esc_attr( get_option( 'fts_facebook_instagram_custom_api_token' ) ); ?>"/>
|
241 |
-
<div class="clear"></div>
|
242 |
-
|
243 |
-
<input type="text" hidden name="fts_facebook_instagram_custom_api_token_user_name" class="feed-them-social-admin-input" id="fts_facebook_instagram_custom_api_token_user_name" value="<?php echo esc_attr( get_option( 'fts_facebook_instagram_custom_api_token_user_name' ) ); ?>"/>
|
244 |
-
<input type="text" hidden name="fts_facebook_instagram_custom_api_token_profile_image" class="feed-them-social-admin-input" id="fts_facebook_instagram_custom_api_token_profile_image" value="<?php echo esc_attr( get_option( 'fts_facebook_instagram_custom_api_token_profile_image' ) ); ?>"/>
|
245 |
-
|
246 |
-
<div class="clear"></div>
|
247 |
-
<?php
|
248 |
-
if ( ! empty( $test_app_token_response ) && ! empty( $test_app_token_id ) ) {
|
249 |
-
if ( isset( $test_app_token_response->data->is_valid ) || '(#100) You must provide an app access token or a user access token that is an owner or developer of the app' === $test_app_token_response->error->message ) {
|
250 |
-
$fb_id = get_option( 'fts_facebook_instagram_custom_api_token_user_id' );
|
251 |
-
$fb_name = get_option( 'fts_facebook_instagram_custom_api_token_user_name' );
|
252 |
-
echo '<div class="fts-successful-api-token fts-special-working-wrap">';
|
253 |
-
|
254 |
-
if ( ! empty( $fb_id ) && ! empty( $fb_name ) && ! empty( $test_app_token_id ) ) {
|
255 |
-
echo '<a href="' . esc_url( 'https://www.facebook.com/' . get_option( 'fts_facebook_instagram_custom_api_token_user_id' ) ) . '" target="_blank"><img border="0" height="50" width="50" class="fts-fb-page-thumb" src="' . get_option( 'fts_facebook_instagram_custom_api_token_profile_image' ) .'"/></a><h3><a href="' . esc_url( 'https://www.facebook.com/' . get_option( 'fts_facebook_custom_api_token_user_id' ) ) . '" target="_blank">' . wp_kses(
|
256 |
-
$fb_name,
|
257 |
-
array(
|
258 |
-
'span' => array(
|
259 |
-
'class' => array(),
|
260 |
-
)
|
261 |
-
)
|
262 |
-
) . '</a></h3>';
|
263 |
-
}
|
264 |
-
|
265 |
-
echo sprintf(
|
266 |
-
esc_html( 'Your access token is working! Generate your shortcode on the %1$sSettings Page%2$s', 'feed-them-social' ),
|
267 |
-
'<a href="' . esc_url( 'admin.php?page=feed-them-settings-page' . $custom_instagram_link_hash ) . '">',
|
268 |
-
'</a>'
|
269 |
-
);
|
270 |
-
|
271 |
-
echo '</div>';
|
272 |
-
}
|
273 |
-
if ( isset( $test_app_token_response->data->error->message ) && ! empty( $test_app_token_id ) || isset( $test_app_token_response->error->message ) && ! empty( $test_app_token_id ) && '(#100) You must provide an app access token or a user access token that is an owner or developer of the app' !== $test_app_token_response->error->message ) {
|
274 |
-
if ( isset( $test_app_token_response->data->error->message ) ) {
|
275 |
-
echo sprintf(
|
276 |
-
esc_html( '%1$sOh No something\'s wrong. %2$s. Please click the button above to retrieve a new Access Token.%3$s', 'feed-them-social' ),
|
277 |
-
'<div class="fts-failed-api-token">',
|
278 |
-
esc_html( $test_app_token_response->data->error->message ),
|
279 |
-
'</div>'
|
280 |
-
);
|
281 |
-
}
|
282 |
-
if ( isset( $test_app_token_response->error->message ) ) {
|
283 |
-
echo sprintf(
|
284 |
-
esc_html( '%1$sOh No something\'s wrong. %2$s. Please click the button above to retrieve a new Access Token.%3$s', 'feed-them-social' ),
|
285 |
-
'<div class="fts-failed-api-token">',
|
286 |
-
esc_html( $test_app_token_response->error->message ),
|
287 |
-
'</div>'
|
288 |
-
);
|
289 |
-
}
|
290 |
-
|
291 |
-
if ( isset( $test_app_token_response->data->error->message ) && empty( $test_app_token_id ) || isset( $test_app_token_response->error->message ) && empty( $test_app_token_id ) ) {
|
292 |
-
echo sprintf(
|
293 |
-
esc_html( '%1$sTo get started, please click the button above to retrieve your Access Token.%2$s', 'feed-them-social' ),
|
294 |
-
'<div class="fts-failed-api-token get-started-message">',
|
295 |
-
'</div>'
|
296 |
-
);
|
297 |
-
}
|
298 |
-
}
|
299 |
-
} else {
|
300 |
-
if ( ! isset( $_GET['return_long_lived_token'] ) || isset( $_GET['reviews_token'] ) ) {
|
301 |
-
echo sprintf(
|
302 |
-
esc_html( '%1$sTo get started, please click the button above to retrieve your Access Token.%2$s', 'feed-them-social' ),
|
303 |
-
'<div class="fts-failed-api-token get-started-message">',
|
304 |
-
'</div>'
|
305 |
-
);
|
306 |
-
}
|
307 |
-
}
|
308 |
-
?>
|
309 |
-
<div class="clear"></div>
|
310 |
|
311 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
echo do_shortcode( '[fts_fb_page_token]' );
|
317 |
|
318 |
-
|
319 |
-
|
320 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
|
|
|
|
|
|
|
327 |
|
|
|
|
|
|
|
328 |
|
329 |
|
330 |
|
37 |
* @since 1.9.6
|
38 |
*/
|
39 |
public function feed_them_instagram_options_page() {
|
40 |
+
$fts_functions = new feed_them_social_functions();
|
41 |
$fts_instagram_access_token = get_option( 'fts_instagram_custom_api_token' );
|
42 |
$fts_instagram_custom_id = get_option( 'fts_instagram_custom_id' );
|
43 |
$fts_instagram_show_follow_btn = get_option( 'instagram_show_follow_btn' );
|
44 |
$fts_instagram_show_follow_btn_where = get_option( 'instagram_show_follow_btn_where' );
|
45 |
+
$user_id_basic = isset( $_GET['access_token'], $_GET['feed_type'] ) && 'instagram_basic' === $_GET['feed_type'] ? sanitize_text_field( $_GET['user_id'] ) : $fts_instagram_custom_id;
|
46 |
+
$access_token_basic = isset( $_GET['access_token'], $_GET['feed_type'] ) && 'instagram_basic' === $_GET['feed_type'] ? sanitize_text_field( $_GET['access_token'] ) : get_option( 'fts_instagram_custom_api_token' );
|
47 |
+
$access_token = isset( $_GET['access_token'], $_GET['feed_type'] ) && 'original_instagram' === $_GET['feed_type'] ? sanitize_text_field( $_GET['access_token'] ) : $access_token_basic;
|
48 |
|
49 |
if ( isset( $_GET['access_token'] ) ) { ?>
|
50 |
<script>
|
53 |
$('#fts_instagram_custom_api_token').val('');
|
54 |
$('#fts_instagram_custom_api_token').val($('#fts_instagram_custom_api_token').val() + '<?php echo esc_js( $access_token ); ?>');
|
55 |
|
56 |
+
<?php if ( 'original_instagram' === $_GET['feed_type'] ){ ?>
|
57 |
+
$('#fts_instagram_custom_id').val('');
|
58 |
+
var str = '<?php echo esc_js( $access_token ); ?>';
|
59 |
+
$('#fts_instagram_custom_id').val($('#fts_instagram_custom_id').val() + str.split('.', 1));
|
60 |
+
<?php }
|
61 |
+
elseif ( 'instagram_basic' === $_GET['feed_type'] ){ ?>
|
62 |
|
63 |
+
$('#fts_instagram_custom_id').val('');
|
64 |
+
$('#fts_instagram_custom_id').val($('#fts_instagram_custom_id').val() + '<?php echo esc_js( $user_id_basic ); ?>');
|
65 |
+
<?php } ?>
|
66 |
});
|
67 |
</script>
|
68 |
<?php } ?>
|
88 |
settings_fields( 'fts-instagram-feed-style-options' );
|
89 |
?>
|
90 |
<h3>
|
91 |
+
<?php esc_html_e( 'Instagram Basic API Token', 'feed-them-social' ); ?>
|
92 |
</h3>
|
93 |
<?php
|
94 |
|
95 |
|
96 |
+
// $insta_url = esc_url( 'https://api.instagram.com/v1/users/self/?access_token=' . $fts_instagram_access_token );
|
97 |
+
|
98 |
+
$insta_url = esc_url_raw( 'https://graph.instagram.com/me?fields=id,username&access_token=' . $fts_instagram_access_token );
|
99 |
+
|
100 |
// Get Data for Instagram!
|
101 |
$response = wp_remote_fopen( $insta_url );
|
102 |
// Error Check!
|
103 |
$test_app_token_response = json_decode( $response );
|
104 |
+
|
105 |
+
// echo '<pre>';
|
106 |
+
// print_r( $test_app_token_response );
|
107 |
+
// echo '</pre>';
|
108 |
+
|
109 |
?>
|
110 |
<p>
|
111 |
<?php
|
112 |
+
echo esc_html( 'This is required to make the Instagram Feed work. Click the button below and it will connect to your Instagram Account to get an access token. It will then return to this page and save it in the inputs below. After it finishes you will be able to generate your Instagram feed. Instagram Basic connections do not allow you to show Profile info or Heart/Comment counts. Please use the Instagram Business option to achieve that.', 'feed-them-social' );
|
113 |
+
?>
|
114 |
</p>
|
115 |
<p>
|
116 |
<?php
|
117 |
+
|
118 |
+
echo sprintf(
|
119 |
esc_html( '%1$sLogin and get my Access Token%2$s', 'feed-them-social' ),
|
120 |
+
'<a href="' . esc_url( 'https://api.instagram.com/oauth/authorize?app_id=206360940619297&redirect_uri=https://www.slickremix.com/instagram-basic-token/&response_type=code&scope=user_profile,user_media&state=' . admin_url( 'admin.php?page=fts-instagram-feed-styles-submenu-page' ) . '' ) . '" class="fts-instagram-get-access-token">',
|
121 |
'</a>'
|
122 |
);
|
123 |
?>
|
137 |
|
138 |
<div class="feed-them-social-admin-input-wrap">
|
139 |
<div class="feed-them-social-admin-input-label fts-instagram-border-bottom-color-label">
|
140 |
+
<?php
|
141 |
+
esc_html_e( 'Access Token Required', 'feed-them-social' );
|
142 |
|
143 |
+
if ( isset( $_GET['access_token'], $_GET['feed_type'] ) && 'original_instagram' === $_GET['feed_type'] || isset( $_GET['access_token'], $_GET['feed_type'] ) && 'instagram_basic' === $_GET['feed_type'] ) {
|
144 |
+
// START AJAX TO SAVE TOKEN TO DB
|
145 |
$fts_functions->feed_them_instagram_save_token();
|
146 |
+
}
|
147 |
+
?>
|
148 |
</div>
|
149 |
|
150 |
<input type="text" name="fts_instagram_custom_api_token" class="feed-them-social-admin-input" id="fts_instagram_custom_api_token" value="<?php echo esc_attr( $access_token ); ?>"/>
|
151 |
<div class="fts-clear"></div>
|
152 |
</div>
|
153 |
|
154 |
+
<div class="feed-them-social-admin-input-wrap fts-instagram-last-row" style="margin-top: 0; padding-top: 0">
|
155 |
+
<?php
|
156 |
+
// Error Check
|
157 |
+
// 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.
|
158 |
+
if ( is_plugin_active( 'feed-them-social-combined-streams/feed-them-social-combined-streams.php' ) ) {
|
159 |
+
$custom_instagram_link_hash = '';
|
160 |
+
} else {
|
161 |
+
$custom_instagram_link_hash = '#feed_type=instagram';
|
162 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
+
str_replace(".", ".", $fts_instagram_access_token, $count);
|
165 |
|
166 |
+
if( ! empty( $fts_instagram_access_token ) && 0 !== $count ){
|
167 |
echo sprintf(
|
168 |
+
esc_html( '%1$sThe %2$sLegacy API will be depreciated as of March 31st, 2020%3$s in favor of the new Instagram Graph API and the Instagram Basic Display API. Please click the the button above to reconnect your account or you can connect as a Business account below. You must also generate a new shortcode and replace your existing one.%4$s', 'feed-them-social' ),
|
169 |
'<div class="fts-failed-api-token instagram-failed-message">',
|
170 |
+
'<a href="' . esc_url( 'https://www.instagram.com/developer/' ) . '" target="_blank">',
|
171 |
+
'</a>',
|
172 |
'</div>'
|
173 |
);
|
174 |
}
|
175 |
+
elseif ( ! isset( $test_app_token_response->error ) && ! empty( $fts_instagram_access_token ) ) {
|
176 |
+
echo 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 |
+
} elseif ( isset( $test_app_token_response->error ) && ! empty( $fts_instagram_access_token ) ) {
|
183 |
+
$text = isset( $test_app_token_response->error->message ) ? $test_app_token_response->error->message : $test_app_token_response->error->message;
|
184 |
+
echo sprintf(
|
185 |
+
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' ),
|
186 |
+
'<div class="fts-failed-api-token instagram-failed-message">',
|
187 |
+
esc_html( $text ),
|
188 |
+
'</div>'
|
189 |
+
);
|
190 |
+
}
|
191 |
+
|
192 |
+
$feed_type = isset( $_GET['feed_type'] ) ? $_GET['feed_type'] : '';
|
193 |
+
|
194 |
+
if ( empty( $fts_instagram_access_token ) && 'original_instagram' !== $feed_type ) {
|
195 |
+
echo sprintf(
|
196 |
+
esc_html( '%1$sYou are required to get an access token to view your photos.%2$s', 'feed-them-social' ),
|
197 |
+
'<div class="fts-failed-api-token instagram-failed-message">',
|
198 |
+
'</div>'
|
199 |
+
);
|
200 |
+
}
|
201 |
+
?>
|
202 |
+
</div>
|
203 |
<div class="fts-clear"></div>
|
204 |
</div>
|
205 |
|
206 |
|
207 |
|
208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
|
210 |
+
<div id="fb-token-master-wrap" class="feed-them-social-admin-input-wrap" >
|
211 |
+
<div class="fts-title-description-settings-page">
|
212 |
+
<h3>
|
213 |
+
<?php esc_html_e( 'Instagram Business API Token', 'feed-them-social' ); ?>
|
214 |
+
</h3>
|
215 |
+
<?php
|
216 |
+
echo sprintf(
|
217 |
+
esc_html( 'You must have your Instagram Account linked to a Facebook Business Page, this is required to make the Instagram Business Feed or Hashtag Feed work. %1$sRead Instructions%2$s. Once you have completed the instructions you can click the button below and it will connect to your Facebook Account to get an access token. It should return a Facebook page or list of pages you are admin of and display which ones are connected to Instagram. Choose one, then click save. The Instagram Business option will allow you to display your profile info and the Heart/Comment counts on your media.', 'feed-them-social' ),
|
218 |
+
'<a target="_blank" href="' . esc_url( 'https://www.slickremix.com/docs/link-instagram-account-to-facebook/' ) . '">',
|
219 |
+
'</a>'
|
220 |
+
);
|
221 |
+
?>
|
222 |
+
<p>
|
223 |
+
<?php
|
224 |
+
|
225 |
+
// call to get instagram account attached to the facebook page
|
226 |
+
// 1844222799032692 = slicktest fb page (dev user)
|
227 |
+
// 1844222799032692?fields=instagram_business_account&access_token=
|
228 |
+
// This redirect url must have an &state= instead of a ?state= otherwise it will not work proper with the fb app. https://www.slickremix.com/instagram-token/&state=.
|
229 |
+
echo sprintf(
|
230 |
+
esc_html( '%1$sLogin and get my Access Token%2$s', 'feed-them-social' ),
|
231 |
+
'<a href="' . esc_url( 'https://www.facebook.com/dialog/oauth?client_id=1123168491105924&redirect_uri=https://www.slickremix.com/instagram-token/&state=' . admin_url( 'admin.php?page=fts-instagram-feed-styles-submenu-page' ) . '&scope=manage_pages,instagram_basic' ) . '" class="fts-facebook-get-access-token">',
|
232 |
+
'</a>'
|
233 |
+
);
|
234 |
+
?>
|
235 |
+
</p>
|
236 |
+
|
237 |
+
</div>
|
238 |
+
<a href="<?php echo esc_url( 'mailto:support@slickremix.com' ); ?>" target="_blank" class="fts-admin-button-no-work"><?php esc_html_e( 'Button not working?', 'feed-them-social' ); ?></a>
|
239 |
+
<?php
|
240 |
+
$test_app_token_id = get_option( 'fts_facebook_instagram_custom_api_token' );
|
241 |
+
if ( ! empty( $test_app_token_id ) || ! empty( $test_app_token_id_biz ) ) {
|
242 |
|
243 |
+
$test_app_token_url = array(
|
244 |
+
'app_token_id' => 'https://graph.facebook.com/debug_token?input_token=' . $test_app_token_id . '&access_token=' . $test_app_token_id,
|
245 |
+
);
|
|
|
246 |
|
247 |
+
// Test App ID
|
248 |
+
$test_app_token_response = $fts_functions->fts_get_feed_json( $test_app_token_url );
|
249 |
+
$test_app_token_response = json_decode( $test_app_token_response['app_token_id'] );
|
250 |
+
|
251 |
+
// echo '<pre>';
|
252 |
+
// print_r($test_app_token_response);
|
253 |
+
// echo '</pre>';
|
254 |
+
}
|
255 |
+
?>
|
256 |
+
<div class="clear"></div>
|
257 |
+
<div class="feed-them-social-admin-input-wrap fts-fb-token-wrap" id="fts-fb-token-wrap" style="margin-bottom:0px;">
|
258 |
+
<div class="feed-them-social-admin-input-label fts-twitter-border-bottom-color-label">
|
259 |
+
<?php esc_html_e( 'Instagram ID', 'feed-them-social' ); ?>
|
260 |
+
</div>
|
261 |
+
|
262 |
+
<input type="text" name="fts_facebook_instagram_custom_api_token_user_id" class="feed-them-social-admin-input" id="fts_facebook_instagram_custom_api_token_user_id" value="<?php echo esc_attr( get_option( 'fts_facebook_instagram_custom_api_token_user_id' ) ); ?>"/>
|
263 |
+
<div class="clear" style="margin-bottom:10px;"></div>
|
264 |
+
<div class="feed-them-social-admin-input-label fts-twitter-border-bottom-color-label">
|
265 |
+
<?php esc_html_e( 'Access Token Required', 'feed-them-social' ); ?>
|
266 |
+
</div>
|
267 |
+
|
268 |
+
<input type="text" name="fts_facebook_instagram_custom_api_token" class="feed-them-social-admin-input" id="fts_facebook_instagram_custom_api_token" value="<?php echo esc_attr( get_option( 'fts_facebook_instagram_custom_api_token' ) ); ?>"/>
|
269 |
+
<div class="clear"></div>
|
270 |
+
|
271 |
+
<input type="text" hidden name="fts_facebook_instagram_custom_api_token_user_name" class="feed-them-social-admin-input" id="fts_facebook_instagram_custom_api_token_user_name" value="<?php echo esc_attr( get_option( 'fts_facebook_instagram_custom_api_token_user_name' ) ); ?>"/>
|
272 |
+
<input type="text" hidden name="fts_facebook_instagram_custom_api_token_profile_image" class="feed-them-social-admin-input" id="fts_facebook_instagram_custom_api_token_profile_image" value="<?php echo esc_attr( get_option( 'fts_facebook_instagram_custom_api_token_profile_image' ) ); ?>"/>
|
273 |
+
|
274 |
+
<div class="clear"></div>
|
275 |
+
<?php
|
276 |
+
if ( ! empty( $test_app_token_response ) && ! empty( $test_app_token_id ) ) {
|
277 |
+
if ( isset( $test_app_token_response->data->is_valid ) || '(#100) You must provide an app access token or a user access token that is an owner or developer of the app' === $test_app_token_response->error->message ) {
|
278 |
+
$fb_id = get_option( 'fts_facebook_instagram_custom_api_token_user_id' );
|
279 |
+
$fb_name = get_option( 'fts_facebook_instagram_custom_api_token_user_name' );
|
280 |
+
echo '<div class="fts-successful-api-token fts-special-working-wrap">';
|
281 |
+
|
282 |
+
if ( ! empty( $fb_id ) && ! empty( $fb_name ) && ! empty( $test_app_token_id ) ) {
|
283 |
+
echo '<a href="' . esc_url( 'https://www.facebook.com/' . get_option( 'fts_facebook_instagram_custom_api_token_user_id' ) ) . '" target="_blank"><img border="0" height="50" width="50" class="fts-fb-page-thumb" src="' . get_option( 'fts_facebook_instagram_custom_api_token_profile_image' ) . '"/></a><h3><a href="' . esc_url( 'https://www.facebook.com/' . get_option( 'fts_facebook_custom_api_token_user_id' ) ) . '" target="_blank">' . wp_kses(
|
284 |
+
$fb_name,
|
285 |
+
array(
|
286 |
+
'span' => array(
|
287 |
+
'class' => array(),
|
288 |
+
),
|
289 |
+
)
|
290 |
+
) . '</a></h3>';
|
291 |
+
}
|
292 |
+
|
293 |
+
echo sprintf(
|
294 |
+
esc_html( 'Your access token is working! Generate your shortcode on the %1$sSettings Page%2$s', 'feed-them-social' ),
|
295 |
+
'<a href="' . esc_url( 'admin.php?page=feed-them-settings-page' . $custom_instagram_link_hash ) . '">',
|
296 |
+
'</a>'
|
297 |
+
);
|
298 |
+
|
299 |
+
echo '</div>';
|
300 |
+
}
|
301 |
+
if ( isset( $test_app_token_response->data->error->message ) && ! empty( $test_app_token_id ) || isset( $test_app_token_response->error->message ) && ! empty( $test_app_token_id ) && '(#100) You must provide an app access token or a user access token that is an owner or developer of the app' !== $test_app_token_response->error->message ) {
|
302 |
+
if ( isset( $test_app_token_response->data->error->message ) ) {
|
303 |
+
echo sprintf(
|
304 |
+
esc_html( '%1$sOh No something\'s wrong. %2$s. Please click the button above to retrieve a new Access Token.%3$s', 'feed-them-social' ),
|
305 |
+
'<div class="fts-failed-api-token">',
|
306 |
+
esc_html( $test_app_token_response->data->error->message ),
|
307 |
+
'</div>'
|
308 |
+
);
|
309 |
+
}
|
310 |
+
if ( isset( $test_app_token_response->error->message ) ) {
|
311 |
+
echo sprintf(
|
312 |
+
esc_html( '%1$sOh No something\'s wrong. %2$s. Please click the button above to retrieve a new Access Token.%3$s', 'feed-them-social' ),
|
313 |
+
'<div class="fts-failed-api-token">',
|
314 |
+
esc_html( $test_app_token_response->error->message ),
|
315 |
+
'</div>'
|
316 |
+
);
|
317 |
+
}
|
318 |
+
|
319 |
+
if ( isset( $test_app_token_response->data->error->message ) && empty( $test_app_token_id ) || isset( $test_app_token_response->error->message ) && empty( $test_app_token_id ) ) {
|
320 |
+
echo sprintf(
|
321 |
+
esc_html( '%1$sTo get started, please click the button above to retrieve your Access Token.%2$s', 'feed-them-social' ),
|
322 |
+
'<div class="fts-failed-api-token get-started-message">',
|
323 |
+
'</div>'
|
324 |
+
);
|
325 |
+
}
|
326 |
+
}
|
327 |
+
} else {
|
328 |
+
if ( ! isset( $_GET['return_long_lived_token'] ) || isset( $_GET['reviews_token'] ) ) {
|
329 |
+
echo sprintf(
|
330 |
+
esc_html( '%1$sTo get started, please click the button above to retrieve your Access Token.%2$s', 'feed-them-social' ),
|
331 |
+
'<div class="fts-failed-api-token get-started-message">',
|
332 |
+
'</div>'
|
333 |
+
);
|
334 |
+
}
|
335 |
+
}
|
336 |
+
?>
|
337 |
+
<div class="clear"></div>
|
338 |
+
|
339 |
+
<?php
|
340 |
|
341 |
+
if ( isset( $_GET['return_long_lived_token'], $_GET['feed_type'] ) && ! isset( $_GET['reviews_token'] ) && 'instagram_basic' !== $_GET['feed_type'] ) {
|
342 |
+
// Echo our shortcode for the page token list with loadmore button
|
343 |
+
// These functions are on feed-them-functions.php!
|
344 |
+
echo do_shortcode( '[fts_fb_page_token]' );
|
345 |
|
346 |
+
}
|
347 |
+
?>
|
348 |
+
</div>
|
349 |
|
350 |
+
<div class="clear"></div>
|
351 |
+
</div>
|
352 |
+
<!--/fts-facebook-feed-styles-input-wrap-->
|
353 |
|
354 |
|
355 |
|
admin/class-fts-pinterest-options-page.php
CHANGED
@@ -67,7 +67,7 @@ class FTS_Pinterest_Options_Page {
|
|
67 |
<?php
|
68 |
echo sprintf(
|
69 |
esc_html( '%1$sLogin and get my Access Token%2$s', 'feed-them-social' ),
|
70 |
-
'<a href="' . esc_url( 'https://api.pinterest.com/oauth/?response_type=token&redirect_uri=https://www.slickremix.com/pinterest-token-plugin/&client_id=
|
71 |
'</a>'
|
72 |
);
|
73 |
?>
|
67 |
<?php
|
68 |
echo sprintf(
|
69 |
esc_html( '%1$sLogin and get my Access Token%2$s', 'feed-them-social' ),
|
70 |
+
'<a href="' . esc_url( 'https://api.pinterest.com/oauth/?response_type=token&redirect_uri=https://www.slickremix.com/pinterest-token-plugin/&client_id=5063534389122615467&scope=read_public&state=' . admin_url( 'admin.php?page=fts-pinterest-feed-styles-submenu-page' ) ) . '" class="fts-pinterest-get-access-token">',
|
71 |
'</a>'
|
72 |
);
|
73 |
?>
|
admin/class-fts-settings-page-options.php
CHANGED
@@ -439,6 +439,10 @@ class FTS_Settings_Page_Options {
|
|
439 |
// 'short_attr_final' => 'yes',
|
440 |
// Inputs relative to all Feed_types of this feed. (Eliminates Duplication)[Excluded from loop when creating select]
|
441 |
// Twitter Search Name
|
|
|
|
|
|
|
|
|
442 |
array(
|
443 |
'option_type' => 'input',
|
444 |
'input_wrap_class' => 'combine_twitter_hashtag_etc_name',
|
@@ -537,13 +541,17 @@ class FTS_Settings_Page_Options {
|
|
537 |
'name' => 'combine_instagram_type',
|
538 |
'options' => array(
|
539 |
|
540 |
-
//
|
541 |
array(
|
542 |
-
'value' => '
|
543 |
-
'label' => __( '
|
544 |
),
|
545 |
-
|
546 |
-
|
|
|
|
|
|
|
|
|
547 |
array(
|
548 |
'value' => 'hashtag',
|
549 |
'label' => __( 'Hashtag Feed', 'feed-them-social' ),
|
@@ -4388,13 +4396,17 @@ class FTS_Settings_Page_Options {
|
|
4388 |
// Feed Types and their options
|
4389 |
'feeds_types' => array(
|
4390 |
|
4391 |
-
//
|
4392 |
array(
|
4393 |
-
'value' => '
|
4394 |
-
'title' => __( '
|
4395 |
),
|
4396 |
-
|
4397 |
-
|
|
|
|
|
|
|
|
|
4398 |
array(
|
4399 |
'value' => 'hashtag',
|
4400 |
'title' => __( 'Hashtag Feed', 'feed-them-social' ),
|
@@ -4742,13 +4754,13 @@ class FTS_Settings_Page_Options {
|
|
4742 |
'name' => 'instagram-custom-gallery',
|
4743 |
'options' => array(
|
4744 |
1 => array(
|
4745 |
-
'label' => __( '
|
4746 |
'value' => 'yes',
|
4747 |
),
|
4748 |
-
|
4749 |
-
|
4750 |
-
|
4751 |
-
|
4752 |
),
|
4753 |
'short_attr' => array(
|
4754 |
'attr_name' => 'super_gallery',
|
@@ -4871,7 +4883,7 @@ class FTS_Settings_Page_Options {
|
|
4871 |
// Hide Date, Likes and Comments
|
4872 |
array(
|
4873 |
'option_type' => 'select',
|
4874 |
-
'label' => __( 'Date, Heart & Comment icon', 'feed-them-social' ),
|
4875 |
'label_note' => __( 'Good for image sizes under 120px', 'feed-them-social' ),
|
4876 |
'type' => 'text',
|
4877 |
'id' => 'fts-slicker-instagram-container-hide-date-likes-comments',
|
439 |
// 'short_attr_final' => 'yes',
|
440 |
// Inputs relative to all Feed_types of this feed. (Eliminates Duplication)[Excluded from loop when creating select]
|
441 |
// Twitter Search Name
|
442 |
+
|
443 |
+
// MUST ADD TWITTER DIRECTIONS FOR SEARCH
|
444 |
+
|
445 |
+
// If 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. from:user_name%#YourHashtag
|
446 |
array(
|
447 |
'option_type' => 'input',
|
448 |
'input_wrap_class' => 'combine_twitter_hashtag_etc_name',
|
541 |
'name' => 'combine_instagram_type',
|
542 |
'options' => array(
|
543 |
|
544 |
+
// Basic Feed
|
545 |
array(
|
546 |
+
'value' => 'basic',
|
547 |
+
'label' => __( 'Basic Feed', 'feed-them-social' ),
|
548 |
),
|
549 |
+
// Business Feed
|
550 |
+
array(
|
551 |
+
'value' => 'business',
|
552 |
+
'label' => __( 'Business Feed', 'feed-them-social' ),
|
553 |
+
),
|
554 |
+
// Hastag Feed
|
555 |
array(
|
556 |
'value' => 'hashtag',
|
557 |
'label' => __( 'Hashtag Feed', 'feed-them-social' ),
|
4396 |
// Feed Types and their options
|
4397 |
'feeds_types' => array(
|
4398 |
|
4399 |
+
// Basic Feed
|
4400 |
array(
|
4401 |
+
'value' => 'basic',
|
4402 |
+
'title' => __( 'Basic Feed', 'feed-them-social' ),
|
4403 |
),
|
4404 |
+
// Business Feed
|
4405 |
+
array(
|
4406 |
+
'value' => 'business',
|
4407 |
+
'title' => __( 'Business Feed', 'feed-them-social' ),
|
4408 |
+
),
|
4409 |
+
// Hastag Feed
|
4410 |
array(
|
4411 |
'value' => 'hashtag',
|
4412 |
'title' => __( 'Hashtag Feed', 'feed-them-social' ),
|
4754 |
'name' => 'instagram-custom-gallery',
|
4755 |
'options' => array(
|
4756 |
1 => array(
|
4757 |
+
'label' => __( 'Responsive Gallery', 'feed-them-social' ),
|
4758 |
'value' => 'yes',
|
4759 |
),
|
4760 |
+
// 2 => array(
|
4761 |
+
// 'label' => __( 'Classic Gallery Style', 'feed-them-social' ),
|
4762 |
+
// 'value' => 'no',
|
4763 |
+
// ),
|
4764 |
),
|
4765 |
'short_attr' => array(
|
4766 |
'attr_name' => 'super_gallery',
|
4883 |
// Hide Date, Likes and Comments
|
4884 |
array(
|
4885 |
'option_type' => 'select',
|
4886 |
+
'label' => __( 'Date, Heart & Comment icon', 'feed-them-social' ) . '<br/><small>' . __( 'Heart and Comment counts only work when using Feed Type: Business Feed.', 'feed-them-social' ) . '</small>',
|
4887 |
'label_note' => __( 'Good for image sizes under 120px', 'feed-them-social' ),
|
4888 |
'type' => 'text',
|
4889 |
'id' => 'fts-slicker-instagram-container-hide-date-likes-comments',
|
admin/class-fts-settings-page.php
CHANGED
@@ -1007,6 +1007,8 @@ class FTS_Settings_Page {
|
|
1007 |
|
1008 |
var fts_notice_message = '<div class="feed-them-social-admin-input-wrap fts-instagram-hashtag-location-options-message fts-premium-options-message" id="not_active_main_select" style="display: block;"><a class="not-active-title" href="https://www.slickremix.com/instagram-hashtag-and-location-options/" target="_blank"><h3>Hashtag and Location Depreciation Notice</h3></a>The hashtag and location options are being retired for the moment. You can <a target="_blank" href="https://www.slickremix.com/instagram-hashtag-and-location-options/">read more about it here</a>. It appears there is a way to do hashtag calls through the Facebook/Instagram api, so we are looking into making this happen. It is limited in terms of API calls so this may not work for many people. Unfortunately these are the new privacy guide lines set forth by facebook since they own Instagram.<br/><br/>Your Existing Hashtag or Location feeds will work until December 11th, 2018. We will be making an update on the 10th to remove the call so any existing hashtag or location feeds will not display</div>';
|
1009 |
|
|
|
|
|
1010 |
jQuery('#instagram-messages-selector').bind('change', function (e) {
|
1011 |
|
1012 |
if (jQuery('#instagram-messages-selector').val() == 'hashtag') {
|
@@ -1014,17 +1016,17 @@ class FTS_Settings_Page {
|
|
1014 |
|
1015 |
jQuery(".instagram_hashtag, .instagram-hashtag-option-text, .instagram_hashtag_type").show();
|
1016 |
}
|
1017 |
-
else if (jQuery('#instagram-messages-selector').val() == '
|
1018 |
-
|
1019 |
-
|
1020 |
-
jQuery(".
|
1021 |
-
|
1022 |
-
jQuery( ".fts-instagram-shortcode-form").append( fts_notice_message );
|
1023 |
-
}
|
1024 |
-
else {
|
1025 |
-
jQuery(".fts-instagram-hashtag-location-options-message").show();
|
1026 |
-
}
|
1027 |
}
|
|
|
|
|
|
|
|
|
|
|
1028 |
else {
|
1029 |
jQuery(".instagram-id-option-wrap,.instagram-user-option-text,.main-instagram-profile-options-wrap").show();
|
1030 |
jQuery(".instagram-hashtag-option-text,.instagram-location-option-text").hide();
|
@@ -1072,12 +1074,12 @@ class FTS_Settings_Page {
|
|
1072 |
}
|
1073 |
|
1074 |
jQuery('#shortcode-form-selector, #instagram-messages-selector').bind('change', function (e) {
|
1075 |
-
if (jQuery('#instagram-messages-selector').val() == '
|
1076 |
jQuery('#instagram_id, #insta_access_token').val('');
|
1077 |
jQuery('#instagram_id').val(jQuery('#instagram_id').val() + '<?php echo esc_js( get_option( 'fts_instagram_custom_id' ) ); ?>');
|
1078 |
jQuery('#insta_access_token').val(jQuery('#insta_access_token').val() + '<?php echo esc_js( get_option( 'fts_instagram_custom_api_token' ) ); ?>');
|
1079 |
}
|
1080 |
-
else if (jQuery('#instagram-messages-selector').val() == 'hashtag') {
|
1081 |
jQuery('#instagram_id').val('<?php echo esc_js( get_option( 'fts_facebook_instagram_custom_api_token_user_id' ) ); ?>');
|
1082 |
jQuery('#insta_access_token').val('<?php echo esc_js( get_option( 'fts_facebook_instagram_custom_api_token' ) ); ?>');
|
1083 |
}
|
@@ -1138,10 +1140,10 @@ class FTS_Settings_Page {
|
|
1138 |
|
1139 |
jQuery('#combine_instagram, #combine_instagram_type').bind('change', function (e) {
|
1140 |
jQuery('#combine_instagram_name').val('');
|
1141 |
-
if (jQuery('#combine_instagram_type').val() == '
|
1142 |
jQuery('#combine_instagram_name').val(jQuery('#combine_instagram_name').val() + '<?php echo esc_js( get_option( 'fts_instagram_custom_id' ) ); ?>');
|
1143 |
}
|
1144 |
-
else if (jQuery('#combine_instagram_type').val() == 'hashtag') {
|
1145 |
|
1146 |
jQuery('#combine_instagram_name').val('<?php echo esc_js( get_option( 'fts_facebook_instagram_custom_api_token_user_id' ) ); ?>');
|
1147 |
}
|
1007 |
|
1008 |
var fts_notice_message = '<div class="feed-them-social-admin-input-wrap fts-instagram-hashtag-location-options-message fts-premium-options-message" id="not_active_main_select" style="display: block;"><a class="not-active-title" href="https://www.slickremix.com/instagram-hashtag-and-location-options/" target="_blank"><h3>Hashtag and Location Depreciation Notice</h3></a>The hashtag and location options are being retired for the moment. You can <a target="_blank" href="https://www.slickremix.com/instagram-hashtag-and-location-options/">read more about it here</a>. It appears there is a way to do hashtag calls through the Facebook/Instagram api, so we are looking into making this happen. It is limited in terms of API calls so this may not work for many people. Unfortunately these are the new privacy guide lines set forth by facebook since they own Instagram.<br/><br/>Your Existing Hashtag or Location feeds will work until December 11th, 2018. We will be making an update on the 10th to remove the call so any existing hashtag or location feeds will not display</div>';
|
1009 |
|
1010 |
+
jQuery(".main-instagram-profile-options-wrap").hide();
|
1011 |
+
|
1012 |
jQuery('#instagram-messages-selector').bind('change', function (e) {
|
1013 |
|
1014 |
if (jQuery('#instagram-messages-selector').val() == 'hashtag') {
|
1016 |
|
1017 |
jQuery(".instagram_hashtag, .instagram-hashtag-option-text, .instagram_hashtag_type").show();
|
1018 |
}
|
1019 |
+
else if (jQuery('#instagram-messages-selector').val() == 'basic') {
|
1020 |
+
|
1021 |
+
jQuery(".main-instagram-profile-options-wrap").hide();
|
1022 |
+
jQuery(".instagram_hashtag, .instagram_hashtag_type").hide();
|
1023 |
+
|
|
|
|
|
|
|
|
|
|
|
1024 |
}
|
1025 |
+
else if (jQuery('#instagram-messages-selector').val() == 'business') {
|
1026 |
+
|
1027 |
+
jQuery(".instagram_hashtag, .instagram_hashtag_type").hide();
|
1028 |
+
|
1029 |
+
}
|
1030 |
else {
|
1031 |
jQuery(".instagram-id-option-wrap,.instagram-user-option-text,.main-instagram-profile-options-wrap").show();
|
1032 |
jQuery(".instagram-hashtag-option-text,.instagram-location-option-text").hide();
|
1074 |
}
|
1075 |
|
1076 |
jQuery('#shortcode-form-selector, #instagram-messages-selector').bind('change', function (e) {
|
1077 |
+
if (jQuery('#instagram-messages-selector').val() == 'basic') {
|
1078 |
jQuery('#instagram_id, #insta_access_token').val('');
|
1079 |
jQuery('#instagram_id').val(jQuery('#instagram_id').val() + '<?php echo esc_js( get_option( 'fts_instagram_custom_id' ) ); ?>');
|
1080 |
jQuery('#insta_access_token').val(jQuery('#insta_access_token').val() + '<?php echo esc_js( get_option( 'fts_instagram_custom_api_token' ) ); ?>');
|
1081 |
}
|
1082 |
+
else if (jQuery('#instagram-messages-selector').val() == 'hashtag' || jQuery('#instagram-messages-selector').val() == 'business') {
|
1083 |
jQuery('#instagram_id').val('<?php echo esc_js( get_option( 'fts_facebook_instagram_custom_api_token_user_id' ) ); ?>');
|
1084 |
jQuery('#insta_access_token').val('<?php echo esc_js( get_option( 'fts_facebook_instagram_custom_api_token' ) ); ?>');
|
1085 |
}
|
1140 |
|
1141 |
jQuery('#combine_instagram, #combine_instagram_type').bind('change', function (e) {
|
1142 |
jQuery('#combine_instagram_name').val('');
|
1143 |
+
if (jQuery('#combine_instagram_type').val() == 'basic') {
|
1144 |
jQuery('#combine_instagram_name').val(jQuery('#combine_instagram_name').val() + '<?php echo esc_js( get_option( 'fts_instagram_custom_id' ) ); ?>');
|
1145 |
}
|
1146 |
+
else if (jQuery('#combine_instagram_type').val() == 'hashtag' || jQuery('#combine_instagram_type').val() == 'business') {
|
1147 |
|
1148 |
jQuery('#combine_instagram_name').val('<?php echo esc_js( get_option( 'fts_facebook_instagram_custom_api_token_user_id' ) ); ?>');
|
1149 |
}
|
feed-them.php
CHANGED
@@ -7,18 +7,18 @@
|
|
7 |
* Plugin Name: Feed Them Social - for Twitter feed, Youtube, Pinterest and more
|
8 |
* Plugin URI: https://feedthemsocial.com/
|
9 |
* Description: Display a Custom Facebook feed, Instagram feed, Twitter feed, Pinterest feed & YouTube feed on pages, posts or widgets.
|
10 |
-
* Version: 2.8.
|
11 |
* Author: SlickRemix
|
12 |
* Author URI: https://www.slickremix.com/
|
13 |
* Text Domain: feed-them-social
|
14 |
* Domain Path: /languages
|
15 |
* Requires at least: WordPress 4.0.0
|
16 |
* Tested up to: WordPress 5.3.2
|
17 |
-
* Stable tag: 2.8.
|
18 |
* License: GPLv2 or later
|
19 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
20 |
*
|
21 |
-
* @version 2.8.
|
22 |
* @package FeedThemSocial/Core
|
23 |
* @copyright Copyright (c) 2012-2020 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.8.
|
35 |
|
36 |
define( 'FEED_THEM_SOCIAL_NOTICE_STATUS', get_option( 'rating_fts_slick_notice', false ) );
|
37 |
|
7 |
* Plugin Name: Feed Them Social - for Twitter feed, Youtube, Pinterest and more
|
8 |
* Plugin URI: https://feedthemsocial.com/
|
9 |
* Description: Display a Custom Facebook feed, Instagram feed, Twitter feed, Pinterest feed & YouTube feed on pages, posts or widgets.
|
10 |
+
* Version: 2.8.3.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.3.2
|
17 |
+
* Stable tag: 2.8.3.1
|
18 |
* License: GPLv2 or later
|
19 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
20 |
*
|
21 |
+
* @version 2.8.3.1
|
22 |
* @package FeedThemSocial/Core
|
23 |
* @copyright Copyright (c) 2012-2020 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.8.3.1' );
|
35 |
|
36 |
define( 'FEED_THEM_SOCIAL_NOTICE_STATUS', get_option( 'rating_fts_slick_notice', false ) );
|
37 |
|
feeds/instagram/class-fts-instagram-feed.php
CHANGED
@@ -163,7 +163,7 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
|
|
163 |
|
164 |
$instagram_api_children = isset( $post_data->images ) ? $post_data->images->standard_resolution->url : $hashtag_children;
|
165 |
|
166 |
-
$data_type_child = strpos( $hashtag_children, 'mp4' ) ? $post_data->permalink . 'media?size=l' : $instagram_api_children
|
167 |
|
168 |
$hastag_media_url = isset( $post_data->media_url ) ? $post_data->media_url : $data_type_child;
|
169 |
|
@@ -203,15 +203,19 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
|
|
203 |
*/
|
204 |
public function fts_instagram_video_link( $post_data ) {
|
205 |
|
206 |
-
|
|
|
|
|
|
|
207 |
|
208 |
-
|
209 |
|
210 |
-
|
211 |
|
212 |
-
|
|
|
213 |
|
214 |
-
return $
|
215 |
}
|
216 |
|
217 |
/**
|
@@ -358,11 +362,11 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
|
|
358 |
wp_enqueue_script( 'fts-global', plugins_url( 'feed-them-social/feeds/js/fts-global.js' ), array( 'jquery' ), FTS_CURRENT_VERSION, false );
|
359 |
$instagram_data_array = array();
|
360 |
|
361 |
-
$
|
362 |
-
$fts_check_token_type
|
363 |
-
$fts_instagram_access_token
|
364 |
-
$fts_instagram_show_follow_btn
|
365 |
-
$fts_instagram_show_follow_btn_where
|
366 |
if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
|
367 |
$instagram_load_more_text = get_option( 'instagram_load_more_text' ) ? get_option( 'instagram_load_more_text' ) : __( 'Load More', 'feed-them-social' );
|
368 |
$instagram_no_more_photos_text = get_option( 'instagram_no_more_photos_text' ) ? get_option( 'instagram_no_more_photos_text' ) : __( 'No More Photos', 'feed-them-social' );
|
@@ -370,7 +374,6 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
|
|
370 |
|
371 |
// Make sure it's not ajaxing.
|
372 |
if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
|
373 |
-
// $type is the variable coming the shortcode.
|
374 |
$_REQUEST['fts_dynamic_name'] = sanitize_key( $this->fts_rand_string( 10 ) . '_' . $type );
|
375 |
// Create Dynamic Class Name.
|
376 |
$fts_dynamic_class_name = '';
|
@@ -405,7 +408,7 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
|
|
405 |
$cache_hashtag_id_array = 'instagram_cache_' . $instagram_id . '_num' . $pics_count . '_search' . $search . '';
|
406 |
|
407 |
if ( false === $this->fts_check_feed_cache_exists( $cache_hashtag_id_array ) ) {
|
408 |
-
|
409 |
$instagram_hashtag_data_array['data'] = 'https://graph.facebook.com/ig_hashtag_search?user_id=' . $instagram_id . '&q=' . $hashtag . '&access_token=' . $fts_instagram_access_token_final;
|
410 |
|
411 |
$hashtag_response = $this->fts_get_feed_json( $instagram_hashtag_data_array );
|
@@ -441,12 +444,135 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
|
|
441 |
// Now that we have the Instagram ID we can do a search for the endpoint 'Top Media'.
|
442 |
$instagram_data_array['data'] = isset( $_REQUEST['next_url'] ) ? esc_url_raw( $_REQUEST['next_url'] ) : 'https://graph.facebook.com/' . $hashtag_id . '/top_media?user_id=' . $instagram_id . '&fields=media_url,caption,id,comments_count,permalink,like_count,media_type,children{media_url}&limit=' . $pics_count . '&access_token=' . $fts_instagram_access_token_final;
|
443 |
}
|
444 |
-
}
|
445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
|
447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
}
|
449 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
$cache = 'instagram_cache_' . $instagram_id . '_num' . $pics_count . '';
|
451 |
// First we make sure the feed is not cached already before trying to run the Instagram API.
|
452 |
if ( false === $this->fts_check_feed_cache_exists( $cache ) ) {
|
@@ -464,49 +590,63 @@ class FTS_Instagram_Feed extends feed_them_social_functions {
|
|
464 |
}
|
465 |
}
|
466 |
|
467 |
-
|
468 |
-
if (
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
476 |
|
477 |
-
|
478 |
-
$error = $error_check->error_message;
|
479 |
-
} elseif ( isset( $error_check->meta->error_message ) ) {
|
480 |
-
$error = $error_check->meta->error_message;
|
481 |
} else {
|
482 |
-
|
483 |
}
|
484 |
-
|
485 |
-
return esc_html( 'Feed Them Social (Notice visible to Admin only). Instagram returned:', 'feed-them-social' ) . ' ' . $error;
|
486 |
} else {
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
$this->fts_create_feed_cache( $cache, $response );
|
494 |
-
$note = esc_html( 'Not Cached', 'feed-them-social' );
|
495 |
}
|
496 |
}
|
497 |
|
498 |
$instagram_user_info = ! empty( $response['user_info'] ) ? json_decode( $response['user_info'] ) : '';
|
499 |
// URL to get Feeds.
|
500 |
-
if ( '
|
501 |
$username = $instagram_user_info->data->username;
|
502 |
$bio = $instagram_user_info->data->bio;
|
503 |
$profile_picture = $instagram_user_info->data->profile_picture;
|
504 |
$full_name = $instagram_user_info->data->full_name;
|
505 |
$website = $instagram_user_info->data->website;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
506 |
}
|
507 |
|
508 |
if ( current_user_can( 'administrator' ) && 'true' === $debug_userinfo ) {
|
509 |
-
echo '<pre>';
|
510 |
print_r( $instagram_user_info );
|
511 |
echo '</pre>';
|
512 |
}
|
@@ -538,9 +678,9 @@ if ( isset( $profile_name ) && 'yes' === $profile_name ) {
|
|
538 |
|
539 |
<div class="fts-isnta-full-name"><?php echo esc_html( $full_name ); ?></div>
|
540 |
<?php
|
541 |
-
if ( isset( $
|
542 |
echo '<div class="fts-follow-header-wrap">';
|
543 |
-
echo $this->social_follow_button( 'instagram', $
|
544 |
echo '</div>';
|
545 |
}
|
546 |
?>
|
@@ -550,7 +690,8 @@ if ( isset( $profile_name ) && 'yes' === $profile_name ) {
|
|
550 |
// $profile stats comes from the shortcode
|
551 |
if ( 'yes' === $profile_stats ) {
|
552 |
// These need to be in this order to keep the different counts straight since I used either $instagram_likes or $instagram_comments throughout.
|
553 |
-
$
|
|
|
554 |
// here we add a , for all numbers below 9,999.
|
555 |
if ( isset( $number_posted_pics ) && $number_posted_pics <= 9999 ) {
|
556 |
$number_posted_pics = number_format( $number_posted_pics );
|
@@ -564,7 +705,8 @@ if ( 'yes' === $profile_stats ) {
|
|
564 |
$number_posted_pics = round( ( $number_posted_pics / 1000 ), 1 ) . 'k';
|
565 |
}
|
566 |
|
567 |
-
$
|
|
|
568 |
// here we add a , for all numbers below 9,999.
|
569 |
if ( isset( $number_followed_by ) && $number_followed_by <= 9999 ) {
|
570 |
$number_followed_by = number_format( $number_followed_by );
|
@@ -578,7 +720,8 @@ if ( 'yes' === $profile_stats ) {
|
|
578 |
$number_followed_by = round( ( $number_followed_by / 1000 ), 1 ) . 'k';
|
579 |
}
|
580 |
|
581 |
-
$
|
|
|
582 |
// here we add a , for all numbers below 9,999.
|
583 |
if ( isset( $number_follows ) && $number_follows <= 9999 ) {
|
584 |
$number_follows = number_format( $number_follows );
|
@@ -700,8 +843,9 @@ if ( 'yes' === $profile_description ) {
|
|
700 |
|
701 |
// Create Instagram Variables
|
702 |
// tied to date function.
|
703 |
-
$feed_type
|
704 |
-
$
|
|
|
705 |
// call our function to get the date.
|
706 |
$instagram_date = $this->fts_custom_date( $times, $feed_type );
|
707 |
|
@@ -710,8 +854,13 @@ if ( 'yes' === $profile_description ) {
|
|
710 |
$profile_picture = isset( $post_data->user->profile_picture ) ? $post_data->user->profile_picture : '';
|
711 |
$full_name = isset( $post_data->user->full_name ) ? $post_data->user->full_name : '';
|
712 |
$instagram_username = $username;
|
|
|
|
|
|
|
|
|
|
|
|
|
713 |
} else {
|
714 |
-
|
715 |
$instagram_username = $instagram_user_info->data->username;
|
716 |
}
|
717 |
$instagram_caption_a_hashtag_title = isset( $post_data->caption ) ? $post_data->caption : '';
|
@@ -737,10 +886,10 @@ if ( 'yes' === $profile_description ) {
|
|
737 |
if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup ) {
|
738 |
?>
|
739 |
<div class="fts-instagram-popup-profile-wrap">
|
740 |
-
<div class="fts-profile-pic"><?php $user_type = isset( $
|
741 |
<a href="https://www.instagram.com/<?php echo esc_html( $user_type ); ?>" target="_blank">
|
742 |
<?php
|
743 |
-
if ( 'user' === $type ) {
|
744 |
?>
|
745 |
<img src="<?php echo esc_url( $profile_picture ); ?>" title="<?php echo esc_attr( $username ); ?>"/>
|
746 |
<?php
|
@@ -756,6 +905,8 @@ if ( 'yes' === $profile_description ) {
|
|
756 |
<?php
|
757 |
if ( 'user' === $type ) {
|
758 |
echo esc_html( $full_name );
|
|
|
|
|
759 |
} else {
|
760 |
echo esc_html( '#' . $hashtag );
|
761 |
}
|
@@ -764,7 +915,7 @@ if ( 'yes' === $profile_description ) {
|
|
764 |
</div>
|
765 |
|
766 |
<?php
|
767 |
-
if ( isset( $
|
768 |
echo '<div class="fts-follow-header-wrap">';
|
769 |
echo $this->social_follow_button( 'instagram', $instagram_username );
|
770 |
echo '</div>';
|
@@ -785,8 +936,9 @@ if ( 'yes' === $profile_description ) {
|
|
785 |
$data_type = isset( $post_data->type ) ? $post_data->type : $data_type_hashtag;
|
786 |
|
787 |
// Check to see if a video is the first child if children are present
|
788 |
-
$
|
789 |
-
|
|
|
790 |
$child_url = isset( $post_data->children ) ? $post_data->children->data[0]->media_url : $instagram_api_child_url;
|
791 |
$data_type_child = ! empty( $child_url ) && false !== strpos( $child_url, 'mp4' ) ? 'VIDEO' : '';
|
792 |
|
@@ -796,11 +948,11 @@ if ( 'yes' === $profile_description ) {
|
|
796 |
|
797 |
if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup && $data_type_image === $data_type || is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && $data_type_carousel === $data_type && empty( $data_type_child ) ) {
|
798 |
|
799 |
-
|
800 |
|
801 |
} elseif ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && $data_type_video === $data_type || is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && ! empty( $data_type_child ) && 'VIDEO' === $data_type_child ) {
|
802 |
|
803 |
-
|
804 |
print $this->fts_instagram_video_link( $post_data ) ? esc_url( $this->fts_instagram_video_link( $post_data ) ) : esc_url( $post_data->permalink . 'media?size=l' );
|
805 |
|
806 |
} else {
|
@@ -826,28 +978,26 @@ if ( 'yes' === $profile_description ) {
|
|
826 |
// element so we don't have duplicated of the first child. We do this because we need to hide these other links with CSS. We have to have these links here
|
827 |
// because that is how the magnific popup works in order to get to the next image or video.
|
828 |
// NOTE: $post_data->childer is FB/Instagram API, $post_data->carousel_media is OG Instagram API.
|
829 |
-
|
830 |
if ( isset( $post_data->children ) || isset( $post_data->carousel_media ) ) {
|
831 |
|
832 |
-
|
833 |
?>
|
834 |
<div class="fts-carousel-image-wrapper"><div class="fts-carousel-image" ></div></div>
|
835 |
<?php
|
836 |
foreach ( array_slice( $carousel_media, 1 ) as $child ) {
|
837 |
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
$url_images = isset( $child->images->standard_resolution->url ) ? $child->images->standard_resolution->url : '';
|
843 |
$url = isset( $child->videos->standard_resolution->url ) ? $child->videos->standard_resolution->url : $url_images;
|
844 |
-
$url_final
|
845 |
$data_type_video_child = ! empty( $url_final ) && false != strpos( $url_final, 'mp4' ) ? 'video_media' : 'image_media';
|
846 |
?>
|
847 |
<a href='
|
848 |
<?php
|
849 |
if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup && 'image_media' === $data_type_video_child ) {
|
850 |
-
|
851 |
} elseif ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && 'video_media' === $data_type_video_child ) {
|
852 |
print esc_url( $this->fts_instagram_video_link( $child ) );
|
853 |
} else {
|
@@ -909,15 +1059,17 @@ if ( 'yes' === $profile_description ) {
|
|
909 |
// this is already escaping in the function, re escaping will cause errors.
|
910 |
echo $this->fts_share_option( $this->fts_view_on_instagram_url( $post_data ), $this->fts_instagram_description( $post_data ) );
|
911 |
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
|
|
|
|
921 |
</div>
|
922 |
<?php } ?>
|
923 |
</div>
|
@@ -950,9 +1102,9 @@ if ( 'yes' === $profile_description ) {
|
|
950 |
|
951 |
<div class="fts-isnta-full-name"><?php echo esc_attr( $full_name ); ?></div>
|
952 |
<?php
|
953 |
-
if (
|
954 |
echo '<div class="fts-follow-header-wrap">';
|
955 |
-
echo $this->social_follow_button( 'instagram', $
|
956 |
echo '</div>';
|
957 |
}
|
958 |
?>
|
@@ -1012,7 +1164,7 @@ if ( 'yes' === $profile_description ) {
|
|
1012 |
$next_hashtag_url = isset( $insta_data->paging->next ) ? $insta_data->paging->next : '';
|
1013 |
$next_url = isset( $insta_data->pagination->next_url ) ? $insta_data->pagination->next_url : $next_hashtag_url;
|
1014 |
// fb api uses limit for the post count and instagram api uses count.
|
1015 |
-
$the_count = 'hashtag' === $type ? 'limit' : 'count';
|
1016 |
// we check to see if the loadmore count number is set and if so pass that as the new count number when fetching the next set of posts.
|
1017 |
$_REQUEST['next_url'] = '' !== $loadmore_count ? str_replace( "'.$the_count.'=$pics_count", "'.$the_count.'=$loadmore_count", $next_url ) : $next_url;
|
1018 |
$access_token = 'access_token=' . $fts_instagram_access_token_final;
|
163 |
|
164 |
$instagram_api_children = isset( $post_data->images ) ? $post_data->images->standard_resolution->url : $hashtag_children;
|
165 |
|
166 |
+
$data_type_child = strpos( $hashtag_children, 'mp4' ) ? $post_data->permalink . 'media?size=l' : $instagram_api_children;
|
167 |
|
168 |
$hastag_media_url = isset( $post_data->media_url ) ? $post_data->media_url : $data_type_child;
|
169 |
|
203 |
*/
|
204 |
public function fts_instagram_video_link( $post_data ) {
|
205 |
|
206 |
+
if ( isset( $post_data->children ) ) {
|
207 |
+
$video = isset( $post_data->children ) ? $post_data->children->data[0]->media_url : '';
|
208 |
+
} else {
|
209 |
+
$hashtag_children = isset( $post_data->children ) ? $post_data->children->data[0]->media_url : '';
|
210 |
|
211 |
+
$instagram_api_children = isset( $post_data->videos ) ? $post_data->videos->standard_resolution->url : $hashtag_children;
|
212 |
|
213 |
+
$hastag_media_url = isset( $post_data->media_url ) ? $post_data->media_url : $instagram_api_children;
|
214 |
|
215 |
+
$video = isset( $post_data->videos->standard_resolution->url ) ? $post_data->videos->standard_resolution->url : $hastag_media_url;
|
216 |
+
}
|
217 |
|
218 |
+
return $video;
|
219 |
}
|
220 |
|
221 |
/**
|
362 |
wp_enqueue_script( 'fts-global', plugins_url( 'feed-them-social/feeds/js/fts-global.js' ), array( 'jquery' ), FTS_CURRENT_VERSION, false );
|
363 |
$instagram_data_array = array();
|
364 |
|
365 |
+
$fts_business_or_hashtag_check_token_type = '' === $access_token ? get_option( 'fts_facebook_instagram_custom_api_token' ) : $access_token;
|
366 |
+
$fts_check_token_type = '' === $access_token ? get_option( 'fts_instagram_custom_api_token' ) : $access_token;
|
367 |
+
$fts_instagram_access_token = 'hashtag' === $type || 'business' === $type ? $fts_business_or_hashtag_check_token_type : $fts_check_token_type;
|
368 |
+
$fts_instagram_show_follow_btn = get_option( 'instagram_show_follow_btn' );
|
369 |
+
$fts_instagram_show_follow_btn_where = get_option( 'instagram_show_follow_btn_where' );
|
370 |
if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) ) {
|
371 |
$instagram_load_more_text = get_option( 'instagram_load_more_text' ) ? get_option( 'instagram_load_more_text' ) : __( 'Load More', 'feed-them-social' );
|
372 |
$instagram_no_more_photos_text = get_option( 'instagram_no_more_photos_text' ) ? get_option( 'instagram_no_more_photos_text' ) : __( 'No More Photos', 'feed-them-social' );
|
374 |
|
375 |
// Make sure it's not ajaxing.
|
376 |
if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
|
|
|
377 |
$_REQUEST['fts_dynamic_name'] = sanitize_key( $this->fts_rand_string( 10 ) . '_' . $type );
|
378 |
// Create Dynamic Class Name.
|
379 |
$fts_dynamic_class_name = '';
|
408 |
$cache_hashtag_id_array = 'instagram_cache_' . $instagram_id . '_num' . $pics_count . '_search' . $search . '';
|
409 |
|
410 |
if ( false === $this->fts_check_feed_cache_exists( $cache_hashtag_id_array ) ) {
|
411 |
+
// This call is required because users enter a hashtag name, then we have to check the API to see if it exists and if it does return the ID number for that hashtag.
|
412 |
$instagram_hashtag_data_array['data'] = 'https://graph.facebook.com/ig_hashtag_search?user_id=' . $instagram_id . '&q=' . $hashtag . '&access_token=' . $fts_instagram_access_token_final;
|
413 |
|
414 |
$hashtag_response = $this->fts_get_feed_json( $instagram_hashtag_data_array );
|
444 |
// Now that we have the Instagram ID we can do a search for the endpoint 'Top Media'.
|
445 |
$instagram_data_array['data'] = isset( $_REQUEST['next_url'] ) ? esc_url_raw( $_REQUEST['next_url'] ) : 'https://graph.facebook.com/' . $hashtag_id . '/top_media?user_id=' . $instagram_id . '&fields=media_url,caption,id,comments_count,permalink,like_count,media_type,children{media_url}&limit=' . $pics_count . '&access_token=' . $fts_instagram_access_token_final;
|
446 |
}
|
447 |
+
}
|
448 |
+
|
449 |
+
|
450 |
+
|
451 |
+
|
452 |
+
|
453 |
+
|
454 |
+
|
455 |
+
|
456 |
+
|
457 |
+
|
458 |
+
elseif ( 'business' === $type ) {
|
459 |
+
|
460 |
+
$business_cache = 'instagram_business_cache' . $instagram_id . '_num' . $pics_count . '';
|
461 |
+
|
462 |
+
// this is not getting cached currently
|
463 |
+
$instagram_data_array['user_info'] = 'https://graph.facebook.com/v3.2/' . $instagram_id . '?fields=biography%2Cid%2Cig_id%2Cfollowers_count%2Cfollows_count%2Cmedia_count%2Cname%2Cprofile_picture_url%2Cusername%2Cwebsite&access_token=' . $fts_instagram_access_token_final;
|
464 |
|
465 |
+
// This only returns the next url and a list of media ids. We then have to loop through the ids and make a call to get each ids data from the API.
|
466 |
+
$instagram_data_array['data'] = isset( $_REQUEST['next_url'] ) ? esc_url_raw( $_REQUEST['next_url'] ) : 'https://graph.facebook.com/' . $instagram_id . '/media?limit=' . $pics_count . '&access_token=' . $fts_instagram_access_token_final;
|
467 |
+
|
468 |
+
// First we make sure the feed is not cached already before trying to run the Instagram API.
|
469 |
+
if ( false === $this->fts_check_feed_cache_exists( $business_cache ) ) {
|
470 |
+
|
471 |
+
|
472 |
+
$instagram_business_response = $this->fts_get_feed_json( $instagram_data_array );
|
473 |
+
|
474 |
+
$instagram_business = json_decode( $instagram_business_response['data'] );
|
475 |
+
|
476 |
+
// We loop through the media ids from the above $instagram_business_data_array['data'] and request the info for each to create an array we can cache.
|
477 |
+
$instagram_business_output = (object) [ 'data' => [] ];
|
478 |
+
foreach ( $instagram_business->data as $media ) {
|
479 |
+
$media_id = $media->id;
|
480 |
+
$instagram_business_data_array['data'] = 'https://graph.facebook.com/' . $media_id . '?fields=caption,comments_count,like_count,id,media_url,media_type,permalink,thumbnail_url,timestamp,username,children{media_url}&access_token=' . $fts_instagram_access_token_final;
|
481 |
+
$instagram_business_media_response = $this->fts_get_feed_json( $instagram_business_data_array );
|
482 |
+
$instagram_business_media = json_decode( $instagram_business_media_response['data'] );
|
483 |
+
$instagram_business_output->data[] = $instagram_business_media;
|
484 |
+
}
|
485 |
+
$insta_data = (object) array_merge( (array) $instagram_business, (array) $instagram_business_output );
|
486 |
+
|
487 |
+
// echo 'rrrrrrrrrrrr';
|
488 |
+
// echo '<br/><pre>';
|
489 |
+
// print_r( $insta_data );
|
490 |
+
// echo '</pre>';
|
491 |
+
|
492 |
+
if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
|
493 |
+
$this->fts_create_feed_cache( $business_cache, $insta_data );
|
494 |
+
}
|
495 |
+
}
|
496 |
+
|
497 |
+
else {
|
498 |
+
$insta_data = $this->fts_get_feed_cache( $business_cache );
|
499 |
+
|
500 |
+
// echo 'eeeeeeeeeeee';
|
501 |
+
// Used for Testing Only.
|
502 |
+
if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
|
503 |
+
esc_html_e( 'Array Check Cached', 'feed-them-social' );
|
504 |
+
echo '<br/><pre>';
|
505 |
+
print_r( $insta_data );
|
506 |
+
echo '</pre>';
|
507 |
+
}
|
508 |
+
}
|
509 |
}
|
510 |
|
511 |
+
|
512 |
+
|
513 |
+
|
514 |
+
|
515 |
+
|
516 |
+
|
517 |
+
|
518 |
+
|
519 |
+
|
520 |
+
|
521 |
+
|
522 |
+
elseif ( 'basic' === $type ) {
|
523 |
+
// We don't really need this right now, but leaving in case we find a need. This is a call to return basic user data but the only thing worth anything I can
|
524 |
+
// think of right now would be making an option to show the media count. That would need to be a new option, worth adding in a future update. This call is duplicated and used to return info on the instagram options page though.
|
525 |
+
// $instagram_data_array['user_info'] = 'https://graph.instagram.com/me?fields=id,username,media_count,account_type&access_token=' . $fts_instagram_access_token_final;
|
526 |
+
|
527 |
+
$basic_cache = 'instagram_basic_cache' . $instagram_id . '_num' . $pics_count . '';
|
528 |
+
// This only returns the next url and a list of media ids. We then have to loop through the ids and make a call to get each ids data from the API.
|
529 |
+
$instagram_data_array['data'] = isset( $_REQUEST['next_url'] ) ? esc_url_raw( $_REQUEST['next_url'] ) : 'https://graph.instagram.com/' . $instagram_id . '/media?limit=' . $pics_count . '&access_token=' . $fts_instagram_access_token_final;
|
530 |
+
|
531 |
+
// First we make sure the feed is not cached already before trying to run the Instagram API.
|
532 |
+
if ( false === $this->fts_check_feed_cache_exists( $basic_cache ) ) {
|
533 |
+
$instagram_basic_response = $this->fts_get_feed_json( $instagram_data_array );
|
534 |
+
|
535 |
+
$instagram_basic = json_decode( $instagram_basic_response['data'] );
|
536 |
+
|
537 |
+
// We loop through the media ids from the above $instagram_basic_data_array['data'] and request the info for each to create an array we can cache.
|
538 |
+
$instagram_basic_output = (object) [ 'data' => [] ];
|
539 |
+
foreach ( $instagram_basic->data as $media ) {
|
540 |
+
$media_id = $media->id;
|
541 |
+
$instagram_basic_data_array['data'] = 'https://graph.instagram.com/' . $media_id . '?fields=caption,id,media_url,media_type,permalink,thumbnail_url,timestamp,username,children{media_url}&access_token=' . $fts_instagram_access_token_final;
|
542 |
+
$instagram_basic_media_response = $this->fts_get_feed_json( $instagram_basic_data_array );
|
543 |
+
$instagram_basic_media = json_decode( $instagram_basic_media_response['data'] );
|
544 |
+
$instagram_basic_output->data[] = $instagram_basic_media;
|
545 |
+
}
|
546 |
+
|
547 |
+
$insta_data = (object) array_merge( (array) $instagram_basic, (array) $instagram_basic_output );
|
548 |
+
|
549 |
+
|
550 |
+
if ( ! isset( $_GET['load_more_ajaxing'] ) ) {
|
551 |
+
$this->fts_create_feed_cache( $basic_cache, $insta_data );
|
552 |
+
}
|
553 |
+
}
|
554 |
+
|
555 |
+
else {
|
556 |
+
$insta_data = $this->fts_get_feed_cache( $basic_cache );
|
557 |
+
|
558 |
+
// echo 'eeeeeeeeeeee';
|
559 |
+
// Used for Testing Only.
|
560 |
+
if ( current_user_can( 'administrator' ) && 'true' === $debug ) {
|
561 |
+
esc_html_e( 'Array Check Cached', 'feed-them-social' );
|
562 |
+
echo '<br/><pre>';
|
563 |
+
print_r( $insta_data );
|
564 |
+
echo '</pre>';
|
565 |
+
}
|
566 |
+
}
|
567 |
+
|
568 |
+
// echo '<br/>asdfasdfasdf<pre>';
|
569 |
+
// print_r( $insta_data );
|
570 |
+
// echo '</pre>zzzz';
|
571 |
+
// $instagram_data_array['user_info'] = 'https://graph.instagram.com/me?fields=id,username,media_count,account_type&access_token=' . $fts_instagram_access_token_final;
|
572 |
+
}
|
573 |
+
|
574 |
+
|
575 |
+
|
576 |
$cache = 'instagram_cache_' . $instagram_id . '_num' . $pics_count . '';
|
577 |
// First we make sure the feed is not cached already before trying to run the Instagram API.
|
578 |
if ( false === $this->fts_check_feed_cache_exists( $cache ) ) {
|
590 |
}
|
591 |
}
|
592 |
|
593 |
+
//$spencer_testing = 'true';
|
594 |
+
if ( 'hashtag' === $type || 'user' === $type || !isset( $type ) ) {
|
595 |
+
// If the feed is NOT cached then we run the cached array to display the feed.
|
596 |
+
// Legacy API depreciation as of March 31st, 2020. SO we add a check here to by pass the cache and show an error message
|
597 |
+
// letting users know they need to reconnect there account generate a new shortcode.
|
598 |
+
if ( false !== $this->fts_check_feed_cache_exists( $cache ) && ! isset( $_GET['load_more_ajaxing'] ) && 'user' !== $type ) {
|
599 |
+
$response = $this->fts_get_feed_cache( $cache );
|
600 |
+
$insta_data = isset( $type ) && 'basic' === $type || 'business' === $type ? $insta_fb_data : json_decode( $response['data'] );
|
601 |
+
$note = esc_html( 'Cached', 'feed-them-social' );
|
602 |
+
|
603 |
+
} elseif ( isset( $error_check->error_message ) || isset( $error_check->meta->error_message ) || empty( $error_check ) || 'user' === $type || !isset( $type ) ) {
|
604 |
+
// If the Instagram API array returns any error messages we check for them here and return the corresponding error message!
|
605 |
+
if ( current_user_can( 'administrator' ) ) {
|
606 |
+
|
607 |
+
if ( 'user' === $type || !isset( $type ) ) {
|
608 |
+
$error = esc_html( 'The Legacy API is depreciated as of March 31st, 2020 in favor of the new Instagram Graph API and the Instagram Basic Display API. Please go to the Instgram Options page of our plugin and reconnect your account and generate a new shortcode and replace your existing one.', 'feed-them-social' );
|
609 |
+
} elseif ( isset( $error_check->error_message ) ) {
|
610 |
+
$error = $error_check->error_message;
|
611 |
+
} elseif ( isset( $error_check->meta->error_message ) ) {
|
612 |
+
$error = $error_check->meta->error_message;
|
613 |
+
} else {
|
614 |
+
$error = esc_html( 'Please go to the Feed Them > Instagram Options page of our Feed Them Social plugin a double check your Instagram ID matches the one used in your shortcode on this page.', 'feed-them-social' );
|
615 |
+
}
|
616 |
|
617 |
+
return esc_html( 'Feed Them Social (Notice visible to Admin only). Instagram returned:', 'feed-them-social' ) . ' ' . $error;
|
|
|
|
|
|
|
618 |
} else {
|
619 |
+
return;
|
620 |
}
|
|
|
|
|
621 |
} else {
|
622 |
+
$insta_data = json_decode( $response['data'] );
|
623 |
+
// if Error DON'T Cache.
|
624 |
+
if ( ! isset( $error_check->meta->error_message ) && ! isset( $_GET['load_more_ajaxing'] ) || ! isset( $error_check->error_message ) && ! isset( $_GET['load_more_ajaxing'] ) ) {
|
625 |
+
$this->fts_create_feed_cache( $cache, $response );
|
626 |
+
$note = esc_html( 'Not Cached', 'feed-them-social' );
|
627 |
+
}
|
|
|
|
|
628 |
}
|
629 |
}
|
630 |
|
631 |
$instagram_user_info = ! empty( $response['user_info'] ) ? json_decode( $response['user_info'] ) : '';
|
632 |
// URL to get Feeds.
|
633 |
+
if ( 'user' === $type ) {
|
634 |
$username = $instagram_user_info->data->username;
|
635 |
$bio = $instagram_user_info->data->bio;
|
636 |
$profile_picture = $instagram_user_info->data->profile_picture;
|
637 |
$full_name = $instagram_user_info->data->full_name;
|
638 |
$website = $instagram_user_info->data->website;
|
639 |
+
} elseif ( 'business' === $type ) {
|
640 |
+
$username = $instagram_user_info->username;
|
641 |
+
$bio = $instagram_user_info->biography;
|
642 |
+
$profile_picture = $instagram_user_info->profile_picture_url;
|
643 |
+
$full_name = $instagram_user_info->name;
|
644 |
+
$website = $instagram_user_info->website;
|
645 |
+
|
646 |
}
|
647 |
|
648 |
if ( current_user_can( 'administrator' ) && 'true' === $debug_userinfo ) {
|
649 |
+
echo 'aSDasdasDasdaSDa<pre>';
|
650 |
print_r( $instagram_user_info );
|
651 |
echo '</pre>';
|
652 |
}
|
678 |
|
679 |
<div class="fts-isnta-full-name"><?php echo esc_html( $full_name ); ?></div>
|
680 |
<?php
|
681 |
+
if ( isset( $username ) && 'yes' === $fts_instagram_show_follow_btn && 'instagram-follow-above' === $fts_instagram_show_follow_btn_where ) {
|
682 |
echo '<div class="fts-follow-header-wrap">';
|
683 |
+
echo $this->social_follow_button( 'instagram', $username );
|
684 |
echo '</div>';
|
685 |
}
|
686 |
?>
|
690 |
// $profile stats comes from the shortcode
|
691 |
if ( 'yes' === $profile_stats ) {
|
692 |
// These need to be in this order to keep the different counts straight since I used either $instagram_likes or $instagram_comments throughout.
|
693 |
+
$number_posted_pics_fb_api = isset( $instagram_user_info->media_count ) ? $instagram_user_info->media_count : '';
|
694 |
+
$number_posted_pics = isset( $instagram_user_info->data->counts->media ) ? $instagram_user_info->data->counts->media : $number_posted_pics_fb_api;
|
695 |
// here we add a , for all numbers below 9,999.
|
696 |
if ( isset( $number_posted_pics ) && $number_posted_pics <= 9999 ) {
|
697 |
$number_posted_pics = number_format( $number_posted_pics );
|
705 |
$number_posted_pics = round( ( $number_posted_pics / 1000 ), 1 ) . 'k';
|
706 |
}
|
707 |
|
708 |
+
$number_followed_by_fb_api = isset( $instagram_user_info->followers_count ) ? $instagram_user_info->followers_count : '';
|
709 |
+
$number_followed_by = isset( $instagram_user_info->data->counts->followed_by ) ? $instagram_user_info->data->counts->followed_by : $number_followed_by_fb_api;
|
710 |
// here we add a , for all numbers below 9,999.
|
711 |
if ( isset( $number_followed_by ) && $number_followed_by <= 9999 ) {
|
712 |
$number_followed_by = number_format( $number_followed_by );
|
720 |
$number_followed_by = round( ( $number_followed_by / 1000 ), 1 ) . 'k';
|
721 |
}
|
722 |
|
723 |
+
$number_follows_fb_api = isset( $instagram_user_info->follows_count ) ? $instagram_user_info->follows_count : '';
|
724 |
+
$number_follows = isset( $instagram_user_info->data->counts->follows ) ? $instagram_user_info->data->counts->follows : $number_follows_fb_api;
|
725 |
// here we add a , for all numbers below 9,999.
|
726 |
if ( isset( $number_follows ) && $number_follows <= 9999 ) {
|
727 |
$number_follows = number_format( $number_follows );
|
843 |
|
844 |
// Create Instagram Variables
|
845 |
// tied to date function.
|
846 |
+
$feed_type = 'instagram';
|
847 |
+
$fb_api_time = isset( $post_data->timestamp ) ? $post_data->timestamp : '';
|
848 |
+
$times = isset( $post_data->created_time ) ? $post_data->created_time : $fb_api_time;
|
849 |
// call our function to get the date.
|
850 |
$instagram_date = $this->fts_custom_date( $times, $feed_type );
|
851 |
|
854 |
$profile_picture = isset( $post_data->user->profile_picture ) ? $post_data->user->profile_picture : '';
|
855 |
$full_name = isset( $post_data->user->full_name ) ? $post_data->user->full_name : '';
|
856 |
$instagram_username = $username;
|
857 |
+
} elseif ( 'basic' === $type ) {
|
858 |
+
$instagram_username = $post_data->username;
|
859 |
+
$username = $instagram_username;
|
860 |
+
} elseif ( 'business' === $type ) {
|
861 |
+
$instagram_username = $post_data->username;
|
862 |
+
$username = $instagram_username;
|
863 |
} else {
|
|
|
864 |
$instagram_username = $instagram_user_info->data->username;
|
865 |
}
|
866 |
$instagram_caption_a_hashtag_title = isset( $post_data->caption ) ? $post_data->caption : '';
|
886 |
if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup ) {
|
887 |
?>
|
888 |
<div class="fts-instagram-popup-profile-wrap">
|
889 |
+
<div class="fts-profile-pic"><?php $user_type = isset( $type ) && 'hashtag' === $type ? 'explore/tags/' . $hashtag : $username; ?>
|
890 |
<a href="https://www.instagram.com/<?php echo esc_html( $user_type ); ?>" target="_blank">
|
891 |
<?php
|
892 |
+
if ( 'user' === $type || 'business' === $type ) {
|
893 |
?>
|
894 |
<img src="<?php echo esc_url( $profile_picture ); ?>" title="<?php echo esc_attr( $username ); ?>"/>
|
895 |
<?php
|
905 |
<?php
|
906 |
if ( 'user' === $type ) {
|
907 |
echo esc_html( $full_name );
|
908 |
+
} elseif ( 'basic' === $type || 'business' === $type ) {
|
909 |
+
echo esc_html( $instagram_username );
|
910 |
} else {
|
911 |
echo esc_html( '#' . $hashtag );
|
912 |
}
|
915 |
</div>
|
916 |
|
917 |
<?php
|
918 |
+
if ( isset( $instagram_username ) && 'yes' === $fts_instagram_show_follow_btn && 'instagram-follow-above' === $fts_instagram_show_follow_btn_where ) {
|
919 |
echo '<div class="fts-follow-header-wrap">';
|
920 |
echo $this->social_follow_button( 'instagram', $instagram_username );
|
921 |
echo '</div>';
|
936 |
$data_type = isset( $post_data->type ) ? $post_data->type : $data_type_hashtag;
|
937 |
|
938 |
// Check to see if a video is the first child if children are present
|
939 |
+
$instagram_basic_api_child_url = isset( $post_data->children->data[0]->media_url ) ? $post_data->children->data[0]->media_url : '';
|
940 |
+
$instagram_api_child_url = isset( $post_data->carousel_media ) ? $post_data->carousel_media[0]->videos->standard_resolution->url : $instagram_basic_api_child_url;
|
941 |
+
// $child url is the fb/instagram api
|
942 |
$child_url = isset( $post_data->children ) ? $post_data->children->data[0]->media_url : $instagram_api_child_url;
|
943 |
$data_type_child = ! empty( $child_url ) && false !== strpos( $child_url, 'mp4' ) ? 'VIDEO' : '';
|
944 |
|
948 |
|
949 |
if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup && $data_type_image === $data_type || is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && $data_type_carousel === $data_type && empty( $data_type_child ) ) {
|
950 |
|
951 |
+
print esc_url( $this->fts_instagram_image_link( $post_data ) );
|
952 |
|
953 |
} elseif ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && $data_type_video === $data_type || is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && ! empty( $data_type_child ) && 'VIDEO' === $data_type_child ) {
|
954 |
|
955 |
+
// this statement below does not make sense, check later.
|
956 |
print $this->fts_instagram_video_link( $post_data ) ? esc_url( $this->fts_instagram_video_link( $post_data ) ) : esc_url( $post_data->permalink . 'media?size=l' );
|
957 |
|
958 |
} else {
|
978 |
// element so we don't have duplicated of the first child. We do this because we need to hide these other links with CSS. We have to have these links here
|
979 |
// because that is how the magnific popup works in order to get to the next image or video.
|
980 |
// NOTE: $post_data->childer is FB/Instagram API, $post_data->carousel_media is OG Instagram API.
|
|
|
981 |
if ( isset( $post_data->children ) || isset( $post_data->carousel_media ) ) {
|
982 |
|
983 |
+
$carousel_media = isset( $post_data->children ) ? $post_data->children->data : $post_data->carousel_media;
|
984 |
?>
|
985 |
<div class="fts-carousel-image-wrapper"><div class="fts-carousel-image" ></div></div>
|
986 |
<?php
|
987 |
foreach ( array_slice( $carousel_media, 1 ) as $child ) {
|
988 |
|
989 |
+
// echo '<pre style="text-align: left;"> wwwqwqwq';
|
990 |
+
// print_r( $child );
|
991 |
+
// echo '</pre>';
|
992 |
+
$url_images = isset( $child->images->standard_resolution->url ) ? $child->images->standard_resolution->url : '';
|
|
|
993 |
$url = isset( $child->videos->standard_resolution->url ) ? $child->videos->standard_resolution->url : $url_images;
|
994 |
+
$url_final = isset( $child->media_url ) ? $child->media_url : $url;
|
995 |
$data_type_video_child = ! empty( $url_final ) && false != strpos( $url_final, 'mp4' ) ? 'video_media' : 'image_media';
|
996 |
?>
|
997 |
<a href='
|
998 |
<?php
|
999 |
if ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && isset( $popup ) && 'yes' === $popup && 'image_media' === $data_type_video_child ) {
|
1000 |
+
print esc_url( $this->fts_instagram_image_link( $child ) );
|
1001 |
} elseif ( is_plugin_active( 'feed-them-premium/feed-them-premium.php' ) && 'yes' === $popup && 'video_media' === $data_type_video_child ) {
|
1002 |
print esc_url( $this->fts_instagram_video_link( $child ) );
|
1003 |
} else {
|
1059 |
// this is already escaping in the function, re escaping will cause errors.
|
1060 |
echo $this->fts_share_option( $this->fts_view_on_instagram_url( $post_data ), $this->fts_instagram_description( $post_data ) );
|
1061 |
|
1062 |
+
if ( 'basic' !== $type ) {
|
1063 |
+
?>
|
1064 |
+
<div class="fts-instagram-reply-wrap-left">
|
1065 |
+
<ul class='slicker-heart-comments-wrap'>
|
1066 |
+
<li class='slicker-instagram-image-likes'><?php echo esc_html( $this->fts_instagram_likes_count( $post_data ) ); ?> </li>
|
1067 |
+
<li class='slicker-instagram-image-comments'>
|
1068 |
+
<span class="fts-comment-instagram"></span> <?php echo esc_html( $this->fts_instagram_comments_count( $post_data ) ); ?>
|
1069 |
+
</li>
|
1070 |
+
</ul>
|
1071 |
+
</div>
|
1072 |
+
<?php } ?>
|
1073 |
</div>
|
1074 |
<?php } ?>
|
1075 |
</div>
|
1102 |
|
1103 |
<div class="fts-isnta-full-name"><?php echo esc_attr( $full_name ); ?></div>
|
1104 |
<?php
|
1105 |
+
if ( $username && 'yes' === $fts_instagram_show_follow_btn && 'instagram-follow-above' === $fts_instagram_show_follow_btn_where ) {
|
1106 |
echo '<div class="fts-follow-header-wrap">';
|
1107 |
+
echo $this->social_follow_button( 'instagram', $username );
|
1108 |
echo '</div>';
|
1109 |
}
|
1110 |
?>
|
1164 |
$next_hashtag_url = isset( $insta_data->paging->next ) ? $insta_data->paging->next : '';
|
1165 |
$next_url = isset( $insta_data->pagination->next_url ) ? $insta_data->pagination->next_url : $next_hashtag_url;
|
1166 |
// fb api uses limit for the post count and instagram api uses count.
|
1167 |
+
$the_count = 'hashtag' === $type || 'basic' === $type || 'business' === $type ? 'limit' : 'count';
|
1168 |
// we check to see if the loadmore count number is set and if so pass that as the new count number when fetching the next set of posts.
|
1169 |
$_REQUEST['next_url'] = '' !== $loadmore_count ? str_replace( "'.$the_count.'=$pics_count", "'.$the_count.'=$loadmore_count", $next_url ) : $next_url;
|
1170 |
$access_token = 'access_token=' . $fts_instagram_access_token_final;
|
includes/feed-them-functions.php
CHANGED
@@ -116,11 +116,13 @@ class feed_them_social_functions {
|
|
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 |
-
|
124 |
}
|
125 |
}
|
126 |
die;
|
@@ -142,23 +144,32 @@ class feed_them_social_functions {
|
|
142 |
|
143 |
$auth_obj = $_GET['access_token'];
|
144 |
$feed_type = $_GET['feed_type'];
|
|
|
145 |
|
146 |
-
if ( isset( $auth_obj ) && 'original_instagram' === $feed_type ) {
|
147 |
?>
|
148 |
<script>
|
149 |
jQuery(document).ready(function () {
|
150 |
var access_token = '<?php echo sanitize_text_field( $auth_obj ); ?>';
|
|
|
|
|
151 |
jQuery.ajax({
|
152 |
data: {
|
153 |
action: 'fts_instagram_token_ajax',
|
154 |
access_token: access_token,
|
|
|
155 |
},
|
156 |
type: 'POST',
|
157 |
url: ftsAjax.ajaxurl,
|
158 |
success: function (response) {
|
159 |
<?php
|
160 |
$auth_obj = $_GET['access_token'];
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
162 |
// Get Data for Instagram to check for errors
|
163 |
$response = wp_remote_fopen( $insta_url );
|
164 |
$test_app_token_response = json_decode( $response );
|
@@ -199,6 +210,7 @@ class feed_them_social_functions {
|
|
199 |
<?php
|
200 |
}
|
201 |
?>
|
|
|
202 |
}
|
203 |
}); // end of ajax()
|
204 |
return false;
|
116 |
|
117 |
$fts_refresh_token_nonce = wp_create_nonce( 'fts_token_nonce' );
|
118 |
$access_token = $_REQUEST['access_token'];
|
119 |
+
$user_id = $_REQUEST['user_id'];
|
120 |
+
|
121 |
if ( wp_verify_nonce( $fts_refresh_token_nonce, 'fts_token_nonce' ) ) {
|
122 |
if ( isset( $access_token ) ) {
|
123 |
update_option( 'fts_instagram_custom_api_token', sanitize_text_field( $access_token ) );
|
124 |
+
// $insta_id = substr( $access_token, 0, strpos( $access_token, '.' ) );
|
125 |
+
update_option( 'fts_instagram_custom_id', sanitize_text_field( $user_id ) );
|
126 |
}
|
127 |
}
|
128 |
die;
|
144 |
|
145 |
$auth_obj = $_GET['access_token'];
|
146 |
$feed_type = $_GET['feed_type'];
|
147 |
+
$user_id = $_GET['user_id'];
|
148 |
|
149 |
+
if ( isset( $auth_obj ) && 'original_instagram' === $feed_type || isset( $auth_obj ) && 'instagram_basic' === $feed_type ) {
|
150 |
?>
|
151 |
<script>
|
152 |
jQuery(document).ready(function () {
|
153 |
var access_token = '<?php echo sanitize_text_field( $auth_obj ); ?>';
|
154 |
+
var user_id = '<?php echo sanitize_text_field( $user_id ); ?>';
|
155 |
+
|
156 |
jQuery.ajax({
|
157 |
data: {
|
158 |
action: 'fts_instagram_token_ajax',
|
159 |
access_token: access_token,
|
160 |
+
user_id: user_id,
|
161 |
},
|
162 |
type: 'POST',
|
163 |
url: ftsAjax.ajaxurl,
|
164 |
success: function (response) {
|
165 |
<?php
|
166 |
$auth_obj = $_GET['access_token'];
|
167 |
+
if ( 'instagram_basic' === $feed_type ){
|
168 |
+
$insta_url = esc_url_raw( 'https://graph.instagram.com/me?fields=id,username&access_token=' . $auth_obj );
|
169 |
+
}
|
170 |
+
else {
|
171 |
+
$insta_url = esc_url( 'https://api.instagram.com/v1/users/self/?access_token=' . $auth_obj );
|
172 |
+
}
|
173 |
// Get Data for Instagram to check for errors
|
174 |
$response = wp_remote_fopen( $insta_url );
|
175 |
$test_app_token_response = json_decode( $response );
|
210 |
<?php
|
211 |
}
|
212 |
?>
|
213 |
+
console.log( 'success saving instagram access token' );
|
214 |
}
|
215 |
}); // end of ajax()
|
216 |
return false;
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: slickremix, slickchris
|
|
3 |
Tags: Facebook, Instagram, Twitter, YouTube, Feed
|
4 |
Requires at least: 3.6.0
|
5 |
Tested up to: 5.3.2
|
6 |
-
Stable tag: 2.8.
|
7 |
License: GPLv2 or later
|
8 |
|
9 |
Display a Custom Facebook feed, Instagram feed, Twitter feed, Pinterest feed & YouTube feed on pages, posts or widgets.
|
@@ -75,6 +75,9 @@ 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.8.2 Friday, January 17th, 2020 =
|
79 |
* FIXED: Instagram Options & Feed: Premium feature was visible and not working properly. Please upgrade to the premium or combined streams extension to use the hashtag feed.
|
80 |
|
3 |
Tags: Facebook, Instagram, Twitter, YouTube, Feed
|
4 |
Requires at least: 3.6.0
|
5 |
Tested up to: 5.3.2
|
6 |
+
Stable tag: 2.8.3.1
|
7 |
License: GPLv2 or later
|
8 |
|
9 |
Display a Custom Facebook feed, Instagram feed, Twitter feed, Pinterest feed & YouTube feed on pages, posts or widgets.
|
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.8.3.1 Monday, March 30th, 2020 =
|
79 |
+
* NOTICE: Instagram Feed: The Legacy API will be depreciated as of March 31st, 2020 in favor of the new Instagram Graph API and the Instagram Basic Display API. Please click the the button on the Instgram Options page of our plugin to reconnect your account. You must also generate a new shortcode and replace your existing one.
|
80 |
+
|
81 |
= Version 2.8.2 Friday, January 17th, 2020 =
|
82 |
* FIXED: Instagram Options & Feed: Premium feature was visible and not working properly. Please upgrade to the premium or combined streams extension to use the hashtag feed.
|
83 |
|