Ticket #19307: 19307.diff
File 19307.diff, 3.7 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/export.php
65 65 } 66 66 } 67 67 68 if ( 'post' == $args['content'] || 'page' == $args['content'] ) { 69 if ( $args['author'] ) 70 $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] ); 68 if ( $args['author'] ) 69 $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] ); 71 70 72 73 71 if ( $args['start_date'] ) 72 $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime($args['start_date']) ) ); 74 73 75 if ( $args['end_date'] ) 76 $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date'])) ) ); 77 } 74 if ( $args['end_date'] ) 75 $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date'])) ) ); 78 76 79 77 // grab a snapshot of post IDs, just in case it changes during the export 80 78 $post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" ); -
wp-admin/export.php
23 23 jQuery(document).ready(function($){ 24 24 var form = $('#export-filters'), 25 25 filters = form.find('.export-filters'); 26 filters. hide();26 filters.not('#all-filters').hide(); 27 27 form.find('input:radio').change(function() { 28 28 filters.slideUp('fast'); 29 29 switch ( $(this).val() ) { 30 case 'all' : $('#all-filters').slideDown(); break; 30 31 case 'posts': $('#post-filters').slideDown(); break; 31 32 case 'pages': $('#page-filters').slideDown(); break; 32 33 } … … 56 57 57 58 if ( ! isset( $_GET['content'] ) || 'all' == $_GET['content'] ) { 58 59 $args['content'] = 'all'; 60 61 if ( $_GET['all_start_date'] || $_GET['all_end_date'] ) { 62 $args['start_date'] = $_GET['all_start_date']; 63 $args['end_date'] = $_GET['all_end_date']; 64 } 59 65 } else if ( 'posts' == $_GET['content'] ) { 60 66 $args['content'] = 'post'; 61 67 … … 98 104 function export_date_options( $post_type = 'post' ) { 99 105 global $wpdb, $wp_locale; 100 106 107 $post_type_clause = ''; 108 if ( 'all' != $post_type ) 109 $post_type_clause = $wpdb->prepare( 'post_type = %s AND', $post_type ); 110 101 111 $months = $wpdb->get_results( $wpdb->prepare( " 102 112 SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month 103 113 FROM $wpdb->posts 104 WHERE post_type = %s ANDpost_status != 'auto-draft'114 WHERE $post_type_clause post_status != 'auto-draft' 105 115 ORDER BY post_date DESC 106 116 ", $post_type ) ); 107 117 … … 132 142 <input type="hidden" name="download" value="true" /> 133 143 <p><label><input type="radio" name="content" value="all" checked="checked" /> <?php _e( 'All content' ); ?></label> 134 144 <span class="description"><?php _e( 'This will contain all of your posts, pages, comments, custom fields, terms, navigation menus and custom posts.' ); ?></span></p> 145 <ul id="all-filters" class="export-filters"> 146 <li> 147 <label><?php _e( 'Date range:' ); ?></label> 148 <select name="all_start_date"> 149 <option value="0"><?php _e( 'Start Date' ); ?></option> 150 <?php export_date_options( 'all' ); ?> 151 </select> 152 <select name="all_end_date"> 153 <option value="0"><?php _e( 'End Date' ); ?></option> 154 <?php export_date_options( 'all' ); ?> 155 </select> 156 </li> 157 </ul> 135 158 136 159 <p><label><input type="radio" name="content" value="posts" /> <?php _e( 'Posts' ); ?></label></p> 137 160 <ul id="post-filters" class="export-filters">