wppaste
WordPress

WP_REST_URL_Details_Controller

Since
5.9.0
Source
wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php:18
Controller which provides REST endpoint for retrieving information from a remote site's HTML response.

Compatibility

WordPress
since 5.9.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Hooks and filters fired · 3

Every hook that fires from inside WP_REST_URL_Details_Controller, in the order it appears in the class, grouped by the method that fires it.

Methods · 17

Source code

class WP_REST_URL_Details_Controller extends WP_REST_Controller { 	/**	 * Constructs the controller.	 *	 * @since 5.9.0	 */	public function __construct() {		$this->namespace = 'wp-block-editor/v1';		$this->rest_base = 'url-details';	} 	/**	 * Registers the necessary REST API routes.	 *	 * @since 5.9.0	 */	public function register_routes() {		register_rest_route(			$this->namespace,			'/' . $this->rest_base,			array(				array(					'methods'             => WP_REST_Server::READABLE,					'callback'            => array( $this, 'parse_url_details' ),					'args'                => array(						'url' => array(							'required'          => true,							'description'       => __( 'The URL to process.' ),							'validate_callback' => 'wp_http_validate_url',							'sanitize_callback' => 'sanitize_url',							'type'              => 'string',							'format'            => 'uri',						),					),					'permission_callback' => array( $this, 'permissions_check' ),					'schema'              => array( $this, 'get_public_item_schema' ),				),			)		);	} 	/**	 * Retrieves the item's schema, conforming to JSON Schema.	 *	 * @since 5.9.0	 *	 * @return array Item schema data.	 */	public function get_item_schema() {		if ( $this->schema ) {			return $this->add_additional_fields_schema( $this->schema );		} 		$this->schema = array(			'$schema'    => 'http://json-schema.org/draft-04/schema#',			'title'      => 'url-details',			'type'       => 'object',			'properties' => array(				'title'       => array(					'description' => sprintf(						/* translators: %s: HTML title tag. */						__( 'The contents of the %s element from the URL.' ),						'<title>'					),					'type'        => 'string',					'context'     => array( 'view', 'edit', 'embed' ),					'readonly'    => true,				),				'icon'        => array(					'description' => sprintf(						/* translators: %s: HTML link tag. */						__( 'The favicon image link of the %s element from the URL.' ),						'<link rel="icon">'					),					'type'        => 'string',					'format'      => 'uri',					'context'     => array( 'view', 'edit', 'embed' ),					'readonly'    => true,				),

Changelog

Introduced in 5.9.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.