Ticket #25408: 25408.15.diff
File 25408.15.diff, 64.4 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.0 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.0 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 … … 491 478 $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); 492 479 493 480 $i = 0; 494 echo'<div class="row-actions">';481 $out .= '<div class="row-actions">'; 495 482 foreach ( $actions as $action => $link ) { 496 483 ++$i; 497 484 ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; … … 506 493 $action .= ' unapprove'; 507 494 } 508 495 509 echo"<span class='$action'>$sep$link</span>";496 $out .= "<span class='$action'>$sep$link</span>"; 510 497 } 511 echo'</div>';498 $out .= '</div>'; 512 499 } 500 501 return $out; 513 502 } 514 503 504 public function column_cb( $comment ) { 505 if ( $this->user_can ) { ?> 506 <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label> 507 <input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /> 508 <?php 509 } 510 } 511 512 public function column_comment( $comment ) { 513 global $comment_status; 514 $post = get_post(); 515 516 $comment_url = esc_url( get_comment_link( $comment->comment_ID ) ); 517 $the_comment_status = wp_get_comment_status( $comment->comment_ID ); 518 519 echo '<div class="comment-author">'; 520 $this->column_author( $comment ); 521 echo '</div>'; 522 523 echo '<div class="submitted-on">'; 524 /* translators: 2: comment date, 3: comment time */ 525 printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url, 526 /* translators: comment date format. See http://php.net/date */ 527 get_comment_date( __( 'Y/m/d' ) ), 528 get_comment_date( get_option( 'time_format' ) ) 529 ); 530 531 if ( $comment->comment_parent ) { 532 $parent = get_comment( $comment->comment_parent ); 533 $parent_link = esc_url( get_comment_link( $comment->comment_parent ) ); 534 $name = get_comment_author( $parent->comment_ID ); 535 printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name ); 536 } 537 538 echo '</div>'; 539 comment_text(); 540 if ( $this->user_can ) { ?> 541 <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden"> 542 <textarea class="comment" rows="1" cols="1"><?php 543 /** This filter is documented in wp-admin/includes/comment.php */ 544 echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) ); 545 ?></textarea> 546 <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div> 547 <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div> 548 <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div> 549 <div class="comment_status"><?php echo $comment->comment_approved; ?></div> 550 </div> 551 <?php 552 } 553 } 554 515 555 public function column_author( $comment ) { 516 556 global $comment_status; 517 557 -
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 switch ( $column_name ) { 141 case 'cb': ?> 142 <th scope="row" class="check-column"> 143 <label class="screen-reader-text" for="cb-select-<?php echo $link->link_id; ?>"><?php echo sprintf( __( 'Select %s' ), $link->link_name ); ?></label> 144 <input type="checkbox" name="linkcheck[]" id="cb-select-<?php echo $link->link_id; ?>" value="<?php echo esc_attr( $link->link_id ); ?>" /> 145 </th> 146 <?php 147 break; 156 if ( 'cb' === $column_name ) { 157 ?> 158 <th scope="row" class="check-column"> 159 <label class="screen-reader-text" for="cb-select-<?php echo $link->link_id; ?>"><?php echo sprintf( __( 'Select %s' ), $link->link_name ); ?></label> 160 <input type="checkbox" name="linkcheck[]" id="cb-select-<?php echo $link->link_id; ?>" value="<?php echo esc_attr( $link->link_id ); ?>" /> 161 </th> 162 <?php 163 } else { 164 echo "<td $attributes>"; 148 165 149 case 'name': 150 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 />"; 166 switch ( $column_name ) { 167 case 'cb': 168 break; 151 169 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 break; 159 case 'url': 160 echo "<td $attributes><a href='$link->link_url' title='". esc_attr( sprintf( __( 'Visit %s' ), $link->link_name ) )."'>$short_url</a></td>"; 161 break; 162 case 'categories': 163 ?><td <?php echo $attributes ?>><?php 164 $cat_names = array(); 165 foreach ( $link->link_category as $category ) { 166 $cat = get_term( $category, 'link_category', OBJECT, 'display' ); 167 if ( is_wp_error( $cat ) ) 168 echo $cat->get_error_message(); 169 $cat_name = $cat->name; 170 if ( $cat_id != $category ) 171 $cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>"; 172 $cat_names[] = $cat_name; 173 } 174 echo implode( ', ', $cat_names ); 175 ?></td><?php 176 break; 177 case 'rel': 178 ?><td <?php echo $attributes ?>><?php echo empty( $link->link_rel ) ? '<br />' : $link->link_rel; ?></td><?php 179 break; 180 case 'visible': 181 ?><td <?php echo $attributes ?>><?php echo $visible; ?></td><?php 182 break; 183 case 'rating': 184 ?><td <?php echo $attributes ?>><?php echo $rating; ?></td><?php 185 break; 186 default: 187 ?> 188 <td <?php echo $attributes ?>><?php 170 case 'name': 171 echo "<strong><a class='row-title' href='$edit_link' title='" . esc_attr( sprintf( __( 'Edit “%s”' ), $link->link_name ) ) . "'>$link->link_name</a></strong><br />"; 172 break; 173 case 'url': 174 echo "<a href='$link->link_url' title='". esc_attr( sprintf( __( 'Visit %s' ), $link->link_name ) )."'>$short_url</a>"; 175 break; 176 case 'categories': 177 $cat_names = array(); 178 foreach ( $link->link_category as $category ) { 179 $cat = get_term( $category, 'link_category', OBJECT, 'display' ); 180 if ( is_wp_error( $cat ) ) 181 echo $cat->get_error_message(); 182 $cat_name = $cat->name; 183 if ( $cat_id != $category ) 184 $cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>"; 185 $cat_names[] = $cat_name; 186 } 187 echo implode( ', ', $cat_names ); 188 break; 189 case 'rel': 190 echo empty( $link->link_rel ) ? '<br />' : $link->link_rel; 191 break; 192 case 'visible': 193 echo $visible; 194 break; 195 case 'rating': 196 echo $rating; 197 break; 198 default: 189 199 /** 190 200 * Fires for each registered custom link column. 191 201 * … … 195 205 * @param int $link_id Link ID. 196 206 */ 197 207 do_action( 'manage_link_custom_column', $column_name, $link->link_id ); 198 ?></td> 199 <?php 200 break; 208 break; 209 } 201 210 } 211 212 echo $this->handle_row_actions( $link, $column_name, $primary ); 213 echo '</td>'; 202 214 } 203 215 ?> 204 216 </tr> … … 205 217 <?php 206 218 } 207 219 } 220 221 /** 222 * Generate and display row actions links 223 * 224 * @since 4.3 225 * @access protected 226 * 227 * @param object $link Link being acted upon 228 * @param string $column_name Current column name 229 * @param string $primary Primary column name 230 * 231 * @return string 232 */ 233 protected function handle_row_actions( $link, $column_name, $primary ) { 234 if( $primary === $column_name ) { 235 $edit_link = get_edit_bookmark_link( $link ); 236 237 $actions = array(); 238 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 239 $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>"; 240 return $this->row_actions($actions); 241 } 242 } 208 243 } -
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.0 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.0 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.0 821 * 822 * @param string $default Column name default for the specific list table (eg: 'name') 823 * @param string $context Screen ID for specific list table (eg: 'plugins') 824 */ 825 $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); 826 827 if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { 828 $column = $default; 829 } 830 831 return $column; 832 } 833 834 /** 795 835 * Get a list of all, hidden and sortable columns, with filter applied 796 836 * 797 837 * @since 3.1.0 … … 831 871 $sortable[$id] = $data; 832 872 } 833 873 834 $this->_column_headers = array( $columns, $hidden, $sortable ); 874 $primary = $this->get_primary_column_name(); 875 $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); 835 876 836 877 return $this->_column_headers; 837 878 } … … 1059 1100 * @param object $item The current item 1060 1101 */ 1061 1102 protected function single_row_columns( $item ) { 1062 list( $columns, $hidden ) = $this->get_column_info();1103 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 1063 1104 1064 1105 foreach ( $columns as $column_name => $column_display_name ) { 1065 $class = "class='$column_name column-$column_name'"; 1106 $classes = "$column_name column-$column_name"; 1107 if ( $primary === $column_name ) { 1108 $classes .= ' has-row-actions column-primary'; 1109 } 1066 1110 1067 1111 $style = ''; 1068 if ( in_array( $column_name, $hidden ) ) 1112 if ( in_array( $column_name, $hidden ) ) { 1069 1113 $style = ' style="display:none;"'; 1114 } 1070 1115 1071 $attributes = " $class$style";1116 $attributes = "class='$classes'$style"; 1072 1117 1073 1118 if ( 'cb' == $column_name ) { 1074 1119 echo '<th scope="row" class="check-column">'; … … 1078 1123 elseif ( method_exists( $this, 'column_' . $column_name ) ) { 1079 1124 echo "<td $attributes>"; 1080 1125 echo call_user_func( array( $this, 'column_' . $column_name ), $item ); 1126 echo $this->handle_row_actions( $item, $column_name, $primary ); 1081 1127 echo "</td>"; 1082 1128 } 1083 1129 else { … … 1089 1135 } 1090 1136 1091 1137 /** 1138 * Generate and display row actions links 1139 * 1140 * @since 4.3.0 1141 * @access protected 1142 * 1143 * @param object $item Item being acted upon 1144 * @param string $column_name Current column name 1145 * @param string $primary Primary column name 1146 * 1147 * @return string 1148 */ 1149 protected function handle_row_actions( $item, $column_name, $primary ) { 1150 return ''; 1151 } 1152 1153 /** 1092 1154 * Handle an incoming ajax request (called from admin-ajax.php) 1093 1155 * 1094 1156 * @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.0 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"> … … 269 277 echo '<p>' . sprintf( __( '%1$s – <em>%2$s</em>' ), get_option( 'blogname' ), get_option( 'blogdescription ' ) ) . '</p>'; 270 278 restore_current_blog(); 271 279 } 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 ( $blog['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 292 if ( $blog['archived'] == '1' ) { 293 $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>'; 294 } else { 295 $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>'; 296 } 297 298 if ( $blog['spam'] == '1' ) { 299 $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>'; 300 } else { 301 $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>'; 302 } 303 304 if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) { 305 $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>'; 306 } 307 } 308 309 $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>'; 310 311 /** 312 * Filter the action links displayed for each site in the Sites list table. 313 * 314 * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by 315 * default for each site. The site's status determines whether to show the 316 * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and 317 * 'Not Spam' or 'Spam' link for each site. 318 * 319 * @since 3.1.0 320 * 321 * @param array $actions An array of action links to be displayed. 322 * @param int $blog_id The site ID. 323 * @param string $blogname Site path, formatted depending on whether it is a sub-domain 324 * or subdirectory multisite install. 325 */ 326 $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); 327 echo $this->row_actions( $actions ); 280 echo $this->handle_row_actions( $blog, $column_name, $primary ); 328 281 ?> 329 282 </td> 330 283 <?php … … 331 284 break; 332 285 333 286 case 'lastupdated': 334 echo "<td class='$column_name column-$column_name'$style>"; 335 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 ?> 336 291 </td> 337 292 <?php 338 293 break; 339 294 case 'registered': 340 echo "<td class='$column_name column-$column_name'$style>";295 echo "<td $attributes>"; 341 296 if ( $blog['registered'] == '0000-00-00 00:00:00' ) 342 297 echo '—'; 343 298 else 344 299 echo mysql2date( $date, $blog['registered'] ); 300 echo $this->handle_row_actions( $blog, $column_name, $primary ); 345 301 ?> 346 302 </td> 347 303 <?php 348 304 break; 349 305 case 'users': 350 echo "<td class='$column_name column-$column_name'$style>";306 echo "<td $attributes>"; 351 307 $blogusers = get_users( array( 'blog_id' => $blog['blog_id'], 'number' => 6) ); 352 308 if ( is_array( $blogusers ) ) { 353 309 $blogusers_warning = ''; … … 364 320 if ( $blogusers_warning != '' ) 365 321 echo '<strong>' . $blogusers_warning . '</strong><br />'; 366 322 } 323 echo $this->handle_row_actions( $blog, $column_name, $primary ); 367 324 ?> 368 325 </td> 369 326 <?php … … 371 328 372 329 case 'plugins': ?> 373 330 <?php if ( has_filter( 'wpmublogsaction' ) ) { 374 echo "<td class='$column_name column-$column_name'$style>";331 echo "<td $attributes>"; 375 332 /** 376 333 * Fires inside the auxiliary 'Actions' column of the Sites list table. 377 334 * … … 381 338 * 382 339 * @param int $blog_id The site ID. 383 340 */ 384 do_action( 'wpmublogsaction', $blog['blog_id'] ); ?> 341 do_action( 'wpmublogsaction', $blog['blog_id'] ); 342 echo $this->handle_row_actions( $blog, $column_name, $primary ); 343 ?> 385 344 </td> 386 345 <?php } 387 346 break; 388 347 389 348 default: 390 echo "<td class='$column_name column-$column_name'$style>";349 echo "<td $attributes>"; 391 350 /** 392 351 * Fires for each registered custom column in the Sites list table. 393 352 * … … 397 356 * @param int $blog_id The site ID. 398 357 */ 399 358 do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] ); 359 echo $this->handle_row_actions( $blog, $column_name, $primary ); 400 360 echo "</td>"; 401 361 break; 402 362 } … … 406 366 <?php 407 367 } 408 368 } 369 370 /** 371 * Get name of default primary column 372 * 373 * @since 4.3.0 374 * @access protected 375 * 376 * @return string 377 */ 378 protected function get_default_primary_column_name() { 379 return 'blogname'; 380 } 381 382 /** 383 * Generate and display row actions links 384 * 385 * @since 4.3.0 386 * @access protected 387 * 388 * @param object $blog Blog being acted upon 389 * @param string $column_name Current column name 390 * @param string $primary Primary column name 391 * 392 * @return string 393 */ 394 protected function handle_row_actions( $blog, $column_name, $primary ) { 395 global $current_site; 396 397 if ( $primary === $column_name ) { 398 $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path']; 399 400 // Preordered. 401 $actions = array( 402 'edit' => '', 'backend' => '', 403 'activate' => '', 'deactivate' => '', 404 'archive' => '', 'unarchive' => '', 405 'spam' => '', 'unspam' => '', 406 'delete' => '', 407 'visit' => '', 408 ); 409 410 $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>'; 411 $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>'; 412 if ( get_current_site()->blog_id != $blog['blog_id'] ) { 413 if ( $blog['deleted'] == '1' ) { 414 $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>'; 415 } else { 416 $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>'; 417 } 418 419 if ( $blog['archived'] == '1' ) { 420 $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>'; 421 } else { 422 $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>'; 423 } 424 425 if ( $blog['spam'] == '1' ) { 426 $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>'; 427 } else { 428 $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>'; 429 } 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 436 $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>'; 437 438 /** 439 * Filter the action links displayed for each site in the Sites list table. 440 * 441 * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by 442 * default for each site. The site's status determines whether to show the 443 * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and 444 * 'Not Spam' or 'Spam' link for each site. 445 * 446 * @since 3.1.0 447 * 448 * @param array $actions An array of action links to be displayed. 449 * @param int $blog_id The site ID. 450 * @param string $blogname Site path, formatted depending on whether it is a sub-domain 451 * or subdirectory multisite install. 452 */ 453 $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); 454 return $this->row_actions( $actions ); 455 } 456 } 409 457 } -
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.0 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 ) { 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 switch ( $column_name ){179 case 'cb':?>180 181 182 183 186 if ( 'cb' === $column_name ){ 187 ?> 188 <th scope="row" class="check-column"> 189 <label class="screen-reader-text" for="blog_<?php echo $user->ID; ?>"><?php echo sprintf( __( 'Select %s' ), $user->user_login ); ?></label> 190 <input type="checkbox" id="blog_<?php echo $user->ID ?>" name="allusers[]" value="<?php echo esc_attr( $user->ID ) ?>" /> 191 </th> 184 192 <?php 185 break; 193 } else { 194 echo "<td $attributes>"; 195 196 switch ( $column_name ) { 197 case 'username': 198 $avatar = get_avatar( $user->user_email, 32 ); 199 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); 186 200 187 case 'username': 188 $avatar = get_avatar( $user->user_email, 32 ); 189 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); 190 191 echo "<td $attributes>"; ?> 192 <?php echo $avatar; ?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo $user->user_login; ?></a><?php 201 echo $avatar; ?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo $user->user_login; ?></a><?php 193 202 if ( in_array( $user->user_login, $super_admins ) ) 194 203 echo ' - ' . __( 'Super Admin' ); 195 204 ?></strong> 196 <br/> 197 <?php 198 $actions = array(); 199 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 205 <?php 206 break; 200 207 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 }208 case 'name': 209 echo "$user->first_name $user->last_name"; 210 break; 204 211 205 /** 206 * Filter the action links displayed under each user 207 * in the Network Admin Users list table. 208 * 209 * @since 3.2.0 210 * 211 * @param array $actions An array of action links to be displayed. 212 * Default 'Edit', 'Delete'. 213 * @param WP_User $user WP_User object. 214 */ 215 $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); 216 echo $this->row_actions( $actions ); 217 ?> 218 </td> 219 <?php 220 break; 212 case 'email': 213 echo "<a href='mailto:$user->user_email'>$user->user_email</a>"; 214 break; 221 215 222 case 'name': 223 echo "<td $attributes>$user->first_name $user->last_name</td>"; 224 break; 216 case 'registered': 217 if ( 'list' == $mode ) 218 $date = __( 'Y/m/d' ); 219 else 220 $date = __( 'Y/m/d g:i:s a' ); 225 221 226 case 'email': 227 echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a></td>"; 228 break; 222 echo mysql2date( $date, $user->user_registered ); 223 break; 229 224 230 case 'registered': 231 if ( 'list' == $mode ) 232 $date = __( 'Y/m/d' ); 233 else 234 $date = __( 'Y/m/d g:i:s a' ); 235 236 echo "<td $attributes>" . mysql2date( $date, $user->user_registered ) . "</td>"; 237 break; 238 239 case 'blogs': 240 $blogs = get_blogs_of_user( $user->ID, true ); 241 echo "<td $attributes>"; 225 case 'blogs': 226 $blogs = get_blogs_of_user( $user->ID, true ); 242 227 if ( is_array( $blogs ) ) { 243 228 foreach ( (array) $blogs as $key => $val ) { 244 229 if ( !can_edit_network( $val->site_id ) ) … … 289 274 echo '</small></span><br/>'; 290 275 } 291 276 } 292 ?> 293 </td> 294 <?php 295 break; 277 break; 296 278 297 default: 298 echo "<td $attributes>"; 299 /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */ 300 echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID ); 301 echo "</td>"; 302 break; 279 default: 280 /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */ 281 echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID ); 282 break; 283 } 303 284 } 285 286 echo $this->handle_row_actions( $user, $column_name, $primary ); 287 echo '</td>'; 304 288 endforeach 305 289 ?> 306 290 </tr> … … 307 291 <?php 308 292 } 309 293 } 294 295 /** 296 * Get name of default primary column 297 * 298 * @since 4.3.0 299 * @access protected 300 * 301 * @return string 302 */ 303 protected function get_default_primary_column_name() { 304 return 'username'; 305 } 306 307 /** 308 * Generate and display row actions links 309 * 310 * @since 4.3.0 311 * @access protected 312 * 313 * @param object $user User being acted upon 314 * @param string $column_name Current column name 315 * @param string $primary Primary column name 316 * 317 * @return string 318 */ 319 protected function handle_row_actions( $user, $column_name, $primary ) { 320 $super_admins = get_super_admins(); 321 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); 322 323 if ( $primary === $column_name ) { 324 $actions = array(); 325 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 326 327 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) { 328 $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>'; 329 } 330 331 /** 332 * Filter the action links displayed under each user 333 * in the Network Admin Users list table. 334 * 335 * @since 3.2.0 336 * 337 * @param array $actions An array of action links to be displayed. 338 * Default 'Edit', 'Delete'. 339 * @param WP_User $user WP_User object. 340 */ 341 $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); 342 return $this->row_actions( $actions ); 343 } 344 } 310 345 } -
src/wp-admin/includes/class-wp-plugins-list-table.php
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.0 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.0 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.0 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.0 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.0 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.0 471 * @access protected 472 * 473 * @return string 474 */ 475 protected function get_default_primary_column_name() { 476 return 'username'; 477 } 460 478 }