Пример #1
0
 function cb_get_featured_image_style($cb_featured_image_style, $post, $cb_page = NULL)
 {
     $cb_mobile = new Mobile_Detect();
     $cb_post_id = $post->ID;
     $cb_post_format_media = $cb_media_data = $cb_title_closer = $cb_get_fis_tl = NULL;
     $cb_phone = $cb_mobile->isMobile();
     $cb_tablet = $cb_mobile->isTablet();
     if ($cb_tablet == true || $cb_phone == true) {
         $cb_is_mobile = true;
     } else {
         $cb_is_mobile = false;
     }
     $cb_post_format = get_post_format($cb_post_id);
     $cb_video_post_select = get_post_meta($cb_post_id, 'cb_video_post_select', true);
     $cb_audio_post_style = get_post_meta($cb_post_id, 'cb_audio_post_style', true);
     $cb_featured_image_style = get_post_meta($cb_post_id, 'cb_featured_image_style', true);
     $cb_review_checkbox = get_post_meta($cb_post_id, 'cb_review_checkbox', true);
     $cb_audio_url = get_post_meta($cb_post_id, 'cb_soundcloud_embed_code_post', true);
     $cb_credit_line = get_post_meta($cb_post_id, 'cb_image_credit', true);
     if ($cb_featured_image_style == NULL) {
         $cb_featured_image_style = 'standard';
     }
     $cb_featured_image_style_override_onoff = ot_get_option('cb_post_style_override_onoff', 'off');
     $cb_featured_image_style_override_style = ot_get_option('cb_post_style_override', 'standard');
     $cb_featured_image_style_override_post_onoff = get_post_meta($post->ID, 'cb_featured_image_style_override', true);
     if ($cb_featured_image_style_override_onoff == 'on' && $cb_featured_image_style_override_post_onoff != 'on' && is_page() == false) {
         $cb_featured_image_style = $cb_featured_image_style_override_style;
     }
     if (is_attachment()) {
         $cb_featured_image_style = 'off';
     }
     if ($cb_credit_line != NULL) {
         $cb_credit_line = '<span class="cb-credit-line">' . $cb_credit_line . '</span>';
     }
     if ($cb_review_checkbox == 'on' || $cb_review_checkbox == '1') {
         $cb_item_type = 'itemprop="itemReviewed"';
     } else {
         $cb_item_type = 'itemprop="headline"';
     }
     $cb_output = $cb_title = $cb_featured_image_url = $cb_image = NULL;
     if ($cb_page == NULL) {
         $cb_get_fis_tl = cb_get_fis_tl($cb_post_id);
         $cb_title .= '<div class="cb-entry-header cb-meta clearfix">';
         $cb_title .= '<h1 class="entry-title cb-entry-title cb-title" ' . $cb_item_type . '>' . get_the_title() . '</h1>';
         $cb_title .= apply_filters('cb_after_post_h1', '');
         if ($cb_featured_image_style != 'standard' && $cb_featured_image_style != 'standard-uncrop' && $cb_featured_image_style != 'off' && $cb_featured_image_style != NULL || $cb_post_format == 'gallery') {
             $cb_title .= cb_get_byline($cb_post_id, true, true, true, true);
         } else {
             $cb_title .= cb_get_byline($cb_post_id, NULL, NULL, NULL, true);
         }
         if ($cb_featured_image_style == 'standard' || $cb_featured_image_style == 'standard-uncrop' || $cb_featured_image_style == 'off') {
             $cb_title .= cb_get_post_meta($cb_post_id, true);
         }
         if ($cb_post_format == 'video' && $cb_video_post_select == '2' || $cb_post_format == 'audio' && $cb_audio_post_style == '2') {
             $cb_media_data = '<div id="cb-video-data" class="cb-media-icon"><a href="#cb-video-overlay" id="cb-media-play" class="cb-video-overlay-icon cb-circle"><i class="fa fa-play"></i></a></div>';
         }
         $cb_title_closer .= '</div>';
     } elseif ($cb_page == 'page-overlay') {
         $cb_get_fis_tl = NULL;
         $cb_page_title = get_post_meta($cb_post_id, 'cb_page_title', true);
         if ($cb_page_title != 'off') {
             $cb_title .= '<div class="cb-entry-header cb-meta clearfix">';
             $cb_title .= '<h1 class="entry-title cb-entry-title cb-title" ' . $cb_item_type . '>' . get_the_title() . '</h1>';
             $cb_title .= '</div>';
         }
     }
     $cb_gallery_post_images = get_post_meta($cb_post_id, 'cb_gallery_post_images', true);
     if ($cb_post_format == 'gallery' && $cb_gallery_post_images != NULL) {
         $cb_output .= cb_get_post_format_data($cb_post_id, $cb_post_format);
     } elseif ($cb_post_format == 'video' && $cb_video_post_select == '1' || $cb_post_format == 'audio' && $cb_audio_post_style == '1') {
         $cb_responsive = NULL;
         $cb_video_url = get_post_meta($cb_post_id, 'cb_video_embed_code_post', true);
         if (strpos($cb_video_url, 'vime') !== false || strpos($cb_video_url, 'yout') !== false) {
             $cb_responsive = ' cb-video-frame';
         }
         if ($cb_featured_image_style == 'standard' || $cb_featured_image_style == 'off' || $cb_featured_image_style == 'standard-uncrop') {
             $cb_output .= '<div id="cb-featured-image" class="cb-fis cb-fis-block-video' . $cb_responsive . '">' . $cb_title . $cb_title_closer . cb_get_post_format_data($cb_post_id, $cb_post_format) . '</div>';
         } else {
             $cb_output .= '<div id="cb-featured-image" class="cb-fis wrap cb-site-padding cb-fis-block-video' . $cb_responsive . '">' . $cb_title . $cb_title_closer . cb_get_post_format_data($cb_post_id, $cb_post_format) . '</div>';
         }
     } elseif ($cb_featured_image_style == 'off') {
         $cb_output .= $cb_title . $cb_title_closer;
     } elseif ($cb_featured_image_style == 'standard' || $cb_featured_image_style == 'standard-uncrop') {
         if ($cb_featured_image_style == 'standard-uncrop') {
             $cb_width = $cb_height = 'full';
         } else {
             $cb_width = 759;
             $cb_height = 500;
         }
         $cb_fis = '<div class="cb-mask">' . cb_get_thumbnail($cb_width, $cb_height, $cb_post_id, false) . $cb_media_data . $cb_credit_line . '</div>';
         $cb_output .= '<div id="cb-featured-image" class="cb-fis cb-fis-block-standard">';
         if ($cb_get_fis_tl == 'cb-fis-tl-st-above') {
             $cb_output .= $cb_title . $cb_title_closer . $cb_fis;
         } else {
             $cb_output .= $cb_fis . $cb_title . $cb_title_closer;
         }
         $cb_output .= '</div>';
     } elseif ($cb_featured_image_style == 'site-width' || $cb_featured_image_style == 'full-width' || $cb_featured_image_style == 'screen-width') {
         $cb_featured_image_url = cb_get_thumbnail_url(1400, 600, $cb_post_id);
         if ($cb_featured_image_url != NULL) {
             if ($cb_featured_image_style == 'screen-width') {
                 $cb_class = ' cb-fis-block-screen-width';
             } else {
                 $cb_class = ' wrap';
             }
             if ($cb_get_fis_tl == 'cb-fis-tl-me-above') {
                 $cb_output = '<div class="cb-fis-title-bg clearfix wrap">' . $cb_title . $cb_title_closer . '</div>';
                 $cb_output .= '<div id="cb-featured-image" data-cb-bs-fis="' . $cb_featured_image_url[0] . '" class="cb-fis cb-fis-big cb-fis-not-bg cb-fis-block-site-width' . $cb_class . ' cb-fis-block-background"><div class="cb-meta cb-no-mt">' . $cb_media_data . '</div>' . $cb_credit_line;
                 $cb_output .= '</div>';
             } elseif ($cb_get_fis_tl == 'cb-fis-tl-me-below') {
                 $cb_output = '<div id="cb-featured-image" data-cb-bs-fis="' . $cb_featured_image_url[0] . '" class="cb-fis cb-fis-big cb-fis-not-bg cb-fis-block-site-width' . $cb_class . ' cb-fis-block-background"><div class="cb-meta cb-no-mt">' . $cb_media_data . '</div>' . $cb_credit_line;
                 $cb_output .= '</div>';
                 $cb_output .= '<div class="cb-fis-title-bg clearfix wrap">' . $cb_title . $cb_title_closer . '</div>';
             } else {
                 $cb_output = '<div id="cb-featured-image" data-cb-bs-fis="' . $cb_featured_image_url[0] . '" class="cb-fis cb-fis-big cb-fis-not-bg cb-fis-block-site-width' . $cb_class . ' cb-fis-block-background">';
                 $cb_output .= $cb_title . $cb_media_data . $cb_title_closer . $cb_credit_line;
                 $cb_output .= '</div>';
             }
         }
     } elseif ($cb_featured_image_style == 'full-background' || $cb_featured_image_style == 'parallax' && $cb_is_mobile == true) {
         $cb_featured_image_url = cb_get_thumbnail_url('full', 'full', $cb_post_id);
         if ($cb_featured_image_url != NULL) {
             if ($cb_get_fis_tl == 'cb-fis-tl-below') {
                 $cb_output = '<div id="cb-featured-image" data-cb-bs-fis="' . $cb_featured_image_url[0] . '" class="cb-fis cb-fis-fs cb-fis-big cb-fis-block-background"><div class="cb-meta cb-no-mt">' . $cb_media_data . '</div>' . $cb_credit_line;
                 $cb_output .= cb_get_arrow_down();
                 $cb_output .= '</div>';
                 $cb_output .= '<div class="cb-fis-title-bg clearfix wrap">' . $cb_title . $cb_title_closer . '</div>';
             } else {
                 $cb_output = '<div id="cb-featured-image" data-cb-bs-fis="' . $cb_featured_image_url[0] . '" class="cb-fis cb-fis-fs cb-fis-big cb-fis-block-background">';
                 $cb_output .= $cb_title . $cb_media_data . $cb_title_closer . $cb_credit_line;
                 $cb_output .= cb_get_arrow_down();
                 $cb_output .= '</div>';
             }
         }
     } elseif ($cb_featured_image_style == 'background-slideshow') {
         $cb_gallery_post_images = get_post_meta($cb_post_id, 'cb_post_background_slideshow', true);
         if ($cb_gallery_post_images != NULL) {
             $cb_featured_img_src = $cb_count = NULL;
             $cb_gallery_images = cb_get_gallery_images($cb_post_id, $cb_gallery_post_images);
             foreach ($cb_gallery_images as $cb_slide) {
                 if ($cb_count != 0) {
                     $cb_featured_img_src .= ",";
                 }
                 $cb_featured_img_src .= esc_url($cb_slide['cb-url']);
                 $cb_count++;
             }
             $cb_output = '<div id="cb-featured-image" class="cb-fis cb-fis-fs cb-fis-big cb-fis-block-background cb-fis-block-slideshow cb-background-preload" data-cb-bs-fis="' . $cb_featured_img_src . '">';
             $cb_output .= $cb_title . $cb_media_data . $cb_title_closer;
             $cb_output .= cb_get_arrow_down();
             $cb_output .= $cb_credit_line;
             $cb_output .= '</div>';
         }
     } elseif ($cb_featured_image_style == 'parallax') {
         $cb_featured_image_url = cb_get_thumbnail_url('full', 'full', $cb_post_id);
         if ($cb_featured_image_url != NULL) {
             if ($cb_get_fis_tl == 'cb-fis-tl-below') {
                 $cb_output = '<div id="cb-featured-image" class="cb-fis cb-fis-fs cb-fis-big cb-fis-block-parallax clearfix">';
                 $cb_output .= '<div class="cb-meta cb-no-mt">' . $cb_media_data . '</div>';
                 $cb_output .= cb_get_arrow_down();
                 $cb_output .= $cb_credit_line;
                 $cb_output .= '</div>';
                 $cb_output .= '<div id="cb-parallax-bg"><div id="cb-par-wrap"><img class="cb-image" src="' . $cb_featured_image_url[0] . '" alt=""></div></div>';
                 $cb_output .= '<div class="cb-fis-title-bg clearfix wrap">' . $cb_title . $cb_title_closer . '</div>';
             } else {
                 $cb_output = '<div id="cb-featured-image" class="cb-fis cb-fis-fs cb-fis-big cb-fis-block-parallax clearfix">';
                 $cb_output .= $cb_title . $cb_media_data . $cb_title_closer;
                 $cb_output .= cb_get_arrow_down();
                 $cb_output .= $cb_credit_line;
                 $cb_output .= '</div>';
                 $cb_output .= '<div id="cb-parallax-bg"><div id="cb-par-wrap"><img class="cb-image" src="' . $cb_featured_image_url[0] . '" alt=""></div></div>';
             }
         }
     }
     return $cb_output;
 }
