Crelly Slider - Version 1.3.5

Version Description

  • Security patch
  • Improved import/export slider functions. They should now be compatible with web hosting services that block file_get_contents
  • Minor changes and bux fixes
Download this release

Release Info

Developer fabiorino
Plugin Icon 128x128 Crelly Slider
Version 1.3.5
Comparing to
See all releases

Code changes from version 1.3.4 to 1.3.5

README.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Crelly Slider
2
+ __Crelly Slider has Layers Animations, is Free, Responsive and Easy to Use__
3
+
4
+ Crelly Slider in the WordPress plugins reposity: https://wordpress.org/plugins/crelly-slider
5
+
6
+ Official plugin website (with live demo): http://crellyslider.altervista.org/
7
+
8
+ Documentation: http://crellyslider.altervista.org/documentation/
9
+
10
+ ## Description
11
+ Crelly Slider is a Free / Open Source WordPress slider with a powerful Drag & Drop Builder. You can add Texts, Images, YouTube/Vimeo videos and animate each of them. It's perfect to display your creative content in posts and pages. With it's tons of features, Crelly Slider is the best free solution for your online WebSite.
12
+
13
+
14
+
15
+ #### User Friendly Admin Panel
16
+ Crelly Slider does not require any Coding Knowledge. With the simple admin panel you will be able to create the sliders in the easiest way. Upload images with the default WordPress interface or choose colors using the picker.
17
+
18
+ #### High Cross Browser Compatibility
19
+ Most of the animations and the transitions are written in jQuery (using the "animate" function). In this way we can assure the compatibility with modern (even Android and iOs) and older browsers.
20
+
21
+ #### Drag and Drop Builder
22
+ How can you position all the elements in to the slider area? You just simply drag them in to the desired position. Like in Powerpoint, you just have to move the object around the Slide.
23
+
24
+ #### Transitions & Animations
25
+ Foreach element and slide you can choose an in animation and an out animation using a simple selection menu. You can set the transition speeds and how long the element will take to get in and out.
26
+
27
+ #### Completely Responsive
28
+ Responsive means that the Slider will be displayed correctly in every resolution that the user will use. If the display is small (like in a smartphone), the slides and the elements will be scaled to be adapted.
29
+
30
+ #### Full & Fixed Width Modes
31
+ Using Crelly Slider you can select between a fixed or a full-width layout (both of them can be responsive). You are the designer, you own the WebSite, just choose the best for it.
crellyslider.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Crelly Slider
4
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
5
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
6
- * Version: 1.3.4
7
  * Author: Fabio Rinaldi
8
  * Author URI: https://github.com/fabiorino
9
  * Text Domain: crelly-slider
@@ -18,7 +18,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
18
 
19
  define('CS_DEBUG', false);
20
 
21
- define('CS_VERSION', '1.3.4');
 
22
  define('CS_PATH', plugin_dir_path(__FILE__));
23
  define('CS_PLUGIN_URL', plugins_url() . '/crelly-slider');
24
 
3
  * Plugin Name: Crelly Slider
4
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
5
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
6
+ * Version: 1.3.5
7
  * Author: Fabio Rinaldi
8
  * Author URI: https://github.com/fabiorino
9
  * Text Domain: crelly-slider
18
 
19
  define('CS_DEBUG', false);
20
 
21
+ define('CS_VERSION', '1.3.5');
22
+ define('CS_MIN_CAPABILITY', 'manage_options');
23
  define('CS_PATH', plugin_dir_path(__FILE__));
24
  define('CS_PLUGIN_URL', plugins_url() . '/crelly-slider');
25
 
css/crellyslider.css CHANGED
@@ -2,7 +2,7 @@
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
- * Version: 1.3.4
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.3.5
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
css/crellyslider.min.css CHANGED
@@ -2,7 +2,7 @@
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
- * Version: 1.3.4
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.3.5
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
js/jquery.crellyslider.js CHANGED
@@ -2,7 +2,7 @@
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
- * Version: 1.3.4
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
@@ -331,7 +331,7 @@ var crellyslider_vimeo_api_ready = false;
331
  if(e.data === YT.PlayerState.PLAYING) {
332
  youtube_videos[element.attr('id')].manually_paused = false;
333
  }
334
- }
335
  },
336
  },
337
  });
@@ -454,7 +454,7 @@ var crellyslider_vimeo_api_ready = false;
454
  var element = $(this);
455
 
456
  element.find('*').each(function() {
457
- var element_content = $(this);
458
  setElementData(element_content);
459
  });
460
 
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.3.5
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
331
  if(e.data === YT.PlayerState.PLAYING) {
332
  youtube_videos[element.attr('id')].manually_paused = false;
333
  }
334
+ }
335
  },
336
  },
337
  });
454
  var element = $(this);
455
 
456
  element.find('*').each(function() {
457
+ var element_content = $(this);
458
  setElementData(element_content);
459
  });
460
 
js/jquery.crellyslider.min.js CHANGED
@@ -2,10 +2,10 @@
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
- * Version: 1.3.4
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
9
  */
10
 
