Ticket #5454: export-minor-additions-r6367.patch
File export-minor-additions-r6367.patch, 3.6 KB (added by , 16 years ago) |
---|
-
wordpress/wp-admin/includes/export.php
1 1 <?php 2 2 3 // version number for the export format. bump this when something changes that might affect compatibility. 4 define('WXR_VERSION', '1.0'); 5 3 6 function export_wp($author='') { 4 7 global $wpdb, $post_ids, $post; 5 8 … … 69 72 return $str; 70 73 } 71 74 75 function wxr_site_url() { 76 global $current_site; 77 78 // mu: the base url 79 if ( isset($current_site->domain) ) { 80 return 'http://'.$current_site->domain.$current_site->path; 81 } 82 // wp: the blog url 83 else { 84 return get_bloginfo_rss('url'); 85 } 86 } 87 72 88 function wxr_cat_name($c) { 73 89 if ( empty($c->name) ) 74 90 return; … … 105 121 106 122 if ( !empty($categories) ) foreach ( (array) $categories as $category ) { 107 123 $cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter); 124 // for backwards compatibility 108 125 $the_list .= "\n\t\t<category><![CDATA[$cat_name]]></category>\n"; 126 // forwards compatibility: use a unique identifier for each cat to avoid clashes 127 // http://trac.wordpress.org/ticket/5447 128 $the_list .= "\n\t\t<category domain=\"category\" nicename=\"{$category->slug}\"><![CDATA[$cat_name]]></category>\n"; 109 129 } 110 130 111 131 if ( !empty($tags) ) foreach ( (array) $tags as $tag ) { 112 132 $tag_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter); 113 133 $the_list .= "\n\t\t<category domain=\"tag\"><![CDATA[$tag_name]]></category>\n"; 134 // forwards compatibility as above 135 $the_list .= "\n\t\t<category domain=\"tag\" nicename=\"{$tag->slug}\"><![CDATA[$tag_name]]></category>\n"; 114 136 } 115 137 116 138 echo $the_list; … … 140 162 xmlns:content="http://purl.org/rss/1.0/modules/content/" 141 163 xmlns:wfw="http://wellformedweb.org/CommentAPI/" 142 164 xmlns:dc="http://purl.org/dc/elements/1.1/" 143 xmlns:wp="http://wordpress.org/export/ 1.0/"165 xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/" 144 166 > 145 167 146 168 <channel> … … 150 172 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate> 151 173 <generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator> 152 174 <language><?php echo get_option('rss_language'); ?></language> 175 <wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version> 176 <wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url> 177 <wp:base_blog_url><?php bloginfo_rss('url'); ?></wp:base_blog_url> 153 178 <?php if ( $cats ) : foreach ( $cats as $c ) : ?> 154 179 <wp:category><wp:category_nicename><?php echo $c->slug; ?></wp:category_nicename><wp:category_parent><?php echo $c->parent ? $cats[$c->parent]->name : ''; ?></wp:category_parent><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category> 155 180 <?php endforeach; endif; ?> … … 187 212 <wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order> 188 213 <wp:post_type><?php echo $post->post_type; ?></wp:post_type> 189 214 <?php 215 if ($post->post_type == 'attachment') { ?> 216 <wp:attachment_url><?php echo wp_get_attachment_url($post->ID); ?></wp:attachment_url> 217 <?php } ?> 218 <?php 190 219 $postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID"); 191 220 if ( $postmeta ) { 192 221 ?> … … 212 241 <wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved> 213 242 <wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type> 214 243 <wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent> 244 <wp:comment_user_id><?php echo $c->user_id; ?></wp:comment_user_id> 215 245 </wp:comment> 216 246 <?php } } ?> 217 247 </item>