Esempio n. 1
0
function getResizedImageTag($post, $w = null, $h = null, $c = null, $u = true, $find_thumb = false, $itemprop = false)
{
    static $mult = 0;
    if ($mult == 0) {
        $mult = min(2, max(1, get_theme_option("retina_ready")));
    }
    if (is_object($post)) {
        $alt = getPostTitle($post->ID);
    } else {
        if ((int) $post > 0) {
            $alt = getPostTitle($post);
        } else {
            $alt = basename($post);
        }
    }
    $url = getResizedImageURL($post, $w ? $w * $mult : $w, $h ? $h * $mult : $h, $c, $u, $find_thumb);
    /*
    if ($url != '') {
    	if (($url_dir = getUploadsDirFromURL($url)) !== false)
    		$size = @getimagesize($url_dir);
    	else
    		$size = false;
    	return '<img class="wp-post-image" ' . ($size!==false && isset($size[3]) ? $size[3] : '') . ' alt="' . $alt . '" src="' . $url . '">';
    } else
    	return '';
    */
    return $url != '' ? '<img class="wp-post-image"' . ($w ? ' width="' . $w . '"' : '') . ($h ? ' height="' . $h . '"' : '') . ' alt="' . $alt . '" src="' . $url . '"' . ($itemprop ? ' itemprop="image"' : '') . '>' : '';
}
Esempio n. 2
0
function sc_video($atts, $content = null)
{
    if (in_shortcode_blogger()) {
        return '';
    }
    extract(shortcode_atts(array("id" => "", "class" => "", "url" => '', "src" => '', "image" => '', "title" => 'off', "ratio" => '16:9', "autoplay" => 'off', "width" => '100%', "height" => '295', "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts));
    if ($src == '' && $url == '' && isset($atts[0])) {
        $src = $atts[0];
    }
    $ed = themerex_substr($width, -1);
    $s = getStyleString($top, $right, $bottom, $left, $width, $height != '' ? $height + (sc_param_is_on($title) ? 21 : 0) : '');
    $url = $src != '' ? $src : $url;
    if ($image != '' && sc_param_is_off($image)) {
        $image = '';
    } else {
        if (sc_param_is_on($autoplay) && is_single()) {
            $image = '';
        } else {
            if ($image > 0) {
                $attach = wp_get_attachment_image_src($image, 'full');
                if (isset($attach[0]) && $attach[0] != '') {
                    $image = $attach[0];
                }
            }
            $image = getResizedImageURL(empty($image) ? get_the_ID() : $image, $ed != '%' ? $width : null, $height);
            if (empty($image)) {
                $image = getVideoCoverImage($url);
            }
        }
    }
    $url = getVideoPlayerURL($src != '' ? $src : $url);
    $ratio = empty($ratio) ? "16:9" : str_replace(array('/', '\\', '-'), ':', $ratio);
    $video = '<video' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_video' . (!empty($class) ? ' ' . $class : '') . '"' . ' src="' . $url . '"' . ' width="' . $width . '" height="' . $height . '"' . ' data-width="' . $width . '" data-height="' . $height . '"' . ' data-ratio="' . esc_attr($ratio) . '"' . ($image ? ' data-image="' . esc_attr($image) . '"' : '') . ' data-title="' . $title . '"' . ($s != '' ? ' style="' . $s . '"' : '') . ($image && get_theme_option('substitute_video') == 'yes' || sc_param_is_on($autoplay) && is_single() ? ' autoplay="autoplay"' : '') . ' controls="controls"' . '>' . '</video>';
    if (get_custom_option('substitute_video') == 'no') {
        $video = getVideoFrame($video, $image, sc_param_is_on($title), $s);
    }
    if (get_theme_option('use_mediaelement') == 'yes') {
        themerex_enqueue_script('wp-mediaelement');
    }
    return $video;
}
echo 'post_format_' . $post_data['post_format'] . ($opt['number'] % 2 == 0 ? ' even' : ' odd') . ($opt['number'] == 0 ? ' first' : '') . ($opt['number'] == $opt['posts_on_page'] ? ' last' : '') . ($opt['add_view_more'] ? ' viewmore' : '') . (get_custom_option('show_filters') == 'yes' ? ' flt_' . join(' flt_', get_custom_option('filter_taxonomy') == 'categories' ? $post_data['post_categories_ids'] : $post_data['post_tags_ids']) : '');
?>
" data-postid="<?php 
echo esc_attr($post_data['post_id']);
?>
">
		<div class="isotopeItemWrap">
			<?php 
//thumb
if ($post_data['post_thumb']) {
    ?>
				<div class="thumb">
					<?php 
    $thumb_crop = array('portfolio_big' => '1', 'portfolio_medium' => '2', 'portfolio_mini' => '3');
    $thumb_sizes = getThumbSizes(array('thumb_size' => getThumbColumns('cub', $thumb_crop[$post_data['post_layout']]), 'thumb_crop' => true, 'sidebar' => false));
    $thumb_img = getResizedImageURL($post_data['post_attachment'], $thumb_sizes['w'], $thumb_sizes['h']);
    ?>
					<img src="<?php 
    echo esc_url($thumb_img);
    ?>
" alt="<?php 
    echo esc_attr($post_data['post_title']);
    ?>
">
				</div>
			<?php 
} else {
    if ($post_data['post_gallery']) {
        echo balanceTags($post_data['post_gallery']);
    } else {
        if ($post_data['post_video']) {
Esempio n. 4
0
function sc_text($atts, $content = null)
{
    if (in_shortcode_blogger()) {
        return '';
    }
    extract(shortcode_atts(array("id" => "", "align" => "left", "weight" => "inherit", "color" => "", "spacing" => "", "uppercase" => "", "height" => "", "class" => "", "size" => "", "position" => "inline", "box_style" => "none", "bg_color" => "", "icon_color" => "", "icon" => "", "icon_image" => "", "image_url" => "", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts));
    $factor = array('inherit' => 1, 'small' => 0.35, 'medium' => 0.55, 'large' => 1.2, 'huge' => 2);
    $image_url = getAttachmentID($image_url);
    $font_size = $size;
    $style_icon = $icon != '' || $bg_color != '' ? 'icon' : ($image_url != '' || $icon_image != '' ? 'image' : '');
    $block_size = getThumbSizes(array('thumb_size' => 'cub_mini', 'thumb_crop' => true, 'sidebar' => false));
    $image_url = $image_url !== '' ? getResizedImageURL($image_url, $block_size['w'], $block_size['h']) : '';
    $s = ($top !== '' ? 'margin-top:' . $top . 'px;' : '') . ($bottom !== '' ? 'margin-bottom:' . $bottom . 'px;' : '') . ($left !== '' ? 'margin-left:' . $left . 'px;' : '') . ($right !== '' ? 'margin-right:' . $right . 'px;' : '') . ($weight && $weight != 'inherit' ? 'font-weight:' . $weight . ';' : '') . ($color !== '' ? 'color:' . $color . ';' : '') . ($spacing !== '' ? 'letter-spacing: ' . $spacing . 'px;' : '') . ($uppercase == 'yes' || $uppercase == 'on' ? 'text-transform: uppercase;' : '') . ($size !== '' ? 'font-size: ' . $size . 'px;' : '') . ($height !== '' ? 'line-height: ' . $height . 'px;' : '');
    $c = ($style_icon !== '' ? ' sc_text_style_' . $style_icon : '') . ($align !== '' ? ' sc_text_' . $align : '') . ($box_style !== '' && $box_style !== 'none' && $style_icon !== '' ? ' sc_text_icon_box_' . $box_style : '') . ($class !== '' ? ' ' . $class : '');
    $c_ico = ' sc_icon_size_' . $size . ($position !== '' ? ' sc_icon_' . $position : ' sc_icon_inline') . ($box_style !== 'none' || $bg_color != '' ? ' sc_icon_box sc_icon_box_' . $box_style : '') . ($icon !== '' && $icon !== 'none' ? ' ' . $icon : '');
    $s_ico = ($style_icon == 'icon' ? 'font-size: ' . $font_size . 'px; line-height: ' . $font_size . 'px; ' . ($icon_color !== '' ? 'color:' . $icon_color . ';' : '') : '') . ($style_icon == 'image' ? 'background-image:url(' . ($image_url !== '' ? $image_url : ($icon_image !== '' ? get_template_directory_uri() . '/images/icons/' . $icon_image . '.png' : '')) . ');' : '') . ('width: ' . $font_size . 'px;') . ('height: ' . $font_size . 'px;') . ($bg_color !== '' ? 'background-color: ' . $bg_color . ';' : '');
    $icons = $style_icon !== '' ? '<span class="sc_icon ' . $c_ico . '" ' . ($s_ico != '' ? 'style="' . $s_ico . '"' : '') . '></span>' : '';
    $icon_left_top = $icon_right = '';
    if ($position == 'left' || $position == 'top' || $position == 'inline') {
        $icon_left_top = $icons;
    } else {
        if ($position == 'right') {
            $icon_right = $icons;
        }
    }
    return '<p ' . ($id ? ' id="sc_text_' . $id . '"' : '') . ' class="sc_text ' . $c . '"' . ($s != '' ? ' style="' . $s . '"' : '') . '>' . $icon_left_top . do_shortcode($content) . $icon_right . '</p>';
}
Esempio n. 5
0
 function getResizedImageTag($post, $w = null, $h = null, $c = null, $u = true, $find_thumb = false, $itemprop = false)
 {
     static $mult = 0;
     if ($mult == 0) {
         $mult = min(2, max(1, get_theme_option("retina_ready")));
     }
     if (is_object($post)) {
         $alt = getPostTitle($post->ID);
     } else {
         if ((int) $post > 0) {
             $alt = getPostTitle($post);
         } else {
             $alt = basename($post);
         }
     }
     $url = getResizedImageURL($post, $w ? $w * $mult : $w, $h ? $h * $mult : $h, $c, $u, $find_thumb);
     return $url != '' ? '<img class="wp-post-image"' . ($w ? ' width="' . $w . '"' : '') . ($h ? ' height="' . $h . '"' : '') . ' alt="' . $alt . '" src="' . $url . '"' . ($itemprop ? ' itemprop="image"' : '') . '>' : '';
 }