Lines:
1 to 81 of 81
<?php /** * Youtube shortcode * * Contains shortcode + some improvements over the Core Embeds syntax (see http://codex.wordpress.org/Embeds ) * * Examples: * [youtube https://www.youtube.com/watch?v=WVbQ-oro7FQ] * [youtube=http://www.youtube.com/watch?v=wq0rXGLs0YM&fs=1&hl=bg_BG&autohide=1&rel=0] * http://www.youtube.com/watch?v=H2Ncxw1xfck&w=320&h=240&fmt=1&rel=0&showsearch=1&hd=0 * http://www.youtube.com/v/9FhMMmqzbD8?fs=1&hl=en_US * https://www.youtube.com/playlist?list=PLP7HaNDU4Cifov7C2fQM8Ij6Ew_uPHEXW * * @package Jetpack */ /* function youtube_embed_to_short_code() – Replaces YouTube embeds with YouTube shortcodes. */ add_filter( 'pre_kses', 'youtube_embed_to_short_code' ); /* function youtube_link() – Replaces plain-text links to YouTube videos with YouTube embeds. */ /* function youtube_link_callback() – Callback function for the regex that replaces YouTube URLs with YouTube embeds. */ /** * Normalizes a YouTube URL to include a v= parameter and a query string free of encoded ampersands. * * @param string $url * @return string The normalized URL */ if ( ! function_exists( 'youtube_sanitize_url' ) ) : /* function youtube_sanitize_url() – Normalizes a YouTube URL to include a v= parameter and a query string free of encoded ampersands. */ endif; /* function youtube_id() – Converts a YouTube URL into an embedded YouTube video. */ /* function jetpack_shortcode_youtube_args() – Gets the args present in the YouTube shortcode URL. */ /* function youtube_shortcode() – Display the Youtube shortcode. */ add_shortcode( 'youtube', 'youtube_shortcode' ); /* function jetpack_amp_youtube_shortcode() – Renders the [youtube] shortcode as an AMP component. */ /* function jetpack_shortcode_youtube_dimensions() – Gets the dimensions of the [youtube] shortcode. */ /* function wpcom_youtube_embed_crazy_url() – For bare URLs on their own line of the form http://www.youtube.com/v/9FhMMmqzbD8?fs=1&hl=en_US */ /* function wpcom_youtube_embed_crazy_url_init() – Add a new handler to automatically transform custom Youtube URLs (like playlists) into embeds. */ add_action( 'init', 'wpcom_youtube_embed_crazy_url_init' ); if ( ! is_admin() /** * Allow oEmbeds in Jetpack's Comment form. * * @module shortcodes * * @since 2.8.0 * * @param int $allow_oembed Option to automatically embed all plain text URLs. */ && apply_filters( 'jetpack_comments_allow_oembed', true ) // No need for this on WordPress.com, this is done for multiple shortcodes at a time there. && ( ! defined( 'IS_WPCOM' ) || ! IS_WPCOM ) ) { /* * We attach wp_kses_post to comment_text in default-filters.php with priority of 10 anyway, * so the iframe gets filtered out. * Higher priority because we need it before auto-link and autop get to it. */ add_filter( 'comment_text', 'youtube_link', 1 ); } /* function jetpack_fix_youtube_shortcode_display_filter() – Core changes to do_shortcode (https://core.trac.wordpress.org/changeset/34747) broke "improper" shortcodes with the format [shortcode=http://url.com]. */ add_filter( 'the_content', 'jetpack_fix_youtube_shortcode_display_filter', 7 );
Called by
Invoked by
Calls
Call hooks
1 to 1 of 1