diff -r 34716fd837a4 -r be944660c56a wp/wp-admin/includes/export.php --- a/wp/wp-admin/includes/export.php Tue Dec 15 15:52:01 2020 +0100 +++ b/wp/wp-admin/includes/export.php Wed Sep 21 18:19:35 2022 +0200 @@ -23,6 +23,7 @@ * 'auto-draft' status will be skipped. * * @since 2.1.0 + * @since 5.7.0 Added the `post_modified` and `post_modified_gmt` fields to the export file. * * @global wpdb $wpdb WordPress database abstraction object. * @global WP_Post $post Global post object. @@ -168,7 +169,7 @@ // Put categories in order with no child going before its parent. while ( $cat = array_shift( $categories ) ) { - if ( 0 == $cat->parent || isset( $cats[ $cat->parent ] ) ) { + if ( ! $cat->parent || isset( $cats[ $cat->parent ] ) ) { $cats[ $cat->term_id ] = $cat; } else { $categories[] = $cat; @@ -177,7 +178,7 @@ // Put terms in order with no child going before its parent. while ( $t = array_shift( $custom_terms ) ) { - if ( 0 == $t->parent || isset( $terms[ $t->parent ] ) ) { + if ( ! $t->parent || isset( $terms[ $t->parent ] ) ) { $terms[ $t->term_id ] = $t; } else { $custom_terms[] = $t; @@ -227,7 +228,7 @@ * * @since 2.1.0 * - * @param object $category Category Object + * @param WP_Term $category Category Object */ function wxr_cat_name( $category ) { if ( empty( $category->name ) ) { @@ -242,7 +243,7 @@ * * @since 2.1.0 * - * @param object $category Category Object + * @param WP_Term $category Category Object */ function wxr_category_description( $category ) { if ( empty( $category->description ) ) { @@ -257,7 +258,7 @@ * * @since 2.3.0 * - * @param object $tag Tag Object + * @param WP_Term $tag Tag Object */ function wxr_tag_name( $tag ) { if ( empty( $tag->name ) ) { @@ -272,7 +273,7 @@ * * @since 2.3.0 * - * @param object $tag Tag Object + * @param WP_Term $tag Tag Object */ function wxr_tag_description( $tag ) { if ( empty( $tag->description ) ) { @@ -287,7 +288,7 @@ * * @since 2.9.0 * - * @param object $term Term Object + * @param WP_Term $term Term Object */ function wxr_term_name( $term ) { if ( empty( $term->name ) ) { @@ -302,7 +303,7 @@ * * @since 2.9.0 * - * @param object $term Term Object + * @param WP_Term $term Term Object */ function wxr_term_description( $term ) { if ( empty( $term->description ) ) { @@ -372,7 +373,7 @@ foreach ( $authors as $author ) { echo "\t"; - echo '' . intval( $author->ID ) . ''; + echo '' . (int) $author->ID . ''; echo '' . wxr_cdata( $author->user_login ) . ''; echo '' . wxr_cdata( $author->user_email ) . ''; echo '' . wxr_cdata( $author->display_name ) . ''; @@ -395,7 +396,7 @@ foreach ( $nav_menus as $menu ) { echo "\t"; - echo '' . intval( $menu->term_id ) . ''; + echo '' . (int) $menu->term_id . ''; echo 'nav_menu'; echo '' . wxr_cdata( $menu->slug ) . ''; wxr_term_name( $menu ); @@ -478,7 +479,7 @@ - term_id ); ?> + term_id; ?> slug ); ?> parent ? $cats[ $c->parent ]->slug : '' ); ?> - term_id ); ?> + term_id; ?> slug ); ?> - term_id ); ?> + term_id; ?> taxonomy ); ?> slug ); ?> parent ? $terms[ $t->parent ]->slug : '' ); ?> @@ -534,15 +535,21 @@ // Fetch 20 posts at a time rather than loading the entire table into memory. while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) { - $where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')'; + $where = 'WHERE ID IN (' . implode( ',', $next_posts ) . ')'; $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" ); // Begin Loop. foreach ( $posts as $post ) { setup_postdata( $post ); - /** This filter is documented in wp-includes/feed.php */ - $title = apply_filters( 'the_title_rss', $post->post_title ); + /** + * Filters the post title used for WXR exports. + * + * @since 5.7.0 + * + * @param string $post_title Title of the current post. + */ + $title = wxr_cdata( apply_filters( 'the_title_export', $post->post_title ) ); /** * Filters the post content used for WXR exports. @@ -573,18 +580,20 @@ - ID ); ?> + ID; ?> post_date ); ?> post_date_gmt ); ?> + post_modified ); ?> + post_modified_gmt ); ?> comment_status ); ?> ping_status ); ?> post_name ); ?> post_status ); ?> - post_parent ); ?> - menu_order ); ?> + post_parent; ?> + menu_order; ?> post_type ); ?> post_password ); ?> - + post_type ) : ?> ID ) ); ?> @@ -620,7 +629,7 @@ foreach ( $comments as $c ) : ?> - comment_ID ); ?> + comment_ID; ?> comment_author ); ?> comment_author_email ); ?> comment_author_url ); ?> @@ -630,8 +639,8 @@ comment_content ); ?> comment_approved ); ?> comment_type ); ?> - comment_parent ); ?> - user_id ); ?> + comment_parent; ?> + user_id; ?> get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) ); foreach ( $c_meta as $meta ) :