Make WordPress Core

Ticket #34577: 34577.patch

File 34577.patch, 2.3 KB (added by ocean90, 10 years ago)
  • src/wp-admin/includes/class-wp-posts-list-table.php

     
    7878         * @param array $args An associative array of arguments.
    7979         */
    8080        public function __construct( $args = array() ) {
    81                 global $post_type_object, $wpdb;
     81                global $post_type_object, $wpdb, $mode;
    8282
    8383                parent::__construct( array(
    8484                        'plural' => 'posts',
     
    8888                $post_type        = $this->screen->post_type;
    8989                $post_type_object = get_post_type_object( $post_type );
    9090
     91                if ( ! empty( $_REQUEST['mode'] ) ) {
     92                        $mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list';
     93                        set_user_setting ( 'posts_list_mode', $mode );
     94                } else {
     95                        $mode = get_user_setting ( 'posts_list_mode', 'list' );
     96                }
     97
    9198                $exclude_states   = get_post_stati( array(
    9299                        'show_in_admin_all_list' => false,
    93100                ) );
     
    157164         * @global array    $avail_post_stati
    158165         * @global WP_Query $wp_query
    159166         * @global int      $per_page
    160          * @global string   $mode
    161167         */
    162168        public function prepare_items() {
    163                 global $avail_post_stati, $wp_query, $per_page, $mode;
     169                global $avail_post_stati, $wp_query, $per_page;
    164170
    165171                // is going to call wp()
    166172                $avail_post_stati = wp_edit_posts_query();
     
    196202
    197203                $total_pages = ceil( $total_items / $per_page );
    198204
    199                 if ( ! empty( $_REQUEST['mode'] ) ) {
    200                         $mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list';
    201                         set_user_setting ( 'posts_list_mode', $mode );
    202                 } else {
    203                         $mode = get_user_setting ( 'posts_list_mode', 'list' );
    204                 }
    205 
    206205                $this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] === 'trash';
    207206
    208207                $this->set_pagination_args( array(
     
    490489                 * list table.
    491490                 *
    492491                 * @since 4.4.0
    493                  * 
     492                 *
    494493                 * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
    495494                 */
    496495                do_action( 'manage_posts_extra_tablenav', $which );
     
    647646        }
    648647
    649648        /**
    650          * @global string $mode
    651649         * @param array $posts
    652650         * @param int $level
    653651         */
    654652        private function _display_rows( $posts, $level = 0 ) {
    655                 global $mode;
    656 
    657653                // Create array of post IDs.
    658654                $post_ids = array();
    659655