From 9b591d6b0963f751a66ec2c5031f273ac446cc56 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 17 Oct 2015 01:20:19 +0000 Subject: [PATCH] Embeds: Rename files, functions, and hooks added in [34903] to make it more clear what is oEmbed-specific and what isn't. See https://core.trac.wordpress.org/ticket/34272#comment:7 for full list of renamed functions and hooks. Props swissspidy. Fixes #34272. git-svn-id: https://develop.svn.wordpress.org/trunk@35235 602fd350-edb4-49c9-b593-d223f7449a82 --- Gruntfile.js | 6 ++-- ...oembed-embed.css => wp-embed-template.css} | 0 src/wp-includes/default-filters.php | 22 ++++++------ src/wp-includes/embed-functions.php | 34 +++++++++---------- src/wp-includes/embed-template.php | 20 +++++------ .../js/tinymce/plugins/wpoembed/plugin.js | 2 +- ...p-oembed-embed.js => wp-embed-template.js} | 0 .../js/{wp-oembed.js => wp-embed.js} | 0 tests/phpunit/tests/oembed/template.php | 10 +++--- 9 files changed, 47 insertions(+), 47 deletions(-) rename src/wp-includes/css/{wp-oembed-embed.css => wp-embed-template.css} (100%) rename src/wp-includes/js/{wp-oembed-embed.js => wp-embed-template.js} (100%) rename src/wp-includes/js/{wp-oembed.js => wp-embed.js} (100%) diff --git a/Gruntfile.js b/Gruntfile.js index 030c7aa53a..8bc1b4805c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -233,7 +233,7 @@ module.exports = function(grunt) { // Exceptions '!wp-includes/css/dashicons.css', - '!wp-includes/css/wp-oembed-embed.css' + '!wp-includes/css/wp-embed-template.css' ] }, colors: { @@ -530,7 +530,7 @@ module.exports = function(grunt) { src: BUILD_DIR + 'wp-includes/formatting.php', dest: '.' }, - oembed: { + embed: { src: BUILD_DIR + 'wp-includes/embed-functions.php', dest: '.' } @@ -642,7 +642,7 @@ module.exports = function(grunt) { 'clean:tinymce', 'concat:emoji', 'includes:emoji', - 'includes:oembed', + 'includes:embed', 'jsvalidate:build' ] ); diff --git a/src/wp-includes/css/wp-oembed-embed.css b/src/wp-includes/css/wp-embed-template.css similarity index 100% rename from src/wp-includes/css/wp-oembed-embed.css rename to src/wp-includes/css/wp-embed-template.css diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php index 75dadfc465..31284d580d 100644 --- a/src/wp-includes/default-filters.php +++ b/src/wp-includes/default-filters.php @@ -446,24 +446,24 @@ add_action( 'parse_query', 'wp_oembed_parse_query' ); add_action( 'wp_head', 'wp_oembed_add_discovery_links' ); add_action( 'wp_head', 'wp_oembed_add_host_js' ); -add_action( 'oembed_head', 'print_emoji_detection_script' ); -add_action( 'oembed_head', 'print_emoji_styles' ); -add_action( 'oembed_head', 'print_oembed_embed_styles' ); -add_action( 'oembed_head', 'print_oembed_embed_scripts' ); -add_action( 'oembed_head', 'wp_print_head_scripts', 20 ); -add_action( 'oembed_head', 'wp_print_styles', 20 ); -add_action( 'oembed_head', 'wp_no_robots' ); -add_action( 'oembed_head', 'rel_canonical' ); -add_action( 'oembed_head', 'locale_stylesheet' ); +add_action( 'embed_head', 'print_emoji_detection_script' ); +add_action( 'embed_head', 'print_emoji_styles' ); +add_action( 'embed_head', 'print_embed_styles' ); +add_action( 'embed_head', 'print_embed_scripts' ); +add_action( 'embed_head', 'wp_print_head_scripts', 20 ); +add_action( 'embed_head', 'wp_print_styles', 20 ); +add_action( 'embed_head', 'wp_no_robots' ); +add_action( 'embed_head', 'rel_canonical' ); +add_action( 'embed_head', 'locale_stylesheet' ); add_action( 'oembed_footer', 'wp_print_footer_scripts', 20 ); -add_filter( 'excerpt_more', 'wp_oembed_excerpt_more', 20 ); +add_filter( 'excerpt_more', 'wp_embed_excerpt_more', 20 ); add_filter( 'the_excerpt_embed', 'wptexturize' ); add_filter( 'the_excerpt_embed', 'convert_chars' ); add_filter( 'the_excerpt_embed', 'wpautop' ); add_filter( 'the_excerpt_embed', 'shortcode_unautop' ); -add_filter( 'the_excerpt_embed', 'wp_oembed_excerpt_attachment' ); +add_filter( 'the_excerpt_embed', 'wp_embed_excerpt_attachment' ); add_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10, 3 ); add_filter( 'oembed_response_data', 'get_oembed_response_data_rich', 10, 4 ); diff --git a/src/wp-includes/embed-functions.php b/src/wp-includes/embed-functions.php index a6940b07a1..eff7ae4010 100644 --- a/src/wp-includes/embed-functions.php +++ b/src/wp-includes/embed-functions.php @@ -464,20 +464,20 @@ function get_post_embed_html( $post = null, $width, $height ) { $output = ""; @@ -491,7 +491,7 @@ JS; ); /** - * Filter the oEmbed HTML output. + * Filter the embed HTML output for a given post. * * @since 4.4.0 * @@ -500,7 +500,7 @@ JS; * @param int $width Width of the response. * @param int $height Height of the response. */ - return apply_filters( 'oembed_html', $output, $post, $width, $height ); + return apply_filters( 'embed_html', $output, $post, $width, $height ); } /** @@ -748,7 +748,7 @@ function wp_filter_oembed_result( $result, $data, $url ) { * @param string $more_string The string shown within the more link. * @return string The modified excerpt. */ -function wp_oembed_excerpt_more( $more_string ) { +function wp_embed_excerpt_more( $more_string ) { if ( ! is_embed() ) { return $more_string; } @@ -793,7 +793,7 @@ function the_excerpt_embed() { * @param string $content The current post excerpt. * @return string The modified post excerpt. */ -function wp_oembed_excerpt_attachment( $content ) { +function wp_embed_excerpt_attachment( $content ) { if ( is_attachment() ) { return prepend_attachment( '' ); } @@ -806,12 +806,12 @@ function wp_oembed_excerpt_attachment( $content ) { * * @since 4.4.0 */ -function print_oembed_embed_styles() { +function print_embed_styles() { ?>