- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-ms-sites-list-table.php
r41289 r42343 40 40 'spam' => array( 'site-spammed', _x( 'Spam', 'site' ) ), 41 41 'deleted' => array( 'site-deleted', __( 'Deleted' ) ), 42 'mature' => array( 'site-mature', __( 'Mature' ) ) 43 ); 44 45 parent::__construct( array( 46 'plural' => 'sites', 47 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, 48 ) ); 49 } 50 51 /** 52 * 42 'mature' => array( 'site-mature', __( 'Mature' ) ), 43 ); 44 45 parent::__construct( 46 array( 47 'plural' => 'sites', 48 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, 49 ) 50 ); 51 } 52 53 /** 53 54 * @return bool 54 55 */ … … 80 81 $pagenum = $this->get_pagenum(); 81 82 82 $s = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST[ 's'] ) ) : '';83 $s = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : ''; 83 84 $wild = ''; 84 if ( false !== strpos( $s, '*') ) {85 if ( false !== strpos( $s, '*' ) ) { 85 86 $wild = '*'; 86 $s = trim($s, '*');87 $s = trim( $s, '*' ); 87 88 } 88 89 … … 91 92 * the latest sites with no paging in order to avoid expensive count queries. 92 93 */ 93 if ( ! $s && wp_is_large_network() ) {94 if ( ! isset($_REQUEST['orderby']) )94 if ( ! $s && wp_is_large_network() ) { 95 if ( ! isset( $_REQUEST['orderby'] ) ) { 95 96 $_GET['orderby'] = $_REQUEST['orderby'] = ''; 96 if ( !isset($_REQUEST['order']) ) 97 } 98 if ( ! isset( $_REQUEST['order'] ) ) { 97 99 $_GET['order'] = $_REQUEST['order'] = 'DESC'; 100 } 98 101 } 99 102 … … 104 107 ); 105 108 106 if ( empty( $s) ) {109 if ( empty( $s ) ) { 107 110 // Nothing to do. 108 111 } elseif ( preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $s ) || … … 111 114 preg_match( '/^[0-9]{1,3}\.$/', $s ) ) { 112 115 // IPv4 address 113 $sql = $wpdb->prepare( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s", $wpdb->esc_like( $s ) . ( ! empty( $wild ) ? '%' : '' ) );116 $sql = $wpdb->prepare( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s", $wpdb->esc_like( $s ) . ( ! empty( $wild ) ? '%' : '' ) ); 114 117 $reg_blog_ids = $wpdb->get_col( $sql ); 115 118 … … 147 150 148 151 if ( $order_by ) { 149 $args['order'] = ( isset( $_REQUEST['order'] ) && 'DESC' === strtoupper( $_REQUEST['order'] ) ) ? "DESC" : "ASC";152 $args['order'] = ( isset( $_REQUEST['order'] ) && 'DESC' === strtoupper( $_REQUEST['order'] ) ) ? 'DESC' : 'ASC'; 150 153 } 151 154 … … 172 175 } 173 176 174 $total_sites = get_sites( array_merge( $args, array( 175 'count' => true, 176 'offset' => 0, 177 'number' => 0, 178 ) ) ); 179 180 $this->set_pagination_args( array( 181 'total_items' => $total_sites, 182 'per_page' => $per_page, 183 ) ); 177 $total_sites = get_sites( 178 array_merge( 179 $args, array( 180 'count' => true, 181 'offset' => 0, 182 'number' => 0, 183 ) 184 ) 185 ); 186 187 $this->set_pagination_args( 188 array( 189 'total_items' => $total_sites, 190 'per_page' => $per_page, 191 ) 192 ); 184 193 } 185 194 … … 191 200 192 201 /** 193 *194 202 * @return array 195 203 */ 196 204 protected function get_bulk_actions() { 197 205 $actions = array(); 198 if ( current_user_can( 'delete_sites' ) ) 206 if ( current_user_can( 'delete_sites' ) ) { 199 207 $actions['delete'] = __( 'Delete' ); 200 $actions['spam'] = _x( 'Mark as Spam', 'site' ); 208 } 209 $actions['spam'] = _x( 'Mark as Spam', 'site' ); 201 210 $actions['notspam'] = _x( 'Not Spam', 'site' ); 202 211 … … 214 223 parent::pagination( $which ); 215 224 216 if ( 'top' === $which ) 225 if ( 'top' === $which ) { 217 226 $this->view_switcher( $mode ); 227 } 218 228 } 219 229 … … 267 277 $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); 268 278 ?> 269 <label class="screen-reader-text" for="blog_<?php echo $blog['blog_id']; ?>"><?php 270 printf( __( 'Select %s' ), $blogname ); 271 ?></label> 272 <input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ) ?>" /> 273 <?php endif; 279 <label class="screen-reader-text" for="blog_<?php echo $blog['blog_id']; ?>"> 280 <?php 281 printf( __( 'Select %s' ), $blogname ); 282 ?> 283 </label> 284 <input type="checkbox" id="blog_<?php echo $blog['blog_id']; ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ); ?>" /> 285 <?php 286 endif; 274 287 } 275 288 … … 297 310 global $mode; 298 311 299 $blogname = untrailingslashit( $blog['domain'] . $blog['path'] );312 $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); 300 313 $blog_states = array(); 301 314 reset( $this->status_list ); … … 309 322 if ( ! empty( $blog_states ) ) { 310 323 $state_count = count( $blog_states ); 311 $i = 0;324 $i = 0; 312 325 $blog_state .= ' — '; 313 326 foreach ( $blog_states as $state ) { 314 327 ++$i; 315 $sep = ( $i == $state_count ) ? '' : ', ';328 $sep = ( $i == $state_count ) ? '' : ', '; 316 329 $blog_state .= "<span class='post-state'>$state$sep</span>"; 317 330 } … … 394 407 $user_count = wp_cache_get( $blog['blog_id'] . '_user_count', 'blog-details' ); 395 408 if ( ! $user_count ) { 396 $blog_users = get_users( array( 'blog_id' => $blog['blog_id'], 'fields' => 'ID' ) ); 409 $blog_users = get_users( 410 array( 411 'blog_id' => $blog['blog_id'], 412 'fields' => 'ID', 413 ) 414 ); 397 415 $user_count = count( $blog_users ); 398 416 unset( $blog_users ); … … 450 468 451 469 /** 452 *453 470 * @global string $mode 454 471 */ 455 472 public function display_rows() { 456 473 foreach ( $this->items as $blog ) { 457 $blog = $blog->to_array();474 $blog = $blog->to_array(); 458 475 $class = ''; 459 476 reset( $this->status_list ); … … 503 520 // Preordered. 504 521 $actions = array( 505 'edit' => '', 'backend' => '', 506 'activate' => '', 'deactivate' => '', 507 'archive' => '', 'unarchive' => '', 508 'spam' => '', 'unspam' => '', 509 'delete' => '', 510 'visit' => '', 511 ); 512 513 $actions['edit'] = '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a>'; 514 $actions['backend'] = "<a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a>'; 522 'edit' => '', 523 'backend' => '', 524 'activate' => '', 525 'deactivate' => '', 526 'archive' => '', 527 'unarchive' => '', 528 'spam' => '', 529 'unspam' => '', 530 'delete' => '', 531 'visit' => '', 532 ); 533 534 $actions['edit'] = '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a>'; 535 $actions['backend'] = "<a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a>'; 515 536 if ( get_network()->site_id != $blog['blog_id'] ) { 516 537 if ( $blog['deleted'] == '1' ) { 517 $actions['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>';538 $actions['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>'; 518 539 } else { 519 540 $actions['deactivate'] = '<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>'; … … 523 544 $actions['unarchive'] = '<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>'; 524 545 } else { 525 $actions['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>';546 $actions['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>'; 526 547 } 527 548 … … 529 550 $actions['unspam'] = '<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>'; 530 551 } else { 531 $actions['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>';552 $actions['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>'; 532 553 } 533 554 … … 537 558 } 538 559 539 $actions['visit'] = "<a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='bookmark'>" . __( 'Visit' ) . '</a>';560 $actions['visit'] = "<a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='bookmark'>" . __( 'Visit' ) . '</a>'; 540 561 541 562 /**
Note: See TracChangeset
for help on using the changeset viewer.