public function get_image_info($id, $size = 'full')
 {
     $thumbid = 0;
     if (has_post_thumbnail($id)) {
         $thumbid = get_post_thumbnail_id($id);
     } else {
         $args = array('post_parent' => $id, 'numberposts' => 1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'DESC', 'orderby' => 'ID', 'post_status' => null);
         $attachments = get_posts($args);
         if ($attachments) {
             foreach ($attachments as $attachment) {
                 $thumbid = $attachment->ID;
                 break;
             }
         }
     }
     $image_info = array();
     if ($thumbid > 0) {
         $image_attribute = wp_get_attachment_image_src($thumbid, $size);
         $image_info['url'] = $image_attribute[0];
         $image_info['width'] = $image_attribute[1];
         $image_info['height'] = $image_attribute[2];
     } else {
         $image_info = WC_Product_Slider_Functions::get_template_image_file_info('no-image.gif');
     }
     return $image_info;
 }
    public function slider_generator_popup()
    {
        $is_post_edit_page = in_array(basename($_SERVER['PHP_SELF']), array('post.php', 'page.php', 'page-new.php', 'post-new.php'));
        if (!$is_post_edit_page) {
            return;
        }
        ?>
		<div id="wc-product-slider-wrap" style="display:none">

        	<fieldset id="wc_product_slider_upgrade_area"><legend><?php 
        _e('Insert WC Product Slider', 'wc_product_slider');
        ?>
 - <?php 
        _e('Upgrade to', 'wc_product_slider');
        ?>
 <a href="<?php 
        echo WC_PRODUCT_SLIDER_VERSION_URI;
        ?>
" target="_blank"><?php 
        _e('Product Slider Version', 'wc_product_slider');
        ?>
</a> <?php 
        _e('to activate', 'wc_product_slider');
        ?>
</legend>
            <div id="wc-product-slider-content" class="wc-product-slider-content wc-product-slider-shortcode-popup-container" style="text-align:left;">
            	<p>
                    <label for="wc_product_slider_show_type"><strong><?php 
        _e('Show Type:', 'wc_product_slider');
        ?>
</strong></label>
                    <select class="wc_product_slider_show_type" id="wc_product_slider_show_type" name="wc_product_slider_show_type" >
                        <option value="category" selected="selected"><?php 
        _e('Category', 'wc_product_slider');
        ?>
</option>
                        <option value="tag"><?php 
        _e('Tag', 'wc_product_slider');
        ?>
</option>
                        <option value="featured"><?php 
        _e('Featured', 'wc_product_slider');
        ?>
</option>
                        <option value="onsale"><?php 
        _e('On Sale', 'wc_product_slider');
        ?>
</option>
                    </select>
                </p>

                <p id="wc_product_slider_show_type_category" >
                	<label for="wc_product_slider_category_id"><?php 
        _e('Category:', 'wc_product_slider');
        ?>
</label>
                	<?php 
        wp_dropdown_categories(array('orderby' => 'name', 'name' => 'wc_product_slider_category_id', 'id' => 'wc_product_slider_category_id', 'class' => 'wc_product_slider_category_id', 'depth' => true, 'taxonomy' => 'product_cat'));
        ?>
                </p>

                <p id="wc_product_slider_show_type_tag" style="display:none" >
                	<label for="wc_product_slider_tag_id"><?php 
        _e('Tag:', 'wc_product_slider');
        ?>
</label>
                	<?php 
        wp_dropdown_categories(array('orderby' => 'name', 'name' => 'wc_product_slider_tag_id', 'id' => 'wc_product_slider_tag_id', 'class' => 'wc_product_slider_tag_id', 'depth' => true, 'taxonomy' => 'product_tag'));
        ?>
                </p>

                <p id="wc_product_slider_filter_type_container">
                    <label for="wc_product_slider_filter_type"><strong><?php 
        _e('Filter:', 'wc_product_slider');
        ?>
</strong></label>
                    <select id="wc_product_slider_filter_type" name="wc_product_slider_filter_type" >
                        <option value="" selected="selected"><?php 
        _e('Recent', 'wc_product_slider');
        ?>
</option>
                        <option value="featured"><?php 
        _e('Featured', 'wc_product_slider');
        ?>
</option>
                        <option value="onsale"><?php 
        _e('On Sale', 'wc_product_slider');
        ?>
</option>
                    </select>
                </p>

                <p><label for="wc_product_slider_number_products"><?php 
        _e('Number of products:', 'wc_product_slider');
        ?>
</label> <input id="wc_product_slider_number_products" name="wc_product_slider_number_products" type="text" value="6" size="2" /><br />
                <span class="description"><?php 
        _e('Important! Set -1 to show all products. Warning - Setting large numbers (unlimited) could / will have an  impact on page load speed on some sites.', 'wc_product_slider');
        ?>
</span>
                </p>

                <div style="border-top:2px dashed #111111; height:4px;">&nbsp;</div>

                <fieldset id="wc_product_slider_upgrade_area">
                <legend><?php 
        _e('Upgrade to', 'wc_product_slider');
        ?>
 <a href="<?php 
        echo WC_CAROUSEL_SLIDER_VERSION_URI;
        ?>
" target="_blank"><?php 
        _e('Carousel & Slider Version', 'wc_product_slider');
        ?>
</a> <?php 
        _e('to activate', 'wc_product_slider');
        ?>
</legend>
                <p><label><strong><?php 
        _e('Slider Type:', 'wc_product_slider');
        ?>
</strong></label>
                    <label><input type="radio" class="wc_product_slider_slider_type" name="wc_product_slider_slider_type" value="default" checked="checked" /> <?php 
        _e('SLIDER', 'wc_product_slider');
        ?>
</label> &nbsp;&nbsp;&nbsp;
                    <label><input type="radio" class="wc_product_slider_slider_type" name="wc_product_slider_slider_type" value="carousel" /> <?php 
        _e('CAROUSEL', 'wc_product_slider');
        ?>
</label>
                </p>

                <div id="wc_product_slider_slider_type_carousel" style="display:none;">
                	<p><label><strong><?php 
        _e('Carousel Type:', 'wc_product_slider');
        ?>
</strong></label>
                        <label><input type="radio" class="wc_product_slider_slider_carousel_type" name="wc_product_slider_slider_carousel_type" value="horizontal" checked="checked" /> <?php 
        _e('HORIZONTAL', 'wc_product_slider');
        ?>
</label> &nbsp;&nbsp;&nbsp;
                        <label><input type="radio" class="wc_product_slider_slider_carousel_type" name="wc_product_slider_slider_carousel_type" value="vertical" /> <?php 
        _e('VERTICAL', 'wc_product_slider');
        ?>
</label>
                    </p>

                    <p><label for="wc_product_slider_slider_carousel_visible"><?php 
        _e('Carousel number visible:', 'wc_product_slider');
        ?>
</label> <input id="wc_product_slider_slider_carousel_visible" name="wc_product_slider_slider_carousel_visible" type="text" value="4" size="1" />
                    <span class="description"><?php 
        _e('Number of slides to be displayed in the carousel.', 'wc_product_slider');
        ?>
</span>
                    </p>
                </div>
                </fieldset>

                <div id="wc_product_slider_slider_type_default">
                    <p><label><strong><?php 
        _e('Skin Type:', 'wc_product_slider');
        ?>
</strong></label>
                        <label><input type="radio" class="wc_product_slider_skin_type" name="wc_product_slider_skin_type" value="widget" checked="checked" /> <?php 
        _e('WIDGET', 'wc_product_slider');
        ?>
</label> &nbsp;&nbsp;&nbsp;
                        <label><input type="radio" class="wc_product_slider_skin_type" name="wc_product_slider_skin_type" value="card" /> <?php 
        _e('CARD', 'wc_product_slider');
        ?>
</label>
                    </p>

                    <div id="wc_product_slider_skin_type_widget">
                        <p><label for="wc_product_slider_widget_effect"><strong><?php 
        _e('Effects Type:', 'wc_product_slider');
        ?>
</strong></label>
                            <select id="wc_product_slider_widget_effect" name="wc_product_slider_widget_effect" >
                            <?php 
        $transitions_list = WC_Product_Slider_Functions::slider_transitions_list();
        foreach ($transitions_list as $effect_key => $effect_name) {
            ?>
                                <option value="<?php 
            echo $effect_key;
            ?>
" <?php 
            if ($effect_key == 'fade') {
                echo 'selected="selected"';
            }
            ?>
><?php 
            echo $effect_name;
            ?>
</option>
                            <?php 
        }
        ?>
                            </select>
                        </p>
                    </div>

                    <div id="wc_product_slider_skin_type_card" style="display:none">
                        <p><label><strong><?php 
        _e('Effects Type:', 'wc_product_slider');
        ?>
</strong></label>
                            <select id="wc_product_slider_card_effect" name="wc_product_slider_card_effect" >
                            <?php 
        $transitions_list = WC_Product_Slider_Functions::card_slider_transitions_list();
        foreach ($transitions_list as $effect_key => $effect_name) {
            ?>
                                <option value="<?php 
            echo $effect_key;
            ?>
" <?php 
            if ($effect_key == 'fade') {
                echo 'selected="selected"';
            }
            ?>
><?php 
            echo $effect_name;
            ?>
</option>
                            <?php 
        }
        ?>
                            </select>
                        </p>
                    </div>
                </div>

                <div style="border-top:2px dashed #111111; height:4px;">&nbsp;</div>

                <p><label><strong><?php 
        _e('Transition Method:', 'wc_product_slider');
        ?>
</strong></label>
                    <label><input type="radio" class="wc_product_slider_auto_scroll" name="wc_product_slider_auto_scroll" value="no" checked="checked" /> <?php 
        _e('MANUAL', 'wc_product_slider');
        ?>
</label> &nbsp;&nbsp;&nbsp;
                    <label><input type="radio" class="wc_product_slider_auto_scroll" name="wc_product_slider_auto_scroll" value="yes" /> <?php 
        _e('AUTO', 'wc_product_slider');
        ?>
</label>
                </p>

                <div id="wc_product_slider_auto_scroll_auto" style="display:none;">
                    <p><label for="wc_product_slider_effect_delay"><?php 
        _e('Auto Start Delay:', 'wc_product_slider');
        ?>
</label> <input id="wc_product_slider_effect_delay" name="wc_product_slider_effect_delay" type="text" value="1" size="1" /> <?php 
        _e('seconds', 'wc_product_slider');
        ?>
</p>
                </div>

                <p><label for="wc_product_slider_effect_timeout"><?php 
        _e('Time Between Transitions:', 'wc_product_slider');
        ?>
</label> <input id="wc_product_slider_effect_timeout" name="wc_product_slider_effect_timeout" type="text" value="4" size="1" /> <?php 
        _e('seconds', 'wc_product_slider');
        ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <label for="wc_product_slider_effect_speed"><?php 
        _e('Transition Effect Speed:', 'wc_product_slider');
        ?>
</label> <input id="wc_product_slider_effect_speed" name="wc_product_slider_effect_speed" type="text" value="2" size="1" /> <?php 
        _e('seconds', 'wc_product_slider');
        ?>
                </p>

				<div style="border-top:2px dashed #111111; height:4px;">&nbsp;</div>

                <p><label for="wc_product_slider_align"><?php 
        _e('Slider Alignment', 'wc_product_slider');
        ?>
:</label>
                <select style="width:120px" id="wc_product_slider_align" name="wc_product_slider_align">
                	<option value="none" selected="selected"><?php 
        _e('None', 'wc_product_slider');
        ?>
</option>
                    <option value="left-wrap"><?php 
        _e('Left - wrap', 'wc_product_slider');
        ?>
</option>
                    <option value="left"><?php 
        _e('Left - no wrap', 'wc_product_slider');
        ?>
</option>
                    <option value="center"><?php 
        _e('Center', 'wc_product_slider');
        ?>
</option>
                    <option value="right-wrap"><?php 
        _e('Right - wrap', 'wc_product_slider');
        ?>
</option>
                    <option value="right"><?php 
        _e('Right - no wrap', 'wc_product_slider');
        ?>
</option>
                </select> <span class="description"><?php 
        _e('Wrap is text wrap like images', 'wc_product_slider');
        ?>
</span></p>
				<p><label for="wc_product_slider_width"><?php 
        _e('Slider Width', 'wc_product_slider');
        ?>
:</label> <input style="width:50px;" size="10" id="wc_product_slider_width" name="wc_product_slider_width" type="text" value="300" />
                <select style="width:60px" id="wc_product_slider_width_type" name="wc_product_slider_width_type">
                	<option value="px" selected="selected">px</option>
                    <option value="%">%</option>
                </select>
                </p>
                <p><label for=""><strong><?php 
        _e('Slider Margin', 'wc_product_slider');
        ?>
</strong>:</label><br />
                        <label for="wc_product_slider_margin_top" style="width:auto; float:none"><?php 
        _e('Above', 'wc_product_slider');
        ?>
:</label><input style="width:50px;" size="10" id="wc_product_slider_margin_top" name="wc_product_slider_margin_top" type="text" value="10" />px &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <label for="wc_product_slider_margin_bottom" style="width:auto; float:none"><?php 
        _e('Below', 'wc_product_slider');
        ?>
:</label> <input style="width:50px;" size="10" id="wc_product_slider_margin_bottom" name="wc_product_slider_margin_bottom" type="text" value="10" />px &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <label for="wc_product_slider_margin_left" style="width:auto; float:none"><?php 
        _e('Left', 'wc_product_slider');
        ?>
:</label> <input style="width:50px;" size="10" id="wc_product_slider_margin_left" name="wc_product_slider_margin_left" type="text" value="10" />px &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <label for="wc_product_slider_margin_right" style="width:auto; float:none"><?php 
        _e('Right', 'wc_product_slider');
        ?>
:</label> <input style="width:50px;" size="10" id="wc_product_slider_margin_right" name="wc_product_slider_margin_right" type="text" value="10" />px
                </p>
			</div>
            <div style="clear:both;height:0px"></div>
            <p><input type="button" class="button button-primary" value="<?php 
        _e('Insert Shortcode', 'wc_product_slider');
        ?>
" disabled="disabled" />
            <input type="button" class="button" onclick="tb_remove(); return false;" value="<?php 
        _e('Cancel', 'wc_product_slider');
        ?>
" />
			</p>
            </fieldset>

		</div>
        <script type="text/javascript">
		(function($) {
		$(document).ready(function() {
			$("input.wc_product_slider_slider_type").change( function() {
				if ( $("input.wc_product_slider_slider_type:checked").val() == 'default') {
					$("#wc_product_slider_slider_type_carousel").slideUp();
				} else {
					$("#wc_product_slider_slider_type_carousel").slideDown();
				}
			});

			$("select.wc_product_slider_show_type").change( function() {
				if ( $("select.wc_product_slider_show_type").val() == 'category') {
					$("#wc_product_slider_show_type_category").slideDown();
					$("#wc_product_slider_show_type_tag").slideUp();
                    $("#wc_product_slider_filter_type_container").slideDown();
				} else if ( $("select.wc_product_slider_show_type").val() == 'tag') {
					$("#wc_product_slider_show_type_category").slideUp();
					$("#wc_product_slider_show_type_tag").slideDown();
                    $("#wc_product_slider_filter_type_container").slideDown();
				} else {
					$("#wc_product_slider_show_type_category").slideUp();
					$("#wc_product_slider_show_type_tag").slideUp();
                    $("#wc_product_slider_filter_type_container").slideUp();
				}
			});

			$("input.wc_product_slider_skin_type").change( function() {
				if ( $("input.wc_product_slider_skin_type:checked").val() == 'widget') {
					$("#wc_product_slider_skin_type_widget").slideDown();
					$("#wc_product_slider_skin_type_card").slideUp();
				} else {
					$("#wc_product_slider_skin_type_widget").slideUp();
					$("#wc_product_slider_skin_type_card").slideDown();
				}
			});

			$("input.wc_product_slider_auto_scroll").change( function() {
				if ( $("input.wc_product_slider_auto_scroll:checked").val() == 'yes') {
					$("#wc_product_slider_auto_scroll_auto").slideDown();
				} else {
					$("#wc_product_slider_auto_scroll_auto").slideUp();
				}
			});

		});
		})(jQuery);

		</script>
		<?php 
    }
    public static function dispay_slider_widget($slider_id = '', $slider_settings = array(), $category_link = '', $tag_link = '')
    {
        global $wc_product_slider_a3_widget_skin_global_settings;
        global $wc_product_slider_a3_widget_skin_dimensions_settings;
        global $wc_product_slider_a3_widget_skin_title_settings;
        global $wc_product_slider_a3_widget_skin_product_link_settings;
        global $wc_product_slider_a3_widget_skin_category_tag_link_settings;
        extract($wc_product_slider_a3_widget_skin_global_settings);
        // Detect the slider is viewing on Mobile, if True then Show Slider for Mobile
        if ($enable_slider_touch == 1) {
            require_once WC_PRODUCT_SLIDER_DIR . '/includes/mobile_detect.php';
            $device_detect = new WC_Product_Slider_Mobile_Detect();
            if ($device_detect->isMobile()) {
                $is_used_mobile_skin = false;
                require_once WC_PRODUCT_SLIDER_DIR . '/classes/class-slider-mobile-display.php';
                return WC_Product_Slider_Mobile_Display::mobile_dispay_slider($slider_id, $is_used_mobile_skin, $slider_settings, $category_link, $tag_link);
            }
        }
        // TEST MOBILE
        //if ( $is_used_mobile_skin == 1 ) $is_used_mobile_skin = true;
        //else  $is_used_mobile_skin = false;
        //require_once WC_PRODUCT_SLIDER_DIR . '/classes/class-slider-mobile-display.php';
        //return WC_Product_Slider_Mobile_Display::mobile_dispay_slider( $slider_id, $is_used_mobile_skin , $slider_settings, $category_link, $tag_link );
        //add_action( 'wp_footer', array( 'WC_Product_Slider_Hook_Filter', 'include_slider_widget_scripts' ) );
        extract($wc_product_slider_a3_widget_skin_dimensions_settings);
        extract($wc_product_slider_a3_widget_skin_title_settings);
        extract($wc_product_slider_a3_widget_skin_product_link_settings);
        extract($wc_product_slider_a3_widget_skin_category_tag_link_settings);
        $caption_fx_out = 'fadeOut';
        $caption_fx_in = 'fadeIn';
        $unique_id = rand(1, 100);
        $caption_class = '#cycle-widget-skin-caption-' . $unique_id;
        $overlay_class = '#cycle-widget-skin-overlay-' . $unique_id;
        $slider_transition_data = WC_Product_Slider_Functions::get_slider_transition($slider_settings['widget_effect'], $slider_settings);
        $fx = $slider_transition_data['fx'];
        $transition_attributes = $slider_transition_data['transition_attributes'];
        $timeout = $slider_transition_data['timeout'];
        $speed = $slider_transition_data['speed'];
        $delay = $slider_transition_data['delay'];
        $dynamic_tall = 'false';
        if ($is_slider_tall_dynamic == 1) {
            $dynamic_tall = 'container';
        }
        WC_Product_Slider_Hook_Filter::include_slider_widget_scripts($slider_transition_data);
        ob_start();
        ?>
    <div style="clear:both;"></div>
    <div class="wc-product-slider-widget-skin-container">
    <?php 
        $lazy_load = '';
        $lazy_hidden = '';
        if (!is_admin() && function_exists('a3_lazy_load_enable')) {
            $lazy_load = 'wc-product-slider-lazyload';
            $lazy_hidden = '<div class="a3-cycle-lazy-hidden lazy-hidden"></div>';
        }
        ?>
    <?php 
        echo $lazy_hidden;
        ?>
    <?php 
        if ($title_position == 'above') {
            self::get_title_widget_skin($unique_id);
        }
        ?>

    <div id="wc-product-slider-container-<?php 
        echo $unique_id;
        ?>
" class="wc-product-slider-container wc-product-slider-widget-skin" data-slider-id="<?php 
        echo $slider_id;
        ?>
" data-slider-settings="<?php 
        echo esc_attr(json_encode($slider_settings));
        ?>
" data-slider-skin-type="widget" >
    	<div style=" <?php 
        if ($is_slider_tall_dynamic == 0) {
            echo 'height:' . $slider_height_fixed . 'px';
        }
        ?>
" id="wc-product-slider-<?php 
        echo $unique_id;
        ?>
" class="wc-product-slider <?php 
        echo $lazy_load;
        ?>
 <?php 
        if ($is_slider_tall_dynamic == 1) {
            ?>
wc-product-slider-dynamic-tall<?php 
        }
        ?>
"
        	data-cycle-fx="<?php 
        echo $fx;
        ?>
"
            <?php 
        echo $transition_attributes;
        ?>

        	data-cycle-timeout=<?php 
        echo $timeout;
        ?>
            data-cycle-speed=<?php 
        echo $speed;
        ?>
            data-cycle-delay=<?php 
        echo $delay;
        ?>
            <?php 
        if ($enable_slider_touch == 1) {
            ?>
            data-cycle-swipe=true
            <?php 
        }
        ?>

            data-cycle-prev="> .a3-cycle-controls .cycle-prev"
            data-cycle-next="> .a3-cycle-controls .cycle-next"
            data-cycle-pager="> .cycle-pager-container .cycle-pager-inside .cycle-pager"

            <?php 
        if ($is_slider_tall_dynamic == 0) {
            ?>
            data-cycle-center-vert=true
            <?php 
        }
        ?>
            data-cycle-auto-height=<?php 
        echo $dynamic_tall;
        ?>
    		data-cycle-center-horz=true

            data-cycle-caption="<?php 
        echo $caption_class;
        ?>
"
            data-cycle-caption-template="{{name}}"
            data-cycle-caption-plugin="caption2"
            data-cycle-caption-fx-out="<?php 
        echo $caption_fx_out;
        ?>
"
            data-cycle-caption-fx-in="<?php 
        echo $caption_fx_in;
        ?>
"

            data-cycle-overlay="<?php 
        echo $overlay_class;
        ?>
"
			data-cycle-overlay-fx-out="<?php 
        echo $caption_fx_out;
        ?>
"
			data-cycle-overlay-fx-in="<?php 
        echo $caption_fx_in;
        ?>
"

            data-cycle-loader=true
        >

        	<div class="a3-cycle-controls" style="display: none;">
            	<span><a href="#" class="cycle-prev"><?php 
        _e('Prev', 'wc_product_slider');
        ?>
</a></span>
                <span><a href="#" class="cycle-next"><?php 
        _e('Next', 'wc_product_slider');
        ?>
</a></span>
                <span><a href="#" data-cycle-cmd="pause" data-cycle-context="#wc-product-slider-<?php 
        echo $unique_id;
        ?>
" onclick="return false;" class="cycle-pause" style=" <?php 
        if ($slider_settings['slider_auto_scroll'] == 'no') {
            echo 'display:none';
        }
        ?>
"><?php 
        _e('Pause', 'wc_product_slider');
        ?>
</a></span>
                <span><a href="#" data-cycle-cmd="resume" data-cycle-context="#wc-product-slider-<?php 
        echo $unique_id;
        ?>
" onclick="return false;" class="cycle-play"  style=" <?php 
        if ($slider_settings['slider_auto_scroll'] != 'no') {
            echo 'display:none';
        }
        ?>
"><?php 
        _e('Play', 'wc_product_slider');
        ?>
</a></span>
            </div>

        	<div class="cycle-pager-container" style="display: none;">
            	<div class="cycle-pager-inside">
            		<div class="cycle-pager-overlay"></div>
                	<div class="cycle-pager"></div>
                </div>
            </div>

        </div>

    </div>

    <?php 
        if ($title_position == 'bellow') {
            self::get_title_widget_skin($unique_id);
        }
        ?>

    <div id="cycle-widget-skin-overlay-<?php 
        echo $unique_id;
        ?>
" class="cycle-widget-skin-product-linked-container"></div>

    <?php 
        if ($enable_category_link == 1 && trim($category_link) != '') {
            ?>
    <div class="cycle-widget-skin-category-linked-container"><a class="cycle-category-linked" href="<?php 
            echo esc_attr($category_link);
            ?>
"><?php 
            echo trim($category_link_text);
            ?>
</a></div>
    <?php 
        }
        ?>

    <?php 
        if ($enable_tag_link == 1 && trim($tag_link) != '') {
            ?>
    <div class="cycle-widget-skin-tag-linked-container"><a class="cycle-tag-linked" href="<?php 
            echo esc_attr($tag_link);
            ?>
"><?php 
            echo trim($tag_link_text);
            ?>
</a></div>
    <?php 
        }
        ?>

    </div>
    <div style="clear:both;"></div>
    <?php 
        $slider_output = ob_get_clean();
        return str_replace(array("\r\n", "\r", "\n"), '', $slider_output);
    }
    function form($instance)
    {
        $instance = wp_parse_args((array) $instance, array('title' => '', 'category_id' => 0, 'filter_type' => '', 'widget_effect' => 'fade', 'slider_auto_scroll' => 'no'));
        $widget_id = str_replace('widget_product_cycle-', '', $this->id);
        extract($instance);
        $title = esc_attr($title);
        ?>
<p><label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:', 'wc_product_slider');
        ?>
</label> <input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo $title;
        ?>
" /></p>

<fieldset id="wc_product_slider_upgrade_area">
<legend><?php 
        _e('Upgrade to', 'wc_product_slider');
        ?>
 <a href="<?php 
        echo WC_WIDGET_PRODUCT_SLIDER_VERSION_URI;
        ?>
" target="_blank"><?php 
        _e('Widget Product Slider Version', 'wc_product_slider');
        ?>
</a> <?php 
        _e('to activate', 'wc_product_slider');
        ?>
</legend>
<p>
	<label for="<?php 
        echo $this->get_field_id('show_type');
        ?>
"><strong><?php 
        _e('Show Type:', 'wc_product_slider');
        ?>
</strong></label>
    <select class="wc_product_slider_show_type" id="<?php 
        echo $this->get_field_id('show_type');
        ?>
" name="<?php 
        echo $this->get_field_name('show_type');
        ?>
" >
		<option value="category" selected="selected" ><?php 
        _e('Category', 'wc_product_slider');
        ?>
</option>
        <option value="tag"><?php 
        _e('Tag', 'wc_product_slider');
        ?>
</option>
        <option value="featured"><?php 
        _e('Featured', 'wc_product_slider');
        ?>
</option>
        <option value="onsale"><?php 
        _e('On Sale', 'wc_product_slider');
        ?>
</option>
	</select>
</p>

<p id="<?php 
        echo $this->get_field_id('show_type');
        ?>
_tag" style="display:none">
<label for="<?php 
        echo $this->get_field_id('tag_id');
        ?>
"><?php 
        _e('Tag:', 'wc_product_slider');
        ?>
</label> 
<?php 
        wp_dropdown_categories(array('orderby' => 'name', 'name' => $this->get_field_name('tag_id'), 'id' => $this->get_field_id('tag_id'), 'class' => 'widefat', 'depth' => true, 'taxonomy' => 'product_tag'));
        ?>
</p>

<p id="<?php 
        echo $this->get_field_id('show_type');
        ?>
_filter" >
	<label for="<?php 
        echo $this->get_field_id('filter_type');
        ?>
_pro"><strong><?php 
        _e('Filter:', 'wc_product_slider');
        ?>
</strong></label>
	<select id="<?php 
        echo $this->get_field_id('filter_type');
        ?>
_pro" name="<?php 
        echo $this->get_field_name('filter_type');
        ?>
_pro" >
		<option value="" selected="selected"><?php 
        _e('Recent', 'wc_product_slider');
        ?>
</option>
        <option value="featured" <?php 
        selected($filter_type, 'featured');
        ?>
><?php 
        _e('Featured', 'wc_product_slider');
        ?>
</option>
        <option value="onsale" <?php 
        selected($filter_type, 'onsale');
        ?>
><?php 
        _e('On Sale', 'wc_product_slider');
        ?>
</option>
	</select>
</p>

<p><label><?php 
        _e('Number of products to show:', 'wc_product_slider');
        ?>
 <input class="" name="<?php 
        echo $this->get_field_name('number_products');
        ?>
" type="text" value="6" size="2" /></label><br />
<span class="description"><?php 
        _e('Important! Set -1 to show all products. Warning - Setting large numbers (unlimited) could / will have an  impact on page load speed on some sites.', 'wc_product_slider');
        ?>
</span>
</p>
</fieldset>

<p>
<label for="<?php 
        echo $this->get_field_id('category_id');
        ?>
"><?php 
        _e('Category:', 'wc_product_slider');
        ?>
</label> 
<?php 
        wp_dropdown_categories(array('orderby' => 'name', 'selected' => $category_id, 'name' => $this->get_field_name('category_id'), 'id' => $this->get_field_id('category_id'), 'class' => 'widefat', 'depth' => true, 'taxonomy' => 'product_cat'));
        ?>
</p>

<p>
	<label for="<?php 
        echo $this->get_field_id('filter_type');
        ?>
"><strong><?php 
        _e('Filter:', 'wc_product_slider');
        ?>
</strong></label>
	<select id="<?php 
        echo $this->get_field_id('filter_type');
        ?>
" name="<?php 
        echo $this->get_field_name('filter_type');
        ?>
" >
		<option value="" selected="selected"><?php 
        _e('Recent', 'wc_product_slider');
        ?>
</option>
        <option value="featured" <?php 
        selected($filter_type, 'featured');
        ?>
><?php 
        _e('Featured', 'wc_product_slider');
        ?>
</option>
        <option value="onsale" <?php 
        selected($filter_type, 'onsale');
        ?>
><?php 
        _e('On Sale', 'wc_product_slider');
        ?>
</option>
	</select>
</p>

<fieldset id="wc_product_slider_upgrade_area">
<legend><?php 
        _e('Upgrade to', 'wc_product_slider');
        ?>
 <a href="<?php 
        echo WC_WIDGET_PRODUCT_SLIDER_VERSION_URI;
        ?>
" target="_blank"><?php 
        _e('Widget Product Slider Version', 'wc_product_slider');
        ?>
</a> <?php 
        _e('to activate', 'wc_product_slider');
        ?>
</legend>
<p><label><strong><?php 
        _e('Skin Type:', 'wc_product_slider');
        ?>
</strong></label>
	<label><input type="radio" class="wc_product_slider_skin_type" data-id="<?php 
        echo $this->get_field_id('skin_type');
        ?>
" name="<?php 
        echo $this->get_field_name('skin_type');
        ?>
" value="widget" checked="checked" /> <?php 
        _e('WIDGET', 'wc_product_slider');
        ?>
</label> &nbsp;&nbsp;&nbsp;
	<label><input type="radio" class="wc_product_slider_skin_type" data-id="<?php 
        echo $this->get_field_id('skin_type');
        ?>
" name="<?php 
        echo $this->get_field_name('skin_type');
        ?>
" value="card" /> <?php 
        _e('CARD', 'wc_product_slider');
        ?>
</label>
</p>

<div id="<?php 
        echo $this->get_field_id('skin_type');
        ?>
_card" style="display:none">
    <p><label><strong><?php 
        _e('Effects Type:', 'wc_product_slider');
        ?>
</strong></label>
        <select>
        <?php 
        $transitions_list = WC_Product_Slider_Functions::card_slider_transitions_list();
        foreach ($transitions_list as $effect_key => $effect_name) {
            ?>
            <option value="<?php 
            echo $effect_key;
            ?>
"><?php 
            echo $effect_name;
            ?>
</option>
        <?php 
        }
        ?>
        </select>
    </p>
</div>
</fieldset>

<div id="<?php 
        echo $this->get_field_id('skin_type');
        ?>
_widget">
    <p><label><strong><?php 
        _e('Effects Type:', 'wc_product_slider');
        ?>
</strong></label>
        <select id="<?php 
        echo $this->get_field_id('widget_effect');
        ?>
" name="<?php 
        echo $this->get_field_name('widget_effect');
        ?>
" >
        <?php 
        $transitions_list = WC_Product_Slider_Functions::slider_transitions_list();
        foreach ($transitions_list as $effect_key => $effect_name) {
            ?>
            <option value="<?php 
            echo $effect_key;
            ?>
" <?php 
            selected($effect_key, $widget_effect);
            ?>
><?php 
            echo $effect_name;
            ?>
</option>
        <?php 
        }
        ?>
        </select>
    </p>
</div>
  
<p><label><strong><?php 
        _e('Transition Method:', 'wc_product_slider');
        ?>
</strong></label>
    <label><input type="radio" class="wc_product_slider_slider_auto_scroll" data-id="<?php 
        echo $this->get_field_id('slider_auto_scroll');
        ?>
" name="<?php 
        echo $this->get_field_name('slider_auto_scroll');
        ?>
" value="no" checked="checked" /> <?php 
        _e('MANUAL', 'wc_product_slider');
        ?>
</label> &nbsp;&nbsp;&nbsp;
    <label><input type="radio" class="wc_product_slider_slider_auto_scroll" data-id="<?php 
        echo $this->get_field_id('slider_auto_scroll');
        ?>
" name="<?php 
        echo $this->get_field_name('slider_auto_scroll');
        ?>
" value="yes" <?php 
        checked($slider_auto_scroll, 'yes');
        ?>
 /> <?php 
        _e('AUTO', 'wc_product_slider');
        ?>
</label>
</p>

<fieldset id="wc_product_slider_upgrade_area">
<legend><?php 
        _e('Upgrade to', 'wc_product_slider');
        ?>
 <a href="<?php 
        echo WC_WIDGET_PRODUCT_SLIDER_VERSION_URI;
        ?>
" target="_blank"><?php 
        _e('Widget Product Slider Version', 'wc_product_slider');
        ?>
</a> <?php 
        _e('to activate', 'wc_product_slider');
        ?>
</legend>
<div id="<?php 
        echo $this->get_field_id('slider_auto_scroll');
        ?>
_auto" <?php 
        if ($slider_auto_scroll != 'yes') {
            echo 'style="display:none"';
        }
        ?>
>
    <p><label><?php 
        _e('Auto Start Delay:', 'wc_product_slider');
        ?>
 <input name="<?php 
        echo $this->get_field_name('effect_delay');
        ?>
" type="text" value="1" size="1" /> <?php 
        _e('seconds', 'wc_product_slider');
        ?>
</label></p>
</div>

<p><label><?php 
        _e('Time Between Transitions:', 'wc_product_slider');
        ?>
 <input name="<?php 
        echo $this->get_field_name('effect_timeout');
        ?>
" type="text" value="4" size="1" /> <?php 
        _e('seconds', 'wc_product_slider');
        ?>
</label></p>
<p><label><?php 
        _e('Transition Effect Speed:', 'wc_product_slider');
        ?>
 <input name="<?php 
        echo $this->get_field_name('effect_speed');
        ?>
" type="text" value="2" size="1" /> <?php 
        _e('seconds', 'wc_product_slider');
        ?>
</label></p>

</fieldset>
       
<?php 
    }