Make WordPress Core

Ticket #15930: 15930.diff

File 15930.diff, 7.2 KB (added by ryan, 10 years ago)
  • src/wp-admin/includes/class-wp-posts-list-table.php

     
    204204
    205205                if ( $this->is_trash ) {
    206206                        $actions['untrash'] = __( 'Restore' );
    207                 } else {
    208                         $actions['edit'] = __( 'Edit' );
    209207                }
    210208
     209                $actions['edit'] = __( 'Edit' );
     210
    211211                if ( current_user_can( $post_type_obj->cap->delete_posts ) ) {
    212212                        if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) {
    213213                                $actions['delete'] = __( 'Delete Permanently' );
     
    667667                                        echo '<a href="' . esc_url( add_query_arg( array( 'post_format' => $format, 'post_type' => $post->post_type ), 'edit.php' ) ) . '" class="post-state-format post-format-icon post-format-' . $format . '" title="' . $label . '">' . $label . ":</a> ";
    668668                                }
    669669
    670                                 if ( $can_edit_post && $post->post_status != 'trash' ) {
     670                                if ( $can_edit_post ) {
    671671                                        echo '<a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ) . '">' . $pad . $title . '</a>';
    672672                                } else {
    673673                                        echo $pad . $title;
     
    679679
    680680                                echo "</strong>\n";
    681681
    682                                 if ( $can_edit_post && $post->post_status != 'trash' ) {
     682                                if ( $can_edit_post ) {
    683683                                        if ( $lock_holder ) {
    684684                                                $locked_avatar = get_avatar( $lock_holder->ID, 18 );
    685685                                                $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
     
    694694                                                the_excerpt();
    695695
    696696                                $actions = array();
    697                                 if ( $can_edit_post && 'trash' != $post->post_status ) {
     697                                if ( $can_edit_post ) {
    698698                                        $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>';
    699699                                        $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick&nbsp;Edit' ) . '</a>';
    700700                                }
     
    714714                                                        $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
    715715                                                        $actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
    716716                                                }
    717                                         } elseif ( 'trash' != $post->post_status ) {
     717                                        } else {
    718718                                                $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
    719719                                        }
    720720                                }
  • src/wp-admin/includes/meta-boxes.php

     
    8181        case 'pending':
    8282                _e('Pending Review');
    8383                break;
     84    case 'trash':
     85        _e('Trash');
     86        break;
    8487        case 'draft':
    8588        case 'auto-draft':
    8689                _e('Draft');
     
    102105<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
    103106<?php endif; ?>
    104107<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
     108<?php if ( 'trash' == $post->post_status ) : ?>
     109<option<?php selected( $post->post_status, 'trash' ); ?> value='trash'><?php _e('Trash') ?></option>
     110<?php endif; ?>
    105111<?php if ( 'auto-draft' == $post->post_status ) : ?>
    106112<option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option>
    107113<?php else : ?>
     
    231237?>
    232238<div id="delete-action">
    233239<?php
    234 if ( current_user_can( "delete_post", $post->ID ) ) {
     240if ( current_user_can( "delete_post", $post->ID ) && 'trash' != $post->post_status ) {
    235241        if ( !EMPTY_TRASH_DAYS )
    236242                $delete_text = __('Delete Permanently');
    237243        else
     
    244250<div id="publishing-action">
    245251<span class="spinner"></span>
    246252<?php
    247 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {
     253if ( !in_array( $post->post_status, array('publish', 'future', 'private', 'trash') ) || 0 == $post->ID ) {
    248254        if ( $can_publish ) :
    249255                if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
    250256                <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />
  • src/wp-admin/includes/post.php

     
    13001300        }
    13011301
    13021302        if ( isset( $view_post ) ) {
    1303                 if( 'draft' == $post->post_status ) {
     1303                if( 'draft' == $post->post_status || 'trash' == $post->post_status ) {
    13041304                        $preview_link = set_url_scheme( get_permalink( $post->ID ) );
    13051305                        /** This filter is documented in wp-admin/includes/meta-boxes.php */
    13061306                        $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
  • src/wp-admin/post.php

     
    153153        if ( ! current_user_can( 'edit_post', $post_id ) )
    154154                wp_die( __( 'You are not allowed to edit this item.' ) );
    155155
    156         if ( 'trash' == $post->post_status )
    157                 wp_die( __( 'You can&#8217;t edit this item because it is in the Trash. Please restore it and try again.' ) );
    158 
    159156        if ( ! empty( $_GET['get-post-lock'] ) ) {
    160157                wp_set_post_lock( $post_id );
    161158                wp_redirect( get_edit_post_link( $post_id, 'url' ) );
  • src/wp-includes/link-template.php

     
    157157         */
    158158        $permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename );
    159159
    160         if ( '' != $permalink && !in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future' ) ) ) {
     160        if ( '' != $permalink && !in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future', 'trash' ) ) ) {
    161161                $unixtime = strtotime($post->post_date);
    162162
    163163                $category = '';
     
    253253
    254254        $slug = $post->post_name;
    255255
    256         $draft_or_pending = isset( $post->post_status ) && in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future' ) );
     256        $draft_or_pending = isset( $post->post_status ) && in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future', 'trash' ) );
    257257
    258258        $post_type = get_post_type_object($post->post_type);
    259259
  • src/wp-includes/post.php

     
    145145
    146146        register_post_status( 'trash', array(
    147147                'label'       => _x( 'Trash', 'post' ),
    148                 'internal'    => true,
     148                //'internal'    => true,
     149        'protected'   => true,
    149150                '_builtin'    => true, /* internal use only. */
    150151                'label_count' => _n_noop( 'Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>' ),
    151152                'show_in_admin_status_list' => true,