Changeset 4485 for trunk/wp-admin/export.php
- Timestamp:
- 11/18/2006 11:13:15 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/export.php
r4480 r4485 16 16 <p><?php _e('This format, which we call WordPress eXtended RSS or WXR, will contain your posts, comments, custom fields, and categories.'); ?></p> 17 17 <form action="" method="get"> 18 <h3><?php _e('Optional options'); ?></h3> 19 20 <table> 21 <tr> 22 <th><?php _e('Restrict Author:'); ?></th> 23 <td> 24 <select name="author"> 25 <option value="all" selected="selected"><?php _e('All'); ?></option> 26 <?php 27 $authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" ); 28 foreach ( $authors as $id ) { 29 $o = get_userdata( $id ); 30 echo "<option value='$o->ID'>$o->display_name</option>"; 31 } 32 ?> 33 </select> 34 </td> 35 </tr> 36 </table> 18 37 <p class="submit"><input type="submit" name="submit" value="<?php _e('Download Export File'); ?> »" /> 19 38 <input type="hidden" name="download" value="true" /> … … 26 45 27 46 function export_wp() { 28 global $wpdb, $posts, $post; 29 $filename = 'wordpress.' . date('Y-m-d') . '.xml'; 47 global $wpdb, $posts, $post; 48 49 $filename = 'wordpress.' . date('Y-m-d') . '.xml'; 50 30 51 header('Content-Description: File Transfer'); 31 52 header('Content-Type: application/octet-stream'); 32 53 header("Content-Disposition: attachment; filename=$filename"); 33 54 header('Content-type: text/wxr+xml; charset=' . get_option('blog_charset'), true); 34 //$posts = query_posts(''); 35 $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts ORDER BY post_date_gmt ASC"); 55 56 $where = ''; 57 if ( isset( $_GET['author'] ) && $_GET['author'] != 'all' ) { 58 $author_id = (int) $_GET['author']; 59 $where = " WHERE post_author = '$author_id' "; 60 } 61 62 $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC"); 36 63 ?> 37 64 <!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. --> … … 72 99 <description></description> 73 100 <content:encoded><![CDATA[<?php echo $post->post_content ?>]]></content:encoded> 101 <wp:post_id><?php echo $post->ID; ?></wp:post_id> 74 102 <wp:post_date><?php echo $post->post_date; ?></wp:post_date> 75 103 <wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt> … … 95 123 if ( $comments ) { foreach ( $comments as $c ) { ?> 96 124 <wp:comment> 125 <wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id> 97 126 <wp:comment_author><?php echo $c->comment_author; ?></wp:comment_author> 98 127 <wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
Note: See TracChangeset
for help on using the changeset viewer.