Make WordPress Core

Ticket #24381: 24381.patch

File 24381.patch, 1.6 KB (added by johnbillion, 11 years ago)
  • wp-includes/class-oembed.php

     
    6565        /**
    6666         * The do-it-all function that takes a URL and attempts to return the HTML.
    6767         *
    68          * @see WP_oEmbed::discover()
    6968         * @see WP_oEmbed::fetch()
    7069         * @see WP_oEmbed::data2html()
    7170         *
     
    7473         * @return bool|string False on failure, otherwise the UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
    7574         */
    7675        function get_html( $url, $args = '' ) {
     76                $provider = $this->get_provider( $url, $args );
     77
     78                if ( !$provider || false === $data = $this->fetch( $provider, $url, $args ) )
     79                        return false;
     80
     81                return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args );
     82        }
     83
     84        /**
     85         * Takes a URL and return the corresponding oEmbed provider URL, if there is one.
     86         *
     87         * @see WP_oEmbed::discover()
     88         *
     89         * @param string $url The URL to the content.
     90         * @param array $args Optional arguments.
     91         * @return bool|string False on failure, otherwise the oEmbed provider URL.
     92         * @since 3.6
     93         */
     94        function get_provider( $url, $args = array() ) {
     95
    7796                $provider = false;
    7897
    7998                if ( !isset($args['discover']) )
     
    97116                if ( !$provider && $args['discover'] )
    98117                        $provider = $this->discover( $url );
    99118
    100                 if ( !$provider || false === $data = $this->fetch( $provider, $url, $args ) )
    101                         return false;
     119                return $provider;
    102120
    103                 return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args );
    104121        }
    105122
    106123        /**