Changeset 6129
- Timestamp:
- 09/18/07 17:50:21 (1 year ago)
- Files:
-
- trunk/wp-admin/import/wordpress.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/import/wordpress.php
r6125 r6129 89 89 $this->posts = array(); 90 90 $this->categories = array(); 91 $this->tags = array(); 91 92 $num = 0; 92 93 $doing_entry = false; … … 100 101 preg_match('|<wp:category>(.*?)</wp:category>|is', $importline, $category); 101 102 $this->categories[] = $category[1]; 103 continue; 104 } 105 if ( false !== strpos($importline, '<wp:tag>') ) { 106 preg_match('|<wp:tag>(.*?)</wp:tag>|is', $importline, $tag); 107 $this->tags[] = $tag[1]; 102 108 continue; 103 109 } … … 244 250 245 251 $cat_ID = wp_insert_category($catarr); 252 } 253 } 254 255 function process_tags() { 256 global $wpdb; 257 258 $tag_names = (array) get_terms('post_tag', 'fields=names'); 259 260 while ( $c = array_shift($this->tags) ) { 261 $tag_name = trim($this->get_tag( $c, 'wp:tag_name' )); 262 263 // If the category exists we leave it alone 264 if ( in_array($tag_name, $tag_names) ) 265 continue; 266 267 $slug = $this->get_tag( $c, 'wp:tag_slug' ); 268 $description = $this->get_tag( $c, 'wp:tag_description' ); 269 270 $tagarr = compact('slug', 'description'); 271 272 $tag_ID = wp_insert_term($tag_name, 'post_tag', $tagarr); 246 273 } 247 274 } … … 392 419 $this->get_entries(); 393 420 $this->process_categories(); 421 $this->process_tags(); 394 422 $result = $this->process_posts(); 395 423 if ( is_wp_error( $result ) )
