WordPress Importer - Version 0.6.4

Version Description

  • Improve PHP7 compatibility.
  • Fix bug that caused slashes to be stripped from imported comments.
  • Fix for various deprecation notices including wp_get_http() and screen_icon().
  • Fix for importing export files with multiline term meta data.
Download this release

Release Info

Developer ocean90
Plugin Icon 128x128 WordPress Importer
Version 0.6.4
Comparing to
See all releases

Code changes from version 0.6.3 to 0.6.4

Files changed (4) hide show
  1. languages/wordpress-importer.pot +0 -239
  2. parsers.php +34 -27
  3. readme.txt +15 -8
  4. wordpress-importer.php +20 -10
languages/wordpress-importer.pot DELETED
@@ -1,239 +0,0 @@
1
- # Copyright (C) 2016 WordPress Importer
2
- # This file is distributed under the same license as the WordPress Importer package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: WordPress Importer 0.6.3\n"
6
- "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wordpress-"
7
- "importer\n"
8
- "POT-Creation-Date: 2016-08-19 13:28:24+00:00\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
13
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
- "Language-Team: LANGUAGE <LL@li.org>\n"
15
-
16
- #: parsers.php:42 parsers.php:72 parsers.php:80
17
- msgid "There was an error when reading this WXR file"
18
- msgstr ""
19
-
20
- #: parsers.php:43
21
- msgid ""
22
- "Details are shown above. The importer will now try again with a different "
23
- "parser..."
24
- msgstr ""
25
-
26
- #: parsers.php:84 parsers.php:89 parsers.php:306 parsers.php:495
27
- msgid ""
28
- "This does not appear to be a WXR file, missing/invalid WXR version number"
29
- msgstr ""
30
-
31
- #: wordpress-importer.php:132 wordpress-importer.php:141
32
- #: wordpress-importer.php:192 wordpress-importer.php:196
33
- #: wordpress-importer.php:205
34
- msgid "Sorry, there has been an error."
35
- msgstr ""
36
-
37
- #: wordpress-importer.php:133
38
- msgid "The file does not exist, please try again."
39
- msgstr ""
40
-
41
- #: wordpress-importer.php:176
42
- msgid "All done."
43
- msgstr ""
44
-
45
- #: wordpress-importer.php:176
46
- msgid "Have fun!"
47
- msgstr ""
48
-
49
- #: wordpress-importer.php:177
50
- msgid "Remember to update the passwords and roles of imported users."
51
- msgstr ""
52
-
53
- #: wordpress-importer.php:197
54
- msgid ""
55
- "The export file could not be found at <code>%s</code>. It is likely that "
56
- "this was caused by a permissions problem."
57
- msgstr ""
58
-
59
- #: wordpress-importer.php:213
60
- msgid ""
61
- "This WXR file (version %s) may not be supported by this version of the "
62
- "importer. Please consider updating."
63
- msgstr ""
64
-
65
- #: wordpress-importer.php:238
66
- msgid ""
67
- "Failed to import author %s. Their posts will be attributed to the current "
68
- "user."
69
- msgstr ""
70
-
71
- #: wordpress-importer.php:264
72
- msgid "Assign Authors"
73
- msgstr ""
74
-
75
- #: wordpress-importer.php:265
76
- msgid ""
77
- "To make it easier for you to edit and save the imported content, you may "
78
- "want to reassign the author of the imported item to an existing user of this "
79
- "site. For example, you may want to import all the entries as <code>admin</"
80
- "code>s entries."
81
- msgstr ""
82
-
83
- #: wordpress-importer.php:267
84
- msgid ""
85
- "If a new user is created by WordPress, a new password will be randomly "
86
- "generated and the new user&#8217;s role will be set as %s. Manually changing "
87
- "the new user&#8217;s details will be necessary."
88
- msgstr ""
89
-
90
- #: wordpress-importer.php:277
91
- msgid "Import Attachments"
92
- msgstr ""
93
-
94
- #: wordpress-importer.php:280
95
- msgid "Download and import file attachments"
96
- msgstr ""
97
-
98
- #: wordpress-importer.php:284
99
- msgid "Submit"
100
- msgstr ""
101
-
102
- #: wordpress-importer.php:297
103
- msgid "Import author:"
104
- msgstr ""
105
-
106
- #: wordpress-importer.php:308
107
- msgid "or create new user with login name:"
108
- msgstr ""
109
-
110
- #: wordpress-importer.php:311
111
- msgid "as a new user:"
112
- msgstr ""
113
-
114
- #: wordpress-importer.php:319
115
- msgid "assign posts to an existing user:"
116
- msgstr ""
117
-
118
- #: wordpress-importer.php:321
119
- msgid "or assign posts to an existing user:"
120
- msgstr ""
121
-
122
- #: wordpress-importer.php:322
123
- msgid "- Select -"
124
- msgstr ""
125
-
126
- #: wordpress-importer.php:372
127
- msgid ""
128
- "Failed to create new user for %s. Their posts will be attributed to the "
129
- "current user."
130
- msgstr ""
131
-
132
- #: wordpress-importer.php:424
133
- msgid "Failed to import category %s"
134
- msgstr ""
135
-
136
- #: wordpress-importer.php:467
137
- msgid "Failed to import post tag %s"
138
- msgstr ""
139
-
140
- #: wordpress-importer.php:516 wordpress-importer.php:738
141
- msgid "Failed to import %s %s"
142
- msgstr ""
143
-
144
- #: wordpress-importer.php:605
145
- msgid "Failed to import &#8220;%s&#8221;: Invalid post type %s"
146
- msgstr ""
147
-
148
- #: wordpress-importer.php:642
149
- msgid "%s &#8220;%s&#8221; already exists."
150
- msgstr ""
151
-
152
- #: wordpress-importer.php:704
153
- msgid "Failed to import %s &#8220;%s&#8221;"
154
- msgstr ""
155
-
156
- #: wordpress-importer.php:869
157
- msgid "Menu item skipped due to missing menu slug"
158
- msgstr ""
159
-
160
- #: wordpress-importer.php:876
161
- msgid "Menu item skipped due to invalid menu slug: %s"
162
- msgstr ""
163
-
164
- #: wordpress-importer.php:939
165
- msgid "Fetching attachments is not enabled"
166
- msgstr ""
167
-
168
- #: wordpress-importer.php:952
169
- msgid "Invalid file type"
170
- msgstr ""
171
-
172
- #: wordpress-importer.php:996
173
- msgid "Remote server did not respond"
174
- msgstr ""
175
-
176
- #: wordpress-importer.php:1002
177
- msgid "Remote server returned error response %1$d %2$s"
178
- msgstr ""
179
-
180
- #: wordpress-importer.php:1009
181
- msgid "Remote file is incorrect size"
182
- msgstr ""
183
-
184
- #: wordpress-importer.php:1014
185
- msgid "Zero size file downloaded"
186
- msgstr ""
187
-
188
- #: wordpress-importer.php:1020
189
- msgid "Remote file is too large, limit is %s"
190
- msgstr ""
191
-
192
- #: wordpress-importer.php:1119
193
- msgid "Import WordPress"
194
- msgstr ""
195
-
196
- #: wordpress-importer.php:1126
197
- msgid ""
198
- "A new version of this importer is available. Please update to version %s to "
199
- "ensure compatibility with newer export files."
200
- msgstr ""
201
-
202
- #: wordpress-importer.php:1141
203
- msgid ""
204
- "Howdy! Upload your WordPress eXtended RSS (WXR) file and we&#8217;ll import "
205
- "the posts, pages, comments, custom fields, categories, and tags into this "
206
- "site."
207
- msgstr ""
208
-
209
- #: wordpress-importer.php:1142
210
- msgid "Choose a WXR (.xml) file to upload, then click Upload file and import."
211
- msgstr ""
212
-
213
- #: wordpress-importer.php:1216
214
- msgid ""
215
- "Import <strong>posts, pages, comments, custom fields, categories, and tags</"
216
- "strong> from a WordPress export file."
217
- msgstr ""
218
-
219
- #. Plugin Name of the plugin/theme
220
- msgid "WordPress Importer"
221
- msgstr ""
222
-
223
- #. Plugin URI of the plugin/theme
224
- msgid "http://wordpress.org/extend/plugins/wordpress-importer/"
225
- msgstr ""
226
-
227
- #. Description of the plugin/theme
228
- msgid ""
229
- "Import posts, pages, comments, custom fields, categories, tags and more from "
230
- "a WordPress export file."
231
- msgstr ""
232
-
233
- #. Author of the plugin/theme
234
- msgid "wordpressdotorg"
235
- msgstr ""
236
-
237
- #. Author URI of the plugin/theme
238
- msgid "http://wordpress.org/"
239
- msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
parsers.php CHANGED
@@ -437,7 +437,16 @@ class WXR_Parser_Regex {
437
  }
