';
if ( strpos( $video, 'vimeo.com/' ) > 0 ) {
$video_id = substr( $video, strpos( $video, 'vimeo.com/' ) + 10 );
$html .= '
';
} 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', $video ) );
if ( strlen( $youtube_id ) == 11 ) {
$html .= '
';
} else {
$html = '
';
$html .= do_shortcode( $video );
}
}
$html .= '
';
} else if ( $audio != '' ) {
if ( strpos( $audio, '' ) > 0 ) {
$html = '
' . wp_kses( $audio, 'audio' ) . '
';
} else {
$html = '
' . do_shortcode( $audio ) . '
';
}
} else if ( $link_url != '' ) {
$bt_link_bg_image = '';
if ( $featured_image != '' ) $bt_link_bg_image .= " style='background-image: url(" . esc_url( $featured_image ) . ")'";
$html = '
';
} else if ( $quote != '' ) {
$bt_quote_bg_image = '';
if ( $featured_image != '' ) $bt_quote_bg_image .= " style='background-image: url(" . esc_url( $featured_image ) . ")'";
$html = $quote;
if ( $permalink != '' ) $html = '
' . $html .'';
$html = '
';
} else if ( count( $images ) > 0 ) {
if ( $gallery_type == 'carousel' ) {
$html = '
';
if ( shortcode_exists( 'bt_bb_slider' ) ) {
$image_urls = array();
$image_ids = array();
foreach( $images as $image ) {
$image_urls[] = $image['url'];
$image_ids[] = $image['ID'];
}
$html .= do_shortcode( '[bt_bb_slider images="' . implode( ',', $image_ids ) . '" show_dots="bottom" height="auto" auto_play="3000" animation="fade" ignore_fe_editor="true"]' );
}
$html .= '
';
} else {
$html = '
';
if ( shortcode_exists( 'bt_bb_masonry_image_grid' ) ) {
$image_ids = array();
foreach( $images as $image ) {
$image_ids[] = $image['ID'];
}
$prefix = 'blog';
if ( $type == 'single-portfolio' ) {
$prefix = 'pf';
}
$html .= do_shortcode( '[bt_bb_masonry_image_grid images="' . implode( ',', $image_ids ) . '" columns="' . boldthemes_get_option( $prefix . '_grid_gallery_columns' ) . '" gap="' . boldthemes_get_option( $prefix . '_grid_gallery_gap' ) . '" ignore_fe_editor="true"]' );
}
$html .= '
';
}
} else if ( $featured_image != '' ) {
$html = '
 . ')
';
if ( $permalink != '' ) $html = '
' . $html .'';
if ( $featured_image_caption != '' ) {
$html .= '
' . $featured_image_caption . '
';
}
$html = '
' . $html . '
';
}
return $html;
}
}
/**
* Post media HTML
*
* @param string
* @param array
* @return string
*/
if ( ! function_exists( 'boldthemes_get_media_html' ) ) {
function boldthemes_get_media_html( $type, $data ) {
$html = 'OLD MEDIA!!!';
return $html;
}
}
/**
* Returns share icons HTML
*
* @return string
*/
if ( ! function_exists( 'boldthemes_get_share_html' ) ) {
function boldthemes_get_share_html( $permalink, $type = 'blog', $size = 'small', $style = 'filled', $shape = 'circle', $color_scheme = '' ) {
if ( function_exists( 'boldthemes_get_share_html2' ) ) {
return boldthemes_get_share_html2( $permalink, $type, $size, $style, $shape, $color_scheme );
}
}
}
/**
* Logo
*/
if ( ! function_exists( 'boldthemes_logo' ) ) {
function boldthemes_logo( $type = 'header' ) {
$logo = boldthemes_get_option( 'logo' );
$alt_logo = boldthemes_get_option( 'alt_logo' );
$hw = '';
if ( ! is_string( $logo ) ) { // erased from disk
$logo = '';
}
if ( $logo != '' ) {
$image_id = 0;
if( is_numeric( $logo ) ) {
$image_id = $logo + 0;
} else {
$tmp = $logo;
if ( strpos( $logo, '/wp-content' ) === 0 ) {
$logo = get_home_url() . $logo;
}
$image_id = attachment_url_to_postid( $logo );
if ( $image_id == 0 ) {
$logo = $tmp;
}
$image_id = attachment_url_to_postid( $logo );
}
if( $image_id > 0) {
$image = wp_get_attachment_image_src( $image_id, 'full' );
if ( $image ) {
if ( is_array($image) && preg_match('/\.svg$/i', $image[0]) && $image[1] <= 1 ) {
// fix svg logo dimensions
$image[1] = $image[2] = null;
$xml = '';
$allow_url = ini_get('allow_url_fopen');
if ( $allow_url ){
$xml = simplexml_load_file($image[0]);
} else {
$args['curl_url'] = $image[0];
$xml = boldthemes_get_curl($args);
$xml = simplexml_load_string($xml);
}
if ( $xml ) {
$attr = $xml->attributes();
$viewbox = explode(' ', $attr->viewBox);
$image[1] = isset($attr->width) && preg_match('/\d+/', $attr->width, $value) ? (int) $value[0] : (count($viewbox) == 4 ? (int) $viewbox[2] : null);
$image[2] = isset($attr->height) && preg_match('/\d+/', $attr->height, $value) ? (int) $value[0] : (count($viewbox) == 4 ? (int) $viewbox[3] : null);
}
}
$logo = $image[0];
$width = $image[1];
$height = $image[2];
if ( $height != 0 ) {
$hw = $width / $height;
} else {
$meta = wp_get_attachment_metadata( $image_id );
$width = isset($meta['width']) ? $meta['width'] : 0;
$height = isset($meta['height']) ? $meta['height'] : 0;
if ( $height != 0 ) {
$hw = $width / $height;
}
}
} else {
$logo = '';
}
} else {
$logo = '';
}
}
if ( ! is_string( $alt_logo ) ) { // erased from disk
$alt_logo = '';
}
if ( $alt_logo != '' ) {
$image_id = 0;
if( is_numeric( $alt_logo ) ) {
$image_id = $alt_logo + 0;
} else {
$tmp = $alt_logo;
if ( strpos( $alt_logo, '/wp-content' ) === 0 ) {
$alt_logo = get_home_url() . $alt_logo;
}
$image_id = attachment_url_to_postid( $alt_logo );
if ( $image_id == 0 ) {
$alt_logo = $tmp;
}
$image_id = attachment_url_to_postid( $alt_logo );
}
if( $image_id > 0) {
$image = wp_get_attachment_image_src( $image_id, 'full' );
if ( $image ) {
$alt_logo = $image[0];
} else {
$alt_logo = '';
}
} else {
$alt_logo = '';
}
}
$home_link = home_url( '/' ) ;
if ( $logo != '' && $logo != ' ' ) {
if ( $type == 'header' ) {
echo '
';
if ( $alt_logo != '' && $alt_logo != ' ' ) echo '
';
echo '';
} else if ( $type == 'footer' ) {
echo '
 . ')
';
} else if ( $type == 'preloader' ) {
echo '
 . ')
';
}
} else {
echo '
' . esc_html( get_bloginfo( 'name' ) ) . '';
}
}
}
/**
* Top bar HTML output
*/
if ( ! function_exists( 'boldthemes_top_bar_html' ) ) {
function boldthemes_top_bar_html( $type = 'top', $menu_type = '' ) {
if ( $type == 'top' ) {
if ( is_active_sidebar( 'header_left_widgets' ) || is_active_sidebar( 'header_right_widgets' ) ) { ?>
)(.*)(<\/a>)/';
if ( $prev != '' || $next != '' ) {
echo '';
}
}
}
/**
* Custom comments HTML output
*/
if ( ! function_exists( 'boldthemes_theme_comment' ) ) {
function boldthemes_theme_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
$rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) );
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
// Display trackbacks differently than normal comments.
?>
id="comment-">
', '' ); ?>
id="li-comment-">
';
}
?>
control_arr ) ) {
foreach( BoldThemesFramework::$fake_customizer->control_arr as $k => $v ) {
$fake_customizer_js .= 'window.bt_fake_customizer_controls["' . $k . '"]=' . json_encode( $v ) . ';';
}
}
wp_add_inline_script( 'boldthemes-framework-text', $fake_customizer_js );
}
static function sort_fake_customizer_sections( $a, $b ) {
/* TEST */
return false;
$sections = BoldThemesFramework::$fake_customizer->section_arr;
if ( isset( $sections[ $a['section'] ] ) && isset( $sections[ $b['section'] ] ) ) {
if ( $sections[ $a['section'] ]['priority'] == $sections[ $b['section'] ]['priority'] ) {
return 0;
}
return ( $sections[ $a['section'] ]['priority'] < $sections[ $b['section'] ]['priority'] ) ? -1 : 1;
} else {
return 0;
}
}
static function stable_uasort( & $array, $cmp_function ) {
/* TEST */
return false;
if ( count( $array ) < 2 ) {
return;
}
$halfway = round( count( $array ) / 2 );
$array1 = array_slice( $array, 0, $halfway, TRUE );
$array2 = array_slice( $array, $halfway, NULL, TRUE );
self::stable_uasort( $array1, $cmp_function );
self::stable_uasort( $array2, $cmp_function );
if ( call_user_func( $cmp_function, end( $array1 ), reset( $array2 ) ) < 1 ) {
$array = $array1 + $array2;
return;
}
$array = array();
reset( $array1 );
reset( $array2 );
while( current( $array1 ) && current( $array2 ) ) {
if ( call_user_func( $cmp_function, current( $array1 ), current( $array2 ) ) < 1 ) {
$array[ key( $array1 ) ] = current( $array1 );
next( $array1 );
} else {
$array[ key( $array2 ) ] = current( $array2 );
next( $array2 );
}
}
while( current( $array1 ) ) {
$array[ key( $array1 ) ] = current( $array1 );
next( $array1 );
}
while( current( $array2 ) ) {
$array[ key( $array2 ) ] = current( $array2 );
next( $array2 );
}
return;
}
static function sort_fake_customizer_controls( $a, $b ) {
/* TEST */
return false;
if ( isset( $a['priority'] ) && isset ( $b['priority'] ) ) {
if ( $a['priority'] == $b['priority'] ) {
return 0;
}
return ( $a['priority'] < $b['priority'] ) ? -1 : 1;
} else {
return 0;
}
}
static function html( $meta, $field ) {
/* TEST */
return false;
$meta_key = substr( $meta, 0, strpos( $meta, ':' ) );
$meta_value = substr( $meta, strpos( $meta, ':' ) + 1 );
$vars = BoldThemesFramework::$fake_customizer->control_arr;
self::stable_uasort( $vars, array( 'RWMB_BoldThemesText_Field', 'sort_fake_customizer_controls' ) );
self::stable_uasort( $vars, array( 'RWMB_BoldThemesText_Field', 'sort_fake_customizer_sections' ) );
$select = '