[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/rest-api/endpoints/ -> class-wp-rest-font-faces-controller.php (summary)

REST API: WP_REST_Font_Faces_Controller class

File Size: 950 lines (30 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 wp-admin/includes/file.php

Defines 1 class

WP_REST_Font_Faces_Controller:: (22 methods):
  register_routes()
  get_items_permissions_check()
  get_item_permissions_check()
  validate_create_font_face_settings()
  sanitize_font_face_settings()
  get_items()
  get_item()
  create_item()
  delete_item()
  prepare_item_for_response()
  get_item_schema()
  get_public_item_schema()
  get_collection_params()
  get_create_params()
  get_parent_font_family_post()
  prepare_links()
  prepare_item_for_database()
  sanitize_src()
  handle_font_file_upload()
  handle_font_file_upload_error()
  relative_fonts_path()
  get_settings_from_post()


Class: WP_REST_Font_Faces_Controller  - X-Ref

Class to access font faces through the REST API.

register_routes()   X-Ref
Registers the routes for posts.


get_items_permissions_check( $request )   X-Ref
Checks if a given request has access to font faces.

return: true|WP_Error True if the request has read access, WP_Error object otherwise.
param: WP_REST_Request $request Full details about the request.

get_item_permissions_check( $request )   X-Ref
Checks if a given request has access to a font face.

return: true|WP_Error True if the request has read access, WP_Error object otherwise.
param: WP_REST_Request $request Full details about the request.

validate_create_font_face_settings( $value, $request )   X-Ref
Validates settings when creating a font face.

return: true|WP_Error True if the settings are valid, otherwise a WP_Error object.
param: string          $value   Encoded JSON string of font face settings.
param: WP_REST_Request $request Request object.

sanitize_font_face_settings( $value )   X-Ref
Sanitizes the font face settings when creating a font face.

return: array Decoded and sanitized array of font face settings.
param: string $value Encoded JSON string of font face settings.

get_items( $request )   X-Ref
Retrieves a collection of font faces within the parent font family.

return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.

get_item( $request )   X-Ref
Retrieves a single font face within the parent font family.

return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.

create_item( $request )   X-Ref
Creates a font face for the parent font family.

return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.

delete_item( $request )   X-Ref
Deletes a single font face.

return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.

prepare_item_for_response( $item, $request )   X-Ref
Prepares a single font face output for response.

return: WP_REST_Response Response object.
param: WP_Post         $item    Post object.
param: WP_REST_Request $request Request object.

get_item_schema()   X-Ref
Retrieves the post's schema, conforming to JSON Schema.

return: array Item schema data.

get_public_item_schema()   X-Ref
Retrieves the item's schema for display / public consumption purposes.

return: array Public item schema data.

get_collection_params()   X-Ref
Retrieves the query params for the font face collection.

return: array Collection parameters.

get_create_params()   X-Ref
Get the params used when creating a new font face.

return: array Font face create arguments.

get_parent_font_family_post( $font_family_id )   X-Ref
Get the parent font family, if the ID is valid.

return: WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise.
param: int $font_family_id Supplied ID.

prepare_links( $post )   X-Ref
Prepares links for the request.

return: array Links for the given post.
param: WP_Post $post Post object.

prepare_item_for_database( $request )   X-Ref
Prepares a single font face post for creation.

return: stdClass Post object.
param: WP_REST_Request $request Request object.

sanitize_src( $value )   X-Ref
Sanitizes a single src value for a font face.

return: string Sanitized value.
param: string $value Font face src that is a URL or the key for a $_FILES array item.

handle_font_file_upload( $file )   X-Ref
Handles the upload of a font file using wp_handle_upload().

return: array|WP_Error Array containing uploaded file attributes on success, or WP_Error object on failure.
param: array $file Single file item from $_FILES.

handle_font_file_upload_error( $file, $message )   X-Ref
Handles file upload error.

return: WP_Error WP_Error object.
param: array  $file    File upload data.
param: string $message Error message from wp_handle_upload().

relative_fonts_path( $path )   X-Ref
Returns relative path to an uploaded font file.

The path is relative to the current fonts directory.

return: string Relative path on success, unchanged path on failure.
param: string $path Full path to the file.

get_settings_from_post( $post )   X-Ref
Gets the font face's settings from the post.

return: array Font face settings array.
param: WP_Post $post Font face post object.



Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref