WD Instagram Feed – Instagram Gallery - Version 1.4.9

Version Description

Fixed: Filters logic. Fixed: Load more functionality. Fixed: Update user info on feed saving. Fixed: Hashtag removing functionality.

Download this release

Release Info

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

Code changes from version 1.4.8 to 1.4.9

admin/controllers/WDIControllerThemes_wdi.php CHANGED
@@ -322,3 +322,4 @@ class WDIControllerThemes_wdi {
322
  }
323
 
324
  }
 
322
  }
323
 
324
  }
325
+
admin/controllers/settings.php CHANGED
@@ -127,11 +127,9 @@ class Settings_controller_wdi {
127
  }
128
 
129
  function account_refresh() {
130
- $json = array();
131
  $user_name = WDILibrary::get('user_name');
132
- var_dump($user_name);
133
- // @ToDo if the type is business, change all businesses.
134
- echo json_encode($json);
135
  exit;
136
  }
137
  /**
127
  }
128
 
129
  function account_refresh() {
 
130
  $user_name = WDILibrary::get('user_name');
131
+ $return_data = WDILibrary::refresh_instagram_account($user_name);
132
+ echo json_encode($return_data);
 
133
  exit;
134
  }
135
  /**
admin/models/WDIModelUninstall_wdi.php DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
- class WDIModelUninstall_wdi{
3
- ////////////////////////////////////////////////////////////////////////////////////////
4
- // Variables //
5
- ////////////////////////////////////////////////////////////////////////////////////////
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- // Constructor and Destructor //
8
- ////////////////////////////////////////////////////////////////////////////////////////
9
- public function __construct(){
10
-
11
- }
12
-
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/WDIViewUninstall_wdi.php DELETED
@@ -1,133 +0,0 @@
1
- <?php
2
-
3
- class WDIViewUninstall_wdi
4
- {
5
-
6
- private $model;
7
-
8
- public function __construct($model)
9
- {
10
- $this->model = $model;
11
- }
12
-
13
- public function display()
14
- {
15
- global $wpdb;
16
- ?>
17
-
18
- <span class="uninstall-icon"></span>
19
- <h2 class="wdi_page_title">
20
- <?php _e('Uninstalling Instagram Feed', "wd-instagram-feed"); ?>
21
- </h2>
22
- <p
23
- style="color:red;font-size:15px"> <?php _e('Deactivating Instagram Feed plugin does not remove any data that may have been created. To completely remove this plugin, you can uninstall it here.', 'wd-instagram-feed') ?>
24
- <br>
25
- <?php _e('WARNING: Once uninstalled, this can\'t be undone. You should use a Database Backup plugin of WordPress to back up all the data first.', 'wd-instagram-feed') ?>
26
- </p>
27
- <p
28
- style="color:red;margin-top:10px;font-size:13px;"> <?php _e('The following Database Tables will be deleted:', 'wd-instagram-feed') ?> </p>
29
- <div style="background-color:white;border:1px solid #888888">
30
- <ul style="background-color:white;margin:0">
31
- <p style="background-color:#F3EFEF;margin: 0;border-bottom: 1px solid #888888;padding:2px;font-size:20px;">
32
- Database Tables</p>
33
- <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">
34
- 1) <?php echo $wpdb->prefix . WDI_FEED_TABLE ?></li>
35
- <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">
36
- 2) <?php echo $wpdb->prefix . WDI_THEME_TABLE ?></li>
37
- <p
38
- style="background-color:#F3EFEF;margin: 0;border-top: 1px solid #888888;border-bottom: 1px solid #888888;padding:2px;font-size:20px;">
39
- Options From <?php echo $wpdb->prefix, 'options' ?></p>
40
- <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">3) wdi_user_name</li>
41
- <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">4) wdi_access_token</li>
42
- <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">6) wdi_custom_js</li>
43
- <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">7) wdi_custom_css</li>
44
- <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">8) wdi_feeds_min_capability</li>
45
- </ul>
46
- </div>
47
-
48
- <form action="admin.php?page=wdi_uninstall" id="wdi_uninstall_form" method="post">
49
- <?php wp_nonce_field('nonce_wd', 'nonce_wd'); ?>
50
- <input type="hidden" name="task" value="uninstall">
51
- <div style="text-align:center">
52
- <p style="margin:0;font-size:15px;"><?php _e('Are you sure you want to uninstall plugin?', 'wd-instagram-feed') ?></p>
53
- <input type="checkbox" style="text-align: center;" id="wdi_verify" name="wdi_verify" value="1">
54
- <label for="wdi_verify" style="vertical-align:top">Yes</label>
55
- <br>
56
-
57
- <div id="wdi_submit" style="text-align:center;margin-top:10px" class="button button-primary">Uninstall</div>
58
- </div>
59
-
60
-
61
- </form>
62
- <script>
63
- jQuery(document).ready(function ()
64
- {
65
- jQuery('#wdi_submit').on('click', function ()
66
- {
67
- if (confirm("<?php _e('Are you sure you want to uninstall plugin?', 'wd-instagram-feed') ?>")) {
68
- jQuery('#wdi_uninstall_form').submit();
69
- }
70
- });
71
- });
72
- </script>
73
- <?php
74
- }
75
-
76
- public function already_uninstalled()
77
- {
78
- $deactivate_url = wp_nonce_url('plugins.php?action=deactivate&amp;plugin=wd-instagram-feed/wd-instagram-feed.php', 'deactivate-plugin_wd-instagram-feed/wd-instagram-feed.php');
79
- ?>
80
- <span class="uninstall-icon"></span>
81
- <h2>
82
- <?php _e('Uninstalling Instagram Feed', "wd-instagram-feed"); ?>
83
- </h2>
84
- <!--<p style="color:green;font-size:15px"> <?php /*_e('Instagram Feed WD is uninstalled','wd-instagram-feed') */
85
- ?><a style="text-decoration:none;padding:3px;" href="<?php /*echo $deactivate_url */
86
- ?>"> <?php /*_e('Click Here') */
87
- ?> </a><?php /*_e('to deactivate it','wd-instagram-feed') */
88
- ?></p>-->
89
- <p><strong><a href="<?php echo $deactivate_url ?>" class="wdi_deactivate_link"
90
- data-uninstall="1"><?php _e("Click Here", "wd-instagram-feed"); ?></a><?php _e(" To Finish the Uninstallation and Instagram Feed will be Deactivated Automatically.", "wd-instagram-feed"); ?>
91
- </strong></p>
92
-
93
- <?php
94
- }
95
-
96
- public function successfully_uninstalled()
97
- {
98
- global $wpdb;
99
- $deactivate_url = wp_nonce_url('plugins.php?action=deactivate&amp;plugin=wd-instagram-feed/wd-instagram-feed.php', 'deactivate-plugin_wd-instagram-feed/wd-instagram-feed.php');
100
- ?>
101
- <span class="uninstall-icon"></span>
102
- <h2>
103
- <?php _e('Uninstalling Instagram Feed', "wd-instagram-feed"); ?>
104
- </h2>
105
- <p
106
- style="color:green;margin-top:10px;font-size:13px;"> <?php _e('The following Database Tables has been successfully deleted:', 'wd-instagram-feed') ?> </p>
107
- <div style="background-color:white;border:1px solid #888888">
108
- <ul style="background-color:white;margin:0">
109
- <p style="background-color:#F3EFEF;margin: 0;border-bottom: 1px solid #888888;padding:2px;font-size:20px;">
110
- Database Tables</p>
111
- <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">
112
- 1)<?php echo $wpdb->prefix . WDI_FEED_TABLE ?></li>
113
- <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">
114
- 2)<?php echo $wpdb->prefix . WDI_THEME_TABLE ?></li>
115
- <p
116
- style="background-color:#F3EFEF;margin: 0;border-top: 1px solid #888888;border-bottom: 1px solid #888888;padding:2px;font-size:20px;">
117
- Options From <?php echo $wpdb->prefix, 'options' ?></p>
118
- <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">3)wdi_user_name</li>
119
- <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">4)wdi_access_token</li>
120
- </ul>
121
- </div>
122
- <!--<p style="color:green;font-size:15px"> <?php /*_e('Instagram Feed WD is successfully uninstalled','wd-instagram-feed') */
123
- ?><a style="text-decoration:none;padding:3px;" href="<?php /*echo $deactivate_url */
124
- ?>"> <?php /*_e('Click Here') */
125
- ?> </a><?php /*_e('to deactivate it','wd-instagram-feed') */
126
- ?></p>-->
127
- <p><strong><a href="<?php echo $deactivate_url; ?>" class="wdi_deactivate_link"
128
- data-uninstall="1"><?php _e("Click Here", "wd-instagram-feed"); ?></a><?php _e(" To Finish the Uninstallation and Instagram Feed will be Deactivated Automatically.", "wd-instagram-feed"); ?>
129
- </strong></p>
130
-
131
- <?php
132
- }
133
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/feeds.php CHANGED
@@ -281,7 +281,10 @@ class Feeds_view_wdi {
281
  'feed_users',
282
  'hashtag_top_recent',
283
  'display_user_post_follow_number',
284
- 'display_user_info'
 
 
 
285
  ),
