Export: allow Media to exported separately from other types.

Props PhilipLakin.
Fixes #32230.

Built from https://develop.svn.wordpress.org/trunk@34326


git-svn-id: http://core.svn.wordpress.org/trunk@34290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-19 16:47:25 +00:00
parent 28964445d4
commit 0fd01b9057
3 changed files with 26 additions and 4 deletions

View File

@ -31,6 +31,7 @@ function export_add_js() {
form.find('input:radio').change(function() {
filters.slideUp('fast');
switch ( $(this).val() ) {
case 'attachment': $('#attachment-filters').slideDown(); break;
case 'posts': $('#post-filters').slideDown(); break;
case 'pages': $('#page-filters').slideDown(); break;
}
@ -89,7 +90,15 @@ if ( isset( $_GET['download'] ) ) {
if ( $_GET['page_status'] )
$args['status'] = $_GET['page_status'];
} else {
} elseif ( 'attachment' == $_GET['content'] ) {
$args['content'] = 'attachment';
if ( $_GET['attachment_start_date'] || $_GET['attachment_end_date'] ) {
$args['start_date'] = $_GET['attachment_start_date'];
$args['end_date'] = $_GET['attachment_end_date'];
}
}
else {
$args['content'] = $_GET['content'];
}
@ -225,7 +234,20 @@ function export_date_options( $post_type = 'post' ) {
<?php foreach ( get_post_types( array( '_builtin' => false, 'can_export' => true ), 'objects' ) as $post_type ) : ?>
<p><label><input type="radio" name="content" value="<?php echo esc_attr( $post_type->name ); ?>" /> <?php echo esc_html( $post_type->label ); ?></label></p>
<?php endforeach; ?>
<p><label><input type="radio" name="content" value="attachment" /> <?php _e( 'Media' ); ?></label></p>
<ul id="attachment-filters" class="export-filters">
<li>
<label><?php _e( 'Date range:' ); ?></label>
<select name="attachment_start_date">
<option value="0"><?php _e( 'Start Date' ); ?></option>
<?php export_date_options( 'attachment' ); ?>
</select>
<select name="attachment_end_date">
<option value="0"><?php _e( 'End Date' ); ?></option>
<?php export_date_options( 'attachment' ); ?>
</select>
</li>
</ul>
<?php
/**
* Fires after the export filters form.

View File

@ -75,7 +75,7 @@ function export_wp( $args = array() ) {
}
}
if ( 'post' == $args['content'] || 'page' == $args['content'] ) {
if ( 'post' == $args['content'] || 'page' == $args['content'] || 'attachment' == $args['content'] ) {
if ( $args['author'] )
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34325';
$wp_version = '4.4-alpha-34326';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.