ded' are not typically part of the item schema,
* but they can be specified in '_fields', so they are added here as a
* convenience for checking with rest_is_field_included().
*/
$fields[] = '_links';
if ( $request->has_param( '_embed' ) ) {
$fields[] = '_embedded';
}
$fields = array_unique( $fields );
if ( ! isset( $request['_fields'] ) ) {
return $fields;
}
$requested_fields = wp_parse_list( $request['_fields'] );
if ( 0 === count( $requested_fields ) ) {
return $fields;
}
// Trim off outside whitespace from the comma delimited list.
$requested_fields = array_map( 'trim', $requested_fields );
// Always persist 'id', because it can be needed for add_additional_fields_to_object().
if ( in_array( 'id', $fields, true ) ) {
$requested_fields[] = 'id';
}
// Return the list of all requested fields which appear in the schema.
return array_reduce(
$requested_fields,
static function ( $response_fields, $field ) use ( $fields ) {
if ( in_array( $field, $fields, true ) ) {
$response_fields[] = $field;
return $response_fields;
}
// Check for nested fields if $field is not a direct match.
$nested_fields = explode( '.', $field );
/*
* A nested field is included so long as its top-level property
* is present in the schema.
*/
if ( in_array( $nested_fields[0], $fields, true ) ) {
$response_fields[] = $field;
}
return $response_fields;
},
array()
);
}
/**
* Retrieves an array of endpoint arguments from the item schema for the controller.
*
* @since 4.7.0
*
* @param string $method Optional. HTTP method of the request. The arguments for `CREATABLE` requests are
* checked for required values and may fall-back to a given default, this is not done
* on `EDITABLE` requests. Default WP_REST_Server::CREATABLE.
* @return array Endpoint arguments.
*/
public function get_endpoint_args_for_item_schema( $method = WP_REST_Server::CREATABLE ) {
return rest_get_endpoint_args_for_schema( $this->get_item_schema(), $method );
}
/**
* Sanitizes the slug value.
*
* @since 4.7.0
*
* @internal We can't use sanitize_title() directly, as the second
* parameter is the fallback title, which would end up being set to the
* request object.
*
* @see https://github.com/WP-API/WP-API/issues/1585
*
* @todo Remove this in favour of https://core.trac.wordpress.org/ticket/34659
*
* @param string $slug Slug value passed in request.
* @return string Sanitized value for the slug.
*/
public function sanitize_slug( $slug ) {
return sanitize_title( $slug );
}
}
Fatal error: Uncaught Error: Class 'WP_REST_Controller' not found in /var/www/html/helitower.com.br/web/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:17
Stack trace:
#0 /var/www/html/helitower.com.br/web/wp-settings.php(282): require()
#1 /var/www/html/helitower.com.br/web/wp-config.php(99): require_once('/var/www/html/h...')
#2 /var/www/html/helitower.com.br/web/wp-load.php(50): require_once('/var/www/html/h...')
#3 /var/www/html/helitower.com.br/web/wp-blog-header.php(13): require_once('/var/www/html/h...')
#4 /var/www/html/helitower.com.br/web/index.php(18): require('/var/www/html/h...')
#5 {main}
thrown in /var/www/html/helitower.com.br/web/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php on line 17
Fatal error: Uncaught Error: Call to a member function set() on null in /var/www/html/helitower.com.br/web/wp-includes/l10n.php:854
Stack trace:
#0 /var/www/html/helitower.com.br/web/wp-includes/l10n.php(957): load_textdomain('default', '/var/www/html/h...', 'pt_BR')
#1 /var/www/html/helitower.com.br/web/wp-includes/class-wp-fatal-error-handler.php(49): load_default_textdomain()
#2 [internal function]: WP_Fatal_Error_Handler->handle()
#3 {main}
thrown in /var/www/html/helitower.com.br/web/wp-includes/l10n.php on line 854