Changeset 37240 for trunk/src/wp-admin/includes/export.php
- Timestamp:
- 04/18/2016 03:37:04 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/export.php
r35170 r37240 183 183 return; 184 184 185 echo '<wp:cat_name>' . wxr_cdata( $category->name ) . '</wp:cat_name>';185 echo '<wp:cat_name>' . wxr_cdata( $category->name ) . "</wp:cat_name>\n"; 186 186 } 187 187 … … 197 197 return; 198 198 199 echo '<wp:category_description>' . wxr_cdata( $category->description ) . '</wp:category_description>';199 echo '<wp:category_description>' . wxr_cdata( $category->description ) . "</wp:category_description>\n"; 200 200 } 201 201 … … 211 211 return; 212 212 213 echo '<wp:tag_name>' . wxr_cdata( $tag->name ) . '</wp:tag_name>';213 echo '<wp:tag_name>' . wxr_cdata( $tag->name ) . "</wp:tag_name>\n"; 214 214 } 215 215 … … 225 225 return; 226 226 227 echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . '</wp:tag_description>';227 echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . "</wp:tag_description>\n"; 228 228 } 229 229 … … 239 239 return; 240 240 241 echo '<wp:term_name>' . wxr_cdata( $term->name ) . '</wp:term_name>';241 echo '<wp:term_name>' . wxr_cdata( $term->name ) . "</wp:term_name>\n"; 242 242 } 243 243 … … 253 253 return; 254 254 255 echo '<wp:term_description>' . wxr_cdata( $term->description ) . '</wp:term_description>'; 255 echo "\t\t<wp:term_description>" . wxr_cdata( $term->description ) . "</wp:term_description>\n"; 256 } 257 258 /** 259 * Output termmeta XML tags for a given term object. 260 * 261 * @since 4.6.0 262 * 263 * @param WP_Term $term Term object. 264 */ 265 function wxr_term_meta( $term ) { 266 global $wpdb; 267 268 $termmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->termmeta WHERE term_id = %d", $term->term_id ) ); 269 270 foreach ( $termmeta as $meta ) { 271 /** 272 * Filter whether to selectively skip term meta used for WXR exports. 273 * 274 * Returning a truthy value to the filter will skip the current meta 275 * object from being exported. 276 * 277 * @since 4.6.0 278 * 279 * @param bool $skip Whether to skip the current piece of term meta. Default false. 280 * @param string $meta_key Current meta key. 281 * @param object $meta Current meta object. 282 */ 283 if ( ! apply_filters( 'wxr_export_skip_termmeta', false, $meta->meta_key, $meta ) ) { 284 printf( "\t\t<wp:termmeta>\n\t\t\t<wp:meta_key>%s</wp:meta_key>\n\t\t\t<wp:meta_value>%s</wp:meta_value>\n\t\t</wp:termmeta>\n", wxr_cdata( $meta->meta_key ), wxr_cdata( $meta->meta_value ) ); 285 } 286 } 256 287 } 257 288 … … 387 418 388 419 <?php foreach ( $cats as $c ) : ?> 389 <wp:category><wp:term_id><?php echo intval( $c->term_id ); ?></wp:term_id><wp:category_nicename><?php echo wxr_cdata( $c->slug ); ?></wp:category_nicename><wp:category_parent><?php echo wxr_cdata( $c->parent ? $cats[$c->parent]->slug : '' ); ?></wp:category_parent><?php wxr_cat_name( $c ); ?><?php wxr_category_description( $c ); ?></wp:category> 420 <wp:category> 421 <wp:term_id><?php echo intval( $c->term_id ); ?></wp:term_id> 422 <wp:category_nicename><?php echo wxr_cdata( $c->slug ); ?></wp:category_nicename> 423 <wp:category_parent><?php echo wxr_cdata( $c->parent ? $cats[$c->parent]->slug : '' ); ?></wp:category_parent> 424 <?php wxr_cat_name( $c ); 425 wxr_category_description( $c ); 426 wxr_term_meta( $c ); ?> 427 </wp:category> 390 428 <?php endforeach; ?> 391 429 <?php foreach ( $tags as $t ) : ?> 392 <wp:tag><wp:term_id><?php echo intval( $t->term_id ); ?></wp:term_id><wp:tag_slug><?php echo wxr_cdata( $t->slug ); ?></wp:tag_slug><?php wxr_tag_name( $t ); ?><?php wxr_tag_description( $t ); ?></wp:tag> 430 <wp:tag> 431 <wp:term_id><?php echo intval( $t->term_id ); ?></wp:term_id> 432 <wp:tag_slug><?php echo wxr_cdata( $t->slug ); ?></wp:tag_slug> 433 <?php wxr_tag_name( $t ); 434 wxr_tag_description( $t ); 435 wxr_term_meta( $t ); ?> 436 </wp:tag> 393 437 <?php endforeach; ?> 394 438 <?php foreach ( $terms as $t ) : ?> 395 <wp:term><wp:term_id><?php echo wxr_cdata( $t->term_id ); ?></wp:term_id><wp:term_taxonomy><?php echo wxr_cdata( $t->taxonomy ); ?></wp:term_taxonomy><wp:term_slug><?php echo wxr_cdata( $t->slug ); ?></wp:term_slug><wp:term_parent><?php echo wxr_cdata( $t->parent ? $terms[$t->parent]->slug : '' ); ?></wp:term_parent><?php wxr_term_name( $t ); ?><?php wxr_term_description( $t ); ?></wp:term> 439 <wp:term> 440 <wp:term_id><?php echo wxr_cdata( $t->term_id ); ?></wp:term_id> 441 <wp:term_taxonomy><?php echo wxr_cdata( $t->taxonomy ); ?></wp:term_taxonomy> 442 <wp:term_slug><?php echo wxr_cdata( $t->slug ); ?></wp:term_slug> 443 <wp:term_parent><?php echo wxr_cdata( $t->parent ? $terms[$t->parent]->slug : '' ); ?></wp:term_parent> 444 <?php wxr_term_name( $t ); 445 wxr_term_description( $t ); 446 wxr_term_meta( $t ); ?> 447 </wp:term> 396 448 <?php endforeach; ?> 397 449 <?php if ( 'all' == $args['content'] ) wxr_nav_menu_terms(); ?>
Note: See TracChangeset
for help on using the changeset viewer.