Version Description
Fixed: Feed images view.
Download this release
Release Info
Developer | webdorado |
Plugin | WD Instagram Feed – Instagram Gallery |
Version | 1.4.7 |
Comparing to | |
See all releases |
Code changes from version 1.4.6 to 1.4.7
- admin/views/settings.php +2 -2
- framework/WDIInstagram.php +8 -8
- framework/WDILibrary.php +0 -16
- framework/WDILibraryEmbed.php +22 -858
- framework/WDI_generate_styles.php +0 -2
- frontend/views/WDIViewGalleryBox.php +65 -79
- js/gallerybox/wdi_gallery_box.js +49 -204
- js/gallerybox/wdi_gallery_box.min.js +1 -1
- js/wdi_frontend.js +21 -17
- js/wdi_frontend.min.js +1 -1
- js/wdi_instagram.js +11 -11
- js/wdi_instagram.min.js +1 -1
- readme.txt +4 -1
- update/wdi_update.php +0 -41
- wd-instagram-feed.php +16 -32
admin/views/settings.php
CHANGED
@@ -216,9 +216,9 @@ class Settings_view_wdi {
|
|
216 |
<span class="wdi_account_type"><?php _e('Business', 'wd-instagram-feed'); ?></span>
|
217 |
</label>
|
218 |
<span class="wdi_info_text"><?php _e('Used for displaying user feeds and <span>hashtags</span><br class="wdi_desktop"> from a “Business” Instagram account.', 'wd-instagram-feed'); ?></span>
|
219 |
-
<?php if(IS_FREE)
|
220 |
<a href="#" class="wdi_paid">This option is available in Premium version</a>
|
221 |
-
<?php
|
222 |
</p>
|
223 |
</div>
|
224 |
<a href="<?php echo $personal_href; ?>" class="button button-primary wdi-connect"><?php _e('Connect', 'wd-instagram-feed'); ?></a>
|
216 |
<span class="wdi_account_type"><?php _e('Business', 'wd-instagram-feed'); ?></span>
|
217 |
</label>
|
218 |
<span class="wdi_info_text"><?php _e('Used for displaying user feeds and <span>hashtags</span><br class="wdi_desktop"> from a “Business” Instagram account.', 'wd-instagram-feed'); ?></span>
|
219 |
+
<?php if ( IS_FREE ) { ?>
|
220 |
<a href="#" class="wdi_paid">This option is available in Premium version</a>
|
221 |
+
<?php } ?>
|
222 |
</p>
|
223 |
</div>
|
224 |
<a href="<?php echo $personal_href; ?>" class="button button-primary wdi-connect"><?php _e('Connect', 'wd-instagram-feed'); ?></a>
|
framework/WDIInstagram.php
CHANGED
@@ -187,17 +187,17 @@ class WDIInstagram {
|
|
187 |
"thumbnail" => array(
|
188 |
"width" => 150,
|
189 |
"height" => 150,
|
190 |
-
"url" => (isset($media["
|
191 |
),
|
192 |
"low_resolution" => array(
|
193 |
"width" => 320,
|
194 |
"height" => 320,
|
195 |
-
"url" => (isset($media["
|
196 |
),
|
197 |
"standard_resolution" => array(
|
198 |
"width" => 1080,
|
199 |
"height" => 1080,
|
200 |
-
"url" => (isset($media["
|
201 |
),
|
202 |
),
|
203 |
"created_time" => (isset($media["timestamp"]) ? $media["timestamp"] : ""),
|
@@ -233,17 +233,17 @@ class WDIInstagram {
|
|
233 |
"standard_resolution" => array(
|
234 |
"width" => 640,
|
235 |
"height" => 800,
|
236 |
-
"url" => $media["
|
237 |
),
|
238 |
"low_bandwidth" => array(
|
239 |
"width" => 480,
|
240 |
"height" => 600,
|
241 |
-
"url" => $media["
|
242 |
),
|
243 |
"low_resolution" => array(
|
244 |
"width" => 480,
|
245 |
"height" => 600,
|
246 |
-
"url" => $media["
|
247 |
),
|
248 |
);
|
249 |
}
|
@@ -327,12 +327,12 @@ class WDIInstagram {
|
|
327 |
"thumbnail" => array(
|
328 |
"width" => 150,
|
329 |
"height" => 150,
|
330 |
-
"url" => $media_data["
|
331 |
),
|
332 |
"low_resolution" => array(
|
333 |
"width" => 320,
|
334 |
"height" => 320,
|
335 |
-
"url" => $media_data["
|
336 |
),
|
337 |
"standard_resolution" => array(
|
338 |
"width" => 640,
|
187 |
"thumbnail" => array(
|
188 |
"width" => 150,
|
189 |
"height" => 150,
|
190 |
+
"url" => (isset($media["media_url"]) ? $media["media_url"] : ""),
|
191 |
),
|
192 |
"low_resolution" => array(
|
193 |
"width" => 320,
|
194 |
"height" => 320,
|
195 |
+
"url" => (isset($media["media_url"]) ? $media["media_url"] : ""),
|
196 |
),
|
197 |
"standard_resolution" => array(
|
198 |
"width" => 1080,
|
199 |
"height" => 1080,
|
200 |
+
"url" => (isset($media["media_url"]) ? $media["media_url"] : ""),
|
201 |
),
|
202 |
),
|
203 |
"created_time" => (isset($media["timestamp"]) ? $media["timestamp"] : ""),
|
233 |
"standard_resolution" => array(
|
234 |
"width" => 640,
|
235 |
"height" => 800,
|
236 |
+
"url" => $media["thumbnail_url"],
|
237 |
),
|
238 |
"low_bandwidth" => array(
|
239 |
"width" => 480,
|
240 |
"height" => 600,
|
241 |
+
"url" => $media["thumbnail_url"],
|
242 |
),
|
243 |
"low_resolution" => array(
|
244 |
"width" => 480,
|
245 |
"height" => 600,
|
246 |
+
"url" => $media["thumbnail_url"],
|
247 |
),
|
248 |
);
|
249 |
}
|
327 |
"thumbnail" => array(
|
328 |
"width" => 150,
|
329 |
"height" => 150,
|
330 |
+
"url" => $media_data["media_url"],
|
331 |
),
|
332 |
"low_resolution" => array(
|
333 |
"width" => 320,
|
334 |
"height" => 320,
|
335 |
+
"url" => $media_data["media_url"],
|
336 |
),
|
337 |
"standard_resolution" => array(
|
338 |
"width" => 640,
|
framework/WDILibrary.php
CHANGED
@@ -5,22 +5,6 @@ class WDILibrary {
|
|
5 |
public function __construct() {
|
6 |
}
|
7 |
|
8 |
-
/* public static function get($key, $default_value = '') {
|
9 |
-
if (isset($_GET[$key])) {
|
10 |
-
$value = sanitize_text_field($_GET[$key]);
|
11 |
-
}
|
12 |
-
elseif (isset($_POST[$key])) {
|
13 |
-
$value = sanitize_text_field($_POST[$key]);
|
14 |
-
}
|
15 |
-
else {
|
16 |
-
$value = '';
|
17 |
-
}
|
18 |
-
if (!$value) {
|
19 |
-
$value = $default_value;
|
20 |
-
}
|
21 |
-
return $value;
|
22 |
-
}*/
|
23 |
-
|
24 |
/**
|
25 |
* Get request value.
|
26 |
*
|
5 |
public function __construct() {
|
6 |
}
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
/**
|
9 |
* Get request value.
|
10 |
*
|
framework/WDILibraryEmbed.php
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
* Class for handling embedded media in gallery
|
5 |
-
*
|
6 |
*/
|
7 |
|
8 |
class WDILibraryEmbed {
|
@@ -10,430 +8,34 @@ class WDILibraryEmbed {
|
|
10 |
public function __construct() {
|
11 |
}
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
if ( !$regex ) {
|
22 |
-
$matchmask = '#' . str_replace( '___wildcard___', '(.+)', preg_quote( str_replace( '*', '___wildcard___', $matchmask ), '#' ) ) . '#i';
|
23 |
-
$matchmask = preg_replace( '|^#http\\\://|', '#https?\://', $matchmask );
|
24 |
-
}
|
25 |
-
if ( preg_match( $matchmask, $url ) ) {
|
26 |
-
$provider = str_replace( '{format}', 'json', $providerurl ); // JSON is easier to deal with than XML
|
27 |
-
break;
|
28 |
-
}
|
29 |
-
}
|
30 |
-
if ( !$provider && $args['discover'] ) {
|
31 |
-
$provider = $oembed->discover($url);
|
32 |
-
}
|
33 |
-
return $provider;
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* check host and get data for a given url
|
38 |
-
* @return encode_json(associative array of data) on success
|
39 |
-
* @return encode_json(array[false, "error message"]) on failure
|
40 |
-
*
|
41 |
-
* EMBED TYPES
|
42 |
-
*
|
43 |
-
* EMBED_OEMBED_YOUTUBE_VIDEO
|
44 |
-
* EMBED_OEMBED_VIMEO_VIDEO
|
45 |
-
* EMBED_OEMBED_DAILYMOTION_VIDEO
|
46 |
-
* EMBED_OEMBED_INSTAGRAM_IMAGE
|
47 |
-
* EMBED_OEMBED_INSTAGRAM_VIDEO
|
48 |
-
* EMBED_OEMBED_INSTAGRAM_POST
|
49 |
-
* EMBED_OEMBED_FLICKR_IMAGE
|
50 |
-
*
|
51 |
-
* RULES FOR NEW TYPES
|
52 |
-
*
|
53 |
-
* 1. begin type name with EMBED_
|
54 |
-
* 2. if using WP native OEMBED class, add _OEMBED then
|
55 |
-
* 3. add provider name
|
56 |
-
* 4. add _VIDEO, _IMAGE FOR embedded media containing only video or image
|
57 |
-
* 5. add _DIRECT_URL from static URL of image (not implemented yet)
|
58 |
-
*
|
59 |
-
*/
|
60 |
-
|
61 |
-
public static function add_embed($url) {
|
62 |
-
|
63 |
-
$url = sanitize_text_field(urldecode($url));
|
64 |
-
|
65 |
-
|
66 |
-
$embed_type = '';
|
67 |
-
$host = '';
|
68 |
-
/*returns this array*/
|
69 |
-
$embedData = array(
|
70 |
-
'name' => '',
|
71 |
-
'description' => '',
|
72 |
-
'filename' => '',
|
73 |
-
'url' => '',
|
74 |
-
'reliative_url' => '',
|
75 |
-
'thumb_url' => '',
|
76 |
-
'thumb' => '',
|
77 |
-
'size' => '',
|
78 |
-
'filetype' => '',
|
79 |
-
'date_modified' => '',
|
80 |
-
'resolution' => '',
|
81 |
-
'redirect_url' => '');
|
82 |
-
|
83 |
-
$accepted_oembeds = array(
|
84 |
-
'YOUTUBE' => '/youtube/',
|
85 |
-
'VIMEO' => '/vimeo/',
|
86 |
-
'FLICKR' => '/flickr/',
|
87 |
-
'INSTAGRAM' => '/instagram/',
|
88 |
-
'DAILYMOTION' => '/dailymotion/'
|
89 |
-
);
|
90 |
-
|
91 |
-
/*check if we can embed this using wordpress class WP_oEmbed */
|
92 |
-
if ( !function_exists( '_wp_oembed_get_object' ) )
|
93 |
-
include( ABSPATH . WPINC . '/class-oembed.php' );
|
94 |
-
// get an oembed object
|
95 |
-
$oembed = _wp_oembed_get_object();
|
96 |
-
if (method_exists($oembed, 'get_provider')) {
|
97 |
-
// Since 4.0.0
|
98 |
-
$provider = $oembed->get_provider($url);
|
99 |
-
}
|
100 |
-
else {
|
101 |
-
$provider = self::get_provider($oembed, $url);
|
102 |
-
}
|
103 |
-
foreach ($accepted_oembeds as $oembed_provider => $regex) {
|
104 |
-
if(preg_match($regex, $provider)==1){
|
105 |
-
$host = $oembed_provider;
|
106 |
-
}
|
107 |
-
}
|
108 |
-
/*return json_encode($host); for test*/
|
109 |
-
|
110 |
-
/*handling oembed cases*/
|
111 |
-
if($host){
|
112 |
-
/*instagram is exception*/
|
113 |
-
/*standard oembed fetching does not return thumbnail_url! so we do it manually*/
|
114 |
-
if($host == 'INSTAGRAM' && substr($url,-4)!='post' && substr($url,-4!='POST')){
|
115 |
-
$embed_type = 'EMBED_OEMBED_INSTAGRAM';
|
116 |
-
|
117 |
-
$insta_host_and_id= strtok($url, '/')."/".strtok('/')."/".strtok('/')."/".strtok('/');
|
118 |
-
$insta_host= strtok($url, '/')."/".strtok('/')."/".strtok('/')."/";
|
119 |
-
$filename = str_replace($insta_host, "", $insta_host_and_id);
|
120 |
-
|
121 |
-
$get_embed_data = wp_remote_get("http://api.instagram.com/oembed?url=http://instagram.com/p/".$filename);
|
122 |
-
if ( is_wp_error( $get_embed_data ) ) {
|
123 |
-
return json_encode(array("error", "cannot get Instagram data"));
|
124 |
-
}
|
125 |
-
$result = json_decode(wp_remote_retrieve_body($get_embed_data));
|
126 |
-
if(empty($result)){
|
127 |
-
return json_encode(array("error", wp_remote_retrieve_body($get_embed_data)));
|
128 |
-
}
|
129 |
-
|
130 |
-
|
131 |
-
$embedData = array(
|
132 |
-
'name' => htmlspecialchars($result->title),
|
133 |
-
'description' => htmlspecialchars($result->title),
|
134 |
-
'filename' => $filename,
|
135 |
-
'url' => $url,
|
136 |
-
'reliative_url' => $url,
|
137 |
-
'thumb_url' => $result->thumbnail_url,
|
138 |
-
'thumb' => $result->thumbnail_url,
|
139 |
-
'size' => '',
|
140 |
-
'filetype' => $embed_type,
|
141 |
-
'date_modified' => date('d F Y, H:i'),
|
142 |
-
'resolution' => $result->thumbnail_width." x ".$result->thumbnail_height." px",
|
143 |
-
'redirect_url' => ''
|
144 |
-
);
|
145 |
-
|
146 |
-
/*get instagram post html page, parse its DOM to find video URL*/
|
147 |
-
$DOM = new DOMDocument;
|
148 |
-
libxml_use_internal_errors(true);
|
149 |
-
$html_code = wp_remote_get($url);
|
150 |
-
if ( is_wp_error( $html_code ) ) {
|
151 |
-
return json_encode(array("error", "cannot get Instagram data"));
|
152 |
-
}
|
153 |
-
$html_body = wp_remote_retrieve_body($html_code);
|
154 |
-
if(empty($html_body)){
|
155 |
-
return json_encode(array("error", wp_remote_retrieve_body($html_code)));
|
156 |
-
}
|
157 |
-
|
158 |
-
$DOM->loadHTML($html_body);
|
159 |
-
$finder = new DomXPath($DOM);
|
160 |
-
$query = "//meta[@property='og:video']";
|
161 |
-
$nodes = $finder->query($query);
|
162 |
-
$node = $nodes->item(0);
|
163 |
-
if($node){
|
164 |
-
$length = $node->attributes->length;
|
165 |
-
|
166 |
-
for ($i = 0; $i < $length; ++$i) {
|
167 |
-
$name = $node->attributes->item($i)->name;
|
168 |
-
$value = $node->attributes->item($i)->value;
|
169 |
-
|
170 |
-
if($name == 'content'){
|
171 |
-
$filename = $value;
|
172 |
-
}
|
173 |
-
}
|
174 |
-
$embedData['filename'] = $filename;
|
175 |
-
$embedData['filetype'] .= '_VIDEO';
|
176 |
-
}
|
177 |
-
else{
|
178 |
-
$embedData['filetype'] .= '_IMAGE';
|
179 |
-
}
|
180 |
-
|
181 |
-
return json_encode($embedData);
|
182 |
-
}
|
183 |
-
if($host == 'INSTAGRAM' && (substr($url,-4)=='post'||substr($url,-4)=='POST')){
|
184 |
-
/*check if instagram post*/
|
185 |
-
$url = substr($url,0,-4);
|
186 |
-
$embed_type = 'EMBED_OEMBED_INSTAGRAM_POST';
|
187 |
-
parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars );
|
188 |
-
$matches = array();
|
189 |
-
$filename = '';
|
190 |
-
$regex = "/^.*?instagram\.com\/p\/(.*?)[\/]?$/";
|
191 |
-
if(preg_match($regex, $url, $matches)){
|
192 |
-
$filename = $matches[1];
|
193 |
-
}
|
194 |
-
$get_embed_data = wp_remote_get("http://api.instagram.com/oembed?url=http://instagram.com/p/".$filename);
|
195 |
-
if ( is_wp_error( $get_embed_data ) ) {
|
196 |
-
return json_encode(array("error", "cannot get Instagram data"));
|
197 |
-
}
|
198 |
-
$result = json_decode(wp_remote_retrieve_body($get_embed_data));
|
199 |
-
if(empty($result)){
|
200 |
-
return json_encode(array("error", wp_remote_retrieve_body($get_embed_data)));
|
201 |
-
}
|
202 |
-
|
203 |
-
$embedData = array(
|
204 |
-
'name' => htmlspecialchars($result->title),
|
205 |
-
'description' => htmlspecialchars($result->title),
|
206 |
-
'filename' => $filename,
|
207 |
-
'url' => $url,
|
208 |
-
'reliative_url' => $url,
|
209 |
-
'thumb_url' => $result->thumbnail_url,
|
210 |
-
'thumb' => $result->thumbnail_url,
|
211 |
-
'size' => '',
|
212 |
-
'filetype' => $embed_type,
|
213 |
-
'date_modified' => date('d F Y, H:i'),
|
214 |
-
'resolution' => $result->width." x ".$result->width." px",
|
215 |
-
'redirect_url' => '');
|
216 |
-
|
217 |
-
return json_encode($embedData);
|
218 |
-
}
|
219 |
-
|
220 |
-
$result = $oembed->fetch( $provider, $url);
|
221 |
-
/*no data fetched for a known provider*/
|
222 |
-
if(!$result){
|
223 |
-
return json_encode(array("error", "please enter ". $host . " correct single media URL"));
|
224 |
-
}
|
225 |
-
else{/*one of known oembed types*/
|
226 |
-
$embed_type = 'EMBED_OEMBED_'.$host;
|
227 |
-
switch ($embed_type) {
|
228 |
-
case 'EMBED_OEMBED_YOUTUBE':
|
229 |
-
$youtube_regex = "#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+|(?<=v=)[^&\n]+|(?<=youtu.be/)[^&\n]+#";
|
230 |
-
$matches = array();
|
231 |
-
preg_match($youtube_regex , $url , $matches);
|
232 |
-
$filename = $matches[0];
|
233 |
-
|
234 |
-
$embedData = array(
|
235 |
-
'name' => htmlspecialchars($result->title),
|
236 |
-
'description' => htmlspecialchars($result->title),
|
237 |
-
'filename' => $filename,
|
238 |
-
'url' => $url,
|
239 |
-
'reliative_url' => $url,
|
240 |
-
'thumb_url' => $result->thumbnail_url,
|
241 |
-
'thumb' => $result->thumbnail_url,
|
242 |
-
'size' => '',
|
243 |
-
'filetype' => $embed_type."_VIDEO",
|
244 |
-
'date_modified' => date('d F Y, H:i'),
|
245 |
-
'resolution' => $result->width." x ".$result->height." px",
|
246 |
-
'redirect_url' => '');
|
247 |
-
|
248 |
-
return json_encode($embedData);
|
249 |
-
|
250 |
-
break;
|
251 |
-
case 'EMBED_OEMBED_VIMEO':
|
252 |
-
|
253 |
-
$embedData = array(
|
254 |
-
'name' => htmlspecialchars($result->title),
|
255 |
-
'description' => htmlspecialchars($result->title),
|
256 |
-
'filename' => $result->video_id,
|
257 |
-
'url' => $url,
|
258 |
-
'reliative_url' => $url,
|
259 |
-
'thumb_url' => $result->thumbnail_url,
|
260 |
-
'thumb' => $result->thumbnail_url,
|
261 |
-
'size' => '',
|
262 |
-
'filetype' => $embed_type."_VIDEO",
|
263 |
-
'date_modified' => date('d F Y, H:i'),
|
264 |
-
'resolution' => $result->width." x ".$result->height." px",
|
265 |
-
'redirect_url' => '');
|
266 |
-
|
267 |
-
return json_encode($embedData);
|
268 |
-
|
269 |
-
break;
|
270 |
-
case 'EMBED_OEMBED_FLICKR':
|
271 |
-
$matches = preg_match('~^.+/(\d+)~',$url,$matches);
|
272 |
-
$filename = $matches[1];
|
273 |
-
/*if($result->type =='photo')
|
274 |
-
$embed_type .= '_IMAGE';
|
275 |
-
if($result->type =='video')
|
276 |
-
$embed_type .= '_VIDEO';*/
|
277 |
-
/*flickr video type not implemented yet*/
|
278 |
-
$embed_type .= '_IMAGE';
|
279 |
-
|
280 |
-
$embedData = array(
|
281 |
-
'name' => htmlspecialchars($result->title),
|
282 |
-
'description' => htmlspecialchars($result->title),
|
283 |
-
'filename' =>substr($result->thumbnail_url, 0, -5)."b.jpg",
|
284 |
-
'url' => $url,
|
285 |
-
'reliative_url' => $url,
|
286 |
-
'thumb_url' => $result->thumbnail_url,
|
287 |
-
'thumb' => $result->thumbnail_url,
|
288 |
-
'size' => '',
|
289 |
-
'filetype' => $embed_type,
|
290 |
-
'date_modified' => date('d F Y, H:i'),
|
291 |
-
'resolution' => $result->width." x ".$result->height." px",
|
292 |
-
'redirect_url' => '');
|
293 |
-
|
294 |
-
return json_encode($embedData);
|
295 |
-
break;
|
296 |
-
|
297 |
-
case 'EMBED_OEMBED_DAILYMOTION':
|
298 |
-
$filename = strtok(basename($url), '_');
|
299 |
-
|
300 |
-
$embedData = array(
|
301 |
-
'name' => htmlspecialchars($result->title),
|
302 |
-
'description' => htmlspecialchars($result->title),
|
303 |
-
'filename' => $filename,
|
304 |
-
'url' => $url,
|
305 |
-
'reliative_url' => $url,
|
306 |
-
'thumb_url' => $result->thumbnail_url,
|
307 |
-
'thumb' => $result->thumbnail_url,
|
308 |
-
'size' => '',
|
309 |
-
'filetype' => $embed_type."_VIDEO",
|
310 |
-
'date_modified' => date('d F Y, H:i'),
|
311 |
-
'resolution' => $result->width." x ".$result->height." px",
|
312 |
-
'redirect_url' => '');
|
313 |
-
|
314 |
-
return json_encode($embedData);
|
315 |
-
|
316 |
-
break;
|
317 |
-
case 'EMBED_OEMBED_GETTYIMAGES':
|
318 |
-
/*not working yet*/
|
319 |
-
$filename = strtok(basename($url), '_');
|
320 |
-
|
321 |
-
$embedData = array(
|
322 |
-
'name' => htmlspecialchars($result->title),
|
323 |
-
'description' => htmlspecialchars($result->title),
|
324 |
-
'filename' => $filename,
|
325 |
-
'url' => $url,
|
326 |
-
'reliative_url' => $url,
|
327 |
-
'thumb_url' => $result->thumbnail_url,
|
328 |
-
'thumb' => $result->thumbnail_url,
|
329 |
-
'size' => '',
|
330 |
-
'filetype' => $embed_type,
|
331 |
-
'date_modified' => date('d F Y, H:i'),
|
332 |
-
'resolution' => $result->width." x ".$result->height." px",
|
333 |
-
'redirect_url' => '');
|
334 |
-
|
335 |
-
return json_encode($embedData);
|
336 |
-
|
337 |
-
default:
|
338 |
-
return json_encode(array("error", "unknown URL host"));
|
339 |
-
break;
|
340 |
-
}
|
341 |
-
}
|
342 |
-
}/*end of oembed cases*/
|
343 |
-
else {
|
344 |
-
/*check for direct image url*/
|
345 |
-
/*check if something else*/
|
346 |
-
/*not implemented yet*/
|
347 |
-
return json_encode(array("error", "unknown URL"));
|
348 |
-
}
|
349 |
-
return json_encode(array("error", "unknown URL"));
|
350 |
-
}
|
351 |
-
|
352 |
-
|
353 |
-
/**
|
354 |
-
* client side analogue is function wdi_spider_display_embed in wdi_embed.js
|
355 |
-
*
|
356 |
-
* @param embed_type: string , one of predefined accepted types
|
357 |
-
* @param embed_id: string, id of media in corresponding host, or url if no unique id system is defined for host
|
358 |
-
* @param attrs: associative array with html attributes and values format e.g. array('width'=>"100px", 'style'=>"display:inline;")
|
359 |
-
*
|
360 |
-
*/
|
361 |
|
362 |
-
public static function display_embed($embed_type, $embed_id='', $attrs = array(), $carousel_media = null) {
|
363 |
$html_to_insert = '';
|
364 |
-
switch ($embed_type) {
|
365 |
-
case 'EMBED_OEMBED_YOUTUBE_VIDEO':
|
366 |
-
$oembed_youtube_html ='<iframe ';
|
367 |
-
if($embed_id!=''){
|
368 |
-
$oembed_youtube_html .= ' src="' . '//www.youtube.com/embed/'. $embed_id . '?enablejsapi=1&wmode=transparent"';
|
369 |
-
}
|
370 |
-
foreach ($attrs as $attr => $value) {
|
371 |
-
if(preg_match('/src/i', $attr)===0){
|
372 |
-
if($attr != '' && $value != ''){
|
373 |
-
$oembed_youtube_html .= ' '. $attr . '="'. $value . '"';
|
374 |
-
}
|
375 |
-
}
|
376 |
-
}
|
377 |
-
$oembed_youtube_html .= " ></iframe>";
|
378 |
-
$html_to_insert .= $oembed_youtube_html;
|
379 |
-
break;
|
380 |
-
case 'EMBED_OEMBED_VIMEO_VIDEO':
|
381 |
-
$oembed_vimeo_html ='<iframe ';
|
382 |
-
if($embed_id!=''){
|
383 |
-
$oembed_vimeo_html .= ' src="' . '//player.vimeo.com/video/'. $embed_id . '?enablejsapi=1"';
|
384 |
-
}
|
385 |
-
foreach ($attrs as $attr => $value) {
|
386 |
-
if(preg_match('/src/i', $attr)===0){
|
387 |
-
if($attr != '' && $value != ''){
|
388 |
-
$oembed_vimeo_html .= ' '. $attr . '="'. $value . '"';
|
389 |
-
}
|
390 |
-
}
|
391 |
-
}
|
392 |
-
$oembed_vimeo_html .= " ></iframe>";
|
393 |
-
$html_to_insert .= $oembed_vimeo_html;
|
394 |
-
break;
|
395 |
-
case 'EMBED_OEMBED_FLICKR_IMAGE':
|
396 |
-
$oembed_flickr_html ='<div ';
|
397 |
-
foreach ($attrs as $attr => $value) {
|
398 |
-
if(preg_match('/src/i', $attr)===0){
|
399 |
-
if($attr != '' && $value != ''){
|
400 |
-
$oembed_flickr_html .= ' '. $attr . '="'. $value . '"';
|
401 |
-
}
|
402 |
-
}
|
403 |
-
}
|
404 |
-
$oembed_flickr_html .= " >";
|
405 |
-
if($embed_id!=''){
|
406 |
-
$oembed_flickr_html .= '<img src="'.$embed_id.'"'.
|
407 |
-
' style="'.
|
408 |
-
'max-width:'.'100%'." !important".
|
409 |
-
'; max-height:'.'100%'." !important".
|
410 |
-
'; width:'.'auto !important'.
|
411 |
-
'; height:'. 'auto !important' .
|
412 |
-
';">';
|
413 |
-
}
|
414 |
-
$oembed_flickr_html .="</div>";
|
415 |
-
|
416 |
-
$html_to_insert .= $oembed_flickr_html;
|
417 |
-
break;
|
418 |
-
case 'EMBED_OEMBED_FLICKR_VIDEO':
|
419 |
-
# code...not implemented yet
|
420 |
-
break;
|
421 |
case 'EMBED_OEMBED_INSTAGRAM_VIDEO':
|
422 |
-
$oembed_instagram_html ='<div ';
|
423 |
-
foreach ($attrs as $attr => $value) {
|
424 |
-
if(preg_match('/src/i', $attr)===0){
|
425 |
-
if($attr != '' && $value != ''){
|
426 |
-
$oembed_instagram_html .= ' '. $attr . '="'. $value . '"';
|
427 |
}
|
428 |
}
|
429 |
}
|
430 |
$oembed_instagram_html .= " >";
|
431 |
-
if($
|
432 |
$oembed_instagram_html .= '<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls>'.
|
433 |
-
'<source src="'. $
|
434 |
-
'" type="video/mp4"> Your browser does not support the video tag. </video>';
|
|
|
435 |
}
|
436 |
-
$oembed_instagram_html .="</div>";
|
437 |
$html_to_insert .= $oembed_instagram_html;
|
438 |
break;
|
439 |
case 'EMBED_OEMBED_INSTAGRAM_IMAGE':
|
@@ -457,455 +59,17 @@ class WDILibraryEmbed {
|
|
457 |
}
|
458 |
}
|
459 |
else {
|
460 |
-
if ( $
|
461 |
-
$oembed_instagram_html .= '<img src="
|
462 |
}
|
463 |
}
|
464 |
$oembed_instagram_html .= "</div>";
|
465 |
$html_to_insert .= $oembed_instagram_html;
|
466 |
break;
|
467 |
-
case 'EMBED_OEMBED_INSTAGRAM_POST':
|
468 |
-
$oembed_instagram_html ='<div ';
|
469 |
-
$id = '';
|
470 |
-
foreach ($attrs as $attr => $value) {
|
471 |
-
if(preg_match('/src/i', $attr)===0){
|
472 |
-
if($attr != '' && $value != ''){
|
473 |
-
$oembed_instagram_html .= ' '. $attr . '="'. $value . '"';
|
474 |
-
if($attr == 'class' || $attr =='CLASS' || $attr =='Class'){
|
475 |
-
$class = $value;
|
476 |
-
}
|
477 |
-
}
|
478 |
-
}
|
479 |
-
}
|
480 |
-
$oembed_instagram_html .= " >";
|
481 |
-
if($embed_id!=''){
|
482 |
-
$oembed_instagram_html .= '<iframe class="inner_instagram_iframe_'.$class.'" src="//instagr.am/p/'.$embed_id.'/embed/?enablejsapi=1"'.
|
483 |
-
' style="'.
|
484 |
-
'max-width:'.'100%'." !important".
|
485 |
-
'; max-height:'.'100%'." !important".
|
486 |
-
'; width:'.'100%'.
|
487 |
-
'; height:'. '100%' .
|
488 |
-
'; margin:0'.
|
489 |
-
'; display:table-cell; vertical-align:middle;"'.
|
490 |
-
'frameborder="0" scrolling="no" allowtransparency="false" allowfullscreen'.
|
491 |
-
'></iframe>';
|
492 |
-
}
|
493 |
-
$oembed_instagram_html .="</div>";
|
494 |
-
$html_to_insert .= $oembed_instagram_html;
|
495 |
-
break;
|
496 |
-
case 'EMBED_OEMBED_DAILYMOTION_VIDEO':
|
497 |
-
$oembed_dailymotion_html ='<iframe ';
|
498 |
-
if($embed_id!=''){
|
499 |
-
$oembed_dailymotion_html .= ' src="' . '//www.dailymotion.com/embed/video/'. $embed_id . '?api=postMessage"';
|
500 |
-
}
|
501 |
-
foreach ($attrs as $attr => $value) {
|
502 |
-
if(preg_match('/src/i', $attr)===0){
|
503 |
-
if($attr != '' && $value != ''){
|
504 |
-
$oembed_dailymotion_html .= ' '. $attr . '="'. $value . '"';
|
505 |
-
}
|
506 |
-
}
|
507 |
-
}
|
508 |
-
$oembed_dailymotion_html .= " ></iframe>";
|
509 |
-
$html_to_insert .= $oembed_dailymotion_html;
|
510 |
-
break;
|
511 |
default:
|
512 |
-
|
513 |
break;
|
514 |
}
|
515 |
-
|
516 |
echo $html_to_insert;
|
517 |
-
|
518 |
-
}
|
519 |
-
|
520 |
-
|
521 |
-
/**
|
522 |
-
*
|
523 |
-
* @return json_encode(array("error","error message")) on failure
|
524 |
-
* @return json_encode(array of data of instagram user recent posts) on success
|
525 |
-
*/
|
526 |
-
public static function add_instagram_gallery($instagram_user, $client_id, $whole_post, $autogallery_image_number) {
|
527 |
-
$instagram_user = sanitize_text_field(urldecode($instagram_user));
|
528 |
-
$instagram_user_response = wp_remote_get("https://api.instagram.com/v1/users/search?q=".$instagram_user."&client_id=".$client_id."&count=1");
|
529 |
-
if ( is_wp_error( $instagram_user_response ) ) {
|
530 |
-
return json_encode(array("error", "cannot get Instagram user parameters"));
|
531 |
-
}
|
532 |
-
$user_json = wp_remote_retrieve_body($instagram_user_response);
|
533 |
-
$response_code = json_decode($user_json)->meta->code;
|
534 |
-
|
535 |
-
/*
|
536 |
-
instagram API returns
|
537 |
-
|
538 |
-
*wrong username
|
539 |
-
{"meta":{"code":200},"data":[]}
|
540 |
-
|
541 |
-
*wrong client_id
|
542 |
-
{"meta":{"error_type":"OAuthParameterException","code":400,"error_message":"The client_id provided is invalid and does not match a valid application."}}
|
543 |
-
|
544 |
-
*/
|
545 |
-
|
546 |
-
if($response_code != 200){
|
547 |
-
return json_encode(array("error", json_decode($user_json)->meta->error_message));
|
548 |
-
}
|
549 |
-
|
550 |
-
|
551 |
-
if(!property_exists(json_decode($user_json), 'data')){
|
552 |
-
return json_encode(array("error", "cannot get Instagram user parameters"));
|
553 |
-
}
|
554 |
-
if(empty(json_decode($user_json)->data)){
|
555 |
-
return json_encode(array("error", "wrong Instagram username"));
|
556 |
-
}
|
557 |
-
$user_data = json_decode($user_json)->data[0];
|
558 |
-
$user_id = $user_data->id;
|
559 |
-
|
560 |
-
|
561 |
-
$instagram_posts_response = wp_remote_get("https://api.instagram.com/v1/users/".$user_id."/media/recent/?client_id=".$client_id."&count=".$autogallery_image_number);
|
562 |
-
if ( is_wp_error( $instagram_posts_response ) ) {
|
563 |
-
return json_encode(array("error", "cannot get Instagram user posts"));
|
564 |
-
}
|
565 |
-
$posts_json = wp_remote_retrieve_body($instagram_posts_response);
|
566 |
-
$response_code = json_decode($posts_json)->meta->code;
|
567 |
-
|
568 |
-
/*
|
569 |
-
instagram API returns
|
570 |
-
|
571 |
-
*private user
|
572 |
-
'{"meta":{"error_type":"APINotAllowedError","code":400,"error_message":"you cannot view this resource"}}'
|
573 |
-
|
574 |
-
*/
|
575 |
-
|
576 |
-
if($response_code != 200){
|
577 |
-
return json_encode(array("error", json_decode($posts_json)->meta->error_message));
|
578 |
-
}
|
579 |
-
if(!property_exists(json_decode($posts_json), 'data')){
|
580 |
-
return json_encode(array("error", "cannot get Instagram user posts data"));
|
581 |
-
}
|
582 |
-
/*
|
583 |
-
if instagram user has no posts
|
584 |
-
*/
|
585 |
-
if(empty(json_decode($posts_json)->data)){
|
586 |
-
return json_encode(array("error", "Instagram user has no posts"));
|
587 |
-
}
|
588 |
-
|
589 |
-
|
590 |
-
$posts_array = json_decode($posts_json)->data;
|
591 |
-
$instagram_album_data = array();
|
592 |
-
if($whole_post==1){
|
593 |
-
$post_flag ="post";
|
594 |
-
}
|
595 |
-
else{
|
596 |
-
$post_flag ='';
|
597 |
-
}
|
598 |
-
foreach ($posts_array as $post_data) {
|
599 |
-
$url = $post_data ->link . $post_flag;
|
600 |
-
|
601 |
-
$post_to_embed = json_decode(self::add_embed($url), true);
|
602 |
-
|
603 |
-
/* if add_embed function did not indexed array because of error */
|
604 |
-
if(!isset($post_to_embed[0]) ){
|
605 |
-
array_push($instagram_album_data, $post_to_embed);
|
606 |
-
}
|
607 |
-
|
608 |
-
}
|
609 |
-
|
610 |
-
return json_encode($instagram_album_data);
|
611 |
-
|
612 |
-
}
|
613 |
-
|
614 |
-
/**
|
615 |
-
*
|
616 |
-
* @return array of galleries,
|
617 |
-
* @return array(false, "error message");
|
618 |
-
*
|
619 |
-
*/
|
620 |
-
|
621 |
-
public static function check_instagram_galleries(){
|
622 |
-
|
623 |
-
global $wpdb;
|
624 |
-
$instagram_galleries = $wpdb->get_results( "SELECT id, gallery_type, gallery_source, update_flag, autogallery_image_number FROM " . $wpdb->prefix . "wdi_gallery WHERE gallery_type='instagram' OR gallery_type='instagram_post'", OBJECT );
|
625 |
-
|
626 |
-
$galleries_to_update = array();
|
627 |
-
if($instagram_galleries){
|
628 |
-
foreach ($instagram_galleries as $gallery) {
|
629 |
-
if($gallery->update_flag == 'add' || $gallery->update_flag == 'replace'){
|
630 |
-
array_push($galleries_to_update, $gallery);
|
631 |
-
}
|
632 |
-
}
|
633 |
-
if(!empty($galleries_to_update)){
|
634 |
-
return $galleries_to_update;
|
635 |
-
}
|
636 |
-
else{
|
637 |
-
return array(false, "No instagram gallery has to be updated");
|
638 |
-
}
|
639 |
-
}
|
640 |
-
else{
|
641 |
-
return array(false,"There is no instagram gallery");
|
642 |
-
}
|
643 |
-
}
|
644 |
-
|
645 |
-
/**
|
646 |
-
*
|
647 |
-
* @return array(true, "refresh time");
|
648 |
-
* @return array(false, "error message");
|
649 |
-
*
|
650 |
-
*/
|
651 |
-
|
652 |
-
public static function refresh_instagram_gallery($gallery){
|
653 |
-
global $wpdb;
|
654 |
-
$id = $gallery->id;
|
655 |
-
$type = $gallery->gallery_type;
|
656 |
-
$update_flag = $gallery->update_flag;
|
657 |
-
$autogallery_image_number = $gallery->autogallery_image_number;
|
658 |
-
|
659 |
-
if($type=='instagram'){
|
660 |
-
$whole_post = 0;
|
661 |
-
}
|
662 |
-
if($type=='instagram_post'){
|
663 |
-
$whole_post = 1;
|
664 |
-
}
|
665 |
-
$source =$gallery->gallery_source;
|
666 |
-
if(!$id || !$type || !$source){
|
667 |
-
return array(false, "Gallery id, type or source are empty");
|
668 |
-
}
|
669 |
-
|
670 |
-
$get_client_id = $wpdb->get_results( "SELECT instagram_client_id FROM " . $wpdb->prefix . "wdi_option", OBJECT );
|
671 |
-
if(!$get_client_id){
|
672 |
-
return array(false, "Cannot get CLIENT_ID from the database");
|
673 |
-
}
|
674 |
-
$client_id = $get_client_id[0]->instagram_client_id;
|
675 |
-
|
676 |
-
$images = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "wdi_image WHERE gallery_id='" . $id . "' ", OBJECT);
|
677 |
-
$images_count = sizeof($images);
|
678 |
-
$new_images_data = self::add_instagram_gallery($source, $client_id, $whole_post, $autogallery_image_number);
|
679 |
-
if(!$new_images_data){
|
680 |
-
return array(false, "Cannot get instagram data");
|
681 |
-
}
|
682 |
-
$images_new = json_decode($new_images_data);
|
683 |
-
if(empty($images_new)){
|
684 |
-
return array(false, "Cannot get instagram data");
|
685 |
-
}
|
686 |
-
if($images_new[0] == "error"){
|
687 |
-
return array(false, "Cannot get instagram data");
|
688 |
-
}
|
689 |
-
|
690 |
-
$images_count_new = sizeof($images_new);
|
691 |
-
|
692 |
-
$images_update = array(); /*ids and orders of images existing in both arrays*/
|
693 |
-
$images_insert = array(); /*data of new images*/
|
694 |
-
$images_dated = array(); /*ids and orders of images not existing in the array of new images*/
|
695 |
-
$new_order = 0; /*how many images should be added*/
|
696 |
-
if($images_count!=0){
|
697 |
-
$author = $images[0]->author; /* author is the same for the images in the gallery */
|
698 |
-
}
|
699 |
-
else{
|
700 |
-
$author = 1;
|
701 |
-
}
|
702 |
-
|
703 |
-
/*loops to compare new and existing images*/
|
704 |
-
foreach ($images_new as $image_new) {
|
705 |
-
$to_add = true;
|
706 |
-
if($images_count != 0){
|
707 |
-
foreach($images as $image){
|
708 |
-
if($image_new->filename == $image->filename){
|
709 |
-
/*if that image exist, do not update*/
|
710 |
-
$to_add = false;
|
711 |
-
}
|
712 |
-
}
|
713 |
-
}
|
714 |
-
if($to_add){
|
715 |
-
/*if image does not exist, insert*/
|
716 |
-
$new_order++;
|
717 |
-
$new_image_data = array(
|
718 |
-
'gallery_id' => $id,
|
719 |
-
'slug' => sanitize_title($image_new->name),
|
720 |
-
'filename' => $image_new->filename,
|
721 |
-
'image_url' => $image_new->url,
|
722 |
-
'thumb_url' => $image_new->thumb_url,
|
723 |
-
'description' => $image_new->description,
|
724 |
-
'alt' => $image_new->name,
|
725 |
-
'date' => $image_new->date_modified,
|
726 |
-
'size' => $image_new->size,
|
727 |
-
'filetype' => $image_new->filetype,
|
728 |
-
'resolution' => $image_new->resolution,
|
729 |
-
'author' => $author,
|
730 |
-
'order' => $new_order,
|
731 |
-
'published' => 1,
|
732 |
-
'comment_count' => 0,
|
733 |
-
'avg_rating' => 0,
|
734 |
-
'rate_count' => 0,
|
735 |
-
'hit_count' => 0,
|
736 |
-
'redirect_url' => $image_new->redirect_url,
|
737 |
-
);
|
738 |
-
array_push($images_insert, $new_image_data);
|
739 |
-
}
|
740 |
-
}
|
741 |
-
|
742 |
-
|
743 |
-
if($images_count != 0){
|
744 |
-
foreach ($images as $image) {
|
745 |
-
$is_dated = true;
|
746 |
-
foreach($images_new as $image_new){
|
747 |
-
if($image_new->filename == $image->filename){
|
748 |
-
/* if that image exist, do not update */
|
749 |
-
/* shift order by a number of new images */
|
750 |
-
$image_update = array(
|
751 |
-
'id' => $image->id ,
|
752 |
-
'order'=> intval($image->order) + $new_order,
|
753 |
-
"slug" => sanitize_title($image_new->name),
|
754 |
-
"description" => $image_new->description,
|
755 |
-
"alt" => $image_new->name,
|
756 |
-
"date" => $image_new->date_modified);
|
757 |
-
array_push($images_update, $image_update);
|
758 |
-
$is_dated = false;
|
759 |
-
}
|
760 |
-
}
|
761 |
-
if($is_dated){
|
762 |
-
$image_dated = array(
|
763 |
-
'id' => $image->id ,
|
764 |
-
'order'=> intval($image->order) + $new_order,
|
765 |
-
);
|
766 |
-
array_push($images_dated, $image_dated);
|
767 |
-
}
|
768 |
-
}
|
769 |
-
}
|
770 |
-
/*endof comparing loops*/
|
771 |
-
|
772 |
-
$to_unpublish = true;
|
773 |
-
if($update_flag == 'add'){
|
774 |
-
$to_unpublish = false;
|
775 |
-
}
|
776 |
-
if($update_flag == 'replace'){
|
777 |
-
$to_unpublish = true;
|
778 |
-
}
|
779 |
-
|
780 |
-
|
781 |
-
/*update old images*/
|
782 |
-
if($images_count != 0){
|
783 |
-
if($to_unpublish){
|
784 |
-
foreach ($images_dated as $image) {
|
785 |
-
$q = 'UPDATE ' . $wpdb->prefix . 'wdi_image SET published=0, `order` ='.$image['order'].' WHERE `id`='.$image['id'];
|
786 |
-
$wpdb->query($q);
|
787 |
-
}
|
788 |
-
}
|
789 |
-
else{
|
790 |
-
foreach ($images_dated as $image) {
|
791 |
-
$q = 'UPDATE ' . $wpdb->prefix . 'wdi_image SET `order` ='.$image['order'].' WHERE `id`='.$image['id'];
|
792 |
-
$wpdb->query($q);
|
793 |
-
}
|
794 |
-
}
|
795 |
-
|
796 |
-
foreach ($images_update as $image) {
|
797 |
-
$save = $wpdb->update($wpdb->prefix . 'wdi_image', array(
|
798 |
-
'order' => $image['order'],
|
799 |
-
'slug' => $image['slug'],
|
800 |
-
'description' => $image['description'],
|
801 |
-
'alt' => $image['alt'],
|
802 |
-
'date' => $image['date']
|
803 |
-
), array('id' => $image['id']));
|
804 |
-
}
|
805 |
-
}
|
806 |
-
/*add new images*/
|
807 |
-
foreach($images_insert as $image){
|
808 |
-
$save = $wpdb->insert($wpdb->prefix . 'wdi_image', array(
|
809 |
-
'gallery_id' => $image['gallery_id'],
|
810 |
-
'slug' => $image['slug'],
|
811 |
-
'filename' => $image['filename'],
|
812 |
-
'image_url' => $image['image_url'],
|
813 |
-
'thumb_url' => $image['thumb_url'],
|
814 |
-
'description' => $image['description'],
|
815 |
-
'alt' => $image['alt'],
|
816 |
-
'date' => $image['date'],
|
817 |
-
'size' => $image['size'],
|
818 |
-
'filetype' => $image['filetype'],
|
819 |
-
'resolution' => $image['resolution'],
|
820 |
-
'author' => $image['author'],
|
821 |
-
'order' => $image['order'],
|
822 |
-
'published' => $image['published'],
|
823 |
-
'comment_count' => $image['comment_count'],
|
824 |
-
'avg_rating' => $image['avg_rating'],
|
825 |
-
'rate_count' => $image['rate_count'],
|
826 |
-
'hit_count' => $image['hit_count'],
|
827 |
-
'redirect_url' => $image['redirect_url'],
|
828 |
-
), array(
|
829 |
-
'%d',
|
830 |
-
'%s',
|
831 |
-
'%s',
|
832 |
-
'%s',
|
833 |
-
'%s',
|
834 |
-
'%s',
|
835 |
-
'%s',
|
836 |
-
'%s',
|
837 |
-
'%s',
|
838 |
-
'%s',
|
839 |
-
'%s',
|
840 |
-
'%d',
|
841 |
-
'%d',
|
842 |
-
'%d',
|
843 |
-
'%d',
|
844 |
-
'%d',
|
845 |
-
'%d',
|
846 |
-
'%d',
|
847 |
-
'%s',
|
848 |
-
));
|
849 |
-
}
|
850 |
-
$time = date('d F Y, H:i');
|
851 |
-
|
852 |
-
/*return time of last update*/
|
853 |
-
return array(true, $time);
|
854 |
-
|
855 |
-
}
|
856 |
-
|
857 |
-
public static function get_autoupdate_interval(){
|
858 |
-
global $wpdb;
|
859 |
-
|
860 |
-
$row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wdi_option WHERE id="%d"', 1));
|
861 |
-
if(!isset($row)){
|
862 |
-
return 30;
|
863 |
-
}
|
864 |
-
if(!isset($row->autoupdate_interval)){
|
865 |
-
return 30;
|
866 |
-
}
|
867 |
-
$autoupdate_interval = $row->autoupdate_interval;
|
868 |
-
return $autoupdate_interval;
|
869 |
-
}
|
870 |
-
|
871 |
-
/**
|
872 |
-
* @return user id by username
|
873 |
-
* @return flase on failure
|
874 |
-
*/
|
875 |
-
public static function get_instagram_id_by_username($instagram_user) {
|
876 |
-
|
877 |
-
$instagram_user_response = wp_remote_get('https://api.instagram.com/v1/users/search?q=' . $instagram_user . '&access_token=2276055961.145c5c2.c37b17e530f245a29716f748137c84a9');
|
878 |
-
if ( is_wp_error( $instagram_user_response ) ) {
|
879 |
-
return false;
|
880 |
-
}
|
881 |
-
$user_json = wp_remote_retrieve_body($instagram_user_response);
|
882 |
-
$response_code = json_decode($user_json)->meta->code;
|
883 |
-
|
884 |
-
/*
|
885 |
-
instagram API returns
|
886 |
-
|
887 |
-
*wrong username
|
888 |
-
{"meta":{"code":200},"data":[]}
|
889 |
-
|
890 |
-
*wrong client_id
|
891 |
-
{"meta":{"error_type":"OAuthParameterException","code":400,"error_message":"The client_id provided is invalid and does not match a valid application."}}
|
892 |
-
|
893 |
-
*/
|
894 |
-
|
895 |
-
if($response_code != 200){
|
896 |
-
return false;
|
897 |
-
}
|
898 |
-
|
899 |
-
|
900 |
-
if(!property_exists(json_decode($user_json), 'data')){
|
901 |
-
return false;
|
902 |
-
}
|
903 |
-
if(empty(json_decode($user_json)->data)){
|
904 |
-
return false;
|
905 |
-
}
|
906 |
-
$user_data = json_decode($user_json)->data[0];
|
907 |
-
$user_id = $user_data->id;
|
908 |
-
|
909 |
-
return $user_id;
|
910 |
}
|
911 |
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Class for handling embedded media in gallery
|
|
|
4 |
*/
|
5 |
|
6 |
class WDILibraryEmbed {
|
8 |
public function __construct() {
|
9 |
}
|
10 |
|
11 |
+
/**
|
12 |
+
* client side analogue is function wdi_spider_display_embed in wdi_embed.js
|
13 |
+
*
|
14 |
+
* @param embed_type: string , one of predefined accepted types
|
15 |
+
* @param embed_id: string, id of media in corresponding host, or url if no unique id system is defined for host
|
16 |
+
* @param attrs: associative array with html attributes and values format e.g. array('width'=>"100px", 'style'=>"display:inline;")
|
17 |
+
*/
|
18 |
+
public static function display_embed( $embed_type, $embed_id = '', $attrs = array(), $carousel_media = NULL, $url = '' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
|
|
20 |
$html_to_insert = '';
|
21 |
+
switch ( $embed_type ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
case 'EMBED_OEMBED_INSTAGRAM_VIDEO':
|
23 |
+
$oembed_instagram_html = '<div ';
|
24 |
+
foreach ( $attrs as $attr => $value ) {
|
25 |
+
if ( preg_match('/src/i', $attr) === 0 ) {
|
26 |
+
if ( $attr != '' && $value != '' ) {
|
27 |
+
$oembed_instagram_html .= ' ' . $attr . '="' . $value . '"';
|
28 |
}
|
29 |
}
|
30 |
}
|
31 |
$oembed_instagram_html .= " >";
|
32 |
+
if( $url != '' ) {
|
33 |
$oembed_instagram_html .= '<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls>'.
|
34 |
+
'<source src="'. $url .
|
35 |
+
'" type="video/mp4"> Your browser does not support the video tag. </video>';
|
36 |
+
|
37 |
}
|
38 |
+
$oembed_instagram_html .= "</div>";
|
39 |
$html_to_insert .= $oembed_instagram_html;
|
40 |
break;
|
41 |
case 'EMBED_OEMBED_INSTAGRAM_IMAGE':
|
59 |
}
|
60 |
}
|
61 |
else {
|
62 |
+
if ( $url != '' ) {
|
63 |
+
$oembed_instagram_html .= '<img src="' . $url . '"' . ' style="' . 'max-width:' . '100%' . " !important" . '; max-height:' . '100%' . " !important" . '; width:' . 'auto !important' . '; height:' . 'auto !important' . ';">';
|
64 |
}
|
65 |
}
|
66 |
$oembed_instagram_html .= "</div>";
|
67 |
$html_to_insert .= $oembed_instagram_html;
|
68 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
default:
|
70 |
+
// code...
|
71 |
break;
|
72 |
}
|
|
|
73 |
echo $html_to_insert;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
}
|
framework/WDI_generate_styles.php
CHANGED
@@ -652,8 +652,6 @@ class WDI_generate_styles {
|
|
652 |
public function lightbox_styles(){
|
653 |
$style = $this->theme_options;
|
654 |
$theme_id = $this->theme_id;
|
655 |
-
|
656 |
-
require_once(WDI_DIR . '/framework/WDILibraryEmbed.php');
|
657 |
$rgb_lightbox_ctrl_cont_bg_color = WDILibrary::wdi_spider_hex2rgb($style['lightbox_ctrl_cont_bg_color']);
|
658 |
$rgb_wdi_image_info_bg_color = WDILibrary::wdi_spider_hex2rgb($style['lightbox_info_bg_color']);
|
659 |
|
652 |
public function lightbox_styles(){
|
653 |
$style = $this->theme_options;
|
654 |
$theme_id = $this->theme_id;
|
|
|
|
|
655 |
$rgb_lightbox_ctrl_cont_bg_color = WDILibrary::wdi_spider_hex2rgb($style['lightbox_ctrl_cont_bg_color']);
|
656 |
$rgb_wdi_image_info_bg_color = WDILibrary::wdi_spider_hex2rgb($style['lightbox_info_bg_color']);
|
657 |
|
frontend/views/WDIViewGalleryBox.php
CHANGED
@@ -194,74 +194,73 @@ class WDIViewGalleryBox {
|
|
194 |
$current_filename = '';
|
195 |
?>
|
196 |
<style>
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
<?php
|
208 |
-
if($option_row->autohide_lightbox_navigation){?>
|
209 |
-
#wdi_spider_popup_left-ico{
|
210 |
-
left: -9999px;
|
211 |
-
}
|
212 |
-
#wdi_spider_popup_right-ico{
|
213 |
-
left: -9999px;
|
214 |
-
}
|
215 |
-
<?php }
|
216 |
-
else { ?>
|
217 |
-
#wdi_spider_popup_left-ico {
|
218 |
-
left: 20px;
|
219 |
-
}
|
220 |
-
#wdi_spider_popup_right-ico {
|
221 |
-
left: auto;
|
222 |
-
right: 20px;
|
223 |
-
}
|
224 |
-
<?php } ?>
|
225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
|
264 |
-
|
265 |
<?php echo ((!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'bottom') && $theme_row->lightbox_ctrl_btn_pos == 'bottom' && $theme_row->lightbox_info_pos == 'bottom') ? 'bottom: ' . ($theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top) . 'px;' : '' ?>
|
266 |
width: 33%;
|
267 |
margin: <?php echo $theme_row->lightbox_info_margin; ?>;
|
@@ -481,7 +480,6 @@ class WDIViewGalleryBox {
|
|
481 |
$image_row->filename = esc_url_raw($image_row->filename);
|
482 |
}
|
483 |
$is_embed = preg_match('/EMBED/',sanitize_text_field($image_row->filetype))==1 ? true :false;
|
484 |
-
$is_embed_instagram_post = preg_match('/INSTAGRAM_POST/',sanitize_text_field($image_row->filetype))==1 ? true :false;
|
485 |
if (intval($image_row->id) == intval($current_image_id) ) {
|
486 |
$current_key = $current_image_index;
|
487 |
?>
|
@@ -489,28 +487,16 @@ class WDIViewGalleryBox {
|
|
489 |
<span class="wdi_popup_image_spun1" style="display: table; width: inherit; height: inherit;">
|
490 |
<span class="wdi_popup_image_spun2" style="display: table-cell; vertical-align: middle; text-align: center;">
|
491 |
<?php
|
492 |
-
if (!$is_embed) {
|
493 |
?>
|
494 |
<img class="wdi_popup_image wdi_popup_watermark" src="<?php echo site_url() . '/' . $WD_WDI_UPLOAD_DIR . esc_url_raw($image_row->image_url); ?>" alt="<?php echo sanitize_text_field($image_row->alt); ?>" />
|
495 |
<?php
|
496 |
}
|
497 |
-
else {
|
498 |
<span class="wdi_popup_embed wdi_popup_watermark" style="display:table; table-layout:fixed;">
|
499 |
-
<?php
|
500 |
-
|
501 |
-
$
|
502 |
-
$post_height = $image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0);
|
503 |
-
if($post_height <$post_width +88 ){
|
504 |
-
$post_width =$post_height -88;
|
505 |
-
}
|
506 |
-
else{
|
507 |
-
$post_height =$post_width +88;
|
508 |
-
}
|
509 |
-
WDILibraryEmbed::display_embed(sanitize_text_field($image_row->filetype), $image_row->filename, array('class'=>"wdi_embed_frame", 'frameborder'=>"0", 'style'=>"width:".$post_width."px; height:".$post_height."px; vertical-align:middle; display:inline-block; position:relative;"), $carousel_media);
|
510 |
-
}
|
511 |
-
else{
|
512 |
-
WDILibraryEmbed::display_embed(sanitize_text_field($image_row->filetype), $image_row->filename, array('class'=>"wdi_embed_frame", 'frameborder'=>"0", 'allowfullscreen'=>"allowfullscreen", 'style'=>"width:inherit; height:inherit; vertical-align:middle; display:table-cell;"), $carousel_media);
|
513 |
-
}
|
514 |
?>
|
515 |
</span>
|
516 |
<?php
|
@@ -768,10 +754,10 @@ class WDIViewGalleryBox {
|
|
768 |
post_width = cur_width;
|
769 |
post_height = post_width +88 ;
|
770 |
}
|
771 |
-
innhtml += wdi_spider_display_embed(wdi_data[key]['filetype'], wdi_data[key]['filename'], {class:"wdi_embed_frame", frameborder:"0", allowfullscreen:"allowfullscreen", style:"width:"+post_width+"px; height:"+post_height+"px; vertical-align:middle; display:inline-block; position:relative; top: "+0.5*(cur_height-post_height)+ "px; " },wdi_data[key]['carousel_media']);
|
772 |
}
|
773 |
else{
|
774 |
-
innhtml += wdi_spider_display_embed(wdi_data[key]['filetype'], wdi_data[key]['filename'], {class:"wdi_embed_frame", frameborder:"0", allowfullscreen:"allowfullscreen", style:"width:inherit; height:inherit; vertical-align:middle; display:table-cell;" },wdi_data[key]['carousel_media']);
|
775 |
}
|
776 |
innhtml += "</span>";
|
777 |
}
|
194 |
$current_filename = '';
|
195 |
?>
|
196 |
<style>
|
197 |
+
.wdi_popup_image {
|
198 |
+
max-width: <?php echo $image_width - ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>px;
|
199 |
+
max-height: <?php echo $image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>px;
|
200 |
+
}
|
201 |
+
|
202 |
+
.wdi_popup_embed {
|
203 |
+
width: <?php echo $image_width - ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0); ?>px;
|
204 |
+
height: <?php echo $image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0); ?>px;
|
205 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
|
207 |
+
<?php
|
208 |
+
if($option_row->autohide_lightbox_navigation){?>
|
209 |
+
#wdi_spider_popup_left-ico{
|
210 |
+
left: -9999px;
|
211 |
+
}
|
212 |
+
#wdi_spider_popup_right-ico{
|
213 |
+
left: -9999px;
|
214 |
+
}
|
215 |
+
<?php }
|
216 |
+
else { ?>
|
217 |
+
#wdi_spider_popup_left-ico {
|
218 |
+
left: 20px;
|
219 |
+
}
|
220 |
+
#wdi_spider_popup_right-ico {
|
221 |
+
left: auto;
|
222 |
+
right: 20px;
|
223 |
+
}
|
224 |
+
<?php } ?>
|
225 |
|
226 |
+
.wdi_image_container {
|
227 |
+
<?php echo $theme_row->lightbox_filmstrip_pos; ?>: <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : $image_filmstrip_width); ?>px;
|
228 |
+
}
|
229 |
|
230 |
+
.wdi_filmstrip_container {
|
231 |
+
height: <?php echo ($filmstrip_direction == 'horizontal'? $image_filmstrip_height : $image_height); ?>px;
|
232 |
+
width: <?php echo ($filmstrip_direction == 'horizontal' ? $image_width : $image_filmstrip_width); ?>px;
|
233 |
+
}
|
234 |
|
235 |
+
.wdi_filmstrip {
|
236 |
+
<?php echo $left_or_top; ?>: 20px;
|
237 |
+
<?php echo $width_or_height; ?>: <?php echo ($filmstrip_direction == 'horizontal' ? $image_width - 40 : $image_height - 40); ?>px;
|
238 |
+
}
|
239 |
|
240 |
+
.wdi_filmstrip_thumbnails {
|
241 |
+
height: <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : ($image_filmstrip_height + $filmstrip_thumb_margin_hor + 2 * $theme_row->lightbox_filmstrip_thumb_border_width) * $image_rows_count); ?>px;
|
242 |
+
<?php echo $left_or_top; ?>: 0px;
|
243 |
+
width: <?php echo ($filmstrip_direction == 'horizontal' ? ($image_filmstrip_width + $filmstrip_thumb_margin_hor + 2 * $theme_row->lightbox_filmstrip_thumb_border_width) * $image_rows_count : $image_filmstrip_width); ?>px;
|
244 |
+
}
|
245 |
|
246 |
+
.wdi_filmstrip_thumbnail {
|
247 |
+
height: <?php echo $image_filmstrip_height; ?>px;
|
248 |
+
width: <?php echo $image_filmstrip_width; ?>px;
|
249 |
+
}
|
250 |
|
251 |
+
.wdi_filmstrip_left {
|
252 |
+
<?php echo $width_or_height; ?>: 20px;
|
253 |
+
<?php echo $left_or_top; ?>: 0;
|
254 |
+
}
|
255 |
+
.wdi_filmstrip_right {
|
256 |
+
<?php echo $width_or_height; ?>: 20px;
|
257 |
+
}
|
258 |
|
259 |
+
.wdi_image_info_container1 {
|
260 |
+
display: <?php echo $popup_info_always_show ? 'table-cell' : 'none'; ?>;
|
261 |
+
}
|
262 |
|
263 |
+
.wdi_image_info {
|
264 |
<?php echo ((!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'bottom') && $theme_row->lightbox_ctrl_btn_pos == 'bottom' && $theme_row->lightbox_info_pos == 'bottom') ? 'bottom: ' . ($theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top) . 'px;' : '' ?>
|
265 |
width: 33%;
|
266 |
margin: <?php echo $theme_row->lightbox_info_margin; ?>;
|
480 |
$image_row->filename = esc_url_raw($image_row->filename);
|
481 |
}
|
482 |
$is_embed = preg_match('/EMBED/',sanitize_text_field($image_row->filetype))==1 ? true :false;
|
|
|
483 |
if (intval($image_row->id) == intval($current_image_id) ) {
|
484 |
$current_key = $current_image_index;
|
485 |
?>
|
487 |
<span class="wdi_popup_image_spun1" style="display: table; width: inherit; height: inherit;">
|
488 |
<span class="wdi_popup_image_spun2" style="display: table-cell; vertical-align: middle; text-align: center;">
|
489 |
<?php
|
490 |
+
if ( !$is_embed ) {
|
491 |
?>
|
492 |
<img class="wdi_popup_image wdi_popup_watermark" src="<?php echo site_url() . '/' . $WD_WDI_UPLOAD_DIR . esc_url_raw($image_row->image_url); ?>" alt="<?php echo sanitize_text_field($image_row->alt); ?>" />
|
493 |
<?php
|
494 |
}
|
495 |
+
else { ?>
|
496 |
<span class="wdi_popup_embed wdi_popup_watermark" style="display:table; table-layout:fixed;">
|
497 |
+
<?php
|
498 |
+
$url = isset($image_row->images->standard_resolution->url) ? $image_row->images->standard_resolution->url : '';
|
499 |
+
WDILibraryEmbed::display_embed(sanitize_text_field($image_row->filetype), $image_row->filename, array('class'=>"wdi_embed_frame", 'frameborder'=>"0", 'allowfullscreen'=>"allowfullscreen", 'style'=>"width:inherit; height:inherit; vertical-align:middle; display:table-cell;"), $carousel_media, $url );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
500 |
?>
|
501 |
</span>
|
502 |
<?php
|
754 |
post_width = cur_width;
|
755 |
post_height = post_width +88 ;
|
756 |
}
|
757 |
+
innhtml += wdi_spider_display_embed(wdi_data[key]['filetype'], wdi_data[key]['filename'], wdi_data[key]['src'], {class:"wdi_embed_frame", frameborder:"0", allowfullscreen:"allowfullscreen", style:"width:"+post_width+"px; height:"+post_height+"px; vertical-align:middle; display:inline-block; position:relative; top: "+0.5*(cur_height-post_height)+ "px; " },wdi_data[key]['carousel_media']);
|
758 |
}
|
759 |
else{
|
760 |
+
innhtml += wdi_spider_display_embed(wdi_data[key]['filetype'], wdi_data[key]['filename'], wdi_data[key]['src'], {class:"wdi_embed_frame", frameborder:"0", allowfullscreen:"allowfullscreen", style:"width:inherit; height:inherit; vertical-align:middle; display:table-cell;" },wdi_data[key]['carousel_media']);
|
761 |
}
|
762 |
innhtml += "</span>";
|
763 |
}
|
js/gallerybox/wdi_gallery_box.js
CHANGED
@@ -1,13 +1,11 @@
|
|
1 |
var isPopUpOpened = false;
|
2 |
var wdi_data = [];
|
3 |
|
4 |
-
function wdi_spider_createpopup(url, current_view, width, height, duration, description, lifetime, currentFeed, image_id)
|
5 |
-
{
|
6 |
url = url.replace(/&/g, '&');
|
7 |
if (isPopUpOpened) {
|
8 |
return
|
9 |
}
|
10 |
-
;
|
11 |
isPopUpOpened = true;
|
12 |
if (wdi_spider_hasalreadyreceivedpopup(description) || wdi_spider_isunsupporteduseragent()) {
|
13 |
return;
|
@@ -25,6 +23,7 @@ function wdi_spider_createpopup(url, current_view, width, height, duration, desc
|
|
25 |
var current_image_row;
|
26 |
for (var i = 0; i < currentFeed.parsedData.length; i++) {
|
27 |
if(currentFeed.parsedData[i].id === image_id){
|
|
|
28 |
current_image_index = i;
|
29 |
current_image_row = [currentFeed.parsedData[i]];
|
30 |
break;
|
@@ -50,11 +49,9 @@ function wdi_spider_createpopup(url, current_view, width, height, duration, desc
|
|
50 |
'width:' + width + 'px;' +
|
51 |
'height:' + height + 'px;' +
|
52 |
'margin-top:-' + (height / 2) + 'px;' +
|
53 |
-
'margin-left: -' + (width / 2) + 'px; ">' +
|
54 |
-
response +
|
55 |
'</div>');
|
56 |
|
57 |
-
|
58 |
var constructor = new wdi_construct_popup(popup, currentFeed, currentFeed.parsedData, image_id);
|
59 |
constructor.construct();
|
60 |
|
@@ -64,7 +61,7 @@ function wdi_spider_createpopup(url, current_view, width, height, duration, desc
|
|
64 |
display: "none !important;"
|
65 |
});
|
66 |
}
|
67 |
-
});
|
68 |
}
|
69 |
|
70 |
var wdi_construct_popup = function (popup, currentFeed, image_rows, current_image_id) {
|
@@ -89,6 +86,7 @@ var wdi_construct_popup = function (popup, currentFeed, image_rows, current_imag
|
|
89 |
wdi_data[i]["profile_picture"] = image_rows[i].profile_picture;
|
90 |
wdi_data[i]["image_url"] = image_rows[i].image_url;
|
91 |
wdi_data[i]["thumb_url"] = image_rows[i].thumb_url;
|
|
|
92 |
wdi_data[i]["date"] = image_rows[i].date;
|
93 |
wdi_data[i]["comment_count"] = image_rows[i].comment_count;
|
94 |
wdi_data[i]["filetype"] = image_rows[i].filetype;
|
@@ -546,88 +544,20 @@ function wdi_play_pause($this)
|
|
546 |
embed_id: string, id of media in corresponding host, or url if no unique id system is defined for host
|
547 |
attrs: object with html attributes and values format e.g. {width:'100px', style:"display:inline;"}
|
548 |
*/
|
549 |
-
|
550 |
-
function wdi_spider_display_embed(embed_type, embed_id, attrs, carousel_media){
|
551 |
-
|
552 |
var html_to_insert = '';
|
553 |
-
|
554 |
-
switch(embed_type) {
|
555 |
-
case 'EMBED_OEMBED_YOUTUBE_VIDEO':
|
556 |
-
var oembed_youtube_html ='<iframe ';
|
557 |
-
if(embed_id!=''){
|
558 |
-
oembed_youtube_html += ' src="' + '//www.youtube.com/embed/'+embed_id + '?enablejsapi=1&wmode=transparent"';
|
559 |
-
}
|
560 |
-
for (attr in attrs) {
|
561 |
-
if(!(/src/i).test(attr)){
|
562 |
-
if(attr != '' && attrs[attr] != ''){
|
563 |
-
oembed_youtube_html += ' '+ attr + '="'+ attrs[attr] + '"';
|
564 |
-
}
|
565 |
-
}
|
566 |
-
}
|
567 |
-
oembed_youtube_html += " ></iframe>";
|
568 |
-
html_to_insert += oembed_youtube_html;
|
569 |
-
|
570 |
-
break;
|
571 |
-
case 'EMBED_OEMBED_VIMEO_VIDEO':
|
572 |
-
var oembed_vimeo_html ='<iframe ';
|
573 |
-
if(embed_id!=''){
|
574 |
-
oembed_vimeo_html += ' src="' + '//player.vimeo.com/video/'+embed_id + '?enablejsapi=1"';
|
575 |
-
}
|
576 |
-
for (attr in attrs) {
|
577 |
-
if(!(/src/i).test(attr)){
|
578 |
-
if(attr != '' && attrs[attr] != ''){
|
579 |
-
oembed_vimeo_html += ' '+ attr + '="'+ attrs[attr] + '"';
|
580 |
-
}
|
581 |
-
}
|
582 |
-
}
|
583 |
-
oembed_vimeo_html += " ></iframe>";
|
584 |
-
html_to_insert += oembed_vimeo_html;
|
585 |
-
|
586 |
-
break;
|
587 |
-
case 'EMBED_OEMBED_FLICKR_IMAGE':
|
588 |
-
|
589 |
-
var oembed_flickr_html ='<div ';
|
590 |
-
for (attr in attrs) {
|
591 |
-
if(!(/src/i).test(attr)){
|
592 |
-
if(attr != '' && attrs[attr] != ''){
|
593 |
-
oembed_flickr_html += ' '+ attr + '="'+ attrs[attr] + '"';
|
594 |
-
}
|
595 |
-
}
|
596 |
-
}
|
597 |
-
oembed_flickr_html += " >";
|
598 |
-
if(embed_id!=''){
|
599 |
-
|
600 |
-
oembed_flickr_html += '<img src="'+embed_id+'"'+
|
601 |
-
' style="'+
|
602 |
-
'max-width:'+'100%'+" !important"+
|
603 |
-
'; max-height:'+'100%'+" !important"+
|
604 |
-
'; width:'+'auto !important'+
|
605 |
-
'; height:'+ 'auto !important' +
|
606 |
-
';">';
|
607 |
-
|
608 |
-
|
609 |
-
}
|
610 |
-
|
611 |
-
oembed_flickr_html +="</div>";
|
612 |
-
|
613 |
-
html_to_insert += oembed_flickr_html;
|
614 |
-
break;
|
615 |
-
case 'EMBED_OEMBED_FLICKR_VIDEO':
|
616 |
-
/* code...*/
|
617 |
-
break;
|
618 |
-
|
619 |
case 'EMBED_OEMBED_INSTAGRAM_VIDEO':
|
620 |
-
var oembed_instagram_html ='<div ';
|
621 |
-
for (attr in attrs) {
|
622 |
-
if(!(/src/i).test(attr)){
|
623 |
-
if(attr != '' && attrs[attr] != ''){
|
624 |
-
oembed_instagram_html += ' '+ attr + '="'+ attrs[attr] + '"';
|
625 |
}
|
626 |
}
|
627 |
}
|
628 |
oembed_instagram_html += " >";
|
629 |
-
if(embed_id!=''){
|
630 |
-
|
631 |
/*oembed_instagram_html += '<iframe src="'+embed_id+'"'+
|
632 |
' style="'+
|
633 |
'max-width:'+'100%'+" !important"+
|
@@ -637,144 +567,59 @@ function wdi_spider_display_embed(embed_type, embed_id, attrs, carousel_media){
|
|
637 |
'; margin:0;"'+
|
638 |
'frameborder="0" scrolling="no" allowtransparency="false"></iframe>';
|
639 |
*/
|
640 |
-
oembed_instagram_html += '<video onclick=\"wdi_play_pause(jQuery(this));\" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls>'+
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
}
|
645 |
-
|
646 |
-
|
647 |
-
oembed_instagram_html +="</div>";
|
648 |
-
|
649 |
html_to_insert += oembed_instagram_html;
|
650 |
-
|
651 |
break;
|
652 |
-
|
653 |
case 'EMBED_OEMBED_INSTAGRAM_IMAGE':
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
}
|
660 |
-
}
|
661 |
-
}
|
662 |
-
oembed_instagram_html += " >";
|
663 |
-
if(carousel_media != null && carousel_media.length){
|
664 |
-
for(var i = 0; i < carousel_media.length; i++){
|
665 |
-
if(carousel_media[i]["type"] == "image"){
|
666 |
-
oembed_instagram_html += '<img src="'+carousel_media[i]["images"]["standard_resolution"]["url"]+'"'+
|
667 |
-
' style="'+
|
668 |
-
'max-width:'+'100%'+" !important"+
|
669 |
-
'; max-height:'+'100%'+" !important"+
|
670 |
-
'; width:'+'auto !important'+
|
671 |
-
'; height:'+ 'auto !important' +
|
672 |
-
';" data-id="' + i + '" class="carousel_media ' + (i == 0 ? "active" : "") + '">';
|
673 |
-
} else if(carousel_media[i]["type"] == "video"){
|
674 |
-
oembed_instagram_html += '<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="' + i + '" class="carousel_media ' + (i == 0 ? "active" : "") + '">'+
|
675 |
-
'<source src="'+ carousel_media[i]["videos"]["standard_resolution"]["url"] +
|
676 |
-
'" type="video/mp4"> Your browser does not support the video tag. </video>';
|
677 |
-
}
|
678 |
-
}
|
679 |
-
}
|
680 |
-
else {
|
681 |
-
if( embed_id != '' ) {
|
682 |
-
|
683 |
-
oembed_instagram_html += '<img src="//instagram.com/p/'+embed_id+'/media/?size=l"'+
|
684 |
-
' style=" '+
|
685 |
-
'max-width:'+'100%'+" !important"+
|
686 |
-
'; max-height:'+'100%'+" !important"+
|
687 |
-
'; width:'+'auto'+
|
688 |
-
'; height:'+ 'auto' +
|
689 |
-
';">';
|
690 |
-
}
|
691 |
-
}
|
692 |
-
oembed_instagram_html +="</div>";
|
693 |
-
|
694 |
-
html_to_insert += oembed_instagram_html;
|
695 |
-
break;
|
696 |
-
case 'EMBED_OEMBED_INSTAGRAM_POST':
|
697 |
-
var oembed_instagram_html ='<div ';
|
698 |
-
var id = '';
|
699 |
-
for (attr in attrs) {
|
700 |
-
if(!(/src/i).test(attr)){
|
701 |
-
if(attr != '' && attrs[attr] != ''){
|
702 |
-
oembed_instagram_html += ' '+ attr + '="'+ attrs[attr] + '"';
|
703 |
-
if(attr == 'CLASS' || attr =='class' || attr =='Class'){
|
704 |
-
obj_class = attrs[attr];
|
705 |
-
}
|
706 |
}
|
707 |
}
|
708 |
}
|
709 |
oembed_instagram_html += " >";
|
710 |
-
if(
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
'frameborder="0" scrolling="no" allowtransparency="false" allowfullscreen'+
|
721 |
-
'></iframe>';
|
722 |
-
}
|
723 |
-
|
724 |
-
oembed_instagram_html +="</div>";
|
725 |
-
|
726 |
-
html_to_insert += oembed_instagram_html;
|
727 |
-
|
728 |
-
break;
|
729 |
-
|
730 |
-
case 'EMBED_OEMBED_DAILYMOTION_VIDEO':
|
731 |
-
var oembed_dailymotion_html ='<iframe ';
|
732 |
-
if(embed_id!=''){
|
733 |
-
oembed_dailymotion_html += ' src="' + '//www.dailymotion.com/embed/video/'+embed_id + '?api=postMessage"';
|
734 |
-
}
|
735 |
-
for (attr in attrs) {
|
736 |
-
if(!(/src/i).test(attr)){
|
737 |
-
if(attr != '' && attrs[attr] != ''){
|
738 |
-
oembed_dailymotion_html += ' '+ attr + '="'+ attrs[attr] + '"';
|
739 |
}
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
break;
|
746 |
-
case 'EMBED_OEMBED_IMGUR':
|
747 |
-
/*not working yet*/
|
748 |
-
var oembed_imgur_html ='<div ';
|
749 |
-
for (attr in attrs) {
|
750 |
-
if(!(/src/i).test(attr)){
|
751 |
-
if(attr != '' && attrs[attr] != ''){
|
752 |
-
oembed_instagram_html += ' '+ attr + '="'+ attrs[attr] + '"';
|
753 |
}
|
754 |
}
|
755 |
}
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
}
|
767 |
-
|
768 |
-
|
769 |
-
html_to_insert += oembed_imgur_html;
|
770 |
-
|
771 |
break;
|
772 |
default:
|
773 |
-
;
|
774 |
}
|
775 |
-
|
776 |
return html_to_insert;
|
777 |
-
|
778 |
}
|
779 |
/**
|
780 |
* @param from_popup: optional, true if from bulk embed popup, false(default) if from instagram gallery
|
1 |
var isPopUpOpened = false;
|
2 |
var wdi_data = [];
|
3 |
|
4 |
+
function wdi_spider_createpopup(url, current_view, width, height, duration, description, lifetime, currentFeed, image_id) {
|
|
|
5 |
url = url.replace(/&/g, '&');
|
6 |
if (isPopUpOpened) {
|
7 |
return
|
8 |
}
|
|
|
9 |
isPopUpOpened = true;
|
10 |
if (wdi_spider_hasalreadyreceivedpopup(description) || wdi_spider_isunsupporteduseragent()) {
|
11 |
return;
|
23 |
var current_image_row;
|
24 |
for (var i = 0; i < currentFeed.parsedData.length; i++) {
|
25 |
if(currentFeed.parsedData[i].id === image_id){
|
26 |
+
|
27 |
current_image_index = i;
|
28 |
current_image_row = [currentFeed.parsedData[i]];
|
29 |
break;
|
49 |
'width:' + width + 'px;' +
|
50 |
'height:' + height + 'px;' +
|
51 |
'margin-top:-' + (height / 2) + 'px;' +
|
52 |
+
'margin-left: -' + (width / 2) + 'px; ">' + response +
|
|
|
53 |
'</div>');
|
54 |
|
|
|
55 |
var constructor = new wdi_construct_popup(popup, currentFeed, currentFeed.parsedData, image_id);
|
56 |
constructor.construct();
|
57 |
|
61 |
display: "none !important;"
|
62 |
});
|
63 |
}
|
64 |
+
});
|
65 |
}
|
66 |
|
67 |
var wdi_construct_popup = function (popup, currentFeed, image_rows, current_image_id) {
|
86 |
wdi_data[i]["profile_picture"] = image_rows[i].profile_picture;
|
87 |
wdi_data[i]["image_url"] = image_rows[i].image_url;
|
88 |
wdi_data[i]["thumb_url"] = image_rows[i].thumb_url;
|
89 |
+
wdi_data[i]["src"] = image_rows[i].images.standard_resolution.url;
|
90 |
wdi_data[i]["date"] = image_rows[i].date;
|
91 |
wdi_data[i]["comment_count"] = image_rows[i].comment_count;
|
92 |
wdi_data[i]["filetype"] = image_rows[i].filetype;
|
544 |
embed_id: string, id of media in corresponding host, or url if no unique id system is defined for host
|
545 |
attrs: object with html attributes and values format e.g. {width:'100px', style:"display:inline;"}
|
546 |
*/
|
547 |
+
function wdi_spider_display_embed( embed_type, embed_id, src, attrs, carousel_media ) {
|
|
|
|
|
548 |
var html_to_insert = '';
|
549 |
+
switch ( embed_type ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
550 |
case 'EMBED_OEMBED_INSTAGRAM_VIDEO':
|
551 |
+
var oembed_instagram_html = '<div ';
|
552 |
+
for ( attr in attrs ) {
|
553 |
+
if ( !(/src/i).test(attr) ) {
|
554 |
+
if ( attr != '' && attrs[attr] != '' ) {
|
555 |
+
oembed_instagram_html += ' ' + attr + '="' + attrs[attr] + '"';
|
556 |
}
|
557 |
}
|
558 |
}
|
559 |
oembed_instagram_html += " >";
|
560 |
+
if ( embed_id != '' ) {
|
|
|
561 |
/*oembed_instagram_html += '<iframe src="'+embed_id+'"'+
|
562 |
' style="'+
|
563 |
'max-width:'+'100%'+" !important"+
|
567 |
'; margin:0;"'+
|
568 |
'frameborder="0" scrolling="no" allowtransparency="false"></iframe>';
|
569 |
*/
|
570 |
+
oembed_instagram_html += '<video onclick=\"wdi_play_pause(jQuery(this));\" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls>' +
|
571 |
+
'<source src="' + src +
|
572 |
+
'" type="video/mp4"> Your browser does not support the video tag. </video>';
|
|
|
573 |
}
|
574 |
+
oembed_instagram_html += "</div>";
|
|
|
|
|
|
|
575 |
html_to_insert += oembed_instagram_html;
|
|
|
576 |
break;
|
|
|
577 |
case 'EMBED_OEMBED_INSTAGRAM_IMAGE':
|
578 |
+
var oembed_instagram_html = '<div ';
|
579 |
+
for ( attr in attrs ) {
|
580 |
+
if ( !(/src/i).test(attr) ) {
|
581 |
+
if ( attr != '' && attrs[attr] != '' ) {
|
582 |
+
oembed_instagram_html += ' ' + attr + '="' + attrs[attr] + '"';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
583 |
}
|
584 |
}
|
585 |
}
|
586 |
oembed_instagram_html += " >";
|
587 |
+
if ( carousel_media != null && carousel_media.length ) {
|
588 |
+
for ( var i = 0; i < carousel_media.length; i++ ) {
|
589 |
+
if ( carousel_media[i]["type"] == "image" ) {
|
590 |
+
oembed_instagram_html += '<img src="' + carousel_media[i]["images"]["standard_resolution"]["url"] + '"' +
|
591 |
+
' style="' +
|
592 |
+
'max-width:' + '100%' + " !important" +
|
593 |
+
'; max-height:' + '100%' + " !important" +
|
594 |
+
'; width:' + 'auto !important' +
|
595 |
+
'; height:' + 'auto !important' +
|
596 |
+
';" data-id="' + i + '" class="carousel_media ' + (i == 0 ? "active" : "") + '">';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
597 |
}
|
598 |
+
else if ( carousel_media[i]["type"] == "video" ) {
|
599 |
+
oembed_instagram_html += '<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="' + i + '" class="carousel_media ' + (i == 0 ? "active" : "") + '">' +
|
600 |
+
'<source src="' + src +
|
601 |
+
'" type="video/mp4"> Your browser does not support the video tag. </video>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
602 |
}
|
603 |
}
|
604 |
}
|
605 |
+
else {
|
606 |
+
if ( embed_id != '' ) {
|
607 |
+
oembed_instagram_html += '<img src="' + src + '"' +
|
608 |
+
' style=" ' +
|
609 |
+
'max-width:' + '100%' + " !important" +
|
610 |
+
'; max-height:' + '100%' + " !important" +
|
611 |
+
'; width:' + 'auto' +
|
612 |
+
'; height:' + 'auto' +
|
613 |
+
';">';
|
614 |
+
}
|
615 |
}
|
616 |
+
oembed_instagram_html += "</div>";
|
617 |
+
html_to_insert += oembed_instagram_html;
|
|
|
|
|
618 |
break;
|
619 |
default:
|
620 |
+
break;
|
621 |
}
|
|
|
622 |
return html_to_insert;
|
|
|
623 |
}
|
624 |
/**
|
625 |
* @param from_popup: optional, true if from bulk embed popup, false(default) if from instagram gallery
|
js/gallerybox/wdi_gallery_box.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var isPopUpOpened=!1,wdi_data=[];function wdi_spider_createpopup(e,t,i,a,r,n,d,o,s){if(e=e.replace(/&/g,"&"),!isPopUpOpened&&(isPopUpOpened=!0,!wdi_spider_hasalreadyreceivedpopup(n)&&!wdi_spider_isunsupporteduseragent())){jQuery("html").attr("style","overflow:hidden !important;"),jQuery("#wdi_spider_popup_loading_"+t).css({display:"block"}),jQuery("#wdi_spider_popup_overlay_"+t).css({display:"block"});for(var _,c=0,m=0;m<o.parsedData.length;m++)if(o.parsedData[m].id===s){c=m,_=[o.parsedData[m]];break}jQuery.ajax({type:"POST",url:e,dataType:"text",data:{action:"WDIGalleryBox",image_rows:JSON.stringify(_),feed_id:o.feed_row.id,feed_counter:o.feed_row.wdi_feed_counter,current_image_index:c,image_rows_count:o.parsedData.length,carousel_media_row:JSON.stringify(_[0].carousel_media)},success:function(e){var _=jQuery('<div id="wdi_spider_popup_wrap" class="wdi_spider_popup_wrap wdi_lightbox_theme_'+o.feed_row.theme_id+'" style="width:'+i+"px;height:"+a+"px;margin-top:-"+a/2+"px;margin-left: -"+i/2+'px; ">'+e+"</div>");new wdi_construct_popup(_,o,o.parsedData,s).construct(),_.hide().appendTo("body"),wdi_spider_showpopup(n,d,_,r),jQuery("#wdi_spider_popup_loading_"+t).css({display:"none !important;"})}})}}var wdi_construct_popup=function(e,t,i,a){this.theme_row={},this.construct=function(){this.theme_row=window["wdi_theme_"+t.feed_row.theme_id],t.feed_row.popup_enable_filmstrip&&"1"===t.feed_row.popup_enable_filmstrip&&this.add_filmstrip(),this.set_wdi_data()},this.add_filmstrip=function(){var r="horizontal";"right"!==this.theme_row.lightbox_filmstrip_pos&&"left"!==this.theme_row.lightbox_filmstrip_pos||(r="vertical");var n,d,o="horizontal"===r?"tenweb-i-angle-left":"tenweb-i-angle-up",s="horizontal"===r?"tenweb-i-angle-right":"tenweb-i-angle-down",_="";d=n="horizontal"===r?void 0!==t.feed_row.popup_filmstrip_height?t.feed_row.popup_filmstrip_height:"20":void 0!==t.feed_row.popup_filmstrip_height?t.feed_row.popup_filmstrip_height:"50",n=d=parseInt(d);for(var c=0;c<i.length;c++){var m,l,u,p=i[c];if(p.resolution&&""!==p.resolution){p.resolution.split(" ");var w=intval($resolution_arr[0]),h=intval($resolution_arr[2]);0!==w&&0!==h?(m=w*(u=Math.max(d/w,n/h)),l=h*u):(m=d,l=n)}else m=d,l=n;var f=(d-(m*=u=Math.max(d/m,n/l)))/2,g=(n-(l*=u))/2;_+='<div id="wdi_filmstrip_thumbnail_'+c+'" class="'+("wdi_filmstrip_thumbnail "+(parseInt(p.id)===parseInt(a)?"wdi_thumb_active":"wdi_thumb_deactive"))+'">'+('<img style="'+("width:"+m+"px;height:"+l+"px;margin-left:"+f+"px;margin-top:"+g+"px;")+'" class="wdi_filmstrip_thumbnail_img" src="'+(void 0!==p.images[t.feedImageResolution]&&void 0!==p.images[t.feedImageResolution].url?p.images[t.feedImageResolution].url:p.thumb_url)+'" onclick="'+("wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+c+"', wdi_data)")+'" ontouchend="'+("wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+c+"', wdi_data)")+'" image_id="'+p.id+'" image_key="'+c+'" alt="'+p.alt+'" />')+"</div>"}var y='<div class="wdi_filmstrip_left"><i class="tenweb-i '+o+'"></i></div><div class="wdi_filmstrip"><div class="wdi_filmstrip_thumbnails">'+_+'</div></div><div class="wdi_filmstrip_right"><i class="tenweb-i '+s+'"></i></div>';e.find(".wdi_filmstrip_container").append(y)},this.set_wdi_data=function(){wdi_data=[];for(var e=0;e<i.length;e++)wdi_data[e]=[],wdi_data[e].number=e+1,wdi_data[e].id=i[e].id,wdi_data[e].alt=i[e].alt,wdi_data[e].description=wdi_front.escape_tags(i[e].description),wdi_data[e].username=i[e].username,wdi_data[e].profile_picture=i[e].profile_picture,wdi_data[e].image_url=i[e].image_url,wdi_data[e].thumb_url=i[e].thumb_url,wdi_data[e].date=i[e].date,wdi_data[e].comment_count=i[e].comment_count,wdi_data[e].filetype=i[e].filetype,wdi_data[e].filename=i[e].filename,wdi_data[e].avg_rating=i[e].avg_rating,wdi_data[e].rate=i[e].rate,wdi_data[e].rate_count=i[e].rate_count,wdi_data[e].hit_count=i[e].hit_count,wdi_data[e].comments_data=void 0!==i[e].comments_data?i[e].comments_data:"null",wdi_data[e].carousel_media=void 0!==i[e].carousel_media?i[e].carousel_media:null}};function wdi_spider_showpopup(e,t,i,a){isPopUpOpened=!0,i.show(),wdi_spider_receivedpopup(e,t)}function wdi_spider_hasalreadyreceivedpopup(e){return document.cookie.indexOf(e)>-1&&delete document.cookie[document.cookie.indexOf(e)],!1}function wdi_spider_receivedpopup(e,t){var i=new Date;i.setDate(i.getDate()+t),document.cookie=e+"=true;expires="+i.toUTCString()+";path=/"}function wdi_spider_isunsupporteduseragent(){return!window.XMLHttpRequest}function wdi_spider_destroypopup(e){null!=document.getElementById("wdi_spider_popup_wrap")&&(wdi_comments_manager.popup_destroyed(),void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&jQuery.fullscreen.isFullScreen()&&jQuery.fullscreen.exit(),setTimeout(function(){jQuery(".wdi_spider_popup_wrap").remove(),jQuery(".wdi_spider_popup_loading").css({display:"none"}),jQuery(".wdi_spider_popup_overlay").css({display:"none"}),jQuery(document).off("keydown"),jQuery("html").attr("style","")},20)),isPopUpOpened=!1;var t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),i=document.querySelector('meta[name="viewport"]');t&&i&&(i.content="width=device-width, initial-scale=1");var a=jQuery(document).scrollTop();window.location.hash="",jQuery(document).scrollTop(a),"undefined"!=typeof wdi_playInterval&&clearInterval(wdi_playInterval)}function wdi_spider_ajax_save(e,t){return wdi_comments_manager.init(t),!1}function wdi_spider_set_input_value(e,t){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_spider_check_required(e,t){return""==jQuery("#"+e).val()&&(wdi_front.show_alert(t+"* "+wdi_objectL10n.wdi_field_required),jQuery("#"+e).attr("style","border-color: #FF0000;"),jQuery("#"+e).focus(),!0)}function wdi_spider_check_email(e){if(""!=jQuery("#"+e).val())return-1==jQuery("#"+e).val().replace(/^\s+|\s+$/g,"").search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)&&(wdi_front.show_alert(wdi_objectL10n.wdi_mail_validation),!0)}function wdi_captcha_refresh(e){document.getElementById(e+"_img")&&document.getElementById(e+"_input")&&(srcArr=document.getElementById(e+"_img").src.split("&r="),document.getElementById(e+"_img").src=srcArr[0]+"&r="+Math.floor(100*Math.random()),document.getElementById(e+"_img").style.display="inline-block",document.getElementById(e+"_input").value="")}function wdi_play_pause(e){var t=navigator.userAgent.indexOf("Chrome")>-1,i=navigator.userAgent.indexOf("Safari")>-1;if(t&&i&&(i=!1),!i){var a=e.get(0),r=!1;navigator.userAgent.match(/firefox/i)&&(r=!0),r||(a.paused?a.play():a.pause())}}function wdi_spider_display_embed(e,t,i,a){var r="";switch(e){case"EMBED_OEMBED_YOUTUBE_VIDEO":var n="<iframe ";for(attr in""!=t&&(n+=' src="//www.youtube.com/embed/'+t+'?enablejsapi=1&wmode=transparent"'),i)/src/i.test(attr)||""!=attr&&""!=i[attr]&&(n+=" "+attr+'="'+i[attr]+'"');r+=n+=" ></iframe>";break;case"EMBED_OEMBED_VIMEO_VIDEO":var d="<iframe ";for(attr in""!=t&&(d+=' src="//player.vimeo.com/video/'+t+'?enablejsapi=1"'),i)/src/i.test(attr)||""!=attr&&""!=i[attr]&&(d+=" "+attr+'="'+i[attr]+'"');r+=d+=" ></iframe>";break;case"EMBED_OEMBED_FLICKR_IMAGE":var o="<div ";for(attr in i)/src/i.test(attr)||""!=attr&&""!=i[attr]&&(o+=" "+attr+'="'+i[attr]+'"');o+=" >",""!=t&&(o+='<img src="'+t+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;">'),r+=o+="</div>";break;case"EMBED_OEMBED_FLICKR_VIDEO":break;case"EMBED_OEMBED_INSTAGRAM_VIDEO":var s="<div ";for(attr in i)/src/i.test(attr)||""!=attr&&""!=i[attr]&&(s+=" "+attr+'="'+i[attr]+'"');s+=" >",""!=t&&(s+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+t+'" type="video/mp4"> Your browser does not support the video tag. </video>'),r+=s+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":s="<div ";for(attr in i)/src/i.test(attr)||""!=attr&&""!=i[attr]&&(s+=" "+attr+'="'+i[attr]+'"');if(s+=" >",null!=a&&a.length)for(var _=0;_<a.length;_++)"image"==a[_].type?s+='<img src="'+a[_].images.standard_resolution.url+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;" data-id="'+_+'" class="carousel_media '+(0==_?"active":"")+'">':"video"==a[_].type&&(s+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="'+_+'" class="carousel_media '+(0==_?"active":"")+'"><source src="'+a[_].videos.standard_resolution.url+'" type="video/mp4"> Your browser does not support the video tag. </video>');else""!=t&&(s+='<img src="//instagram.com/p/'+t+'/media/?size=l" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">');r+=s+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_POST":s="<div ";for(attr in i)/src/i.test(attr)||""!=attr&&""!=i[attr]&&(s+=" "+attr+'="'+i[attr]+'"',"CLASS"!=attr&&"class"!=attr&&"Class"!=attr||(obj_class=i[attr]));s+=" >",""!=t&&(s+='<iframe class="inner_instagram_iframe_'+obj_class+'" src="//instagr.am/p/'+t+'/embed/?enablejsapi=1" style="max-width:100% !important; max-height:100% !important; width:100%; height:100%; margin:0; display:table-cell; vertical-align:middle;"frameborder="0" scrolling="no" allowtransparency="false" allowfullscreen></iframe>'),r+=s+="</div>";break;case"EMBED_OEMBED_DAILYMOTION_VIDEO":var c="<iframe ";for(attr in""!=t&&(c+=' src="//www.dailymotion.com/embed/video/'+t+'?api=postMessage"'),i)/src/i.test(attr)||""!=attr&&""!=i[attr]&&(c+=" "+attr+'="'+i[attr]+'"');r+=c+=" ></iframe>";break;case"EMBED_OEMBED_IMGUR":var m="<div ";for(attr in i)/src/i.test(attr)||""!=attr&&""!=i[attr]&&(s+=" "+attr+'="'+i[attr]+'"');m+=" >",""!=t&&(m+='<img src="'+t+'" style="max-width:100% !important; max-height:100% !important; width:auto; height:auto !important;">'),r+=m+="</div>"}return r}function wdi_testBrowser_cssTransitions(){return wdi_testDom("Transition")}function wdi_testBrowser_cssTransforms3d(){return wdi_testDom("Perspective")}function wdi_testDom(e){for(var t=["","Webkit","Moz","ms","O","Khtml"],i=t.length;i--;)if(void 0!==document.body.style[t[i]+e])return!0;return!1}function wdi_cube(e,t,i,a,r,n,d,o,s,_){if(!wdi_testBrowser_cssTransitions())return wdi_fallback(o,s,_);if(!wdi_testBrowser_cssTransforms3d())return wdi_fallback3d(o,s,_);wdi_trans_in_progress=!0,jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),jQuery(".wdi_slide_bg").css("perspective",1e3),jQuery(o).css({transform:"translateZ("+e+"px)",backfaceVisibility:"hidden"}),jQuery(s).css({opacity:1,filter:"Alpha(opacity=100)",backfaceVisibility:"hidden",transform:"translateY("+i+"px) translateX("+t+"px) rotateY("+r+"deg) rotateX("+a+"deg)"}),jQuery(".wdi_slider").css({transform:"translateZ(-"+e+"px)",transformStyle:"preserve-3d"}),setTimeout(function(){jQuery(".wdi_slider").css({transition:"all "+wdi_transition_duration+"ms ease-in-out",transform:"translateZ(-"+e+"px) rotateX("+n+"deg) rotateY("+d+"deg)"})},20),jQuery(".wdi_slider").one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(function(){jQuery(o).removeAttr("style"),jQuery(s).removeAttr("style"),jQuery(".wdi_slider").removeAttr("style"),jQuery(o).css({opacity:0,filter:"Alpha(opacity=0)","z-index":1}),jQuery(s).css({opacity:1,filter:"Alpha(opacity=100)","z-index":2}),wdi_trans_in_progress=!1,jQuery(o).html(""),"undefined"!=typeof event_stack&&event_stack.length>0&&(key=event_stack[0].split("-"),event_stack.shift(),wdi_change_image(key[0],key[1],wdi_data,!0));wdi_change_watermark_container()}))}function wdi_cubeH(e,t,i){var a=jQuery(e).width()/2;"right"==i?wdi_cube(a,a,0,0,90,0,-90,e,t,i):"left"==i&&wdi_cube(a,-a,0,0,-90,0,90,e,t,i)}function wdi_cubeV(e,t,i){var a=jQuery(e).height()/2;"right"==i?wdi_cube(a,0,-a,90,0,-90,0,e,t,i):"left"==i&&wdi_cube(a,0,a,-90,0,90,0,e,t,i)}function wdi_fallback(e,t,i){wdi_fade(e,t,i)}function wdi_fallback3d(e,t,i){wdi_sliceV(e,t,i)}function wdi_none(e,t,i){jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),wdi_trans_in_progress=!1,jQuery(e).html(""),wdi_change_watermark_container()}function wdi_fade(e,t,i){jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),wdi_testBrowser_cssTransitions()?(jQuery(t).css("transition","opacity "+wdi_transition_duration+"ms linear"),jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),wdi_change_watermark_container()):(jQuery(e).animate({opacity:0,"z-index":1},wdi_transition_duration),jQuery(t).animate({opacity:1,"z-index":2},{duration:wdi_transition_duration,complete:function(){wdi_trans_in_progress=!1,jQuery(e).html(""),wdi_change_watermark_container()}}),jQuery(e).fadeTo(wdi_transition_duration,0),jQuery(t).fadeTo(wdi_transition_duration,1))}function wdi_grid(e,t,i,a,r,n,d,o,s,_){if(!wdi_testBrowser_cssTransitions())return wdi_fallback(o,s,_);wdi_trans_in_progress=!0,jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");var c=wdi_transition_duration/(e+t);function m(e,t,i,a,r,n,d,o,s,_,m){var l=(_+m)*c;return jQuery('<span class="wdi_gridlet" />').css({display:"block",width:e,height:t,top:i,left:r,backgroundImage:'url("'+d+'")',backgroundColor:jQuery(".wdi_spider_popup_wrap").css("background-color"),backgroundRepeat:"no-repeat",backgroundPosition:n+"px "+a+"px",backgroundSize:o+"px "+s+"px",transition:"all "+wdi_transition_duration+"ms ease-in-out "+l+"ms",transform:"none"})}var l=jQuery(o).find("img"),u=jQuery('<span style="display: block;" />').addClass("wdi_grid");jQuery(o).prepend(u);var p=jQuery(".wdi_slide_bg"),w=l.width(),h=l.height(),f=p.width(),g=p.height(),y=Math.floor(f/e),v=Math.floor(g/t),b=f-e*y,j=Math.ceil(b/e),Q=g-t*v,k=Math.ceil(Q/t),x=0,E=Math.ceil((jQuery(".wdi_slide_bg").width()-l.width())/2),C=void 0===l.attr("src")?"":l.attr("src");a="min-auto"===(a="auto"===a?f:a)?-f:a,r="min-auto"===(r="auto"===r?g:r)?-g:r;for(var M=0;M<e;M++){var I=0,B=Math.floor((jQuery(".wdi_slide_bg").height()-l.height())/2),D=y;if(b>0){var O=b>=j?j:b;D+=O,b-=O}for(var A=0;A<t;A++){var T=v,z=Q;z>0&&(T+=O=z>=k?k:Q,z-=O),u.append(m(D,T,I,B,x,E,C,w,h,M,A)),I+=T,B-=T}E-=D,x+=D}var S=u.children().last();u.show(),l.css("opacity",0),u.children().first().addClass("rs-top-left"),u.children().last().addClass("rs-bottom-right"),u.children().eq(t-1).addClass("rs-bottom-left"),u.children().eq(-t).addClass("rs-top-right"),setTimeout(function(){u.children().css({opacity:d,transform:"rotate("+i+"deg) translateX("+a+"px) translateY("+r+"px) scale("+n+")"})},1),jQuery(s).css("opacity",1),jQuery(S).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(function(){jQuery(o).css({opacity:0,"z-index":1}),jQuery(s).css({opacity:1,"z-index":2}),l.css("opacity",1),u.remove(),wdi_trans_in_progress=!1,jQuery(o).html(""),"undefined"!=typeof event_stack&&event_stack.length>0&&(key=event_stack[0].split("-"),event_stack.shift(),wdi_change_image(key[0],key[1],wdi_data,!0));wdi_change_watermark_container()}))}function wdi_sliceH(e,t,i){if("right"==i)var a="min-auto";else if("left"==i)a="auto";wdi_grid(1,8,0,a,0,1,0,e,t,i)}function wdi_sliceV(e,t,i){if("right"==i)var a="min-auto";else if("left"==i)a="auto";wdi_grid(10,1,0,0,a,1,0,e,t,i)}function wdi_slideV(e,t,i){if("right"==i)var a="auto";else if("left"==i)a="min-auto";wdi_grid(1,1,0,0,a,1,1,e,t,i)}function wdi_slideH(e,t,i){if("right"==i)var a="min-auto";else if("left"==i)a="auto";wdi_grid(1,1,0,a,0,1,1,e,t,i)}function wdi_scaleOut(e,t,i){wdi_grid(1,1,0,0,0,1.5,0,e,t,i)}function wdi_scaleIn(e,t,i){wdi_grid(1,1,0,0,0,.5,0,e,t,i)}function wdi_blockScale(e,t,i){wdi_grid(8,6,0,0,0,.6,0,e,t,i)}function wdi_kaleidoscope(e,t,i){wdi_grid(10,8,0,0,0,1,0,e,t,i)}function wdi_fan(e,t,i){if("right"==i)var a=45,r=100;else if("left"==i)a=-45,r=-100;wdi_grid(1,10,a,r,0,1,0,e,t,i)}function wdi_blindV(e,t,i){wdi_grid(1,8,0,0,0,.7,0,e,t)}function wdi_blindH(e,t,i){wdi_grid(10,1,0,0,0,.7,0,e,t)}function wdi_random(e,t,i){var a=["sliceH","sliceV","slideH","slideV","scaleOut","scaleIn","blockScale","kaleidoscope","fan","blindH","blindV"];this["wdi_"+a[Math.floor(Math.random()*a.length)]](e,t,i)}function wdi_pause_stream(e){jQuery(e).find("video").each(function(){jQuery(this).get(0).pause()})}function wdi_reset_zoom(){var e=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),t=document.querySelector('meta[name="viewport"]');e&&t&&(t.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0")}Object.size=function(e){var t,i=0;for(t in e)e.hasOwnProperty(t)&&i++;return i},wdi_comments_manager={media_id:"",mediaComments:[],load_more_count:10,commentCounter:0,currentKey:-1,init:function(e){this.instagram=new WDIInstagram,this.instagram.addToken(wdi_front.access_token),this.currentKey!=e&&(this.currentKey=e,this.reset_comments())},reset_comments:function(){jQuery("#wdi_load_more_comments").remove(),jQuery("#wdi_added_comments").html(""),this.commentCounter=0,this.media_id=wdi_data[this.currentKey].id,this.getAjaxComments(this.currentKey)},popup_destroyed:function(){this.media_id="",this.mediaComments=[],this.commentCounter=0,this.currentKey=-1},showComments:function(e,t){(Object.size(e)-this.commentCounter-t<0||void 0===t)&&(t=Object.size(e)-this.commentCounter);var a=this.commentCounter;for(i=Object.size(e)-a-1;i>=Object.size(e)-a-t;i--){this.commentCounter++;var r=e[i].text;r=wdi_front.escape_tags(r),r=this.filterCommentText(r);var n=e[i].from.username,d=(e[i].from.profile_picture,jQuery('<div class="wdi_single_comment"></div>'));d.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/'+n+'">'+n+'</a></span><span class="wdi_comment_date">'+wdi_front.convertUnixDate(e[i].created_time)+"</span></p>")),d.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>'+r+"</p></span></div>")),jQuery("#wdi_added_comments").prepend(d)}this.updateScrollbar()},updateScrollbar:function(){var e=jQuery("#wdi_comments"),t=jQuery("#wdi_added_comments");jQuery(".wdi_comments").attr("class","wdi_comments"),jQuery(".wdi_comments").html(""),jQuery(".wdi_comments").append(e),jQuery(".wdi_comments").append(t),void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".wdi_comments").mCustomScrollbar({scrollInertia:250}),jQuery(".wdi_comments_close_btn").on("click",wdi_comment)},getAjaxComments:function(){this.instagram.getRecentMediaComments(this.media_id,{success:function(e){if(""==e||null==e||null==e)return errorMessage="Network Error, please try again later :(",void console.log("%c"+errorMessage,"color:#cc0000;");if(200!=e.meta.code)return errorMessage=e.meta.error_message,void console.log("%c"+errorMessage,"color:#cc0000;");wdi_comments_manager.mediaComments=e.data;var t=wdi_data[wdi_comments_manager.currentKey];t.comments_data=e.data,wdi_comments_manager.showComments(t.comments_data,wdi_comments_manager.load_more_count),wdi_comments_manager.ajax_comments_ready(e.data)}})},ajax_comments_ready:function(e){this.createLoadMoreAndBindEvent()},createLoadMoreAndBindEvent:function(){jQuery("#wdi_added_comments").prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>')),jQuery(".wdi_comment_container #wdi_load_more_comments").on("click",function(){jQuery(this).remove(),wdi_comments_manager.showComments(wdi_comments_manager.mediaComments,wdi_comments_manager.load_more_count),wdi_comments_manager.createLoadMoreAndBindEvent()})},filterCommentText:function(e){for(var t=e.split(" "),i="",a=0;a<t.length;a++)switch(t[a][0]){case"@":i+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/'+t[a].substring(1,t[a].length)+'">'+t[a]+"</a> ";break;case"#":i+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/explore/tags/'+t[a].substring(1,t[a].length)+'">'+t[a]+"</a> ";break;default:i+=t[a]+" "}return i=i.substring(0,i.length-1)}};
|
1 |
+
var isPopUpOpened=!1,wdi_data=[];function wdi_spider_createpopup(e,t,i,a,r,n,o,d,s){if(e=e.replace(/&/g,"&"),!isPopUpOpened&&(isPopUpOpened=!0,!wdi_spider_hasalreadyreceivedpopup(n)&&!wdi_spider_isunsupporteduseragent())){jQuery("html").attr("style","overflow:hidden !important;"),jQuery("#wdi_spider_popup_loading_"+t).css({display:"block"}),jQuery("#wdi_spider_popup_overlay_"+t).css({display:"block"});for(var _,m=0,c=0;c<d.parsedData.length;c++)if(d.parsedData[c].id===s){m=c,_=[d.parsedData[c]];break}jQuery.ajax({type:"POST",url:e,dataType:"text",data:{action:"WDIGalleryBox",image_rows:JSON.stringify(_),feed_id:d.feed_row.id,feed_counter:d.feed_row.wdi_feed_counter,current_image_index:m,image_rows_count:d.parsedData.length,carousel_media_row:JSON.stringify(_[0].carousel_media)},success:function(e){var _=jQuery('<div id="wdi_spider_popup_wrap" class="wdi_spider_popup_wrap wdi_lightbox_theme_'+d.feed_row.theme_id+'" style="width:'+i+"px;height:"+a+"px;margin-top:-"+a/2+"px;margin-left: -"+i/2+'px; ">'+e+"</div>");new wdi_construct_popup(_,d,d.parsedData,s).construct(),_.hide().appendTo("body"),wdi_spider_showpopup(n,o,_,r),jQuery("#wdi_spider_popup_loading_"+t).css({display:"none !important;"})}})}}var wdi_construct_popup=function(e,t,i,a){this.theme_row={},this.construct=function(){this.theme_row=window["wdi_theme_"+t.feed_row.theme_id],this.set_wdi_data()},this.set_wdi_data=function(){wdi_data=[];for(var e=0;e<i.length;e++)wdi_data[e]=[],wdi_data[e].number=e+1,wdi_data[e].id=i[e].id,wdi_data[e].alt=i[e].alt,wdi_data[e].description=wdi_front.escape_tags(i[e].description),wdi_data[e].username=i[e].username,wdi_data[e].profile_picture=i[e].profile_picture,wdi_data[e].image_url=i[e].image_url,wdi_data[e].thumb_url=i[e].thumb_url,wdi_data[e].src=i[e].images.standard_resolution.url,wdi_data[e].date=i[e].date,wdi_data[e].comment_count=i[e].comment_count,wdi_data[e].filetype=i[e].filetype,wdi_data[e].filename=i[e].filename,wdi_data[e].avg_rating=i[e].avg_rating,wdi_data[e].rate=i[e].rate,wdi_data[e].rate_count=i[e].rate_count,wdi_data[e].hit_count=i[e].hit_count,wdi_data[e].comments_data=void 0!==i[e].comments_data?i[e].comments_data:"null",wdi_data[e].carousel_media=void 0!==i[e].carousel_media?i[e].carousel_media:null}};function wdi_spider_showpopup(e,t,i,a){isPopUpOpened=!0,i.show(),wdi_spider_receivedpopup(e,t)}function wdi_spider_hasalreadyreceivedpopup(e){return document.cookie.indexOf(e)>-1&&delete document.cookie[document.cookie.indexOf(e)],!1}function wdi_spider_receivedpopup(e,t){var i=new Date;i.setDate(i.getDate()+t),document.cookie=e+"=true;expires="+i.toUTCString()+";path=/",jQuery(".wdi_image_info").mCustomScrollbar({autoHideScrollbar:!1,scrollInertia:150,advanced:{updateOnContentResize:!0}})}function wdi_spider_isunsupporteduseragent(){return!window.XMLHttpRequest}function wdi_spider_destroypopup(e){null!=document.getElementById("wdi_spider_popup_wrap")&&(wdi_comments_manager.popup_destroyed(),void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&jQuery.fullscreen.isFullScreen()&&jQuery.fullscreen.exit(),setTimeout(function(){jQuery(".wdi_spider_popup_wrap").remove(),jQuery(".wdi_spider_popup_loading").css({display:"none"}),jQuery(".wdi_spider_popup_overlay").css({display:"none"}),jQuery(document).off("keydown"),jQuery("html").attr("style","")},20)),isPopUpOpened=!1;var t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),i=document.querySelector('meta[name="viewport"]');t&&i&&(i.content="width=device-width, initial-scale=1");var a=jQuery(document).scrollTop();window.location.hash="",jQuery(document).scrollTop(a),"undefined"!=typeof wdi_playInterval&&clearInterval(wdi_playInterval)}function wdi_spider_ajax_save(e,t){return wdi_comments_manager.init(t),!1}function wdi_spider_set_input_value(e,t){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_spider_check_required(e,t){return""==jQuery("#"+e).val()&&(wdi_front.show_alert(t+"* "+wdi_objectL10n.wdi_field_required),jQuery("#"+e).attr("style","border-color: #FF0000;"),jQuery("#"+e).focus(),!0)}function wdi_spider_check_email(e){if(""!=jQuery("#"+e).val())return-1==jQuery("#"+e).val().replace(/^\s+|\s+$/g,"").search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)&&(wdi_front.show_alert(wdi_objectL10n.wdi_mail_validation),!0)}function wdi_captcha_refresh(e){document.getElementById(e+"_img")&&document.getElementById(e+"_input")&&(srcArr=document.getElementById(e+"_img").src.split("&r="),document.getElementById(e+"_img").src=srcArr[0]+"&r="+Math.floor(100*Math.random()),document.getElementById(e+"_img").style.display="inline-block",document.getElementById(e+"_input").value="")}function wdi_play_pause(e){var t=navigator.userAgent.indexOf("Chrome")>-1,i=navigator.userAgent.indexOf("Safari")>-1;if(t&&i&&(i=!1),!i){var a=e.get(0),r=!1;navigator.userAgent.match(/firefox/i)&&(r=!0),r||(a.paused?a.play():a.pause())}}function wdi_spider_display_embed(e,t,i,a,r){var n="";switch(e){case"EMBED_OEMBED_INSTAGRAM_VIDEO":var o="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(o+=" "+attr+'="'+a[attr]+'"');o+=" >",""!=t&&(o+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+i+'" type="video/mp4"> Your browser does not support the video tag. </video>'),n+=o+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":o="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(o+=" "+attr+'="'+a[attr]+'"');if(o+=" >",null!=r&&r.length)for(var d=0;d<r.length;d++)"image"==r[d].type?o+='<img src="'+r[d].images.standard_resolution.url+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;" data-id="'+d+'" class="carousel_media '+(0==d?"active":"")+'">':"video"==r[d].type&&(o+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="'+d+'" class="carousel_media '+(0==d?"active":"")+'"><source src="'+i+'" type="video/mp4"> Your browser does not support the video tag. </video>');else""!=t&&(o+='<img src="'+i+'" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">');n+=o+="</div>"}return n}function wdi_testBrowser_cssTransitions(){return wdi_testDom("Transition")}function wdi_testBrowser_cssTransforms3d(){return wdi_testDom("Perspective")}function wdi_testDom(e){for(var t=["","Webkit","Moz","ms","O","Khtml"],i=t.length;i--;)if(void 0!==document.body.style[t[i]+e])return!0;return!1}function wdi_fallback(e,t,i){wdi_fade(e,t,i)}function wdi_fallback3d(e,t,i){wdi_sliceV(e,t,i)}function wdi_none(e,t,i){jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),wdi_trans_in_progress=!1,jQuery(e).html(""),wdi_change_watermark_container()}function wdi_fade(e,t,i){jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),wdi_testBrowser_cssTransitions()?(jQuery(t).css("transition","opacity "+wdi_transition_duration+"ms linear"),jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),wdi_change_watermark_container()):(jQuery(e).animate({opacity:0,"z-index":1},wdi_transition_duration),jQuery(t).animate({opacity:1,"z-index":2},{duration:wdi_transition_duration,complete:function(){wdi_trans_in_progress=!1,jQuery(e).html(""),wdi_change_watermark_container()}}),jQuery(e).fadeTo(wdi_transition_duration,0),jQuery(t).fadeTo(wdi_transition_duration,1))}function wdi_pause_stream(e){jQuery(e).find("video").each(function(){jQuery(this).get(0).pause()})}function wdi_reset_zoom(){var e=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),t=document.querySelector('meta[name="viewport"]');e&&t&&(t.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0")}Object.size=function(e){var t,i=0;for(t in e)e.hasOwnProperty(t)&&i++;return i},wdi_comments_manager={media_id:"",mediaComments:[],load_more_count:10,commentCounter:0,currentKey:-1,init:function(e){this.instagram=new WDIInstagram,this.instagram.addToken(wdi_front.access_token),this.currentKey!=e&&(this.currentKey=e,this.reset_comments())},reset_comments:function(){jQuery("#wdi_load_more_comments").remove(),jQuery("#wdi_added_comments").html(""),this.commentCounter=0,this.media_id=wdi_data[this.currentKey].id,this.getAjaxComments(this.currentKey)},popup_destroyed:function(){this.media_id="",this.mediaComments=[],this.commentCounter=0,this.currentKey=-1},showComments:function(e,t){(Object.size(e)-this.commentCounter-t<0||void 0===t)&&(t=Object.size(e)-this.commentCounter);var a=this.commentCounter;for(i=Object.size(e)-a-1;i>=Object.size(e)-a-t;i--){this.commentCounter++;var r=e[i].text;r=wdi_front.escape_tags(r),r=this.filterCommentText(r);var n=e[i].from.username,o=(e[i].from.profile_picture,jQuery('<div class="wdi_single_comment"></div>'));o.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/'+n+'">'+n+'</a></span><span class="wdi_comment_date">'+wdi_front.convertUnixDate(e[i].created_time)+"</span></p>")),o.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>'+r+"</p></span></div>")),jQuery("#wdi_added_comments").prepend(o)}this.updateScrollbar()},updateScrollbar:function(){var e=jQuery("#wdi_comments"),t=jQuery("#wdi_added_comments");jQuery(".wdi_comments").attr("class","wdi_comments"),jQuery(".wdi_comments").html(""),jQuery(".wdi_comments").append(e),jQuery(".wdi_comments").append(t),void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".wdi_comments").mCustomScrollbar({scrollInertia:250}),jQuery(".wdi_comments_close_btn").on("click",wdi_comment)},getAjaxComments:function(){this.instagram.getRecentMediaComments(this.media_id,{success:function(e){if(""==e||null==e||null==e)return errorMessage="Network Error, please try again later :(",void console.log("%c"+errorMessage,"color:#cc0000;");if(200!=e.meta.code)return errorMessage=e.meta.error_message,void console.log("%c"+errorMessage,"color:#cc0000;");wdi_comments_manager.mediaComments=e.data;var t=wdi_data[wdi_comments_manager.currentKey];t.comments_data=e.data,wdi_comments_manager.showComments(t.comments_data,wdi_comments_manager.load_more_count),wdi_comments_manager.ajax_comments_ready(e.data)}})},ajax_comments_ready:function(e){this.createLoadMoreAndBindEvent()},createLoadMoreAndBindEvent:function(){jQuery("#wdi_added_comments").prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>')),jQuery(".wdi_comment_container #wdi_load_more_comments").on("click",function(){jQuery(this).remove(),wdi_comments_manager.showComments(wdi_comments_manager.mediaComments,wdi_comments_manager.load_more_count),wdi_comments_manager.createLoadMoreAndBindEvent()})},filterCommentText:function(e){for(var t=e.split(" "),i="",a=0;a<t.length;a++)switch(t[a][0]){case"@":i+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/'+t[a].substring(1,t[a].length)+'">'+t[a]+"</a> ";break;case"#":i+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/explore/tags/'+t[a].substring(1,t[a].length)+'">'+t[a]+"</a> ";break;default:i+=t[a]+" "}return i=i.substring(0,i.length-1)}};
|
js/wdi_frontend.js
CHANGED
@@ -4,7 +4,6 @@ if (typeof wdi_front == 'undefined') {
|
|
4 |
};
|
5 |
}
|
6 |
|
7 |
-
|
8 |
wdi_front.detectEvent = function ()
|
9 |
{
|
10 |
var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
|
@@ -30,7 +29,6 @@ wdi_front.escape_tags = function (text)
|
|
30 |
text = text.toString().replace(lt, "<").replace(gt, ">").replace(ap, "'").replace(ic, """);
|
31 |
|
32 |
return text;
|
33 |
-
|
34 |
}
|
35 |
|
36 |
wdi_front.show_alert = function (message, response, wdi_current_feed)
|
@@ -1337,17 +1335,22 @@ wdi_front.smartPicker = function (currentFeed, load_more_number)
|
|
1337 |
wdi_front.createObject = function (obj, currentFeed)
|
1338 |
{
|
1339 |
var caption = (obj['caption'] != null) ? obj['caption']['text'] : ' ';
|
1340 |
-
|
1341 |
-
|
|
|
|
|
1342 |
if ( obj['type'] == 'video' && obj['videos'][currentFeed.feedVideoResolution] && obj['videos'][currentFeed.feedVideoResolution]['url'] != null ) {
|
1343 |
videoUrl = obj.hasOwnProperty('videos') ? obj['videos'][currentFeed.feedVideoResolution]['url'] : '';
|
1344 |
}
|
1345 |
|
1346 |
if(typeof obj.images[currentFeed.feedImageResolution] == "undefined"){
|
1347 |
-
debugger;
|
1348 |
var image_url = wdi_url.plugin_url + "images/missing.png";
|
1349 |
}else {
|
1350 |
-
|
|
|
|
|
|
|
|
|
1351 |
}
|
1352 |
|
1353 |
var imageIndex = currentFeed.imageIndex;
|
@@ -2591,9 +2594,7 @@ wdi_front.getImgCount = function (currentFeed)
|
|
2591 |
}
|
2592 |
|
2593 |
// parses image data for lightbox popup
|
2594 |
-
wdi_front.parseLighboxData = function (currentFeed, filterFlag)
|
2595 |
-
{
|
2596 |
-
|
2597 |
var dataStorage = currentFeed.dataStorage;
|
2598 |
var sortImagesBy = currentFeed.feed_row['sort_images_by'];
|
2599 |
var sortOrder = currentFeed.feed_row['display_order'];
|
@@ -2617,6 +2618,13 @@ wdi_front.parseLighboxData = function (currentFeed, filterFlag)
|
|
2617 |
}
|
2618 |
|
2619 |
for (i = 0; i < data.length; i++) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2620 |
obj = {
|
2621 |
'alt': '',
|
2622 |
'avg_rating': '',
|
@@ -2633,14 +2641,13 @@ wdi_front.parseLighboxData = function (currentFeed, filterFlag)
|
|
2633 |
'rate_count': '0',
|
2634 |
'username': data[i]['user']['username'],
|
2635 |
'profile_picture': data[i]['user']['profile_picture'],
|
2636 |
-
'thumb_url':
|
2637 |
'comments_data': data[i]['comments']['data'],
|
2638 |
'images': data[i]['images'],
|
2639 |
'carousel_media': (typeof data[i]['carousel_media'] !== "undefined") ? data[i]['carousel_media'] : null
|
2640 |
}
|
2641 |
popupData.push(obj);
|
2642 |
}
|
2643 |
-
|
2644 |
return popupData;
|
2645 |
}
|
2646 |
|
@@ -2680,11 +2687,10 @@ wdi_front.getFileName = function (data)
|
|
2680 |
}
|
2681 |
}
|
2682 |
|
2683 |
-
wdi_front.getFileType = function (data)
|
2684 |
-
{
|
2685 |
/*if pure video, not carousel*/
|
2686 |
//@ToDo old if (data['type'] == 'video' && data.hasOwnProperty('videos')) {
|
2687 |
-
if (data['
|
2688 |
return "EMBED_OEMBED_INSTAGRAM_VIDEO";
|
2689 |
}
|
2690 |
else {
|
@@ -2692,9 +2698,7 @@ wdi_front.getFileType = function (data)
|
|
2692 |
}
|
2693 |
}
|
2694 |
|
2695 |
-
|
2696 |
-
wdi_front.array_max = function (array)
|
2697 |
-
{
|
2698 |
var max = array[0];
|
2699 |
var minIndex = 0;
|
2700 |
for (var i = 1; i < array.length; i++) {
|
4 |
};
|
5 |
}
|
6 |
|
|
|
7 |
wdi_front.detectEvent = function ()
|
8 |
{
|
9 |
var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
|
29 |
text = text.toString().replace(lt, "<").replace(gt, ">").replace(ap, "'").replace(ic, """);
|
30 |
|
31 |
return text;
|
|
|
32 |
}
|
33 |
|
34 |
wdi_front.show_alert = function (message, response, wdi_current_feed)
|
1335 |
wdi_front.createObject = function (obj, currentFeed)
|
1336 |
{
|
1337 |
var caption = (obj['caption'] != null) ? obj['caption']['text'] : ' ';
|
1338 |
+
/*
|
1339 |
+
@TODO need to change video default image
|
1340 |
+
*/
|
1341 |
+
var videoUrl = wdi_url.plugin_url + "images/video_missing.png";
|
1342 |
if ( obj['type'] == 'video' && obj['videos'][currentFeed.feedVideoResolution] && obj['videos'][currentFeed.feedVideoResolution]['url'] != null ) {
|
1343 |
videoUrl = obj.hasOwnProperty('videos') ? obj['videos'][currentFeed.feedVideoResolution]['url'] : '';
|
1344 |
}
|
1345 |
|
1346 |
if(typeof obj.images[currentFeed.feedImageResolution] == "undefined"){
|
|
|
1347 |
var image_url = wdi_url.plugin_url + "images/missing.png";
|
1348 |
}else {
|
1349 |
+
if( obj.type == "carousel" && typeof obj.images[currentFeed.feedImageResolution].url === 'undefined') {
|
1350 |
+
var image_url = obj.carousel_media[0].images[currentFeed.feedImageResolution].url;
|
1351 |
+
} else {
|
1352 |
+
var image_url = obj.images[currentFeed.feedImageResolution].url;
|
1353 |
+
}
|
1354 |
}
|
1355 |
|
1356 |
var imageIndex = currentFeed.imageIndex;
|
2594 |
}
|
2595 |
|
2596 |
// parses image data for lightbox popup
|
2597 |
+
wdi_front.parseLighboxData = function (currentFeed, filterFlag) {
|
|
|
|
|
2598 |
var dataStorage = currentFeed.dataStorage;
|
2599 |
var sortImagesBy = currentFeed.feed_row['sort_images_by'];
|
2600 |
var sortOrder = currentFeed.feed_row['display_order'];
|
2618 |
}
|
2619 |
|
2620 |
for (i = 0; i < data.length; i++) {
|
2621 |
+
var thumb_url = (typeof data[i]['media_url'] !== 'undefined') ? data[i]['media_url'] : wdi_url.plugin_url + 'images/video_missing.png';
|
2622 |
+
if( typeof data[i]['media_url'] === 'undefined' ) {
|
2623 |
+
if( data[i]['type'] === 'carousel' ) {
|
2624 |
+
var carousel_media = data[i]['carousel_media'][0];
|
2625 |
+
thumb_url = carousel_media['images']['standard_resolution']['url'];
|
2626 |
+
}
|
2627 |
+
}
|
2628 |
obj = {
|
2629 |
'alt': '',
|
2630 |
'avg_rating': '',
|
2641 |
'rate_count': '0',
|
2642 |
'username': data[i]['user']['username'],
|
2643 |
'profile_picture': data[i]['user']['profile_picture'],
|
2644 |
+
'thumb_url': thumb_url,
|
2645 |
'comments_data': data[i]['comments']['data'],
|
2646 |
'images': data[i]['images'],
|
2647 |
'carousel_media': (typeof data[i]['carousel_media'] !== "undefined") ? data[i]['carousel_media'] : null
|
2648 |
}
|
2649 |
popupData.push(obj);
|
2650 |
}
|
|
|
2651 |
return popupData;
|
2652 |
}
|
2653 |
|
2687 |
}
|
2688 |
}
|
2689 |
|
2690 |
+
wdi_front.getFileType = function (data) {
|
|
|
2691 |
/*if pure video, not carousel*/
|
2692 |
//@ToDo old if (data['type'] == 'video' && data.hasOwnProperty('videos')) {
|
2693 |
+
if (data['type'] == 'video' && data.hasOwnProperty('videos')) {
|
2694 |
return "EMBED_OEMBED_INSTAGRAM_VIDEO";
|
2695 |
}
|
2696 |
else {
|
2698 |
}
|
2699 |
}
|
2700 |
|
2701 |
+
wdi_front.array_max = function (array) {
|
|
|
|
|
2702 |
var max = array[0];
|
2703 |
var minIndex = 0;
|
2704 |
for (var i = 1; i < array.length; i++) {
|
js/wdi_frontend.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
"undefined"==typeof wdi_front&&(wdi_front={type:"not_declared"}),wdi_front.detectEvent=function(){return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())?"touchend":"click"};var wdi_error_show=!1,wdi_error_init=!1;function wdi_baseName(e){var t=e.substr(e.lastIndexOf("/"));return e.replace(t,"")}wdi_front.escape_tags=function(e){return void 0===e&&(e=""),e=e.toString().replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")},wdi_front.show_alert=function(e,t,r){if(r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter),400===t.meta.code&&"APINotAllowedError"===t.meta.error_type){if(void 0!==t.wdi_current_feed_name){var i=t.wdi_current_feed_name,a=r.find(".wdi_private_feed_names");void 0===a.attr("wdi_first_private_user")?a.attr("wdi_first_private_user",1):i=", "+i,a.append(i),r.find(".wdi_private_feed_error").removeClass("wdi_hidden")}r.find(".wdi_spinner").remove()}if(void 0!==r&&"APINotAllowedError"!=t.meta.error_type){r.find(".wdi_spinner").remove(),wdi_error_show=!0;var d=r.find(".wdi_js_error"),o=r.find(".wdi_token_error");0!=t&&null!=typeof t.meta&&"OAuthAccessTokenException"===t.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,t=0;if(void 0!==wdi_ajax.ajax_response)t=wdi_feed_counter_init.wdi_feed_counter_init;for(var r=t;r<=e;r++)if(0!==jQuery("#wdi_feed_"+r).length){var i=new WDIFeed(window["wdi_feed_"+r]);i.instagram=new WDIInstagram,i.instagram.filterArguments={feed:i},i.instagram.filters=[],i.instagram.addToken(i.feed_row.access_token),wdi_front.access_token=i.feed_row.access_token,i.dataStorageRaw=[],i.dataStorage=[],i.dataStorageList=[],i.allResponseLength=0,i.currentResponseLength=0,i.temproraryUsersData=[],i.removedUsers=0,i.nowLoadingImages=!0,i.imageIndex=0,i.resIndex=0,i.currentPage=1,i.userSortFlags=[],i.customFilterChanged=!1,i.maxConditionalFiltersRequestCount=10,i.instagramRequestCounter=0,i.mediaRequestsDone=!1,i.conditionalFilterBuffer=[],i.stopInfiniteScrollFlag=!1,"masonry"==i.feed_row.feed_type&&(i.displayedData=[]),"pagination"==i.feed_row.feed_display_view?(i.feed_row.resort_after_load_more=0,"image_browser"!=i.feed_row.feed_type?(i.feed_row.load_more_number=parseInt(i.feed_row.pagination_per_page_number),i.feed_row.number_of_photos=(1+parseInt(i.feed_row.pagination_preload_number))*i.feed_row.load_more_number):(i.feed_row.number_of_photos=1+parseInt(i.feed_row.image_browser_preload_number),i.feed_row.load_more_number=parseInt(i.feed_row.image_browser_load_number)),i.freeSpaces=(Math.floor(i.feed_row.pagination_per_page_number/i.feed_row.number_of_columns)+1)*i.feed_row.number_of_columns-i.feed_row.pagination_per_page_number):i.freeSpaces=0,i.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(i),"masonry"==i.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(i),window["wdi_feed_"+r]=i,wdi_front.init(i)}},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 t=[];void 0!==window.wdi_all_tags&&(t=window.wdi_all_tags);for(var r=0;r<e.feed_users.length;r++)"#"===e.feed_users[r].username[0]&&void 0!==e.feed_users[r].tag_id&&(t[e.feed_users[r].tag_id]=e.feed_users[r]);window.wdi_all_tags=t,e.dataCount=e.feed_users.length;var i=wdi_front.getFeedItemResolution(e);e.feedImageResolution=i.image,e.feedVideoResolution=i.video;for(var a=0;a<e.dataCount;a++)wdi_front.instagramRequest(a,e);e.feed_row.number_of_photos>0&&wdi_front.ajaxLoader(e),"1"===e.feed_row.display_header&&wdi_front.show("header",e)},wdi_front.getFeedItemResolution=function(e){var t={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 i=r.attr("wdi-res").split("wdi_col_");if(r.find("#wdi_feed_item_example").remove(),2!==i.length)return t;var a=parseInt(i[1]);if(a<=0)return t;var d=r.width()/a-10,o=t;return d<=150?(o.image="thumbnail",o.video="low_bandwidth"):d>150&&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(e,t){var r=this,i=t.feed_users;"string"==typeof i[e]&&"self"===i[e]?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(i[e].username)?t.instagram.getTagRecentMedia(this.stripHashtag(i[e].username),{success:function(i){void 0!==i.meta&&void 0!==i.meta.error_type&&wdi_front.show_alert(!1,i,t),t.mediaRequestsDone=!0,0!=(i=r.checkMediaResponse(i,t))&&r.saveUserData(i,t.feed_users[e],t)}},null,t.feed_row.hashtag_top_recent):"user"==this.getInputType(i[e].username)&&t.instagram.getUserMedia({user_id:i[e].id,success:function(a){void 0!==a.meta&&void 0!==a.meta.error_type&&(a.wdi_current_feed_name=i[e].username,wdi_front.show_alert(!1,a,t)),t.mediaRequestsDone=!0,0!=(a=r.checkMediaResponse(a,t))&&r.saveUserData(a,t.feed_users[e],t)}})},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,t,r){if(e.username=t.username,e.user_id=t.id,"#"===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)if(r.currentResponseLength<r.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(r))wdi_front.loadMore("initial-keep",r);else if(wdi_front.displayFeed(r),wdi_front.applyFilters(r),!wdi_front.activeUsersCount(r)&&"load_more_btn"==r.feed_row.feed_display_view){var i=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter);i.find(".wdi_load_more").addClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden")}},wdi_front.saveSelfUserData=function(e,t){if(e.user_id="",e.username="",t.usersData.push(e),t.currentResponseLength=wdi_front.getArrayContentLength(t.usersData,"data"),t.allResponseLength+=t.currentResponseLength,t.dataCount==t.usersData.length)if(t.currentResponseLength<t.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(t))wdi_front.loadMore("initial-keep",t);else if(wdi_front.displayFeed(t),wdi_front.applyFilters(t),!wdi_front.activeUsersCount(t)&&"load_more_btn"==t.feed_row.feed_display_view){var r=jQuery("#wdi_feed_"+t.feed_row.wdi_feed_counter);r.find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").addClass("wdi_hidden")}},wdi_front.userHasNoPhoto=function(e,t){var r=0,i=e.usersData;void 0!==t&&(i=t);for(var a=0;a<i.length;a++)void 0===i[a].pagination&&(i[a].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===i[a].pagination.next_max_like_id&&r++:void 0===i[a].pagination.next_max_id&&r++;return r==i.length?1:0},wdi_front.appendRequestHashtag=function(e,t){for(var r=0;r<e.length;r++)e[r].wdi_hashtag=t;return e},wdi_front.displayFeed=function(e,t){if(0==e.customFilterChanged)var r=wdi_front.feedSort(e,t);var i=e.customFilterChanged;if(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&&!i&&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(e){jQuery("#wdi_feed_"+e.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"==e.feed_row.liked_feed)return;for(var t=0;t<e.usersData.length;t++)e.usersData[t].username==jQuery(this).parent().parent().find("h3").text()&&0!=e.usersData[t].data.length&&jQuery(this).attr("src",e.usersData[t].data[0].images.thumbnail.url)}})},wdi_front.masonryDisplayFeedItems=function(e,t){var r=[],i=[];if(0!=jQuery("#wdi_feed_"+t.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){jQuery("#wdi_feed_"+t.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){1==t.feed_row.resort_after_load_more&&(jQuery(this).html(""),t.imageIndex=0),1==t.customFilterChanged&&(jQuery(this).html(""),t.imageIndex=0),"pagination"==t.feed_row.feed_display_view?r.push(0):r.push(jQuery(this).height()),i.push(jQuery(this))}),1==t.customFilterChanged&&(t.customFilterChanged=!1);for(var a=0;a<e.length;a++)if("object"!=typeof e[a].videos||null!=e[a].videos.standard_resolution){if(t.displayedData.push(e[a]),"image"==e[a].type)var d=wdi_front.getPhotoTemplate(t);else if(e[a].hasOwnProperty("videos")||"video"==e[a].type)d=wdi_front.getVideoTemplate(t);else d=wdi_front.getSliderTemplate(t);var o=e[a],n=d(wdi_front.createObject(o,t)),s=wdi_front.array_min(r),_=wdi_front.getImageResolution(e[a]);i[s.index].html(i[s.index].html()+n),r[s.index]+=i[s.index].width()*_,t.imageIndex++,"pagination"==t.feed_row.feed_display_view&&((a+1)%t.feed_row.pagination_per_page_number==0?t.resIndex+=t.freeSpaces+1:t.resIndex++)}t.wdi_loadedImages=0;var f=!1;t.wdi_load_count=a;var l=t.feed_row.wdi_feed_counter;jQuery("#wdi_feed_"+l+" img.wdi_img").on("load",function(){t.wdi_loadedImages++,w(),!1===f&&(wdi_responsive.columnControl(t,1),f=!0)});w(),1==t.paginatorNextFlag&&wdi_front.updatePagination(t,"next"),t.infiniteScrollFlag=!1}function w(){t.wdi_load_count===t.wdi_loadedImages&&0!=t.wdi_loadedImages&&(t.loadedImages=0,t.wdi_load_count=0,wdi_front.allImagesLoaded(t))}},wdi_front.getImageResolution=function(e){var t=e.images.standard_resolution.width;return e.images.standard_resolution.height/t},wdi_front.getDataLength=function(e,t){var r=0;if(void 0===t)for(var i=0;i<e.dataStorage.length;i++)r+=e.dataStorage[i].length;else for(i=0;i<t.length;i++)r+=t[i].length;return r},wdi_front.getArrayContentLength=function(e,t){for(var r=0,i=0;i<e.length;i++)"finished"!=e[i].finished&&(r+=e[i][t].length);return r},wdi_front.displayFeedItems=function(e,t){if(0!=jQuery("#wdi_feed_"+t.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){var r=t.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+r+" .wdi_feed_wrapper");"1"===t.feed_row.resort_after_load_more&&(i.html(""),t.imageIndex=0),1==t.customFilterChanged&&(i.html(""),t.imageIndex=0,t.customFilterChanged=!1);wdi_front.getImgCount(t),e.length;if("pagination"==t.feed_row.feed_display_view){var a=t.feed_row.load_more_number;"image_browser"==t.feed_row.feed_type&&(a=1),(jQuery("#wdi_feed_"+t.feed_row.wdi_feed_counter+' [wdi_page="'+(t.currentPage-1)+'"]').length<a||0==e.length)&&(t.currentPage=--t.currentPage<=1?1:t.currentPage)}for(var d=0;d<e.length;d++)if("object"!=typeof e[d].videos||null!=e[d].videos.standard_resolution){if("image"==e[d].type)var o=wdi_front.getPhotoTemplate(t);else if(e[d].hasOwnProperty("videos"))o=wdi_front.getVideoTemplate(t);else o=wdi_front.getSliderTemplate(t);var n=e[d],s=o(wdi_front.createObject(n,t));i.html(i.html()+s),t.imageIndex++,"pagination"==t.feed_row.feed_display_view&&((d+1)%t.feed_row.pagination_per_page_number==0?t.resIndex+=t.freeSpaces+1:t.resIndex++)}t.wdi_loadedImages=0;var _=!1;t.wdi_load_count=d;r=t.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+r+" img.wdi_img").on("load",function(){t.wdi_loadedImages++,t.wdi_load_count===t.wdi_loadedImages&&0!=t.wdi_loadedImages&&(t.loadedImages=0,t.wdi_load_count=0,wdi_front.allImagesLoaded(t)),!1===_&&(wdi_responsive.columnControl(t,1),_=!0)});1==t.paginatorNextFlag&&wdi_front.updatePagination(t,"next"),t.infiniteScrollFlag=!1}},wdi_front.checkFeedFinished=function(e){for(var t=0;t<e.usersData.length;t++)if(void 0===e.usersData[t].finished)return!1;return!0},wdi_front.sortingOperator=function(e,t){var r;switch(e){case"date":switch(t){case"asc":r=function(e,t){return e.created_time>t.created_time?1:-1};break;case"desc":r=function(e,t){return e.created_time>t.created_time?-1:1}}break;case"likes":switch(t){case"asc":r=function(e,t){return e.likes.count<t.likes.count?-1:1};break;case"desc":r=function(e,t){return e.likes.count<t.likes.count?1:-1}}break;case"comments":switch(t){case"asc":r=function(e,t){return e.comments.count<t.comments.count?-1:1};break;case"desc":r=function(e,t){return e.comments.count<t.comments.count?1:-1}}break;case"random":r=function(e,t){return Math.random()>.5?1:-1}}return r},wdi_front.feedSort=function(e,t){var r=e.feed_row.sort_images_by,i=e.feed_row.display_order;"1"===e.feed_row.resort_after_load_more?e.data=e.data.concat(wdi_front.smartPicker(e,t)):e.data=wdi_front.smartPicker(e,t);var a=wdi_front.sortingOperator(r,i);return e.data.sort(a),e.data},wdi_front.smartPicker=function(e,t){var r=[],i=0,a=[],d=Math.ceil(e.feed_row.number_of_photos/e.usersData.length),o=parseInt(e.feed_row.number_of_photos),n=0;""!=t&&void 0!==t&&null!=t&&(o=parseInt(t),d=Math.ceil(o/wdi_front.activeUsersCount(e)));e.storeRawData(e.usersData,"dataStorageRaw");for(var s=e.dataStorageRaw.sort(function(e,t){return e.length()>t.length()?1:-1}),_=e.usersData.sort(function(e,t){return e.data.length>t.data.length?1:-1}),f=0;f<_.length;f++)if(n+=d,s[f].length()<=n)n-=s[f].length(),r.push(s[f].getData(s[f].length())),i+=r[r.length-1].length;else{i+n>o&&(n=o-i);var l=[];!1===e.auto_trigger?l=l.concat(s[f].getData(n)):l.length+wdi_front.getDataLength(e)+wdi_front.getDataLength(e,r)<e.feed_row.number_of_photos&&(l=l.concat(s[f].getData(n))),n=0,i+=l.length,r.push(l)}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++)a=a.concat(r[f]);return a},wdi_front.createObject=function(e,t){var r=null!=e.caption?e.caption.text:" ",i="";if("video"==e.type&&e.videos[t.feedVideoResolution]&&null!=e.videos[t.feedVideoResolution].url&&(i=e.hasOwnProperty("videos")?e.videos[t.feedVideoResolution].url:""),void 0===e.images[t.feedImageResolution])var a=wdi_url.plugin_url+"images/missing.png";else a=e.images[t.feedImageResolution].url;var d=t.imageIndex,o="square",n=e.images.standard_resolution.height,s=e.images.standard_resolution.width;n>s?o="portrait":n<s&&(o="landscape");var _=e.user.username;return""===_&&(_="no_user"),{id:e.id,caption:wdi_front.escape_tags(r),image_url:a,likes:e.likes.count,comments:e.comments.count,wdi_index:d,wdi_res_index:t.resIndex,wdi_media_user:_,link:e.link,video_url:i,wdi_username:_,wdi_shape:o}},wdi_front.setPage=function(e){var t=e.feed_row.feed_display_view,r=e.feed_row.feed_type;if("pagination"!=t)return"";var i=e.imageIndex;if("image_browser"==r)var a=1;else a=Math.abs(e.feed_row.pagination_per_page_number);return e.paginator=Math.ceil((i+1)/a),e.paginator},wdi_front.getPhotoTemplate=function(e){var t=wdi_front.setPage(e),r="",i="",a="",d="",o="tenweb-i-arrows-out";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o=""),""!=t?(i='wdi_page="'+t+'"',sourceAttr="src"):sourceAttr="src",""!=t&&1!=t&&(r="wdi_hidden"),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(r+=" wdi_full_caption");switch("blog_style"!==e.feed_row.feed_type&&("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":a="",d="wdi_cursor_off wdi_hover_off",o=""}var n='<div class="wdi_feed_item '+r+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+i+' 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+'" ><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 n+="</div>",_.template(n)},wdi_front.getSliderTemplate=function(e){var t=wdi_front.setPage(e),r="",i="",a="",d="",o="tenweb-i-clone";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o=""),""!=t?(i='wdi_page="'+t+'"',sourceAttr="src"):sourceAttr="src",""!=t&&1!=t&&(r="wdi_hidden"),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(r+=" wdi_full_caption");switch("blog_style"!==e.feed_row.feed_type&&("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":a="",d="wdi_cursor_off wdi_hover_off",o=""}var n='<div class="wdi_feed_item '+r+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+i+' 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+'" ><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 n+="</div>",_.template(n)},wdi_front.replaceToVideo=function(e,t,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="'+t+'"] .wdi_photo_wrap_inner').html(overlayHtml),jQuery("#wdi_feed_"+r+' [wdi_index="'+t+'"] .wdi_photo_wrap_inner video').get(0).play()},wdi_front.getVideoTemplate=function(e){var t,r=wdi_front.setPage(e),i="",a="",d="tenweb-i-play",o="",n="";""!=r?(a='wdi_page="'+r+'"',t="src"):t="src",""!=r&&1!=r&&(i="wdi_hidden"),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(i+=" wdi_full_caption");switch("blog_style"!==e.feed_row.feed_type&&("masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":o="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":o="onclick=\"window.open ('<%= link%>','_blank')\"",n="wdi_hover_off",d="tenweb-i-play";break;case"custom_redirect":o="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",n="wdi_hover_off",d="";break;case"none":n="wdi_cursor_off wdi_hover_off",d="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",n="",d="tenweb-i-play")}var s='<div class="wdi_feed_item '+i+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+a+' 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\" "+t+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+n+'" '+o+'><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 s+="</div>",_.template(s)},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))},wdi_front.paginationFirstPage=function(e,t){if(1!=t.paginator&&1!=t.currentPage){var r=t.currentPage;t.currentPage=1,wdi_front.updatePagination(t,"custom",r),e.parent().find("#wdi_last_page").removeClass("wdi_disabled"),e.addClass("wdi_disabled")}else e.addClass("wdi_disabled")},wdi_front.paginationLastPage=function(e,t){if(1!=t.paginator&&t.currentPage!=t.paginator){var r=t.currentPage;t.currentPage=t.paginator,wdi_front.updatePagination(t,"custom",r),e.addClass("wdi_disabled"),e.parent().find("#wdi_first_page").removeClass("wdi_disabled")}},wdi_front.paginatorNext=function(e,t){var r=e.parent().find("#wdi_last_page"),i=e.parent().find("#wdi_first_page");if(t.paginatorNextFlag=!0,t.paginator!=t.currentPage||wdi_front.checkFeedFinished(t))t.paginator>t.currentPage&&(t.currentPage++,wdi_front.updatePagination(t,"next"),t.paginator>t.currentPage?r.removeClass("wdi_disabled"):r.addClass("wdi_disabled"));else{t.currentPage++;var a=t.feed_row.number_of_photos;wdi_front.loadMore(e,t,a),r.addClass("wdi_disabled")}i.removeClass("wdi_disabled")},wdi_front.paginatorPrev=function(e,t){var r=e.parent().find("#wdi_last_page"),i=e.parent().find("#wdi_first_page");1!=t.currentPage?(t.currentPage--,wdi_front.updatePagination(t,"prev"),r.removeClass("wdi_disabled"),1==t.currentPage&&i.addClass("wdi_disabled")):i.addClass("wdi_disabled")},wdi_front.updatePagination=function(e,t,r){var i="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(i+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),t){case"next":r=e.currentPage-1;jQuery(i+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(i+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":r=e.currentPage+1;jQuery(i+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(i+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(r=r)!=e.currentPage&&(jQuery(i+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(i+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(i+" .wdi_feed_wrapper").css("height","auto"),jQuery(i+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,t){var r=0;if(""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e)var i=window[e.parent().parent().parent().parent().attr("id")];if(void 0!==t)i=t;for(var a=0,d=0,o=0;o<i.userSortFlags.length;o++)if(!0===i.userSortFlags[o].flag){a++;for(var n=0;n<i.usersData.length;n++)i.userSortFlags[o].id===i.usersData[n].user_id&&"finished"===i.usersData[n].finished&&d++}if(a!==d||0==a){i.auto_trigger=""===e,wdi_front.ajaxLoader(i),"masonry"===i.feed_row.feed_type&&"pagination"==i.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<i.usersData.length;o++)"finished"===i.usersData[o].finished&&r++;r===i.usersData.length&&(wdi_front.allImagesLoaded(i),jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_load_more").remove());var s=i.usersData;i.loadMoreDataCount=i.feed_users.length;for(o=0;o<s.length;o++){var _=s[o].pagination,f={user_id:s[o].user_id,username:s[o].username};if(""!=_.next_url&&null!=_.next_url&&void 0!==_.next_url){var l=_.next_url;wdi_front.loadMoreRequest(f,l,i,e)}else"initial-keep"==e&&(i.temproraryUsersData[o]=i.usersData[o]),i.loadMoreDataCount--,wdi_front.checkForLoadMoreDone(i,e)}}},wdi_front.loadMoreRequest=function(e,t,r,i){if(r.mediaRequestsDone){r.usersData;var a="",d=function(t){if(""===t||void 0===t||null==t)return a=wdi_front_messages.network_error,r.loadMoreDataCount--,void wdi_front.show_alert(a,t,r);if(void 0!==t.meta&&void 0!==t.meta.error_type&&wdi_front.show_alert(!1,t,r),void 0!==t.meta&&void 0!==t.meta.code&&200!=t.meta.code)return a=t.meta.error_message,r.loadMoreDataCount--,void wdi_front.show_alert(a,t,r);t.user_id=e.user_id,t.username=e.username;for(var d=0;d<r.usersData.length;d++)t.user_id===r.usersData[d].user_id&&("#"===t.user_id[0]&&(t.data=wdi_front.appendRequestHashtag(t.data,t.user_id)),"initial-keep"==i&&(r.temproraryUsersData[d]=r.usersData[d]),r.usersData[d]=t,r.loadMoreDataCount--);wdi_front.checkForLoadMoreDone(r,i)};"#"!==e.username[0]?r.instagram.requestByUrl(t,{success:d}):r.instagram.getTagRecentMedia(e.username,{success:d},t,r.feed_row.hashtag_top_recent)}},wdi_front.checkForLoadMoreDone=function(e,t){var r=e.feed_row.load_more_number,i=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"==t&&(t="initial"),"initial"==t)a<i&&!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<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 t=0,r=0;r<e.dataStorageRaw.length;r++)0==e.dataStorageRaw[r].length()&&1==e.dataStorageRaw[r].locked&&t++;return t==e.dataStorageRaw.length},wdi_front.mergeData=function(e,t){for(var r=0;r<t.length;r++)if(void 0!==e[r]){if("finished"==t[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(t[r].data),e[r].pagination=t[r].pagination,e[r].user_id=t[r].user_id,e[r].username=t[r].username,e[r].meta=t[r].meta}else e.push(t[r]);return e},wdi_front.brokenImageHandler=function(e){var t=e.src.split("/p/");if(void 0!==t[0]&&void 0!==t[1]&&"https://www.instagram.com"!==t[0]){var r=wdi_baseName(t[0])+"/p/"+t[1];e.src=r}else e.src=wdi_url.plugin_url+"images/missing.png";return e.onerror="",!0},wdi_front.ajaxLoader=function(e){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").addClass("wdi_hidden"),r.find(".wdi_spinner").removeClass("wdi_hidden"))},wdi_front.allImagesLoaded=function(e){var t=wdi_front.getDataLength(e);e.mediaRequestsDone||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia"),0!=t||!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,i=jQuery("#wdi_feed_"+r);"load_more_btn"==e.feed_row.feed_display_view&&(i.find(".wdi_load_more").removeClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden")),i.trigger("wdi_feed_loaded")},wdi_front.show=function(e,t){var r,i,a,d=t.feed_row.wdi_feed_counter,o=jQuery("#wdi_feed_"+d+" .wdi_feed_container");switch(e){case"header":r={feed_thumb:t.feed_row.feed_thumb,feed_name:t.feed_row.feed_name},i=wdi_front.getHeaderTemplate()(r),a=o.find(".wdi_feed_header").html(),o.find(".wdi_feed_header").html(a+i)}},wdi_front.getUserTemplate=function(e,t){var r,i,a=e.dataCount;switch(t[0]){case"#":r="//instagram.com/explore/tags/"+t.substr(1,t.length);break;default:r="//instagram.com/"+t}i="onclick='"+('window.open("'+r+'","_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 a>1&&(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 "+i+"><%= user_name%></h3>","#"!==t[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&&"#"!==t[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,t){var r=window["wdi_feed_"+t];if(!(r.dataCount<2)&&0==r.nowLoadingImages){var i=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');i.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg"),i.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col"),i.find(".wdi_media_info").toggleClass("wdi_filter_active_col"),i.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col"),r.customFilterChanged=!0,0==r.userSortFlags[e].flag?r.userSortFlags[e].flag=!0:r.userSortFlags[e].flag=!1;for(var a=0,d=0;d<r.userSortFlags.length;d++)1==r.userSortFlags[d].flag&&a++;"pagination"==r.feed_row.feed_display_view&&(r.resIndex=0),0!=a?(wdi_front.filterData(r),wdi_front.displayFeed(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 t=e.userSortFlags;e.customFilteredData=[];for(var r=0;r<e.dataStorageList.length;r++)for(var i=0;i<t.length;i++)(void 0!==e.dataStorageList[r].user.id&&e.dataStorageList[r].user.id==t[i].id||e.dataStorageList[r].wdi_hashtag==t[i].name)&&1==t[i].flag&&e.customFilteredData.push(e.dataStorageList[r])},wdi_front.applyFilters=function(e){for(var t=0;t<e.userSortFlags.length;t++)if(1==e.userSortFlags[t].flag){jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+'[user_index="'+t+'"]');wdi_front.addFilter(t,e.feed_row.wdi_feed_counter),wdi_front.addFilter(t,e.feed_row.wdi_feed_counter)}},wdi_front.getImgCount=function(e){for(var t=e.dataStorage,r=0,i=0;i<t.length;i++)r+=t[i].length;return r},wdi_front.parseLighboxData=function(e,t){var r=e.dataStorage,i=e.feed_row.sort_images_by,a=e.feed_row.display_order,d=wdi_front.sortingOperator(i,a),o=[],n=[],s={};if(1==t)o=e.customFilteredData;else{for(var _=0;_<r.length;_++)for(var f=0;f<r[_].length;f++)o.push(r[_][f]);o.sort(d)}for(_=0;_<o.length;_++)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:o[_].link+"media/?size=t",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 t=parseInt(e),r=new Date(0);r.setUTCSeconds(t);var i=r.getFullYear()+"-"+r.getMonth()+"-"+r.getDate();return i+=" "+r.getHours()+":"+r.getMinutes()},wdi_front.getDescription=function(e){return e=e.replace(/\r?\n|\r/g," ")},wdi_front.getFileName=function(e){var t=e.link;if("video"===e.type&&e.hasOwnProperty("videos")&&null!=e.videos.standard_resolution)return e.videos.standard_resolution.url;var r=t.split("/");return r[r.length-2]},wdi_front.getFileType=function(e){return"VIDEO"==e.media_type&&e.hasOwnProperty("videos")?"EMBED_OEMBED_INSTAGRAM_VIDEO":"EMBED_OEMBED_INSTAGRAM_IMAGE"},wdi_front.array_max=function(e){for(var t=e[0],r=0,i=1;i<e.length;i++)t<e[i]&&(t=e[i],r=i);return{value:t,index:r}},wdi_front.array_min=function(e){for(var t=e[0],r=0,i=1;i<e.length;i++)t>e[i]&&(t=e[i],r=i);return{value:t,index:r}},wdi_front.activeUsersCount=function(e){for(var t=0,r=0;r<e.usersData.length;r++)"finished"!=e.usersData[r].finished&&t++;return t},wdi_front.checkMediaResponse=function(e,t){return""==e||void 0===e||null==e?(errorMessage=wdi_front_messages.connection_error,wdi_front.show_alert(errorMessage,e,t),!1):""!=e&&void 0!==e&&null!=e&&200!=e.meta.code?(errorMessage=e.meta.error_message,wdi_front.show_alert(errorMessage,e,t),!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,t){var r=!1,i=!1,a=t.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),d=new RegExp("(?:^|\\s)"+a+"(?:^|\\s)"),o=new RegExp("(?:^|\\s)"+a,"g");for(null!=d.exec(e)&&(r=!0);null!=(match=o.exec(e));)i=!0;return 1==r||1==i},wdi_front.replaceNewLines=function(e){var t,r=[];for(e=e.replace(/\r?\n|\r/g,"vUkCJvN2ps3t"),t=new RegExp("vUkCJvN2ps3t","g");null!=(match=t.exec(e));)r.push(match.index);for(var i=e.split("vUkCJvN2ps3t"),a=0,d=0;d<i.length;d++)""==i[d]?a++:a=0,a>0&&(i.splice(d,1),a--,d--);return e=i.join(" ")},wdi_front.isEmptyObject=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0};var WDIFeed=function(e){this.data=e.data,this.dataCount=e.dataCount,this.feed_row=e.feed_row,this.usersData=e.usersData,_this=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,t){return e},WDIFeed.prototype.applyANDLogic=function(e,t){for(var r=0;r<t.length;r++)e=this.filterResponse(e,t[r]);return e},WDIFeed.prototype.applyORLogic=function(e,t){for(var r,i,a=[],d=[],o=0;o<t.length;o++)r=this.filterResponse(e,t[o]),a=a.concat(r.data),r={};for(o=0;o<a.length;o++)i=a[o],this.mediaExists(i,d)||this.mediaExists(i,this.dataStorageList)||d.push(i);return{data:d,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.applyNORLogic=function(e,t){for(var r=e,i=this.applyORLogic(e,t,this),a=[],d=0;d<r.data.length;d++)this.mediaExists(r.data[d],i.data)||a.push(r.data[d]);return{data:a,meta:r.meta,pagination:r.pagination}},WDIFeed.prototype.mediaExists=function(e,t){for(var r=0;r<t.length;r++)if(e.id==t[r].id)return!0;return!1},WDIFeed.prototype.filterResponse=function(e,t){switch(t.filter_type){case"hashtag":return this.filterByHashtag(e,t);case"username":return this.filterByUsername(e,t);case"mention":return this.filterByMention(e,t);case"description":return this.filterByDescription(e,t);case"location":return this.filterByLocation(e,t);case"url":return this.filterByUrl(e,t)}},WDIFeed.prototype.filterByHashtag=function(e,t){for(var r,i=[],a=0;a<e.data.length;a++)if(void 0!==(r=e.data[a]).tags)for(var d=0;d<r.tags.length;d++){tag=r.tags[d];var o=tag.toLowerCase(),n=t.filter_by.toLowerCase();o.trim()==n.trim()&&i.push(r)}return{data:i,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByUsername=function(e,t){for(var r,i=[],a=0;a<e.data.length;a++)(r=e.data[a]).user.username.toLowerCase()==t.filter_by.toLowerCase()&&i.push(r);return{data:i,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByMention=function(e,t){for(var r,i=[],a=0;a<e.data.length;a++)null!==(r=e.data[a]).caption&&-1!=r.caption.text.toLowerCase().indexOf("@"+t.filter_by.toLowerCase())&&i.push(r);return{data:i,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByDescription=function(e,t){for(var r,i,a=[],d=0;d<e.data.length;d++)if(null!==(r=e.data[d]).caption){i=r.caption.text.toLowerCase(),i=wdi_front.replaceNewLines(i);var o=t.filter_by.toLowerCase();wdi_front.regexpTestCaption(i,o)&&a.push(r)}return{data:a,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByLocation=function(e,t){for(var r,i=[],a=0;a<e.data.length;a++)null!==(r=e.data[a]).location&&r.location.id==t.filter_by&&i.push(r);return{data:i,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByUrl=function(e,t){var r,i=[];t.filter_by=this.getIdFromUrl(t.filter_by);for(var a=0;a<e.data.length;a++)null!==(r=e.data[a]).link&&this.getIdFromUrl(r.link)==t.filter_by&&i.push(r);return{data:i,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.getIdFromUrl=function(e){for(var t=e.split("/"),r=!1,i=0;i<t.length;i++)if("p"==t[i]&&void 0!==t[i+1]){r=t[i+1];break}return r},WDIFeed.prototype.avoidDuplicateMedia=function(e){var t=e.data,r=[];void 0===t&&(t=[]);for(var i=0;i<t.length;i++)this.mediaExists(t[i],this.dataStorageList)||this.mediaExists(t[i],r)||this.mediaExists(t[i],this.conditionalFilterBuffer)||r.push(t[i]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(r),{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,t){var r=this;if("object"==typeof this[t]&&"number"==typeof this[t].length)for(var i=0;i<e.length;i++){var a="";wdi_front.isHashtag(e[i].user_id)?void 0!==e[i].pagination.cursors&&(a=e[i].pagination.cursors.after):"liked"==r.feed_row.liked_feed?void 0===(a=e[i].pagination.next_max_like_id)&&(a=""):(null==e[i].pagination&&(e[i].pagination=[]),void 0===(a=e[i].pagination.next_max_id)&&(a="")),void 0===this[t][i]?this[t].push({data:e[i].data,index:0,locked:!1,hash_id:a,usersDataFinished:!1,userId:e[i].user_id,length:function(){return this.data.length-this.index},getData:function(e){var t=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 i=0;i<r.usersData.length;i++)if(r.usersData[i].user_id==this.userId){r.usersData[i].finished="finished",this.usersDataFinished=!0;break}return t}}):0==this[t][i].locked&&(a!=this[t][i].hash_id?(this[t][i].data=this[t][i].data.concat(e[i].data),this[t][i].hash_id=a):this[t][i].locked=!0)}},wdi_front.updateUsersIfNecessary=function(e){for(var t=e.feed_users,r=!1,i=0;i<t.length;i++)"#"!=t[i].username.substr(0,1)?""!=t[i].id&&"username"!=t[i].id||(r=!0,e.instagram.searchForUsersByName(t[i].username,{success:function(r){if(void 0!==r.meta&&void 0!==r.meta.error_type&&wdi_front.show_alert(!1,r,e),200==r.meta.code&&r.data.length>0){for(var i=!1,a=0;a<r.data.length;a++)if(r.data[a].username==r.args.username){i=!0;break}if(i)for(var d=0;d<t.length;d++)r.data[a].username==t[d].username&&(t[d].id=r.data[a].id)}for(var o=!1,n=0;n<t.length;n++)if(""==t[n].id||"username"==t[n].id){o=!0;break}o||(e.feed_row.feed_users=JSON.stringify(t),wdi_front.init(e))},username:t[i].username})):t[i].id=t[i].username;return r},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"}),wdi_front.detectEvent=function(){return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())?"touchend":"click"};var wdi_error_show=!1,wdi_error_init=!1;function wdi_baseName(e){var t=e.substr(e.lastIndexOf("/"));return e.replace(t,"")}wdi_front.escape_tags=function(e){return void 0===e&&(e=""),e=e.toString().replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")},wdi_front.show_alert=function(e,t,r){if(r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter),400===t.meta.code&&"APINotAllowedError"===t.meta.error_type){if(void 0!==t.wdi_current_feed_name){var i=t.wdi_current_feed_name,a=r.find(".wdi_private_feed_names");void 0===a.attr("wdi_first_private_user")?a.attr("wdi_first_private_user",1):i=", "+i,a.append(i),r.find(".wdi_private_feed_error").removeClass("wdi_hidden")}r.find(".wdi_spinner").remove()}if(void 0!==r&&"APINotAllowedError"!=t.meta.error_type){r.find(".wdi_spinner").remove(),wdi_error_show=!0;var d=r.find(".wdi_js_error"),o=r.find(".wdi_token_error");0!=t&&null!=typeof t.meta&&"OAuthAccessTokenException"===t.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,t=0;if(void 0!==wdi_ajax.ajax_response)t=wdi_feed_counter_init.wdi_feed_counter_init;for(var r=t;r<=e;r++)if(0!==jQuery("#wdi_feed_"+r).length){var i=new WDIFeed(window["wdi_feed_"+r]);i.instagram=new WDIInstagram,i.instagram.filterArguments={feed:i},i.instagram.filters=[],i.instagram.addToken(i.feed_row.access_token),wdi_front.access_token=i.feed_row.access_token,i.dataStorageRaw=[],i.dataStorage=[],i.dataStorageList=[],i.allResponseLength=0,i.currentResponseLength=0,i.temproraryUsersData=[],i.removedUsers=0,i.nowLoadingImages=!0,i.imageIndex=0,i.resIndex=0,i.currentPage=1,i.userSortFlags=[],i.customFilterChanged=!1,i.maxConditionalFiltersRequestCount=10,i.instagramRequestCounter=0,i.mediaRequestsDone=!1,i.conditionalFilterBuffer=[],i.stopInfiniteScrollFlag=!1,"masonry"==i.feed_row.feed_type&&(i.displayedData=[]),"pagination"==i.feed_row.feed_display_view?(i.feed_row.resort_after_load_more=0,"image_browser"!=i.feed_row.feed_type?(i.feed_row.load_more_number=parseInt(i.feed_row.pagination_per_page_number),i.feed_row.number_of_photos=(1+parseInt(i.feed_row.pagination_preload_number))*i.feed_row.load_more_number):(i.feed_row.number_of_photos=1+parseInt(i.feed_row.image_browser_preload_number),i.feed_row.load_more_number=parseInt(i.feed_row.image_browser_load_number)),i.freeSpaces=(Math.floor(i.feed_row.pagination_per_page_number/i.feed_row.number_of_columns)+1)*i.feed_row.number_of_columns-i.feed_row.pagination_per_page_number):i.freeSpaces=0,i.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(i),"masonry"==i.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(i),window["wdi_feed_"+r]=i,wdi_front.init(i)}},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 t=[];void 0!==window.wdi_all_tags&&(t=window.wdi_all_tags);for(var r=0;r<e.feed_users.length;r++)"#"===e.feed_users[r].username[0]&&void 0!==e.feed_users[r].tag_id&&(t[e.feed_users[r].tag_id]=e.feed_users[r]);window.wdi_all_tags=t,e.dataCount=e.feed_users.length;var i=wdi_front.getFeedItemResolution(e);e.feedImageResolution=i.image,e.feedVideoResolution=i.video;for(var a=0;a<e.dataCount;a++)wdi_front.instagramRequest(a,e);e.feed_row.number_of_photos>0&&wdi_front.ajaxLoader(e),"1"===e.feed_row.display_header&&wdi_front.show("header",e)},wdi_front.getFeedItemResolution=function(e){var t={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 i=r.attr("wdi-res").split("wdi_col_");if(r.find("#wdi_feed_item_example").remove(),2!==i.length)return t;var a=parseInt(i[1]);if(a<=0)return t;var d=r.width()/a-10,o=t;return d<=150?(o.image="thumbnail",o.video="low_bandwidth"):d>150&&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(e,t){var r=this,i=t.feed_users;"string"==typeof i[e]&&"self"===i[e]?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(i[e].username)?t.instagram.getTagRecentMedia(this.stripHashtag(i[e].username),{success:function(i){void 0!==i.meta&&void 0!==i.meta.error_type&&wdi_front.show_alert(!1,i,t),t.mediaRequestsDone=!0,0!=(i=r.checkMediaResponse(i,t))&&r.saveUserData(i,t.feed_users[e],t)}},null,t.feed_row.hashtag_top_recent):"user"==this.getInputType(i[e].username)&&t.instagram.getUserMedia({user_id:i[e].id,success:function(a){void 0!==a.meta&&void 0!==a.meta.error_type&&(a.wdi_current_feed_name=i[e].username,wdi_front.show_alert(!1,a,t)),t.mediaRequestsDone=!0,0!=(a=r.checkMediaResponse(a,t))&&r.saveUserData(a,t.feed_users[e],t)}})},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,t,r){if(e.username=t.username,e.user_id=t.id,"#"===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)if(r.currentResponseLength<r.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(r))wdi_front.loadMore("initial-keep",r);else if(wdi_front.displayFeed(r),wdi_front.applyFilters(r),!wdi_front.activeUsersCount(r)&&"load_more_btn"==r.feed_row.feed_display_view){var i=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter);i.find(".wdi_load_more").addClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden")}},wdi_front.saveSelfUserData=function(e,t){if(e.user_id="",e.username="",t.usersData.push(e),t.currentResponseLength=wdi_front.getArrayContentLength(t.usersData,"data"),t.allResponseLength+=t.currentResponseLength,t.dataCount==t.usersData.length)if(t.currentResponseLength<t.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(t))wdi_front.loadMore("initial-keep",t);else if(wdi_front.displayFeed(t),wdi_front.applyFilters(t),!wdi_front.activeUsersCount(t)&&"load_more_btn"==t.feed_row.feed_display_view){var r=jQuery("#wdi_feed_"+t.feed_row.wdi_feed_counter);r.find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").addClass("wdi_hidden")}},wdi_front.userHasNoPhoto=function(e,t){var r=0,i=e.usersData;void 0!==t&&(i=t);for(var a=0;a<i.length;a++)void 0===i[a].pagination&&(i[a].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===i[a].pagination.next_max_like_id&&r++:void 0===i[a].pagination.next_max_id&&r++;return r==i.length?1:0},wdi_front.appendRequestHashtag=function(e,t){for(var r=0;r<e.length;r++)e[r].wdi_hashtag=t;return e},wdi_front.displayFeed=function(e,t){if(0==e.customFilterChanged)var r=wdi_front.feedSort(e,t);var i=e.customFilterChanged;if(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&&!i&&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(e){jQuery("#wdi_feed_"+e.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"==e.feed_row.liked_feed)return;for(var t=0;t<e.usersData.length;t++)e.usersData[t].username==jQuery(this).parent().parent().find("h3").text()&&0!=e.usersData[t].data.length&&jQuery(this).attr("src",e.usersData[t].data[0].images.thumbnail.url)}})},wdi_front.masonryDisplayFeedItems=function(e,t){var r=[],i=[];if(0!=jQuery("#wdi_feed_"+t.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){jQuery("#wdi_feed_"+t.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){1==t.feed_row.resort_after_load_more&&(jQuery(this).html(""),t.imageIndex=0),1==t.customFilterChanged&&(jQuery(this).html(""),t.imageIndex=0),"pagination"==t.feed_row.feed_display_view?r.push(0):r.push(jQuery(this).height()),i.push(jQuery(this))}),1==t.customFilterChanged&&(t.customFilterChanged=!1);for(var a=0;a<e.length;a++)if("object"!=typeof e[a].videos||null!=e[a].videos.standard_resolution){if(t.displayedData.push(e[a]),"image"==e[a].type)var d=wdi_front.getPhotoTemplate(t);else if(e[a].hasOwnProperty("videos")||"video"==e[a].type)d=wdi_front.getVideoTemplate(t);else d=wdi_front.getSliderTemplate(t);var o=e[a],n=d(wdi_front.createObject(o,t)),s=wdi_front.array_min(r),_=wdi_front.getImageResolution(e[a]);i[s.index].html(i[s.index].html()+n),r[s.index]+=i[s.index].width()*_,t.imageIndex++,"pagination"==t.feed_row.feed_display_view&&((a+1)%t.feed_row.pagination_per_page_number==0?t.resIndex+=t.freeSpaces+1:t.resIndex++)}t.wdi_loadedImages=0;var f=!1;t.wdi_load_count=a;var l=t.feed_row.wdi_feed_counter;jQuery("#wdi_feed_"+l+" img.wdi_img").on("load",function(){t.wdi_loadedImages++,w(),!1===f&&(wdi_responsive.columnControl(t,1),f=!0)});w(),1==t.paginatorNextFlag&&wdi_front.updatePagination(t,"next"),t.infiniteScrollFlag=!1}function w(){t.wdi_load_count===t.wdi_loadedImages&&0!=t.wdi_loadedImages&&(t.loadedImages=0,t.wdi_load_count=0,wdi_front.allImagesLoaded(t))}},wdi_front.getImageResolution=function(e){var t=e.images.standard_resolution.width;return e.images.standard_resolution.height/t},wdi_front.getDataLength=function(e,t){var r=0;if(void 0===t)for(var i=0;i<e.dataStorage.length;i++)r+=e.dataStorage[i].length;else for(i=0;i<t.length;i++)r+=t[i].length;return r},wdi_front.getArrayContentLength=function(e,t){for(var r=0,i=0;i<e.length;i++)"finished"!=e[i].finished&&(r+=e[i][t].length);return r},wdi_front.displayFeedItems=function(e,t){if(0!=jQuery("#wdi_feed_"+t.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){var r=t.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+r+" .wdi_feed_wrapper");"1"===t.feed_row.resort_after_load_more&&(i.html(""),t.imageIndex=0),1==t.customFilterChanged&&(i.html(""),t.imageIndex=0,t.customFilterChanged=!1);wdi_front.getImgCount(t),e.length;if("pagination"==t.feed_row.feed_display_view){var a=t.feed_row.load_more_number;"image_browser"==t.feed_row.feed_type&&(a=1),(jQuery("#wdi_feed_"+t.feed_row.wdi_feed_counter+' [wdi_page="'+(t.currentPage-1)+'"]').length<a||0==e.length)&&(t.currentPage=--t.currentPage<=1?1:t.currentPage)}for(var d=0;d<e.length;d++)if("object"!=typeof e[d].videos||null!=e[d].videos.standard_resolution){if("image"==e[d].type)var o=wdi_front.getPhotoTemplate(t);else if(e[d].hasOwnProperty("videos"))o=wdi_front.getVideoTemplate(t);else o=wdi_front.getSliderTemplate(t);var n=e[d],s=o(wdi_front.createObject(n,t));i.html(i.html()+s),t.imageIndex++,"pagination"==t.feed_row.feed_display_view&&((d+1)%t.feed_row.pagination_per_page_number==0?t.resIndex+=t.freeSpaces+1:t.resIndex++)}t.wdi_loadedImages=0;var _=!1;t.wdi_load_count=d;r=t.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+r+" img.wdi_img").on("load",function(){t.wdi_loadedImages++,t.wdi_load_count===t.wdi_loadedImages&&0!=t.wdi_loadedImages&&(t.loadedImages=0,t.wdi_load_count=0,wdi_front.allImagesLoaded(t)),!1===_&&(wdi_responsive.columnControl(t,1),_=!0)});1==t.paginatorNextFlag&&wdi_front.updatePagination(t,"next"),t.infiniteScrollFlag=!1}},wdi_front.checkFeedFinished=function(e){for(var t=0;t<e.usersData.length;t++)if(void 0===e.usersData[t].finished)return!1;return!0},wdi_front.sortingOperator=function(e,t){var r;switch(e){case"date":switch(t){case"asc":r=function(e,t){return e.created_time>t.created_time?1:-1};break;case"desc":r=function(e,t){return e.created_time>t.created_time?-1:1}}break;case"likes":switch(t){case"asc":r=function(e,t){return e.likes.count<t.likes.count?-1:1};break;case"desc":r=function(e,t){return e.likes.count<t.likes.count?1:-1}}break;case"comments":switch(t){case"asc":r=function(e,t){return e.comments.count<t.comments.count?-1:1};break;case"desc":r=function(e,t){return e.comments.count<t.comments.count?1:-1}}break;case"random":r=function(e,t){return Math.random()>.5?1:-1}}return r},wdi_front.feedSort=function(e,t){var r=e.feed_row.sort_images_by,i=e.feed_row.display_order;"1"===e.feed_row.resort_after_load_more?e.data=e.data.concat(wdi_front.smartPicker(e,t)):e.data=wdi_front.smartPicker(e,t);var a=wdi_front.sortingOperator(r,i);return e.data.sort(a),e.data},wdi_front.smartPicker=function(e,t){var r=[],i=0,a=[],d=Math.ceil(e.feed_row.number_of_photos/e.usersData.length),o=parseInt(e.feed_row.number_of_photos),n=0;""!=t&&void 0!==t&&null!=t&&(o=parseInt(t),d=Math.ceil(o/wdi_front.activeUsersCount(e)));e.storeRawData(e.usersData,"dataStorageRaw");for(var s=e.dataStorageRaw.sort(function(e,t){return e.length()>t.length()?1:-1}),_=e.usersData.sort(function(e,t){return e.data.length>t.data.length?1:-1}),f=0;f<_.length;f++)if(n+=d,s[f].length()<=n)n-=s[f].length(),r.push(s[f].getData(s[f].length())),i+=r[r.length-1].length;else{i+n>o&&(n=o-i);var l=[];!1===e.auto_trigger?l=l.concat(s[f].getData(n)):l.length+wdi_front.getDataLength(e)+wdi_front.getDataLength(e,r)<e.feed_row.number_of_photos&&(l=l.concat(s[f].getData(n))),n=0,i+=l.length,r.push(l)}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++)a=a.concat(r[f]);return a},wdi_front.createObject=function(e,t){var r=null!=e.caption?e.caption.text:" ",i=wdi_url.plugin_url+"images/video_missing.png";if("video"==e.type&&e.videos[t.feedVideoResolution]&&null!=e.videos[t.feedVideoResolution].url&&(i=e.hasOwnProperty("videos")?e.videos[t.feedVideoResolution].url:""),void 0===e.images[t.feedImageResolution])var a=wdi_url.plugin_url+"images/missing.png";else if("carousel"==e.type&&void 0===e.images[t.feedImageResolution].url)a=e.carousel_media[0].images[t.feedImageResolution].url;else a=e.images[t.feedImageResolution].url;var d=t.imageIndex,o="square",n=e.images.standard_resolution.height,s=e.images.standard_resolution.width;n>s?o="portrait":n<s&&(o="landscape");var _=e.user.username;return""===_&&(_="no_user"),{id:e.id,caption:wdi_front.escape_tags(r),image_url:a,likes:e.likes.count,comments:e.comments.count,wdi_index:d,wdi_res_index:t.resIndex,wdi_media_user:_,link:e.link,video_url:i,wdi_username:_,wdi_shape:o}},wdi_front.setPage=function(e){var t=e.feed_row.feed_display_view,r=e.feed_row.feed_type;if("pagination"!=t)return"";var i=e.imageIndex;if("image_browser"==r)var a=1;else a=Math.abs(e.feed_row.pagination_per_page_number);return e.paginator=Math.ceil((i+1)/a),e.paginator},wdi_front.getPhotoTemplate=function(e){var t=wdi_front.setPage(e),r="",i="",a="",d="",o="tenweb-i-arrows-out";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o=""),""!=t?(i='wdi_page="'+t+'"',sourceAttr="src"):sourceAttr="src",""!=t&&1!=t&&(r="wdi_hidden"),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(r+=" wdi_full_caption");switch("blog_style"!==e.feed_row.feed_type&&("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":a="",d="wdi_cursor_off wdi_hover_off",o=""}var n='<div class="wdi_feed_item '+r+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+i+' 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+'" ><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 n+="</div>",_.template(n)},wdi_front.getSliderTemplate=function(e){var t=wdi_front.setPage(e),r="",i="",a="",d="",o="tenweb-i-clone";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o=""),""!=t?(i='wdi_page="'+t+'"',sourceAttr="src"):sourceAttr="src",""!=t&&1!=t&&(r="wdi_hidden"),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(r+=" wdi_full_caption");switch("blog_style"!==e.feed_row.feed_type&&("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":a="",d="wdi_cursor_off wdi_hover_off",o=""}var n='<div class="wdi_feed_item '+r+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+i+' 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+'" ><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 n+="</div>",_.template(n)},wdi_front.replaceToVideo=function(e,t,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="'+t+'"] .wdi_photo_wrap_inner').html(overlayHtml),jQuery("#wdi_feed_"+r+' [wdi_index="'+t+'"] .wdi_photo_wrap_inner video').get(0).play()},wdi_front.getVideoTemplate=function(e){var t,r=wdi_front.setPage(e),i="",a="",d="tenweb-i-play",o="",n="";""!=r?(a='wdi_page="'+r+'"',t="src"):t="src",""!=r&&1!=r&&(i="wdi_hidden"),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(i+=" wdi_full_caption");switch("blog_style"!==e.feed_row.feed_type&&("masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":o="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":o="onclick=\"window.open ('<%= link%>','_blank')\"",n="wdi_hover_off",d="tenweb-i-play";break;case"custom_redirect":o="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",n="wdi_hover_off",d="";break;case"none":n="wdi_cursor_off wdi_hover_off",d="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",n="",d="tenweb-i-play")}var s='<div class="wdi_feed_item '+i+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+a+' 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\" "+t+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+n+'" '+o+'><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 s+="</div>",_.template(s)},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))},wdi_front.paginationFirstPage=function(e,t){if(1!=t.paginator&&1!=t.currentPage){var r=t.currentPage;t.currentPage=1,wdi_front.updatePagination(t,"custom",r),e.parent().find("#wdi_last_page").removeClass("wdi_disabled"),e.addClass("wdi_disabled")}else e.addClass("wdi_disabled")},wdi_front.paginationLastPage=function(e,t){if(1!=t.paginator&&t.currentPage!=t.paginator){var r=t.currentPage;t.currentPage=t.paginator,wdi_front.updatePagination(t,"custom",r),e.addClass("wdi_disabled"),e.parent().find("#wdi_first_page").removeClass("wdi_disabled")}},wdi_front.paginatorNext=function(e,t){var r=e.parent().find("#wdi_last_page"),i=e.parent().find("#wdi_first_page");if(t.paginatorNextFlag=!0,t.paginator!=t.currentPage||wdi_front.checkFeedFinished(t))t.paginator>t.currentPage&&(t.currentPage++,wdi_front.updatePagination(t,"next"),t.paginator>t.currentPage?r.removeClass("wdi_disabled"):r.addClass("wdi_disabled"));else{t.currentPage++;var a=t.feed_row.number_of_photos;wdi_front.loadMore(e,t,a),r.addClass("wdi_disabled")}i.removeClass("wdi_disabled")},wdi_front.paginatorPrev=function(e,t){var r=e.parent().find("#wdi_last_page"),i=e.parent().find("#wdi_first_page");1!=t.currentPage?(t.currentPage--,wdi_front.updatePagination(t,"prev"),r.removeClass("wdi_disabled"),1==t.currentPage&&i.addClass("wdi_disabled")):i.addClass("wdi_disabled")},wdi_front.updatePagination=function(e,t,r){var i="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(i+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),t){case"next":r=e.currentPage-1;jQuery(i+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(i+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":r=e.currentPage+1;jQuery(i+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(i+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(r=r)!=e.currentPage&&(jQuery(i+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(i+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(i+" .wdi_feed_wrapper").css("height","auto"),jQuery(i+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,t){var r=0;if(""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e)var i=window[e.parent().parent().parent().parent().attr("id")];if(void 0!==t)i=t;for(var a=0,d=0,o=0;o<i.userSortFlags.length;o++)if(!0===i.userSortFlags[o].flag){a++;for(var n=0;n<i.usersData.length;n++)i.userSortFlags[o].id===i.usersData[n].user_id&&"finished"===i.usersData[n].finished&&d++}if(a!==d||0==a){i.auto_trigger=""===e,wdi_front.ajaxLoader(i),"masonry"===i.feed_row.feed_type&&"pagination"==i.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<i.usersData.length;o++)"finished"===i.usersData[o].finished&&r++;r===i.usersData.length&&(wdi_front.allImagesLoaded(i),jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_load_more").remove());var s=i.usersData;i.loadMoreDataCount=i.feed_users.length;for(o=0;o<s.length;o++){var _=s[o].pagination,f={user_id:s[o].user_id,username:s[o].username};if(""!=_.next_url&&null!=_.next_url&&void 0!==_.next_url){var l=_.next_url;wdi_front.loadMoreRequest(f,l,i,e)}else"initial-keep"==e&&(i.temproraryUsersData[o]=i.usersData[o]),i.loadMoreDataCount--,wdi_front.checkForLoadMoreDone(i,e)}}},wdi_front.loadMoreRequest=function(e,t,r,i){if(r.mediaRequestsDone){r.usersData;var a="",d=function(t){if(""===t||void 0===t||null==t)return a=wdi_front_messages.network_error,r.loadMoreDataCount--,void wdi_front.show_alert(a,t,r);if(void 0!==t.meta&&void 0!==t.meta.error_type&&wdi_front.show_alert(!1,t,r),void 0!==t.meta&&void 0!==t.meta.code&&200!=t.meta.code)return a=t.meta.error_message,r.loadMoreDataCount--,void wdi_front.show_alert(a,t,r);t.user_id=e.user_id,t.username=e.username;for(var d=0;d<r.usersData.length;d++)t.user_id===r.usersData[d].user_id&&("#"===t.user_id[0]&&(t.data=wdi_front.appendRequestHashtag(t.data,t.user_id)),"initial-keep"==i&&(r.temproraryUsersData[d]=r.usersData[d]),r.usersData[d]=t,r.loadMoreDataCount--);wdi_front.checkForLoadMoreDone(r,i)};"#"!==e.username[0]?r.instagram.requestByUrl(t,{success:d}):r.instagram.getTagRecentMedia(e.username,{success:d},t,r.feed_row.hashtag_top_recent)}},wdi_front.checkForLoadMoreDone=function(e,t){var r=e.feed_row.load_more_number,i=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"==t&&(t="initial"),"initial"==t)a<i&&!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<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 t=0,r=0;r<e.dataStorageRaw.length;r++)0==e.dataStorageRaw[r].length()&&1==e.dataStorageRaw[r].locked&&t++;return t==e.dataStorageRaw.length},wdi_front.mergeData=function(e,t){for(var r=0;r<t.length;r++)if(void 0!==e[r]){if("finished"==t[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(t[r].data),e[r].pagination=t[r].pagination,e[r].user_id=t[r].user_id,e[r].username=t[r].username,e[r].meta=t[r].meta}else e.push(t[r]);return e},wdi_front.brokenImageHandler=function(e){var t=e.src.split("/p/");if(void 0!==t[0]&&void 0!==t[1]&&"https://www.instagram.com"!==t[0]){var r=wdi_baseName(t[0])+"/p/"+t[1];e.src=r}else e.src=wdi_url.plugin_url+"images/missing.png";return e.onerror="",!0},wdi_front.ajaxLoader=function(e){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").addClass("wdi_hidden"),r.find(".wdi_spinner").removeClass("wdi_hidden"))},wdi_front.allImagesLoaded=function(e){var t=wdi_front.getDataLength(e);e.mediaRequestsDone||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia"),0!=t||!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,i=jQuery("#wdi_feed_"+r);"load_more_btn"==e.feed_row.feed_display_view&&(i.find(".wdi_load_more").removeClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden")),i.trigger("wdi_feed_loaded")},wdi_front.show=function(e,t){var r,i,a,d=t.feed_row.wdi_feed_counter,o=jQuery("#wdi_feed_"+d+" .wdi_feed_container");switch(e){case"header":r={feed_thumb:t.feed_row.feed_thumb,feed_name:t.feed_row.feed_name},i=wdi_front.getHeaderTemplate()(r),a=o.find(".wdi_feed_header").html(),o.find(".wdi_feed_header").html(a+i)}},wdi_front.getUserTemplate=function(e,t){var r,i,a=e.dataCount;switch(t[0]){case"#":r="//instagram.com/explore/tags/"+t.substr(1,t.length);break;default:r="//instagram.com/"+t}i="onclick='"+('window.open("'+r+'","_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 a>1&&(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 "+i+"><%= user_name%></h3>","#"!==t[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&&"#"!==t[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,t){var r=window["wdi_feed_"+t];if(!(r.dataCount<2)&&0==r.nowLoadingImages){var i=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');i.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg"),i.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col"),i.find(".wdi_media_info").toggleClass("wdi_filter_active_col"),i.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col"),r.customFilterChanged=!0,0==r.userSortFlags[e].flag?r.userSortFlags[e].flag=!0:r.userSortFlags[e].flag=!1;for(var a=0,d=0;d<r.userSortFlags.length;d++)1==r.userSortFlags[d].flag&&a++;"pagination"==r.feed_row.feed_display_view&&(r.resIndex=0),0!=a?(wdi_front.filterData(r),wdi_front.displayFeed(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 t=e.userSortFlags;e.customFilteredData=[];for(var r=0;r<e.dataStorageList.length;r++)for(var i=0;i<t.length;i++)(void 0!==e.dataStorageList[r].user.id&&e.dataStorageList[r].user.id==t[i].id||e.dataStorageList[r].wdi_hashtag==t[i].name)&&1==t[i].flag&&e.customFilteredData.push(e.dataStorageList[r])},wdi_front.applyFilters=function(e){for(var t=0;t<e.userSortFlags.length;t++)if(1==e.userSortFlags[t].flag){jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+'[user_index="'+t+'"]');wdi_front.addFilter(t,e.feed_row.wdi_feed_counter),wdi_front.addFilter(t,e.feed_row.wdi_feed_counter)}},wdi_front.getImgCount=function(e){for(var t=e.dataStorage,r=0,i=0;i<t.length;i++)r+=t[i].length;return r},wdi_front.parseLighboxData=function(e,t){var r=e.dataStorage,i=e.feed_row.sort_images_by,a=e.feed_row.display_order,d=wdi_front.sortingOperator(i,a),o=[],n=[],s={};if(1==t)o=e.customFilteredData;else{for(var _=0;_<r.length;_++)for(var f=0;f<r[_].length;f++)o.push(r[_][f]);o.sort(d)}for(_=0;_<o.length;_++){var l=void 0!==o[_].media_url?o[_].media_url:wdi_url.plugin_url+"images/video_missing.png";if(void 0===o[_].media_url)if("carousel"===o[_].type)l=o[_].carousel_media[0].images.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:l,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 t=parseInt(e),r=new Date(0);r.setUTCSeconds(t);var i=r.getFullYear()+"-"+r.getMonth()+"-"+r.getDate();return i+=" "+r.getHours()+":"+r.getMinutes()},wdi_front.getDescription=function(e){return e=e.replace(/\r?\n|\r/g," ")},wdi_front.getFileName=function(e){var t=e.link;if("video"===e.type&&e.hasOwnProperty("videos")&&null!=e.videos.standard_resolution)return e.videos.standard_resolution.url;var r=t.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 t=e[0],r=0,i=1;i<e.length;i++)t<e[i]&&(t=e[i],r=i);return{value:t,index:r}},wdi_front.array_min=function(e){for(var t=e[0],r=0,i=1;i<e.length;i++)t>e[i]&&(t=e[i],r=i);return{value:t,index:r}},wdi_front.activeUsersCount=function(e){for(var t=0,r=0;r<e.usersData.length;r++)"finished"!=e.usersData[r].finished&&t++;return t},wdi_front.checkMediaResponse=function(e,t){return""==e||void 0===e||null==e?(errorMessage=wdi_front_messages.connection_error,wdi_front.show_alert(errorMessage,e,t),!1):""!=e&&void 0!==e&&null!=e&&200!=e.meta.code?(errorMessage=e.meta.error_message,wdi_front.show_alert(errorMessage,e,t),!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,t){var r=!1,i=!1,a=t.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),d=new RegExp("(?:^|\\s)"+a+"(?:^|\\s)"),o=new RegExp("(?:^|\\s)"+a,"g");for(null!=d.exec(e)&&(r=!0);null!=(match=o.exec(e));)i=!0;return 1==r||1==i},wdi_front.replaceNewLines=function(e){var t,r=[];for(e=e.replace(/\r?\n|\r/g,"vUkCJvN2ps3t"),t=new RegExp("vUkCJvN2ps3t","g");null!=(match=t.exec(e));)r.push(match.index);for(var i=e.split("vUkCJvN2ps3t"),a=0,d=0;d<i.length;d++)""==i[d]?a++:a=0,a>0&&(i.splice(d,1),a--,d--);return e=i.join(" ")},wdi_front.isEmptyObject=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0};var WDIFeed=function(e){this.data=e.data,this.dataCount=e.dataCount,this.feed_row=e.feed_row,this.usersData=e.usersData,_this=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,t){return e},WDIFeed.prototype.applyANDLogic=function(e,t){for(var r=0;r<t.length;r++)e=this.filterResponse(e,t[r]);return e},WDIFeed.prototype.applyORLogic=function(e,t){for(var r,i,a=[],d=[],o=0;o<t.length;o++)r=this.filterResponse(e,t[o]),a=a.concat(r.data),r={};for(o=0;o<a.length;o++)i=a[o],this.mediaExists(i,d)||this.mediaExists(i,this.dataStorageList)||d.push(i);return{data:d,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.applyNORLogic=function(e,t){for(var r=e,i=this.applyORLogic(e,t,this),a=[],d=0;d<r.data.length;d++)this.mediaExists(r.data[d],i.data)||a.push(r.data[d]);return{data:a,meta:r.meta,pagination:r.pagination}},WDIFeed.prototype.mediaExists=function(e,t){for(var r=0;r<t.length;r++)if(e.id==t[r].id)return!0;return!1},WDIFeed.prototype.filterResponse=function(e,t){switch(t.filter_type){case"hashtag":return this.filterByHashtag(e,t);case"username":return this.filterByUsername(e,t);case"mention":return this.filterByMention(e,t);case"description":return this.filterByDescription(e,t);case"location":return this.filterByLocation(e,t);case"url":return this.filterByUrl(e,t)}},WDIFeed.prototype.filterByHashtag=function(e,t){for(var r,i=[],a=0;a<e.data.length;a++)if(void 0!==(r=e.data[a]).tags)for(var d=0;d<r.tags.length;d++){tag=r.tags[d];var o=tag.toLowerCase(),n=t.filter_by.toLowerCase();o.trim()==n.trim()&&i.push(r)}return{data:i,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByUsername=function(e,t){for(var r,i=[],a=0;a<e.data.length;a++)(r=e.data[a]).user.username.toLowerCase()==t.filter_by.toLowerCase()&&i.push(r);return{data:i,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByMention=function(e,t){for(var r,i=[],a=0;a<e.data.length;a++)null!==(r=e.data[a]).caption&&-1!=r.caption.text.toLowerCase().indexOf("@"+t.filter_by.toLowerCase())&&i.push(r);return{data:i,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByDescription=function(e,t){for(var r,i,a=[],d=0;d<e.data.length;d++)if(null!==(r=e.data[d]).caption){i=r.caption.text.toLowerCase(),i=wdi_front.replaceNewLines(i);var o=t.filter_by.toLowerCase();wdi_front.regexpTestCaption(i,o)&&a.push(r)}return{data:a,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByLocation=function(e,t){for(var r,i=[],a=0;a<e.data.length;a++)null!==(r=e.data[a]).location&&r.location.id==t.filter_by&&i.push(r);return{data:i,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.filterByUrl=function(e,t){var r,i=[];t.filter_by=this.getIdFromUrl(t.filter_by);for(var a=0;a<e.data.length;a++)null!==(r=e.data[a]).link&&this.getIdFromUrl(r.link)==t.filter_by&&i.push(r);return{data:i,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.getIdFromUrl=function(e){for(var t=e.split("/"),r=!1,i=0;i<t.length;i++)if("p"==t[i]&&void 0!==t[i+1]){r=t[i+1];break}return r},WDIFeed.prototype.avoidDuplicateMedia=function(e){var t=e.data,r=[];void 0===t&&(t=[]);for(var i=0;i<t.length;i++)this.mediaExists(t[i],this.dataStorageList)||this.mediaExists(t[i],r)||this.mediaExists(t[i],this.conditionalFilterBuffer)||r.push(t[i]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(r),{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,t){var r=this;if("object"==typeof this[t]&&"number"==typeof this[t].length)for(var i=0;i<e.length;i++){var a="";wdi_front.isHashtag(e[i].user_id)?void 0!==e[i].pagination.cursors&&(a=e[i].pagination.cursors.after):"liked"==r.feed_row.liked_feed?void 0===(a=e[i].pagination.next_max_like_id)&&(a=""):(null==e[i].pagination&&(e[i].pagination=[]),void 0===(a=e[i].pagination.next_max_id)&&(a="")),void 0===this[t][i]?this[t].push({data:e[i].data,index:0,locked:!1,hash_id:a,usersDataFinished:!1,userId:e[i].user_id,length:function(){return this.data.length-this.index},getData:function(e){var t=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 i=0;i<r.usersData.length;i++)if(r.usersData[i].user_id==this.userId){r.usersData[i].finished="finished",this.usersDataFinished=!0;break}return t}}):0==this[t][i].locked&&(a!=this[t][i].hash_id?(this[t][i].data=this[t][i].data.concat(e[i].data),this[t][i].hash_id=a):this[t][i].locked=!0)}},wdi_front.updateUsersIfNecessary=function(e){for(var t=e.feed_users,r=!1,i=0;i<t.length;i++)"#"!=t[i].username.substr(0,1)?""!=t[i].id&&"username"!=t[i].id||(r=!0,e.instagram.searchForUsersByName(t[i].username,{success:function(r){if(void 0!==r.meta&&void 0!==r.meta.error_type&&wdi_front.show_alert(!1,r,e),200==r.meta.code&&r.data.length>0){for(var i=!1,a=0;a<r.data.length;a++)if(r.data[a].username==r.args.username){i=!0;break}if(i)for(var d=0;d<t.length;d++)r.data[a].username==t[d].username&&(t[d].id=r.data[a].id)}for(var o=!1,n=0;n<t.length;n++)if(""==t[n].id||"username"==t[n].id){o=!0;break}o||(e.feed_row.feed_users=JSON.stringify(t),wdi_front.init(e))},username:t[i].username})):t[i].id=t[i].username;return r},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
@@ -409,17 +409,17 @@ function WDIInstagram(args) {
|
|
409 |
"thumbnail": {
|
410 |
"width": 150,
|
411 |
"height": 150,
|
412 |
-
"url": media.
|
413 |
},
|
414 |
"low_resolution": {
|
415 |
"width": 320,
|
416 |
"height": 320,
|
417 |
-
"url": media.
|
418 |
},
|
419 |
"standard_resolution": {
|
420 |
"width": 1080,
|
421 |
"height": 1080,
|
422 |
-
"url": media.
|
423 |
}
|
424 |
},
|
425 |
"created_time": media.timestamp,
|
@@ -455,17 +455,17 @@ function WDIInstagram(args) {
|
|
455 |
"thumbnail": {
|
456 |
"width": 150,
|
457 |
"height": 150,
|
458 |
-
"url": media.
|
459 |
},
|
460 |
"low_resolution": {
|
461 |
"width": 320,
|
462 |
"height": 320,
|
463 |
-
"url": media.
|
464 |
},
|
465 |
"standard_resolution": {
|
466 |
"width": 1080,
|
467 |
"height": 1080,
|
468 |
-
"url": media.
|
469 |
}
|
470 |
};
|
471 |
} else if (media.media_type === "VIDEO") {
|
@@ -473,17 +473,17 @@ function WDIInstagram(args) {
|
|
473 |
"standard_resolution": {
|
474 |
"width": 640,
|
475 |
"height": 800,
|
476 |
-
"url": media.
|
477 |
},
|
478 |
"low_bandwidth": {
|
479 |
"width": 480,
|
480 |
"height": 600,
|
481 |
-
"url": media.
|
482 |
},
|
483 |
"low_resolution": {
|
484 |
"width": 480,
|
485 |
"height": 600,
|
486 |
-
"url": media.
|
487 |
}
|
488 |
};
|
489 |
}
|
@@ -498,12 +498,12 @@ function WDIInstagram(args) {
|
|
498 |
"thumbnail": {
|
499 |
"width": 150,
|
500 |
"height": 150,
|
501 |
-
"url": media.children.data[j].media_url
|
502 |
},
|
503 |
"low_resolution": {
|
504 |
"width": 320,
|
505 |
"height": 320,
|
506 |
-
"url": media.children.data[j].
|
507 |
},
|
508 |
"standard_resolution": {
|
509 |
"width": 640,
|
409 |
"thumbnail": {
|
410 |
"width": 150,
|
411 |
"height": 150,
|
412 |
+
"url": media.media_url
|
413 |
},
|
414 |
"low_resolution": {
|
415 |
"width": 320,
|
416 |
"height": 320,
|
417 |
+
"url": media.media_url
|
418 |
},
|
419 |
"standard_resolution": {
|
420 |
"width": 1080,
|
421 |
"height": 1080,
|
422 |
+
"url": media.media_url
|
423 |
}
|
424 |
},
|
425 |
"created_time": media.timestamp,
|
455 |
"thumbnail": {
|
456 |
"width": 150,
|
457 |
"height": 150,
|
458 |
+
"url": media.media_url
|
459 |
},
|
460 |
"low_resolution": {
|
461 |
"width": 320,
|
462 |
"height": 320,
|
463 |
+
"url": media.media_url
|
464 |
},
|
465 |
"standard_resolution": {
|
466 |
"width": 1080,
|
467 |
"height": 1080,
|
468 |
+
"url": media.media_url
|
469 |
}
|
470 |
};
|
471 |
} else if (media.media_type === "VIDEO") {
|
473 |
"standard_resolution": {
|
474 |
"width": 640,
|
475 |
"height": 800,
|
476 |
+
"url": media.thumb_url,
|
477 |
},
|
478 |
"low_bandwidth": {
|
479 |
"width": 480,
|
480 |
"height": 600,
|
481 |
+
"url": media.thumb_url,
|
482 |
},
|
483 |
"low_resolution": {
|
484 |
"width": 480,
|
485 |
"height": 600,
|
486 |
+
"url": media.thumb_url,
|
487 |
}
|
488 |
};
|
489 |
}
|
498 |
"thumbnail": {
|
499 |
"width": 150,
|
500 |
"height": 150,
|
501 |
+
"url": media.children.data[j].media_url
|
502 |
},
|
503 |
"low_resolution": {
|
504 |
"width": 320,
|
505 |
"height": 320,
|
506 |
+
"url": media.children.data[j].media_url
|
507 |
},
|
508 |
"standard_resolution": {
|
509 |
"width": 640,
|
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 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=[]},this.getTagRecentMedia=function(e,r,o,i){var n=this,c=!1,u=this.statusCode,a=!1,d=this.getFilter("getTagRecentMedia");i=0===parseInt(i)?"top_media":"recent_media",void 0===r||0===r.length||("success"in r&&(c=!0),"statusCode"in r&&(u=r.statusCode),"error"in r&&(a=!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 f=this.getTagId(e);jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{tagname:e,endpoint:i,wdi_nonce:wdi_ajax.wdi_nonce,wdiTagId:f,next_url:o,user_name:t(),action:"wdi_getTagRecentMedia"},success:function(e){if(!1===f&&(f=""),void 0!==e.tag_data){var t=e.tag_data;void 0!==t.tag_id&&(f=t.tag_id);var o=[];void 0!==window.wdi_all_tags&&(o=window.wdi_all_tags),o[t.tag_id]=t,window.wdi_all_tags=o}e=e.response,(e=s.convertHashtagData(e)).meta={code:200},e.tag_id=f,function(e){void 0===e.data&&(e.data=[]);c&&("object"==typeof r.success&&2==r.success.length?void 0!==window[r.success[0]]&&"function"==typeof window[r.success[0]][r.success[1]]&&(d&&(e=d(e,n.filterArguments,r.args)),window[r.success[0]][r.success[1]](e)):"string"==typeof r.success?"function"==typeof window[r.success]&&(d&&(e=d(e,n.filterArguments,r.args)),window[r.success](e)):"function"==typeof r.success&&(d&&(e=d(e,n.filterArguments,r.args)),r.success(e)))}(e=s.addTags(e))},error:function(e){a&&("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:u})},this.addTags=function(e){for(i in e.data){var s=e.data[i].caption.text;if(void 0!==s&&""!==s&&-1!=s.indexOf("#")){var t=s.split("#");e.data[i].tags=t}}return e},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:{}};for(var t in void 0!==e.paging&&(s.pagination={cursors:{after:e.paging.cursors.after},next_url:e.paging.next}),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.permalink+"media?size=t"},low_resolution:{width:320,height:320,url:o.permalink+"media?size=m"},standard_resolution:{width:1080,height:1080,url:o.permalink+"media?size=l"}},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.permalink+"media?size=t"},low_resolution:{width:320,height:320,url:o.permalink+"media?size=m"},standard_resolution:{width:1080,height:1080,url:o.permalink+"media?size=l"}}:"VIDEO"===o.media_type&&(i.videos={standard_resolution:{width:640,height:800,url:o.media_url},low_bandwidth:{width:480,height:600,url:o.media_url},low_resolution:{width:480,height:600,url:o.media_url}}),"CAROUSEL_ALBUM"===o.media_type)for(var 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+"media?size=t"},low_resolution:{width:320,height:320,url:o.children.data[n].permalink+"media?size=m"},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){var r=this,o=!1,i=this.statusCode,n=!1,c=this.getFilter("getUserMedia");void 0===e||0===e.length||("success"in e&&(o=!0),"error"in e&&(n=!0),"statusCode"in e&&(i=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()},success:function(t){t.meta={code:200},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&&(t=s.addTags(t),t=c(t,r.filterArguments,e)),window[e.success[0]][e.success[1]](t)):"string"==typeof e.success?"function"==typeof window[e.success]&&(c&&(t=s.addTags(t),t=c(t,r.filterArguments,e)),window[e.success](t)):"function"==typeof e.success&&(c&&(t=s.addTags(t),t=c(t,r.filterArguments,e)),e.success(t)))},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))},statusCode:i})},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){}})}}
|
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=[]},this.getTagRecentMedia=function(e,r,o,i){var n=this,c=!1,u=this.statusCode,a=!1,d=this.getFilter("getTagRecentMedia");i=0===parseInt(i)?"top_media":"recent_media",void 0===r||0===r.length||("success"in r&&(c=!0),"statusCode"in r&&(u=r.statusCode),"error"in r&&(a=!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 f=this.getTagId(e);jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{tagname:e,endpoint:i,wdi_nonce:wdi_ajax.wdi_nonce,wdiTagId:f,next_url:o,user_name:t(),action:"wdi_getTagRecentMedia"},success:function(e){if(!1===f&&(f=""),void 0!==e.tag_data){var t=e.tag_data;void 0!==t.tag_id&&(f=t.tag_id);var o=[];void 0!==window.wdi_all_tags&&(o=window.wdi_all_tags),o[t.tag_id]=t,window.wdi_all_tags=o}e=e.response,(e=s.convertHashtagData(e)).meta={code:200},e.tag_id=f,function(e){void 0===e.data&&(e.data=[]);c&&("object"==typeof r.success&&2==r.success.length?void 0!==window[r.success[0]]&&"function"==typeof window[r.success[0]][r.success[1]]&&(d&&(e=d(e,n.filterArguments,r.args)),window[r.success[0]][r.success[1]](e)):"string"==typeof r.success?"function"==typeof window[r.success]&&(d&&(e=d(e,n.filterArguments,r.args)),window[r.success](e)):"function"==typeof r.success&&(d&&(e=d(e,n.filterArguments,r.args)),r.success(e)))}(e=s.addTags(e))},error:function(e){a&&("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:u})},this.addTags=function(e){for(i in e.data){var s=e.data[i].caption.text;if(void 0!==s&&""!==s&&-1!=s.indexOf("#")){var t=s.split("#");e.data[i].tags=t}}return e},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:{}};for(var t in void 0!==e.paging&&(s.pagination={cursors:{after:e.paging.cursors.after},next_url:e.paging.next}),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){var r=this,o=!1,i=this.statusCode,n=!1,c=this.getFilter("getUserMedia");void 0===e||0===e.length||("success"in e&&(o=!0),"error"in e&&(n=!0),"statusCode"in e&&(i=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()},success:function(t){t.meta={code:200},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&&(t=s.addTags(t),t=c(t,r.filterArguments,e)),window[e.success[0]][e.success[1]](t)):"string"==typeof e.success?"function"==typeof window[e.success]&&(c&&(t=s.addTags(t),t=c(t,r.filterArguments,e)),window[e.success](t)):"function"==typeof e.success&&(c&&(t=s.addTags(t),t=c(t,r.filterArguments,e)),e.success(t)))},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))},statusCode:i})},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
@@ -4,7 +4,7 @@ Tags: custom instagram feed, feed, instagram, hashtag, Instagram feed, instagram
|
|
4 |
Requires at least: 3.9
|
5 |
Requires PHP: 5.2
|
6 |
Tested up to: 5.5
|
7 |
-
Stable tag: 1.4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -505,6 +505,9 @@ 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.6 =
|
509 |
Improved: Separate options for personal and business accounts.
|
510 |
Improved: Increased loading time of feed.
|
4 |
Requires at least: 3.9
|
5 |
Requires PHP: 5.2
|
6 |
Tested up to: 5.5
|
7 |
+
Stable tag: 1.4.7
|
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.7 =
|
509 |
+
Fixed: Feed images view.
|
510 |
+
|
511 |
= 1.4.6 =
|
512 |
Improved: Separate options for personal and business accounts.
|
513 |
Improved: Increased loading time of feed.
|
update/wdi_update.php
CHANGED
@@ -19,47 +19,6 @@ function wdi_update_diff($new_v, $old_v = 0.0){
|
|
19 |
$wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `th_thumb_user_color` varchar(32) NOT NULL DEFAULT '#FFFFFF'");
|
20 |
$wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `mas_thumb_user_bg_color` varchar(32) NOT NULL DEFAULT '#429FFF'");
|
21 |
$wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `mas_thumb_user_color` varchar(32) NOT NULL DEFAULT '#FFFFFF'");
|
22 |
-
|
23 |
-
require_once(WDI_DIR . '/framework/WDILibraryEmbed.php');
|
24 |
-
|
25 |
-
/*set master user id*/
|
26 |
-
$wdi_options = get_option(WDI_OPT);
|
27 |
-
$master_username = isset($wdi_options['wdi_user_name']) ? $wdi_options['wdi_user_name'] : false;
|
28 |
-
if($master_username){
|
29 |
-
$master_user_id = WDILibraryEmbed::get_instagram_id_by_username($master_username);
|
30 |
-
}
|
31 |
-
$wdi_options["wdi_user_id"] = $master_user_id ? $master_user_id : '';
|
32 |
-
update_option(WDI_OPT, $wdi_options);
|
33 |
-
|
34 |
-
/*set ids in feeds*/
|
35 |
-
$feeds = $wpdb->get_results( 'SELECT * FROM '.$wpdb->prefix . WDI_FEED_TABLE, ARRAY_A );
|
36 |
-
foreach ($feeds as $feed) {
|
37 |
-
$users_new = array();
|
38 |
-
$users = trim($feed['feed_users']);
|
39 |
-
$usersArr = explode(',',$users);
|
40 |
-
foreach ($usersArr as $username) {
|
41 |
-
if(substr($username, 0, 1) == "#"){
|
42 |
-
$current_user_id = $username;
|
43 |
-
}
|
44 |
-
else{
|
45 |
-
$current_user_id = WDILibraryEmbed::get_instagram_id_by_username($username);
|
46 |
-
}
|
47 |
-
|
48 |
-
$current_user = new stdClass();
|
49 |
-
$current_user->username = $username;
|
50 |
-
$current_user->id = $current_user_id;
|
51 |
-
array_push($users_new, $current_user);
|
52 |
-
}
|
53 |
-
$users_new_json = json_encode($users_new);
|
54 |
-
/*save current feed data into WPDB*/
|
55 |
-
$wpdb->update(
|
56 |
-
$wpdb->prefix . WDI_FEED_TABLE,
|
57 |
-
array(
|
58 |
-
'feed_users' => $users_new_json,
|
59 |
-
),
|
60 |
-
array( 'id' => $feed['id'] )
|
61 |
-
);
|
62 |
-
}
|
63 |
}
|
64 |
|
65 |
if(version_compare($old_v, "0.7", '<')){
|
19 |
$wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `th_thumb_user_color` varchar(32) NOT NULL DEFAULT '#FFFFFF'");
|
20 |
$wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `mas_thumb_user_bg_color` varchar(32) NOT NULL DEFAULT '#429FFF'");
|
21 |
$wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `mas_thumb_user_color` varchar(32) NOT NULL DEFAULT '#FFFFFF'");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
}
|
23 |
|
24 |
if(version_compare($old_v, "0.7", '<')){
|
wd-instagram-feed.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: 10Web Social Photo Feed
|
4 |
Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/?utm_source=instagram_feed&utm_medium=free_plugin
|
5 |
Description: 10Web Social Photo Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
|
6 |
-
Version: 1.4.
|
7 |
Author: 10Web
|
8 |
Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
|
9 |
License: GPLv2 or later
|
@@ -22,7 +22,7 @@ define("WDI_META", '_' . WDI_VAR . '_meta');
|
|
22 |
define('WDI_FEED_TABLE', 'wdi_feeds');
|
23 |
define('WDI_THEME_TABLE', 'wdi_themes');
|
24 |
|
25 |
-
define('WDI_VERSION', '1.4.
|
26 |
$wdi_minify = (isset($_GET['wdi_no_minify']) && rest_sanitize_boolean($_GET['wdi_no_minify']) == 'true') ? FALSE : TRUE;
|
27 |
define('WDI_MINIFY', $wdi_minify);
|
28 |
define('IS_FREE', TRUE);
|
@@ -387,39 +387,23 @@ function wdi_create_sample_feed($new_options){
|
|
387 |
// Adding menues.
|
388 |
add_action('admin_menu', 'WDI_instagram_menu', 9);
|
389 |
function WDI_instagram_menu() {
|
390 |
-
$wdi_options = wdi_get_options();
|
391 |
$menu_icon = WDI_URL . '/images/menu_icon.png';
|
392 |
$parent_slug = "wdi_feeds";
|
393 |
$min_feeds_capability = wdi_get_create_feeds_cap();
|
394 |
-
$
|
395 |
-
$
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
add_submenu_page($parent_slug, __('Themes', 'wd-instagram-feed'), __('Themes', 'wd-instagram-feed'), $min_feeds_capability, 'wdi_themes', 'WDI_instagram_themes_page');
|
409 |
-
add_submenu_page($parent_slug, __('Settings', 'wd-instagram-feed'), __('Settings', 'wd-instagram-feed'), 'manage_options', 'wdi_settings', 'WDI_instagram_settings_page');
|
410 |
-
add_submenu_page("", __('Uninstall', 'wd-instagram-feed'), __('Uninstall', 'wd-instagram-feed'), 'manage_options', 'wdi_uninstall', 'WDI_instagram_uninstall_page');
|
411 |
-
|
412 |
-
|
413 |
-
if(IS_FREE){
|
414 |
-
/* Custom link to wordpress.org*/
|
415 |
-
global $submenu;
|
416 |
-
$url = 'https://wordpress.org/support/plugin/wd-instagram-feed/#new-post';
|
417 |
-
$submenu[$parent_slug][] = array(
|
418 |
-
'<div id="wdi_ask_question">' . __('Ask a question', 'wd-instagram-feed') . '</div>',
|
419 |
-
'manage_options',
|
420 |
-
$url
|
421 |
-
);
|
422 |
-
}
|
423 |
}
|
424 |
}
|
425 |
|
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.7
|
7 |
Author: 10Web
|
8 |
Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
|
9 |
License: GPLv2 or later
|
22 |
define('WDI_FEED_TABLE', 'wdi_feeds');
|
23 |
define('WDI_THEME_TABLE', 'wdi_themes');
|
24 |
|
25 |
+
define('WDI_VERSION', '1.4.7');
|
26 |
$wdi_minify = (isset($_GET['wdi_no_minify']) && rest_sanitize_boolean($_GET['wdi_no_minify']) == 'true') ? FALSE : TRUE;
|
27 |
define('WDI_MINIFY', $wdi_minify);
|
28 |
define('IS_FREE', TRUE);
|
387 |
// Adding menues.
|
388 |
add_action('admin_menu', 'WDI_instagram_menu', 9);
|
389 |
function WDI_instagram_menu() {
|
|
|
390 |
$menu_icon = WDI_URL . '/images/menu_icon.png';
|
391 |
$parent_slug = "wdi_feeds";
|
392 |
$min_feeds_capability = wdi_get_create_feeds_cap();
|
393 |
+
add_menu_page(__('Instagram Feed', 'wd-instagram-feed'), 'Instagram Feed', $min_feeds_capability, 'wdi_feeds', 'WDI_instagram_feeds_page', $menu_icon);
|
394 |
+
add_submenu_page($parent_slug, __('Feeds', 'wd-instagram-feed'), __('Feeds', 'wd-instagram-feed'), $min_feeds_capability, 'wdi_feeds', 'WDI_instagram_feeds_page');
|
395 |
+
add_submenu_page($parent_slug, __('Themes', 'wd-instagram-feed'), __('Themes', 'wd-instagram-feed'), $min_feeds_capability, 'wdi_themes', 'WDI_instagram_themes_page');
|
396 |
+
add_submenu_page($parent_slug, __('Settings', 'wd-instagram-feed'), __('Settings', 'wd-instagram-feed'), 'manage_options', 'wdi_settings', 'WDI_instagram_settings_page');
|
397 |
+
add_submenu_page("", __('Uninstall', 'wd-instagram-feed'), __('Uninstall', 'wd-instagram-feed'), 'manage_options', 'wdi_uninstall', 'WDI_instagram_uninstall_page');
|
398 |
+
if ( IS_FREE ) {
|
399 |
+
/* Custom link to wordpress.org*/
|
400 |
+
global $submenu;
|
401 |
+
$url = 'https://wordpress.org/support/plugin/wd-instagram-feed/#new-post';
|
402 |
+
$submenu[$parent_slug][] = array(
|
403 |
+
'<div id="wdi_ask_question">' . __('Ask a question', 'wd-instagram-feed') . '</div>',
|
404 |
+
'manage_options',
|
405 |
+
$url
|
406 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
}
|
408 |
}
|
409 |
|