Make WordPress Core

Ticket #5555: wpexcerpt.patch

File wpexcerpt.patch, 1.4 KB (added by kartik_subbarao, 17 years ago)

Enable proper import/export of blog excerpts

  • export.php

    diff -urN wp-admin.orig/export.php wp-admin/export.php
    old new  
    222222
    223223<guid isPermaLink="false"><?php the_guid(); ?></guid>
    224224<description></description>
     225<excerpt:encoded><![CDATA[<?php echo $post->post_excerpt ?>]]></excerpt:encoded>
    225226<content:encoded><![CDATA[<?php echo $post->post_content ?>]]></content:encoded>
    226227<wp:post_id><?php echo $post->ID; ?></wp:post_id>
    227228<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
  • import/wordpress.php

    diff -urN wp-admin.orig/import/wordpress.php wp-admin/import/wordpress.php
    old new  
    294294                $guid           = $this->get_tag( $post, 'guid' );
    295295                $post_author    = $this->get_tag( $post, 'dc:creator' );
    296296
     297                $post_excerpt = $this->get_tag( $post, 'excerpt:encoded' );
     298                $post_excerpt = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_excerpt);
     299                $post_excerpt = str_replace('<br>', '<br />', $post_excerpt);
     300                $post_excerpt = str_replace('<hr>', '<hr />', $post_excerpt);
     301
    297302                $post_content = $this->get_tag( $post, 'content:encoded' );
    298303                $post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);
    299304                $post_content = str_replace('<br>', '<br />', $post_content);