• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Jetpack a2z

Jetpack a2z

Jetpack a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / Files / modules/shortcodes/youtube.php


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 );
 

 View on GitHub View on Trac

Called by

    Invoked by

      Calls

      Call hooks

      1 to 1 of 1
      • jetpack_comments_allow_oembed – filter
      File name: modules/shortcodes/youtube.php
      Plugin ref: Jetpack
      Version: 9.2
      Deprecated?: No
      API Letters: M,P,S,Y

      Related

      Published: 27 November 2019 | Last updated: 10 December 2020

      Primary Sidebar

      Information

      File name: modules/shortcodes/youtube.php
      Plugin ref: Jetpack
      Version: 9.2
      Deprecated?: No
      API Letters: M,P,S,Y

      modules/shortcodes

      Footer

      Jetpack a2z
      Jetpack a2z
      Jetpack a2z
      WordPress 5.6
      WordPress a2z
      WordPress core a2z
      Genesis Theme Framework a2z
      Jetpack a2z
      WordPress develop tests
      Easy Digital Downloads a2z
      WooCommerce a2z
      Yoast SEO a2z
      WordPress Blocks

      Site:  jetpack.wp-a2z.org
      © Copyright Jetpack a2z 2014-2021. All rights reserved.


      Website designed and developed by Herb Miller
      Proudly powered by WordPress and oik plugins

      • Home
      • Blog
      • Sitemap
      • Sites