Instagram Gallery - Version 1.4.4

Version Description

  • Carousel spacing bug fixed
  • some CSS updates
Download this release

Release Info

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

Code changes from version 1.3.7 to 1.4.4

app/views/edit.php CHANGED
@@ -22,16 +22,10 @@ if (isset($InstaGalleryItem['ig_select_from'])) {
22
  }
23
  $active_gallery = true;
24
  $active_carousel = false;
25
- $active_slider = false;
26
  if (isset($InstaGalleryItem['ig_display_type'])) {
27
  if ($InstaGalleryItem['ig_display_type'] == 'carousel') {
28
  $active_gallery = false;
29
  $active_carousel = true;
30
- $active_slider = false;
31
- } else if ($InstaGalleryItem['ig_display_type'] == 'slider') {
32
- $active_gallery = false;
33
- $active_carousel = false;
34
- $active_slider = true;
35
  }
36
  }
37
 
@@ -114,10 +108,6 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
114
  <?php if($active_carousel) echo 'checked';?> /><label
115
  for="ig_display_type-carousel">Carousel</label>
116
  <div class="check"></div></li>
117
- <li><input type="radio" id="ig_display_type-slider" name="ig_display_type"
118
- value="slider" <?php if($active_slider) echo 'checked';?> /><label
119
- for="ig_display_type-slider">Slider</label>
120
- <div class="check"></div></li>
121
  </ul>
122
  </td>
123
  </tr>
@@ -133,7 +123,7 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
133
  value="<?php if(!empty($InstaGalleryItem['insta_gal-cols'])){echo $InstaGalleryItem['insta_gal-cols']; } else {echo 3;}?>" />
134
  <span class="description">number of pics in a row. </span></td>
135
  <td rowspan="3"><img
136
- src="<?php echo INSGALLERY_URL; ?>/assests/media/demo-gallery.jpg"
137
  alt="demo gallery" width="500" /></td>
138
  </tr>
139
  <tr>
@@ -162,7 +152,7 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
162
  value="<?php if(!empty($InstaGalleryItem['insta_car-slidespv'])){echo $InstaGalleryItem['insta_car-slidespv']; } else {echo 5;}?>" />
163
  <span class="description">display number of pictures per slide view. </span></td>
164
  <td rowspan="5"><img
165
- src="<?php echo INSGALLERY_URL; ?>/assests/media/demo-carousel.jpg"
166
  alt="demo carousel" width="500" /></td>
167
  </tr>
168
  <tr>
@@ -186,64 +176,13 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
186
  </table>
187
  </td>
188
  </tr>
189
- <tr id="ig-section-as-slider"
190
- class="ig-tab-content-row <?php if($active_slider) echo 'active';?>">
191
- <td colspan="100%">
192
- <p>Pictures will be displayed as Slider. (for better display pictures
193
- should be same size.)</p>
194
- <p class="ig-thm-color"
195
- style="font-style: italic; text-decoration: underline;">
196
- <strong>Deprecated:</strong> Slider option will be removed in the future
197
- updates of the plugin, because of pictures different sizes issue.
198
- </p>
199
- <table>
200
- <tr>
201
- <th scope="row">Slide effect:</th>
202
- <td><select name="insta_sli-effect">
203
- <option value="fade">fade</option>
204
- <option value="slide"
205
- <?php echo (isset($InstaGalleryItem['insta_sli-effect']) && ($InstaGalleryItem['insta_sli-effect']=='slide')) ? 'selected' : ''; ?>>slide</option>
206
- </select> <span class="description">sliding effect/animation. </span></td>
207
- <td rowspan="5"><img
208
- src="<?php echo INSGALLERY_URL; ?>/assests/media/demo-slider.jpg"
209
- alt="demo slider" width="500" /></td>
210
- </tr>
211
- <tr>
212
- <th scope="row">Slide timeout:</th>
213
- <td><input name="insta_sli-timeout" type="number" min="100" max="20000"
214
- value="<?php if(!empty($InstaGalleryItem['insta_sli-timeout'])){echo $InstaGalleryItem['insta_sli-timeout']; } else {echo 5000;}?>" />
215
- <span class="description">slide duration in seconds. </span></td>
216
- </tr>
217
- <tr>
218
- <th scope="row">Navigation arrows:</th>
219
- <td><input name="insta_sli-navarrows" type="checkbox" value="1"
220
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_sli-navarrows'])) ? '' : 'checked'; ?> />
221
- <span class="description">show prev-next navigation arrows. </span></td>
222
- </tr>
223
- <tr>
224
- <th scope="row">Dotted navigation:</th>
225
- <td><input name="insta_sli-dots" type="checkbox" value="1"
226
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_sli-dots'])) ? '' : 'checked'; ?> />
227
- <span class="description">show dotted navigation buttons. </span></td>
228
- </tr>
229
- <tr>
230
- <th scope="row">Scrollbar:</th>
231
- <td><input name="insta_sli-scroll" type="checkbox" value="1"
232
- <?php echo (isset($InstaGalleryItem) && empty($InstaGalleryItem['insta_sli-scroll'])) ? '' : 'checked'; ?> />
233
- <span class="description">show scrollbar on slider bottom. </span></td>
234
- </tr>
235
- </table>
236
- </td>
237
- </tr>
238
  <tr>
239
  <th scope="row">Images thumbnail size:</th>
240
  <td><select name="insta_thumb-size">
241
- <option value="medium">Medium</option>
242
  <option value="small"
243
- <?php echo (isset($InstaGalleryItem['insta_thumb-size']) && ($InstaGalleryItem['insta_thumb-size'] == 'small')) ? 'selected' : ''; ?>>Small</option>
244
- </select> <span class="description"><br />select <strong>small (width 150px)</strong>
245
- if gallery items size is <= 150px OR <br /> 8+ images in a row OR
246
- displaying in widget. </span></td>
247
  </tr>
248
  <tr>
249
  <th scope="row">Images hover color:</th>
@@ -321,21 +260,17 @@ if (isset($InstaGalleryItem['ig_display_type'])) {
321
  }
322
  });
323
 
324
- // gallery, carousel, slider toggle
325
  $('input[name="ig_display_type"]').on('change',function(){
326
 
327
  if(this.value == 'gallery'){
328
- $('#ig-section-as-slider,#ig-section-as-carousel').hide(500, function() {
329
  $('#ig-section-as-galllery').show( ).addClass('active');
330
  }).removeClass('active');
331
  }else if(this.value == 'carousel'){
332
- $('#ig-section-as-galllery,#ig-section-as-slider').hide(500, function() {
333
  $('#ig-section-as-carousel').show( ).addClass('active');
334
  }).removeClass('active');
335
- } else {
336
- $('#ig-section-as-galllery,#ig-section-as-carousel').hide(500, function() {
337
- $('#ig-section-as-slider').show( ).addClass('active');
338
- }).removeClass('active');
339
  }
340
 
341
  });
22
  }
23
  $active_gallery = true;
24
  $active_carousel = false;
 
25
  if (isset($InstaGalleryItem['ig_display_type'])) {
26
  if ($InstaGalleryItem['ig_display_type'] == 'carousel') {
27
  $active_gallery = false;
28
  $active_carousel = true;
 
 
 
 
 
29
  }
30
  }
31
 
108
  <?php if($active_carousel) echo 'checked';?> /><label
109
  for="ig_display_type-carousel">Carousel</label>
110
  <div class="check"></div></li>
 
 
 
 
111
  </ul>
112
  </td>
113
  </tr>
123
  value="<?php if(!empty($InstaGalleryItem['insta_gal-cols'])){echo $InstaGalleryItem['insta_gal-cols']; } else {echo 3;}?>" />
124
  <span class="description">number of pics in a row. </span></td>
125
  <td rowspan="3"><img
126
+ src="<?php echo INSGALLERY_URL; ?>/assets/media/demo-gallery.jpg"
127
  alt="demo gallery" width="500" /></td>
128
  </tr>
129
  <tr>
152
  value="<?php if(!empty($InstaGalleryItem['insta_car-slidespv'])){echo $InstaGalleryItem['insta_car-slidespv']; } else {echo 5;}?>" />
153
  <span class="description">display number of pictures per slide view. </span></td>
154
  <td rowspan="5"><img
155
+ src="<?php echo INSGALLERY_URL; ?>/assets/media/demo-carousel.jpg"
156
  alt="demo carousel" width="500" /></td>
157
  </tr>
158
  <tr>
176
  </table>
177
  </td>
178
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  <tr>
180
  <th scope="row">Images thumbnail size:</th>
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>
260
  }
261
  });
262
 
263
+ // gallery, carousel toggle
264
  $('input[name="ig_display_type"]').on('change',function(){
265
 
266
  if(this.value == 'gallery'){
267
+ $('#ig-section-as-carousel').hide(500, function() {
268
  $('#ig-section-as-galllery').show( ).addClass('active');
269
  }).removeClass('active');
270
  }else if(this.value == 'carousel'){
271
+ $('#ig-section-as-galllery').hide(500, function() {
272
  $('#ig-section-as-carousel').show( ).addClass('active');
273
  }).removeClass('active');
 
 
 
 
274
  }
275
 
276
  });
