Ticket #5460: 5460_get_entries.diff

File 5460_get_entries.diff, 1.4 KB (added by hailin, 5 years ago)

patch

Line 
1Index: C:/xampp/htdocs/wordpress_trunk/wp-admin/import/wordpress.php
2===================================================================
3--- C:/xampp/htdocs/wordpress_trunk/wp-admin/import/wordpress.php       (revision 8737)
4+++ C:/xampp/htdocs/wordpress_trunk/wp-admin/import/wordpress.php       (working copy)
5@@ -116,17 +116,35 @@
6                                        $this->tags[] = $tag[1];
7                                        continue;
8                                }
9-                               if ( false !== strpos($importline, '<item>') ) {
10+                               
11+                               /*
12+                                * need to handle the special case when </item><item> are on the same line
13+                                * eg: <item>
14+                                *     ......
15+                                *     </item> <item>
16+                                *     ......
17+                                *     </item>
18+                                */
19+                               $item_begin = ( false !== strpos($importline, '<item>') );
20+                               $item_end   = ( false !== strpos($importline, '</item>') );
21+                               
22+                               if ( $item_end && $item_begin ) {
23+                                       if ($process_post_func)
24+                                               call_user_func($process_post_func, $this->post);
25                                        $this->post = '';
26                                        $doing_entry = true;
27+                                       continue;
28+                               } else if ( $item_begin ) {
29+                                       $this->post = '';
30+                                       $doing_entry = true;
31                                        continue;
32-                               }
33-                               if ( false !== strpos($importline, '</item>') ) {
34-                                       $doing_entry = false;
35+                               } else if ( $item_end ) {
36                                        if ($process_post_func)
37                                                call_user_func($process_post_func, $this->post);
38+                                       $doing_entry = false;
39                                        continue;
40                                }
41+                               
42                                if ( $doing_entry ) {
43                                        $this->post .= $importline . "\n";
44                                }