Ticket #38808: 38808.combined.patch
File 38808.combined.patch, 10.8 KB (added by , 8 years ago) |
---|
-
src/wp-admin/includes/post.php
160 160 $post_data['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss ); 161 161 $valid_date = wp_checkdate( $mm, $jj, $aa, $post_data['post_date'] ); 162 162 if ( !$valid_date ) { 163 return new WP_Error( 'invalid_date', __( ' Whoops, the provided date is invalid.' ) );163 return new WP_Error( 'invalid_date', __( 'Invalid date.' ) ); 164 164 } 165 165 $post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] ); 166 166 } -
src/wp-includes/class-wp-xmlrpc-server.php
1270 1270 } 1271 1271 } elseif ( isset( $post_data['sticky'] ) ) { 1272 1272 if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) { 1273 return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) );1273 return new IXR_Error( 401, __( 'Sorry, you are not allowed to make posts sticky.' ) ); 1274 1274 } 1275 1275 1276 1276 $sticky = wp_validate_boolean( $post_data['sticky'] ); … … 1795 1795 } 1796 1796 1797 1797 if ( ! current_user_can( $post_type->cap->edit_posts ) ) 1798 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type.' ) );1798 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type.' ) ); 1799 1799 1800 1800 $query['post_type'] = $post_type->name; 1801 1801 … … 4117 4117 $post_type = get_post_type_object( $post_type_name ); 4118 4118 4119 4119 if ( ! current_user_can( $post_type->cap->edit_posts ) ) 4120 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post type.' ) );4120 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type.' ) ); 4121 4121 4122 4122 return $this->_prepare_post_type( $post_type, $fields ); 4123 4123 } -
src/wp-includes/post.php
3123 3123 $valid_date = wp_checkdate( $mm, $jj, $aa, $post_date ); 3124 3124 if ( ! $valid_date ) { 3125 3125 if ( $wp_error ) { 3126 return new WP_Error( 'invalid_date', __( ' Whoops, the provided date is invalid.' ) );3126 return new WP_Error( 'invalid_date', __( 'Invalid date.' ) ); 3127 3127 } else { 3128 3128 return 0; 3129 3129 } … … 3403 3403 $page_templates = wp_get_theme()->get_page_templates( $post ); 3404 3404 if ( 'default' != $postarr['page_template'] && ! isset( $page_templates[ $postarr['page_template'] ] ) ) { 3405 3405 if ( $wp_error ) { 3406 return new WP_Error( 'invalid_page_template', __('The page template is invalid.'));3406 return new WP_Error( 'invalid_page_template', __( 'Invalid page template.' ) ); 3407 3407 } 3408 3408 update_post_meta( $post_ID, '_wp_page_template', 'default' ); 3409 3409 } else { -
src/wp-includes/rest-api.php
1040 1040 switch ( $args['format'] ) { 1041 1041 case 'date-time' : 1042 1042 if ( ! rest_parse_date( $value ) ) { 1043 return new WP_Error( 'rest_invalid_date', __( ' The date you provided is invalid.' ) );1043 return new WP_Error( 'rest_invalid_date', __( 'Invalid date.' ) ); 1044 1044 } 1045 1045 break; 1046 1046 … … 1050 1050 // 1051 1051 // https://core.trac.wordpress.org/ticket/38506 1052 1052 if ( ! is_email( $value ) || strlen( $value ) < 6 ) { 1053 return new WP_Error( 'rest_invalid_email', __( ' The email address you provided is invalid.' ) );1053 return new WP_Error( 'rest_invalid_email', __( 'Invalid email address.' ) ); 1054 1054 } 1055 1055 break; 1056 1056 case 'ipv4' : -
src/wp-includes/rest-api/class-wp-rest-server.php
285 285 286 286 $jsonp_callback = $_GET['_jsonp']; 287 287 if ( ! wp_check_jsonp_callback( $jsonp_callback ) ) { 288 echo $this->json_error( 'rest_callback_invalid', __( ' The JSONP callback function is invalid.' ), 400 );288 echo $this->json_error( 'rest_callback_invalid', __( 'Invalid JSONP callback function.' ), 400 ); 289 289 return false; 290 290 } 291 291 } -
src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
435 435 * comment_content. See wp_handle_comment_submission(). 436 436 */ 437 437 if ( empty( $prepared_comment['comment_content'] ) ) { 438 return new WP_Error( 'rest_comment_content_invalid', __( ' Comment content is invalid.' ), array( 'status' => 400 ) );438 return new WP_Error( 'rest_comment_content_invalid', __( 'Invalid comment content.' ), array( 'status' => 400 ) ); 439 439 } 440 440 441 441 // Setting remaining values before wp_insert_comment so we can use wp_allow_comment(). … … 637 637 } 638 638 639 639 if ( isset( $prepared_args['comment_content'] ) && empty( $prepared_args['comment_content'] ) ) { 640 return new WP_Error( 'rest_comment_content_invalid', __( ' Comment content is invalid.' ), array( 'status' => 400 ) );640 return new WP_Error( 'rest_comment_content_invalid', __( 'Invalid comment content.' ), array( 'status' => 400 ) ); 641 641 } 642 642 643 643 $prepared_args['comment_ID'] = $id; -
src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
126 126 $post_type = get_post_type_object( $this->post_type ); 127 127 128 128 if ( 'edit' === $request['context'] && ! current_user_can( $post_type->cap->edit_posts ) ) { 129 return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit theseposts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );129 return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) ); 130 130 } 131 131 132 132 return true; … … 458 458 } 459 459 460 460 if ( ! current_user_can( $post_type->cap->create_posts ) ) { 461 return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create new posts.' ), array( 'status' => rest_authorization_required_code() ) );461 return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create posts as this user.' ), array( 'status' => rest_authorization_required_code() ) ); 462 462 } 463 463 464 464 if ( ! $this->check_assign_terms_permission( $request ) ) { … … 708 708 $post = get_post( $request['id'] ); 709 709 710 710 if ( $post && ! $this->check_delete_permission( $post ) ) { 711 return new WP_Error( 'rest_cannot_delete', __( 'Sorry, you are not allowed to delete posts.' ), array( 'status' => rest_authorization_required_code() ) );711 return new WP_Error( 'rest_cannot_delete', __( 'Sorry, you are not allowed to delete this post.' ), array( 'status' => rest_authorization_required_code() ) ); 712 712 } 713 713 714 714 return true; -
src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
546 546 } 547 547 548 548 if ( ! current_user_can( 'delete_term', $term->term_id ) ) { 549 return new WP_Error( 'rest_cannot_delete', __( 'Sorry, you are not allowed to delete resource.' ), array( 'status' => rest_authorization_required_code() ) );549 return new WP_Error( 'rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.' ), array( 'status' => rest_authorization_required_code() ) ); 550 550 } 551 551 552 552 return true; … … 823 823 'context' => array( 'view', 'edit' ), 824 824 ), 825 825 'link' => array( 826 'description' => __( 'URL tothe resource.' ),826 'description' => __( 'URL of the resource.' ), 827 827 'type' => 'string', 828 828 'format' => 'uri', 829 829 'context' => array( 'view', 'embed', 'edit' ), -
src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
543 543 } 544 544 545 545 if ( email_exists( $request['email'] ) && $request['email'] !== $user->user_email ) { 546 return new WP_Error( 'rest_user_invalid_email', __( ' Email address is invalid.' ), array( 'status' => 400 ) );546 return new WP_Error( 'rest_user_invalid_email', __( 'Invalid email address.' ), array( 'status' => 400 ) ); 547 547 } 548 548 549 549 if ( ! empty( $request['username'] ) && $request['username'] !== $user->user_login ) { … … 551 551 } 552 552 553 553 if ( ! empty( $request['slug'] ) && $request['slug'] !== $user->user_nicename && get_user_by( 'slug', $request['slug'] ) ) { 554 return new WP_Error( 'rest_user_invalid_slug', __( ' Slug is invalid.' ), array( 'status' => 400 ) );554 return new WP_Error( 'rest_user_invalid_slug', __( 'Invalid slug.' ), array( 'status' => 400 ) ); 555 555 } 556 556 557 557 if ( ! empty( $request['roles'] ) ) { … … 1139 1139 'context' => array( 'embed', 'view', 'edit' ), 1140 1140 ), 1141 1141 'link' => array( 1142 'description' => __( 'Author URL tothe resource.' ),1142 'description' => __( 'Author URL of the resource.' ), 1143 1143 'type' => 'string', 1144 1144 'format' => 'uri', 1145 1145 'context' => array( 'embed', 'view', 'edit' ), -
src/wp-includes/script-loader.php
231 231 232 232 // Strings for 'jquery-ui-autocomplete' live region messages 233 233 did_action( 'init' ) && $scripts->localize( 'jquery-ui-autocomplete', 'uiAutocompleteL10n', array( 234 'noResults' => __( 'No search results.' ),234 'noResults' => __( 'No results found.' ), 235 235 /* translators: Number of results found when using jQuery UI Autocomplete */ 236 236 'oneResult' => __( '1 result found. Use up and down arrow keys to navigate.' ), 237 237 /* translators: %d: Number of results found when using jQuery UI Autocomplete */