[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

(no description)

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

Defines 1 class

WP_Embed:: (13 methods):
  __construct()
  run_shortcode()
  maybe_run_ajax_cache()
  register_handler()
  unregister_handler()
  get_embed_handler_html()
  shortcode()
  delete_oembed_caches()
  cache_oembed()
  autoembed()
  autoembed_callback()
  maybe_make_link()
  find_oembed_post_id()


Class: WP_Embed  - X-Ref

API for easily embedding rich media such as videos and images into content.

__construct()   X-Ref
Constructor


run_shortcode( $content )   X-Ref
Processes the [embed] shortcode.

Since the [embed] shortcode needs to be run earlier than other shortcodes,
this function removes all existing shortcodes, registers the [embed] shortcode,
calls do_shortcode(), and then re-registers the old shortcodes.

param: string $content Content to parse.
return: string Content with shortcode parsed.

maybe_run_ajax_cache()   X-Ref
If a post/page was saved, then output JavaScript to make
an Ajax request that will call WP_Embed::cache_oembed().


register_handler( $id, $regex, $callback, $priority = 10 )   X-Ref
Registers an embed handler.

Do not use this function directly, use wp_embed_register_handler() instead.

This function should probably also only be used for sites that do not support oEmbed.

param: string   $id       An internal ID/name for the handler. Needs to be unique.
param: string   $regex    The regex that will be used to see if this handler should be used for a URL.
param: callable $callback The callback function that will be called if the regex is matched.
param: int      $priority Optional. Used to specify the order in which the registered handlers will be tested.

unregister_handler( $id, $priority = 10 )   X-Ref
Unregisters a previously-registered embed handler.

Do not use this function directly, use wp_embed_unregister_handler() instead.

param: string $id       The handler ID that should be removed.
param: int    $priority Optional. The priority of the handler to be removed (default: 10).

get_embed_handler_html( $attr, $url )   X-Ref
Returns embed HTML for a given URL from embed handlers.

Attempts to convert a URL into embed HTML by checking the URL
against the regex of the registered embed handlers.

param: array  $attr {
param: string $url The URL attempting to be embedded.
return: string|false The embed HTML on success, false otherwise.
since: 5.5.0

shortcode( $attr, $url = '' )   X-Ref
The do_shortcode() callback function.

Attempts to convert a URL into embed HTML. Starts by checking the URL against the regex of
the registered embed handlers. If none of the regex matches and it's enabled, then the URL
will be given to the WP_oEmbed class.

param: array  $attr {
param: string $url The URL attempting to be embedded.
return: string|false The embed HTML on success, otherwise the original URL.

delete_oembed_caches( $post_ID )   X-Ref
Deletes all oEmbed caches. Unused by core as of 4.0.0.

param: int $post_ID Post ID to delete the caches for.

cache_oembed( $post_ID )   X-Ref
Triggers a caching of all oEmbed results.

param: int $post_ID Post ID to do the caching for.

autoembed( $content )   X-Ref
Passes any unlinked URLs that are on their own line to WP_Embed::shortcode() for potential embedding.

param: string $content The content to be searched.
return: string Potentially modified $content.

autoembed_callback( $matches )   X-Ref
Callback function for WP_Embed::autoembed().

param: array $matches A regex match array.
return: string The embed HTML on success, otherwise the original URL.

maybe_make_link( $url )   X-Ref
Conditionally makes a hyperlink based on an internal class variable.

param: string $url URL to potentially be linked.
return: string|false Linked URL or the original URL. False if 'return_false_on_fail' is true.

find_oembed_post_id( $cache_key )   X-Ref
Finds the oEmbed cache post ID for a given cache key.

param: string $cache_key oEmbed cache key.
return: int|null Post ID on success, null on failure.
since: 4.9.0



Generated: Sun Dec 22 01:00:02 2024 Cross-referenced by PHPXref 0.7.1