app/views/list.php CHANGED
@@ -166,7 +166,7 @@ if (empty($InstaGalleryItems)) {
166
  <p>
167
  Please Donate now to support the Advancement of this plugin. Thanks <a
168
  class="ig_donation_btn" href="https://www.paypal.me/karanpay" target="blank">Donate
169
- <img src="<?php echo INSGALLERY_URL; ?>/assests/media/paypal-logo.svg"
170
  class="ig-logo" />
171
  </a>
172
  </p>
166
  <p>
167
  Please Donate now to support the Advancement of this plugin. Thanks <a
168
  class="ig_donation_btn" href="https://www.paypal.me/karanpay" target="blank">Donate
169
+ <img src="<?php echo INSGALLERY_URL; ?>/assets/media/paypal-logo.svg"
170
  class="ig-logo" />
171
  </a>
172
  </p>
app/wp-front.php CHANGED
@@ -3,64 +3,67 @@ if (! defined('ABSPATH')) {
3
  die();
4
  }
5
 
6
- // Registering css.
7
- add_action('wp_enqueue_scripts', 'insgal_enqueue_scripts');
8
-
9
- function insgal_enqueue_scripts()
10
- {
11
- wp_enqueue_style('insta-gallery', INSGALLERY_URL . '/assests/insta-gallery.css');
12
- wp_enqueue_style( 'dashicons' );
13
-
14
- wp_register_script('insta-gallery', INSGALLERY_URL . '/assests/insta-gallery.js', array('jquery'),null,true);
15
- wp_localize_script( 'insta-gallery', 'insgalajax', array(
16
- 'ajax_url' => admin_url( 'admin-ajax.php' )
17
- ));
18
- wp_register_script('swiper', INSGALLERY_URL . '/assests/swiper/swiper.jquery.min.js', array('jquery'),null,true);
19
- wp_register_script('magnific-popup', INSGALLERY_URL . '/assests/magnific-popup/jquery.magnific-popup.min.js', array('jquery'),null,true);
20
-
21
- }
22
- include_once (INSGALLERY_PATH . 'app/Libra/InstagramSpider.php');
23
-
24
-
25
- // shortcode added
26
- add_shortcode('insta-gallery', 'insta_gallery');
27
-
28
- // Insta-Gallery shortcode handler
29
- function insta_gallery($atts)
30
- {
31
- if (empty($atts) || ! isset($atts['id'])) {
32
- return;
33
- }
34
- $gid = (int) $atts['id'];
35
- $InstaGalleryItems = get_option('insta_gallery_items');
36
- $InstaGallerySetting = get_option('insta_gallery_setting');
37
- if (! isset($InstaGalleryItems[$gid])) {
38
- return;
39
- }
40
-
41
- wp_enqueue_script('insta-gallery');
42
-
43
- $IGItem = $InstaGalleryItems[$gid];
44
- if ($IGItem['ig_display_type'] == 'gallery') {
45
- wp_enqueue_script('magnific-popup');
46
- } else if ($IGItem['ig_display_type'] == 'carousel') {
47
- wp_enqueue_script('swiper');
48
- wp_enqueue_script('magnific-popup');
49
- } else {
50
- wp_enqueue_script('swiper');
51
- }
52
-
53
- $insta_source = ($IGItem['ig_select_from'] == 'username') ? 'user_'. $IGItem['insta_user'] : 'tag_'. $IGItem['insta_tag'];
54
-
55
-
56
- $results = '';
57
- $results .= '<!--[if lte IE 8]><div class="igblock-wrap-IElte8"><![endif]-->';
58
- $results .= '<div class="ig-block" data-igalid="'.$gid.'" data-source="'.$insta_source.'">';
59
- $results .= '<div class="ig-spinner">';
60
- if(!empty($InstaGallerySetting['igs_spinner'])){
61
- $results .= '<img src="'.$InstaGallerySetting['igs_spinner'].'" alt="Instagram Gallery" class="ig-spin" />';
62
- }else {
63
- $results .= '<svg version="1.1" class="ig-spin" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
 
 
 
64
  viewBox="0 0 551.034 551.034" style="enable-background:new 0 0 551.034 551.034;" xml:space="preserve">
65
  <g>
66
  <linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="275.517" y1="4.57" x2="275.517" y2="549.72" gradientTransform="matrix(1 0 0 -1 0 554)">
@@ -92,130 +95,138 @@ function insta_gallery($atts)
92
  <circle style="fill:url(#SVGID_3_);" cx="418.31" cy="134.07" r="34.15"/>
93
  </g>
94
  </svg>';
95
- }
96
- $results .= '</div>';
97
- $results .= '</div> <!-- // IG BLOCK -->';
98
- $results .= '<!--[if lte IE 8]></div><![endif]-->';
99
- return $results;
100
- }
101
-
102
-
103
- // ajax request served
104
- add_action( 'wp_ajax_nopriv_load_ig_item', 'load_ig_item' );
105
- add_action( 'wp_ajax_load_ig_item', 'load_ig_item' );
106
-
107
- function load_ig_item() {
108
- //echo json_encode(array('igsuccess' => true, 'result' => 'asia'));die();
109
- if (! isset($_POST['igalid']) ) {
110
- return;
111
- }
112
- $gid = (int)$_POST['igalid'];
113
- $InstaGalleryItems = get_option('insta_gallery_items');
114
- if (! isset($InstaGalleryItems[$gid])) {
115
- return;
116
- }
117
- $IGItem = $InstaGalleryItems[$gid];
118
- $IGItem['gid'] = $gid; // push gallery ID for later use
119
- $igs = new InstagramSpider();
120
-
121
- // validating options
122
- if (empty($IGItem['ig_select_from'])) {
123
- return;
124
- }
125
- $IGItem['insta_limit'] = (int) $IGItem['insta_limit'];
126
- $IGItem['insta_limit'] = (($IGItem['insta_limit'] > 0) && ($IGItem['insta_limit'] <= 20)) ? $IGItem['insta_limit'] : 12;
127
-
128
- $IGItem['insta_gal-hover'] = filter_var($IGItem['insta_gal-hover'], FILTER_VALIDATE_BOOLEAN);
129
- $IGItem['insta_gal-spacing'] = filter_var($IGItem['insta_gal-spacing'], FILTER_VALIDATE_BOOLEAN);
130
- $IGItem['insta_instalink'] = filter_var($IGItem['insta_instalink'], FILTER_VALIDATE_BOOLEAN);
131
- $IGItem['insta_instalink-text'] = empty($IGItem['insta_instalink-text']) ? 'view on Instagram' : $IGItem['insta_instalink-text'];
132
-
133
- $IGItem['insta_car-navarrows'] = @filter_var($IGItem['insta_car-navarrows'], FILTER_VALIDATE_BOOLEAN);
134
- $IGItem['insta_car-dots'] = @filter_var($IGItem['insta_car-dots'], FILTER_VALIDATE_BOOLEAN);
135
- $IGItem['insta_car-spacing'] = @filter_var($IGItem['insta_car-spacing'], FILTER_VALIDATE_BOOLEAN);
136
-
137
- $IGItem['insta_sli-navarrows'] = filter_var($IGItem['insta_sli-navarrows'], FILTER_VALIDATE_BOOLEAN);
138
- $IGItem['insta_sli-dots'] = filter_var($IGItem['insta_sli-dots'], FILTER_VALIDATE_BOOLEAN);
139
- $IGItem['insta_sli-scroll'] = filter_var($IGItem['insta_sli-scroll'], FILTER_VALIDATE_BOOLEAN);
140
-
141
- $IGItem['insta_thumb-size'] = empty($IGItem['insta_thumb-size']) ? 'medium' : $IGItem['insta_thumb-size'];
142
- $IGItem['insta_hover-color'] = @$IGItem['insta_hover-color'];
143
- $IGItem['insta_gal-popup'] = filter_var($IGItem['insta_gal-popup'], FILTER_VALIDATE_BOOLEAN);
144
- $IGItem['insta_likes'] = @filter_var($IGItem['insta_likes'], FILTER_VALIDATE_BOOLEAN);
145
- $IGItem['insta_comments'] = @filter_var($IGItem['insta_comments'], FILTER_VALIDATE_BOOLEAN);
146
-
147
- // continue to results
148
- $results = '';
149
- $instaItems = '';
150
- if ($IGItem['ig_select_from'] == 'username') { // get from username
151
- if (! empty($IGItem['insta_user'])) { // valid Instagram Username
152
- $instaItems = $igs->getUserItems($IGItem['insta_user']);
153
- }
154
- } else { // continue to tag
155
- if (! empty($IGItem['insta_tag'])) { // valid Instagram Tag;
156
- $instaItems = $igs->getTagItems($IGItem['insta_tag']);
157
- }
158
- }
159
-
160
- if (! empty($instaItems)) {
161
-
162
- if ($IGItem['ig_display_type'] == 'gallery') {
163
- include (INSGALLERY_PATH . 'templates/gallery.php');
164
- } else if ($IGItem['ig_display_type'] == 'carousel') {
165
- include (INSGALLERY_PATH . 'templates/carousel.php');
166
- } else {
167
- include (INSGALLERY_PATH . 'templates/slider.php');
168
- }
169
- } else {
170
- if (current_user_can('administrator')) {
171
- $results .= '<div class="ig-no-items-msg"><p class="ig_front_msg-color"><strong>(Admin Notice) ERROR:</strong> unable to get results. possible reasons:</p>';
172
- $results .= '<ul>';
173
- $results .= '<li>your Instagram account may be private.</li>';
174
- $results .= '<li>inavalid Instagram username/tag.</li>';
175
- $results .= '<li>network or server issue.</li>';
176
-
177
- $igsMsgs = $igs->getMessages();
178
- if(!empty($igsMsgs)){
179
- foreach ($igsMsgs as $igsMsg){
180
- $results .= "<li>$igsMsg</li>";
181
- }
182
- }
183
-
184
- $results .= '</ul></div>';
185
- }
186
- }
187
- // echo $results;
188
- $result = array(
189
- 'igsuccess' => true,
190
- 'result' => $results,
191
- );
192
- echo json_encode($result);
193
- die();
194
- }
195
-
196
- /**
197
- * ****
198
- *
199
- *
200
- *
201
- *
202
- * OLD shortcode warning
203
- *
204
- *
205
- *
206
- *
207
- */
208
- // shortcode added
209
- add_shortcode('Insta-Gallery', 'instaGallery');
210
- // Insta-Gallery shortcode handler
211
- function instaGallery($atts)
212
- {
213
- $results = '';
214
- // deprecated warning
215
- if (current_user_can('administrator')) {
216
- $results .= '<p class="ig-deprecated-shortcode-msg ig_front_msg-color"><strong>(Admin Notice) Shortcode Removed:</strong> It looks like you are using old shortcode. Please goto Instagram Gallery plugin page and regenerate new shortcode. </p>';
217
- }
218
- return $results;
219
- }
220
-
221
-
 
 
 
 
 
 
 
 
3
  die();
4
  }
5
 
