WordPress.org

Make WordPress Core

Ticket #11118: export.php.patch

File export.php.patch, 2.2 KB (added by briancolinger, 12 years ago)
  • Sites/wordpress-trunk/wp-admin/includes/export.php

     
    1414 * @since unknown
    1515 * @var string
    1616 */
    17 define('WXR_VERSION', '1.0');
     17define('WXR_VERSION', '1.1');
    1818
    1919/**
    2020 * {@internal Missing Short Description}}
     
    265265        echo $the_list;
    266266}
    267267
     268/**
     269 * Get list of blog authors
     270 *
     271 * @param mixed UserID or all
     272 * @return array of user objects
     273 */
     274
     275function wxr_get_authors( $author ) {
     276        global $wpdb;
     277        $users = array();
     278
     279        if ( 'all' == $author) {
     280                $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts" );
     281                foreach ( $results as $result )
     282                        $users[] = get_userdata( $result->post_author );
     283        } else {
     284                $users[] = get_userdata( $author );
     285        }
     286
     287        return $users;
     288}
     289
    268290echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
    269291
    270292?>
     
    303325        <wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
    304326        <wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
    305327        <wp:base_blog_url><?php bloginfo_rss('url'); ?></wp:base_blog_url>
     328
     329<?php
     330$wp_authors = wxr_get_authors( $author );
     331?>
     332<?php foreach( $wp_authors as $wp_author ) : ?>
     333<wp:author>
     334        <wp:author_nicename><?php echo $wp_author->user_nicename; ?></wp:author_nicename>
     335        <wp:author_email><?php echo $wp_author->user_email; ?></wp:author_email>
     336        <wp:author_display_name><?php echo wxr_cdata( $wp_author->display_name ); ?></wp:author_display_name>
     337        <wp:author_first_name><?php echo wxr_cdata( $wp_author->user_firstname ); ?></wp:author_first_name>
     338        <wp:author_last_name><?php echo wxr_cdata( $wp_author->user_lastname ); ?></wp:author_last_name>
     339</wp:author>
     340<?php endforeach; ?>
     341
    306342<?php if ( $cats ) : foreach ( $cats as $c ) : ?>
    307343        <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>
    308344<?php endforeach; endif; ?>