[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

(no description)

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

Defines 1 class

WP_Embed:: (12 methods):
  __construct()
  run_shortcode()
  maybe_run_ajax_cache()
  register_handler()
  unregister_handler()
  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
Process 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.

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

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 (default: 10). Lower numbers correspond with earlier testing, and handlers with the same priority are tested in the order in which they were added to the action.

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

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.

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

delete_oembed_caches( $post_ID )   X-Ref
Delete 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.

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

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

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

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

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

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

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



Generated: Mon Sep 16 01:00:03 2019 Cross-referenced by PHPXref 0.7.1