0byt3m1n1-V2
Path:
/
home
/
yvffpqmy
/
public_html
/
wp-content
/
themes
/
cargo
/
php
/
[
Home
]
File: bt_functions.php
<?php /** * Post media HTML * * @param string * @param array * @return string */ if ( ! function_exists( 'bt_get_media_html' ) ) { function bt_get_media_html( $type, $data ) { $html = ''; if ( $type == 'image' ) { $data_attr = ''; if ( isset( $data[2] ) ) { $data_attr = 'data-hw="' . esc_attr( $data[2] ) . '"'; } $html = '<div class="btMediaBox" ' . $data_attr . '><div class="bpbItem">'; $html .= '<a href="' . esc_url_raw( $data[0] ) . '"><img src="' . esc_url_raw( $data[1] ) . '" alt="' . esc_attr( basename( $data[1] ) ) . '"></a>'; $html .= '</div></div>'; } else if ( $type == 'gallery' ) { $data_attr = ''; if ( isset( $data[1] ) ) { $data_attr = 'data-hw="' . esc_attr( $data[1] ) . '"'; } $html = '<div class="btMediaBox" ' . $data_attr . '>' . do_shortcode( '[gallery ids="' . join( ',', $data[0] ) . '"]' ) . '</div>'; } else if ( $type == 'grid_gallery' ) { $html = '<div class="btMediaBox">' . do_shortcode( '[bt_grid_gallery ids="' . join( ',', $data[0] ) . '" columns="' . $data[1] . '" has_thumb="' . $data[2] . '" format="' . $data[3] . '" lightbox="' . $data[4] . '" grid_gap="' . $data[5] . '"]' ) . '</div>'; } else if ( $type == 'video' ) { $hw = 9 / 16; $html = '<div class="btMediaBox video" data-hw="' . esc_attr( $hw ) . '"><img class="aspectVideo" src="' . esc_url_raw( get_template_directory_uri() . '/gfx/video-16.9.png' ) . '" alt="" role="presentation" aria-hidden="true">'; if ( strpos( $data[0], 'vimeo.com/' ) > 0 ) { $video_id = substr( $data[0], strpos( $data[0], 'vimeo.com/' ) + 10 ); $html .= '<ifra' . 'me src="' . esc_url_raw( 'http://player.vimeo.com/video/' . $video_id ) . '" allowfullscreen></ifra' . 'me>'; } else { $yt_id_pattern = '~(?:http|https|)(?::\/\/|)(?:www.|)(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[a-z0-9;:@#?&%=+\/\$_.-]*~i'; $youtube_id = ( preg_replace( $yt_id_pattern, '$1', $data[0] ) ); if ( strlen( $youtube_id ) == 11 ) { $html .= '<ifra' . 'me width="560" height="315" src="' . esc_url_raw( 'http://www.youtube.com/embed/' . $youtube_id ) . '" allowfullscreen></ifra' . 'me>'; } else { $html = '<div class="btMediaBox video" data-hw="' . esc_attr( $hw ) . '">'; $html .= do_shortcode( $data[0] ); } } $html .= '</div>'; if ( $data[0] == '' ) { $html = ''; } } else if ( $type == 'audio' ) { if ( strpos( $data[0], '</ifra' . 'me>' ) > 0 ) { $html = '<div class="btMediaBox audio">' . wp_kses( $data[0], array( 'iframe' => array( 'height' => array(), 'src' =>array() ) ) ) . '</div>'; } else { $html = '<div class="btMediaBox audio">' . do_shortcode( $data[0] ) . '</div>'; } if ( $data[0] == '' ) { $html = ''; } } else if ( $type == 'link' ) { $html = '<div class="btMediaBox btDarkSkin btLink"><div class="bpbItem">' . bt_get_icon_html( 's7_e641', esc_url( $data[0] ), '', 'medium colorless borderless' ) . '<a href="' . esc_url_raw( $data[0] ) . '"><strong>' . $data[1] . '</strong><span class="bUrl">' . $data[0] . '</span></a></div></div>'; if ( $data[1] == '' || $data[0] == '' ) { $html = ''; } } else if ( $type == 'quote' ) { $html = '<div class="btMediaBox btQuote btDarkSkin"><blockquote>' . bt_get_icon_html( 's7_e6b9', $data[2], '', 'medium colorless borderless' ) . '<p>' . $data[0] . '</p><cite>' . $data[1] . '</cite></blockquote></div>'; if ( $data[0] == '' || $data[1] == '' ) { $html = ''; } } return $html; } } /** * Returns share icons HTML * * @return string */ if ( ! function_exists( 'bt_get_share_html' ) ) { function bt_get_share_html( $permalink, $type = 'blog', $size = 'extrasmall' ) { $share_facebook = bt_get_option( $type . '_share_facebook' ); $share_twitter = bt_get_option( $type . '_share_twitter' ); $share_google_plus = bt_get_option( $type . '_share_google_plus' ); $share_linkedin = bt_get_option( $type . '_share_linkedin' ); $share_vk = bt_get_option( $type . '_share_vk' ); require_once( get_template_directory() . '/php/share.php' ); $share_html = ''; if ( $share_facebook || $share_twitter || $share_google_plus || $share_linkedin || $share_vk ) { if ( $share_facebook ) { $share_html .= bt_get_icon_html( 'fa_f09a', bt_get_share_link( 'facebook', $permalink ), '', ' colorless ' . $size ); } if ( $share_twitter ) { $share_html .= bt_get_icon_html( 'fa_f099', bt_get_share_link( 'twitter', $permalink ), '', ' colorless ' . $size ); } if ( $share_linkedin ) { $share_html .= bt_get_icon_html( 'fa_f0e1', bt_get_share_link( 'linkedin', $permalink ), '', ' colorless ' . $size ); } if ( $share_google_plus ) { $share_html .= bt_get_icon_html( 'fa_f0d5', bt_get_share_link( 'google_plus', $permalink ), '', ' colorless ' . $size ); } if ( $share_vk ) { $share_html .= bt_get_icon_html( 'fa_f189', bt_get_share_link( 'vk', $permalink ), '', ' colorless ' . $size ); } } return $share_html; } } /** * Returns heading HTML * * @param string $superheadline * @param string $headline * @param string $subheadline * @param string $headline_size // small/medium/large/extralarge * @param string $dash // no/top/bottom * @param string $el_class * @param string $el_style * @return string */ if ( ! function_exists( 'bt_get_heading_html' ) ) { function bt_get_heading_html( $superheadline, $headline, $subheadline, $headline_size, $dash, $el_class, $el_style ) { if ( $superheadline != '' ) { $superheadline = '<p class="btSuperTitle">' . $superheadline . '</p>'; } if ( $subheadline != '' ) { $subheadline = '<p class="btSubTitle">' . $subheadline . '</p>'; } $h_tag = 'h1'; $class = ''; $style_attr = ''; if ( $el_style != '' ) { $style_attr = 'style="' . esc_attr( $el_style ) . '"'; } if ( $headline_size != 'no' ) { $class .= $headline_size; } if ( $headline_size == 'extralarge' || $headline_size == 'huge' ) { $h_tag = 'h1'; } else if ( $headline_size == 'large' ) { $h_tag = 'h2'; } else if ( $headline_size == 'medium' ) { $h_tag = 'h3'; } else { $h_tag = 'h4'; } if ( $dash == 'yes' ) { $dash = 'top'; } if( $dash != 'no' && $dash != '' ) { $class .= ' btDash ' . $dash . 'Dash'; } if ( $el_class != '' ) { $class .= ' ' . $el_class; } $output = '<header class="header btClear ' . $class . '" ' . $style_attr . '>'; $output .= $superheadline; if ( $headline != '' ) $output .= '<div class="dash"><' . $h_tag . '><span class="headline">' . $headline . '</span></' . $h_tag . '></div>'; $output .= $subheadline; $output .= '</header>'; return $output; } } /** * Returns icon HTML * * @param string $icon * @param string $url * @param string $text * @param string $el_class * @return string */ if ( ! function_exists( 'bt_get_icon_html' ) ) { function bt_get_icon_html( $icon, $url, $text, $el_class, $target = '') { $icon_set = substr( $icon, 0, 2 ); $icon = substr( $icon, 3 ); if( substr( $url, 0, 3 ) == 'www') $url = "http://" . $url; $link = ""; if ( $url != '' && $url != '#' && substr( $url, 0, 4 ) != 'http' && substr( $url, 0, 5 ) != 'https' && substr( $url, 0, 6 ) != 'mailto' ) { $link_tmp = get_posts( array( 'name' => $url, 'post_type' => 'page' ) ); if ( ( is_array( $link_tmp ) && count( $link_tmp ) > 0 && isset( $link_tmp[0]->ID ) ) ) { if ( substr( $url, 0, 4 ) == 'http' ) { $link = $url; } else { $link = get_permalink( $link_tmp[0]->ID ); } } else { $link = $url; } } else { $link = $url; } if ( $text != '' ) $text = '<span>' . $text . '</span>'; if ( $target != '' ) $target = ' target="' . ( $target ) . '" '; $ico_tag = 'a '; if ( $link == '' ) { $ico_tag = 'span '; $ico_tag_end = 'span'; } else { $ico_tag = 'a href="' . esc_url_raw( $link ) . '" ' . ( $target ); $ico_tag_end = 'a'; } return '<div class="btIco ' . esc_attr( $el_class ) . '"><' . $ico_tag . ' data-ico-' . esc_attr( $icon_set ) . '="&#x' . esc_attr( $icon ) . ';" class="btIcoHolder">' . $text . '</' . $ico_tag_end . '></div>'; } } /** * Returns button HTML * * @param string $icon * @param string $url * @param string $text * @param string $el_class * @param string $el_style * @param string $target * @return string */ if ( ! function_exists( 'bt_get_button_html' ) ) { function bt_get_button_html( $icon, $url, $text, $el_class, $el_style = '', $target = '' ) { if ( substr( $url, 0, 3 ) == 'www' ) { $url = 'http://' . $url; } $link = ''; if ( $url != '' && $url != '#' && substr( $url, 0, 4 ) != 'http' && substr( $url, 0, 5 ) != 'https' && substr( $url, 0, 6 ) != 'mailto' ) { $link_tmp = get_posts( array( 'name' => $url, 'post_type' => 'page' ) ); if ( ( is_array( $link_tmp ) && count( $link_tmp ) > 0 && isset( $link_tmp[0]->ID ) ) ) { if ( substr( $url, 0, 4 ) == 'http' ) { $link = $url; } else { $link = get_permalink( $link_tmp[0]->ID ); } } else { $link = $url; } } else { $link = $url; } $style_attr = ''; if ( $el_style != '' ) { $style_attr = 'style="' . esc_attr( $el_style ) . '"'; } if ( is_array( $el_class ) ) $el_class = implode( ' ', $el_class ); $output = '<div class="btBtn ' . esc_attr( $el_class ) . '"' . ' ' . $style_attr . '>'; if ( $icon == '' ) { if ( $link != '' ) { $output .= '<a href="' . $link . '">' . $text . '</a>'; } else { $output .= $text; } } else { $output .= bt_get_icon_html( $icon, $url, $text, 'borderless extrasmall', $target ); } $output .= '</div>'; return $output; } } /** * Top bar HTML output */ if ( ! function_exists( 'bt_top_bar_html' ) ) { function bt_top_bar_html( $type = "top" ) { if ( is_active_sidebar( 'header_left_widgets' ) || is_active_sidebar( 'header_right_widgets' ) ) { if ( $type == "top" ) { ?> <div class="topBar btClear"> <div class="topBarPort btClear"> <div class="topTools ttLeft col-ms-6 btTextLeft"> <?php dynamic_sidebar( 'header_left_widgets' ); ?> </div><!-- /ttLeft --> <div class="topTools ttRight col-ms-6 btTextRight"> <?php dynamic_sidebar( 'header_right_widgets' ); ?> </div><!-- /ttRight --> </div><!-- /topBarPort --> </div><!-- /topBar --> <?php } else { ?> <div class="topBarInMenu"> <div class="topBarInMenuCell"> <?php dynamic_sidebar( 'header_left_widgets' ); ?> <?php dynamic_sidebar( 'header_right_widgets' ); ?> </div><!-- /topBarInMenu --> </div><!-- /topBarInMenuCell --> <?php } } } } /** * Preloader HTML output */ if ( ! function_exists( 'bt_preloader_html' ) ) { function bt_preloader_html() { if ( ! bt_get_option( 'disable_preloader' ) ) { ?> <div id="btPreloader" class="btPreloader fullScreenHeight"> <div class="animation"> <div><?php bt_logo( 'preloader' ); ?></div> <div class="btLoader"></div> <p><?php echo bt_get_option( 'preloader_text' ); ?></p> </div> </div><!-- /.preloader --> <?php } } } /** * Returns image with link HTML * * @param string $image * @param string $caption_text * @param string $size * @param string $url * @param string $el_style * @param string $el_class * @return string */ if ( ! function_exists( 'bt_get_image_html' ) ) { function bt_get_image_html( $image, $caption, $caption_text, $size, $shape, $url, $show_titles, $el_style, $el_class ) { $el_style = sanitize_text_field( $el_style ); $el_class = sanitize_text_field( $el_class ); if ( $size == '' ) $size = 'large'; if ( $shape == 'circle' ) $el_class .= ' btCircleImage'; $style_html = ''; if ( $el_style != '' ) { $style_html= ' ' . 'style="' . esc_attr( $el_style ) . '"'; } $output = '<div class = "btImage"><img src="' . esc_url_raw( $image ) . '" alt="' . esc_url( $image ) . '"></div>'; if ( strpos( $url, '<a href') === 0 ) { $link = $url; } else { $link = '<a href="' . esc_url_raw( $url ) . '" target="_self"></a>'; } if ( $url != '' ) { $link_output = '<div class="bpgPhoto ' . $el_class . '" ' . $style_html . '> ' . $link . ' <div class="boldPhotoBox"><div class="bpbItem">' . $output . '</div></div> <div class="captionPane"> <div class="captionTable"> <div class="captionCell"> <div class="captionTxt">' . bt_get_heading_html( '', $caption, $caption_text, 'small', 'bottom', '', '' ) . '</div> </div> </div> </div>'; if ( $show_titles ) { $link_output .= ' <div class="btShowTitle"> <span class="btShowTitleCaptionTxt">' . bt_get_heading_html( '', $caption, $caption_text, 'small', 'bottom', '', '' ) . '</span> </div>'; } $link_output .= '</div>'; $output = $link_output; } else { $output = '<div class="bpgPhoto ' . $el_class . '" ' . $style_html . '>' . $output . '</div>'; } return $output; } }
©
2018.