Ticket #25408: 25408.2.diff
| File 25408.2.diff, 49.5 KB (added by , 12 years ago) |
|---|
-
class-wp-comments-list-table.php
273 273 ); 274 274 } 275 275 276 function get_primary_column() { 277 return( 'comment' ); 278 } 279 276 280 function display() { 277 281 extract( $this->_args ); 278 282 … … 381 385 </div> 382 386 <?php 383 387 } 384 385 if ( $user_can ) {386 // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash387 $actions = array(388 'approve' => '', 'unapprove' => '',389 'reply' => '',390 'quickedit' => '',391 'edit' => '',392 'spam' => '', 'unspam' => '',393 'trash' => '', 'untrash' => '', 'delete' => ''394 );395 396 if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments397 if ( 'approved' == $the_comment_status )398 $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>';399 else if ( 'unapproved' == $the_comment_status )400 $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>';401 } else {402 $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>';403 $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>';404 }405 406 if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {407 $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>';408 } elseif ( 'spam' == $the_comment_status ) {409 $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>';410 } elseif ( 'trash' == $the_comment_status ) {411 $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>';412 }413 414 if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) {415 $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>';416 } else {417 $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>';418 }419 420 if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {421 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';422 $actions['quickedit'] = '<a onclick="commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\' );return false;" class="vim-q" title="'.esc_attr__( 'Quick Edit' ).'" href="#">' . __( 'Quick Edit' ) . '</a>';423 $actions['reply'] = '<a onclick="commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\' );return false;" class="vim-r" title="'.esc_attr__( 'Reply to this comment' ).'" href="#">' . __( 'Reply' ) . '</a>';424 }425 426 $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );427 428 $i = 0;429 echo '<div class="row-actions">';430 foreach ( $actions as $action => $link ) {431 ++$i;432 ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';433 434 // Reply and quickedit need a hide-if-no-js span when not added with ajax435 if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') )436 $action .= ' hide-if-no-js';437 elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {438 if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) )439 $action .= ' approve';440 else441 $action .= ' unapprove';442 }443 444 echo "<span class='$action'>$sep$link</span>";445 }446 echo '</div>';447 }448 388 } 449 389 450 390 function column_author( $comment ) { … … 512 452 function column_default( $comment, $column_name ) { 513 453 do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID ); 514 454 } 455 456 function handle_actions( $comment, $column_name, $primary ) { 457 global $comment_status; 458 $post = get_post(); 459 460 $user_can = $this->user_can; 461 462 $comment_url = esc_url( get_comment_link( $comment->comment_ID ) ); 463 $the_comment_status = wp_get_comment_status( $comment->comment_ID ); 464 465 if( $primary == $column_name ) { 466 if ( $user_can ) { 467 // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash 468 $actions = array( 469 'approve' => '', 'unapprove' => '', 470 'reply' => '', 471 'quickedit' => '', 472 'edit' => '', 473 'spam' => '', 'unspam' => '', 474 'trash' => '', 'untrash' => '', 'delete' => '' 475 ); 476 477 if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments 478 if ( 'approved' == $the_comment_status ) 479 $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>'; 480 else if ( 'unapproved' == $the_comment_status ) 481 $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>'; 482 } else { 483 $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>'; 484 $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>'; 485 } 486 487 if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) { 488 $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>'; 489 } elseif ( 'spam' == $the_comment_status ) { 490 $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>'; 491 } elseif ( 'trash' == $the_comment_status ) { 492 $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>'; 493 } 494 495 if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) { 496 $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>'; 497 } else { 498 $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>'; 499 } 500 501 if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) { 502 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>'; 503 $actions['quickedit'] = '<a onclick="commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\' );return false;" class="vim-q" title="'.esc_attr__( 'Quick Edit' ).'" href="#">' . __( 'Quick Edit' ) . '</a>'; 504 $actions['reply'] = '<a onclick="commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\' );return false;" class="vim-r" title="'.esc_attr__( 'Reply to this comment' ).'" href="#">' . __( 'Reply' ) . '</a>'; 505 } 506 507 $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); 508 509 $i = 0; 510 $actions_handled = '<div class="row-actions">'; 511 foreach ( $actions as $action => $link ) { 512 ++$i; 513 ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; 514 515 // Reply and quickedit need a hide-if-no-js span when not added with ajax 516 if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') ) 517 $action .= ' hide-if-no-js'; 518 elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) { 519 if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) 520 $action .= ' approve'; 521 else 522 $action .= ' unapprove'; 523 } 524 525 $actions_handled .= "<span class='$action'>$sep$link</span>"; 526 } 527 $actions_handled .= '</div>'; 528 return( $actions_handled ); 529 } 530 } 531 } 532 515 533 } 516 534 517 535 /** -
class-wp-list-table.php
600 600 } 601 601 602 602 /** 603 * Get name of primary column. 604 * 605 * @return string 606 */ 607 function get_primary_column() { 608 return( '' ); 609 } 610 611 /** 603 612 * Get a list of all, hidden and sortable columns, with filter applied 604 613 * 605 614 * @since 3.1.0 … … 628 637 $sortable[$id] = $data; 629 638 } 630 639 631 $ this->_column_headers = array( $columns, $hidden, $sortable);640 $primary = $this->get_primary_column(); 632 641 642 $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); 643 633 644 return $this->_column_headers; 634 645 } 635 646 … … 849 860 * @param object $item The current item 850 861 */ 851 862 function single_row_columns( $item ) { 852 list( $columns, $hidden ) = $this->get_column_info(); 853 863 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 854 864 foreach ( $columns as $column_name => $column_display_name ) { 855 $class = "class='$column_name column-$column_name'"; 865 if ( $primary == $column_name ) { 866 $class = "class='$column_name column-$column_name has-row-actions'"; 867 } else { 868 $class = "class='$column_name column-$column_name'"; 869 } 856 870 857 871 $style = ''; 858 872 if ( in_array( $column_name, $hidden ) ) … … 868 882 elseif ( method_exists( $this, 'column_' . $column_name ) ) { 869 883 echo "<td $attributes>"; 870 884 echo call_user_func( array( $this, 'column_' . $column_name ), $item ); 885 echo $this->handle_actions( $item, $column_name, $primary ); 871 886 echo "</td>"; 872 887 } 873 888 else { … … 879 894 } 880 895 881 896 /** 897 * Generate and display row actions links 898 */ 899 function handle_actions( $post, $column_name, $primary ) { 900 if( $primary == $column_name ) { 901 return( '' ); 902 } 903 } 904 905 /** 882 906 * Handle an incoming ajax request (called from admin-ajax.php) 883 907 * 884 908 * @since 3.1.0 -
class-wp-media-list-table.php
194 194 <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $alt . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top"> 195 195 <?php 196 196 197 list( $columns, $hidden ) = $this->get_column_info();197 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 198 198 foreach ( $columns as $column_name => $column_display_name ) { 199 $class = "class='$column_name column-$column_name'";200 199 200 if( $primary == $column_name ) { 201 $class = "class='$column_name column-$column_name has-row-actions'"; 202 } else { 203 $class = "class='$column_name column-$column_name'"; 204 } 205 201 206 $style = ''; 202 207 if ( in_array( $column_name, $hidden ) ) 203 208 $style = ' style="display:none;"'; … … 257 262 ?> 258 263 </p> 259 264 <?php 260 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 265 if( $primary == $column_name ) { 266 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 267 } 261 268 ?> 262 269 </td> 263 270 <?php … … 270 277 esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ), 271 278 get_the_author() 272 279 ); 280 if( $primary == $column_name ) { 281 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 282 } 273 283 ?></td> 274 284 <?php 275 285 break; … … 276 286 277 287 case 'desc': 278 288 ?> 279 <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?> </td>289 <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?> 280 290 <?php 291 if( $primary == $column_name ) { 292 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 293 } 294 echo '</td>'; 281 295 break; 282 296 283 297 case 'date': … … 296 310 } 297 311 } 298 312 ?> 299 <td <?php echo $attributes ?>><?php echo $h_time ?> </td>313 <td <?php echo $attributes ?>><?php echo $h_time ?> 300 314 <?php 315 if( $primary == $column_name ) { 316 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 317 } 318 echo '</td>'; 301 319 break; 302 320 303 321 case 'parent': … … 318 336 echo $title; 319 337 } ?></strong>, 320 338 <?php echo get_the_time( __( 'Y/m/d' ) ); ?> 321 </td>322 339 <?php 323 340 } else { 324 341 ?> … … 328 345 onclick="findPosts.open( 'media[]','<?php echo $post->ID ?>' ); return false;" 329 346 href="#the-list"> 330 347 <?php _e( 'Attach' ); ?></a> 331 <?php } ?> </td>348 <?php } ?> 332 349 <?php 333 350 } 351 if( $primary == $column_name ) { 352 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 353 } 354 echo '</td>'; 334 355 break; 335 356 336 357 case 'comments': … … 344 365 $this->comments_bubble( $post->ID, $pending_comments ); 345 366 ?> 346 367 </div> 347 </td>348 368 <?php 369 if( $primary == $column_name ) { 370 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 371 } 372 echo '</td>'; 349 373 break; 350 374 351 375 default: … … 378 402 } else { 379 403 echo '—'; 380 404 } 405 406 if( $primary == $column_name ) { 407 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 408 } 381 409 echo '</td>'; 382 410 break; 383 411 } 384 412 ?> 385 413 <td <?php echo $attributes ?>> 386 <?php do_action( 'manage_media_custom_column', $column_name, $post->ID ); ?> 414 <?php 415 do_action( 'manage_media_custom_column', $column_name, $post->ID ); 416 if( $primary == $column_name ) { 417 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 418 } 419 ?> 387 420 </td> 388 421 <?php 389 422 break; … … 394 427 <?php endwhile; 395 428 } 396 429 430 function get_primary_column() { 431 return( 'title' ); 432 } 433 397 434 function _get_row_actions( $post, $att_title ) { 398 435 $actions = array(); 399 436 -
class-wp-ms-sites-list-table.php
167 167 ); 168 168 } 169 169 170 function get_primary_column() { 171 return( 'blogname' ); 172 } 173 170 174 function display_rows() { 171 175 global $current_site, $mode; 172 176 … … 204 208 205 209 $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path']; 206 210 207 list( $columns, $hidden ) = $this->get_column_info();211 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 208 212 209 213 foreach ( $columns as $column_name => $column_display_name ) { 210 214 $style = ''; … … 230 234 break; 231 235 232 236 case 'blogname': 233 echo "<td class='column-$column_name $column_name'$style>"; ?> 237 if( $primary == $column_name ) { 238 echo "<td class='column-$column_name $column_name has-row-actions'$style>"; 239 } else { 240 echo "<td class='column-$column_name $column_name'$style>"; 241 } 242 ?> 234 243 <a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a> 235 244 <?php 236 245 if ( 'list' != $mode ) { … … 239 248 restore_current_blog(); 240 249 } 241 250 242 // Preordered. 243 $actions = array( 244 'edit' => '', 'backend' => '', 245 'activate' => '', 'deactivate' => '', 246 'archive' => '', 'unarchive' => '', 247 'spam' => '', 'unspam' => '', 248 'delete' => '', 249 'visit' => '', 250 ); 251 echo $this->handle_actions( $blog, $column_name, $primary ); 251 252 252 $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>';253 $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>';254 if ( $current_site->blog_id != $blog['blog_id'] ) {255 if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )256 $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>';257 else258 $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>';259 260 if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' )261 $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>';262 else263 $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>';264 265 if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' )266 $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>';267 else268 $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>';269 270 if ( current_user_can( 'delete_site', $blog['blog_id'] ) )271 $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>';272 }273 274 $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>';275 276 $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname );277 echo $this->row_actions( $actions );278 253 ?> 279 254 </td> 280 255 <?php … … 281 256 break; 282 257 283 258 case 'lastupdated': 284 echo "<td valign='top' class='$column_name column-$column_name'$style>"; 259 if( $primary == $column_name ) { 260 echo "<td valign='top' class='$column_name column-$column_name has-row-actions'$style>"; 261 } else { 262 echo "<td valign='top' class='$column_name column-$column_name'$style>"; 263 } 285 264 if ( 'list' == $mode ) 286 265 $date = 'Y/m/d'; 287 266 else 288 267 $date = 'Y/m/d \<\b\r \/\> g:i:s a'; 289 echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); ?> 268 echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); 269 echo $this->handle_actions( $blog, $column_name, $primary ); 270 ?> 290 271 </td> 291 272 <?php 292 273 break; 293 274 case 'registered': 294 echo "<td valign='top' class='$column_name column-$column_name'$style>"; 275 if( $primary == $column_name ) { 276 echo "<td valign='top' class='$column_name column-$column_name has-row-actions'$style>"; 277 } 278 echo "<td valign='top' class='$column_name column-$column_name'$style>"; 279 } 295 280 if ( $blog['registered'] == '0000-00-00 00:00:00' ) 296 281 echo '—'; 297 282 else 298 283 echo mysql2date( $date, $blog['registered'] ); 284 285 echo $this->handle_actions( $blog, $column_name, $primary ); 299 286 ?> 300 287 </td> 301 288 <?php 302 289 break; 303 290 case 'users': 304 echo "<td valign='top' class='$column_name column-$column_name'$style>"; 291 if( $primary == $column_name ) { 292 echo "<td valign='top' class='$column_name column-$column_name'$style>"; 293 } else { 294 echo "<td valign='top' class='$column_name column-$column_name'$style>"; 295 } 305 296 $blogusers = get_users( array( 'blog_id' => $blog['blog_id'], 'number' => 6) ); 306 297 if ( is_array( $blogusers ) ) { 307 298 $blogusers_warning = ''; … … 318 309 if ( $blogusers_warning != '' ) 319 310 echo '<strong>' . $blogusers_warning . '</strong><br />'; 320 311 } 312 echo $this->handle_actions( $blog, $column_name, $primary ); 321 313 ?> 322 314 </td> 323 <?php315 <?php 324 316 break; 325 317 326 case 'plugins': ?> 327 <?php if ( has_filter( 'wpmublogsaction' ) ) { 328 echo "<td valign='top' class='$column_name column-$column_name'$style>"; 329 do_action( 'wpmublogsaction', $blog['blog_id'] ); ?> 318 case 'plugins': 319 if ( has_filter( 'wpmublogsaction' ) ) { 320 if( $primary == $column_name ) { 321 echo "<td valign='top' class='$column_name column-$column_name has-row-actions'$style>"; 322 } else { 323 echo "<td valign='top' class='$column_name column-$column_name'$style>"; 324 } 325 do_action( 'wpmublogsaction', $blog['blog_id'] ); 326 echo $this->handle_actions( $blog, $column_name, $primary ); 327 ?> 330 328 </td> 331 <?php } 329 <?php 330 } 332 331 break; 333 332 334 333 default: 335 echo "<td class='$column_name column-$column_name'$style>"; 334 if( $primary == $column_name ) { 335 echo "<td class='$column_name column-$column_name has-row-actions'$style>"; 336 } else { 337 echo "<td class='$column_name column-$column_name'$style>"; 338 } 336 339 do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] ); 340 echo $this->handle_actions( $blog, $column_name, $primary ); 337 341 echo "</td>"; 338 342 break; 339 343 } … … 343 347 <?php 344 348 } 345 349 } 350 351 function handle_actions( $blog, $column_name, $primary ) { 352 global $current_site; 353 if( $primary == $column_name ) { 354 $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path']; 355 // Preordered. 356 $actions = array( 357 'edit' => '', 'backend' => '', 358 'activate' => '', 'deactivate' => '', 359 'archive' => '', 'unarchive' => '', 360 'spam' => '', 'unspam' => '', 361 'delete' => '', 362 'visit' => '', 363 ); 364 365 $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>'; 366 $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>'; 367 if ( $current_site->blog_id != $blog['blog_id'] ) { 368 if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' ) 369 $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>'; 370 else 371 $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>'; 372 373 if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' ) 374 $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>'; 375 else 376 $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>'; 377 378 if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' ) 379 $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>'; 380 else 381 $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>'; 382 383 if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) 384 $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>'; 385 } 386 387 $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>'; 388 389 $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); 390 return( $this->row_actions( $actions ) ); 391 } 392 } 346 393 } -
class-wp-ms-themes-list-table.php
182 182 ); 183 183 } 184 184 185 function get_primary_column() { 186 return( 'name' ); 187 } 188 185 189 function get_views() { 186 190 global $totals, $status; 187 191 … … 298 302 299 303 echo "<tr id='$id' class='$class'>"; 300 304 301 list( $columns, $hidden ) = $this->get_column_info();305 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 302 306 303 307 foreach ( $columns as $column_name => $column_display_name ) { 304 308 $style = ''; … … 311 315 break; 312 316 case 'name': 313 317 echo "<td class='theme-title'$style><strong>" . $theme->display('Name') . "</strong>"; 314 echo $this->row_actions( $actions, true );318 if( $primary == $column_name ) echo $this->row_actions( $actions, true ); 315 319 echo "</td>"; 316 320 break; 317 321 case 'description': … … 335 339 336 340 $theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $stylesheet, $theme, $status ); 337 341 echo implode( ' | ', $theme_meta ); 342 echo "</div>"; 338 343 339 echo "</div></td>"; 344 if( $primary == $column_name ) echo $this->row_actions( $actions, true ); 345 echo "</td>"; 340 346 break; 341 347 342 348 default: 343 349 echo "<td class='$column_name column-$column_name'$style>"; 344 350 do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme ); 351 if( $primary == $column_name ) echo $this->row_actions( $actions, true ); 345 352 echo "</td>"; 346 353 } 347 354 } -
class-wp-ms-users-list-table.php
132 132 ); 133 133 } 134 134 135 function get_primary_column() { 136 return( 'username' ); 137 } 138 135 139 function display_rows() { 136 140 global $current_site, $mode; 137 141 … … 151 155 <tr class="<?php echo $alt; ?>"> 152 156 <?php 153 157 154 list( $columns, $hidden ) = $this->get_column_info();158 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 155 159 156 160 foreach ( $columns as $column_name => $column_display_name ) : 157 $class = "class='$column_name column-$column_name'"; 161 if( $primary == $column_name ) { 162 $class = "class='$column_name column-$column_name has-row-actions'"; 163 } else { 164 $class = "class='$column_name column-$column_name'"; 165 } 158 166 159 167 $style = ''; 160 168 if ( in_array( $column_name, $hidden ) ) … … 182 190 ?></strong> 183 191 <br/> 184 192 <?php 185 $actions = array(); 186 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 187 188 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) { 189 $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>'; 190 } 191 192 $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); 193 echo $this->row_actions( $actions ); 193 echo $this->handle_actions( $user, $column_name, $primary ); 194 194 ?> 195 195 </td> 196 196 <?php … … 197 197 break; 198 198 199 199 case 'name': 200 echo "<td $attributes>$user->first_name $user->last_name</td>"; 200 echo "<td $attributes>$user->first_name $user->last_name"; 201 echo $this->handle_actions( $user, $column_name, $primary ); 202 echo "</td>"; 201 203 break; 202 204 203 205 case 'email': 204 echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a></td>"; 206 echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a>"; 207 echo $this->handle_actions( $user, $column_name, $primary ); 208 echo "</td>"; 205 209 break; 206 210 207 211 case 'registered': … … 210 214 else 211 215 $date = 'Y/m/d \<\b\r \/\> g:i:s a'; 212 216 213 echo "<td $attributes>" . mysql2date( $date, $user->user_registered ) . "</td>"; 217 echo "<td $attributes>" . mysql2date( $date, $user->user_registered ); 218 echo $this->handle_actions( $user, $column_name, $primary ); 219 echo "</td>"; 214 220 break; 215 221 216 222 case 'blogs': … … 252 258 echo '</small></span><br/>'; 253 259 } 254 260 } 261 echo $this->handle_actions( $user, $column_name, $primary ); 255 262 ?> 256 263 </td> 257 264 <?php … … 260 267 default: 261 268 echo "<td $attributes>"; 262 269 echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID ); 270 echo $this->handle_actions( $user, $column_name, $primary ); 263 271 echo "</td>"; 264 272 break; 265 273 } … … 269 277 <?php 270 278 } 271 279 } 280 281 282 function handle_actions( $user, $column_name, $primary ) { 283 $super_admins = get_super_admins(); 284 if( $primary == $column_name ) { 285 $actions = array(); 286 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 287 288 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) { 289 $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>'; 290 } 291 292 $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); 293 return( $this->row_actions( $actions ) ); 294 } 295 } 296 272 297 } -
class-wp-plugins-list-table.php
384 384 385 385 echo "<tr id='$id' class='$class'>"; 386 386 387 list( $columns, $hidden ) = $this->get_column_info();387 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 388 388 389 389 foreach ( $columns as $column_name => $column_display_name ) { 390 390 $style = ''; … … 396 396 echo "<th scope='row' class='check-column'>$checkbox</th>"; 397 397 break; 398 398 case 'name': 399 echo "<td class='plugin-title'$style><strong>$plugin_name</strong>"; 400 echo $this->row_actions( $actions, true ); 399 if( $primary == $column_name ) { 400 echo "<td class='plugin-title has-row-actions'$style><strong>$plugin_name</strong>"; 401 echo $this->row_actions( $actions, true ); 402 } else { 403 echo "<td class='plugin-title'$style><strong>$plugin_name</strong>"; 404 } 401 405 echo "</td>"; 402 406 break; 403 407 case 'description': 404 echo "<td class='column-description desc'$style> 405 <div class='plugin-description'>$description</div> 406 <div class='$class second plugin-version-author-uri'>"; 408 if( $primary == $column_name ) { 409 echo "<td class='column-description desc has-row-actions'$style>"; 410 } else { 411 echo "<td class='column-description desc'$style>"; 412 } 413 echo "<div class='plugin-description'>$description</div> 414 <div class='$class second plugin-version-author-uri'>"; 407 415 408 416 $plugin_meta = array(); 409 417 if ( !empty( $plugin_data['Version'] ) ) … … 420 428 $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status ); 421 429 echo implode( ' | ', $plugin_meta ); 422 430 431 if( $primary == $column_name ) { 432 echo $this->row_actions( $actions, true ); 433 } 423 434 echo "</div></td>"; 424 435 break; 425 436 default: … … 434 445 do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status ); 435 446 do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status ); 436 447 } 448 449 function get_primary_column() { 450 return( 'name' ); 451 } 437 452 } -
class-wp-posts-list-table.php
495 495 <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>" valign="top"> 496 496 <?php 497 497 498 list( $columns, $hidden ) = $this->get_column_info();498 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 499 499 500 500 foreach ( $columns as $column_name => $column_display_name ) { 501 $class = "class=\"$column_name column-$column_name\"";502 501 502 if ( $primary == $column_name ) { 503 $class = "class=\"$column_name column-$column_name has-row-actions\""; 504 } else { 505 $class = "class=\"$column_name column-$column_name\""; 506 } 507 503 508 $style = ''; 504 509 if ( in_array( $column_name, $hidden ) ) 505 510 $style = ' style="display:none;"'; … … 526 531 break; 527 532 528 533 case 'title': 529 $attributes = 'class="post-title page-title column-title"' . $style; 534 if ( $primary == $column_name ) { 535 $attributes = 'class="post-title page-title column-title has_row_actions"'; 536 } else { 537 $attributes = 'class="post-title page-title column-title"'; 538 } 539 $attributes .= $style; 540 530 541 if ( $this->hierarchical_display ) { 531 542 if ( 0 == $level && (int) $post->post_parent > 0 ) { 532 543 //sent level 0 by accident, by default, or because we don't know the actual level … … 581 592 if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) ) 582 593 the_excerpt(); 583 594 584 $actions = array(); 585 if ( $can_edit_post && 'trash' != $post->post_status ) { 586 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>'; 587 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick Edit' ) . '</a>'; 588 } 589 if ( current_user_can( 'delete_post', $post->ID ) ) { 590 if ( 'trash' == $post->post_status ) 591 $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>"; 592 elseif ( EMPTY_TRASH_DAYS ) 593 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; 594 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) 595 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 596 } 597 if ( $post_type_object->public ) { 598 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { 599 if ( $can_edit_post ) 600 $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>'; 601 } elseif ( 'trash' != $post->post_status ) { 602 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 603 } 604 } 595 echo $this->handle_actions( $post, $column_name, $primary ); 605 596 606 $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post );607 echo $this->row_actions( $actions );608 609 597 get_inline_data( $post ); 610 598 echo '</td>'; 611 599 break; … … 643 631 } else { 644 632 _e( 'Last Modified' ); 645 633 } 634 echo $this->handle_actions( $post, $column_name, $primary ); 646 635 echo '</td>'; 647 636 break; 648 637 … … 654 643 655 644 $this->comments_bubble( $post->ID, $pending_comments ); 656 645 ?> 657 </div> </td>646 </div> <?php echo $this->handle_actions( $post, $column_name, $primary ); ?> </td> 658 647 <?php 659 648 break; 660 649 … … 665 654 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )), 666 655 get_the_author() 667 656 ); 657 echo $this->handle_actions( $post, $column_name, $primary ); 668 658 ?></td> 669 659 <?php 670 660 break; … … 705 695 } else { 706 696 echo '—'; 707 697 } 698 699 echo $this->handle_actions( $post, $column_name, $primary ); 708 700 echo '</td>'; 709 701 break; 710 702 } … … 715 707 else 716 708 do_action( 'manage_posts_custom_column', $column_name, $post->ID ); 717 709 do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID ); 710 echo $this->handle_actions( $post, $column_name, $primary ); 718 711 ?></td> 719 712 <?php 720 713 break; … … 726 719 $GLOBALS['post'] = $global_post; 727 720 } 728 721 722 function get_primary_column() { 723 return( 'title' ); 724 } 725 726 function handle_actions( $post, $column_name, $primary ) { 727 if ( $primary == $column_name ) { 728 $post_type_object = get_post_type_object( $post->post_type ); 729 $can_edit_post = current_user_can( 'edit_post', $post->ID ); 730 $actions = array(); 731 if ( $can_edit_post && 'trash' != $post->post_status ) { 732 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>'; 733 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick Edit' ) . '</a>'; 734 } 735 if ( current_user_can( 'delete_post', $post->ID ) ) { 736 if ( 'trash' == $post->post_status ) 737 $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>"; 738 elseif ( EMPTY_TRASH_DAYS ) 739 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; 740 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) 741 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 742 } 743 if ( $post_type_object->public ) { 744 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { 745 if ( $can_edit_post ) 746 $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>'; 747 } elseif ( 'trash' != $post->post_status ) { 748 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 749 } 750 } 751 752 $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post ); 753 return( $this->row_actions( $actions ) ); 754 } 755 } 756 729 757 /** 730 758 * Outputs the hidden row displayed when inline editing 731 759 * -
class-wp-terms-list-table.php
252 252 253 253 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a></strong><br />'; 254 254 255 $actions = array();256 if ( current_user_can( $tax->cap->edit_terms ) ) {257 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';258 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>';259 }260 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )261 $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>";262 if ( $tax->public )263 $actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>';264 265 $actions = apply_filters( 'tag_row_actions', $actions, $tag );266 $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );267 268 $out .= $this->row_actions( $actions );269 255 $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">'; 270 256 $out .= '<div class="name">' . $qe_data->name . '</div>'; 271 257 $out .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug ) . '</div>'; … … 317 303 return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $tag->term_id ); 318 304 } 319 305 306 function get_primary_column() { 307 return( 'name' ); 308 } 309 310 function handle_actions( $tag, $column_name, $primary ) { 311 $taxonomy = $this->screen->taxonomy; 312 $tax = get_taxonomy( $taxonomy ); 313 314 $default_term = get_option( 'default_' . $taxonomy ); 315 316 $pad = str_repeat( '— ', max( 0, $this->level ) ); 317 $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag ); 318 $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' ); 319 $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) ); 320 $actions = array(); 321 if( $primary == $column_name ) { 322 if ( current_user_can( $tax->cap->edit_terms ) ) { 323 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 324 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>'; 325 } 326 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) 327 $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>"; 328 if ( $tax->public ) 329 $actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>'; 330 331 $actions = apply_filters( 'tag_row_actions', $actions, $tag ); 332 $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag ); 333 334 return( $this->row_actions( $actions ) ); 335 } 336 } 337 320 338 /** 321 339 * Outputs the hidden row displayed when inline editing 322 340 * -
class-wp-users-list-table.php
258 258 if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) ) 259 259 $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>"; 260 260 $actions = apply_filters( 'user_row_actions', $actions, $user_object ); 261 $edit .= $this->row_actions( $actions );262 261 263 262 // Set up the checkbox ( because the user is editable, otherwise it's empty ) 264 263 $checkbox = '<label class="screen-reader-text" for="cb-select-' . $user_object->ID . '">' . sprintf( __( 'Select %s' ), $user_object->user_login ) . '</label>' … … 272 271 273 272 $r = "<tr id='user-$user_object->ID'$style>"; 274 273 275 list( $columns, $hidden ) = $this->get_column_info();274 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 276 275 277 276 foreach ( $columns as $column_name => $column_display_name ) { 278 $class = "class=\"$column_name column-$column_name\"";279 277 278 if( $primary == $column_name ) { 279 $class = "class=\"$column_name column-$column_name has-row-actions\""; 280 } else { 281 $class = "class=\"$column_name column-$column_name\""; 282 } 283 280 284 $style = ''; 281 285 if ( in_array( $column_name, $hidden ) ) 282 286 $style = ' style="display:none;"'; … … 288 292 $r .= "<th scope='row' class='check-column'>$checkbox</th>"; 289 293 break; 290 294 case 'username': 291 $r .= "<td $attributes>$avatar $edit </td>";295 $r .= "<td $attributes>$avatar $edit"; 292 296 break; 293 297 case 'name': 294 $r .= "<td $attributes>$user_object->first_name $user_object->last_name </td>";298 $r .= "<td $attributes>$user_object->first_name $user_object->last_name"; 295 299 break; 296 300 case 'email': 297 $r .= "<td $attributes><a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a> </td>";301 $r .= "<td $attributes><a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a>"; 298 302 break; 299 303 case 'role': 300 $r .= "<td $attributes>$role_name </td>";304 $r .= "<td $attributes>$role_name"; 301 305 break; 302 306 case 'posts': 303 307 $attributes = 'class="posts column-posts num"' . $style; … … 309 313 } else { 310 314 $r .= 0; 311 315 } 312 $r .= "</td>";313 316 break; 314 317 default: 315 318 $r .= "<td $attributes>"; … … 316 319 $r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID ); 317 320 $r .= "</td>"; 318 321 } 322 323 if( $primary == $column_name ) { 324 $r .= $this->row_actions( $actions ); 325 } 326 $r .= '</td>'; 319 327 } 320 328 $r .= '</tr>'; 321 329 322 330 return $r; 323 331 } 332 333 function get_primary_column() { 334 return( 'username' ); 335 } 324 336 }