REST API: Update “resource” strings to use the appropriate nouns.

Props ramiy.
Fixes #38811.

git-svn-id: https://develop.svn.wordpress.org/trunk@39342 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe Hoyle
2016-11-23 02:42:00 +00:00
parent d6d843dccd
commit 2341473a5f
9 changed files with 115 additions and 115 deletions
@@ -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',
);