BlossomThemes Social Feed - Version 1.1.9

Version Description

  • Feature: Posts fetch interval added
  • Improvement: Split the plugin settings page into general and usage template
Download this release

Release Info

Developer blossomthemes
Plugin Icon 128x128 BlossomThemes Social Feed
Version 1.1.9
Comparing to
See all releases

Code changes from version 1.1.8 to 1.1.9

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: instagram, popup, responsive, insta widget
5
  Requires at least: 4.3
6
  Tested up to: 5.2
7
  Requires PHP: 5.6
8
- Stable tag: 1.1.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -66,6 +66,10 @@ If you do not enter the Instagram username in the widget, the username assigned
66
 
67
  == Changelog ==
68
 
 
 
 
 
69
  = 1.1.8 =
70
  * Plugin name renamed due to Instagram Trademark issues
71
  * Minor SEO issues fixed
5
  Requires at least: 4.3
6
  Tested up to: 5.2
7
  Requires PHP: 5.6
8
+ Stable tag: 1.1.9
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
66
 
67
  == Changelog ==
68
 
69
+ = 1.1.9 =
70
+ * Feature: Posts fetch interval added
71
+ * Improvement: Split the plugin settings page into general and usage template
72
+
73
  = 1.1.8 =
74
  * Plugin name renamed due to Instagram Trademark issues
75
  * Minor SEO issues fixed
admin/class-blossomthemes-instagram-feed-admin.php CHANGED
@@ -167,15 +167,33 @@ class Blossomthemes_Instagram_Feed_Admin {
167
  $meta = get_user_meta($user_id, 'blossomthemes_instagram_admin_notice');
168
  $screen = get_current_screen();
169
 
170
- /* Check that the user hasn't already clicked to ignore the message */
171
- if ( !$meta && isset($screen->parent_file) && $screen->parent_file !='class-blossomthemes-instagram-feed-admin.php') {
172
-
173
- echo '<div class="error notice is-dismissible" style="position:relative"><p>';
174
-
175
- echo '<strong>'.'Please configure BlossomThemes Social Feed</strong><br /><br/> If you have just installed or updated this plugin, please go to the <strong><a href="admin.php?page=class-blossomthemes-instagram-feed-admin.php">Settings Page</a> and connect it with your Instagram account.</strong> You can ignore this message if you have already configured it. | '.'<strong><a href="' . esc_url( wp_nonce_url( add_query_arg( 'btif-dismiss', 'dismiss_admin_notices' ), 'confirm=0' ) ) .'" class="dismiss-notice" target="_parent">' . __( 'Dismiss this notice', 'blossomthemes-instagram-feed' ) . '</a></strong>';
176
-
177
- echo "</p></div>";
178
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  }
180
 
181
  function blossomthemes_instagram_feed_ignore_admin_notice() {
@@ -188,5 +206,4 @@ class Blossomthemes_Instagram_Feed_Admin {
188
  update_user_meta($user_id, 'blossomthemes_instagram_admin_notice', 1);
189
  }
190
  }
191
-
192
- }
167
  $meta = get_user_meta($user_id, 'blossomthemes_instagram_admin_notice');
168
  $screen = get_current_screen();
169
 
170
+ // Display invalid access token notice.
171
+ $invalid_access_token = get_option( 'blossomthemes_instagram_invalid_token' );
172
+ if ( $invalid_access_token ): ?>
173
+ <div class="error notice is-dismissible">
174
+ <p>
175
+ <?php _e( 'BlossomThemes: Invalid or expired instagram access token. Please reconnect instagram.', 'blossomthemes-instagram-feed' ); ?>
176
+ </p>
177
+ </div>
178
+
179
+ <?php endif;
180
+
181
+ // Check that the user hasn't already clicked to ignore the message
182
+ if ( empty( $meta ) && isset($screen->parent_file) && $screen->parent_file !=='class-blossomthemes-instagram-feed-admin.php'): ?>
183
+ <div class="error notice is-dismissible" style="position:relative">
184
+ <p>
185
+ <strong><?php _e( 'Please configure BlossomThemes Social Feed', 'blossomthemes-instagram-feed' );?></strong>
186
+ <br /><br/>
187
+ <?php _e( 'If you have just installed or updated this plugin, please go to the', 'blossomthemes-instagram-feed' );?>
188
+ <strong>
189
+ <a href="admin.php?page=class-blossomthemes-instagram-feed-admin.php"><?php _e( 'Settings Page', 'blossomthemes-instagram-feed' );?></a>
190
+ <?php _e( 'and connect it with your Instagram account.', 'blossomthemes-instagram-feed');?>
191
+ </strong> <?php _e( 'You can ignore this message if you have already configured it.', 'blossomthemes-instagram-feed' );?> | <strong>
192
+ <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'btif-dismiss', 'dismiss_admin_notices' ), 'confirm=0' ) ); ?>" class="dismiss-notice" target="_parent"> <?php _e( 'Dismiss this notice', 'blossomthemes-instagram-feed' ); ?> </a>
193
+ </strong>
194
+ </p>
195
+ </div>
196
+ <?php endif;
197
  }
198
 
199
  function blossomthemes_instagram_feed_ignore_admin_notice() {
206
  update_user_meta($user_id, 'blossomthemes_instagram_admin_notice', 1);
207
  }
208
  }
209
+ }
 
blossomthemes-instagram-feed.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: BlossomThemes Social Feed
16
  * Plugin URI: https://wordpress.org/plugins/blossomthemes-instagram-feed
17
  * Description: Show instagram feed on your website using shortcode and widget.
18
- * Version: 1.1.8
19
  * Author: blossomthemes
20
  * Author URI: https://blossomthemes.com
21
  * License: GPL-2.0+
@@ -32,6 +32,17 @@ if ( ! defined( 'WPINC' ) ) {
32
  define( 'BTIF_BASE_PATH', dirname( __FILE__ ) );
33
  define( 'BTIF_FILE_PATH', __FILE__ );
34
  define( 'BTIF_FILE_URL', rtrim( plugin_dir_url( __FILE__ ), '/' ) );
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  /**
37
  * The code that runs during plugin activation.
15
  * Plugin Name: BlossomThemes Social Feed
16
  * Plugin URI: https://wordpress.org/plugins/blossomthemes-instagram-feed
17
  * Description: Show instagram feed on your website using shortcode and widget.
18
+ * Version: 1.1.9
19
  * Author: blossomthemes
20
  * Author URI: https://blossomthemes.com
21
  * License: GPL-2.0+
32
  define( 'BTIF_BASE_PATH', dirname( __FILE__ ) );
33
  define( 'BTIF_FILE_PATH', __FILE__ );
34
  define( 'BTIF_FILE_URL', rtrim( plugin_dir_url( __FILE__ ), '/' ) );
35
+ define( 'BTIF_PLUGIN_VERSION', '1.1.9' );
36
+
37
+ // Instagram API image limit.
38
+ if ( ! defined( 'BTIF_INSTAGRAM_API_IMAGE_LIMIT' ) ) {
39
+ define( 'BTIF_INSTAGRAM_API_IMAGE_LIMIT', 30 );
40
+ }
41
+
42
+ // Instagram media access URL.
43
+ if ( ! defined ( 'BTIF_INSTAGRAM_API_MEDIA_ACCESS_URL' ) ) {
44
+ define( 'BTIF_INSTAGRAM_API_MEDIA_ACCESS_URL', 'https://api.instagram.com/v1/users/self/media/recent/?access_token=%s&count=%s' );
45
+ }
46
 
47
  /**
48
  * The code that runs during plugin activation.
includes/class-blossomthemes-instagram-feed-api.php CHANGED
@@ -27,51 +27,72 @@ class Blossomthemes_Instagram_Feed_API {
27
  }
28
 
29
  protected function __construct() {
30
- $options = get_option( 'blossomthemes_instagram_feed_settings' );
31
- $token = isset ( $options['access-token'] ) ? $options['access-token'] : '';
32
- $this->access_token = $token;
 
 
 
33
  }
34
 
35
  /**
36
- * @param $screen_name string Instagram username
37
- * @param $image_limit int Number of images to retrieve
38
- * @param $image_width int Desired image width to retrieve
39
- *
40
- * @return array|bool Array of tweets or false if method fails
41
  */
42
- public function get_items( $image_limit, $photo_size ) {
43
 
44
- $transient = 'blossomthemes_instagram_is_configured';
 
 
45
 
46
- if ( false !== ( $data = get_transient( $transient ) ) && is_object( $data ) && ! empty( $data->data ) ) {
 
47
 
48
- return $this->processing_response_data( $data, $photo_size, $image_limit );
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
 
51
- $api_image_limit = 30;
52
- $response = wp_remote_get( sprintf( 'https://api.instagram.com/v1/users/self/media/recent/?access_token=%s&count=%s', $this->access_token, $api_image_limit ) );
53
-
54
- if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
55
- set_transient( $transient, false, MINUTE_IN_SECONDS );
56
 
57
- return false;
 
 
 
58
  }
59
 
60
  $data = json_decode( wp_remote_retrieve_body( $response ) );
61
 
62
- if ( ! empty( $data->data ) ) {
63
- set_transient( $transient, $data, 30 * MINUTE_IN_SECONDS );
64
- } else {
65
- set_transient( $transient, false, MINUTE_IN_SECONDS );
66
-
67
  return false;
68
  }
69
 
 
 
 
70
  return $this->processing_response_data( $data, $photo_size, $image_limit );
71
  }
72
 
73
  public function processing_response_data( $data, $photo_size, $image_limit ) {
74
 
 
 
 
 
 
75
  $result = array();
76
  $username = '';
77
 
@@ -90,7 +111,7 @@ class Blossomthemes_Instagram_Feed_API {
90
  'image-url' => $item->images->$photo_size->url,
91
  'likes_count' => ! empty( $item->likes->count ) ? esc_attr( $item->likes->count ) : 0,
92
  'comments_count' => ! empty( $item->comments->count ) ? esc_attr( $item->comments->count ) : 0,
93
- 'caption' => ! empty( $item->caption->text ) ? html_entity_decode( $item->caption->text ) : 'Instagram-Caption',
94
  );
95
  }
96
  $i++;
@@ -115,6 +136,8 @@ class Blossomthemes_Instagram_Feed_API {
115
  return false;
116
  }
117
 
 
 
118
  return true;
119
  }
