Enjoy Instagram feed on website with WordPress Widget and Shortcode - Version 5.0.1

Version Description

  • Fix bug video
Download this release

Release Info

Developer designemotions
Plugin Icon 128x128 Enjoy Instagram feed on website with WordPress Widget and Shortcode
Version 5.0.1
Comparing to
See all releases

Code changes from version 5.0 to 5.0.1

assets/css/swipebox.css CHANGED
@@ -215,9 +215,11 @@ html.swipebox-html.swipebox-touch {
215
  0% {
216
  left: 0;
217
  }
 
218
  50% {
219
  left: -30px;
220
  }
 
221
  100% {
222
  left: 0;
223
  }
@@ -227,9 +229,11 @@ html.swipebox-html.swipebox-touch {
227
  0% {
228
  left: 0;
229
  }
 
230
  50% {
231
  left: -30px;
232
  }
 
233
  100% {
234
  left: 0;
235
  }
@@ -238,9 +242,11 @@ html.swipebox-html.swipebox-touch {
238
  0% {
239
  left: 0;
240
  }
 
241
  50% {
242
  left: 30px;
243
  }
 
244
  100% {
245
  left: 0;
246
  }
@@ -249,9 +255,11 @@ html.swipebox-html.swipebox-touch {
249
  0% {
250
  left: 0;
251
  }
 
252
  50% {
253
  left: 30px;
254
  }
 
255
  100% {
256
  left: 0;
257
  }
215
  0% {
216
  left: 0;
217
  }
218
+
219
  50% {
220
  left: -30px;
221
  }
222
+
223
  100% {
224
  left: 0;
225
  }
229
  0% {
230
  left: 0;
231
  }
232
+
233
  50% {
234
  left: -30px;
235
  }
236
+
237
  100% {
238
  left: 0;
239
  }
242
  0% {
243
  left: 0;
244
  }
245
+
246
  50% {
247
  left: 30px;
248
  }
249
+
250
  100% {
251
  left: 0;
252
  }
255
  0% {
256
  left: 0;
257
  }
258
+
259
  50% {
260
  left: 30px;
261
  }
262
+
263
  100% {
264
  left: 0;
265
  }
assets/css/swipebox.min.css ADDED
@@ -0,0 +1 @@
 
1
+ /*! Swipebox v1.3.0 | Constantin Saguin csag.co | MIT License | github.com/brutaldesign/swipebox */html.swipebox-html.swipebox-touch{overflow:hidden!important}#swipebox-overlay img{border:none!important}#swipebox-overlay{width:100%;height:100%;position:fixed;top:0;left:0;z-index:99999!important;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}#swipebox-container{position:relative;width:100%;height:100%}#swipebox-slider{-webkit-transition:-webkit-transform .4s ease;transition:transform .4s ease;height:100%;left:0;top:0;width:100%;white-space:nowrap;position:absolute;display:none;cursor:pointer}#swipebox-slider .slide{height:100%;width:100%;line-height:1px;text-align:center;display:inline-block}#swipebox-slider .slide:before{content:"";display:inline-block;height:50%;width:1px;margin-right:-1px}#swipebox-slider .slide .swipebox-inline-container,#swipebox-slider .slide .swipebox-video-container,#swipebox-slider .slide img{display:inline-block;max-height:100%;max-width:100%;margin:0;padding:0;width:auto;height:auto;vertical-align:middle}#swipebox-slider .slide .swipebox-video-container{background:0 0;max-width:1140px;max-height:100%;width:100%;padding:5%;-webkit-box-sizing:border-box;box-sizing:border-box}#swipebox-slider .slide .swipebox-video-container .swipebox-video{width:100%;height:0;padding-bottom:56.25%;overflow:hidden;position:relative}#swipebox-slider .slide .swipebox-video-container .swipebox-video iframe{width:100%!important;height:100%!important;position:absolute;top:0;left:0}#swipebox-slider .slide-loading{background:url(../images/loader.gif) center center no-repeat}#swipebox-bottom-bar,#swipebox-top-bar{-webkit-transition:.5s;transition:.5s;position:absolute;left:0;z-index:999;height:50px;width:100%}#swipebox-bottom-bar{bottom:-50px}#swipebox-bottom-bar.visible-bars{-webkit-transform:translate3d(0,-50px,0);transform:translate3d(0,-50px,0)}#swipebox-top-bar{top:-50px}#swipebox-top-bar.visible-bars{-webkit-transform:translate3d(0,50px,0);transform:translate3d(0,50px,0)}#swipebox-title{display:block;width:100%;text-align:center}#swipebox-close,#swipebox-next,#swipebox-prev{background-image:url(../images/icons.png);background-repeat:no-repeat;border:none!important;text-decoration:none!important;cursor:pointer;width:50px;height:50px;top:0}#swipebox-arrows{display:block;margin:0 auto;width:100%;height:50px}#swipebox-prev{background-position:-32px 13px;float:left}#swipebox-next{background-position:-78px 13px;float:right}#swipebox-close{top:0;right:0;position:absolute;z-index:9999;background-position:15px 12px}.swipebox-no-close-button #swipebox-close{display:none}#swipebox-next.disabled,#swipebox-prev.disabled{opacity:.3}.swipebox-no-touch #swipebox-overlay.rightSpring #swipebox-slider{-webkit-animation:rightSpring .3s;animation:rightSpring .3s}.swipebox-no-touch #swipebox-overlay.leftSpring #swipebox-slider{-webkit-animation:leftSpring .3s;animation:leftSpring .3s}.swipebox-touch #swipebox-container:after,.swipebox-touch #swipebox-container:before{-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transition:all .3s ease;transition:all .3s ease;content:' ';position:absolute;z-index:999;top:0;height:100%;width:20px;opacity:0}.swipebox-touch #swipebox-container:before{left:0;-webkit-box-shadow:inset 10px 0 10px -8px #656565;box-shadow:inset 10px 0 10px -8px #656565}.swipebox-touch #swipebox-container:after{right:0;-webkit-box-shadow:inset -10px 0 10px -8px #656565;box-shadow:inset -10px 0 10px -8px #656565}.swipebox-touch #swipebox-overlay.leftSpringTouch #swipebox-container:before,.swipebox-touch #swipebox-overlay.rightSpringTouch #swipebox-container:after{opacity:1}@-webkit-keyframes rightSpring{0%{left:0}50%{left:-30px}100%{left:0}}@keyframes rightSpring{0%{left:0}50%{left:-30px}100%{left:0}}@-webkit-keyframes leftSpring{0%{left:0}50%{left:30px}100%{left:0}}@keyframes leftSpring{0%{left:0}50%{left:30px}100%{left:0}}@media screen and (min-width:800px){#swipebox-close{right:10px}#swipebox-arrows{width:92%;max-width:800px}}#swipebox-overlay{background:#0d0d0d}#swipebox-bottom-bar,#swipebox-top-bar{text-shadow:1px 1px 1px #000;background:#000;opacity:.95}#swipebox-top-bar{color:#fff!important;font-size:15px;line-height:43px;font-family:Helvetica,Arial,sans-serif}
assets/images/icons.svg ADDED
@@ -0,0 +1 @@
 
1
+ <?xml version="1.0" encoding="utf-8"?> <!-- Generator: IcoMoon.io --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="120" height="24" viewBox="0 0 120 24" fill="#ffffff" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M 17.384,17.705q0.00,0.536 -0.375,0.911l-1.821,1.821q-0.375,0.375 -0.911,0.375t-0.911-0.375l-3.938-3.938l-3.938,3.938q-0.375,0.375 -0.911,0.375t-0.911-0.375l-1.821-1.821q-0.375-0.375 -0.375-0.911t 0.375-0.911l 3.938-3.938l-3.938-3.938q-0.375-0.375 -0.375-0.911t 0.375-0.911l 1.821-1.821q 0.375-0.375 0.911-0.375t 0.911,0.375l 3.938,3.938l 3.938-3.938q 0.375-0.375 0.911-0.375t 0.911,0.375l 1.821,1.821q 0.375,0.375 0.375,0.911 t-0.375,0.911l-3.938,3.938l 3.938,3.938q 0.375,0.375 0.375,0.911zM 57.938,21.067l-8.732-8.719q-0.496-0.496 -0.496-1.212t 0.496-1.212l 8.732-8.719q 0.496-0.496 1.212-0.496t 1.212,0.496l 1.004,1.004q 0.496,0.496 0.496,1.212t-0.496,1.212l-6.509,6.509l 6.509,6.496q 0.496,0.509 0.496,1.219t-0.496,1.205l-1.004,1.004q-0.496,0.496 -1.212,0.496t-1.212-0.496zM 110.719,11.143q0.00,0.696 -0.496,1.219l-8.732,8.719q-0.496,0.496 -1.205,0.496t-1.205-0.496l-1.018-1.004q-0.496-0.522 -0.496-1.219q0.00-0.71 0.496-1.205l 6.509-6.509l-6.509-6.496q-0.496-0.522 -0.496-1.219q0.00-0.71 0.496-1.205l 1.018-1.004q 0.482-0.509 1.205-0.509t 1.205,0.509l 8.732,8.719q 0.496,0.496 0.496,1.205z"></path></svg>
assets/images/loader.gif CHANGED
Binary file
assets/images/video_placeholder.jpeg ADDED
Binary file
assets/js/jquery.swipebox.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Swipebox v1.3.0.2 | Constantin Saguin csag.co | MIT License | github.com/brutaldesign/swipebox */
2
 
3
  ;( function ( window, document, $, undefined ) {
4
 
@@ -8,6 +8,7 @@
8
  var ui,
9
  defaults = {
10
  useCSS : true,
 
11
  initialIndexOnArray : 0,
12
  removeBarsOnMobile : true,
13
  hideCloseButtonOnMobile : false,
@@ -17,17 +18,19 @@
17
  beforeOpen: null,
18
  afterOpen: null,
19
  afterClose: null,
 
 
 
20
  loopAtEnd: false,
21
  autoplayVideos: false,
22
  queryStringData: {},
23
- toggleClassOnLoad: ''
24
  },
25
 
26
  plugin = this,
27
  elements = [], // slides array [ { href:'...', title:'...' }, ...],
28
  $elem,
29
  selector = elem.selector,
30
- $selector = $( selector ),
31
  isMobile = navigator.userAgent.match( /(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i ),
32
  isTouch = isMobile !== null || document.createTouch !== undefined || ( 'ontouchstart' in window ) || ( 'onmsgesturechange' in window ) || navigator.msMaxTouchPoints,
33
  supportSVG = !! document.createElementNS && !! document.createElementNS( 'http://www.w3.org/2000/svg', 'svg').createSVGRect,
@@ -89,12 +92,12 @@
89
  }
90
 
91
  elements = [];
92
- var index , relType, relVal;
93
 
94
  // Allow for HTML5 compliant attribute before legacy use of rel
95
  if ( ! relVal ) {
96
  relType = 'data-rel';
97
- relVal = $( this ).attr( relType );
98
  }
99
 
100
  if ( ! relVal ) {
@@ -103,7 +106,7 @@
103
  }
104
 
105
  if ( relVal && relVal !== '' && relVal !== 'nofollow' ) {
106
- $elem = $selector.filter( '[' + relType + '="' + relVal + '"]' );
107
  } else {
108
  $elem = $( selector );
109
  }
@@ -154,7 +157,7 @@
154
  this.preloadMedia( index+1 );
155
  this.preloadMedia( index-1 );
156
  if ( plugin.settings.afterOpen ) {
157
- plugin.settings.afterOpen();
158
  }
159
  },
160
 
@@ -684,9 +687,17 @@
684
  $this.loadMedia( src, function() {
685
  slide.removeClass( 'slide-loading' );
686
  slide.html( this );
 
 
 
 
687
  } );
688
  } else {
689
  slide.html( $this.getVideo( src ) );
 
 
 
 
690
  }
691
 
692
  },
@@ -717,7 +728,7 @@
717
  isVideo : function ( src ) {
718
 
719
  if ( src ) {
720
- if ( src.match( /youtube\.com\/watch\?v=([a-zA-Z0-9\-_]+)/) || src.match( /vimeo\.com\/([0-9]*)/ ) || src.match( /youtu\.be\/([a-zA-Z0-9\-_]+)/ ) || src.match( /mp4/ )) {
721
  return true;
722
  }
723
 
@@ -742,8 +753,10 @@
742
  a.href = decodeURIComponent( uri );
743
 
744
  // QueryString to Object
745
- qs = JSON.parse( '{"' + a.search.toLowerCase().replace('?','').replace(/&/g,'","').replace(/=/g,'":"') + '"}' );
746
-
 
 
747
  // Extend with custom data
748
  if ( $.isPlainObject( customData ) ) {
749
  qs = $.extend( qs, customData, plugin.settings.queryStringData ); // The dev has always the final word
@@ -762,29 +775,37 @@
762
  /**
763
  * Get video iframe code from URL
764
  */
765
- getVideo : function( url ) {
766
- var iframe = '',
767
- youtubeUrl = url.match( /watch\?v=([a-zA-Z0-9\-_]+)/ ),
768
- youtubeShortUrl = url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/),
769
- vimeoUrl = url.match( /vimeo\.com\/([0-9]*)/ );
770
- instagramUrl = url.match(/cdninstagram\.com\/([a-zA-Z0-9\-_\-.\--]+)\/([a-zA-Z0-9\-_\-.\--]+)/);
771
- if ( youtubeUrl || youtubeShortUrl) {
772
- if ( youtubeShortUrl ) {
773
- youtubeUrl = youtubeShortUrl;
774
- }
775
- iframe = '<iframe width="560" height="315" src="//www.youtube.com/embed/' + youtubeUrl[1] + '" frameborder="0" allowfullscreen></iframe>';
776
-
777
- } else if ( vimeoUrl ) {
778
-
779
- iframe = '<iframe width="560" height="315" src="//player.vimeo.com/video/' + vimeoUrl[1] + '?byline=0&amp;portrait=0&amp;color='+plugin.settings.vimeoColor+'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
780
-
781
- }else if ( instagramUrl ) {
 
 
 
 
 
 
 
782
 
783
- iframe = '<video id="inst_video" controls allowfullscreen> <source src=' + url + '> Your browser does not support HTML5 video</video>';
784
- }
 
785
 
786
- return '<div class="swipebox-video-container" style="max-width:' + plugin.settings.videomaxWidth + 'px"><div class="swipebox-video;">'+iframe+'</div></div>';
787
- },
788
 
789
  /**
790
  * Load image
@@ -829,6 +850,9 @@
829
  index++;
830
  $this.setSlide( index );
831
  $this.preloadMedia( index+1 );
 
 
 
832
  } else {
833
 
834
  if ( plugin.settings.loopAtEnd === true ) {
@@ -838,6 +862,9 @@
838
  $this.preloadMedia( index );
839
  $this.setSlide( index );
840
  $this.preloadMedia( index + 1 );
 
 
 
841
  } else {
842
  $( '#swipebox-overlay' ).addClass( 'rightSpring' );
843
  setTimeout( function() {
@@ -859,6 +886,9 @@
859
  index--;
860
  this.setSlide( index );
861
  this.preloadMedia( index-1 );
 
 
 
862
  } else {
863
  $( '#swipebox-overlay' ).addClass( 'leftSpring' );
864
  setTimeout( function() {
@@ -866,6 +896,14 @@
866
  }, 500 );
867
  }
868
  },
 
 
 
 
 
 
 
 
869
 
870
  /**
871
  * Close
1
+ /*! Swipebox v1.4.4 | Constantin Saguin csag.co | MIT License | github.com/brutaldesign/swipebox */
2
 
3
  ;( function ( window, document, $, undefined ) {
4
 
8
  var ui,
9
  defaults = {
10
  useCSS : true,
11
+ useSVG : true,
12
  initialIndexOnArray : 0,
13
  removeBarsOnMobile : true,
14
  hideCloseButtonOnMobile : false,
18
  beforeOpen: null,
19
  afterOpen: null,
20
  afterClose: null,
21
+ afterMedia: null,
22
+ nextSlide: null,
23
+ prevSlide: null,
24
  loopAtEnd: false,
25
  autoplayVideos: false,
26
  queryStringData: {},
27
+ toggleClassOnLoad: ''
28
  },
29
 
30
  plugin = this,
31
  elements = [], // slides array [ { href:'...', title:'...' }, ...],
32
  $elem,
33
  selector = elem.selector,
 
34
  isMobile = navigator.userAgent.match( /(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i ),
35
  isTouch = isMobile !== null || document.createTouch !== undefined || ( 'ontouchstart' in window ) || ( 'onmsgesturechange' in window ) || navigator.msMaxTouchPoints,
36
  supportSVG = !! document.createElementNS && !! document.createElementNS( 'http://www.w3.org/2000/svg', 'svg').createSVGRect,
92
  }
93
 
94
  elements = [];
95
+ var index, relType, relVal;
96
 
97
  // Allow for HTML5 compliant attribute before legacy use of rel
98
  if ( ! relVal ) {
99
  relType = 'data-rel';
100
+ relVal = $( this ).attr( relType );
101
  }
102
 
103
  if ( ! relVal ) {
106
  }
107
 
108
  if ( relVal && relVal !== '' && relVal !== 'nofollow' ) {
109
+ $elem = $( selector ).filter( '[' + relType + '="' + relVal + '"]' );
110
  } else {
111
  $elem = $( selector );
112
  }
157
  this.preloadMedia( index+1 );
158
  this.preloadMedia( index-1 );
159
  if ( plugin.settings.afterOpen ) {
160
+ plugin.settings.afterOpen(index);
161
  }
162
  },
163
 
687
  $this.loadMedia( src, function() {
688
  slide.removeClass( 'slide-loading' );
689
  slide.html( this );
690
+
691
+ if ( plugin.settings.afterMedia ) {
692
+ plugin.settings.afterMedia( index );
693
+ }
694
  } );
695
  } else {
696
  slide.html( $this.getVideo( src ) );
697
+
698
+ if ( plugin.settings.afterMedia ) {
699
+ plugin.settings.afterMedia( index );
700
+ }
701
  }
702
 
703
  },
728
  isVideo : function ( src ) {
729
 
730
  if ( src ) {
731
+ if ( src.match( /(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || src.match( /vimeo\.com\/([0-9]*)/ ) || src.match( /youtu\.be\/([a-zA-Z0-9\-_]+)/ ) ) {
732
  return true;
733
  }
734
 
753
  a.href = decodeURIComponent( uri );
754
 
755
  // QueryString to Object
756
+ if ( a.search ) {
757
+ qs = JSON.parse( '{"' + a.search.toLowerCase().replace('?','').replace(/&/g,'","').replace(/=/g,'":"') + '"}' );
758
+ }
759
+
760
  // Extend with custom data
761
  if ( $.isPlainObject( customData ) ) {
762
  qs = $.extend( qs, customData, plugin.settings.queryStringData ); // The dev has always the final word
775
  /**
776
  * Get video iframe code from URL
777
  */
778
+ getVideo : function( url ) {
779
+ var iframe = '',
780
+ youtubeUrl = url.match( /((?:www\.)?youtube\.com|(?:www\.)?youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/ ),
781
+ youtubeShortUrl = url.match(/(?:www\.)?youtu\.be\/([a-zA-Z0-9\-_]+)/),
782
+ vimeoUrl = url.match( /(?:www\.)?vimeo\.com\/([0-9]*)/ ),
783
+ qs = '';
784
+ if ( youtubeUrl || youtubeShortUrl) {
785
+ if ( youtubeShortUrl ) {
786
+ youtubeUrl = youtubeShortUrl;
787
+ }
788
+ qs = ui.parseUri( url, {
789
+ 'autoplay' : ( plugin.settings.autoplayVideos ? '1' : '0' ),
790
+ 'v' : ''
791
+ });
792
+ iframe = '<iframe width="560" height="315" src="//' + youtubeUrl[1] + '/embed/' + youtubeUrl[2] + '?' + qs + '" frameborder="0" allowfullscreen></iframe>';
793
+
794
+ } else if ( vimeoUrl ) {
795
+ qs = ui.parseUri( url, {
796
+ 'autoplay' : ( plugin.settings.autoplayVideos ? '1' : '0' ),
797
+ 'byline' : '0',
798
+ 'portrait' : '0',
799
+ 'color': plugin.settings.vimeoColor
800
+ });
801
+ iframe = '<iframe width="560" height="315" src="//player.vimeo.com/video/' + vimeoUrl[1] + '?' + qs + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
802
 
803
+ } else {
804
+ iframe = '<iframe width="560" height="315" src="' + url + '" frameborder="0" allowfullscreen></iframe>';
805
+ }
806
 
807
+ return '<div class="swipebox-video-container" style="max-width:' + plugin.settings.videoMaxWidth + 'px"><div class="swipebox-video">' + iframe + '</div></div>';
808
+ },
809
 
810
  /**
811
  * Load image
850
  index++;
851
  $this.setSlide( index );
852
  $this.preloadMedia( index+1 );
853
+ if ( plugin.settings.nextSlide ) {
854
+ plugin.settings.nextSlide(index);
855
+ }
856
  } else {
857
 
858
  if ( plugin.settings.loopAtEnd === true ) {
862
  $this.preloadMedia( index );
863
  $this.setSlide( index );
864
  $this.preloadMedia( index + 1 );
865
+ if ( plugin.settings.nextSlide ) {
866
+ plugin.settings.nextSlide(index);
867
+ }
868
  } else {
869
  $( '#swipebox-overlay' ).addClass( 'rightSpring' );
870
  setTimeout( function() {
886
  index--;
887
  this.setSlide( index );
888
  this.preloadMedia( index-1 );
889
+ if ( plugin.settings.prevSlide ) {
890
+ plugin.settings.prevSlide(index);
891
+ }
892
  } else {
893
  $( '#swipebox-overlay' ).addClass( 'leftSpring' );
894
  setTimeout( function() {
896
  }, 500 );
897
  }
898
  },
899
+ /* jshint unused:false */
900
+ nextSlide : function ( index ) {
901
+ // Callback for next slide
902
+ },
903
+
904
+ prevSlide : function ( index ) {
905
+ // Callback for prev slide
906
+ },
907
 
908
  /**
909
  * Close
assets/js/jquery.swipebox.min.js CHANGED
@@ -1 +1,2 @@
1
- !function(e,t,i,s){i.swipebox=function(o,a){var n,r,l={useCSS:!0,initialIndexOnArray:0,removeBarsOnMobile:!0,hideCloseButtonOnMobile:!1,hideBarsDelay:3e3,videoMaxWidth:1140,vimeoColor:"cccccc",beforeOpen:null,afterOpen:null,afterClose:null,loopAtEnd:!1,autoplayVideos:!1,queryStringData:{},toggleClassOnLoad:""},d=this,p=[],c=o.selector,b=i(c),u=navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i),h=null!==u||t.createTouch!==s||"ontouchstart"in e||"onmsgesturechange"in e||navigator.msMaxTouchPoints,m=!!t.createElementNS&&!!t.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,g=e.innerWidth?e.innerWidth:i(e).width(),w=e.innerHeight?e.innerHeight:i(e).height(),f=0;d.settings={},i.swipebox.close=function(){n.closeSlide()},i.swipebox.extend=function(){return n},d.init=function(){d.settings=i.extend({},l,a),i.isArray(o)?(p=o,n.target=i(e),n.init(d.settings.initialIndexOnArray)):i(t).on("click",c,function(e){if("slide current"===e.target.parentNode.className)return!1;var t,s,a;i.isArray(o)||(n.destroy(),r=i(c),n.actions()),p=[],a||(s="data-rel",a=i(this).attr(s)),a||(s="rel",a=i(this).attr(s)),(r=a&&""!==a&&"nofollow"!==a?b.filter("["+s+'="'+a+'"]'):i(c)).each(function(){var e=null,t=null;i(this).attr("title")&&(e=i(this).attr("title")),i(this).attr("href")&&(t=i(this).attr("href")),p.push({href:t,title:e})}),t=r.index(i(this)),e.preventDefault(),e.stopPropagation(),n.target=i(e.target),n.init(t)})},n={init:function(e){d.settings.beforeOpen&&d.settings.beforeOpen(),this.target.trigger("swipebox-start"),i.swipebox.isOpen=!0,this.build(),this.openSlide(e),this.openMedia(e),this.preloadMedia(e+1),this.preloadMedia(e-1),d.settings.afterOpen&&d.settings.afterOpen()},build:function(){var e,t=this;i("body").append('<div id="swipebox-overlay">\t\t\t\t\t<div id="swipebox-container">\t\t\t\t\t\t<div id="swipebox-slider"></div>\t\t\t\t\t\t<div id="swipebox-top-bar">\t\t\t\t\t\t\t<div id="swipebox-title"></div>\t\t\t\t\t\t</div>\t\t\t\t\t\t<div id="swipebox-bottom-bar">\t\t\t\t\t\t\t<div id="swipebox-arrows">\t\t\t\t\t\t\t\t<a id="swipebox-prev"></a>\t\t\t\t\t\t\t\t<a id="swipebox-next"></a>\t\t\t\t\t\t\t</div>\t\t\t\t\t\t</div>\t\t\t\t\t\t<a id="swipebox-close"></a>\t\t\t\t\t</div>\t\t\t</div>'),m&&!0===d.settings.useSVG&&(e=(e=i("#swipebox-close").css("background-image")).replace("png","svg"),i("#swipebox-prev, #swipebox-next, #swipebox-close").css({"background-image":e})),u&&d.settings.removeBarsOnMobile&&i("#swipebox-bottom-bar, #swipebox-top-bar").remove(),i.each(p,function(){i("#swipebox-slider").append('<div class="slide"></div>')}),t.setDim(),t.actions(),h&&t.gesture(),t.keyboard(),t.animBars(),t.resize()},setDim:function(){var t,s,o;"onorientationchange"in e?e.addEventListener("orientationchange",function(){0===e.orientation?(t=g,s=w):90!==e.orientation&&-90!==e.orientation||(t=w,s=g)},!1):(t=e.innerWidth?e.innerWidth:i(e).width(),s=e.innerHeight?e.innerHeight:i(e).height()),o={width:t,height:s},i("#swipebox-overlay").css(o)},resize:function(){var t=this;i(e).resize(function(){t.setDim()}).resize()},supportTransition:function(){var e,i="transition WebkitTransition MozTransition OTransition msTransition KhtmlTransition".split(" ");for(e=0;e<i.length;e++)if(t.createElement("div").style[i[e]]!==s)return i[e];return!1},doCssTrans:function(){if(d.settings.useCSS&&this.supportTransition())return!0},gesture:function(){var e,t,s,o,a,n,r=this,l=!1,d=!1,c={},b={},u=i("#swipebox-top-bar, #swipebox-bottom-bar"),h=i("#swipebox-slider");u.addClass("visible-bars"),r.setTimeout(),i("body").bind("touchstart",function(r){return i(this).addClass("touching"),e=i("#swipebox-slider .slide").index(i("#swipebox-slider .slide.current")),b=r.originalEvent.targetTouches[0],c.pageX=r.originalEvent.targetTouches[0].pageX,c.pageY=r.originalEvent.targetTouches[0].pageY,i("#swipebox-slider").css({"-webkit-transform":"translate3d("+f+"%, 0, 0)",transform:"translate3d("+f+"%, 0, 0)"}),i(".touching").bind("touchmove",function(r){if(r.preventDefault(),r.stopPropagation(),b=r.originalEvent.targetTouches[0],!d&&(a=s,s=b.pageY-c.pageY,Math.abs(s)>=50||l)){var u=.75-Math.abs(s)/h.height();h.css({top:s+"px"}),h.css({opacity:u}),l=!0}o=t,t=b.pageX-c.pageX,n=100*t/g,!d&&!l&&Math.abs(t)>=10&&(i("#swipebox-slider").css({"-webkit-transition":"",transition:""}),d=!0),d&&(0<t?0===e?i("#swipebox-overlay").addClass("leftSpringTouch"):(i("#swipebox-overlay").removeClass("leftSpringTouch").removeClass("rightSpringTouch"),i("#swipebox-slider").css({"-webkit-transform":"translate3d("+(f+n)+"%, 0, 0)",transform:"translate3d("+(f+n)+"%, 0, 0)"})):0>t&&(p.length===e+1?i("#swipebox-overlay").addClass("rightSpringTouch"):(i("#swipebox-overlay").removeClass("leftSpringTouch").removeClass("rightSpringTouch"),i("#swipebox-slider").css({"-webkit-transform":"translate3d("+(f+n)+"%, 0, 0)",transform:"translate3d("+(f+n)+"%, 0, 0)"}))))}),!1}).bind("touchend",function(e){if(e.preventDefault(),e.stopPropagation(),i("#swipebox-slider").css({"-webkit-transition":"-webkit-transform 0.4s ease",transition:"transform 0.4s ease"}),s=b.pageY-c.pageY,t=b.pageX-c.pageX,n=100*t/g,l)if(l=!1,Math.abs(s)>=100&&Math.abs(s)>Math.abs(a)){var p=s>0?h.height():-h.height();h.animate({top:p+"px",opacity:0},300,function(){r.closeSlide()})}else h.animate({top:0,opacity:1},300);else d?(d=!1,t>=10&&t>=o?r.getPrev():t<=-10&&t<=o&&r.getNext()):u.hasClass("visible-bars")?(r.clearTimeout(),r.hideBars()):(r.showBars(),r.setTimeout());i("#swipebox-slider").css({"-webkit-transform":"translate3d("+f+"%, 0, 0)",transform:"translate3d("+f+"%, 0, 0)"}),i("#swipebox-overlay").removeClass("leftSpringTouch").removeClass("rightSpringTouch"),i(".touching").off("touchmove").removeClass("touching")})},setTimeout:function(){if(d.settings.hideBarsDelay>0){var t=this;t.clearTimeout(),t.timeout=e.setTimeout(function(){t.hideBars()},d.settings.hideBarsDelay)}},clearTimeout:function(){e.clearTimeout(this.timeout),this.timeout=null},showBars:function(){var e=i("#swipebox-top-bar, #swipebox-bottom-bar");this.doCssTrans()?e.addClass("visible-bars"):(i("#swipebox-top-bar").animate({top:0},500),i("#swipebox-bottom-bar").animate({bottom:0},500),setTimeout(function(){e.addClass("visible-bars")},1e3))},hideBars:function(){var e=i("#swipebox-top-bar, #swipebox-bottom-bar");this.doCssTrans()?e.removeClass("visible-bars"):(i("#swipebox-top-bar").animate({top:"-50px"},500),i("#swipebox-bottom-bar").animate({bottom:"-50px"},500),setTimeout(function(){e.removeClass("visible-bars")},1e3))},animBars:function(){var e=this,t=i("#swipebox-top-bar, #swipebox-bottom-bar");t.addClass("visible-bars"),e.setTimeout(),i("#swipebox-slider").click(function(){t.hasClass("visible-bars")||(e.showBars(),e.setTimeout())}),i("#swipebox-bottom-bar").hover(function(){e.showBars(),t.addClass("visible-bars"),e.clearTimeout()},function(){d.settings.hideBarsDelay>0&&(t.removeClass("visible-bars"),e.setTimeout())})},keyboard:function(){var t=this;i(e).bind("keyup",function(e){e.preventDefault(),e.stopPropagation(),37===e.keyCode?t.getPrev():39===e.keyCode?t.getNext():27===e.keyCode&&t.closeSlide()})},actions:function(){var e=this,t="touchend click";p.length<2?(i("#swipebox-bottom-bar").hide(),s===p[1]&&i("#swipebox-top-bar").hide()):(i("#swipebox-prev").bind(t,function(t){t.preventDefault(),t.stopPropagation(),e.getPrev(),e.setTimeout()}),i("#swipebox-next").bind(t,function(t){t.preventDefault(),t.stopPropagation(),e.getNext(),e.setTimeout()})),i("#swipebox-close").bind(t,function(){e.closeSlide()})},setSlide:function(e,t){t=t||!1;var s=i("#swipebox-slider");f=100*-e,this.doCssTrans()?s.css({"-webkit-transform":"translate3d("+100*-e+"%, 0, 0)",transform:"translate3d("+100*-e+"%, 0, 0)"}):s.animate({left:100*-e+"%"}),i("#swipebox-slider .slide").removeClass("current"),i("#swipebox-slider .slide").eq(e).addClass("current"),this.setTitle(e),t&&s.fadeIn(),i("#swipebox-prev, #swipebox-next").removeClass("disabled"),0===e?i("#swipebox-prev").addClass("disabled"):e===p.length-1&&!0!==d.settings.loopAtEnd&&i("#swipebox-next").addClass("disabled")},openSlide:function(t){i("html").addClass("swipebox-html"),h?(i("html").addClass("swipebox-touch"),d.settings.hideCloseButtonOnMobile&&i("html").addClass("swipebox-no-close-button")):i("html").addClass("swipebox-no-touch"),i(e).trigger("resize"),this.setSlide(t,!0)},preloadMedia:function(e){var t=this,i=null;p[e]!==s&&(i=p[e].href),t.isVideo(i)?t.openMedia(e):setTimeout(function(){t.openMedia(e)},1e3)},openMedia:function(e){var t,o;if(p[e]!==s&&(t=p[e].href),e<0||e>=p.length)return!1;o=i("#swipebox-slider .slide").eq(e),this.isVideo(t)?o.html(this.getVideo(t)):(o.addClass("slide-loading"),this.loadMedia(t,function(){o.removeClass("slide-loading"),o.html(this)}))},setTitle:function(e){var t=null;i("#swipebox-title").empty(),p[e]!==s&&(t=p[e].title),t?(i("#swipebox-top-bar").show(),i("#swipebox-title").append(t)):i("#swipebox-top-bar").hide()},isVideo:function(e){if(e){if(e.match(/youtube\.com\/watch\?v=([a-zA-Z0-9\-_]+)/)||e.match(/vimeo\.com\/([0-9]*)/)||e.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||e.match(/mp4/))return!0;if(e.toLowerCase().indexOf("swipeboxvideo=1")>=0)return!0}},parseUri:function(e,s){var o=t.createElement("a"),a={};return o.href=decodeURIComponent(e),a=JSON.parse('{"'+o.search.toLowerCase().replace("?","").replace(/&/g,'","').replace(/=/g,'":"')+'"}'),i.isPlainObject(s)&&(a=i.extend(a,s,d.settings.queryStringData)),i.map(a,function(e,t){if(e&&e>"")return encodeURIComponent(t)+"="+encodeURIComponent(e)}).join("&")},getVideo:function(e){var t="",i=e.match(/watch\?v=([a-zA-Z0-9\-_]+)/),s=e.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/),o=e.match(/vimeo\.com\/([0-9]*)/);return instagramUrl=e.match(/cdninstagram\.com\/([a-zA-Z0-9\-_\-.\--]+)\/([a-zA-Z0-9\-_\-.\--]+)/),i||s?(s&&(i=s),t='<iframe width="560" height="315" src="//www.youtube.com/embed/'+i[1]+'" frameborder="0" allowfullscreen></iframe>'):o?t='<iframe width="560" height="315" src="//player.vimeo.com/video/'+o[1]+"?byline=0&amp;portrait=0&amp;color="+d.settings.vimeoColor+'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>':instagramUrl&&(t='<video id="inst_video" controls allowfullscreen> <source src='+e+"> Your browser does not support HTML5 video</video>"),'<div class="swipebox-video-container" style="max-width:'+d.settings.videomaxWidth+'px"><div class="swipebox-video;">'+t+"</div></div>"},loadMedia:function(e,t){if(0===e.trim().indexOf("#"))t.call(i("<div>",{class:"swipebox-inline-container"}).append(i(e).clone().toggleClass(d.settings.toggleClassOnLoad)));else if(!this.isVideo(e)){var s=i("<img>").on("load",function(){t.call(s)});s.attr("src",e)}},getNext:function(){var e,t=this,s=i("#swipebox-slider .slide").index(i("#swipebox-slider .slide.current"));s+1<p.length?(e=i("#swipebox-slider .slide").eq(s).contents().find("iframe").attr("src"),i("#swipebox-slider .slide").eq(s).contents().find("iframe").attr("src",e),s++,t.setSlide(s),t.preloadMedia(s+1)):!0===d.settings.loopAtEnd?(e=i("#swipebox-slider .slide").eq(s).contents().find("iframe").attr("src"),i("#swipebox-slider .slide").eq(s).contents().find("iframe").attr("src",e),s=0,t.preloadMedia(s),t.setSlide(s),t.preloadMedia(s+1)):(i("#swipebox-overlay").addClass("rightSpring"),setTimeout(function(){i("#swipebox-overlay").removeClass("rightSpring")},500))},getPrev:function(){var e,t=i("#swipebox-slider .slide").index(i("#swipebox-slider .slide.current"));t>0?(e=i("#swipebox-slider .slide").eq(t).contents().find("iframe").attr("src"),i("#swipebox-slider .slide").eq(t).contents().find("iframe").attr("src",e),t--,this.setSlide(t),this.preloadMedia(t-1)):(i("#swipebox-overlay").addClass("leftSpring"),setTimeout(function(){i("#swipebox-overlay").removeClass("leftSpring")},500))},closeSlide:function(){i("html").removeClass("swipebox-html"),i("html").removeClass("swipebox-touch"),i(e).trigger("resize"),this.destroy()},destroy:function(){i(e).unbind("keyup"),i("body").unbind("touchstart"),i("body").unbind("touchmove"),i("body").unbind("touchend"),i("#swipebox-slider").unbind(),i("#swipebox-overlay").remove(),i.isArray(o)||o.removeData("_swipebox"),this.target&&this.target.trigger("swipebox-destroy"),i.swipebox.isOpen=!1,d.settings.afterClose&&d.settings.afterClose()}},d.init()},i.fn.swipebox=function(e){if(!i.data(this,"_swipebox")){var t=new i.swipebox(this,e);this.data("_swipebox",t)}return this.data("_swipebox")}}(window,document,jQuery);
 
1
+ /*! Swipebox v1.4.4 | Constantin Saguin csag.co | MIT License | github.com/brutaldesign/swipebox */
2
+ !function(a,b,c,d){c.swipebox=function(e,f){var g,h,i={useCSS:!0,useSVG:!0,initialIndexOnArray:0,removeBarsOnMobile:!0,hideCloseButtonOnMobile:!1,hideBarsDelay:3e3,videoMaxWidth:1140,vimeoColor:"cccccc",beforeOpen:null,afterOpen:null,afterClose:null,afterMedia:null,nextSlide:null,prevSlide:null,loopAtEnd:!1,autoplayVideos:!1,queryStringData:{},toggleClassOnLoad:""},j=this,k=[],l=e.selector,m=navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i),n=null!==m||b.createTouch!==d||"ontouchstart"in a||"onmsgesturechange"in a||navigator.msMaxTouchPoints,o=!!b.createElementNS&&!!b.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,p=a.innerWidth?a.innerWidth:c(a).width(),q=a.innerHeight?a.innerHeight:c(a).height(),r=0,s='<div id="swipebox-overlay"> <div id="swipebox-container"> <div id="swipebox-slider"></div> <div id="swipebox-top-bar"> <div id="swipebox-title"></div> </div> <div id="swipebox-bottom-bar"> <div id="swipebox-arrows"> <a id="swipebox-prev"></a> <a id="swipebox-next"></a> </div> </div> <a id="swipebox-close"></a> </div> </div>';j.settings={},c.swipebox.close=function(){g.closeSlide()},c.swipebox.extend=function(){return g},j.init=function(){j.settings=c.extend({},i,f),c.isArray(e)?(k=e,g.target=c(a),g.init(j.settings.initialIndexOnArray)):c(b).on("click",l,function(a){if("slide current"===a.target.parentNode.className)return!1;c.isArray(e)||(g.destroy(),h=c(l),g.actions()),k=[];var b,d,f;f||(d="data-rel",f=c(this).attr(d)),f||(d="rel",f=c(this).attr(d)),h=f&&""!==f&&"nofollow"!==f?c(l).filter("["+d+'="'+f+'"]'):c(l),h.each(function(){var a=null,b=null;c(this).attr("title")&&(a=c(this).attr("title")),c(this).attr("href")&&(b=c(this).attr("href")),k.push({href:b,title:a})}),b=h.index(c(this)),a.preventDefault(),a.stopPropagation(),g.target=c(a.target),g.init(b)})},g={init:function(a){j.settings.beforeOpen&&j.settings.beforeOpen(),this.target.trigger("swipebox-start"),c.swipebox.isOpen=!0,this.build(),this.openSlide(a),this.openMedia(a),this.preloadMedia(a+1),this.preloadMedia(a-1),j.settings.afterOpen&&j.settings.afterOpen(a)},build:function(){var a,b=this;c("body").append(s),o&&j.settings.useSVG===!0&&(a=c("#swipebox-close").css("background-image"),a=a.replace("png","svg"),c("#swipebox-prev, #swipebox-next, #swipebox-close").css({"background-image":a})),m&&j.settings.removeBarsOnMobile&&c("#swipebox-bottom-bar, #swipebox-top-bar").remove(),c.each(k,function(){c("#swipebox-slider").append('<div class="slide"></div>')}),b.setDim(),b.actions(),n&&b.gesture(),b.keyboard(),b.animBars(),b.resize()},setDim:function(){var b,d,e={};"onorientationchange"in a?a.addEventListener("orientationchange",function(){0===a.orientation?(b=p,d=q):(90===a.orientation||-90===a.orientation)&&(b=q,d=p)},!1):(b=a.innerWidth?a.innerWidth:c(a).width(),d=a.innerHeight?a.innerHeight:c(a).height()),e={width:b,height:d},c("#swipebox-overlay").css(e)},resize:function(){var b=this;c(a).resize(function(){b.setDim()}).resize()},supportTransition:function(){var a,c="transition WebkitTransition MozTransition OTransition msTransition KhtmlTransition".split(" ");for(a=0;a<c.length;a++)if(b.createElement("div").style[c[a]]!==d)return c[a];return!1},doCssTrans:function(){return j.settings.useCSS&&this.supportTransition()?!0:void 0},gesture:function(){var a,b,d,e,f,g,h=this,i=!1,j=!1,l=10,m=50,n={},o={},q=c("#swipebox-top-bar, #swipebox-bottom-bar"),s=c("#swipebox-slider");q.addClass("visible-bars"),h.setTimeout(),c("body").bind("touchstart",function(h){return c(this).addClass("touching"),a=c("#swipebox-slider .slide").index(c("#swipebox-slider .slide.current")),o=h.originalEvent.targetTouches[0],n.pageX=h.originalEvent.targetTouches[0].pageX,n.pageY=h.originalEvent.targetTouches[0].pageY,c("#swipebox-slider").css({"-webkit-transform":"translate3d("+r+"%, 0, 0)",transform:"translate3d("+r+"%, 0, 0)"}),c(".touching").bind("touchmove",function(h){if(h.preventDefault(),h.stopPropagation(),o=h.originalEvent.targetTouches[0],!j&&(f=d,d=o.pageY-n.pageY,Math.abs(d)>=m||i)){var q=.75-Math.abs(d)/s.height();s.css({top:d+"px"}),s.css({opacity:q}),i=!0}e=b,b=o.pageX-n.pageX,g=100*b/p,!j&&!i&&Math.abs(b)>=l&&(c("#swipebox-slider").css({"-webkit-transition":"",transition:""}),j=!0),j&&(b>0?0===a?c("#swipebox-overlay").addClass("leftSpringTouch"):(c("#swipebox-overlay").removeClass("leftSpringTouch").removeClass("rightSpringTouch"),c("#swipebox-slider").css({"-webkit-transform":"translate3d("+(r+g)+"%, 0, 0)",transform:"translate3d("+(r+g)+"%, 0, 0)"})):0>b&&(k.length===a+1?c("#swipebox-overlay").addClass("rightSpringTouch"):(c("#swipebox-overlay").removeClass("leftSpringTouch").removeClass("rightSpringTouch"),c("#swipebox-slider").css({"-webkit-transform":"translate3d("+(r+g)+"%, 0, 0)",transform:"translate3d("+(r+g)+"%, 0, 0)"}))))}),!1}).bind("touchend",function(a){if(a.preventDefault(),a.stopPropagation(),c("#swipebox-slider").css({"-webkit-transition":"-webkit-transform 0.4s ease",transition:"transform 0.4s ease"}),d=o.pageY-n.pageY,b=o.pageX-n.pageX,g=100*b/p,i)if(i=!1,Math.abs(d)>=2*m&&Math.abs(d)>Math.abs(f)){var k=d>0?s.height():-s.height();s.animate({top:k+"px",opacity:0},300,function(){h.closeSlide()})}else s.animate({top:0,opacity:1},300);else j?(j=!1,b>=l&&b>=e?h.getPrev():-l>=b&&e>=b&&h.getNext()):q.hasClass("visible-bars")?(h.clearTimeout(),h.hideBars()):(h.showBars(),h.setTimeout());c("#swipebox-slider").css({"-webkit-transform":"translate3d("+r+"%, 0, 0)",transform:"translate3d("+r+"%, 0, 0)"}),c("#swipebox-overlay").removeClass("leftSpringTouch").removeClass("rightSpringTouch"),c(".touching").off("touchmove").removeClass("touching")})},setTimeout:function(){if(j.settings.hideBarsDelay>0){var b=this;b.clearTimeout(),b.timeout=a.setTimeout(function(){b.hideBars()},j.settings.hideBarsDelay)}},clearTimeout:function(){a.clearTimeout(this.timeout),this.timeout=null},showBars:function(){var a=c("#swipebox-top-bar, #swipebox-bottom-bar");this.doCssTrans()?a.addClass("visible-bars"):(c("#swipebox-top-bar").animate({top:0},500),c("#swipebox-bottom-bar").animate({bottom:0},500),setTimeout(function(){a.addClass("visible-bars")},1e3))},hideBars:function(){var a=c("#swipebox-top-bar, #swipebox-bottom-bar");this.doCssTrans()?a.removeClass("visible-bars"):(c("#swipebox-top-bar").animate({top:"-50px"},500),c("#swipebox-bottom-bar").animate({bottom:"-50px"},500),setTimeout(function(){a.removeClass("visible-bars")},1e3))},animBars:function(){var a=this,b=c("#swipebox-top-bar, #swipebox-bottom-bar");b.addClass("visible-bars"),a.setTimeout(),c("#swipebox-slider").click(function(){b.hasClass("visible-bars")||(a.showBars(),a.setTimeout())}),c("#swipebox-bottom-bar").hover(function(){a.showBars(),b.addClass("visible-bars"),a.clearTimeout()},function(){j.settings.hideBarsDelay>0&&(b.removeClass("visible-bars"),a.setTimeout())})},keyboard:function(){var b=this;c(a).bind("keyup",function(a){a.preventDefault(),a.stopPropagation(),37===a.keyCode?b.getPrev():39===a.keyCode?b.getNext():27===a.keyCode&&b.closeSlide()})},actions:function(){var a=this,b="touchend click";k.length<2?(c("#swipebox-bottom-bar").hide(),d===k[1]&&c("#swipebox-top-bar").hide()):(c("#swipebox-prev").bind(b,function(b){b.preventDefault(),b.stopPropagation(),a.getPrev(),a.setTimeout()}),c("#swipebox-next").bind(b,function(b){b.preventDefault(),b.stopPropagation(),a.getNext(),a.setTimeout()})),c("#swipebox-close").bind(b,function(){a.closeSlide()})},setSlide:function(a,b){b=b||!1;var d=c("#swipebox-slider");r=100*-a,this.doCssTrans()?d.css({"-webkit-transform":"translate3d("+100*-a+"%, 0, 0)",transform:"translate3d("+100*-a+"%, 0, 0)"}):d.animate({left:100*-a+"%"}),c("#swipebox-slider .slide").removeClass("current"),c("#swipebox-slider .slide").eq(a).addClass("current"),this.setTitle(a),b&&d.fadeIn(),c("#swipebox-prev, #swipebox-next").removeClass("disabled"),0===a?c("#swipebox-prev").addClass("disabled"):a===k.length-1&&j.settings.loopAtEnd!==!0&&c("#swipebox-next").addClass("disabled")},openSlide:function(b){c("html").addClass("swipebox-html"),n?(c("html").addClass("swipebox-touch"),j.settings.hideCloseButtonOnMobile&&c("html").addClass("swipebox-no-close-button")):c("html").addClass("swipebox-no-touch"),c(a).trigger("resize"),this.setSlide(b,!0)},preloadMedia:function(a){var b=this,c=null;k[a]!==d&&(c=k[a].href),b.isVideo(c)?b.openMedia(a):setTimeout(function(){b.openMedia(a)},1e3)},openMedia:function(a){var b,e,f=this;return k[a]!==d&&(b=k[a].href),0>a||a>=k.length?!1:(e=c("#swipebox-slider .slide").eq(a),void(f.isVideo(b)?(e.html(f.getVideo(b)),j.settings.afterMedia&&j.settings.afterMedia(a)):(e.addClass("slide-loading"),f.loadMedia(b,function(){e.removeClass("slide-loading"),e.html(this),j.settings.afterMedia&&j.settings.afterMedia(a)}))))},setTitle:function(a){var b=null;c("#swipebox-title").empty(),k[a]!==d&&(b=k[a].title),b?(c("#swipebox-top-bar").show(),c("#swipebox-title").append(b)):c("#swipebox-top-bar").hide()},isVideo:function(a){if(a){if(a.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||a.match(/vimeo\.com\/([0-9]*)/)||a.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/))return!0;if(a.toLowerCase().indexOf("swipeboxvideo=1")>=0)return!0}},parseUri:function(a,d){var e=b.createElement("a"),f={};return e.href=decodeURIComponent(a),e.search&&(f=JSON.parse('{"'+e.search.toLowerCase().replace("?","").replace(/&/g,'","').replace(/=/g,'":"')+'"}')),c.isPlainObject(d)&&(f=c.extend(f,d,j.settings.queryStringData)),c.map(f,function(a,b){return a&&a>""?encodeURIComponent(b)+"="+encodeURIComponent(a):void 0}).join("&")},getVideo:function(a){var b="",c=a.match(/((?:www\.)?youtube\.com|(?:www\.)?youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/),d=a.match(/(?:www\.)?youtu\.be\/([a-zA-Z0-9\-_]+)/),e=a.match(/(?:www\.)?vimeo\.com\/([0-9]*)/),f="";return c||d?(d&&(c=d),f=g.parseUri(a,{autoplay:j.settings.autoplayVideos?"1":"0",v:""}),b='<iframe width="560" height="315" src="//'+c[1]+"/embed/"+c[2]+"?"+f+'" frameborder="0" allowfullscreen></iframe>'):e?(f=g.parseUri(a,{autoplay:j.settings.autoplayVideos?"1":"0",byline:"0",portrait:"0",color:j.settings.vimeoColor}),b='<iframe width="560" height="315" src="//player.vimeo.com/video/'+e[1]+"?"+f+'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'):b='<iframe width="560" height="315" src="'+a+'" frameborder="0" allowfullscreen></iframe>','<div class="swipebox-video-container" style="max-width:'+j.settings.videoMaxWidth+'px"><div class="swipebox-video">'+b+"</div></div>"},loadMedia:function(a,b){if(0===a.trim().indexOf("#"))b.call(c("<div>",{"class":"swipebox-inline-container"}).append(c(a).clone().toggleClass(j.settings.toggleClassOnLoad)));else if(!this.isVideo(a)){var d=c("<img>").on("load",function(){b.call(d)});d.attr("src",a)}},getNext:function(){var a,b=this,d=c("#swipebox-slider .slide").index(c("#swipebox-slider .slide.current"));d+1<k.length?(a=c("#swipebox-slider .slide").eq(d).contents().find("iframe").attr("src"),c("#swipebox-slider .slide").eq(d).contents().find("iframe").attr("src",a),d++,b.setSlide(d),b.preloadMedia(d+1),j.settings.nextSlide&&j.settings.nextSlide(d)):j.settings.loopAtEnd===!0?(a=c("#swipebox-slider .slide").eq(d).contents().find("iframe").attr("src"),c("#swipebox-slider .slide").eq(d).contents().find("iframe").attr("src",a),d=0,b.preloadMedia(d),b.setSlide(d),b.preloadMedia(d+1),j.settings.nextSlide&&j.settings.nextSlide(d)):(c("#swipebox-overlay").addClass("rightSpring"),setTimeout(function(){c("#swipebox-overlay").removeClass("rightSpring")},500))},getPrev:function(){var a,b=c("#swipebox-slider .slide").index(c("#swipebox-slider .slide.current"));b>0?(a=c("#swipebox-slider .slide").eq(b).contents().find("iframe").attr("src"),c("#swipebox-slider .slide").eq(b).contents().find("iframe").attr("src",a),b--,this.setSlide(b),this.preloadMedia(b-1),j.settings.prevSlide&&j.settings.prevSlide(b)):(c("#swipebox-overlay").addClass("leftSpring"),setTimeout(function(){c("#swipebox-overlay").removeClass("leftSpring")},500))},nextSlide:function(a){},prevSlide:function(a){},closeSlide:function(){c("html").removeClass("swipebox-html"),c("html").removeClass("swipebox-touch"),c(a).trigger("resize"),this.destroy()},destroy:function(){c(a).unbind("keyup"),c("body").unbind("touchstart"),c("body").unbind("touchmove"),c("body").unbind("touchend"),c("#swipebox-slider").unbind(),c("#swipebox-overlay").remove(),c.isArray(e)||e.removeData("_swipebox"),this.target&&this.target.trigger("swipebox-destroy"),c.swipebox.isOpen=!1,j.settings.afterClose&&j.settings.afterClose()}},j.init()},c.fn.swipebox=function(a){if(!c.data(this,"_swipebox")){var b=new c.swipebox(this,a);this.data("_swipebox",b)}return this.data("_swipebox")}}(window,document,jQuery);
enjoyinstagram.php CHANGED
@@ -2,13 +2,13 @@
2
  /*
3
  Plugin Name: Enjoy Plugin for Instagram
4
  Description: Instagram Responsive Images Gallery and Carousel, works with Shortcodes and Widgets.
5
- Version: 5.0.0
6
  Author: Mediabeta Srl
7
  Text Domain: enjoy-instagram-instagram-responsive-images-gallery-and-carousel
8
  Author URI: http://www.mediabeta.com/team/
9
  */
10
 
11
- ! defined( 'ENJOYINSTAGRAM_VERSION' ) && define( 'ENJOYINSTAGRAM_VERSION', '5.0.0' );
12
  ! defined( 'ENJOYINSTAGRAM_FILE' ) && define( 'ENJOYINSTAGRAM_FILE', __FILE__ );
13
  ! defined( 'ENJOYINSTAGRAM_URL' ) && define( 'ENJOYINSTAGRAM_URL', plugin_dir_url( __FILE__ ) );
14
  ! defined( 'ENJOYINSTAGRAM_DIR' ) && define( 'ENJOYINSTAGRAM_DIR', plugin_dir_path( __FILE__ ) );
@@ -38,4 +38,4 @@ function enjoyinstagram_init_plugin() {
38
  require_once( 'includes/functions.enjoyinstagram.php' );
39
  require_once( 'includes/class.enjoyinstagram.php' );
40
  EnjoyInstagram();
41
- }
2
  /*
3
  Plugin Name: Enjoy Plugin for Instagram
4
  Description: Instagram Responsive Images Gallery and Carousel, works with Shortcodes and Widgets.
5
+ Version: 5.0.1
6
  Author: Mediabeta Srl
7
  Text Domain: enjoy-instagram-instagram-responsive-images-gallery-and-carousel
8
  Author URI: http://www.mediabeta.com/team/
9
  */
10
 
11
+ ! defined( 'ENJOYINSTAGRAM_VERSION' ) && define( 'ENJOYINSTAGRAM_VERSION', '5.0.1' );
12
  ! defined( 'ENJOYINSTAGRAM_FILE' ) && define( 'ENJOYINSTAGRAM_FILE', __FILE__ );
13
  ! defined( 'ENJOYINSTAGRAM_URL' ) && define( 'ENJOYINSTAGRAM_URL', plugin_dir_url( __FILE__ ) );
14
  ! defined( 'ENJOYINSTAGRAM_DIR' ) && define( 'ENJOYINSTAGRAM_DIR', plugin_dir_path( __FILE__ ) );
38
  require_once( 'includes/functions.enjoyinstagram.php' );
39
  require_once( 'includes/class.enjoyinstagram.php' );
40
  EnjoyInstagram();
41
+ }
includes/class.enjoyinstagram-admin.php CHANGED
@@ -305,16 +305,20 @@ class EnjoyInstagram_Admin {
305
 
306
  $is_business = $_GET['api'] === 'graph';
307
  $access_token = sanitize_text_field( $_GET['access_token'] );
308
- $data = EnjoyInstagram_Api_Connection()->get_user_profile( $access_token, $is_business );
309
 
310
  if ( $data === false ) {
311
  $message = EnjoyInstagram_Api_Connection()->last_error;
312
  enjoyinstagram_add_notice( $message, 'error' );
 
 
 
313
  } else {
314
- $data['access_token'] = $access_token;
315
- EnjoyInstagram()->add_user( $data['username'], $data );
 
316
  enjoyinstagram_add_notice(
317
- sprintf( __( 'User %s successfully added', 'enjoyinstagram' ), $data['username'] ),
318
  'notice'
319
  );
320
  }
305
 
306
  $is_business = $_GET['api'] === 'graph';
307
  $access_token = sanitize_text_field( $_GET['access_token'] );
308
+ $data = EnjoyInstagram_Api_Connection()->get_user_accounts( $access_token, $is_business );
309
 
310
  if ( $data === false ) {
311
  $message = EnjoyInstagram_Api_Connection()->last_error;
312
  enjoyinstagram_add_notice( $message, 'error' );
313
+ } else if ( empty( $data ) ) {
314
+ $message = __( 'No account found for this user', 'enjoyinstagram' );
315
+ enjoyinstagram_add_notice( $message, 'error' );
316
  } else {
317
+ $profile = $data[0]; // one account allowed for the free version
318
+ $profile['access_token'] = $access_token;
319
+ EnjoyInstagram()->add_user( $profile['username'], $profile );
320
  enjoyinstagram_add_notice(
321
+ sprintf( __( 'User %s successfully added', 'enjoyinstagram' ), $profile['username'] ),
322
  'notice'
323
  );
324
  }
includes/class.enjoyinstagram-api-connection.php CHANGED
@@ -38,7 +38,53 @@ class EnjoyInstagram_Api_Connection {
38
  }
39
 
40
  /**
41
- * Get user profile
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  *
43
  * @param string $access_token
44
  * @param bool $is_business_profile
@@ -47,56 +93,38 @@ class EnjoyInstagram_Api_Connection {
47
  * @author Giulio Ganci
48
  * @since 11.0.0
49
  */
50
- public function get_user_profile( $access_token, $is_business_profile ) {
51
 
52
- $segment = 'me';
53
  $params['access_token'] = $access_token;
54
- $meta = [];
 
55
 
56
  if ( $is_business_profile ) {
57
  // check is the profile is a real business user
58
- if ( false === ( $segment = $this->is_business( $access_token ) ) ) {
 
 
59
  $this->last_error = __( 'There was an error with account connection; please, make sure to be a business account and try again!',
60
  'enjoyinstagram' );
61
 
62
  return false;
63
  }
64
-
65
- $params['fields'] = 'media_count,username,website,name,profile_picture_url,biography';
66
-
67
- } else {
68
- $params['fields'] = 'id,media_count,username,account_type';
69
  }
70
 
71
- $response = $this->_get_remote_data( $segment, $params, $is_business_profile );
72
-
73
- if ( is_wp_error( $response ) ) {
74
- return false;
75
  }
76
 
77
- if ( $is_business_profile ) {
78
- $meta_params = array(
79
- 'fields' => 'followers_count,media_count,follows_count',
80
- 'access_token' => $access_token
81
- );
82
- $meta_response = $this->_get_remote_data( $response['id'], $meta_params, $is_business_profile );
83
 
84
- if ( ! is_wp_error( $meta_response ) ) {
85
- $meta = $meta_response;
 
86
  }
87
  }
88
 
89
- return array(
90
- 'business' => $is_business_profile,
91
- 'username' => enjoyinstagram_replace4byte( $response['username'] ),
92
- 'website' => $is_business_profile && isset( $response['website'] ) ? $response['website'] : '',
93
- 'profile_picture' => $is_business_profile && isset( $response['profile_picture_url'] ) ? $response['profile_picture_url'] : '',
94
- 'bio' => $is_business_profile && isset( $response['biography'] ) ? enjoyinstagram_replace4byte( $response['biography'] ) : '',
95
- 'full_name' => $is_business_profile && isset( $response['name'] ) ? enjoyinstagram_replace4byte( $response['name'] ) : '',
96
- 'id' => $response['id'],
97
- 'count' => $response['media_count'],
98
- 'meta' => $meta
99
- );
100
  }
101
 
102
  /**
@@ -117,7 +145,7 @@ class EnjoyInstagram_Api_Connection {
117
 
118
  if ( empty( $next ) ) {
119
  $response = $this->_get_remote_data( "{$user['id']}/media", array(
120
- 'fields' => 'media_url,thumbnail_url,caption,id,media_type,timestamp,username,permalink,like_count',
121
  'access_token' => $user['access_token'],
122
  'limit' => $limit
123
  ), $user['business'] );
@@ -169,54 +197,50 @@ class EnjoyInstagram_Api_Connection {
169
  if ( ! is_wp_error( $response ) ) {
170
  // certain ways of representing the html for double quotes causes errors so replaced here.
171
  $response = json_decode( str_replace( '%22', '&rdquo;', $response['body'] ), true );
172
-
173
- if ( isset( $response['error'] ) ) {
174
- $response = new WP_Error( $response['error']['code'], $response['error']['message'] );
175
- }
176
  }
177
 
178
- if ( is_wp_error( $response ) ) {
179
- $this->last_error = $response->get_error_message('http_request_failed');
 
180
  }
181
 
182
  return $response;
183
  }
184
 
185
  /**
186
- * Check if given access token is valid for a business account and return the business ID
187
  *
188
  * @param string $access_token
189
  *
190
- * @return boolean|string
191
- * @since 11.0.0
192
  */
193
- public function is_business( $access_token ) {
194
 
195
- $data = $this->_get_remote_data( 'me/accounts', array( 'access_token' => $access_token ), true );
196
-
197
- if ( is_wp_error( $data ) ) {
198
- return false;
199
- }
200
 
201
  if ( empty( $data ) || empty( $data['data'] ) || ! is_array( $data['data'] ) ) {
202
- return false;
203
  }
204
 
205
- $data = array_shift( $data['data'] );
206
- $page_id = $data['id'];
207
-
208
- $data = $this->_get_remote_data( $page_id,
209
- array( 'fields' => 'instagram_business_account', 'access_token' => $access_token ), true );
 
 
 
210
 
211
- if ( is_wp_error( $data ) ) {
212
- return false;
213
- }
214
 
215
- if ( empty( $data ) || empty( $data['instagram_business_account'] ) || empty( $data['instagram_business_account']['id'] ) ) {
216
- return false;
217
  }
218
 
219
- return sanitize_text_field( $data['instagram_business_account']['id'] );
220
  }
221
 
222
  /**
@@ -229,20 +253,14 @@ class EnjoyInstagram_Api_Connection {
229
  *
230
  * @param array $user
231
  * @param string $hashtag
232
- * @param int $limit
233
  *
234
  * @return array
235
  * @since 11.0.0
236
  */
237
- public function search_business_hashtag( $user, $hashtag, $limit = 20 ) {
238
 
239
  $params = array( 'user_id' => $user['id'], 'access_token' => $user['access_token'], 'q' => $hashtag );
240
  $hashtag_data = $this->_get_remote_data( 'ig_hashtag_search', $params, true );
241
-
242
- if ( is_wp_error( $hashtag_data ) ) {
243
- return array();
244
- }
245
-
246
  if ( empty( $hashtag_data['data'] ) ) {
247
  return array();
248
  }
@@ -252,9 +270,7 @@ class EnjoyInstagram_Api_Connection {
252
  $params = array(
253
  'user_id' => $user['id'],
254
  'access_token' => $user['access_token'],
255
- 'fields' => 'id,permalink,media_url,caption,like_count',
256
- 'limit' => $limit
257
-
258
  );
259
  $medias = $this->_get_remote_data( "{$hashtag_id}/top_media", $params, true );
260
 
@@ -291,14 +307,21 @@ class EnjoyInstagram_Api_Connection {
291
  foreach ( $data as $media ) {
292
 
293
  $caption = isset( $media['caption'] ) ? sanitize_text_field( $media['caption'] ) : '';
 
 
 
 
 
 
 
294
 
295
  $return[] = array(
296
  'image_id' => trim( $media['id'] ),
297
  'image_link' => $media['permalink'],
298
  'image_url' => $media['media_url'],
299
- 'thumbnail_url' => isset( $media['thumbnail_url'] ) ? $media['thumbnail_url'] : $media['media_url'],
300
- 'user' => isset( $media['username'] ) ? enjoyinstagram_replace4byte($media['username']) : '',
301
- 'caption' => isset( $media['caption'] ) ? sanitize_text_field( enjoyinstagram_replace4byte($media['caption']) ) : '',
302
  'likes' => isset( $media['like_count'] ) ? $media['like_count'] : 0,
303
  'tags' => enjoyinstagram_extract_hashtags( $caption ),
304
  'date' => isset( $media['timestamp'] ) ? strtotime( $media['timestamp'] ) : ''
38
  }
39
 
40
  /**
41
+ * @param $segment
42
+ * @param $access_token
43
+ * @param $is_business
44
+ *
45
+ * @return array|bool
46
+ */
47
+ public function get_user_profile( $segment, $access_token, $is_business ) {
48
+
49
+ $meta = [];
50
+ $params = array(
51
+ 'access_token' => $access_token,
52
+ 'fields' => $is_business ? 'media_count,username,website,name,profile_picture_url,biography' : 'id,media_count,username,account_type'
53
+ );
54
+
55
+ $response = $this->_get_remote_data( $segment, $params, $is_business );
56
+
57
+ if ( is_wp_error( $response ) ) {
58
+ return false;
59
+ }
60
+
61
+ if ( $is_business ) {
62
+ $meta_params = array(
63
+ 'fields' => 'followers_count,media_count,follows_count',
64
+ 'access_token' => $access_token
65
+ );
66
+ $meta_response = $this->_get_remote_data( $response['id'], $meta_params, $is_business );
67
+
68
+ if ( ! is_wp_error( $meta_response ) ) {
69
+ $meta = $meta_response;
70
+ }
71
+ }
72
+
73
+ return array(
74
+ 'business' => $is_business,
75
+ 'username' => $response['username'],
76
+ 'website' => $is_business && isset( $response['website'] ) ? $response['website'] : '',
77
+ 'profile_picture' => $is_business && isset( $response['profile_picture_url'] ) ? $response['profile_picture_url'] : '',
78
+ 'bio' => $is_business && isset( $response['biography'] ) ? $response['biography'] : '',
79
+ 'full_name' => $is_business && isset( $response['name'] ) ? $response['name'] : '',
80
+ 'id' => $response['id'],
81
+ 'count' => $response['media_count'],
82
+ 'meta' => $meta
83
+ );
84
+ }
85
+
86
+ /**
87
+ * Get user profiles
88
  *
89
  * @param string $access_token
90
  * @param bool $is_business_profile
93
  * @author Giulio Ganci
94
  * @since 11.0.0
95
  */
96
+ public function get_user_accounts( $access_token, $is_business_profile ) {
97
 
 
98
  $params['access_token'] = $access_token;
99
+ $accounts = [];
100
+ $profiles = [];
101
 
102
  if ( $is_business_profile ) {
103
  // check is the profile is a real business user
104
+ $accounts = $this->get_business_accounts( $access_token );
105
+
106
+ if ( empty( $accounts ) ) {
107
  $this->last_error = __( 'There was an error with account connection; please, make sure to be a business account and try again!',
108
  'enjoyinstagram' );
109
 
110
  return false;
111
  }
 
 
 
 
 
112
  }
113
 
114
+ // for basic display api users
115
+ if ( empty( $accounts ) ) {
116
+ $accounts[] = 'me';
 
117
  }
118
 
119
+ foreach ( $accounts as $segment ) {
 
 
 
 
 
120
 
121
+ $profile = $this->get_user_profile( $segment, $access_token, $is_business_profile );
122
+ if ( $profile ) {
123
+ $profiles[] = $profile;
124
  }
125
  }
126
 
127
+ return $profiles;
 
 
 
 
 
 
 
 
 
 
128
  }
129
 
130
  /**
145
 
146
  if ( empty( $next ) ) {
147
  $response = $this->_get_remote_data( "{$user['id']}/media", array(
148
+ 'fields' => 'media_url,thumbnail_url,caption,id,media_type,timestamp,username,permalink,like_count,children{media_url,id,media_type,timestamp,permalink,thumbnail_url}',
149
  'access_token' => $user['access_token'],
150
  'limit' => $limit
151
  ), $user['business'] );
197
  if ( ! is_wp_error( $response ) ) {
198
  // certain ways of representing the html for double quotes causes errors so replaced here.
199
  $response = json_decode( str_replace( '%22', '&rdquo;', $response['body'] ), true );
 
 
 
 
200
  }
201
 
202
+ if ( isset( $response['error'] ) ) {
203
+ $this->last_error = $response['error']['message'];
204
+ $response = new WP_Error( $response['error']['code'], $response['error']['message'] );
205
  }
206
 
207
  return $response;
208
  }
209
 
210
  /**
211
+ * Returns the id of each instagram account linked to the given access token
212
  *
213
  * @param string $access_token
214
  *
215
+ * @return array
216
+ * @since 11.0.1
217
  */
218
+ public function get_business_accounts( $access_token ) {
219
 
220
+ $data = $this->_get_remote_data( 'me/accounts', array( 'access_token' => $access_token ), true );
221
+ $accounts = array();
 
 
 
222
 
223
  if ( empty( $data ) || empty( $data['data'] ) || ! is_array( $data['data'] ) ) {
224
+ return $accounts;
225
  }
226
 
227
+ foreach ( $data['data'] as $account ) {
228
+ $account_data = $this->_get_remote_data( $account['id'],
229
+ array(
230
+ 'fields' => 'instagram_business_account',
231
+ 'access_token' => $access_token
232
+ ),
233
+ true
234
+ );
235
 
236
+ if ( empty( $account_data ) || empty( $account_data['instagram_business_account'] ) || empty( $account_data['instagram_business_account']['id'] ) ) {
237
+ continue;
238
+ }
239
 
240
+ $accounts[] = $account_data['instagram_business_account']['id'];
 
241
  }
242
 
243
+ return $accounts;
244
  }
245
 
246
  /**
253
  *
254
  * @param array $user
255
  * @param string $hashtag
 
256
  *
257
  * @return array
258
  * @since 11.0.0
259
  */
260
+ public function search_business_hashtag( $user, $hashtag ) {
261
 
262
  $params = array( 'user_id' => $user['id'], 'access_token' => $user['access_token'], 'q' => $hashtag );
263
  $hashtag_data = $this->_get_remote_data( 'ig_hashtag_search', $params, true );
 
 
 
 
 
264
  if ( empty( $hashtag_data['data'] ) ) {
265
  return array();
266
  }
270
  $params = array(
271
  'user_id' => $user['id'],
272
  'access_token' => $user['access_token'],
273
+ 'fields' => 'id,permalink,media_url,caption,like_count,media_type'
 
 
274
  );
275
  $medias = $this->_get_remote_data( "{$hashtag_id}/top_media", $params, true );
276
 
307
  foreach ( $data as $media ) {
308
 
309
  $caption = isset( $media['caption'] ) ? sanitize_text_field( $media['caption'] ) : '';
310
+ $thumb = null;
311
+
312
+ if ( isset( $media['thumbnail_url'] ) ) {
313
+ $thumb = $media['thumbnail_url'];
314
+ } else if ( $media['media_type'] === 'IMAGE' || $media['media_type'] === 'CAROUSEL_ALBUM' ) {
315
+ $thumb = $media['media_url'];
316
+ }
317
 
318
  $return[] = array(
319
  'image_id' => trim( $media['id'] ),
320
  'image_link' => $media['permalink'],
321
  'image_url' => $media['media_url'],
322
+ 'thumbnail_url' => $thumb,
323
+ 'user' => isset( $media['username'] ) ? $media['username'] : '',
324
+ 'caption' => isset( $media['caption'] ) ? sanitize_text_field( $media['caption'] ) : '',
325
  'likes' => isset( $media['like_count'] ) ? $media['like_count'] : 0,
326
  'tags' => enjoyinstagram_extract_hashtags( $caption ),
327
  'date' => isset( $media['timestamp'] ) ? strtotime( $media['timestamp'] ) : ''
includes/class.enjoyinstagram-db.php CHANGED
@@ -31,7 +31,7 @@ class EnjoyInstagram_DB {
31
  * DB version
32
  * @var string
33
  */
34
- protected $db_version = '1.0.2';
35
 
36
  /**
37
  * Single plugin instance
@@ -102,6 +102,10 @@ class EnjoyInstagram_DB {
102
  $wpdb->query( "ALTER TABLE {$this->main_table} ADD date bigint(20) DEFAULT 0 NOT NULL" );
103
  delete_option( 'enjoyinstagram_sync_times' );
104
  break;
 
 
 
 
105
  default:
106
  $sqls = array();
107
  $charset_collate = $wpdb->get_charset_collate();
@@ -111,6 +115,7 @@ class EnjoyInstagram_DB {
111
  image_id varchar(255) DEFAULT '' NOT NULL,
112
  image_link varchar(255) DEFAULT '' NOT NULL,
113
  image_url text DEFAULT '' NOT NULL,
 
114
  user varchar(225) DEFAULT '' NOT NULL,
115
  caption longtext DEFAULT '' NOT NULL,
116
  likes mediumint(9) DEFAULT 0 NOT NULL,
@@ -349,14 +354,15 @@ class EnjoyInstagram_DB {
349
 
350
  $id = $wpdb->get_var( "SELECT id FROM {$this->main_table} WHERE image_id = '{$data['image_id']}'" );
351
  $table_cols = array(
352
- 'image_id' => '%s',
353
- 'image_link' => '%s',
354
- 'image_url' => '%s',
355
- 'user' => '%s',
356
- 'caption' => '%s',
357
- 'likes' => '%d',
358
- 'moderate' => '%s',
359
- 'date' => '%d'
 
360
  );
361
 
362
  $insert = array_intersect_key( $data, $table_cols );
31
  * DB version
32
  * @var string
33
  */
34
+ protected $db_version = '1.0.3';
35
 
36
  /**
37
  * Single plugin instance
102
  $wpdb->query( "ALTER TABLE {$this->main_table} ADD date bigint(20) DEFAULT 0 NOT NULL" );
103
  delete_option( 'enjoyinstagram_sync_times' );
104
  break;
105
+ case '1.0.2':
106
+ $wpdb->query( "ALTER TABLE {$this->main_table} ADD thumbnail_url text DEFAULT '' NOT NULL AFTER image_url" );
107
+ delete_option( 'enjoyinstagram_sync_times' );
108
+ break;
109
  default:
110
  $sqls = array();
111
  $charset_collate = $wpdb->get_charset_collate();
115
  image_id varchar(255) DEFAULT '' NOT NULL,
116
  image_link varchar(255) DEFAULT '' NOT NULL,
117
  image_url text DEFAULT '' NOT NULL,
118
+ thumbnail_url text DEFAULT '' NOT NULL,
119
  user varchar(225) DEFAULT '' NOT NULL,
120
  caption longtext DEFAULT '' NOT NULL,
121
  likes mediumint(9) DEFAULT 0 NOT NULL,
354
 
355
  $id = $wpdb->get_var( "SELECT id FROM {$this->main_table} WHERE image_id = '{$data['image_id']}'" );
356
  $table_cols = array(
357
+ 'image_id' => '%s',
358
+ 'image_link' => '%s',
359
+ 'image_url' => '%s',
360
+ 'thumbnail_url' => '%s',
361
+ 'user' => '%s',
362
+ 'caption' => '%s',
363
+ 'likes' => '%d',
364
+ 'moderate' => '%s',
365
+ 'date' => '%d'
366
  );
367
 
368
  $insert = array_intersect_key( $data, $table_cols );
includes/class.enjoyinstagram-shortcodes.php CHANGED
@@ -188,6 +188,7 @@ class EnjoyInstagram_Shortcodes {
188
  $items_num = get_option( 'enjoyinstagram_carousel_items_number', '4' );
189
  $nav = get_option( 'enjoyinstagram_carousel_navigation', 'false' );
190
  $result = $this->_get_shortcode_data();
 
191
  if ( empty( $result ) ) {
192
  return '';
193
  }
188
  $items_num = get_option( 'enjoyinstagram_carousel_items_number', '4' );
189
  $nav = get_option( 'enjoyinstagram_carousel_navigation', 'false' );
190
  $result = $this->_get_shortcode_data();
191
+
192
  if ( empty( $result ) ) {
193
  return '';
194
  }
includes/class.enjoyinstagram.php CHANGED
@@ -166,7 +166,7 @@ final class EnjoyInstagram {
166
  */
167
  public function schedule_sync( $force = false ) {
168
 
169
- if ( empty( $this->_users ) || defined('DOING_AJAX') ) {
170
  return;
171
  };
172
 
@@ -207,7 +207,7 @@ final class EnjoyInstagram {
207
  $user_data = $this->_users[ $user ];
208
 
209
  $api = EnjoyInstagram_Api_Connection();
210
- $data = $api->get_user_profile( $user_data['access_token'], $user_data['business'] );
211
 
212
 
213
  if ( $data === false && ! empty( $api->last_error ) ) {
166
  */
167
  public function schedule_sync( $force = false ) {
168
 
169
+ if ( empty( $this->_users ) || defined( 'DOING_AJAX' ) ) {
170
  return;
171
  };
172
 
207
  $user_data = $this->_users[ $user ];
208
 
209
  $api = EnjoyInstagram_Api_Connection();
210
+ $data = $api->get_user_profile( $user_data['id'], $user_data['access_token'], $user_data['business'] );
211
 
212
 
213
  if ( $data === false && ! empty( $api->last_error ) ) {
includes/functions.enjoyinstagram.php CHANGED
@@ -65,16 +65,23 @@ if ( ! function_exists( 'enjoyinstagram_format_entry_before_print' ) ) {
65
  $entry['caption'] ) : ''
66
  );
67
 
 
 
 
 
 
 
 
68
  $entry['images'] = array(
69
- 'thumbnail' => array( 'url' => $entry['image_url'] ),
70
  'standard_resolution' => array( 'url' => $entry['image_url'] )
71
  );
72
 
73
  if ( enjoyinstagram_isHttps() ) {
74
  $entry['images']['thumbnail']['url'] = str_replace( 'http://', 'https://',
75
- $entry['image_url'] );
76
  $entry['images']['standard_resolution']['url'] = str_replace( 'http://', 'https://',
77
- $entry['image_url'] );
78
  }
79
 
80
  return $entry;
65
  $entry['caption'] ) : ''
66
  );
67
 
68
+ $entry['type'] = strpos( $entry['image_url'], 'video' ) !== false ? 'video' : 'image';
69
+
70
+ if ( $entry['type'] === 'video' && $entry['thumbnail_url'] === null ) {
71
+ // In public hashtag video has no thumb
72
+ $entry['thumbnail_url'] = ENJOYINSTAGRAM_ASSETS_URL . '/images/video_placeholder.jpeg';
73
+ }
74
+
75
  $entry['images'] = array(
76
+ 'thumbnail' => array( 'url' => $entry['thumbnail_url'] ),
77
  'standard_resolution' => array( 'url' => $entry['image_url'] )
78
  );
79
 
80
  if ( enjoyinstagram_isHttps() ) {
81
  $entry['images']['thumbnail']['url'] = str_replace( 'http://', 'https://',
82
+ $entry['images']['thumbnail']['url'] );
83
  $entry['images']['standard_resolution']['url'] = str_replace( 'http://', 'https://',
84
+ $entry['images']['standard_resolution']['url'] );
85
  }
86
 
87
  return $entry;
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: https://www.google.com/url?q=https%3A%2F%2Fwww.paypal.com%2Fcgi-bin
4
  Tags: Instagram, Instagram feed, Instagram Widget, Instagram grid, Instagram carousel, Embed Instagram, Embed Instagram feed, Instagram feed on website, responsive carousel, WordPress carousel, Instagram gallery, Instagram WordPress, Instagram pictures
5
  Requires at least: 4.0
6
  Tested up to: 5.4
7
- Version: 5.0
8
- Stable tag: 5.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -210,6 +210,8 @@ In the Setting section yon can customize grid and/or Carousel view
210
 
211
  == Changelog ==
212
 
 
 
213
  = 5.0 =
214
  * Compatibility with the new Instagram API's: Basic Display API and Graph API
215
  = 4.0.7 =
4
  Tags: Instagram, Instagram feed, Instagram Widget, Instagram grid, Instagram carousel, Embed Instagram, Embed Instagram feed, Instagram feed on website, responsive carousel, WordPress carousel, Instagram gallery, Instagram WordPress, Instagram pictures
5
  Requires at least: 4.0
6
  Tested up to: 5.4
7
+ Version: 5.0.1
8
+ Stable tag: 5.0.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
210
 
211
  == Changelog ==
212
 
213
+ = 5.0.1 =
214
+ * Fix bug video
215
  = 5.0 =
216
  * Compatibility with the new Instagram API's: Basic Display API and Graph API
217
  = 4.0.7 =
templates/shortcodes/carousel-widget.php CHANGED
@@ -10,6 +10,9 @@ if ( ! defined( 'ABSPATH' ) ) {
10
  ?>
11
  <script>
12
  jQuery(function () {
 
 
 
13
  jQuery(document.body)
14
  .on('click touchend', '#swipebox-slider .current img', function (e) {
15
  jQuery('#swipebox-next').click();
@@ -18,38 +21,42 @@ if ( ! defined( 'ABSPATH' ) ) {
18
  .on('click touchend', '#swipebox-slider .current', function (e) {
19
  jQuery('#swipebox-close').trigger('click');
20
  });
21
- });
22
- jQuery(function ($) {
23
- $(".swipebox").swipebox({
24
  hideBarsDelay: 0
25
  });
26
 
27
- });
28
- jQuery(document).ready(function () {
29
- jQuery("#owl-<?php echo "{$id}"; ?>").owlCarousel({
30
  items: <?php echo "{$n}"; ?>,
31
  navigation: <?php echo "{$n_y_n}"; ?>,
32
  autoPlay: true,
33
- afterAction: callback_height
 
 
 
34
  });
35
 
36
- function callback_height() {
37
- let it = jQuery("#owl-<?php echo $i; ?>").find('.owl-item a');
38
- it.css('height', it.first().outerWidth());
39
- }
40
-
41
- jQuery("#owl-<?php echo "{$id}"; ?>").fadeIn('slow');
42
  });
43
  </script>
44
- <div id="owl-<?php echo "{$id}"; ?>" class="owl-example enjoy-instagram-carousel">
 
45
  <?php foreach ( $result as $entry ) :
46
- $url = ( $n > 3 ) ? $entry['images']['thumbnail']['url'] : $entry['images']['standard_resolution']['url'];
47
- $link_style = "style=\"background-image: url('{$entry['images']['standard_resolution']['url']}'); background-size: cover; display: block; opacity: 1;\"";
 
 
 
 
 
48
  ?>
49
  <div class="box">
50
- <a title="<?php echo $entry['caption']['text'] ?>" rel="gallery_swypebox" class="swipebox"
51
- href="<?php echo $entry['images']['standard_resolution']['url'] ?>" <?php echo $link_style ?>>
52
- <img src="<?php echo $url ?>">
 
 
53
  </a>
54
  </div>
55
  <?php endforeach; ?>
10
  ?>
11
  <script>
12
  jQuery(function () {
13
+
14
+ $slider = jQuery("#owl-<?php echo $i ?>");
15
+
16
  jQuery(document.body)
17
  .on('click touchend', '#swipebox-slider .current img', function (e) {
18
  jQuery('#swipebox-next').click();
21
  .on('click touchend', '#swipebox-slider .current', function (e) {
22
  jQuery('#swipebox-close').trigger('click');
23
  });
24
+
25
+
26
+ jQuery(".swipebox").swipebox({
27
  hideBarsDelay: 0
28
  });
29
 
30
+ $slider.owlCarousel({
 
 
31
  items: <?php echo "{$n}"; ?>,
32
  navigation: <?php echo "{$n_y_n}"; ?>,
33
  autoPlay: true,
34
+ afterAction: function () {
35
+ let it = $slider.find('.owl-item a');
36
+ it.css('height', it.first().outerWidth());
37
+ }
38
  });
39
 
40
+ $slider.fadeIn('slow');
 
 
 
 
 
41
  });
42
  </script>
43
+
44
+ <div id="owl-<?php echo $i ?>" class="owl-example enjoy-instagram-carousel" style="display:none;">
45
  <?php foreach ( $result as $entry ) :
46
+
47
+ $url = $entry['images']['standard_resolution']['url'];
48
+ if ( $entry['type'] === 'video' ) {
49
+ $url .= '&swipeboxvideo=1';
50
+ }
51
+
52
+ $link_style = "style=\"background-image: url('{$entry['images']['thumbnail']['url']}'); background-size: cover; display: block; opacity: 1;\"";
53
  ?>
54
  <div class="box">
55
+ <a title="<?php echo $entry['caption']['text'] ?>" rel="gallery_swypebox"
56
+ class="<?php echo $entry['type'] === 'video' ? 'swipebox swipebox_video' : 'swipebox' ?>"
57
+ href="<?php echo $url ?>" <?php echo $link_style ?>>
58
+ <img alt="<?php echo $entry['caption']['text'] ?>"
59
+ src="<?php echo $entry['images']['thumbnail']['url'] ?>">
60
  </a>
61
  </div>
62
  <?php endforeach; ?>
templates/shortcodes/carousel.php CHANGED
@@ -3,60 +3,67 @@
3
  * Carousel shortcode template
4
  */
5
 
6
- if( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
  }
9
 
10
  ?>
11
 
12
  <script>
13
- jQuery(function(){
14
- jQuery(document.body)
15
- .on('click touchend','#swipebox-slider .current img', function(e){
16
- jQuery('#swipebox-next').click();
17
- return false;
18
- })
19
- .on('click touchend','#swipebox-slider .current', function(e){
20
- jQuery('#swipebox-close').trigger('click');
21
- });
 
 
 
 
22
  });
23
- jQuery(function($) {
24
- $(".swipebox").swipebox({
25
- hideBarsDelay: 0
26
- });
27
- });
28
- jQuery(document).ready(function() {
29
- jQuery("#owl-<?php echo $i; ?>").owlCarousel({
30
- lazyLoad: true,
31
- items: <?php echo $items_num ?>,
32
- itemsDesktop: [1199,<?php echo $items_num ?>],
33
- itemsDesktopSmall: [980,<?php echo $items_num ?>],
34
- itemsTablet: [768,<?php echo $items_num ?>],
35
- itemsMobile: [479,<?php echo $items_num ?>],
36
- stopOnHover: true,
37
- autoPlay: true,
38
- navigation: <?php echo $nav ?>,
39
- afterAction: callback_height
40
- });
41
- function callback_height() {
42
- let it = jQuery("#owl-<?php echo $i; ?>").find('.owl-item a');
43
- it.css( 'height', it.first().outerWidth() );
44
- }
45
- jQuery("#owl-<?php echo $i; ?>").fadeIn();
46
  });
 
 
 
 
 
 
 
 
47
  </script>
48
 
49
  <div id="owl-<?php echo $i ?>" class="owl-example enjoy-instagram-carousel" style="display:none;">
50
- <?php foreach( $result as $entry ) :
51
- $link = $entry['images']['standard_resolution']['url'];
52
- $url = ($items_num > 3) ? $entry['images']['thumbnail']['url'] : $entry['images']['standard_resolution']['url'];
 
 
 
53
 
54
- $link_style = "style=\"background-image: url('{$entry['images']['standard_resolution']['url']}'); background-size: cover; display: block; opacity: 1;\"";
55
- ?>
56
  <div class="box">
57
- <a title="<?php echo $entry['caption']['text'] ?>" rel="gallery_swypebox" class="swipebox" href="<?php echo $link ?>" <?php echo $link_style ?>>
58
- <img alt="<?php echo $entry['caption']['text'] ?>" src="<?php echo $url ?>">
 
 
59
  </a>
60
  </div>
61
- <?php endforeach; ?>
62
  </div>
3
  * Carousel shortcode template
4
  */
5
 
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
  }
9
 
10
  ?>
11
 
12
  <script>
13
+ jQuery(function () {
14
+ jQuery(document.body)
15
+ .on('click touchend', '#swipebox-slider .current img', function (e) {
16
+ jQuery('#swipebox-next').click();
17
+ return false;
18
+ })
19
+ .on('click touchend', '#swipebox-slider .current', function (e) {
20
+ jQuery('#swipebox-close').trigger('click');
21
+ });
22
+ });
23
+ jQuery(function ($) {
24
+ $(".swipebox").swipebox({
25
+ hideBarsDelay: 0
26
  });
27
+ });
28
+ jQuery(document).ready(function () {
29
+ jQuery("#owl-<?php echo $i; ?>").owlCarousel({
30
+ lazyLoad: true,
31
+ items: <?php echo $items_num ?>,
32
+ itemsDesktop: [1199,<?php echo $items_num ?>],
33
+ itemsDesktopSmall: [980,<?php echo $items_num ?>],
34
+ itemsTablet: [768,<?php echo $items_num ?>],
35
+ itemsMobile: [479,<?php echo $items_num ?>],
36
+ stopOnHover: true,
37
+ autoPlay: true,
38
+ navigation: <?php echo $nav ?>,
39
+ afterAction: callback_height
 
 
 
 
 
 
 
 
 
 
40
  });
41
+
42
+ function callback_height() {
43
+ let it = jQuery("#owl-<?php echo $i; ?>").find('.owl-item a');
44
+ it.css('height', it.first().outerWidth());
45
+ }
46
+
47
+ jQuery("#owl-<?php echo $i; ?>").fadeIn();
48
+ });
49
  </script>
50
 
51
  <div id="owl-<?php echo $i ?>" class="owl-example enjoy-instagram-carousel" style="display:none;">
52
+ <?php foreach ( $result as $entry ) :
53
+
54
+ $url = $entry['images']['standard_resolution']['url'];
55
+ if($entry['type'] === 'video') {
56
+ $url .= '&swipeboxvideo=1';
57
+ }
58
 
59
+ $link_style = "style=\"background-image: url('{$entry['images']['thumbnail']['url']}'); background-size: cover; display: block; opacity: 1;\"";
60
+ ?>
61
  <div class="box">
62
+ <a title="<?php echo $entry['caption']['text'] ?>" rel="gallery_swypebox" class="<?php echo $entry['type'] === 'video' ? 'swipebox swipebox_video' : 'swipebox' ?>"
63
+ href="<?php echo $url ?>" <?php echo $link_style ?>>
64
+ <img alt="<?php echo $entry['caption']['text'] ?>"
65
+ src="<?php echo $entry['images']['thumbnail']['url'] ?>">
66
  </a>
67
  </div>
68
+ <?php endforeach; ?>
69
  </div>
templates/shortcodes/grid-widget.php CHANGED
@@ -3,57 +3,62 @@
3
  * Grid shortcode template
4
  */
5
 
6
- if( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
  }
9
 
10
  ?>
11
  <div id="rigrid-<?php echo "{$id}"; ?>" class="ri-grid ri-grid-size-2 ri-shadow" style="display:none">
12
  <ul>
13
- <?php foreach( $result as $entry ) :
14
- if( empty( $entry['images'] ) )
15
- continue;
16
- ?>
 
 
 
 
17
  <li>
18
- <a title="<?php echo $entry['caption']['text']; ?>" class="swipebox_grid"
19
- href="<?php echo $entry['images']['standard_resolution']['url'] ?>">
20
- <img src="<?php echo $entry['images']['standard_resolution']['url'] ?>">
 
21
  </a>
22
  </li>
23
- <?php endforeach; ?>
24
  </ul>
25
  </div>
26
 
27
  <script type="text/javascript">
28
- jQuery(function() {
29
- jQuery('#rigrid-<?php echo "{$id}"; ?>').gridrotator({
30
- rows: <?php echo "{$n_r}"; ?>,
31
- columns: <?php echo "{$n_c}"; ?>,
32
- animType: 'fadeInOut',
33
- onhover: false,
34
- interval: 7000,
35
- preventClick: false,
36
- w1024: {
37
- rows: <?php echo "{$n_r}"; ?>,
38
- columns: <?php echo "{$n_c}"; ?>
39
- },
40
- w768: {
41
- rows: <?php echo "{$n_r}"; ?>,
42
- columns: <?php echo "{$n_c}"; ?>
43
- },
44
- w480: {
45
- rows: <?php echo "{$n_r}"; ?>,
46
- columns: <?php echo "{$n_c}"; ?>
47
- },
48
- w320: {
49
- rows: <?php echo "{$n_r}"; ?>,
50
- columns: <?php echo "{$n_c}"; ?>
51
- },
52
- w240: {
53
- rows: <?php echo "{$n_r}"; ?>,
54
- columns: <?php echo "{$n_c}"; ?>
55
- }
56
- });
57
- jQuery('#rigrid-<?php echo "{$id}"; ?>').fadeIn('slow');
58
  });
 
 
59
  </script>
3
  * Grid shortcode template
4
  */
5
 
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
  }
9
 
10
  ?>
11
  <div id="rigrid-<?php echo "{$id}"; ?>" class="ri-grid ri-grid-size-2 ri-shadow" style="display:none">
12
  <ul>
13
+ <?php foreach ( $result as $entry ) :
14
+
15
+ $url = $entry['images']['standard_resolution']['url'];
16
+ if ( $entry['type'] === 'video' ) {
17
+ $url .= '&swipeboxvideo=1';
18
+ }
19
+
20
+ ?>
21
  <li>
22
+ <a title="<?php echo $entry['caption']['text'] ?>" class="swipebox_grid"
23
+ href="<?php echo $url ?>">
24
+ <img alt="<?php echo $entry['caption']['text'] ?>"
25
+ src="<?php echo $entry['images']['thumbnail']['url'] ?>">
26
  </a>
27
  </li>
28
+ <?php endforeach; ?>
29
  </ul>
30
  </div>
31
 
32
  <script type="text/javascript">
33
+ jQuery(function () {
34
+ jQuery('#rigrid-<?php echo "{$id}"; ?>').gridrotator({
35
+ rows: <?php echo "{$n_r}"; ?>,
36
+ columns: <?php echo "{$n_c}"; ?>,
37
+ animType: 'fadeInOut',
38
+ onhover: false,
39
+ interval: 7000,
40
+ preventClick: false,
41
+ w1024: {
42
+ rows: <?php echo "{$n_r}"; ?>,
43
+ columns: <?php echo "{$n_c}"; ?>
44
+ },
45
+ w768: {
46
+ rows: <?php echo "{$n_r}"; ?>,
47
+ columns: <?php echo "{$n_c}"; ?>
48
+ },
49
+ w480: {
50
+ rows: <?php echo "{$n_r}"; ?>,
51
+ columns: <?php echo "{$n_c}"; ?>
52
+ },
53
+ w320: {
54
+ rows: <?php echo "{$n_r}"; ?>,
55
+ columns: <?php echo "{$n_c}"; ?>
56
+ },
57
+ w240: {
58
+ rows: <?php echo "{$n_r}"; ?>,
59
+ columns: <?php echo "{$n_c}"; ?>
60
+ }
 
 
61
  });
62
+ jQuery('#rigrid-<?php echo "{$id}"; ?>').fadeIn('slow');
63
+ });
64
  </script>
templates/shortcodes/grid.php CHANGED
@@ -48,16 +48,21 @@ if ( ! defined( 'ABSPATH' ) ) {
48
  </script>
49
  <div id="grid-<?php echo $i ?>" class="ri-grid ri-grid-size-2 ri-shadow" style="display:none;">
50
  <ul>
51
- <?php foreach ( $result as $entry ) :
52
- $link = $entry['images']['standard_resolution']['url'];
53
- ?>
 
 
 
 
 
54
  <li>
55
  <a title="<?php echo $entry['caption']['text'] ?>" class="swipebox_grid"
56
- href="<?php echo $link ?>">
57
  <img alt="<?php echo $entry['caption']['text'] ?>"
58
- src="<?php echo $entry['images']['standard_resolution']['url'] ?>">
59
  </a>
60
  </li>
61
- <?php endforeach; ?>
62
  </ul>
63
  </div>
48
  </script>
49
  <div id="grid-<?php echo $i ?>" class="ri-grid ri-grid-size-2 ri-shadow" style="display:none;">
50
  <ul>
51
+ <?php foreach ( $result as $entry ) :
52
+
53
+ $url = $entry['images']['standard_resolution']['url'];
54
+ if ( $entry['type'] === 'video' ) {
55
+ $url .= '&swipeboxvideo=1';
56
+ }
57
+
58
+ ?>
59
  <li>
60
  <a title="<?php echo $entry['caption']['text'] ?>" class="swipebox_grid"
61
+ href="<?php echo $url ?>">
62
  <img alt="<?php echo $entry['caption']['text'] ?>"
63
+ src="<?php echo $entry['images']['thumbnail']['url'] ?>">
64
  </a>
65
  </li>
66
+ <?php endforeach; ?>
67
  </ul>
68
  </div>