Changeset 5423
- Timestamp:
- 05/10/2007 12:05:21 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/import/wordpress.php
r5404 r5423 85 85 function get_entries() { 86 86 set_magic_quotes_runtime(0); 87 $importdata = file($this->file); // Read the file into an array 88 $importdata = implode('', $importdata); // squish it 89 $importdata = preg_replace("/(\r\n|\n|\r)/", "\n", $importdata); 90 preg_match_all('|<item>(.*?)</item>|is', $importdata, $this->posts); 91 $this->posts = $this->posts[1]; 87 $importdata = array_map('rtrim', file($this->file)); // Read the file into an array 88 89 $this->posts = array(); 90 $this->categories = array(); 91 $num = 0; 92 $doing_entry = false; 93 foreach ($importdata as $importline) { 94 if ( false !== strpos($importline, '<wp:category>') ) { 95 preg_match('|<wp:category>(.*?)</wp:category>|is', $importline, $category); 96 $this->categories[] = $category[1]; 97 continue; 98 } 99 if ( false !== strpos($importline, '<item>') ) { 100 $this->posts[$num] = ''; 101 $doing_entry = true; 102 continue; 103 } 104 if ( false !== strpos($importline, '</item>') ) { 105 $num++; 106 $doing_entry = false; 107 continue; 108 } 109 if ( $doing_entry ) { 110 $this->posts[$num] .= $importline . "\n"; 111 } 112 } 113 92 114 foreach ($this->posts as $post) { 93 115 $post_ID = (int) $this->get_tag( $post, 'wp:post_id' ); 94 if ($post_ID) 116 if ($post_ID) { 95 117 $this->posts_processed[$post_ID][0] = &$post; 96 118 $this->posts_processed[$post_ID][1] = 0; 97 } 98 preg_match_all('|<wp:category>(.*?)</wp:category>|is', $importdata, $this->categories); 99 $this->categories = $this->categories[1]; 119 } 120 } 100 121 } 101 122
Note: See TracChangeset
for help on using the changeset viewer.