438
 
439
  function parse( $file ) {
440
- $wxr_version = $in_post = false;
 
 
 
 
 
 
 
 
 
441
 
442
  $fp = $this->fopen( $file, 'r' );
443
  if ( $fp ) {
@@ -452,39 +461,37 @@ class WXR_Parser_Regex {
452
  $this->base_url = $url[1];
453
  continue;
454
  }
455
- if ( false !== strpos( $importline, '<wp:category>' ) ) {
456
- preg_match( '|<wp:category>(.*?)</wp:category>|is', $importline, $category );
457
- $this->categories[] = $this->process_category( $category[1] );
458
- continue;
459
- }
460
- if ( false !== strpos( $importline, '<wp:tag>' ) ) {
461
- preg_match( '|<wp:tag>(.*?)</wp:tag>|is', $importline, $tag );
462
- $this->tags[] = $this->process_tag( $tag[1] );
463
- continue;
464
- }
465
- if ( false !== strpos( $importline, '<wp:term>' ) ) {
466
- preg_match( '|<wp:term>(.*?)</wp:term>|is', $importline, $term );
467
- $this->terms[] = $this->process_term( $term[1] );
468
- continue;
469
- }
470
  if ( false !== strpos( $importline, '<wp:author>' ) ) {
471
  preg_match( '|<wp:author>(.*?)</wp:author>|is', $importline, $author );
472
  $a = $this->process_author( $author[1] );
473
  $this->authors[$a['author_login']] = $a;
474
  continue;
475
  }
476
- if ( false !== strpos( $importline, '<item>' ) ) {
477
- $post = '';
478
- $in_post = true;
479
- continue;
480
- }
481
- if ( false !== strpos( $importline, '</item>' ) ) {
482
- $in_post = false;
483
- $this->posts[] = $this->process_post( $post );
484
- continue;
 
 
 
 
 
 
 
 
 
 
 
485
  }
486
- if ( $in_post ) {
487
- $post .= $importline . "\n";
 
488
  }
489
  }
490
 
437
  }
