Export and import post excerpts. Props kartik_subbarao. fixes #5555

git-svn-id: http://svn.automattic.com/wordpress/trunk@7965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-05-20 22:22:21 +00:00
parent a54eb08d09
commit 47e6a79b98
2 changed files with 8 additions and 2 deletions

View File

@ -357,6 +357,11 @@ class WP_Import {
$guid = $this->get_tag( $post, 'guid' );
$post_author = $this->get_tag( $post, 'dc:creator' );
$post_excerpt = $this->get_tag( $post, 'excerpt:encoded' );
$post_excerpt = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_excerpt);
$post_excerpt = str_replace('<br>', '<br />', $post_excerpt);
$post_excerpt = str_replace('<hr>', '<hr />', $post_excerpt);
$post_content = $this->get_tag( $post, 'content:encoded' );
$post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);
$post_content = str_replace('<br>', '<br />', $post_content);
@ -404,7 +409,7 @@ class WP_Import {
$post_author = $this->checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent', 'menu_order', 'post_type', 'post_password');
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_excerpt', 'post_title', 'post_status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent', 'menu_order', 'post_type', 'post_password');
if ($post_type == 'attachment') {
$remote_url = $this->get_tag( $post, 'wp:attachment_url' );
if ( !$remote_url )

View File

@ -201,6 +201,7 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
<guid isPermaLink="false"><?php the_guid(); ?></guid>
<description></description>
<content:encoded><?php echo wxr_cdata( apply_filters('the_content_export', $post->post_content) ); ?></content:encoded>
<excerpt:encoded><?php echo wxr_cdata( apply_filters('the_excerpt_export', $post->post_excerpt) ); ?></excerpt:encoded>
<wp:post_id><?php echo $post->ID; ?></wp:post_id>
<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
@ -252,4 +253,4 @@ if ( $comments ) { foreach ( $comments as $c ) { ?>
<?php
}
?>
?>