includes/class-parse-this-html.php
private static function limit_embed( $src, $source_url ) {
		$src = self::limit_url( $src, $source_url );

		if ( empty( $src ) ) {
			return '';
		}

		if ( preg_match( '!//(m|www)\.youtube\.com/(embed|v)/([^?]+)\?.+$!i', $src, $src_matches ) ) {
			// Embedded Youtube videos (www or mobile)
			$src = 'https://www.youtube.com/watch?v=' . $src_matches[3];
		} elseif ( preg_match( '!//player\.vimeo\.com/video/([\d]+)([?/].*)?$!i', $src, $src_matches ) ) {
			// Embedded Vimeo iframe videos
			$src = 'https://vimeo.com/' . (int) $src_matches[1];
		} elseif ( preg_match( '!//vimeo\.com/moogaloop\.swf\?clip_id=([\d]+)$!i', $src, $src_matches ) ) {
			// Embedded Vimeo Flash videos
			$src = 'https://vimeo.com/' . (int) $src_matches[1];
		} elseif ( preg_match( '!//vine\.co/v/([^/]+)/embed!i', $src, $src_matches ) ) {
			// Embedded Vine videos
			$src = 'https://vine.co/v/' . $src_matches[1];
		} elseif ( preg_match( '!//(www\.)?dailymotion\.com/embed/video/([^/?]+)([/?].+)?!i', $src, $src_matches ) ) {
			// Embedded Daily Motion videos
			$src = 'https://www.dailymotion.com/video/' . $src_matches[2];
		} else {
			$oembed = _wp_oembed_get_object();

			if ( ! $oembed->get_provider(
				$src,
				array(
					'discover' => false,
				)
			) ) {
				$src = '';
			}
		}

		return $src;
	}
private static function limit_embed( $src, $source_url ) {
		$src = self::limit_url( $src, $source_url );

		if ( empty( $src ) ) {
			return '';
		}

		if ( preg_match( '!//(m|www)\.youtube\.com/(embed|v)/([^?]+)\?.+$!i', $src, $src_matches ) ) {
			// Embedded Youtube videos (www or mobile)
			$src = 'https://www.youtube.com/watch?v=' . $src_matches[3];
		} elseif ( preg_match( '!//player\.vimeo\.com/video/([\d]+)([?/].*)?$!i', $src, $src_matches ) ) {
			// Embedded Vimeo iframe videos
			$src = 'https://vimeo.com/' . (int) $src_matches[1];
		} elseif ( preg_match( '!//vimeo\.com/moogaloop\.swf\?clip_id=([\d]+)$!i', $src, $src_matches ) ) {
			// Embedded Vimeo Flash videos
			$src = 'https://vimeo.com/' . (int) $src_matches[1];
		} elseif ( preg_match( '!//vine\.co/v/([^/]+)/embed!i', $src, $src_matches ) ) {
			// Embedded Vine videos
			$src = 'https://vine.co/v/' . $src_matches[1];
		} elseif ( preg_match( '!//(www\.)?dailymotion\.com/embed/video/([^/?]+)([/?].+)?!i', $src, $src_matches ) ) {
			// Embedded Daily Motion videos
			$src = 'https://www.dailymotion.com/video/' . $src_matches[2];
		} else {
			$oembed = _wp_oembed_get_object();

			if ( ! $oembed->get_provider(
				$src,
				array(
					'discover' => false,
				)
			) ) {
				$src = '';
			}
		}

		return $src;
	}
private static function limit_embed ( $ src , $ source_url ) { $ src = self :: limit_url ( $ src , $ source_url ) ; if ( empty ( $ src ) ) { return '' ; } if ( preg_match ( '!//(m|www)\.youtube\.com/(embed|v)/([^?]+)\?.+$!i' , $ src , $ src_matches ) ) { // Embedded Youtube videos (www or mobile) $ src = 'https://www.youtube.com/watch?v=' . $ src_matches [ 3 ] ; } elseif ( preg_match ( '!//player\.vimeo\.com/video/([\d]+)([?/].*)?$!i' , $ src , $ src_matches ) ) { // Embedded Vimeo iframe videos $ src = 'https://vimeo.com/' . ( int ) $ src_matches [ 1 ] ; } elseif ( preg_match ( '!//vimeo\.com/moogaloop\.swf\?clip_id=([\d]+)$!i' , $ src , $ src_matches ) ) { // Embedded Vimeo Flash videos $ src = 'https://vimeo.com/' . ( int ) $ src_matches [ 1 ] ; } elseif ( preg_match ( '!//vine\.co/v/([^/]+)/embed!i' , $ src , $ src_matches ) ) { // Embedded Vine videos $ src = 'https://vine.co/v/' . $ src_matches [ 1 ] ; } elseif ( preg_match ( '!//(www\.)?dailymotion\.com/embed/video/([^/?]+)([/?].+)?!i' , $ src , $ src_matches ) ) { // Embedded Daily Motion videos $ src = 'https://www.dailymotion.com/video/' . $ src_matches [ 2 ] ; } else { $ oembed = _wp_oembed_get_object ( ) ; if ( ! $ oembed -> get_provider ( $ src , array ( 'discover' => false , ) ) ) { $ src = '' ; } } return $ src ; }
Limit embed source URLs to specific providers.

Not all core oEmbed providers are supported. Supported providers include YouTube, Vimeo,
Vine, Daily Motion, SoundCloud, and Twitter.


@param string $src Embed source URL.
@param string $source_url Source URL
@return string If not from a supported provider, an empty string. Otherwise, a reformatted embed URL.
Limit embed source URLs to specific providers .