wp/wp-admin/export.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
    22  * @since 3.5.0
    22  * @since 3.5.0
    23  */
    23  */
    24 function export_add_js() {
    24 function export_add_js() {
    25 ?>
    25 ?>
    26 <script type="text/javascript">
    26 <script type="text/javascript">
    27 //<![CDATA[
       
    28 	jQuery(document).ready(function($){
    27 	jQuery(document).ready(function($){
    29  		var form = $('#export-filters'),
    28  		var form = $('#export-filters'),
    30  			filters = form.find('.export-filters');
    29  			filters = form.find('.export-filters');
    31  		filters.hide();
    30  		filters.hide();
    32  		form.find('input:radio').change(function() {
    31  		form.find('input:radio').change(function() {
    35 				case 'posts': $('#post-filters').slideDown(); break;
    34 				case 'posts': $('#post-filters').slideDown(); break;
    36 				case 'pages': $('#page-filters').slideDown(); break;
    35 				case 'pages': $('#page-filters').slideDown(); break;
    37 			}
    36 			}
    38  		});
    37  		});
    39 	});
    38 	});
    40 //]]>
       
    41 </script>
    39 </script>
    42 <?php
    40 <?php
    43 }
    41 }
    44 add_action( 'admin_head', 'export_add_js' );
    42 add_action( 'admin_head', 'export_add_js' );
    45 
    43 
    50 		'<p>' . __('Once generated, your WXR file can be imported by another WordPress site or by another blogging platform able to access this format.') . '</p>',
    48 		'<p>' . __('Once generated, your WXR file can be imported by another WordPress site or by another blogging platform able to access this format.') . '</p>',
    51 ) );
    49 ) );
    52 
    50 
    53 get_current_screen()->set_help_sidebar(
    51 get_current_screen()->set_help_sidebar(
    54 	'<p><strong>' . __('For more information:') . '</strong></p>' .
    52 	'<p><strong>' . __('For more information:') . '</strong></p>' .
    55 	'<p>' . __('<a href="http://codex.wordpress.org/Tools_Export_Screen" target="_blank">Documentation on Export</a>') . '</p>' .
    53 	'<p>' . __('<a href="https://codex.wordpress.org/Tools_Export_Screen" target="_blank">Documentation on Export</a>') . '</p>' .
    56 	'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    54 	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    57 );
    55 );
    58 
    56 
       
    57 // If the 'download' URL parameter is set, a WXR export file is baked and returned.
    59 if ( isset( $_GET['download'] ) ) {
    58 if ( isset( $_GET['download'] ) ) {
    60 	$args = array();
    59 	$args = array();
    61 
    60 
    62 	if ( ! isset( $_GET['content'] ) || 'all' == $_GET['content'] ) {
    61 	if ( ! isset( $_GET['content'] ) || 'all' == $_GET['content'] ) {
    63 		$args['content'] = 'all';
    62 		$args['content'] = 'all';
    64 	} else if ( 'posts' == $_GET['content'] ) {
    63 	} elseif ( 'posts' == $_GET['content'] ) {
    65 		$args['content'] = 'post';
    64 		$args['content'] = 'post';
    66 
    65 
    67 		if ( $_GET['cat'] )
    66 		if ( $_GET['cat'] )
    68 			$args['category'] = (int) $_GET['cat'];
    67 			$args['category'] = (int) $_GET['cat'];
    69 
    68 
    75 			$args['end_date'] = $_GET['post_end_date'];
    74 			$args['end_date'] = $_GET['post_end_date'];
    76 		}
    75 		}
    77 
    76 
    78 		if ( $_GET['post_status'] )
    77 		if ( $_GET['post_status'] )
    79 			$args['status'] = $_GET['post_status'];
    78 			$args['status'] = $_GET['post_status'];
    80 	} else if ( 'pages' == $_GET['content'] ) {
    79 	} elseif ( 'pages' == $_GET['content'] ) {
    81 		$args['content'] = 'page';
    80 		$args['content'] = 'page';
    82 
    81 
    83 		if ( $_GET['page_author'] )
    82 		if ( $_GET['page_author'] )
    84 			$args['author'] = (int) $_GET['page_author'];
    83 			$args['author'] = (int) $_GET['page_author'];
    85 
    84 
   110 require_once( ABSPATH . 'wp-admin/admin-header.php' );
   109 require_once( ABSPATH . 'wp-admin/admin-header.php' );
   111 
   110 
   112 /**
   111 /**
   113  * Create the date options fields for exporting a given post type.
   112  * Create the date options fields for exporting a given post type.
   114  *
   113  *
   115  * @global wpdb      $wpdb      WordPress database object.
   114  * @global wpdb      $wpdb      WordPress database abstraction object.
   116  * @global WP_Locale $wp_locale Date and Time Locale object.
   115  * @global WP_Locale $wp_locale Date and Time Locale object.
   117  *
   116  *
   118  * @since 3.1.0
   117  * @since 3.1.0
   119  *
   118  *
   120  * @param string $post_type The post type. Default 'post'.
   119  * @param string $post_type The post type. Default 'post'.
   142 	}
   141 	}
   143 }
   142 }
   144 ?>
   143 ?>
   145 
   144 
   146 <div class="wrap">
   145 <div class="wrap">
   147 <?php screen_icon(); ?>
       
   148 <h2><?php echo esc_html( $title ); ?></h2>
   146 <h2><?php echo esc_html( $title ); ?></h2>
   149 
   147 
   150 <p><?php _e('When you click the button below WordPress will create an XML file for you to save to your computer.'); ?></p>
   148 <p><?php _e('When you click the button below WordPress will create an XML file for you to save to your computer.'); ?></p>
   151 <p><?php _e('This format, which we call WordPress eXtended RSS or WXR, will contain your posts, pages, comments, custom fields, categories, and tags.'); ?></p>
   149 <p><?php _e('This format, which we call WordPress eXtended RSS or WXR, will contain your posts, pages, comments, custom fields, categories, and tags.'); ?></p>
   152 <p><?php _e('Once you&#8217;ve saved the download file, you can use the Import function in another WordPress installation to import the content from this site.'); ?></p>
   150 <p><?php _e('Once you&#8217;ve saved the download file, you can use the Import function in another WordPress installation to import the content from this site.'); ?></p>
   153 
   151 
   154 <h3><?php _e( 'Choose what to export' ); ?></h3>
   152 <h3><?php _e( 'Choose what to export' ); ?></h3>
   155 <form action="" method="get" id="export-filters">
   153 <form method="get" id="export-filters">
   156 <input type="hidden" name="download" value="true" />
   154 <input type="hidden" name="download" value="true" />
   157 <p><label><input type="radio" name="content" value="all" checked="checked" /> <?php _e( 'All content' ); ?></label></p>
   155 <p><label><input type="radio" name="content" value="all" checked="checked" /> <?php _e( 'All content' ); ?></label></p>
   158 <p class="description"><?php _e( 'This will contain all of your posts, pages, comments, custom fields, terms, navigation menus and custom posts.' ); ?></p>
   156 <p class="description"><?php _e( 'This will contain all of your posts, pages, comments, custom fields, terms, navigation menus and custom posts.' ); ?></p>
   159 
   157 
   160 <p><label><input type="radio" name="content" value="posts" /> <?php _e( 'Posts' ); ?></label></p>
   158 <p><label><input type="radio" name="content" value="posts" /> <?php _e( 'Posts' ); ?></label></p>