Make WordPress Core

Changeset 34798


Ignore:
Timestamp:
10/03/2015 02:08:43 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Merge some strings with the same meaning in wp-includes/class-wp-xmlrpc-server.php.

Props pavelevap.
Fixes #33644.

File:
1 edited

Legend:

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

    r34681 r34798  
    15831583
    15841584        $post = get_post( $post_id, ARRAY_A );
    1585         if ( empty( $post['ID'] ) )
     1585        if ( empty( $post['ID'] ) ) {
    15861586            return new IXR_Error( 404, __( 'Invalid post ID.' ) );
    1587 
    1588         if ( ! current_user_can( 'delete_post', $post_id ) )
    1589             return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this post.' ) );
     1587        }
     1588
     1589        if ( ! current_user_can( 'delete_post', $post_id ) ) {
     1590            return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete this post.' ) );
     1591        }
    15901592
    15911593        $result = wp_delete_post( $post_id );
    15921594
    1593         if ( ! $result )
     1595        if ( ! $result ) {
    15941596            return new IXR_Error( 500, __( 'The post cannot be deleted.' ) );
     1597        }
    15951598
    15961599        return true;
     
    46864689        do_action( 'xmlrpc_call', 'blogger.deletePost' );
    46874690
    4688         $actual_post = get_post($post_ID,ARRAY_A);
    4689 
    4690         if ( !$actual_post || $actual_post['post_type'] != 'post' )
    4691             return new IXR_Error(404, __('Sorry, no such post.'));
    4692 
    4693         if ( !current_user_can('delete_post', $post_ID) )
    4694             return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.'));
    4695 
    4696         $result = wp_delete_post($post_ID);
    4697 
    4698         if ( !$result )
    4699             return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.'));
     4691        $actual_post = get_post( $post_ID, ARRAY_A );
     4692
     4693        if ( ! $actual_post || $actual_post['post_type'] != 'post' ) {
     4694            return new IXR_Error( 404, __( 'Sorry, no such post.' ) );
     4695        }
     4696
     4697        if ( ! current_user_can( 'delete_post', $post_ID ) ) {
     4698            return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete this post.' ) );
     4699        }
     4700
     4701        $result = wp_delete_post( $post_ID );
     4702
     4703        if ( ! $result ) {
     4704            return new IXR_Error( 500, __( 'The post cannot be deleted.' ) );
     4705        }
    47004706
    47014707        /**
Note: See TracChangeset for help on using the changeset viewer.