File "content.php"
Full Path: /var/www/bvnghean.vn/save_bvnghean.vn/wp-content/themes/publisher/includes/libs/better-framework/functions/content.php
File size: 1.03 KB
MIME-type: text/x-php
Charset: utf-8
<?php
// Callback For Video Format auto-embed
add_filter( 'better-framework/content/video-embed', 'bf_auto_embed_content' );
add_filter( 'better-framework/content/auto-embed', 'bf_auto_embed_content' );
if ( ! function_exists( 'bf_auto_embed_content' ) ) {
/**
* Filter Callback: Auto-embed using a link
*
* @param string $content
*
* @return string
*/
function bf_auto_embed_content( $content ) {
//
// Custom External Videos
//
preg_match( '#^(http|https)://.+\.(mp4|m4v|webm|ogv|wmv|flv)$#i', $content, $matches );
if ( ! empty( $matches[0] ) ) {
return do_shortcode( '[video src="' . $matches[0] . '"]' );
}
//
// Custom External Audio
//
preg_match( '#^(http|https)://.+\.(mp3|m4a|ogg|wav|wma)$#i', $content, $matches );
if ( ! empty( $matches[0] ) ) {
return do_shortcode( '[audio src="' . $matches[0] . '"]' );
}
//
// Default embeds and other registered
//
global $wp_embed;
if ( ! is_object( $wp_embed ) ) {
return $content;
}
return $wp_embed->autoembed( $content );
}
}