芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/cepali.edu.mx/wp-admin/includes/class-wp-ms-users-list-table.php
get_items_per_page( 'users_network_per_page' ); $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : ''; $paged = $this->get_pagenum(); $args = array( 'number' => $users_per_page, 'offset' => ( $paged - 1 ) * $users_per_page, 'search' => $usersearch, 'blog_id' => 0, 'fields' => 'all_with_meta', ); if ( wp_is_large_network( 'users' ) ) { $args['search'] = ltrim( $args['search'], '*' ); } elseif ( '' !== $args['search'] ) { $args['search'] = trim( $args['search'], '*' ); $args['search'] = '*' . $args['search'] . '*'; } if ( 'super' === $role ) { $args['login__in'] = get_super_admins(); } /* * If the network is large and a search is not being performed, * show only the latest users with no paging in order to avoid * expensive count queries. */ if ( ! $usersearch && wp_is_large_network( 'users' ) ) { if ( ! isset( $_REQUEST['orderby'] ) ) { $_GET['orderby'] = 'id'; $_REQUEST['orderby'] = 'id'; } if ( ! isset( $_REQUEST['order'] ) ) { $_GET['order'] = 'DESC'; $_REQUEST['order'] = 'DESC'; } $args['count_total'] = false; } if ( isset( $_REQUEST['orderby'] ) ) { $args['orderby'] = $_REQUEST['orderby']; } if ( isset( $_REQUEST['order'] ) ) { $args['order'] = $_REQUEST['order']; } /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */ $args = apply_filters( 'users_list_table_query_args', $args ); // Query the user IDs for this page. $wp_user_search = new WP_User_Query( $args ); $this->items = $wp_user_search->get_results(); $this->set_pagination_args( array( 'total_items' => $wp_user_search->get_total(), 'per_page' => $users_per_page, ) ); } /** * @return array */ protected function get_bulk_actions() { $actions = array(); if ( current_user_can( 'delete_users' ) ) { $actions['delete'] = __( 'Delete' ); } $actions['spam'] = _x( 'Mark as spam', 'user' ); $actions['notspam'] = _x( 'Not spam', 'user' ); return $actions; } /** */ public function no_items() { _e( 'No users found.' ); } /** * @global string $role * @return array */ protected function get_views() { global $role; $total_users = get_user_count(); $super_admins = get_super_admins(); $total_admins = count( $super_admins ); $role_links = array(); $role_links['all'] = array( 'url' => network_admin_url( 'users.php' ), 'label' => sprintf( /* translators: Number of users. */ _nx( 'All
(%s)
', 'All
(%s)
', $total_users, 'users' ), number_format_i18n( $total_users ) ), 'current' => 'super' !== $role, ); $role_links['super'] = array( 'url' => network_admin_url( 'users.php?role=super' ), 'label' => sprintf( /* translators: Number of users. */ _n( 'Super Admin
(%s)
', 'Super Admins
(%s)
', $total_admins ), number_format_i18n( $total_admins ) ), 'current' => 'super' === $role, ); return $this->get_views_links( $role_links ); } /** * @global string $mode List table view mode. * * @param string $which */ protected function pagination( $which ) { global $mode; parent::pagination( $which ); if ( 'top' === $which ) { $this->view_switcher( $mode ); } } /** * @return string[] Array of column titles keyed by their column name. */ public function get_columns() { $users_columns = array( 'cb' => '
', 'username' => __( 'Username' ), 'name' => __( 'Name' ), 'email' => __( 'Email' ), 'registered' => _x( 'Registered', 'user' ), 'blogs' => __( 'Sites' ), ); /** * Filters the columns displayed in the Network Admin Users list table. * * @since MU (3.0.0) * * @param string[] $users_columns An array of user columns. Default 'cb', 'username', * 'name', 'email', 'registered', 'blogs'. */ return apply_filters( 'wpmu_users_columns', $users_columns ); } /** * @return array */ protected function get_sortable_columns() { return array( 'username' => array( 'login', false, __( 'Username' ), __( 'Table ordered by Username.' ), 'asc' ), 'name' => array( 'name', false, __( 'Name' ), __( 'Table ordered by Name.' ) ), 'email' => array( 'email', false, __( 'E-mail' ), __( 'Table ordered by E-mail.' ) ), 'registered' => array( 'id', false, _x( 'Registered', 'user' ), __( 'Table ordered by User Registered Date.' ) ), ); } /** * Handles the checkbox column output. * * @since 4.3.0 * @since 5.9.0 Renamed `$user` to `$item` to match parent class for PHP 8 named parameter support. * * @param WP_User $item The current WP_User object. */ public function column_cb( $item ) { // Restores the more descriptive, specific name for use within this method. $user = $item; if ( is_super_admin( $user->ID ) ) { return; } ?>
user_login ); ?>
ID; } /** * Handles the username column output. * * @since 4.3.0 * * @param WP_User $user The current WP_User object. */ public function column_username( $user ) { $super_admins = get_super_admins(); $avatar = get_avatar( $user->user_email, 32 ); echo $avatar; if ( current_user_can( 'edit_user', $user->ID ) ) { $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); $edit = "
{$user->user_login}
"; } else { $edit = $user->user_login; } ?>
user_login, $super_admins, true ) ) { echo ' — ' . __( 'Super Admin' ); } ?>
first_name && $user->last_name ) { printf( /* translators: 1: User's first name, 2: Last name. */ _x( '%1$s %2$s', 'Display name based on first name and last name' ), $user->first_name, $user->last_name ); } elseif ( $user->first_name ) { echo $user->first_name; } elseif ( $user->last_name ) { echo $user->last_name; } else { echo '
—
' . /* translators: Hidden accessibility text. */ _x( 'Unknown', 'name' ) . '
'; } } /** * Handles the email column output. * * @since 4.3.0 * * @param WP_User $user The current WP_User object. */ public function column_email( $user ) { echo "
$user->user_email
"; } /** * Handles the registered date column output. * * @since 4.3.0 * * @global string $mode List table view mode. * * @param WP_User $user The current WP_User object. */ public function column_registered( $user ) { global $mode; if ( 'list' === $mode ) { $date = __( 'Y/m/d' ); } else { $date = __( 'Y/m/d g:i:s a' ); } echo mysql2date( $date, $user->user_registered ); } /** * @since 4.3.0 * * @param WP_User $user * @param string $classes * @param string $data * @param string $primary */ protected function _column_blogs( $user, $classes, $data, $primary ) { echo '
'; echo $this->column_blogs( $user ); echo $this->handle_row_actions( $user, 'blogs', $primary ); echo '
'; } /** * Handles the sites column output. * * @since 4.3.0 * * @param WP_User $user The current WP_User object. */ public function column_blogs( $user ) { $blogs = get_blogs_of_user( $user->ID, true ); if ( ! is_array( $blogs ) ) { return; } foreach ( $blogs as $site ) { if ( ! can_edit_network( $site->site_id ) ) { continue; } $path = ( '/' === $site->path ) ? '' : $site->path; $site_classes = array( 'site-' . $site->site_id ); /** * Filters the span class for a site listing on the multisite user list table. * * @since 5.2.0 * * @param string[] $site_classes Array of class names used within the span tag. * Default "site-#" with the site's network ID. * @param int $site_id Site ID. * @param int $network_id Network ID. * @param WP_User $user WP_User object. */ $site_classes = apply_filters( 'ms_user_list_site_class', $site_classes, $site->userblog_id, $site->site_id, $user ); if ( is_array( $site_classes ) && ! empty( $site_classes ) ) { $site_classes = array_map( 'sanitize_html_class', array_unique( $site_classes ) ); echo '
'; } else { echo '
'; } echo '
' . str_replace( '.' . get_network()->domain, '', $site->domain . $path ) . '
'; echo '
'; $actions = array(); $actions['edit'] = '
' . __( 'Edit' ) . '
'; $class = ''; if ( 1 === (int) $site->spam ) { $class .= 'site-spammed '; } if ( 1 === (int) $site->mature ) { $class .= 'site-mature '; } if ( 1 === (int) $site->deleted ) { $class .= 'site-deleted '; } if ( 1 === (int) $site->archived ) { $class .= 'site-archived '; } $actions['view'] = '
' . __( 'View' ) . '
'; /** * Filters the action links displayed next the sites a user belongs to * in the Network Admin Users list table. * * @since 3.1.0 * * @param string[] $actions An array of action links to be displayed. Default 'Edit', 'View'. * @param int $userblog_id The site ID. */ $actions = apply_filters( 'ms_user_list_site_actions', $actions, $site->userblog_id ); $action_count = count( $actions ); $i = 0; foreach ( $actions as $action => $link ) { ++$i; $separator = ( $i < $action_count ) ? ' | ' : ''; echo "
{$link}{$separator}
"; } echo '
'; } } /** * Handles the default column output. * * @since 4.3.0 * @since 5.9.0 Renamed `$user` to `$item` to match parent class for PHP 8 named parameter support. * * @param WP_User $item The current WP_User object. * @param string $column_name The current column name. */ public function column_default( $item, $column_name ) { // Restores the more descriptive, specific name for use within this method. $user = $item; /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */ echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID ); } public function display_rows() { foreach ( $this->items as $user ) { $class = ''; $status_list = array( 'spam' => 'site-spammed', 'deleted' => 'site-deleted', ); foreach ( $status_list as $status => $col ) { if ( $user->$status ) { $class .= " $col"; } } ?>
single_row_columns( $user ); ?>
ID ) ) { $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); $actions['edit'] = '
' . __( 'Edit' ) . '
'; } if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins, true ) ) { $actions['delete'] = '
' . __( 'Delete' ) . '
'; } /** * Filters the action links displayed under each user in the Network Admin Users list table. * * @since 3.2.0 * * @param string[] $actions An array of action links to be displayed. Default 'Edit', 'Delete'. * @param WP_User $user WP_User object. */ $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); return $this->row_actions( $actions ); } }