diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index 6f5f7f80d6..1e25dde70c 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/wp-admin/includes/class-wp-comments-list-table.php @@ -80,11 +80,16 @@ class WP_Comments_List_Table extends WP_List_Table { /** * @global int $post_id * @global string $comment_status - * @global string $search * @global string $comment_type + * @global string $search */ public function prepare_items() { - global $post_id, $comment_status, $search, $comment_type; + global $post_id, $comment_status, $comment_type, $search; + + if ( ! empty( $_REQUEST['mode'] ) ) { + $mode = 'extended' === $_REQUEST['mode'] ? 'extended' : 'list'; + set_user_setting( 'posts_list_mode', $mode ); + } $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; if ( ! in_array( $comment_status, array( 'all', 'mine', 'moderated', 'approved', 'spam', 'trash' ), true ) ) { @@ -124,13 +129,6 @@ class WP_Comments_List_Table extends WP_List_Table { $start += $_REQUEST['offset']; } - if ( ! empty( $_REQUEST['mode'] ) ) { - $mode = 'extended' === $_REQUEST['mode'] ? 'extended' : 'list'; - set_user_setting( 'posts_list_mode', $mode ); - } else { - $mode = get_user_setting( 'posts_list_mode', 'list' ); - } - $status_map = array( 'mine' => '', 'moderated' => 'hold', @@ -759,21 +757,34 @@ class WP_Comments_List_Table extends WP_List_Table { $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); $always_visible = false; - $mode = get_user_setting( 'posts_list_mode', 'list' ); + + $mode = get_user_setting( 'posts_list_mode', 'list' ); + if ( 'extended' === $mode ) { $always_visible = true; } - $i = 0; $out .= '
'; + + $i = 0; + foreach ( $actions as $action => $link ) { ++$i; - ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; - // Reply and quickedit need a hide-if-no-js span when not added with ajax. + if ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) + || 1 === $i + ) { + $sep = ''; + } else { + $sep = ' | '; + } + + // Reply and quickedit need a hide-if-no-js span when not added with Ajax. if ( ( 'reply' === $action || 'quickedit' === $action ) && ! wp_doing_ajax() ) { $action .= ' hide-if-no-js'; - } elseif ( ( 'untrash' === $action && 'trash' === $the_comment_status ) || ( 'unspam' === $action && 'spam' === $the_comment_status ) ) { + } elseif ( ( 'untrash' === $action && 'trash' === $the_comment_status ) + || ( 'unspam' === $action && 'spam' === $the_comment_status ) + ) { if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) { $action .= ' approve'; } else { @@ -783,6 +794,7 @@ class WP_Comments_List_Table extends WP_List_Table { $out .= "$sep$link"; } + $out .= '
'; $out .= ''; diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php index 38540c4121..978200c6a3 100644 --- a/wp-admin/includes/class-wp-list-table.php +++ b/wp-admin/includes/class-wp-list-table.php @@ -166,8 +166,8 @@ class WP_List_Table { if ( empty( $this->modes ) ) { $this->modes = array( - 'list' => __( 'Compact View' ), - 'extended' => __( 'Extended View' ), + 'list' => __( 'Compact view' ), + 'extended' => __( 'Extended view' ), ); } } @@ -517,23 +517,29 @@ class WP_List_Table { */ protected function row_actions( $actions, $always_visible = false ) { $action_count = count( $actions ); - $i = 0; if ( ! $action_count ) { return ''; } $mode = get_user_setting( 'posts_list_mode', 'list' ); + if ( 'extended' === $mode ) { $always_visible = true; } $out = '
'; + + $i = 0; + foreach ( $actions as $action => $link ) { ++$i; - ( $i == $action_count ) ? $sep = '' : $sep = ' | '; - $out .= "$link$sep"; + + $sep = ( $i < $action_count ) ? ' | ' : ''; + + $out .= "$link$sep"; } + $out .= '
'; $out .= ''; @@ -1252,20 +1258,12 @@ class WP_List_Table { * @return string[] Array of CSS classes for the table tag. */ protected function get_table_classes() { - $mode = get_user_setting( 'posts_list_mode', 'list' ); - $mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-list'; - $mode = get_user_setting( 'posts_list_mode', 'list' ); - /** - * Filters the current view mode. - * - * @since 5.5.0 - * - * @param string $mode The current selected mode. Default value of - * posts_list_mode user setting. - */ + $mode = get_user_setting( 'posts_list_mode', 'list' ); + + /** This filter is documented in wp-admin/includes/class-wp-screen.php */ $mode = apply_filters( 'table_view_mode', $mode ); - $mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-' . $mode; + $mode_class = esc_attr( 'table-view-' . $mode ); return array( 'widefat', 'fixed', 'striped', $mode_class, $this->_args['plural'] ); } diff --git a/wp-admin/includes/class-wp-media-list-table.php b/wp-admin/includes/class-wp-media-list-table.php index 1724b96728..b0fbfaea22 100644 --- a/wp-admin/includes/class-wp-media-list-table.php +++ b/wp-admin/includes/class-wp-media-list-table.php @@ -61,13 +61,15 @@ class WP_Media_List_Table extends WP_List_Table { } /** + * @global string $mode List table view mode. * @global WP_Query $wp_query WordPress Query object. * @global array $post_mime_types * @global array $avail_post_mime_types - * @global string $mode */ public function prepare_items() { - global $wp_query, $post_mime_types, $avail_post_mime_types, $mode; + global $mode, $wp_query, $post_mime_types, $avail_post_mime_types; + + $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; // Exclude attachments scheduled for deletion in the next two hours // if they are for zip packages for interrupted or failed updates. @@ -96,8 +98,6 @@ class WP_Media_List_Table extends WP_List_Table { $this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' === $_REQUEST['attachment-filter']; - $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; - $this->set_pagination_args( array( 'total_items' => $wp_query->found_posts, diff --git a/wp-admin/includes/class-wp-ms-sites-list-table.php b/wp-admin/includes/class-wp-ms-sites-list-table.php index 995a733823..acd22daa82 100644 --- a/wp-admin/includes/class-wp-ms-sites-list-table.php +++ b/wp-admin/includes/class-wp-ms-sites-list-table.php @@ -62,12 +62,12 @@ class WP_MS_Sites_List_Table extends WP_List_Table { * * @since 3.1.0 * + * @global string $mode List table view mode. * @global string $s - * @global string $mode * @global wpdb $wpdb WordPress database abstraction object. */ public function prepare_items() { - global $s, $mode, $wpdb; + global $mode, $s, $wpdb; if ( ! empty( $_REQUEST['mode'] ) ) { $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; @@ -576,7 +576,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table { } /** - * @global string $mode + * @global string $mode List table view mode. */ public function display_rows() { foreach ( $this->items as $blog ) { diff --git a/wp-admin/includes/class-wp-ms-users-list-table.php b/wp-admin/includes/class-wp-ms-users-list-table.php index 57968ae935..461411e910 100644 --- a/wp-admin/includes/class-wp-ms-users-list-table.php +++ b/wp-admin/includes/class-wp-ms-users-list-table.php @@ -24,12 +24,19 @@ class WP_MS_Users_List_Table extends WP_List_Table { } /** + * @global string $mode List table view mode. * @global string $usersearch * @global string $role - * @global string $mode */ public function prepare_items() { - global $usersearch, $role, $mode; + global $mode, $usersearch, $role; + + if ( ! empty( $_REQUEST['mode'] ) ) { + $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; + set_user_setting( 'network_users_list_mode', $mode ); + } else { + $mode = get_user_setting( 'network_users_list_mode', 'list' ); + } $usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : ''; @@ -83,13 +90,6 @@ class WP_MS_Users_List_Table extends WP_List_Table { $args['order'] = $_REQUEST['order']; } - if ( ! empty( $_REQUEST['mode'] ) ) { - $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; - set_user_setting( 'network_users_list_mode', $mode ); - } else { - $mode = get_user_setting( 'network_users_list_mode', 'list' ); - } - /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */ $args = apply_filters( 'users_list_table_query_args', $args ); @@ -422,13 +422,18 @@ class WP_MS_Users_List_Table extends WP_List_Table { */ $actions = apply_filters( 'ms_user_list_site_actions', $actions, $val->userblog_id ); - $i = 0; $action_count = count( $actions ); + + $i = 0; + foreach ( $actions as $action => $link ) { ++$i; - $sep = ( $i == $action_count ) ? '' : ' | '; + + $sep = ( $i < $action_count ) ? ' | ' : ''; + echo "$link$sep"; } + echo '
'; } } diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index b4fcfe5bdb..03112a0917 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -135,13 +135,20 @@ class WP_Posts_List_Table extends WP_List_Table { } /** + * @global string $mode List table view mode. * @global array $avail_post_stati * @global WP_Query $wp_query WordPress Query object. * @global int $per_page - * @global string $mode */ public function prepare_items() { - global $avail_post_stati, $wp_query, $per_page, $mode; + global $mode, $avail_post_stati, $wp_query, $per_page; + + if ( ! empty( $_REQUEST['mode'] ) ) { + $mode = 'extended' === $_REQUEST['mode'] ? 'extended' : 'list'; + set_user_setting( 'posts_list_mode', $mode ); + } else { + $mode = get_user_setting( 'posts_list_mode', 'list' ); + } // Is going to call wp(). $avail_post_stati = wp_edit_posts_query(); @@ -177,13 +184,6 @@ class WP_Posts_List_Table extends WP_List_Table { } } - if ( ! empty( $_REQUEST['mode'] ) ) { - $mode = 'extended' === $_REQUEST['mode'] ? 'extended' : 'list'; - set_user_setting( 'posts_list_mode', $mode ); - } else { - $mode = get_user_setting( 'posts_list_mode', 'list' ); - } - $this->is_trash = isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status']; $this->set_pagination_args( @@ -595,23 +595,17 @@ class WP_Posts_List_Table extends WP_List_Table { } /** + * @global string $mode List table view mode. + * * @return array */ protected function get_table_classes() { - $mode = get_user_setting( 'posts_list_mode', 'list' ); - $mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-list'; - $mode = get_user_setting( 'posts_list_mode', 'list' ); - /** - * Filters the current view mode. - * - * @since 5.5.0 - * - * @param string $mode The current selected mode. Default value of - * posts_list_mode user setting. - */ + global $mode; + + /** This filter is documented in wp-admin/includes/class-wp-screen.php */ $mode = apply_filters( 'table_view_mode', $mode ); - $mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-' . $mode; + $mode_class = esc_attr( 'table-view-' . $mode ); return array( 'widefat', 'fixed', 'striped', $mode_class, is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' ); } diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 27bdeb0cae..913b955eab 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -756,10 +756,13 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); $i = 0; + foreach ( $actions as $action => $link ) { ++$i; - if ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) { + if ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) + || 1 === $i + ) { $sep = ''; } else { $sep = ' | '; diff --git a/wp-includes/version.php b/wp-includes/version.php index c0011e3c86..23d75429c5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-beta1-48423'; +$wp_version = '5.5-beta1-48424'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.