diff -r c7c34916027a -r 177826044cd9 wp/wp-admin/includes/class-wp-users-list-table.php --- a/wp/wp-admin/includes/class-wp-users-list-table.php Mon Oct 14 18:06:33 2019 +0200 +++ b/wp/wp-admin/includes/class-wp-users-list-table.php Mon Oct 14 18:28:13 2019 +0200 @@ -43,30 +43,34 @@ * @param array $args An associative array of arguments. */ public function __construct( $args = array() ) { - parent::__construct( array( - 'singular' => 'user', - 'plural' => 'users', - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, - ) ); + parent::__construct( + array( + 'singular' => 'user', + 'plural' => 'users', + 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, + ) + ); $this->is_site_users = 'site-users-network' === $this->screen->id; - if ( $this->is_site_users ) + if ( $this->is_site_users ) { $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; + } } /** * Check the current user's permissions. * - * @since 3.1.0 + * @since 3.1.0 * * @return bool */ public function ajax_user_can() { - if ( $this->is_site_users ) + if ( $this->is_site_users ) { return current_user_can( 'manage_sites' ); - else + } else { return current_user_can( 'list_users' ); + } } /** @@ -84,40 +88,44 @@ $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : ''; - $per_page = ( $this->is_site_users ) ? 'site_users_network_per_page' : 'users_per_page'; + $per_page = ( $this->is_site_users ) ? 'site_users_network_per_page' : 'users_per_page'; $users_per_page = $this->get_items_per_page( $per_page ); $paged = $this->get_pagenum(); if ( 'none' === $role ) { $args = array( - 'number' => $users_per_page, - 'offset' => ( $paged-1 ) * $users_per_page, + 'number' => $users_per_page, + 'offset' => ( $paged - 1 ) * $users_per_page, 'include' => wp_get_users_with_no_role( $this->site_id ), - 'search' => $usersearch, - 'fields' => 'all_with_meta' + 'search' => $usersearch, + 'fields' => 'all_with_meta', ); } else { $args = array( 'number' => $users_per_page, - 'offset' => ( $paged-1 ) * $users_per_page, - 'role' => $role, + 'offset' => ( $paged - 1 ) * $users_per_page, + 'role' => $role, 'search' => $usersearch, - 'fields' => 'all_with_meta' + 'fields' => 'all_with_meta', ); } - if ( '' !== $args['search'] ) + if ( '' !== $args['search'] ) { $args['search'] = '*' . $args['search'] . '*'; + } - if ( $this->is_site_users ) + if ( $this->is_site_users ) { $args['blog_id'] = $this->site_id; + } - if ( isset( $_REQUEST['orderby'] ) ) + if ( isset( $_REQUEST['orderby'] ) ) { $args['orderby'] = $_REQUEST['orderby']; + } - if ( isset( $_REQUEST['order'] ) ) + if ( isset( $_REQUEST['order'] ) ) { $args['order'] = $_REQUEST['order']; + } /** * Filters the query arguments used to retrieve users for the current users list table. @@ -134,10 +142,12 @@ $this->items = $wp_user_search->get_results(); - $this->set_pagination_args( array( - 'total_items' => $wp_user_search->get_total(), - 'per_page' => $users_per_page, - ) ); + $this->set_pagination_args( + array( + 'total_items' => $wp_user_search->get_total(), + 'per_page' => $users_per_page, + ) + ); } /** @@ -173,21 +183,22 @@ $users_of_blog = count_users( 'time', $this->site_id ); restore_current_blog(); } else { - $url = 'users.php'; + $url = 'users.php'; $users_of_blog = count_users(); } $total_users = $users_of_blog['total_users']; $avail_roles =& $users_of_blog['avail_roles']; - unset($users_of_blog); + unset( $users_of_blog ); $current_link_attributes = empty( $role ) ? ' class="current" aria-current="page"' : ''; - $role_links = array(); + $role_links = array(); $role_links['all'] = "" . sprintf( _nx( 'All (%s)', 'All (%s)', $total_users, 'users' ), number_format_i18n( $total_users ) ) . ''; foreach ( $wp_roles->get_names() as $this_role => $name ) { - if ( !isset($avail_roles[$this_role]) ) + if ( ! isset( $avail_roles[ $this_role ] ) ) { continue; + } $current_link_attributes = ''; @@ -197,11 +208,11 @@ $name = translate_user_role( $name ); /* translators: User role name with count */ - $name = sprintf( __('%1$s (%2$s)'), $name, number_format_i18n( $avail_roles[$this_role] ) ); - $role_links[$this_role] = "$name"; + $name = sprintf( __( '%1$s (%2$s)' ), $name, number_format_i18n( $avail_roles[ $this_role ] ) ); + $role_links[ $this_role ] = "$name"; } - if ( ! empty( $avail_roles['none' ] ) ) { + if ( ! empty( $avail_roles['none'] ) ) { $current_link_attributes = ''; @@ -211,7 +222,7 @@ $name = __( 'No role' ); /* translators: User role name with count */ - $name = sprintf( __('%1$s (%2$s)'), $name, number_format_i18n( $avail_roles['none' ] ) ); + $name = sprintf( __( '%1$s (%2$s)' ), $name, number_format_i18n( $avail_roles['none'] ) ); $role_links['none'] = "$name"; } @@ -230,11 +241,13 @@ $actions = array(); if ( is_multisite() ) { - if ( current_user_can( 'remove_users' ) ) + if ( current_user_can( 'remove_users' ) ) { $actions['remove'] = __( 'Remove' ); + } } else { - if ( current_user_can( 'delete_users' ) ) + if ( current_user_can( 'delete_users' ) ) { $actions['delete'] = __( 'Delete' ); + } } return $actions; @@ -249,17 +262,17 @@ * or below the table ("bottom"). */ protected function extra_tablenav( $which ) { - $id = 'bottom' === $which ? 'new_role2' : 'new_role'; + $id = 'bottom' === $which ? 'new_role2' : 'new_role'; $button_id = 'bottom' === $which ? 'changeit2' : 'changeit'; - ?> + ?>