Make WordPress Core


Ignore:
Timestamp:
08/15/2010 10:36:17 PM (15 years ago)
Author:
scribu
Message:

In WP_Posts_Table, merge _single_row_hierarchical() and _single_row(). Fixes #14089; see #14579

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/default-list-tables.php

    r15499 r15500  
    1313
    1414class WP_Posts_Table extends WP_List_Table {
    15    
     15
    1616    /**
    1717     * Wether the items should be displayed hierarchically or linearly
     
    1919     * @since 3.1.0
    2020     * @var bool
    21      * @access private
     21     * @access protected
    2222     */
    23     var $_hierarchical_display;
     23    var $hierarchical_display;
     24
     25    /**
     26     * Holds the number of pending comments for each post
     27     *
     28     * @since 3.1.0
     29     * @var bool
     30     * @access protected
     31     */
     32    var $comment_pending_count;
    2433
    2534    function WP_Posts_Table() {
     
    5463        $avail_post_stati = wp_edit_posts_query();
    5564
    56         $this->_hierarchical_display = ( $post_type_object->hierarchical && 0 === strpos( get_query_var( 'orderby' ), 'menu_order' ) );
    57 
    58         $total_items = $this->_hierarchical_display ? $wp_query->post_count : $wp_query->found_posts;
     65        $this->hierarchical_display = ( $post_type_object->hierarchical && 0 === strpos( get_query_var( 'orderby' ), 'menu_order' ) );
     66
     67        $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts;
    5968
    6069        $edit_per_page = 'edit_' . $post_type . '_per_page';
     
    6574        $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
    6675
    67         if ( $this->_hierarchical_display )
     76        if ( $this->hierarchical_display )
    6877            $total_pages = ceil( $total_items / $per_page );
    6978        else
     
    206215            $posts = $wp_query->posts;
    207216
    208         if ( $this->_hierarchical_display ) {
     217        if ( $this->hierarchical_display ) {
    209218            $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page );
    210219        } else {
     
    224233            $post_ids[] = $a_post->ID;
    225234
    226         $comment_pending_count = get_pending_comments_num( $post_ids );
    227 
    228         foreach ( $posts as $post ) {
    229             if ( empty( $comment_pending_count[$post->ID] ) )
    230                 $comment_pending_count[$post->ID] = 0;
    231 
    232             $this->_single_row( $post, $comment_pending_count[$post->ID], $mode );
    233         }
     235        $this->comment_pending_count = get_pending_comments_num( $post_ids );
     236
     237        foreach ( $posts as $post )
     238            $this->single_row( $post );
    234239    }
    235240
     
    285290
    286291            if ( $count >= $start )
    287                 echo "\t" . $this->_single_row_hierarchical( $page, $level );
     292                echo "\t" . $this->single_row( $page, $level );
    288293
    289294            $count++;
     
    300305                        break;
    301306                    if ( $count >= $start )
    302                         echo "\t" . $this->_single_row_hierarchical( $op, 0 );
     307                        echo "\t" . $this->single_row( $op, 0 );
    303308                    $count++;
    304309                }
     
    346351                $num_parents = count( $my_parents );
    347352                while ( $my_parent = array_pop( $my_parents ) ) {
    348                     echo "\t" . $this->_single_row_hierarchical( $my_parent, $level - $num_parents );
     353                    echo "\t" . $this->single_row( $my_parent, $level - $num_parents );
    349354                    $num_parents--;
    350355                }
     
    352357
    353358            if ( $count >= $start )
    354                 echo "\t" . $this->_single_row_hierarchical( $page, $level );
     359                echo "\t" . $this->single_row( $page, $level );
    355360
    356361            $count++;
     
    362367    }
    363368
    364     /**
    365      * display one row if the page doesn't have any children
    366      * otherwise, display the row and its children in subsequent rows
    367      *
    368      * @since unknown
    369      *
    370      * @param unknown_type $page
    371      * @param unknown_type $level
    372      */
    373     function _single_row_hierarchical( $page, $level = 0 ) {
    374         global $post, $current_screen;
    375         static $rowclass;
    376 
    377         $post = $page;
    378         setup_postdata( $page );
    379 
    380         if ( 0 == $level && (int) $page->post_parent > 0 ) {
    381             //sent level 0 by accident, by default, or because we don't know the actual level
    382             $find_main_page = (int) $page->post_parent;
    383             while ( $find_main_page > 0 ) {
    384                 $parent = get_page( $find_main_page );
    385 
    386                 if ( is_null( $parent ) )
    387                     break;
    388 
    389                 $level++;
    390                 $find_main_page = (int) $parent->post_parent;
    391 
    392                 if ( !isset( $parent_name ) )
    393                     $parent_name = $parent->post_title;
    394             }
    395         }
    396 
    397         $page->post_title = esc_html( $page->post_title );
    398         $pad = str_repeat( '— ', $level );
    399         $id = (int) $page->ID;
    400         $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
    401         $title = _draft_or_post_title();
    402         $post_type = $page->post_type;
    403         $post_type_object = get_post_type_object( $post_type );
    404 ?>
    405     <tr id="post-<?php echo $id; ?>" class="<?php echo $rowclass; ?> iedit">
    406 <?php
    407 
    408     list( $columns, $hidden ) = $this->get_column_headers();
    409 
    410     foreach ( $columns as $column_name => $column_display_name ) {
    411         $class = "class=\"$column_name column-$column_name\"";
    412 
    413         $style = '';
    414         if ( in_array( $column_name, $hidden ) )
    415             $style = ' style="display:none;"';
    416 
    417         $attributes = "$class$style";
    418 
    419         switch ( $column_name ) {
    420 
    421         case 'cb':
    422             ?>
    423             <th scope="row" class="check-column"><?php if ( current_user_can( $post_type_object->cap->edit_post, $page->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
    424             <?php
    425             break;
    426         case 'date':
    427             if ( '0000-00-00 00:00:00' == $page->post_date && 'date' == $column_name ) {
    428                 $t_time = $h_time = __( 'Unpublished' );
    429                 $time_diff = 0;
    430             } else {
    431                 $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
    432                 $m_time = $page->post_date;
    433                 $time = get_post_time( 'G', true );
    434 
    435                 $time_diff = time() - $time;
    436 
    437                 if ( $time_diff > 0 && $time_diff < 24*60*60 )
    438                     $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
    439                 else
    440                     $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
    441             }
    442             echo '<td ' . $attributes . '>';
    443             echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $page, $column_name, '' ) . '</abbr>';
    444             echo '<br />';
    445             if ( 'publish' == $page->post_status ) {
    446                 _e( 'Published' );
    447             } elseif ( 'future' == $page->post_status ) {
    448                 if ( $time_diff > 0 )
    449                     echo '<strong class="attention">' . __( 'Missed schedule' ) . '</strong>';
    450                 else
    451                     _e( 'Scheduled' );
    452             } else {
    453                 _e( 'Last Modified' );
    454             }
    455             echo '</td>';
    456             break;
    457         case 'title':
    458             $attributes = 'class="post-title page-title column-title"' . $style;
    459             $edit_link = get_edit_post_link( $page->ID );
    460             ?>
    461             <td <?php echo $attributes ?>><strong><?php if ( current_user_can( $post_type_object->cap->edit_post, $page->ID ) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states( $page ); echo isset( $parent_name ) ? ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name ) : ''; ?></strong>
    462             <?php
    463             $actions = array();
    464             if ( current_user_can( $post_type_object->cap->edit_post, $page->ID ) && $post->post_status != 'trash' ) {
    465                 $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr( __( 'Edit this page' ) ) . '">' . __( 'Edit' ) . '</a>';
    466                 $actions['inline'] = '<a href="#" class="editinline">' . __( 'Quick&nbsp;Edit' ) . '</a>';
    467             }
    468             if ( current_user_can( $post_type_object->cap->delete_post, $page->ID ) ) {
    469                 if ( $post->post_status == 'trash' )
    470                     $actions['untrash'] = "<a title='" . esc_attr( __( 'Remove this page from the Trash' ) ) . "' href='" . wp_nonce_url( "post.php?post_type=$post_type&amp;action=untrash&amp;post=$page->ID", 'untrash-' . $post->post_type . '_' . $page->ID ) . "'>" . __( 'Restore' ) . "</a>";
    471                 elseif ( EMPTY_TRASH_DAYS )
    472                     $actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this page to the Trash' ) ) . "' href='" . get_delete_post_link( $page->ID ) . "'>" . __( 'Trash' ) . "</a>";
    473                 if ( $post->post_status == 'trash' || !EMPTY_TRASH_DAYS )
    474                     $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this page permanently' ) ) . "' href='" . wp_nonce_url( "post.php?post_type=$post_type&amp;action=delete&amp;post=$page->ID", 'delete-' . $post->post_type . '_' . $page->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>";
    475             }
    476             if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) {
    477                 if ( current_user_can( $post_type_object->cap->edit_post, $page->ID ) )
    478                     $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $page->ID ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
    479             } elseif ( $post->post_status != 'trash' ) {
    480                 $actions['view'] = '<a href="' . get_permalink( $page->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
    481             }
    482             $actions = apply_filters( 'page_row_actions', $actions, $page );
    483             $action_count = count( $actions );
    484 
    485             $i = 0;
    486             echo '<div class="row-actions">';
    487             foreach ( $actions as $action => $link ) {
    488                 ++$i;
    489                 ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
    490                 echo "<span class='$action'>$link$sep</span>";
    491             }
    492             echo '</div>';
    493 
    494             get_inline_data( $post );
    495             echo '</td>';
    496             break;
    497 
    498         case 'comments':
    499             ?>
    500             <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
    501             <?php
    502             $left = get_pending_comments_num( $page->ID );
    503             $pending_phrase = sprintf( __( '%s pending' ), number_format( $left ) );
    504             if ( $left )
    505                 echo '<strong>';
    506             comments_number(
    507                 "<a href='edit-comments.php?post_ID=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>"
    508                 . /* translators: comment count link */ _x( '0', 'comment count' ) . '</span></a>',
    509                 "<a href='edit-comments.php?post_ID=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>"
    510                 . /* translators: comment count link */ _x( '1', 'comment count' ) . '</span></a>',
    511                 "<a href='edit-comments.php?post_ID=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>"
    512                 . /* translators: comment count link: % will be substituted by comment count */ _x( '%', 'comment count' ) . '</span></a>'
    513             );
    514             if ( $left )
    515                 echo '</strong>';
    516             ?>
    517             </div></td>
    518             <?php
    519             break;
    520 
    521         case 'author':
    522             ?>
    523             <td <?php echo $attributes ?>><a href="edit.php?post_type=<?php echo $post_type; ?>&amp;author=<?php the_author_meta( 'ID' ); ?>"><?php the_author() ?></a></td>
    524             <?php
    525             break;
    526 
    527         default:
    528             ?>
    529             <td <?php echo $attributes ?>><?php do_action( 'manage_pages_custom_column', $column_name, $id ); ?></td>
    530             <?php
    531             break;
    532         }
    533     }
    534 ?>
    535 
    536     </tr>
    537 
    538 <?php
    539     }
    540 
    541     function _single_row( $a_post, $pending_comments, $mode ) {
    542         global $post, $current_screen;
     369    function single_row( $a_post, $level = 0 ) {
     370        global $post, $current_screen, $mode;
    543371        static $rowclass;
    544372
     
    552380        $title = _draft_or_post_title();
    553381        $post_type_object = get_post_type_object( $post->post_type );
     382        $can_edit_post = current_user_can( 'edit_post', $post->ID );
    554383    ?>
    555384        <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status ); ?> iedit' valign="top">
     
    571400            case 'cb':
    572401            ?>
    573             <th scope="row" class="check-column"><?php if ( current_user_can( $post_type_object->cap->edit_post, $post->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
     402            <th scope="row" class="check-column"><?php if ( $can_edit_post ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
    574403            <?php
     404            break;
     405
     406            case 'title':
     407                if ( $this->hierarchical_display ) {
     408                    $attributes = 'class="post-title page-title column-title"' . $style;
     409
     410                    if ( 0 == $level && (int) $post->post_parent > 0 ) {
     411                        //sent level 0 by accident, by default, or because we don't know the actual level
     412                        $find_main_page = (int) $post->post_parent;
     413                        while ( $find_main_page > 0 ) {
     414                            $parent = get_page( $find_main_page );
     415
     416                            if ( is_null( $parent ) )
     417                                break;
     418
     419                            $level++;
     420                            $find_main_page = (int) $parent->post_parent;
     421
     422                            if ( !isset( $parent_name ) )
     423                                $parent_name = $parent->post_title;
     424                        }
     425                    }
     426
     427                    $post->post_title = esc_html( $post->post_title );
     428                    $pad = str_repeat( '&#8212; ', $level );
     429?>
     430            <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states( $post ); echo isset( $parent_name ) ? ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name ) : ''; ?></strong>
     431<?php
     432                }
     433                else {
     434                    $attributes = 'class="post-title page-title column-title"' . $style;
     435?>
     436            <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states( $post ); ?></strong>
     437<?php
     438                    if ( 'excerpt' == $mode ) {
     439                        the_excerpt();
     440                    }
     441                }
     442
     443                $actions = array();
     444                if ( $can_edit_post && 'trash' != $post->post_status ) {
     445                    $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>';
     446                    $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick&nbsp;Edit' ) . '</a>';
     447                }
     448                if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {
     449                    if ( 'trash' == $post->post_status )
     450                        $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
     451                    elseif ( EMPTY_TRASH_DAYS )
     452                        $actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
     453                    if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
     454                        $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
     455                }
     456                if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) {
     457                    if ( $can_edit_post )
     458                        $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
     459                } elseif ( 'trash' != $post->post_status ) {
     460                    $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
     461                }
     462
     463                $actions = apply_filters( $this->hierarchical_display ? 'page_row_actions' : 'post_row_actions', $actions, $post );
     464                $action_count = count( $actions );
     465                $i = 0;
     466                echo '<div class="row-actions">';
     467                foreach ( $actions as $action => $link ) {
     468                    ++$i;
     469                    ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
     470                    echo "<span class='$action'>$link$sep</span>";
     471                }
     472                echo '</div>';
     473
     474                get_inline_data( $post );
    575475            break;
    576476
     
    611511            break;
    612512
    613             case 'title':
    614                 $attributes = 'class="post-title column-title"' . $style;
    615             ?>
    616             <td <?php echo $attributes ?>><strong><?php if ( current_user_can( $post_type_object->cap->edit_post, $post->ID ) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states( $post ); ?></strong>
    617             <?php
    618                 if ( 'excerpt' == $mode )
    619                     the_excerpt();
    620 
    621                 $actions = array();
    622                 if ( current_user_can( $post_type_object->cap->edit_post, $post->ID ) && 'trash' != $post->post_status ) {
    623                     $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>';
    624                     $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick&nbsp;Edit' ) . '</a>';
    625                 }
    626                 if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {
    627                     if ( 'trash' == $post->post_status )
    628                         $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
    629                     elseif ( EMPTY_TRASH_DAYS )
    630                         $actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
    631                     if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
    632                         $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
    633                 }
    634                 if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) {
    635                     if ( current_user_can( $post_type_object->cap->edit_post, $post->ID ) )
    636                         $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
    637                 } elseif ( 'trash' != $post->post_status ) {
    638                     $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
    639                 }
    640                 $actions = apply_filters( 'post_row_actions', $actions, $post );
    641                 $action_count = count( $actions );
    642                 $i = 0;
    643                 echo '<div class="row-actions">';
    644                 foreach ( $actions as $action => $link ) {
    645                     ++$i;
    646                     ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
    647                     echo "<span class='$action'>$link$sep</span>";
    648                 }
    649                 echo '</div>';
    650 
    651                 get_inline_data( $post );
    652             ?>
    653             </td>
    654             <?php
    655             break;
    656 
    657513            case 'categories':
    658514            ?>
     
    661517                if ( !empty( $categories ) ) {
    662518                    $out = array();
    663                     foreach ( $categories as $c )
    664                         $out[] = "<a href='edit.php?post_type={$post->post_type}&amp;category_name={$c->slug}'> " . esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) ) . '</a>';
    665                         echo join( ', ', $out );
     519                    foreach ( $categories as $c ) {
     520                        $out[] = sprintf( '<a href="%s">%s</a>',
     521                            add_query_arg( array( 'post_type' => $post->post_type, 'category_name' => $c->slug ), 'edit.php' ),
     522                            esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) )
     523                        );
     524                    }
     525                    echo join( ', ', $out );
    666526                } else {
    667527                    _e( 'Uncategorized' );
     
    677537                if ( !empty( $tags ) ) {
    678538                    $out = array();
    679                     foreach ( $tags as $c )
    680                         $out[] = "<a href='edit.php?post_type={$post->post_type}&amp;tag={$c->slug}'> " . esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'post_tag', 'display' ) ) . '</a>';
     539                    foreach ( $tags as $c ) {
     540                        $out[] = sprintf( '<a href="%s">%s</a>',
     541                            add_query_arg( array( 'post_type' => $post->post_type, 'tag' => $c->slug ), 'edit.php' ),
     542                            esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'tag', 'display' ) )
     543                        );
     544                    }
    681545                    echo join( ', ', $out );
    682546                } else {
     
    691555            <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
    692556            <?php
     557                $pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
    693558                $pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
    694559                if ( $pending_comments )
     
    711576            case 'author':
    712577            ?>
    713             <td <?php echo $attributes ?>><a href="edit.php?post_type=<?php echo $post->post_type; ?>&amp;author=<?php the_author_meta( 'ID' ); ?>"><?php the_author() ?></a></td>
    714             <?php
    715             break;
    716 
    717             case 'control_view':
    718             ?>
    719             <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e( 'View' ); ?></a></td>
    720             <?php
    721             break;
    722 
    723             case 'control_edit':
    724             ?>
    725             <td><?php if ( current_user_can( $post_type_object->cap->edit_post, $post->ID ) ) { echo "<a href='$edit_link' class='edit'>" . __( 'Edit' ) . "</a>"; } ?></td>
    726             <?php
    727             break;
    728 
    729             case 'control_delete':
    730             ?>
    731             <td><?php if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) { echo "<a href='" . wp_nonce_url( "post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID ) . "' class='delete'>" . __( 'Delete' ) . "</a>"; } ?></td>
     578            <td <?php echo $attributes ?>><?php
     579                printf( '<a href="%s">%s</a>',
     580                    add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' ),
     581                    get_the_author()
     582                );
     583            ?></td>
    732584            <?php
    733585            break;
Note: See TracChangeset for help on using the changeset viewer.