438
 
439
  function parse( $file ) {
440
+ $wxr_version = $in_multiline = false;
441
+
442
+ $multiline_content = '';
443
+
444
+ $multiline_tags = array(
445
+ 'item' => array( 'posts', array( $this, 'process_post' ) ),
446
+ 'wp:category' => array( 'categories', array( $this, 'process_category' ) ),
447
+ 'wp:tag' => array( 'tags', array( $this, 'process_tag' ) ),
448
+ 'wp:term' => array( 'terms', array( $this, 'process_term' ) ),
449
+ );
450
 
451
  $fp = $this->fopen( $file, 'r' );
452
  if ( $fp ) {
461
  $this->base_url = $url[1];
462
  continue;
463
  }
464
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  if ( false !== strpos( $importline, '<wp:author>' ) ) {
466
  preg_match( '|<wp:author>(.*?)</wp:author>|is', $importline, $author );
467
  $a = $this->process_author( $author[1] );
468
  $this->authors[$a['author_login']] = $a;
469
  continue;
470
  }
471
+
472
+ foreach ( $multiline_tags as $tag => $handler ) {
473
+ // Handle multi-line tags on a singular line
474
+ if ( preg_match( '|<' . $tag . '>(.*?)</' . $tag . '>|is', $importline, $matches ) ) {
475
+ $this->{$handler[0]}[] = call_user_func( $handler[1], $matches[1] );
476
+
477
+ } elseif ( false !== ( $pos = strpos( $importline, "<$tag>" ) ) ) {
478
+ // Take note of any content after the opening tag
479
+ $multiline_content = trim( substr( $importline, $pos + strlen( $tag ) + 2 ) );
480
+
481
+ // We don't want to have this line added to `$is_multiline` below.
482
+ $importline = '';
483
+ $in_multiline = $tag;
484
+
485
+ } elseif ( false !== ( $pos = strpos( $importline, "</$tag>" ) ) ) {
486
+ $in_multiline = false;
487
+ $multiline_content .= trim( substr( $importline, 0, $pos ) );
488
+
489
+ $this->{$handler[0]}[] = call_user_func( $handler[1], $multiline_content );
490
+ }
491
  }
492
+
493
+ if ( $in_multiline && $importline ) {
494
+ $multiline_content .= $importline . "\n";
495
  }
496
  }
