- Timestamp:
- 07/14/2015 05:46:13 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-ms-sites-list-table.php
r33199 r33270 410 410 411 411 /** 412 * Handles columns output for a single row.413 *414 * @since 4.3.0415 * @access public416 *417 * @param array $item Current site.418 */419 public function single_row_columns( $item ) {420 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();421 422 foreach ( $columns as $column_name => $column_display_name ) {423 $classes = "$column_name column-$column_name";424 if ( $primary === $column_name ) {425 $classes .= ' has-row-actions column-primary';426 }427 428 if ( in_array( $column_name, $hidden ) ) {429 $classes .= ' hidden';430 }431 432 $data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';433 434 $attributes = "class='$classes' $data";435 436 if ( 'cb' === $column_name ) {437 echo '<th scope="row" class="check-column">';438 439 $this->column_cb( $item );440 441 echo '</th>';442 } elseif ( 'id' === $column_name ) {443 ?>444 <th scope="row">445 <?php echo $item['blog_id'] ?>446 </th>447 <?php448 } elseif ( method_exists( $this, 'column_' . $column_name ) ) {449 echo "<td $attributes>";450 451 echo call_user_func( array( $this, 'column_' . $column_name ), $item );452 453 echo $this->handle_row_actions( $item, $column_name, $primary );454 echo "</td>";455 } else {456 echo "<td $attributes>";457 458 echo $this->column_default( $item, $column_name );459 460 echo $this->handle_row_actions( $item, $column_name, $primary );461 echo "</td>";462 }463 }464 }465 466 /**467 412 * 468 413 * @global string $mode … … 511 456 */ 512 457 protected function handle_row_actions( $blog, $column_name, $primary ) { 513 if ( $primary === $column_name ) { 514 $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); 515 516 // Preordered. 517 $actions = array( 518 'edit' => '', 'backend' => '', 519 'activate' => '', 'deactivate' => '', 520 'archive' => '', 'unarchive' => '', 521 'spam' => '', 'unspam' => '', 522 'delete' => '', 523 'visit' => '', 524 ); 525 526 $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>'; 527 $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>'; 528 if ( get_current_site()->blog_id != $blog['blog_id'] ) { 529 if ( $blog['deleted'] == '1' ) { 530 $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'] ), 'activateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Activate' ) . '</a></span>'; 531 } else { 532 $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'] ), 'deactivateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Deactivate' ) . '</a></span>'; 533 } 534 535 if ( $blog['archived'] == '1' ) { 536 $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'] ), 'unarchiveblog_' . $blog['blog_id'] ) ) . '">' . __( 'Unarchive' ) . '</a></span>'; 537 } else { 538 $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'] ), 'archiveblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>'; 539 } 540 541 if ( $blog['spam'] == '1' ) { 542 $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'] ), 'unspamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>'; 543 } else { 544 $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'] ), 'spamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Spam', 'site' ) . '</a></span>'; 545 } 546 547 if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) { 548 $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'] ), 'deleteblog_' . $blog['blog_id'] ) ) . '">' . __( 'Delete' ) . '</a></span>'; 549 } 550 } 551 552 $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>'; 553 554 /** 555 * Filter the action links displayed for each site in the Sites list table. 556 * 557 * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by 558 * default for each site. The site's status determines whether to show the 559 * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and 560 * 'Not Spam' or 'Spam' link for each site. 561 * 562 * @since 3.1.0 563 * 564 * @param array $actions An array of action links to be displayed. 565 * @param int $blog_id The site ID. 566 * @param string $blogname Site path, formatted depending on whether it is a sub-domain 567 * or subdirectory multisite install. 568 */ 569 $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); 570 return $this->row_actions( $actions ); 571 } 458 if ( $primary !== $column_name ) { 459 return; 460 } 461 462 $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); 463 464 // Preordered. 465 $actions = array( 466 'edit' => '', 'backend' => '', 467 'activate' => '', 'deactivate' => '', 468 'archive' => '', 'unarchive' => '', 469 'spam' => '', 'unspam' => '', 470 'delete' => '', 471 'visit' => '', 472 ); 473 474 $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>'; 475 $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>'; 476 if ( get_current_site()->blog_id != $blog['blog_id'] ) { 477 if ( $blog['deleted'] == '1' ) { 478 $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'] ), 'activateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Activate' ) . '</a></span>'; 479 } else { 480 $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'] ), 'deactivateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Deactivate' ) . '</a></span>'; 481 } 482 483 if ( $blog['archived'] == '1' ) { 484 $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'] ), 'unarchiveblog_' . $blog['blog_id'] ) ) . '">' . __( 'Unarchive' ) . '</a></span>'; 485 } else { 486 $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'] ), 'archiveblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>'; 487 } 488 489 if ( $blog['spam'] == '1' ) { 490 $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'] ), 'unspamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>'; 491 } else { 492 $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'] ), 'spamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Spam', 'site' ) . '</a></span>'; 493 } 494 495 if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) { 496 $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'] ), 'deleteblog_' . $blog['blog_id'] ) ) . '">' . __( 'Delete' ) . '</a></span>'; 497 } 498 } 499 500 $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>'; 501 502 /** 503 * Filter the action links displayed for each site in the Sites list table. 504 * 505 * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by 506 * default for each site. The site's status determines whether to show the 507 * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and 508 * 'Not Spam' or 'Spam' link for each site. 509 * 510 * @since 3.1.0 511 * 512 * @param array $actions An array of action links to be displayed. 513 * @param int $blog_id The site ID. 514 * @param string $blogname Site path, formatted depending on whether it is a sub-domain 515 * or subdirectory multisite install. 516 */ 517 $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); 518 return $this->row_actions( $actions ); 572 519 } 573 520 }
Note: See TracChangeset
for help on using the changeset viewer.