WordPress.org

Make WordPress Core

Changeset 38361


Ignore:
Timestamp:
08/26/2016 09:48:32 AM (4 years ago)
Author:
wonderboymusic
Message:

OEmbed: move _wp_oembed_get_object() to embed.php, where all of the other embed functions live. WP_oEmbed is then in a file by itself. Load class-oembed.php in wp-settings.php and remove extraneous include calls.

See #37827.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-press-this.php

    r38028 r38361  
    480480            $src = 'https://www.dailymotion.com/video/' . $src_matches[2];
    481481        } else {
    482             require_once( ABSPATH . WPINC . '/class-oembed.php' );
    483482            $oembed = _wp_oembed_get_object();
    484483
  • trunk/src/wp-includes/class-oembed.php

    r38230 r38361  
    678678    }
    679679}
    680 
    681 /**
    682  * Returns the initialized WP_oEmbed object.
    683  *
    684  * @since 2.9.0
    685  * @access private
    686  *
    687  * @staticvar WP_oEmbed $wp_oembed
    688  *
    689  * @return WP_oEmbed object.
    690  */
    691 function _wp_oembed_get_object() {
    692     static $wp_oembed = null;
    693 
    694     if ( is_null( $wp_oembed ) ) {
    695         $wp_oembed = new WP_oEmbed();
    696     }
    697     return $wp_oembed;
    698 }
  • trunk/src/wp-includes/embed.php

    r38321 r38361  
    9595 */
    9696function wp_oembed_get( $url, $args = '' ) {
    97     require_once( ABSPATH . WPINC . '/class-oembed.php' );
    9897    $oembed = _wp_oembed_get_object();
    9998    return $oembed->get_html( $url, $args );
     99}
     100
     101/**
     102 * Returns the initialized WP_oEmbed object.
     103 *
     104 * @since 2.9.0
     105 * @access private
     106 *
     107 * @staticvar WP_oEmbed $wp_oembed
     108 *
     109 * @return WP_oEmbed object.
     110 */
     111function _wp_oembed_get_object() {
     112    static $wp_oembed = null;
     113
     114    if ( is_null( $wp_oembed ) ) {
     115        $wp_oembed = new WP_oEmbed();
     116    }
     117    return $wp_oembed;
    100118}
    101119
     
    113131 */
    114132function wp_oembed_add_provider( $format, $provider, $regex = false ) {
    115     require_once( ABSPATH . WPINC . '/class-oembed.php' );
    116 
    117133    if ( did_action( 'plugins_loaded' ) ) {
    118134        $oembed = _wp_oembed_get_object();
     
    134150 */
    135151function wp_oembed_remove_provider( $format ) {
    136     require_once( ABSPATH . WPINC . '/class-oembed.php' );
    137 
    138152    if ( did_action( 'plugins_loaded' ) ) {
    139153        $oembed = _wp_oembed_get_object();
     
    707721    }
    708722
    709     require_once( ABSPATH . WPINC . '/class-oembed.php' );
    710723    $wp_oembed = _wp_oembed_get_object();
    711724
  • trunk/src/wp-settings.php

    r38351 r38361  
    192192require( ABSPATH . WPINC . '/embed.php' );
    193193require( ABSPATH . WPINC . '/class-wp-embed.php' );
     194require( ABSPATH . WPINC . '/class-oembed.php' );
    194195require( ABSPATH . WPINC . '/class-wp-oembed-controller.php' );
    195196require( ABSPATH . WPINC . '/media.php' );
Note: See TracChangeset for help on using the changeset viewer.