497
 
readme.txt CHANGED
@@ -1,11 +1,12 @@
1
  === WordPress Importer ===
2
  Contributors: wordpressdotorg
 
3
  Tags: importer, wordpress
4
- Requires at least: 3.0
5
- Tested up to: 4.6
6
- Stable tag: 0.6.3
7
  License: GPLv2 or later
8
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.
11
 
@@ -19,7 +20,7 @@ The WordPress Importer will import the following content from a WordPress export
19
  * Categories, tags and terms from custom taxonomies
20
  * Authors
21
 
22
- For further information and instructions please see the [Codex page on Importing Content](http://codex.wordpress.org/Importing_Content#WordPress)
23
 
24
  == Installation ==
25
 
@@ -38,6 +39,12 @@ If you would prefer to do things manually then follow these instructions:
38
 
39
  == Changelog ==
40
 
 
 
 
 
 
 
41
  = 0.6.3 =
42
  * Add support for import term metadata.
43
  * Fix bug that caused slashes to be stripped from imported content.
@@ -45,7 +52,7 @@ If you would prefer to do things manually then follow these instructions:
45
  * Fix PHP notices.
46
 
47
  = 0.6.2 =
48
- * Add wp_import_existing_post filter. See: https://core.trac.wordpress.org/ticket/33721
49
 
50
  = 0.6 =
51
  * Support for WXR 1.2 and multiple CDATA sections
@@ -68,7 +75,7 @@ an export file is uploaded to a server with bad permissions and WordPress 3.3 or
68
  = 0.3 =
69
  * Use an XML Parser if possible
70
  * Proper import support for nav menus
71
- * ... and much more, see [Trac ticket #15197](http://core.trac.wordpress.org/ticket/15197)
72
 
73
  = 0.1 =
74
  * Initial release
@@ -99,7 +106,7 @@ A message like "Fatal error: Allowed memory size of 8388608 bytes exhausted" ind
99
 
100
  For those with shared hosting, the best alternative may be to consult hosting support to determine the safest approach for running the import. A host may be willing to temporarily lift the memory limit and/or run the process directly from their end.
101
 
102
- -- [WordPress Codex: Importing Content](http://codex.wordpress.org/Importing_Content#Before_Importing)
103
 
104
  == Filters ==
105
 
1
  === WordPress Importer ===
2
  Contributors: wordpressdotorg
3
+ Donate link: https://wordpressfoundation.org/donate/
4
  Tags: importer, wordpress
5
+ Requires at least: 3.6
6
+ Tested up to: 4.9
7
+ Stable tag: 0.6.4
8
  License: GPLv2 or later
9
+ License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.
12
 
20
  * Categories, tags and terms from custom taxonomies
21
  * Authors
22
 
23
+ For further information and instructions please see the [Codex page on Importing Content](https://codex.wordpress.org/Importing_Content#WordPress)
24
 
25
  == Installation ==
26
 
39
 
40
  == Changelog ==
41
 
42
+ = 0.6.4 =
43
+ * Improve PHP7 compatibility.
44
+ * Fix bug that caused slashes to be stripped from imported comments.
45
+ * Fix for various deprecation notices including `wp_get_http()` and `screen_icon()`.
46
+ * Fix for importing export files with multiline term meta data.
47
+
48
  = 0.6.3 =
49
  * Add support for import term metadata.
50
  * Fix bug that caused slashes to be stripped from imported content.
52
  * Fix PHP notices.
53
 
54
  = 0.6.2 =
55
+ * Add `wp_import_existing_post` filter, see [Trac ticket #33721](https://core.trac.wordpress.org/ticket/33721).
56
 
57
  = 0.6 =
58
  * Support for WXR 1.2 and multiple CDATA sections
75
  = 0.3 =
76
  * Use an XML Parser if possible
77
  * Proper import support for nav menus
78
+ * ... and much more, see [Trac ticket #15197](https://core.trac.wordpress.org/ticket/15197)
79
 
80
  = 0.1 =
81
  * Initial release
106
 
107
  For those with shared hosting, the best alternative may be to consult hosting support to determine the safest approach for running the import. A host may be willing to temporarily lift the memory limit and/or run the process directly from their end.
108
 
109
+ -- [WordPress Codex: Importing Content](https://codex.wordpress.org/Importing_Content#Before_Importing)
110
 
111
  == Filters ==
112
 
wordpress-importer.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /*
3
  Plugin Name: WordPress Importer
4
- Plugin URI: http://wordpress.org/extend/plugins/wordpress-importer/
5
  Description: Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.
6
  Author: wordpressdotorg
7
- Author URI: http://wordpress.org/
8
- Version: 0.6.3
9
  Text Domain: wordpress-importer
10
  License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
  */
@@ -786,6 +786,7 @@ class WP_Import extends WP_Importer {
786
  if ( ! $post_exists || ! comment_exists( $comment['comment_author'], $comment['comment_date'] ) ) {
787
  if ( isset( $inserted_comments[$comment['comment_parent']] ) )
788
  $comment['comment_parent'] = $inserted_comments[$comment['comment_parent']];
 
789
  $comment = wp_filter_comment( $comment );
790
  $inserted_comments[$key] = wp_insert_comment( $comment );
791
  do_action( 'wp_import_insert_comment', $inserted_comments[$key], $comment, $comment_post_ID, $post );
@@ -881,7 +882,7 @@ class WP_Import extends WP_Importer {
881
  }
882
 
883
  foreach ( $item['postmeta'] as $meta )
884
- $$meta['key'] = $meta['value'];
885
 
886
  if ( 'taxonomy' == $_menu_item_type && isset( $this->processed_terms[intval($_menu_item_object_id)] ) ) {
887
  $_menu_item_object_id = $this->processed_terms[intval($_menu_item_object_id)];
@@ -988,7 +989,13 @@ class WP_Import extends WP_Importer {
988
  return new WP_Error( 'upload_dir_error', $upload['error'] );
989
 
990
  // fetch the remote url and write it to the placeholder file
991
- $headers = wp_get_http( $url, $upload['file'] );
 
 
 
 
 
 
992
 
993
  // request failed
994
  if ( ! $headers ) {
@@ -996,10 +1003,12 @@ class WP_Import extends WP_Importer {
996
  return new WP_Error( 'import_file_error', __('Remote server did not respond', 'wordpress-importer') );
997
  }
998
 
 
 
999
  // make sure the fetch was successful
1000
- if ( $headers['response'] != '200' ) {
1001
  @unlink( $upload['file'] );
1002
- return new WP_Error( 'import_file_error', sprintf( __('Remote server returned error response %1$d %2$s', 'wordpress-importer'), esc_html($headers['response']), get_status_header_desc($headers['response']) ) );
1003
  }
1004
 
1005
  $filesize = filesize( $upload['file'] );
@@ -1048,8 +1057,10 @@ class WP_Import extends WP_Importer {
1048
  if ( isset( $this->processed_posts[$parent_id] ) )
1049
  $local_parent_id = $this->processed_posts[$parent_id];
1050
 
1051
- if ( $local_child_id && $local_parent_id )
1052
  $wpdb->update( $wpdb->posts, array( 'post_parent' => $local_parent_id ), array( 'ID' => $local_child_id ), '%d', '%d' );
 
 
1053
  }
1054
 
1055
  // all other posts/terms are imported, retry menu items with missing associated object
@@ -1115,7 +1126,6 @@ class WP_Import extends WP_Importer {
1115
  // Display import page title
1116
  function header() {
1117
  echo '<div class="wrap">';
1118
- screen_icon();
1119
  echo '<h2>' . __( 'Import WordPress', 'wordpress-importer' ) . '</h2>';
1120
 
1121
  $updates = get_plugin_updates();
@@ -1206,7 +1216,7 @@ class WP_Import extends WP_Importer {
1206
  } // class_exists( 'WP_Importer' )
1207
 
1208
  function wordpress_importer_init() {
1209
- load_plugin_textdomain( 'wordpress-importer', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
1210
 
1211
  /**
1212
  * WordPress Importer object for registering the import callback
1
  <?php
2
  /*
3
  Plugin Name: WordPress Importer
4
+ Plugin URI: https://wordpress.org/plugins/wordpress-importer/
5
  Description: Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.
6
  Author: wordpressdotorg
7
+ Author URI: https://wordpress.org/
8
+ Version: 0.6.4
9
  Text Domain: wordpress-importer
10
  License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
  */
786
  if ( ! $post_exists || ! comment_exists( $comment['comment_author'], $comment['comment_date'] ) ) {
787
  if ( isset( $inserted_comments[$comment['comment_parent']] ) )
788
  $comment['comment_parent'] = $inserted_comments[$comment['comment_parent']];
789
+ $comment = wp_slash( $comment );
790
  $comment = wp_filter_comment( $comment );
791
  $inserted_comments[$key] = wp_insert_comment( $comment );
792
  do_action( 'wp_import_insert_comment', $inserted_comments[$key], $comment, $comment_post_ID, $post );
882
  }
883
 
884
  foreach ( $item['postmeta'] as $meta )
885
+ ${$meta['key']} = $meta['value'];
886
 
887
  if ( 'taxonomy' == $_menu_item_type && isset( $this->processed_terms[intval($_menu_item_object_id)] ) ) {
888
  $_menu_item_object_id = $this->processed_terms[intval($_menu_item_object_id)];
989
  return new WP_Error( 'upload_dir_error', $upload['error'] );
990
 
991
  // fetch the remote url and write it to the placeholder file
992
+ $remote_response = wp_safe_remote_get( $url, array(
993
+ 'timeout' => 300,
994
+ 'stream' => true,
995
+ 'filename' => $upload['file'],
996
+ ) );
997
+
998
+ $headers = wp_remote_retrieve_headers( $remote_response );
999
 
1000
  // request failed
1001
  if ( ! $headers ) {
1003
  return new WP_Error( 'import_file_error', __('Remote server did not respond', 'wordpress-importer') );
1004
  }
1005
 
1006
+ $remote_response_code = wp_remote_retrieve_response_code( $remote_response );
1007
+
1008
  // make sure the fetch was successful
1009
+ if ( $remote_response_code != '200' ) {
1010
  @unlink( $upload['file'] );
1011
+ return new WP_Error( 'import_file_error', sprintf( __('Remote server returned error response %1$d %2$s', 'wordpress-importer'), esc_html($remote_response_code), get_status_header_desc($remote_response_code) ) );
1012
  }
1013
 
1014
  $filesize = filesize( $upload['file'] );
1057
  if ( isset( $this->processed_posts[$parent_id] ) )
1058
  $local_parent_id = $this->processed_posts[$parent_id];
1059
 
1060
+ if ( $local_child_id && $local_parent_id ) {
1061
  $wpdb->update( $wpdb->posts, array( 'post_parent' => $local_parent_id ), array( 'ID' => $local_child_id ), '%d', '%d' );
1062
+ clean_post_cache( $local_child_id );
1063
+ }
1064
  }
1065
 
1066
  // all other posts/terms are imported, retry menu items with missing associated object
1126
  // Display import page title
1127
  function header() {
1128
  echo '<div class="wrap">';
 
1129
  echo '<h2>' . __( 'Import WordPress', 'wordpress-importer' ) . '</h2>';
1130
 
1131
  $updates = get_plugin_updates();
1216
  } // class_exists( 'WP_Importer' )
1217
 
1218
  function wordpress_importer_init() {
1219
+ load_plugin_textdomain( 'wordpress-importer' );
1220
 
1221
  /**
1222
  * WordPress Importer object for registering the import callback