Ticket #25408: 25408.3.diff
| File 25408.3.diff, 57.8 KB (added by , 12 years ago) |
|---|
-
wp-admin/includes/class-wp-ms-users-list-table.php
140 140 ); 141 141 } 142 142 143 function get_primary_column() { 144 return( 'username' ); 145 } 146 143 147 function display_rows() { 144 148 global $mode; 145 149 … … 159 163 <tr class="<?php echo $alt; ?>"> 160 164 <?php 161 165 162 list( $columns, $hidden ) = $this->get_column_info();166 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 163 167 164 168 foreach ( $columns as $column_name => $column_display_name ) : 165 $class = "class='$column_name column-$column_name'"; 169 if( $primary == $column_name ) { 170 $class = "class='$column_name column-$column_name has-row-actions'"; 171 } else { 172 $class = "class='$column_name column-$column_name'"; 173 } 166 174 167 175 $style = ''; 168 176 if ( in_array( $column_name, $hidden ) ) … … 190 198 ?></strong> 191 199 <br/> 192 200 <?php 193 $actions = array(); 194 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 195 196 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) { 197 $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' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>'; 198 } 199 200 /** 201 * Filter the action links displayed under each user 202 * in the Network Admin Users list table. 203 * 204 * @since 3.2.0 205 * 206 * @param array $actions An array of action links to be displayed. 207 * Default 'Edit', 'Delete'. 208 * @param WP_User $user WP_User object. 209 */ 210 $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); 211 echo $this->row_actions( $actions ); 201 echo $this->handle_actions( $user, $column_name, $primary ); 212 202 ?> 213 203 </td> 214 204 <?php 215 205 break; 216 206 217 207 case 'name': 218 echo "<td $attributes>$user->first_name $user->last_name</td>"; 208 echo "<td $attributes>$user->first_name $user->last_name"; 209 echo $this->handle_actions( $user, $column_name, $primary ); 210 echo "</td>"; 219 211 break; 220 212 221 213 case 'email': 222 echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a></td>"; 214 echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a>"; 215 echo $this->handle_actions( $user, $column_name, $primary ); 216 echo "</td>"; 223 217 break; 224 218 225 219 case 'registered': … … 228 222 else 229 223 $date = 'Y/m/d \<\b\r \/\> g:i:s a'; 230 224 231 echo "<td $attributes>" . mysql2date( $date, $user->user_registered ) . "</td>"; 225 echo "<td $attributes>" . mysql2date( $date, $user->user_registered ); 226 echo $this->handle_actions( $user, $column_name, $primary ); 227 echo "</td>"; 232 228 break; 233 229 234 230 case 'blogs': … … 280 276 echo '</small></span><br/>'; 281 277 } 282 278 } 279 echo $this->handle_actions( $user, $column_name, $primary ); 283 280 ?> 284 281 </td> 285 282 <?php … … 289 286 echo "<td $attributes>"; 290 287 /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */ 291 288 echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID ); 289 echo $this->handle_actions( $user, $column_name, $primary ); 292 290 echo "</td>"; 293 291 break; 294 292 } … … 298 296 <?php 299 297 } 300 298 } 299 300 function handle_actions( $user, $column_name, $primary ) { 301 $super_admins = get_super_admins(); 302 if( $primary == $column_name ) { 303 $actions = array(); 304 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); 305 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 306 307 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) { 308 $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' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>'; 309 } 310 311 /** 312 * Filter the action links displayed under each user 313 * in the Network Admin Users list table. 314 * 315 * @since 3.2.0 316 * 317 * @param array $actions An array of action links to be displayed. 318 * Default 'Edit', 'Delete'. 319 * @param WP_User $user WP_User object. 320 */ 321 $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); 322 return $this->row_actions( $actions ); 323 } 324 } 301 325 } -
wp-admin/includes/class-wp-plugins-list-table.php
467 467 468 468 echo "<tr id='$id' class='$class'>"; 469 469 470 list( $columns, $hidden ) = $this->get_column_info();470 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 471 471 472 472 foreach ( $columns as $column_name => $column_display_name ) { 473 473 $style = ''; … … 479 479 echo "<th scope='row' class='check-column'>$checkbox</th>"; 480 480 break; 481 481 case 'name': 482 echo "<td class='plugin-title'$style><strong>$plugin_name</strong>"; 483 echo $this->row_actions( $actions, true ); 482 if( $primary == $column_name ) { 483 echo "<td class='plugin-title has-row-actions'$style><strong>$plugin_name</strong>"; 484 echo $this->row_actions( $actions, true ); 485 } else { 486 echo "<td class='plugin-title'$style><strong>$plugin_name</strong>"; 487 } 484 488 echo "</td>"; 485 489 break; 486 490 case 'description': 487 echo "<td class='column-description desc'$style> 488 <div class='plugin-description'>$description</div> 491 if( $primary == $column_name ) { 492 echo "<td class='column-description desc has-row-actions'$style>"; 493 } else { 494 echo "<td class='column-description desc'$style>"; 495 } 496 echo "<div class='plugin-description'>$description</div> 489 497 <div class='$class second plugin-version-author-uri'>"; 490 498 491 499 $plugin_meta = array(); … … 517 525 $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status ); 518 526 echo implode( ' | ', $plugin_meta ); 519 527 528 if( $primary == $column_name ) { 529 echo $this->row_actions( $actions, true ); 530 } 520 531 echo "</div></td>"; 521 532 break; 522 533 default: … … 567 578 */ 568 579 do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status ); 569 580 } 581 582 function get_primary_column() { 583 return( 'name' ); 584 } 570 585 } -
wp-admin/includes/class-wp-comments-list-table.php
308 308 ); 309 309 } 310 310 311 function get_primary_column() { 312 return( 'comment' ); 313 } 314 311 315 function display() { 312 316 extract( $this->_args ); 313 317 … … 375 379 $comment_url = esc_url( get_comment_link( $comment->comment_ID ) ); 376 380 $the_comment_status = wp_get_comment_status( $comment->comment_ID ); 377 381 378 if ( $user_can ) {379 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );380 $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );381 382 $url = "comment.php?c=$comment->comment_ID";383 384 $approve_url = esc_url( $url . "&action=approvecomment&$approve_nonce" );385 $unapprove_url = esc_url( $url . "&action=unapprovecomment&$approve_nonce" );386 $spam_url = esc_url( $url . "&action=spamcomment&$del_nonce" );387 $unspam_url = esc_url( $url . "&action=unspamcomment&$del_nonce" );388 $trash_url = esc_url( $url . "&action=trashcomment&$del_nonce" );389 $untrash_url = esc_url( $url . "&action=untrashcomment&$del_nonce" );390 $delete_url = esc_url( $url . "&action=deletecomment&$del_nonce" );391 }392 393 382 echo '<div class="comment-author">'; 394 383 $this->column_author( $comment ); 395 384 echo '</div>'; … … 424 413 </div> 425 414 <?php 426 415 } 427 428 if ( $user_can ) {429 // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash430 $actions = array(431 'approve' => '', 'unapprove' => '',432 'reply' => '',433 'quickedit' => '',434 'edit' => '',435 'spam' => '', 'unspam' => '',436 'trash' => '', 'untrash' => '', 'delete' => ''437 );438 439 if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments440 if ( 'approved' == $the_comment_status )441 $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved' class='vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';442 else if ( 'unapproved' == $the_comment_status )443 $actions['approve'] = "<a href='$approve_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved' class='vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';444 } else {445 $actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';446 $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';447 }448 449 if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {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 */ _x( 'Spam', 'verb' ) . '</a>';451 } elseif ( 'spam' == $the_comment_status ) {452 $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>';453 } elseif ( 'trash' == $the_comment_status ) {454 $actions['untrash'] = "<a href='$untrash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1' class='vim-z vim-destructive'>" . __( 'Restore' ) . '</a>';455 }456 457 if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) {458 $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::delete=1' class='delete vim-d vim-destructive'>" . __( 'Delete Permanently' ) . '</a>';459 } else {460 $actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>';461 }462 463 if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {464 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';465 $actions['quickedit'] = '<a onclick="window.commentReply && commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\' );return false;" class="vim-q" title="'.esc_attr__( 'Quick Edit' ).'" href="#">' . __( 'Quick Edit' ) . '</a>';466 $actions['reply'] = '<a onclick="window.commentReply && commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\' );return false;" class="vim-r" title="'.esc_attr__( 'Reply to this comment' ).'" href="#">' . __( 'Reply' ) . '</a>';467 }468 469 /** This filter is documented in wp-admin/includes/dashboard.php */470 $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );471 472 $i = 0;473 echo '<div class="row-actions">';474 foreach ( $actions as $action => $link ) {475 ++$i;476 ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';477 478 // Reply and quickedit need a hide-if-no-js span when not added with ajax479 if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') )480 $action .= ' hide-if-no-js';481 elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {482 if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) )483 $action .= ' approve';484 else485 $action .= ' unapprove';486 }487 488 echo "<span class='$action'>$sep$link</span>";489 }490 echo '</div>';491 }492 416 } 493 417 494 418 function column_author( $comment ) { … … 564 488 */ 565 489 do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID ); 566 490 } 491 492 function handle_actions( $comment, $column_name, $primary ) { 493 global $comment_status; 494 $post = get_post(); 495 496 $user_can = $this->user_can; 497 498 $comment_url = esc_url( get_comment_link( $comment->comment_ID ) ); 499 $the_comment_status = wp_get_comment_status( $comment->comment_ID ); 500 501 if( $primary == $column_name ) { 502 if ( $user_can ) { 503 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); 504 $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); 505 506 $url = "comment.php?c=$comment->comment_ID"; 507 508 $approve_url = esc_url( $url . "&action=approvecomment&$approve_nonce" ); 509 $unapprove_url = esc_url( $url . "&action=unapprovecomment&$approve_nonce" ); 510 $spam_url = esc_url( $url . "&action=spamcomment&$del_nonce" ); 511 $unspam_url = esc_url( $url . "&action=unspamcomment&$del_nonce" ); 512 $trash_url = esc_url( $url . "&action=trashcomment&$del_nonce" ); 513 $untrash_url = esc_url( $url . "&action=untrashcomment&$del_nonce" ); 514 $delete_url = esc_url( $url . "&action=deletecomment&$del_nonce" ); 515 516 // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash 517 $actions = array( 518 'approve' => '', 'unapprove' => '', 519 'reply' => '', 520 'quickedit' => '', 521 'edit' => '', 522 'spam' => '', 'unspam' => '', 523 'trash' => '', 'untrash' => '', 'delete' => '' 524 ); 525 526 if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments 527 if ( 'approved' == $the_comment_status ) 528 $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved' class='vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; 529 else if ( 'unapproved' == $the_comment_status ) 530 $actions['approve'] = "<a href='$approve_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved' class='vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; 531 } else { 532 $actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; 533 $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; 534 } 535 536 if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) { 537 $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>'; 538 } elseif ( 'spam' == $the_comment_status ) { 539 $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>'; 540 } elseif ( 'trash' == $the_comment_status ) { 541 $actions['untrash'] = "<a href='$untrash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1' class='vim-z vim-destructive'>" . __( 'Restore' ) . '</a>'; 542 } 543 544 if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) { 545 $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::delete=1' class='delete vim-d vim-destructive'>" . __( 'Delete Permanently' ) . '</a>'; 546 } else { 547 $actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>'; 548 } 549 550 if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) { 551 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>'; 552 $actions['quickedit'] = '<a onclick="window.commentReply && commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\' );return false;" class="vim-q" title="'.esc_attr__( 'Quick Edit' ).'" href="#">' . __( 'Quick Edit' ) . '</a>'; 553 $actions['reply'] = '<a onclick="window.commentReply && commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\' );return false;" class="vim-r" title="'.esc_attr__( 'Reply to this comment' ).'" href="#">' . __( 'Reply' ) . '</a>'; 554 } 555 556 /** This filter is documented in wp-admin/includes/dashboard.php */ 557 $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); 558 559 $i = 0; 560 $actions_handled = '<div class="row-actions">'; 561 foreach ( $actions as $action => $link ) { 562 ++$i; 563 ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; 564 565 // Reply and quickedit need a hide-if-no-js span when not added with ajax 566 if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') ) 567 $action .= ' hide-if-no-js'; 568 elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) { 569 if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) 570 $action .= ' approve'; 571 else 572 $action .= ' unapprove'; 573 } 574 575 $actions_handled .= "<span class='$action'>$sep$link</span>"; 576 } 577 $actions_handled .= '</div>'; 578 return( $actions_handled ); 579 } 580 } 581 } 567 582 } 568 583 569 584 /** -
wp-admin/includes/class-wp-ms-sites-list-table.php
177 177 ); 178 178 } 179 179 180 function get_primary_column() { 181 return( 'blogname' ); 182 } 183 180 184 function display_rows() { 181 185 global $mode; 182 186 … … 214 218 215 219 $blogname = ( is_subdomain_install() ) ? str_replace( '.' . get_current_site()->domain, '', $blog['domain'] ) : $blog['path']; 216 220 217 list( $columns, $hidden ) = $this->get_column_info();221 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 218 222 219 223 foreach ( $columns as $column_name => $column_display_name ) { 220 224 $style = ''; … … 240 244 break; 241 245 242 246 case 'blogname': 243 echo "<td class='column-$column_name $column_name'$style>"; ?> 247 if( $primary == $column_name ) { 248 echo "<td class='column-$column_name $column_name has-row-actions'$style>"; 249 } else { 250 echo "<td class='column-$column_name $column_name'$style>"; 251 } 252 ?> 244 253 <a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a> 245 254 <?php 246 255 if ( 'list' != $mode ) { … … 249 258 restore_current_blog(); 250 259 } 251 260 252 // Preordered. 253 $actions = array( 254 'edit' => '', 'backend' => '', 255 'activate' => '', 'deactivate' => '', 256 'archive' => '', 'unarchive' => '', 257 'spam' => '', 'unspam' => '', 258 'delete' => '', 259 'visit' => '', 260 ); 261 echo $this->handle_actions( $blog, $column_name, $primary ); 261 262 262 $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>';263 $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>';264 if ( get_current_site()->blog_id != $blog['blog_id'] ) {265 if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )266 $actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>';267 else268 $actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Deactivate' ) . '</a></span>';269 270 if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' )271 $actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Unarchive' ) . '</a></span>';272 else273 $actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>';274 275 if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' )276 $actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>';277 else278 $actions['spam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Spam', 'site' ) . '</a></span>';279 280 if ( current_user_can( 'delete_site', $blog['blog_id'] ) )281 $actions['delete'] = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Delete' ) . '</a></span>';282 }283 284 $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>';285 286 /**287 * Filter the action links displayed for each site in the Sites list table.288 *289 * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by290 * default for each site. The site's status determines whether to show the291 * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and292 * 'Not Spam' or 'Spam' link for each site.293 *294 * @since 3.1.0295 *296 * @param array $actions An array of action links to be displayed.297 * @param int $blog_id The site ID.298 * @param string $blogname Site path, formatted depending on whether it is a sub-domain299 * or subdirectory multisite install.300 */301 $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname );302 echo $this->row_actions( $actions );303 263 ?> 304 264 </td> 305 265 <?php 306 266 break; 307 267 308 268 case 'lastupdated': 309 echo "<td class='$column_name column-$column_name'$style>"; 269 if( $primary == $column_name ) { 270 echo "<td class='$column_name column-$column_name has-row-actions'$style>"; 271 } else { 272 echo "<td class='$column_name column-$column_name'$style>"; 273 } 310 274 if ( 'list' == $mode ) 311 275 $date = 'Y/m/d'; 312 276 else 313 277 $date = 'Y/m/d \<\b\r \/\> g:i:s a'; 314 echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); ?> 278 echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); 279 echo $this->handle_actions( $blog, $column_name, $primary ); 280 ?> 315 281 </td> 316 282 <?php 317 283 break; 318 284 case 'registered': 319 echo "<td class='$column_name column-$column_name'$style>"; 285 if( $primary == $column_name ) { 286 echo "<td class='$column_name column-$column_name has-row-actions'$style>"; 287 } else { 288 echo "<td class='$column_name column-$column_name'$style>"; 289 } 320 290 if ( $blog['registered'] == '0000-00-00 00:00:00' ) 321 291 echo '—'; 322 292 else 323 293 echo mysql2date( $date, $blog['registered'] ); 294 295 echo $this->handle_actions( $blog, $column_name, $primary ); 324 296 ?> 325 297 </td> 326 298 <?php 327 299 break; 328 300 case 'users': 329 echo "<td class='$column_name column-$column_name'$style>"; 301 if( $primary == $column_name ) { 302 echo "<td class='$column_name column-$column_name has-row-actions'$style>"; 303 } else { 304 echo "<td class='$column_name column-$column_name'$style>"; 305 } 330 306 $blogusers = get_users( array( 'blog_id' => $blog['blog_id'], 'number' => 6) ); 331 307 if ( is_array( $blogusers ) ) { 332 308 $blogusers_warning = ''; … … 343 319 if ( $blogusers_warning != '' ) 344 320 echo '<strong>' . $blogusers_warning . '</strong><br />'; 345 321 } 322 echo $this->handle_actions( $blog, $column_name, $primary ); 346 323 ?> 347 324 </td> 348 325 <?php … … 350 327 351 328 case 'plugins': ?> 352 329 <?php if ( has_filter( 'wpmublogsaction' ) ) { 353 echo "<td class='$column_name column-$column_name'$style>"; 330 if( $primary == $column_name ) { 331 echo "<td class='$column_name column-$column_name has-row-actions'$style>"; 332 } else { 333 echo "<td class='$column_name column-$column_name'$style>"; 334 } 354 335 /** 355 336 * Fires inside the auxiliary 'Actions' column of the Sites list table. 356 337 * … … 360 341 * 361 342 * @param int $blog_id The site ID. 362 343 */ 363 do_action( 'wpmublogsaction', $blog['blog_id'] ); ?> 344 do_action( 'wpmublogsaction', $blog['blog_id'] ); 345 echo $this->handle_actions( $blog, $column_name, $primary ); ?> 364 346 </td> 365 347 <?php } 366 348 break; 367 349 368 350 default: 369 echo "<td class='$column_name column-$column_name'$style>"; 351 if( $primary == $column_name ) { 352 echo "<td class='$column_name column-$column_name has-row-actions'$style>"; 353 } else { 354 echo "<td class='$column_name column-$column_name'$style>"; 355 } 370 356 /** 371 357 * Fires for each registered custom column in the Sites list table. 372 358 * … … 376 362 * @param int $blog_id The site ID. 377 363 */ 378 364 do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] ); 365 echo $this->handle_actions( $blog, $column_name, $primary ); 379 366 echo "</td>"; 380 367 break; 381 368 } … … 385 372 <?php 386 373 } 387 374 } 375 376 function handle_actions( $blog, $column_name, $primary ) { 377 global $current_site; 378 if( $primary == $column_name ) { 379 $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path']; 380 // Preordered. 381 $actions = array( 382 'edit' => '', 'backend' => '', 383 'activate' => '', 'deactivate' => '', 384 'archive' => '', 'unarchive' => '', 385 'spam' => '', 'unspam' => '', 386 'delete' => '', 387 'visit' => '', 388 ); 389 390 $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>'; 391 $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>'; 392 if ( get_current_site()->blog_id != $blog['blog_id'] ) { 393 if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' ) 394 $actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>'; 395 else 396 $actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Deactivate' ) . '</a></span>'; 397 398 if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' ) 399 $actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Unarchive' ) . '</a></span>'; 400 else 401 $actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>'; 402 403 if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' ) 404 $actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>'; 405 else 406 $actions['spam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Spam', 'site' ) . '</a></span>'; 407 408 if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) 409 $actions['delete'] = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Delete' ) . '</a></span>'; 410 } 411 412 $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>'; 413 414 /** 415 * Filter the action links displayed for each site in the Sites list table. 416 * 417 * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by 418 * default for each site. The site's status determines whether to show the 419 * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and 420 * 'Not Spam' or 'Spam' link for each site. 421 * 422 * @since 3.1.0 423 * 424 * @param array $actions An array of action links to be displayed. 425 * @param int $blog_id The site ID. 426 * @param string $blogname Site path, formatted depending on whether it is a sub-domain 427 * or subdirectory multisite install. 428 */ 429 $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); 430 return( $this->row_actions( $actions ) ); 431 } 432 } 388 433 } -
wp-admin/includes/class-wp-posts-list-table.php
553 553 <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>"> 554 554 <?php 555 555 556 list( $columns, $hidden ) = $this->get_column_info();556 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 557 557 558 558 foreach ( $columns as $column_name => $column_display_name ) { 559 $class = "class=\"$column_name column-$column_name\""; 559 if ( $primary == $column_name ) { 560 $class = "class=\"$column_name column-$column_name has-row-actions\""; 561 } else { 562 $class = "class=\"$column_name column-$column_name\""; 563 } 560 564 561 565 $style = ''; 562 566 if ( in_array( $column_name, $hidden ) ) … … 584 588 break; 585 589 586 590 case 'title': 587 $attributes = 'class="post-title page-title column-title"' . $style; 591 if ( $primary == $column_name ) { 592 $attributes = 'class="post-title page-title column-title has_row_actions"'; 593 } else { 594 $attributes = 'class="post-title page-title column-title"'; 595 } 596 $attributes .= $style; 597 588 598 if ( $this->hierarchical_display ) { 589 599 if ( 0 == $level && (int) $post->post_parent > 0 ) { 590 600 //sent level 0 by accident, by default, or because we don't know the actual level … … 641 651 if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) ) 642 652 the_excerpt(); 643 653 644 $actions = array(); 645 if ( $can_edit_post && 'trash' != $post->post_status ) { 646 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>'; 647 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick Edit' ) . '</a>'; 648 } 649 if ( current_user_can( 'delete_post', $post->ID ) ) { 650 if ( 'trash' == $post->post_status ) 651 $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; 652 elseif ( EMPTY_TRASH_DAYS ) 653 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; 654 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) 655 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 656 } 657 if ( $post_type_object->public ) { 658 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { 659 if ( $can_edit_post ) { 654 echo $this->handle_actions( $post, $column_name, $primary ); 660 655 661 /** This filter is documented in wp-admin/includes/meta-boxes.php */662 $actions['view'] = '<a href="' . esc_url( apply_filters( 'preview_post_link', set_url_scheme( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';663 }664 } elseif ( 'trash' != $post->post_status ) {665 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';666 }667 }668 669 if ( is_post_type_hierarchical( $post->post_type ) ) {670 671 /**672 * Filter the array of row action links on the Pages list table.673 *674 * The filter is evaluated only for hierarchical post types.675 *676 * @since 2.8.0677 *678 * @param array $actions An array of row action links. Defaults are679 * 'Edit', 'Quick Edit', 'Restore, 'Trash',680 * 'Delete Permanently', 'Preview', and 'View'.681 * @param WP_Post $post The post object.682 */683 $actions = apply_filters( 'page_row_actions', $actions, $post );684 } else {685 686 /**687 * Filter the array of row action links on the Posts list table.688 *689 * The filter is evaluated only for non-hierarchical post types.690 *691 * @since 2.8.0692 *693 * @param array $actions An array of row action links. Defaults are694 * 'Edit', 'Quick Edit', 'Restore, 'Trash',695 * 'Delete Permanently', 'Preview', and 'View'.696 * @param WP_Post $post The post object.697 */698 $actions = apply_filters( 'post_row_actions', $actions, $post );699 }700 701 echo $this->row_actions( $actions );702 703 656 get_inline_data( $post ); 704 657 echo '</td>'; 705 658 break; … … 755 708 } else { 756 709 _e( 'Last Modified' ); 757 710 } 711 echo $this->handle_actions( $post, $column_name, $primary ); 758 712 echo '</td>'; 759 713 break; 760 714 … … 766 720 767 721 $this->comments_bubble( $post->ID, $pending_comments ); 768 722 ?> 769 </div>< /td>723 </div><?php echo $this->handle_actions( $post, $column_name, $primary ); ?></td> 770 724 <?php 771 725 break; 772 726 … … 777 731 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )), 778 732 get_the_author() 779 733 ); 734 echo $this->handle_actions( $post, $column_name, $primary ); 780 735 ?></td> 781 736 <?php 782 737 break; … … 817 772 } else { 818 773 echo '—'; 819 774 } 775 echo $this->handle_actions( $post, $column_name, $primary ); 820 776 echo '</td>'; 821 777 break; 822 778 } … … 863 819 * @param int $post_id The current post ID. 864 820 */ 865 821 do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID ); 822 echo $this->handle_actions( $post, $column_name, $primary ); 866 823 ?></td> 867 824 <?php 868 825 break; … … 874 831 $GLOBALS['post'] = $global_post; 875 832 } 876 833 834 function get_primary_column() { 835 return( 'title' ); 836 } 837 838 function handle_actions( $post, $column_name, $primary ) { 839 $title = _draft_or_post_title(); 840 if ( $primary == $column_name ) { 841 $post_type_object = get_post_type_object( $post->post_type ); 842 $can_edit_post = current_user_can( 'edit_post', $post->ID ); 843 $actions = array(); 844 if ( $can_edit_post && 'trash' != $post->post_status ) { 845 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>'; 846 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick Edit' ) . '</a>'; 847 } 848 if ( current_user_can( 'delete_post', $post->ID ) ) { 849 if ( 'trash' == $post->post_status ) 850 $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; 851 elseif ( EMPTY_TRASH_DAYS ) 852 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; 853 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) 854 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 855 } 856 if ( $post_type_object->public ) { 857 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { 858 if ( $can_edit_post ) { 859 860 /** This filter is documented in wp-admin/includes/meta-boxes.php */ 861 $actions['view'] = '<a href="' . esc_url( apply_filters( 'preview_post_link', set_url_scheme( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>'; 862 } 863 } elseif ( 'trash' != $post->post_status ) { 864 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 865 } 866 } 867 868 if ( is_post_type_hierarchical( $post->post_type ) ) { 869 870 /** 871 * Filter the array of row action links on the Pages list table. 872 * 873 * The filter is evaluated only for hierarchical post types. 874 * 875 * @since 2.8.0 876 * 877 * @param array $actions An array of row action links. Defaults are 878 * 'Edit', 'Quick Edit', 'Restore, 'Trash', 879 * 'Delete Permanently', 'Preview', and 'View'. 880 * @param WP_Post $post The post object. 881 */ 882 $actions = apply_filters( 'page_row_actions', $actions, $post ); 883 } else { 884 885 /** 886 * Filter the array of row action links on the Posts list table. 887 * 888 * The filter is evaluated only for non-hierarchical post types. 889 * 890 * @since 2.8.0 891 * 892 * @param array $actions An array of row action links. Defaults are 893 * 'Edit', 'Quick Edit', 'Restore, 'Trash', 894 * 'Delete Permanently', 'Preview', and 'View'. 895 * @param WP_Post $post The post object. 896 */ 897 $actions = apply_filters( 'post_row_actions', $actions, $post ); 898 } 899 900 return( $this->row_actions( $actions ) ); 901 } 902 } 903 877 904 /** 878 905 * Outputs the hidden row displayed when inline editing 879 906 * -
wp-admin/includes/class-wp-media-list-table.php
212 212 <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $alt . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>'> 213 213 <?php 214 214 215 list( $columns, $hidden ) = $this->get_column_info();215 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 216 216 foreach ( $columns as $column_name => $column_display_name ) { 217 $class = "class='$column_name column-$column_name'"; 217 if( $primary == $column_name ) { 218 $class = "class='$column_name column-$column_name has-row-actions'"; 219 } else { 220 $class = "class='$column_name column-$column_name'"; 221 } 218 222 219 223 $style = ''; 220 224 if ( in_array( $column_name, $hidden ) ) … … 275 279 ?> 276 280 </p> 277 281 <?php 278 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 282 if( $primary == $column_name ) { 283 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 284 } 279 285 ?> 280 286 </td> 281 287 <?php … … 288 294 esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ), 289 295 get_the_author() 290 296 ); 297 if( $primary == $column_name ) { 298 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 299 } 291 300 ?></td> 292 301 <?php 293 302 break; 294 303 295 304 case 'desc': 296 305 ?> 297 <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?> </td>306 <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?> 298 307 <?php 308 if( $primary == $column_name ) { 309 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 310 } 311 echo '</td>'; 299 312 break; 300 313 301 314 case 'date': … … 314 327 } 315 328 } 316 329 ?> 317 <td <?php echo $attributes ?>><?php echo $h_time ?> </td>330 <td <?php echo $attributes ?>><?php echo $h_time ?> 318 331 <?php 332 if( $primary == $column_name ) { 333 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 334 } 335 echo '</td>'; 319 336 break; 320 337 321 338 case 'parent': … … 336 353 echo $title; 337 354 } ?></strong>, 338 355 <?php echo get_the_time( __( 'Y/m/d' ) ); ?> 339 </td>340 356 <?php 341 357 } else { 342 358 ?> … … 346 362 onclick="findPosts.open( 'media[]','<?php echo $post->ID ?>' ); return false;" 347 363 href="#the-list"> 348 364 <?php _e( 'Attach' ); ?></a> 349 <?php } ?> </td>365 <?php } ?> 350 366 <?php 351 367 } 368 if( $primary == $column_name ) { 369 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 370 } 352 371 break; 353 372 354 373 case 'comments': … … 362 381 $this->comments_bubble( $post->ID, $pending_comments ); 363 382 ?> 364 383 </div> 365 </td>366 384 <?php 385 if( $primary == $column_name ) { 386 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 387 } 388 echo '</td>'; 367 389 break; 368 390 369 391 default: … … 396 418 } else { 397 419 echo '—'; 398 420 } 421 422 if( $primary == $column_name ) { 423 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 424 } 399 425 echo '</td>'; 400 426 break; 401 427 } … … 413 439 * @param int $post_id Attachment ID. 414 440 */ 415 441 ?> 416 <?php do_action( 'manage_media_custom_column', $column_name, $post->ID ); ?> 442 <?php do_action( 'manage_media_custom_column', $column_name, $post->ID ); 443 if( $primary == $column_name ) { 444 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 445 } 446 ?> 417 447 </td> 418 448 <?php 419 449 break; … … 424 454 <?php endwhile; 425 455 } 426 456 457 function get_primary_column() { 458 return( 'title' ); 459 } 460 427 461 function _get_row_actions( $post, $att_title ) { 428 462 $actions = array(); 429 463 -
wp-admin/includes/class-wp-terms-list-table.php
264 264 265 265 function column_name( $tag ) { 266 266 $taxonomy = $this->screen->taxonomy; 267 $tax = get_taxonomy( $taxonomy );268 267 269 $default_term = get_option( 'default_' . $taxonomy );270 271 268 $pad = str_repeat( '— ', max( 0, $this->level ) ); 272 269 273 270 /** … … 289 286 $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) ); 290 287 291 288 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a></strong><br />'; 292 293 $actions = array();294 if ( current_user_can( $tax->cap->edit_terms ) ) {295 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';296 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>';297 }298 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )299 $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>";300 if ( $tax->public )301 $actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>';302 303 /**304 * Filter the action links displayed for each term in the Tags list table.305 *306 * @since 2.8.0307 * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead.308 *309 * @param array $actions An array of action links to be displayed. Default310 * 'Edit', 'Quick Edit', 'Delete', and 'View'.311 * @param object $tag Term object.312 */313 $actions = apply_filters( 'tag_row_actions', $actions, $tag );314 315 /**316 * Filter the action links displayed for each term in the terms list table.317 *318 * The dynamic portion of the hook name, $taxonomy, refers to the taxonomy slug.319 *320 * @since 3.0.0321 *322 * @param array $actions An array of action links to be displayed. Default323 * 'Edit', 'Quick Edit', 'Delete', and 'View'.324 * @param object $tag Term object.325 */326 $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );327 328 $out .= $this->row_actions( $actions );329 289 $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">'; 330 290 $out .= '<div class="name">' . $qe_data->name . '</div>'; 331 291 … … 392 352 return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $tag->term_id ); 393 353 } 394 354 355 function get_primary_column() { 356 return( 'name' ); 357 } 358 359 function handle_actions( $tag, $column_name, $primary ) { 360 $taxonomy = $this->screen->taxonomy; 361 $tax = get_taxonomy( $taxonomy ); 362 363 $default_term = get_option( 'default_' . $taxonomy ); 364 365 $pad = str_repeat( '— ', max( 0, $this->level ) ); 366 $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) ); 367 if( $primary == $column_name ) { 368 $actions = array(); 369 if ( current_user_can( $tax->cap->edit_terms ) ) { 370 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 371 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>'; 372 } 373 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) 374 $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>"; 375 if ( $tax->public ) 376 $actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>'; 377 378 /** 379 * Filter the action links displayed for each term in the Tags list table. 380 * 381 * @since 2.8.0 382 * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead. 383 * 384 * @param array $actions An array of action links to be displayed. Default 385 * 'Edit', 'Quick Edit', 'Delete', and 'View'. 386 * @param object $tag Term object. 387 */ 388 $actions = apply_filters( 'tag_row_actions', $actions, $tag ); 389 390 /** 391 * Filter the action links displayed for each term in the terms list table. 392 * 393 * The dynamic portion of the hook name, $taxonomy, refers to the taxonomy slug. 394 * 395 * @since 3.0.0 396 * 397 * @param array $actions An array of action links to be displayed. Default 398 * 'Edit', 'Quick Edit', 'Delete', and 'View'. 399 * @param object $tag Term object. 400 */ 401 $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag ); 402 403 return( $this->row_actions( $actions ) ); 404 } 405 } 406 395 407 /** 396 408 * Outputs the hidden row displayed when inline editing 397 409 * -
wp-admin/includes/class-wp-users-list-table.php
381 381 * @param WP_User $user_object WP_User object for the currently-listed user. 382 382 */ 383 383 $actions = apply_filters( 'user_row_actions', $actions, $user_object ); 384 $edit .= $this->row_actions( $actions );385 384 386 385 // Set up the checkbox ( because the user is editable, otherwise it's empty ) 387 386 $checkbox = '<label class="screen-reader-text" for="cb-select-' . $user_object->ID . '">' . sprintf( __( 'Select %s' ), $user_object->user_login ) . '</label>' … … 395 394 396 395 $r = "<tr id='user-$user_object->ID'$style>"; 397 396 398 list( $columns, $hidden ) = $this->get_column_info();397 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 399 398 400 399 foreach ( $columns as $column_name => $column_display_name ) { 401 $class = "class=\"$column_name column-$column_name\""; 400 if( $primary == $column_name ) { 401 $class = "class=\"$column_name column-$column_name has-row-actions\""; 402 } else { 403 $class = "class=\"$column_name column-$column_name\""; 404 } 402 405 403 406 $style = ''; 404 407 if ( in_array( $column_name, $hidden ) ) … … 411 414 $r .= "<th scope='row' class='check-column'>$checkbox</th>"; 412 415 break; 413 416 case 'username': 414 $r .= "<td $attributes>$avatar $edit </td>";417 $r .= "<td $attributes>$avatar $edit"; 415 418 break; 416 419 case 'name': 417 $r .= "<td $attributes>$user_object->first_name $user_object->last_name </td>";420 $r .= "<td $attributes>$user_object->first_name $user_object->last_name"; 418 421 break; 419 422 case 'email': 420 $r .= "<td $attributes><a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a> </td>";423 $r .= "<td $attributes><a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a>"; 421 424 break; 422 425 case 'role': 423 $r .= "<td $attributes>$role_name </td>";426 $r .= "<td $attributes>$role_name"; 424 427 break; 425 428 case 'posts': 426 429 $attributes = 'class="posts column-posts num"' . $style; … … 432 435 } else { 433 436 $r .= 0; 434 437 } 435 $r .= "</td>";436 438 break; 437 439 default: 438 440 $r .= "<td $attributes>"; … … 449 451 $r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID ); 450 452 $r .= "</td>"; 451 453 } 454 455 if( $primary == $column_name ) { 456 $r .= $this->row_actions( $actions ); 457 } 458 $r .= '</td>'; 452 459 } 453 460 $r .= '</tr>'; 454 461 455 462 return $r; 456 463 } 464 465 function get_primary_column() { 466 return( 'username' ); 467 } 457 468 } -
wp-admin/includes/class-wp-list-table.php
625 625 } 626 626 627 627 /** 628 * Get name of primary column. 629 * 630 * @return string 631 */ 632 function get_primary_column() { 633 return( '' ); 634 } 635 636 /** 628 637 * Get a list of all, hidden and sortable columns, with filter applied 629 638 * 630 639 * @since 3.1.0 … … 664 673 $sortable[$id] = $data; 665 674 } 666 675 667 $this->_column_headers = array( $columns, $hidden, $sortable ); 676 $primary = $this->get_primary_column(); 677 $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); 668 678 669 679 return $this->_column_headers; 670 680 } … … 885 895 * @param object $item The current item 886 896 */ 887 897 function single_row_columns( $item ) { 888 list( $columns, $hidden ) = $this->get_column_info();898 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 889 899 890 900 foreach ( $columns as $column_name => $column_display_name ) { 891 $class = "class='$column_name column-$column_name'"; 901 if ( $primary == $column_name ) { 902 $class = "class='$column_name column-$column_name has-row-actions'"; 903 } else { 904 $class = "class='$column_name column-$column_name'"; 905 } 892 906 893 907 $style = ''; 894 908 if ( in_array( $column_name, $hidden ) ) … … 904 918 elseif ( method_exists( $this, 'column_' . $column_name ) ) { 905 919 echo "<td $attributes>"; 906 920 echo call_user_func( array( $this, 'column_' . $column_name ), $item ); 921 echo $this->handle_actions( $item, $column_name, $primary ); 907 922 echo "</td>"; 908 923 } 909 924 else { … … 915 930 } 916 931 917 932 /** 933 * Generate and display row actions links 934 */ 935 function handle_actions( $post, $column_name, $primary ) { 936 if( $primary == $column_name ) { 937 return( '' ); 938 } 939 } 940 941 /** 918 942 * Handle an incoming ajax request (called from admin-ajax.php) 919 943 * 920 944 * @since 3.1.0 -
wp-admin/includes/class-wp-ms-themes-list-table.php
190 190 ); 191 191 } 192 192 193 function get_primary_column() { 194 return( 'name' ); 195 } 196 193 197 function get_views() { 194 198 global $totals, $status; 195 199 … … 343 347 344 348 echo "<tr id='$id' class='$class'>"; 345 349 346 list( $columns, $hidden ) = $this->get_column_info();350 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 347 351 348 352 foreach ( $columns as $column_name => $column_display_name ) { 349 353 $style = ''; … … 356 360 break; 357 361 case 'name': 358 362 echo "<td class='theme-title'$style><strong>" . $theme->display('Name') . "</strong>"; 359 echo $this->row_actions( $actions, true );363 if( $primary == $column_name ) echo $this->row_actions( $actions, true ); 360 364 echo "</td>"; 361 365 break; 362 366 case 'description': … … 394 398 $theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $stylesheet, $theme, $status ); 395 399 echo implode( ' | ', $theme_meta ); 396 400 397 echo "</div></td>"; 401 echo "</div>"; 402 if( $primary == $column_name ) echo $this->row_actions( $actions, true ); 403 echo "</td>"; 398 404 break; 399 405 400 406 default: … … 410 416 * @param WP_Theme $theme Current WP_Theme object. 411 417 */ 412 418 do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme ); 419 if( $primary == $column_name ) echo $this->row_actions( $actions, true ); 413 420 echo "</td>"; 414 421 } 415 422 }