Exemplo n.º 1
0
    function __construct($args, $page_title)
    {
        global $onepage;
        $poster_id = false;
        $limit_width = $limit_content_width = $content_html = $content_width = $header_title = $header_title_custom = $header_title_font = $header_title_size = $header_title_height = $header_title_spacing = $header_title_weight = $header_title_italic = $header_title_transform = $header_background = $header_container_background = $header_title = $header_parallax = $header_parallax_class = $height_style = $data_height = $header_background_video = $back_mime = $back_mime_css = $header_background_selfvideo = $header_overlay_color = $header_overlay_color_alpha = $header_overlay_pattern = $header_container_overlay_color = $header_container_overlay_color_alpha = $header_container_overlay_pattern = $header_align = $header_scroll_opacity = $header_scrolldown = '';
        $boxed = ot_get_option('_uncode_boxed');
        if ($boxed !== 'on') {
            if (isset($args['_uncode_header_full_width'][0]) && $args['_uncode_header_full_width'][0] !== '') {
                if ($args['_uncode_header_full_width'][0] === 'limit') {
                    $limit_width = ' limit-width';
                }
            } else {
                $header_width = ot_get_option('_uncode_header_full');
                if ($header_width === 'off') {
                    $limit_width = ' limit-width';
                }
            }
            if (isset($args['_uncode_header_content_width'][0]) && $args['_uncode_header_content_width'][0] !== 'on') {
                $limit_content_width = ' limit-width';
            }
            if (isset($args['_uncode_header_custom_width'][0])) {
                if ($args['_uncode_header_custom_width'][0] != '100') {
                    $content_width = ' style="max-width: ' . $args['_uncode_header_custom_width'][0] . '%;"';
                }
            }
        }
        if ($onepage) {
            if (isset($args['_uncode_scroll_header_name'][0]) && $args['_uncode_scroll_header_name'][0] !== '') {
                $onepage_header_name = esc_attr($args['_uncode_scroll_header_name'][0]);
                $onepage_header_name = ' data-label="' . $onepage_header_name . '" data-name="' . sanitize_title($onepage_header_name) . '"';
            } else {
                $onepage_header_name = '';
            }
        } else {
            $onepage_header_name = '';
        }
        /** style **/
        if (isset($args['_uncode_header_height'][0]) && $args['_uncode_header_height'][0] !== '') {
            $height = $args['_uncode_header_height'][0];
            if ($height[1] == '%') {
                $data_height = ' data-height="' . $height[0] . '"';
            }
            if ($height[1] == 'px') {
                $data_height = ' data-height="fixed"';
                $height_style .= 'height: ' . $height[0] . $height[1] . ';';
            }
        }
        if (isset($args['_uncode_header_min_height'][0]) && $args['_uncode_header_min_height'][0] !== '') {
            $min_height = intval(preg_replace('/[^0-9]+/', '', $args['_uncode_header_min_height'][0]), 10);
            $height_style .= 'min-height: ' . $min_height . 'px;';
        }
        if ($height_style !== '') {
            $height_style = ' style="' . $height_style . '"';
        }
        $header_style = isset($args['_uncode_header_style']) ? $args['_uncode_header_style'][0] : 'light';
        $header_align = isset($args['_uncode_header_align']) ? $args['_uncode_header_align'][0] : 'center';
        if (isset($args['_uncode_header_title'])) {
            $header_title = $args['_uncode_header_title'][0];
        }
        if (isset($args['_uncode_header_title_custom'])) {
            $header_title_custom = $args['_uncode_header_title_custom'][0];
        }
        if (isset($args['_uncode_header_title_font'])) {
            $header_title_font = $args['_uncode_header_title_font'][0];
        }
        if (isset($args['_uncode_header_title_size'])) {
            $header_title_size = $args['_uncode_header_title_size'][0];
        }
        if (isset($args['_uncode_header_title_height'])) {
            $header_title_height = $args['_uncode_header_title_height'][0];
        }
        if (isset($args['_uncode_header_title_spacing'])) {
            $header_title_spacing = $args['_uncode_header_title_spacing'][0];
        }
        if (isset($args['_uncode_header_title_weight'])) {
            $header_title_weight = $args['_uncode_header_title_weight'][0];
        }
        if (isset($args['_uncode_header_title_italic'])) {
            $header_title_italic = $args['_uncode_header_title_italic'][0];
        }
        if (isset($args['_uncode_header_title_transform'])) {
            $header_title_transform = $args['_uncode_header_title_transform'][0];
        }
        if (isset($args['_uncode_header_overlay_pattern'])) {
            $header_overlay_pattern = $args['_uncode_header_overlay_pattern'][0];
        }
        if (isset($args['_uncode_header_background'])) {
            $header_background = $args['_uncode_header_background'][0];
        }
        if (isset($args['_uncode_header_overlay_color'])) {
            $header_overlay_color = $args['_uncode_header_overlay_color'][0];
        }
        if (isset($args['_uncode_header_overlay_color_alpha'])) {
            $header_overlay_color_alpha = $args['_uncode_header_overlay_color_alpha'][0];
        }
        if (isset($args['_uncode_header_scroll_opacity'])) {
            $header_scroll_opacity = $args['_uncode_header_scroll_opacity'][0];
        }
        if (isset($args['_uncode_header_scrolldown'])) {
            $header_scrolldown = $args['_uncode_header_scrolldown'][0];
        }
        $item_style = ' style-' . $header_style;
        if ($header_scrolldown === 'on') {
            $header_scroll_html = '<div class="header-scrolldown' . $item_style . '"><i class="fa fa-angle-down"></i></div>';
        } else {
            $header_scroll_html = '';
        }
        $this->html = '';
        $header_type = isset($args['_uncode_header_type'][0]) ? $args['_uncode_header_type'][0] : 'none';
        switch ($header_type) {
            case 'header_basic':
                $div_data = array();
                $title_classes = array();
                $data_size = '';
                $header_parallax = isset($args['_uncode_header_parallax'][0]) && $args['_uncode_header_parallax'][0] == 'on' ? ' header-parallax' : '';
                $header_position = isset($args['_uncode_header_position'][0]) ? ' ' . $args['_uncode_header_position'][0] : '';
                $header_background_array = uncode_get_back_html($header_background, $header_overlay_color, $header_overlay_color_alpha, $header_overlay_pattern, $item_style, 'header');
                $this->poster_id = $header_background_array['poster_id'];
                $text_animation = isset($args['_uncode_header_text_animation'][0]) && $args['_uncode_header_text_animation'][0] != '' ? ' blocks-animation ' . $args['_uncode_header_text_animation'][0] : '';
                if (isset($args['_uncode_header_animation_speed'][0]) && $args['_uncode_header_animation_speed'][0] != '') {
                    $div_data['data-speed'] = $args['_uncode_header_animation_speed'][0];
                }
                if (isset($args['_uncode_header_animation_delay'][0]) && $args['_uncode_header_animation_delay'][0] != '') {
                    $div_data['data-delay'] = $args['_uncode_header_animation_delay'][0];
                }
                if ($header_title_font !== '') {
                    $title_classes[] = $header_title_font;
                }
                if ($header_title_size !== '') {
                    $title_classes[] = $header_title_size;
                }
                if ($header_title_height !== '') {
                    $title_classes[] = $header_title_height;
                }
                if ($header_title_spacing !== '') {
                    $title_classes[] = $header_title_spacing;
                }
                if ($header_title_weight !== '') {
                    $title_classes[] = 'font-weight-' . $header_title_weight;
                }
                if ($header_title_transform !== '') {
                    $title_classes[] = 'text-' . $header_title_transform;
                }
                $page_title = $header_title_italic === 'on' ? $page_title = '<i>' . $page_title . '</i>' : $page_title;
                if ($header_background_array['content_html'] === '') {
                    if ($header_title !== 'off') {
                        if ($header_title_custom !== 'on') {
                            $content_html .= '<h1 class="header-title ' . implode(' ', $title_classes) . '"' . $data_size . '><span>' . $page_title . '</span></h1>';
                        } else {
                            if (isset($args['_uncode_header_text'][0])) {
                                $content = '<h1 class="header-title ' . implode(' ', $title_classes) . '"' . $data_size . '><span>';
                                $title = trim($args['_uncode_header_text'][0]);
                                $title_lines = explode("\n", $title);
                                $lines_counter = count($title_lines);
                                if ($lines_counter > 1) {
                                    foreach ($title_lines as $key => $value) {
                                        $value = trim($value);
                                        $content .= $value;
                                        if ($value !== '' && $lines_counter - 1 !== $key) {
                                            $content .= '</span><span>';
                                        }
                                    }
                                } else {
                                    $content .= $title;
                                }
                                $content .= '</span></h1>';
                                $content_html .= do_shortcode($content);
                            }
                        }
                        $get_post_type = get_post_type();
                        if ($get_post_type === 'post' && is_single()) {
                            $content_html .= uncode_post_info();
                        }
                        if ($get_post_type === 'portfolio' && is_single()) {
                            $content_html .= uncode_portfolio_info();
                        }
                    }
                } else {
                    $this->show_title = 'yes';
                    $content_html .= $header_background_array['content_html'];
                }
                $this->html .= '<div class="header-basic' . $limit_width . $item_style . '">
												<div class="background-element header-wrapper' . ($header_scroll_opacity === 'on' ? ' header-scroll-opacity' : '') . ($onepage ? ' onepage-section' : '') . $header_parallax . $header_background_array['back_color'] . ($header_background_array['content_html'] === '' || $header_background_array['content_only_text'] ? ' header-only-text' : '') . '"' . $onepage_header_name . $data_height . $height_style . '>
												' . (isset($header_background_array['back_html']) ? $header_background_array['back_html'] : '');
                if ($content_html !== '') {
                    $this->html .= '<div class="header-main-container' . $limit_content_width . ($header_background_array['is_carousel'] ? ' header-carousel' : '') . '">
											<div class="header-content' . $header_position . ' header-align-' . $header_align . '">
												<div class="header-content-inner' . $text_animation . '"' . $content_width . ' ' . implode(' ', array_map(function ($v, $k) {
                        return $k . '="' . $v . '"';
                    }, $div_data, array_keys($div_data))) . '>
													' . $content_html . '
												</div>
											</div>
										</div>';
                }
                $this->html .= $header_scroll_html . '</div>
								</div>';
                break;
            case 'header_uncodeblock':
                $this->html .= '<div class="header-wrapper header-uncode-block' . ($header_scroll_opacity === 'on' ? ' header-scroll-opacity' : '') . '">
								' . (isset($header_background_array['back_html']) ? $header_background_array['back_html'] : '');
                $uncodeblock_id = isset($args['_uncode_blocks_list']) && $args['_uncode_blocks_list'][0] !== '' ? $args['_uncode_blocks_list'][0] : '';
                $uncode_block = $uncodeblock_id !== '' ? get_post_field('post_content', $uncodeblock_id) : '';
                $uncode_block = str_replace('[vc_row ', '[vc_row is_header="yes" ', $uncode_block);
                $this->html .= do_shortcode($uncode_block);
                $this->html .= $header_scroll_html;
                $this->html .= '</div>';
                break;
            case 'header_revslider':
                $this->html .= '<div class="header-wrapper header-revslider">
								' . (isset($header_background_array['back_html']) ? $header_background_array['back_html'] : '') . '
								<div class="header-main-container">';
                $revslider_id = isset($args['_uncode_revslider_list']) && $args['_uncode_revslider_list'][0] != '' ? $args['_uncode_revslider_list'][0] : '';
                $this->html .= do_shortcode('[rev_slider ' . $revslider_id . ']');
                $this->html .= '</div>';
                $this->html .= '</div>';
                break;
            case 'header_layerslider':
                $this->html .= '<div class="header-wrapper">
								' . (isset($header_background_array['back_html']) ? $header_background_array['back_html'] : '') . '
								<div class="header-main-container">';
                $layerslider_id = isset($args['_uncode_layerslider_list']) && $args['_uncode_layerslider_list'][0] != '' ? $args['_uncode_layerslider_list'][0] : '';
                $this->html .= do_shortcode('[layerslider id="' . $layerslider_id . '"]');
                $this->html .= '</div>';
                $this->html .= '</div>';
                break;
        }
    }
Exemplo n.º 2
0
                $media_content .= $media_html;
            }
            if ($media_display === 'carousel') {
                break;
            }
        }
        if ($media_display === 'isotope') {
            $media_content .= '</div>
				</div>
			</div>';
        }
    }
    /** Build title **/
    if ($show_title) {
        $title_content = '<div class="post-title-wrapper"><h1 class="post-title">' . get_the_title() . '</h1>';
        $title_content .= uncode_post_info() . '</div>';
    }
    /** Build content **/
    $the_content = get_the_content();
    if (has_shortcode($the_content, 'vc_row')) {
        $with_builder = true;
    }
    if (!$with_builder) {
        $the_content = apply_filters('the_content', $the_content);
        $the_content = $title_content . $the_content;
        if ($media_content !== '') {
            $the_content = $media_content . $the_content;
        }
    }
    $the_content .= wp_link_pages(array('before' => '<div class="page-links">' . esc_html__('Pages:', 'uncode'), 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>', 'echo' => 0));
    /** Build post footer **/