Changeset 43571 for trunk/src/wp-admin/includes/export.php
- Timestamp:
- 08/17/2018 01:50:26 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/export.php
r42875 r43571 446 446 <!-- contained in this file into your site. --> 447 447 448 <?php the_generator( 'export' ); ?>448 <?php the_generator( 'export' ); ?> 449 449 <rss version="2.0" 450 450 xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/" … … 465 465 <wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url> 466 466 467 <?php wxr_authors_list( $post_ids ); ?>468 469 <?php foreach ( $cats as $c ) : ?>467 <?php wxr_authors_list( $post_ids ); ?> 468 469 <?php foreach ( $cats as $c ) : ?> 470 470 <wp:category> 471 471 <wp:term_id><?php echo intval( $c->term_id ); ?></wp:term_id> … … 478 478 ?> 479 479 </wp:category> 480 <?php endforeach; ?>481 <?php foreach ( $tags as $t ) : ?>480 <?php endforeach; ?> 481 <?php foreach ( $tags as $t ) : ?> 482 482 <wp:tag> 483 483 <wp:term_id><?php echo intval( $t->term_id ); ?></wp:term_id> … … 489 489 ?> 490 490 </wp:tag> 491 <?php endforeach; ?>492 <?php foreach ( $terms as $t ) : ?>491 <?php endforeach; ?> 492 <?php foreach ( $terms as $t ) : ?> 493 493 <wp:term> 494 494 <wp:term_id><?php echo wxr_cdata( $t->term_id ); ?></wp:term_id> … … 502 502 ?> 503 503 </wp:term> 504 <?php endforeach; ?>505 <?php506 if ( 'all' == $args['content'] ) {507 wxr_nav_menu_terms();}508 ?>504 <?php endforeach; ?> 505 <?php 506 if ( 'all' == $args['content'] ) { 507 wxr_nav_menu_terms();} 508 ?> 509 509 510 510 <?php … … 513 513 ?> 514 514 515 <?php516 if ( $post_ids ) {517 /**518 * @global WP_Query $wp_query519 */520 global $wp_query;521 522 // Fake being in the loop.523 $wp_query->in_the_loop = true;524 525 // Fetch 20 posts at a time rather than loading the entire table into memory.526 while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {527 $where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')';528 $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );529 530 // Begin Loop.531 foreach ( $posts as $post ) {532 setup_postdata( $post );533 $is_sticky = is_sticky( $post->ID ) ? 1 : 0;534 ?>515 <?php 516 if ( $post_ids ) { 517 /** 518 * @global WP_Query $wp_query 519 */ 520 global $wp_query; 521 522 // Fake being in the loop. 523 $wp_query->in_the_loop = true; 524 525 // Fetch 20 posts at a time rather than loading the entire table into memory. 526 while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) { 527 $where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')'; 528 $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" ); 529 530 // Begin Loop. 531 foreach ( $posts as $post ) { 532 setup_postdata( $post ); 533 $is_sticky = is_sticky( $post->ID ) ? 1 : 0; 534 ?> 535 535 <item> 536 536 <title> 537 <?php538 /** This filter is documented in wp-includes/feed.php */539 echo apply_filters( 'the_title_rss', $post->post_title );540 ?>537 <?php 538 /** This filter is documented in wp-includes/feed.php */ 539 echo apply_filters( 'the_title_rss', $post->post_title ); 540 ?> 541 541 </title> 542 542 <link><?php the_permalink_rss(); ?></link> … … 546 546 <description></description> 547 547 <content:encoded> 548 <?php549 /**550 * Filters the post content used for WXR exports.551 *552 * @since 2.5.0553 *554 * @param string $post_content Content of the current post.555 */556 echo wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) );557 ?>548 <?php 549 /** 550 * Filters the post content used for WXR exports. 551 * 552 * @since 2.5.0 553 * 554 * @param string $post_content Content of the current post. 555 */ 556 echo wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) ); 557 ?> 558 558 </content:encoded> 559 559 <excerpt:encoded> 560 <?php561 /**562 * Filters the post excerpt used for WXR exports.563 *564 * @since 2.6.0565 *566 * @param string $post_excerpt Excerpt for the current post.567 */568 echo wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) );569 ?>560 <?php 561 /** 562 * Filters the post excerpt used for WXR exports. 563 * 564 * @since 2.6.0 565 * 566 * @param string $post_excerpt Excerpt for the current post. 567 */ 568 echo wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) ); 569 ?> 570 570 </excerpt:encoded> 571 571 <wp:post_id><?php echo intval( $post->ID ); ?></wp:post_id> … … 581 581 <wp:post_password><?php echo wxr_cdata( $post->post_password ); ?></wp:post_password> 582 582 <wp:is_sticky><?php echo intval( $is_sticky ); ?></wp:is_sticky> 583 <?php if ( $post->post_type == 'attachment' ) : ?>583 <?php if ( $post->post_type == 'attachment' ) : ?> 584 584 <wp:attachment_url><?php echo wxr_cdata( wp_get_attachment_url( $post->ID ) ); ?></wp:attachment_url> 585 585 <?php endif; ?> 586 <?php wxr_post_taxonomy(); ?>587 <?php588 $postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );589 foreach ( $postmeta as $meta ) :590 /**591 * Filters whether to selectively skip post meta used for WXR exports.592 *593 * Returning a truthy value to the filter will skip the current meta594 * object from being exported.595 *596 * @since 3.3.0597 *598 * @param bool $skip Whether to skip the current post meta. Default false.599 * @param string $meta_key Current meta key.600 * @param object $meta Current meta object.601 */602 if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) {603 continue;604 }605 ?>586 <?php wxr_post_taxonomy(); ?> 587 <?php 588 $postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) ); 589 foreach ( $postmeta as $meta ) : 590 /** 591 * Filters whether to selectively skip post meta used for WXR exports. 592 * 593 * Returning a truthy value to the filter will skip the current meta 594 * object from being exported. 595 * 596 * @since 3.3.0 597 * 598 * @param bool $skip Whether to skip the current post meta. Default false. 599 * @param string $meta_key Current meta key. 600 * @param object $meta Current meta object. 601 */ 602 if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) { 603 continue; 604 } 605 ?> 606 606 <wp:postmeta> 607 607 <wp:meta_key><?php echo wxr_cdata( $meta->meta_key ); ?></wp:meta_key> 608 608 <wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value> 609 609 </wp:postmeta> 610 <?php611 endforeach;612 613 $_comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) );614 $comments = array_map( 'get_comment', $_comments );615 foreach ( $comments as $c ) :616 ?>610 <?php 611 endforeach; 612 613 $_comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) ); 614 $comments = array_map( 'get_comment', $_comments ); 615 foreach ( $comments as $c ) : 616 ?> 617 617 <wp:comment> 618 618 <wp:comment_id><?php echo intval( $c->comment_ID ); ?></wp:comment_id> … … 628 628 <wp:comment_parent><?php echo intval( $c->comment_parent ); ?></wp:comment_parent> 629 629 <wp:comment_user_id><?php echo intval( $c->user_id ); ?></wp:comment_user_id> 630 <?php631 632 foreach ( $c_meta as $meta ) :633 /**634 * Filters whether to selectively skip comment meta used for WXR exports.635 *636 * Returning a truthy value to the filter will skip the current meta637 * object from being exported.638 *639 * @since 4.0.0640 *641 * @param bool $skip Whether to skip the current comment meta. Default false.642 * @param string $meta_key Current meta key.643 * @param object $meta Current meta object.644 */645 if ( apply_filters( 'wxr_export_skip_commentmeta', false, $meta->meta_key, $meta ) ) {646 continue;647 }648 ?>630 <?php 631 $c_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) ); 632 foreach ( $c_meta as $meta ) : 633 /** 634 * Filters whether to selectively skip comment meta used for WXR exports. 635 * 636 * Returning a truthy value to the filter will skip the current meta 637 * object from being exported. 638 * 639 * @since 4.0.0 640 * 641 * @param bool $skip Whether to skip the current comment meta. Default false. 642 * @param string $meta_key Current meta key. 643 * @param object $meta Current meta object. 644 */ 645 if ( apply_filters( 'wxr_export_skip_commentmeta', false, $meta->meta_key, $meta ) ) { 646 continue; 647 } 648 ?> 649 649 <wp:commentmeta> 650 650 <wp:meta_key><?php echo wxr_cdata( $meta->meta_key ); ?></wp:meta_key> 651 651 <wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value> 652 652 </wp:commentmeta> 653 <?php endforeach; ?>653 <?php endforeach; ?> 654 654 </wp:comment> 655 <?php endforeach; ?>655 <?php endforeach; ?> 656 656 </item> 657 <?php658 }659 }660 }661 ?>657 <?php 658 } 659 } 660 } 661 ?> 662 662 </channel> 663 663 </rss> 664 <?php664 <?php 665 665 }
Note: See TracChangeset
for help on using the changeset viewer.