11
- var crellyslider_youtube_api_ready=!1,crellyslider_vimeo_api_ready=!1;!function(e){var t,i,n;t=this,i=document,n=function(e,t,i,n){var a,o;(function(e,t,i,n){function a(e){for(;e&&void 0!==e.originalEvent;)e=e.originalEvent;return e}function o(t){for(var i,n,a={};t;){for(n in i=e.data(t,k))i[n]&&(a[n]=a.hasVirtualBinding=!0);t=t.parentNode}return a}function s(){M=!0}function r(){M=!1}function c(){l(),P=setTimeout(function(){P=0,C=0,Y.length=0,O=!1,s()},e.vmouse.resetTimerDuration)}function l(){P&&(clearTimeout(P),P=0)}function d(t,i,o){var s;return(o&&o[t]||!o&&function(t,i){for(var n;t;){if((n=e.data(t,k))&&(!i||n[i]))return t;t=t.parentNode}return null}(i.target,t))&&(s=function(t,i){var o,s,r,c,l,d,p,f,u,h=t.type;if((t=e.Event(t)).type=i,o=t.originalEvent,s=e.event.props,h.search(/^(mouse|click)/)>-1&&(s=E),o)for(p=s.length;p;)t[c=s[--p]]=o[c];if(h.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1),-1!==h.search(/^touch/)&&(h=(r=a(o)).touches,l=r.changedTouches,d=h&&h.length?h[0]:l&&l.length?l[0]:n))for(f=0,u=D.length;f<u;f++)t[c=D[f]]=d[c];return t}(i,t),e(i.target).trigger(s)),s}function p(t){var i,n=e.data(t.target,S);!O&&(!C||C!==n)&&((i=d("v"+t.type,t))&&(i.isDefaultPrevented()&&t.preventDefault(),i.isPropagationStopped()&&t.stopPropagation(),i.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function f(t){var i,n,s,c=a(t).touches;c&&1===c.length&&((n=o(i=t.target)).hasVirtualBinding&&(C=z++,e.data(i,S,C),l(),r(),F=!1,s=a(t).touches[0],N=s.pageX,L=s.pageY,d("vmouseover",t,n),d("vmousedown",t,n)))}function u(e){M||(F||d("vmousecancel",e,o(e.target)),F=!0,c())}function h(t){if(!M){var i=a(t).touches[0],n=F,s=e.vmouse.moveDistanceThreshold,r=o(t.target);(F=F||Math.abs(i.pageX-N)>s||Math.abs(i.pageY-L)>s)&&!n&&d("vmousecancel",t,r),d("vmousemove",t,r),c()}}function v(e){if(!M){s();var t,i,n=o(e.target);d("vmouseup",e,n),F||(t=d("vclick",e,n))&&t.isDefaultPrevented()&&(i=a(e).changedTouches[0],Y.push({touchID:C,x:i.clientX,y:i.clientY}),O=!0),d("vmouseout",e,n),F=!1,c()}}function y(t){var i,n=e.data(t,k);if(n)for(i in n)if(n[i])return!0;return!1}function m(){}function g(t){var i=t.substr(1);return{setup:function(){y(this)||e.data(this,k,{}),e.data(this,k)[t]=!0,_[t]=(_[t]||0)+1,1===_[t]&&R.bind(i,p),e(this).bind(i,m),x&&(_.touchstart=(_.touchstart||0)+1,1===_.touchstart&&R.bind("touchstart",f).bind("touchend",v).bind("touchmove",h).bind("scroll",u))},teardown:function(){--_[t],_[t]||R.unbind(i,p),x&&(--_.touchstart,_.touchstart||R.unbind("touchstart",f).unbind("touchmove",h).unbind("touchend",v).unbind("scroll",u));var n=e(this),a=e.data(this,k);a&&(a[t]=!1),n.unbind(i,m),y(this)||n.removeData(k)}}}var b,w,k="virtualMouseBindings",S="virtualTouchID",T="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),D="clientX clientY pageX pageY screenX screenY".split(" "),I=e.event.mouseHooks?e.event.mouseHooks.props:[],E=e.event.props.concat(I),_={},P=0,N=0,L=0,F=!1,Y=[],O=!1,M=!1,x="addEventListener"in i,R=e(i),z=1,C=0;for(e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},w=0;w<T.length;w++)e.event.special[T[w]]=g(T[w]);x&&i.addEventListener("click",function(t){var i,n,a,o,s,r=Y.length,c=t.target;if(r)for(i=t.clientX,n=t.clientY,b=e.vmouse.clickDistanceThreshold,a=c;a;){for(o=0;o<r;o++)if(s=Y[o],0,a===c&&Math.abs(s.x-i)<b&&Math.abs(s.y-n)<b||e.data(a,S)===s.touchID)return t.preventDefault(),void t.stopPropagation();a=a.parentNode}},!0)})(e,0,i),e.mobile={},o={touch:"ontouchend"in i},(a=e).mobile.support=a.mobile.support||{},a.extend(a.support,o),a.extend(a.mobile.support,o),function(e,t,n){function a(t,i,a,o){var s=a.type;a.type=i,o?e.event.trigger(a,n,t):e.event.dispatch.call(t,a),a.type=s}var o=e(i),s=e.mobile.support.touch,r="touchmove scroll",c=s?"touchstart":"mousedown",l=s?"touchend":"mouseup",d=s?"touchmove":"mousemove";e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,i){e.fn[i]=function(e){return e?this.bind(i,e):this.trigger(i)},e.attrFn&&(e.attrFn[i]=!0)}),e.event.special.scrollstart={enabled:!0,setup:function(){function t(e,t){a(o,(i=t)?"scrollstart":"scrollstop",e)}var i,n,o=this;e(o).bind(r,function(a){e.event.special.scrollstart.enabled&&(i||t(a,!0),clearTimeout(n),n=setTimeout(function(){t(a,!1)},50))})},teardown:function(){e(this).unbind(r)}},e.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var t=this,i=e(t),n=!1;i.bind("vmousedown",function(s){function r(){clearTimeout(d)}function c(){r(),i.unbind("vclick",l).unbind("vmouseup",r),o.unbind("vmousecancel",c)}function l(e){c(),n||p!==e.target?n&&e.preventDefault():a(t,"tap",e)}if(n=!1,s.which&&1!==s.which)return!1;var d,p=s.target;i.bind("vmouseup",r).bind("vclick",l),o.bind("vmousecancel",c),d=setTimeout(function(){e.event.special.tap.emitTapOnTaphold||(n=!0),a(t,"taphold",e.Event("taphold",{target:p}))},e.event.special.tap.tapholdThreshold)})},teardown:function(){e(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),o.unbind("vmousecancel")}},e.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var i=t.pageXOffset,n=t.pageYOffset,a=e.clientX,o=e.clientY;return 0===e.pageY&&Math.floor(o)>Math.floor(e.pageY)||0===e.pageX&&Math.floor(a)>Math.floor(e.pageX)?(a-=i,o-=n):(o<e.pageY-n||a<e.pageX-i)&&(a=e.pageX-i,o=e.pageY-n),{x:a,y:o}},start:function(t){var i=t.originalEvent.touches?t.originalEvent.touches[0]:t,n=e.event.special.swipe.getLocation(i);return{time:(new Date).getTime(),coords:[n.x,n.y],origin:e(t.target)}},stop:function(t){var i=t.originalEvent.touches?t.originalEvent.touches[0]:t,n=e.event.special.swipe.getLocation(i);return{time:(new Date).getTime(),coords:[n.x,n.y]}},handleSwipe:function(t,i,n,o){if(i.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-i.coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-i.coords[1])<e.event.special.swipe.verticalDistanceThreshold){var s=t.coords[0]>i.coords[0]?"swipeleft":"swiperight";return a(n,"swipe",e.Event("swipe",{target:o,swipestart:t,swipestop:i}),!0),a(n,s,e.Event(s,{target:o,swipestart:t,swipestop:i}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,i=this,n=e(i),a={};(t=e.data(this,"mobile-events"))||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=a,a.start=function(t){if(!e.event.special.swipe.eventInProgress){e.event.special.swipe.eventInProgress=!0;var n,s=e.event.special.swipe.start(t),r=t.target,c=!1;a.move=function(t){s&&!t.isDefaultPrevented()&&(n=e.event.special.swipe.stop(t),c||(c=e.event.special.swipe.handleSwipe(s,n,i,r))&&(e.event.special.swipe.eventInProgress=!1),Math.abs(s.coords[0]-n.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault())},a.stop=function(){c=!0,e.event.special.swipe.eventInProgress=!1,o.off(d,a.move),a.move=null},o.on(d,a.move).one(l,a.stop)}},n.on(c,a.start)},teardown:function(){var t,i;(t=e.data(this,"mobile-events"))&&(i=t.swipe,delete t.swipe,t.length--,0===t.length&&e.removeData(this,"mobile-events")),i&&(i.start&&e(this).off(c,i.start),i.move&&o.off(d,i.move),i.stop&&o.off(l,i.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,i){e.event.special[t]={setup:function(){e(this).bind(i,e.noop)},teardown:function(){e(this).unbind(i)}}})}(e,this)},"function"==typeof define&&define.amd?define(["jquery"],function(e){return n(e,0,i),e.mobile}):n(t.jQuery,0,i),e.CrellySlider=function(t,i){var n,a=e(t),o="div.crellyslider",s="ul.cs-slides",r="li.cs-slide",c="> *",l=0,d=!1,p=!1,f=!1,u=!0,h=new H(function(){},0),v=new Array,y=new Array,m={},g={},b=1,w=0;if(!crellyslider_youtube_api_ready&&S("youtube")&&function(){var e=document.createElement("script");e.src="https://www.youtube.com/iframe_api";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t),crellyslider_youtube_api_ready=!0}(),!crellyslider_vimeo_api_ready&&S("vimeo")&&(!function(){function e(t){return new e.fn.init(t)}function t(e,t,i){if(!i.contentWindow.postMessage)return!1;e=JSON.stringify({method:e,value:t}),i.contentWindow.postMessage(e,s)}function i(e){var t,i;try{i=(t=JSON.parse(e.data)).event||t.method}catch(e){}if("ready"!=i||o||(o=!0),!/^https?:\/\/player.vimeo.com/.test(e.origin))return!1;"*"===s&&(s=e.origin),e=t.value;var n=t.data,r=""===r?null:t.player_id;return t=r?a[r][i]:a[i],i=[],!!t&&(void 0!==e&&i.push(e),n&&i.push(n),r&&i.push(r),0<i.length?t.apply(null,i):t.call())}function n(e,t,i){i?(a[i]||(a[i]={}),a[i][e]=t):a[e]=t}var a={},o=!1,s="*";e.fn=e.prototype={element:null,init:function(e){return"string"==typeof e&&(e=document.getElementById(e)),this.element=e,this},api:function(e,i){if(!this.element||!e)return!1;var a=this.element,o=""!==a.id?a.id:null,s=i&&i.constructor&&i.call&&i.apply?null:i,r=i&&i.constructor&&i.call&&i.apply?i:null;return r&&n(e,r,o),t(e,s,a),this},addEvent:function(e,i){if(!this.element)return!1;var a=this.element,s=""!==a.id?a.id:null;return n(e,i,s),"ready"!=e?t("addEventListener",e,a):"ready"==e&&o&&i.call(null,s),this},removeEvent:function(e){if(!this.element)return!1;var i=this.element,n=""!==i.id?i.id:null;e:{if(n&&a[n]){if(!a[n][e]){n=!1;break e}a[n][e]=null}else{if(!a[e]){n=!1;break e}a[e]=null}n=!0}"ready"!=e&&n&&t("removeEventListener",e,i)}},e.fn.init.prototype=e.fn,window.addEventListener?window.addEventListener("message",i,!1):window.attachEvent("onmessage",i),window.Froogaloop=window.$f=e}(),crellyslider_vimeo_api_ready=!0),!crellyslider_youtube_api_ready||"undefined"!=typeof YT&&void 0!==YT.Player)T();else var k=setInterval(function(){"undefined"!=typeof YT&&void 0!==YT.Player&&(clearInterval(k),T())},100);function S(e){return"youtube"==e?a.find(".cs-yt-iframe").length>0:"vimeo"==e?a.find(".cs-vimeo-iframe").length>0:-1}function T(){if(a.wrapInner('<div class="crellyslider" />'),a.find(o+" > ul").addClass("cs-slides"),a.find(o+" "+s+" > li").addClass("cs-slide"),0==(n=A().length))return!1;if(1==n){var t=B(0),r=a.find(o).find(s);t.clone().prependTo(r),n++}if(function(){if(!i.randomOrder&&0==i.startFromSlide)return;var e=new Array,t=new Array;if(-1==i.startFromSlide){var r=Math.floor(Math.random()*n);e[0]=r,t[0]=B(r)}else e[0]=i.startFromSlide,t[0]=B(i.startFromSlide);for(var c=1;c<n;c++){if(i.randomOrder)do{r=Math.floor(Math.random()*n)}while(-1!=e.indexOf(r));else r=c+e[0]<n?c+e[0]:c+e[0]-n;e[c]=r,t[c]=B(r)}a.find(o).find(s).empty();for(var c=0;c<n;c++)a.find(o).find(s).append(t[c])}(),i.showControls&&a.find(o).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>'),i.showNavigation){for(var d='<div class="cs-navigation">',f=0;f<n;f++)d+='<span class="cs-slide-link"></span>';d+="</div>",a.find(o).append(d)}i.showProgressBar?a.find(o).append('<div class="cs-progress-bar"></div>'):a.find(o).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>'),a.css("display","block"),i.responsive&&N(),I(),A().find(".cs-background-link").html(" ").data({left:0,top:0,in:"none",out:"none",easeIn:0,easeOut:0,delay:0,time:"all"}),function(){a.find(o).find(s).css("visibility","hidden"),a.find(o).find(".cs-progress-bar").css("display","none"),a.find(o).find(".cs-navigation").css("display","none"),a.find(o).find(".cs-controls").css("display","none");var t=B(0).css("background-image");(t=t.replace(/^url\(["']?/,"").replace(/["']?\)$/,"")).match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)?e("<img>").load(function(){i()}).attr("src",t).each(function(){this.complete&&e(this).load()}):i();function i(){a.find(o).append('<div class="cs-preloader"><div class="cs-bg"></div><div class="cs-loader"><div class="cs-spinner"></div></div></div>'),a.find(o).find(".cs-preloader").css({"background-color":B(l).css("background-color"),"background-image":B(l).css("background-image"),"background-position":B(l).css("background-position"),"background-repeat":B(l).css("background-repeat"),"background-size":B(l).css("background-size")}),a.find(o).find(".cs-preloader > .cs-bg").css({"background-color":B(l).css("background-color"),"background-image":B(l).css("background-image"),"background-position":B(l).css("background-position"),"background-repeat":B(l).css("background-repeat"),"background-size":B(l).css("background-size")})}}(),function(){var t=new e.Deferred,i=A().find(".cs-yt-iframe, .cs-vimeo-iframe").length,n=0;if(0==i)return t.resolve().promise();return A().find(".cs-yt-iframe, .cs-vimeo-iframe").each(function(){e(this).one("load",function(){var a,o,s,r,l;++n==i&&(o=new e.Deferred,s=A(),r=s.find(c+".cs-yt-iframe").length,l=0,0==r?o.resolve().promise():(s.each(function(){e(this).find(c+".cs-yt-iframe").each(function(){var t=e(this);t.uniqueId(),t.attr("id","cs-yt-iframe-"+t.attr("id"));var i=new YT.Player(t.attr("id"),{events:{onReady:function(){++l==r&&o.resolve()},onStateChange:function(e){e.data===YT.PlayerState.ENDED&&X(t,"loop")&&i.playVideo(),p&&(e.data===YT.PlayerState.PAUSED&&(m[t.attr("id")].manually_paused=!0),e.data===YT.PlayerState.PLAYING&&(m[t.attr("id")].manually_paused=!1))}}});a={player:i,played_once:!1,manually_paused:!1},m[t.attr("id")]=a})}),o.promise())).done(function(){var i,n,a,o,s;(n=new e.Deferred,a=A(),o=a.find(c+".cs-vimeo-iframe").length,s=0,0==o?n.resolve().promise():(a.each(function(){e(this).find(c+".cs-vimeo-iframe").each(function(){var t=e(this);t.uniqueId(),t.attr("id","cs-vimeo-iframe-"+t.attr("id")),t.attr("src",t.attr("src")+"&player_id="+t.attr("id"));var a=$f(t[0]);a.addEvent("ready",function(){a.addEvent("finish",function(){g[t.attr("id")].ended=!0}),a.addEvent("play",function(){g[t.attr("id")].played_once=!0,g[t.attr("id")].ended=!1,p&&(g[t.attr("id")].manually_paused=!1)}),a.addEvent("pause",function(){p&&(g[t.attr("id")].manually_paused=!0)}),X(t,"loop")&&a.api("setLoop",!0),++s==o&&n.resolve()}),i={player:a,played_once:!1,ended:!1,manually_paused:!1},g[t.attr("id")]=i})}),n.promise())).done(function(){t.resolve()})})})}),t.promise()}().done(function(){var t=setInterval(function(){"complete"==document.readyState&&a.find(o).find(".cs-preloader").length>0&&(clearInterval(t),function(){i.responsive&&N();I(),w=e(window).width(),A().each(function(){var t=e(this);t.find(c).each(function(){var t=e(this);t.find("*").each(function(){var t=e(this);D(t)}),D(t)}),t.css("display","none"),t.data("opacity",parseFloat(t.css("opacity")))}),i.responsive&&e(window).resize(function(){w!=e(window).width()&&("full-width"==i.layout&&x()!=e(a).width()||e(a).width()<x()||e(a).width()>x()&&x()<i.startWidth)&&_()}),a.find(o).find(".cs-controls > .cs-previous").click(function(){V(C())}),a.find(o).find(".cs-controls > .cs-next").click(function(){V(z())}),i.enableSwipe&&(a.find(o).on("swipeleft",function(){M(),V(z())}),a.find(o).on("swiperight",function(){M(),V(C())})),a.find(o).find(".cs-navigation > .cs-slide-link").click(function(){V(e(this).index())}),i.pauseOnHover&&(a.find(o).find(s).hover(function(){O()}),a.find(o).find(s).mouseleave(function(){M()})),a.find(o).find(s).css("visibility","visible"),a.find(o).find(".cs-progress-bar").css("display","block"),a.find(o).find(".cs-navigation").css("display","block"),a.find(o).find(".cs-controls").css("display","block"),ne(B(0)),B(0).finish(),a.find(o).find(".cs-preloader").animate({opacity:0},300,function(){a.find(o).find(".cs-preloader").remove()}),i.beforeStart(),i.responsive?_():F()}())},100)})}function D(e){e.data("width",parseFloat(e.width())),e.data("height",parseFloat(e.height())),e.data("letter-spacing",parseFloat(e.css("letter-spacing"))),e.data("font-size",parseFloat(e.css("font-size"))),"px"==e.css("line-height").slice(-2).toLowerCase()?e.data("line-height",parseFloat(e.css("line-height"))):"normal"==e.css("line-height")?e.data("line-height",1.15*X(e,"font-size")):e.data("line-height",parseFloat(e.css("line-height"))*X(e,"font-size")),e.data("padding-top",parseFloat(e.css("padding-top"))),e.data("padding-right",parseFloat(e.css("padding-right"))),e.data("padding-bottom",parseFloat(e.css("padding-bottom"))),e.data("padding-left",parseFloat(e.css("padding-left"))),e.data("opacity",parseFloat(e.css("opacity")))}function I(){var e,t;switch(i.layout){case"fixed":e=i.startWidth,t=i.startHeight,a.find(o).css({width:L(e),height:L(t)}),A().css({width:L(e),height:L(t)});break;case"full-width":e=a.width(),t=i.startHeight,a.find(o).css({width:e,height:L(t)}),A().css({width:e,height:L(t)});break;default:return!1}}function E(e){var t=(R()-i.startHeight)/2,n=(x()-i.startWidth)/2,a=0,o=0;return t>0&&(a=t),n>0&&(o=n),{top:a,left:o}}function _(){i.beforeSetResponsive();var t=A();Y(!0),t.each(function(){var t=e(this),i=t.find(c);t.finish(),ne(t),t.finish(),i.each(function(){var t=e(this);t.finish(),oe(t),t.finish(),$(t)&&Q(t)})}),N(),I(),t.each(function(){var t=e(this);t.find(c).each(function(){var t=e(this);t.find("*").each(function(){P(e(this))}),P(t),t.finish(),se(t),t.finish(),$(t)&&Q(t)}),t.finish(),ae(t),t.finish()}),w=e(window).width(),F()}function P(e){e.css({top:L(X(e,"top")+E().top),left:L(X(e,"left")+E().left),"padding-top":L(X(e,"padding-top")),"padding-right":L(X(e,"padding-right")),"padding-bottom":L(X(e,"padding-bottom")),"padding-left":L(X(e,"padding-left"))}),e.is("input")||e.is("button")||e.text().trim().length?e.css({"line-height":L(X(e,"line-height"))+"px","letter-spacing":L(X(e,"letter-spacing")),"font-size":L(X(e,"font-size"))}):e.css({width:L(X(e,"width")),height:L(X(e,"height"))})}function N(){var e=a.width(),t=i.startWidth;b=e>=t||!i.responsive?1:e/t}function L(e){return e*b}function F(){i.automaticSlide?function e(){j(l).done(function(){d||(l=z(),e())})}():j(l),u=!1}function Y(t){for(var i=0;i<v.length;i++)v[i].clear();for(i=0;i<y.length;i++)y[i].clear();h.clear(),A().each(function(){var i=e(this);t?i.finish():i.stop(!0,!0),i.find(c).each(function(){var i=e(this);t?i.finish():i.stop(!0,!0)})}),W()}function O(){!d&&p&&(i.beforePause(),a.find(o).find(".cs-progress-bar").stop(!0),h.pause(),d=!0)}function M(){if(d&&p){i.beforeResume();var e=a.find(o).find(".cs-progress-bar"),t=(X(B(l),"time"),h.getRemaining());e.animate({width:"100%"},t),h.resume(),d=!1}}function x(){return a.find(o).width()}function R(){return a.find(o).height()}function z(){return l+1==n?0:l+1}function C(){return l-1<0?n-1:l-1}function X(e,t){var n;switch(n=!!e.parent("ul").hasClass("cs-slides"),t){case"ease-in":return n?isNaN(parseInt(e.data(t)))?i.slidesEaseIn:parseInt(e.data(t)):isNaN(parseInt(e.data(t)))?i.elementsEaseIn:parseInt(e.data(t));case"ease-out":return n?isNaN(parseInt(e.data(t)))?i.slidesEaseOut:parseInt(e.data(t)):isNaN(parseInt(e.data(t)))?i.elementsEaseOut:parseInt(e.data(t));case"delay":return isNaN(parseInt(e.data(t)))?i.elementsDelay:parseInt(e.data(t));case"time":return n?isNaN(parseInt(e.data(t)))?i.slidesTime:parseInt(e.data(t)):"all"==e.data(t)?"all":isNaN(parseInt(e.data(t)))?i.itemsTime:parseInt(e.data(t));case"ignore-ease-out":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&i.ignoreElementsEaseOut;case"autoplay":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&i.videoAutoplay;case"loop":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&i.videoLoop;case"top":case"left":case"width":case"height":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"line-height":case"letter-spacing":case"font-size":return isNaN(parseFloat(e.data(t)))?0:parseFloat(e.data(t));case"in":case"out":case"opacity":return e.data(t);default:return!1}}function A(){return a.find(o).find(s).find(r)}function B(e){return A().eq(e)}function H(e,t){var i,n,a=t;this.pause=function(){clearTimeout(i),a-=new Date-n},this.resume=function(){n=new Date,clearTimeout(i),i=window.setTimeout(function(){e()},a)},this.clear=function(){clearTimeout(i)},this.getRemaining=function(){return a},this.resume()}function U(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function W(){var e=a.find(o).find(".cs-progress-bar");e.stop(),e.css("width",0)}function V(e){e!=l&&(p||f)&&(Y(!1),q(l,!1,!0).done(function(){l=e,F()}))}function j(t){i.beforeSlideStart();var n,s,r,d,u,b=new e.Deferred;f=!1;for(var w=0;w<v.length;w++)v[w].clear();for(w=0;w<y.length;w++)y[w].clear();return h.clear(),B(t).finish(),ae(t),B(t).finish(),B(t).find(c).each(function(){var t=e(this);t.finish(),se(t),t.finish()}),a.find(o).find(".cs-navigation").find("> .cs-slide-link").each(function(){var t=e(this);t.index()==l?t.addClass("cs-active"):t.removeClass("cs-active")}),s=B(n=t).find(c),r=0,d=!1,u=new e.Deferred,p=!1,ne(n).done(function(){var e;e=a.find(o).find(".cs-progress-bar"),W(),e.animate({width:"100%"},X(B(l),"time")),p=!0,(d=!0)&&r==s.length&&u.resolve()}),s.each(function(){var t=e(this),i=X(t,"delay");y.push(new H(function(){oe(t).done(function(){var e,i,n;$(t)&&(G(n=t)?(!X(i=n,"autoplay")||m[i.attr("id")].played_once||U()||K(i).playVideo(),2!=Z(i)||m[i.attr("id")].manually_paused||K(i).playVideo(),m[i.attr("id")].played_once=!0):(!X(e=n,"autoplay")||g[e.attr("id")].played_once||U()||te(e).api("play"),te(e).api("paused")&&!g[e.attr("id")].ended&&g[e.attr("id")].played_once&&!g[e.attr("id")].manually_paused&&te(e).api("play"))),r++,d&&r==s.length&&u.resolve()})},i))}),u.promise(),i.automaticSlide?q(t,!0,!0).done(function(){f=!0,b.resolve()}):q(t,!0,!1).done(function(){f=!0,b.resolve()}),b.promise()}function q(t,i,n){var a=B(t),o=a.find(c),s=i?X(a,"time")+X(a,"ease-in"):0,r=0,l=!1,d=new e.Deferred;return o.each(function(){var a=e(this),s=X(a,"time");if("all"!=s){var c=i?s:0;X(a,"ignore-ease-out")&&(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve())),v.push(new H(function(){se(a).done(function(){X(a,"ignore-ease-out")||(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve()))})},c))}}),h=new H(function(){p=!1,W(),l=!0,o.length==r&&l&&n&&(J(t),ae(t),d.resolve()),n?o.each(function(){var i=e(this);"all"==X(i,"time")&&(X(i,"ignore-ease-out")&&(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve())),se(i).done(function(){X(i,"ignore-ease-out")||(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve()))}))}):d.resolve()},s),d.promise()}function $(e){return G(e)||e.hasClass("cs-vimeo-iframe")}function J(t){B(t).each(function(){var t=e(this);t.find(c+".cs-yt-iframe").each(function(){ee(e(this))})}),B(t).each(function(){var t=e(this);t.find(c+".cs-vimeo-iframe").each(function(){ie(e(this))})})}function Q(e){G(e)?ee(e):ie(e)}function G(e){return e.hasClass("cs-yt-iframe")}function K(e){return m[e.attr("id")].player}function Z(e){return K(e).getPlayerState()}function ee(e){1==Z(e)&&K(e).pauseVideo()}function te(e){return g[e.attr("id")].player}function ie(e){te(e).api("pause")}function ne(t){var i=B(t),n=X(i,"in"),a=X(i,"ease-in"),o=new e.Deferred;if("block"==i.css("display"))return o.resolve().promise();if(u)return i.css({display:"block",top:0,left:0,opacity:X(i,"opacity")}),o.resolve().promise();switch(n){case"fade":i.css({display:"block",top:0,left:0,opacity:0}),i.animate({opacity:X(i,"opacity")},a,function(){o.resolve()});break;case"fadeLeft":i.css({display:"block",top:0,left:x(),opacity:0}),i.animate({opacity:X(i,"opacity"),left:0},a,function(){o.resolve()});break;case"fadeRight":i.css({display:"block",top:0,left:-x(),opacity:0}),i.animate({opacity:X(i,"opacity"),left:0},a,function(){o.resolve()});break;case"slideLeft":i.css({display:"block",top:0,left:x(),opacity:X(i,"opacity")}),i.animate({left:0},a,function(){o.resolve()});break;case"slideRight":i.css({display:"block",top:0,left:-x(),opacity:X(i,"opacity")}),i.animate({left:0},a,function(){o.resolve()});break;case"slideUp":i.css({display:"block",top:R(),left:0,opacity:X(i,"opacity")}),i.animate({top:0},a,function(){o.resolve()});break;case"slideDown":i.css({display:"block",top:-R(),left:0,opacity:X(i,"opacity")}),i.animate({top:0},a,function(){o.resolve()});break;default:i.css({display:"block",top:0,left:0,opacity:X(i,"opacity")}),o.resolve()}return o.promise()}function ae(t){var i=B(t),n=X(i,"out"),a=X(i,"ease-out"),o=new e.Deferred;if("none"==i.css("display"))return o.resolve().promise();switch(n){case"fade":i.animate({opacity:0},a,function(){i.css({display:"none",opacity:X(i,"opacity")}),o.resolve()});break;case"fadeLeft":i.animate({opacity:0,left:-x()},a,function(){i.css({display:"none",opacity:X(i,"opacity"),left:0}),o.resolve()});break;case"fadeRight":i.animate({opacity:0,left:x()},a,function(){i.css({display:"none",opacity:X(i,"opacity"),left:0}),o.resolve()});break;case"slideLeft":i.animate({left:-x()},a,function(){i.css({display:"none",left:0}),o.resolve()});break;case"slideRight":i.animate({left:x()},a,function(){i.css({display:"none",left:0}),o.resolve()});break;case"slideUp":i.animate({top:-R()},a,function(){i.css({display:"none",top:0}),o.resolve()});break;case"slideDown":i.animate({top:R()},a,function(){i.css({display:"none",top:0}),o.resolve()});break;default:i.css({display:"none"}),o.resolve()}return o.promise()}function oe(t){var i=t.outerWidth(),n=t.outerHeight(),a=X(t,"in"),o=X(t,"ease-in"),s=X(t,"top"),r=X(t,"left"),c=new e.Deferred;if("block"==t.css("display"))return c.resolve().promise();switch(a){case"slideDown":t.css({display:"block",top:-n,left:L(r+E().left),opacity:X(t,"opacity")}).animate({top:L(s+E().top)},o,function(){c.resolve()});break;case"slideUp":t.css({display:"block",top:R(),left:L(r+E().left),opacity:X(t,"opacity")}).animate({top:L(s+E().top)},o,function(){c.resolve()});break;case"slideLeft":t.css({display:"block",top:L(s+E().top),left:x(),opacity:X(t,"opacity")}).animate({left:L(r+E().left)},o,function(){c.resolve()});break;case"slideRight":t.css({display:"block",top:L(s+E().top),left:-i,opacity:X(t,"opacity")}).animate({left:L(r+E().left)},o,function(){c.resolve()});break;case"fade":t.css({display:"block",top:L(s+E().top),left:L(r+E().left),opacity:0}).animate({opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeDown":t.css({display:"block",top:-n,left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeUp":t.css({display:"block",top:R(),left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeLeft":t.css({display:"block",top:L(s+E().top),left:x(),opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeRight":t.css({display:"block",top:L(s+E().top),left:-i,opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallDown":t.css({display:"block",top:L(s+E().top-30),left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallUp":t.css({display:"block",top:L(s+E().top+30),left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallLeft":t.css({display:"block",top:L(s+E().top),left:L(r+E().left+30),opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallRight":t.css({display:"block",top:L(s+E().top),left:L(r+E().left-30),opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;default:t.css({display:"block",top:L(s+E().top),left:L(r+E().left),opacity:X(t,"opacity")}),c.resolve()}return c.promise()}function se(t){var i=t.outerWidth(),n=t.outerHeight(),a=X(t,"out"),o=X(t,"ease-out"),s=new e.Deferred;if("none"==t.css("display"))return s.resolve().promise();switch(a){case"slideDown":t.animate({top:R()},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideUp":t.animate({top:-n},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideLeft":t.animate({left:-i},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideRight":t.animate({left:x()},o,function(){t.css({display:"none"}),s.resolve()});break;case"fade":t.animate({opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeDown":t.animate({top:R(),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeUp":t.animate({top:-n,opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeLeft":t.animate({left:-i,opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeRight":t.animate({left:x(),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallDown":t.animate({top:L(X(t,"top")+E().top+30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallUp":t.animate({top:L(X(t,"top")+E().top-30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallLeft":t.animate({left:L(X(t,"left")+E().left-30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallRight":t.animate({left:L(X(t,"left")+E().left+30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;default:t.css({display:"none"}),s.resolve()}return s.promise()}this.resume=function(){M()},this.pause=function(){O()},this.nextSlide=function(){V(z())},this.previousSlide=function(){V(C())},this.changeSlide=function(e){V(e)},this.getCurrentSlide=function(){return l},this.getTotalSlides=function(){return n}},e.fn.crellySlider=function(t){var i=e.extend({layout:"fixed",responsive:!0,startWidth:1140,startHeight:500,pauseOnHover:!0,automaticSlide:!0,randomOrder:!0,startFromSlide:0,showControls:!0,showNavigation:!0,showProgressBar:!0,enableSwipe:!0,slidesTime:3e3,elementsDelay:0,elementsTime:"all",slidesEaseIn:300,elementsEaseIn:300,slidesEaseOut:300,elementsEaseOut:300,ignoreElementsEaseOut:!1,videoAutoplay:!1,videoLoop:!1,beforeStart:function(){},beforeSetResponsive:function(){},beforeSlideStart:function(){},beforePause:function(){},beforeResume:function(){}},t);return this.each(function(){if(null==e(this).data("crellySlider")){var t=new e.CrellySlider(this,i);e(this).data("crellySlider",t)}})}}(jQuery);
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.3.5
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
9
  */
10
 
11
+ var crellyslider_youtube_api_ready=!1,crellyslider_vimeo_api_ready=!1;!function(se){var e,t,i;e=this,t=document,i=function(e,t,i,n){function l(e,t,i,n){var a=i.type;i.type=t,n?d.event.trigger(i,s,e):d.event.dispatch.call(e,i),i.type=a}var d,o,s,p,a,r,c,f,u,h,v;(function(f,e,t,u){function h(e){for(;e&&void 0!==e.originalEvent;)e=e.originalEvent;return e}function o(e){for(var t,i,n={};e;){for(i in t=f.data(e,k))t[i]&&(n[i]=n.hasVirtualBinding=!0);e=e.parentNode}return n}function a(){M=!0}function s(){M=!1}function r(){c(),P=setTimeout(function(){C=P=0,Y.length=0,O=!1,a()},f.vmouse.resetTimerDuration)}function c(){P&&(clearTimeout(P),P=0)}function l(e,t,i){var n;return(i&&i[e]||!i&&function(e,t){for(var i;e;){if((i=f.data(e,k))&&(!t||i[t]))return e;e=e.parentNode}return null}(t.target,e))&&(n=function(e,t){var i,n,a,o,s,r,c,l,d,p=e.type;if((e=f.Event(e)).type=t,i=e.originalEvent,n=f.event.props,-1<p.search(/^(mouse|click)/)&&(n=E),i)for(c=n.length;c;)e[o=n[--c]]=i[o];if(-1<p.search(/mouse(down|up)|click/)&&!e.which&&(e.which=1),-1!==p.search(/^touch/)&&(p=(a=h(i)).touches,s=a.changedTouches,r=p&&p.length?p[0]:s&&s.length?s[0]:u))for(l=0,d=D.length;l<d;l++)e[o=D[l]]=r[o];return e}(t,e),f(t.target).trigger(n)),n}function d(e){var t,i=f.data(e.target,S);O||C&&C===i||(t=l("v"+e.type,e))&&(t.isDefaultPrevented()&&e.preventDefault(),t.isPropagationStopped()&&e.stopPropagation(),t.isImmediatePropagationStopped()&&e.stopImmediatePropagation())}function p(e){var t,i,n,a=h(e).touches;!a||1!==a.length||(i=o(t=e.target)).hasVirtualBinding&&(C=z++,f.data(t,S,C),c(),s(),F=!1,n=h(e).touches[0],N=n.pageX,L=n.pageY,l("vmouseover",e,i),l("vmousedown",e,i))}function v(e){M||(F||l("vmousecancel",e,o(e.target)),F=!0,r())}function y(e){if(!M){var t=h(e).touches[0],i=F,n=f.vmouse.moveDistanceThreshold,a=o(e.target);(F=F||Math.abs(t.pageX-N)>n||Math.abs(t.pageY-L)>n)&&!i&&l("vmousecancel",e,a),l("vmousemove",e,a),r()}}function m(e){if(!M){a();var t,i,n=o(e.target);l("vmouseup",e,n),F||(t=l("vclick",e,n))&&t.isDefaultPrevented()&&(i=h(e).changedTouches[0],Y.push({touchID:C,x:i.clientX,y:i.clientY}),O=!0),l("vmouseout",e,n),F=!1,r()}}function g(e){var t,i=f.data(e,k);if(i)for(t in i)if(i[t])return!0;return!1}function b(){}function i(i){var n=i.substr(1);return{setup:function(){g(this)||f.data(this,k,{}),f.data(this,k)[i]=!0,_[i]=(_[i]||0)+1,1===_[i]&&R.bind(n,d),f(this).bind(n,b),x&&(_.touchstart=(_.touchstart||0)+1,1===_.touchstart&&R.bind("touchstart",p).bind("touchend",m).bind("touchmove",y).bind("scroll",v))},teardown:function(){--_[i],_[i]||R.unbind(n,d),x&&(--_.touchstart,_.touchstart||R.unbind("touchstart",p).unbind("touchmove",y).unbind("touchend",m).unbind("scroll",v));var e=f(this),t=f.data(this,k);t&&(t[i]=!1),e.unbind(n,b),g(this)||e.removeData(k)}}}var w,n,k="virtualMouseBindings",S="virtualTouchID",T="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),D="clientX clientY pageX pageY screenX screenY".split(" "),I=f.event.mouseHooks?f.event.mouseHooks.props:[],E=f.event.props.concat(I),_={},P=0,N=0,L=0,F=!1,Y=[],O=!1,M=!1,x="addEventListener"in t,R=f(t),z=1,C=0;for(f.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},n=0;n<T.length;n++)f.event.special[T[n]]=i(T[n]);x&&t.addEventListener("click",function(e){var t,i,n,a,o,s=Y.length,r=e.target;if(s)for(t=e.clientX,i=e.clientY,w=f.vmouse.clickDistanceThreshold,n=r;n;){for(a=0;a<s;a++)if(o=Y[a],0,n===r&&Math.abs(o.x-t)<w&&Math.abs(o.y-i)<w||f.data(n,S)===o.touchID)return e.preventDefault(),void e.stopPropagation();n=n.parentNode}},!0)})(e,0,i),e.mobile={},v={touch:"ontouchend"in i},(h=e).mobile.support=h.mobile.support||{},h.extend(h.support,v),h.extend(h.mobile.support,v),o=this,p=(d=e)(i),a=d.mobile.support.touch,r="touchmove scroll",c=a?"touchstart":"mousedown",f=a?"touchend":"mouseup",u=a?"touchmove":"mousemove",d.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(e,t){d.fn[t]=function(e){return e?this.bind(t,e):this.trigger(t)},d.attrFn&&(d.attrFn[t]=!0)}),d.event.special.scrollstart={enabled:!0,setup:function(){function t(e,t){l(a,(i=t)?"scrollstart":"scrollstop",e)}var i,n,a=this;d(a).bind(r,function(e){d.event.special.scrollstart.enabled&&(i||t(e,!0),clearTimeout(n),n=setTimeout(function(){t(e,!1)},50))})},teardown:function(){d(this).unbind(r)}},d.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var s=this,r=d(s),c=!1;r.bind("vmousedown",function(e){function t(){clearTimeout(a)}function i(){t(),r.unbind("vclick",n).unbind("vmouseup",t),p.unbind("vmousecancel",i)}function n(e){i(),c||o!==e.target?c&&e.preventDefault():l(s,"tap",e)}if(c=!1,e.which&&1!==e.which)return!1;var a,o=e.target;r.bind("vmouseup",t).bind("vclick",n),p.bind("vmousecancel",i),a=setTimeout(function(){d.event.special.tap.emitTapOnTaphold||(c=!0),l(s,"taphold",d.Event("taphold",{target:o}))},d.event.special.tap.tapholdThreshold)})},teardown:function(){d(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),p.unbind("vmousecancel")}},d.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var t=o.pageXOffset,i=o.pageYOffset,n=e.clientX,a=e.clientY;return 0===e.pageY&&Math.floor(a)>Math.floor(e.pageY)||0===e.pageX&&Math.floor(n)>Math.floor(e.pageX)?(n-=t,a-=i):(a<e.pageY-i||n<e.pageX-t)&&(n=e.pageX-t,a=e.pageY-i),{x:n,y:a}},start:function(e){var t=e.originalEvent.touches?e.originalEvent.touches[0]:e,i=d.event.special.swipe.getLocation(t);return{time:(new Date).getTime(),coords:[i.x,i.y],origin:d(e.target)}},stop:function(e){var t=e.originalEvent.touches?e.originalEvent.touches[0]:e,i=d.event.special.swipe.getLocation(t);return{time:(new Date).getTime(),coords:[i.x,i.y]}},handleSwipe:function(e,t,i,n){if(t.time-e.time<d.event.special.swipe.durationThreshold&&Math.abs(e.coords[0]-t.coords[0])>d.event.special.swipe.horizontalDistanceThreshold&&Math.abs(e.coords[1]-t.coords[1])<d.event.special.swipe.verticalDistanceThreshold){var a=e.coords[0]>t.coords[0]?"swipeleft":"swiperight";return l(i,"swipe",d.Event("swipe",{target:n,swipestart:e,swipestop:t}),!0),l(i,a,d.Event(a,{target:n,swipestart:e,swipestop:t}),!0),!0}return!1},eventInProgress:!1,setup:function(){var e,o=this,t=d(o),s={};(e=d.data(this,"mobile-events"))||(e={length:0},d.data(this,"mobile-events",e)),e.length++,(e.swipe=s).start=function(e){if(!d.event.special.swipe.eventInProgress){d.event.special.swipe.eventInProgress=!0;var t,i=d.event.special.swipe.start(e),n=e.target,a=!1;s.move=function(e){i&&!e.isDefaultPrevented()&&(t=d.event.special.swipe.stop(e),a||(a=d.event.special.swipe.handleSwipe(i,t,o,n))&&(d.event.special.swipe.eventInProgress=!1),Math.abs(i.coords[0]-t.coords[0])>d.event.special.swipe.scrollSupressionThreshold&&e.preventDefault())},s.stop=function(){a=!0,d.event.special.swipe.eventInProgress=!1,p.off(u,s.move),s.move=null},p.on(u,s.move).one(f,s.stop)}},t.on(c,s.start)},teardown:function(){var e,t;(e=d.data(this,"mobile-events"))&&(t=e.swipe,delete e.swipe,e.length--,0===e.length&&d.removeData(this,"mobile-events")),t&&(t.start&&d(this).off(c,t.start),t.move&&p.off(u,t.move),t.stop&&p.off(f,t.stop))}},d.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(e,t){d.event.special[e]={setup:function(){d(this).bind(t,d.noop)},teardown:function(){d(this).unbind(t)}}})},"function"==typeof define&&define.amd?define(["jquery"],function(e){return i(e,0,t),e.mobile}):i(e.jQuery,0,t),se.CrellySlider=function(e,a){var o,s=se(e),r="div.crellyslider",c="ul.cs-slides",t="li.cs-slide",d="> *",l=0,i=!1,p=!1,n=!1,f=!0,u=new B(function(){},0),h=new Array,v=new Array,y={},m={},g=1,b=0;if(!crellyslider_youtube_api_ready&&k("youtube")&&function(){var e=document.createElement("script");e.src="https://www.youtube.com/iframe_api";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t),crellyslider_youtube_api_ready=!0}(),!crellyslider_vimeo_api_ready&&k("vimeo")&&function(){var o,s,r;function t(e){return new t.fn.init(e)}function c(e,t,i){if(!i.contentWindow.postMessage)return!1;e=JSON.stringify({method:e,value:t}),i.contentWindow.postMessage(e,r)}function e(e){var t,i;try{i=(t=JSON.parse(e.data)).event||t.method}catch(e){}if("ready"!=i||s||(s=!0),!/^https?:\/\/player.vimeo.com/.test(e.origin))return!1;"*"===r&&(r=e.origin),e=t.value;var n=t.data,a=""===a?null:t.player_id;return t=a?o[a][i]:o[i],i=[],!!t&&(void 0!==e&&i.push(e),n&&i.push(n),a&&i.push(a),0<i.length?t.apply(null,i):t.call())}function l(e,t,i){i?(o[i]||(o[i]={}),o[i][e]=t):o[e]=t}s=!(o={}),r="*",(t.fn=t.prototype={element:null,init:function(e){return"string"==typeof e&&(e=document.getElementById(e)),this.element=e,this},api:function(e,t){if(!this.element||!e)return!1;var i=this.element,n=""!==i.id?i.id:null,a=t&&t.constructor&&t.call&&t.apply?null:t,o=t&&t.constructor&&t.call&&t.apply?t:null;return o&&l(e,o,n),c(e,a,i),this},addEvent:function(e,t){if(!this.element)return!1;var i=this.element,n=""!==i.id?i.id:null;return l(e,t,n),"ready"!=e?c("addEventListener",e,i):"ready"==e&&s&&t.call(null,n),this},removeEvent:function(e){if(!this.element)return!1;var t=this.element,i=""!==t.id?t.id:null;e:{if(i&&o[i]){if(!o[i][e]){i=!1;break e}o[i][e]=null}else{if(!o[e]){i=!1;break e}o[e]=null}i=!0}"ready"!=e&&i&&c("removeEventListener",e,t)}}).init.prototype=t.fn,window.addEventListener?window.addEventListener("message",e,!1):window.attachEvent("onmessage",e),window.Froogaloop=window.$f=t,crellyslider_vimeo_api_ready=!0}(),!crellyslider_youtube_api_ready||"undefined"!=typeof YT&&void 0!==YT.Player)S();else var w=setInterval(function(){"undefined"!=typeof YT&&void 0!==YT.Player&&(clearInterval(w),S())},100);function k(e){return"youtube"==e?0<s.find(".cs-yt-iframe").length:"vimeo"==e?0<s.find(".cs-vimeo-iframe").length:-1}function S(){if(s.wrapInner('<div class="crellyslider" />'),s.find(r+" > ul").addClass("cs-slides"),s.find(r+" "+c+" > li").addClass("cs-slide"),0==(o=X().length))return!1;if(1==o){var e=A(0),t=s.find(r).find(c);e.clone().prependTo(t),o++}if(function(){if(!a.randomOrder&&0==a.startFromSlide)return;var e=new Array,t=new Array;if(-1==a.startFromSlide){var i=Math.floor(Math.random()*o);e[0]=i,t[0]=A(i)}else e[0]=a.startFromSlide,t[0]=A(a.startFromSlide);for(var n=1;n<o;n++){if(a.randomOrder)for(;i=Math.floor(Math.random()*o),-1!=e.indexOf(i););else i=n+e[0]<o?n+e[0]:n+e[0]-o;e[n]=i,t[n]=A(i)}s.find(r).find(c).empty();for(n=0;n<o;n++)s.find(r).find(c).append(t[n])}(),a.showControls&&s.find(r).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>'),a.showNavigation){for(var i='<div class="cs-navigation">',n=0;n<o;n++)i+='<span class="cs-slide-link"></span>';i+="</div>",s.find(r).append(i)}a.showProgressBar?s.find(r).append('<div class="cs-progress-bar"></div>'):s.find(r).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>'),s.css("display","block"),a.responsive&&P(),D(),X().find(".cs-background-link").html(" ").data({left:0,top:0,in:"none",out:"none",easeIn:0,easeOut:0,delay:0,time:"all"}),function(){s.find(r).find(c).css("visibility","hidden"),s.find(r).find(".cs-progress-bar").css("display","none"),s.find(r).find(".cs-navigation").css("display","none"),s.find(r).find(".cs-controls").css("display","none");var e=A(0).css("background-image");(e=e.replace(/^url\(["']?/,"").replace(/["']?\)$/,"")).match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)?se("<img>").load(function(){t()}).attr("src",e).each(function(){this.complete&&se(this).load()}):t();function t(){s.find(r).append('<div class="cs-preloader"><div class="cs-bg"></div><div class="cs-loader"><div class="cs-spinner"></div></div></div>'),s.find(r).find(".cs-preloader").css({"background-color":A(l).css("background-color"),"background-image":A(l).css("background-image"),"background-position":A(l).css("background-position"),"background-repeat":A(l).css("background-repeat"),"background-size":A(l).css("background-size")}),s.find(r).find(".cs-preloader > .cs-bg").css({"background-color":A(l).css("background-color"),"background-image":A(l).css("background-image"),"background-position":A(l).css("background-position"),"background-repeat":A(l).css("background-repeat"),"background-size":A(l).css("background-size")})}}(),function(){var e=new se.Deferred,t=X().find(".cs-yt-iframe, .cs-vimeo-iframe").length,i=0;return 0!=t?(X().find(".cs-yt-iframe, .cs-vimeo-iframe").each(function(){se(this).one("load",function(){++i==t&&function(){var e,n=new se.Deferred,t=X(),a=t.find(d+".cs-yt-iframe").length,o=0;return 0!=a?(t.each(function(){se(this).find(d+".cs-yt-iframe").each(function(){var t=se(this);t.uniqueId(),t.attr("id","cs-yt-iframe-"+t.attr("id"));var i=new YT.Player(t.attr("id"),{events:{onReady:function(){++o==a&&n.resolve()},onStateChange:function(e){e.data===YT.PlayerState.ENDED&&C(t,"loop")&&i.playVideo(),p&&(e.data===YT.PlayerState.PAUSED&&(y[t.attr("id")].manually_paused=!0),e.data===YT.PlayerState.PLAYING&&(y[t.attr("id")].manually_paused=!1))}}});e={player:i,played_once:!1,manually_paused:!1},y[t.attr("id")]=e})}),n.promise()):n.resolve().promise()}().done(function(){(function(){var i,n=new se.Deferred,e=X(),a=e.find(d+".cs-vimeo-iframe").length,o=0;return 0!=a?(e.each(function(){se(this).find(d+".cs-vimeo-iframe").each(function(){var e=se(this);e.uniqueId(),e.attr("id","cs-vimeo-iframe-"+e.attr("id")),e.attr("src",e.attr("src")+"&player_id="+e.attr("id"));var t=$f(e[0]);t.addEvent("ready",function(){t.addEvent("finish",function(){m[e.attr("id")].ended=!0}),t.addEvent("play",function(){m[e.attr("id")].played_once=!0,m[e.attr("id")].ended=!1,p&&(m[e.attr("id")].manually_paused=!1)}),t.addEvent("pause",function(){p&&(m[e.attr("id")].manually_paused=!0)}),C(e,"loop")&&t.api("setLoop",!0),++o==a&&n.resolve()}),i={player:t,played_once:!1,ended:!1,manually_paused:!1},m[e.attr("id")]=i})}),n.promise()):n.resolve().promise()})().done(function(){e.resolve()})})})}),e.promise()):e.resolve().promise()}().done(function(){var e=setInterval(function(){"complete"==document.readyState&&0<s.find(r).find(".cs-preloader").length&&(clearInterval(e),function(){a.responsive&&P();D(),b=se(window).width(),void X().each(function(){var e=se(this);e.find(d).each(function(){var e=se(this);e.find("*").each(function(){T(se(this))}),T(e)}),e.css("display","none"),e.data("opacity",parseFloat(e.css("opacity")))}),function(){a.responsive&&se(window).resize(function(){b!=se(window).width()&&("full-width"==a.layout&&M()!=se(s).width()||se(s).width()<M()||se(s).width()>M()&&M()<a.startWidth)&&E()});s.find(r).find(".cs-controls > .cs-previous").click(function(){W(z())}),s.find(r).find(".cs-controls > .cs-next").click(function(){W(R())}),a.enableSwipe&&(s.find(r).on("swipeleft",function(){O(),W(R())}),s.find(r).on("swiperight",function(){O(),W(z())}));s.find(r).find(".cs-navigation > .cs-slide-link").click(function(){W(se(this).index())}),a.pauseOnHover&&(s.find(r).find(c).hover(function(){Y()}),s.find(r).find(c).mouseleave(function(){O()}))}(),s.find(r).find(c).css("visibility","visible"),s.find(r).find(".cs-progress-bar").css("display","block"),s.find(r).find(".cs-navigation").css("display","block"),s.find(r).find(".cs-controls").css("display","block"),ie(A(0)),A(0).finish(),void s.find(r).find(".cs-preloader").animate({opacity:0},300,function(){s.find(r).find(".cs-preloader").remove()}),a.beforeStart(),a.responsive?E():L()}())},100)})}function T(e){e.data("width",parseFloat(e.width())),e.data("height",parseFloat(e.height())),e.data("letter-spacing",parseFloat(e.css("letter-spacing"))),e.data("font-size",parseFloat(e.css("font-size"))),"px"==e.css("line-height").slice(-2).toLowerCase()?e.data("line-height",parseFloat(e.css("line-height"))):"normal"==e.css("line-height")?e.data("line-height",1.15*C(e,"font-size")):e.data("line-height",parseFloat(e.css("line-height"))*C(e,"font-size")),e.data("padding-top",parseFloat(e.css("padding-top"))),e.data("padding-right",parseFloat(e.css("padding-right"))),e.data("padding-bottom",parseFloat(e.css("padding-bottom"))),e.data("padding-left",parseFloat(e.css("padding-left"))),e.data("opacity",parseFloat(e.css("opacity")))}function D(){var e,t;switch(a.layout){case"fixed":e=a.startWidth,t=a.startHeight,s.find(r).css({width:N(e),height:N(t)}),X().css({width:N(e),height:N(t)});break;case"full-width":e=s.width(),t=a.startHeight,s.find(r).css({width:e,height:N(t)}),X().css({width:e,height:N(t)});break;default:return!1}}function I(){var e=(x()-a.startHeight)/2,t=(M()-a.startWidth)/2,i=0,n=0;return 0<e&&(i=e),0<t&&(n=t),{top:i,left:n}}function E(){a.beforeSetResponsive();var e=X();F(!0),e.each(function(){var e=se(this),t=e.find(d);e.finish(),ie(e),e.finish(),t.each(function(){var e=se(this);e.finish(),ae(e),e.finish(),q(e)&&J(e)})}),P(),D(),e.each(function(){var e=se(this);e.find(d).each(function(){var e=se(this);e.find("*").each(function(){_(se(this))}),_(e),e.finish(),oe(e),e.finish(),q(e)&&J(e)}),e.finish(),ne(e),e.finish()}),b=se(window).width(),L()}function _(e){e.css({top:N(C(e,"top")+I().top),left:N(C(e,"left")+I().left),"padding-top":N(C(e,"padding-top")),"padding-right":N(C(e,"padding-right")),"padding-bottom":N(C(e,"padding-bottom")),"padding-left":N(C(e,"padding-left"))}),e.is("input")||e.is("button")||e.text().trim().length?e.css({"line-height":N(C(e,"line-height"))+"px","letter-spacing":N(C(e,"letter-spacing")),"font-size":N(C(e,"font-size"))}):e.css({width:N(C(e,"width")),height:N(C(e,"height"))})}function P(){var e=s.width(),t=a.startWidth;g=t<=e||!a.responsive?1:e/t}function N(e){return e*g}function L(){a.automaticSlide?function e(){V(l).done(function(){i||(l=R(),e())})}():V(l),f=!1}function F(t){for(var e=0;e<h.length;e++)h[e].clear();for(e=0;e<v.length;e++)v[e].clear();u.clear(),X().each(function(){var e=se(this);t?e.finish():e.stop(!0,!0),e.find(d).each(function(){var e=se(this);t?e.finish():e.stop(!0,!0)})}),U()}function Y(){!i&&p&&(a.beforePause(),s.find(r).find(".cs-progress-bar").stop(!0),u.pause(),i=!0)}function O(){if(i&&p){a.beforeResume();var e=s.find(r).find(".cs-progress-bar"),t=(C(A(l),"time"),u.getRemaining());e.animate({width:"100%"},t),u.resume(),i=!1}}function M(){return s.find(r).width()}function x(){return s.find(r).height()}function R(){return l+1==o?0:l+1}function z(){return l-1<0?o-1:l-1}function C(e,t){var i;switch(i=!!e.parent("ul").hasClass("cs-slides"),t){case"ease-in":return i?isNaN(parseInt(e.data(t)))?a.slidesEaseIn:parseInt(e.data(t)):isNaN(parseInt(e.data(t)))?a.elementsEaseIn:parseInt(e.data(t));case"ease-out":return i?isNaN(parseInt(e.data(t)))?a.slidesEaseOut:parseInt(e.data(t)):isNaN(parseInt(e.data(t)))?a.elementsEaseOut:parseInt(e.data(t));case"delay":return isNaN(parseInt(e.data(t)))?a.elementsDelay:parseInt(e.data(t));case"time":return i?isNaN(parseInt(e.data(t)))?a.slidesTime:parseInt(e.data(t)):"all"==e.data(t)?"all":isNaN(parseInt(e.data(t)))?a.itemsTime:parseInt(e.data(t));case"ignore-ease-out":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&a.ignoreElementsEaseOut;case"autoplay":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&a.videoAutoplay;case"loop":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&a.videoLoop;case"top":case"left":case"width":case"height":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"line-height":case"letter-spacing":case"font-size":return isNaN(parseFloat(e.data(t)))?0:parseFloat(e.data(t));case"in":case"out":case"opacity":return e.data(t);default:return!1}}function X(){return s.find(r).find(c).find(t)}function A(e){return X().eq(e)}function B(e,t){var i,n,a=t;this.pause=function(){clearTimeout(i),a-=new Date-n},this.resume=function(){n=new Date,clearTimeout(i),i=window.setTimeout(function(){e()},a)},this.clear=function(){clearTimeout(i)},this.getRemaining=function(){return a},this.resume()}function H(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function U(){var e=s.find(r).find(".cs-progress-bar");e.stop(),e.css("width",0)}function W(e){e!=l&&(p||n)&&(F(!1),j(l,!1,!0).done(function(){l=e,L()}))}function V(e){a.beforeSlideStart();var t=new se.Deferred;n=!1;for(var i=0;i<h.length;i++)h[i].clear();for(i=0;i<v.length;i++)v[i].clear();return u.clear(),A(e).finish(),ne(e),A(e).finish(),A(e).find(d).each(function(){var e=se(this);e.finish(),oe(e),e.finish()}),s.find(r).find(".cs-navigation").find("> .cs-slide-link").each(function(){var e=se(this);e.index()==l?e.addClass("cs-active"):e.removeClass("cs-active")}),function(e){var i=A(e).find(d),n=0,a=!1,o=new se.Deferred;p=!1,ie(e).done(function(){!function(){var e=s.find(r).find(".cs-progress-bar");U(),e.animate({width:"100%"},C(A(l),"time"))}(),(a=p=!0)&&n==i.length&&o.resolve()}),i.each(function(){var e=se(this),t=C(e,"delay");v.push(new B(function(){ae(e).done(function(){q(e)&&function(e){Q(e)?function(e){!C(e,"autoplay")||y[e.attr("id")].played_once||H()||G(e).playVideo();2!=K(e)||y[e.attr("id")].manually_paused||G(e).playVideo();y[e.attr("id")].played_once=!0}(e):function(e){!C(e,"autoplay")||m[e.attr("id")].played_once||H()||ee(e).api("play");ee(e).api("paused")&&!m[e.attr("id")].ended&&m[e.attr("id")].played_once&&!m[e.attr("id")].manually_paused&&ee(e).api("play")}(e)}(e),n++,a&&n==i.length&&o.resolve()})},t))}),o.promise()}(e),a.automaticSlide?j(e,!0,!0).done(function(){n=!0,t.resolve()}):j(e,!0,!1).done(function(){n=!0,t.resolve()}),t.promise()}function j(n,a,o){var e=A(n),s=e.find(d),t=a?C(e,"time")+C(e,"ease-in"):0,r=0,c=!1,l=new se.Deferred;return s.each(function(){var e=se(this),t=C(e,"time");if("all"!=t){var i=a?t:0;C(e,"ignore-ease-out")&&(r++,s.length==r&&c&&o&&($(n),ne(n),l.resolve())),h.push(new B(function(){oe(e).done(function(){C(e,"ignore-ease-out")||(r++,s.length==r&&c&&o&&($(n),ne(n),l.resolve()))})},i))}}),u=new B(function(){p=!1,U(),c=!0,s.length==r&&c&&o&&($(n),ne(n),l.resolve()),o?s.each(function(){var e=se(this);"all"==C(e,"time")&&(C(e,"ignore-ease-out")&&(r++,s.length==r&&c&&o&&($(n),ne(n),l.resolve())),oe(e).done(function(){C(e,"ignore-ease-out")||(r++,s.length==r&&c&&o&&($(n),ne(n),l.resolve()))}))}):l.resolve()},t),l.promise()}function q(e){return Q(e)||function(e){return e.hasClass("cs-vimeo-iframe")}(e)}function $(e){!function(e){A(e).each(function(){se(this).find(d+".cs-yt-iframe").each(function(){Z(se(this))})})}(e),function(e){A(e).each(function(){se(this).find(d+".cs-vimeo-iframe").each(function(){te(se(this))})})}(e)}function J(e){Q(e)?Z(e):te(e)}function Q(e){return e.hasClass("cs-yt-iframe")}function G(e){return y[e.attr("id")].player}function K(e){return G(e).getPlayerState()}function Z(e){1==K(e)&&G(e).pauseVideo()}function ee(e){return m[e.attr("id")].player}function te(e){ee(e).api("pause")}function ie(e){var t=A(e),i=C(t,"in"),n=C(t,"ease-in"),a=new se.Deferred;if("block"==t.css("display"))return a.resolve().promise();if(f)return t.css({display:"block",top:0,left:0,opacity:C(t,"opacity")}),a.resolve().promise();switch(i){case"fade":t.css({display:"block",top:0,left:0,opacity:0}),t.animate({opacity:C(t,"opacity")},n,function(){a.resolve()});break;case"fadeLeft":t.css({display:"block",top:0,left:M(),opacity:0}),t.animate({opacity:C(t,"opacity"),left:0},n,function(){a.resolve()});break;case"fadeRight":t.css({display:"block",top:0,left:-M(),opacity:0}),t.animate({opacity:C(t,"opacity"),left:0},n,function(){a.resolve()});break;case"slideLeft":t.css({display:"block",top:0,left:M(),opacity:C(t,"opacity")}),t.animate({left:0},n,function(){a.resolve()});break;case"slideRight":t.css({display:"block",top:0,left:-M(),opacity:C(t,"opacity")}),t.animate({left:0},n,function(){a.resolve()});break;case"slideUp":t.css({display:"block",top:x(),left:0,opacity:C(t,"opacity")}),t.animate({top:0},n,function(){a.resolve()});break;case"slideDown":t.css({display:"block",top:-x(),left:0,opacity:C(t,"opacity")}),t.animate({top:0},n,function(){a.resolve()});break;default:t.css({display:"block",top:0,left:0,opacity:C(t,"opacity")}),a.resolve()}return a.promise()}function ne(e){var t=A(e),i=C(t,"out"),n=C(t,"ease-out"),a=new se.Deferred;if("none"==t.css("display"))return a.resolve().promise();switch(i){case"fade":t.animate({opacity:0},n,function(){t.css({display:"none",opacity:C(t,"opacity")}),a.resolve()});break;case"fadeLeft":t.animate({opacity:0,left:-M()},n,function(){t.css({display:"none",opacity:C(t,"opacity"),left:0}),a.resolve()});break;case"fadeRight":t.animate({opacity:0,left:M()},n,function(){t.css({display:"none",opacity:C(t,"opacity"),left:0}),a.resolve()});break;case"slideLeft":t.animate({left:-M()},n,function(){t.css({display:"none",left:0}),a.resolve()});break;case"slideRight":t.animate({left:M()},n,function(){t.css({display:"none",left:0}),a.resolve()});break;case"slideUp":t.animate({top:-x()},n,function(){t.css({display:"none",top:0}),a.resolve()});break;case"slideDown":t.animate({top:x()},n,function(){t.css({display:"none",top:0}),a.resolve()});break;default:t.css({display:"none"}),a.resolve()}return a.promise()}function ae(e){var t=e.outerWidth(),i=e.outerHeight(),n=C(e,"in"),a=C(e,"ease-in"),o=C(e,"top"),s=C(e,"left"),r=new se.Deferred;if("block"==e.css("display"))return r.resolve().promise();switch(n){case"slideDown":e.css({display:"block",top:-i,left:N(s+I().left),opacity:C(e,"opacity")}).animate({top:N(o+I().top)},a,function(){r.resolve()});break;case"slideUp":e.css({display:"block",top:x(),left:N(s+I().left),opacity:C(e,"opacity")}).animate({top:N(o+I().top)},a,function(){r.resolve()});break;case"slideLeft":e.css({display:"block",top:N(o+I().top),left:M(),opacity:C(e,"opacity")}).animate({left:N(s+I().left)},a,function(){r.resolve()});break;case"slideRight":e.css({display:"block",top:N(o+I().top),left:-t,opacity:C(e,"opacity")}).animate({left:N(s+I().left)},a,function(){r.resolve()});break;case"fade":e.css({display:"block",top:N(o+I().top),left:N(s+I().left),opacity:0}).animate({opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeDown":e.css({display:"block",top:-i,left:N(s+I().left),opacity:0}).animate({top:N(o+I().top),opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeUp":e.css({display:"block",top:x(),left:N(s+I().left),opacity:0}).animate({top:N(o+I().top),opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeLeft":e.css({display:"block",top:N(o+I().top),left:M(),opacity:0}).animate({left:N(s+I().left),opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeRight":e.css({display:"block",top:N(o+I().top),left:-t,opacity:0}).animate({left:N(s+I().left),opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeSmallDown":e.css({display:"block",top:N(o+I().top-30),left:N(s+I().left),opacity:0}).animate({top:N(o+I().top),opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeSmallUp":e.css({display:"block",top:N(o+I().top+30),left:N(s+I().left),opacity:0}).animate({top:N(o+I().top),opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeSmallLeft":e.css({display:"block",top:N(o+I().top),left:N(s+I().left+30),opacity:0}).animate({left:N(s+I().left),opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeSmallRight":e.css({display:"block",top:N(o+I().top),left:N(s+I().left-30),opacity:0}).animate({left:N(s+I().left),opacity:C(e,"opacity")},a,function(){r.resolve()});break;default:e.css({display:"block",top:N(o+I().top),left:N(s+I().left),opacity:C(e,"opacity")}),r.resolve()}return r.promise()}function oe(e){var t=e.outerWidth(),i=e.outerHeight(),n=C(e,"out"),a=C(e,"ease-out"),o=new se.Deferred;if("none"==e.css("display"))return o.resolve().promise();switch(n){case"slideDown":e.animate({top:x()},a,function(){e.css({display:"none"}),o.resolve()});break;case"slideUp":e.animate({top:-i},a,function(){e.css({display:"none"}),o.resolve()});break;case"slideLeft":e.animate({left:-t},a,function(){e.css({display:"none"}),o.resolve()});break;case"slideRight":e.animate({left:M()},a,function(){e.css({display:"none"}),o.resolve()});break;case"fade":e.animate({opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeDown":e.animate({top:x(),opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeUp":e.animate({top:-i,opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeLeft":e.animate({left:-t,opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeRight":e.animate({left:M(),opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeSmallDown":e.animate({top:N(C(e,"top")+I().top+30),opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeSmallUp":e.animate({top:N(C(e,"top")+I().top-30),opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeSmallLeft":e.animate({left:N(C(e,"left")+I().left-30),opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeSmallRight":e.animate({left:N(C(e,"left")+I().left+30),opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;default:e.css({display:"none"}),o.resolve()}return o.promise()}this.resume=function(){O()},this.pause=function(){Y()},this.nextSlide=function(){W(R())},this.previousSlide=function(){W(z())},this.changeSlide=function(e){W(e)},this.getCurrentSlide=function(){return l},this.getTotalSlides=function(){return o}},se.fn.crellySlider=function(e){var t=se.extend({layout:"fixed",responsive:!0,startWidth:1140,startHeight:500,pauseOnHover:!0,automaticSlide:!0,randomOrder:!0,startFromSlide:0,showControls:!0,showNavigation:!0,showProgressBar:!0,enableSwipe:!0,slidesTime:3e3,elementsDelay:0,elementsTime:"all",slidesEaseIn:300,elementsEaseIn:300,slidesEaseOut:300,elementsEaseOut:300,ignoreElementsEaseOut:!1,videoAutoplay:!1,videoLoop:!1,beforeStart:function(){},beforeSetResponsive:function(){},beforeSlideStart:function(){},beforePause:function(){},beforeResume:function(){}},e);return this.each(function(){if(null==se(this).data("crellySlider")){var e=new se.CrellySlider(this,t);se(this).data("crellySlider",e)}})}}(jQuery);
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: fabiorino
3
  Donate link: http://crellyslider.altervista.org/contribute-and-support/
4
  Tags: animations, layers, texts, images, videos
5
  Requires at least: 3.9
6
- Tested up to: 4.9
7
- Stable tag: 1.3.4
8
  License: MIT
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -54,6 +54,11 @@ You can find the documentation <a href="http://crellyslider.altervista.org/docum
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
57
  = 1.3.4 =
58
  * French translation moved to Polyglots. If you want to contribute to translate Crelly Slider in your language, check out <a href="https://translate.wordpress.org/projects/wp-plugins/crelly-slider">this page</a>
59
  * Fixed error with old PHP versions
@@ -70,7 +75,7 @@ You can find the documentation <a href="http://crellyslider.altervista.org/docum
70
 
71
  = 1.3.0 =
72
  * New feature: sliders can be scheduled (you can specify from when and how long they should be displayed for)
73
- * When a video is manually paused by the user, it won't resume automatically at the next slides loop
74
  * For developers: TinyMCE settings are now hookable (credits to dlaxar https://github.com/fabiorino/crelly-slider/commits?author=dlaxar)
75
  * For developers: sliders can be imported via code
76
  * Other minor changes and bug fixes
3
  Donate link: http://crellyslider.altervista.org/contribute-and-support/
4
  Tags: animations, layers, texts, images, videos
5
  Requires at least: 3.9
6
+ Tested up to: 5.2
7
+ Stable tag: 1.3.5
8
  License: MIT
9
  License URI: http://opensource.org/licenses/MIT
10
 
54
 
55
  == Changelog ==
56
 
57
+ = 1.3.5 =
58
+ * Security patch
59
+ * Improved import/export slider functions. They should now be compatible with web hosting services that block file_get_contents
60
+ * Minor changes and bux fixes
61
+
62
  = 1.3.4 =
63
  * French translation moved to Polyglots. If you want to contribute to translate Crelly Slider in your language, check out <a href="https://translate.wordpress.org/projects/wp-plugins/crelly-slider">this page</a>
64
  * Fixed error with old PHP versions
75
 
76
  = 1.3.0 =
77
  * New feature: sliders can be scheduled (you can specify from when and how long they should be displayed for)
78
+ * When a video is manually paused by the user, it won't resume automatically at the next slides loop
79
  * For developers: TinyMCE settings are now hookable (credits to dlaxar https://github.com/fabiorino/crelly-slider/commits?author=dlaxar)
80
  * For developers: sliders can be imported via code
81
  * Other minor changes and bug fixes
wordpress/admin.php CHANGED
@@ -11,7 +11,7 @@ class CrellySliderAdmin {
11
  }
12
 
13
  public static function pluginMenus() {
14
- add_menu_page('Crelly Slider', 'Crelly Slider', 'manage_options', 'crellyslider', 'CrellySliderAdmin::displayPage', 'div');
15
  }
16
 
17
  // Go to the correct page
@@ -137,6 +137,16 @@ class CrellySliderAdmin {
137
  <div class="cs-slider <?php echo $edit ? 'cs-edit-slider' : 'cs-add-slider' ?>">
138
  <div class="cs-tabs cs-tabs-fade cs-tabs-switch-interface">
139
  <?php if($edit): ?>
 
 
 
 
 
 
 
 
 
 
140
  <ul>
141
 
142
  <li>
@@ -192,7 +202,7 @@ class CrellySliderAdmin {
192
  wp_enqueue_script('jquery-ui-tabs');
193
  wp_enqueue_script('jquery-ui-sortable');
194
  wp_enqueue_script('jquery-ui-dialog');
195
- wp_enqueue_script('jquery-ui-datepicker');
196
  wp_enqueue_style('wp-color-picker');
197
  wp_enqueue_media();
198
 
@@ -203,6 +213,8 @@ class CrellySliderAdmin {
203
  add_action('admin_print_footer_scripts', array( __CLASS__, 'printTinyMCEOptions'), 1);
204
  wp_register_script('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/js/admin.js', array('wp-color-picker', 'datetimepicker'), CS_VERSION, true);
205
 
 
 
206
  self::localization();
207
 
208
  wp_enqueue_style('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/css/admin.css', array(), CS_VERSION);
@@ -287,6 +299,18 @@ class CrellySliderAdmin {
287
  wp_localize_script('crellyslider-admin', 'crellyslider_translations', $crellyslider_translations);
288
  }
289
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  /**
291
  * Invokes the filter for the tinyMCE init options
292
  */
@@ -313,7 +337,7 @@ class CrellySliderAdmin {
313
  else {
314
  $language = $language[0];
315
  }
316
-
317
  return array(
318
  'toolbar1' => 'bold,italic,strikethrough,alignleft,aligncenter,alignright,link,unlink,underline,forecolor,backcolor',
319
  'toolbar2' => 'fontselect,fontsizeselect',
11
  }
12
 
13
  public static function pluginMenus() {
14
+ add_menu_page('Crelly Slider', 'Crelly Slider', CS_MIN_CAPABILITY, 'crellyslider', 'CrellySliderAdmin::displayPage', 'div');
15
  }
16
 
17
  // Go to the correct page
137
  <div class="cs-slider <?php echo $edit ? 'cs-edit-slider' : 'cs-add-slider' ?>">
138
  <div class="cs-tabs cs-tabs-fade cs-tabs-switch-interface">
139
  <?php if($edit): ?>
140
+ <script type="text/javascript">
141
+ <?php
142
+ $currentSliderNonce = CrellySliderHelpers::getNonce($id);
143
+ if(! $currentSliderNonce) {
144
+ die('Could not get nonce for current slider');
145
+ }
146
+ ?>
147
+ var crellyslider_currentSliderNonce = "<?php echo $currentSliderNonce; ?>";
148
+ </script>
149
+
150
  <ul>
151
 
152
  <li>
202
  wp_enqueue_script('jquery-ui-tabs');
203
  wp_enqueue_script('jquery-ui-sortable');
204
  wp_enqueue_script('jquery-ui-dialog');
205
+ wp_enqueue_script('jquery-ui-datepicker');
206
  wp_enqueue_style('wp-color-picker');
207
  wp_enqueue_media();
208
 
213
  add_action('admin_print_footer_scripts', array( __CLASS__, 'printTinyMCEOptions'), 1);
214
  wp_register_script('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/js/admin.js', array('wp-color-picker', 'datetimepicker'), CS_VERSION, true);
215
 
216
+ wp_register_script('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/js/admin.js', array('wp-color-picker', 'datetimepicker'), CS_VERSION, true);
217
+ self::createNonces();
218
  self::localization();
219
 
220
  wp_enqueue_style('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/css/admin.css', array(), CS_VERSION);
299
  wp_localize_script('crellyslider-admin', 'crellyslider_translations', $crellyslider_translations);
300
  }
301
 
302
+ public static function createNonces() {
303
+ $nonces = array(
304
+ 'addSlider' => wp_create_nonce('crellyslider_add-slider'),
305
+ 'deleteSlider' => wp_create_nonce('crellyslider_delete-slider'),
306
+ 'duplicateSlider' => wp_create_nonce('crellyslider_duplicate-slider'),
307
+ 'exportSlider' => wp_create_nonce('crellyslider_export-slider'),
308
+ 'importSlider' => wp_create_nonce('crellyslider_import-slider'),
309
+ );
310
+
311
+ wp_localize_script('crellyslider-admin', 'crellyslider_nonces', $nonces);
312
+ }
313
+
314
  /**
315
  * Invokes the filter for the tinyMCE init options
316
  */
337
  else {
338
  $language = $language[0];
339
  }
340
+
341
  return array(
342
  'toolbar1' => 'bold,italic,strikethrough,alignleft,aligncenter,alignright,link,unlink,underline,forecolor,backcolor',
343
  'toolbar2' => 'fontselect,fontsizeselect',
wordpress/ajax.php CHANGED
@@ -1,23 +1,7 @@
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
- /************************/
5
- /** EXTERNAL RESOURCES **/
6
- /************************/
7
-
8
- // Alternative to file_get_contents. If CURL is not installed, file_get_contents is called
9
- // http://stackoverflow.com/questions/3979802/alternative-to-file-get-contents
10
- function crellyslider_url_get_contents ($Url) {
11
- if (!function_exists('curl_init')){
12
- return file_get_contents($Url);
13
- }
14
- $ch = curl_init();
15
- curl_setopt($ch, CURLOPT_URL, $Url);
16
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
17
- $output = curl_exec($ch);
18
- curl_close($ch);
19
- return $output;
20
- }
21
 
22
  /********************/
23
  /** AJAX CALLBACKS **/
@@ -84,6 +68,13 @@ function crellyslider_wp_insert_rows($row_arrays = array(), $wp_table_name) {
84
  // Add slider
85
  add_action('wp_ajax_crellyslider_addSlider', 'crellyslider_addSlider_callback');
86
  function crellyslider_addSlider_callback() {
 
 
 
 
 
 
 
87
  global $wpdb;
88
  $options = $_POST['datas'];
89
 
@@ -103,9 +94,9 @@ function crellyslider_insertSliderSQL($options) {
103
  return $wpdb->insert(
104
  $wpdb->prefix . 'crellyslider_sliders',
105
  array(
106
- 'name' => $options['name'],
107
- 'alias' => $options['alias'],
108
- 'layout' => $options['layout'],
109
  'responsive' => $options['responsive'],
110
  'startWidth' => $options['startWidth'],
111
  'startHeight' => $options['startHeight'],
@@ -118,8 +109,8 @@ function crellyslider_insertSliderSQL($options) {
118
  'randomOrder' => $options['randomOrder'],
119
  'startFromSlide' => $options['startFromSlide'],
120
  'enableSwipe' => $options['enableSwipe'],
121
- 'fromDate' => $options['fromDate'],
122
- 'toDate' => $options['toDate'],
123
  ),
124
  array(
125
  '%s',
@@ -146,6 +137,10 @@ function crellyslider_insertSliderSQL($options) {
146
  // Edit slider
147
  add_action('wp_ajax_crellyslider_editSlider', 'crellyslider_editSlider_callback');
148
  function crellyslider_editSlider_callback() {
 
 
 
 
149
  global $wpdb;
150
  $options = $_POST['datas'];
151
  $table_name = $wpdb->prefix . 'crellyslider_sliders';
@@ -155,12 +150,16 @@ function crellyslider_editSlider_callback() {
155
  return;
156
  }
157
 
 
 
 
 
158
  $output = $wpdb->update(
159
  $table_name,
160
  array(
161
- 'name' => $options['name'],
162
- 'alias' => $options['alias'],
163
- 'layout' => $options['layout'],
164
  'responsive' => $options['responsive'],
165
  'startWidth' => $options['startWidth'],
166
  'startHeight' => $options['startHeight'],
@@ -170,11 +169,11 @@ function crellyslider_editSlider_callback() {
170
  'showProgressBar' => $options['showProgressBar'],
171
  'pauseOnHover' => $options['pauseOnHover'],
172
  'callbacks' => $options['callbacks'],
173
- 'randomOrder' => $options['randomOrder'],
174
- 'startFromSlide' => $options['startFromSlide'],
175
  'enableSwipe' => $options['enableSwipe'],
176
- 'fromDate' => $options['fromDate'],
177
- 'toDate' => $options['toDate'],
178
  ),
179
  array('id' => esc_sql($options['id'])),
180
  array(
@@ -210,6 +209,10 @@ function crellyslider_editSlider_callback() {
210
  // Edit slides. Receives an array with all the slides options. Delete al the old slides then recreate them
211
  add_action('wp_ajax_crellyslider_editSlides', 'crellyslider_editSlides_callback');
212
  function crellyslider_editSlides_callback() {
 
 
 
 
213
  global $wpdb;
214
  $options = $_POST['datas'];
215
 
@@ -218,6 +221,10 @@ function crellyslider_editSlides_callback() {
218
  return;
219
  }
220
 
 
 
 
 
221
  $output = true;
222
 
223
  // Remove all the old slides
@@ -232,7 +239,12 @@ function crellyslider_editSlides_callback() {
232
  return;
233
  }
234
 
235
- $output = crellyslider_wp_insert_rows($options['options'], $wpdb->prefix . 'crellyslider_slides');
 
 
 
 
 
236
 
237
  // Returning
238
  $output = json_encode($output);
@@ -243,9 +255,31 @@ function crellyslider_editSlides_callback() {
243
  die();
244
  }
245
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  // Edit elements. Receives an array with all the elements options. Delete al the old elements then recreate them
247
  add_action('wp_ajax_crellyslider_editElements', 'crellyslider_editElements_callback');
248
  function crellyslider_editElements_callback() {
 
 
 
 
249
  global $wpdb;
250
  $options = $_POST['datas'];
251
 
@@ -254,6 +288,10 @@ function crellyslider_editElements_callback() {
254
  return;
255
  }
256
 
 
 
 
 
257
  $output = true;
258
 
259
  // Remove all the old elements
@@ -265,26 +303,57 @@ function crellyslider_editElements_callback() {
265
  // No elements
266
  $quick_temp = json_decode(stripslashes($options['options']));
267
  if(empty($quick_temp)) {
268
- echo json_encode(true);
 
269
  }
270
  else {
271
  $options_array = json_decode(stripslashes($options['options']));
272
 
273
- $output = crellyslider_wp_insert_rows($options_array, $wpdb->prefix . 'crellyslider_elements');
274
 
275
- // Returning
276
- $output = json_encode($output);
277
- if(is_array($output)) print_r($output);
278
- else echo $output;
 
 
 
 
 
 
279
  }
280
  }
281
 
282
  die();
283
  }
284
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  // Delete slider and its content
286
  add_action('wp_ajax_crellyslider_deleteSlider', 'crellyslider_deleteSlider_callback');
287
  function crellyslider_deleteSlider_callback() {
 
 
 
 
 
 
 
288
  global $wpdb;
289
  $options = $_POST['datas'];
290
 
@@ -316,6 +385,11 @@ function crellyslider_deleteSlider_callback() {
316
  $real_output = false;
317
  }
318
 
 
 
 
 
 
319
  // Returning
320
  $real_output = json_encode($real_output);
321
  if(is_array($real_output)) print_r($real_output);
@@ -327,6 +401,13 @@ function crellyslider_deleteSlider_callback() {
327
  // Duplicate slider and its content
328
  add_action('wp_ajax_crellyslider_duplicateSlider', 'crellyslider_duplicateSlider_callback');
329
  function crellyslider_duplicateSlider_callback() {
 
 
 
 
 
 
 
330
  global $wpdb;
331
  $options = $_POST['datas'];
332
 
@@ -421,10 +502,14 @@ function crellyslider_duplicateSlider_callback() {
421
  // Exports the slider in .zip
422
  add_action('wp_ajax_crellyslider_exportSlider', 'crellyslider_exportSlider_callback');
423
  function crellyslider_exportSlider_callback() {
424
- global $wpdb;
 
 
 
 
 
425
 
426
- // Clear the temp folder
427
- array_map('unlink', glob(CS_PATH . '/wordpress/temp/*'));
428
 
429
  $options = $_POST['datas'];
430
 
@@ -433,6 +518,11 @@ function crellyslider_exportSlider_callback() {
433
  return;
434
  }
435
 
 
 
 
 
 
436
  $real_output = true;
437
 
438
  $result = array();
@@ -451,8 +541,9 @@ function crellyslider_exportSlider_callback() {
451
 
452
  $zip = new ZipArchive();
453
  $filename = 'crellyslider-' . $sliders[0]['alias'] . '.zip';
454
- if($zip->open(CS_PATH . '/wordpress/temp/' . $filename, ZipArchive::CREATE) !== TRUE) {
455
  echo false;
 
456
  die();
457
  }
458
 
@@ -466,8 +557,13 @@ function crellyslider_exportSlider_callback() {
466
  // Add images to zip and remove media directory URLs
467
  if($slides[$key]['background_type_image'] != 'none' && $slides[$key]['background_type_image'] != 'undefined') {
468
  $img = CrellySliderCommon::getURL($slides[$key]['background_type_image']);
469
- $zip->addFromString(basename($img), crellyslider_url_get_contents($img));
470
- $slides[$key]['background_type_image'] = basename($img);
 
 
 
 
 
471
  }
472
  }
473
  $result['slides'] = $slides;
@@ -483,7 +579,12 @@ function crellyslider_exportSlider_callback() {
483
  // Add images to zip and remove media directory URLs
484
  if($elements[$key]['type'] == 'image') {
485
  $img = CrellySliderCommon::getURL($elements[$key]['image_src']);
486
- $zip->addFromString(basename($img), crellyslider_url_get_contents($img));
 
 
 
 
 
487
  $elements[$key]['image_src'] = basename($img);
488
  }
489
  }
@@ -498,7 +599,7 @@ function crellyslider_exportSlider_callback() {
498
  if($real_output === true) {
499
  $real_output = array(
500
  'response' => true,
501
- 'url' => CS_PLUGIN_URL . '/wordpress/temp/' . $filename,
502
  );
503
  }
504
  else {
@@ -519,9 +620,16 @@ function crellyslider_exportSlider_callback() {
519
  // Imports a slider given a .zip in $_FILES
520
  add_action('wp_ajax_crellyslider_importSlider', 'crellyslider_importSlider_callback');
521
  function crellyslider_importSlider_callback() {
 
 
 
 
 
 
 
522
  foreach($_FILES as $file) {
523
  $real_output = crellyslider_importSlider($file['tmp_name']);
524
-
525
  if($real_output == false) {
526
  echo false;
527
  die();
@@ -538,10 +646,12 @@ function crellyslider_importSlider_callback() {
538
  // Imports a slider given a .zip file path
539
  function crellyslider_importSlider($filePath) {
540
  global $wpdb;
541
-
542
- // Clear the temp folder
543
- array_map('unlink', glob(CS_PATH . '/wordpress/temp/*'));
544
-
 
 
545
  $output = true;
546
  $real_output = true;
547
 
@@ -550,9 +660,51 @@ function crellyslider_importSlider($filePath) {
550
  return false;
551
  }
552
 
553
- $zip->extractTo(CS_PATH . '/wordpress/temp/');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
554
 
555
- $imported_array = json_decode(file_get_contents(CS_PATH . '/wordpress/temp/slider.json'));
556
 
557
  $sliders = $imported_array->sliders;
558
  foreach($sliders as $slider) {
@@ -584,19 +736,19 @@ function crellyslider_importSlider($filePath) {
584
 
585
  // Set background images
586
  if($slides[$key]->background_type_image != 'undefined' && $slides[$key]->background_type_image != 'none') {
587
- $url = CS_PATH . '/wordpress/temp/' . $slides[$key]->background_type_image;
588
  $id = crellyslider_importImage($url);
589
  $slides[$key]->background_type_image = $id;
590
  }
591
  }
592
- $temp = crellyslider_wp_insert_rows($slides, $wpdb->prefix . 'crellyslider_slides');
593
  if($temp === false) {
594
  $output = false;
595
  }
596
  }
597
 
598
  // Import elements
599
- $elements = (array) $imported_array->elements;
600
  if(empty($elements)) {
601
  $output = true;
602
  }
@@ -606,12 +758,12 @@ function crellyslider_importSlider($filePath) {
606
 
607
  // Set images
608
  if($elements[$key]->type == 'image') {
609
- $url = CS_PATH . '/wordpress/temp/' . $elements[$key]->image_src;
610
  $id = crellyslider_importImage($url);
611
  $elements[$key]->image_src = $id;
612
  }
613
  }
614
- $temp = crellyslider_wp_insert_rows($elements, $wpdb->prefix . 'crellyslider_elements');
615
  if($temp === false) {
616
  $output = false;
617
  }
@@ -639,6 +791,8 @@ function crellyslider_importSlider($filePath) {
639
  );
640
  }
641
 
 
 
642
  return $real_output;
643
  }
644
 
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
+ require_once CS_PATH . 'wordpress/helpers.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  /********************/
7
  /** AJAX CALLBACKS **/
68
  // Add slider
69
  add_action('wp_ajax_crellyslider_addSlider', 'crellyslider_addSlider_callback');
70
  function crellyslider_addSlider_callback() {
71
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
72
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
73
+ }
74
+ if(! check_ajax_referer('crellyslider_add-slider', 'security', false)) {
75
+ die('Could not verify nonce');
76
+ }
77
+
78
  global $wpdb;
79
  $options = $_POST['datas'];
80
 
94
  return $wpdb->insert(
95
  $wpdb->prefix . 'crellyslider_sliders',
96
  array(
97
+ 'name' => sanitize_text_field($options['name']),
98
+ 'alias' => sanitize_text_field($options['alias']),
99
+ 'layout' => sanitize_key($options['layout']),
100
  'responsive' => $options['responsive'],
101
  'startWidth' => $options['startWidth'],
102
  'startHeight' => $options['startHeight'],
109
  'randomOrder' => $options['randomOrder'],
110
  'startFromSlide' => $options['startFromSlide'],
111
  'enableSwipe' => $options['enableSwipe'],
112
+ 'fromDate' => sanitize_text_field($options['fromDate']),
113
+ 'toDate' => sanitize_text_field($options['toDate']),
114
  ),
115
  array(
116
  '%s',
137
  // Edit slider
138
  add_action('wp_ajax_crellyslider_editSlider', 'crellyslider_editSlider_callback');
139
  function crellyslider_editSlider_callback() {
140
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
141
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
142
+ }
143
+
144
  global $wpdb;
145
  $options = $_POST['datas'];
146
  $table_name = $wpdb->prefix . 'crellyslider_sliders';
150
  return;
151
  }
152
 
153
+ if(! isset($_POST['security']) || ! CrellySliderHelpers::verifyNonce(esc_sql($options['id']), esc_sql($_POST['security']))) {
154
+ die('Could not verify nonce');
155
+ }
156
+
157
  $output = $wpdb->update(
158
  $table_name,
159
  array(
160
+ 'name' => sanitize_text_field($options['name']),
161
+ 'alias' => sanitize_text_field($options['alias']),
162
+ 'layout' => sanitize_key($options['layout']),
163
  'responsive' => $options['responsive'],
164
  'startWidth' => $options['startWidth'],
165
  'startHeight' => $options['startHeight'],
169
  'showProgressBar' => $options['showProgressBar'],
170
  'pauseOnHover' => $options['pauseOnHover'],
171
  'callbacks' => $options['callbacks'],
172
+ 'randomOrder' => $options['randomOrder'],
173
+ 'startFromSlide' => $options['startFromSlide'],
174
  'enableSwipe' => $options['enableSwipe'],
175
+ 'fromDate' => sanitize_text_field($options['fromDate']),
176
+ 'toDate' => sanitize_text_field($options['toDate']),
177
  ),
178
  array('id' => esc_sql($options['id'])),
179
  array(
209
  // Edit slides. Receives an array with all the slides options. Delete al the old slides then recreate them
210
  add_action('wp_ajax_crellyslider_editSlides', 'crellyslider_editSlides_callback');
211
  function crellyslider_editSlides_callback() {
212
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
213
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
214
+ }
215
+
216
  global $wpdb;
217
  $options = $_POST['datas'];
218
 
221
  return;
222
  }
223
 
224
+ if(! isset($_POST['security']) || ! CrellySliderHelpers::verifyNonce(esc_sql($options['slider_parent']), esc_sql($_POST['security']))) {
225
+ die('Could not verify nonce');
226
+ }
227
+
228
  $output = true;
229
 
230
  // Remove all the old slides
239
  return;
240
  }
241
 
242
+ $options_array = array();
243
+ for($i = 0; $i < count($options['options']); $i++) {
244
+ $options_array[$i] = (object)($options['options'][$i]);
245
+ }
246
+
247
+ $output = crellyslider_insertSlidesSQL($options_array);
248
 
249
  // Returning
250
  $output = json_encode($output);
255
  die();
256
  }
257
 
258
+ function crellyslider_insertSlidesSQL($options) {
259
+ global $wpdb;
260
+
261
+ // Sanitize input
262
+ for($i = 0; $i < count($options); $i++) {
263
+ $options[$i]->background_type_image = sanitize_text_field($options[$i]->background_type_image);
264
+ $options[$i]->background_type_color = sanitize_text_field($options[$i]->background_type_color);
265
+ $options[$i]->background_repeat = sanitize_text_field($options[$i]->background_repeat);
266
+ $options[$i]->background_propriety_size = sanitize_text_field($options[$i]->background_propriety_size);
267
+ $options[$i]->data_in = sanitize_text_field($options[$i]->data_in);
268
+ $options[$i]->data_out = sanitize_text_field($options[$i]->data_out);
269
+ $options[$i]->link = sanitize_text_field($options[$i]->link);
270
+ $options[$i]->custom_css = sanitize_textarea_field($options[$i]->custom_css);
271
+ }
272
+
273
+ return crellyslider_wp_insert_rows($options, $wpdb->prefix . 'crellyslider_slides');
274
+ }
275
+
276
  // Edit elements. Receives an array with all the elements options. Delete al the old elements then recreate them
277
  add_action('wp_ajax_crellyslider_editElements', 'crellyslider_editElements_callback');
278
  function crellyslider_editElements_callback() {
279
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
280
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
281
+ }
282
+
283
  global $wpdb;
284
  $options = $_POST['datas'];
285
 
288
  return;
289
  }
290
 
291
+ if(! isset($_POST['security']) || ! CrellySliderHelpers::verifyNonce(esc_sql($options['slider_parent']), esc_sql($_POST['security']))) {
292
+ die('Could not verify nonce');
293
+ }
294
+
295
  $output = true;
296
 
297
  // Remove all the old elements
303
  // No elements
304
  $quick_temp = json_decode(stripslashes($options['options']));
305
  if(empty($quick_temp)) {
306
+ $newNonce = CrellySliderHelpers::setNonce(esc_sql($options['slider_parent']));
307
+ echo json_encode($newNonce);
308
  }
309
  else {
310
  $options_array = json_decode(stripslashes($options['options']));
311
 
312
+ $output = crellyslider_insertElementsSQL($options_array);
313
 
314
+ // Generate new nonce on success and return it
315
+ if($output) {
316
+ $newNonce = CrellySliderHelpers::setNonce(esc_sql($options['slider_parent']));
317
+ echo json_encode($newNonce);
318
+ }
319
+ else {
320
+ $output = json_encode($output);
321
+ if(is_array($output)) print_r($output);
322
+ else echo $output;
323
+ }
324
  }
325
  }
326
 
327
  die();
328
  }
329
 
330
+ function crellyslider_insertElementsSQL($options) {
331
+ global $wpdb;
332
+
333
+ // Sanitize input
334
+ for($i = 0; $i < count($options); $i++) {
335
+ $options[$i]->image_src = sanitize_text_field($options[$i]->image_src);
336
+ $options[$i]->image_alt = sanitize_text_field($options[$i]->image_alt);
337
+ $options[$i]->data_in = sanitize_text_field($options[$i]->data_in);
338
+ $options[$i]->data_out = sanitize_text_field($options[$i]->data_out);
339
+ $options[$i]->custom_css_classes = sanitize_text_field($options[$i]->custom_css_classes);
340
+ $options[$i]->link = sanitize_text_field($options[$i]->link);
341
+ $options[$i]->video_id = sanitize_text_field($options[$i]->video_id);
342
+ }
343
+
344
+ return crellyslider_wp_insert_rows($options, $wpdb->prefix . 'crellyslider_elements');
345
+ }
346
+
347
  // Delete slider and its content
348
  add_action('wp_ajax_crellyslider_deleteSlider', 'crellyslider_deleteSlider_callback');
349
  function crellyslider_deleteSlider_callback() {
350
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
351
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
352
+ }
353
+ if(! check_ajax_referer('crellyslider_delete-slider', 'security', false)) {
354
+ die('Could not verify nonce');
355
+ }
356
+
357
  global $wpdb;
358
  $options = $_POST['datas'];
359
 
385
  $real_output = false;
386
  }
387
 
388
+ $output = CrellySliderHelpers::removeNonce(esc_sql($options['id']));
389
+ if($output === false) {
390
+ $real_output = false;
391
+ }
392
+
393
  // Returning
394
  $real_output = json_encode($real_output);
395
  if(is_array($real_output)) print_r($real_output);
401
  // Duplicate slider and its content
402
  add_action('wp_ajax_crellyslider_duplicateSlider', 'crellyslider_duplicateSlider_callback');
403
  function crellyslider_duplicateSlider_callback() {
404
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
405
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
406
+ }
407
+ if(! check_ajax_referer('crellyslider_duplicate-slider', 'security', false)) {
408
+ die('Could not verify nonce');
409
+ }
410
+
411
  global $wpdb;
412
  $options = $_POST['datas'];
413
 
502
  // Exports the slider in .zip
503
  add_action('wp_ajax_crellyslider_exportSlider', 'crellyslider_exportSlider_callback');
504
  function crellyslider_exportSlider_callback() {
505
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
506
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
507
+ }
508
+ if(! check_ajax_referer('crellyslider_export-slider', 'security', false)) {
509
+ die('Could not verify nonce');
510
+ }
511
 
512
+ global $wpdb;
 
513
 
514
  $options = $_POST['datas'];
515
 
518
  return;
519
  }
520
 
521
+ // Make dir with random name
522
+ $dirName = uniqid();
523
+ $tmpDir = CS_PATH . '/wordpress/temp/' . $dirName;
524
+ mkdir($tmpDir);
525
+
526
  $real_output = true;
527
 
528
  $result = array();
541
 
542
  $zip = new ZipArchive();
543
  $filename = 'crellyslider-' . $sliders[0]['alias'] . '.zip';
544
+ if($zip->open($tmpDir . '/' . $filename, ZipArchive::CREATE) !== TRUE) {
545
  echo false;
546
+ CrellySliderHelpers::delTree($tmpDir);
547
  die();
548
  }
549
 
557
  // Add images to zip and remove media directory URLs
558
  if($slides[$key]['background_type_image'] != 'none' && $slides[$key]['background_type_image'] != 'undefined') {
559
  $img = CrellySliderCommon::getURL($slides[$key]['background_type_image']);
560
+ $imgFile = download_url($img);
561
+ if(is_wp_error($imgFile)) {
562
+ echo false;
563
+ die();
564
+ }
565
+ $zip->addFile($imgFile, basename($img));
566
+ $slides[$key]['background_type_image'] = basename($img);
567
  }
568
  }
569
  $result['slides'] = $slides;
579
  // Add images to zip and remove media directory URLs
580
  if($elements[$key]['type'] == 'image') {
581
  $img = CrellySliderCommon::getURL($elements[$key]['image_src']);
582
+ $imgFile = download_url($img);
583
+ if(is_wp_error($imgFile)) {
584
+ echo false;
585
+ die();
586
+ }
587
+ $zip->addFile($imgFile, basename($img));
588
  $elements[$key]['image_src'] = basename($img);
589
  }
590
  }
599
  if($real_output === true) {
600
  $real_output = array(
601
  'response' => true,
602
+ 'url' => CS_PLUGIN_URL . "/wordpress/temp/$dirName/$filename",
603
  );
604
  }
605
  else {
620
  // Imports a slider given a .zip in $_FILES
621
  add_action('wp_ajax_crellyslider_importSlider', 'crellyslider_importSlider_callback');
622
  function crellyslider_importSlider_callback() {
623
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
624
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
625
+ }
626
+ if (! isset($_POST['security']) || ! wp_verify_nonce($_POST['security'], 'crellyslider_import-slider')) {
627
+ die('Could not verify nonce');
628
+ }
629
+
630
  foreach($_FILES as $file) {
631
  $real_output = crellyslider_importSlider($file['tmp_name']);
632
+
633
  if($real_output == false) {
634
  echo false;
635
  die();
646
  // Imports a slider given a .zip file path
647
  function crellyslider_importSlider($filePath) {
648
  global $wpdb;
649
+
650
+ // Make dir with random name
651
+ $dirName = uniqid();
652
+ $tmpDir = CS_PATH . '/wordpress/temp/' . $dirName;
653
+ mkdir($tmpDir);
654
+
655
  $output = true;
656
  $real_output = true;
657
 
660
  return false;
661
  }
662
 
663
+ // The zip archive should only contain a json file and images.
664
+ $safeFiles = array(
665
+ 'slider.json'
666
+ );
667
+ $safeExtensions = array(
668
+ // List of common images extensions stolen from https://github.com/dyne/file-extension-list/blob/master/data/image
669
+ '3dm',
670
+ '3ds',
671
+ 'max',
672
+ 'bmp',
673
+ 'dds',
674
+ 'gif',
675
+ 'jpg',
676
+ 'jpeg',
677
+ 'png',
678
+ 'psd',
679
+ 'xcf',
680
+ 'tga',
681
+ 'thm',
682
+ 'tif',
683
+ 'tiff',
684
+ 'yuv',
685
+ 'ai',
686
+ 'eps',
687
+ 'ps',
688
+ 'svg',
689
+ 'dwg',
690
+ 'dxf',
691
+ 'gpx',
692
+ 'kml',
693
+ 'kmz',
694
+ );
695
+ for($i = 0; ! empty($zip->statIndex($i)['name']); $i++) {
696
+ $fileName = $zip->statIndex($i)['name'];
697
+ $ext = pathinfo($fileName, PATHINFO_EXTENSION);
698
+
699
+ if(! in_array($fileName, $safeFiles) && ! in_array($ext, $safeExtensions)) {
700
+ CrellySliderHelpers::delTree($tmpDir);
701
+ die('Attempting to extract an unsupported file: ' . $fileName);
702
+ }
703
+ }
704
+
705
+ $zip->extractTo($tmpDir);
706
 
707
+ $imported_array = json_decode(file_get_contents($tmpDir . '/slider.json'));
708
 
709
  $sliders = $imported_array->sliders;
710
  foreach($sliders as $slider) {
736
 
737
  // Set background images
738
  if($slides[$key]->background_type_image != 'undefined' && $slides[$key]->background_type_image != 'none') {
739
+ $url = $tmpDir . '/' . $slides[$key]->background_type_image;
740
  $id = crellyslider_importImage($url);
741
  $slides[$key]->background_type_image = $id;
742
  }
743
  }
744
+ $temp = crellyslider_insertSlidesSQL((array) $slides);
745
  if($temp === false) {
746
  $output = false;
747
  }
748
  }
749
 
750
  // Import elements
751
+ $elements = isset($imported_array->elements) ? (array) $imported_array->elements : array();
752
  if(empty($elements)) {
753
  $output = true;
754
  }
758
 
759
  // Set images
760
  if($elements[$key]->type == 'image') {
761
+ $url = $tmpDir . '/' . $elements[$key]->image_src;
762
  $id = crellyslider_importImage($url);
763
  $elements[$key]->image_src = $id;
764
  }
765
  }
766
+ $temp = crellyslider_insertElementsSQL((array) $elements);
767
  if($temp === false) {
768
  $output = false;
769
  }
791
  );
792
  }
793
 
794
+ CrellySliderHelpers::delTree($tmpDir);
795
+
796
  return $real_output;
797
  }
798
 
wordpress/helpers.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ class CrellySliderHelpers {
5
+ // Removes a directory and its content
6
+ public static function delTree($dir) {
7
+ $files = array_diff(scandir($dir), array('.','..'));
8
+ foreach ($files as $file) {
9
+ (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file");
10
+ }
11
+ return rmdir($dir);
12
+ }
13
+
14
+ public static function setNonce($sliderID) {
15
+ global $wpdb;
16
+
17
+ $nonce = self::randomString(10);
18
+
19
+ $replace = $wpdb->replace(
20
+ $wpdb->prefix . 'crellyslider_nonces',
21
+ array(
22
+ 'slider_id' => $sliderID,
23
+ 'nonce' => $nonce,
24
+ ),
25
+ array(
26
+ '%d',
27
+ '%s',
28
+ )
29
+ );
30
+
31
+ if($replace) {
32
+ return $nonce;
33
+ }
34
+ return false;
35
+ }
36
+
37
+ public static function getNonce($sliderID) {
38
+ global $wpdb;
39
+
40
+ $table_name = $wpdb->prefix . 'crellyslider_nonces';
41
+
42
+ $nonce = $wpdb->get_var($wpdb->prepare("SELECT nonce FROM $table_name WHERE slider_id=%d", $sliderID));
43
+ if($nonce == null) {
44
+ return self::setNonce($sliderID);
45
+ }
46
+ return $nonce;
47
+ }
48
+
49
+ public static function verifyNonce($sliderID, $nonce) {
50
+ global $wpdb;
51
+ $table_name = $wpdb->prefix . 'crellyslider_nonces';
52
+ $dbNonce = $wpdb->get_var($wpdb->prepare("SELECT nonce FROM $table_name WHERE slider_id=%d", $sliderID));
53
+ return $nonce === $dbNonce;
54
+ }
55
+
56
+ public static function removeNonce($sliderID) {
57
+ global $wpdb;
58
+ return $wpdb->delete( $wpdb->prefix . 'crellyslider_nonces', array( 'slider_id' => $sliderID ), array( '%d' ) );
59
+ }
60
+
61
+ public static function randomString($length) {
62
+ $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
63
+ $charactersLength = strlen($characters);
64
+ $randomString = '';
65
+ for ($i = 0; $i < $length; $i++) {
66
+ $randomString .= $characters[rand(0, $charactersLength - 1)];
67
+ }
68
+ return $randomString;
69
+ }
70
+ }
71
+ ?>
wordpress/js/admin.js CHANGED
@@ -89,12 +89,12 @@
89
 
90
  function crellyslider_showWait() {
91
  $('.cs-admin .cs-message').css('display', 'none');
92
-
93
  var target = $('.cs-admin .cs-message.cs-message-wait');
94
 
95
  var untouchedMessage = target.text().split('.').join('');
96
  target.text(untouchedMessage);
97
-
98
  target.css({
99
  'display' : 'block',
100
  'opacity' : 1,
@@ -1384,7 +1384,7 @@
1384
  // Sends an array with the new or current slider options
1385
  function crellyslider_saveSlider() {
1386
  crellyslider_showWait();
1387
-
1388
  var content = $('.cs-admin .cs-slider #cs-slider-settings');
1389
  var options = {
1390
  id : parseInt($('.cs-admin .cs-slider .cs-save-settings').data('id')),
@@ -1407,6 +1407,14 @@
1407
  callbacks : content.find('#cs-slider-callbacks').val(),
1408
  };
1409
 
 
 
 
 
 
 
 
 
1410
  // Do the ajax call
1411
  jQuery.ajax({
1412
  type : 'POST',
@@ -1415,6 +1423,7 @@
1415
  data : {
1416
  // Is it saving or updating?
1417
  action: $('.cs-admin .cs-slider').hasClass('cs-add-slider') ? 'crellyslider_addSlider' : 'crellyslider_editSlider',
 
1418
  datas : options,
1419
  },
1420
  success: function(response) {
@@ -1500,6 +1509,7 @@
1500
  url : ajaxurl,
1501
  data : {
1502
  action: 'crellyslider_editSlides',
 
1503
  datas : final_options,
1504
  },
1505
  success: function(response) {
@@ -1521,7 +1531,7 @@
1521
  }
1522
 
1523
  // Sends an array with all the elements options of each slide
1524
- function crellyslider_saveElements() {
1525
  var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1526
  var i = 0, j = 0;
1527
  var final_options = {};
@@ -1612,11 +1622,13 @@
1612
  url : ajaxurl,
1613
  data : {
1614
  action: 'crellyslider_editElements',
 
1615
  datas : final_options,
1616
  },
1617
  success: function(response) {
1618
  //console.log(response);
1619
  if(response !== false) {
 
1620
  crellyslider_showSuccess();
1621
  }
1622
  else {
@@ -1634,7 +1646,7 @@
1634
 
1635
  function crellyslider_deleteSlider(content) {
1636
  crellyslider_showWait();
1637
-
1638
  // Get options
1639
  var options = {
1640
  id : parseInt(content.data('delete')),
@@ -1647,6 +1659,7 @@
1647
  url : ajaxurl,
1648
  data : {
1649
  action: 'crellyslider_deleteSlider',
 
1650
  datas : options,
1651
  },
1652
  success: function(response) {
@@ -1675,7 +1688,7 @@
1675
 
1676
  function crellyslider_duplicateSlider(content) {
1677
  crellyslider_showWait();
1678
-
1679
  // Get options
1680
  var options = {
1681
  id : parseInt(content.data('duplicate')),
@@ -1688,6 +1701,7 @@
1688
  url : ajaxurl,
1689
  data : {
1690
  action: 'crellyslider_duplicateSlider',
 
1691
  datas : options,
1692
  },
1693
  success: function(response) {
@@ -1721,7 +1735,7 @@
1721
 
1722
  function crellyslider_exportSlider(content) {
1723
  crellyslider_showWait();
1724
-
1725
  // Get options
1726
  var options = {
1727
  id : parseInt(content.data('export')),
@@ -1734,6 +1748,7 @@
1734
  url : ajaxurl,
1735
  data : {
1736
  action: 'crellyslider_exportSlider',
 
1737
  datas : options,
1738
  },
1739
  success: function(response) {
@@ -1770,6 +1785,7 @@
1770
  var fd = new FormData();
1771
  fd.append('file', file);
1772
  fd.append('action', 'crellyslider_importSlider');
 
1773
 
1774
  // Do the ajax call
1775
  jQuery.ajax({
89
 
90
  function crellyslider_showWait() {
91
  $('.cs-admin .cs-message').css('display', 'none');
92
+
93
  var target = $('.cs-admin .cs-message.cs-message-wait');
94
 
95
  var untouchedMessage = target.text().split('.').join('');
96
  target.text(untouchedMessage);
97
+
98
  target.css({
99
  'display' : 'block',
100
  'opacity' : 1,
1384
  // Sends an array with the new or current slider options
1385
  function crellyslider_saveSlider() {
1386
  crellyslider_showWait();
1387
+
1388
  var content = $('.cs-admin .cs-slider #cs-slider-settings');
1389
  var options = {
1390
  id : parseInt($('.cs-admin .cs-slider .cs-save-settings').data('id')),
1407
  callbacks : content.find('#cs-slider-callbacks').val(),
1408
  };
1409
 
1410
+ var sliderNonce;
1411
+ if(typeof(crellyslider_currentSliderNonce) != "undefined") {
1412
+ sliderNonce = crellyslider_currentSliderNonce;
1413
+ }
1414
+ else {
1415
+ sliderNonce = crellyslider_nonces.addSlider;
1416
+ }
1417
+
1418
  // Do the ajax call
1419
  jQuery.ajax({
1420
  type : 'POST',
1423
  data : {
1424
  // Is it saving or updating?
1425
  action: $('.cs-admin .cs-slider').hasClass('cs-add-slider') ? 'crellyslider_addSlider' : 'crellyslider_editSlider',
1426
+ security: sliderNonce,
1427
  datas : options,
1428
  },
1429
  success: function(response) {
1509
  url : ajaxurl,
1510
  data : {
1511
  action: 'crellyslider_editSlides',
1512
+ security: crellyslider_currentSliderNonce,
1513
  datas : final_options,
1514
  },
1515
  success: function(response) {
1531
  }
1532
 
1533
  // Sends an array with all the elements options of each slide
1534
+ function crellyslider_saveElements() {
1535
  var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1536
  var i = 0, j = 0;
1537
  var final_options = {};
1622
  url : ajaxurl,
1623
  data : {
1624
  action: 'crellyslider_editElements',
1625
+ security: crellyslider_currentSliderNonce,
1626
  datas : final_options,
1627
  },
1628
  success: function(response) {
1629
  //console.log(response);
1630
  if(response !== false) {
1631
+ crellyslider_currentSliderNonce = response;
1632
  crellyslider_showSuccess();
1633
  }
1634
  else {
1646
 
1647
  function crellyslider_deleteSlider(content) {
1648
  crellyslider_showWait();
1649
+
1650
  // Get options
1651
  var options = {
1652
  id : parseInt(content.data('delete')),
1659
  url : ajaxurl,
1660
  data : {
1661
  action: 'crellyslider_deleteSlider',
1662
+ security: crellyslider_nonces.deleteSlider,
1663
  datas : options,
1664
  },
1665
  success: function(response) {
1688
 
1689
  function crellyslider_duplicateSlider(content) {
1690
  crellyslider_showWait();
1691
+
1692
  // Get options
1693
  var options = {
1694
  id : parseInt(content.data('duplicate')),
1701
  url : ajaxurl,
1702
  data : {
1703
  action: 'crellyslider_duplicateSlider',
1704
+ security: crellyslider_nonces.duplicateSlider,
1705
  datas : options,
1706
  },
1707
  success: function(response) {
1735
 
1736
  function crellyslider_exportSlider(content) {
1737
  crellyslider_showWait();
1738
+
1739
  // Get options
1740
  var options = {
1741
  id : parseInt(content.data('export')),
1748
  url : ajaxurl,
1749
  data : {
1750
  action: 'crellyslider_exportSlider',
1751
+ security: crellyslider_nonces.exportSlider,
1752
  datas : options,
1753
  },
1754
  success: function(response) {
1785
  var fd = new FormData();
1786
  fd.append('file', file);
1787
  fd.append('action', 'crellyslider_importSlider');
1788
+ fd.append('security', crellyslider_nonces.importSlider);
1789
 
1790
  // Do the ajax call
1791
  jQuery.ajax({
wordpress/js/gutenberg.js ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var el = wp.element.createElement;
2
+ var registerBlockType = wp.blocks.registerBlockType;
3
+
4
+ var sliders = null;
5
+ var options = null;
6
+
7
+ registerBlockType( 'crelly-slider/select-slider', {
8
+ title: 'Crelly Slider',
9
+ icon: 'universal-access-alt',
10
+ category: 'layout',
11
+ attributes: {
12
+ sliderAlias: {
13
+ type: 'string'
14
+ }
15
+ },
16
+
17
+ edit: function (props) {
18
+ if(sliders == null) {
19
+ jQuery.ajax({
20
+ type : 'POST',
21
+ url : ajaxurl,
22
+ async: false,
23
+ data : {
24
+ action: 'crellyslider_getSlidersList',
25
+ },
26
+ success: function(response) {
27
+ sliders = JSON.parse(response);
28
+
29
+ var attributes = props.attributes;
30
+ var savedAlias = attributes.sliderAlias;
31
+
32
+ options = [];
33
+ for(var i = 0; i < sliders.length; i++) {
34
+ var s = sliders[i];
35
+ if(s['alias'] == savedAlias) {
36
+ o = el('option', {value: s['alias'], selected:true}, s['name']);
37
+ }
38
+ else {
39
+ o = el('option', {value: s['alias']}, s['name']);
40
+ }
41
+ options.push(o);
42
+ }
43
+ },
44
+
45
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
46
+ alert('Cannot request sliders list');
47
+ console.log(XMLHttpRequest.responseText);
48
+ }
49
+ });
50
+ }
51
+
52
+ console.log("edit")
53
+ console.log(props);
54
+ return el(
55
+ 'select',
56
+ {
57
+ className: props.className,
58
+ onChange: function(event) {
59
+ var alias = event.target.value;
60
+ if(alias == 'crellyslider-no-slider') {
61
+ alias = null;
62
+ }
63
+ props.setAttributes({
64
+ sliderAlias: alias
65
+ });
66
+ }
67
+ },
68
+ el('option', {value: 'crellyslider-no-slider'}, crellyslider_translations.select_slider),
69
+ options
70
+ );
71
+ },
72
+
73
+ save: function(props) {
74
+ var attributes = props.attributes;
75
+ var alias = attributes.sliderAlias;
76
+ console.log(props);
77
+ return el('div', {className: props.className + 'crellyslider-block-slider-' + alias}, '[crellyslider alias="' + alias + '"]');
78
+ },
79
+ });
wordpress/tables.php CHANGED
@@ -17,6 +17,21 @@ class CrellySliderTables {
17
  self::setSlidersTable();
18
  self::setSlidesTable();
19
  self::setElementsTable();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
 
22
  public static function setSlidersTable() {
@@ -125,6 +140,7 @@ class CrellySliderTables {
125
  self::dropTable($wpdb->prefix . 'crellyslider_sliders');
126
  self::dropTable($wpdb->prefix . 'crellyslider_slides');
127
  self::dropTable($wpdb->prefix . 'crellyslider_elements');
 
128
  }
129
 
130
  public static function dropTable($table_name) {
17
  self::setSlidersTable();
18
  self::setSlidesTable();
19
  self::setElementsTable();
20
+ self::setNoncesTable();
21
+ }
22
+
23
+ public static function setNoncesTable() {
24
+ global $wpdb;
25
+ $table_name = $wpdb->prefix . 'crellyslider_nonces';
26
+
27
+ $sql = "CREATE TABLE $table_name (
28
+ slider_id mediumint(9) NOT NULL,
29
+ nonce varchar(100) DEFAULT '' NOT NULL,
30
+ UNIQUE KEY slider_id (slider_id)
31
+ );";
32
+
33
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
34
+ dbDelta($sql);
35
  }
36
 
37
  public static function setSlidersTable() {
140
  self::dropTable($wpdb->prefix . 'crellyslider_sliders');
141
  self::dropTable($wpdb->prefix . 'crellyslider_slides');
142
  self::dropTable($wpdb->prefix . 'crellyslider_elements');
143
+ self::dropTable($wpdb->prefix . 'crellyslider_nonces');
144
  }
145
 
146
  public static function dropTable($table_name) {
wordpress/temp/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
+ <?php // Leave this file here in order to block dir listing ?>
wordpress/temp/silence.php DELETED
@@ -1,2 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
- <?php // If you can read this, you probably have never used the Import/Export function ?>