Instagram Gallery - Version 1.4.6

Version Description

  • Instagram API error quick FIX added
Download this release

Release Info

Developer buntisoft
Plugin Icon 128x128 Instagram Gallery
Version 1.4.6
Comparing to
See all releases

Code changes from version 1.4.4 to 1.4.6

app/Libra/InstagramSpider.php CHANGED
@@ -3,8 +3,8 @@
3
  /**
4
  * Instagram Spider
5
  * @author Karan Singh
6
- * @version 1.1.5
7
- * @description script to get instagram media by using Username and/or Tag.
8
  */
9
  class InstagramSpider
10
  {
@@ -39,21 +39,43 @@ class InstagramSpider
39
 
40
  $items = array();
41
  if (isset($instaRes->items)) {
42
- $instaRes = $instaRes->items;
43
 
44
- if (! empty($instaRes) && is_array($instaRes)) {
45
- foreach ($instaRes as $res) {
46
  $items[] = array(
47
  'img_standard' => $res->images->standard_resolution->url,
48
  'img_low' => $res->images->low_resolution->url,
49
  'img_thumb' => $res->images->thumbnail->url,
50
  'likes' => $res->likes->count,
51
  'comments' => $res->comments->count,
52
- 'caption' => isset($res->caption->text) ? htmlspecialchars($res->caption->text) : '',
53
  );
54
  }
55
  }
56
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  return $items;
58
  }
59
 
@@ -61,9 +83,10 @@ class InstagramSpider
61
  * takes #Tag name and return items list array
62
  *
63
  * @param string $tag
 
64
  * @return array
65
  */
66
- function getTagItems($tag = '')
67
  {
68
  $tag = urlencode((string) $tag);
69
  if (empty($tag)) {
@@ -75,17 +98,26 @@ class InstagramSpider
75
  $instaRes = json_decode($instaRes);
76
  $items = array();
77
  if (isset($instaRes->tag->media->nodes)) {
78
- $instaRes = $instaRes->tag->media->nodes;
79
 
80
- if (! empty($instaRes) && is_array($instaRes)) {
81
- foreach ($instaRes as $res) {
 
 
 
 
 
 
 
 
 
 
82
  $items[] = array(
83
  'img_standard' => $res->display_src,
84
  'img_low' => $res->thumbnail_src,
85
- 'img_thumb' => str_replace('s640x640','s150x150',$res->thumbnail_src),
86
  'likes' => $res->likes->count,
87
  'comments' => $res->comments->count,
88
- 'caption' => isset($res->caption) ? htmlspecialchars($res->caption) : '',
89
  );
90
  }
91
  }
@@ -107,23 +139,39 @@ class InstagramSpider
107
  return;
108
  }
109
  $instaItems = '';
110
- if (function_exists('curl_version')) {
111
- $ch = curl_init();
112
- curl_setopt($ch, CURLOPT_URL, $url);
113
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
114
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
115
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
116
- $contents = curl_exec($ch);
117
- if (curl_error($ch)) {
118
- $this->messages[] = 'error: ' . curl_error($ch);
 
119
  }
120
- curl_close($ch);
121
- $instaItems = $contents;
122
- } else {
123
- if (ini_get('allow_url_fopen')) {
124
- $instaItems = @file_get_contents($url);
 
 
 
 
 
 
 
 
 
 
 
125
  } else {
126
- $this->messages[] = 'Your server does\'t have enabled the required extensions/functions.';
 
 
 
 
127
  }
128
  }
129
  return $instaItems;
3
  /**
4
  * Instagram Spider
5
  * @author Karan Singh
6
+ * @version 1.2.3
7
+ * @description script to get instagram media by using Username and/or Tag. added WP (wp_remote_request) to run in WP.
8
  */
9
  class InstagramSpider
10
  {
39
 
40
  $items = array();
41
  if (isset($instaRes->items)) {
42
+ $instaItems = $instaRes->items;
43
 
44
+ if (! empty($instaItems) && is_array($instaItems)) {
45
+ foreach ($instaItems as $res) {
46
  $items[] = array(
47
  'img_standard' => $res->images->standard_resolution->url,
48
  'img_low' => $res->images->low_resolution->url,
49
  'img_thumb' => $res->images->thumbnail->url,
50
  'likes' => $res->likes->count,
51
  'comments' => $res->comments->count,
52
+ 'caption' => isset($res->caption->text) ? htmlspecialchars($res->caption->text) : ''
53
  );
54
  }
55
  }
56
  }
57
+ if(empty($items)){
58
+ $inURL = $this->instagram . $username . '/?__a=1';
59
+ $instaRes = $this->ig_spider($inURL);
60
+ $instaRes = @json_decode($instaRes);
61
+ $items = array();
62
+ if (isset($instaRes->user->media->nodes)) {
63
+ $instaItems = $instaRes->user->media->nodes;
64
+
65
+ if (! empty($instaItems) && is_array($instaItems)) {
66
+ foreach ($instaItems as $res) {
67
+ $items[] = array(
68
+ 'img_standard' => $res->display_src,
69
+ 'img_low' => $res->thumbnail_resources[4]->src,
70
+ 'img_thumb' => $res->thumbnail_resources[0]->src,
71
+ 'likes' => $res->likes->count,
72
+ 'comments' => $res->comments->count,
73
+ 'caption' => isset($res->caption) ? htmlspecialchars($res->caption) : ''
74
+ );
75
+ }
76
+ }
77
+ }
78
+ }
79
  return $items;
80
  }
81
 
83
  * takes #Tag name and return items list array
84
  *
85
  * @param string $tag
86
+ * @param boolean get top posts
87
  * @return array
88
  */
89
+ function getTagItems($tag = '',$getTopItems = false)
90
  {
91
  $tag = urlencode((string) $tag);
92
  if (empty($tag)) {
98
  $instaRes = json_decode($instaRes);
99
  $items = array();
100
  if (isset($instaRes->tag->media->nodes)) {
 
101
 
102
+ $instaItems = $instaRes->tag->media->nodes;
103
+ if (empty($instaItems) && isset($instaRes->tag->top_posts->nodes)) {
104
+ $instaItems = $instaRes->tag->top_posts->nodes;
105
+ }
106
+
107
+ // get top posts
108
+ if($getTopItems && isset($instaRes->tag->top_posts->nodes)){
109
+ $instaItems = $instaRes->tag->top_posts->nodes;
110
+ }
111
+
112
+ if (! empty($instaItems) && is_array($instaItems)) {
113
+ foreach ($instaItems as $res) {
114
  $items[] = array(
115
  'img_standard' => $res->display_src,
116
  'img_low' => $res->thumbnail_src,
117
+ 'img_thumb' => str_replace('s640x640', 's150x150', $res->thumbnail_src),
118
  'likes' => $res->likes->count,
119
  'comments' => $res->comments->count,
120
+ 'caption' => isset($res->caption) ? htmlspecialchars($res->caption) : ''
121
  );
122
  }
123
  }
139
  return;
140
  }
141
  $instaItems = '';
142
+
143
+ // get results if script executed in WP
144
+ if (function_exists('wp_remote_request')) {
145
+ $result = wp_remote_request($url);
146
+ if (is_wp_error($result)) {
147
+ $this->messages[] = 'WP Error: ' . $result->get_error_messages();
148
+ } else {
149
+ if (! empty($result['body'])) {
150
+ $instaItems = $result['body'];
151
+ }
152
  }
153
+ }
154
+
155
+ if (empty($instaItems)) { // continue via PHP
156
+
157
+ if (function_exists('curl_version')) {
158
+ $ch = curl_init();
159
+ curl_setopt($ch, CURLOPT_URL, $url);
160
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
161
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
162
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
163
+ $contents = curl_exec($ch);
164
+ if (curl_error($ch)) {
165
+ $this->messages[] = 'error: ' . curl_error($ch);
166
+ }
167
+ curl_close($ch);
168
+ $instaItems = $contents;
169
  } else {
170
+ if (ini_get('allow_url_fopen')) {
171
+ $instaItems = @file_get_contents($url);
172
+ } else {
173
+ $this->messages[] = 'Your server does\'t have enabled the required extensions/functions.';
174
+ }
175
  }
176
  }
177
  return $instaItems;
app/views/edit.php CHANGED
@@ -181,8 +181,10 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
181
  <td><select name="insta_thumb-size">
182
  <option value="medium">Medium(640,320 x auto)</option>
183
  <option value="small"
184
- <?php echo (isset($InstaGalleryItem['insta_thumb-size']) && ($InstaGalleryItem['insta_thumb-size'] == 'small')) ? 'selected' : ''; ?>>Small(150 x 150)</option>
185
- </select> <span class="description"><br />select small for square size images. </span></td>
 
 
186
  </tr>
187
  <tr>
188
  <th scope="row">Images hover color:</th>
@@ -196,19 +198,6 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
196
  </span> )
197
  </span></td>
198
  </tr>
199
- <tr>
200
- <th scope="row">Display Instagram Link Button:</th>
201
- <td><input name="insta_instalink" type="checkbox" value="1"
202
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_instalink'])) ? '' : 'checked'; ?> />
203
- <span class="description">show the button to open Instagram site link </span></td>
204
- </tr>
205
- <tr>
206
- <th scope="row">Instagram Link Text:</th>
207
- <td><input name="insta_instalink-text" type="text"
208
- placeholder="view on Instagram"
209
- value="<?php if(!empty($InstaGalleryItem['insta_instalink-text'])){echo $InstaGalleryItem['insta_instalink-text']; }?>" />
210
- <span class="description">update Instagram button text here.</span></td>
211
- </tr>
212
  <tr>
213
  <th scope="row">Popup images on thumbnail click:</th>
214
  <td><input name="insta_gal-popup" type="checkbox" value="1"
@@ -230,6 +219,49 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
230
  <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_comments'])) ? '' : 'checked'; ?> />
231
  <span class="description">display comments count of images. </span></td>
232
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  </tbody>
234
  </table>
235
  <div>
@@ -298,7 +330,7 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
298
  }
299
  });
300
 
301
- // color sync
302
  $('#insta_hover-color-choose').on('change',function(){
303
  $('input[name="insta_hover-color"]').val($(this).val());
304
  });
@@ -316,6 +348,52 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
316
  $('#insta_hover-color-choose').val('#007aff');
317
  }
