[ 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: 750 lines (30 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|bool Return value of the callback, false otherwise.
since: 4.0.0
param: string   $name      Method to call.
param: array    $arguments Arguments to pass when calling.

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

return: false|string False on failure, otherwise the oEmbed provider URL.
since: 4.0.0
param: string        $url  The URL to the content.
param: string|array  $args Optional provider arguments.

_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.

since: 4.0.0
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.

_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.

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

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

return: false|object False on failure, otherwise the result in the form of an object.
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.

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

return: false|string False on failure, otherwise the UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
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.

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

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

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

return: false|object False on failure, otherwise the result in the form of an object.
since: 2.9.0
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.

_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: false|object|WP_Error False on failure, otherwise the result in the form of an object.
since: 3.0.0
param: string $provider_url_with_args URL to the provider with full arguments list (url, maxheight, etc.)
param: string $format Format to use

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

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

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

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

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

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

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

return: false|string False on error, otherwise the HTML needed to embed.
since: 2.9.0
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.

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

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



Generated: Sun Sep 15 01:00:03 2019 Cross-referenced by PHPXref 0.7.1