]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/export.php
Wordpress 3.7
[autoinstalls/wordpress.git] / wp-admin / includes / export.php
index 6aa85a85a3dc89bcaf6041310493903553259c55..91d88a18abe5b9f8ff330319f75558e12b653c22 100644 (file)
@@ -13,7 +13,7 @@
  *
  * @since 2.5.0
  */
  *
  * @since 2.5.0
  */
-define( 'WXR_VERSION', '1.1' );
+define( 'WXR_VERSION', '1.2' );
 
 /**
  * Generates the WXR export file for download
 
 /**
  * Generates the WXR export file for download
@@ -117,13 +117,14 @@ function export_wp( $args = array() ) {
         * @since 2.1.0
         *
         * @param string $str String to wrap in XML CDATA tag.
         * @since 2.1.0
         *
         * @param string $str String to wrap in XML CDATA tag.
+        * @return string
         */
        function wxr_cdata( $str ) {
                if ( seems_utf8( $str ) == false )
                        $str = utf8_encode( $str );
 
                // $str = ent2ncr(esc_html($str));
         */
        function wxr_cdata( $str ) {
                if ( seems_utf8( $str ) == false )
                        $str = utf8_encode( $str );
 
                // $str = ent2ncr(esc_html($str));
-               $str = "<![CDATA[$str" . ( ( substr( $str, -1 ) == ']' ) ? ' ' : '' ) . ']]>';
+               $str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
 
                return $str;
        }
 
                return $str;
        }
@@ -237,7 +238,7 @@ function export_wp( $args = array() ) {
                global $wpdb;
 
                $authors = array();
                global $wpdb;
 
                $authors = array();
-               $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts" );
+               $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft'" );
                foreach ( (array) $results as $result )
                        $authors[] = get_userdata( $result->post_author );
 
                foreach ( (array) $results as $result )
                        $authors[] = get_userdata( $result->post_author );
 
@@ -278,7 +279,7 @@ function export_wp( $args = array() ) {
         * @since 2.3.0
         */
        function wxr_post_taxonomy() {
         * @since 2.3.0
         */
        function wxr_post_taxonomy() {
-               global $post;
+               $post = get_post();
 
                $taxonomies = get_object_taxonomies( $post->post_type );
                if ( empty( $taxonomies ) )
 
                $taxonomies = get_object_taxonomies( $post->post_type );
                if ( empty( $taxonomies ) )
@@ -331,7 +332,7 @@ function export_wp( $args = array() ) {
        <link><?php bloginfo_rss( 'url' ); ?></link>
        <description><?php bloginfo_rss( 'description' ); ?></description>
        <pubDate><?php echo date( 'D, d M Y H:i:s +0000' ); ?></pubDate>
        <link><?php bloginfo_rss( 'url' ); ?></link>
        <description><?php bloginfo_rss( 'description' ); ?></description>
        <pubDate><?php echo date( 'D, d M Y H:i:s +0000' ); ?></pubDate>
-       <language><?php echo get_option( 'rss_language' ); ?></language>
+       <language><?php bloginfo_rss( 'language' ); ?></language>
        <wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
        <wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
        <wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url>
        <wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
        <wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
        <wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url>
@@ -366,11 +367,12 @@ function export_wp( $args = array() ) {
                $is_sticky = is_sticky( $post->ID ) ? 1 : 0;
 ?>
        <item>
                $is_sticky = is_sticky( $post->ID ) ? 1 : 0;
 ?>
        <item>
+               <?php /** This filter is documented in wp-includes/feed.php */ ?>
                <title><?php echo apply_filters( 'the_title_rss', $post->post_title ); ?></title>
                <link><?php the_permalink_rss() ?></link>
                <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate>
                <title><?php echo apply_filters( 'the_title_rss', $post->post_title ); ?></title>
                <link><?php the_permalink_rss() ?></link>
                <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate>
-               <dc:creator><?php echo get_the_author_meta( 'login' ); ?></dc:creator>
-               <guid isPermaLink="false"><?php esc_url( the_guid() ); ?></guid>
+               <dc:creator><?php echo wxr_cdata( get_the_author_meta( 'login' ) ); ?></dc:creator>
+               <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>
                <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>