286
  'attr' => array(
287
  array(
281
  'feed_users',
282
  'hashtag_top_recent',
283
  'display_user_post_follow_number',
284
+ 'display_user_info',
285
+ 'show_likes',
286
+ 'show_comments',
287
+ 'show_username_on_thumb'
288
  ),
289
  'attr' => array(
290
  array(
admin/views/settings.php CHANGED
@@ -80,13 +80,13 @@ class Settings_view_wdi {
80
  </p>
81
  <p class="wdi-input-group">
82
  <label><?php _e('Access Token:', 'wd-instagram-feed'); ?></label>
83
- <input type="text" value="<?php echo $user['access_token']; ?>" readonly="readonly"
84
  onclick="this.focus();this.select()"
85
  title="<?php _e('To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac).', 'wd-instagram-feed'); ?>">
86
  </p>
87
  <p class="wdi-input-group">
88
  <label><?php _e('Refresh Access Token', 'wd-instagram-feed'); ?></label>
89
- <span class="button" onclick="wdi_account_refresh('<?php echo $user_name; ?>')"><?php _e('Refresh', 'wd-instagram-feed'); ?></span>
90
  </p>
91
  </div>
92
  <span class="button wdi-account-remove"
80
  </p>
81
  <p class="wdi-input-group">
82
  <label><?php _e('Access Token:', 'wd-instagram-feed'); ?></label>
83
+ <input class="wdi_user_token" type="text" value="<?php echo $user['access_token']; ?>" readonly="readonly"
84
  onclick="this.focus();this.select()"
85
  title="<?php _e('To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac).', 'wd-instagram-feed'); ?>">
86
  </p>
87
  <p class="wdi-input-group">
88
  <label><?php _e('Refresh Access Token', 'wd-instagram-feed'); ?></label>
89
+ <span class="button wdi_account_refresh" data-wdi_account="<?php echo $user_name; ?>"><?php _e('Refresh', 'wd-instagram-feed'); ?></span>
90
  </p>
91
  </div>
92
  <span class="button wdi-account-remove"
framework/IsFree.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
- $free_messages = array(
3
- "wdi-business" => "Business connecting are available only in Premium version"
4
- );
 
 
 
 
framework/WDICache.php CHANGED
@@ -26,8 +26,8 @@ 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
- if ( isset($cache_data) && $cache_data != FALSE && isset($cache_data["cache_response"]) ) {
30
 
 
31
  $wdi_debugging = FALSE;
32
  $wdi_debugging_data = array();
33
  if ( $debug ) {
@@ -57,8 +57,9 @@ class WDICache {
57
 
58
  return $return_data;
59
  }
60
-
61
- return array( "success" => FALSE );
 
62
  }
63
 
64
  /**
@@ -69,10 +70,7 @@ class WDICache {
69
  *
70
  * @return array|bool
71
  */
72
- public function set_cache_data( $name, $response ) {
73
- //$response = json_decode(stripslashes($response), TRUE);
74
- //$response["cache"]=TRUE;
75
- //$response = json_encode($response, true);
76
  if ( isset($this->wdi_options["wdi_transient_time"]) ) {
77
  $wdi_transient_time = intval($this->wdi_options["wdi_transient_time"]);
78
  }
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();
33
  if ( $debug ) {
57
 
58
  return $return_data;
59
  }
60
+ else {
61
+ return array("success" => FALSE);
62
+ }
63
  }
64
 
65
  /**
70
  *
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
  }
framework/WDIInstagram.php CHANGED
@@ -6,6 +6,10 @@ class WDIInstagram {
6
  private $wdi_authenticated_users_list = NULL;
7
  private $account_data = NULL;
8
 
 
 
 
 
9
  function __construct() {
10
  require_once("WDICache.php");
11
  $this->cache = new WDICache();
@@ -13,23 +17,54 @@ class WDIInstagram {
13
  if ( isset($this->wdi_options["wdi_authenticated_users_list"]) ) {
14
  $this->wdi_authenticated_users_list = json_decode($this->wdi_options["wdi_authenticated_users_list"], TRUE);
15
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
17
 
18
  public function getUserMedia( $user_name ) {
19
  if ( isset($this->wdi_authenticated_users_list) && is_array($this->wdi_authenticated_users_list) && isset($this->wdi_authenticated_users_list[$user_name]) ) {
20
- $this->account_data = $this->wdi_authenticated_users_list[$user_name];
21
- $user_id = $this->account_data["user_id"];
22
- $access_token = $this->account_data["access_token"];
23
- $api_url = 'https://graph.instagram.com/v1.0/';
24
- $media_fields = 'id,media_type,media_url,permalink,thumbnail_url,username,caption,timestamp';
25
- if ( $this->account_data["type"] === "business" ) {
26
- $api_url = 'https://graph.facebook.com/v8.0/';
27
- $media_fields = 'id,media_type,media_url,permalink,thumbnail_url,username,caption,timestamp,ig_id,is_comment_enabled,like_count,owner,shortcode';
28
- }
29
 
30
- $baseUrl = $api_url . $user_id . '/media/?fields=' . $media_fields . '&limit=100&access_token=' . $access_token;
31
- if(WDI_IS_FREE){
32
- $media = array();
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
34
  $cache_data = $this->cache->get_cache_data($baseUrl);
35
  if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) ) {
@@ -37,7 +72,7 @@ class WDIInstagram {
37
  }
38
  $args = array();
39
  $response = wp_remote_get($baseUrl, $args);
40
- if ( !isset($response->errors) && isset($response["body"]) ) {
41
  $data = json_decode($response["body"], TRUE);
42
  if ( !empty($data['data']) ) {
43
  $return_data = $this->convertPersonalData($data);
@@ -58,7 +93,7 @@ class WDIInstagram {
58
  $baseUrl = $next_url;
59
  }
60
  else {
61
- $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"] . '&user_id=' . $this->account_data["user_id"];
62
  if ( $wdiTagId !== FALSE ) {
63
  $baseUrl = str_replace("{tagid}", $wdiTagId, $baseUrl);
64
  }
@@ -76,7 +111,6 @@ class WDIInstagram {
76
  }
77
  /***********************************************************/
78
  $args = array();
79
- //$return_data = '{"error":{"message":"cURL error","type":"http_request_failed"}}';
80
  $cache_data = $this->cache->get_cache_data($baseUrl);
81
  if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) ) {
82
  $cache_data_json = base64_decode($cache_data["cache_data"]);
@@ -84,11 +118,19 @@ class WDIInstagram {
84
  return $cache_data_json;
85
  }
86
  }
 
87
  $response = wp_remote_get($baseUrl, $args);
88
- if ( !isset($response->errors) && isset($response["body"]) ) {
89
- $response_arr = json_decode($response["body"]);
90
  $return_data["response"] = $response_arr;
91
- $this->cache->set_cache_data($baseUrl, base64_encode(json_encode($return_data)));
 
 
 
 
 
 
 
92
  return json_encode($return_data);
93
  }
94
  $return_data = '{"error":{"message":"cURL error","type":"http_request_failed"}}';
@@ -104,7 +146,7 @@ class WDIInstagram {
104
  return json_decode($cache_data["cache_data"], TRUE);
105
  }
106
  $response = wp_remote_get($url, $args);
107
- if ( !isset($response->errors) && isset($response["body"]) ) {
108
  $response = json_decode($response["body"]);
109
  if ( isset($response->data) && isset($response->data[0]) && isset($response->data[0]->id) ) {
110
  $hashtag_id = $response->data[0]->id;
@@ -135,8 +177,6 @@ class WDIInstagram {
135
  }
136
  if ( isset($data["data"]) ) {
137
  foreach ( $data["data"] as $key => $media ) {
138
-
139
-
140
  if ( $media["media_type"] == "IMAGE" ) {
141
  $media_type = "image";
142
  }
@@ -261,7 +301,7 @@ class WDIInstagram {
261
  }
262
  $api_url .= $media_id . '/children?access_token=' . $this->account_data["access_token"];
263
  $response = wp_remote_get($api_url, array());
264
- if ( isset($response["body"]) && $this->isJson($response["body"]) ) {
265
  $media_ids = json_decode($response["body"], TRUE);
266
  if ( is_array($media_ids) && isset($media_ids["data"]) ) {
267
  foreach ( $media_ids["data"] as $id ) {
@@ -277,7 +317,6 @@ class WDIInstagram {
277
  return $carousel_media;
278
  }
279
 
280
-
281
  /**
282
  * Get media info by id.
283
  *
@@ -296,9 +335,13 @@ class WDIInstagram {
296
  }
297
  $api_url = $api_url . $media_id . '/?fields=' . $fields . '&access_token=' . $this->account_data["access_token"];
298
  $response = wp_remote_get($api_url, array());
299
- if ( isset($response["body"]) && $this->isJson($response["body"]) ) {
300
  $media_data = json_decode($response["body"], TRUE);
301
- if ( $media_data["media_type"] == "IMAGE" ) {
 
 
 
 
302
  $return_data = array(
303
  "images" => array(
304
  "thumbnail" => array(
@@ -377,7 +420,6 @@ class WDIInstagram {
377
  }
378
  }
379
 
380
-
381
  private function get_feed_list($data, $cron = TRUE){
382
  $feed_list = array();
383
  if($cron){
6
  private $wdi_authenticated_users_list = NULL;
7
  private $account_data = NULL;
8
 
9
+ public $feed_id;
10
+ public $conditions = array();
11
+ public $iter;
12
+
13
  function __construct() {
14
  require_once("WDICache.php");
15
  $this->cache = new WDICache();
17
  if ( isset($this->wdi_options["wdi_authenticated_users_list"]) ) {
18
  $this->wdi_authenticated_users_list = json_decode($this->wdi_options["wdi_authenticated_users_list"], TRUE);
19
  }
20
+
21
+ $this->iter = WDILibrary::get('iter', 0, 'intval', 'POST' );
22
+ $this->feed_id = WDILibrary::get('feed_id', 0, 'intval', 'POST' );
23
+ $this->conditions = $this->get_filters( $this->feed_id );
24
+ }
25
+
26
+ /**
27
+ * Get condition filters for feed
28
+ *
29
+ * @param integer $feed_id
30
+ *
31
+ * @return array current feed filter data
32
+ */
33
+ public function get_filters( $feed_id ) {
34
+ return array();
35
+ }
36
+
37
+ /**
38
+ * Filter media data according to the filter conditions
39
+ *
40
+ * @param array $medias all medias got from endpoint
41
+ * @param array $filters hashtag conditions for feed
42
+ * @param string $type condition type AND / OR
43
+ *filterUserMedia
44
+ * @return array filtered media
45
+ */
46
+ public function filterUserMedia( $response, $filters, $type ) {
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"]) ) {
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);
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
  }
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"]);
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"], 1 );
125
  $return_data["response"] = $response_arr;
126
+ if ( !empty($this->conditions) ) {
127
+ $this->cache->set_cache_data($baseUrl."&iter=".$this->iter, base64_encode(json_encode($return_data)));
128
+ $response_arr['data'] = $this->filterUserMedia( $response_arr, $this->conditions['conditional_filters'], $this->conditions['conditional_filter_type'] );
129
+ $response_arr['iter'] = $this->iter;
130
+ $return_data["response"] = $response_arr;
131
+ } else {
132
+ $this->cache->set_cache_data($baseUrl, base64_encode(json_encode($return_data)));
133
+ }
134
  return json_encode($return_data);
135
  }
136
  $return_data = '{"error":{"message":"cURL error","type":"http_request_failed"}}';
146
  return json_decode($cache_data["cache_data"], TRUE);
147
  }
148
  $response = wp_remote_get($url, $args);
149
+ if ( !isset($response->errors) && is_array($response) && isset($response["body"]) ) {
150
  $response = json_decode($response["body"]);
151
  if ( isset($response->data) && isset($response->data[0]) && isset($response->data[0]->id) ) {
152
  $hashtag_id = $response->data[0]->id;
177
  }
178
  if ( isset($data["data"]) ) {
179
  foreach ( $data["data"] as $key => $media ) {
 
 
180
  if ( $media["media_type"] == "IMAGE" ) {
181
  $media_type = "image";
182
  }
301
  }
302
  $api_url .= $media_id . '/children?access_token=' . $this->account_data["access_token"];
303
  $response = wp_remote_get($api_url, array());
304
+ if ( is_array($response) && isset($response["body"]) && $this->isJson($response["body"]) ) {
305
  $media_ids = json_decode($response["body"], TRUE);
306
  if ( is_array($media_ids) && isset($media_ids["data"]) ) {
307
  foreach ( $media_ids["data"] as $id ) {
317
  return $carousel_media;
318
  }
319
 
 
320
  /**
321
  * Get media info by id.
322
  *
335
  }
336
  $api_url = $api_url . $media_id . '/?fields=' . $fields . '&access_token=' . $this->account_data["access_token"];
337
  $response = wp_remote_get($api_url, array());
338
+ if ( is_array($response) && isset($response["body"]) && $this->isJson($response["body"]) ) {
339
  $media_data = json_decode($response["body"], TRUE);
340
+ if( isset($media_data['error']) ) {
341
+ return FALSE;
342
+ }
343
+
344
+ if ( isset($media_data["media_type"]) && $media_data["media_type"] == "IMAGE" ) {
345
  $return_data = array(
346
  "images" => array(
347
  "thumbnail" => array(
420
  }
421
  }
422
 
 
423
  private function get_feed_list($data, $cron = TRUE){
424
  $feed_list = array();
425
  if($cron){
framework/WDILibrary.php CHANGED
@@ -1348,21 +1348,90 @@ class WDILibrary {
1348
  */
1349
  public static function refresh_instagram_access_token() {
1350
  $wdi_options = wdi_get_options();
1351
- if ( !empty($wdi_options['wdi_access_token']) ) {
1352
- $config = self::instagram_app_config();
1353
- $response = wp_remote_get($config['refresh_access_token'] . '?grant_type=ig_refresh_token&access_token=' . $wdi_options['wdi_access_token']);
1354
- $response = json_decode(wp_remote_retrieve_body($response), TRUE);
1355
- if ( !empty($response['expires_in']) && !empty($response['access_token']) ) {
1356
- $wdi_options['wdi_start_in'] = time();
1357
- $wdi_options['wdi_expires_in'] = $response['expires_in'];
1358
- $wdi_options['wdi_access_token'] = $response['access_token'];
1359
- update_option(WDI_OPT, $wdi_options);
1360
-
1361
- return $response;
1362
  }
1363
  }
 
1364
 
1365
- return FALSE;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1366
  }
1367
 
1368
  /**
@@ -1380,6 +1449,14 @@ class WDILibrary {
1380
  ?>
1381
  <div class="wdi_single_user">
1382
  <div class="wdi_header_user_text ">
 
 
 
 
 
 
 
 
1383
  <?php if ( !empty($settings['show_follow']) && $settings['show_follow'] == 1 ) { ?>
1384
  <div class="wdi_user_controls">
1385
  <div class="wdi_follow_btn"
@@ -1413,10 +1490,6 @@ class WDILibrary {
1413
  }
1414
  }
1415
 
1416
- public static function get_user_info( $user_name ) {
1417
-
1418
- }
1419
-
1420
  /**
1421
  * Generate top bar.
1422
  *
1348
  */
1349
  public static function refresh_instagram_access_token() {
1350
  $wdi_options = wdi_get_options();
1351
+ if(is_array($wdi_options) && isset($wdi_options["wdi_authenticated_users_list"])){
1352
+ $wdi_authenticated_users_list = json_decode($wdi_options["wdi_authenticated_users_list"], TRUE);
1353
+ foreach ($wdi_authenticated_users_list as $wdi_user){
1354
+ if(isset($wdi_user["user_name"])){
1355
+ self::refresh_instagram_account($wdi_user["user_name"]);
1356
+ }
 
 
 
 
 
1357
  }
1358
  }
1359
+ }
1360
 
1361
+ public static function refresh_instagram_account($user_name){
1362
+ $return_data = array(
1363
+ 'success'=>FALSE
1364
+ );
1365
+ $wdi_user_data = NULL;
1366
+ $instagram_app_config = self::instagram_app_config();
1367
+ $wdi_instagram_options = get_option("wdi_instagram_options");
1368
+ if(is_array($wdi_instagram_options) && isset($wdi_instagram_options["wdi_authenticated_users_list"])){
1369
+ $wdi_authenticated_users_list = json_decode($wdi_instagram_options["wdi_authenticated_users_list"], TRUE);
1370
+ if(is_array($wdi_authenticated_users_list) && isset($wdi_authenticated_users_list[$user_name])){
1371
+ $wdi_user = $wdi_authenticated_users_list[$user_name];
1372
+ if(isset($wdi_user["access_token"]) && isset($wdi_user["type"])){
1373
+ $wdi_user_type = $wdi_user["type"];
1374
+ $wdi_user_token = $wdi_user["access_token"];
1375
+ $wdi_user_id = $wdi_user["user_id"];
1376
+ $url = '';
1377
+ if($wdi_user_type === "personal"){
1378
+ $url = $instagram_app_config["basic_redirect_uri"];
1379
+ }elseif ($wdi_user_type === "business"){
1380
+ $wdi_user_data = wp_remote_get('https://graph.facebook.com/v3.2/' . $wdi_user_id . '?fields=id,ig_id,username,name,biography,profile_picture_url,followers_count,follows_count,media_count,website&access_token=' . $wdi_user_token);
1381
+ if(!is_wp_error( $wdi_user_data ) && isset($wdi_user_data["body"])){
1382
+ $wdi_user_data = json_decode($wdi_user_data["body"], TRUE);
1383
+ }
1384
+ $url = $instagram_app_config["graph_redirect_uri"];
1385
+ }
1386
+ $args = array(
1387
+ 'body' => array( 'action'=>'wdi_account_refresh','wdi_user_token' => $wdi_user_token),
1388
+ );
1389
+ $response = wp_remote_post( $url, $args );
1390
+ if(!is_wp_error( $response ) && isset($response["body"])){
1391
+ $wdi_user_access_token = json_decode($response["body"], TRUE);
1392
+ if(isset($wdi_user_access_token["access_token"])){
1393
+ $wdi_user_token = sanitize_text_field($wdi_user_access_token["access_token"]);
1394
+ $wdi_authenticated_users_list[$user_name]["access_token"] = $wdi_user_token;
1395
+ if(isset($wdi_user_data)){
1396
+ if(isset($wdi_user_data["id"])){
1397
+ $wdi_authenticated_users_list[$user_name]["user_id"] = $wdi_user_data["id"];
1398
+ }
1399
+ if(isset($wdi_user_data["username"])){
1400
+ $wdi_authenticated_users_list[$user_name]["user_name"] = $wdi_user_data["username"];
1401
+ }
1402
+ if(isset($wdi_user_data["biography"])){
1403
+ $wdi_authenticated_users_list[$user_name]["biography"] = $wdi_user_data["biography"];
1404
+ }
1405
+ if(isset($wdi_user_data["profile_picture_url"])){
1406
+ $wdi_authenticated_users_list[$user_name]["profile_picture_url"] = $wdi_user_data["profile_picture_url"];
1407
+ }
1408
+ if(isset($wdi_user_data["followers_count"])){
1409
+ $wdi_authenticated_users_list[$user_name]["followers_count"] = $wdi_user_data["followers_count"];
1410
+ }
1411
+ if(isset($wdi_user_data["follows_count"])){
1412
+ $wdi_authenticated_users_list[$user_name]["follows_count"] = $wdi_user_data["follows_count"];
1413
+ }
1414
+ if(isset($wdi_user_data["media_count"])){
1415
+ $wdi_authenticated_users_list[$user_name]["media_count"] = $wdi_user_data["media_count"];
1416
+ }
1417
+ if(isset($wdi_user_data["website"])){
1418
+ $wdi_authenticated_users_list[$user_name]["website"] = $wdi_user_data["website"];
1419
+ }
1420
+ }
1421
+ $wdi_instagram_options["wdi_authenticated_users_list"] = json_encode($wdi_authenticated_users_list);
1422
+ $updated = update_option("wdi_instagram_options" , $wdi_instagram_options);
1423
+ if($updated){
1424
+ $return_data["success"] = TRUE;
1425
+ $return_data["user"] = $user_name;
1426
+ $return_data["token"] = $wdi_user_token;
1427
+ }
1428
+ }
1429
+ }
1430
+ }
1431
+ }
1432
+ }
1433
+ // @ToDo if the type is business, change all businesses.
1434
+ return $return_data;
1435
  }
1436
 
1437
  /**
1449
  ?>
1450
  <div class="wdi_single_user">
1451
  <div class="wdi_header_user_text ">
1452
+ <?php if ( !empty($settings['show_usernames']) && $settings['show_usernames'] == 1 ) { ?>
1453
+ <?php if ( $business ) { ?>
1454
+ <div class="wdi_user_img_wrap">
1455
+ <img src="<?php echo $user['profile_picture_url']; ?>" alt="<?php echo $user['user_name']; ?>">
1456
+ </div>
1457
+ <?php } ?>
1458
+ <h3 onclick="window.open('//instagram.com/<?php echo $user['user_name']; ?>','_blank')"><?php echo $user['user_name']; ?></h3>
1459
+ <?php } ?>
1460
  <?php if ( !empty($settings['show_follow']) && $settings['show_follow'] == 1 ) { ?>
1461
  <div class="wdi_user_controls">
1462
  <div class="wdi_follow_btn"
1490
  }
1491
  }
1492
 
 
 
 
 
1493
  /**
1494
  * Generate top bar.
1495
  *
framework/WDI_form_builder.php CHANGED
@@ -194,7 +194,7 @@ public function __construct() {
194
  $type = isset($element['type']) ? $element['type'] : '';
195
  $label = isset($element['label']) ? $element['label'] : '';
196
  $width = isset($element['width']) ? ($element['width']) : '';
197
- $options = isset($element['valid_options']) ? $element['valid_options'] : array();
198
  $hide_ids = isset($element['hide_ids']) ? $element['hide_ids'] : '';
199
  $defaults = $element['defaults'];
200
  $current_settings = isset($feed_row) ? $feed_row : '';
194
  $type = isset($element['type']) ? $element['type'] : '';
195
  $label = isset($element['label']) ? $element['label'] : '';
196
  $width = isset($element['width']) ? ($element['width']) : '';
197
+ $options = isset($element['valid_options']) ? $element['valid_options'] : '';
198
  $hide_ids = isset($element['hide_ids']) ? $element['hide_ids'] : '';
199
  $defaults = $element['defaults'];
200
  $current_settings = isset($feed_row) ? $feed_row : '';
frontend/shortcode.php CHANGED
@@ -45,6 +45,7 @@ function wdi_feed($atts, $widget_params = '') {
45
  $atts['id'] = $feed_id;
46
  }
47
  $attributes = shortcode_atts( array('id' => 'no_id'), $atts );
 
48
 
49
  if ( $attributes['id'] == 'no_id' ) {
50
  //including feed model
@@ -99,7 +100,11 @@ function wdi_feed($atts, $widget_params = '') {
99
  }
100
  }
101
 
102
- wdi_register_frontend_scripts();
 
 
 
 
103
  if ( WDILibrary::is_ajax() || WDILibrary::elementor_is_active() ) {
104
  if ( $wdi_feed_counter == 0 ) {
105
  $wdi_feed_counter = rand(1000, 9999);
@@ -208,7 +213,7 @@ function wdi_feed($atts, $widget_params = '') {
208
  return ob_get_clean();
209
  }
210
 
211
- function wdi_register_frontend_scripts(){
212
 
213
  wp_register_script('wdi_lazy_load', WDI_URL . '/js/jquery.lazyload.min.js', array("jquery"), wdi_get_pro_version(), true);
214
  if( WDI_MINIFY === true ) {
@@ -248,10 +253,15 @@ function wdi_register_frontend_scripts(){
248
  $user_is_admin = current_user_can('manage_options');
249
  $wdi_token_error_flag = get_option("wdi_token_error_flag");
250
 
 
 
 
251
  wp_localize_script("wdi_frontend", 'wdi_ajax', array(
252
  'ajax_url' => admin_url('admin-ajax.php'),
253
  'wdi_nonce' => wp_create_nonce("wdi_cache"),
254
- 'WDI_MINIFY' => (WDI_MINIFY) ? 'true' : 'false'
 
 
255
  ));
256
 
257
  wp_localize_script("wdi_frontend", 'wdi_url', array(
45
  $atts['id'] = $feed_id;
46
  }
47
  $attributes = shortcode_atts( array('id' => 'no_id'), $atts );
48
+ $current_feed_id = $attributes['id'];
49
 
50
  if ( $attributes['id'] == 'no_id' ) {
51
  //including feed model
100
  }
101
  }
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() ) {
109
  if ( $wdi_feed_counter == 0 ) {
110
  $wdi_feed_counter = rand(1000, 9999);
213
  return ob_get_clean();
214
  }
215
 
216
+ function wdi_register_frontend_scripts( $params = array() ){
217
 
218
  wp_register_script('wdi_lazy_load', WDI_URL . '/js/jquery.lazyload.min.js', array("jquery"), wdi_get_pro_version(), true);
219
  if( WDI_MINIFY === true ) {
253
  $user_is_admin = current_user_can('manage_options');
254
  $wdi_token_error_flag = get_option("wdi_token_error_flag");
255
 
256
+
257
+ $current_feed_id = $params['current_feed_id'];
258
+ $number_of_photos = $params['number_of_photos'];
259
  wp_localize_script("wdi_frontend", 'wdi_ajax', array(
260
  'ajax_url' => admin_url('admin-ajax.php'),
261
  'wdi_nonce' => wp_create_nonce("wdi_cache"),
262
+ 'WDI_MINIFY' => (WDI_MINIFY) ? 'true' : 'false',
263
+ 'feed_id' => $current_feed_id,
264
+ 'number_of_photos' => $number_of_photos,
265
  ));
266
 
267
  wp_localize_script("wdi_frontend", 'wdi_url', array(
js/gallerybox/wdi_gallery_box.js CHANGED
@@ -139,7 +139,11 @@ var wdi_construct_popup = function (popup, currentFeed, image_rows, current_imag
139
  var src = (typeof image_row.filename !== 'undefined') ? image_row.filename : image_row.thumb_url;
140
  } else {
141
  var src = (typeof image_row.images[currentFeed.feedImageResolution] !== 'undefined' && typeof image_row.images[currentFeed.feedImageResolution]['url'] !== "undefined") ? image_row.images[currentFeed.feedImageResolution]['url'] : image_row.thumb_url;
142
- } var onclick = 'wdi_change_image(parseInt(jQuery(\'#wdi_current_image_key\').val()), \'' + i + '\', wdi_data)';
 
 
 
 
143
  var ontouchend = 'wdi_change_image(parseInt(jQuery(\'#wdi_current_image_key\').val()), \'' + i + '\', wdi_data)';
144
 
145
  var img_html = '<img style="' + img_style + '" class="wdi_filmstrip_thumbnail_img" src="' + src + '" onclick="' + onclick + '" ontouchend="' + ontouchend + '" image_id="' + image_row.id + '" image_key="' + i + '" alt="' + image_row.alt + '" />';
139
  var src = (typeof image_row.filename !== 'undefined') ? image_row.filename : image_row.thumb_url;
140
  } else {
141
  var src = (typeof image_row.images[currentFeed.feedImageResolution] !== 'undefined' && typeof image_row.images[currentFeed.feedImageResolution]['url'] !== "undefined") ? image_row.images[currentFeed.feedImageResolution]['url'] : image_row.thumb_url;
142
+ }
143
+ if( src.indexOf('https://video.cdninstagram.com/') == 0 ) {
144
+ src = wdi_url.plugin_url + "images/video_missing.png";
145
+ }
146
+ var onclick = 'wdi_change_image(parseInt(jQuery(\'#wdi_current_image_key\').val()), \'' + i + '\', wdi_data)';
147
  var ontouchend = 'wdi_change_image(parseInt(jQuery(\'#wdi_current_image_key\').val()), \'' + i + '\', wdi_data)';
148
 
149
  var img_html = '<img style="' + img_style + '" class="wdi_filmstrip_thumbnail_img" src="' + src + '" onclick="' + onclick + '" ontouchend="' + ontouchend + '" image_id="' + image_row.id + '" image_key="' + i + '" alt="' + image_row.alt + '" />';
js/wdi_admin.js CHANGED
@@ -22,6 +22,33 @@ jQuery(document).ready(function() {
22
  });
23
  });
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  /*Feeds page*/
26
  wdi_controller.bindSaveFeedEvent();
27
  wdi_controller.bindAddNewUserOrHashtagEvent();
@@ -437,7 +464,7 @@ wdi_controller.bindSaveFeedEvent = function() {
437
  * @param {String} task [this is self explanatory]
438
  */
439
  wdi_controller.save_feed = function ( task ) {
440
- var feed_users = this.feed_users,
441
  id,
442
  type,
443
  username,
@@ -567,9 +594,13 @@ wdi_controller.makeInstagramUserRequest = function ( user_input, ignoreConfirm )
567
  * @return {Boolean}
568
  */
569
  wdi_controller.checkForDuplicateUser = function(username) {
570
- for (var i = 0; i < this.feed_users.length; i++) {
571
- if (username == this.feed_users[i]['username']) {
572
- return true;
 
 
 
 
573
  }
574
  }
575
  return false;
@@ -616,28 +647,30 @@ wdi_controller.stringifyUserData = function (feed_users) {
616
  */
617
  wdi_controller.bindAddNewUserOrHashtagEvent = function () {
618
  jQuery('#wdi_add_user_ajax').on('click', function () {
619
- if ( typeof jQuery(this).attr('disabled') !== 'undefined' ) {
620
- return;
 
621
  }
622
  else {
623
- jQuery(this).attr('disabled', 'disabled');
624
  }
625
  var tag_name = jQuery('#wdi_add_user_ajax_input').val().trim().toLowerCase();
626
  if ( wdi_controller.makeInstagramUserRequest(tag_name) === false ) {
627
  jQuery(this).removeAttr('disabled', 'disabled');
628
  }
629
  });
630
- jQuery('#wdi_add_user_ajax_input').on("keypress", function ( e ) {
 
631
  if ( e.keyCode == 13 ) {
632
- if ( typeof jQuery("#wdi_add_user_ajax").attr('disabled') !== "undefined" ) {
633
- return;
634
  }
635
  else {
636
- jQuery("#wdi_add_user_ajax").attr('disabled', 'disabled');
637
  }
638
  var tag_name = jQuery('#wdi_add_user_ajax_input').val().trim().toLowerCase();
639
  if ( wdi_controller.makeInstagramUserRequest(tag_name) === false ) {
640
- jQuery("#wdi_add_user_ajax").removeAttr('disabled', 'disabled');
641
  }
642
  return false; // prevent the button click from happening
643
  }
@@ -674,8 +707,8 @@ wdi_controller.removeFeedUser = function ( $this ) {
674
  this.feed_users.splice(i, 1);
675
  }
676
  }
677
- $this.parent().remove();
678
  jQuery('#WDI_feed_users').val(this.stringifyUserData(this.feed_users));
 
679
  wdi_controller.changed_users();
680
  }
681
 
@@ -859,25 +892,40 @@ wdi_controller.addHashtag = function(tagname, response) {
859
  jQuery('#wdi_add_user_ajax_input').val('');
860
  var profile_picture;
861
  if (typeof response != 'undefined') {
 
862
  profile_picture = (response['data'].length != 0 && typeof response['data'][0]['images']['thumbnail'] !== "undefined") ? response['data'][0]['images']['thumbnail']['url'] : '';
863
  } else {
864
  profile_picture = '';
865
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
866
  var tag_obj = {
867
  id: '#' + tagname,
868
  username: '#' + tagname,
869
  profile_picture: profile_picture,
870
  tag_id: response.tag_id
871
  };
872
- this.feed_users.push(tag_obj);
873
- } else {
 
 
 
874
  alert(wdi_messages.invalid_hashtag);
875
  }
876
 
877
  this.updateConditionalFiltersUi();
878
-
879
  wdi_controller.saveFeedAfterAjaxWait(true);
880
-
881
  wdi_controller.changed_users();
882
  };
883
 
@@ -1479,24 +1527,6 @@ function wdi_spider_set_input_value(input_id, input_value) {
1479
  }
1480
  }
1481
 
1482
- function wdi_account_refresh(user_name) {
1483
- jQuery.ajax({
1484
- type: 'POST',
1485
- url: wdi_ajax.ajax_url,
1486
- dataType: 'json',
1487
- data: {
1488
- page: 'wdi_settings',
1489
- action: 'wdi_account_refresh',
1490
- nonce: wdi_ajax.wdi_nonce,
1491
- user_name: user_name
1492
- },
1493
- success: function (response) {
1494
- if ( response.success ) {
1495
-
1496
- }
1497
- }
1498
- });
1499
- }
1500
 
1501
  function wdi_account_remove(user_name) {
1502
  jQuery.ajax({
22
  });
23
  });
24
 
25
+ jQuery(".wdi_account_refresh").click(function () {
26
+ var __this = jQuery(this);
27
+ var wdi_user_name = __this.data("wdi_account");
28
+ jQuery.ajax({
29
+ type: 'POST',
30
+ url: wdi_ajax.ajax_url,
31
+ dataType: 'json',
32
+ data: {
33
+ page: 'wdi_settings',
34
+ action: 'wdi_account_refresh',
35
+ nonce: wdi_ajax.wdi_nonce,
36
+ user_name: wdi_user_name
37
+ },
38
+ success: function (data) {
39
+ var wdi_reset_cache_success = __this.closest("div").find(".wdi_reset_cache_success");
40
+ wdi_reset_cache_success.remove();
41
+ if(data.success === true){
42
+ __this.after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>");
43
+ var wdi_token_filed = __this.closest("div").find(".wdi_user_token");
44
+ wdi_token_filed.val(data.token);
45
+ }else{
46
+ __this.after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>");
47
+ }
48
+ }
49
+ });
50
+ });
51
+
52
  /*Feeds page*/
53
  wdi_controller.bindSaveFeedEvent();
54
  wdi_controller.bindAddNewUserOrHashtagEvent();
464
  * @param {String} task [this is self explanatory]
465
  */
466
  wdi_controller.save_feed = function ( task ) {
467
+ var feed_users = [],
468
  id,
469
  type,
470
  username,
594
  * @return {Boolean}
595
  */
596
  wdi_controller.checkForDuplicateUser = function(username) {
597
+ var feed_users = jQuery('#WDI_feed_users').val();
598
+ if ( this.isJsonString(feed_users) ) {
599
+ feed_users = JSON.parse(feed_users);
600
+ for (var i = 0; i < feed_users.length; i++) {
601
+ if (username == feed_users[i]['username']) {
602
+ return true;
603
+ }
604
  }
605
  }
606
  return false;
647
  */
648
  wdi_controller.bindAddNewUserOrHashtagEvent = function () {
649
  jQuery('#wdi_add_user_ajax').on('click', function () {
650
+ // ToDo. what is this for.
651
+ if ( typeof jQuery(this).prop('disabled') !== 'undefined' ) {
652
+ //return;
653
  }
654
  else {
655
+ jQuery(this).prop('disabled', true);
656
  }
657
  var tag_name = jQuery('#wdi_add_user_ajax_input').val().trim().toLowerCase();
658
  if ( wdi_controller.makeInstagramUserRequest(tag_name) === false ) {
659
  jQuery(this).removeAttr('disabled', 'disabled');
660
  }
661
  });
662
+ jQuery('#wdi_add_user_ajax_input').on('keypress', function ( e ) {
663
+ // ToDo. what is this for.
664
  if ( e.keyCode == 13 ) {
665
+ if ( typeof jQuery('#wdi_add_user_ajax').prop('disabled') !== 'undefined' ) {
666
+ //return;
667
  }
668
  else {
669
+ jQuery('#wdi_add_user_ajax').prop('disabled', true);
670
  }
671
  var tag_name = jQuery('#wdi_add_user_ajax_input').val().trim().toLowerCase();
672
  if ( wdi_controller.makeInstagramUserRequest(tag_name) === false ) {
673
+ jQuery('#wdi_add_user_ajax').removeAttr('disabled', 'disabled');
674
  }
675
  return false; // prevent the button click from happening
676
  }
707
  this.feed_users.splice(i, 1);
708
  }
709
  }
 
710
  jQuery('#WDI_feed_users').val(this.stringifyUserData(this.feed_users));
711
+ $this.parent().remove();
712
  wdi_controller.changed_users();
713
  }
714
 
892
  jQuery('#wdi_add_user_ajax_input').val('');
893
  var profile_picture;
894
  if (typeof response != 'undefined') {
895
+ // ToDo. check all type
896
  profile_picture = (response['data'].length != 0 && typeof response['data'][0]['images']['thumbnail'] !== "undefined") ? response['data'][0]['images']['thumbnail']['url'] : '';
897
  } else {
898
  profile_picture = '';
899
  }
900
+ var feed_users = jQuery('#WDI_feed_users').val();
901
+ if ( this.isJsonString(feed_users) ) {
902
+ feed_users = JSON.parse(feed_users);
903
+ for ( var i = 0; i < feed_users.length; i++ ) {
904
+ var name = feed_users[i]['username'];
905
+ if ( name.charAt(0) !== '#' ) {
906
+ feed_users.splice(i, 1);
907
+ }
908
+ }
909
+ }
910
+ else {
911
+ feed_users = [];
912
+ }
913
  var tag_obj = {
914
  id: '#' + tagname,
915
  username: '#' + tagname,
916
  profile_picture: profile_picture,
917
  tag_id: response.tag_id
918
  };
919
+ feed_users.push(tag_obj);
920
+ this.feed_users = feed_users;
921
+ jQuery('#WDI_feed_users').val(this.stringifyUserData(this.feed_users));
922
+ }
923
+ else {
924
  alert(wdi_messages.invalid_hashtag);
925
  }
926
 
927
  this.updateConditionalFiltersUi();
 
928
  wdi_controller.saveFeedAfterAjaxWait(true);
 
929
  wdi_controller.changed_users();
930
  };
931
 
1527
  }
1528
  }
1529
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1530
 
1531
  function wdi_account_remove(user_name) {
1532
  jQuery.ajax({
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=JSON.parse(wdi_options.wdi_authenticated_users_list),r=0;for(var a in i)t+="<tr data-multiple-account='"+r+"'>",t+="<th>Access Token</th>",t+='<td><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][access_token][]" size="53" required="" value="'+i[a].access_token+'"></td>',t+="</tr>",t+="<tr data-multiple-account='"+r+"' 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="'+i[a].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="'+i[a].user_id+'">',t+="</tr>",r++;e.append(t)}jQuery(".wdi_remove_auth_user").on("click",function(e){e.preventDefault();var t=jQuery(this).closest(".wdi_username_tr").data("multiple-account");return jQuery(this).closest(".wdi_multiple_accounts_section").find('tr[data-multiple-account="'+t+'"]').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){var t=jQuery(e).val();return""!=t&&(!("delete_all"==t&&!confirm(wdi_messages.do_you_want_to_delete_selected_items))&&(wdi_spider_set_input_value("task",t),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,t;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,t=(jQuery('input[id^="check_pr_"]').length?parseInt(jQuery('input[id^="check_pr_"]').length):0)+e,jQuery("#check_all_items").prop("checked",!0),t&&(jQuery("#draganddrop").html("<strong><p>Selected "+t+" item"+(1<t?"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_refresh(e){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){e.success}})}function wdi_account_remove(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:t},success:function(e){e.success&&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+"']");d(t[i],r)}}else{var a,s=jQuery(e).data("section_name"),n=null;e.hasClass("wdi_section_open")?(d("show",e),n="show"):e.hasClass("wdi_section_close")&&(d("hide",e),n="hide"),null!=n&&((a=JSON.parse(localStorage.getItem("wdi_sections"))||{})[s]=n,localStorage.setItem("wdi_sections",JSON.stringify(a)))}}function d(e,t){var i;"show"===e?("table"===(i=t.closest(".wdi_section").find(".wdi_elements")).data("display")?i.css({display:"table"}):i.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>")}})}),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})}),wdi_controller.getParameterByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===t?"":decodeURIComponent(t[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"),r=jQuery("#wdi_refresh_section");wdi_controller.oldDisplayType={section:i,tab:t},wdi_controller.displayTypeMemory[t]=wdi_controller.oldDisplayType,null!=r&&r.attr("value",i);var a=jQuery(".wdi_border_wrapper .form-table");jQuery("#wdi_feed_type").attr("value",i);var s=0,n=!1;a.find(".wdi_element").each(function(){0;var e=jQuery(this).find(".wdwt_param").children().children().children().attr("section");if(void 0!==e){n=!1;var t=e.toLowerCase().trim().split(",");for(s=0;s<t.length;s++)t[s]===i&&(jQuery(this).css("display","block"),n=!0);!1===n&&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).trigger("click"):jQuery('.display_type[tab="'+e+'"]').first().find("input").trigger("click"):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=this.feed_users,n={};"cancel"==e&&(window.location=window.location.href),i=jQuery("#WDI_user_name option:selected").data("type"),r=jQuery("#WDI_user_name option:selected").val();var d=wdi_controller.getUserObj(r);if(!d)return alert(wdi_messages.user_field_required),!1;if(a={id:d.user_id,username:d.user_name},wdi_controller.checkIfUserNotSaved(e),0==wdi_controller.waitingAjaxRequestEnd.button){if(n=jQuery("#WDI_feed_users").val(),this.isJsonString(n))for(var l in n=JSON.parse(n))"#"===n[l].username.charAt(0)&&s.push(n[l]);s.push(a),jQuery("#WDI_feed_users").val(this.stringifyUserData(s)),jQuery("#wdi_feed_thumb").val(""),"business"==i&&jQuery("#wdi_feed_thumb").val(d.profile_picture_url),"apply_changes"!=e&&"save_feed"!=e||(t=jQuery("#wdi_add_or_edit").val(),jQuery("#wdi_current_id").val(t)),jQuery("#task").attr("value",e),jQuery("#wdi_save_feed").submit()}},wdi_controller.makeInstagramUserRequest=function(e,i){var t,r,a=this,s=this.getInputType(e),n="hashtag"===s;if(""==e)return alert(wdi_messages.please_write_hashtag),!1;if(""!=e&&!n)return alert(wdi_messages.invalid_hashtag),!1;if(a.checkForDuplicateUser(e))return alert(e+" "+wdi_messages.already_added),!1;switch(t=jQuery("#WDI_user_name option:selected").val(),(r=wdi_controller.getUserObj(t))&&(this.instagram.user=r),s){case"user":break;case"hashtag":var d=(d=e.substr(1,e.length)).replace(" ",""),l=jQuery("input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val();this.instagram.getTagRecentMedia(d,{success:function(e){jQuery("#wdi_add_user_ajax").removeAttr("disabled");var t=a.isValidResponse(e);t.valid&&a.hasData(e)?a.addHashtag(d,e):a.hasData(e)||"success"!=t.msg?alert(t.msg):1==i||confirm(wdi_messages.hashtag_no_data)?a.addHashtag(d,e):jQuery("#wdi_add_user_ajax_input").val("")}},null,l)}},wdi_controller.checkForDuplicateUser=function(e){for(var t=0;t<this.feed_users.length;t++)if(e==this.feed_users[t].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(){var e;void 0===jQuery(this).attr("disabled")&&(jQuery(this).attr("disabled","disabled"),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){if(void 0!==jQuery("#wdi_add_user_ajax").attr("disabled"))return;jQuery("#wdi_add_user_ajax").attr("disabled","disabled");var t=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();return!1===wdi_controller.makeInstagramUserRequest(t)&&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)}e.parent().remove(),jQuery("#WDI_feed_users").val(this.stringifyUserData(this.feed_users)),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){var t=("; "+document.cookie).split("; "+e+"=");if(2==t.length)return t.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){var i,r;null==e.match(/[~!@$%&*#^()<>?]/)?(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(""),r={id:"#"+e,username:"#"+e,profile_picture:void 0!==t&&0!=t.data.length&&void 0!==t.data[0].images.thumbnail?t.data[0].images.thumbnail.url:"",tag_id:t.tag_id},this.feed_users.push(r)):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,t=JSON.stringify(e);jQuery("#wdi_conditional_filters_textarea").val(t)},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").text():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=JSON.parse(wdi_options.wdi_authenticated_users_list),r=0;for(var a in i)t+="<tr data-multiple-account='"+r+"'>",t+="<th>Access Token</th>",t+='<td><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][access_token][]" size="53" required="" value="'+i[a].access_token+'"></td>',t+="</tr>",t+="<tr data-multiple-account='"+r+"' 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="'+i[a].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="'+i[a].user_id+'">',t+="</tr>",r++;e.append(t)}jQuery(".wdi_remove_auth_user").on("click",function(e){e.preventDefault();var t=jQuery(this).closest(".wdi_username_tr").data("multiple-account");return jQuery(this).closest(".wdi_multiple_accounts_section").find('tr[data-multiple-account="'+t+'"]').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){var t=jQuery(e).val();return""!=t&&(!("delete_all"==t&&!confirm(wdi_messages.do_you_want_to_delete_selected_items))&&(wdi_spider_set_input_value("task",t),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,t;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,t=(jQuery('input[id^="check_pr_"]').length?parseInt(jQuery('input[id^="check_pr_"]').length):0)+e,jQuery("#check_all_items").prop("checked",!0),t&&(jQuery("#draganddrop").html("<strong><p>Selected "+t+" item"+(1<t?"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(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:t},success:function(e){e.success&&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+"']");d(t[i],r)}}else{var a,s=jQuery(e).data("section_name"),n=null;e.hasClass("wdi_section_open")?(d("show",e),n="show"):e.hasClass("wdi_section_close")&&(d("hide",e),n="hide"),null!=n&&((a=JSON.parse(localStorage.getItem("wdi_sections"))||{})[s]=n,localStorage.setItem("wdi_sections",JSON.stringify(a)))}}function d(e,t){var i;"show"===e?("table"===(i=t.closest(".wdi_section").find(".wdi_elements")).data("display")?i.css({display:"table"}):i.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})}),wdi_controller.getParameterByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===t?"":decodeURIComponent(t[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"),r=jQuery("#wdi_refresh_section");wdi_controller.oldDisplayType={section:i,tab:t},wdi_controller.displayTypeMemory[t]=wdi_controller.oldDisplayType,null!=r&&r.attr("value",i);var a=jQuery(".wdi_border_wrapper .form-table");jQuery("#wdi_feed_type").attr("value",i);var s=0,n=!1;a.find(".wdi_element").each(function(){0;var e=jQuery(this).find(".wdwt_param").children().children().children().attr("section");if(void 0!==e){n=!1;var t=e.toLowerCase().trim().split(",");for(s=0;s<t.length;s++)t[s]===i&&(jQuery(this).css("display","block"),n=!0);!1===n&&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).trigger("click"):jQuery('.display_type[tab="'+e+'"]').first().find("input").trigger("click"):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=[],n={};"cancel"==e&&(window.location=window.location.href),i=jQuery("#WDI_user_name option:selected").data("type"),r=jQuery("#WDI_user_name option:selected").val();var d=wdi_controller.getUserObj(r);if(!d)return alert(wdi_messages.user_field_required),!1;if(a={id:d.user_id,username:d.user_name},wdi_controller.checkIfUserNotSaved(e),0==wdi_controller.waitingAjaxRequestEnd.button){if(n=jQuery("#WDI_feed_users").val(),this.isJsonString(n))for(var l in n=JSON.parse(n))"#"===n[l].username.charAt(0)&&s.push(n[l]);s.push(a),jQuery("#WDI_feed_users").val(this.stringifyUserData(s)),jQuery("#wdi_feed_thumb").val(""),"business"==i&&jQuery("#wdi_feed_thumb").val(d.profile_picture_url),"apply_changes"!=e&&"save_feed"!=e||(t=jQuery("#wdi_add_or_edit").val(),jQuery("#wdi_current_id").val(t)),jQuery("#task").attr("value",e),jQuery("#wdi_save_feed").submit()}},wdi_controller.makeInstagramUserRequest=function(e,i){var t,r,a=this,s=this.getInputType(e),n="hashtag"===s;if(""==e)return alert(wdi_messages.please_write_hashtag),!1;if(""!=e&&!n)return alert(wdi_messages.invalid_hashtag),!1;if(a.checkForDuplicateUser(e))return alert(e+" "+wdi_messages.already_added),!1;switch(t=jQuery("#WDI_user_name option:selected").val(),(r=wdi_controller.getUserObj(t))&&(this.instagram.user=r),s){case"user":break;case"hashtag":var d=(d=e.substr(1,e.length)).replace(" ",""),l=jQuery("input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val();this.instagram.getTagRecentMedia(d,{success:function(e){jQuery("#wdi_add_user_ajax").removeAttr("disabled");var t=a.isValidResponse(e);t.valid&&a.hasData(e)?a.addHashtag(d,e):a.hasData(e)||"success"!=t.msg?alert(t.msg):1==i||confirm(wdi_messages.hashtag_no_data)?a.addHashtag(d,e):jQuery("#wdi_add_user_ajax_input").val("")}},null,l)}},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);var t=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();return!1===wdi_controller.makeInstagramUserRequest(t)&&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){var t=("; "+document.cookie).split("; "+e+"=");if(2==t.length)return t.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,r=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(r),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 a=jQuery("#WDI_feed_users").val();if(this.isJsonString(a)){a=JSON.parse(a);for(var s=0;s<a.length;s++){"#"!==a[s].username.charAt(0)&&a.splice(s,1)}}else a=[];var n={id:"#"+e,username:"#"+e,profile_picture:i,tag_id:t.tag_id};a.push(n),this.feed_users=a,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,t=JSON.stringify(e);jQuery("#wdi_conditional_filters_textarea").val(t)},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").text():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
@@ -105,7 +105,6 @@ wdi_front.globalInit = function () {
105
  if (typeof wdi_ajax.ajax_response != "undefined") {
106
  var init_feed_counter = wdi_feed_counter_init.wdi_feed_counter_init;
107
  }
108
-
109
  for (var i = init_feed_counter; i <= num; i++) {
110
 
111
  if(jQuery('#wdi_feed_' + i).length === 0) { //conflict with Yoast SEO, Page Builder by SiteOrigin
@@ -124,44 +123,6 @@ wdi_front.globalInit = function () {
124
  feed: currentFeed
125
  };
126
 
127
- currentFeed.instagram.filters = [
128
- {
129
- 'where': 'getUserRecentMedia',
130
- 'what': function (response, args, cArgs)
131
- {
132
- return args.feed.conditionalFilter(response, cArgs);
133
- }
134
- },
135
- {
136
- 'where': 'getUserMedia',
137
- 'what': function (response, args, cArgs)
138
- {
139
- return args.feed.conditionalFilter(response, cArgs);
140
- }
141
- },
142
- {
143
- 'where': 'getTagRecentMedia',
144
- 'what': function (response, args, cArgs)
145
- {
146
- return args.feed.conditionalFilter(response, cArgs);
147
- }
148
- },
149
- {
150
- 'where': 'getRecentLikedMedia',
151
- 'what': function (response, args, cArgs)
152
- {
153
- return args.feed.conditionalFilter(response, cArgs);
154
- }
155
- },
156
- {
157
- 'where': 'requestByUrl',
158
- 'what': function (response, args, cArgs)
159
- {
160
- return args.feed.conditionalFilter(response, cArgs);
161
- }
162
- }
163
- ];
164
-
165
  currentFeed.instagram.addToken(currentFeed['feed_row']['access_token']);
166
 
167
  wdi_front.access_token = currentFeed['feed_row']['access_token'];
@@ -919,7 +880,7 @@ wdi_front.getArrayContentLength = function (array, data)
919
  {
920
  var sum = 0;
921
  for (var i = 0; i < array.length; i++) {
922
- if (array[i]['finished'] == 'finished') {
923
  continue;
924
  }
925
  sum += array[i][data].length;
@@ -975,7 +936,9 @@ wdi_front.displayFeedItems = function (data, currentFeed) {
975
 
976
 
977
  for (var i = 0; i < data.length; i++) {
978
-
 
 
979
  if ( typeof data[i]['videos'] === 'object' ) {
980
  if ( data[i]['videos'].standard_resolution == null ) {
981
  continue;
@@ -1353,12 +1316,8 @@ wdi_front.smartPicker = function (currentFeed, load_more_number)
1353
  /*
1354
  * returns json object for inserting photo template
1355
  */
1356
- wdi_front.createObject = function (obj, currentFeed)
1357
- {
1358
  var caption = (obj['caption'] != null) ? obj['caption']['text'] : '&nbsp';
1359
- /*
1360
- @TODO need to change video default image
1361
- */
1362
  var videoUrl = wdi_url.plugin_url + "images/video_missing.png";
1363
  if ( obj['type'] == 'video' && obj['videos'][currentFeed.feedVideoResolution] && obj['videos'][currentFeed.feedVideoResolution]['url'] != null ) {
1364
  videoUrl = obj.hasOwnProperty('videos') ? obj['videos'][currentFeed.feedVideoResolution]['url'] : '';
@@ -1372,7 +1331,7 @@ wdi_front.createObject = function (obj, currentFeed)
1372
  var image_url = obj.carousel_media[0].images[currentFeed.feedImageResolution].url;
1373
  }
1374
  else if ( typeof obj.carousel_media[0].videos !== 'undefined' ) {
1375
- var image_url = obj.carousel_media[0].videos['standard_resolution'].url;
1376
  }
1377
  }
1378
  else {
@@ -1805,7 +1764,6 @@ wdi_front.bindEvents = function (currentFeed)
1805
  {
1806
  //do the actual load more operation
1807
  wdi_front.loadMore(jQuery(this).find('.wdi_load_more_wrap'));
1808
-
1809
  });
1810
  }
1811
 
@@ -1843,7 +1801,6 @@ wdi_front.bindEvents = function (currentFeed)
1843
 
1844
  wdi_front.infiniteScroll = function (currentFeed)
1845
  {
1846
-
1847
  if ((jQuery(window).scrollTop() + jQuery(window).height() - 100) >= jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_infinite_scroll').offset().top) {
1848
  if (currentFeed.infiniteScrollFlag === false && currentFeed.stopInfiniteScrollFlag == false) {
1849
  currentFeed.infiniteScrollFlag = true;
@@ -2063,7 +2020,6 @@ wdi_front.loadMore = function (button, _currentFeed) {
2063
  user_id: usersData[i]['user_id'],
2064
  username: usersData[i]['username']
2065
  }
2066
-
2067
  //checking if pagination url exists then load images, else skip
2068
  if (pagination['next_url'] != '' && pagination['next_url'] != null && typeof pagination['next_url'] != 'undefined') {
2069
  var next_url = pagination['next_url'];
@@ -2125,6 +2081,7 @@ wdi_front.loadMoreRequest = function (user, next_url, currentFeed, button) {
2125
  currentFeed.temproraryUsersData[i] = currentFeed.usersData[i];
2126
  }
2127
  currentFeed['usersData'][i] = response;
 
2128
  currentFeed.loadMoreDataCount--;
2129
  }
2130
  }
@@ -2137,10 +2094,10 @@ wdi_front.loadMoreRequest = function (user, next_url, currentFeed, button) {
2137
  }
2138
  else {
2139
  currentFeed.instagram.getTagRecentMedia(user.username, {
2140
- success: success_function
2141
  },
2142
- next_url,
2143
- currentFeed.feed_row.hashtag_top_recent
2144
  )
2145
  }
2146
  }
@@ -2734,24 +2691,31 @@ wdi_front.parseLighboxData = function (currentFeed, filterFlag) {
2734
  data.sort(sortOperator);
2735
  }
2736
  for (i = 0; i < data.length; i++) {
2737
- var thumb_url = (typeof data[i]['media_url'] !== 'undefined') ? data[i]['media_url'] : wdi_url.plugin_url + 'images/video_missing.png';
2738
- if ( typeof data[i]['media_url'] === 'undefined' ) {
 
 
 
2739
  if ( data[i]['type'] === 'carousel' ) {
2740
  var carousel_media = data[i]['carousel_media'][0];
2741
- if ( typeof carousel_media['images'] !== 'undefined' ) {
2742
  thumb_url = carousel_media['images']['standard_resolution']['url'];
2743
  }
2744
- else if ( typeof carousel_media['videos'] !== 'undefined' ) {
2745
  thumb_url = carousel_media['videos']['standard_resolution']['url'];
2746
  }
2747
  }
2748
  }
 
 
 
 
2749
  obj = {
2750
  'alt': '',
2751
  'avg_rating': '',
2752
- 'comment_count': data[i]['comments']['count'],
2753
  'date': wdi_front.convertUnixDate(data[i]['created_time']),
2754
- 'description': wdi_front.getDescription((data[i]['caption'] !== null) ? wdi_front.escape_tags(data[i]['caption']['text']) : ''),
2755
  'filename': wdi_front.getFileName(data[i]),
2756
  'filetype': wdi_front.getFileType(data[i]),
2757
  'hit_count': '0',
@@ -2797,14 +2761,17 @@ wdi_front.getDescription = function (desc)
2797
 
2798
  wdi_front.getFileName = function (data)
2799
  {
2800
- var link = data['link'];
2801
- var type = data['type'];
2802
- /*if pure video, not carousel*/
2803
- if ( type === 'video' && data.hasOwnProperty('videos') && data['videos']['standard_resolution'] != null ) {
2804
- return data['videos']['standard_resolution']['url'];
2805
- } else {
2806
- var linkFragments = link.split('/');
2807
- return linkFragments[linkFragments.length - 2];
 
 
 
2808
  }
2809
  }
2810
 
@@ -3039,155 +3006,6 @@ var WDIFeed = function (obj)
3039
  this.set_images_loading_flag(_this);
3040
  };
3041
 
3042
- /**
3043
- * Iterates through all filter objects and filters response accroding to them
3044
- * @param {Object} response [instagram API response]
3045
- * @param {Object} args [some custom arguments ]
3046
- * @return {Object} [instagram API response]
3047
- */
3048
- WDIFeed.prototype.conditionalFilter = function (response, args)
3049
- {
3050
- var currentFeed = this,
3051
- conditional_filter_type = currentFeed.feed_row.conditional_filter_type,
3052
- filters = currentFeed.feed_row.conditional_filters;
3053
-
3054
-
3055
- if (args.ignoreFiltering == true) {
3056
-
3057
- } else {
3058
-
3059
- /**
3060
- * Get rid of duplicate media
3061
- */
3062
- response = this.avoidDuplicateMedia(response);
3063
- }
3064
-
3065
- //if filters json is invalid then return response without filtering
3066
- if (!wdi_front.isJsonString(filters)) {
3067
- return response;
3068
- } else {
3069
- filters = JSON.parse(filters);
3070
- if (typeof filters !=="undefined" && filters.length == 0) {
3071
- return response;
3072
- }
3073
- }
3074
-
3075
-
3076
- if (currentFeed.feed_row.conditional_filter_enable == '0') {
3077
- return response;
3078
- }
3079
- //increase counter for determing request count if this counter is more then
3080
- //currentFeed.maxConditionalFiltersRequestCount then program will terminate recursion loop
3081
- currentFeed.instagramRequestCounter++;
3082
-
3083
- switch (conditional_filter_type) {
3084
- case 'AND':
3085
- {
3086
- response = this.applyANDLogic(response, filters, currentFeed);
3087
- break;
3088
- }
3089
- case 'OR':
3090
- {
3091
- response = this.applyORLogic(response, filters, currentFeed)
3092
- break;
3093
- }
3094
- case 'NOR':
3095
- {
3096
- response = this.applyNORLogic(response, filters, currentFeed)
3097
- break;
3098
- }
3099
- default:
3100
- {
3101
- break;
3102
- }
3103
- }
3104
-
3105
-
3106
- return response;
3107
- }
3108
-
3109
-
3110
- /**
3111
- * Return those elements which meet filters conditions
3112
- * @param {Object} response [instagram API response]
3113
- * @param {Array} filters [Array of filter objects]
3114
- * @return {Object} [filtered response]
3115
- */
3116
- WDIFeed.prototype.applyANDLogic = function (response, filters)
3117
- {
3118
- var currentFeed = this;
3119
- for (var i = 0; i < filters.length; i++) {
3120
- response = this.filterResponse(response, filters[i]);
3121
- }
3122
-
3123
- return response;
3124
- }
3125
-
3126
- /**
3127
- * Return those elements which meet filters conditions
3128
- * @param {Object} response [instagram API response]
3129
- * @param {Array} filters [Array of filter objects]
3130
- * @return {Object} [filtered response]
3131
- */
3132
- WDIFeed.prototype.applyORLogic = function (response, filters)
3133
- {
3134
- var currentFeed = this;
3135
- var allData = [],
3136
- res,
3137
- mergedData = [],
3138
- returnObject,
3139
- media;
3140
-
3141
- for (var i = 0; i < filters.length; i++) {
3142
- res = this.filterResponse(response, filters[i]);
3143
- allData = allData.concat(res['data']);
3144
- res = {};
3145
- }
3146
-
3147
- for (i = 0; i < allData.length; i++) {
3148
- media = allData[i];
3149
- if (!this.mediaExists(media, mergedData) && !this.mediaExists(media, currentFeed.dataStorageList)) {
3150
- mergedData.push(media);
3151
- }
3152
- }
3153
-
3154
- returnObject = {
3155
- data: mergedData,
3156
- meta: response['meta'],
3157
- pagination: response['pagination']
3158
- }
3159
- return returnObject;
3160
- }
3161
-
3162
-
3163
- /**
3164
- * Return those elements which meet filters conditions
3165
- * @param {Object} response [instagram API response]
3166
- * @param {Array} filters [Array of filter objects]
3167
- * @return {Object} [filtered response]
3168
- */
3169
- WDIFeed.prototype.applyNORLogic = function (response, filters)
3170
- {
3171
- var res = response,
3172
- currentFeed = this,
3173
- matchedData = this.applyORLogic(response, filters, currentFeed),
3174
- mergedData = [],
3175
- returnObject;
3176
-
3177
- for (var i = 0; i < res['data'].length; i++) {
3178
- if (!this.mediaExists(res['data'][i], matchedData['data'])) {
3179
- mergedData.push(res['data'][i]);
3180
- }
3181
- }
3182
-
3183
- returnObject = {
3184
- data: mergedData,
3185
- meta: res['meta'],
3186
- pagination: res['pagination']
3187
- }
3188
- return returnObject;
3189
- }
3190
-
3191
 
3192
  WDIFeed.prototype.mediaExists = function (media, array)
3193
  {
@@ -3201,247 +3019,6 @@ WDIFeed.prototype.mediaExists = function (media, array)
3201
  }
3202
 
3203
 
3204
- /**
3205
- * checks filter type and calls corresponding function for filtering
3206
- * @param {Object} response [instagram API response]
3207
- * @param {Object} filter [filter object created in backend]
3208
- * @return {Object} [filtered response]
3209
- */
3210
- WDIFeed.prototype.filterResponse = function (response, filter)
3211
- {
3212
- switch (filter.filter_type) {
3213
- case 'hashtag':
3214
- {
3215
- return this.filterByHashtag(response, filter);
3216
- break;
3217
- }
3218
- case 'username':
3219
- {
3220
- return this.filterByUsername(response, filter);
3221
- break;
3222
- }
3223
- case 'mention':
3224
- {
3225
- return this.filterByMention(response, filter);
3226
- break;
3227
- }
3228
- case 'description':
3229
- {
3230
- return this.filterByDescription(response, filter);
3231
- break;
3232
- }
3233
- case 'location':
3234
- {
3235
- return this.filterByLocation(response, filter);
3236
- break;
3237
- }
3238
- case 'url':
3239
- {
3240
- return this.filterByUrl(response, filter);
3241
- break;
3242
- }
3243
- }
3244
- }
3245
-
3246
-
3247
- /**
3248
- * filters data by given hastag filter and returns filtered response
3249
- * @param {Object} response [instagram API response]
3250
- * @param {Object} filter [hashtag filter object]
3251
- * @return {Object} [filtered response]
3252
- */
3253
-
3254
-
3255
- WDIFeed.prototype.filterByHashtag = function (response, filter)
3256
- {
3257
- var filteredResponse = [],
3258
- currentTag,
3259
- media,
3260
- returnObject;
3261
- for (var i = 0; i < response['data'].length; i++) {
3262
- media = response['data'][i];
3263
-
3264
- if(typeof media['tags'] == 'undefined' ) {
3265
- continue;
3266
- }
3267
- for (var j = 0; j < media['tags'].length; j++) {
3268
- tag = media['tags'][j];
3269
- var tag1 = tag.toLowerCase();
3270
- var tag2 = filter.filter_by.toLowerCase();
3271
-
3272
- if (tag1.trim() == tag2.trim()) {
3273
-
3274
- filteredResponse.push(media);
3275
- }
3276
- }
3277
- }
3278
-
3279
-
3280
- returnObject = {
3281
- data: filteredResponse,
3282
- meta: response['meta'],
3283
- pagination: response['pagination']
3284
- }
3285
- return returnObject;
3286
- }
3287
-
3288
- /**
3289
- * filters data by given username filter and returns filtered response
3290
- * @param {Object} response [instagram API response]
3291
- * @param {Object} filter [hashtag filter object]
3292
- * @return {Object} [filtered response]
3293
- */
3294
- WDIFeed.prototype.filterByUsername = function (response, filter)
3295
- {
3296
- var filteredResponse = [],
3297
- media,
3298
- returnObject;
3299
-
3300
- for (var i = 0; i < response['data'].length; i++) {
3301
- media = response['data'][i];
3302
- if (media.user.username.toLowerCase() == filter.filter_by.toLowerCase()) {
3303
- filteredResponse.push(media);
3304
- }
3305
- }
3306
-
3307
-
3308
- returnObject = {
3309
- data: filteredResponse,
3310
- meta: response['meta'],
3311
- pagination: response['pagination']
3312
- }
3313
- return returnObject;
3314
- }
3315
-
3316
-
3317
- /**
3318
- * filters data by given mention filter and returns filtered response
3319
- * @param {Object} response [instagram API response]
3320
- * @param {Object} filter [hashtag filter object]
3321
- * @return {Object} [filtered response]
3322
- */
3323
- WDIFeed.prototype.filterByMention = function (response, filter)
3324
- {
3325
- var filteredResponse = [],
3326
- media, captionText, returnObject;
3327
- for (var i = 0; i < response['data'].length; i++) {
3328
- media = response['data'][i];
3329
- if (media['caption'] !== null) {
3330
- captionText = media['caption']['text'].toLowerCase();
3331
- if (captionText.indexOf('@' + filter.filter_by.toLowerCase()) != -1) {
3332
-
3333
- filteredResponse.push(media);
3334
- }
3335
- }
3336
- }
3337
-
3338
- returnObject = {
3339
- data: filteredResponse,
3340
- meta: response['meta'],
3341
- pagination: response['pagination']
3342
- }
3343
- return returnObject;
3344
- }
3345
-
3346
-
3347
- /**
3348
- * filters data by given description filter and returns filtered response
3349
- * @param {Object} response [instagram API response]
3350
- * @param {Object} filter [hashtag filter object]
3351
- * @return {Object} [filtered response]
3352
- */
3353
- WDIFeed.prototype.filterByDescription = function (response, filter)
3354
- {
3355
- var filteredResponse = [],
3356
- media, captionText, returnObject;
3357
-
3358
- for (var i = 0; i < response['data'].length; i++) {
3359
- media = response['data'][i];
3360
- if (media['caption'] !== null) {
3361
-
3362
- captionText = media['caption']['text'].toLowerCase();
3363
- captionText = wdi_front.replaceNewLines(captionText);
3364
- var searchkey = filter.filter_by.toLowerCase();
3365
-
3366
- if (wdi_front.regexpTestCaption(captionText, searchkey)) {
3367
- filteredResponse.push(media);
3368
- }
3369
- }
3370
- }
3371
-
3372
- returnObject = {
3373
- data: filteredResponse,
3374
- meta: response['meta'],
3375
- pagination: response['pagination']
3376
- }
3377
-
3378
- return returnObject;
3379
- }
3380
-
3381
-
3382
- /**
3383
- * filters data by given location filter and returns filtered response
3384
- * @param {Object} response [instagram API response]
3385
- * @param {Object} filter [hashtag filter object]
3386
- * @return {Object} [filtered response]
3387
- */
3388
- WDIFeed.prototype.filterByLocation = function (response, filter)
3389
- {
3390
- var filteredResponse = [],
3391
- media, locationId, returnObject;
3392
- for (var i = 0; i < response['data'].length; i++) {
3393
- media = response['data'][i];
3394
-
3395
- if (media['location'] !== null) {
3396
- locationId = media['location']['id'];
3397
- if (locationId == filter.filter_by) {
3398
- filteredResponse.push(media);
3399
- }
3400
- }
3401
- }
3402
-
3403
- returnObject = {
3404
- data: filteredResponse,
3405
- meta: response['meta'],
3406
- pagination: response['pagination']
3407
- }
3408
- return returnObject;
3409
- }
3410
-
3411
-
3412
- /**
3413
- * filters data by given url filter and returns filtered response
3414
- * @param {Object} response [instagram API response]
3415
- * @param {Object} filter [hashtag filter object]
3416
- * @return {Object} [filtered response]
3417
- */
3418
-
3419
- WDIFeed.prototype.filterByUrl = function (response, filter)
3420
- {
3421
- var filteredResponse = [],
3422
- media, id, returnObject, filter_by;
3423
-
3424
- filter.filter_by = this.getIdFromUrl(filter.filter_by);
3425
-
3426
- for (var i = 0; i < response['data'].length; i++) {
3427
- media = response['data'][i];
3428
-
3429
- if (media['link'] !== null) {
3430
- id = this.getIdFromUrl(media['link']);
3431
- if (id == filter.filter_by) {
3432
- filteredResponse.push(media);
3433
- }
3434
- }
3435
- }
3436
-
3437
- returnObject = {
3438
- data: filteredResponse,
3439
- meta: response['meta'],
3440
- pagination: response['pagination']
3441
- }
3442
- return returnObject;
3443
- }
3444
-
3445
  /**
3446
  * gets id of media from url, this id is not the one which comes with api request
3447
  * @param {String} url [media url]
105
  if (typeof wdi_ajax.ajax_response != "undefined") {
106
  var init_feed_counter = wdi_feed_counter_init.wdi_feed_counter_init;
107
  }
 
108
  for (var i = init_feed_counter; i <= num; i++) {
109
 
110
  if(jQuery('#wdi_feed_' + i).length === 0) { //conflict with Yoast SEO, Page Builder by SiteOrigin
123
  feed: currentFeed
124
  };
125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  currentFeed.instagram.addToken(currentFeed['feed_row']['access_token']);
127
 
128
  wdi_front.access_token = currentFeed['feed_row']['access_token'];
880
  {
881
  var sum = 0;
882
  for (var i = 0; i < array.length; i++) {
883
+ if (array[i]['finished'] == 'finished' || (typeof array[i]['error'] !== 'undefined')) {
884
  continue;
885
  }
886
  sum += array[i][data].length;
936
 
937
 
938
  for (var i = 0; i < data.length; i++) {
939
+ if( typeof data[i] == 'undefined') {
940
+ return;
941
+ }
942
  if ( typeof data[i]['videos'] === 'object' ) {
943
  if ( data[i]['videos'].standard_resolution == null ) {
944
  continue;
1316
  /*
1317
  * returns json object for inserting photo template
1318
  */
1319
+ wdi_front.createObject = function (obj, currentFeed) {
 
1320
  var caption = (obj['caption'] != null) ? obj['caption']['text'] : '&nbsp';
 
 
 
1321
  var videoUrl = wdi_url.plugin_url + "images/video_missing.png";
1322
  if ( obj['type'] == 'video' && obj['videos'][currentFeed.feedVideoResolution] && obj['videos'][currentFeed.feedVideoResolution]['url'] != null ) {
1323
  videoUrl = obj.hasOwnProperty('videos') ? obj['videos'][currentFeed.feedVideoResolution]['url'] : '';
1331
  var image_url = obj.carousel_media[0].images[currentFeed.feedImageResolution].url;
1332
  }
1333
  else if ( typeof obj.carousel_media[0].videos !== 'undefined' ) {
1334
+ var image_url = wdi_url.plugin_url + 'images/video_missing.png'; //obj.carousel_media[0].videos['standard_resolution'].url;
1335
  }
1336
  }
1337
  else {
1764
  {
1765
  //do the actual load more operation
1766
  wdi_front.loadMore(jQuery(this).find('.wdi_load_more_wrap'));
 
1767
  });
1768
  }
1769
 
1801
 
1802
  wdi_front.infiniteScroll = function (currentFeed)
1803
  {
 
1804
  if ((jQuery(window).scrollTop() + jQuery(window).height() - 100) >= jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_infinite_scroll').offset().top) {
1805
  if (currentFeed.infiniteScrollFlag === false && currentFeed.stopInfiniteScrollFlag == false) {
1806
  currentFeed.infiniteScrollFlag = true;
2020
  user_id: usersData[i]['user_id'],
2021
  username: usersData[i]['username']
2022
  }
 
2023
  //checking if pagination url exists then load images, else skip
2024
  if (pagination['next_url'] != '' && pagination['next_url'] != null && typeof pagination['next_url'] != 'undefined') {
2025
  var next_url = pagination['next_url'];
2081
  currentFeed.temproraryUsersData[i] = currentFeed.usersData[i];
2082
  }
2083
  currentFeed['usersData'][i] = response;
2084
+ currentFeed['dataStorageRaw'][i]['data'] = currentFeed['dataStorageRaw'][i]['data'].concat(response['data']);
2085
  currentFeed.loadMoreDataCount--;
2086
  }
2087
  }
2094
  }
2095
  else {
2096
  currentFeed.instagram.getTagRecentMedia(user.username, {
2097
+ success: success_function,
2098
  },
2099
+ next_url,
2100
+ currentFeed.feed_row.hashtag_top_recent
2101
  )
2102
  }
2103
  }
2691
  data.sort(sortOperator);
2692
  }
2693
  for (i = 0; i < data.length; i++) {
2694
+ if( typeof data[i] === 'undefined' ) {
2695
+ continue;
2696
+ }
2697
+ var thumb_url = (typeof data[i] !== 'undefined' && typeof data[i]['media_url'] !== 'undefined') ? data[i]['media_url'] : wdi_url.plugin_url + 'images/video_missing.png';
2698
+ if ( typeof data[i] !== 'undefined' && typeof data[i]['media_url'] === 'undefined' ) {
2699
  if ( data[i]['type'] === 'carousel' ) {
2700
  var carousel_media = data[i]['carousel_media'][0];
2701
+ if ( typeof carousel_media !== 'undefined' && typeof carousel_media['images'] !== 'undefined' ) {
2702
  thumb_url = carousel_media['images']['standard_resolution']['url'];
2703
  }
2704
+ else if ( typeof carousel_media !== 'undefined' && typeof carousel_media['videos'] !== 'undefined' ) {
2705
  thumb_url = carousel_media['videos']['standard_resolution']['url'];
2706
  }
2707
  }
2708
  }
2709
+ var comment_count = 0;
2710
+ if( typeof data[i] !== 'undefined' && typeof data[i]['comments'] !== "undefined" ) {
2711
+ comment_count = data[i]['comments']['count'];
2712
+ }
2713
  obj = {
2714
  'alt': '',
2715
  'avg_rating': '',
2716
+ 'comment_count': comment_count,
2717
  'date': wdi_front.convertUnixDate(data[i]['created_time']),
2718
+ 'description': wdi_front.getDescription((typeof data[i]['caption'] !== 'undefined' && data[i]['caption'] !== null) ? wdi_front.escape_tags(data[i]['caption']['text']) : ''),
2719
  'filename': wdi_front.getFileName(data[i]),
2720
  'filetype': wdi_front.getFileType(data[i]),
2721
  'hit_count': '0',
2761
 
2762
  wdi_front.getFileName = function (data)
2763
  {
2764
+ if( typeof data !== 'undefined' ) {
2765
+ var link = data['link'];
2766
+ var type = data['type'];
2767
+ /*if pure video, not carousel*/
2768
+ if (type === 'video' && data.hasOwnProperty('videos') && data['videos']['standard_resolution'] != null) {
2769
+ return data['videos']['standard_resolution']['url'];
2770
+ }
2771
+ else {
2772
+ var linkFragments = link.split('/');
2773
+ return linkFragments[linkFragments.length - 2];
2774
+ }
2775
  }
2776
  }
2777
 
3006
  this.set_images_loading_flag(_this);
3007
  };
3008
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3009
 
3010
  WDIFeed.prototype.mediaExists = function (media, array)
3011
  {
3019
  }
3020
 
3021
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3022
  /**
3023
  * gets id of media from url, this id is not the one which comes with api request
3024
  * @param {String} url [media url]
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(){return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())?"touchend":"click"}),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,t){var r,a,d,o;t=jQuery("#wdi_feed_"+t.feed_row.wdi_feed_counter),400===i.meta.code&&"APINotAllowedError"===i.meta.error_type&&(void 0!==i.wdi_current_feed_name&&(r=i.wdi_current_feed_name,void 0===(a=t.find(".wdi_private_feed_names")).attr("wdi_first_private_user")?a.attr("wdi_first_private_user",1):r=", "+r,a.append(r),t.find(".wdi_private_feed_error").removeClass("wdi_hidden")),t.find(".wdi_spinner").remove()),void 0!==t&&"APINotAllowedError"!=i.meta.error_type&&(t.find(".wdi_spinner").remove(),wdi_error_show=!0,d=t.find(".wdi_js_error"),o=t.find(".wdi_token_error"),0!=i&&null!=typeof i.meta&&"OAuthAccessTokenException"===i.meta.error_type?(o.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){}})):(d.removeClass("wdi_js_error"),d.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 t,r=i;r<=e;r++){0!==jQuery("#wdi_feed_"+r).length&&((t=new WDIFeed(window["wdi_feed_"+r])).instagram=new WDIInstagram,t.instagram.filterArguments={feed:t},t.instagram.filters=[{where:"getUserRecentMedia",what:function(e,i,t){return i.feed.conditionalFilter(e,t)}},{where:"getUserMedia",what:function(e,i,t){return i.feed.conditionalFilter(e,t)}},{where:"getTagRecentMedia",what:function(e,i,t){return i.feed.conditionalFilter(e,t)}},{where:"getRecentLikedMedia",what:function(e,i,t){return i.feed.conditionalFilter(e,t)}},{where:"requestByUrl",what:function(e,i,t){return i.feed.conditionalFilter(e,t)}}],t.instagram.addToken(t.feed_row.access_token),wdi_front.access_token=t.feed_row.access_token,t.dataStorageRaw=[],t.dataStorage=[],t.dataStorageList=[],t.allResponseLength=0,t.currentResponseLength=0,t.temproraryUsersData=[],t.removedUsers=0,t.nowLoadingImages=!0,t.imageIndex=0,t.resIndex=0,t.currentPage=1,t.userSortFlags=[],t.customFilterChanged=!1,t.maxConditionalFiltersRequestCount=10,t.instagramRequestCounter=0,t.mediaRequestsDone=!1,t.conditionalFilterBuffer=[],t.stopInfiniteScrollFlag=!1,"masonry"==t.feed_row.feed_type&&(t.displayedData=[]),"pagination"==t.feed_row.feed_display_view?(t.feed_row.resort_after_load_more=0,"image_browser"!=t.feed_row.feed_type?(t.feed_row.load_more_number=parseInt(t.feed_row.pagination_per_page_number),t.feed_row.number_of_photos=(1+parseInt(t.feed_row.pagination_preload_number))*t.feed_row.load_more_number):(t.feed_row.number_of_photos=1+parseInt(t.feed_row.image_browser_preload_number),t.feed_row.load_more_number=parseInt(t.feed_row.image_browser_load_number)),t.freeSpaces=(Math.floor(t.feed_row.pagination_per_page_number/t.feed_row.number_of_columns)+1)*t.feed_row.number_of_columns-t.feed_row.pagination_per_page_number):t.freeSpaces=0,t.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(t),"masonry"==t.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(t),window["wdi_feed_"+r]=t,wdi_front.init(t))}},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=[],t=[],r=[];void 0!==window.wdi_all_tags&&(i=window.wdi_all_tags);for(var a=0;a<e.feed_users.length;a++)"#"===e.feed_users[a].username[0]&&void 0!==e.feed_users[a].tag_id?(i[e.feed_users[a].tag_id]=e.feed_users[a],r[a]=e.feed_users[a]):t[0]=e.feed_users[a];window.wdi_all_tags=i,e.feed_users=void 0===r||wdi_front.isEmpty(r)?t:r;var d=wdi_front.getFeedItemResolution(e);e.feedImageResolution=d.image,e.feedVideoResolution=d.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 t=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");t.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>'),wdi_responsive.columnControl(e,1);var r=t.attr("wdi-res").split("wdi_col_");if(t.find("#wdi_feed_item_example").remove(),2!==r.length)return i;var a=parseInt(r[1]);if(a<=0)return i;var d=t.width()/a-10,o=i;return d<=150?(o.image="thumbnail",o.video="low_bandwidth"):150<d&&d<=320?(o.image="low_resolution",o.video="low_resolution"):(o.image="standard_resolution",o.video="standard_resolution"),o},wdi_front.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_front.instagramRequest=function(i,t){var r=this,a=t.feed_users;"string"==typeof a[i]&&"self"===a[i]?t.instagram.getRecentLikedMedia({success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,t),t.mediaRequestsDone=!0,0!=(e=r.checkMediaResponse(e,t))&&r.saveSelfUserData(e,t)}}):"hashtag"==this.getInputType(a[i].username)?t.instagram.getTagRecentMedia(this.stripHashtag(a[i].username),{success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,t),t.mediaRequestsDone=!0,0!=(e=r.checkMediaResponse(e,t))&&r.saveUserData(e,t.feed_users[i],t)}},null,t.feed_row.hashtag_top_recent):"user"==this.getInputType(a[i].username)&&t.instagram.getUserMedia({user_id:a[i].id,success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&(e.wdi_current_feed_name=a[i].username,wdi_front.show_alert(!1,e,t)),t.mediaRequestsDone=!0,0!=(e=r.checkMediaResponse(e,t))&&r.saveUserData(e,t.feed_users[i],t)}})},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,i,t){var r;e.user_id=i.id,e.username=i.username,"#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),t.usersData.push(e),t.currentResponseLength=wdi_front.getArrayContentLength(t.usersData,"data"),t.allResponseLength+=t.currentResponseLength,t.dataCount==t.usersData.length&&(t.currentResponseLength<t.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(t)?wdi_front.loadMore("initial-keep",t):(wdi_front.displayFeed(t),wdi_front.applyFilters(t),wdi_front.activeUsersCount(t)||"load_more_btn"==t.feed_row.feed_display_view&&((r=jQuery("#wdi_feed_"+t.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){var t;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&&((t=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),t.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.userHasNoPhoto=function(e,i){var t=0,r=e.usersData;void 0!==i&&(r=i);for(var a=0;a<r.length;a++)void 0===r[a].pagination&&(r[a].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===r[a].pagination.next_max_like_id&&t++:void 0===r[a].pagination.next_max_id&&t++;return t==r.length?1:0},wdi_front.appendRequestHashtag=function(e,i){for(var t=0;t<e.length;t++)e[t].wdi_hashtag=i;return e},wdi_front.displayFeed=function(e,i){0==e.customFilterChanged&&(t=wdi_front.feedSort(e,i));var t,r=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)<e.photoCounter&&!r&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(e)?wdi_front.loadMore("",e):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")){if("liked"==i.feed_row.liked_feed)return;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 t=[],r=[];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?t.push(0):t.push(jQuery(this).height()),r.push(jQuery(this))}),1==i.customFilterChanged&&(i.customFilterChanged=!1);for(var a,d,o,n,s,_=0;_<e.length;_++){"object"==typeof e[_].videos&&null==e[_].videos.standard_resolution||(i.displayedData.push(e[_]),a="image"==e[_].type?wdi_front.getPhotoTemplate(i):e[_].hasOwnProperty("videos")||"video"==e[_].type?wdi_front.getVideoTemplate(i):wdi_front.getSliderTemplate(i),d=e[_],o=a(wdi_front.createObject(d,i)),n=wdi_front.array_min(t),s=wdi_front.getImageResolution(e[_]),r[n.index].html(r[n.index].html()+o),t[n.index]+=r[n.index].width()*s,i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((_+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++))}i.wdi_loadedImages=0;var l=!1;i.wdi_load_count=_;var f=i.feed_row.wdi_feed_counter;jQuery("#wdi_feed_"+f+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,w(),!1===l&&(wdi_responsive.columnControl(i,1),l=!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 t=0;if(void 0===i)for(var r=0;r<e.dataStorage.length;r++)t+=e.dataStorage[r].length;else for(r=0;r<i.length;r++)t+=i[r].length;return t},wdi_front.getArrayContentLength=function(e,i){for(var t=0,r=0;r<e.length;r++)"finished"!=e[r].finished&&(t+=e[r][i].length);return t},wdi_front.displayFeedItems=function(e,i){if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){var t=i.feed_row.wdi_feed_counter,r=jQuery("#wdi_feed_"+t+" .wdi_feed_wrapper");"1"===i.feed_row.resort_after_load_more&&(r.html(""),i.imageIndex=0),1==i.customFilterChanged&&(r.html(""),i.imageIndex=0,i.customFilterChanged=!1);var a;wdi_front.getImgCount(i),e.length;"pagination"==i.feed_row.feed_display_view&&(a=i.feed_row.load_more_number,"image_browser"==i.feed_row.feed_type&&(a=1),(jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+' [wdi_page="'+(i.currentPage-1)+'"]').length<a||0==e.length)&&(i.currentPage=--i.currentPage<=1?1:i.currentPage));for(var d,o,n,s=0;s<e.length;s++){"object"==typeof e[s].videos&&null==e[s].videos.standard_resolution||(d="image"==e[s].type?wdi_front.getPhotoTemplate(i):e[s].hasOwnProperty("videos")?wdi_front.getVideoTemplate(i):wdi_front.getSliderTemplate(i),o=e[s],n=d(wdi_front.createObject(o,i)),r.html(r.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;t=i.feed_row.wdi_feed_counter,r=jQuery("#wdi_feed_"+t+" 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 t;switch(e){case"date":switch(i){case"asc":t=function(e,i){return e.created_time>i.created_time?1:-1};break;case"desc":t=function(e,i){return e.created_time>i.created_time?-1:1}}break;case"likes":switch(i){case"asc":t=function(e,i){return e.likes.count<i.likes.count?-1:1};break;case"desc":t=function(e,i){return e.likes.count<i.likes.count?1:-1}}break;case"comments":switch(i){case"asc":t=function(e,i){return e.comments.count<i.comments.count?-1:1};break;case"desc":t=function(e,i){return e.comments.count<i.comments.count?1:-1}}break;case"random":t=function(e,i){return.5<Math.random()?1:-1}}return t},wdi_front.feedSort=function(e,i){var t=e.feed_row.sort_images_by,r=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);var a=wdi_front.sortingOperator(t,r);return e.data.sort(a),e.data},wdi_front.smartPicker=function(e,i){var t=[],r=0,a=[],d=Math.ceil(e.feed_row.number_of_photos/e.usersData.length),o=parseInt(e.feed_row.number_of_photos),n=0;""!=i&&void 0!==i&&null!=i&&(o=parseInt(i),d=Math.ceil(o/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}),l=e.usersData.sort(function(e,i){return e.data.length>i.data.length?1:-1}),f=0;f<l.length;f++){n+=d,_[f].length()<=n?(n-=_[f].length(),t.push(_[f].getData(_[f].length())),r+=t[t.length-1].length):(o<r+n&&(n=o-r),(!(s=[])===e.auto_trigger||s.length+wdi_front.getDataLength(e)+wdi_front.getDataLength(e,t)<e.feed_row.number_of_photos)&&(s=s.concat(_[f].getData(n))),n=0,r+=s.length,t.push(s))}for(f=0;f<t.length;f++)void 0===e.dataStorage[f]?e.dataStorage.push(t[f]):e.dataStorage[f]=e.dataStorage[f].concat(t[f]);for(e.parsedData=wdi_front.parseLighboxData(e),f=0;f<t.length;f++)a=a.concat(t[f]);return a},wdi_front.createObject=function(e,i){var t,r=null!=e.caption?e.caption.text:"&nbsp",a=wdi_url.plugin_url+"images/video_missing.png";"video"==e.type&&e.videos[i.feedVideoResolution]&&null!=e.videos[i.feedVideoResolution].url&&(a=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution].url:""),void 0===e.images[i.feedImageResolution]?t=wdi_url.plugin_url+"images/missing.png":"carousel"==e.type&&void 0===e.images[i.feedImageResolution].url?void 0!==e.carousel_media[0].images?t=e.carousel_media[0].images[i.feedImageResolution].url:void 0!==e.carousel_media[0].videos&&(t=e.carousel_media[0].videos.standard_resolution.url):t=e.images[i.feedImageResolution].url;var d=i.imageIndex,o="square",n=e.images.standard_resolution.height,s=e.images.standard_resolution.width;s<n?o="portrait":n<s&&(o="landscape");var _=e.user.username;return""===_&&(_="no_user"),{id:e.id,caption:wdi_front.escape_tags(r),image_url:t,likes:e.likes.count,comments:e.comments.count,wdi_index:d,wdi_res_index:i.resIndex,wdi_media_user:_,link:e.link,video_url:a,wdi_username:_,wdi_shape:o}},wdi_front.setPage=function(e){var i=e.feed_row.feed_display_view,t=e.feed_row.feed_type;if("pagination"!=i)return"";var r,a=e.imageIndex;return r="image_browser"==t?1:Math.abs(e.feed_row.pagination_per_page_number),e.paginator=Math.ceil((a+1)/r),e.paginator},wdi_front.getPhotoTemplate=function(e){var i=wdi_front.setPage(e),t="",r="",a="",d="",o="tenweb-i-arrows-out",n="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o=""),sourceAttr=(""!=i&&(r='wdi_page="'+i+'"'),"src"),""!=i&&1!=i&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(n='<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");var s="";switch("blog_style"!==e.feed_row.feed_type&&(s="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')\"",d="wdi_hover_off",o="";break;case"custom_redirect":a="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",d="wdi_hover_off",o="";break;case"none":d="wdi_cursor_off wdi_hover_off",o=a=""}var l='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+r+' 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 '+d+'" >'+n+'<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 '+o+'"></i></div></div></div></div></div></div>';return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(l+='<div class="wdi_photo_meta">',"#"===e.feed_row.thumb_user[0]&&"1"===e.feed_row.show_likes&&(l+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"#"===e.feed_row.thumb_user[0]&&"1"===e.feed_row.show_comments&&(l+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),l+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(l+='<div class="wdi_photo_title" onclick='+s+" ><%=caption%></div>"),l+="</div>"),l+="</div>",_.template(l)},wdi_front.getSliderTemplate=function(e){var i=wdi_front.setPage(e),t="",r="",a="",d="",o="tenweb-i-clone",n="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o=""),sourceAttr=(""!=i&&(r='wdi_page="'+i+'"'),"src"),""!=i&&1!=i&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(n='<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");var s="";switch("blog_style"!==e.feed_row.feed_type&&(s="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')\"",d="wdi_hover_off",o="tenweb-i-clone";break;case"custom_redirect":a="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",d="wdi_hover_off",o="";break;case"none":d="wdi_cursor_off wdi_hover_off",o=a=""}var l='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+r+' 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') ) %>\"><img class=\"wdi_img\" "+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" >'+n+'<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 '+o+'"></i></div></div></div></div></div></div>';return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(l+='<div class="wdi_photo_meta">',"#"===e.feed_row.thumb_user[0]&&"1"===e.feed_row.show_likes&&(l+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"#"===e.feed_row.thumb_user[0]&&"1"===e.feed_row.show_comments&&(l+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),l+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(l+='<div class="wdi_photo_title" onclick='+s+" ><%=caption%></div>"),l+="</div>"),l+="</div>",_.template(l)},wdi_front.replaceToVideo=function(e,i,t){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_"+t+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner').html(overlayHtml),jQuery("#wdi_feed_"+t+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner video').get(0).play()},wdi_front.getVideoTemplate=function(e){var i=wdi_front.setPage(e),t="",r="",a="tenweb-i-play",d="",o="",n="",s=(""!=i&&(r='wdi_page="'+i+'"'),"src");""!=i&&1!=i&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(n='<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");var l="";switch("blog_style"!==e.feed_row.feed_type&&(l="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":d="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":d="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",a="tenweb-i-play";break;case"custom_redirect":d="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",a="";break;case"none":o="wdi_cursor_off wdi_hover_off",a="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(d="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",o="",a="tenweb-i-play")}var f='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+r+' 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\" "+s+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+o+'" '+d+">"+n+'<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>';return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(f+='<div class="wdi_photo_meta">',"#"===e.feed_row.thumb_user[0]&&"1"===e.feed_row.show_likes&&(f+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"#"===e.feed_row.thumb_user[0]&&"1"===e.feed_row.show_comments&&(f+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),f+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(f+='<div class="wdi_photo_title" onclick='+l+" ><%=caption%></div>"),f+="</div>"),f+="</div>",_.template(f)},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 t;1!=i.paginator&&1!=i.currentPage&&(t=i.currentPage,i.currentPage=1,wdi_front.updatePagination(i,"custom",t),e.parent().find("#wdi_last_page").removeClass("wdi_disabled")),e.addClass("wdi_disabled")},wdi_front.paginationLastPage=function(e,i){var t;1!=i.paginator&&i.currentPage!=i.paginator&&(t=i.currentPage,i.currentPage=i.paginator,wdi_front.updatePagination(i,"custom",t),e.addClass("wdi_disabled"),e.parent().find("#wdi_first_page").removeClass("wdi_disabled"))},wdi_front.paginatorNext=function(e,i){var t,r=e.parent().find("#wdi_last_page"),a=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?r.removeClass("wdi_disabled"):r.addClass("wdi_disabled")):(i.currentPage++,t=i.feed_row.number_of_photos,wdi_front.loadMore(e,i,t),r.addClass("wdi_disabled")),a.removeClass("wdi_disabled")},wdi_front.paginatorPrev=function(e,i){var t=e.parent().find("#wdi_last_page"),r=e.parent().find("#wdi_first_page");1!=i.currentPage?(i.currentPage--,wdi_front.updatePagination(i,"prev"),t.removeClass("wdi_disabled"),1==i.currentPage&&r.addClass("wdi_disabled")):r.addClass("wdi_disabled")},wdi_front.updatePagination=function(e,i,t){var r="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(r+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),i){case"next":var t=e.currentPage-1;jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+t+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":t=e.currentPage+1;jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+t+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(t=t)!=e.currentPage&&(jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+t+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(r+" .wdi_feed_wrapper").css("height","auto"),jQuery(r+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,i){var t,r=0;""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e&&(t=window[e.parent().parent().parent().parent().attr("id")]),void 0!==i&&(t=i);for(var a=0,d=0,o=0;o<t.userSortFlags.length;o++)if(!0===t.userSortFlags[o].flag){a++;for(var n=0;n<t.usersData.length;n++)t.userSortFlags[o].id===t.usersData[n].user_id&&"finished"===t.usersData[n].finished&&d++}if(a!==d||0==a){t.auto_trigger=""===e,wdi_front.ajaxLoader(t),"masonry"===t.feed_row.feed_type&&"pagination"==t.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(o=0;o<t.usersData.length;o++)"finished"===t.usersData[o].finished&&r++;r===t.usersData.length&&(wdi_front.allImagesLoaded(t),jQuery("#wdi_feed_"+t.feed_row.wdi_feed_counter+" .wdi_load_more").remove());var s=t.usersData;t.loadMoreDataCount=t.feed_users.length;for(o=0;o<s.length;o++){var _,l=s[o].pagination,f={user_id:s[o].user_id,username:s[o].username};""!=l.next_url&&null!=l.next_url&&void 0!==l.next_url?(_=l.next_url,wdi_front.loadMoreRequest(f,_,t,e)):("initial-keep"==e&&(t.temproraryUsersData[o]=t.usersData[o]),t.loadMoreDataCount--,wdi_front.checkForLoadMoreDone(t,e))}}},wdi_front.loadMoreRequest=function(t,e,r,a){var d,i;r.mediaRequestsDone&&(r.usersData,d="",i=function(e){if(""===e||void 0===e||null==e)return d=wdi_front_messages.network_error,r.loadMoreDataCount--,void wdi_front.show_alert(d,e,r);if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,r),void 0!==e.meta&&void 0!==e.meta.code&&200!=e.meta.code)return d=e.meta.error_message,r.loadMoreDataCount--,void wdi_front.show_alert(d,e,r);e.user_id=t.user_id,e.username=t.username;for(var i=0;i<r.usersData.length;i++)e.user_id===r.usersData[i].user_id&&("#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),"initial-keep"==a&&(r.temproraryUsersData[i]=r.usersData[i]),r.usersData[i]=e,r.loadMoreDataCount--);wdi_front.checkForLoadMoreDone(r,a)},"#"!==t.username[0]?r.instagram.requestByUrl(e,{success:i}):r.instagram.getTagRecentMedia(t.username,{success:i},e,r.feed_row.hashtag_top_recent))},wdi_front.checkForLoadMoreDone=function(e,i){var t=e.feed_row.load_more_number,r=e.feed_row.number_of_photos;if(0==e.loadMoreDataCount){e.temproraryUsersData=wdi_front.mergeData(e.temproraryUsersData,e.usersData);var a=wdi_front.getArrayContentLength(e.temproraryUsersData,"data");if("initial-keep"==i&&(i="initial"),"initial"==i)a<r&&!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=[]);else if(a<t&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount)wdi_front.loadMore(void 0,e);else{if(e.usersData=e.temproraryUsersData,!wdi_front.activeUsersCount(e))return;wdi_front.displayFeed(e,t),wdi_front.applyFilters(e),e.temproraryUsersData=[]}}},wdi_front.allDataHasFinished=function(e){for(var i=0,t=0;t<e.dataStorageRaw.length;t++)0==e.dataStorageRaw[t].length()&&1==e.dataStorageRaw[t].locked&&i++;return i==e.dataStorageRaw.length},wdi_front.mergeData=function(e,i){for(var t=0;t<i.length;t++)if(void 0!==e[t]){if("finished"==i[t].finished)continue;if(void 0===e[t].pagination.next_max_id&&void 0===e[t].pagination.next_max_like_id)continue;e[t].data=e[t].data.concat(i[t].data),e[t].pagination=i[t].pagination,e[t].user_id=i[t].user_id,e[t].username=i[t].username,e[t].meta=i[t].meta}else e.push(i[t]);return e},wdi_front.brokenImageHandler=function(e){return!0},wdi_front.ajaxLoader=function(e){var i,t=e.feed_row.wdi_feed_counter,r=jQuery("#wdi_feed_"+t);"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>");var t=e.feed_row.wdi_feed_counter,r=jQuery("#wdi_feed_"+t);"load_more_btn"==e.feed_row.feed_display_view&&(r.find(".wdi_load_more").removeClass("wdi_hidden"),r.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"),r.trigger("wdi_feed_loaded")},wdi_front.show=function(e,i){var t,r,a,d=i.feed_row.wdi_feed_counter,o=jQuery("#wdi_feed_"+d+" .wdi_feed_container");switch(e){case"header":t={feed_thumb:i.feed_row.feed_thumb,feed_name:i.feed_row.feed_name},r=wdi_front.getHeaderTemplate()(t),a=o.find(".wdi_feed_header").html(),o.find(".wdi_feed_header").html(a+r)}},wdi_front.getUserTemplate=function(e,i){var t,r,a=e.dataCount;switch(i[0]){case"#":t="//instagram.com/explore/tags/"+i.substr(1,i.length);break;default:t="//instagram.com/"+i}r="onclick='"+('window.open("'+t+'","_blank")')+"'";var d='<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<a&&(d+='<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>'),d+="</div>",d+="<h3 "+r+"><%= user_name%></h3>","#"!==i[0]?("1"==e.feed_row.follow_on_instagram_btn&&(d+='<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>"),d+='<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>'):d+='<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>',d+='<div class="wdi_clear"></div>',1==a&&"#"!==i[0]&&"1"==e.feed_row.display_user_info&&(d+='<div class="wdi_bio"><%= bio%></div>',d+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'),d+="</div></div>",_.template(d)},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 t=window["wdi_feed_"+i];if(!(t.dataCount<2)&&0==t.nowLoadingImages){var r=jQuery("#wdi_feed_"+t.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');r.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg"),r.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col"),r.find(".wdi_media_info").toggleClass("wdi_filter_active_col"),r.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col"),t.customFilterChanged=!0,0==t.userSortFlags[e].flag?t.userSortFlags[e].flag=!0:t.userSortFlags[e].flag=!1;for(var a=0,d=0;d<t.userSortFlags.length;d++)1==t.userSortFlags[d].flag&&a++;"pagination"==t.feed_row.feed_display_view&&(t.resIndex=0),0!=a?wdi_front.filterData(t):t.customFilteredData=t.dataStorageList,wdi_front.displayFeed(t),"pagination"==t.feed_row.feed_display_view&&(t.paginator=Math.ceil(t.imageIndex/parseInt(t.feed_row.pagination_per_page_number)),t.currentPage=t.paginator,wdi_front.updatePagination(t,"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 t=0;t<e.dataStorageList.length;t++)for(var r=0;r<i.length;r++)(void 0!==e.dataStorageList[t].user.id&&e.dataStorageList[t].user.id==i[r].id||e.dataStorageList[t].wdi_hashtag==i[r].name)&&1==i[r].flag&&e.customFilteredData.push(e.dataStorageList[t])},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,t=0,r=0;r<i.length;r++)t+=i[r].length;return t},wdi_front.parseLighboxData=function(e,i){var t=e.dataStorage,r=e.feed_row.sort_images_by,a=e.feed_row.display_order,d=wdi_front.sortingOperator(r,a),o=[],n=[],s={};if(1==i)o=e.customFilteredData;else{for(var _=0;_<t.length;_++)for(var l=0;l<t[_].length;l++)o.push(t[_][l]);o.sort(d)}for(_=0;_<o.length;_++){var f,w=void 0!==o[_].media_url?o[_].media_url:wdi_url.plugin_url+"images/video_missing.png";void 0===o[_].media_url&&"carousel"===o[_].type&&(void 0!==(f=o[_].carousel_media[0]).images?w=f.images.standard_resolution.url:void 0!==f.videos&&(w=f.videos.standard_resolution.url)),s={alt:"",avg_rating:"",comment_count:o[_].comments.count,date:wdi_front.convertUnixDate(o[_].created_time),description:wdi_front.getDescription(null!==o[_].caption?wdi_front.escape_tags(o[_].caption.text):""),filename:wdi_front.getFileName(o[_]),filetype:wdi_front.getFileType(o[_]),hit_count:"0",id:o[_].id,image_url:o[_].link,number:0,rate:"",rate_count:"0",username:o[_].user.username,profile_picture:o[_].user.profile_picture,thumb_url:w,comments_data:o[_].comments.data,images:o[_].images,carousel_media:void 0!==o[_].carousel_media?o[_].carousel_media:null},n.push(s)}return n},wdi_front.convertUnixDate=function(e){var i=parseInt(e),t=new Date(0);t.setUTCSeconds(i);var r=t.getFullYear()+"-"+t.getMonth()+"-"+t.getDate();return r+=" "+t.getHours()+":"+t.getMinutes()},wdi_front.getDescription=function(e){return e=e.replace(/\r?\n|\r/g," ")},wdi_front.getFileName=function(e){var i=e.link;if("video"===e.type&&e.hasOwnProperty("videos")&&null!=e.videos.standard_resolution)return e.videos.standard_resolution.url;var t=i.split("/");return t[t.length-2]},wdi_front.getFileType=function(e){return"video"==e.type&&e.hasOwnProperty("videos")?"EMBED_OEMBED_INSTAGRAM_VIDEO":"EMBED_OEMBED_INSTAGRAM_IMAGE"},wdi_front.array_max=function(e){for(var i=e[0],t=0,r=1;r<e.length;r++)i<e[r]&&(i=e[r],t=r);return{value:i,index:t}},wdi_front.array_min=function(e){for(var i=e[0],t=0,r=1;r<e.length;r++)i>e[r]&&(i=e[r],t=r);return{value:i,index:t}},wdi_front.activeUsersCount=function(e){for(var i=0,t=0;t<e.usersData.length;t++)"finished"!=e.usersData[t].finished&&i++;return i},wdi_front.checkMediaResponse=function(e,i){return""==e||void 0===e||null==e?(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){switch(e[0]){case"#":return e.substr(1,e.length);default:return e}},wdi_front.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_front.regexpTestCaption=function(e,i){var t=!1,r=!1,a=i.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),d=new RegExp("(?:^|\\s)"+a+"(?:^|\\s)"),o=new RegExp("(?:^|\\s)"+a,"g");for(null!=d.exec(e)&&(t=!0);null!=(match=o.exec(e));)r=!0;return 1==t||1==r},wdi_front.replaceNewLines=function(e){var i,t="vUkCJvN2ps3t",r=[];for(e=e.replace(/\r?\n|\r/g,t),i=new RegExp(t,"g");null!=(match=i.exec(e));)r.push(match.index);for(var a=e.split(t),d=0,o=0;o<a.length;o++)""==a[o]?d++:d=0,0<d&&(a.splice(o,1),d--,o--);return e=a.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.conditionalFilter=function(e,i){var t=this,r=t.feed_row.conditional_filter_type,a=t.feed_row.conditional_filters;if(1==i.ignoreFiltering||(e=this.avoidDuplicateMedia(e)),!wdi_front.isJsonString(a))return e;if(void 0!==(a=JSON.parse(a))&&0==a.length)return e;if("0"==t.feed_row.conditional_filter_enable)return e;switch(t.instagramRequestCounter++,r){case"AND":e=this.applyANDLogic(e,a,t);break;case"OR":e=this.applyORLogic(e,a,t);break;case"NOR":e=this.applyNORLogic(e,a,t)}return e},WDIFeed.prototype.applyANDLogic=function(e,i){for(var t=0;t<i.length;t++)e=this.filterResponse(e,i[t]);return e},WDIFeed.prototype.applyORLogic=function(e,i){for(var t,r,a=[],d=[],o=0;o<i.length;o++)t=this.filterResponse(e,i[o]),a=a.concat(t.data),t={};for(o=0;o<a.length;o++)r=a[o],this.mediaExists(r,d)||this.mediaExists(r,this.dataStorageList)||d.push(r);return{data:d,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.applyNORLogic=function(e,i){for(var t=e,r=this.applyORLogic(e,i,this),a=[],d=0;d<t.data.length;d++)this.mediaExists(t.data[d],r.data)||a.push(t.data[d]);return{data:a,meta:t.meta,pagination:t.pagination}},WDIFeed.prototype.mediaExists=function(e,i){for(var t=0;t<i.length;t++)if(e.id==i[t].id)return!0;return!1},WDIFeed.prototype.filterResponse=function(e,i){switch(i.filter_type){case"hashtag":return this.filterByHashtag(e,i);case"username":return this.filterByUsername(e,i);case"mention":return this.filterByMention(e,i);case"description":return this.filterByDescription(e,i);case"location":return this.filterByLocation(e,i);case"url":return this.filterByUrl(e,i)}},WDIFeed.prototype.filterByHashtag=function(e,i){for(var t,r=[],a=0;a<e.data.length;a++)if(void 0!==(t=e.data[a]).tags)for(var d=0;d<t.tags.length;d++){tag=t.tags[d];var o=tag.toLowerCase(),n=i.filter_by.toLowerCase();o.trim()==n.trim()&&r.push(t)}return{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByUsername=function(e,i){for(var t,r=[],a=0;a<e.data.length;a++)(t=e.data[a]).user.username.toLowerCase()==i.filter_by.toLowerCase()&&r.push(t);return{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByMention=function(e,i){for(var t,r=[],a=0;a<e.data.length;a++)null!==(t=e.data[a]).caption&&-1!=t.caption.text.toLowerCase().indexOf("@"+i.filter_by.toLowerCase())&&r.push(t);return{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByDescription=function(e,i){for(var t,r,a,d=[],o=0;o<e.data.length;o++){null!==(a=e.data[o]).caption&&(t=a.caption.text.toLowerCase(),t=wdi_front.replaceNewLines(t),r=i.filter_by.toLowerCase(),wdi_front.regexpTestCaption(t,r)&&d.push(a))}return{data:d,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByLocation=function(e,i){for(var t,r=[],a=0;a<e.data.length;a++)null!==(t=e.data[a]).location&&t.location.id==i.filter_by&&r.push(t);return{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByUrl=function(e,i){var t,r=[];i.filter_by=this.getIdFromUrl(i.filter_by);for(var a=0;a<e.data.length;a++)null!==(t=e.data[a]).link&&this.getIdFromUrl(t.link)==i.filter_by&&r.push(t);return{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.getIdFromUrl=function(e){for(var i=e.split("/"),t=!1,r=0;r<i.length;r++)if("p"==i[r]&&void 0!==i[r+1]){t=i[r+1];break}return t},WDIFeed.prototype.avoidDuplicateMedia=function(e){var i=e.data,t=[];void 0===i&&(i=[]);for(var r=0;r<i.length;r++)this.mediaExists(i[r],this.dataStorageList)||this.mediaExists(i[r],t)||this.mediaExists(i[r],this.conditionalFilterBuffer)||t.push(i[r]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(t),{data:t,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,i){var r=this;if("object"==typeof this[i]&&"number"==typeof this[i].length)for(var t=0;t<e.length;t++){var a="";wdi_front.isHashtag(e[t].user_id)?void 0!==e[t].pagination.cursors&&(a=e[t].pagination.cursors.after):"liked"==r.feed_row.liked_feed?void 0===(a=e[t].pagination.next_max_like_id)&&(a=""):(null==e[t].pagination&&(e[t].pagination=[]),void 0===(a=e[t].pagination.next_max_id)&&(a="")),void 0===this[i][t]?this[i].push({data:e[t].data,index:0,locked:!1,hash_id:a,usersDataFinished:!1,userId:e[t].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 t=0;t<r.usersData.length;t++)if(r.usersData[t].user_id==this.userId){r.usersData[t].finished="finished",this.usersDataFinished=!0;break}return i}}):0==this[i][t].locked&&(a!=this[i][t].hash_id?(this[i][t].data=this[i][t].data.concat(e[t].data),this[i][t].hash_id=a):this[i][t].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,t=0;t<e.data.length;t++)if(e.data[t].username==e.args.username){i=!0;break}if(i)for(var r=0;r<n.length;r++)e.data[t].username==n[r].username&&(n[r].id=e.data[t].id)}for(var a=!1,d=0;d<n.length;d++)if(""==n[d].id||"username"==n[d].id){a=!0;break}a||(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(){return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())?"touchend":"click"}),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,a,o;r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter),400===i.meta.code&&"APINotAllowedError"===i.meta.error_type&&(void 0!==i.wdi_current_feed_name&&(t=i.wdi_current_feed_name,void 0===(d=r.find(".wdi_private_feed_names")).attr("wdi_first_private_user")?d.attr("wdi_first_private_user",1):t=", "+t,d.append(t),r.find(".wdi_private_feed_error").removeClass("wdi_hidden")),r.find(".wdi_spinner").remove()),void 0!==r&&"APINotAllowedError"!=i.meta.error_type&&(r.find(".wdi_spinner").remove(),wdi_error_show=!0,a=r.find(".wdi_js_error"),o=r.find(".wdi_token_error"),0!=i&&null!=typeof i.meta&&"OAuthAccessTokenException"===i.meta.error_type?(o.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){}})):(a.removeClass("wdi_js_error"),a.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.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);var t=r.attr("wdi-res").split("wdi_col_");if(r.find("#wdi_feed_item_example").remove(),2!==t.length)return i;var d=parseInt(t[1]);if(d<=0)return i;var a=r.width()/d-10,o=i;return a<=150?(o.image="thumbnail",o.video="low_bandwidth"):150<a&&a<=320?(o.image="low_resolution",o.video="low_resolution"):(o.image="standard_resolution",o.video="standard_resolution"),o},wdi_front.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_front.instagramRequest=function(i,r){var t=this,d=r.feed_users;"string"==typeof d[i]&&"self"===d[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)}}):"hashtag"==this.getInputType(d[i].username)?r.instagram.getTagRecentMedia(this.stripHashtag(d[i].username),{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.saveUserData(e,r.feed_users[i],r)}},null,r.feed_row.hashtag_top_recent):"user"==this.getInputType(d[i].username)&&r.instagram.getUserMedia({user_id:d[i].id,success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&(e.wdi_current_feed_name=d[i].username,wdi_front.show_alert(!1,e,r)),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){var t;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&&((t=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),t.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.saveSelfUserData=function(e,i){var r;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&&((r=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),r.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,t=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)<e.photoCounter&&!t&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(e)?wdi_front.loadMore("",e):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")){if("liked"==i.feed_row.liked_feed)return;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,s,_=0;_<e.length;_++){"object"==typeof e[_].videos&&null==e[_].videos.standard_resolution||(i.displayedData.push(e[_]),d="image"==e[_].type?wdi_front.getPhotoTemplate(i):e[_].hasOwnProperty("videos")||"video"==e[_].type?wdi_front.getVideoTemplate(i):wdi_front.getSliderTemplate(i),a=e[_],o=d(wdi_front.createObject(a,i)),n=wdi_front.array_min(r),s=wdi_front.getImageResolution(e[_]),t[n.index].html(t[n.index].html()+o),r[n.index]+=t[n.index].width()*s,i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((_+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++))}i.wdi_loadedImages=0;var w=!1;i.wdi_load_count=_;var f=i.feed_row.wdi_feed_counter;jQuery("#wdi_feed_"+f+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,l(),!1===w&&(wdi_responsive.columnControl(i,1),w=!0)});l(),1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}function l(){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||(a="image"==e[s].type?wdi_front.getPhotoTemplate(i):e[s].hasOwnProperty("videos")?wdi_front.getVideoTemplate(i):wdi_front.getSliderTemplate(i),o=e[s],n=a(wdi_front.createObject(o,i)),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);var d=wdi_front.sortingOperator(r,t);return e.data.sort(d),e.data},wdi_front.smartPicker=function(e,i){var r=[],t=0,d=[],a=Math.ceil(e.feed_row.number_of_photos/e.usersData.length),o=parseInt(e.feed_row.number_of_photos),n=0;""!=i&&void 0!==i&&null!=i&&(o=parseInt(i),a=Math.ceil(o/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+=a,_[f].length()<=n?(n-=_[f].length(),r.push(_[f].getData(_[f].length())),t+=r[r.length-1].length):(o<t+n&&(n=o-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,t=null!=e.caption?e.caption.text:"&nbsp",d=wdi_url.plugin_url+"images/video_missing.png";"video"==e.type&&e.videos[i.feedVideoResolution]&&null!=e.videos[i.feedVideoResolution].url&&(d=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution].url:""),void 0===e.images[i.feedImageResolution]?r=wdi_url.plugin_url+"images/missing.png":"carousel"==e.type&&void 0===e.images[i.feedImageResolution].url?void 0!==e.carousel_media[0].images?r=e.carousel_media[0].images[i.feedImageResolution].url:void 0!==e.carousel_media[0].videos&&(r=wdi_url.plugin_url+"images/video_missing.png"):r=e.images[i.feedImageResolution].url;var a=i.imageIndex,o="square",n=e.images.standard_resolution.height,s=e.images.standard_resolution.width;s<n?o="portrait":n<s&&(o="landscape");var _=e.user.username;return""===_&&(_="no_user"),{id:e.id,caption:wdi_front.escape_tags(t),image_url:r,likes:e.likes.count,comments:e.comments.count,wdi_index:a,wdi_res_index:i.resIndex,wdi_media_user:_,link:e.link,video_url:d,wdi_username:_,wdi_shape:o}},wdi_front.setPage=function(e){var i=e.feed_row.feed_display_view,r=e.feed_row.feed_type;if("pagination"!=i)return"";var t,d=e.imageIndex;return t="image_browser"==r?1:Math.abs(e.feed_row.pagination_per_page_number),e.paginator=Math.ceil((d+1)/t),e.paginator},wdi_front.getPhotoTemplate=function(e){var i=wdi_front.setPage(e),r="",t="",d="",a="",o="tenweb-i-arrows-out",n="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o=""),sourceAttr=(""!=i&&(t='wdi_page="'+i+'"'),"src"),""!=i&&1!=i&&(r="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(n='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(r+=" wdi_full_caption");var s="";switch("blog_style"!==e.feed_row.feed_type&&(s="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":d="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":d="onclick=\"window.open ('<%= link%>','_blank')\"",a="wdi_hover_off",o="";break;case"custom_redirect":d="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",a="wdi_hover_off",o="";break;case"none":a="wdi_cursor_off wdi_hover_off",o=d=""}var w='<div class="wdi_feed_item '+r+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+t+' 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 '+a+'" >'+n+'<div class="wdi_thumb_icon" '+d+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+o+'"></i></div></div></div></div></div></div>';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">',"#"===e.feed_row.thumb_user[0]&&"1"===e.feed_row.show_likes&&(w+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"#"===e.feed_row.thumb_user[0]&&"1"===e.feed_row.show_comments&&(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='+s+" ><%=caption%></div>"),w+="</div>"),w+="</div>",_.template(w)},wdi_front.getSliderTemplate=function(e){var i=wdi_front.setPage(e),r="",t="",d="",a="",o="tenweb-i-clone",n="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o=""),sourceAttr=(""!=i&&(t='wdi_page="'+i+'"'),"src"),""!=i&&1!=i&&(r="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(n='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(r+=" wdi_full_caption");var s="";switch("blog_style"!==e.feed_row.feed_type&&(s="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":d="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":d="onclick=\"window.open ('<%= link%>','_blank')\"",a="wdi_hover_off",o="tenweb-i-clone";break;case"custom_redirect":d="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",a="wdi_hover_off",o="";break;case"none":a="wdi_cursor_off wdi_hover_off",o=d=""}var w='<div class="wdi_feed_item '+r+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+t+' 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') ) %>\"><img class=\"wdi_img\" "+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+a+'" >'+n+'<div class="wdi_thumb_icon" '+d+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+o+'"></i></div></div></div></div></div></div>';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">',"#"===e.feed_row.thumb_user[0]&&"1"===e.feed_row.show_likes&&(w+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"#"===e.feed_row.thumb_user[0]&&"1"===e.feed_row.show_comments&&(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='+s+" ><%=caption%></div>"),w+="</div>"),w+="</div>",_.template(w)},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){var i=wdi_front.setPage(e),r="",t="",d="tenweb-i-play",a="",o="",n="",s=(""!=i&&(t='wdi_page="'+i+'"'),"src");""!=i&&1!=i&&(r="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(n='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(r+=" wdi_full_caption");var w="";switch("blog_style"!==e.feed_row.feed_type&&(w="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",d="tenweb-i-play";break;case"custom_redirect":a="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",d="";break;case"none":o="wdi_cursor_off wdi_hover_off",d="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(a="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",o="",d="tenweb-i-play")}var f='<div class="wdi_feed_item '+r+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+t+' 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\" "+s+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+o+'" '+a+">"+n+'<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 '+d+'"></i></div></div></div></div></div></div>';return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(f+='<div class="wdi_photo_meta">',"#"===e.feed_row.thumb_user[0]&&"1"===e.feed_row.show_likes&&(f+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"#"===e.feed_row.thumb_user[0]&&"1"===e.feed_row.show_comments&&(f+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),f+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(f+='<div class="wdi_photo_title" onclick='+w+" ><%=caption%></div>"),f+="</div>"),f+="</div>",_.template(f)},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"),t=e.parent().find("#wdi_first_page");1!=i.currentPage?(i.currentPage--,wdi_front.updatePagination(i,"prev"),r.removeClass("wdi_disabled"),1==i.currentPage&&t.addClass("wdi_disabled")):t.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;""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e&&(r=window[e.parent().parent().parent().parent().attr("id")]),void 0!==i&&(r=i);for(var d=0,a=0,o=0;o<r.userSortFlags.length;o++)if(!0===r.userSortFlags[o].flag){d++;for(var n=0;n<r.usersData.length;n++)r.userSortFlags[o].id===r.usersData[n].user_id&&"finished"===r.usersData[n].finished&&a++}if(d!==a||0==d){r.auto_trigger=""===e,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(o=0;o<r.usersData.length;o++)"finished"===r.usersData[o].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(o=0;o<s.length;o++){var _,w=s[o].pagination,f={user_id:s[o].user_id,username:s[o].username};""!=w.next_url&&null!=w.next_url&&void 0!==w.next_url?(_=w.next_url,wdi_front.loadMoreRequest(f,_,r,e)):("initial-keep"==e&&(r.temproraryUsersData[o]=r.usersData[o]),r.loadMoreDataCount--,wdi_front.checkForLoadMoreDone(r,e))}}},wdi_front.loadMoreRequest=function(r,e,t,d){var a,i;t.mediaRequestsDone&&(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);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.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,t.dataStorageRaw[i].data=t.dataStorageRaw[i].data.concat(e.data),t.loadMoreDataCount--);wdi_front.checkForLoadMoreDone(t,d)},"#"!==r.username[0]?t.instagram.requestByUrl(e,{success:i}):t.instagram.getTagRecentMedia(r.username,{success:i},e,t.feed_row.hashtag_top_recent))},wdi_front.checkForLoadMoreDone=function(e,i){var r=e.feed_row.load_more_number,t=e.feed_row.number_of_photos;if(0==e.loadMoreDataCount){e.temproraryUsersData=wdi_front.mergeData(e.temproraryUsersData,e.usersData);var d=wdi_front.getArrayContentLength(e.temproraryUsersData,"data");if("initial-keep"==i&&(i="initial"),"initial"==i)d<t&&!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=[]);else if(d<r&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount)wdi_front.loadMore(void 0,e);else{if(e.usersData=e.temproraryUsersData,!wdi_front.activeUsersCount(e))return;wdi_front.displayFeed(e,r),wdi_front.applyFilters(e),e.temproraryUsersData=[]}}},wdi_front.allDataHasFinished=function(e){for(var i=0,r=0;r<e.dataStorageRaw.length;r++)0==e.dataStorageRaw[r].length()&&1==e.dataStorageRaw[r].locked&&i++;return i==e.dataStorageRaw.length},wdi_front.mergeData=function(e,i){for(var r=0;r<i.length;r++)if(void 0!==e[r]){if("finished"==i[r].finished)continue;if(void 0===e[r].pagination.next_max_id&&void 0===e[r].pagination.next_max_like_id)continue;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}else 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,t=jQuery("#wdi_feed_"+r);"load_more_btn"==e.feed_row.feed_display_view&&(t.find(".wdi_load_more").addClass("wdi_hidden"),t.find(".wdi_spinner").removeClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&(0==t.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>'),t.append(i)):i=t.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>");var r=e.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r);"load_more_btn"==e.feed_row.feed_display_view&&(t.find(".wdi_load_more").removeClass("wdi_hidden"),t.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"),t.trigger("wdi_feed_loaded")},wdi_front.show=function(e,i){var r,t,d,a=i.feed_row.wdi_feed_counter,o=jQuery("#wdi_feed_"+a+" .wdi_feed_container");switch(e){case"header":r={feed_thumb:i.feed_row.feed_thumb,feed_name:i.feed_row.feed_name},t=wdi_front.getHeaderTemplate()(r),d=o.find(".wdi_feed_header").html(),o.find(".wdi_feed_header").html(d+t)}},wdi_front.getUserTemplate=function(e,i){var r,t,d=e.dataCount;switch(i[0]){case"#":r="//instagram.com/explore/tags/"+i.substr(1,i.length);break;default:r="//instagram.com/"+i}t="onclick='"+('window.open("'+r+'","_blank")')+"'";var a='<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<d&&(a+='<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>'),a+="</div>",a+="<h3 "+t+"><%= user_name%></h3>","#"!==i[0]?("1"==e.feed_row.follow_on_instagram_btn&&(a+='<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>"),a+='<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>'):a+='<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>',a+='<div class="wdi_clear"></div>',1==d&&"#"!==i[0]&&"1"==e.feed_row.display_user_info&&(a+='<div class="wdi_bio"><%= bio%></div>',a+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'),a+="</div></div>",_.template(a)},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];if(!(r.dataCount<2)&&0==r.nowLoadingImages){var t=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');t.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg"),t.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col"),t.find(".wdi_media_info").toggleClass("wdi_filter_active_col"),t.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 d=0,a=0;a<r.userSortFlags.length;a++)1==r.userSortFlags[a].flag&&d++;"pagination"==r.feed_row.feed_display_view&&(r.resIndex=0),0!=d?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,s=wdi_front.sortingOperator(o,n),_=[],w=[],f={};if(1==i)_=e.customFilteredData;else{for(var l=0;l<a.length;l++)for(var u=0;u<a[l].length;u++)_.push(a[l][u]);_.sort(s)}for(l=0;l<_.length;l++){void 0!==_[l]&&(r=void 0!==_[l]&&void 0!==_[l].media_url?_[l].media_url:wdi_url.plugin_url+"images/video_missing.png",void 0!==_[l]&&void 0===_[l].media_url&&"carousel"===_[l].type&&(void 0!==(t=_[l].carousel_media[0])&&void 0!==t.images?r=t.images.standard_resolution.url:void 0!==t&&void 0!==t.videos&&(r=t.videos.standard_resolution.url)),void(d=0)!==_[l]&&void 0!==_[l].comments&&(d=_[l].comments.count),f={alt:"",avg_rating:"",comment_count:d,date:wdi_front.convertUnixDate(_[l].created_time),description:wdi_front.getDescription(void 0!==_[l].caption&&null!==_[l].caption?wdi_front.escape_tags(_[l].caption.text):""),filename:wdi_front.getFileName(_[l]),filetype:wdi_front.getFileType(_[l]),hit_count:"0",id:_[l].id,image_url:_[l].link,number:0,rate:"",rate_count:"0",username:_[l].user.username,profile_picture:_[l].user.profile_picture,thumb_url:r,comments_data:_[l].comments.data,images:_[l].images,carousel_media:void 0!==_[l].carousel_media?_[l].carousel_media:null},w.push(f))}return w},wdi_front.convertUnixDate=function(e){var i=parseInt(e),r=new Date(0);r.setUTCSeconds(i);var t=r.getFullYear()+"-"+r.getMonth()+"-"+r.getDate();return t+=" "+r.getHours()+":"+r.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;var r=i.split("/");return r[r.length-2]}},wdi_front.getFileType=function(e){return"video"==e.type&&e.hasOwnProperty("videos")?"EMBED_OEMBED_INSTAGRAM_VIDEO":"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?(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){switch(e[0]){case"#":return e.substr(1,e.length);default:return e}},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,"\\$&"),a=new RegExp("(?:^|\\s)"+d+"(?:^|\\s)"),o=new RegExp("(?:^|\\s)"+d,"g");for(null!=a.exec(e)&&(r=!0);null!=(match=o.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){t.usersData[r].finished="finished",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
@@ -166,6 +166,11 @@ function WDIInstagram(args) {
166
  _this.access_tokens = [];
167
  }
168
 
 
 
 
 
 
169
  /**
170
  * Gets recent media based on tagname
171
  *
@@ -195,7 +200,7 @@ function WDIInstagram(args) {
195
  *
196
  * @return object of founded media
197
  */
198
- this.getTagRecentMedia = function (tagname, args, next_url, endpoint) {
199
  var instagram = this,
200
  noArgument = false,
201
  successFlag = false,
@@ -236,47 +241,59 @@ function WDIInstagram(args) {
236
  args.count = 33;
237
  }
238
  }
239
-
240
  var wdiTagId = this.getTagId(tagname);
241
  jQuery.ajax({
242
  type: "POST",
243
  url: wdi_ajax.ajax_url,
244
  dataType:"json",
245
  data: {
246
- tagname:tagname,
247
- endpoint:endpoint,
248
- wdi_nonce:wdi_ajax.wdi_nonce,
249
- wdiTagId:wdiTagId,
250
- next_url:next_url,
251
- user_name:getUserName(),
252
- action:"wdi_getTagRecentMedia"
 
 
253
  },
254
  success: function (response) {
255
- if(wdiTagId === false){
256
- wdiTagId = "";
 
 
257
  }
258
- if(typeof response.tag_data !== "undefined"){
259
-
260
- var tag_data = response.tag_data;
261
- if(typeof tag_data.tag_id !== "undefined"){
262
- wdiTagId = tag_data.tag_id;
 
 
 
 
263
  }
264
- var all_tags = [];
265
- if(typeof window['wdi_all_tags'] !== "undefined"){
266
- all_tags = window['wdi_all_tags'];
267
  }
268
-
269
- all_tags[tag_data.tag_id] = tag_data;
270
-
271
- window['wdi_all_tags'] = all_tags;
 
 
 
 
 
 
 
 
 
 
 
 
 
272
  }
273
-
274
- response = response.response;
275
- response = _this.convertHashtagData(response);
276
- response.meta = {"code": 200};
277
- response.tag_id = wdiTagId;
278
- response = _this.addTags(response);
279
- success(response)
280
  },
281
  error: function (response) {
282
  if (errorFlag) {
@@ -284,11 +301,13 @@ function WDIInstagram(args) {
284
  if (typeof window[args['error'][0]][args['error'][1]] == 'function') {
285
  window[args['error'][0]][args['error'][1]](response);
286
  }
287
- } else if (typeof args['error'] == 'string') {
 
288
  if (typeof window[args['error']] == 'function') {
289
  window[args['error']](response);
290
  }
291
- } else if (typeof args['error'] == 'function') {
 
292
  args['error'](response);
293
  }
294
  }
@@ -302,41 +321,24 @@ function WDIInstagram(args) {
302
  if (typeof args.success == 'object' && args.success.length == 2) {
303
  if (typeof window[args.success[0]] != 'undefined') {
304
  if (typeof window[args.success[0]][args.success[1]] == 'function') {
305
- if (filter) {
306
- response = filter(response, instagram.filterArguments, args.args);
307
- }
308
  window[args.success[0]][args.success[1]](response);
309
  }
310
  }
311
  } else if ( typeof args.success == 'string' ) {
312
  if ( typeof window[args.success] == 'function' ) {
313
- if (filter) {
314
- response = filter(response, instagram.filterArguments, args.args);
315
- }
316
  window[args.success](response);
317
  }
318
  }
319
- else if ( typeof args.success == 'function' ) {
320
- if (filter) {
321
- response = filter(response, instagram.filterArguments, args.args);
322
- }
323
  args.success(response);
324
  }
325
  }
326
  }
327
  }
328
 
329
- this.addTags = function (response) {
330
- for (i in response.data) {
331
- var caption = response.data[i].caption.text;
332
- if (typeof caption !== 'undefined' && caption !== '' && caption.indexOf('#') != -1) {
333
- var res = caption.split('#');
334
- response.data[i].tags = res;
335
- }
336
- }
337
- return response;
338
- }
339
-
340
  this.getTagId = function (tagname) {
341
 
342
  var feed_users = [];
@@ -378,7 +380,7 @@ function WDIInstagram(args) {
378
  }
379
  }
380
  }
381
- if ( typeof data.data != 'undefined' ) {
382
  for ( var i in data.data ) {
383
  var media = data.data[i];
384
  var media_type;
@@ -565,8 +567,7 @@ function WDIInstagram(args) {
565
  * @return object of founded media
566
  */
567
 
568
- this.searchForTagsByName = function (tagname, args)
569
- {
570
  var instagram = this,
571
  noArgument = false,
572
  successFlag = false,
@@ -1045,6 +1046,9 @@ function WDIInstagram(args) {
1045
  *
1046
  * }
1047
  *
 
 
 
1048
  *
1049
  * if callback function is property of any other object just give it as array [ 'parent_object', 'callback_function']
1050
  * or you can pass as callback function an anonymous function
@@ -1057,7 +1061,7 @@ function WDIInstagram(args) {
1057
  * ToDo, we should not use this anymore, get user_id for current user and get user_id/media with graph or basic API
1058
  */
1059
 
1060
- this.getUserMedia = function (args) {
1061
  var instagram = this,
1062
  noArgument = false,
1063
  successFlag = false,
@@ -1103,38 +1107,53 @@ function WDIInstagram(args) {
1103
  data: {
1104
  wdi_nonce:wdi_ajax.wdi_nonce,
1105
  action:"wdi_getUserMedia",
1106
- user_name:getUserName()
 
 
 
1107
  },
1108
  success: function (response)
1109
  {
1110
- response.meta = {"code": 200};
1111
- if (successFlag) {
1112
- if (typeof args.success == 'object' && args.success.length == 2) {
1113
- if (typeof window[args.success[0]] != 'undefined') {
1114
- if (typeof window[args.success[0]][args.success[1]] == 'function') {
1115
- if (filter) {
1116
- response = _this.addTags(response);
1117
- response = filter(response, instagram.filterArguments, args);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1118
  }
1119
- window[args.success[0]][args.success[1]](response);
1120
  }
1121
  }
1122
- } else
1123
- if (typeof args.success == 'string') {
1124
- if (typeof window[args.success] == 'function') {
1125
- if (filter) {
1126
- response = _this.addTags(response);
1127
- response = filter(response, instagram.filterArguments, args);
 
1128
  }
1129
- window[args.success](response);
1130
  }
1131
- } else
1132
- if (typeof args.success == 'function') {
1133
- if (filter) {
1134
- response = _this.addTags(response);
1135
- response = filter(response, instagram.filterArguments, args);
1136
  }
1137
- args.success(response);
1138
  }
1139
  }
1140
 
166
  _this.access_tokens = [];
167
  }
168
 
169
+
170
+ /* counter for break cycle */
171
+ var errorItercount = 0;
172
+ var filterResponse = {data:new Array(), paging:{}} ;
173
+
174
  /**
175
  * Gets recent media based on tagname
176
  *
200
  *
201
  * @return object of founded media
202
  */
203
+ this.getTagRecentMedia = function (tagname, args, next_url, endpoint, iter = 0) {
204
  var instagram = this,
205
  noArgument = false,
206
  successFlag = false,
241
  args.count = 33;
242
  }
243
  }
 
244
  var wdiTagId = this.getTagId(tagname);
245
  jQuery.ajax({
246
  type: "POST",
247
  url: wdi_ajax.ajax_url,
248
  dataType:"json",
249
  data: {
250
+ iter: iter,
251
+ tagname: tagname,
252
+ endpoint: endpoint,
253
+ wdi_nonce: wdi_ajax.wdi_nonce,
254
+ wdiTagId: wdiTagId,
255
+ next_url: next_url,
256
+ user_name: getUserName(),
257
+ action: "wdi_getTagRecentMedia",
258
+ feed_id: wdi_ajax.feed_id,
259
  },
260
  success: function (response) {
261
+ if ( typeof response.error !== 'undefined' && errorItercount < 5 ) {
262
+ /* counter for break cycle */
263
+ errorItercount++;
264
+ _this.getTagRecentMedia(tagname, args, next_url, endpoint, iter)
265
  }
266
+ else if ( typeof response.response !== 'undefined' && typeof response.response.iter !== 'undefined' && filterResponse.data.length < parseInt(wdi_ajax.number_of_photos) && iter < 10 && response.response.paging.next != '' ) {
267
+ next_url = response.response.paging.next;
268
+ filterResponse.data = filterResponse.data.concat(response.response.data);
269
+ filterResponse.paging = response.response.paging;
270
+ _this.getTagRecentMedia(tagname, args, next_url, endpoint, response.response.iter)
271
+ }
272
+ else {
273
+ if ( filterResponse.data.length != 0 ) {
274
+ response.response = filterResponse;
275
  }
276
+ if (wdiTagId === false) {
277
+ wdiTagId = "";
 
278
  }
279
+ if ( typeof response.tag_data !== "undefined" ) {
280
+ var tag_data = response.tag_data;
281
+ if (typeof tag_data.tag_id !== "undefined") {
282
+ wdiTagId = tag_data.tag_id;
283
+ }
284
+ var all_tags = [];
285
+ if (typeof window['wdi_all_tags'] !== "undefined") {
286
+ all_tags = window['wdi_all_tags'];
287
+ }
288
+ all_tags[tag_data.tag_id] = tag_data;
289
+ window['wdi_all_tags'] = all_tags;
290
+ }
291
+ response = response.response;
292
+ response = _this.convertHashtagData(response);
293
+ response.meta = {"code": 200};
294
+ response.tag_id = wdiTagId;
295
+ success(response)
296
  }
 
 
 
 
 
 
 
297
  },
298
  error: function (response) {
299
  if (errorFlag) {
301
  if (typeof window[args['error'][0]][args['error'][1]] == 'function') {
302
  window[args['error'][0]][args['error'][1]](response);
303
  }
304
+ }
305
+ else if (typeof args['error'] == 'string') {
306
  if (typeof window[args['error']] == 'function') {
307
  window[args['error']](response);
308
  }
309
+ }
310
+ else if (typeof args['error'] == 'function') {
311
  args['error'](response);
312
  }
313
  }
321
  if (typeof args.success == 'object' && args.success.length == 2) {
322
  if (typeof window[args.success[0]] != 'undefined') {
323
  if (typeof window[args.success[0]][args.success[1]] == 'function') {
324
+
 
 
325
  window[args.success[0]][args.success[1]](response);
326
  }
327
  }
328
  } else if ( typeof args.success == 'string' ) {
329
  if ( typeof window[args.success] == 'function' ) {
330
+
 
 
331
  window[args.success](response);
332
  }
333
  }
334
+ else if ( typeof args.success == 'function' ) {
335
+
 
 
336
  args.success(response);
337
  }
338
  }
339
  }
340
  }
341
 
 
 
 
 
 
 
 
 
 
 
 
342
  this.getTagId = function (tagname) {
343
 
344
  var feed_users = [];
380
  }
381
  }
382
  }
383
+ if ( typeof data != 'undefined' && typeof data.data != 'undefined' ) {
384
  for ( var i in data.data ) {
385
  var media = data.data[i];
386
  var media_type;
567
  * @return object of founded media
568
  */
569
 
570
+ this.searchForTagsByName = function (tagname, args) {
 
571
  var instagram = this,
572
  noArgument = false,
573
  successFlag = false,
1046
  *
1047
  * }
1048
  *
1049
+ * @param next_url
1050
+ * @param iter
1051
+ *
1052
  *
1053
  * if callback function is property of any other object just give it as array [ 'parent_object', 'callback_function']
1054
  * or you can pass as callback function an anonymous function
1061
  * ToDo, we should not use this anymore, get user_id for current user and get user_id/media with graph or basic API
1062
  */
1063
 
1064
+ this.getUserMedia = function (args, next_url = '', iter = 0) {
1065
  var instagram = this,
1066
  noArgument = false,
1067
  successFlag = false,
1107
  data: {
1108
  wdi_nonce:wdi_ajax.wdi_nonce,
1109
  action:"wdi_getUserMedia",
1110
+ user_name:getUserName(),
1111
+ feed_id: wdi_ajax.feed_id,
1112
+ next_url:next_url,
1113
+ iter:iter,
1114
  },
1115
  success: function (response)
1116
  {
1117
+ if (typeof response.error !== 'undefined' && errorItercount < 5) {
1118
+ errorItercount++;
1119
+ _this.getUserMedia(args, next_url, response.iter)
1120
+ return;
1121
+ }
1122
+
1123
+ if( typeof response.iter !== 'undefined' && filterResponse.data.length < parseInt(wdi_ajax.number_of_photos) && iter < 20 && response.pagination.next_url != '') {
1124
+ next_url = response.pagination.next_url;
1125
+ filterResponse.data = filterResponse.data.concat(response.data);
1126
+ filterResponse.pagination = response.pagination;
1127
+ _this.getUserMedia( args, next_url, response.iter)
1128
+ } else {
1129
+ if(filterResponse.data.length != 0) {
1130
+ response = filterResponse;
1131
+ }
1132
+ response.meta = {"code": 200};
1133
+ if (successFlag) {
1134
+ if (typeof args.success == 'object' && args.success.length == 2) {
1135
+ if (typeof window[args.success[0]] != 'undefined') {
1136
+ if (typeof window[args.success[0]][args.success[1]] == 'function') {
1137
+ if (filter) {
1138
+ response = _this.addTags(response);
1139
+ response = filter(response, instagram.filterArguments, args);
1140
+ }
1141
+ window[args.success[0]][args.success[1]](response);
1142
  }
 
1143
  }
1144
  }
1145
+ else if (typeof args.success == 'string') {
1146
+ if (typeof window[args.success] == 'function') {
1147
+ if (filter) {
1148
+ response = _this.addTags(response);
1149
+ response = filter(response, instagram.filterArguments, args);
1150
+ }
1151
+ window[args.success](response);
1152
  }
 
1153
  }
1154
+ else if (typeof args.success == 'function') {
1155
+ args.success(response);
 
 
 
1156
  }
 
1157
  }
1158
  }
1159
 
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 d=this;function f(){return void 0!==d.user&&void 0!==d.user.user_name?d.user.user_name:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_name:""}function a(){return void 0!==d.user&&void 0!==d.user.access_token?d.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=d.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&&d.access_tokens.push(e)},this.resetTokens=function(){d.access_tokens=[]},this.getTagRecentMedia=function(e,r,s,t){var o=this,i=!1,n=this.statusCode,c=!1,u=this.getFilter("getTagRecentMedia");t=0===parseInt(t)?"top_media":"recent_media",void 0===r||0===r.length||("success"in r&&(i=!0),"statusCode"in r&&(n=r.statusCode),"error"in r&&(c=!0),"args"in r||(r.args={}),"count"in r?(r.count=parseInt(r.count),(!Number.isInteger(r.count)||r.count<=0)&&(r.count=33)):r.count=33);var a=this.getTagId(e);jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{tagname:e,endpoint:t,wdi_nonce:wdi_ajax.wdi_nonce,wdiTagId:a,next_url:s,user_name:f(),action:"wdi_getTagRecentMedia"},success:function(e){var s,t;!1===a&&(a=""),void 0!==e.tag_data&&(void 0!==(s=e.tag_data).tag_id&&(a=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=e.response,(e=d.convertHashtagData(e)).meta={code:200},e.tag_id=a,function(e){void 0===e.data&&(e.data=[]);i&&("object"==typeof r.success&&2==r.success.length?void 0!==window[r.success[0]]&&"function"==typeof window[r.success[0]][r.success[1]]&&(u&&(e=u(e,o.filterArguments,r.args)),window[r.success[0]][r.success[1]](e)):"string"==typeof r.success?"function"==typeof window[r.success]&&(u&&(e=u(e,o.filterArguments,r.args)),window[r.success](e)):"function"==typeof r.success&&(u&&(e=u(e,o.filterArguments,r.args)),r.success(e)))}(e=d.addTags(e))},error:function(e){c&&("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:n})},this.addTags=function(e){for(i in e.data){var s,t=e.data[i].caption.text;void 0!==t&&""!==t&&-1!=t.indexOf("#")&&(s=t.split("#"),e.data[i].tags=s)}return e},this.getTagId=function(e){var s,t=[];for(var r in"undefined"!=typeof wdi_controller?0!==(t=wdi_controller.feed_users).length||void 0!==(s=jQuery("#WDI_feed_users").val())&&""!==s&&(t=JSON.parse(s)):void 0!==window.wdi_all_tags&&(t=window.wdi_all_tags),t)if(e===t[r].username||"#"+e===t[r].username)return void 0!==t[r].tag_id&&t[r].tag_id;return!1},this.convertHashtagData=function(e){var s={data:[],pagination:{}};if(void 0!==e&&void 0!==e.paging&&(s.pagination={cursors:{after:e.paging.cursors.after},next_url:e.paging.next}),void 0!==e.data)for(var t in e.data){var r,o=e.data[t],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.thumb_url},low_bandwidth:{width:480,height:600,url:o.thumb_url},low_resolution:{width:480,height:600,url:o.thumb_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)}s.data.push(n)}return s},this.searchForTagsByName=function(e,t){var r=this,o=!1,i=this.statusCode,n=!1;filter=this.getFilter("searchForTagsByName"),void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(n=!0),"statusCode"in t&&(i=t.statusCode));var c="https://api.instagram.com/v1/tags/search?q="+e+"&access_token="+a();d.getDataFromCache(function(e){function s(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]]&&(filter&&(e=filter(e,r.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(filter&&(e=filter(e,r.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(filter&&(e=filter(e,r.filterArguments)),t.success(e)))}!1===e?jQuery.ajax({type:"POST",url:c,dataType:"jsonp",success:function(e){d.setDataToCache(c,e),s(e)},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}):s(e)},c)},this.searchForUsersByName=function(e,s){var t=this,r=!1,o=(this.statusCode,!1),i=this.getFilter("searchForUsersByName");void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(o=!0),"statusCode"in s&&s.statusCode),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/search?q="+e+"&access_token="+a(),success:function(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]]&&(i&&(e=i(e,t.filterArguments)),e.args=s,window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments)),e.args=s,window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments)),(e.args=s).success(e)))},error:function(e){o&&("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,r=!1,e=this.statusCode,o=!1,i=this.getFilter("getRecentLikedMedia"),n="https://api.instagram.com/v1/users/self/media/liked?access_token="+a();void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(o=!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,n+="&count="+s.count,"next_max_like_id"in s&&(n+="&next_max_like_id="+s.next_max_like_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:n,success:function(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]]&&(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){o&&("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,r=!1,o=this.statusCode,i=!1,n=this.getFilter("getUserRecentMedia"),c="https://api.instagram.com/v1/users/"+e+"/media/recent/?access_token="+a();void 0===s||0===s.length||("success"in s&&(r=!0),"statusCode"in s&&(o=s.statusCode),"args"in s||(s.args={}),"error"in s&&(i=!0),"count"in s?(s.count=parseInt(s.count),(!Number.isInteger(s.count)||s.count<=0)&&(s.count=33)):s.count=33,c+="&count="+s.count,"min_id"in s&&(c+="&min_id="+s.min_id),"max_id"in s&&(c+="&max_id="+s.max_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:c,success:function(e){void 0===e.data&&(e.data=[]),r&&("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){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:o})},this.getUserMedia=function(s){var t=this,r=!1,e=this.statusCode,o=!1,i=this.getFilter("getUserMedia");void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(o=!0),"statusCode"in s&&(e=s.statusCode),"args"in s||(s.args={}),"count"in s?(s.count=parseInt(s.count),(!Number.isInteger(s.count)||s.count<=0)&&(s.count=20)):s.count=20),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getUserMedia",user_name:f()},success:function(e){e.meta={code:200},r&&("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=d.addTags(e),e=i(e,t.filterArguments,s)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=d.addTags(e),e=i(e,t.filterArguments,s)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=d.addTags(e),e=i(e,t.filterArguments,s)),s.success(e)))},error:function(e){o&&("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.getUserInfo=function(e,s){var t=this,r=!1,o=this.statusCode,i=!1,n=this.getFilter("getUserInfo");void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(i=!0),"statusCode"in s&&(o=s.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+e+"/?access_token="+a(),success:function(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]]&&(n&&(e=n(e,t.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(n&&(e=n(e,t.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(n&&(e=n(e,t.filterArguments)),s.success(e)))},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:o})},this.getSelfInfo=function(t){var r=this,o=!1,i=this.statusCode,n=!1,c=this.getFilter("getSelfInfo");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(n=!0),"statusCode"in t&&(i=t.statusCode));var u="https://graph.facebook.com/v3.2/"+(void 0!==d.user&&void 0!==d.user.user_id?d.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="+a();d.getDataFromCache(function(e){var s;!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:u,statusCode:i,success:function(e){d.setDataToCache(u,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.meta={code:200},e=c(e,r.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,r.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(c&&(e.meta={code:200},e=c(e,r.filterArguments)),t.success(e)))},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))}}):(s=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&&(s=c(s,r.filterArguments)),window[t.success[0]][t.success[1]](s)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(s=c(s,r.filterArguments)),window[t.success](s)):"function"==typeof t.success&&(c&&(s=c(s,r.filterArguments)),t.success(s))))},u)},this.getRecentMediaComments=function(e,t){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));var u="https://api.instagram.com/v1/media/"+e+"/comments?access_token="+a();d.getDataFromCache(function(e){function s(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)))}!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:u,success:function(e){d.setDataToCache(u,e),s(e)},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}):s(e)},u)},this.getRecentMediaLikes=function(e,s){var t=this,r=!1,o=this.statusCode,i=!1,n=this.getFilter("getRecentMediaLikes");void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(i=!0),"statusCode"in s&&(o=s.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/media/"+e+"/likes?access_token="+a(),success:function(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]]&&(n&&(e=n(e,t.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(n&&(e=n(e,t.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(n&&(e=n(e,t.filterArguments)),s.success(e)))},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:o})},this.requestByUrl=function(t,r){for(var o=this,i=!1,n=!1,c=this.statusCode,u=this.getFilter("requestByUrl"),e=t.split("?")[1].split("&"),s=0;s<e.length;s++)e[s]=e[s].split("="),"access_token"==e[s][0]&&(e[s][1]=a()),e[s]=e[s].join("=");e=e.join("&"),t=t.split("?")[0]+"?"+e,void 0===r||0===r.length||("success"in r&&(i=!0),"args"in r||(r.args={}),"error"in r&&(n=!0),"statusCode"in r&&(c=r.statusCode));d.getDataFromCache(function(e){var s;!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:t,success:function(e){d.setDataToCache(t,e),i&&("object"==typeof r.success&&2==r.success.length?void 0!==window[r.success[0]]&&"function"==typeof window[r.success[0]][r.success[1]]&&(u&&(e=u(e,o.filterArguments,r.args)),window[r.success[0]][r.success[1]](e)):"string"==typeof r.success?"function"==typeof window[r.success]&&(u&&(e=u(e,o.filterArguments,r.args)),window[r.success](e)):"function"==typeof r.success&&(u&&(e=u(e,o.filterArguments,r.args)),r.success(e)))},error:function(e){n&&("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:c}):(s=e,i&&("object"==typeof r.success&&2==r.success.length?void 0!==window[r.success[0]]&&"function"==typeof window[r.success[0]][r.success[1]]&&(u&&(s=u(s,o.filterArguments,r.args)),window[r.success[0]][r.success[1]](s)):"string"==typeof r.success?"function"==typeof window[r.success]&&(u&&(s=u(s,o.filterArguments,r.args)),window[r.success](s)):"function"==typeof r.success&&(u&&(s=u(s,o.filterArguments,r.args)),r.success(s))))},t)},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){var s;e.success&&void 0!==e.cache_data&&null!==e.cache_data?(s=JSON.parse(e.cache_data),t(s)):t(!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){}})}}
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 s=this;function t(){return void 0!==s.user&&void 0!==s.user.user_name?s.user.user_name:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_name:""}function r(){return void 0!==s.user&&void 0!==s.user.access_token?s.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=s.filters;if(void 0===t)return!1;for(var r=0;r<t.length;r++)if(t[r].where==e)if("object"==typeof t[r].what&&2==t[r].what.length){if(void 0!==window[t[r].what[0]]&&"function"==typeof window[t[r].what[0]][t[r].what[1]])return window[t[r].what[0]][t[r].what[1]]}else{if("string"!=typeof t[r].what)return"function"==typeof t[r].what&&t[r].what;if("function"==typeof window[t[r].what])return window[t[r].what]}return!1},this.addToken=function(e){"string"==typeof e&&s.access_tokens.push(e)},this.resetTokens=function(){s.access_tokens=[]};var o=0,i={data:new Array,paging:{}};this.getTagRecentMedia=function(e,r,n,c,u=0){var a=!1,d=this.statusCode,f=!1;this.getFilter("getTagRecentMedia");c=0===parseInt(c)?"top_media":"recent_media",void 0===r||0===r.length||("success"in r&&(a=!0),"statusCode"in r&&(d=r.statusCode),"error"in r&&(f=!0),"args"in r?!0:r.args={},"count"in r?(r.count=parseInt(r.count),(!Number.isInteger(r.count)||r.count<=0)&&(r.count=33)):r.count=33);var w=this.getTagId(e);jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{iter:u,tagname:e,endpoint:c,wdi_nonce:wdi_ajax.wdi_nonce,wdiTagId:w,next_url:n,user_name:t(),action:"wdi_getTagRecentMedia",feed_id:wdi_ajax.feed_id},success:function(t){if(void 0!==t.error&&o<5)o++,s.getTagRecentMedia(e,r,n,c,u);else if(void 0!==t.response&&void 0!==t.response.iter&&i.data.length<parseInt(wdi_ajax.number_of_photos)&&u<10&&""!=t.response.paging.next)n=t.response.paging.next,i.data=i.data.concat(t.response.data),i.paging=t.response.paging,s.getTagRecentMedia(e,r,n,c,t.response.iter);else{if(0!=i.data.length&&(t.response=i),!1===w&&(w=""),void 0!==t.tag_data){var d=t.tag_data;void 0!==d.tag_id&&(w=d.tag_id);var f=[];void 0!==window.wdi_all_tags&&(f=window.wdi_all_tags),f[d.tag_id]=d,window.wdi_all_tags=f}t=t.response,(t=s.convertHashtagData(t)).meta={code:200},t.tag_id=w,function(e){void 0===e.data&&(e.data=[]);a&&("object"==typeof r.success&&2==r.success.length?void 0!==window[r.success[0]]&&"function"==typeof window[r.success[0]][r.success[1]]&&window[r.success[0]][r.success[1]](e):"string"==typeof r.success?"function"==typeof window[r.success]&&window[r.success](e):"function"==typeof r.success&&r.success(e))}(t)}},error:function(e){f&&("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:d})},this.getTagId=function(e){var s=[];if("undefined"!=typeof wdi_controller){if(0===(s=wdi_controller.feed_users).length){var t=jQuery("#WDI_feed_users").val();void 0!==t&&""!==t&&(s=JSON.parse(t))}}else void 0!==window.wdi_all_tags&&(s=window.wdi_all_tags);for(var r in s)if(e===s[r].username||"#"+e===s[r].username)return void 0!==s[r].tag_id&&s[r].tag_id;return!1},this.convertHashtagData=function(e){var s={data:[],pagination:{}};if(void 0!==e&&void 0!==e.paging&&(s.pagination={cursors:{after:e.paging.cursors.after},next_url:e.paging.next}),void 0!==e&&void 0!==e.data)for(var t in e.data){var r,o=e.data[t];r="IMAGE"===o.media_type?"image":"VIDEO"===o.media_type?"video":"carousel";var i={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:o.like_count>0,likes:{count:o.like_count},tags:[],filter:"Normal",comments:{count:o.comments_count},type:r,link:o.permalink,location:null,attribution:null,users_in_photo:[]};if("IMAGE"===o.media_type||"CAROUSEL_ALBUM"===o.media_type?i.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&&(i.videos={standard_resolution:{width:640,height:800,url:o.thumb_url},low_bandwidth:{width:480,height:600,url:o.thumb_url},low_resolution:{width:480,height:600,url:o.thumb_url}}),"CAROUSEL_ALBUM"===o.media_type)for(var n in i.carousel_media=[],o.children.data){if("IMAGE"===o.children.data[n].media_type)var c={images:{thumbnail:{width:150,height:150,url:o.children.data[n].media_url},low_resolution:{width:320,height:320,url:o.children.data[n].media_url},standard_resolution:{width:640,height:640,url:o.children.data[n].media_url}},users_in_photo:[],type:"image"};else c={videos:{standard_resolution:{width:640,height:800,url:o.children.data[n].media_url,id:o.children.data[n].id},low_bandwidth:{width:480,height:600,url:o.children.data[n].media_url,id:o.children.data[n].id},low_resolution:{width:480,height:600,url:o.children.data[n].media_url,id:o.children.data[n].id}},users_in_photo:[],type:"video"};i.carousel_media.push(c)}s.data.push(i)}return s},this.searchForTagsByName=function(e,t){var o=this,i=!1,n=this.statusCode,c=!1;filter=this.getFilter("searchForTagsByName"),void 0===t||0===t.length||("success"in t&&(i=!0),"error"in t&&(c=!0),"statusCode"in t&&(n=t.statusCode));var u="https://api.instagram.com/v1/tags/search?q="+e+"&access_token="+r();s.getDataFromCache(function(e){function r(e){i&&("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:u,dataType:"jsonp",success:function(e){s.setDataToCache(u,e),r(e)},error:function(e){c&&("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}):r(e)},u)},this.searchForUsersByName=function(e,s){var t=this,o=!1,i=(this.statusCode,!1),n=this.getFilter("searchForUsersByName");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(i=!0),"statusCode"in s&&s.statusCode),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/search?q="+e+"&access_token="+r(),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,s.success(e)))},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:this.statusCode})},this.getRecentLikedMedia=function(e){var s=this,t=!1,o=this.statusCode,i=!1,n=this.getFilter("getRecentLikedMedia"),c="https://api.instagram.com/v1/users/self/media/liked?access_token="+r();void 0===e||0===e.length||("success"in e&&(t=!0),"error"in e&&(i=!0),"statusCode"in e&&(o=e.statusCode),"args"in e?argFlag=!0:e.args={},"count"in e?(e.count=parseInt(e.count),(!Number.isInteger(e.count)||e.count<=0)&&(e.count=20)):e.count=20,c+="&count="+e.count,"next_max_like_id"in e&&(c+="&next_max_like_id="+e.next_max_like_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:c,success:function(r){t&&("object"==typeof e.success&&2==e.success.length?void 0!==window[e.success[0]]&&"function"==typeof window[e.success[0]][e.success[1]]&&(n&&(r=n(r,s.filterArguments,e.args)),window[e.success[0]][e.success[1]](r)):"string"==typeof e.success?"function"==typeof window[e.success]&&(n&&(r=n(r,s.filterArguments,e.args)),window[e.success](r)):"function"==typeof e.success&&(n&&(r=n(r,s.filterArguments,e.args)),e.success(r)))},error:function(s){i&&("object"==typeof e.error&&2==e.error.length?"function"==typeof window[e.error[0]][e.error[1]]&&window[e.error[0]][e.error[1]](s):"string"==typeof e.error?"function"==typeof window[e.error]&&window[e.error](s):"function"==typeof e.error&&e.error(s))},statusCode:o})},this.getUserRecentMedia=function(e,s){var t=this,o=!1,i=this.statusCode,n=!1,c=this.getFilter("getUserRecentMedia"),u="https://api.instagram.com/v1/users/"+e+"/media/recent/?access_token="+r();void 0===s||0===s.length||("success"in s&&(o=!0),"statusCode"in s&&(i=s.statusCode),"args"in s?!0: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,u+="&count="+s.count,"min_id"in s&&(u+="&min_id="+s.min_id),"max_id"in s&&(u+="&max_id="+s.max_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:u,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]]&&(c&&(e=c(e,t.filterArguments,s.args)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(e=c(e,t.filterArguments,s.args)),window[s.success](e)):"function"==typeof s.success&&(c&&(e=c(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:i})},this.getUserMedia=function(e,r="",n=0){var c=this,u=!1,a=this.statusCode,d=!1,f=this.getFilter("getUserMedia");void 0===e||0===e.length||("success"in e&&(u=!0),"error"in e&&(d=!0),"statusCode"in e&&(a=e.statusCode),"args"in e?!0:e.args={},"count"in e?(e.count=parseInt(e.count),(!Number.isInteger(e.count)||e.count<=0)&&(e.count=20)):e.count=20),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getUserMedia",user_name:t(),feed_id:wdi_ajax.feed_id,next_url:r,iter:n},success:function(t){if(void 0!==t.error&&o<5)return o++,void s.getUserMedia(e,r,t.iter);void 0!==t.iter&&i.data.length<parseInt(wdi_ajax.number_of_photos)&&n<20&&""!=t.pagination.next_url?(r=t.pagination.next_url,i.data=i.data.concat(t.data),i.pagination=t.pagination,s.getUserMedia(e,r,t.iter)):(0!=i.data.length&&(t=i),t.meta={code:200},u&&("object"==typeof e.success&&2==e.success.length?void 0!==window[e.success[0]]&&"function"==typeof window[e.success[0]][e.success[1]]&&(f&&(t=s.addTags(t),t=f(t,c.filterArguments,e)),window[e.success[0]][e.success[1]](t)):"string"==typeof e.success?"function"==typeof window[e.success]&&(f&&(t=s.addTags(t),t=f(t,c.filterArguments,e)),window[e.success](t)):"function"==typeof e.success&&e.success(t)))},error:function(s){d&&("object"==typeof e.error&&2==e.error.length?"function"==typeof window[e.error[0]][e.error[1]]&&window[e.error[0]][e.error[1]](s):"string"==typeof e.error?"function"==typeof window[e.error]&&window[e.error](s):"function"==typeof e.error&&e.error(s))},statusCode:a})},this.getUserInfo=function(e,s){var t=this,o=!1,i=this.statusCode,n=!1,c=this.getFilter("getUserInfo");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(i=s.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+e+"/?access_token="+r(),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]]&&(c&&(e=c(e,t.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(e=c(e,t.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(c&&(e=c(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:i})},this.getSelfInfo=function(e){var t=this,o=!1,i=this.statusCode,n=!1,c=this.getFilter("getSelfInfo");void 0===e||0===e.length||("success"in e&&(o=!0),"error"in e&&(n=!0),"statusCode"in e&&(i=e.statusCode));var u="https://graph.facebook.com/v3.2/"+(void 0!==s.user&&void 0!==s.user.user_id?s.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="+r();s.getDataFromCache(function(r){var a;!1===r?jQuery.ajax({type:"POST",dataType:"jsonp",url:u,statusCode:i,success:function(r){s.setDataToCache(u,r),o&&("object"==typeof e.success&&2==e.success.length?void 0!==window[e.success[0]]&&"function"==typeof window[e.success[0]][e.success[1]]&&(c&&(r.meta={code:200},r=c(r,t.filterArguments)),window[e.success[0]][e.success[1]](r)):"string"==typeof e.success?"function"==typeof window[e.success]&&(c&&(r.meta={code:200},r=c(r,t.filterArguments)),window[e.success](r)):"function"==typeof e.success&&(c&&(r.meta={code:200},r=c(r,t.filterArguments)),e.success(r)))},error:function(s){n&&("object"==typeof e.error&&2==e.error.length?"function"==typeof window[e.error[0]][e.error[1]]&&window[e.error[0]][e.error[1]](s):"string"==typeof e.error?"function"==typeof window[e.error]&&window[e.error](s):"function"==typeof e.error&&e.error(s))}}):(a=r,o&&("object"==typeof e.success&&2==e.success.length?void 0!==window[e.success[0]]&&"function"==typeof window[e.success[0]][e.success[1]]&&(c&&(a=c(a,t.filterArguments)),window[e.success[0]][e.success[1]](a)):"string"==typeof e.success?"function"==typeof window[e.success]&&(c&&(a=c(a,t.filterArguments)),window[e.success](a)):"function"==typeof e.success&&(c&&(a=c(a,t.filterArguments)),e.success(a))))},u)},this.getRecentMediaComments=function(e,t){var o=this,i=!1,n=this.statusCode,c=!1,u=this.getFilter("getRecentMediaComments");void 0===t||0===t.length||("success"in t&&(i=!0),"error"in t&&(c=!0),"statusCode"in t&&(n=t.statusCode));var a="https://api.instagram.com/v1/media/"+e+"/comments?access_token="+r();s.getDataFromCache(function(e){function r(e){i&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(u&&(e=u(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(u&&(e=u(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(u&&(e=u(e,o.filterArguments)),t.success(e)))}!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:a,success:function(e){s.setDataToCache(a,e),r(e)},error:function(e){c&&("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}):r(e)},a)},this.getRecentMediaLikes=function(e,s){var t=this,o=!1,i=this.statusCode,n=!1,c=this.getFilter("getRecentMediaLikes");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(i=s.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/media/"+e+"/likes?access_token="+r(),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]]&&(c&&(e=c(e,t.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(e=c(e,t.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(c&&(e=c(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:i})},this.requestByUrl=function(e,t){var o,i=this,n=!1,c=!1,u=this.statusCode,a=this.getFilter("requestByUrl");o=e.split("?")[1].split("&");for(var d=0;d<o.length;d++)o[d]=o[d].split("="),"access_token"==o[d][0]&&(o[d][1]=r()),o[d]=o[d].join("=");o=o.join("&"),e=e.split("?")[0]+"?"+o,void 0===t||0===t.length||("success"in t&&(n=!0),"args"in t?!0:t.args={},"error"in t&&(c=!0),"statusCode"in t&&(u=t.statusCode));s.getDataFromCache(function(r){var o;!1===r?jQuery.ajax({type:"POST",dataType:"jsonp",url:e,success:function(r){s.setDataToCache(e,r),n&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(a&&(r=a(r,i.filterArguments,t.args)),window[t.success[0]][t.success[1]](r)):"string"==typeof t.success?"function"==typeof window[t.success]&&(a&&(r=a(r,i.filterArguments,t.args)),window[t.success](r)):"function"==typeof t.success&&(a&&(r=a(r,i.filterArguments,t.args)),t.success(r)))},error:function(e){c&&("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:u}):(o=r,n&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(a&&(o=a(o,i.filterArguments,t.args)),window[t.success[0]][t.success[1]](o)):"string"==typeof t.success?"function"==typeof window[t.success]&&(a&&(o=a(o,i.filterArguments,t.args)),window[t.success](o)):"function"==typeof t.success&&(a&&(o=a(o,i.filterArguments,t.args)),t.success(o))))},e)},this.getDataFromCache=function(e,s,t){void 0===t&&(t=!0),jQuery.ajax({type:"POST",async:t,url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:s,wdi_nonce:wdi_ajax.wdi_nonce,WDI_MINIFY:wdi_ajax.WDI_MINIFY,task:"get",action:"wdi_cache"},success:function(s){if(s.success)if(void 0!==s.cache_data&&null!==s.cache_data){var t=JSON.parse(s.cache_data);e(t)}else e(!1);else e(!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.5
7
- Stable tag: 1.4.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -505,6 +505,12 @@ Please make sure you don't have any important information before you proceed.
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.8 =
509
  Fixed: JS error.
510
  Fixed: Broken images.
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.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
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.9 =
509
+ Fixed: Filters logic.
510
+ Fixed: Load more functionality.
511
+ Fixed: Update user info on feed saving.
512
+ Fixed: Hashtag removing functionality.
513
+
514
  = 1.4.8 =
515
  Fixed: JS error.
516
  Fixed: Broken images.
templates/plugin-uninstalled.php DELETED
@@ -1,36 +0,0 @@
1
- <?php $deactivate_url = wp_nonce_url('plugins.php?action=deactivate&amp;plugin=wd-instagram-feed/wd-instagram-feed.php', 'deactivate-plugin_wd-instagram-feed/wd-instagram-feed.php'); ?>
2
- <div id="wdi_plugin_uninstalled">
3
- <style>
4
- .wdi_plugin_uninstalled p{
5
- font-size: 20px;
6
- }
7
- .wdi_plugin_uninstalled p span{
8
- font-weight: bold;
9
- }
10
- .wdi_plugin_uninstalled p span.wdi_regards{
11
- font-size: 25px;
12
- }
13
- .wdi_plugin_uninstalled img{
14
- width: 100%;
15
- }
16
- .wdi_plugin_uninstalled{
17
- width: 75%;
18
- display: inline-block;
19
- }
20
- #wdi_plugin_uninstalled{
21
- text-align: center;
22
- }
23
-
24
-
25
- </style>
26
- <div class="wdi_plugin_uninstalled_container">
27
- <div class="wdi_plugin_uninstalled">
28
- <p>Dear <span><?php echo (wp_get_current_user()->user_firstname!='') ? wp_get_current_user()->user_firstname .' '. wp_get_current_user()->user_lastname : wp_get_current_user()->user_login?></span> <?php _e('you have uninstalled','wd-instagram-feed') ?> <span>Instagram Feed </span><?php _e('plugin,if you want to use it again simply deactivate and activate it again','wd-instagram-feed') ?>
29
- <span class="wdi_regards">Best regards 10Web Team.</span></p>
30
- <a href="<?php echo $deactivate_url?>">Deactivate Plugin</a>
31
- <p id="wdi_redirect"></p>
32
- </div>
33
- </div>
34
- </div>
35
- <script type="text/javascript">
36
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wd-instagram-feed.php CHANGED
@@ -3,14 +3,14 @@
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.8
7
  Author: 10Web
8
  Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
9
  License: GPLv2 or later
10
  */
11
 
12
  // define constants
13
- define('WDI_VERSION', '1.4.8');
14
  define('WDI_IS_FREE', TRUE);
15
  define('WDI_PREFIX', 'wdi');
16
  define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
@@ -22,8 +22,7 @@ define('WDI_FSN', 'wdi_feed_settings');
22
  define('WDI_TSN', 'wdi_theme_settings');
23
  define('WDI_FEED_TABLE', 'wdi_feeds');
24
  define('WDI_THEME_TABLE', 'wdi_themes');
25
- $wdi_minify = (isset($_GET['wdi_no_minify']) && rest_sanitize_boolean($_GET['wdi_no_minify']) == 'true') ? FALSE : TRUE;
26
- define('WDI_MINIFY', $wdi_minify);
27
 
28
  add_action('wp_ajax_wdi_cache', 'wdi_cache');
29
  add_action('wp_ajax_nopriv_wdi_cache', 'wdi_cache');
@@ -92,7 +91,7 @@ function wdi_getTagRecentMedia(){
92
  if( $wdiTagIdTemp !== "false" && !empty($wdiTagIdTemp) ) {
93
  $wdiTagId = $wdiTagIdTemp;
94
  }
95
- $next_urlTemp = WDILibrary::get('next_url');
96
  if( !empty($next_urlTemp) ){
97
  $next_url = $next_urlTemp;
98
  }
@@ -272,32 +271,19 @@ function wdi_privacy_policy() {
272
  $text
273
  );
274
  }
 
275
  $wdi_options = wdi_get_options();
276
- wp_schedule_single_event( time() + intval($wdi_options["wdi_transient_time"]), 'wdi_cache_cron' );
 
277
  add_action( 'wdi_cache_cron', 'wdi_run_cache_cron' );
278
  function wdi_run_cache_cron() {
 
 
279
  require_once ("framework/WDIInstagram.php");
280
  $WDIInstagram = new WDIInstagram();
281
  $WDIInstagram->wdi_preload_cache();
282
  }
283
 
284
- add_filter('cron_schedules', 'wdi_autoupdate_interval');
285
-
286
- function wdi_autoupdate_interval( $schedules ) {
287
- $schedules['wdi_autoupdate_interval'] = array(
288
- 'interval' => 2592000, // 30 days
289
- 'display' => __('Instagram Feed token autoupdate interval.', 'wd-instagram-feed'),
290
- );
291
-
292
- return $schedules;
293
- }
294
-
295
- add_action('wdi_schedule_event_hook', 'wdi_schedule_events');
296
- function wdi_schedule_events() {
297
- require_once(WDI_DIR . '/framework/WDILibrary.php');
298
- WDILibrary::refresh_instagram_access_token();
299
- }
300
-
301
  add_filter('wdi_sanitize_options', 'wdi_create_sample_feed');
302
  function wdi_create_sample_feed($new_options){
303
  require_once(WDI_DIR . '/framework/WDILibrary.php');
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.9
7
  Author: 10Web
8
  Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
9
  License: GPLv2 or later
10
  */
11
 
12
  // define constants
13
+ define('WDI_VERSION', '1.4.9');
14
  define('WDI_IS_FREE', TRUE);
15
  define('WDI_PREFIX', 'wdi');
16
  define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
22
  define('WDI_TSN', 'wdi_theme_settings');
23
  define('WDI_FEED_TABLE', 'wdi_feeds');
24
  define('WDI_THEME_TABLE', 'wdi_themes');
25
+ define('WDI_MINIFY', TRUE);
 
26
 
27
  add_action('wp_ajax_wdi_cache', 'wdi_cache');
28
  add_action('wp_ajax_nopriv_wdi_cache', 'wdi_cache');
91
  if( $wdiTagIdTemp !== "false" && !empty($wdiTagIdTemp) ) {
92
  $wdiTagId = $wdiTagIdTemp;
93
  }
94
+ $next_urlTemp = WDILibrary::get('next_url', '', 'esc_url_raw', 'POST' );
95
  if( !empty($next_urlTemp) ){
96
  $next_url = $next_urlTemp;
97
  }
271
  $text
272
  );
273
  }
274
+
275
  $wdi_options = wdi_get_options();
276
+ wp_schedule_single_event( time() + (intval($wdi_options["wdi_transient_time"])*60), 'wdi_cache_cron' );
277
+
278
  add_action( 'wdi_cache_cron', 'wdi_run_cache_cron' );
279
  function wdi_run_cache_cron() {
280
+ require_once(WDI_DIR . '/framework/WDILibrary.php');
281
+ WDILibrary::refresh_instagram_access_token();
282
  require_once ("framework/WDIInstagram.php");
283
  $WDIInstagram = new WDIInstagram();
284
  $WDIInstagram->wdi_preload_cache();
285
  }
286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  add_filter('wdi_sanitize_options', 'wdi_create_sample_feed');
288
  function wdi_create_sample_feed($new_options){
289
  require_once(WDI_DIR . '/framework/WDILibrary.php');