MetaSlider - Version 1.2.1

Version Description

  • Fix: Number of slides per slideshow limited to WordPress 'blog pages show at most' setting (reported by and thanks to: Kenny)
  • Fix: Add warning when BMP file is added to slider (reported by and thanks to MadBong)
  • Fix: Allow images smaller than default thumbnail size to be added to slider (reported by and thanks to: MadBong)
Download this release

Release Info

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

Code changes from version 1.1 to 1.2.1

Files changed (4) hide show
  1. assets/ml-slider-admin.css +19 -0
  2. assets/ml-slider.js +51 -18
  3. ml-slider.php +213 -97
  4. readme.txt +46 -16
assets/ml-slider-admin.css CHANGED
@@ -1,3 +1,22 @@
1
.ml-slider tr.slide textarea {
2
width: 100%;
3
height: 75px;
1
+ .ml-slider .unsaved {
2
+ float: right;
3
+ background: #ff3019; /* Old browsers */
4
+ background: -moz-linear-gradient(top, #ff3019 0%, #cf0404 100%); /* FF3.6+ */
5
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ff3019), color-stop(100%,#cf0404)); /* Chrome,Safari4+ */
6
+ background: -webkit-linear-gradient(top, #ff3019 0%,#cf0404 100%); /* Chrome10+,Safari5.1+ */
7
+ background: -o-linear-gradient(top, #ff3019 0%,#cf0404 100%); /* Opera 11.10+ */
8
+ background: -ms-linear-gradient(top, #ff3019 0%,#cf0404 100%); /* IE10+ */
9
+ background: linear-gradient(to bottom, #ff3019 0%,#cf0404 100%); /* W3C */
10
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff3019', endColorstr='#cf0404',GradientType=0 ); /* IE6-9 */
11
+ color: white;
12
+ padding: 1px 9px;
13
+ border-radius: 3px;
14
+ margin-top: 2px;
15
+ font-weight: bold;
16
+ font-size: 1em !important;
17
+ text-rendering: optimizeLegibility;
18
+ margin: 2px 10px;
19
+ }
20
.ml-slider tr.slide textarea {
21
width: 100%;
22
height: 75px;
assets/ml-slider.js CHANGED
@@ -41,7 +41,8 @@
41
*/
42
$(".ml-slider table.sortable").tableDnD({
43
onDrop: function() {
44
- updateSlideOrder()
45
}
46
});
47
@@ -70,34 +71,61 @@
70
}
71
72
// Create the media frame.
73
-
74
file_frame = wp.media.frames.file_frame = wp.media({
75
- title: jQuery( this ).data( 'uploader_title' ),
76
- button: {
77
- text: jQuery( this ).data( 'uploader_button_text' ),
78
- },
79
- multiple: false
80
});
81
82
// When an image is selected, run a callback.
83
file_frame.on( 'select', function() {
84
- attachment = file_frame.state().get('selection').first().toJSON();
85
86
- var tableRow = "<tr class='slide'><td>" +
87
- "<div style='position: absolute'>" +
88
- "<a class='delete-slide confirm' href='?page=ml-slider&id=438'>x</a> " +
89
- "</div>" +
90
- "<img src='" + attachment.sizes.thumbnail.url + "' width='150px'></td><td> " +
91
- "<textarea name='attachment[" + attachment.id + "][post_excerpt]' placeholder='Caption'>" + attachment.caption + "</textarea>" +
92
- "<input type='text' name='attachment[" + attachment.id + "][url]' placeholder='URL'>" +
93
- "<input type='hidden' class='menu_order' name='attachment[" + attachment.id + "][menu_order]' value='100'>" +
94
- "</td></tr>";
95
96
- jQuery(".ml-slider .slides tbody").append(tableRow);
97
98
// reindex the slides
99
updateSlideOrder();
100
101
$(".ml-slider table.sortable").tableDnD({
102
onDrop: function() {
103
updateSlideOrder()
@@ -107,5 +135,10 @@
107
108
file_frame.open();
109
});
110
});
111
}(jQuery));
41
*/
42
$(".ml-slider table.sortable").tableDnD({
43
onDrop: function() {
44
+ updateSlideOrder();
45
+ $('.ml-slider .unsaved').fadeIn();
46
}
47
});
48
71
}
72
73
// Create the media frame.
74
file_frame = wp.media.frames.file_frame = wp.media({
75
+ title: jQuery( this ).data( 'uploader_title' ),
76
+ button: {
77
+ text: jQuery( this ).data( 'uploader_button_text' ),
78
+ },
79
+ multiple: 'add'
80
});
81
82
// When an image is selected, run a callback.
83
file_frame.on( 'select', function() {
84
+ var selection = file_frame.state().get('selection');
85
86
+ selection.map( function( attachment ) {
87
88
+ attachment = attachment.toJSON();
89
+
90
+ if (attachment.subtype == 'bmp') {
91
+ alert('Warning: BML images not allowed');
92
+ return;
93
+ }
94
+
95
+ var url = attachment.url;
96
+
97
+ if (typeof(attachment.sizes.thumbnail) != 'undefined') {
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
119
+ // button is clicked
120
+ jQuery(".remove-slide").live('click', function(e){
121
+ e.preventDefault();
122
+ $(this).closest('tr').remove();
123
+ });
124
125
// reindex the slides
126
updateSlideOrder();
127
128
+ // ensure the rows are sortable
129
$(".ml-slider table.sortable").tableDnD({
130
onDrop: function() {
131
updateSlideOrder()
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));
ml-slider.php CHANGED
@@ -3,7 +3,7 @@
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.1
7
* Author: Matcha Labs
8
* Author URI: http://www.matchalabs.com
9
* License: GPL
@@ -14,7 +14,7 @@
14
* GNU General Public License for more details.
15
*/
16
17
- define( 'MLSLIDER_VERSION', '1.1' );
18
define( 'MLSLIDER_BASE_URL', plugin_dir_url( __FILE__ ) );
19
define( 'MLSLIDER_ASSETS_URL', MLSLIDER_BASE_URL . 'assets/' );
20
@@ -234,6 +234,7 @@ class MLSlider {
234
'order' => 'ASC',
235
'post_type' => 'attachment',
236
'post_status' => 'inherit',
237
'tax_query' => array(
238
array(
239
'taxonomy' => 'ml-slider',
@@ -254,9 +255,9 @@ class MLSlider {
254
'id' => $query->post->ID,
255
'type' => 'image',
256
'url' => get_post_meta($query->post->ID, 'ml-slider_url', true),
257
- 'caption' => $query->post->post_excerpt,
258
'src' => $image_attributes[0],
259
- 'alt' => get_post_meta($query->post->ID, '_wp_attachment_image_alt', true),
260
'menu_order' => $query->post->menu_order
261
);
262
}
@@ -325,7 +326,6 @@ class MLSlider {
325
* Update slider settings
326
*/
327
private function handle_update_slider_settings() {
328
- // update options
329
if (isset($_POST['settings'])) {
330
$old_settings = get_post_meta($this->get_slider(), 'ml-slider_settings', true);
331
$new_settings = $_POST['settings'];
@@ -353,7 +353,6 @@ class MLSlider {
353
* Update slider title
354
*/
355
private function handle_update_slider_title() {
356
- // update title
357
if (isset($_POST['title'])) {
358
$slide = array(
359
'ID' => $this->get_slider(),
@@ -371,7 +370,6 @@ class MLSlider {
371
* @return bool true if the slide was untagged
372
*/
373
private function handle_delete_slide() {
374
- // delete slide
375
if (isset($_GET['deleteSlide'])) {
376
$slideToUntagFromCurrentSlider = $_GET['deleteSlide'];
377
@@ -402,7 +400,7 @@ class MLSlider {
402
$term = get_term_by('name', $this->get_slider(), 'ml-slider');
403
404
// tag this slide to the taxonomy term
405
- wp_set_post_terms($id, $term->term_id, 'ml-slider', false);
406
407
// update the slide
408
wp_update_post(array(
@@ -435,7 +433,6 @@ class MLSlider {
435
* Delete a slider
436
*/
437
private function handle_delete_slider() {
438
- // delete slider
439
if (isset($_GET['delete'])) {
440
$slide = array(
441
'ID' => intVal($_GET['delete']),
@@ -476,14 +473,198 @@ class MLSlider {
476
}
477
478
479
/**
480
* Return coin slider markup
481
*
482
* @return string coin slider markup.
483
*/
484
- public function get_coin_slider() {
485
- $identifier = 'ml-slider-' . rand();
486
-
487
$retVal = "<div id='" . $identifier . "' class='coin-slider'>";
488
489
foreach ($this->get_slides() as $slide) {
@@ -496,35 +677,15 @@ class MLSlider {
496
497
$retVal .= "</div>";
498
499
- $retVal .= "<script type='text/javascript'>";
500
- $retVal .= "\njQuery(document).ready(function($) {";
501
- $retVal .= "\n $('#" . $identifier . "').coinslider({";
502
- $retVal .= "\n effect: '{$this->get_setting('effect')}',";
503
- $retVal .= "\n width: '{$this->get_setting('width')}',";
504
- $retVal .= "\n height: '{$this->get_setting('height')}',";
505
- $retVal .= "\n spw: '{$this->get_setting('spw')}',";
506
- $retVal .= "\n sph: '{$this->get_setting('sph')}',";
507
- $retVal .= "\n delay: '{$this->get_setting('delay')}',";
508
- $retVal .= "\n sDelay: '{$this->get_setting('sDelay')}',";
509
- $retVal .= "\n opacity: '{$this->get_setting('opacity')}',";
510
- $retVal .= "\n titleSpeed: '{$this->get_setting('titleSpeed')}',";
511
- $retVal .= "\n navigation: {$this->get_setting('navigation')},";
512
- $retVal .= "\n hoverPause: {$this->get_setting('hoverPause')}";
513
- $retVal .= "\n });";
514
- $retVal .= "\n});";
515
- $retVal .= "</script>";
516
-
517
return $retVal;
518
}
519
-
520
/**
521
* Return flexslider markup
522
*
523
* @return string flex slider markup.
524
*/
525
- public function get_flex_slider() {
526
- $identifier = 'ml-slider-' . rand();
527
-
528
$retVal = "<div id='" . $identifier . "' class='flexslider'><ul class='slides'>";
529
530
foreach ($this->get_slides() as $slide) {
@@ -537,24 +698,7 @@ class MLSlider {
537
}
538
539
$retVal .= "</ul></div>";
540
-
541
- $retVal .= "<script type='text/javascript'>";
542
- $retVal .= "\njQuery(document).ready(function($) {";
543
- $retVal .= "\n $('#" . $identifier . "').flexslider({";
544
- $retVal .= "\n animation: '{$this->get_setting('effect')}',";
545
- $retVal .= "\n direction: '{$this->get_setting('direction')}',";
546
- $retVal .= "\n reverse: {$this->get_setting('reverse')},";
547
- $retVal .= "\n slideshowSpeed: {$this->get_setting('delay')},";
548
- $retVal .= "\n pauseOnHover: {$this->get_setting('hoverPause')},";
549
- $retVal .= "\n animationSpeed: {$this->get_setting('animationSpeed')},";
550
- $retVal .= "\n controlNav: {$this->get_setting('navigation')},";
551
- $retVal .= "\n directionNav: {$this->get_setting('links')},";
552
- $retVal .= "\n prevText: '{$this->get_setting('prevText')}',";
553
- $retVal .= "\n nextText: '{$this->get_setting('nextText')}',";
554
- $retVal .= "\n });";
555
- $retVal .= "\n});";
556
- $retVal .= "</script>";
557
-
558
return $retVal;
559
}
560
@@ -563,9 +707,7 @@ class MLSlider {
563
*
564
* @return string responsive slider markup.
565
*/
566
- public function get_responsive_slider() {
567
- $identifier = 'ml-slider-' . rand();
568
-
569
$retVal = "<ul id='" . $identifier . "' class='rslides'>";
570
571
foreach ($this->get_slides() as $slide) {
@@ -578,21 +720,6 @@ class MLSlider {
578
579
$retVal .= "</ul>";
580
581
- $retVal .= "<script type='text/javascript'>";
582
- $retVal .= "\njQuery(document).ready(function($) {";
583
- $retVal .= "\n $('#" . $identifier . "').responsiveSlides({";
584
- $retVal .= "\n timeout: {$this->get_setting('delay')},";
585
- $retVal .= "\n pause: {$this->get_setting('hoverPause')},";
586
- $retVal .= "\n pauseControls: {$this->get_setting('hoverPause')},";
587
- $retVal .= "\n speed: {$this->get_setting('animationSpeed')},";
588
- $retVal .= "\n pager: {$this->get_setting('navigation')},";
589
- $retVal .= "\n nav: {$this->get_setting('links')},";
590
- $retVal .= "\n prevText: '{$this->get_setting('prevText')}',";
591
- $retVal .= "\n nextText: '{$this->get_setting('nextText')}',";
592
- $retVal .= "\n });";
593
- $retVal .= "\n});";
594
- $retVal .= "</script>";
595
-
596
return $retVal;
597
}
598
@@ -601,9 +728,7 @@ class MLSlider {
601
*
602
* @return string nivo slider markup.
603
*/
604
- public function get_nivo_slider() {
605
- $identifier = 'ml-slider-' . rand();
606
-
607
$retVal = "<div class='slider-wrapper theme-{$this->get_setting('theme')}'>";
608
$retVal .= "<div class='ribbon'></div>";
609
$retVal .= "<div id='" . $identifier . "' class='nivoSlider'>";
@@ -616,24 +741,6 @@ class MLSlider {
616
617
$retVal .= "</div></div>";
618
619
- $retVal .= "<script type='text/javascript'>";
620
- $retVal .= "\njQuery(document).ready(function($) {";
621
- $retVal .= "\n $('#" . $identifier . "').nivoSlider({";
622
- $retVal .= "\n effect: '{$this->get_setting('effect')}',";
623
- $retVal .= "\n slices: {$this->get_setting('slices')},";
624
- $retVal .= "\n pauseTime: {$this->get_setting('delay')},";
625
- $retVal .= "\n animSpeed: {$this->get_setting('animationSpeed')},";
626
- $retVal .= "\n pauseOnHover: {$this->get_setting('hoverPause')},";
627
- $retVal .= "\n boxCols: {$this->get_setting('spw')},";
628
- $retVal .= "\n boxRows: {$this->get_setting('sph')},";
629
- $retVal .= "\n controlNav: {$this->get_setting('navigation')},";
630
- $retVal .= "\n directionNav: {$this->get_setting('links')},";
631
- $retVal .= "\n prevText: '{$this->get_setting('prevText')}',";
632
- $retVal .= "\n nextText: '{$this->get_setting('nextText')}',";
633
- $retVal .= "\n });";
634
- $retVal .= "\n});";
635
- $retVal .= "</script>";
636
-
637
return $retVal;
638
}
639
@@ -661,6 +768,8 @@ class MLSlider {
661
662
$this->set_slider($id);
663
664
// coinslider
665
if ($this->get_setting('type') == 'coin') {
666
if ($this->get_setting('printJs') == 'true') {
@@ -671,7 +780,8 @@ class MLSlider {
671
wp_enqueue_style('ml-slider_coin_slider_css', plugins_url('ml-slider/assets/coinslider/coin-slider-styles.css'));
672
}
673
674
- $retVal = $this->get_coin_slider();
675
}
676
677
// flex
@@ -684,7 +794,8 @@ class MLSlider {
684
wp_enqueue_style('ml-slider_flex_slider_css', plugins_url('ml-slider/assets/flexslider/flexslider.css'));
685
}
686
687
- $retVal = $this->get_flex_slider();
688
}
689
690
// responsive
@@ -697,7 +808,8 @@ class MLSlider {
697
wp_enqueue_style('ml-slider_responsive_slides_css', plugins_url('ml-slider/assets/responsiveslides/responsiveslides.css'));
698
}
699
700
- $retVal = $this->get_responsive_slider();
701
}
702
703
// nivo
@@ -711,7 +823,8 @@ class MLSlider {
711
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'));
712
}
713
714
- $retVal = $this->get_nivo_slider();
715
}
716
717
return "<div class='ml-slider ml-slider-{$this->get_setting('type')} {$this->get_setting('cssClass')}'>" . $retVal . "</div>";
@@ -745,7 +858,7 @@ class MLSlider {
745
}
746
?>
747
748
- <a href="?page=ml-slider&add=true" id="create_new_tab" class="nav-tab">+</a>
749
</h2>
750
751
<?php
@@ -791,7 +904,10 @@ class MLSlider {
791
<thead>
792
<tr>
793
<th colspan="2">Settings</th>
794
- <th><input type='submit' value='Save' class='alignright button-primary' /></th>
795
</tr>
796
</thead>
797
<tbody>
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
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
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',
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
}
326
* Update slider settings
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'];
353
* Update slider title
354
*/
355
private function handle_update_slider_title() {
356
if (isset($_POST['title'])) {
357
$slide = array(
358
'ID' => $this->get_slider(),
370
* @return bool true if the slide was untagged
371
*/
372
private function handle_delete_slide() {
373
if (isset($_GET['deleteSlide'])) {
374
$slideToUntagFromCurrentSlider = $_GET['deleteSlide'];
375
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);
404
405
// update the slide
406
wp_update_post(array(
433
* Delete a slider
434
*/
435
private function handle_delete_slider() {
436
if (isset($_GET['delete'])) {
437
$slide = array(
438
'ID' => intVal($_GET['delete']),
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) {
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) {
698
}
699
700
$retVal .= "</ul></div>";
701
+
702
return $retVal;
703
}
704
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) {
720
721
$retVal .= "</ul>";
722
723
return $retVal;
724
}
725
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'>";
741
742
$retVal .= "</div></div>";
743
744
return $retVal;
745
}
746
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') {
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
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
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
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>";
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
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>
readme.txt CHANGED
@@ -1,39 +1,46 @@
1
=== Plugin Name ===
2
Contributors: matchalabs
3
- Tags: flexslider,flex,flex slider,nivoslider,nivo,nivo slider,responsiveslides,responsive, responsive slides,slider,coinslider,coin,coin slider,slideshow,carousel,wordpress slider,responsive slider,slider plugin,photos,picture,vertical slides,ml slider,image rotator,wordpress slideshow,image slider
4
Requires at least: 3.5
5
Tested up to: 3.5
6
- Stable tag: 1.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 attachments.
14
15
- Use the intuitive administration panel to manage your slideshows.
16
17
- Add multiple slideshows to pages, posts and templates using the built in shortcode.
18
19
- Features:
20
-
21
- * Create unlimited slideshows with unlimited number of slides
22
* Intuitive administration panel
23
- * Choose slider library from Nivo Slider, Flex Slider, Coin Slider or Responsive Slides (per slideshow)
24
* Add captions to slides
25
* Add URLs to slides
26
- * 18 transition effects
27
- * 4 themes (Nivo Slider)
28
* Reorder slides with drag and drop
29
- * Integrated with WordPress media manager
30
* Create new slides from your Media Library, or upload new images
31
- * Responsive (Nivo Slider, Flex Slider, Responsive Slides)
32
* Mix & Match! Include as many slideshows on the same page as you want
33
- * Configure each slideshow with the chosen slider library options
34
- * Adjust slider libary options such as: speed, theme, hover pause, width, height
35
* Option to include your own CSS
36
* Lightweight, only the bare minimum in terms of JavaScript and CSS is outputted to your website
37
38
== Installation ==
39
@@ -43,6 +50,16 @@ Features:
43
44
== Frequently Asked Questions ==
45
46
== Screenshots ==
47
48
1. Administration panel - overview
@@ -54,6 +71,19 @@ Features:
54
55
== Changelog ==
56
57
= 1.1 =
58
* Improvement: Code refactored
59
* Fix: hitting [enter] brings up Media Library
@@ -64,4 +94,4 @@ Features:
64
* Fix: min version incorrect (should be 3.5)
65
66
= 1.0 =
67
- * 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
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
21
+ * Choose slider library from Nivo Slider, Flex Slider 2, Coin Slider or Responsive Slides (per slideshow)
22
* Add captions to slides
23
* Add URLs to slides
24
* Reorder slides with drag and drop
25
* Create new slides from your Media Library, or upload new images
26
* Mix & Match! Include as many slideshows on the same page as you want
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
37
+
38
+ Read more and thanks to:
39
+
40
+ * [http://flexslider.woothemes.com/](http://flexslider.woothemes.com/)
41
+ * [http://responsive-slides.viljamis.com/](http://responsive-slides.viljamis.com/)
42
+ * [http://workshop.rs/projects/coin-slider/](http://workshop.rs/projects/coin-slider/)
43
+ * [http://dev7studios.com/nivo-slider/](http://dev7studios.com/nivo-slider/)
44
45
== Installation ==
46
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
+
63
== Screenshots ==
64
65
1. Administration panel - overview
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 =
80
+ * Improvement: Code refactored
81
+ * Fix: Unable to assign the same image to more than one slider
82
+ * Fix: JavaScript error when jQuery is loaded in page footer
83
+ * Improvement: Warning notice when the slider has unsaved changes
84
+ * Fix: Captions not being escaped (reported by and thanks to: papabeers)
85
+ * Improvement: Add multiple files to slider from Media Browser
86
+
87
= 1.1 =
88
* Improvement: Code refactored
89
* Fix: hitting [enter] brings up Media Library
94
* Fix: min version incorrect (should be 3.5)
95
96
= 1.0 =
97
+ * Initial version