Embeds: Document $args in wp_oembed_get().

Props hellofromTonya, audrasjb, SergeyBiryukov.
Fixes #51269.


git-svn-id: https://develop.svn.wordpress.org/trunk@49620 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Helen Hou-Sandi 2020-11-16 23:11:21 +00:00
parent 4b8faba8db
commit 4fcdd01f33

View File

@ -237,7 +237,13 @@ class WP_oEmbed {
* @see WP_oEmbed::discover()
*
* @param string $url The URL to the content.
* @param string|array $args Optional provider arguments.
* @param string|array $args {
* Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
*
* @type bool $discover Optional. Determines whether to attempt to discover link tags at the given URL
* for an oEmbed provider when the oEmbed provider URL is not found in the
* built-in providers list.
* }
* @return string|false The oEmbed provider URL on success, false on failure.
*/
public function get_provider( $url, $args = '' ) {
@ -328,7 +334,15 @@ class WP_oEmbed {
* @since 4.8.0
*
* @param string $url The URL to the content that should be attempted to be embedded.
* @param array|string $args Optional. Arguments, usually passed from a shortcode. Default empty.
* @param string|array $args {
* Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
*
* @type int|string $width Optional. The "maxwidth" value passed to the provider URL.
* @type int|string $height Optional. The "maxheight" value passed to the provider URL.
* @type bool $discover Optional. Determines whether to attempt to discover link tags
* at the given URL for an oEmbed provider when the oEmbed
* provider URL is not found in the built-in providers list.
* }
* @return object|false The result in the form of an object on success, false on failure.
*/
public function get_data( $url, $args = '' ) {
@ -358,9 +372,17 @@ class WP_oEmbed {
* @since 2.9.0
*
* @param string $url The URL to the content that should be attempted to be embedded.
* @param array|string $args Optional. Arguments, usually passed from a shortcode. Default empty.
* @return string|false The UNSANITIZED (and potentially unsafe) HTML that should be used to embed on success,
* false on failure.
* @param string|array $args {
* Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
*
* @type int|string $width Optional. The "maxwidth" value passed to the provider URL.
* @type int|string $height Optional. The "maxheight" value passed to the provider URL.
* @type bool $discover Optional. Determines whether to attempt to discover link tags
* at the given URL for an oEmbed provider when the oEmbed
* provider URL is not found in the built-in providers list.
* }
* @return string|false The UNSANITIZED (and potentially unsafe) HTML that should be used to embed
* on success, false on failure.
*/
public function get_html( $url, $args = '' ) {
/**
@ -374,10 +396,18 @@ class WP_oEmbed {
*
* @since 4.5.3
*
* @param null|string $result The UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
* Default null to continue retrieving the result.
* @param string $url The URL to the content that should be attempted to be embedded.
* @param array $args Optional. Arguments, usually passed from a shortcode. Default empty.
* @param null|string $result The UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
* Default null to continue retrieving the result.
* @param string $url The URL to the content that should be attempted to be embedded.
* @param string|array $args {
* Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
*
* @type int|string $width Optional. The "maxwidth" value passed to the provider URL.
* @type int|string $height Optional. The "maxheight" value passed to the provider URL.
* @type bool $discover Optional. Determines whether to attempt to discover link tags
* at the given URL for an oEmbed provider when the oEmbed
* provider URL is not found in the built-in providers list.
* }
*/
$pre = apply_filters( 'pre_oembed_result', null, $url, $args );
@ -398,7 +428,15 @@ class WP_oEmbed {
*
* @param string|false $data The returned oEmbed HTML (false if unsafe).
* @param string $url URL of the content to be embedded.
* @param array $args Optional arguments, usually passed from a shortcode.
* @param string|array $args {
* Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
*
* @type int|string $width Optional. The "maxwidth" value passed to the provider URL.
* @type int|string $height Optional. The "maxheight" value passed to the provider URL.
* @type bool $discover Optional. Determines whether to attempt to discover link tags
* at the given URL for an oEmbed provider when the oEmbed
* provider URL is not found in the built-in providers list.
* }
*/
return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args );
}
@ -500,7 +538,15 @@ class WP_oEmbed {
*
* @param string $provider The URL to the oEmbed provider.
* @param string $url The URL to the content that is desired to be embedded.
* @param array|string $args Optional. Arguments, usually passed from a shortcode. Default empty.
* @param string|array $args {
* Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
*
* @type int|string $width Optional. The "maxwidth" value passed to the provider URL.
* @type int|string $height Optional. The "maxheight" value passed to the provider URL.
* @type bool $discover Optional. Determines whether to attempt to discover link tags
* at the given URL for an oEmbed provider when the oEmbed
* provider URL is not found in the built-in providers list.
* }
* @return object|false The result in the form of an object on success, false on failure.
*/
public function fetch( $provider, $url, $args = '' ) {
@ -517,9 +563,17 @@ class WP_oEmbed {
* @since 2.9.0
* @since 4.9.0 The `dnt` (Do Not Track) query parameter was added to all oEmbed provider URLs.
*
* @param string $provider URL of the oEmbed provider.
* @param string $url URL of the content to be embedded.
* @param array $args Optional arguments, usually passed from a shortcode.
* @param string $provider URL of the oEmbed provider.
* @param string $url URL of the content to be embedded.
* @param string|array $args {
* Optional. Additional arguments and parameters for retrieving embed HTML. Default empty.
*
* @type int|string $width Optional. The "maxwidth" value passed to the provider URL.
* @type int|string $height Optional. The "maxheight" value passed to the provider URL.
* @type bool $discover Optional. Determines whether to attempt to discover link tags
* at the given URL for an oEmbed provider when the oEmbed
* provider URL is not found in the built-in providers list.
* }
*/
$provider = apply_filters( 'oembed_fetch_url', $provider, $url, $args );