Make WordPress Core

Ticket #9681: 9681.2.patch

File 9681.2.patch, 2.1 KB (added by hakre, 15 years ago)
  • wp-admin/edit-form-advanced.php

     
    3131$messages[9] = sprintf(__('Post scheduled for: <b>%1$s</b>. <a href="%2$s">Preview post</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), get_permalink($post_ID));
    3232
    3333if ( isset($_GET['revision']) )
    34         $messages[5] = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
     34{
     35        $messages[5]  = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
     36        $messages[10] = sprintf( __('Revision %s (#%d) deleted'), htmlspecialchars($_GET['revisiontitle']), (int) $_GET['revision'] );
     37}
    3538
    3639$notice = false;
    3740$notices[1] = __( 'There is an autosave of this post that is more recent than the version below.  <a href="%s">View the autosave</a>.' );
  • wp-admin/revision.php

     
    1818$parent_file = $redirect = 'edit.php';
    1919
    2020switch ( $action ) :
    21 case 'delete' : // stubs
     21case 'delete' :
     22        if ( !$revision = wp_get_post_revision( $revision_id ) )
     23                break;
     24        if ( !current_user_can( 'edit_post', $revision->post_parent ) )
     25                break;
     26        if ( !$post = get_post( $revision->post_parent ) )
     27                break;
     28        if ( !constant('WP_POST_REVISIONS') && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave
     29                break;
     30
     31        check_admin_referer( "delete-post_$post->ID|$revision->ID" );
     32
     33        $revisiontitle = wp_post_revision_title( $revision->ID, false);
     34        wp_delete_post_revision( $revision->ID );
     35        $redirect = add_query_arg( array( 'message' => 10, 'revision' => $revision->ID, 'revisiontitle' => urlencode($revisiontitle) ), get_edit_post_link( $post->ID, 'url' ) );
     36        break;
    2237case 'edit' :
    2338        if ( constant('WP_POST_REVISIONS') ) // stub
    2439                $redirect = remove_query_arg( 'action' );