]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/export.php
Wordpress 3.2
[autoinstalls/wordpress.git] / wp-admin / includes / export.php
index 2efd0405afa3a199438a4a601130a2df299bf810..cfdc3dded39952ef6e7e29d10ec15a87f5376013 100644 (file)
@@ -49,7 +49,7 @@ function export_wp( $args = array() ) {
        } else {
                $post_types = get_post_types( array( 'can_export' => true ) );
                $esses = array_fill( 0, count($post_types), '%s' );
-               $where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (". implode(',',$esses) .")", $post_types );
+               $where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types );
        }
 
        if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) )
@@ -123,7 +123,7 @@ function export_wp( $args = array() ) {
                        $str = utf8_encode( $str );
 
                // $str = ent2ncr(esc_html($str));
-               $str = "<![CDATA[$str" . ( ( substr( $str, -1 ) == ']' ) ? ' ' : '') . "]]>";
+               $str = "<![CDATA[$str" . ( ( substr( $str, -1 ) == ']' ) ? ' ' : '' ) . ']]>';
 
                return $str;
        }
@@ -350,7 +350,7 @@ function export_wp( $args = array() ) {
 
        // fetch 20 posts at a time rather than loading the entire table into memory
        while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
-       $where = "WHERE ID IN (" . join( ',', $next_posts ) . ")";
+       $where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')';
        $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
 
        // Begin Loop
@@ -384,14 +384,14 @@ function export_wp( $args = array() ) {
 <?php  endif; ?>
 <?php  wxr_post_taxonomy(); ?>
 <?php  $postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );
-               if ( $postmeta ) : foreach( $postmeta as $meta ) : if ( $meta->meta_key != '_edit_lock' ) : ?>
+               foreach( $postmeta as $meta ) : if ( $meta->meta_key != '_edit_lock' ) : ?>
                <wp:postmeta>
                        <wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
                        <wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
                </wp:postmeta>
-<?php  endif; endforeach; endif; ?>
+<?php  endif; endforeach; ?>
 <?php  $comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) );
-               if ( $comments ) : foreach ( $comments as $c ) : ?>
+               foreach ( $comments as $c ) : ?>
                <wp:comment>
                        <wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
                        <wp:comment_author><?php echo wxr_cdata( $c->comment_author ); ?></wp:comment_author>
@@ -405,8 +405,15 @@ function export_wp( $args = array() ) {
                        <wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
                        <wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
                        <wp:comment_user_id><?php echo $c->user_id; ?></wp:comment_user_id>
+<?php          $c_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) );
+                       foreach ( $c_meta as $meta ) : ?>
+                       <wp:commentmeta>
+                               <wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
+                               <wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
+                       </wp:commentmeta>
+<?php          endforeach; ?>
                </wp:comment>
-<?php  endforeach; endif; ?>
+<?php  endforeach; ?>
        </item>
 <?php
        }