[ Index ]

WordPress Cross Reference

title

Body

[close]

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

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

File Size: 397 lines (14 kb)
Included or required: 3 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_oEmbed:: (11 methods):
  __construct()
  get_html()
  discover()
  fetch()
  _fetch_with_format()
  _parse_json()
  _parse_xml()
  _parse_xml_body()
  data2html()
  _strip_newlines()
  _wp_oembed_get_object()


Class: WP_oEmbed  - X-Ref

oEmbed class.

__construct()   X-Ref
Constructor


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

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

discover( $url )   X-Ref
Attempts to find oEmbed provider discovery <link> tags at the given URL.

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

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

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 $args Optional arguments. Usually passed from a shortcode.
return: bool|object False on failure, otherwise the result in the form of an object.

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

param: string $provider_url_with_args URL to the provider with full arguments list (url, maxheight, etc.)
param: string $format Format to use
return: bool|object False on failure, otherwise the result in the form of an object.

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


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


_parse_xml_body( $response_body )   X-Ref
Helper function for parsing an XML response body.


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

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

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

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

_wp_oembed_get_object()   X-Ref
Returns the initialized {@link WP_oEmbed} object

return: WP_oEmbed object.



Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu