WordPress.org

Make WordPress Core

Changeset 28728


Ignore:
Timestamp:
06/10/2014 06:13:43 PM (6 years ago)
Author:
johnbillion
Message:

A little more abstraction in the WP_oEmbed class. Fixes #24381.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-oembed.php

    r28651 r28728  
    9696
    9797    /**
    98      * The do-it-all function that takes a URL and attempts to return the HTML.
     98     * Takes a URL and returns the corresponding oEmbed provider's URL, if there is one.
    9999     *
    100100     * @see WP_oEmbed::discover()
    101      * @see WP_oEmbed::fetch()
    102      * @see WP_oEmbed::data2html()
    103      *
    104      * @param string $url The URL to the content that should be attempted to be embedded.
    105      * @param array $args Optional arguments. Usually passed from a shortcode.
    106      * @return bool|string False on failure, otherwise the UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
    107      */
    108     public function get_html( $url, $args = '' ) {
     101     *
     102     * @param string $url  The URL to the content.
     103     * @param array  $args Optional arguments.
     104     * @return bool|string False on failure, otherwise the oEmbed provider URL.
     105     * @since 4.0.0
     106     */
     107    public function get_provider( $url, $args = '' ) {
     108
    109109        $provider = false;
    110110
     
    129129        if ( !$provider && $args['discover'] )
    130130            $provider = $this->discover( $url );
     131
     132        return $provider;
     133    }
     134
     135    /**
     136     * The do-it-all function that takes a URL and attempts to return the HTML.
     137     *
     138     * @see WP_oEmbed::fetch()
     139     * @see WP_oEmbed::data2html()
     140     *
     141     * @param string $url The URL to the content that should be attempted to be embedded.
     142     * @param array $args Optional arguments. Usually passed from a shortcode.
     143     * @return bool|string False on failure, otherwise the UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
     144     */
     145    function get_html( $url, $args = '' ) {
     146        $provider = $this->get_provider( $url, $args );
    131147
    132148        if ( !$provider || false === $data = $this->fetch( $provider, $url, $args ) )
Note: See TracChangeset for help on using the changeset viewer.