/** * Display column 2 * @return void */ public function displayColumn2() { $oFlexSliderSlide = new FlexSliderSlide(); $iNextId = $oFlexSliderSlide->getNextId(); if (empty($iNextId)) { $iNextId = 1; } if ($this->_iId > 0) { $oFlexSliderSlide = new FlexSliderSlide(); $aSlides = $oFlexSliderSlide->getSliderSlides($this->_iId); } ?> <div id="advanced-sortables" class="meta-box-sortables ui-sortable"> <div id="smashing-post-class" class="postbox "> <div class="handlediv" title="<?php _e('Click to toggle', 'framework'); ?> "><br></div> <h3 class="hndle"><span><?php _e('Slider', 'framework'); ?> </span></h3> <div class="inside" id="slidersettings"> <div class="left"> <p> <label for="smashing-post-class"><?php _e('Name', 'framework'); ?> </label><br> <input type="text" name="name" id="name" size="30" class="required" value="<?php echo stripslashes($this->_oRecord->name); ?> "> </p> <p> <label for="smashing-post-class"><?php _e('Animation', 'framework'); ?> </label><br> <select name="animation" id="animation"> <option value="slide" <?php echo $this->_oRecord->animation == 'slide' ? 'selected' : ''; ?> ><?php _e('slide', 'framework'); ?> </option> <option value="fade" <?php echo $this->_oRecord->animation == 'fade' ? 'selected' : ''; ?> ><?php _e('fade', 'framework'); ?> </option> </select> </p> <p> <label for="smashing-post-class"><?php _e('Direction', 'framework'); ?> </label><br> <select name="direction" id="direction"> <option value="horizontal" <?php echo $this->_oRecord->direction == 'horizontal' ? 'selected' : ''; ?> ><?php _e('horizontal', 'framework'); ?> </option> <option value="vertical" <?php echo $this->_oRecord->direction == 'vertical' ? 'selected' : ''; ?> ><?php _e('vertical', 'framework'); ?> </option> </select> </p> <p> <label for="smashing-post-class"><?php _e('Slideshow speed (ms)', 'framework'); ?> </label><br> <input type="text" name="slideshow_speed" id="slideshow_speed" size="30" class="required" value="<?php echo empty($this->_oRecord->slideshow_speed) ? '7000' : stripslashes($this->_oRecord->slideshow_speed); ?> "> </p> <p> <label for="smashing-post-class"><?php _e('Animation speed (ms)', 'framework'); ?> </label><br> <input type="text" name="animation_speed" id="animation_speed" size="30" class="required" value="<?php echo empty($this->_oRecord->animation_speed) ? '600' : stripslashes($this->_oRecord->animation_speed); ?> "> </p> <p> <label for="smashing-post-class"><?php _e('Background', 'framework'); ?> </label><br> <input type="hidden" name="background" value="0"> <input type="text" size="40" id="background" type="text" name="background" value="<?php echo $this->_oRecord->background; ?> "> <a class="button" id="upload_background" href="javascript:void(0);"><?php _e('Upload', 'framework'); ?> </a> </p> </div> <div class="left"> <p> <label for="smashing-post-class"><?php _e('Reverse', 'framework'); ?> </label><br> <select name="reverse" id="reverse"> <option value="1" <?php echo $this->_oRecord->reverse == 1 ? 'selected' : ''; ?> ><?php _e('yes', 'framework'); ?> </option> <option value="0" <?php echo $this->_oRecord->reverse != 1 ? 'selected' : ''; ?> ><?php _e('no', 'framework'); ?> </option> </select> </p> <p> <label for="smashing-post-class"><?php _e('Randomize', 'framework'); ?> </label><br> <select name="randomize" id="randomize"> <option value="1" <?php echo $this->_oRecord->randomize == 1 ? 'selected' : ''; ?> ><?php _e('yes', 'framework'); ?> </option> <option value="0" <?php echo $this->_oRecord->randomize != 1 ? 'selected' : ''; ?> ><?php _e('no', 'framework'); ?> </option> </select> </p> <p> <label for="smashing-post-class"><?php _e('Control Navigation', 'framework'); ?> </label><br> <select name="control_nav" id="control_nav"> <option value="1" <?php echo $this->_oRecord->control_nav != 0 ? 'selected' : ''; ?> ><?php _e('yes', 'framework'); ?> </option> <option value="0" <?php echo $this->_oRecord->control_nav == 0 ? 'selected' : ''; ?> ><?php _e('no', 'framework'); ?> </option> </select> </p> <p> <label for="smashing-post-class"><?php _e('Direction Navigation', 'framework'); ?> </label><br> <select name="direction_nav" id="direction_nav"> <option value="1" <?php echo $this->_oRecord->direction_nav != 0 ? 'selected' : ''; ?> ><?php _e('yes', 'framework'); ?> </option> <option value="0" <?php echo $this->_oRecord->direction_nav == 0 ? 'selected' : ''; ?> ><?php _e('no', 'framework'); ?> </option> </select> </p> </div> <div class="clear"></div> </div> </div> <div id="smashing-post-class" class="postbox"> <div class="handlediv" title="<?php _e('Click to toggle', 'framework'); ?> "><br></div> <h3 class="hndle"><span><?php _e('Slides', 'framework'); ?> </span></h3> <div class="inside slide-fields"> <ul id="slides"> <?php if (isset($aSlides) && is_array($aSlides)) { ?> <?php foreach ($aSlides as $oSlide) { ?> <li class="slide"> <p> <div class="left"> <input type="hidden" name="new[<?php echo $oSlide->slide_id; ?> ]" value="0"> <input type="text" size="30" id="slide_<?php echo $oSlide->slide_id; ?> " type="text" name="image[<?php echo $oSlide->slide_id; ?> ]" value="<?php echo stripslashes($oSlide->image); ?> " class="required"> <a class="button" id="upload_<?php echo $oSlide->slide_id; ?> " href="javascript:void(0);"><?php _e('Upload', 'framework'); ?> </a> </div> <div class="right"><a class="button removeslide" href="#"><?php _e('Remove', 'framework'); ?> </a></div> <div class="clear"></div> <script> jQuery('#upload_<?php echo $oSlide->slide_id; ?> ').click(function() { uploadID = jQuery(this).prev('input'); formfield = jQuery('#image_<?php echo $oSlide->slide_id; ?> ').attr('name'); tb_show('', 'media-upload.php?type=image&TB_iframe=true'); return false; }); </script> </p> </li> <?php } ?> <?php } ?> </ul> <div class="left"><a id="add_slide" class="button" href="#"><?php _e('Add', 'framework'); ?> </a></div> <div class="right"><?php _e('Change Order by Drag & Drop', 'framework'); ?> </div> <div class="clear"></div> </div> </div> <div id="smashing-post-class" class="postbox "> <div class="handlediv" title="<?php _e('Click to toggle', 'framework'); ?> "><br></div> <h3 class="hndle"><span><?php _e('Publish', 'framework'); ?> </span></h3> <div class="inside"> <p> <?php if ($this->_iId != 0 && $this->_bDelete === true) { ?> <div id="slider-delete-action"> <a class="delete button remove" href="admin.php?page=<?php echo $_GET['page']; ?> &action=remove&id=<?php echo $this->_iId; ?> " tabindex="4"><?php _e('Delete', 'framework'); ?> </a> </div> <?php } ?> <input type="submit" name="save" id="save" class="button-primary" value="<?php _e('Save Slider', 'framework'); ?> " tabindex="5" accesskey="p"> <div class="clear"></div> </p> </div> </div> </div> <script type="text/javascript"> jQuery(document).ready(function() { //validate form // jQuery("#slider").validate({ // // errorPlacement: function(error, element) { // // error.insertAfter(element); // } // }); jQuery('#upload_background').click(function() { uploadID = jQuery(this).prev('input'); /*grab the specific input*/ formfield = jQuery('#background').attr('name'); tb_show('', 'media-upload.php?type=image&TB_iframe=true'); return false; }); var slides_count = <?php echo $iNextId; ?> ; var formelement = ''; //add new field to the group jQuery("#add_slide").click(function() { html_content = '<li class="slide"><p>'; html_content += '<div class="left">'; html_content += '<input type="hidden" name="new[' + slides_count + ']" value="1">'; html_content += '<input type="text" size="30" id="image_' + slides_count + '" type="text" name="image[' + slides_count + ']" class="required">'; html_content += '<a class="button" id="upload_' + slides_count + '" href="javascript:void(0);"><?php _e('Upload', 'framework'); ?> </a>'; html_content += '</div>'; html_content += '<div class="right"><a class="button removeslide" href="#"><?php _e('Remove', 'framework'); ?> </a></div>'; html_content += '<div class="clear"></div>'; html_content += '</p></li>'; jQuery(html_content).appendTo("#slides"); jQuery('#upload_' + slides_count).click(function() { uploadID = jQuery(this).prev('input'); /*grab the specific input*/ formfield = jQuery('#image_' + slides_count).attr('name'); tb_show('', 'media-upload.php?type=image&TB_iframe=true'); return false; }); slides_count++; //remove slide - register event for newly created elements jQuery(".removeslide").click(function() { jQuery(this).closest('.slide').remove(); }); return false; }); window.send_to_editor = function(html) { imgurl = jQuery('img',html).attr('src'); uploadID.val(imgurl); tb_remove(); } //remove slide jQuery(".removeslide").click(function() { jQuery(this).closest('.slide').remove(); }); /*drag and drop order*/ jQuery("#slides").sortable({ 'tolerance':'intersect', 'cursor':'pointer', 'items':'li', 'placeholder':'placeholder', stop: function(e, ui) { } }); //jQuery("#slides").disableSelection(); }); </script> <?php }
function ts_flexslider_func($atts, $content = null) { extract(shortcode_atts(array("id" => ""), $atts)); if (!(int) $id) { return ''; } require_once get_template_directory() . '/framework/class/FlexSliderSlider.class.php'; require_once get_template_directory() . '/framework/class/FlexSliderSlide.class.php'; $oSlider = new FlexSliderSlider($id); $oRecord = $oSlider->get(); if ($oRecord === false) { return ''; } $oSlides = new FlexSliderSlide(); $aSlides = $oSlides->getSliderSlides($id); if (is_array($aSlides) && count($aSlides) > 0) { require_once get_template_directory() . '/framework/class/freshizer.php'; foreach ($aSlides as $oSlide) { $image = ts_get_resized_image_by_size($oSlide->image, 'slider'); $content .= '<li>' . $image . '</li>'; } } $rand = $id . '-' . rand(1, 5000); $animation = 'slide'; if (in_array($oRecord->animation, array('slide', 'fade'))) { $animation = $oRecord->animation; } $direction = 'horizontal'; if (in_array($oRecord->direction, array('horizontal', 'vertical'))) { $direction = $oRecord->direction; } $slideshow_speed = 100; if ((int) $oRecord->slideshow_speed > 100) { $slideshow_speed = $oRecord->slideshow_speed; } $animation_speed = 100; if ((int) $oRecord->animation_speed > 100) { $animation_speed = $oRecord->animation_speed; } $reverse = false; if ((int) $oRecord->reverse == 1) { $reverse = true; } $randomize = false; if ((int) $oRecord->randomize == 1) { $randomize = true; } $controlNav = true; if ((int) $oRecord->control_nav == 0) { $controlNav = false; } $directionNav = true; if ((int) $oRecord->direction_nav == 0) { $directionNav = false; } $before = ""; $after = ""; if (!empty($oRecord->background)) { $before = "<div class='slider-background' style='background: url(" . $oRecord->background . ");'>"; $after = "</div>"; } $content = $before . "\n\t\t<div class='flexslider images-slider' id='flexslider-" . $rand . "'>\n\t\t\t<ul class='slides'>" . do_shortcode(shortcode_unautop($content)) . "</ul>\n\t\t</div>" . $after; $content .= "\n\t\t<script type='text/javascript'>\n\t\t\tjQuery(document).ready(function() {\n\t\t\t jQuery('#flexslider-" . $rand . "').flexslider({\n\t\t\t\tanimation: '" . $animation . "',\n\t\t\t\tdirection: '" . $direction . "',\n\t\t\t\tslideshowSpeed: " . $slideshow_speed . ",\n\t\t\t\tanimationSpeed: " . $animation_speed . ",\n\t\t\t\tcontrolNav: " . (int) $controlNav . ",\n\t\t\t\tdirectionNav: " . (int) $directionNav . ",\n\t\t\t\treverse: " . (int) $reverse . ",\n\t\t\t\trandomize: " . (int) $randomize . ",\n\t\t\t\tprevText: \"" . ts_get_prev_slider_text() . "\",\n\t\t\t\tnextText: \"" . ts_get_next_slider_text() . "\"\n\t\t\t });\n\t\t\t});\n\t\t</script>"; // Restor original Query & Post Data wp_reset_query(); wp_reset_postdata(); return $content; }