Make WordPress Core

Ticket #25408: 25408.5.diff

File 25408.5.diff, 59.5 KB (added by stephdau, 9 years ago)
  • src/wp-admin/includes/class-wp-comments-list-table.php

     
    323323                );
    324324        }
    325325
     326        /**
     327         * Get name of default primary column
     328         *
     329         * @since 4.3
     330         * @access protected
     331         *
     332         * @return string
     333         */
     334        protected function get_default_primary_column_name() {
     335                return 'comment';
     336        }
     337
    326338        public function display() {
    327339                wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
    328340
     
    375387                echo "</tr>\n";
    376388        }
    377389
    378         public function column_cb( $comment ) {
    379                 if ( $this->user_can ) { ?>
    380                 <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label>
    381                 <input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" />
    382                 <?php
     390        /**
     391         * Generate and display row actions links
     392         *
     393         * @since 4.3
     394         * @access protected
     395         *
     396         * @param object $comment Comment being acted upon
     397         * @param string $column_name Current column name
     398         * @param string $primary Primary column name
     399         *
     400         * @return string
     401         */
     402        protected function handle_row_actions( $comment, $column_name, $primary ) {
     403                global $comment_status;
     404
     405                if ( ! $this->user_can ) {
     406                        return;
    383407                }
    384         }
    385408
    386         public function column_comment( $comment ) {
    387                 global $comment_status;
    388409                $post = get_post();
    389410
    390                 $comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
    391411                $the_comment_status = wp_get_comment_status( $comment->comment_ID );
    392412
    393                 echo '<div class="comment-author">';
    394                         $this->column_author( $comment );
    395                 echo '</div>';
    396 
    397                 echo '<div class="submitted-on">';
    398                 /* translators: 2: comment date, 3: comment time */
    399                 printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
    400                         /* translators: comment date format. See http://php.net/date */
    401                         get_comment_date( __( 'Y/m/d' ) ),
    402                         get_comment_date( get_option( 'time_format' ) )
    403                 );
    404 
    405                 if ( $comment->comment_parent ) {
    406                         $parent = get_comment( $comment->comment_parent );
    407                         $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
    408                         $name = get_comment_author( $parent->comment_ID );
    409                         printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
    410                 }
    411 
    412                 echo '</div>';
    413                 comment_text();
    414                 if ( $this->user_can ) { ?>
    415                 <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
    416                 <textarea class="comment" rows="1" cols="1"><?php
    417                         /** This filter is documented in wp-admin/includes/comment.php */
    418                         echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) );
    419                 ?></textarea>
    420                 <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
    421                 <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
    422                 <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
    423                 <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
    424                 </div>
    425                 <?php
    426                 }
    427 
    428                 if ( $this->user_can ) {
     413                if( $primary === $column_name ) {
    429414                        $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
    430415                        $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
    431416
     
    462447                        }
    463448
    464449                        if ( 'spam' != $the_comment_status ) {
    465                                 $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
     450                                $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */
     451                                        _x( 'Spam', 'verb' ) . '</a>';
    466452                        } elseif ( 'spam' == $the_comment_status ) {
    467453                                $actions['unspam'] = "<a href='$unspam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1' class='vim-z vim-destructive'>" . _x( 'Not Spam', 'comment' ) . '</a>';
    468454                        }
     
    478464                        }
    479465
    480466                        if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
    481                                 $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';
     467                                $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>" . __( 'Edit' ) . '</a>';
    482468
    483469                                $format = '<a data-comment-id="%d" data-post-id="%d" data-action="%s" class="%s" title="%s" href="#">%s</a>';
    484470
    485                                 $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'edit', 'vim-q comment-inline',esc_attr__( 'Edit this item inline' ), __( 'Quick&nbsp;Edit' ) );
     471                                $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'edit', 'vim-q comment-inline', esc_attr__( 'Edit this item inline' ), __( 'Quick&nbsp;Edit' ) );
    486472
    487473                                $actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) );
    488474                        }
     
    494480                        echo '<div class="row-actions">';
    495481                        foreach ( $actions as $action => $link ) {
    496482                                ++$i;
    497                                 ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
     483                                ( (( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
    498484
    499485                                // Reply and quickedit need a hide-if-no-js span when not added with ajax
    500                                 if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') )
     486                                if ( ('reply' == $action || 'quickedit' == $action ) && !defined( 'DOING_AJAX' ) )
    501487                                        $action .= ' hide-if-no-js';
    502                                 elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {
     488                                elseif ( ($action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {
    503489                                        if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) )
    504490                                                $action .= ' approve';
    505491                                        else
     
    512498                }
    513499        }
    514500
     501        public function column_cb( $comment ) {
     502                if ( $this->user_can ) { ?>
     503                <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label>
     504                <input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" />
     505                <?php
     506                }
     507        }
     508
     509        public function column_comment( $comment ) {
     510                global $comment_status;
     511                $post = get_post();
     512
     513                $comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
     514                $the_comment_status = wp_get_comment_status( $comment->comment_ID );
     515
     516                echo '<div class="comment-author">';
     517                        $this->column_author( $comment );
     518                echo '</div>';
     519
     520                echo '<div class="submitted-on">';
     521                /* translators: 2: comment date, 3: comment time */
     522                printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
     523                        /* translators: comment date format. See http://php.net/date */
     524                        get_comment_date( __( 'Y/m/d' ) ),
     525                        get_comment_date( get_option( 'time_format' ) )
     526                );
     527
     528                if ( $comment->comment_parent ) {
     529                        $parent = get_comment( $comment->comment_parent );
     530                        $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
     531                        $name = get_comment_author( $parent->comment_ID );
     532                        printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
     533                }
     534
     535                echo '</div>';
     536                comment_text();
     537                if ( $this->user_can ) { ?>
     538                <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
     539                <textarea class="comment" rows="1" cols="1"><?php
     540                        /** This filter is documented in wp-admin/includes/comment.php */
     541                        echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) );
     542                ?></textarea>
     543                <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
     544                <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
     545                <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
     546                <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
     547                </div>
     548                <?php
     549                }
     550        }
     551
    515552        public function column_author( $comment ) {
    516553                global $comment_status;
    517554
  • src/wp-admin/includes/class-wp-list-table.php

     
    792792        }
    793793
    794794        /**
     795         * Get name of default primary column
     796         *
     797         * @since 4.3
     798         * @access protected
     799         *
     800         * @return string
     801         */
     802        protected function get_default_primary_column_name() {
     803                return '';
     804        }
     805
     806        /**
     807         * Get name of primary column.
     808         *
     809         * @since 4.3
     810         * @access protected
     811         *
     812         * @return string Filtered name of primary column
     813         */
     814        protected function get_primary_column_name() {
     815                $columns = $this->get_columns();
     816                $default = $this->get_default_primary_column_name();
     817                /**
     818                 * Filter the name of the primary column for the current list table.
     819                 *
     820                 * @since 4.3
     821                 *
     822                 * @param string $default Column name default for the specific list table (eg: 'name')
     823                 * @param string $context Screen ID for specific list table (eg: 'plugins')
     824                 */
     825                $column  = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
     826
     827                if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {
     828                        $column = $default;
     829                }
     830
     831                return $column;
     832        }
     833
     834        /**
    795835         * Get a list of all, hidden and sortable columns, with filter applied
    796836         *
    797837         * @since 3.1.0
     
    831871                        $sortable[$id] = $data;
    832872                }
    833873
    834                 $this->_column_headers = array( $columns, $hidden, $sortable );
     874                $primary = $this->get_primary_column_name();
     875                $this->_column_headers = array( $columns, $hidden, $sortable, $primary );
    835876
    836877                return $this->_column_headers;
    837878        }
     
    10591100         * @param object $item The current item
    10601101         */
    10611102        protected function single_row_columns( $item ) {
    1062                 list( $columns, $hidden ) = $this->get_column_info();
     1103                list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
    10631104
    10641105                foreach ( $columns as $column_name => $column_display_name ) {
    1065                         $class = "class='$column_name column-$column_name'";
     1106                        $classes = "$column_name column-$column_name";
     1107                        if ( $primary === $column_name ) {
     1108                                $classes .= ' has-row-actions';
     1109                        }
    10661110
    10671111                        $style = '';
    1068                         if ( in_array( $column_name, $hidden ) )
     1112                        if ( in_array( $column_name, $hidden ) ) {
    10691113                                $style = ' style="display:none;"';
     1114                        }
    10701115
    1071                         $attributes = "$class$style";
     1116                        $attributes = "class='$classes'$style";
    10721117
    10731118                        if ( 'cb' == $column_name ) {
    10741119                                echo '<th scope="row" class="check-column">';
     
    10781123                        elseif ( method_exists( $this, 'column_' . $column_name ) ) {
    10791124                                echo "<td $attributes>";
    10801125                                echo call_user_func( array( $this, 'column_' . $column_name ), $item );
     1126                                echo $this->handle_row_actions( $item, $column_name, $primary );
    10811127                                echo "</td>";
    10821128                        }
    10831129                        else {
     
    10891135        }
    10901136
    10911137        /**
     1138         * Generate and display row actions links
     1139         *
     1140         * @since 4.3
     1141         * @access protected
     1142         *
     1143         * @param object $item Item being acted upon
     1144         * @param string $column_name Current column name
     1145         * @param string $primary Primary column name
     1146         *
     1147         * @return string
     1148         */
     1149        protected function handle_row_actions( $item, $column_name, $primary ) {
     1150                return '';
     1151        }
     1152
     1153        /**
    10921154         * Handle an incoming ajax request (called from admin-ajax.php)
    10931155         *
    10941156         * @since 3.1.0
  • src/wp-admin/includes/class-wp-media-list-table.php

     
    288288        <tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim( ' author-' . $post_owner . ' status-' . $post->post_status ); ?>">
    289289<?php
    290290
    291 list( $columns, $hidden ) = $this->get_column_info();
     291list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
     292
    292293foreach ( $columns as $column_name => $column_display_name ) {
    293         $class = "class='$column_name column-$column_name'";
     294        $classes = "$column_name column-$column_name";
     295        if ( $primary === $column_name ) {
     296                $classes .= ' has-row-actions';
     297        }
    294298
    295299        $style = '';
    296         if ( in_array( $column_name, $hidden ) )
     300        if ( in_array( $column_name, $hidden ) ) {
    297301                $style = ' style="display:none;"';
     302        }
    298303
    299         $attributes = $class . $style;
     304        $attributes = "class='$classes'$style";
    300305
    301306        switch ( $column_name ) {
    302307
     
    345350                        _media_states( $post ); ?></strong>
    346351                        <p class="filename"><?php echo wp_basename( $post->guid ); ?></p>
    347352<?php
    348                 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
     353                if( $primary === $column_name ) {
     354                        echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
     355                }
    349356?>
    350357                </td>
    351358<?php
     
    358365                                esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ),
    359366                                get_the_author()
    360367                        );
     368
     369                        if( $primary === $column_name ) {
     370                                echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
     371                        }
    361372                ?></td>
    362373<?php
    363374                break;
     
    364375
    365376        case 'desc':
    366377?>
    367                 <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
     378                <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?>
    368379<?php
     380                if( $primary === $column_name ) {
     381                        echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
     382                }
     383                echo '</td>';
    369384                break;
    370385
    371386        case 'date':
     
    384399                        }
    385400                }
    386401?>
    387                 <td <?php echo $attributes ?>><?php echo $h_time ?></td>
     402                <td <?php echo $attributes ?>><?php echo $h_time ?>
    388403<?php
     404                if( $primary === $column_name ) {
     405                        echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
     406                }
     407                echo '</td>';
    389408                break;
    390409
    391410        case 'parent':
     
    414433                                                '_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] )
    415434                                        ), 'upload.php' ); ?>
    416435                                <a class="hide-if-no-js detach-from-parent" href="<?php echo $detach_url ?>"><?php _e( 'Detach' ); ?></a>
    417                                 <?php endif; ?>
    418                         </td>
    419 <?php
     436                                <?php endif;
    420437                } else {
    421438?>
    422439                        <td <?php echo $attributes ?>><?php _e( '(Unattached)' ); ?><br />
     
    425442                                        onclick="findPosts.open( 'media[]','<?php echo $post->ID ?>' ); return false;"
    426443                                        href="#the-list">
    427444                                        <?php _e( 'Attach' ); ?></a>
    428                         <?php } ?></td>
    429 <?php
     445                        <?php }
    430446                }
     447
     448                if( $primary === $column_name ) {
     449                        echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
     450                }
     451                echo '</td>';
    431452                break;
    432453
    433454        case 'comments':
     
    474495                        } else {
    475496                                echo '&#8212;';
    476497                        }
     498                        if( $primary === $column_name ) {
     499                                echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
     500                        }
    477501                        echo '</td>';
    478502                        break;
    479503                }
     
    490514                         * @param int    $post_id     Attachment ID.
    491515                         */
    492516                        do_action( 'manage_media_custom_column', $column_name, $post->ID );
     517
     518                        if( $primary === $column_name ) {
     519                                echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
     520                        }
    493521                ?></td>
    494522<?php
    495523                break;
     
    501529        }
    502530
    503531        /**
     532         * Get name of default primary column
     533         *
     534         * @since 4.3
     535         * @access protected
     536         *
     537         * @return string
     538         */
     539        protected function get_default_primary_column_name() {
     540                return 'title';
     541        }
     542
     543        /**
    504544         * @param WP_Post $post
    505545         * @param string  $att_title
    506546         */
  • src/wp-admin/includes/class-wp-ms-sites-list-table.php

     
    234234
    235235                        $blogname = ( is_subdomain_install() ) ? str_replace( '.' . get_current_site()->domain, '', $blog['domain'] ) : $blog['path'];
    236236
    237                         list( $columns, $hidden ) = $this->get_column_info();
     237                        list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
    238238
    239239                        foreach ( $columns as $column_name => $column_display_name ) {
     240                                $classes = "$column_name column-$column_name";
     241                                if ( $primary === $column_name ) {
     242                                        $classes .= ' has-row-actions';
     243                                }
     244
    240245                                $style = '';
    241                                 if ( in_array( $column_name, $hidden ) )
     246                                if ( in_array( $column_name, $hidden ) ) {
    242247                                        $style = ' style="display:none;"';
     248                                }
    243249
     250                                $attributes = "class='$classes'$style";
     251
    244252                                switch ( $column_name ) {
    245253                                        case 'cb': ?>
    246254                                                <th scope="row" class="check-column">
     
    260268                                        break;
    261269
    262270                                        case 'blogname':
    263                                                 echo "<td class='column-$column_name $column_name'$style>"; ?>
    264                                                         <a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a>
    265                                                         <?php
    266                                                         if ( 'list' != $mode ) {
    267                                                                 switch_to_blog( $blog['blog_id'] );
    268                                                                 /* translators: 1: site name, 2: site tagline. */
    269                                                                 echo '<p>' . sprintf( __( '%1$s &#8211; <em>%2$s</em>' ), get_option( 'blogname' ), get_option( 'blogdescription ' ) ) . '</p>';
    270                                                                 restore_current_blog();
    271                                                         }
    272 
    273                                                         // Preordered.
    274                                                         $actions = array(
    275                                                                 'edit' => '', 'backend' => '',
    276                                                                 'activate' => '', 'deactivate' => '',
    277                                                                 'archive' => '', 'unarchive' => '',
    278                                                                 'spam' => '', 'unspam' => '',
    279                                                                 'delete' => '',
    280                                                                 'visit' => '',
    281                                                         );
    282 
    283                                                         $actions['edit']        = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>';
    284                                                         $actions['backend']     = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>';
    285                                                         if ( get_current_site()->blog_id != $blog['blog_id'] ) {
    286                                                                 if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )
    287                                                                         $actions['activate']    = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>';
    288                                                                 else
    289                                                                         $actions['deactivate']  = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Deactivate' ) . '</a></span>';
    290 
    291                                                                 if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' )
    292                                                                         $actions['unarchive']   = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Unarchive' ) . '</a></span>';
    293                                                                 else
    294                                                                         $actions['archive']     = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>';
    295 
    296                                                                 if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' )
    297                                                                         $actions['unspam']      = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>';
    298                                                                 else
    299                                                                         $actions['spam']        = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Spam', 'site' ) . '</a></span>';
    300 
    301                                                                 if ( current_user_can( 'delete_site', $blog['blog_id'] ) )
    302                                                                         $actions['delete']      = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Delete' ) . '</a></span>';
    303                                                         }
    304 
    305                                                         $actions['visit']       = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>';
    306 
    307                                                         /**
    308                                                          * Filter the action links displayed for each site in the Sites list table.
    309                                                          *
    310                                                          * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by
    311                                                          * default for each site. The site's status determines whether to show the
    312                                                          * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and
    313                                                          * 'Not Spam' or 'Spam' link for each site.
    314                                                          *
    315                                                          * @since 3.1.0
    316                                                          *
    317                                                          * @param array  $actions  An array of action links to be displayed.
    318                                                          * @param int    $blog_id  The site ID.
    319                                                          * @param string $blogname Site path, formatted depending on whether it is a sub-domain
    320                                                          *                         or subdirectory multisite install.
    321                                                          */
    322                                                         $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname );
    323                                                         echo $this->row_actions( $actions );
     271                                                echo "<td $attributes>"; ?>
     272                                                <a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a>
     273                                                <?php
     274                                                if ( 'list' != $mode ) {
     275                                                        switch_to_blog( $blog['blog_id'] );
     276                                                        /* translators: 1: site name, 2: site tagline. */
     277                                                        echo '<p>' . sprintf( __( '%1$s &#8211; <em>%2$s</em>' ), get_option( 'blogname' ), get_option( 'blogdescription ' ) ) . '</p>';
     278                                                        restore_current_blog();
     279                                                }
     280                                                echo $this->handle_row_actions( $blog, $column_name, $primary );
    324281                                        ?>
    325282                                                </td>
    326283                                        <?php
     
    327284                                        break;
    328285
    329286                                        case 'lastupdated':
    330                                                 echo "<td class='$column_name column-$column_name'$style>";
    331                                                         echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); ?>
     287                                                echo "<td $attributes>";
     288                                                echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] );
     289                                                echo $this->handle_row_actions( $blog, $column_name, $primary );
     290                                                ?>
    332291                                                </td>
    333292                                        <?php
    334293                                        break;
    335294                                case 'registered':
    336                                                 echo "<td class='$column_name column-$column_name'$style>";
     295                                                echo "<td $attributes>";
    337296                                                if ( $blog['registered'] == '0000-00-00 00:00:00' )
    338297                                                        echo '&#x2014;';
    339298                                                else
    340299                                                        echo mysql2date( $date, $blog['registered'] );
     300                                                echo $this->handle_row_actions( $blog, $column_name, $primary );
    341301                                                ?>
    342302                                                </td>
    343303                                        <?php
    344304                                        break;
    345305                                case 'users':
    346                                                 echo "<td class='$column_name column-$column_name'$style>";
     306                                                echo "<td $attributes>";
    347307                                                        $blogusers = get_users( array( 'blog_id' => $blog['blog_id'], 'number' => 6) );
    348308                                                        if ( is_array( $blogusers ) ) {
    349309                                                                $blogusers_warning = '';
     
    360320                                                                if ( $blogusers_warning != '' )
    361321                                                                        echo '<strong>' . $blogusers_warning . '</strong><br />';
    362322                                                        }
     323
     324                                                        echo $this->handle_row_actions( $blog, $column_name, $primary );
    363325                                                        ?>
    364326                                                </td>
    365327                                        <?php
     
    367329
    368330                                case 'plugins': ?>
    369331                                        <?php if ( has_filter( 'wpmublogsaction' ) ) {
    370                                         echo "<td class='$column_name column-$column_name'$style>";
     332                                        echo "<td $attributes>";
    371333                                                /**
    372334                                                 * Fires inside the auxiliary 'Actions' column of the Sites list table.
    373335                                                 *
     
    377339                                                 *
    378340                                                 * @param int $blog_id The site ID.
    379341                                                 */
    380                                                 do_action( 'wpmublogsaction', $blog['blog_id'] ); ?>
     342                                                do_action( 'wpmublogsaction', $blog['blog_id'] );
     343
     344                                                echo $this->handle_row_actions( $blog, $column_name, $primary );
     345                                                ?>
    381346                                        </td>
    382347                                        <?php }
    383348                                        break;
    384349
    385350                                default:
    386                                         echo "<td class='$column_name column-$column_name'$style>";
     351                                        echo "<td $attributes>";
    387352                                        /**
    388353                                         * Fires for each registered custom column in the Sites list table.
    389354                                         *
     
    393358                                         * @param int    $blog_id     The site ID.
    394359                                         */
    395360                                        do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] );
     361
     362                                        echo $this->handle_row_actions( $blog, $column_name, $primary );
    396363                                        echo "</td>";
    397364                                        break;
    398365                                }
     
    402369                        <?php
    403370                }
    404371        }
     372
     373        /**
     374         * Get name of default primary column
     375         *
     376         * @since 4.3
     377         * @access protected
     378         *
     379         * @return string
     380         */
     381        protected function get_default_primary_column_name() {
     382                return 'blogname';
     383        }
     384
     385        /**
     386         * Generate and display row actions links
     387         *
     388         * @since 4.3
     389         * @access protected
     390         *
     391         * @param object $blog Blog being acted upon
     392         * @param string $column_name Current column name
     393         * @param string $primary Primary column name
     394         *
     395         * @return string
     396         */
     397        protected function handle_row_actions( $blog, $column_name, $primary ) {
     398                global $current_site;
     399
     400                if ( $primary === $column_name ) {
     401                        $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path'];
     402
     403                        // Preordered.
     404                        $actions = array(
     405                                'edit' => '', 'backend' => '',
     406                                'activate' => '', 'deactivate' => '',
     407                                'archive' => '', 'unarchive' => '',
     408                                'spam' => '', 'unspam' => '',
     409                                'delete' => '',
     410                                'visit' => '',
     411                        );
     412
     413                        $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>';
     414                        $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>';
     415                        if ( get_current_site()->blog_id != $blog['blog_id'] ) {
     416                                if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )
     417                                        $actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>';
     418                                else
     419                                        $actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Deactivate' ) . '</a></span>';
     420
     421                                if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' )
     422                                        $actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Unarchive' ) . '</a></span>';
     423                                else
     424                                        $actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>';
     425
     426                                if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' )
     427                                        $actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>';
     428                                else
     429                                        $actions['spam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Spam', 'site' ) . '</a></span>';
     430
     431                                if ( current_user_can( 'delete_site', $blog['blog_id'] ) )
     432                                        $actions['delete'] = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Delete' ) . '</a></span>';
     433                        }
     434
     435                        $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>';
     436
     437                        /**
     438                         * Filter the action links displayed for each site in the Sites list table.
     439                         *
     440                         * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by
     441                         * default for each site. The site's status determines whether to show the
     442                         * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and
     443                         * 'Not Spam' or 'Spam' link for each site.
     444                         *
     445                         * @since 3.1.0
     446                         *
     447                         * @param array $actions An array of action links to be displayed.
     448                         * @param int $blog_id The site ID.
     449                         * @param string $blogname Site path, formatted depending on whether it is a sub-domain
     450                         *                         or subdirectory multisite install.
     451                         */
     452                        $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname );
     453                        return $this->row_actions( $actions );
     454                }
     455        }
    405456}
  • src/wp-admin/includes/class-wp-ms-themes-list-table.php

     
    215215                );
    216216        }
    217217
     218        /**
     219         * Get name of default primary column
     220         *
     221         * @since 4.3
     222         * @access protected
     223         *
     224         * @return string
     225         */
     226        protected function get_default_primary_column_name() {
     227                return 'name';
     228        }
     229
    218230        protected function get_views() {
    219231                global $totals, $status;
    220232
     
    375387
    376388                echo "<tr id='$id' class='$class'>";
    377389
    378                 list( $columns, $hidden ) = $this->get_column_info();
     390                list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
    379391
    380392                foreach ( $columns as $column_name => $column_display_name ) {
    381393                        $style = '';
     
    388400                                        break;
    389401                                case 'name':
    390402                                        echo "<td class='theme-title'$style><strong>" . $theme->display('Name') . "</strong>";
    391                                         echo $this->row_actions( $actions, true );
     403                                        if ( $primary === $column_name ) {
     404                                                echo $this->row_actions($actions, true);
     405                                        }
    392406                                        echo "</td>";
    393407                                        break;
    394408                                case 'description':
     
    426440                                        $theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $stylesheet, $theme, $status );
    427441                                        echo implode( ' | ', $theme_meta );
    428442
    429                                         echo "</div></td>";
     443                                        echo '</div>';
     444                                        if ( $primary === $column_name ) {
     445                                                echo $this->row_actions($actions, true);
     446                                        }
     447                                        echo '</td>';
    430448                                        break;
    431449
    432450                                default:
     
    442460                                         * @param WP_Theme $theme       Current WP_Theme object.
    443461                                         */
    444462                                        do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme );
     463
     464                                        if ( $primary === $column_name ) {
     465                                                echo $this->row_actions($actions, true);
     466                                        }
    445467                                        echo "</td>";
    446468                        }
    447469                }
  • src/wp-admin/includes/class-wp-ms-users-list-table.php

     
    164164                        <tr class="<?php echo trim( $class ); ?>">
    165165                        <?php
    166166
    167                         list( $columns, $hidden ) = $this->get_column_info();
     167                        list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
    168168
    169169                        foreach ( $columns as $column_name => $column_display_name ) :
    170                                 $class = "class='$column_name column-$column_name'";
     170                                $classes = "$column_name column-$column_name";
     171                                if ( $primary === $column_name ) {
     172                                        $classes .= ' has-row-actions';
     173                                }
    171174
    172175                                $style = '';
    173                                 if ( in_array( $column_name, $hidden ) )
     176                                if ( in_array( $column_name, $hidden ) ) {
    174177                                        $style = ' style="display:none;"';
     178                                }
    175179
    176                                 $attributes = "$class$style";
     180                                $attributes = "class='$classes'$style";
    177181
    178182                                switch ( $column_name ) {
    179183                                        case 'cb': ?>
     
    193197                                                        if ( in_array( $user->user_login, $super_admins ) )
    194198                                                                echo ' - ' . __( 'Super Admin' );
    195199                                                        ?></strong>
    196                                                         <br/>
    197                                                         <?php
    198                                                                 $actions = array();
    199                                                                 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
    200 
    201                                                                 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {
    202                                                                         $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&amp;action=deleteuser&amp;id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
    203                                                                 }
    204 
    205                                                                 /**
    206                                                                  * Filter the action links displayed under each user
    207                                                                  * in the Network Admin Users list table.
    208                                                                  *
    209                                                                  * @since 3.2.0
    210                                                                  *
    211                                                                  * @param array   $actions An array of action links to be displayed.
    212                                                                  *                         Default 'Edit', 'Delete'.
    213                                                                  * @param WP_User $user    WP_User object.
    214                                                                  */
    215                                                                 $actions = apply_filters( 'ms_user_row_actions', $actions, $user );
    216                                                                 echo $this->row_actions( $actions );
    217                                                         ?>
    218                                                 </td>
    219200                                        <?php
    220201                                        break;
    221202
    222203                                        case 'name':
    223                                                 echo "<td $attributes>$user->first_name $user->last_name</td>";
     204                                                echo "<td $attributes>$user->first_name $user->last_name";
    224205                                        break;
    225206
    226207                                        case 'email':
    227                                                 echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a></td>";
     208                                                echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a>";
    228209                                        break;
    229210
    230211                                        case 'registered':
     
    233214                                                else
    234215                                                        $date = __( 'Y/m/d g:i:s a' );
    235216
    236                                                 echo "<td $attributes>" . mysql2date( $date, $user->user_registered ) . "</td>";
     217                                                echo "<td $attributes>" . mysql2date( $date, $user->user_registered );
    237218                                        break;
    238219
    239220                                        case 'blogs':
     
    286267                                                                }
    287268                                                        }
    288269                                                        ?>
    289                                                 </td>
    290270                                        <?php
    291271                                        break;
    292272
     
    294274                                                echo "<td $attributes>";
    295275                                                /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
    296276                                                echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID );
    297                                                 echo "</td>";
    298277                                        break;
    299278                                }
     279
     280                                echo $this->handle_row_actions( $user, $column_name, $primary );
     281                                echo '</td>';
    300282                        endforeach
    301283                        ?>
    302284                        </tr>
     
    303285                        <?php
    304286                }
    305287        }
     288
     289        /**
     290         * Get name of default primary column
     291         *
     292         * @since 4.3
     293         * @access protected
     294         *
     295         * @return string
     296         */
     297        protected function get_default_primary_column_name() {
     298                return 'username';
     299        }
     300
     301        /**
     302         * Generate and display row actions links
     303         *
     304         * @since 4.3
     305         * @access protected
     306         *
     307         * @param object $user User being acted upon
     308         * @param string $column_name Current column name
     309         * @param string $primary Primary column name
     310         *
     311         * @return string
     312         */
     313        protected function handle_row_actions( $user, $column_name, $primary ) {
     314                $super_admins = get_super_admins();
     315                $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
     316
     317                if ( $primary === $column_name ) {
     318                        $actions = array();
     319                        $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
     320
     321                        if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {
     322                                $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&amp;action=deleteuser&amp;id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
     323                        }
     324
     325                        /**
     326                         * Filter the action links displayed under each user
     327                         * in the Network Admin Users list table.
     328                         *
     329                         * @since 3.2.0
     330                         *
     331                         * @param array   $actions An array of action links to be displayed.
     332                         *                         Default 'Edit', 'Delete'.
     333                         * @param WP_User $user    WP_User object.
     334                         */
     335                        $actions = apply_filters( 'ms_user_row_actions', $actions, $user );
     336                        return $this->row_actions( $actions );
     337                }
     338        }
    306339}
  • src/wp-admin/includes/class-wp-plugins-list-table.php

     
    301301                                        add_query_arg('plugin_status', $type, 'plugins.php'),
    302302                                        ( $type == $status ) ? ' class="current"' : '',
    303303                                        sprintf( $text, number_format_i18n( $count ) )
    304                                         );
     304                                );
    305305                        }
    306306                }
    307307
     
    451451                                                $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
    452452                                } // end if $is_active
    453453
    454                          } // end if $screen->in_admin( 'network' )
     454                        } // end if $screen->in_admin( 'network' )
    455455
    456456                        if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
    457457                                $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . esc_attr__('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
     
    531531                        $plugin_slug
    532532                );
    533533
    534                 list( $columns, $hidden ) = $this->get_column_info();
     534                list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
    535535
     536                $extra_class = ' has-row-actions';
     537
    536538                foreach ( $columns as $column_name => $column_display_name ) {
    537539                        $style = '';
    538                         if ( in_array( $column_name, $hidden ) )
     540                        if ( in_array( $column_name, $hidden ) ) {
    539541                                $style = ' style="display:none;"';
     542                        }
    540543
    541544                        switch ( $column_name ) {
    542545                                case 'cb':
     
    543546                                        echo "<th scope='row' class='check-column'>$checkbox</th>";
    544547                                        break;
    545548                                case 'name':
    546                                         echo "<td class='plugin-title'$style><strong>$plugin_name</strong>";
    547                                         echo $this->row_actions( $actions, true );
     549                                        if ( $primary === $column_name || ! isset( $columns[ $primary ] ) ) {
     550                                                echo "<td class='plugin-title $extra_class'$style><strong>$plugin_name</strong>";
     551                                                echo $this->row_actions( $actions, true );
     552                                        } else {
     553                                                echo "<td class='plugin-title'$style><strong>$plugin_name</strong>";
     554                                        }
    548555                                        echo "</td>";
    549556                                        break;
    550557                                case 'description':
    551                                         echo "<td class='column-description desc'$style>
     558                                        $classes = 'column-description desc';
     559                                        if ( $primary === $column_name ) {
     560                                                $classes .= " $extra_class";
     561                                        }
     562
     563                                        echo "<td class='$classes'$style>
    552564                                                <div class='plugin-description'>$description</div>
    553565                                                <div class='$class second plugin-version-author-uri'>";
    554566
     
    595607                                        $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status );
    596608                                        echo implode( ' | ', $plugin_meta );
    597609
     610                                        if ( $primary === $column_name ) {
     611                                                echo $this->row_actions( $actions, true );
     612                                        }
    598613                                        echo "</div></td>";
    599614                                        break;
    600615                                default:
    601                                         echo "<td class='$column_name column-$column_name'$style>";
     616                                        $classes = "$column_name column-$column_name$class";
     617                                        if ( $primary === $column_name ) {
     618                                                $classes .= " $extra_class";
     619                                        }
    602620
     621                                        echo "<td class='$classes'$style>";
     622
    603623                                        /**
    604624                                         * Fires inside each custom column of the Plugins list table.
    605625                                         *
     
    610630                                         * @param array  $plugin_data An array of plugin data.
    611631                                         */
    612632                                        do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data );
     633
     634                                        if ( $primary === $column_name ) {
     635                                                echo $this->row_actions( $actions, true );
     636                                        }
    613637                                        echo "</td>";
    614638                        }
    615639                }
     
    645669                 */
    646670                do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status );
    647671        }
    648 }
     672
     673        /**
     674         * Get name of default primary column for this specific list table.
     675         *
     676         * @since 4.3
     677         * @access protected
     678         *
     679         * @return string
     680         */
     681        protected function get_default_primary_column_name() {
     682                return 'plugin';
     683        }
     684}
     685 No newline at end of file
  • src/wp-admin/includes/class-wp-posts-list-table.php

     
    665665                <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>">
    666666        <?php
    667667
    668                 list( $columns, $hidden ) = $this->get_column_info();
     668                list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
    669669
    670670                foreach ( $columns as $column_name => $column_display_name ) {
    671                         $class = "class=\"$column_name column-$column_name\"";
     671                        $classes = "$column_name column-$column_name";
     672                        if ( $primary === $column_name ) {
     673                                $classes .= ' has-row-actions';
     674                        }
    672675
    673676                        $style = '';
    674                         if ( in_array( $column_name, $hidden ) )
     677                        if ( in_array( $column_name, $hidden ) ) {
    675678                                $style = ' style="display:none;"';
     679                        }
    676680
    677                         $attributes = "$class$style";
     681                        $attributes = "class='$classes'$style";
    678682
    679683                        switch ( $column_name ) {
    680684
     
    696700                        break;
    697701
    698702                        case 'title':
    699                                 $attributes = 'class="post-title page-title column-title"' . $style;
     703                                $classes .= ' page-title'; // Special addition for title column
     704                                $attributes = "class='$classes'$style";
    700705                                if ( $this->hierarchical_display ) {
    701706                                        if ( 0 == $level && (int) $post->post_parent > 0 ) {
    702707                                                // Sent level 0 by accident, by default, or because we don't know the actual level.
     
    753758                                if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
    754759                                                the_excerpt();
    755760
    756                                 $actions = array();
    757                                 if ( $can_edit_post && 'trash' != $post->post_status ) {
    758                                         $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>';
    759                                         $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick&nbsp;Edit' ) . '</a>';
    760                                 }
    761                                 if ( current_user_can( 'delete_post', $post->ID ) ) {
    762                                         if ( 'trash' == $post->post_status )
    763                                                 $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->ID ) . "'>" . __( 'Restore' ) . "</a>";
    764                                         elseif ( EMPTY_TRASH_DAYS )
    765                                                 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
    766                                         if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
    767                                                 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
    768                                 }
    769                                 if ( $post_type_object->public ) {
    770                                         if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
    771                                                 if ( $can_edit_post ) {
    772                                                         $preview_link = set_url_scheme( get_permalink( $post->ID ) );
    773                                                         /** This filter is documented in wp-admin/includes/meta-boxes.php */
    774                                                         $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
    775                                                         $actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
    776                                                 }
    777                                         } elseif ( 'trash' != $post->post_status ) {
    778                                                 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
    779                                         }
    780                                 }
     761                                echo $this->handle_row_actions( $post, $column_name, $primary );
    781762
    782                                 if ( is_post_type_hierarchical( $post->post_type ) ) {
    783 
    784                                         /**
    785                                          * Filter the array of row action links on the Pages list table.
    786                                          *
    787                                          * The filter is evaluated only for hierarchical post types.
    788                                          *
    789                                          * @since 2.8.0
    790                                          *
    791                                          * @param array   $actions An array of row action links. Defaults are
    792                                          *                         'Edit', 'Quick Edit', 'Restore, 'Trash',
    793                                          *                         'Delete Permanently', 'Preview', and 'View'.
    794                                          * @param WP_Post $post    The post object.
    795                                          */
    796                                         $actions = apply_filters( 'page_row_actions', $actions, $post );
    797                                 } else {
    798 
    799                                         /**
    800                                          * Filter the array of row action links on the Posts list table.
    801                                          *
    802                                          * The filter is evaluated only for non-hierarchical post types.
    803                                          *
    804                                          * @since 2.8.0
    805                                          *
    806                                          * @param array   $actions An array of row action links. Defaults are
    807                                          *                         'Edit', 'Quick Edit', 'Restore, 'Trash',
    808                                          *                         'Delete Permanently', 'Preview', and 'View'.
    809                                          * @param WP_Post $post    The post object.
    810                                          */
    811                                         $actions = apply_filters( 'post_row_actions', $actions, $post );
    812                                 }
    813 
    814                                 echo $this->row_actions( $actions );
    815 
    816763                                get_inline_data( $post );
    817764                                echo '</td>';
    818765                        break;
     
    868815                                } else {
    869816                                        _e( 'Last Modified' );
    870817                                }
     818                                echo $this->handle_row_actions( $post, $column_name, $primary );
    871819                                echo '</td>';
    872820                        break;
    873821
     
    879827
    880828                                $this->comments_bubble( $post->ID, $pending_comments );
    881829                        ?>
    882                         </div></td>
     830                        </div><?php echo $this->handle_row_actions( $post, $column_name, $primary ); ?></td>
    883831                        <?php
    884832                        break;
    885833
     
    890838                                        esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )),
    891839                                        get_the_author()
    892840                                );
     841                                echo $this->handle_row_actions( $post, $column_name, $primary );
    893842                        ?></td>
    894843                        <?php
    895844                        break;
     
    930879                                        } else {
    931880                                                echo '&#8212;';
    932881                                        }
     882                                        echo $this->handle_row_actions( $post, $column_name, $primary );
    933883                                        echo '</td>';
    934884                                        break;
    935885                                }
     
    976926                                 * @param int    $post_id     The current post ID.
    977927                                 */
    978928                                do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
     929                                echo $this->handle_row_actions( $post, $column_name, $primary );
    979930                        ?></td>
    980931                        <?php
    981932                        break;
     
    988939        }
    989940
    990941        /**
     942         * Get name of default primary column
     943         *
     944         * @since 4.3
     945         * @access protected
     946         *
     947         * @return string
     948         */
     949        protected function get_default_primary_column_name() {
     950                return( 'author' );
     951        }
     952
     953        /**
     954         * Generate and display row actions links
     955         *
     956         * @since 4.3
     957         * @access protected
     958         *
     959         * @param object $post Post being acted upon
     960         * @param string $column_name Current column name
     961         * @param string $primary Primary column name
     962         *
     963         * @return string
     964         */
     965        protected function handle_row_actions( $post, $column_name, $primary ) {
     966                $title = _draft_or_post_title();
     967
     968                if ( $primary === $column_name ) {
     969                        $post_type_object = get_post_type_object( $post->post_type );
     970                        $can_edit_post = current_user_can( 'edit_post', $post->ID );
     971                        $actions = array();
     972
     973                        if ( $can_edit_post && 'trash' != $post->post_status ) {
     974                                $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>';
     975                                $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick&nbsp;Edit' ) . '</a>';
     976                        }
     977
     978                        if ( current_user_can( 'delete_post', $post->ID ) ) {
     979                                if ( 'trash' == $post->post_status )
     980                                        $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->ID ) . "'>" . __( 'Restore' ) . "</a>";
     981                                elseif ( EMPTY_TRASH_DAYS )
     982                                        $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
     983                                if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
     984                                        $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
     985                        }
     986
     987                        if ( $post_type_object->public ) {
     988                                if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
     989                                        if ( $can_edit_post ) {
     990                                                $preview_link = set_url_scheme( get_permalink( $post->ID ) );
     991                                                /** This filter is documented in wp-admin/includes/meta-boxes.php */
     992                                                $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
     993                                                $actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
     994                                        }
     995                                } elseif ( 'trash' != $post->post_status ) {
     996                                        $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
     997                                }
     998                        }
     999
     1000                        if ( is_post_type_hierarchical( $post->post_type ) ) {
     1001
     1002                                /**
     1003                                 * Filter the array of row action links on the Pages list table.
     1004                                 *
     1005                                 * The filter is evaluated only for hierarchical post types.
     1006                                 *
     1007                                 * @since 2.8.0
     1008                                 *
     1009                                 * @param array $actions An array of row action links. Defaults are
     1010                                 *                         'Edit', 'Quick Edit', 'Restore, 'Trash',
     1011                                 *                         'Delete Permanently', 'Preview', and 'View'.
     1012                                 * @param WP_Post $post The post object.
     1013                                 */
     1014                                $actions = apply_filters( 'page_row_actions', $actions, $post );
     1015                        } else {
     1016
     1017                                /**
     1018                                 * Filter the array of row action links on the Posts list table.
     1019                                 *
     1020                                 * The filter is evaluated only for non-hierarchical post types.
     1021                                 *
     1022                                 * @since 2.8.0
     1023                                 *
     1024                                 * @param array $actions An array of row action links. Defaults are
     1025                                 *                         'Edit', 'Quick Edit', 'Restore, 'Trash',
     1026                                 *                         'Delete Permanently', 'Preview', and 'View'.
     1027                                 * @param WP_Post $post The post object.
     1028                                 */
     1029                                $actions = apply_filters( 'post_row_actions', $actions, $post );
     1030                        }
     1031
     1032                        return $this->row_actions( $actions );
     1033                }
     1034        }
     1035
     1036        /**
    9911037         * Outputs the hidden row displayed when inline editing
    9921038         *
    9931039         * @since 3.1.0
  • src/wp-admin/includes/class-wp-terms-list-table.php

     
    302302         */
    303303        public function column_name( $tag ) {
    304304                $taxonomy = $this->screen->taxonomy;
    305                 $tax = get_taxonomy( $taxonomy );
    306305
    307                 $default_term = get_option( 'default_' . $taxonomy );
    308 
    309306                $pad = str_repeat( '&#8212; ', max( 0, $this->level ) );
    310307
    311308                /**
     
    328325
    329326                $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $name ) ) . '">' . $name . '</a></strong><br />';
    330327
    331                 $actions = array();
    332                 if ( current_user_can( $tax->cap->edit_terms ) ) {
    333                         $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
    334                         $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick&nbsp;Edit' ) . '</a>';
    335                 }
    336                 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
    337                         $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>";
    338                 if ( $tax->public )
    339                         $actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>';
    340 
    341                 /**
    342                  * Filter the action links displayed for each term in the Tags list table.
    343                  *
    344                  * @since 2.8.0
    345                  * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead.
    346                  *
    347                  * @param array  $actions An array of action links to be displayed. Default
    348                  *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
    349                  * @param object $tag     Term object.
    350                  */
    351                 $actions = apply_filters( 'tag_row_actions', $actions, $tag );
    352 
    353                 /**
    354                  * Filter the action links displayed for each term in the terms list table.
    355                  *
    356                  * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
    357                  *
    358                  * @since 3.0.0
    359                  *
    360                  * @param array  $actions An array of action links to be displayed. Default
    361                  *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
    362                  * @param object $tag     Term object.
    363                  */
    364                 $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
    365 
    366                 $out .= $this->row_actions( $actions );
    367328                $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
    368329                $out .= '<div class="name">' . $qe_data->name . '</div>';
    369330
     
    375336        }
    376337
    377338        /**
     339         * Get name of default primary column
     340         *
     341         * @since 4.3
     342         * @access protected
     343         *
     344         * @return string
     345         */
     346        protected function get_default_primary_column_name() {
     347                return 'name';
     348        }
     349
     350        /**
     351         * Generate and display row actions links
     352         *
     353         * @since 4.3
     354         * @access protected
     355         *
     356         * @param object $tag Tag being acted upon
     357         * @param string $column_name Current column name
     358         * @param string $primary Primary column name
     359         *
     360         * @return string
     361         */
     362        protected function handle_row_actions( $tag, $column_name, $primary ) {
     363                $taxonomy = $this->screen->taxonomy;
     364                $tax = get_taxonomy( $taxonomy );
     365                $default_term = get_option( 'default_' . $taxonomy );
     366
     367                $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) );
     368
     369                if ( $primary === $column_name ) {
     370                        $actions = array();
     371                        if ( current_user_can( $tax->cap->edit_terms ) ) {
     372                                $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
     373                                $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick&nbsp;Edit' ) . '</a>';
     374                        }
     375                        if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
     376                                $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>";
     377                        if ( $tax->public )
     378                                $actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>';
     379
     380                        /**
     381                         * Filter the action links displayed for each term in the Tags list table.
     382                         *
     383                         * @since 2.8.0
     384                         * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead.
     385                         *
     386                         * @param array  $actions An array of action links to be displayed. Default
     387                         *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
     388                         * @param object $tag     Term object.
     389                         */
     390                        $actions = apply_filters( 'tag_row_actions', $actions, $tag );
     391
     392                        /**
     393                         * Filter the action links displayed for each term in the terms list table.
     394                         *
     395                         * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     396                         *
     397                         * @since 3.0.0
     398                         *
     399                         * @param array  $actions An array of action links to be displayed. Default
     400                         *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
     401                         * @param object $tag     Term object.
     402                         */
     403                        $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
     404
     405                        return $this->row_actions( $actions );
     406                }
     407        }
     408
     409        /**
    378410         * @param object $tag
    379411         * @return string
    380412         */
  • src/wp-admin/includes/class-wp-users-list-table.php

     
    384384                         * @param WP_User $user_object WP_User object for the currently-listed user.
    385385                         */
    386386                        $actions = apply_filters( 'user_row_actions', $actions, $user_object );
    387                         $edit .= $this->row_actions( $actions );
    388387
    389388                        // Set up the checkbox ( because the user is editable, otherwise it's empty )
    390389                        $checkbox = '<label class="screen-reader-text" for="user_' . $user_object->ID . '">' . sprintf( __( 'Select %s' ), $user_object->user_login ) . '</label>'
     
    398397
    399398                $r = "<tr id='user-$user_object->ID'>";
    400399
    401                 list( $columns, $hidden ) = $this->get_column_info();
     400                list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
    402401
    403402                foreach ( $columns as $column_name => $column_display_name ) {
    404                         $class = "class=\"$column_name column-$column_name\"";
     403                        $classes = "$column_name column-$column_name";
     404                        if ( $primary === $column_name ) {
     405                                $classes .= ' has-row-actions';
     406                        }
    405407
    406408                        $style = '';
    407                         if ( in_array( $column_name, $hidden ) )
     409                        if ( in_array( $column_name, $hidden ) ) {
    408410                                $style = ' style="display:none;"';
     411                        }
    409412
    410                         $attributes = "$class$style";
     413                        $attributes = "class='$classes'$style";
    411414
    412415                        switch ( $column_name ) {
    413416                                case 'cb':
     
    414417                                        $r .= "<th scope='row' class='check-column'>$checkbox</th>";
    415418                                        break;
    416419                                case 'username':
    417                                         $r .= "<td $attributes>$avatar $edit</td>";
     420                                        $r .= "<td $attributes>$avatar $edit";
    418421                                        break;
    419422                                case 'name':
    420                                         $r .= "<td $attributes>$user_object->first_name $user_object->last_name</td>";
     423                                        $r .= "<td $attributes>$user_object->first_name $user_object->last_name";
    421424                                        break;
    422425                                case 'email':
    423                                         $r .= "<td $attributes><a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a></td>";
     426                                        $r .= "<td $attributes><a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a>";
    424427                                        break;
    425428                                case 'role':
    426                                         $r .= "<td $attributes>$role_name</td>";
     429                                        $r .= "<td $attributes>$role_name";
    427430                                        break;
    428431                                case 'posts':
    429432                                        $attributes = 'class="posts column-posts num"' . $style;
     
    435438                                        } else {
    436439                                                $r .= 0;
    437440                                        }
    438                                         $r .= "</td>";
    439441                                        break;
    440442                                default:
    441443                                        $r .= "<td $attributes>";
     
    450452                                         * @param int    $user_id     ID of the currently-listed user.
    451453                                         */
    452454                                        $r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID );
    453                                         $r .= "</td>";
    454455                        }
     456
     457                        if ( $primary === $column_name ) {
     458                                $r .= $this->row_actions( $actions );
     459                        }
     460                        $r .= "</td>";
    455461                }
    456462                $r .= '</tr>';
    457463
    458464                return $r;
    459465        }
     466
     467        /**
     468         * Get name of default primary column
     469         *
     470         * @since 4.3
     471         * @access protected
     472         *
     473         * @return string
     474         */
     475        protected function get_default_primary_column_name() {
     476                return 'username';
     477        }
    460478}