[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
REST API: WP_REST_URL_Details_Controller class
File Size: | 668 lines (21 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
WP_REST_URL_Details_Controller:: (17 methods):
__construct()
register_routes()
get_item_schema()
parse_url_details()
permissions_check()
get_remote_url()
get_title()
get_icon()
get_description()
get_image()
prepare_metadata_for_output()
build_cache_key_for_url()
get_cache()
set_cache()
get_document_head()
get_meta_with_content_elements()
get_metadata_from_meta_element()
Class: WP_REST_URL_Details_Controller - X-Ref
Controller which provides REST endpoint for retrieving information__construct() X-Ref |
Constructs the controller. since: 5.9.0 |
register_routes() X-Ref |
Registers the necessary REST API routes. since: 5.9.0 |
get_item_schema() X-Ref |
Retrieves the item's schema, conforming to JSON Schema. return: array Item schema data. since: 5.9.0 |
parse_url_details( $request ) X-Ref |
Retrieves the contents of the title tag from the HTML response. return: WP_REST_Response|WP_Error The parsed details as a response object. WP_Error if there are errors. param: WP_REST_REQUEST $request Full details about the request. since: 5.9.0 |
permissions_check() X-Ref |
Checks whether a given request has permission to read remote URLs. return: WP_Error|bool True if the request has permission, else WP_Error. since: 5.9.0 |
get_remote_url( $url ) X-Ref |
Retrieves the document title from a remote URL. return: string|WP_Error The HTTP response from the remote URL on success. param: string $url The website URL whose HTML to access. since: 5.9.0 |
get_title( $html ) X-Ref |
Parses the title tag contents from the provided HTML. return: string The title tag contents on success. Empty string if not found. param: string $html The HTML from the remote website at URL. since: 5.9.0 |
get_icon( $html, $url ) X-Ref |
Parses the site icon from the provided HTML. return: string The icon URI on success. Empty string if not found. param: string $html The HTML from the remote website at URL. param: string $url The target website URL. since: 5.9.0 |
get_description( $meta_elements ) X-Ref |
Parses the meta description from the provided HTML. return: string The meta description contents on success. Empty string if not found. param: array $meta_elements { since: 5.9.0 |
get_image( $meta_elements, $url ) X-Ref |
Parses the Open Graph (OG) Image from the provided HTML. See: https://ogp.me/. return: string The OG image on success. Empty string if not found. param: array $meta_elements { param: string $url The target website URL. since: 5.9.0 |
prepare_metadata_for_output( $metadata ) X-Ref |
Prepares the metadata by: - stripping all HTML tags and tag entities. - converting non-tag entities into characters. return: string The prepared metadata. param: string $metadata The metadata content to prepare. since: 5.9.0 |
build_cache_key_for_url( $url ) X-Ref |
Utility function to build cache key for a given URL. return: string The cache key. param: string $url The URL for which to build a cache key. since: 5.9.0 |
get_cache( $key ) X-Ref |
Utility function to retrieve a value from the cache at a given key. return: mixed The value from the cache. param: string $key The cache key. since: 5.9.0 |
set_cache( $key, $data = '' ) X-Ref |
Utility function to cache a given data set at a given cache key. return: bool True when transient set. False if not set. param: string $key The cache key under which to store the value. param: string $data The data to be stored at the given cache key. since: 5.9.0 |
get_document_head( $html ) X-Ref |
Retrieves the head element section. return: string The `<head>..</head>` section on success. Given `$html` if not found. param: string $html The string of HTML to parse. since: 5.9.0 |
get_meta_with_content_elements( $html ) X-Ref |
Gets all the meta tag elements that have a 'content' attribute. return: array { param: string $html The string of HTML to be parsed. since: 5.9.0 |
get_metadata_from_meta_element( $meta_elements, $attr, $attr_value ) X-Ref |
Gets the metadata from a target meta element. return: string The metadata on success. Empty string if not found. param: array $meta_elements { param: string $attr Attribute that identifies the element with the target metadata. param: string $attr_value The attribute's value that identifies the element with the target metadata. since: 5.9.0 |
Generated: Thu Nov 21 01:00:03 2024 | Cross-referenced by PHPXref 0.7.1 |