Ticket #49715: 49715.4.diff
File 49715.4.diff, 11.4 KB (added by , 5 years ago) |
---|
-
src/wp-admin/includes/class-wp-comments-list-table.php
diff --git a/src/wp-admin/includes/class-wp-comments-list-table.php b/src/wp-admin/includes/class-wp-comments-list-table.php index e3678b60d5..dd02be9c46 100644
a b class WP_Comments_List_Table extends WP_List_Table { 124 124 $start += $_REQUEST['offset']; 125 125 } 126 126 127 if ( ! empty( $_REQUEST['mode'] ) ) { 128 $mode = 'extended' === $_REQUEST['mode'] ? 'extended' : 'list'; 129 set_user_setting( 'posts_list_mode', $mode ); 130 } else { 131 $mode = get_user_setting( 'posts_list_mode', 'list' ); 132 } 133 127 134 $status_map = array( 128 135 'mine' => '', 129 136 'moderated' => 'hold', … … class WP_Comments_List_Table extends WP_List_Table { 751 758 /** This filter is documented in wp-admin/includes/dashboard.php */ 752 759 $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); 753 760 761 $mode = get_user_setting( 'posts_list_mode', 'list' ); 762 $always_visible = false; 763 if ( 'extended' === $mode ) { 764 $always_visible = true; 765 } 766 754 767 $i = 0; 755 $out .= '<div class=" row-actions">';768 $out .= '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; 756 769 foreach ( $actions as $action => $link ) { 757 770 ++$i; 758 771 ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; -
src/wp-admin/includes/class-wp-list-table.php
diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php index 7cf6f0725f..de16e89b32 100644
a b class WP_List_Table { 166 166 167 167 if ( empty( $this->modes ) ) { 168 168 $this->modes = array( 169 'list' => __( 'List View' ),170 'ex cerpt' => __( 'Excerpt View' ),169 'list' => __( 'Compact view' ), 170 'extended' => __( 'Extended view' ), 171 171 ); 172 172 } 173 173 } … … class WP_List_Table { 523 523 return ''; 524 524 } 525 525 526 $mode = get_user_setting( 'posts_list_mode', 'list' ); 527 if ( 'extended' === $mode ) { 528 $always_visible = true; 529 } 530 526 531 $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; 527 532 foreach ( $actions as $action => $link ) { 528 533 ++$i; … … class WP_List_Table { 1247 1252 * @return string[] Array of CSS classes for the table tag. 1248 1253 */ 1249 1254 protected function get_table_classes() { 1250 return array( 'widefat', 'fixed', 'striped', $this->_args['plural'] ); 1255 $mode = get_user_setting( 'posts_list_mode', 'list' ); 1256 /** 1257 * Filters the current view mode. 1258 * 1259 * @since 5.5.0 1260 * 1261 * @param string $mode The current selected mode. Default value of 1262 * posts_list_mode user setting. 1263 */ 1264 $mode = apply_filters( 'table_view_mode', $mode ); 1265 1266 $mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-' . $mode; 1267 1268 return array( 'widefat', 'fixed', 'striped', $mode_class, $this->_args['plural'] ); 1251 1269 } 1252 1270 1253 1271 /** -
src/wp-admin/includes/class-wp-posts-list-table.php
diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php index 065e5d0382..889a22ae0d 100644
a b class WP_Posts_List_Table extends WP_List_Table { 178 178 } 179 179 180 180 if ( ! empty( $_REQUEST['mode'] ) ) { 181 $mode = 'ex cerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list';181 $mode = 'extended' === $_REQUEST['mode'] ? 'extended' : 'list'; 182 182 set_user_setting( 'posts_list_mode', $mode ); 183 183 } else { 184 184 $mode = get_user_setting( 'posts_list_mode', 'list' ); … … class WP_Posts_List_Table extends WP_List_Table { 598 598 * @return array 599 599 */ 600 600 protected function get_table_classes() { 601 return array( 'widefat', 'fixed', 'striped', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' ); 601 $mode = get_user_setting( 'posts_list_mode', 'list' ); 602 /** 603 * Filters the current view mode. 604 * 605 * @since 5.5.0 606 * 607 * @param string $mode The current selected mode. Default value of 608 * posts_list_mode user setting. 609 */ 610 $mode = apply_filters( 'table_view_mode', $mode ); 611 612 $mode_class = 'extended' === $mode ? 'table-view-extended' : 'table-view-' . $mode; 613 614 return array( 'widefat', 'fixed', 'striped', $mode_class, is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' ); 602 615 } 603 616 604 617 /** … … class WP_Posts_List_Table extends WP_List_Table { 1042 1055 } 1043 1056 echo "</strong>\n"; 1044 1057 1045 if ( ! is_post_type_hierarchical( $this->screen->post_type ) && 'ex cerpt' === $mode && current_user_can( 'read_post', $post->ID ) ) {1058 if ( ! is_post_type_hierarchical( $this->screen->post_type ) && 'extended' === $mode && current_user_can( 'read_post', $post->ID ) ) { 1046 1059 if ( post_password_required( $post ) ) { 1047 1060 echo '<span class="protected-post-excerpt">' . esc_html( get_the_excerpt() ) . '</span>'; 1048 1061 } else { … … class WP_Posts_List_Table extends WP_List_Table { 1102 1115 * @param string $status The status text. 1103 1116 * @param WP_Post $post Post object. 1104 1117 * @param string $column_name The column name. 1105 * @param string $mode The list display mode ('ex cerpt' or 'list').1118 * @param string $mode The list display mode ('extended' or 'list'). 1106 1119 */ 1107 1120 $status = apply_filters( 'post_date_column_status', $status, $post, 'date', $mode ); 1108 1121 … … class WP_Posts_List_Table extends WP_List_Table { 1110 1123 echo $status . '<br />'; 1111 1124 } 1112 1125 1113 /** 1114 * Filters the published time of the post. 1115 * 1116 * @since 2.5.1 1117 * @since 5.5.0 Removed the difference between 'excerpt' and 'list' modes. 1118 * The published time and date are both displayed now, 1119 * which is equivalent to the previous 'excerpt' mode. 1120 * 1121 * @param string $t_time The published time. 1122 * @param WP_Post $post Post object. 1123 * @param string $column_name The column name. 1124 * @param string $mode The list display mode ('excerpt' or 'list'). 1125 */ 1126 echo apply_filters( 'post_date_column_time', $t_time, $post, 'date', $mode ); 1126 if ( 'extended' === $mode || 'excerpt' === $mode ) { 1127 /** 1128 * Filters the published time of the post. 1129 * 1130 * If `$mode` equals 'extended', the published time and date are both displayed. 1131 * If `$mode` equals 'list' (default), the publish date is displayed, with the 1132 * time and date together available as an abbreviation definition. 1133 * 1134 * @since 2.5.1 1135 * 1136 * @param string $t_time The published time. 1137 * @param WP_Post $post Post object. 1138 * @param string $column_name The column name. 1139 * @param string $mode The list display mode ('extended' or 'list'). 1140 */ 1141 echo apply_filters( 'post_date_column_time', $t_time, $post, 'date', $mode ); 1142 } else { 1143 /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */ 1144 echo '<span title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, 'date', $mode ) . '</span>'; 1145 } 1127 1146 } 1128 1147 1129 1148 /** … … class WP_Posts_List_Table extends WP_List_Table { 1451 1470 * 1452 1471 * @since 3.1.0 1453 1472 * 1454 * @global string $mode List table view mode.1473 * @global string $mode Compact table view mode. 1455 1474 */ 1456 1475 public function inline_edit() { 1457 1476 global $mode; … … class WP_Posts_List_Table extends WP_List_Table { 1491 1510 } 1492 1511 } 1493 1512 1494 $m = ( isset( $mode ) && 'ex cerpt' === $mode ) ? 'excerpt' : 'list';1513 $m = ( isset( $mode ) && 'extended' === $mode ) ? 'extended' : 'list'; 1495 1514 $can_publish = current_user_can( $post_type_object->cap->publish_posts ); 1496 1515 $core_columns = array( 1497 1516 'cb' => true, -
src/wp-admin/includes/class-wp-screen.php
diff --git a/src/wp-admin/includes/class-wp-screen.php b/src/wp-admin/includes/class-wp-screen.php index e3a2fcd7a6..c06b19902f 100644
a b final class WP_Screen { 1288 1288 public function render_view_mode() { 1289 1289 $screen = get_current_screen(); 1290 1290 1291 // Currently only enabled for posts lists.1292 if ( 'edit' !== $screen->base ) {1291 // Currently only enabled for posts and comments lists. 1292 if ( 'edit' !== $screen->base && 'edit-comments' !== $screen->base && 'users' !== $screen->base ) { 1293 1293 return; 1294 1294 } 1295 1295 1296 $view_mode_post_types = get_post_types( 1297 array( 1298 'hierarchical' => false, 1299 'show_ui' => true, 1300 ) 1301 ); 1296 $view_mode_post_types = get_post_types( array( 'show_ui' => true ) ); 1302 1297 1303 1298 /** 1304 1299 * Filters the post types that have different view mode options. … … final class WP_Screen { 1306 1301 * @since 4.4.0 1307 1302 * 1308 1303 * @param string[] $view_mode_post_types Array of post types that can change view modes. 1309 * Default non-hierarchicalpost types with show_ui on.1304 * Default post types with show_ui on. 1310 1305 */ 1311 1306 $view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types ); 1312 1307 1313 if ( ! in_array( $this->post_type, $view_mode_post_types, true ) ) {1308 if ( 'edit' === $screen->base && ! in_array( $this->post_type, $view_mode_post_types, true ) ) { 1314 1309 return; 1315 1310 } 1316 1311 1317 global $mode; 1312 $mode = get_user_setting( 'posts_list_mode', 'list' ); 1313 1314 // Set 'list' as default value if $mode is not set. 1315 $mode = ( isset( $mode ) && 'extended' === $mode ) ? 'extended' : 'list'; 1316 1317 /** 1318 * Filters the current view mode. 1319 * 1320 * @since 5.5.0 1321 * 1322 * @param string $mode The current selected mode. Default value of 1323 * posts_list_mode user setting. 1324 */ 1325 $mode = apply_filters( 'table_view_mode', $mode ); 1318 1326 1319 1327 // This needs a submit button. 1320 1328 add_filter( 'screen_options_show_submit', '__return_true' ); … … final class WP_Screen { 1323 1331 <legend><?php _e( 'View Mode' ); ?></legend> 1324 1332 <label for="list-view-mode"> 1325 1333 <input id="list-view-mode" type="radio" name="mode" value="list" <?php checked( 'list', $mode ); ?> /> 1326 <?php _e( ' List View' ); ?>1334 <?php _e( 'Compact view' ); ?> 1327 1335 </label> 1328 1336 <label for="excerpt-view-mode"> 1329 <input id="excerpt-view-mode" type="radio" name="mode" value="ex cerpt" <?php checked( 'excerpt', $mode ); ?> />1330 <?php _e( 'Ex cerptView' ); ?>1337 <input id="excerpt-view-mode" type="radio" name="mode" value="extended" <?php checked( 'extended', $mode ); ?> /> 1338 <?php _e( 'Extended View' ); ?> 1331 1339 </label> 1340 <?php 1341 /** 1342 * Fires at the end of the table view modes screen option. 1343 * 1344 * @since 5.5.0 1345 * 1346 * @param string $mode The currently selected mode. 1347 */ 1348 do_action( 'wp_table_view_modes', $mode ); 1349 ?> 1332 1350 </fieldset> 1333 1351 <?php 1334 1352 } -
src/wp-admin/includes/class-wp-users-list-table.php
diff --git a/src/wp-admin/includes/class-wp-users-list-table.php b/src/wp-admin/includes/class-wp-users-list-table.php index 018654bdd2..731e9304e5 100644
a b class WP_Users_List_Table extends WP_List_Table { 127 127 $args['order'] = $_REQUEST['order']; 128 128 } 129 129 130 if ( ! empty( $_REQUEST['mode'] ) ) { 131 $mode = 'extended' === $_REQUEST['mode'] ? 'extended' : 'list'; 132 set_user_setting( 'posts_list_mode', $mode ); 133 } else { 134 $mode = get_user_setting( 'posts_list_mode', 'list' ); 135 } 136 130 137 /** 131 138 * Filters the query arguments used to retrieve users for the current users list table. 132 139 *