MetaSlider - Version 1.3

Version Description

  • Renamed to Meta Slider (previously ML Slider)
  • Improvement: Admin styling cleaned up
  • Improvement: Code refactored
  • Improvement: Plugin localised
  • Improvement: Template include PHP code now displayed on slider edit page
  • Improvement: jQuery tablednd replaced with jQuery sortable for reordering slides
  • Improvement: Open URL in new window option added
  • Improvement: max-width css rule added to slider wrapper
  • Fix: UTF-8 support in captions (reported by and thanks to: petergluk)
  • Fix: JS && encoding error (reported by and thanks to: neefje)
  • Fix: Editors now have permission to use MetaSlider (reported by and thanks to: rritsud)
Download this release

Release Info

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

Code changes from version 1.2.1 to 1.3

assets/jquery.tablednd.js DELETED
@@ -1,314 +0,0 @@
1
- /**
2
- * TableDnD plug-in for JQuery, allows you to drag and drop table rows
3
- * You can set up various options to control how the system will work
4
- * Copyright © Denis Howlett <denish@isocra.com>
5
- * Licensed like jQuery, see http://docs.jquery.com/License.
6
- *
7
- * Configuration options:
8
- *
9
- * onDragStyle
10
- * This is the style that is assigned to the row during drag. There are limitations to the styles that can be
11
- * associated with a row (such as you can't assign a border—well you can, but it won't be
12
- * displayed). (So instead consider using onDragClass.) The CSS style to apply is specified as
13
- * a map (as used in the jQuery css(...) function).
14
- * onDropStyle
15
- * This is the style that is assigned to the row when it is dropped. As for onDragStyle, there are limitations
16
- * to what you can do. Also this replaces the original style, so again consider using onDragClass which
17
- * is simply added and then removed on drop.
18
- * onDragClass
19
- * This class is added for the duration of the drag and then removed when the row is dropped. It is more
20
- * flexible than using onDragStyle since it can be inherited by the row cells and other content. The default
21
- * is class is tDnD_whileDrag. So to use the default, simply customise this CSS class in your
22
- * stylesheet.
23
- * onDrop
24
- * Pass a function that will be called when the row is dropped. The function takes 2 parameters: the table
25
- * and the row that was dropped. You can work out the new order of the rows by using
26
- * table.rows.
27
- * onDragStart
28
- * Pass a function that will be called when the user starts dragging. The function takes 2 parameters: the
29
- * table and the row which the user has started to drag.
30
- * onAllowDrop
31
- * Pass a function that will be called as a row is over another row. If the function returns true, allow
32
- * dropping on that row, otherwise not. The function takes 2 parameters: the dragged row and the row under
33
- * the cursor. It returns a boolean: true allows the drop, false doesn't allow it.
34
- * scrollAmount
35
- * This is the number of pixels to scroll if the user moves the mouse cursor to the top or bottom of the
36
- * window. The page should automatically scroll up or down as appropriate (tested in IE6, IE7, Safari, FF2,
37
- * FF3 beta)
38
- *
39
- * Other ways to control behaviour:
40
- *
41
- * Add class="nodrop" to any rows for which you don't want to allow dropping, and class="nodrag" to any rows
42
- * that you don't want to be draggable.
43
- *
44
- * Inside the onDrop method you can also call $.tableDnD.serialize() this returns a string of the form
45
- * <tableID>[]=<rowID1>&<tableID>[]=<rowID2> so that you can send this back to the server. The table must have
46
- * an ID as must all the rows.
47
- *
48
- * Known problems:
49
- * - Auto-scoll has some problems with IE7 (it scrolls even when it shouldn't), work-around: set scrollAmount to 0
50
- *
51
- * Version 0.2: 2008-02-20 First public version
52
- * Version 0.3: 2008-02-07 Added onDragStart option
53
- * Made the scroll amount configurable (default is 5 as before)
54
- * Version 0.4: 2008-03-15 Changed the noDrag/noDrop attributes to nodrag/nodrop classes
55
- * Added onAllowDrop to control dropping
56
- * Fixed a bug which meant that you couldn't set the scroll amount in both directions
57
- * Added serialise method
58
- */
59
- jQuery.tableDnD = {
60
- /** Keep hold of the current table being dragged */
61
- currentTable : null,
62
- /** Keep hold of the current drag object if any */
63
- dragObject: null,
64
- /** The current mouse offset */
65
- mouseOffset: null,
66
- /** Remember the old value of Y so that we don't do too much processing */
67
- oldY: 0,
68
-
69
- /** Actually build the structure */
70
- build: function(options) {
71
- // Make sure options exists
72
- options = options || {};
73
- // Set up the defaults if any
74
-
75
- this.each(function() {
76
- // Remember the options
77
- this.tableDnDConfig = {
78
- onDragStyle: options.onDragStyle,
79
- onDropStyle: options.onDropStyle,
80
- // Add in the default class for whileDragging
81
- onDragClass: options.onDragClass ? options.onDragClass : "tDnD_whileDrag",
82
- onDrop: options.onDrop,
83
- onDragStart: options.onDragStart,
84
- scrollAmount: options.scrollAmount ? options.scrollAmount : 5
85
- };
86
- // Now make the rows draggable
87
- jQuery.tableDnD.makeDraggable(this);
88
- });
89
-
90
- // Now we need to capture the mouse up and mouse move event
91
- // We can use bind so that we don't interfere with other event handlers
92
- jQuery(document)
93
- .bind('mousemove', jQuery.tableDnD.mousemove)
94
- .bind('mouseup', jQuery.tableDnD.mouseup);
95
-
96
- // Don't break the chain
97
- return this;
98
- },
99
-
100
- /** This function makes all the rows on the table draggable apart from those marked as "NoDrag" */
101
- makeDraggable: function(table) {
102
- // Now initialise the rows
103
- var rows = table.rows; //getElementsByTagName("tr")
104
- var config = table.tableDnDConfig;
105
- for (var i=0; i<rows.length; i++) {
106
- // To make non-draggable rows, add the nodrag class (eg for Category and Header rows)
107
- // inspired by John Tarr and Famic
108
- var nodrag = jQuery(rows[i]).hasClass("nodrag");
109
- if (! nodrag) { //There is no NoDnD attribute on rows I want to drag
110
- jQuery(rows[i]).mousedown(function(ev) {
111
- if (ev.target.tagName == "TD") {
112
- jQuery.tableDnD.dragObject = this;
113
- jQuery.tableDnD.currentTable = table;
114
- jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev);
115
- if (config.onDragStart) {
116
- // Call the onDrop method if there is one
117
- config.onDragStart(table, this);
118
- }
119
- return false;
120
- }
121
- }).css("cursor", "move"); // Store the tableDnD object
122
- }
123
- }
124
- },
125
-
126
- /** Get the mouse coordinates from the event (allowing for browser differences) */
127
- mouseCoords: function(ev){
128
- if(ev.pageX || ev.pageY){
129
- return {x:ev.pageX, y:ev.pageY};
130
- }
131
- return {
132
- x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
133
- y:ev.clientY + document.body.scrollTop - document.body.clientTop
134
- };
135
- },
136
-
137
- /** Given a target element and a mouse event, get the mouse offset from that element.
138
- To do this we need the element's position and the mouse position */
139
- getMouseOffset: function(target, ev) {
140
- ev = ev || window.event;
141
-
142
- var docPos = this.getPosition(target);
143
- var mousePos = this.mouseCoords(ev);
144
- return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
145
- },
146
-
147
- /** Get the position of an element by going up the DOM tree and adding up all the offsets */
148
- getPosition: function(e){
149
- var left = 0;
150
- var top = 0;
151
- /** Safari fix -- thanks to Luis Chato for this! */
152
- if (e.offsetHeight == 0) {
153
- /** Safari 2 doesn't correctly grab the offsetTop of a table row
154
- this is detailed here:
155
- http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in-safari/
156
- the solution is likewise noted there, grab the offset of a table cell in the row - the firstChild.
157
- note that firefox will return a text node as a first child, so designing a more thorough
158
- solution may need to take that into account, for now this seems to work in firefox, safari, ie */
159
- e = e.firstChild; // a table cell
160
- }
161
-
162
- while (e.offsetParent){
163
- left += e.offsetLeft;
164
- top += e.offsetTop;
165
- e = e.offsetParent;
166
- }
167
-
168
- left += e.offsetLeft;
169
- top += e.offsetTop;
170
-
171
- return {x:left, y:top};
172
- },
173
-
174
- mousemove: function(ev) {
175
- if (jQuery.tableDnD.dragObject == null) {
176
- return;
177
- }
178
-
179
- var dragObj = jQuery(jQuery.tableDnD.dragObject);
180
- var config = jQuery.tableDnD.currentTable.tableDnDConfig;
181
- var mousePos = jQuery.tableDnD.mouseCoords(ev);
182
- var y = mousePos.y - jQuery.tableDnD.mouseOffset.y;
183
- //auto scroll the window
184
- var yOffset = window.pageYOffset;
185
- if (document.all) {
186
- // Windows version
187
- //yOffset=document.body.scrollTop;
188
- if (typeof document.compatMode != 'undefined' &&
189
- document.compatMode != 'BackCompat') {
190
- yOffset = document.documentElement.scrollTop;
191
- }
192
- else if (typeof document.body != 'undefined') {
193
- yOffset=document.body.scrollTop;
194
- }
195
-
196
- }
197
-
198
- if (mousePos.y-yOffset < config.scrollAmount) {
199
- window.scrollBy(0, -config.scrollAmount);
200
- } else {
201
- var windowHeight = window.innerHeight ? window.innerHeight
202
- : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
203
- if (windowHeight-(mousePos.y-yOffset) < config.scrollAmount) {
204
- window.scrollBy(0, config.scrollAmount);
205
- }
206
- }
207
-
208
-
209
- if (y != jQuery.tableDnD.oldY) {
210
- // work out if we're going up or down...
211
- var movingDown = y > jQuery.tableDnD.oldY;
212
- // update the old value
213
- jQuery.tableDnD.oldY = y;
214
- // update the style to show we're dragging
215
- if (config.onDragClass) {
216
- dragObj.addClass(config.onDragClass);
217
- } else {
218
- dragObj.css(config.onDragStyle);
219
- }
220
- // If we're over a row then move the dragged row to there so that the user sees the
221
- // effect dynamically
222
- var currentRow = jQuery.tableDnD.findDropTargetRow(dragObj, y);
223
- if (currentRow) {
224
- // TODO worry about what happens when there are multiple TBODIES
225
- if (movingDown && jQuery.tableDnD.dragObject != currentRow) {
226
- jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow.nextSibling);
227
- } else if (! movingDown && jQuery.tableDnD.dragObject != currentRow) {
228
- jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow);
229
- }
230
- }
231
- }
232
-
233
- return false;
234
- },
235
-
236
- /** We're only worried about the y position really, because we can only move rows up and down */
237
- findDropTargetRow: function(draggedRow, y) {
238
- var rows = jQuery.tableDnD.currentTable.rows;
239
- for (var i=0; i<rows.length; i++) {
240
- var row = rows[i];
241
- var rowY = this.getPosition(row).y;
242
- var rowHeight = parseInt(row.offsetHeight)/2;
243
- if (row.offsetHeight == 0) {
244
- rowY = this.getPosition(row.firstChild).y;
245
- rowHeight = parseInt(row.firstChild.offsetHeight)/2;
246
- }
247
- // Because we always have to insert before, we need to offset the height a bit
248
- if ((y > rowY - rowHeight) && (y < (rowY + rowHeight))) {
249
- // that's the row we're over
250
- // If it's the same as the current row, ignore it
251
- if (row == draggedRow) {return null;}
252
- var config = jQuery.tableDnD.currentTable.tableDnDConfig;
253
- if (config.onAllowDrop) {
254
- if (config.onAllowDrop(draggedRow, row)) {
255
- return row;
256
- } else {
257
- return null;
258
- }
259
- } else {
260
- // If a row has nodrop class, then don't allow dropping (inspired by John Tarr and Famic)
261
- var nodrop = jQuery(row).hasClass("nodrop");
262
- if (! nodrop) {
263
- return row;
264
- } else {
265
- return null;
266
- }
267
- }
268
- return row;
269
- }
270
- }
271
- return null;
272
- },
273
-
274
- mouseup: function(e) {
275
- if (jQuery.tableDnD.currentTable && jQuery.tableDnD.dragObject) {
276
- var droppedRow = jQuery.tableDnD.dragObject;
277
- var config = jQuery.tableDnD.currentTable.tableDnDConfig;
278
- // If we have a dragObject, then we need to release it,
279
- // The row will already have been moved to the right place so we just reset stuff
280
- if (config.onDragClass) {
281
- jQuery(droppedRow).removeClass(config.onDragClass);
282
- } else {
283
- jQuery(droppedRow).css(config.onDropStyle);
284
- }
285
- jQuery.tableDnD.dragObject = null;
286
- if (config.onDrop) {
287
- // Call the onDrop method if there is one
288
- config.onDrop(jQuery.tableDnD.currentTable, droppedRow);
289
- }
290
- jQuery.tableDnD.currentTable = null; // let go of the table too
291
- }
292
- },
293
-
294
- serialize: function() {
295
- if (jQuery.tableDnD.currentTable) {
296
- var result = "";
297
- var tableId = jQuery.tableDnD.currentTable.id;
298
- var rows = jQuery.tableDnD.currentTable.rows;
299
- for (var i=0; i<rows.length; i++) {
300
- if (result.length > 0) result += "&";
301
- result += tableId + '[]=' + rows[i].id;
302
- }
303
- return result;
304
- } else {
305
- return "Error: No Table id set, you need to set an id on your table and every row";
306
- }
307
- }
308
- }
309
-
310
- jQuery.fn.extend(
311
- {
312
- tableDnD : jQuery.tableDnD.build
313
- }
314
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/{ml-slider-admin.css → metaslider-admin.css} RENAMED
@@ -1,4 +1,93 @@
1
- .ml-slider .unsaved {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  float: right;
3
  background: #ff3019; /* Old browsers */
4
  background: -moz-linear-gradient(top, #ff3019 0%, #cf0404 100%); /* FF3.6+ */
@@ -17,15 +106,22 @@
17
  text-rendering: optimizeLegibility;
18
  margin: 2px 10px;
19
  }
20
- .ml-slider tr.slide textarea {
 
 
 
21
  width: 100%;
22
  height: 75px;
 
23
  }
24
-
25
- .ml-slider tr.slide input {
 
 
 
26
  width: 100%;
27
  }
28
- .ml-slider .delete-slide {
29
  position: relative;
30
  top: 0px;
31
  left: 0px;
@@ -35,9 +131,13 @@
35
  height: 16px;
36
  float: left;
37
  text-align: center;
 
 
 
 
38
  }
39
 
40
- .ml-slider .slider-wrap {
41
  border-left: 1px solid #ccc;
42
  border-right: 1px solid #ccc;
43
  border-bottom: 1px solid #ccc;
@@ -45,7 +145,7 @@
45
  float: left;
46
  }
47
 
48
- .ml-slider .slider-lib {
49
  float: left;
50
  width: 23%;
51
  margin: 1%;
@@ -53,25 +153,27 @@
53
  text-align: center;
54
  }
55
 
56
- .ml-slider .tooltip {
57
- font-size: 0.8em;
58
  }
59
 
60
- .ml-slider .settings td {
61
  font-size: 0.9em;
 
 
 
62
  }
63
 
64
- .ml-slider .slider-lib label {
65
  color: white;
66
  border-radius: 10%;
67
- font-size: 0.8em;
68
  float: left;
69
  width: 100%;
70
  padding: 10px 0px;
71
  vertical-align: bottom;
72
  }
73
 
74
- .ml-slider .slider-lib.nivo label {
75
  background: #b6e026; /* Old browsers */
76
  background: -moz-linear-gradient(top, #b6e026 0%, #abdc28 100%); /* FF3.6+ */
77
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b6e026), color-stop(100%,#abdc28)); /* Chrome,Safari4+ */
@@ -81,7 +183,7 @@
81
  background: linear-gradient(to bottom, #b6e026 0%,#abdc28 100%); /* W3C */
82
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b6e026', endColorstr='#abdc28',GradientType=0 ); /* IE6-9 */
83
  }
84
- .ml-slider .slider-lib.flex label {
85
  background: #00b7ea; /* Old browsers */
86
  background: -moz-linear-gradient(top, #00b7ea 0%, #009ec3 100%); /* FF3.6+ */
87
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#00b7ea), color-stop(100%,#009ec3)); /* Chrome,Safari4+ */
@@ -92,7 +194,7 @@
92
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00b7ea', endColorstr='#009ec3',GradientType=0 ); /* IE6-9 */
93
  }
94
 
95
- .ml-slider .slider-lib.coin label {
96
  background: #ffd65e; /* Old browsers */
97
  background: -moz-linear-gradient(top, #ffd65e 0%, #febf04 100%); /* FF3.6+ */
98
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffd65e), color-stop(100%,#febf04)); /* Chrome,Safari4+ */
@@ -103,7 +205,7 @@
103
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffd65e', endColorstr='#febf04',GradientType=0 ); /* IE6-9 */
104
  }
105
 
106
- .ml-slider .slider-lib.responsive label {
107
  background: #959595; /* Old browsers */
108
  background: -moz-linear-gradient(top, #959595 0%, #0d0d0d 46%, #010101 50%, #0a0a0a 53%, #4e4e4e 76%, #383838 87%, #1b1b1b 100%); /* FF3.6+ */
109
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#959595), color-stop(46%,#0d0d0d), color-stop(50%,#010101), color-stop(53%,#0a0a0a), color-stop(76%,#4e4e4e), color-stop(87%,#383838), color-stop(100%,#1b1b1b)); /* Chrome,Safari4+ */
1
+ .msTipsy .tipsy-inner { color: white; background-color: #555; }
2
+ .msTipsy .tipsy-arrow-n { border-bottom-color: #555; }
3
+ .msTipsy .tipsy-arrow-s { border-top-color: #555; }
4
+ .msTipsy .tipsy-arrow-e { border-left-color: #555; }
5
+ .msTipsy .tipsy-arrow-w { border-right-color: #555; }
6
+
7
+ .metaslider .highlight {
8
+ background: #f1f1f1;
9
+ background-image: -webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9));
10
+ background-image: -webkit-linear-gradient(bottom, #ececec, #f9f9f9);
11
+ background-image: -moz-linear-gradient(bottom, #ececec, #f9f9f9);
12
+ background-image: -o-linear-gradient(bottom, #ececec, #f9f9f9);
13
+ background-image: linear-gradient(to top, #ececec, #f9f9f9);
14
+ }
15
+ .metaslider .ui-sortable-helper {
16
+ box-shadow: 3px 3px 5px #cccccc;
17
+ }
18
+ .metaslider tr.slide .new_window {
19
+ position: relative;
20
+ float: right;
21
+ font-size: 10px;
22
+ padding: 0px 3px;
23
+ color: #a9a9a9;
24
+ }
25
+ .metaslider tr.slide .new_window label {
26
+ position: absolute;
27
+ width: 78px;
28
+ right: 0;
29
+ top: -30px;
30
+ }
31
+ .metaslider tr.slide .new_window label input {
32
+ margin: 1px 0 0 4px;
33
+ margin-bottom: 0;
34
+ }
35
+ .metaslider .shortcode {
36
+ width: 100%;
37
+ margin-top: 20px;
38
+
39
+ }
40
+ .metaslider .shortcode input {
41
+ width: 100%;
42
+ font-size: 0.9em;
43
+ background: transparent;
44
+ border: 0;
45
+ }
46
+ .metaslider .shortcode td {
47
+ border-bottom: 0;
48
+ border-top: 0;
49
+ font-size: 0.9em;
50
+ }
51
+ .metaslider .nav-tab,
52
+ .metaslider h2.nav-tab-wrapper {
53
+ font-size: 13px;
54
+ }
55
+ .metaslider .nav-tab-active input {
56
+ padding: 0;
57
+ margin: 0;
58
+ border: 0;
59
+ width: 100px;
60
+ font-size: 13px;
61
+ }
62
+ .metaslider .left {
63
+ width: 68%;
64
+ margin-top: 20px;
65
+ float: left;
66
+ clear: none;
67
+ }
68
+ .metaslider .right {
69
+ width: 30%;
70
+ float: right;
71
+ margin-top: 20px;
72
+ clear: none;
73
+ }
74
+ .metaslider table.slides td {
75
+ border-bottom: 0;
76
+ border-top: 0;
77
+ background: #f9f9f9;
78
+ cursor: move;
79
+ padding: 5px 10px 5px 10px;
80
+ }
81
+ .metaslider table.slides td.col-1 {
82
+ padding: 10px 10px 0 10px;
83
+ }
84
+ .metaslider table.slides td.col-2 {
85
+ padding: 10px 10px 0 0;
86
+ }
87
+ .metaslider table.slides tr:last-child td {
88
+ padding-bottom: 10px;
89
+ }
90
+ .metaslider .unsaved {
91
  float: right;
92
  background: #ff3019; /* Old browsers */
93
  background: -moz-linear-gradient(top, #ff3019 0%, #cf0404 100%); /* FF3.6+ */
106
  text-rendering: optimizeLegibility;
107
  margin: 2px 10px;
108
  }
109
+ .metaslider tr.slide {
110
+ background-color: #f9f9f9;
111
+ }
112
+ .metaslider tr.slide textarea {
113
  width: 100%;
114
  height: 75px;
115
+ margin-bottom: 5px;
116
  }
117
+ .metaslider tr.slide input {
118
+ margin-bottom: 10px;
119
+ }
120
+ .metaslider tr.slide input.alt,
121
+ .metaslider tr.slide input.url {
122
  width: 100%;
123
  }
124
+ .metaslider .delete-slide {
125
  position: relative;
126
  top: 0px;
127
  left: 0px;
131
  height: 16px;
132
  float: left;
133
  text-align: center;
134
+ display: none;
135
+ }
136
+ .metaslider tr.slide td.col-1:hover .delete-slide {
137
+ display: block;
138
  }
139
 
140
+ .metaslider .slider-wrap {
141
  border-left: 1px solid #ccc;
142
  border-right: 1px solid #ccc;
143
  border-bottom: 1px solid #ccc;
145
  float: left;
146
  }
147
 
148
+ .metaslider .slider-lib {
149
  float: left;
150
  width: 23%;
151
  margin: 1%;
153
  text-align: center;
154
  }
155
 
156
+ .metaslider .tooltip {
157
+ font-size: 0.9em;
158
  }
159
 
160
+ .metaslider .settings td {
161
  font-size: 0.9em;
162
+ vertical-align: middle;
163
+ padding: 3px 0px 3px 6px;
164
+ border-bottom: 0;
165
  }
166
 
167
+ .metaslider .slider-lib label {
168
  color: white;
169
  border-radius: 10%;
 
170
  float: left;
171
  width: 100%;
172
  padding: 10px 0px;
173
  vertical-align: bottom;
174
  }
175
 
176
+ .metaslider .slider-lib.nivo label {
177
  background: #b6e026; /* Old browsers */
178
  background: -moz-linear-gradient(top, #b6e026 0%, #abdc28 100%); /* FF3.6+ */
179
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b6e026), color-stop(100%,#abdc28)); /* Chrome,Safari4+ */
183
  background: linear-gradient(to bottom, #b6e026 0%,#abdc28 100%); /* W3C */
184
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b6e026', endColorstr='#abdc28',GradientType=0 ); /* IE6-9 */
185
  }
186
+ .metaslider .slider-lib.flex label {
187
  background: #00b7ea; /* Old browsers */
188
  background: -moz-linear-gradient(top, #00b7ea 0%, #009ec3 100%); /* FF3.6+ */
189
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#00b7ea), color-stop(100%,#009ec3)); /* Chrome,Safari4+ */
194
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00b7ea', endColorstr='#009ec3',GradientType=0 ); /* IE6-9 */
195
  }
196
 
197
+ .metaslider .slider-lib.coin label {
198
  background: #ffd65e; /* Old browsers */
199
  background: -moz-linear-gradient(top, #ffd65e 0%, #febf04 100%); /* FF3.6+ */
200
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffd65e), color-stop(100%,#febf04)); /* Chrome,Safari4+ */
205
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffd65e', endColorstr='#febf04',GradientType=0 ); /* IE6-9 */
206
  }
207
 
208
+ .metaslider .slider-lib.responsive label {
209
  background: #959595; /* Old browsers */
210
  background: -moz-linear-gradient(top, #959595 0%, #0d0d0d 46%, #010101 50%, #0a0a0a 53%, #4e4e4e 76%, #383838 87%, #1b1b1b 100%); /* FF3.6+ */
211
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#959595), color-stop(46%,#0d0d0d), color-stop(50%,#010101), color-stop(53%,#0a0a0a), color-stop(76%,#4e4e4e), color-stop(87%,#383838), color-stop(100%,#1b1b1b)); /* Chrome,Safari4+ */
assets/{ml-slider-display.css → metaslider-display.css} RENAMED
@@ -1,23 +1,23 @@
1
- .ml-slider .flexslider,
2
- .ml-slider .flexslider ul,
3
- .ml-slider .flexslider .slides li,
4
- .ml-slider .flexslider .slides ul,
5
- .ml-slider .flexslider .slides ol,
6
- .ml-slider .flexslider .flex-direction-nav,
7
- .ml-slider .rslides li,
8
- .ml-slider .rslides .rslides_tabs {
9
  border: 0;
10
  margin: 0;
11
  list-style-type: none;
12
  }
13
- .ml-slider .flexslider .slides p {
14
  margin: 0;
15
  }
16
- .ml-slider .flexslider .flex-control-nav {
17
  position: inherit;
18
  bottom: auto;
19
  }
20
- .ml-slider .rslides_tabs {
21
  margin: 0;
22
  padding: 7px 0 !important;
23
  background: #333;
@@ -31,7 +31,7 @@
31
  text-align: center;
32
  width: 100%;
33
  }
34
- .ml-slider .rslides_tabs li {
35
  margin: 0;
36
  padding: 0;
37
  display: inline;
@@ -39,7 +39,7 @@
39
  margin-right: 1px;
40
  list-style-type: none;
41
  }
42
- .ml-slider .rslides_tabs a {
43
  text-decoration: none;
44
  width: auto;
45
  line-height: 20px;
@@ -48,23 +48,23 @@
48
  background: transparent;
49
  display: inline;
50
  }
51
- .ml-slider .rslides_tabs a:hover {
52
  border: 0;
53
  color: white;
54
  }
55
 
56
- .ml-slider .rslides_tabs li:first-child {
57
  margin-left: 0;
58
  }
59
- .ml-slider .rslides_tabs .rslides_here a {
60
  background: rgba(255,255,255,.1);
61
  color: #fff;
62
  font-weight: bold;
63
  }
64
- .ml-slider-responsive {
65
  position: relative;
66
  }
67
- .ml-slider .rslides_nav {
68
  background-color: #000000;
69
  color: #FFFFFF;
70
  padding: 0px 10px;
@@ -73,9 +73,9 @@
73
  z-index:9;
74
  cursor:pointer;
75
  }
76
- .ml-slider .rslides_nav.prev {
77
  left:0px;
78
  }
79
- .ml-slider .rslides_nav.next {
80
  right:0px;
81
  }
1
+ .metaslider .flexslider,
2
+ .metaslider .flexslider ul,
3
+ .metaslider .flexslider .slides li,
4
+ .metaslider .flexslider .slides ul,
5
+ .metaslider .flexslider .slides ol,
6
+ .metaslider .flexslider .flex-direction-nav,
7
+ .metaslider .rslides li,
8
+ .metaslider .rslides .rslides_tabs {
9
  border: 0;
10
  margin: 0;
11
  list-style-type: none;
12
  }
13
+ .metaslider .flexslider .slides p {
14
  margin: 0;
15
  }
16
+ .metaslider .flexslider .flex-control-nav {
17
  position: inherit;
18
  bottom: auto;
19
  }
20
+ .metaslider .rslides_tabs {
21
  margin: 0;
22
  padding: 7px 0 !important;
23
  background: #333;
31
  text-align: center;
32
  width: 100%;
33
  }
34
+ .metaslider .rslides_tabs li {
35
  margin: 0;
36
  padding: 0;
37
  display: inline;
39
  margin-right: 1px;
40
  list-style-type: none;
41
  }
42
+ .metaslider .rslides_tabs a {
43
  text-decoration: none;
44
  width: auto;
45
  line-height: 20px;
48
  background: transparent;
49
  display: inline;
50
  }
51
+ .metaslider .rslides_tabs a:hover {
52
  border: 0;
53
  color: white;
54
  }
55
 
56
+ .metaslider .rslides_tabs li:first-child {
57
  margin-left: 0;
58
  }
59
+ .metaslider .rslides_tabs .rslides_here a {
60
  background: rgba(255,255,255,.1);
61
  color: #fff;
62
  font-weight: bold;
63
  }
64
+ .metaslider-responsive {
65
  position: relative;
66
  }
67
+ .metaslider .rslides_nav {
68
  background-color: #000000;
69
  color: #FFFFFF;
70
  padding: 0px 10px;
73
  z-index:9;
74
  cursor:pointer;
75
  }
76
+ .metaslider .rslides_nav.prev {
77
  left:0px;
78
  }
79
+ .metaslider .rslides_nav.next {
80
  right:0px;
81
  }
assets/{ml-slider.js → metaslider.js} RENAMED
@@ -3,11 +3,12 @@
3
  */
4
  (function ($) {
5
  $(function () {
 
6
  /**
7
  * Reindex the slides after they have been dragged/dropped
8
  */
9
  var updateSlideOrder = function() {
10
- $('.ml-slider table.sortable tr').each(function() {
11
  $('input.menu_order', $(this)).val($(this).index());
12
  });
13
  }
@@ -16,8 +17,8 @@
16
  * Enable the correct options for this slider type
17
  */
18
  var enableOptions = function(slider) {
19
- $('.ml-slider .option:not(.' + slider + ')').attr('disabled', 'disabled').css('color','#ccc').parents('tr').hide();
20
- $('.ml-slider .option.' + slider).removeAttr('disabled').css('color','').parents('tr').show();
21
 
22
  if ($('.effect option:selected').attr('disabled') == 'disabled') {
23
  $('.effect option:enabled:first').attr('selected', 'selected');
@@ -27,34 +28,40 @@
27
  /**
28
  * Enable the correct options on page load
29
  */
30
- enableOptions($('.ml-slider .select-slider:checked').attr('rel'));
31
 
32
  /**
33
  * Handle slide libary switching
34
  */
35
- $('.ml-slider .select-slider').click(function() {
36
  enableOptions($(this).attr('rel'));
37
  });
38
 
39
- /**
40
- * Enable drag and drop table rows for slides
41
- */
42
- $(".ml-slider table.sortable").tableDnD({
43
- onDrop: function() {
44
- updateSlideOrder();
45
- $('.ml-slider .unsaved').fadeIn();
 
 
 
 
 
46
  }
47
  });
48
 
 
49
  $(".confirm").click(function() {
50
- return confirm("Are you sure?");
51
  });
52
 
53
  /**
54
  * Helptext tooltips
55
  */
56
- $(".ml-slider .tooltip").tipsy({html: true, fade: true, gravity: 'e'});
57
- $(".ml-slider .tooltiptop").tipsy({html: true, fade: true, gravity: 'se'});
58
 
59
  /**
60
  * Image uploader
@@ -98,21 +105,22 @@
98
  url = attachment.sizes.thumbnail.url;
99
  }
100
 
101
- var tableRow = "<tr class='slide'><td>" +
102
- "<div style='position: absolute'>" +
103
- "<a class='delete-slide remove-slide' href='#'>x</a> " +
 
 
 
 
104
  "</div>" +
105
- "<img src='" + url + "' width='150px'></td><td> " +
106
- "<textarea name='attachment[" + attachment.id + "][post_excerpt]' placeholder='Caption'>" + attachment.caption + "</textarea>" +
107
- "<input type='text' name='attachment[" + attachment.id + "][url]' placeholder='URL'>" +
108
- "<input type='hidden' class='menu_order' name='attachment[" + attachment.id + "][menu_order]' value='100'>" +
109
  "</td></tr>";
110
 
111
  // add slide to existing slides table
112
- jQuery(".ml-slider .slides tbody").append(tableRow);
113
 
114
  // display the unsaved changes warning
115
- $('.ml-slider .unsaved').show();
116
  });
117
 
118
  // the slides haven't been assigned to the slider yet, so just remove the row if the delete
@@ -125,20 +133,19 @@
125
  // reindex the slides
126
  updateSlideOrder();
127
 
128
- // ensure the rows are sortable
129
- $(".ml-slider table.sortable").tableDnD({
130
- onDrop: function() {
131
- updateSlideOrder()
132
- }
133
- });
134
  });
135
 
136
  file_frame.open();
137
  });
138
 
139
  // show the unsaved changes when the form is changed
140
- $('.ml-slider form').live('change', function() {
141
- $('.ml-slider .unsaved').fadeIn();
 
 
 
 
 
142
  });
143
  });
144
  }(jQuery));
3
  */
4
  (function ($) {
5
  $(function () {
6
+
7
  /**
8
  * Reindex the slides after they have been dragged/dropped
9
  */
10
  var updateSlideOrder = function() {
11
+ $('.metaslider table.sortable tr').each(function() {
12
  $('input.menu_order', $(this)).val($(this).index());
13
  });
14
  }
17
  * Enable the correct options for this slider type
18
  */
19
  var enableOptions = function(slider) {
20
+ $('.metaslider .option:not(.' + slider + ')').attr('disabled', 'disabled').css('color','#ccc').parents('tr').hide();
21
+ $('.metaslider .option.' + slider).removeAttr('disabled').css('color','').parents('tr').show();
22
 
23
  if ($('.effect option:selected').attr('disabled') == 'disabled') {
24
  $('.effect option:enabled:first').attr('selected', 'selected');
28
  /**
29
  * Enable the correct options on page load
30
  */
31
+ enableOptions($('.metaslider .select-slider:checked').attr('rel'));
32
 
33
  /**
34
  * Handle slide libary switching
35
  */
36
+ $('.metaslider .select-slider').click(function() {
37
  enableOptions($(this).attr('rel'));
38
  });
39
 
40
+ // Return a helper with preserved width of cells
41
+ var helper = function(e, ui) {
42
+ ui.children().each(function() {
43
+ $(this).width($(this).width());
44
+ });
45
+ return ui;
46
+ };
47
+
48
+ $(".metaslider table.sortable tbody").sortable({
49
+ helper: helper,
50
+ stop: function() {
51
+ updateSlideOrder()
52
  }
53
  });
54
 
55
+
56
  $(".confirm").click(function() {
57
+ return confirm(metaslider.confirm);
58
  });
59
 
60
  /**
61
  * Helptext tooltips
62
  */
63
+ $(".metaslider .tooltip").tipsy({className: 'msTipsy', live: true, delayIn: 200, html: true, fade: true, gravity: 'e'});
64
+ $(".metaslider .tooltiptop").tipsy({live: true, delayIn: 500, html: true, fade: true, gravity: 'se'});
65
 
66
  /**
67
  * Image uploader
105
  url = attachment.sizes.thumbnail.url;
106
  }
107
 
108
+ var tableRow = "<tr class='slide'><td class='col-1'>" +
109
+ "<div style='position: absolute'><a class='delete-slide remove-slide' href='#'>x</a></div>" +
110
+ "<img src='" + url + "' width='150px'></td>" +
111
+ "<td class='col-2'><textarea name='attachment[" + attachment.id + "][post_excerpt]' placeholder='" + metaslider.caption + "'>" + attachment.caption + "</textarea>" +
112
+ "<input class='url' type='text' name='attachment[" + attachment.id + "][url]' placeholder='" + metaslider.url + "' value=''>" +
113
+ "<div class='new_window'>" +
114
+ "<label>" + metaslider.new_window + "<input type='checkbox' name='attachment[" + attachment.id + "][new_window]'></label>" +
115
  "</div>" +
116
+ "<input type='hidden' class='menu_order' name='attachment[" + attachment.id + "][menu_order]'>" +
 
 
 
117
  "</td></tr>";
118
 
119
  // add slide to existing slides table
120
+ jQuery(".metaslider .slides tbody").append(tableRow);
121
 
122
  // display the unsaved changes warning
123
+ $('.metaslider .unsaved').show();
124
  });
125
 
126
  // the slides haven't been assigned to the slider yet, so just remove the row if the delete
133
  // reindex the slides
134
  updateSlideOrder();
135
 
 
 
 
 
 
 
136
  });
137
 
138
  file_frame.open();
139
  });
140
 
141
  // show the unsaved changes when the form is changed
142
+ $('.metaslider form').live('change', function() {
143
+ $('.metaslider .unsaved').fadeIn();
144
+ });
145
+
146
+ $(".metaslider .shortcode input").click(function(){
147
+ // Select input field contents
148
+ this.select();
149
  });
150
  });
151
  }(jQuery));
inc/metaslider.class.php ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+ class MetaSlider {
6
+
7
+ public $id = 0; // slider ID
8
+ public $identifier = 0; // unique identifier
9
+ public $slides = array(); //slides belonging to this slider
10
+ public $settings = array(); // slider settings
11
+
12
+ /**
13
+ * Constructor
14
+ */
15
+ public function __construct($id) {
16
+ $this->id = $id;
17
+ $this->slides = $this->get_slides();
18
+ $this->settings = $this->get_settings();
19
+ $this->identifier = 'metaslider_' . rand();
20
+ }
21
+
22
+ /**
23
+ * Return the unique identifier for the slider (used to avoid javascript conflicts)
24
+ */
25
+ protected function get_identifier() {
26
+ return $this->identifier;
27
+ }
28
+
29
+ /**
30
+ * Return slides for the current slider
31
+ *
32
+ * @return array collection of slides belonging to the current slider
33
+ */
34
+ protected function get_slides() {
35
+ $slides = array();
36
+
37
+ $args = array(
38
+ 'orderby' => $this->get_setting('random') == 'true' && !is_admin() ? 'rand' : 'menu_order',
39
+ 'order' => 'ASC',
40
+ 'post_type' => 'attachment',
41
+ 'post_status' => 'inherit',
42
+ 'posts_per_page' => -1,
43
+ 'tax_query' => array(
44
+ array(
45
+ 'taxonomy' => 'ml-slider',
46
+ 'field' => 'slug',
47
+ 'terms' => $this->id
48
+ )
49
+ )
50
+ );
51
+
52
+ $query = new WP_Query($args);
53
+
54
+ while ($query->have_posts()) {
55
+ $query->next_post();
56
+
57
+ $slide_src = wp_get_attachment_image_src($query->post->ID, 'ml-slider-slide'); // returns an array
58
+ $slide_thumb = wp_get_attachment_image_src($query->post->ID); // returns an array
59
+
60
+ $slides[] = array(
61
+ 'id' => $query->post->ID,
62
+ 'type' => 'image',
63
+ 'url' => get_post_meta($query->post->ID, 'ml-slider_url', true),
64
+ 'caption' => htmlentities($query->post->post_excerpt, ENT_QUOTES, 'UTF-8'),
65
+ 'src' => $slide_src[0],
66
+ 'thumb' => $slide_thumb[0],
67
+ 'menu_order' => $query->post->menu_order,
68
+ 'target' => get_post_meta($query->post->ID, 'ml-slider_new_window', true) ? '_blank' : '_self',
69
+ 'alt' => get_post_meta($query->post->ID, '_wp_attachment_image_alt', true)
70
+ );
71
+ }
72
+
73
+ return $slides;
74
+ }
75
+
76
+ /**
77
+ * Get settings for the current slider
78
+ *
79
+ * @return array slider settings
80
+ */
81
+ private function get_settings() {
82
+ return get_post_meta($this->id, 'ml-slider_settings', true);
83
+ }
84
+
85
+ /**
86
+ * Return an individual setting
87
+ *
88
+ * @param string $name Name of the setting
89
+ * @return string | bool setting value or fase
90
+ */
91
+ public function get_setting($name) {
92
+ return isset($this->settings[$name]) && strlen($this->settings[$name]) > 0 ? $this->settings[$name] : "false";
93
+ }
94
+
95
+ /**
96
+ * Get the slider libary parameters. This function is overridden by sub classes.
97
+ *
98
+ * @return string javascript options
99
+ */
100
+ public function get_default_parameters() {
101
+ $params = array(
102
+ 'type' => 'nivo',
103
+ 'random' => false,
104
+ 'cssClass' => '',
105
+ 'printCss' => true,
106
+ 'printJs' => true,
107
+ 'width' => 565,
108
+ 'height' => 290,
109
+ 'spw' => 7,
110
+ 'sph' => 5,
111
+ 'delay' => 3000,
112
+ 'sDelay' => 30,
113
+ 'opacity' => 0.7,
114
+ 'titleSpeed' => 500,
115
+ 'effect' => 'random',
116
+ 'navigation' => true,
117
+ 'links' => true,
118
+ 'hoverPause' => true,
119
+ 'theme' => 'default',
120
+ 'direction' => 'horizontal',
121
+ 'reverse' => false,
122
+ 'animationSpeed' => 600,
123
+ 'prevText' => 'Previous',
124
+ 'nextText' => 'Next',
125
+ 'slices' => 15
126
+ );
127
+
128
+ return $params;
129
+ }
130
+
131
+ /**
132
+ *
133
+ */
134
+ private function get_javascript_parameters() {
135
+ $options = array();
136
+
137
+ foreach ($this->get_default_parameters() as $name => $default) {
138
+ if ($param = $this->get_param($name)) {
139
+ $val = $this->get_setting($name);
140
+
141
+ if (gettype($default) == 'string') {
142
+ $options[] = $param . ": '" . $val . "'";
143
+ } else {
144
+ $options[] = $param . ": " . $val;
145
+ }
146
+ }
147
+ }
148
+
149
+ return implode(",\n ", $options);
150
+ }
151
+
152
+ /**
153
+ * Return the Javascript to kick off the slider. Code is wrapped in a timer
154
+ * to allow for themes that load jQuery at the bottom of the page.
155
+ *
156
+ * @return string javascript
157
+ */
158
+ public function get_javascript() {
159
+ $identifier = $this->identifier;
160
+
161
+ $return_value = "\n<script type='text/javascript'>";
162
+ $return_value .= "\n var " . $identifier . " = function($) {";
163
+ $return_value .= "\n $('#" . $identifier . "')." . $this->js_function . "({ ";
164
+ $return_value .= "\n " . $this->get_javascript_parameters();
165
+ $return_value .= "\n });";
166
+ $return_value .= "\n };";
167
+ $return_value .= "\n var timer_" . $identifier . " = function() {";
168
+ $return_value .= "\n if (window.jQuery && jQuery.isReady) {";
169
+ $return_value .= "\n " . $identifier . "(window.jQuery);";
170
+ $return_value .= "\n } else {";
171
+ $return_value .= "\n window.setTimeout(timer_" . $identifier . ", 100);";
172
+ $return_value .= "\n }";
173
+ $return_value .= "\n };";
174
+ $return_value .= "\n timer_" . $identifier . "();";
175
+ $return_value .= "\n</script>";
176
+
177
+ return $return_value;
178
+ }
179
+
180
+ /**
181
+ * Output the HTML and Javascript for this slider
182
+ */
183
+ public function output() {
184
+ $class = "metaslider metaslider-{$this->get_setting('type')} metaslider-{$this->id} ml-slider";
185
+
186
+ if ($this->get_setting('cssClass') != 'false') {
187
+ $class .= " " . $this->get_setting('cssClass');
188
+ }
189
+
190
+ return "<div style='max-width: {$this->get_setting('width')}px;' class='{$class}'>" .
191
+ $this->get_html() .
192
+ "</div>" .
193
+ $this->get_javascript();
194
+ }
195
+
196
+ /**
197
+ * Include slider assets
198
+ */
199
+ public function enqueue_scripts() {
200
+ if ($this->get_setting('printJs') == 'true') {
201
+ wp_enqueue_script('metaslider_' . $this->get_setting('type') . '_slider', METASLIDER_ASSETS_URL . $this->get_js_path(), array('jquery'), METASLIDER_VERSION);
202
+ }
203
+
204
+ if ($this->get_setting('printCss') == 'true') {
205
+ wp_enqueue_style('metaslider_display_css', METASLIDER_ASSETS_URL . 'metaslider-display.css');
206
+ wp_enqueue_style('metaslider_' . $this->get_setting('type') . '_slider_css', METASLIDER_ASSETS_URL . $this->get_css_path());
207
+ }
208
+ }
209
+ }
210
+ ?>
inc/metaslider.coin.class.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ *
4
+ */
5
+ class MetaCoinSlider extends MetaSlider {
6
+
7
+ protected $js_function = 'coinslider';
8
+
9
+ /**
10
+ * Constructor
11
+ */
12
+ public function __construct($id) {
13
+ parent::__construct($id);
14
+ }
15
+
16
+ /**
17
+ * Return the file path to the Javascript for this slider
18
+ */
19
+ public function get_js_path() {
20
+ return 'coinslider/coin-slider.min.js';
21
+ }
22
+
23
+ /**
24
+ * Return the file path to the CSS for this slider
25
+ */
26
+ public function get_css_path() {
27
+ return 'coinslider/coin-slider-styles.css';
28
+ }
29
+
30
+ /**
31
+ * Enable the parameters that are accepted by the slider
32
+ *
33
+ * @return array enabled parameters
34
+ */
35
+ protected function get_param($param) {
36
+ $params = array(
37
+ 'effect' => 'animation',
38
+ 'width' => 'width',
39
+ 'height' => 'height',
40
+ 'sph' => 'sph',
41
+ 'spw' => 'spw',
42
+ 'delay' => 'delay',
43
+ 'sDelay' => 'sDelay',
44
+ 'opacity' => 'opacity',
45
+ 'titleSpeed' => 'titleSpeed',
46
+ 'hoverPause' => 'hoverPause',
47
+ 'navigation' => 'navigation'
48
+ );
49
+
50
+ if (isset($params[$param])) {
51
+ return $params[$param];
52
+ }
53
+
54
+ return false;
55
+ }
56
+
57
+ /**
58
+ * Build the HTML for a slider.
59
+ *
60
+ * @return string slider markup.
61
+ */
62
+ protected function get_html() {
63
+ $retVal = "<div id='" . $this->get_identifier() . "' class='coin-slider'>";
64
+
65
+ foreach ($this->get_slides() as $slide) {
66
+ $url = strlen($slide['url']) ? $slide['url'] : "javascript:void(0)"; // coinslider always wants a URL
67
+ $retVal .= "<a href='{$url}'>";
68
+ $retVal .= "<img src='{$slide['src']}' alt='{$slide['alt']}' target='{$slide['target']}'>";
69
+ $retVal .= "<span>{$slide['caption']}</span>";
70
+ $retVal .= "</a>";
71
+ }
72
+
73
+ $retVal .= "</div>";
74
+
75
+ return $retVal;
76
+ }
77
+ }
78
+ ?>
inc/metaslider.flex.class.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ *
4
+ */
5
+ class MetaFlexSlider extends MetaSlider {
6
+
7
+ protected $js_function = 'flexslider';
8
+
9
+ /**
10
+ * Constructor
11
+ */
12
+ public function __construct($id) {
13
+ parent::__construct($id);
14
+ }
15
+
16
+ /**
17
+ * Return the file path to the Javascript for this slider
18
+ */
19
+ public function get_js_path() {
20
+ return 'flexslider/jquery.flexslider-min.js';
21
+ }
22
+
23
+ /**
24
+ * Return the css path to the Javascript for this slider
25
+ */
26
+ public function get_css_path() {
27
+ return 'flexslider/flexslider.css';
28
+ }
29
+
30
+ /**
31
+ * Enable the parameters that are accepted by the slider
32
+ *
33
+ * @return array enabled parameters
34
+ */
35
+ protected function get_param($param) {
36
+ $params = array(
37
+ 'effect' => 'animation',
38
+ 'direction' => 'direction',
39
+ 'prevText' => 'prevText',
40
+ 'nextText' => 'nextText',
41
+ 'delay' => 'slideshowSpeed',
42
+ 'animationSpeed' => 'animationSpeed',
43
+ 'hoverPause' => 'pauseOnHover',
44
+ 'reverse' => 'reverse',
45
+ 'navigation' => 'controlNav',
46
+ 'links' =>'directionNav'
47
+ );
48
+
49
+ if (isset($params[$param])) {
50
+ return $params[$param];
51
+ }
52
+
53
+ return false;
54
+ }
55
+
56
+ /**
57
+ * Build the HTML for a slider.
58
+ *
59
+ * @return string slider markup.
60
+ */
61
+ protected function get_html() {
62
+ $return_value = "<div id='" . $this->get_identifier() . "' class='flexslider'><ul class='slides'>";
63
+
64
+ foreach ($this->get_slides() as $slide) {
65
+ $return_value .= "<li>";
66
+ if (strlen($slide['url'])) $return_value .= "<a href='{$slide['url']}' target='{$slide['target']}'>";
67
+ $return_value .= "<img src='{$slide['src']}' alt='{$slide['alt']}'>";
68
+ if (strlen($slide['caption'])) $return_value .= "<p class='flex-caption'>{$slide['caption']}</p>";
69
+ if (strlen($slide['url'])) $return_value .= "</a>";
70
+ $return_value .= "</li>";
71
+ }
72
+
73
+ $return_value .= "</ul></div>";
74
+
75
+ return $return_value;
76
+ }
77
+ }
78
+ ?>
inc/metaslider.nivo.class.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ *
4
+ */
5
+ class MetaNivoSlider extends MetaSlider {
6
+
7
+ protected $js_function = 'nivoSlider';
8
+
9
+ /**
10
+ * Constructor
11
+ */
12
+ public function __construct($id) {
13
+ parent::__construct($id);
14
+ }
15
+
16
+ /**
17
+ * Return the file path to the Javascript for this slider
18
+ */
19
+ public function get_js_path() {
20
+ return 'nivoslider/jquery.nivo.slider.pack.js';
21
+ }
22
+
23
+ /**
24
+ * Return the file path to the CSS for this slider
25
+ */
26
+ public function get_css_path() {
27
+ return 'nivoslider/nivo-slider.css';
28
+ }
29
+
30
+ /**
31
+ * Detect whether thie slide supports the requested setting,
32
+ * and if so, the name to use for the setting in the Javascript parameters
33
+ *
34
+ * @return false (parameter not supported) or parameter name (parameter supported)
35
+ */
36
+ protected function get_param($param) {
37
+ $params = array(
38
+ 'effect' => 'effect',
39
+ 'slices' => 'slices',
40
+ 'prevText' => 'prevText',
41
+ 'nextText' => 'nextText',
42
+ 'delay' => 'pauseTime',
43
+ 'animationSpeed' => 'animSpeed',
44
+ 'hoverPause' => 'pauseOnHover',
45
+ 'spw' => 'boxCols',
46
+ 'sph' => 'boxRows',
47
+ 'navigation' => 'controlNav',
48
+ 'links' =>'directionNav'
49
+ );
50
+
51
+ if (isset($params[$param])) {
52
+ return $params[$param];
53
+ }
54
+
55
+ return false;
56
+ }
57
+
58
+ /**
59
+ * Include slider assets
60
+ */
61
+ public function enqueue_scripts() {
62
+ parent::enqueue_scripts();
63
+
64
+ // include the theme
65
+ if ($this->get_setting('printCss') == 'true') {
66
+ $theme = $this->get_setting('theme');
67
+ wp_enqueue_style('ml-slider_nivo_slider_theme_' . $theme, METASLIDER_ASSETS_URL . "nivoslider/themes/{$theme}/{$theme}.css");
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Build the HTML for a slider.
73
+ *
74
+ * @return string slider markup.
75
+ */
76
+ protected function get_html() {
77
+ $retVal = "<div class='slider-wrapper theme-{$this->get_setting('theme')}'>";
78
+ $retVal .= "<div class='ribbon'></div>";
79
+ $retVal .= "<div id='" . $this->get_identifier() . "' class='nivoSlider'>";
80
+
81
+ foreach ($this->get_slides() as $slide) {
82
+ if (strlen($slide['url'])) $retVal .= "<a href='{$slide['url']}' target='{$slide['target']}'>";
83
+ $retVal .= "<img src='{$slide['src']}' title='{$slide['caption']}' alt='{$slide['alt']}'>";
84
+ if (strlen($slide['url'])) $retVal .= "</a>";
85
+ }
86
+
87
+ $retVal .= "</div></div>";
88
+
89
+ return $retVal;
90
+ }
91
+ }
92
+ ?>
inc/metaslider.responsive.class.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ *
4
+ */
5
+ class MetaResponsiveSlider extends MetaSlider {
6
+
7
+ public $js_function = 'responsiveSlides';
8
+
9
+ /**
10
+ * Constructor
11
+ */
12
+ public function __construct($id) {
13
+ parent::__construct($id);
14
+ }
15
+
16
+ /**
17
+ * Return the file path to the Javascript for this slider
18
+ */
19
+ public function get_js_path() {
20
+ return 'responsiveslides/responsiveslides.min.js';
21
+ }
22
+
23
+ /**
24
+ * Return the file path to the CSS for this slider
25
+ */
26
+ public function get_css_path() {
27
+ return 'responsiveslides/responsiveslides.css';
28
+ }
29
+
30
+ /**
31
+ * Detect whether thie slide supports the requested setting,
32
+ * and if so, the name to use for the setting in the Javascript parameters
33
+ *
34
+ * @return false (parameter not supported) or parameter name (parameter supported)
35
+ */
36
+ protected function get_param($param) {
37
+ $params = array(
38
+ 'prevText' => 'prevText',
39
+ 'nextText' => 'nextText',
40
+ 'delay' => 'timeout',
41
+ 'animationSpeed' => 'speed',
42
+ 'hoverPause' => 'pause',
43
+ 'navigation' => 'pager',
44
+ 'links' =>'nav'
45
+ );
46
+
47
+ if (isset($params[$param])) {
48
+ return $params[$param];
49
+ }
50
+
51
+ return false;
52
+ }
53
+
54
+ /**
55
+ * Build the HTML for a slider.
56
+ *
57
+ * @return string slider markup.
58
+ */
59
+ protected function get_html() {
60
+ $return_value = "<ul id='" . $this->get_identifier() . "' class='rslides'>";
61
+
62
+ foreach ($this->get_slides() as $slide) {
63
+ $return_value .= "<li>";
64
+ if (strlen($slide['url'])) $return_value .= "<a href='{$slide['url']}' target='{$slide['target']}'>";
65
+ $return_value .= "<img src='{$slide['src']}' alt='{$slide['alt']}'>";
66
+ if (strlen($slide['url'])) $return_value .= "</a>";
67
+ $return_value .= "</li>";
68
+ }
69
+
70
+ $return_value .= "</ul>";
71
+
72
+ return $return_value;
73
+ }
74
+ }
75
+ ?>
languages/default.mo ADDED
Binary file
languages/default.po ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: metaslider\n"
4
+ "POT-Creation-Date: 2013-02-28 14:38-0000\n"
5
+ "PO-Revision-Date: 2013-02-28 14:39-0000\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: Matcha Labs <hello@matchalabs.com>\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.5\n"
12
+ "X-Poedit-KeywordsList: _e;__\n"
13
+ "X-Poedit-Basepath: ../\n"
14
+ "X-Poedit-SearchPath-0: .\n"
15
+ "X-Poedit-SearchPath-1: ..\n"
16
+
17
+ #: metaslider.php:65 metaslider.php:494 ../ml-slider/metaslider.php:65
18
+ #: ../ml-slider/metaslider.php:494
19
+ msgid "URL"
20
+ msgstr ""
21
+
22
+ #: metaslider.php:66 metaslider.php:492 ../ml-slider/metaslider.php:66
23
+ #: ../ml-slider/metaslider.php:492
24
+ msgid "Caption"
25
+ msgstr ""
26
+
27
+ #: metaslider.php:67 metaslider.php:493 ../ml-slider/metaslider.php:67
28
+ #: ../ml-slider/metaslider.php:493
29
+ msgid "New Window"
30
+ msgstr ""
31
+
32
+ #: metaslider.php:68 ../ml-slider/metaslider.php:68
33
+ msgid "Are you sure?"
34
+ msgstr ""
35
+
36
+ #: metaslider.php:95 metaslider.php:115 ../ml-slider/metaslider.php:95
37
+ #: ../ml-slider/metaslider.php:115
38
+ msgid "Slider"
39
+ msgstr ""
40
+
41
+ #: metaslider.php:483 ../ml-slider/metaslider.php:483
42
+ msgid "Slides"
43
+ msgstr ""
44
+
45
+ #: metaslider.php:484 ../ml-slider/metaslider.php:484
46
+ msgid "Add Slide"
47
+ msgstr ""
48
+
49
+ #: metaslider.php:484 ../ml-slider/metaslider.php:484
50
+ msgid "Select Slide"
51
+ msgstr ""
52
+
53
+ #: metaslider.php:484 ../ml-slider/metaslider.php:484
54
+ msgid "Add to slider"
55
+ msgstr ""
56
+
57
+ #: metaslider.php:519 ../ml-slider/metaslider.php:519
58
+ msgid "Configuration"
59
+ msgstr ""
60
+
61
+ #: metaslider.php:521 ../ml-slider/metaslider.php:521
62
+ msgid "Save"
63
+ msgstr ""
64
+
65
+ #: metaslider.php:522 ../ml-slider/metaslider.php:522
66
+ msgid "Unsaved Changes"
67
+ msgstr ""
68
+
69
+ #: metaslider.php:548 ../ml-slider/metaslider.php:548
70
+ msgid "Set the initial size for the slides (width x height)"
71
+ msgstr ""
72
+
73
+ #: metaslider.php:549 ../ml-slider/metaslider.php:549
74
+ msgid "Size"
75
+ msgstr ""
76
+
77
+ #: metaslider.php:557 ../ml-slider/metaslider.php:557
78
+ msgid "Slide transition effect"
79
+ msgstr ""
80
+
81
+ #: metaslider.php:558 ../ml-slider/metaslider.php:558
82
+ msgid "Effect"
83
+ msgstr ""
84
+
85
+ #: metaslider.php:584 ../ml-slider/metaslider.php:584
86
+ msgid "Change the slider style"
87
+ msgstr ""
88
+
89
+ #: metaslider.php:585 ../ml-slider/metaslider.php:585
90
+ msgid "Theme"
91
+ msgstr ""
92
+
93
+ #: metaslider.php:597 ../ml-slider/metaslider.php:597
94
+ msgid "Show slide navigation row"
95
+ msgstr ""
96
+
97
+ #: metaslider.php:598 ../ml-slider/metaslider.php:598
98
+ msgid "Show Navigation"
99
+ msgstr ""
100
+
101
+ #: metaslider.php:605 ../ml-slider/metaslider.php:605
102
+ msgid "Show previous and next links"
103
+ msgstr ""
104
+
105
+ #: metaslider.php:606 ../ml-slider/metaslider.php:606
106
+ msgid "Show Links"
107
+ msgstr ""
108
+
109
+ #: metaslider.php:613 ../ml-slider/metaslider.php:613
110
+ msgid ""
111
+ "Pause the slideshow when hovering over slider, then resume when no longer "
112
+ "hovering"
113
+ msgstr ""
114
+
115
+ #: metaslider.php:614 ../ml-slider/metaslider.php:614
116
+ msgid "Hover pause"
117
+ msgstr ""
118
+
119
+ #: metaslider.php:621 ../ml-slider/metaslider.php:621
120
+ msgid "How long to display each slide, in milliseconds"
121
+ msgstr ""
122
+
123
+ #: metaslider.php:622 ../ml-slider/metaslider.php:622
124
+ msgid "Slide delay"
125
+ msgstr ""
126
+
127
+ #: metaslider.php:629 ../ml-slider/metaslider.php:629
128
+ msgid "Randomise the order of the slides"
129
+ msgstr ""
130
+
131
+ #: metaslider.php:630 ../ml-slider/metaslider.php:630
132
+ msgid "Random"
133
+ msgstr ""
134
+
135
+ #: metaslider.php:637 ../ml-slider/metaslider.php:637
136
+ msgid "Select the sliding direction"
137
+ msgstr ""
138
+
139
+ #: metaslider.php:637 ../ml-slider/metaslider.php:637
140
+ msgid "Direction"
141
+ msgstr ""
142
+
143
+ #: metaslider.php:646 ../ml-slider/metaslider.php:646
144
+ msgid "Set the text for the 'previous' direction item"
145
+ msgstr ""
146
+
147
+ #: metaslider.php:647 ../ml-slider/metaslider.php:647
148
+ msgid "Previous text"
149
+ msgstr ""
150
+
151
+ #: metaslider.php:654 ../ml-slider/metaslider.php:654
152
+ msgid "Set the text for the 'next' direction item"
153
+ msgstr ""
154
+
155
+ #: metaslider.php:655 ../ml-slider/metaslider.php:655
156
+ msgid "Next text"
157
+ msgstr ""
158
+
159
+ #: metaslider.php:662 ../ml-slider/metaslider.php:662
160
+ msgid "Advanced Settings"
161
+ msgstr ""
162
+
163
+ #: metaslider.php:665 ../ml-slider/metaslider.php:665
164
+ msgid "Reverse the animation direction"
165
+ msgstr ""
166
+
167
+ #: metaslider.php:666 ../ml-slider/metaslider.php:666
168
+ msgid "Reverse"
169
+ msgstr ""
170
+
171
+ #: metaslider.php:673 ../ml-slider/metaslider.php:673
172
+ msgid "Number of squares (width x height)"
173
+ msgstr ""
174
+
175
+ #: metaslider.php:674 ../ml-slider/metaslider.php:674
176
+ msgid "Number of squares"
177
+ msgstr ""
178
+
179
+ #: metaslider.php:682 metaslider.php:683 ../ml-slider/metaslider.php:682
180
+ #: ../ml-slider/metaslider.php:683
181
+ msgid "Number of slices"
182
+ msgstr ""
183
+
184
+ #: metaslider.php:690 ../ml-slider/metaslider.php:690
185
+ msgid "Delay beetwen squares in ms"
186
+ msgstr ""
187
+
188
+ #: metaslider.php:691 ../ml-slider/metaslider.php:691
189
+ msgid "Square delay"
190
+ msgstr ""
191
+
192
+ #: metaslider.php:698 ../ml-slider/metaslider.php:698
193
+ msgid "Opacity of title and navigation"
194
+ msgstr ""
195
+
196
+ #: metaslider.php:699 ../ml-slider/metaslider.php:699
197
+ msgid "Opacity"
198
+ msgstr ""
199
+
200
+ #: metaslider.php:706 ../ml-slider/metaslider.php:706
201
+ msgid "Set the fade in speef of the caption"
202
+ msgstr ""
203
+
204
+ #: metaslider.php:707 ../ml-slider/metaslider.php:707
205
+ msgid "Caption speed"
206
+ msgstr ""
207
+
208
+ #: metaslider.php:714 ../ml-slider/metaslider.php:714
209
+ msgid "Set the speed of animations, in milliseconds"
210
+ msgstr ""
211
+
212
+ #: metaslider.php:715 ../ml-slider/metaslider.php:715
213
+ msgid "Animation speed"
214
+ msgstr ""
215
+
216
+ #: metaslider.php:722 ../ml-slider/metaslider.php:722
217
+ msgid "Developer Options"
218
+ msgstr ""
219
+
220
+ #: metaslider.php:725 ../ml-slider/metaslider.php:725
221
+ msgid ""
222
+ "Specify any custom CSS Classes you would like to be added to the slider "
223
+ "wrapper"
224
+ msgstr ""
225
+
226
+ #: metaslider.php:726 ../ml-slider/metaslider.php:726
227
+ msgid "CSS classes"
228
+ msgstr ""
229
+
230
+ #: metaslider.php:733 ../ml-slider/metaslider.php:733
231
+ msgid "Uncheck this is you would like to include your own CSS"
232
+ msgstr ""
233
+
234
+ #: metaslider.php:734 ../ml-slider/metaslider.php:734
235
+ msgid "Print CSS"
236
+ msgstr ""
237
+
238
+ #: metaslider.php:741 ../ml-slider/metaslider.php:741
239
+ msgid "Uncheck this is you would like to include your own Javascript"
240
+ msgstr ""
241
+
242
+ #: metaslider.php:742 ../ml-slider/metaslider.php:742
243
+ msgid "Print JS"
244
+ msgstr ""
245
+
246
+ #: metaslider.php:754 ../ml-slider/metaslider.php:754
247
+ msgid "Usage"
248
+ msgstr ""
249
+
250
+ #: metaslider.php:760 ../ml-slider/metaslider.php:760
251
+ msgid "Shortcode"
252
+ msgstr ""
253
+
254
+ #: metaslider.php:766 ../ml-slider/metaslider.php:766
255
+ msgid "Template Include"
256
+ msgstr ""
257
+
258
+ #: metaslider.php:776 ../ml-slider/metaslider.php:776
259
+ msgid "Delete Slider"
260
+ msgstr ""
261
+
262
+ #: ../ml-post-slider/ml-post-slider.php:71
263
+ msgid "Title"
264
+ msgstr ""
265
+
266
+ #: ../ml-post-slider/ml-post-slider.php:72
267
+ msgid "Slider category"
268
+ msgstr ""
269
+
270
+ #: ../ml-post-slider/ml-post-slider.php:73
271
+ msgid "Date"
272
+ msgstr ""
ml-slider.php CHANGED
@@ -1,34 +1,34 @@
1
  <?php
2
  /*
3
- * Plugin Name: ML Slider
4
- * Plugin URI: http://www.ml-slider.com
5
  * Description: 4 sliders in 1! Choose from Nivo Slider, Flex Slider, Coin Slider or Responsive Slides.
6
- * Version: 1.2.1
7
  * Author: Matcha Labs
8
  * Author URI: http://www.matchalabs.com
9
- * License: GPL
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
- define( 'MLSLIDER_VERSION', '1.2.1' );
18
- define( 'MLSLIDER_BASE_URL', plugin_dir_url( __FILE__ ) );
19
- define( 'MLSLIDER_ASSETS_URL', MLSLIDER_BASE_URL . 'assets/' );
 
 
20
 
21
- class MLSlider {
 
 
 
 
22
 
23
- var $slider = 0;
24
- var $slides = array();
25
- var $settings = array();
26
 
27
- /**
28
- * /////////////////////////////////////////////////////////////////
29
- * Plugin Registration
30
- * /////////////////////////////////////////////////////////////////
31
- */
32
 
33
  /**
34
  * Constructor
@@ -36,19 +36,20 @@ class MLSlider {
36
  public function __construct() {
37
  add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
38
  add_action('admin_menu', array($this, 'register_admin_menu'), 10001);
39
- add_action('admin_menu', array($this, 'admin_process'), 10002);
40
  add_action('init', array($this, 'register_post_type' ));
41
  add_action('init', array($this, 'register_taxonomy' ));
42
  add_action('admin_print_styles', array( $this, 'register_admin_styles'));
43
- add_shortcode('ml-slider', array($this, 'register_shortcode'));
 
 
44
  }
45
 
46
  /**
47
  * Registers and enqueues admin-specific styles.
48
  */
49
  public function register_admin_styles() {
50
- wp_enqueue_style('ml-slider-tipsy-styles', plugins_url('ml-slider/assets/tipsy/tipsy.css'));
51
- wp_enqueue_style('ml-slider-admin-styles', plugins_url('ml-slider/assets/ml-slider-admin.css'));
52
  }
53
 
54
  /**
@@ -56,26 +57,32 @@ class MLSlider {
56
  */
57
  public function register_admin_scripts() {
58
  wp_enqueue_media();
59
- wp_enqueue_script('ml-slider-tipsy', plugins_url('ml-slider/assets/tipsy/jquery.tipsy.js'), array('jquery'));
60
- wp_enqueue_script('jquery-tablednd', plugins_url('ml-slider/assets/jquery.tablednd.js'), array('jquery'));
61
- wp_enqueue_script('ml-slider-admin-script', plugins_url('ml-slider/assets/ml-slider.js'), array('jquery', 'ml-slider-tipsy', 'jquery-tablednd', 'media-upload'));
 
 
 
 
 
 
 
62
  }
63
 
64
  /**
65
  * Include the default CSS
66
  */
67
  public function enqueue_scripts() {
68
- wp_enqueue_style('ml-slider_display_css', plugins_url('ml-slider/assets/ml-slider-display.css'));
69
  }
70
 
71
  /**
72
  * Add the menu page
73
  */
74
  public function register_admin_menu() {
75
- $page = add_menu_page('ML Slider', 'ML Slider', 'add_users', 'ml-slider', array(
76
- $this,
77
- 'render_admin_page'
78
- ), MLSLIDER_ASSETS_URL . 'matchalabs.png', 99999);
79
 
80
  add_action('admin_print_scripts-' . $page, array( $this, 'register_admin_scripts' ) );
81
  }
@@ -102,65 +109,29 @@ class MLSlider {
102
  * Create taxonomy to store slider => slides relationship
103
  */
104
  public function register_taxonomy() {
105
- $labels = array(
106
  'name' => _x( 'Slider', 'taxonomy general name' ),
107
  'singular_name' => _x( 'Slider', 'taxonomy singular name' ),
108
  'menu_name' => __( 'Slider' )
109
- );
110
 
111
- $args = array(
112
  'hierarchical' => true,
113
  'labels' => $labels,
114
  'show_ui' => false,
115
  'show_admin_column' => true,
116
  'query_var' => false,
117
- 'rewrite' => array( 'slug' => 'ml-slider' )
118
- );
119
 
120
- register_taxonomy( 'ml-slider', 'attachment', $args );
121
  }
122
 
123
- /**
124
- * /////////////////////////////////////////////////////////////////
125
- * ML Slider
126
- * /////////////////////////////////////////////////////////////////
127
- */
128
-
129
  /**
130
  * Current slide ID
131
  */
132
  private function set_slider($id) {
133
- $this->slider = $id;
134
- $this->settings = $this->get_settings();
135
- $this->slides = $this->get_slides();
136
- }
137
-
138
- /**
139
- * Get slide ID
140
- *
141
- * @return int the current slider ID
142
- */
143
- private function get_slider() {
144
- return $this->slider;
145
- }
146
-
147
- /**
148
- * Get settings for the current slider
149
- *
150
- * @return array slider settings
151
- */
152
- private function get_settings() {
153
- return get_post_meta($this->get_slider(), 'ml-slider_settings', true);
154
- }
155
-
156
- /**
157
- * Return an individual setting
158
- *
159
- * @param string $name Name of the setting
160
- * @return string | bool setting value or fase
161
- */
162
- private function get_setting($name) {
163
- return isset($this->settings[$name]) && strlen($this->settings[$name]) > 0 ? $this->settings[$name] : "false";
164
  }
165
 
166
  /**
@@ -168,12 +139,12 @@ class MLSlider {
168
  */
169
  public function admin_process() {
170
  if (isset($_REQUEST['id'])) {
171
- $slider = $_REQUEST['id'];
172
  } else {
173
- $slider = $this->find_slider('date', 'DESC');
174
  }
175
 
176
- $this->set_slider($slider);
177
 
178
  $this->handle_slide_updates();
179
  $this->handle_delete_slider();
@@ -181,6 +152,8 @@ class MLSlider {
181
  $this->handle_update_slider_title();
182
  $this->handle_update_slider_settings();
183
  $this->handle_create_slider();
 
 
184
  }
185
 
186
  /**
@@ -204,12 +177,12 @@ class MLSlider {
204
  $the_query = new WP_Query($args);
205
 
206
  while ($the_query->have_posts()) {
207
- if (!$this->get_slider()) {
208
  $this->set_slider($the_query->post->ID);
209
  }
210
 
211
  $the_query->the_post();
212
- $active = $this->get_slider() == $the_query->post->ID ? true : false;
213
 
214
  $sliders[] = array(
215
  'active' => $active,
@@ -221,87 +194,17 @@ class MLSlider {
221
  return $sliders;
222
  }
223
 
224
- /**
225
- * Return slides for the current slider
226
- *
227
- * @return array collection of slides belonging to the current slider
228
- */
229
- public function get_slides() {
230
- $retVal = array();
231
-
232
- $args = array(
233
- 'orderby' => $this->get_setting('random') == 'true' && !is_admin() ? 'rand' : 'menu_order',
234
- 'order' => 'ASC',
235
- 'post_type' => 'attachment',
236
- 'post_status' => 'inherit',
237
- 'posts_per_page' => -1,
238
- 'tax_query' => array(
239
- array(
240
- 'taxonomy' => 'ml-slider',
241
- 'field' => 'slug',
242
- 'terms' => $this->get_slider()
243
- )
244
- )
245
- );
246
-
247
- $query = new WP_Query($args);
248
-
249
- while ($query->have_posts()) {
250
- $query->next_post();
251
-
252
- $image_attributes = wp_get_attachment_image_src($query->post->ID, 'ml-slider-slide'); // returns an array
253
-
254
- $retVal[] = array(
255
- 'id' => $query->post->ID,
256
- 'type' => 'image',
257
- 'url' => get_post_meta($query->post->ID, 'ml-slider_url', true),
258
- 'caption' => htmlentities($query->post->post_excerpt, ENT_QUOTES),
259
- 'src' => $image_attributes[0],
260
- 'alt' => htmlentities(get_post_meta($query->post->ID, '_wp_attachment_image_alt', true),ENT_QUOTES),
261
- 'menu_order' => $query->post->menu_order
262
- );
263
- }
264
-
265
- return $retVal;
266
- }
267
-
268
  /**
269
  * Create a new slider
270
  */
271
  private function handle_create_slider() {
272
  // create a new slider
273
  if (isset($_GET['add'])) {
 
 
274
  // if possible, take a copy of the last edited slider settings in place of default settings
275
  if ($last_modified = $this->find_slider('modified', 'DESC')) {
276
  $defaults = get_post_meta($last_modified, 'ml-slider_settings', true);
277
- } else {
278
- // default settings
279
- $defaults = array(
280
- 'type' => 'nivo',
281
- 'height' => 290,
282
- 'width' => 565,
283
- 'spw' => 7, // squares per width
284
- 'sph' => 5, // squares per height
285
- 'delay' => 3000,
286
- 'sDelay' => 30, // delay between squares
287
- 'opacity' => 0.7, // opacity of title and navigation
288
- 'titleSpeed' => 500, // speed of title appereance in ms
289
- 'effect' => 'random', // random, swirl, rain, straight
290
- 'navigation' => 'true', // prev next and buttons
291
- 'links' => 'true', // show images as links
292
- 'hoverPause' => 'true', // pause on hover
293
- 'theme' => 'dark',
294
- 'direction' => 'horizontal',
295
- 'reverse' => 'false',
296
- 'animationSpeed' => 600,
297
- 'prevText' => 'Previous',
298
- 'nextText' => 'Next',
299
- 'slices' => 15,
300
- 'random' => 'false',
301
- 'cssClass' => '',
302
- 'printCss' => 'true',
303
- 'printJs' => 'true'
304
- );
305
  }
306
 
307
  // insert the post
@@ -311,6 +214,12 @@ class MLSlider {
311
  'post_type' => 'ml-slider'
312
  ));
313
 
 
 
 
 
 
 
314
  // insert the post meta
315
  add_post_meta($id, 'ml-slider_settings', $defaults, true);
316
 
@@ -327,7 +236,8 @@ class MLSlider {
327
  */
328
  private function handle_update_slider_settings() {
329
  if (isset($_POST['settings'])) {
330
- $old_settings = get_post_meta($this->get_slider(), 'ml-slider_settings', true);
 
331
  $new_settings = $_POST['settings'];
332
 
333
  // convert submitted checkbox values from 'on' or 'off' to boolean values
@@ -335,17 +245,14 @@ class MLSlider {
335
 
336
  foreach ($checkboxes as $checkbox) {
337
  if (isset($new_settings[$checkbox]) && $new_settings[$checkbox] == 'on') {
338
- $new_settings[$checkbox] = true;
339
  } else {
340
- $new_settings[$checkbox] = false;
341
  }
342
  }
343
-
344
- // update the slider settings
345
- update_post_meta($this->get_slider(), 'ml-slider_settings', array_merge($old_settings, $new_settings));
346
 
347
- // update settings
348
- $this->settings = get_post_meta($this->get_slider(), 'ml-slider_settings', true);
349
  }
350
  }
351
 
@@ -355,7 +262,7 @@ class MLSlider {
355
  private function handle_update_slider_title() {
356
  if (isset($_POST['title'])) {
357
  $slide = array(
358
- 'ID' => $this->get_slider(),
359
  'post_title' => $_POST['title']
360
  );
361
 
@@ -376,7 +283,7 @@ class MLSlider {
376
  // Get the existing terms and only keep the ones we don't want removed
377
  $new_terms = array();
378
  $current_terms = wp_get_object_terms($slideToUntagFromCurrentSlider, 'ml-slider', array('fields' => 'ids'));
379
- $term = get_term_by('name', $this->get_slider(), 'ml-slider');
380
 
381
  foreach ($current_terms as $current_term) {
382
  if ($current_term != $term->term_id) {
@@ -397,7 +304,7 @@ class MLSlider {
397
  if (isset($_POST['attachment'])) {
398
  foreach ($_POST['attachment'] as $id => $fields) {
399
  // get the term thats name is the same as the ID of the slider
400
- $term = get_term_by('name', $this->get_slider(), 'ml-slider');
401
 
402
  // tag this slide to the taxonomy term
403
  wp_set_post_terms($id, $term->term_id, 'ml-slider', true);
@@ -420,8 +327,21 @@ class MLSlider {
420
  add_post_meta($id, 'ml-slider_url', $fields['url'], true);
421
  }
422
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
  // add a new image size for the current slider
424
- add_image_size('ml-slider-slide', $this->get_setting('width'), $this->get_setting('height'), true);
425
  $file = get_attached_file($id);
426
  // ask WordPress to resize our slides for us
427
  wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file));
@@ -471,278 +391,7 @@ class MLSlider {
471
 
472
  return false;
473
  }
474
-
475
 
476
-
477
- /**
478
- * Get the slider libary parameters
479
- *
480
- * @return string javascript options
481
- */
482
- private function get_params() {
483
- $params = array(
484
- 'width' => array(
485
- 'map' => array(
486
- 'coin' => 'width'
487
- ),
488
- 'default' => 565
489
- ),
490
- 'height' => array(
491
- 'map' => array(
492
- 'coin' => 'height'
493
- ),
494
- 'default' => 290
495
- ),
496
- 'spw' => array(
497
- 'map' => array(
498
- 'coin' => 'spw',
499
- 'nivo' => 'boxCols'
500
- ),
501
- 'default' => 7
502
- ),
503
- 'sph' => array(
504
- 'map' => array(
505
- 'coin' => 'sph',
506
- 'nivo' => 'boxRows'
507
- ),
508
- 'default' => 5
509
- ),
510
- 'delay' => array(
511
- 'map' => array(
512
- 'coin' => 'delay',
513
- 'nivo' => 'pauseTime',
514
- 'flex' => 'slideshowSpeed',
515
- 'responsive' => 'timeout'
516
- ),
517
- 'default' => 3000
518
- ),
519
- 'sDelay' => array(
520
- 'map' => array(
521
- 'coin' => 'sDelay'
522
- ),
523
- 'default' => 30
524
- ),
525
- 'opacity' => array(
526
- 'map' => array(
527
- 'coin' => 'opacity'
528
- ),
529
- 'default' => 0.7
530
- ),
531
- 'effect' => array(
532
- 'map' => array(
533
- 'coin' => 'effect',
534
- 'nivo' => 'effect',
535
- 'flex' => 'animation'
536
- ),
537
- 'default' => 'random'
538
- ),
539
- 'navigation' => array(
540
- 'map' => array(
541
- 'coin' => 'navigation',
542
- 'nivo' => 'controlNav',
543
- 'flex' => 'controlNav',
544
- 'responsive' => 'pager'
545
- ),
546
- 'default' => true
547
- ),
548
- 'links' => array(
549
- 'map' => array(
550
- 'nivo' => 'directionNav',
551
- 'flex' => 'directionNav',
552
- 'responsive' => 'nav'
553
- ),
554
- 'default' => true
555
- ),
556
- 'hoverPause' => array(
557
- 'map' => array(
558
- 'coin' => 'hoverPause',
559
- 'nivo' => 'pauseOnHover',
560
- 'flex' => 'pauseOnHover',
561
- 'responsive' => 'pause'
562
- ),
563
- 'default' => true
564
- ),
565
- 'theme' => array(
566
- 'map' => array(
567
- 'nivo' => 'theme'
568
- ),
569
- 'default' => 'dark'
570
- ),
571
- 'direction' => array(
572
- 'map' => array(
573
- 'flex' => 'direction'
574
- ),
575
- 'default' => 'horizontal'
576
- ),
577
- 'reverse' => array(
578
- 'map' => array(
579
- 'flex' => 'reverse'
580
- ),
581
- 'default' => false,
582
- ),
583
- 'animationSpeed' => array(
584
- 'map' => array(
585
- 'nivo' => 'animSpeed',
586
- 'flex' => 'animationSpeed',
587
- 'responsive' => 'speed'
588
- ),
589
- 'default' => 600
590
- ),
591
- 'prevText' => array(
592
- 'map' => array(
593
- 'nivo' => 'prevText',
594
- 'flex' => 'prevText',
595
- 'responsive' => 'prevText'
596
- ),
597
- 'default' => 'Previous'
598
- ),
599
- 'nextText' => array(
600
- 'map' => array(
601
- 'nivo' => 'nextText',
602
- 'flex' => 'nextText',
603
- 'responsive' => 'nextText'
604
- ),
605
- 'default' => 'Next'
606
- ),
607
- 'slices' => array(
608
- 'map' => array(
609
- 'nivo' => 'slices'
610
- ),
611
- 'default' => 15
612
- )
613
- );
614
-
615
- $options = array();
616
-
617
- foreach ($params as $setting => $map) {
618
- if (isset($map['map'][$this->get_setting('type')])) {
619
- $optionName = $map['map'][$this->get_setting('type')];
620
-
621
- if (!$optionVal = $this->get_setting($setting)) {
622
- $optionVal = $map['default'];
623
- }
624
-
625
- if (gettype($map['default']) == 'string') {
626
- $options[] = $optionName . ": '" . $optionVal . "'";
627
- } else {
628
- $options[] = $optionName . ": " . $optionVal;
629
- }
630
- }
631
- }
632
-
633
- return implode(",\n ", $options);;
634
- }
635
-
636
- /**
637
- * Return the Javascript to kick off the slider. Code is wrapped in a timer
638
- * to allow for themes that load jQuery at the bottom of the page.
639
- *
640
- * @return string javascript
641
- */
642
- private function get_inline_javascript($type, $identifier) {
643
- $retVal = "\n<script type='text/javascript'>";
644
- $retVal .= "\n var " . $identifier . " = function($) {";
645
- $retVal .= "\n $('#" . $identifier . "')." . $type . "({ ";
646
- $retVal .= "\n " . $this->get_params();
647
- $retVal .= "\n });";
648
- $retVal .= "\n };";
649
- $retVal .= "\n var timer_" . $identifier . " = function() {";
650
- $retVal .= "\n if (window.jQuery && jQuery.isReady) {";
651
- $retVal .= "\n " . $identifier . "(window.jQuery);";
652
- $retVal .= "\n } else {";
653
- $retVal .= "\n window.setTimeout(timer_" . $identifier . ", 100);";
654
- $retVal .= "\n }";
655
- $retVal .= "\n };";
656
- $retVal .= "\n timer_" . $identifier . "();";
657
- $retVal .= "\n</script>";
658
-
659
- return $retVal;
660
- }
661
-
662
- /**
663
- * Return coin slider markup
664
- *
665
- * @return string coin slider markup.
666
- */
667
- private function get_coin_slider($identifier) {
668
- $retVal = "<div id='" . $identifier . "' class='coin-slider'>";
669
-
670
- foreach ($this->get_slides() as $slide) {
671
- $url = strlen($slide['url']) ? $slide['url'] : "javascript:void(0)"; // coinslider always wants a URL
672
- $retVal .= "<a href='{$url}'>";
673
- $retVal .= "<img src='{$slide['src']}' alt='{$slide['alt']}'>";
674
- $retVal .= "<span>{$slide['caption']}</span>";
675
- $retVal .= "</a>";
676
- }
677
-
678
- $retVal .= "</div>";
679
-
680
- return $retVal;
681
- }
682
-
683
- /**
684
- * Return flexslider markup
685
- *
686
- * @return string flex slider markup.
687
- */
688
- private function get_flex_slider($identifier) {
689
- $retVal = "<div id='" . $identifier . "' class='flexslider'><ul class='slides'>";
690
-
691
- foreach ($this->get_slides() as $slide) {
692
- $retVal .= "<li>";
693
- if (strlen($slide['url'])) $retVal .= "<a href='{$slide['url']}'>";
694
- $retVal .= "<img src='{$slide['src']}' alt='{$slide['alt']}'>";
695
- if (strlen($slide['caption'])) $retVal .= "<p class='flex-caption'>{$slide['caption']}</p>";
696
- if (strlen($slide['url'])) $retVal .= "</a>";
697
- $retVal .= "</li>";
698
- }
699
-
700
- $retVal .= "</ul></div>";
701
-
702
- return $retVal;
703
- }
704
-
705
- /**
706
- * Return responsive slides markup
707
- *
708
- * @return string responsive slider markup.
709
- */
710
- private function get_responsive_slider($identifier) {
711
- $retVal = "<ul id='" . $identifier . "' class='rslides'>";
712
-
713
- foreach ($this->get_slides() as $slide) {
714
- $retVal .= "<li>";
715
- if (strlen($slide['url'])) $retVal .= "<a href='{$slide['url']}'>";
716
- $retVal .= "<img src='{$slide['src']}' alt='{$slide['alt']}'>";
717
- if (strlen($slide['url'])) $retVal .= "</a>";
718
- $retVal .= "</li>";
719
- }
720
-
721
- $retVal .= "</ul>";
722
-
723
- return $retVal;
724
- }
725
-
726
- /**
727
- * Return nivoslider markup
728
- *
729
- * @return string nivo slider markup.
730
- */
731
- private function get_nivo_slider($identifier) {
732
- $retVal = "<div class='slider-wrapper theme-{$this->get_setting('theme')}'>";
733
- $retVal .= "<div class='ribbon'></div>";
734
- $retVal .= "<div id='" . $identifier . "' class='nivoSlider'>";
735
-
736
- foreach ($this->get_slides() as $slide) {
737
- if (strlen($slide['url'])) $retVal .= "<a href='{$slide['url']}'>";
738
- $retVal .= "<img src='{$slide['src']}' title='{$slide['caption']}' alt='{$slide['alt']}'>";
739
- if (strlen($slide['url'])) $retVal .= "</a>";
740
- }
741
-
742
- $retVal .= "</div></div>";
743
-
744
- return $retVal;
745
- }
746
 
747
  /**
748
  * Shortcode used to display slideshow
@@ -753,7 +402,6 @@ class MLSlider {
753
  extract(shortcode_atts(array(
754
  'id' => null
755
  ), $atts));
756
-
757
 
758
  if ($id == null) {
759
  return;
@@ -766,68 +414,28 @@ class MLSlider {
766
  return false;
767
  }
768
 
 
769
  $this->set_slider($id);
770
 
771
- $identifier = 'ml_slider_' . rand();
772
-
773
- // coinslider
774
- if ($this->get_setting('type') == 'coin') {
775
- if ($this->get_setting('printJs') == 'true') {
776
- wp_enqueue_script('ml-slider_coin_slider', MLSLIDER_ASSETS_URL . 'coinslider/coin-slider.min.js', array('jquery'), MLSLIDER_VERSION);
777
- }
778
-
779
- if ($this->get_setting('printCss') == 'true') {
780
- wp_enqueue_style('ml-slider_coin_slider_css', plugins_url('ml-slider/assets/coinslider/coin-slider-styles.css'));
781
- }
782
-
783
- $retVal = $this->get_coin_slider($identifier);
784
- $retVal .= $this->get_inline_javascript('coinslider', $identifier);
785
- }
786
-
787
- // flex
788
- if ($this->get_setting('type') == 'flex') {
789
- if ($this->get_setting('printJs') == 'true') {
790
- wp_enqueue_script('ml-slider_flex_slider', MLSLIDER_ASSETS_URL . 'flexslider/jquery.flexslider-min.js', array('jquery'), MLSLIDER_VERSION);
791
- }
792
-
793
- if ($this->get_setting('printCss') == 'true') {
794
- wp_enqueue_style('ml-slider_flex_slider_css', plugins_url('ml-slider/assets/flexslider/flexslider.css'));
795
- }
796
-
797
- $retVal = $this->get_flex_slider($identifier);
798
- $retVal .= $this->get_inline_javascript('flexslider', $identifier);
799
  }
800
-
801
- // responsive
802
- if ($this->get_setting('type') == 'responsive') {
803
- if ($this->get_setting('printJs') == 'true') {
804
- wp_enqueue_script('ml-slider_responsive_slides', MLSLIDER_ASSETS_URL . 'responsiveslides/responsiveslides.min.js', array('jquery'), MLSLIDER_VERSION);
805
- }
806
 
807
- if ($this->get_setting('printCss') == 'true') {
808
- wp_enqueue_style('ml-slider_responsive_slides_css', plugins_url('ml-slider/assets/responsiveslides/responsiveslides.css'));
809
- }
810
 
811
- $retVal = $this->get_responsive_slider($identifier);
812
- $retVal .= $this->get_inline_javascript('responsiveSlides', $identifier);
813
- }
814
 
815
- // nivo
816
- if ($this->get_setting('type') == 'nivo') {
817
- if ($this->get_setting('printJs') == 'true') {
818
- wp_enqueue_script('ml-slider_nivo_slider', MLSLIDER_ASSETS_URL . 'nivoslider/jquery.nivo.slider.pack.js', array('jquery'), MLSLIDER_VERSION);
819
- }
820
-
821
- if ($this->get_setting('printCss') == 'true') {
822
- wp_enqueue_style('ml-slider_nivo_slider_css', plugins_url('ml-slider/assets/nivoslider/nivo-slider.css'));
823
- wp_enqueue_style('ml-slider_nivo_slider_theme_' . $this->get_setting('theme'), plugins_url('ml-slider/assets/nivoslider/themes/' . $this->get_setting('theme') . '/' . $this->get_setting('theme') . '.css'));
824
- }
825
-
826
- $retVal = $this->get_nivo_slider($identifier);
827
- $retVal .= $this->get_inline_javascript('nivoSlider', $identifier);
828
- }
829
-
830
- return "<div class='ml-slider ml-slider-{$this->get_setting('type')} {$this->get_setting('cssClass')}'>" . $retVal . "</div>";
831
  }
832
 
833
  /**
@@ -840,56 +448,61 @@ class MLSlider {
840
  * Render the admin page (tabs, slides, settings)
841
  */
842
  public function render_admin_page() {
 
843
  ?>
844
 
845
- <div class="wrap ml-slider">
846
- <form enctype="multipart/form-data" action="?page=ml-slider&id=<?php echo $this->get_slider() ?>" method="post">
847
 
848
- <h2 class="nav-tab-wrapper" style="font-size: 13px;">
849
  <?php
850
  if ($tabs = $this->get_sliders()) {
851
  foreach ($tabs as $tab) {
852
  if ($tab['active']) {
853
- echo "<div class='nav-tab nav-tab-active' style='font-size: 13px;'><input type='text' name='title' value='" . $tab['title'] . "' style='padding: 0; margin: 0; border: 0; width: 100px; font-size: 14px' onkeypress='this.style.width = ((this.value.length + 1) * 9) + \"px\"' /></div>";
854
  } else {
855
- echo "<a href='?page=ml-slider&id={$tab['id']}' class='nav-tab' style='font-size: 13px;'>" . $tab['title'] . "</a>";
856
  }
857
  }
858
  }
859
  ?>
860
 
861
- <a href="?page=ml-slider&add=true" id="create_new_tab" class="nav-tab" style='font-size: 13px;'>+</a>
862
  </h2>
863
 
864
  <?php
865
- if (!$this->get_slider()) {
866
  return;
867
  }
868
  ?>
869
 
870
- <div class="left" style='width: 68%; margin-top: 20px; float: left; clear: none;'>
871
  <table class="widefat sortable slides">
872
  <thead>
873
  <tr>
874
- <th style="width: 100px;">Slides</th>
875
- <th><input class='upload_image_button alignright button-secondary' type='button' value='Add Slide' data-uploader_title='Select Slide' data-uploader_button_text='Add to slider' /></th>
876
  </tr>
877
  </thead>
878
 
879
  <tbody>
880
  <?php
881
- $slides = $this->get_slides();
 
 
 
 
882
 
883
- foreach($slides as $slide) {
884
- $image_attributes = wp_get_attachment_image_src($slide['id']); // returns an array
885
- $url = get_post_meta($slide['id'], 'ml-slider_url', true);
886
  echo "<tr class='slide'>";
887
- echo "<td>";
888
- echo "<div style='position: absolute'><a class='delete-slide confirm' href='?page=ml-slider&id={$this->get_slider()}&deleteSlide={$slide['id']}'>x</a></div>";
889
- echo "<img src='{$image_attributes[0]}' width='150px'></td>";
890
- echo "<td>";
891
- echo "<textarea name='attachment[{$slide['id']}][post_excerpt]' placeholder='Caption'>{$slide['caption']}</textarea>";
892
- echo "<input type='text' name='attachment[{$slide['id']}][url]' placeholder='URL' value='{$url}' />";
 
 
 
893
  echo "<input type='hidden' class='menu_order' name='attachment[{$slide['id']}][menu_order]' value={$slide['menu_order']} />";
894
  echo "</td>";
895
  echo "</tr>";
@@ -899,222 +512,274 @@ class MLSlider {
899
  </table>
900
  </div>
901
 
902
- <div class='right' style="width: 30%; float: right; margin-top: 20px; clear: none;">
903
  <table class="widefat settings">
904
  <thead>
905
  <tr>
906
- <th colspan="2">Settings</th>
907
  <th>
908
- <input type='submit' value='Save' class='alignright button-primary' />
909
- <div class='unsaved tooltip' style='display: none;' title='Unsaved Changes'>!</div>
910
  </th>
911
  </tr>
912
  </thead>
913
  <tbody>
914
  <tr>
915
- <td colspan='3'>
916
  <div class='slider-lib nivo'>
917
  <label for='nivo' title='Version: 3.2<br />Responsive: Yes<br />Effects: 14<br />Size: 12kb<br />Mobile Friendly: Yes<br />Themes: 4' class='tooltiptop'>NivoSlider</label>
918
- <input class="select-slider" id='nivo' rel='nivo' type='radio' name="settings[type]" <?php if ($this->get_setting('type') == 'nivo') echo 'checked=checked' ?> value='nivo' />
919
  </div>
920
  <div class='slider-lib coin'>
921
  <label for='coin' title='Version: 1.0<br />Responsive: No<br />Effects: 4<br />Size: 8kb<br />Mobile Friendly: Yes' class='tooltiptop'>CoinSlider</label>
922
- <input class="select-slider" id='coin' rel='coin' type='radio' name="settings[type]" <?php if ($this->get_setting('type') == 'coin') echo 'checked=checked' ?> value='coin' />
923
  </div>
924
  <div class='slider-lib flex'>
925
  <label for='flex' title='Version: 2.1<br />Responsive: Yes<br />Effects: 2<br />Size: 17kb<br />Mobile Friendly: Yes' class='tooltiptop'>FlexSlider</label>
926
- <input class="select-slider" id='flex' rel='flex' type='radio' name="settings[type]" <?php if ($this->get_setting('type') == 'flex') echo 'checked=checked' ?> value='flex' />
927
  </div>
928
  <div class='slider-lib responsive'>
929
  <label for='responsive' title='Version: 1.53<br />Responsive: Yes<br />Effects: 1<br />Size: 3kb<br />Mobile Friendly: Yes' class='tooltiptop'>Responsive</label>
930
- <input class="select-slider" id='responsive' rel='responsive' type='radio' name="settings[type]" <?php if ($this->get_setting('type') == 'responsive') echo 'checked=checked' ?> value='responsive' />
931
  </div>
932
  </td>
933
  </tr>
934
  <tr>
935
- <td><a href="#" class="tooltip" title="Set the initial size for the slides (width x height)">?</a></td>
936
- <td>Size</td>
 
937
  <td>
938
- <input type='text' size='3' name="settings[width]" value='<?php echo $this->get_setting('width') ?>' />px X
939
- <input type='text' size='3' name="settings[height]" value='<?php echo $this->get_setting('height') ?>' />px
940
  </td>
941
  </tr>
942
  <tr>
943
- <td><a href="#" class="tooltip" title="Slide transition effect">?</a></td>
944
- <td>Effect</td>
 
945
  <td>
946
  <select name="settings[effect]" class='effect option coin nivo flex'>
947
- <option class='option coin nivo' value='random' <?php if ($this->get_setting('effect') == 'random') echo 'selected=selected' ?>>Random</option>
948
- <option class='option coin' value='swirl' <?php if ($this->get_setting('effect') == 'swirl') echo 'selected=selected' ?>>Swirl</option>
949
- <option class='option coin' value='rain' <?php if ($this->get_setting('effect') == 'rain') echo 'selected=selected' ?>>Rain</option>
950
- <option class='option coin' value='straight' <?php if ($this->get_setting('effect') == 'straight') echo 'selected=selected' ?>>Straight</option>
951
- <option class='option nivo' value='sliceDown' <?php if ($this->get_setting('effect') == 'sliceDown') echo 'selected=selected' ?>>Slice Down</option>
952
- <option class='option nivo' value='sliceUp' <?php if ($this->get_setting('effect') == 'sliceUp') echo 'selected=selected' ?>>Slice Up</option>
953
- <option class='option nivo' value='sliceUpLeft' <?php if ($this->get_setting('effect') == 'sliceUpLeft') echo 'selected=selected' ?>>Slice Up Left</option>
954
- <option class='option nivo' value='sliceUpDown' <?php if ($this->get_setting('effect') == 'sliceUpDown') echo 'selected=selected' ?>>Slice Up Down</option>
955
- <option class='option nivo' value='sliceUpDownLeft' <?php if ($this->get_setting('effect') == 'sliceUpDownLeft') echo 'selected=selected' ?>>Slice Up Down Left</option>
956
- <option class='option nivo' value='fold' <?php if ($this->get_setting('effect') == 'fold') echo 'selected=selected' ?>>Fold</option>
957
- <option class='option nivo flex' value='fade' <?php if ($this->get_setting('effect') == 'fade') echo 'selected=selected' ?>>Fade</option>
958
- <option class='option nivo' value='slideInRight' <?php if ($this->get_setting('effect') == 'slideInRight') echo 'selected=selected' ?>>Slide In Right</option>
959
- <option class='option nivo' value='slideInLeft' <?php if ($this->get_setting('effect') == 'slideInLeft') echo 'selected=selected' ?>>Slide In Left</option>
960
- <option class='option nivo' value='boxRandom' <?php if ($this->get_setting('effect') == 'boxRandom') echo 'selected=selected' ?>>Box Random</option>
961
- <option class='option nivo' value='boxRain' <?php if ($this->get_setting('effect') == 'boxRain') echo 'selected=selected' ?>>Box Rain</option>
962
- <option class='option nivo' value='boxRainReverse' <?php if ($this->get_setting('effect') == 'boxRainReverse') echo 'selected=selected' ?>>Box Rain Reverse</option>
963
- <option class='option nivo' value='boxRainGrowReverse' <?php if ($this->get_setting('effect') == 'boxRainGrowReverse') echo 'selected=selected' ?>>Box Rain Grow Reverse</option>
964
- <option class='option flex' value='slide' <?php if ($this->get_setting('effect') == 'slide') echo 'selected=selected' ?>>Slide</option>
965
  </select>
966
  </td>
967
  </tr>
968
  <tr>
969
- <td><a href="#" class="tooltip" title="Change the slider style">?</a></td>
970
- <td>Theme</td>
 
971
  <td>
972
  <select class='option nivo' name="settings[theme]">
973
- <option value='default' <?php if ($this->get_setting('theme') == 'default') echo 'selected=selected' ?>>Default</option>
974
- <option value='dark' <?php if ($this->get_setting('theme') == 'dark') echo 'selected=selected' ?>>Dark</option>
975
- <option value='light' <?php if ($this->get_setting('theme') == 'light') echo 'selected=selected' ?>>Light</option>
976
- <option value='bar' <?php if ($this->get_setting('theme') == 'bar') echo 'selected=selected' ?>>Bar</option>
977
  </select>
978
  </td>
979
  </tr>
980
  <tr>
981
- <td><a href="#" class="tooltip" title="Number of squares (width x height)">?</a></td>
982
- <td>Number of squares</td>
 
983
  <td>
984
- <input class='option coin nivo' type='text' size='2' name="settings[spw]" value='<?php echo $this->get_setting('spw') ?>' /> x
985
- <input class='option coin nivo' type='text' size='2' name="settings[sph]" value='<?php echo $this->get_setting('sph') ?>' />
986
  </td>
987
  </tr>
988
  <tr>
989
- <td><a href="#" class="tooltip" title="Number of slices">?</a></td>
990
- <td>Number of slices</td>
 
991
  <td>
992
- <input class='option nivo' type='text' size='2' name="settings[slices]" value='<?php echo $this->get_setting('slices') ?>' />
993
  </td>
994
  </tr>
995
  <tr>
996
- <td><a href="#" class="tooltip" title="How long to display each slide, in milliseconds">?</a></td>
997
- <td>Slide delay</td>
998
- <td><input class='option coin flex responsive nivo' type='text' size='5' name="settings[delay]" value='<?php echo $this->get_setting('delay') ?>' />ms</td>
 
 
 
999
  </tr>
1000
  <tr>
1001
- <td><a href="#" class="tooltip" title="Delay beetwen squares in ms">?</a></td>
1002
- <td>Square delay</td>
1003
- <td><input class='option coin' type='text' size='5' name="settings[sDelay]" value='<?php echo $this->get_setting('sDelay') ?>' />ms</td>
 
 
 
1004
  </tr>
1005
  <tr>
1006
- <td><a href="#" class="tooltip" title="Opacity of title and navigation">?</a></td>
1007
- <td>Opacity</td>
1008
- <td><input class='option coin' type='text' size='5' name="settings[opacity]" value='<?php echo $this->get_setting('opacity') ?>' /></td>
 
 
 
1009
  </tr>
1010
  <tr>
1011
- <td><a href="#" class="tooltip" title="Set the fade in speef of the caption">?</a></td>
1012
- <td>Caption speed</td>
1013
- <td><input class='option coin' type='text' size='5' name="settings[titleSpeed]" value='<?php echo $this->get_setting('titleSpeed') ?>' />ms</td>
 
 
 
 
1014
  </tr>
1015
  <tr>
1016
- <td><a href="#" class="tooltip" title="Set the speed of animations, in milliseconds">?</a></td>
1017
- <td>Animation speed</td>
1018
- <td><input class='option flex responsive nivo' type='text' size='5' name="settings[animationSpeed]" value='<?php echo $this->get_setting('animationSpeed') ?>' />ms</td>
 
 
 
1019
  </tr>
1020
  <tr>
1021
- <td><a href="#" class="tooltip" title="Show slide navigation row">?</a></td>
1022
- <td>Navigation</td>
 
1023
  <td>
1024
- <input class='option coin responsive nivo flex' type='checkbox' name="settings[navigation]" <?php if ($this->get_setting('navigation') == 'true') echo 'checked=checked' ?> />
1025
  </td>
1026
  </tr>
1027
  <tr>
1028
- <td><a href="#" class="tooltip" title="Show previous and next links">?</a></td>
1029
- <td>Links</td>
 
 
 
 
1030
  <td>
1031
- <input class='option responsive nivo flex' type='checkbox' name="settings[links]" <?php if ($this->get_setting('links') == 'true') echo 'checked=checked' ?> />
1032
  </td>
1033
  </tr>
1034
  <tr>
1035
- <td><a href="#" class="tooltip" title="Pause the slideshow when hovering over slider, then resume when no longer hovering">?</a></td>
1036
- <td>Hover pause</td>
 
1037
  <td>
1038
- <input class='option coin flex responsive nivo' type='checkbox' name="settings[hoverPause]" <?php if ($this->get_setting('hoverPause') == 'true') echo 'checked=checked' ?> />
 
1039
  </td>
1040
  </tr>
1041
  <tr>
1042
- <td><a href="#" class="tooltip" title="Reverse the animation direction">?</a></td>
1043
- <td>Reverse</td>
 
1044
  <td>
1045
- <input class='option flex' type='checkbox' name="settings[reverse]" <?php if ($this->get_setting('reverse') == 'true') echo 'checked=checked' ?> />
1046
  </td>
1047
  </tr>
1048
  <tr>
1049
- <td><a href="#" class="tooltip" title="Randomise the order of the slides">?</a></td>
1050
- <td>Random</td>
 
1051
  <td>
1052
- <input type='checkbox' name="settings[random]" <?php if ($this->get_setting('random') == 'true') echo 'checked=checked' ?> />
1053
  </td>
1054
  </tr>
1055
  <tr>
1056
- <td><a href="#" class="tooltip" title="Uncheck this is you would like to include your own CSS">?</a></td>
1057
- <td>Print CSS</td>
 
1058
  <td>
1059
- <input type='checkbox' name="settings[printCss]" <?php if ($this->get_setting('printCss') == 'true') echo 'checked=checked' ?> />
1060
  </td>
1061
  </tr>
1062
  <tr>
1063
- <td><a href="#" class="tooltip" title="Uncheck this is you would like to include your own Javascript">?</a></td>
1064
- <td>Print JS</td>
 
1065
  <td>
1066
- <input type='checkbox' name="settings[printJs]" <?php if ($this->get_setting('printJs') == 'true') echo 'checked=checked' ?> />
1067
  </td>
1068
  </tr>
1069
  <tr>
1070
- <td><a href="#" class="tooltip" title="Select the sliding direction">?</a></td>
1071
- <td>Direction</td>
 
1072
  <td>
1073
- <select class='option flex' name="settings[direction]">
1074
- <option value='horizontal' <?php if ($this->get_setting('direction') == 'horizontal') echo 'selected=selected' ?>>Horizontal</option>
1075
- <option value='vertical' <?php if ($this->get_setting('direction') == 'vertical') echo 'selected=selected' ?>>Vertical</option>
1076
- </select>
1077
  </td>
1078
  </tr>
1079
  <tr>
1080
- <td><a href="#" class="tooltip" title="Set the text for the 'previous' direction item">?</a></td>
1081
- <td>Previous text</td>
1082
- <td><input class='option flex responsive nivo' type='text' name="settings[prevText]" value='<?php if ($this->get_setting('prevText') != 'false') echo $this->get_setting('prevText') ?>' /></td>
1083
  </tr>
1084
  <tr>
1085
- <td><a href="#" class="tooltip" title="Set the text for the 'next' direction item">?</a></td>
1086
- <td>Next text</td>
1087
- <td><input class='option flex responsive nivo' type='text' name="settings[nextText]" value='<?php if ($this->get_setting('nextText') != 'false') echo $this->get_setting('nextText') ?>' /></td>
 
 
 
1088
  </tr>
1089
  <tr>
1090
- <td><a href="#" class="tooltip" title="Specify any custom CSS Classes you would like to be added to the slider wrapper">?</a></td>
1091
- <td>CSS classes</td>
1092
- <td><input type='text' name="settings[cssClass]" value='<?php if ($this->get_setting('cssClass') != 'false') echo $this->get_setting('cssClass') ?>' /></td>
 
 
 
 
 
 
 
 
 
 
 
1093
  </tr>
1094
  </tbody>
1095
  </table>
1096
 
1097
- <table class="widefat" style="width: 100%; margin-top: 20px;">
1098
  <thead>
1099
  <tr>
1100
- <th>Shortcode</th>
1101
  </tr>
1102
  </thead>
1103
 
1104
  <tbody>
1105
  <tr>
1106
- <td><textarea style="width: 100%">[ml-slider id=<?php echo $this->get_slider() ?>]</textarea></td>
 
 
 
 
 
 
 
 
 
1107
  </tr>
1108
  </tbody>
 
1109
  </table>
1110
 
1111
  <br />
1112
- <a class='alignright button-secondary confirm' href="?page=ml-slider&delete=<?php echo $this->get_slider() ?>">Delete Slider</a>
1113
  </div>
1114
  </form>
1115
  </div>
1116
  <?php
1117
  }
1118
  }
1119
- $mlslider = new MLSlider();
 
1120
  ?>
1
  <?php
2
  /*
3
+ * Plugin Name: Meta Slider
4
+ * Plugin URI: http://www.metaslider.com
5
  * Description: 4 sliders in 1! Choose from Nivo Slider, Flex Slider, Coin Slider or Responsive Slides.
6
+ * Version: 1.3
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
+ define('METASLIDER_VERSION', '1.3');
18
+ define('METASLIDER_BASE_URL', plugin_dir_url(__FILE__));
19
+ define('METASLIDER_ASSETS_URL', METASLIDER_BASE_URL . 'assets/');
20
+ define('METASLIDER_BASE_DIR_LONG', dirname(__FILE__));
21
+ define('METASLIDER_INC_DIR', METASLIDER_BASE_DIR_LONG . '/inc/');
22
 
23
+ require_once( METASLIDER_INC_DIR . 'metaslider.class.php' );
24
+ require_once( METASLIDER_INC_DIR . 'metaslider.coin.class.php' );
25
+ require_once( METASLIDER_INC_DIR . 'metaslider.flex.class.php' );
26
+ require_once( METASLIDER_INC_DIR . 'metaslider.nivo.class.php' );
27
+ require_once( METASLIDER_INC_DIR . 'metaslider.responsive.class.php' );
28
 
29
+ class MetaSliderPlugin {
 
 
30
 
31
+ var $slider = null;
 
 
 
 
32
 
33
  /**
34
  * Constructor
36
  public function __construct() {
37
  add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
38
  add_action('admin_menu', array($this, 'register_admin_menu'), 10001);
 
39
  add_action('init', array($this, 'register_post_type' ));
40
  add_action('init', array($this, 'register_taxonomy' ));
41
  add_action('admin_print_styles', array( $this, 'register_admin_styles'));
42
+ add_shortcode('metaslider', array($this, 'register_shortcode'));
43
+ add_shortcode('ml-slider', array($this, 'register_shortcode')); // backwards compatibility
44
+ load_plugin_textdomain( 'metaslider', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
45
  }
46
 
47
  /**
48
  * Registers and enqueues admin-specific styles.
49
  */
50
  public function register_admin_styles() {
51
+ wp_enqueue_style('metaslider-tipsy-styles', METASLIDER_ASSETS_URL . 'tipsy/tipsy.css');
52
+ wp_enqueue_style('metaslider-admin-styles', METASLIDER_ASSETS_URL . 'metaslider-admin.css');
53
  }
54
 
55
  /**
57
  */
58
  public function register_admin_scripts() {
59
  wp_enqueue_media();
60
+ wp_enqueue_script('jquery-ui-core', array('jquery'));
61
+ wp_enqueue_script('jquery-ui-sortable', array('jquery', 'jquery-ui-core'));
62
+ wp_enqueue_script('metaslider-tipsy', METASLIDER_ASSETS_URL . 'tipsy/jquery.tipsy.js', array('jquery'));
63
+ wp_enqueue_script('metaslider-admin-script', METASLIDER_ASSETS_URL . 'metaslider.js', array('jquery', 'metaslider-tipsy', 'media-upload'));
64
+ wp_localize_script( 'metaslider-admin-script', 'metaslider', array(
65
+ 'url' => __("URL", 'metaslider'),
66
+ 'caption' => __("Caption", 'metaslider'),
67
+ 'new_window' => __("New Window", 'metaslider'),
68
+ 'confirm' => __("Are you sure?", 'metaslider')
69
+ ));
70
  }
71
 
72
  /**
73
  * Include the default CSS
74
  */
75
  public function enqueue_scripts() {
76
+ wp_enqueue_style('metaslider_display_css', METASLIDER_ASSETS_URL . 'metaslider-display.css');
77
  }
78
 
79
  /**
80
  * Add the menu page
81
  */
82
  public function register_admin_menu() {
83
+ $page = add_menu_page('MetaSlider', 'MetaSlider', 'edit_others_posts', 'metaslider', array(
84
+ $this, 'render_admin_page'
85
+ ), METASLIDER_ASSETS_URL . 'matchalabs.png', 9501);
 
86
 
87
  add_action('admin_print_scripts-' . $page, array( $this, 'register_admin_scripts' ) );
88
  }
109
  * Create taxonomy to store slider => slides relationship
110
  */
111
  public function register_taxonomy() {
112
+ $labels = array(
113
  'name' => _x( 'Slider', 'taxonomy general name' ),
114
  'singular_name' => _x( 'Slider', 'taxonomy singular name' ),
115
  'menu_name' => __( 'Slider' )
116
+ );
117
 
118
+ $args = array(
119
  'hierarchical' => true,
120
  'labels' => $labels,
121
  'show_ui' => false,
122
  'show_admin_column' => true,
123
  'query_var' => false,
124
+ 'rewrite' => array('slug' => 'ml-slider')
125
+ );
126
 
127
+ register_taxonomy( 'ml-slider', 'attachment', $args );
128
  }
129
 
 
 
 
 
 
 
130
  /**
131
  * Current slide ID
132
  */
133
  private function set_slider($id) {
134
+ $this->slider = new MetaSlider($id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
136
 
137
  /**
139
  */
140
  public function admin_process() {
141
  if (isset($_REQUEST['id'])) {
142
+ $slider_id = $_REQUEST['id'];
143
  } else {
144
+ $slider_id = $this->find_slider('date', 'DESC');
145
  }
146
 
147
+ $this->set_slider($slider_id);
148
 
149
  $this->handle_slide_updates();
150
  $this->handle_delete_slider();
152
  $this->handle_update_slider_title();
153
  $this->handle_update_slider_settings();
154
  $this->handle_create_slider();
155
+
156
+ $this->set_slider($this->slider->id); // refresh
157
  }
158
 
159
  /**
177
  $the_query = new WP_Query($args);
178
 
179
  while ($the_query->have_posts()) {
180
+ if (!$this->slider->id) {
181
  $this->set_slider($the_query->post->ID);
182
  }
183
 
184
  $the_query->the_post();
185
+ $active = $this->slider->id == $the_query->post->ID ? true : false;
186
 
187
  $sliders[] = array(
188
  'active' => $active,
194
  return $sliders;
195
  }
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  /**
198
  * Create a new slider
199
  */
200
  private function handle_create_slider() {
201
  // create a new slider
202
  if (isset($_GET['add'])) {
203
+ $defaults = array();
204
+
205
  // if possible, take a copy of the last edited slider settings in place of default settings
206
  if ($last_modified = $this->find_slider('modified', 'DESC')) {
207
  $defaults = get_post_meta($last_modified, 'ml-slider_settings', true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  }
209
 
210
  // insert the post
214
  'post_type' => 'ml-slider'
215
  ));
216
 
217
+ // use the default settings if we can't find anything more suitable.
218
+ if (empty($defaults)) {
219
+ $slider = new MetaSlider($id);
220
+ $defaults = $slider->get_default_parameters();
221
+ }
222
+
223
  // insert the post meta
224
  add_post_meta($id, 'ml-slider_settings', $defaults, true);
225
 
236
  */
237
  private function handle_update_slider_settings() {
238
  if (isset($_POST['settings'])) {
239
+ $old_settings = $this->slider->settings;
240
+
241
  $new_settings = $_POST['settings'];
242
 
243
  // convert submitted checkbox values from 'on' or 'off' to boolean values
245
 
246
  foreach ($checkboxes as $checkbox) {
247
  if (isset($new_settings[$checkbox]) && $new_settings[$checkbox] == 'on') {
248
+ $new_settings[$checkbox] = "true";
249
  } else {
250
+ $new_settings[$checkbox] = "false";
251
  }
252
  }
 
 
 
253
 
254
+ // update the slider settings
255
+ update_post_meta($this->slider->id, 'ml-slider_settings', array_merge($old_settings, $new_settings));
256
  }
257
  }
258
 
262
  private function handle_update_slider_title() {
263
  if (isset($_POST['title'])) {
264
  $slide = array(
265
+ 'ID' => $this->slider->id,
266
  'post_title' => $_POST['title']
267
  );
268
 
283
  // Get the existing terms and only keep the ones we don't want removed
284
  $new_terms = array();
285
  $current_terms = wp_get_object_terms($slideToUntagFromCurrentSlider, 'ml-slider', array('fields' => 'ids'));
286
+ $term = get_term_by('name', $this->slider->id, 'ml-slider');
287
 
288
  foreach ($current_terms as $current_term) {
289
  if ($current_term != $term->term_id) {
304
  if (isset($_POST['attachment'])) {
305
  foreach ($_POST['attachment'] as $id => $fields) {
306
  // get the term thats name is the same as the ID of the slider
307
+ $term = get_term_by('name', $this->slider->id, 'ml-slider');
308
 
309
  // tag this slide to the taxonomy term
310
  wp_set_post_terms($id, $term->term_id, 'ml-slider', true);
327
  add_post_meta($id, 'ml-slider_url', $fields['url'], true);
328
  }
329
 
330
+ // store the new window setting as a meta field against the attachment
331
+ if (isset($fields['new_window']) && $fields['new_window'] == 'on') {
332
+ if (get_post_meta($id, 'ml-slider_new_window')) {
333
+ update_post_meta($id, 'ml-slider_new_window', 'true');
334
+ } else {
335
+ add_post_meta($id, 'ml-slider_new_window', 'true', true);
336
+ }
337
+ } else {
338
+ if (get_post_meta($id, 'ml-slider_new_window')) {
339
+ delete_post_meta($id, 'ml-slider_new_window');
340
+ }
341
+ }
342
+
343
  // add a new image size for the current slider
344
+ add_image_size('ml-slider-slide', $this->slider->get_setting('width'), $this->slider->get_setting('height'), true);
345
  $file = get_attached_file($id);
346
  // ask WordPress to resize our slides for us
347
  wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file));
391
 
392
  return false;
393
  }
 
394
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
395
 
396
  /**
397
  * Shortcode used to display slideshow
402
  extract(shortcode_atts(array(
403
  'id' => null
404
  ), $atts));
 
405
 
406
  if ($id == null) {
407
  return;
414
  return false;
415
  }
416
 
417
+ // good to go
418
  $this->set_slider($id);
419
 
420
+ switch ($this->slider->get_setting('type')) {
421
+ case('coin'):
422
+ $slider = new MetaCoinSlider($id);
423
+ break;
424
+ case('flex'):
425
+ $slider = new MetaFlexSlider($id);
426
+ break;
427
+ case('nivo'):
428
+ $slider = new MetaNivoSlider($id);
429
+ break;
430
+ case('responsive'):
431
+ $slider = new MetaResponsiveSlider($id);
432
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
  }
 
 
 
 
 
 
434
 
435
+ $slider->enqueue_scripts();
 
 
436
 
437
+ return $slider->output();
 
 
438
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
  }
440
 
441
  /**
448
  * Render the admin page (tabs, slides, settings)
449
  */
450
  public function render_admin_page() {
451
+ $this->admin_process();
452
  ?>
453
 
454
+ <div class="wrap metaslider">
455
+ <form accept-charset="UTF-8" action="?page=metaslider&id=<?php echo $this->slider->id ?>" method="post">
456
 
457
+ <h2 class="nav-tab-wrapper">
458
  <?php
459
  if ($tabs = $this->get_sliders()) {
460
  foreach ($tabs as $tab) {
461
  if ($tab['active']) {
462
+ echo "<div class='nav-tab nav-tab-active'><input type='text' name='title' value='" . $tab['title'] . "' onkeypress='this.style.width = ((this.value.length + 1) * 9) + \"px\"' /></div>";
463
  } else {
464
+ echo "<a href='?page=metaslider&id={$tab['id']}' class='nav-tab'>" . $tab['title'] . "</a>";
465
  }
466
  }
467
  }
468
  ?>
469
 
470
+ <a href="?page=metaslider&add=true" id="create_new_tab" class="nav-tab">+</a>
471
  </h2>
472
 
473
  <?php
474
+ if (!$this->slider->id) {
475
  return;
476
  }
477
  ?>
478
 
479
+ <div class="left">
480
  <table class="widefat sortable slides">
481
  <thead>
482
  <tr>
483
+ <th style="width: 100px;"><?php _e("Slides", 'metaslider') ?></th>
484
+ <th><input class='upload_image_button alignright button-secondary' type='button' value='<?php _e("Add Slide", 'metaslider') ?>' data-uploader_title='<?php _e("Select Slide", 'metaslider') ?>' data-uploader_button_text='<?php _e("Add to slider", 'metaslider') ?>' /></th>
485
  </tr>
486
  </thead>
487
 
488
  <tbody>
489
  <?php
490
+ foreach($this->slider->slides as $slide) {
491
+ $new_window_checked = $slide['target'] == '_blank' ? 'checked=checked' : '';
492
+ $str_caption = __("Caption", 'metaslider');
493
+ $str_new_window = __("New Window", 'metaslider');
494
+ $str_url = __("URL", 'metaslider');
495
 
 
 
 
496
  echo "<tr class='slide'>";
497
+ echo "<td class='col-1'>";
498
+ echo "<div style='position: absolute'><a class='delete-slide confirm' href='?page=metaslider&id={$this->slider->id}&deleteSlide={$slide['id']}'>x</a></div>";
499
+ echo "<img src='{$slide['thumb']}' width='150px'></td>";
500
+ echo "<td class='col-2'>";
501
+ echo "<textarea name='attachment[{$slide['id']}][post_excerpt]' placeholder='{$str_caption}'>{$slide['caption']}</textarea>";
502
+ echo "<input class='url' type='text' name='attachment[{$slide['id']}][url]' placeholder='{$str_url}' value='{$slide['url']}' />";
503
+ echo "<div class='new_window'><label>{$str_new_window}";
504
+ echo "<input type='checkbox' name='attachment[{$slide['id']}][new_window]' {$new_window_checked} />";
505
+ echo "</label></div>";
506
  echo "<input type='hidden' class='menu_order' name='attachment[{$slide['id']}][menu_order]' value={$slide['menu_order']} />";
507
  echo "</td>";
508
  echo "</tr>";
512
  </table>
513
  </div>
514
 
515
+ <div class='right'>
516
  <table class="widefat settings">
517
  <thead>
518
  <tr>
519
+ <th><?php _e("Configuration", 'metaslider') ?></th>
520
  <th>
521
+ <input type='submit' value='<?php _e("Save", 'metaslider') ?>' class='alignright button-primary' />
522
+ <div class='unsaved tooltip' style='display: none;' title='<?php _e("Unsaved Changes", 'metaslider') ?>'>!</div>
523
  </th>
524
  </tr>
525
  </thead>
526
  <tbody>
527
  <tr>
528
+ <td colspan='2'>
529
  <div class='slider-lib nivo'>
530
  <label for='nivo' title='Version: 3.2<br />Responsive: Yes<br />Effects: 14<br />Size: 12kb<br />Mobile Friendly: Yes<br />Themes: 4' class='tooltiptop'>NivoSlider</label>
531
+ <input class="select-slider" id='nivo' rel='nivo' type='radio' name="settings[type]" <?php if ($this->slider->get_setting('type') == 'nivo') echo 'checked=checked' ?> value='nivo' />
532
  </div>
533
  <div class='slider-lib coin'>
534
  <label for='coin' title='Version: 1.0<br />Responsive: No<br />Effects: 4<br />Size: 8kb<br />Mobile Friendly: Yes' class='tooltiptop'>CoinSlider</label>
535
+ <input class="select-slider" id='coin' rel='coin' type='radio' name="settings[type]" <?php if ($this->slider->get_setting('type') == 'coin') echo 'checked=checked' ?> value='coin' />
536
  </div>
537
  <div class='slider-lib flex'>
538
  <label for='flex' title='Version: 2.1<br />Responsive: Yes<br />Effects: 2<br />Size: 17kb<br />Mobile Friendly: Yes' class='tooltiptop'>FlexSlider</label>
539
+ <input class="select-slider" id='flex' rel='flex' type='radio' name="settings[type]" <?php if ($this->slider->get_setting('type') == 'flex') echo 'checked=checked' ?> value='flex' />
540
  </div>
541
  <div class='slider-lib responsive'>
542
  <label for='responsive' title='Version: 1.53<br />Responsive: Yes<br />Effects: 1<br />Size: 3kb<br />Mobile Friendly: Yes' class='tooltiptop'>Responsive</label>
543
+ <input class="select-slider" id='responsive' rel='responsive' type='radio' name="settings[type]" <?php if ($this->slider->get_setting('type') == 'responsive') echo 'checked=checked' ?> value='responsive' />
544
  </div>
545
  </td>
546
  </tr>
547
  <tr>
548
+ <td class='tooltip' title="<?php _e("Set the initial size for the slides (width x height)", 'metaslider') ?>">
549
+ <?php _e("Size", 'metaslider') ?>
550
+ </td>
551
  <td>
552
+ <input type='text' size='3' name="settings[width]" value='<?php echo $this->slider->get_setting('width') ?>' />px X
553
+ <input type='text' size='3' name="settings[height]" value='<?php echo $this->slider->get_setting('height') ?>' />px
554
  </td>
555
  </tr>
556
  <tr>
557
+ <td class='tooltip' title="<?php _e("Slide transition effect", 'metaslider') ?>">
558
+ <?php _e("Effect", 'metaslider') ?>
559
+ </td>
560
  <td>
561
  <select name="settings[effect]" class='effect option coin nivo flex'>
562
+ <option class='option coin nivo' value='random' <?php if ($this->slider->get_setting('effect') == 'random') echo 'selected=selected' ?>>Random</option>
563
+ <option class='option coin' value='swirl' <?php if ($this->slider->get_setting('effect') == 'swirl') echo 'selected=selected' ?>>Swirl</option>
564
+ <option class='option coin' value='rain' <?php if ($this->slider->get_setting('effect') == 'rain') echo 'selected=selected' ?>>Rain</option>
565
+ <option class='option coin' value='straight' <?php if ($this->slider->get_setting('effect') == 'straight') echo 'selected=selected' ?>>Straight</option>
566
+ <option class='option nivo' value='sliceDown' <?php if ($this->slider->get_setting('effect') == 'sliceDown') echo 'selected=selected' ?>>Slice Down</option>
567
+ <option class='option nivo' value='sliceUp' <?php if ($this->slider->get_setting('effect') == 'sliceUp') echo 'selected=selected' ?>>Slice Up</option>
568
+ <option class='option nivo' value='sliceUpLeft' <?php if ($this->slider->get_setting('effect') == 'sliceUpLeft') echo 'selected=selected' ?>>Slice Up Left</option>
569
+ <option class='option nivo' value='sliceUpDown' <?php if ($this->slider->get_setting('effect') == 'sliceUpDown') echo 'selected=selected' ?>>Slice Up Down</option>
570
+ <option class='option nivo' value='sliceUpDownLeft' <?php if ($this->slider->get_setting('effect') == 'sliceUpDownLeft') echo 'selected=selected' ?>>Slice Up Down Left</option>
571
+ <option class='option nivo' value='fold' <?php if ($this->slider->get_setting('effect') == 'fold') echo 'selected=selected' ?>>Fold</option>
572
+ <option class='option nivo flex' value='fade' <?php if ($this->slider->get_setting('effect') == 'fade') echo 'selected=selected' ?>>Fade</option>
573
+ <option class='option nivo' value='slideInRight' <?php if ($this->slider->get_setting('effect') == 'slideInRight') echo 'selected=selected' ?>>Slide In Right</option>
574
+ <option class='option nivo' value='slideInLeft' <?php if ($this->slider->get_setting('effect') == 'slideInLeft') echo 'selected=selected' ?>>Slide In Left</option>
575
+ <option class='option nivo' value='boxRandom' <?php if ($this->slider->get_setting('effect') == 'boxRandom') echo 'selected=selected' ?>>Box Random</option>
576
+ <option class='option nivo' value='boxRain' <?php if ($this->slider->get_setting('effect') == 'boxRain') echo 'selected=selected' ?>>Box Rain</option>
577
+ <option class='option nivo' value='boxRainReverse' <?php if ($this->slider->get_setting('effect') == 'boxRainReverse') echo 'selected=selected' ?>>Box Rain Reverse</option>
578
+ <option class='option nivo' value='boxRainGrowReverse' <?php if ($this->slider->get_setting('effect') == 'boxRainGrowReverse') echo 'selected=selected' ?>>Box Rain Grow Reverse</option>
579
+ <option class='option flex' value='slide' <?php if ($this->slider->get_setting('effect') == 'slide') echo 'selected=selected' ?>>Slide</option>
580
  </select>
581
  </td>
582
  </tr>
583
  <tr>
584
+ <td class='tooltip' title="<?php _e("Change the slider style", 'metaslider') ?>">
585
+ <?php _e("Theme", 'metaslider') ?>
586
+ </td>
587
  <td>
588
  <select class='option nivo' name="settings[theme]">
589
+ <option value='default' <?php if ($this->slider->get_setting('theme') == 'default') echo 'selected=selected' ?>>Default</option>
590
+ <option value='dark' <?php if ($this->slider->get_setting('theme') == 'dark') echo 'selected=selected' ?>>Dark</option>
591
+ <option value='light' <?php if ($this->slider->get_setting('theme') == 'light') echo 'selected=selected' ?>>Light</option>
592
+ <option value='bar' <?php if ($this->slider->get_setting('theme') == 'bar') echo 'selected=selected' ?>>Bar</option>
593
  </select>
594
  </td>
595
  </tr>
596
  <tr>
597
+ <td class='tooltip' title="<?php _e("Show slide navigation row", 'metaslider') ?>">
598
+ <?php _e("Show Navigation", 'metaslider') ?>
599
+ </td>
600
  <td>
601
+ <input class='option coin responsive nivo flex' type='checkbox' name="settings[navigation]" <?php if ($this->slider->get_setting('navigation') == 'true') echo 'checked=checked' ?> />
 
602
  </td>
603
  </tr>
604
  <tr>
605
+ <td class='tooltip' title="<?php _e("Show previous and next links", 'metaslider') ?>">
606
+ <?php _e("Show Links", 'metaslider') ?>
607
+ </td>
608
  <td>
609
+ <input class='option responsive nivo flex' type='checkbox' name="settings[links]" <?php if ($this->slider->get_setting('links') == 'true') echo 'checked=checked' ?> />
610
  </td>
611
  </tr>
612
  <tr>
613
+ <td class='tooltip' title="<?php _e("Pause the slideshow when hovering over slider, then resume when no longer hovering", 'metaslider') ?>">
614
+ <?php _e("Hover pause", 'metaslider') ?>
615
+ </td>
616
+ <td>
617
+ <input class='option coin flex responsive nivo' type='checkbox' name="settings[hoverPause]" <?php if ($this->slider->get_setting('hoverPause') == 'true') echo 'checked=checked' ?> />
618
+ </td>
619
  </tr>
620
  <tr>
621
+ <td class='tooltip' title="<?php _e("How long to display each slide, in milliseconds", 'metaslider') ?>">
622
+ <?php _e("Slide delay", 'metaslider') ?>
623
+ </td>
624
+ <td>
625
+ <input class='option coin flex responsive nivo' type='text' size='5' name="settings[delay]" value='<?php echo $this->slider->get_setting('delay') ?>' />ms
626
+ </td>
627
  </tr>
628
  <tr>
629
+ <td class='tooltip' title="<?php _e("Randomise the order of the slides", 'metaslider') ?>">
630
+ <?php _e("Random", 'metaslider') ?>
631
+ </td>
632
+ <td>
633
+ <input type='checkbox' name="settings[random]" <?php if ($this->slider->get_setting('random') == 'true') echo 'checked=checked' ?> />
634
+ </td>
635
  </tr>
636
  <tr>
637
+ <td class='tooltip' title="<?php _e("Select the sliding direction", 'metaslider') ?>"><?php _e("Direction", 'metaslider') ?></td>
638
+ <td>
639
+ <select class='option flex' name="settings[direction]">
640
+ <option value='horizontal' <?php if ($this->slider->get_setting('direction') == 'horizontal') echo 'selected=selected' ?>>Horizontal</option>
641
+ <option value='vertical' <?php if ($this->slider->get_setting('direction') == 'vertical') echo 'selected=selected' ?>>Vertical</option>
642
+ </select>
643
+ </td>
644
  </tr>
645
  <tr>
646
+ <td class='tooltip' title="<?php _e("Set the text for the 'previous' direction item", 'metaslider') ?>">
647
+ <?php _e("Previous text", 'metaslider') ?>
648
+ </td>
649
+ <td>
650
+ <input class='option flex responsive nivo' type='text' name="settings[prevText]" value='<?php if ($this->slider->get_setting('prevText') != 'false') echo $this->slider->get_setting('prevText') ?>' />
651
+ </td>
652
  </tr>
653
  <tr>
654
+ <td class='tooltip' title="<?php _e("Set the text for the 'next' direction item", 'metaslider') ?>">
655
+ <?php _e("Next text", 'metaslider') ?>
656
+ </td>
657
  <td>
658
+ <input class='option flex responsive nivo' type='text' name="settings[nextText]" value='<?php if ($this->slider->get_setting('nextText') != 'false') echo $this->slider->get_setting('nextText') ?>' />
659
  </td>
660
  </tr>
661
  <tr>
662
+ <td colspan='2' class='highlight'><?php _e("Advanced Settings", 'metaslider') ?></td>
663
+ </tr>
664
+ <tr>
665
+ <td class='tooltip' title="<?php _e("Reverse the animation direction", 'metaslider') ?>">
666
+ <?php _e("Reverse", 'metaslider') ?>
667
+ </td>
668
  <td>
669
+ <input class='option flex' type='checkbox' name="settings[reverse]" <?php if ($this->slider->get_setting('reverse') == 'true') echo 'checked=checked' ?> />
670
  </td>
671
  </tr>
672
  <tr>
673
+ <td class='tooltip' title="<?php _e("Number of squares (width x height)", 'metaslider') ?>">
674
+ <?php _e("Number of squares", 'metaslider') ?>
675
+ </td>
676
  <td>
677
+ <input class='option coin nivo' type='text' size='2' name="settings[spw]" value='<?php echo $this->slider->get_setting('spw') ?>' /> x
678
+ <input class='option coin nivo' type='text' size='2' name="settings[sph]" value='<?php echo $this->slider->get_setting('sph') ?>' />
679
  </td>
680
  </tr>
681
  <tr>
682
+ <td class='tooltip' title="<?php _e("Number of slices", 'metaslider') ?>">
683
+ <?php _e("Number of slices", 'metaslider') ?>
684
+ </td>
685
  <td>
686
+ <input class='option nivo' type='text' size='2' name="settings[slices]" value='<?php echo $this->slider->get_setting('slices') ?>' />
687
  </td>
688
  </tr>
689
  <tr>
690
+ <td class='tooltip' title="<?php _e("Delay beetwen squares in ms", 'metaslider') ?>">
691
+ <?php _e("Square delay", 'metaslider') ?>
692
+ </td>
693
  <td>
694
+ <input class='option coin' type='text' size='5' name="settings[sDelay]" value='<?php echo $this->slider->get_setting('sDelay') ?>' />ms
695
  </td>
696
  </tr>
697
  <tr>
698
+ <td class='tooltip' title="<?php _e("Opacity of title and navigation", 'metaslider') ?>">
699
+ <?php _e("Opacity", 'metaslider') ?>
700
+ </td>
701
  <td>
702
+ <input class='option coin' type='text' size='5' name="settings[opacity]" value='<?php echo $this->slider->get_setting('opacity') ?>' />
703
  </td>
704
  </tr>
705
  <tr>
706
+ <td class='tooltip' title="<?php _e("Set the fade in speef of the caption", 'metaslider') ?>">
707
+ <?php _e("Caption speed", 'metaslider') ?>
708
+ </td>
709
  <td>
710
+ <input class='option coin' type='text' size='5' name="settings[titleSpeed]" value='<?php echo $this->slider->get_setting('titleSpeed') ?>' />ms
711
  </td>
712
  </tr>
713
  <tr>
714
+ <td class='tooltip' title="<?php _e("Set the speed of animations, in milliseconds", 'metaslider') ?>">
715
+ <?php _e("Animation speed", 'metaslider') ?>
716
+ </td>
717
  <td>
718
+ <input class='option flex responsive nivo' type='text' size='5' name="settings[animationSpeed]" value='<?php echo $this->slider->get_setting('animationSpeed') ?>' />ms
 
 
 
719
  </td>
720
  </tr>
721
  <tr>
722
+ <td colspan='2' class='highlight'><?php _e("Developer Options", 'metaslider') ?></td>
 
 
723
  </tr>
724
  <tr>
725
+ <td class='tooltip' title="<?php _e("Specify any custom CSS Classes you would like to be added to the slider wrapper", 'metaslider') ?>">
726
+ <?php _e("CSS classes", 'metaslider') ?>
727
+ </td>
728
+ <td>
729
+ <input type='text' name="settings[cssClass]" value='<?php if ($this->slider->get_setting('cssClass') != 'false') echo $this->slider->get_setting('cssClass') ?>' />
730
+ </td>
731
  </tr>
732
  <tr>
733
+ <td class='tooltip' title="<?php _e("Uncheck this is you would like to include your own CSS", 'metaslider') ?>">
734
+ <?php _e("Print CSS", 'metaslider') ?>
735
+ </td>
736
+ <td>
737
+ <input type='checkbox' name="settings[printCss]" <?php if ($this->slider->get_setting('printCss') == 'true') echo 'checked=checked' ?> />
738
+ </td>
739
+ </tr>
740
+ <tr>
741
+ <td class='tooltip' title="<?php _e("Uncheck this is you would like to include your own Javascript", 'metaslider') ?>">
742
+ <?php _e("Print JS", 'metaslider') ?>
743
+ </td>
744
+ <td>
745
+ <input type='checkbox' name="settings[printJs]" <?php if ($this->slider->get_setting('printJs') == 'true') echo 'checked=checked' ?> />
746
+ </td>
747
  </tr>
748
  </tbody>
749
  </table>
750
 
751
+ <table class="widefat shortcode">
752
  <thead>
753
  <tr>
754
+ <th><?php _e("Usage", 'metaslider') ?></th>
755
  </tr>
756
  </thead>
757
 
758
  <tbody>
759
  <tr>
760
+ <td class='highlight'><?php _e("Shortcode", 'metaslider') ?></td>
761
+ </tr>
762
+ <tr>
763
+ <td><input readonly='readonly' type='text' value='[metaslider id=<?php echo $this->slider->id ?>]' /></td>
764
+ </tr>
765
+ <tr>
766
+ <td class='highlight'><?php _e("Template Include", 'metaslider') ?></td>
767
+ </tr>
768
+ <tr>
769
+ <td><input readonly='readonly' type='text' value='&lt;?php echo do_shortcode("[metaslider id=<?php echo $this->slider->id ?>]"); ?>' /></td>
770
  </tr>
771
  </tbody>
772
+
773
  </table>
774
 
775
  <br />
776
+ <a class='alignright button-secondary confirm' href="?page=metaslider&delete=<?php echo $this->slider->id ?>"><?php _e("Delete Slider", 'metaslider') ?></a>
777
  </div>
778
  </form>
779
  </div>
780
  <?php
781
  }
782
  }
783
+
784
+ $metaslider = new MetaSliderPlugin();
785
  ?>
readme.txt CHANGED
@@ -1,20 +1,27 @@
1
  === Plugin Name ===
2
  Contributors: matchalabs
3
- Tags: wordpress slider,slider,slides,slideshow,wordpress slideshow,image slider,flexslider,flex,flex slider,nivoslider,nivo,nivo slider,responsiveslides,responsive,responsive slides,coinslider,coin,coin slider,slideshow,carousel,responsive slider,slider plugin,vertical slides,ml slider,image rotator
4
  Requires at least: 3.5
5
  Tested up to: 3.5
6
- Stable tag: 1.2.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  4 image sliders in 1! Choose from Nivo Slider, Flex Slider, Coin Slider or Responsive Slides.
11
 
12
  == Description ==
13
- ML Slider is a clean slideshow management plugin that leaves the heavy lifting to a selection of popular jQuery slider plugins - the choice is yours. ML Slider builds upon standard WordPress functionality wherever possible; slideshows are stored as a custom post type, slides are stored as media files and the relation between the two is stored as taxonomy data.
14
 
15
- http://www.youtube.com/watch?v=SdPKN7rTfM8
 
 
 
16
 
17
- ML Slider Features:
 
 
 
 
18
 
19
  * Intuitive administration panel
20
  * Create unlimited slideshows with unlimited number of slides
@@ -27,10 +34,11 @@ ML Slider Features:
27
  * Option to include your own CSS
28
  * Lightweight, only the bare minimum in terms of JavaScript and CSS is outputted to your website
29
  * Built in shortcode
 
30
 
31
  Slider Features:
32
 
33
- * 18 transition effects
34
  * 4 themes (Nivo Slider)
35
  * Responsive (Nivo Slider, Flex Slider 2, Responsive Slides)
36
  * Adjust slider libary options such as: speed, theme, hover pause, width, height
@@ -46,17 +54,17 @@ Read more and thanks to:
46
 
47
  1. Upload the `ml-slider` folder to the `/wp-content/plugins/` directory
48
  1. Activate the plugin through the 'Plugins' menu in WordPress
49
- 1. Manage your slideshows using the 'ML Slider' menu option
50
 
51
  == Frequently Asked Questions ==
52
 
53
  = How do I include a slideshow directly in my templates? =
54
 
55
- `<?php echo do_shortcode("[ml-slider id=#]") ?>`
56
 
57
  = Why are some effects/options greyed out? =
58
 
59
- The effects are enabled/disabled depending on which library you have selected.
60
 
61
  For example, flex slider supports the 'Fade' and 'Slide' effect whereas coin slider supports 'Random', 'Swirl', 'Straight' and 'Rain'. Unavailable options are greyed out.
62
 
@@ -71,9 +79,22 @@ For example, flex slider supports the 'Fade' and 'Slide' effect whereas coin sli
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  = 1.2.1 =
75
  * Fix: Number of slides per slideshow limited to WordPress 'blog pages show at most' setting (reported by and thanks to: Kenny)
76
- * Fix: Add warning when BMP file is added to slider (reported by and thanks to MadBong)
77
  * Fix: Allow images smaller than default thumbnail size to be added to slider (reported by and thanks to: MadBong)
78
 
79
  = 1.2 =
@@ -95,3 +116,8 @@ For example, flex slider supports the 'Fade' and 'Slide' effect whereas coin sli
95
 
96
  = 1.0 =
97
  * Initial version
 
 
 
 
 
1
  === Plugin Name ===
2
  Contributors: matchalabs
3
+ Tags: wordpress slider,slider,slides,slideshow,wordpress slideshow,image slider,flexslider,flex,flex slider,nivoslider,nivo,nivo slider,responsiveslides,responsive,responsive slides,coinslider,coin,coin slider,slideshow,carousel,responsive slider,slider plugin,vertical slides,ml slider,image rotator,metaslider, meta
4
  Requires at least: 3.5
5
  Tested up to: 3.5
6
+ Stable tag: 1.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  4 image sliders in 1! Choose from Nivo Slider, Flex Slider, Coin Slider or Responsive Slides.
11
 
12
  == Description ==
13
+ Meta Slider is a flexible, intuitive slideshow administration plugin with that leaves the heavy lifting to a selection of open source jQuery libraries. The choice is yours:
14
 
15
+ * Nivo Slider (Responsive, 16 transition effects, 4 themes)
16
+ * Flex Slider 2 (Responsive, 2 transition effects)
17
+ * Coin Slider (4 transition effects)
18
+ * Responsive Slides (Responsive, fade effect only, incredibly light weight!)
19
 
20
+ The plugin builds upon standard WordPress functionality wherever possible; slideshows are stored as a custom post type, slides are stored as media files and the relation between the two is stored as taxonomy data.
21
+
22
+ http://www.youtube.com/watch?v=uGSEc8dfiPA
23
+
24
+ Meta Slider Features:
25
 
26
  * Intuitive administration panel
27
  * Create unlimited slideshows with unlimited number of slides
34
  * Option to include your own CSS
35
  * Lightweight, only the bare minimum in terms of JavaScript and CSS is outputted to your website
36
  * Built in shortcode
37
+ * Supports localisation
38
 
39
  Slider Features:
40
 
41
+ * Total of 18 transition effects
42
  * 4 themes (Nivo Slider)
43
  * Responsive (Nivo Slider, Flex Slider 2, Responsive Slides)
44
  * Adjust slider libary options such as: speed, theme, hover pause, width, height
54
 
55
  1. Upload the `ml-slider` folder to the `/wp-content/plugins/` directory
56
  1. Activate the plugin through the 'Plugins' menu in WordPress
57
+ 1. Manage your slideshows using the 'MetaSlider' menu option
58
 
59
  == Frequently Asked Questions ==
60
 
61
  = How do I include a slideshow directly in my templates? =
62
 
63
+ `<?php echo do_shortcode("[metaslider id=#]") ?>`
64
 
65
  = Why are some effects/options greyed out? =
66
 
67
+ The effects are enabled/disabled depending on which slider library you have selected.
68
 
69
  For example, flex slider supports the 'Fade' and 'Slide' effect whereas coin slider supports 'Random', 'Swirl', 'Straight' and 'Rain'. Unavailable options are greyed out.
70
 
79
 
80
  == Changelog ==
81
 
82
+ = 1.3 =
83
+ * Renamed to Meta Slider (previously ML Slider)
84
+ * Improvement: Admin styling cleaned up
85
+ * Improvement: Code refactored
86
+ * Improvement: Plugin localised
87
+ * Improvement: Template include PHP code now displayed on slider edit page
88
+ * Improvement: jQuery tablednd replaced with jQuery sortable for reordering slides
89
+ * Improvement: Open URL in new window option added
90
+ * Improvement: max-width css rule added to slider wrapper
91
+ * Fix: UTF-8 support in captions (reported by and thanks to: petergluk)
92
+ * Fix: JS && encoding error (reported by and thanks to: neefje)
93
+ * Fix: Editors now have permission to use MetaSlider (reported by and thanks to: rritsud)
94
+
95
  = 1.2.1 =
96
  * Fix: Number of slides per slideshow limited to WordPress 'blog pages show at most' setting (reported by and thanks to: Kenny)
97
+ * Fix: Add warning when BMP file is added to slider (reported by and thanks to: MadBong)
98
  * Fix: Allow images smaller than default thumbnail size to be added to slider (reported by and thanks to: MadBong)
99
 
100
  = 1.2 =
116
 
117
  = 1.0 =
118
  * Initial version
119
+
120
+ == Upgrade Notice ==
121
+
122
+ = 1.3 =
123
+ As part of this update ML Slider will be renamed to MetaSlider. Your shortcodes and slideshows will be unaffected. If you have customised any CSS you should update your CSS files to reference .metaslider rather than .ml-slider. Check the changelog for updates.
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
screenshot-3.png DELETED
Binary file
screenshot-4.png DELETED
Binary file
screenshot-5.png DELETED
Binary file
screenshot-6.png DELETED
Binary file