Ejemplo n.º 1
0
function sc_slider($atts, $content = null)
{
    global $mult;
    if (in_shortcode_blogger()) {
        return '';
    }
    extract(shortcode_atts(array("id" => "", "engine" => "swiper", "alias" => "", "ids" => "", "cat" => "", "count" => "0", "offset" => "", "orderby" => "date", "order" => 'desc', "border" => "none", "controls" => "no", "pagination" => "no", "caption" => "no", "links" => "no", "align" => "", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => "", "info" => "yes", "progressbar" => "", "date_before" => "", "date_after" => ""), $atts));
    global $THEMEREX_sc_slider_engine, $THEMEREX_sc_slider_width, $THEMEREX_sc_slider_height, $THEMEREX_sc_slider_links, $trex_accent_color;
    $THEMEREX_sc_slider_engine = $engine;
    $THEMEREX_sc_slider_width = $width;
    $THEMEREX_sc_slider_height = $height;
    $THEMEREX_sc_slider_links = sc_param_is_on($links);
    $show_pagination = in_array($pagination, array('default', 'thumbs', 'icons')) ? true : false;
    $s = ($top !== '' ? 'margin-top:' . $top . 'px;' : '') . ($bottom !== '' ? 'margin-bottom:' . $bottom . 'px;' : '') . ($left !== '' ? 'margin-left:' . $left . 'px;' : '') . ($right !== '' ? 'margin-right:' . $right . 'px;' : '') . (!empty($width) ? 'width:' . $width . (themerex_strpos($width, '%') !== false ? '' : 'px') . ';' : '') . (!empty($height) ? 'height:' . $height . (themerex_strpos($height, '%') !== false ? '' : 'px') . ';' : '');
    $output = '';
    if ($pagination == 'thumbs' || $pagination == 'icons') {
        $output .= '<div class="slider_wrap">';
    }
    $output .= ($border != 'none' ? '<div class="sc_border sc_border_' . $border . ($align != '' && $align != 'none' ? ' sc_align' . $align : '') . '">' : '') . '<div' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_slider' . ' sc_slider_' . $engine . (sc_param_is_on($controls) ? ' sc_slider_controls' : ' sc_slider_nocontrols') . (!empty($width) && $width < 600 ? ' sc_slider_compact' : '') . ($pagination == 'default' ? ' sc_slider_pagination' : ' sc_slider_nopagination') . ' pagination_style_' . $pagination . (sc_param_is_on($progressbar) ? ' sc_slider_progress' : '') . ($border == 'none' && $align != '' && $align != 'none' ? ' sc_align' . $align : '') . ($engine == 'swiper' ? ' swiper-container' : '') . '"' . ($s != '' ? ' style="' . $s . '"' : '') . '>';
    if ($engine == 'revo') {
        if (revslider_exists() && !empty($alias)) {
            $output .= do_shortcode('[rev_slider ' . $alias . ']');
        } else {
            $output = '';
        }
    } else {
        if ($engine == 'royal') {
            if (royalslider_exists() && !empty($alias)) {
                $output .= do_shortcode('[[new_royalslider id="' . $alias . '"]');
            } else {
                $output = '';
            }
        } else {
            if ($engine == 'swiper') {
                $output .= '<ul class="slides' . ($engine == 'swiper' ? ' swiper-wrapper' : '') . '">';
                $content = empty($ids) || empty($cat) ? do_shortcode($content) : '';
                if ($content) {
                    $output .= $content;
                } else {
                    global $post;
                    if (!empty($ids)) {
                        $posts = explode(',', $ids);
                        $count = count($posts);
                    }
                    $args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $count, 'ignore_sticky_posts' => 1, 'order' => $order == 'asc' ? 'asc' : 'desc');
                    if ($offset > 0 && empty($ids)) {
                        $args['offset'] = $offset;
                    }
                    $args = addSortOrderInQuery($args, $orderby, $order, true);
                    $args = addPostsAndCatsInQuery($args, $ids, $cat);
                    if (!empty($date_before)) {
                        $args['date_query']['before'] = $date_before;
                    }
                    if (!empty($date_after)) {
                        $args['date_query']['after'] = $date_after;
                    }
                    $query = new WP_Query($args);
                    $pagination_posts = $show_pagination ? array() : '';
                    $i = 0;
                    while ($query->have_posts()) {
                        $query->the_post();
                        $post_id = get_the_ID();
                        $post_link = get_permalink();
                        $post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id));
                        $post_accent_color = '';
                        $post_category = '';
                        $post_category_link = '';
                        $post_title = getPostTitle($post_id);
                        $post_title = '<span>' . str_replace(' ', '</span><span>', $post_title) . '</span>';
                        $post_obj = get_post($post_id);
                        $post_content = $post_obj->post_content;
                        $post_format = get_post_format($post_id);
                        if ($post_format == 'video') {
                            $post_video = getPostVideo($post_content);
                            $post_video_frame = '<iframe class="video_frame"' . ' src="' . getVideoPlayerURL($post_video) . '"' . ' width="100%"' . (!empty($height) ? ' height=' . $height . 'px' : '') . ' frameborder="0" webkitAllowFullScreen="webkitAllowFullScreen" mozallowfullscreen="mozallowfullscreen" allowFullScreen="allowFullScreen"></iframe>';
                        }
                        $post_author_data = get_userdata($post_obj->post_author);
                        $post_author = $post_author_data->user_nicename;
                        $author_link = get_author_posts_url($post_obj->post_author);
                        $post_date = '<i class="icon-clock-1"></i>' . date('M d, Y', strtotime($post_obj->post_date));
                        $post_comments = $post_obj->comment_count;
                        $post_comments_link = '<a href="' . $post_link . '"><i class="icon-comment-1"></i>' . $post_comments . '</a>';
                        $post_info = '<div class="slide_info">' . __('By ', 'themerex') . '<a href="' . $author_link . '">' . $post_author . '</a><span class="separator">|</span>' . $post_date . '<span class="separator">|</span>' . $post_comments_link . '</div>';
                        $output .= '<li' . ($engine == 'swiper' ? ' class="swiper-slide' . ($post_format == 'video' ? ' format-video' : '') . '"' : '') . ' style="background-image:url(' . $post_attachment . ');' . (!empty($width) ? 'width:' . $width . (themerex_strpos($width, '%') !== false ? '' : 'px') . ';' : '') . (!empty($height) ? 'height:' . $height . (themerex_strpos($height, '%') !== false ? '' : 'px') . ';' : '') . '"' . ($post_format == 'video' && !empty($post_video_frame) ? ' data-video="' . esc_attr($post_video_frame) . '"' : '') . ' >';
                        $output .= '<a href="' . $post_link . '" class="sc_slider_post_link"></a>';
                        $output .= '<div class="slider_info_wrap" ' . (!empty($height) ? 'style="height:' . $height . 'px"' : '') . '>';
                        if (!sc_param_is_off($caption)) {
                            $post_hover_bg = get_custom_option('theme_color', null, $post_id);
                            $post_bg = '';
                            $output .= '<div class="sc_slider_info' . ($caption == 'fixed' ? ' sc_slider_info_fixed' : '') . ($engine == 'swiper' ? ' content-slide' : '') . '">';
                            $post_descr = getPostDescription();
                            $output .= '<h2 class="sc_slider_subtitle">' . $post_title . '</h2>';
                            $output .= $info == 'yes' ? $post_info : '';
                            $output .= '</div>';
                        }
                        $output .= '</div>';
                        $output .= '</li>';
                        if ($show_pagination) {
                            $post_format = get_post_format($post_id);
                            $format_icon = getPostFormatIcon($post_format);
                            $pagination_posts[$i] = '<li class="pagination_post swiper-slide' . ($i == 0 ? ' current' : '') . '">';
                            if ($pagination == 'thumbs') {
                                $pagination_posts[$i] .= !empty($post_attachment) ? '<div class="post_thumb">' . getResizedImageTag($post_attachment, 50 * $mult, 50 * $mult) . '</div>' : '';
                            } else {
                                $pagination_posts[$i] .= '<div class="post_icon"><i class="' . $format_icon . '"></i></div>';
                                $post_info = $post_date . '<span class="separator">|</span><i class="icon-comment-1"></i>' . $post_comments;
                            }
                            $pagination_posts[$i] .= '<div class="pagi_wrap">';
                            $pagination_posts[$i] .= '<h4>' . getPostTitle($post_id) . '</h4>';
                            $pagination_posts[$i] .= !empty($post_info) && $pagination != 'thumbs' ? '<div class="post_info">' . $post_info . '</div>' : '';
                            $pagination_posts[$i] .= '</div>';
                            $pagination_posts[$i] .= '</li>';
                        }
                        $i++;
                    }
                    wp_reset_postdata();
                }
                $output .= '</ul>';
                if ($show_pagination) {
                    if (!empty($pagination_posts)) {
                        $pagination_output = '';
                        foreach ($pagination_posts as $pagi_post) {
                            $pagination_output .= $pagi_post;
                        }
                    }
                }
                if (sc_param_is_on($controls)) {
                    $output .= '
				<ul class="flex-direction-nav">
					<li><a class="flex-prev" href="#">' . (!empty($width) && $width < 600 ? '<span class="icon-left-open-big"></span>' : '') . '</a></li>
					<li><a class="flex-next" href="#">' . (!empty($width) && $width < 600 ? '<span class="icon-right-open-big"></span>' : '') . '</a></li>
				</ul>';
                }
            } else {
                $output = '';
            }
        }
    }
    $output .= !empty($output) ? ($border != 'none' ? '</div>' : '') . '</div>' : '';
    $output .= '<div class="flex-control-nav"' . (!empty($pagination_output) ? ' style="height:' . $height . 'px"' : '') . '>' . (!empty($pagination_output) ? '<div class="swipe_scroll_vertical"></div><ul class="slides swiper-wrapper">' . $pagination_output . '</ul></div>' : '') . '</div>';
    return $output;
}
Ejemplo n.º 2
0
function sc_zoom($atts, $content = null)
{
    if (in_shortcode_blogger()) {
        return '';
    }
    extract(shortcode_atts(array("id" => "", "class" => "", "src" => "", "url" => "", "over" => "", "border" => "none", "align" => "", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts));
    $s = getStyleString('!' . $top, '!' . $right, '!' . $bottom, '!' . $left, $width, $height);
    $width = getStyleValue($width);
    $height = getStyleValue($height);
    if (empty($id)) {
        $id = 'sc_zoom_' . str_replace('.', '', mt_rand());
    }
    themerex_enqueue_script('elevate-zoom', themerex_get_file_url('/js/jquery.elevateZoom-3.0.4.min.js'), array(), null, true);
    $src = $src != '' ? $src : $url;
    if ($src > 0) {
        $attach = wp_get_attachment_image_src($src, 'full');
        if (isset($attach[0]) && $attach[0] != '') {
            $src = $attach[0];
        }
    }
    if ($over > 0) {
        $attach = wp_get_attachment_image_src($over, 'full');
        if (isset($attach[0]) && $attach[0] != '') {
            $over = $attach[0];
        }
    }
    return empty($src) ? '' : (!sc_param_is_off($border) ? '<div class="sc_border sc_border_' . $border . '">' : '') . '<div' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_zoom' . (!empty($class) ? ' ' . $class : '') . '"' . ($s != '' ? ' style="' . $s . '"' : '') . '>' . '<img src="' . $src . '"' . ($height != '' ? ' style="height:' . $height . ';"' : '') . ' data-zoom-image="' . $over . '" alt="" />' . '</div>' . (!sc_param_is_off($border) ? '</div>' : '');
}
Ejemplo n.º 3
0
function sc_zoom($atts, $content = null)
{
    if (in_shortcode_blogger()) {
        return '';
    }
    extract(shortcode_atts(array("id" => "", "src" => "", "url" => "", "over" => "", "border" => "none", "align" => "", "width" => "-1", "height" => "-1", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts));
    $url = getAttachmentID($url);
    $src = getAttachmentID($src);
    $over = getAttachmentID($over);
    $ed = themerex_substr($width, -1) == '%' ? '%' : 'px';
    $width = (int) str_replace('%', '', $width);
    $s = ($top > 0 ? 'margin-top:' . $top . 'px !important;' : '') . ($bottom > 0 ? 'margin-bottom:' . $bottom . 'px !important;' : '') . ($left > 0 ? 'margin-left:' . $left . 'px !important;' : '') . ($right > 0 ? 'margin-right:' . $right . 'px !important;' : '') . ($width > 0 ? 'width:' . $width . $ed . ';' : '') . ($height > 0 ? 'height:' . $height . 'px;' : '');
    if (empty($id)) {
        $id = 'sc_zoom_' . str_replace('.', '', mt_rand());
    }
    themerex_enqueue_script('elevate-zoom', get_template_directory_uri() . '/js/jquery.elevateZoom-3.0.4.min.js', array(), null, true);
    return (!sc_param_is_off($border) ? '<div class="sc_border sc_border_' . $border . '">' : '') . '<div' . ($id ? ' id="sc_zoom_' . $id . '"' : '') . ' class="sc_zoom"' . ($s != '' ? ' style="' . $s . '"' : '') . '>' . '<img src="' . ($src != '' ? $src : $url) . '"' . ($height > 0 ? ' style="height:' . $height . 'px;"' : '') . ' border="0" data-zoom-image="' . $over . '" alt="" />' . '</div>' . (!sc_param_is_off($border) ? '</div>' : '');
}