<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[15961] trunk: Importer and exporter overhaul, mega props duck.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15961">15961</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-10-25 20:43:52 +0000 (Mon, 25 Oct 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Importer and exporter overhaul, mega props duck.

Exporter overhaul:
 * Add author information to export
 * Greater usage of slug identifiers
 * Don't export auto-drafts, spam comments, or edit lock/last meta keys
 * Inline documentation improvements
 * Remove filtering for now (@todo)
 * Bump WXR version to 1.1, but remain back compat in the importer

Importer overhaul (http://plugins.trac.wordpress.org/changeset/304249):
 * Use an XML parser where available (SimpleXML, XML Parser)
 * Proper import support for navigation menus
 * Many bug fixes, specifically improvements to category and custom taxonomy handling
 * Better author/user mapping

Fixes <a href="http://trac.wordpress.org/ticket/5447">#5447</a> <a href="http://trac.wordpress.org/ticket/5460">#5460</a> <a href="http://trac.wordpress.org/ticket/7400">#7400</a> <a href="http://trac.wordpress.org/ticket/7973">#7973</a> <a href="http://trac.wordpress.org/ticket/8471">#8471</a> <a href="http://trac.wordpress.org/ticket/9237">#9237</a> <a href="http://trac.wordpress.org/ticket/10319">#10319</a> <a href="http://trac.wordpress.org/ticket/11118">#11118</a> <a href="http://trac.wordpress.org/ticket/11144">#11144</a> <a href="http://trac.wordpress.org/ticket/11354">#11354</a> <a href="http://trac.wordpress.org/ticket/11574">#11574</a> <a href="http://trac.wordpress.org/ticket/12685">#12685</a> <a href="http://trac.wordpress.org/ticket/13364">#13364</a> <a href="http://trac.wordpress.org/ticket/13394">#13394</a> <a href="http://trac.wordpress.org/ticket/13453">#13453</a> <a href="http://trac.wordpress.org/ticket/13454">#13454</a> <a href="http://trac.wordpress.org/ticket/13627">#13627</a> <a href="http://trac.wordpress.org/ticket/14306">#14306</a> <a href="http://trac.wordpress.org/ticket/14442">#14442</a> <a href="http://trac.wordpress.org/ticket/14524">#14524</a> <a href="http://trac.wordpress.org/ticket/14750">#14750</a> <a href="http://trac.wordpress.org/ticket/15055">#15055</a> <a href="http://trac.wordpress.org/ticket/15091">#15091</a> <a href="http://trac.wordpress.org/ticket/15108">#15108</a>.

See <a href="http://trac.wordpress.org/ticket/15197">#15197</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminexportphp">trunk/wp-admin/export.php</a></li>
<li><a href="#trunkwpadminincludesexportphp">trunk/wp-admin/includes/export.php</a></li>
<li><a href="#trunkwpincludesgeneraltemplatephp">trunk/wp-includes/general-template.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminexportphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/export.php (15960 => 15961)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/export.php        2010-10-25 14:50:58 UTC (rev 15960)
+++ trunk/wp-admin/export.php        2010-10-25 20:43:52 UTC (rev 15961)
</span><span class="lines">@@ -25,26 +25,7 @@
</span><span class="cx"> );
</span><span class="cx"> 
</span><span class="cx"> if ( isset( $_GET['download'] ) ) {
</span><del>-                $author = isset($_GET['author']) ? $_GET['author'] : 'all';
-                $taxonomy = array();
-                foreach ( get_taxonomies( array( 'show_ui' =&gt; true ) ) as $tax )
-                        $taxonomy[ $tax ] = ! empty( $_GET['export_taxonomy'][ $tax ] ) ? $_GET['export_taxonomy'][ $tax ] : 'all';
-                $post_type = isset($_GET['export_post_type']) ? stripslashes_deep($_GET['export_post_type']) : 'all';
-                $status = isset($_GET['export_post_status']) ? stripslashes_deep($_GET['export_post_status']) : 'all';
-                $mm_start = isset($_GET['mm_start']) ? $_GET['mm_start'] : 'all';
-                $mm_end = isset($_GET['mm_end']) ? $_GET['mm_end'] : 'all';
-                if( $mm_start != 'all' ) {
-                        $start_date = sprintf( &quot;%04d-%02d-%02d&quot;, substr( $mm_start, 0, 4 ), substr( $mm_start, 5, 2 ), 1 );
-                } else {
-                        $start_date = 'all';
-                }
-                if( $mm_end != 'all' ) {
-                        $end_date = sprintf( &quot;%04d-%02d-%02d&quot;, substr( $mm_end, 0, 4 ), substr( $mm_end, 5, 2 ), 1 );
-                } else {
-                        $end_date = 'all';
-                }
-
-        export_wp( array( 'author' =&gt; $author, 'taxonomy' =&gt; $taxonomy, 'post_type' =&gt; $post_type, 'post_status' =&gt; $status, 'start_date' =&gt; $start_date, 'end_date' =&gt; $end_date ) );
</del><ins>+        export_wp();
</ins><span class="cx">         die();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -72,70 +53,6 @@
</span><span class="cx"> &lt;p&gt;&lt;?php _e('This format, which we call WordPress eXtended RSS or WXR, will contain your posts, pages, comments, custom fields, categories, and tags.'); ?&gt;&lt;/p&gt;
</span><span class="cx"> &lt;p&gt;&lt;?php _e('Once you&amp;#8217;ve saved the download file, you can use the Import function on another WordPress site to import this site.'); ?&gt;&lt;/p&gt;
</span><span class="cx"> &lt;form action=&quot;&quot; method=&quot;get&quot;&gt;
</span><del>-&lt;h3&gt;&lt;?php _e('Filters'); ?&gt;&lt;/h3&gt;
-
-&lt;table class=&quot;form-table&quot;&gt;
-&lt;tr&gt;
-&lt;th&gt;&lt;label for=&quot;mm_start&quot;&gt;&lt;?php _e('Start Date'); ?&gt;&lt;/label&gt;&lt;/th&gt;
-&lt;td&gt;
-&lt;select name=&quot;mm_start&quot; id=&quot;mm_start&quot;&gt;
-        &lt;option value=&quot;all&quot; selected=&quot;selected&quot;&gt;&lt;?php _e('All Dates'); ?&gt;&lt;/option&gt;
-&lt;?php echo $dateoptions; ?&gt;
-&lt;/select&gt;
-&lt;/td&gt;
-&lt;/tr&gt;
-&lt;tr&gt;
-&lt;th&gt;&lt;label for=&quot;mm_end&quot; id=&quot;mm_end&quot;&gt;&lt;?php _e('End Date'); ?&gt;&lt;/label&gt;&lt;/th&gt;
-&lt;td&gt;
-&lt;select name=&quot;mm_end&quot; id=&quot;mm_end&quot;&gt;
-        &lt;option value=&quot;all&quot; selected=&quot;selected&quot;&gt;&lt;?php _e('All Dates'); ?&gt;&lt;/option&gt;
-&lt;?php echo $edateoptions; ?&gt;
-&lt;/select&gt;
-&lt;/td&gt;
-&lt;/tr&gt;
-&lt;tr&gt;
-&lt;th&gt;&lt;label for=&quot;author&quot;&gt;&lt;?php _e('Authors'); ?&gt;&lt;/label&gt;&lt;/th&gt;
-&lt;td&gt;
-&lt;select name=&quot;author&quot; id=&quot;author&quot;&gt;
-&lt;option value=&quot;all&quot; selected=&quot;selected&quot;&gt;&lt;?php _e('All Authors'); ?&gt;&lt;/option&gt;
-&lt;?php
-$authors = $wpdb-&gt;get_results( &quot;SELECT DISTINCT u.id, u.display_name FROM $wpdb-&gt;users u INNER JOIN $wpdb-&gt;posts p WHERE u.id = p.post_author ORDER BY u.display_name&quot; );
-foreach ( (array) $authors as $author ) {
-        echo &quot;&lt;option value='{$author-&gt;id}'&gt;{$author-&gt;display_name}&lt;/option&gt;\n&quot;;
-}
-?&gt;
-&lt;/select&gt;
-&lt;/td&gt;
-&lt;/tr&gt;
-&lt;?php foreach ( get_taxonomies( array( 'show_ui' =&gt; true ), 'objects' ) as $tax_obj ) {
-        $term_dropdown = wp_dropdown_categories( array( 'taxonomy' =&gt; $tax_obj-&gt;name, 'hide_if_empty' =&gt; true, 'show_option_all' =&gt; __( 'All Terms' ), 'name' =&gt; 'export_taxonomy[' . $tax_obj-&gt;name . ']', 'id' =&gt; 'taxonomy-' . $tax_obj-&gt;name, 'class' =&gt; '', 'echo' =&gt; false ) );
-        if ( $term_dropdown )
-                echo '&lt;tr&gt;&lt;th&gt;&lt;label for=&quot;taxonomy-' . $tax_obj-&gt;name . '&quot;&gt;' . $tax_obj-&gt;labels-&gt;name . '&lt;/label&gt;&lt;/th&gt;&lt;td&gt;' . $term_dropdown . '&lt;/td&gt;&lt;/tr&gt;';
-}
-?&gt;
-&lt;tr&gt;
-&lt;th&gt;&lt;label for=&quot;post_type&quot;&gt;&lt;?php _e('Content Types'); ?&gt;&lt;/label&gt;&lt;/th&gt;
-&lt;td&gt;
-&lt;select name=&quot;export_post_type&quot; id=&quot;post_type&quot;&gt;
-        &lt;option value=&quot;all&quot; selected=&quot;selected&quot;&gt;&lt;?php _e('All Content'); ?&gt;&lt;/option&gt;
-        &lt;?php foreach ( get_post_types( array( 'public' =&gt; true, 'can_export' =&gt; true ), 'objects' ) as $post_type_obj ) { ?&gt;
-                &lt;option value=&quot;&lt;?php echo $post_type_obj-&gt;name; ?&gt;&quot;&gt;&lt;?php echo $post_type_obj-&gt;labels-&gt;name; ?&gt;&lt;/option&gt;
-        &lt;?php } ?&gt;
-&lt;/select&gt;
-&lt;/td&gt;
-&lt;/tr&gt;
-&lt;tr&gt;
-&lt;th&gt;&lt;label for=&quot;status&quot;&gt;&lt;?php _e('Statuses'); ?&gt;&lt;/label&gt;&lt;/th&gt;
-&lt;td&gt;
-&lt;select name=&quot;export_post_status&quot; id=&quot;status&quot;&gt;
-        &lt;option value=&quot;all&quot; selected=&quot;selected&quot;&gt;&lt;?php _e('All Statuses'); ?&gt;&lt;/option&gt;
-&lt;?php foreach ( get_post_stati( array( 'internal' =&gt; false ), 'objects' ) as $post_status_obj ) { ?&gt;
-        &lt;option value=&quot;&lt;?php echo $post_status_obj-&gt;name; ?&gt;&quot;&gt;&lt;?php echo $post_status_obj-&gt;label; ?&gt;&lt;/option&gt;
-&lt;?php } ?&gt;
-&lt;/select&gt;
-&lt;/td&gt;
-&lt;/tr&gt;
-&lt;/table&gt;
</del><span class="cx"> &lt;?php submit_button( __('Download Export File'), 'secondary' ); ?&gt;
</span><span class="cx"> &lt;input type=&quot;hidden&quot; name=&quot;download&quot; value=&quot;true&quot; /&gt;
</span><span class="cx"> &lt;/p&gt;
</span></span></pre></div>
<a id="trunkwpadminincludesexportphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/export.php (15960 => 15961)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/export.php        2010-10-25 14:50:58 UTC (rev 15960)
+++ trunk/wp-admin/includes/export.php        2010-10-25 20:43:52 UTC (rev 15961)
</span><span class="lines">@@ -11,127 +11,63 @@
</span><span class="cx">  *
</span><span class="cx">  * Bump this when something changes that might affect compatibility.
</span><span class="cx">  *
</span><del>- * @since unknown
- * @var string
</del><ins>+ * @since 2.5.0
</ins><span class="cx">  */
</span><del>-define('WXR_VERSION', '1.0');
</del><ins>+define( 'WXR_VERSION', '1.1' );
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * {@internal Missing Short Description}}
</del><ins>+ * Generates the WXR export file for download
</ins><span class="cx">  *
</span><del>- * @since unknown
</del><ins>+ * @since 2.1.0
</ins><span class="cx">  *
</span><del>- * @param unknown_type $args
</del><ins>+ * @param array $args Filters defining what should be included in the export
</ins><span class="cx">  */
</span><span class="cx"> function export_wp( $args = array() ) {
</span><del>-        global $wpdb, $post_ids, $post, $wp_taxonomies;
</del><ins>+        global $wpdb, $post;
</ins><span class="cx"> 
</span><del>-        if ( ! is_array( $args ) )
-                $args = array( 'author' =&gt; $args );
</del><ins>+        do_action( 'export_wp' );
</ins><span class="cx"> 
</span><del>-        $defaults = array( 'author' =&gt; null, 'taxonomy' =&gt; null, 'post_type' =&gt; null, 'post_status' =&gt; null, 'start_date' =&gt; null, 'end_date' =&gt; null );
-        $args = wp_parse_args( $args, $defaults );
</del><ins>+        $sitename = sanitize_key( get_bloginfo( 'name' ) );
+        if ( ! empty($sitename) ) $sitename .= '.';
+        $filename = $sitename . 'wordpress.' . date( 'Y-m-d' ) . '.xml';
</ins><span class="cx"> 
</span><del>-        extract($args);
-
-        do_action('export_wp');
-
-        if( strlen( $start_date ) &gt; 4 &amp;&amp; strlen( $end_date ) &gt; 4 )
-                $filename = 'wordpress.' . $start_date . '.' . $end_date . '.xml';
-        else
-                $filename = 'wordpress.' . date( 'Y-m-d' ) . '.xml';
-
</del><span class="cx">         header( 'Content-Description: File Transfer' );
</span><span class="cx">         header( 'Content-Disposition: attachment; filename=' . $filename );
</span><span class="cx">         header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
</span><span class="cx"> 
</span><del>-        if ( $post_type &amp;&amp; $post_type != 'all' )
-                $where = $wpdb-&gt;prepare(&quot;WHERE post_type = %s &quot;, $post_type);
-        else
-                $where = &quot;WHERE post_type != 'revision' &quot;;
-
-        if ( $author &amp;&amp; $author != 'all' ) {
-                $author_id = (int) $author;
-                $where .= $wpdb-&gt;prepare( &quot;AND post_author = %d &quot;, $author_id );
-        }
-
-        if ( $start_date &amp;&amp; $start_date != 'all' )
-                $where .= $wpdb-&gt;prepare( &quot;AND post_date &gt;= %s &quot;, $start_date );
-
-        if ( $end_date &amp;&amp; $end_date != 'all' )
-                $where .= $wpdb-&gt;prepare( &quot;AND post_date &lt; %s &quot;, $end_date );
-
-        if ( $taxonomy &amp;&amp; is_array( $taxonomy ) ) {
-                foreach ( $taxonomy as $term_id ) {
-                        if ( $term_id != 'all' )
-                                $where .= $wpdb-&gt;prepare( &quot;AND ID IN (SELECT object_id FROM $wpdb-&gt;term_relationships WHERE term_taxonomy_id = %d) &quot;, $term_id );
-                }
-        }
-
-        if ( $post_status &amp;&amp; $post_status != 'all' )
-                $where .= $wpdb-&gt;prepare( &quot;AND post_status = %s&quot;, $post_status );
-
</del><span class="cx">         // grab a snapshot of post IDs, just in case it changes during the export
</span><del>-        $post_ids = $wpdb-&gt;get_col( &quot;SELECT ID FROM $wpdb-&gt;posts $where ORDER BY post_date_gmt ASC&quot; );
</del><ins>+        $post_ids = $wpdb-&gt;get_col( &quot;SELECT ID FROM $wpdb-&gt;posts WHERE post_type != 'revision' AND post_status != 'auto-draft' ORDER BY post_date_gmt ASC&quot; );
</ins><span class="cx"> 
</span><span class="cx">         $categories = (array) get_categories( array( 'get' =&gt; 'all' ) );
</span><span class="cx">         $tags = (array) get_tags( array( 'get' =&gt; 'all' ) );
</span><span class="cx"> 
</span><del>-        $custom_taxonomies = $wp_taxonomies;
-        unset( $custom_taxonomies['category'] );
-        unset( $custom_taxonomies['post_tag'] );
-        unset( $custom_taxonomies['link_category'] );
-        $custom_taxonomies = array_keys( $custom_taxonomies );
-        $terms = (array) get_terms( $custom_taxonomies, array( 'get' =&gt; 'all' ) );
</del><ins>+        $custom_taxonomies = get_taxonomies( array( '_builtin' =&gt; false ) );
+        $taxonomy_terms = (array) get_terms( $custom_taxonomies, array( 'get' =&gt; 'all' ) );
</ins><span class="cx"> 
</span><del>-        /**
-         * {@internal Missing Short Description}}
-         *
-         * @since unknown
-         *
-         * @param unknown_type $categories
-         */
-        function wxr_missing_parents( $categories ) {
-                if ( ! is_array( $categories ) || empty( $categories ) )
-                        return array();
-
-                foreach ( $categories as $category ){
-                        $parents[$category-&gt;term_id] = $category-&gt;parent;
-                }
-
-                $parents = array_unique( array_diff( $parents, array_keys( $parents ) ) );
-
-                if ( $zero = array_search( '0', $parents ) )
-                        unset( $parents[$zero] );
-
-                return $parents;
-        }
-
-        while ( $parents = wxr_missing_parents( $categories ) ) {
-                $found_parents = get_categories( array( 'include' =&gt; join( ', ', $parents) ) );
-                if ( is_array( $found_parents ) &amp;&amp; count( $found_parents ) )
-                        $categories = array_merge( $categories, $found_parents );
-                else
-                        break;
-        }
-
-        // Put them in order to be inserted with no child going before its parent
-        $pass = 0;
-        $passes = 1000 + count( $categories );
-        while ( ( $cat = array_shift( $categories ) ) &amp;&amp; ++$pass &lt; $passes ) {
</del><ins>+        // put categories in order with no child going before its parent
+        $cats = array();
+        while ( $cat = array_shift( $categories ) ) {
</ins><span class="cx">                 if ( $cat-&gt;parent == 0 || isset( $cats[$cat-&gt;parent] ) )
</span><span class="cx">                         $cats[$cat-&gt;term_id] = $cat;
</span><span class="cx">                 else
</span><span class="cx">                         $categories[] = $cat;
</span><span class="cx">         }
</span><del>-        unset( $categories );
</del><span class="cx"> 
</span><ins>+        // put terms in order with no child going before its parent
+        $terms = array();
+        while ( $t = array_shift( $taxonomy_terms ) ) {
+                if ( $t-&gt;parent == 0 || isset( $terms[$t-&gt;parent] ) )
+                        $terms[$t-&gt;term_id] = $t;
+                else
+                        $taxonomy_terms[] = $t;
+        }
+
</ins><span class="cx">         /**
</span><del>-         * Place string in CDATA tag.
</del><ins>+         * Wrap given string in XML CDATA tag.
</ins><span class="cx">          *
</span><del>-         * @since unknown
</del><ins>+         * @since 2.1.0
</ins><span class="cx">          *
</span><del>-         * @param string $str String to place in XML CDATA tag.
</del><ins>+         * @param string $str String to wrap in XML CDATA tag.
</ins><span class="cx">          */
</span><span class="cx">         function wxr_cdata( $str ) {
</span><span class="cx">                 if ( seems_utf8( $str ) == false )
</span><span class="lines">@@ -144,17 +80,15 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * {@internal Missing Short Description}}
</del><ins>+         * Return the URL of the site
</ins><span class="cx">          *
</span><del>-         * @since unknown
</del><ins>+         * @since 2.5.0
</ins><span class="cx">          *
</span><span class="cx">          * @return string Site URL.
</span><span class="cx">          */
</span><span class="cx">         function wxr_site_url() {
</span><del>-                global $current_site;
-
-                // mu: the base url
-                if ( isset( $current_site-&gt;domain ) )
</del><ins>+                // ms: the base url
+                if ( is_multisite() )
</ins><span class="cx">                         return network_home_url();
</span><span class="cx">                 // wp: the blog url
</span><span class="cx">                 else
</span><span class="lines">@@ -162,136 +96,169 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * {@internal Missing Short Description}}
</del><ins>+         * Output a cat_name XML tag from a given category object
</ins><span class="cx">          *
</span><del>-         * @since unknown
</del><ins>+         * @since 2.1.0
</ins><span class="cx">          *
</span><del>-         * @param object $c Category Object
</del><ins>+         * @param object $category Category Object
</ins><span class="cx">          */
</span><del>-        function wxr_cat_name( $c ) {
-                if ( empty( $c-&gt;name ) )
</del><ins>+        function wxr_cat_name( $category ) {
+                if ( empty( $category-&gt;name ) )
</ins><span class="cx">                         return;
</span><span class="cx"> 
</span><del>-                echo '&lt;wp:cat_name&gt;' . wxr_cdata( $c-&gt;name ) . '&lt;/wp:cat_name&gt;';
</del><ins>+                echo '&lt;wp:cat_name&gt;' . wxr_cdata( $category-&gt;name ) . '&lt;/wp:cat_name&gt;';
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * {@internal Missing Short Description}}
</del><ins>+         * Output a category_description XML tag from a given category object
</ins><span class="cx">          *
</span><del>-         * @since unknown
</del><ins>+         * @since 2.1.0
</ins><span class="cx">          *
</span><del>-         * @param object $c Category Object
</del><ins>+         * @param object $category Category Object
</ins><span class="cx">          */
</span><del>-        function wxr_category_description( $c ) {
-                if ( empty( $c-&gt;description ) )
</del><ins>+        function wxr_category_description( $category ) {
+                if ( empty( $category-&gt;description ) )
</ins><span class="cx">                         return;
</span><span class="cx"> 
</span><del>-                echo '&lt;wp:category_description&gt;' . wxr_cdata($c-&gt;description) . '&lt;/wp:category_description&gt;';
</del><ins>+                echo '&lt;wp:category_description&gt;' . wxr_cdata( $category-&gt;description ) . '&lt;/wp:category_description&gt;';
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * {@internal Missing Short Description}}
</del><ins>+         * Output a tag_name XML tag from a given tag object
</ins><span class="cx">          *
</span><del>-         * @since unknown
</del><ins>+         * @since 2.3.0
</ins><span class="cx">          *
</span><del>-         * @param object $t Tag Object
</del><ins>+         * @param object $tag Tag Object
</ins><span class="cx">          */
</span><del>-        function wxr_tag_name( $t ) {
-                if ( empty( $t-&gt;name ) )
</del><ins>+        function wxr_tag_name( $tag ) {
+                if ( empty( $tag-&gt;name ) )
</ins><span class="cx">                         return;
</span><span class="cx"> 
</span><del>-                echo '&lt;wp:tag_name&gt;' . wxr_cdata($t-&gt;name) . '&lt;/wp:tag_name&gt;';
</del><ins>+                echo '&lt;wp:tag_name&gt;' . wxr_cdata( $tag-&gt;name ) . '&lt;/wp:tag_name&gt;';
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * {@internal Missing Short Description}}
</del><ins>+         * Output a tag_description XML tag from a given tag object
</ins><span class="cx">          *
</span><del>-         * @since unknown
</del><ins>+         * @since 2.3.0
</ins><span class="cx">          *
</span><del>-         * @param object $t Tag Object
</del><ins>+         * @param object $tag Tag Object
</ins><span class="cx">          */
</span><del>-        function wxr_tag_description( $t ) {
-                if ( empty( $t-&gt;description ) )
</del><ins>+        function wxr_tag_description( $tag ) {
+                if ( empty( $tag-&gt;description ) )
</ins><span class="cx">                         return;
</span><span class="cx"> 
</span><del>-                echo '&lt;wp:tag_description&gt;' . wxr_cdata($t-&gt;description) . '&lt;/wp:tag_description&gt;';
</del><ins>+                echo '&lt;wp:tag_description&gt;' . wxr_cdata( $tag-&gt;description ) . '&lt;/wp:tag_description&gt;';
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * {@internal Missing Short Description}}
</del><ins>+         * Output a term_name XML tag from a given term object
</ins><span class="cx">          *
</span><del>-         * @since unknown
</del><ins>+         * @since 2.9.0
</ins><span class="cx">          *
</span><del>-         * @param object $t Term Object
</del><ins>+         * @param object $term Term Object
</ins><span class="cx">          */
</span><del>-        function wxr_term_name( $t ) {
-                if ( empty( $t-&gt;name ) )
</del><ins>+        function wxr_term_name( $term ) {
+                if ( empty( $term-&gt;name ) )
</ins><span class="cx">                         return;
</span><span class="cx"> 
</span><del>-                echo '&lt;wp:term_name&gt;' . wxr_cdata($t-&gt;name) . '&lt;/wp:term_name&gt;';
</del><ins>+                echo '&lt;wp:term_name&gt;' . wxr_cdata( $term-&gt;name ) . '&lt;/wp:term_name&gt;';
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * {@internal Missing Short Description}}
</del><ins>+         * Output a term_description XML tag from a given term object
</ins><span class="cx">          *
</span><del>-         * @since unknown
</del><ins>+         * @since 2.9.0
</ins><span class="cx">          *
</span><del>-         * @param object $t Term Object
</del><ins>+         * @param object $term Term Object
</ins><span class="cx">          */
</span><del>-        function wxr_term_description( $t ) {
-                if ( empty( $t-&gt;description ) )
</del><ins>+        function wxr_term_description( $term ) {
+                if ( empty( $term-&gt;description ) )
</ins><span class="cx">                         return;
</span><span class="cx"> 
</span><del>-                echo '&lt;wp:term_description&gt;' . wxr_cdata($t-&gt;description) . '&lt;/wp:term_description&gt;';
</del><ins>+                echo '&lt;wp:term_description&gt;' . wxr_cdata( $term-&gt;description ) . '&lt;/wp:term_description&gt;';
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * {@internal Missing Short Description}}
</del><ins>+         * Output list of authors with posts
</ins><span class="cx">          *
</span><del>-         * @since unknown
</del><ins>+         * @since 3.1.0
</ins><span class="cx">          */
</span><ins>+        function wxr_authors_list() {
+                global $wpdb;
+
+                $authors = array();
+                $results = $wpdb-&gt;get_results( &quot;SELECT DISTINCT post_author FROM $wpdb-&gt;posts&quot; );
+                foreach ( (array) $results as $result )
+                        $authors[] = get_userdata( $result-&gt;post_author );
+
+                foreach( $authors as $author ) {
+                        echo &quot;\t&lt;wp:author&gt;&quot;;
+                        echo '&lt;wp:author_login&gt;' . $author-&gt;user_login . '&lt;/wp:author_login&gt;';
+                        echo '&lt;wp:author_email&gt;' . $author-&gt;user_email . '&lt;/wp:author_email&gt;';
+                        echo '&lt;wp:author_display_name&gt;' . wxr_cdata( $author-&gt;display_name ) . '&lt;/wp:author_display_name&gt;';
+                        echo '&lt;wp:author_first_name&gt;' . wxr_cdata( $author-&gt;user_firstname ) . '&lt;/wp:author_first_name&gt;';
+                        echo '&lt;wp:author_last_name&gt;' . wxr_cdata( $author-&gt;user_lastname ) . '&lt;/wp:author_last_name&gt;';
+                        echo &quot;&lt;/wp:author&gt;\n&quot;;
+                }
+        }
+
+        /**
+         * Ouput all navigation menu terms
+         *
+         * @since 3.1.0
+         */
+        function wxr_nav_menu_terms() {
+                $nav_menus = wp_get_nav_menus();
+                if ( empty( $nav_menus ) || ! is_array( $nav_menus ) )
+                        return;
+
+                foreach ( $nav_menus as $menu ) {
+                        echo &quot;\t&lt;wp:term&gt;&lt;wp:term_id&gt;{$menu-&gt;term_id}&lt;/wp:term_id&gt;&lt;wp:term_taxonomy&gt;nav_menu&lt;/wp:term_taxonomy&gt;&lt;wp:term_slug&gt;{$menu-&gt;slug}&lt;/wp:term_slug&gt;&quot;;
+                        wxr_term_name( $menu );
+                        echo &quot;&lt;/wp:term&gt;\n&quot;;
+                }
+        }
+
+        /**
+         * Output list of taxonomy terms, in XML tag format, associated with a post
+         *
+         * @since 2.3.0
+         */
</ins><span class="cx">         function wxr_post_taxonomy() {
</span><span class="cx">                 global $post;
</span><span class="cx"> 
</span><del>-                $the_list = '';
-                $filter = 'rss';
</del><ins>+                $taxonomies = get_object_taxonomies( $post-&gt;post_type );
+                if ( empty( $taxonomies ) )
+                        return;
+                $terms = wp_get_object_terms( $post-&gt;ID, $taxonomies );
</ins><span class="cx"> 
</span><del>-                $taxonomies = get_object_taxonomies( 'post' );
-                $terms = wp_get_post_terms( $post-&gt;ID, $taxonomies );
</del><span class="cx">                 foreach ( (array) $terms as $term ) {
</span><del>-                        $domain = ( 'post_tag' == $term-&gt;taxonomy ) ? 'tag' : $term-&gt;taxonomy;
-                        $term_name = sanitize_term_field( 'name', $term-&gt;name, $term-&gt;term_id, $term-&gt;taxonomy, $filter );
-                        // Back compat.
-                        if ( 'category' == $term-&gt;taxonomy )
-                                $the_list .= &quot;\n\t\t&lt;category&gt;&lt;![CDATA[$term_name]]&gt;&lt;/category&gt;\n&quot;;
-                        elseif ( 'post_tag' == $term-&gt;taxonomy )
-                                $the_list .= &quot;\n\t\t&lt;category domain=\&quot;$domain\&quot;&gt;&lt;![CDATA[$term_name]]&gt;&lt;/category&gt;\n&quot;;
-                        // forwards compatibility as above
-                        $the_list .= &quot;\n\t\t&lt;category domain=\&quot;$domain\&quot; nicename=\&quot;{$term-&gt;slug}\&quot;&gt;&lt;![CDATA[$term_name]]&gt;&lt;/category&gt;\n&quot;;
</del><ins>+                        echo &quot;\t\t&lt;category domain=\&quot;{$term-&gt;taxonomy}\&quot; nicename=\&quot;{$term-&gt;slug}\&quot;&gt;&quot; . wxr_cdata( $term-&gt;name ) . &quot;&lt;/category&gt;\n&quot;;
</ins><span class="cx">                 }
</span><del>-                echo $the_list;
</del><span class="cx">         }
</span><span class="cx"> 
</span><del>-        echo '&lt;?xml version=&quot;1.0&quot; encoding=&quot;' . get_bloginfo('charset') . '&quot;?' . &quot;&gt;\n&quot;;
</del><ins>+        echo '&lt;?xml version=&quot;1.0&quot; encoding=&quot;' . get_bloginfo('charset') . &quot;\&quot; ?&gt;\n&quot;;
</ins><span class="cx"> 
</span><span class="cx">         ?&gt;
</span><del>-&lt;!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. --&gt;
-&lt;!-- It contains information about your blog's posts, comments, and categories. --&gt;
</del><ins>+&lt;!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. --&gt;
+&lt;!-- It contains information about your site's posts, pages, comments, categories, and other content. --&gt;
</ins><span class="cx"> &lt;!-- You may use this file to transfer that content from one site to another. --&gt;
</span><del>-&lt;!-- This file is not intended to serve as a complete backup of your blog. --&gt;
</del><ins>+&lt;!-- This file is not intended to serve as a complete backup of your site. --&gt;
</ins><span class="cx"> 
</span><del>-&lt;!-- To import this information into a WordPress blog follow these steps. --&gt;
-&lt;!-- 1. Log in to that blog as an administrator. --&gt;
-&lt;!-- 2. Go to Tools: Import in the blog's admin panels (or Manage: Import in older versions of WordPress). --&gt;
-&lt;!-- 3. Choose &quot;WordPress&quot; from the list. --&gt;
-&lt;!-- 4. Upload this file using the form provided on that page. --&gt;
-&lt;!-- 5. You will first be asked to map the authors in this export file to users --&gt;
-&lt;!--    on the blog.  For each author, you may choose to map to an --&gt;
-&lt;!--    existing user on the blog or to create a new user --&gt;
-&lt;!-- 6. WordPress will then import each of the posts, comments, and categories --&gt;
-&lt;!--    contained in this file into your blog --&gt;
</del><ins>+&lt;!-- To import this information into a WordPress site follow these steps: --&gt;
+&lt;!-- 1. Log in to that site as an administrator. --&gt;
+&lt;!-- 2. Go to Tools: Import in the WordPress admin panel. --&gt;
+&lt;!-- 3. Install the &quot;WordPress&quot; importer from the list. --&gt;
+&lt;!-- 4. Activate &amp; Run Importer. --&gt;
+&lt;!-- 5. Upload this file using the form provided on that page. --&gt;
+&lt;!-- 6. You will first be asked to map the authors in this export file to users --&gt;
+&lt;!--    on the site. For each author, you may choose to map to an --&gt;
+&lt;!--    existing user on the site or to create a new user. --&gt;
+&lt;!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. --&gt;
+&lt;!--    contained in this file into your site. --&gt;
</ins><span class="cx"> 
</span><del>-&lt;?php the_generator( 'export' );?&gt;
</del><ins>+&lt;?php the_generator( 'export' ); ?&gt;
</ins><span class="cx"> &lt;rss version=&quot;2.0&quot;
</span><span class="cx">         xmlns:excerpt=&quot;http://wordpress.org/export/&lt;?php echo WXR_VERSION; ?&gt;/excerpt/&quot;
</span><span class="cx">         xmlns:content=&quot;http://purl.org/rss/1.0/modules/content/&quot;
</span><span class="lines">@@ -302,29 +269,32 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;channel&gt;
</span><span class="cx">         &lt;title&gt;&lt;?php bloginfo_rss( 'name' ); ?&gt;&lt;/title&gt;
</span><del>-        &lt;link&gt;&lt;?php bloginfo_rss( 'url' ) ?&gt;&lt;/link&gt;
-        &lt;description&gt;&lt;?php bloginfo_rss( 'description' ) ?&gt;&lt;/description&gt;
</del><ins>+        &lt;link&gt;&lt;?php bloginfo_rss( 'url' ); ?&gt;&lt;/link&gt;
+        &lt;description&gt;&lt;?php bloginfo_rss( 'description' ); ?&gt;&lt;/description&gt;
</ins><span class="cx">         &lt;pubDate&gt;&lt;?php echo mysql2date( 'D, d M Y H:i:s +0000', get_lastpostmodified( 'GMT' ), false ); ?&gt;&lt;/pubDate&gt;
</span><del>-        &lt;generator&gt;http://wordpress.org/?v=&lt;?php bloginfo_rss( 'version' ); ?&gt;&lt;/generator&gt;
</del><span class="cx">         &lt;language&gt;&lt;?php echo get_option( 'rss_language' ); ?&gt;&lt;/language&gt;
</span><span class="cx">         &lt;wp:wxr_version&gt;&lt;?php echo WXR_VERSION; ?&gt;&lt;/wp:wxr_version&gt;
</span><span class="cx">         &lt;wp:base_site_url&gt;&lt;?php echo wxr_site_url(); ?&gt;&lt;/wp:base_site_url&gt;
</span><span class="cx">         &lt;wp:base_blog_url&gt;&lt;?php bloginfo_rss( 'url' ); ?&gt;&lt;/wp:base_blog_url&gt;
</span><del>-        &lt;?php if ( $cats ) : foreach ( $cats as $c ) : ?&gt;
-        &lt;wp:category&gt;&lt;wp:category_nicename&gt;&lt;?php echo $c-&gt;slug; ?&gt;&lt;/wp:category_nicename&gt;&lt;wp:category_parent&gt;&lt;?php echo $c-&gt;parent ? $cats[$c-&gt;parent]-&gt;name : ''; ?&gt;&lt;/wp:category_parent&gt;&lt;?php wxr_cat_name( $c ); ?&gt;&lt;?php wxr_category_description( $c ); ?&gt;&lt;/wp:category&gt;
-        &lt;?php endforeach; endif; ?&gt;
-        &lt;?php if ( $tags ) : foreach ( $tags as $t ) : ?&gt;
-        &lt;wp:tag&gt;&lt;wp:tag_slug&gt;&lt;?php echo $t-&gt;slug; ?&gt;&lt;/wp:tag_slug&gt;&lt;?php wxr_tag_name( $t ); ?&gt;&lt;?php wxr_tag_description( $t ); ?&gt;&lt;/wp:tag&gt;
-        &lt;?php endforeach; endif; ?&gt;
-        &lt;?php if ( $terms ) : foreach ( $terms as $t ) : ?&gt;
-        &lt;wp:term&gt;&lt;wp:term_taxonomy&gt;&lt;?php echo $t-&gt;taxonomy; ?&gt;&lt;/wp:term_taxonomy&gt;&lt;wp:term_slug&gt;&lt;?php echo $t-&gt;slug; ?&gt;&lt;/wp:term_slug&gt;&lt;wp:term_parent&gt;&lt;?php echo $t-&gt;parent ? $custom_taxonomies[$t-&gt;parent]-&gt;name : ''; ?&gt;&lt;/wp:term_parent&gt;&lt;?php wxr_term_name( $t ); ?&gt;&lt;?php wxr_term_description( $t ); ?&gt;&lt;/wp:term&gt;
-        &lt;?php endforeach; endif; ?&gt;
</del><span class="cx"> 
</span><ins>+&lt;?php wxr_authors_list(); ?&gt;
+
+&lt;?php foreach ( $cats as $c ) : ?&gt;
+        &lt;wp:category&gt;&lt;wp:term_id&gt;&lt;?php echo $c-&gt;term_id ?&gt;&lt;/wp:term_id&gt;&lt;wp:category_nicename&gt;&lt;?php echo $c-&gt;slug; ?&gt;&lt;/wp:category_nicename&gt;&lt;wp:category_parent&gt;&lt;?php echo $c-&gt;parent ? $cats[$c-&gt;parent]-&gt;slug : ''; ?&gt;&lt;/wp:category_parent&gt;&lt;?php wxr_cat_name( $c ); ?&gt;&lt;?php wxr_category_description( $c ); ?&gt;&lt;/wp:category&gt;
+&lt;?php endforeach; ?&gt;
+&lt;?php foreach ( $tags as $t ) : ?&gt;
+        &lt;wp:tag&gt;&lt;wp:term_id&gt;&lt;?php echo $t-&gt;term_id ?&gt;&lt;/wp:term_id&gt;&lt;wp:tag_slug&gt;&lt;?php echo $t-&gt;slug; ?&gt;&lt;/wp:tag_slug&gt;&lt;?php wxr_tag_name( $t ); ?&gt;&lt;?php wxr_tag_description( $t ); ?&gt;&lt;/wp:tag&gt;
+&lt;?php endforeach; ?&gt;
+&lt;?php foreach ( $terms as $t ) : ?&gt;
+        &lt;wp:term&gt;&lt;wp:term_id&gt;&lt;?php echo $t-&gt;term_id ?&gt;&lt;/wp:term_id&gt;&lt;wp:term_taxonomy&gt;&lt;?php echo $t-&gt;taxonomy; ?&gt;&lt;/wp:term_taxonomy&gt;&lt;wp:term_slug&gt;&lt;?php echo $t-&gt;slug; ?&gt;&lt;/wp:term_slug&gt;&lt;wp:term_parent&gt;&lt;?php echo $t-&gt;parent ? $terms[$t-&gt;parent]-&gt;slug : ''; ?&gt;&lt;/wp:term_parent&gt;&lt;?php wxr_term_name( $t ); ?&gt;&lt;?php wxr_term_description( $t ); ?&gt;&lt;/wp:term&gt;
+&lt;?php endforeach; ?&gt;
+&lt;?php wxr_nav_menu_terms(); ?&gt;
+
</ins><span class="cx">         &lt;?php do_action( 'rss2_head' ); ?&gt;
</span><span class="cx"> 
</span><del>-        &lt;?php if ( $post_ids ) {
</del><ins>+&lt;?php if ( $post_ids ) {
</ins><span class="cx">         global $wp_query;
</span><del>-        $wp_query-&gt;in_the_loop = true;  // Fake being in the loop.
</del><ins>+        $wp_query-&gt;in_the_loop = true; // Fake being in the loop.
</ins><span class="cx"> 
</span><span class="cx">         // fetch 20 posts at a time rather than loading the entire table into memory
</span><span class="cx">         while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
</span><span class="lines">@@ -332,21 +302,15 @@
</span><span class="cx">         $posts = $wpdb-&gt;get_results( &quot;SELECT * FROM $wpdb-&gt;posts $where ORDER BY post_date_gmt ASC&quot; );
</span><span class="cx"> 
</span><span class="cx">         // Begin Loop
</span><del>-        foreach ($posts as $post) {
-        setup_postdata( $post );
-
-        $is_sticky = 0;
-        if ( is_sticky( $post-&gt;ID ) )
-                $is_sticky = 1;
-
-        ?&gt;
</del><ins>+        foreach ( $posts as $post ) {
+                setup_postdata( $post );
+                $is_sticky = is_sticky( $post-&gt;ID ) ? 1 : 0;
+?&gt;
</ins><span class="cx">         &lt;item&gt;
</span><span class="cx">                 &lt;title&gt;&lt;?php echo apply_filters( 'the_title_rss', $post-&gt;post_title ); ?&gt;&lt;/title&gt;
</span><span class="cx">                 &lt;link&gt;&lt;?php the_permalink_rss() ?&gt;&lt;/link&gt;
</span><span class="cx">                 &lt;pubDate&gt;&lt;?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?&gt;&lt;/pubDate&gt;
</span><del>-                &lt;dc:creator&gt;&lt;?php echo wxr_cdata( get_the_author() ); ?&gt;&lt;/dc:creator&gt;
-                &lt;?php wxr_post_taxonomy() ?&gt;
-
</del><ins>+                &lt;dc:creator&gt;&lt;?php echo get_the_author_meta( 'login' ); ?&gt;&lt;/dc:creator&gt;
</ins><span class="cx">                 &lt;guid isPermaLink=&quot;false&quot;&gt;&lt;?php esc_url( the_guid() ); ?&gt;&lt;/guid&gt;
</span><span class="cx">                 &lt;description&gt;&lt;/description&gt;
</span><span class="cx">                 &lt;content:encoded&gt;&lt;?php echo wxr_cdata( apply_filters( 'the_content_export', $post-&gt;post_content ) ); ?&gt;&lt;/content:encoded&gt;
</span><span class="lines">@@ -363,41 +327,36 @@
</span><span class="cx">                 &lt;wp:post_type&gt;&lt;?php echo $post-&gt;post_type; ?&gt;&lt;/wp:post_type&gt;
</span><span class="cx">                 &lt;wp:post_password&gt;&lt;?php echo $post-&gt;post_password; ?&gt;&lt;/wp:post_password&gt;
</span><span class="cx">                 &lt;wp:is_sticky&gt;&lt;?php echo $is_sticky; ?&gt;&lt;/wp:is_sticky&gt;
</span><del>-                &lt;?php
-                if ( $post-&gt;post_type == 'attachment' ) { ?&gt;
</del><ins>+&lt;?php        if ( $post-&gt;post_type == 'attachment' ) : ?&gt;
</ins><span class="cx">                 &lt;wp:attachment_url&gt;&lt;?php echo wp_get_attachment_url( $post-&gt;ID ); ?&gt;&lt;/wp:attachment_url&gt;
</span><del>-                &lt;?php } ?&gt;
-                &lt;?php
-                $postmeta = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT * FROM $wpdb-&gt;postmeta WHERE post_id = %d&quot;, $post-&gt;ID ) );
-                if ( $postmeta ) {
-                ?&gt;
-                &lt;?php foreach( $postmeta as $meta ) { ?&gt;
</del><ins>+&lt;?php         endif; ?&gt;
+&lt;?php         wxr_post_taxonomy(); ?&gt;
+&lt;?php        $postmeta = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT * FROM $wpdb-&gt;postmeta WHERE post_id = %d&quot;, $post-&gt;ID ) );
+                if ( $postmeta ) : foreach( $postmeta as $meta ) : if ( $meta-&gt;meta_key != '_edit_lock' &amp;&amp; $meta-&gt;meta_key != '_edit_last' ) : ?&gt;
</ins><span class="cx">                 &lt;wp:postmeta&gt;
</span><del>-                &lt;wp:meta_key&gt;&lt;?php echo $meta-&gt;meta_key; ?&gt;&lt;/wp:meta_key&gt;
-                &lt;wp:meta_value&gt;&lt;?php echo wxr_cdata( $meta-&gt;meta_value ); ?&gt;&lt;/wp:meta_value&gt;
</del><ins>+                        &lt;wp:meta_key&gt;&lt;?php echo $meta-&gt;meta_key; ?&gt;&lt;/wp:meta_key&gt;
+                        &lt;wp:meta_value&gt;&lt;?php echo wxr_cdata( $meta-&gt;meta_value ); ?&gt;&lt;/wp:meta_value&gt;
</ins><span class="cx">                 &lt;/wp:postmeta&gt;
</span><del>-                &lt;?php } ?&gt;
-                &lt;?php } ?&gt;
-                &lt;?php
-                $comments = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT * FROM $wpdb-&gt;comments WHERE comment_post_ID = %d&quot;, $post-&gt;ID ) );
-                if ( $comments ) { foreach ( $comments as $c ) { ?&gt;
</del><ins>+&lt;?php        endif; endforeach; endif; ?&gt;
+&lt;?php        $comments = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT * FROM $wpdb-&gt;comments WHERE comment_post_ID = %d AND comment_approved &lt;&gt; 'spam'&quot;, $post-&gt;ID ) );
+                if ( $comments ) : foreach ( $comments as $c ) : ?&gt;
</ins><span class="cx">                 &lt;wp:comment&gt;
</span><del>-                &lt;wp:comment_id&gt;&lt;?php echo $c-&gt;comment_ID; ?&gt;&lt;/wp:comment_id&gt;
-                &lt;wp:comment_author&gt;&lt;?php echo wxr_cdata( $c-&gt;comment_author ); ?&gt;&lt;/wp:comment_author&gt;
-                &lt;wp:comment_author_email&gt;&lt;?php echo $c-&gt;comment_author_email; ?&gt;&lt;/wp:comment_author_email&gt;
-                &lt;wp:comment_author_url&gt;&lt;?php echo esc_url_raw( $c-&gt;comment_author_url ); ?&gt;&lt;/wp:comment_author_url&gt;
-                &lt;wp:comment_author_IP&gt;&lt;?php echo $c-&gt;comment_author_IP; ?&gt;&lt;/wp:comment_author_IP&gt;
-                &lt;wp:comment_date&gt;&lt;?php echo $c-&gt;comment_date; ?&gt;&lt;/wp:comment_date&gt;
-                &lt;wp:comment_date_gmt&gt;&lt;?php echo $c-&gt;comment_date_gmt; ?&gt;&lt;/wp:comment_date_gmt&gt;
-                &lt;wp:comment_content&gt;&lt;?php echo wxr_cdata( $c-&gt;comment_content ) ?&gt;&lt;/wp:comment_content&gt;
-                &lt;wp:comment_approved&gt;&lt;?php echo $c-&gt;comment_approved; ?&gt;&lt;/wp:comment_approved&gt;
-                &lt;wp:comment_type&gt;&lt;?php echo $c-&gt;comment_type; ?&gt;&lt;/wp:comment_type&gt;
-                &lt;wp:comment_parent&gt;&lt;?php echo $c-&gt;comment_parent; ?&gt;&lt;/wp:comment_parent&gt;
-                &lt;wp:comment_user_id&gt;&lt;?php echo $c-&gt;user_id; ?&gt;&lt;/wp:comment_user_id&gt;
</del><ins>+                        &lt;wp:comment_id&gt;&lt;?php echo $c-&gt;comment_ID; ?&gt;&lt;/wp:comment_id&gt;
+                        &lt;wp:comment_author&gt;&lt;?php echo wxr_cdata( $c-&gt;comment_author ); ?&gt;&lt;/wp:comment_author&gt;
+                        &lt;wp:comment_author_email&gt;&lt;?php echo $c-&gt;comment_author_email; ?&gt;&lt;/wp:comment_author_email&gt;
+                        &lt;wp:comment_author_url&gt;&lt;?php echo esc_url_raw( $c-&gt;comment_author_url ); ?&gt;&lt;/wp:comment_author_url&gt;
+                        &lt;wp:comment_author_IP&gt;&lt;?php echo $c-&gt;comment_author_IP; ?&gt;&lt;/wp:comment_author_IP&gt;
+                        &lt;wp:comment_date&gt;&lt;?php echo $c-&gt;comment_date; ?&gt;&lt;/wp:comment_date&gt;
+                        &lt;wp:comment_date_gmt&gt;&lt;?php echo $c-&gt;comment_date_gmt; ?&gt;&lt;/wp:comment_date_gmt&gt;
+                        &lt;wp:comment_content&gt;&lt;?php echo wxr_cdata( $c-&gt;comment_content ) ?&gt;&lt;/wp:comment_content&gt;
+                        &lt;wp:comment_approved&gt;&lt;?php echo $c-&gt;comment_approved; ?&gt;&lt;/wp:comment_approved&gt;
+                        &lt;wp:comment_type&gt;&lt;?php echo $c-&gt;comment_type; ?&gt;&lt;/wp:comment_type&gt;
+                        &lt;wp:comment_parent&gt;&lt;?php echo $c-&gt;comment_parent; ?&gt;&lt;/wp:comment_parent&gt;
+                        &lt;wp:comment_user_id&gt;&lt;?php echo $c-&gt;user_id; ?&gt;&lt;/wp:comment_user_id&gt;
</ins><span class="cx">                 &lt;/wp:comment&gt;
</span><del>-                &lt;?php } } ?&gt;
</del><ins>+&lt;?php        endforeach; endif; ?&gt;
</ins><span class="cx">         &lt;/item&gt;
</span><del>-        &lt;?php
</del><ins>+&lt;?php
</ins><span class="cx">         }
</span><span class="cx">         }
</span><span class="cx"> } ?&gt;
</span><span class="lines">@@ -405,5 +364,3 @@
</span><span class="cx"> &lt;/rss&gt;
</span><span class="cx"> &lt;?php
</span><span class="cx"> }
</span><del>-
-?&gt;
</del></span></pre></div>
<a id="trunkwpincludesgeneraltemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/general-template.php (15960 => 15961)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/general-template.php        2010-10-25 14:50:58 UTC (rev 15960)
+++ trunk/wp-includes/general-template.php        2010-10-25 20:43:52 UTC (rev 15961)
</span><span class="lines">@@ -2229,7 +2229,7 @@
</span><span class="cx">                         $gen = '&lt;!-- generator=&quot;WordPress/' . get_bloginfo( 'version' ) . '&quot; --&gt;';
</span><span class="cx">                         break;
</span><span class="cx">                 case 'export':
</span><del>-                        $gen = '&lt;!-- generator=&quot;WordPress/' . get_bloginfo_rss('version') . '&quot; created=&quot;'. date('Y-m-d H:i') . '&quot;--&gt;';
</del><ins>+                        $gen = '&lt;!-- generator=&quot;WordPress/' . get_bloginfo_rss('version') . '&quot; created=&quot;'. date('Y-m-d H:i') . '&quot; --&gt;';
</ins><span class="cx">                         break;
</span><span class="cx">         }
</span><span class="cx">         return apply_filters( &quot;get_the_generator_{$type}&quot;, $gen, $type );
</span></span></pre>
</div>
</div>

</body>
</html>