Instagram Feed - Version 6.0.2

Version Description

  • Fix: Fixed Instagram Feed JavaScript file missing from the page when using the "AJAX theme loading fix" setting causing blank images to display.
  • Fix: Added the ability to create the custom database tables if there was an error when first trying to create them.
  • Fix: Fixed the error message not displaying if there was an error when trying to connect a personal or basic account.
Download this release

Release Info

Developer Craig at Smash Balloon
Plugin Icon 128x128 Instagram Feed
Version 6.0.2
Comparing to
See all releases

Code changes from version 6.0.1 to 6.0.2

README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: smashballoon, craig-at-smash-balloon
3
  Tags: Instagram, Instagram feed, Instagram photos, Instagram widget, Instagram gallery
4
  Requires at least: 4.1
5
  Tested up to: 5.9
6
- Stable tag: 6.0.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -331,6 +331,11 @@ We understand that sometimes you need help, have issues or just have questions.
331
  * Plus more customization options added all the time!
332
 
333
  == Changelog ==
 
 
 
 
 
334
  = 6.0.1 =
335
  * Fix: Custom HTML templates were not applying to new feeds.
336
  * Fix: Some custom tables were not being created for specific versions of MySQL.
3
  Tags: Instagram, Instagram feed, Instagram photos, Instagram widget, Instagram gallery
4
  Requires at least: 4.1
5
  Tested up to: 5.9
6
+ Stable tag: 6.0.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
331
  * Plus more customization options added all the time!
332
 
333
  == Changelog ==
334
+ = 6.0.2 =
335
+ * Fix: Fixed Instagram Feed JavaScript file missing from the page when using the "AJAX theme loading fix" setting causing blank images to display.
336
+ * Fix: Added the ability to create the custom database tables if there was an error when first trying to create them.
337
+ * Fix: Fixed the error message not displaying if there was an error when trying to connect a personal or basic account.
338
+
339
  = 6.0.1 =
340
  * Fix: Custom HTML templates were not applying to new feeds.
341
  * Fix: Some custom tables were not being created for specific versions of MySQL.
admin/SBI_Global_Settings.php CHANGED
@@ -53,6 +53,7 @@ class SBI_Global_Settings {
53
  add_action( 'wp_ajax_sbi_clear_cache', [$this, 'sbi_clear_cache'] );
54
  add_action( 'wp_ajax_sbi_clear_image_resize_cache', [$this, 'sbi_clear_image_resize_cache'] );
55
  add_action( 'wp_ajax_sbi_clear_error_log', [$this, 'sbi_clear_error_log'] );
 
56
  add_action( 'wp_ajax_sbi_dpa_reset', [$this, 'sbi_dpa_reset'] );
57
  }
58
 
@@ -576,6 +577,32 @@ class SBI_Global_Settings {
576
  wp_send_json_success();
577
  }
