WordPress.org

Make WordPress Core

Changeset 15504


Ignore:
Timestamp:
08/18/2010 04:30:27 PM (8 years ago)
Author:
scribu
Message:

introduce WP_List_Table::comments_bubble(); revert to edit-comments.php?p=123. See #14579

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-comments.php

    r15496 r15504  
    226226    $link = add_query_arg( 'comment_status', $status, $link );
    227227    if ( $post_id )
    228         $link = add_query_arg( 'post_ID', absint( $post_id ), $link );
     228        $link = add_query_arg( 'p', absint( $post_id ), $link );
    229229    /*
    230230    // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
     
    253253<input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
    254254<?php if ( $post_id ) : ?>
    255 <input type="hidden" name="post_ID" value="<?php echo esc_attr( intval( $post_id ) ); ?>" />
     255<input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" />
    256256<?php endif; ?>
    257257<input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" />
     
    281281    <input type="hidden" name="page" value="<?php echo esc_attr($page); ?>" />
    282282    <input type="hidden" name="per_page" value="<?php echo esc_attr($comments_per_page); ?>" />
    283     <input type="hidden" name="post_ID" value="<?php echo esc_attr( $post_id ); ?>" />
     283    <input type="hidden" name="p" value="<?php echo esc_attr( $post_id ); ?>" />
    284284    <input type="hidden" name="comment_type" value="<?php echo esc_attr( $comment_type ); ?>" />
    285285    <?php wp_nonce_field( 'add-comment', '_ajax_nonce', false ); ?>
  • trunk/wp-admin/includes/default-list-tables.php

    r15502 r15504  
    556556            <?php
    557557                $pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
    558                 $pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
    559                 if ( $pending_comments )
    560                     echo '<strong>';
    561                 comments_number(
    562                     "<a href='edit-comments.php?post_ID=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>"
    563                     . /* translators: comment count link */ _x( '0', 'comment count' ) . '</span></a>',
    564                     "<a href='edit-comments.php?post_ID=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>"
    565                     . /* translators: comment count link */ _x( '1', 'comment count' ) . '</span></a>',
    566                     "<a href='edit-comments.php?post_ID=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>"
    567                     . /* translators: comment count link: % will be substituted by comment count */ _x( '%', 'comment count' ) . '</span></a>'
    568                 );
    569                 if ( $pending_comments )
    570                     echo '</strong>';
     558
     559                $this->comments_bubble( $post->ID, $pending_comments );
    571560            ?>
    572561            </div></td>
     
    12171206            <div class="post-com-count-wrapper">
    12181207<?php
    1219         $left = get_pending_comments_num( $post->ID );
    1220         $pending_phrase = sprintf( __( '%s pending' ), number_format( $left ) );
    1221         if ( $left )
    1222             echo '<strong>';
    1223         comments_number(
    1224             "<a href='edit-comments.php?post_ID=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>"
    1225             . /* translators: comment count link */ _x( '0', 'comment count' ) . '</span></a>',
    1226             "<a href='edit-comments.php?post_ID=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>"
    1227             . /* translators: comment count link */ _x( '1', 'comment count' ) . '</span></a>',
    1228             "<a href='edit-comments.php?post_ID=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>"
    1229             . /* translators: comment count link: % will be substituted by comment count */ _x( '%', 'comment count' ) . '</span></a>'
    1230         );
    1231         if ( $left )
    1232             echo '</strong>';
    1233         ?>
     1208        $pending_comments = get_pending_comments_num( $post->ID );
     1209
     1210        $this->comments_bubble( $post->ID, $pending_comments );
     1211?>
    12341212            </div>
    12351213        </td>
     
    19661944        global $post_id, $comment_status, $mode;
    19671945
    1968         $post_id = isset( $_REQUEST['post_ID'] ) ? absint( $_REQUEST['post_ID'] ) : 0;
     1946        $post_id = isset( $_REQUEST['p'] ) ? absint( $_REQUEST['p'] ) : 0;
    19691947
    19701948        $mode = ( empty( $_REQUEST['mode'] ) ) ? 'detail' : $_REQUEST['mode'];
     
    23392317                        echo '<div class="response-links"><span class="post-com-count-wrapper">';
    23402318                        echo $post_link . '<br />';
    2341                         $pending_phrase = esc_attr( sprintf( __( '%s pending' ), number_format( $pending_comments ) ) );
    2342                         if ( $pending_comments )
    2343                             echo '<strong>';
    2344                         comments_number(
    2345                             "<a href='edit-comments.php?post_ID=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>"
    2346                             . /* translators: comment count link */ _x( '0', 'comment count' ) . '</span></a>',
    2347                             "<a href='edit-comments.php?post_ID=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>"
    2348                             . /* translators: comment count link */ _x( '1', 'comment count' ) . '</span></a>',
    2349                             "<a href='edit-comments.php?post_ID=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>"
    2350                             . /* translators: comment count link: % will be substituted by comment count */ _x( '%', 'comment count' ) . '</span></a>'
    2351                         );
    2352                         if ( $pending_comments )
    2353                             echo '</strong>';
     2319                        $this->comments_bubble( $post->ID, $pending_comments );
    23542320                        echo '</span> ';
    23552321                        echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
  • trunk/wp-admin/includes/list-table.php

    r15496 r15504  
    267267        </div>
    268268<?php
     269    }
     270
     271    /** Display a comment count bubble
     272     *
     273     *
     274     * @since 3.1.0
     275     * @access protected
     276     *
     277     * @param int $post_id
     278     * @param int $pending_comments
     279     */
     280    function comments_bubble( $post_id, $pending_comments ) {
     281        $pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
     282
     283        if ( $pending_comments )
     284            echo '<strong>';
     285
     286        $link = "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>%s</span></a>";
     287
     288        comments_number(
     289            sprintf( $link, /* translators: comment count link */ _x( '0', 'comment count' ) ),
     290            sprintf( $link, /* translators: comment count link */ _x( '1', 'comment count' ) ),
     291            sprintf( $link, /* translators: comment count link: % will be substituted by comment count */ _x( '%', 'comment count' ) )
     292        );
     293
     294        if ( $pending_comments )
     295            echo '</strong>';
    269296    }
    270297
Note: See TracChangeset for help on using the changeset viewer.