6
+ // registering session
7
+ /* add_action('init', function(){
8
+ if( !session_id() )
9
+ session_start();
10
+ }); */
11
+
12
+ // Registering css.
13
+ add_action('wp_enqueue_scripts', 'insgal_enqueue_scripts');
14
+ function insgal_enqueue_scripts()
15
+ {
16
+ wp_enqueue_style('insta-gallery', INSGALLERY_URL . '/assets/insta-gallery.css',array(),INSGALLERY_VER);
17
+ wp_enqueue_style( 'dashicons' );
18
+
19
+ wp_register_script('insta-gallery', INSGALLERY_URL . '/assets/insta-gallery.js', array('jquery'),INSGALLERY_VER,true);
20
+ wp_localize_script( 'insta-gallery', 'insgalajax', array(
21
+ 'ajax_url' => admin_url( 'admin-ajax.php' )
22
+ ));
23
+ wp_register_script('swiper', INSGALLERY_URL . '/assets/swiper/swiper.jquery.min.js', array('jquery'),null,true);
24
+ wp_register_script('magnific-popup', INSGALLERY_URL . '/assets/magnific-popup/jquery.magnific-popup.min.js', array('jquery'),null,true);
25
+
26
+ }
27
+ include_once (INSGALLERY_PATH . 'app/Libra/InstagramSpider.php');
28
+
29
+
30
+ // shortcode added
31
+ add_shortcode('insta-gallery', 'insta_gallery');
32
+
33
+ // Insta-Gallery shortcode handler
34
+ function insta_gallery($atts)
35
+ {
36
+ if (empty($atts) || ! isset($atts['id'])) {
37
+ return;
38
+ }
39
+ $gid = (int) $atts['id'];
40
+ $InstaGalleryItems = get_option('insta_gallery_items');
41
+ $InstaGallerySetting = get_option('insta_gallery_setting');
42
+ if (! isset($InstaGalleryItems[$gid])) {
43
+ return;
44
+ }
45
+
46
+ wp_enqueue_script('insta-gallery');
47
+
48
+ $IGItem = $InstaGalleryItems[$gid];
49
+ if ($IGItem['ig_display_type'] == 'gallery') {
50
+ wp_enqueue_script('magnific-popup');
51
+ } else if ($IGItem['ig_display_type'] == 'carousel') {
52
+ wp_enqueue_script('swiper');
53
+ wp_enqueue_script('magnific-popup');
54
+ }
55
+
56
+ $insta_source = ($IGItem['ig_select_from'] == 'username') ? 'user_'. $IGItem['insta_user'] : 'tag_'. $IGItem['insta_tag'];
57
+
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" />';
65
+ }else {
66
+ $results .= '<svg version="1.1" class="ig-spin" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
67
  viewBox="0 0 551.034 551.034" style="enable-background:new 0 0 551.034 551.034;" xml:space="preserve">
68
  <g>
69
  <linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="275.517" y1="4.57" x2="275.517" y2="549.72" gradientTransform="matrix(1 0 0 -1 0 554)">
95
  <circle style="fill:url(#SVGID_3_);" cx="418.31" cy="134.07" r="34.15"/>
96
  </g>
97
  </svg>';
98
+ }
99
+ $results .= '</div>';
100
+ $results .= '</div> <!-- // IG BLOCK -->';
101
+ $results .= '<!--[if lte IE 8]></div><![endif]-->';
102
+ return $results;
103
+ }
104
+
105
+
106
+ // ajax request served
107
+ add_action( 'wp_ajax_nopriv_load_ig_item', 'load_ig_item' );
108
+ add_action( 'wp_ajax_load_ig_item', 'load_ig_item' );
109
+
110
+ function load_ig_item() {
111
+ // loading session for AJAX request
112
+ if( !session_id()){
113
+ session_start();
114
+ }
115
+
116
+ if (! isset($_POST['igalid']) ) {
117
+ return;
118
+ }
119
+ $gid = (int)$_POST['igalid'];
120
+ $InstaGalleryItems = get_option('insta_gallery_items');
121
+ if (! isset($InstaGalleryItems[$gid])) {
122
+ return;
123
+ }
124
+ $IGItem = $InstaGalleryItems[$gid];
125
+ $IGItem['gid'] = $gid; // push gallery ID for later use
126
+ $igs = new InstagramSpider();
127
+
128
+ // validating options
129
+ if (empty($IGItem['ig_select_from'])) {
130
+ return;
131
+ }
132
+ $IGItem['insta_limit'] = (int) $IGItem['insta_limit'];
133
+ $IGItem['insta_limit'] = (($IGItem['insta_limit'] > 0) && ($IGItem['insta_limit'] <= 20)) ? $IGItem['insta_limit'] : 12;
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);
142
+ $IGItem['insta_car-spacing'] = @filter_var($IGItem['insta_car-spacing'], FILTER_VALIDATE_BOOLEAN);
143
+
144
+ $IGItem['insta_thumb-size'] = empty($IGItem['insta_thumb-size']) ? 'medium' : $IGItem['insta_thumb-size'];
145
+ $IGItem['insta_hover-color'] = @$IGItem['insta_hover-color'];
146
+ $IGItem['insta_gal-popup'] = filter_var($IGItem['insta_gal-popup'], FILTER_VALIDATE_BOOLEAN);
147
+ $IGItem['insta_likes'] = @filter_var($IGItem['insta_likes'], FILTER_VALIDATE_BOOLEAN);
148
+ $IGItem['insta_comments'] = @filter_var($IGItem['insta_comments'], FILTER_VALIDATE_BOOLEAN);
149
+
150
+ // continue to results
151
+ $results = '';
152
+ $instaItems = '';
153
+ $igsess_time = (current_user_can('administrator')) ? 60 : 300;
154
+ if ($IGItem['ig_select_from'] == 'username') { // get from username
155
+ if (! empty($IGItem['insta_user'])) { // valid Instagram Username
156
+ $sk = 'user_'.$IGItem['insta_user'];
157
+ if(isset($_SESSION['IGSession'][$sk])) {
158
+ $time = ($igsess_time - (time() - $_SESSION['IGSession'][$sk]['started']));
159
+ if($time <= 0) { // refresh session if expired
160
+ $instaItems = $igs->getUserItems($IGItem['insta_user']);
161
+ $_SESSION['IGSession'][$sk]['started'] = time();
162
+ $_SESSION['IGSession'][$sk]['items'] = $instaItems;
163
+ }else {
164
+ $instaItems = $_SESSION['IGSession'][$sk]['items'];
165
+ }
166
+ } else { // create new session
167
+ $instaItems = $igs->getUserItems($IGItem['insta_user']);
168
+ $_SESSION['IGSession'][$sk]['started'] = time();
169
+ $_SESSION['IGSession'][$sk]['items'] = $instaItems;
170
+ }
171
+ }
172
+ } else { // continue to tag
173
+ if (! empty($IGItem['insta_tag'])) { // valid Instagram Tag;
174
+ $sk = 'tag_'.$IGItem['insta_tag'];
175
+ if(isset($_SESSION['IGSession'][$sk])){
176
+ $time = ($igsess_time - (time() - $_SESSION['IGSession'][$sk]['started']));
177
+ if($time <= 0) { // refresh session if expired
178
+ $instaItems = $igs->getTagItems($IGItem['insta_tag']);
179
+ $_SESSION['IGSession'][$sk]['started'] = time();
180
+ $_SESSION['IGSession'][$sk]['items'] = $instaItems;
181
+ }else {
182
+ $instaItems = $_SESSION['IGSession'][$sk]['items'];
183
+ }
184
+ } else { // create new session
185
+ $instaItems = $igs->getTagItems($IGItem['insta_tag']);
186
+ $_SESSION['IGSession'][$sk]['started'] = time();
187
+ $_SESSION['IGSession'][$sk]['items'] = $instaItems;
188
+ }
189
+ }
190
+ }
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') {
197
+ include (INSGALLERY_PATH . 'templates/carousel.php');
198
+ } else {
199
+ if (current_user_can('administrator')) {
200
+ $results .= '<div class="ig-no-items-msg"><p class="ig_front_msg-color">ERROR: invalid display type, please check gallery settings.</p></div>';
201
+ }
202
+ }
203
+ } else {
204
+ if (current_user_can('administrator')) {
205
+ $results .= '<div class="ig-no-items-msg"><p class="ig_front_msg-color"><strong>(Admin Notice) ERROR:</strong> unable to get results. possible reasons:</p>';
206
+ $results .= '<ul>';
207
+ $results .= '<li>your Instagram account may be private.</li>';
208
+ $results .= '<li>inavalid Instagram username/tag.</li>';
209
+ $results .= '<li>network or server issue.</li>';
210
+
211
+ $igsMsgs = $igs->getMessages();
212
+ if(!empty($igsMsgs)){
213
+ foreach ($igsMsgs as $igsMsg){
214
+ $results .= "<li>$igsMsg</li>";
215
+ }
216
+ }
217
+
218
+ $results .= '</ul></div>';
219
+ }
220
+ }
221
+ // echo $results;
222
+ $result = array(
223
+ 'igsuccess' => true,
224
+ 'result' => $results,
225
+ );
226
+ echo json_encode($result);
227
+ die();
228
+ }
229
+
230
+
231
+
232
+
app/wp-panel.php CHANGED
@@ -25,18 +25,13 @@ if (isset($_POST['ig-form-update'])) {
25
  $IGItem['insta_gal-hover'] = @$POSTDATA['insta_gal-hover'];
26
  $IGItem['insta_gal-spacing'] = @$POSTDATA['insta_gal-spacing'];
27
  $IGItem['insta_instalink'] = @$POSTDATA['insta_instalink'];
28
- $IGItem['insta_instalink-text'] = trim(@$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'];
32
  $IGItem['insta_car-spacing'] = @$POSTDATA['insta_car-spacing'];
33
- $IGItem['insta_sli-effect'] = $POSTDATA['insta_sli-effect'];
34
- $IGItem['insta_sli-timeout'] = $POSTDATA['insta_sli-timeout'];
35
- $IGItem['insta_sli-navarrows'] = @$POSTDATA['insta_sli-navarrows'];
36
- $IGItem['insta_sli-dots'] = @$POSTDATA['insta_sli-dots'];
37
- $IGItem['insta_sli-scroll'] = @$POSTDATA['insta_sli-scroll'];
38
  $IGItem['insta_thumb-size'] = @$POSTDATA['insta_thumb-size'];
39
- $IGItem['insta_hover-color'] = @$POSTDATA['insta_hover-color'];
40
  $IGItem['insta_gal-popup'] = @$POSTDATA['insta_gal-popup'];
41
  $IGItem['insta_likes'] = @$POSTDATA['insta_likes'];
42
  $IGItem['insta_comments'] = @$POSTDATA['insta_comments'];
@@ -77,7 +72,7 @@ if (isset($_GET['ig_item_delete'])) {
77
  <div id="ig-page">
78
  <div class="wrap">
79
  <header class="ig-page-header">
80
- <img src="<?php echo INSGALLERY_URL; ?>/assests/media/icon-128x128.jpg" class="ig-logo" />
81
  <h3>Instagram Gallery:</h3>
82
  <p>easy way to display your Instagram pictures on the website.</p>
83
  </header>
25
  $IGItem['insta_gal-hover'] = @$POSTDATA['insta_gal-hover'];
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'];
32
  $IGItem['insta_car-spacing'] = @$POSTDATA['insta_car-spacing'];
 
 
 
 
 
33
  $IGItem['insta_thumb-size'] = @$POSTDATA['insta_thumb-size'];
34
+ $IGItem['insta_hover-color'] = sanitize_text_field(@$POSTDATA['insta_hover-color']);
35
  $IGItem['insta_gal-popup'] = @$POSTDATA['insta_gal-popup'];
36
  $IGItem['insta_likes'] = @$POSTDATA['insta_likes'];
37
  $IGItem['insta_comments'] = @$POSTDATA['insta_comments'];
72
  <div id="ig-page">
73
  <div class="wrap">
74
  <header class="ig-page-header">
75
+ <img src="<?php echo INSGALLERY_URL; ?>/assets/media/icon-128x128.jpg" class="ig-logo" />
76
  <h3>Instagram Gallery:</h3>
77
  <p>easy way to display your Instagram pictures on the website.</p>
78
  </header>
assests/media/demo-slider.jpg DELETED
Binary file
{assests → assets}/admin-style.css RENAMED
File without changes
{assests → assets}/insta-gallery.css RENAMED
@@ -29,15 +29,17 @@
29
  padding: 10px;
30
  box-sizing: border-box;
31
  text-align: center;
 
32
  }
33
  .ig-item.no-spacing {
34
  padding: 0px;
35
  }
36
  .ig-item a{
37
- display: inline-block;
38
  width: 100%;
39
  position: relative;
40
  text-align: center;
 
41
  }
42
  .ig-item.ighover a:after {
43
  content: "";
@@ -50,21 +52,22 @@
50
  -webkit-transition: all .3s ease;
51
  transition: all .3s ease;
52
  opacity: 0;
 
53
  }
54
  .ig-item.ighover a:hover:after {
55
  background: #007aff;
56
- width: 90%;
57
- height: 90%;
58
  opacity: 0.5;
59
  left: 0px;
60
- top: 0px;
61
- margin:5%;
62
  }
63
  .instagallery-items .ig-item a img{
64
  margin: auto;
65
  max-width: 100%;
66
  -webkit-box-shadow: none;
67
  box-shadow: none;
 
68
  }
69
  .ig-likes-comments {
70
  position: absolute;
29
  padding: 10px;
30
  box-sizing: border-box;
31
  text-align: center;
32
+ vertical-align: middle;
33
  }
34
  .ig-item.no-spacing {
35
  padding: 0px;
36
  }
37
  .ig-item a{
38
+ display: block;
39
  width: 100%;
40
  position: relative;
41
  text-align: center;
42
+ overflow: hidden;
43
  }
44
  .ig-item.ighover a:after {
45
  content: "";
52
  -webkit-transition: all .3s ease;
53
  transition: all .3s ease;
54
  opacity: 0;
55
+ margin:0;
56
  }
57
  .ig-item.ighover a:hover:after {
58
  background: #007aff;
59
+ width: 100%;
60
+ height: 100%;
61
  opacity: 0.5;
62
  left: 0px;
63
+ top: 0px;
 
64
  }
65
  .instagallery-items .ig-item a img{
66
  margin: auto;
67
  max-width: 100%;
68
  -webkit-box-shadow: none;
69
  box-shadow: none;
70
+ display: block;
71
  }
72
  .ig-likes-comments {
73
  position: absolute;
{assests → assets}/insta-gallery.js RENAMED
@@ -1,5 +1,5 @@
1
  /**
2
- * Instagram Gallery 1.3.6
3
  * script for insta-gallery wp plugin
4
  *
5
  */
1
  /**
2
+ * Instagram Gallery 1.4.1
3
  * script for insta-gallery wp plugin
4
  *
5
  */
{assests → assets}/magnific-popup/jquery.magnific-popup.min.js RENAMED
File without changes
{assests → assets}/magnific-popup/magnific-popup.css RENAMED
File without changes
{assests → assets}/media/demo-carousel.jpg RENAMED
File without changes
{assests → assets}/media/demo-gallery.jpg RENAMED
File without changes
{assests → assets}/media/icon-128x128.jpg RENAMED
File without changes
{assests → assets}/media/paypal-logo.svg RENAMED
File without changes
{assests → assets}/swiper/maps/swiper.jquery.min.js.map RENAMED
File without changes
{assests → assets}/swiper/swiper.jquery.min.js RENAMED
File without changes
{assests → assets}/swiper/swiper.min.css RENAMED
File without changes
insta-gallery.php CHANGED
@@ -5,10 +5,11 @@
5
  * Author: Karan Singh
6
  * Author URI: https://www.karansingh.ml/
7
  * Text Domain: insta-gallery
8
- * Version: 1.3.7
9
  */
10
 
11
  // plugin global constants
 
12
  define('INSGALLERY_PATH', plugin_dir_path(__FILE__));
13
  define('INSGALLERY_URL', plugins_url('', __FILE__));
14
 
@@ -89,7 +90,7 @@ class INSGALLERY
89
  if ($hook != 'settings_page_insta_gallery') {
90
  return;
91
  }
92
- wp_enqueue_style('insta-gallery-admin', INSGALLERY_URL . '/assests/admin-style.css');
93
  }
94
 
95
  function loadMenus()
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
 
90
  if ($hook != 'settings_page_insta_gallery') {
91
  return;
92
  }
93
+ wp_enqueue_style('insta-gallery-admin', INSGALLERY_URL . '/assets/admin-style.css');
94
  }
95
 
96
  function loadMenus()
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.3.7
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
@@ -13,14 +13,12 @@ Instagram Gallery is an easy way to display your Instagram pictures on the websi
13
  == Description ==
14
 
15
  Easy and simple way to display your Instagram images on the website.
16
- Display pictures from Instagram account as Gallery or as Carousel Slider. For this you have to paste your Instagram account username. It's also supports to display pictures from Instagram #Tag.
17
- Plugin updates new pictures as you upload new-one on Instagram.
18
 
19
- **Note:** Profile needs to be publicly visible to show pictures.
20
 
21
- **Demo:** you can see live demo [HERE](https://www.karansingh.ml/public/demo/insta-gallery/). or check 'screenshots' section for demo.
22
-
23
- **How to use:** add new gallery in plugin setting panel, generate shortcode and paste them in the pages/post content OR use the "echo do_shortcode( '[MyShortcode]' );" php code to add them in PHP file.
24
 
25
 
26
  == Installation ==
@@ -39,26 +37,52 @@ Upload and install in the same way you'd install any other plugin OR see [HERE](
39
 
40
  == Frequently Asked Questions ==
41
 
42
- = why my pictures are not showing on page? =
43
 
44
  profile needs to be publicly visible to show pictures.
45
 
46
- = can i display pictures by using #Tag? =
 
 
 
 
47
 
48
  Yes you can.
49
 
50
- = why there are two popups on image click? =
51
 
52
  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.
53
 
 
 
 
 
54
  == Screenshots ==
55
 
56
- 1. Plugin backend
57
- 2. Gallery front-end view
58
- 3. Gallery front-end view with image popup
59
- 4. Carousel Slider view
60
 
61
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  = 1.3.7 =
63
  * Instagram profile link/button added in Carousel view
64
  * wp_nonce removed because of conflicts with cache plugins
@@ -109,6 +133,18 @@ there may be some other plugins(like: fancybox) which also uses image links to o
109
 
110
 
111
  == Upgrade Notice ==
 
 
 
 
 
 
 
 
 
 
 
 
112
  = 1.3.7 =
113
  cache confliction fixed
114
 
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
13
  == Description ==
14
 
15
  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
 
23
 
24
  == Installation ==
37
 
38
  == Frequently Asked Questions ==
39
 
40
+ = Why my pictures are not showing on page? =
41
 
42
  profile needs to be publicly visible to show pictures.
43
 
44
+ = Can i add same Shortcode twice on a page? =
45
+
46
+ Yes, but sometimes it can conflicts with each other. So, try to create new gallery with same setting and add them.
47
+
48
+ = Can i display pictures by using #Tag? =
49
 
50
  Yes you can.
51
 
52
+ = Why there are two popups on image click? =
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
 
62
+ 1. Gallery front-end view
63
+ 2. Gallery front-end view with image popup
64
+ 3. Carousel Slider view
65
+ 4. Plugin backend
66
 
67
  == Changelog ==
68
+ = 1.4.4 =
69
+ * Carousel spacing bug fixed
70
+ * some CSS updates
71
+
72
+ = 1.4.3 =
73
+ * Carousel popup bug fixed
74
+ * added version to assets
75
+
76
+ = 1.4.2 =
77
+ * Gallery image sizes fixed to square display
78
+ * some CSS fixes
79
+
80
+ = 1.4.1 =
81
+ * Carousel image sizes fixed to square display
82
+ * added caching of images to speedup loading
83
+ * display type Slider removed
84
+ * old-shortcode warning message removed
85
+
86
  = 1.3.7 =
87
  * Instagram profile link/button added in Carousel view
88
  * wp_nonce removed because of conflicts with cache plugins
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
147
+
148
  = 1.3.7 =
149
  cache confliction fixed
150
 
templates/carousel.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
 
3
  $insta_source = ($IGItem['ig_select_from'] == 'username') ? 'user_' . $IGItem['insta_user'] : 'tag_' . $IGItem['insta_tag'];
4
 
@@ -19,7 +19,7 @@ foreach ($instaItems as $item) {
19
  $img_src = ($IGItem['insta_car-slidespv'] == 1) ? $item['img_standard'] : ((($IGItem['insta_car-slidespv'] > 10) || ($IGItem['insta_thumb-size'] == 'small')) ? $item['img_thumb'] : $item['img_low']);
20
  $results .= '<div class="swiper-slide" >';
21
  $results .= '<a href="' . $item['img_standard'] . '" target="blank" data-title="' .$item['caption']. '" class="nofancybox">'; // ' .substr($item['caption'],0,120). '
22
- $results .= '<img alt="instagram" src="' . $img_src. '" />';
23
  // $results .= '<img data-src="' . $img_src. '" class="swiper-lazy" /><div class="swiper-lazy-preloader"></div>';
24
  if ($IGItem['insta_likes'] || $IGItem['insta_comments']) {
25
  $results .= '<span class="ic-likes-comments">';
@@ -53,8 +53,34 @@ $JSICSelector = '#instagal-' . $IGItem['gid'];
53
 
54
  $results .= "<script>
55
  jQuery(document).ready(function ($) {
56
- var mySwiper = new Swiper ('$JSICSelector', {
57
- loop: true,autoplay: 3000,";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  if ($IGItem['insta_car-dots']) {
59
  $results .= "pagination: '.swiper-pagination',
60
  ";
@@ -63,7 +89,7 @@ if ($IGItem['insta_car-navarrows']) {
63
  $results .= "nextButton: '.swiper-button-next',
64
  prevButton: '.swiper-button-prev',paginationClickable: true,";
65
  }
66
- if ($car_spacing) {
67
  $results .= "spaceBetween: 20,";
68
  }
69
 
@@ -89,28 +115,28 @@ $results .= "}";
89
 
90
  $results .= "});";
91
 
92
- if ($IGItem['insta_car-spacing']) {
93
-
94
  $results .= "jQuery('$JSICSelector .swiper-slide>a').magnificPopup({
95
- type: 'image',
96
- mainClass: 'mfp-with-zoom',
97
- zoom: {
98
- enabled: true,
99
- duration: 300,
100
- easing: 'ease-in-out',
101
- opener: function(openerElement) {
102
- return openerElement.is('img') ? openerElement : openerElement.find('img');
103
- }
104
- },
105
- gallery: {
106
- enabled: true
107
- },
108
- image: {
109
- titleSrc: function(item) {
110
- return item.el.attr('data-title');
111
- }
112
- }
113
- });";
114
  }
115
  $results .= "});
116
  </script>";
1
+ <?php
2
 
3
  $insta_source = ($IGItem['ig_select_from'] == 'username') ? 'user_' . $IGItem['insta_user'] : 'tag_' . $IGItem['insta_tag'];
4
 
19
  $img_src = ($IGItem['insta_car-slidespv'] == 1) ? $item['img_standard'] : ((($IGItem['insta_car-slidespv'] > 10) || ($IGItem['insta_thumb-size'] == 'small')) ? $item['img_thumb'] : $item['img_low']);
20
  $results .= '<div class="swiper-slide" >';
21
  $results .= '<a href="' . $item['img_standard'] . '" target="blank" data-title="' .$item['caption']. '" class="nofancybox">'; // ' .substr($item['caption'],0,120). '
22
+ $results .= '<img alt="instagram" class="instacarousel-image" src="' . $img_src. '" />';
23
  // $results .= '<img data-src="' . $img_src. '" class="swiper-lazy" /><div class="swiper-lazy-preloader"></div>';
24
  if ($IGItem['insta_likes'] || $IGItem['insta_comments']) {
25
  $results .= '<span class="ic-likes-comments">';
53
 
54
  $results .= "<script>
55
  jQuery(document).ready(function ($) {
56
+ var mySwiper;
57
+ // resize images to square
58
+ var instacarouselImages = $('$JSICSelector img.instacarousel-image');
59
+ if(instacarouselImages.length){
60
+ var totalImages = instacarouselImages.length, imagesLoaded = 0,minHeight = 0;
61
+ instacarouselImages.load(function(){
62
+ imagesLoaded++;
63
+ if(minHeight == 0)minHeight = $(this).height();
64
+ // if(minHeight > $(this).height())minHeight = $(this).height();
65
+ if(($(this).width() == $(this).height()))minHeight = $(this).height();
66
+ if(imagesLoaded >= totalImages){
67
+ $('$JSICSelector img.instacarousel-image').each(function(){
68
+ var i = $(this);
69
+ var th = i.height();
70
+ if(minHeight < th){
71
+ var m = (th-minHeight)/2;
72
+ $(this).css('margin-top','-'+m+'px');
73
+ $(this).css('margin-bottom','-'+m+'px');
74
+ }
75
+ });
76
+ mySwiper.update();
77
+ }
78
+ });
79
+ }
80
+
81
+ mySwiper = new Swiper ('$JSICSelector', {
82
+ loop: true,autoplay: 3000,
83
+ autoHeight:true,";
84
  if ($IGItem['insta_car-dots']) {
85
  $results .= "pagination: '.swiper-pagination',
86
  ";
89
  $results .= "nextButton: '.swiper-button-next',
90
  prevButton: '.swiper-button-prev',paginationClickable: true,";
91
  }
92
+ if ($IGItem['insta_car-spacing']) {
93
  $results .= "spaceBetween: 20,";
94
  }
95
 
115
 
116
  $results .= "});";
117
 
118
+ if ($IGItem['insta_gal-popup']) {
119
+
120
  $results .= "jQuery('$JSICSelector .swiper-slide>a').magnificPopup({
121
+ type: 'image',
122
+ mainClass: 'mfp-with-zoom',
123
+ zoom: {
124
+ enabled: true,
125
+ duration: 300,
126
+ easing: 'ease-in-out',
127
+ opener: function(openerElement) {
128
+ return openerElement.is('img') ? openerElement : openerElement.find('img');
129
+ }
130
+ },
131
+ gallery: {
132
+ enabled: true
133
+ },
134
+ image: {
135
+ titleSrc: function(item) {
136
+ return item.el.attr('data-title');
137
+ }
138
+ }
139
+ });";
140
  }
141
  $results .= "});
142
  </script>";
templates/gallery.php CHANGED
@@ -18,44 +18,67 @@ $results .= '<div class="instagallery-items instagallery" data-source="'.$insta_
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']);
21
- $hovered = $IGItem['insta_gal-hover'] ? 'ighover' : '';
22
- $spacing = $IGItem['insta_gal-spacing'] ? '' : 'no-spacing';
23
- $results .= '<div class="ig-item '.$hovered.' '. $spacing .' cols-' . $IGItem['insta_gal-cols'] . '" style="width:' . (100 / $IGItem['insta_gal-cols']) . '%;">';
24
-
25
- $results .= '<a href="' . $item['img_standard'] . '" target="blank" data-title="' .$item['caption']. '" class="nofancybox">';
26
- $results .= '<img src="' . $img_src . '" alt="instagram" />';
27
- if($IGItem['insta_likes'] || $IGItem['insta_comments']){
28
- $results .= '<span class="ig-likes-comments">';
29
- if($IGItem['insta_likes']){
30
- $results .= '<span><span class="dashicons dashicons-heart"></span>' . $item['likes'] . '</span>';
31
- }
32
- if($IGItem['insta_comments']){
33
- $results .= '<span><span class="dashicons dashicons-admin-comments"></span>' . $item['comments'] . '</span>';
34
- }
35
- $results .= '</span>';
36
  }
37
- $results .= '</a>';
38
- $results .= '</div>';
 
 
39
 
40
  $i ++;
41
  if (($IGItem['insta_limit'] != 0) && ($i > $IGItem['insta_limit']))
42
  break;
43
  }
44
  $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'].' .ig-item a';
51
- $rs = <<<JS
52
  <script>
53
  jQuery(document).ready(function ($) {
54
- jQuery('$JSIGSelector').magnificPopup({
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  type: 'image',
56
  mainClass: 'mfp-with-zoom',
57
  zoom: {
58
- enabled: true,
59
  duration: 300,
60
  easing: 'ease-in-out',
61
  opener: function(openerElement) {
@@ -64,17 +87,17 @@ if ($IGItem['insta_gal-popup']) {
64
  },
65
  gallery: {
66
  enabled: true
67
- },
68
  image: {
69
  titleSrc: function(item) {
70
  return item.el.attr('data-title');
71
  }
72
- }
73
  });
74
  });
75
  </script>
76
  JS;
77
- $results .= $rs;
78
  }
79
 
80
  // return $results;
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']);
21
+ $hovered = $IGItem['insta_gal-hover'] ? 'ighover' : '';
22
+ $spacing = $IGItem['insta_gal-spacing'] ? '' : 'no-spacing';
23
+ $results .= '<div class="ig-item '.$hovered.' '. $spacing .' cols-' . $IGItem['insta_gal-cols'] . '" style="width:' . (100 / $IGItem['insta_gal-cols']) . '%;">';
24
+
25
+ $results .= '<a href="' . $item['img_standard'] . '" target="blank" data-title="' .$item['caption']. '" class="nofancybox">';
26
+ $results .= '<img src="' . $img_src . '" alt="instagram" class="instagallery-image" />';
27
+ if($IGItem['insta_likes'] || $IGItem['insta_comments']){
28
+ $results .= '<span class="ig-likes-comments">';
29
+ if($IGItem['insta_likes']){
30
+ $results .= '<span><span class="dashicons dashicons-heart"></span>' . $item['likes'] . '</span>';
31
+ }
32
+ if($IGItem['insta_comments']){
33
+ $results .= '<span><span class="dashicons dashicons-admin-comments"></span>' . $item['comments'] . '</span>';
 
 
34
  }
35
+ $results .= '</span>';
36
+ }
37
+ $results .= '</a>';
38
+ $results .= '</div>';
39
 
40
  $i ++;
41
  if (($IGItem['insta_limit'] != 0) && ($i > $IGItem['insta_limit']))
42
  break;
43
  }
44
  $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 ($) {
54
+
55
+ // resize images to square
56
+ var instagalleryImages = $('$JSIGSelector .ig-item img.instagallery-image');
57
+ if(instagalleryImages.length){
58
+ var totalImages = instagalleryImages.length, imagesLoaded = 0,minHeight = 0;
59
+ instagalleryImages.load(function(){
60
+ imagesLoaded++;
61
+ if(minHeight == 0)minHeight = $(this).height();
62
+ // if(minHeight > $(this).height())minHeight = $(this).height();
63
+ if(($(this).width() == $(this).height()))minHeight = $(this).height();
64
+ if(imagesLoaded >= totalImages){
65
+ $('$JSIGSelector .ig-item img.instagallery-image').each(function(){
66
+ var i = $(this);
67
+ var th = i.height();
68
+ if(minHeight < th){
69
+ var m = (th-minHeight)/2;
70
+ $(this).css('margin-top','-'+m+'px');
71
+ $(this).css('margin-bottom','-'+m+'px');
72
+ }
73
+ });
74
+ }
75
+ });
76
+ }
77
+ jQuery('$JSIGSelector .ig-item a').magnificPopup({
78
  type: 'image',
79
  mainClass: 'mfp-with-zoom',
80
  zoom: {
81
+ enabled: true,
82
  duration: 300,
83
  easing: 'ease-in-out',
84
  opener: function(openerElement) {
87
  },
88
  gallery: {
89
  enabled: true
90
+ },
91
  image: {
92
  titleSrc: function(item) {
93
  return item.el.attr('data-title');
94
  }
95
+ }
96
  });
97
  });
98
  </script>
99
  JS;
100
+ $results .= $rs;
101
  }
102
 
103
  // return $results;
templates/slider.php DELETED
@@ -1,55 +0,0 @@
1
- <?php
2
-
3
- $insta_source = ($IGItem['ig_select_from'] == 'username') ? 'user_'. $IGItem['insta_user'] : 'tag_'. $IGItem['insta_tag'];
4
-
5
-
6
- // Registering scripts.
7
- // wp_enqueue_script('swiper');
8
-
9
- $i = 1;
10
-
11
- $results .= '<div class="swiper-container instaslider" data-source="'.$insta_source.'" id="instaslider-'.$IGItem['gid'].'">';
12
- $results .= '<div class="swiper-wrapper">';
13
- foreach ($instaItems as $item) {
14
- if (! empty($item['img_standard'])) {
15
- $results .= '<div class="swiper-slide" >';
16
- $results .= '<img src="' . $item['img_standard'] . '" alt="instagram" /></div>';
17
- }
18
- $i ++;
19
- if (($IGItem['insta_limit'] != 0) && ($i > $IGItem['insta_limit']))
20
- break;
21
- }
22
- $results .= '</div>';
23
- $results .= '<div class="swiper-pagination"></div>';
24
- if ($IGItem['insta_sli-navarrows']) {
25
- $results .= '<div class="swiper-button-prev"></div><div class="swiper-button-next"></div>';
26
- }
27
- if ($IGItem['insta_sli-scroll']) {
28
- $results .= '<div class="swiper-scrollbar"></div>';
29
- }
30
- $results .= '</div>';
31
-
32
- $JSISSelector = '#instaslider-'.$IGItem['gid'];
33
-
34
- $results .= "<script>
35
- jQuery(document).ready(function ($) {
36
- var mySwiper = new Swiper ('$JSISSelector', {
37
- loop: true,";
38
- if ($IGItem['insta_sli-dots']) {
39
- $results .= "pagination: '.swiper-pagination',
40
- ";
41
- }
42
- if ($IGItem['insta_sli-navarrows']) {
43
- $results .= "nextButton: '.swiper-button-next',
44
- prevButton: '.swiper-button-prev',";
45
- }
46
- if ($IGItem['insta_sli-scroll']) {
47
- $results .= "scrollbar: '.swiper-scrollbar',";
48
- }
49
- $sli_timeout = (int) $IGItem['insta_sli-timeout'];
50
- $results .= "effect: '{$IGItem['insta_sli-effect']}',autoplay: '$sli_timeout',
51
- });
52
- });
53
- </script>";
54
-
55
- // return $results;