318
  });
319
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  });
321
  </script>
181
  <td><select name="insta_thumb-size">
182
  <option value="medium">Medium(640,320 x auto)</option>
183
  <option value="small"
184
+ <?php echo (isset($InstaGalleryItem['insta_thumb-size']) && ($InstaGalleryItem['insta_thumb-size'] == 'small')) ? 'selected' : ''; ?>>Small(150
185
+ x 150)</option>
186
+ </select> <span class="description"><br />select small for square size
187
+ images. </span></td>
188
  </tr>
189
  <tr>
190
  <th scope="row">Images hover color:</th>
198
  </span> )
199
  </span></td>
200
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  <tr>
202
  <th scope="row">Popup images on thumbnail click:</th>
203
  <td><input name="insta_gal-popup" type="checkbox" value="1"
219
  <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_comments'])) ? '' : 'checked'; ?> />
220
  <span class="description">display comments count of images. </span></td>
221
  </tr>
222
+ <tr>
223
+ <th scope="row">Display Instagram Link Button:</th>
224
+ <td><input name="insta_instalink" type="checkbox" value="1"
225
+ <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_instalink'])) ? '' : 'checked'; ?> />
226
+ <span class="description">show the button to open Instagram site link </span></td>
227
+ </tr>
228
+ <tr id="ig-section-igbtn"
229
+ class="ig-tab-content-row <?php if(isset($InstaGalleryItem) && !empty($InstaGalleryItem['insta_instalink'])) echo 'active';?>">
230
+ <td colspan="100%">
231
+ <table>
232
+ <tr>
233
+ <th scope="row">Instagram Button Text:</th>
234
+ <td><input name="insta_instalink-text" type="text"
235
+ placeholder="view on Instagram"
236
+ value="<?php if(!empty($InstaGalleryItem['insta_instalink-text'])){echo $InstaGalleryItem['insta_instalink-text']; }?>" />
237
+ <span class="description">update Instagram button text here.</span></td>
238
+ </tr>
239
+ <tr>
240
+ <th scope="row">Button Background Color:</th>
241
+ <td><input id="insta_instalink-bgcolor-choose" type="color"
242
+ value="<?php echo (!empty($InstaGalleryItem['insta_instalink-bgcolor']) ? $InstaGalleryItem['insta_instalink-bgcolor'] : '#c32a67'); ?>" />
243
+ <input name="insta_instalink-bgcolor" type="text" placeholder="#c32a67"
244
+ value="<?php echo (!empty($InstaGalleryItem['insta_instalink-bgcolor']) ? $InstaGalleryItem['insta_instalink-bgcolor'] : ''); ?>" />
245
+ <span class="description">select color which is displayed on button background.<br />( <span class="ig-thm-color">color name should be in
246
+ <i>hexadecimal notation</i> e.g. #000000
247
+ </span> )
248
+ </span></td>
249
+ </tr>
250
+ <tr>
251
+ <th scope="row">Button Mouse Hover Color:</th>
252
+ <td><input id="insta_instalink-hvrcolor-choose" type="color"
253
+ value="<?php echo (!empty($InstaGalleryItem['insta_instalink-hvrcolor']) ? $InstaGalleryItem['insta_instalink-hvrcolor'] : '#da894a'); ?>" />
254
+ <input name="insta_instalink-hvrcolor" type="text" placeholder="#da894a"
255
+ value="<?php echo (!empty($InstaGalleryItem['insta_instalink-hvrcolor']) ? $InstaGalleryItem['insta_instalink-hvrcolor'] : ''); ?>" />
256
+ <span class="description">select color which is displayed when hovered
257
+ over button.<br />( <span class="ig-thm-color">color name should be in
258
+ <i>hexadecimal notation</i> e.g. #000000
259
+ </span> )
260
+ </span></td>
261
+ </tr>
262
+ </table>
263
+ </td>
264
+ </tr>
265
  </tbody>
