Ticket #37392: 37392.diff
File 37392.diff, 4.4 KB (added by , 6 years ago) |
---|
-
src/wp-admin/includes/class-wp-ms-sites-list-table.php
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
157 157 } else { 158 158 $args['no_found_rows'] = false; 159 159 } 160 // Take into account the role the user has selected. 161 $status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : ''; 162 if ( in_array( $status, array( 'public', 'archived', 'mature', 'spam', 'deleted' ), true ) ) { 163 $args[ $status ] = 1; 164 } 160 165 161 166 /** 162 167 * Filters the arguments for the site query in the sites list table. … … 199 204 _e( 'No sites found.' ); 200 205 } 201 206 207 /** 208 * Gets links to filter sites by status. 209 * 210 * @since 5.3.0 211 * 212 * @return array 213 * 214 */ 215 protected function get_views() { 216 $counts = wp_count_sites(); 217 218 $statuses = array( 219 'all' => _n_noop( 'All <span class="count">(%s)</span>', 'All <span class="count">(%1$s)</span>' ), 220 'public' => _n_noop( 'Public <span class="count">(%s)</span>', 'Public <span class="count">(%1$s)</span>' ), 221 'archived' => _n_noop( 'Archived <span class="count">(%1$s)</span>', 'Archived <span class="count">(%1$s)</span>' ), 222 'mature' => _n_noop( 'Mature <span class="count">(%1$s)</span>', 'Mature <span class="count">(%1$s)</span>' ), 223 'spam' => _n_noop( 'Spam <span class="count">(%1$s)</span>', 'Spam <span class="count">(%1$s)</span>' ), 224 'deleted' => _n_noop( 'Deleted <span class="count">(%1$s)</span>', 'Deleted <span class="count">(%1$s)</span>' ), 225 ); 226 227 $view_links = array(); 228 $requested_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : ''; 229 $url = 'sites.php'; 230 231 foreach ( $statuses as $status => $label_count ) { 232 $current_link_attributes = $requested_status === $status || ( $requested_status === '' && 'all' === $status ) 233 ? ' class="current" aria-current="page"' 234 : ''; 235 if ( (int) $counts[ $status ] > 0 ) { 236 $label = sprintf( translate_nooped_plural( $label_count, $counts[ $status ] ), number_format_i18n( $counts[ $status ] ) ); 237 238 $full_url = 'all' === $status ? $url : add_query_arg( 'status', $status, $url ); 239 240 $view_links[ $status ] = sprintf( 241 '<a href="%1$s"%2$s>%3$s</a>', 242 esc_url( $full_url ), 243 $current_link_attributes, 244 $label 245 ); 246 } 247 } 248 249 return $view_links; 250 } 251 202 252 /** 203 253 * @return array 204 254 */ -
src/wp-admin/network/sites.php
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
355 355 356 356 <hr class="wp-header-end"> 357 357 358 <?php $wp_list_table->views(); ?> 359 358 360 <?php echo $msg; ?> 359 361 360 362 <form method="get" id="ms-search" class="wp-clearfix"> -
src/wp-includes/ms-blogs.php
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
854 854 855 855 update_posts_count(); 856 856 } 857 858 /** 859 * Count number of sites grouped by site status. 860 * 861 * @since 5.3.0 862 * 863 * @global wpdb $wpdb WordPress database abstraction object. 864 * 865 * @param int $network_id Defaults to the current network id 866 * 867 * @return object Includes a grand total 'all' and an array of counts indexed by status strings: public, archived, 868 * mature, spam, deleted 869 */ 870 function wp_count_sites( $network_id = null ) { 871 global $wpdb; 872 873 if ( ! $network_id ) { 874 $network_id = get_current_network_id(); 875 } 876 877 $counts = array(); 878 $args = array( 879 'network_id' => $network_id, 880 'number' => 1, 881 'fields' => 'ids', 882 'no_found_rows' => false, 883 ); 884 $q = new WP_Site_Query(); 885 $q->query( $args ); 886 887 $counts['all'] = $q->found_sites; 888 889 $statuses = array( 'public', 'archived', 'mature', 'spam', 'deleted' ); 890 foreach ( $statuses as $status ) { 891 $q = new WP_Site_Query(); 892 $_args = $args; 893 $_args[ $status ] = 1; 894 $q->query( $_args ); 895 896 $counts[ $status ] = $q->found_sites; 897 898 } 899 900 return $counts; 901 }