578
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
579
  /**
580
  * SBI Clear Image Resize Cache
581
  *
53
  add_action( 'wp_ajax_sbi_clear_cache', [$this, 'sbi_clear_cache'] );
54
  add_action( 'wp_ajax_sbi_clear_image_resize_cache', [$this, 'sbi_clear_image_resize_cache'] );
55
  add_action( 'wp_ajax_sbi_clear_error_log', [$this, 'sbi_clear_error_log'] );
56
+ add_action( 'wp_ajax_sbi_retry_db', [$this, 'sbi_retry_db'] );
57
  add_action( 'wp_ajax_sbi_dpa_reset', [$this, 'sbi_dpa_reset'] );
58
  }
59
 
577
  wp_send_json_success();
578
  }
579
 
580
+ /**
581
+ * SBI CLear Error Log
582
+ *
583
+ * @since 6.0
584
+ */
585
+ public function sbi_retry_db() {
586
+ //Security Checks
587
+ check_ajax_referer( 'sbi_nonce', 'sbi_nonce' );
588
+
589
+ if ( ! sbi_current_user_can( 'manage_instagram_feed_options' ) ) {
590
+ wp_send_json_error();
591
+ }
592
+ sbi_create_database_table( false );
593
+ \SB_Instagram_Feed_Locator::create_table();
594
+ \InstagramFeed\Builder\SBI_Db::create_tables( false );
595
+
596
+ global $wpdb;
597
+ $table_name = $wpdb->prefix . SBI_INSTAGRAM_POSTS_TYPE;
598
+
599
+ if ( $wpdb->get_var( "show tables like '$table_name'" ) !== $table_name ) {
600
+ wp_send_json_error( array( 'message' => '<div style="margin-top: 10px;">' . esc_html__( 'Unsuccessful. Try visiting our website.', 'instagram-feed' ) . '</div>' ) );
601
+ }
602
+
603
+ wp_send_json_success( array( 'message' => '<div style="margin-top: 10px;">' . esc_html__( 'Success! Try creating a feed and connecting a source.', 'instagram-feed' ) . '</div>' ) );
604
+ }
605
+
606
  /**
607
  * SBI Clear Image Resize Cache
608
  *
admin/builder/assets/css/global.css CHANGED
@@ -2279,6 +2279,9 @@
2279
  word-break: break-word;
2280
  background: #FFEFCC
2281
  }
 
 
 
2282
  .sbi-connect-actions .sbi-fb-source-btn {
2283
  margin-top: 0;
2284
  }
2279
  word-break: break-word;
2280
  background: #FFEFCC
2281
  }
2282
+ .sbi-connection-error .sb-alert {
2283
+ margin: 20px;
2284
+ }
2285
  .sbi-connect-actions .sbi-fb-source-btn {
2286
  margin-top: 0;
2287
  }
admin/builder/templates/sections/popup/add-source-popup.php CHANGED
@@ -155,7 +155,7 @@
155
  <!-- Step Two Show Accounts Connected to -->
156
  <div class="sbi-fb-source-step2 sbi-fb-fs" v-if="viewsActive.sourcePopupScreen == 'step_2'" data-source="active">
157
  <div class="sbi-fb-source-top sbi-fb-fs">
158
- <div v-if="typeof $parent.newSourceData !== 'undefined' && typeof $parent.newSourceData.error !== 'undefined'" class="sbi-businesses-connect-actions">
159
  <div class="sb-alert">
160
  <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
161
  <path d="M8.99935 0.666504C4.39935 0.666504 0.666016 4.39984 0.666016 8.99984C0.666016 13.5998 4.39935 17.3332 8.99935 17.3332C13.5993 17.3332 17.3327 13.5998 17.3327 8.99984C17.3327 4.39984 13.5993 0.666504 8.99935 0.666504ZM9.83268 13.1665H8.16602V11.4998H9.83268V13.1665ZM9.83268 9.83317H8.16602V4.83317H9.83268V9.83317Z" fill="#995C00"/>
@@ -293,4 +293,4 @@
293
 
294
  </div>
295
  </div>
296
- </script>
155
  <!-- Step Two Show Accounts Connected to -->
156
  <div class="sbi-fb-source-step2 sbi-fb-fs" v-if="viewsActive.sourcePopupScreen == 'step_2'" data-source="active">
157
  <div class="sbi-fb-source-top sbi-fb-fs">
158
+ <div v-if="typeof $parent.newSourceData !== 'undefined' && typeof $parent.newSourceData.error !== 'undefined'" class="sbi-businesses-connect-actions sbi-connection-error">
159
  <div class="sb-alert">
160
  <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
161
  <path d="M8.99935 0.666504C4.39935 0.666504 0.666016 4.39984 0.666016 8.99984C0.666016 13.5998 4.39935 17.3332 8.99935 17.3332C13.5993 17.3332 17.3327 13.5998 17.3327 8.99984C17.3327 4.39984 13.5993 0.666504 8.99935 0.666504ZM9.83268 13.1665H8.16602V11.4998H9.83268V13.1665ZM9.83268 9.83317H8.16602V4.83317H9.83268V9.83317Z" fill="#995C00"/>
293
 
294
  </div>
295
  </div>
296
+ </script>
inc/Builder/SBI_Db.php CHANGED
@@ -654,17 +654,15 @@ class SBI_Db {
654
 
655
  return $wpdb->get_results( $sql, ARRAY_A );
656
  }
657
-
658
-
659
- /**
660
- * Creates all database tables used in the new admin area in
661
- * the 6.0 update.
662
- *
663
- * TODO: Add error reporting
664
- *
665
- * @since 6.0
666
- */
667
- public static function create_tables() {
668
  if ( ! function_exists( 'dbDelta' ) ) {
669
  require_once ABSPATH . '/wp-admin/includes/upgrade.php';
670
  }
@@ -672,7 +670,7 @@ class SBI_Db {
672
  global $wpdb;
673
  $max_index_length = 191;
674
  $charset_collate = '';
675
- if ( method_exists( $wpdb, 'get_charset_collate' ) ) { // get_charset_collate introduced in WP 3.5
676
  $charset_collate = $wpdb->get_charset_collate();
677
  }
678
 
654
 
655
  return $wpdb->get_results( $sql, ARRAY_A );
656
  }
657
+ /**
658
+ * Creates all database tables used in the new admin area in
659
+ * the 6.0 update.
660
+ *
661
+ * TODO: Add error reporting
662
+ *
663
+ * @since 6.0
664
+ */
665
+ public static function create_tables( $include_charset_collate = true ) {
 
 
666
  if ( ! function_exists( 'dbDelta' ) ) {
667
  require_once ABSPATH . '/wp-admin/includes/upgrade.php';
668
  }
670
  global $wpdb;
671
  $max_index_length = 191;
672
  $charset_collate = '';
673
+ if ( $include_charset_collate && method_exists( $wpdb, 'get_charset_collate' ) ) { // get_charset_collate introduced in WP 3.5
674
  $charset_collate = $wpdb->get_charset_collate();
675
  }
676
 
inc/Builder/SBI_Source.php CHANGED
@@ -308,6 +308,7 @@ class SBI_Source {
308
  $source_data['error'] = '';
309
  if ( ! $connection->is_wp_error() && ! $connection->is_instagram_error() ) {
310
  $header_details_array = $connection->get_data();
 
311
  $header_details_array = self::merge_account_details( $header_details_array, $source_data );
312
  $source_data['username'] = $header_details_array['username'];
313
  $header_details = sbi_json_encode( $header_details_array );
@@ -315,21 +316,29 @@ class SBI_Source {
315
  $source_data['error'] = $connection;
316
  if ( $connection->is_wp_error() ) {
317
  $page_error = $connection->get_wp_error();
318
- if ( isset( $page_error ) && isset( $page_error->errors ) ) {
319
  $error_message = '';
320
- foreach ( $page_error->errors as $key => $item ) {
321
  $error_message .= $key . ': ' . $item[0] . ' ';
322
  }
 
323
  return array(
324
  'error' => array(
325
  'code' => 'HTTP Request',
326
- 'message' => __( 'Your server could not complete a remote request to Facebook\'s API. Your host may be blocking access or there may be a problem with your server.', 'instagram-feed' ),
327
  'details' => $error_message,
328
  ),
329
  );
330
  }
331
  } else {
332
- $source_data['error'] = $connection->get_data();
 
 
 
 
 
 
 
333
  }
334
  }
335
 
308
  $source_data['error'] = '';
309
  if ( ! $connection->is_wp_error() && ! $connection->is_instagram_error() ) {
310
  $header_details_array = $connection->get_data();
311
+
312
  $header_details_array = self::merge_account_details( $header_details_array, $source_data );
313
  $source_data['username'] = $header_details_array['username'];
314
  $header_details = sbi_json_encode( $header_details_array );
316
  $source_data['error'] = $connection;
317
  if ( $connection->is_wp_error() ) {
318
  $page_error = $connection->get_wp_error();
319
+ if ( ! empty( $page_error ) && isset( $page_error['response']->errors ) ) {
320
  $error_message = '';
321
+ foreach ( $page_error['response']->errors as $key => $item ) {
322
  $error_message .= $key . ': ' . $item[0] . ' ';
323
  }
324
+
325
  return array(
326
  'error' => array(
327
  'code' => 'HTTP Request',
328
+ 'message' => $error_message,
329
  'details' => $error_message,
330
  ),
331
  );
332
  }
333
  } else {
334
+ $error = $connection->get_data();
335
+ return array(
336
+ 'error' => array(
337
+ 'code' => $error['error']['code'],
338
+ 'message' => $error['error']['message'],
339
+ 'details' => $error['error']['message'],
340
+ ),
341
+ );
342
  }
343
  }
344
 
inc/admin/actions.php CHANGED
@@ -213,9 +213,29 @@ function sbi_admin_error_notices() {
213
  $errors = $sb_instagram_posts_manager->get_errors();
214
  if ( ! empty( $errors ) && (! empty( $errors['database_create'] ) || ! empty( $errors['upload_dir'] )) ) : ?>
215
  <div class="sbi-admin-notices sbi-critical-error-notice">
216
- <?php if ( ! empty( $errors['database_create'] ) ) echo '<p>' . wp_kses_post( $errors['database_create'] ) . '</p>'; ?>
217
- <?php if ( ! empty( $errors['upload_dir'] ) ) echo '<p>' . wp_kses_post( $errors['upload_dir'] ) . '</p>'; ?>
218
- <p><?php echo wp_kses_post( sprintf( __( 'Visit our %s page for help', 'instagram-feed' ), '<a href="https://smashballoon.com/docs/instagram/" class="sbi-notice-btn sbi-btn-grey" target="_blank">FAQ</a>' ) ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  </div>
220
 
221
  <?php endif;
213
  $errors = $sb_instagram_posts_manager->get_errors();
214
  if ( ! empty( $errors ) && (! empty( $errors['database_create'] ) || ! empty( $errors['upload_dir'] )) ) : ?>
215
  <div class="sbi-admin-notices sbi-critical-error-notice">
216
+ <span class="sb-notice-icon sb-error-icon">
217
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
218
+ <path d="M10 0C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20C15.52 20 20 15.52 20 10C20 4.48 15.52 0 10 0ZM11 15H9V13H11V15ZM11 11H9V5H11V11Z" fill="#D72C2C"/>
219
+ </svg>
220
+ </span>
221
+ <div class="sbi-notice-body">
222
+
223
+ <?php if ( ! empty( $errors['database_create'] ) ) : ?>
224
+ <h3 class="sb-notice-title">
225
+ <?php echo esc_html__( 'Instagram Feed was unable to create new database tables.', 'instagram-feed') ; ?>
226
+ </h3>
227
+ <p><?php echo wp_kses_post( $errors['database_create'] ); ?></p><br><br>
228
+ <p class="sbi-error-directions"><a href="https://smashballoon.com/docs/instagram/" class="sbi-license-btn sbi-btn-blue sbi-notice-btn" target="_blank"><?php esc_html_e( 'Visit our FAQ page for help', 'instagram-feed' ); ?></a> <button class="sbi-retry-db sbi-space-left sbi-btn sbi-notice-btn sbi-btn-grey"><?php esc_html_e( 'Try creating database tables again', 'instagram-feed' ); ?></button></p>
229
+ <?php
230
+ endif;
231
+ ?>
232
+ <?php if ( ! empty( $errors['upload_dir'] ) ) : ?>
233
+ <p><?php echo wp_kses_post( $errors['upload_dir'] ); ?></p><br><br>
234
+
235
+ <p class="sbi-error-directions"><a href="https://smashballoon.com/docs/instagram/" class="sbi-license-btn sbi-btn-blue sbi-notice-btn" target="_blank"><?php esc_html_e( 'Visit our FAQ page for help', 'instagram-feed' ); ?></a></p>
236
+
237
+ <?php endif; ?>
238
+ </div>
239
  </div>
240
 
241
  <?php endif;
inc/class-sb-instagram-api-connect.php CHANGED
@@ -195,6 +195,15 @@ class SB_Instagram_API_Connect
195
  if ( ! is_wp_error( $response ) ) {
196
  // certain ways of representing the html for double quotes causes errors so replaced here.
197
  $response = json_decode( str_replace( '%22', '&rdquo;', $response['body'] ), true );
 
 
 
 
 
 
 
 
 
198
  }
199
 
200
  $this->response = $response;
195
  if ( ! is_wp_error( $response ) ) {
196
  // certain ways of representing the html for double quotes causes errors so replaced here.
197
  $response = json_decode( str_replace( '%22', '&rdquo;', $response['body'] ), true );
198
+
199
+ if ( empty( $response ) ) {
200
+ $response = array(
201
+ 'error' => array(
202
+ 'code' => 'unknown',
203
+ 'message' => __( "An unknown error occurred when trying to connect to Instagram's API.", 'instagram-feed' )
204
+ )
205
+ );
206
+ }
207
  }
208
 
209
  $this->response = $response;
inc/class-sb-instagram-display-elements.php CHANGED
@@ -12,8 +12,8 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  die( '-1' );
13
  }
14
 
15
- class SB_Instagram_Display_Elements
16
- {
17
  /**
18
  * Images are hidden initially with the new/transition classes
19
  * except if the js image loading is disabled using the plugin
@@ -27,19 +27,18 @@ class SB_Instagram_Display_Elements
27
  * @since 2.0/5.0
28
  */
29
  public static function get_item_classes( $settings, $post = false ) {
30
- $classes = '';
31
  $customizer = sbi_doing_customizer( $settings );
32
- if( !$customizer ){
33
- if ( !$settings['disable_js_image_loading'] ) {
34
  $classes .= ' sbi_new sbi_transition';
35
  } else {
36
  $classes .= ' sbi_new sbi_no_js sbi_no_resraise sbi_js_load_disabled';
37
  }
38
- }else{
39
  $classes .= ' sbi_new ';
40
  }
41
 
42
-
43
  if ( $post && SB_Instagram_Parse::get_media_product_type( $post ) === 'igtv' ) {
44
  $classes .= ' sbi_igtv';
45
  }
@@ -77,24 +76,24 @@ class SB_Instagram_Display_Elements
77
  * @since 2.0/5.0
78
  */
79
  public static function get_optimum_media_url( $post, $settings, $resized_images = array() ) {
80
- $media_url = '';
81
- $optimum_res = $settings['imageres'];
82
  $account_type = isset( $post['images'] ) ? 'personal' : 'business';
83
 
84
  // only use the placeholder if it will be replaced using JS
85
- if ( !$settings['disable_js_image_loading'] ) {
86
  return trailingslashit( SBI_PLUGIN_URL ) . 'img/placeholder.png';
87
  } elseif ( $settings['imageres'] === 'auto' ) {
88
- $optimum_res = 'full';
89
  $settings['imageres'] = 'full';
90
  } else {
91
  if ( ! empty( $resized_images ) ) {
92
  $resolution = $settings['imageres'];
93
- $post_id = SB_Instagram_Parse::get_post_id( $post );
94
  if ( isset( $resized_images[ $post_id ] )
95
- && $resized_images[ $post_id ]['id'] !== 'error'
96
- && $resized_images[ $post_id ]['id'] !== 'pending'
97
- && $resized_images[ $post_id ]['id'] !== 'video' ) {
98
  if ( $resolution === 'thumb' ) {
99
  if ( isset( $resized_images[ $post_id ]['sizes']['low'] ) ) {
100
  $suffix = 'low';
@@ -128,13 +127,13 @@ class SB_Instagram_Display_Elements
128
 
129
  if ( $account_type === 'personal' ) {
130
  switch ( $optimum_res ) {
131
- case 'thumb' :
132
  $media_url = $post['images']['thumbnail']['url'];
133
  break;
134
- case 'medium' :
135
  $media_url = $post['images']['low_resolution']['url'];
136
  break;
137
- default :
138
  $media_url = $post['images']['standard_resolution']['url'];
139
  }
140
  } else {
@@ -142,9 +141,9 @@ class SB_Instagram_Display_Elements
142
 
143
  // use resized images if exists
144
  if ( $optimum_res === 'full' && isset( $resized_images[ $post_id ]['id'] )
145
- && $resized_images[ $post_id ]['id'] !== 'pending'
146
- && $resized_images[ $post_id ]['id'] !== 'video'
147
- && $resized_images[ $post_id ]['id'] !== 'error' ) {
148
  $media_url = sbi_get_resized_uploads_url() . $resized_images[ $post_id ]['id'] . 'full.jpg';
149
  } else {
150
  if ( SB_Instagram_GDPR_Integrations::doing_gdpr( $settings ) ) {
@@ -152,14 +151,14 @@ class SB_Instagram_Display_Elements
152
  }
153
  $media_type = $post['media_type'];
154
  if ( $media_type === 'CAROUSEL_ALBUM'
155
- || $media_type === 'VIDEO'
156
- || $media_type === 'OEMBED' ) {
157
  if ( isset( $post['thumbnail_url'] ) ) {
158
  return $post['thumbnail_url'];
159
  } elseif ( $media_type === 'CAROUSEL_ALBUM' && isset( $post['media_url'] ) ) {
160
  return $post['media_url'];
161
  } elseif ( isset( $post['children'] ) ) {
162
- $i = 0;
163
  $full_size = '';
164
  foreach ( $post['children']['data'] as $carousel_item ) {
165
  if ( $carousel_item['media_type'] === 'IMAGE' && empty( $full_size ) ) {
@@ -181,7 +180,7 @@ class SB_Instagram_Display_Elements
181
  }
182
  //attempt to get
183
  $permalink = SB_Instagram_Parse::fix_permalink( SB_Instagram_Parse::get_permalink( $post ) );
184
- $single = new SB_Instagram_Single( $permalink );
185
  $single->init();
186
  $post = $single->get_post();
187
 
@@ -201,7 +200,6 @@ class SB_Instagram_Display_Elements
201
  return trailingslashit( SBI_PLUGIN_URL ) . 'img/thumb-placeholder.png';
202
  }
203
  }
204
-
205
  }
206
 
207
  return $media_url;
@@ -222,10 +220,10 @@ class SB_Instagram_Display_Elements
222
  * @since 2.1.1/5.2.1 added support for resized images
223
  */
224
  public static function get_sbi_photo_style_element( $post, $settings, $resized_images = array() ) {
225
- if ( !$settings['disable_js_image_loading'] ) {
226
  return '';
227
  } else {
228
- $full_res_image = SB_Instagram_Display_Elements::get_optimum_media_url( $post, $settings, $resized_images );
229
  /*
230
  * By setting the height to "0" the bottom padding can be used
231
  * as a percent to square the images. Since it needs to be a percent
@@ -233,10 +231,10 @@ class SB_Instagram_Display_Elements
233
  */
234
  $padding_bottom = '100%';
235
  if ( $settings['imagepaddingunit'] === '%' ) {
236
- $padding_bottom = 100 - ($settings['imagepadding'] * 2) . '%';
237
  } else {
238
- $padding_percent = $settings['imagepadding'] > 0 ? 100 - ($settings['cols'] / 2 * $settings['imagepadding'] / 5) : 100;
239
- $padding_bottom = $padding_percent . '%';
240
  }
241
  return ' style="background-image: url(&quot;' . esc_url( $full_res_image ) . '&quot;); background-size: cover; background-position: center center; background-repeat: no-repeat; opacity: 1;height: 0;padding-bottom: ' . esc_attr( $padding_bottom ) . ';"';
242
  }
@@ -255,23 +253,23 @@ class SB_Instagram_Display_Elements
255
  public static function get_feed_style( $settings ) {
256
  $styles = '';
257
  if ( ! empty( $settings['imagepadding'] )
258
- || ! empty( $settings['background'] )
259
- || ! empty( $settings['width'] )
260
- || ! empty( $settings['height'] ) ) {
261
  $styles = ' style="';
262
  if ( ! empty( $settings['imagepadding'] ) ) {
263
- $styles .= 'padding-bottom: ' . ((int)$settings['imagepadding'] * 2) . esc_attr( $settings['imagepaddingunit'] ) . ';';
264
  }
265
  if ( ! empty( $settings['background'] ) ) {
266
- $styles .= 'background-color: rgb(' . esc_attr( sbi_hextorgb( $settings['background'] ) ). ');';
267
  }
268
  if ( ! empty( $settings['width'] ) ) {
269
  $width_unit = ! empty( $settings['widthunit'] ) && $settings['widthunit'] === '%' ? '%' : 'px';
270
- $styles .= 'width: ' . (int) $settings['width'] . $width_unit . ';';
271
  }
272
  if ( ! empty( $settings['height'] ) ) {
273
  $height_unit = ! empty( $settings['heightunit'] ) && $settings['heightunit'] === '%' ? '%' : 'px';
274
- $styles .= 'height: ' . (int) $settings['height'] . $height_unit . ';';
275
  }
276
  $styles .= '"';
277
  }
@@ -294,13 +292,15 @@ class SB_Instagram_Display_Elements
294
  } else {
295
  $disable_mobile = $settings['disablemobile'];
296
  ( $disable_mobile == 'on' || $disable_mobile == 'true' || $disable_mobile == true ) ? $disable_mobile = true : $disable_mobile = false;
297
- if( $settings[ 'disablemobile' ] === 'false' ) $disable_mobile = '';
 
 
298
 
299
  if ( $disable_mobile !== ' sbi_disable_mobile' && $settings['colsmobile'] !== 'same' ) {
300
- $colsmobile = (int)( $settings['colsmobile'] ) > 0 ? (int)$settings['colsmobile'] : 'auto';
301
  return ' sbi_mob_col_' . $colsmobile;
302
  } else {
303
- $colsmobile = (int)( $settings['cols'] ) > 0 ? (int)$settings['cols'] : 4;
304
  return ' sbi_disable_mobile sbi_mob_col_' . $colsmobile;
305
  }
306
  }
@@ -320,7 +320,7 @@ class SB_Instagram_Display_Elements
320
  if ( $customizer ) {
321
  return ' $parent.getTabletColsClass() ';
322
  } else {
323
- $colstablet = (int)( $settings['colstablet'] ) > 0 ? (int)$settings['colstablet'] : 3;
324
 
325
  return ' sbi_tab_col_' . $colstablet;
326
  }
@@ -336,8 +336,8 @@ class SB_Instagram_Display_Elements
336
  * @since 6.0
337
  */
338
  public static function get_sbi_images_style( $settings ) {
339
- if ( ! empty ( $settings['imagepadding'] ) ) {
340
- return ' style="padding: '.(int)$settings['imagepadding'] . esc_attr( $settings['imagepaddingunit'] ) . ';"';
341
  }
342
  return '';
343
  }
@@ -354,7 +354,7 @@ class SB_Instagram_Display_Elements
354
  */
355
  public static function get_header_text_color_styles( $settings ) {
356
  if ( ! empty( $settings['headercolor'] ) ) {
357
- return ' style="color: rgb(' . esc_attr( sbi_hextorgb( $settings['headercolor'] ) ). ');"';
358
  }
359
  return '';
360
  }
@@ -369,7 +369,7 @@ class SB_Instagram_Display_Elements
369
  * @since 2.0.1/5.0
370
  */
371
  public static function get_header_size_class( $settings ) {
372
- $header_size_class = in_array( strtolower( $settings['headersize'] ), array( 'medium', 'large' ) ) ? ' sbi_'.strtolower( $settings['headersize'] ) : '';
373
  return $header_size_class;
374
  }
375
 
@@ -386,17 +386,17 @@ class SB_Instagram_Display_Elements
386
  public static function get_follow_styles( $settings ) {
387
  $styles = '';
388
 
389
- if ( (empty( $settings['colorpalette'] ) || $settings['colorpalette'] === 'inherit') && ( ! empty( $settings['followcolor'] ) || ! empty( $settings['followtextcolor'] ) ) ) {
390
  $styles = ' style="';
391
  if ( ! empty( $settings['followcolor'] ) ) {
392
  $styles .= 'background: rgb(' . esc_attr( sbi_hextorgb( $settings['followcolor'] ) ) . ');';
393
  }
394
  if ( ! empty( $settings['followtextcolor'] ) ) {
395
- $styles .= 'color: rgb(' . esc_attr( sbi_hextorgb( $settings['followtextcolor'] ) ). ');';
396
  }
397
  $styles .= '"';
398
  }
399
- if ( (empty( $settings['colorpalette'] ) || $settings['colorpalette'] === 'inherit') && ! empty( $settings['followhovercolor'] ) ) {
400
  $styles .= ' data-button-hover="' . esc_attr( $settings['followhovercolor'] ) . '"';
401
  }
402
  return $styles;
@@ -419,7 +419,7 @@ class SB_Instagram_Display_Elements
419
  $styles .= 'background: rgb(' . esc_attr( sbi_hextorgb( $settings['buttoncolor'] ) ) . ');';
420
  }
421
  if ( ! empty( $settings['buttontextcolor'] ) ) {
422
- $styles .= 'color: rgb(' . esc_attr( sbi_hextorgb( $settings['buttontextcolor'] ) ). ');';
423
  }
424
  $styles .= '"';
425
  }
@@ -448,7 +448,6 @@ class SB_Instagram_Display_Elements
448
  } else {
449
  return '<i class="fa fa-clone sbi_carousel_icon" aria-hidden="true"></i>';
450
  }
451
-
452
  } elseif ( $type === 'video' ) {
453
  if ( $icon_type === 'svg' ) {
454
  return '<svg style="color: rgba(255,255,255,1)" class="svg-inline--fa fa-play fa-w-14 sbi_playbtn" aria-label="Play" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="play" role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"></path></svg>';
@@ -487,17 +486,17 @@ class SB_Instagram_Display_Elements
487
  * @since 6.0
488
  */
489
  public static function get_feed_container_css_classes( $settings, $additional_classes ) {
490
- $customizer = sbi_doing_customizer( $settings );
491
- $mobilecols_class = SB_Instagram_Display_Elements::get_mobilecols_class( $settings );
492
- $tabletcols_class = SB_Instagram_Display_Elements::get_tabletcols_class( $settings );
493
- $cols_setting = ( $customizer ) ? ' $parent.getColsPreviewScreen() ' : $settings['cols'];
494
  $additional_customizer_classes = ( $customizer ) ? ' $parent.getAdditionalCustomizerClasses() ' : '';
495
- $palette_class = SB_Instagram_Display_Elements::get_palette_class( $settings );
496
 
497
- if ( $customizer ){
498
- return ' :class="\'sbi \' + ' . $mobilecols_class . ' + \' \' + ' . $tabletcols_class .' + \' sbi_col_\' + '. $cols_setting . ' + \' \' + ' . $palette_class . ' + \' \' + ' . $additional_customizer_classes . '" ';
499
  } else {
500
- $classes = 'sbi'. esc_attr( $mobilecols_class ) . esc_attr( $tabletcols_class ) . ' sbi_col_'. esc_attr( $cols_setting ) . esc_attr( $additional_classes ) . esc_attr( $palette_class );
501
  $classes = ' class="' . $classes . '"';
502
  }
503
  return $classes;
@@ -515,11 +514,11 @@ class SB_Instagram_Display_Elements
515
  */
516
  public static function get_palette_class( $settings, $context = '' ) {
517
  $customizer = sbi_doing_customizer( $settings );
518
- if( $customizer ){
519
  return ' $parent.getPaletteClass() ';
520
- }else{
521
- $feed_id_addition = ! empty( $settings['colorpalette'] ) && $settings['colorpalette'] === 'custom' ? '_' . $settings['feed'] : '';
522
- $palette_class = ! empty( $settings['colorpalette'] ) && $settings['colorpalette'] !== 'inherit' ? ' sbi' . $context . '_palette_' . $settings['colorpalette'] . $feed_id_addition : '';
523
  return $palette_class;
524
  }
525
  }
@@ -549,42 +548,60 @@ class SB_Instagram_Display_Elements
549
  public static function get_feed_container_data_attributes( $settings ) {
550
  $customizer = sbi_doing_customizer( $settings );
551
 
552
- $atts = '';
553
- $atts .= SB_Instagram_Display_Elements::print_element_attribute( $customizer, [
554
- 'attr' => 'data-res',
555
- 'vue_content' => '$parent.customizerFeedData.settings.imageres',
556
- 'php_content' => $settings['imageres']
557
- ]);
558
-
559
- $atts .= SB_Instagram_Display_Elements::print_element_attribute( $customizer, [
560
- 'attr' => 'data-cols',
561
- 'vue_content' => '$parent.getColsPreviewScreen()',
562
- 'php_content' => $settings['cols']
563
- ]);
564
-
565
- $atts .= SB_Instagram_Display_Elements::print_element_attribute( $customizer, [
566
- 'attr' => 'data-colsmobile',
567
- 'vue_content' => '$parent.customizerFeedData.settings.colsmobile',
568
- 'php_content' => $settings['colsmobile']
569
- ]);
570
-
571
- $atts .= SB_Instagram_Display_Elements::print_element_attribute( $customizer, [
572
- 'attr' => 'data-colstablet',
573
- 'vue_content' => '$parent.customizerFeedData.settings.colstablet',
574
- 'php_content' => $settings['colstablet']
575
- ]);
576
-
577
- $atts .= SB_Instagram_Display_Elements::print_element_attribute( $customizer, [
578
- 'attr' => 'data-num',
579
- 'vue_content' => '$parent.getModerationShoppableMode ? 10 : $parent.getPostNumberPreviewScreen()',
580
- 'php_content' => $settings['num']
581
- ]);
582
-
583
- $atts .= SB_Instagram_Display_Elements::print_element_attribute( $customizer, [
584
- 'attr' => 'data-nummobile',
585
- 'vue_content' => '$parent.customizerFeedData.settings.nummobile',
586
- 'php_content' => $settings['nummobile']
587
- ]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
588
 
589
  return $atts;
590
  }
@@ -602,13 +619,13 @@ class SB_Instagram_Display_Elements
602
 
603
  $customizer = sbi_doing_customizer( $settings );
604
  if ( $customizer ) {
605
- return ' :class="$parent.getHeaderClass(\''.$type.'\')" ';
606
  } else {
607
- $size_class = SB_Instagram_Display_Elements::get_header_size_class( $settings );
608
- $avatar_class = $avatar !== '' ? '' : ' sbi_no_avatar';
609
- $palette_class = SB_Instagram_Display_Elements::get_palette_class( $settings, '_header' );
610
  $outside_class = $settings['headeroutside'] ? ' sbi_header_outside' : '';
611
- return ' class="sb_instagram_header ' . esc_attr( $size_class ) . esc_attr( $avatar_class ) . esc_attr( $outside_class ) . esc_attr( $palette_class ) .'" ';
612
  }
613
  }
614
 
@@ -622,11 +639,11 @@ class SB_Instagram_Display_Elements
622
  *
623
  * @since 6.0
624
  */
625
- public static function get_header_link( $settings, $username ){
626
- if ( sbi_doing_customizer( $settings ) ){
627
  return ' :href="\'https://www.instagram.com/\' + $parent.getHeaderUserName() "';
628
- } else{
629
- return ' href="'. esc_url( 'https://www.instagram.com/' . $username . '/' ) .'"';
630
  }
631
  }
632
 
@@ -640,8 +657,15 @@ class SB_Instagram_Display_Elements
640
  *
641
  * @since 6.0
642
  */
643
- public static function get_header_link_title( $settings, $username ){
644
- return SB_Instagram_Display_Elements::print_element_attribute( sbi_doing_customizer( $settings ), [ 'attr' => 'title', 'vue_content' => '\'@\' + $parent.getHeaderUserName()', 'php_content' => "@".esc_attr( $username ) ]);
 
 
 
 
 
 
 
645
  }
646
 
647
  /**
@@ -653,8 +677,8 @@ class SB_Instagram_Display_Elements
653
  *
654
  * @since 6.0
655
  */
656
- public static function get_follow_attribute( $settings ){
657
- return SB_Instagram_Display_Elements::should_print_element_vue( sbi_doing_customizer( $settings ), '$parent.customizerFeedData.settings.followtext' );
658
  }
659
 
660
  /**
@@ -666,8 +690,8 @@ class SB_Instagram_Display_Elements
666
  *
667
  * @since 6.0
668
  */
669
- public static function get_button_attribute( $settings ){
670
- return SB_Instagram_Display_Elements::should_print_element_vue( sbi_doing_customizer( $settings ), '$parent.customizerFeedData.settings.buttontext' );
671
  }
672
 
673
  /**
@@ -699,15 +723,15 @@ class SB_Instagram_Display_Elements
699
 
700
  if ( sbi_doing_customizer( $settings ) ) {
701
  if ( isset( $settings['generic_header'] ) ) {
702
- return SB_Instagram_Display_Elements::vue_check_header_enabled( $settings, 'header-generic', $settings['vue_args'] );
703
  }
704
- $header_vue = $settings['vue_args'];
705
  $header_vue['condition'] = $settings['vue_args']['condition'];
706
 
707
- $header_enabeld_vue = SB_Instagram_Display_Elements::vue_check_header_enabled( $settings, 'header', $header_vue );
708
- $atts .= ' ' . $header_enabeld_vue;
709
  }
710
- $avatar = SB_Instagram_Parse::get_avatar( $header_data, $settings );
711
  $story_data_att = '';
712
  if ( sbi_is_pro_version() ) {
713
  $story_data_att = SB_Instagram_Display_Elements_Pro::get_story_attributes( sbi_doing_customizer( $settings ), $settings, $header_data, $avatar );
@@ -730,26 +754,46 @@ class SB_Instagram_Display_Elements
730
  * @since 6.0
731
  */
732
  public static function get_header_img_data_attributes( $settings, $header_data = array(), $location = 'default' ) {
733
- $instagram_cdn_avatar = SB_Instagram_Parse::get_avatar( $header_data, $settings, true );
734
- $doing_customizer = sbi_doing_customizer( $settings );
735
- $return = '';
736
  if ( $settings['headerstyle'] === 'boxed' ) {
737
  if ( ! empty( $instagram_cdn_avatar ) ) {
738
- $return = SB_Instagram_Display_Elements::print_element_attribute( $doing_customizer, [ 'attr' => 'data-avatar-url', 'vue_content' => '$parent.getHeaderAvatar()', 'php_content' => $instagram_cdn_avatar ] );
 
 
 
 
 
 
 
739
  } else {
740
- $return = SB_Instagram_Display_Elements::create_condition_vue( $doing_customizer, '$parent.getHeaderAvatar() === false');
741
  }
742
  } else {
743
  if ( $location !== 'centered' ) {
744
- if ( ! empty( $instagram_cdn_avatar ) || $doing_customizer) {
745
- $return = SB_Instagram_Display_Elements::print_element_attribute( $doing_customizer, [ 'attr' => 'data-avatar-url', 'vue_content' => '$parent.getHeaderAvatar()', 'php_content' => $instagram_cdn_avatar ] ) .
746
- SB_Instagram_Display_Elements::create_condition_vue( $doing_customizer, ' $parent.customizerFeedData.settings.headerstyle !== \'centered\'' );
 
 
 
 
 
 
 
747
  }
748
-
749
  } else {
750
  if ( ! empty( $instagram_cdn_avatar ) || $doing_customizer ) {
751
- $return = SB_Instagram_Display_Elements::print_element_attribute( $doing_customizer, [ 'attr' => 'data-avatar-url', 'vue_content' => '$parent.getHeaderAvatar()', 'php_content' => $instagram_cdn_avatar ] ) .
752
- SB_Instagram_Display_Elements::create_condition_vue( $doing_customizer, ' $parent.customizerFeedData.settings.headerstyle === \'centered\'' );
 
 
 
 
 
 
 
753
  }
754
  }
755
  }
@@ -776,7 +820,14 @@ class SB_Instagram_Display_Elements
776
  $should_show_bio = $settings['showbio'] && $bio !== '';
777
  $bio_class = ! $should_show_bio ? ' sbi_no_bio' : '';
778
 
779
- return SB_Instagram_Display_Elements::print_element_attribute( sbi_doing_customizer( $settings ), [ 'attr' => 'class', 'vue_content' => '$parent.getTextHeaderClass()', 'php_content' => "sbi_header_text".esc_attr( $bio_class ) ]);
 
 
 
 
 
 
 
780
  }
781
 
782
  /**
@@ -793,9 +844,23 @@ class SB_Instagram_Display_Elements
793
  $avatar = SB_Instagram_Parse::get_avatar( $header_data, $settings );
794
  $name = SB_Instagram_Parse::get_name( $header_data );
795
 
796
- return ' ' . SB_Instagram_Display_Elements::print_element_attribute( sbi_doing_customizer( $settings ), [ 'attr' => 'src', 'vue_content' => '$parent.getHeaderAvatar()', 'php_content' => $avatar ] ) .
797
- SB_Instagram_Display_Elements::print_element_attribute( sbi_doing_customizer( $settings ), [ 'attr' => 'alt', 'vue_content' => '$parent.getHeaderName()', 'php_content' => $name ] ).
798
- SB_Instagram_Display_Elements::create_condition_vue( sbi_doing_customizer( $settings ), '$parent.getHeaderAvatar() !== false' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
799
  }
800
 
801
  /**
@@ -808,7 +873,7 @@ class SB_Instagram_Display_Elements
808
  * @since 6.0
809
  */
810
  public static function get_avatar_hover_data_attributes( $settings ) {
811
- return ' '. SB_Instagram_Display_Elements::create_condition_vue( sbi_doing_customizer( $settings ), '$parent.getHeaderAvatar() !== false' );
812
  }
813
 
814
  /**
@@ -821,7 +886,7 @@ class SB_Instagram_Display_Elements
821
  * @since 6.0
822
  */
823
  public static function get_avatar_svg_data_attributes( $settings ) {
824
- return ' '. SB_Instagram_Display_Elements::create_condition_vue( sbi_doing_customizer( $settings ), '$parent.getHeaderAvatar() === false' );
825
  }
826
 
827
  /**
@@ -837,7 +902,7 @@ class SB_Instagram_Display_Elements
837
  if ( ! sbi_doing_customizer( $settings ) ) {
838
  return '';
839
  }
840
- return ' ' . SB_Instagram_Display_Elements::should_show_element_vue( $settings, 'showfollowers' ) . SB_Instagram_Display_Elements::should_print_element_vue( sbi_doing_customizer( $settings ), ' $parent.svgIcons[\'headerPhoto\']+ \' \' + $parent.getHeaderMediaCount()' );
841
  }
842
 
843
  /**
@@ -853,7 +918,7 @@ class SB_Instagram_Display_Elements
853
  if ( ! sbi_doing_customizer( $settings ) ) {
854
  return '';
855
  }
856
- return ' ' . SB_Instagram_Display_Elements::should_show_element_vue( $settings, 'showfollowers' ) . SB_Instagram_Display_Elements::should_print_element_vue( sbi_doing_customizer( $settings ), ' $parent.svgIcons[\'headerUser\'] + \' \' + $parent.getHeaderFollowersCount()' );
857
  }
858
 
859
  /**
@@ -869,7 +934,7 @@ class SB_Instagram_Display_Elements
869
  if ( ! sbi_doing_customizer( $settings ) ) {
870
  return '';
871
  }
872
- return ' ' . SB_Instagram_Display_Elements::should_print_element_vue( sbi_doing_customizer( $settings ), '$parent.customizerFeedData.headerData.username' );
873
  }
874
 
875
  /**
@@ -885,7 +950,7 @@ class SB_Instagram_Display_Elements
885
  if ( ! sbi_doing_customizer( $settings ) ) {
886
  return '';
887
  }
888
- return ' ' . SB_Instagram_Display_Elements::create_condition_vue( sbi_doing_customizer( $settings ), '$parent.checkNotEmpty( $parent.getHeaderBio() ) ? $parent.valueIsEnabled( $parent.customizerFeedData.settings[\'showbio\'] ) : false' );
889
  }
890
 
891
  /**
@@ -898,7 +963,7 @@ class SB_Instagram_Display_Elements
898
  * @since 6.0
899
  */
900
  public static function hoverdisplay_vue_condition( $setting_name ) {
901
- return SB_Instagram_Display_Elements::create_condition_vue( true, '$parent.customizerFeedData.settings.hoverdisplay.includes(\''. $setting_name . '\')' );
902
  }
903
 
904
  /**
@@ -911,7 +976,7 @@ class SB_Instagram_Display_Elements
911
  * @since 6.0
912
  */
913
  public static function display_vue_condition( $setting_name ) {
914
- return SB_Instagram_Display_Elements::create_condition_vue( true, '$parent.valueIsEnabled( $parent.customizerFeedData.settings.'.$setting_name.' )' );
915
  }
916
 
917
  /**
@@ -927,7 +992,7 @@ class SB_Instagram_Display_Elements
927
  if ( ! sbi_doing_customizer( $settings ) ) {
928
  return '';
929
  }
930
- return ' ' . SB_Instagram_Display_Elements::hoverdisplay_vue_condition( 'username' );
931
  }
932
 
933
  /**
@@ -944,9 +1009,9 @@ class SB_Instagram_Display_Elements
944
  return '';
945
  }
946
 
947
- $caption = SB_Instagram_Display_Elements::sanitize_caption( $caption );
948
 
949
- return ' ' . SB_Instagram_Display_Elements::display_vue_condition( 'showcaption' ) . ' v-html="$parent.getPostCaption(\'' . htmlspecialchars($caption) . '\', ' . $post_id . ')"';
950
  }
951
 
952
  /**
@@ -962,7 +1027,7 @@ class SB_Instagram_Display_Elements
962
  if ( ! sbi_doing_customizer( $settings ) ) {
963
  return '';
964
  }
965
- return ' ' . SB_Instagram_Display_Elements::hoverdisplay_vue_condition( 'caption' );
966
  }
967
 
968
 
@@ -975,16 +1040,16 @@ class SB_Instagram_Display_Elements
975
  * @return mixed
976
  */
977
  public static function sanitize_caption( $caption ) {
978
- $caption = str_replace( array( "'"), '`', $caption );
979
- $caption = str_replace( '&amp;', '&', $caption );
980
- $caption = str_replace('&lt;', '<', $caption );
981
- $caption = str_replace('&gt;', '>', $caption );
982
- $caption = str_replace('&quot;', '"', $caption );
983
- $caption = str_replace('&#039;', "/", $caption );
984
- $caption = str_replace('&#92;', '\/', $caption );
985
 
986
  $caption = str_replace( array( "\r", "\n" ), '<br>', $caption );
987
- $caption = str_replace( '&lt;br /&gt;', '<br>', nl2br( $caption ) );
988
 
989
  return $caption;
990
  }
@@ -1002,7 +1067,7 @@ class SB_Instagram_Display_Elements
1002
  if ( ! sbi_doing_customizer( $settings ) ) {
1003
  return '';
1004
  }
1005
- return ' ' . SB_Instagram_Display_Elements::hoverdisplay_vue_condition( 'instagram' );
1006
  }
1007
 
1008
  /**
@@ -1018,7 +1083,7 @@ class SB_Instagram_Display_Elements
1018
  if ( ! sbi_doing_customizer( $settings ) ) {
1019
  return '';
1020
  }
1021
- return ' ' . SB_Instagram_Display_Elements::hoverdisplay_vue_condition( 'date' );
1022
  }
1023
 
1024
  /**
@@ -1034,7 +1099,7 @@ class SB_Instagram_Display_Elements
1034
  if ( ! sbi_doing_customizer( $settings ) ) {
1035
  return '';
1036
  }
1037
- return ' ' . SB_Instagram_Display_Elements::hoverdisplay_vue_condition( 'likes' );
1038
  }
1039
 
1040
  /**
@@ -1050,7 +1115,7 @@ class SB_Instagram_Display_Elements
1050
  if ( ! sbi_doing_customizer( $settings ) ) {
1051
  return '';
1052
  }
1053
- return ' ' . SB_Instagram_Display_Elements::display_vue_condition( 'showlikes' );
1054
  }
1055
 
1056
  /**
@@ -1066,7 +1131,7 @@ class SB_Instagram_Display_Elements
1066
  if ( ! sbi_doing_customizer( $settings ) ) {
1067
  return '';
1068
  }
1069
- return ' ' . SB_Instagram_Display_Elements::display_vue_condition( 'showbutton' );
1070
  }
1071
 
1072
  /**
@@ -1082,7 +1147,7 @@ class SB_Instagram_Display_Elements
1082
  if ( ! sbi_doing_customizer( $settings ) ) {
1083
  return '';
1084
  }
1085
- return ' ' . SB_Instagram_Display_Elements::display_vue_condition( 'showfollow' );
1086
  }
1087
 
1088
  /**
@@ -1123,7 +1188,7 @@ class SB_Instagram_Display_Elements
1123
  public static function vue_check_header_enabled( $settings, $header_type, $vue_args ) {
1124
  $customizer = sbi_doing_customizer( $settings );
1125
  $result_vue = '';
1126
- if ( $customizer ){
1127
  $result_vue = '$parent.valueIsEnabled($parent.customizerFeedData.settings.showheader) ' . $vue_args['condition'];
1128
  $result_vue = ' v-if=" ' . $result_vue . '" ';
1129
  }
@@ -1140,10 +1205,10 @@ class SB_Instagram_Display_Elements
1140
  *
1141
  * @return string
1142
  */
1143
- public static function should_show_element_vue( $settings, $setting_name, $custom_condition = false ){
1144
  $customizer = sbi_doing_customizer( $settings );
1145
  if ( $customizer ) {
1146
- return ' v-if="$parent.valueIsEnabled($parent.customizerFeedData.settings.'.$setting_name.')' . ($custom_condition != false ? $custom_condition : '' ). '" ';
1147
  }
1148
  return '';
1149
  }
@@ -1158,7 +1223,7 @@ class SB_Instagram_Display_Elements
1158
  *
1159
  * @since 6.0
1160
  */
1161
- public static function should_print_element_vue( $customizer, $content ){
1162
  if ( $customizer ) {
1163
  return ' v-html="' . $content . '" ';
1164
  }
@@ -1175,8 +1240,8 @@ class SB_Instagram_Display_Elements
1175
  *
1176
  * @since 6.0
1177
  */
1178
- public static function create_condition_vue( $customizer, $condition ){
1179
- if( $customizer ) {
1180
  return ' v-if="' . $condition . '" ';
1181
  }
1182
  return '';
@@ -1192,7 +1257,7 @@ class SB_Instagram_Display_Elements
1192
  *
1193
  * @since 6.0
1194
  */
1195
- public static function print_element_attribute( $customizer, $args ){
1196
  if ( $customizer ) {
1197
  return ' :' . $args['attr'] . '="' . $args['vue_content'] . '"';
1198
  }
@@ -1209,10 +1274,10 @@ class SB_Instagram_Display_Elements
1209
  *
1210
  * @since 6.0
1211
  */
1212
- public static function get_footer_attributes( $settings ){
1213
  $customizer = sbi_doing_customizer( $settings );
1214
- if($customizer){
1215
- return SB_Instagram_Display_Elements::create_condition_vue( $customizer, '!$parent.getModerationShoppableMode');
1216
  }
1217
  return '';
1218
  }
12
  die( '-1' );
13
  }
14
 
15
+ class SB_Instagram_Display_Elements {
16
+
17
  /**
18
  * Images are hidden initially with the new/transition classes
19
  * except if the js image loading is disabled using the plugin
27
  * @since 2.0/5.0
28
  */
29
  public static function get_item_classes( $settings, $post = false ) {
30
+ $classes = '';
31
  $customizer = sbi_doing_customizer( $settings );
32
+ if ( ! $customizer ) {
33
+ if ( ! $settings['disable_js_image_loading'] ) {
34
  $classes .= ' sbi_new sbi_transition';
35
  } else {
36
  $classes .= ' sbi_new sbi_no_js sbi_no_resraise sbi_js_load_disabled';
37
  }
38
+ } else {
39
  $classes .= ' sbi_new ';
40
  }
41
 
 
42
  if ( $post && SB_Instagram_Parse::get_media_product_type( $post ) === 'igtv' ) {
43
  $classes .= ' sbi_igtv';
44
  }
76
  * @since 2.0/5.0
77
  */
78
  public static function get_optimum_media_url( $post, $settings, $resized_images = array() ) {
79
+ $media_url = '';
80
+ $optimum_res = $settings['imageres'];
81
  $account_type = isset( $post['images'] ) ? 'personal' : 'business';
82
 
83
  // only use the placeholder if it will be replaced using JS
84
+ if ( ! $settings['disable_js_image_loading'] ) {
85
  return trailingslashit( SBI_PLUGIN_URL ) . 'img/placeholder.png';
86
  } elseif ( $settings['imageres'] === 'auto' ) {
87
+ $optimum_res = 'full';
88
  $settings['imageres'] = 'full';
89
  } else {
90
  if ( ! empty( $resized_images ) ) {
91
  $resolution = $settings['imageres'];
92
+ $post_id = SB_Instagram_Parse::get_post_id( $post );
93
  if ( isset( $resized_images[ $post_id ] )
94
+ && $resized_images[ $post_id ]['id'] !== 'error'
95
+ && $resized_images[ $post_id ]['id'] !== 'pending'
96
+ && $resized_images[ $post_id ]['id'] !== 'video' ) {
97
  if ( $resolution === 'thumb' ) {
98
  if ( isset( $resized_images[ $post_id ]['sizes']['low'] ) ) {
99
  $suffix = 'low';
127
 
128
  if ( $account_type === 'personal' ) {
129
  switch ( $optimum_res ) {
130
+ case 'thumb':
131
  $media_url = $post['images']['thumbnail']['url'];
132
  break;
133
+ case 'medium':
134
  $media_url = $post['images']['low_resolution']['url'];
135
  break;
136
+ default:
137
  $media_url = $post['images']['standard_resolution']['url'];
138
  }
139
  } else {
141
 
142
  // use resized images if exists
143
  if ( $optimum_res === 'full' && isset( $resized_images[ $post_id ]['id'] )
144
+ && $resized_images[ $post_id ]['id'] !== 'pending'
145
+ && $resized_images[ $post_id ]['id'] !== 'video'
146
+ && $resized_images[ $post_id ]['id'] !== 'error' ) {
147
  $media_url = sbi_get_resized_uploads_url() . $resized_images[ $post_id ]['id'] . 'full.jpg';
148
  } else {
149
  if ( SB_Instagram_GDPR_Integrations::doing_gdpr( $settings ) ) {
151
  }
152
  $media_type = $post['media_type'];
153
  if ( $media_type === 'CAROUSEL_ALBUM'
154
+ || $media_type === 'VIDEO'
155
+ || $media_type === 'OEMBED' ) {
156
  if ( isset( $post['thumbnail_url'] ) ) {
157
  return $post['thumbnail_url'];
158
  } elseif ( $media_type === 'CAROUSEL_ALBUM' && isset( $post['media_url'] ) ) {
159
  return $post['media_url'];
160
  } elseif ( isset( $post['children'] ) ) {
161
+ $i = 0;
162
  $full_size = '';
163
  foreach ( $post['children']['data'] as $carousel_item ) {
164
  if ( $carousel_item['media_type'] === 'IMAGE' && empty( $full_size ) ) {
180
  }
181
  //attempt to get
182
  $permalink = SB_Instagram_Parse::fix_permalink( SB_Instagram_Parse::get_permalink( $post ) );
183
+ $single = new SB_Instagram_Single( $permalink );
184
  $single->init();
185
  $post = $single->get_post();
186
 
200
  return trailingslashit( SBI_PLUGIN_URL ) . 'img/thumb-placeholder.png';
201
  }
202
  }
 
203
  }
204
 
205
  return $media_url;
220
  * @since 2.1.1/5.2.1 added support for resized images
221
  */
222
  public static function get_sbi_photo_style_element( $post, $settings, $resized_images = array() ) {
223
+ if ( ! $settings['disable_js_image_loading'] ) {
224
  return '';
225
  } else {
226
+ $full_res_image = self::get_optimum_media_url( $post, $settings, $resized_images );
227
  /*
228
  * By setting the height to "0" the bottom padding can be used
229
  * as a percent to square the images. Since it needs to be a percent
231
  */
232
  $padding_bottom = '100%';
233
  if ( $settings['imagepaddingunit'] === '%' ) {
234
+ $padding_bottom = 100 - ( $settings['imagepadding'] * 2 ) . '%';
235
  } else {
236
+ $padding_percent = $settings['imagepadding'] > 0 ? 100 - ( $settings['cols'] / 2 * $settings['imagepadding'] / 5 ) : 100;
237
+ $padding_bottom = $padding_percent . '%';
238
  }
239
  return ' style="background-image: url(&quot;' . esc_url( $full_res_image ) . '&quot;); background-size: cover; background-position: center center; background-repeat: no-repeat; opacity: 1;height: 0;padding-bottom: ' . esc_attr( $padding_bottom ) . ';"';
240
  }
253
  public static function get_feed_style( $settings ) {
254
  $styles = '';
255
  if ( ! empty( $settings['imagepadding'] )
256
+ || ! empty( $settings['background'] )
257
+ || ! empty( $settings['width'] )
258
+ || ! empty( $settings['height'] ) ) {
259
  $styles = ' style="';
260
  if ( ! empty( $settings['imagepadding'] ) ) {
261
+ $styles .= 'padding-bottom: ' . ( (int) $settings['imagepadding'] * 2 ) . esc_attr( $settings['imagepaddingunit'] ) . ';';
262
  }
263
  if ( ! empty( $settings['background'] ) ) {
264
+ $styles .= 'background-color: rgb(' . esc_attr( sbi_hextorgb( $settings['background'] ) ) . ');';
265
  }
266
  if ( ! empty( $settings['width'] ) ) {
267
  $width_unit = ! empty( $settings['widthunit'] ) && $settings['widthunit'] === '%' ? '%' : 'px';
268
+ $styles .= 'width: ' . (int) $settings['width'] . $width_unit . ';';
269
  }
270
  if ( ! empty( $settings['height'] ) ) {
271
  $height_unit = ! empty( $settings['heightunit'] ) && $settings['heightunit'] === '%' ? '%' : 'px';
272
+ $styles .= 'height: ' . (int) $settings['height'] . $height_unit . ';';
273
  }
274
  $styles .= '"';
275
  }
292
  } else {
293
  $disable_mobile = $settings['disablemobile'];
294
  ( $disable_mobile == 'on' || $disable_mobile == 'true' || $disable_mobile == true ) ? $disable_mobile = true : $disable_mobile = false;
295
+ if ( $settings['disablemobile'] === 'false' ) {
296
+ $disable_mobile = '';
297
+ }
298
 
299
  if ( $disable_mobile !== ' sbi_disable_mobile' && $settings['colsmobile'] !== 'same' ) {
300
+ $colsmobile = (int) ( $settings['colsmobile'] ) > 0 ? (int) $settings['colsmobile'] : 'auto';
301
  return ' sbi_mob_col_' . $colsmobile;
302
  } else {
303
+ $colsmobile = (int) ( $settings['cols'] ) > 0 ? (int) $settings['cols'] : 4;
304
  return ' sbi_disable_mobile sbi_mob_col_' . $colsmobile;
305
  }
306
  }
320
  if ( $customizer ) {
321
  return ' $parent.getTabletColsClass() ';
322
  } else {
323
+ $colstablet = (int) ( $settings['colstablet'] ) > 0 ? (int) $settings['colstablet'] : 3;
324
 
325
  return ' sbi_tab_col_' . $colstablet;
326
  }
336
  * @since 6.0
337
  */
338
  public static function get_sbi_images_style( $settings ) {
339
+ if ( ! empty( $settings['imagepadding'] ) ) {
340
+ return ' style="padding: ' . (int) $settings['imagepadding'] . esc_attr( $settings['imagepaddingunit'] ) . ';"';
341
  }
342
  return '';
343
  }
354
  */
355
  public static function get_header_text_color_styles( $settings ) {
356
  if ( ! empty( $settings['headercolor'] ) ) {
357
+ return ' style="color: rgb(' . esc_attr( sbi_hextorgb( $settings['headercolor'] ) ) . ');"';
358
  }
359
  return '';
360
  }
369
  * @since 2.0.1/5.0
370
  */
371
  public static function get_header_size_class( $settings ) {
372
+ $header_size_class = in_array( strtolower( $settings['headersize'] ), array( 'medium', 'large' ) ) ? ' sbi_' . strtolower( $settings['headersize'] ) : '';
373
  return $header_size_class;
374
  }
375
 
386
  public static function get_follow_styles( $settings ) {
387
  $styles = '';
388
 
389
+ if ( ( empty( $settings['colorpalette'] ) || $settings['colorpalette'] === 'inherit' ) && ( ! empty( $settings['followcolor'] ) || ! empty( $settings['followtextcolor'] ) ) ) {
390
  $styles = ' style="';
391
  if ( ! empty( $settings['followcolor'] ) ) {
392
  $styles .= 'background: rgb(' . esc_attr( sbi_hextorgb( $settings['followcolor'] ) ) . ');';
393
  }
394
  if ( ! empty( $settings['followtextcolor'] ) ) {
395
+ $styles .= 'color: rgb(' . esc_attr( sbi_hextorgb( $settings['followtextcolor'] ) ) . ');';
396
  }
397
  $styles .= '"';
398
  }
399
+ if ( ( empty( $settings['colorpalette'] ) || $settings['colorpalette'] === 'inherit' ) && ! empty( $settings['followhovercolor'] ) ) {
400
  $styles .= ' data-button-hover="' . esc_attr( $settings['followhovercolor'] ) . '"';
401
  }
402
  return $styles;
419
  $styles .= 'background: rgb(' . esc_attr( sbi_hextorgb( $settings['buttoncolor'] ) ) . ');';
420
  }
421
  if ( ! empty( $settings['buttontextcolor'] ) ) {
422
+ $styles .= 'color: rgb(' . esc_attr( sbi_hextorgb( $settings['buttontextcolor'] ) ) . ');';
423
  }
424
  $styles .= '"';
425
  }
448
  } else {
449
  return '<i class="fa fa-clone sbi_carousel_icon" aria-hidden="true"></i>';
450
  }
 
451
  } elseif ( $type === 'video' ) {
452
  if ( $icon_type === 'svg' ) {
453
  return '<svg style="color: rgba(255,255,255,1)" class="svg-inline--fa fa-play fa-w-14 sbi_playbtn" aria-label="Play" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="play" role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"></path></svg>';
486
  * @since 6.0
487
  */
488
  public static function get_feed_container_css_classes( $settings, $additional_classes ) {
489
+ $customizer = sbi_doing_customizer( $settings );
490
+ $mobilecols_class = self::get_mobilecols_class( $settings );
491
+ $tabletcols_class = self::get_tabletcols_class( $settings );
492
+ $cols_setting = ( $customizer ) ? ' $parent.getColsPreviewScreen() ' : $settings['cols'];
493
  $additional_customizer_classes = ( $customizer ) ? ' $parent.getAdditionalCustomizerClasses() ' : '';
494
+ $palette_class = self::get_palette_class( $settings );
495
 
496
+ if ( $customizer ) {
497
+ return ' :class="\'sbi \' + ' . $mobilecols_class . ' + \' \' + ' . $tabletcols_class . ' + \' sbi_col_\' + ' . $cols_setting . ' + \' \' + ' . $palette_class . ' + \' \' + ' . $additional_customizer_classes . '" ';
498
  } else {
499
+ $classes = 'sbi' . esc_attr( $mobilecols_class ) . esc_attr( $tabletcols_class ) . ' sbi_col_' . esc_attr( $cols_setting ) . esc_attr( $additional_classes ) . esc_attr( $palette_class );
500
  $classes = ' class="' . $classes . '"';
501
  }
502
  return $classes;
514
  */
515
  public static function get_palette_class( $settings, $context = '' ) {
516
  $customizer = sbi_doing_customizer( $settings );
517
+ if ( $customizer ) {
518
  return ' $parent.getPaletteClass() ';
519
+ } else {
520
+ $feed_id_addition = ! empty( $settings['colorpalette'] ) && $settings['colorpalette'] === 'custom' ? '_' . $settings['feed'] : '';
521
+ $palette_class = ! empty( $settings['colorpalette'] ) && $settings['colorpalette'] !== 'inherit' ? ' sbi' . $context . '_palette_' . $settings['colorpalette'] . $feed_id_addition : '';
522
  return $palette_class;
523
  }
524
  }
548
  public static function get_feed_container_data_attributes( $settings ) {
549
  $customizer = sbi_doing_customizer( $settings );
550
 
551
+ $atts = '';
552
+ $atts .= self::print_element_attribute(
553
+ $customizer,
554
+ array(
555
+ 'attr' => 'data-res',
556
+ 'vue_content' => '$parent.customizerFeedData.settings.imageres',
557
+ 'php_content' => $settings['imageres'],
558
+ )
559
+ );
560
+
561
+ $atts .= self::print_element_attribute(
562
+ $customizer,
563
+ array(
564
+ 'attr' => 'data-cols',
565
+ 'vue_content' => '$parent.getColsPreviewScreen()',
566
+ 'php_content' => $settings['cols'],
567
+ )
568
+ );
569
+
570
+ $atts .= self::print_element_attribute(
571
+ $customizer,
572
+ array(
573
+ 'attr' => 'data-colsmobile',
574
+ 'vue_content' => '$parent.customizerFeedData.settings.colsmobile',
575
+ 'php_content' => $settings['colsmobile'],
576
+ )
577
+ );
578
+
579
+ $atts .= self::print_element_attribute(
580
+ $customizer,
581
+ array(
582
+ 'attr' => 'data-colstablet',
583
+ 'vue_content' => '$parent.customizerFeedData.settings.colstablet',
584
+ 'php_content' => $settings['colstablet'],
585
+ )
586
+ );
587
+
588
+ $atts .= self::print_element_attribute(
589
+ $customizer,
590
+ array(
591
+ 'attr' => 'data-num',
592
+ 'vue_content' => '$parent.getModerationShoppableMode ? 10 : $parent.getPostNumberPreviewScreen()',
593
+ 'php_content' => $settings['num'],
594
+ )
595
+ );
596
+
597
+ $atts .= self::print_element_attribute(
598
+ $customizer,
599
+ array(
600
+ 'attr' => 'data-nummobile',
601
+ 'vue_content' => '$parent.customizerFeedData.settings.nummobile',
602
+ 'php_content' => $settings['nummobile'],
603
+ )
604
+ );
605
 
606
  return $atts;
607
  }
619
 
620
  $customizer = sbi_doing_customizer( $settings );
621
  if ( $customizer ) {
622
+ return ' :class="$parent.getHeaderClass(\'' . $type . '\')" ';
623
  } else {
624
+ $size_class = self::get_header_size_class( $settings );
625
+ $avatar_class = $avatar !== '' ? '' : ' sbi_no_avatar';
626
+ $palette_class = self::get_palette_class( $settings, '_header' );
627
  $outside_class = $settings['headeroutside'] ? ' sbi_header_outside' : '';
628
+ return ' class="sb_instagram_header ' . esc_attr( $size_class ) . esc_attr( $avatar_class ) . esc_attr( $outside_class ) . esc_attr( $palette_class ) . '" ';
629
  }
630
  }
631
 
639
  *
640
  * @since 6.0
641
  */
642
+ public static function get_header_link( $settings, $username ) {
643
+ if ( sbi_doing_customizer( $settings ) ) {
644
  return ' :href="\'https://www.instagram.com/\' + $parent.getHeaderUserName() "';
645
+ } else {
646
+ return ' href="' . esc_url( 'https://www.instagram.com/' . $username . '/' ) . '"';
647
  }
648
  }
649
 
657
  *
658
  * @since 6.0
659
  */
660
+ public static function get_header_link_title( $settings, $username ) {
661
+ return self::print_element_attribute(
662
+ sbi_doing_customizer( $settings ),
663
+ array(
664
+ 'attr' => 'title',
665
+ 'vue_content' => '\'@\' + $parent.getHeaderUserName()',
666
+ 'php_content' => '@' . esc_attr( $username ),
667
+ )
668
+ );
669
  }
670
 
671
  /**
677
  *
678
  * @since 6.0
679
  */
680
+ public static function get_follow_attribute( $settings ) {
681
+ return self::should_print_element_vue( sbi_doing_customizer( $settings ), '$parent.customizerFeedData.settings.followtext' );
682
  }
683
 
684
  /**
690
  *
691
  * @since 6.0
692
  */
693
+ public static function get_button_attribute( $settings ) {
694
+ return self::should_print_element_vue( sbi_doing_customizer( $settings ), '$parent.customizerFeedData.settings.buttontext' );
695
  }
696
 
697
  /**
723
 
724
  if ( sbi_doing_customizer( $settings ) ) {
725
  if ( isset( $settings['generic_header'] ) ) {
726
+ return self::vue_check_header_enabled( $settings, 'header-generic', $settings['vue_args'] );
727
  }
728
+ $header_vue = $settings['vue_args'];
729
  $header_vue['condition'] = $settings['vue_args']['condition'];
730
 
731
+ $header_enabeld_vue = self::vue_check_header_enabled( $settings, 'header', $header_vue );
732
+ $atts .= ' ' . $header_enabeld_vue;
733
  }
734
+ $avatar = SB_Instagram_Parse::get_avatar( $header_data, $settings );
735
  $story_data_att = '';
736
  if ( sbi_is_pro_version() ) {
737
  $story_data_att = SB_Instagram_Display_Elements_Pro::get_story_attributes( sbi_doing_customizer( $settings ), $settings, $header_data, $avatar );
754
  * @since 6.0
755
  */
756
  public static function get_header_img_data_attributes( $settings, $header_data = array(), $location = 'default' ) {
757
+ $instagram_cdn_avatar = SB_Instagram_Parse::get_avatar( $header_data, $settings, true );
758
+ $doing_customizer = sbi_doing_customizer( $settings );
759
+ $return = '';
760
  if ( $settings['headerstyle'] === 'boxed' ) {
761
  if ( ! empty( $instagram_cdn_avatar ) ) {
762
+ $return = self::print_element_attribute(
763
+ $doing_customizer,
764
+ array(
765
+ 'attr' => 'data-avatar-url',
766
+ 'vue_content' => '$parent.getHeaderAvatar()',
767
+ 'php_content' => $instagram_cdn_avatar,
768
+ )
769
+ );
770
  } else {
771
+ $return = self::create_condition_vue( $doing_customizer, '$parent.getHeaderAvatar() === false' );
772
  }
773
  } else {
774
  if ( $location !== 'centered' ) {
775
+ if ( ! empty( $instagram_cdn_avatar ) || $doing_customizer ) {
776
+ $return = self::print_element_attribute(
777
+ $doing_customizer,
778
+ array(
779
+ 'attr' => 'data-avatar-url',
780
+ 'vue_content' => '$parent.getHeaderAvatar()',
781
+ 'php_content' => $instagram_cdn_avatar,
782
+ )
783
+ ) .
784
+ self::create_condition_vue( $doing_customizer, ' $parent.customizerFeedData.settings.headerstyle !== \'centered\'' );
785
  }
 
786
  } else {
787
  if ( ! empty( $instagram_cdn_avatar ) || $doing_customizer ) {
788
+ $return = self::print_element_attribute(
789
+ $doing_customizer,
790
+ array(
791
+ 'attr' => 'data-avatar-url',
792
+ 'vue_content' => '$parent.getHeaderAvatar()',
793
+ 'php_content' => $instagram_cdn_avatar,
794
+ )
795
+ ) .
796
+ self::create_condition_vue( $doing_customizer, ' $parent.customizerFeedData.settings.headerstyle === \'centered\'' );
797
  }
798
  }
799
  }
820
  $should_show_bio = $settings['showbio'] && $bio !== '';
821
  $bio_class = ! $should_show_bio ? ' sbi_no_bio' : '';
822
 
823
+ return self::print_element_attribute(
824
+ sbi_doing_customizer( $settings ),
825
+ array(
826
+ 'attr' => 'class',
827
+ 'vue_content' => '$parent.getTextHeaderClass()',
828
+ 'php_content' => 'sbi_header_text' . esc_attr( $bio_class ),
829
+ )
830
+ );
831
  }
832
 
833
  /**
844
  $avatar = SB_Instagram_Parse::get_avatar( $header_data, $settings );
845
  $name = SB_Instagram_Parse::get_name( $header_data );
846
 
847
+ return ' ' . self::print_element_attribute(
848
+ sbi_doing_customizer( $settings ),
849
+ array(
850
+ 'attr' => 'src',
851
+ 'vue_content' => '$parent.getHeaderAvatar()',
852
+ 'php_content' => $avatar,
853
+ )
854
+ ) .
855
+ self::print_element_attribute(
856
+ sbi_doing_customizer( $settings ),
857
+ array(
858
+ 'attr' => 'alt',
859
+ 'vue_content' => '$parent.getHeaderName()',
860
+ 'php_content' => $name,
861
+ )
862
+ ) .
863
+ self::create_condition_vue( sbi_doing_customizer( $settings ), '$parent.getHeaderAvatar() !== false' );
864
  }
865
 
866
  /**
873
  * @since 6.0
874
  */
875
  public static function get_avatar_hover_data_attributes( $settings ) {
876
+ return ' ' . self::create_condition_vue( sbi_doing_customizer( $settings ), '$parent.getHeaderAvatar() !== false' );
877
  }
878
 
879
  /**
886
  * @since 6.0
887
  */
888
  public static function get_avatar_svg_data_attributes( $settings ) {
889
+ return ' ' . self::create_condition_vue( sbi_doing_customizer( $settings ), '$parent.getHeaderAvatar() === false' );
890
  }
891
 
892
  /**
902
  if ( ! sbi_doing_customizer( $settings ) ) {
903
  return '';
904
  }
905
+ return ' ' . self::should_show_element_vue( $settings, 'showfollowers' ) . self::should_print_element_vue( sbi_doing_customizer( $settings ), ' $parent.svgIcons[\'headerPhoto\']+ \' \' + $parent.getHeaderMediaCount()' );
906
  }
907
 
908
  /**
918
  if ( ! sbi_doing_customizer( $settings ) ) {
919
  return '';
920
  }
921
+ return ' ' . self::should_show_element_vue( $settings, 'showfollowers' ) . self::should_print_element_vue( sbi_doing_customizer( $settings ), ' $parent.svgIcons[\'headerUser\'] + \' \' + $parent.getHeaderFollowersCount()' );
922
  }
923
 
924
  /**
934
  if ( ! sbi_doing_customizer( $settings ) ) {
935
  return '';
936
  }
937
+ return ' ' . self::should_print_element_vue( sbi_doing_customizer( $settings ), '$parent.customizerFeedData.headerData.username' );
938
  }
939
 
940
  /**
950
  if ( ! sbi_doing_customizer( $settings ) ) {
951
  return '';
952
  }
953
+ return ' ' . self::create_condition_vue( sbi_doing_customizer( $settings ), '$parent.checkNotEmpty( $parent.getHeaderBio() ) ? $parent.valueIsEnabled( $parent.customizerFeedData.settings[\'showbio\'] ) : false' );
954
  }
955
 
956
  /**
963
  * @since 6.0
964
  */
965
  public static function hoverdisplay_vue_condition( $setting_name ) {
966
+ return self::create_condition_vue( true, '$parent.customizerFeedData.settings.hoverdisplay.includes(\'' . $setting_name . '\')' );
967
  }
968
 
969
  /**
976
  * @since 6.0
977
  */
978
  public static function display_vue_condition( $setting_name ) {
979
+ return self::create_condition_vue( true, '$parent.valueIsEnabled( $parent.customizerFeedData.settings.' . $setting_name . ' )' );
980
  }
981
 
982
  /**
992
  if ( ! sbi_doing_customizer( $settings ) ) {
993
  return '';
994
  }
995
+ return ' ' . self::hoverdisplay_vue_condition( 'username' );
996
  }
997
 
998
  /**
1009
  return '';
1010
  }
1011
 
1012
+ $caption = self::sanitize_caption( $caption );
1013
 
1014
+ return ' ' . self::display_vue_condition( 'showcaption' ) . ' v-html="$parent.getPostCaption(\'' . htmlspecialchars( $caption ) . '\', ' . $post_id . ')"';
1015
  }
1016
 
1017
  /**
1027
  if ( ! sbi_doing_customizer( $settings ) ) {
1028
  return '';
1029
  }
1030
+ return ' ' . self::hoverdisplay_vue_condition( 'caption' );
1031
  }
1032
 
1033
 
1040
  * @return mixed
1041
  */
1042
  public static function sanitize_caption( $caption ) {
1043
+ $caption = str_replace( array( "'" ), '`', $caption );
1044
+ $caption = str_replace( '&amp;', '&', $caption );
1045
+ $caption = str_replace( '&lt;', '<', $caption );
1046
+ $caption = str_replace( '&gt;', '>', $caption );
1047
+ $caption = str_replace( '&quot;', '"', $caption );
1048
+ $caption = str_replace( '&#039;', '/', $caption );
1049
+ $caption = str_replace( '&#92;', '\/', $caption );
1050
 
1051
  $caption = str_replace( array( "\r", "\n" ), '<br>', $caption );
1052
+ $caption = str_replace( '&lt;br /&gt;', '<br>', nl2br( $caption ) );
1053
 
1054
  return $caption;
1055
  }
1067
  if ( ! sbi_doing_customizer( $settings ) ) {
1068
  return '';
1069
  }
1070
+ return ' ' . self::hoverdisplay_vue_condition( 'instagram' );
1071
  }
1072
 
1073
  /**
1083
  if ( ! sbi_doing_customizer( $settings ) ) {
1084
  return '';
1085
  }
1086
+ return ' ' . self::hoverdisplay_vue_condition( 'date' );
1087
  }
1088
 
1089
  /**
1099
  if ( ! sbi_doing_customizer( $settings ) ) {
1100
  return '';
1101
  }
1102
+ return ' ' . self::hoverdisplay_vue_condition( 'likes' );
1103
  }
1104
 
1105
  /**
1115
  if ( ! sbi_doing_customizer( $settings ) ) {
1116
  return '';
1117
  }
1118
+ return ' ' . self::display_vue_condition( 'showlikes' );
1119
  }
1120
 
1121
  /**
1131
  if ( ! sbi_doing_customizer( $settings ) ) {
1132
  return '';
1133
  }
1134
+ return ' ' . self::display_vue_condition( 'showbutton' );
1135
  }
1136
 
1137
  /**
1147
  if ( ! sbi_doing_customizer( $settings ) ) {
1148
  return '';
1149
  }
1150
+ return ' ' . self::display_vue_condition( 'showfollow' );
1151
  }
1152
 
1153
  /**
1188
  public static function vue_check_header_enabled( $settings, $header_type, $vue_args ) {
1189
  $customizer = sbi_doing_customizer( $settings );
1190
  $result_vue = '';
1191
+ if ( $customizer ) {
1192
  $result_vue = '$parent.valueIsEnabled($parent.customizerFeedData.settings.showheader) ' . $vue_args['condition'];
1193
  $result_vue = ' v-if=" ' . $result_vue . '" ';
1194
  }
1205
  *
1206
  * @return string
1207
  */
1208
+ public static function should_show_element_vue( $settings, $setting_name, $custom_condition = false ) {
1209
  $customizer = sbi_doing_customizer( $settings );
1210
  if ( $customizer ) {
1211
+ return ' v-if="$parent.valueIsEnabled($parent.customizerFeedData.settings.' . $setting_name . ')' . ( $custom_condition != false ? $custom_condition : '' ) . '" ';
1212
  }
1213
  return '';
1214
  }
1223
  *
1224
  * @since 6.0
1225
  */
1226
+ public static function should_print_element_vue( $customizer, $content ) {
1227
  if ( $customizer ) {
1228
  return ' v-html="' . $content . '" ';
1229
  }
1240
  *
1241
  * @since 6.0
1242
  */
1243
+ public static function create_condition_vue( $customizer, $condition ) {
1244
+ if ( $customizer ) {
1245
  return ' v-if="' . $condition . '" ';
1246
  }
1247
  return '';
1257
  *
1258
  * @since 6.0
1259
  */
1260
+ public static function print_element_attribute( $customizer, $args ) {
1261
  if ( $customizer ) {
1262
  return ' :' . $args['attr'] . '="' . $args['vue_content'] . '"';
1263
  }
1274
  *
1275
  * @since 6.0
1276
  */
1277
+ public static function get_footer_attributes( $settings ) {
1278
  $customizer = sbi_doing_customizer( $settings );
1279
+ if ( $customizer ) {
1280
+ return self::create_condition_vue( $customizer, '!$parent.getModerationShoppableMode' );
1281
  }
1282
  return '';
1283
  }
inc/class-sb-instagram-settings.php CHANGED
@@ -327,7 +327,7 @@ class SB_Instagram_Settings {
327
  $settings['ajaxtheme'] = $atts['ajaxtheme'] === 'true';
328
  } else {
329
  $db = sbi_get_database_settings();
330
- $settings['ajaxtheme'] = isset( $db['sb_instagram_ajax_theme'] ) ? $db['sb_instagram_ajax_theme'] === '1' || $db['sb_instagram_ajax_theme'] === true : false;
331
  }
332
 
333
  return $settings;
327
  $settings['ajaxtheme'] = $atts['ajaxtheme'] === 'true';
328
  } else {
329
  $db = sbi_get_database_settings();
330
+ $settings['ajaxtheme'] = isset( $db['sb_instagram_ajax_theme'] ) ? $db['sb_instagram_ajax_theme'] === '1' || $db['sb_instagram_ajax_theme'] === true || $db['sb_instagram_ajax_theme'] === 'on' : false;
331
  }
332
 
333
  return $settings;
inc/if-functions.php CHANGED
@@ -30,7 +30,8 @@ function display_instagram( $atts = array(), $preview_settings = false ) {
30
 
31
  if ( $database_settings['sb_instagram_ajax_theme'] !== 'on'
32
  && $database_settings['sb_instagram_ajax_theme'] !== 'true'
33
- && $database_settings['sb_instagram_ajax_theme'] !== '1' ) {
 
34
  wp_enqueue_script( 'sbi_scripts' );
35
  }
36
 
@@ -600,11 +601,11 @@ function sbi_debug_report( $instagram_feed, $feed_id ) {
600
  $atts = array( 'feed' => 1 );
601
  }
602
 
603
- $settings_obj = new SB_Instagram_Settings_Pro( $atts, sbi_get_database_settings() );
604
 
605
  $settings = $settings_obj->get_settings();
606
 
607
- $public_settings_keys = SB_Instagram_Settings_Pro::get_public_db_settings_keys();
608
  ?>
609
 
610
  <p>Status</p>
@@ -792,7 +793,7 @@ function sbi_get_database_settings() {
792
  'sb_instagram_disable_resize' => false,
793
  'sb_instagram_cache_time' => 1,
794
  'sb_instagram_cache_time_unit' => 'hours',
795
- 'sbi_caching_type' => 'page',
796
  'sbi_cache_cron_interval' => '12hours',
797
  'sbi_cache_cron_time' => '1',
798
  'sbi_cache_cron_am_pm' => 'am',
30
 
31
  if ( $database_settings['sb_instagram_ajax_theme'] !== 'on'
32
  && $database_settings['sb_instagram_ajax_theme'] !== 'true'
33
+ && $database_settings['sb_instagram_ajax_theme'] !== '1'
34
+ && $database_settings['sb_instagram_ajax_theme'] !== true ) {
35
  wp_enqueue_script( 'sbi_scripts' );
36
  }
37
 
601
  $atts = array( 'feed' => 1 );
602
  }
603
 
604
+ $settings_obj = new SB_Instagram_Settings( $atts, sbi_get_database_settings() );
605
 
606
  $settings = $settings_obj->get_settings();
607
 
608
+ $public_settings_keys = SB_Instagram_Settings::get_public_db_settings_keys();
609
  ?>
610
 
611
  <p>Status</p>
793
  'sb_instagram_disable_resize' => false,
794
  'sb_instagram_cache_time' => 1,
795
  'sb_instagram_cache_time_unit' => 'hours',
796
+ 'sbi_caching_type' => 'background',
797
  'sbi_cache_cron_interval' => '12hours',
798
  'sbi_cache_cron_time' => '1',
799
  'sbi_cache_cron_am_pm' => 'am',
instagram-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Smash Balloon Instagram Feed
4
  Plugin URI: https://smashballoon.com/instagram-feed
5
  Description: Display beautifully clean, customizable, and responsive Instagram feeds.
6
- Version: 6.0.1
7
  Author: Smash Balloon
8
  Author URI: https://smashballoon.com/
9
  License: GPLv2 or later
@@ -29,7 +29,7 @@ if ( ! defined( 'SBI_PLUGIN_NAME' ) ) {
29
  define( 'SBI_PLUGIN_NAME', 'Instagram Feed Free' );
30
  }
31
  if ( ! defined( 'SBIVER' ) ) {
32
- define( 'SBIVER', '6.0.1' );
33
  }
34
  // Db version.
35
  if ( ! defined( 'SBI_DBVERSION' ) ) {
@@ -353,7 +353,18 @@ if ( function_exists( 'sb_instagram_feed_init' ) ) {
353
  *
354
  * @since 2.0
355
  */
356
- function sbi_create_database_table() {
 
 
 
 
 
 
 
 
 
 
 
357
  global $wpdb;
358
  global $sb_instagram_posts_manager;
359
 
@@ -364,102 +375,61 @@ if ( function_exists( 'sb_instagram_feed_init' ) ) {
364
  $sb_instagram_posts_manager = new SB_Instagram_Posts_Manager();
365
  }
366
 
367
- global $wp_version;
368
-
369
- if ( version_compare( $wp_version, '3.5', '<' ) ) {
370
- $table_name = esc_sql( $wpdb->prefix . SBI_INSTAGRAM_POSTS_TYPE );
371
-
372
- if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) {
373
- $sql = "CREATE TABLE " . $table_name . " (
374
- id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
375
- created_on DATETIME,
376
- instagram_id VARCHAR(1000) DEFAULT '' NOT NULL,
377
- time_stamp DATETIME,
378
- top_time_stamp DATETIME,
379
- json_data LONGTEXT DEFAULT '' NOT NULL,
380
- media_id VARCHAR(1000) DEFAULT '' NOT NULL,
381
- sizes VARCHAR(1000) DEFAULT '' NOT NULL,
382
- aspect_ratio DECIMAL (4,2) DEFAULT 0 NOT NULL,
383
- images_done TINYINT(1) DEFAULT 0 NOT NULL,
384
- last_requested DATE
385
- );";
386
- $wpdb->query( $sql );
387
- }
388
-
389
- $feeds_posts_table_name = esc_sql( $wpdb->prefix . SBI_INSTAGRAM_FEEDS_POSTS );
390
-
391
- if ( $wpdb->get_var( "show tables like '$feeds_posts_table_name'" ) != $feeds_posts_table_name ) {
392
- $sql = "CREATE TABLE " . $feeds_posts_table_name . " (
393
- record_id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
394
- id INT(11) UNSIGNED NOT NULL,
395
- instagram_id VARCHAR(1000) DEFAULT '' NOT NULL,
396
- feed_id VARCHAR(1000) DEFAULT '' NOT NULL,
397
- hashtag VARCHAR(1000) DEFAULT '' NOT NULL,
398
- INDEX hashtag (hashtag(100)),
399
- INDEX feed_id (feed_id(100))
400
- );";
401
- $wpdb->query( $sql );
402
- }
403
-
404
- return;
405
- } else {
406
- $charset_collate = $wpdb->get_charset_collate();
407
- $table_name = esc_sql( $wpdb->prefix . SBI_INSTAGRAM_POSTS_TYPE );
408
-
409
- if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) {
410
- $sql = "CREATE TABLE " . $table_name . " (
411
- id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
412
- created_on DATETIME,
413
- instagram_id VARCHAR(1000) DEFAULT '' NOT NULL,
414
- time_stamp DATETIME,
415
- top_time_stamp DATETIME,
416
- json_data LONGTEXT DEFAULT '' NOT NULL,
417
- media_id VARCHAR(1000) DEFAULT '' NOT NULL,
418
- sizes VARCHAR(1000) DEFAULT '' NOT NULL,
419
- aspect_ratio DECIMAL (4,2) DEFAULT 0 NOT NULL,
420
- images_done TINYINT(1) DEFAULT 0 NOT NULL,
421
- last_requested DATE
422
- ) $charset_collate;";
423
- $wpdb->query( $sql );
424
- }
425
- $error = $wpdb->last_error;
426
- $query = $wpdb->last_query;
427
 
428
- if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) {
429
- $had_error = true;
430
- $sb_instagram_posts_manager->add_error( 'database_create', '<strong>' . __( 'There was an error when trying to create the database tables used for resizing images.', 'instagram-feed' ) .'</strong><br>' . $error . '<br><code>' . $query . '</code>' );
431
- }
432
 
433
- $feeds_posts_table_name = esc_sql( $wpdb->prefix . SBI_INSTAGRAM_FEEDS_POSTS );
434
-
435
- if ( $wpdb->get_var( "show tables like '$feeds_posts_table_name'" ) != $feeds_posts_table_name ) {
436
- $sql = "CREATE TABLE " . $feeds_posts_table_name . " (
437
- record_id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
438
- id INT(11) UNSIGNED NOT NULL,
439
- instagram_id VARCHAR(1000) DEFAULT '' NOT NULL,
440
- feed_id VARCHAR(1000) DEFAULT '' NOT NULL,
441
- hashtag VARCHAR(1000) DEFAULT '' NOT NULL,
442
- INDEX hashtag (hashtag(100)),
443
- INDEX feed_id (feed_id(100))
444
- ) $charset_collate;";
445
- $wpdb->query( $sql );
446
- $sbi_statuses_option = get_option( 'sbi_statuses', array() );
447
 
448
- $sbi_statuses_option['database']['hashtag_column'] = true;
449
 
450
- update_option( 'sbi_statuses', $sbi_statuses_option );
451
- }
452
- $error = $wpdb->last_error;
453
- $query = $wpdb->last_query;
454
 
455
- if ( $wpdb->get_var( "show tables like '$feeds_posts_table_name'" ) != $feeds_posts_table_name ) {
456
- $had_error = true;
457
- $sb_instagram_posts_manager->add_error( 'database_create', '<strong>' . __( 'There was an error when trying to create the database tables used for resizing images.', 'instagram-feed' ) .'</strong><br>' . $error . '<br><code>' . $query . '</code>' );
458
- }
459
 
460
- if ( ! $had_error ) {
461
- $sb_instagram_posts_manager->remove_error( 'database_create' );
462
- }
463
  }
464
  }
465
 
3
  Plugin Name: Smash Balloon Instagram Feed
4
  Plugin URI: https://smashballoon.com/instagram-feed
5
  Description: Display beautifully clean, customizable, and responsive Instagram feeds.
6
+ Version: 6.0.2
7
  Author: Smash Balloon
8
  Author URI: https://smashballoon.com/
9
  License: GPLv2 or later
29
  define( 'SBI_PLUGIN_NAME', 'Instagram Feed Free' );
30
  }
31
  if ( ! defined( 'SBIVER' ) ) {
32
+ define( 'SBIVER', '6.0.2' );
33
  }
34
  // Db version.
35
  if ( ! defined( 'SBI_DBVERSION' ) ) {
353
  *
354
  * @since 2.0
355
  */
356
+ function sbi_create_database_table ( $include_charset_collate = true ) {
357
+ if ( ! function_exists( 'dbDelta' ) ) {
358
+ require_once ABSPATH . '/wp-admin/includes/upgrade.php';
359
+ }
360
+
361
+ global $wpdb;
362
+ $max_index_length = 191;
363
+ $charset_collate = '';
364
+ if ( $include_charset_collate && method_exists( $wpdb, 'get_charset_collate' ) ) { // get_charset_collate introduced in WP 3.5
365
+ $charset_collate = $wpdb->get_charset_collate();
366
+ }
367
+
368
  global $wpdb;
369
  global $sb_instagram_posts_manager;
370
 
375
  $sb_instagram_posts_manager = new SB_Instagram_Posts_Manager();
376
  }
377
 
378
+ $table_name = esc_sql( $wpdb->prefix . SBI_INSTAGRAM_POSTS_TYPE );
379
+
380
+ if ( $wpdb->get_var( "show tables like '$table_name'" ) !== $table_name ) {
381
+ $sql = "CREATE TABLE " . $table_name . " (
382
+ id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
383
+ created_on DATETIME,
384
+ instagram_id VARCHAR(1000) DEFAULT '' NOT NULL,
385
+ time_stamp DATETIME,
386
+ top_time_stamp DATETIME,
387
+ json_data LONGTEXT DEFAULT '' NOT NULL,
388
+ media_id VARCHAR(1000) DEFAULT '' NOT NULL,
389
+ sizes VARCHAR(1000) DEFAULT '' NOT NULL,
390
+ aspect_ratio DECIMAL (4,2) DEFAULT 0 NOT NULL,
391
+ images_done TINYINT(1) DEFAULT 0 NOT NULL,
392
+ last_requested DATE
393
+ ) $charset_collate;";
394
+ $wpdb->query( $sql );
395
+ }
396
+ $error = $wpdb->last_error;
397
+ $query = $wpdb->last_query;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
398
 
399
+ if ( $wpdb->get_var( "show tables like '$table_name'" ) !== $table_name ) {
400
+ $had_error = true;
401
+ $sb_instagram_posts_manager->add_error( 'database_create', '<strong>' . __( 'There was an error when trying to create the database tables used for resizing images.', 'instagram-feed' ) .'</strong><br>' . $error . '<br><code>' . $query . '</code>' );
402
+ }
403
 
404
+ $feeds_posts_table_name = esc_sql( $wpdb->prefix . SBI_INSTAGRAM_FEEDS_POSTS );
405
+
406
+ if ( $wpdb->get_var( "show tables like '$feeds_posts_table_name'" ) != $feeds_posts_table_name ) {
407
+ $sql = "CREATE TABLE " . $feeds_posts_table_name . " (
408
+ record_id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
409
+ id INT(11) UNSIGNED NOT NULL,
410
+ instagram_id VARCHAR(1000) DEFAULT '' NOT NULL,
411
+ feed_id VARCHAR(1000) DEFAULT '' NOT NULL,
412
+ hashtag VARCHAR(1000) DEFAULT '' NOT NULL,
413
+ INDEX hashtag (hashtag($max_index_length)),
414
+ INDEX feed_id (feed_id($max_index_length))
415
+ ) $charset_collate;";
416
+ $wpdb->query( $sql );
417
+ $sbi_statuses_option = get_option( 'sbi_statuses', array() );
418
 
419
+ $sbi_statuses_option['database']['hashtag_column'] = true;
420
 
421
+ update_option( 'sbi_statuses', $sbi_statuses_option );
422
+ }
423
+ $error = $wpdb->last_error;
424
+ $query = $wpdb->last_query;
425
 
426
+ if ( $wpdb->get_var( "show tables like '$feeds_posts_table_name'" ) != $feeds_posts_table_name ) {
427
+ $had_error = true;
428
+ $sb_instagram_posts_manager->add_error( 'database_create', '<strong>' . __( 'There was an error when trying to create the database tables used for resizing images.', 'instagram-feed' ) .'</strong><br>' . $error . '<br><code>' . $query . '</code>' );
429
+ }
430
 
431
+ if ( ! $had_error ) {
432
+ $sb_instagram_posts_manager->remove_error( 'database_create' );
 
433
  }
434
  }
435
 
js/sb-instagram-admin-6.js CHANGED
@@ -72,6 +72,28 @@ jQuery(document).ready(function($) {
72
  });
73
  });
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  $('.sbi-clear-errors-visit-page').on('click', function(event) {
76
  event.preventDefault();
77
  var $btn = $(this);
72
  });
73
  });
74
 
75
+ $('.sbi-retry-db').on('click', function(event) {
76
+ event.preventDefault();
77
+ var $btn = $(this);
78
+ $btn.prop( 'disabled', true ).addClass( 'loading' ).html('<i class="fa fa-spinner fa-spin" aria-hidden="true"></i>');
79
+ $.ajax({
80
+ url : sbiA.ajax_url,
81
+ type : 'post',
82
+ data : {
83
+ action : 'sbi_retry_db',
84
+ sbi_nonce : sbiA.sbi_nonce,
85
+ },
86
+ success : function(data) {
87
+ if (typeof data.data.message !== 'undefined') {
88
+ $btn.closest('p').after(data.data.message);
89
+ $btn.remove();
90
+ }
91
+ },
92
+ error : function(data) {
93
+ }
94
+ }); // ajax call
95
+ });
96
+
97
  $('.sbi-clear-errors-visit-page').on('click', function(event) {
98
  event.preventDefault();
99
  var $btn = $(this);