Changeset 11749 for trunk/wp-admin/includes/template.php
- Timestamp:
- 07/30/2009 01:39:34 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/template.php
r11748 r11749 1434 1434 $attributes = 'class="post-title column-title"' . $style; 1435 1435 ?> 1436 <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $post->ID )) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>1436 <td <?php echo $attributes ?>><strong><?php if ( current_user_can('edit_post', $post->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong> 1437 1437 <?php 1438 1438 if ( 'excerpt' == $mode ) … … 1440 1440 1441 1441 $actions = array(); 1442 if ( current_user_can('edit_post', $post->ID) ) { 1443 $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>'; 1444 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick Edit') . '</a>'; 1445 } 1446 if ( current_user_can('delete_post', $post->ID) ) { 1447 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 1448 } 1449 if ( in_array($post->post_status, array('pending', 'draft')) ) { 1450 if ( current_user_can('edit_post', $post->ID) ) 1451 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; 1442 if ( 'trash' == $post->post_status && current_user_can('delete_post', $post->ID) ) { 1443 $actions['untrash'] = "<a title='" . esc_attr(__('Remove this post from the Trash')) . "' href='" . wp_nonce_url("post.php?action=untrash&post=$post->ID", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>"; 1444 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>"; 1452 1445 } else { 1453 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; 1446 if ( current_user_can('edit_post', $post->ID) ) { 1447 $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>'; 1448 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick Edit') . '</a>'; 1449 } 1450 if ( current_user_can('delete_post', $post->ID) ) { 1451 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . wp_nonce_url("post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>"; 1452 } 1453 if ( in_array($post->post_status, array('pending', 'draft')) ) { 1454 if ( current_user_can('edit_post', $post->ID) ) 1455 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; 1456 } else { 1457 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; 1458 } 1454 1459 } 1455 1460 $actions = apply_filters('post_row_actions', $actions, $post); … … 1652 1657 $edit_link = get_edit_post_link( $page->ID ); 1653 1658 ?> 1654 <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_page', $page->ID )) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . __('Parent Page: ') . esc_html($parent_name) : ''; ?></strong>1659 <td <?php echo $attributes ?>><strong><?php if ( current_user_can('edit_page', $page->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . __('Parent Page: ') . esc_html($parent_name) : ''; ?></strong> 1655 1660 <?php 1656 1661 $actions = array(); 1657 if ( current_user_can('edit_page', $page->ID) ) { 1658 $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>'; 1659 $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 1660 } 1661 if ( current_user_can('delete_page', $page->ID) ) { 1662 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page')) . "' href='" . wp_nonce_url("page.php?action=delete&post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 1663 } 1664 if ( in_array($post->post_status, array('pending', 'draft')) ) { 1665 if ( current_user_can('edit_page', $page->ID) ) 1666 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; 1662 if ($post->post_status == 'trash' && current_user_can('delete_page', $page->ID)) { 1663 $actions['untrash'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("page.php?action=untrash&post=$page->ID", 'untrash-page_' . $page->ID) . "'>" . __('Restore') . "</a>"; 1664 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("page.php?action=delete&post=$page->ID", 'delete-page_' . $page->ID) . "'>" . __('Delete Permanently') . "</a>"; 1667 1665 } else { 1668 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; 1666 if ( current_user_can('edit_page', $page->ID) ) { 1667 $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>'; 1668 $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 1669 } 1670 if ( current_user_can('delete_page', $page->ID) ) { 1671 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this page to the Trash')) . "' href='" . wp_nonce_url("page.php?action=trash&post=$page->ID", 'trash-page_' . $page->ID) . "'>" . __('Trash') . "</a>"; 1672 } 1673 if ( in_array($post->post_status, array('pending', 'draft')) ) { 1674 if ( current_user_can('edit_page', $page->ID) ) 1675 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; 1676 } else { 1677 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; 1678 } 1669 1679 } 1670 1680 $actions = apply_filters('page_row_actions', $actions, $page); … … 1982 1992 * @since unknown 1983 1993 * 1984 * @param string $status Comment status (approved, spam, deleted, etc)1994 * @param string $status Comment status (approved, spam, trash, etc) 1985 1995 * @param string $s Term to search for 1986 1996 * @param int $start Offset to start at for pagination … … 2000 2010 2001 2011 if ( 'moderated' == $status ) { 2002 $approved = "c omment_approved = '0'";2012 $approved = "c.comment_approved = '0'"; 2003 2013 $total = $count->moderated; 2004 2014 } elseif ( 'approved' == $status ) { 2005 $approved = "c omment_approved = '1'";2015 $approved = "c.comment_approved = '1'"; 2006 2016 $total = $count->approved; 2007 2017 } elseif ( 'spam' == $status ) { 2008 $approved = "c omment_approved = 'spam'";2018 $approved = "c.comment_approved = 'spam'"; 2009 2019 $total = $count->spam; 2010 } elseif ( ' deleted' == $status ) {2011 $approved = "c omment_approved = 'deleted'";2012 $total = $count-> deleted;2020 } elseif ( 'trash' == $status ) { 2021 $approved = "c.comment_approved = 'trash'"; 2022 $total = $count->trash; 2013 2023 } else { 2014 $approved = "( c omment_approved = '0' ORcomment_approved = '1' )";2024 $approved = "( c.comment_approved = '0' OR c.comment_approved = '1' )"; 2015 2025 $total = $count->moderated + $count->approved; 2016 $index = 'USE INDEX (c omment_date_gmt)';2026 $index = 'USE INDEX (c.comment_date_gmt)'; 2017 2027 } 2018 2028 2019 2029 if ( $post ) { 2020 2030 $total = ''; 2021 $post = " AND c omment_post_ID = '$post'";2022 $orderby = "ORDER BY c omment_date_gmt ASC LIMIT $start, $num";2031 $post = " AND c.comment_post_ID = '$post'"; 2032 $orderby = "ORDER BY c.comment_date_gmt ASC LIMIT $start, $num"; 2023 2033 } else { 2024 2034 $post = ''; 2025 $orderby = "ORDER BY c omment_date_gmt DESC LIMIT $start, $num";2035 $orderby = "ORDER BY c.comment_date_gmt DESC LIMIT $start, $num"; 2026 2036 } 2027 2037 2028 2038 if ( 'comment' == $type ) 2029 $typesql = "AND c omment_type = ''";2039 $typesql = "AND c.comment_type = ''"; 2030 2040 elseif ( 'pings' == $type ) 2031 $typesql = "AND ( c omment_type = 'pingback' ORcomment_type = 'trackback' )";2041 $typesql = "AND ( c.comment_type = 'pingback' OR c.comment_type = 'trackback' )"; 2032 2042 elseif ( !empty($type) ) 2033 $typesql = $wpdb->prepare("AND c omment_type = %s", $type);2043 $typesql = $wpdb->prepare("AND c.comment_type = %s", $type); 2034 2044 else 2035 2045 $typesql = ''; … … 2038 2048 $total = ''; 2039 2049 2050 $query = "FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' "; 2040 2051 if ( $s ) { 2041 2052 $total = ''; 2042 2053 $s = $wpdb->escape($s); 2043 $query = "FROM $wpdb->comments WHERE2044 (c omment_author LIKE '%$s%' OR2045 c omment_author_email LIKE '%$s%' OR2046 c omment_author_url LIKE ('%$s%') OR2047 c omment_author_IP LIKE ('%$s%') OR2048 c omment_content LIKE ('%$s%') ) AND2054 $query .= "AND 2055 (c.comment_author LIKE '%$s%' OR 2056 c.comment_author_email LIKE '%$s%' OR 2057 c.comment_author_url LIKE ('%$s%') OR 2058 c.comment_author_IP LIKE ('%$s%') OR 2059 c.comment_content LIKE ('%$s%') ) AND 2049 2060 $approved 2050 2061 $typesql"; 2051 2062 } else { 2052 $query = "FROM $wpdb->comments $index WHERE$approved $post $typesql";2053 } 2054 2063 $query .= "AND $approved $post $typesql"; 2064 } 2065 2055 2066 $comments = $wpdb->get_results("SELECT * $query $orderby"); 2056 2067 if ( '' === $total ) 2057 $total = $wpdb->get_var("SELECT COUNT(c omment_ID) $query");2068 $total = $wpdb->get_var("SELECT COUNT(c.comment_ID) $query"); 2058 2069 2059 2070 update_comment_cache($comments); … … 2096 2107 $unapprove_url = esc_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) ); 2097 2108 $spam_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) ); 2109 $trash_url = esc_url( wp_nonce_url( "comment.php?action=trashcomment&p=$post->ID&c=$comment->comment_ID", "trash-comment_$comment->comment_ID" ) ); 2110 $untrash_url = esc_url( wp_nonce_url( "comment.php?action=untrashcomment&p=$post->ID&c=$comment->comment_ID", "untrash-comment_$comment->comment_ID" ) ); 2098 2111 2099 2112 echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>"; … … 2135 2148 2136 2149 if ( $user_can ) { 2137 if ( ' deleted' == $the_comment_status ) {2138 $actions['un approve'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved vim-u vim-destructive' title='" . __( 'Return this comment to Unapproved status' ) . "'>" . __( 'Return to Pending' ) . '</a>';2139 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID ::deleted=1delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';2150 if ( 'trash' == $the_comment_status ) { 2151 $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID::untrash=1 vim-t vim-destructive''>" . __( 'Restore' ) . '</a>'; 2152 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>'; 2140 2153 } else { 2141 2154 $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; … … 2153 2166 2154 2167 if ( 'spam' == $the_comment_status ) { 2155 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID ::deleted=1delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';2168 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>'; 2156 2169 } else { 2157 2170 $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>'; 2158 $actions[' delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Move toTrash') . '</a>';2171 $actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-t vim-destructive'>" . __('Trash') . '</a>'; 2159 2172 } 2160 2173 … … 2177 2190 if ( ('reply' == $action || 'quickedit' == $action) && ! $from_ajax ) 2178 2191 $action .= ' hide-if-no-js'; 2192 elseif ($action == 'untrash' && $the_comment_status == 'trash') { 2193 $trash_meta = get_option('wp_trash_meta'); 2194 if (is_array($trash_meta) && isset($trash_meta['comments'][$comment_id]['status'])) { 2195 if ($trash_meta['comments'][$comment_id]['status'] == '1') 2196 $action .= ' approve'; 2197 else 2198 $action .= ' unapprove'; 2199 } 2200 } 2179 2201 2180 2202 echo "<span class='$action'>$sep$link</span>";
Note: See TracChangeset
for help on using the changeset viewer.