Ticket #25408: 25408.9.diff
File 25408.9.diff, 65.1 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/class-wp-comments-list-table.php
323 323 ); 324 324 } 325 325 326 /** 327 * Get name of default primary column 328 * 329 * @since 4.3 330 * @access protected 331 * 332 * @return string 333 */ 334 protected function get_default_primary_column_name() { 335 return 'comment'; 336 } 337 326 338 public function display() { 327 339 wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); 328 340 … … 375 387 echo "</tr>\n"; 376 388 } 377 389 378 public function column_cb( $comment ) { 379 if ( $this->user_can ) { ?> 380 <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label> 381 <input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /> 382 <?php 390 /** 391 * Generate and display row actions links 392 * 393 * @since 4.3 394 * @access protected 395 * 396 * @param object $comment Comment being acted upon 397 * @param string $column_name Current column name 398 * @param string $primary Primary column name 399 * 400 * @return string 401 */ 402 protected function handle_row_actions( $comment, $column_name, $primary ) { 403 global $comment_status; 404 405 if ( ! $this->user_can ) { 406 return; 383 407 } 384 }385 408 386 public function column_comment( $comment ) {387 global $comment_status;388 409 $post = get_post(); 389 410 390 $comment_url = esc_url( get_comment_link( $comment->comment_ID ) );391 411 $the_comment_status = wp_get_comment_status( $comment->comment_ID ); 392 412 393 echo '<div class="comment-author">'; 394 $this->column_author( $comment ); 395 echo '</div>'; 413 $out = ''; 396 414 397 echo '<div class="submitted-on">'; 398 /* translators: 2: comment date, 3: comment time */ 399 printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url, 400 /* translators: comment date format. See http://php.net/date */ 401 get_comment_date( __( 'Y/m/d' ) ), 402 get_comment_date( get_option( 'time_format' ) ) 403 ); 404 405 if ( $comment->comment_parent ) { 406 $parent = get_comment( $comment->comment_parent ); 407 $parent_link = esc_url( get_comment_link( $comment->comment_parent ) ); 408 $name = get_comment_author( $parent->comment_ID ); 409 printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name ); 410 } 411 412 echo '</div>'; 413 comment_text(); 414 if ( $this->user_can ) { ?> 415 <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden"> 416 <textarea class="comment" rows="1" cols="1"><?php 417 /** This filter is documented in wp-admin/includes/comment.php */ 418 echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) ); 419 ?></textarea> 420 <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div> 421 <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div> 422 <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div> 423 <div class="comment_status"><?php echo $comment->comment_approved; ?></div> 424 </div> 425 <?php 426 } 427 428 if ( $this->user_can ) { 415 if( $primary === $column_name ) { 429 416 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); 430 417 $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); 431 418 … … 462 449 } 463 450 464 451 if ( 'spam' != $the_comment_status ) { 465 $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>'; 452 $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 */ 453 _x( 'Spam', 'verb' ) . '</a>'; 466 454 } elseif ( 'spam' == $the_comment_status ) { 467 455 $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>'; 468 456 } … … 478 466 } 479 467 480 468 if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) { 481 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>" . __( 'Edit' ) . '</a>';469 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>" . __( 'Edit' ) . '</a>'; 482 470 483 471 $format = '<a data-comment-id="%d" data-post-id="%d" data-action="%s" class="%s" title="%s" href="#">%s</a>'; 484 472 485 $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'edit', 'vim-q comment-inline', esc_attr__( 'Edit this item inline' ), __( 'Quick Edit' ) );473 $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'edit', 'vim-q comment-inline', esc_attr__( 'Edit this item inline' ), __( 'Quick Edit' ) ); 486 474 487 475 $actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) ); 488 476 } … … 491 479 $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); 492 480 493 481 $i = 0; 494 echo'<div class="row-actions">';482 $out .= '<div class="row-actions">'; 495 483 foreach ( $actions as $action => $link ) { 496 484 ++$i; 497 ( ( 485 ( (( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; 498 486 499 487 // Reply and quickedit need a hide-if-no-js span when not added with ajax 500 if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') )488 if ( ('reply' == $action || 'quickedit' == $action ) && !defined( 'DOING_AJAX' ) ) 501 489 $action .= ' hide-if-no-js'; 502 elseif ( ( 490 elseif ( ($action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) { 503 491 if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) 504 492 $action .= ' approve'; 505 493 else … … 506 494 $action .= ' unapprove'; 507 495 } 508 496 509 echo"<span class='$action'>$sep$link</span>";497 $out .= "<span class='$action'>$sep$link</span>"; 510 498 } 511 echo'</div>';499 $out .= '</div>'; 512 500 } 501 502 return $out; 513 503 } 514 504 505 public function column_cb( $comment ) { 506 if ( $this->user_can ) { ?> 507 <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label> 508 <input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /> 509 <?php 510 } 511 } 512 513 public function column_comment( $comment ) { 514 global $comment_status; 515 $post = get_post(); 516 517 $comment_url = esc_url( get_comment_link( $comment->comment_ID ) ); 518 $the_comment_status = wp_get_comment_status( $comment->comment_ID ); 519 520 echo '<div class="comment-author">'; 521 $this->column_author( $comment ); 522 echo '</div>'; 523 524 echo '<div class="submitted-on">'; 525 /* translators: 2: comment date, 3: comment time */ 526 printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url, 527 /* translators: comment date format. See http://php.net/date */ 528 get_comment_date( __( 'Y/m/d' ) ), 529 get_comment_date( get_option( 'time_format' ) ) 530 ); 531 532 if ( $comment->comment_parent ) { 533 $parent = get_comment( $comment->comment_parent ); 534 $parent_link = esc_url( get_comment_link( $comment->comment_parent ) ); 535 $name = get_comment_author( $parent->comment_ID ); 536 printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name ); 537 } 538 539 echo '</div>'; 540 comment_text(); 541 if ( $this->user_can ) { ?> 542 <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden"> 543 <textarea class="comment" rows="1" cols="1"><?php 544 /** This filter is documented in wp-admin/includes/comment.php */ 545 echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) ); 546 ?></textarea> 547 <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div> 548 <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div> 549 <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div> 550 <div class="comment_status"><?php echo $comment->comment_approved; ?></div> 551 </div> 552 <?php 553 } 554 } 555 515 556 public function column_author( $comment ) { 516 557 global $comment_status; 517 558 -
src/wp-admin/includes/class-wp-links-list-table.php
108 108 ); 109 109 } 110 110 111 /** 112 * Get name of default primary column 113 * 114 * @since 4.3 115 * @access protected 116 * 117 * @return string 118 */ 119 protected function get_default_primary_column_name() { 120 return 'name'; 121 } 122 111 123 public function display_rows() { 112 124 global $cat_id; 113 125 … … 126 138 <tr id="link-<?php echo $link->link_id; ?>"> 127 139 <?php 128 140 129 list( $columns, $hidden ) = $this->get_column_info();141 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 130 142 131 143 foreach ( $columns as $column_name => $column_display_name ) { 132 $class = "class='column-$column_name'"; 144 $classes = "$column_name column-$column_name"; 145 if ( $primary === $column_name ) { 146 $classes .= ' has-row-actions column-primary'; 147 } 133 148 134 149 $style = ''; 135 if ( in_array( $column_name, $hidden ) ) 150 if ( in_array( $column_name, $hidden ) ) { 136 151 $style = ' style="display:none;"'; 152 } 137 153 138 $attributes = $class . $style;154 $attributes = "class='$classes'$style"; 139 155 140 156 switch ( $column_name ) { 141 157 case 'cb': ?> … … 148 164 149 165 case 'name': 150 166 echo "<td $attributes><strong><a class='row-title' href='$edit_link' title='" . esc_attr( sprintf( __( 'Edit “%s”' ), $link->link_name ) ) . "'>$link->link_name</a></strong><br />"; 151 152 $actions = array();153 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';154 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( "You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ) . "' ) ) { return true;}return false;\">" . __( 'Delete' ) . "</a>";155 echo $this->row_actions( $actions );156 157 echo '</td>';158 167 break; 159 168 case 'url': 160 echo "<td $attributes><a href='$link->link_url' title='". esc_attr( sprintf( __( 'Visit %s' ), $link->link_name ) )."'>$short_url</a> </td>";169 echo "<td $attributes><a href='$link->link_url' title='". esc_attr( sprintf( __( 'Visit %s' ), $link->link_name ) )."'>$short_url</a>"; 161 170 break; 162 171 case 'categories': 163 172 ?><td <?php echo $attributes ?>><?php … … 172 181 $cat_names[] = $cat_name; 173 182 } 174 183 echo implode( ', ', $cat_names ); 175 ?></td><?php176 184 break; 177 185 case 'rel': 178 ?><td <?php echo $attributes ?>><?php echo empty( $link->link_rel ) ? '<br />' : $link->link_rel; ?></td><?php186 ?><td <?php echo $attributes ?>><?php echo empty( $link->link_rel ) ? '<br />' : $link->link_rel; 179 187 break; 180 188 case 'visible': 181 ?><td <?php echo $attributes ?>><?php echo $visible; ?></td><?php189 ?><td <?php echo $attributes ?>><?php echo $visible; 182 190 break; 183 191 case 'rating': 184 ?><td <?php echo $attributes ?>><?php echo $rating; ?></td><?php192 ?><td <?php echo $attributes ?>><?php echo $rating; 185 193 break; 186 194 default: 187 195 ?> … … 195 203 * @param int $link_id Link ID. 196 204 */ 197 205 do_action( 'manage_link_custom_column', $column_name, $link->link_id ); 198 ?></td>199 <?php200 206 break; 201 207 } 208 209 echo $this->handle_row_actions( $link, $column_name, $primary ); 210 echo '</td>'; 202 211 } 203 212 ?> 204 213 </tr> … … 205 214 <?php 206 215 } 207 216 } 217 218 /** 219 * Generate and display row actions links 220 * 221 * @since 4.3 222 * @access protected 223 * 224 * @param object $link Link being acted upon 225 * @param string $column_name Current column name 226 * @param string $primary Primary column name 227 * 228 * @return string 229 */ 230 protected function handle_row_actions( $link, $column_name, $primary ) { 231 if( $primary === $column_name ) { 232 $edit_link = get_edit_bookmark_link( $link ); 233 234 $actions = array(); 235 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 236 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm( '" . esc_js(sprintf(__("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name)) . "' ) ) { return true;}return false;\">" . __('Delete') . "</a>"; 237 return $this->row_actions($actions); 238 } 239 } 208 240 } -
src/wp-admin/includes/class-wp-list-table.php
792 792 } 793 793 794 794 /** 795 * Get name of default primary column 796 * 797 * @since 4.3 798 * @access protected 799 * 800 * @return string 801 */ 802 protected function get_default_primary_column_name() { 803 return ''; 804 } 805 806 /** 807 * Get name of primary column. 808 * 809 * @since 4.3 810 * @access protected 811 * 812 * @return string Filtered name of primary column 813 */ 814 protected function get_primary_column_name() { 815 $columns = $this->get_columns(); 816 $default = $this->get_default_primary_column_name(); 817 /** 818 * Filter the name of the primary column for the current list table, with context as argument (eg: 'plugins'). 819 * 820 * @since 4.3 821 * 822 * @param string $default Column name default for the specific list table (eg: 'name') 823 * @param string $context Screen ID for specific list table (eg: 'plugins') 824 */ 825 $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); 826 827 /** 828 * Filter the name of the primary column for the current list table, with context in hook name (eg: 'list_table_primary_column_plugins'). 829 * 830 * @since 4.3 831 * 832 * @param string $default Column name default for the specific list table (eg: 'name') 833 */ 834 $column = apply_filters( 'list_table_primary_column_' . str_replace( '-', '_', $this->screen->id ), $column ); 835 836 if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { 837 $column = $default; 838 } 839 840 return $column; 841 } 842 843 /** 795 844 * Get a list of all, hidden and sortable columns, with filter applied 796 845 * 797 846 * @since 3.1.0 … … 831 880 $sortable[$id] = $data; 832 881 } 833 882 834 $this->_column_headers = array( $columns, $hidden, $sortable ); 883 $primary = $this->get_primary_column_name(); 884 $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); 835 885 836 886 return $this->_column_headers; 837 887 } … … 1059 1109 * @param object $item The current item 1060 1110 */ 1061 1111 protected function single_row_columns( $item ) { 1062 list( $columns, $hidden ) = $this->get_column_info();1112 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 1063 1113 1064 1114 foreach ( $columns as $column_name => $column_display_name ) { 1065 $class = "class='$column_name column-$column_name'"; 1115 $classes = "$column_name column-$column_name"; 1116 if ( $primary === $column_name ) { 1117 $classes .= ' has-row-actions column-primary'; 1118 } 1066 1119 1067 1120 $style = ''; 1068 if ( in_array( $column_name, $hidden ) ) 1121 if ( in_array( $column_name, $hidden ) ) { 1069 1122 $style = ' style="display:none;"'; 1123 } 1070 1124 1071 $attributes = " $class$style";1125 $attributes = "class='$classes'$style"; 1072 1126 1073 1127 if ( 'cb' == $column_name ) { 1074 1128 echo '<th scope="row" class="check-column">'; … … 1078 1132 elseif ( method_exists( $this, 'column_' . $column_name ) ) { 1079 1133 echo "<td $attributes>"; 1080 1134 echo call_user_func( array( $this, 'column_' . $column_name ), $item ); 1135 echo $this->handle_row_actions( $item, $column_name, $primary ); 1081 1136 echo "</td>"; 1082 1137 } 1083 1138 else { … … 1089 1144 } 1090 1145 1091 1146 /** 1147 * Generate and display row actions links 1148 * 1149 * @since 4.3 1150 * @access protected 1151 * 1152 * @param object $item Item being acted upon 1153 * @param string $column_name Current column name 1154 * @param string $primary Primary column name 1155 * 1156 * @return string 1157 */ 1158 protected function handle_row_actions( $item, $column_name, $primary ) { 1159 return ''; 1160 } 1161 1162 /** 1092 1163 * Handle an incoming ajax request (called from admin-ajax.php) 1093 1164 * 1094 1165 * @since 3.1.0 -
src/wp-admin/includes/class-wp-media-list-table.php
288 288 <tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim( ' author-' . $post_owner . ' status-' . $post->post_status ); ?>"> 289 289 <?php 290 290 291 list( $columns, $hidden ) = $this->get_column_info(); 291 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 292 292 293 foreach ( $columns as $column_name => $column_display_name ) { 293 $class = "class='$column_name column-$column_name'"; 294 $classes = "$column_name column-$column_name"; 295 if ( $primary === $column_name ) { 296 $classes .= ' has-row-actions column-primary'; 297 } 294 298 295 299 $style = ''; 296 if ( in_array( $column_name, $hidden ) ) 300 if ( in_array( $column_name, $hidden ) ) { 297 301 $style = ' style="display:none;"'; 302 } 298 303 299 $attributes = $class . $style;304 $attributes = "class='$classes'$style"; 300 305 301 306 switch ( $column_name ) { 302 307 … … 345 350 _media_states( $post ); ?></strong> 346 351 <p class="filename"><?php echo wp_basename( $post->guid ); ?></p> 347 352 <?php 348 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 353 if( $primary === $column_name ) { 354 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 355 } 349 356 ?> 350 357 </td> 351 358 <?php … … 358 365 esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ), 359 366 get_the_author() 360 367 ); 368 369 if( $primary === $column_name ) { 370 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 371 } 361 372 ?></td> 362 373 <?php 363 374 break; … … 364 375 365 376 case 'desc': 366 377 ?> 367 <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?> </td>378 <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?> 368 379 <?php 380 if( $primary === $column_name ) { 381 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 382 } 383 echo '</td>'; 369 384 break; 370 385 371 386 case 'date': … … 384 399 } 385 400 } 386 401 ?> 387 <td <?php echo $attributes ?>><?php echo $h_time ?> </td>402 <td <?php echo $attributes ?>><?php echo $h_time ?> 388 403 <?php 404 if( $primary === $column_name ) { 405 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 406 } 407 echo '</td>'; 389 408 break; 390 409 391 410 case 'parent': … … 414 433 '_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] ) 415 434 ), 'upload.php' ); ?> 416 435 <a class="hide-if-no-js detach-from-parent" href="<?php echo $detach_url ?>"><?php _e( 'Detach' ); ?></a> 417 <?php endif; ?> 418 </td> 419 <?php 436 <?php endif; 420 437 } else { 421 438 ?> 422 439 <td <?php echo $attributes ?>><?php _e( '(Unattached)' ); ?><br /> … … 425 442 onclick="findPosts.open( 'media[]','<?php echo $post->ID ?>' ); return false;" 426 443 href="#the-list"> 427 444 <?php _e( 'Attach' ); ?></a> 428 <?php } ?></td> 429 <?php 445 <?php } 430 446 } 447 448 if( $primary === $column_name ) { 449 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 450 } 451 echo '</td>'; 431 452 break; 432 453 433 454 case 'comments': … … 474 495 } else { 475 496 echo '—'; 476 497 } 498 if( $primary === $column_name ) { 499 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 500 } 477 501 echo '</td>'; 478 502 break; 479 503 } … … 490 514 * @param int $post_id Attachment ID. 491 515 */ 492 516 do_action( 'manage_media_custom_column', $column_name, $post->ID ); 517 518 if( $primary === $column_name ) { 519 echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 520 } 493 521 ?></td> 494 522 <?php 495 523 break; … … 501 529 } 502 530 503 531 /** 532 * Get name of default primary column 533 * 534 * @since 4.3 535 * @access protected 536 * 537 * @return string 538 */ 539 protected function get_default_primary_column_name() { 540 return 'title'; 541 } 542 543 /** 504 544 * @param WP_Post $post 505 545 * @param string $att_title 506 546 */ -
src/wp-admin/includes/class-wp-ms-sites-list-table.php
234 234 235 235 $blogname = ( is_subdomain_install() ) ? str_replace( '.' . get_current_site()->domain, '', $blog['domain'] ) : $blog['path']; 236 236 237 list( $columns, $hidden ) = $this->get_column_info();237 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 238 238 239 239 foreach ( $columns as $column_name => $column_display_name ) { 240 $classes = "$column_name column-$column_name"; 241 if ( $primary === $column_name ) { 242 $classes .= ' has-row-actions column-primary'; 243 } 244 240 245 $style = ''; 241 if ( in_array( $column_name, $hidden ) ) 246 if ( in_array( $column_name, $hidden ) ) { 242 247 $style = ' style="display:none;"'; 248 } 243 249 250 $attributes = "class='$classes'$style"; 251 244 252 switch ( $column_name ) { 245 253 case 'cb': ?> 246 254 <th scope="row" class="check-column"> … … 260 268 break; 261 269 262 270 case 'blogname': 263 echo "<td class='column-$column_name $column_name'$style>"; ?> 264 <a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a> 265 <?php 266 if ( 'list' != $mode ) { 267 switch_to_blog( $blog['blog_id'] ); 268 /* translators: 1: site name, 2: site tagline. */ 269 echo '<p>' . sprintf( __( '%1$s – <em>%2$s</em>' ), get_option( 'blogname' ), get_option( 'blogdescription ' ) ) . '</p>'; 270 restore_current_blog(); 271 } 272 273 // Preordered. 274 $actions = array( 275 'edit' => '', 'backend' => '', 276 'activate' => '', 'deactivate' => '', 277 'archive' => '', 'unarchive' => '', 278 'spam' => '', 'unspam' => '', 279 'delete' => '', 280 'visit' => '', 281 ); 282 283 $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>'; 284 $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>'; 285 if ( get_current_site()->blog_id != $blog['blog_id'] ) { 286 if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' ) 287 $actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>'; 288 else 289 $actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Deactivate' ) . '</a></span>'; 290 291 if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' ) 292 $actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Unarchive' ) . '</a></span>'; 293 else 294 $actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&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>'; 295 296 if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' ) 297 $actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&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>'; 298 else 299 $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>'; 300 301 if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) 302 $actions['delete'] = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Delete' ) . '</a></span>'; 303 } 304 305 $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>'; 306 307 /** 308 * Filter the action links displayed for each site in the Sites list table. 309 * 310 * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by 311 * default for each site. The site's status determines whether to show the 312 * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and 313 * 'Not Spam' or 'Spam' link for each site. 314 * 315 * @since 3.1.0 316 * 317 * @param array $actions An array of action links to be displayed. 318 * @param int $blog_id The site ID. 319 * @param string $blogname Site path, formatted depending on whether it is a sub-domain 320 * or subdirectory multisite install. 321 */ 322 $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); 323 echo $this->row_actions( $actions ); 271 echo "<td $attributes>"; ?> 272 <a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a> 273 <?php 274 if ( 'list' != $mode ) { 275 switch_to_blog( $blog['blog_id'] ); 276 /* translators: 1: site name, 2: site tagline. */ 277 echo '<p>' . sprintf( __( '%1$s – <em>%2$s</em>' ), get_option( 'blogname' ), get_option( 'blogdescription ' ) ) . '</p>'; 278 restore_current_blog(); 279 } 280 echo $this->handle_row_actions( $blog, $column_name, $primary ); 324 281 ?> 325 282 </td> 326 283 <?php … … 327 284 break; 328 285 329 286 case 'lastupdated': 330 echo "<td class='$column_name column-$column_name'$style>"; 331 echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); ?> 287 echo "<td $attributes>"; 288 echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); 289 echo $this->handle_row_actions( $blog, $column_name, $primary ); 290 ?> 332 291 </td> 333 292 <?php 334 293 break; 335 294 case 'registered': 336 echo "<td class='$column_name column-$column_name'$style>";295 echo "<td $attributes>"; 337 296 if ( $blog['registered'] == '0000-00-00 00:00:00' ) 338 297 echo '—'; 339 298 else 340 299 echo mysql2date( $date, $blog['registered'] ); 300 echo $this->handle_row_actions( $blog, $column_name, $primary ); 341 301 ?> 342 302 </td> 343 303 <?php 344 304 break; 345 305 case 'users': 346 echo "<td class='$column_name column-$column_name'$style>";306 echo "<td $attributes>"; 347 307 $blogusers = get_users( array( 'blog_id' => $blog['blog_id'], 'number' => 6) ); 348 308 if ( is_array( $blogusers ) ) { 349 309 $blogusers_warning = ''; … … 360 320 if ( $blogusers_warning != '' ) 361 321 echo '<strong>' . $blogusers_warning . '</strong><br />'; 362 322 } 323 324 echo $this->handle_row_actions( $blog, $column_name, $primary ); 363 325 ?> 364 326 </td> 365 327 <?php … … 367 329 368 330 case 'plugins': ?> 369 331 <?php if ( has_filter( 'wpmublogsaction' ) ) { 370 echo "<td class='$column_name column-$column_name'$style>";332 echo "<td $attributes>"; 371 333 /** 372 334 * Fires inside the auxiliary 'Actions' column of the Sites list table. 373 335 * … … 377 339 * 378 340 * @param int $blog_id The site ID. 379 341 */ 380 do_action( 'wpmublogsaction', $blog['blog_id'] ); ?> 342 do_action( 'wpmublogsaction', $blog['blog_id'] ); 343 344 echo $this->handle_row_actions( $blog, $column_name, $primary ); 345 ?> 381 346 </td> 382 347 <?php } 383 348 break; 384 349 385 350 default: 386 echo "<td class='$column_name column-$column_name'$style>";351 echo "<td $attributes>"; 387 352 /** 388 353 * Fires for each registered custom column in the Sites list table. 389 354 * … … 393 358 * @param int $blog_id The site ID. 394 359 */ 395 360 do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] ); 361 362 echo $this->handle_row_actions( $blog, $column_name, $primary ); 396 363 echo "</td>"; 397 364 break; 398 365 } … … 402 369 <?php 403 370 } 404 371 } 372 373 /** 374 * Get name of default primary column 375 * 376 * @since 4.3 377 * @access protected 378 * 379 * @return string 380 */ 381 protected function get_default_primary_column_name() { 382 return 'blogname'; 383 } 384 385 /** 386 * Generate and display row actions links 387 * 388 * @since 4.3 389 * @access protected 390 * 391 * @param object $blog Blog being acted upon 392 * @param string $column_name Current column name 393 * @param string $primary Primary column name 394 * 395 * @return string 396 */ 397 protected function handle_row_actions( $blog, $column_name, $primary ) { 398 global $current_site; 399 400 if ( $primary === $column_name ) { 401 $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path']; 402 403 // Preordered. 404 $actions = array( 405 'edit' => '', 'backend' => '', 406 'activate' => '', 'deactivate' => '', 407 'archive' => '', 'unarchive' => '', 408 'spam' => '', 'unspam' => '', 409 'delete' => '', 410 'visit' => '', 411 ); 412 413 $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>'; 414 $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>'; 415 if ( get_current_site()->blog_id != $blog['blog_id'] ) { 416 if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' ) 417 $actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>'; 418 else 419 $actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Deactivate' ) . '</a></span>'; 420 421 if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' ) 422 $actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Unarchive' ) . '</a></span>'; 423 else 424 $actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&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>'; 425 426 if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' ) 427 $actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&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>'; 428 else 429 $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>'; 430 431 if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) 432 $actions['delete'] = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Delete' ) . '</a></span>'; 433 } 434 435 $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>'; 436 437 /** 438 * Filter the action links displayed for each site in the Sites list table. 439 * 440 * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by 441 * default for each site. The site's status determines whether to show the 442 * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and 443 * 'Not Spam' or 'Spam' link for each site. 444 * 445 * @since 3.1.0 446 * 447 * @param array $actions An array of action links to be displayed. 448 * @param int $blog_id The site ID. 449 * @param string $blogname Site path, formatted depending on whether it is a sub-domain 450 * or subdirectory multisite install. 451 */ 452 $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); 453 return $this->row_actions( $actions ); 454 } 455 } 405 456 } -
src/wp-admin/includes/class-wp-ms-themes-list-table.php
215 215 ); 216 216 } 217 217 218 /** 219 * Get name of default primary column 220 * 221 * @since 4.3 222 * @access protected 223 * 224 * @return string 225 */ 226 protected function get_default_primary_column_name() { 227 return 'name'; 228 } 229 218 230 protected function get_views() { 219 231 global $totals, $status; 220 232 … … 375 387 376 388 echo "<tr id='$id' class='$class'>"; 377 389 378 list( $columns, $hidden ) = $this->get_column_info();390 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 379 391 380 392 foreach ( $columns as $column_name => $column_display_name ) { 381 393 $style = ''; … … 388 400 break; 389 401 case 'name': 390 402 echo "<td class='theme-title'$style><strong>" . $theme->display('Name') . "</strong>"; 391 echo $this->row_actions( $actions, true ); 403 if ( $primary === $column_name ) { 404 echo $this->row_actions($actions, true); 405 } 392 406 echo "</td>"; 393 407 break; 394 408 case 'description': … … 426 440 $theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $stylesheet, $theme, $status ); 427 441 echo implode( ' | ', $theme_meta ); 428 442 429 echo "</div></td>"; 443 echo '</div>'; 444 if ( $primary === $column_name ) { 445 echo $this->row_actions($actions, true); 446 } 447 echo '</td>'; 430 448 break; 431 449 432 450 default: … … 442 460 * @param WP_Theme $theme Current WP_Theme object. 443 461 */ 444 462 do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme ); 463 464 if ( $primary === $column_name ) { 465 echo $this->row_actions($actions, true); 466 } 445 467 echo "</td>"; 446 468 } 447 469 } -
src/wp-admin/includes/class-wp-ms-users-list-table.php
164 164 <tr class="<?php echo trim( $class ); ?>"> 165 165 <?php 166 166 167 list( $columns, $hidden ) = $this->get_column_info();167 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 168 168 169 169 foreach ( $columns as $column_name => $column_display_name ) : 170 $class = "class='$column_name column-$column_name'"; 170 $classes = "$column_name column-$column_name"; 171 if ( $primary === $column_name || 'blogs' === $column_name ) { 172 $classes .= ' has-row-actions'; 173 } 171 174 175 if ( $primary === $column_name && 'blogs' === $column_name ) { 176 $classes .= ' column-primary'; 177 } 178 172 179 $style = ''; 173 if ( in_array( $column_name, $hidden ) ) 180 if ( in_array( $column_name, $hidden ) ) { 174 181 $style = ' style="display:none;"'; 182 } 175 183 176 $attributes = " $class$style";184 $attributes = "class='$classes'$style"; 177 185 178 186 switch ( $column_name ) { 179 187 case 'cb': ?> … … 193 201 if ( in_array( $user->user_login, $super_admins ) ) 194 202 echo ' - ' . __( 'Super Admin' ); 195 203 ?></strong> 196 <br/>197 <?php198 $actions = array();199 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';200 201 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {202 $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';203 }204 205 /**206 * Filter the action links displayed under each user207 * in the Network Admin Users list table.208 *209 * @since 3.2.0210 *211 * @param array $actions An array of action links to be displayed.212 * Default 'Edit', 'Delete'.213 * @param WP_User $user WP_User object.214 */215 $actions = apply_filters( 'ms_user_row_actions', $actions, $user );216 echo $this->row_actions( $actions );217 ?>218 </td>219 204 <?php 220 205 break; 221 206 222 207 case 'name': 223 echo "<td $attributes>$user->first_name $user->last_name </td>";208 echo "<td $attributes>$user->first_name $user->last_name"; 224 209 break; 225 210 226 211 case 'email': 227 echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a> </td>";212 echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a>"; 228 213 break; 229 214 230 215 case 'registered': … … 233 218 else 234 219 $date = __( 'Y/m/d g:i:s a' ); 235 220 236 echo "<td $attributes>" . mysql2date( $date, $user->user_registered ) . "</td>";221 echo "<td $attributes>" . mysql2date( $date, $user->user_registered ); 237 222 break; 238 223 239 224 case 'blogs': … … 286 271 } 287 272 } 288 273 ?> 289 </td>290 274 <?php 291 275 break; 292 276 … … 294 278 echo "<td $attributes>"; 295 279 /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */ 296 280 echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID ); 297 echo "</td>";298 281 break; 299 282 } 283 284 echo $this->handle_row_actions( $user, $column_name, $primary ); 285 echo '</td>'; 300 286 endforeach 301 287 ?> 302 288 </tr> … … 303 289 <?php 304 290 } 305 291 } 292 293 /** 294 * Get name of default primary column 295 * 296 * @since 4.3 297 * @access protected 298 * 299 * @return string 300 */ 301 protected function get_default_primary_column_name() { 302 return 'username'; 303 } 304 305 /** 306 * Generate and display row actions links 307 * 308 * @since 4.3 309 * @access protected 310 * 311 * @param object $user User being acted upon 312 * @param string $column_name Current column name 313 * @param string $primary Primary column name 314 * 315 * @return string 316 */ 317 protected function handle_row_actions( $user, $column_name, $primary ) { 318 $super_admins = get_super_admins(); 319 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); 320 321 if ( $primary === $column_name ) { 322 $actions = array(); 323 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 324 325 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) { 326 $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>'; 327 } 328 329 /** 330 * Filter the action links displayed under each user 331 * in the Network Admin Users list table. 332 * 333 * @since 3.2.0 334 * 335 * @param array $actions An array of action links to be displayed. 336 * Default 'Edit', 'Delete'. 337 * @param WP_User $user WP_User object. 338 */ 339 $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); 340 return $this->row_actions( $actions ); 341 } 342 } 306 343 } -
src/wp-admin/includes/class-wp-plugins-list-table.php
301 301 add_query_arg('plugin_status', $type, 'plugins.php'), 302 302 ( $type == $status ) ? ' class="current"' : '', 303 303 sprintf( $text, number_format_i18n( $count ) ) 304 304 ); 305 305 } 306 306 } 307 307 … … 451 451 $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>'; 452 452 } // end if $is_active 453 453 454 454 } // end if $screen->in_admin( 'network' ) 455 455 456 456 if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) ) 457 457 $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . esc_attr__('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>'; … … 531 531 $plugin_slug 532 532 ); 533 533 534 list( $columns, $hidden ) = $this->get_column_info();534 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 535 535 536 $extra_class = ' has-row-actions column-primary'; 537 536 538 foreach ( $columns as $column_name => $column_display_name ) { 537 539 $style = ''; 538 if ( in_array( $column_name, $hidden ) ) 540 if ( in_array( $column_name, $hidden ) ) { 539 541 $style = ' style="display:none;"'; 542 } 540 543 541 544 switch ( $column_name ) { 542 545 case 'cb': … … 543 546 echo "<th scope='row' class='check-column'>$checkbox</th>"; 544 547 break; 545 548 case 'name': 546 echo "<td class='plugin-title'$style><strong>$plugin_name</strong>"; 547 echo $this->row_actions( $actions, true ); 549 if ( $primary === $column_name || ! isset( $columns[ $primary ] ) ) { 550 echo "<td class='plugin-title $extra_class'$style><strong>$plugin_name</strong>"; 551 echo $this->row_actions( $actions, true ); 552 } else { 553 echo "<td class='plugin-title'$style><strong>$plugin_name</strong>"; 554 } 548 555 echo "</td>"; 549 556 break; 550 557 case 'description': 551 echo "<td class='column-description desc'$style> 558 $classes = 'column-description desc'; 559 if ( $primary === $column_name ) { 560 $classes .= " $extra_class"; 561 } 562 563 echo "<td class='$classes'$style> 552 564 <div class='plugin-description'>$description</div> 553 565 <div class='$class second plugin-version-author-uri'>"; 554 566 … … 595 607 $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status ); 596 608 echo implode( ' | ', $plugin_meta ); 597 609 610 if ( $primary === $column_name ) { 611 echo $this->row_actions( $actions, true ); 612 } 598 613 echo "</div></td>"; 599 614 break; 600 615 default: 601 echo "<td class='$column_name column-$column_name'$style>"; 616 $classes = "$column_name column-$column_name$class"; 617 if ( $primary === $column_name ) { 618 $classes .= " $extra_class"; 619 } 602 620 621 echo "<td class='$classes'$style>"; 622 603 623 /** 604 624 * Fires inside each custom column of the Plugins list table. 605 625 * … … 610 630 * @param array $plugin_data An array of plugin data. 611 631 */ 612 632 do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data ); 633 634 if ( $primary === $column_name ) { 635 echo $this->row_actions( $actions, true ); 636 } 613 637 echo "</td>"; 614 638 } 615 639 } … … 645 669 */ 646 670 do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status ); 647 671 } 648 } 672 673 /** 674 * Get name of default primary column for this specific list table. 675 * 676 * @since 4.3 677 * @access protected 678 * 679 * @return string 680 */ 681 protected function get_default_primary_column_name() { 682 return 'plugin'; 683 } 684 } 685 No newline at end of file -
src/wp-admin/includes/class-wp-posts-list-table.php
665 665 <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>"> 666 666 <?php 667 667 668 list( $columns, $hidden ) = $this->get_column_info();668 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 669 669 670 670 foreach ( $columns as $column_name => $column_display_name ) { 671 $class = "class=\"$column_name column-$column_name\""; 671 $classes = "$column_name column-$column_name"; 672 if ( $primary === $column_name ) { 673 $classes .= ' has-row-actions column-primary'; 674 } 672 675 673 676 $style = ''; 674 if ( in_array( $column_name, $hidden ) ) 677 if ( in_array( $column_name, $hidden ) ) { 675 678 $style = ' style="display:none;"'; 679 } 676 680 677 $attributes = " $class$style";681 $attributes = "class='$classes'$style"; 678 682 679 683 switch ( $column_name ) { 680 684 … … 696 700 break; 697 701 698 702 case 'title': 699 $attributes = 'class="post-title page-title column-title"' . $style; 703 $classes .= ' page-title'; // Special addition for title column 704 $attributes = "class='$classes'$style"; 700 705 if ( $this->hierarchical_display ) { 701 706 if ( 0 == $level && (int) $post->post_parent > 0 ) { 702 707 // Sent level 0 by accident, by default, or because we don't know the actual level. … … 753 758 if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) ) 754 759 the_excerpt(); 755 760 756 $actions = array(); 757 if ( $can_edit_post && 'trash' != $post->post_status ) { 758 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>'; 759 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick Edit' ) . '</a>'; 760 } 761 if ( current_user_can( 'delete_post', $post->ID ) ) { 762 if ( 'trash' == $post->post_status ) 763 $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash' ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; 764 elseif ( EMPTY_TRASH_DAYS ) 765 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; 766 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) 767 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 768 } 769 if ( $post_type_object->public ) { 770 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { 771 if ( $can_edit_post ) { 772 $preview_link = set_url_scheme( get_permalink( $post->ID ) ); 773 /** This filter is documented in wp-admin/includes/meta-boxes.php */ 774 $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ); 775 $actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>'; 776 } 777 } elseif ( 'trash' != $post->post_status ) { 778 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 779 } 780 } 761 echo $this->handle_row_actions( $post, $column_name, $primary ); 781 762 782 if ( is_post_type_hierarchical( $post->post_type ) ) {783 784 /**785 * Filter the array of row action links on the Pages list table.786 *787 * The filter is evaluated only for hierarchical post types.788 *789 * @since 2.8.0790 *791 * @param array $actions An array of row action links. Defaults are792 * 'Edit', 'Quick Edit', 'Restore, 'Trash',793 * 'Delete Permanently', 'Preview', and 'View'.794 * @param WP_Post $post The post object.795 */796 $actions = apply_filters( 'page_row_actions', $actions, $post );797 } else {798 799 /**800 * Filter the array of row action links on the Posts list table.801 *802 * The filter is evaluated only for non-hierarchical post types.803 *804 * @since 2.8.0805 *806 * @param array $actions An array of row action links. Defaults are807 * 'Edit', 'Quick Edit', 'Restore, 'Trash',808 * 'Delete Permanently', 'Preview', and 'View'.809 * @param WP_Post $post The post object.810 */811 $actions = apply_filters( 'post_row_actions', $actions, $post );812 }813 814 echo $this->row_actions( $actions );815 816 763 get_inline_data( $post ); 817 764 echo '</td>'; 818 765 break; … … 868 815 } else { 869 816 _e( 'Last Modified' ); 870 817 } 818 echo $this->handle_row_actions( $post, $column_name, $primary ); 871 819 echo '</td>'; 872 820 break; 873 821 … … 879 827 880 828 $this->comments_bubble( $post->ID, $pending_comments ); 881 829 ?> 882 </div>< /td>830 </div><?php echo $this->handle_row_actions( $post, $column_name, $primary ); ?></td> 883 831 <?php 884 832 break; 885 833 … … 890 838 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )), 891 839 get_the_author() 892 840 ); 841 echo $this->handle_row_actions( $post, $column_name, $primary ); 893 842 ?></td> 894 843 <?php 895 844 break; … … 930 879 } else { 931 880 echo '—'; 932 881 } 882 echo $this->handle_row_actions( $post, $column_name, $primary ); 933 883 echo '</td>'; 934 884 break; 935 885 } … … 976 926 * @param int $post_id The current post ID. 977 927 */ 978 928 do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID ); 929 echo $this->handle_row_actions( $post, $column_name, $primary ); 979 930 ?></td> 980 931 <?php 981 932 break; … … 988 939 } 989 940 990 941 /** 942 * Get name of default primary column 943 * 944 * @since 4.3 945 * @access protected 946 * 947 * @return string 948 */ 949 protected function get_default_primary_column_name() { 950 return( 'title' ); 951 } 952 953 /** 954 * Generate and display row actions links 955 * 956 * @since 4.3 957 * @access protected 958 * 959 * @param object $post Post being acted upon 960 * @param string $column_name Current column name 961 * @param string $primary Primary column name 962 * 963 * @return string 964 */ 965 protected function handle_row_actions( $post, $column_name, $primary ) { 966 $title = _draft_or_post_title(); 967 968 if ( $primary === $column_name ) { 969 $post_type_object = get_post_type_object( $post->post_type ); 970 $can_edit_post = current_user_can( 'edit_post', $post->ID ); 971 $actions = array(); 972 973 if ( $can_edit_post && 'trash' != $post->post_status ) { 974 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>'; 975 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick Edit' ) . '</a>'; 976 } 977 978 if ( current_user_can( 'delete_post', $post->ID ) ) { 979 if ( 'trash' == $post->post_status ) 980 $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash' ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; 981 elseif ( EMPTY_TRASH_DAYS ) 982 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; 983 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) 984 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 985 } 986 987 if ( $post_type_object->public ) { 988 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { 989 if ( $can_edit_post ) { 990 $preview_link = set_url_scheme( get_permalink( $post->ID ) ); 991 /** This filter is documented in wp-admin/includes/meta-boxes.php */ 992 $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ); 993 $actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>'; 994 } 995 } elseif ( 'trash' != $post->post_status ) { 996 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 997 } 998 } 999 1000 if ( is_post_type_hierarchical( $post->post_type ) ) { 1001 1002 /** 1003 * Filter the array of row action links on the Pages list table. 1004 * 1005 * The filter is evaluated only for hierarchical post types. 1006 * 1007 * @since 2.8.0 1008 * 1009 * @param array $actions An array of row action links. Defaults are 1010 * 'Edit', 'Quick Edit', 'Restore, 'Trash', 1011 * 'Delete Permanently', 'Preview', and 'View'. 1012 * @param WP_Post $post The post object. 1013 */ 1014 $actions = apply_filters( 'page_row_actions', $actions, $post ); 1015 } else { 1016 1017 /** 1018 * Filter the array of row action links on the Posts list table. 1019 * 1020 * The filter is evaluated only for non-hierarchical post types. 1021 * 1022 * @since 2.8.0 1023 * 1024 * @param array $actions An array of row action links. Defaults are 1025 * 'Edit', 'Quick Edit', 'Restore, 'Trash', 1026 * 'Delete Permanently', 'Preview', and 'View'. 1027 * @param WP_Post $post The post object. 1028 */ 1029 $actions = apply_filters( 'post_row_actions', $actions, $post ); 1030 } 1031 1032 return $this->row_actions( $actions ); 1033 } 1034 } 1035 1036 /** 991 1037 * Outputs the hidden row displayed when inline editing 992 1038 * 993 1039 * @since 3.1.0 -
src/wp-admin/includes/class-wp-terms-list-table.php
302 302 */ 303 303 public function column_name( $tag ) { 304 304 $taxonomy = $this->screen->taxonomy; 305 $tax = get_taxonomy( $taxonomy );306 305 307 $default_term = get_option( 'default_' . $taxonomy );308 309 306 $pad = str_repeat( '— ', max( 0, $this->level ) ); 310 307 311 308 /** … … 328 325 329 326 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a></strong><br />'; 330 327 331 $actions = array();332 if ( current_user_can( $tax->cap->edit_terms ) ) {333 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';334 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>';335 }336 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )337 $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>";338 if ( $tax->public )339 $actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>';340 341 /**342 * Filter the action links displayed for each term in the Tags list table.343 *344 * @since 2.8.0345 * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead.346 *347 * @param array $actions An array of action links to be displayed. Default348 * 'Edit', 'Quick Edit', 'Delete', and 'View'.349 * @param object $tag Term object.350 */351 $actions = apply_filters( 'tag_row_actions', $actions, $tag );352 353 /**354 * Filter the action links displayed for each term in the terms list table.355 *356 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.357 *358 * @since 3.0.0359 *360 * @param array $actions An array of action links to be displayed. Default361 * 'Edit', 'Quick Edit', 'Delete', and 'View'.362 * @param object $tag Term object.363 */364 $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );365 366 $out .= $this->row_actions( $actions );367 328 $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">'; 368 329 $out .= '<div class="name">' . $qe_data->name . '</div>'; 369 330 … … 375 336 } 376 337 377 338 /** 339 * Get name of default primary column 340 * 341 * @since 4.3 342 * @access protected 343 * 344 * @return string 345 */ 346 protected function get_default_primary_column_name() { 347 return 'name'; 348 } 349 350 /** 351 * Generate and display row actions links 352 * 353 * @since 4.3 354 * @access protected 355 * 356 * @param object $tag Tag being acted upon 357 * @param string $column_name Current column name 358 * @param string $primary Primary column name 359 * 360 * @return string 361 */ 362 protected function handle_row_actions( $tag, $column_name, $primary ) { 363 $taxonomy = $this->screen->taxonomy; 364 $tax = get_taxonomy( $taxonomy ); 365 $default_term = get_option( 'default_' . $taxonomy ); 366 367 $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) ); 368 369 if ( $primary === $column_name ) { 370 $actions = array(); 371 if ( current_user_can( $tax->cap->edit_terms ) ) { 372 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 373 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>'; 374 } 375 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) 376 $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>"; 377 if ( $tax->public ) 378 $actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>'; 379 380 /** 381 * Filter the action links displayed for each term in the Tags list table. 382 * 383 * @since 2.8.0 384 * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead. 385 * 386 * @param array $actions An array of action links to be displayed. Default 387 * 'Edit', 'Quick Edit', 'Delete', and 'View'. 388 * @param object $tag Term object. 389 */ 390 $actions = apply_filters( 'tag_row_actions', $actions, $tag ); 391 392 /** 393 * Filter the action links displayed for each term in the terms list table. 394 * 395 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 396 * 397 * @since 3.0.0 398 * 399 * @param array $actions An array of action links to be displayed. Default 400 * 'Edit', 'Quick Edit', 'Delete', and 'View'. 401 * @param object $tag Term object. 402 */ 403 $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag ); 404 405 return $this->row_actions( $actions ); 406 } 407 } 408 409 /** 378 410 * @param object $tag 379 411 * @return string 380 412 */ -
src/wp-admin/includes/class-wp-users-list-table.php
384 384 * @param WP_User $user_object WP_User object for the currently-listed user. 385 385 */ 386 386 $actions = apply_filters( 'user_row_actions', $actions, $user_object ); 387 $edit .= $this->row_actions( $actions );388 387 389 388 // Set up the checkbox ( because the user is editable, otherwise it's empty ) 390 389 $checkbox = '<label class="screen-reader-text" for="user_' . $user_object->ID . '">' . sprintf( __( 'Select %s' ), $user_object->user_login ) . '</label>' … … 398 397 399 398 $r = "<tr id='user-$user_object->ID'>"; 400 399 401 list( $columns, $hidden ) = $this->get_column_info();400 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 402 401 403 402 foreach ( $columns as $column_name => $column_display_name ) { 404 $class = "class=\"$column_name column-$column_name\""; 403 $classes = "$column_name column-$column_name"; 404 if ( $primary === $column_name ) { 405 $classes .= ' has-row-actions column-primary'; 406 } 405 407 406 408 $style = ''; 407 if ( in_array( $column_name, $hidden ) ) 409 if ( in_array( $column_name, $hidden ) ) { 408 410 $style = ' style="display:none;"'; 411 } 409 412 410 $attributes = " $class$style";413 $attributes = "class='$classes'$style"; 411 414 412 415 switch ( $column_name ) { 413 416 case 'cb': … … 414 417 $r .= "<th scope='row' class='check-column'>$checkbox</th>"; 415 418 break; 416 419 case 'username': 417 $r .= "<td $attributes>$avatar $edit </td>";420 $r .= "<td $attributes>$avatar $edit"; 418 421 break; 419 422 case 'name': 420 $r .= "<td $attributes>$user_object->first_name $user_object->last_name </td>";423 $r .= "<td $attributes>$user_object->first_name $user_object->last_name"; 421 424 break; 422 425 case 'email': 423 $r .= "<td $attributes><a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a> </td>";426 $r .= "<td $attributes><a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a>"; 424 427 break; 425 428 case 'role': 426 $r .= "<td $attributes>$role_name </td>";429 $r .= "<td $attributes>$role_name"; 427 430 break; 428 431 case 'posts': 429 432 $attributes = 'class="posts column-posts num"' . $style; … … 435 438 } else { 436 439 $r .= 0; 437 440 } 438 $r .= "</td>";439 441 break; 440 442 default: 441 443 $r .= "<td $attributes>"; … … 450 452 * @param int $user_id ID of the currently-listed user. 451 453 */ 452 454 $r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID ); 453 $r .= "</td>";454 455 } 456 457 if ( $primary === $column_name ) { 458 $r .= $this->row_actions( $actions ); 459 } 460 $r .= "</td>"; 455 461 } 456 462 $r .= '</tr>'; 457 463 458 464 return $r; 459 465 } 466 467 /** 468 * Get name of default primary column 469 * 470 * @since 4.3 471 * @access protected 472 * 473 * @return string 474 */ 475 protected function get_default_primary_column_name() { 476 return 'username'; 477 } 460 478 }