120
 
@@ -145,14 +168,25 @@ class Blossomthemes_Instagram_Feed_API {
145
  return false;
146
  }
147
 
 
 
 
148
  public static function reset_cache() {
149
  delete_transient( 'blossomthemes_instagram_is_configured' );
150
  }
151
 
 
 
 
152
  public function get_access_token() {
153
  return $this->access_token;
154
  }
155
 
 
 
 
 
 
156
  public function set_access_token( $access_token ) {
157
  $this->access_token = $access_token;
158
  }
27
  }
28
 
29
  protected function __construct() {
30
+ $options = get_option( 'blossomthemes_instagram_feed_settings' );
31
+ $this->access_token = !empty( $options['access-token'] ) ? $options['access-token'] : '';
32
+ $this->username = !empty( $options['username'] ) ? $options['username'] : '';
33
+ $this->pull_duration = !empty( $options['pull_duration'] ) ? $options['pull_duration'] : 1;
34
+ $this->pull_unit = !empty( $options['pull_unit'] ) ? $options['pull_unit'] : 'days';
35
+
36
  }
37
 
38
  /**
39
+ * Calculate posts fetch interval.
 
 
 
 
40
  */
41
+ function get_transient_lifetime() {
42
 
43
+ $values = array( 'minutes' => MINUTE_IN_SECONDS, 'hours' => HOUR_IN_SECONDS, 'days' => DAY_IN_SECONDS );
44
+ $keys = array_keys( $values );
45
+ $type = in_array( $this->pull_unit, $keys ) ? $values[ $this->pull_unit ] : $values['minutes'];
46
 
47
+ return $type * $this->pull_duration;
48
+ }
49
 
50
+ /**
51
+ * @param int $image_limit Number of images to retrieve
52
+ * @param string $photo_size Desired image size to retrieve
53
+ *
54
+ * @return array|bool Array of tweets or false if method fails
55
+ */
56
+ public function get_items( $image_limit, $photo_size ) {
57
+ // Check if the user feed is already fetched.
58
+ $fetch_already = get_transient( 'blossomthemes_instagram_data_fetch' );
59
+ $feed = get_option( 'blossomthemes_instagram_user_feed' );
60
+
61
+ // Return data from cache if the images are already fetched and data is in the cache.
62
+ if ( $fetch_already && ! empty( $feed )) {
63
+ return $this->processing_response_data( $feed, $photo_size, $image_limit );
64
  }
65
 
66
+ // Get the new images if the images are not fetched.
67
+ $response = wp_remote_get( sprintf( BTIF_INSTAGRAM_API_MEDIA_ACCESS_URL, $this->access_token, BTIF_INSTAGRAM_API_IMAGE_LIMIT ) );
 
 
 
68
 
69
+ // Return the images from cache if new images cannot be fetched.
70
+ if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
71
+ update_option( 'blossomthemes_instagram_invalid_token', true, false );
72
+ return $this->processing_response_data( $feed, $photo_size, $image_limit );
73
  }
74
 
75
  $data = json_decode( wp_remote_retrieve_body( $response ) );
76
 
77
+ // Bail if the data is empty.
78
+ if ( empty( $data->data ) ) {
79
+ update_option( 'blossomthemes_instagram_invalid_token', true, false );
 
 
80
  return false;
81
  }
82
 
83
+ // Set the data fetch to true and update the cache with new posts.
84
+ set_transient( 'blossomthemes_instagram_data_fetch', true, $this->get_transient_lifetime() );
85
+ update_option( 'blossomthemes_instagram_user_feed', $data, false );
86
  return $this->processing_response_data( $data, $photo_size, $image_limit );
87
  }
88
 
89
  public function processing_response_data( $data, $photo_size, $image_limit ) {
90
 
91
+ // Bail early if the data is false.
92
+ if ( false === $data ) {
93
+ return false;
94
+ }
95
+
96
  $result = array();
97
  $username = '';
98
 
111
  'image-url' => $item->images->$photo_size->url,
112
  'likes_count' => ! empty( $item->likes->count ) ? esc_attr( $item->likes->count ) : 0,
113
  'comments_count' => ! empty( $item->comments->count ) ? esc_attr( $item->comments->count ) : 0,
114
+ 'caption' => ! empty( $item->caption->text ) ? html_entity_decode( $item->caption->text ) : 'Instagram-Caption',
115
  );
116
  }
117
  $i++;
136
  return false;
137
  }
138
 
139
+ // Set invalid token to false.
140
+ update_option( 'blossomthemes_instagram_invalid_token', false, false );
141
  return true;
142
  }
143
 
168
  return false;
169
  }
170
 
171
+ /**
172
+ * Reset the cache.
173
+ */
174
  public static function reset_cache() {
175
  delete_transient( 'blossomthemes_instagram_is_configured' );
176
  }
177
 
178
+ /**
179
+ * Get access token.
180
+ */
181
  public function get_access_token() {
182
  return $this->access_token;
183
  }
184
 
185
+ /**
186
+ * Set access token.
187
+ *
188
+ * @param string $access_token Instagram access token.
189
+ */
190
  public function set_access_token( $access_token ) {
191
  $this->access_token = $access_token;
192
  }
includes/class-blossomthemes-instagram-feed-settings.php CHANGED
@@ -8,150 +8,88 @@
8
  * @subpackage BlossomThemes_Instagram_Feed/includes
9
  * @author blossomthemes
10
  */
