WD Instagram Feed – Instagram Gallery - Version 1.4.15

Version Description

Improved: Decreased load time on front end.

=

Download this release

Release Info

Developer 10web
Plugin Icon 128x128 WD Instagram Feed – Instagram Gallery
Version 1.4.15
Comparing to
See all releases

Code changes from version 1.4.14 to 1.4.15

admin-functions.php CHANGED
@@ -708,6 +708,14 @@ function wdi_get_settings() {
708
  'title' => __('Uninstall', "wd-instagram-feed"),
709
  'default' => '',
710
  ),
 
 
 
 
 
 
 
 
711
  //'wdi_version' => array('name'=>'wdi_version','field_or_not'=>'no_field','default'=>WDI_VERSION),
712
  //'wdi_first_time'=>array('name'=>'wdi_first_time','field_or_not'=>'no_field','default'=>'1')
713
  );
@@ -725,6 +733,12 @@ function wdi_set_options_defaults() {
725
  $db_options[$setting['name']] = $settingDefault;
726
  }
727
  $options = wp_parse_args($options, $db_options);
 
 
 
 
 
 
728
  if ( isset($options['wdi_plugin_uninstalled']) && $options['wdi_plugin_uninstalled'] == 'true' ) {
729
  $options['wdi_plugin_uninstalled'] = 'false';
730
  }
708
  'title' => __('Uninstall', "wd-instagram-feed"),
709
  'default' => '',
710
  ),
711
+ 'wdi_cache_request_count' => array(
712
+ 'name' => 'wdi_cache_request_count',
713
+ 'sanitize_type' => 'number',
714
+ 'field_or_not' => 'field',
715
+ 'type' => 'number',
716
+ 'section' => 'wdi_customize_section',
717
+ 'title' => __('Set Maximum Count of Cache Requests', "wd-instagram-feed"),
718
+ ),
719
  //'wdi_version' => array('name'=>'wdi_version','field_or_not'=>'no_field','default'=>WDI_VERSION),
720
  //'wdi_first_time'=>array('name'=>'wdi_first_time','field_or_not'=>'no_field','default'=>'1')
721
  );
733
  $db_options[$setting['name']] = $settingDefault;
734
  }
735
  $options = wp_parse_args($options, $db_options);
736
+
737
+
738
+ if ( !isset($options['wdi_cache_request_count']) ) {
739
+ $options['wdi_cache_request_count'] = 10;
740
+ }
741
+
742
  if ( isset($options['wdi_plugin_uninstalled']) && $options['wdi_plugin_uninstalled'] == 'true' ) {
743
  $options['wdi_plugin_uninstalled'] = 'false';
744
  }
admin/controllers/feeds.php CHANGED
@@ -213,10 +213,9 @@ class Feeds_controller_wdi {
213
  $settings = wp_parse_args($settings, $defaults);
214
  $action = WDILibrary::get('add_or_edit');
215
  require_once (WDI_DIR."/framework/WDIInstagram.php");
216
- $WDIInstagram = new WDIInstagram();
217
- $WDIInstagram->wdi_preload_cache(json_decode(stripslashes($posts["feed_users"]), TRUE));
218
 
219
  $message_id = 23;
 
220
  if ( $action == '' ) {
221
  $settings["feed_name"] = $model->get_unique_title($settings["feed_name"]);
222
  $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $settings, $this->dataFormat);
@@ -225,6 +224,7 @@ class Feeds_controller_wdi {
225
  }
226
  }
227
  else {
 
228
  $msg = $wpdb->update($wpdb->prefix . WDI_FEED_TABLE, $settings, array( 'id' => $action ), $this->dataFormat, array( '%d' ));
229
  if ( $msg == FALSE ) {
230
  $message_id = 24;
@@ -241,12 +241,17 @@ class Feeds_controller_wdi {
241
  $wdi_current_task = "display";
242
  $wdi_current_id = 0;
243
  }
244
- WDILibrary::wdi_spider_redirect(add_query_arg(array(
245
- 'page' => WDILibrary::get('page'),
246
- 'task' => $wdi_current_task,
247
- 'current_id' => $wdi_current_id,
248
- 'message' => $message_id,
249
- ), admin_url('admin.php')));
 
 
 
 
 
250
  }
251
 
252
  private function reset_changes() {
@@ -468,6 +473,9 @@ class Feeds_controller_wdi {
468
  $sanitize_types = $model->get_sanitize_types();
469
  $sanitized_output = array();
470
  foreach ( $settings as $setting_name => $value ) {
 
 
 
471
  switch ( $sanitize_types[$setting_name] ) {
472
  case 'string':
473
  {
213
  $settings = wp_parse_args($settings, $defaults);
214
  $action = WDILibrary::get('add_or_edit');
215
  require_once (WDI_DIR."/framework/WDIInstagram.php");
 
 
216
 
217
  $message_id = 23;
218
+ $need_cache = 1;
219
  if ( $action == '' ) {
220
  $settings["feed_name"] = $model->get_unique_title($settings["feed_name"]);
221
  $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $settings, $this->dataFormat);
224
  }
225
  }
226
  else {
227
+ $need_cache = $model->check_need_cache( $action, $settings );
228
  $msg = $wpdb->update($wpdb->prefix . WDI_FEED_TABLE, $settings, array( 'id' => $action ), $this->dataFormat, array( '%d' ));
229
  if ( $msg == FALSE ) {
230
  $message_id = 24;
241
  $wdi_current_task = "display";
242
  $wdi_current_id = 0;
243
  }
244
+
245
+ $redirect_url['need_cache'] = $need_cache;
246
+ $redirect_url['feed_id'] = $wdi_current_id;
247
+ $redirect_url['url'] = add_query_arg(array(
248
+ 'page' => WDILibrary::get('page'),
249
+ 'task' => $wdi_current_task,
250
+ 'current_id' => $wdi_current_id,
251
+ 'message' => $message_id,
252
+ ), admin_url('admin.php'));
253
+ echo json_encode($redirect_url);
254
+ die();
255
  }
256
 
257
  private function reset_changes() {
473
  $sanitize_types = $model->get_sanitize_types();
474
  $sanitized_output = array();
475
  foreach ( $settings as $setting_name => $value ) {
476
+ if( !isset($sanitize_types[$setting_name]) ) {
477
+ continue;
478
+ }
479
  switch ( $sanitize_types[$setting_name] ) {
480
  case 'string':
481
  {
admin/controllers/settings.php CHANGED
@@ -60,7 +60,8 @@ class Settings_controller_wdi {
60
  $wdi_options['wdi_feeds_min_capability'] = $post['wdi_feeds_min_capability'];
61
  $wdi_options['wdi_custom_css'] = esc_js(str_replace(array( "\n", "\r" ), "", $post['wdi_custom_css']));
62
  $wdi_options['wdi_custom_js'] = esc_js(str_replace(array( "\n", "\r" ), "", $post['wdi_custom_js']));
63
- $update = update_option(WDI_OPT, $wdi_options);
 
64
  $message_id = 8;
65
  WDILibrary::redirect(add_query_arg(array(
66
  'page' => 'wdi_settings',
60
  $wdi_options['wdi_feeds_min_capability'] = $post['wdi_feeds_min_capability'];
61
  $wdi_options['wdi_custom_css'] = esc_js(str_replace(array( "\n", "\r" ), "", $post['wdi_custom_css']));
62
  $wdi_options['wdi_custom_js'] = esc_js(str_replace(array( "\n", "\r" ), "", $post['wdi_custom_js']));
63
+ $wdi_options['wdi_cache_request_count'] = intval($post['wdi_cache_request_count']);
64
+ update_option(WDI_OPT, $wdi_options);
65
  $message_id = 8;
66
  WDILibrary::redirect(add_query_arg(array(
67
  'page' => 'wdi_settings',
admin/models/feeds.php CHANGED
@@ -290,4 +290,31 @@ class Feeds_model_wdi {
290
  }
291
  }
292
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  }
290
  }
291
  }
292
  }
293
+
294
+ /**
295
+ * Check if data in db and new data the same ( especially feed_users, conditional_filters, conditional_filter_type)
296
+ *
297
+ * int $feed_id
298
+ * array $data
299
+ *
300
+ * @return string $guid
301
+ */
302
+ public function check_need_cache( $feed_id, $data ) {
303
+ global $wpdb;
304
+ $users = $data['feed_users'];
305
+ $conditional_filters = $data['conditional_filters'];
306
+ $conditional_filter_type = $data['conditional_filter_type'];
307
+ $count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(id) FROM ". $wpdb->prefix.WDI_FEED_TABLE. " WHERE id ='%d' AND feed_users='%s' AND conditional_filters='%s' AND conditional_filter_type='%s'", $feed_id, $users, $conditional_filters, $conditional_filter_type));
308
+ if ( $count == 0 ) {
309
+ return 1;
310
+ } else {
311
+ $transient_key = "wdi_cache_" . md5($feed_id);
312
+ $cache_data = get_transient($transient_key);
313
+ if ( isset($cache_data) && $cache_data != FALSE && isset($cache_data["cache_response"]) ) {
314
+ return 0;
315
+ } else {
316
+ return 1;
317
+ }
318
+ }
319
+ }
320
  }
admin/views/feeds.php CHANGED
@@ -978,6 +978,16 @@ class Feeds_view_wdi {
978
  </form>
979
  </div>
980
  </div>
 
 
 
 
 
 
 
 
 
 
981
  <?php
982
  }
983
 
978
  </form>
979
  </div>
980
  </div>
981
+ <div id="wdi_save_loading" class="wdi_hidden">
982
+ <img src="<?php echo WDI_URL . '/images/ajax_loader.png'; ?>" class="wdi_spider_ajax_loading" style="width:50px;">
983
+ <span class="caching-process-message wdi_hidden">
984
+ <?php
985
+ _e("Please don't close this window. We are caching Instagram media.", "wdi");
986
+ echo "<br>";
987
+ _e("This may take a few minutes.", "wdi");
988
+ ?>
989
+ </span>
990
+ </div>
991
  <?php
992
  }
993
 
admin/views/settings.php CHANGED
@@ -105,6 +105,10 @@ class Settings_view_wdi {
105
  </div>
106
  <div class="wdi-advanced-body">
107
  <p class="wdi-input-group">
 
 
 
 
108
  <label><?php _e('Check for new posts every (min)', 'wd-instagram-feed'); ?></label>
109
  <input type="text" name="<?php echo WDI_OPT . '[wdi_transient_time]' ?>" value="<?php echo $options['wdi_transient_time']; ?>">
110
  </p>
@@ -149,6 +153,17 @@ class Settings_view_wdi {
149
  ?>
150
  </form>
151
  </div>
 
 
 
 
 
 
 
 
 
 
 
152
  <script>
153
  jQuery(document).ready(function () {
154
  jQuery('#wdi-personal-business-popup input[name="wdi-connect-type"]').on('click', function () {
105
  </div>
106
  <div class="wdi-advanced-body">
107
  <p class="wdi-input-group">
108
+ <label><?php _e('Set Maximum Count of Cache Requests', 'wd-instagram-feed'); ?></label>
109
+ <input type="number" name="<?php echo WDI_OPT . '[wdi_cache_request_count]' ?>" value="<?php echo (isset($options['wdi_cache_request_count']) && $options['wdi_cache_request_count'] !== '') ? $options['wdi_cache_request_count'] : 10; ?>">
110
+ </p>
111
+ <p class="wdi-input-group" style="display: none">
112
  <label><?php _e('Check for new posts every (min)', 'wd-instagram-feed'); ?></label>
113
  <input type="text" name="<?php echo WDI_OPT . '[wdi_transient_time]' ?>" value="<?php echo $options['wdi_transient_time']; ?>">
114
  </p>
153
  ?>
154
  </form>
155
  </div>
156
+ <div id="wdi_save_loading" class="wdi_hidden">
157
+ <img src="<?php echo WDI_URL . '/images/ajax_loader.png'; ?>" class="wdi_spider_ajax_loading" style="width:50px;">
158
+ <span class="caching-process-message">
159
+ <?php
160
+ _e("Please don't close this window. We are caching Instagram media.", "wdi");
161
+ echo "<br>";
162
+ _e("This may take a few minutes.", "wdi");
163
+ ?>
164
+ </span>
165
+ </div>
166
+
167
  <script>
168
  jQuery(document).ready(function () {
169
  jQuery('#wdi-personal-business-popup input[name="wdi-connect-type"]').on('click', function () {
config.php CHANGED
@@ -3,7 +3,7 @@ if ( !defined('ABSPATH') ) {
3
  exit;
4
  }
5
 
6
- define('WDI_VERSION', '1.4.14');
7
  define('WDI_IS_FREE', TRUE);
8
  define('WDI_PREFIX', 'wdi');
9
  define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
@@ -16,4 +16,6 @@ define('WDI_FSN', 'wdi_feed_settings');
16
  define('WDI_TSN', 'wdi_theme_settings');
17
  define('WDI_FEED_TABLE', 'wdi_feeds');
18
  define('WDI_THEME_TABLE', 'wdi_themes');
19
- define('WDI_MINIFY', TRUE);
 
 
3
  exit;
4
  }
5
 
6
+ define('WDI_VERSION', '1.4.15');
7
  define('WDI_IS_FREE', TRUE);
8
  define('WDI_PREFIX', 'wdi');
9
  define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
16
  define('WDI_TSN', 'wdi_theme_settings');
17
  define('WDI_FEED_TABLE', 'wdi_feeds');
18
  define('WDI_THEME_TABLE', 'wdi_themes');
19
+ define('WDI_MINIFY', TRUE);
20
+ /* 48 hors */
21
+ define('WDI_TRANSIENT_DEFAULT_TIME', 2880);
css/wdi_backend.css CHANGED
@@ -2280,3 +2280,31 @@ body.instagram-feed_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(4){
2280
  color: #323A45 !important;
2281
  }
2282
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2280
  color: #323A45 !important;
2281
  }
2282
 
2283
+ #wdi_save_loading {
2284
+ position: fixed;
2285
+ width: 100%;
2286
+ height: 100%;
2287
+ background-color: rgba(0, 0, 0, 0.7);
2288
+ z-index: 999999;
2289
+ margin: auto;
2290
+ display: flex;
2291
+ justify-content: center;
2292
+ align-items: center;
2293
+
2294
+ /* position the div in center */
2295
+ top: 50%;
2296
+ left: 50%;
2297
+ transform: translate(-50%, -50%);
2298
+ }
2299
+
2300
+ #wdi_save_loading .caching-process-message {
2301
+ color: #fff;
2302
+ font-size: 25px;
2303
+ line-height: 30px;
2304
+ text-align: center;
2305
+ }
2306
+
2307
+ #wdi_save_loading img {
2308
+ position: absolute;
2309
+ }
2310
+
css/wdi_backend.min.css CHANGED
@@ -1 +1 @@
1
- .wdi_clear{display:block;height:0;clear:both}.wdi_clear_tag:after{content:"";display:table;clear:both}#wdi_unistall{background-color:#d82121;border-color:#d31818;box-shadow:inset 0 1px 0 rgba(230,120,120,.5),0 1px 0 rgba(0,0,0,.15)}#wdi_unistall:hover{background-color:#da1313}#wdi_unistall_table th{width:45%}#toplevel_page_wdi_settings.current a div img{opacity:1}.wdi_settings_link,.wdi_tooltip{display:block;font-size:14px!important;font-weight:700;line-height:20px;margin-bottom:5px;color:#444;text-decoration:none}.wdi_theme.wdi_border_wrapper{background:#fff;padding:5px 0}.wdi_settings_link:hover,.wdi_tooltip:hover{color:#23282d;position:relative}.wdi_tooltip:hover:after{content:attr(wdi-tooltip);padding:4px 8px;color:#dbdbe0;position:absolute;left:0;top:100%;white-space:nowrap;z-index:20;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:2px;-moz-box-shadow:0 0 4px #222;-webkit-box-shadow:0 0 4px #222;box-shadow:0 0 4px rgba(0,0,0,.5);background-color:rgba(0,0,0,.75);font-size:12px}.display_type_container>div{float:left;margin-right:15px}#wdi_feed_users_ajax{width:100%;margin-top:2px}#wdi_feed_tabs .wdi_feed_tabs{border:1px solid #f1f1f1;color:#444;cursor:pointer;font-size:13px;font-weight:700;padding:12px;background:#fff;text-decoration:none;display:inline-block}#wdi_feed_tabs{margin:16px 0}#wdi_feed_tabs .wdi_feed_tab_active,#wdi_feed_tabs .wdi_feed_tabs:hover{background:none repeat scroll 0 0 #fff;color:#9a2465}#wdi_feed_tabs .wdi_feed_tab_title{margin-top:1px;display:inline-block}.wdi_border_wrapper [scope=row],.wdi_border_wrapper [scope=row]+td{padding:8px}.wdi_user{border:1px solid #b9b9b9;background-color:rgba(0,0,0,.05);margin:0 4px 0 0;border-radius:5px;height:28px;position:relative;display:inline-block}.wdi_user:hover{background-color:rgba(0,0,0,.08)}.display_type_container.wdi_clear_tag{display:table;margin:10px auto}.wdi_user a{text-decoration:none;color:#000;line-height:28px;width:70%;margin-left:12%;margin-right:18%;height:100%;display:table-row;padding-right:3px}.wdi_user .wdi_profile_pic{width:20px;height:20px;top:4px;left:30px;padding:5px;vertical-align:middle;display:table-cell}.wdi_user span{display:table-cell;vertical-align:middle;left:55px;font-weight:700;font-size:14px}.wdi_user .wdi_check_thumb_user,.wdi_user .wdi_remove_user{position:absolute;right:4px;width:15px;height:15px;top:6.5px;transition:all .1s ease}.wdi_user .wdi_remove_user:hover{cursor:pointer;transform:rotate(180deg)}.wdi_user .wdi_check_thumb_user:hover{cursor:pointer}.wdi_user .wdi_check_thumb_user{left:4px}.wdi_border_wrapper [scope=row]{padding:2px;font-size:13px;min-width:250px}.wdi_border_wrapper [scope=row],.wdi_border_wrapper [scope=row]+td{padding:2px}.small_input{width:60px;text-align:center}.display_type{text-align:center}.instagram-feed_page_wdi_settings table td{padding-left:0;padding-right:0}.instagram-feed_page_wdi_settings table th{padding-left:4px}.instagram-feed_page_wdi_settings table input{float:right}.wdi-settings-page .wdi_help_bar_wrap{background-color:unset;padding:15px 15px 15px 0}.wdi-settings-page .wdi_settings_form{margin-right:20px;padding:30px 20px;background:#fff}.wdi_advanced_option_open tr:nth-child(10),.wdi_advanced_option_open tr:nth-child(11),.wdi_advanced_option_open tr:nth-child(9){display:none}.instagram-feed_page_wdi_settings table #wdwt_wrap_wdi_fb_auth{margin-left:115px}#wdwt_wrap_wdi_fb_auth .block a{background-color:#4267b2;color:#fff}#wdwt_wrap_wdi_authenticated_users_list .block,#wdwt_wrap_wdi_reset_cache .block,.wdi_advanced_option .optioninput{display:inline-block}#wdi_options_page_buttons_wrapper .submit{display:inline;margin-left:15px}.wdi_advanced_option{width:100%;position:relative;font-weight:600}.wdi_advanced_option{background-color:#fff;cursor:pointer;border:1px solid #e3e3e3;border-radius:10px;border-collapse:separate;border-spacing:0}.wdi_advanced_option .wdi_advanced_option_head{border-bottom:1px solid #e3e3e3}.wdi_advanced_option .wdi_advanced_option_head th{padding-top:10px;padding-bottom:10px}.wdi_advanced_option.wdi_advanced_option_open .wdi_advanced_option_head th{border-bottom:1px solid #e3e3e3;border-bottom-left-radius:10px}.wdi_advanced_option.wdi_advanced_option_open .wdi_advanced_option_head td{border-bottom:1px solid #e3e3e3;border-bottom-right-radius:10px}.instagram-feed_page_wdi_settings table.wdi_advanced_option th{padding-left:12px}.instagram-feed_page_wdi_settings table.wdi_advanced_option td .wdwt_param{margin-left:15px}.instagram-feed_page_wdi_settings #wdwt_wrap_wdi_disable_fa .optioninput{display:inline-block}.wdi_advanced_option .wdi_advanced_option_icon{background-repeat:no-repeat;background-position:left top;width:20px;height:20px;display:inline-block;position:absolute;top:16px;right:10px}.wdi_advanced_option.wdi_advanced_option_close .wdi_advanced_option_icon{background-image:url(../images/arrow_1.png)}.wdi_advanced_option.wdi_advanced_option_open .wdi_advanced_option_icon{background-image:url(../images/arrow_2.png)}.wdi_advanced_option.wdi_advanced_option_close tbody tr:not(.wdi_advanced_option_head){display:none}#wdi_options_page_buttons_wrapper{margin-top:10px;width:700px}.wdi_hidden{display:none!important}.selectoff{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.wdi_filter_radio{margin:5px;display:inline-block}.wdi_filter_radio label{vertical-align:text-bottom}.filters_description{font-size:13px;font-weight:700;margin-top:8px;display:inline-block}.wdi_filter_input input{width:250px;margin-right:0;padding-right:0}#wdi_filter_type{line-height:28px;margin:0;padding:0;position:relative;right:2px;top:-1px;font-weight:400}.wdi_filter_item{display:inline-block;padding:6px;margin-top:5px;border-radius:5px}.wdi_filter_by_username{background-color:#00a0d2;color:#fff}.wdi_filter_by_hashtag{background-color:#e08d11;color:#fff}.wdi_logic{display:inline-block;padding:5px;font-weight:700}.wdi_filter_by_location{background-color:#509833;color:#fff}.wdi_filter_by_mention{background-color:#833888;color:#fff}.wdi_filter_by_description{background-color:#bd242b;color:#fff}.wdi_filter_by_url{background-color:#004eff;color:#fff}.wdi_remove_filter{padding-left:5px;color:#fff;font-size:13px}.wdi_remove_filter:hover{cursor:pointer}.wdi_source_user{border:1px solid #d4d4d4;background-color:rgba(0,0,0,.03);margin:0 4px 0 0;border-radius:5px;height:29px;display:inline-block;padding:2px 0 0 4px}.wdi_source_img{display:inline-block}.wdi_source_img img{width:22px;height:22px;border-radius:15px;display:block;padding:0}.wdi_source_username{display:inline-block;line-height:25px;font-size:15px!important;height:30px;vertical-align:bottom;padding:0 5px;font-weight:700}#login_with_instagram>a:focus{-webkit-box-shadow:none;box-shadow:none}.wdi_help_bar_wrap{background-color:#fff;border:none;box-sizing:border-box;clear:both;color:#6e7990;font-size:14px;font-weight:700;line-height:30px;padding:15px;vertical-align:middle;width:100%;margin:20px 0 0 0}.wdi_help_bar_wrap a,.wdi_help_bar_wrap span{font-size:14px}.wdi_help_bar_text{float:left}.wdi_help_bar_text>a{color:#0073aa;text-decoration:none}.wdi_hb_buy_pro{float:right;padding:0}.wdi_hb_buy_pro a,.wdi_hb_buy_pro a:active,.wdi_hb_buy_pro a:hover,.wdi_hb_buy_pro a:visited{display:inline-block;font-weight:700;font-size:14px;vertical-align:middle;border:none;box-shadow:none!important;text-decoration:none}.wdi_hb_buy_pro .wdi_support_link{color:#72777c!important;padding:0 10px}.wdi_hb_buy_pro .wdi_update_pro_link{background:#45a6b7;font-weight:700;line-height:30px;padding:0 18px 0 18px;color:#fff!important}.wdi_hb_buy_pro img{border:none;display:inline-block;vertical-align:middle}#bull_style,#bullets_images_color,#bullets_images_type,#rl_butt_color,#rl_butt_style,#rl_butt_type{margin:0 10px 0 0;width:100px}.wds_ctrl_btn_upload{display:block!important;margin:5px 0!important;text-align:center;vertical-align:middle;width:95%}.wds_reverse{margin:0 5px!important}.wds_free_button,.wds_free_button:hover{background:linear-gradient(to bottom,#e5e5e5,#e5e5e5) repeat scroll 0 0 #f3f3f3!important;border-color:#bbb!important;color:#888!important}.wdi_spider_free_version_label,.wdi_spider_free_version_label *{color:grey!important}.wdi_spider_free_version{background-color:#dfdfdf;border:1px solid #797979;border-radius:2px;padding:2px;width:210px}.wds_more{font-size:12px}.wrap .button{border-radius:3px!important;text-shadow:none!important}.wdi_spider_message_cont{display:none;width:99%}.wdi_spider_load{display:none}.wdi_spider_load_cont{background-color:rgba(0,0,0,.2);left:0;height:100%;position:fixed;top:0;width:100%;z-index:99998}.wdi_spider_load_icon{left:0;height:100%;position:fixed;text-align:center;top:0;width:100%;z-index:99999}.wdi_spider_ajax_loading{border:none!important;margin-top:200px;width:50px;-webkit-animation:spin 2.5s infinite linear;-moz-animation:spin 2.5s infinite linear;-o-animation:spin 2.5s infinite linear;animation:spin 2.5s infinite linear}@-moz-keyframes spin{0%{-moz-transform:rotate(0)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0)}100%{-o-transform:rotate(359deg)}}@-ms-keyframes spin{0%{-ms-transform:rotate(0)}100%{-ms-transform:rotate(359deg)}}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(359deg)}}#TB_iframeContent,#TB_window{width:800px!important;height:500px!important}#TB_window{margin-left:-400px!important}.input_th{margin-left:0!important;width:160px!important;font-family:sans-serif}.input_th2{margin-left:0!important;width:160px!important;margin-top:5px;height:19px}.edit_input{height:28px!important;padding-bottom:7px!important}.add_tag_th{padding-left:21px;font-size:12px;font-family:sans-serif}.pointer{cursor:pointer}.non_selectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.wds_position_table input,.wds_position_table td{border:1px solid #ccc;margin:2px}.wds_position_table .wds_position_td{background-color:#f4f4f4;display:inline-block;line-height:1;padding:0!important}.wdi_spider_div_options{background:none repeat scroll 0 0 #f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;display:none;margin:2px 0 0 190px;padding:13px;min-height:300px;min-width:600px;vertical-align:top}.table_medium_col{text-align:center!important;width:70px}.table_medium_col_uncenter{width:80px}.table_extra_large_col{padding:4px!important;width:150px!important}.first-page,.last-page,.next-page,.prev-page,.table_big_col a,.table_extra_large_col a,.table_medium_col a,.table_small_col a{cursor:pointer}.wdi_spider_word_wrap{word-wrap:normal}.wdi_spider_description{color:#666;font-size:.923em;line-height:1.231em}.handle{background:url(../images/draggable.png) no-repeat transparent;border:none;cursor:move;display:inline-block;height:15px;margin:0 auto;vertical-align:middle;width:15px}.wdi_page_title{font-size:1.5em;font-weight:500}.slider-icon{background-image:url(../images/slider-icon.png);background-repeat:no-repeat;border:none;float:left;height:32px;margin:7px 8px 0 0;width:32px}.theme-icon{background-image:url(../images/theme-2.png);background-repeat:no-repeat;border:none;float:left;height:32px;margin:7px 8px 0 0;width:32px}.uninstall-icon{background-image:url(../images/uninstall-icon.png);background-repeat:no-repeat;border:none;float:left;height:32px;margin:7px 8px 0 0;width:32px}.wdi_spider_label{font-weight:700;width:100px}.wdi_spider_label_top{font-weight:700;padding-top:3px;vertical-align:top;width:100px}.wdi_spider_fieldset .wdi_spider_label{font-weight:700;vertical-align:top;width:150px}.wdi_spider_label_options{font-weight:700;vertical-align:top;width:150px}.wdi_spider_choose_option{display:table;box-shadow:0 0 1px 1px #d2d2d2;margin-bottom:5px;border-radius:2px;padding:2px;box-sizing:border-box;cursor:pointer;width:100%}.wdi_spider_bull_options_color_cont,.wdi_spider_bull_options_cont,.wdi_spider_options_color_cont,.wdi_spider_options_cont,.wdi_spider_pp_options_color_cont,.wdi_spider_pp_options_cont{display:none;width:180px;height:150px;overflow:scroll;overflow-x:hidden;overflow-y:scroll}.wdi_spider_option_cont{display:block;border-bottom:1px solid #d3d3d3;padding:3px 0 3px 0;box-sizing:content-box;width:98%;border-radius:0;cursor:pointer}.wdi_spider_option_cont_title{display:table-cell;vertical-align:middle;padding:0 0 0 4px}.wdi_spider_option_cont_img{display:table-cell;width:23%;height:15px;text-align:right;padding:5px 4px 0 0;box-sizing:border-box;background-color:#eee}.wdi_spider_option_main_title{display:table-cell;width:65%;vertical-align:middle;padding:0 0 0 4px;color:#555}.wdi_spider_sel_option_ic{display:table-cell;width:20%;height:15px;text-align:right;padding:0 6px 0 0;box-sizing:border-box}.wdi_spider_int_input{width:45px}.wdi_spider_char_input{width:115px}.wdi_spider_text_input{width:190px}.wdi_spider_slider_div{display:inline-block;vertical-align:middle;width:140px}.wdi_spider_slider_percentage,.wdi_spider_slider_percentage input,.wdi_spider_slider_percentage input :focus{background:0 0;border:none;color:#00aeef;display:inline;font-weight:700;text-align:right;vertical-align:middle;width:30px}.error,.updated{margin:5px 0 2px!important}.buttons_div{clear:both;float:right;margin:5px 0}.buttons_div_left{float:left;margin:5px 0;width:100%}.buttons_div_right{float:right;margin:5px 0}.wdi_spider_delete_img{background-image:url(../images/delete.png);border:none;cursor:pointer;display:inline-block;vertical-align:middle;height:14px;width:14px}.wdi_spider_delete_img_small{background-image:url(../images/delete.png);background-size:10px auto;border:medium none;cursor:pointer;display:inline-block;height:10px;margin-top:2px;vertical-align:middle;width:10px}.wdi_spider_fieldset{background:none repeat scroll 0 0 #f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;display:none;float:left;margin:4px;padding:13px;width:97%}.wdi_spider_type_fieldset{background:none repeat scroll 0 0 #f4f4f4;border-radius:8px 8px 8px 8px;display:none;float:left;width:100%}.wdi_spider_child_fieldset{background:none repeat scroll 0 0 #f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;float:left;margin:4px;width:30%;padding:13px;display:block}.wdi_spider_table td{padding:0;vertical-align:middle}.wdi_spider_ctrls{padding:4px;text-align:center;width:40px}.theme_type{background-color:#f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;cursor:pointer;display:inline-block;font-size:16px;height:24px;padding-top:5px;text-align:center;vertical-align:middle;width:123px;margin:2px 0 2px 0}.ui-slider-handle{cursor:pointer!important}.thumb{border:1px solid #ccc;max-height:120px;max-width:120px}.fileDescription{color:#666;cursor:pointer;font-family:sans-serif;font-size:12px}.filename{font-size:13px}.tag_div{background-clip:padding-box;background-color:#f3f3f3;border:1px solid #aaa;border-radius:3px 3px 3px 3px;box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#666;line-height:13px;margin:2px 0;padding:2px 5px 2px 5px;width:132px}.tags_div{overflow-y:auto;height:65px}.tag_name{width:118px}.edit_thumb{cursor:pointer}.wdi_spider_rotate{border-radius:2px;border:1px solid #fff;height:30px}.wdi_spider_search_value{height:2em;margin:0 0 4px}#th_order,.wdi_spider_order{display:none}.wds_add_video,.wds_exports,.wds_import,.wds_resize_image{display:none;padding:10px;height:60px;background-color:#fff;border:1px solid #999;top:50%;position:fixed;left:50%;text-align:left;z-index:100000;border-radius:3px;margin-top:-45px}.wds_add_video,.wds_resize_image{margin-left:-340px}.wds_exports{margin-left:-240px}.wds_import{margin-left:-185px}.wds_add_video input[type=text],.wds_resize_image input[type=text]{width:500px}.wds_opacity_export,.wds_opacity_import,.wds_opacity_video{background-color:#000;display:none;opacity:.75;filter:Alpha(opacity=75);position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998}.wds_tabs{clear:both;display:none;position:relative;z-index:1}.wds_tabs a.wds_active,.wds_tabs a.wds_sub_active{background-color:#f5f5f5;border-bottom:1px solid #f5f5f5;color:#333}.wds_tabs a{background-color:#f9f9f9;border:1px solid #dfdfdf;border-top-left-radius:3px;border-top-right-radius:3px;color:#c7c7c7;display:block!important;float:left;font:bold 17px/32px Arial,serif;height:30px;margin:3px 3px 0 0;padding:0 10px;position:relative;text-decoration:none;width:130px}.wbs_subtab a{font:bold 14px/26px Arial,serif;height:26px;padding:0 5px;width:105px}.wds_add_layer{font:normal 20px/28px Arial,serif!important;width:initial!important;padding:0 9px!important}.wds_tab_title{background:none repeat scroll 0 0 transparent!important;border:none!important;cursor:pointer;opacity:.5;filter:Alpha(opacity=50);padding:1px;vertical-align:middle;width:50px}.wds_layer_title,.wds_sub_active .wds_tab_title{background-color:#fff!important;border-color:#dfdfdf!important;border-radius:3px!important;border-style:solid!important;border-width:1px!important;cursor:pointer;opacity:1;filter:Alpha(opacity=100)}.wds_tab_remove{background-image:url(../images/close.png);background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:9px;height:9px;opacity:.5;filter:Alpha(opacity=50);vertical-align:middle}.wds_layer_remove{background-image:url(../images/close.png);background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:15px;height:15px;margin:5px;float:right}.wds_layer_dublicate{background-image:url(../images/duplicate.png);background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:15px;height:15px;margin:5px;float:right}.wds_slide_dublicate{background-image:url(../images/duplicate.png);background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:12px;height:12px;vertical-align:middle}.wds_layer_depth{float:right;font-size:13px;line-height:15px;margin:1px 5px;text-align:left;width:40px}.wds_layer_label{display:inline-block;font-size:13px;width:80%}.wds_sub_active .wds_tab_remove{cursor:pointer!important;opacity:1;filter:Alpha(opacity=100)}.wds_box.wds_active,.wds_box.wds_sub_active{display:block}.wds_tab_label{display:block;width:inherit}.wds_box{display:none;margin-top:0!important;position:relative;top:-1px}.wds_box{border:1px solid #dfdfdf;border-radius:3px;box-shadow:0 0 10px #f2f2f2;margin-top:15px;position:relative}.wds_clear{clear:both;float:none!important}.wds_box thead td{border-bottom:0 none!important}.wds_box tbody{background-color:#fff;border-top:0 none;padding-left:10px}.wds_box thead{background:-webkit-linear-gradient(#f5f5f5,#fff);background:-o-linear-gradient(#f5f5f5,#fff);background:-moz-linear-gradient(#f5f5f5,#fff);background:linear-gradient(#f5f5f5,#fff);border-top:0 none;border-bottom:0 none;color:#333;font:bold 12px/29px Arial,serif;height:29px;margin:0;padding:0 10px;text-align:left;text-shadow:0 1px 0 #fff}.wds_box table{border-collapse:collapse;border-spacing:0;width:100%}.wds_nav_tabs{background-color:#f5f5f5;border-right:1px solid #dfdfdf;float:left;height:640px;margin:0;width:150px}.wds_nav_tabs ul{list-style:none outside none;margin:10px 0;padding:0}.wds_nav_tabs .wds_active,.wds_nav_tabs .wds_active a,.wds_nav_tabs .wds_active a:hover,.wds_nav_tabs .wds_sub_active,.wds_nav_tabs .wds_sub_active a,.wds_nav_tabs .wds_sub_active a:hover{background:none repeat scroll 0 0 #fff;color:#333}.wds_nav_tabs .wds_active{border-color:#dfdfdf;border-width:1px 0 1px 1px;border-style:solid;margin:0 -1px 0 -4px;padding:0}.wds_nav_tabs li{border-color:transparent;border-style:solid;border-width:1px 0;list-style-type:none;margin-bottom:0}.wds_nav_tabs a{display:block;line-height:18px;padding:5px 5px 5px 12px;text-decoration:none}.wds_nav_box{background:none repeat scroll 0 0 #fff;display:none;height:610px;overflow:auto;padding:15px}.wds_nav_box.wds_active{display:block}.wds_layer_head{background-color:#f5f5f5;border-bottom:1px solid #dfdfdf;border-top:1px solid #dfdfdf;cursor:pointer;padding:5px}.wds_layer_head .handle{cursor:move;display:inline-block;margin:5px}.wds_box td{padding:10px!important}.wds_draggable{box-sizing:border-box;cursor:move}.wds_box .color{width:60px}.wds_active_layer{box-shadow:#2c2424 0 0 5px;border-radius:3px}.wds_draggable a,.wds_draggable a:hover{color:inherit!important;font-size:inherit!important;font-style:inherit!important;font-weight:inherit!important;text-decoration:none}#add_embed_help{height:200px;width:672px;top:40%}#add_embed input[type=text]{width:500px}.wds_buttons{float:right;font-weight:400;position:relative}.wds_reset_button{display:none;font-weight:400;margin:10px 0;position:absolute;right:40px;z-index:1}.wdi_about_filed{font-size:13px;font-style:italic}#wdi_save_feed .two .section_col,.wdi_theme .section_col{width:47%;float:left;margin:0 1.5% 18px}.wdi_theme .section_col{margin-bottom:0}#wdi_save_feed .wdi_element{margin:0 0 18px}.display_type_content{background:#fff;border:1px solid #dedede;margin-bottom:15px}#wdi_save_feed .half .wdi_element,#wdi_save_feed .one .wdi_element{width:96%;float:none;margin:0 2% 20px}.wdi_element_name_liked_feed{display:none!important}#wdi_save_feed .wdi_element p{margin:2px 0 0}.wdi_section_name{font-size:19px;margin:0 auto 15px;width:100%;box-sizing:border-box;padding:15px;border-bottom:1px solid #f1f1f1;color:#444;cursor:pointer}.wdi_section{border:1px solid #dedede;margin-bottom:20px;background:#fff}.wdi_section .optioninput *,.wdwt_param .optioninput *{text-align:left}.wdi_section.half{width:49%;float:left;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wdi_buttons{text-align:right;margin-top:7px}.wdi_tab .wdi_section.half:last-child{margin-left:2%}label[for=WDI_user_padding]{display:block}.wdi_settings_notification{font-size:13px;color:#8b0000}#how_to_publish_tab .wdi_howto_container{display:flex;flex-wrap:wrap}#how_to_publish_tab .wdi_howto_content{border:1px #ddd solid;display:flex;flex:1;flex-direction:column;margin:5px;min-width:250px;max-width:calc(25% - 20px);padding:20px 10px;text-align:center}#how_to_publish_tab .wdi_howto_container h2{font-size:23px;font-weight:400;line-height:29px;margin:0;padding:11px 15px 4px 0}#how_to_publish_tab .wdi_howto_container .wdi_howto_content .wdi_howto_wrapper{max-width:270px;margin:0 auto}#how_to_publish_tab .wdi_howto_container .wdi_howto_content .wdi_howto_wrapper img{max-width:100%}#how_to_publish_tab .wdi_howto_container .wdi_howto_content input{margin:0 auto;text-align:center;width:100%}.wdi_buttons button.button.preview-button{height:28px}@media (max-width:782px){.wdi_buttons button.button.preview-button{height:auto}}@media (min-width:820px){#conditional_filters_tab .one .wdi_element{width:70%;float:none;margin:0 2% 20px}.wdi_border_wrapper .wdi_element_content{width:100%;display:block}.wdi_border_wrapper .wdi_element_title{display:block}.wdi_border_wrapper .wdi_element_content input[type=text]:not(.wp-color-picker){width:calc(100% - 30px);height:28px}.wdi_element_content .wdi_filter_input input[type=text]:not(.wp-color-picker){width:270px}.wdi_border_wrapper .wdi_element_content input#wdi_add_user_ajax_input{width:calc(100% - 78px)}.wdi_border_wrapper .wdi_element_content input[type=number]{width:calc(100% - 30px)}.wdi_border_wrapper .wdi_element_content select{width:calc(100% - 30px)}.wdi_element_content .wdi_filter_input select{width:calc(100% - 413px)}.wdi_filter_input input{height:28px;line-height:28px}}@media (max-width:768px){.wdi_element_content .wdi_filter_input input[type=text]{width:130px}.wdi_element_content .wdi_filter_input select{width:calc(100% - 144px)}#wdi_save_feed .two .section_col,.wdi_theme .section_col{width:96%;float:none;margin:0 2% 18px}.wdi_section.half{width:100%;float:none;margin:0 0 20px!important}.wdi_theme .section_col{margin-bottom:0}}.wdi_section_close::before{content:"\f142";display:inline-block;font:400 20px/1 dashicons;speak:none;float:right;cursor:pointer}.wdi_section_open::before{content:"\f140";display:inline-block;font:400 20px/1 dashicons;speak:none;float:right;cursor:pointer}.wdi-page-header{width:98%;padding:10px}.wdi-page-header .wdi_buttons{float:right}.wdi-page-header .WDI_title_input{padding:3px 8px;font-size:1.7em;line-height:100%;height:1.5em;width:30%;outline:0;margin:0 0 3px;background-color:#fff}.wdi_themes_list td{display:table-cell!important}#wdi_feed_form .wd-page-title.wd-header{width:100%;padding:10px 0}@media screen and (max-width:782px){#wdi_feed_form p.search-box{margin-bottom:0}#wdi_feed_form p.search-box input[type=search]{width:100%;height:auto!important}#wdi_feed_form p.search-box input[type=button]{margin-bottom:10px;padding:6px 14px;line-height:normal;font-size:14px;height:auto}.wdi-page-header .WDI_title_input{width:60%}.wdi-page-header .wdi_buttons{float:none;text-align:center}}.wdi_element_name_hashtag_top_recent{display:none}body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(4),body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(5){display:none}body.instagram-feed_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(3){display:table-row!important}body.instagram-feed_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(4){display:table-row!important}.wdi_settings_form .button{min-height:unset;padding:9px 20px;background:#fff 0 0 no-repeat;border:1px solid #dedede;border-radius:4px;line-height:19px;font-weight:600;font-size:14px;color:#32373c;height:auto!important}.wdi-page-title{margin-bottom:30px;text-align:left;letter-spacing:0;font-size:22px;color:#323a45}.wdi-input-group{margin:0 0 30px 0}.wdi-input-group:last-child{margin:0}.wdi-input-group label{display:block;margin-bottom:15px;font-weight:700;line-height:20px;font-size:15px;color:#323a45}.wdi-input-group .wdi-description{font-style:italic}.wdi-input-group input[readonly],.wdi-input-group input[type=text],.wdi-input-group textarea{width:100%;max-height:40px;margin:0;padding:10px 12px;background:#fff;border-radius:4px;border:1px solid #ddd;font-weight:400;font-size:15px;color:#323a45}.wdi-input-group textarea{max-height:100px;min-height:100px}.wdi-input-group select{max-width:unset;width:100%;margin:0;padding:10px 12px;border-radius:4px;border:1px solid #ddd;font-weight:400;font-size:15px;color:#323a45}.wdi-connect-instagram{background-image:url(../images/instagram-connect.png);background-size:cover;width:330px;height:50px;cursor:pointer}.wdi-access-token-missing{max-width:778px;margin:10px 0 50px 0;line-height:17px;font-size:13px;color:#323a45}.wdi-access-token-missing p{margin:0}.wdi-accounts-list li{margin-bottom:20px;padding:20px;background:#f9f9f9}.wdi-accounts-list .wdi-account-block{display:flex;flex-wrap:wrap;justify-content:space-between}.wdi-accounts-list .wdi-account-user-info{float:left;min-width:145px;margin-right:15px}.wdi-accounts-list .wdi-account-name{margin:0;font-weight:700;line-height:24px;font-size:18px;color:#323a45}.wdi-accounts-list .wdi-account-type{margin:0;line-height:16px;text-transform:capitalize;font-size:12px;color:rgba(50,58,69,.8)}.wdi-accounts-list .wdi-account-show-token{float:left;width:27px;height:27px;padding:8px 0 0 8px;background:#fff;border:1px solid #dedede;border-radius:4px;cursor:pointer}.wdi-accounts-list .wdi-account-remove{display:block;padding:9px 20px;background:#fff 0 0 no-repeat padding-box;border:1px solid #dedede;border-radius:4px;font-weight:500;font-size:14px;color:#32373c;cursor:pointer;height:auto!important}.wdi-accounts-list .wdi-account-accesstoken{margin-top:25px;display:none;clear:both}.wdi-account-accesstoken .wdi-account-remove{display:none}.wdi-advanced-options{max-width:752px;padding:20px;margin-top:30px;background:#f9f9f9}.wdi-advanced-options .wdi-advanced-headline{margin-bottom:25px;padding-bottom:16px;border-bottom:1px solid #e5e5e5;cursor:pointer}.wdi-advanced-options .wdi-advanced-headline .wdi-page-title{float:left;margin:0;font-size:16px}.wdi-advanced-options .wdi-advanced-headline i{float:right;cursor:pointer}.wdi-advanced-options .wdi-advanced-body{display:none}.wdi_settings_form .submit{margin:30px 0 0 0;padding:0}.wdi_settings_form .button-primary{background:#007cba;border-color:#007cba;color:#fff;height:auto!important}.wdi-popup{display:none;position:fixed;height:100%;width:100%;top:0;left:0;background:rgba(0,0,0,.3);z-index:1000000}.wdi-popup .wdi-popup-container{top:50%;transform:translate(0,-50%);width:800px;position:relative;margin:0 auto;padding:30px 30px 25px 30px;background:#fff;border-radius:4px}.wdi-popup .wdi-popup-container .wdi-popup-close{display:block;position:absolute;top:12px;right:11px;width:10px;height:10px;background-image:url(../images/close.svg);background-position:center;background-repeat:no-repeat;cursor:pointer}.wdi-popup .wdi-popup-container h3{margin:0 0 30px 0;line-height:30px;font-weight:700;font-size:20px}#wdi-personal-business-popup .wdi-popup-container{width:570px;height:auto;text-align:center}.wdi_paid{pointer-events:none!important;font-size:12px;text-decoration:none;color:#fff;background:transparent linear-gradient(262deg,#008a62 0,#23b536 100%) 0 0 no-repeat padding-box;border-radius:4px;padding:8px 12px;float:right;margin-top:20px}.wdi-label-business:after{clear:both;display:table;content:""}.wdi-popup-container:after{clear:both;display:table;content:""}#wdi-personal-business-popup .wdi-radio-button{margin:0;font-size:14px}#wdi-personal-business-popup .wdi-radio-button p{margin:0;display:block;width:100%;text-align:left;background:#fff 0 0 no-repeat padding-box;box-shadow:0 0 10px #00000026;margin-bottom:20px;padding:21px 20px 20px 42px;box-sizing:border-box;border-radius:4px}.wdi-radio-button .wdi-label-business label input,.wdi-radio-button .wdi-label-business label span,.wdi-radio-button .wdi-label-personal label input,.wdi-radio-button .wdi-label-personal label span{position:relative;left:-24px}#wdi-personal-business-popup .wdi-radio-button p:first-child{margin-right:50px}#wdi-personal-business-popup .wdi-radio-button p label{font-size:14px;display:block}.wdi_info_text{font-size:14px;line-height:20px;font-weight:400;color:rgba(50,58,69,.5);margin-top:4px;display:block}#wdi-personal-business-popup .dashicons-info{color:#ccc}.wdi-radio-button .wdi-radio-info-text{display:none;position:absolute;max-width:220px;margin:5px 0 0 78px;padding:14px;background:#fff;box-shadow:0 0 8px rgba(0,0,0,.14);border:1px solid #dadcdc;border-radius:4px;line-height:20px;font-size:14px}.wdi-radio-button .wdi-label-business .wdi-radio-info-text{margin:5px 0 0 -152px}.wdi-radio-button .wdi-radio-info-text.active{display:block}#wdi-personal-business-popup .wdi-connect{width:140px;height:37px;margin-top:10px;padding:0;line-height:37px;font-size:14px;background-color:#2160b5;float:right}@media screen and (max-width:1919px){.wdi-advanced-options{max-width:unset}}@media screen and (max-width:767px){br.wdi_desktop{display:none!important}#wdi-personal-business-popup .wdi-connect{margin-top:0}.wdi_paid{width:229px;box-sizing:border-box;padding:8px 7px;font-size:11px}.wdi-radio-button input[type=radio]:checked:before{width:6px;height:6px;margin:4px}input[type=checkbox],input[type=radio]{height:16px;width:12px}#wdi-personal-business-popup .wdi-radio-button p{padding:19px 18px 18px 38px}.wdi-radio-button .wdi-label-business label input,.wdi-radio-button .wdi-label-business label span,.wdi-radio-button .wdi-label-personal label input,.wdi-radio-button .wdi-label-personal label span{position:relative;left:-25px}.wdi-popup .wdi-popup-container{padding:30px 20px 20px 20px}.wdi-settings-page .wdi_settings_form{margin-right:10px;padding:20px 15px}.wdi-connect-instagram{background-image:url(../images/instagram-connect-320.png);width:272px;height:40px}.wdi-account-block>div{width:100%}.wdi-accounts-list li{margin-bottom:15px;padding:20px 15px}.wdi-accounts-list .wdi-account-show-token{float:right}.wdi-account-block .wdi-account-remove{display:none}.wdi-account-accesstoken .wdi-account-remove{display:block;float:right;margin-top:20px}#wdi-personal-business-popup .wdi-popup-container{width:300px;box-sizing:border-box}.wdi-popup .wdi-popup-container h3{max-width:260px;margin:0 auto 20px auto;font-size:16px;line-height:26px}.wdi-radio-button .wdi-label-personal .wdi-radio-info-text{margin:5px 0 0 12px}.wdi-radio-button .wdi-label-business .wdi-radio-info-text{margin:5px 0 0 -147px}.wdi_settings_form .submit{margin-top:25px}}.wdi_pro_only{font-style:italic;color:#4e4e4e!important;background-color:#ccc!important;text-decoration:none;font-weight:700}.wdi-pro-overlay img{opacity:.7}.wdi_pro_notice{text-align:right;color:#15699f;font-size:20px!important;padding:10px}.wdi-radio-button .wdi_account_type{font-weight:700;color:#323A4580}.wdi_input_group{border:1px solid transparent}.wdi_active{border:1px solid #2160b5}.wdi_active .wdi_account_type,.wdi_active .wdi_info_text{color:#323a45}.wdi_free .wdi_info_text span{text-decoration:underline}.wdi_pro .wdi_account_type,.wdi_pro .wdi_info_text{color:#323a45!important}
1
+ .wdi_clear{display:block;height:0;clear:both}.wdi_clear_tag:after{content:"";display:table;clear:both}#wdi_unistall{background-color:#d82121;border-color:#d31818;box-shadow:inset 0 1px 0 rgba(230,120,120,.5),0 1px 0 rgba(0,0,0,.15)}#wdi_unistall:hover{background-color:#da1313}#wdi_unistall_table th{width:45%}#toplevel_page_wdi_settings.current a div img{opacity:1}.wdi_settings_link,.wdi_tooltip{display:block;font-size:14px!important;font-weight:700;line-height:20px;margin-bottom:5px;color:#444;text-decoration:none}.wdi_theme.wdi_border_wrapper{background:#fff;padding:5px 0}.wdi_settings_link:hover,.wdi_tooltip:hover{color:#23282d;position:relative}.wdi_tooltip:hover:after{content:attr(wdi-tooltip);padding:4px 8px;color:#dbdbe0;position:absolute;left:0;top:100%;white-space:nowrap;z-index:20;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:2px;-moz-box-shadow:0 0 4px #222;-webkit-box-shadow:0 0 4px #222;box-shadow:0 0 4px rgba(0,0,0,.5);background-color:rgba(0,0,0,.75);font-size:12px}.display_type_container>div{float:left;margin-right:15px}#wdi_feed_users_ajax{width:100%;margin-top:2px}#wdi_feed_tabs .wdi_feed_tabs{border:1px solid #f1f1f1;color:#444;cursor:pointer;font-size:13px;font-weight:700;padding:12px;background:#fff;text-decoration:none;display:inline-block}#wdi_feed_tabs{margin:16px 0}#wdi_feed_tabs .wdi_feed_tab_active,#wdi_feed_tabs .wdi_feed_tabs:hover{background:none repeat scroll 0 0 #fff;color:#9a2465}#wdi_feed_tabs .wdi_feed_tab_title{margin-top:1px;display:inline-block}.wdi_border_wrapper [scope=row],.wdi_border_wrapper [scope=row]+td{padding:8px}.wdi_user{border:1px solid #b9b9b9;background-color:rgba(0,0,0,.05);margin:0 4px 0 0;border-radius:5px;height:28px;position:relative;display:inline-block}.wdi_user:hover{background-color:rgba(0,0,0,.08)}.display_type_container.wdi_clear_tag{display:table;margin:10px auto}.wdi_user a{text-decoration:none;color:#000;line-height:28px;width:70%;margin-left:12%;margin-right:18%;height:100%;display:table-row;padding-right:3px}.wdi_user .wdi_profile_pic{width:20px;height:20px;top:4px;left:30px;padding:5px;vertical-align:middle;display:table-cell}.wdi_user span{display:table-cell;vertical-align:middle;left:55px;font-weight:700;font-size:14px}.wdi_user .wdi_check_thumb_user,.wdi_user .wdi_remove_user{position:absolute;right:4px;width:15px;height:15px;top:6.5px;transition:all .1s ease}.wdi_user .wdi_remove_user:hover{cursor:pointer;transform:rotate(180deg)}.wdi_user .wdi_check_thumb_user:hover{cursor:pointer}.wdi_user .wdi_check_thumb_user{left:4px}.wdi_border_wrapper [scope=row]{padding:2px;font-size:13px;min-width:250px}.wdi_border_wrapper [scope=row],.wdi_border_wrapper [scope=row]+td{padding:2px}.small_input{width:60px;text-align:center}.display_type{text-align:center}.instagram-feed_page_wdi_settings table td{padding-left:0;padding-right:0}.instagram-feed_page_wdi_settings table th{padding-left:4px}.instagram-feed_page_wdi_settings table input{float:right}.wdi-settings-page .wdi_help_bar_wrap{background-color:unset;padding:15px 15px 15px 0}.wdi-settings-page .wdi_settings_form{margin-right:20px;padding:30px 20px;background:#fff}.wdi_advanced_option_open tr:nth-child(10),.wdi_advanced_option_open tr:nth-child(11),.wdi_advanced_option_open tr:nth-child(9){display:none}.instagram-feed_page_wdi_settings table #wdwt_wrap_wdi_fb_auth{margin-left:115px}#wdwt_wrap_wdi_fb_auth .block a{background-color:#4267b2;color:#fff}#wdwt_wrap_wdi_authenticated_users_list .block,#wdwt_wrap_wdi_reset_cache .block,.wdi_advanced_option .optioninput{display:inline-block}#wdi_options_page_buttons_wrapper .submit{display:inline;margin-left:15px}.wdi_advanced_option{width:100%;position:relative;font-weight:600}.wdi_advanced_option{background-color:#fff;cursor:pointer;border:1px solid #e3e3e3;border-radius:10px;border-collapse:separate;border-spacing:0}.wdi_advanced_option .wdi_advanced_option_head{border-bottom:1px solid #e3e3e3}.wdi_advanced_option .wdi_advanced_option_head th{padding-top:10px;padding-bottom:10px}.wdi_advanced_option.wdi_advanced_option_open .wdi_advanced_option_head th{border-bottom:1px solid #e3e3e3;border-bottom-left-radius:10px}.wdi_advanced_option.wdi_advanced_option_open .wdi_advanced_option_head td{border-bottom:1px solid #e3e3e3;border-bottom-right-radius:10px}.instagram-feed_page_wdi_settings table.wdi_advanced_option th{padding-left:12px}.instagram-feed_page_wdi_settings table.wdi_advanced_option td .wdwt_param{margin-left:15px}.instagram-feed_page_wdi_settings #wdwt_wrap_wdi_disable_fa .optioninput{display:inline-block}.wdi_advanced_option .wdi_advanced_option_icon{background-repeat:no-repeat;background-position:left top;width:20px;height:20px;display:inline-block;position:absolute;top:16px;right:10px}.wdi_advanced_option.wdi_advanced_option_close .wdi_advanced_option_icon{background-image:url(../images/arrow_1.png)}.wdi_advanced_option.wdi_advanced_option_open .wdi_advanced_option_icon{background-image:url(../images/arrow_2.png)}.wdi_advanced_option.wdi_advanced_option_close tbody tr:not(.wdi_advanced_option_head){display:none}#wdi_options_page_buttons_wrapper{margin-top:10px;width:700px}.wdi_hidden{display:none!important}.selectoff{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.wdi_filter_radio{margin:5px;display:inline-block}.wdi_filter_radio label{vertical-align:text-bottom}.filters_description{font-size:13px;font-weight:700;margin-top:8px;display:inline-block}.wdi_filter_input input{width:250px;margin-right:0;padding-right:0}#wdi_filter_type{line-height:28px;margin:0;padding:0;position:relative;right:2px;top:-1px;font-weight:400}.wdi_filter_item{display:inline-block;padding:6px;margin-top:5px;border-radius:5px}.wdi_filter_by_username{background-color:#00a0d2;color:#fff}.wdi_filter_by_hashtag{background-color:#e08d11;color:#fff}.wdi_logic{display:inline-block;padding:5px;font-weight:700}.wdi_filter_by_location{background-color:#509833;color:#fff}.wdi_filter_by_mention{background-color:#833888;color:#fff}.wdi_filter_by_description{background-color:#bd242b;color:#fff}.wdi_filter_by_url{background-color:#004eff;color:#fff}.wdi_remove_filter{padding-left:5px;color:#fff;font-size:13px}.wdi_remove_filter:hover{cursor:pointer}.wdi_source_user{border:1px solid #d4d4d4;background-color:rgba(0,0,0,.03);margin:0 4px 0 0;border-radius:5px;height:29px;display:inline-block;padding:2px 0 0 4px}.wdi_source_img{display:inline-block}.wdi_source_img img{width:22px;height:22px;border-radius:15px;display:block;padding:0}.wdi_source_username{display:inline-block;line-height:25px;font-size:15px!important;height:30px;vertical-align:bottom;padding:0 5px;font-weight:700}#login_with_instagram>a:focus{-webkit-box-shadow:none;box-shadow:none}.wdi_help_bar_wrap{background-color:#fff;border:none;box-sizing:border-box;clear:both;color:#6e7990;font-size:14px;font-weight:700;line-height:30px;padding:15px;vertical-align:middle;width:100%;margin:20px 0 0 0}.wdi_help_bar_wrap a,.wdi_help_bar_wrap span{font-size:14px}.wdi_help_bar_text{float:left}.wdi_help_bar_text>a{color:#0073aa;text-decoration:none}.wdi_hb_buy_pro{float:right;padding:0}.wdi_hb_buy_pro a,.wdi_hb_buy_pro a:active,.wdi_hb_buy_pro a:hover,.wdi_hb_buy_pro a:visited{display:inline-block;font-weight:700;font-size:14px;vertical-align:middle;border:none;box-shadow:none!important;text-decoration:none}.wdi_hb_buy_pro .wdi_support_link{color:#72777c!important;padding:0 10px}.wdi_hb_buy_pro .wdi_update_pro_link{background:#45a6b7;font-weight:700;line-height:30px;padding:0 18px 0 18px;color:#fff!important}.wdi_hb_buy_pro img{border:none;display:inline-block;vertical-align:middle}#bull_style,#bullets_images_color,#bullets_images_type,#rl_butt_color,#rl_butt_style,#rl_butt_type{margin:0 10px 0 0;width:100px}.wds_ctrl_btn_upload{display:block!important;margin:5px 0!important;text-align:center;vertical-align:middle;width:95%}.wds_reverse{margin:0 5px!important}.wds_free_button,.wds_free_button:hover{background:linear-gradient(to bottom,#e5e5e5,#e5e5e5) repeat scroll 0 0 #f3f3f3!important;border-color:#bbb!important;color:#888!important}.wdi_spider_free_version_label,.wdi_spider_free_version_label *{color:grey!important}.wdi_spider_free_version{background-color:#dfdfdf;border:1px solid #797979;border-radius:2px;padding:2px;width:210px}.wds_more{font-size:12px}.wrap .button{border-radius:3px!important;text-shadow:none!important}.wdi_spider_message_cont{display:none;width:99%}.wdi_spider_load{display:none}.wdi_spider_load_cont{background-color:rgba(0,0,0,.2);left:0;height:100%;position:fixed;top:0;width:100%;z-index:99998}.wdi_spider_load_icon{left:0;height:100%;position:fixed;text-align:center;top:0;width:100%;z-index:99999}.wdi_spider_ajax_loading{border:none!important;margin-top:200px;width:50px;-webkit-animation:spin 2.5s infinite linear;-moz-animation:spin 2.5s infinite linear;-o-animation:spin 2.5s infinite linear;animation:spin 2.5s infinite linear}@-moz-keyframes spin{0%{-moz-transform:rotate(0)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0)}100%{-o-transform:rotate(359deg)}}@-ms-keyframes spin{0%{-ms-transform:rotate(0)}100%{-ms-transform:rotate(359deg)}}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(359deg)}}#TB_iframeContent,#TB_window{width:800px!important;height:500px!important}#TB_window{margin-left:-400px!important}.input_th{margin-left:0!important;width:160px!important;font-family:sans-serif}.input_th2{margin-left:0!important;width:160px!important;margin-top:5px;height:19px}.edit_input{height:28px!important;padding-bottom:7px!important}.add_tag_th{padding-left:21px;font-size:12px;font-family:sans-serif}.pointer{cursor:pointer}.non_selectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.wds_position_table input,.wds_position_table td{border:1px solid #ccc;margin:2px}.wds_position_table .wds_position_td{background-color:#f4f4f4;display:inline-block;line-height:1;padding:0!important}.wdi_spider_div_options{background:none repeat scroll 0 0 #f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;display:none;margin:2px 0 0 190px;padding:13px;min-height:300px;min-width:600px;vertical-align:top}.table_medium_col{text-align:center!important;width:70px}.table_medium_col_uncenter{width:80px}.table_extra_large_col{padding:4px!important;width:150px!important}.first-page,.last-page,.next-page,.prev-page,.table_big_col a,.table_extra_large_col a,.table_medium_col a,.table_small_col a{cursor:pointer}.wdi_spider_word_wrap{word-wrap:normal}.wdi_spider_description{color:#666;font-size:.923em;line-height:1.231em}.handle{background:url(../images/draggable.png) no-repeat transparent;border:none;cursor:move;display:inline-block;height:15px;margin:0 auto;vertical-align:middle;width:15px}.wdi_page_title{font-size:1.5em;font-weight:500}.slider-icon{background-image:url(../images/slider-icon.png);background-repeat:no-repeat;border:none;float:left;height:32px;margin:7px 8px 0 0;width:32px}.theme-icon{background-image:url(../images/theme-2.png);background-repeat:no-repeat;border:none;float:left;height:32px;margin:7px 8px 0 0;width:32px}.uninstall-icon{background-image:url(../images/uninstall-icon.png);background-repeat:no-repeat;border:none;float:left;height:32px;margin:7px 8px 0 0;width:32px}.wdi_spider_label{font-weight:700;width:100px}.wdi_spider_label_top{font-weight:700;padding-top:3px;vertical-align:top;width:100px}.wdi_spider_fieldset .wdi_spider_label{font-weight:700;vertical-align:top;width:150px}.wdi_spider_label_options{font-weight:700;vertical-align:top;width:150px}.wdi_spider_choose_option{display:table;box-shadow:0 0 1px 1px #d2d2d2;margin-bottom:5px;border-radius:2px;padding:2px;box-sizing:border-box;cursor:pointer;width:100%}.wdi_spider_bull_options_color_cont,.wdi_spider_bull_options_cont,.wdi_spider_options_color_cont,.wdi_spider_options_cont,.wdi_spider_pp_options_color_cont,.wdi_spider_pp_options_cont{display:none;width:180px;height:150px;overflow:scroll;overflow-x:hidden;overflow-y:scroll}.wdi_spider_option_cont{display:block;border-bottom:1px solid #d3d3d3;padding:3px 0 3px 0;box-sizing:content-box;width:98%;border-radius:0;cursor:pointer}.wdi_spider_option_cont_title{display:table-cell;vertical-align:middle;padding:0 0 0 4px}.wdi_spider_option_cont_img{display:table-cell;width:23%;height:15px;text-align:right;padding:5px 4px 0 0;box-sizing:border-box;background-color:#eee}.wdi_spider_option_main_title{display:table-cell;width:65%;vertical-align:middle;padding:0 0 0 4px;color:#555}.wdi_spider_sel_option_ic{display:table-cell;width:20%;height:15px;text-align:right;padding:0 6px 0 0;box-sizing:border-box}.wdi_spider_int_input{width:45px}.wdi_spider_char_input{width:115px}.wdi_spider_text_input{width:190px}.wdi_spider_slider_div{display:inline-block;vertical-align:middle;width:140px}.wdi_spider_slider_percentage,.wdi_spider_slider_percentage input,.wdi_spider_slider_percentage input :focus{background:0 0;border:none;color:#00aeef;display:inline;font-weight:700;text-align:right;vertical-align:middle;width:30px}.error,.updated{margin:5px 0 2px!important}.buttons_div{clear:both;float:right;margin:5px 0}.buttons_div_left{float:left;margin:5px 0;width:100%}.buttons_div_right{float:right;margin:5px 0}.wdi_spider_delete_img{background-image:url(../images/delete.png);border:none;cursor:pointer;display:inline-block;vertical-align:middle;height:14px;width:14px}.wdi_spider_delete_img_small{background-image:url(../images/delete.png);background-size:10px auto;border:medium none;cursor:pointer;display:inline-block;height:10px;margin-top:2px;vertical-align:middle;width:10px}.wdi_spider_fieldset{background:none repeat scroll 0 0 #f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;display:none;float:left;margin:4px;padding:13px;width:97%}.wdi_spider_type_fieldset{background:none repeat scroll 0 0 #f4f4f4;border-radius:8px 8px 8px 8px;display:none;float:left;width:100%}.wdi_spider_child_fieldset{background:none repeat scroll 0 0 #f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;float:left;margin:4px;width:30%;padding:13px;display:block}.wdi_spider_table td{padding:0;vertical-align:middle}.wdi_spider_ctrls{padding:4px;text-align:center;width:40px}.theme_type{background-color:#f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;cursor:pointer;display:inline-block;font-size:16px;height:24px;padding-top:5px;text-align:center;vertical-align:middle;width:123px;margin:2px 0 2px 0}.ui-slider-handle{cursor:pointer!important}.thumb{border:1px solid #ccc;max-height:120px;max-width:120px}.fileDescription{color:#666;cursor:pointer;font-family:sans-serif;font-size:12px}.filename{font-size:13px}.tag_div{background-clip:padding-box;background-color:#f3f3f3;border:1px solid #aaa;border-radius:3px 3px 3px 3px;box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#666;line-height:13px;margin:2px 0;padding:2px 5px 2px 5px;width:132px}.tags_div{overflow-y:auto;height:65px}.tag_name{width:118px}.edit_thumb{cursor:pointer}.wdi_spider_rotate{border-radius:2px;border:1px solid #fff;height:30px}.wdi_spider_search_value{height:2em;margin:0 0 4px}#th_order,.wdi_spider_order{display:none}.wds_add_video,.wds_exports,.wds_import,.wds_resize_image{display:none;padding:10px;height:60px;background-color:#fff;border:1px solid #999;top:50%;position:fixed;left:50%;text-align:left;z-index:100000;border-radius:3px;margin-top:-45px}.wds_add_video,.wds_resize_image{margin-left:-340px}.wds_exports{margin-left:-240px}.wds_import{margin-left:-185px}.wds_add_video input[type=text],.wds_resize_image input[type=text]{width:500px}.wds_opacity_export,.wds_opacity_import,.wds_opacity_video{background-color:#000;display:none;opacity:.75;filter:Alpha(opacity=75);position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998}.wds_tabs{clear:both;display:none;position:relative;z-index:1}.wds_tabs a.wds_active,.wds_tabs a.wds_sub_active{background-color:#f5f5f5;border-bottom:1px solid #f5f5f5;color:#333}.wds_tabs a{background-color:#f9f9f9;border:1px solid #dfdfdf;border-top-left-radius:3px;border-top-right-radius:3px;color:#c7c7c7;display:block!important;float:left;font:bold 17px/32px Arial,serif;height:30px;margin:3px 3px 0 0;padding:0 10px;position:relative;text-decoration:none;width:130px}.wbs_subtab a{font:bold 14px/26px Arial,serif;height:26px;padding:0 5px;width:105px}.wds_add_layer{font:normal 20px/28px Arial,serif!important;width:initial!important;padding:0 9px!important}.wds_tab_title{background:none repeat scroll 0 0 transparent!important;border:none!important;cursor:pointer;opacity:.5;filter:Alpha(opacity=50);padding:1px;vertical-align:middle;width:50px}.wds_layer_title,.wds_sub_active .wds_tab_title{background-color:#fff!important;border-color:#dfdfdf!important;border-radius:3px!important;border-style:solid!important;border-width:1px!important;cursor:pointer;opacity:1;filter:Alpha(opacity=100)}.wds_tab_remove{background-image:url(../images/close.png);background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:9px;height:9px;opacity:.5;filter:Alpha(opacity=50);vertical-align:middle}.wds_layer_remove{background-image:url(../images/close.png);background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:15px;height:15px;margin:5px;float:right}.wds_layer_dublicate{background-image:url(../images/duplicate.png);background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:15px;height:15px;margin:5px;float:right}.wds_slide_dublicate{background-image:url(../images/duplicate.png);background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:12px;height:12px;vertical-align:middle}.wds_layer_depth{float:right;font-size:13px;line-height:15px;margin:1px 5px;text-align:left;width:40px}.wds_layer_label{display:inline-block;font-size:13px;width:80%}.wds_sub_active .wds_tab_remove{cursor:pointer!important;opacity:1;filter:Alpha(opacity=100)}.wds_box.wds_active,.wds_box.wds_sub_active{display:block}.wds_tab_label{display:block;width:inherit}.wds_box{display:none;margin-top:0!important;position:relative;top:-1px}.wds_box{border:1px solid #dfdfdf;border-radius:3px;box-shadow:0 0 10px #f2f2f2;margin-top:15px;position:relative}.wds_clear{clear:both;float:none!important}.wds_box thead td{border-bottom:0 none!important}.wds_box tbody{background-color:#fff;border-top:0 none;padding-left:10px}.wds_box thead{background:-webkit-linear-gradient(#f5f5f5,#fff);background:-o-linear-gradient(#f5f5f5,#fff);background:-moz-linear-gradient(#f5f5f5,#fff);background:linear-gradient(#f5f5f5,#fff);border-top:0 none;border-bottom:0 none;color:#333;font:bold 12px/29px Arial,serif;height:29px;margin:0;padding:0 10px;text-align:left;text-shadow:0 1px 0 #fff}.wds_box table{border-collapse:collapse;border-spacing:0;width:100%}.wds_nav_tabs{background-color:#f5f5f5;border-right:1px solid #dfdfdf;float:left;height:640px;margin:0;width:150px}.wds_nav_tabs ul{list-style:none outside none;margin:10px 0;padding:0}.wds_nav_tabs .wds_active,.wds_nav_tabs .wds_active a,.wds_nav_tabs .wds_active a:hover,.wds_nav_tabs .wds_sub_active,.wds_nav_tabs .wds_sub_active a,.wds_nav_tabs .wds_sub_active a:hover{background:none repeat scroll 0 0 #fff;color:#333}.wds_nav_tabs .wds_active{border-color:#dfdfdf;border-width:1px 0 1px 1px;border-style:solid;margin:0 -1px 0 -4px;padding:0}.wds_nav_tabs li{border-color:transparent;border-style:solid;border-width:1px 0;list-style-type:none;margin-bottom:0}.wds_nav_tabs a{display:block;line-height:18px;padding:5px 5px 5px 12px;text-decoration:none}.wds_nav_box{background:none repeat scroll 0 0 #fff;display:none;height:610px;overflow:auto;padding:15px}.wds_nav_box.wds_active{display:block}.wds_layer_head{background-color:#f5f5f5;border-bottom:1px solid #dfdfdf;border-top:1px solid #dfdfdf;cursor:pointer;padding:5px}.wds_layer_head .handle{cursor:move;display:inline-block;margin:5px}.wds_box td{padding:10px!important}.wds_draggable{box-sizing:border-box;cursor:move}.wds_box .color{width:60px}.wds_active_layer{box-shadow:#2c2424 0 0 5px;border-radius:3px}.wds_draggable a,.wds_draggable a:hover{color:inherit!important;font-size:inherit!important;font-style:inherit!important;font-weight:inherit!important;text-decoration:none}#add_embed_help{height:200px;width:672px;top:40%}#add_embed input[type=text]{width:500px}.wds_buttons{float:right;font-weight:400;position:relative}.wds_reset_button{display:none;font-weight:400;margin:10px 0;position:absolute;right:40px;z-index:1}.wdi_about_filed{font-size:13px;font-style:italic}#wdi_save_feed .two .section_col,.wdi_theme .section_col{width:47%;float:left;margin:0 1.5% 18px}.wdi_theme .section_col{margin-bottom:0}#wdi_save_feed .wdi_element{margin:0 0 18px}.display_type_content{background:#fff;border:1px solid #dedede;margin-bottom:15px}#wdi_save_feed .half .wdi_element,#wdi_save_feed .one .wdi_element{width:96%;float:none;margin:0 2% 20px}.wdi_element_name_liked_feed{display:none!important}#wdi_save_feed .wdi_element p{margin:2px 0 0}.wdi_section_name{font-size:19px;margin:0 auto 15px;width:100%;box-sizing:border-box;padding:15px;border-bottom:1px solid #f1f1f1;color:#444;cursor:pointer}.wdi_section{border:1px solid #dedede;margin-bottom:20px;background:#fff}.wdi_section .optioninput *,.wdwt_param .optioninput *{text-align:left}.wdi_section.half{width:49%;float:left;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wdi_buttons{text-align:right;margin-top:7px}.wdi_tab .wdi_section.half:last-child{margin-left:2%}label[for=WDI_user_padding]{display:block}.wdi_settings_notification{font-size:13px;color:#8b0000}#how_to_publish_tab .wdi_howto_container{display:flex;flex-wrap:wrap}#how_to_publish_tab .wdi_howto_content{border:1px #ddd solid;display:flex;flex:1;flex-direction:column;margin:5px;min-width:250px;max-width:calc(25% - 20px);padding:20px 10px;text-align:center}#how_to_publish_tab .wdi_howto_container h2{font-size:23px;font-weight:400;line-height:29px;margin:0;padding:11px 15px 4px 0}#how_to_publish_tab .wdi_howto_container .wdi_howto_content .wdi_howto_wrapper{max-width:270px;margin:0 auto}#how_to_publish_tab .wdi_howto_container .wdi_howto_content .wdi_howto_wrapper img{max-width:100%}#how_to_publish_tab .wdi_howto_container .wdi_howto_content input{margin:0 auto;text-align:center;width:100%}.wdi_buttons button.button.preview-button{height:28px}@media (max-width:782px){.wdi_buttons button.button.preview-button{height:auto}}@media (min-width:820px){#conditional_filters_tab .one .wdi_element{width:70%;float:none;margin:0 2% 20px}.wdi_border_wrapper .wdi_element_content{width:100%;display:block}.wdi_border_wrapper .wdi_element_title{display:block}.wdi_border_wrapper .wdi_element_content input[type=text]:not(.wp-color-picker){width:calc(100% - 30px);height:28px}.wdi_element_content .wdi_filter_input input[type=text]:not(.wp-color-picker){width:270px}.wdi_border_wrapper .wdi_element_content input#wdi_add_user_ajax_input{width:calc(100% - 78px)}.wdi_border_wrapper .wdi_element_content input[type=number]{width:calc(100% - 30px)}.wdi_border_wrapper .wdi_element_content select{width:calc(100% - 30px)}.wdi_element_content .wdi_filter_input select{width:calc(100% - 413px)}.wdi_filter_input input{height:28px;line-height:28px}}@media (max-width:768px){.wdi_element_content .wdi_filter_input input[type=text]{width:130px}.wdi_element_content .wdi_filter_input select{width:calc(100% - 144px)}#wdi_save_feed .two .section_col,.wdi_theme .section_col{width:96%;float:none;margin:0 2% 18px}.wdi_section.half{width:100%;float:none;margin:0 0 20px!important}.wdi_theme .section_col{margin-bottom:0}}.wdi_section_close::before{content:"\f142";display:inline-block;font:400 20px/1 dashicons;speak:none;float:right;cursor:pointer}.wdi_section_open::before{content:"\f140";display:inline-block;font:400 20px/1 dashicons;speak:none;float:right;cursor:pointer}.wdi-page-header{width:98%;padding:10px}.wdi-page-header .wdi_buttons{float:right}.wdi-page-header .WDI_title_input{padding:3px 8px;font-size:1.7em;line-height:100%;height:1.5em;width:30%;outline:0;margin:0 0 3px;background-color:#fff}.wdi_themes_list td{display:table-cell!important}#wdi_feed_form .wd-page-title.wd-header{width:100%;padding:10px 0}@media screen and (max-width:782px){#wdi_feed_form p.search-box{margin-bottom:0}#wdi_feed_form p.search-box input[type=search]{width:100%;height:auto!important}#wdi_feed_form p.search-box input[type=button]{margin-bottom:10px;padding:6px 14px;line-height:normal;font-size:14px;height:auto}.wdi-page-header .WDI_title_input{width:60%}.wdi-page-header .wdi_buttons{float:none;text-align:center}}.wdi_element_name_hashtag_top_recent{display:none}body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(4),body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(5){display:none}body.instagram-feed_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(3){display:table-row!important}body.instagram-feed_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(4){display:table-row!important}.wdi_settings_form .button{min-height:unset;padding:9px 20px;background:#fff 0 0 no-repeat;border:1px solid #dedede;border-radius:4px;line-height:19px;font-weight:600;font-size:14px;color:#32373c;height:auto!important}.wdi-page-title{margin-bottom:30px;text-align:left;letter-spacing:0;font-size:22px;color:#323a45}.wdi-input-group{margin:0 0 30px 0}.wdi-input-group:last-child{margin:0}.wdi-input-group label{display:block;margin-bottom:15px;font-weight:700;line-height:20px;font-size:15px;color:#323a45}.wdi-input-group .wdi-description{font-style:italic}.wdi-input-group input[readonly],.wdi-input-group input[type=text],.wdi-input-group textarea{width:100%;max-height:40px;margin:0;padding:10px 12px;background:#fff;border-radius:4px;border:1px solid #ddd;font-weight:400;font-size:15px;color:#323a45}.wdi-input-group textarea{max-height:100px;min-height:100px}.wdi-input-group select{max-width:unset;width:100%;margin:0;padding:10px 12px;border-radius:4px;border:1px solid #ddd;font-weight:400;font-size:15px;color:#323a45}.wdi-connect-instagram{background-image:url(../images/instagram-connect.png);background-size:cover;width:330px;height:50px;cursor:pointer}.wdi-access-token-missing{max-width:778px;margin:10px 0 50px 0;line-height:17px;font-size:13px;color:#323a45}.wdi-access-token-missing p{margin:0}.wdi-accounts-list li{margin-bottom:20px;padding:20px;background:#f9f9f9}.wdi-accounts-list .wdi-account-block{display:flex;flex-wrap:wrap;justify-content:space-between}.wdi-accounts-list .wdi-account-user-info{float:left;min-width:145px;margin-right:15px}.wdi-accounts-list .wdi-account-name{margin:0;font-weight:700;line-height:24px;font-size:18px;color:#323a45}.wdi-accounts-list .wdi-account-type{margin:0;line-height:16px;text-transform:capitalize;font-size:12px;color:rgba(50,58,69,.8)}.wdi-accounts-list .wdi-account-show-token{float:left;width:27px;height:27px;padding:8px 0 0 8px;background:#fff;border:1px solid #dedede;border-radius:4px;cursor:pointer}.wdi-accounts-list .wdi-account-remove{display:block;padding:9px 20px;background:#fff 0 0 no-repeat padding-box;border:1px solid #dedede;border-radius:4px;font-weight:500;font-size:14px;color:#32373c;cursor:pointer;height:auto!important}.wdi-accounts-list .wdi-account-accesstoken{margin-top:25px;display:none;clear:both}.wdi-account-accesstoken .wdi-account-remove{display:none}.wdi-advanced-options{max-width:752px;padding:20px;margin-top:30px;background:#f9f9f9}.wdi-advanced-options .wdi-advanced-headline{margin-bottom:25px;padding-bottom:16px;border-bottom:1px solid #e5e5e5;cursor:pointer}.wdi-advanced-options .wdi-advanced-headline .wdi-page-title{float:left;margin:0;font-size:16px}.wdi-advanced-options .wdi-advanced-headline i{float:right;cursor:pointer}.wdi-advanced-options .wdi-advanced-body{display:none}.wdi_settings_form .submit{margin:30px 0 0 0;padding:0}.wdi_settings_form .button-primary{background:#007cba;border-color:#007cba;color:#fff;height:auto!important}.wdi-popup{display:none;position:fixed;height:100%;width:100%;top:0;left:0;background:rgba(0,0,0,.3);z-index:1000000}.wdi-popup .wdi-popup-container{top:50%;transform:translate(0,-50%);width:800px;position:relative;margin:0 auto;padding:30px 30px 25px 30px;background:#fff;border-radius:4px}.wdi-popup .wdi-popup-container .wdi-popup-close{display:block;position:absolute;top:12px;right:11px;width:10px;height:10px;background-image:url(../images/close.svg);background-position:center;background-repeat:no-repeat;cursor:pointer}.wdi-popup .wdi-popup-container h3{margin:0 0 30px 0;line-height:30px;font-weight:700;font-size:20px}#wdi-personal-business-popup .wdi-popup-container{width:570px;height:auto;text-align:center}.wdi_paid{pointer-events:none!important;font-size:12px;text-decoration:none;color:#fff;background:transparent linear-gradient(262deg,#008a62 0,#23b536 100%) 0 0 no-repeat padding-box;border-radius:4px;padding:8px 12px;float:right;margin-top:20px}.wdi-label-business:after{clear:both;display:table;content:""}.wdi-popup-container:after{clear:both;display:table;content:""}#wdi-personal-business-popup .wdi-radio-button{margin:0;font-size:14px}#wdi-personal-business-popup .wdi-radio-button p{margin:0;display:block;width:100%;text-align:left;background:#fff 0 0 no-repeat padding-box;box-shadow:0 0 10px #00000026;margin-bottom:20px;padding:21px 20px 20px 42px;box-sizing:border-box;border-radius:4px}.wdi-radio-button .wdi-label-business label input,.wdi-radio-button .wdi-label-business label span,.wdi-radio-button .wdi-label-personal label input,.wdi-radio-button .wdi-label-personal label span{position:relative;left:-24px}#wdi-personal-business-popup .wdi-radio-button p:first-child{margin-right:50px}#wdi-personal-business-popup .wdi-radio-button p label{font-size:14px;display:block}.wdi_info_text{font-size:14px;line-height:20px;font-weight:400;color:rgba(50,58,69,.5);margin-top:4px;display:block}#wdi-personal-business-popup .dashicons-info{color:#ccc}.wdi-radio-button .wdi-radio-info-text{display:none;position:absolute;max-width:220px;margin:5px 0 0 78px;padding:14px;background:#fff;box-shadow:0 0 8px rgba(0,0,0,.14);border:1px solid #dadcdc;border-radius:4px;line-height:20px;font-size:14px}.wdi-radio-button .wdi-label-business .wdi-radio-info-text{margin:5px 0 0 -152px}.wdi-radio-button .wdi-radio-info-text.active{display:block}#wdi-personal-business-popup .wdi-connect{width:140px;height:37px;margin-top:10px;padding:0;line-height:37px;font-size:14px;background-color:#2160b5;float:right}@media screen and (max-width:1919px){.wdi-advanced-options{max-width:unset}}@media screen and (max-width:767px){br.wdi_desktop{display:none!important}#wdi-personal-business-popup .wdi-connect{margin-top:0}.wdi_paid{width:229px;box-sizing:border-box;padding:8px 7px;font-size:11px}.wdi-radio-button input[type=radio]:checked:before{width:6px;height:6px;margin:4px}input[type=checkbox],input[type=radio]{height:16px;width:12px}#wdi-personal-business-popup .wdi-radio-button p{padding:19px 18px 18px 38px}.wdi-radio-button .wdi-label-business label input,.wdi-radio-button .wdi-label-business label span,.wdi-radio-button .wdi-label-personal label input,.wdi-radio-button .wdi-label-personal label span{position:relative;left:-25px}.wdi-popup .wdi-popup-container{padding:30px 20px 20px 20px}.wdi-settings-page .wdi_settings_form{margin-right:10px;padding:20px 15px}.wdi-connect-instagram{background-image:url(../images/instagram-connect-320.png);width:272px;height:40px}.wdi-account-block>div{width:100%}.wdi-accounts-list li{margin-bottom:15px;padding:20px 15px}.wdi-accounts-list .wdi-account-show-token{float:right}.wdi-account-block .wdi-account-remove{display:none}.wdi-account-accesstoken .wdi-account-remove{display:block;float:right;margin-top:20px}#wdi-personal-business-popup .wdi-popup-container{width:300px;box-sizing:border-box}.wdi-popup .wdi-popup-container h3{max-width:260px;margin:0 auto 20px auto;font-size:16px;line-height:26px}.wdi-radio-button .wdi-label-personal .wdi-radio-info-text{margin:5px 0 0 12px}.wdi-radio-button .wdi-label-business .wdi-radio-info-text{margin:5px 0 0 -147px}.wdi_settings_form .submit{margin-top:25px}}.wdi_pro_only{font-style:italic;color:#4e4e4e!important;background-color:#ccc!important;text-decoration:none;font-weight:700}.wdi-pro-overlay img{opacity:.7}.wdi_pro_notice{text-align:right;color:#15699f;font-size:20px!important;padding:10px}.wdi-radio-button .wdi_account_type{font-weight:700;color:#323A4580}.wdi_input_group{border:1px solid transparent}.wdi_active{border:1px solid #2160b5}.wdi_active .wdi_account_type,.wdi_active .wdi_info_text{color:#323a45}.wdi_free .wdi_info_text span{text-decoration:underline}.wdi_pro .wdi_account_type,.wdi_pro .wdi_info_text{color:#323a45!important}#wdi_save_loading{position:fixed;width:100%;height:100%;background-color:rgba(0,0,0,.7);z-index:999999;margin:auto;display:flex;justify-content:center;align-items:center;top:50%;left:50%;transform:translate(-50%,-50%)}#wdi_save_loading .caching-process-message{color:#fff;font-size:25px;line-height:30px;text-align:center}#wdi_save_loading img{position:absolute}
framework/WDICache.php CHANGED
@@ -6,12 +6,14 @@
6
  class WDICache {
7
 
8
  private $wdi_options = NULL;
 
9
 
10
  /**
11
  * WDICache constructor.
12
  */
13
- function __construct() {
14
  global $wdi_options;
 
15
  $this->wdi_options = $wdi_options;
16
  }
17
 
@@ -26,7 +28,6 @@ class WDICache {
26
  public function get_cache_data( $name, $debug = FALSE ) {
27
  $transient_key = "wdi_cache_" . md5($name);
28
  $cache_data = get_transient($transient_key);
29
-
30
  if ( isset($cache_data) && $cache_data != FALSE && isset($cache_data["cache_response"]) ) {
31
  $wdi_debugging = FALSE;
32
  $wdi_debugging_data = array();
@@ -71,12 +72,7 @@ class WDICache {
71
  * @return array|bool
72
  */
73
  public function set_cache_data($name, $response){
74
- if ( isset($this->wdi_options["wdi_transient_time"]) ) {
75
- $wdi_transient_time = intval($this->wdi_options["wdi_transient_time"]);
76
- }
77
- else {
78
- $wdi_transient_time = 60;
79
- }
80
  $cache_date = (date('Y-m-d H:i:s'));
81
  $wdi_cache_response = $response;
82
  $transient_key = "wdi_cache_" . md5($name);
@@ -107,4 +103,18 @@ class WDICache {
107
 
108
  return $data;
109
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  }
6
  class WDICache {
7
 
8
  private $wdi_options = NULL;
9
+ private $feed_id = 0;
10
 
11
  /**
12
  * WDICache constructor.
13
  */
14
+ function __construct( $feed_id = 0 ) {
15
  global $wdi_options;
16
+ $this->feed_id = $feed_id;
17
  $this->wdi_options = $wdi_options;
18
  }
19
 
28
  public function get_cache_data( $name, $debug = FALSE ) {
29
  $transient_key = "wdi_cache_" . md5($name);
30
  $cache_data = get_transient($transient_key);
 
31
  if ( isset($cache_data) && $cache_data != FALSE && isset($cache_data["cache_response"]) ) {
32
  $wdi_debugging = FALSE;
33
  $wdi_debugging_data = array();
72
  * @return array|bool
73
  */
74
  public function set_cache_data($name, $response){
75
+ $wdi_transient_time = WDI_TRANSIENT_DEFAULT_TIME;
 
 
 
 
 
76
  $cache_date = (date('Y-m-d H:i:s'));
77
  $wdi_cache_response = $response;
78
  $transient_key = "wdi_cache_" . md5($name);
103
 
104
  return $data;
105
  }
106
+
107
+ /**
108
+ * Reset cache by feed_id.
109
+ *
110
+ * @param $feed_id integer
111
+ *
112
+ * @return bool|int
113
+ */
114
+ public function reset_feed_cache( $feed_id ) {
115
+ global $wpdb;
116
+ $transient_key = "wdi_cache_" . md5($feed_id);
117
+ $result = $wpdb->query('DELETE FROM ' . $wpdb->prefix . 'options WHERE option_name LIKE "%'.$transient_key.'%"');
118
+ return $result;
119
+ }
120
  }
framework/WDIInstagram.php CHANGED
@@ -47,123 +47,75 @@ class WDIInstagram {
47
  return array();
48
  }
49
 
50
- public function getUserMedia( $user_name ) {
 
 
 
 
 
 
 
 
51
  if ( isset($this->wdi_authenticated_users_list) && is_array($this->wdi_authenticated_users_list) && isset($this->wdi_authenticated_users_list[$user_name]) ) {
52
-
53
- $next_url = WDILibrary::get('next_url', '', 'esc_url_raw', 'POST' );
54
- if ( $next_url != '' ) {
55
- $baseUrl = $next_url;
56
- }
57
- else {
58
- $this->account_data = $this->wdi_authenticated_users_list[$user_name];
59
- $user_id = $this->account_data["user_id"];
60
- $access_token = $this->account_data["access_token"];
61
- $api_url = 'https://graph.instagram.com/v1.0/';
62
- $media_fields = 'id,media_type,media_url,permalink,thumbnail_url,username,caption,timestamp';
63
- if ( $this->account_data["type"] === "business" ) {
64
- $api_url = 'https://graph.facebook.com/v8.0/';
65
- $media_fields = 'id,media_type,media_url,permalink,thumbnail_url,username,caption,timestamp,ig_id,is_comment_enabled,like_count,owner,shortcode';
66
- }
67
- $baseUrl = $api_url . $user_id . '/media/?fields=' . $media_fields . '&limit=100&access_token=' . $access_token;
68
- }
69
- $cache_data = $this->cache->get_cache_data($baseUrl);
70
  if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) ) {
 
71
  return base64_decode($cache_data["cache_data"]);
 
 
72
  }
73
- $args = array();
74
- $response = wp_remote_get($baseUrl, $args);
75
- if ( !isset($response->errors) && is_array($response) && isset($response["body"]) ) {
76
- $data = json_decode($response["body"], TRUE);
77
- if ( !empty($data['data']) ) {
78
- $return_data = $this->convertPersonalData($data);
79
- $return_data = json_encode($return_data);
80
- $this->cache->set_cache_data($baseUrl, base64_encode($return_data));
81
- return $return_data;
82
- }
83
- }
84
- $return_data = '{"error":{"message":"cURL error","type":"http_request_failed"}}';
85
- return $return_data;
86
  }
87
  }
88
 
89
- public function getTagRecentMedia( $tagname, $endpoint, $next_url = NULL, $wdiTagId = FALSE, $user_name = NULL ) {
90
- $this->account_data = $this->wdi_authenticated_users_list[$user_name];
91
- $return_data = array();
92
- if ( isset($next_url) ) {
93
- $baseUrl = $next_url;
94
- }
95
- else {
96
- $baseUrl = 'https://graph.facebook.com/{tagid}/' . $endpoint . '/?fields=media_url,caption,id,media_type,comments_count,like_count,permalink,children{media_url,id,media_type,permalink}&access_token=' . $this->account_data["access_token"] . '&limit=50&user_id=' . $this->account_data["user_id"];
97
- if ( $wdiTagId !== FALSE ) {
98
- $baseUrl = str_replace("{tagid}", $wdiTagId, $baseUrl);
99
- }
100
- else {
101
- $data = $this->getHastagDataUrl($tagname, $baseUrl);
102
- if ( isset($data["id"]) && isset($data["url"]) ) {
103
- $baseUrl = $data["url"];
104
- $return_data["tag_data"] = array(
105
- 'id' => "#" . $tagname,
106
- 'username' => "#" . $tagname,
107
- 'tag_id' => $data["id"],
108
- );
109
- }
110
- }
111
- }
112
- /***********************************************************/
113
- $args = array();
114
- $cache_data = $this->cache->get_cache_data($baseUrl);
115
- if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) ) {
116
- $cache_data_json = base64_decode($cache_data["cache_data"]);
117
- if ( isset($cache_data_json) && $cache_data_json !== "null" ) {
118
- return $cache_data_json;
119
- }
120
- }
121
 
122
- $response = wp_remote_get($baseUrl, $args);
123
- if ( !isset($response->errors) && is_array($response) && isset($response["body"]) ) {
124
- $response_arr = json_decode($response["body"], TRUE);
125
- $return_data["response"] = $response_arr;
126
- if ( !empty($return_data['response']) && !empty($return_data['response']['error']) ) {
127
- return $response['body'];
128
- }
129
- if ( !empty($return_data['response']) && !empty($return_data['response']['data']) ) {
130
- if ( !empty($this->conditions) ) {
131
- $this->cache->set_cache_data($baseUrl . "&iter=" . $this->iter, base64_encode(json_encode($return_data)));
132
- $response_arr['data'] = $this->filterUserMedia($response_arr, $this->conditions['conditional_filters'], $this->conditions['conditional_filter_type']);
133
- $response_arr['iter'] = $this->iter;
134
- $return_data["response"] = $response_arr;
135
- }
136
- else {
137
- $this->cache->set_cache_data($baseUrl, base64_encode(json_encode($return_data)));
138
- }
139
 
140
- return json_encode($return_data);
141
- }
 
142
  }
143
- $return_data = '{"error":{"message":"cURL error","type":"http_request_failed"}}';
144
- return $return_data;
145
  }
146
 
147
- private function getHastagDataUrl( $tagname, $baseUrl ) {
 
148
  $url = 'https://graph.facebook.com/v9.0/ig_hashtag_search/?user_id=' . $this->account_data["user_id"] . '&q=' . $tagname . '&access_token=' . $this->account_data["access_token"];
149
- $return_data = array();
150
  $args = array();
151
- $cache_data = $this->cache->get_cache_data($url);
152
- if ( !empty($cache_data) && $cache_data["success"] && !empty($cache_data["cache_data"]) ) {
153
- return json_decode($cache_data["cache_data"], TRUE);
154
- }
155
  $response = wp_remote_get($url, $args);
 
 
156
  if ( !isset($response->errors) && is_array($response) && isset($response["body"]) ) {
157
  $response = json_decode($response["body"], true);
158
  if ( !empty($response['data']) && !empty($response['data'][0]) && !empty($response['data'][0]['id']) ) {
159
  $hashtag_id = $response['data'][0]['id'];
160
- $baseUrl = str_replace("{tagid}", $hashtag_id, $baseUrl);
161
- $return_data["id"] = $hashtag_id;
162
- $return_data["url"] = $baseUrl;
163
- $this->cache->set_cache_data($url, json_encode($return_data, TRUE));
164
  }
165
- }
166
 
 
 
 
167
  return $return_data;
168
  }
169
 
@@ -289,6 +241,21 @@ class WDIInstagram {
289
  }
290
  }
291
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
 
293
  return $converted_data;
294
  }
@@ -372,30 +339,88 @@ class WDIInstagram {
372
  return $carousel_media;
373
  }
374
 
375
- public function wdi_preload_cache($data=NULL) {
376
- if(isset($data)){
377
- $feed_list = $this->get_feed_list($data, FALSE);
378
- }else{
379
- $this->cache->reset_cache();
380
- global $wpdb;
381
- $row = $wpdb->get_results("SELECT id, feed_users ,hashtag_top_recent FROM " . $wpdb->prefix . WDI_FEED_TABLE . " WHERE published=1 ORDER BY `feed_name` ASC");
382
- $feed_list = $this->get_feed_list($row, TRUE);
383
- }
384
- if(isset($feed_list)){
385
- foreach ($feed_list as $user_feed){
386
- if(isset($user_feed["feed_list"])){
387
- foreach ($user_feed["feed_list"] as $data){
388
- if($data["type"] === "user"){
389
- $this->getUserMedia($data["tag_name"]);
390
- }else{
391
- $this->getTagRecentMedia($data["tag_name"], 1, NULL, FALSE, $user_feed["user_name"]);
 
392
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  }
 
 
 
 
 
 
 
394
  }
395
  }
396
  }
397
  }
398
 
 
 
 
 
399
  private function get_feed_list($data, $cron = TRUE){
400
  $feed_list = array();
401
  if($cron){
47
  return array();
48
  }
49
 
50
+ /**
51
+ * Get user media from cache
52
+ *
53
+ * @param string $user_name connected username
54
+ * @param integer $fee_id
55
+ *
56
+ * @return string comments data
57
+ */
58
+ public function getUserMedia( $user_name, $feed_id ) {
59
  if ( isset($this->wdi_authenticated_users_list) && is_array($this->wdi_authenticated_users_list) && isset($this->wdi_authenticated_users_list[$user_name]) ) {
60
+ $cache_data = $this->cache->get_cache_data($feed_id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) ) {
62
+
63
  return base64_decode($cache_data["cache_data"]);
64
+ } else {
65
+ return json_encode(array('data'=>''));
66
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  }
68
  }
69
 
70
+ /**
71
+ * Get comments from endpoint or from cache
72
+ *
73
+ * @param string $user_name connected username
74
+ * @param string $media_id media id
75
+ *
76
+ * @return string comments data
77
+ */
78
+ public function getRecentMediaComments( $user_name, $media_id ) {
79
+ $data['data'] = '';
80
+ $data['meta']['code'] = 200;
81
+ return json_encode($data);
82
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
+ /**
85
+ * Get medias from cache
86
+ *
87
+ * @param string $feed_id
88
+ *
89
+ * @return string
90
+ */
91
+ public function getTagRecentMedia( $feed_id ) {
92
+ $cache_data = $this->cache->get_cache_data($feed_id);
93
+ if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) ) {
 
 
 
 
 
 
 
94
 
95
+ return base64_decode($cache_data["cache_data"]);
96
+ } else {
97
+ return json_encode(array('data'=>''));
98
  }
 
 
99
  }
100
 
101
+ public function wdi_getHashtagId( $tagname = '', $user_name='' ) {
102
+ $this->account_data = $this->wdi_authenticated_users_list[$user_name];
103
  $url = 'https://graph.facebook.com/v9.0/ig_hashtag_search/?user_id=' . $this->account_data["user_id"] . '&q=' . $tagname . '&access_token=' . $this->account_data["access_token"];
 
104
  $args = array();
 
 
 
 
105
  $response = wp_remote_get($url, $args);
106
+
107
+ $hashtag_id = '';
108
  if ( !isset($response->errors) && is_array($response) && isset($response["body"]) ) {
109
  $response = json_decode($response["body"], true);
110
  if ( !empty($response['data']) && !empty($response['data'][0]) && !empty($response['data'][0]['id']) ) {
111
  $hashtag_id = $response['data'][0]['id'];
112
+ $return_data['meta']['code'] = 200;
 
 
 
113
  }
114
+ } else {
115
 
116
+ }
117
+ $return_data["tag_id"] = $hashtag_id;
118
+ //$return_data['meta']['code'] = $hashtag_id;
119
  return $return_data;
120
  }
121
 
241
  }
242
  }
243
  }
244
+ return $converted_data;
245
+ }
246
+
247
+ /**
248
+ * Convert hashtag data
249
+ *
250
+ * @param data array
251
+ *
252
+ * @return array
253
+ */
254
+ private function convertHashtagData( $data ) {
255
+ $converted_data = array(
256
+ 'data' => array(),
257
+ 'pagination' => array(),
258
+ );
259
 
260
  return $converted_data;
261
  }
339
  return $carousel_media;
340
  }
341
 
342
+ public function wdi_set_preload_cache_data( $user_name, $feed_id, $endpoint, $tag_id, $tag_name ) {
343
+ if ( $tag_id === 'false' || (isset($this->wdi_authenticated_users_list) && is_array($this->wdi_authenticated_users_list) && isset($this->wdi_authenticated_users_list[$user_name])) ) {
344
+ $next_url = WDILibrary::get('next_url', '', 'esc_url_raw', 'POST');
345
+ $iter = WDILibrary::get('iter', 0, 'intval');
346
+ if ( $next_url != '' ) {
347
+ $baseUrl = $next_url;
348
+ $this->account_data = $this->wdi_authenticated_users_list[$user_name];
349
+ }
350
+ else {
351
+ $this->account_data = $this->wdi_authenticated_users_list[$user_name];
352
+ $user_id = $this->account_data["user_id"];
353
+ $access_token = $this->account_data["access_token"];
354
+ if( $tag_id === 'false' ) {
355
+ $api_url = 'https://graph.instagram.com/v1.0/';
356
+ $media_fields = 'id,media_type,media_url,permalink,thumbnail_url,username,caption,timestamp';
357
+ if ( $this->account_data["type"] === "business" ) {
358
+ $api_url = 'https://graph.facebook.com/v8.0/';
359
+ $media_fields = 'id,media_type,media_url,permalink,thumbnail_url,username,caption,timestamp,ig_id,is_comment_enabled,like_count,comments_count,owner,shortcode';
360
  }
361
+ $baseUrl = $api_url . $user_id . '/media/?fields=' . $media_fields . '&limit=100&access_token=' . $access_token;
362
+ } else {
363
+ $baseUrl = $this->wdi_getHashtagData($user_name, $endpoint, $tag_id);
364
+ }
365
+ }
366
+ $args = array(
367
+ 'timeout' => 60,
368
+ 'sslverify' => FALSE
369
+ );
370
+ $response = wp_remote_get($baseUrl, $args);
371
+
372
+ if ( !isset($response->errors) && is_array($response) && isset($response["body"]) ) {
373
+ $data = json_decode($response["body"], TRUE);
374
+ if ( !empty($data['data']) ) {
375
+ if ( !empty($this->conditions) ) {
376
+ $temp_data = $data;
377
+ $temp_data['data'] = $this->filterUserMedia( $data, $this->conditions['conditional_filters'], $this->conditions['conditional_filter_type'] );
378
+ if($tag_id !== 'false') {
379
+ $current_data = $this->convertHashtagData($temp_data);
380
+ } else {
381
+ $current_data = $this->convertPersonalData($temp_data);
382
+ }
383
+ } elseif( $tag_id !== 'false' ) {
384
+ $current_data = $this->convertHashtagData($data);
385
+ } else {
386
+ $current_data = $this->convertPersonalData($data);
387
+ }
388
+ /* Remove current feed cache data */
389
+ if ( $iter == 0 ) {
390
+ $this->cache->reset_feed_cache( $feed_id );
391
+ } else {
392
+ $cache_data = $this->cache->get_cache_data($feed_id);
393
+ if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) ) {
394
+ $cache_data = base64_decode($cache_data["cache_data"]);
395
+ $cache_data = json_decode($cache_data, 1);
396
+ $current_data['data'] = array_merge( $cache_data['data'], $current_data['data'] );
397
+ }
398
+ }
399
+
400
+ $current_data = json_encode($current_data);
401
+
402
+ $this->cache->set_cache_data($feed_id, base64_encode($current_data));
403
+ $return_data['next_url'] = '';
404
+ if ( isset($data['paging']['next']) && $data['paging']['next'] != '' ) {
405
+ $return_data['next_url'] = $data['paging']['next'];
406
+ $return_data['iter'] = $iter;
407
  }
408
+
409
+ return json_encode($return_data);
410
+ }
411
+ else {
412
+ $return_data['next_url'] = '';
413
+ $return_data['iter'] = $iter;
414
+ return json_encode($return_data);
415
  }
416
  }
417
  }
418
  }
419
 
420
+ public function wdi_getHashtagData($user_name, $endpoint, $tag_id) {
421
+ return '';
422
+ }
423
+
424
  private function get_feed_list($data, $cron = TRUE){
425
  $feed_list = array();
426
  if($cron){
frontend/shortcode.php CHANGED
@@ -102,7 +102,8 @@ function wdi_feed($atts, $widget_params = '') {
102
 
103
  $params = array(
104
  'current_feed_id' => $current_feed_id,
105
- 'number_of_photos' => $feed_row['number_of_photos']
 
106
  );
107
  wdi_register_frontend_scripts( $params );
108
  if ( WDILibrary::is_ajax() || WDILibrary::elementor_is_active() ) {
@@ -244,6 +245,7 @@ function wdi_register_frontend_scripts( $params = array() ){
244
  'WDI_MINIFY' => (WDI_MINIFY) ? 'true' : 'false',
245
  'feed_id' => $current_feed_id,
246
  'number_of_photos' => $number_of_photos,
 
247
  ));
248
 
249
  wp_localize_script("wdi_frontend", 'wdi_url', array(
102
 
103
  $params = array(
104
  'current_feed_id' => $current_feed_id,
105
+ 'number_of_photos' => $feed_row['number_of_photos'],
106
+ 'options' => $wdi_options
107
  );
108
  wdi_register_frontend_scripts( $params );
109
  if ( WDILibrary::is_ajax() || WDILibrary::elementor_is_active() ) {
245
  'WDI_MINIFY' => (WDI_MINIFY) ? 'true' : 'false',
246
  'feed_id' => $current_feed_id,
247
  'number_of_photos' => $number_of_photos,
248
+ 'wdi_cache_request_count' => isset($params['options']['wdi_cache_request_count']) ? $params['options']['wdi_cache_request_count'] : 10,
249
  ));
250
 
251
  wp_localize_script("wdi_frontend", 'wdi_url', array(
js/wdi_admin.js CHANGED
@@ -2,6 +2,7 @@ jQuery(document).ready(function() {
2
  /* @ToDo It must be separate for each user */
3
  jQuery("#wdi_reset_cache").click(function (e) {
4
  jQuery(".wdi_reset_cache_success").remove();
 
5
  e.preventDefault();
6
  jQuery.ajax({
7
  type: "POST",
@@ -12,11 +13,39 @@ jQuery(document).ready(function() {
12
  task:"reset",
13
  action:"wdi_cache"
14
  },
15
- success: function(data){
16
- if(data.success === false){
17
  jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>");
18
- }else{
19
- jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
  }
22
  });
@@ -468,6 +497,7 @@ wdi_controller.bindSaveFeedEvent = function() {
468
  * @param {String} task [this is self explanatory]
469
  */
470
  wdi_controller.save_feed = function ( task ) {
 
471
  var feed_users = [],
472
  id,
473
  type,
@@ -514,8 +544,8 @@ wdi_controller.save_feed = function ( task ) {
514
  else {
515
  feed_users.push(default_user);
516
  }
517
-
518
- jQuery('#WDI_feed_users').val(this.stringifyUserData(feed_users));
519
  jQuery('#wdi_feed_thumb').val('');
520
  if ( type == 'business' ) {
521
  jQuery('#wdi_feed_thumb').val(userObj.profile_picture_url);
@@ -525,9 +555,47 @@ wdi_controller.save_feed = function ( task ) {
525
  jQuery('#wdi_current_id').val(id);
526
  }
527
  jQuery('#task').attr('value', task);
 
 
 
 
 
528
  jQuery('#wdi_save_feed').submit();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
529
  }
530
 
 
531
  /**
532
  * Takes user input as argument and makes an
533
  * instagram request for getting meta info such as username and user id
@@ -569,37 +637,28 @@ wdi_controller.makeInstagramUserRequest = function ( user_input, ignoreConfirm )
569
  var tagname = user_input.substr(1, user_input.length);
570
  tagname = tagname.replace(' ', '');
571
  var radio = jQuery("input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val();
572
- this.instagram.getTagRecentMedia(tagname, {
573
- success: function ( response ) {
 
 
 
 
 
 
 
 
 
 
574
  jQuery('#wdi_add_user_ajax').removeAttr('disabled');
575
- // contain information about response such as error messages and if
576
- // response is valid or not
577
  var vObj = _this.isValidResponse(response);
578
- if ( vObj.valid && _this.hasData(response) ) {
579
  _this.addHashtag(tagname, response);
580
  }
581
- else {
582
- if ( !_this.hasData(response) && vObj.msg == 'success' ) {
583
- if ( ignoreConfirm != true ) {
584
- if ( confirm(wdi_messages.hashtag_no_data) ) {
585
- jQuery('#wdi_add_user_ajax_input').val('');
586
- // @ToDo. If we get the wrong answer, why add Hashtag?
587
- // _this.addHashtag(tagname, response);
588
- }
589
- else {
590
- jQuery('#wdi_add_user_ajax_input').val('');
591
- }
592
- }
593
- else {
594
- _this.addHashtag(tagname, response);
595
- }
596
- }
597
- else {
598
- alert(vObj.msg);
599
- }
600
- }
601
  }
602
- }, null, radio);
 
603
  break;
604
  }
605
  }
2
  /* @ToDo It must be separate for each user */
3
  jQuery("#wdi_reset_cache").click(function (e) {
4
  jQuery(".wdi_reset_cache_success").remove();
5
+ jQuery("#wdi_save_loading").removeClass("wdi_hidden");
6
  e.preventDefault();
7
  jQuery.ajax({
8
  type: "POST",
13
  task:"reset",
14
  action:"wdi_cache"
15
  },
16
+ success: function(result){
17
+ if(result.success === false){
18
  jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>");
19
+ } else{
20
+
21
+ wdi_controller.instagram = new WDIInstagram();
22
+
23
+ jQuery.each( result['data'], function( key, value ) {
24
+
25
+ var users = JSON.parse(value['users']);
26
+ var username = '';
27
+ var tagname = '';
28
+ var tag_id = '';
29
+ var endpoint = value['endpoint'];
30
+
31
+ jQuery.each( users, function( key1, value1 ) {
32
+ /* Hashtag case */
33
+ if( value1['tag_id'] !== "" ) {
34
+ tagname = value1['username'];
35
+ tagname = tagname.substr(1, tagname.length);
36
+ tagname = tagname.replace(' ', '');
37
+ tag_id = value1['tag_id'];
38
+ } else {
39
+ username = wdi_controller.getUserObj(value1['username']);
40
+ if (username) {
41
+ username = username['user_name'];
42
+ }
43
+ }
44
+ });
45
+ var feed_id = value['feed_id'];
46
+ wdi_controller.instagram.set_cache_data( '', username, feed_id, '', 0, 0, tagname, tag_id, endpoint, '' );
47
+ });
48
+ jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>");
49
  }
50
  }
51
  });
497
  * @param {String} task [this is self explanatory]
498
  */
499
  wdi_controller.save_feed = function ( task ) {
500
+
501
  var feed_users = [],
502
  id,
503
  type,
544
  else {
545
  feed_users.push(default_user);
546
  }
547
+ users = this.stringifyUserData(feed_users);
548
+ jQuery('#WDI_feed_users').val(users);
549
  jQuery('#wdi_feed_thumb').val('');
550
  if ( type == 'business' ) {
551
  jQuery('#wdi_feed_thumb').val(userObj.profile_picture_url);
555
  jQuery('#wdi_current_id').val(id);
556
  }
557
  jQuery('#task').attr('value', task);
558
+
559
+
560
+ //set_cache_data( users );
561
+ submit_ajax();
562
+ /*
563
  jQuery('#wdi_save_feed').submit();
564
+ */
565
+ }
566
+
567
+ var comlete_redirect_url = '';
568
+
569
+ function submit_ajax() {
570
+ var data = jQuery("#wdi_save_feed").serialize();
571
+ data = data + '&action=wdi_apply_changes&page=wdi_feeds';
572
+
573
+ jQuery("#wdi_save_loading").removeClass("wdi_hidden");
574
+ jQuery.ajax({
575
+ type: "POST",
576
+ url: wdi_ajax.ajax_url,
577
+ dataType: 'json',
578
+ data: data,
579
+ success: function (response) {
580
+ /* comlete_redirect_url url is redirect url which will be done after cash ajax complete */
581
+ comlete_redirect_url = response['url'];
582
+ var feed_id = response['feed_id'];
583
+ if( response['need_cache'] == 1 ) {
584
+ jQuery(".caching-process-message").removeClass("wdi_hidden");
585
+ /* TODO Timeout need as loader not appear without timeout, need to fix */
586
+ setTimeout(function(){ wdi_controller.instagram.set_cache_data(comlete_redirect_url, '', feed_id, '', 0, 0, '', '', '', ''); }, 1000);
587
+ } else {
588
+ jQuery("#wdi_save_loading").addClass("wdi_hidden");
589
+ window.location = comlete_redirect_url;
590
+ }
591
+ },
592
+ error: function (xhr, status, error) {
593
+ window.location = comlete_redirect_url;
594
+ }
595
+ });
596
  }
597
 
598
+
599
  /**
600
  * Takes user input as argument and makes an
601
  * instagram request for getting meta info such as username and user id
637
  var tagname = user_input.substr(1, user_input.length);
638
  tagname = tagname.replace(' ', '');
639
  var radio = jQuery("input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val();
640
+ var data = {
641
+ tagname : tagname,
642
+ action : 'wdi_getHashtagId',
643
+ wdi_nonce: wdi_ajax.wdi_nonce,
644
+ user_name: username,
645
+ };
646
+ jQuery.ajax({
647
+ type: "POST",
648
+ url: wdi_ajax.ajax_url,
649
+ dataType: 'json',
650
+ data: data,
651
+ success: function (response) {
652
  jQuery('#wdi_add_user_ajax').removeAttr('disabled');
 
 
653
  var vObj = _this.isValidResponse(response);
654
+ if ( vObj.valid ) {
655
  _this.addHashtag(tagname, response);
656
  }
657
+ },
658
+ error: function (xhr, status, error) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
  }
660
+ });
661
+
662
  break;
663
  }
664
  }
js/wdi_admin.min.js CHANGED
@@ -1 +1 @@
1
- function wdi_multiple_accounts_option_controller(){var e=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));e.addClass("wdi_multiple_accounts_section");var t="";if(wdi_options.wdi_authenticated_users_list){var i,r=JSON.parse(wdi_options.wdi_authenticated_users_list),a=0;for(i in r)t+="<tr data-multiple-account='"+a+"'>",t+="<th>Access Token</th>",t+='<td><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][access_token][]" size="53" required="" value="'+r[i].access_token+'"></td>',t+="</tr>",t+="<tr data-multiple-account='"+a+"' class='wdi_username_tr'>",t+="<th>Username</th>",t+='<td><div class="wdi_input_wrapper"><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][user_name][]" size="53" required="" value="'+r[i].user_name+'"></div><div class="wdi_remove_auth_user">Delete</div></td>',t+='<input type="hidden" name="wdi_instagram_options[wdi_authenticated_users_list][user_id][]" size="53" required="" value="'+r[i].user_id+'">',t+="</tr>",a++;e.append(t)}jQuery(".wdi_remove_auth_user").on("click",function(e){e.preventDefault();e=jQuery(this).closest(".wdi_username_tr").data("multiple-account");return jQuery(this).closest(".wdi_multiple_accounts_section").find('tr[data-multiple-account="'+e+'"]').remove(),!1})}function wdi_advanced_option_controller(){var e=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));e.addClass("wdi_advanced_option wdi_advanced_option_close");$tr=jQuery("<tr class='wdi_advanced_option_head'><th style='width: 100%;'>ADVANCED OPTIONS AND MULTIPLE INSTAGRAM ACCOUNTS</th><td><div class='wdi_advanced_option_icon'></div></td></tr>"),e.prepend($tr),$tr.on("click",function(){e.hasClass("wdi_advanced_option_open")?(e.removeClass("wdi_advanced_option_open"),e.addClass("wdi_advanced_option_close")):(e.removeClass("wdi_advanced_option_close"),e.addClass("wdi_advanced_option_open"))})}function wdi_controller(){}function wdi_spider_select_value(e){e.focus(),e.select()}function wdi_spider_set_input_value(e,t){"add"===t&&""==jQuery("#wdi_access_token").attr("value")&&alert("Please get your access token"),document.getElementById(e)&&(document.getElementById(e).value=t)}function wdi_spider_form_submit(e,t){document.getElementById(t)&&document.getElementById(t).submit(),e.preventDefault?e.preventDefault():e.returnValue=!1}function wdi_bulk_actions(e){e=jQuery(e).val();return""!=e&&(!("delete_all"==e&&!confirm(wdi_messages.do_you_want_to_delete_selected_items))&&(wdi_spider_set_input_value("task",e),jQuery("#wdi_feed_form").submit(),!0))}function wdi_spider_check_all_items(){wdi_spider_check_all_items_checkbox(),jQuery("#check_all").trigger("click")}function wdi_spider_check_all_items_checkbox(){var e;jQuery("#check_all_items").prop("checked")?(jQuery("#check_all_items").prop("checked",!1),jQuery("#draganddrop").hide()):(e=parseInt(jQuery(".displaying-num").html())?parseInt(jQuery(".displaying-num").html()):0,e=(jQuery('input[id^="check_pr_"]').length?parseInt(jQuery('input[id^="check_pr_"]').length):0)+e,jQuery("#check_all_items").prop("checked",!0),e&&(jQuery("#draganddrop").html("<strong><p>Selected "+e+" item"+(1<e?"s":"")+".</p></strong>"),jQuery("#draganddrop").show()))}function wdi_spider_check_all(e){jQuery(e).prop("checked")||(jQuery("#check_all_items").prop("checked",!1),jQuery("#draganddrop").hide())}function wdi_spider_set_input_value(e,t){"add"===t&&""==jQuery("#wdi_access_token").attr("value")&&alert("Please get your access token"),document.getElementById(e)&&(document.getElementById(e).value=t)}function wdi_account_remove(e,t){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{page:"wdi_settings",action:"wdi_account_disconnect",nonce:wdi_ajax.wdi_nonce,user_name:e,user_id:t},success:function(e){e.success&&(1==jQuery('[class*="wdi-account-list"]').length?((e=jQuery(".wdi-account-list-"+t).parent()).prev().remove(),e.remove(),jQuery("#toplevel_page_wdi_feeds ul").remove(),jQuery("#toplevel_page_wdi_feeds a").attr("href","admin.php?page=wdi_settings")):jQuery(".wdi-account-list-"+t).remove())}})}function wdi_popup_open(){jQuery(".wdi-popup").show()}function wdi_popup_close(){jQuery(".wdi-popup").hide()}jQuery(document).ready(function(){function e(e){if(!1===e){var t=JSON.parse(localStorage.getItem("wdi_sections"));for(i in null!==t&&!1!==t||(t={wdi_layout_section:"show",wdi_media:"show",wdi_layout:"hide",wdi_advanced:"hide",wdi_lightbox_general:"show",wdi_lightbox_advanced:"hide",wdi_conditional_filters:"show",wdi_how_to_publish:"show"},localStorage.setItem("wdi_sections",JSON.stringify(t))),t){var r=jQuery("#wdi_save_feed").find("[data-section_name='"+i+"']");n(t[i],r)}}else{var a=jQuery(e).data("section_name"),s=null;e.hasClass("wdi_section_open")?(n("show",e),s="show"):e.hasClass("wdi_section_close")&&(n("hide",e),s="hide"),null!=s&&((e=JSON.parse(localStorage.getItem("wdi_sections"))||{})[a]=s,localStorage.setItem("wdi_sections",JSON.stringify(e)))}}function n(e,t){"show"===e?("table"===(e=t.closest(".wdi_section").find(".wdi_elements")).data("display")?e.css({display:"table"}):e.css({display:"block"}),t.css({"border-bottom":"1px solid #f1f1f1",margin:"0 auto 15px"}),t.removeClass("wdi_section_open"),t.addClass("wdi_section_close")):(t.closest(".wdi_section").find(".wdi_elements").css({display:"none"}),t.css({"border-bottom":"0px",margin:"0 auto 0px"}),t.removeClass("wdi_section_close"),t.addClass("wdi_section_open"))}jQuery("#wdi_reset_cache").click(function(e){jQuery(".wdi_reset_cache_success").remove(),e.preventDefault(),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,task:"reset",action:"wdi_cache"},success:function(e){!1===e.success?jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>"):jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>")}})}),jQuery(".wdi_account_refresh").click(function(){var t=jQuery(this),e=t.data("wdi_account");jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{page:"wdi_settings",action:"wdi_account_refresh",nonce:wdi_ajax.wdi_nonce,user_name:e},success:function(e){t.closest("div").find(".wdi_reset_cache_success").remove(),!0===e.success?(t.after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>"),t.closest("div").find(".wdi_user_token").val(e.token)):t.after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>")}})}),wdi_controller.bindSaveFeedEvent(),wdi_controller.bindAddNewUserOrHashtagEvent(),jQuery(".display_type input").on("click",function(){wdi_controller.displaySettingsSection(jQuery(this))}),wdi_controller.conditionalFiltersTabInit(),wdi_controller.bindSaveThemeEvent(),jQuery("body").hasClass("instagram-feed_page_wdi_settings")&&wdi_advanced_option_controller(),jQuery(".wdi_section_name").click(function(){e(jQuery(this))}),e(!1),jQuery(document).on("click",".wdi-account-show-token",function(){jQuery(this).find("i").toggleClass("dashicons-arrow-up-alt2 dashicons-arrow-down-alt2"),jQuery(this).parents("li").find(".wdi-account-accesstoken").slideToggle(300)}),jQuery(document).on("click",".wdi-advanced-options .wdi-advanced-headline",function(){jQuery(this).find("i").toggleClass("dashicons-arrow-up-alt2 dashicons-arrow-down-alt2"),jQuery(this).parents(".wdi-advanced-options").find(".wdi-advanced-body").slideToggle(500)}),jQuery(document).on("click","#wdi_verify",function(){jQuery("#wdi_submit").prop("disabled",!0),jQuery(this).is(":checked")&&jQuery("#wdi_submit").prop("disabled",!1)}),jQuery(document).on("click","#wdi_submit",function(){return confirm(wdi_messages.uninstall_plugin)&&jQuery("#wdi_uninstall_form").submit(),!1}),jQuery("#WDI_feed_name").on("keypress",function(){jQuery(this).removeAttr("style")})}),wdi_controller.getParameterByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");e=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))},wdi_controller.apiRedirected=function(){var e=this.getParameterByName("access_token").split("."),t=/^[^\\\/&?><"']*$/;for(i=0;i<e.length;i++)if(null===e[i].match(t))return;var r=e.join(".");jQuery(document).ready(function(){""===wdi_options.wdi_access_token?jQuery("#wdi_access_token").attr("value",r):(jQuery(".wdi_more_token_template .wdi_more_access_token").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_access_token").attr("value",r))}),wdi_controller.instagram.addToken(r),wdi_controller.getUserInfo(r)},wdi_controller.getUserInfo=function(e){this.instagram.getSelfInfo({success:function(e){""===wdi_options.wdi_access_token?(jQuery("#wdi_user_name").attr("value",e.data.username),jQuery("#wdi_user_id").attr("value",e.data.id)):(jQuery(".wdi_more_token_template .wdi_more_user_name").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_user_id").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_user_name").attr("value",e.data.username),jQuery(".wdi_more_token_template .wdi_more_user_id").attr("value",e.data.id)),jQuery(document).trigger("wdi_settings_filled")}})},wdi_controller.oldDisplayType={},wdi_controller.displayTypeMemory={},wdi_controller.switchFeedTabs=function(e,t){jQuery("#wdi_refresh_tab").attr("value",e),jQuery(".wdi_tab").hide(),jQuery("#"+e+"_tab").show(),jQuery(".display_type").css("display","none"),jQuery('.display_type[tab="'+e+'"]').css("display","block"),jQuery('.display_type[tab="'+e+'"]').length?jQuery(".display_type_content").show():jQuery(".display_type_content").hide(),jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")}),jQuery("#wdi_"+e).addClass("wdi_feed_tab_active");var i=jQuery(),r=!1;null!=t&&""!=t&&(i=jQuery(".display_type #"+t).prop("checked",!0),jQuery("#wdi_feed_type").attr("value",t)),r||0!=(i=jQuery('.display_type[tab="'+e+'"] input[name="feed_type"]:checked')).length&&(r=!0),r||0!=(i=jQuery('.display_type[tab="'+e+'"] #thumbnails')).length&&(r=!0,i.prop("checked",!0),jQuery("#wdi_feed_type").attr("value","thumbnails")),r&&wdi_controller.displaySettingsSection(i),"conditional_filters"==e&&wdi_controller.updateConditionalFiltersUi()},wdi_controller.displaySettingsSection=function(e){var i=e.attr("id").toLowerCase().trim(),t=e.parent().parent().attr("tab"),e=jQuery("#wdi_refresh_section");wdi_controller.oldDisplayType={section:i,tab:t},wdi_controller.displayTypeMemory[t]=wdi_controller.oldDisplayType,null!=e&&e.attr("value",i);e=jQuery(".wdi_border_wrapper .form-table");jQuery("#wdi_feed_type").attr("value",i);var r=0,a=!1;e.find(".wdi_element").each(function(){0;var e=jQuery(this).find(".wdwt_param").children().children().children().attr("section");if(void 0!==e){a=!1;var t=e.toLowerCase().trim().split(",");for(r=0;r<t.length;r++)t[r]===i&&(jQuery(this).css("display","block"),a=!0);!1===a&&jQuery(this).css("display","none")}})},wdi_controller.switchThemeTabs=function(e,t){jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")}),jQuery("#wdi_"+e).addClass("wdi_feed_tab_active"),jQuery("[tab]").each(function(){jQuery(this).attr("tab")!=e?jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","none"):jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","block")}),jQuery(".display_type").css("display","none"),jQuery('.display_type[tab="'+e+'"]').css("display","block"),jQuery("#wdi_refresh_tab").attr("value",e),null!=t&&""!=t&&jQuery("#wdi_refresh_section").attr("value",t),(null==t&&""!=t?null!=wdi_controller.displayTypeMemory[e]?jQuery(".display_type #"+wdi_controller.displayTypeMemory[e].section):jQuery('.display_type[tab="'+e+'"]').first().find("input"):jQuery(".display_type #"+t)).trigger("click")},wdi_controller.bindSaveFeedEvent=function(){var e=this;jQuery("#wdi_save_feed_submit").on("click",function(){e.save_feed("save_feed")}),jQuery("#wdi_save_feed_apply").on("click",function(){e.save_feed("apply_changes")}),jQuery("#wdi_cancel_changes").on("click",function(){e.save_feed("cancel")})},wdi_controller.save_feed=function(e){var t,i,r,a=[],s={};"cancel"==e&&(window.location=window.location.href),t=jQuery("#WDI_user_name option:selected").data("type"),n=jQuery("#WDI_user_name option:selected").val(),i=jQuery("#WDI_feed_name");var n=wdi_controller.getUserObj(n);if(""==i.val())return alert(wdi_messages.feed_title_field_required),i.focus().attr("style","border-color: #FF0000;"),!1;if(!n)return alert(wdi_messages.user_field_required),!1;if(r={id:n.user_id,username:n.user_name},wdi_controller.checkIfUserNotSaved(e),0==wdi_controller.waitingAjaxRequestEnd.button){if(s=jQuery("#WDI_feed_users").val(),this.isJsonString(s)){for(var d in s=JSON.parse(s))"#"===s[d].username.charAt(0)&&a.push(s[d]);a.push(r)}else a.push(r);jQuery("#WDI_feed_users").val(this.stringifyUserData(a)),jQuery("#wdi_feed_thumb").val(""),"business"==t&&jQuery("#wdi_feed_thumb").val(n.profile_picture_url),"apply_changes"!=e&&"save_feed"!=e||(n=jQuery("#wdi_add_or_edit").val(),jQuery("#wdi_current_id").val(n)),jQuery("#task").attr("value",e),jQuery("#wdi_save_feed").submit()}},wdi_controller.makeInstagramUserRequest=function(e,i){var r=this,t=this.getInputType(e),a="hashtag"===t;if(""==e)return alert(wdi_messages.please_write_hashtag),!1;if(""!=e&&!a)return alert(wdi_messages.invalid_hashtag),!1;if(r.checkForDuplicateUser(e))return alert(e+" "+wdi_messages.already_added),!1;switch(a=jQuery("#WDI_user_name option:selected").val(),(a=wdi_controller.getUserObj(a))&&(this.instagram.user=a),t){case"user":break;case"hashtag":var s=(s=e.substr(1,e.length)).replace(" ",""),n=jQuery("input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val();this.instagram.getTagRecentMedia(s,{success:function(e){jQuery("#wdi_add_user_ajax").removeAttr("disabled");var t=r.isValidResponse(e);t.valid&&r.hasData(e)?r.addHashtag(s,e):r.hasData(e)||"success"!=t.msg?alert(t.msg):1!=i?(confirm(wdi_messages.hashtag_no_data),jQuery("#wdi_add_user_ajax_input").val("")):r.addHashtag(s,e)}},null,n)}},wdi_controller.checkForDuplicateUser=function(e){var t=jQuery("#WDI_feed_users").val();if(this.isJsonString(t)){t=JSON.parse(t);for(var i=0;i<t.length;i++)if(e==t[i].username)return!0}return!1},wdi_controller.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_controller.stringifyUserData=function(e){for(var t=[],i=0;i<e.length;i++)t.push({id:e[i].id,username:e[i].username,tag_id:void 0!==e[i].tag_id?e[i].tag_id:""});return JSON.stringify(t)},wdi_controller.bindAddNewUserOrHashtagEvent=function(){jQuery("#wdi_add_user_ajax").on("click",function(){void 0!==jQuery(this).prop("disabled")||jQuery(this).prop("disabled",!0);var e=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();!1===wdi_controller.makeInstagramUserRequest(e)&&jQuery(this).removeAttr("disabled","disabled")}),jQuery("#wdi_add_user_ajax_input").on("keypress",function(e){if(13==e.keyCode){void 0!==jQuery("#wdi_add_user_ajax").prop("disabled")||jQuery("#wdi_add_user_ajax").prop("disabled",!0);e=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();return!1===wdi_controller.makeInstagramUserRequest(e)&&jQuery("#wdi_add_user_ajax").removeAttr("disabled","disabled"),!1}})},wdi_controller.removeFeedUser=function(e){var t,i=e.parent().find("a span").text();e.parent().find("a span").hasClass("wdi_hashtag")&&(i="#"+i),0!=this.feed_users.length||void 0!==(t=jQuery("#WDI_feed_users").val())&&this.isJsonString(t)&&(this.feed_users=JSON.parse(t));for(var r=0;r<this.feed_users.length;r++)if(this.feed_users[r].username==i){this.feed_users.splice(r,1);break}for(r=0;r<this.feed_users.length;r++)"#"!==this.feed_users[r].username.charAt(0)&&this.feed_users.splice(r,1);jQuery("#WDI_feed_users").val(this.stringifyUserData(this.feed_users)),e.parent().remove(),wdi_controller.changed_users()},wdi_controller.bindSaveThemeEvent=function(){jQuery("#wdi_save_theme_submit").on("click",function(){jQuery("#task").attr("value","save_feed"),jQuery("#wdi_save_feed").submit()}),jQuery("#wdi_save_theme_apply").on("click",function(){jQuery("#task").attr("value","apply_changes");var e=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",e),jQuery("#wdi_save_feed").submit()}),jQuery("#wdi_save_theme_reset").on("click",function(){jQuery("#task").attr("value","reset_changes");var e=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",e),jQuery("#wdi_save_feed").submit()})},wdi_controller.checkIfUserNotSaved=function(e){switch(e){case"save_feed":e="submit";break;case"apply_changes":e="apply";break;case"reset_changes":e="reset"}if(""==jQuery("#wdi_add_user_ajax_input").val().trim())return wdi_controller.waitingAjaxRequestEnd={button:0},0;var t=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();return wdi_controller.waitingAjaxRequestEnd={button:e},wdi_controller.makeInstagramUserRequest(t),1},wdi_controller.saveFeedAfterAjaxWait=function(e){var t;null!=wdi_controller.waitingAjaxRequestEnd&&(t=wdi_controller.waitingAjaxRequestEnd.button,e&&0!=t&&jQuery("#wdi_save_feed_"+t).trigger("click"),wdi_controller.waitingAjaxRequestEnd=void 0)},wdi_controller.getCookie=function(e){e=("; "+document.cookie).split("; "+e+"=");if(2==e.length)return e.pop().split(";").shift()},wdi_controller.isValidResponse=function(e){var t={};return void 0===e||void 0===e.meta.code||200!=e.meta.code?(t.valid=!1,void 0===e?t.msg=wdi_messages.instagram_server_error:200!==e.meta.code?t.msg=e.meta.error_message:t.msg=""):(t.valid=!0,t.msg="success"),t},wdi_controller.hasData=function(e){return void 0!==e&&void 0!==e.data&&0!=e.data.length},wdi_controller.thumbUser=function(e){return 0<this.feed_users.length&&this.feed_users[0].username===e},wdi_controller.findUser=function(e,t){var i=[];void 0!==t&&void 0!==t.data&&(i=t.data);for(var r=0;r<i.length;r++)if(i[r].username==e)return i[r];return!1},wdi_controller.addHashtag=function(e,t){if(null==e.match(/[~!@$%&*#^()<>?]/)){var i=jQuery('<div class="wdi_user"><a target="_blank" href="https://instagram.com/explore/tags/'+e+'"><img class="wdi_profile_pic" src="'+wdi_url.plugin_url+'images/hashtag.png"><span class="wdi_hashtag">'+e+'</span><i style="display:table-cell;width:25px;"></i></a><img class="wdi_remove_user" onclick="wdi_controller.removeFeedUser(jQuery(this))" src="'+wdi_url.plugin_url+'/images/delete_user.png"></div>');jQuery("#wdi_feed_users_ajax").append(i),jQuery("#wdi_add_user_ajax_input").val(""),i=void 0!==t&&0!=t.data.length&&void 0!==t.data[0].images.thumbnail?t.data[0].images.thumbnail.url:"";var r=jQuery("#WDI_feed_users").val();if(this.isJsonString(r)){r=JSON.parse(r);for(var a=0;a<r.length;a++)"#"!==r[a].username.charAt(0)&&r.splice(a,1)}else r=[];t={id:"#"+e,username:"#"+e,profile_picture:i,tag_id:t.tag_id};r.push(t),this.feed_users=r,jQuery("#WDI_feed_users").val(this.stringifyUserData(this.feed_users))}else alert(wdi_messages.invalid_hashtag);this.updateConditionalFiltersUi(),wdi_controller.saveFeedAfterAjaxWait(!0),wdi_controller.changed_users()},wdi_controller.changed_users=function(){for(var e=!1,t=0;t<this.feed_users.length;t++)if("#"===this.feed_users[t].username[0]){e=!0;break}e?(jQuery(".wdi_element_name_hashtag_top_recent").show(),jQuery(".wdi_element_name_show_username_on_thumb").hide()):(jQuery(".wdi_element_name_hashtag_top_recent").hide(),jQuery(".wdi_element_name_show_username_on_thumb").show())},wdi_controller.addUser=function(e){e.username=e.user_name,0==this.checkForDuplicateUser(e.username)?(newUser=jQuery('<div class="wdi_user"><a target="_blank" href="http://www.instagram.com/'+e.username+'"><span class="wdi_username">'+e.username+'</span><i style="display:table-cell;width:25px;"></i></a><img class="wdi_remove_user" onclick="wdi_controller.removeFeedUser(jQuery(this))" src="'+wdi_url.plugin_url+'images/delete_user.png"></div>'),jQuery("#wdi_feed_users_ajax").append(newUser),jQuery("#wdi_add_user_ajax_input").val(""),this.feed_users.push({id:e.id,username:e.username,profile_picture:""})):alert(e.username+" "+wdi_messages.already_added),this.updateConditionalFiltersUi(),wdi_controller.saveFeedAfterAjaxWait(!0)},wdi_controller.getUserProfilePic=function(e){for(var t=0;t<this.feed_users.length;t++)if(e==this.feed_users[t].username)return this.feed_users[t].profile_picture;return"false"},wdi_controller.conditionalFiltersTabInit=function(){this.setInitialFilters(),this.updateFiltersUi();var t=this;function e(){switch(jQuery("#WDI_wrap_conditional_filter_enable input:checked").val()){case"0":jQuery("#WDI_conditional_filters").parent().parent().addClass("wdi_hidden"),jQuery("#WDI_conditional_filter_type").parent().parent().parent().parent().parent().addClass("wdi_hidden"),jQuery("#wdi_final_condition").addClass("wdi_hidden"),jQuery("#WDI_filter_source").addClass("wdi_hidden");break;case"1":jQuery("#WDI_conditional_filters").parent().parent().removeClass("wdi_hidden"),jQuery("#WDI_conditional_filter_type").parent().parent().parent().parent().parent().removeClass("wdi_hidden"),jQuery("#wdi_final_condition").removeClass("wdi_hidden"),jQuery("#WDI_filter_source").removeClass("wdi_hidden")}}jQuery("#wdi_add_filter").on("click",function(){t.addConditionalFilter()&&jQuery("#wdi_filter_input").val("")}),jQuery(".wdi_filter_radio").on("click",function(){jQuery("#wdi_filter_input").trigger("focus")}),jQuery("#wdi_filter_input").on("keypress",function(e){if(13==e.keyCode)return t.addConditionalFilter()&&jQuery(this).val(""),!1}),e(),jQuery("#WDI_wrap_conditional_filter_enable input").on("change",function(){e()}),jQuery("#WDI_conditional_filter_type").on("change",function(){switch("none"==jQuery(this).val()||jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").css({display:"inline-block"}),jQuery(this).val()){case"AND":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.and_descr);break;case"OR":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.or_descr);break;case"NOR":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.nor_descr)}wdi_controller.updateFiltersUi()}),jQuery("#WDI_conditional_filter_type").trigger("change")},wdi_controller.addConditionalFilter=function(){var e=jQuery("#wdi_filter_input").val(),t=jQuery("#wdi_filter_type").val();if(filter={},""==e)return!1;switch(e=e.trim(),null==t&&("@"==e[0]?t="mention":"#"==e[0]?t="hashtag":"http"!=e.split("://")[0]&&"https"!=e.split("://")[0]||(t="url")),t){case"username":case"mention":"@"==e[0]&&(e=e.substr(1,e.length));break;case"hashtag":"#"==e[0]&&(e=e.substr(1,e.length));break;case"url":if(!/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e))return alert(wdi_messages.invalid_url),!1}return filter={filter_type:t,filter_by:e,id:this.randomId()},null!=t?this.filterExists(filter)?(alert(e+" "+wdi_messages.already_added),!1):(this.conditionalFilters.push(filter),this.updateFiltersUi(),!0):(alert(wdi_messages.selectConditionType),!1)},wdi_controller.filterExists=function(e){for(var t=0;t<this.conditionalFilters.length;t++)if(this.conditionalFilters[t].filter_type==e.filter_type&&this.conditionalFilters[t].filter_by==e.filter_by)return!0;return!1},wdi_controller.updateFiltersUi=function(){for(var e,t=jQuery("#wdi_filters_ui").html(""),i=0;i<this.conditionalFilters.length;i++){if(0==i)if(1!=this.conditionalFilters.length)switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":break;case"OR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.either+"</span>"));break;case"NOR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.neither+"</span>"))}else switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":case"OR":break;case"NOR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.not+"</span>"))}switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":e=wdi_messages.and;break;case"OR":e=wdi_messages.or;break;case"NOR":e=wdi_messages.nor}1<=i&&t.append(jQuery('<span class="wdi_logic">'+e+"</span>")),t.append(this.createUiElement(this.conditionalFilters[i]))}this.updateFilterTextarea()},wdi_controller.createUiElement=function(e){var t;switch(e.filter_type){case"mention":t="@";break;case"hashtag":t="#";break;case"location":t="%";break;default:t=""}return jQuery('<span data-id="'+e.id+'" class="wdi_filter_item wdi_filter_by_'+e.filter_type+'"></span>').html(t+e.filter_by+'<span onclick="wdi_controller.removeConditionalFilter(jQuery(this));" class="wdi_remove_filter">X</span>')},wdi_controller.randomId=function(){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<5;i++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},wdi_controller.removeConditionalFilter=function(e){for(var t=e.parent().attr("data-id"),i=0;i<this.conditionalFilters.length;i++)this.conditionalFilters[i].id==t&&this.conditionalFilters.splice(i,1);this.updateFiltersUi()},wdi_controller.updateFilterTextarea=function(){var e=this.conditionalFilters,e=JSON.stringify(e);jQuery("#wdi_conditional_filters_textarea").val(e)},wdi_controller.setInitialFilters=function(){var e=[],t=jQuery("#wdi_conditional_filters_textarea").val();this.isJsonString(t)&&(e=JSON.parse(t)),this.conditionalFilters=e},wdi_controller.updateConditionalFiltersUi=function(){wdi_controller.updateFilterSource()},wdi_controller.updateFilterSource=function(){if("liked"!=jQuery('input[name="wdi_feed_settings[liked_feed]"]:checked').val()){var e,t,i=[];jQuery(".wdi_user").each(function(){e=(0!=jQuery(this).find(".wdi_username").length?jQuery(this).find(".wdi_username"):jQuery(this).find(".wdi_hashtag")).text(),t=jQuery(this).find("img").attr("src"),i.push({username:e,image:t})});for(var r=jQuery("#wdi_filter_source").html(""),a=0;a<i.length;a++){s="<div class='wdi_source_user'><span class='wdi_source_img'><img src='"+i[a].image+"'></span><span class='wdi_source_username'>"+i[a].username+"</span></div>";r.html(r.html()+s)}}else{var r,s="<div class='wdi_source_user'><span class='wdi_source_username'>Media I liked</span></div>";(r=jQuery("#wdi_filter_source").html("")).html(r.html()+s)}},wdi_controller.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_controller.getUserObj=function(e){var t=JSON.parse(wdi_options.wdi_authenticated_users_list);if("object"==typeof t){if("object"==typeof t[e]&&""!=t[e])return t[e];console.log("Error: User not exist on Users object")}else console.log("Error: Wrong response when parsed on users (JSON.parse)");return!1};
1
+ function wdi_multiple_accounts_option_controller(){var e=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));e.addClass("wdi_multiple_accounts_section");var t="";if(wdi_options.wdi_authenticated_users_list){var i,r=JSON.parse(wdi_options.wdi_authenticated_users_list),a=0;for(i in r)t+="<tr data-multiple-account='"+a+"'>",t+="<th>Access Token</th>",t+='<td><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][access_token][]" size="53" required="" value="'+r[i].access_token+'"></td>',t+="</tr>",t+="<tr data-multiple-account='"+a+"' class='wdi_username_tr'>",t+="<th>Username</th>",t+='<td><div class="wdi_input_wrapper"><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][user_name][]" size="53" required="" value="'+r[i].user_name+'"></div><div class="wdi_remove_auth_user">Delete</div></td>',t+='<input type="hidden" name="wdi_instagram_options[wdi_authenticated_users_list][user_id][]" size="53" required="" value="'+r[i].user_id+'">',t+="</tr>",a++;e.append(t)}jQuery(".wdi_remove_auth_user").on("click",function(e){e.preventDefault();e=jQuery(this).closest(".wdi_username_tr").data("multiple-account");return jQuery(this).closest(".wdi_multiple_accounts_section").find('tr[data-multiple-account="'+e+'"]').remove(),!1})}function wdi_advanced_option_controller(){var e=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));e.addClass("wdi_advanced_option wdi_advanced_option_close");$tr=jQuery("<tr class='wdi_advanced_option_head'><th style='width: 100%;'>ADVANCED OPTIONS AND MULTIPLE INSTAGRAM ACCOUNTS</th><td><div class='wdi_advanced_option_icon'></div></td></tr>"),e.prepend($tr),$tr.on("click",function(){e.hasClass("wdi_advanced_option_open")?(e.removeClass("wdi_advanced_option_open"),e.addClass("wdi_advanced_option_close")):(e.removeClass("wdi_advanced_option_close"),e.addClass("wdi_advanced_option_open"))})}function wdi_controller(){}jQuery(document).ready(function(){function e(e){if(!1===e){var t=JSON.parse(localStorage.getItem("wdi_sections"));for(i in null!==t&&!1!==t||(t={wdi_layout_section:"show",wdi_media:"show",wdi_layout:"hide",wdi_advanced:"hide",wdi_lightbox_general:"show",wdi_lightbox_advanced:"hide",wdi_conditional_filters:"show",wdi_how_to_publish:"show"},localStorage.setItem("wdi_sections",JSON.stringify(t))),t){var r=jQuery("#wdi_save_feed").find("[data-section_name='"+i+"']");n(t[i],r)}}else{var a=jQuery(e).data("section_name"),s=null;e.hasClass("wdi_section_open")?(n("show",e),s="show"):e.hasClass("wdi_section_close")&&(n("hide",e),s="hide"),null!=s&&((e=JSON.parse(localStorage.getItem("wdi_sections"))||{})[a]=s,localStorage.setItem("wdi_sections",JSON.stringify(e)))}}function n(e,t){"show"===e?("table"===(e=t.closest(".wdi_section").find(".wdi_elements")).data("display")?e.css({display:"table"}):e.css({display:"block"}),t.css({"border-bottom":"1px solid #f1f1f1",margin:"0 auto 15px"}),t.removeClass("wdi_section_open"),t.addClass("wdi_section_close")):(t.closest(".wdi_section").find(".wdi_elements").css({display:"none"}),t.css({"border-bottom":"0px",margin:"0 auto 0px"}),t.removeClass("wdi_section_close"),t.addClass("wdi_section_open"))}jQuery("#wdi_reset_cache").click(function(e){jQuery(".wdi_reset_cache_success").remove(),jQuery("#wdi_save_loading").removeClass("wdi_hidden"),e.preventDefault(),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,task:"reset",action:"wdi_cache"},success:function(e){!1===e.success?jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>"):(wdi_controller.instagram=new WDIInstagram,jQuery.each(e.data,function(e,t){var i=JSON.parse(t.users),r="",a="",s="",n=t.endpoint;jQuery.each(i,function(e,t){""!==t.tag_id?(a=(a=(a=t.username).substr(1,a.length)).replace(" ",""),s=t.tag_id):r=(r=wdi_controller.getUserObj(t.username))&&r.user_name});t=t.feed_id;wdi_controller.instagram.set_cache_data("",r,t,"",0,0,a,s,n,"")}),jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>"))}})}),jQuery(".wdi_account_refresh").click(function(){var t=jQuery(this),e=t.data("wdi_account");jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{page:"wdi_settings",action:"wdi_account_refresh",nonce:wdi_ajax.wdi_nonce,user_name:e},success:function(e){t.closest("div").find(".wdi_reset_cache_success").remove(),!0===e.success?(t.after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>"),t.closest("div").find(".wdi_user_token").val(e.token)):t.after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>")}})}),wdi_controller.bindSaveFeedEvent(),wdi_controller.bindAddNewUserOrHashtagEvent(),jQuery(".display_type input").on("click",function(){wdi_controller.displaySettingsSection(jQuery(this))}),wdi_controller.conditionalFiltersTabInit(),wdi_controller.bindSaveThemeEvent(),jQuery("body").hasClass("instagram-feed_page_wdi_settings")&&wdi_advanced_option_controller(),jQuery(".wdi_section_name").click(function(){e(jQuery(this))}),e(!1),jQuery(document).on("click",".wdi-account-show-token",function(){jQuery(this).find("i").toggleClass("dashicons-arrow-up-alt2 dashicons-arrow-down-alt2"),jQuery(this).parents("li").find(".wdi-account-accesstoken").slideToggle(300)}),jQuery(document).on("click",".wdi-advanced-options .wdi-advanced-headline",function(){jQuery(this).find("i").toggleClass("dashicons-arrow-up-alt2 dashicons-arrow-down-alt2"),jQuery(this).parents(".wdi-advanced-options").find(".wdi-advanced-body").slideToggle(500)}),jQuery(document).on("click","#wdi_verify",function(){jQuery("#wdi_submit").prop("disabled",!0),jQuery(this).is(":checked")&&jQuery("#wdi_submit").prop("disabled",!1)}),jQuery(document).on("click","#wdi_submit",function(){return confirm(wdi_messages.uninstall_plugin)&&jQuery("#wdi_uninstall_form").submit(),!1}),jQuery("#WDI_feed_name").on("keypress",function(){jQuery(this).removeAttr("style")})}),wdi_controller.getParameterByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");e=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))},wdi_controller.apiRedirected=function(){var e=this.getParameterByName("access_token").split("."),t=/^[^\\\/&?><"']*$/;for(i=0;i<e.length;i++)if(null===e[i].match(t))return;var r=e.join(".");jQuery(document).ready(function(){""===wdi_options.wdi_access_token?jQuery("#wdi_access_token").attr("value",r):(jQuery(".wdi_more_token_template .wdi_more_access_token").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_access_token").attr("value",r))}),wdi_controller.instagram.addToken(r),wdi_controller.getUserInfo(r)},wdi_controller.getUserInfo=function(e){this.instagram.getSelfInfo({success:function(e){""===wdi_options.wdi_access_token?(jQuery("#wdi_user_name").attr("value",e.data.username),jQuery("#wdi_user_id").attr("value",e.data.id)):(jQuery(".wdi_more_token_template .wdi_more_user_name").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_user_id").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_user_name").attr("value",e.data.username),jQuery(".wdi_more_token_template .wdi_more_user_id").attr("value",e.data.id)),jQuery(document).trigger("wdi_settings_filled")}})},wdi_controller.oldDisplayType={},wdi_controller.displayTypeMemory={},wdi_controller.switchFeedTabs=function(e,t){jQuery("#wdi_refresh_tab").attr("value",e),jQuery(".wdi_tab").hide(),jQuery("#"+e+"_tab").show(),jQuery(".display_type").css("display","none"),jQuery('.display_type[tab="'+e+'"]').css("display","block"),jQuery('.display_type[tab="'+e+'"]').length?jQuery(".display_type_content").show():jQuery(".display_type_content").hide(),jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")}),jQuery("#wdi_"+e).addClass("wdi_feed_tab_active");var i=jQuery(),r=!1;null!=t&&""!=t&&(i=jQuery(".display_type #"+t).prop("checked",!0),jQuery("#wdi_feed_type").attr("value",t)),r||0!=(i=jQuery('.display_type[tab="'+e+'"] input[name="feed_type"]:checked')).length&&(r=!0),r||0!=(i=jQuery('.display_type[tab="'+e+'"] #thumbnails')).length&&(r=!0,i.prop("checked",!0),jQuery("#wdi_feed_type").attr("value","thumbnails")),r&&wdi_controller.displaySettingsSection(i),"conditional_filters"==e&&wdi_controller.updateConditionalFiltersUi()},wdi_controller.displaySettingsSection=function(e){var i=e.attr("id").toLowerCase().trim(),t=e.parent().parent().attr("tab"),e=jQuery("#wdi_refresh_section");wdi_controller.oldDisplayType={section:i,tab:t},wdi_controller.displayTypeMemory[t]=wdi_controller.oldDisplayType,null!=e&&e.attr("value",i);e=jQuery(".wdi_border_wrapper .form-table");jQuery("#wdi_feed_type").attr("value",i);var r=0,a=!1;e.find(".wdi_element").each(function(){0;var e=jQuery(this).find(".wdwt_param").children().children().children().attr("section");if(void 0!==e){a=!1;var t=e.toLowerCase().trim().split(",");for(r=0;r<t.length;r++)t[r]===i&&(jQuery(this).css("display","block"),a=!0);!1===a&&jQuery(this).css("display","none")}})},wdi_controller.switchThemeTabs=function(e,t){jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")}),jQuery("#wdi_"+e).addClass("wdi_feed_tab_active"),jQuery("[tab]").each(function(){jQuery(this).attr("tab")!=e?jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","none"):jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","block")}),jQuery(".display_type").css("display","none"),jQuery('.display_type[tab="'+e+'"]').css("display","block"),jQuery("#wdi_refresh_tab").attr("value",e),null!=t&&""!=t&&jQuery("#wdi_refresh_section").attr("value",t),(null==t&&""!=t?null!=wdi_controller.displayTypeMemory[e]?jQuery(".display_type #"+wdi_controller.displayTypeMemory[e].section):jQuery('.display_type[tab="'+e+'"]').first().find("input"):jQuery(".display_type #"+t)).trigger("click")},wdi_controller.bindSaveFeedEvent=function(){var e=this;jQuery("#wdi_save_feed_submit").on("click",function(){e.save_feed("save_feed")}),jQuery("#wdi_save_feed_apply").on("click",function(){e.save_feed("apply_changes")}),jQuery("#wdi_cancel_changes").on("click",function(){e.save_feed("cancel")})},wdi_controller.save_feed=function(e){var t,i,r,a=[],s={};"cancel"==e&&(window.location=window.location.href),t=jQuery("#WDI_user_name option:selected").data("type"),n=jQuery("#WDI_user_name option:selected").val(),i=jQuery("#WDI_feed_name");var n=wdi_controller.getUserObj(n);if(""==i.val())return alert(wdi_messages.feed_title_field_required),i.focus().attr("style","border-color: #FF0000;"),!1;if(!n)return alert(wdi_messages.user_field_required),!1;if(r={id:n.user_id,username:n.user_name},wdi_controller.checkIfUserNotSaved(e),0==wdi_controller.waitingAjaxRequestEnd.button){if(s=jQuery("#WDI_feed_users").val(),this.isJsonString(s)){for(var d in s=JSON.parse(s))"#"===s[d].username.charAt(0)&&a.push(s[d]);a.push(r)}else a.push(r);users=this.stringifyUserData(a),jQuery("#WDI_feed_users").val(users),jQuery("#wdi_feed_thumb").val(""),"business"==t&&jQuery("#wdi_feed_thumb").val(n.profile_picture_url),"apply_changes"!=e&&"save_feed"!=e||(n=jQuery("#wdi_add_or_edit").val(),jQuery("#wdi_current_id").val(n)),jQuery("#task").attr("value",e),submit_ajax()}};var comlete_redirect_url="";function submit_ajax(){var e=jQuery("#wdi_save_feed").serialize();e+="&action=wdi_apply_changes&page=wdi_feeds",jQuery("#wdi_save_loading").removeClass("wdi_hidden"),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:e,success:function(e){comlete_redirect_url=e.url;var t=e.feed_id;1==e.need_cache?(jQuery(".caching-process-message").removeClass("wdi_hidden"),setTimeout(function(){wdi_controller.instagram.set_cache_data(comlete_redirect_url,"",t,"",0,0,"","","","")},1e3)):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),window.location=comlete_redirect_url)},error:function(e,t,i){window.location=comlete_redirect_url}})}function wdi_spider_select_value(e){e.focus(),e.select()}function wdi_spider_set_input_value(e,t){"add"===t&&""==jQuery("#wdi_access_token").attr("value")&&alert("Please get your access token"),document.getElementById(e)&&(document.getElementById(e).value=t)}function wdi_spider_form_submit(e,t){document.getElementById(t)&&document.getElementById(t).submit(),e.preventDefault?e.preventDefault():e.returnValue=!1}function wdi_bulk_actions(e){e=jQuery(e).val();return""!=e&&(!("delete_all"==e&&!confirm(wdi_messages.do_you_want_to_delete_selected_items))&&(wdi_spider_set_input_value("task",e),jQuery("#wdi_feed_form").submit(),!0))}function wdi_spider_check_all_items(){wdi_spider_check_all_items_checkbox(),jQuery("#check_all").trigger("click")}function wdi_spider_check_all_items_checkbox(){var e;jQuery("#check_all_items").prop("checked")?(jQuery("#check_all_items").prop("checked",!1),jQuery("#draganddrop").hide()):(e=parseInt(jQuery(".displaying-num").html())?parseInt(jQuery(".displaying-num").html()):0,e=(jQuery('input[id^="check_pr_"]').length?parseInt(jQuery('input[id^="check_pr_"]').length):0)+e,jQuery("#check_all_items").prop("checked",!0),e&&(jQuery("#draganddrop").html("<strong><p>Selected "+e+" item"+(1<e?"s":"")+".</p></strong>"),jQuery("#draganddrop").show()))}function wdi_spider_check_all(e){jQuery(e).prop("checked")||(jQuery("#check_all_items").prop("checked",!1),jQuery("#draganddrop").hide())}function wdi_spider_set_input_value(e,t){"add"===t&&""==jQuery("#wdi_access_token").attr("value")&&alert("Please get your access token"),document.getElementById(e)&&(document.getElementById(e).value=t)}function wdi_account_remove(e,t){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{page:"wdi_settings",action:"wdi_account_disconnect",nonce:wdi_ajax.wdi_nonce,user_name:e,user_id:t},success:function(e){e.success&&(1==jQuery('[class*="wdi-account-list"]').length?((e=jQuery(".wdi-account-list-"+t).parent()).prev().remove(),e.remove(),jQuery("#toplevel_page_wdi_feeds ul").remove(),jQuery("#toplevel_page_wdi_feeds a").attr("href","admin.php?page=wdi_settings")):jQuery(".wdi-account-list-"+t).remove())}})}function wdi_popup_open(){jQuery(".wdi-popup").show()}function wdi_popup_close(){jQuery(".wdi-popup").hide()}wdi_controller.makeInstagramUserRequest=function(e,t){var i,r=this,a=this.getInputType(e),s="hashtag"===a;if(""==e)return alert(wdi_messages.please_write_hashtag),!1;if(""!=e&&!s)return alert(wdi_messages.invalid_hashtag),!1;if(r.checkForDuplicateUser(e))return alert(e+" "+wdi_messages.already_added),!1;switch(i=jQuery("#WDI_user_name option:selected").val(),(s=wdi_controller.getUserObj(i))&&(this.instagram.user=s),a){case"user":break;case"hashtag":var n=(n=e.substr(1,e.length)).replace(" ",""),d=(jQuery("input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val(),{tagname:n,action:"wdi_getHashtagId",wdi_nonce:wdi_ajax.wdi_nonce,user_name:i});jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:d,success:function(e){jQuery("#wdi_add_user_ajax").removeAttr("disabled"),r.isValidResponse(e).valid&&r.addHashtag(n,e)},error:function(e,t,i){}})}},wdi_controller.checkForDuplicateUser=function(e){var t=jQuery("#WDI_feed_users").val();if(this.isJsonString(t)){t=JSON.parse(t);for(var i=0;i<t.length;i++)if(e==t[i].username)return!0}return!1},wdi_controller.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_controller.stringifyUserData=function(e){for(var t=[],i=0;i<e.length;i++)t.push({id:e[i].id,username:e[i].username,tag_id:void 0!==e[i].tag_id?e[i].tag_id:""});return JSON.stringify(t)},wdi_controller.bindAddNewUserOrHashtagEvent=function(){jQuery("#wdi_add_user_ajax").on("click",function(){void 0!==jQuery(this).prop("disabled")||jQuery(this).prop("disabled",!0);var e=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();!1===wdi_controller.makeInstagramUserRequest(e)&&jQuery(this).removeAttr("disabled","disabled")}),jQuery("#wdi_add_user_ajax_input").on("keypress",function(e){if(13==e.keyCode){void 0!==jQuery("#wdi_add_user_ajax").prop("disabled")||jQuery("#wdi_add_user_ajax").prop("disabled",!0);e=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();return!1===wdi_controller.makeInstagramUserRequest(e)&&jQuery("#wdi_add_user_ajax").removeAttr("disabled","disabled"),!1}})},wdi_controller.removeFeedUser=function(e){var t,i=e.parent().find("a span").text();e.parent().find("a span").hasClass("wdi_hashtag")&&(i="#"+i),0!=this.feed_users.length||void 0!==(t=jQuery("#WDI_feed_users").val())&&this.isJsonString(t)&&(this.feed_users=JSON.parse(t));for(var r=0;r<this.feed_users.length;r++)if(this.feed_users[r].username==i){this.feed_users.splice(r,1);break}for(r=0;r<this.feed_users.length;r++)"#"!==this.feed_users[r].username.charAt(0)&&this.feed_users.splice(r,1);jQuery("#WDI_feed_users").val(this.stringifyUserData(this.feed_users)),e.parent().remove(),wdi_controller.changed_users()},wdi_controller.bindSaveThemeEvent=function(){jQuery("#wdi_save_theme_submit").on("click",function(){jQuery("#task").attr("value","save_feed"),jQuery("#wdi_save_feed").submit()}),jQuery("#wdi_save_theme_apply").on("click",function(){jQuery("#task").attr("value","apply_changes");var e=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",e),jQuery("#wdi_save_feed").submit()}),jQuery("#wdi_save_theme_reset").on("click",function(){jQuery("#task").attr("value","reset_changes");var e=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",e),jQuery("#wdi_save_feed").submit()})},wdi_controller.checkIfUserNotSaved=function(e){switch(e){case"save_feed":e="submit";break;case"apply_changes":e="apply";break;case"reset_changes":e="reset"}if(""==jQuery("#wdi_add_user_ajax_input").val().trim())return wdi_controller.waitingAjaxRequestEnd={button:0},0;var t=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();return wdi_controller.waitingAjaxRequestEnd={button:e},wdi_controller.makeInstagramUserRequest(t),1},wdi_controller.saveFeedAfterAjaxWait=function(e){var t;null!=wdi_controller.waitingAjaxRequestEnd&&(t=wdi_controller.waitingAjaxRequestEnd.button,e&&0!=t&&jQuery("#wdi_save_feed_"+t).trigger("click"),wdi_controller.waitingAjaxRequestEnd=void 0)},wdi_controller.getCookie=function(e){e=("; "+document.cookie).split("; "+e+"=");if(2==e.length)return e.pop().split(";").shift()},wdi_controller.isValidResponse=function(e){var t={};return void 0===e||void 0===e.meta.code||200!=e.meta.code?(t.valid=!1,void 0===e?t.msg=wdi_messages.instagram_server_error:200!==e.meta.code?t.msg=e.meta.error_message:t.msg=""):(t.valid=!0,t.msg="success"),t},wdi_controller.hasData=function(e){return void 0!==e&&void 0!==e.data&&0!=e.data.length},wdi_controller.thumbUser=function(e){return 0<this.feed_users.length&&this.feed_users[0].username===e},wdi_controller.findUser=function(e,t){var i=[];void 0!==t&&void 0!==t.data&&(i=t.data);for(var r=0;r<i.length;r++)if(i[r].username==e)return i[r];return!1},wdi_controller.addHashtag=function(e,t){if(null==e.match(/[~!@$%&*#^()<>?]/)){var i=jQuery('<div class="wdi_user"><a target="_blank" href="https://instagram.com/explore/tags/'+e+'"><img class="wdi_profile_pic" src="'+wdi_url.plugin_url+'images/hashtag.png"><span class="wdi_hashtag">'+e+'</span><i style="display:table-cell;width:25px;"></i></a><img class="wdi_remove_user" onclick="wdi_controller.removeFeedUser(jQuery(this))" src="'+wdi_url.plugin_url+'/images/delete_user.png"></div>');jQuery("#wdi_feed_users_ajax").append(i),jQuery("#wdi_add_user_ajax_input").val(""),i=void 0!==t&&0!=t.data.length&&void 0!==t.data[0].images.thumbnail?t.data[0].images.thumbnail.url:"";var r=jQuery("#WDI_feed_users").val();if(this.isJsonString(r)){r=JSON.parse(r);for(var a=0;a<r.length;a++)"#"!==r[a].username.charAt(0)&&r.splice(a,1)}else r=[];t={id:"#"+e,username:"#"+e,profile_picture:i,tag_id:t.tag_id};r.push(t),this.feed_users=r,jQuery("#WDI_feed_users").val(this.stringifyUserData(this.feed_users))}else alert(wdi_messages.invalid_hashtag);this.updateConditionalFiltersUi(),wdi_controller.saveFeedAfterAjaxWait(!0),wdi_controller.changed_users()},wdi_controller.changed_users=function(){for(var e=!1,t=0;t<this.feed_users.length;t++)if("#"===this.feed_users[t].username[0]){e=!0;break}e?(jQuery(".wdi_element_name_hashtag_top_recent").show(),jQuery(".wdi_element_name_show_username_on_thumb").hide()):(jQuery(".wdi_element_name_hashtag_top_recent").hide(),jQuery(".wdi_element_name_show_username_on_thumb").show())},wdi_controller.addUser=function(e){e.username=e.user_name,0==this.checkForDuplicateUser(e.username)?(newUser=jQuery('<div class="wdi_user"><a target="_blank" href="http://www.instagram.com/'+e.username+'"><span class="wdi_username">'+e.username+'</span><i style="display:table-cell;width:25px;"></i></a><img class="wdi_remove_user" onclick="wdi_controller.removeFeedUser(jQuery(this))" src="'+wdi_url.plugin_url+'images/delete_user.png"></div>'),jQuery("#wdi_feed_users_ajax").append(newUser),jQuery("#wdi_add_user_ajax_input").val(""),this.feed_users.push({id:e.id,username:e.username,profile_picture:""})):alert(e.username+" "+wdi_messages.already_added),this.updateConditionalFiltersUi(),wdi_controller.saveFeedAfterAjaxWait(!0)},wdi_controller.getUserProfilePic=function(e){for(var t=0;t<this.feed_users.length;t++)if(e==this.feed_users[t].username)return this.feed_users[t].profile_picture;return"false"},wdi_controller.conditionalFiltersTabInit=function(){this.setInitialFilters(),this.updateFiltersUi();var t=this;function e(){switch(jQuery("#WDI_wrap_conditional_filter_enable input:checked").val()){case"0":jQuery("#WDI_conditional_filters").parent().parent().addClass("wdi_hidden"),jQuery("#WDI_conditional_filter_type").parent().parent().parent().parent().parent().addClass("wdi_hidden"),jQuery("#wdi_final_condition").addClass("wdi_hidden"),jQuery("#WDI_filter_source").addClass("wdi_hidden");break;case"1":jQuery("#WDI_conditional_filters").parent().parent().removeClass("wdi_hidden"),jQuery("#WDI_conditional_filter_type").parent().parent().parent().parent().parent().removeClass("wdi_hidden"),jQuery("#wdi_final_condition").removeClass("wdi_hidden"),jQuery("#WDI_filter_source").removeClass("wdi_hidden")}}jQuery("#wdi_add_filter").on("click",function(){t.addConditionalFilter()&&jQuery("#wdi_filter_input").val("")}),jQuery(".wdi_filter_radio").on("click",function(){jQuery("#wdi_filter_input").trigger("focus")}),jQuery("#wdi_filter_input").on("keypress",function(e){if(13==e.keyCode)return t.addConditionalFilter()&&jQuery(this).val(""),!1}),e(),jQuery("#WDI_wrap_conditional_filter_enable input").on("change",function(){e()}),jQuery("#WDI_conditional_filter_type").on("change",function(){switch("none"==jQuery(this).val()||jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").css({display:"inline-block"}),jQuery(this).val()){case"AND":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.and_descr);break;case"OR":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.or_descr);break;case"NOR":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.nor_descr)}wdi_controller.updateFiltersUi()}),jQuery("#WDI_conditional_filter_type").trigger("change")},wdi_controller.addConditionalFilter=function(){var e=jQuery("#wdi_filter_input").val(),t=jQuery("#wdi_filter_type").val();if(filter={},""==e)return!1;switch(e=e.trim(),null==t&&("@"==e[0]?t="mention":"#"==e[0]?t="hashtag":"http"!=e.split("://")[0]&&"https"!=e.split("://")[0]||(t="url")),t){case"username":case"mention":"@"==e[0]&&(e=e.substr(1,e.length));break;case"hashtag":"#"==e[0]&&(e=e.substr(1,e.length));break;case"url":if(!/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e))return alert(wdi_messages.invalid_url),!1}return filter={filter_type:t,filter_by:e,id:this.randomId()},null!=t?this.filterExists(filter)?(alert(e+" "+wdi_messages.already_added),!1):(this.conditionalFilters.push(filter),this.updateFiltersUi(),!0):(alert(wdi_messages.selectConditionType),!1)},wdi_controller.filterExists=function(e){for(var t=0;t<this.conditionalFilters.length;t++)if(this.conditionalFilters[t].filter_type==e.filter_type&&this.conditionalFilters[t].filter_by==e.filter_by)return!0;return!1},wdi_controller.updateFiltersUi=function(){for(var e,t=jQuery("#wdi_filters_ui").html(""),i=0;i<this.conditionalFilters.length;i++){if(0==i)if(1!=this.conditionalFilters.length)switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":break;case"OR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.either+"</span>"));break;case"NOR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.neither+"</span>"))}else switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":case"OR":break;case"NOR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.not+"</span>"))}switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":e=wdi_messages.and;break;case"OR":e=wdi_messages.or;break;case"NOR":e=wdi_messages.nor}1<=i&&t.append(jQuery('<span class="wdi_logic">'+e+"</span>")),t.append(this.createUiElement(this.conditionalFilters[i]))}this.updateFilterTextarea()},wdi_controller.createUiElement=function(e){var t;switch(e.filter_type){case"mention":t="@";break;case"hashtag":t="#";break;case"location":t="%";break;default:t=""}return jQuery('<span data-id="'+e.id+'" class="wdi_filter_item wdi_filter_by_'+e.filter_type+'"></span>').html(t+e.filter_by+'<span onclick="wdi_controller.removeConditionalFilter(jQuery(this));" class="wdi_remove_filter">X</span>')},wdi_controller.randomId=function(){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<5;i++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},wdi_controller.removeConditionalFilter=function(e){for(var t=e.parent().attr("data-id"),i=0;i<this.conditionalFilters.length;i++)this.conditionalFilters[i].id==t&&this.conditionalFilters.splice(i,1);this.updateFiltersUi()},wdi_controller.updateFilterTextarea=function(){var e=this.conditionalFilters,e=JSON.stringify(e);jQuery("#wdi_conditional_filters_textarea").val(e)},wdi_controller.setInitialFilters=function(){var e=[],t=jQuery("#wdi_conditional_filters_textarea").val();this.isJsonString(t)&&(e=JSON.parse(t)),this.conditionalFilters=e},wdi_controller.updateConditionalFiltersUi=function(){wdi_controller.updateFilterSource()},wdi_controller.updateFilterSource=function(){if("liked"!=jQuery('input[name="wdi_feed_settings[liked_feed]"]:checked').val()){var e,t,i=[];jQuery(".wdi_user").each(function(){e=(0!=jQuery(this).find(".wdi_username").length?jQuery(this).find(".wdi_username"):jQuery(this).find(".wdi_hashtag")).text(),t=jQuery(this).find("img").attr("src"),i.push({username:e,image:t})});for(var r=jQuery("#wdi_filter_source").html(""),a=0;a<i.length;a++){s="<div class='wdi_source_user'><span class='wdi_source_img'><img src='"+i[a].image+"'></span><span class='wdi_source_username'>"+i[a].username+"</span></div>";r.html(r.html()+s)}}else{var r,s="<div class='wdi_source_user'><span class='wdi_source_username'>Media I liked</span></div>";(r=jQuery("#wdi_filter_source").html("")).html(r.html()+s)}},wdi_controller.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_controller.getUserObj=function(e){var t=JSON.parse(wdi_options.wdi_authenticated_users_list);if("object"==typeof t){if("object"==typeof t[e]&&""!=t[e])return t[e];console.log("Error: User not exist on Users object")}else console.log("Error: Wrong response when parsed on users (JSON.parse)");return!1};
js/wdi_frontend.js CHANGED
@@ -372,7 +372,8 @@ wdi_front.instagramRequest = function (id, currentFeed) {
372
  }
373
  },
374
  null,
375
- currentFeed.feed_row.hashtag_top_recent
 
376
  );
377
  }
378
  else {
@@ -392,7 +393,7 @@ wdi_front.instagramRequest = function (id, currentFeed) {
392
  _this.saveUserData(response, currentFeed.feed_users[id], currentFeed);
393
  }
394
  }
395
- });
396
  }
397
  }
398
  }
@@ -540,6 +541,14 @@ wdi_front.appendRequestHashtag = function (data, hashtag) {
540
  * it recursively calls wdi_front.loadMore() until the desired number of photos is reached
541
  */
542
  wdi_front.displayFeed = function (currentFeed, load_more_number) {
 
 
 
 
 
 
 
 
543
  if (currentFeed.customFilterChanged == false) {
544
  // sorting data...
545
  var data = wdi_front.feedSort(currentFeed, load_more_number);
@@ -925,7 +934,12 @@ wdi_front.displayFeedItems = function (data, currentFeed) {
925
 
926
  var rawItem = data[i];
927
  var item = wdi_front.createObject(rawItem, currentFeed);
928
- var html = photoTemplate(item);
 
 
 
 
 
929
  feed_wrapper.html(feed_wrapper.html() + html);
930
 
931
  currentFeed.imageIndex++;
@@ -1222,23 +1236,29 @@ wdi_front.createObject = function (obj, currentFeed) {
1222
  var thumbType = 'video';
1223
  break;
1224
  case 'carousel':
1225
- switch (obj.carousel_media[0].type) {
1226
- case 'image':
1227
- var image_url = obj.carousel_media[0].images[currentFeed.feedImageResolution].url
1228
- var videoUrl = undefined;
1229
- var thumbType = 'image';
1230
- break;
1231
- case 'video':
1232
- var image_url = undefined;
1233
- var videoUrl = obj.carousel_media[0].videos[currentFeed.feedVideoResolution].url;
1234
- var thumbType = 'video';
1235
- break;
1236
- default:
1237
  var image_url = wdi_url.plugin_url + "images/missing.png";
1238
- var videoUrl = wdi_url.plugin_url + "images/video_missing.png";
1239
  var thumbType = 'image';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1240
  }
1241
- break
1242
  default:
1243
  var image_url = wdi_url.plugin_url + "images/missing.png";
1244
  var videoUrl = wdi_url.plugin_url + "images/video_missing.png";
@@ -1854,6 +1874,8 @@ wdi_front.loadMore = function (button, _currentFeed) {
1854
  if ( typeof _currentFeed != 'undefined' ) {
1855
  var currentFeed = _currentFeed;
1856
  }
 
 
1857
  if ( this.isJsonString(currentFeed.feed_row.feed_users) ) {
1858
  json_feed_users = JSON.parse(currentFeed.feed_row.feed_users);
1859
  for ( var i in json_feed_users ) {
@@ -1887,8 +1909,7 @@ wdi_front.loadMore = function (button, _currentFeed) {
1887
  if (button === '') {
1888
  currentFeed['auto_trigger'] = true;
1889
  }
1890
- // ading ajax loading
1891
- wdi_front.ajaxLoader(currentFeed);
1892
 
1893
  //check if masonry view is on and and feed display type is pagination then
1894
  //close all captions before loading more pages for porper pagination rendering
@@ -1927,20 +1948,13 @@ wdi_front.loadMore = function (button, _currentFeed) {
1927
  };
1928
 
1929
  //checking if pagination url exists then load images, else skip
1930
- if (pagination['next_url'] != '' && pagination['next_url'] != null && typeof pagination['next_url'] != 'undefined') {
1931
- var next_url = pagination['next_url'];
1932
- wdi_front.loadMoreRequest(user, next_url, currentFeed, button);
1933
  }
1934
- else {
1935
- if (button == 'initial-keep') {
1936
- currentFeed.temproraryUsersData[i] = currentFeed.usersData[i];
1937
- }
1938
- if ( currentFeed.loadMoreDataCount > 0 ) {
1939
- currentFeed.loadMoreDataCount--
1940
- }
1941
- wdi_front.checkForLoadMoreDone(currentFeed, button);
1942
- continue;
1943
  }
 
1944
  }
1945
  }
1946
 
@@ -2005,28 +2019,6 @@ wdi_front.loadMoreRequest = function (user, next_url, currentFeed, button) {
2005
  }
2006
  wdi_front.checkForLoadMoreDone(currentFeed, button);
2007
  };
2008
-
2009
- if ( ! user.hashtag && ! user.hashtag_id ) {
2010
- currentFeed.instagram.getUserMedia({
2011
- feed_id: currentFeed.feed_row.id,
2012
- user_id: user.user_id,
2013
- user_name: user.username,
2014
- success: success_function
2015
- },
2016
- next_url
2017
- );
2018
- }
2019
- else {
2020
- currentFeed.instagram.getTagRecentMedia(this.stripHashtag(user.hashtag), {
2021
- feed_id: currentFeed.feed_row.id,
2022
- user_id: user.hashtag_id,
2023
- user_name: user.hashtag,
2024
- success: success_function
2025
- },
2026
- next_url,
2027
- currentFeed.feed_row.hashtag_top_recent
2028
- );
2029
- }
2030
  }
2031
 
2032
  wdi_front.checkForLoadMoreDone = function (currentFeed, button) {
@@ -2735,7 +2727,7 @@ wdi_front.checkMediaResponse = function (response, currentFeed) {
2735
  wdi_front.show_alert(errorMessage, response, currentFeed);
2736
  return false;
2737
  }
2738
- if ( response != '' && typeof response != 'undefined' && response != null && response['meta']['code'] != 200) {
2739
  errorMessage = response['meta']['error_message'];
2740
  wdi_front.show_alert(errorMessage, response, currentFeed);
2741
  return false;
372
  }
373
  },
374
  null,
375
+ currentFeed.feed_row.hashtag_top_recent,
376
+ 0
377
  );
378
  }
379
  else {
393
  _this.saveUserData(response, currentFeed.feed_users[id], currentFeed);
394
  }
395
  }
396
+ }, '', 0);
397
  }
398
  }
399
  }
541
  * it recursively calls wdi_front.loadMore() until the desired number of photos is reached
542
  */
543
  wdi_front.displayFeed = function (currentFeed, load_more_number) {
544
+ if(currentFeed.data.length >= currentFeed.allResponseLength) {
545
+ if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
546
+ var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
547
+ jQuery('#wdi_feed_' + wdi_feed_counter).find('.wdi_load_more').remove();
548
+ jQuery('#wdi_feed_' + wdi_feed_counter).find('.wdi_spinner').remove();
549
+ }
550
+ return;
551
+ }
552
  if (currentFeed.customFilterChanged == false) {
553
  // sorting data...
554
  var data = wdi_front.feedSort(currentFeed, load_more_number);
934
 
935
  var rawItem = data[i];
936
  var item = wdi_front.createObject(rawItem, currentFeed);
937
+
938
+ var html = '';
939
+ /* undefined when carousel media not defined */
940
+ if( typeof item !== 'undefined' ) {
941
+ html = photoTemplate(item);
942
+ }
943
  feed_wrapper.html(feed_wrapper.html() + html);
944
 
945
  currentFeed.imageIndex++;
1236
  var thumbType = 'video';
1237
  break;
1238
  case 'carousel':
1239
+ if( obj.carousel_media.length === 0 ){
 
 
 
 
 
 
 
 
 
 
 
1240
  var image_url = wdi_url.plugin_url + "images/missing.png";
1241
+ var videoUrl = undefined;
1242
  var thumbType = 'image';
1243
+ } else {
1244
+ switch (obj.carousel_media[0].type) {
1245
+ case 'image':
1246
+ var image_url = obj.carousel_media[0].images[currentFeed.feedImageResolution].url
1247
+ var videoUrl = undefined;
1248
+ var thumbType = 'image';
1249
+ break;
1250
+ case 'video':
1251
+ var image_url = undefined;
1252
+ var videoUrl = obj.carousel_media[0].videos[currentFeed.feedVideoResolution].url;
1253
+ var thumbType = 'video';
1254
+ break;
1255
+ default:
1256
+ var image_url = wdi_url.plugin_url + "images/missing.png";
1257
+ var videoUrl = wdi_url.plugin_url + "images/video_missing.png";
1258
+ var thumbType = 'image';
1259
+ }
1260
  }
1261
+ break;
1262
  default:
1263
  var image_url = wdi_url.plugin_url + "images/missing.png";
1264
  var videoUrl = wdi_url.plugin_url + "images/video_missing.png";
1874
  if ( typeof _currentFeed != 'undefined' ) {
1875
  var currentFeed = _currentFeed;
1876
  }
1877
+ // ading ajax loading
1878
+ wdi_front.ajaxLoader(currentFeed);
1879
  if ( this.isJsonString(currentFeed.feed_row.feed_users) ) {
1880
  json_feed_users = JSON.parse(currentFeed.feed_row.feed_users);
1881
  for ( var i in json_feed_users ) {
1909
  if (button === '') {
1910
  currentFeed['auto_trigger'] = true;
1911
  }
1912
+
 
1913
 
1914
  //check if masonry view is on and and feed display type is pagination then
1915
  //close all captions before loading more pages for porper pagination rendering
1948
  };
1949
 
1950
  //checking if pagination url exists then load images, else skip
1951
+ if (button == 'initial-keep') {
1952
+ currentFeed.temproraryUsersData[i] = currentFeed.usersData[i];
 
1953
  }
1954
+ if ( currentFeed.loadMoreDataCount > 0 ) {
1955
+ currentFeed.loadMoreDataCount--
 
 
 
 
 
 
 
1956
  }
1957
+ wdi_front.checkForLoadMoreDone(currentFeed, button);
1958
  }
1959
  }
1960
 
2019
  }
2020
  wdi_front.checkForLoadMoreDone(currentFeed, button);
2021
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2022
  }
2023
 
2024
  wdi_front.checkForLoadMoreDone = function (currentFeed, button) {
2727
  wdi_front.show_alert(errorMessage, response, currentFeed);
2728
  return false;
2729
  }
2730
+ if ( response != '' && typeof response != 'undefined' && response != null && typeof response['meta'] !== "undefined" && response['meta']['code'] != 200) {
2731
  errorMessage = response['meta']['error_message'];
2732
  wdi_front.show_alert(errorMessage, response, currentFeed);
2733
  return false;
js/wdi_frontend.min.js CHANGED
@@ -1 +1 @@
1
- "undefined"==typeof wdi_front&&(wdi_front={type:"not_declared"});var wdi_error_show=!(wdi_front.detectEvent=function(){var e="click";return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())&&(e="touchend"),e}),wdi_error_init=!1;function wdi_baseName(e){var i=e.substr(e.lastIndexOf("/"));return e.replace(i,"")}wdi_front.escape_tags=function(e){return void 0===e&&(e=""),e=e.toString().replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&#34;")},wdi_front.show_alert=function(e,i,r){var t,d;void 0!==(r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter))&&(wdi_error_show=!0,r.find(".wdi_spinner").remove(),t=r.find(".wdi_js_error"),d=r.find(".wdi_token_error"),0!=i&&(void 0!==i.meta&&1==i.meta.error&&"OAuthException"===i.meta.error_type||void 0!==i.error&&"OAuthException"===i.error.type)?(r.find(".wdi_single_user").remove(),d.removeClass("wdi_hidden"),"1"!=wdi_front_messages.wdi_token_error_flag&&jQuery.ajax({type:"POST",url:wdi_url.ajax_url,dataType:"json",data:{action:"wdi_token_flag",wdi_token_flag_nonce:wdi_front_messages.wdi_token_flag_nonce},success:function(e){}})):void 0!==i.error&&void 0!==i.error.message&&(t.html(i.error.message),r.find(".wdi_single_user").remove(),t.removeClass("wdi_js_error"),t.addClass("wdi_js_error_no_animate"),jQuery(".wdi_js_error_no_animate").show()),wdi_front_messages.show_alerts||console.log("%c"+e,"color:#cc0000;")),wdi_error_show=!0},wdi_front.globalInit=function(){var e=wdi_front.feed_counter,i=0;void 0!==wdi_ajax.ajax_response&&(i=wdi_feed_counter_init.wdi_feed_counter_init);for(var r,t=i;t<=e;t++)0!==jQuery("#wdi_feed_"+t).length&&((r=new WDIFeed(window["wdi_feed_"+t])).instagram=new WDIInstagram,r.instagram.filterArguments={feed:r},r.instagram.addToken(r.feed_row.access_token),wdi_front.access_token=r.feed_row.access_token,r.dataStorageRaw=[],r.dataStorage=[],r.dataStorageList=[],r.allResponseLength=0,r.currentResponseLength=0,r.temproraryUsersData=[],r.removedUsers=0,r.nowLoadingImages=!0,r.imageIndex=0,r.resIndex=0,r.currentPage=1,r.currentPageLoadMore=0,r.userSortFlags=[],r.customFilterChanged=!1,r.maxConditionalFiltersRequestCount=10,r.instagramRequestCounter=0,r.mediaRequestsDone=!1,r.conditionalFilterBuffer=[],r.stopInfiniteScrollFlag=!1,"masonry"==r.feed_row.feed_type&&(r.displayedData=[]),"pagination"==r.feed_row.feed_display_view?(r.feed_row.resort_after_load_more=0,"image_browser"!=r.feed_row.feed_type?(r.feed_row.load_more_number=parseInt(r.feed_row.pagination_per_page_number),r.feed_row.number_of_photos=(1+parseInt(r.feed_row.pagination_preload_number))*r.feed_row.load_more_number):(r.feed_row.number_of_photos=1+parseInt(r.feed_row.image_browser_preload_number),r.feed_row.load_more_number=parseInt(r.feed_row.image_browser_load_number)),r.freeSpaces=(Math.floor(r.feed_row.pagination_per_page_number/r.feed_row.number_of_columns)+1)*r.feed_row.number_of_columns-r.feed_row.pagination_per_page_number):r.freeSpaces=0,r.galleryBox=function(e){wdi_spider_createpopup(wdi_url.ajax_url+"?gallery_id="+this.feed_row.id+"&image_id="+e,this.feed_row.wdi_feed_counter,this.feed_row.lightbox_width,this.feed_row.lightbox_height,1,"testpopup",5,this,e)},wdi_responsive.columnControl(r),"masonry"==r.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(r),window["wdi_feed_"+t]=r,wdi_front.init(r))},wdi_front.init=function(e){if(jQuery(".wdi_js_error").hide(),e.photoCounter=e.feed_row.number_of_photos,"liked"==e.feed_row.liked_feed)e.feed_users=["self"];else{if(!wdi_front.isJsonString(e.feed_row.feed_users))return void wdi_front.show_alert(wdi_front_messages.invalid_users_format,!1,e);e.feed_users=JSON.parse(e.feed_row.feed_users)}var i=[],r=[],t=[];void 0!==window.wdi_all_tags&&(i=window.wdi_all_tags);for(var d=0;d<e.feed_users.length;d++)"#"===e.feed_users[d].username[0]&&void 0!==e.feed_users[d].tag_id?(i[e.feed_users[d].tag_id]=e.feed_users[d],t[d]=e.feed_users[d]):r[0]=e.feed_users[d];window.wdi_all_tags=i,e.feed_users=void 0===t||wdi_front.isEmpty(t)?r:t;var a=wdi_front.getFeedItemResolution(e);e.feedImageResolution=a.image,e.feedVideoResolution=a.video,e.dataCount=e.feed_users.length;for(var o=0;o<e.dataCount;o++)wdi_front.instagramRequest(o,e);0<e.feed_row.number_of_photos&&wdi_front.ajaxLoader(e),"1"===e.feed_row.display_header&&wdi_front.show("header",e),"1"===e.feed_row.show_usernames&&wdi_front.show("users",e)},wdi_front.getFeedItemResolution=function(e){var i={image:"standard_resolution",video:"standard_resolution"};if("thumbnail"===e.feed_row.feed_resolution)return{image:"thumbnail",video:"low_bandwidth"};if("low"===e.feed_row.feed_resolution)return{image:"low_resolution",video:"low_resolution"};if("standard"===e.feed_row.feed_resolution)return{image:"standard_resolution",video:"standard_resolution"};var r=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");r.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>'),wdi_responsive.columnControl(e,1);e=r.attr("wdi-res").split("wdi_col_");if(r.find("#wdi_feed_item_example").remove(),2!==e.length)return i;e=parseInt(e[1]);if(e<=0)return i;e=r.width()/e-10;return e<=150?(i.image="thumbnail",i.video="low_bandwidth"):150<e&&e<=320?(i.image="low_resolution",i.video="low_resolution"):(i.image="standard_resolution",i.video="standard_resolution"),i},wdi_front.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_front.instagramRequest=function(i,r){var t=this,e=r.feed_users;if("string"==typeof e[i]&&"self"===e[i])r.instagram.getRecentLikedMedia({success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,r),r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveSelfUserData(e,r)}});else if("hashtag"==this.getInputType(e[i].username)){if(this.isJsonString(r.feed_row.feed_users))for(var d in json_feed_users=JSON.parse(r.feed_row.feed_users),json_feed_users)"#"!==json_feed_users[d].username.charAt(0)&&(user=json_feed_users[d]);r.instagram.getTagRecentMedia(this.stripHashtag(e[i].username),{feed_id:r.feed_row.id,user_id:user.id,user_name:user.username,success:function(e){if(void 0!==e.error&&"undefined"!=e.error.type||void 0!==e.meta&&1==e.meta.error)return wdi_front.show_alert(!1,e,r),!1;r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}},null,r.feed_row.hashtag_top_recent)}else"user"==this.getInputType(e[i].username)&&r.instagram.getUserMedia({feed_id:r.feed_row.id,user_id:e[i].id,user_name:e[i].username,success:function(e){if(void 0!==e.meta&&1==typeof e.meta.error)return wdi_front.show_alert(!1,e,r),!1;r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}})},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,i,r){e.user_id=i.id,e.username=i.username,"#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),r.usersData.push(e),r.currentResponseLength=wdi_front.getArrayContentLength(r.usersData,"data"),r.allResponseLength+=r.currentResponseLength,r.dataCount==r.usersData.length&&(r.currentResponseLength<r.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(r)?wdi_front.loadMore("initial-keep",r):(wdi_front.displayFeed(r),wdi_front.applyFilters(r),wdi_front.activeUsersCount(r)||"load_more_btn"==r.feed_row.feed_display_view&&((r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.saveSelfUserData=function(e,i){e.user_id="",e.username="",i.usersData.push(e),i.currentResponseLength=wdi_front.getArrayContentLength(i.usersData,"data"),i.allResponseLength+=i.currentResponseLength,i.dataCount==i.usersData.length&&(i.currentResponseLength<i.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(i)?wdi_front.loadMore("initial-keep",i):(wdi_front.displayFeed(i),wdi_front.applyFilters(i),wdi_front.activeUsersCount(i)||"load_more_btn"==i.feed_row.feed_display_view&&((i=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.userHasNoPhoto=function(e,i){var r=0,t=e.usersData;void 0!==i&&(t=i);for(var d=0;d<t.length;d++)void 0===t[d].pagination&&(t[d].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===t[d].pagination.next_max_like_id&&r++:void 0===t[d].pagination.next_max_id&&r++;return r==t.length?1:0},wdi_front.appendRequestHashtag=function(e,i){for(var r=0;r<e.length;r++)e[r].wdi_hashtag=i;return e},wdi_front.displayFeed=function(e,i){0==e.customFilterChanged&&(r=wdi_front.feedSort(e,i));var r,i=e.customFilterChanged;1==e.customFilterChanged&&(r=e.customFilteredData,e.parsedData=wdi_front.parseLighboxData(e,!0)),"1"!=e.feed_row.resort_after_load_more?0==e.customFilterChanged&&(e.dataStorageList=e.dataStorageList.concat(r)):0==e.customFilterChanged&&(e.dataStorageList=r),"masonry"==e.feed_row.feed_type&&wdi_front.masonryDisplayFeedItems(r,e),"thumbnails"!=e.feed_row.feed_type&&"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||wdi_front.displayFeedItems(r,e),wdi_front.getDataLength(e)<parseInt(e.feed_row.number_of_photos)+parseInt(e.feed_row.load_more_number*e.currentPageLoadMore)&&!i&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(e)?wdi_front.loadMore("",e):(e.currentPageLoadMore++,wdi_front.allImagesLoaded(e)),e.instagramRequestCounter>e.maxConditionalFiltersRequestCount&&(wdi_front.allImagesLoaded(e),0==r.length&&(e.stopInfiniteScrollFlag=!0)),"pagination"==e.feed_row.feed_display_view&&e.currentPage<e.paginator&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled"),e.instagramRequestCounter=0,e.conditionalFilterBuffer=[],wdi_front.updateUsersImages(e)},wdi_front.updateUsersImages=function(i){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img").each(function(){if((jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||""==jQuery(this).attr("src"))&&"liked"!=i.feed_row.liked_feed)for(var e=0;e<i.usersData.length;e++)i.usersData[e].username==jQuery(this).parent().parent().find("h3").text()&&0!=i.usersData[e].data.length&&jQuery(this).attr("src",i.usersData[e].data[0].images.thumbnail.url)})},wdi_front.masonryDisplayFeedItems=function(e,i){var r=[],t=[];if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){1==i.feed_row.resort_after_load_more&&(jQuery(this).html(""),i.imageIndex=0),1==i.customFilterChanged&&(jQuery(this).html(""),i.imageIndex=0),"pagination"==i.feed_row.feed_display_view?r.push(0):r.push(jQuery(this).height()),t.push(jQuery(this))}),1==i.customFilterChanged&&(i.customFilterChanged=!1);for(var d,a,o,n=0;n<e.length;n++)"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(i.displayedData.push(e[n]),d="",void 0!==e[n].wdi_hashtag&&(d=e[n].wdi_hashtag),a="image"==e[n].type?wdi_front.getPhotoTemplate(i,d):e[n].hasOwnProperty("videos")||"video"==e[n].type?wdi_front.getVideoTemplate(i,d):wdi_front.getSliderTemplate(i,d),o=e[n],d=a(wdi_front.createObject(o,i)),a=wdi_front.array_min(r),o=wdi_front.getImageResolution(e[n]),t[a.index].html(t[a.index].html()+d),r[a.index]+=t[a.index].width()*o,i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++));i.wdi_loadedImages=0;var s=!1;i.wdi_load_count=n;var _=i.feed_row.wdi_feed_counter;jQuery("#wdi_feed_"+_+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,w(),!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});w(),1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}function w(){i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i))}},wdi_front.getImageResolution=function(e){var i=e.images.standard_resolution.width;return e.images.standard_resolution.height/i},wdi_front.getDataLength=function(e,i){var r=0;if(void 0===i)for(var t=0;t<e.dataStorage.length;t++)r+=e.dataStorage[t].length;else for(t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.getArrayContentLength=function(e,i){for(var r=0,t=0;t<e.length;t++)"finished"!=e[t].finished&&void 0===e[t].error&&(r+=e[t][i].length);return r},wdi_front.displayFeedItems=function(e,i){if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){var r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" .wdi_feed_wrapper");"1"===i.feed_row.resort_after_load_more&&(t.html(""),i.imageIndex=0),1==i.customFilterChanged&&(t.html(""),i.imageIndex=0,i.customFilterChanged=!1);var d;wdi_front.getImgCount(i),e.length;"pagination"==i.feed_row.feed_display_view&&(d=i.feed_row.load_more_number,"image_browser"==i.feed_row.feed_type&&(d=1),(jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+' [wdi_page="'+(i.currentPage-1)+'"]').length<d||0==e.length)&&(i.currentPage=--i.currentPage<=1?1:i.currentPage));for(var a,o,n=0;n<e.length;n++){if(void 0===e[n])return;"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(o="",void 0!==e[n].wdi_hashtag&&(o=e[n].wdi_hashtag),a="image"==e[n].type?wdi_front.getPhotoTemplate(i,o):e[n].hasOwnProperty("videos")?wdi_front.getVideoTemplate(i,o):wdi_front.getSliderTemplate(i,o),o=e[n],o=a(wdi_front.createObject(o,i)),t.html(t.html()+o),i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++))}i.wdi_loadedImages=0;var s=!1;i.wdi_load_count=n;r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i)),!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}},wdi_front.checkFeedFinished=function(e){for(var i=0;i<e.usersData.length;i++)if(void 0===e.usersData[i].finished)return!1;return!0},wdi_front.sortingOperator=function(e,i){var r;switch(e){case"date":switch(i){case"asc":r=function(e,i){return e.created_time>i.created_time?1:-1};break;case"desc":r=function(e,i){return e.created_time>i.created_time?-1:1}}break;case"likes":switch(i){case"asc":r=function(e,i){return e.likes.count<i.likes.count?-1:1};break;case"desc":r=function(e,i){return e.likes.count<i.likes.count?1:-1}}break;case"comments":switch(i){case"asc":r=function(e,i){return e.comments.count<i.comments.count?-1:1};break;case"desc":r=function(e,i){return e.comments.count<i.comments.count?1:-1}}break;case"random":r=function(e,i){return.5<Math.random()?1:-1}}return r},wdi_front.feedSort=function(e,i){var r=e.feed_row.sort_images_by,t=e.feed_row.display_order;"1"===e.feed_row.resort_after_load_more?e.data=e.data.concat(wdi_front.smartPicker(e,i)):e.data=wdi_front.smartPicker(e,i);t=wdi_front.sortingOperator(r,t);return e.data.sort(t),e.data},wdi_front.smartPicker=function(e,i){var r=[],t=0,d=[],a=parseInt(e.feed_row.number_of_photos),o=Math.ceil(a/e.usersData.length),n=0;""!=i&&void 0!==i&&null!=i&&(a=parseInt(i),o=Math.ceil(a/wdi_front.activeUsersCount(e)));e.storeRawData(e.usersData,"dataStorageRaw");for(var s,_=e.dataStorageRaw.sort(function(e,i){return e.length()>i.length()?1:-1}),w=e.usersData.sort(function(e,i){return e.data.length>i.data.length?1:-1}),f=0;f<w.length;f++)n+=o,_[f].length()<=n?(n-=_[f].length(),r.push(_[f].getData(_[f].length())),t+=r[r.length-1].length):(a<t+n&&(n=a-t),(!(s=[])===e.auto_trigger||s.length+wdi_front.getDataLength(e)+wdi_front.getDataLength(e,r)<e.feed_row.number_of_photos)&&(s=s.concat(_[f].getData(n))),n=0,t+=s.length,r.push(s));for(f=0;f<r.length;f++)void 0===e.dataStorage[f]?e.dataStorage.push(r[f]):e.dataStorage[f]=e.dataStorage[f].concat(r[f]);for(e.parsedData=wdi_front.parseLighboxData(e),f=0;f<r.length;f++)d=d.concat(r[f]);return d},wdi_front.createObject=function(e,i){var r=null!=e.caption?e.caption.text:"&nbsp";switch(e.type){case"image":var t=e.images[i.feedImageResolution].url,d=void 0,a="image";break;case"video":t=void 0,d=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution].url:wdi_url.plugin_url+"images/video_missing.png",a="video";break;case"carousel":switch(e.carousel_media[0].type){case"image":t=e.carousel_media[0].images[i.feedImageResolution].url,d=void 0,a="image";break;case"video":t=void 0,d=e.carousel_media[0].videos[i.feedVideoResolution].url,a="video";break;default:t=wdi_url.plugin_url+"images/missing.png",d=wdi_url.plugin_url+"images/video_missing.png",a="image"}break;default:t=wdi_url.plugin_url+"images/missing.png",d=wdi_url.plugin_url+"images/video_missing.png",a="image"}var o=i.imageIndex,n="square",s=e.images.standard_resolution.height,_=e.images.standard_resolution.width;_<s?n="portrait":s<_&&(n="landscape");_=e.user.username;return""===_&&(_="no_user"),{id:e.id,thumbType:a,caption:wdi_front.escape_tags(r),image_url:t,likes:e.likes.count,comments:e.comments.count,wdi_index:o,wdi_res_index:i.resIndex,wdi_media_user:_,link:e.link,video_url:d,wdi_username:_,wdi_shape:n}},wdi_front.setPage=function(e){var i=e.feed_row.feed_display_view,r=e.feed_row.feed_type;if("pagination"!=i)return"";i=e.imageIndex;return r="image_browser"==r?1:Math.abs(e.feed_row.pagination_per_page_number),e.paginator=Math.ceil((i+1)/r),e.paginator},wdi_front.getPhotoTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="",o="",n="tenweb-i-arrows-out",s="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(n=""),sourceAttr=(""!=r&&(d='wdi_page="'+r+'"'),"src"),""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":a="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":a="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",n="";break;case"custom_redirect":a="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",n="";break;case"none":o="wdi_cursor_off wdi_hover_off",n=a=""}d='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><img class=\"wdi_img\" "+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+o+'" >'+s+'<div class="wdi_thumb_icon" '+a+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+n+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(d+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(d+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(d+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),d+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(d+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),d+="</div>"),d+="</div>",_.template(d)},wdi_front.getSliderTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="",o="",n="tenweb-i-clone",s="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(n=""),sourceAttr=(""!=r&&(d='wdi_page="'+r+'"'),"src"),""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":a="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":a="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",n="tenweb-i-clone";break;case"custom_redirect":a="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",n="";break;case"none":o="wdi_cursor_off wdi_hover_off",n=a=""}d='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' wdi_type="slideshow" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><% if (thumbType === 'video') { %><video class=\"wdi_img\" "+sourceAttr+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video><% } else {%><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><% }%><div class="wdi_photo_overlay '+o+'" >'+s+'<div class="wdi_thumb_icon" '+a+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+n+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(d+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(d+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(d+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),d+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(d+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),d+="</div>"),d+="</div>",_.template(d)},wdi_front.replaceToVideo=function(e,i,r){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+e+"' type='video/mp4'>Your browser does not support the video tag. </video>",jQuery("#wdi_feed_"+r+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner').html(overlayHtml),jQuery("#wdi_feed_"+r+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner video').get(0).play()},wdi_front.getVideoTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="tenweb-i-play",o="",n="",s="",w=(""!=r&&(d='wdi_page="'+r+'"'),"src");""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":o="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":o="onclick=\"window.open ('<%= link%>','_blank')\"",n="wdi_hover_off",a="tenweb-i-play";break;case"custom_redirect":o="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",n="wdi_hover_off",a="";break;case"none":n="wdi_cursor_off wdi_hover_off",a="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",n="",a="tenweb-i-play")}w='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><video class=\"wdi_img\" "+w+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video><div class="wdi_photo_overlay '+n+'" '+o+">"+s+'<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+a+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(w+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(w+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(w+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),w+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(w+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),w+="</div>"),w+="</div>",_.template(w)},wdi_front.bindEvents=function(e){0!=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length&&("load_more_btn"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"))}),"pagination"==e.feed_row.feed_display_view&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorNext(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorPrev(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationLastPage(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationFirstPage(jQuery(this),e)}),e.paginatorNextFlag=!1),"infinite_scroll"==e.feed_row.feed_display_view&&(jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(e)}),e.infiniteScrollFlag=!1))},wdi_front.infiniteScroll=function(e){jQuery(window).scrollTop()+jQuery(window).height()-100>=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll").offset().top&&(!1===e.infiniteScrollFlag&&0==e.stopInfiniteScrollFlag?(e.infiniteScrollFlag=!0,wdi_front.loadMore(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),e)):e.stopInfiniteScrollFlag&&wdi_front.allImagesLoaded(e))},wdi_front.paginationFirstPage=function(e,i){var r;1!=i.paginator&&1!=i.currentPage&&(r=i.currentPage,i.currentPage=1,wdi_front.updatePagination(i,"custom",r),e.parent().find("#wdi_last_page").removeClass("wdi_disabled")),e.addClass("wdi_disabled")},wdi_front.paginationLastPage=function(e,i){var r;1!=i.paginator&&i.currentPage!=i.paginator&&(r=i.currentPage,i.currentPage=i.paginator,wdi_front.updatePagination(i,"custom",r),e.addClass("wdi_disabled"),e.parent().find("#wdi_first_page").removeClass("wdi_disabled"))},wdi_front.paginatorNext=function(e,i){var r,t=e.parent().find("#wdi_last_page"),d=e.parent().find("#wdi_first_page");i.paginatorNextFlag=!0,i.paginator!=i.currentPage||wdi_front.checkFeedFinished(i)?i.paginator>i.currentPage&&(i.currentPage++,wdi_front.updatePagination(i,"next"),i.paginator>i.currentPage?t.removeClass("wdi_disabled"):t.addClass("wdi_disabled")):(i.currentPage++,r=i.feed_row.number_of_photos,wdi_front.loadMore(e,i,r),t.addClass("wdi_disabled")),d.removeClass("wdi_disabled")},wdi_front.paginatorPrev=function(e,i){var r=e.parent().find("#wdi_last_page"),e=e.parent().find("#wdi_first_page");1!=i.currentPage?(i.currentPage--,wdi_front.updatePagination(i,"prev"),r.removeClass("wdi_disabled"),1==i.currentPage&&e.addClass("wdi_disabled")):e.addClass("wdi_disabled")},wdi_front.updatePagination=function(e,i,r){var t="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(t+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),i){case"next":var r=e.currentPage-1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":r=e.currentPage+1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(r=r)!=e.currentPage&&(jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(t+" .wdi_feed_wrapper").css("height","auto"),jQuery(t+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,i){var r,t=0;if(""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e&&(r=window[e.parent().parent().parent().parent().attr("id")]),void 0!==i&&(r=i),this.isJsonString(r.feed_row.feed_users))for(var d in json_feed_users=JSON.parse(r.feed_row.feed_users),json_feed_users)iuser=json_feed_users[d],"#"!==json_feed_users[d].username.charAt(0)&&(iuser=json_feed_users[d]);for(var a=0,o=0,d=0;d<r.userSortFlags.length;d++)if(!0===r.userSortFlags[d].flag){a++;for(var n=0;n<r.usersData.length;n++)r.userSortFlags[d].id===r.usersData[n].user_id&&"finished"===r.usersData[n].finished&&o++}if(a!==o||0==a){r.auto_trigger=!1,""===e&&(r.auto_trigger=!0),wdi_front.ajaxLoader(r),"masonry"===r.feed_row.feed_type&&"pagination"==r.feed_row.feed_display_view&&jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)});for(d=0;d<r.usersData.length;d++)"finished"===r.usersData[d].finished&&t++;t===r.usersData.length&&(wdi_front.allImagesLoaded(r),jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+" .wdi_load_more").remove());var s=r.usersData;r.loadMoreDataCount=r.feed_users.length;for(d=0;d<s.length;d++){var _=s[d].pagination,w=void 0!==s[d].tag_id?s[d].tag_id:"",f=void 0!==s[d].username&&w?s[d].username:"",w={old_user_id:s[d].user_id,odl_username:s[d].username,user_id:iuser.id,username:iuser.username,hashtag:f,hashtag_id:w};""!=_.next_url&&null!=_.next_url&&void 0!==_.next_url?(_=_.next_url,wdi_front.loadMoreRequest(w,_,r,e)):("initial-keep"==e&&(r.temproraryUsersData[d]=r.usersData[d]),0<r.loadMoreDataCount&&r.loadMoreDataCount--,wdi_front.checkForLoadMoreDone(r,e))}}},wdi_front.loadMoreRequest=function(r,e,t,d){var a,i;t.mediaRequestsDone&&""!=e&&(t.usersData,a="",i=function(e){if(""===e||void 0===e||null==e)return a=wdi_front_messages.network_error,t.loadMoreDataCount--,void wdi_front.show_alert(a,e,t);if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,t),void 0!==e.meta&&void 0!==e.meta.code&&200!=e.meta.code)return a=e.meta.error_message,t.loadMoreDataCount--,void wdi_front.show_alert(a,e,t);r.hashtag?(e.user_id=r.hashtag_id,e.username=r.hashtag):(e.user_id=r.user_id,e.username=r.username);for(var i=0;i<t.usersData.length;i++)e.user_id!==t.usersData[i].user_id&&e.tag_id!==t.usersData[i].tag_id||("#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),"initial-keep"==d&&(t.temproraryUsersData[i]=t.usersData[i]),t.usersData[i]=e,void 0===t.dataStorageRaw[i]?t.dataStorageRaw[i]={data:e.data}:t.dataStorageRaw[i].data=t.dataStorageRaw[i].data.concat(e.data),t.loadMoreDataCount--);wdi_front.checkForLoadMoreDone(t,d)},r.hashtag||r.hashtag_id?t.instagram.getTagRecentMedia(this.stripHashtag(r.hashtag),{feed_id:t.feed_row.id,user_id:r.hashtag_id,user_name:r.hashtag,success:i},e,t.feed_row.hashtag_top_recent):t.instagram.getUserMedia({feed_id:t.feed_row.id,user_id:r.user_id,user_name:r.username,success:i},e))},wdi_front.checkForLoadMoreDone=function(e,i){var r,t=e.feed_row.load_more_number,d=e.feed_row.number_of_photos;0==e.loadMoreDataCount&&(e.temproraryUsersData=wdi_front.mergeData(e.temproraryUsersData,e.usersData),r=wdi_front.getArrayContentLength(e.temproraryUsersData,"data"),"initial-keep"==i&&(i="initial"),"initial"==i?r<d&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore("initial",e):(e.usersData=e.temproraryUsersData,wdi_front.displayFeed(e),wdi_front.applyFilters(e),e.temproraryUsersData=[]):r<t&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore(void 0,e):(e.usersData=e.temproraryUsersData,wdi_front.activeUsersCount(e)&&(wdi_front.displayFeed(e,t),wdi_front.applyFilters(e),e.temproraryUsersData=[])))},wdi_front.allDataHasFinished=function(e){for(var i=0,r=0;r<e.dataStorageRaw.length;r++)""==e.usersData[r].pagination.next_url&&(i++,e.usersData[r].finished="finished");return i==e.dataStorageRaw.length&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more").remove(),!0)},wdi_front.mergeData=function(e,i){for(var r=0;r<i.length;r++)void 0!==e[r]?"finished"!=i[r].finished&&(void 0===e[r].pagination.next_max_id&&void 0===e[r].pagination.next_max_like_id||(e[r].data=e[r].data.concat(i[r].data),e[r].pagination=i[r].pagination,e[r].user_id=i[r].user_id,e[r].username=i[r].username,e[r].meta=i[r].meta)):e.push(i[r]);return e},wdi_front.brokenImageHandler=function(e){return!0},wdi_front.ajaxLoader=function(e){var i,r=e.feed_row.wdi_feed_counter,r=jQuery("#wdi_feed_"+r);"load_more_btn"==e.feed_row.feed_display_view&&(r.find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").removeClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&(0==r.find(".wdi_ajax_loading").length?(i=jQuery('<div class="wdi_ajax_loading"><div><div><img class="wdi_load_more_spinner" src="'+wdi_url.plugin_url+'images/ajax_loader.png"></div></div></div>'),r.append(i)):i=r.find(".wdi_ajax_loading"),i.removeClass("wdi_hidden"))},wdi_front.allImagesLoaded=function(e){var i=wdi_front.getDataLength(e);e.mediaRequestsDone||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia"),0!=i||!e.mediaRequestsDone||0!=e.feed_row.conditional_filters.length&&0!=e.feed_row.conditional_filter_enable||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>");i=e.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+i);"load_more_btn"==e.feed_row.feed_display_view&&(i.find(".wdi_load_more").removeClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")},wdi_front.show=function(e,i){var r,t,d=i.feed_row.wdi_feed_counter,a=jQuery("#wdi_feed_"+d+" .wdi_feed_container");"header"===e&&(r={feed_thumb:i.feed_row.feed_thumb,feed_name:i.feed_row.feed_name},t=wdi_front.getHeaderTemplate()(r),r=a.find(".wdi_feed_header").html(),a.find(".wdi_feed_header").html(r+t))},wdi_front.getUserTemplate=function(e,i){var r=e.dataCount,t="#"===i[0]?"//instagram.com/explore/tags/"+i.substr(1,i.length):"//instagram.com/"+i,d="onclick='"+('window.open("'+t+'","_blank")')+"'",t='<div class="wdi_single_user" user_index="<%=user_index%>"><div class="wdi_header_user_text <%=hashtagClass%>"><div class="wdi_user_img_wrap"><img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';return 1<r&&(t+='<div title="'+wdi_front_messages.filter_title+'" class="wdi_filter_overlay"><div class="wdi_filter_icon"><span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="tenweb-i tenweb-i-filter"></span></div></div>'),t+="</div>",t+="<h3 "+d+"><%= user_name%></h3>","#"!==i[0]?("1"==e.feed_row.follow_on_instagram_btn&&(t+='<div class="wdi_user_controls"><div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> '+wdi_front_messages.follow+"</span></div></div>"),t+='<div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="tenweb-i tenweb-i-user"></span><%= counts.followed_by%></p></div>'):t+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>',t+='<div class="wdi_clear"></div>',1==r&&"#"!==i[0]&&"1"==e.feed_row.display_user_info&&(t+='<div class="wdi_bio"><%= bio%></div>',t+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'),t+="</div></div>",_.template(t)},wdi_front.getHeaderTemplate=function(){return _.template('<div class="wdi_header_wrapper"><div class="wdi_header_img_wrap"><img src="<%=feed_thumb%>"></div><div class="wdi_header_text"><%=feed_name%></div><div class="wdi_clear"></div>')},wdi_front.addFilter=function(e,i){var r=window["wdi_feed_"+i],i=r.dataCount;if(!(i<2)&&0==r.nowLoadingImages){i=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');i.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg"),i.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col"),i.find(".wdi_media_info").toggleClass("wdi_filter_active_col"),i.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col"),r.customFilterChanged=!0,0==r.userSortFlags[e].flag?r.userSortFlags[e].flag=!0:r.userSortFlags[e].flag=!1;for(var t=0,d=0;d<r.userSortFlags.length;d++)1==r.userSortFlags[d].flag&&t++;"pagination"==r.feed_row.feed_display_view&&(r.resIndex=0),0!=t?wdi_front.filterData(r):r.customFilteredData=r.dataStorageList,wdi_front.displayFeed(r),"pagination"==r.feed_row.feed_display_view&&(r.paginator=Math.ceil(r.imageIndex/parseInt(r.feed_row.pagination_per_page_number)),r.currentPage=r.paginator,wdi_front.updatePagination(r,"custom",1),jQuery("#wdi_first_page").removeClass("wdi_disabled"),jQuery("#wdi_last_page").addClass("wdi_disabled"))}},wdi_front.filterData=function(e){var i=e.userSortFlags;e.customFilteredData=[];for(var r=0;r<e.dataStorageList.length;r++)for(var t=0;t<i.length;t++)(void 0!==e.dataStorageList[r].user.id&&e.dataStorageList[r].user.id==i[t].id||e.dataStorageList[r].wdi_hashtag==i[t].name)&&1==i[t].flag&&e.customFilteredData.push(e.dataStorageList[r])},wdi_front.applyFilters=function(e){for(var i=0;i<e.userSortFlags.length;i++)1==e.userSortFlags[i].flag&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+'[user_index="'+i+'"]'),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter))},wdi_front.getImgCount=function(e){for(var i=e.dataStorage,r=0,t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.parseLighboxData=function(e,i){var r,t,d,a=e.dataStorage,o=e.feed_row.sort_images_by,n=e.feed_row.display_order,n=wdi_front.sortingOperator(o,n),s=[],_=[];if(1==i)s=e.customFilteredData;else{for(var w=0;w<a.length;w++)for(var f=0;f<a[w].length;f++)s.push(a[w][f]);s.sort(n)}for(w=0;w<s.length;w++)void 0!==s[w]&&(t=void 0!==s[w]&&void 0!==s[w].media_url?s[w].media_url:wdi_url.plugin_url+"images/video_missing.png",void 0!==s[w]&&void 0===s[w].media_url&&"carousel"===s[w].type&&(void 0!==(d=s[w].carousel_media[0])&&void 0!==d.images?t=d.images.standard_resolution.url:void 0!==d&&void 0!==d.videos&&(t=d.videos.standard_resolution.url)),void(d=0)!==s[w]&&void 0!==s[w].comments&&(d=s[w].comments.count),r={alt:"",avg_rating:"",comment_count:d,date:wdi_front.convertUnixDate(s[w].created_time),description:wdi_front.getDescription(void 0!==s[w].caption&&null!==s[w].caption?wdi_front.escape_tags(s[w].caption.text):""),filename:wdi_front.getFileName(s[w]),filetype:wdi_front.getFileType(s[w]),hit_count:"0",id:s[w].id,image_url:s[w].link,number:0,rate:"",rate_count:"0",username:void 0!==s[w].user?s[w].user.username:"",profile_picture:void 0!==s[w].user?s[w].user.profile_picture:"",thumb_url:t,comments_data:void 0!==s[w].comments?s[w].comments.data:"",images:s[w].images,carousel_media:void 0!==s[w].carousel_media?s[w].carousel_media:null},_.push(r));return _},wdi_front.convertUnixDate=function(e){var i=new Date(e).getTime()/1e3,e=new Date(0);e.setUTCSeconds(i);i=e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate();return i+=" "+e.getHours()+":"+e.getMinutes()},wdi_front.getDescription=function(e){return e=e.replace(/\r?\n|\r/g," ")},wdi_front.getFileName=function(e){if(void 0!==e){var i=e.link;if("video"===e.type&&e.hasOwnProperty("videos")&&null!=e.videos.standard_resolution)return e.videos.standard_resolution.url;if(void 0===i)return"";i=i.split("/");return i[i.length-2]}},wdi_front.getFileType=function(e){return"video"==e.type&&e.hasOwnProperty("videos")?"EMBED_OEMBED_INSTAGRAM_VIDEO":"carousel"==e.type&&e.hasOwnProperty("carousel_media")?"EMBED_OEMBED_INSTAGRAM_CAROUSEL":"EMBED_OEMBED_INSTAGRAM_IMAGE"},wdi_front.array_max=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i<e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.array_min=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i>e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.activeUsersCount=function(e){for(var i=0,r=0;r<e.usersData.length;r++)"finished"!=e.usersData[r].finished&&i++;return i},wdi_front.checkMediaResponse=function(e,i){return""==e||void 0===e||null==e||void 0!==e.error?(errorMessage=wdi_front_messages.connection_error,wdi_front.show_alert(errorMessage,e,i),!1):""!=e&&void 0!==e&&null!=e&&200!=e.meta.code?(errorMessage=e.meta.error_message,wdi_front.show_alert(errorMessage,e,i),!1):e},wdi_front.stripHashtag=function(e){return"#"!==e[0]?e:e.substr(1,e.length)},wdi_front.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_front.regexpTestCaption=function(e,i){var r=!1,t=!1,d=i.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),i=new RegExp("(?:^|\\s)"+d+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+d,"g");for(null!=i.exec(e)&&(r=!0);null!=(match=a.exec(e));)t=!0;return 1==r||1==t},wdi_front.replaceNewLines=function(e){var i,r="vUkCJvN2ps3t",t=[];for(e=e.replace(/\r?\n|\r/g,r),i=new RegExp(r,"g");null!=(match=i.exec(e));)t.push(match.index);for(var d=e.split(r),a=0,o=0;o<d.length;o++)""==d[o]?a++:a=0,0<a&&(d.splice(o,1),a--,o--);return e=d.join(" ")},wdi_front.isEmptyObject=function(e){for(var i in e)if(e.hasOwnProperty(i))return!1;return!0},wdi_front.isEmpty=function(e){return!e||0===e.length};var WDIFeed=function(e){this.data=e.data,this.dataCount=e.dataCount,this.feed_row=e.feed_row,this.usersData=e.usersData,(_this=this).set_images_loading_flag=function(e){window.addEventListener("load",function(){e.nowLoadingImages=!1})},this.set_images_loading_flag(_this)};function wdi_extractHostname(e){return void 0===e||""===e?"":e.replace(/(^\w+:|^)\/\//,"")}WDIFeed.prototype.mediaExists=function(e,i){for(var r=0;r<i.length;r++)if(e.id==i[r].id)return!0;return!1},WDIFeed.prototype.getIdFromUrl=function(e){for(var i=e.split("/"),r=!1,t=0;t<i.length;t++)if("p"==i[t]&&void 0!==i[t+1]){r=i[t+1];break}return r},WDIFeed.prototype.avoidDuplicateMedia=function(e){var i=e.data,r=[];void 0===i&&(i=[]);for(var t=0;t<i.length;t++)this.mediaExists(i[t],this.dataStorageList)||this.mediaExists(i[t],r)||this.mediaExists(i[t],this.conditionalFilterBuffer)||r.push(i[t]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(r),{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,i){var t=this;if("object"==typeof this[i]&&"number"==typeof this[i].length)for(var r=0;r<e.length;r++){var d="";wdi_front.isHashtag(e[r].user_id)?void 0!==e[r].pagination.cursors&&(d=e[r].pagination.cursors.after):"liked"==t.feed_row.liked_feed?void 0===(d=e[r].pagination.next_max_like_id)&&(d=""):(null==e[r].pagination&&(e[r].pagination=[]),void 0===(d=e[r].pagination.next_max_id)&&(d="")),void 0===this[i][r]?this[i].push({data:e[r].data,index:0,locked:!1,hash_id:d,usersDataFinished:!1,userId:e[r].user_id,length:function(){return this.data.length-this.index},getData:function(e){var i=this.data.slice(this.index,this.index+e);if(this.index+=Math.min(e,this.length()),this.index==this.data.length&&1==this.locked&&0==this.usersDataFinished)for(var r=0;r<t.usersData.length;r++)if(t.usersData[r].user_id==this.userId){this.usersDataFinished=!0;break}return i}}):0==this[i][r].locked&&(d!=this[i][r].hash_id?(this[i][r].data=this[i][r].data.concat(e[r].data),this[i][r].hash_id=d):this[i][r].locked=!0)}},wdi_front.updateUsersIfNecessary=function(o){for(var n=o.feed_users,e=!1,i=0;i<n.length;i++)"#"!=n[i].username.substr(0,1)?""!=n[i].id&&"username"!=n[i].id||(e=!0,o.instagram.searchForUsersByName(n[i].username,{success:function(e){if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,o),200==e.meta.code&&0<e.data.length){for(var i=!1,r=0;r<e.data.length;r++)if(e.data[r].username==e.args.username){i=!0;break}if(i)for(var t=0;t<n.length;t++)e.data[r].username==n[t].username&&(n[t].id=e.data[r].id)}for(var d=!1,a=0;a<n.length;a++)if(""==n[a].id||"username"==n[a].id){d=!0;break}d||(o.feed_row.feed_users=JSON.stringify(n),wdi_front.init(o))},username:n[i].username})):n[i].id=n[i].username;return e},void 0!==wdi_ajax.ajax_response?jQuery(document).one("ajaxStop",function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}):jQuery(document).ready(function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}),jQuery(document).ready(function(){setTimeout(function(){"1"===wdi_front_messages.show_alerts&&"I"!==jQuery(".wdi_check_fontawesome .tenweb-i-instagram").prop("tagName")&&console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")},2e3)});
1
+ "undefined"==typeof wdi_front&&(wdi_front={type:"not_declared"});var wdi_error_show=!(wdi_front.detectEvent=function(){var e="click";return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())&&(e="touchend"),e}),wdi_error_init=!1;function wdi_baseName(e){var i=e.substr(e.lastIndexOf("/"));return e.replace(i,"")}wdi_front.escape_tags=function(e){return void 0===e&&(e=""),e=e.toString().replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&#34;")},wdi_front.show_alert=function(e,i,r){var t,d;void 0!==(r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter))&&(wdi_error_show=!0,r.find(".wdi_spinner").remove(),t=r.find(".wdi_js_error"),d=r.find(".wdi_token_error"),0!=i&&(void 0!==i.meta&&1==i.meta.error&&"OAuthException"===i.meta.error_type||void 0!==i.error&&"OAuthException"===i.error.type)?(r.find(".wdi_single_user").remove(),d.removeClass("wdi_hidden"),"1"!=wdi_front_messages.wdi_token_error_flag&&jQuery.ajax({type:"POST",url:wdi_url.ajax_url,dataType:"json",data:{action:"wdi_token_flag",wdi_token_flag_nonce:wdi_front_messages.wdi_token_flag_nonce},success:function(e){}})):void 0!==i.error&&void 0!==i.error.message&&(t.html(i.error.message),r.find(".wdi_single_user").remove(),t.removeClass("wdi_js_error"),t.addClass("wdi_js_error_no_animate"),jQuery(".wdi_js_error_no_animate").show()),wdi_front_messages.show_alerts||console.log("%c"+e,"color:#cc0000;")),wdi_error_show=!0},wdi_front.globalInit=function(){var e=wdi_front.feed_counter,i=0;void 0!==wdi_ajax.ajax_response&&(i=wdi_feed_counter_init.wdi_feed_counter_init);for(var r,t=i;t<=e;t++)0!==jQuery("#wdi_feed_"+t).length&&((r=new WDIFeed(window["wdi_feed_"+t])).instagram=new WDIInstagram,r.instagram.filterArguments={feed:r},r.instagram.addToken(r.feed_row.access_token),wdi_front.access_token=r.feed_row.access_token,r.dataStorageRaw=[],r.dataStorage=[],r.dataStorageList=[],r.allResponseLength=0,r.currentResponseLength=0,r.temproraryUsersData=[],r.removedUsers=0,r.nowLoadingImages=!0,r.imageIndex=0,r.resIndex=0,r.currentPage=1,r.currentPageLoadMore=0,r.userSortFlags=[],r.customFilterChanged=!1,r.maxConditionalFiltersRequestCount=10,r.instagramRequestCounter=0,r.mediaRequestsDone=!1,r.conditionalFilterBuffer=[],r.stopInfiniteScrollFlag=!1,"masonry"==r.feed_row.feed_type&&(r.displayedData=[]),"pagination"==r.feed_row.feed_display_view?(r.feed_row.resort_after_load_more=0,"image_browser"!=r.feed_row.feed_type?(r.feed_row.load_more_number=parseInt(r.feed_row.pagination_per_page_number),r.feed_row.number_of_photos=(1+parseInt(r.feed_row.pagination_preload_number))*r.feed_row.load_more_number):(r.feed_row.number_of_photos=1+parseInt(r.feed_row.image_browser_preload_number),r.feed_row.load_more_number=parseInt(r.feed_row.image_browser_load_number)),r.freeSpaces=(Math.floor(r.feed_row.pagination_per_page_number/r.feed_row.number_of_columns)+1)*r.feed_row.number_of_columns-r.feed_row.pagination_per_page_number):r.freeSpaces=0,r.galleryBox=function(e){wdi_spider_createpopup(wdi_url.ajax_url+"?gallery_id="+this.feed_row.id+"&image_id="+e,this.feed_row.wdi_feed_counter,this.feed_row.lightbox_width,this.feed_row.lightbox_height,1,"testpopup",5,this,e)},wdi_responsive.columnControl(r),"masonry"==r.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(r),window["wdi_feed_"+t]=r,wdi_front.init(r))},wdi_front.init=function(e){if(jQuery(".wdi_js_error").hide(),e.photoCounter=e.feed_row.number_of_photos,"liked"==e.feed_row.liked_feed)e.feed_users=["self"];else{if(!wdi_front.isJsonString(e.feed_row.feed_users))return void wdi_front.show_alert(wdi_front_messages.invalid_users_format,!1,e);e.feed_users=JSON.parse(e.feed_row.feed_users)}var i=[],r=[],t=[];void 0!==window.wdi_all_tags&&(i=window.wdi_all_tags);for(var d=0;d<e.feed_users.length;d++)"#"===e.feed_users[d].username[0]&&void 0!==e.feed_users[d].tag_id?(i[e.feed_users[d].tag_id]=e.feed_users[d],t[d]=e.feed_users[d]):r[0]=e.feed_users[d];window.wdi_all_tags=i,e.feed_users=void 0===t||wdi_front.isEmpty(t)?r:t;var a=wdi_front.getFeedItemResolution(e);e.feedImageResolution=a.image,e.feedVideoResolution=a.video,e.dataCount=e.feed_users.length;for(var o=0;o<e.dataCount;o++)wdi_front.instagramRequest(o,e);0<e.feed_row.number_of_photos&&wdi_front.ajaxLoader(e),"1"===e.feed_row.display_header&&wdi_front.show("header",e),"1"===e.feed_row.show_usernames&&wdi_front.show("users",e)},wdi_front.getFeedItemResolution=function(e){var i={image:"standard_resolution",video:"standard_resolution"};if("thumbnail"===e.feed_row.feed_resolution)return{image:"thumbnail",video:"low_bandwidth"};if("low"===e.feed_row.feed_resolution)return{image:"low_resolution",video:"low_resolution"};if("standard"===e.feed_row.feed_resolution)return{image:"standard_resolution",video:"standard_resolution"};var r=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");r.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>'),wdi_responsive.columnControl(e,1);e=r.attr("wdi-res").split("wdi_col_");if(r.find("#wdi_feed_item_example").remove(),2!==e.length)return i;e=parseInt(e[1]);if(e<=0)return i;e=r.width()/e-10;return e<=150?(i.image="thumbnail",i.video="low_bandwidth"):150<e&&e<=320?(i.image="low_resolution",i.video="low_resolution"):(i.image="standard_resolution",i.video="standard_resolution"),i},wdi_front.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_front.instagramRequest=function(i,r){var t=this,e=r.feed_users;if("string"==typeof e[i]&&"self"===e[i])r.instagram.getRecentLikedMedia({success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,r),r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveSelfUserData(e,r)}});else if("hashtag"==this.getInputType(e[i].username)){if(this.isJsonString(r.feed_row.feed_users))for(var d in json_feed_users=JSON.parse(r.feed_row.feed_users),json_feed_users)"#"!==json_feed_users[d].username.charAt(0)&&(user=json_feed_users[d]);r.instagram.getTagRecentMedia(this.stripHashtag(e[i].username),{feed_id:r.feed_row.id,user_id:user.id,user_name:user.username,success:function(e){if(void 0!==e.error&&"undefined"!=e.error.type||void 0!==e.meta&&1==e.meta.error)return wdi_front.show_alert(!1,e,r),!1;r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}},null,r.feed_row.hashtag_top_recent,0)}else"user"==this.getInputType(e[i].username)&&r.instagram.getUserMedia({feed_id:r.feed_row.id,user_id:e[i].id,user_name:e[i].username,success:function(e){if(void 0!==e.meta&&1==typeof e.meta.error)return wdi_front.show_alert(!1,e,r),!1;r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}},"",0)},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,i,r){e.user_id=i.id,e.username=i.username,"#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),r.usersData.push(e),r.currentResponseLength=wdi_front.getArrayContentLength(r.usersData,"data"),r.allResponseLength+=r.currentResponseLength,r.dataCount==r.usersData.length&&(r.currentResponseLength<r.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(r)?wdi_front.loadMore("initial-keep",r):(wdi_front.displayFeed(r),wdi_front.applyFilters(r),wdi_front.activeUsersCount(r)||"load_more_btn"==r.feed_row.feed_display_view&&((r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.saveSelfUserData=function(e,i){e.user_id="",e.username="",i.usersData.push(e),i.currentResponseLength=wdi_front.getArrayContentLength(i.usersData,"data"),i.allResponseLength+=i.currentResponseLength,i.dataCount==i.usersData.length&&(i.currentResponseLength<i.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(i)?wdi_front.loadMore("initial-keep",i):(wdi_front.displayFeed(i),wdi_front.applyFilters(i),wdi_front.activeUsersCount(i)||"load_more_btn"==i.feed_row.feed_display_view&&((i=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.userHasNoPhoto=function(e,i){var r=0,t=e.usersData;void 0!==i&&(t=i);for(var d=0;d<t.length;d++)void 0===t[d].pagination&&(t[d].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===t[d].pagination.next_max_like_id&&r++:void 0===t[d].pagination.next_max_id&&r++;return r==t.length?1:0},wdi_front.appendRequestHashtag=function(e,i){for(var r=0;r<e.length;r++)e[r].wdi_hashtag=i;return e},wdi_front.displayFeed=function(e,i){var r,t;e.data.length>=e.allResponseLength?"load_more_btn"==e.feed_row.feed_display_view&&(r=e.feed_row.wdi_feed_counter,jQuery("#wdi_feed_"+r).find(".wdi_load_more").remove(),jQuery("#wdi_feed_"+r).find(".wdi_spinner").remove()):(0==e.customFilterChanged&&(t=wdi_front.feedSort(e,i)),i=e.customFilterChanged,1==e.customFilterChanged&&(t=e.customFilteredData,e.parsedData=wdi_front.parseLighboxData(e,!0)),"1"!=e.feed_row.resort_after_load_more?0==e.customFilterChanged&&(e.dataStorageList=e.dataStorageList.concat(t)):0==e.customFilterChanged&&(e.dataStorageList=t),"masonry"==e.feed_row.feed_type&&wdi_front.masonryDisplayFeedItems(t,e),"thumbnails"!=e.feed_row.feed_type&&"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||wdi_front.displayFeedItems(t,e),wdi_front.getDataLength(e)<parseInt(e.feed_row.number_of_photos)+parseInt(e.feed_row.load_more_number*e.currentPageLoadMore)&&!i&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(e)?wdi_front.loadMore("",e):(e.currentPageLoadMore++,wdi_front.allImagesLoaded(e)),e.instagramRequestCounter>e.maxConditionalFiltersRequestCount&&(wdi_front.allImagesLoaded(e),0==t.length&&(e.stopInfiniteScrollFlag=!0)),"pagination"==e.feed_row.feed_display_view&&e.currentPage<e.paginator&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled"),e.instagramRequestCounter=0,e.conditionalFilterBuffer=[],wdi_front.updateUsersImages(e))},wdi_front.updateUsersImages=function(i){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img").each(function(){if((jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||""==jQuery(this).attr("src"))&&"liked"!=i.feed_row.liked_feed)for(var e=0;e<i.usersData.length;e++)i.usersData[e].username==jQuery(this).parent().parent().find("h3").text()&&0!=i.usersData[e].data.length&&jQuery(this).attr("src",i.usersData[e].data[0].images.thumbnail.url)})},wdi_front.masonryDisplayFeedItems=function(e,i){var r=[],t=[];if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){1==i.feed_row.resort_after_load_more&&(jQuery(this).html(""),i.imageIndex=0),1==i.customFilterChanged&&(jQuery(this).html(""),i.imageIndex=0),"pagination"==i.feed_row.feed_display_view?r.push(0):r.push(jQuery(this).height()),t.push(jQuery(this))}),1==i.customFilterChanged&&(i.customFilterChanged=!1);for(var d,a,o,n=0;n<e.length;n++)"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(i.displayedData.push(e[n]),d="",void 0!==e[n].wdi_hashtag&&(d=e[n].wdi_hashtag),a="image"==e[n].type?wdi_front.getPhotoTemplate(i,d):e[n].hasOwnProperty("videos")||"video"==e[n].type?wdi_front.getVideoTemplate(i,d):wdi_front.getSliderTemplate(i,d),o=e[n],d=a(wdi_front.createObject(o,i)),a=wdi_front.array_min(r),o=wdi_front.getImageResolution(e[n]),t[a.index].html(t[a.index].html()+d),r[a.index]+=t[a.index].width()*o,i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++));i.wdi_loadedImages=0;var s=!1;i.wdi_load_count=n;var _=i.feed_row.wdi_feed_counter;jQuery("#wdi_feed_"+_+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,w(),!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});w(),1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}function w(){i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i))}},wdi_front.getImageResolution=function(e){var i=e.images.standard_resolution.width;return e.images.standard_resolution.height/i},wdi_front.getDataLength=function(e,i){var r=0;if(void 0===i)for(var t=0;t<e.dataStorage.length;t++)r+=e.dataStorage[t].length;else for(t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.getArrayContentLength=function(e,i){for(var r=0,t=0;t<e.length;t++)"finished"!=e[t].finished&&void 0===e[t].error&&(r+=e[t][i].length);return r},wdi_front.displayFeedItems=function(e,i){if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){var r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" .wdi_feed_wrapper");"1"===i.feed_row.resort_after_load_more&&(t.html(""),i.imageIndex=0),1==i.customFilterChanged&&(t.html(""),i.imageIndex=0,i.customFilterChanged=!1);var d;wdi_front.getImgCount(i),e.length;"pagination"==i.feed_row.feed_display_view&&(d=i.feed_row.load_more_number,"image_browser"==i.feed_row.feed_type&&(d=1),(jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+' [wdi_page="'+(i.currentPage-1)+'"]').length<d||0==e.length)&&(i.currentPage=--i.currentPage<=1?1:i.currentPage));for(var a,o,n,s=0;s<e.length;s++){if(void 0===e[s])return;"object"==typeof e[s].videos&&null==e[s].videos.standard_resolution||(n="",void 0!==e[s].wdi_hashtag&&(n=e[s].wdi_hashtag),a="image"==e[s].type?wdi_front.getPhotoTemplate(i,n):e[s].hasOwnProperty("videos")?wdi_front.getVideoTemplate(i,n):wdi_front.getSliderTemplate(i,n),o=e[s],n="",void 0!==(o=wdi_front.createObject(o,i))&&(n=a(o)),t.html(t.html()+n),i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((s+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++))}i.wdi_loadedImages=0;var _=!1;i.wdi_load_count=s;r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i)),!1===_&&(wdi_responsive.columnControl(i,1),_=!0)});1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}},wdi_front.checkFeedFinished=function(e){for(var i=0;i<e.usersData.length;i++)if(void 0===e.usersData[i].finished)return!1;return!0},wdi_front.sortingOperator=function(e,i){var r;switch(e){case"date":switch(i){case"asc":r=function(e,i){return e.created_time>i.created_time?1:-1};break;case"desc":r=function(e,i){return e.created_time>i.created_time?-1:1}}break;case"likes":switch(i){case"asc":r=function(e,i){return e.likes.count<i.likes.count?-1:1};break;case"desc":r=function(e,i){return e.likes.count<i.likes.count?1:-1}}break;case"comments":switch(i){case"asc":r=function(e,i){return e.comments.count<i.comments.count?-1:1};break;case"desc":r=function(e,i){return e.comments.count<i.comments.count?1:-1}}break;case"random":r=function(e,i){return.5<Math.random()?1:-1}}return r},wdi_front.feedSort=function(e,i){var r=e.feed_row.sort_images_by,t=e.feed_row.display_order;"1"===e.feed_row.resort_after_load_more?e.data=e.data.concat(wdi_front.smartPicker(e,i)):e.data=wdi_front.smartPicker(e,i);t=wdi_front.sortingOperator(r,t);return e.data.sort(t),e.data},wdi_front.smartPicker=function(e,i){var r=[],t=0,d=[],a=parseInt(e.feed_row.number_of_photos),o=Math.ceil(a/e.usersData.length),n=0;""!=i&&void 0!==i&&null!=i&&(a=parseInt(i),o=Math.ceil(a/wdi_front.activeUsersCount(e)));e.storeRawData(e.usersData,"dataStorageRaw");for(var s,_=e.dataStorageRaw.sort(function(e,i){return e.length()>i.length()?1:-1}),w=e.usersData.sort(function(e,i){return e.data.length>i.data.length?1:-1}),f=0;f<w.length;f++)n+=o,_[f].length()<=n?(n-=_[f].length(),r.push(_[f].getData(_[f].length())),t+=r[r.length-1].length):(a<t+n&&(n=a-t),(!(s=[])===e.auto_trigger||s.length+wdi_front.getDataLength(e)+wdi_front.getDataLength(e,r)<e.feed_row.number_of_photos)&&(s=s.concat(_[f].getData(n))),n=0,t+=s.length,r.push(s));for(f=0;f<r.length;f++)void 0===e.dataStorage[f]?e.dataStorage.push(r[f]):e.dataStorage[f]=e.dataStorage[f].concat(r[f]);for(e.parsedData=wdi_front.parseLighboxData(e),f=0;f<r.length;f++)d=d.concat(r[f]);return d},wdi_front.createObject=function(e,i){var r=null!=e.caption?e.caption.text:"&nbsp";switch(e.type){case"image":var t=e.images[i.feedImageResolution].url,d=void 0,a="image";break;case"video":t=void 0,d=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution].url:wdi_url.plugin_url+"images/video_missing.png",a="video";break;case"carousel":if(0===e.carousel_media.length)t=wdi_url.plugin_url+"images/missing.png",d=void 0,a="image";else switch(e.carousel_media[0].type){case"image":t=e.carousel_media[0].images[i.feedImageResolution].url,d=void 0,a="image";break;case"video":t=void 0,d=e.carousel_media[0].videos[i.feedVideoResolution].url,a="video";break;default:t=wdi_url.plugin_url+"images/missing.png",d=wdi_url.plugin_url+"images/video_missing.png",a="image"}break;default:t=wdi_url.plugin_url+"images/missing.png",d=wdi_url.plugin_url+"images/video_missing.png",a="image"}var o=i.imageIndex,n="square",s=e.images.standard_resolution.height,_=e.images.standard_resolution.width;_<s?n="portrait":s<_&&(n="landscape");_=e.user.username;return""===_&&(_="no_user"),{id:e.id,thumbType:a,caption:wdi_front.escape_tags(r),image_url:t,likes:e.likes.count,comments:e.comments.count,wdi_index:o,wdi_res_index:i.resIndex,wdi_media_user:_,link:e.link,video_url:d,wdi_username:_,wdi_shape:n}},wdi_front.setPage=function(e){var i=e.feed_row.feed_display_view,r=e.feed_row.feed_type;if("pagination"!=i)return"";i=e.imageIndex;return r="image_browser"==r?1:Math.abs(e.feed_row.pagination_per_page_number),e.paginator=Math.ceil((i+1)/r),e.paginator},wdi_front.getPhotoTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="",o="",n="tenweb-i-arrows-out",s="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(n=""),sourceAttr=(""!=r&&(d='wdi_page="'+r+'"'),"src"),""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":a="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":a="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",n="";break;case"custom_redirect":a="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",n="";break;case"none":o="wdi_cursor_off wdi_hover_off",n=a=""}d='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><img class=\"wdi_img\" "+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+o+'" >'+s+'<div class="wdi_thumb_icon" '+a+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+n+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(d+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(d+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(d+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),d+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(d+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),d+="</div>"),d+="</div>",_.template(d)},wdi_front.getSliderTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="",o="",n="tenweb-i-clone",s="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(n=""),sourceAttr=(""!=r&&(d='wdi_page="'+r+'"'),"src"),""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":a="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":a="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",n="tenweb-i-clone";break;case"custom_redirect":a="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",n="";break;case"none":o="wdi_cursor_off wdi_hover_off",n=a=""}d='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' wdi_type="slideshow" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><% if (thumbType === 'video') { %><video class=\"wdi_img\" "+sourceAttr+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video><% } else {%><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><% }%><div class="wdi_photo_overlay '+o+'" >'+s+'<div class="wdi_thumb_icon" '+a+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+n+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(d+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(d+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(d+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),d+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(d+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),d+="</div>"),d+="</div>",_.template(d)},wdi_front.replaceToVideo=function(e,i,r){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+e+"' type='video/mp4'>Your browser does not support the video tag. </video>",jQuery("#wdi_feed_"+r+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner').html(overlayHtml),jQuery("#wdi_feed_"+r+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner video').get(0).play()},wdi_front.getVideoTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="tenweb-i-play",o="",n="",s="",w=(""!=r&&(d='wdi_page="'+r+'"'),"src");""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":o="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":o="onclick=\"window.open ('<%= link%>','_blank')\"",n="wdi_hover_off",a="tenweb-i-play";break;case"custom_redirect":o="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",n="wdi_hover_off",a="";break;case"none":n="wdi_cursor_off wdi_hover_off",a="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",n="",a="tenweb-i-play")}w='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><video class=\"wdi_img\" "+w+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video><div class="wdi_photo_overlay '+n+'" '+o+">"+s+'<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+a+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(w+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(w+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(w+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),w+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(w+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),w+="</div>"),w+="</div>",_.template(w)},wdi_front.bindEvents=function(e){0!=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length&&("load_more_btn"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"))}),"pagination"==e.feed_row.feed_display_view&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorNext(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorPrev(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationLastPage(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationFirstPage(jQuery(this),e)}),e.paginatorNextFlag=!1),"infinite_scroll"==e.feed_row.feed_display_view&&(jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(e)}),e.infiniteScrollFlag=!1))},wdi_front.infiniteScroll=function(e){jQuery(window).scrollTop()+jQuery(window).height()-100>=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll").offset().top&&(!1===e.infiniteScrollFlag&&0==e.stopInfiniteScrollFlag?(e.infiniteScrollFlag=!0,wdi_front.loadMore(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),e)):e.stopInfiniteScrollFlag&&wdi_front.allImagesLoaded(e))},wdi_front.paginationFirstPage=function(e,i){var r;1!=i.paginator&&1!=i.currentPage&&(r=i.currentPage,i.currentPage=1,wdi_front.updatePagination(i,"custom",r),e.parent().find("#wdi_last_page").removeClass("wdi_disabled")),e.addClass("wdi_disabled")},wdi_front.paginationLastPage=function(e,i){var r;1!=i.paginator&&i.currentPage!=i.paginator&&(r=i.currentPage,i.currentPage=i.paginator,wdi_front.updatePagination(i,"custom",r),e.addClass("wdi_disabled"),e.parent().find("#wdi_first_page").removeClass("wdi_disabled"))},wdi_front.paginatorNext=function(e,i){var r,t=e.parent().find("#wdi_last_page"),d=e.parent().find("#wdi_first_page");i.paginatorNextFlag=!0,i.paginator!=i.currentPage||wdi_front.checkFeedFinished(i)?i.paginator>i.currentPage&&(i.currentPage++,wdi_front.updatePagination(i,"next"),i.paginator>i.currentPage?t.removeClass("wdi_disabled"):t.addClass("wdi_disabled")):(i.currentPage++,r=i.feed_row.number_of_photos,wdi_front.loadMore(e,i,r),t.addClass("wdi_disabled")),d.removeClass("wdi_disabled")},wdi_front.paginatorPrev=function(e,i){var r=e.parent().find("#wdi_last_page"),e=e.parent().find("#wdi_first_page");1!=i.currentPage?(i.currentPage--,wdi_front.updatePagination(i,"prev"),r.removeClass("wdi_disabled"),1==i.currentPage&&e.addClass("wdi_disabled")):e.addClass("wdi_disabled")},wdi_front.updatePagination=function(e,i,r){var t="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(t+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),i){case"next":var r=e.currentPage-1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":r=e.currentPage+1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(r=r)!=e.currentPage&&(jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(t+" .wdi_feed_wrapper").css("height","auto"),jQuery(t+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,i){var r,t=0;if(""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e&&(r=window[e.parent().parent().parent().parent().attr("id")]),void 0!==i&&(r=i),wdi_front.ajaxLoader(r),this.isJsonString(r.feed_row.feed_users))for(var d in json_feed_users=JSON.parse(r.feed_row.feed_users),json_feed_users)iuser=json_feed_users[d],"#"!==json_feed_users[d].username.charAt(0)&&(iuser=json_feed_users[d]);for(var a=0,o=0,d=0;d<r.userSortFlags.length;d++)if(!0===r.userSortFlags[d].flag){a++;for(var n=0;n<r.usersData.length;n++)r.userSortFlags[d].id===r.usersData[n].user_id&&"finished"===r.usersData[n].finished&&o++}if(a!==o||0==a){r.auto_trigger=!1,""===e&&(r.auto_trigger=!0),"masonry"===r.feed_row.feed_type&&"pagination"==r.feed_row.feed_display_view&&jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)});for(d=0;d<r.usersData.length;d++)"finished"===r.usersData[d].finished&&t++;t===r.usersData.length&&(wdi_front.allImagesLoaded(r),jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+" .wdi_load_more").remove());var s=r.usersData;r.loadMoreDataCount=r.feed_users.length;for(d=0;d<s.length;d++){s[d].pagination;var _=void 0!==s[d].tag_id?s[d].tag_id:"",w=void 0!==s[d].username&&_?s[d].username:"";s[d].user_id,s[d].username,iuser.id,iuser.username;"initial-keep"==e&&(r.temproraryUsersData[d]=r.usersData[d]),0<r.loadMoreDataCount&&r.loadMoreDataCount--,wdi_front.checkForLoadMoreDone(r,e)}}},wdi_front.loadMoreRequest=function(e,i,r,t){r.mediaRequestsDone&&""!=i&&r.usersData},wdi_front.checkForLoadMoreDone=function(e,i){var r,t=e.feed_row.load_more_number,d=e.feed_row.number_of_photos;0==e.loadMoreDataCount&&(e.temproraryUsersData=wdi_front.mergeData(e.temproraryUsersData,e.usersData),r=wdi_front.getArrayContentLength(e.temproraryUsersData,"data"),"initial-keep"==i&&(i="initial"),"initial"==i?r<d&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore("initial",e):(e.usersData=e.temproraryUsersData,wdi_front.displayFeed(e),wdi_front.applyFilters(e),e.temproraryUsersData=[]):r<t&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore(void 0,e):(e.usersData=e.temproraryUsersData,wdi_front.activeUsersCount(e)&&(wdi_front.displayFeed(e,t),wdi_front.applyFilters(e),e.temproraryUsersData=[])))},wdi_front.allDataHasFinished=function(e){for(var i=0,r=0;r<e.dataStorageRaw.length;r++)""==e.usersData[r].pagination.next_url&&(i++,e.usersData[r].finished="finished");return i==e.dataStorageRaw.length&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more").remove(),!0)},wdi_front.mergeData=function(e,i){for(var r=0;r<i.length;r++)void 0!==e[r]?"finished"!=i[r].finished&&(void 0===e[r].pagination.next_max_id&&void 0===e[r].pagination.next_max_like_id||(e[r].data=e[r].data.concat(i[r].data),e[r].pagination=i[r].pagination,e[r].user_id=i[r].user_id,e[r].username=i[r].username,e[r].meta=i[r].meta)):e.push(i[r]);return e},wdi_front.brokenImageHandler=function(e){return!0},wdi_front.ajaxLoader=function(e){var i,r=e.feed_row.wdi_feed_counter,r=jQuery("#wdi_feed_"+r);"load_more_btn"==e.feed_row.feed_display_view&&(r.find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").removeClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&(0==r.find(".wdi_ajax_loading").length?(i=jQuery('<div class="wdi_ajax_loading"><div><div><img class="wdi_load_more_spinner" src="'+wdi_url.plugin_url+'images/ajax_loader.png"></div></div></div>'),r.append(i)):i=r.find(".wdi_ajax_loading"),i.removeClass("wdi_hidden"))},wdi_front.allImagesLoaded=function(e){var i=wdi_front.getDataLength(e);e.mediaRequestsDone||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia"),0!=i||!e.mediaRequestsDone||0!=e.feed_row.conditional_filters.length&&0!=e.feed_row.conditional_filter_enable||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>");i=e.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+i);"load_more_btn"==e.feed_row.feed_display_view&&(i.find(".wdi_load_more").removeClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")},wdi_front.show=function(e,i){var r,t,d=i.feed_row.wdi_feed_counter,a=jQuery("#wdi_feed_"+d+" .wdi_feed_container");"header"===e&&(r={feed_thumb:i.feed_row.feed_thumb,feed_name:i.feed_row.feed_name},t=wdi_front.getHeaderTemplate()(r),r=a.find(".wdi_feed_header").html(),a.find(".wdi_feed_header").html(r+t))},wdi_front.getUserTemplate=function(e,i){var r=e.dataCount,t="#"===i[0]?"//instagram.com/explore/tags/"+i.substr(1,i.length):"//instagram.com/"+i,d="onclick='"+('window.open("'+t+'","_blank")')+"'",t='<div class="wdi_single_user" user_index="<%=user_index%>"><div class="wdi_header_user_text <%=hashtagClass%>"><div class="wdi_user_img_wrap"><img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';return 1<r&&(t+='<div title="'+wdi_front_messages.filter_title+'" class="wdi_filter_overlay"><div class="wdi_filter_icon"><span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="tenweb-i tenweb-i-filter"></span></div></div>'),t+="</div>",t+="<h3 "+d+"><%= user_name%></h3>","#"!==i[0]?("1"==e.feed_row.follow_on_instagram_btn&&(t+='<div class="wdi_user_controls"><div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> '+wdi_front_messages.follow+"</span></div></div>"),t+='<div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="tenweb-i tenweb-i-user"></span><%= counts.followed_by%></p></div>'):t+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>',t+='<div class="wdi_clear"></div>',1==r&&"#"!==i[0]&&"1"==e.feed_row.display_user_info&&(t+='<div class="wdi_bio"><%= bio%></div>',t+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'),t+="</div></div>",_.template(t)},wdi_front.getHeaderTemplate=function(){return _.template('<div class="wdi_header_wrapper"><div class="wdi_header_img_wrap"><img src="<%=feed_thumb%>"></div><div class="wdi_header_text"><%=feed_name%></div><div class="wdi_clear"></div>')},wdi_front.addFilter=function(e,i){var r=window["wdi_feed_"+i],i=r.dataCount;if(!(i<2)&&0==r.nowLoadingImages){i=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');i.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg"),i.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col"),i.find(".wdi_media_info").toggleClass("wdi_filter_active_col"),i.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col"),r.customFilterChanged=!0,0==r.userSortFlags[e].flag?r.userSortFlags[e].flag=!0:r.userSortFlags[e].flag=!1;for(var t=0,d=0;d<r.userSortFlags.length;d++)1==r.userSortFlags[d].flag&&t++;"pagination"==r.feed_row.feed_display_view&&(r.resIndex=0),0!=t?wdi_front.filterData(r):r.customFilteredData=r.dataStorageList,wdi_front.displayFeed(r),"pagination"==r.feed_row.feed_display_view&&(r.paginator=Math.ceil(r.imageIndex/parseInt(r.feed_row.pagination_per_page_number)),r.currentPage=r.paginator,wdi_front.updatePagination(r,"custom",1),jQuery("#wdi_first_page").removeClass("wdi_disabled"),jQuery("#wdi_last_page").addClass("wdi_disabled"))}},wdi_front.filterData=function(e){var i=e.userSortFlags;e.customFilteredData=[];for(var r=0;r<e.dataStorageList.length;r++)for(var t=0;t<i.length;t++)(void 0!==e.dataStorageList[r].user.id&&e.dataStorageList[r].user.id==i[t].id||e.dataStorageList[r].wdi_hashtag==i[t].name)&&1==i[t].flag&&e.customFilteredData.push(e.dataStorageList[r])},wdi_front.applyFilters=function(e){for(var i=0;i<e.userSortFlags.length;i++)1==e.userSortFlags[i].flag&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+'[user_index="'+i+'"]'),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter))},wdi_front.getImgCount=function(e){for(var i=e.dataStorage,r=0,t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.parseLighboxData=function(e,i){var r,t,d,a=e.dataStorage,o=e.feed_row.sort_images_by,n=e.feed_row.display_order,n=wdi_front.sortingOperator(o,n),s=[],_=[];if(1==i)s=e.customFilteredData;else{for(var w=0;w<a.length;w++)for(var f=0;f<a[w].length;f++)s.push(a[w][f]);s.sort(n)}for(w=0;w<s.length;w++)void 0!==s[w]&&(t=void 0!==s[w]&&void 0!==s[w].media_url?s[w].media_url:wdi_url.plugin_url+"images/video_missing.png",void 0!==s[w]&&void 0===s[w].media_url&&"carousel"===s[w].type&&(void 0!==(d=s[w].carousel_media[0])&&void 0!==d.images?t=d.images.standard_resolution.url:void 0!==d&&void 0!==d.videos&&(t=d.videos.standard_resolution.url)),void(d=0)!==s[w]&&void 0!==s[w].comments&&(d=s[w].comments.count),r={alt:"",avg_rating:"",comment_count:d,date:wdi_front.convertUnixDate(s[w].created_time),description:wdi_front.getDescription(void 0!==s[w].caption&&null!==s[w].caption?wdi_front.escape_tags(s[w].caption.text):""),filename:wdi_front.getFileName(s[w]),filetype:wdi_front.getFileType(s[w]),hit_count:"0",id:s[w].id,image_url:s[w].link,number:0,rate:"",rate_count:"0",username:void 0!==s[w].user?s[w].user.username:"",profile_picture:void 0!==s[w].user?s[w].user.profile_picture:"",thumb_url:t,comments_data:void 0!==s[w].comments?s[w].comments.data:"",images:s[w].images,carousel_media:void 0!==s[w].carousel_media?s[w].carousel_media:null},_.push(r));return _},wdi_front.convertUnixDate=function(e){var i=new Date(e).getTime()/1e3,e=new Date(0);e.setUTCSeconds(i);i=e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate();return i+=" "+e.getHours()+":"+e.getMinutes()},wdi_front.getDescription=function(e){return e=e.replace(/\r?\n|\r/g," ")},wdi_front.getFileName=function(e){if(void 0!==e){var i=e.link;if("video"===e.type&&e.hasOwnProperty("videos")&&null!=e.videos.standard_resolution)return e.videos.standard_resolution.url;if(void 0===i)return"";i=i.split("/");return i[i.length-2]}},wdi_front.getFileType=function(e){return"video"==e.type&&e.hasOwnProperty("videos")?"EMBED_OEMBED_INSTAGRAM_VIDEO":"carousel"==e.type&&e.hasOwnProperty("carousel_media")?"EMBED_OEMBED_INSTAGRAM_CAROUSEL":"EMBED_OEMBED_INSTAGRAM_IMAGE"},wdi_front.array_max=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i<e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.array_min=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i>e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.activeUsersCount=function(e){for(var i=0,r=0;r<e.usersData.length;r++)"finished"!=e.usersData[r].finished&&i++;return i},wdi_front.checkMediaResponse=function(e,i){return""==e||void 0===e||null==e||void 0!==e.error?(errorMessage=wdi_front_messages.connection_error,wdi_front.show_alert(errorMessage,e,i),!1):""!=e&&void 0!==e&&null!=e&&void 0!==e.meta&&200!=e.meta.code?(errorMessage=e.meta.error_message,wdi_front.show_alert(errorMessage,e,i),!1):e},wdi_front.stripHashtag=function(e){return"#"!==e[0]?e:e.substr(1,e.length)},wdi_front.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_front.regexpTestCaption=function(e,i){var r=!1,t=!1,d=i.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),i=new RegExp("(?:^|\\s)"+d+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+d,"g");for(null!=i.exec(e)&&(r=!0);null!=(match=a.exec(e));)t=!0;return 1==r||1==t},wdi_front.replaceNewLines=function(e){var i,r="vUkCJvN2ps3t",t=[];for(e=e.replace(/\r?\n|\r/g,r),i=new RegExp(r,"g");null!=(match=i.exec(e));)t.push(match.index);for(var d=e.split(r),a=0,o=0;o<d.length;o++)""==d[o]?a++:a=0,0<a&&(d.splice(o,1),a--,o--);return e=d.join(" ")},wdi_front.isEmptyObject=function(e){for(var i in e)if(e.hasOwnProperty(i))return!1;return!0},wdi_front.isEmpty=function(e){return!e||0===e.length};var WDIFeed=function(e){this.data=e.data,this.dataCount=e.dataCount,this.feed_row=e.feed_row,this.usersData=e.usersData,(_this=this).set_images_loading_flag=function(e){window.addEventListener("load",function(){e.nowLoadingImages=!1})},this.set_images_loading_flag(_this)};function wdi_extractHostname(e){return void 0===e||""===e?"":e.replace(/(^\w+:|^)\/\//,"")}WDIFeed.prototype.mediaExists=function(e,i){for(var r=0;r<i.length;r++)if(e.id==i[r].id)return!0;return!1},WDIFeed.prototype.getIdFromUrl=function(e){for(var i=e.split("/"),r=!1,t=0;t<i.length;t++)if("p"==i[t]&&void 0!==i[t+1]){r=i[t+1];break}return r},WDIFeed.prototype.avoidDuplicateMedia=function(e){var i=e.data,r=[];void 0===i&&(i=[]);for(var t=0;t<i.length;t++)this.mediaExists(i[t],this.dataStorageList)||this.mediaExists(i[t],r)||this.mediaExists(i[t],this.conditionalFilterBuffer)||r.push(i[t]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(r),{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,i){var t=this;if("object"==typeof this[i]&&"number"==typeof this[i].length)for(var r=0;r<e.length;r++){var d="";wdi_front.isHashtag(e[r].user_id)?void 0!==e[r].pagination.cursors&&(d=e[r].pagination.cursors.after):"liked"==t.feed_row.liked_feed?void 0===(d=e[r].pagination.next_max_like_id)&&(d=""):(null==e[r].pagination&&(e[r].pagination=[]),void 0===(d=e[r].pagination.next_max_id)&&(d="")),void 0===this[i][r]?this[i].push({data:e[r].data,index:0,locked:!1,hash_id:d,usersDataFinished:!1,userId:e[r].user_id,length:function(){return this.data.length-this.index},getData:function(e){var i=this.data.slice(this.index,this.index+e);if(this.index+=Math.min(e,this.length()),this.index==this.data.length&&1==this.locked&&0==this.usersDataFinished)for(var r=0;r<t.usersData.length;r++)if(t.usersData[r].user_id==this.userId){this.usersDataFinished=!0;break}return i}}):0==this[i][r].locked&&(d!=this[i][r].hash_id?(this[i][r].data=this[i][r].data.concat(e[r].data),this[i][r].hash_id=d):this[i][r].locked=!0)}},wdi_front.updateUsersIfNecessary=function(o){for(var n=o.feed_users,e=!1,i=0;i<n.length;i++)"#"!=n[i].username.substr(0,1)?""!=n[i].id&&"username"!=n[i].id||(e=!0,o.instagram.searchForUsersByName(n[i].username,{success:function(e){if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,o),200==e.meta.code&&0<e.data.length){for(var i=!1,r=0;r<e.data.length;r++)if(e.data[r].username==e.args.username){i=!0;break}if(i)for(var t=0;t<n.length;t++)e.data[r].username==n[t].username&&(n[t].id=e.data[r].id)}for(var d=!1,a=0;a<n.length;a++)if(""==n[a].id||"username"==n[a].id){d=!0;break}d||(o.feed_row.feed_users=JSON.stringify(n),wdi_front.init(o))},username:n[i].username})):n[i].id=n[i].username;return e},void 0!==wdi_ajax.ajax_response?jQuery(document).one("ajaxStop",function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}):jQuery(document).ready(function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}),jQuery(document).ready(function(){setTimeout(function(){"1"===wdi_front_messages.show_alerts&&"I"!==jQuery(".wdi_check_fontawesome .tenweb-i-instagram").prop("tagName")&&console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")},2e3)});
js/wdi_instagram.js CHANGED
@@ -162,10 +162,6 @@ function WDIInstagram(args) {
162
  }
163
 
164
 
165
- /* counter for break cycle */
166
- var errorItercount = 0;
167
- var filterResponse = {data:new Array(), paging:{}} ;
168
-
169
  /**
170
  * Gets recent media based on tagname
171
  *
@@ -195,8 +191,7 @@ function WDIInstagram(args) {
195
  *
196
  * @return object of founded media
197
  */
198
- this.getTagRecentMedia = function ( tagname, args, next_url, endpoint, iter ) {
199
- iter = (iter === undefined || typeof iter !== 'number') ? 0 : iter;
200
  var instagram = this,
201
  noArgument = false,
202
  successFlag = false,
@@ -256,7 +251,6 @@ function WDIInstagram(args) {
256
  tagname: tagname,
257
  wdiTagId: wdiTagId,
258
  endpoint: endpoint,
259
- iter: iter
260
  },
261
  success: function ( response ) {
262
  var error = false;
@@ -265,45 +259,36 @@ function WDIInstagram(args) {
265
  error = true;
266
  error_type = response.error.type;
267
  }
268
- if ( typeof response.error !== 'undefined' && response.error.type === 'HashtagNotFound' ) {
269
- errorItercount = 5;
270
- success(response);
271
- }
272
- else if ( typeof response.error !== 'undefined' && response.error.type !== 'OAuthException' && errorItercount < 5 ) {
273
- /* counter for break cycle */
274
- errorItercount++;
275
- _this.getTagRecentMedia(tagname, args, next_url, endpoint, iter)
276
- }
277
- else if ( typeof response.response !== 'undefined' && typeof response.response.iter !== 'undefined' && filterResponse.data.length < parseInt(wdi_ajax.number_of_photos) && iter < 10 && typeof response.response.paging !== 'undefined' && response.response.paging.next != '' ) {
278
- next_url = response.response.paging.next;
279
- filterResponse.data = filterResponse.data.concat(response.response.data);
280
- filterResponse.paging = response.response.paging;
281
- _this.getTagRecentMedia(tagname, args, next_url, endpoint, response.response.iter)
282
- }
283
- else {
284
- if ( filterResponse.data.length != 0 ) {
285
- response.response = filterResponse;
286
- }
287
- if ( wdiTagId === false ) {
288
- wdiTagId = "";
289
- }
290
- if ( typeof response.tag_data !== "undefined" ) {
291
- var tag_data = response.tag_data;
292
- if ( typeof tag_data.tag_id !== "undefined" ) {
293
- wdiTagId = tag_data.tag_id;
294
- }
295
- var all_tags = [];
296
- if ( typeof window['wdi_all_tags'] !== "undefined" ) {
297
- all_tags = window['wdi_all_tags'];
298
- }
299
- all_tags[tag_data.tag_id] = tag_data;
300
- window['wdi_all_tags'] = all_tags;
301
  }
302
- response = response.response;
303
- response = _this.convertHashtagData(response);
304
- response.meta = { 'code': 200, 'error': error, 'error_type': error_type };
305
- response.tag_id = wdiTagId;
306
- success(response)
307
  }
308
  },
309
  error: function ( response ) {
@@ -354,6 +339,9 @@ function WDIInstagram(args) {
354
  var feed_users = [];
355
  if ( typeof wdi_controller !== 'undefined' ) {
356
  feed_users = wdi_controller.feed_users;
 
 
 
357
  if (feed_users.length === 0) {
358
  var json = jQuery('#WDI_feed_users').val();
359
  if (typeof json !== 'undefined' && json !== '' ) {
@@ -377,183 +365,6 @@ function WDIInstagram(args) {
377
  return false;
378
  };
379
 
380
- this.convertHashtagData = function ( data ) {
381
- var converted_data = {
382
- data: [],
383
- pagination: {}
384
- };
385
- if ( typeof data !== 'undefined' ) {
386
- if ( typeof data.paging !== "undefined" ) {
387
- converted_data.pagination = {
388
- cursors: { after: data.paging.cursors.after },
389
- next_url: data.paging.next
390
- }
391
- }
392
- }
393
- if ( typeof data != 'undefined' && typeof data.data != 'undefined' ) {
394
- for ( var i in data.data ) {
395
- var media = data.data[i];
396
- var media_type;
397
- if ( media.media_type === "IMAGE" ) {
398
- media_type = "image";
399
- }
400
- else if ( media.media_type === "VIDEO" ) {
401
- media_type = "video";
402
- }
403
- else {
404
- media_type = "carousel";
405
- }
406
- var converted = {
407
- "id": media.id,
408
- "user": {
409
- "id": "",
410
- "full_name": "",
411
- "profile_picture": "",
412
- "username": ""
413
- },
414
- "images": {
415
- "thumbnail": {
416
- "width": 150,
417
- "height": 150,
418
- "url": media.media_url
419
- },
420
- "low_resolution": {
421
- "width": 320,
422
- "height": 320,
423
- "url": media.media_url
424
- },
425
- "standard_resolution": {
426
- "width": 1080,
427
- "height": 1080,
428
- "url": media.media_url
429
- }
430
- },
431
- "created_time": media.timestamp,
432
- "caption": {
433
- "id": "",
434
- "text": media.caption,
435
- "created_time": "",
436
- "from": {
437
- "id": "",
438
- "full_name": "",
439
- "profile_picture": "",
440
- "username": ""
441
- }
442
- },
443
- "user_has_liked": (media.like_count > 0),
444
- "likes": {
445
- "count": media.like_count
446
- },
447
- "tags": [],
448
- "filter": "Normal",
449
- "comments": {
450
- "count": media.comments_count
451
- },
452
- "type": media_type,
453
- "link": media.permalink,
454
- "location": null,
455
- "attribution": null,
456
- "users_in_photo": []
457
- };
458
- if ( media.media_type === "IMAGE" || media.media_type === "CAROUSEL_ALBUM" ) {
459
- converted.images = {
460
- "thumbnail": {
461
- "width": 150,
462
- "height": 150,
463
- "url": media.media_url
464
- },
465
- "low_resolution": {
466
- "width": 320,
467
- "height": 320,
468
- "url": media.media_url
469
- },
470
- "standard_resolution": {
471
- "width": 1080,
472
- "height": 1080,
473
- "url": media.media_url
474
- }
475
- };
476
- }
477
- else if ( media.media_type === "VIDEO" ) {
478
- converted.videos = {
479
- "standard_resolution": {
480
- "width": 640,
481
- "height": 800,
482
- "url": media.media_url,
483
- },
484
- "low_bandwidth": {
485
- "width": 480,
486
- "height": 600,
487
- "url": media.media_url,
488
- },
489
- "low_resolution": {
490
- "width": 480,
491
- "height": 600,
492
- "url": media.media_url,
493
- }
494
- };
495
- }
496
- if ( media.media_type === "CAROUSEL_ALBUM" ) {
497
- converted.carousel_media = [];
498
- for ( var j in media.children.data ) {
499
- if ( media.children.data[j].media_type === "IMAGE" ) {
500
- var child = {
501
- "images": {
502
- "thumbnail": {
503
- "width": 150,
504
- "height": 150,
505
- "url": media.children.data[j].media_url
506
- },
507
- "low_resolution": {
508
- "width": 320,
509
- "height": 320,
510
- "url": media.children.data[j].media_url
511
- },
512
- "standard_resolution": {
513
- "width": 640,
514
- "height": 640,
515
- "url": media.children.data[j].media_url
516
- }
517
- },
518
- "users_in_photo": [],
519
- "type": "image"
520
- };
521
- }
522
- else {
523
- var child = {
524
- "videos": {
525
- "standard_resolution": {
526
- "width": 640,
527
- "height": 800,
528
- "url": media.children.data[j].media_url,
529
- "id": media.children.data[j].id
530
- },
531
- "low_bandwidth": {
532
- "width": 480,
533
- "height": 600,
534
- "url": media.children.data[j].media_url,
535
- "id": media.children.data[j].id
536
- },
537
- "low_resolution": {
538
- "width": 480,
539
- "height": 600,
540
- "url": media.children.data[j].media_url,
541
- "id": media.children.data[j].id
542
- }
543
- },
544
- "users_in_photo": [],
545
- "type": "video"
546
- };
547
- }
548
- converted.carousel_media.push(child);
549
- }
550
- }
551
- converted_data.data.push(converted);
552
- }
553
- }
554
- return converted_data;
555
- };
556
-
557
  /**
558
  * Search for tags by name.
559
  *
@@ -1063,9 +874,8 @@ function WDIInstagram(args) {
1063
  * @return object of founded media
1064
  */
1065
 
1066
- this.getUserMedia = function (args, next_url, iter) {
1067
  next_url = (next_url === undefined) ? '' : next_url;
1068
- iter = (iter === undefined || typeof iter !== 'number') ? 0 : iter;
1069
  var instagram = this,
1070
  noArgument = false,
1071
  successFlag = false,
@@ -1123,7 +933,6 @@ function WDIInstagram(args) {
1123
  user_name: user_name,
1124
  feed_id: feed_id,
1125
  next_url: next_url,
1126
- iter:iter,
1127
  },
1128
  success: function (response) {
1129
  var error = false;
@@ -1133,49 +942,41 @@ function WDIInstagram(args) {
1133
  error_type = response.error.type;
1134
  }
1135
 
1136
- if ( typeof response.error !== 'undefined' && response.error.type !== "OAuthException" && errorItercount < 5) {
1137
- errorItercount++;
1138
- _this.getUserMedia(args, next_url, response.iter);
1139
- return;
1140
- }
1141
-
1142
- if( typeof response.iter !== 'undefined' && filterResponse.data.length < parseInt(wdi_ajax.number_of_photos) && iter < 20 && response.pagination.next_url != '') {
1143
- next_url = response.pagination.next_url;
1144
- filterResponse.data = filterResponse.data.concat(response.data);
1145
- filterResponse.pagination = response.pagination;
1146
- _this.getUserMedia( args, next_url, response.iter)
1147
- }
1148
- else {
1149
- if(filterResponse.data.length != 0) {
1150
- response.data = filterResponse.data;
1151
- }
1152
- response.meta = {'code': 200, 'error': error, 'error_type': error_type};
1153
-
1154
- if (successFlag) {
1155
- if (typeof args.success == 'object' && args.success.length == 2) {
1156
- if (typeof window[args.success[0]] != 'undefined') {
1157
- if (typeof window[args.success[0]][args.success[1]] == 'function') {
1158
  if (filter) {
1159
  response = _this.addTags(response);
1160
  response = filter(response, instagram.filterArguments, args);
1161
  }
1162
- window[args.success[0]][args.success[1]](response);
1163
  }
1164
  }
1165
- }
1166
- else if (typeof args.success == 'string') {
1167
- if (typeof window[args.success] == 'function') {
1168
- if (filter) {
1169
- response = _this.addTags(response);
1170
- response = filter(response, instagram.filterArguments, args);
1171
- }
1172
- window[args.success](response);
1173
  }
1174
  }
1175
- else if (typeof args.success == 'function') {
1176
- args.success(response);
1177
- }
1178
  }
 
1179
  }
1180
  },
1181
  error: function (response)
@@ -1200,6 +1001,131 @@ function WDIInstagram(args) {
1200
  });
1201
  }
1202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1203
  /* deprecated API */
1204
  /**
1205
  * Get information about a user.
162
  }
163
 
164
 
 
 
 
 
165
  /**
166
  * Gets recent media based on tagname
167
  *
191
  *
192
  * @return object of founded media
193
  */
194
+ this.getTagRecentMedia = function ( tagname, args, next_url, endpoint, after_cache ) {
 
195
  var instagram = this,
196
  noArgument = false,
197
  successFlag = false,
251
  tagname: tagname,
252
  wdiTagId: wdiTagId,
253
  endpoint: endpoint,
 
254
  },
255
  success: function ( response ) {
256
  var error = false;
259
  error = true;
260
  error_type = response.error.type;
261
  }
262
+
263
+ if( typeof response['data'] === 'undefined' || (typeof response['data'] !== 'undefined' && response['data'].length === 0 && after_cache === 0)) {
264
+ _this.set_cache_data('', user_name, feed_id, '', 0, 1, tagname, wdiTagId, endpoint, args);
265
+ } else {
266
+ if ( response.data.length === 0 ) {
267
+ response.meta = {'code': 400, 'error': error, 'error_type': error_type};
268
+ response.tag_id = wdiTagId;
269
+ success(response)
270
+ } else {
271
+ if (wdiTagId === false) {
272
+ wdiTagId = "";
273
+ }
274
+ if (typeof response.tag_data !== "undefined") {
275
+ var tag_data = response.tag_data;
276
+ if (typeof tag_data.tag_id !== "undefined") {
277
+ wdiTagId = tag_data.tag_id;
278
+ }
279
+ var all_tags = [];
280
+ if (typeof window['wdi_all_tags'] !== "undefined") {
281
+ all_tags = window['wdi_all_tags'];
282
+ }
283
+ all_tags[tag_data.tag_id] = tag_data;
284
+ window['wdi_all_tags'] = all_tags;
285
+ }
286
+ //response = response.response;
287
+ //response = _this.convertHashtagData(response);
288
+ response.meta = {'code': 200, 'error': error, 'error_type': error_type};
289
+ response.tag_id = wdiTagId;
290
+ success(response)
 
 
 
 
291
  }
 
 
 
 
 
292
  }
293
  },
294
  error: function ( response ) {
339
  var feed_users = [];
340
  if ( typeof wdi_controller !== 'undefined' ) {
341
  feed_users = wdi_controller.feed_users;
342
+ if( typeof feed_users === 'undefined' ) {
343
+ return false;
344
+ }
345
  if (feed_users.length === 0) {
346
  var json = jQuery('#WDI_feed_users').val();
347
  if (typeof json !== 'undefined' && json !== '' ) {
365
  return false;
366
  };
367
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368
  /**
369
  * Search for tags by name.
370
  *
874
  * @return object of founded media
875
  */
876
 
877
+ this.getUserMedia = function (args, next_url, after_cache) {
878
  next_url = (next_url === undefined) ? '' : next_url;
 
879
  var instagram = this,
880
  noArgument = false,
881
  successFlag = false,
933
  user_name: user_name,
934
  feed_id: feed_id,
935
  next_url: next_url,
 
936
  },
937
  success: function (response) {
938
  var error = false;
942
  error_type = response.error.type;
943
  }
944
 
945
+ if( typeof response['data'] === 'undefined' || (typeof response['data'] !== 'undefined' && response['data'].length === 0 && after_cache === 0)) {
946
+ _this.set_cache_data('', user_name, feed_id,'', 0, 1, '', '', '', args);
947
+ } else {
948
+ if( response['data'].length !== 0 ) {
949
+ response.meta = {'code': 200, 'error': error, 'error_type': error_type};
950
+ if (successFlag) {
951
+ if (typeof args.success == 'object' && args.success.length == 2) {
952
+ if (typeof window[args.success[0]] != 'undefined') {
953
+ if (typeof window[args.success[0]][args.success[1]] == 'function') {
954
+ if (filter) {
955
+ response = _this.addTags(response);
956
+ response = filter(response, instagram.filterArguments, args);
957
+ }
958
+ window[args.success[0]][args.success[1]](response);
959
+ }
960
+ }
961
+ }
962
+ else if (typeof args.success == 'string') {
963
+ if (typeof window[args.success] == 'function') {
 
 
 
964
  if (filter) {
965
  response = _this.addTags(response);
966
  response = filter(response, instagram.filterArguments, args);
967
  }
968
+ window[args.success](response);
969
  }
970
  }
971
+ else if (typeof args.success == 'function') {
972
+ args.success(response);
 
 
 
 
 
 
973
  }
974
  }
975
+ } else {
976
+ response.meta = {'code': 400, 'error': error, 'error_type': error_type};
977
+ args.success(response);
978
  }
979
+
980
  }
981
  },
982
  error: function (response)
1001
  });
1002
  }
1003
 
1004
+ /**
1005
+ * Set the medias to cache.
1006
+ *
1007
+ *
1008
+ * @param comlete_redirect_url string redirect url which called after update and cache processes finished
1009
+ * @param user_name string instagram username for current feed
1010
+ * @param feed_id integer
1011
+ * @param next_url string
1012
+ * @param iter integer
1013
+ * @param frontend integer using to understand if the function called from backend or frontend ( 1-frontend, 0-backend)
1014
+ * @param tagname string hashtag name
1015
+ * @param tag_id integer id of hashtag
1016
+ * @param endpoint string (0-is top_media, 1-is recent_media)
1017
+ * @param args = {
1018
+ * success : 'success_callback',
1019
+ * error : 'error_callback',
1020
+ * count : 'media_count',
1021
+ * min_id : 'min_id'
1022
+ * max_id : 'max_id'
1023
+ * statusCode : statusCode
1024
+ *
1025
+ * }
1026
+ *
1027
+ */
1028
+ this.set_cache_data = function ( comlete_redirect_url , user_name, feed_id, next_url, iter, frontend, tagname, tag_id, endpoint, args ) {
1029
+ /* Check if call is frontend 0-backend, 1-frontend */
1030
+ if( frontend === 0 ) {
1031
+ if (user_name === '') {
1032
+ user_name = jQuery("#WDI_user_name").val();
1033
+ }
1034
+
1035
+ if ( feed_id === 0 ) {
1036
+ feed_id = jQuery("#wdi_add_or_edit").val();
1037
+ }
1038
+ if ( endpoint === '' && jQuery("#wdi_feed_users_ajax .wdi_user").length !== 0 ) {
1039
+ endpoint = jQuery("#WDI_wrap_hashtag_top_recent input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val();
1040
+ }
1041
+ if ( endpoint === '0' ) {
1042
+ endpoint = 'top_media'
1043
+ }
1044
+ else {
1045
+ endpoint = 'recent_media'
1046
+ }
1047
+
1048
+ if( tag_id === '' && typeof users !== 'undefined' ) {
1049
+ var tag_obj = JSON.parse(users);
1050
+ tag_id = tag_obj[0]['tag_id'];
1051
+ }
1052
+ if( tag_id === '' ) {
1053
+ tag_id = 'false';
1054
+ }
1055
+ } else {
1056
+ tag_id = this.getTagId(tagname);
1057
+ if (user_name === '') {
1058
+ user_name = jQuery("#WDI_user_name").val();
1059
+ }
1060
+ if ( feed_id === 0 ) {
1061
+ feed_id = wdi_ajax.feed_id;
1062
+ }
1063
+ }
1064
+
1065
+ var wdi_cache_request_count = 10;
1066
+ if( typeof wdi_ajax.wdi_cache_request_count != 'undefined' && wdi_ajax.wdi_cache_request_count !== "" ) {
1067
+ wdi_cache_request_count = parseInt(wdi_ajax.wdi_cache_request_count);
1068
+ }
1069
+
1070
+ jQuery.ajax({
1071
+ type: "POST",
1072
+ url: wdi_ajax.ajax_url,
1073
+ dataType: 'json',
1074
+ async : false,
1075
+ data: {
1076
+ action: 'wdi_set_preload_cache_data',
1077
+ tag_id: tag_id,
1078
+ tagname: tagname,
1079
+ user_name : user_name,
1080
+ feed_id : feed_id,
1081
+ endpoint : endpoint,
1082
+ wdi_nonce: wdi_ajax.wdi_nonce,
1083
+ next_url : next_url,
1084
+ iter : iter,
1085
+ },
1086
+ success: function ( response ) {
1087
+ if( response['next_url'] != '' ) {
1088
+ response['iter']++;
1089
+
1090
+ if( response['iter'] > wdi_cache_request_count ) {
1091
+ if( frontend === 1 ) {
1092
+ if( tag_id === 'false' ) {
1093
+ _this.getTagRecentMedia( tagname, args, next_url, endpoint, 1);
1094
+ } else {
1095
+ _this.getUserMedia(args, response['next_url'], 1);
1096
+ }
1097
+ } else {
1098
+ jQuery("#wdi_save_loading").addClass("wdi_hidden");
1099
+ window.location = comlete_redirect_url;
1100
+ }
1101
+ } else {
1102
+ /* Recall function for next iteration */
1103
+ _this.set_cache_data(comlete_redirect_url, user_name, feed_id, response['next_url'], response['iter'], frontend, tagname, tag_id, endpoint, args);
1104
+ }
1105
+ } else {
1106
+ if( frontend === 1 ) {
1107
+ if(tag_id === 'false') {
1108
+ _this.getTagRecentMedia( tagname, args, next_url, endpoint, 1);
1109
+ } else {
1110
+ _this.getUserMedia(args, response['next_url'], 1);
1111
+ }
1112
+ } else {
1113
+ jQuery("#wdi_save_loading").addClass("wdi_hidden");
1114
+ jQuery("#wdi_save_loading .caching-process-message").addClass("wdi_hidden");
1115
+ if( comlete_redirect_url !== '' ) {
1116
+ window.location = comlete_redirect_url;
1117
+ }
1118
+ }
1119
+ }
1120
+ },
1121
+ error: function( xhr, status, error ) {
1122
+ jQuery("#wdi_save_loading .caching-process-message").addClass("wdi_hidden");
1123
+ jQuery("#wdi_save_loading").addClass("wdi_hidden");
1124
+ }
1125
+ });
1126
+ }
1127
+
1128
+
1129
  /* deprecated API */
1130
  /**
1131
  * Get information about a user.
js/wdi_instagram.min.js CHANGED
@@ -1 +1 @@
1
- function WDIInstagram(e){this.user={},this.access_tokens=[],this.filters=[],void 0!==e&&(void 0!==e.access_tokens&&(this.access_tokens=e.access_tokens),void 0!==e.filters&&(this.filters=e.filters));var w=this;function g(){return void 0!==w.user&&void 0!==w.user.user_name?w.user.user_name:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_name:""}function u(){return void 0!==w.user&&void 0!==w.user.access_token?w.user.access_token:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user&&void 0!==wdi_object.user.access_token?wdi_object.user.access_token:""}this.statusCode={429:function(){console.log(" 429: Too many requests. Try after one hour")}},this.getFilter=function(e){var t=w.filters;if(void 0===t)return!1;for(var s=0;s<t.length;s++)if(t[s].where==e)if("object"==typeof t[s].what&&2==t[s].what.length){if(void 0!==window[t[s].what[0]]&&"function"==typeof window[t[s].what[0]][t[s].what[1]])return window[t[s].what[0]][t[s].what[1]]}else{if("string"!=typeof t[s].what)return"function"==typeof t[s].what&&t[s].what;if("function"==typeof window[t[s].what])return window[t[s].what]}return!1},this.addToken=function(e){"string"==typeof e&&w.access_tokens.push(e)},this.resetTokens=function(){w.access_tokens=[]};var l=0,p={data:new Array,paging:{}};this.getTagRecentMedia=function(i,n,c,a,u){u=void 0===u||"number"!=typeof u?0:u;var t=!1,e=this.statusCode,s=!1,r=(this.getFilter("getTagRecentMedia"),wdi_ajax.feed_id),o=g();a=0===parseInt(a)?"top_media":"recent_media",void 0===n||0===n.length||("success"in n&&(t=!0),"statusCode"in n&&(e=n.statusCode),"error"in n&&(s=!0),"args"in n||(n.args={}),"count"in n?(n.count=parseInt(n.count),(!Number.isInteger(n.count)||n.count<=0)&&(n.count=33)):n.count=33,"feed_id"in n&&(r=n.feed_id),"user_name"in n&&(o=n.user_name));var d=this.getTagId(i);function f(e){void 0===e.data&&(e.data=[]),t&&("object"==typeof n.success&&2==n.success.length?void 0!==window[n.success[0]]&&"function"==typeof window[n.success[0]][n.success[1]]&&window[n.success[0]][n.success[1]](e):"string"==typeof n.success?"function"==typeof window[n.success]&&window[n.success](e):"function"==typeof n.success&&n.success(e))}jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{action:"wdi_getTagRecentMedia",wdi_nonce:wdi_ajax.wdi_nonce,user_name:o,feed_id:r,next_url:c,tagname:i,wdiTagId:d,endpoint:a,iter:u},success:function(e){var t,s,r=!1,o="";void 0!==e.error&&(r=!0,o=e.error.type),void 0!==e.error&&"HashtagNotFound"===e.error.type?(l=5,f(e)):void 0!==e.error&&"OAuthException"!==e.error.type&&l<5?(l++,w.getTagRecentMedia(i,n,c,a,u)):void 0!==e.response&&void 0!==e.response.iter&&p.data.length<parseInt(wdi_ajax.number_of_photos)&&u<10&&void 0!==e.response.paging&&""!=e.response.paging.next?(c=e.response.paging.next,p.data=p.data.concat(e.response.data),p.paging=e.response.paging,w.getTagRecentMedia(i,n,c,a,e.response.iter)):(0!=p.data.length&&(e.response=p),!1===d&&(d=""),void 0!==e.tag_data&&(void 0!==(t=e.tag_data).tag_id&&(d=t.tag_id),s=[],void 0!==window.wdi_all_tags&&(s=window.wdi_all_tags),s[t.tag_id]=t,window.wdi_all_tags=s),e=e.response,(e=w.convertHashtagData(e)).meta={code:200,error:r,error_type:o},e.tag_id=d,f(e))},error:function(e){s&&("object"==typeof n.error&&2==n.error.length?"function"==typeof window[n.error[0]][n.error[1]]&&window[n.error[0]][n.error[1]](e):"string"==typeof n.error?"function"==typeof window[n.error]&&window[n.error](e):"function"==typeof n.error&&n.error(e))},statusCode:e})},this.getTagId=function(e){var t,s,r=[];for(s in"undefined"!=typeof wdi_controller?0!==(r=wdi_controller.feed_users).length||void 0!==(t=jQuery("#WDI_feed_users").val())&&""!==t&&(r=JSON.parse(t)):void 0!==window.wdi_all_tags&&(r=window.wdi_all_tags),r)if(e===r[s].username||"#"+e===r[s].username)return void 0!==r[s].tag_id&&r[s].tag_id;return!1},this.convertHashtagData=function(e){var t={data:[],pagination:{}};if(void 0!==e&&void 0!==e.paging&&(t.pagination={cursors:{after:e.paging.cursors.after},next_url:e.paging.next}),void 0!==e&&void 0!==e.data)for(var s in e.data){var r,o=e.data[s],i="IMAGE"===o.media_type?"image":"VIDEO"===o.media_type?"video":"carousel",n={id:o.id,user:{id:"",full_name:"",profile_picture:"",username:""},images:{thumbnail:{width:150,height:150,url:o.media_url},low_resolution:{width:320,height:320,url:o.media_url},standard_resolution:{width:1080,height:1080,url:o.media_url}},created_time:o.timestamp,caption:{id:"",text:o.caption,created_time:"",from:{id:"",full_name:"",profile_picture:"",username:""}},user_has_liked:0<o.like_count,likes:{count:o.like_count},tags:[],filter:"Normal",comments:{count:o.comments_count},type:i,link:o.permalink,location:null,attribution:null,users_in_photo:[]};if("IMAGE"===o.media_type||"CAROUSEL_ALBUM"===o.media_type?n.images={thumbnail:{width:150,height:150,url:o.media_url},low_resolution:{width:320,height:320,url:o.media_url},standard_resolution:{width:1080,height:1080,url:o.media_url}}:"VIDEO"===o.media_type&&(n.videos={standard_resolution:{width:640,height:800,url:o.media_url},low_bandwidth:{width:480,height:600,url:o.media_url},low_resolution:{width:480,height:600,url:o.media_url}}),"CAROUSEL_ALBUM"===o.media_type)for(var c in n.carousel_media=[],o.children.data)r="IMAGE"===o.children.data[c].media_type?{images:{thumbnail:{width:150,height:150,url:o.children.data[c].media_url},low_resolution:{width:320,height:320,url:o.children.data[c].media_url},standard_resolution:{width:640,height:640,url:o.children.data[c].media_url}},users_in_photo:[],type:"image"}:{videos:{standard_resolution:{width:640,height:800,url:o.children.data[c].media_url,id:o.children.data[c].id},low_bandwidth:{width:480,height:600,url:o.children.data[c].media_url,id:o.children.data[c].id},low_resolution:{width:480,height:600,url:o.children.data[c].media_url,id:o.children.data[c].id}},users_in_photo:[],type:"video"},n.carousel_media.push(r);t.data.push(n)}return t},this.searchForTagsByName=function(e,s){var r=this,o=!1,i=this.statusCode,n=!1;filter=this.getFilter("searchForTagsByName"),void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(i=s.statusCode));var c="https://api.instagram.com/v1/tags/search?q="+e+"&access_token="+u();w.getDataFromCache(function(e){function t(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(filter&&(e=filter(e,r.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(filter&&(e=filter(e,r.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(filter&&(e=filter(e,r.filterArguments)),s.success(e)))}!1===e?jQuery.ajax({type:"POST",url:c,dataType:"jsonp",success:function(e){w.setDataToCache(c,e),t(e)},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:i}):t(e)},c)},this.searchForUsersByName=function(e,t){var s=this,r=!1,o=(this.statusCode,!1),i=this.getFilter("searchForUsersByName");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(o=!0),"statusCode"in t&&t.statusCode),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/search?q="+e+"&access_token="+u(),success:function(e){r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(i&&(e=i(e,s.filterArguments)),e.args=t,window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(i&&(e=i(e,s.filterArguments)),e.args=t,window[t.success](e)):"function"==typeof t.success&&(i&&(e=i(e,s.filterArguments)),(e.args=t).success(e)))},error:function(e){o&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:this.statusCode})},this.getRecentLikedMedia=function(t){var s=this,r=!1,e=this.statusCode,o=!1,i=this.getFilter("getRecentLikedMedia"),n="https://api.instagram.com/v1/users/self/media/liked?access_token="+u();void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(o=!0),"statusCode"in t&&(e=t.statusCode),"args"in t?argFlag=!0:t.args={},"count"in t?(t.count=parseInt(t.count),(!Number.isInteger(t.count)||t.count<=0)&&(t.count=20)):t.count=20,n+="&count="+t.count,"next_max_like_id"in t&&(n+="&next_max_like_id="+t.next_max_like_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:n,success:function(e){r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(i&&(e=i(e,s.filterArguments,t.args)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(i&&(e=i(e,s.filterArguments,t.args)),window[t.success](e)):"function"==typeof t.success&&(i&&(e=i(e,s.filterArguments,t.args)),t.success(e)))},error:function(e){o&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:e})},this.getUserRecentMedia=function(e,t){var s=this,r=!1,o=this.statusCode,i=!1,n=this.getFilter("getUserRecentMedia"),e="https://api.instagram.com/v1/users/"+e+"/media/recent/?access_token="+u();void 0===t||0===t.length||("success"in t&&(r=!0),"statusCode"in t&&(o=t.statusCode),"args"in t||(t.args={}),"error"in t&&(i=!0),"count"in t?(t.count=parseInt(t.count),(!Number.isInteger(t.count)||t.count<=0)&&(t.count=33)):t.count=33,e+="&count="+t.count,"min_id"in t&&(e+="&min_id="+t.min_id),"max_id"in t&&(e+="&max_id="+t.max_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:e,success:function(e){void 0===e.data&&(e.data=[]),r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments,t.args)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments,t.args)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.filterArguments,t.args)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:o})},this.getUserMedia=function(r,o,i){o=void 0===o?"":o,i=void 0===i||"number"!=typeof i?0:i;var n=this,c=!1,e=this.statusCode,t=!1,a=this.getFilter("getUserMedia"),s=g(),u=wdi_ajax.feed_id;void 0===r||0===r.length||("success"in r&&(c=!0),"error"in r&&(t=!0),"statusCode"in r&&(e=r.statusCode),"args"in r||(r.args={}),"count"in r?(r.count=parseInt(r.count),(!Number.isInteger(r.count)||r.count<=0)&&(r.count=20)):r.count=20,"feed_id"in r&&(u=r.feed_id),"user_name"in r&&(s=r.user_name)),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getUserMedia",user_name:s,feed_id:u,next_url:o,iter:i},success:function(e){var t=!1,s="";if(void 0!==e.error&&(t=!0,s=e.error.type),void 0!==e.error&&"OAuthException"!==e.error.type&&l<5)return l++,void w.getUserMedia(r,o,e.iter);void 0!==e.iter&&p.data.length<parseInt(wdi_ajax.number_of_photos)&&i<20&&""!=e.pagination.next_url?(o=e.pagination.next_url,p.data=p.data.concat(e.data),p.pagination=e.pagination,w.getUserMedia(r,o,e.iter)):(0!=p.data.length&&(e.data=p.data),e.meta={code:200,error:t,error_type:s},c&&("object"==typeof r.success&&2==r.success.length?void 0!==window[r.success[0]]&&"function"==typeof window[r.success[0]][r.success[1]]&&(a&&(e=w.addTags(e),e=a(e,n.filterArguments,r)),window[r.success[0]][r.success[1]](e)):"string"==typeof r.success?"function"==typeof window[r.success]&&(a&&(e=w.addTags(e),e=a(e,n.filterArguments,r)),window[r.success](e)):"function"==typeof r.success&&r.success(e)))},error:function(e){t&&("object"==typeof r.error&&2==r.error.length?"function"==typeof window[r.error[0]][r.error[1]]&&window[r.error[0]][r.error[1]](e):"string"==typeof r.error?"function"==typeof window[r.error]&&window[r.error](e):"function"==typeof r.error&&r.error(e))},statusCode:e})},this.getUserInfo=function(e,t){var s=this,r=!1,o=this.statusCode,i=!1,n=this.getFilter("getUserInfo");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(i=!0),"statusCode"in t&&(o=t.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+e+"/?access_token="+u(),success:function(e){r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.filterArguments)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:o})},this.getSelfInfo=function(s){var r=this,o=!1,i=this.statusCode,n=!1,c=this.getFilter("getSelfInfo");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(i=s.statusCode));var a="https://graph.facebook.com/v3.2/"+(void 0!==w.user&&void 0!==w.user.user_id?w.user.user_id:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_id:"")+"?fields=id,ig_id,username,name,biography,profile_picture_url,followers_count,follows_count,media_count,website&access_token="+u();w.getDataFromCache(function(e){var t;!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:a,statusCode:i,success:function(e){w.setDataToCache(a,e),o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(c&&(e.meta={code:200},e=c(e,r.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(e.meta={code:200},e=c(e,r.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(c&&(e.meta={code:200},e=c(e,r.filterArguments)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))}}):(t=e,o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(c&&(t=c(t,r.filterArguments)),window[s.success[0]][s.success[1]](t)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(t=c(t,r.filterArguments)),window[s.success](t)):"function"==typeof s.success&&(c&&(t=c(t,r.filterArguments)),s.success(t))))},a)},this.getRecentMediaComments=function(e,t,s){var r=this,o=!1,i=this.statusCode,n=!1,c=this.getFilter("getRecentMediaComments");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(n=!0),"statusCode"in t&&(i=t.statusCode)),jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","block"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","block"),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getRecentMediaComments",user_name:g(),media_id:e,next:s},success:function(e){e=e,o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(c&&(e=c(e,r.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(e=c(e,r.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(c&&(e=c(e,r.filterArguments)),t.success(e)))},complete:function(){jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","none"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","none")},error:function(e){n&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:i})},this.getRecentMediaLikes=function(e,t){var s=this,r=!1,o=this.statusCode,i=!1,n=this.getFilter("getRecentMediaLikes");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(i=!0),"statusCode"in t&&(o=t.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/media/"+e+"/likes?access_token="+u(),success:function(e){r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.filterArguments)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:o})},this.getDataFromCache=function(t,e,s){void 0===s&&(s=!0),jQuery.ajax({type:"POST",async:s,url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_nonce:wdi_ajax.wdi_nonce,WDI_MINIFY:wdi_ajax.WDI_MINIFY,task:"get",action:"wdi_cache"},success:function(e){e.success&&void 0!==e.cache_data&&null!==e.cache_data?(e=JSON.parse(e.cache_data),t(e)):t(!1)}})},this.setDataToCache=function(e,t){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_cache_response:JSON.stringify(t),wdi_nonce:wdi_ajax.wdi_nonce,task:"set",action:"wdi_cache"},success:function(e){}})}}
1
+ function WDIInstagram(e){this.user={},this.access_tokens=[],this.filters=[],void 0!==e&&(void 0!==e.access_tokens&&(this.access_tokens=e.access_tokens),void 0!==e.filters&&(this.filters=e.filters));var _=this;function g(){return void 0!==_.user&&void 0!==_.user.user_name?_.user.user_name:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_name:""}function u(){return void 0!==_.user&&void 0!==_.user.access_token?_.user.access_token:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user&&void 0!==wdi_object.user.access_token?wdi_object.user.access_token:""}this.statusCode={429:function(){console.log(" 429: Too many requests. Try after one hour")}},this.getFilter=function(e){var s=_.filters;if(void 0===s)return!1;for(var t=0;t<s.length;t++)if(s[t].where==e)if("object"==typeof s[t].what&&2==s[t].what.length){if(void 0!==window[s[t].what[0]]&&"function"==typeof window[s[t].what[0]][s[t].what[1]])return window[s[t].what[0]][s[t].what[1]]}else{if("string"!=typeof s[t].what)return"function"==typeof s[t].what&&s[t].what;if("function"==typeof window[s[t].what])return window[s[t].what]}return!1},this.addToken=function(e){"string"==typeof e&&_.access_tokens.push(e)},this.resetTokens=function(){_.access_tokens=[]},this.getTagRecentMedia=function(n,i,e,c,a){var s=!1,t=this.statusCode,o=!1,u=(this.getFilter("getTagRecentMedia"),wdi_ajax.feed_id),d=g();c=0===parseInt(c)?"top_media":"recent_media",void 0===i||0===i.length||("success"in i&&(s=!0),"statusCode"in i&&(t=i.statusCode),"error"in i&&(o=!0),"args"in i||(i.args={}),"count"in i?(i.count=parseInt(i.count),(!Number.isInteger(i.count)||i.count<=0)&&(i.count=33)):i.count=33,"feed_id"in i&&(u=i.feed_id),"user_name"in i&&(d=i.user_name));var f=this.getTagId(n);function w(e){void 0===e.data&&(e.data=[]),s&&("object"==typeof i.success&&2==i.success.length?void 0!==window[i.success[0]]&&"function"==typeof window[i.success[0]][i.success[1]]&&window[i.success[0]][i.success[1]](e):"string"==typeof i.success?"function"==typeof window[i.success]&&window[i.success](e):"function"==typeof i.success&&i.success(e))}jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{action:"wdi_getTagRecentMedia",wdi_nonce:wdi_ajax.wdi_nonce,user_name:d,feed_id:u,next_url:e,tagname:n,wdiTagId:f,endpoint:c},success:function(e){var s,t,o=!1,r="";void 0!==e.error&&(o=!0,r=e.error.type),void 0===e.data||void 0!==e.data&&0===e.data.length&&0===a?_.set_cache_data("",d,u,"",0,1,n,f,c,i):(0===e.data.length?e.meta={code:400,error:o,error_type:r}:(!1===f&&(f=""),void 0!==e.tag_data&&(void 0!==(s=e.tag_data).tag_id&&(f=s.tag_id),t=[],void 0!==window.wdi_all_tags&&(t=window.wdi_all_tags),t[s.tag_id]=s,window.wdi_all_tags=t),e.meta={code:200,error:o,error_type:r}),e.tag_id=f,w(e))},error:function(e){o&&("object"==typeof i.error&&2==i.error.length?"function"==typeof window[i.error[0]][i.error[1]]&&window[i.error[0]][i.error[1]](e):"string"==typeof i.error?"function"==typeof window[i.error]&&window[i.error](e):"function"==typeof i.error&&i.error(e))},statusCode:t})},this.getTagId=function(e){var s,t,o=[];if("undefined"!=typeof wdi_controller){if(void 0===(o=wdi_controller.feed_users))return!1;0!==o.length||void 0!==(s=jQuery("#WDI_feed_users").val())&&""!==s&&(o=JSON.parse(s))}else void 0!==window.wdi_all_tags&&(o=window.wdi_all_tags);for(t in o)if(e===o[t].username||"#"+e===o[t].username)return void 0!==o[t].tag_id&&o[t].tag_id;return!1},this.searchForTagsByName=function(e,t){var o=this,r=!1,n=this.statusCode,i=!1;filter=this.getFilter("searchForTagsByName"),void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(i=!0),"statusCode"in t&&(n=t.statusCode));var c="https://api.instagram.com/v1/tags/search?q="+e+"&access_token="+u();_.getDataFromCache(function(e){function s(e){r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(filter&&(e=filter(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(filter&&(e=filter(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(filter&&(e=filter(e,o.filterArguments)),t.success(e)))}!1===e?jQuery.ajax({type:"POST",url:c,dataType:"jsonp",success:function(e){_.setDataToCache(c,e),s(e)},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:n}):s(e)},c)},this.searchForUsersByName=function(e,s){var t=this,o=!1,r=(this.statusCode,!1),n=this.getFilter("searchForUsersByName");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(r=!0),"statusCode"in s&&s.statusCode),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/search?q="+e+"&access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(n&&(e=n(e,t.filterArguments)),e.args=s,window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(n&&(e=n(e,t.filterArguments)),e.args=s,window[s.success](e)):"function"==typeof s.success&&(n&&(e=n(e,t.filterArguments)),(e.args=s).success(e)))},error:function(e){r&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:this.statusCode})},this.getRecentLikedMedia=function(s){var t=this,o=!1,e=this.statusCode,r=!1,n=this.getFilter("getRecentLikedMedia"),i="https://api.instagram.com/v1/users/self/media/liked?access_token="+u();void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(r=!0),"statusCode"in s&&(e=s.statusCode),"args"in s?argFlag=!0:s.args={},"count"in s?(s.count=parseInt(s.count),(!Number.isInteger(s.count)||s.count<=0)&&(s.count=20)):s.count=20,i+="&count="+s.count,"next_max_like_id"in s&&(i+="&next_max_like_id="+s.next_max_like_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:i,success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(n&&(e=n(e,t.filterArguments,s.args)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(n&&(e=n(e,t.filterArguments,s.args)),window[s.success](e)):"function"==typeof s.success&&(n&&(e=n(e,t.filterArguments,s.args)),s.success(e)))},error:function(e){r&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:e})},this.getUserRecentMedia=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getUserRecentMedia"),e="https://api.instagram.com/v1/users/"+e+"/media/recent/?access_token="+u();void 0===s||0===s.length||("success"in s&&(o=!0),"statusCode"in s&&(r=s.statusCode),"args"in s||(s.args={}),"error"in s&&(n=!0),"count"in s?(s.count=parseInt(s.count),(!Number.isInteger(s.count)||s.count<=0)&&(s.count=33)):s.count=33,e+="&count="+s.count,"min_id"in s&&(e+="&min_id="+s.min_id),"max_id"in s&&(e+="&max_id="+s.max_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:e,success:function(e){void 0===e.data&&(e.data=[]),o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments,s.args)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments,s.args)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments,s.args)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getUserMedia=function(o,e,r){e=void 0===e?"":e;var n=this,i=!1,s=this.statusCode,t=!1,c=this.getFilter("getUserMedia"),a=g(),u=wdi_ajax.feed_id;void 0===o||0===o.length||("success"in o&&(i=!0),"error"in o&&(t=!0),"statusCode"in o&&(s=o.statusCode),"args"in o||(o.args={}),"count"in o?(o.count=parseInt(o.count),(!Number.isInteger(o.count)||o.count<=0)&&(o.count=20)):o.count=20,"feed_id"in o&&(u=o.feed_id),"user_name"in o&&(a=o.user_name)),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getUserMedia",user_name:a,feed_id:u,next_url:e},success:function(e){var s=!1,t="";void 0!==e.error&&(s=!0,t=e.error.type),void 0===e.data||void 0!==e.data&&0===e.data.length&&0===r?_.set_cache_data("",a,u,"",0,1,"","","",o):0!==e.data.length?(e.meta={code:200,error:s,error_type:t},i&&("object"==typeof o.success&&2==o.success.length?void 0!==window[o.success[0]]&&"function"==typeof window[o.success[0]][o.success[1]]&&(c&&(e=_.addTags(e),e=c(e,n.filterArguments,o)),window[o.success[0]][o.success[1]](e)):"string"==typeof o.success?"function"==typeof window[o.success]&&(c&&(e=_.addTags(e),e=c(e,n.filterArguments,o)),window[o.success](e)):"function"==typeof o.success&&o.success(e))):(e.meta={code:400,error:s,error_type:t},o.success(e))},error:function(e){t&&("object"==typeof o.error&&2==o.error.length?"function"==typeof window[o.error[0]][o.error[1]]&&window[o.error[0]][o.error[1]](e):"string"==typeof o.error?"function"==typeof window[o.error]&&window[o.error](e):"function"==typeof o.error&&o.error(e))},statusCode:s})},this.set_cache_data=function(s,t,o,r,e,n,i,c,a,u){var d;0===n?(""===t&&(t=jQuery("#WDI_user_name").val()),0===o&&(o=jQuery("#wdi_add_or_edit").val()),""===a&&0!==jQuery("#wdi_feed_users_ajax .wdi_user").length&&(a=jQuery("#WDI_wrap_hashtag_top_recent input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val()),a="0"===a?"top_media":"recent_media",""===c&&"undefined"!=typeof users&&(d=JSON.parse(users),c=d[0].tag_id),""===c&&(c="false")):(c=this.getTagId(i),""===t&&(t=jQuery("#WDI_user_name").val()),0===o&&(o=wdi_ajax.feed_id));var f=10;void 0!==wdi_ajax.wdi_cache_request_count&&""!==wdi_ajax.wdi_cache_request_count&&(f=parseInt(wdi_ajax.wdi_cache_request_count)),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",async:!1,data:{action:"wdi_set_preload_cache_data",tag_id:c,tagname:i,user_name:t,feed_id:o,endpoint:a,wdi_nonce:wdi_ajax.wdi_nonce,next_url:r,iter:e},success:function(e){""!=e.next_url?(e.iter++,e.iter>f?1===n?"false"===c?_.getTagRecentMedia(i,u,r,a,1):_.getUserMedia(u,e.next_url,1):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),window.location=s):_.set_cache_data(s,t,o,e.next_url,e.iter,n,i,c,a,u)):1===n?"false"===c?_.getTagRecentMedia(i,u,r,a,1):_.getUserMedia(u,e.next_url,1):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),jQuery("#wdi_save_loading .caching-process-message").addClass("wdi_hidden"),""!==s&&(window.location=s))},error:function(e,s,t){jQuery("#wdi_save_loading .caching-process-message").addClass("wdi_hidden"),jQuery("#wdi_save_loading").addClass("wdi_hidden")}})},this.getUserInfo=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getUserInfo");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(r=s.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+e+"/?access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getSelfInfo=function(t){var o=this,r=!1,n=this.statusCode,i=!1,c=this.getFilter("getSelfInfo");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(i=!0),"statusCode"in t&&(n=t.statusCode));var a="https://graph.facebook.com/v3.2/"+(void 0!==_.user&&void 0!==_.user.user_id?_.user.user_id:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_id:"")+"?fields=id,ig_id,username,name,biography,profile_picture_url,followers_count,follows_count,media_count,website&access_token="+u();_.getDataFromCache(function(e){var s;!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:a,statusCode:n,success:function(e){_.setDataToCache(a,e),r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))}}):(s=e,r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(c&&(s=c(s,o.filterArguments)),window[t.success[0]][t.success[1]](s)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(s=c(s,o.filterArguments)),window[t.success](s)):"function"==typeof t.success&&(c&&(s=c(s,o.filterArguments)),t.success(s))))},a)},this.getRecentMediaComments=function(e,s,t){var o=this,r=!1,n=this.statusCode,i=!1,c=this.getFilter("getRecentMediaComments");void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(i=!0),"statusCode"in s&&(n=s.statusCode)),jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","block"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","block"),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getRecentMediaComments",user_name:g(),media_id:e,next:t},success:function(e){e=e,r&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(c&&(e=c(e,o.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(e=c(e,o.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(c&&(e=c(e,o.filterArguments)),s.success(e)))},complete:function(){jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","none"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","none")},error:function(e){i&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:n})},this.getRecentMediaLikes=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getRecentMediaLikes");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(r=s.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/media/"+e+"/likes?access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getDataFromCache=function(s,e,t){void 0===t&&(t=!0),jQuery.ajax({type:"POST",async:t,url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_nonce:wdi_ajax.wdi_nonce,WDI_MINIFY:wdi_ajax.WDI_MINIFY,task:"get",action:"wdi_cache"},success:function(e){e.success&&void 0!==e.cache_data&&null!==e.cache_data?(e=JSON.parse(e.cache_data),s(e)):s(!1)}})},this.setDataToCache=function(e,s){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_cache_response:JSON.stringify(s),wdi_nonce:wdi_ajax.wdi_nonce,task:"set",action:"wdi_cache"},success:function(e){}})}}
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === 10Web Social Photo Feed ===
2
  Contributors: webdorado,10web,progmastery
3
  Tags: custom instagram feed, feed, instagram, hashtag, Instagram feed, instagram gallery, instagram posts, Instagram images, Instagram photos, lightbox, photos,instagram account
4
  Requires at least: 3.9
5
  Requires PHP: 5.2
6
- Tested up to: 5.6
7
- Stable tag: 1.4.14
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -504,6 +504,10 @@ Please make sure you don't have any important information before you proceed.
504
  == Privacy Policy ==
505
  10Web Social Photo Feed for Instagram plugin uses Instagram API on website front end. You have to authorize the plugin via sign in to get data from Instagram on your behalf. The plugin does not send any user’s data to Instagram. All the data received from Instagram via API is cached in WordPress database for some short customizable period to provide front end optimization. You can delete or update cached data. Instagram saves some cookies in browsers of website visitors via API data. These cookies are mostly used for security purposes. They are regulated under terms of Instagram’s privacy policy https://instagram.com/legal/privacy. The plugin asks for your consent to collect site administrator’s email address and site URL to offer customer support, deals and discounts on premium products and more.
506
 
 
 
 
 
507
  == Changelog ==
508
  = 1.4.14 =
509
  Fixed: Removing feed.
@@ -544,6 +548,7 @@ Fixed: Requests limitation in API.
544
  = 1.4.7 =
545
  Fixed: Feed images view.
546
 
 
547
  = 1.4.6 =
548
  Improved: Separate options for personal and business accounts.
549
  Improved: Increased loading time of feed.
1
+ === 10Web Social Photo Feed ===
2
  Contributors: webdorado,10web,progmastery
3
  Tags: custom instagram feed, feed, instagram, hashtag, Instagram feed, instagram gallery, instagram posts, Instagram images, Instagram photos, lightbox, photos,instagram account
4
  Requires at least: 3.9
5
  Requires PHP: 5.2
6
+ Tested up to: 5.7
7
+ Stable tag: 1.4.15
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
504
  == Privacy Policy ==
505
  10Web Social Photo Feed for Instagram plugin uses Instagram API on website front end. You have to authorize the plugin via sign in to get data from Instagram on your behalf. The plugin does not send any user’s data to Instagram. All the data received from Instagram via API is cached in WordPress database for some short customizable period to provide front end optimization. You can delete or update cached data. Instagram saves some cookies in browsers of website visitors via API data. These cookies are mostly used for security purposes. They are regulated under terms of Instagram’s privacy policy https://instagram.com/legal/privacy. The plugin asks for your consent to collect site administrator’s email address and site URL to offer customer support, deals and discounts on premium products and more.
506
 
507
+ == Changelog ==
508
+ = 1.4.15 =
509
+ Improved: Decreased load time on front end.
510
+
511
  == Changelog ==
512
  = 1.4.14 =
513
  Fixed: Removing feed.
548
  = 1.4.7 =
549
  Fixed: Feed images view.
550
 
551
+ == Changelog ==
552
  = 1.4.6 =
553
  Improved: Separate options for personal and business accounts.
554
  Improved: Increased loading time of feed.
wd-instagram-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: 10Web Social Photo Feed
4
  * Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/?utm_source=instagram_feed&utm_medium=free_plugin
5
  * Description: 10Web Social Photo Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
6
- * Version: 1.4.14
7
  * Author: 10Web
8
  * Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
9
  * License: GPLv2 or later
@@ -16,6 +16,14 @@ add_action('wp_ajax_wdi_getUserMedia', 'wdi_getUserMedia');
16
  add_action('wp_ajax_nopriv_wdi_getUserMedia', 'wdi_getUserMedia');
17
  add_action('wp_ajax_wdi_getTagRecentMedia', 'wdi_getTagRecentMedia');
18
  add_action('wp_ajax_nopriv_wdi_getTagRecentMedia', 'wdi_getTagRecentMedia');
 
 
 
 
 
 
 
 
19
  add_action('wp_ajax_wdi_account_disconnect', 'wdi_backend_ajax');
20
  add_action('wp_ajax_wdi_account_refresh', 'wdi_backend_ajax');
21
 
@@ -57,42 +65,68 @@ function wdi_getUserMedia(){
57
  require_once(WDI_DIR . '/framework/WDILibrary.php');
58
  $wdi_nonce = WDILibrary::get('wdi_nonce');
59
  $user_name = WDILibrary::get('user_name');
 
60
  if ( wp_verify_nonce($wdi_nonce, 'wdi_cache') && $user_name != '' ) {
61
  require_once ("framework/WDIInstagram.php");
62
  $WDIInstagram = new WDIInstagram();
63
- $data = $WDIInstagram->getUserMedia($user_name);
64
  echo $data; die;
65
  }
66
  }
67
 
68
- function wdi_getTagRecentMedia(){
69
  require_once(WDI_DIR . '/framework/WDILibrary.php');
70
  $wdi_nonce = WDILibrary::get('wdi_nonce');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  if ( wp_verify_nonce($wdi_nonce, 'wdi_cache') ) {
72
- if ( WDILibrary::get('tagname') != '' && WDILibrary::get('endpoint') != '' ) {
73
- $tagname = WDILibrary::get('tagname');
74
- $endpoint = WDILibrary::get('endpoint');
75
- $wdiTagId = FALSE;
76
- $next_url = NULL;
77
- $user_name = NULL;
78
- $wdiTagIdTemp = WDILibrary::get('wdiTagId');
79
- if( $wdiTagIdTemp !== "false" && !empty($wdiTagIdTemp) ) {
80
- $wdiTagId = $wdiTagIdTemp;
81
- }
82
- $next_urlTemp = WDILibrary::get('next_url', '', 'esc_url_raw', 'POST' );
83
- if( !empty($next_urlTemp) ){
84
- $next_url = $next_urlTemp;
85
- }
86
- $user_nameTemp = WDILibrary::get('user_name');
87
- if( !empty($user_nameTemp) ) {
88
- $user_name = $user_nameTemp;
89
- }
 
 
90
 
 
 
 
 
 
91
  require_once ("framework/WDIInstagram.php");
92
  $WDIInstagram = new WDIInstagram();
93
- $data = $WDIInstagram->getTagRecentMedia($tagname, $endpoint, $next_url, $wdiTagId, $user_name);
94
  echo $data; die;
95
- }
96
  }
97
  }
98
 
@@ -111,24 +145,42 @@ function wdi_cache(){
111
  } elseif ($task == "set"){
112
  $wdi_cache_response = WDILibrary::get('wdi_cache_response');
113
  if ( $wdi_cache_response != '' ) {
114
- $data = $WDICache->set_cache_data($wdi_cache_name, $wdi_cache_response);
115
- if ( $data === FALSE ) {
116
  wdi_send_response(array( "success" => FALSE ));
117
  }
118
  else {
119
  wdi_send_response(array( "success" => TRUE ));
120
- }
121
  die;
122
  }
123
  }
124
  }
125
- if ($task == "reset"){
126
- $data = $WDICache->reset_cache();
127
- if ( $data === FALSE ) {
128
- wdi_send_response(array( "success" => FALSE ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  }
130
  else {
131
- wdi_send_response(array( "success" => TRUE ));
 
132
  }
133
  die;
134
  }
@@ -258,18 +310,19 @@ function wdi_privacy_policy() {
258
  $text
259
  );
260
  }
 
261
  $wdi_options = wdi_get_options();
262
- if ( $wdi_options["wdi_transient_time"] > 0 ) {
263
- wp_schedule_single_event( time() + (intval($wdi_options["wdi_transient_time"])*60), 'wdi_cache_cron' );
264
  }
265
 
266
  add_action( 'wdi_cache_cron', 'wdi_run_cache_cron' );
267
  function wdi_run_cache_cron() {
268
  require_once(WDI_DIR . '/framework/WDILibrary.php');
269
  WDILibrary::refresh_instagram_access_token();
270
- require_once ("framework/WDIInstagram.php");
271
- $WDIInstagram = new WDIInstagram();
272
- $WDIInstagram->wdi_preload_cache();
273
  }
274
 
275
  add_filter('wdi_sanitize_options', 'wdi_create_sample_feed');
@@ -434,7 +487,8 @@ function wdi_load_scripts(){
434
  wp_localize_script("wdi_admin", 'wdi_ajax', array(
435
  'ajax_url' => admin_url('admin-ajax.php'),
436
  'uninstall_url' => $uninstall_url,
437
- 'wdi_nonce' => wp_create_nonce("wdi_cache")
 
438
  ));
439
 
440
  wp_localize_script("wdi_admin", 'wdi_messages', array(
3
  * Plugin Name: 10Web Social Photo Feed
4
  * Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/?utm_source=instagram_feed&utm_medium=free_plugin
5
  * Description: 10Web Social Photo Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
6
+ * Version: 1.4.15
7
  * Author: 10Web
8
  * Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
9
  * License: GPLv2 or later
16
  add_action('wp_ajax_nopriv_wdi_getUserMedia', 'wdi_getUserMedia');
17
  add_action('wp_ajax_wdi_getTagRecentMedia', 'wdi_getTagRecentMedia');
18
  add_action('wp_ajax_nopriv_wdi_getTagRecentMedia', 'wdi_getTagRecentMedia');
19
+ add_action('wp_ajax_wdi_getRecentMediaComments', 'wdi_getRecentMediaComments');
20
+ add_action('wp_ajax_nopriv_wdi_getRecentMediaComments', 'wdi_getRecentMediaComments');
21
+ add_action('wp_ajax_wdi_set_preload_cache_data', 'wdi_set_preload_cache_data');
22
+ add_action('wp_ajax_nopriv_wdi_set_preload_cache_data', 'wdi_set_preload_cache_data');
23
+ add_action('wp_ajax_wdi_getHashtagId', 'wdi_getHashtagId');
24
+ add_action('wp_ajax_nopriv_wdi_getHashtagId', 'wdi_getHashtagId');
25
+ add_action('wp_ajax_wdi_apply_changes', 'WDI_instagram_feeds_page');
26
+ add_action('wp_ajax_nopriv_wdi_apply_changes', 'WDI_instagram_feeds_page');
27
  add_action('wp_ajax_wdi_account_disconnect', 'wdi_backend_ajax');
28
  add_action('wp_ajax_wdi_account_refresh', 'wdi_backend_ajax');
29
 
65
  require_once(WDI_DIR . '/framework/WDILibrary.php');
66
  $wdi_nonce = WDILibrary::get('wdi_nonce');
67
  $user_name = WDILibrary::get('user_name');
68
+ $feed_id = WDILibrary::get('feed_id');
69
  if ( wp_verify_nonce($wdi_nonce, 'wdi_cache') && $user_name != '' ) {
70
  require_once ("framework/WDIInstagram.php");
71
  $WDIInstagram = new WDIInstagram();
72
+ $data = $WDIInstagram->getUserMedia($user_name, $feed_id);
73
  echo $data; die;
74
  }
75
  }
76
 
77
+ function wdi_set_preload_cache_data() {
78
  require_once(WDI_DIR . '/framework/WDILibrary.php');
79
  $wdi_nonce = WDILibrary::get('wdi_nonce');
80
+ $user_name = WDILibrary::get('user_name');
81
+ $feed_id = WDILibrary::get('feed_id', 0);
82
+ $endpoint = WDILibrary::get('endpoint');
83
+ $tag_id = WDILibrary::get('tag_id');
84
+ $tag_name = WDILibrary::get('$tag_name');
85
+ if ( wp_verify_nonce($wdi_nonce, 'wdi_cache') && $user_name != '' ) {
86
+ require_once ("framework/WDIInstagram.php");
87
+ $WDIInstagram = new WDIInstagram();
88
+ $data = $WDIInstagram->wdi_set_preload_cache_data($user_name, $feed_id, $endpoint, $tag_id, $tag_name);
89
+ echo $data;
90
+ die;
91
+ }
92
+ }
93
+
94
+ function wdi_getHashtagId() {
95
+ require_once(WDI_DIR . '/framework/WDILibrary.php');
96
+ $wdi_nonce = WDILibrary::get('wdi_nonce');
97
+ $tagname = WDILibrary::get('tagname');
98
+ $user_name = WDILibrary::get('user_name');
99
  if ( wp_verify_nonce($wdi_nonce, 'wdi_cache') ) {
100
+ require_once("framework/WDIInstagram.php");
101
+ $WDIInstagram = new WDIInstagram();
102
+ $data = $WDIInstagram->wdi_getHashtagId($tagname,$user_name);
103
+ echo json_encode($data);
104
+ die;
105
+ }
106
+ }
107
+
108
+ function wdi_getRecentMediaComments(){
109
+ require_once(WDI_DIR . '/framework/WDILibrary.php');
110
+ $wdi_nonce = WDILibrary::get('wdi_nonce');
111
+ $user_name = WDILibrary::get('user_name');
112
+ $media_id = WDILibrary::get('media_id');
113
+ if ( wp_verify_nonce($wdi_nonce, 'wdi_cache') && $user_name != '' ) {
114
+ require_once ("framework/WDIInstagram.php");
115
+ $WDIInstagram = new WDIInstagram();
116
+ $data = $WDIInstagram->getRecentMediaComments($user_name,$media_id);
117
+ echo $data; die;
118
+ }
119
+ }
120
 
121
+ function wdi_getTagRecentMedia(){
122
+ require_once(WDI_DIR . '/framework/WDILibrary.php');
123
+ $wdi_nonce = WDILibrary::get('wdi_nonce');
124
+ if ( wp_verify_nonce($wdi_nonce, 'wdi_cache') ) {
125
+ $feed_id = WDILibrary::get('feed_id');
126
  require_once ("framework/WDIInstagram.php");
127
  $WDIInstagram = new WDIInstagram();
128
+ $data = $WDIInstagram->getTagRecentMedia($feed_id);
129
  echo $data; die;
 
130
  }
131
  }
132
 
145
  } elseif ($task == "set"){
146
  $wdi_cache_response = WDILibrary::get('wdi_cache_response');
147
  if ( $wdi_cache_response != '' ) {
148
+ //$data = $WDICache->set_cache_data($wdi_cache_name, $wdi_cache_response);
149
+ /*if ( $data === FALSE ) {
150
  wdi_send_response(array( "success" => FALSE ));
151
  }
152
  else {
153
  wdi_send_response(array( "success" => TRUE ));
154
+ } */
155
  die;
156
  }
157
  }
158
  }
159
+ if ($task == "reset") {
160
+
161
+ global $wpdb;
162
+ $feeds = $wpdb->get_results("SELECT id,feed_users,hashtag_top_recent FROM ". $wpdb->prefix.WDI_FEED_TABLE, ARRAY_A);
163
+ foreach ( $feeds as $feed ) {
164
+
165
+
166
+
167
+ $data['data'][] = array(
168
+ 'feed_id' => $feed['id'],
169
+ 'users' => $feed['feed_users'],
170
+ 'endpoint' => $feed['hashtag_top_recent']
171
+ );
172
+ }
173
+
174
+
175
+ $status = $WDICache->reset_cache();
176
+
177
+ if ( $status === FALSE ) {
178
+ $data['status'] = FALSE;
179
+ wdi_send_response($data);
180
  }
181
  else {
182
+ $data['status'] = TRUE;
183
+ wdi_send_response($data);
184
  }
185
  die;
186
  }
310
  $text
311
  );
312
  }
313
+
314
  $wdi_options = wdi_get_options();
315
+ if ( WDI_TRANSIENT_DEFAULT_TIME > 0 ) {
316
+ wp_schedule_single_event( time() + (intval(WDI_TRANSIENT_DEFAULT_TIME)*60), 'wdi_cache_cron' );
317
  }
318
 
319
  add_action( 'wdi_cache_cron', 'wdi_run_cache_cron' );
320
  function wdi_run_cache_cron() {
321
  require_once(WDI_DIR . '/framework/WDILibrary.php');
322
  WDILibrary::refresh_instagram_access_token();
323
+ require_once ("framework/WDICache.php");
324
+ $WDICache = new WDICache();
325
+ $WDICache->reset_cache();
326
  }
327
 
328
  add_filter('wdi_sanitize_options', 'wdi_create_sample_feed');
487
  wp_localize_script("wdi_admin", 'wdi_ajax', array(
488
  'ajax_url' => admin_url('admin-ajax.php'),
489
  'uninstall_url' => $uninstall_url,
490
+ 'wdi_nonce' => wp_create_nonce("wdi_cache"),
491
+ 'wdi_cache_request_count' => isset($wdi_options['wdi_cache_request_count']) ? $wdi_options['wdi_cache_request_count'] : 10,
492
  ));
493
 
494
  wp_localize_script("wdi_admin", 'wdi_messages', array(