WordPress.org

Make WordPress Core

Changeset 38509


Ignore:
Timestamp:
09/02/2016 03:56:22 AM (3 years ago)
Author:
jorbin
Message:

Text Changes: Improve Error messages in XML-RPC

Three changes to the error message strings:

  • add some missing periods.
  • merge similar translation strings.
  • remove the "Something wrong happened" suffix.

Fixes #37792.
Props ramiy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r38459 r38509  
    13301330            case 'private':
    13311331                if ( ! current_user_can( $post_type->cap->publish_posts ) )
    1332                     return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' ) );
     1332                    return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type.' ) );
    13331333                break;
    13341334            case 'publish':
    13351335            case 'future':
    13361336                if ( ! current_user_can( $post_type->cap->publish_posts ) )
    1337                     return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' ) );
     1337                    return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type.' ) );
    13381338                break;
    13391339            default:
     
    13441344
    13451345        if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) )
    1346             return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) );
     1346            return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type.' ) );
    13471347
    13481348        $post_data['post_author'] = absint( $post_data['post_author'] );
     
    15291529
    15301530        if ( ! $post_ID )
    1531             return new IXR_Error( 401, __( 'Sorry, your entry could not be posted. Something wrong happened.' ) );
     1531            return new IXR_Error( 401, __( 'Sorry, your entry could not be posted.' ) );
    15321532
    15331533        return strval( $post_ID );
     
    17951795            $post_type = get_post_type_object( $filter['post_type'] );
    17961796            if ( ! ( (bool) $post_type ) )
    1797                 return new IXR_Error( 403, __( 'The post type specified is not valid' ) );
     1797                return new IXR_Error( 403, __( 'Invalid post type.' ) );
    17981798        } else {
    17991799            $post_type = get_post_type_object( 'post' );
     
    19231923
    19241924        if ( ! $term )
    1925             return new IXR_Error( 500, __( 'Sorry, your term could not be created. Something wrong happened.' ) );
     1925            return new IXR_Error( 500, __( 'Sorry, your term could not be created.' ) );
    19261926
    19271927        return strval( $term['term_id'] );
     
    24952495        if ( isset( $filter['role'] ) ) {
    24962496            if ( get_role( $filter['role'] ) === null )
    2497                 return new IXR_Error( 403, __( 'The role specified is not valid' ) );
     2497                return new IXR_Error( 403, __( 'Invalid role.' ) );
    24982498
    24992499            $query['role'] = $filter['role'];
     
    34733473
    34743474        if ( !$result )
    3475             return new IXR_Error(500, __('Sorry, the comment could not be edited. Something wrong happened.'));
     3475            return new IXR_Error(500, __('Sorry, the comment could not be edited.'));
    34763476
    34773477        /**
     
    35273527            $logged_in = false;
    35283528            if ( $allow_anon && get_option('comment_registration') ) {
    3529                 return new IXR_Error( 403, __( 'You must be registered to comment' ) );
     3529                return new IXR_Error( 403, __( 'You must be registered to comment.' ) );
    35303530            } elseif ( ! $allow_anon ) {
    35313531                return $this->error;
     
    35813581            if ( get_option('require_name_email') ) {
    35823582                if ( 6 > strlen($comment['comment_author_email']) || '' == $comment['comment_author'] )
    3583                     return new IXR_Error( 403, __( 'Comment author name and email are required' ) );
     3583                    return new IXR_Error( 403, __( 'Comment author name and email are required.' ) );
    35843584                elseif ( !is_email($comment['comment_author_email']) )
    3585                     return new IXR_Error( 403, __( 'A valid email address is required' ) );
     3585                    return new IXR_Error( 403, __( 'A valid email address is required.' ) );
    35863586            }
    35873587        }
     
    46274627
    46284628        if ( !$post_ID )
    4629             return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
     4629            return new IXR_Error(500, __('Sorry, your entry could not be posted.'));
    46304630
    46314631        $this->attach_uploads( $post_ID, $post_content );
     
    48814881            $content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] );
    48824882            if ( !array_key_exists( $content_struct['wp_post_format'], get_post_format_strings() ) ) {
    4883                 return new IXR_Error( 404, __( 'Invalid post format' ) );
     4883                return new IXR_Error( 404, __( 'Invalid post format.' ) );
    48844884            }
    48854885        }
     
    50865086
    50875087        if ( !$post_ID )
    5088             return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
     5088            return new IXR_Error(500, __('Sorry, your entry could not be posted.'));
    50895089
    50905090        /**
     
    52025202            $content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] );
    52035203            if ( !array_key_exists( $content_struct['wp_post_format'], get_post_format_strings() ) ) {
    5204                 return new IXR_Error( 404, __( 'Invalid post format' ) );
     5204                return new IXR_Error( 404, __( 'Invalid post format.' ) );
    52055205            }
    52065206        }
     
    54045404
    54055405        if ( !$result )
    5406             return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.'));
     5406            return new IXR_Error(500, __('Sorry, your entry could not be edited.'));
    54075407
    54085408        // Only posts can be sticky
     
    58135813        $upload = wp_upload_bits($name, null, $bits);
    58145814        if ( ! empty($upload['error']) ) {
    5815             $errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']);
     5815            $errorString = sprintf(__('Could not write file %1$s (%2$s).'), $name, $upload['error']);
    58165816            return new IXR_Error(500, $errorString);
    58175817        }
Note: See TracChangeset for help on using the changeset viewer.