From d711f2c18d570d0f5f8bc122e4eeb1b11816c147 Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Wed, 23 Nov 2016 02:42:30 +0000 Subject: [PATCH] =?UTF-8?q?REST=20API:=20Update=20=E2=80=9Cresource?= =?UTF-8?q?=E2=80=9D=20strings=20to=20use=20the=20appropriate=20nouns.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Props ramiy. Fixes #38811. Built from https://develop.svn.wordpress.org/trunk@39342 git-svn-id: http://core.svn.wordpress.org/trunk@39282 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../class-wp-rest-attachments-controller.php | 22 +++--- .../class-wp-rest-comments-controller.php | 8 +- ...class-wp-rest-post-statuses-controller.php | 18 ++--- .../class-wp-rest-post-types-controller.php | 20 ++--- .../class-wp-rest-posts-controller.php | 6 +- .../class-wp-rest-revisions-controller.php | 6 +- .../class-wp-rest-taxonomies-controller.php | 20 ++--- .../class-wp-rest-terms-controller.php | 52 ++++++------- .../class-wp-rest-users-controller.php | 78 +++++++++---------- wp-includes/version.php | 2 +- 10 files changed, 116 insertions(+), 116 deletions(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php index ea89a94585..a90d32293b 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php @@ -76,7 +76,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { $post_parent_type = get_post_type_object( $parent->post_type ); if ( ! current_user_can( $post_parent_type->cap->edit_post, $request['post'] ) ) { - return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to upload media to this resource.' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to upload media to this post.' ), array( 'status' => rest_authorization_required_code() ) ); } } @@ -378,7 +378,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { $schema = parent::get_item_schema(); $schema['properties']['alt_text'] = array( - 'description' => __( 'Alternative text to display when resource is not displayed.' ), + 'description' => __( 'Alternative text to display when attachment is not displayed.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'arg_options' => array( @@ -387,7 +387,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { ); $schema['properties']['caption'] = array( - 'description' => __( 'The caption for the resource.' ), + 'description' => __( 'The attachment caption.' ), 'type' => 'object', 'context' => array( 'view', 'edit', 'embed' ), 'arg_options' => array( @@ -395,12 +395,12 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { ), 'properties' => array( 'raw' => array( - 'description' => __( 'Caption for the resource, as it exists in the database.' ), + 'description' => __( 'Caption for the attachment, as it exists in the database.' ), 'type' => 'string', 'context' => array( 'edit' ), ), 'rendered' => array( - 'description' => __( 'HTML caption for the resource, transformed for display.' ), + 'description' => __( 'HTML caption for the attachment, transformed for display.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, @@ -409,7 +409,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { ); $schema['properties']['description'] = array( - 'description' => __( 'The description for the resource.' ), + 'description' => __( 'The attachment description.' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -431,7 +431,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { ); $schema['properties']['media_type'] = array( - 'description' => __( 'Type of resource.' ), + 'description' => __( 'Attachment type.' ), 'type' => 'string', 'enum' => array( 'image', 'file' ), 'context' => array( 'view', 'edit', 'embed' ), @@ -439,27 +439,27 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { ); $schema['properties']['mime_type'] = array( - 'description' => __( 'MIME type of resource.' ), + 'description' => __( 'The attachment MIME type.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ); $schema['properties']['media_details'] = array( - 'description' => __( 'Details about the resource file, specific to its type.' ), + 'description' => __( 'Details about the media file, specific to its type.' ), 'type' => 'object', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ); $schema['properties']['post'] = array( - 'description' => __( 'The ID for the associated post of the resource.' ), + 'description' => __( 'The ID for the associated post of the attachment.' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ); $schema['properties']['source_url'] = array( - 'description' => __( 'URL to the original resource file.' ), + 'description' => __( 'URL to the original attachment file.' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit', 'embed' ), diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php index 17ceec370f..a552df78dd 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php @@ -1287,7 +1287,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller { $query_params['context']['default'] = 'view'; $query_params['after'] = array( - 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.' ), + 'description' => __( 'Limit response to comments published after a given ISO8601 compliant date.' ), 'type' => 'string', 'format' => 'date-time', ); @@ -1316,7 +1316,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller { ); $query_params['before'] = array( - 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.' ), + 'description' => __( 'Limit response to comments published before a given ISO8601 compliant date.' ), 'type' => 'string', 'format' => 'date-time', ); @@ -1371,7 +1371,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller { $query_params['parent'] = array( 'default' => array(), - 'description' => __( 'Limit result set to resources of specific parent IDs.' ), + 'description' => __( 'Limit result set to comments of specific parent IDs.' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -1389,7 +1389,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller { $query_params['post'] = array( 'default' => array(), - 'description' => __( 'Limit result set to resources assigned to specific post IDs.' ), + 'description' => __( 'Limit result set to comments assigned to specific post IDs.' ), 'type' => 'array', 'items' => array( 'type' => 'integer', diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php index 918a29b6e8..0ec4bcd1a1 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php @@ -125,13 +125,13 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller { $status = get_post_status_object( $request['status'] ); if ( empty( $status ) ) { - return new WP_Error( 'rest_status_invalid', __( 'Invalid resource.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_status_invalid', __( 'Invalid status.' ), array( 'status' => 404 ) ); } $check = $this->check_read_permission( $status ); if ( ! $check ) { - return new WP_Error( 'rest_cannot_read_status', __( 'Cannot view resource.' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_cannot_read_status', __( 'Cannot view status.' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -177,7 +177,7 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller { $obj = get_post_status_object( $request['status'] ); if ( empty( $obj ) ) { - return new WP_Error( 'rest_status_invalid', __( 'Invalid resource.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_status_invalid', __( 'Invalid status.' ), array( 'status' => 404 ) ); } $data = $this->prepare_item_for_response( $obj, $request ); @@ -248,31 +248,31 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller { 'type' => 'object', 'properties' => array( 'name' => array( - 'description' => __( 'The title for the resource.' ), + 'description' => __( 'The title for the status.' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), 'private' => array( - 'description' => __( 'Whether posts with this resource should be private.' ), + 'description' => __( 'Whether posts with this status should be private.' ), 'type' => 'boolean', 'context' => array( 'edit' ), 'readonly' => true, ), 'protected' => array( - 'description' => __( 'Whether posts with this resource should be protected.' ), + 'description' => __( 'Whether posts with this status should be protected.' ), 'type' => 'boolean', 'context' => array( 'edit' ), 'readonly' => true, ), 'public' => array( - 'description' => __( 'Whether posts of this resource should be shown in the front end of the site.' ), + 'description' => __( 'Whether posts of this status should be shown in the front end of the site.' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'queryable' => array( - 'description' => __( 'Whether posts with this resource should be publicly-queryable.' ), + 'description' => __( 'Whether posts with this status should be publicly-queryable.' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -284,7 +284,7 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller { 'readonly' => true, ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource.' ), + 'description' => __( 'An alphanumeric identifier for the status.' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php index 7a6e5312c4..a1437dd597 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php @@ -119,11 +119,11 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller { $obj = get_post_type_object( $request['type'] ); if ( empty( $obj ) ) { - return new WP_Error( 'rest_type_invalid', __( 'Invalid resource.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_type_invalid', __( 'Invalid post type.' ), array( 'status' => 404 ) ); } if ( empty( $obj->show_in_rest ) ) { - return new WP_Error( 'rest_cannot_read_type', __( 'Cannot view resource.' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_cannot_read_type', __( 'Cannot view post type.' ), array( 'status' => rest_authorization_required_code() ) ); } if ( 'edit' === $request['context'] && ! current_user_can( $obj->cap->edit_posts ) ) { @@ -204,43 +204,43 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller { 'type' => 'object', 'properties' => array( 'capabilities' => array( - 'description' => __( 'All capabilities used by the resource.' ), + 'description' => __( 'All capabilities used by the post type.' ), 'type' => 'object', 'context' => array( 'edit' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human-readable description of the resource.' ), + 'description' => __( 'A human-readable description of the post type.' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'hierarchical' => array( - 'description' => __( 'Whether or not the resource should have children.' ), + 'description' => __( 'Whether or not the post type should have children.' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'labels' => array( - 'description' => __( 'Human-readable labels for the resource for various contexts.' ), + 'description' => __( 'Human-readable labels for the post type for various contexts.' ), 'type' => 'object', 'context' => array( 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'The title for the resource.' ), + 'description' => __( 'The title for the post type.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource.' ), + 'description' => __( 'An alphanumeric identifier for the post type.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), 'taxonomies' => array( - 'description' => __( 'Taxonomies associated with resource.' ), + 'description' => __( 'Taxonomies associated with post type.' ), 'type' => 'array', 'items' => array( 'type' => 'string', @@ -249,7 +249,7 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller { 'readonly' => true, ), 'rest_base' => array( - 'description' => __( 'REST base route for the resource.' ), + 'description' => __( 'REST base route for the post type.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php index ba241c94fa..ac463e6313 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php @@ -1963,7 +1963,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { $params['context']['default'] = 'view'; $params['after'] = array( - 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.' ), + 'description' => __( 'Limit response to posts published after a given ISO8601 compliant date.' ), 'type' => 'string', 'format' => 'date-time', ); @@ -1988,7 +1988,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { } $params['before'] = array( - 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.' ), + 'description' => __( 'Limit response to posts published before a given ISO8601 compliant date.' ), 'type' => 'string', 'format' => 'date-time', ); @@ -2013,7 +2013,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { if ( 'page' === $this->post_type || post_type_supports( $this->post_type, 'page-attributes' ) ) { $params['menu_order'] = array( - 'description' => __( 'Limit result set to resources with a specific menu_order value.' ), + 'description' => __( 'Limit result set to posts with a specific menu_order value.' ), 'type' => 'integer', ); } diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php index 907ba054b1..3b45d9f987 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php @@ -11,7 +11,7 @@ * Core class used to access revisions via the REST API. * * @since 4.7.0 - * + *0 * @see WP_REST_Controller */ class WP_REST_Revisions_Controller extends WP_REST_Controller { @@ -97,7 +97,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller { 'force' => array( 'type' => 'boolean', 'default' => false, - 'description' => __( 'Required to be true, as resource does not support trashing.' ), + 'description' => __( 'Required to be true, as revisions do not support trashing.' ), ), ), ), @@ -227,7 +227,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller { public function delete_item( $request ) { $force = isset( $request['force'] ) ? (bool) $request['force'] : false; - // We don't support trashing for this resource type. + // We don't support trashing for revisions. if ( ! $force ) { return new WP_Error( 'rest_trash_not_supported', __( 'Revisions do not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) ); } diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php index 8672c5e050..0fe91ee432 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php @@ -160,7 +160,7 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller { public function get_item( $request ) { $tax_obj = get_taxonomy( $request['taxonomy'] ); if ( empty( $tax_obj ) ) { - return new WP_Error( 'rest_taxonomy_invalid', __( 'Invalid resource.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_taxonomy_invalid', __( 'Invalid taxonomy.' ), array( 'status' => 404 ) ); } $data = $this->prepare_item_for_response( $tax_obj, $request ); return rest_ensure_response( $data ); @@ -235,37 +235,37 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller { 'type' => 'object', 'properties' => array( 'capabilities' => array( - 'description' => __( 'All capabilities used by the resource.' ), + 'description' => __( 'All capabilities used by the taxonomy.' ), 'type' => 'object', 'context' => array( 'edit' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human-readable description of the resource.' ), + 'description' => __( 'A human-readable description of the taxonomy.' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'hierarchical' => array( - 'description' => __( 'Whether or not the resource should have children.' ), + 'description' => __( 'Whether or not the taxonomy should have children.' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'labels' => array( - 'description' => __( 'Human-readable labels for the resource for various contexts.' ), + 'description' => __( 'Human-readable labels for the taxonomy for various contexts.' ), 'type' => 'object', 'context' => array( 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'The title for the resource.' ), + 'description' => __( 'The title for the taxonomy.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource.' ), + 'description' => __( 'An alphanumeric identifier for the taxonomy.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, @@ -277,7 +277,7 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller { 'readonly' => true, ), 'types' => array( - 'description' => __( 'Types associated with resource.' ), + 'description' => __( 'Types associated with the taxonomy.' ), 'type' => 'array', 'items' => array( 'type' => 'string', @@ -286,7 +286,7 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller { 'readonly' => true, ), 'rest_base' => array( - 'description' => __( 'REST base route for the resource.' ), + 'description' => __( 'REST base route for the taxonomy.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, @@ -308,7 +308,7 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller { $new_params = array(); $new_params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $new_params['type'] = array( - 'description' => __( 'Limit results to resources associated with a specific post type.' ), + 'description' => __( 'Limit results to taxonomies associated with a specific post type.' ), 'type' => 'string', ); return $new_params; diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php index 1af5138b73..c758d60241 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php @@ -118,7 +118,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { 'force' => array( 'type' => 'boolean', 'default' => false, - 'description' => __( 'Required to be true, as resource does not support trashing.' ), + 'description' => __( 'Required to be true, as terms do not support trashing.' ), ), ), ), @@ -321,7 +321,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { $term = get_term( (int) $request['id'], $this->taxonomy ); if ( ! $term || $term->taxonomy !== $this->taxonomy ) { - return new WP_Error( 'rest_term_invalid', __( "Resource doesn't exist." ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_term_invalid', __( "Term doesn't exist." ), array( 'status' => 404 ) ); } if ( is_wp_error( $term ) ) { @@ -350,7 +350,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { $taxonomy_obj = get_taxonomy( $this->taxonomy ); if ( ! current_user_can( $taxonomy_obj->cap->manage_terms ) ) { - return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create new resource.' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create new terms.' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -368,13 +368,13 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { public function create_item( $request ) { if ( isset( $request['parent'] ) ) { if ( ! is_taxonomy_hierarchical( $this->taxonomy ) ) { - return new WP_Error( 'rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_taxonomy_not_hierarchical', __( 'Can not set parent term, taxonomy is not hierarchical.' ), array( 'status' => 400 ) ); } $parent = get_term( (int) $request['parent'], $this->taxonomy ); if ( ! $parent ) { - return new WP_Error( 'rest_term_invalid', __( "Parent resource doesn't exist." ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_term_invalid', __( "Parent term doesn't exist." ), array( 'status' => 400 ) ); } } @@ -453,11 +453,11 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { $term = get_term( (int) $request['id'], $this->taxonomy ); if ( ! $term ) { - return new WP_Error( 'rest_term_invalid', __( "Resource doesn't exist." ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_term_invalid', __( "Term doesn't exist." ), array( 'status' => 404 ) ); } if ( ! current_user_can( 'edit_term', $term->term_id ) ) { - return new WP_Error( 'rest_cannot_update', __( 'Sorry, you are not allowed to update resource.' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_cannot_update', __( 'Sorry, you are not allowed to edit terms.' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -475,13 +475,13 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { public function update_item( $request ) { if ( isset( $request['parent'] ) ) { if ( ! is_taxonomy_hierarchical( $this->taxonomy ) ) { - return new WP_Error( 'rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_taxonomy_not_hierarchical', __( 'Can not set parent term, taxonomy is not hierarchical.' ), array( 'status' => 400 ) ); } $parent = get_term( (int) $request['parent'], $this->taxonomy ); if ( ! $parent ) { - return new WP_Error( 'rest_term_invalid', __( "Parent resource doesn't exist." ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_term_invalid', __( "Parent term doesn't exist." ), array( 'status' => 400 ) ); } } @@ -542,11 +542,11 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { $term = get_term( (int) $request['id'], $this->taxonomy ); if ( ! $term ) { - return new WP_Error( 'rest_term_invalid', __( "Resource doesn't exist." ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_term_invalid', __( "Term doesn't exist." ), array( 'status' => 404 ) ); } if ( ! current_user_can( 'delete_term', $term->term_id ) ) { - return new WP_Error( 'rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_cannot_delete', __( 'Sorry, you are not allowed to delete this term.' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -565,7 +565,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { $force = isset( $request['force'] ) ? (bool) $request['force'] : false; - // We don't support trashing for this resource type. + // We don't support trashing for terms. if ( ! $force ) { return new WP_Error( 'rest_trash_not_supported', __( 'Terms do not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) ); } @@ -579,7 +579,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { $retval = wp_delete_term( $term->term_id, $term->taxonomy ); if ( ! $retval ) { - return new WP_Error( 'rest_cannot_delete', __( 'The resource cannot be deleted.' ), array( 'status' => 500 ) ); + return new WP_Error( 'rest_cannot_delete', __( 'The term cannot be deleted.' ), array( 'status' => 500 ) ); } $response = new WP_REST_Response(); @@ -806,31 +806,31 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.' ), + 'description' => __( 'Unique identifier for the term.' ), 'type' => 'integer', 'context' => array( 'view', 'embed', 'edit' ), 'readonly' => true, ), 'count' => array( - 'description' => __( 'Number of published posts for the resource.' ), + 'description' => __( 'Number of published posts for the term.' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'HTML description of the resource.' ), + 'description' => __( 'HTML description of the term.' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'link' => array( - 'description' => __( 'URL of the resource.' ), + 'description' => __( 'URL of the term.' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'embed', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'HTML title for the resource.' ), + 'description' => __( 'HTML title for the term.' ), 'type' => 'string', 'context' => array( 'view', 'embed', 'edit' ), 'arg_options' => array( @@ -839,7 +839,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { 'required' => true, ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource unique to its type.' ), + 'description' => __( 'An alphanumeric identifier for the term unique to its type.' ), 'type' => 'string', 'context' => array( 'view', 'embed', 'edit' ), 'arg_options' => array( @@ -847,7 +847,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { ), ), 'taxonomy' => array( - 'description' => __( 'Type attribution for the resource.' ), + 'description' => __( 'Type attribution for the term.' ), 'type' => 'string', 'enum' => array_keys( get_taxonomies() ), 'context' => array( 'view', 'embed', 'edit' ), @@ -860,7 +860,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { if ( $taxonomy->hierarchical ) { $schema['properties']['parent'] = array( - 'description' => __( 'The ID for the parent of the resource.' ), + 'description' => __( 'The parent term ID.' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ); @@ -921,7 +921,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { ); $query_params['orderby'] = array( - 'description' => __( 'Sort collection by resource attribute.' ), + 'description' => __( 'Sort collection by term attribute.' ), 'type' => 'string', 'default' => 'name', 'enum' => array( @@ -936,26 +936,26 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { ); $query_params['hide_empty'] = array( - 'description' => __( 'Whether to hide resources not assigned to any posts.' ), + 'description' => __( 'Whether to hide terms not assigned to any posts.' ), 'type' => 'boolean', 'default' => false, ); if ( $taxonomy->hierarchical ) { $query_params['parent'] = array( - 'description' => __( 'Limit result set to resources assigned to a specific parent.' ), + 'description' => __( 'Limit result set to terms assigned to a specific parent.' ), 'type' => 'integer', ); } $query_params['post'] = array( - 'description' => __( 'Limit result set to resources assigned to a specific post.' ), + 'description' => __( 'Limit result set to terms assigned to a specific post.' ), 'type' => 'integer', 'default' => null, ); $query_params['slug'] = array( - 'description' => __( 'Limit result set to resources with a specific slug.' ), + 'description' => __( 'Limit result set to terms with a specific slug.' ), 'type' => 'string', ); diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php index e0da1c07ca..c61228ed57 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php @@ -87,7 +87,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { 'force' => array( 'type' => 'boolean', 'default' => false, - 'description' => __( 'Required to be true, as resource does not support trashing.' ), + 'description' => __( 'Required to be true, as users do not support trashing.' ), ), 'reassign' => array( 'type' => 'integer', @@ -120,7 +120,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { 'force' => array( 'type' => 'boolean', 'default' => false, - 'description' => __( 'Required to be true, as resource does not support trashing.' ), + 'description' => __( 'Required to be true, as users do not support trashing.' ), ), 'reassign' => array( 'type' => 'integer', @@ -144,7 +144,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { public function get_items_permissions_check( $request ) { // Check if roles is specified in GET request and if user can list users. if ( ! empty( $request['roles'] ) && ! current_user_can( 'list_users' ) ) { - return new WP_Error( 'rest_user_cannot_view', __( 'Sorry, you are not allowed to filter by role.' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_user_cannot_view', __( 'Sorry, you are not allowed to filter users by role.' ), array( 'status' => rest_authorization_required_code() ) ); } if ( 'edit' === $request['context'] && ! current_user_can( 'list_users' ) ) { @@ -152,7 +152,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { } if ( in_array( $request['orderby'], array( 'email', 'registered_date' ), true ) && ! current_user_can( 'list_users' ) ) { - return new WP_Error( 'rest_forbidden_orderby', __( 'Sorry, you are not allowed to order by this parameter.' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_forbidden_orderby', __( 'Sorry, you are not allowed to order users by this parameter.' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -312,7 +312,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { $types = get_post_types( array( 'show_in_rest' => true ), 'names' ); if ( empty( $id ) || empty( $user->ID ) ) { - return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource ID.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_user_invalid_id', __( 'Invalid user ID.' ), array( 'status' => 404 ) ); } if ( get_current_user_id() === $id ) { @@ -342,7 +342,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { $user = get_userdata( $id ); if ( empty( $id ) || empty( $user->ID ) ) { - return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource ID.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_user_invalid_id', __( 'Invalid user ID.' ), array( 'status' => 404 ) ); } $user = $this->prepare_item_for_response( $user, $request ); @@ -387,7 +387,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { public function create_item_permissions_check( $request ) { if ( ! current_user_can( 'create_users' ) ) { - return new WP_Error( 'rest_cannot_create_user', __( 'Sorry, you are not allowed to create new resource.' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_cannot_create_user', __( 'Sorry, you are not allowed to create new users.' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -404,7 +404,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { */ public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { - return new WP_Error( 'rest_user_exists', __( 'Cannot create existing resource.' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_user_exists', __( 'Cannot create existing user.' ), array( 'status' => 400 ) ); } $schema = $this->get_item_schema(); @@ -440,7 +440,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { $user_id = wpmu_create_user( $user->user_login, $user->user_pass, $user->user_email ); if ( ! $user_id ) { - return new WP_Error( 'rest_user_create', __( 'Error creating new resource.' ), array( 'status' => 500 ) ); + return new WP_Error( 'rest_user_create', __( 'Error creating new user.' ), array( 'status' => 500 ) ); } $user->ID = $user_id; @@ -515,11 +515,11 @@ class WP_REST_Users_Controller extends WP_REST_Controller { $id = (int) $request['id']; if ( ! current_user_can( 'edit_user', $id ) ) { - return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to edit this user.' ), array( 'status' => rest_authorization_required_code() ) ); } if ( ! empty( $request['roles'] ) && ! current_user_can( 'edit_users' ) ) { - return new WP_Error( 'rest_cannot_edit_roles', __( 'Sorry, you are not allowed to edit roles of this resource.' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_cannot_edit_roles', __( 'Sorry, you are not allowed to edit roles of this user.' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -539,7 +539,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { $user = get_userdata( $id ); if ( ! $user ) { - return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource ID.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_user_invalid_id', __( 'Invalid user ID.' ), array( 'status' => 404 ) ); } if ( email_exists( $request['email'] ) && $request['email'] !== $user->user_email ) { @@ -654,7 +654,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { $id = (int) $request['id']; if ( ! current_user_can( 'delete_user', $id ) ) { - return new WP_Error( 'rest_user_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_user_cannot_delete', __( 'Sorry, you are not allowed to delete this user.' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -674,7 +674,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { $reassign = isset( $request['reassign'] ) ? absint( $request['reassign'] ) : null; $force = isset( $request['force'] ) ? (bool) $request['force'] : false; - // We don't support trashing for this type, error out. + // We don't support trashing for users. if ( ! $force ) { return new WP_Error( 'rest_trash_not_supported', __( 'Users do not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) ); } @@ -682,12 +682,12 @@ class WP_REST_Users_Controller extends WP_REST_Controller { $user = get_userdata( $id ); if ( ! $user ) { - return new WP_Error( 'rest_user_invalid_id', __( 'Invalid resource ID.' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_user_invalid_id', __( 'Invalid user ID.' ), array( 'status' => 404 ) ); } if ( ! empty( $reassign ) ) { if ( $reassign === $id || ! get_userdata( $reassign ) ) { - return new WP_Error( 'rest_user_invalid_reassign', __( 'Invalid resource ID for reassignment.' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_user_invalid_reassign', __( 'Invalid user ID for reassignment.' ), array( 'status' => 400 ) ); } } @@ -701,7 +701,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { $result = wp_delete_user( $id, $reassign ); if ( ! $result ) { - return new WP_Error( 'rest_cannot_delete', __( 'The resource cannot be deleted.' ), array( 'status' => 500 ) ); + return new WP_Error( 'rest_cannot_delete', __( 'The user cannot be deleted.' ), array( 'status' => 500 ) ); } $response = new WP_REST_Response(); @@ -995,7 +995,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { && get_current_user_id() === $user_id && ! $potential_role->has_cap( 'edit_users' ) ) { - return new WP_Error( 'rest_user_invalid_role', __( 'Sorry, you are not allowed to give resource that role.' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_user_invalid_role', __( 'Sorry, you are not allowed to give users that role.' ), array( 'status' => rest_authorization_required_code() ) ); } /** Include admin functions to get access to get_editable_roles() */ @@ -1005,7 +1005,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { $editable_roles = get_editable_roles(); if ( empty( $editable_roles[ $role ] ) ) { - return new WP_Error( 'rest_user_invalid_role', __( 'Sorry, you are not allowed to give resource that role.' ), array( 'status' => 403 ) ); + return new WP_Error( 'rest_user_invalid_role', __( 'Sorry, you are not allowed to give users that role.' ), array( 'status' => 403 ) ); } } @@ -1082,13 +1082,13 @@ class WP_REST_Users_Controller extends WP_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.' ), + 'description' => __( 'Unique identifier for the user.' ), 'type' => 'integer', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), 'username' => array( - 'description' => __( 'Login name for the resource.' ), + 'description' => __( 'Login name for the user.' ), 'type' => 'string', 'context' => array( 'edit' ), 'required' => true, @@ -1097,7 +1097,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { ), ), 'name' => array( - 'description' => __( 'Display name for the resource.' ), + 'description' => __( 'Display name for the user.' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), 'arg_options' => array( @@ -1105,7 +1105,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { ), ), 'first_name' => array( - 'description' => __( 'First name for the resource.' ), + 'description' => __( 'First name for the user.' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( @@ -1113,7 +1113,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { ), ), 'last_name' => array( - 'description' => __( 'Last name for the resource.' ), + 'description' => __( 'Last name for the user.' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( @@ -1121,38 +1121,38 @@ class WP_REST_Users_Controller extends WP_REST_Controller { ), ), 'email' => array( - 'description' => __( 'The email address for the resource.' ), + 'description' => __( 'The email address for the user.' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'edit' ), 'required' => true, ), 'url' => array( - 'description' => __( 'URL of the resource.' ), + 'description' => __( 'URL of the user.' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'embed', 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'Description of the resource.' ), + 'description' => __( 'Description of the user.' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), ), 'link' => array( - 'description' => __( 'Author URL of the resource.' ), + 'description' => __( 'Author URL of the user.' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), 'locale' => array( - 'description' => __( 'Locale for the resource.' ), + 'description' => __( 'Locale for the user.' ), 'type' => 'string', 'enum' => array_merge( array( '', 'en_US' ), get_available_languages() ), 'context' => array( 'edit' ), ), 'nickname' => array( - 'description' => __( 'The nickname for the resource.' ), + 'description' => __( 'The nickname for the user.' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( @@ -1160,7 +1160,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { ), ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource.' ), + 'description' => __( 'An alphanumeric identifier for the user.' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), 'arg_options' => array( @@ -1168,14 +1168,14 @@ class WP_REST_Users_Controller extends WP_REST_Controller { ), ), 'registered_date' => array( - 'description' => __( 'Registration date for the resource.' ), + 'description' => __( 'Registration date for the user.' ), 'type' => 'string', 'format' => 'date-time', 'context' => array( 'edit' ), 'readonly' => true, ), 'roles' => array( - 'description' => __( 'Roles assigned to the resource.' ), + 'description' => __( 'Roles assigned to the user.' ), 'type' => 'array', 'items' => array( 'type' => 'string', @@ -1183,7 +1183,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { 'context' => array( 'edit' ), ), 'password' => array( - 'description' => __( 'Password for the resource (never included).' ), + 'description' => __( 'Password for the user (never included).' ), 'type' => 'string', 'context' => array(), // Password is never displayed. 'required' => true, @@ -1192,13 +1192,13 @@ class WP_REST_Users_Controller extends WP_REST_Controller { ), ), 'capabilities' => array( - 'description' => __( 'All capabilities assigned to the resource.' ), + 'description' => __( 'All capabilities assigned to the user.' ), 'type' => 'object', 'context' => array( 'edit' ), 'readonly' => true, ), 'extra_capabilities' => array( - 'description' => __( 'Any extra capabilities assigned to the resource.' ), + 'description' => __( 'Any extra capabilities assigned to the user.' ), 'type' => 'object', 'context' => array( 'edit' ), 'readonly' => true, @@ -1222,7 +1222,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { } $schema['properties']['avatar_urls'] = array( - 'description' => __( 'Avatar URLs for the resource.' ), + 'description' => __( 'Avatar URLs for the user.' ), 'type' => 'object', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, @@ -1294,12 +1294,12 @@ class WP_REST_Users_Controller extends WP_REST_Controller { ); $query_params['slug'] = array( - 'description' => __( 'Limit result set to resources with a specific slug.' ), + 'description' => __( 'Limit result set to users with a specific slug.' ), 'type' => 'string', ); $query_params['roles'] = array( - 'description' => __( 'Limit result set to resources matching at least one specific role provided. Accepts csv list or single role.' ), + 'description' => __( 'Limit result set to users matching at least one specific role provided. Accepts csv list or single role.' ), 'type' => 'array', 'items' => array( 'type' => 'string', diff --git a/wp-includes/version.php b/wp-includes/version.php index 51cf0c6a0c..0e4604c25b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-beta4-39341'; +$wp_version = '4.7-beta4-39342'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.