public static function get_embed($url)
{
/**
* Set arguments for getting embeded HTML.
* Without arguments, default width will be taken from global $content_width, which can break UI in the admin
*
* @link https://github.com/rilwis/meta-box/issues/801
* @see WP_oEmbed::fetch()
* @see WP_Embed::shortcode()
* @see wp_embed_defaults()
*/
$args = array();
if (is_admin()) {
$args['width'] = 360;
}
// Try oembed first
$embed = wp_oembed_get($url, $args);
// If no oembed provides found, try WordPress auto embed
if (!$embed) {
$embed = $GLOBALS['wp_embed']->shortcode($args, $url);
}
return $embed ? $embed : __('Embed HTML not available.', 'meta-box');
}