266
  </table>
267
  <div>
330
  }
331
  });
332
 
333
+ // gallery color sync
334
  $('#insta_hover-color-choose').on('change',function(){
335
  $('input[name="insta_hover-color"]').val($(this).val());
336
  });
348
  $('#insta_hover-color-choose').val('#007aff');
349
  }
350
  });
351
+
352
+ // instagram link button toggle
353
+ $('input[name="insta_instalink"]').on('change',function(){
354
+ if(this.checked){
355
+ $('#ig-section-igbtn').show('slow').addClass('active');
356
+ }else{
357
+ $('#ig-section-igbtn').hide('slow').removeClass('active');
358
+ }
359
+ });
360
+
361
+ // button bgcolor sync
362
+ $('#insta_instalink-bgcolor-choose').on('change',function(){
363
+ $('input[name="insta_instalink-bgcolor"]').val($(this).val());
364
+ });
365
+ $('input[name="insta_instalink-bgcolor"]').on('change',function(){
366
+ var hvcolor = $(this).val();
367
+ if(hvcolor != ''){
368
+ var isOk = /^#[0-9A-F]{6}$/i.test(hvcolor);
369
+ if(!isOk){
370
+ alert('please enter valid color code');
371
+ $(this).val('');
372
+ return;
373
+ }
374
+ $('#insta_instalink-bgcolor-choose').val($(this).val());
375
+ }else {
376
+ $('#insta_instalink-bgcolor-choose').val('#c32a67');
377
+ }
378
+ });
379
+
380
+ // button hover color sync
381
+ $('#insta_instalink-hvrcolor-choose').on('change',function(){
382
+ $('input[name="insta_instalink-hvrcolor"]').val($(this).val());
383
+ });
384
+ $('input[name="insta_instalink-hvrcolor"]').on('change',function(){
385
+ var hvcolor = $(this).val();
386
+ if(hvcolor != ''){
387
+ var isOk = /^#[0-9A-F]{6}$/i.test(hvcolor);
388
+ if(!isOk){
389
+ alert('please enter valid color code');
390
+ $(this).val('');
391
+ return;
392
+ }
393
+ $('#insta_instalink-hvrcolor-choose').val($(this).val());
394
+ }else {
395
+ $('#insta_instalink-hvrcolor-choose').val('#da894a');
396
+ }
397
+ });
398
  });
