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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

param: WP_Post         $item    Post object.
param: WP_REST_Request $request Request object.
return: WP_REST_Response Response 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.

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

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

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

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

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

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

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

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

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

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

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

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

The path is relative to the current fonts directory.

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

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

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



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref