X7ROOT File Manager
Current Path:
/home/notabjze/pyirates.net/wp-includes/rest-api/endpoints
home
/
notabjze
/
pyirates.net
/
wp-includes
/
rest-api
/
endpoints
/
ðŸ“
..
📄
class-wp-rest-application-passwords-controller.php
(23.59 KB)
📄
class-wp-rest-attachments-controller.php
(46.36 KB)
📄
class-wp-rest-autosaves-controller.php
(14.42 KB)
📄
class-wp-rest-block-directory-controller.php
(9.72 KB)
📄
class-wp-rest-block-pattern-categories-controller.php
(4.55 KB)
📄
class-wp-rest-block-patterns-controller.php
(9.08 KB)
📄
class-wp-rest-block-renderer-controller.php
(5.7 KB)
📄
class-wp-rest-block-types-controller.php
(25.79 KB)
📄
class-wp-rest-blocks-controller.php
(3.1 KB)
📄
class-wp-rest-comments-controller.php
(56.24 KB)
📄
class-wp-rest-controller.php
(18.62 KB)
📄
class-wp-rest-edit-site-export-controller.php
(2.07 KB)
📄
class-wp-rest-font-collections-controller.php
(9.18 KB)
📄
class-wp-rest-font-faces-controller.php
(29.11 KB)
📄
class-wp-rest-font-families-controller.php
(17.1 KB)
📄
class-wp-rest-global-styles-controller.php
(20.45 KB)
📄
class-wp-rest-global-styles-revisions-controller.php
(11.71 KB)
📄
class-wp-rest-menu-items-controller.php
(31.68 KB)
📄
class-wp-rest-menu-locations-controller.php
(8.32 KB)
📄
class-wp-rest-menus-controller.php
(16.44 KB)
📄
class-wp-rest-navigation-fallback-controller.php
(5.05 KB)
📄
class-wp-rest-pattern-directory-controller.php
(12.77 KB)
📄
class-wp-rest-plugins-controller.php
(27.86 KB)
📄
class-wp-rest-post-statuses-controller.php
(10.08 KB)
📄
class-wp-rest-post-types-controller.php
(13.48 KB)
📄
class-wp-rest-posts-controller.php
(95.92 KB)
📄
class-wp-rest-revisions-controller.php
(25.12 KB)
📄
class-wp-rest-search-controller.php
(11.07 KB)
📄
class-wp-rest-settings-controller.php
(10.11 KB)
📄
class-wp-rest-sidebars-controller.php
(15.36 KB)
📄
class-wp-rest-site-health-controller.php
(9.61 KB)
📄
class-wp-rest-taxonomies-controller.php
(13.22 KB)
📄
class-wp-rest-template-autosaves-controller.php
(7.52 KB)
📄
class-wp-rest-template-revisions-controller.php
(8.11 KB)
📄
class-wp-rest-templates-controller.php
(35.45 KB)
📄
class-wp-rest-terms-controller.php
(33.16 KB)
📄
class-wp-rest-themes-controller.php
(20.53 KB)
📄
class-wp-rest-url-details-controller.php
(20.07 KB)
📄
class-wp-rest-users-controller.php
(46.62 KB)
📄
class-wp-rest-widget-types-controller.php
(18.31 KB)
📄
class-wp-rest-widgets-controller.php
(25.86 KB)
Editing: class-wp-rest-block-renderer-controller.php
<?php /** * Block Renderer REST API: WP_REST_Block_Renderer_Controller class * * @package WordPress * @subpackage REST_API * @since 5.0.0 */ /** * Controller which provides REST endpoint for rendering a block. * * @since 5.0.0 * * @see WP_REST_Controller */ class WP_REST_Block_Renderer_Controller extends WP_REST_Controller { /** * Constructs the controller. * * @since 5.0.0 */ public function __construct() { $this->namespace = 'wp/v2'; $this->rest_base = 'block-renderer'; } /** * Registers the necessary REST API routes, one for each dynamic block. * * @since 5.0.0 * * @see register_rest_route() */ public function register_routes() { register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<name>[a-z0-9-]+/[a-z0-9-]+)', array( 'args' => array( 'name' => array( 'description' => __( 'Unique registered name for the block.' ), 'type' => 'string', ), ), array( 'methods' => array( WP_REST_Server::READABLE, WP_REST_Server::CREATABLE ), 'callback' => array( $this, 'get_item' ), 'permission_callback' => array( $this, 'get_item_permissions_check' ), 'args' => array( 'context' => $this->get_context_param( array( 'default' => 'view' ) ), 'attributes' => array( 'description' => __( 'Attributes for the block.' ), 'type' => 'object', 'default' => array(), 'validate_callback' => static function ( $value, $request ) { $block = WP_Block_Type_Registry::get_instance()->get_registered( $request['name'] ); if ( ! $block ) { // This will get rejected in ::get_item(). return true; } $schema = array( 'type' => 'object', 'properties' => $block->get_attributes(), 'additionalProperties' => false, ); return rest_validate_value_from_schema( $value, $schema ); }, 'sanitize_callback' => static function ( $value, $request ) { $block = WP_Block_Type_Registry::get_instance()->get_registered( $request['name'] ); if ( ! $block ) { // This will get rejected in ::get_item(). return true; } $schema = array( 'type' => 'object', 'properties' => $block->get_attributes(), 'additionalProperties' => false, ); return rest_sanitize_value_from_schema( $value, $schema ); }, ), 'post_id' => array( 'description' => __( 'ID of the post context.' ), 'type' => 'integer', ), ), ), 'schema' => array( $this, 'get_public_item_schema' ), ) ); } /** * Checks if a given request has access to read blocks. * * @since 5.0.0 * * @global WP_Post $post Global post object. * * @param WP_REST_Request $request Request. * @return true|WP_Error True if the request has read access, WP_Error object otherwise. */ public function get_item_permissions_check( $request ) { global $post; $post_id = isset( $request['post_id'] ) ? (int) $request['post_id'] : 0; if ( $post_id > 0 ) { $post = get_post( $post_id ); if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) { return new WP_Error( 'block_cannot_read', __( 'Sorry, you are not allowed to read blocks of this post.' ), array( 'status' => rest_authorization_required_code(), ) ); } } else { if ( ! current_user_can( 'edit_posts' ) ) { return new WP_Error( 'block_cannot_read', __( 'Sorry, you are not allowed to read blocks as this user.' ), array( 'status' => rest_authorization_required_code(), ) ); } } return true; } /** * Returns block output from block's registered render_callback. * * @since 5.0.0 * * @global WP_Post $post Global post object. * * @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. */ public function get_item( $request ) { global $post; $post_id = isset( $request['post_id'] ) ? (int) $request['post_id'] : 0; if ( $post_id > 0 ) { $post = get_post( $post_id ); // Set up postdata since this will be needed if post_id was set. setup_postdata( $post ); } $registry = WP_Block_Type_Registry::get_instance(); $registered = $registry->get_registered( $request['name'] ); if ( null === $registered || ! $registered->is_dynamic() ) { return new WP_Error( 'block_invalid', __( 'Invalid block.' ), array( 'status' => 404, ) ); } $attributes = $request->get_param( 'attributes' ); // Create an array representation simulating the output of parse_blocks. $block = array( 'blockName' => $request['name'], 'attrs' => $attributes, 'innerHTML' => '', 'innerContent' => array(), ); // Render using render_block to ensure all relevant filters are used. $data = array( 'rendered' => render_block( $block ), ); return rest_ensure_response( $data ); } /** * Retrieves block's output schema, conforming to JSON Schema. * * @since 5.0.0 * * @return array Item schema data. */ public function get_item_schema() { if ( $this->schema ) { return $this->schema; } $this->schema = array( '$schema' => 'http://json-schema.org/schema#', 'title' => 'rendered-block', 'type' => 'object', 'properties' => array( 'rendered' => array( 'description' => __( 'The rendered block.' ), 'type' => 'string', 'required' => true, 'context' => array( 'edit' ), ), ), ); return $this->schema; } }
Upload File
Create Folder