Make WordPress Core


Ignore:
Timestamp:
11/10/2009 10:38:19 AM (16 years ago)
Author:
azaozz
Message:

Remove all instances of "Trash" from the UI when Trash is disabled, replace trash actions with "Delete permanently", props caesarsgrunt, see #4529

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/template.php

    r12139 r12162  
    14451445
    14461446            $actions = array();
    1447             if ('trash' == $post->post_status) {
    1448                 if ( current_user_can('delete_post', $post->ID) ) {
     1447            if ( current_user_can('edit_post', $post->ID) && 'trash' != $post->post_status ) {
     1448                $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>';
     1449                $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
     1450            }
     1451            if ( current_user_can('delete_post', $post->ID) ) {
     1452                if ( 'trash' == $post->post_status )
    14491453                    $actions['untrash'] = "<a title='" . esc_attr(__('Restore this post from the Trash')) . "' href='" . wp_nonce_url("post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>";
     1454                elseif ( EMPTY_TRASH_DAYS )
     1455                    $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>";
     1456                if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
    14501457                    $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
    1451                 }
    1452             } else {
    1453                 if ( current_user_can('edit_post', $post->ID) ) {
    1454                     $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>';
    1455                     $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
    1456                 }
    1457                 if ( current_user_can('delete_post', $post->ID) ) {
    1458                     $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>";
    1459                 }
    1460                 if ( in_array($post->post_status, array('pending', 'draft')) ) {
    1461                     if ( current_user_can('edit_post', $post->ID) )
    1462                         $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
    1463                 } else {
    1464                     $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
    1465                 }
     1458            }
     1459            if ( in_array($post->post_status, array('pending', 'draft')) ) {
     1460                if ( current_user_can('edit_post', $post->ID) )
     1461                    $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
     1462            } elseif ( 'trash' != $post->post_status ) {
     1463                $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
    14661464            }
    14671465            $actions = apply_filters('post_row_actions', $actions, $post);
     
    16671665        <?php
    16681666        $actions = array();
    1669         if ($post->post_status == 'trash' && current_user_can('delete_page', $page->ID)) {
    1670             $actions['untrash'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("page.php?action=untrash&amp;post=$page->ID", 'untrash-page_' . $page->ID) . "'>" . __('Restore') . "</a>";
    1671             $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "'>" . __('Delete Permanently') . "</a>";
    1672         } else {
    1673             if ( current_user_can('edit_page', $page->ID) ) {
    1674                 $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>';
    1675                 $actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
    1676             }
    1677             if ( current_user_can('delete_page', $page->ID) ) {
     1667        if ( current_user_can('edit_page', $page->ID) && $post->post_status != 'trash' ) {
     1668            $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>';
     1669            $actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
     1670        }
     1671        if ( current_user_can('delete_page', $page->ID) ) {
     1672            if ( $post->post_status == 'trash' )
     1673                $actions['untrash'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("page.php?action=untrash&amp;post=$page->ID", 'untrash-page_' . $page->ID) . "'>" . __('Restore') . "</a>";
     1674            elseif ( EMPTY_TRASH_DAYS )
    16781675                $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this page to the Trash')) . "' href='" . get_delete_post_link($page->ID) . "'>" . __('Trash') . "</a>";
    1679             }
    1680             if ( in_array($post->post_status, array('pending', 'draft')) ) {
    1681                 if ( current_user_can('edit_page', $page->ID) )
    1682                     $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
    1683             } else {
    1684                 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
    1685             }
     1676            if ( $post->post_status == 'trash' || !EMPTY_TRASH_DAYS )
     1677                $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "'>" . __('Delete Permanently') . "</a>";
     1678        }
     1679        if ( in_array($post->post_status, array('pending', 'draft')) ) {
     1680            if ( current_user_can('edit_page', $page->ID) )
     1681                $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
     1682        } elseif ( $post->post_status != 'trash' ) {
     1683            $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
    16861684        }
    16871685        $actions = apply_filters('page_row_actions', $actions, $page);
     
    21802178                        }
    21812179
    2182                         if ( 'spam' == $the_comment_status ) {
     2180                        if ( 'spam' != $the_comment_status ) {
     2181                            $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
     2182                        }
     2183                        if ( 'spam' == $the_comment_status || !EMPTY_TRASH_DAYS ) {
    21832184                            $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::delete=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
    21842185                        } else {
    2185                             $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
    21862186                            $actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . __( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>';
    21872187                        }
Note: See TracChangeset for help on using the changeset viewer.