Changeset 17270 for trunk/wp-admin/includes/class-wp-list-table.php
- Timestamp:
- 01/12/2011 05:06:33 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-list-table.php
r17268 r17270 615 615 return count( $columns ) - count( $hidden ); 616 616 } 617 618 /** 619 * Print column headers, accounting for hidden and sortable columns. 620 * 621 * @since 3.1.0 622 * @access protected 623 * 624 * @param bool $with_id Whether to set the id attribute or not 625 */ 626 function print_column_headers( $with_id = true ) { 627 $screen = get_current_screen(); 628 629 list( $columns, $hidden, $sortable ) = $this->get_column_info(); 630 631 $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 632 633 if ( isset( $_GET['orderby'] ) ) 634 $current_orderby = $_GET['orderby']; 635 else 636 $current_orderby = ''; 637 638 if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] ) 617 618 function get_order_info() { 619 $current_orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : ''; 620 621 if ( ! $current_orderby ) 622 $current_order = ''; 623 elseif ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] ) 639 624 $current_order = 'desc'; 640 625 else 641 626 $current_order = 'asc'; 627 628 return array( $current_orderby, $current_order ); 629 } 630 631 function add_query_args( $location ) { 632 $pagenum = $this->get_pagenum(); 633 list( $current_orderby, $current_order ) = $this->get_order_info(); 634 $location = add_query_arg( 'paged', $pagenum, $location ); 635 if ( $current_orderby ) 636 $location = add_query_arg( array( 'orderby' => $current_orderby, 'order' => $current_order ), $location ); 637 638 return $location; 639 } 640 641 /** 642 * Print column headers, accounting for hidden and sortable columns. 643 * 644 * @since 3.1.0 645 * @access protected 646 * 647 * @param bool $with_id Whether to set the id attribute or not 648 */ 649 function print_column_headers( $with_id = true ) { 650 $screen = get_current_screen(); 651 652 list( $columns, $hidden, $sortable ) = $this->get_column_info(); 653 654 $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 655 656 list( $current_orderby, $current_order ) = $this->get_order_info(); 642 657 643 658 foreach ( $columns as $column_key => $column_display_name ) { … … 734 749 */ 735 750 function display_tablenav( $which ) { 736 if ( 'top' == $which ) 751 if ( 'top' == $which ) { 737 752 wp_nonce_field( 'bulk-' . $this->_args['plural'] ); 753 list( $current_orderby, $current_order ) = $this->get_order_info(); 754 echo '<input type="hidden" name="orderby" value="' . esc_attr( $current_orderby ) . '" /><input type="hidden" name="order" value="' . esc_attr( $current_order ) . '" />'; 755 } 738 756 ?> 739 757 <div class="tablenav <?php echo esc_attr( $which ); ?>">
Note: See TracChangeset
for help on using the changeset viewer.