11
- class BlossomThemes_Instagram_Feed_Settings
12
- {
13
- function blossomthemes_instagram_feed_backend_settings()
14
- {
15
- $oauth_url = 'https://instagram.com/oauth/authorize/?client_id=8dc488eba3d54eb9806eb27eabb8cd03&response_type=token&redirect_uri=https://blossomthemes.com/instagram/';
16
- // $oauth_url = 'https://instagram.com/oauth/authorize/?client_id=291228964f8746a9933b6a51c6dcb750&response_type=token&redirect_uri=http://localhost/blossom/wordpress/blossom-insta-check/';
17
- ?>
18
- <div class="btif-wrap">
19
- <?php settings_errors(); ?>
20
- <div class="btif-header">
21
- <h3><?php _e( 'BlossomThemes Social Feed', 'blossomthemes-instagram-feed' ); ?></h3>
22
- </div>
23
- <div class="btif-inner-wrap">
24
- <h2 class="nav-tab-wrapper">
25
- <a href="#" class="btss-tab-trigger nav-tab nav-tab-active" data-configuration="general"><?php _e('General','blossomthemes-instagram-feed');?></a>
26
- <a href="#" class="btss-tab-trigger nav-tab" data-configuration="usage"><?php _e('Usage','blossomthemes-instagram-feed');?></a>
27
- </h2>
28
- <form method="post" action="options.php" class="btif-settings-form">
29
- <?php
30
- $options = get_option( 'blossomthemes_instagram_feed_settings', true );
31
- $size = isset( $options['photo_size'] ) ? esc_attr( $options['photo_size'] ):'low_resolution';
32
- $sizes = array(
33
- 'img_thumb' => 'thumbnail',
34
- 'img_low' => 'low_resolution',
35
- 'img_standard' => 'standard_resolution'
36
- );
37
-
38
- if ( array_key_exists( $size, $sizes ) )
39
- {
40
- foreach ( $sizes as $key => $value )
41
- {
42
- if($size == $key)
43
- $size = $value;
44
- }
45
- }
46
- ?>
47
- <div class="blossomthemes-instagram-feed-settings general" id="blossomthemes-instagram-feed-settings-general">
48
 
49
- <div class="btif-option-field-wrap">
50
-
51
- <h2><?php _e('Connect with Instagram', 'blossomthemes-instagram-feed'); ?></h2>
 
 
52
 
53
- <p><?php _e( 'To get started click the button below. You’ll be prompted to authorize BlossomThemes Social Feed to access your Instagram photos.', 'blossomthemes-instagram-feed' ); ?>
54
- <a href="https://www.youtube.com/watch?v=U4tkwdtgkt0" target="_blank"><?php _e('For help, please refer to this video tutorial.', 'blossomthemes-instagram-feed');?></a>
55
- </p>
 
 
 
56
 
57
- <p class="description"><?php _e( 'Due to recent Instagram API changes it is no longer possible to display photos from a different Instagram account than yours. The widget will automatically display the latest photos of the account which was authorized on this page.', 'blossomthemes-instagram-feed' ); ?></p>
 
 
 
 
 
58
 
59
- <br />
 
 
 
 
60
 
61
- <a class="button button-connect" target="_blank" href="<?php echo esc_url( $oauth_url ); ?>">
62
- <?php if ( ! Blossomthemes_Instagram_Feed_API::getInstance()->is_configured() ) : ?>
63
- <span><?php _e( 'Connect with Instagram', 'blossomthemes-instagram-feed' ); ?></span>
64
- <?php else: ?>
65
- <span class="btif-instagarm-connected"><?php _e( 'Re-connect with Instagram', 'blossomthemes-instagram-feed' ); ?></span>
66
- <?php endif; ?>
67
- </a>
68
 
69
- <p><label for="blossomthemes_instagram_feed_settings[access-token]"><?php _e('Access Token', 'blossomthemes-instagram-feed'); ?></label>
70
- <input class="" id="blossomthemes_instagram_feed_settings[access-token]" name="blossomthemes_instagram_feed_settings[access-token]" type="text" value="<?php echo isset( $options['access-token'] ) ? esc_attr( $options['access-token'] ):''; ?>"></p>
71
 
72
- <p class="btif-description">
73
- <?php
74
- _e('Access Token is used as key to access your photos from Instagram so they can be displayed.', 'blossomthemes-instagram-feed');
75
- ?>
76
- </p>
 
 
 
 
77
 
78
- </div>
 
 
 
 
 
 
 
 
 
 
 
79
 
80
- <div class="btif-option-field-wrap">
81
- <label for="blossomthemes_instagram_feed_settings[username]"><?php _e('Username', 'blossomthemes-instagram-feed'); ?></label>
82
- <input id="blossomthemes_instagram_feed_settings[username]" name="blossomthemes_instagram_feed_settings[username]" type="text" value="<?php echo isset( $options['username'] ) ? esc_attr( $options['username'] ):''; ?>">
83
- </div>
84
 
85
- <div class="btif-option-field-wrap">
86
- <label for="blossomthemes_instagram_feed_settings[photos]"><?php _e('Number of Photos', 'blossomthemes-instagram-feed'); ?></label>
87
- <input min="1" max="20" id="blossomthemes_instagram_feed_settings[photos]" name="blossomthemes_instagram_feed_settings[photos]" type="number" value="<?php echo isset( $options['photos'] ) ? esc_attr( $options['photos'] ):'10'; ?>">
88
- </div>
89
- <div class="btif-option-field-wrap">
90
- <label for="blossomthemes_instagram_feed_settings[photo_size]"><?php esc_html_e( 'Photo size', 'blossomthemes-instagram-feed' ); ?></label>
91
- <select id="blossomthemes_instagram_feed_settings[photo_size]" name="blossomthemes_instagram_feed_settings[photo_size]">
92
- <option value="thumbnail" <?php selected( 'thumbnail', $size ) ?>><?php esc_html_e( 'Thumbnail', 'blossomthemes-instagram-feed' ); ?></option>
93
- <option value="low_resolution" <?php selected( 'low_resolution', $size ) ?>><?php esc_html_e( 'Small', 'blossomthemes-instagram-feed' ); ?></option>
94
- <option value="standard_resolution" <?php selected( 'standard_resolution', $size ) ?>><?php esc_html_e( 'Large', 'blossomthemes-instagram-feed' ); ?></option>
95
- </select>
96
- </div>
97
- <div class="btif-option-field-wrap">
98
- <label for="blossomthemes_instagram_feed_settings[photos_row]"><?php _e('Photos Per Row', 'blossomthemes-instagram-feed'); ?></label>
99
- <input min="1" max="20" id="blossomthemes_instagram_feed_settings[photos_row]" name="blossomthemes_instagram_feed_settings[photos_row]" type="number" value="<?php echo isset( $options['photos_row'] ) ? esc_attr( $options['photos_row'] ):'5'; ?>">
100
- </div>
101
- <div class="btif-option-field-wrap">
102
- <label for="blossomthemes_instagram_feed_settings[follow_me]"><?php _e('Profile Link Text', 'blossomthemes-instagram-feed'); ?></label>
103
- <input id="blossomthemes_instagram_feed_settings[follow_me]" name="blossomthemes_instagram_feed_settings[follow_me]" type="text" value="<?php echo isset( $options['follow_me'] ) ? esc_attr( $options['follow_me'] ):'Follow Me!'; ?>">
104
- </div>
105
- <div class="btif-option-field-wrap">
106
- <label for="likes-comments"><?php _e( 'Show Likes/Comments', 'blossomthemes-instagram-feed' ); ?></label>
107
- <input type="checkbox" value="1" id="likes-comments" name="blossomthemes_instagram_feed_settings[meta]" <?php
108
- if ( isset( $options['meta'] ) ) {
109
- checked( $options['meta'], true );
110
- }
111
- ?>>
112
- </div>
113
- </div>
114
- <div class="blossomthemes-instagram-feed-settings usage" id="blossomthemes-instagram-feed-settings-usage">
115
- <?php $custom_id = get_the_ID(); ?>
116
- <h4><?php _e( 'Uses', 'blossomthemes-instagram-feed' ); ?></h4>
117
- <div class="wp-tm-settings-wrapper">
118
- <h4 class="wp-tm-setting-title"><?php _e('Display via Shortcode','blossomthemes-instagram-feed');?></h4>
119
- <div class="wp-tm--option-wrapper">
120
- <div class="wp-tm-option-field">
121
- <label class="wp-tm-plain-label">
122
- <div class="tm-option-side-note"> <?php _e('Copy this Shortcode to display your instagram gallery in pages/posts => ', 'blossomthemes-instagram-feed') ?><br>
123
- <input type="text" readonly="readonly" class="shortcode-usage" value="[blossomthemes_instagram_feed]" onClick="this.setSelectionRange(0, this.value.length)">
124
- </div>
125
- </label>
126
- </div>
127
- </div>
128
- <h4 class="wp-tm-setting-title"><?php _e('Display via PHP Function','blossomthemes-instagram-feed');?></h4>
129
- <div class="wp-tm--option-wrapper">
130
- <div class="wp-tm-option-field">
131
- <label class="wp-tm-plain-label">
132
- <div class="tm-option-side-note"> <?php _e('Copy the PHP Function below to display your instagram gallery in templates :', 'blossomthemes-instagram-feed') ?> <br>
133
- <textarea rows="2" cols="50" readonly="readonly" onClick="this.setSelectionRange(0, this.value.length)">&lt;?php echo do_shortcode("[blossomthemes_instagram_feed]"); ?&gt; </textarea>
134
- </div>
135
- </label>
136
 
137
- </div>
138
- </div>
139
- </div>
140
- </div>
141
- <?php $nonce = wp_create_nonce( 'blossomthemes-instagram-feed-nonce' ); ?>
142
- <input type="hidden" name="blossomthemes-instagram-feed-nonce" value="<?php echo $nonce; ?>">
143
- <div class="blossomthemes-instagram-feed-settings-submit">
144
- <?php
145
- settings_fields( 'blossomthemes_instagram_feed_settings' );
146
- do_settings_sections( __FILE__ );
147
- echo submit_button();
148
- ?>
149
- </div>
150
- </form>
151
- </div>
152
- <?php include(BTIF_BASE_PATH . '/includes/template/backend/sidebar.php'); ?>
153
- </div>
154
- <?php
155
  }
156
  }
157
  new BlossomThemes_Instagram_Feed_Settings;
8
  * @subpackage BlossomThemes_Instagram_Feed/includes
9
  * @author blossomthemes
10
  */
