public static function init_dimensions($url, $urlkvp, $finalparams) { // get default dimensions; try embed size in settings, then try theme's content width, then just 480px if (self::$defaultwidth == null) { global $content_width; if (empty($content_width)) { $content_width = $GLOBALS['content_width']; } if (isset($urlkvp['width']) && is_numeric($urlkvp['width'])) { self::$defaultwidth = $urlkvp['width']; } else { if (self::$alloptions[self::$opt_defaultdims] == 1 && (isset(self::$alloptions[self::$opt_defaultwidth]) && is_numeric(self::$alloptions[self::$opt_defaultwidth]))) { self::$defaultwidth = self::$alloptions[self::$opt_defaultwidth]; } else { if (self::$optembedwidth) { self::$defaultwidth = self::$optembedwidth; } else { if ($content_width) { self::$defaultwidth = $content_width; } else { self::$defaultwidth = 480; } } } } if (isset($urlkvp['height']) && is_numeric($urlkvp['height'])) { self::$defaultheight = $urlkvp['height']; } else { if (self::$alloptions[self::$opt_defaultdims] == 1 && (isset(self::$alloptions[self::$opt_defaultheight]) && is_numeric(self::$alloptions[self::$opt_defaultheight]))) { self::$defaultheight = self::$alloptions[self::$opt_defaultheight]; } else { self::$defaultheight = self::get_aspect_height($url, $urlkvp, $finalparams); } } } }
public static function get_oembed($url, $height, $width) { require_once ABSPATH . WPINC . '/class-oembed.php'; $oembed = _wp_oembed_get_object(); $args = array(); $args['width'] = $width; $args['height'] = $height; $args['discover'] = false; self::$oembeddata = $oembed->fetch('https://www.youtube.com/oembed', $url, $args); return self::$oembeddata; }
public static function init_dimensions($url, $urlkvp) { // get default dimensions; try embed size in settings, then try theme's content width, then just 480px if (self::$defaultwidth == null) { global $content_width; if (empty($content_width)) { $content_width = $GLOBALS['content_width']; } self::$defaultwidth = $urlkvp['width'] ? $urlkvp['width'] : (self::$optembedwidth ? self::$optembedwidth : ($content_width ? $content_width : 480)); self::$defaultheight = self::get_aspect_height($url); } }