Changeset 4558 for trunk/wp-admin/import/wordpress.php
- Timestamp:
- 11/30/2006 06:15:14 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/import/wordpress.php
r4495 r4558 86 86 preg_match_all('|<item>(.*?)</item>|is', $importdata, $this->posts); 87 87 $this->posts = $this->posts[1]; 88 preg_match_all('|<wp:category>(.*?)</wp:category>|is', $importdata, $this->categories); 89 $this->categories = $this->categories[1]; 88 90 } 89 91 … … 176 178 $this->get_entries(); 177 179 $this->wp_authors_form(); 180 } 181 182 function process_categories() { 183 global $wpdb; 184 185 $cat_names = (array) $wpdb->get_col("SELECT cat_name FROM $wpdb->categories"); 186 187 while ( $c = array_shift($this->categories) ) { 188 $cat_name = trim(str_replace(array ('<![CDATA[', ']]>'), '', $this->get_tag( $c, 'wp:cat_name' ))); 189 190 // If the category exists we leave it alone 191 if ( in_array($cat_name, $cat_names) ) 192 continue; 193 194 $category_nicename = $this->get_tag( $c, 'wp:category_nicename' ); 195 $posts_private = (int) $this->get_tag( $c, 'wp:posts_private' ); 196 $links_private = (int) $this->get_tag( $c, 'wp:links_private' ); 197 198 $parent = $this->get_tag( $c, 'wp:category_parent' ); 199 200 if ( empty($parent) ) 201 $category_parent = '0'; 202 else 203 $category_parent = (int) category_exists($parent); 204 205 $catarr = compact('category_nicename', 'category_parent', 'posts_private', 'links_private', 'posts_private', 'cat_name'); 206 207 $cat_ID = wp_insert_category($catarr); 208 } 178 209 } 179 210 … … 207 238 $cat_index = 0; 208 239 foreach ($categories as $category) { 209 $categories[$cat_index] = $wpdb->escape($this->unhtmlentities( $category));240 $categories[$cat_index] = $wpdb->escape($this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $category))); 210 241 $cat_index++; 211 242 } … … 278 309 $this->get_authors_from_post(); 279 310 $this->get_entries(); 311 $this->process_categories(); 280 312 $this->process_posts(); 281 313 }
Note: See TracChangeset
for help on using the changeset viewer.