MetaSlider - Version 2.8.1

Version Description

[28/04/14] =

  • Fix: All in One Events Calendar conflict fix (Advanced Settings not toggling)
  • Fix: CSS resets to avoid theme conflicts
  • Fix: Autoload visibility conflict (http://wordpress.org/support/topic/autoload-visibillity-conflict)
  • Fix: Layer Editor in IE11 - text fields not accessible in modal windows
  • Fix: FlexSlider IE11 Fade transition
Download this release

Release Info

Developer matchalabs
Plugin Icon 128x128 MetaSlider
Version 2.8.1
Comparing to
See all releases

Code changes from version 2.7.2 to 2.8.1

assets/colorbox/jquery.colorbox-min.js CHANGED
@@ -49,7 +49,7 @@
49
 
50
  open: false,
51
  returnFocus: true,
52
- trapFocus: true,
53
  reposition: true,
54
  loop: true,
55
  slideshow: false,
49
 
50
  open: false,
51
  returnFocus: true,
52
+ trapFocus: false,
53
  reposition: true,
54
  loop: true,
55
  slideshow: false,
assets/matchalabs.png DELETED
Binary file
assets/metaslider/admin.css CHANGED
@@ -160,8 +160,16 @@
160
  display: none
161
  }
162
 
163
- .metaslider .probutton,
164
- .metaslider .probutton:hover {
 
 
 
 
 
 
 
 
165
  width: 36%;
166
  margin: 20px 32% 10px 32%;
167
  float: left;
@@ -190,21 +198,21 @@
190
  line-height: 2em;
191
  }
192
 
193
- .metaslider .super {
194
  text-transform: uppercase;
195
  font-size: 0.7em;
196
  vertical-align: top;
197
  line-height: 2em;
198
  }
199
 
200
- .metaslider .subtext {
201
  float: left;
202
  width: 100%;
203
  text-align: center;
204
  font-style: italic;
205
  }
206
 
207
- .metaslider .logo {
208
  text-transform: uppercase
209
  }
210
 
@@ -618,7 +626,16 @@ input[type=radio]:checked + label {
618
  }
619
 
620
  .metaslider .right .postbox table {
621
- border: 0
 
 
 
 
 
 
 
 
 
622
  }
623
 
624
  .metaslider .right .postbox h3 {
@@ -735,13 +752,7 @@ textarea:-ms-input-placeholder {
735
  font-size: 11px
736
  }
737
 
738
- .metaslider .slide.image .tabs-content {
739
- overflow: hidden
740
- }
741
-
742
  .metaslider .left .tabs-content {
743
- height: 118px;
744
- overflow-x: scroll;
745
  clear: both;
746
  }
747
 
@@ -750,7 +761,11 @@ textarea:-ms-input-placeholder {
750
  clear: both;
751
  width: 100%;
752
  vertical-align: middle;
753
- margin-bottom: 5px;
 
 
 
 
754
  }
755
 
756
  .metaslider .tabs-content .row label {
160
  display: none
161
  }
162
 
163
+ .metaslider_pro {
164
+ margin-top: 50px;
165
+ }
166
+ .metaslider_pro p {
167
+ text-align: center;
168
+ font-size: 1.2em;
169
+ }
170
+
171
+ .metaslider_pro .probutton,
172
+ .metaslider_pro .probutton:hover {
173
  width: 36%;
174
  margin: 20px 32% 10px 32%;
175
  float: left;
198
  line-height: 2em;
199
  }
200
 
201
+ .metaslider_pro .super {
202
  text-transform: uppercase;
203
  font-size: 0.7em;
204
  vertical-align: top;
205
  line-height: 2em;
206
  }
207
 
208
+ .metaslider_pro .subtext {
209
  float: left;
210
  width: 100%;
211
  text-align: center;
212
  font-style: italic;
213
  }
214
 
215
+ .metaslider_pro .logo {
216
  text-transform: uppercase
217
  }
218
 
626
  }
627
 
628
  .metaslider .right .postbox table {
629
+ border: 0;
630
+ width: 100%;
631
+ }
632
+
633
+ .metaslider .right .postbox table textarea {
634
+ width: 100%;
635
+ height: 100px;
636
+ font-family: monospace;
637
+ background: #272822;
638
+ color: #a6e22e;
639
  }
640
 
641
  .metaslider .right .postbox h3 {
752
  font-size: 11px
753
  }
754
 
 
 
 
 
755
  .metaslider .left .tabs-content {
 
 
756
  clear: both;
757
  }
758
 
761
  clear: both;
762
  width: 100%;
763
  vertical-align: middle;
764
+ margin-bottom: 6px;
765
+ }
766
+
767
+ .metaslider .tabs-content .row.last {
768
+ margin-bottom: 0;
769
  }
770
 
771
  .metaslider .tabs-content .row label {
assets/metaslider/admin.js CHANGED
@@ -1,5 +1,63 @@
1
  jQuery(document).ready(function($) {
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  jQuery("#screen-options-link-wrap").appendTo("#screen-meta-links").show();
4
 
5
  // Enable the correct options for this slider type
@@ -59,6 +117,7 @@ jQuery(document).ready(function($) {
59
  handle: "td.col-1",
60
  stop: function() {
61
  jQuery(".metaslider .left table").trigger("updateSlideOrder");
 
62
  }
63
  });
64
 
@@ -225,7 +284,7 @@ jQuery(document).ready(function($) {
225
  if (button.id === "ms-preview") {
226
  jQuery.colorbox({
227
  iframe: true,
228
- href: metaslider.iframeurl + "?slider_id=" + jQuery(button).data("slider_id"),
229
  transition: "elastic",
230
  innerHeight: getLightboxHeight(),
231
  innerWidth: getLightboxWidth(),
1
  jQuery(document).ready(function($) {
2
 
3
+ var file_frame;
4
+
5
+ jQuery('.metaslider .add-slide').on('click', function(event){
6
+ event.preventDefault();
7
+
8
+ // If the media frame already exists, reopen it.
9
+ if ( file_frame ) {
10
+ file_frame.open();
11
+ return;
12
+ }
13
+
14
+ // Create the media frame.
15
+ file_frame = wp.media.frames.file_frame = wp.media({
16
+ multiple: 'add',
17
+ frame: 'post',
18
+ library: {type: 'image'}
19
+ });
20
+
21
+ // When an image is selected, run a callback.
22
+ file_frame.on('insert', function() {
23
+
24
+ jQuery(".metaslider .spinner").show();
25
+ jQuery(".metaslider input[type=submit]").attr('disabled', 'disabled');
26
+
27
+ var selection = file_frame.state().get('selection');
28
+ var slide_ids = [];
29
+
30
+ selection.map(function(attachment) {
31
+ attachment = attachment.toJSON();
32
+ slide_ids.push(attachment.id);
33
+ });
34
+
35
+ var data = {
36
+ action: 'create_image_slide',
37
+ slider_id: window.parent.metaslider_slider_id,
38
+ selection: slide_ids,
39
+ _wpnonce: metaslider.addslide_nonce
40
+ };
41
+
42
+ jQuery.post(metaslider.ajaxurl, data, function(response) {
43
+ jQuery(".metaslider .left table").append(response);
44
+ jQuery(".metaslider .left table").trigger('resizeSlides');
45
+ });
46
+ });
47
+
48
+ file_frame.open();
49
+
50
+ // Remove the Media Library tab (media_upload_tabs filter is broken in 3.6)
51
+ jQuery(".media-menu a:contains('Media Library')").remove();
52
+
53
+ if (!window.parent.metaslider_pro_active) {
54
+ jQuery(".media-menu a:contains('YouTube')").addClass('disabled');
55
+ jQuery(".media-menu a:contains('Vimeo')").addClass('disabled');
56
+ jQuery(".media-menu a:contains('Post Feed')").addClass('disabled');
57
+ jQuery(".media-menu a:contains('Layer Slide')").addClass('disabled');
58
+ }
59
+ });
60
+
61
  jQuery("#screen-options-link-wrap").appendTo("#screen-meta-links").show();
62
 
63
  // Enable the correct options for this slider type
117
  handle: "td.col-1",
118
  stop: function() {
119
  jQuery(".metaslider .left table").trigger("updateSlideOrder");
120
+ jQuery(".metaslider form #ms-save").click();
121
  }
122
  });
123
 
284
  if (button.id === "ms-preview") {
285
  jQuery.colorbox({
286
  iframe: true,
287
+ href: metaslider.iframeurl + "&slider_id=" + jQuery(button).data("slider_id"),
288
  transition: "elastic",
289
  innerHeight: getLightboxHeight(),
290
  innerWidth: getLightboxWidth(),
assets/metaslider/image/image.js DELETED
@@ -1,66 +0,0 @@
1
- /**
2
- * Meta Slider
3
- */
4
- (function ($) {
5
- $(function () {
6
- var file_frame;
7
-
8
- jQuery('.metaslider .add-slide').on('click', function(event){
9
- event.preventDefault();
10
-
11
- // If the media frame already exists, reopen it.
12
- if ( file_frame ) {
13
- file_frame.open();
14
- return;
15
- }
16
-
17
- // Create the media frame.
18
- file_frame = wp.media.frames.file_frame = wp.media({
19
- multiple: 'add',
20
- frame: 'post',
21
- library: {type: 'image'}
22
- });
23
-
24
- // When an image is selected, run a callback.
25
- file_frame.on('insert', function() {
26
-
27
- jQuery(".metaslider .spinner").show();
28
- jQuery(".metaslider input[type=submit]").attr('disabled', 'disabled');
29
-
30
- var selection = file_frame.state().get('selection');
31
- var slide_ids = [];
32
-
33
- selection.map(function(attachment) {
34
- attachment = attachment.toJSON();
35
- slide_ids.push(attachment.id);
36
- });
37
-
38
- var data = {
39
- action: 'create_image_slide',
40
- slider_id: window.parent.metaslider_slider_id,
41
- selection: slide_ids,
42
- _wpnonce: metaslider_image.addslide_nonce
43
- };
44
-
45
- jQuery.post(metaslider.ajaxurl, data, function(response) {
46
- jQuery(".metaslider .left table").append(response);
47
- jQuery(".metaslider .left table").trigger('resizeSlides');
48
- });
49
- });
50
-
51
- file_frame.open();
52
-
53
- // Remove the Media Library tab (media_upload_tabs filter is broken in 3.6)
54
- jQuery(".media-menu a:contains('Media Library')").remove();
55
-
56
- if (!window.parent.metaslider_pro_active) {
57
- jQuery(".media-menu a:contains('YouTube')").addClass('disabled');
58
- jQuery(".media-menu a:contains('Vimeo')").addClass('disabled');
59
- jQuery(".media-menu a:contains('Post Feed')").addClass('disabled');
60
- jQuery(".media-menu a:contains('Layer Slide')").addClass('disabled');
61
- }
62
- });
63
-
64
- });
65
-
66
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/metaslider/public.css CHANGED
@@ -10,15 +10,23 @@
10
  position: relative;
11
  z-index: 0;
12
  }
13
- .metaslider.nav-hidden .flexslider {
14
- margin-bottom: 0;
15
- }
16
- .metaslider.nav-hidden.add-margin .flexslider {
17
- margin-bottom: 40px;
18
- }
19
 
20
  .metaslider .caption {
21
  padding: 5px 10px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  }
23
 
24
  .metaslider img {
@@ -27,6 +35,10 @@
27
  margin: 0;
28
  }
29
 
 
 
 
 
30
  .metaslider .theme-default .nivoSlider {
31
  -webkit-box-shadow: 0 0 0;
32
  -moz-box-shadow: 0 0 0;
@@ -41,19 +53,6 @@
41
  margin: 0 !important;
42
  }
43
 
44
- .metaslider .caption-wrap {
45
- position: absolute;
46
- bottom: 0;
47
- left: 0;
48
- background: black;
49
- color: white;
50
- line-height: 30px;
51
- opacity: 0.7;
52
- margin: 0;
53
- display: block;
54
- width: 100%;
55
- }
56
-
57
  .metaslider .caption-wrap .caption img {
58
  width: auto;
59
  }
@@ -96,7 +95,10 @@
96
  list-style: none;
97
  padding: 0;
98
  line-height: normal;
 
 
99
  }
 
100
  .metaslider .slides img {
101
  width: 100%;
102
  display: block;
10
  position: relative;
11
  z-index: 0;
12
  }
 
 
 
 
 
 
13
 
14
  .metaslider .caption {
15
  padding: 5px 10px;
16
+ word-wrap: break-word;
17
+ }
18
+
19
+ .metaslider .caption-wrap {
20
+ position: absolute;
21
+ bottom: 0;
22
+ left: 0;
23
+ background: black;
24
+ color: white;
25
+ opacity: 0.7;
26
+ margin: 0;
27
+ display: block;
28
+ width: 100%;
29
+ line-height: 1.4em;
30
  }
31
 
32
  .metaslider img {
35
  margin: 0;
36
  }
37
 
38
+ .metaslider a {
39
+ outline: none;
40
+ }
41
+
42
  .metaslider .theme-default .nivoSlider {
43
  -webkit-box-shadow: 0 0 0;
44
  -moz-box-shadow: 0 0 0;
53
  margin: 0 !important;
54
  }
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  .metaslider .caption-wrap .caption img {
57
  width: auto;
58
  }
95
  list-style: none;
96
  padding: 0;
97
  line-height: normal;
98
+ max-width: none;
99
+ max-height: none;
100
  }
101
+
102
  .metaslider .slides img {
103
  width: 100%;
104
  display: block;
assets/sliders/flexslider/flexslider.css CHANGED
@@ -22,7 +22,7 @@
22
  /* FlexSlider Necessary Styles
23
  *********************************/
24
  .flexslider {margin: 0; padding: 0;}
25
- .flexslider .slides > li {display: none; -webkit-backface-visibility: hidden;} /* Hide the slides before the JS is loaded. Avoids image jumping */
26
  .flexslider .slides img {width: 100%; display: block;}
27
  .flex-pauseplay span {text-transform: capitalize;}
28
 
@@ -76,7 +76,7 @@ html[xmlns] .slides {display: block;}
76
  }
77
 
78
  /** Custom Meta Slider CSS **/
79
- .flexslider {
80
  background: none;
81
  box-shadow: none;
82
  -webkit-box-shadow: none;
@@ -84,6 +84,8 @@ html[xmlns] .slides {display: block;}
84
  -o-box-shadow: none;
85
  border: 0;
86
  margin: 0 0 40px 0;
 
 
87
  }
88
 
89
  .flex-control-nav {
@@ -103,6 +105,7 @@ html[xmlns] .slides {display: block;}
103
 
104
  .flexslider .slides li {
105
  position: relative;
 
106
  }
107
 
108
  /** fix for users with RTL languages */
@@ -146,4 +149,13 @@ html[xmlns] .slides {display: block;}
146
  .metaslider ol.flex-control-thumbs img,
147
  #content .metaslider ol.flex-control-thumbs img {
148
  margin: 10px 5px 0;
 
 
 
 
 
149
  }
 
 
 
 
22
  /* FlexSlider Necessary Styles
23
  *********************************/
24
  .flexslider {margin: 0; padding: 0;}
25
+ /*.flexslider .slides > li {display: none; -webkit-backface-visibility: hidden;} /* Hide the slides before the JS is loaded. Avoids image jumping */
26
  .flexslider .slides img {width: 100%; display: block;}
27
  .flex-pauseplay span {text-transform: capitalize;}
28
 
76
  }
77
 
78
  /** Custom Meta Slider CSS **/
79
+ .metaslider .flexslider {
80
  background: none;
81
  box-shadow: none;
82
  -webkit-box-shadow: none;
84
  -o-box-shadow: none;
85
  border: 0;
86
  margin: 0 0 40px 0;
87
+ max-width: none;
88
+ max-height: none;
89
  }
90
 
91
  .flex-control-nav {
105
 
106
  .flexslider .slides li {
107
  position: relative;
108
+ height: auto;
109
  }
110
 
111
  /** fix for users with RTL languages */
149
  .metaslider ol.flex-control-thumbs img,
150
  #content .metaslider ol.flex-control-thumbs img {
151
  margin: 10px 5px 0;
152
+ width: auto;
153
+ }
154
+
155
+ .metaslider.nav-hidden .flexslider {
156
+ margin-bottom: 0;
157
  }
158
+
159
+ .metaslider.nav-hidden.add-margin .flexslider {
160
+ margin-bottom: 40px;
161
+ }
assets/sliders/flexslider/jquery.flexslider-min.js CHANGED
@@ -1,5 +1,1156 @@
1
  /*
2
- * jQuery FlexSlider v2.2.0
3
  * Copyright 2012 WooThemes
4
  * Contributing Author: Tyler Smith
5
- */(function(e){e.flexslider=function(t,n){var r=e(t);r.vars=e.extend({},e.flexslider.defaults,n);var i=r.vars.namespace,s=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture,o=("ontouchstart"in window||s||window.DocumentTouch&&document instanceof DocumentTouch)&&r.vars.touch,u="click touchend MSPointerUp",a="",f,l=r.vars.direction==="vertical",c=r.vars.reverse,h=r.vars.itemWidth>0,p=r.vars.animation==="fade",d=r.vars.asNavFor!=="",v={},m=!0;e.data(t,"flexslider",r);v={init:function(){r.animating=!1;r.currentSlide=parseInt(r.vars.startAt?r.vars.startAt:0);isNaN(r.currentSlide)&&(r.currentSlide=0);r.animatingTo=r.currentSlide;r.atEnd=r.currentSlide===0||r.currentSlide===r.last;r.containerSelector=r.vars.selector.substr(0,r.vars.selector.search(" "));r.slides=e(r.vars.selector,r);r.container=e(r.containerSelector,r);r.count=r.slides.length;r.syncExists=e(r.vars.sync).length>0;r.vars.animation==="slide"&&(r.vars.animation="swing");r.prop=l?"top":"marginLeft";r.args={};r.manualPause=!1;r.stopped=!1;r.started=!1;r.startTimeout=null;r.transitions=!r.vars.video&&!p&&r.vars.useCSS&&function(){var e=document.createElement("div"),t=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var n in t)if(e.style[t[n]]!==undefined){r.pfx=t[n].replace("Perspective","").toLowerCase();r.prop="-"+r.pfx+"-transform";return!0}return!1}();r.vars.controlsContainer!==""&&(r.controlsContainer=e(r.vars.controlsContainer).length>0&&e(r.vars.controlsContainer));r.vars.manualControls!==""&&(r.manualControls=e(r.vars.manualControls).length>0&&e(r.vars.manualControls));if(r.vars.randomize){r.slides.sort(function(){return Math.round(Math.random())-.5});r.container.empty().append(r.slides)}r.doMath();r.setup("init");r.vars.controlNav&&v.controlNav.setup();r.vars.directionNav&&v.directionNav.setup();r.vars.keyboard&&(e(r.containerSelector).length===1||r.vars.multipleKeyboard)&&e(document).bind("keyup",function(e){var t=e.keyCode;if(!r.animating&&(t===39||t===37)){var n=t===39?r.getTarget("next"):t===37?r.getTarget("prev"):!1;r.flexAnimate(n,r.vars.pauseOnAction)}});r.vars.mousewheel&&r.bind("mousewheel",function(e,t,n,i){e.preventDefault();var s=t<0?r.getTarget("next"):r.getTarget("prev");r.flexAnimate(s,r.vars.pauseOnAction)});r.vars.pausePlay&&v.pausePlay.setup();r.vars.slideshow&&r.vars.pauseInvisible&&v.pauseInvisible.init();if(r.vars.slideshow){r.vars.pauseOnHover&&r.hover(function(){!r.manualPlay&&!r.manualPause&&r.pause()},function(){!r.manualPause&&!r.manualPlay&&!r.stopped&&r.play()});if(!r.vars.pauseInvisible||!v.pauseInvisible.isHidden())r.vars.initDelay>0?r.startTimeout=setTimeout(r.play,r.vars.initDelay):r.play()}d&&v.asNav.setup();o&&r.vars.touch&&v.touch();(!p||p&&r.vars.smoothHeight)&&e(window).bind("resize orientationchange focus",v.resize);r.find("img").attr("draggable","false");setTimeout(function(){r.vars.start(r)},200)},asNav:{setup:function(){r.asNav=!0;r.animatingTo=Math.floor(r.currentSlide/r.move);r.currentItem=r.currentSlide;r.slides.removeClass(i+"active-slide").eq(r.currentItem).addClass(i+"active-slide");if(!s)r.slides.click(function(t){t.preventDefault();var n=e(this),s=n.index(),o=n.offset().left-e(r).scrollLeft();if(o<=0&&n.hasClass(i+"active-slide"))r.flexAnimate(r.getTarget("prev"),!0);else if(!e(r.vars.asNavFor).data("flexslider").animating&&!n.hasClass(i+"active-slide")){r.direction=r.currentItem<s?"next":"prev";r.flexAnimate(s,r.vars.pauseOnAction,!1,!0,!0)}});else{t._slider=r;r.slides.each(function(){var t=this;t._gesture=new MSGesture;t._gesture.target=t;t.addEventListener("MSPointerDown",function(e){e.preventDefault();e.currentTarget._gesture&&e.currentTarget._gesture.addPointer(e.pointerId)},!1);t.addEventListener("MSGestureTap",function(t){t.preventDefault();var n=e(this),i=n.index();if(!e(r.vars.asNavFor).data("flexslider").animating&&!n.hasClass("active")){r.direction=r.currentItem<i?"next":"prev";r.flexAnimate(i,r.vars.pauseOnAction,!1,!0,!0)}})})}}},controlNav:{setup:function(){r.manualControls?v.controlNav.setupManual():v.controlNav.setupPaging()},setupPaging:function(){var t=r.vars.controlNav==="thumbnails"?"control-thumbs":"control-paging",n=1,s,o;r.controlNavScaffold=e('<ol class="'+i+"control-nav "+i+t+'"></ol>');if(r.pagingCount>1)for(var f=0;f<r.pagingCount;f++){o=r.slides.eq(f);s=r.vars.controlNav==="thumbnails"?'<img src="'+o.attr("data-thumb")+'"/>':"<a>"+n+"</a>";if("thumbnails"===r.vars.controlNav&&!0===r.vars.thumbCaptions){var l=o.attr("data-thumbcaption");""!=l&&undefined!=l&&(s+='<span class="'+i+'caption">'+l+"</span>")}r.controlNavScaffold.append("<li>"+s+"</li>");n++}r.controlsContainer?e(r.controlsContainer).append(r.controlNavScaffold):r.append(r.controlNavScaffold);v.controlNav.set();v.controlNav.active();r.controlNavScaffold.delegate("a, img",u,function(t){t.preventDefault();if(a===""||a===t.type){var n=e(this),s=r.controlNav.index(n);if(!n.hasClass(i+"active")){r.direction=s>r.currentSlide?"next":"prev";r.flexAnimate(s,r.vars.pauseOnAction)}}a===""&&(a=t.type);v.setToClearWatchedEvent()})},setupManual:function(){r.controlNav=r.manualControls;v.controlNav.active();r.controlNav.bind(u,function(t){t.preventDefault();if(a===""||a===t.type){var n=e(this),s=r.controlNav.index(n);if(!n.hasClass(i+"active")){s>r.currentSlide?r.direction="next":r.direction="prev";r.flexAnimate(s,r.vars.pauseOnAction)}}a===""&&(a=t.type);v.setToClearWatchedEvent()})},set:function(){var t=r.vars.controlNav==="thumbnails"?"img":"a";r.controlNav=e("."+i+"control-nav li "+t,r.controlsContainer?r.controlsContainer:r)},active:function(){r.controlNav.removeClass(i+"active").eq(r.animatingTo).addClass(i+"active")},update:function(t,n){r.pagingCount>1&&t==="add"?r.controlNavScaffold.append(e("<li><a>"+r.count+"</a></li>")):r.pagingCount===1?r.controlNavScaffold.find("li").remove():r.controlNav.eq(n).closest("li").remove();v.controlNav.set();r.pagingCount>1&&r.pagingCount!==r.controlNav.length?r.update(n,t):v.controlNav.active()}},directionNav:{setup:function(){var t=e('<ul class="'+i+'direction-nav"><li><a class="'+i+'prev" href="#">'+r.vars.prevText+'</a></li><li><a class="'+i+'next" href="#">'+r.vars.nextText+"</a></li></ul>");if(r.controlsContainer){e(r.controlsContainer).append(t);r.directionNav=e("."+i+"direction-nav li a",r.controlsContainer)}else{r.append(t);r.directionNav=e("."+i+"direction-nav li a",r)}v.directionNav.update();r.directionNav.bind(u,function(t){t.preventDefault();var n;if(a===""||a===t.type){n=e(this).hasClass(i+"next")?r.getTarget("next"):r.getTarget("prev");r.flexAnimate(n,r.vars.pauseOnAction)}a===""&&(a=t.type);v.setToClearWatchedEvent()})},update:function(){var e=i+"disabled";r.pagingCount===1?r.directionNav.addClass(e).attr("tabindex","-1"):r.vars.animationLoop?r.directionNav.removeClass(e).removeAttr("tabindex"):r.animatingTo===0?r.directionNav.removeClass(e).filter("."+i+"prev").addClass(e).attr("tabindex","-1"):r.animatingTo===r.last?r.directionNav.removeClass(e).filter("."+i+"next").addClass(e).attr("tabindex","-1"):r.directionNav.removeClass(e).removeAttr("tabindex")}},pausePlay:{setup:function(){var t=e('<div class="'+i+'pauseplay"><a></a></div>');if(r.controlsContainer){r.controlsContainer.append(t);r.pausePlay=e("."+i+"pauseplay a",r.controlsContainer)}else{r.append(t);r.pausePlay=e("."+i+"pauseplay a",r)}v.pausePlay.update(r.vars.slideshow?i+"pause":i+"play");r.pausePlay.bind(u,function(t){t.preventDefault();if(a===""||a===t.type)if(e(this).hasClass(i+"pause")){r.manualPause=!0;r.manualPlay=!1;r.pause()}else{r.manualPause=!1;r.manualPlay=!0;r.play()}a===""&&(a=t.type);v.setToClearWatchedEvent()})},update:function(e){e==="play"?r.pausePlay.removeClass(i+"pause").addClass(i+"play").html(r.vars.playText):r.pausePlay.removeClass(i+"play").addClass(i+"pause").html(r.vars.pauseText)}},touch:function(){var e,n,i,o,u,a,f=!1,d=0,v=0,m=0;if(!s){t.addEventListener("touchstart",g,!1);function g(s){if(r.animating)s.preventDefault();else if(window.navigator.msPointerEnabled||s.touches.length===1){r.pause();o=l?r.h:r.w;a=Number(new Date);d=s.touches[0].pageX;v=s.touches[0].pageY;i=h&&c&&r.animatingTo===r.last?0:h&&c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:h&&r.currentSlide===r.last?r.limit:h?(r.itemW+r.vars.itemMargin)*r.move*r.currentSlide:c?(r.last-r.currentSlide+r.cloneOffset)*o:(r.currentSlide+r.cloneOffset)*o;e=l?v:d;n=l?d:v;t.addEventListener("touchmove",y,!1);t.addEventListener("touchend",b,!1)}}function y(t){d=t.touches[0].pageX;v=t.touches[0].pageY;u=l?e-v:e-d;f=l?Math.abs(u)<Math.abs(d-n):Math.abs(u)<Math.abs(v-n);var s=500;if(!f||Number(new Date)-a>s){t.preventDefault();if(!p&&r.transitions){r.vars.animationLoop||(u/=r.currentSlide===0&&u<0||r.currentSlide===r.last&&u>0?Math.abs(u)/o+2:1);r.setProps(i+u,"setTouch")}}}function b(s){t.removeEventListener("touchmove",y,!1);if(r.animatingTo===r.currentSlide&&!f&&u!==null){var l=c?-u:u,h=l>0?r.getTarget("next"):r.getTarget("prev");r.canAdvance(h)&&(Number(new Date)-a<550&&Math.abs(l)>50||Math.abs(l)>o/2)?r.flexAnimate(h,r.vars.pauseOnAction):p||r.flexAnimate(r.currentSlide,r.vars.pauseOnAction,!0)}t.removeEventListener("touchend",b,!1);e=null;n=null;u=null;i=null}}else{t.style.msTouchAction="none";t._gesture=new MSGesture;t._gesture.target=t;t.addEventListener("MSPointerDown",w,!1);t._slider=r;t.addEventListener("MSGestureChange",E,!1);t.addEventListener("MSGestureEnd",S,!1);function w(e){e.stopPropagation();if(r.animating)e.preventDefault();else{r.pause();t._gesture.addPointer(e.pointerId);m=0;o=l?r.h:r.w;a=Number(new Date);i=h&&c&&r.animatingTo===r.last?0:h&&c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:h&&r.currentSlide===r.last?r.limit:h?(r.itemW+r.vars.itemMargin)*r.move*r.currentSlide:c?(r.last-r.currentSlide+r.cloneOffset)*o:(r.currentSlide+r.cloneOffset)*o}}function E(e){e.stopPropagation();var n=e.target._slider;if(!n)return;var r=-e.translationX,s=-e.translationY;m+=l?s:r;u=m;f=l?Math.abs(m)<Math.abs(-r):Math.abs(m)<Math.abs(-s);if(e.detail===e.MSGESTURE_FLAG_INERTIA){setImmediate(function(){t._gesture.stop()});return}if(!f||Number(new Date)-a>500){e.preventDefault();if(!p&&n.transitions){n.vars.animationLoop||(u=m/(n.currentSlide===0&&m<0||n.currentSlide===n.last&&m>0?Math.abs(m)/o+2:1));n.setProps(i+u,"setTouch")}}}function S(t){t.stopPropagation();var r=t.target._slider;if(!r)return;if(r.animatingTo===r.currentSlide&&!f&&u!==null){var s=c?-u:u,l=s>0?r.getTarget("next"):r.getTarget("prev");r.canAdvance(l)&&(Number(new Date)-a<550&&Math.abs(s)>50||Math.abs(s)>o/2)?r.flexAnimate(l,r.vars.pauseOnAction):p||r.flexAnimate(r.currentSlide,r.vars.pauseOnAction,!0)}e=null;n=null;u=null;i=null;m=0}}},resize:function(){if(!r.animating&&r.is(":visible")){h||r.doMath();if(p)v.smoothHeight();else if(h){r.slides.width(r.computedW);r.update(r.pagingCount);r.setProps()}else if(l){r.viewport.height(r.h);r.setProps(r.h,"setTotal")}else{r.vars.smoothHeight&&v.smoothHeight();r.newSlides.width(r.computedW);r.setProps(r.computedW,"setTotal")}}},smoothHeight:function(e){if(!l||p){var t=p?r:r.viewport;e?t.animate({height:r.slides.eq(r.animatingTo).height()},e):t.height(r.slides.eq(r.animatingTo).height())}},sync:function(t){var n=e(r.vars.sync).data("flexslider"),i=r.animatingTo;switch(t){case"animate":n.flexAnimate(i,r.vars.pauseOnAction,!1,!0);break;case"play":!n.playing&&!n.asNav&&n.play();break;case"pause":n.pause()}},pauseInvisible:{visProp:null,init:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t<e.length;t++)e[t]+"Hidden"in document&&(v.pauseInvisible.visProp=e[t]+"Hidden");if(v.pauseInvisible.visProp){var n=v.pauseInvisible.visProp.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(n,function(){v.pauseInvisible.isHidden()?r.startTimeout?clearTimeout(r.startTimeout):r.pause():r.started?r.play():r.vars.initDelay>0?setTimeout(r.play,r.vars.initDelay):r.play()})}},isHidden:function(){return document[v.pauseInvisible.visProp]||!1}},setToClearWatchedEvent:function(){clearTimeout(f);f=setTimeout(function(){a=""},3e3)}};r.flexAnimate=function(t,n,s,u,a){!r.vars.animationLoop&&t!==r.currentSlide&&(r.direction=t>r.currentSlide?"next":"prev");d&&r.pagingCount===1&&(r.direction=r.currentItem<t?"next":"prev");if(!r.animating&&(r.canAdvance(t,a)||s)&&r.is(":visible")){if(d&&u){var f=e(r.vars.asNavFor).data("flexslider");r.atEnd=t===0||t===r.count-1;f.flexAnimate(t,!0,!1,!0,a);r.direction=r.currentItem<t?"next":"prev";f.direction=r.direction;if(Math.ceil((t+1)/r.visible)-1===r.currentSlide||t===0){r.currentItem=t;r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");return!1}r.currentItem=t;r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");t=Math.floor(t/r.visible)}r.animating=!0;r.animatingTo=t;n&&r.pause();r.vars.before(r);r.syncExists&&!a&&v.sync("animate");r.vars.controlNav&&v.controlNav.active();h||r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");r.atEnd=t===0||t===r.last;r.vars.directionNav&&v.directionNav.update();if(t===r.last){r.vars.end(r);r.vars.animationLoop||r.pause()}if(!p){var m=l?r.slides.filter(":first").height():r.computedW,g,y,b;if(h){g=r.vars.itemMargin;b=(r.itemW+g)*r.move*r.animatingTo;y=b>r.limit&&r.visible!==1?r.limit:b}else r.currentSlide===0&&t===r.count-1&&r.vars.animationLoop&&r.direction!=="next"?y=c?(r.count+r.cloneOffset)*m:0:r.currentSlide===r.last&&t===0&&r.vars.animationLoop&&r.direction!=="prev"?y=c?0:(r.count+1)*m:y=c?(r.count-1-t+r.cloneOffset)*m:(t+r.cloneOffset)*m;r.setProps(y,"",r.vars.animationSpeed);if(r.transitions){if(!r.vars.animationLoop||!r.atEnd){r.animating=!1;r.currentSlide=r.animatingTo}r.container.unbind("webkitTransitionEnd transitionend");r.container.bind("webkitTransitionEnd transitionend",function(){r.wrapup(m)})}else r.container.animate(r.args,r.vars.animationSpeed,r.vars.easing,function(){r.wrapup(m)})}else if(!o){r.slides.eq(r.currentSlide).css({zIndex:1}).animate({opacity:0},r.vars.animationSpeed,r.vars.easing);r.slides.eq(t).css({zIndex:2}).animate({opacity:1},r.vars.animationSpeed,r.vars.easing,r.wrapup)}else{r.slides.eq(r.currentSlide).css({opacity:0,zIndex:1});r.slides.eq(t).css({opacity:1,zIndex:2});r.wrapup(m)}r.vars.smoothHeight&&v.smoothHeight(r.vars.animationSpeed)}};r.wrapup=function(e){!p&&!h&&(r.currentSlide===0&&r.animatingTo===r.last&&r.vars.animationLoop?r.setProps(e,"jumpEnd"):r.currentSlide===r.last&&r.animatingTo===0&&r.vars.animationLoop&&r.setProps(e,"jumpStart"));r.animating=!1;r.currentSlide=r.animatingTo;r.vars.after(r)};r.animateSlides=function(){!r.animating&&m&&r.flexAnimate(r.getTarget("next"))};r.pause=function(){clearInterval(r.animatedSlides);r.animatedSlides=null;r.playing=!1;r.vars.pausePlay&&v.pausePlay.update("play");r.syncExists&&v.sync("pause")};r.play=function(){r.playing&&clearInterval(r.animatedSlides);r.animatedSlides=r.animatedSlides||setInterval(r.animateSlides,r.vars.slideshowSpeed);r.started=r.playing=!0;r.vars.pausePlay&&v.pausePlay.update("pause");r.syncExists&&v.sync("play")};r.stop=function(){r.pause();r.stopped=!0};r.canAdvance=function(e,t){var n=d?r.pagingCount-1:r.last;return t?!0:d&&r.currentItem===r.count-1&&e===0&&r.direction==="prev"?!0:d&&r.currentItem===0&&e===r.pagingCount-1&&r.direction!=="next"?!1:e===r.currentSlide&&!d?!1:r.vars.animationLoop?!0:r.atEnd&&r.currentSlide===0&&e===n&&r.direction!=="next"?!1:r.atEnd&&r.currentSlide===n&&e===0&&r.direction==="next"?!1:!0};r.getTarget=function(e){r.direction=e;return e==="next"?r.currentSlide===r.last?0:r.currentSlide+1:r.currentSlide===0?r.last:r.currentSlide-1};r.setProps=function(e,t,n){var i=function(){var n=e?e:(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo,i=function(){if(h)return t==="setTouch"?e:c&&r.animatingTo===r.last?0:c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:r.animatingTo===r.last?r.limit:n;switch(t){case"setTotal":return c?(r.count-1-r.currentSlide+r.cloneOffset)*e:(r.currentSlide+r.cloneOffset)*e;case"setTouch":return c?e:e;case"jumpEnd":return c?e:r.count*e;case"jumpStart":return c?r.count*e:e;default:return e}}();return i*-1+"px"}();if(r.transitions){i=l?"translate3d(0,"+i+",0)":"translate3d("+i+",0,0)";n=n!==undefined?n/1e3+"s":"0s";r.container.css("-"+r.pfx+"-transition-duration",n)}r.args[r.prop]=i;(r.transitions||n===undefined)&&r.container.css(r.args)};r.setup=function(t){if(!p){var n,s;if(t==="init"){r.viewport=e('<div class="'+i+'viewport"></div>').css({overflow:"hidden",position:"relative"}).appendTo(r).append(r.container);r.cloneCount=0;r.cloneOffset=0;if(c){s=e.makeArray(r.slides).reverse();r.slides=e(s);r.container.empty().append(r.slides)}}if(r.vars.animationLoop&&!h){r.cloneCount=2;r.cloneOffset=1;t!=="init"&&r.container.find(".clone").remove();r.container.append(r.slides.first().clone().addClass("clone").attr("aria-hidden","true")).prepend(r.slides.last().clone().addClass("clone").attr("aria-hidden","true"))}r.newSlides=e(r.vars.selector,r);n=c?r.count-1-r.currentSlide+r.cloneOffset:r.currentSlide+r.cloneOffset;if(l&&!h){r.container.height((r.count+r.cloneCount)*200+"%").css("position","absolute").width("100%");setTimeout(function(){r.newSlides.css({display:"block"});r.doMath();r.viewport.height(r.h);r.setProps(n*r.h,"init")},t==="init"?100:0)}else{r.container.width((r.count+r.cloneCount)*200+"%");r.setProps(n*r.computedW,"init");setTimeout(function(){r.doMath();r.newSlides.css({width:r.computedW,"float":"left",display:"block"});r.vars.smoothHeight&&v.smoothHeight()},t==="init"?100:0)}}else{r.slides.css({width:"100%","float":"left",marginRight:"-100%",position:"relative"});t==="init"&&(o?r.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+r.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(r.currentSlide).css({opacity:1,zIndex:2}):r.slides.css({opacity:0,display:"block",zIndex:1}).eq(r.currentSlide).css({zIndex:2}).animate({opacity:1},r.vars.animationSpeed,r.vars.easing));r.vars.smoothHeight&&v.smoothHeight()}h||r.slides.removeClass(i+"active-slide").eq(r.currentSlide).addClass(i+"active-slide")};r.doMath=function(){var e=r.slides.first(),t=r.vars.itemMargin,n=r.vars.minItems,i=r.vars.maxItems;r.w=r.viewport===undefined?r.width():r.viewport.width();r.h=e.height();r.boxPadding=e.outerWidth()-e.width();if(h){r.itemT=r.vars.itemWidth+t;r.minW=n?n*r.itemT:r.w;r.maxW=i?i*r.itemT-t:r.w;r.itemW=r.minW>r.w?(r.w-t*(n-1))/n:r.maxW<r.w?(r.w-t*(i-1))/i:r.vars.itemWidth>r.w?r.w:r.vars.itemWidth;r.visible=Math.floor(r.w/r.itemW);r.move=r.vars.move>0&&r.vars.move<r.visible?r.vars.move:r.visible;r.pagingCount=Math.ceil((r.count-r.visible)/r.move+1);r.last=r.pagingCount-1;r.limit=r.pagingCount===1?0:r.vars.itemWidth>r.w?r.itemW*(r.count-1)+t*(r.count-1):(r.itemW+t)*r.count-r.w-t}else{r.itemW=r.w;r.pagingCount=r.count;r.last=r.count-1}r.computedW=r.itemW-r.boxPadding};r.update=function(e,t){r.doMath();if(!h){e<r.currentSlide?r.currentSlide+=1:e<=r.currentSlide&&e!==0&&(r.currentSlide-=1);r.animatingTo=r.currentSlide}if(r.vars.controlNav&&!r.manualControls)if(t==="add"&&!h||r.pagingCount>r.controlNav.length)v.controlNav.update("add");else if(t==="remove"&&!h||r.pagingCount<r.controlNav.length){if(h&&r.currentSlide>r.last){r.currentSlide-=1;r.animatingTo-=1}v.controlNav.update("remove",r.last)}r.vars.directionNav&&v.directionNav.update()};r.addSlide=function(t,n){var i=e(t);r.count+=1;r.last=r.count-1;l&&c?n!==undefined?r.slides.eq(r.count-n).after(i):r.container.prepend(i):n!==undefined?r.slides.eq(n).before(i):r.container.append(i);r.update(n,"add");r.slides=e(r.vars.selector+":not(.clone)",r);r.setup();r.vars.added(r)};r.removeSlide=function(t){var n=isNaN(t)?r.slides.index(e(t)):t;r.count-=1;r.last=r.count-1;isNaN(t)?e(t,r.slides).remove():l&&c?r.slides.eq(r.last).remove():r.slides.eq(t).remove();r.doMath();r.update(n,"remove");r.slides=e(r.vars.selector+":not(.clone)",r);r.setup();r.vars.removed(r)};v.init()};e(window).blur(function(e){focused=!1}).focus(function(e){focused=!0});e.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){}};e.fn.flexslider=function(t){t===undefined&&(t={});if(typeof t=="object")return this.each(function(){var n=e(this),r=t.selector?t.selector:".slides > li",i=n.find(r);if(i.length===1&&t.allowOneSlide===!0||i.length===0){i.fadeIn(400);t.start&&t.start(n)}else n.data("flexslider")===undefined&&new e.flexslider(this,t)});var n=e(this).data("flexslider");switch(t){case"play":n.play();break;case"pause":n.pause();break;case"stop":n.stop();break;case"next":n.flexAnimate(n.getTarget("next"),!0);break;case"prev":case"previous":n.flexAnimate(n.getTarget("prev"),!0);break;default:typeof t=="number"&&n.flexAnimate(t,!0)}}})(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /*
2
+ * jQuery FlexSlider v2.2.2
3
  * Copyright 2012 WooThemes
4
  * Contributing Author: Tyler Smith
5
+ * Modifications applied: https://github.com/woothemes/FlexSlider/pull/1044
6
+ * Line 921: https://github.com/woothemes/FlexSlider/issues/1043
7
+ */
8
+ ;
9
+ (function ($) {
10
+
11
+ //FlexSlider: Object Instance
12
+ $.flexslider = function(el, options) {
13
+ var slider = $(el);
14
+
15
+ // making variables public
16
+ slider.vars = $.extend({}, $.flexslider.defaults, options);
17
+
18
+ var namespace = slider.vars.namespace,
19
+ msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
20
+ touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
21
+ // depricating this idea, as devices are being released with both of these events
22
+ //eventType = (touch) ? "touchend" : "click",
23
+ eventType = "click touchend MSPointerUp",
24
+ watchedEvent = "",
25
+ watchedEventClearTimer,
26
+ vertical = slider.vars.direction === "vertical",
27
+ reverse = slider.vars.reverse,
28
+ carousel = (slider.vars.itemWidth > 0),
29
+ fade = slider.vars.animation === "fade",
30
+ asNav = slider.vars.asNavFor !== "",
31
+ methods = {},
32
+ focused = true;
33
+
34
+ // Store a reference to the slider object
35
+ $.data(el, "flexslider", slider);
36
+
37
+ // Private slider methods
38
+ methods = {
39
+ init: function() {
40
+ slider.animating = false;
41
+ // Get current slide and make sure it is a number
42
+ slider.currentSlide = parseInt( ( slider.vars.startAt ? slider.vars.startAt : 0), 10 );
43
+ if ( isNaN( slider.currentSlide ) ) slider.currentSlide = 0;
44
+ slider.animatingTo = slider.currentSlide;
45
+ slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
46
+ slider.containerSelector = slider.vars.selector.substr(0,slider.vars.selector.search(' '));
47
+ slider.slides = $(slider.vars.selector, slider);
48
+ slider.container = $(slider.containerSelector, slider);
49
+ slider.count = slider.slides.length;
50
+ // SYNC:
51
+ slider.syncExists = $(slider.vars.sync).length > 0;
52
+ // SLIDE:
53
+ if (slider.vars.animation === "slide") slider.vars.animation = "swing";
54
+ slider.prop = (vertical) ? "top" : "marginLeft";
55
+ slider.args = {};
56
+ // SLIDESHOW:
57
+ slider.manualPause = false;
58
+ slider.stopped = false;
59
+ //PAUSE WHEN INVISIBLE
60
+ slider.started = false;
61
+ slider.startTimeout = null;
62
+ // TOUCH/USECSS:
63
+ slider.transitions = !slider.vars.video && !fade && slider.vars.useCSS && (function() {
64
+ var obj = document.createElement('div'),
65
+ props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
66
+ for (var i in props) {
67
+ if ( obj.style[ props[i] ] !== undefined ) {
68
+ slider.pfx = props[i].replace('Perspective','').toLowerCase();
69
+ slider.prop = "-" + slider.pfx + "-transform";
70
+ return true;
71
+ }
72
+ }
73
+ return false;
74
+ }());
75
+ slider.ensureAnimationEnd = '';
76
+ // CONTROLSCONTAINER:
77
+ if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer);
78
+ // MANUAL:
79
+ if (slider.vars.manualControls !== "") slider.manualControls = $(slider.vars.manualControls).length > 0 && $(slider.vars.manualControls);
80
+
81
+ // RANDOMIZE:
82
+ if (slider.vars.randomize) {
83
+ slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
84
+ slider.container.empty().append(slider.slides);
85
+ }
86
+
87
+ slider.doMath();
88
+
89
+ // INIT
90
+ slider.setup("init");
91
+
92
+ // CONTROLNAV:
93
+ if (slider.vars.controlNav) methods.controlNav.setup();
94
+
95
+ // DIRECTIONNAV:
96
+ if (slider.vars.directionNav) methods.directionNav.setup();
97
+
98
+ // KEYBOARD:
99
+ if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) {
100
+ $(document).bind('keyup', function(event) {
101
+ var keycode = event.keyCode;
102
+ if (!slider.animating && (keycode === 39 || keycode === 37)) {
103
+ var target = (keycode === 39) ? slider.getTarget('next') :
104
+ (keycode === 37) ? slider.getTarget('prev') : false;
105
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
106
+ }
107
+ });
108
+ }
109
+ // MOUSEWHEEL:
110
+ if (slider.vars.mousewheel) {
111
+ slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
112
+ event.preventDefault();
113
+ var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
114
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
115
+ });
116
+ }
117
+
118
+ // PAUSEPLAY
119
+ if (slider.vars.pausePlay) methods.pausePlay.setup();
120
+
121
+ //PAUSE WHEN INVISIBLE
122
+ if (slider.vars.slideshow && slider.vars.pauseInvisible) methods.pauseInvisible.init();
123
+
124
+ // SLIDSESHOW
125
+ if (slider.vars.slideshow) {
126
+ if (slider.vars.pauseOnHover) {
127
+ slider.hover(function() {
128
+ if (!slider.manualPlay && !slider.manualPause) slider.pause();
129
+ }, function() {
130
+ if (!slider.manualPause && !slider.manualPlay && !slider.stopped) slider.play();
131
+ });
132
+ }
133
+ // initialize animation
134
+ //If we're visible, or we don't use PageVisibility API
135
+ if(!slider.vars.pauseInvisible || !methods.pauseInvisible.isHidden()) {
136
+ (slider.vars.initDelay > 0) ? slider.startTimeout = setTimeout(slider.play, slider.vars.initDelay) : slider.play();
137
+ }
138
+ }
139
+
140
+ // ASNAV:
141
+ if (asNav) methods.asNav.setup();
142
+
143
+ // TOUCH
144
+ if (touch && slider.vars.touch) methods.touch();
145
+
146
+ // FADE&&SMOOTHHEIGHT || SLIDE:
147
+ if (!fade || (fade && slider.vars.smoothHeight)) $(window).bind("resize orientationchange focus", methods.resize);
148
+
149
+ slider.find("img").attr("draggable", "false");
150
+
151
+ // API: start() Callback
152
+ setTimeout(function(){
153
+ slider.vars.start(slider);
154
+ }, 200);
155
+ },
156
+ asNav: {
157
+ setup: function() {
158
+ slider.asNav = true;
159
+ slider.animatingTo = Math.floor(slider.currentSlide/slider.move);
160
+ slider.currentItem = slider.currentSlide;
161
+ slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
162
+ if(!msGesture){
163
+ slider.slides.on(eventType, function(e){
164
+ e.preventDefault();
165
+ var $slide = $(this),
166
+ target = $slide.index();
167
+ var posFromLeft = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container
168
+ if( posFromLeft <= 0 && $slide.hasClass( namespace + 'active-slide' ) ) {
169
+ slider.flexAnimate(slider.getTarget("prev"), true);
170
+ } else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) {
171
+ slider.direction = (slider.currentItem < target) ? "next" : "prev";
172
+ slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
173
+ }
174
+ });
175
+ }else{
176
+ el._slider = slider;
177
+ slider.slides.each(function (){
178
+ var that = this;
179
+ that._gesture = new MSGesture();
180
+ that._gesture.target = that;
181
+ that.addEventListener("MSPointerDown", function (e){
182
+ e.preventDefault();
183
+ if(e.currentTarget._gesture)
184
+ e.currentTarget._gesture.addPointer(e.pointerId);
185
+ }, false);
186
+ that.addEventListener("MSGestureTap", function (e){
187
+ e.preventDefault();
188
+ var $slide = $(this),
189
+ target = $slide.index();
190
+ if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
191
+ slider.direction = (slider.currentItem < target) ? "next" : "prev";
192
+ slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
193
+ }
194
+ });
195
+ });
196
+ }
197
+ }
198
+ },
199
+ controlNav: {
200
+ setup: function() {
201
+ if (!slider.manualControls) {
202
+ methods.controlNav.setupPaging();
203
+ } else { // MANUALCONTROLS:
204
+ methods.controlNav.setupManual();
205
+ }
206
+ },
207
+ setupPaging: function() {
208
+ var type = (slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
209
+ j = 1,
210
+ item,
211
+ slide;
212
+
213
+ slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>');
214
+
215
+ if (slider.pagingCount > 1) {
216
+ for (var i = 0; i < slider.pagingCount; i++) {
217
+ slide = slider.slides.eq(i);
218
+ item = (slider.vars.controlNav === "thumbnails") ? '<img src="' + slide.attr( 'data-thumb' ) + '"/>' : '<a>' + j + '</a>';
219
+ if ( 'thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions ) {
220
+ var captn = slide.attr( 'data-thumbcaption' );
221
+ if ( '' != captn && undefined != captn ) item += '<span class="' + namespace + 'caption">' + captn + '</span>';
222
+ }
223
+ slider.controlNavScaffold.append('<li>' + item + '</li>');
224
+ j++;
225
+ }
226
+ }
227
+
228
+ // CONTROLSCONTAINER:
229
+ (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
230
+ methods.controlNav.set();
231
+
232
+ methods.controlNav.active();
233
+
234
+ slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
235
+ event.preventDefault();
236
+
237
+ if (watchedEvent === "" || watchedEvent === event.type) {
238
+ var $this = $(this),
239
+ target = slider.controlNav.index($this);
240
+
241
+ if (!$this.hasClass(namespace + 'active')) {
242
+ slider.direction = (target > slider.currentSlide) ? "next" : "prev";
243
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
244
+ }
245
+ }
246
+
247
+ // setup flags to prevent event duplication
248
+ if (watchedEvent === "") {
249
+ watchedEvent = event.type;
250
+ }
251
+ methods.setToClearWatchedEvent();
252
+
253
+ });
254
+ },
255
+ setupManual: function() {
256
+ slider.controlNav = slider.manualControls;
257
+ methods.controlNav.active();
258
+
259
+ slider.controlNav.bind(eventType, function(event) {
260
+ event.preventDefault();
261
+
262
+ if (watchedEvent === "" || watchedEvent === event.type) {
263
+ var $this = $(this),
264
+ target = slider.controlNav.index($this);
265
+
266
+ if (!$this.hasClass(namespace + 'active')) {
267
+ (target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
268
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
269
+ }
270
+ }
271
+
272
+ // setup flags to prevent event duplication
273
+ if (watchedEvent === "") {
274
+ watchedEvent = event.type;
275
+ }
276
+ methods.setToClearWatchedEvent();
277
+ });
278
+ },
279
+ set: function() {
280
+ var selector = (slider.vars.controlNav === "thumbnails") ? 'img' : 'a';
281
+ slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
282
+ },
283
+ active: function() {
284
+ slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
285
+ },
286
+ update: function(action, pos) {
287
+ if (slider.pagingCount > 1 && action === "add") {
288
+ slider.controlNavScaffold.append($('<li><a>' + slider.count + '</a></li>'));
289
+ } else if (slider.pagingCount === 1) {
290
+ slider.controlNavScaffold.find('li').remove();
291
+ } else {
292
+ slider.controlNav.eq(pos).closest('li').remove();
293
+ }
294
+ methods.controlNav.set();
295
+ (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
296
+ }
297
+ },
298
+ directionNav: {
299
+ setup: function() {
300
+ var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li><a class="' + namespace + 'prev" href="#">' + slider.vars.prevText + '</a></li><li><a class="' + namespace + 'next" href="#">' + slider.vars.nextText + '</a></li></ul>');
301
+
302
+ // CONTROLSCONTAINER:
303
+ if (slider.controlsContainer) {
304
+ $(slider.controlsContainer).append(directionNavScaffold);
305
+ slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
306
+ } else {
307
+ slider.append(directionNavScaffold);
308
+ slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
309
+ }
310
+
311
+ methods.directionNav.update();
312
+
313
+ slider.directionNav.bind(eventType, function(event) {
314
+ event.preventDefault();
315
+ var target;
316
+
317
+ if (watchedEvent === "" || watchedEvent === event.type) {
318
+ target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
319
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
320
+ }
321
+
322
+ // setup flags to prevent event duplication
323
+ if (watchedEvent === "") {
324
+ watchedEvent = event.type;
325
+ }
326
+ methods.setToClearWatchedEvent();
327
+ });
328
+ },
329
+ update: function() {
330
+ var disabledClass = namespace + 'disabled';
331
+ if (slider.pagingCount === 1) {
332
+ slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
333
+ } else if (!slider.vars.animationLoop) {
334
+ if (slider.animatingTo === 0) {
335
+ slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass).attr('tabindex', '-1');
336
+ } else if (slider.animatingTo === slider.last) {
337
+ slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
338
+ } else {
339
+ slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
340
+ }
341
+ } else {
342
+ slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
343
+ }
344
+ }
345
+ },
346
+ pausePlay: {
347
+ setup: function() {
348
+ var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a></a></div>');
349
+
350
+ // CONTROLSCONTAINER:
351
+ if (slider.controlsContainer) {
352
+ slider.controlsContainer.append(pausePlayScaffold);
353
+ slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
354
+ } else {
355
+ slider.append(pausePlayScaffold);
356
+ slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
357
+ }
358
+
359
+ methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play');
360
+
361
+ slider.pausePlay.bind(eventType, function(event) {
362
+ event.preventDefault();
363
+
364
+ if (watchedEvent === "" || watchedEvent === event.type) {
365
+ if ($(this).hasClass(namespace + 'pause')) {
366
+ slider.manualPause = true;
367
+ slider.manualPlay = false;
368
+ slider.pause();
369
+ } else {
370
+ slider.manualPause = false;
371
+ slider.manualPlay = true;
372
+ slider.play();
373
+ }
374
+ }
375
+
376
+ // setup flags to prevent event duplication
377
+ if (watchedEvent === "") {
378
+ watchedEvent = event.type;
379
+ }
380
+ methods.setToClearWatchedEvent();
381
+ });
382
+ },
383
+ update: function(state) {
384
+ (state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').html(slider.vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').html(slider.vars.pauseText);
385
+ }
386
+ },
387
+ touch: function() {
388
+ var startX,
389
+ startY,
390
+ offset,
391
+ cwidth,
392
+ dx,
393
+ startT,
394
+ scrolling = false,
395
+ localX = 0,
396
+ localY = 0,
397
+ accDx = 0;
398
+
399
+ if(!msGesture){
400
+ el.addEventListener('touchstart', onTouchStart, false);
401
+
402
+ function onTouchStart(e) {
403
+ if (slider.animating) {
404
+ e.preventDefault();
405
+ } else if ( ( window.navigator.msPointerEnabled ) || e.touches.length === 1 ) {
406
+ slider.pause();
407
+ // CAROUSEL:
408
+ cwidth = (vertical) ? slider.h : slider. w;
409
+ startT = Number(new Date());
410
+ // CAROUSEL:
411
+
412
+ // Local vars for X and Y points.
413
+ localX = e.touches[0].pageX;
414
+ localY = e.touches[0].pageY;
415
+
416
+ offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
417
+ (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
418
+ (carousel && slider.currentSlide === slider.last) ? slider.limit :
419
+ (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
420
+ (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
421
+ startX = (vertical) ? localY : localX;
422
+ startY = (vertical) ? localX : localY;
423
+
424
+ el.addEventListener('touchmove', onTouchMove, false);
425
+ el.addEventListener('touchend', onTouchEnd, false);
426
+ }
427
+ }
428
+
429
+ function onTouchMove(e) {
430
+ // Local vars for X and Y points.
431
+
432
+ localX = e.touches[0].pageX;
433
+ localY = e.touches[0].pageY;
434
+
435
+ dx = (vertical) ? startX - localY : startX - localX;
436
+ scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY));
437
+
438
+ var fxms = 500;
439
+
440
+ if ( ! scrolling || Number( new Date() ) - startT > fxms ) {
441
+ e.preventDefault();
442
+ if (!fade && slider.transitions) {
443
+ if (!slider.vars.animationLoop) {
444
+ dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
445
+ }
446
+ slider.setProps(offset + dx, "setTouch");
447
+ }
448
+ }
449
+ }
450
+
451
+ function onTouchEnd(e) {
452
+ // finish the touch by undoing the touch session
453
+ el.removeEventListener('touchmove', onTouchMove, false);
454
+
455
+ if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
456
+ var updateDx = (reverse) ? -dx : dx,
457
+ target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
458
+
459
+ if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
460
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
461
+ } else {
462
+ if (!fade) slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true);
463
+ }
464
+ }
465
+ el.removeEventListener('touchend', onTouchEnd, false);
466
+
467
+ startX = null;
468
+ startY = null;
469
+ dx = null;
470
+ offset = null;
471
+ }
472
+ }else{
473
+ el.style.msTouchAction = "none";
474
+ el._gesture = new MSGesture();
475
+ el._gesture.target = el;
476
+ el.addEventListener("MSPointerDown", onMSPointerDown, false);
477
+ el._slider = slider;
478
+ el.addEventListener("MSGestureChange", onMSGestureChange, false);
479
+ el.addEventListener("MSGestureEnd", onMSGestureEnd, false);
480
+
481
+ function onMSPointerDown(e){
482
+ e.stopPropagation();
483
+ if (slider.animating) {
484
+ e.preventDefault();
485
+ }else{
486
+ slider.pause();
487
+ el._gesture.addPointer(e.pointerId);
488
+ accDx = 0;
489
+ cwidth = (vertical) ? slider.h : slider. w;
490
+ startT = Number(new Date());
491
+ // CAROUSEL:
492
+
493
+ offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
494
+ (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
495
+ (carousel && slider.currentSlide === slider.last) ? slider.limit :
496
+ (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
497
+ (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
498
+ }
499
+ }
500
+
501
+ function onMSGestureChange(e) {
502
+ e.stopPropagation();
503
+ var slider = e.target._slider;
504
+ if(!slider){
505
+ return;
506
+ }
507
+ var transX = -e.translationX,
508
+ transY = -e.translationY;
509
+
510
+ //Accumulate translations.
511
+ accDx = accDx + ((vertical) ? transY : transX);
512
+ dx = accDx;
513
+ scrolling = (vertical) ? (Math.abs(accDx) < Math.abs(-transX)) : (Math.abs(accDx) < Math.abs(-transY));
514
+
515
+ if(e.detail === e.MSGESTURE_FLAG_INERTIA){
516
+ setImmediate(function (){
517
+ el._gesture.stop();
518
+ });
519
+
520
+ return;
521
+ }
522
+
523
+ if (!scrolling || Number(new Date()) - startT > 500) {
524
+ e.preventDefault();
525
+ if (!fade && slider.transitions) {
526
+ if (!slider.vars.animationLoop) {
527
+ dx = accDx / ((slider.currentSlide === 0 && accDx < 0 || slider.currentSlide === slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1);
528
+ }
529
+ slider.setProps(offset + dx, "setTouch");
530
+ }
531
+ }
532
+ }
533
+
534
+ function onMSGestureEnd(e) {
535
+ e.stopPropagation();
536
+ var slider = e.target._slider;
537
+ if(!slider){
538
+ return;
539
+ }
540
+ if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
541
+ var updateDx = (reverse) ? -dx : dx,
542
+ target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
543
+
544
+ if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
545
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
546
+ } else {
547
+ if (!fade) slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true);
548
+ }
549
+ }
550
+
551
+ startX = null;
552
+ startY = null;
553
+ dx = null;
554
+ offset = null;
555
+ accDx = 0;
556
+ }
557
+ }
558
+ },
559
+ resize: function() {
560
+ if (!slider.animating && slider.is(':visible')) {
561
+ if (!carousel) slider.doMath();
562
+
563
+ if (fade) {
564
+ // SMOOTH HEIGHT:
565
+ methods.smoothHeight();
566
+ } else if (carousel) { //CAROUSEL:
567
+ slider.slides.width(slider.computedW);
568
+ slider.update(slider.pagingCount);
569
+ slider.setProps();
570
+ }
571
+ else if (vertical) { //VERTICAL:
572
+ slider.viewport.height(slider.h);
573
+ slider.setProps(slider.h, "setTotal");
574
+ } else {
575
+ // SMOOTH HEIGHT:
576
+ if (slider.vars.smoothHeight) methods.smoothHeight();
577
+ slider.newSlides.width(slider.computedW);
578
+ slider.setProps(slider.computedW, "setTotal");
579
+ }
580
+ }
581
+ },
582
+ smoothHeight: function(dur) {
583
+ if (!vertical || fade) {
584
+ var $obj = (fade) ? slider : slider.viewport;
585
+ (dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).height()}, dur) : $obj.height(slider.slides.eq(slider.animatingTo).height());
586
+ }
587
+ },
588
+ sync: function(action) {
589
+ var $obj = $(slider.vars.sync).data("flexslider"),
590
+ target = slider.animatingTo;
591
+
592
+ switch (action) {
593
+ case "animate": $obj.flexAnimate(target, slider.vars.pauseOnAction, false, true); break;
594
+ case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
595
+ case "pause": $obj.pause(); break;
596
+ }
597
+ },
598
+ uniqueID: function($clone) {
599
+ $clone.find( '[id]' ).each(function() {
600
+ var $this = $(this);
601
+ $this.attr( 'id', $this.attr( 'id' ) + '_clone' );
602
+ });
603
+ return $clone;
604
+ },
605
+ pauseInvisible: {
606
+ visProp: null,
607
+ init: function() {
608
+ var prefixes = ['webkit','moz','ms','o'];
609
+
610
+ if ('hidden' in document) return 'hidden';
611
+ for (var i = 0; i < prefixes.length; i++) {
612
+ if ((prefixes[i] + 'Hidden') in document)
613
+ methods.pauseInvisible.visProp = prefixes[i] + 'Hidden';
614
+ }
615
+ if (methods.pauseInvisible.visProp) {
616
+ var evtname = methods.pauseInvisible.visProp.replace(/[H|h]idden/,'') + 'visibilitychange';
617
+ document.addEventListener(evtname, function() {
618
+ if (methods.pauseInvisible.isHidden()) {
619
+ if(slider.startTimeout) clearTimeout(slider.startTimeout); //If clock is ticking, stop timer and prevent from starting while invisible
620
+ else slider.pause(); //Or just pause
621
+ }
622
+ else {
623
+ if(slider.started) slider.play(); //Initiated before, just play
624
+ else (slider.vars.initDelay > 0) ? setTimeout(slider.play, slider.vars.initDelay) : slider.play(); //Didn't init before: simply init or wait for it
625
+ }
626
+ });
627
+ }
628
+ },
629
+ isHidden: function() {
630
+ return document[methods.pauseInvisible.visProp] || false;
631
+ }
632
+ },
633
+ setToClearWatchedEvent: function() {
634
+ clearTimeout(watchedEventClearTimer);
635
+ watchedEventClearTimer = setTimeout(function() {
636
+ watchedEvent = "";
637
+ }, 3000);
638
+ }
639
+ };
640
+
641
+ // public methods
642
+ slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
643
+ if (!slider.vars.animationLoop && target !== slider.currentSlide) {
644
+ slider.direction = (target > slider.currentSlide) ? "next" : "prev";
645
+ }
646
+
647
+ if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
648
+
649
+ if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) {
650
+ if (asNav && withSync) {
651
+ var master = $(slider.vars.asNavFor).data('flexslider');
652
+ slider.atEnd = target === 0 || target === slider.count - 1;
653
+ master.flexAnimate(target, true, false, true, fromNav);
654
+ slider.direction = (slider.currentItem < target) ? "next" : "prev";
655
+ master.direction = slider.direction;
656
+
657
+ if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) {
658
+ slider.currentItem = target;
659
+ slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
660
+ target = Math.floor(target/slider.visible);
661
+ } else {
662
+ slider.currentItem = target;
663
+ slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
664
+ return false;
665
+ }
666
+ }
667
+
668
+ slider.animating = true;
669
+ slider.animatingTo = target;
670
+
671
+ // SLIDESHOW:
672
+ if (pause) slider.pause();
673
+
674
+ // API: before() animation Callback
675
+ slider.vars.before(slider);
676
+
677
+ // SYNC:
678
+ if (slider.syncExists && !fromNav) methods.sync("animate");
679
+
680
+ // CONTROLNAV
681
+ if (slider.vars.controlNav) methods.controlNav.active();
682
+
683
+ // !CAROUSEL:
684
+ // CANDIDATE: slide active class (for add/remove slide)
685
+ if (!carousel) slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide');
686
+
687
+ // INFINITE LOOP:
688
+ // CANDIDATE: atEnd
689
+ slider.atEnd = target === 0 || target === slider.last;
690
+
691
+ // DIRECTIONNAV:
692
+ if (slider.vars.directionNav) methods.directionNav.update();
693
+
694
+ if (target === slider.last) {
695
+ // API: end() of cycle Callback
696
+ slider.vars.end(slider);
697
+ // SLIDESHOW && !INFINITE LOOP:
698
+ if (!slider.vars.animationLoop) slider.pause();
699
+ }
700
+
701
+ // SLIDE:
702
+ if (!fade) {
703
+ var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
704
+ margin, slideString, calcNext;
705
+
706
+ // INFINITE LOOP / REVERSE:
707
+ if (carousel) {
708
+ //margin = (slider.vars.itemWidth > slider.w) ? slider.vars.itemMargin * 2 : slider.vars.itemMargin;
709
+ margin = slider.vars.itemMargin;
710
+ calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
711
+ slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
712
+ } else if (slider.currentSlide === 0 && target === slider.count - 1 && slider.vars.animationLoop && slider.direction !== "next") {
713
+ slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
714
+ } else if (slider.currentSlide === slider.last && target === 0 && slider.vars.animationLoop && slider.direction !== "prev") {
715
+ slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
716
+ } else {
717
+ slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
718
+ }
719
+ slider.setProps(slideString, "", slider.vars.animationSpeed);
720
+ if (slider.transitions) {
721
+ if (!slider.vars.animationLoop || !slider.atEnd) {
722
+ slider.animating = false;
723
+ slider.currentSlide = slider.animatingTo;
724
+ }
725
+
726
+ // Unbind previous transitionEnd events and re-bind new transitionEnd event
727
+ slider.container.unbind("webkitTransitionEnd transitionend");
728
+ slider.container.bind("webkitTransitionEnd transitionend", function() {
729
+ clearTimeout(slider.ensureAnimationEnd);
730
+ slider.wrapup(dimension);
731
+ });
732
+
733
+ // Insurance for the ever-so-fickle transitionEnd event
734
+ clearTimeout(slider.ensureAnimationEnd);
735
+ slider.ensureAnimationEnd = setTimeout(function() {
736
+ slider.wrapup(dimension);
737
+ }, slider.vars.animationSpeed + 100);
738
+
739
+ } else {
740
+ slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function(){
741
+ slider.wrapup(dimension);
742
+ });
743
+ }
744
+ } else { // FADE:
745
+ if (!touch) {
746
+ //slider.slides.eq(slider.currentSlide).fadeOut(slider.vars.animationSpeed, slider.vars.easing);
747
+ //slider.slides.eq(target).fadeIn(slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
748
+
749
+ slider.slides.eq(slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, slider.vars.animationSpeed, slider.vars.easing);
750
+ slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
751
+
752
+ } else {
753
+ slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
754
+ slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
755
+ slider.wrapup(dimension);
756
+ }
757
+ }
758
+ // SMOOTH HEIGHT:
759
+ if (slider.vars.smoothHeight) methods.smoothHeight(slider.vars.animationSpeed);
760
+ }
761
+ };
762
+ slider.wrapup = function(dimension) {
763
+ // SLIDE:
764
+ if (!fade && !carousel) {
765
+ if (slider.currentSlide === 0 && slider.animatingTo === slider.last && slider.vars.animationLoop) {
766
+ slider.setProps(dimension, "jumpEnd");
767
+ } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && slider.vars.animationLoop) {
768
+ slider.setProps(dimension, "jumpStart");
769
+ }
770
+ }
771
+ slider.animating = false;
772
+ slider.currentSlide = slider.animatingTo;
773
+ // API: after() animation Callback
774
+ slider.vars.after(slider);
775
+ };
776
+
777
+ // SLIDESHOW:
778
+ slider.animateSlides = function() {
779
+ if (!slider.animating && focused ) slider.flexAnimate(slider.getTarget("next"));
780
+ };
781
+ // SLIDESHOW:
782
+ slider.pause = function() {
783
+ clearInterval(slider.animatedSlides);
784
+ slider.animatedSlides = null;
785
+ slider.playing = false;
786
+ // PAUSEPLAY:
787
+ if (slider.vars.pausePlay) methods.pausePlay.update("play");
788
+ // SYNC:
789
+ if (slider.syncExists) methods.sync("pause");
790
+ };
791
+ // SLIDESHOW:
792
+ slider.play = function() {
793
+ if (slider.playing) clearInterval(slider.animatedSlides);
794
+ slider.animatedSlides = slider.animatedSlides || setInterval(slider.animateSlides, slider.vars.slideshowSpeed);
795
+ slider.started = slider.playing = true;
796
+ // PAUSEPLAY:
797
+ if (slider.vars.pausePlay) methods.pausePlay.update("pause");
798
+ // SYNC:
799
+ if (slider.syncExists) methods.sync("play");
800
+ };
801
+ // STOP:
802
+ slider.stop = function () {
803
+ slider.pause();
804
+ slider.stopped = true;
805
+ };
806
+ slider.canAdvance = function(target, fromNav) {
807
+ // ASNAV:
808
+ var last = (asNav) ? slider.pagingCount - 1 : slider.last;
809
+ return (fromNav) ? true :
810
+ (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
811
+ (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
812
+ (target === slider.currentSlide && !asNav) ? false :
813
+ (slider.vars.animationLoop) ? true :
814
+ (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
815
+ (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
816
+ true;
817
+ };
818
+ slider.getTarget = function(dir) {
819
+ slider.direction = dir;
820
+ if (dir === "next") {
821
+ return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
822
+ } else {
823
+ return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
824
+ }
825
+ };
826
+
827
+ // SLIDE:
828
+ slider.setProps = function(pos, special, dur) {
829
+ var target = (function() {
830
+ var posCheck = (pos) ? pos : ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo,
831
+ posCalc = (function() {
832
+ if (carousel) {
833
+ return (special === "setTouch") ? pos :
834
+ (reverse && slider.animatingTo === slider.last) ? 0 :
835
+ (reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
836
+ (slider.animatingTo === slider.last) ? slider.limit : posCheck;
837
+ } else {
838
+ switch (special) {
839
+ case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
840
+ case "setTouch": return (reverse) ? pos : pos;
841
+ case "jumpEnd": return (reverse) ? pos : slider.count * pos;
842
+ case "jumpStart": return (reverse) ? slider.count * pos : pos;
843
+ default: return pos;
844
+ }
845
+ }
846
+ }());
847
+
848
+ return (posCalc * -1) + "px";
849
+ }());
850
+
851
+ if (slider.transitions) {
852
+ target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
853
+ dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
854
+ slider.container.css("-" + slider.pfx + "-transition-duration", dur);
855
+ slider.container.css("transition-duration", dur);
856
+ }
857
+
858
+ slider.args[slider.prop] = target;
859
+ if (slider.transitions || dur === undefined) slider.container.css(slider.args);
860
+
861
+ slider.container.css('transform',target);
862
+ };
863
+
864
+ slider.setup = function(type) {
865
+ // SLIDE:
866
+ if (!fade) {
867
+ var sliderOffset, arr;
868
+
869
+ if (type === "init") {
870
+ slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container);
871
+ // INFINITE LOOP:
872
+ slider.cloneCount = 0;
873
+ slider.cloneOffset = 0;
874
+ // REVERSE:
875
+ if (reverse) {
876
+ arr = $.makeArray(slider.slides).reverse();
877
+ slider.slides = $(arr);
878
+ slider.container.empty().append(slider.slides);
879
+ }
880
+ }
881
+ // INFINITE LOOP && !CAROUSEL:
882
+ if (slider.vars.animationLoop && !carousel) {
883
+ slider.cloneCount = 2;
884
+ slider.cloneOffset = 1;
885
+ // clear out old clones
886
+ if (type !== "init") slider.container.find('.clone').remove();
887
+ // slider.container.append(slider.slides.first().clone().addClass('clone').attr('aria-hidden', 'true')).prepend(slider.slides.last().clone().addClass('clone').attr('aria-hidden', 'true'));
888
+ methods.uniqueID( slider.slides.first().clone().addClass('clone').attr('aria-hidden', 'true') ).appendTo( slider.container );
889
+ methods.uniqueID( slider.slides.last().clone().addClass('clone').attr('aria-hidden', 'true') ).prependTo( slider.container );
890
+ }
891
+ slider.newSlides = $(slider.vars.selector, slider);
892
+
893
+ sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
894
+ // VERTICAL:
895
+ if (vertical && !carousel) {
896
+ slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
897
+ setTimeout(function(){
898
+ slider.newSlides.css({"display": "block"});
899
+ slider.doMath();
900
+ slider.viewport.height(slider.h);
901
+ slider.setProps(sliderOffset * slider.h, "init");
902
+ }, (type === "init") ? 100 : 0);
903
+ } else {
904
+ slider.newSlides.css({"width": slider.computedW, "float": "left", "display": "block"});
905
+ slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
906
+ slider.setProps(sliderOffset * slider.computedW, "init");
907
+ setTimeout(function(){
908
+ slider.doMath();
909
+ slider.newSlides.css({"width": slider.computedW, "float": "left", "display": "block"});
910
+ // SMOOTH HEIGHT:
911
+ if (slider.vars.smoothHeight) methods.smoothHeight();
912
+ }, (type === "init") ? 100 : 0);
913
+ }
914
+ } else { // FADE:
915
+ slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
916
+ if (type === "init") {
917
+ if (!touch) {
918
+ //slider.slides.eq(slider.currentSlide).fadeIn(slider.vars.animationSpeed, slider.vars.easing);
919
+ slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},slider.vars.animationSpeed,slider.vars.easing);
920
+ } else {
921
+ slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + slider.vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
922
+ slider.slides.css("transition", "opacity " + slider.vars.animationSpeed / 1000 + "s ease");
923
+ }
924
+ }
925
+ // SMOOTH HEIGHT:
926
+ if (slider.vars.smoothHeight) methods.smoothHeight();
927
+ }
928
+ // !CAROUSEL:
929
+ // CANDIDATE: active slide
930
+ if (!carousel) slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide");
931
+
932
+ //FlexSlider: init() Callback
933
+ slider.vars.init(slider);
934
+ };
935
+
936
+ slider.doMath = function() {
937
+ var slide = slider.slides.first(),
938
+ slideMargin = slider.vars.itemMargin,
939
+ minItems = slider.vars.minItems,
940
+ maxItems = slider.vars.maxItems;
941
+
942
+ slider.w = (slider.viewport===undefined) ? slider.width() : slider.viewport.width();
943
+ slider.h = slide.height();
944
+ slider.boxPadding = slide.outerWidth() - slide.width();
945
+
946
+ // CAROUSEL:
947
+ if (carousel) {
948
+ slider.itemT = slider.vars.itemWidth + slideMargin;
949
+ slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
950
+ slider.maxW = (maxItems) ? (maxItems * slider.itemT) - slideMargin : slider.w;
951
+ slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * (minItems - 1)))/minItems :
952
+ (slider.maxW < slider.w) ? (slider.w - (slideMargin * (maxItems - 1)))/maxItems :
953
+ (slider.vars.itemWidth > slider.w) ? slider.w : slider.vars.itemWidth;
954
+
955
+ slider.visible = Math.floor(slider.w/(slider.itemW));
956
+ slider.move = (slider.vars.move > 0 && slider.vars.move < slider.visible ) ? slider.vars.move : slider.visible;
957
+ slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
958
+ slider.last = slider.pagingCount - 1;
959
+ slider.limit = (slider.pagingCount === 1) ? 0 :
960
+ (slider.vars.itemWidth > slider.w) ? (slider.itemW * (slider.count - 1)) + (slideMargin * (slider.count - 1)) : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
961
+ } else {
962
+ slider.itemW = slider.w;
963
+ slider.pagingCount = slider.count;
964
+ slider.last = slider.count - 1;
965
+ }
966
+ slider.computedW = slider.itemW - slider.boxPadding;
967
+ };
968
+
969
+ slider.update = function(pos, action) {
970
+ slider.doMath();
971
+
972
+ // update currentSlide and slider.animatingTo if necessary
973
+ if (!carousel) {
974
+ if (pos < slider.currentSlide) {
975
+ slider.currentSlide += 1;
976
+ } else if (pos <= slider.currentSlide && pos !== 0) {
977
+ slider.currentSlide -= 1;
978
+ }
979
+ slider.animatingTo = slider.currentSlide;
980
+ }
981
+
982
+ // update controlNav
983
+ if (slider.vars.controlNav && !slider.manualControls) {
984
+ if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
985
+ methods.controlNav.update("add");
986
+ } else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
987
+ if (carousel && slider.currentSlide > slider.last) {
988
+ slider.currentSlide -= 1;
989
+ slider.animatingTo -= 1;
990
+ }
991
+ methods.controlNav.update("remove", slider.last);
992
+ }
993
+ }
994
+ // update directionNav
995
+ if (slider.vars.directionNav) methods.directionNav.update();
996
+
997
+ };
998
+
999
+ slider.addSlide = function(obj, pos) {
1000
+ var $obj = $(obj);
1001
+
1002
+ slider.count += 1;
1003
+ slider.last = slider.count - 1;
1004
+
1005
+ // append new slide
1006
+ if (vertical && reverse) {
1007
+ (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
1008
+ } else {
1009
+ (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
1010
+ }
1011
+
1012
+ // update currentSlide, animatingTo, controlNav, and directionNav
1013
+ slider.update(pos, "add");
1014
+
1015
+ // update slider.slides
1016
+ slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
1017
+ // re-setup the slider to accomdate new slide
1018
+ slider.setup();
1019
+
1020
+ //FlexSlider: added() Callback
1021
+ slider.vars.added(slider);
1022
+ };
1023
+ slider.removeSlide = function(obj) {
1024
+ var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
1025
+
1026
+ // update count
1027
+ slider.count -= 1;
1028
+ slider.last = slider.count - 1;
1029
+
1030
+ // remove slide
1031
+ if (isNaN(obj)) {
1032
+ $(obj, slider.slides).remove();
1033
+ } else {
1034
+ (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
1035
+ }
1036
+
1037
+ // update currentSlide, animatingTo, controlNav, and directionNav
1038
+ slider.doMath();
1039
+ slider.update(pos, "remove");
1040
+
1041
+ // update slider.slides
1042
+ slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
1043
+ // re-setup the slider to accomdate new slide
1044
+ slider.setup();
1045
+
1046
+ // FlexSlider: removed() Callback
1047
+ slider.vars.removed(slider);
1048
+ };
1049
+
1050
+ //FlexSlider: Initialize
1051
+ methods.init();
1052
+ };
1053
+
1054
+ // Ensure the slider isn't focussed if the window loses focus.
1055
+ $( window ).blur( function ( e ) {
1056
+ focused = false;
1057
+ }).focus( function ( e ) {
1058
+ focused = true;
1059
+ });
1060
+
1061
+ //FlexSlider: Default Settings
1062
+ $.flexslider.defaults = {
1063
+ namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin
1064
+ selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
1065
+ animation: "fade", //String: Select your animation type, "fade" or "slide"
1066
+ easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
1067
+ direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
1068
+ reverse: false, //{NEW} Boolean: Reverse the animation direction
1069
+ animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
1070
+ smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
1071
+ startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
1072
+ slideshow: true, //Boolean: Animate slider automatically
1073
+ slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
1074
+ animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds
1075
+ initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds
1076
+ randomize: false, //Boolean: Randomize slide order
1077
+ thumbCaptions: false, //Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav.
1078
+
1079
+ // Usability features
1080
+ pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
1081
+ pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
1082
+ pauseInvisible: true, //{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
1083
+ useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available
1084
+ touch: true, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
1085
+ video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
1086
+
1087
+ // Primary Controls
1088
+ controlNav: true, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
1089
+ directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)
1090
+ prevText: "Previous", //String: Set the text for the "previous" directionNav item
1091
+ nextText: "Next", //String: Set the text for the "next" directionNav item
1092
+
1093
+ // Secondary Navigation
1094
+ keyboard: true, //Boolean: Allow slider navigating via keyboard left/right keys
1095
+ multipleKeyboard: false, //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
1096
+ mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
1097
+ pausePlay: false, //Boolean: Create pause/play dynamic element
1098
+ pauseText: "Pause", //String: Set the text for the "pause" pausePlay item
1099
+ playText: "Play", //String: Set the text for the "play" pausePlay item
1100
+
1101
+ // Special properties
1102
+ controlsContainer: "", //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found.
1103
+ manualControls: "", //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
1104
+ sync: "", //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
1105
+ asNavFor: "", //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
1106
+
1107
+ // Carousel Options
1108
+ itemWidth: 0, //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
1109
+ itemMargin: 0, //{NEW} Integer: Margin between carousel items.
1110
+ minItems: 1, //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
1111
+ maxItems: 0, //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
1112
+ move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
1113
+ allowOneSlide: true, //{NEW} Boolean: Whether or not to allow a slider comprised of a single slide
1114
+
1115
+ // Callback API
1116
+ start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide
1117
+ before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation
1118
+ after: function(){}, //Callback: function(slider) - Fires after each slider animation completes
1119
+ end: function(){}, //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
1120
+ added: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is added
1121
+ removed: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is removed
1122
+ init: function() {} //{NEW} Callback: function(slider) - Fires after the slider is initially setup
1123
+ };
1124
+
1125
+ //FlexSlider: Plugin Function
1126
+ $.fn.flexslider = function(options) {
1127
+ if (options === undefined) options = {};
1128
+
1129
+ if (typeof options === "object") {
1130
+ return this.each(function() {
1131
+ var $this = $(this),
1132
+ selector = (options.selector) ? options.selector : ".slides > li",
1133
+ $slides = $this.find(selector);
1134
+
1135
+ if ( ( $slides.length === 1 && options.allowOneSlide === true ) || $slides.length === 0 ) {
1136
+ $slides.fadeIn(400);
1137
+ if (options.start) options.start($this);
1138
+ } else if ($this.data('flexslider') === undefined) {
1139
+ new $.flexslider(this, options);
1140
+ }
1141
+ });
1142
+ } else {
1143
+ // Helper strings to quickly perform functions on the slider
1144
+ var $slider = $(this).data('flexslider');
1145
+ switch (options) {
1146
+ case "play": $slider.play(); break;
1147
+ case "pause": $slider.pause(); break;
1148
+ case "stop": $slider.stop(); break;
1149
+ case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
1150
+ case "prev":
1151
+ case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
1152
+ default: if (typeof options === "number") $slider.flexAnimate(options, true);
1153
+ }
1154
+ }
1155
+ };
1156
+ })(jQuery);
inc/metaslider.imagehelper.class.php CHANGED
@@ -16,16 +16,16 @@ class MetaSliderImageHelper {
16
  * Constructor
17
  *
18
  * @param integer $slide_id
19
- * @param integer $width - required width of image
20
- * @param integer $height - required height of image
21
- * @param string $smart_crop
22
  */
23
- public function __construct($slide_id, $width, $height, $smart_crop, $use_image_editor = true) {
24
  $upload_dir = wp_upload_dir();
25
 
26
  $this->id = $slide_id;
27
- $this->url = $upload_dir['baseurl'] . "/" . get_post_meta($slide_id, '_wp_attached_file', true);
28
- $this->path = get_attached_file($slide_id);
29
  $this->container_width = $width;
30
  $this->container_height = $height;
31
  $this->smart_crop = $smart_crop;
@@ -43,9 +43,9 @@ class MetaSliderImageHelper {
43
  * @param integer $image_height
44
  * @return array image dimensions
45
  */
46
- private function get_crop_dimensions($image_width, $image_height) {
47
- if ($this->smart_crop == 'false') {
48
- return array('width' => (int)$this->container_width, 'height' => (int)$this->container_height);
49
  }
50
 
51
  $container_width = $this->container_width;
@@ -54,17 +54,17 @@ class MetaSliderImageHelper {
54
  /**
55
  * Slideshow Width == Slide Width
56
  */
57
- if ($image_width == $container_width && $image_height == $container_height) {
58
  $new_slide_width = $container_width;
59
  $new_slide_height = $container_height;
60
  }
61
 
62
- if ($image_width == $container_width && $image_height < $container_height) {
63
  $new_slide_height = $image_height;
64
- $new_slide_width = $container_width / ($container_height / $image_height);
65
  }
66
 
67
- if ($image_width == $container_width && $image_height > $container_height) {
68
  $new_slide_width = $container_width;
69
  $new_slide_height = $container_height;
70
  }
@@ -72,85 +72,85 @@ class MetaSliderImageHelper {
72
  /**
73
  * Slideshow Width < Slide Width
74
  */
75
- if ($image_width < $container_width && $image_height == $container_height) {
76
  $new_slide_width = $image_width;
77
- $new_slide_height = $image_height / ($container_width / $image_width);
78
  }
79
 
80
  /**
81
  * Slide is smaller than slidehow - both width and height
82
  */
83
- if ($image_width < $container_width && $image_height < $container_height) {
84
- if ($container_width > $container_height) {
85
  // wide
86
 
87
- if ($image_width > $image_height) {
88
  // wide
89
  $new_slide_height = $image_height;
90
- $new_slide_width = $container_width / ($container_height / $image_height);
91
 
92
- if ($new_slide_width > $image_width) {
93
  $new_slide_width = $image_width;
94
- $new_slide_height = $container_height / ($container_width / $image_width);
95
  }
96
  } else {
97
  // tall
98
  $new_slide_width = $image_width;
99
- $new_slide_height = $container_height / ($container_width / $image_width);
100
 
101
- if ($new_slide_height > $image_height) {
102
  $new_slide_height = $image_height;
103
- $new_slide_width = $container_width / ($container_height / $image_height);
104
  }
105
  }
106
  } else {
107
  // tall
108
- if ($image_width > $image_height) {
109
  // wide
110
  $new_slide_height = $image_height;
111
- $new_slide_width = $container_width / ($container_height / $image_height);
112
 
113
- if ($new_slide_width > $image_width) {
114
  $new_slide_width = $image_width;
115
- $new_slide_height = $container_height / ($container_width / $image_width);
116
  }
117
  } else {
118
  // tall
119
  $new_slide_width = $image_width;
120
- $new_slide_height = $container_height / ($container_width / $image_width);
121
 
122
- if ($new_slide_height > $image_height) {
123
  $new_slide_height = $image_height;
124
- $new_slide_width = $container_width / ($container_height / $image_height);
125
  }
126
  }
127
  }
128
  }
129
 
130
- if ($image_width < $container_width && $image_height > $container_height) {
131
  $new_slide_width = $image_width;
132
- $new_slide_height = $container_height / ($container_width / $image_width);
133
  }
134
 
135
  /**
136
  * Slideshow Width > Slide Width
137
  */
138
- if ($image_width > $container_width && $image_height == $container_height) {
139
  $new_slide_width = $container_width;
140
  $new_slide_height = $container_height;
141
  }
142
 
143
- if ($image_width > $container_width && $image_height < $container_height) {
144
  $new_slide_height = $image_height;
145
- $new_slide_width = $container_width / ($container_height / $image_height);
146
  }
147
 
148
- if ($image_width > $container_width && $image_height > $container_height) {
149
  $new_slide_width = $container_width;
150
  $new_slide_height = $container_height;
151
  }
152
 
153
- return array('width' => floor($new_slide_width), 'height' => floor($new_slide_height));
154
  }
155
 
156
 
@@ -162,43 +162,43 @@ class MetaSliderImageHelper {
162
  */
163
  function get_image_url() {
164
  // Get the image file path
165
- if (!strlen($this->path)) {
166
- return apply_filters('metaslider_resized_image_url', $this->url, $this->url);
167
  }
168
 
169
  // get the full image size dimensions
170
  $orig_size = $this->get_original_image_dimensions();
171
 
172
  // bail out if we can't find the image dimensions, return the full URL
173
- if ($orig_size == false) {
174
- return apply_filters('metaslider_resized_image_url', $this->url, $this->url);
175
  }
176
 
177
  // get our crop dimensions (this is the size we want to display)
178
- $dest_size = $this->get_crop_dimensions($orig_size['width'], $orig_size['height']);
179
 
180
  // if the full size is the same as the required size, return the full URL
181
- if ($orig_size['width'] == $dest_size['width'] && $orig_size['height'] == $dest_size['height']) {
182
- return apply_filters('metaslider_resized_image_url', $this->url, $this->url);
183
  }
184
 
185
  // construct the file name
186
- $dest_file_name = $this->get_destination_file_name($dest_size);
187
 
188
- if (file_exists($dest_file_name)) {
189
  // good. no need for resize, just return the URL
190
- $dest_url = str_replace(basename($this->url), basename($dest_file_name), $this->url);
191
- }
192
- else if ($this->use_image_editor) {
193
- // resize, assuming we're allowed to use the image editor
194
- $dest_url = $this->resize_image($orig_size, $dest_size, $dest_file_name);
195
  }
 
 
 
 
196
  else {
197
  // fall back to the full URL
198
  $dest_url = $this->url;
199
  }
200
 
201
- $dest_url = apply_filters('metaslider_resized_image_url', $dest_url, $this->url);
202
 
203
  return $dest_url;
204
  }
@@ -214,17 +214,17 @@ class MetaSliderImageHelper {
214
  $size = array();
215
 
216
  // try and get the image size from metadata
217
- $meta = wp_get_attachment_metadata($this->id);
218
 
219
- if (isset($meta['width'], $meta['height'])) {
220
  return $meta;
221
  }
222
 
223
- if ($this->use_image_editor) {
224
  // get the size from the image itself
225
- $image = wp_get_image_editor($this->path);
226
 
227
- if (!is_wp_error($image)) {
228
  $size = $image->get_size();
229
  return $size;
230
  }
@@ -236,14 +236,14 @@ class MetaSliderImageHelper {
236
  /**
237
  * Return the file name for the required image size
238
  *
239
- * @param array $dest_size image dimensions (width/height) in pixels
240
  * @return string
241
  */
242
- private function get_destination_file_name($dest_size) {
243
- $info = pathinfo($this->path);
244
  $dir = $info['dirname'];
245
  $ext = $info['extension'];
246
- $name = wp_basename($this->path, ".$ext");
247
  $dest_file_name = "{$dir}/{$name}-{$dest_size['width']}x{$dest_size['height']}.{$ext}";
248
 
249
  return $dest_file_name;
@@ -252,17 +252,17 @@ class MetaSliderImageHelper {
252
  /**
253
  * Use WP_Image_Editor to create a resized image and return the URL for that image
254
  *
255
- * @param array $orig_size
256
- * @param array $dest_size
257
  * @return string
258
  */
259
- private function resize_image($orig_size, $dest_size, $dest_file_name) {
260
  // load image
261
- $image = wp_get_image_editor($this->path);
262
 
263
  // editor will return an error if the path is invalid
264
- if (is_wp_error($image)) {
265
- if (is_admin()) {
266
  echo '<div id="message" class="error">';
267
  echo "<p><strong>ERROR</strong> Slide ID: {$this->id} - <i>" . $image->get_error_message() . "</i></p>";
268
  echo "</div>";
@@ -271,33 +271,33 @@ class MetaSliderImageHelper {
271
  return $this->url;
272
  }
273
 
274
- $dims = image_resize_dimensions($orig_size['width'], $orig_size['height'], $dest_size['width'], $dest_size['height'], true);
275
 
276
- if ($dims) {
277
- list($dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) = $dims;
278
- $image->crop($src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h);
279
  }
280
 
281
- $saved = $image->save($dest_file_name);
282
 
283
- if (is_wp_error($saved)) {
284
  return $this->url;
285
  }
286
 
287
  // Record the new size so that the file is correctly removed when the media file is deleted.
288
- $backup_sizes = get_post_meta($this->id,'_wp_attachment_backup_sizes',true);
289
 
290
- if (!is_array($backup_sizes)) {
291
  $backup_sizes = array();
292
  }
293
 
294
  $backup_sizes["resized-{$dest_size['width']}x{$dest_size['height']}"] = $saved;
295
- update_post_meta($this->id,'_wp_attachment_backup_sizes', $backup_sizes);
296
 
297
- $url = str_replace(basename($this->url), basename($saved['path']), $this->url);
298
 
299
  return $url;
300
  }
301
  }
302
 
303
- ?>
16
  * Constructor
17
  *
18
  * @param integer $slide_id
19
+ * @param integer $width - required width of image
20
+ * @param integer $height - required height of image
21
+ * @param string $smart_crop
22
  */
23
+ public function __construct( $slide_id, $width, $height, $smart_crop, $use_image_editor = true ) {
24
  $upload_dir = wp_upload_dir();
25
 
26
  $this->id = $slide_id;
27
+ $this->url = $upload_dir['baseurl'] . "/" . get_post_meta( $slide_id, '_wp_attached_file', true );
28
+ $this->path = get_attached_file( $slide_id );
29
  $this->container_width = $width;
30
  $this->container_height = $height;
31
  $this->smart_crop = $smart_crop;
43
  * @param integer $image_height
44
  * @return array image dimensions
45
  */
46
+ private function get_crop_dimensions( $image_width, $image_height ) {
47
+ if ( $this->smart_crop == 'false' ) {
48
+ return array( 'width' => (int)$this->container_width, 'height' => (int)$this->container_height );
49
  }
50
 
51
  $container_width = $this->container_width;
54
  /**
55
  * Slideshow Width == Slide Width
56
  */
57
+ if ( $image_width == $container_width && $image_height == $container_height ) {
58
  $new_slide_width = $container_width;
59
  $new_slide_height = $container_height;
60
  }
61
 
62
+ if ( $image_width == $container_width && $image_height < $container_height ) {
63
  $new_slide_height = $image_height;
64
+ $new_slide_width = $container_width / ( $container_height / $image_height );
65
  }
66
 
67
+ if ( $image_width == $container_width && $image_height > $container_height ) {
68
  $new_slide_width = $container_width;
69
  $new_slide_height = $container_height;
70
  }
72
  /**
73
  * Slideshow Width < Slide Width
74
  */
75
+ if ( $image_width < $container_width && $image_height == $container_height ) {
76
  $new_slide_width = $image_width;
77
+ $new_slide_height = $image_height / ( $container_width / $image_width );
78
  }
79
 
80
  /**
81
  * Slide is smaller than slidehow - both width and height
82
  */
83
+ if ( $image_width < $container_width && $image_height < $container_height ) {
84
+ if ( $container_width > $container_height ) {
85
  // wide
86
 
87
+ if ( $image_width > $image_height ) {
88
  // wide
89
  $new_slide_height = $image_height;
90
+ $new_slide_width = $container_width / ( $container_height / $image_height );
91
 
92
+ if ( $new_slide_width > $image_width ) {
93
  $new_slide_width = $image_width;
94
+ $new_slide_height = $container_height / ( $container_width / $image_width );
95
  }
96
  } else {
97
  // tall
98
  $new_slide_width = $image_width;
99
+ $new_slide_height = $container_height / ( $container_width / $image_width );
100
 
101
+ if ( $new_slide_height > $image_height ) {
102
  $new_slide_height = $image_height;
103
+ $new_slide_width = $container_width / ( $container_height / $image_height );
104
  }
105
  }
106
  } else {
107
  // tall
108
+ if ( $image_width > $image_height ) {
109
  // wide
110
  $new_slide_height = $image_height;
111
+ $new_slide_width = $container_width / ( $container_height / $image_height );
112
 
113
+ if ( $new_slide_width > $image_width ) {
114
  $new_slide_width = $image_width;
115
+ $new_slide_height = $container_height / ( $container_width / $image_width );
116
  }
117
  } else {
118
  // tall
119
  $new_slide_width = $image_width;
120
+ $new_slide_height = $container_height / ( $container_width / $image_width );
121
 
122
+ if ( $new_slide_height > $image_height ) {
123
  $new_slide_height = $image_height;
124
+ $new_slide_width = $container_width / ( $container_height / $image_height );
125
  }
126
  }
127
  }
128
  }
129
 
130
+ if ( $image_width < $container_width && $image_height > $container_height ) {
131
  $new_slide_width = $image_width;
132
+ $new_slide_height = $container_height / ( $container_width / $image_width );
133
  }
134
 
135
  /**
136
  * Slideshow Width > Slide Width
137
  */
138
+ if ( $image_width > $container_width && $image_height == $container_height ) {
139
  $new_slide_width = $container_width;
140
  $new_slide_height = $container_height;
141
  }
142
 
143
+ if ( $image_width > $container_width && $image_height < $container_height ) {
144
  $new_slide_height = $image_height;
145
+ $new_slide_width = $container_width / ( $container_height / $image_height );
146
  }
147
 
148
+ if ( $image_width > $container_width && $image_height > $container_height ) {
149
  $new_slide_width = $container_width;
150
  $new_slide_height = $container_height;
151
  }
152
 
153
+ return array( 'width' => floor( $new_slide_width ), 'height' => floor( $new_slide_height ) );
154
  }
155
 
156
 
162
  */
163
  function get_image_url() {
164
  // Get the image file path
165
+ if ( !strlen( $this->path ) ) {
166
+ return apply_filters( 'metaslider_resized_image_url', $this->url, $this->url );
167
  }
168
 
169
  // get the full image size dimensions
170
  $orig_size = $this->get_original_image_dimensions();
171
 
172
  // bail out if we can't find the image dimensions, return the full URL
173
+ if ( $orig_size == false ) {
174
+ return apply_filters( 'metaslider_resized_image_url', $this->url, $this->url );
175
  }
176
 
177
  // get our crop dimensions (this is the size we want to display)
178
+ $dest_size = $this->get_crop_dimensions( $orig_size['width'], $orig_size['height'] );
179
 
180
  // if the full size is the same as the required size, return the full URL
181
+ if ( $orig_size['width'] == $dest_size['width'] && $orig_size['height'] == $dest_size['height'] ) {
182
+ return apply_filters( 'metaslider_resized_image_url', $this->url, $this->url );
183
  }
184
 
185
  // construct the file name
186
+ $dest_file_name = $this->get_destination_file_name( $dest_size );
187
 
188
+ if ( file_exists( $dest_file_name ) ) {
189
  // good. no need for resize, just return the URL
190
+ $dest_url = str_replace( basename( $this->url ), basename( $dest_file_name ), $this->url );
 
 
 
 
191
  }
192
+ else if ( $this->use_image_editor ) {
193
+ // resize, assuming we're allowed to use the image editor
194
+ $dest_url = $this->resize_image( $orig_size, $dest_size, $dest_file_name );
195
+ }
196
  else {
197
  // fall back to the full URL
198
  $dest_url = $this->url;
199
  }
200
 
201
+ $dest_url = apply_filters( 'metaslider_resized_image_url', $dest_url, $this->url );
202
 
203
  return $dest_url;
204
  }
214
  $size = array();
215
 
216
  // try and get the image size from metadata
217
+ $meta = wp_get_attachment_metadata( $this->id );
218
 
219
+ if ( isset( $meta['width'], $meta['height'] ) ) {
220
  return $meta;
221
  }
222
 
223
+ if ( $this->use_image_editor ) {
224
  // get the size from the image itself
225
+ $image = wp_get_image_editor( $this->path );
226
 
227
+ if ( !is_wp_error( $image ) ) {
228
  $size = $image->get_size();
229
  return $size;
230
  }
236
  /**
237
  * Return the file name for the required image size
238
  *
239
+ * @param array $dest_size image dimensions (width/height) in pixels
240
  * @return string
241
  */
242
+ private function get_destination_file_name( $dest_size ) {
243
+ $info = pathinfo( $this->path );
244
  $dir = $info['dirname'];
245
  $ext = $info['extension'];
246
+ $name = wp_basename( $this->path, ".$ext" );
247
  $dest_file_name = "{$dir}/{$name}-{$dest_size['width']}x{$dest_size['height']}.{$ext}";
248
 
249
  return $dest_file_name;
252
  /**
253
  * Use WP_Image_Editor to create a resized image and return the URL for that image
254
  *
255
+ * @param array $orig_size
256
+ * @param array $dest_size
257
  * @return string
258
  */
259
+ private function resize_image( $orig_size, $dest_size, $dest_file_name ) {
260
  // load image
261
+ $image = wp_get_image_editor( $this->path );
262
 
263
  // editor will return an error if the path is invalid
264
+ if ( is_wp_error( $image ) ) {
265
+ if ( is_admin() ) {
266
  echo '<div id="message" class="error">';
267
  echo "<p><strong>ERROR</strong> Slide ID: {$this->id} - <i>" . $image->get_error_message() . "</i></p>";
268
  echo "</div>";
271
  return $this->url;
272
  }
273
 
274
+ $dims = image_resize_dimensions( $orig_size['width'], $orig_size['height'], $dest_size['width'], $dest_size['height'], true );
275
 
276
+ if ( $dims ) {
277
+ list( $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ) = $dims;
278
+ $image->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h );
279
  }
280
 
281
+ $saved = $image->save( $dest_file_name );
282
 
283
+ if ( is_wp_error( $saved ) ) {
284
  return $this->url;
285
  }
286
 
287
  // Record the new size so that the file is correctly removed when the media file is deleted.
288
+ $backup_sizes = get_post_meta( $this->id, '_wp_attachment_backup_sizes', true );
289
 
290
+ if ( !is_array( $backup_sizes ) ) {
291
  $backup_sizes = array();
292
  }
293
 
294
  $backup_sizes["resized-{$dest_size['width']}x{$dest_size['height']}"] = $saved;
295
+ update_post_meta( $this->id, '_wp_attachment_backup_sizes', $backup_sizes );
296
 
297
+ $url = str_replace( basename( $this->url ), basename( $saved['path'] ), $this->url );
298
 
299
  return $url;
300
  }
301
  }
302
 
303
+ ?>
inc/metaslider.systemcheck.class.php CHANGED
@@ -10,7 +10,7 @@ class MetaSliderSystemCheck {
10
  * Constructor
11
  */
12
  public function __construct() {
13
- $this->options = get_site_option('metaslider_systemcheck');
14
  }
15
 
16
  /**
@@ -29,13 +29,13 @@ class MetaSliderSystemCheck {
29
  * Disable a message
30
  */
31
  private function dismissMessages() {
32
- if (isset($_REQUEST['dismissMessage']) && isset($_REQUEST['_wpnonce'])) {
33
  $nonce = $_REQUEST['_wpnonce'];
34
  $key = $_REQUEST['dismissMessage'];
35
 
36
- if (wp_verify_nonce($nonce, "metaslider-dismiss-{$key}")) {
37
  $this->options[$key] = false;
38
- update_site_option('metaslider_systemcheck', $this->options);
39
  }
40
  }
41
  }
@@ -44,20 +44,20 @@ class MetaSliderSystemCheck {
44
  * Update our stored messages
45
  */
46
  private function updateSystemCheck() {
47
- update_site_option('metaslider_systemcheck', $this->options);
48
  }
49
 
50
  /**
51
  * Check the WordPress version.
52
  */
53
  private function checkWordPressVersion() {
54
- if (isset($this->options['wordPressVersion']) && $this->options['wordPressVersion'] === false) {
55
  return;
56
  }
57
 
58
- if (!function_exists('wp_enqueue_media')) {
59
  $error = "Meta Slider requires WordPress 3.5 or above. Please upgrade your WordPress installation.";
60
- $this->printMessage($error, 'wordPressVersion');
61
  } else {
62
  $this->options['wordPressVersion'] = false;
63
  }
@@ -67,13 +67,13 @@ class MetaSliderSystemCheck {
67
  * Check GD or ImageMagick library exists
68
  */
69
  private function checkImageLibrary() {
70
- if (isset($this->options['imageLibrary']) && $this->options['imageLibrary'] === false) {
71
  return;
72
  }
73
 
74
- if ((!extension_loaded('gd') || !function_exists('gd_info')) && (!extension_loaded( 'imagick' ) || !class_exists( 'Imagick' ) || !class_exists( 'ImagickPixel' ))) {
75
  $error = "Meta Slider requires the GD or ImageMagick PHP extension. Please contact your hosting provider";
76
- $this->printMessage($error, 'imageLibrary');
77
  } else {
78
  $this->options['imageLibrary'] = false;
79
  }
@@ -83,17 +83,17 @@ class MetaSliderSystemCheck {
83
  * Detect the role scoper plugin
84
  */
85
  private function checkRoleScoper() {
86
- if (isset($this->options['roleScoper']) && $this->options['roleScoper'] === false) {
87
  return;
88
  }
89
 
90
- if (function_exists('is_plugin_active') && is_plugin_active('role-scoper/role-scoper.php')) {
91
 
92
- $access_types = get_option('scoper_disabled_access_types');
93
 
94
- if (isset($access_types['front']) && !$access_types['front']) {
95
  $error = 'Role Scoper Plugin Detected. Please go to Roles > Options. Click the Realm Tab, scroll down to "Access Types" and uncheck the "Viewing content (front-end)" setting.';
96
- $this->printMessage($error, 'roleScoper');
97
  }
98
  }
99
  }
@@ -107,46 +107,46 @@ class MetaSliderSystemCheck {
107
 
108
  $key = 'wpFooter:' . $theme_name;
109
 
110
- if (isset($this->options[$key]) && $this->options[$key] === false) {
111
  return;
112
  }
113
-
114
  $child_footer = get_stylesheet_directory() . '/footer.php';
115
  $parent_footer = TEMPLATEPATH . '/footer.php';
116
  $theme_type = 'parent';
117
 
118
- if (file_exists($child_footer)) {
119
  $theme_type = 'child';
120
- $footer_file = file_get_contents($child_footer);
121
 
122
- if (strpos($footer_file, 'wp_footer()')) {
123
  return;
124
  }
125
- } else if (file_exists($parent_footer . '/footer.php')) {
126
- $theme_type = 'parent';
127
- $footer_file = file_get_contents($parent_footer . '/footer.php');
128
 
129
- if (strpos($footer_file, 'wp_footer()')) {
130
- return;
 
131
  }
132
- }
133
 
134
- if ($theme_type == 'parent') {
135
  $file_path = $parent_footer;
136
  } else {
137
  $file_path = $child_footer;
138
  }
139
 
140
  $error = "Required call to wp_footer() not found in file <b>{$file_path}</b>. <br /><br />Please check the <a href='http://codex.wordpress.org/Function_Reference/wp_footer'>wp_footer()</a> documentation and make sure your theme has a call to wp_footer() just above the closing </body> tag.";
141
- $this->printMessage($error, $key);
142
  }
143
 
144
  /**
145
  * Print a warning message to the screen
146
  */
147
- private function printMessage($message, $key) {
148
  $nonce = wp_create_nonce( "metaslider-dismiss-{$key}" );
149
  echo "<div id='message' class='updated'><p><b>Warning:</b> {$message}<br /><br /><a class='button' href='?page=metaslider&dismissMessage={$key}&_wpnonce={$nonce}'>Hide</a></p></div>";
150
  }
151
  }
152
- ?>
10
  * Constructor
11
  */
12
  public function __construct() {
13
+ $this->options = get_site_option( 'metaslider_systemcheck' );
14
  }
15
 
16
  /**
29
  * Disable a message
30
  */
31
  private function dismissMessages() {
32
+ if ( isset( $_REQUEST['dismissMessage'] ) && isset( $_REQUEST['_wpnonce'] ) ) {
33
  $nonce = $_REQUEST['_wpnonce'];
34
  $key = $_REQUEST['dismissMessage'];
35
 
36
+ if ( wp_verify_nonce( $nonce, "metaslider-dismiss-{$key}" ) ) {
37
  $this->options[$key] = false;
38
+ update_site_option( 'metaslider_systemcheck', $this->options );
39
  }
40
  }
41
  }
44
  * Update our stored messages
45
  */
46
  private function updateSystemCheck() {
47
+ update_site_option( 'metaslider_systemcheck', $this->options );
48
  }
49
 
50
  /**
51
  * Check the WordPress version.
52
  */
53
  private function checkWordPressVersion() {
54
+ if ( isset( $this->options['wordPressVersion'] ) && $this->options['wordPressVersion'] === false ) {
55
  return;
56
  }
57
 
58
+ if ( !function_exists( 'wp_enqueue_media' ) ) {
59
  $error = "Meta Slider requires WordPress 3.5 or above. Please upgrade your WordPress installation.";
60
+ $this->printMessage( $error, 'wordPressVersion' );
61
  } else {
62
  $this->options['wordPressVersion'] = false;
63
  }
67
  * Check GD or ImageMagick library exists
68
  */
69
  private function checkImageLibrary() {
70
+ if ( isset( $this->options['imageLibrary'] ) && $this->options['imageLibrary'] === false ) {
71
  return;
72
  }
73
 
74
+ if ( ( !extension_loaded( 'gd' ) || !function_exists( 'gd_info' ) ) && ( !extension_loaded( 'imagick' ) || !class_exists( 'Imagick' ) || !class_exists( 'ImagickPixel' ) ) ) {
75
  $error = "Meta Slider requires the GD or ImageMagick PHP extension. Please contact your hosting provider";
76
+ $this->printMessage( $error, 'imageLibrary' );
77
  } else {
78
  $this->options['imageLibrary'] = false;
79
  }
83
  * Detect the role scoper plugin
84
  */
85
  private function checkRoleScoper() {
86
+ if ( isset( $this->options['roleScoper'] ) && $this->options['roleScoper'] === false ) {
87
  return;
88
  }
89
 
90
+ if ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'role-scoper/role-scoper.php' ) ) {
91
 
92
+ $access_types = get_option( 'scoper_disabled_access_types' );
93
 
94
+ if ( isset( $access_types['front'] ) && !$access_types['front'] ) {
95
  $error = 'Role Scoper Plugin Detected. Please go to Roles > Options. Click the Realm Tab, scroll down to "Access Types" and uncheck the "Viewing content (front-end)" setting.';
96
+ $this->printMessage( $error, 'roleScoper' );
97
  }
98
  }
99
  }
107
 
108
  $key = 'wpFooter:' . $theme_name;
109
 
110
+ if ( isset( $this->options[$key] ) && $this->options[$key] === false ) {
111
  return;
112
  }
113
+
114
  $child_footer = get_stylesheet_directory() . '/footer.php';
115
  $parent_footer = TEMPLATEPATH . '/footer.php';
116
  $theme_type = 'parent';
117
 
118
+ if ( file_exists( $child_footer ) ) {
119
  $theme_type = 'child';
120
+ $footer_file = file_get_contents( $child_footer );
121
 
122
+ if ( strpos( $footer_file, 'wp_footer()' ) ) {
123
  return;
124
  }
125
+ } else if ( file_exists( $parent_footer . '/footer.php' ) ) {
126
+ $theme_type = 'parent';
127
+ $footer_file = file_get_contents( $parent_footer . '/footer.php' );
128
 
129
+ if ( strpos( $footer_file, 'wp_footer()' ) ) {
130
+ return;
131
+ }
132
  }
 
133
 
134
+ if ( $theme_type == 'parent' ) {
135
  $file_path = $parent_footer;
136
  } else {
137
  $file_path = $child_footer;
138
  }
139
 
140
  $error = "Required call to wp_footer() not found in file <b>{$file_path}</b>. <br /><br />Please check the <a href='http://codex.wordpress.org/Function_Reference/wp_footer'>wp_footer()</a> documentation and make sure your theme has a call to wp_footer() just above the closing </body> tag.";
141
+ $this->printMessage( $error, $key );
142
  }
143
 
144
  /**
145
  * Print a warning message to the screen
146
  */
147
+ private function printMessage( $message, $key ) {
148
  $nonce = wp_create_nonce( "metaslider-dismiss-{$key}" );
149
  echo "<div id='message' class='updated'><p><b>Warning:</b> {$message}<br /><br /><a class='button' href='?page=metaslider&dismissMessage={$key}&_wpnonce={$nonce}'>Hide</a></p></div>";
150
  }
151
  }
152
+ ?>
inc/metaslider.widget.class.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
  /**
3
  * Adds Meta Slider widget.
4
  */
5
 
6
  // disable direct access
7
- if (!defined('ABSPATH')) exit;
8
 
9
  class MetaSlider_Widget extends WP_Widget {
10
 
@@ -13,9 +13,9 @@ class MetaSlider_Widget extends WP_Widget {
13
  */
14
  public function __construct() {
15
  parent::__construct(
16
- 'metaslider_widget', // Base ID
17
  'Meta Slider', // Name
18
- array( 'description' => __( 'Meta Slider', 'metaslider' ), ) // Args
19
  );
20
  }
21
 
@@ -24,13 +24,13 @@ class MetaSlider_Widget extends WP_Widget {
24
  *
25
  * @see WP_Widget::widget()
26
  *
27
- * @param array $args Widget arguments.
28
- * @param array $instance Saved values from database.
29
  */
30
  public function widget( $args, $instance ) {
31
- extract($args);
32
 
33
- if (isset($instance['slider_id'])) {
34
  $slider_id = $instance['slider_id'];
35
 
36
  $title = apply_filters( 'widget_title', $instance['title'] );
@@ -39,7 +39,7 @@ class MetaSlider_Widget extends WP_Widget {
39
  if ( ! empty( $title ) )
40
  echo $before_title . $title . $after_title;
41
 
42
- echo do_shortcode("[metaslider id={$slider_id}]");
43
  echo $after_widget;
44
  }
45
  }
@@ -49,8 +49,8 @@ class MetaSlider_Widget extends WP_Widget {
49
  *
50
  * @see WP_Widget::update()
51
  *
52
- * @param array $new_instance Values just sent to be saved.
53
- * @param array $old_instance Previously saved values from database.
54
  *
55
  * @return array Updated safe values to be saved.
56
  */
@@ -67,67 +67,61 @@ class MetaSlider_Widget extends WP_Widget {
67
  *
68
  * @see WP_Widget::form()
69
  *
70
- * @param array $instance Previously saved values from database.
71
  */
72
  public function form( $instance ) {
73
  $selected_slider = 0;
74
  $title = "";
75
  $sliders = false;
76
 
77
- if (isset($instance['slider_id'])) {
78
  $selected_slider = $instance['slider_id'];
79
  }
80
 
81
- if (isset($instance['title'])) {
82
  $title = $instance['title'];
83
  }
84
 
85
-
86
- $posts = get_posts(array(
87
- 'post_type' => 'ml-slider',
88
- 'post_status' => 'publish',
89
- 'orderby' => 'date',
90
- 'order' => 'ASC',
91
- 'posts_per_page' => -1
92
- ));
93
 
94
- foreach($posts as $post) {
 
 
 
 
 
 
 
 
95
  $active = $selected_slider == $post->ID ? true : false;
96
-
97
- $sliders[] = array(
98
- 'active' => $active,
99
- 'title' => $post->post_title,
100
- 'id' => $post->ID
101
- );
102
  }
103
-
104
- ?>
105
  <p>
106
- <?php if ($sliders) { ?>
107
  <p>
108
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
109
  <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
110
  </p>
111
- <label for="<?php echo $this->get_field_id('slider_id'); ?>"><?php _e('Select Slider:', 'metaslider'); ?></label>
112
- <select id="<?php echo $this->get_field_id('slider_id'); ?>" name="<?php echo $this->get_field_name('slider_id'); ?>">
113
  <?php
114
- foreach ($sliders as $slider) {
115
- $selected = $slider['active'] ? 'selected=selected' : '';
116
- echo "<option value='{$slider['id']}' {$selected}>{$slider['title']}</option>";
117
- }
118
- ?>
119
  </select>
120
  <?php } else {
121
- _e('No slideshows found', 'metaslider');
122
- } ?>
123
  </p>
124
- <?php
125
  }
126
  }
127
-
128
- add_action('widgets_init', 'register_metaslider_widget');
129
-
130
- function register_metaslider_widget() {
131
- register_widget('MetaSlider_Widget');
132
- }
133
- ?>
1
+ <?php
2
  /**
3
  * Adds Meta Slider widget.
4
  */
5
 
6
  // disable direct access
7
+ if ( !defined( 'ABSPATH' ) ) exit;
8
 
9
  class MetaSlider_Widget extends WP_Widget {
10
 
13
  */
14
  public function __construct() {
15
  parent::__construct(
16
+ 'metaslider_widget', // Base ID
17
  'Meta Slider', // Name
18
+ array( 'description' => __( 'Meta Slider', 'metaslider' ) ) // Args
19
  );
20
  }
21
 
24
  *
25
  * @see WP_Widget::widget()
26
  *
27
+ * @param array $args Widget arguments.
28
+ * @param array $instance Saved values from database.
29
  */
30
  public function widget( $args, $instance ) {
31
+ extract( $args );
32
 
33
+ if ( isset( $instance['slider_id'] ) ) {
34
  $slider_id = $instance['slider_id'];
35
 
36
  $title = apply_filters( 'widget_title', $instance['title'] );
39
  if ( ! empty( $title ) )
40
  echo $before_title . $title . $after_title;
41
 
42
+ echo do_shortcode( "[metaslider id={$slider_id}]" );
43
  echo $after_widget;
44
  }
45
  }
49
  *
50
  * @see WP_Widget::update()
51
  *
52
+ * @param array $new_instance Values just sent to be saved.
53
+ * @param array $old_instance Previously saved values from database.
54
  *
55
  * @return array Updated safe values to be saved.
56
  */
67
  *
68
  * @see WP_Widget::form()
69
  *
70
+ * @param array $instance Previously saved values from database.
71
  */
72
  public function form( $instance ) {
73
  $selected_slider = 0;
74
  $title = "";
75
  $sliders = false;
76
 
77
+ if ( isset( $instance['slider_id'] ) ) {
78
  $selected_slider = $instance['slider_id'];
79
  }
80
 
81
+ if ( isset( $instance['title'] ) ) {
82
  $title = $instance['title'];
83
  }
84
 
 
 
 
 
 
 
 
 
85
 
86
+ $posts = get_posts( array(
87
+ 'post_type' => 'ml-slider',
88
+ 'post_status' => 'publish',
89
+ 'orderby' => 'date',
90
+ 'order' => 'ASC',
91
+ 'posts_per_page' => -1
92
+ ) );
93
+
94
+ foreach ( $posts as $post ) {
95
  $active = $selected_slider == $post->ID ? true : false;
96
+
97
+ $sliders[] = array(
98
+ 'active' => $active,
99
+ 'title' => $post->post_title,
100
+ 'id' => $post->ID
101
+ );
102
  }
103
+
104
+ ?>
105
  <p>
106
+ <?php if ( $sliders ) { ?>
107
  <p>
108
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'metaslider' ); ?></label>
109
  <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
110
  </p>
111
+ <label for="<?php echo $this->get_field_id( 'slider_id' ); ?>"><?php _e( 'Select Slider:', 'metaslider' ); ?></label>
112
+ <select id="<?php echo $this->get_field_id( 'slider_id' ); ?>" name="<?php echo $this->get_field_name( 'slider_id' ); ?>">
113
  <?php
114
+ foreach ( $sliders as $slider ) {
115
+ $selected = $slider['active'] ? 'selected=selected' : '';
116
+ echo "<option value='{$slider['id']}' {$selected}>{$slider['title']}</option>";
117
+ }
118
+ ?>
119
  </select>
120
  <?php } else {
121
+ _e( 'No slideshows found', 'metaslider' );
122
+ } ?>
123
  </p>
124
+ <?php
125
  }
126
  }
127
+ ?>
 
 
 
 
 
 
inc/simple_html_dom.php ADDED
@@ -0,0 +1,1703 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Website: http://sourceforge.net/projects/simplehtmldom/
4
+ * Additional projects that may be used: http://sourceforge.net/projects/debugobject/
5
+ * Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/)
6
+ * Contributions by:
7
+ * Yousuke Kumakura (Attribute filters)
8
+ * Vadim Voituk (Negative indexes supports of "find" method)
9
+ * Antcs (Constructor with automatically load contents either text or file/url)
10
+ *
11
+ * all affected sections have comments starting with "PaperG"
12
+ *
13
+ * Paperg - Added case insensitive testing of the value of the selector.
14
+ * Paperg - Added tag_start for the starting index of tags - NOTE: This works but not accurately.
15
+ * This tag_start gets counted AFTER \r\n have been crushed out, and after the remove_noice calls so it will not reflect the REAL position of the tag in the source,
16
+ * it will almost always be smaller by some amount.
17
+ * We use this to determine how far into the file the tag in question is. This "percentage will never be accurate as the $dom->size is the "real" number of bytes the dom was created from.
18
+ * but for most purposes, it's a really good estimation.
19
+ * Paperg - Added the forceTagsClosed to the dom constructor. Forcing tags closed is great for malformed html, but it CAN lead to parsing errors.
20
+ * Allow the user to tell us how much they trust the html.
21
+ * Paperg add the text and plaintext to the selectors for the find syntax. plaintext implies text in the innertext of a node. text implies that the tag is a text node.
22
+ * This allows for us to find tags based on the text they contain.
23
+ * Create find_ancestor_tag to see if a tag is - at any level - inside of another specific tag.
24
+ * Paperg: added parse_charset so that we know about the character set of the source document.
25
+ * NOTE: If the user's system has a routine called get_last_retrieve_url_contents_content_type availalbe, we will assume it's returning the content-type header from the
26
+ * last transfer or curl_exec, and we will parse that and use it in preference to any other method of charset detection.
27
+ *
28
+ * Found infinite loop in the case of broken html in restore_noise. Rewrote to protect from that.
29
+ * PaperG (John Schlick) Added get_display_size for "IMG" tags.
30
+ *
31
+ * Licensed under The MIT License
32
+ * Redistributions of files must retain the above copyright notice.
33
+ *
34
+ * @author S.C. Chen <me578022@gmail.com>
35
+ * @author John Schlick
36
+ * @author Rus Carroll
37
+ * @version 1.5 ($Rev: 208 $)
38
+ * @package PlaceLocalInclude
39
+ * @subpackage simple_html_dom
40
+ */
41
+
42
+ if ( ! class_exists('simple_html_dom_node') ) :
43
+ /**
44
+ * All of the Defines for the classes below.
45
+ * @author S.C. Chen <me578022@gmail.com>
46
+ */
47
+ define('HDOM_TYPE_ELEMENT', 1);
48
+ define('HDOM_TYPE_COMMENT', 2);
49
+ define('HDOM_TYPE_TEXT', 3);
50
+ define('HDOM_TYPE_ENDTAG', 4);
51
+ define('HDOM_TYPE_ROOT', 5);
52
+ define('HDOM_TYPE_UNKNOWN', 6);
53
+ define('HDOM_QUOTE_DOUBLE', 0);
54
+ define('HDOM_QUOTE_SINGLE', 1);
55
+ define('HDOM_QUOTE_NO', 3);
56
+ define('HDOM_INFO_BEGIN', 0);
57
+ define('HDOM_INFO_END', 1);
58
+ define('HDOM_INFO_QUOTE', 2);
59
+ define('HDOM_INFO_SPACE', 3);
60
+ define('HDOM_INFO_TEXT', 4);
61
+ define('HDOM_INFO_INNER', 5);
62
+ define('HDOM_INFO_OUTER', 6);
63
+ define('HDOM_INFO_ENDSPACE',7);
64
+ define('DEFAULT_TARGET_CHARSET', 'UTF-8');
65
+ define('DEFAULT_BR_TEXT', "\r\n");
66
+ define('DEFAULT_SPAN_TEXT', " ");
67
+ define('MAX_FILE_SIZE', 600000);
68
+
69
+ /**
70
+ * simple html dom node
71
+ * PaperG - added ability for "find" routine to lowercase the value of the selector.
72
+ * PaperG - added $tag_start to track the start position of the tag in the total byte index
73
+ *
74
+ * @package PlaceLocalInclude
75
+ */
76
+ class simple_html_dom_node
77
+ {
78
+ public $nodetype = HDOM_TYPE_TEXT;
79
+ public $tag = 'text';
80
+ public $attr = array();
81
+ public $children = array();
82
+ public $nodes = array();
83
+ public $parent = null;
84
+ // The "info" array - see HDOM_INFO_... for what each element contains.
85
+ public $_ = array();
86
+ public $tag_start = 0;
87
+ private $dom = null;
88
+
89
+ function __construct($dom)
90
+ {
91
+ $this->dom = $dom;
92
+ $dom->nodes[] = $this;
93
+ }
94
+
95
+ function __destruct()
96
+ {
97
+ $this->clear();
98
+ }
99
+
100
+ function __toString()
101
+ {
102
+ return $this->outertext();
103
+ }
104
+
105
+ // clean up memory due to php5 circular references memory leak...
106
+ function clear()
107
+ {
108
+ $this->dom = null;
109
+ $this->nodes = null;
110
+ $this->parent = null;
111
+ $this->children = null;
112
+ }
113
+
114
+ // dump node's tree
115
+ function dump($show_attr=true, $deep=0)
116
+ {
117
+ $lead = str_repeat(' ', $deep);
118
+
119
+ echo $lead.$this->tag;
120
+ if ($show_attr && count($this->attr)>0)
121
+ {
122
+ echo '(';
123
+ foreach ($this->attr as $k=>$v)
124
+ echo "[$k]=>\"".$this->$k.'", ';
125
+ echo ')';
126
+ }
127
+ echo "\n";
128
+
129
+ if ($this->nodes)
130
+ {
131
+ foreach ($this->nodes as $c)
132
+ {
133
+ $c->dump($show_attr, $deep+1);
134
+ }
135
+ }
136
+ }
137
+
138
+
139
+ // Debugging function to dump a single dom node with a bunch of information about it.
140
+ function dump_node($echo=true)
141
+ {
142
+
143
+ $string = $this->tag;
144
+ if (count($this->attr)>0)
145
+ {
146
+ $string .= '(';
147
+ foreach ($this->attr as $k=>$v)
148
+ {
149
+ $string .= "[$k]=>\"".$this->$k.'", ';
150
+ }
151
+ $string .= ')';
152
+ }
153
+ if (count($this->_)>0)
154
+ {
155
+ $string .= ' $_ (';
156
+ foreach ($this->_ as $k=>$v)
157
+ {
158
+ if (is_array($v))
159
+ {
160
+ $string .= "[$k]=>(";
161
+ foreach ($v as $k2=>$v2)
162
+ {
163
+ $string .= "[$k2]=>\"".$v2.'", ';
164
+ }
165
+ $string .= ")";
166
+ } else {
167
+ $string .= "[$k]=>\"".$v.'", ';
168
+ }
169
+ }
170
+ $string .= ")";
171
+ }
172
+
173
+ if (isset($this->text))
174
+ {
175
+ $string .= " text: (" . $this->text . ")";
176
+ }
177
+
178
+ $string .= " HDOM_INNER_INFO: '";
179
+ if (isset($node->_[HDOM_INFO_INNER]))
180
+ {
181
+ $string .= $node->_[HDOM_INFO_INNER] . "'";
182
+ }
183
+ else
184
+ {
185
+ $string .= ' NULL ';
186
+ }
187
+
188
+ $string .= " children: " . count($this->children);
189
+ $string .= " nodes: " . count($this->nodes);
190
+ $string .= " tag_start: " . $this->tag_start;
191
+ $string .= "\n";
192
+
193
+ if ($echo)
194
+ {
195
+ echo $string;
196
+ return;
197
+ }
198
+ else
199
+ {
200
+ return $string;
201
+ }
202
+ }
203
+
204
+ // returns the parent of node
205
+ // If a node is passed in, it will reset the parent of the current node to that one.
206
+ function parent($parent=null)
207
+ {
208
+ // I am SURE that this doesn't work properly.
209
+ // It fails to unset the current node from it's current parents nodes or children list first.
210
+ if ($parent !== null)
211
+ {
212
+ $this->parent = $parent;
213
+ $this->parent->nodes[] = $this;
214
+ $this->parent->children[] = $this;
215
+ }
216
+
217
+ return $this->parent;
218
+ }
219
+
220
+ // verify that node has children
221
+ function has_child()
222
+ {
223
+ return !empty($this->children);
224
+ }
225
+
226
+ // returns children of node
227
+ function children($idx=-1)
228
+ {
229
+ if ($idx===-1)
230
+ {
231
+ return $this->children;
232
+ }
233
+ if (isset($this->children[$idx]))
234
+ {
235
+ return $this->children[$idx];
236
+ }
237
+ return null;
238
+ }
239
+
240
+ // returns the first child of node
241
+ function first_child()
242
+ {
243
+ if (count($this->children)>0)
244
+ {
245
+ return $this->children[0];
246
+ }
247
+ return null;
248
+ }
249
+
250
+ // returns the last child of node
251
+ function last_child()
252
+ {
253
+ if (($count=count($this->children))>0)
254
+ {
255
+ return $this->children[$count-1];
256
+ }
257
+ return null;
258
+ }
259
+
260
+ // returns the next sibling of node
261
+ function next_sibling()
262
+ {
263
+ if ($this->parent===null)
264
+ {
265
+ return null;
266
+ }
267
+
268
+ $idx = 0;
269
+ $count = count($this->parent->children);
270
+ while ($idx<$count && $this!==$this->parent->children[$idx])
271
+ {
272
+ ++$idx;
273
+ }
274
+ if (++$idx>=$count)
275
+ {
276
+ return null;
277
+ }
278
+ return $this->parent->children[$idx];
279
+ }
280
+
281
+ // returns the previous sibling of node
282
+ function prev_sibling()
283
+ {
284
+ if ($this->parent===null) return null;
285
+ $idx = 0;
286
+ $count = count($this->parent->children);
287
+ while ($idx<$count && $this!==$this->parent->children[$idx])
288
+ ++$idx;
289
+ if (--$idx<0) return null;
290
+ return $this->parent->children[$idx];
291
+ }
292
+
293
+ // function to locate a specific ancestor tag in the path to the root.
294
+ function find_ancestor_tag($tag)
295
+ {
296
+ global $debug_object;
297
+ if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
298
+
299
+ // Start by including ourselves in the comparison.
300
+ $returnDom = $this;
301
+
302
+ while (!is_null($returnDom))
303
+ {
304
+ if (is_object($debug_object)) { $debug_object->debug_log(2, "Current tag is: " . $returnDom->tag); }
305
+
306
+ if ($returnDom->tag == $tag)
307
+ {
308
+ break;
309
+ }
310
+ $returnDom = $returnDom->parent;
311
+ }
312
+ return $returnDom;
313
+ }
314
+
315
+ // get dom node's inner html
316
+ function innertext()
317
+ {
318
+ if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER];
319
+ if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
320
+
321
+ $ret = '';
322
+ foreach ($this->nodes as $n)
323
+ $ret .= $n->outertext();
324
+ return $ret;
325
+ }
326
+
327
+ // get dom node's outer text (with tag)
328
+ function outertext()
329
+ {
330
+ global $debug_object;
331
+ if (is_object($debug_object))
332
+ {
333
+ $text = '';
334
+ if ($this->tag == 'text')
335
+ {
336
+ if (!empty($this->text))
337
+ {
338
+ $text = " with text: " . $this->text;
339
+ }
340
+ }
341
+ $debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text);
342
+ }
343
+
344
+ if ($this->tag==='root') return $this->innertext();
345
+
346
+ // trigger callback
347
+ if ($this->dom && $this->dom->callback!==null)
348
+ {
349
+ call_user_func_array($this->dom->callback, array($this));
350
+ }
351
+
352
+ if (isset($this->_[HDOM_INFO_OUTER])) return $this->_[HDOM_INFO_OUTER];
353
+ if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
354
+
355
+ // render begin tag
356
+ if ($this->dom && $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]])
357
+ {
358
+ $ret = $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]]->makeup();
359
+ } else {
360
+ $ret = "";
361
+ }
362
+
363
+ // render inner text
364
+ if (isset($this->_[HDOM_INFO_INNER]))
365
+ {
366
+ // If it's a br tag... don't return the HDOM_INNER_INFO that we may or may not have added.
367
+ if ($this->tag != "br")
368
+ {
369
+ $ret .= $this->_[HDOM_INFO_INNER];
370
+ }
371
+ } else {
372
+ if ($this->nodes)
373
+ {
374
+ foreach ($this->nodes as $n)
375
+ {
376
+ $ret .= $this->convert_text($n->outertext());
377
+ }
378
+ }
379
+ }
380
+
381
+ // render end tag
382
+ if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0)
383
+ $ret .= '</'.$this->tag.'>';
384
+ return $ret;
385
+ }
386
+
387
+ // get dom node's plain text
388
+ function text()
389
+ {
390
+ if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER];
391
+ switch ($this->nodetype)
392
+ {
393
+ case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
394
+ case HDOM_TYPE_COMMENT: return '';
395
+ case HDOM_TYPE_UNKNOWN: return '';
396
+ }
397
+ if (strcasecmp($this->tag, 'script')===0) return '';
398
+ if (strcasecmp($this->tag, 'style')===0) return '';
399
+
400
+ $ret = '';
401
+ // In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed for some span tags, and some p tags) $this->nodes is set to NULL.
402
+ // NOTE: This indicates that there is a problem where it's set to NULL without a clear happening.
403
+ // WHY is this happening?
404
+ if (!is_null($this->nodes))
405
+ {
406
+ foreach ($this->nodes as $n)
407
+ {
408
+ $ret .= $this->convert_text($n->text());
409
+ }
410
+
411
+ // If this node is a span... add a space at the end of it so multiple spans don't run into each other. This is plaintext after all.
412
+ if ($this->tag == "span")
413
+ {
414
+ $ret .= $this->dom->default_span_text;
415
+ }
416
+
417
+
418
+ }
419
+ return $ret;
420
+ }
421
+
422
+ function xmltext()
423
+ {
424
+ $ret = $this->innertext();
425
+ $ret = str_ireplace('<![CDATA[', '', $ret);
426
+ $ret = str_replace(']]>', '', $ret);
427
+ return $ret;
428
+ }
429
+
430
+ // build node's text with tag
431
+ function makeup()
432
+ {
433
+ // text, comment, unknown
434
+ if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
435
+
436
+ $ret = '<'.$this->tag;
437
+ $i = -1;
438
+
439
+ foreach ($this->attr as $key=>$val)
440
+ {
441
+ ++$i;
442
+
443
+ // skip removed attribute
444
+ if ($val===null || $val===false)
445
+ continue;
446
+
447
+ $ret .= $this->_[HDOM_INFO_SPACE][$i][0];
448
+ //no value attr: nowrap, checked selected...
449
+ if ($val===true)
450
+ $ret .= $key;
451
+ else {
452
+ switch ($this->_[HDOM_INFO_QUOTE][$i])
453
+ {
454
+ case HDOM_QUOTE_DOUBLE: $quote = '"'; break;
455
+ case HDOM_QUOTE_SINGLE: $quote = '\''; break;
456
+ default: $quote = '';
457
+ }
458
+ $ret .= $key.$this->_[HDOM_INFO_SPACE][$i][1].'='.$this->_[HDOM_INFO_SPACE][$i][2].$quote.$val.$quote;
459
+ }
460
+ }
461
+ $ret = $this->dom->restore_noise($ret);
462
+ return $ret . $this->_[HDOM_INFO_ENDSPACE] . '>';
463
+ }
464
+
465
+ // find elements by css selector
466
+ //PaperG - added ability for find to lowercase the value of the selector.
467
+ function find($selector, $idx=null, $lowercase=false)
468
+ {
469
+ $selectors = $this->parse_selector($selector);
470
+ if (($count=count($selectors))===0) return array();
471
+ $found_keys = array();
472
+
473
+ // find each selector
474
+ for ($c=0; $c<$count; ++$c)
475
+ {
476
+ // The change on the below line was documented on the sourceforge code tracker id 2788009
477
+ // used to be: if (($levle=count($selectors[0]))===0) return array();
478
+ if (($levle=count($selectors[$c]))===0) return array();
479
+ if (!isset($this->_[HDOM_INFO_BEGIN])) return array();
480
+
481
+ $head = array($this->_[HDOM_INFO_BEGIN]=>1);
482
+
483
+ // handle descendant selectors, no recursive!
484
+ for ($l=0; $l<$levle; ++$l)
485
+ {
486
+ $ret = array();
487
+ foreach ($head as $k=>$v)
488
+ {
489
+ $n = ($k===-1) ? $this->dom->root : $this->dom->nodes[$k];
490
+ //PaperG - Pass this optional parameter on to the seek function.
491
+ $n->seek($selectors[$c][$l], $ret, $lowercase);
492
+ }
493
+ $head = $ret;
494
+ }
495
+
496
+ foreach ($head as $k=>$v)
497
+ {
498
+ if (!isset($found_keys[$k]))
499
+ {
500
+ $found_keys[$k] = 1;
501
+ }
502
+ }
503
+ }
504
+
505
+ // sort keys
506
+ ksort($found_keys);
507
+
508
+ $found = array();
509
+ foreach ($found_keys as $k=>$v)
510
+ $found[] = $this->dom->nodes[$k];
511
+
512
+ // return nth-element or array
513
+ if (is_null($idx)) return $found;
514
+ else if ($idx<0) $idx = count($found) + $idx;
515
+ return (isset($found[$idx])) ? $found[$idx] : null;
516
+ }
517
+
518
+ // seek for given conditions
519
+ // PaperG - added parameter to allow for case insensitive testing of the value of a selector.
520
+ protected function seek($selector, &$ret, $lowercase=false)
521
+ {
522
+ global $debug_object;
523
+ if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
524
+
525
+ list($tag, $key, $val, $exp, $no_key) = $selector;
526
+
527
+ // xpath index
528
+ if ($tag && $key && is_numeric($key))
529
+ {
530
+ $count = 0;
531
+ foreach ($this->children as $c)
532
+ {
533
+ if ($tag==='*' || $tag===$c->tag) {
534
+ if (++$count==$key) {
535
+ $ret[$c->_[HDOM_INFO_BEGIN]] = 1;
536
+ return;
537
+ }
538
+ }
539
+ }
540
+ return;
541
+ }
542
+
543
+ $end = (!empty($this->_[HDOM_INFO_END])) ? $this->_[HDOM_INFO_END] : 0;
544
+ if ($end==0) {
545
+ $parent = $this->parent;
546
+ while (!isset($parent->_[HDOM_INFO_END]) && $parent!==null) {
547
+ $end -= 1;
548
+ $parent = $parent->parent;
549
+ }
550
+ $end += $parent->_[HDOM_INFO_END];
551
+ }
552
+
553
+ for ($i=$this->_[HDOM_INFO_BEGIN]+1; $i<$end; ++$i) {
554
+ $node = $this->dom->nodes[$i];
555
+
556
+ $pass = true;
557
+
558
+ if ($tag==='*' && !$key) {
559
+ if (in_array($node, $this->children, true))
560
+ $ret[$i] = 1;
561
+ continue;
562
+ }
563
+
564
+ // compare tag
565
+ if ($tag && $tag!=$node->tag && $tag!=='*') {$pass=false;}
566
+ // compare key
567
+ if ($pass && $key) {
568
+ if ($no_key) {
569
+ if (isset($node->attr[$key])) $pass=false;
570
+ } else {
571
+ if (($key != "plaintext") && !isset($node->attr[$key])) $pass=false;
572
+ }
573
+ }
574
+ // compare value
575
+ if ($pass && $key && $val && $val!=='*') {
576
+ // If they have told us that this is a "plaintext" search then we want the plaintext of the node - right?
577
+ if ($key == "plaintext") {
578
+ // $node->plaintext actually returns $node->text();
579
+ $nodeKeyValue = $node->text();
580
+ } else {
581
+ // this is a normal search, we want the value of that attribute of the tag.
582
+ $nodeKeyValue = $node->attr[$key];
583
+ }
584
+ if (is_object($debug_object)) {$debug_object->debug_log(2, "testing node: " . $node->tag . " for attribute: " . $key . $exp . $val . " where nodes value is: " . $nodeKeyValue);}
585
+
586
+ //PaperG - If lowercase is set, do a case insensitive test of the value of the selector.
587
+ if ($lowercase) {
588
+ $check = $this->match($exp, strtolower($val), strtolower($nodeKeyValue));
589
+ } else {
590
+ $check = $this->match($exp, $val, $nodeKeyValue);
591
+ }
592
+ if (is_object($debug_object)) {$debug_object->debug_log(2, "after match: " . ($check ? "true" : "false"));}
593
+
594
+ // handle multiple class
595
+ if (!$check && strcasecmp($key, 'class')===0) {
596
+ foreach (explode(' ',$node->attr[$key]) as $k) {
597
+ // Without this, there were cases where leading, trailing, or double spaces lead to our comparing blanks - bad form.
598
+ if (!empty($k)) {
599
+ if ($lowercase) {
600
+ $check = $this->match($exp, strtolower($val), strtolower($k));
601
+ } else {
602
+ $check = $this->match($exp, $val, $k);
603
+ }
604
+ if ($check) break;
605
+ }
606
+ }
607
+ }
608
+ if (!$check) $pass = false;
609
+ }
610
+ if ($pass) $ret[$i] = 1;
611
+ unset($node);
612
+ }
613
+ // It's passed by reference so this is actually what this function returns.
614
+ if (is_object($debug_object)) {$debug_object->debug_log(1, "EXIT - ret: ", $ret);}
615
+ }
616
+
617
+ protected function match($exp, $pattern, $value) {
618
+ global $debug_object;
619
+ if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
620
+
621
+ switch ($exp) {
622
+ case '=':
623
+ return ($value===$pattern);
624
+ case '!=':
625
+ return ($value!==$pattern);
626
+ case '^=':
627
+ return preg_match("/^".preg_quote($pattern,'/')."/", $value);
628
+ case '$=':
629
+ return preg_match("/".preg_quote($pattern,'/')."$/", $value);
630
+ case '*=':
631
+ if ($pattern[0]=='/') {
632
+ return preg_match($pattern, $value);
633
+ }
634
+ return preg_match("/".$pattern."/i", $value);
635
+ }
636
+ return false;
637
+ }
638
+
639
+ protected function parse_selector($selector_string) {
640
+ global $debug_object;
641
+ if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
642
+
643
+ // pattern of CSS selectors, modified from mootools
644
+ // Paperg: Add the colon to the attrbute, so that it properly finds <tag attr:ibute="something" > like google does.
645
+ // Note: if you try to look at this attribute, yo MUST use getAttribute since $dom->x:y will fail the php syntax check.
646
+ // Notice the \[ starting the attbute? and the @? following? This implies that an attribute can begin with an @ sign that is not captured.
647
+ // This implies that an html attribute specifier may start with an @ sign that is NOT captured by the expression.
648
+ // farther study is required to determine of this should be documented or removed.
649
+ // $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
650
+ $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
651
+ preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER);
652
+ if (is_object($debug_object)) {$debug_object->debug_log(2, "Matches Array: ", $matches);}
653
+
654
+ $selectors = array();
655
+ $result = array();
656
+ //print_r($matches);
657
+
658
+ foreach ($matches as $m) {
659
+ $m[0] = trim($m[0]);
660
+ if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') continue;
661
+ // for browser generated xpath
662
+ if ($m[1]==='tbody') continue;
663
+
664
+ list($tag, $key, $val, $exp, $no_key) = array($m[1], null, null, '=', false);
665
+ if (!empty($m[2])) {$key='id'; $val=$m[2];}
666
+ if (!empty($m[3])) {$key='class'; $val=$m[3];}
667
+ if (!empty($m[4])) {$key=$m[4];}
668
+ if (!empty($m[5])) {$exp=$m[5];}
669
+ if (!empty($m[6])) {$val=$m[6];}
670
+
671
+ // convert to lowercase
672
+ if ($this->dom->lowercase) {$tag=strtolower($tag); $key=strtolower($key);}
673
+ //elements that do NOT have the specified attribute
674
+ if (isset($key[0]) && $key[0]==='!') {$key=substr($key, 1); $no_key=true;}
675
+
676
+ $result[] = array($tag, $key, $val, $exp, $no_key);
677
+ if (trim($m[7])===',') {
678
+ $selectors[] = $result;
679
+ $result = array();
680
+ }
681
+ }
682
+ if (count($result)>0)
683
+ $selectors[] = $result;
684
+ return $selectors;
685
+ }
686
+
687
+ function __get($name)
688
+ {
689
+ if (isset($this->attr[$name]))
690
+ {
691
+ return $this->convert_text($this->attr[$name]);
692
+ }
693
+ switch ($name)
694
+ {
695
+ case 'outertext': return $this->outertext();
696
+ case 'innertext': return $this->innertext();
697
+ case 'plaintext': return $this->text();
698
+ case 'xmltext': return $this->xmltext();
699
+ default: return array_key_exists($name, $this->attr);
700
+ }
701
+ }
702
+
703
+ function __set($name, $value)
704
+ {
705
+ global $debug_object;
706
+ if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
707
+
708
+ switch ($name)
709
+ {
710
+ case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value;
711
+ case 'innertext':
712
+ if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value;
713
+ return $this->_[HDOM_INFO_INNER] = $value;
714
+ }
715
+ if (!isset($this->attr[$name]))
716
+ {
717
+ $this->_[HDOM_INFO_SPACE][] = array(' ', '', '');
718
+ $this->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE;
719
+ }
720
+ $this->attr[$name] = $value;
721
+ }
722
+
723
+ function __isset($name)
724
+ {
725
+ switch ($name)
726
+ {
727
+ case 'outertext': return true;
728
+ case 'innertext': return true;
729
+ case 'plaintext': return true;
730
+ }
731
+ //no value attr: nowrap, checked selected...
732
+ return (array_key_exists($name, $this->attr)) ? true : isset($this->attr[$name]);
733
+ }
734
+
735
+ function __unset($name) {
736
+ if (isset($this->attr[$name]))
737
+ unset($this->attr[$name]);
738
+ }
739
+
740
+ // PaperG - Function to convert the text from one character set to another if the two sets are not the same.
741
+ function convert_text($text)
742
+ {
743
+ global $debug_object;
744
+ if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
745
+
746
+ $converted_text = $text;
747
+
748
+ $sourceCharset = "";
749
+ $targetCharset = "";
750
+
751
+ if ($this->dom)
752
+ {
753
+ $sourceCharset = strtoupper($this->dom->_charset);
754
+ $targetCharset = strtoupper($this->dom->_target_charset);
755
+ }
756
+ if (is_object($debug_object)) {$debug_object->debug_log(3, "source charset: " . $sourceCharset . " target charaset: " . $targetCharset);}
757
+
758
+ if (!empty($sourceCharset) && !empty($targetCharset) && (strcasecmp($sourceCharset, $targetCharset) != 0))
759
+ {
760
+ // Check if the reported encoding could have been incorrect and the text is actually already UTF-8
761
+ if ((strcasecmp($targetCharset, 'UTF-8') == 0) && ($this->is_utf8($text)))
762
+ {
763
+ $converted_text = $text;
764
+ }
765
+ else
766
+ {
767
+ $converted_text = iconv($sourceCharset, $targetCharset, $text);
768
+ }
769
+ }
770
+
771
+ // Lets make sure that we don't have that silly BOM issue with any of the utf-8 text we output.
772
+ if ($targetCharset == 'UTF-8')
773
+ {
774
+ if (substr($converted_text, 0, 3) == "\xef\xbb\xbf")
775
+ {
776
+ $converted_text = substr($converted_text, 3);
777
+ }
778
+ if (substr($converted_text, -3) == "\xef\xbb\xbf")
779
+ {
780
+ $converted_text = substr($converted_text, 0, -3);
781
+ }
782
+ }
783
+
784
+ return $converted_text;
785
+ }
786
+
787
+ /**
788
+ * Returns true if $string is valid UTF-8 and false otherwise.
789
+ *
790
+ * @param mixed $str String to be tested
791
+ * @return boolean
792
+ */
793
+ static function is_utf8($str)
794
+ {
795
+ $c=0; $b=0;
796
+ $bits=0;
797
+ $len=strlen($str);
798
+ for($i=0; $i<$len; $i++)
799
+ {
800
+ $c=ord($str[$i]);
801
+ if($c > 128)
802
+ {
803
+ if(($c >= 254)) return false;
804
+ elseif($c >= 252) $bits=6;
805
+ elseif($c >= 248) $bits=5;
806
+ elseif($c >= 240) $bits=4;
807
+ elseif($c >= 224) $bits=3;
808
+ elseif($c >= 192) $bits=2;
809
+ else return false;
810
+ if(($i+$bits) > $len) return false;
811
+ while($bits > 1)
812
+ {
813
+ $i++;
814
+ $b=ord($str[$i]);
815
+ if($b < 128 || $b > 191) return false;
816
+ $bits--;
817
+ }
818
+ }
819
+ }
820
+ return true;
821
+ }
822
+ /*
823
+ function is_utf8($string)
824
+ {
825
+ //this is buggy
826
+ return (utf8_encode(utf8_decode($string)) == $string);
827
+ }
828
+ */
829
+
830
+ /**
831
+ * Function to try a few tricks to determine the displayed size of an img on the page.
832
+ * NOTE: This will ONLY work on an IMG tag. Returns FALSE on all other tag types.
833
+ *
834
+ * @author John Schlick
835
+ * @version April 19 2012
836
+ * @return array an array containing the 'height' and 'width' of the image on the page or -1 if we can't figure it out.
837
+ */
838
+ function get_display_size()
839
+ {
840
+ global $debug_object;
841
+
842
+ $width = -1;
843
+ $height = -1;
844
+
845
+ if ($this->tag !== 'img')
846
+ {
847
+ return false;
848
+ }
849
+
850
+ // See if there is aheight or width attribute in the tag itself.
851
+ if (isset($this->attr['width']))
852
+ {
853
+ $width = $this->attr['width'];
854
+ }
855
+
856
+ if (isset($this->attr['height']))
857
+ {
858
+ $height = $this->attr['height'];
859
+ }
860
+
861
+ // Now look for an inline style.
862
+ if (isset($this->attr['style']))
863
+ {
864
+ // Thanks to user gnarf from stackoverflow for this regular expression.
865
+ $attributes = array();
866
+ preg_match_all("/([\w-]+)\s*:\s*([^;]+)\s*;?/", $this->attr['style'], $matches, PREG_SET_ORDER);
867
+ foreach ($matches as $match) {
868
+ $attributes[$match[1]] = $match[2];
869
+ }
870
+
871
+ // If there is a width in the style attributes:
872
+ if (isset($attributes['width']) && $width == -1)
873
+ {
874
+ // check that the last two characters are px (pixels)
875
+ if (strtolower(substr($attributes['width'], -2)) == 'px')
876
+ {
877
+ $proposed_width = substr($attributes['width'], 0, -2);
878
+ // Now make sure that it's an integer and not something stupid.
879
+ if (filter_var($proposed_width, FILTER_VALIDATE_INT))
880
+ {
881
+ $width = $proposed_width;
882
+ }
883
+ }
884
+ }
885
+
886
+ // If there is a width in the style attributes:
887
+ if (isset($attributes['height']) && $height == -1)
888
+ {
889
+ // check that the last two characters are px (pixels)
890
+ if (strtolower(substr($attributes['height'], -2)) == 'px')
891
+ {
892
+ $proposed_height = substr($attributes['height'], 0, -2);
893
+ // Now make sure that it's an integer and not something stupid.
894
+ if (filter_var($proposed_height, FILTER_VALIDATE_INT))
895
+ {
896
+ $height = $proposed_height;
897
+ }
898
+ }
899
+ }
900
+
901
+ }
902
+
903
+ // Future enhancement:
904
+ // Look in the tag to see if there is a class or id specified that has a height or width attribute to it.
905
+
906
+ // Far future enhancement
907
+ // Look at all the parent tags of this image to see if they specify a class or id that has an img selector that specifies a height or width
908
+ // Note that in this case, the class or id will have the img subselector for it to apply to the image.
909
+
910
+ // ridiculously far future development
911
+ // If the class or id is specified in a SEPARATE css file thats not on the page, go get it and do what we were just doing for the ones on the page.
912
+
913
+ $result = array('height' => $height,
914
+ 'width' => $width);
915
+ return $result;
916
+ }
917
+
918
+ // camel naming conventions
919
+ function getAllAttributes() {return $this->attr;}
920
+ function getAttribute($name) {return $this->__get($name);}
921
+ function setAttribute($name, $value) {$this->__set($name, $value);}
922
+ function hasAttribute($name) {return $this->__isset($name);}
923
+ function removeAttribute($name) {$this->__set($name, null);}
924
+ function getElementById($id) {return $this->find("#$id", 0);}
925
+ function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);}
926
+ function getElementByTagName($name) {return $this->find($name, 0);}
927
+ function getElementsByTagName($name, $idx=null) {return $this->find($name, $idx);}
928
+ function parentNode() {return $this->parent();}
929
+ function childNodes($idx=-1) {return $this->children($idx);}
930
+ function firstChild() {return $this->first_child();}
931
+ function lastChild() {return $this->last_child();}
932
+ function nextSibling() {return $this->next_sibling();}
933
+ function previousSibling() {return $this->prev_sibling();}
934
+ function hasChildNodes() {return $this->has_child();}
935
+ function nodeName() {return $this->tag;}
936
+ function appendChild($node) {$node->parent($this); return $node;}
937
+
938
+ }
939
+
940
+ /**
941
+ * simple html dom parser
942
+ * Paperg - in the find routine: allow us to specify that we want case insensitive testing of the value of the selector.
943
+ * Paperg - change $size from protected to public so we can easily access it
944
+ * Paperg - added ForceTagsClosed in the constructor which tells us whether we trust the html or not. Default is to NOT trust it.
945
+ *
946
+ * @package PlaceLocalInclude
947
+ */
948
+ class simple_html_dom
949
+ {
950
+ public $root = null;
951
+ public $nodes = array();
952
+ public $callback = null;
953
+ public $lowercase = false;
954
+ // Used to keep track of how large the text was when we started.
955
+ public $original_size;
956
+ public $size;
957
+ protected $pos;
958
+ protected $doc;
959
+ protected $char;
960
+ protected $cursor;
961
+ protected $parent;
962
+ protected $noise = array();
963
+ protected $token_blank = " \t\r\n";
964
+ protected $token_equal = ' =/>';
965
+ protected $token_slash = " />\r\n\t";
966
+ protected $token_attr = ' >';
967
+ // Note that this is referenced by a child node, and so it needs to be public for that node to see this information.
968
+ public $_charset = '';
969
+ public $_target_charset = '';
970
+ protected $default_br_text = "";
971
+ public $default_span_text = "";
972
+
973
+ // use isset instead of in_array, performance boost about 30%...
974
+ protected $self_closing_tags = array('img'=>1, 'br'=>1, 'input'=>1, 'meta'=>1, 'link'=>1, 'hr'=>1, 'base'=>1, 'embed'=>1, 'spacer'=>1);
975
+ protected $block_tags = array('root'=>1, 'body'=>1, 'form'=>1, 'div'=>1, 'span'=>1, 'table'=>1);
976
+ // Known sourceforge issue #2977341
977
+ // B tags that are not closed cause us to return everything to the end of the document.
978
+ protected $optional_closing_tags = array(
979
+ 'tr'=>array('tr'=>1, 'td'=>1, 'th'=>1),
980
+ 'th'=>array('th'=>1),
981
+ 'td'=>array('td'=>1),
982
+ 'li'=>array('li'=>1),
983
+ 'dt'=>array('dt'=>1, 'dd'=>1),
984
+ 'dd'=>array('dd'=>1, 'dt'=>1),
985
+ 'dl'=>array('dd'=>1, 'dt'=>1),
986
+ 'p'=>array('p'=>1),
987
+ 'nobr'=>array('nobr'=>1),
988
+ 'b'=>array('b'=>1),
989
+ 'option'=>array('option'=>1),
990
+ );
991
+
992
+ function __construct($str=null, $lowercase=true, $forceTagsClosed=true, $target_charset=DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
993
+ {
994
+ if ($str)
995
+ {
996
+ if (preg_match("/^http:\/\//i",$str) || is_file($str))
997
+ {
998
+ $this->load_file($str);
999
+ }
1000
+ else
1001
+ {
1002
+ $this->load($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText);
1003
+ }
1004
+ }
1005
+ // Forcing tags to be closed implies that we don't trust the html, but it can lead to parsing errors if we SHOULD trust the html.
1006
+ if (!$forceTagsClosed) {
1007
+ $this->optional_closing_array=array();
1008
+ }
1009
+ $this->_target_charset = $target_charset;
1010
+ }
1011
+
1012
+ function __destruct()
1013
+ {
1014
+ $this->clear();
1015
+ }
1016
+
1017
+ // load html from string
1018
+ function load($str, $lowercase=true, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
1019
+ {
1020
+ global $debug_object;
1021
+
1022
+ // prepare
1023
+ $this->prepare($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText);
1024
+ // strip out cdata
1025
+ $this->remove_noise("'<!\[CDATA\[(.*?)\]\]>'is", true);
1026
+ // strip out comments
1027
+ $this->remove_noise("'<!--(.*?)-->'is");
1028
+ // Per sourceforge http://sourceforge.net/tracker/?func=detail&aid=2949097&group_id=218559&atid=1044037
1029
+ // Script tags removal now preceeds style tag removal.
1030
+ // strip out <script> tags
1031
+ $this->remove_noise("'<\s*script[^>]*[^/]>(.*?)<\s*/\s*script\s*>'is");
1032
+ $this->remove_noise("'<\s*script\s*>(.*?)<\s*/\s*script\s*>'is");
1033
+ // strip out <style> tags
1034
+ $this->remove_noise("'<\s*style[^>]*[^/]>(.*?)<\s*/\s*style\s*>'is");
1035
+ $this->remove_noise("'<\s*style\s*>(.*?)<\s*/\s*style\s*>'is");
1036
+ // strip out preformatted tags
1037
+ $this->remove_noise("'<\s*(?:code)[^>]*>(.*?)<\s*/\s*(?:code)\s*>'is");
1038
+ // strip out server side scripts
1039
+ $this->remove_noise("'(<\?)(.*?)(\?>)'s", true);
1040
+ // strip smarty scripts
1041
+ $this->remove_noise("'(\{\w)(.*?)(\})'s", true);
1042
+
1043
+ // parsing
1044
+ while ($this->parse());
1045
+ // end
1046
+ $this->root->_[HDOM_INFO_END] = $this->cursor;
1047
+ $this->parse_charset();
1048
+
1049
+ // make load function chainable
1050
+ return $this;
1051
+
1052
+ }
1053
+
1054
+ // load html from file
1055
+ function load_file()
1056
+ {
1057
+ $args = func_get_args();
1058
+ $this->load(call_user_func_array('file_get_contents', $args), true);
1059
+ // Throw an error if we can't properly load the dom.
1060
+ if (($error=error_get_last())!==null) {
1061
+ $this->clear();
1062
+ return false;
1063
+ }
1064
+ }
1065
+
1066
+ // set callback function
1067
+ function set_callback($function_name)
1068
+ {
1069
+ $this->callback = $function_name;
1070
+ }
1071
+
1072
+ // remove callback function
1073
+ function remove_callback()
1074
+ {
1075
+ $this->callback = null;
1076
+ }
1077
+
1078
+ // save dom as string
1079
+ function save($filepath='')
1080
+ {
1081
+ $ret = $this->root->innertext();
1082
+ if ($filepath!=='') file_put_contents($filepath, $ret, LOCK_EX);
1083
+ return $ret;
1084
+ }
1085
+
1086
+ // find dom node by css selector
1087
+ // Paperg - allow us to specify that we want case insensitive testing of the value of the selector.
1088
+ function find($selector, $idx=null, $lowercase=false)
1089
+ {
1090
+ return $this->root->find($selector, $idx, $lowercase);
1091
+ }
1092
+
1093
+ // clean up memory due to php5 circular references memory leak...
1094
+ function clear()
1095
+ {
1096
+ foreach ($this->nodes as $n) {$n->clear(); $n = null;}
1097
+ // This add next line is documented in the sourceforge repository. 2977248 as a fix for ongoing memory leaks that occur even with the use of clear.
1098
+ if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null;}
1099
+ if (isset($this->parent)) {$this->parent->clear(); unset($this->parent);}
1100
+ if (isset($this->root)) {$this->root->clear(); unset($this->root);}
1101
+ unset($this->doc);
1102
+ unset($this->noise);
1103
+ }
1104
+
1105
+ function dump($show_attr=true)
1106
+ {
1107
+ $this->root->dump($show_attr);
1108
+ }
1109
+
1110
+ // prepare HTML data and init everything
1111
+ protected function prepare($str, $lowercase=true, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
1112
+ {
1113
+ $this->clear();
1114
+
1115
+ // set the length of content before we do anything to it.
1116
+ $this->size = strlen($str);
1117
+ // Save the original size of the html that we got in. It might be useful to someone.
1118
+ $this->original_size = $this->size;
1119
+
1120
+ //before we save the string as the doc... strip out the \r \n's if we are told to.
1121
+ if ($stripRN) {
1122
+ $str = str_replace("\r", " ", $str);
1123
+ $str = str_replace("\n", " ", $str);
1124
+
1125
+ // set the length of content since we have changed it.
1126
+ $this->size = strlen($str);
1127
+ }
1128
+
1129
+ $this->doc = $str;
1130
+ $this->pos = 0;
1131
+ $this->cursor = 1;
1132
+ $this->noise = array();
1133
+ $this->nodes = array();
1134
+ $this->lowercase = $lowercase;
1135
+ $this->default_br_text = $defaultBRText;
1136
+ $this->default_span_text = $defaultSpanText;
1137
+ $this->root = new simple_html_dom_node($this);
1138
+ $this->root->tag = 'root';
1139
+ $this->root->_[HDOM_INFO_BEGIN] = -1;
1140
+ $this->root->nodetype = HDOM_TYPE_ROOT;
1141
+ $this->parent = $this->root;
1142
+ if ($this->size>0) $this->char = $this->doc[0];
1143
+ }
1144
+
1145
+ // parse html content
1146
+ protected function parse()
1147
+ {
1148
+ if (($s = $this->copy_until_char('<'))==='')
1149
+ {
1150
+ return $this->read_tag();
1151
+ }
1152
+
1153
+ // text
1154
+ $node = new simple_html_dom_node($this);
1155
+ ++$this->cursor;
1156
+ $node->_[HDOM_INFO_TEXT] = $s;
1157
+ $this->link_nodes($node, false);
1158
+ return true;
1159
+ }
1160
+
1161
+ // PAPERG - dkchou - added this to try to identify the character set of the page we have just parsed so we know better how to spit it out later.
1162
+ // NOTE: IF you provide a routine called get_last_retrieve_url_contents_content_type which returns the CURLINFO_CONTENT_TYPE from the last curl_exec
1163
+ // (or the content_type header from the last transfer), we will parse THAT, and if a charset is specified, we will use it over any other mechanism.
1164
+ protected function parse_charset()
1165
+ {
1166
+ global $debug_object;
1167
+
1168
+ $charset = null;
1169
+
1170
+ if (function_exists('get_last_retrieve_url_contents_content_type'))
1171
+ {
1172
+ $contentTypeHeader = get_last_retrieve_url_contents_content_type();
1173
+ $success = preg_match('/charset=(.+)/', $contentTypeHeader, $matches);
1174
+ if ($success)
1175
+ {
1176
+ $charset = $matches[1];
1177
+ if (is_object($debug_object)) {$debug_object->debug_log(2, 'header content-type found charset of: ' . $charset);}
1178
+ }
1179
+
1180
+ }
1181
+
1182
+ if (empty($charset))
1183
+ {
1184
+ $el = $this->root->find('meta[http-equiv=Content-Type]',0);
1185
+ if (!empty($el))
1186
+ {
1187
+ $fullvalue = $el->content;
1188
+ if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag found' . $fullvalue);}
1189
+
1190
+ if (!empty($fullvalue))
1191
+ {
1192
+ $success = preg_match('/charset=(.+)/', $fullvalue, $matches);
1193
+ if ($success)
1194
+ {
1195
+ $charset = $matches[1];
1196
+ }
1197
+ else
1198
+ {
1199
+ // If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1
1200
+ if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');}
1201
+ $charset = 'ISO-8859-1';
1202
+ }
1203
+ }
1204
+ }
1205
+ }
1206
+
1207
+ // If we couldn't find a charset above, then lets try to detect one based on the text we got...
1208
+ if (empty($charset))
1209
+ {
1210
+ // Use this in case mb_detect_charset isn't installed/loaded on this machine.
1211
+ $charset = false;
1212
+ if (function_exists('mb_detect_encoding'))
1213
+ {
1214
+ // Have php try to detect the encoding from the text given to us.
1215
+ $charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );
1216
+ if (is_object($debug_object)) {$debug_object->debug_log(2, 'mb_detect found: ' . $charset);}
1217
+ }
1218
+
1219
+ // and if this doesn't work... then we need to just wrongheadedly assume it's UTF-8 so that we can move on - cause this will usually give us most of what we need...
1220
+ if ($charset === false)
1221
+ {
1222
+ if (is_object($debug_object)) {$debug_object->debug_log(2, 'since mb_detect failed - using default of utf-8');}
1223
+ $charset = 'UTF-8';
1224
+ }
1225
+ }
1226
+
1227
+ // Since CP1252 is a superset, if we get one of it's subsets, we want it instead.
1228
+ if ((strtolower($charset) == strtolower('ISO-8859-1')) || (strtolower($charset) == strtolower('Latin1')) || (strtolower($charset) == strtolower('Latin-1')))
1229
+ {
1230
+ if (is_object($debug_object)) {$debug_object->debug_log(2, 'replacing ' . $charset . ' with CP1252 as its a superset');}
1231
+ $charset = 'CP1252';
1232
+ }
1233
+
1234
+ if (is_object($debug_object)) {$debug_object->debug_log(1, 'EXIT - ' . $charset);}
1235
+
1236
+ return $this->_charset = $charset;
1237
+ }
1238
+
1239
+ // read tag info
1240
+ protected function read_tag()
1241
+ {
1242
+ if ($this->char!=='<')
1243
+ {
1244
+ $this->root->_[HDOM_INFO_END] = $this->cursor;
1245
+ return false;
1246
+ }
1247
+ $begin_tag_pos = $this->pos;
1248
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1249
+
1250
+ // end tag
1251
+ if ($this->char==='/')
1252
+ {
1253
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1254
+ // This represents the change in the simple_html_dom trunk from revision 180 to 181.
1255
+ // $this->skip($this->token_blank_t);
1256
+ $this->skip($this->token_blank);
1257
+ $tag = $this->copy_until_char('>');
1258
+
1259
+ // skip attributes in end tag
1260
+ if (($pos = strpos($tag, ' '))!==false)
1261
+ $tag = substr($tag, 0, $pos);
1262
+
1263
+ $parent_lower = strtolower($this->parent->tag);
1264
+ $tag_lower = strtolower($tag);
1265
+
1266
+ if ($parent_lower!==$tag_lower)
1267
+ {
1268
+ if (isset($this->optional_closing_tags[$parent_lower]) && isset($this->block_tags[$tag_lower]))
1269
+ {
1270
+ $this->parent->_[HDOM_INFO_END] = 0;
1271
+ $org_parent = $this->parent;
1272
+
1273
+ while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1274
+ $this->parent = $this->parent->parent;
1275
+
1276
+ if (strtolower($this->parent->tag)!==$tag_lower) {
1277
+ $this->parent = $org_parent; // restore origonal parent
1278
+ if ($this->parent->parent) $this->parent = $this->parent->parent;
1279
+ $this->parent->_[HDOM_INFO_END] = $this->cursor;
1280
+ return $this->as_text_node($tag);
1281
+ }
1282
+ }
1283
+ else if (($this->parent->parent) && isset($this->block_tags[$tag_lower]))
1284
+ {
1285
+ $this->parent->_[HDOM_INFO_END] = 0;
1286
+ $org_parent = $this->parent;
1287
+
1288
+ while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1289
+ $this->parent = $this->parent->parent;
1290
+
1291
+ if (strtolower($this->parent->tag)!==$tag_lower)
1292
+ {
1293
+ $this->parent = $org_parent; // restore origonal parent
1294
+ $this->parent->_[HDOM_INFO_END] = $this->cursor;
1295
+ return $this->as_text_node($tag);
1296
+ }
1297
+ }
1298
+ else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower)
1299
+ {
1300
+ $this->parent->_[HDOM_INFO_END] = 0;
1301
+ $this->parent = $this->parent->parent;
1302
+ }
1303
+ else
1304
+ return $this->as_text_node($tag);
1305
+ }
1306
+
1307
+ $this->parent->_[HDOM_INFO_END] = $this->cursor;
1308
+ if ($this->parent->parent) $this->parent = $this->parent->parent;
1309
+
1310
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1311
+ return true;
1312
+ }
1313
+
1314
+ $node = new simple_html_dom_node($this);
1315
+ $node->_[HDOM_INFO_BEGIN] = $this->cursor;
1316
+ ++$this->cursor;
1317
+ $tag = $this->copy_until($this->token_slash);
1318
+ $node->tag_start = $begin_tag_pos;
1319
+
1320
+ // doctype, cdata & comments...
1321
+ if (isset($tag[0]) && $tag[0]==='!') {
1322
+ $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until_char('>');
1323
+
1324
+ if (isset($tag[2]) && $tag[1]==='-' && $tag[2]==='-') {
1325
+ $node->nodetype = HDOM_TYPE_COMMENT;
1326
+ $node->tag = 'comment';
1327
+ } else {
1328
+ $node->nodetype = HDOM_TYPE_UNKNOWN;
1329
+ $node->tag = 'unknown';
1330
+ }
1331
+ if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1332
+ $this->link_nodes($node, true);
1333
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1334
+ return true;
1335
+ }
1336
+
1337
+ // text
1338
+ if ($pos=strpos($tag, '<')!==false) {
1339
+ $tag = '<' . substr($tag, 0, -1);
1340
+ $node->_[HDOM_INFO_TEXT] = $tag;
1341
+ $this->link_nodes($node, false);
1342
+ $this->char = $this->doc[--$this->pos]; // prev
1343
+ return true;
1344
+ }
1345
+
1346
+ if (!preg_match("/^[\w-:]+$/", $tag)) {
1347
+ $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
1348
+ if ($this->char==='<') {
1349
+ $this->link_nodes($node, false);
1350
+ return true;
1351
+ }
1352
+
1353
+ if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1354
+ $this->link_nodes($node, false);
1355
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1356
+ return true;
1357
+ }
1358
+
1359
+ // begin tag
1360
+ $node->nodetype = HDOM_TYPE_ELEMENT;
1361
+ $tag_lower = strtolower($tag);
1362
+ $node->tag = ($this->lowercase) ? $tag_lower : $tag;
1363
+
1364
+ // handle optional closing tags
1365
+ if (isset($this->optional_closing_tags[$tag_lower]) )
1366
+ {
1367
+ while (isset($this->optional_closing_tags[$tag_lower][strtolower($this->parent->tag)]))
1368
+ {
1369
+ $this->parent->_[HDOM_INFO_END] = 0;
1370
+ $this->parent = $this->parent->parent;
1371
+ }
1372
+ $node->parent = $this->parent;
1373
+ }
1374
+
1375
+ $guard = 0; // prevent infinity loop
1376
+ $space = array($this->copy_skip($this->token_blank), '', '');
1377
+
1378
+ // attributes
1379
+ do
1380
+ {
1381
+ if ($this->char!==null && $space[0]==='')
1382
+ {
1383
+ break;
1384
+ }
1385
+ $name = $this->copy_until($this->token_equal);
1386
+ if ($guard===$this->pos)
1387
+ {
1388
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1389
+ continue;
1390
+ }
1391
+ $guard = $this->pos;
1392
+
1393
+ // handle endless '<'
1394
+ if ($this->pos>=$this->size-1 && $this->char!=='>') {
1395
+ $node->nodetype = HDOM_TYPE_TEXT;
1396
+ $node->_[HDOM_INFO_END] = 0;
1397
+ $node->_[HDOM_INFO_TEXT] = '<'.$tag . $space[0] . $name;
1398
+ $node->tag = 'text';
1399
+ $this->link_nodes($node, false);
1400
+ return true;
1401
+ }
1402
+
1403
+ // handle mismatch '<'
1404
+ if ($this->doc[$this->pos-1]=='<') {
1405
+ $node->nodetype = HDOM_TYPE_TEXT;
1406
+ $node->tag = 'text';
1407
+ $node->attr = array();
1408
+ $node->_[HDOM_INFO_END] = 0;
1409
+ $node->_[HDOM_INFO_TEXT] = substr($this->doc, $begin_tag_pos, $this->pos-$begin_tag_pos-1);
1410
+ $this->pos -= 2;
1411
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1412
+ $this->link_nodes($node, false);
1413
+ return true;
1414
+ }
1415
+
1416
+ if ($name!=='/' && $name!=='') {
1417
+ $space[1] = $this->copy_skip($this->token_blank);
1418
+ $name = $this->restore_noise($name);
1419
+ if ($this->lowercase) $name = strtolower($name);
1420
+ if ($this->char==='=') {
1421
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1422
+ $this->parse_attr($node, $name, $space);
1423
+ }
1424
+ else {
1425
+ //no value attr: nowrap, checked selected...
1426
+ $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
1427
+ $node->attr[$name] = true;
1428
+ if ($this->char!='>') $this->char = $this->doc[--$this->pos]; // prev
1429
+ }
1430
+ $node->_[HDOM_INFO_SPACE][] = $space;
1431
+ $space = array($this->copy_skip($this->token_blank), '', '');
1432
+ }
1433
+ else
1434
+ break;
1435
+ } while ($this->char!=='>' && $this->char!=='/');
1436
+
1437
+ $this->link_nodes($node, true);
1438
+ $node->_[HDOM_INFO_ENDSPACE] = $space[0];
1439
+
1440
+ // check self closing
1441
+ if ($this->copy_until_char_escape('>')==='/')
1442
+ {
1443
+ $node->_[HDOM_INFO_ENDSPACE] .= '/';
1444
+ $node->_[HDOM_INFO_END] = 0;
1445
+ }
1446
+ else
1447
+ {
1448
+ // reset parent
1449
+ if (!isset($this->self_closing_tags[strtolower($node->tag)])) $this->parent = $node;
1450
+ }
1451
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1452
+
1453
+ // If it's a BR tag, we need to set it's text to the default text.
1454
+ // This way when we see it in plaintext, we can generate formatting that the user wants.
1455
+ // since a br tag never has sub nodes, this works well.
1456
+ if ($node->tag == "br")
1457
+ {
1458
+ $node->_[HDOM_INFO_INNER] = $this->default_br_text;
1459
+ }
1460
+
1461
+ return true;
1462
+ }
1463
+
1464
+ // parse attributes
1465
+ protected function parse_attr($node, $name, &$space)
1466
+ {
1467
+ // Per sourceforge: http://sourceforge.net/tracker/?func=detail&aid=3061408&group_id=218559&atid=1044037
1468
+ // If the attribute is already defined inside a tag, only pay atetntion to the first one as opposed to the last one.
1469
+ if (isset($node->attr[$name]))
1470
+ {
1471
+ return;
1472
+ }
1473
+
1474
+ $space[2] = $this->copy_skip($this->token_blank);
1475
+ switch ($this->char) {
1476
+ case '"':
1477
+ $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE;
1478
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1479
+ $node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('"'));
1480
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1481
+ break;
1482
+ case '\'':
1483
+ $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_SINGLE;
1484
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1485
+ $node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('\''));
1486
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1487
+ break;
1488
+ default:
1489
+ $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
1490
+ $node->attr[$name] = $this->restore_noise($this->copy_until($this->token_attr));
1491
+ }
1492
+ // PaperG: Attributes should not have \r or \n in them, that counts as html whitespace.
1493
+ $node->attr[$name] = str_replace("\r", "", $node->attr[$name]);
1494
+ $node->attr[$name] = str_replace("\n", "", $node->attr[$name]);
1495
+ // PaperG: If this is a "class" selector, lets get rid of the preceeding and trailing space since some people leave it in the multi class case.
1496
+ if ($name == "class") {
1497
+ $node->attr[$name] = trim($node->attr[$name]);
1498
+ }
1499
+ }
1500
+
1501
+ // link node's parent
1502
+ protected function link_nodes(&$node, $is_child)
1503
+ {
1504
+ $node->parent = $this->parent;
1505
+ $this->parent->nodes[] = $node;
1506
+ if ($is_child)
1507
+ {
1508
+ $this->parent->children[] = $node;
1509
+ }
1510
+ }
1511
+
1512
+ // as a text node
1513
+ protected function as_text_node($tag)
1514
+ {
1515
+ $node = new simple_html_dom_node($this);
1516
+ ++$this->cursor;
1517
+ $node->_[HDOM_INFO_TEXT] = '</' . $tag . '>';
1518
+ $this->link_nodes($node, false);
1519
+ $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1520
+ return true;
1521
+ }
1522
+
1523
+ protected function skip($chars)
1524
+ {
1525
+ $this->pos += strspn($this->doc, $chars, $this->pos);
1526
+ $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1527
+ }
1528
+
1529
+ protected function copy_skip($chars)
1530
+ {
1531
+ $pos = $this->pos;
1532
+ $len = strspn($this->doc, $chars, $pos);
1533
+ $this->pos += $len;
1534
+ $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1535
+ if ($len===0) return '';
1536
+ return substr($this->doc, $pos, $len);
1537
+ }
1538
+
1539
+ protected function copy_until($chars)
1540
+ {
1541
+ $pos = $this->pos;
1542
+ $len = strcspn($this->doc, $chars, $pos);
1543
+ $this->pos += $len;
1544
+ $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1545
+ return substr($this->doc, $pos, $len);
1546
+ }
1547
+
1548
+ protected function copy_until_char($char)
1549
+ {
1550
+ if ($this->char===null) return '';
1551
+
1552
+ if (($pos = strpos($this->doc, $char, $this->pos))===false) {
1553
+ $ret = substr($this->doc, $this->pos, $this->size-$this->pos);
1554
+ $this->char = null;
1555
+ $this->pos = $this->size;
1556
+ return $ret;
1557
+ }
1558
+
1559
+ if ($pos===$this->pos) return '';
1560
+ $pos_old = $this->pos;
1561
+ $this->char = $this->doc[$pos];
1562
+ $this->pos = $pos;
1563
+ return substr($this->doc, $pos_old, $pos-$pos_old);
1564
+ }
1565
+
1566
+ protected function copy_until_char_escape($char)
1567
+ {
1568
+ if ($this->char===null) return '';
1569
+
1570
+ $start = $this->pos;
1571
+ while (1)
1572
+ {
1573
+ if (($pos = strpos($this->doc, $char, $start))===false)
1574
+ {
1575
+ $ret = substr($this->doc, $this->pos, $this->size-$this->pos);
1576
+ $this->char = null;
1577
+ $this->pos = $this->size;
1578
+ return $ret;
1579
+ }
1580
+
1581
+ if ($pos===$this->pos) return '';
1582
+
1583
+ if ($this->doc[$pos-1]==='\\') {
1584
+ $start = $pos+1;
1585
+ continue;
1586
+ }
1587
+
1588
+ $pos_old = $this->pos;
1589
+ $this->char = $this->doc[$pos];
1590
+ $this->pos = $pos;
1591
+ return substr($this->doc, $pos_old, $pos-$pos_old);
1592
+ }
1593
+ }
1594
+
1595
+ // remove noise from html content
1596
+ // save the noise in the $this->noise array.
1597
+ protected function remove_noise($pattern, $remove_tag=false)
1598
+ {
1599
+ global $debug_object;
1600
+ if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
1601
+
1602
+ $count = preg_match_all($pattern, $this->doc, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE);
1603
+
1604
+ for ($i=$count-1; $i>-1; --$i)
1605
+ {
1606
+ $key = '___noise___'.sprintf('% 5d', count($this->noise)+1000);
1607
+ if (is_object($debug_object)) { $debug_object->debug_log(2, 'key is: ' . $key); }
1608
+ $idx = ($remove_tag) ? 0 : 1;
1609
+ $this->noise[$key] = $matches[$i][$idx][0];
1610
+ $this->doc = substr_replace($this->doc, $key, $matches[$i][$idx][1], strlen($matches[$i][$idx][0]));
1611
+ }
1612
+
1613
+ // reset the length of content
1614
+ $this->size = strlen($this->doc);
1615
+ if ($this->size>0)
1616
+ {
1617
+ $this->char = $this->doc[0];
1618
+ }
1619
+ }
1620
+
1621
+ // restore noise to html content
1622
+ function restore_noise($text)
1623
+ {
1624
+ global $debug_object;
1625
+ if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
1626
+
1627
+ while (($pos=strpos($text, '___noise___'))!==false)
1628
+ {
1629
+ // Sometimes there is a broken piece of markup, and we don't GET the pos+11 etc... token which indicates a problem outside of us...
1630
+ if (strlen($text) > $pos+15)
1631
+ {
1632
+ $key = '___noise___'.$text[$pos+11].$text[$pos+12].$text[$pos+13].$text[$pos+14].$text[$pos+15];
1633
+ if (is_object($debug_object)) { $debug_object->debug_log(2, 'located key of: ' . $key); }
1634
+
1635
+ if (isset($this->noise[$key]))
1636
+ {
1637
+ $text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos+16);
1638
+ }
1639
+ else
1640
+ {
1641
+ // do this to prevent an infinite loop.
1642
+ $text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key . substr($text, $pos+16);
1643
+ }
1644
+ }
1645
+ else
1646
+ {
1647
+ // There is no valid key being given back to us... We must get rid of the ___noise___ or we will have a problem.
1648
+ $text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY' . substr($text, $pos+11);
1649
+ }
1650
+ }
1651
+ return $text;
1652
+ }
1653
+
1654
+ // Sometimes we NEED one of the noise elements.
1655
+ function search_noise($text)
1656
+ {
1657
+ global $debug_object;
1658
+ if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
1659
+
1660
+ foreach($this->noise as $noiseElement)
1661
+ {
1662
+ if (strpos($noiseElement, $text)!==false)
1663
+ {
1664
+ return $noiseElement;
1665
+ }
1666
+ }
1667
+ }
1668
+ function __toString()
1669
+ {
1670
+ return $this->root->innertext();
1671
+ }
1672
+
1673
+ function __get($name)
1674
+ {
1675
+ switch ($name)
1676
+ {
1677
+ case 'outertext':
1678
+ return $this->root->innertext();
1679
+ case 'innertext':
1680
+ return $this->root->innertext();
1681
+ case 'plaintext':
1682
+ return $this->root->text();
1683
+ case 'charset':
1684
+ return $this->_charset;
1685
+ case 'target_charset':
1686
+ return $this->_target_charset;
1687
+ }
1688
+ }
1689
+
1690
+ // camel naming conventions
1691
+ function childNodes($idx=-1) {return $this->root->childNodes($idx);}
1692
+ function firstChild() {return $this->root->first_child();}
1693
+ function lastChild() {return $this->root->last_child();}
1694
+ function createElement($name, $value=null) {return @str_get_html("<$name>$value</$name>")->first_child();}
1695
+ function createTextNode($value) {return @end(str_get_html($value)->nodes);}
1696
+ function getElementById($id) {return $this->find("#$id", 0);}
1697
+ function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);}
1698
+ function getElementByTagName($name) {return $this->find($name, 0);}
1699
+ function getElementsByTagName($name, $idx=-1) {return $this->find($name, $idx);}
1700
+ function loadFile() {$args = func_get_args();$this->load_file($args);}
1701
+ }
1702
+
1703
+ endif;
inc/slide/metaslide.class.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Slide class represting a single slide. This is extended by type specific
4
  * slides (eg, MetaImageSlide, MetaYoutubeSlide (pro only), etc)
5
  */
6
  class MetaSlide {
@@ -12,84 +12,85 @@ class MetaSlide {
12
  /**
13
  * Set the slide
14
  */
15
- public function set_slide($id) {
16
- $this->slide = get_post($id);
17
  }
18
 
19
  /**
20
  * Set the slide (that this slide belongs to)
21
  */
22
- public function set_slider($id) {
23
- $this->slider = get_post($id);
24
- $this->settings = get_post_meta($id, 'ml-slider_settings', true);
25
  }
26
 
27
  /**
28
  * Return the HTML for the slide
29
- *
30
  * @return array complete array of slides
31
  */
32
- public function get_slide($slide_id, $slider_id) {
33
- $this->set_slider($slider_id);
34
- $this->set_slide($slide_id);
35
  return $this->get_slide_html();
36
  }
37
 
38
  /**
39
  * Save the slide
40
  */
41
- public function save_slide($slide_id, $slider_id, $fields) {
42
- $this->set_slider($slider_id);
43
- $this->set_slide($slide_id);
44
- $this->save($fields);
45
  }
46
 
47
  /**
48
- * Return the correct slide HTML based on whether we're viewing the slides in the
49
  * admin panel or on the front end.
50
- *
51
  * @return string slide html
52
  */
53
  public function get_slide_html() {
54
- if (is_admin() && isset($_GET['page']) && $_GET['page'] == 'metaslider-theme-editor') {
55
  return $this->get_public_slide();
56
  }
57
-
58
- if (is_admin() && !isset($_GET['slider_id'])) {
59
  return $this->get_admin_slide();
60
  }
61
 
62
  return $this->get_public_slide();
63
  }
64
-
65
  /**
66
- *
67
  */
68
- public function slide_exists_in_slideshow($slider_id, $slide_id) {
69
- return has_term("{$slider_id}", 'ml-slider', $slide_id);
70
  }
71
 
72
  /**
73
- *
74
  */
75
- public function slide_is_unassigned_or_image_slide($slider_id, $slide_id) {
76
- $type = get_post_meta($slide_id, 'ml-slider_type', true);
77
- return !strlen($type) || $type == 'image';
78
  }
79
 
80
-
81
  /**
82
  * Build image HTML
83
- *
84
- * @param array $attributes
85
  * @return string image HTML
86
  */
87
- public function build_image_tag($attributes) {
88
  $html = "<img";
89
 
90
- foreach ($attributes as $att => $val) {
91
- if (strlen($val)) {
92
  $html .= " " . $att . '="' . $val . '"';
 
 
93
  }
94
  }
95
 
@@ -100,15 +101,15 @@ class MetaSlide {
100
 
101
  /**
102
  * Build image HTML
103
- *
104
- * @param array $attributes
105
  * @return string image HTML
106
  */
107
- public function build_anchor_tag($attributes, $content) {
108
  $html = "<a";
109
 
110
- foreach ($attributes as $att => $val) {
111
- if (strlen($val)) {
112
  $html .= " " . $att . '="' . $val . '"';
113
  }
114
  }
@@ -121,15 +122,15 @@ class MetaSlide {
121
  * Tag the slide attachment to the slider tax category
122
  */
123
  public function tag_slide_to_slider() {
124
- if (!term_exists($this->slider->ID, 'ml-slider')) {
125
  // create the taxonomy term, the term is the ID of the slider itself
126
- wp_insert_term($this->slider->ID, 'ml-slider');
127
  }
128
 
129
  // get the term thats name is the same as the ID of the slider
130
- $term = get_term_by('name', $this->slider->ID, 'ml-slider');
131
  // tag this slide to the taxonomy term
132
- wp_set_post_terms($this->slide->ID, $term->term_id, 'ml-slider', true);
133
 
134
  $this->update_menu_order();
135
  }
@@ -162,9 +163,9 @@ class MetaSlide {
162
  )
163
  );
164
 
165
- $query = new WP_Query($args);
166
 
167
- while ($query->have_posts()) {
168
  $query->next_post();
169
  $menu_order = $query->post->menu_order;
170
  }
@@ -175,10 +176,11 @@ class MetaSlide {
175
  $menu_order = $menu_order + 1;
176
 
177
  // update the slide
178
- wp_update_post(array(
179
- 'ID' => $this->slide->ID,
180
- 'menu_order' => $menu_order
181
- ));
 
182
  }
183
 
184
  /**
@@ -186,18 +188,18 @@ class MetaSlide {
186
  * If the meta exists, but the value is empty, delete it
187
  * If the meta exists, update it
188
  */
189
- public function add_or_update_or_delete_meta($post_id, $name, $value) {
190
  $key = "ml-slider_" . $name;
191
 
192
- if ($value == 'false' || $value == "" || !$value) {
193
- if (get_post_meta($post_id, $key)) {
194
- delete_post_meta($post_id, $key);
195
  }
196
  } else {
197
- if (get_post_meta($post_id, $key)) {
198
- update_post_meta($post_id, $key, $value);
199
  } else {
200
- add_post_meta($post_id, $key, $value, true);
201
  }
202
  }
203
  }
@@ -206,8 +208,8 @@ class MetaSlide {
206
  * Get the thumbnail for the slide
207
  */
208
  public function get_thumb() {
209
- $imageHelper = new MetaSliderImageHelper($this->slide->ID, 150,150,'false');
210
  return $imageHelper->get_image_url();
211
  }
212
  }
213
- ?>
1
  <?php
2
  /**
3
+ * Slide class represting a single slide. This is extended by type specific
4
  * slides (eg, MetaImageSlide, MetaYoutubeSlide (pro only), etc)
5
  */
6
  class MetaSlide {
12
  /**
13
  * Set the slide
14
  */
15
+ public function set_slide( $id ) {
16
+ $this->slide = get_post( $id );
17
  }
18
 
19
  /**
20
  * Set the slide (that this slide belongs to)
21
  */
22
+ public function set_slider( $id ) {
23
+ $this->slider = get_post( $id );
24
+ $this->settings = get_post_meta( $id, 'ml-slider_settings', true );
25
  }
26
 
27
  /**
28
  * Return the HTML for the slide
29
+ *
30
  * @return array complete array of slides
31
  */
32
+ public function get_slide( $slide_id, $slider_id ) {
33
+ $this->set_slider( $slider_id );
34
+ $this->set_slide( $slide_id );
35
  return $this->get_slide_html();
36
  }
37
 
38
  /**
39
  * Save the slide
40
  */
41
+ public function save_slide( $slide_id, $slider_id, $fields ) {
42
+ $this->set_slider( $slider_id );
43
+ $this->set_slide( $slide_id );
44
+ $this->save( $fields );
45
  }
46
 
47
  /**
48
+ * Return the correct slide HTML based on whether we're viewing the slides in the
49
  * admin panel or on the front end.
50
+ *
51
  * @return string slide html
52
  */
53
  public function get_slide_html() {
54
+ if ( is_admin() && isset( $_GET['page'] ) && $_GET['page'] == 'metaslider-theme-editor' ) {
55
  return $this->get_public_slide();
56
  }
57
+
58
+ if ( is_admin() && !isset( $_GET['slider_id'] ) ) {
59
  return $this->get_admin_slide();
60
  }
61
 
62
  return $this->get_public_slide();
63
  }
64
+
65
  /**
66
+ * Check if a slide already exists in a slideshow
67
  */
68
+ public function slide_exists_in_slideshow( $slider_id, $slide_id ) {
69
+ return has_term( "{$slider_id}", 'ml-slider', $slide_id );
70
  }
71
 
72
  /**
73
+ * Check if a slide has already been assigned to a slideshow
74
  */
75
+ public function slide_is_unassigned_or_image_slide( $slider_id, $slide_id ) {
76
+ $type = get_post_meta( $slide_id, 'ml-slider_type', true );
77
+ return !strlen( $type ) || $type == 'image';
78
  }
79
 
 
80
  /**
81
  * Build image HTML
82
+ *
83
+ * @param array $attributes
84
  * @return string image HTML
85
  */
86
+ public function build_image_tag( $attributes ) {
87
  $html = "<img";
88
 
89
+ foreach ( $attributes as $att => $val ) {
90
+ if ( strlen( $val ) ) {
91
  $html .= " " . $att . '="' . $val . '"';
92
+ } else if ( $att == 'alt' ) {
93
+ $html .= " " . $att . '=""'; // always include alt tag for HTML5 validation
94
  }
95
  }
96
 
101
 
102
  /**
103
  * Build image HTML
104
+ *
105
+ * @param array $attributes
106
  * @return string image HTML
107
  */
108
+ public function build_anchor_tag( $attributes, $content ) {
109
  $html = "<a";
110
 
111
+ foreach ( $attributes as $att => $val ) {
112
+ if ( strlen( $val ) ) {
113
  $html .= " " . $att . '="' . $val . '"';
114
  }
115
  }
122
  * Tag the slide attachment to the slider tax category
123
  */
124
  public function tag_slide_to_slider() {
125
+ if ( !term_exists( $this->slider->ID, 'ml-slider' ) ) {
126
  // create the taxonomy term, the term is the ID of the slider itself
127
+ wp_insert_term( $this->slider->ID, 'ml-slider' );
128
  }
129
 
130
  // get the term thats name is the same as the ID of the slider
131
+ $term = get_term_by( 'name', $this->slider->ID, 'ml-slider' );
132
  // tag this slide to the taxonomy term
133
+ wp_set_post_terms( $this->slide->ID, $term->term_id, 'ml-slider', true );
134
 
135
  $this->update_menu_order();
136
  }
163
  )
164
  );
165
 
166
+ $query = new WP_Query( $args );
167
 
168
+ while ( $query->have_posts() ) {
169
  $query->next_post();
170
  $menu_order = $query->post->menu_order;
171
  }
176
  $menu_order = $menu_order + 1;
177
 
178
  // update the slide
179
+ wp_update_post( array(
180
+ 'ID' => $this->slide->ID,
181
+ 'menu_order' => $menu_order
182
+ )
183
+ );
184
  }
185
 
186
  /**
188
  * If the meta exists, but the value is empty, delete it
189
  * If the meta exists, update it
190
  */
191
+ public function add_or_update_or_delete_meta( $post_id, $name, $value ) {
192
  $key = "ml-slider_" . $name;
193
 
194
+ if ( $value == 'false' || $value == "" || !$value ) {
195
+ if ( get_post_meta( $post_id, $key ) ) {
196
+ delete_post_meta( $post_id, $key );
197
  }
198
  } else {
199
+ if ( get_post_meta( $post_id, $key ) ) {
200
+ update_post_meta( $post_id, $key, $value );
201
  } else {
202
+ add_post_meta( $post_id, $key, $value, true );
203
  }
204
  }
205
  }
208
  * Get the thumbnail for the slide
209
  */
210
  public function get_thumb() {
211
+ $imageHelper = new MetaSliderImageHelper( $this->slide->ID, 150, 150, 'false' );
212
  return $imageHelper->get_image_url();
213
  }
214
  }
215
+ ?>
inc/slide/metaslide.image.class.php CHANGED
@@ -8,10 +8,10 @@ class MetaImageSlide extends MetaSlide {
8
  * Register slide type
9
  */
10
  public function __construct() {
11
- add_filter('metaslider_get_image_slide', array($this, 'get_slide'), 10, 2);
12
- add_action('metaslider_save_image_slide', array($this, 'save_slide'), 5, 3);
13
- add_action('wp_ajax_create_image_slide', array($this, 'ajax_create_slide'));
14
- add_action('wp_ajax_resize_image_slide', array($this, 'ajax_resize_slide'));
15
  }
16
 
17
  /**
@@ -19,26 +19,26 @@ class MetaImageSlide extends MetaSlide {
19
  */
20
  public function ajax_create_slide() {
21
  // security check
22
- if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'metaslider_addslide')) {
23
- echo "<tr><td colspan='2'>" . __("Security check failed. Refresh page and try again.", 'metaslider') . "</td></tr>";
24
  die();
25
  }
26
 
27
- $slider_id = intval($_POST['slider_id']);
28
  $selection = $_POST['selection'];
29
 
30
- if (is_array($selection) && count($selection) && $slider_id > 0) {
31
- foreach ($selection as $slide_id) {
32
- $this->set_slide($slide_id);
33
- $this->set_slider($slider_id);
34
 
35
- if ($this->slide_exists_in_slideshow($slider_id, $slide_id)) {
36
- echo "<tr><td colspan='2'>ID: {$slide_id} \"" . get_the_title($slide_id) . "\" - " . __("Failed to add slide. Slide already exists in slideshow.", 'metaslider') . "</td></tr>";
37
- } else if (!$this->slide_is_unassigned_or_image_slide($slider_id, $slide_id)) {
38
- echo "<tr><td colspan='2'>ID: {$slide_id} \"" . get_the_title($slide_id) . "\" - " . __("Failed to add slide. Slide is not of type 'image'.", 'metaslider') . "</td></tr>";
39
- }else {
40
  $this->tag_slide_to_slider();
41
- $this->add_or_update_or_delete_meta($slide_id, 'type', 'image');
42
 
43
  // override the width and height to kick off the AJAX image resizing on save
44
  $this->settings['width'] = 0;
@@ -56,22 +56,22 @@ class MetaImageSlide extends MetaSlide {
56
  * Create a new slide and echo the admin HTML
57
  */
58
  public function ajax_resize_slide() {
59
- check_admin_referer('metaslider_resize');
60
 
61
- $slider_id = intval($_POST['slider_id']);
62
- $slide_id = intval($_POST['slide_id']);
63
 
64
- $this->set_slide($slide_id);
65
- $this->set_slider($slider_id);
66
 
67
- $settings = get_post_meta($slider_id, 'ml-slider_settings', true);
68
 
69
  // create a copy of the correct sized image
70
  $imageHelper = new MetaSliderImageHelper(
71
  $slide_id,
72
  $settings['width'],
73
  $settings['height'],
74
- isset($settings['smartCrop']) ? $settings['smartCrop'] : 'false',
75
  $this->use_wp_image_editor()
76
  );
77
 
@@ -89,21 +89,21 @@ class MetaImageSlide extends MetaSlide {
89
  */
90
  protected function get_admin_slide() {
91
  // get some slide settings
92
- $imageHelper = new MetaSliderImageHelper($this->slide->ID, 150, 150, 'false', $this->use_wp_image_editor());
93
  $thumb = $imageHelper->get_image_url();
94
- $url = get_post_meta($this->slide->ID, 'ml-slider_url', true);
95
- $title = get_post_meta($this->slide->ID, 'ml-slider_title', true);
96
- $alt = get_post_meta($this->slide->ID, '_wp_attachment_image_alt', true);
97
- $target = get_post_meta($this->slide->ID, 'ml-slider_new_window', true) ? 'checked=checked' : '';
98
- $caption = htmlentities($this->slide->post_excerpt, ENT_QUOTES, 'UTF-8');
99
 
100
  // localisation
101
- $str_caption = __("Caption", 'metaslider');
102
- $str_new_window = __("New Window", 'metaslider');
103
- $str_url = __("URL", 'metaslider');
104
- $str_label = __("Image Slide", "metaslider");
105
 
106
- $slide_label = apply_filters("metaslider_image_slide_label", $str_label, $this->slide, $this->settings);
107
 
108
  // slide row HTML
109
  $row = "<tr class='slide image flex responsive nivo coin'>";
@@ -115,13 +115,13 @@ class MetaImageSlide extends MetaSlide {
115
  $row .= " </td>";
116
  $row .= " <td class='col-2'>";
117
  $row .= " <ul class='tabs'>";
118
- $row .= " <li class='selected' rel='tab-1'>" . __("General", "metaslider") . "</li>";
119
- $row .= " <li rel='tab-2'>" . __("SEO", "metaslider") . "</li>";
120
  $row .= " </ul>";
121
  $row .= " <div class='tabs-content'>";
122
  $row .= " <div class='tab tab-1'>";
123
- if (!$this->is_valid_image()) {
124
- $row .= "<div class='warning'>" . __('Warning: Image data does not exist. Please re-upload the image.') . "</div>";
125
  }
126
  $row .= " <textarea name='attachment[{$this->slide->ID}][post_excerpt]' placeholder='{$str_caption}'>{$caption}</textarea>";
127
  $row .= " <input class='url' type='text' name='attachment[{$this->slide->ID}][url]' placeholder='{$str_url}' value='{$url}' />";
@@ -130,9 +130,9 @@ class MetaImageSlide extends MetaSlide {
130
  $row .= " </div>";
131
  $row .= " </div>";
132
  $row .= " <div class='tab tab-2' style='display: none;'>";
133
- $row .= " <div class='row'><label>" . __("Image Title Text", "metaslider") . "</label></div>";
134
  $row .= " <div class='row'><input type='text' size='50' name='attachment[{$this->slide->ID}][title]' value='{$title}' /></div>";
135
- $row .= " <div class='row'><label>" . __("Image Alt Text", "metaslider") . "</label></div>";
136
  $row .= " <div class='row'><input type='text' size='50' name='attachment[{$this->slide->ID}][alt]' value='{$alt}' /></div>";
137
  $row .= " </div>";
138
  $row .= " </div>";
@@ -153,8 +153,8 @@ class MetaImageSlide extends MetaSlide {
153
  * @return bool, true if metadata and size exists.
154
  */
155
  public function is_valid_image() {
156
- $meta = wp_get_attachment_metadata($this->slide->ID);
157
- return isset($meta['width'], $meta['height']);
158
  }
159
 
160
  /**
@@ -163,7 +163,7 @@ class MetaImageSlide extends MetaSlide {
163
  * @return bool
164
  */
165
  public function use_wp_image_editor() {
166
- return apply_filters('metaslider_use_image_editor', $this->is_valid_image());
167
  }
168
 
169
  /**
@@ -178,7 +178,7 @@ class MetaImageSlide extends MetaSlide {
178
  $this->slide->ID,
179
  $this->settings['width'],
180
  $this->settings['height'],
181
- isset($this->settings['smartCrop']) ? $this->settings['smartCrop'] : 'false',
182
  $this->use_wp_image_editor()
183
  );
184
 
@@ -187,40 +187,40 @@ class MetaImageSlide extends MetaSlide {
187
  // store the slide details
188
  $slide = array(
189
  'id' => $this->slide->ID,
190
- 'url' => __(get_post_meta($this->slide->ID, 'ml-slider_url', true)),
191
- 'title' => __(get_post_meta($this->slide->ID, 'ml-slider_title', true)),
192
- 'target' => get_post_meta($this->slide->ID, 'ml-slider_new_window', true) ? '_blank' : '_self',
193
  'src' => $thumb,
194
  'thumb' => $thumb, // backwards compatibility with Vantage
195
  'width' => $this->settings['width'],
196
  'height' => $this->settings['height'],
197
- 'alt' => __(get_post_meta($this->slide->ID, '_wp_attachment_image_alt', true)),
198
- 'caption' => __(html_entity_decode(do_shortcode($this->slide->post_excerpt), ENT_NOQUOTES, 'UTF-8')),
199
- 'caption_raw' => __(do_shortcode($this->slide->post_excerpt)),
200
  'class' => "slider-{$this->slider->ID} slide-{$this->slide->ID}",
201
  'rel' => "",
202
  'data-thumb' => ""
203
  );
204
 
205
  // fix slide URLs
206
- if (strpos($slide['url'], 'www.') === 0) {
207
  $slide['url'] = 'http://' . $slide['url'];
208
  }
209
 
210
- $slide = apply_filters('metaslider_image_slide_attributes', $slide, $this->slider->ID, $this->settings);
211
 
212
  // return the slide HTML
213
- switch($this->settings['type']) {
214
- case "coin":
215
- return $this->get_coin_slider_markup($slide);
216
- case "flex":
217
- return $this->get_flex_slider_markup($slide);
218
- case "nivo":
219
- return $this->get_nivo_slider_markup($slide);
220
- case "responsive":
221
- return $this->get_responsive_slides_markup($slide);
222
- default:
223
- return $this->get_flex_slider_markup($slide);
224
  }
225
  }
226
 
@@ -229,31 +229,31 @@ class MetaImageSlide extends MetaSlide {
229
  *
230
  * @return string slide html
231
  */
232
- private function get_nivo_slider_markup($slide) {
233
- $attributes = apply_filters('metaslider_nivo_slider_image_attributes', array(
234
- 'src' => $slide['src'],
235
- 'height' => $slide['height'],
236
- 'width' => $slide['width'],
237
- 'data-title' => htmlentities($slide['caption_raw'], ENT_QUOTES, 'UTF-8'),
238
- 'data-thumb' => $slide['data-thumb'],
239
- 'title' => $slide['title'],
240
- 'alt' => $slide['alt'],
241
- 'rel' => $slide['rel'],
242
- 'class' => $slide['class']
243
- ), $slide, $this->slider->ID);
244
-
245
- $html = $this->build_image_tag($attributes);
246
-
247
- $anchor_attributes = apply_filters('metaslider_nivo_slider_anchor_attributes', array(
248
- 'href' => $slide['url'],
249
- 'target' => $slide['target']
250
- ), $slide, $this->slider->ID);
251
-
252
- if (strlen($anchor_attributes['href'])) {
253
- $html = $this->build_anchor_tag($anchor_attributes, $html);
254
  }
255
 
256
- return apply_filters('metaslider_image_nivo_slider_markup', $html, $slide, $this->settings);
257
  }
258
 
259
  /**
@@ -261,38 +261,38 @@ class MetaImageSlide extends MetaSlide {
261
  *
262
  * @return string slide html
263
  */
264
- private function get_flex_slider_markup($slide) {
265
- $attributes = apply_filters('metaslider_flex_slider_image_attributes', array(
266
- 'src' => $slide['src'],
267
- 'height' => $slide['height'],
268
- 'width' => $slide['width'],
269
- 'alt' => $slide['alt'],
270
- 'rel' => $slide['rel'],
271
- 'class' => $slide['class'],
272
- 'title' => $slide['title']
273
- ), $slide, $this->slider->ID);
274
-
275
- $html = $this->build_image_tag($attributes);
276
-
277
- $anchor_attributes = apply_filters('metaslider_flex_slider_anchor_attributes', array(
278
- 'href' => $slide['url'],
279
- 'target' => $slide['target']
280
- ), $slide, $this->slider->ID);
281
-
282
- if (strlen($anchor_attributes['href'])) {
283
- $html = $this->build_anchor_tag($anchor_attributes, $html);
284
  }
285
 
286
  // add caption
287
- if (strlen($slide['caption'])) {
288
  $html .= '<div class="caption-wrap"><div class="caption">' . $slide['caption'] . '</div></div>';
289
  }
290
 
291
- $thumb = isset($slide['data-thumb']) && strlen($slide['data-thumb']) ? " data-thumb=\"{$slide['data-thumb']}\"" : "";
292
 
293
- $html = '<li style="display: none;"' . $thumb . '>' . $html . '</li>';
294
 
295
- return apply_filters('metaslider_image_flex_slider_markup', $html, $slide, $this->settings);
296
  }
297
 
298
  /**
@@ -300,31 +300,31 @@ class MetaImageSlide extends MetaSlide {
300
  *
301
  * @return string slide html
302
  */
303
- private function get_coin_slider_markup($slide) {
304
- $attributes = apply_filters('metaslider_coin_slider_image_attributes', array(
305
- 'src' => $slide['src'],
306
- 'height' => $slide['height'],
307
- 'width' => $slide['width'],
308
- 'alt' => $slide['alt'],
309
- 'rel' => $slide['rel'],
310
- 'class' => $slide['class'],
311
- 'title' => $slide['title'],
312
- 'style' => 'display: none;'
313
- ), $slide, $this->slider->ID);
314
-
315
- $html = $this->build_image_tag($attributes);
316
-
317
- if (strlen($slide['caption'])) {
318
  $html .= "<span>{$slide['caption']}</span>";
319
  }
320
 
321
- $attributes = apply_filters('metaslider_coin_slider_anchor_attributes', array(
322
- 'href' => strlen($slide['url']) ? $slide['url'] : 'javascript:void(0)'
323
- ), $slide, $this->slider->ID);
324
 
325
- $html = $this->build_anchor_tag($attributes, $html);
326
 
327
- return apply_filters('metaslider_image_coin_slider_markup', $html, $slide, $this->settings);
328
  }
329
 
330
  /**
@@ -332,59 +332,59 @@ class MetaImageSlide extends MetaSlide {
332
  *
333
  * @return string slide html
334
  */
335
- private function get_responsive_slides_markup($slide) {
336
- $attributes = apply_filters('metaslider_responsive_slider_image_attributes', array(
337
- 'src' => $slide['src'],
338
- 'height' => $slide['height'],
339
- 'width' => $slide['width'],
340
- 'alt' => $slide['alt'],
341
- 'rel' => $slide['rel'],
342
- 'class' => $slide['class'],
343
- 'title' => $slide['title']
344
- ), $slide, $this->slider->ID);
345
-
346
- $html = $this->build_image_tag($attributes);
347
-
348
- if (strlen($slide['caption'])) {
349
  $html .= '<div class="caption-wrap"><div class="caption">' . $slide['caption'] . '</div></div>';
350
  }
351
 
352
- $anchor_attributes = apply_filters('metaslider_responsive_slider_anchor_attributes', array(
353
- 'href' => $slide['url'],
354
- 'target' => $slide['target']
355
- ), $slide, $this->slider->ID);
356
 
357
- if (strlen($anchor_attributes['href'])) {
358
- $html = $this->build_anchor_tag($anchor_attributes, $html);
359
  }
360
 
361
- return apply_filters('metaslider_image_responsive_slider_markup', $html, $slide, $this->settings);
362
  }
363
 
364
  /**
365
  * Save
366
  */
367
- protected function save($fields) {
368
  // update the slide
369
- wp_update_post(array(
370
- 'ID' => $this->slide->ID,
371
- 'post_excerpt' => $fields['post_excerpt'],
372
- 'menu_order' => $fields['menu_order']
373
- ));
374
 
375
  // store the URL as a meta field against the attachment
376
- $this->add_or_update_or_delete_meta($this->slide->ID, 'url', $fields['url']);
377
 
378
- $this->add_or_update_or_delete_meta($this->slide->ID, 'title', $fields['title']);
379
 
380
- if (isset($fields['alt'])) {
381
- update_post_meta($this->slide->ID, '_wp_attachment_image_alt', $fields['alt']);
382
  }
383
 
384
  // store the 'new window' setting
385
- $new_window = isset($fields['new_window']) && $fields['new_window'] == 'on' ? 'true' : 'false';
386
 
387
- $this->add_or_update_or_delete_meta($this->slide->ID, 'new_window', $new_window);
388
  }
389
  }
390
- ?>
8
  * Register slide type
9
  */
10
  public function __construct() {
11
+ add_filter( 'metaslider_get_image_slide', array( $this, 'get_slide' ), 10, 2 );
12
+ add_action( 'metaslider_save_image_slide', array( $this, 'save_slide' ), 5, 3 );
13
+ add_action( 'wp_ajax_create_image_slide', array( $this, 'ajax_create_slide' ) );
14
+ add_action( 'wp_ajax_resize_image_slide', array( $this, 'ajax_resize_slide' ) );
15
  }
16
 
17
  /**
19
  */
20
  public function ajax_create_slide() {
21
  // security check
22
+ if ( !wp_verify_nonce( $_REQUEST['_wpnonce'], 'metaslider_addslide' ) ) {
23
+ echo "<tr><td colspan='2'>" . __( "Security check failed. Refresh page and try again.", 'metaslider' ) . "</td></tr>";
24
  die();
25
  }
26
 
27
+ $slider_id = absint( $_POST['slider_id'] );
28
  $selection = $_POST['selection'];
29
 
30
+ if ( is_array( $selection ) && count( $selection ) && $slider_id > 0 ) {
31
+ foreach ( $selection as $slide_id ) {
32
+ $this->set_slide( $slide_id );
33
+ $this->set_slider( $slider_id );
34
 
35
+ if ( $this->slide_exists_in_slideshow( $slider_id, $slide_id ) ) {
36
+ echo "<tr><td colspan='2'>ID: {$slide_id} \"" . get_the_title( $slide_id ) . "\" - " . __( "Failed to add slide. Slide already exists in slideshow.", 'metaslider' ) . "</td></tr>";
37
+ } else if ( !$this->slide_is_unassigned_or_image_slide( $slider_id, $slide_id ) ) {
38
+ echo "<tr><td colspan='2'>ID: {$slide_id} \"" . get_the_title( $slide_id ) . "\" - " . __( "Failed to add slide. Slide is not of type 'image'.", 'metaslider' ) . "</td></tr>";
39
+ }else {
40
  $this->tag_slide_to_slider();
41
+ $this->add_or_update_or_delete_meta( $slide_id, 'type', 'image' );
42
 
43
  // override the width and height to kick off the AJAX image resizing on save
44
  $this->settings['width'] = 0;
56
  * Create a new slide and echo the admin HTML
57
  */
58
  public function ajax_resize_slide() {
59
+ check_admin_referer( 'metaslider_resize' );
60
 
61
+ $slider_id = absint( $_POST['slider_id'] );
62
+ $slide_id = absint( $_POST['slide_id'] );
63
 
64
+ $this->set_slide( $slide_id );
65
+ $this->set_slider( $slider_id );
66
 
67
+ $settings = get_post_meta( $slider_id, 'ml-slider_settings', true );
68
 
69
  // create a copy of the correct sized image
70
  $imageHelper = new MetaSliderImageHelper(
71
  $slide_id,
72
  $settings['width'],
73
  $settings['height'],
74
+ isset( $settings['smartCrop'] ) ? $settings['smartCrop'] : 'false',
75
  $this->use_wp_image_editor()
76
  );
77
 
89
  */
90
  protected function get_admin_slide() {
91
  // get some slide settings
92
+ $imageHelper = new MetaSliderImageHelper( $this->slide->ID, 150, 150, 'false', $this->use_wp_image_editor() );
93
  $thumb = $imageHelper->get_image_url();
94
+ $url = get_post_meta( $this->slide->ID, 'ml-slider_url', true );
95
+ $title = get_post_meta( $this->slide->ID, 'ml-slider_title', true );
96
+ $alt = get_post_meta( $this->slide->ID, '_wp_attachment_image_alt', true );
97
+ $target = get_post_meta( $this->slide->ID, 'ml-slider_new_window', true ) ? 'checked=checked' : '';
98
+ $caption = htmlentities( $this->slide->post_excerpt, ENT_QUOTES, 'UTF-8' );
99
 
100
  // localisation
101
+ $str_caption = __( "Caption", "metaslider" );
102
+ $str_new_window = __( "New Window", "metaslider" );
103
+ $str_url = __( "URL", "metaslider" );
104
+ $str_label = __( "Image Slide", "metaslider" );
105
 
106
+ $slide_label = apply_filters( "metaslider_image_slide_label", $str_label, $this->slide, $this->settings );
107
 
108
  // slide row HTML
109
  $row = "<tr class='slide image flex responsive nivo coin'>";
115
  $row .= " </td>";
116
  $row .= " <td class='col-2'>";
117
  $row .= " <ul class='tabs'>";
118
+ $row .= " <li class='selected' rel='tab-1'>" . __( "General", "metaslider" ) . "</li>";
119
+ $row .= " <li rel='tab-2'>" . __( "SEO", "metaslider" ) . "</li>";
120
  $row .= " </ul>";
121
  $row .= " <div class='tabs-content'>";
122
  $row .= " <div class='tab tab-1'>";
123
+ if ( !$this->is_valid_image() ) {
124
+ $row .= "<div class='warning'>" . __( "Warning: Image data does not exist. Please re-upload the image.", "metaslider" ) . "</div>";
125
  }
126
  $row .= " <textarea name='attachment[{$this->slide->ID}][post_excerpt]' placeholder='{$str_caption}'>{$caption}</textarea>";
127
  $row .= " <input class='url' type='text' name='attachment[{$this->slide->ID}][url]' placeholder='{$str_url}' value='{$url}' />";
130
  $row .= " </div>";
131
  $row .= " </div>";
132
  $row .= " <div class='tab tab-2' style='display: none;'>";
133
+ $row .= " <div class='row'><label>" . __( "Image Title Text", "metaslider" ) . "</label></div>";
134
  $row .= " <div class='row'><input type='text' size='50' name='attachment[{$this->slide->ID}][title]' value='{$title}' /></div>";
135
+ $row .= " <div class='row'><label>" . __( "Image Alt Text", "metaslider" ) . "</label></div>";
136
  $row .= " <div class='row'><input type='text' size='50' name='attachment[{$this->slide->ID}][alt]' value='{$alt}' /></div>";
137
  $row .= " </div>";
138
  $row .= " </div>";
153
  * @return bool, true if metadata and size exists.
154
  */
155
  public function is_valid_image() {
156
+ $meta = wp_get_attachment_metadata( $this->slide->ID );
157
+ return isset( $meta['width'], $meta['height'] );
158
  }
159
 
160
  /**
163
  * @return bool
164
  */
165
  public function use_wp_image_editor() {
166
+ return apply_filters( 'metaslider_use_image_editor', $this->is_valid_image() );
167
  }
168
 
169
  /**
178
  $this->slide->ID,
179
  $this->settings['width'],
180
  $this->settings['height'],
181
+ isset( $this->settings['smartCrop'] ) ? $this->settings['smartCrop'] : 'false',
182
  $this->use_wp_image_editor()
183
  );
184
 
187
  // store the slide details
188
  $slide = array(
189
  'id' => $this->slide->ID,
190
+ 'url' => __( get_post_meta( $this->slide->ID, 'ml-slider_url', true ) ),
191
+ 'title' => __( get_post_meta( $this->slide->ID, 'ml-slider_title', true ) ),
192
+ 'target' => get_post_meta( $this->slide->ID, 'ml-slider_new_window', true ) ? '_blank' : '_self',
193
  'src' => $thumb,
194
  'thumb' => $thumb, // backwards compatibility with Vantage
195
  'width' => $this->settings['width'],
196
  'height' => $this->settings['height'],
197
+ 'alt' => __( get_post_meta( $this->slide->ID, '_wp_attachment_image_alt', true ) ),
198
+ 'caption' => __( html_entity_decode( do_shortcode( $this->slide->post_excerpt ), ENT_NOQUOTES, 'UTF-8' ) ),
199
+ 'caption_raw' => __( do_shortcode( $this->slide->post_excerpt ) ),
200
  'class' => "slider-{$this->slider->ID} slide-{$this->slide->ID}",
201
  'rel' => "",
202
  'data-thumb' => ""
203
  );
204
 
205
  // fix slide URLs
206
+ if ( strpos( $slide['url'], 'www.' ) === 0 ) {
207
  $slide['url'] = 'http://' . $slide['url'];
208
  }
209
 
210
+ $slide = apply_filters( 'metaslider_image_slide_attributes', $slide, $this->slider->ID, $this->settings );
211
 
212
  // return the slide HTML
213
+ switch ( $this->settings['type'] ) {
214
+ case "coin":
215
+ return $this->get_coin_slider_markup( $slide );
216
+ case "flex":
217
+ return $this->get_flex_slider_markup( $slide );
218
+ case "nivo":
219
+ return $this->get_nivo_slider_markup( $slide );
220
+ case "responsive":
221
+ return $this->get_responsive_slides_markup( $slide );
222
+ default:
223
+ return $this->get_flex_slider_markup( $slide );
224
  }
225
  }
226
 
229
  *
230
  * @return string slide html
231
  */
232
+ private function get_nivo_slider_markup( $slide ) {
233
+ $attributes = apply_filters( 'metaslider_nivo_slider_image_attributes', array(
234
+ 'src' => $slide['src'],
235
+ 'height' => $slide['height'],
236
+ 'width' => $slide['width'],
237
+ 'data-title' => htmlentities( $slide['caption_raw'], ENT_QUOTES, 'UTF-8' ),
238
+ 'data-thumb' => $slide['data-thumb'],
239
+ 'title' => $slide['title'],
240
+ 'alt' => $slide['alt'],
241
+ 'rel' => $slide['rel'],
242
+ 'class' => $slide['class']
243
+ ), $slide, $this->slider->ID );
244
+
245
+ $html = $this->build_image_tag( $attributes );
246
+
247
+ $anchor_attributes = apply_filters( 'metaslider_nivo_slider_anchor_attributes', array(
248
+ 'href' => $slide['url'],
249
+ 'target' => $slide['target']
250
+ ), $slide, $this->slider->ID );
251
+
252
+ if ( strlen( $anchor_attributes['href'] ) ) {
253
+ $html = $this->build_anchor_tag( $anchor_attributes, $html );
254
  }
255
 
256
+ return apply_filters( 'metaslider_image_nivo_slider_markup', $html, $slide, $this->settings );
257
  }
258
 
259
  /**
261
  *
262
  * @return string slide html
263
  */
264
+ private function get_flex_slider_markup( $slide ) {
265
+ $attributes = apply_filters( 'metaslider_flex_slider_image_attributes', array(
266
+ 'src' => $slide['src'],
267
+ 'height' => $slide['height'],
268
+ 'width' => $slide['width'],
269
+ 'alt' => $slide['alt'],
270
+ 'rel' => $slide['rel'],
271
+ 'class' => $slide['class'],
272
+ 'title' => $slide['title']
273
+ ), $slide, $this->slider->ID );
274
+
275
+ $html = $this->build_image_tag( $attributes );
276
+
277
+ $anchor_attributes = apply_filters( 'metaslider_flex_slider_anchor_attributes', array(
278
+ 'href' => $slide['url'],
279
+ 'target' => $slide['target']
280
+ ), $slide, $this->slider->ID );
281
+
282
+ if ( strlen( $anchor_attributes['href'] ) ) {
283
+ $html = $this->build_anchor_tag( $anchor_attributes, $html );
284
  }
285
 
286
  // add caption
287
+ if ( strlen( $slide['caption'] ) ) {
288
  $html .= '<div class="caption-wrap"><div class="caption">' . $slide['caption'] . '</div></div>';
289
  }
290
 
291
+ $thumb = isset( $slide['data-thumb'] ) && strlen( $slide['data-thumb'] ) ? " data-thumb=\"{$slide['data-thumb']}\"" : "";
292
 
293
+ $html = '<li style="display: none; float: left; width: 100%;"' . $thumb . '>' . $html . '</li>';
294
 
295
+ return apply_filters( 'metaslider_image_flex_slider_markup', $html, $slide, $this->settings );
296
  }
297
 
298
  /**
300
  *
301
  * @return string slide html
302
  */
303
+ private function get_coin_slider_markup( $slide ) {
304
+ $attributes = apply_filters( 'metaslider_coin_slider_image_attributes', array(
305
+ 'src' => $slide['src'],
306
+ 'height' => $slide['height'],
307
+ 'width' => $slide['width'],
308
+ 'alt' => $slide['alt'],
309
+ 'rel' => $slide['rel'],
310
+ 'class' => $slide['class'],
311
+ 'title' => $slide['title'],
312
+ 'style' => 'display: none;'
313
+ ), $slide, $this->slider->ID );
314
+
315
+ $html = $this->build_image_tag( $attributes );
316
+
317
+ if ( strlen( $slide['caption'] ) ) {
318
  $html .= "<span>{$slide['caption']}</span>";
319
  }
320
 
321
+ $attributes = apply_filters( 'metaslider_coin_slider_anchor_attributes', array(
322
+ 'href' => strlen( $slide['url'] ) ? $slide['url'] : 'javascript:void(0)'
323
+ ), $slide, $this->slider->ID );
324
 
325
+ $html = $this->build_anchor_tag( $attributes, $html );
326
 
327
+ return apply_filters( 'metaslider_image_coin_slider_markup', $html, $slide, $this->settings );
328
  }
329
 
330
  /**
332
  *
333
  * @return string slide html
334
  */
335
+ private function get_responsive_slides_markup( $slide ) {
336
+ $attributes = apply_filters( 'metaslider_responsive_slider_image_attributes', array(
337
+ 'src' => $slide['src'],
338
+ 'height' => $slide['height'],
339
+ 'width' => $slide['width'],
340
+ 'alt' => $slide['alt'],
341
+ 'rel' => $slide['rel'],
342
+ 'class' => $slide['class'],
343
+ 'title' => $slide['title']
344
+ ), $slide, $this->slider->ID );
345
+
346
+ $html = $this->build_image_tag( $attributes );
347
+
348
+ if ( strlen( $slide['caption'] ) ) {
349
  $html .= '<div class="caption-wrap"><div class="caption">' . $slide['caption'] . '</div></div>';
350
  }
351
 
352
+ $anchor_attributes = apply_filters( 'metaslider_responsive_slider_anchor_attributes', array(
353
+ 'href' => $slide['url'],
354
+ 'target' => $slide['target']
355
+ ), $slide, $this->slider->ID );
356
 
357
+ if ( strlen( $anchor_attributes['href'] ) ) {
358
+ $html = $this->build_anchor_tag( $anchor_attributes, $html );
359
  }
360
 
361
+ return apply_filters( 'metaslider_image_responsive_slider_markup', $html, $slide, $this->settings );
362
  }
363
 
364
  /**
365
  * Save
366
  */
367
+ protected function save( $fields ) {
368
  // update the slide
369
+ wp_update_post( array(
370
+ 'ID' => $this->slide->ID,
371
+ 'post_excerpt' => $fields['post_excerpt'],
372
+ 'menu_order' => $fields['menu_order']
373
+ ) );
374
 
375
  // store the URL as a meta field against the attachment
376
+ $this->add_or_update_or_delete_meta( $this->slide->ID, 'url', $fields['url'] );
377
 
378
+ $this->add_or_update_or_delete_meta( $this->slide->ID, 'title', $fields['title'] );
379
 
380
+ if ( isset( $fields['alt'] ) ) {
381
+ update_post_meta( $this->slide->ID, '_wp_attachment_image_alt', $fields['alt'] );
382
  }
383
 
384
  // store the 'new window' setting
385
+ $new_window = isset( $fields['new_window'] ) && $fields['new_window'] == 'on' ? 'true' : 'false';
386
 
387
+ $this->add_or_update_or_delete_meta( $this->slide->ID, 'new_window', $new_window );
388
  }
389
  }
390
+ ?>
inc/slider/metaslider.class.php CHANGED
@@ -15,9 +15,9 @@ class MetaSlider {
15
  /**
16
  * Constructor
17
  */
18
- public function __construct($id, $shortcode_settings) {
19
  $this->id = $id;
20
- $this->settings = array_merge($shortcode_settings, $this->get_settings());
21
  $this->identifier = 'metaslider_' . $this->id;
22
  $this->save();
23
  $this->populate_slides();
@@ -38,12 +38,11 @@ class MetaSlider {
38
  * @return array slider settings
39
  */
40
  private function get_settings() {
41
- $settings = get_post_meta($this->id, 'ml-slider_settings', true);
42
 
43
- if (is_array($settings) &&
44
- isset($settings['type']) &&
45
- in_array($settings['type'], array('flex', 'coin', 'nivo', 'responsive')))
46
- {
47
  return $settings;
48
  } else {
49
  return $this->get_default_parameters();
@@ -53,18 +52,18 @@ class MetaSlider {
53
  /**
54
  * Return an individual setting
55
  *
56
- * @param string $name Name of the setting
57
  * @return string setting value or 'false'
58
  */
59
- public function get_setting($name) {
60
- if (!isset($this->settings[$name])) {
61
  $defaults = $this->get_default_parameters();
62
 
63
- if (isset($defaults[$name])) {
64
  return $defaults[$name] ? $defaults[$name] : 'false';
65
  }
66
  } else {
67
- if (strlen($this->settings[$name]) > 0) {
68
  return $this->settings[$name];
69
  }
70
  }
@@ -114,10 +113,10 @@ class MetaSlider {
114
  'thumb_width' => 150,
115
  'thumb_height' => 100,
116
  'fullWidth' => false,
117
- 'noConflict' => false
118
  );
119
 
120
- $params = apply_filters('metaslider_default_parameters', $params);
121
 
122
  return $params;
123
  }
@@ -126,34 +125,48 @@ class MetaSlider {
126
  * Save the slider details and initiate the update of all slides associated with slider.
127
  */
128
  private function save() {
129
- if (!is_admin()) {
130
  return;
131
  }
132
 
 
 
133
  // make changes to slider
134
- if (isset($_POST['settings'])) {
135
- check_admin_referer('metaslider_save_' . $this->id);
136
- $this->update_settings($_POST['settings']);
 
137
  }
138
- if (isset($_POST['title'])) {
139
- check_admin_referer('metaslider_save_' . $this->id);
140
- $this->update_title($_POST['title']);
 
 
141
  }
142
- if (isset($_GET['deleteSlide'])) {
143
- $this->delete_slide(intval($_GET['deleteSlide']));
 
 
144
  }
145
 
146
  // make changes to slides
147
- if (isset($_POST['attachment'])) {
148
- check_admin_referer('metaslider_save_' . $this->id);
149
- $this->update_slides($_POST['attachment']);
 
 
 
 
 
 
 
150
  }
151
  }
152
 
153
  /**
154
  * The main query for extracting the slides for the slideshow
155
  */
156
- public function get_slides() {
157
  $args = array(
158
  'force_no_custom_order' => true,
159
  'orderby' => 'menu_order',
@@ -172,12 +185,12 @@ class MetaSlider {
172
  )
173
  );
174
 
175
- $args = apply_filters('metaslider_populate_slides_args', $args, $this->id, $this->settings);
176
 
177
- $query = new WP_Query($args);
178
 
179
  return $query;
180
- }
181
 
182
  /**
183
  * Return slides for the current slider
@@ -189,17 +202,17 @@ class MetaSlider {
189
 
190
  $query = $this->get_slides();
191
 
192
- while ($query->have_posts()) {
193
  $query->next_post();
194
 
195
- $type = get_post_meta($query->post->ID, 'ml-slider_type', true);
196
  $type = $type ? $type : 'image'; // backwards compatibility, fall back to 'image'
197
 
198
- if (has_filter("metaslider_get_{$type}_slide")) {
199
- $return = apply_filters("metaslider_get_{$type}_slide", $query->post->ID, $this->id);
200
 
201
- if (is_array($return)) {
202
- $slides = array_merge($slides, $return);
203
  } else {
204
  $slides[] = $return;
205
  }
@@ -207,8 +220,8 @@ class MetaSlider {
207
  }
208
 
209
  // apply random setting
210
- if ($this->get_setting('random') == 'true' && !is_admin()) {
211
- shuffle($slides);
212
  }
213
 
214
  $this->slides = $slides;
@@ -220,7 +233,7 @@ class MetaSlider {
220
  * Render each slide belonging to the slider out to the screen
221
  */
222
  public function render_admin_slides() {
223
- foreach($this->slides as $slide) {
224
  echo $slide;
225
  }
226
  }
@@ -244,9 +257,9 @@ class MetaSlider {
244
  $html[] = '</div>';
245
  $html[] = '<!--// meta slider-->';
246
 
247
- $slideshow = implode("\n", $html);
248
 
249
- $slideshow = apply_filters('metaslider_slideshow_output', $slideshow, $this->id, $this->settings);
250
 
251
  return $slideshow;
252
  }
@@ -257,7 +270,7 @@ class MetaSlider {
257
  private function get_container_id() {
258
  $container_id = 'metaslider_container_' . $this->id;
259
 
260
- $id = apply_filters('metaslider_container_id', $container_id, $this->id, $this->settings);
261
 
262
  return $id;
263
  }
@@ -266,15 +279,15 @@ class MetaSlider {
266
  * Return the classes to use for the slidehsow container
267
  */
268
  private function get_container_class() {
269
- $class = "metaslider metaslider-{$this->get_setting('type')} metaslider-{$this->id} ml-slider";
270
 
271
  // apply the css class setting
272
- if ($this->get_setting('cssClass') != 'false') {
273
- $class .= " " . $this->get_setting('cssClass');
274
  }
275
 
276
  // handle any custom classes
277
- $class = apply_filters('metaslider_css_classes', $class, $this->id, $this->settings);
278
 
279
  return $class;
280
  }
@@ -284,25 +297,25 @@ class MetaSlider {
284
  */
285
  private function get_container_style() {
286
  // default
287
- $style = "max-width: {$this->get_setting('width')}px;";
288
 
289
  // carousels are always 100% wide
290
- if ($this->get_setting('carouselMode') == 'true' || ($this->get_setting('fullWidth') == 'true') && $this->get_setting('type') != 'coin') {
291
  $style = "width: 100%;";
292
  }
293
 
294
  // percentWidth showcode parameter takes precedence
295
- if ($this->get_setting('percentwidth') != 'false' && $this->get_setting('percentwidth') > 0) {
296
- $style = "width: {$this->get_setting('percentwidth')}%;";
297
  }
298
 
299
  // center align the slideshow
300
- if ($this->get_setting('center') != 'false') {
301
  $style .= " margin: 0 auto;";
302
  }
303
 
304
  // handle any custom container styles
305
- $style = apply_filters('metaslider_container_style', $style, $this->id, $this->settings);
306
 
307
  return $style;
308
  }
@@ -320,17 +333,21 @@ class MetaSlider {
320
  $custom_js_before = $this->get_custom_javascript_before();
321
  $custom_js_after = $this->get_custom_javascript_after();
322
 
323
- $script = "var " . $this->identifier . " = function($) {";
 
 
324
  $script .= $custom_js_before;
325
- $script .= "\n $('#" . $this->identifier . "')." . $this->js_function . "({ ";
326
  $script .= "\n " . $this->get_javascript_parameters();
327
  $script .= "\n });";
328
  $script .= $custom_js_after;
329
  $script .= "\n };";
330
- $script .= "\n var timer_" . $this->identifier . " = function() {";
331
- $script .= "\n var slider = !window.jQuery ? window.setTimeout(timer_{$this->identifier}, 100) : !jQuery.isReady ? window.setTimeout(timer_{$this->identifier}, 100) : {$this->identifier}(window.jQuery);";
 
 
332
  $script .= "\n };";
333
- $script .= "\n timer_" . $this->identifier . "();";
334
 
335
  return $script;
336
  }
@@ -339,11 +356,11 @@ class MetaSlider {
339
  * Custom HTML to add immediately below the markup
340
  */
341
  private function get_html_after() {
342
- $type = $this->get_setting('type');
343
 
344
- $html = apply_filters("metaslider_{$type}_slider_html_after", "", $this->id, $this->settings);
345
 
346
- if (strlen($html)) {
347
  return " {$html}";
348
  }
349
 
@@ -354,17 +371,17 @@ class MetaSlider {
354
  * Custom JavaScript to execute immediately before the slideshow is initialized
355
  */
356
  private function get_custom_javascript_before() {
357
- $type = $this->get_setting('type');
358
 
359
  $javascript = "";
360
 
361
- if ($this->get_setting('noConflict') == 'true' && $type == 'flex') {
362
  $javascript = "$('#metaslider_{$this->id}').addClass('flexslider'); // theme/plugin conflict avoidance";
363
  }
364
 
365
- $custom_js = apply_filters("metaslider_{$type}_slider_javascript_before", $javascript, $this->id);
366
 
367
- if (strlen($custom_js)) {
368
  return "\n {$custom_js}";
369
  }
370
 
@@ -375,12 +392,12 @@ class MetaSlider {
375
  * Custom Javascript to execute immediately after the slideshow is initialized
376
  */
377
  private function get_custom_javascript_after() {
378
- $type = $this->get_setting('type');
379
 
380
- $custom_js = apply_filters("metaslider_{$type}_slider_javascript", "", $this->id);
381
 
382
- if (strlen($custom_js)) {
383
- return "\n {$custom_js}";
384
  }
385
 
386
  return "";
@@ -395,11 +412,11 @@ class MetaSlider {
395
  $options = array();
396
 
397
  // construct an array of all parameters
398
- foreach ($this->get_default_parameters() as $name => $default) {
399
- if ($param = $this->get_param($name)) {
400
- $val = $this->get_setting($name);
401
 
402
- if (gettype($default) == 'integer' || $val == 'true' || $val == 'false') {
403
  $options[$param] = $val;
404
  } else {
405
  $options[$param] = '"' . $val . '"';
@@ -408,22 +425,22 @@ class MetaSlider {
408
  }
409
 
410
  // deal with any customised parameters
411
- $type = $this->get_setting('type');
412
- $options = apply_filters("metaslider_{$type}_slider_parameters", $options, $this->id, $this->settings);
413
  $arg = $type == 'flex' ? 'slider' : '';
414
 
415
  // create key:value strings
416
- foreach ($options as $key => $value) {
417
- if (is_array($value)) {
418
  $pairs[] = "{$key}: function($arg) {\n "
419
- . implode("\n ", $value)
420
- . "\n }";
421
  } else {
422
  $pairs[] = "{$key}:{$value}";
423
  }
424
  }
425
 
426
- return implode(",\n ", $pairs);
427
  }
428
 
429
  /**
@@ -432,13 +449,13 @@ class MetaSlider {
432
  * @return string
433
  */
434
  private function get_inline_css() {
435
- $css = apply_filters("metaslider_css", "", $this->settings, $this->id);
436
 
437
  // use this to add the scoped attribute for HTML5 validation (if needed)
438
- $attributes = apply_filters("metaslider_style_attributes", "", $this->settings, $this->id);
439
 
440
- if (strlen($css)) {
441
- return "<style type=\"text/css\"{$attributes}>{$css}\n </style>";
442
  }
443
 
444
  return "";
@@ -448,31 +465,31 @@ class MetaSlider {
448
  * Include slider assets, JS and CSS paths are specified by child classes.
449
  */
450
  public function enqueue_scripts() {
451
- if ($this->get_setting('printJs') == 'true') {
452
- wp_enqueue_script('metaslider-' . $this->get_setting('type') . '-slider', METASLIDER_ASSETS_URL . $this->js_path, array('jquery'), METASLIDER_VERSION);
453
  }
454
 
455
- if ($this->get_setting('printCss') == 'true') {
456
  // this will be added to the bottom of the page as <head> has already been processed by WordPress.
457
  // For HTML5 compatibility, use a minification plugin to move the CSS to the <head>
458
- wp_enqueue_style('metaslider-' . $this->get_setting('type') . '-slider', METASLIDER_ASSETS_URL . $this->css_path, false, METASLIDER_VERSION);
459
- wp_enqueue_style('metaslider-public', METASLIDER_ASSETS_URL . 'metaslider/public.css', false, METASLIDER_VERSION);
460
  }
461
 
462
- do_action('metaslider_register_public_styles');
463
  }
464
 
465
  /**
466
  * Update the slider settings, converting checkbox values (on/off) to true or false.
467
  */
468
- public function update_settings($new_settings) {
469
  $old_settings = $this->get_settings();
470
 
471
  // convert submitted checkbox values from 'on' or 'off' to boolean values
472
- $checkboxes = array('noConflict', 'fullWidth', 'hoverPause', 'links', 'reverse', 'random', 'printCss', 'printJs', 'smoothHeight', 'center', 'smartCrop', 'carouselMode', 'autoPlay');
473
 
474
- foreach ($checkboxes as $checkbox) {
475
- if (isset($new_settings[$checkbox]) && $new_settings[$checkbox] == 'on') {
476
  $new_settings[$checkbox] = "true";
477
  } else {
478
  $new_settings[$checkbox] = "false";
@@ -480,7 +497,7 @@ class MetaSlider {
480
  }
481
 
482
  // update the slider settings
483
- update_post_meta($this->id, 'ml-slider_settings', array_merge((array)$old_settings, $new_settings));
484
 
485
  $this->settings = $this->get_settings();
486
  }
@@ -488,44 +505,44 @@ class MetaSlider {
488
  /**
489
  * Update the title of the slider
490
  */
491
- private function update_title($title) {
492
  $slide = array(
493
  'ID' => $this->id,
494
  'post_title' => $title
495
  );
496
 
497
- wp_update_post($slide);
498
  }
499
 
500
  /**
501
  * Delete a slide. This doesn't actually remove the slide from WordPress, simply untags
502
  * it from the slide taxonomy.
503
  *
504
- * @param int $slide_id
505
  */
506
- private function delete_slide($slide_id) {
507
  // Get the existing terms and only keep the ones we don't want removed
508
  $new_terms = array();
509
- $current_terms = wp_get_object_terms($slide_id, 'ml-slider', array('fields' => 'ids'));
510
- $term = get_term_by('name', $this->id, 'ml-slider');
511
 
512
- foreach ($current_terms as $current_term) {
513
- if ($current_term != $term->term_id) {
514
- $new_terms[] = intval($current_term);
515
  }
516
  }
517
 
518
- return wp_set_object_terms($slide_id, $new_terms, 'ml-slider');
519
  }
520
 
521
  /**
522
  * Loop over each slide and call the save action on each
523
  *
524
- * @param array $data - posted form data.
525
  */
526
- private function update_slides($data) {
527
- foreach ($data as $slide_id => $fields) {
528
- do_action("metaslider_save_{$fields['type']}_slide", $slide_id, $this->id, $fields);
529
  }
530
  }
531
  }
15
  /**
16
  * Constructor
17
  */
18
+ public function __construct( $id, $shortcode_settings ) {
19
  $this->id = $id;
20
+ $this->settings = array_merge( $shortcode_settings, $this->get_settings() );
21
  $this->identifier = 'metaslider_' . $this->id;
22
  $this->save();
23
  $this->populate_slides();
38
  * @return array slider settings
39
  */
40
  private function get_settings() {
41
+ $settings = get_post_meta( $this->id, 'ml-slider_settings', true );
42
 
43
+ if ( is_array( $settings ) &&
44
+ isset( $settings['type'] ) &&
45
+ in_array( $settings['type'], array( 'flex', 'coin', 'nivo', 'responsive' ) ) ) {
 
46
  return $settings;
47
  } else {
48
  return $this->get_default_parameters();
52
  /**
53
  * Return an individual setting
54
  *
55
+ * @param string $name Name of the setting
56
  * @return string setting value or 'false'
57
  */
58
+ public function get_setting( $name ) {
59
+ if ( !isset( $this->settings[$name] ) ) {
60
  $defaults = $this->get_default_parameters();
61
 
62
+ if ( isset( $defaults[$name] ) ) {
63
  return $defaults[$name] ? $defaults[$name] : 'false';
64
  }
65
  } else {
66
+ if ( strlen( $this->settings[$name] ) > 0 ) {
67
  return $this->settings[$name];
68
  }
69
  }
113
  'thumb_width' => 150,
114
  'thumb_height' => 100,
115
  'fullWidth' => false,
116
+ 'noConflict' => true
117
  );
118
 
119
+ $params = apply_filters( 'metaslider_default_parameters', $params );
120
 
121
  return $params;
122
  }
125
  * Save the slider details and initiate the update of all slides associated with slider.
126
  */
127
  private function save() {
128
+ if ( !is_admin() ) {
129
  return;
130
  }
131
 
132
+ $changes_made = false;
133
+
134
  // make changes to slider
135
+ if ( isset( $_POST['settings'] ) ) {
136
+ check_admin_referer( 'metaslider_save_' . $this->id );
137
+ $this->update_settings( $_POST['settings'] );
138
+ $changes_made = true;
139
  }
140
+
141
+ if ( isset( $_POST['title'] ) ) {
142
+ check_admin_referer( 'metaslider_save_' . $this->id );
143
+ $this->update_title( $_POST['title'] );
144
+ $changes_made = true;
145
  }
146
+
147
+ if ( isset( $_GET['deleteSlide'] ) ) {
148
+ $this->delete_slide( absint( $_GET['deleteSlide'] ) );
149
+ $changes_made = true;
150
  }
151
 
152
  // make changes to slides
153
+ if ( isset( $_POST['attachment'] ) ) {
154
+ check_admin_referer( 'metaslider_save_' . $this->id );
155
+ $this->update_slides( $_POST['attachment'] );
156
+ $changes_made = true;
157
+ }
158
+
159
+ // Clear current blog's WP Super Cache files when slideshow is modified
160
+ if ( $changes_made && function_exists( 'wp_cache_clear_cache' ) ) {
161
+ global $wpdb;
162
+ wp_cache_clear_cache( $wpdb->blogid );
163
  }
164
  }
165
 
166
  /**
167
  * The main query for extracting the slides for the slideshow
168
  */
169
+ public function get_slides() {
170
  $args = array(
171
  'force_no_custom_order' => true,
172
  'orderby' => 'menu_order',
185
  )
186
  );
187
 
188
+ $args = apply_filters( 'metaslider_populate_slides_args', $args, $this->id, $this->settings );
189
 
190
+ $query = new WP_Query( $args );
191
 
192
  return $query;
193
+ }
194
 
195
  /**
196
  * Return slides for the current slider
202
 
203
  $query = $this->get_slides();
204
 
205
+ while ( $query->have_posts() ) {
206
  $query->next_post();
207
 
208
+ $type = get_post_meta( $query->post->ID, 'ml-slider_type', true );
209
  $type = $type ? $type : 'image'; // backwards compatibility, fall back to 'image'
210
 
211
+ if ( has_filter( "metaslider_get_{$type}_slide" ) ) {
212
+ $return = apply_filters( "metaslider_get_{$type}_slide", $query->post->ID, $this->id );
213
 
214
+ if ( is_array( $return ) ) {
215
+ $slides = array_merge( $slides, $return );
216
  } else {
217
  $slides[] = $return;
218
  }
220
  }
221
 
222
  // apply random setting
223
+ if ( $this->get_setting( 'random' ) == 'true' && !is_admin() ) {
224
+ shuffle( $slides );
225
  }
226
 
227
  $this->slides = $slides;
233
  * Render each slide belonging to the slider out to the screen
234
  */
235
  public function render_admin_slides() {
236
+ foreach ( $this->slides as $slide ) {
237
  echo $slide;
238
  }
239
  }
257
  $html[] = '</div>';
258
  $html[] = '<!--// meta slider-->';
259
 
260
+ $slideshow = implode( "\n", $html );
261
 
262
+ $slideshow = apply_filters( 'metaslider_slideshow_output', $slideshow, $this->id, $this->settings );
263
 
264
  return $slideshow;
265
  }
270
  private function get_container_id() {
271
  $container_id = 'metaslider_container_' . $this->id;
272
 
273
+ $id = apply_filters( 'metaslider_container_id', $container_id, $this->id, $this->settings );
274
 
275
  return $id;
276
  }
279
  * Return the classes to use for the slidehsow container
280
  */
281
  private function get_container_class() {
282
+ $class = "metaslider metaslider-{$this->get_setting( 'type' )} metaslider-{$this->id} ml-slider";
283
 
284
  // apply the css class setting
285
+ if ( $this->get_setting( 'cssClass' ) != 'false' ) {
286
+ $class .= " " . $this->get_setting( 'cssClass' );
287
  }
288
 
289
  // handle any custom classes
290
+ $class = apply_filters( 'metaslider_css_classes', $class, $this->id, $this->settings );
291
 
292
  return $class;
293
  }
297
  */
298
  private function get_container_style() {
299
  // default
300
+ $style = "max-width: {$this->get_setting( 'width' )}px;";
301
 
302
  // carousels are always 100% wide
303
+ if ( $this->get_setting( 'carouselMode' ) == 'true' || ( $this->get_setting( 'fullWidth' ) == 'true' ) && $this->get_setting( 'type' ) != 'coin' ) {
304
  $style = "width: 100%;";
305
  }
306
 
307
  // percentWidth showcode parameter takes precedence
308
+ if ( $this->get_setting( 'percentwidth' ) != 'false' && $this->get_setting( 'percentwidth' ) > 0 ) {
309
+ $style = "width: {$this->get_setting( 'percentwidth' )}%;";
310
  }
311
 
312
  // center align the slideshow
313
+ if ( $this->get_setting( 'center' ) != 'false' ) {
314
  $style .= " margin: 0 auto;";
315
  }
316
 
317
  // handle any custom container styles
318
+ $style = apply_filters( 'metaslider_container_style', $style, $this->id, $this->settings );
319
 
320
  return $style;
321
  }
333
  $custom_js_before = $this->get_custom_javascript_before();
334
  $custom_js_after = $this->get_custom_javascript_after();
335
 
336
+ $identifier = $this->get_identifier();
337
+
338
+ $script = "var " . $identifier . " = function($) {";
339
  $script .= $custom_js_before;
340
+ $script .= "\n $('#" . $identifier . "')." . $this->js_function . "({ ";
341
  $script .= "\n " . $this->get_javascript_parameters();
342
  $script .= "\n });";
343
  $script .= $custom_js_after;
344
  $script .= "\n };";
345
+ $script .= "\n var timer_" . $identifier . " = function() {";
346
+ // this would be the sensible way to do it, but WordPress sometimes converts && to &#038;&
347
+ // window.jQuery && jQuery.isReady ? {$identifier}(window.jQuery) : window.setTimeout(timer_{$identifier}, 1);";
348
+ $script .= "\n var slider = !window.jQuery ? window.setTimeout(timer_{$this->identifier}, 100) : !jQuery.isReady ? window.setTimeout(timer_{$this->identifier}, 1) : {$this->identifier}(window.jQuery);";
349
  $script .= "\n };";
350
+ $script .= "\n timer_" . $identifier . "();";
351
 
352
  return $script;
353
  }
356
  * Custom HTML to add immediately below the markup
357
  */
358
  private function get_html_after() {
359
+ $type = $this->get_setting( 'type' );
360
 
361
+ $html = apply_filters( "metaslider_{$type}_slider_html_after", "", $this->id, $this->settings );
362
 
363
+ if ( strlen( $html ) ) {
364
  return " {$html}";
365
  }
366
 
371
  * Custom JavaScript to execute immediately before the slideshow is initialized
372
  */
373
  private function get_custom_javascript_before() {
374
+ $type = $this->get_setting( 'type' );
375
 
376
  $javascript = "";
377
 
378
+ if ( $this->get_setting( 'noConflict' ) == 'true' && $type == 'flex' ) {
379
  $javascript = "$('#metaslider_{$this->id}').addClass('flexslider'); // theme/plugin conflict avoidance";
380
  }
381
 
382
+ $custom_js = apply_filters( "metaslider_{$type}_slider_javascript_before", $javascript, $this->id );
383
 
384
+ if ( strlen( $custom_js ) ) {
385
  return "\n {$custom_js}";
386
  }
387
 
392
  * Custom Javascript to execute immediately after the slideshow is initialized
393
  */
394
  private function get_custom_javascript_after() {
395
+ $type = $this->get_setting( 'type' );
396
 
397
+ $custom_js = apply_filters( "metaslider_{$type}_slider_javascript", "", $this->id );
398
 
399
+ if ( strlen( $custom_js ) ) {
400
+ return " {$custom_js}";
401
  }
402
 
403
  return "";
412
  $options = array();
413
 
414
  // construct an array of all parameters
415
+ foreach ( $this->get_default_parameters() as $name => $default ) {
416
+ if ( $param = $this->get_param( $name ) ) {
417
+ $val = $this->get_setting( $name );
418
 
419
+ if ( gettype( $default ) == 'integer' || $val == 'true' || $val == 'false' ) {
420
  $options[$param] = $val;
421
  } else {
422
  $options[$param] = '"' . $val . '"';
425
  }
426
 
427
  // deal with any customised parameters
428
+ $type = $this->get_setting( 'type' );
429
+ $options = apply_filters( "metaslider_{$type}_slider_parameters", $options, $this->id, $this->settings );
430
  $arg = $type == 'flex' ? 'slider' : '';
431
 
432
  // create key:value strings
433
+ foreach ( $options as $key => $value ) {
434
+ if ( is_array( $value ) ) {
435
  $pairs[] = "{$key}: function($arg) {\n "
436
+ . implode( "\n ", $value )
437
+ . "\n }";
438
  } else {
439
  $pairs[] = "{$key}:{$value}";
440
  }
441
  }
442
 
443
+ return implode( ",\n ", $pairs );
444
  }
445
 
446
  /**
449
  * @return string
450
  */
451
  private function get_inline_css() {
452
+ $css = apply_filters( "metaslider_css", "", $this->settings, $this->id );
453
 
454
  // use this to add the scoped attribute for HTML5 validation (if needed)
455
+ $attributes = apply_filters( "metaslider_style_attributes", "", $this->settings, $this->id );
456
 
457
+ if ( strlen( $css ) ) {
458
+ return "<style type=\"text/css\"{$attributes} id=\"metaslider-css-{$this->id}\">{$css}\n </style>";
459
  }
460
 
461
  return "";
465
  * Include slider assets, JS and CSS paths are specified by child classes.
466
  */
467
  public function enqueue_scripts() {
468
+ if ( $this->get_setting( 'printJs' ) == 'true' ) {
469
+ wp_enqueue_script( 'metaslider-' . $this->get_setting( 'type' ) . '-slider', METASLIDER_ASSETS_URL . $this->js_path, array( 'jquery' ), METASLIDER_VERSION );
470
  }
471
 
472
+ if ( $this->get_setting( 'printCss' ) == 'true' ) {
473
  // this will be added to the bottom of the page as <head> has already been processed by WordPress.
474
  // For HTML5 compatibility, use a minification plugin to move the CSS to the <head>
475
+ wp_enqueue_style( 'metaslider-' . $this->get_setting( 'type' ) . '-slider', METASLIDER_ASSETS_URL . $this->css_path, false, METASLIDER_VERSION );
476
+ wp_enqueue_style( 'metaslider-public', METASLIDER_ASSETS_URL . 'metaslider/public.css', false, METASLIDER_VERSION );
477
  }
478
 
479
+ do_action( 'metaslider_register_public_styles' );
480
  }
481
 
482
  /**
483
  * Update the slider settings, converting checkbox values (on/off) to true or false.
484
  */
485
+ public function update_settings( $new_settings ) {
486
  $old_settings = $this->get_settings();
487
 
488
  // convert submitted checkbox values from 'on' or 'off' to boolean values
489
+ $checkboxes = array( 'noConflict', 'fullWidth', 'hoverPause', 'links', 'reverse', 'random', 'printCss', 'printJs', 'smoothHeight', 'center', 'smartCrop', 'carouselMode', 'autoPlay' );
490
 
491
+ foreach ( $checkboxes as $checkbox ) {
492
+ if ( isset( $new_settings[$checkbox] ) && $new_settings[$checkbox] == 'on' ) {
493
  $new_settings[$checkbox] = "true";
494
  } else {
495
  $new_settings[$checkbox] = "false";
497
  }
498
 
499
  // update the slider settings
500
+ update_post_meta( $this->id, 'ml-slider_settings', array_merge( (array)$old_settings, $new_settings ) );
501
 
502
  $this->settings = $this->get_settings();
503
  }
505
  /**
506
  * Update the title of the slider
507
  */
508
+ private function update_title( $title ) {
509
  $slide = array(
510
  'ID' => $this->id,
511
  'post_title' => $title
512
  );
513
 
514
+ wp_update_post( $slide );
515
  }
516
 
517
  /**
518
  * Delete a slide. This doesn't actually remove the slide from WordPress, simply untags
519
  * it from the slide taxonomy.
520
  *
521
+ * @param int $slide_id
522
  */
523
+ private function delete_slide( $slide_id ) {
524
  // Get the existing terms and only keep the ones we don't want removed
525
  $new_terms = array();
526
+ $current_terms = wp_get_object_terms( $slide_id, 'ml-slider', array( 'fields' => 'ids' ) );
527
+ $term = get_term_by( 'name', $this->id, 'ml-slider' );
528
 
529
+ foreach ( $current_terms as $current_term ) {
530
+ if ( $current_term != $term->term_id ) {
531
+ $new_terms[] = absint( $current_term );
532
  }
533
  }
534
 
535
+ return wp_set_object_terms( $slide_id, $new_terms, 'ml-slider' );
536
  }
537
 
538
  /**
539
  * Loop over each slide and call the save action on each
540
  *
541
+ * @param array $data - posted form data.
542
  */
543
+ private function update_slides( $data ) {
544
+ foreach ( $data as $slide_id => $fields ) {
545
+ do_action( "metaslider_save_{$fields['type']}_slide", $slide_id, $this->id, $fields );
546
  }
547
  }
548
  }
inc/slider/metaslider.coin.class.php CHANGED
@@ -11,10 +11,10 @@ class MetaCoinSlider extends MetaSlider {
11
 
12
  /**
13
  * Enable the parameters that are accepted by the slider
14
- *
15
  * @return array enabled parameters
16
  */
17
- protected function get_param($param) {
18
  $params = array(
19
  'effect' => 'animation',
20
  'width' => 'width',
@@ -32,7 +32,7 @@ class MetaCoinSlider extends MetaSlider {
32
  'nextText' => 'nextText'
33
  );
34
 
35
- if (isset($params[$param])) {
36
  return $params[$param];
37
  }
38
 
@@ -46,14 +46,14 @@ class MetaCoinSlider extends MetaSlider {
46
  */
47
  protected function get_html() {
48
  $return_value = "<div id='" . $this->get_identifier() . "' class='coin-slider'>";
49
-
50
- foreach ($this->slides as $slide) {
51
  $return_value .= "\n" . $slide;
52
  }
53
-
54
  $return_value .= "\n </div>";
55
-
56
- return apply_filters('metaslider_coin_slider_get_html', $return_value, $this->id, $this->settings); $retVal;
57
  }
58
  }
59
- ?>
11
 
12
  /**
13
  * Enable the parameters that are accepted by the slider
14
+ *
15
  * @return array enabled parameters
16
  */
17
+ protected function get_param( $param ) {
18
  $params = array(
19
  'effect' => 'animation',
20
  'width' => 'width',
32
  'nextText' => 'nextText'
33
  );
34
 
35
+ if ( isset( $params[$param] ) ) {
36
  return $params[$param];
37
  }
38
 
46
  */
47
  protected function get_html() {
48
  $return_value = "<div id='" . $this->get_identifier() . "' class='coin-slider'>";
49
+
50
+ foreach ( $this->slides as $slide ) {
51
  $return_value .= "\n" . $slide;
52
  }
53
+
54
  $return_value .= "\n </div>";
55
+
56
+ return apply_filters( 'metaslider_coin_slider_get_html', $return_value, $this->id, $this->settings ); $retVal;
57
  }
58
  }
59
+ ?>
inc/slider/metaslider.flex.class.php CHANGED
@@ -13,37 +13,37 @@ class MetaFlexSlider extends MetaSlider {
13
  *
14
  * @param integer $id slideshow ID
15
  */
16
- public function __construct($id, $shortcode_settings) {
17
- parent::__construct($id, $shortcode_settings);
18
 
19
- add_filter('metaslider_flex_slider_parameters', array($this, 'enable_carousel_mode'), 10, 2);
20
- add_filter('metaslider_flex_slider_parameters', array($this, 'manage_easing'), 10, 2);
21
- add_filter('metaslider_css', array($this, 'get_carousel_css'), 11, 3);
22
- add_filter('metaslider_css_classes', array($this, 'remove_bottom_margin'), 11, 3);
23
  }
24
 
25
  /**
26
  * Adjust the slider parameters so they're comparible with the carousel mode
27
  *
28
- * @param array $options
29
  * @param integer $slider_id
30
  * @return array $options
31
  */
32
- public function enable_carousel_mode($options, $slider_id) {
33
- if (isset($options["carouselMode"])) {
34
- if ($options["carouselMode"] == "true") {
35
- $options["itemWidth"] = $this->get_setting('width');
36
  $options["animation"] = "'slide'";
37
  $options["direction"] = "'horizontal'";
38
  $options["minItems"] = 1;
39
- $options["itemMargin"] = apply_filters('metaslider_carousel_margin', $this->get_setting('carouselMargin'), $slider_id);
40
  }
41
 
42
- unset($options["carouselMode"]);
43
  }
44
 
45
  // we don't want this filter hanging around if there's more than one slideshow on the page
46
- remove_filter('metaslider_flex_slider_parameters', array($this, 'enable_carousel_mode'), 10, 2);
47
 
48
  return $options;
49
  }
@@ -51,21 +51,23 @@ class MetaFlexSlider extends MetaSlider {
51
  /**
52
  * Ensure CSS transitions are disabled when easing is enabled.
53
  *
54
- * @param array $options
55
  * @param integer $slider_id
56
  * @return array $options
57
  */
58
- public function manage_easing($options, $slider_id) {
59
- if (isset($options["easing"])) {
60
- $options['useCSS'] = 'false';
 
61
  }
62
 
63
- if ($options["animation"] == '"fade"') {
64
- unset($options['easing']);
65
  }
66
 
 
67
  // we don't want this filter hanging around if there's more than one slideshow on the page
68
- remove_filter('metaslider_flex_slider_parameters', array($this, 'manage_easing'), 10, 2);
69
 
70
  return $options;
71
  }
@@ -73,18 +75,18 @@ class MetaFlexSlider extends MetaSlider {
73
  /**
74
  * Add a 'nav-hidden' class to slideshows where the navigation is hidden.
75
  *
76
- * @param string $css
77
- * @param array $settings
78
  * @param integer $slider_id
79
  * @return string $css
80
  */
81
- public function remove_bottom_margin($class, $id, $settings) {
82
- if (isset($settings["navigation"]) && $settings['navigation'] == 'false') {
83
  return $class .= " nav-hidden";
84
  }
85
 
86
  // we don't want this filter hanging around if there's more than one slideshow on the page
87
- remove_filter('metaslider_css_classes', array($this, 'remove_bottom_margin'), 11, 3);
88
 
89
  return $class;
90
  }
@@ -92,19 +94,19 @@ class MetaFlexSlider extends MetaSlider {
92
  /**
93
  * Return css to ensure our slides are rendered correctly in the carousel
94
  *
95
- * @param string $css
96
- * @param array $settings
97
  * @param integer $slider_id
98
  * @return string $css
99
  */
100
- public function get_carousel_css($css, $settings, $slider_id) {
101
- if (isset($settings["carouselMode"]) && $settings['carouselMode'] == 'true') {
102
- $margin = apply_filters('metaslider_carousel_margin', $this->get_setting('carouselMargin'), $slider_id);
103
  $css .= "\n #metaslider_{$slider_id}.flexslider .slides li {margin-right: {$margin}px !important;}";
104
  }
105
 
106
  // we don't want this filter hanging around if there's more than one slideshow on the page
107
- remove_filter('metaslider_css', array($this, 'get_carousel_css'), 11, 3);
108
 
109
  return $css;
110
  }
@@ -112,10 +114,10 @@ class MetaFlexSlider extends MetaSlider {
112
  /**
113
  * Enable the parameters that are accepted by the slider
114
  *
115
- * @param string $param
116
  * @return array|boolean enabled parameters (false if parameter doesn't exist)
117
  */
118
- protected function get_param($param) {
119
  $params = array(
120
  'effect' => 'animation',
121
  'direction' => 'direction',
@@ -132,7 +134,7 @@ class MetaFlexSlider extends MetaSlider {
132
  'autoPlay' => 'slideshow'
133
  );
134
 
135
- if (isset($params[$param])) {
136
  return $params[$param];
137
  }
138
 
@@ -145,8 +147,8 @@ class MetaFlexSlider extends MetaSlider {
145
  public function enqueue_scripts() {
146
  parent::enqueue_scripts();
147
 
148
- if ($this->get_setting('printJs') == 'true' && ($this->get_setting('effect') == 'slide' || $this->get_setting('carouselMode') == 'true')) {
149
- wp_enqueue_script('metaslider-easing', METASLIDER_ASSETS_URL . 'easing/jQuery.easing.min.js', array('jquery'), METASLIDER_VERSION);
150
  }
151
  }
152
 
@@ -156,16 +158,16 @@ class MetaFlexSlider extends MetaSlider {
156
  * @return string slider markup.
157
  */
158
  protected function get_html() {
159
- $class = $this->get_setting('noConflict') == 'true' ? "" : ' class="flexslider"';
160
 
161
  $return_value = '<div id="' . $this->get_identifier() . '"' . $class . '>';
162
  $return_value .= "\n <ul class=\"slides\">";
163
 
164
- foreach ($this->slides as $slide) {
165
  // backwards compatibility with older versions of Meta Slider Pro (< v2.0)
166
  // MS Pro < 2.0 does not include the <li>
167
  // MS Pro 2.0+ returns the <li>
168
- if (strpos($slide, '<li') === 0) {
169
  $return_value .= "\n " . $slide;
170
  } else {
171
  $return_value .= "\n <li style=\"display: none;\">" . $slide . "</li>";
@@ -175,7 +177,12 @@ class MetaFlexSlider extends MetaSlider {
175
  $return_value .= "\n </ul>";
176
  $return_value .= "\n </div>";
177
 
178
- return apply_filters('metaslider_flex_slider_get_html', $return_value, $this->id, $this->settings);
 
 
 
 
 
179
  }
180
  }
181
- ?>
13
  *
14
  * @param integer $id slideshow ID
15
  */
16
+ public function __construct( $id, $shortcode_settings ) {
17
+ parent::__construct( $id, $shortcode_settings );
18
 
19
+ add_filter( 'metaslider_flex_slider_parameters', array( $this, 'enable_carousel_mode' ), 10, 2 );
20
+ add_filter( 'metaslider_flex_slider_parameters', array( $this, 'manage_easing' ), 10, 2 );
21
+ add_filter( 'metaslider_css', array( $this, 'get_carousel_css' ), 11, 3 );
22
+ add_filter( 'metaslider_css_classes', array( $this, 'remove_bottom_margin' ), 11, 3 );
23
  }
24
 
25
  /**
26
  * Adjust the slider parameters so they're comparible with the carousel mode
27
  *
28
+ * @param array $options
29
  * @param integer $slider_id
30
  * @return array $options
31
  */
32
+ public function enable_carousel_mode( $options, $slider_id ) {
33
+ if ( isset( $options["carouselMode"] ) ) {
34
+ if ( $options["carouselMode"] == "true" ) {
35
+ $options["itemWidth"] = $this->get_setting( 'width' );
36
  $options["animation"] = "'slide'";
37
  $options["direction"] = "'horizontal'";
38
  $options["minItems"] = 1;
39
+ $options["itemMargin"] = apply_filters( 'metaslider_carousel_margin', $this->get_setting( 'carouselMargin' ), $slider_id );
40
  }
41
 
42
+ unset( $options["carouselMode"] );
43
  }
44
 
45
  // we don't want this filter hanging around if there's more than one slideshow on the page
46
+ remove_filter( 'metaslider_flex_slider_parameters', array( $this, 'enable_carousel_mode' ), 10, 2 );
47
 
48
  return $options;
49
  }
51
  /**
52
  * Ensure CSS transitions are disabled when easing is enabled.
53
  *
54
+ * @param array $options
55
  * @param integer $slider_id
56
  * @return array $options
57
  */
58
+ public function manage_easing( $options, $slider_id ) {
59
+
60
+ if ( $options["animation"] == '"fade"' ) {
61
+ unset( $options['easing'] );
62
  }
63
 
64
+ if ( isset( $options["easing"] ) && $options["easing"] != '"linear"' ) {
65
+ $options['useCSS'] = 'false';
66
  }
67
 
68
+
69
  // we don't want this filter hanging around if there's more than one slideshow on the page
70
+ remove_filter( 'metaslider_flex_slider_parameters', array( $this, 'manage_easing' ), 10, 2 );
71
 
72
  return $options;
73
  }
75
  /**
76
  * Add a 'nav-hidden' class to slideshows where the navigation is hidden.
77
  *
78
+ * @param string $css
79
+ * @param array $settings
80
  * @param integer $slider_id
81
  * @return string $css
82
  */
83
+ public function remove_bottom_margin( $class, $id, $settings ) {
84
+ if ( isset( $settings["navigation"] ) && $settings['navigation'] == 'false' ) {
85
  return $class .= " nav-hidden";
86
  }
87
 
88
  // we don't want this filter hanging around if there's more than one slideshow on the page
89
+ remove_filter( 'metaslider_css_classes', array( $this, 'remove_bottom_margin' ), 11, 3 );
90
 
91
  return $class;
92
  }
94
  /**
95
  * Return css to ensure our slides are rendered correctly in the carousel
96
  *
97
+ * @param string $css
98
+ * @param array $settings
99
  * @param integer $slider_id
100
  * @return string $css
101
  */
102
+ public function get_carousel_css( $css, $settings, $slider_id ) {
103
+ if ( isset( $settings["carouselMode"] ) && $settings['carouselMode'] == 'true' ) {
104
+ $margin = apply_filters( 'metaslider_carousel_margin', $this->get_setting( 'carouselMargin' ), $slider_id );
105
  $css .= "\n #metaslider_{$slider_id}.flexslider .slides li {margin-right: {$margin}px !important;}";
106
  }
107
 
108
  // we don't want this filter hanging around if there's more than one slideshow on the page
109
+ remove_filter( 'metaslider_css', array( $this, 'get_carousel_css' ), 11, 3 );
110
 
111
  return $css;
112
  }
114
  /**
115
  * Enable the parameters that are accepted by the slider
116
  *
117
+ * @param string $param
118
  * @return array|boolean enabled parameters (false if parameter doesn't exist)
119
  */
120
+ protected function get_param( $param ) {
121
  $params = array(
122
  'effect' => 'animation',
123
  'direction' => 'direction',
134
  'autoPlay' => 'slideshow'
135
  );
136
 
137
+ if ( isset( $params[$param] ) ) {
138
  return $params[$param];
139
  }
140
 
147
  public function enqueue_scripts() {
148
  parent::enqueue_scripts();
149
 
150
+ if ( $this->get_setting( 'printJs' ) == 'true' && ( $this->get_setting( 'effect' ) == 'slide' || $this->get_setting( 'carouselMode' ) == 'true' ) ) {
151
+ wp_enqueue_script( 'metaslider-easing', METASLIDER_ASSETS_URL . 'easing/jQuery.easing.min.js', array( 'jquery' ), METASLIDER_VERSION );
152
  }
153
  }
154
 
158
  * @return string slider markup.
159
  */
160
  protected function get_html() {
161
+ $class = $this->get_setting( 'noConflict' ) == 'true' ? "" : ' class="flexslider"';
162
 
163
  $return_value = '<div id="' . $this->get_identifier() . '"' . $class . '>';
164
  $return_value .= "\n <ul class=\"slides\">";
165
 
166
+ foreach ( $this->slides as $slide ) {
167
  // backwards compatibility with older versions of Meta Slider Pro (< v2.0)
168
  // MS Pro < 2.0 does not include the <li>
169
  // MS Pro 2.0+ returns the <li>
170
+ if ( strpos( $slide, '<li' ) === 0 ) {
171
  $return_value .= "\n " . $slide;
172
  } else {
173
  $return_value .= "\n <li style=\"display: none;\">" . $slide . "</li>";
177
  $return_value .= "\n </ul>";
178
  $return_value .= "\n </div>";
179
 
180
+ // show the first slide
181
+ if ($this->get_setting('carouselMode') != 'true') {
182
+ $return_value = preg_replace('/none/', 'inline-block', $return_value, 1);
183
+ }
184
+
185
+ return apply_filters( 'metaslider_flex_slider_get_html', $return_value, $this->id, $this->settings );
186
  }
187
  }
188
+ ?>
inc/slider/metaslider.nivo.class.php CHANGED
@@ -11,10 +11,10 @@ class MetaNivoSlider extends MetaSlider {
11
  /**
12
  * Constructor
13
  */
14
- public function __construct($id, $shortcode_settings) {
15
- parent::__construct($id, $shortcode_settings);
16
 
17
- add_filter('metaslider_nivo_slider_parameters', array($this, 'set_autoplay_parameter'), 10, 3);
18
  }
19
 
20
  /**
@@ -22,19 +22,19 @@ class MetaNivoSlider extends MetaSlider {
22
  * Nivo slider uses "ManualAvance = false" (ie, false autoplays the slideshow)
23
  * Take care of the manualAdvance parameter here.
24
  */
25
- public function set_autoplay_parameter($options, $slider_id, $settings) {
26
  global $wp_filter;
27
- if (isset($options["autoPlay"])) {
28
- if ($options["autoPlay"] == 'true') {
29
  $options["manualAdvance"] = 'false';
30
  } else {
31
  $options["manualAdvance"] = 'true';
32
  }
33
 
34
- unset($options['autoPlay']);
35
  }
36
  // we don't want this filter hanging around if there's more than one slideshow on the page
37
- remove_filter('metaslider_nivo_slider_parameters', array($this, 'set_autoplay_parameter'), 10, 3);
38
 
39
  return $options;
40
  }
@@ -42,10 +42,10 @@ class MetaNivoSlider extends MetaSlider {
42
  /**
43
  * Detect whether thie slide supports the requested setting,
44
  * and if so, the name to use for the setting in the Javascript parameters
45
- *
46
  * @return false (parameter not supported) or parameter name (parameter supported)
47
  */
48
- protected function get_param($param) {
49
  $params = array(
50
  'effect' => 'effect',
51
  'slices' => 'slices',
@@ -61,7 +61,7 @@ class MetaNivoSlider extends MetaSlider {
61
  'autoPlay' => 'autoPlay'
62
  );
63
 
64
- if (isset($params[$param])) {
65
  return $params[$param];
66
  }
67
 
@@ -69,24 +69,24 @@ class MetaNivoSlider extends MetaSlider {
69
  }
70
 
71
  /**
72
- *
73
  */
74
  public function enqueue_scripts() {
75
  parent::enqueue_scripts();
76
 
77
- if ($this->get_setting('printCss') == 'true') {
78
  $theme = $this->get_theme();
79
- wp_enqueue_style('metaslider-' . $this->get_setting('type') . '-slider-'.$theme, METASLIDER_ASSETS_URL . "sliders/nivoslider/themes/{$theme}/{$theme}.css", false, METASLIDER_VERSION);
80
  }
81
  }
82
 
83
  /**
84
- *
85
  */
86
  private function get_theme() {
87
- $theme = $this->get_setting('theme');
88
 
89
- if (!in_array($theme, array('dark', 'bar', 'light'))) {
90
  $theme = 'default';
91
  }
92
 
@@ -102,14 +102,14 @@ class MetaNivoSlider extends MetaSlider {
102
  $return_value = "<div class='slider-wrapper theme-{$this->get_theme()}'>";
103
  $return_value .= "\n <div class='ribbon'></div>";
104
  $return_value .= "\n <div id='" . $this->get_identifier() . "' class='nivoSlider'>";
105
-
106
- foreach ($this->slides as $slide) {
107
  $return_value .= "\n " . $slide;
108
  }
109
-
110
  $return_value .= "\n </div>\n </div>";
111
-
112
- return apply_filters('metaslider_nivo_slider_get_html', $return_value, $this->id, $this->settings);;
113
  }
114
  }
115
- ?>
11
  /**
12
  * Constructor
13
  */
14
+ public function __construct( $id, $shortcode_settings ) {
15
+ parent::__construct( $id, $shortcode_settings );
16
 
17
+ add_filter( 'metaslider_nivo_slider_parameters', array( $this, 'set_autoplay_parameter' ), 10, 3 );
18
  }
19
 
20
  /**
22
  * Nivo slider uses "ManualAvance = false" (ie, false autoplays the slideshow)
23
  * Take care of the manualAdvance parameter here.
24
  */
25
+ public function set_autoplay_parameter( $options, $slider_id, $settings ) {
26
  global $wp_filter;
27
+ if ( isset( $options["autoPlay"] ) ) {
28
+ if ( $options["autoPlay"] == 'true' ) {
29
  $options["manualAdvance"] = 'false';
30
  } else {
31
  $options["manualAdvance"] = 'true';
32
  }
33
 
34
+ unset( $options['autoPlay'] );
35
  }
36
  // we don't want this filter hanging around if there's more than one slideshow on the page
37
+ remove_filter( 'metaslider_nivo_slider_parameters', array( $this, 'set_autoplay_parameter' ), 10, 3 );
38
 
39
  return $options;
40
  }
42
  /**
43
  * Detect whether thie slide supports the requested setting,
44
  * and if so, the name to use for the setting in the Javascript parameters
45
+ *
46
  * @return false (parameter not supported) or parameter name (parameter supported)
47
  */
48
+ protected function get_param( $param ) {
49
  $params = array(
50
  'effect' => 'effect',
51
  'slices' => 'slices',
61
  'autoPlay' => 'autoPlay'
62
  );
63
 
64
+ if ( isset( $params[$param] ) ) {
65
  return $params[$param];
66
  }
67
 
69
  }
70
 
71
  /**
72
+ *
73
  */
74
  public function enqueue_scripts() {
75
  parent::enqueue_scripts();
76
 
77
+ if ( $this->get_setting( 'printCss' ) == 'true' ) {
78
  $theme = $this->get_theme();
79
+ wp_enqueue_style( 'metaslider-' . $this->get_setting( 'type' ) . '-slider-'.$theme, METASLIDER_ASSETS_URL . "sliders/nivoslider/themes/{$theme}/{$theme}.css", false, METASLIDER_VERSION );
80
  }
81
  }
82
 
83
  /**
84
+ *
85
  */
86
  private function get_theme() {
87
+ $theme = $this->get_setting( 'theme' );
88
 
89
+ if ( !in_array( $theme, array( 'dark', 'bar', 'light' ) ) ) {
90
  $theme = 'default';
91
  }
92
 
102
  $return_value = "<div class='slider-wrapper theme-{$this->get_theme()}'>";
103
  $return_value .= "\n <div class='ribbon'></div>";
104
  $return_value .= "\n <div id='" . $this->get_identifier() . "' class='nivoSlider'>";
105
+
106
+ foreach ( $this->slides as $slide ) {
107
  $return_value .= "\n " . $slide;
108
  }
109
+
110
  $return_value .= "\n </div>\n </div>";
111
+
112
+ return apply_filters( 'metaslider_nivo_slider_get_html', $return_value, $this->id, $this->settings );;
113
  }
114
  }
115
+ ?>
inc/slider/metaslider.responsive.class.php CHANGED
@@ -11,10 +11,10 @@ class MetaResponsiveSlider extends MetaSlider {
11
  /**
12
  * Detect whether thie slide supports the requested setting,
13
  * and if so, the name to use for the setting in the Javascript parameters
14
- *
15
  * @return false (parameter not supported) or parameter name (parameter supported)
16
  */
17
- protected function get_param($param) {
18
  $params = array(
19
  'prevText' => 'prevText',
20
  'nextText' => 'nextText',
@@ -26,7 +26,7 @@ class MetaResponsiveSlider extends MetaSlider {
26
  'autoPlay' => 'auto'
27
  );
28
 
29
- if (isset($params[$param])) {
30
  return $params[$param];
31
  }
32
 
@@ -40,21 +40,21 @@ class MetaResponsiveSlider extends MetaSlider {
40
  */
41
  protected function get_html() {
42
  $return_value = "<ul id='" . $this->get_identifier() . "' class='rslides'>";
43
-
44
  $first = true;
45
- foreach ($this->slides as $slide) {
46
  $style = "";
47
-
48
- if (!$first) {
49
  $style = " style='display: none;'";
50
  }
51
  $return_value .= "\n <li{$style}>" . $slide . "</li>";
52
  $first = false;
53
  }
54
-
55
  $return_value .= "\n </ul>";
56
-
57
- return apply_filters('metaslider_responsive_slider_get_html', $return_value, $this->id, $this->settings);;
58
  }
59
  }
60
- ?>
11
  /**
12
  * Detect whether thie slide supports the requested setting,
13
  * and if so, the name to use for the setting in the Javascript parameters
14
+ *
15
  * @return false (parameter not supported) or parameter name (parameter supported)
16
  */
17
+ protected function get_param( $param ) {
18
  $params = array(
19
  'prevText' => 'prevText',
20
  'nextText' => 'nextText',
26
  'autoPlay' => 'auto'
27
  );
28
 
29
+ if ( isset( $params[$param] ) ) {
30
  return $params[$param];
31
  }
32
 
40
  */
41
  protected function get_html() {
42
  $return_value = "<ul id='" . $this->get_identifier() . "' class='rslides'>";
43
+
44
  $first = true;
45
+ foreach ( $this->slides as $slide ) {
46
  $style = "";
47
+
48
+ if ( !$first ) {
49
  $style = " style='display: none;'";
50
  }
51
  $return_value .= "\n <li{$style}>" . $slide . "</li>";
52
  $first = false;
53
  }
54
+
55
  $return_value .= "\n </ul>";
56
+
57
+ return apply_filters( 'metaslider_responsive_slider_get_html', $return_value, $this->id, $this->settings );;
58
  }
59
  }
60
+ ?>
languages/metaslider-nl_NL.mo ADDED
Binary file
languages/metaslider-nl_NL.po ADDED
@@ -0,0 +1,602 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: metaslider\n"
4
+ "POT-Creation-Date: 2013-12-16 17:31-0000\n"
5
+ "PO-Revision-Date: 2014-04-02 16:41+0100\n"
6
+ "Last-Translator: Nick te Morsche <bl44tkip@gmail.com>\n"
7
+ "Language-Team: \n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Generator: Poedit 1.6.4\n"
12
+ "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "Language: nl_NL\n"
15
+ "X-Poedit-SearchPath-0: .\n"
16
+ "X-Poedit-SearchPath-1: ..\n"
17
+
18
+ #: ../ml-slider.php:102
19
+ msgid "Go Pro"
20
+ msgstr "Kies voor Pro"
21
+
22
+ #: ../ml-slider.php:156
23
+ msgid "Image"
24
+ msgstr "Afbeelding"
25
+
26
+ #: ../ml-slider.php:157
27
+ msgid "Add to slider"
28
+ msgstr "Aan Slider toevoegen"
29
+
30
+ #: ../ml-slider.php:177
31
+ msgid "Post Feed"
32
+ msgstr ""
33
+
34
+ #: ../ml-slider.php:178
35
+ msgid "Vimeo"
36
+ msgstr ""
37
+
38
+ #: ../ml-slider.php:179
39
+ msgid "YouTube"
40
+ msgstr ""
41
+
42
+ #: ../ml-slider.php:180
43
+ msgid "Layer Slide"
44
+ msgstr ""
45
+
46
+ #: ../ml-slider.php:235 ../inc/slide/metaslide.image.class.php:103
47
+ msgid "URL"
48
+ msgstr ""
49
+
50
+ #: ../ml-slider.php:236 ../inc/slide/metaslide.image.class.php:101
51
+ msgid "Caption"
52
+ msgstr "Onderschrift"
53
+
54
+ #: ../ml-slider.php:237 ../inc/slide/metaslide.image.class.php:102
55
+ msgid "New Window"
56
+ msgstr "Nieuw venster"
57
+
58
+ #: ../ml-slider.php:238
59
+ msgid "Are you sure?"
60
+ msgstr "Zeker weten?"
61
+
62
+ #: ../ml-slider.php:242
63
+ msgid ""
64
+ "Caution: This setting is for advanced developers only. If you're unsure, "
65
+ "leave it checked."
66
+ msgstr ""
67
+ "Let op! Deze instellingen zijn alleen bedoelt voor voor ervaren "
68
+ "ontwikkelaars. Bij twijfel aangevinkt laten"
69
+
70
+ #: ../ml-slider.php:278
71
+ msgid "Upgrade to Pro $19"
72
+ msgstr "Upgraden naar Pro $19"
73
+
74
+ #: ../ml-slider.php:294
75
+ msgid "Documentation"
76
+ msgstr "Documentatie"
77
+
78
+ #: ../ml-slider.php:430
79
+ msgid "New Slider"
80
+ msgstr "Nieuwe Slider"
81
+
82
+ #: ../ml-slider.php:692
83
+ msgid "New slideshow created. Click 'Add Slide' to get started!"
84
+ msgstr ""
85
+ "Nieuwe slideshow gecreëerd. Klik op 'Slideshow Toevoegen' om te beginnen!"
86
+
87
+ #: ../ml-slider.php:709
88
+ msgid "or"
89
+ msgstr "of"
90
+
91
+ #: ../ml-slider.php:710
92
+ msgid "Add New Slideshow"
93
+ msgstr "Nieuwe Slideshow toevoegen"
94
+
95
+ #: ../ml-slider.php:726
96
+ msgid "Create your first slideshow"
97
+ msgstr "Maak je eerste slideshow"
98
+
99
+ #: ../ml-slider.php:744
100
+ msgid "Settings"
101
+ msgstr "Instellingen"
102
+
103
+ #: ../ml-slider.php:745
104
+ msgid "Save"
105
+ msgstr "Opslaan"
106
+
107
+ #: ../ml-slider.php:746
108
+ msgid "Save & Preview"
109
+ msgstr "Opslaan & Bekijken"
110
+
111
+ #: ../ml-slider.php:759
112
+ msgid "Flex Slider"
113
+ msgstr ""
114
+
115
+ #: ../ml-slider.php:760
116
+ msgid "Responsive"
117
+ msgstr ""
118
+
119
+ #: ../ml-slider.php:761
120
+ msgid "Nivo Slider"
121
+ msgstr ""
122
+
123
+ #: ../ml-slider.php:762
124
+ msgid "Coin Slider"
125
+ msgstr ""
126
+
127
+ #: ../ml-slider.php:773 ../ml-slider.php:995
128
+ msgid "Width"
129
+ msgstr "Breedte"
130
+
131
+ #: ../ml-slider.php:775
132
+ msgid "Slideshow width"
133
+ msgstr "Slideshow breedte"
134
+
135
+ #: ../ml-slider.php:776 ../ml-slider.php:789
136
+ msgid "px"
137
+ msgstr ""
138
+
139
+ #: ../ml-slider.php:786 ../ml-slider.php:1008
140
+ msgid "Height"
141
+ msgstr "Hoogte"
142
+
143
+ #: ../ml-slider.php:788
144
+ msgid "Slideshow height"
145
+ msgstr "Slideshow hoogte"
146
+
147
+ #: ../ml-slider.php:795
148
+ msgid "Effect"
149
+ msgstr ""
150
+
151
+ #: ../ml-slider.php:797
152
+ msgid "Slide transition effect"
153
+ msgstr "Slide overgangs effect"
154
+
155
+ #: ../ml-slider.php:799 ../ml-slider.php:927
156
+ msgid "Random"
157
+ msgstr "Willekeurig"
158
+
159
+ #: ../ml-slider.php:800
160
+ msgid "Swirl"
161
+ msgstr ""
162
+
163
+ #: ../ml-slider.php:801
164
+ msgid "Rain"
165
+ msgstr ""
166
+
167
+ #: ../ml-slider.php:802
168
+ msgid "Straight"
169
+ msgstr "Recht"
170
+
171
+ #: ../ml-slider.php:803
172
+ msgid "Slide Down"
173
+ msgstr "Slide Omlaag"
174
+
175
+ #: ../ml-slider.php:804
176
+ msgid "Slice Up"
177
+ msgstr ""
178
+
179
+ #: ../ml-slider.php:805
180
+ msgid "Slide Up Left"
181
+ msgstr "Slide Omhoog Links"
182
+
183
+ #: ../ml-slider.php:806
184
+ msgid "Slice Up Down"
185
+ msgstr ""
186
+
187
+ #: ../ml-slider.php:807
188
+ msgid "Slide Up Down Left"
189
+ msgstr "Slide Omhoog Omlaag Links"
190
+
191
+ #: ../ml-slider.php:808
192
+ msgid "Fold"
193
+ msgstr "vouwen"
194
+
195
+ #: ../ml-slider.php:809
196
+ msgid "Fade"
197
+ msgstr "Vervaag"
198
+
199
+ #: ../ml-slider.php:810
200
+ msgid "Slide In Right"
201
+ msgstr "Slide in Rechts"
202
+
203
+ #: ../ml-slider.php:811
204
+ msgid "Slide In Left"
205
+ msgstr "Slide in Links"
206
+
207
+ #: ../ml-slider.php:812
208
+ msgid "Box Random"
209
+ msgstr ""
210
+
211
+ #: ../ml-slider.php:813
212
+ msgid "Box Rain"
213
+ msgstr ""
214
+
215
+ #: ../ml-slider.php:814
216
+ msgid "Box Rain Reverse"
217
+ msgstr ""
218
+
219
+ #: ../ml-slider.php:815
220
+ msgid "Box Rain Grow Reverse"
221
+ msgstr ""
222
+
223
+ #: ../ml-slider.php:816
224
+ msgid "Slide"
225
+ msgstr ""
226
+
227
+ #: ../ml-slider.php:823
228
+ msgid "Theme"
229
+ msgstr ""
230
+
231
+ #: ../ml-slider.php:825
232
+ msgid "Slideshow theme"
233
+ msgstr ""
234
+
235
+ #: ../ml-slider.php:827
236
+ msgid "Default"
237
+ msgstr "Standaart"
238
+
239
+ #: ../ml-slider.php:828
240
+ msgid "Dark (Nivo)"
241
+ msgstr ""
242
+
243
+ #: ../ml-slider.php:829
244
+ msgid "Light (Nivo)"
245
+ msgstr ""
246
+
247
+ #: ../ml-slider.php:830
248
+ msgid "Bar (Nivo)"
249
+ msgstr ""
250
+
251
+ #: ../ml-slider.php:836
252
+ msgid "Arrows"
253
+ msgstr "Pijlen"
254
+
255
+ #: ../ml-slider.php:839
256
+ msgid "Show the previous/next arrows"
257
+ msgstr "Vorige/Volgende pijlen weergeven"
258
+
259
+ #: ../ml-slider.php:844
260
+ msgid "Navigation"
261
+ msgstr "Navigatie"
262
+
263
+ #: ../ml-slider.php:847
264
+ msgid "Show the slide navigation bullets"
265
+ msgstr "Slide Navigatiebalk weergeven"
266
+
267
+ #: ../ml-slider.php:849
268
+ msgid "Hidden"
269
+ msgstr "Verborgen"
270
+
271
+ #: ../ml-slider.php:850
272
+ msgid "Dots"
273
+ msgstr ""
274
+
275
+ #: ../ml-slider.php:851
276
+ msgid "Thumbnails (Pro)"
277
+ msgstr ""
278
+
279
+ #: ../ml-slider.php:862
280
+ msgid "Title"
281
+ msgstr "Titel"
282
+
283
+ #: ../ml-slider.php:863
284
+ msgid "Slideshow title"
285
+ msgstr "Titel Slideshow"
286
+
287
+ #: ../ml-slider.php:877
288
+ msgid "Advanced Settings"
289
+ msgstr "Geavanceerde Instellingen"
290
+
291
+ #: ../ml-slider.php:886
292
+ msgid "Stretch"
293
+ msgstr "Uitrekken"
294
+
295
+ #: ../ml-slider.php:888
296
+ msgid "100% wide output"
297
+ msgstr ""
298
+
299
+ #: ../ml-slider.php:890
300
+ msgid "Stretch the slideshow output to fill it's parent container"
301
+ msgstr ""
302
+
303
+ #: ../ml-slider.php:895
304
+ msgid "Center align"
305
+ msgstr "Uitlijnen midden"
306
+
307
+ #: ../ml-slider.php:898
308
+ msgid "Center align the slideshow"
309
+ msgstr "Slideshow in midden uitlijnen"
310
+
311
+ #: ../ml-slider.php:903
312
+ msgid "Auto play"
313
+ msgstr "Automatisch Afspelen"
314
+
315
+ #: ../ml-slider.php:906
316
+ msgid "Transition between slides automatically"
317
+ msgstr "Overgang tussen slides automatisch"
318
+
319
+ #: ../ml-slider.php:911
320
+ msgid "Smart crop"
321
+ msgstr "Slim knippen"
322
+
323
+ #: ../ml-slider.php:914
324
+ msgid ""
325
+ "Smart Crop ensures your responsive slides are cropped to a ratio that "
326
+ "results in a consistent slideshow size"
327
+ msgstr ""
328
+ "Slim uitsnijden garandeerd dat de slides optimaal worden uitgesneden, zodat "
329
+ "deze in het juiste formaat worden weergegeven"
330
+
331
+ #: ../ml-slider.php:919
332
+ msgid "Carousel mode"
333
+ msgstr "Carousel modus"
334
+
335
+ #: ../ml-slider.php:922
336
+ msgid "Display multiple slides at once. Slideshow output will be 100% wide."
337
+ msgstr ""
338
+
339
+ #: ../ml-slider.php:930
340
+ msgid "Randomise the order of the slides"
341
+ msgstr "Stel de volgorde van de slides in op Willekeurig"
342
+
343
+ #: ../ml-slider.php:935
344
+ msgid "Hover pause"
345
+ msgstr "Pause bij zweven"
346
+
347
+ #: ../ml-slider.php:938
348
+ msgid ""
349
+ "Pause the slideshow when hovering over slider, then resume when no longer "
350
+ "hovering."
351
+ msgstr ""
352
+ "Pauseer de slideshow zodra de cursor over de slider hangt en hervat de "
353
+ "slideshow wanneer deze wordt verwijdert "
354
+
355
+ #: ../ml-slider.php:943
356
+ msgid "Reverse"
357
+ msgstr "Omkeren"
358
+
359
+ #: ../ml-slider.php:946
360
+ msgid "Reverse the animation direction"
361
+ msgstr "Keer de animatie richting om"
362
+
363
+ #: ../ml-slider.php:956
364
+ msgid "Slide delay"
365
+ msgstr "Slide Vertraging"
366
+
367
+ #: ../ml-slider.php:958
368
+ msgid "How long to display each slide, in milliseconds"
369
+ msgstr "Weergave tijd per slide, in milliseconden"
370
+
371
+ #: ../ml-slider.php:959 ../ml-slider.php:972 ../ml-slider.php:985
372
+ #: ../ml-slider.php:1061 ../ml-slider.php:1087
373
+ msgid "ms"
374
+ msgstr ""
375
+
376
+ #: ../ml-slider.php:969
377
+ msgid "Animation speed"
378
+ msgstr "Animatie snelheid"
379
+
380
+ #: ../ml-slider.php:971
381
+ msgid "Set the speed of animations, in milliseconds"
382
+ msgstr "Animatie snelheid instellen, in milliseconden"
383
+
384
+ #: ../ml-slider.php:982 ../ml-slider.php:984
385
+ msgid "Number of slices"
386
+ msgstr ""
387
+
388
+ #: ../ml-slider.php:995 ../ml-slider.php:997 ../ml-slider.php:1008
389
+ #: ../ml-slider.php:1010
390
+ msgid "Number of squares"
391
+ msgstr ""
392
+
393
+ #: ../ml-slider.php:1016
394
+ msgid "Slide direction"
395
+ msgstr "Slide Richting"
396
+
397
+ #: ../ml-slider.php:1018
398
+ msgid "Select the sliding direction"
399
+ msgstr "Selecteer slide richting"
400
+
401
+ #: ../ml-slider.php:1021
402
+ msgid "Horizontal"
403
+ msgstr "Horizontaal"
404
+
405
+ #: ../ml-slider.php:1022
406
+ msgid "Vertical"
407
+ msgstr "Verticaal"
408
+
409
+ #: ../ml-slider.php:1028
410
+ msgid "Easing"
411
+ msgstr "Versoepelen"
412
+
413
+ #: ../ml-slider.php:1030
414
+ msgid "Animation easing effect"
415
+ msgstr "Versoepeling annimatie effect"
416
+
417
+ #: ../ml-slider.php:1037
418
+ msgid "Previous text"
419
+ msgstr "Vorige text"
420
+
421
+ #: ../ml-slider.php:1039
422
+ msgid "Set the text for the 'previous' direction item"
423
+ msgstr ""
424
+ "Stel hier uw text in om naar de vorige afbeelding te gaan, bijvoorbeeld: "
425
+ "Vorige Afbeelding"
426
+
427
+ #: ../ml-slider.php:1045
428
+ msgid "Next text"
429
+ msgstr "Volgende text"
430
+
431
+ #: ../ml-slider.php:1047
432
+ msgid "Set the text for the 'next' direction item"
433
+ msgstr ""
434
+ "Stel hier uw text in om naar de volgende afbeelding te gaan, bijvoorbeeld: "
435
+ "Volgende Afbeelding"
436
+
437
+ #: ../ml-slider.php:1058
438
+ msgid "Square delay"
439
+ msgstr ""
440
+
441
+ #: ../ml-slider.php:1060
442
+ msgid "Delay between squares in ms"
443
+ msgstr ""
444
+
445
+ #: ../ml-slider.php:1071
446
+ msgid "Opacity"
447
+ msgstr "(on)Doorzichtigheid"
448
+
449
+ #: ../ml-slider.php:1073
450
+ msgid "Opacity of title and navigation"
451
+ msgstr "(on)Doorzichtigheid van de Titel en Navigatie"
452
+
453
+ #: ../ml-slider.php:1084
454
+ msgid "Caption speed"
455
+ msgstr "Onderschrift snelheid"
456
+
457
+ #: ../ml-slider.php:1086
458
+ msgid "Set the fade in speed of the caption"
459
+ msgstr "Stel hier de snelheid in waarmee het onderschrift vervaagt"
460
+
461
+ #: ../ml-slider.php:1093
462
+ msgid "Developer options"
463
+ msgstr "Ontwikkelaar opties"
464
+
465
+ #: ../ml-slider.php:1098
466
+ msgid "CSS classes"
467
+ msgstr ""
468
+
469
+ #: ../ml-slider.php:1100
470
+ msgid ""
471
+ "Specify any custom CSS Classes you would like to be added to the slider "
472
+ "wrapper"
473
+ msgstr ""
474
+
475
+ #: ../ml-slider.php:1106
476
+ msgid "Print CSS"
477
+ msgstr ""
478
+
479
+ #: ../ml-slider.php:1109
480
+ msgid "Uncheck this is you would like to include your own CSS"
481
+ msgstr "Vink deze uit wanneer je een eigen CSS wilt invoegen"
482
+
483
+ #: ../ml-slider.php:1114
484
+ msgid "Print JS"
485
+ msgstr ""
486
+
487
+ #: ../ml-slider.php:1117
488
+ msgid "Uncheck this is you would like to include your own Javascript"
489
+ msgstr "Vink deze uit wanneer je een eigen javascript wilt invoegen"
490
+
491
+ #: ../ml-slider.php:1122
492
+ msgid "No conflict mode"
493
+ msgstr ""
494
+
495
+ #: ../ml-slider.php:1125
496
+ msgid "Delay adding the flexslider class to the slideshow"
497
+ msgstr ""
498
+
499
+ #: ../ml-slider.php:1139
500
+ msgid "Usage"
501
+ msgstr "Gebruik"
502
+
503
+ #: ../ml-slider.php:1142
504
+ msgid "Shortcode"
505
+ msgstr ""
506
+
507
+ #: ../ml-slider.php:1143
508
+ msgid "Template Include"
509
+ msgstr ""
510
+
511
+ #: ../ml-slider.php:1147
512
+ msgid "Copy & paste the shortcode directly into any WordPress post or page."
513
+ msgstr "Kopieer & plak de shortcode direct in elk Wordpress bericht of pagina"
514
+
515
+ #: ../ml-slider.php:1150
516
+ msgid ""
517
+ "Copy & paste this code into a template file to include the slideshow within "
518
+ "your theme."
519
+ msgstr ""
520
+ "Kopieer & plak deze code in een template bestand om een slideshow in je "
521
+ "thema op te nemen."
522
+
523
+ #: ../ml-slider.php:1179
524
+ msgid "Delete Slider"
525
+ msgstr "Verwijder Slider"
526
+
527
+ #: ../ml-slider.php:1190
528
+ msgid "Slides"
529
+ msgstr ""
530
+
531
+ #: ../ml-slider.php:1193 ../ml-slider.php:1194
532
+ msgid "Add Slide"
533
+ msgstr "Slide toevoegen"
534
+
535
+ #: ../ml-slider.php:1224
536
+ msgid "Select slideshow to insert into post"
537
+ msgstr "Selecteer een slideshow om in uw bericht te plaatsen"
538
+
539
+ #: ../ml-slider.php:1227
540
+ msgid "Add slider"
541
+ msgstr "Slider toevoegen"
542
+
543
+ #: ../ml-slider.php:1258
544
+ msgid "Insert Meta Slider"
545
+ msgstr "Meta Slider invoegen"
546
+
547
+ #: ../ml-slider.php:1260
548
+ msgid "Choose slideshow"
549
+ msgstr "Slideshow kiezen"
550
+
551
+ #: ../ml-slider.php:1267 ../inc/metaslider.widget.class.php:124
552
+ msgid "No slideshows found"
553
+ msgstr "geen slideshows gevonden"
554
+
555
+ #: ../inc/metaslider.widget.class.php:18
556
+ msgid "Meta Slider"
557
+ msgstr ""
558
+
559
+ #: ../inc/metaslider.widget.class.php:111
560
+ msgid "Title:"
561
+ msgstr "Titel:"
562
+
563
+ #: ../inc/metaslider.widget.class.php:114
564
+ msgid "Select Slider:"
565
+ msgstr "Slider Selecteren:"
566
+
567
+ #: ../inc/slide/metaslide.image.class.php:23
568
+ msgid "Security check failed. Refresh page and try again."
569
+ msgstr "Beveiligings probleem. Vernieuw de pagina en probeer opnieuw."
570
+
571
+ #: ../inc/slide/metaslide.image.class.php:36
572
+ msgid "Failed to add slide. Slide already exists in slideshow."
573
+ msgstr "Toevoegen slide mislukt. Slide bestaat al in slideshow"
574
+
575
+ #: ../inc/slide/metaslide.image.class.php:38
576
+ msgid "Failed to add slide. Slide is not of type 'image'."
577
+ msgstr "Toevoegen slide mislukt. Het bestand is geen 'afbeelding'"
578
+
579
+ #: ../inc/slide/metaslide.image.class.php:110
580
+ msgid "Image Slide"
581
+ msgstr "Afbeelding Slide"
582
+
583
+ #: ../inc/slide/metaslide.image.class.php:115
584
+ msgid "General"
585
+ msgstr "Algemeen"
586
+
587
+ #: ../inc/slide/metaslide.image.class.php:116
588
+ msgid "SEO"
589
+ msgstr ""
590
+
591
+ #: ../inc/slide/metaslide.image.class.php:121
592
+ msgid "Warning: Image data does not exist. Please re-upload the image."
593
+ msgstr ""
594
+ "Waarschuwing: Afbeelding data bestaat niet, upload aub uw afbeelding opnieuw"
595
+
596
+ #: ../inc/slide/metaslide.image.class.php:130
597
+ msgid "Image Title Text"
598
+ msgstr "Text Titel Afbeelding"
599
+
600
+ #: ../inc/slide/metaslide.image.class.php:132
601
+ msgid "Image Alt Text"
602
+ msgstr "Alternatieve Afbeelding text"
languages/metaslider-ro_RO.mo ADDED
Binary file
languages/metaslider-ro_RO.po ADDED
@@ -0,0 +1,604 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: metaslider\n"
4
+ "POT-Creation-Date: 2013-12-16 17:31-0000\n"
5
+ "PO-Revision-Date: 2014-03-28 12:41+0200\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Generator: Poedit 1.5.7\n"
12
+ "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-SearchPath-0: .\n"
15
+ "X-Poedit-SearchPath-1: ..\n"
16
+
17
+ #: ../ml-slider.php:102
18
+ msgid "Go Pro"
19
+ msgstr "Cumpără varianta PRO"
20
+
21
+ #: ../ml-slider.php:156
22
+ msgid "Image"
23
+ msgstr "Imagine"
24
+
25
+ #: ../ml-slider.php:157
26
+ msgid "Add to slider"
27
+ msgstr "Adaugă la diapozitiv"
28
+
29
+ #: ../ml-slider.php:177
30
+ msgid "Post Feed"
31
+ msgstr "Flux Postări"
32
+
33
+ #: ../ml-slider.php:178
34
+ msgid "Vimeo"
35
+ msgstr "Vimeo"
36
+
37
+ #: ../ml-slider.php:179
38
+ msgid "YouTube"
39
+ msgstr "YouTube"
40
+
41
+ #: ../ml-slider.php:180
42
+ msgid "Layer Slide"
43
+ msgstr "Layer Slide"
44
+
45
+ #: ../ml-slider.php:235 ../inc/slide/metaslide.image.class.php:103
46
+ msgid "URL"
47
+ msgstr "URL"
48
+
49
+ #: ../ml-slider.php:236 ../inc/slide/metaslide.image.class.php:101
50
+ msgid "Caption"
51
+ msgstr "Titlu"
52
+
53
+ #: ../ml-slider.php:237 ../inc/slide/metaslide.image.class.php:102
54
+ msgid "New Window"
55
+ msgstr "Fereastră Nouă"
56
+
57
+ #: ../ml-slider.php:238
58
+ msgid "Are you sure?"
59
+ msgstr "Eşti sigur ?"
60
+
61
+ #: ../ml-slider.php:242
62
+ msgid ""
63
+ "Caution: This setting is for advanced developers only. If you're unsure, "
64
+ "leave it checked."
65
+ msgstr ""
66
+ "Atenţie : Această opţiune este destinată doar dezvoltatorilor. Dacă nu "
67
+ "sunteţi sigur, lăsaţi bifat ."
68
+
69
+ #: ../ml-slider.php:278
70
+ msgid "Upgrade to Pro $19"
71
+ msgstr "Actualizaţi la varianta Pro $19"
72
+
73
+ #: ../ml-slider.php:294
74
+ msgid "Documentation"
75
+ msgstr "Documentaţie"
76
+
77
+ #: ../ml-slider.php:430
78
+ msgid "New Slider"
79
+ msgstr "Diapozitiv Nou"
80
+
81
+ #: ../ml-slider.php:692
82
+ msgid "New slideshow created. Click 'Add Slide' to get started!"
83
+ msgstr "Diapoziv nou creat. Apăsaţi 'Adaugă Diapozitiv' pentru a începe !"
84
+
85
+ #: ../ml-slider.php:709
86
+ msgid "or"
87
+ msgstr "sau"
88
+
89
+ #: ../ml-slider.php:710
90
+ msgid "Add New Slideshow"
91
+ msgstr "Adaugă Diapozitiv Nou"
92
+
93
+ #: ../ml-slider.php:726
94
+ msgid "Create your first slideshow"
95
+ msgstr "Creaţi primul dvs. diapozitiv"
96
+
97
+ #: ../ml-slider.php:744
98
+ msgid "Settings"
99
+ msgstr "Setări"
100
+
101
+ #: ../ml-slider.php:745
102
+ msgid "Save"
103
+ msgstr "Salvaţi"
104
+
105
+ #: ../ml-slider.php:746
106
+ msgid "Save & Preview"
107
+ msgstr "Previzualizare & Salvare"
108
+
109
+ #: ../ml-slider.php:759
110
+ msgid "Flex Slider"
111
+ msgstr "Flex Slider"
112
+
113
+ #: ../ml-slider.php:760
114
+ msgid "Responsive"
115
+ msgstr "Responsive"
116
+
117
+ #: ../ml-slider.php:761
118
+ msgid "Nivo Slider"
119
+ msgstr "Nivo Slider"
120
+
121
+ #: ../ml-slider.php:762
122
+ msgid "Coin Slider"
123
+ msgstr "Coin Slider"
124
+
125
+ #: ../ml-slider.php:773 ../ml-slider.php:995
126
+ msgid "Width"
127
+ msgstr "Lăţime"
128
+
129
+ #: ../ml-slider.php:775
130
+ msgid "Slideshow width"
131
+ msgstr "Lăţime Diapozitiv"
132
+
133
+ #: ../ml-slider.php:776 ../ml-slider.php:789
134
+ msgid "px"
135
+ msgstr "px"
136
+
137
+ #: ../ml-slider.php:786 ../ml-slider.php:1008
138
+ msgid "Height"
139
+ msgstr "Înălţime"
140
+
141
+ #: ../ml-slider.php:788
142
+ msgid "Slideshow height"
143
+ msgstr "Înăţime Diapozitiv"
144
+
145
+ #: ../ml-slider.php:795
146
+ msgid "Effect"
147
+ msgstr "Efect"
148
+
149
+ #: ../ml-slider.php:797
150
+ msgid "Slide transition effect"
151
+ msgstr "Efect tranziţie diapozitiv"
152
+
153
+ #: ../ml-slider.php:799 ../ml-slider.php:927
154
+ msgid "Random"
155
+ msgstr "Aleatoriu"
156
+
157
+ #: ../ml-slider.php:800
158
+ msgid "Swirl"
159
+ msgstr "Învârtire"
160
+
161
+ #: ../ml-slider.php:801
162
+ msgid "Rain"
163
+ msgstr "Curgător"
164
+
165
+ #: ../ml-slider.php:802
166
+ msgid "Straight"
167
+ msgstr "Liniar"
168
+
169
+ #: ../ml-slider.php:803
170
+ msgid "Slide Down"
171
+ msgstr "Glisaţi în Jos"
172
+
173
+ #: ../ml-slider.php:804
174
+ msgid "Slice Up"
175
+ msgstr "Decupaţi Sus"
176
+
177
+ #: ../ml-slider.php:805
178
+ msgid "Slide Up Left"
179
+ msgstr "Decupaţi în Stânga Sus"
180
+
181
+ #: ../ml-slider.php:806
182
+ msgid "Slice Up Down"
183
+ msgstr "Decupaţi Sus Jos"
184
+
185
+ #: ../ml-slider.php:807
186
+ msgid "Slide Up Down Left"
187
+ msgstr "Decupaţi în Sânga Sus Jos"
188
+
189
+ #: ../ml-slider.php:808
190
+ msgid "Fold"
191
+ msgstr "Pliaţi"
192
+
193
+ #: ../ml-slider.php:809
194
+ msgid "Fade"
195
+ msgstr "Apunere"
196
+
197
+ #: ../ml-slider.php:810
198
+ msgid "Slide In Right"
199
+ msgstr "Glisare Spre Dreapta"
200
+
201
+ #: ../ml-slider.php:811
202
+ msgid "Slide In Left"
203
+ msgstr "Glisare Spre Stânga"
204
+
205
+ #: ../ml-slider.php:812
206
+ msgid "Box Random"
207
+ msgstr "Caseta Aleatoriu"
208
+
209
+ #: ../ml-slider.php:813
210
+ msgid "Box Rain"
211
+ msgstr "Caseta Curgător"
212
+
213
+ #: ../ml-slider.php:814
214
+ msgid "Box Rain Reverse"
215
+ msgstr "Caseta Curgător Invers"
216
+
217
+ #: ../ml-slider.php:815
218
+ msgid "Box Rain Grow Reverse"
219
+ msgstr "Caseta Curgător Crescător Invers"
220
+
221
+ #: ../ml-slider.php:816
222
+ msgid "Slide"
223
+ msgstr "Glisaţi"
224
+
225
+ #: ../ml-slider.php:823
226
+ msgid "Theme"
227
+ msgstr "Temă"
228
+
229
+ #: ../ml-slider.php:825
230
+ msgid "Slideshow theme"
231
+ msgstr "Diapozitiv temă"
232
+
233
+ #: ../ml-slider.php:827
234
+ msgid "Default"
235
+ msgstr "Implicit"
236
+
237
+ #: ../ml-slider.php:828
238
+ msgid "Dark (Nivo)"
239
+ msgstr "Dark (Nivo)"
240
+
241
+ #: ../ml-slider.php:829
242
+ msgid "Light (Nivo)"
243
+ msgstr "Light (Nivo)"
244
+
245
+ #: ../ml-slider.php:830
246
+ msgid "Bar (Nivo)"
247
+ msgstr "Bar (Nivo)"
248
+
249
+ #: ../ml-slider.php:836
250
+ msgid "Arrows"
251
+ msgstr "Săgeţi"
252
+
253
+ #: ../ml-slider.php:839
254
+ msgid "Show the previous/next arrows"
255
+ msgstr "Afişaţi săgeţile Înapoi/Înainte"
256
+
257
+ #: ../ml-slider.php:844
258
+ msgid "Navigation"
259
+ msgstr "Navigare"
260
+
261
+ #: ../ml-slider.php:847
262
+ msgid "Show the slide navigation bullets"
263
+ msgstr "Afişaţi bulinele de navigare ale diapozitivului"
264
+
265
+ #: ../ml-slider.php:849
266
+ msgid "Hidden"
267
+ msgstr "Ascuns"
268
+
269
+ #: ../ml-slider.php:850
270
+ msgid "Dots"
271
+ msgstr "Puncte (buline)"
272
+
273
+ #: ../ml-slider.php:851
274
+ msgid "Thumbnails (Pro)"
275
+ msgstr "Miniaturi (Pro)"
276
+
277
+ #: ../ml-slider.php:862
278
+ msgid "Title"
279
+ msgstr "Titlu"
280
+
281
+ #: ../ml-slider.php:863
282
+ msgid "Slideshow title"
283
+ msgstr "Titlu diapozitiv"
284
+
285
+ #: ../ml-slider.php:877
286
+ msgid "Advanced Settings"
287
+ msgstr "Setări Avansate"
288
+
289
+ #: ../ml-slider.php:886
290
+ msgid "Stretch"
291
+ msgstr "Întindere(extindere)"
292
+
293
+ #: ../ml-slider.php:888
294
+ msgid "100% wide output"
295
+ msgstr "lărgime 100%"
296
+
297
+ #: ../ml-slider.php:890
298
+ msgid "Stretch the slideshow output to fill it's parent container"
299
+ msgstr "Extindeţi diapozitivul pentru încadrare optimă"
300
+
301
+ #: ../ml-slider.php:895
302
+ msgid "Center align"
303
+ msgstr "Aliniere centrală"
304
+
305
+ #: ../ml-slider.php:898
306
+ msgid "Center align the slideshow"
307
+ msgstr "Alinierea centrală a diapozitivului"
308
+
309
+ #: ../ml-slider.php:903
310
+ msgid "Auto play"
311
+ msgstr "Redare automată"
312
+
313
+ #: ../ml-slider.php:906
314
+ msgid "Transition between slides automatically"
315
+ msgstr "Tranziţie automată între diapozitive"
316
+
317
+ #: ../ml-slider.php:911
318
+ msgid "Smart crop"
319
+ msgstr "Decupare inteligentă"
320
+
321
+ #: ../ml-slider.php:914
322
+ msgid ""
323
+ "Smart Crop ensures your responsive slides are cropped to a ratio that "
324
+ "results in a consistent slideshow size"
325
+ msgstr ""
326
+ "Decupare Inteligentă se asigură că diapozitivele sunt decupate la un raport "
327
+ "din care rezultă un diapozitiv la mărimea dorită"
328
+
329
+ #: ../ml-slider.php:919
330
+ msgid "Carousel mode"
331
+ msgstr "Modul Carusel"
332
+
333
+ #: ../ml-slider.php:922
334
+ msgid "Display multiple slides at once. Slideshow output will be 100% wide."
335
+ msgstr ""
336
+ "Afişaţi mai multe diapozitive simultan. Dimensiunea diapozitivului va fi de "
337
+ "100% ."
338
+
339
+ #: ../ml-slider.php:930
340
+ msgid "Randomise the order of the slides"
341
+ msgstr "Sortaţi ordinea diapozitivelor"
342
+
343
+ #: ../ml-slider.php:935
344
+ msgid "Hover pause"
345
+ msgstr "Pauză la planare cursor"
346
+
347
+ #: ../ml-slider.php:938
348
+ msgid ""
349
+ "Pause the slideshow when hovering over slider, then resume when no longer "
350
+ "hovering."
351
+ msgstr ""
352
+ "Puneţi pauză diapozitivului la planarea cursorului , apoi reluaţi când "
353
+ "planarea cursorului încetează."
354
+
355
+ #: ../ml-slider.php:943
356
+ msgid "Reverse"
357
+ msgstr "Invers"
358
+
359
+ #: ../ml-slider.php:946
360
+ msgid "Reverse the animation direction"
361
+ msgstr "Inversaţi direcţia animaţiei"
362
+
363
+ #: ../ml-slider.php:956
364
+ msgid "Slide delay"
365
+ msgstr "Temporizare diapozitiv"
366
+
367
+ #: ../ml-slider.php:958
368
+ msgid "How long to display each slide, in milliseconds"
369
+ msgstr "Durata de afişare a fiecărui diapozitiv , în milisecunde"
370
+
371
+ #: ../ml-slider.php:959 ../ml-slider.php:972 ../ml-slider.php:985
372
+ #: ../ml-slider.php:1061 ../ml-slider.php:1087
373
+ msgid "ms"
374
+ msgstr "ms"
375
+
376
+ #: ../ml-slider.php:969
377
+ msgid "Animation speed"
378
+ msgstr "Viteza animaţiei"
379
+
380
+ #: ../ml-slider.php:971
381
+ msgid "Set the speed of animations, in milliseconds"
382
+ msgstr "Setaţi viteza animaţiilor, în milisecunde"
383
+
384
+ #: ../ml-slider.php:982 ../ml-slider.php:984
385
+ msgid "Number of slices"
386
+ msgstr "Numărul decupăturilor"
387
+
388
+ #: ../ml-slider.php:995 ../ml-slider.php:997 ../ml-slider.php:1008
389
+ #: ../ml-slider.php:1010
390
+ msgid "Number of squares"
391
+ msgstr "Numărul pătratelor"
392
+
393
+ #: ../ml-slider.php:1016
394
+ msgid "Slide direction"
395
+ msgstr "Direcţie de glisare"
396
+
397
+ #: ../ml-slider.php:1018
398
+ msgid "Select the sliding direction"
399
+ msgstr "Selectaţi direcţia de glisare"
400
+
401
+ #: ../ml-slider.php:1021
402
+ msgid "Horizontal"
403
+ msgstr "Orizontal"
404
+
405
+ #: ../ml-slider.php:1022
406
+ msgid "Vertical"
407
+ msgstr "Vertical"
408
+
409
+ #: ../ml-slider.php:1028
410
+ msgid "Easing"
411
+ msgstr "Easing"
412
+
413
+ #: ../ml-slider.php:1030
414
+ msgid "Animation easing effect"
415
+ msgstr "Efectul de easing al animaţiei"
416
+
417
+ #: ../ml-slider.php:1037
418
+ msgid "Previous text"
419
+ msgstr "Textul anterior"
420
+
421
+ #: ../ml-slider.php:1039
422
+ msgid "Set the text for the 'previous' direction item"
423
+ msgstr "Setaţi textul pentru elementul din direcţia 'anterior'"
424
+
425
+ #: ../ml-slider.php:1045
426
+ msgid "Next text"
427
+ msgstr "Textul urmator"
428
+
429
+ #: ../ml-slider.php:1047
430
+ msgid "Set the text for the 'next' direction item"
431
+ msgstr "Setaţi textul pentru elementul din direcţia 'urmator'"
432
+
433
+ #: ../ml-slider.php:1058
434
+ msgid "Square delay"
435
+ msgstr "Temporizare casetă(pătrat)"
436
+
437
+ #: ../ml-slider.php:1060
438
+ msgid "Delay between squares in ms"
439
+ msgstr "Temporizare între casete în ms"
440
+
441
+ #: ../ml-slider.php:1071
442
+ msgid "Opacity"
443
+ msgstr "Opacitate"
444
+
445
+ #: ../ml-slider.php:1073
446
+ msgid "Opacity of title and navigation"
447
+ msgstr "Opacitate titlu şi navigaţie"
448
+
449
+ #: ../ml-slider.php:1084
450
+ msgid "Caption speed"
451
+ msgstr "Viteza titlu"
452
+
453
+ #: ../ml-slider.php:1086
454
+ msgid "Set the fade in speed of the caption"
455
+ msgstr "Setaţi viteza de apunere a titlului"
456
+
457
+ #: ../ml-slider.php:1093
458
+ msgid "Developer options"
459
+ msgstr "Opţiuni dezvoltator"
460
+
461
+ #: ../ml-slider.php:1098
462
+ msgid "CSS classes"
463
+ msgstr "Clase CSS"
464
+
465
+ #: ../ml-slider.php:1100
466
+ msgid ""
467
+ "Specify any custom CSS Classes you would like to be added to the slider "
468
+ "wrapper"
469
+ msgstr ""
470
+ "Specificaţi orice Clase CSS pe care aţi dorii să fie adăugate la ambalatorul "
471
+ "diapozitivului"
472
+
473
+ #: ../ml-slider.php:1106
474
+ msgid "Print CSS"
475
+ msgstr "Publicare CSS"
476
+
477
+ #: ../ml-slider.php:1109
478
+ msgid "Uncheck this is you would like to include your own CSS"
479
+ msgstr "Prin debifarea acesteia doriţi să includeţi propriul dvs. CSS"
480
+
481
+ #: ../ml-slider.php:1114
482
+ msgid "Print JS"
483
+ msgstr "Publicare JS"
484
+
485
+ #: ../ml-slider.php:1117
486
+ msgid "Uncheck this is you would like to include your own Javascript"
487
+ msgstr "Prin debifarea acesteia doriţi să includeţi propriul dvs. Javascript"
488
+
489
+ #: ../ml-slider.php:1122
490
+ msgid "No conflict mode"
491
+ msgstr "Modul fară conflict"
492
+
493
+ #: ../ml-slider.php:1125
494
+ msgid "Delay adding the flexslider class to the slideshow"
495
+ msgstr "Temporizare în adăugarea clasei flexslider la diapozitiv"
496
+
497
+ #: ../ml-slider.php:1139
498
+ msgid "Usage"
499
+ msgstr "Utilizare"
500
+
501
+ #: ../ml-slider.php:1142
502
+ msgid "Shortcode"
503
+ msgstr "Cod scurt"
504
+
505
+ #: ../ml-slider.php:1143
506
+ msgid "Template Include"
507
+ msgstr "Şablonul Include"
508
+
509
+ #: ../ml-slider.php:1147
510
+ msgid "Copy & paste the shortcode directly into any WordPress post or page."
511
+ msgstr ""
512
+ "Copiaţi şi lipiţi codul scurt direct in orice postare sau pagina Wordpress"
513
+
514
+ #: ../ml-slider.php:1150
515
+ msgid ""
516
+ "Copy & paste this code into a template file to include the slideshow within "
517
+ "your theme."
518
+ msgstr ""
519
+ "Copiaţi şi lipiţi acest cod într-un fişier şablon pentru a include "
520
+ "diapozitivul in tema dvs."
521
+
522
+ #: ../ml-slider.php:1179
523
+ msgid "Delete Slider"
524
+ msgstr "Ştergere Diapozitiv"
525
+
526
+ #: ../ml-slider.php:1190
527
+ msgid "Slides"
528
+ msgstr "Diapozitive"
529
+
530
+ #: ../ml-slider.php:1193 ../ml-slider.php:1194
531
+ msgid "Add Slide"
532
+ msgstr "Adăugare Diapozitiv"
533
+
534
+ #: ../ml-slider.php:1224
535
+ msgid "Select slideshow to insert into post"
536
+ msgstr "Selectaţi diapozitivul pe care doriţi să-l inseraţi în postare"
537
+
538
+ #: ../ml-slider.php:1227
539
+ msgid "Add slider"
540
+ msgstr "Adăugare diapozitiv"
541
+
542
+ #: ../ml-slider.php:1258
543
+ msgid "Insert Meta Slider"
544
+ msgstr "Inserare Meta Slider"
545
+
546
+ #: ../ml-slider.php:1260
547
+ msgid "Choose slideshow"
548
+ msgstr "Alegeţi diapozitiv"
549
+
550
+ #: ../ml-slider.php:1267 ../inc/metaslider.widget.class.php:124
551
+ msgid "No slideshows found"
552
+ msgstr "Nici un diapozitiv găsit"
553
+
554
+ #: ../inc/metaslider.widget.class.php:18
555
+ msgid "Meta Slider"
556
+ msgstr "Meta Slider"
557
+
558
+ #: ../inc/metaslider.widget.class.php:111
559
+ msgid "Title:"
560
+ msgstr "Titlu"
561
+
562
+ #: ../inc/metaslider.widget.class.php:114
563
+ msgid "Select Slider:"
564
+ msgstr "Selectaţi Diapozitivul"
565
+
566
+ #: ../inc/slide/metaslide.image.class.php:23
567
+ msgid "Security check failed. Refresh page and try again."
568
+ msgstr ""
569
+ "Verificarea de securitate a eşuat. Reîmprospătaţi pagina şi încercaţi din "
570
+ "nou."
571
+
572
+ #: ../inc/slide/metaslide.image.class.php:36
573
+ msgid "Failed to add slide. Slide already exists in slideshow."
574
+ msgstr ""
575
+ "Eşuare în adaugarea diapozitivului. Diapozitivul există deja în diapozitive."
576
+
577
+ #: ../inc/slide/metaslide.image.class.php:38
578
+ msgid "Failed to add slide. Slide is not of type 'image'."
579
+ msgstr ""
580
+ "Eşuare în adaugarea diapozitivului. Diapozitivul nu este de tip 'imagine'."
581
+
582
+ #: ../inc/slide/metaslide.image.class.php:110
583
+ msgid "Image Slide"
584
+ msgstr "Imagine Diapozitiv"
585
+
586
+ #: ../inc/slide/metaslide.image.class.php:115
587
+ msgid "General"
588
+ msgstr "General"
589
+
590
+ #: ../inc/slide/metaslide.image.class.php:116
591
+ msgid "SEO"
592
+ msgstr "SEO"
593
+
594
+ #: ../inc/slide/metaslide.image.class.php:121
595
+ msgid "Warning: Image data does not exist. Please re-upload the image."
596
+ msgstr "Avertisment: Imaginea nu există. Vă rugăm să reîncărcaţi imaginea."
597
+
598
+ #: ../inc/slide/metaslide.image.class.php:130
599
+ msgid "Image Title Text"
600
+ msgstr "Titlu Imagine"
601
+
602
+ #: ../inc/slide/metaslide.image.class.php:132
603
+ msgid "Image Alt Text"
604
+ msgstr "Text Alt Imagine"
languages/metaslider-ru_RU.mo ADDED
Binary file
languages/metaslider-ru_RU.po ADDED
@@ -0,0 +1,782 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Meta Slider v2.8-beta\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2014-04-25 01:29:30+0000\n"
7
+ "Last-Translator: admin <info@1245.ru>\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "Plural-Forms: nplurals=3; plural=n%100/10==1 ? 2 : n%10==1 ? 0 : (n+9)%10>3 ? 2 : 1;\n"
13
+ "X-Generator: CSL v1.x\n"
14
+ "X-Poedit-Language: Russian\n"
15
+ "X-Poedit-Country: RUSSIA\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
18
+ "X-Poedit-Basepath: ../\n"
19
+ "X-Poedit-Bookmarks: \n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+ "X-Textdomain-Support: yes"
22
+
23
+ #. translators: plugin header field 'Name'
24
+ #: inc/metaslider.widget.class.php:18
25
+ #: ml-slider.php:0
26
+ #@ metaslider
27
+ msgid "Meta Slider"
28
+ msgstr "Мета слайдер"
29
+
30
+ #: inc/metaslider.widget.class.php:108
31
+ #@ metaslider
32
+ msgid "Title:"
33
+ msgstr "Название:"
34
+
35
+ #: inc/metaslider.widget.class.php:111
36
+ #@ metaslider
37
+ msgid "Select Slider:"
38
+ msgstr "Выберите слайдер:"
39
+
40
+ #: inc/metaslider.widget.class.php:121
41
+ #: ml-slider.php:1494
42
+ #@ metaslider
43
+ msgid "No slideshows found"
44
+ msgstr "Не найдено ни одного слайд-шоу"
45
+
46
+ #: inc/slide/metaslide.image.class.php:23
47
+ #@ metaslider
48
+ msgid "Security check failed. Refresh page and try again."
49
+ msgstr "Проверка безопасности не удалась. Обновить страницу и попробуйте еще раз."
50
+
51
+ #: inc/slide/metaslide.image.class.php:36
52
+ #@ metaslider
53
+ msgid "Failed to add slide. Slide already exists in slideshow."
54
+ msgstr "Добавить слайд не удалось. Такой слайд уже существует в слайд-шоу."
55
+
56
+ #: inc/slide/metaslide.image.class.php:38
57
+ #@ metaslider
58
+ msgid "Failed to add slide. Slide is not of type 'image'."
59
+ msgstr "Добавить слайд не удалось. Этот слайд не является изображением."
60
+
61
+ #: inc/slide/metaslide.image.class.php:101
62
+ #: ml-slider.php:381
63
+ #@ metaslider
64
+ msgid "Caption"
65
+ msgstr "Описание"
66
+
67
+ #: inc/slide/metaslide.image.class.php:102
68
+ #: ml-slider.php:382
69
+ #@ metaslider
70
+ msgid "New Window"
71
+ msgstr "Открывать в новом окне"
72
+
73
+ #: inc/slide/metaslide.image.class.php:103
74
+ #: ml-slider.php:380
75
+ #@ metaslider
76
+ msgid "URL"
77
+ msgstr "Ссылка (URL)"
78
+
79
+ #: inc/slide/metaslide.image.class.php:104
80
+ #@ metaslider
81
+ msgid "Image Slide"
82
+ msgstr "Слайд"
83
+
84
+ #: inc/slide/metaslide.image.class.php:118
85
+ #@ metaslider
86
+ msgid "General"
87
+ msgstr "Основное"
88
+
89
+ #: inc/slide/metaslide.image.class.php:119
90
+ #@ metaslider
91
+ msgid "SEO"
92
+ msgstr "CEO"
93
+
94
+ #: inc/slide/metaslide.image.class.php:124
95
+ #@ metaslider
96
+ msgid "Warning: Image data does not exist. Please re-upload the image."
97
+ msgstr "Внимание: данные изображения не существуют. Пожалуйста, загрузить изображение еще раз."
98
+
99
+ #: inc/slide/metaslide.image.class.php:133
100
+ #@ metaslider
101
+ msgid "Image Title Text"
102
+ msgstr "Title изображния"
103
+
104
+ #: inc/slide/metaslide.image.class.php:135
105
+ #@ metaslider
106
+ msgid "Image Alt Text"
107
+ msgstr "Alt изображения"
108
+
109
+ #. translators: plugin header field 'PluginURI'
110
+ #: ml-slider.php:0
111
+ #@ metaslider
112
+ msgid "http://www.metaslider.com"
113
+ msgstr "http://www.metaslider.com"
114
+
115
+ #. translators: plugin header field 'Description'
116
+ #: ml-slider.php:0
117
+ #@ metaslider
118
+ msgid "Easy to use slideshow plugin. Create SEO optimised responsive slideshows with Nivo Slider, Flex Slider, Coin Slider and Responsive Slides."
119
+ msgstr "Простой в использовании слайд-шоу плагин. Создавайте СЕО-оптимизированные адаптивные слайд-шоу с Nivo Slider, Flex Slider, Coin Slider и Responsive Slides."
120
+
121
+ #. translators: plugin header field 'Author'
122
+ #: ml-slider.php:0
123
+ #@ metaslider
124
+ msgid "Matcha Labs"
125
+ msgstr "Matcha Labs"
126
+
127
+ #. translators: plugin header field 'AuthorURI'
128
+ #: ml-slider.php:0
129
+ #@ metaslider
130
+ msgid "http://www.matchalabs.com"
131
+ msgstr "http://www.matchalabs.com"
132
+
133
+ #. translators: plugin header field 'Version'
134
+ #: ml-slider.php:0
135
+ #@ metaslider
136
+ msgid "2.8-beta"
137
+ msgstr "2.8-beta"
138
+
139
+ #: ml-slider.php:328
140
+ #@ metaslider
141
+ msgid "Documentation"
142
+ msgstr "Документация"
143
+
144
+ #: ml-slider.php:383
145
+ #@ metaslider
146
+ msgid "Are you sure?"
147
+ msgstr "Вы уверены?"
148
+
149
+ #: ml-slider.php:388
150
+ #@ metaslider
151
+ msgid "Caution: This setting is for advanced developers only. If you're unsure, leave it checked."
152
+ msgstr "Внимание: данная настройка только для опытных пользователей. Если вы не уверены, оставьте её отмеченной."
153
+
154
+ #: ml-slider.php:437
155
+ #@ metaslider
156
+ msgid "Image"
157
+ msgstr "Изображение"
158
+
159
+ #: ml-slider.php:438
160
+ #@ metaslider
161
+ msgid "Add to slider"
162
+ msgstr "Добавить в слайдер"
163
+
164
+ #: ml-slider.php:464
165
+ #@ metaslider
166
+ msgid "Post Feed"
167
+ msgstr "Лента записей"
168
+
169
+ #: ml-slider.php:465
170
+ #@ metaslider
171
+ msgid "Vimeo"
172
+ msgstr "Vimeo"
173
+
174
+ #: ml-slider.php:466
175
+ #@ metaslider
176
+ msgid "YouTube"
177
+ msgstr "YouTube"
178
+
179
+ #: ml-slider.php:467
180
+ #@ metaslider
181
+ msgid "Layer Slide"
182
+ msgstr "Слайд-слой"
183
+
184
+ #: ml-slider.php:584
185
+ #@ metaslider
186
+ msgid "New Slider"
187
+ msgstr "Новый слайдер"
188
+
189
+ #: ml-slider.php:903
190
+ #@ metaslider
191
+ msgid "New slideshow created. Click 'Add Slide' to get started!"
192
+ msgstr "Новое слайд-шоу создано. Нажмите кнопку \"Добавить слайд\", чтобы начать работу!"
193
+
194
+ #: ml-slider.php:920
195
+ #@ metaslider
196
+ msgid "or"
197
+ msgstr "или"
198
+
199
+ #: ml-slider.php:921
200
+ #@ metaslider
201
+ msgid "Add New Slideshow"
202
+ msgstr "Добавить новое слайд-шоу"
203
+
204
+ #: ml-slider.php:937
205
+ #@ metaslider
206
+ msgid "Create your first slideshow"
207
+ msgstr "Создайте Ваше первое слайд-шоу"
208
+
209
+ #: ml-slider.php:956
210
+ #@ metaslider
211
+ msgid "Slides"
212
+ msgstr "Слайды"
213
+
214
+ #: ml-slider.php:959
215
+ #: ml-slider.php:960
216
+ #@ metaslider
217
+ msgid "Add Slide"
218
+ msgstr "Добавить слайд"
219
+
220
+ #: ml-slider.php:980
221
+ #@ metaslider
222
+ msgid "Settings"
223
+ msgstr "Настройки"
224
+
225
+ #: ml-slider.php:981
226
+ #@ metaslider
227
+ msgid "Save"
228
+ msgstr "Сохранить"
229
+
230
+ #: ml-slider.php:982
231
+ #@ metaslider
232
+ msgid "Save & Preview"
233
+ msgstr "Просмотр"
234
+
235
+ #: ml-slider.php:995
236
+ #@ metaslider
237
+ msgid "Flex Slider"
238
+ msgstr "Flex Slider"
239
+
240
+ #: ml-slider.php:996
241
+ #@ metaslider
242
+ msgid "R. Slides"
243
+ msgstr "R. Slides"
244
+
245
+ #: ml-slider.php:997
246
+ #@ metaslider
247
+ msgid "Nivo Slider"
248
+ msgstr "Nivo Slider"
249
+
250
+ #: ml-slider.php:998
251
+ #@ metaslider
252
+ msgid "Coin Slider"
253
+ msgstr "Coin Slider"
254
+
255
+ #: ml-slider.php:1009
256
+ #: ml-slider.php:1243
257
+ #@ metaslider
258
+ msgid "Width"
259
+ msgstr "Ширина"
260
+
261
+ #: ml-slider.php:1011
262
+ #@ metaslider
263
+ msgid "Slideshow width"
264
+ msgstr "Ширина слайд-шоу"
265
+
266
+ #: ml-slider.php:1012
267
+ #: ml-slider.php:1025
268
+ #: ml-slider.php:1170
269
+ #@ metaslider
270
+ msgid "px"
271
+ msgstr "пикселей"
272
+
273
+ #: ml-slider.php:1022
274
+ #: ml-slider.php:1256
275
+ #@ metaslider
276
+ msgid "Height"
277
+ msgstr "Высота"
278
+
279
+ #: ml-slider.php:1024
280
+ #@ metaslider
281
+ msgid "Slideshow height"
282
+ msgstr "Высота слайд-шоу"
283
+
284
+ #: ml-slider.php:1031
285
+ #@ metaslider
286
+ msgid "Effect"
287
+ msgstr "Эффект"
288
+
289
+ #: ml-slider.php:1033
290
+ #@ metaslider
291
+ msgid "Slide transition effect"
292
+ msgstr "Эффект смены слайдов"
293
+
294
+ #: ml-slider.php:1035
295
+ #: ml-slider.php:1175
296
+ #@ metaslider
297
+ msgid "Random"
298
+ msgstr "Случайно"
299
+
300
+ #: ml-slider.php:1036
301
+ #@ metaslider
302
+ msgid "Swirl"
303
+ msgstr "Кручение"
304
+
305
+ #: ml-slider.php:1037
306
+ #@ metaslider
307
+ msgid "Rain"
308
+ msgstr "Дождь"
309
+
310
+ #: ml-slider.php:1038
311
+ #@ metaslider
312
+ msgid "Straight"
313
+ msgstr "Классический"
314
+
315
+ #: ml-slider.php:1039
316
+ #@ metaslider
317
+ msgid "Slide Down"
318
+ msgstr "Скольжение вниз"
319
+
320
+ #: ml-slider.php:1040
321
+ #@ metaslider
322
+ msgid "Slice Up"
323
+ msgstr "Сдвиг"
324
+
325
+ #: ml-slider.php:1041
326
+ #@ metaslider
327
+ msgid "Slide Up Left"
328
+ msgstr "Скольжение вверх влево"
329
+
330
+ #: ml-slider.php:1042
331
+ #@ metaslider
332
+ msgid "Slice Up Down"
333
+ msgstr "Сдвиг вниз"
334
+
335
+ #: ml-slider.php:1043
336
+ #@ metaslider
337
+ msgid "Slide Up Down Left"
338
+ msgstr "Сдвиг влево вниз"
339
+
340
+ #: ml-slider.php:1044
341
+ #@ metaslider
342
+ msgid "Fold"
343
+ msgstr "Жалюзи"
344
+
345
+ #: ml-slider.php:1045
346
+ #@ metaslider
347
+ msgid "Fade"
348
+ msgstr "Растворение"
349
+
350
+ #: ml-slider.php:1046
351
+ #@ metaslider
352
+ msgid "Slide In Right"
353
+ msgstr "Скольжение вправо"
354
+
355
+ #: ml-slider.php:1047
356
+ #@ metaslider
357
+ msgid "Slide In Left"
358
+ msgstr "Скольжение влево"
359
+
360
+ #: ml-slider.php:1048
361
+ #@ metaslider
362
+ msgid "Box Random"
363
+ msgstr "Случайные квадраты"
364
+
365
+ #: ml-slider.php:1049
366
+ #@ metaslider
367
+ msgid "Box Rain"
368
+ msgstr "Мозаика"
369
+
370
+ #: ml-slider.php:1050
371
+ #@ metaslider
372
+ msgid "Box Rain Reverse"
373
+ msgstr "Обратная мозаика"
374
+
375
+ #: ml-slider.php:1051
376
+ #@ metaslider
377
+ msgid "Box Rain Grow Reverse"
378
+ msgstr "Возрастающая мозаика"
379
+
380
+ #: ml-slider.php:1052
381
+ #@ metaslider
382
+ msgid "Slide"
383
+ msgstr "Скольжение"
384
+
385
+ #: ml-slider.php:1059
386
+ #@ metaslider
387
+ msgid "Theme"
388
+ msgstr "Дизайн"
389
+
390
+ #: ml-slider.php:1061
391
+ #@ metaslider
392
+ msgid "Slideshow theme"
393
+ msgstr "Дизайн слайд-шоу"
394
+
395
+ #: ml-slider.php:1063
396
+ #@ metaslider
397
+ msgid "Default"
398
+ msgstr "По умолчанию"
399
+
400
+ #: ml-slider.php:1064
401
+ #@ metaslider
402
+ msgid "Dark (Nivo)"
403
+ msgstr "Темный (Nivo)"
404
+
405
+ #: ml-slider.php:1065
406
+ #@ metaslider
407
+ msgid "Light (Nivo)"
408
+ msgstr "Светлый (Nivo)"
409
+
410
+ #: ml-slider.php:1066
411
+ #@ metaslider
412
+ msgid "Bar (Nivo)"
413
+ msgstr "Плитка (Nivo)"
414
+
415
+ #: ml-slider.php:1072
416
+ #@ metaslider
417
+ msgid "Arrows"
418
+ msgstr "Стрелочки"
419
+
420
+ #: ml-slider.php:1075
421
+ #@ metaslider
422
+ msgid "Show the previous/next arrows"
423
+ msgstr "Показывать стрелки вперед/назад"
424
+
425
+ #: ml-slider.php:1080
426
+ #@ metaslider
427
+ msgid "Navigation"
428
+ msgstr "Навигация"
429
+
430
+ #: ml-slider.php:1083
431
+ #@ metaslider
432
+ msgid "Show the slide navigation bullets"
433
+ msgstr "Показывать метки навигации"
434
+
435
+ #: ml-slider.php:1085
436
+ #@ metaslider
437
+ msgid "Hidden"
438
+ msgstr "Не показывать"
439
+
440
+ #: ml-slider.php:1086
441
+ #@ metaslider
442
+ msgid "Dots"
443
+ msgstr "Точки"
444
+
445
+ #: ml-slider.php:1087
446
+ #@ metaslider
447
+ msgid "Thumbnails (Pro)"
448
+ msgstr "Миниатюры (Pro)"
449
+
450
+ #: ml-slider.php:1098
451
+ #@ metaslider
452
+ msgid "Title"
453
+ msgstr "Название"
454
+
455
+ #: ml-slider.php:1099
456
+ #@ metaslider
457
+ msgid "Slideshow title"
458
+ msgstr "Название слай-шоу"
459
+
460
+ #: ml-slider.php:1113
461
+ #@ metaslider
462
+ msgid "Advanced Settings"
463
+ msgstr "Расширенные настройки"
464
+
465
+ #: ml-slider.php:1122
466
+ #@ metaslider
467
+ msgid "Stretch"
468
+ msgstr "Растянуть"
469
+
470
+ #: ml-slider.php:1124
471
+ #@ metaslider
472
+ msgid "100% wide output"
473
+ msgstr "Во всю ширину"
474
+
475
+ #: ml-slider.php:1126
476
+ #@ metaslider
477
+ msgid "Stretch the slideshow output to fill it's parent container"
478
+ msgstr "Растягивает слайд-шоу на всю ширину родительского элемента"
479
+
480
+ #: ml-slider.php:1131
481
+ #@ metaslider
482
+ msgid "Center align"
483
+ msgstr "Выравнять по центру"
484
+
485
+ #: ml-slider.php:1134
486
+ #@ metaslider
487
+ msgid "Center align the slideshow"
488
+ msgstr "Центрирует слайд-шоу"
489
+
490
+ #: ml-slider.php:1139
491
+ #@ metaslider
492
+ msgid "Auto play"
493
+ msgstr "Воспроизводить автоматически"
494
+
495
+ #: ml-slider.php:1142
496
+ #@ metaslider
497
+ msgid "Transition between slides automatically"
498
+ msgstr "Задержка между сменой слайдов определяется автоматически"
499
+
500
+ #: ml-slider.php:1147
501
+ #@ metaslider
502
+ msgid "Smart crop"
503
+ msgstr "Кадрирование"
504
+
505
+ #: ml-slider.php:1150
506
+ #@ metaslider
507
+ msgid "Smart Crop ensures your responsive slides are cropped to a ratio that results in a consistent slideshow size"
508
+ msgstr "Слайды будут обрезаны с определённым соотношением, чтобы размер слайд-шоу не изменялся"
509
+
510
+ #: ml-slider.php:1155
511
+ #@ metaslider
512
+ msgid "Carousel mode"
513
+ msgstr "Режим карусели"
514
+
515
+ #: ml-slider.php:1158
516
+ #@ metaslider
517
+ msgid "Display multiple slides at once. Slideshow output will be 100% wide."
518
+ msgstr "Показывать несколько слайдов одновременно. Слайд-шоу будет иметь ширину 100%."
519
+
520
+ #: ml-slider.php:1166
521
+ #@ metaslider
522
+ msgid "Carousel margin"
523
+ msgstr "Отступ карусели"
524
+
525
+ #: ml-slider.php:1169
526
+ #@ metaslider
527
+ msgid "Pixel margin between slides in carousel."
528
+ msgstr "Отступ (в пикселях) между слайдами в карусели"
529
+
530
+ #: ml-slider.php:1178
531
+ #@ metaslider
532
+ msgid "Randomise the order of the slides"
533
+ msgstr "Случайный порядок салйдов"
534
+
535
+ #: ml-slider.php:1183
536
+ #@ metaslider
537
+ msgid "Hover pause"
538
+ msgstr "Пауза при наведении мыши"
539
+
540
+ #: ml-slider.php:1186
541
+ #@ metaslider
542
+ msgid "Pause the slideshow when hovering over slider, then resume when no longer hovering."
543
+ msgstr "Останавливает слайд-шоу при наведении на него мышки и снова возобновляет, когда мышка убрана."
544
+
545
+ #: ml-slider.php:1191
546
+ #@ metaslider
547
+ msgid "Reverse"
548
+ msgstr "В обратном порядке"
549
+
550
+ #: ml-slider.php:1194
551
+ #@ metaslider
552
+ msgid "Reverse the animation direction"
553
+ msgstr "Изменить порядок слайдов на обратный"
554
+
555
+ #: ml-slider.php:1204
556
+ #@ metaslider
557
+ msgid "Slide delay"
558
+ msgstr "Время показа слайда"
559
+
560
+ #: ml-slider.php:1206
561
+ #@ metaslider
562
+ msgid "How long to display each slide, in milliseconds"
563
+ msgstr "Как долго будет показан каждый слайд (в миллисекундах)"
564
+
565
+ #: ml-slider.php:1207
566
+ #: ml-slider.php:1220
567
+ #: ml-slider.php:1233
568
+ #: ml-slider.php:1309
569
+ #: ml-slider.php:1335
570
+ #@ metaslider
571
+ msgid "ms"
572
+ msgstr "мс"
573
+
574
+ #: ml-slider.php:1217
575
+ #@ metaslider
576
+ msgid "Animation speed"
577
+ msgstr "Скорость анимации"
578
+
579
+ #: ml-slider.php:1219
580
+ #@ metaslider
581
+ msgid "Set the speed of animations, in milliseconds"
582
+ msgstr "Устанавливает скорость анимации (в миллисекундах)"
583
+
584
+ #: ml-slider.php:1230
585
+ #: ml-slider.php:1232
586
+ #@ metaslider
587
+ msgid "Number of slices"
588
+ msgstr "Количество секций"
589
+
590
+ #: ml-slider.php:1243
591
+ #: ml-slider.php:1245
592
+ #: ml-slider.php:1256
593
+ #: ml-slider.php:1258
594
+ #@ metaslider
595
+ msgid "Number of squares"
596
+ msgstr "Количество квадратов"
597
+
598
+ #: ml-slider.php:1264
599
+ #@ metaslider
600
+ msgid "Slide direction"
601
+ msgstr "Направление воспроизведения"
602
+
603
+ #: ml-slider.php:1266
604
+ #@ metaslider
605
+ msgid "Select the sliding direction"
606
+ msgstr "Выбор направления воспроизведения"
607
+
608
+ #: ml-slider.php:1269
609
+ #@ metaslider
610
+ msgid "Horizontal"
611
+ msgstr "Горизонтально"
612
+
613
+ #: ml-slider.php:1270
614
+ #@ metaslider
615
+ msgid "Vertical"
616
+ msgstr "Вертикально"
617
+
618
+ #: ml-slider.php:1276
619
+ #@ metaslider
620
+ msgid "Easing"
621
+ msgstr "Сглаживание"
622
+
623
+ #: ml-slider.php:1278
624
+ #@ metaslider
625
+ msgid "Animation easing effect"
626
+ msgstr "Анимированный эффект сглаживания"
627
+
628
+ #: ml-slider.php:1285
629
+ #@ metaslider
630
+ msgid "Previous text"
631
+ msgstr "Текст \"назад\""
632
+
633
+ #: ml-slider.php:1287
634
+ #@ metaslider
635
+ msgid "Set the text for the 'previous' direction item"
636
+ msgstr "Установить текст для метки \"назад\" (предыдущий слайд)"
637
+
638
+ #: ml-slider.php:1293
639
+ #@ metaslider
640
+ msgid "Next text"
641
+ msgstr "Текст \"вперед\""
642
+
643
+ #: ml-slider.php:1295
644
+ #@ metaslider
645
+ msgid "Set the text for the 'next' direction item"
646
+ msgstr "Установить текст для метки \"вперед\" (следующий слайд)"
647
+
648
+ #: ml-slider.php:1306
649
+ #@ metaslider
650
+ msgid "Square delay"
651
+ msgstr "Задержка между квадратами"
652
+
653
+ #: ml-slider.php:1308
654
+ #@ metaslider
655
+ msgid "Delay between squares in ms"
656
+ msgstr "Задержка между квадратами (в миллисекундах)"
657
+
658
+ #: ml-slider.php:1319
659
+ #@ metaslider
660
+ msgid "Opacity"
661
+ msgstr "Прозрачность"
662
+
663
+ #: ml-slider.php:1321
664
+ #@ metaslider
665
+ msgid "Opacity of title and navigation"
666
+ msgstr "Прозрачность названия и навигации"
667
+
668
+ #: ml-slider.php:1332
669
+ #@ metaslider
670
+ msgid "Caption speed"
671
+ msgstr "Скорость описания"
672
+
673
+ #: ml-slider.php:1334
674
+ #@ metaslider
675
+ msgid "Set the fade in speed of the caption"
676
+ msgstr "Установить скорость растворения описания"
677
+
678
+ #: ml-slider.php:1341
679
+ #@ metaslider
680
+ msgid "Developer options"
681
+ msgstr "Опции для разработчиков"
682
+
683
+ #: ml-slider.php:1346
684
+ #@ metaslider
685
+ msgid "CSS classes"
686
+ msgstr "CSS классы"
687
+
688
+ #: ml-slider.php:1348
689
+ #@ metaslider
690
+ msgid "Specify any custom CSS Classes you would like to be added to the slider wrapper"
691
+ msgstr "Укажите любые пользовательские CSS классы, которые вы хотите добавить к контейнеру слайдера"
692
+
693
+ #: ml-slider.php:1354
694
+ #@ metaslider
695
+ msgid "Print CSS"
696
+ msgstr "Выводить CSS"
697
+
698
+ #: ml-slider.php:1357
699
+ #@ metaslider
700
+ msgid "Uncheck this is you would like to include your own CSS"
701
+ msgstr "Снимите галочку, если Вы хотите использовать свой собственный CSS"
702
+
703
+ #: ml-slider.php:1362
704
+ #@ metaslider
705
+ msgid "Print JS"
706
+ msgstr "Выводить JS"
707
+
708
+ #: ml-slider.php:1365
709
+ #@ metaslider
710
+ msgid "Uncheck this is you would like to include your own Javascript"
711
+ msgstr "Снимите галочку, если Вы хотите использовать свой собственный Javascript"
712
+
713
+ #: ml-slider.php:1370
714
+ #@ metaslider
715
+ msgid "No conflict mode"
716
+ msgstr "Бесконфликтный режим"
717
+
718
+ #: ml-slider.php:1373
719
+ #@ metaslider
720
+ msgid "Delay adding the flexslider class to the slideshow"
721
+ msgstr "Задержка при добавлении класса flexslider в слайдшоу"
722
+
723
+ #: ml-slider.php:1387
724
+ #@ metaslider
725
+ msgid "Usage"
726
+ msgstr "Использование"
727
+
728
+ #: ml-slider.php:1390
729
+ #@ metaslider
730
+ msgid "Shortcode"
731
+ msgstr "Шорткод"
732
+
733
+ #: ml-slider.php:1391
734
+ #@ metaslider
735
+ msgid "Template Include"
736
+ msgstr "Вставка в шаблон"
737
+
738
+ #: ml-slider.php:1395
739
+ #@ metaslider
740
+ msgid "Copy & paste the shortcode directly into any WordPress post or page."
741
+ msgstr "Скопируйте шорткод и вставьте его в любую страницу или запись Вашего сайта"
742
+
743
+ #: ml-slider.php:1398
744
+ #@ metaslider
745
+ msgid "Copy & paste this code into a template file to include the slideshow within your theme."
746
+ msgstr "Скопируйте этот код и вставьте его в файл шаблона , чтобы добавить слайд-шоу в Вашу тему"
747
+
748
+ #: ml-slider.php:1427
749
+ #@ metaslider
750
+ msgid "Delete Slider"
751
+ msgstr "Удалить слайдер"
752
+
753
+ #: ml-slider.php:1448
754
+ #@ metaslider
755
+ msgid "Select slideshow to insert into post"
756
+ msgstr "Выберите слайд-шоу для вставки в запись"
757
+
758
+ #: ml-slider.php:1451
759
+ #@ metaslider
760
+ msgid "Add slider"
761
+ msgstr "Добавить слайдер"
762
+
763
+ #: ml-slider.php:1485
764
+ #@ metaslider
765
+ msgid "Insert Meta Slider"
766
+ msgstr "Вставить Мета Слайдер"
767
+
768
+ #: ml-slider.php:1487
769
+ #@ metaslider
770
+ msgid "Choose slideshow"
771
+ msgstr "Выберите слайдшоу"
772
+
773
+ #: ml-slider.php:1511
774
+ #@ metaslider
775
+ msgid "Go Pro"
776
+ msgstr "Получить Pro"
777
+
778
+ #: ml-slider.php:1567
779
+ #@ metaslider
780
+ msgid "Upgrade to Pro $19"
781
+ msgstr "Обновитесь до Pro за $19"
782
+
ml-slider.php CHANGED
@@ -1,47 +1,25 @@
1
  <?php
2
  /*
 
 
3
  * Plugin Name: Meta Slider
4
- * Plugin URI: http://www.metaslider.com
5
  * Description: Easy to use slideshow plugin. Create SEO optimised responsive slideshows with Nivo Slider, Flex Slider, Coin Slider and Responsive Slides.
6
- * Version: 2.7.2
7
- * Author: Matcha Labs
8
- * Author URI: http://www.matchalabs.com
9
- * License: GPLv2 or later
 
10
  *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
  */
16
 
17
- // disable direct access
18
- if (!defined('ABSPATH')) exit;
19
-
20
- define('METASLIDER_VERSION', '2.7.2');
21
- define('METASLIDER_BASE_URL', plugins_url('ml-slider') . '/'); //plugin_dir_url(__FILE__)
22
- define('METASLIDER_ASSETS_URL', METASLIDER_BASE_URL . 'assets/');
23
- define('METASLIDER_BASE_DIR_LONG', dirname(__FILE__));
24
- define('METASLIDER_INC_DIR', METASLIDER_BASE_DIR_LONG . '/inc/');
25
-
26
- // include slider classes
27
- require_once( METASLIDER_INC_DIR . 'slider/metaslider.class.php' );
28
- require_once( METASLIDER_INC_DIR . 'slider/metaslider.coin.class.php' );
29
- require_once( METASLIDER_INC_DIR . 'slider/metaslider.flex.class.php' );
30
- require_once( METASLIDER_INC_DIR . 'slider/metaslider.nivo.class.php' );
31
- require_once( METASLIDER_INC_DIR . 'slider/metaslider.responsive.class.php' );
32
-
33
- // include slide classes
34
- require_once( METASLIDER_INC_DIR . 'slide/metaslide.class.php' );
35
- require_once( METASLIDER_INC_DIR . 'slide/metaslide.image.class.php' );
36
-
37
- // include image helper
38
- require_once( METASLIDER_INC_DIR . 'metaslider.imagehelper.class.php' );
39
-
40
- // include widget
41
- require_once( METASLIDER_INC_DIR . 'metaslider.widget.class.php' );
42
 
43
- // include system check
44
- require_once( METASLIDER_INC_DIR . 'metaslider.systemcheck.class.php' );
45
 
46
  /**
47
  * Register the plugin.
@@ -50,432 +28,617 @@ require_once( METASLIDER_INC_DIR . 'metaslider.systemcheck.class.php' );
50
  */
51
  class MetaSliderPlugin {
52
 
53
- /** Current Slider **/
54
- var $slider = null;
 
 
 
 
 
 
 
 
 
55
 
56
  /**
57
  * Init
58
  */
59
  public static function init() {
60
- $metaslider = new MetaSliderPlugin;
 
 
61
  }
62
 
 
63
  /**
64
  * Constructor
65
  */
66
  public function __construct() {
67
- // create the admin menu/page
68
- add_action('admin_menu', array($this, 'register_admin_menu'), 9553);
69
 
70
- // register slider post type and taxonomy
71
- add_action('init', array($this, 'register_post_type'));
72
- add_action('init', array($this, 'register_taxonomy'));
73
- add_action('init', array($this, 'load_plugin_textdomain'));
 
 
74
 
75
- // register shortcodes
76
- add_shortcode('metaslider', array($this, 'register_shortcode'));
77
- add_shortcode('ml-slider', array($this, 'register_shortcode')); // backwards compatibility
78
 
79
- add_filter('media_upload_tabs', array($this,'custom_media_upload_tab_name'), 998);
80
- add_filter('media_view_strings', array($this, 'custom_media_uploader_tabs'), 5);
81
- add_action('media_upload_vimeo', array($this, 'metaslider_pro_tab'));
82
- add_action('media_upload_youtube', array($this, 'metaslider_pro_tab'));
83
- add_action('media_upload_post_feed', array($this, 'metaslider_pro_tab'));
84
- add_action('media_upload_layer', array($this, 'metaslider_pro_tab'));
85
 
86
- add_filter('media_buttons_context', array($this, 'insert_metaslider_button'));
87
- add_action('admin_footer', array($this, 'admin_footer'), 11);
 
 
88
 
89
- // add 'go pro' link to plugin options
90
- $plugin = plugin_basename(__FILE__);
91
- add_filter("plugin_action_links_{$plugin}", array($this,'upgrade_to_pro'));
 
92
 
93
- $this->register_slide_types();
94
  }
95
 
 
96
  /**
97
- * Check our WordPress installation is compatible with Meta Slider
98
  */
99
- public function system_check(){
100
- $systemCheck = new MetaSliderSystemCheck();
101
- $systemCheck->check();
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  }
103
 
 
104
  /**
105
- * Add settings link on plugin page
106
  */
107
- public function upgrade_to_pro($links) {
108
- if (function_exists('is_plugin_active') && !is_plugin_active('ml-slider-pro/ml-slider-pro.php')) {
109
- $links[] = '<a href="http://www.metaslider.com/upgrade" target="_blank">' . __("Go Pro", "metaslider") . '</a>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  }
111
- return $links;
112
  }
113
 
 
114
  /**
115
- * Return the meta slider pro upgrade iFrame
116
  */
117
- public function metaslider_pro_tab() {
118
- if (function_exists('is_plugin_active') && !is_plugin_active('ml-slider-pro/ml-slider-pro.php')) {
119
- return wp_iframe(array($this, 'iframe'));
 
 
 
 
 
120
  }
 
121
  }
122
 
 
123
  /**
124
- * Media Manager iframe HTML
125
  */
126
- public function iframe() {
127
- wp_enqueue_style('metaslider-admin-styles', METASLIDER_ASSETS_URL . 'metaslider/admin.css', false, METASLIDER_VERSION);
128
- wp_enqueue_script('google-font-api', 'http://fonts.googleapis.com/css?family=PT+Sans:400,700');
129
 
130
- $link = apply_filters('metaslider_hoplink', 'http://www.metaslider.com/upgrade/');
131
- $link .= '?utm_source=lite&amp;utm_medium=more-slide-types&amp;utm_campaign=pro';
132
 
133
- echo "<div class='metaslider'>";
134
- echo "<p style='text-align: center; font-size: 1.2em; margin-top: 50px;'>Get the Pro Addon pack to add support for: <b>Post Feed</b> Slides, <b>YouTube</b> Slides, <b>HTML</b> Slides & <b>Vimeo</b> Slides</p>";
135
- echo "<p style='text-align: center; font-size: 1.2em;'><b>NEW: </b> Animated HTML <b>Layer</b> Slides (with an awesome Drag & Drop editor!)</p>";
136
- echo "<p style='text-align: center; font-size: 1.2em;'><b></b> Live Theme Editor!</p>";
137
- echo "<p style='text-align: center; font-size: 1.2em;'><b>NEW:</b> Thumbnail Navigation for Flex & Nivo Slider!</p>";
138
- echo "<a class='probutton' href='{$link}' target='_blank'>Get <span class='logo'><strong>Meta</strong>Slider</span><span class='super'>Pro</span></a>";
139
- echo "<span class='subtext'>Opens in a new window</span>";
140
- echo "</div>";
141
  }
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  /**
144
  * Register our slide types
145
  */
146
  private function register_slide_types() {
 
147
  $image = new MetaImageSlide();
 
148
  }
149
 
 
150
  /**
151
- * Initialise translations
152
  */
153
- public function load_plugin_textdomain() {
154
- load_plugin_textdomain('metaslider', false, dirname(plugin_basename(__FILE__)) . '/languages/');
 
 
 
 
 
 
 
 
 
 
 
155
  }
156
 
 
157
  /**
158
- * Update the tab options in the media manager
 
 
159
  */
160
- public function custom_media_uploader_tabs( $strings ) {
161
- //update strings
162
- if ((isset($_GET['page']) && $_GET['page'] == 'metaslider')) {
163
- $strings['insertMediaTitle'] = __("Image", "metaslider");
164
- $strings['insertIntoPost'] = __("Add to slider", "metaslider");
165
- // remove options
166
- if (isset($strings['createGalleryTitle'])) unset($strings['createGalleryTitle']);
167
- if (isset($strings['insertFromUrlTitle'])) unset($strings['insertFromUrlTitle']);
168
  }
169
- return $strings;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  }
171
 
 
172
  /**
173
- * Add extra tabs to the default wordpress Media Manager iframe
174
- *
175
- * @var array existing media manager tabs
176
  */
177
- public function custom_media_upload_tab_name($tabs) {
178
- $metaslider_tabs = array('post_feed', 'layer', 'youtube', 'vimeo');
179
 
180
- // restrict our tab changes to the meta slider plugin page
181
- if ((isset($_GET['page']) && $_GET['page'] == 'metaslider') || (isset($_GET['tab']) && in_array($_GET['tab'], $metaslider_tabs))) {
182
- $newtabs = array();
183
 
184
- if (function_exists('is_plugin_active') && !is_plugin_active('ml-slider-pro/ml-slider-pro.php')) {
185
- $newtabs = array(
186
- 'post_feed' => __("Post Feed", "metaslider"),
187
- 'vimeo' => __("Vimeo", "metaslider"),
188
- 'youtube' => __("YouTube", "metaslider"),
189
- 'layer' => __("Layer Slide", "metaslider")
190
- );
191
- }
192
 
193
- if (isset($tabs['nextgen'])) unset($tabs['nextgen']);
194
 
195
- return array_merge($tabs, $newtabs);
196
- }
 
 
 
 
 
 
 
 
 
 
 
 
197
 
198
- return $tabs;
199
  }
200
 
 
201
  /**
202
  * Rehister admin styles
203
  */
204
  public function register_admin_styles() {
205
- wp_enqueue_style('metaslider-admin-styles', METASLIDER_ASSETS_URL . 'metaslider/admin.css', false, METASLIDER_VERSION);
206
- wp_enqueue_style('metaslider-colorbox-styles', METASLIDER_ASSETS_URL . 'colorbox/colorbox.css', false, METASLIDER_VERSION);
207
- wp_enqueue_style('metaslider-tipsy-styles', METASLIDER_ASSETS_URL . 'tipsy/tipsy.css', false, METASLIDER_VERSION);
208
 
209
- do_action('metaslider_register_admin_styles');
 
 
 
 
 
210
  }
211
 
 
212
  /**
213
  * Register admin JavaScript
214
  */
215
  public function register_admin_scripts() {
 
216
  // media library dependencies
217
  wp_enqueue_media();
218
 
219
  // plugin dependencies
220
- wp_enqueue_script('jquery-ui-core', array('jquery'));
221
- wp_enqueue_script('jquery-ui-sortable', array('jquery', 'jquery-ui-core'));
222
- wp_enqueue_script('metaslider-colorbox', METASLIDER_ASSETS_URL . 'colorbox/jquery.colorbox-min.js', array('jquery'), METASLIDER_VERSION);
223
- wp_enqueue_script('metaslider-tipsy', METASLIDER_ASSETS_URL . 'tipsy/jquery.tipsy.js', array('jquery'), METASLIDER_VERSION);
224
- wp_enqueue_script('metaslider-admin-script', METASLIDER_ASSETS_URL . 'metaslider/admin.js', array('jquery', 'metaslider-tipsy', 'media-upload'), METASLIDER_VERSION);
225
- wp_enqueue_script('metaslider-admin-addslide', METASLIDER_ASSETS_URL . 'metaslider/image/image.js', array('metaslider-admin-script'), METASLIDER_VERSION);
226
-
227
- wp_dequeue_script('link'); // WP Posts Filter Fix (Advanced Settings not toggling)
228
-
229
- // localise the JS
230
- wp_localize_script( 'metaslider-admin-addslide', 'metaslider_image', array(
231
- 'addslide_nonce' => wp_create_nonce('metaslider_addslide')
232
- ));
233
 
234
- // localise the JS
235
- wp_localize_script( 'metaslider-admin-script', 'metaslider', array(
236
- 'url' => __("URL", "metaslider"),
237
- 'caption' => __("Caption", "metaslider"),
238
- 'new_window' => __("New Window", "metaslider"),
239
- 'confirm' => __("Are you sure?", "metaslider"),
240
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
241
- 'resize_nonce' => wp_create_nonce('metaslider_resize'),
242
- 'iframeurl' => METASLIDER_BASE_URL . 'preview.php',
243
- 'useWithCaution' => __("Caution: This setting is for advanced developers only. If you're unsure, leave it checked.", "metaslider")
244
- ));
245
 
246
- do_action('metaslider_register_admin_scripts');
247
  }
248
 
 
249
  /**
250
- * Add the menu page
251
  */
252
- public function register_admin_menu() {
253
- $title = apply_filters('metaslider_menu_title', "Meta Slider");
254
 
255
- $page = add_menu_page($title, $title, 'edit_others_posts', 'metaslider', array(
256
- $this, 'render_admin_page'
257
- ), METASLIDER_ASSETS_URL . 'metaslider/matchalabs.png', 9501);
 
 
 
 
 
 
 
 
 
258
 
259
- // ensure our JavaScript is only loaded on the Meta Slider admin page
260
- add_action('admin_print_scripts-' . $page, array($this, 'register_admin_scripts'));
261
- add_action('admin_print_styles-' . $page, array($this, 'register_admin_styles'));
262
- add_action('load-' . $page, array($this, 'help_tab'));
263
  }
264
 
 
265
  /**
266
- * Upgrade CTA.
267
  */
268
- public function go_pro_cta() {
269
- if (function_exists('is_plugin_active') && !is_plugin_active('ml-slider-pro/ml-slider-pro.php')) {
270
- $link = apply_filters('metaslider_hoplink', 'http://www.metaslider.com/upgrade/');
271
 
272
- $link .= '?utm_source=lite&amp;utm_medium=nag&amp;utm_campaign=pro';
273
 
274
- $goPro = "<div style='display: none;' id='screen-options-link-wrap'><a target='_blank' class='show-settings' href='{$link}'>Meta Slider v" . METASLIDER_VERSION . " - " .
275
- __('Upgrade to Pro $19', "metaslider") .
276
- "</a></div>";
277
 
278
- echo $goPro;
 
 
 
 
 
 
279
  }
280
- }
281
 
282
- /**
283
- *
284
- */
285
- public function help_tab() {
286
- $screen = get_current_screen();
287
 
288
- // documentation tab
289
- $screen->add_help_tab( array(
290
- 'id' => 'documentation',
291
- 'title' => __('Documentation'),
292
- 'content' => "<p><a href='http://www.metaslider.com/documentation/' target='blank'>Meta Slider Documentation</a></p>",
293
- ) );
294
  }
295
 
 
296
  /**
297
- * Register ML Slider post type
298
  */
299
- public function register_post_type() {
300
- register_post_type('ml-slider', array(
301
- 'query_var' => false,
302
- 'rewrite' => false,
303
- 'public' => true,
304
- 'show_ui' => false,
305
- 'labels' => array(
306
- 'name' => 'Meta Slider'
307
- )
308
- ));
309
  }
310
 
 
311
  /**
312
- * Register taxonomy to store slider => slides relationship
313
  */
314
- public function register_taxonomy() {
315
- register_taxonomy( 'ml-slider', 'attachment', array(
316
- 'hierarchical' => true,
317
- 'public' => false,
318
- 'query_var' => false,
319
- 'rewrite' => false
320
- ));
 
 
 
 
 
 
321
  }
322
 
 
323
  /**
324
- * Shortcode used to display slideshow
325
  *
326
- * @return string HTML output of the shortcode
327
  */
328
- public function register_shortcode($atts) {
329
- if (!isset($atts['id'])) {
330
- return false;
331
- }
332
 
333
- // we have an ID to work with
334
- $slider = get_post($atts['id']);
335
 
336
- // check the slider is published and the ID is correct
337
- if (!$slider || $slider->post_status != 'publish' || $slider->post_type != 'ml-slider') {
338
- return "<!-- meta slider {$atts['id']} not found -->";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  }
340
 
341
- // lets go
342
- $this->set_slider($atts['id'], $atts);
343
- $this->slider->enqueue_scripts();
344
 
345
- return $this->slider->render_public_slides();
346
  }
347
 
 
348
  /**
349
  * Set the current slider
350
  */
351
- public function set_slider($id, $shortcode_settings = array()) {
 
352
  $type = 'flex';
353
 
354
- if (isset($shortcode_settings['type'])) {
355
  $type = $shortcode_settings['type'];
356
- }
357
- else if ($settings = get_post_meta($id, 'ml-slider_settings', true)) {
358
- if (is_array($settings) && isset($settings['type'])) {
359
  $type = $settings['type'];
360
  }
361
  }
362
 
363
- if (!in_array($type, array('flex', 'coin', 'nivo', 'responsive'))) {
364
  $type = 'flex';
365
  }
366
 
367
- $this->slider = $this->create_slider($type, $id, $shortcode_settings);
 
368
  }
369
 
 
370
  /**
371
  * Create a new slider based on the sliders type setting
372
  */
373
- private function create_slider($type, $id, $shortcode_settings) {
374
- switch ($type) {
375
- case('coin'):
376
- return new MetaCoinSlider($id, $shortcode_settings);
377
- case('flex'):
378
- return new MetaFlexSlider($id, $shortcode_settings);
379
- case('nivo'):
380
- return new MetaNivoSlider($id, $shortcode_settings);
381
- case('responsive'):
382
- return new MetaResponsiveSlider($id, $shortcode_settings);
 
383
  default:
384
- return new MetaFlexSlider($id, $shortcode_settings);
 
385
  }
386
  }
387
 
 
388
  /**
389
  * Handle slide uploads/changes.
390
  */
391
  public function admin_process() {
392
- // this function should only ever be called from the Meta Slider admin page.
393
- if (!is_admin()) {
394
- return;
395
- }
 
396
 
397
  // default to the latest slider
398
- $slider_id = $this->find_slider('modified', 'DESC');
399
 
400
  // delete a slider
401
- if (isset($_GET['delete'])) {
402
- $slider_id = $this->delete_slider(intval($_GET['delete']));
403
  }
404
 
405
  // load a slider by ID
406
- if (isset($_REQUEST['id'])) {
407
- $temp_id = intval($_REQUEST['id']);
408
 
409
- // check valid post ID
410
- if (get_post($temp_id)) {
411
- $slider_id = $temp_id;
412
- }
413
  }
414
 
415
  // create a new slider
416
- if (isset($_GET['add'])) {
417
  $slider_id = $this->add_slider();
418
  }
419
 
420
- if ($slider_id > 0) {
421
- $this->set_slider($slider_id);
 
422
  }
 
423
  }
424
 
 
425
  /**
426
  * Create a new slider
427
  */
428
  private function add_slider() {
 
429
  // check nonce
430
- check_admin_referer("metaslider_add_slider");
431
 
432
  $defaults = array();
433
 
434
  // if possible, take a copy of the last edited slider settings in place of default settings
435
- if ($last_modified = $this->find_slider('modified', 'DESC')) {
436
- $defaults = get_post_meta($last_modified, 'ml-slider_settings', true);
437
  }
438
 
439
  // insert the post
440
- $id = wp_insert_post(array(
441
- 'post_title' => __("New Slider", "metaslider"),
442
- 'post_status' => 'publish',
443
- 'post_type' => 'ml-slider'
444
- ));
 
445
 
446
  // use the default settings if we can't find anything more suitable.
447
- if (empty($defaults)) {
448
- $slider = new MetaSlider($id, array());
449
  $defaults = $slider->get_default_parameters();
450
  }
451
 
452
  // insert the post meta
453
- add_post_meta($id, 'ml-slider_settings', $defaults, true);
454
 
455
  // create the taxonomy term, the term is the ID of the slider itself
456
- wp_insert_term($id, 'ml-slider');
457
 
458
  return $id;
 
459
  }
460
 
 
461
  /**
462
  * Delete a slider (send it to trash)
463
  *
464
  * @param int $id
465
  */
466
- private function delete_slider($id) {
 
467
  // check nonce
468
- check_admin_referer("metaslider_delete_slider");
469
 
470
  // send the post to trash
471
- wp_update_post(array(
472
- 'ID' => $id,
473
- 'post_status' => 'trash'
474
- ));
 
 
 
475
 
476
- return $this->find_slider('date', 'DESC');
477
  }
478
 
 
479
  /**
480
  * Find a single slider ID. For example, last edited, or first published.
481
  *
@@ -483,7 +646,8 @@ class MetaSliderPlugin {
483
  * @param string $order direction (ASC or DESC).
484
  * @return int slider ID.
485
  */
486
- private function find_slider($orderby, $order) {
 
487
  $args = array(
488
  'force_no_custom_order' => true,
489
  'post_type' => 'ml-slider',
@@ -494,9 +658,9 @@ class MetaSliderPlugin {
494
  'order' => $order
495
  );
496
 
497
- $the_query = new WP_Query($args);
498
 
499
- while ($the_query->have_posts()) {
500
  $the_query->the_post();
501
  return $the_query->post->ID;
502
  }
@@ -504,6 +668,7 @@ class MetaSliderPlugin {
504
  wp_reset_query();
505
 
506
  return false;
 
507
  }
508
 
509
 
@@ -514,7 +679,8 @@ class MetaSliderPlugin {
514
  * @param string $sort_key
515
  * @return array all published sliders
516
  */
517
- private function all_meta_sliders($sort_key = 'date') {
 
518
  $sliders = false;
519
 
520
  // list the tabs
@@ -527,13 +693,13 @@ class MetaSliderPlugin {
527
  'posts_per_page' => -1
528
  );
529
 
530
- $args = apply_filters('metaslider_all_meta_sliders_args', $args);
531
 
532
- $the_query = new WP_Query($args);
533
 
534
- while ($the_query->have_posts()) {
535
  $the_query->the_post();
536
- $active = $this->slider && ($this->slider->id == $the_query->post->ID) ? true : false;
537
 
538
  $sliders[] = array(
539
  'active' => $active,
@@ -545,8 +711,10 @@ class MetaSliderPlugin {
545
  wp_reset_query();
546
 
547
  return $sliders;
 
548
  }
549
 
 
550
  /**
551
  * Compare array values
552
  *
@@ -554,151 +722,164 @@ class MetaSliderPlugin {
554
  * @param array $elem2
555
  * @return bool
556
  */
557
- private function compare_elems($elem1, $elem2) {
558
- return $elem1['priority'] > $elem2['priority'];
559
- }
560
-
561
- /**
562
- *
563
- * @param array $aFields - array of field to render
564
- * @return string
565
- */
566
- public function build_settings_rows($aFields) {
567
- // order the fields by priority
568
- uasort($aFields, array($this, "compare_elems"));
569
-
570
- $return = "";
571
-
572
- // loop through the array and build the settings HTML
573
- foreach ($aFields as $id => $row) {
574
- // checkbox input type
575
- if ($row['type'] == 'checkbox') {
576
- $return .= "<tr><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><input class='option {$row['class']} {$id}' type='checkbox' name='settings[{$id}]' {$row['checked']} />";
577
-
578
- if (isset($row['after'])) {
579
- $return .= "<span class='after'>{$row['after']}</span>";
580
- }
581
-
582
- $return .= "</td></tr>";
583
- }
584
-
585
- // navigation row
586
- if ($row['type'] == 'navigation') {
587
- $navigation_row = "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><ul>";
588
-
589
- foreach ($row['options'] as $k => $v) {
590
- $checked = checked($k, $row['value'], false);
591
- $disabled = $k == 'thumbnails' ? 'disabled' : '';
592
- $navigation_row .= "<li><label><input type='radio' name='settings[{$id}]' value='{$k}' {$checked} {$disabled}/>{$v['label']}</label></li>";
593
- }
594
-
595
- $navigation_row .= "</ul></td></tr>";
596
-
597
- $return .= apply_filters('metaslider_navigation_options', $navigation_row, $this->slider);
598
- }
599
-
600
- // navigation row
601
- if ($row['type'] == 'radio') {
602
- $navigation_row = "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><ul>";
603
-
604
- foreach ($row['options'] as $k => $v) {
605
- $checked = checked($k, $row['value'], false);
606
- $class = isset($v['class']) ? $v['class'] : "";
607
- $navigation_row .= "<li><label><input type='radio' name='settings[{$id}]' value='{$k}' {$checked} class='radio {$class}'/>{$v['label']}</label></li>";
608
- }
609
-
610
- $navigation_row .= "</ul></td></tr>";
611
-
612
- $return .= apply_filters('metaslider_navigation_options', $navigation_row, $this->slider);
613
- }
614
-
615
- // header/divider row
616
- if ($row['type'] == 'divider') {
617
- $return .= "<tr class='{$row['type']}'><td colspan='2' class='divider'><b>{$row['value']}</b></td></tr>";
618
- }
619
-
620
- // slideshow select row
621
- if ($row['type'] == 'slider-lib') {
622
- $return .= "<tr class='{$row['type']}'><td colspan='2' class='slider-lib-row'>";
623
-
624
- foreach ($row['options'] as $k => $v) {
625
- $checked = checked($k, $row['value'], false);
626
- $return .= "<input class='select-slider' id='{$k}' rel='{$k}' type='radio' name='settings[type]' value='{$k}' {$checked} />
627
- <label for='{$k}'>{$v['label']}</label>";
628
- }
629
-
630
- $return .= "</td></tr>";
631
- }
632
-
633
- // number input type
634
- if ($row['type'] == 'number') {
635
- $return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><input class='option {$row['class']} {$id}' type='number' min='{$row['min']}' max='{$row['max']}' step='{$row['step']}' name='settings[{$id}]' value='{$row['value']}' /><span class='after'>{$row['after']}</span></td></tr>";
636
- }
637
-
638
- // select drop down
639
- if ($row['type'] == 'select') {
640
- $return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><select class='option {$row['class']} {$id}' name='settings[{$id}]'>";
641
- foreach ($row['options'] as $k => $v) {
642
- $selected = selected($k, $row['value'], false);
643
- $return .= "<option class='{$v['class']}' value='{$k}' {$selected}>{$v['label']}</option>";
644
- }
645
- $return .= "</select></td></tr>";
646
- }
647
-
648
- // theme drop down
649
- if ($row['type'] == 'theme') {
650
- $return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><select class='option {$row['class']} {$id}' name='settings[{$id}]'>";
651
- $themes = "";
652
-
653
- foreach ($row['options'] as $k => $v) {
654
- $selected = selected($k, $row['value'], false);
655
- $themes .= "<option class='{$v['class']}' value='{$k}' {$selected}>{$v['label']}</option>";
656
- }
657
-
658
- $return .= apply_filters('metaslider_get_available_themes', $themes, $this->slider->get_setting('theme'));
659
-
660
- $return .= "</select></td></tr>";
661
- }
662
-
663
- // text input type
664
- if ($row['type'] == 'text') {
665
- $return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><input class='option {$row['class']} {$id}' type='text' name='settings[{$id}]' value='{$row['value']}' /></td></tr>";
666
- }
667
-
668
- // text input type
669
- if ($row['type'] == 'title') {
670
- $return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><input class='option {$row['class']} {$id}' type='text' name='{$id}' value='{$row['value']}' /></td></tr>";
671
- }
672
- }
673
-
674
- return $return;
675
  }
676
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
677
  /**
678
  * Return an indexed array of all easing options
679
  *
680
  * @return array
681
  */
682
  private function get_easing_options() {
 
683
  $options = array(
684
- 'linear','swing','jswing','easeInQuad','easeOutQuad','easeInOutQuad',
685
- 'easeInCubic','easeOutCubic','easeInOutCubic','easeInQuart',
686
- 'easeOutQuart','easeInOutQuart','easeInQuint','easeOutQuint',
687
- 'easeInOutQuint','easeInSine','easeOutSine','easeInOutSine',
688
- 'easeInExpo','easeOutExpo','easeInOutExpo','easeInCirc','easeOutCirc',
689
- 'easeInOutCirc','easeInElastic','easeOutElastic','easeInOutElastic',
690
- 'easeInBack','easeOutBack','easeInOutBack','easeInBounce','easeOutBounce',
691
  'easeInOutBounce'
692
  );
693
 
694
- foreach ($options as $option) {
695
  $return[$option] = array(
696
- 'label' => ucfirst(preg_replace('/(\w+)([A-Z])/U', '\\1 \\2', $option)),
697
- 'class' => ''
698
  );
699
  }
700
 
701
  return $return;
 
702
  }
703
 
704
 
@@ -706,53 +887,56 @@ class MetaSliderPlugin {
706
  * Render the admin page (tabs, slides, settings)
707
  */
708
  public function render_admin_page() {
 
709
  $this->admin_process();
710
- $this->go_pro_cta();
711
- $this->system_check();
712
- $max_tabs = apply_filters('metaslider_max_tabs', 0);
 
 
713
  ?>
714
 
715
  <script type='text/javascript'>
716
- var metaslider_slider_id = <?php echo $this->slider->id; ?>;
717
- var metaslider_pro_active = <?php echo function_exists('is_plugin_active') && is_plugin_active('ml-slider-pro/ml-slider-pro.php') ? 'true' : 'false' ?>;
718
  </script>
719
 
720
  <div class="wrap metaslider">
721
- <form accept-charset="UTF-8" action="?page=metaslider&amp;id=<?php echo $this->slider->id ?>" method="post">
722
  <?php
723
- if ($this->slider) {
724
- wp_nonce_field('metaslider_save_' . $this->slider->id);
725
  }
726
 
727
  $title = "";
728
- $add_url = wp_nonce_url("?page=metaslider&amp;add=true", "metaslider_add_slider");
729
 
730
- if ($tabs = $this->all_meta_sliders()) {
731
- if ($max_tabs && count($tabs) > $max_tabs) {
732
- if (isset($_GET['add']) && $_GET['add'] == 'true') {
733
- echo "<div id='message' class='updated'><p>" . __("New slideshow created. Click 'Add Slide' to get started!", "metaslider") . "</p></div>";
734
  }
735
  echo "<div style='margin-top: 20px;'><label for='select-slider'>Select Slider: </label>";
736
  echo "<select name='select-slider' onchange='if (this.value) window.location.href=this.value'>";
737
 
738
- $tabs = $this->all_meta_sliders('title');
739
 
740
- foreach ($tabs as $tab) {
741
  $selected = $tab['active'] ? " selected" : "";
742
 
743
- if ($tab['active']) {
744
  $title = $tab['title'];
745
  }
746
 
747
  echo "<option value='?page=metaslider&amp;id={$tab['id']}'{$selected}>{$tab['title']}</option>";
748
 
749
  }
750
- echo "</select> " . __('or', "metaslider") . " ";
751
- echo "<a href='{$add_url}'>" . __('Add New Slideshow', "metaslider") . "</a></div>";
752
  } else {
753
  echo "<h3 class='nav-tab-wrapper'>";
754
- foreach ($tabs as $tab) {
755
- if ($tab['active']) {
756
  echo "<div class='nav-tab nav-tab-active'><input type='text' name='title' value='" . $tab['title'] . "' onfocus='this.style.width = ((this.value.length + 1) * 9) + \"px\"' /></div>";
757
  } else {
758
  echo "<a href='?page=metaslider&amp;id={$tab['id']}' class='nav-tab'>" . $tab['title'] . "</a>";
@@ -764,14 +948,13 @@ class MetaSliderPlugin {
764
  } else {
765
  echo "<h3 class='nav-tab-wrapper'>";
766
  echo "<a href='{$add_url}' id='create_new_tab' class='nav-tab'>+</a>";
767
- echo "<div class='bubble'>" . __("Create your first slideshow") . "</div>";
768
  echo "</h3>";
769
  }
770
-
771
  ?>
772
 
773
  <?php
774
- if (!$this->slider) {
775
  return;
776
  }
777
  ?>
@@ -784,11 +967,11 @@ class MetaSliderPlugin {
784
  <thead>
785
  <tr>
786
  <th style="width: 100px;">
787
- <h3><?php _e("Slides", "metaslider") ?></h3>
788
  </th>
789
  <th>
790
- <a href='#' class='button alignright add-slide' data-editor='content' title='<?php _e("Add Slide", "metaslider") ?>'>
791
- <span class='wp-media-buttons-icon'></span> <?php _e("Add Slide", "metaslider") ?>
792
  </a>
793
  </th>
794
  </tr>
@@ -803,460 +986,460 @@ class MetaSliderPlugin {
803
  </div>
804
  </div>
805
 
806
- <div id='postbox-container-1' class='postbox-container'>
807
- <div id="side-sortables" class="meta-box-sortables">
808
- <div class='right'>
809
- <div class="postbox">
810
- <h3 class='configuration'>
811
- <?php _e("Settings", "metaslider") ?>
812
- <input class='alignright button button-primary' type='submit' name='save' id='ms-save' value='<?php _e("Save", "metaslider") ?>' />
813
- <input class='alignright button button-primary' type='submit' name='preview' id='ms-preview' value='<?php _e("Save & Preview", "metaslider") ?>' data-slider_id='<?php echo $this->slider->id ?>' data-slider_width='<?php echo $this->slider->get_setting('width') ?>' data-slider_height='<?php echo $this->slider->get_setting('height') ?>' />
814
- <span class="spinner"></span>
815
- </h3>
816
- <div class="inside">
817
- <table class="widefat settings">
818
- <tbody>
819
- <?php
820
- $aFields = array(
821
- 'type' => array(
822
- 'priority' => 0,
823
- 'type' => 'slider-lib',
824
- 'value' => $this->slider->get_setting('type'),
825
- 'options' => array(
826
- 'flex' => array('label' => __("Flex Slider", "metaslider")),
827
- 'responsive' => array('label' => __("R. Slides", "metaslider")),
828
- 'nivo' => array('label' => __("Nivo Slider", "metaslider")),
829
- 'coin' => array('label' => __("Coin Slider", "metaslider"))
830
- )
831
- ),
832
- 'width' => array(
833
- 'priority' => 10,
834
- 'type' => 'number',
835
- 'size' => 3,
836
- 'min' => 0,
837
- 'max' => 9999,
838
- 'step' => 1,
839
- 'value' => $this->slider->get_setting('width'),
840
- 'label' => __("Width", "metaslider"),
841
- 'class' => 'coin flex responsive nivo',
842
- 'helptext' => __("Slideshow width", "metaslider"),
843
- 'after' => __("px", "metaslider")
844
- ),
845
- 'height' => array(
846
- 'priority' => 20,
847
- 'type' => 'number',
848
- 'size' => 3,
849
- 'min' => 0,
850
- 'max' => 9999,
851
- 'step' => 1,
852
- 'value' => $this->slider->get_setting('height'),
853
- 'label' => __("Height", "metaslider"),
854
- 'class' => 'coin flex responsive nivo',
855
- 'helptext' => __("Slideshow height", "metaslider"),
856
- 'after' => __("px", "metaslider")
857
- ),
858
- 'effect' => array(
859
- 'priority' => 30,
860
- 'type' => 'select',
861
- 'value' => $this->slider->get_setting('effect'),
862
- 'label' => __("Effect", "metaslider"),
863
- 'class' => 'effect coin flex responsive nivo',
864
- 'helptext' => __("Slide transition effect", "metaslider"),
865
- 'options' => array(
866
- 'random' => array('class' => 'option coin nivo' , 'label' => __("Random", "metaslider")),
867
- 'swirl' => array('class' => 'option coin', 'label' => __("Swirl", "metaslider")),
868
- 'rain' => array('class' => 'option coin', 'label' => __("Rain", "metaslider")),
869
- 'straight' => array('class' => 'option coin', 'label' => __("Straight", "metaslider")),
870
- 'sliceDown' => array('class' => 'option nivo', 'label' => __("Slide Down", "metaslider")),
871
- 'sliceUp' => array('class' => 'option nivo', 'label' => __("Slice Up", "metaslider")),
872
- 'sliceUpLeft' => array('class' => 'option nivo', 'label' => __("Slide Up Left", "metaslider")),
873
- 'sliceUpDown' => array('class' => 'option nivo', 'label' => __("Slice Up Down", "metaslider")),
874
- 'slideUpDownLeft' => array('class' => 'option nivo', 'label' => __("Slide Up Down Left", "metaslider")),
875
- 'fold' => array('class' => 'option nivo', 'label' => __("Fold", "metaslider")),
876
- 'fade' => array('class' => 'option nivo flex responsive', 'label' => __("Fade", "metaslider")),
877
- 'slideInRight' => array('class' => 'option nivo', 'label' => __("Slide In Right", "metaslider")),
878
- 'slideInLeft' => array('class' => 'option nivo', 'label' => __("Slide In Left", "metaslider")),
879
- 'boxRandom' => array('class' => 'option nivo', 'label' => __("Box Random", "metaslider")),
880
- 'boxRain' => array('class' => 'option nivo', 'label' => __("Box Rain", "metaslider")),
881
- 'boxRainReverse' => array('class' => 'option nivo', 'label' => __("Box Rain Reverse", "metaslider")),
882
- 'boxRainGrowReverse' => array('class' => 'option nivo', 'label' => __("Box Rain Grow Reverse", "metaslider")),
883
- 'slide' => array('class' => 'option flex', 'label' => __("Slide", "metaslider"))
884
- ),
885
- ),
886
- 'theme' => array(
887
- 'priority' => 40,
888
- 'type' => 'theme',
889
- 'value' => $this->slider->get_setting('theme'),
890
- 'label' => __("Theme", "metaslider"),
891
- 'class' => 'effect coin flex responsive nivo',
892
- 'helptext' => __("Slideshow theme", "metaslider"),
893
- 'options' => array(
894
- 'default' => array('class' => 'option nivo flex coin responsive' , 'label' => __("Default", "metaslider")),
895
- 'dark' => array('class' => 'option nivo', 'label' => __("Dark (Nivo)", "metaslider")),
896
- 'light' => array('class' => 'option nivo', 'label' => __("Light (Nivo)", "metaslider")),
897
- 'bar' => array('class' => 'option nivo', 'label' => __("Bar (Nivo)", "metaslider")),
898
- ),
899
- ),
900
- 'links' => array(
901
- 'priority' => 50,
902
- 'type' => 'checkbox',
903
- 'label' => __("Arrows", "metaslider"),
904
- 'class' => 'option coin flex nivo responsive',
905
- 'checked' => $this->slider->get_setting('links') == 'true' ? 'checked' : '',
906
- 'helptext' => __("Show the previous/next arrows", "metaslider")
907
- ),
908
- 'navigation' => array(
909
- 'priority' => 60,
910
- 'type' => 'navigation',
911
- 'label' => __("Navigation", "metaslider"),
912
- 'class' => 'option coin flex nivo responsive',
913
- 'value' => $this->slider->get_setting('navigation'),
914
- 'helptext' => __("Show the slide navigation bullets", "metaslider"),
915
- 'options' => array(
916
- 'false' => array('label' => __("Hidden", "metaslider")),
917
- 'true' => array('label' => __("Dots", "metaslider")),
918
- 'thumbnails' => array('label' => __("Thumbnails (Pro)", "metaslider"))
919
- )
920
- ),
921
- );
922
-
923
- if ($max_tabs && count($this->all_meta_sliders()) > $max_tabs) {
924
- $aFields['title'] = array(
925
- 'type' => 'title',
926
- 'priority' => 5,
927
- 'class' => 'option flex nivo responsive coin',
928
- 'value' => $title,
929
- 'label' => __("Title", "metaslider"),
930
- 'helptext' => __("Slideshow title", "metaslider")
931
- );
932
- }
933
-
934
- $aFields = apply_filters('metaslider_basic_settings', $aFields, $this->slider);
935
-
936
- echo $this->build_settings_rows($aFields);
937
- ?>
938
- </tbody>
939
- </table>
940
- </div>
941
- </div>
942
-
943
- <div class="postbox ms-toggle closed">
944
- <div class="handlediv" title="Click to toggle"><br></div><h3 class="hndle"><span><?php _e("Advanced Settings", "metaslider") ?></span></h3>
945
- <div class="inside">
946
- <table>
947
- <tbody>
948
- <?php
949
- $aFields = array(
950
- 'fullWidth' => array(
951
- 'priority' => 5,
952
- 'type' => 'checkbox',
953
- 'label' => __("Stretch", "metaslider"),
954
- 'class' => 'option flex nivo responsive',
955
- 'after' => __("100% wide output", "metaslider"),
956
- 'checked' => $this->slider->get_setting('fullWidth') == 'true' ? 'checked' : '',
957
- 'helptext' => __("Stretch the slideshow output to fill it's parent container", "metaslider")
958
- ),
959
- 'center' => array(
960
- 'priority' => 10,
961
- 'type' => 'checkbox',
962
- 'label' => __("Center align", "metaslider"),
963
- 'class' => 'option coin flex nivo responsive',
964
- 'checked' => $this->slider->get_setting('center') == 'true' ? 'checked' : '',
965
- 'helptext' => __("Center align the slideshow", "metaslider")
966
- ),
967
- 'autoPlay' => array(
968
- 'priority' => 20,
969
- 'type' => 'checkbox',
970
- 'label' => __("Auto play", "metaslider"),
971
- 'class' => 'option flex nivo responsive',
972
- 'checked' => $this->slider->get_setting('autoPlay') == 'true' ? 'checked' : '',
973
- 'helptext' => __("Transition between slides automatically", "metaslider")
974
- ),
975
- 'smartCrop' => array(
976
- 'priority' => 30,
977
- 'type' => 'checkbox',
978
- 'label' => __("Smart crop", "metaslider"),
979
- 'class' => 'option coin flex nivo responsive',
980
- 'checked' => $this->slider->get_setting('smartCrop') == 'true' ? 'checked' : '',
981
- 'helptext' => __("Smart Crop ensures your responsive slides are cropped to a ratio that results in a consistent slideshow size", "metaslider")
982
- ),
983
- 'carouselMode' => array(
984
- 'priority' => 40,
985
- 'type' => 'checkbox',
986
- 'label' => __("Carousel mode", "metaslider"),
987
- 'class' => 'option flex showNextWhenChecked',
988
- 'checked' => $this->slider->get_setting('carouselMode') == 'true' ? 'checked' : '',
989
- 'helptext' => __("Display multiple slides at once. Slideshow output will be 100% wide.", "metaslider")
990
- ),
991
  'carouselMargin' => array(
992
  'priority' => 45,
993
  'min' => 0,
994
  'max' => 9999,
995
  'step' => 1,
996
  'type' => 'number',
997
- 'label' => __("Carousel margin", "metaslider"),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
998
  'class' => 'option flex',
999
- 'value' => $this->slider->get_setting('carouselMargin'),
1000
- 'helptext' => __("Pixel margin between slides in carousel.", "metaslider"),
1001
- 'after' => __("px", "metaslider")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1002
  ),
1003
- 'random' => array(
1004
- 'priority' => 50,
1005
- 'type' => 'checkbox',
1006
- 'label' => __("Random", "metaslider"),
1007
- 'class' => 'option coin flex nivo responsive',
1008
- 'checked' => $this->slider->get_setting('random') == 'true' ? 'checked' : '',
1009
- 'helptext' => __("Randomise the order of the slides", "metaslider")
1010
- ),
1011
- 'hoverPause' => array(
1012
- 'priority' => 60,
1013
- 'type' => 'checkbox',
1014
- 'label' => __("Hover pause", "metaslider"),
1015
- 'class' => 'option coin flex nivo responsive',
1016
- 'checked' => $this->slider->get_setting('hoverPause') == 'true' ? 'checked' : '',
1017
- 'helptext' => __("Pause the slideshow when hovering over slider, then resume when no longer hovering.", "metaslider")
1018
- ),
1019
- 'reverse' => array(
1020
- 'priority' => 70,
1021
- 'type' => 'checkbox',
1022
- 'label' => __("Reverse", "metaslider"),
1023
- 'class' => 'option flex',
1024
- 'checked' => $this->slider->get_setting('reverse') == 'true' ? 'checked' : '',
1025
- 'helptext' => __("Reverse the animation direction", "metaslider")
1026
- ),
1027
- 'delay' => array(
1028
- 'priority' => 80,
1029
- 'type' => 'number',
1030
- 'size' => 3,
1031
- 'min' => 500,
1032
- 'max' => 10000,
1033
- 'step' => 100,
1034
- 'value' => $this->slider->get_setting('delay'),
1035
- 'label' => __("Slide delay", "metaslider"),
1036
- 'class' => 'option coin flex responsive nivo',
1037
- 'helptext' => __("How long to display each slide, in milliseconds", "metaslider"),
1038
- 'after' => __("ms", "metaslider")
1039
- ),
1040
- 'animationSpeed' => array(
1041
- 'priority' => 90,
1042
- 'type' => 'number',
1043
- 'size' => 3,
1044
- 'min' => 0,
1045
- 'max' => 2000,
1046
- 'step' => 100,
1047
- 'value' => $this->slider->get_setting('animationSpeed'),
1048
- 'label' => __("Animation speed", "metaslider"),
1049
- 'class' => 'option flex responsive nivo',
1050
- 'helptext' => __("Set the speed of animations, in milliseconds", "metaslider"),
1051
- 'after' => __("ms", "metaslider")
1052
- ),
1053
- 'slices' => array(
1054
- 'priority' => 100,
1055
- 'type' => 'number',
1056
- 'size' => 3,
1057
- 'min' => 0,
1058
- 'max' => 20,
1059
- 'step' => 1,
1060
- 'value' => $this->slider->get_setting('slices'),
1061
- 'label' => __("Number of slices", "metaslider"),
1062
- 'class' => 'option nivo',
1063
- 'helptext' => __("Number of slices", "metaslider"),
1064
- 'after' => __("ms", "metaslider")
1065
- ),
1066
- 'spw' => array(
1067
- 'priority' => 110,
1068
- 'type' => 'number',
1069
- 'size' => 3,
1070
- 'min' => 0,
1071
- 'max' => 20,
1072
- 'step' => 1,
1073
- 'value' => $this->slider->get_setting('spw'),
1074
- 'label' => __("Number of squares", "metaslider") . " (" . __("Width", "metaslider") . ")",
1075
- 'class' => 'option nivo',
1076
- 'helptext' => __("Number of squares", "metaslider"),
1077
- 'after' => ''
1078
- ),
1079
- 'sph' => array(
1080
- 'priority' => 120,
1081
- 'type' => 'number',
1082
- 'size' => 3,
1083
- 'min' => 0,
1084
- 'max' => 20,
1085
- 'step' => 1,
1086
- 'value' => $this->slider->get_setting('sph'),
1087
- 'label' => __("Number of squares", "metaslider") . " (" . __("Height", "metaslider") . ")",
1088
- 'class' => 'option nivo',
1089
- 'helptext' => __("Number of squares", "metaslider"),
1090
- 'after' => ''
1091
- ),
1092
- 'direction' => array(
1093
- 'priority' => 130,
1094
- 'type' => 'select',
1095
- 'label' => __("Slide direction", "metaslider"),
1096
- 'class' => 'option flex',
1097
- 'helptext' => __("Select the sliding direction", "metaslider"),
1098
- 'value' => $this->slider->get_setting('direction'),
1099
- 'options' => array(
1100
- 'horizontal' => array('label' => __("Horizontal", "metaslider"), 'class' => ''),
1101
- 'vertical' => array('label' => __("Vertical", "metaslider"), 'class' => ''),
1102
- )
1103
- ),
1104
- 'easing' => array(
1105
- 'priority' => 140,
1106
- 'type' => 'select',
1107
- 'label' => __("Easing", "metaslider"),
1108
- 'class' => 'option flex',
1109
- 'helptext' => __("Animation easing effect", "metaslider"),
1110
- 'value' => $this->slider->get_setting('easing'),
1111
- 'options' => $this->get_easing_options()
1112
- ),
1113
- 'prevText' => array(
1114
- 'priority' => 150,
1115
- 'type' => 'text',
1116
- 'label' => __("Previous text", "metaslider"),
1117
- 'class' => 'option coin flex responsive nivo',
1118
- 'helptext' => __("Set the text for the 'previous' direction item", "metaslider"),
1119
- 'value' => $this->slider->get_setting('prevText') == 'false' ? '' : $this->slider->get_setting('prevText')
1120
- ),
1121
- 'nextText' => array(
1122
- 'priority' => 160,
1123
- 'type' => 'text',
1124
- 'label' => __("Next text", "metaslider"),
1125
- 'class' => 'option coin flex responsive nivo',
1126
- 'helptext' => __("Set the text for the 'next' direction item", "metaslider"),
1127
- 'value' => $this->slider->get_setting('nextText') == 'false' ? '' : $this->slider->get_setting('nextText')
1128
- ),
1129
- 'sDelay' => array(
1130
- 'priority' => 170,
1131
- 'type' => 'number',
1132
- 'size' => 3,
1133
- 'min' => 0,
1134
- 'max' => 500,
1135
- 'step' => 10,
1136
- 'value' => $this->slider->get_setting('sDelay'),
1137
- 'label' => __("Square delay", "metaslider"),
1138
- 'class' => 'option coin',
1139
- 'helptext' => __("Delay between squares in ms", "metaslider"),
1140
- 'after' => __("ms", "metaslider")
1141
- ),
1142
- 'opacity' => array(
1143
- 'priority' => 180,
1144
- 'type' => 'number',
1145
- 'size' => 3,
1146
- 'min' => 0,
1147
- 'max' => 1,
1148
- 'step' => 0.1,
1149
- 'value' => $this->slider->get_setting('opacity'),
1150
- 'label' => __("Opacity", "metaslider"),
1151
- 'class' => 'option coin',
1152
- 'helptext' => __("Opacity of title and navigation", "metaslider"),
1153
- 'after' => ''
1154
- ),
1155
- 'titleSpeed' => array(
1156
- 'priority' => 190,
1157
- 'type' => 'number',
1158
- 'size' => 3,
1159
- 'min' => 0,
1160
- 'max' => 10000,
1161
- 'step' => 100,
1162
- 'value' => $this->slider->get_setting('titleSpeed'),
1163
- 'label' => __("Caption speed", "metaslider"),
1164
- 'class' => 'option coin',
1165
- 'helptext' => __("Set the fade in speed of the caption", "metaslider"),
1166
- 'after' => __("ms", "metaslider")
1167
- ),
1168
- 'developerOptions' => array(
1169
- 'priority' => 195,
1170
- 'type' => 'divider',
1171
- 'class' => 'option coin flex responsive nivo',
1172
- 'value' => __("Developer options", "metaslider")
1173
- ),
1174
- 'cssClass' => array(
1175
- 'priority' => 200,
1176
- 'type' => 'text',
1177
- 'label' => __("CSS classes", "metaslider"),
1178
- 'class' => 'option coin flex responsive nivo',
1179
- 'helptext' => __("Specify any custom CSS Classes you would like to be added to the slider wrapper", "metaslider"),
1180
- 'value' => $this->slider->get_setting('cssClass') == 'false' ? '' : $this->slider->get_setting('cssClass')
1181
- ),
1182
- 'printCss' => array(
1183
- 'priority' => 210,
1184
- 'type' => 'checkbox',
1185
- 'label' => __("Print CSS", "metaslider"),
1186
- 'class' => 'option coin flex responsive nivo useWithCaution',
1187
- 'checked' => $this->slider->get_setting('printCss') == 'true' ? 'checked' : '',
1188
- 'helptext' => __("Uncheck this is you would like to include your own CSS", "metaslider")
1189
- ),
1190
- 'printJs' => array(
1191
- 'priority' => 220,
1192
- 'type' => 'checkbox',
1193
- 'label' => __("Print JS", "metaslider"),
1194
- 'class' => 'option coin flex responsive nivo useWithCaution',
1195
- 'checked' => $this->slider->get_setting('printJs') == 'true' ? 'checked' : '',
1196
- 'helptext' => __("Uncheck this is you would like to include your own Javascript", "metaslider")
1197
- ),
1198
- 'noConflict' => array(
1199
- 'priority' => 230,
1200
- 'type' => 'checkbox',
1201
- 'label' => __("No conflict mode", "metaslider"),
1202
- 'class' => 'option flex',
1203
- 'checked' => $this->slider->get_setting('noConflict') == 'true' ? 'checked' : '',
1204
- 'helptext' => __("Delay adding the flexslider class to the slideshow", "metaslider")
1205
- ),
1206
- );
1207
-
1208
- $aFields = apply_filters('metaslider_advanced_settings', $aFields, $this->slider);
1209
-
1210
- echo $this->build_settings_rows($aFields);
1211
- ?>
1212
- </tbody>
1213
- </table>
1214
- </div>
1215
- </div>
1216
-
1217
- <div class="postbox shortcode ms-toggle">
1218
- <div class="handlediv" title="Click to toggle"><br></div><h3 class="hndle"><span><?php _e("Usage", "metaslider") ?></span></h3>
1219
- <div class="inside">
1220
- <ul class='tabs'>
1221
- <li rel='tab-1' class='selected'><?php _e("Shortcode", "metaslider") ?></li>
1222
- <li rel='tab-2'><?php _e("Template Include", "metaslider") ?></li>
1223
- </ul>
1224
- <div class='tabs-content'>
1225
- <div class='tab tab-1'>
1226
- <p><?php _e("Copy & paste the shortcode directly into any WordPress post or page.", "metaslider"); ?></p>
1227
- <input readonly='readonly' type='text' value='[metaslider id=<?php echo $this->slider->id ?>]' /></div>
1228
- <div class='tab tab-2' style='display: none'>
1229
- <p><?php _e("Copy & paste this code into a template file to include the slideshow within your theme.", "metaslider"); ?></p>
1230
- <textarea readonly='readonly'>&lt;?php &#13;&#10; echo do_shortcode("[metaslider id=<?php echo $this->slider->id ?>]"); &#13;&#10;?></textarea></div>
1231
- </div>
1232
- </div>
1233
- </div>
1234
-
1235
- <div class="postbox social">
1236
- <div class="inside">
1237
- <ul class='info'>
1238
- <li style='width: 33%;'>
1239
- <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.metaslider.com" data-text="Check out Meta Slider, an easy to use slideshow plugin for WordPress" data-hashtags="metaslider, wordpress, slideshow">Tweet</a>
1240
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
1241
- </li>
1242
- <li style='width: 34%;'>
1243
- <div class="g-plusone" data-size="medium" data-href="http://www.metaslider.com"></div>
1244
- <script type="text/javascript">
1245
- (function() {
1246
- var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
1247
- po.src = 'https://apis.google.com/js/plusone.js';
1248
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
1249
- })();
1250
- </script>
1251
- </li>
1252
- <li style='width: 33%;'>
1253
- <iframe style='border:none; overflow:hidden; width:80px; height:21px;' src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.metaslider.com&amp;send=false&amp;layout=button_count&amp;width=90&amp;show_faces=false&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21&amp;appId=156668027835524" scrolling="no" frameborder="0" allowTransparency="true"></iframe>
1254
- </li>
1255
- </ul>
1256
- </div>
1257
- </div>
1258
- <a class='delete-slider alignright button-secondary confirm' href='<?php echo wp_nonce_url("?page=metaslider&amp;delete={$this->slider->id}", "metaslider_delete_slider"); ?>'><?php _e("Delete Slider", "metaslider") ?></a>
1259
- </div>
1260
  </div>
1261
  </div>
1262
  </div>
@@ -1267,67 +1450,199 @@ class MetaSliderPlugin {
1267
  }
1268
 
1269
 
1270
- /**
1271
- * Append the 'Add Slider' button to selected admin pages
1272
- */
1273
- public function insert_metaslider_button($context) {
1274
- global $pagenow;
1275
-
1276
- if (in_array($pagenow, array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ))) {
1277
- $context .= '<a href="#TB_inline?&inlineId=choose-meta-slider" class="thickbox button" title="' .
1278
- __("Select slideshow to insert into post", "metaslider") .
1279
- '"><span class="wp-media-buttons-icon" style="background: url(' . METASLIDER_ASSETS_URL .
1280
- '/metaslider/matchalabs.png); background-repeat: no-repeat; background-position: left bottom;"></span> ' .
1281
- __("Add slider", "metaslider") . '</a>';
1282
- }
1283
-
1284
- return $context;
1285
- }
1286
-
1287
- /**
1288
- * Append the 'Choose Meta Slider' thickbox content to the bottom of selected admin pages
1289
- */
1290
- public function admin_footer() {
1291
- global $pagenow;
1292
-
1293
- // Only run in post/page creation and edit screens
1294
- if (in_array($pagenow, array('post.php', 'page.php', 'post-new.php', 'post-edit.php'))) {
1295
- $sliders = $this->all_meta_sliders('title');
1296
- ?>
1297
-
1298
- <script type="text/javascript">
1299
- jQuery(document).ready(function() {
1300
- jQuery('#insertMetaSlider').on('click', function() {
1301
- var id = jQuery('#metaslider-select option:selected').val();
1302
- window.send_to_editor('[metaslider id=' + id + ']');
1303
- tb_remove();
1304
- })
1305
- });
1306
- </script>
1307
-
1308
- <div id="choose-meta-slider" style="display: none;">
1309
- <div class="wrap">
1310
- <?php
1311
- if (count($sliders)) {
1312
- echo "<h3 style='margin-bottom: 20px;'>" . __("Insert Meta Slider", "metaslider") . "</h3>";
1313
- echo "<select id='metaslider-select'>";
1314
- echo "<option disabled=disabled>" . __("Choose slideshow", "metaslider") . "</option>";
1315
- foreach ($sliders as $slider) {
1316
- echo "<option value='{$slider['id']}'>{$slider['title']}</option>";
1317
- }
1318
- echo "</select>";
1319
- echo "<button class='button primary' id='insertMetaSlider'>Insert Slideshow</button>";
1320
- } else {
1321
- _e("No slideshows found", "metaslider");
1322
- }
1323
- ?>
1324
- </div>
1325
- </div>
1326
- <?php
1327
- }
1328
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1329
  }
1330
 
1331
- add_action('plugins_loaded', array('MetaSliderPlugin', 'init'));
1332
 
1333
- ?>
1
  <?php
2
  /*
3
+ * Meta Slider. Slideshow plugin for WordPress.
4
+ *
5
  * Plugin Name: Meta Slider
6
+ * Plugin URI: http://www.metaslider.com
7
  * Description: Easy to use slideshow plugin. Create SEO optimised responsive slideshows with Nivo Slider, Flex Slider, Coin Slider and Responsive Slides.
8
+ * Version: 2.8.1
9
+ * Author: Matcha Labs
10
+ * Author URI: http://www.matchalabs.com
11
+ * License: GPL-2.0+
12
+ * Copyright: 2014 Matcha Labs LTD
13
  *
14
+ * Text Domain: metaslider
15
+ * Domain Path: /languages/
 
 
16
  */
17
 
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit; // disable direct access
20
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
+ if ( ! class_exists( 'MetaSliderPlugin' ) ) :
 
23
 
24
  /**
25
  * Register the plugin.
28
  */
29
  class MetaSliderPlugin {
30
 
31
+ /**
32
+ * @var string
33
+ */
34
+ public $version = '2.8.1';
35
+
36
+
37
+ /**
38
+ * @var MetaSlider
39
+ */
40
+ public $slider = null;
41
+
42
 
43
  /**
44
  * Init
45
  */
46
  public static function init() {
47
+
48
+ $metaslider = new self();
49
+
50
  }
51
 
52
+
53
  /**
54
  * Constructor
55
  */
56
  public function __construct() {
 
 
57
 
58
+ $this->define_constants();
59
+ $this->includes();
60
+ $this->setup_actions();
61
+ $this->setup_filters();
62
+ $this->setup_shortcode();
63
+ $this->register_slide_types();
64
 
65
+ }
 
 
66
 
 
 
 
 
 
 
67
 
68
+ /**
69
+ * Define Meta Slider constants
70
+ */
71
+ private function define_constants() {
72
 
73
+ define( 'METASLIDER_VERSION', $this->version );
74
+ define( 'METASLIDER_BASE_URL', trailingslashit( plugins_url( 'ml-slider' ) ) );
75
+ define( 'METASLIDER_ASSETS_URL', trailingslashit( METASLIDER_BASE_URL . 'assets' ) );
76
+ define( 'METASLIDER_PATH', plugin_dir_path( __FILE__ ) );
77
 
 
78
  }
79
 
80
+
81
  /**
82
+ * All Meta Slider classes
83
  */
84
+ private function plugin_classes() {
85
+
86
+ return array(
87
+ 'metaslider' => METASLIDER_PATH . 'inc/slider/metaslider.class.php',
88
+ 'metacoinslider' => METASLIDER_PATH . 'inc/slider/metaslider.coin.class.php',
89
+ 'metaflexslider' => METASLIDER_PATH . 'inc/slider/metaslider.flex.class.php',
90
+ 'metanivoslider' => METASLIDER_PATH . 'inc/slider/metaslider.nivo.class.php',
91
+ 'metaresponsiveslider' => METASLIDER_PATH . 'inc/slider/metaslider.responsive.class.php',
92
+ 'metaslide' => METASLIDER_PATH . 'inc/slide/metaslide.class.php',
93
+ 'metaimageslide' => METASLIDER_PATH . 'inc/slide/metaslide.image.class.php',
94
+ 'metasliderimagehelper' => METASLIDER_PATH . 'inc/metaslider.imagehelper.class.php',
95
+ 'metaslidersystemcheck' => METASLIDER_PATH . 'inc/metaslider.systemcheck.class.php',
96
+ 'metaslider_widget' => METASLIDER_PATH . 'inc/metaslider.widget.class.php',
97
+ 'simple_html_dom' => METASLIDER_PATH . 'inc/simple_html_dom.php'
98
+ );
99
+
100
  }
101
 
102
+
103
  /**
104
+ * Load required classes
105
  */
106
+ private function includes() {
107
+
108
+ $autoload_is_disabled = defined( 'METASLIDER_AUTOLOAD_CLASSES' ) && METASLIDER_AUTOLOAD_CLASSES === false;
109
+
110
+ if ( function_exists( "spl_autoload_register" ) && ! ( $autoload_is_disabled ) ) {
111
+
112
+ // >= PHP 5.2 - Use auto loading
113
+ if ( function_exists( "__autoload" ) ) {
114
+ spl_autoload_register( "__autoload" );
115
+ }
116
+
117
+ spl_autoload_register( array( $this, 'autoload' ) );
118
+
119
+ } else {
120
+
121
+ // < PHP5.2 - Require all classes
122
+ foreach ( $this->plugin_classes() as $id => $path ) {
123
+ if ( is_readable( $path ) && ! class_exists( $id ) ) {
124
+ require_once( $path );
125
+ }
126
+ }
127
+
128
  }
129
+
130
  }
131
 
132
+
133
  /**
134
+ * Autoload Meta Slider classes to reduce memory consumption
135
  */
136
+ public function autoload( $class ) {
137
+
138
+ $classes = $this->plugin_classes();
139
+
140
+ $class_name = strtolower( $class );
141
+
142
+ if ( isset( $classes[$class_name] ) && is_readable( $classes[$class_name] ) ) {
143
+ require_once( $classes[$class_name] );
144
  }
145
+
146
  }
147
 
148
+
149
  /**
150
+ * Register the [metaslider] shortcode.
151
  */
152
+ private function setup_shortcode() {
 
 
153
 
154
+ add_shortcode( 'metaslider', array( $this, 'register_shortcode' ) );
155
+ add_shortcode( 'ml-slider', array( $this, 'register_shortcode' ) ); // backwards compatibility
156
 
 
 
 
 
 
 
 
 
157
  }
158
 
159
+
160
+ /**
161
+ * Hook Meta Slider into WordPress
162
+ */
163
+ private function setup_actions() {
164
+
165
+ add_action( 'admin_menu', array( $this, 'register_admin_menu' ), 9553 );
166
+ add_action( 'init', array( $this, 'register_post_type' ) );
167
+ add_action( 'init', array( $this, 'register_taxonomy' ) );
168
+ add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
169
+ add_action( 'admin_footer', array( $this, 'admin_footer' ), 11 );
170
+ add_action( 'media_upload_vimeo', array( $this, 'upgrade_to_pro_tab' ) );
171
+ add_action( 'media_upload_youtube', array( $this, 'upgrade_to_pro_tab' ) );
172
+ add_action( 'media_upload_post_feed', array( $this, 'upgrade_to_pro_tab' ) );
173
+ add_action( 'media_upload_layer', array( $this, 'upgrade_to_pro_tab' ) );
174
+ add_action( 'admin_post_metaslider_preview', array( $this, 'do_preview' ) );
175
+ add_action( 'widgets_init', array( $this, 'register_metaslider_widget' ) );
176
+
177
+ if ( defined( 'METASLIDER_ENABLE_RESOURCE_MANAGER' ) && METASLIDER_ENABLE_RESOURCE_MANAGER === true ) {
178
+
179
+ add_action( 'template_redirect', array( $this, 'start_resource_manager'), 0 );
180
+
181
+ }
182
+
183
+ }
184
+
185
+
186
+ /**
187
+ * Hook Meta Slider into WordPress
188
+ */
189
+ private function setup_filters() {
190
+
191
+ add_filter( 'media_upload_tabs', array( $this, 'custom_media_upload_tab_name' ), 998 );
192
+ add_filter( 'media_view_strings', array( $this, 'custom_media_uploader_tabs' ), 5 );
193
+ add_filter( 'media_buttons_context', array( $this, 'insert_metaslider_button' ) );
194
+
195
+ // add 'go pro' link to plugin options
196
+ $plugin = plugin_basename( __FILE__ );
197
+
198
+ add_filter( "plugin_action_links_{$plugin}", array( $this, 'upgrade_to_pro_link' ) );
199
+
200
+ }
201
+
202
+
203
+ /**
204
+ * Register Meta Slider widget
205
+ */
206
+ public function register_metaslider_widget() {
207
+
208
+ register_widget( 'MetaSlider_Widget' );
209
+
210
+ }
211
+
212
+
213
+ /**
214
+ * Register ML Slider post type
215
+ */
216
+ public function register_post_type() {
217
+
218
+ register_post_type( 'ml-slider', array(
219
+ 'query_var' => false,
220
+ 'rewrite' => false,
221
+ 'public' => true,
222
+ 'exclude_from_search' => true,
223
+ 'publicly_queryable' => false,
224
+ 'show_in_nav_menus' => false,
225
+ 'show_ui' => false,
226
+ 'labels' => array(
227
+ 'name' => 'Meta Slider'
228
+ )
229
+ )
230
+ );
231
+
232
+ }
233
+
234
+
235
+ /**
236
+ * Register taxonomy to store slider => slides relationship
237
+ */
238
+ public function register_taxonomy() {
239
+
240
+ register_taxonomy( 'ml-slider', 'attachment', array(
241
+ 'hierarchical' => true,
242
+ 'public' => false,
243
+ 'query_var' => false,
244
+ 'rewrite' => false
245
+ )
246
+ );
247
+
248
+ }
249
+
250
+
251
  /**
252
  * Register our slide types
253
  */
254
  private function register_slide_types() {
255
+
256
  $image = new MetaImageSlide();
257
+
258
  }
259
 
260
+
261
  /**
262
+ * Add the menu page
263
  */
264
+ public function register_admin_menu() {
265
+
266
+ $title = apply_filters( 'metaslider_menu_title', "Meta Slider" );
267
+
268
+ $page = add_menu_page( $title, $title, 'edit_others_posts', 'metaslider', array(
269
+ $this, 'render_admin_page'
270
+ ), METASLIDER_ASSETS_URL . 'metaslider/matchalabs.png', 9501 );
271
+
272
+ // ensure our JavaScript is only loaded on the Meta Slider admin page
273
+ add_action( 'admin_print_scripts-' . $page, array( $this, 'register_admin_scripts' ) );
274
+ add_action( 'admin_print_styles-' . $page, array( $this, 'register_admin_styles' ) );
275
+ add_action( 'load-' . $page, array( $this, 'help_tab' ) );
276
+
277
  }
278
 
279
+
280
  /**
281
+ * Shortcode used to display slideshow
282
+ *
283
+ * @return string HTML output of the shortcode
284
  */
285
+ public function register_shortcode( $atts ) {
286
+
287
+ if ( !isset( $atts['id'] ) ) {
288
+ return false;
 
 
 
 
289
  }
290
+
291
+ // handle [metaslider id=123 restrict_to=home]
292
+ if ( isset( $atts['restrict_to'] ) && $atts['restrict_to'] == 'home' && ! is_front_page() ) {
293
+ return;
294
+ }
295
+
296
+ // we have an ID to work with
297
+ $slider = get_post( $atts['id'] );
298
+
299
+ // check the slider is published and the ID is correct
300
+ if ( ! $slider || $slider->post_status != 'publish' || $slider->post_type != 'ml-slider' ) {
301
+ return "<!-- meta slider {$atts['id']} not found -->";
302
+ }
303
+
304
+ // lets go
305
+ $this->set_slider( $atts['id'], $atts );
306
+ $this->slider->enqueue_scripts();
307
+
308
+ return $this->slider->render_public_slides();
309
+
310
  }
311
 
312
+
313
  /**
314
+ * Initialise translations
 
 
315
  */
316
+ public function load_plugin_textdomain() {
 
317
 
318
+ load_plugin_textdomain( 'metaslider', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
 
 
319
 
320
+ }
 
 
 
 
 
 
 
321
 
 
322
 
323
+ /**
324
+ * Add the help tab to the screen.
325
+ */
326
+ public function help_tab() {
327
+
328
+ $screen = get_current_screen();
329
+
330
+ // documentation tab
331
+ $screen->add_help_tab( array(
332
+ 'id' => 'documentation',
333
+ 'title' => __( 'Documentation', 'metaslider' ),
334
+ 'content' => "<p><a href='http://www.metaslider.com/documentation/' target='blank'>Meta Slider Documentation</a></p>",
335
+ )
336
+ );
337
 
 
338
  }
339
 
340
+
341
  /**
342
  * Rehister admin styles
343
  */
344
  public function register_admin_styles() {
 
 
 
345
 
346
+ wp_enqueue_style( 'metaslider-admin-styles', METASLIDER_ASSETS_URL . 'metaslider/admin.css', false, METASLIDER_VERSION );
347
+ wp_enqueue_style( 'metaslider-colorbox-styles', METASLIDER_ASSETS_URL . 'colorbox/colorbox.css', false, METASLIDER_VERSION );
348
+ wp_enqueue_style( 'metaslider-tipsy-styles', METASLIDER_ASSETS_URL . 'tipsy/tipsy.css', false, METASLIDER_VERSION );
349
+
350
+ do_action( 'metaslider_register_admin_styles' );
351
+
352
  }
353
 
354
+
355
  /**
356
  * Register admin JavaScript
357
  */
358
  public function register_admin_scripts() {
359
+
360
  // media library dependencies
361
  wp_enqueue_media();
362
 
363
  // plugin dependencies
364
+ wp_enqueue_script( 'jquery-ui-core', array( 'jquery' ) );
365
+ wp_enqueue_script( 'jquery-ui-sortable', array( 'jquery', 'jquery-ui-core' ) );
366
+ wp_enqueue_script( 'metaslider-colorbox', METASLIDER_ASSETS_URL . 'colorbox/jquery.colorbox-min.js', array( 'jquery' ), METASLIDER_VERSION );
367
+ wp_enqueue_script( 'metaslider-tipsy', METASLIDER_ASSETS_URL . 'tipsy/jquery.tipsy.js', array( 'jquery' ), METASLIDER_VERSION );
368
+ wp_enqueue_script( 'metaslider-admin-script', METASLIDER_ASSETS_URL . 'metaslider/admin.js', array( 'jquery', 'metaslider-tipsy', 'media-upload' ), METASLIDER_VERSION );
 
 
 
 
 
 
 
 
369
 
370
+ wp_dequeue_script( 'link' ); // WP Posts Filter Fix (Advanced Settings not toggling)
371
+ wp_dequeue_script( 'ai1ec_requirejs' ); // All In One Events Calendar Fix (Advanced Settings not toggling)
372
+
373
+ $this->localize_admin_scripts();
374
+
375
+ do_action( 'metaslider_register_admin_scripts' );
 
 
 
 
 
376
 
 
377
  }
378
 
379
+
380
  /**
381
+ * Localise admin script
382
  */
383
+ public function localize_admin_scripts() {
 
384
 
385
+ wp_localize_script( 'metaslider-admin-script', 'metaslider', array(
386
+ 'url' => __( "URL", "metaslider" ),
387
+ 'caption' => __( "Caption", "metaslider" ),
388
+ 'new_window' => __( "New Window", "metaslider" ),
389
+ 'confirm' => __( "Are you sure?", "metaslider" ),
390
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
391
+ 'resize_nonce' => wp_create_nonce( 'metaslider_resize' ),
392
+ 'addslide_nonce' => wp_create_nonce( 'metaslider_addslide' ),
393
+ 'iframeurl' => admin_url( 'admin-post.php?action=metaslider_preview' ),
394
+ 'useWithCaution' => __( "Caution: This setting is for advanced developers only. If you're unsure, leave it checked.", "metaslider" )
395
+ )
396
+ );
397
 
 
 
 
 
398
  }
399
 
400
+
401
  /**
402
+ * Outputs a blank page containing a slideshow preview (for use in the 'Preview' iFrame)
403
  */
404
+ public function do_preview() {
 
 
405
 
406
+ remove_action('wp_footer', 'wp_admin_bar_render', 1000);
407
 
408
+ if ( isset( $_GET['slider_id'] ) && absint( $_GET['slider_id'] ) > 0 ) {
409
+ $id = absint( $_GET['slider_id'] );
 
410
 
411
+ echo "<!DOCTYPE html>";
412
+ echo "<html><head>";
413
+ echo "<style>body, html { overflow: hidden; margin: 0; padding: 0; }</style>";
414
+ echo "</head><body>";
415
+ echo do_shortcode("[metaslider id={$id}]");
416
+ wp_footer();
417
+ echo "</body></html>";
418
  }
 
419
 
420
+ die();
 
 
 
 
421
 
 
 
 
 
 
 
422
  }
423
 
424
+
425
  /**
426
+ * Check our WordPress installation is compatible with Meta Slider
427
  */
428
+ public function do_system_check() {
429
+
430
+ $systemCheck = new MetaSliderSystemCheck();
431
+ $systemCheck->check();
432
+
 
 
 
 
 
433
  }
434
 
435
+
436
  /**
437
+ * Update the tab options in the media manager
438
  */
439
+ public function custom_media_uploader_tabs( $strings ) {
440
+
441
+ //update strings
442
+ if ( ( isset( $_GET['page'] ) && $_GET['page'] == 'metaslider' ) ) {
443
+ $strings['insertMediaTitle'] = __( "Image", "metaslider" );
444
+ $strings['insertIntoPost'] = __( "Add to slider", "metaslider" );
445
+ // remove options
446
+ if ( isset( $strings['createGalleryTitle'] ) ) unset( $strings['createGalleryTitle'] );
447
+ if ( isset( $strings['insertFromUrlTitle'] ) ) unset( $strings['insertFromUrlTitle'] );
448
+ }
449
+
450
+ return $strings;
451
+
452
  }
453
 
454
+
455
  /**
456
+ * Add extra tabs to the default wordpress Media Manager iframe
457
  *
458
+ * @var array existing media manager tabs
459
  */
460
+ public function custom_media_upload_tab_name( $tabs ) {
 
 
 
461
 
462
+ $metaslider_tabs = array( 'post_feed', 'layer', 'youtube', 'vimeo' );
 
463
 
464
+ // restrict our tab changes to the meta slider plugin page
465
+ if ( ( isset( $_GET['page'] ) && $_GET['page'] == 'metaslider' ) || ( isset( $_GET['tab'] ) && in_array( $_GET['tab'], $metaslider_tabs ) ) ) {
466
+ $newtabs = array();
467
+
468
+ if ( function_exists( 'is_plugin_active' ) && ! is_plugin_active( 'ml-slider-pro/ml-slider-pro.php' ) ) {
469
+ $newtabs = array(
470
+ 'post_feed' => __( "Post Feed", "metaslider" ),
471
+ 'vimeo' => __( "Vimeo", "metaslider" ),
472
+ 'youtube' => __( "YouTube", "metaslider" ),
473
+ 'layer' => __( "Layer Slide", "metaslider" )
474
+ );
475
+ }
476
+
477
+ if ( isset( $tabs['nextgen'] ) )
478
+ unset( $tabs['nextgen'] );
479
+
480
+
481
+ if ( is_array( $tabs ) ) {
482
+ return array_merge( $tabs, $newtabs );
483
+ } else {
484
+ return $newtabs;
485
+ }
486
+
487
  }
488
 
489
+ return $tabs;
 
 
490
 
 
491
  }
492
 
493
+
494
  /**
495
  * Set the current slider
496
  */
497
+ public function set_slider( $id, $shortcode_settings = array() ) {
498
+
499
  $type = 'flex';
500
 
501
+ if ( isset( $shortcode_settings['type'] ) ) {
502
  $type = $shortcode_settings['type'];
503
+ } else if ( $settings = get_post_meta( $id, 'ml-slider_settings', true ) ) {
504
+ if ( is_array( $settings ) && isset( $settings['type'] ) ) {
 
505
  $type = $settings['type'];
506
  }
507
  }
508
 
509
+ if ( ! in_array( $type, array( 'flex', 'coin', 'nivo', 'responsive' ) ) ) {
510
  $type = 'flex';
511
  }
512
 
513
+ $this->slider = $this->create_slider( $type, $id, $shortcode_settings );
514
+
515
  }
516
 
517
+
518
  /**
519
  * Create a new slider based on the sliders type setting
520
  */
521
+ private function create_slider( $type, $id, $shortcode_settings ) {
522
+
523
+ switch ( $type ) {
524
+ case( 'coin' ):
525
+ return new MetaCoinSlider( $id, $shortcode_settings );
526
+ case( 'flex' ):
527
+ return new MetaFlexSlider( $id, $shortcode_settings );
528
+ case( 'nivo' ):
529
+ return new MetaNivoSlider( $id, $shortcode_settings );
530
+ case( 'responsive' ):
531
+ return new MetaResponsiveSlider( $id, $shortcode_settings );
532
  default:
533
+ return new MetaFlexSlider( $id, $shortcode_settings );
534
+
535
  }
536
  }
537
 
538
+
539
  /**
540
  * Handle slide uploads/changes.
541
  */
542
  public function admin_process() {
543
+
544
+ // this function should only ever be called from the Meta Slider admin page.
545
+ if ( ! is_admin() ) {
546
+ return;
547
+ }
548
 
549
  // default to the latest slider
550
+ $slider_id = $this->find_slider( 'modified', 'DESC' );
551
 
552
  // delete a slider
553
+ if ( isset( $_GET['delete'] ) ) {
554
+ $slider_id = $this->delete_slider( absint( $_GET['delete'] ) );
555
  }
556
 
557
  // load a slider by ID
558
+ if ( isset( $_REQUEST['id'] ) ) {
559
+ $temp_id = absint( $_REQUEST['id'] );
560
 
561
+ // check valid post ID
562
+ if ( get_post( $temp_id ) ) {
563
+ $slider_id = $temp_id;
564
+ }
565
  }
566
 
567
  // create a new slider
568
+ if ( isset( $_GET['add'] ) ) {
569
  $slider_id = $this->add_slider();
570
  }
571
 
572
+ // finally, set the slider
573
+ if ( $slider_id > 0 ) {
574
+ $this->set_slider( $slider_id );
575
  }
576
+
577
  }
578
 
579
+
580
  /**
581
  * Create a new slider
582
  */
583
  private function add_slider() {
584
+
585
  // check nonce
586
+ check_admin_referer( "metaslider_add_slider" );
587
 
588
  $defaults = array();
589
 
590
  // if possible, take a copy of the last edited slider settings in place of default settings
591
+ if ( $last_modified = $this->find_slider( 'modified', 'DESC' ) ) {
592
+ $defaults = get_post_meta( $last_modified, 'ml-slider_settings', true );
593
  }
594
 
595
  // insert the post
596
+ $id = wp_insert_post( array(
597
+ 'post_title' => __( "New Slider", "metaslider" ),
598
+ 'post_status' => 'publish',
599
+ 'post_type' => 'ml-slider'
600
+ )
601
+ );
602
 
603
  // use the default settings if we can't find anything more suitable.
604
+ if ( empty( $defaults ) ) {
605
+ $slider = new MetaSlider( $id, array() );
606
  $defaults = $slider->get_default_parameters();
607
  }
608
 
609
  // insert the post meta
610
+ add_post_meta( $id, 'ml-slider_settings', $defaults, true );
611
 
612
  // create the taxonomy term, the term is the ID of the slider itself
613
+ wp_insert_term( $id, 'ml-slider' );
614
 
615
  return $id;
616
+
617
  }
618
 
619
+
620
  /**
621
  * Delete a slider (send it to trash)
622
  *
623
  * @param int $id
624
  */
625
+ private function delete_slider( $id ) {
626
+
627
  // check nonce
628
+ check_admin_referer( "metaslider_delete_slider" );
629
 
630
  // send the post to trash
631
+ wp_update_post( array(
632
+ 'ID' => $id,
633
+ 'post_status' => 'trash'
634
+ )
635
+ );
636
+
637
+ return $this->find_slider( 'date', 'DESC' );
638
 
 
639
  }
640
 
641
+
642
  /**
643
  * Find a single slider ID. For example, last edited, or first published.
644
  *
646
  * @param string $order direction (ASC or DESC).
647
  * @return int slider ID.
648
  */
649
+ private function find_slider( $orderby, $order ) {
650
+
651
  $args = array(
652
  'force_no_custom_order' => true,
653
  'post_type' => 'ml-slider',
658
  'order' => $order
659
  );
660
 
661
+ $the_query = new WP_Query( $args );
662
 
663
+ while ( $the_query->have_posts() ) {
664
  $the_query->the_post();
665
  return $the_query->post->ID;
666
  }
668
  wp_reset_query();
669
 
670
  return false;
671
+
672
  }
673
 
674
 
679
  * @param string $sort_key
680
  * @return array all published sliders
681
  */
682
+ private function all_meta_sliders( $sort_key = 'date' ) {
683
+
684
  $sliders = false;
685
 
686
  // list the tabs
693
  'posts_per_page' => -1
694
  );
695
 
696
+ $args = apply_filters( 'metaslider_all_meta_sliders_args', $args );
697
 
698
+ $the_query = new WP_Query( $args );
699
 
700
+ while ( $the_query->have_posts() ) {
701
  $the_query->the_post();
702
+ $active = $this->slider && ( $this->slider->id == $the_query->post->ID ) ? true : false;
703
 
704
  $sliders[] = array(
705
  'active' => $active,
711
  wp_reset_query();
712
 
713
  return $sliders;
714
+
715
  }
716
 
717
+
718
  /**
719
  * Compare array values
720
  *
722
  * @param array $elem2
723
  * @return bool
724
  */
725
+ private function compare_elems( $elem1, $elem2 ) {
726
+
727
+ return $elem1['priority'] > $elem2['priority'];
728
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
729
  }
730
 
731
+
732
+ /**
733
+ *
734
+ * @param array $aFields - array of field to render
735
+ * @return string
736
+ */
737
+ public function build_settings_rows( $aFields ) {
738
+
739
+ // order the fields by priority
740
+ uasort( $aFields, array( $this, "compare_elems" ) );
741
+
742
+ $return = "";
743
+
744
+ // loop through the array and build the settings HTML
745
+ foreach ( $aFields as $id => $row ) {
746
+ // checkbox input type
747
+ if ( $row['type'] == 'checkbox' ) {
748
+ $return .= "<tr><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><input class='option {$row['class']} {$id}' type='checkbox' name='settings[{$id}]' {$row['checked']} />";
749
+
750
+ if ( isset( $row['after'] ) ) {
751
+ $return .= "<span class='after'>{$row['after']}</span>";
752
+ }
753
+
754
+ $return .= "</td></tr>";
755
+ }
756
+
757
+ // navigation row
758
+ if ( $row['type'] == 'navigation' ) {
759
+ $navigation_row = "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><ul>";
760
+
761
+ foreach ( $row['options'] as $k => $v ) {
762
+ $checked = checked( $k, $row['value'], false );
763
+ $disabled = $k == 'thumbnails' ? 'disabled' : '';
764
+ $navigation_row .= "<li><label><input type='radio' name='settings[{$id}]' value='{$k}' {$checked} {$disabled}/>{$v['label']}</label></li>";
765
+ }
766
+
767
+ $navigation_row .= "</ul></td></tr>";
768
+
769
+ $return .= apply_filters( 'metaslider_navigation_options', $navigation_row, $this->slider );
770
+ }
771
+
772
+ // navigation row
773
+ if ( $row['type'] == 'radio' ) {
774
+ $navigation_row = "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><ul>";
775
+
776
+ foreach ( $row['options'] as $k => $v ) {
777
+ $checked = checked( $k, $row['value'], false );
778
+ $class = isset( $v['class'] ) ? $v['class'] : "";
779
+ $navigation_row .= "<li><label><input type='radio' name='settings[{$id}]' value='{$k}' {$checked} class='radio {$class}'/>{$v['label']}</label></li>";
780
+ }
781
+
782
+ $navigation_row .= "</ul></td></tr>";
783
+
784
+ $return .= apply_filters( 'metaslider_navigation_options', $navigation_row, $this->slider );
785
+ }
786
+
787
+ // header/divider row
788
+ if ( $row['type'] == 'divider' ) {
789
+ $return .= "<tr class='{$row['type']}'><td colspan='2' class='divider'><b>{$row['value']}</b></td></tr>";
790
+ }
791
+
792
+ // slideshow select row
793
+ if ( $row['type'] == 'slider-lib' ) {
794
+ $return .= "<tr class='{$row['type']}'><td colspan='2' class='slider-lib-row'>";
795
+
796
+ foreach ( $row['options'] as $k => $v ) {
797
+ $checked = checked( $k, $row['value'], false );
798
+ $return .= "<input class='select-slider' id='{$k}' rel='{$k}' type='radio' name='settings[type]' value='{$k}' {$checked} />
799
+ <label for='{$k}'>{$v['label']}</label>";
800
+ }
801
+
802
+ $return .= "</td></tr>";
803
+ }
804
+
805
+ // number input type
806
+ if ( $row['type'] == 'number' ) {
807
+ $return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><input class='option {$row['class']} {$id}' type='number' min='{$row['min']}' max='{$row['max']}' step='{$row['step']}' name='settings[{$id}]' value='{$row['value']}' /><span class='after'>{$row['after']}</span></td></tr>";
808
+ }
809
+
810
+ // select drop down
811
+ if ( $row['type'] == 'select' ) {
812
+ $return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><select class='option {$row['class']} {$id}' name='settings[{$id}]'>";
813
+ foreach ( $row['options'] as $k => $v ) {
814
+ $selected = selected( $k, $row['value'], false );
815
+ $return .= "<option class='{$v['class']}' value='{$k}' {$selected}>{$v['label']}</option>";
816
+ }
817
+ $return .= "</select></td></tr>";
818
+ }
819
+
820
+ // theme drop down
821
+ if ( $row['type'] == 'theme' ) {
822
+ $return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><select class='option {$row['class']} {$id}' name='settings[{$id}]'>";
823
+ $themes = "";
824
+
825
+ foreach ( $row['options'] as $k => $v ) {
826
+ $selected = selected( $k, $row['value'], false );
827
+ $themes .= "<option class='{$v['class']}' value='{$k}' {$selected}>{$v['label']}</option>";
828
+ }
829
+
830
+ $return .= apply_filters( 'metaslider_get_available_themes', $themes, $this->slider->get_setting( 'theme' ) );
831
+
832
+ $return .= "</select></td></tr>";
833
+ }
834
+
835
+ // text input type
836
+ if ( $row['type'] == 'text' ) {
837
+ $return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><input class='option {$row['class']} {$id}' type='text' name='settings[{$id}]' value='{$row['value']}' /></td></tr>";
838
+ }
839
+
840
+ // text input type
841
+ if ( $row['type'] == 'textarea' ) {
842
+ $return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\" colspan='2'>{$row['label']}</td></tr><tr><td colspan='2'><textarea class='option {$row['class']} {$id}' name='settings[{$id}]' />{$row['value']}</textarea></td></tr>";
843
+ }
844
+
845
+ // text input type
846
+ if ( $row['type'] == 'title' ) {
847
+ $return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><input class='option {$row['class']} {$id}' type='text' name='{$id}' value='{$row['value']}' /></td></tr>";
848
+ }
849
+ }
850
+
851
+ return $return;
852
+
853
+ }
854
+
855
+
856
  /**
857
  * Return an indexed array of all easing options
858
  *
859
  * @return array
860
  */
861
  private function get_easing_options() {
862
+
863
  $options = array(
864
+ 'linear', 'swing', 'jswing', 'easeInQuad', 'easeOutQuad', 'easeInOutQuad',
865
+ 'easeInCubic', 'easeOutCubic', 'easeInOutCubic', 'easeInQuart',
866
+ 'easeOutQuart', 'easeInOutQuart', 'easeInQuint', 'easeOutQuint',
867
+ 'easeInOutQuint', 'easeInSine', 'easeOutSine', 'easeInOutSine',
868
+ 'easeInExpo', 'easeOutExpo', 'easeInOutExpo', 'easeInCirc', 'easeOutCirc',
869
+ 'easeInOutCirc', 'easeInElastic', 'easeOutElastic', 'easeInOutElastic',
870
+ 'easeInBack', 'easeOutBack', 'easeInOutBack', 'easeInBounce', 'easeOutBounce',
871
  'easeInOutBounce'
872
  );
873
 
874
+ foreach ( $options as $option ) {
875
  $return[$option] = array(
876
+ 'label' => ucfirst( preg_replace( '/(\w+)([A-Z])/U', '\\1 \\2', $option ) ),
877
+ 'class' => ''
878
  );
879
  }
880
 
881
  return $return;
882
+
883
  }
884
 
885
 
887
  * Render the admin page (tabs, slides, settings)
888
  */
889
  public function render_admin_page() {
890
+
891
  $this->admin_process();
892
+ $this->upgrade_to_pro_cta();
893
+ $this->do_system_check();
894
+ $max_tabs = apply_filters( 'metaslider_max_tabs', 0 );
895
+ $slider_id = $this->slider ? $this->slider->id : 0;
896
+
897
  ?>
898
 
899
  <script type='text/javascript'>
900
+ var metaslider_slider_id = <?php echo $slider_id; ?>;
901
+ var metaslider_pro_active = <?php echo function_exists( 'is_plugin_active' ) && is_plugin_active( 'ml-slider-pro/ml-slider-pro.php' ) ? 'true' : 'false' ?>;
902
  </script>
903
 
904
  <div class="wrap metaslider">
905
+ <form accept-charset="UTF-8" action="?page=metaslider&amp;id=<?php echo $slider_id ?>" method="post">
906
  <?php
907
+ if ( $this->slider ) {
908
+ wp_nonce_field( 'metaslider_save_' . $this->slider->id );
909
  }
910
 
911
  $title = "";
912
+ $add_url = wp_nonce_url( "?page=metaslider&amp;add=true", "metaslider_add_slider" );
913
 
914
+ if ( $tabs = $this->all_meta_sliders() ) {
915
+ if ( $max_tabs && count( $tabs ) > $max_tabs ) {
916
+ if ( isset( $_GET['add'] ) && $_GET['add'] == 'true' ) {
917
+ echo "<div id='message' class='updated'><p>" . __( "New slideshow created. Click 'Add Slide' to get started!", "metaslider" ) . "</p></div>";
918
  }
919
  echo "<div style='margin-top: 20px;'><label for='select-slider'>Select Slider: </label>";
920
  echo "<select name='select-slider' onchange='if (this.value) window.location.href=this.value'>";
921
 
922
+ $tabs = $this->all_meta_sliders( 'title' );
923
 
924
+ foreach ( $tabs as $tab ) {
925
  $selected = $tab['active'] ? " selected" : "";
926
 
927
+ if ( $tab['active'] ) {
928
  $title = $tab['title'];
929
  }
930
 
931
  echo "<option value='?page=metaslider&amp;id={$tab['id']}'{$selected}>{$tab['title']}</option>";
932
 
933
  }
934
+ echo "</select> " . __( 'or', "metaslider" ) . " ";
935
+ echo "<a href='{$add_url}'>" . __( 'Add New Slideshow', "metaslider" ) . "</a></div>";
936
  } else {
937
  echo "<h3 class='nav-tab-wrapper'>";
938
+ foreach ( $tabs as $tab ) {
939
+ if ( $tab['active'] ) {
940
  echo "<div class='nav-tab nav-tab-active'><input type='text' name='title' value='" . $tab['title'] . "' onfocus='this.style.width = ((this.value.length + 1) * 9) + \"px\"' /></div>";
941
  } else {
942
  echo "<a href='?page=metaslider&amp;id={$tab['id']}' class='nav-tab'>" . $tab['title'] . "</a>";
948
  } else {
949
  echo "<h3 class='nav-tab-wrapper'>";
950
  echo "<a href='{$add_url}' id='create_new_tab' class='nav-tab'>+</a>";
951
+ echo "<div class='bubble'>" . __( "Create your first slideshow", "metaslider" ) . "</div>";
952
  echo "</h3>";
953
  }
 
954
  ?>
955
 
956
  <?php
957
+ if ( ! $this->slider ) {
958
  return;
959
  }
960
  ?>
967
  <thead>
968
  <tr>
969
  <th style="width: 100px;">
970
+ <h3><?php _e( "Slides", "metaslider" ) ?></h3>
971
  </th>
972
  <th>
973
+ <a href='#' class='button alignright add-slide' data-editor='content' title='<?php _e( "Add Slide", "metaslider" ) ?>'>
974
+ <span class='wp-media-buttons-icon'></span> <?php _e( "Add Slide", "metaslider" ) ?>
975
  </a>
976
  </th>
977
  </tr>
986
  </div>
987
  </div>
988
 
989
+ <div id="postbox-container-1" class="postbox-container">
990
+ <div id="side-sortables" class="meta-box-sortables">
991
+ <div class='right'>
992
+ <div class="postbox" id="metaslider_configuration">
993
+ <h3 class='configuration'>
994
+ <?php _e( "Settings", "metaslider" ) ?>
995
+ <input class='alignright button button-primary' type='submit' name='save' id='ms-save' value='<?php _e( "Save", "metaslider" ) ?>' />
996
+ <input class='alignright button button-primary' type='submit' name='preview' id='ms-preview' value='<?php _e( "Save & Preview", "metaslider" ) ?>' data-slider_id='<?php echo $this->slider->id ?>' data-slider_width='<?php echo $this->slider->get_setting( 'width' ) ?>' data-slider_height='<?php echo $this->slider->get_setting( 'height' ) ?>' />
997
+ <span class="spinner"></span>
998
+ </h3>
999
+ <div class="inside">
1000
+ <table class="widefat settings">
1001
+ <tbody>
1002
+ <?php
1003
+ $aFields = array(
1004
+ 'type' => array(
1005
+ 'priority' => 0,
1006
+ 'type' => 'slider-lib',
1007
+ 'value' => $this->slider->get_setting( 'type' ),
1008
+ 'options' => array(
1009
+ 'flex' => array( 'label' => __( "Flex Slider", "metaslider" ) ),
1010
+ 'responsive' => array( 'label' => __( "R. Slides", "metaslider" ) ),
1011
+ 'nivo' => array( 'label' => __( "Nivo Slider", "metaslider" ) ),
1012
+ 'coin' => array( 'label' => __( "Coin Slider", "metaslider" ) )
1013
+ )
1014
+ ),
1015
+ 'width' => array(
1016
+ 'priority' => 10,
1017
+ 'type' => 'number',
1018
+ 'size' => 3,
1019
+ 'min' => 0,
1020
+ 'max' => 9999,
1021
+ 'step' => 1,
1022
+ 'value' => $this->slider->get_setting( 'width' ),
1023
+ 'label' => __( "Width", "metaslider" ),
1024
+ 'class' => 'coin flex responsive nivo',
1025
+ 'helptext' => __( "Slideshow width", "metaslider" ),
1026
+ 'after' => __( "px", "metaslider" )
1027
+ ),
1028
+ 'height' => array(
1029
+ 'priority' => 20,
1030
+ 'type' => 'number',
1031
+ 'size' => 3,
1032
+ 'min' => 0,
1033
+ 'max' => 9999,
1034
+ 'step' => 1,
1035
+ 'value' => $this->slider->get_setting( 'height' ),
1036
+ 'label' => __( "Height", "metaslider" ),
1037
+ 'class' => 'coin flex responsive nivo',
1038
+ 'helptext' => __( "Slideshow height", "metaslider" ),
1039
+ 'after' => __( "px", "metaslider" )
1040
+ ),
1041
+ 'effect' => array(
1042
+ 'priority' => 30,
1043
+ 'type' => 'select',
1044
+ 'value' => $this->slider->get_setting( 'effect' ),
1045
+ 'label' => __( "Effect", "metaslider" ),
1046
+ 'class' => 'effect coin flex responsive nivo',
1047
+ 'helptext' => __( "Slide transition effect", "metaslider" ),
1048
+ 'options' => array(
1049
+ 'random' => array( 'class' => 'option coin nivo' , 'label' => __( "Random", "metaslider" ) ),
1050
+ 'swirl' => array( 'class' => 'option coin', 'label' => __( "Swirl", "metaslider" ) ),
1051
+ 'rain' => array( 'class' => 'option coin', 'label' => __( "Rain", "metaslider" ) ),
1052
+ 'straight' => array( 'class' => 'option coin', 'label' => __( "Straight", "metaslider" ) ),
1053
+ 'sliceDown' => array( 'class' => 'option nivo', 'label' => __( "Slide Down", "metaslider" ) ),
1054
+ 'sliceUp' => array( 'class' => 'option nivo', 'label' => __( "Slice Up", "metaslider" ) ),
1055
+ 'sliceUpLeft' => array( 'class' => 'option nivo', 'label' => __( "Slide Up Left", "metaslider" ) ),
1056
+ 'sliceUpDown' => array( 'class' => 'option nivo', 'label' => __( "Slice Up Down", "metaslider" ) ),
1057
+ 'slideUpDownLeft' => array( 'class' => 'option nivo', 'label' => __( "Slide Up Down Left", "metaslider" ) ),
1058
+ 'fold' => array( 'class' => 'option nivo', 'label' => __( "Fold", "metaslider" ) ),
1059
+ 'fade' => array( 'class' => 'option nivo flex responsive', 'label' => __( "Fade", "metaslider" ) ),
1060
+ 'slideInRight' => array( 'class' => 'option nivo', 'label' => __( "Slide In Right", "metaslider" ) ),
1061
+ 'slideInLeft' => array( 'class' => 'option nivo', 'label' => __( "Slide In Left", "metaslider" ) ),
1062
+ 'boxRandom' => array( 'class' => 'option nivo', 'label' => __( "Box Random", "metaslider" ) ),
1063
+ 'boxRain' => array( 'class' => 'option nivo', 'label' => __( "Box Rain", "metaslider" ) ),
1064
+ 'boxRainReverse' => array( 'class' => 'option nivo', 'label' => __( "Box Rain Reverse", "metaslider" ) ),
1065
+ 'boxRainGrowReverse' => array( 'class' => 'option nivo', 'label' => __( "Box Rain Grow Reverse", "metaslider" ) ),
1066
+ 'slide' => array( 'class' => 'option flex', 'label' => __( "Slide", "metaslider" ) )
1067
+ ),
1068
+ ),
1069
+ 'theme' => array(
1070
+ 'priority' => 40,
1071
+ 'type' => 'theme',
1072
+ 'value' => $this->slider->get_setting( 'theme' ),
1073
+ 'label' => __( "Theme", "metaslider" ),
1074
+ 'class' => 'effect coin flex responsive nivo',
1075
+ 'helptext' => __( "Slideshow theme", "metaslider" ),
1076
+ 'options' => array(
1077
+ 'default' => array( 'class' => 'option nivo flex coin responsive' , 'label' => __( "Default", "metaslider" ) ),
1078
+ 'dark' => array( 'class' => 'option nivo', 'label' => __( "Dark (Nivo)", "metaslider" ) ),
1079
+ 'light' => array( 'class' => 'option nivo', 'label' => __( "Light (Nivo)", "metaslider" ) ),
1080
+ 'bar' => array( 'class' => 'option nivo', 'label' => __( "Bar (Nivo)", "metaslider" ) ),
1081
+ ),
1082
+ ),
1083
+ 'links' => array(
1084
+ 'priority' => 50,
1085
+ 'type' => 'checkbox',
1086
+ 'label' => __( "Arrows", "metaslider" ),
1087
+ 'class' => 'option coin flex nivo responsive',
1088
+ 'checked' => $this->slider->get_setting( 'links' ) == 'true' ? 'checked' : '',
1089
+ 'helptext' => __( "Show the previous/next arrows", "metaslider" )
1090
+ ),
1091
+ 'navigation' => array(
1092
+ 'priority' => 60,
1093
+ 'type' => 'navigation',
1094
+ 'label' => __( "Navigation", "metaslider" ),
1095
+ 'class' => 'option coin flex nivo responsive',
1096
+ 'value' => $this->slider->get_setting( 'navigation' ),
1097
+ 'helptext' => __( "Show the slide navigation bullets", "metaslider" ),
1098
+ 'options' => array(
1099
+ 'false' => array( 'label' => __( "Hidden", "metaslider" ) ),
1100
+ 'true' => array( 'label' => __( "Dots", "metaslider" ) ),
1101
+ 'thumbnails' => array( 'label' => __( "Thumbnails (Pro)", "metaslider" ) )
1102
+ )
1103
+ ),
1104
+ );
1105
+
1106
+ if ( $max_tabs && count( $this->all_meta_sliders() ) > $max_tabs ) {
1107
+ $aFields['title'] = array(
1108
+ 'type' => 'title',
1109
+ 'priority' => 5,
1110
+ 'class' => 'option flex nivo responsive coin',
1111
+ 'value' => $title,
1112
+ 'label' => __( "Title", "metaslider" ),
1113
+ 'helptext' => __( "Slideshow title", "metaslider" )
1114
+ );
1115
+ }
1116
+
1117
+ $aFields = apply_filters( 'metaslider_basic_settings', $aFields, $this->slider );
1118
+
1119
+ echo $this->build_settings_rows( $aFields );
1120
+ ?>
1121
+ </tbody>
1122
+ </table>
1123
+ </div>
1124
+ </div>
1125
+
1126
+ <div class="postbox ms-toggle closed" id="metaslider_advanced_settings">
1127
+ <div class="handlediv" title="Click to toggle"><br></div><h3 class="hndle"><span><?php _e( "Advanced Settings", "metaslider" ) ?></span></h3>
1128
+ <div class="inside">
1129
+ <table>
1130
+ <tbody>
1131
+ <?php
1132
+ $aFields = array(
1133
+ 'fullWidth' => array(
1134
+ 'priority' => 5,
1135
+ 'type' => 'checkbox',
1136
+ 'label' => __( "Stretch", "metaslider" ),
1137
+ 'class' => 'option flex nivo responsive',
1138
+ 'after' => __( "100% wide output", "metaslider" ),
1139
+ 'checked' => $this->slider->get_setting( 'fullWidth' ) == 'true' ? 'checked' : '',
1140
+ 'helptext' => __( "Stretch the slideshow output to fill it's parent container", "metaslider" )
1141
+ ),
1142
+ 'center' => array(
1143
+ 'priority' => 10,
1144
+ 'type' => 'checkbox',
1145
+ 'label' => __( "Center align", "metaslider" ),
1146
+ 'class' => 'option coin flex nivo responsive',
1147
+ 'checked' => $this->slider->get_setting( 'center' ) == 'true' ? 'checked' : '',
1148
+ 'helptext' => __( "Center align the slideshow", "metaslider" )
1149
+ ),
1150
+ 'autoPlay' => array(
1151
+ 'priority' => 20,
1152
+ 'type' => 'checkbox',
1153
+ 'label' => __( "Auto play", "metaslider" ),
1154
+ 'class' => 'option flex nivo responsive',
1155
+ 'checked' => $this->slider->get_setting( 'autoPlay' ) == 'true' ? 'checked' : '',
1156
+ 'helptext' => __( "Transition between slides automatically", "metaslider" )
1157
+ ),
1158
+ 'smartCrop' => array(
1159
+ 'priority' => 30,
1160
+ 'type' => 'checkbox',
1161
+ 'label' => __( "Smart crop", "metaslider" ),
1162
+ 'class' => 'option coin flex nivo responsive',
1163
+ 'checked' => $this->slider->get_setting( 'smartCrop' ) == 'true' ? 'checked' : '',
1164
+ 'helptext' => __( "Smart Crop ensures your responsive slides are cropped to a ratio that results in a consistent slideshow size", "metaslider" )
1165
+ ),
1166
+ 'carouselMode' => array(
1167
+ 'priority' => 40,
1168
+ 'type' => 'checkbox',
1169
+ 'label' => __( "Carousel mode", "metaslider" ),
1170
+ 'class' => 'option flex showNextWhenChecked',
1171
+ 'checked' => $this->slider->get_setting( 'carouselMode' ) == 'true' ? 'checked' : '',
1172
+ 'helptext' => __( "Display multiple slides at once. Slideshow output will be 100% wide.", "metaslider" )
1173
+ ),
1174
  'carouselMargin' => array(
1175
  'priority' => 45,
1176
  'min' => 0,
1177
  'max' => 9999,
1178
  'step' => 1,
1179
  'type' => 'number',
1180
+ 'label' => __( "Carousel margin", "metaslider" ),
1181
+ 'class' => 'option flex',
1182
+ 'value' => $this->slider->get_setting( 'carouselMargin' ),
1183
+ 'helptext' => __( "Pixel margin between slides in carousel.", "metaslider" ),
1184
+ 'after' => __( "px", "metaslider" )
1185
+ ),
1186
+ 'random' => array(
1187
+ 'priority' => 50,
1188
+ 'type' => 'checkbox',
1189
+ 'label' => __( "Random", "metaslider" ),
1190
+ 'class' => 'option coin flex nivo responsive',
1191
+ 'checked' => $this->slider->get_setting( 'random' ) == 'true' ? 'checked' : '',
1192
+ 'helptext' => __( "Randomise the order of the slides", "metaslider" )
1193
+ ),
1194
+ 'hoverPause' => array(
1195
+ 'priority' => 60,
1196
+ 'type' => 'checkbox',
1197
+ 'label' => __( "Hover pause", "metaslider" ),
1198
+ 'class' => 'option coin flex nivo responsive',
1199
+ 'checked' => $this->slider->get_setting( 'hoverPause' ) == 'true' ? 'checked' : '',
1200
+ 'helptext' => __( "Pause the slideshow when hovering over slider, then resume when no longer hovering.", "metaslider" )
1201
+ ),
1202
+ 'reverse' => array(
1203
+ 'priority' => 70,
1204
+ 'type' => 'checkbox',
1205
+ 'label' => __( "Reverse", "metaslider" ),
1206
+ 'class' => 'option flex',
1207
+ 'checked' => $this->slider->get_setting( 'reverse' ) == 'true' ? 'checked' : '',
1208
+ 'helptext' => __( "Reverse the animation direction", "metaslider" )
1209
+ ),
1210
+ 'delay' => array(
1211
+ 'priority' => 80,
1212
+ 'type' => 'number',
1213
+ 'size' => 3,
1214
+ 'min' => 500,
1215
+ 'max' => 10000,
1216
+ 'step' => 100,
1217
+ 'value' => $this->slider->get_setting( 'delay' ),
1218
+ 'label' => __( "Slide delay", "metaslider" ),
1219
+ 'class' => 'option coin flex responsive nivo',
1220
+ 'helptext' => __( "How long to display each slide, in milliseconds", "metaslider" ),
1221
+ 'after' => __( "ms", "metaslider" )
1222
+ ),
1223
+ 'animationSpeed' => array(
1224
+ 'priority' => 90,
1225
+ 'type' => 'number',
1226
+ 'size' => 3,
1227
+ 'min' => 0,
1228
+ 'max' => 2000,
1229
+ 'step' => 100,
1230
+ 'value' => $this->slider->get_setting( 'animationSpeed' ),
1231
+ 'label' => __( "Animation speed", "metaslider" ),
1232
+ 'class' => 'option flex responsive nivo',
1233
+ 'helptext' => __( "Set the speed of animations, in milliseconds", "metaslider" ),
1234
+ 'after' => __( "ms", "metaslider" )
1235
+ ),
1236
+ 'slices' => array(
1237
+ 'priority' => 100,
1238
+ 'type' => 'number',
1239
+ 'size' => 3,
1240
+ 'min' => 0,
1241
+ 'max' => 20,
1242
+ 'step' => 1,
1243
+ 'value' => $this->slider->get_setting( 'slices' ),
1244
+ 'label' => __( "Number of slices", "metaslider" ),
1245
+ 'class' => 'option nivo',
1246
+ 'helptext' => __( "Number of slices", "metaslider" ),
1247
+ 'after' => __( "ms", "metaslider" )
1248
+ ),
1249
+ 'spw' => array(
1250
+ 'priority' => 110,
1251
+ 'type' => 'number',
1252
+ 'size' => 3,
1253
+ 'min' => 0,
1254
+ 'max' => 20,
1255
+ 'step' => 1,
1256
+ 'value' => $this->slider->get_setting( 'spw' ),
1257
+ 'label' => __( "Number of squares", "metaslider" ) . " (" . __( "Width", "metaslider" ) . ")",
1258
+ 'class' => 'option nivo',
1259
+ 'helptext' => __( "Number of squares", "metaslider" ),
1260
+ 'after' => ''
1261
+ ),
1262
+ 'sph' => array(
1263
+ 'priority' => 120,
1264
+ 'type' => 'number',
1265
+ 'size' => 3,
1266
+ 'min' => 0,
1267
+ 'max' => 20,
1268
+ 'step' => 1,
1269
+ 'value' => $this->slider->get_setting( 'sph' ),
1270
+ 'label' => __( "Number of squares", "metaslider" ) . " (" . __( "Height", "metaslider" ) . ")",
1271
+ 'class' => 'option nivo',
1272
+ 'helptext' => __( "Number of squares", "metaslider" ),
1273
+ 'after' => ''
1274
+ ),
1275
+ 'direction' => array(
1276
+ 'priority' => 130,
1277
+ 'type' => 'select',
1278
+ 'label' => __( "Slide direction", "metaslider" ),
1279
+ 'class' => 'option flex',
1280
+ 'helptext' => __( "Select the sliding direction", "metaslider" ),
1281
+ 'value' => $this->slider->get_setting( 'direction' ),
1282
+ 'options' => array(
1283
+ 'horizontal' => array( 'label' => __( "Horizontal", "metaslider" ), 'class' => '' ),
1284
+ 'vertical' => array( 'label' => __( "Vertical", "metaslider" ), 'class' => '' ),
1285
+ )
1286
+ ),
1287
+ 'easing' => array(
1288
+ 'priority' => 140,
1289
+ 'type' => 'select',
1290
+ 'label' => __( "Easing", "metaslider" ),
1291
  'class' => 'option flex',
1292
+ 'helptext' => __( "Animation easing effect", "metaslider" ),
1293
+ 'value' => $this->slider->get_setting( 'easing' ),
1294
+ 'options' => $this->get_easing_options()
1295
+ ),
1296
+ 'prevText' => array(
1297
+ 'priority' => 150,
1298
+ 'type' => 'text',
1299
+ 'label' => __( "Previous text", "metaslider" ),
1300
+ 'class' => 'option coin flex responsive nivo',
1301
+ 'helptext' => __( "Set the text for the 'previous' direction item", "metaslider" ),
1302
+ 'value' => $this->slider->get_setting( 'prevText' ) == 'false' ? '' : $this->slider->get_setting( 'prevText' )
1303
+ ),
1304
+ 'nextText' => array(
1305
+ 'priority' => 160,
1306
+ 'type' => 'text',
1307
+ 'label' => __( "Next text", "metaslider" ),
1308
+ 'class' => 'option coin flex responsive nivo',
1309
+ 'helptext' => __( "Set the text for the 'next' direction item", "metaslider" ),
1310
+ 'value' => $this->slider->get_setting( 'nextText' ) == 'false' ? '' : $this->slider->get_setting( 'nextText' )
1311
+ ),
1312
+ 'sDelay' => array(
1313
+ 'priority' => 170,
1314
+ 'type' => 'number',
1315
+ 'size' => 3,
1316
+ 'min' => 0,
1317
+ 'max' => 500,
1318
+ 'step' => 10,
1319
+ 'value' => $this->slider->get_setting( 'sDelay' ),
1320
+ 'label' => __( "Square delay", "metaslider" ),
1321
+ 'class' => 'option coin',
1322
+ 'helptext' => __( "Delay between squares in ms", "metaslider" ),
1323
+ 'after' => __( "ms", "metaslider" )
1324
+ ),
1325
+ 'opacity' => array(
1326
+ 'priority' => 180,
1327
+ 'type' => 'number',
1328
+ 'size' => 3,
1329
+ 'min' => 0,
1330
+ 'max' => 1,
1331
+ 'step' => 0.1,
1332
+ 'value' => $this->slider->get_setting( 'opacity' ),
1333
+ 'label' => __( "Opacity", "metaslider" ),
1334
+ 'class' => 'option coin',
1335
+ 'helptext' => __( "Opacity of title and navigation", "metaslider" ),
1336
+ 'after' => ''
1337
  ),
1338
+ 'titleSpeed' => array(
1339
+ 'priority' => 190,
1340
+ 'type' => 'number',
1341
+ 'size' => 3,
1342
+ 'min' => 0,
1343
+ 'max' => 10000,
1344
+ 'step' => 100,
1345
+ 'value' => $this->slider->get_setting( 'titleSpeed' ),
1346
+ 'label' => __( "Caption speed", "metaslider" ),
1347
+ 'class' => 'option coin',
1348
+ 'helptext' => __( "Set the fade in speed of the caption", "metaslider" ),
1349
+ 'after' => __( "ms", "metaslider" )
1350
+ ),
1351
+ 'developerOptions' => array(
1352
+ 'priority' => 195,
1353
+ 'type' => 'divider',
1354
+ 'class' => 'option coin flex responsive nivo',
1355
+ 'value' => __( "Developer options", "metaslider" )
1356
+ ),
1357
+ 'cssClass' => array(
1358
+ 'priority' => 200,
1359
+ 'type' => 'text',
1360
+ 'label' => __( "CSS classes", "metaslider" ),
1361
+ 'class' => 'option coin flex responsive nivo',
1362
+ 'helptext' => __( "Specify any custom CSS Classes you would like to be added to the slider wrapper", "metaslider" ),
1363
+ 'value' => $this->slider->get_setting( 'cssClass' ) == 'false' ? '' : $this->slider->get_setting( 'cssClass' )
1364
+ ),
1365
+ 'printCss' => array(
1366
+ 'priority' => 210,
1367
+ 'type' => 'checkbox',
1368
+ 'label' => __( "Print CSS", "metaslider" ),
1369
+ 'class' => 'option coin flex responsive nivo useWithCaution',
1370
+ 'checked' => $this->slider->get_setting( 'printCss' ) == 'true' ? 'checked' : '',
1371
+ 'helptext' => __( "Uncheck this is you would like to include your own CSS", "metaslider" )
1372
+ ),
1373
+ 'printJs' => array(
1374
+ 'priority' => 220,
1375
+ 'type' => 'checkbox',
1376
+ 'label' => __( "Print JS", "metaslider" ),
1377
+ 'class' => 'option coin flex responsive nivo useWithCaution',
1378
+ 'checked' => $this->slider->get_setting( 'printJs' ) == 'true' ? 'checked' : '',
1379
+ 'helptext' => __( "Uncheck this is you would like to include your own Javascript", "metaslider" )
1380
+ ),
1381
+ 'noConflict' => array(
1382
+ 'priority' => 230,
1383
+ 'type' => 'checkbox',
1384
+ 'label' => __( "No conflict mode", "metaslider" ),
1385
+ 'class' => 'option flex',
1386
+ 'checked' => $this->slider->get_setting( 'noConflict' ) == 'true' ? 'checked' : '',
1387
+ 'helptext' => __( "Delay adding the flexslider class to the slideshow", "metaslider" )
1388
+ ),
1389
+ );
1390
+
1391
+ $aFields = apply_filters( 'metaslider_advanced_settings', $aFields, $this->slider );
1392
+
1393
+ echo $this->build_settings_rows( $aFields );
1394
+ ?>
1395
+ </tbody>
1396
+ </table>
1397
+ </div>
1398
+ </div>
1399
+
1400
+ <div class="postbox shortcode ms-toggle" id="metaslider_usage">
1401
+ <div class="handlediv" title="Click to toggle"><br></div><h3 class="hndle"><span><?php _e( "Usage", "metaslider" ) ?></span></h3>
1402
+ <div class="inside">
1403
+ <ul class='tabs'>
1404
+ <li rel='tab-1' class='selected'><?php _e( "Shortcode", "metaslider" ) ?></li>
1405
+ <li rel='tab-2'><?php _e( "Template Include", "metaslider" ) ?></li>
1406
+ </ul>
1407
+ <div class='tabs-content'>
1408
+ <div class='tab tab-1'>
1409
+ <p><?php _e( "Copy & paste the shortcode directly into any WordPress post or page.", "metaslider" ); ?></p>
1410
+ <input readonly='readonly' type='text' value='[metaslider id=<?php echo $this->slider->id ?>]' /></div>
1411
+ <div class='tab tab-2' style='display: none'>
1412
+ <p><?php _e( "Copy & paste this code into a template file to include the slideshow within your theme.", "metaslider" ); ?></p>
1413
+ <textarea readonly='readonly'>&lt;?php &#13;&#10; echo do_shortcode("[metaslider id=<?php echo $this->slider->id ?>]"); &#13;&#10;?></textarea></div>
1414
+ </div>
1415
+ </div>
1416
+ </div>
1417
+
1418
+ <div class="postbox social" id="metaslider_social">
1419
+ <div class="inside">
1420
+ <ul class='info'>
1421
+ <li style='width: 33%;'>
1422
+ <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.metaslider.com" data-text="Check out Meta Slider, an easy to use slideshow plugin for WordPress" data-hashtags="metaslider, wordpress, slideshow">Tweet</a>
1423
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
1424
+ </li>
1425
+ <li style='width: 34%;'>
1426
+ <div class="g-plusone" data-size="medium" data-href="http://www.metaslider.com"></div>
1427
+ <script type="text/javascript">
1428
+ (function() {
1429
+ var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
1430
+ po.src = 'https://apis.google.com/js/plusone.js';
1431
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
1432
+ })();
1433
+ </script>
1434
+ </li>
1435
+ <li style='width: 33%;'>
1436
+ <iframe style='border:none; overflow:hidden; width:80px; height:21px;' src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.metaslider.com&amp;send=false&amp;layout=button_count&amp;width=90&amp;show_faces=false&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21&amp;appId=156668027835524" scrolling="no" frameborder="0" allowTransparency="true"></iframe>
1437
+ </li>
1438
+ </ul>
1439
+ </div>
1440
+ </div>
1441
+ <a class='delete-slider alignright button-secondary confirm' href='<?php echo wp_nonce_url( "?page=metaslider&amp;delete={$this->slider->id}", "metaslider_delete_slider" ); ?>'><?php _e( "Delete Slider", "metaslider" ) ?></a>
1442
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1443
  </div>
1444
  </div>
1445
  </div>
1450
  }
1451
 
1452
 
1453
+ /**
1454
+ * Append the 'Add Slider' button to selected admin pages
1455
+ */
1456
+ public function insert_metaslider_button( $context ) {
1457
+
1458
+ global $pagenow;
1459
+
1460
+ if ( in_array( $pagenow, array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ) ) ) {
1461
+ $context .= '<a href="#TB_inline?&inlineId=choose-meta-slider" class="thickbox button" title="' .
1462
+ __( "Select slideshow to insert into post", "metaslider" ) .
1463
+ '"><span class="wp-media-buttons-icon" style="background: url(' . METASLIDER_ASSETS_URL .
1464
+ '/metaslider/matchalabs.png); background-repeat: no-repeat; background-position: left bottom;"></span> ' .
1465
+ __( "Add slider", "metaslider" ) . '</a>';
1466
+ }
1467
+
1468
+ return $context;
1469
+
1470
+ }
1471
+
1472
+
1473
+ /**
1474
+ * Append the 'Choose Meta Slider' thickbox content to the bottom of selected admin pages
1475
+ */
1476
+ public function admin_footer() {
1477
+
1478
+ global $pagenow;
1479
+
1480
+ // Only run in post/page creation and edit screens
1481
+ if ( in_array( $pagenow, array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ) ) ) {
1482
+ $sliders = $this->all_meta_sliders( 'title' );
1483
+ ?>
1484
+
1485
+ <script type="text/javascript">
1486
+ jQuery(document).ready(function() {
1487
+ jQuery('#insertMetaSlider').on('click', function() {
1488
+ var id = jQuery('#metaslider-select option:selected').val();
1489
+ window.send_to_editor('[metaslider id=' + id + ']');
1490
+ tb_remove();
1491
+ })
1492
+ });
1493
+ </script>
1494
+
1495
+ <div id="choose-meta-slider" style="display: none;">
1496
+ <div class="wrap">
1497
+ <?php
1498
+ if ( count( $sliders ) ) {
1499
+ echo "<h3 style='margin-bottom: 20px;'>" . __( "Insert Meta Slider", "metaslider" ) . "</h3>";
1500
+ echo "<select id='metaslider-select'>";
1501
+ echo "<option disabled=disabled>" . __( "Choose slideshow", "metaslider" ) . "</option>";
1502
+ foreach ( $sliders as $slider ) {
1503
+ echo "<option value='{$slider['id']}'>{$slider['title']}</option>";
1504
+ }
1505
+ echo "</select>";
1506
+ echo "<button class='button primary' id='insertMetaSlider'>Insert Slideshow</button>";
1507
+ } else {
1508
+ _e( "No slideshows found", "metaslider" );
1509
+ }
1510
+ ?>
1511
+ </div>
1512
+ </div>
1513
+
1514
+ <?php
1515
+ }
1516
+ }
1517
+
1518
+
1519
+ /**
1520
+ * Add settings link on plugin page
1521
+ */
1522
+ public function upgrade_to_pro_link( $links ) {
1523
+
1524
+ if ( function_exists( 'is_plugin_active' ) && ! is_plugin_active( 'ml-slider-pro/ml-slider-pro.php' ) ) {
1525
+ $links[] = '<a href="http://www.metaslider.com/upgrade" target="_blank">' . __( "Go Pro", "metaslider" ) . '</a>';
1526
+ }
1527
+
1528
+ return $links;
1529
+
1530
+ }
1531
+
1532
+
1533
+ /**
1534
+ * Return the meta slider pro upgrade iFrame
1535
+ */
1536
+ public function upgrade_to_pro_tab() {
1537
+
1538
+ if ( function_exists( 'is_plugin_active' ) && ! is_plugin_active( 'ml-slider-pro/ml-slider-pro.php' ) ) {
1539
+ return wp_iframe( array( $this, 'upgrade_to_pro_iframe' ) );
1540
+ }
1541
+
1542
+ }
1543
+
1544
+
1545
+ /**
1546
+ * Media Manager iframe HTML
1547
+ */
1548
+ public function upgrade_to_pro_iframe() {
1549
+
1550
+ wp_enqueue_style( 'metaslider-admin-styles', METASLIDER_ASSETS_URL . 'metaslider/admin.css', false, METASLIDER_VERSION );
1551
+ wp_enqueue_script( 'google-font-api', 'http://fonts.googleapis.com/css?family=PT+Sans:400,700' );
1552
+
1553
+ $link = apply_filters( 'metaslider_hoplink', 'http://www.metaslider.com/upgrade/' );
1554
+ $link .= '?utm_source=lite&amp;utm_medium=more-slide-types&amp;utm_campaign=pro';
1555
+
1556
+ echo implode("", array(
1557
+ "<div class='metaslider_pro'>",
1558
+ "<p>Get the Pro Addon pack to add support for: <b>Post Feed</b> Slides, <b>YouTube</b> Slides, <b>HTML</b> Slides & <b>Vimeo</b> Slides</p>",
1559
+ "<p><b>NEW: </b> Animated HTML <b>Layer</b> Slides (with an awesome Drag & Drop editor!)</p>",
1560
+ "<p><b></b> Live Theme Editor!</p>",
1561
+ "<p><b>NEW:</b> Thumbnail Navigation for Flex & Nivo Slider!</p>",
1562
+ "<a class='probutton' href='{$link}' target='_blank'>Get <span class='logo'><strong>Meta</strong>Slider</span><span class='super'>Pro</span></a>",
1563
+ "<span class='subtext'>Opens in a new window</span>",
1564
+ "</div>"
1565
+ ));
1566
+
1567
+ }
1568
+
1569
+
1570
+ /**
1571
+ * Upgrade CTA.
1572
+ */
1573
+ public function upgrade_to_pro_cta() {
1574
+
1575
+ if ( function_exists( 'is_plugin_active' ) && ! is_plugin_active( 'ml-slider-pro/ml-slider-pro.php' ) ) {
1576
+ $link = apply_filters( 'metaslider_hoplink', 'http://www.metaslider.com/upgrade/' );
1577
+
1578
+ $link .= '?utm_source=lite&amp;utm_medium=nag&amp;utm_campaign=pro';
1579
+
1580
+ $goPro = "<div style='display: none;' id='screen-options-link-wrap'><a target='_blank' class='show-settings' href='{$link}'>Meta Slider v" . METASLIDER_VERSION . " - " .
1581
+ __( 'Upgrade to Pro $19', "metaslider" ) .
1582
+ "</a></div>";
1583
+
1584
+ echo $goPro;
1585
+ }
1586
+
1587
+ }
1588
+
1589
+
1590
+ /**
1591
+ * Start output buffering.
1592
+ *
1593
+ * Note: wp_ob_end_flush_all is called by default
1594
+ * - see shutdown action in default-filters.php
1595
+ */
1596
+ public function start_resource_manager() {
1597
+
1598
+ ob_start( array( $this, 'resource_manager' ) );
1599
+
1600
+ }
1601
+
1602
+ /**
1603
+ * Process the whole page output. Move link tags with an ID starting
1604
+ * with 'metaslider' into the <head> of the page.
1605
+ */
1606
+ public function resource_manager( $buffer ) {
1607
+
1608
+ // create dom document from buffer
1609
+ $html = new simple_html_dom();
1610
+
1611
+ // Load from a string
1612
+ $html->load( $buffer, true, false );
1613
+
1614
+ if ( ! $html->find( 'body link[id^="metaslider"]' ) )
1615
+ return $buffer;
1616
+
1617
+ // selectors to find Meta Slider links
1618
+ $selectors = array(
1619
+ 'body link[id^="metaslider"]',
1620
+ );
1621
+
1622
+ $selectors = apply_filters( "metaslider_resource_manager_selectors", $selectors );
1623
+
1624
+ if ( $head = $html->find( 'head', 0 ) ) {
1625
+
1626
+ // move meta slider elemends to <head>
1627
+ foreach ( $selectors as $selector ) {
1628
+
1629
+ foreach ( $html->find( $selector ) as $element ) {
1630
+
1631
+ $head->innertext .= "\t" . $element->outertext . "\n";
1632
+ $element->outertext = '';
1633
+
1634
+ }
1635
+
1636
+ }
1637
+
1638
+ }
1639
+
1640
+ return $html->save();
1641
+
1642
+ }
1643
+
1644
  }
1645
 
1646
+ endif;
1647
 
1648
+ add_action( 'plugins_loaded', array( 'MetaSliderPlugin', 'init' ), 10 );
preview.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
-
3
- define('WP_USE_THEMES', false);
4
-
5
- require('../../../wp-blog-header.php');
6
-
7
- if (isset($_GET['slider_id']) && (int)$_GET['slider_id'] > 0) {
8
- add_filter('show_admin_bar', '__return_false');
9
- remove_action('init', 'wp_admin_bar_init');
10
-
11
- $id = intval($_GET['slider_id']);
12
-
13
- echo "<!DOCTYPE html>";
14
- echo "<html style='margin-top: 0 !important'><head></head>";
15
- echo "<body style='overflow: hidden; margin: 0; padding: 0;'>";
16
- echo do_shortcode("[metaslider id={$id}]");
17
- wp_footer();
18
- echo "</body>";
19
- echo "</html>";
20
- }
21
-
22
- die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -3,18 +3,18 @@ Contributors: matchalabs
3
  Tags: wordpress slideshow,seo,slideshow,slider,widget,wordpress slider,image slider,flexslider,flex slider,nivoslider,nivo slider,responsive,responsive slides,coinslider,coin slider,slideshow,carousel,responsive slider,vertical slides
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CQ84KC4X8YKW8
5
  Requires at least: 3.5
6
- Tested up to: 3.8
7
- Stable tag: 2.7.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Easy to use slideshow plugin. Create SEO optimised responsive slideshows with Nivo Slider, Flex Slider, Coin Slider and Responsive Slides.
12
 
13
  == Description ==
14
 
15
  http://www.youtube.com/watch?v=I7IfkV6iLqo
16
 
17
- Meta Slider is the most popular slideshow plugin for WordPress. Creating slideshows with [Meta Slider](http://www.metaslider.com/) is fast and easy. Simply select images from your WordPress Media Library, drag and drop them into place, set slide captions, links and SEO fields all from one page. You can choose from 4 different slideshow types (Flex Slider, Nivo Slider, Responsive Slides & Coin Slider) and use the provided shortcode or template include to easily embed slideshows in your blog.
18
 
19
  **Includes**
20
 
@@ -60,6 +60,7 @@ Upgrade to [Meta Slider Pro](http://www.metaslider.com/upgrade) to add support f
60
  * Chinese (thanks to 断青丝)
61
  * Taiwanese (thanks to 断青丝)
62
  * Norwegian (thanks to Dreamsoft)
 
63
  * Croatian
64
 
65
  Read more and thanks to:
@@ -104,13 +105,11 @@ You will need to paste the "Template Include" code into your theme (you can find
104
  * Find the correct place to add it (for example above or below the logo)
105
  * Paste in the code and save.
106
 
107
- If you want to include the slideshow on your homepage only, use this code:
108
 
109
- `<?php
110
- if (is_front_page() || is_home()) {
111
- echo do_shortcode("[metaslider id=123]"); //replace 123 with slider ID
112
- }
113
- ?>`
114
 
115
  Theme specific instructions:
116
 
@@ -137,6 +136,37 @@ See www.metaslider.com/documentation/image-cropping/
137
 
138
  == Changelog ==
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  = 2.7.2 [25/03/14] =
141
 
142
  * Fix: Only apply carousel margin to slides
3
  Tags: wordpress slideshow,seo,slideshow,slider,widget,wordpress slider,image slider,flexslider,flex slider,nivoslider,nivo slider,responsive,responsive slides,coinslider,coin slider,slideshow,carousel,responsive slider,vertical slides
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CQ84KC4X8YKW8
5
  Requires at least: 3.5
6
+ Tested up to: 3.9
7
+ Stable tag: 2.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Easy to use WordPress slider plugin. Create SEO optimised responsive slideshows with Nivo Slider, Flex Slider, Coin Slider and Responsive Slides.
12
 
13
  == Description ==
14
 
15
  http://www.youtube.com/watch?v=I7IfkV6iLqo
16
 
17
+ The most popular WordPress slider plugin. Creating slideshows with [Meta Slider](http://www.metaslider.com/) is fast and easy. Simply select images from your WordPress Media Library, drag and drop them into place, set slide captions, links and SEO fields all from one page. You can choose from 4 different slideshow types (Flex Slider, Nivo Slider, Responsive Slides & Coin Slider) and use the provided shortcode or template include to easily embed slideshows in your blog.
18
 
19
  **Includes**
20
 
60
  * Chinese (thanks to 断青丝)
61
  * Taiwanese (thanks to 断青丝)
62
  * Norwegian (thanks to Dreamsoft)
63
+ * Romanian (thanks to Octav Madalin Stanoaia)
64
  * Croatian
65
 
66
  Read more and thanks to:
105
  * Find the correct place to add it (for example above or below the logo)
106
  * Paste in the code and save.
107
 
108
+ = I only want to show the slideshow on my homepage, how can I do that? =
109
 
110
+ Add the 'restrict_to' parameter to the shortcode, eg:
111
+
112
+ `[metaslider id=XXX restrict_to=home]");`
 
 
113
 
114
  Theme specific instructions:
115
 
136
 
137
  == Changelog ==
138
 
139
+ = 2.8.1 [28/04/14] =
140
+
141
+ * Fix: All in One Events Calendar conflict fix (Advanced Settings not toggling)
142
+ * Fix: CSS resets to avoid theme conflicts
143
+ * Fix: Autoload visibility conflict (http://wordpress.org/support/topic/autoload-visibillity-conflict)
144
+ * Fix: Layer Editor in IE11 - text fields not accessible in modal windows
145
+ * Fix: FlexSlider IE11 Fade transition
146
+
147
+ = 2.8 [28/04/14] =
148
+
149
+ * New feature: Russian Language Pack added
150
+ * Fix: Carousel image scaling in FireFox
151
+ * Fix: wpautop issue with double ampersand
152
+ * New feature: Shortcode parameter added to restrict slideshow to displaying on homepage only (see FAQ)
153
+ * Improvement: Save slideshow after reordering slides
154
+ * Fix: PHP Warning when no slideshows have been created
155
+
156
+ = 2.8-beta [16/04/14] =
157
+
158
+ * Improvement: Preview now uses admin-post action
159
+ * Improvement: Classes are now auto loaded to reduce memory footprint
160
+ (Thanks to Viktor Szépe for the above suggestions!)
161
+ * Improvement: Slideshow initilisation time reduced
162
+ * Improvement: HTML5 Compatibility: Alt tags always present on image tag - even if empty.
163
+ * Improvement: Flex Slider slideshows should now 'reserve' a space for themselves while they fully load
164
+ * Update: Flex Slider updated to v2.2.2
165
+ * New feature: Romanian Language Pack added (Thanks to Octav Madalin Stanoaia)
166
+ * New feature: Dutch Language Pack added
167
+ * New feature: WP Super Cache compatibility - cache is cleared when saving slideshow
168
+ * New feature: HTML5 Compatibility (Experimental). Set `define('METASLIDER_ENABLE_RESOURCE_MANAGER', true);` in wp-config.php to move Meta Slider link tags head of the page.
169
+
170
  = 2.7.2 [25/03/14] =
171
 
172
  * Fix: Only apply carousel margin to slides