Ticket #3632: 3632.diff
| File 3632.diff, 2.7 KB (added by solarissmoke, 2 years ago) |
|---|
-
wp-admin/includes/export.php
26 26 global $wpdb, $post; 27 27 28 28 $defaults = array( 'content' => 'all', 'author' => false, 'category' => false, 29 'start_date' => false, 'end_date' => false, 'status' => false, 29 'start_date' => false, 'end_date' => false, 'status' => false, 'gzip' => false 30 30 ); 31 31 $args = wp_parse_args( $args, $defaults ); 32 32 33 33 do_action( 'export_wp' ); 34 34 35 35 $sitename = sanitize_key( get_bloginfo( 'name' ) ); 36 if ( ! empty($sitename) ) $sitename .= '.'; 36 if ( ! empty($sitename) ) 37 $sitename .= '.'; 37 38 $filename = $sitename . 'wordpress.' . date( 'Y-m-d' ) . '.xml'; 39 if( $args['gzip'] ) 40 $filename .= '.gz'; 38 41 39 42 header( 'Content-Description: File Transfer' ); 40 43 header( 'Content-Disposition: attachment; filename=' . $filename ); 41 header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); 44 $content_type = $args['gzip'] ? 'application/x-gzip' : 'text/xml'; 45 header( "Content-Type: $content_type; charset=" . get_option( 'blog_charset' ), true ); 42 46 43 47 if ( 'all' != $args['content'] && post_type_exists( $args['content'] ) ) { 44 48 $ptype = get_post_type_object( $args['content'] ); … … 287 291 echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "</category>\n"; 288 292 } 289 293 } 294 295 function export_gzip_handler( $buffer ) { 296 return gzencode( $buffer ); 297 } 298 299 if( $args['gzip'] ) 300 ob_start( 'export_gzip_handler' ); 290 301 291 302 echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . "\" ?>\n"; 292 303 … … 413 424 </channel> 414 425 </rss> 415 426 <?php 416 } 427 } 428 No newline at end of file -
wp-admin/export.php
83 83 } else { 84 84 $args['content'] = $_GET['content']; 85 85 } 86 87 if( isset( $_GET['gzip'] ) ) 88 $args['gzip'] = true; 86 89 87 90 export_wp( $args ); 88 91 die(); … … 199 202 <p><label><input type="radio" name="content" value="<?php echo esc_attr( $post_type->name ); ?>" /> <?php echo esc_html( $post_type->label ); ?></label></p> 200 203 <?php endforeach; ?> 201 204 205 <h3><?php _e( 'Compression' ); ?></h3> 206 <p><label><input type="checkbox" name="gzip" value="gzip" /> <?php _e( 'Compress the XML file using gzip compression (this will create a smaller file for download)' ); ?></label></p> 207 202 208 <?php submit_button( __('Download Export File'), 'secondary' ); ?> 203 209 </form> 204 210 </div> 205 211 206 <?php include('admin-footer.php'); ?> 212 <?php include('admin-footer.php'); ?> 213 No newline at end of file
