Changeset 6375
- Timestamp:
- 12/12/2007 05:11:24 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/export.php
r6354 r6375 1 1 <?php 2 3 // version number for the export format. bump this when something changes that might affect compatibility. 4 define('WXR_VERSION', '1.0'); 2 5 3 6 function export_wp($author='') { … … 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) ) … … 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 … … 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 … … 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 … … 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> … … 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 ) { … … 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 } } ?>
Note: See TracChangeset
for help on using the changeset viewer.