$cb_body_class .= cb_get_body_classes();
$cb_review_checkbox = $cb_bg_to_img = $cb_bg_ad = NULL;
$cb_bg_to = ot_get_option('cb_bg_to', 'off');
$cb_logo = ot_get_option('cb_logo_url', NULL);
$cb_show_header = $cb_show_m_header = NULL;
if (cb_header_banner() != NULL) {
    $cb_hd_wrap_s = ' cb-with-block';
}
if (is_singular()) {
    $cb_body_class .= cb_get_post_fis($post->ID);
    $cb_body_class .= cb_get_singular_fs($post->ID);
    $cb_show_header = cb_show_header();
}
if (is_single()) {
    $cb_review_checkbox = get_post_meta($post->ID, 'cb_review_checkbox', true);
    $cb_body_class .= cb_get_dropcap($post->ID) . ' ' . cb_get_fis_tl($post->ID);
    $cb_post_format = get_post_format($post->ID);
    if ($cb_post_format == 'gallery') {
        $cb_bg_to = NULL;
    }
}
if (is_category() || is_home()) {
    $cb_body_class .= cb_get_featured_block();
}
if (ot_get_option('cb_h_logo_mobile', 'on') == 'off') {
    $cb_body_class .= ' cb-h-logo-off';
}
if (($cb_only_mob = cb_top_nav_right() != NULL || has_nav_menu('top')) == NULL) {
    $cb_body_class .= ' cb-mob-only';
}
if ($cb_show_header == NULL) {