Exemplo n.º 1
0
function return_smooth_slider($slider_id = '', $offset = '0', $data = array())
{
    global $smooth_slider;
    $slider_html = '';
    if ($smooth_slider['multiple_sliders'] == '1' and is_singular()) {
        global $post;
        $post_id = $post->ID;
        if (ss_slider_on_this_post($post_id)) {
            $slider_id = get_slider_for_the_post($post_id);
        }
    }
    if ((!is_singular() or $smooth_slider['multiple_sliders'] != '1') and (empty($slider_id) or !isset($slider_id))) {
        $slider_id = '1';
    }
    if (!empty($slider_id)) {
        $set = '';
        $data['slider_id'] = $slider_id;
        $slider_handle = 'smooth_slider_' . $slider_id;
        $data['slider_handle'] = $slider_handle;
        $r_array = carousel_posts_on_slider($smooth_slider['no_posts'], $offset, $slider_id, $echo = '0', $set, $data);
        $slider_handle = 'smooth_slider_' . $slider_id;
        $slider_html = return_global_smooth_slider($slider_handle, $r_array, $slider_id, $set, $data);
    }
    //end of not empty slider_id condition
    return $slider_html;
}
function return_smooth_slider($slider_id = '')
{
    global $smooth_slider;
    if ($smooth_slider['multiple_sliders'] == '1' and is_singular() and (empty($slider_id) or !isset($slider_id))) {
        global $post;
        $post_id = $post->ID;
        $slider_id = get_slider_for_the_post($post_id);
    }
    if ($smooth_slider['multiple_sliders'] != '1' and (empty($slider_id) or !isset($slider_id))) {
        $slider_id = '1';
    }
    $slider_html = '';
    if (!empty($slider_id)) {
        if ($smooth_slider['autostep'] == '1') {
            $autostep = "enable: true";
        } else {
            $autostep = "enable: false";
        }
        if ($smooth_slider['prev_next'] == 1) {
            $defaultbuttons = "true";
        } else {
            $defaultbuttons = "false";
        }
        $sldr_title = $smooth_slider['title_text'];
        if (!empty($sldr_title)) {
            $extra_height = $smooth_slider['title_fsize'] + $smooth_slider['content_fsize'] + 5 + 18;
        } else {
            $extra_height = $smooth_slider['content_fsize'] + 5 + 5 + 18;
        }
        $nav_ht = ($smooth_slider['height'] - $extra_height) / 2;
        $fontSize = $smooth_slider['content_fsize'] + 5;
        $slider_html = $slider_html . '<script type="text/javascript">
	stepcarousel.setup({
		galleryid: "smooth_sliderc", //id of carousel DIV
		beltclass: "smooth_sliderb", //class of inner "belt" DIV containing all the panel DIVs
		panelclass: "smooth_slideri", //class of panel DIVs each holding content
		autostep: {' . $autostep . ', moveby:1, pause:' . $smooth_slider['speed'] * 1000 . '},
		panelbehavior: {speed:' . $smooth_slider['transition'] * 100 . ', wraparound: true, wrapbehavior: "slide", persist:false},
		defaultbuttons: {enable: ' . $defaultbuttons . ', moveby: 1, leftnav: ["' . smooth_slider_plugin_url('images/button_prev.png') . '", -25, ' . $nav_ht . '], rightnav: ["' . smooth_slider_plugin_url('images/button_next.png') . '", 0, ' . $nav_ht . ']},
		statusvars: ["imageA", "imageB", "imageC"], //register 3 variables that contain current panel (start), current panel (last), and total panels
		contenttype: ["inline"], //content setting ["inline"] or ["external", "path_to_external_file"]
		onslide:function(){
		  jQuery("#smooth_sliderc_nav li a").css("fontWeight", "normal");
		  jQuery("#smooth_sliderc_nav li a").css("fontSize", "' . $smooth_slider['content_fsize'] . 'px");
		  var curr_slide = imageA;
		  jQuery("#sldr"+curr_slide).css("fontWeight", "bolder");
		  jQuery("#sldr"+curr_slide).css("fontSize", "' . $fontSize . 'px");';
        if ($smooth_slider['goto_slide'] == 2) {
            global $sldr_nav_width;
            $sldr_nav_width = $smooth_slider['navimg_w'];
            // var nav_width = <?php global $sldr_nav_width; echo $sldr_nav_width;
            $slider_html = $slider_html . 'jQuery("#smooth_sliderc_nav a").css("backgroundPosition", "0 0");
			  jQuery("#sldr"+curr_slide).css("backgroundPosition", "-"+' . $sldr_nav_width . '+"px 0")';
        }
        $slider_html = $slider_html . ' }
	 })
	</script>
	<noscript><strong>This page is having a slideshow that uses Javascript. Your browser either doesn\'t support Javascript or you have it turned off. To see this page as it is meant to appear please use a Javascript enabled browser.</strong></noscript>
			<div id="smooth_sldr">
			<div id="smooth_sldr_items">
				<div id="smooth_sldr_body">';
        $sldr_title = $smooth_slider['title_text'];
        if (!empty($sldr_title)) {
            $slider_html = $slider_html . '<div class="sldr_title">' . $smooth_slider['title_text'] . '</div>';
        }
        global $smooth_sldr_j;
        $r_array = carousel_posts_on_slider($smooth_slider['no_posts'], $offset = 0, $slider_id, $echo = '0');
        $smooth_sldr_j = $r_array[0];
        $slider_html = $slider_html . '<div id="smooth_sliderc">
						<div class="smooth_sliderb">
						  ' . $r_array[1] . '
						</div>
					</div>
				</div>';
        if ($smooth_slider['goto_slide'] == 1) {
            $slider_html = $slider_html . '<ul id="smooth_sliderc_nav">';
            for ($i = 1; $i <= $smooth_sldr_j; $i++) {
                $slider_html = $slider_html . '<li><a id="sldr' . $i . '" href="javascript:stepcarousel.stepTo(\'smooth_sliderc\', ' . $i . ')" >' . $i . '</a></li>';
            }
            $slider_html = $slider_html . '</ul>';
        }
        if ($smooth_slider['goto_slide'] == 2) {
            $slider_html = $slider_html . '<div id="smooth_sliderc_nav">';
            $width = $smooth_slider['navimg_w'];
            for ($i = 1; $i <= $smooth_sldr_j; $i++) {
                $slider_html = $slider_html . '<a class="smooth_sliderc_nav" id="sldr' . $i . '" style="background-image:url(' . smooth_slider_plugin_url('images/') . 'slide' . $i . '.png);background-position:0 0;width:' . $width . 'px;height:' . $smooth_slider['navimg_ht'] . 'px;" href="javascript:stepcarousel.stepTo(\'smooth_sliderc\', ' . $i . ')" ></a>';
            }
            $slider_html = $slider_html . '</div>';
        }
        if ($smooth_slider['goto_slide'] == 3) {
            $slider_html = $slider_html . '<div id="smooth_sliderc_nav"><li style="border:none;">' . $smooth_slider["custom_nav"] . '</li></div>';
        }
        $slider_html = $slider_html . '<div class="sldrlink"><a href="http://www.clickonf5.org/smooth-slider" target="_blank">Smooth Slider</a></div>
			</div>
		</div>';
    }
    //end of not empty slider_id condition
    return $slider_html;
}
Exemplo n.º 3
0
function get_smooth_slider($slider_id='',$offset=0) {
	global $smooth_slider; 
 
	if($smooth_slider['multiple_sliders'] == '1' and is_singular() and (empty($slider_id) or !isset($slider_id))){
	global $post;
	$post_id = $post->ID;
	$slider_id = get_slider_for_the_post($post_id);
	}
	if((!is_singular() or $smooth_slider['multiple_sliders'] != '1') and (empty($slider_id) or !isset($slider_id))){
	  $slider_id = '1';
	}
	if(!empty($slider_id)){
		$r_array = carousel_posts_on_slider($smooth_slider['no_posts'], $offset, $slider_id, '0'); 
		$slider_handle='smooth_slider_'.$slider_id;
		get_global_smooth_slider($slider_handle,$r_array,$slider_id,$echo='1');
	} //end of not empty slider_id condition
}
Exemplo n.º 4
0
function return_smooth_slider($slider_id = '')
{
    global $smooth_slider;
    if ($smooth_slider['multiple_sliders'] == '1' and is_singular() and (empty($slider_id) or !isset($slider_id))) {
        global $post;
        $post_id = $post->ID;
        $slider_id = get_slider_for_the_post($post_id);
    }
    if ((!is_singular() or $smooth_slider['multiple_sliders'] != '1') and (empty($slider_id) or !isset($slider_id))) {
        $slider_id = '1';
    }
    $slider_html = '';
    if (!empty($slider_id)) {
        global $smooth_sldr_j;
        $r_array = carousel_posts_on_slider($smooth_slider['no_posts'], $offset = 0, $slider_id, $echo = '0');
        $smooth_sldr_j = $r_array[0];
        if (!isset($smooth_slider['fouc']) or $smooth_slider['fouc'] == '0') {
            $fouc = 'jQuery("html").addClass("smooth_slider_fouc");
				jQuery(document).ready(function() {
				   jQuery(".smooth_slider_fouc .smooth_sliderb").css({"display" : "block"});
				}); ';
        } else {
            $fouc = '';
        }
        if ($smooth_slider['autostep'] == '1') {
            $autostep = $smooth_slider['speed'];
        } else {
            $autostep = "0";
        }
        if ($smooth_slider['prev_next'] != 1) {
            $defaultbuttons = ", buttonPrevHTML:null, buttonNextHTML:null";
        } else {
            $defaultbuttons = "";
        }
        $prevnext = '';
        if ($smooth_slider['prev_next'] == 1) {
            $prevnext = "// Disable autoscrolling if the user clicks the prev or next button.\r\n\t\t\tcarousel.buttonNext.bind('click', function() {\r\n\t\t\t\tcarousel.startAuto(0);\r\n\t\t\t});\r\n\t\t \r\n\t\t\tcarousel.buttonPrev.bind('click', function() {\r\n\t\t\t\tcarousel.startAuto(0);\r\n\t\t\t}); ";
        }
        $sldr_title = $smooth_slider['title_text'];
        if (!empty($sldr_title)) {
            $extra_height = $smooth_slider['title_fsize'] + $smooth_slider['content_fsize'] + 5 + 18;
        } else {
            $extra_height = $smooth_slider['content_fsize'] + 5 + 5 + 18;
        }
        $nav_ht = ($smooth_slider['height'] - $extra_height) / 2;
        $fontSize = $smooth_slider['content_fsize'] + 5;
        $sldrlink = '';
        if ($smooth_slider['support'] == '1') {
            $sldrlink = '<div class="sldrlink"><a href="http://www.clickonf5.org/smooth-slider" target="_blank">Smooth Slider</a></div>';
        }
        $slider_html = $slider_html . '<script type="text/javascript"> ' . $fouc . '	
function smooth_slider_initCallback(carousel) {
    jQuery("#smooth_slider .jcarousel-control a").bind("click", function() {
	    var navclass = jQuery(this).attr("class");
		var slide = navclass.replace("sldr", "");
        carousel.scroll(jQuery.jcarousel.intval(slide));
		carousel.startAuto(0);
        return false;
    });
	' . $prevnext . '
 
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};
function smooth_slider_itemFirstInCallback(carousel, jitem, idx, state) {
	jQuery("#smooth_slider .jcarousel-control a").css("fontWeight", "normal");
	jQuery("#smooth_slider .jcarousel-control a").css("fontSize", "' . $smooth_slider['content_fsize'] . 'px");
	var curr_slide = idx;
	jQuery("#smooth_slider .jcarousel-control a.sldr"+curr_slide).css("fontWeight", "bolder");
	jQuery("#smooth_slider .jcarousel-control a.sldr"+curr_slide).css("fontSize", "' . $fontSize . 'px"); ';
        if ($smooth_slider['goto_slide'] == 2) {
            global $sldr_nav_width;
            $sldr_nav_width = $smooth_slider['navimg_w'];
            $slider_html = $slider_html . 'jQuery("#smooth_slider .jcarousel-control a").css("backgroundPosition", "0 0");
		  jQuery("#smooth_slider .jcarousel-control a.sldr"+curr_slide).css("backgroundPosition", "-"+' . $sldr_nav_width . '+"px 0");';
        }
        $slider_html = $slider_html . ' }
	 
	jQuery(document).ready(function() {
    jQuery("#smooth_slider").jcarousel({
        size: ' . $smooth_sldr_j . ',
		scroll: 1,
		visible: 1,
		auto:' . $autostep . ',
		wrap:"last",
		animation:' . $smooth_slider["transition"] * 100 . ',
        initCallback: smooth_slider_initCallback,
		itemVisibleInCallback:{ onAfterAnimation:smooth_slider_itemFirstInCallback }
		' . $defaultbuttons . '
    });
});
	</script>
	<noscript><p><strong>' . $smooth_slider['noscript'] . '</strong></p></noscript>
			<div id="smooth_slider" class="jcarousel-skin-' . $smooth_slider['stylesheet'] . ' smooth_slider">';
        if ($smooth_slider['title_from'] == '1') {
            $sldr_title = get_smooth_slider_name($slider_id);
        } else {
            $sldr_title = $smooth_slider['title_text'];
        }
        if (!empty($sldr_title)) {
            $slider_html = $slider_html . '<div class="sldr_title">' . $smooth_slider['title_text'] . '</div>';
        }
        $slider_html = $slider_html . '<ul class="smooth_sliderb">
						  ' . $r_array[1] . '
						</ul>';
        if ($smooth_slider['goto_slide'] == 1) {
            $slider_html = $slider_html . '<div class="jcarousel-control">';
            for ($i = 1; $i <= $smooth_sldr_j; $i++) {
                $slider_html = $slider_html . '<a href="#" class="sldr' . $i . ' smooth_sliderc_nav" >' . $i . '</a>';
            }
            $slider_html = $slider_html . '</div>';
        }
        if ($smooth_slider['goto_slide'] == 2) {
            $slider_html = $slider_html . '<div class="jcarousel-control">';
            $width = $smooth_slider['navimg_w'];
            for ($i = 1; $i <= $smooth_sldr_j; $i++) {
                $slider_html = $slider_html . '<a class="sldr' . $i . ' smooth_sliderc_nav" style="background-image:url(' . smooth_slider_plugin_url("images") . 'slide' . $i . '.png);background-position:0 0;width:".$width."px;height:' . $smooth_slider["navimg_ht"] . 'px;\\" href="#" ></a>';
            }
            $slider_html = $slider_html . '</div>';
        }
        if ($smooth_slider['goto_slide'] == 3) {
            $slider_html = $slider_html . '<div id="jcarousel-control">' . $smooth_slider["custom_nav"] . '</div>';
        }
        $slider_html = $slider_html . $sldrlink . '<div class="sldr_clearlt"></div><div class="sldr_clearrt"></div>
		</div>';
    }
    //end of not empty slider_id condition
    return $slider_html;
}