Make WordPress Core

Changeset 14509


Ignore:
Timestamp:
05/07/2010 09:53:11 PM (15 years ago)
Author:
wpmuguru
Message:

make end month in export inclusive, see #10317

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/export.php

    r14506 r14509  
    4343require_once ('admin-header.php');
    4444
    45 $dateoptions = array();
     45$dateoptions = $edateoptions = '';
    4646$types = "'" . implode("', '", get_post_types( array( 'public' => true, 'can_export' => true ), 'names' )) . "'";
    4747$stati = "'" . implode("', '", get_post_stati( array( 'internal' => false ), 'names' )) . "'";
    48 if ( $monthyears = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month` FROM $wpdb->posts WHERE post_type IN ($types) AND post_status IN ($stati) ORDER BY post_date ASC ") ) {
    49     foreach ( $monthyears as $monthyear ) {
    50         $dateoptions[] = "\t<option value=\"" . $monthyear->year . '-' . zeroise( $monthyear->month, 2 ) . '">' . $wp_locale->get_month( $monthyear->month ) . ' ' . $monthyear->year . "</option>\n";
     48if ( $monthyears = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, YEAR(DATE_ADD(post_date, INTERVAL 1 MONTH)) AS `eyear`, MONTH(DATE_ADD(post_date, INTERVAL 1 MONTH)) AS `emonth` FROM $wpdb->posts WHERE post_type IN ($types) AND post_status IN ($stati) ORDER BY post_date ASC ") ) {
     49    foreach ( $monthyears as $k => $monthyear )
     50        $monthyears[$k]->lmonth = $wp_locale->get_month( $monthyear->month, 2 );
     51    for( $s = 0, $e = count( $monthyears ) - 1; $e >= 0; $s++, $e-- ) {
     52        $dateoptions .= "\t<option value=\"" . $monthyears[$s]->year . '-' . zeroise( $monthyears[$s]->month, 2 ) . '">' . $monthyears[$s]->lmonth . ' ' . $monthyears[$s]->year . "</option>\n";
     53        $edateoptions .= "\t<option value=\"" . $monthyears[$e]->eyear . '-' . zeroise( $monthyears[$e]->emonth, 2 ) . '">' . $monthyears[$e]->lmonth . ' ' . $monthyears[$e]->year . "</option>\n";
    5154    }
    5255}
     
    7073<select name="mm_start" id="mm_start">
    7174    <option value="all" selected="selected"><?php _e('All Dates'); ?></option>
    72 <?php echo implode( '', $dateoptions ); ?>
     75<?php echo $dateoptions; ?>
    7376</select> <br/>
    7477<strong><?php _e('End:'); ?></strong>
    7578<select name="mm_end" id="mm_end">
    7679    <option value="all" selected="selected"><?php _e('All Dates'); ?></option>
    77 <?php echo implode( '', array_reverse( $dateoptions ) ); ?>
     80<?php echo $edateoptions; ?>
    7881</select>
    7982</td>
Note: See TracChangeset for help on using the changeset viewer.