[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> class-wp-oembed.php (summary)

API for fetching the HTML to embed remote content based on a provided URL Used internally by the WP_Embed class, but is designed to be generic.

File Size: 768 lines (31 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_oEmbed:: (15 methods):
  __construct()
  __call()
  get_provider()
  _add_provider_early()
  _remove_provider_early()
  get_data()
  get_html()
  discover()
  fetch()
  _fetch_with_format()
  _parse_json()
  _parse_xml()
  _parse_xml_body()
  data2html()
  _strip_newlines()


Class: WP_oEmbed  - X-Ref

Core class used to implement oEmbed functionality.

__construct()   X-Ref
Constructor.

since: 2.9.0

__call( $name, $arguments )   X-Ref
Exposes private/protected methods for backward compatibility.

return: mixed|false Return value of the callback, false otherwise.
param: string $name      Method to call.
param: array  $arguments Arguments to pass when calling.
since: 4.0.0

get_provider( $url, $args = '' )   X-Ref
Takes a URL and returns the corresponding oEmbed provider's URL, if there is one.

return: string|false The oEmbed provider URL on success, false on failure.
param: string       $url  The URL to the content.
param: string|array $args {
since: 4.0.0

_add_provider_early( $format, $provider, $regex = false )   X-Ref
Adds an oEmbed provider.

The provider is added just-in-time when wp_oembed_add_provider() is called before
the {@see 'plugins_loaded'} hook.

The just-in-time addition is for the benefit of the {@see 'oembed_providers'} filter.

param: string $format   Format of URL that this provider can handle. You can use
param: string $provider The URL to the oEmbed provider..
param: bool   $regex    Optional. Whether the $format parameter is in a regex format.
since: 4.0.0

_remove_provider_early( $format )   X-Ref
Removes an oEmbed provider.

The provider is removed just-in-time when wp_oembed_remove_provider() is called before
the {@see 'plugins_loaded'} hook.

The just-in-time removal is for the benefit of the {@see 'oembed_providers'} filter.

param: string $format The format of URL that this provider can handle. You can use
since: 4.0.0

get_data( $url, $args = '' )   X-Ref
Takes a URL and attempts to return the oEmbed data.

return: object|false The result in the form of an object on success, false on failure.
param: string       $url  The URL to the content that should be attempted to be embedded.
param: string|array $args Optional. Additional arguments for retrieving embed HTML.
since: 4.8.0

get_html( $url, $args = '' )   X-Ref
The do-it-all function that takes a URL and attempts to return the HTML.

return: string|false The UNSANITIZED (and potentially unsafe) HTML that should be used to embed
param: string       $url  The URL to the content that should be attempted to be embedded.
param: string|array $args Optional. Additional arguments for retrieving embed HTML.
since: 2.9.0

discover( $url )   X-Ref
Attempts to discover link tags at the given URL for an oEmbed provider.

return: string|false The oEmbed provider URL on success, false on failure.
param: string $url The URL that should be inspected for discovery `<link>` tags.
since: 2.9.0

fetch( $provider, $url, $args = '' )   X-Ref
Connects to a oEmbed provider and returns the result.

return: object|false The result in the form of an object on success, false on failure.
param: string       $provider The URL to the oEmbed provider.
param: string       $url      The URL to the content that is desired to be embedded.
param: string|array $args     Optional. Additional arguments for retrieving embed HTML.
since: 2.9.0

_fetch_with_format( $provider_url_with_args, $format )   X-Ref
Fetches result from an oEmbed provider for a specific format and complete provider URL

return: object|false|WP_Error The result in the form of an object on success, false on failure.
param: string $provider_url_with_args URL to the provider with full arguments list (url, maxheight, etc.)
param: string $format                 Format to use.
since: 3.0.0

_parse_json( $response_body )   X-Ref
Parses a json response body.

return: object|false
param: string $response_body
since: 3.0.0

_parse_xml( $response_body )   X-Ref
Parses an XML response body.

return: object|false
param: string $response_body
since: 3.0.0

_parse_xml_body( $response_body )   X-Ref
Serves as a helper function for parsing an XML response body.

return: stdClass|false
param: string $response_body
since: 3.6.0

data2html( $data, $url )   X-Ref
Converts a data object from WP_oEmbed::fetch() and returns the HTML.

return: string|false The HTML needed to embed on success, false on failure.
param: object $data A data object result from an oEmbed provider.
param: string $url  The URL to the content that is desired to be embedded.
since: 2.9.0

_strip_newlines( $html, $data, $url )   X-Ref
Strips any new lines from the HTML.

return: string Possibly modified $html
param: string $html Existing HTML.
param: object $data Data object from WP_oEmbed::data2html()
param: string $url The original URL passed to oEmbed.
since: 2.9.0 as strip_scribd_newlines()
since: 3.0.0



Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1