Make WordPress Core

Changeset 35235


Ignore:
Timestamp:
10/17/2015 01:20:19 AM (11 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk
Files:
6 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/Gruntfile.js

    r35203 r35235  
    234234                                        // Exceptions
    235235                                        '!wp-includes/css/dashicons.css',
    236                                         '!wp-includes/css/wp-oembed-embed.css'
     236                                        '!wp-includes/css/wp-embed-template.css'
    237237                                ]
    238238                        },
    … …  
    531531                                dest: '.'
    532532                        },
    533                         oembed: {
     533                        embed: {
    534534                                src: BUILD_DIR + 'wp-includes/embed-functions.php',
    535535                                dest: '.'
    … …  
    643643                'concat:emoji',
    644644                'includes:emoji',
    645                 'includes:oembed',
     645                'includes:embed',
    646646                'jsvalidate:build'
    647647        ] );
  • trunk/src/wp-includes/default-filters.php

    r35103 r35235  
    447447add_action( 'wp_head',              'wp_oembed_add_host_js'                );
    448448
    449 add_action( 'oembed_head',          'print_emoji_detection_script'         );
    450 add_action( 'oembed_head',          'print_emoji_styles'                   );
    451 add_action( 'oembed_head',          'print_oembed_embed_styles'            );
    452 add_action( 'oembed_head',          'print_oembed_embed_scripts'           );
    453 add_action( 'oembed_head',          'wp_print_head_scripts',         20    );
    454 add_action( 'oembed_head',          'wp_print_styles',               20    );
    455 add_action( 'oembed_head',          'wp_no_robots'                         );
    456 add_action( 'oembed_head',          'rel_canonical'                        );
    457 add_action( 'oembed_head',          'locale_stylesheet'                    );
     449add_action( 'embed_head',           'print_emoji_detection_script'         );
     450add_action( 'embed_head',           'print_emoji_styles'                   );
     451add_action( 'embed_head',           'print_embed_styles'                   );
     452add_action( 'embed_head',           'print_embed_scripts'                  );
     453add_action( 'embed_head',           'wp_print_head_scripts',         20    );
     454add_action( 'embed_head',           'wp_print_styles',               20    );
     455add_action( 'embed_head',           'wp_no_robots'                         );
     456add_action( 'embed_head',           'rel_canonical'                        );
     457add_action( 'embed_head',           'locale_stylesheet'                    );
    458458
    459459add_action( 'oembed_footer',        'wp_print_footer_scripts',       20    );
    460460
    461 add_filter( 'excerpt_more',         'wp_oembed_excerpt_more',        20    );
     461add_filter( 'excerpt_more',         'wp_embed_excerpt_more',         20    );
    462462add_filter( 'the_excerpt_embed',    'wptexturize'                          );
    463463add_filter( 'the_excerpt_embed',    'convert_chars'                        );
    464464add_filter( 'the_excerpt_embed',    'wpautop'                              );
    465465add_filter( 'the_excerpt_embed',    'shortcode_unautop'                    );
    466 add_filter( 'the_excerpt_embed',    'wp_oembed_excerpt_attachment'         );
     466add_filter( 'the_excerpt_embed',    'wp_embed_excerpt_attachment'          );
    467467
    468468add_filter( 'oembed_dataparse',     'wp_filter_oembed_result',       10, 3 );
  • trunk/src/wp-includes/embed-functions.php

    r35228 r35235  
    465465        $output = "<script type='text/javascript'>\n";
    466466        if ( SCRIPT_DEBUG ) {
    467                 $output .= file_get_contents( ABSPATH . WPINC . '/js/wp-oembed.js' );
     467                $output .= file_get_contents( ABSPATH . WPINC . '/js/wp-embed.js' );
    468468        } else {
    469469                /*
    470470                 * If you're looking at a src version of this file, you'll see an "include"
    471471                 * statement below. This is used by the `grunt build` process to directly
    472                  * include a minified version of wp-oembed.js, instead of using the
     472                 * include a minified version of wp-embed.js, instead of using the
    473473                 * file_get_contents() method from above.
    474474                 *
    475475                 * If you're looking at a build version of this file, you'll see a string of
    476476                 * minified JavaScript. If you need to debug it, please turn on SCRIPT_DEBUG
    477                  * and edit wp-oembed.js directly.
     477                 * and edit wp-embed.js directly.
    478478                 */
    479479                $output .=<<<JS
    480                 include "js/wp-oembed.min.js"
     480                include "js/wp-embed.min.js"
    481481JS;
    482482        }
    … …  
    492492
    493493        /**
    494          * Filter the oEmbed HTML output.
     494         * Filter the embed HTML output for a given post.
    495495         *
    496496         * @since 4.4.0
    … …  
    501501         * @param int     $height Height of the response.
    502502         */
    503         return apply_filters( 'oembed_html', $output, $post, $width, $height );
     503        return apply_filters( 'embed_html', $output, $post, $width, $height );
    504504}
    505505
    … …  
    749749 * @return string The modified excerpt.
    750750 */
    751 function wp_oembed_excerpt_more( $more_string ) {
     751function wp_embed_excerpt_more( $more_string ) {
    752752        if ( ! is_embed() ) {
    753753                return $more_string;
    … …  
    794794 * @return string The modified post excerpt.
    795795 */
    796 function wp_oembed_excerpt_attachment( $content ) {
     796function wp_embed_excerpt_attachment( $content ) {
    797797        if ( is_attachment() ) {
    798798                return prepend_attachment( '' );
    … …  
    807807 * @since 4.4.0
    808808 */
    809 function print_oembed_embed_styles() {
     809function print_embed_styles() {
    810810        ?>
    811811        <style type="text/css">
    812812        <?php
    813813                if ( SCRIPT_DEBUG ) {
    814                         readfile( ABSPATH . WPINC . "/css/wp-oembed-embed.css" );
     814                        readfile( ABSPATH . WPINC . "/css/wp-embed-template.css" );
    815815                } else {
    816816                        /*
    … …  
    822822                         * If you're looking at a build version of this file, you'll see a string of
    823823                         * minified CSS. If you need to debug it, please turn on SCRIPT_DEBUG
    824                          * and edit wp-oembed-embed.css directly.
     824                         * and edit wp-embed-template.css directly.
    825825                         */
    826826                        ?>
    827                         include "css/wp-oembed-embed.min.css"
     827                        include "css/wp-embed-template.min.css"
    828828                        <?php
    829829                }
    … …  
    838838 * @since 4.4.0
    839839 */
    840 function print_oembed_embed_scripts() {
     840function print_embed_scripts() {
    841841        ?>
    842842        <script type="text/javascript">
    843843        <?php
    844844                if ( SCRIPT_DEBUG ) {
    845                         readfile( ABSPATH . WPINC . "/js/wp-oembed-embed.js" );
     845                        readfile( ABSPATH . WPINC . "/js/wp-embed-template.js" );
    846846                } else {
    847847                        /*
    848848                         * If you're looking at a src version of this file, you'll see an "include"
    849849                         * statement below. This is used by the `grunt build` process to directly
    850                          * include a minified version of wp-oembed-embed.js, instead of using the
     850                         * include a minified version of wp-embed-template.js, instead of using the
    851851                         * readfile() method from above.
    852852                         *
    853853                         * If you're looking at a build version of this file, you'll see a string of
    854854                         * minified JavaScript. If you need to debug it, please turn on SCRIPT_DEBUG
    855                          * and edit wp-oembed-embed.js directly.
     855                         * and edit wp-embed-template.js directly.
    856856                         */
    857857                        ?>
    858                         include "js/wp-oembed-embed.min.js"
     858                        include "js/wp-embed-template.min.js"
    859859                        <?php
    860860                }
  • trunk/src/wp-includes/embed-template.php

    r35096 r35235  
    1212
    1313if ( ! headers_sent() ) {
    14         header( 'X-WP-oembed: true' );
     14        header( 'X-WP-embed: true' );
    1515}
    1616
    … …  
    2929         * @since 4.4.0
    3030         */
    31         do_action( 'oembed_head' );
     31        do_action( 'embed_head' );
    3232        ?>
    3333</head>
    … …  
    6767                         *
    6868                         * @since 4.4.0
    69                          * 
     69                         *
    7070                         * @param string $image_size Thumbnail image size.
    7171                         */
    72                         $image_size = apply_filters( 'oembed_thumbnail_image_size', $image_size );
     72                        $image_size = apply_filters( 'embed_thumbnail_image_size', $image_size );
    7373
    7474                        $shape = $measurements[0] / $measurements[1] >= 1.75 ? 'rectangular' : 'square';
    … …  
    8484                         * @param string $shape Thumbnail image shape. Either 'rectangular' or 'square'.
    8585                         */
    86                         $shape = apply_filters( 'oembed_thumbnail_image_shape', $shape );
     86                        $shape = apply_filters( 'embed_thumbnail_image_shape', $shape );
    8787                }
    8888                ?>
    … …  
    118118                         * @since 4.4.0
    119119                         */
    120                         do_action( 'oembed_content' );
     120                        do_action( 'embed_content' );
    121121                        ?>
    122122
    … …  
    133133                                         * @param string $site_icon_url The site icon URL.
    134134                                         */
    135                                         $site_icon_url = apply_filters( 'oembed_site_icon_url', $site_icon_url );
     135                                        $site_icon_url = apply_filters( 'embed_site_icon_url', $site_icon_url );
    136136
    137137                                        printf(
    … …  
    151151                                         * @since 4.4.0
    152152                                         */
    153                                         do_action( 'oembed_content_meta');
     153                                        do_action( 'embed_content_meta');
    154154                                        ?>
    155155                                        <?php if ( get_comments_number() || comments_open() ) : ?>
    … …  
    234234                                 * @param string $site_icon_url The site icon URL.
    235235                                 */
    236                                 $site_icon_url = apply_filters( 'oembed_site_icon_url', $site_icon_url );
     236                                $site_icon_url = apply_filters( 'embed_site_icon_url', $site_icon_url );
    237237
    238238                                printf(
    … …  
    254254 * @since 4.4.0
    255255 */
    256 do_action( 'oembed_footer' );
     256do_action( 'embed_footer' );
    257257?>
    258258</body>
  • trunk/src/wp-includes/js/tinymce/plugins/wpoembed/plugin.js

    r34903 r35235  
    99                                id: scriptId,
    1010                                type: 'text/javascript',
    11                                 src: url + '/../../../wp-oembed.js'
     11                                src: url + '/../../../wp-embed.js'
    1212                        } );
    1313
  • trunk/tests/phpunit/tests/oembed/template.php

    r35225 r35235  
    187187        }
    188188
    189         function test_wp_oembed_excerpt_more_no_embed() {
     189        function test_wp_embed_excerpt_more_no_embed() {
    190190                $GLOBALS['wp_query'] = new WP_Query();
    191191
    192                 $this->assertEquals( 'foo bar', wp_oembed_excerpt_more( 'foo bar' ) );
    193         }
    194 
    195         function test_wp_oembed_excerpt_more() {
    196                 $post_id = self::$factory->post->create( array(
    197                         'post_content' => 'Foo Bar',
    198                 ) );
    199 
    200                 $this->assertEquals( '', wp_oembed_excerpt_more( '' ) );
    201 
    202                 $this->go_to( get_post_embed_url( $post_id ) );
    203 
    204                 $actual = wp_oembed_excerpt_more( '' );
     192                $this->assertEquals( 'foo bar', wp_embed_excerpt_more( 'foo bar' ) );
     193        }
     194
     195        function test_wp_embed_excerpt_more() {
     196                $post_id = self::$factory->post->create( array(
     197                        'post_content' => 'Foo Bar',
     198                ) );
     199
     200                $this->assertEquals( '', wp_embed_excerpt_more( '' ) );
     201
     202                $this->go_to( get_post_embed_url( $post_id ) );
     203
     204                $actual = wp_embed_excerpt_more( '' );
    205205
    206206                $expected = sprintf(
Note: See TracChangeset for help on using the changeset viewer.