WordPress.org

Make WordPress Core

Changeset 6076


Ignore:
Timestamp:
09/11/07 18:35:21 (8 years ago)
Author:
ryan
Message:

Add tags to export. see #4682

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/export.php

    r5910 r6076  
    6666 
    6767$categories = (array) get_categories('get=all'); 
     68$tags = (array) get_tags('get=all'); 
    6869 
    6970function wxr_missing_parents($categories) { 
     
    125126 
    126127    echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>'; 
     128} 
     129 
     130function wxr_tag_name($t) { 
     131    if ( empty($t->name) ) 
     132        return; 
     133 
     134    echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>'; 
     135} 
     136 
     137function wxr_tag_description($t) { 
     138    if ( empty($t->description) ) 
     139        return; 
     140 
     141    echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>'; 
    127142} 
    128143 
     
    168183<?php if ( $cats ) : foreach ( $cats as $c ) : ?> 
    169184    <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> 
     185<?php endforeach; endif; ?> 
     186<?php if ( $tags ) : foreach ( $tags as $t ) : ?> 
     187    <wp:tag><wp:tag_slug><?php echo $t->slug; ?></wp:tag_slug><?php wxr_tag_name($t); ?><?php wxr_tag_description($t); ?></wp:tag> 
    170188<?php endforeach; endif; ?> 
    171189    <?php do_action('rss2_head'); ?> 
Note: See TracChangeset for help on using the changeset viewer.