399
  </script>
app/wp-front.php CHANGED
@@ -58,7 +58,7 @@ if (! defined('ABSPATH')) {
58
 
59
  $results = '';
60
  $results .= '<!--[if lte IE 8]><div class="igblock-wrap-IElte8"><![endif]-->';
61
- $results .= '<div class="ig-block" data-igalid="'.$gid.'" data-source="'.$insta_source.'">';
62
  $results .= '<div class="ig-spinner">';
63
  if(!empty($InstaGallerySetting['igs_spinner'])){
64
  $results .= '<img src="'.$InstaGallerySetting['igs_spinner'].'" alt="Instagram Gallery" class="ig-spin" />';
@@ -134,8 +134,11 @@ if (! defined('ABSPATH')) {
134
 
135
  $IGItem['insta_gal-hover'] = filter_var($IGItem['insta_gal-hover'], FILTER_VALIDATE_BOOLEAN);
136
  $IGItem['insta_gal-spacing'] = filter_var($IGItem['insta_gal-spacing'], FILTER_VALIDATE_BOOLEAN);
 
137
  $IGItem['insta_instalink'] = filter_var($IGItem['insta_instalink'], FILTER_VALIDATE_BOOLEAN);
138
  $IGItem['insta_instalink-text'] = empty($IGItem['insta_instalink-text']) ? 'view on Instagram' : $IGItem['insta_instalink-text'];
 
 
139
 
140
  $IGItem['insta_car-navarrows'] = @filter_var($IGItem['insta_car-navarrows'], FILTER_VALIDATE_BOOLEAN);
141
  $IGItem['insta_car-dots'] = @filter_var($IGItem['insta_car-dots'], FILTER_VALIDATE_BOOLEAN);
@@ -191,6 +194,15 @@ if (! defined('ABSPATH')) {
191
 
192
  if (! empty($instaItems)) {
193
 
 
 
 
 
 
 
 
 
 
194
  if ($IGItem['ig_display_type'] == 'gallery') {
195
  include (INSGALLERY_PATH . 'templates/gallery.php');
196
  } else if ($IGItem['ig_display_type'] == 'carousel') {
58
 
59
  $results = '';
60
  $results .= '<!--[if lte IE 8]><div class="igblock-wrap-IElte8"><![endif]-->';
61
+ $results .= '<div class="ig-block" id="ig-block-'.$gid.'" data-igalid="'.$gid.'" data-source="'.$insta_source.'">';
62
  $results .= '<div class="ig-spinner">';
63
  if(!empty($InstaGallerySetting['igs_spinner'])){
64
  $results .= '<img src="'.$InstaGallerySetting['igs_spinner'].'" alt="Instagram Gallery" class="ig-spin" />';
134
 
135
  $IGItem['insta_gal-hover'] = filter_var($IGItem['insta_gal-hover'], FILTER_VALIDATE_BOOLEAN);
136
  $IGItem['insta_gal-spacing'] = filter_var($IGItem['insta_gal-spacing'], FILTER_VALIDATE_BOOLEAN);
137
+
138
  $IGItem['insta_instalink'] = filter_var($IGItem['insta_instalink'], FILTER_VALIDATE_BOOLEAN);
139
  $IGItem['insta_instalink-text'] = empty($IGItem['insta_instalink-text']) ? 'view on Instagram' : $IGItem['insta_instalink-text'];
140
+ $IGItem['insta_instalink-bgcolor'] = @$IGItem['insta_instalink-bgcolor'];
141
+ $IGItem['insta_instalink-hvrcolor'] = @$IGItem['insta_instalink-hvrcolor'];
142
 
143
  $IGItem['insta_car-navarrows'] = @filter_var($IGItem['insta_car-navarrows'], FILTER_VALIDATE_BOOLEAN);
144
  $IGItem['insta_car-dots'] = @filter_var($IGItem['insta_car-dots'], FILTER_VALIDATE_BOOLEAN);
194
 
195
  if (! empty($instaItems)) {
196
 
197
+ $insta_source = ($IGItem['ig_select_from'] == 'username') ? 'user_' . $IGItem['insta_user'] : 'tag_'. $IGItem['insta_tag'];
198
+
199
+ $instaUrl = 'https://www.instagram.com/';
200
+ if($IGItem['ig_select_from'] == 'username') {
201
+ $instaUrl .= $IGItem['insta_user'];
202
+ } else {
203
+ $instaUrl .= 'explore/tags/'.$IGItem['insta_tag'];
204
+ }
205
+
206
  if ($IGItem['ig_display_type'] == 'gallery') {
207
  include (INSGALLERY_PATH . 'templates/gallery.php');
208
  } else if ($IGItem['ig_display_type'] == 'carousel') {
app/wp-panel.php CHANGED
@@ -26,6 +26,8 @@ if (isset($_POST['ig-form-update'])) {
26
  $IGItem['insta_gal-spacing'] = @$POSTDATA['insta_gal-spacing'];
27
  $IGItem['insta_instalink'] = @$POSTDATA['insta_instalink'];
28
  $IGItem['insta_instalink-text'] = trim(esc_html(@$POSTDATA['insta_instalink-text']));
 
 
29
  $IGItem['insta_car-slidespv'] = $POSTDATA['insta_car-slidespv'];
30
  $IGItem['insta_car-navarrows'] = @$POSTDATA['insta_car-navarrows'];
31
  $IGItem['insta_car-dots'] = @$POSTDATA['insta_car-dots'];
26
  $IGItem['insta_gal-spacing'] = @$POSTDATA['insta_gal-spacing'];
27
  $IGItem['insta_instalink'] = @$POSTDATA['insta_instalink'];
28
  $IGItem['insta_instalink-text'] = trim(esc_html(@$POSTDATA['insta_instalink-text']));
29
+ $IGItem['insta_instalink-bgcolor'] = sanitize_text_field(@$POSTDATA['insta_instalink-bgcolor']);
30
+ $IGItem['insta_instalink-hvrcolor'] = sanitize_text_field(@$POSTDATA['insta_instalink-hvrcolor']);
31
  $IGItem['insta_car-slidespv'] = $POSTDATA['insta_car-slidespv'];
32
  $IGItem['insta_car-navarrows'] = @$POSTDATA['insta_car-navarrows'];
33
  $IGItem['insta_car-dots'] = @$POSTDATA['insta_car-dots'];
assets/admin-style.css CHANGED
@@ -178,8 +178,9 @@
178
  font-size: 16px;
179
  color: red;
180
  }
181
- .ig-table-edit #insta_hover-color-choose {
182
  vertical-align: top;
 
183
  }
184
  /* ******** ig advance setting ********** */
185
  .ig_adv-setting-toggle{
178
  font-size: 16px;
179
  color: red;
180
  }
181
+ .ig-table-edit input[type="color"] {
182
  vertical-align: top;
183
+ padding: 1px 2px;
184
  }
185
  /* ******** ig advance setting ********** */
186
  .ig_adv-setting-toggle{
assets/insta-gallery.css CHANGED
@@ -100,7 +100,6 @@
100
  color: #fff;
101
  display: inline-block;
102
  padding: 5px 15px;
103
- border: 1px solid #db8c40;
104
  -webkit-transition: all .3s;
105
  transition: all .3s;
106
  }
@@ -262,15 +261,15 @@
262
  @media screen and (max-width: 767px) {
263
 
264
  .ig-item{
265
- min-width: 50%;
266
  padding: 5px;
267
- }
268
 
269
  }
270
- @media screen and (max-width: 420px) {
271
 
272
  .ig-item{
273
- min-width: 100%;
274
  padding: 5px;
275
  }
276
 
100
  color: #fff;
101
  display: inline-block;
102
  padding: 5px 15px;
 
103
  -webkit-transition: all .3s;
104
  transition: all .3s;
105
  }
261
  @media screen and (max-width: 767px) {
262
 
263
  .ig-item{
264
+ min-width: 33.333%;
265
  padding: 5px;
266
+ }
267
 
268
  }
269
+ @media screen and (max-width: 480px) {
270
 
271
  .ig-item{
272
+ min-width: 50%;
273
  padding: 5px;
274
  }
275
 
assets/insta-gallery.js CHANGED
@@ -21,10 +21,11 @@
21
  }
22
 
23
  // check internet connection
24
- if(!navigator.onLine){
25
  $e.append('you are OFFLINE, please connect to internet to view Instagram Gallery.');
26
  return;
27
- }
 
28
  jQuery.ajax({
29
  url : insgalajax.ajax_url,
30
  type : 'post',
@@ -43,7 +44,6 @@
43
  if ((typeof response === 'object') && response.igsuccess) {
44
  if (response.result) {
45
  $e.append( response.result );
46
- update_ig_dstyle(igalid);
47
  }
48
  }
49
  }
@@ -59,20 +59,6 @@
59
  });
60
  }
61
 
62
- // update dynamic css
63
- function update_ig_dstyle(igalid){
64
- if(igalid == '') return;
65
- igalid = parseInt(igalid);
66
- var ig_itemsw = '#instagal-'+igalid;
67
- if(!$(ig_itemsw).length) return;
68
- var ig_dstyle = '';
69
- if ($(ig_itemsw).attr('data-hvcolor') && ($(ig_itemsw).data('hvcolor') != '')) {
70
- ig_dstyle += ig_itemsw+' .ig-item.ighover a:hover:after, '+ig_itemsw+' .swiper-slide a:hover:after {background: '+$(ig_itemsw).data('hvcolor')+';}';
71
- }
72
- if(ig_dstyle != ''){
73
- $('head').append('<style>'+ig_dstyle+'</style>');
74
- }
75
- }
76
  // start loading as the script loaded
77
  if($('.ig-block').length){
78
  load_ig_gallery();
21
  }
22
 
23
  // check internet connection
24
+ /* if(!navigator.onLine){
25
  $e.append('you are OFFLINE, please connect to internet to view Instagram Gallery.');
26
  return;
27
+ } */
28
+
29
  jQuery.ajax({
30
  url : insgalajax.ajax_url,
31
  type : 'post',
44
  if ((typeof response === 'object') && response.igsuccess) {
45
  if (response.result) {
46
  $e.append( response.result );
 
47
  }
48
  }
49
  }
59
  });
60
  }
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  // start loading as the script loaded
63
  if($('.ig-block').length){
64
  load_ig_gallery();
insta-gallery.php CHANGED
@@ -5,11 +5,11 @@
5
  * Author: Karan Singh
6
  * Author URI: https://www.karansingh.ml/
7
  * Text Domain: insta-gallery
8
- * Version: 1.4.4
9
  */
10
 
11
  // plugin global constants
12
- define('INSGALLERY_VER', '1.4.4');
13
  define('INSGALLERY_PATH', plugin_dir_path(__FILE__));
14
  define('INSGALLERY_URL', plugins_url('', __FILE__));
15
 
5
  * Author: Karan Singh
6
  * Author URI: https://www.karansingh.ml/
7
  * Text Domain: insta-gallery
8
+ * Version: 1.4.6
9
  */
10
 
11
  // plugin global constants
12
+ define('INSGALLERY_VER', '1.4.6');
13
  define('INSGALLERY_PATH', plugin_dir_path(__FILE__));
14
  define('INSGALLERY_URL', plugins_url('', __FILE__));
15
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Karan Singh
3
  Tags: instagram, instagram feed, gallery, pictures, slider, carousel slider, image gallery, image slider, instagram gallery, instagram pictures
4
  Requires at least: 3.8.0
5
  Tested up to: 4.8
6
- Stable tag: 1.4.4
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
  Donate link: https://www.paypal.me/karanpay
@@ -16,7 +16,7 @@ Easy and simple way to display your Instagram images on the website.
16
  Display pictures from Instagram account as Gallery or as Carousel Slider. There is no need to configure APIs or login anywhere, just paste your Instagram Username or Tagname and configure your settings.
17
  it's a game of few seconds and your pictures will be on the website.
18
 
19
- **Demo:** you can see live demo [HERE](https://www.karansingh.ml/public/demo/insta-gallery/) or check 'screenshots' section for demo.
20
 
21
  **How to use:** add new gallery in plugin setting panel, and copy/paste the generated shortcode in the pages/posts/widgets content OR use the "echo do_shortcode( '[MyShortcode]' );" php code to add them in PHP file.
22
 
@@ -53,9 +53,6 @@ Yes you can.
53
 
54
  there may be some other plugins(like: fancybox) which also uses image links to open popup. try to disable popup images option in the setting panel of this plugin, which will allow other plugins to work.
55
 
56
- = What to do after updating the plugin to latest version? =
57
-
58
- if you are getting errors or content not displayed properly after update, then please clear browser cache/history and also clear cache in WP admin (if you are using any cache plugin).
59
 
60
  == Screenshots ==
61
 
@@ -65,6 +62,15 @@ if you are getting errors or content not displayed properly after update, then p
65
  4. Plugin backend
66
 
67
  == Changelog ==
 
 
 
 
 
 
 
 
 
68
  = 1.4.4 =
69
  * Carousel spacing bug fixed
70
  * some CSS updates
@@ -133,14 +139,20 @@ if you are getting errors or content not displayed properly after update, then p
133
 
134
 
135
  == Upgrade Notice ==
 
 
 
 
 
 
136
  = 1.4.4 =
137
- Carousel items spacing bug fixed.
138
 
139
  = 1.4.3 =
140
- Carousel images popup working now.
141
 
142
  = 1.4.2 =
143
- Gallery images are now fixed to equal size.
144
 
145
  = 1.4.1 =
146
  carousel images sizes fixed
3
  Tags: instagram, instagram feed, gallery, pictures, slider, carousel slider, image gallery, image slider, instagram gallery, instagram pictures
4
  Requires at least: 3.8.0
5
  Tested up to: 4.8
6
+ Stable tag: 1.4.6
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
  Donate link: https://www.paypal.me/karanpay
16
  Display pictures from Instagram account as Gallery or as Carousel Slider. There is no need to configure APIs or login anywhere, just paste your Instagram Username or Tagname and configure your settings.
17
  it's a game of few seconds and your pictures will be on the website.
18
 
19
+ **Demo:** you can see live demo [Here](https://www.karansingh.ml/public/demo/insta-gallery/) or check 'screenshots' section for demo.
20
 
21
  **How to use:** add new gallery in plugin setting panel, and copy/paste the generated shortcode in the pages/posts/widgets content OR use the "echo do_shortcode( '[MyShortcode]' );" php code to add them in PHP file.
22
 
53
 
54
  there may be some other plugins(like: fancybox) which also uses image links to open popup. try to disable popup images option in the setting panel of this plugin, which will allow other plugins to work.
55
 
 
 
 
56
 
57
  == Screenshots ==
58
 
62
  4. Plugin backend
63
 
64
  == Changelog ==
65
+ = 1.4.6 =
66
+ * Instagram API error quick FIX added
67
+
68
+ = 1.4.5 =
69
+ * Instagram button color options added
70
+ * two gallery pics in a row in mobile
71
+ * browser online check status removed
72
+ * fetch items via WP built-in option
73
+
74
  = 1.4.4 =
75
  * Carousel spacing bug fixed
76
  * some CSS updates
139
 
140
 
141
  == Upgrade Notice ==
142
+ = 1.4.6 =
143
+ update to fix no data error
144
+
145
+ = 1.4.5 =
146
+ now have options to change Instagram button color
147
+
148
  = 1.4.4 =
149
+ Carousel items spacing bug fixed
150
 
151
  = 1.4.3 =
152
+ Carousel images popup working now
153
 
154
  = 1.4.2 =
155
+ Gallery images are now fixed to equal size
156
 
157
  = 1.4.1 =
158
  carousel images sizes fixed
templates/carousel.php CHANGED
@@ -1,14 +1,5 @@
1
  <?php
2
 
3
- $insta_source = ($IGItem['ig_select_from'] == 'username') ? 'user_' . $IGItem['insta_user'] : 'tag_' . $IGItem['insta_tag'];
4
-
5
- $instaUrl = 'https://www.instagram.com/';
6
- if($IGItem['ig_select_from'] == 'username') {
7
- $instaUrl .= $IGItem['insta_user'];
8
- } else {
9
- $instaUrl .= 'explore/tags/'.$IGItem['insta_tag'];
10
- }
11
-
12
  $i = 1;
13
 
14
  $results .= '<div class="swiper-container instacarousel" data-source="' . $insta_source . '" data-hvcolor="'.$IGItem['insta_hover-color'].'" id="instagal-' . $IGItem['gid']. '">';
@@ -50,6 +41,18 @@ if($IGItem['insta_instalink']){
50
  $results .= '<div class="instagallery-actions"><a href="'.$instaUrl.'" target="blank" class="igact-instalink"><span class="dashicons dashicons-external"></span>'.$IGItem['insta_instalink-text'].'</a></div>';
51
  }
52
  $JSICSelector = '#instagal-' . $IGItem['gid'];
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  $results .= "<script>
55
  jQuery(document).ready(function ($) {
@@ -141,4 +144,3 @@ return item.el.attr('data-title');
141
  $results .= "});
142
  </script>";
143
 
144
- // return $results;
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
3
  $i = 1;
4
 
5
  $results .= '<div class="swiper-container instacarousel" data-source="' . $insta_source . '" data-hvcolor="'.$IGItem['insta_hover-color'].'" id="instagal-' . $IGItem['gid']. '">';
41
  $results .= '<div class="instagallery-actions"><a href="'.$instaUrl.'" target="blank" class="igact-instalink"><span class="dashicons dashicons-external"></span>'.$IGItem['insta_instalink-text'].'</a></div>';
42
  }
43
  $JSICSelector = '#instagal-' . $IGItem['gid'];
44
+ $IGBSelector = '#ig-block-'.$IGItem['gid'];
45
+
46
+ $ig_dstyle = '';
47
+ if(!empty($IGItem['insta_instalink-bgcolor'])){
48
+ $ig_dstyle .= $IGBSelector .' .instagallery-actions .igact-instalink {background: '.$IGItem['insta_instalink-bgcolor'].';}';
49
+ }
50
+ if(!empty($IGItem['insta_instalink-hvrcolor'])){
51
+ $ig_dstyle .= $IGBSelector .' .instagallery-actions .igact-instalink:hover {background: '.$IGItem['insta_instalink-hvrcolor'].';}';
52
+ }
53
+ if(!empty($ig_dstyle)){
54
+ $results .= "<script>jQuery(function(){jQuery('head').append('<style>$ig_dstyle</style>');});</script>";
55
+ }
56
 
57
  $results .= "<script>
58
  jQuery(document).ready(function ($) {
144
  $results .= "});
145
  </script>";
146
 
 
templates/gallery.php CHANGED
@@ -1,20 +1,7 @@
1
  <?php
2
 
3
- $insta_source = ($IGItem['ig_select_from'] == 'username') ? 'user_'. $IGItem['insta_user'] : 'tag_'. $IGItem['insta_tag'];
4
-
5
- $instaUrl = 'https://www.instagram.com/';
6
- if($IGItem['ig_select_from'] == 'username') {
7
- $instaUrl .= $IGItem['insta_user'];
8
- } else {
9
- $instaUrl .= 'explore/tags/'.$IGItem['insta_tag'];
10
- }
11
-
12
  $i = 1;
13
- $data_hvcolor = '';
14
- if(!empty($IGItem['insta_hover-color'])){
15
- $data_hvcolor = ' data-hvcolor="'.$IGItem['insta_hover-color'].'" ';
16
- }
17
- $results .= '<div class="instagallery-items instagallery" data-source="'.$insta_source.'" '.$data_hvcolor.' id="instagal-'.$IGItem['gid'].'">';
18
  foreach ($instaItems as $item) {
19
 
20
  $img_src = ($IGItem['insta_gal-cols'] == 1) ? $item['img_standard'] : ((($IGItem['insta_gal-cols'] > 9) || ($IGItem['insta_thumb-size'] == 'small')) ? $item['img_thumb'] : $item['img_low']);
@@ -45,9 +32,27 @@ $results .= '</div>';
45
  if($IGItem['insta_instalink']){
46
  $results .= '<div class="instagallery-actions"><a href="'.$instaUrl.'" target="blank" class="igact-instalink"><span class="dashicons dashicons-external"></span>'.$IGItem['insta_instalink-text'].'</a></div>';
47
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  if ($IGItem['insta_gal-popup']) {
49
 
50
- $JSIGSelector = '#instagal-'.$IGItem['gid'];
51
  $rs = <<<JS
52
  <script>
53
  jQuery(document).ready(function ($) {
@@ -99,5 +104,3 @@ if ($IGItem['insta_gal-popup']) {
99
  JS;
100
  $results .= $rs;
101
  }
102
-
103
- // return $results;
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
3
  $i = 1;
4
+ $results .= '<div class="instagallery-items instagallery" data-source="'.$insta_source.'" id="instagal-'.$IGItem['gid'].'">';
 
 
 
 
5
  foreach ($instaItems as $item) {
6
 
7
  $img_src = ($IGItem['insta_gal-cols'] == 1) ? $item['img_standard'] : ((($IGItem['insta_gal-cols'] > 9) || ($IGItem['insta_thumb-size'] == 'small')) ? $item['img_thumb'] : $item['img_low']);
32
  if($IGItem['insta_instalink']){
33
  $results .= '<div class="instagallery-actions"><a href="'.$instaUrl.'" target="blank" class="igact-instalink"><span class="dashicons dashicons-external"></span>'.$IGItem['insta_instalink-text'].'</a></div>';
34
  }
35
+
36
+
37
+ $JSIGSelector = '#instagal-'.$IGItem['gid'];
38
+ $IGBSelector = '#ig-block-'.$IGItem['gid'];
39
+
40
+ $ig_dstyle = '';
41
+ if(!empty($IGItem['insta_hover-color'])){
42
+ $ig_dstyle .= $JSIGSelector .' .ig-item.ighover a:hover:after, '.$JSIGSelector.' .swiper-slide a:hover:after {background: '.$IGItem['insta_hover-color'].';}';
43
+ }
44
+ if(!empty($IGItem['insta_instalink-bgcolor'])){
45
+ $ig_dstyle .= $IGBSelector .' .instagallery-actions .igact-instalink {background: '.$IGItem['insta_instalink-bgcolor'].';}';
46
+ }
47
+ if(!empty($IGItem['insta_instalink-hvrcolor'])){
48
+ $ig_dstyle .= $IGBSelector .' .instagallery-actions .igact-instalink:hover {background: '.$IGItem['insta_instalink-hvrcolor'].';}';
49
+ }
50
+ if(!empty($ig_dstyle)){
51
+ $results .= "<script>jQuery(function(){jQuery('head').append('<style>$ig_dstyle</style>');});</script>";
52
+ }
53
+
54
  if ($IGItem['insta_gal-popup']) {
55
 
 
56
  $rs = <<<JS
57
  <script>
58
  jQuery(document).ready(function ($) {
104
  JS;
105
  $results .= $rs;
106
  }