Version Description
- Improvement: Code refactored
- Fix: hitting [enter] brings up Media Library
- Improvement: Settings for new sliders now based on the last edited slider
- Improvement: More screenshots added
Download this release
Release Info
| Developer | matchalabs |
| Plugin | |
| Version | 1.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.1 to 1.1
- ml-slider.php +740 -622
- readme.txt +23 -10
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- screenshot-5.png +0 -0
- screenshot-6.png +0 -0
ml-slider.php
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
/*
|
| 3 |
* Plugin Name: ML Slider
|
| 4 |
* Plugin URI: http://www.ml-slider.com
|
| 5 |
-
* Description: Responsive
|
| 6 |
-
* Version: 1.
|
| 7 |
* Author: Matcha Labs
|
| 8 |
* Author URI: http://www.matchalabs.com
|
| 9 |
* License: GPL
|
|
@@ -14,213 +14,34 @@
|
|
| 14 |
* GNU General Public License for more details.
|
| 15 |
*/
|
| 16 |
|
| 17 |
-
define( 'MLSLIDER_VERSION', '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 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
* Constructor
|
| 27 |
-
*/
|
| 28 |
-
public function __construct() {
|
| 29 |
-
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
|
| 30 |
-
add_action('admin_menu', array($this, 'register_admin_menu'), 10001);
|
| 31 |
-
add_action('admin_menu', array($this, 'process'), 10002);
|
| 32 |
-
add_action('init', array($this, 'register_post_type' ));
|
| 33 |
-
add_action('init', array($this, 'register_taxonomy' ));
|
| 34 |
-
add_action('admin_print_styles', array( $this, 'register_admin_styles'));
|
| 35 |
-
add_shortcode('ml-slider', array($this, 'register_shortcode'));
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
/**
|
| 39 |
-
* Current slide ID
|
| 40 |
-
*/
|
| 41 |
-
private function set_current_slide($id) {
|
| 42 |
-
$this->current_slide = $id;
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
/**
|
| 46 |
-
* Return the current slide ID
|
| 47 |
-
*/
|
| 48 |
-
private function get_current_slide() {
|
| 49 |
-
return $this->current_slide;
|
| 50 |
-
}
|
| 51 |
|
| 52 |
/**
|
| 53 |
-
*
|
|
|
|
|
|
|
| 54 |
*/
|
| 55 |
-
public function process() {
|
| 56 |
-
$current_slide = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0;
|
| 57 |
-
$this->set_current_slide($current_slide);
|
| 58 |
-
|
| 59 |
-
$settings = get_post_meta($this->get_current_slide(), 'ml-slider_settings', true);
|
| 60 |
-
|
| 61 |
-
// handle slide description, url and ordering
|
| 62 |
-
if (isset($_POST['attachment'])) {
|
| 63 |
-
foreach ($_POST['attachment'] as $id => $fields) {
|
| 64 |
-
$term = get_term_by('name', $current_slide, 'ml-slider');
|
| 65 |
-
wp_set_post_terms($id, $term->term_id, 'ml-slider', false);
|
| 66 |
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
delete_post_meta($id, 'ml-slider_url');
|
| 79 |
-
} else {
|
| 80 |
-
update_post_meta($id, 'ml-slider_url', $fields['url']);
|
| 81 |
-
}
|
| 82 |
-
} else {
|
| 83 |
-
add_post_meta($id, 'ml-slider_url', $fields['url'], true);
|
| 84 |
-
}
|
| 85 |
-
|
| 86 |
-
// resize slide
|
| 87 |
-
add_image_size('ml-slider-slide', $settings['width'], $settings['height'], true);
|
| 88 |
-
$file = get_attached_file($id);
|
| 89 |
-
wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file));
|
| 90 |
-
}
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
-
// delete slider
|
| 94 |
-
if (isset($_GET['delete'])) {
|
| 95 |
-
$slide = array(
|
| 96 |
-
'ID' => intVal($_GET['delete']),
|
| 97 |
-
'post_status' => 'trash'
|
| 98 |
-
);
|
| 99 |
-
|
| 100 |
-
wp_update_post($slide);
|
| 101 |
-
|
| 102 |
-
$this->set_current_slide(0);
|
| 103 |
-
}
|
| 104 |
-
|
| 105 |
-
// delete slide
|
| 106 |
-
if (isset($_GET['deleteSlide'])) {
|
| 107 |
-
$slideToUntagFromCurrentSlider = $_GET['deleteSlide'];
|
| 108 |
-
|
| 109 |
-
// Get the existing terms and only keep the ones we don't want removed
|
| 110 |
-
$new_terms = array();
|
| 111 |
-
$current_terms = wp_get_object_terms($slideToUntagFromCurrentSlider, 'ml-slider', array('fields' => 'ids'));
|
| 112 |
-
$term = get_term_by('name', $this->get_current_slide(), 'ml-slider');
|
| 113 |
-
|
| 114 |
-
foreach ($current_terms as $current_term) {
|
| 115 |
-
if ($current_term != $term->term_id) {
|
| 116 |
-
$new_terms[] = intval($current_term);
|
| 117 |
-
}
|
| 118 |
-
}
|
| 119 |
-
|
| 120 |
-
return wp_set_object_terms($slideToUntagFromCurrentSlider, $new_terms, 'ml-slider');
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
// update title
|
| 124 |
-
if (isset($_POST['title'])) {
|
| 125 |
-
$slide = array(
|
| 126 |
-
'ID' => $this->get_current_slide(),
|
| 127 |
-
'post_title' => $_POST['title']
|
| 128 |
-
);
|
| 129 |
-
|
| 130 |
-
wp_update_post($slide);
|
| 131 |
-
}
|
| 132 |
-
|
| 133 |
-
// update options
|
| 134 |
-
if (isset($_POST['settings'])) {
|
| 135 |
-
$old_settings = get_post_meta($this->get_current_slide(), 'ml-slider_settings', true);
|
| 136 |
-
$new_settings = $_POST['settings'];
|
| 137 |
-
|
| 138 |
-
// convert checkbox values
|
| 139 |
-
$new_settings['hoverPause'] = (isset($new_settings['hoverPause']) && $new_settings['hoverPause'] == 'on') ? 'true' : 'false';
|
| 140 |
-
$new_settings['links'] = (isset($new_settings['links']) && $new_settings['links'] == 'on') ? 'true' : 'false';
|
| 141 |
-
$new_settings['navigation'] = (isset($new_settings['navigation']) && $new_settings['navigation'] == 'on') == 'on' ? 'true' : 'false';
|
| 142 |
-
$new_settings['reverse'] = (isset($new_settings['reverse']) && $new_settings['reverse'] == 'on') == 'on' ? 'true' : 'false';
|
| 143 |
-
$new_settings['random'] = (isset($new_settings['random']) && $new_settings['random'] == 'on') == 'on' ? 'true' : 'false';
|
| 144 |
-
$new_settings['printCss'] = (isset($new_settings['printCss']) && $new_settings['printCss'] == 'on') == 'on' ? 'true' : 'false';
|
| 145 |
-
$new_settings['printJs'] = (isset($new_settings['printJs']) && $new_settings['printJs'] == 'on') == 'on' ? 'true' : 'false';
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
update_post_meta($this->get_current_slide(), 'ml-slider_settings', array_merge($old_settings, $new_settings));
|
| 149 |
-
$settings = get_post_meta($this->get_current_slide(), 'ml-slider_settings', true);
|
| 150 |
-
|
| 151 |
-
// has the slideshow been resized?
|
| 152 |
-
if ($old_settings['width'] != $settings['width'] || $old_settings['height'] != $settings['height']) {
|
| 153 |
-
// resize all slides - register a new image size
|
| 154 |
-
add_image_size('ml-slider-slide', $settings['width'], $settings['height'], true);
|
| 155 |
-
|
| 156 |
-
$args = array(
|
| 157 |
-
'post_type' => 'attachment',
|
| 158 |
-
'numberposts' => -1,
|
| 159 |
-
'post_status' => null,
|
| 160 |
-
'post_parent' => $this->get_current_slide(),
|
| 161 |
-
'post_mime_type' => 'image'
|
| 162 |
-
);
|
| 163 |
-
|
| 164 |
-
$attachments = get_posts($args);
|
| 165 |
-
|
| 166 |
-
if ($attachments) {
|
| 167 |
-
foreach ($attachments as $post) {
|
| 168 |
-
$file = get_attached_file($post->ID);
|
| 169 |
-
wp_update_attachment_metadata($post->ID, wp_generate_attachment_metadata($post->ID, $file));
|
| 170 |
-
}
|
| 171 |
-
}
|
| 172 |
-
}
|
| 173 |
-
}
|
| 174 |
-
|
| 175 |
-
// create a new slider
|
| 176 |
-
if (isset($_GET['add'])) {
|
| 177 |
-
$slide = array(
|
| 178 |
-
'post_title' => 'New Slider',
|
| 179 |
-
'post_status' => 'publish',
|
| 180 |
-
'post_type' => 'ml-slider'
|
| 181 |
-
);
|
| 182 |
-
|
| 183 |
-
// insert the post
|
| 184 |
-
$id = wp_insert_post($slide);
|
| 185 |
-
$this->set_current_slide($id);
|
| 186 |
-
|
| 187 |
-
// default settings
|
| 188 |
-
$defaults = array(
|
| 189 |
-
'type' => 'nivo',
|
| 190 |
-
'height' => 290,
|
| 191 |
-
'width' => 565,
|
| 192 |
-
'spw' => 7, // squares per width
|
| 193 |
-
'sph' => 5, // squares per height
|
| 194 |
-
'delay' => 3000,
|
| 195 |
-
'sDelay' => 30, // delay between squares
|
| 196 |
-
'opacity' => 0.7, // opacity of title and navigation
|
| 197 |
-
'titleSpeed' => 500, // speed of title appereance in ms
|
| 198 |
-
'effect' => 'random', // random, swirl, rain, straight
|
| 199 |
-
'navigation' => 'true', // prev next and buttons
|
| 200 |
-
'links' => 'true', // show images as links
|
| 201 |
-
'hoverPause' => 'true', // pause on hover
|
| 202 |
-
'theme' => 'dark',
|
| 203 |
-
'direction' => 'horizontal',
|
| 204 |
-
'reverse' => 'false',
|
| 205 |
-
'animationSpeed' => 600,
|
| 206 |
-
'prevText' => 'Previous',
|
| 207 |
-
'nextText' => 'Next',
|
| 208 |
-
'slices' => 15,
|
| 209 |
-
'random' => 'false',
|
| 210 |
-
'cssClass' => '',
|
| 211 |
-
'printCss' => 'true',
|
| 212 |
-
'printJs' => 'true'
|
| 213 |
-
);
|
| 214 |
-
|
| 215 |
-
// insert the post meta
|
| 216 |
-
add_post_meta($this->get_current_slide(), 'ml-slider_settings', $defaults, true);
|
| 217 |
-
$settings = get_post_meta($this->get_current_slide(), 'ml-slider_settings', true);
|
| 218 |
-
|
| 219 |
-
// create the taxonomy term, the term is the ID of the slider itself
|
| 220 |
-
wp_insert_term($this->get_current_slide(), 'ml-slider');
|
| 221 |
-
}
|
| 222 |
}
|
| 223 |
-
|
| 224 |
|
| 225 |
/**
|
| 226 |
* Registers and enqueues admin-specific styles.
|
|
@@ -257,8 +78,6 @@ class MLSlider {
|
|
| 257 |
), MLSLIDER_ASSETS_URL . 'matchalabs.png', 99999);
|
| 258 |
|
| 259 |
add_action('admin_print_scripts-' . $page, array( $this, 'register_admin_scripts' ) );
|
| 260 |
-
|
| 261 |
-
|
| 262 |
}
|
| 263 |
|
| 264 |
/**
|
|
@@ -300,15 +119,118 @@ class MLSlider {
|
|
| 300 |
|
| 301 |
register_taxonomy( 'ml-slider', 'attachment', $args );
|
| 302 |
}
|
| 303 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
/**
|
| 305 |
* Return slides for the current slider
|
|
|
|
|
|
|
| 306 |
*/
|
| 307 |
-
public function
|
| 308 |
$retVal = array();
|
| 309 |
|
| 310 |
$args = array(
|
| 311 |
-
'orderby' => $random == 'true' ? 'rand' : 'menu_order',
|
| 312 |
'order' => 'ASC',
|
| 313 |
'post_type' => 'attachment',
|
| 314 |
'post_status' => 'inherit',
|
|
@@ -316,15 +238,14 @@ class MLSlider {
|
|
| 316 |
array(
|
| 317 |
'taxonomy' => 'ml-slider',
|
| 318 |
'field' => 'slug',
|
| 319 |
-
'terms' => $this->
|
| 320 |
)
|
| 321 |
)
|
| 322 |
);
|
| 323 |
|
| 324 |
-
|
| 325 |
$query = new WP_Query($args);
|
| 326 |
|
| 327 |
-
while($query->have_posts()) {
|
| 328 |
$query->next_post();
|
| 329 |
|
| 330 |
$image_attributes = wp_get_attachment_image_src($query->post->ID, 'ml-slider-slide'); // returns an array
|
|
@@ -342,14 +263,230 @@ class MLSlider {
|
|
| 342 |
|
| 343 |
return $retVal;
|
| 344 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 345 |
|
| 346 |
/**
|
| 347 |
-
* Return
|
|
|
|
|
|
|
| 348 |
*/
|
| 349 |
-
public function
|
|
|
|
|
|
|
| 350 |
$retVal = "<div id='" . $identifier . "' class='coin-slider'>";
|
| 351 |
|
| 352 |
-
foreach ($
|
| 353 |
$url = strlen($slide['url']) ? $slide['url'] : "javascript:void(0)"; // coinslider always wants a URL
|
| 354 |
$retVal .= "<a href='{$url}'>";
|
| 355 |
$retVal .= "<img src='{$slide['src']}' alt='{$slide['alt']}'>";
|
|
@@ -362,17 +499,17 @@ class MLSlider {
|
|
| 362 |
$retVal .= "<script type='text/javascript'>";
|
| 363 |
$retVal .= "\njQuery(document).ready(function($) {";
|
| 364 |
$retVal .= "\n $('#" . $identifier . "').coinslider({";
|
| 365 |
-
$retVal .= "\n effect: '{$
|
| 366 |
-
$retVal .= "\n width: '{$
|
| 367 |
-
$retVal .= "\n height: '{$
|
| 368 |
-
$retVal .= "\n spw: '{$
|
| 369 |
-
$retVal .= "\n sph: '{$
|
| 370 |
-
$retVal .= "\n delay: '{$
|
| 371 |
-
$retVal .= "\n sDelay: '{$
|
| 372 |
-
$retVal .= "\n opacity: '{$
|
| 373 |
-
$retVal .= "\n titleSpeed: '{$
|
| 374 |
-
$retVal .= "\n navigation: {$
|
| 375 |
-
$retVal .= "\n hoverPause: {$
|
| 376 |
$retVal .= "\n });";
|
| 377 |
$retVal .= "\n});";
|
| 378 |
$retVal .= "</script>";
|
|
@@ -382,11 +519,15 @@ class MLSlider {
|
|
| 382 |
|
| 383 |
/**
|
| 384 |
* Return flexslider markup
|
|
|
|
|
|
|
| 385 |
*/
|
| 386 |
-
public function
|
|
|
|
|
|
|
| 387 |
$retVal = "<div id='" . $identifier . "' class='flexslider'><ul class='slides'>";
|
| 388 |
|
| 389 |
-
foreach ($
|
| 390 |
$retVal .= "<li>";
|
| 391 |
if (strlen($slide['url'])) $retVal .= "<a href='{$slide['url']}'>";
|
| 392 |
$retVal .= "<img src='{$slide['src']}' alt='{$slide['alt']}'>";
|
|
@@ -400,16 +541,16 @@ class MLSlider {
|
|
| 400 |
$retVal .= "<script type='text/javascript'>";
|
| 401 |
$retVal .= "\njQuery(document).ready(function($) {";
|
| 402 |
$retVal .= "\n $('#" . $identifier . "').flexslider({";
|
| 403 |
-
$retVal .= "\n animation: '{$
|
| 404 |
-
$retVal .= "\n direction: '{$
|
| 405 |
-
$retVal .= "\n reverse: {$
|
| 406 |
-
$retVal .= "\n slideshowSpeed: {$
|
| 407 |
-
$retVal .= "\n pauseOnHover: {$
|
| 408 |
-
$retVal .= "\n animationSpeed: {$
|
| 409 |
-
$retVal .= "\n controlNav: {$
|
| 410 |
-
$retVal .= "\n directionNav: {$
|
| 411 |
-
$retVal .= "\n prevText: '{$
|
| 412 |
-
$retVal .= "\n nextText: '{$
|
| 413 |
$retVal .= "\n });";
|
| 414 |
$retVal .= "\n});";
|
| 415 |
$retVal .= "</script>";
|
|
@@ -419,11 +560,15 @@ class MLSlider {
|
|
| 419 |
|
| 420 |
/**
|
| 421 |
* Return responsive slides markup
|
|
|
|
|
|
|
| 422 |
*/
|
| 423 |
-
public function
|
|
|
|
|
|
|
| 424 |
$retVal = "<ul id='" . $identifier . "' class='rslides'>";
|
| 425 |
|
| 426 |
-
foreach ($
|
| 427 |
$retVal .= "<li>";
|
| 428 |
if (strlen($slide['url'])) $retVal .= "<a href='{$slide['url']}'>";
|
| 429 |
$retVal .= "<img src='{$slide['src']}' alt='{$slide['alt']}'>";
|
|
@@ -436,14 +581,14 @@ class MLSlider {
|
|
| 436 |
$retVal .= "<script type='text/javascript'>";
|
| 437 |
$retVal .= "\njQuery(document).ready(function($) {";
|
| 438 |
$retVal .= "\n $('#" . $identifier . "').responsiveSlides({";
|
| 439 |
-
$retVal .= "\n timeout: {$
|
| 440 |
-
$retVal .= "\n pause: {$
|
| 441 |
-
$retVal .= "\n pauseControls: {$
|
| 442 |
-
$retVal .= "\n speed: {$
|
| 443 |
-
$retVal .= "\n pager: {$
|
| 444 |
-
$retVal .= "\n nav: {$
|
| 445 |
-
$retVal .= "\n prevText: '{$
|
| 446 |
-
$retVal .= "\n nextText: '{$
|
| 447 |
$retVal .= "\n });";
|
| 448 |
$retVal .= "\n});";
|
| 449 |
$retVal .= "</script>";
|
|
@@ -453,13 +598,17 @@ class MLSlider {
|
|
| 453 |
|
| 454 |
/**
|
| 455 |
* Return nivoslider markup
|
|
|
|
|
|
|
| 456 |
*/
|
| 457 |
-
public function
|
| 458 |
-
$
|
|
|
|
|
|
|
| 459 |
$retVal .= "<div class='ribbon'></div>";
|
| 460 |
$retVal .= "<div id='" . $identifier . "' class='nivoSlider'>";
|
| 461 |
|
| 462 |
-
foreach ($
|
| 463 |
if (strlen($slide['url'])) $retVal .= "<a href='{$slide['url']}'>";
|
| 464 |
$retVal .= "<img src='{$slide['src']}' title='{$slide['caption']}' alt='{$slide['alt']}'>";
|
| 465 |
if (strlen($slide['url'])) $retVal .= "</a>";
|
|
@@ -470,17 +619,17 @@ class MLSlider {
|
|
| 470 |
$retVal .= "<script type='text/javascript'>";
|
| 471 |
$retVal .= "\njQuery(document).ready(function($) {";
|
| 472 |
$retVal .= "\n $('#" . $identifier . "').nivoSlider({";
|
| 473 |
-
$retVal .= "\n effect: '{$
|
| 474 |
-
$retVal .= "\n slices: {$
|
| 475 |
-
$retVal .= "\n pauseTime: {$
|
| 476 |
-
$retVal .= "\n animSpeed: {$
|
| 477 |
-
$retVal .= "\n pauseOnHover: {$
|
| 478 |
-
$retVal .= "\n boxCols: {$
|
| 479 |
-
$retVal .= "\n boxRows: {$
|
| 480 |
-
$retVal .= "\n controlNav: {$
|
| 481 |
-
$retVal .= "\n directionNav: {$
|
| 482 |
-
$retVal .= "\n prevText: '{$
|
| 483 |
-
$retVal .= "\n nextText: '{$
|
| 484 |
$retVal .= "\n });";
|
| 485 |
$retVal .= "\n});";
|
| 486 |
$retVal .= "</script>";
|
|
@@ -490,397 +639,366 @@ class MLSlider {
|
|
| 490 |
|
| 491 |
/**
|
| 492 |
* Shortcode used to display slideshow
|
|
|
|
|
|
|
| 493 |
*/
|
| 494 |
public function register_shortcode($atts) {
|
| 495 |
extract(shortcode_atts(array(
|
| 496 |
'id' => null
|
| 497 |
), $atts));
|
| 498 |
|
| 499 |
-
if ($id != null) {
|
| 500 |
-
$slider = get_post($id);
|
| 501 |
-
|
| 502 |
-
if ($slider->post_status != 'publish') {
|
| 503 |
-
return false;
|
| 504 |
-
}
|
| 505 |
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
$identifier = 'ml-slider-' . $settings['type'] . '-' . rand();
|
| 510 |
-
$slides = $this->getSlides($settings['random']);
|
| 511 |
-
|
| 512 |
-
if ($settings['type'] == 'coin') {
|
| 513 |
-
if ($settings['printJs'] == 'true') {
|
| 514 |
-
wp_enqueue_script('ml-slider_coin_slider', MLSLIDER_ASSETS_URL . 'coinslider/coin-slider.min.js', array('jquery'), MLSLIDER_VERSION);
|
| 515 |
-
}
|
| 516 |
|
| 517 |
-
|
| 518 |
-
wp_enqueue_style('ml-slider_coin_slider_css', plugins_url('ml-slider/assets/coinslider/coin-slider-styles.css'));
|
| 519 |
-
}
|
| 520 |
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
if ($settings['printJs'] == 'true') {
|
| 526 |
-
wp_enqueue_script('ml-slider_flex_slider', MLSLIDER_ASSETS_URL . 'flexslider/jquery.flexslider-min.js', array('jquery'), MLSLIDER_VERSION);
|
| 527 |
-
}
|
| 528 |
|
| 529 |
-
|
| 530 |
-
wp_enqueue_style('ml-slider_flex_slider_css', plugins_url('ml-slider/assets/flexslider/flexslider.css'));
|
| 531 |
-
}
|
| 532 |
|
| 533 |
-
|
|
|
|
|
|
|
|
|
|
| 534 |
}
|
| 535 |
-
|
| 536 |
-
if ($settings['type'] == 'responsive') {
|
| 537 |
-
if ($settings['printJs'] == 'true') {
|
| 538 |
-
wp_enqueue_script('ml-slider_responsive_slides', MLSLIDER_ASSETS_URL . 'responsiveslides/responsiveslides.min.js', array('jquery'), MLSLIDER_VERSION);
|
| 539 |
-
}
|
| 540 |
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
|
|
|
|
|
|
|
|
|
| 544 |
|
| 545 |
-
|
|
|
|
|
|
|
|
|
|
| 546 |
}
|
| 547 |
-
|
| 548 |
-
if ($
|
| 549 |
-
|
| 550 |
-
wp_enqueue_script('ml-slider_nivo_slider', MLSLIDER_ASSETS_URL . 'nivoslider/jquery.nivo.slider.pack.js', array('jquery'), MLSLIDER_VERSION);
|
| 551 |
-
}
|
| 552 |
-
|
| 553 |
-
if ($settings['printCss'] == 'true') {
|
| 554 |
-
wp_enqueue_style('ml-slider_nivo_slider_css', plugins_url('ml-slider/assets/nivoslider/nivo-slider.css'));
|
| 555 |
-
wp_enqueue_style('ml-slider_nivo_slider_theme_' . $settings['theme'], plugins_url('ml-slider/assets/nivoslider/themes/' . $settings['theme'] . '/' . $settings['theme'] . '.css'));
|
| 556 |
-
}
|
| 557 |
-
|
| 558 |
-
$retVal = $this->getNivoSlider($slides, $identifier, $settings);
|
| 559 |
}
|
| 560 |
-
|
| 561 |
-
|
| 562 |
}
|
| 563 |
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
'post_status' => 'publish',
|
| 577 |
-
'orderby' => 'date',
|
| 578 |
-
'order' => 'ASC',
|
| 579 |
-
'posts_per_page' => -1
|
| 580 |
-
);
|
| 581 |
-
|
| 582 |
-
$the_query = new WP_Query($args);
|
| 583 |
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 587 |
}
|
| 588 |
|
| 589 |
-
$
|
| 590 |
-
$active = $this->get_current_slide() == $the_query->post->ID ? true : false;
|
| 591 |
-
|
| 592 |
-
$tabs[] = array(
|
| 593 |
-
'active' => $active,
|
| 594 |
-
'title' => get_the_title(),
|
| 595 |
-
'id' => $the_query->post->ID
|
| 596 |
-
);
|
| 597 |
}
|
| 598 |
|
| 599 |
-
return $
|
| 600 |
}
|
| 601 |
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
|
| 641 |
-
|
| 642 |
-
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
| 654 |
-
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
|
| 658 |
-
|
| 659 |
-
|
| 660 |
-
|
| 661 |
-
|
| 662 |
-
|
| 663 |
-
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
|
| 667 |
-
|
| 668 |
-
|
| 669 |
-
<div class='right' style="width: 29%; float: right; margin-right: 1%; margin-top: 20px; clear: none;">
|
| 670 |
-
<table class="widefat settings">
|
| 671 |
-
<thead>
|
| 672 |
-
<tr>
|
| 673 |
-
<th colspan="2">Settings</th>
|
| 674 |
-
|
| 675 |
-
<th><input type='submit' value='Save' class='alignright button-primary' /></th>
|
| 676 |
-
</tr>
|
| 677 |
-
</thead>
|
| 678 |
-
<tbody>
|
| 679 |
-
<tr>
|
| 680 |
-
<td colspan='3'>
|
| 681 |
-
<div class='slider-lib nivo'>
|
| 682 |
-
<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>
|
| 683 |
-
<input class="select-slider" id='nivo' rel='nivo' type='radio' name="settings[type]" <?php if ($settings['type'] == 'nivo') echo 'checked=checked' ?> value='nivo' />
|
| 684 |
-
</div>
|
| 685 |
-
<div class='slider-lib coin'>
|
| 686 |
-
<label for='coin' title='Version: 1.0<br />Responsive: No<br />Effects: 4<br />Size: 8kb<br />Mobile Friendly: Yes' class='tooltiptop'>CoinSlider</label>
|
| 687 |
-
<input class="select-slider" id='coin' rel='coin' type='radio' name="settings[type]" <?php if ($settings['type'] == 'coin') echo 'checked=checked' ?> value='coin' />
|
| 688 |
-
</div>
|
| 689 |
-
<div class='slider-lib flex'>
|
| 690 |
-
<label for='flex' title='Version: 2.1<br />Responsive: Yes<br />Effects: 2<br />Size: 17kb<br />Mobile Friendly: Yes' class='tooltiptop'>FlexSlider</label>
|
| 691 |
-
<input class="select-slider" id='flex' rel='flex' type='radio' name="settings[type]" <?php if ($settings['type'] == 'flex') echo 'checked=checked' ?> value='flex' />
|
| 692 |
-
</div>
|
| 693 |
-
<div class='slider-lib responsive'>
|
| 694 |
-
<label for='responsive' title='Version: 1.53<br />Responsive: Yes<br />Effects: 1<br />Size: 3kb<br />Mobile Friendly: Yes' class='tooltiptop'>Responsive</label>
|
| 695 |
-
<input class="select-slider" id='responsive' rel='responsive' type='radio' name="settings[type]" <?php if ($settings['type'] == 'responsive') echo 'checked=checked' ?> value='responsive' />
|
| 696 |
-
</div>
|
| 697 |
-
</td>
|
| 698 |
-
</tr>
|
| 699 |
-
<tr>
|
| 700 |
-
<td><a href="#" class="tooltip" title="Set the initial size for the slides (width x height)">?</a></td>
|
| 701 |
-
<td>Size</td>
|
| 702 |
-
<td>
|
| 703 |
-
<input type='text' size='3' name="settings[width]" value='<?php echo $settings['width'] ?>' />px X
|
| 704 |
-
<input type='text' size='3' name="settings[height]" value='<?php echo $settings['height'] ?>' />px
|
| 705 |
-
</td>
|
| 706 |
-
</tr>
|
| 707 |
-
<tr>
|
| 708 |
-
<td><a href="#" class="tooltip" title="Slide transition effect">?</a></td>
|
| 709 |
-
<td>Effect</td>
|
| 710 |
-
<td>
|
| 711 |
-
<select name="settings[effect]" class='effect option coin nivo flex'>
|
| 712 |
-
<option class='option coin nivo' value='random' <?php if ($settings['effect'] == 'random') echo 'selected=selected' ?>>Random</option>
|
| 713 |
-
<option class='option coin' value='swirl' <?php if ($settings['effect'] == 'swirl') echo 'selected=selected' ?>>Swirl</option>
|
| 714 |
-
<option class='option coin' value='rain' <?php if ($settings['effect'] == 'rain') echo 'selected=selected' ?>>Rain</option>
|
| 715 |
-
<option class='option coin' value='straight' <?php if ($settings['effect'] == 'straight') echo 'selected=selected' ?>>Straight</option>
|
| 716 |
-
<option class='option nivo' value='sliceDown' <?php if ($settings['effect'] == 'sliceDown') echo 'selected=selected' ?>>Slice Down</option>
|
| 717 |
-
<option class='option nivo' value='sliceUp' <?php if ($settings['effect'] == 'sliceUp') echo 'selected=selected' ?>>Slice Up</option>
|
| 718 |
-
<option class='option nivo' value='sliceUpLeft' <?php if ($settings['effect'] == 'sliceUpLeft') echo 'selected=selected' ?>>Slice Up Left</option>
|
| 719 |
-
<option class='option nivo' value='sliceUpDown' <?php if ($settings['effect'] == 'sliceUpDown') echo 'selected=selected' ?>>Slice Up Down</option>
|
| 720 |
-
<option class='option nivo' value='sliceUpDownLeft' <?php if ($settings['effect'] == 'sliceUpDownLeft') echo 'selected=selected' ?>>Slice Up Down Left</option>
|
| 721 |
-
<option class='option nivo' value='fold' <?php if ($settings['effect'] == 'fold') echo 'selected=selected' ?>>Fold</option>
|
| 722 |
-
<option class='option nivo flex' value='fade' <?php if ($settings['effect'] == 'fade') echo 'selected=selected' ?>>Fade</option>
|
| 723 |
-
<option class='option nivo' value='slideInRight' <?php if ($settings['effect'] == 'slideInRight') echo 'selected=selected' ?>>Slide In Right</option>
|
| 724 |
-
<option class='option nivo' value='slideInLeft' <?php if ($settings['effect'] == 'slideInLeft') echo 'selected=selected' ?>>Slide In Left</option>
|
| 725 |
-
<option class='option nivo' value='boxRandom' <?php if ($settings['effect'] == 'boxRandom') echo 'selected=selected' ?>>Box Random</option>
|
| 726 |
-
<option class='option nivo' value='boxRain' <?php if ($settings['effect'] == 'boxRain') echo 'selected=selected' ?>>Box Rain</option>
|
| 727 |
-
<option class='option nivo' value='boxRainReverse' <?php if ($settings['effect'] == 'boxRainReverse') echo 'selected=selected' ?>>Box Rain Reverse</option>
|
| 728 |
-
<option class='option nivo' value='boxRainGrowReverse' <?php if ($settings['effect'] == 'boxRainGrowReverse') echo 'selected=selected' ?>>Box Rain Grow Reverse</option>
|
| 729 |
-
<option class='option flex' value='slide' <?php if ($settings['effect'] == 'slide') echo 'selected=selected' ?>>Slide</option>
|
| 730 |
-
</select>
|
| 731 |
-
</td>
|
| 732 |
-
</tr>
|
| 733 |
-
<tr>
|
| 734 |
-
<td><a href="#" class="tooltip" title="Change the slider style">?</a></td>
|
| 735 |
-
<td>Theme</td>
|
| 736 |
-
<td>
|
| 737 |
-
<select class='option nivo' name="settings[theme]">
|
| 738 |
-
<option value='default' <?php if ($settings['theme'] == 'default') echo 'selected=selected' ?>>Default</option>
|
| 739 |
-
<option value='dark' <?php if ($settings['theme'] == 'dark') echo 'selected=selected' ?>>Dark</option>
|
| 740 |
-
<option value='light' <?php if ($settings['theme'] == 'light') echo 'selected=selected' ?>>Light</option>
|
| 741 |
-
<option value='bar' <?php if ($settings['theme'] == 'bar') echo 'selected=selected' ?>>Bar</option>
|
| 742 |
-
</select>
|
| 743 |
-
</td>
|
| 744 |
-
</tr>
|
| 745 |
-
<tr>
|
| 746 |
-
<td><a href="#" class="tooltip" title="Number of squares (width x height)">?</a></td>
|
| 747 |
-
<td>Number of squares</td>
|
| 748 |
-
<td>
|
| 749 |
-
<input class='option coin nivo' type='text' size='2' name="settings[spw]" value='<?php echo $settings['spw'] ?>' /> x
|
| 750 |
-
<input class='option coin nivo' type='text' size='2' name="settings[sph]" value='<?php echo $settings['sph'] ?>' />
|
| 751 |
-
</td>
|
| 752 |
-
</tr>
|
| 753 |
-
<tr>
|
| 754 |
-
<td><a href="#" class="tooltip" title="Number of slices">?</a></td>
|
| 755 |
-
<td>Number of slices</td>
|
| 756 |
-
<td>
|
| 757 |
-
<input class='option nivo' type='text' size='2' name="settings[slices]" value='<?php echo $settings['slices'] ?>' />
|
| 758 |
-
</td>
|
| 759 |
-
</tr>
|
| 760 |
-
<tr>
|
| 761 |
-
<td><a href="#" class="tooltip" title="How long to display each slide, in milliseconds">?</a></td>
|
| 762 |
-
<td>Slide delay</td>
|
| 763 |
-
<td><input class='option coin flex responsive nivo' type='text' size='5' name="settings[delay]" value='<?php echo $settings['delay'] ?>' />ms</td>
|
| 764 |
-
</tr>
|
| 765 |
-
<tr>
|
| 766 |
-
<td><a href="#" class="tooltip" title="Delay beetwen squares in ms">?</a></td>
|
| 767 |
-
<td>Square delay</td>
|
| 768 |
-
<td><input class='option coin' type='text' size='5' name="settings[sDelay]" value='<?php echo $settings['sDelay'] ?>' />ms</td>
|
| 769 |
-
</tr>
|
| 770 |
-
<tr>
|
| 771 |
-
<td><a href="#" class="tooltip" title="Opacity of title and navigation">?</a></td>
|
| 772 |
-
<td>Opacity</td>
|
| 773 |
-
<td><input class='option coin' type='text' size='5' name="settings[opacity]" value='<?php echo $settings['opacity'] ?>' /></td>
|
| 774 |
-
</tr>
|
| 775 |
-
<tr>
|
| 776 |
-
<td><a href="#" class="tooltip" title="Set the fade in speef of the caption">?</a></td>
|
| 777 |
-
<td>Caption speed</td>
|
| 778 |
-
<td><input class='option coin' type='text' size='5' name="settings[titleSpeed]" value='<?php echo $settings['titleSpeed'] ?>' />ms</td>
|
| 779 |
-
</tr>
|
| 780 |
-
<tr>
|
| 781 |
-
<td><a href="#" class="tooltip" title="Set the speed of animations, in milliseconds">?</a></td>
|
| 782 |
-
<td>Animation speed</td>
|
| 783 |
-
<td><input class='option flex responsive nivo' type='text' size='5' name="settings[animationSpeed]" value='<?php echo $settings['animationSpeed'] ?>' />ms</td>
|
| 784 |
-
</tr>
|
| 785 |
-
<tr>
|
| 786 |
-
<td><a href="#" class="tooltip" title="Show slide navigation row">?</a></td>
|
| 787 |
-
<td>Navigation</td>
|
| 788 |
-
<td>
|
| 789 |
-
<input class='option coin responsive nivo flex' type='checkbox' name="settings[navigation]" <?php if ($settings['navigation'] == 'true') echo 'checked=checked' ?> />
|
| 790 |
-
</td>
|
| 791 |
-
</tr>
|
| 792 |
-
<tr>
|
| 793 |
-
<td><a href="#" class="tooltip" title="Show previous and next links">?</a></td>
|
| 794 |
-
<td>Links</td>
|
| 795 |
-
<td>
|
| 796 |
-
<input class='option responsive nivo flex' type='checkbox' name="settings[links]" <?php if ($settings['links'] == 'true') echo 'checked=checked' ?> />
|
| 797 |
-
</td>
|
| 798 |
-
</tr>
|
| 799 |
-
<tr>
|
| 800 |
-
<td><a href="#" class="tooltip" title="Pause the slideshow when hovering over slider, then resume when no longer hovering">?</a></td>
|
| 801 |
-
<td>Hover pause</td>
|
| 802 |
-
<td>
|
| 803 |
-
<input class='option coin flex responsive nivo' type='checkbox' name="settings[hoverPause]" <?php if ($settings['hoverPause'] == 'true') echo 'checked=checked' ?> />
|
| 804 |
-
</td>
|
| 805 |
-
</tr>
|
| 806 |
-
<tr>
|
| 807 |
-
<td><a href="#" class="tooltip" title="Reverse the animation direction">?</a></td>
|
| 808 |
-
<td>Reverse</td>
|
| 809 |
-
<td>
|
| 810 |
-
<input class='option flex' type='checkbox' name="settings[reverse]" <?php if ($settings['reverse'] == 'true') echo 'checked=checked' ?> />
|
| 811 |
-
</td>
|
| 812 |
-
</tr>
|
| 813 |
-
<tr>
|
| 814 |
-
<td><a href="#" class="tooltip" title="Randomise the order of the slides">?</a></td>
|
| 815 |
-
<td>Random</td>
|
| 816 |
-
<td>
|
| 817 |
-
<input type='checkbox' name="settings[random]" <?php if ($settings['random'] == 'true') echo 'checked=checked' ?> />
|
| 818 |
-
</td>
|
| 819 |
-
</tr>
|
| 820 |
-
<tr>
|
| 821 |
-
<td><a href="#" class="tooltip" title="Uncheck this is you would like to include your own CSS">?</a></td>
|
| 822 |
-
<td>Print CSS</td>
|
| 823 |
-
<td>
|
| 824 |
-
<input type='checkbox' name="settings[printCss]" <?php if ($settings['printCss'] == 'true') echo 'checked=checked' ?> />
|
| 825 |
-
</td>
|
| 826 |
-
</tr>
|
| 827 |
-
<tr>
|
| 828 |
-
<td><a href="#" class="tooltip" title="Uncheck this is you would like to include your own Javascript">?</a></td>
|
| 829 |
-
<td>Print JS</td>
|
| 830 |
-
<td>
|
| 831 |
-
<input type='checkbox' name="settings[printJs]" <?php if ($settings['printJs'] == 'true') echo 'checked=checked' ?> />
|
| 832 |
-
</td>
|
| 833 |
-
</tr>
|
| 834 |
-
<tr>
|
| 835 |
-
<td><a href="#" class="tooltip" title="Select the sliding direction">?</a></td>
|
| 836 |
-
<td>Direction</td>
|
| 837 |
-
<td>
|
| 838 |
-
<select class='option flex' name="settings[direction]">
|
| 839 |
-
<option value='horizontal' <?php if ($settings['direction'] == 'horizontal') echo 'selected=selected' ?>>Horizontal</option>
|
| 840 |
-
<option value='vertical' <?php if ($settings['direction'] == 'vertical') echo 'selected=selected' ?>>Vertical</option>
|
| 841 |
-
</select>
|
| 842 |
-
</td>
|
| 843 |
-
</tr>
|
| 844 |
-
<tr>
|
| 845 |
-
<td><a href="#" class="tooltip" title="Set the text for the 'previous' direction item">?</a></td>
|
| 846 |
-
<td>Previous text</td>
|
| 847 |
-
<td><input class='option flex responsive nivo' type='text' name="settings[prevText]" value='<?php echo $settings['prevText'] ?>' /></td>
|
| 848 |
-
</tr>
|
| 849 |
-
<tr>
|
| 850 |
-
<td><a href="#" class="tooltip" title="Set the text for the 'previous' direction item">?</a></td>
|
| 851 |
-
<td>Next text</td>
|
| 852 |
-
<td><input class='option flex responsive nivo' type='text' name="settings[nextText]" value='<?php echo $settings['nextText'] ?>' /></td>
|
| 853 |
-
</tr>
|
| 854 |
-
<tr>
|
| 855 |
-
<td><a href="#" class="tooltip" title="Specify any custom CSS Classes you would like to be added to the slider wrapper">?</a></td>
|
| 856 |
-
<td>CSS classes</td>
|
| 857 |
-
<td><input type='text' name="settings[cssClass]" value='<?php echo $settings['cssClass'] ?>' /></td>
|
| 858 |
-
</tr>
|
| 859 |
-
</tbody>
|
| 860 |
-
</table>
|
| 861 |
-
|
| 862 |
-
<table class="widefat" style="width: 100%; margin-top: 20px;">
|
| 863 |
-
<thead>
|
| 864 |
-
<tr>
|
| 865 |
-
<th>Shortcode</th>
|
| 866 |
-
</tr>
|
| 867 |
-
</thead>
|
| 868 |
-
|
| 869 |
-
<tbody>
|
| 870 |
-
<tr>
|
| 871 |
-
<td><textarea style="width: 100%">[ml-slider id=<?php echo $this->get_current_slide() ?>]</textarea></td>
|
| 872 |
-
</tr>
|
| 873 |
-
</tbody>
|
| 874 |
-
</table>
|
| 875 |
-
|
| 876 |
-
<br />
|
| 877 |
-
<a class='alignright button-secondary confirm' href="?page=ml-slider&delete=<?php echo $this->get_current_slide() ?>">Delete Slider</a>
|
| 878 |
-
</div>
|
| 879 |
</div>
|
| 880 |
-
|
| 881 |
-
|
| 882 |
-
|
| 883 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 884 |
}
|
| 885 |
$mlslider = new MLSlider();
|
| 886 |
?>
|
| 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.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.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
|
| 35 |
+
*/
|
| 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.
|
| 78 |
), MLSLIDER_ASSETS_URL . 'matchalabs.png', 99999);
|
| 79 |
|
| 80 |
add_action('admin_print_scripts-' . $page, array( $this, 'register_admin_scripts' ) );
|
|
|
|
|
|
|
| 81 |
}
|
| 82 |
|
| 83 |
/**
|
| 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 |
+
/**
|
| 167 |
+
* Handle slide uploads/changes
|
| 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();
|
| 180 |
+
$this->handle_delete_slide();
|
| 181 |
+
$this->handle_update_slider_title();
|
| 182 |
+
$this->handle_update_slider_settings();
|
| 183 |
+
$this->handle_create_slider();
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
/**
|
| 187 |
+
* Get sliders. Returns a nicely formatted array of currently
|
| 188 |
+
* published sliders.
|
| 189 |
+
*
|
| 190 |
+
* @return array array of all published sliders
|
| 191 |
+
*/
|
| 192 |
+
private function get_sliders() {
|
| 193 |
+
$sliders = false;
|
| 194 |
+
|
| 195 |
+
// list the tabs
|
| 196 |
+
$args = array(
|
| 197 |
+
'post_type' => 'ml-slider',
|
| 198 |
+
'post_status' => 'publish',
|
| 199 |
+
'orderby' => 'date',
|
| 200 |
+
'order' => 'ASC',
|
| 201 |
+
'posts_per_page' => -1
|
| 202 |
+
);
|
| 203 |
+
|
| 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,
|
| 216 |
+
'title' => get_the_title(),
|
| 217 |
+
'id' => $the_query->post->ID
|
| 218 |
+
);
|
| 219 |
+
}
|
| 220 |
+
|
| 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',
|
| 238 |
array(
|
| 239 |
'taxonomy' => 'ml-slider',
|
| 240 |
'field' => 'slug',
|
| 241 |
+
'terms' => $this->get_slider()
|
| 242 |
)
|
| 243 |
)
|
| 244 |
);
|
| 245 |
|
|
|
|
| 246 |
$query = new WP_Query($args);
|
| 247 |
|
| 248 |
+
while ($query->have_posts()) {
|
| 249 |
$query->next_post();
|
| 250 |
|
| 251 |
$image_attributes = wp_get_attachment_image_src($query->post->ID, 'ml-slider-slide'); // returns an array
|
| 263 |
|
| 264 |
return $retVal;
|
| 265 |
}
|
| 266 |
+
|
| 267 |
+
/**
|
| 268 |
+
* Create a new slider
|
| 269 |
+
*/
|
| 270 |
+
private function handle_create_slider() {
|
| 271 |
+
// create a new slider
|
| 272 |
+
if (isset($_GET['add'])) {
|
| 273 |
+
// if possible, take a copy of the last edited slider settings in place of default settings
|
| 274 |
+
if ($last_modified = $this->find_slider('modified', 'DESC')) {
|
| 275 |
+
$defaults = get_post_meta($last_modified, 'ml-slider_settings', true);
|
| 276 |
+
} else {
|
| 277 |
+
// default settings
|
| 278 |
+
$defaults = array(
|
| 279 |
+
'type' => 'nivo',
|
| 280 |
+
'height' => 290,
|
| 281 |
+
'width' => 565,
|
| 282 |
+
'spw' => 7, // squares per width
|
| 283 |
+
'sph' => 5, // squares per height
|
| 284 |
+
'delay' => 3000,
|
| 285 |
+
'sDelay' => 30, // delay between squares
|
| 286 |
+
'opacity' => 0.7, // opacity of title and navigation
|
| 287 |
+
'titleSpeed' => 500, // speed of title appereance in ms
|
| 288 |
+
'effect' => 'random', // random, swirl, rain, straight
|
| 289 |
+
'navigation' => 'true', // prev next and buttons
|
| 290 |
+
'links' => 'true', // show images as links
|
| 291 |
+
'hoverPause' => 'true', // pause on hover
|
| 292 |
+
'theme' => 'dark',
|
| 293 |
+
'direction' => 'horizontal',
|
| 294 |
+
'reverse' => 'false',
|
| 295 |
+
'animationSpeed' => 600,
|
| 296 |
+
'prevText' => 'Previous',
|
| 297 |
+
'nextText' => 'Next',
|
| 298 |
+
'slices' => 15,
|
| 299 |
+
'random' => 'false',
|
| 300 |
+
'cssClass' => '',
|
| 301 |
+
'printCss' => 'true',
|
| 302 |
+
'printJs' => 'true'
|
| 303 |
+
);
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
// insert the post
|
| 307 |
+
$id = wp_insert_post(array(
|
| 308 |
+
'post_title' => 'New Slider',
|
| 309 |
+
'post_status' => 'publish',
|
| 310 |
+
'post_type' => 'ml-slider'
|
| 311 |
+
));
|
| 312 |
+
|
| 313 |
+
// insert the post meta
|
| 314 |
+
add_post_meta($id, 'ml-slider_settings', $defaults, true);
|
| 315 |
+
|
| 316 |
+
// create the taxonomy term, the term is the ID of the slider itself
|
| 317 |
+
wp_insert_term($id, 'ml-slider');
|
| 318 |
+
|
| 319 |
+
// set the current slider to the one we have created
|
| 320 |
+
$this->set_slider($id);
|
| 321 |
+
}
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
/**
|
| 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'];
|
| 332 |
+
|
| 333 |
+
// convert submitted checkbox values from 'on' or 'off' to boolean values
|
| 334 |
+
$checkboxes = array('hoverPause', 'links', 'navigation', 'reverse', 'random', 'printCss', 'printJs');
|
| 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 |
+
|
| 352 |
+
/**
|
| 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(),
|
| 360 |
+
'post_title' => $_POST['title']
|
| 361 |
+
);
|
| 362 |
+
|
| 363 |
+
wp_update_post($slide);
|
| 364 |
+
}
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
/**
|
| 368 |
+
* 'Delete' a slide. Note: this doesn't delete the slide itself, it just deletes
|
| 369 |
+
* the relationship between the slider taxonomy term and the slide.
|
| 370 |
+
*
|
| 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 |
+
|
| 378 |
+
// Get the existing terms and only keep the ones we don't want removed
|
| 379 |
+
$new_terms = array();
|
| 380 |
+
$current_terms = wp_get_object_terms($slideToUntagFromCurrentSlider, 'ml-slider', array('fields' => 'ids'));
|
| 381 |
+
$term = get_term_by('name', $this->get_slider(), 'ml-slider');
|
| 382 |
+
|
| 383 |
+
foreach ($current_terms as $current_term) {
|
| 384 |
+
if ($current_term != $term->term_id) {
|
| 385 |
+
$new_terms[] = intval($current_term);
|
| 386 |
+
}
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
return wp_set_object_terms($slideToUntagFromCurrentSlider, $new_terms, 'ml-slider');
|
| 390 |
+
}
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
/**
|
| 394 |
+
* Update the slides. Add new slides, update ordering, taxonomy tagging (associating
|
| 395 |
+
* slide with slider), resize images.
|
| 396 |
+
*/
|
| 397 |
+
private function handle_slide_updates() {
|
| 398 |
+
// handle slide description, url and ordering
|
| 399 |
+
if (isset($_POST['attachment'])) {
|
| 400 |
+
foreach ($_POST['attachment'] as $id => $fields) {
|
| 401 |
+
// get the term thats name is the same as the ID of the slider
|
| 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(
|
| 409 |
+
'ID' => $id,
|
| 410 |
+
'post_excerpt' => $fields['post_excerpt'],
|
| 411 |
+
'menu_order' => $fields['menu_order']
|
| 412 |
+
));
|
| 413 |
+
|
| 414 |
+
// store the URL as a meta field against the attachment
|
| 415 |
+
if (get_post_meta($id, 'ml-slider_url')) {
|
| 416 |
+
if ($fields['url'] == '') {
|
| 417 |
+
delete_post_meta($id, 'ml-slider_url');
|
| 418 |
+
} else {
|
| 419 |
+
update_post_meta($id, 'ml-slider_url', $fields['url']);
|
| 420 |
+
}
|
| 421 |
+
} else {
|
| 422 |
+
add_post_meta($id, 'ml-slider_url', $fields['url'], true);
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
// add a new image size for the current slider
|
| 426 |
+
add_image_size('ml-slider-slide', $this->get_setting('width'), $this->get_setting('height'), true);
|
| 427 |
+
$file = get_attached_file($id);
|
| 428 |
+
// ask WordPress to resize our slides for us
|
| 429 |
+
wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file));
|
| 430 |
+
}
|
| 431 |
+
}
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
/**
|
| 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']),
|
| 442 |
+
'post_status' => 'trash'
|
| 443 |
+
);
|
| 444 |
+
|
| 445 |
+
wp_update_post($slide);
|
| 446 |
+
|
| 447 |
+
// set current slider to first published
|
| 448 |
+
$this->set_slider($this->find_slider('date', 'DESC'));
|
| 449 |
+
}
|
| 450 |
+
}
|
| 451 |
+
|
| 452 |
+
/**
|
| 453 |
+
* Find a single slider ID. For example, last edited, or first published.
|
| 454 |
+
*
|
| 455 |
+
* @param string $orderby field to order.
|
| 456 |
+
* @param string $order direction (ASC or DESC).
|
| 457 |
+
* @return int slider ID.
|
| 458 |
+
*/
|
| 459 |
+
private function find_slider($orderby, $order) {
|
| 460 |
+
$args = array(
|
| 461 |
+
'post_type' => 'ml-slider',
|
| 462 |
+
'num_posts' => 1,
|
| 463 |
+
'post_status' => 'publish',
|
| 464 |
+
'orderby' => $orderby,
|
| 465 |
+
'order' => $order
|
| 466 |
+
);
|
| 467 |
+
|
| 468 |
+
$the_query = new WP_Query($args);
|
| 469 |
+
|
| 470 |
+
while ($the_query->have_posts()) {
|
| 471 |
+
$the_query->the_post();
|
| 472 |
+
return $the_query->post->ID;
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
return false;
|
| 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) {
|
| 490 |
$url = strlen($slide['url']) ? $slide['url'] : "javascript:void(0)"; // coinslider always wants a URL
|
| 491 |
$retVal .= "<a href='{$url}'>";
|
| 492 |
$retVal .= "<img src='{$slide['src']}' alt='{$slide['alt']}'>";
|
| 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>";
|
| 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) {
|
| 531 |
$retVal .= "<li>";
|
| 532 |
if (strlen($slide['url'])) $retVal .= "<a href='{$slide['url']}'>";
|
| 533 |
$retVal .= "<img src='{$slide['src']}' alt='{$slide['alt']}'>";
|
| 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>";
|
| 560 |
|
| 561 |
/**
|
| 562 |
* Return responsive slides markup
|
| 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) {
|
| 572 |
$retVal .= "<li>";
|
| 573 |
if (strlen($slide['url'])) $retVal .= "<a href='{$slide['url']}'>";
|
| 574 |
$retVal .= "<img src='{$slide['src']}' alt='{$slide['alt']}'>";
|
| 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>";
|
| 598 |
|
| 599 |
/**
|
| 600 |
* Return nivoslider markup
|
| 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'>";
|
| 610 |
|
| 611 |
+
foreach ($this->get_slides() as $slide) {
|
| 612 |
if (strlen($slide['url'])) $retVal .= "<a href='{$slide['url']}'>";
|
| 613 |
$retVal .= "<img src='{$slide['src']}' title='{$slide['caption']}' alt='{$slide['alt']}'>";
|
| 614 |
if (strlen($slide['url'])) $retVal .= "</a>";
|
| 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>";
|
| 639 |
|
| 640 |
/**
|
| 641 |
* Shortcode used to display slideshow
|
| 642 |
+
*
|
| 643 |
+
* @return string HTML output of the shortcode
|
| 644 |
*/
|
| 645 |
public function register_shortcode($atts) {
|
| 646 |
extract(shortcode_atts(array(
|
| 647 |
'id' => null
|
| 648 |
), $atts));
|
| 649 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 650 |
|
| 651 |
+
if ($id == null) {
|
| 652 |
+
return;
|
| 653 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 654 |
|
| 655 |
+
$slider = get_post($id);
|
|
|
|
|
|
|
| 656 |
|
| 657 |
+
// check the slider is published
|
| 658 |
+
if ($slider->post_status != 'publish') {
|
| 659 |
+
return false;
|
| 660 |
+
}
|
|
|
|
|
|
|
|
|
|
| 661 |
|
| 662 |
+
$this->set_slider($id);
|
|
|
|
|
|
|
| 663 |
|
| 664 |
+
// coinslider
|
| 665 |
+
if ($this->get_setting('type') == 'coin') {
|
| 666 |
+
if ($this->get_setting('printJs') == 'true') {
|
| 667 |
+
wp_enqueue_script('ml-slider_coin_slider', MLSLIDER_ASSETS_URL . 'coinslider/coin-slider.min.js', array('jquery'), MLSLIDER_VERSION);
|
| 668 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 669 |
|
| 670 |
+
if ($this->get_setting('printCss') == 'true') {
|
| 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
|
| 678 |
+
if ($this->get_setting('type') == 'flex') {
|
| 679 |
+
if ($this->get_setting('printJs') == 'true') {
|
| 680 |
+
wp_enqueue_script('ml-slider_flex_slider', MLSLIDER_ASSETS_URL . 'flexslider/jquery.flexslider-min.js', array('jquery'), MLSLIDER_VERSION);
|
| 681 |
}
|
| 682 |
+
|
| 683 |
+
if ($this->get_setting('printCss') == 'true') {
|
| 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
|
| 691 |
+
if ($this->get_setting('type') == 'responsive') {
|
| 692 |
+
if ($this->get_setting('printJs') == 'true') {
|
| 693 |
+
wp_enqueue_script('ml-slider_responsive_slides', MLSLIDER_ASSETS_URL . 'responsiveslides/responsiveslides.min.js', array('jquery'), MLSLIDER_VERSION);
|
| 694 |
+
}
|
| 695 |
+
|
| 696 |
+
if ($this->get_setting('printCss') == 'true') {
|
| 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
|
| 704 |
+
if ($this->get_setting('type') == 'nivo') {
|
| 705 |
+
if ($this->get_setting('printJs') == 'true') {
|
| 706 |
+
wp_enqueue_script('ml-slider_nivo_slider', MLSLIDER_ASSETS_URL . 'nivoslider/jquery.nivo.slider.pack.js', array('jquery'), MLSLIDER_VERSION);
|
| 707 |
+
}
|
| 708 |
+
|
| 709 |
+
if ($this->get_setting('printCss') == 'true') {
|
| 710 |
+
wp_enqueue_style('ml-slider_nivo_slider_css', plugins_url('ml-slider/assets/nivoslider/nivo-slider.css'));
|
| 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>";
|
| 718 |
}
|
| 719 |
|
| 720 |
+
/**
|
| 721 |
+
* /////////////////////////////////////////////////////////////////
|
| 722 |
+
* Admin Page
|
| 723 |
+
* /////////////////////////////////////////////////////////////////
|
| 724 |
+
*/
|
| 725 |
+
|
| 726 |
+
/**
|
| 727 |
+
* Render the admin page (tabs, slides, settings)
|
| 728 |
+
*/
|
| 729 |
+
public function render_admin_page() {
|
| 730 |
+
?>
|
| 731 |
+
|
| 732 |
+
<div class="wrap ml-slider">
|
| 733 |
+
<form enctype="multipart/form-data" action="?page=ml-slider&id=<?php echo $this->get_slider() ?>" method="post">
|
| 734 |
+
|
| 735 |
+
<h2 class="nav-tab-wrapper" style="font-size: 13px;">
|
| 736 |
+
<?php
|
| 737 |
+
if ($tabs = $this->get_sliders()) {
|
| 738 |
+
foreach ($tabs as $tab) {
|
| 739 |
+
if ($tab['active']) {
|
| 740 |
+
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>";
|
| 741 |
+
} else {
|
| 742 |
+
echo "<a href='?page=ml-slider&id={$tab['id']}' class='nav-tab' style='font-size: 13px;'>" . $tab['title'] . "</a>";
|
| 743 |
+
}
|
| 744 |
+
}
|
| 745 |
+
}
|
| 746 |
+
?>
|
| 747 |
+
|
| 748 |
+
<a href="?page=ml-slider&add=true" id="create_new_tab" class="nav-tab">+</a>
|
| 749 |
+
</h2>
|
| 750 |
+
|
| 751 |
+
<?php
|
| 752 |
+
if (!$this->get_slider()) {
|
| 753 |
+
return;
|
| 754 |
+
}
|
| 755 |
+
?>
|
| 756 |
+
|
| 757 |
+
<div class="left" style='width: 68%; margin-top: 20px; float: left; clear: none;'>
|
| 758 |
+
<table class="widefat sortable slides">
|
| 759 |
+
<thead>
|
| 760 |
+
<tr>
|
| 761 |
+
<th style="width: 100px;">Slides</th>
|
| 762 |
+
<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>
|
| 763 |
+
</tr>
|
| 764 |
+
</thead>
|
| 765 |
+
|
| 766 |
+
<tbody>
|
| 767 |
+
<?php
|
| 768 |
+
$slides = $this->get_slides();
|
| 769 |
+
|
| 770 |
+
foreach($slides as $slide) {
|
| 771 |
+
$image_attributes = wp_get_attachment_image_src($slide['id']); // returns an array
|
| 772 |
+
$url = get_post_meta($slide['id'], 'ml-slider_url', true);
|
| 773 |
+
echo "<tr class='slide'>";
|
| 774 |
+
echo "<td>";
|
| 775 |
+
echo "<div style='position: absolute'><a class='delete-slide confirm' href='?page=ml-slider&id={$this->get_slider()}&deleteSlide={$slide['id']}'>x</a></div>";
|
| 776 |
+
echo "<img src='{$image_attributes[0]}' width='150px'></td>";
|
| 777 |
+
echo "<td>";
|
| 778 |
+
echo "<textarea name='attachment[{$slide['id']}][post_excerpt]' placeholder='Caption'>{$slide['caption']}</textarea>";
|
| 779 |
+
echo "<input type='text' name='attachment[{$slide['id']}][url]' placeholder='URL' value='{$url}' />";
|
| 780 |
+
echo "<input type='hidden' class='menu_order' name='attachment[{$slide['id']}][menu_order]' value={$slide['menu_order']} />";
|
| 781 |
+
echo "</td>";
|
| 782 |
+
echo "</tr>";
|
| 783 |
+
}
|
| 784 |
+
?>
|
| 785 |
+
</tbody>
|
| 786 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 787 |
</div>
|
| 788 |
+
|
| 789 |
+
<div class='right' style="width: 30%; float: right; margin-top: 20px; clear: none;">
|
| 790 |
+
<table class="widefat settings">
|
| 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>
|
| 798 |
+
<tr>
|
| 799 |
+
<td colspan='3'>
|
| 800 |
+
<div class='slider-lib nivo'>
|
| 801 |
+
<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>
|
| 802 |
+
<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' />
|
| 803 |
+
</div>
|
| 804 |
+
<div class='slider-lib coin'>
|
| 805 |
+
<label for='coin' title='Version: 1.0<br />Responsive: No<br />Effects: 4<br />Size: 8kb<br />Mobile Friendly: Yes' class='tooltiptop'>CoinSlider</label>
|
| 806 |
+
<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' />
|
| 807 |
+
</div>
|
| 808 |
+
<div class='slider-lib flex'>
|
| 809 |
+
<label for='flex' title='Version: 2.1<br />Responsive: Yes<br />Effects: 2<br />Size: 17kb<br />Mobile Friendly: Yes' class='tooltiptop'>FlexSlider</label>
|
| 810 |
+
<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' />
|
| 811 |
+
</div>
|
| 812 |
+
<div class='slider-lib responsive'>
|
| 813 |
+
<label for='responsive' title='Version: 1.53<br />Responsive: Yes<br />Effects: 1<br />Size: 3kb<br />Mobile Friendly: Yes' class='tooltiptop'>Responsive</label>
|
| 814 |
+
<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' />
|
| 815 |
+
</div>
|
| 816 |
+
</td>
|
| 817 |
+
</tr>
|
| 818 |
+
<tr>
|
| 819 |
+
<td><a href="#" class="tooltip" title="Set the initial size for the slides (width x height)">?</a></td>
|
| 820 |
+
<td>Size</td>
|
| 821 |
+
<td>
|
| 822 |
+
<input type='text' size='3' name="settings[width]" value='<?php echo $this->get_setting('width') ?>' />px X
|
| 823 |
+
<input type='text' size='3' name="settings[height]" value='<?php echo $this->get_setting('height') ?>' />px
|
| 824 |
+
</td>
|
| 825 |
+
</tr>
|
| 826 |
+
<tr>
|
| 827 |
+
<td><a href="#" class="tooltip" title="Slide transition effect">?</a></td>
|
| 828 |
+
<td>Effect</td>
|
| 829 |
+
<td>
|
| 830 |
+
<select name="settings[effect]" class='effect option coin nivo flex'>
|
| 831 |
+
<option class='option coin nivo' value='random' <?php if ($this->get_setting('effect') == 'random') echo 'selected=selected' ?>>Random</option>
|
| 832 |
+
<option class='option coin' value='swirl' <?php if ($this->get_setting('effect') == 'swirl') echo 'selected=selected' ?>>Swirl</option>
|
| 833 |
+
<option class='option coin' value='rain' <?php if ($this->get_setting('effect') == 'rain') echo 'selected=selected' ?>>Rain</option>
|
| 834 |
+
<option class='option coin' value='straight' <?php if ($this->get_setting('effect') == 'straight') echo 'selected=selected' ?>>Straight</option>
|
| 835 |
+
<option class='option nivo' value='sliceDown' <?php if ($this->get_setting('effect') == 'sliceDown') echo 'selected=selected' ?>>Slice Down</option>
|
| 836 |
+
<option class='option nivo' value='sliceUp' <?php if ($this->get_setting('effect') == 'sliceUp') echo 'selected=selected' ?>>Slice Up</option>
|
| 837 |
+
<option class='option nivo' value='sliceUpLeft' <?php if ($this->get_setting('effect') == 'sliceUpLeft') echo 'selected=selected' ?>>Slice Up Left</option>
|
| 838 |
+
<option class='option nivo' value='sliceUpDown' <?php if ($this->get_setting('effect') == 'sliceUpDown') echo 'selected=selected' ?>>Slice Up Down</option>
|
| 839 |
+
<option class='option nivo' value='sliceUpDownLeft' <?php if ($this->get_setting('effect') == 'sliceUpDownLeft') echo 'selected=selected' ?>>Slice Up Down Left</option>
|
| 840 |
+
<option class='option nivo' value='fold' <?php if ($this->get_setting('effect') == 'fold') echo 'selected=selected' ?>>Fold</option>
|
| 841 |
+
<option class='option nivo flex' value='fade' <?php if ($this->get_setting('effect') == 'fade') echo 'selected=selected' ?>>Fade</option>
|
| 842 |
+
<option class='option nivo' value='slideInRight' <?php if ($this->get_setting('effect') == 'slideInRight') echo 'selected=selected' ?>>Slide In Right</option>
|
| 843 |
+
<option class='option nivo' value='slideInLeft' <?php if ($this->get_setting('effect') == 'slideInLeft') echo 'selected=selected' ?>>Slide In Left</option>
|
| 844 |
+
<option class='option nivo' value='boxRandom' <?php if ($this->get_setting('effect') == 'boxRandom') echo 'selected=selected' ?>>Box Random</option>
|
| 845 |
+
<option class='option nivo' value='boxRain' <?php if ($this->get_setting('effect') == 'boxRain') echo 'selected=selected' ?>>Box Rain</option>
|
| 846 |
+
<option class='option nivo' value='boxRainReverse' <?php if ($this->get_setting('effect') == 'boxRainReverse') echo 'selected=selected' ?>>Box Rain Reverse</option>
|
| 847 |
+
<option class='option nivo' value='boxRainGrowReverse' <?php if ($this->get_setting('effect') == 'boxRainGrowReverse') echo 'selected=selected' ?>>Box Rain Grow Reverse</option>
|
| 848 |
+
<option class='option flex' value='slide' <?php if ($this->get_setting('effect') == 'slide') echo 'selected=selected' ?>>Slide</option>
|
| 849 |
+
</select>
|
| 850 |
+
</td>
|
| 851 |
+
</tr>
|
| 852 |
+
<tr>
|
| 853 |
+
<td><a href="#" class="tooltip" title="Change the slider style">?</a></td>
|
| 854 |
+
<td>Theme</td>
|
| 855 |
+
<td>
|
| 856 |
+
<select class='option nivo' name="settings[theme]">
|
| 857 |
+
<option value='default' <?php if ($this->get_setting('theme') == 'default') echo 'selected=selected' ?>>Default</option>
|
| 858 |
+
<option value='dark' <?php if ($this->get_setting('theme') == 'dark') echo 'selected=selected' ?>>Dark</option>
|
| 859 |
+
<option value='light' <?php if ($this->get_setting('theme') == 'light') echo 'selected=selected' ?>>Light</option>
|
| 860 |
+
<option value='bar' <?php if ($this->get_setting('theme') == 'bar') echo 'selected=selected' ?>>Bar</option>
|
| 861 |
+
</select>
|
| 862 |
+
</td>
|
| 863 |
+
</tr>
|
| 864 |
+
<tr>
|
| 865 |
+
<td><a href="#" class="tooltip" title="Number of squares (width x height)">?</a></td>
|
| 866 |
+
<td>Number of squares</td>
|
| 867 |
+
<td>
|
| 868 |
+
<input class='option coin nivo' type='text' size='2' name="settings[spw]" value='<?php echo $this->get_setting('spw') ?>' /> x
|
| 869 |
+
<input class='option coin nivo' type='text' size='2' name="settings[sph]" value='<?php echo $this->get_setting('sph') ?>' />
|
| 870 |
+
</td>
|
| 871 |
+
</tr>
|
| 872 |
+
<tr>
|
| 873 |
+
<td><a href="#" class="tooltip" title="Number of slices">?</a></td>
|
| 874 |
+
<td>Number of slices</td>
|
| 875 |
+
<td>
|
| 876 |
+
<input class='option nivo' type='text' size='2' name="settings[slices]" value='<?php echo $this->get_setting('slices') ?>' />
|
| 877 |
+
</td>
|
| 878 |
+
</tr>
|
| 879 |
+
<tr>
|
| 880 |
+
<td><a href="#" class="tooltip" title="How long to display each slide, in milliseconds">?</a></td>
|
| 881 |
+
<td>Slide delay</td>
|
| 882 |
+
<td><input class='option coin flex responsive nivo' type='text' size='5' name="settings[delay]" value='<?php echo $this->get_setting('delay') ?>' />ms</td>
|
| 883 |
+
</tr>
|
| 884 |
+
<tr>
|
| 885 |
+
<td><a href="#" class="tooltip" title="Delay beetwen squares in ms">?</a></td>
|
| 886 |
+
<td>Square delay</td>
|
| 887 |
+
<td><input class='option coin' type='text' size='5' name="settings[sDelay]" value='<?php echo $this->get_setting('sDelay') ?>' />ms</td>
|
| 888 |
+
</tr>
|
| 889 |
+
<tr>
|
| 890 |
+
<td><a href="#" class="tooltip" title="Opacity of title and navigation">?</a></td>
|
| 891 |
+
<td>Opacity</td>
|
| 892 |
+
<td><input class='option coin' type='text' size='5' name="settings[opacity]" value='<?php echo $this->get_setting('opacity') ?>' /></td>
|
| 893 |
+
</tr>
|
| 894 |
+
<tr>
|
| 895 |
+
<td><a href="#" class="tooltip" title="Set the fade in speef of the caption">?</a></td>
|
| 896 |
+
<td>Caption speed</td>
|
| 897 |
+
<td><input class='option coin' type='text' size='5' name="settings[titleSpeed]" value='<?php echo $this->get_setting('titleSpeed') ?>' />ms</td>
|
| 898 |
+
</tr>
|
| 899 |
+
<tr>
|
| 900 |
+
<td><a href="#" class="tooltip" title="Set the speed of animations, in milliseconds">?</a></td>
|
| 901 |
+
<td>Animation speed</td>
|
| 902 |
+
<td><input class='option flex responsive nivo' type='text' size='5' name="settings[animationSpeed]" value='<?php echo $this->get_setting('animationSpeed') ?>' />ms</td>
|
| 903 |
+
</tr>
|
| 904 |
+
<tr>
|
| 905 |
+
<td><a href="#" class="tooltip" title="Show slide navigation row">?</a></td>
|
| 906 |
+
<td>Navigation</td>
|
| 907 |
+
<td>
|
| 908 |
+
<input class='option coin responsive nivo flex' type='checkbox' name="settings[navigation]" <?php if ($this->get_setting('navigation') == 'true') echo 'checked=checked' ?> />
|
| 909 |
+
</td>
|
| 910 |
+
</tr>
|
| 911 |
+
<tr>
|
| 912 |
+
<td><a href="#" class="tooltip" title="Show previous and next links">?</a></td>
|
| 913 |
+
<td>Links</td>
|
| 914 |
+
<td>
|
| 915 |
+
<input class='option responsive nivo flex' type='checkbox' name="settings[links]" <?php if ($this->get_setting('links') == 'true') echo 'checked=checked' ?> />
|
| 916 |
+
</td>
|
| 917 |
+
</tr>
|
| 918 |
+
<tr>
|
| 919 |
+
<td><a href="#" class="tooltip" title="Pause the slideshow when hovering over slider, then resume when no longer hovering">?</a></td>
|
| 920 |
+
<td>Hover pause</td>
|
| 921 |
+
<td>
|
| 922 |
+
<input class='option coin flex responsive nivo' type='checkbox' name="settings[hoverPause]" <?php if ($this->get_setting('hoverPause') == 'true') echo 'checked=checked' ?> />
|
| 923 |
+
</td>
|
| 924 |
+
</tr>
|
| 925 |
+
<tr>
|
| 926 |
+
<td><a href="#" class="tooltip" title="Reverse the animation direction">?</a></td>
|
| 927 |
+
<td>Reverse</td>
|
| 928 |
+
<td>
|
| 929 |
+
<input class='option flex' type='checkbox' name="settings[reverse]" <?php if ($this->get_setting('reverse') == 'true') echo 'checked=checked' ?> />
|
| 930 |
+
</td>
|
| 931 |
+
</tr>
|
| 932 |
+
<tr>
|
| 933 |
+
<td><a href="#" class="tooltip" title="Randomise the order of the slides">?</a></td>
|
| 934 |
+
<td>Random</td>
|
| 935 |
+
<td>
|
| 936 |
+
<input type='checkbox' name="settings[random]" <?php if ($this->get_setting('random') == 'true') echo 'checked=checked' ?> />
|
| 937 |
+
</td>
|
| 938 |
+
</tr>
|
| 939 |
+
<tr>
|
| 940 |
+
<td><a href="#" class="tooltip" title="Uncheck this is you would like to include your own CSS">?</a></td>
|
| 941 |
+
<td>Print CSS</td>
|
| 942 |
+
<td>
|
| 943 |
+
<input type='checkbox' name="settings[printCss]" <?php if ($this->get_setting('printCss') == 'true') echo 'checked=checked' ?> />
|
| 944 |
+
</td>
|
| 945 |
+
</tr>
|
| 946 |
+
<tr>
|
| 947 |
+
<td><a href="#" class="tooltip" title="Uncheck this is you would like to include your own Javascript">?</a></td>
|
| 948 |
+
<td>Print JS</td>
|
| 949 |
+
<td>
|
| 950 |
+
<input type='checkbox' name="settings[printJs]" <?php if ($this->get_setting('printJs') == 'true') echo 'checked=checked' ?> />
|
| 951 |
+
</td>
|
| 952 |
+
</tr>
|
| 953 |
+
<tr>
|
| 954 |
+
<td><a href="#" class="tooltip" title="Select the sliding direction">?</a></td>
|
| 955 |
+
<td>Direction</td>
|
| 956 |
+
<td>
|
| 957 |
+
<select class='option flex' name="settings[direction]">
|
| 958 |
+
<option value='horizontal' <?php if ($this->get_setting('direction') == 'horizontal') echo 'selected=selected' ?>>Horizontal</option>
|
| 959 |
+
<option value='vertical' <?php if ($this->get_setting('direction') == 'vertical') echo 'selected=selected' ?>>Vertical</option>
|
| 960 |
+
</select>
|
| 961 |
+
</td>
|
| 962 |
+
</tr>
|
| 963 |
+
<tr>
|
| 964 |
+
<td><a href="#" class="tooltip" title="Set the text for the 'previous' direction item">?</a></td>
|
| 965 |
+
<td>Previous text</td>
|
| 966 |
+
<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>
|
| 967 |
+
</tr>
|
| 968 |
+
<tr>
|
| 969 |
+
<td><a href="#" class="tooltip" title="Set the text for the 'next' direction item">?</a></td>
|
| 970 |
+
<td>Next text</td>
|
| 971 |
+
<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>
|
| 972 |
+
</tr>
|
| 973 |
+
<tr>
|
| 974 |
+
<td><a href="#" class="tooltip" title="Specify any custom CSS Classes you would like to be added to the slider wrapper">?</a></td>
|
| 975 |
+
<td>CSS classes</td>
|
| 976 |
+
<td><input type='text' name="settings[cssClass]" value='<?php if ($this->get_setting('cssClass') != 'false') echo $this->get_setting('cssClass') ?>' /></td>
|
| 977 |
+
</tr>
|
| 978 |
+
</tbody>
|
| 979 |
+
</table>
|
| 980 |
+
|
| 981 |
+
<table class="widefat" style="width: 100%; margin-top: 20px;">
|
| 982 |
+
<thead>
|
| 983 |
+
<tr>
|
| 984 |
+
<th>Shortcode</th>
|
| 985 |
+
</tr>
|
| 986 |
+
</thead>
|
| 987 |
+
|
| 988 |
+
<tbody>
|
| 989 |
+
<tr>
|
| 990 |
+
<td><textarea style="width: 100%">[ml-slider id=<?php echo $this->get_slider() ?>]</textarea></td>
|
| 991 |
+
</tr>
|
| 992 |
+
</tbody>
|
| 993 |
+
</table>
|
| 994 |
+
|
| 995 |
+
<br />
|
| 996 |
+
<a class='alignright button-secondary confirm' href="?page=ml-slider&delete=<?php echo $this->get_slider() ?>">Delete Slider</a>
|
| 997 |
+
</div>
|
| 998 |
+
</form>
|
| 999 |
+
</div>
|
| 1000 |
+
<?php
|
| 1001 |
+
}
|
| 1002 |
}
|
| 1003 |
$mlslider = new MLSlider();
|
| 1004 |
?>
|
readme.txt
CHANGED
|
@@ -3,11 +3,11 @@ 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.
|
| 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
|
| 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.
|
|
@@ -20,16 +20,17 @@ Features:
|
|
| 20 |
|
| 21 |
* Create unlimited slideshows with unlimited number of slides
|
| 22 |
* Intuitive administration panel
|
| 23 |
-
* Choose slider library from
|
| 24 |
* Add captions to slides
|
| 25 |
* Add URLs to slides
|
|
|
|
|
|
|
| 26 |
* Reorder slides with drag and drop
|
| 27 |
* Integrated with WordPress media manager
|
| 28 |
* Create new slides from your Media Library, or upload new images
|
| 29 |
-
* Responsive (
|
| 30 |
-
* Include as many slideshows on the same page as you want
|
| 31 |
* Configure each slideshow with the chosen slider library options
|
| 32 |
-
* 4 Themes (NivoSlider)
|
| 33 |
* Adjust slider libary options such as: speed, theme, hover pause, width, height
|
| 34 |
* Option to include your own CSS
|
| 35 |
* Lightweight, only the bare minimum in terms of JavaScript and CSS is outputted to your website
|
|
@@ -44,11 +45,23 @@ Features:
|
|
| 44 |
|
| 45 |
== Screenshots ==
|
| 46 |
|
| 47 |
-
1. Administration panel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
== Changelog ==
|
| 50 |
|
| 51 |
-
= 1.
|
| 52 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
-
|
|
|
| 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.
|
| 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
|
| 45 |
|
| 46 |
== Screenshots ==
|
| 47 |
|
| 48 |
+
1. Administration panel - overview
|
| 49 |
+
2. Nivo Slider example
|
| 50 |
+
3. Coin Slider example
|
| 51 |
+
4. Flex Slider example
|
| 52 |
+
5. Responsive Slides example
|
| 53 |
+
6. Administration panel - selecting slides
|
| 54 |
|
| 55 |
== Changelog ==
|
| 56 |
|
| 57 |
+
= 1.1 =
|
| 58 |
+
* Improvement: Code refactored
|
| 59 |
+
* Fix: hitting [enter] brings up Media Library
|
| 60 |
+
* Improvement: Settings for new sliders now based on the last edited slider
|
| 61 |
+
* Improvement: More screenshots added
|
| 62 |
+
|
| 63 |
+
= 1.0.1 =
|
| 64 |
+
* Fix: min version incorrect (should be 3.5)
|
| 65 |
|
| 66 |
+
= 1.0 =
|
| 67 |
+
* Initial version
|
screenshot-1.png
ADDED
|
Binary file
|
screenshot-2.png
ADDED
|
Binary file
|
screenshot-3.png
ADDED
|
Binary file
|
screenshot-4.png
ADDED
|
Binary file
|
screenshot-5.png
ADDED
|
Binary file
|
screenshot-6.png
ADDED
|
Binary file
|
