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
This commit is contained in:
Sergey Biryukov 2015-10-17 01:20:19 +00:00
parent 5c19a7a704
commit 9b591d6b09
9 changed files with 47 additions and 47 deletions

View File

@ -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'
] );

View File

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

View File

@ -464,20 +464,20 @@ function get_post_embed_html( $post = null, $width, $height ) {
$output = "<script type='text/javascript'>\n";
if ( SCRIPT_DEBUG ) {
$output .= file_get_contents( ABSPATH . WPINC . '/js/wp-oembed.js' );
$output .= file_get_contents( ABSPATH . WPINC . '/js/wp-embed.js' );
} else {
/*
* If you're looking at a src version of this file, you'll see an "include"
* statement below. This is used by the `grunt build` process to directly
* include a minified version of wp-oembed.js, instead of using the
* include a minified version of wp-embed.js, instead of using the
* file_get_contents() method from above.
*
* If you're looking at a build version of this file, you'll see a string of
* minified JavaScript. If you need to debug it, please turn on SCRIPT_DEBUG
* and edit wp-oembed.js directly.
* and edit wp-embed.js directly.
*/
$output .=<<<JS
include "js/wp-oembed.min.js"
include "js/wp-embed.min.js"
JS;
}
$output .= "\n</script>";
@ -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() {
?>
<style type="text/css">
<?php
if ( SCRIPT_DEBUG ) {
readfile( ABSPATH . WPINC . "/css/wp-oembed-embed.css" );
readfile( ABSPATH . WPINC . "/css/wp-embed-template.css" );
} else {
/*
* If you're looking at a src version of this file, you'll see an "include"
@ -821,10 +821,10 @@ function print_oembed_embed_styles() {
*
* If you're looking at a build version of this file, you'll see a string of
* minified CSS. If you need to debug it, please turn on SCRIPT_DEBUG
* and edit wp-oembed-embed.css directly.
* and edit wp-embed-template.css directly.
*/
?>
include "css/wp-oembed-embed.min.css"
include "css/wp-embed-template.min.css"
<?php
}
?>
@ -837,25 +837,25 @@ function print_oembed_embed_styles() {
*
* @since 4.4.0
*/
function print_oembed_embed_scripts() {
function print_embed_scripts() {
?>
<script type="text/javascript">
<?php
if ( SCRIPT_DEBUG ) {
readfile( ABSPATH . WPINC . "/js/wp-oembed-embed.js" );
readfile( ABSPATH . WPINC . "/js/wp-embed-template.js" );
} else {
/*
* If you're looking at a src version of this file, you'll see an "include"
* statement below. This is used by the `grunt build` process to directly
* include a minified version of wp-oembed-embed.js, instead of using the
* include a minified version of wp-embed-template.js, instead of using the
* readfile() method from above.
*
* If you're looking at a build version of this file, you'll see a string of
* minified JavaScript. If you need to debug it, please turn on SCRIPT_DEBUG
* and edit wp-oembed-embed.js directly.
* and edit wp-embed-template.js directly.
*/
?>
include "js/wp-oembed-embed.min.js"
include "js/wp-embed-template.min.js"
<?php
}
?>

View File

@ -11,7 +11,7 @@
*/
if ( ! headers_sent() ) {
header( 'X-WP-oembed: true' );
header( 'X-WP-embed: true' );
}
wp_enqueue_style( 'open-sans' );
@ -28,7 +28,7 @@ wp_enqueue_style( 'open-sans' );
*
* @since 4.4.0
*/
do_action( 'oembed_head' );
do_action( 'embed_head' );
?>
</head>
<body <?php body_class(); ?>>
@ -66,10 +66,10 @@ if ( have_posts() ) :
* Filter the thumbnail image size for use in the embed template.
*
* @since 4.4.0
*
*
* @param string $image_size Thumbnail image size.
*/
$image_size = apply_filters( 'oembed_thumbnail_image_size', $image_size );
$image_size = apply_filters( 'embed_thumbnail_image_size', $image_size );
$shape = $measurements[0] / $measurements[1] >= 1.75 ? 'rectangular' : 'square';
@ -83,7 +83,7 @@ if ( have_posts() ) :
*
* @param string $shape Thumbnail image shape. Either 'rectangular' or 'square'.
*/
$shape = apply_filters( 'oembed_thumbnail_image_shape', $shape );
$shape = apply_filters( 'embed_thumbnail_image_shape', $shape );
}
?>
<div <?php post_class( 'wp-embed' ); ?>>
@ -117,7 +117,7 @@ if ( have_posts() ) :
*
* @since 4.4.0
*/
do_action( 'oembed_content' );
do_action( 'embed_content' );
?>
<div class="wp-embed-footer">
@ -132,7 +132,7 @@ if ( have_posts() ) :
*
* @param string $site_icon_url The site icon URL.
*/
$site_icon_url = apply_filters( 'oembed_site_icon_url', $site_icon_url );
$site_icon_url = apply_filters( 'embed_site_icon_url', $site_icon_url );
printf(
'<a href="%s" target="_top"><img src="%s" width="32" height="32" alt="" class="wp-embed-site-icon"/><span>%s</span></a>',
@ -150,7 +150,7 @@ if ( have_posts() ) :
*
* @since 4.4.0
*/
do_action( 'oembed_content_meta');
do_action( 'embed_content_meta');
?>
<?php if ( get_comments_number() || comments_open() ) : ?>
<div class="wp-embed-comments">
@ -233,7 +233,7 @@ else :
*
* @param string $site_icon_url The site icon URL.
*/
$site_icon_url = apply_filters( 'oembed_site_icon_url', $site_icon_url );
$site_icon_url = apply_filters( 'embed_site_icon_url', $site_icon_url );
printf(
'<a href="%s" target="_top"><img src="%s" width="32" height="32" alt="" class="wp-embed-site-icon"/><span>%s</span></a>',
@ -253,7 +253,7 @@ endif;
*
* @since 4.4.0
*/
do_action( 'oembed_footer' );
do_action( 'embed_footer' );
?>
</body>
</html>

View File

@ -8,7 +8,7 @@
var scriptElm = editor.dom.create( 'script', {
id: scriptId,
type: 'text/javascript',
src: url + '/../../../wp-oembed.js'
src: url + '/../../../wp-embed.js'
} );
editor.getDoc().getElementsByTagName( 'head' )[ 0 ].appendChild( scriptElm );

View File

@ -186,22 +186,22 @@ class Tests_Embed_Template extends WP_UnitTestCase {
$this->assertTrue( false !== strpos( $actual, 'Hello World' ) );
}
function test_wp_oembed_excerpt_more_no_embed() {
function test_wp_embed_excerpt_more_no_embed() {
$GLOBALS['wp_query'] = new WP_Query();
$this->assertEquals( 'foo bar', wp_oembed_excerpt_more( 'foo bar' ) );
$this->assertEquals( 'foo bar', wp_embed_excerpt_more( 'foo bar' ) );
}
function test_wp_oembed_excerpt_more() {
function test_wp_embed_excerpt_more() {
$post_id = self::$factory->post->create( array(
'post_content' => 'Foo Bar',
) );
$this->assertEquals( '', wp_oembed_excerpt_more( '' ) );
$this->assertEquals( '', wp_embed_excerpt_more( '' ) );
$this->go_to( get_post_embed_url( $post_id ) );
$actual = wp_oembed_excerpt_more( '' );
$actual = wp_embed_excerpt_more( '' );
$expected = sprintf(
'&hellip; <a class="wp-embed-more" href="%s" target="_top">Read more</a>',