Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

Commit e0fdc5f

Browse files
authored
Merge pull request #2812 from Soean/patch-1
Missing full-stop in error message
2 parents 9cdd01e + 40afddd commit e0fdc5f

5 files changed

Lines changed: 15 additions & 15 deletions

lib/endpoints/class-wp-rest-attachments-controller.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -371,15 +371,15 @@ public function get_item_schema() {
371371
*/
372372
protected function upload_from_data( $data, $headers ) {
373373
if ( empty( $data ) ) {
374-
return new WP_Error( 'rest_upload_no_data', __( 'No data supplied' ), array( 'status' => 400 ) );
374+
return new WP_Error( 'rest_upload_no_data', __( 'No data supplied.' ), array( 'status' => 400 ) );
375375
}
376376

377377
if ( empty( $headers['content_type'] ) ) {
378-
return new WP_Error( 'rest_upload_no_content_type', __( 'No Content-Type supplied' ), array( 'status' => 400 ) );
378+
return new WP_Error( 'rest_upload_no_content_type', __( 'No Content-Type supplied.' ), array( 'status' => 400 ) );
379379
}
380380

381381
if ( empty( $headers['content_disposition'] ) ) {
382-
return new WP_Error( 'rest_upload_no_content_disposition', __( 'No Content-Disposition supplied' ), array( 'status' => 400 ) );
382+
return new WP_Error( 'rest_upload_no_content_disposition', __( 'No Content-Disposition supplied.' ), array( 'status' => 400 ) );
383383
}
384384

385385
$filename = $this->get_filename_from_disposition( $headers['content_disposition'] );
@@ -394,7 +394,7 @@ protected function upload_from_data( $data, $headers ) {
394394
$actual = md5( $data );
395395

396396
if ( $expected !== $actual ) {
397-
return new WP_Error( 'rest_upload_hash_mismatch', __( 'Content hash did not match expected' ), array( 'status' => 412 ) );
397+
return new WP_Error( 'rest_upload_hash_mismatch', __( 'Content hash did not match expected.' ), array( 'status' => 412 ) );
398398
}
399399
}
400400

@@ -410,7 +410,7 @@ protected function upload_from_data( $data, $headers ) {
410410
$fp = fopen( $tmpfname, 'w+' );
411411

412412
if ( ! $fp ) {
413-
return new WP_Error( 'rest_upload_file_error', __( 'Could not open file handle' ), array( 'status' => 500 ) );
413+
return new WP_Error( 'rest_upload_file_error', __( 'Could not open file handle.' ), array( 'status' => 500 ) );
414414
}
415415

416416
fwrite( $fp, $data );
@@ -552,7 +552,7 @@ public function validate_user_can_query_private_statuses( $value, $request, $par
552552
*/
553553
protected function upload_from_file( $files, $headers ) {
554554
if ( empty( $files ) ) {
555-
return new WP_Error( 'rest_upload_no_data', __( 'No data supplied' ), array( 'status' => 400 ) );
555+
return new WP_Error( 'rest_upload_no_data', __( 'No data supplied.' ), array( 'status' => 400 ) );
556556
}
557557

558558
// Verify hash, if given
@@ -561,7 +561,7 @@ protected function upload_from_file( $files, $headers ) {
561561
$expected = trim( $content_md5 );
562562
$actual = md5_file( $files['file']['tmp_name'] );
563563
if ( $expected !== $actual ) {
564-
return new WP_Error( 'rest_upload_hash_mismatch', __( 'Content hash did not match expected' ), array( 'status' => 412 ) );
564+
return new WP_Error( 'rest_upload_hash_mismatch', __( 'Content hash did not match expected.' ), array( 'status' => 412 ) );
565565
}
566566
}
567567

lib/endpoints/class-wp-rest-comments-controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ public function create_item_permissions_check( $request ) {
296296
}
297297

298298
if ( empty( $request['post'] ) && ! current_user_can( 'moderate_comments' ) ) {
299-
return new WP_Error( 'rest_comment_invalid_post_id', __( 'Sorry, you cannot create this comment without a post' ), array( 'status' => rest_authorization_required_code() ) );
299+
return new WP_Error( 'rest_comment_invalid_post_id', __( 'Sorry, you cannot create this comment without a post.' ), array( 'status' => rest_authorization_required_code() ) );
300300
}
301301

302302
if ( ! empty( $request['post'] ) && $post = $this->get_post( (int) $request['post'] ) ) {

lib/endpoints/class-wp-rest-posts-controller.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function get_items_permissions_check( $request ) {
7777
$post_type = get_post_type_object( $this->post_type );
7878

7979
if ( 'edit' === $request['context'] && ! current_user_can( $post_type->cap->edit_posts ) ) {
80-
return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit these posts in this post type' ), array( 'status' => rest_authorization_required_code() ) );
80+
return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit these posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
8181
}
8282

8383
return true;
@@ -271,7 +271,7 @@ public function get_item_permissions_check( $request ) {
271271
$post = $this->get_post( (int) $request['id'] );
272272

273273
if ( 'edit' === $request['context'] && $post && ! $this->check_update_permission( $post ) ) {
274-
return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit this post' ), array( 'status' => rest_authorization_required_code() ) );
274+
return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit this post.' ), array( 'status' => rest_authorization_required_code() ) );
275275
}
276276

277277
if ( $post && ! empty( $request['password'] ) ) {
@@ -948,13 +948,13 @@ protected function handle_status_param( $post_status, $post_type ) {
948948
break;
949949
case 'private':
950950
if ( ! current_user_can( $post_type->cap->publish_posts ) ) {
951-
return new WP_Error( 'rest_cannot_publish', __( 'Sorry, you are not allowed to create private posts in this post type' ), array( 'status' => rest_authorization_required_code() ) );
951+
return new WP_Error( 'rest_cannot_publish', __( 'Sorry, you are not allowed to create private posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
952952
}
953953
break;
954954
case 'publish':
955955
case 'future':
956956
if ( ! current_user_can( $post_type->cap->publish_posts ) ) {
957-
return new WP_Error( 'rest_cannot_publish', __( 'Sorry, you are not allowed to publish posts in this post type' ), array( 'status' => rest_authorization_required_code() ) );
957+
return new WP_Error( 'rest_cannot_publish', __( 'Sorry, you are not allowed to publish posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
958958
}
959959
break;
960960
default:
@@ -1917,6 +1917,6 @@ public function validate_user_can_query_private_statuses( $value, $request, $par
19171917
if ( current_user_can( $post_type_obj->cap->edit_posts ) ) {
19181918
return true;
19191919
}
1920-
return new WP_Error( 'rest_forbidden_status', __( 'Status is forbidden' ), array( 'status' => rest_authorization_required_code() ) );
1920+
return new WP_Error( 'rest_forbidden_status', __( 'Status is forbidden.' ), array( 'status' => rest_authorization_required_code() ) );
19211921
}
19221922
}

lib/endpoints/class-wp-rest-users-controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ public function update_item( $request ) {
401401
}
402402

403403
if ( ! empty( $request['username'] ) && $request['username'] !== $user->user_login ) {
404-
return new WP_Error( 'rest_user_invalid_argument', __( "Username isn't editable" ), array( 'status' => 400 ) );
404+
return new WP_Error( 'rest_user_invalid_argument', __( "Username isn't editable." ), array( 'status' => 400 ) );
405405
}
406406

407407
if ( ! empty( $request['slug'] ) && $request['slug'] !== $user->user_nicename && get_user_by( 'slug', $request['slug'] ) ) {

plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ function rest_register_settings() {
226226
),
227227
),
228228
'type' => 'string',
229-
'description' => __( 'Site URL' ),
229+
'description' => __( 'Site URL.' ),
230230
) );
231231

232232
register_setting( 'general', 'admin_email', array(

0 commit comments

Comments
 (0)