Make WordPress Core

Ticket #51269: 51269.2.diff

File 51269.2.diff, 9.6 KB (added by hellofromTonya, 4 years ago)

Documents the optional $args array elements to include width, height, and discovery.

  • src/wp-includes/class-wp-oembed.php

    diff --git a/src/wp-includes/class-wp-oembed.php b/src/wp-includes/class-wp-oembed.php
    index 881de68103..a74540d55b 100644
    a b class WP_oEmbed { 
    247247         *
    248248         * @see WP_oEmbed::discover()
    249249         *
    250          * @param string       $url  The URL to the content.
    251          * @param string|array $args Optional provider arguments.
     250         * @param string       $url      The URL to the content.
     251         * @param string|array $args     {
     252         *     Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
     253         *
     254         *     @type bool $discover Optional. Determines whether to attempt to discover link tags at the given URL
     255         *                          for an oEmbed provider when the oEmbed provider URL is not found in the
     256         *                          built-in providers list.
     257         * }
    252258         * @return string|false The oEmbed provider URL on success, false on failure.
    253259         */
    254260        public function get_provider( $url, $args = '' ) {
    class WP_oEmbed { 
    338344         *
    339345         * @since 4.8.0
    340346         *
    341          * @param string       $url  The URL to the content that should be attempted to be embedded.
    342          * @param array|string $args Optional. Arguments, usually passed from a shortcode. Default empty.
     347         * @param string       $url      The URL to the content that should be attempted to be embedded.
     348         * @param string|array $args     {
     349         *     Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
     350         *
     351         *     @type int|string    $width    Optional. The "maxwidth" value passed to the provider URL.
     352         *     @type int|string    $height   Optional. The "maxheight" value passed to the provider URL.
     353         *     @type bool          $discover Optional. Determines whether to attempt to discover link tags at the given URL
     354         *                                   for an oEmbed provider when the oEmbed provider URL is not found in the
     355         *                                   built-in providers list.
     356         * }
    343357         * @return object|false The result in the form of an object on success, false on failure.
    344358         */
    345359        public function get_data( $url, $args = '' ) {
    class WP_oEmbed { 
    363377        /**
    364378         * The do-it-all function that takes a URL and attempts to return the HTML.
    365379         *
    366          * @see WP_oEmbed::fetch()
     380         * @since 2.9.0
     381         *
    367382         * @see WP_oEmbed::data2html()
    368383         *
    369          * @since 2.9.0
     384         * @see WP_oEmbed::fetch()
     385         *
     386         * @param string       $url      The URL to the content that should be attempted to be embedded.
     387         * @param string|array $args     {
     388         *     Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
    370389         *
    371          * @param string       $url  The URL to the content that should be attempted to be embedded.
    372          * @param array|string $args Optional. Arguments, usually passed from a shortcode. Default empty.
     390         *     @type int|string    $width    Optional. The "maxwidth" value passed to the provider URL.
     391         *     @type int|string    $height   Optional. The "maxheight" value passed to the provider URL.
     392         *     @type bool          $discover Optional. Determines whether to attempt to discover link tags at the given URL
     393         *                                   for an oEmbed provider when the oEmbed provider URL is not found in the
     394         *                                   built-in providers list.
     395         * }
    373396         * @return string|false The UNSANITIZED (and potentially unsafe) HTML that should be used to embed on success,
    374397         *                      false on failure.
    375398         */
    class WP_oEmbed { 
    385408                 *
    386409                 * @since 4.5.3
    387410                 *
    388                  * @param null|string $result The UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
    389                  *                            Default null to continue retrieving the result.
    390                  * @param string      $url    The URL to the content that should be attempted to be embedded.
    391                  * @param array       $args   Optional. Arguments, usually passed from a shortcode. Default empty.
     411                 * @param null|string  $result   The UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
     412                 *                               Default null to continue retrieving the result.
     413                 * @param string       $url      The URL to the content that should be attempted to be embedded.
     414                 * @param string|array $args     {
     415                 *     Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
     416                 *
     417                 *     @type int|string    $width    Optional. The "maxwidth" value passed to the provider URL.
     418                 *     @type int|string    $height   Optional. The "maxheight" value passed to the provider URL.
     419                 *     @type bool          $discover Optional. Determines whether to attempt to discover link tags at the given URL
     420                 *                                   for an oEmbed provider when the oEmbed provider URL is not found in the
     421                 *                                   built-in providers list.
     422                 * }
    392423                 */
    393424                $pre = apply_filters( 'pre_oembed_result', null, $url, $args );
    394425
    class WP_oEmbed { 
    407438                 *
    408439                 * @since 2.9.0
    409440                 *
    410                  * @param string|false $data The returned oEmbed HTML (false if unsafe).
    411                  * @param string       $url  URL of the content to be embedded.
    412                  * @param array        $args Optional arguments, usually passed from a shortcode.
     441                 * @param string|false $data     The returned oEmbed HTML (false if unsafe).
     442                 * @param string       $url      URL of the content to be embedded.
     443                 * @param string|array $args     {
     444                 *     Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
     445                 *
     446                 *     @type int|string    $width    Optional. The "maxwidth" value passed to the provider URL.
     447                 *     @type int|string    $height   Optional. The "maxheight" value passed to the provider URL.
     448                 *     @type bool          $discover Optional. Determines whether to attempt to discover link tags at the given URL
     449                 *                                   for an oEmbed provider when the oEmbed provider URL is not found in the
     450                 *                                   built-in providers list.
     451                 * }
    413452                 */
    414453                return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args );
    415454        }
    class WP_oEmbed { 
    511550         *
    512551         * @param string       $provider The URL to the oEmbed provider.
    513552         * @param string       $url      The URL to the content that is desired to be embedded.
    514          * @param array|string $args     Optional. Arguments, usually passed from a shortcode. Default empty.
     553         * @param string|array $args     {
     554         *     Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
     555         *
     556         *     @type int|string    $width    Optional. The "maxwidth" value passed to the provider URL.
     557         *     @type int|string    $height   Optional. The "maxheight" value passed to the provider URL.
     558         *     @type bool          $discover Optional. Determines whether to attempt to discover link tags at the given URL
     559         *                                   for an oEmbed provider when the oEmbed provider URL is not found in the
     560         *                                   built-in providers list.
     561         * }
    515562         * @return object|false The result in the form of an object on success, false on failure.
    516563         */
    517564        public function fetch( $provider, $url, $args = '' ) {
    class WP_oEmbed { 
    528575                 * @since 2.9.0
    529576                 * @since 4.9.0 The `dnt` (Do Not Track) query parameter was added to all oEmbed provider URLs.
    530577                 *
    531                  * @param string $provider URL of the oEmbed provider.
    532                  * @param string $url      URL of the content to be embedded.
    533                  * @param array  $args     Optional arguments, usually passed from a shortcode.
     578                 * @param string $provider       URL of the oEmbed provider.
     579                 * @param string $url            URL of the content to be embedded.
     580                 * @param string|array $args     {
     581                 *     Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
     582                 *
     583                 *     @type int|string    $width    Optional. The "maxwidth" value passed to the provider URL.
     584                 *     @type int|string    $height   Optional. The "maxheight" value passed to the provider URL.
     585                 *     @type bool          $discover Optional. Determines whether to attempt to discover link tags at the given URL
     586                 *                                   for an oEmbed provider when the oEmbed provider URL is not found in the
     587                 *                                   built-in providers list.
     588                 * }
    534589                 */
    535590                $provider = apply_filters( 'oembed_fetch_url', $provider, $url, $args );
    536591
  • src/wp-includes/embed.php

    diff --git a/src/wp-includes/embed.php b/src/wp-includes/embed.php
    index a9704b7872..0eeef7f612 100644
    a b function wp_embed_defaults( $url = '' ) { 
    9898 *
    9999 * @see WP_oEmbed
    100100 *
    101  * @param string $url  The URL that should be embedded.
    102  * @param array  $args Optional. Additional arguments and parameters for retrieving embed HTML.
    103  *                     Default empty.
     101 * @param string       $url      The URL that should be embedded.
     102 * @param string|array $args     {
     103 *     Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
     104 *
     105 *     @type int|string    $width    Optional. The "maxwidth" value passed to the provider URL.
     106 *     @type int|string    $height   Optional. The "maxheight" value passed to the provider URL.
     107 *     @type bool          $discover Optional. Determines whether to attempt to discover link tags at the given URL
     108 *                                   for an oEmbed provider when the oEmbed provider URL is not found in the
     109 *                                   built-in providers list.
     110 * }
    104111 * @return string|false The embed HTML on success, false on failure.
    105112 */
    106113function wp_oembed_get( $url, $args = '' ) {