11
+ class BlossomThemes_Instagram_Feed_Settings {
12
+ /**
13
+ * Instagram 0auth URL.
14
+ * @var string $auth_url Instagram Oauth URL with callback.
15
+ */
16
+ private $oauth_url = 'https://instagram.com/oauth/authorize/?client_id=8dc488eba3d54eb9806eb27eabb8cd03&response_type=token&redirect_uri=https://blossomthemes.com/instagram/';
17
+ /**
18
+ * Map of old instagram image size to new image size.
19
+ *
20
+ * @var array $photo_sizes Map of old instagram image to new image size.
21
+ */
22
+ private $photo_sizes = array(
23
+ 'img_thumb' => 'thumbnail',
24
+ 'img_low' => 'low_resolution',
25
+ 'img_standard' => 'standard_resolution'
26
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
+ public function __construct() {
29
+ add_action( 'btif_settings_general_tab_content', array( $this, 'btif_settings_general_tab_content' ) );
30
+ add_action( 'btif_settings_usage_tab_content', array( $this, 'btif_settings_usage_tab_content' ) );
31
+ add_action( 'btif_settings_sidebar', array( $this, 'btif_settings_sidebar' ) );
32
+ }
33
 
34
+ /**
35
+ * Include settings sidebar.
36
+ */
37
+ public function btif_settings_sidebar() {
38
+ require_once BTIF_BASE_PATH . '/includes/template/backend/sidebar.php';
39
+ }
40
 
41
+ /**
42
+ * Include the settings usage tab content template.
43
+ */
44
+ public function btif_settings_usage_tab_content() {
45
+ require_once BTIF_BASE_PATH . '/includes/template/backend/usage.php';
46
+ }
47
 
48
+ /**
49
+ * Include the settings general tab content template.
50
+ */
51
+ public function btif_settings_general_tab_content() {
52
+ // $oauth_url = 'https://instagram.com/oauth/authorize/?client_id=291228964f8746a9933b6a51c6dcb750&response_type=token&redirect_uri=http://localhost/blossom/wordpress/blossom-insta-check/';
53
 
54
+ // Authorize URL with client site redirect link
55
+ $oauth_url = $this->oauth_url;
56
+ $oauth_url .= '?auth_site=' . esc_url( admin_url( 'admin.php?page=class-blossomthemes-instagram-feed-admin.php' ) );
57
+ $oauth_url.='&hl=en';
 
 
 
58
 
59
+ $options = get_option( 'blossomthemes_instagram_feed_settings', true );
60
+ $photo_size = isset( $options['photo_size'] ) ? esc_attr( $options['photo_size'] ) : 'low_resolution';
61
 
62
+ // Changed to the new instagram image size.
63
+ if ( array_key_exists( $photo_size, $this->photo_sizes ) ) {
64
+ $photo_size = $this->photo_sizes[ $photo_size ];
65
+ }
66
+
67
+ // Override options Access Token if received new access token by POST method
68
+ if ( isset( $_POST['access_token'] ) ) {
69
+ $options['access-token'] = $_POST['access_token'];
70
+ }
71
 
72
+ // Prepare array to be passed to the template.
73
+ $args = array(
74
+ 'oauth_url' => $oauth_url,
75
+ 'access_token' => isset( $options['access-token'] ) ? $options['access-token'] : '',
76
+ 'username' => isset( $options['username'] ) ? $options['username'] : '',
77
+ 'photos' => isset( $options['photos'] ) ? $options['photos'] : '',
78
+ 'size' => $photo_size,
79
+ 'photos_row' => isset( $options['photos_row'] ) ? $options['photos_row'] : '',
80
+ 'follow_me' => isset( $options['follow_me'] ) ? $options['follow_me'] : '',
81
+ 'pull_duration' => isset( $options['pull_duration'] ) ? $options['pull_duration'] : 1,
82
+ 'pull_unit' => isset( $options['pull_unit'] ) ? $options['pull_unit'] : 'days'
83
+ );
84
 
85
+ // Extrat the variables from the array.
86
+ extract( $args );
 
 
87
 
88
+ require_once BTIF_BASE_PATH . '/includes/template/backend/general.php';
89
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
+ function blossomthemes_instagram_feed_backend_settings() {
92
+ require_once BTIF_BASE_PATH . '/includes/template/backend/settings.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  }
94
  }
95
  new BlossomThemes_Instagram_Feed_Settings;
includes/class-blossomthemes-instagram-feed-shortcodes.php CHANGED
@@ -24,80 +24,78 @@ class BlossomThemes_Instagram_Feed_Shortcodes
24
  $instaUrl .= $options['username'];
25
  $profile_link_text = isset( $options['follow_me'] ) ? esc_attr( $options['follow_me'] ):'Follow Me!';
26
 
27
- if ( Blossomthemes_Instagram_Feed_API::getInstance()->is_configured() ) :
28
 
29
- $this->api = Blossomthemes_Instagram_Feed_API::getInstance();
30
 
31
- $items = $this->api->get_items( $photos, $photo_size );
32
-
33
- if ( ! is_array( $items ) ) {
 
 
 
 
 
34
  echo '<b style="color:red;">'.__('No posts available!','blossomthemes-instagram-feed').'</b>';
35
- } else {
 
36
 
37
- $count = 0;
38
- ?>
39
- <ul class="popup-gallery photos-<?php echo $photos_row;?>">
40
 
41
- <?php foreach ( $items['items'] as $item ) : ?>
42
- <?php
43
- $link = $item['link'];
44
- $img_standard = $item['image-standard'];
45
- $src = $item['image-url'];
46
- $likes = $item['likes_count'];
47
- $comments = $item['comments_count'];
48
- $caption = $item['caption'];
49
- ?>
50
 
51
- <li>
52
 
53
- <a href="<?php echo esc_url($img_standard); ?>">
54
- <img src="<?php echo esc_url($src); ?>" alt="<?php echo html_entity_decode($caption); ?>">
55
- </a>
56
- <?php if( isset( $options['meta'] ) )
57
- {
58
- echo '<div class="instagram-meta"><span class="like"><i class="fa fa-heart"></i>'.$likes.'</span>'.'<span class="comment"><i class="fa fa-comment"></i>'.$comments.'</span>'.'</div>';
59
- }?>
60
- </li>
61
 
62
- <?php if ( ++$count === $photos ) break; ?>
63
 
64
- <?php endforeach; ?>
65
 
66
- </ul>
67
- <?php echo
68
- '<script>
69
- jQuery(document).ready(function($){
70
- $(".popup-gallery").magnificPopup({
71
- delegate: "a",
72
- type: "image",
73
- gallery:{
74
- enabled:true
75
- }
76
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
- $(".popup-modal").magnificPopup({
79
- type: "inline",
80
- preloader: false,
81
- focus: "#username",
82
- modal: true
83
- });
84
- $(document).on("click", ".popup-modal-dismiss", function (e) {
85
- e.preventDefault();
86
- $.magnificPopup.close();
87
- });
88
- });
89
- </script>';
90
- echo ' <a class="profile-link" href="'.esc_url($instaUrl).'" target="_blank" rel="noreferrer"><span class="insta-icon"><i class="fab fa-instagram"></i></span>'.esc_attr($profile_link_text).'</a>';
91
- }
92
- else:
93
- if ( current_user_can( 'edit_theme_options' ) ) {
94
- ?>
95
- <p>
96
- <?php _e( 'BlossomThemes Social Feed misconfigured, check plugin &amp; widget settings.', 'blossomthemes-instagram-feed' ); ?>
97
- </p>
98
- <?php
99
- }
100
- endif;
101
  $output = ob_get_contents();
102
  ob_end_clean();
103
  return $output;
24
  $instaUrl .= $options['username'];
25
  $profile_link_text = isset( $options['follow_me'] ) ? esc_attr( $options['follow_me'] ):'Follow Me!';
26
 
27
+ $this->api = Blossomthemes_Instagram_Feed_API::getInstance();
28
 
29
+ $items = $this->api->get_items( $photos, $photo_size );
30
 
31
+ if ( ! is_array( $items ) ) {
32
+ if ( current_user_can( 'edit_theme_options' ) ) {
33
+ ?>
34
+ <p>
35
+ <?php _e( 'BlossomThemes Social Feed misconfigured, check plugin &amp; widget settings.', 'blossomthemes-instagram-feed' ); ?>
36
+ </p>
37
+ <?php
38
+ } else {
39
  echo '<b style="color:red;">'.__('No posts available!','blossomthemes-instagram-feed').'</b>';
40
+ }
41
+ } else {
42
 
43
+ $count = 0;
44
+ ?>
45
+ <ul class="popup-gallery photos-<?php echo $photos_row;?>">
46
 
47
+ <?php foreach ( $items['items'] as $item ) : ?>
48
+ <?php
49
+ $link = $item['link'];
50
+ $img_standard = $item['image-standard'];
51
+ $src = $item['image-url'];
52
+ $likes = $item['likes_count'];
53
+ $comments = $item['comments_count'];
54
+ $caption = $item['caption'];
55
+ ?>
56
 
57
+ <li>
58
 
59
+ <a href="<?php echo esc_url($img_standard); ?>">
60
+ <img src="<?php echo esc_url($src); ?>" alt="<?php echo html_entity_decode($caption); ?>">
61
+ </a>
62
+ <?php if( isset( $options['meta'] ) )
63
+ {
64
+ echo '<div class="instagram-meta"><span class="like"><i class="fa fa-heart"></i>'.$likes.'</span>'.'<span class="comment"><i class="fa fa-comment"></i>'.$comments.'</span>'.'</div>';
65
+ }?>
66
+ </li>
67
 
68
+ <?php if ( ++$count === $photos ) break; ?>
69
 
70
+ <?php endforeach; ?>
71
 
72
+ </ul>
73
+ <?php echo
74
+ '<script>
75
+ jQuery(document).ready(function($){
76
+ $(".popup-gallery").magnificPopup({
77
+ delegate: "a",
78
+ type: "image",
79
+ gallery:{
80
+ enabled:true
81
+ }
82
+ });
83
+
84
+ $(".popup-modal").magnificPopup({
85
+ type: "inline",
86
+ preloader: false,
87
+ focus: "#username",
88
+ modal: true
89
+ });
90
+ $(document).on("click", ".popup-modal-dismiss", function (e) {
91
+ e.preventDefault();
92
+ $.magnificPopup.close();
93
+ });
94
+ });
95
+ </script>';
96
+ echo ' <a class="profile-link" href="'.esc_url($instaUrl).'" target="_blank" rel="noreferrer"><span class="insta-icon"><i class="fab fa-instagram"></i></span>'.esc_attr($profile_link_text).'</a>';
97
+ }
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  $output = ob_get_contents();
100
  ob_end_clean();
101
  return $output;
includes/class-blossomthemes-instagram-feed.php CHANGED
@@ -67,8 +67,8 @@ class Blossomthemes_Instagram_Feed {
67
  * @since 1.0.0
68
  */
69
  public function __construct() {
70
- if ( defined( 'PLUGIN_VERSION' ) ) {
71
- $this->version = PLUGIN_VERSION;
72
  } else {
73
  $this->version = '1.0.0';
74
  }
@@ -197,6 +197,7 @@ class Blossomthemes_Instagram_Feed {
197
 
198
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
199
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
 
200
 
201
  }
202
 
67
  * @since 1.0.0
68
  */
69
  public function __construct() {
70
+ if ( defined( 'BTIF_PLUGIN_VERSION' ) ) {
71
+ $this->version = BTIF_PLUGIN_VERSION;
72
  } else {
73
  $this->version = '1.0.0';
74
  }
197
 
198
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
199
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
200
+ $this->loader->add_filter( 'script_loader_tag', $plugin_public, 'btif_js_defer_files', 10 );
201
 
202
  }
203
 
includes/template/backend/general.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Settings general tab content template.
4
+ */
5
+ ?>
6
+ <div class="blossomthemes-instagram-feed-settings general" id="blossomthemes-instagram-feed-settings-general">
7
+ <div class="btif-option-field-wrap">
8
+ <h2><?php _e('Connect with Instagram', 'blossomthemes-instagram-feed'); ?></h2>
9
+ <p>
10
+ <?php _e( 'To get started click the button below. You’ll be prompted to authorize BlossomThemes Social Feed to access your Instagram photos.', 'blossomthemes-instagram-feed' ); ?>
11
+ <a href="https://www.youtube.com/watch?v=U4tkwdtgkt0" target="_blank">
12
+ <?php _e('For help, please refer to this video tutorial.', 'blossomthemes-instagram-feed');?>
13
+ </a>
14
+ </p>
15
+
16
+ <p class="description">
17
+ <?php _e( 'Due to recent Instagram API changes it is no longer possible to display photos from a different Instagram account than yours. The widget will automatically display the latest photos of the account which was authorized on this page.', 'blossomthemes-instagram-feed' ); ?>
18
+ </p>
19
+
20
+ <br />
21
+
22
+ <!-- Connect with Instagram button -->
23
+ <a class="button button-connect" target="_blank" href="<?php echo esc_url( $oauth_url ); ?>">
24
+ <?php if ( ! Blossomthemes_Instagram_Feed_API::getInstance()->is_configured() ) : ?>
25
+ <span><?php _e( 'Connect with Instagram', 'blossomthemes-instagram-feed' ); ?></span>
26
+ <?php else: ?>
27
+ <span class="btif-instagarm-connected"><?php _e( 'Re-connect with Instagram', 'blossomthemes-instagram-feed' ); ?></span>
28
+ <?php endif; ?>
29
+ </a>
30
+ <!-- ./ Connect with Instagram button -->
31
+
32
+ <!-- Access token input -->
33
+ <p>
34
+ <label for="blossomthemes_instagram_feed_settings[access-token]">
35
+ <?php _e('Access Token', 'blossomthemes-instagram-feed'); ?>
36
+ </label>
37
+ <input class="" id="blossomthemes_instagram_feed_settings[access-token]"
38
+ name="blossomthemes_instagram_feed_settings[access-token]" type="text"
39
+ value="<?php echo esc_attr( $access_token ); ?>" />
40
+ </p>
41
+ <!-- ./ Access token input -->
42
+
43
+ <p class="btif-description">
44
+ <?php _e( 'Access Token is used as key to access your photos from Instagram so they can be displayed.', 'blossomthemes-instagram-feed' ); ?>
45
+ </p>
46
+ </div>
47
+
48
+ <!-- Username input -->
49
+ <div class="btif-option-field-wrap">
50
+ <label for="blossomthemes_instagram_feed_settings[username]">
51
+ <?php _e('Username', 'blossomthemes-instagram-feed'); ?>
52
+ </label>
53
+ <input id="blossomthemes_instagram_feed_settings[username]"
54
+ name="blossomthemes_instagram_feed_settings[username]" type="text"
55
+ value="<?php echo esc_attr( $username ); ?>" />
56
+ </div>
57
+ <!-- ./ Username input -->
58
+
59
+ <!-- Number of photos -->
60
+ <div class="btif-option-field-wrap">
61
+ <label for="blossomthemes_instagram_feed_settings[photos]">
62
+ <?php _e('Number of Photos', 'blossomthemes-instagram-feed'); ?>
63
+ </label>
64
+ <input min="1" max="30" id="blossomthemes_instagram_feed_settings[photos]"
65
+ name="blossomthemes_instagram_feed_settings[photos]" type="number"
66
+ value="<?php echo esc_attr( $photos ); ?>" />
67
+ </div>
68
+ <!-- ./ Number of photos -->
69
+
70
+ <!-- Photo size -->
71
+ <div class="btif-option-field-wrap">
72
+ <label for="blossomthemes_instagram_feed_settings[photo_size]">
73
+ <?php esc_html_e( 'Photo size', 'blossomthemes-instagram-feed' ); ?>
74
+ </label>
75
+ <select id="blossomthemes_instagram_feed_settings[photo_size]" name="blossomthemes_instagram_feed_settings[photo_size]">
76
+ <option value="thumbnail" <?php selected( 'thumbnail', $size ) ?>>
77
+ <?php esc_html_e( 'Thumbnail', 'blossomthemes-instagram-feed' ); ?>
78
+ </option>
79
+ <option value="low_resolution" <?php selected( 'low_resolution', $size ) ?>>
80
+ <?php esc_html_e( 'Small', 'blossomthemes-instagram-feed' ); ?>
81
+ </option>
82
+ <option value="standard_resolution" <?php selected( 'standard_resolution', $size ) ?>>
83
+ <?php esc_html_e( 'Large', 'blossomthemes-instagram-feed' ); ?>
84
+ </option>
85
+ </select>
86
+ </div>
87
+ <!-- ./ Photo size -->
88
+
89
+ <!-- Photos per row -->
90
+ <div class="btif-option-field-wrap">
91
+ <label for="blossomthemes_instagram_feed_settings[photos_row]">
92
+ <?php _e('Photos Per Row', 'blossomthemes-instagram-feed'); ?>
93
+ </label>
94
+ <input min="1" max="20" id="blossomthemes_instagram_feed_settings[photos_row]"
95
+ name="blossomthemes_instagram_feed_settings[photos_row]" type="number"
96
+ value="<?php echo esc_attr( $photos_row); ?>">
97
+ </div>
98
+ <!-- ./ Photos per row -->
99
+
100
+ <!-- Profiel link text -->
101
+ <div class="btif-option-field-wrap">
102
+ <label for="blossomthemes_instagram_feed_settings[follow_me]">
103
+ <?php _e('Profile Link Text', 'blossomthemes-instagram-feed'); ?>
104
+ </label>
105
+ <input id="blossomthemes_instagram_feed_settings[follow_me]"
106
+ name="blossomthemes_instagram_feed_settings[follow_me]" type="text"
107
+ value="<?php echo esc_attr( $follow_me ); ?>">
108
+ </div>
109
+ <!-- ./ Profile link text -->
110
+
111
+ <!-- Show likes comments -->
112
+ <div class="btif-option-field-wrap">
113
+ <label for="likes-comments">
114
+ <?php _e( 'Show Likes/Comments', 'blossomthemes-instagram-feed' ); ?>
115
+ </label>
116
+ <input type="checkbox" value="1" id="likes-comments"
117
+ name="blossomthemes_instagram_feed_settings[meta]" <?php checked( $options['meta'], true ); ?>>
118
+ </div>
119
+
120
+ <!-- Check for New Posts -->
121
+ <div class="btif-option-field-wrap">
122
+ <label for="transient-pull-interval">
123
+ <?php _e( 'Check for new posts every', 'blossomthemes-instagram-feed' ); ?>
124
+ </label>
125
+ <input type="number"
126
+ id="transient-pull-interval"
127
+ name="blossomthemes_instagram_feed_settings[pull_duration]"
128
+ value="<?php echo esc_attr( $pull_duration ) ?>"
129
+ min="1">
130
+
131
+ <select id="blossomthemes_instagram_feed_settings[pull_unit]"
132
+ name="blossomthemes_instagram_feed_settings[pull_unit]">
133
+ <option <?php selected( $pull_unit, 'hours' ); ?> value="hours"><?php _e( 'Hours', 'blossomthemes-instagram-feed' ) ?></option>
134
+ <option <?php selected( $pull_unit, 'days' ); ?> value="days"><?php _e( 'Days', 'blossomthemes-instagram-feed' ) ?></option>
135
+ <option <?php selected( $pull_unit, 'minutes' ); ?> value="minutes"><?php _e( 'Minutes', 'blossomthemes-instagram-feed' ) ?></option>
136
+ </select>
137
+ </div>
138
+ </div>
includes/template/backend/settings.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Settings template.
4
+ */
5
+ ?>
6
+ <div class="btif-wrap">
7
+ <?php settings_errors(); ?>
8
+ <div class="btif-header">
9
+ <h3><?php _e( 'BlossomThemes Social Feed', 'blossomthemes-instagram-feed' ); ?></h3>
10
+ </div>
11
+
12
+ <div class="btif-inner-wrap">
13
+ <h2 class="nav-tab-wrapper">
14
+ <a href="#" class="btss-tab-trigger nav-tab nav-tab-active" data-configuration="general">
15
+ <?php _e('General','blossomthemes-instagram-feed');?>
16
+ </a>
17
+
18
+ <a href="#" class="btss-tab-trigger nav-tab" data-configuration="usage">
19
+ <?php _e('Usage','blossomthemes-instagram-feed');?>
20
+ </a>
21
+ </h2>
22
+
23
+ <form method="post" action="options.php" class="btif-settings-form">
24
+ <?php
25
+ /**
26
+ * Add hook to include the settings general tab content
27
+ */
28
+ do_action( 'btif_settings_general_tab_content' );
29
+
30
+ /**
31
+ * Add hook toinclude the settings ussae tab content.
32
+ */
33
+ do_action( 'btif_settings_usage_tab_content' );
34
+ ?>
35
+
36
+ <!-- Generate CSRF token -->
37
+ <?php $nonce = wp_create_nonce( 'blossomthemes-instagram-feed-nonce' ); ?>
38
+ <input type="hidden"name="blossomthemes-instagram-feed-nonce" value="<?php echo esc_attr( $nonce ); ?>" />
39
+ <!-- ./ Generate CSRF token -->
40
+
41
+ <!-- Submit button -->
42
+ <div class="blossomthemes-instagram-feed-settings-submit">
43
+ <?php
44
+ settings_fields( 'blossomthemes_instagram_feed_settings' );
45
+ do_settings_sections( __FILE__ );
46
+ echo submit_button();
47
+ ?>
48
+ </div>
49
+ <!-- ./ Submit button -->
50
+ </form>
51
+ </div>
52
+
53
+ <?php
54
+ /**
55
+ * Add hook to include sidebar.
56
+ */
57
+ do_action( 'btif_settings_sidebar' );
58
+ ?>
59
+ </div>
includes/template/backend/usage.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * General usage tab content template.
4
+ */
5
+ ?>
6
+ <div class="blossomthemes-instagram-feed-settings usage" id="blossomthemes-instagram-feed-settings-usage">
7
+ <h4><?php _e( 'Uses', 'blossomthemes-instagram-feed' ); ?></h4>
8
+ <div class="wp-tm-settings-wrapper">
9
+ <h4 class="wp-tm-setting-title">
10
+ <?php _e('Display via Shortcode','blossomthemes-instagram-feed');?>
11
+ </h4>
12
+ <div class="wp-tm--option-wrapper">
13
+ <div class="wp-tm-option-field">
14
+ <label class="wp-tm-plain-label">
15
+ <div class="tm-option-side-note">
16
+ <?php _e('Copy this Shortcode to display your instagram gallery in pages/posts => ', 'blossomthemes-instagram-feed') ?>
17
+ <br>
18
+ <input type="text" readonly="readonly" class="shortcode-usage"
19
+ value="[blossomthemes_instagram_feed]"
20
+ onClick="this.setSelectionRange(0, this.value.length)" />
21
+ </div>
22
+ </label>
23
+ </div>
24
+ </div>
25
+ <h4 class="wp-tm-setting-title">
26
+ <?php _e('Display via PHP Function','blossomthemes-instagram-feed');?>
27
+ </h4>
28
+ <div class="wp-tm--option-wrapper">
29
+ <div class="wp-tm-option-field">
30
+ <label class="wp-tm-plain-label">
31
+ <div class="tm-option-side-note">
32
+ <?php _e('Copy the PHP Function below to display your instagram gallery in templates :', 'blossomthemes-instagram-feed') ?>
33
+ <br>
34
+ <textarea rows="2" cols="50" readonly="readonly"
35
+ onClick="this.setSelectionRange(0, this.value.length)">&lt;?php echo do_shortcode("[blossomthemes_instagram_feed]"); ?&gt; </textarea>
36
+ </div>
37
+ </label>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ </div>
includes/widgets/widget-blossomthemes-instagram-feed.php CHANGED
@@ -73,77 +73,74 @@ class BlossomThemes_Instagram_Widget extends WP_Widget {
73
 
74
  ob_start();
75
 
76
- if ( Blossomthemes_Instagram_Feed_API::getInstance()->is_configured() ) {
77
-
78
- $ran = rand(1,100); $ran++;
79
 
80
- $this->api = Blossomthemes_Instagram_Feed_API::getInstance();
81
- $items = $this->api->get_items( $limit, $size );
82
 
83
- add_filter('widget_text','do_shortcode');
84
 
85
- if ( ! is_array( $items ) ) {
86
- echo '<b style="color:red;">'.__('No posts available!','blossomthemes-instagram-feed').'</b>';
 
 
 
 
 
87
  } else {
88
- $count = 0;
89
- echo '<ul class="popup-gallery-'.$ran.' photos-'.$per_row.'">';
90
-
91
- foreach ( $items['items'] as $item )
92
- {
93
- $link = $item['link'];
94
- $img_standard = $item['image-standard'];
95
- $src = $item['image-url'];
96
- $likes = $item['likes_count'];
97
- $comments = $item['comments_count'];
98
- $caption = $item['caption'];
99
 
100
- echo '<li><a href="'.esc_url($img_standard).'"><img src="'.esc_url($src).'" alt="'.html_entity_decode($caption).'"></a>';
 
 
 
 
 
 
 
101
 
102
- if( isset( $meta ) && $meta == 'true' )
103
- {
104
- echo '<div class="instagram-meta"><span class="like"><i class="fa fa-heart"></i>'.$likes.'</span>'.'<span class="comment"><i class="fa fa-comment"></i>'.$comments.'</span>'.'</div>';
105
- }
106
- echo '</li>';
107
 
108
- if ( ++$count === $limit ) break;
 
 
109
  }
 
110
 
111
- echo '</ul>';
112
- echo
113
- '<script>
114
- jQuery(document).ready(function($){
115
- $(".popup-gallery-'.$ran.'").magnificPopup({
116
- delegate: "a",
117
- type: "image",
118
- gallery:{
119
- enabled:true
120
- }
121
- });
122
 
123
- $(".popup-modal").magnificPopup({
124
- type: "inline",
125
- preloader: false,
126
- focus: "#username",
127
- modal: true
128
- });
129
- $(document).on("click", ".popup-modal-dismiss", function (e) {
130
- e.preventDefault();
131
- $.magnificPopup.close();
 
132
  });
 
 
 
 
 
 
133
  });
134
- </script>';
135
- echo '<a class="profile-link" href="'.esc_url($profile_link).'" target="_blank" rel="noreferrer">'.esc_attr($profile_link_text).'</a>';
136
- }
137
- }
138
- else{
139
- if ( current_user_can( 'edit_theme_options' ) ) {
140
- ?>
141
- <p>
142
- <?php _e( 'BlossomThemes Social Feed Widget misconfigured, check plugin &amp; widget settings.', 'blossomthemes-instagram-feed' ); ?>
143
- </p>
144
- <?php
145
- }
146
- }
147
  $output = ob_get_clean();
148
  echo $output;
149
  echo $args['after_widget'];
@@ -266,8 +263,8 @@ class BlossomThemes_Instagram_Widget extends WP_Widget {
266
  $instance['size'] = $new_instance['size'];
267
  $instance['per_row'] = ! absint( $new_instance['per_row'] ) ? 5 : $new_instance['per_row'];
268
  $instance['meta'] = $new_instance['meta'];
269
- $instance['profile_link'] = 'https://www.instagram.com/'.$username;
270
  $instance['username'] = $new_instance['username'] ;
 
271
  $instance['profile_link_text'] = $new_instance['profile_link_text'] ;
272
 
273
  return $instance;
73
 
74
  ob_start();
75
 
76
+ $ran = rand(1,100); $ran++;
 
 
77
 
78
+ $this->api = Blossomthemes_Instagram_Feed_API::getInstance();
79
+ $items = $this->api->get_items( $limit, $size );
80
 
81
+ add_filter('widget_text','do_shortcode');
82
 
83
+ if ( ! is_array( $items ) ) {
84
+ if ( current_user_can( 'edit_theme_options' ) ) {
85
+ ?>
86
+ <p>
87
+ <?php _e( 'BlossomThemes Social Feed misconfigured, check plugin &amp; widget settings.', 'blossomthemes-instagram-feed' ); ?>
88
+ </p>
89
+ <?php
90
  } else {
91
+ echo '<b style="color:red;">'.__('No posts available!','blossomthemes-instagram-feed').'</b>';
92
+ }
93
+ } else {
94
+ $count = 0;
95
+ echo '<ul class="popup-gallery-'.$ran.' photos-'.$per_row.'">';
 
 
 
 
 
 
96
 
97
+ foreach ( $items['items'] as $item )
98
+ {
99
+ $link = $item['link'];
100
+ $img_standard = $item['image-standard'];
101
+ $src = $item['image-url'];
102
+ $likes = $item['likes_count'];
103
+ $comments = $item['comments_count'];
104
+ $caption = $item['caption'];
105
 
106
+ echo '<li><a href="'.esc_url($img_standard).'"><img src="'.esc_url($src).'" alt="'.html_entity_decode($caption).'"></a>';
 
 
 
 
107
 
108
+ if( isset( $meta ) && $meta == 'true' )
109
+ {
110
+ echo '<div class="instagram-meta"><span class="like"><i class="fa fa-heart"></i>'.$likes.'</span>'.'<span class="comment"><i class="fa fa-comment"></i>'.$comments.'</span>'.'</div>';
111
  }
112
+ echo '</li>';
113
 
114
+ if ( ++$count === $limit ) break;
115
+ }
 
 
 
 
 
 
 
 
 
116
 
117
+ echo '</ul>';
118
+ echo
119
+ '<script>
120
+ jQuery(document).ready(function($){
121
+ $(".popup-gallery-'.$ran.'").magnificPopup({
122
+ delegate: "a",
123
+ type: "image",
124
+ gallery:{
125
+ enabled:true
126
+ }
127
  });
128
+
129
+ $(".popup-modal").magnificPopup({
130
+ type: "inline",
131
+ preloader: false,
132
+ focus: "#username",
133
+ modal: true
134
  });
135
+ $(document).on("click", ".popup-modal-dismiss", function (e) {
136
+ e.preventDefault();
137
+ $.magnificPopup.close();
138
+ });
139
+ });
140
+ </script>';
141
+ echo '<a class="profile-link" href="'.esc_url($profile_link).'" target="_blank" rel="noreferrer">'.esc_attr($profile_link_text).'</a>';
142
+ }
143
+
 
 
 
 
144
  $output = ob_get_clean();
145
  echo $output;
146
  echo $args['after_widget'];
263
  $instance['size'] = $new_instance['size'];
264
  $instance['per_row'] = ! absint( $new_instance['per_row'] ) ? 5 : $new_instance['per_row'];
265
  $instance['meta'] = $new_instance['meta'];
 
266
  $instance['username'] = $new_instance['username'] ;
267
+ $instance['profile_link'] = 'https://www.instagram.com/'. $instance['username'];
268
  $instance['profile_link_text'] = $new_instance['profile_link_text'] ;
269
 
270
  return $instance;
languages/blossomthemes-instagram-feed.pot CHANGED
@@ -1,216 +1,253 @@
1
- # Copyright (C) 2019 blossomthemes
2
- # This file is distributed under the GPL-2.0+.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: BlossomThemes Social Feed 1.1.7\n"
6
- "Report-Msgid-Bugs-To: "
7
- "https://wordpress.org/support/plugin/blossomthemes-instagram-feed\n"
8
- "POT-Creation-Date: 2019-08-09 07:44:48+00:00\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=utf-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
13
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
- "Language-Team: LANGUAGE <LL@li.org>\n"
15
- "X-Generator: grunt-wp-i18n 1.0.3\n"
16
-
17
- #: admin/class-blossomthemes-instagram-feed-admin.php:141
18
- msgid "Access Token rejected by Instagram API. Please add valid Access Token."
19
- msgstr ""
20
-
21
- #: admin/class-blossomthemes-instagram-feed-admin.php:175
22
- msgid "Dismiss this notice"
23
- msgstr ""
24
-
25
- #. Plugin Name of the plugin/theme
26
- msgid "BlossomThemes Social Feed"
27
- msgstr ""
28
-
29
- #: includes/class-blossomthemes-instagram-feed-settings.php:25
30
- msgid "General"
31
- msgstr ""
32
-
33
- #: includes/class-blossomthemes-instagram-feed-settings.php:26
34
- msgid "Usage"
35
- msgstr ""
36
-
37
- #: includes/class-blossomthemes-instagram-feed-settings.php:51
38
- #: includes/class-blossomthemes-instagram-feed-settings.php:63
39
- msgid "Connect with Instagram"
40
- msgstr ""
41
-
42
- #: includes/class-blossomthemes-instagram-feed-settings.php:53
43
- msgid ""
44
- "To get started click the button below. You’ll be prompted to authorize "
45
- "BlossomThemes Social Feed to access your Instagram photos."
46
- msgstr ""
47
-
48
- #: includes/class-blossomthemes-instagram-feed-settings.php:54
49
- msgid "For help, please refer to this video tutorial."
50
- msgstr ""
51
-
52
- #: includes/class-blossomthemes-instagram-feed-settings.php:57
53
- msgid ""
54
- "Due to recent Instagram API changes it is no longer possible to display "
55
- "photos from a different Instagram account than yours. The widget will "
56
- "automatically display the latest photos of the account which was authorized "
57
- "on this page."
58
- msgstr ""
59
-
60
- #: includes/class-blossomthemes-instagram-feed-settings.php:65
61
- msgid "Re-connect with Instagram"
62
- msgstr ""
63
-
64
- #: includes/class-blossomthemes-instagram-feed-settings.php:69
65
- msgid "Access Token"
66
- msgstr ""
67
-
68
- #: includes/class-blossomthemes-instagram-feed-settings.php:74
69
- msgid ""
70
- "Access Token is used as key to access your photos from Instagram so they "
71
- "can be displayed."
72
- msgstr ""
73
-
74
- #: includes/class-blossomthemes-instagram-feed-settings.php:81
75
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:215
76
- msgid "Username"
77
- msgstr ""
78
-
79
- #: includes/class-blossomthemes-instagram-feed-settings.php:86
80
- msgid "Number of Photos"
81
- msgstr ""
82
-
83
- #: includes/class-blossomthemes-instagram-feed-settings.php:90
84
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:225
85
- msgid "Photo size"
86
- msgstr ""
87
-
88
- #: includes/class-blossomthemes-instagram-feed-settings.php:92
89
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:227
90
- msgid "Thumbnail"
91
- msgstr ""
92
-
93
- #: includes/class-blossomthemes-instagram-feed-settings.php:93
94
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:228
95
- msgid "Small"
96
- msgstr ""
97
-
98
- #: includes/class-blossomthemes-instagram-feed-settings.php:94
99
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:229
100
- msgid "Large"
101
- msgstr ""
102
-
103
- #: includes/class-blossomthemes-instagram-feed-settings.php:98
104
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:234
105
- msgid "Photos Per Row"
106
- msgstr ""
107
-
108
- #: includes/class-blossomthemes-instagram-feed-settings.php:102
109
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:244
110
- msgid "Profile Link Text"
111
- msgstr ""
112
-
113
- #: includes/class-blossomthemes-instagram-feed-settings.php:106
114
- msgid "Show Likes/Comments"
115
- msgstr ""
116
-
117
- #: includes/class-blossomthemes-instagram-feed-settings.php:116
118
- msgid "Uses"
119
- msgstr ""
120
-
121
- #: includes/class-blossomthemes-instagram-feed-settings.php:118
122
- msgid "Display via Shortcode"
123
- msgstr ""
124
-
125
- #: includes/class-blossomthemes-instagram-feed-settings.php:122
126
- msgid "Copy this Shortcode to display your instagram gallery in pages/posts => "
127
- msgstr ""
128
-
129
- #: includes/class-blossomthemes-instagram-feed-settings.php:128
130
- msgid "Display via PHP Function"
131
- msgstr ""
132
-
133
- #: includes/class-blossomthemes-instagram-feed-settings.php:132
134
- msgid "Copy the PHP Function below to display your instagram gallery in templates :"
135
- msgstr ""
136
-
137
- #: includes/class-blossomthemes-instagram-feed-shortcodes.php:34
138
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:86
139
- msgid "No posts available!"
140
- msgstr ""
141
-
142
- #: includes/class-blossomthemes-instagram-feed-shortcodes.php:96
143
- msgid "BlossomThemes Social Feed misconfigured, check plugin &amp; widget settings."
144
- msgstr ""
145
-
146
- #: includes/template/backend/sidebar.php:3
147
- msgid "More WordPress Themes and Plugins?"
148
- msgstr ""
149
-
150
- #: includes/template/backend/sidebar.php:5
151
- msgid "Visit us at: "
152
- msgstr ""
153
-
154
- #: includes/template/backend/sidebar.php:6
155
- msgid "Blossom Themes"
156
- msgstr ""
157
-
158
- #: includes/template/backend/sidebar.php:9
159
- msgid "Please fill free to leave us a review, if you found this plugin helpful."
160
- msgstr ""
161
-
162
- #: includes/template/backend/sidebar.php:10
163
- msgid "Leave a Review"
164
- msgstr ""
165
-
166
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:25
167
- msgid "BlossomThemes: Feed for Instagram"
168
- msgstr ""
169
-
170
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:26
171
- msgid "A widget that displays your latest Instagram photos."
172
- msgstr ""
173
-
174
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:142
175
- msgid ""
176
- "BlossomThemes Social Feed Widget misconfigured, check plugin &amp; widget "
177
- "settings."
178
- msgstr ""
179
-
180
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:161
181
- msgid "Instagram"
182
- msgstr ""
183
-
184
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:202
185
- msgid ""
186
- "Please configure <a href=\"%1$s\">Plugin Settings</a> before using this "
187
- "widget."
188
- msgstr ""
189
-
190
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:210
191
- msgid "Title"
192
- msgstr ""
193
-
194
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:220
195
- msgid "Number of photos"
196
- msgstr ""
197
-
198
- #: includes/widgets/widget-blossomthemes-instagram-feed.php:240
199
- msgid "Display Comments/Likes"
200
- msgstr ""
201
-
202
- #. Plugin URI of the plugin/theme
203
- msgid "https://wordpress.org/plugins/blossomthemes-instagram-feed"
204
- msgstr ""
205
-
206
- #. Description of the plugin/theme
207
- msgid "Show instagram feed on your website using shortcode and widget."
208
- msgstr ""
209
-
210
- #. Author of the plugin/theme
211
- msgid "blossomthemes"
212
- msgstr ""
213
-
214
- #. Author URI of the plugin/theme
215
- msgid "https://blossomthemes.com"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  msgstr ""
1
+ # Copyright (C) 2019 blossomthemes
2
+ # This file is distributed under the GPL-2.0+.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: BlossomThemes Social Feed 1.1.9\n"
6
+ "Report-Msgid-Bugs-To: "
7
+ "https://wordpress.org/support/plugin/blossomthemes-instagram-feed\n"
8
+ "POT-Creation-Date: 2019-08-30 08:37:03+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=utf-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "X-Generator: grunt-wp-i18n 1.0.3\n"
16
+
17
+ #: admin/class-blossomthemes-instagram-feed-admin.php:141
18
+ msgid "Access Token rejected by Instagram API. Please add valid Access Token."
19
+ msgstr ""
20
+
21
+ #: admin/class-blossomthemes-instagram-feed-admin.php:175
22
+ msgid ""
23
+ "BlossomThemes: Invalid or expired instagram access token. Please reconnect "
24
+ "instagram."
25
+ msgstr ""
26
+
27
+ #: admin/class-blossomthemes-instagram-feed-admin.php:185
28
+ msgid "Please configure BlossomThemes Social Feed"
29
+ msgstr ""
30
+
31
+ #: admin/class-blossomthemes-instagram-feed-admin.php:187
32
+ msgid "If you have just installed or updated this plugin, please go to the"
33
+ msgstr ""
34
+
35
+ #: admin/class-blossomthemes-instagram-feed-admin.php:189
36
+ msgid "Settings Page"
37
+ msgstr ""
38
+
39
+ #: admin/class-blossomthemes-instagram-feed-admin.php:190
40
+ msgid "and connect it with your Instagram account."
41
+ msgstr ""
42
+
43
+ #: admin/class-blossomthemes-instagram-feed-admin.php:191
44
+ msgid "You can ignore this message if you have already configured it."
45
+ msgstr ""
46
+
47
+ #: admin/class-blossomthemes-instagram-feed-admin.php:192
48
+ msgid "Dismiss this notice"
49
+ msgstr ""
50
+
51
+ #: includes/class-blossomthemes-instagram-feed-shortcodes.php:35
52
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:87
53
+ msgid "BlossomThemes Social Feed misconfigured, check plugin &amp; widget settings."
54
+ msgstr ""
55
+
56
+ #: includes/class-blossomthemes-instagram-feed-shortcodes.php:39
57
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:91
58
+ msgid "No posts available!"
59
+ msgstr ""
60
+
61
+ #: includes/template/backend/general.php:8
62
+ #: includes/template/backend/general.php:25
63
+ msgid "Connect with Instagram"
64
+ msgstr ""
65
+
66
+ #: includes/template/backend/general.php:10
67
+ msgid ""
68
+ "To get started click the button below. You’ll be prompted to authorize "
69
+ "BlossomThemes Social Feed to access your Instagram photos."
70
+ msgstr ""
71
+
72
+ #: includes/template/backend/general.php:12
73
+ msgid "For help, please refer to this video tutorial."
74
+ msgstr ""
75
+
76
+ #: includes/template/backend/general.php:17
77
+ msgid ""
78
+ "Due to recent Instagram API changes it is no longer possible to display "
79
+ "photos from a different Instagram account than yours. The widget will "
80
+ "automatically display the latest photos of the account which was authorized "
81
+ "on this page."
82
+ msgstr ""
83
+
84
+ #: includes/template/backend/general.php:27
85
+ msgid "Re-connect with Instagram"
86
+ msgstr ""
87
+
88
+ #: includes/template/backend/general.php:35
89
+ msgid "Access Token"
90
+ msgstr ""
91
+
92
+ #: includes/template/backend/general.php:44
93
+ msgid ""
94
+ "Access Token is used as key to access your photos from Instagram so they "
95
+ "can be displayed."
96
+ msgstr ""
97
+
98
+ #: includes/template/backend/general.php:51
99
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:212
100
+ msgid "Username"
101
+ msgstr ""
102
+
103
+ #: includes/template/backend/general.php:62
104
+ msgid "Number of Photos"
105
+ msgstr ""
106
+
107
+ #: includes/template/backend/general.php:73
108
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:222
109
+ msgid "Photo size"
110
+ msgstr ""
111
+
112
+ #: includes/template/backend/general.php:77
113
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:224
114
+ msgid "Thumbnail"
115
+ msgstr ""
116
+
117
+ #: includes/template/backend/general.php:80
118
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:225
119
+ msgid "Small"
120
+ msgstr ""
121
+
122
+ #: includes/template/backend/general.php:83
123
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:226
124
+ msgid "Large"
125
+ msgstr ""
126
+
127
+ #: includes/template/backend/general.php:92
128
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:231
129
+ msgid "Photos Per Row"
130
+ msgstr ""
131
+
132
+ #: includes/template/backend/general.php:103
133
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:241
134
+ msgid "Profile Link Text"
135
+ msgstr ""
136
+
137
+ #: includes/template/backend/general.php:114
138
+ msgid "Show Likes/Comments"
139
+ msgstr ""
140
+
141
+ #: includes/template/backend/general.php:123
142
+ msgid "Check for new posts every"
143
+ msgstr ""
144
+
145
+ #: includes/template/backend/general.php:133
146
+ msgid "Hours"
147
+ msgstr ""
148
+
149
+ #: includes/template/backend/general.php:134
150
+ msgid "Days"
151
+ msgstr ""
152
+
153
+ #: includes/template/backend/general.php:135
154
+ msgid "Minutes"
155
+ msgstr ""
156
+
157
+ #. Plugin Name of the plugin/theme
158
+ msgid "BlossomThemes Social Feed"
159
+ msgstr ""
160
+
161
+ #: includes/template/backend/settings.php:15
162
+ msgid "General"
163
+ msgstr ""
164
+
165
+ #: includes/template/backend/settings.php:19
166
+ msgid "Usage"
167
+ msgstr ""
168
+
169
+ #: includes/template/backend/sidebar.php:3
170
+ msgid "More WordPress Themes and Plugins?"
171
+ msgstr ""
172
+
173
+ #: includes/template/backend/sidebar.php:5
174
+ msgid "Visit us at: "
175
+ msgstr ""
176
+
177
+ #: includes/template/backend/sidebar.php:6
178
+ msgid "Blossom Themes"
179
+ msgstr ""
180
+
181
+ #: includes/template/backend/sidebar.php:9
182
+ msgid "Please fill free to leave us a review, if you found this plugin helpful."
183
+ msgstr ""
184
+
185
+ #: includes/template/backend/sidebar.php:10
186
+ msgid "Leave a Review"
187
+ msgstr ""
188
+
189
+ #: includes/template/backend/usage.php:7
190
+ msgid "Uses"
191
+ msgstr ""
192
+
193
+ #: includes/template/backend/usage.php:10
194
+ msgid "Display via Shortcode"
195
+ msgstr ""
196
+
197
+ #: includes/template/backend/usage.php:16
198
+ msgid "Copy this Shortcode to display your instagram gallery in pages/posts => "
199
+ msgstr ""
200
+
201
+ #: includes/template/backend/usage.php:26
202
+ msgid "Display via PHP Function"
203
+ msgstr ""
204
+
205
+ #: includes/template/backend/usage.php:32
206
+ msgid "Copy the PHP Function below to display your instagram gallery in templates :"
207
+ msgstr ""
208
+
209
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:25
210
+ msgid "BlossomThemes: Feed for Instagram"
211
+ msgstr ""
212
+
213
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:26
214
+ msgid "A widget that displays your latest Instagram photos."
215
+ msgstr ""
216
+
217
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:158
218
+ msgid "Instagram"
219
+ msgstr ""
220
+
221
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:199
222
+ msgid ""
223
+ "Please configure <a href=\"%1$s\">Plugin Settings</a> before using this "
224
+ "widget."
225
+ msgstr ""
226
+
227
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:207
228
+ msgid "Title"
229
+ msgstr ""
230
+
231
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:217
232
+ msgid "Number of photos"
233
+ msgstr ""
234
+
235
+ #: includes/widgets/widget-blossomthemes-instagram-feed.php:237
236
+ msgid "Display Comments/Likes"
237
+ msgstr ""
238
+
239
+ #. Plugin URI of the plugin/theme
240
+ msgid "https://wordpress.org/plugins/blossomthemes-instagram-feed"
241
+ msgstr ""
242
+
243
+ #. Description of the plugin/theme
244
+ msgid "Show instagram feed on your website using shortcode and widget."
245
+ msgstr ""
246
+
247
+ #. Author of the plugin/theme
248
+ msgid "blossomthemes"
249
+ msgstr ""
250
+
251
+ #. Author URI of the plugin/theme
252
+ msgid "https://blossomthemes.com"
253
  msgstr ""
public/class-blossomthemes-instagram-feed-public.php CHANGED
@@ -74,7 +74,7 @@ class Blossomthemes_Instagram_Feed_Public {
74
  */
75
 
76
  wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/blossomthemes-instagram-feed-public.min.css', array(), $this->version, 'all' );
77
- wp_enqueue_style( 'magnific-popup', plugin_dir_url( __FILE__ ) . 'css/magnific-popup.min.css', array(), $this->version, 'all' );
78
  }
79
 
80
  /**
@@ -96,9 +96,42 @@ class Blossomthemes_Instagram_Feed_Public {
96
  * class.
97
  */
98
 
99
- wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/blossomthemes-instagram-feed-public.min.js', array( 'jquery' ), $this->version, false );
100
- wp_enqueue_script( 'magnific-popup', plugin_dir_url( __FILE__ ) . 'js/jquery.magnific-popup.min.js', array( 'jquery' ), $this->version, false );
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  }
103
 
104
  }
74
  */
75
 
76
  wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/blossomthemes-instagram-feed-public.min.css', array(), $this->version, 'all' );
77
+ wp_enqueue_style( 'magnific-popup', plugin_dir_url( __FILE__ ) . 'css/magnific-popup.min.css', array(), '1.0.0', 'all' );
78
  }
79
 
80
  /**
96
  * class.
97
  */
98
 
99
+ wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/blossomthemes-instagram-feed-public.min.js', array( 'jquery' ), $this->version, true );
 
100
 
101
+ $magnific_popup = apply_filters('btif_magnific_popup_enqueue',true);
102
+ if( $magnific_popup == true )
103
+ {
104
+ wp_enqueue_script( 'magnific-popup', plugin_dir_url( __FILE__ ) . 'js/jquery.magnific-popup.min.js', array( 'jquery' ), '1.0.0', true );
105
+ }
106
+
107
+ }
108
+
109
+ /**
110
+ * Defer js assets.
111
+ */
112
+ function btif_js_defer_files($tag)
113
+ {
114
+ $btif_assets = apply_filters('btif_public_assets_enqueue',true);
115
+
116
+ if( is_admin() || $btif_assets == true ) return $tag;
117
+
118
+ $async_files = apply_filters( 'btif_js_async_files', array(
119
+ plugin_dir_url( __FILE__ ) . 'js/blossomthemes-instagram-feed-public.min.js',
120
+ plugin_dir_url( __FILE__ ) . 'js/jquery.magnific-popup.min.js'
121
+ ) );
122
+
123
+ $add_async = false;
124
+ foreach( $async_files as $file ){
125
+ if( strpos( $tag, $file ) !== false ){
126
+ $add_async = true;
127
+ break;
128
+ }
129
+ }
130
+
131
+ if( $add_async ) $tag = str_replace( ' src', ' defer="defer" src', $tag );
132
+
133
+ return $tag;
134
+
135
  }
136
 
137
  }