1 |
commit: 15ad975d807a98ec34a4fa4f4d31b1eff01c4be0 |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Aug 24 00:04:47 2016 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Aug 24 00:05:07 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/blogs-gentoo.git/commit/?id=15ad975d |
7 |
|
8 |
Update plugin wordpress-importer to 0.6.3 |
9 |
|
10 |
.../languages/wordpress-importer.pot | 104 +++++++++++---------- |
11 |
plugins/wordpress-importer/parsers.php | 45 +++++++-- |
12 |
plugins/wordpress-importer/readme.txt | 14 ++- |
13 |
plugins/wordpress-importer/wordpress-importer.php | 94 ++++++++++++++++++- |
14 |
4 files changed, 193 insertions(+), 64 deletions(-) |
15 |
|
16 |
diff --git a/plugins/wordpress-importer/languages/wordpress-importer.pot b/plugins/wordpress-importer/languages/wordpress-importer.pot |
17 |
index 0ca72e2..97f2d76 100644 |
18 |
--- a/plugins/wordpress-importer/languages/wordpress-importer.pot |
19 |
+++ b/plugins/wordpress-importer/languages/wordpress-importer.pot |
20 |
@@ -1,18 +1,19 @@ |
21 |
-# Copyright (C) 2011 WordPress Importer |
22 |
+# Copyright (C) 2016 WordPress Importer |
23 |
# This file is distributed under the same license as the WordPress Importer package. |
24 |
msgid "" |
25 |
msgstr "" |
26 |
-"Project-Id-Version: WordPress Importer 0.5\n" |
27 |
-"Report-Msgid-Bugs-To: http://wordpress.org/tag/wordpress-importer\n" |
28 |
-"POT-Creation-Date: 2011-07-16 15:45:12+00:00\n" |
29 |
+"Project-Id-Version: WordPress Importer 0.6.3\n" |
30 |
+"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wordpress-" |
31 |
+"importer\n" |
32 |
+"POT-Creation-Date: 2016-08-19 13:28:24+00:00\n" |
33 |
"MIME-Version: 1.0\n" |
34 |
"Content-Type: text/plain; charset=UTF-8\n" |
35 |
"Content-Transfer-Encoding: 8bit\n" |
36 |
-"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n" |
37 |
+"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n" |
38 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
39 |
"Language-Team: LANGUAGE <LL@××.org>\n" |
40 |
|
41 |
-#: parsers.php:42 parsers.php:63 |
42 |
+#: parsers.php:42 parsers.php:72 parsers.php:80 |
43 |
msgid "There was an error when reading this WXR file" |
44 |
msgstr "" |
45 |
|
46 |
@@ -22,49 +23,56 @@ msgid "" |
47 |
"parser..." |
48 |
msgstr "" |
49 |
|
50 |
-#: parsers.php:67 parsers.php:72 parsers.php:262 parsers.php:451 |
51 |
+#: parsers.php:84 parsers.php:89 parsers.php:306 parsers.php:495 |
52 |
msgid "" |
53 |
"This does not appear to be a WXR file, missing/invalid WXR version number" |
54 |
msgstr "" |
55 |
|
56 |
-#: wordpress-importer.php:134 wordpress-importer.php:143 |
57 |
-#: wordpress-importer.php:194 wordpress-importer.php:202 |
58 |
+#: wordpress-importer.php:132 wordpress-importer.php:141 |
59 |
+#: wordpress-importer.php:192 wordpress-importer.php:196 |
60 |
+#: wordpress-importer.php:205 |
61 |
msgid "Sorry, there has been an error." |
62 |
msgstr "" |
63 |
|
64 |
-#: wordpress-importer.php:135 |
65 |
+#: wordpress-importer.php:133 |
66 |
msgid "The file does not exist, please try again." |
67 |
msgstr "" |
68 |
|
69 |
-#: wordpress-importer.php:178 |
70 |
+#: wordpress-importer.php:176 |
71 |
msgid "All done." |
72 |
msgstr "" |
73 |
|
74 |
-#: wordpress-importer.php:178 |
75 |
+#: wordpress-importer.php:176 |
76 |
msgid "Have fun!" |
77 |
msgstr "" |
78 |
|
79 |
-#: wordpress-importer.php:179 |
80 |
+#: wordpress-importer.php:177 |
81 |
msgid "Remember to update the passwords and roles of imported users." |
82 |
msgstr "" |
83 |
|
84 |
-#: wordpress-importer.php:210 |
85 |
+#: wordpress-importer.php:197 |
86 |
+msgid "" |
87 |
+"The export file could not be found at <code>%s</code>. It is likely that " |
88 |
+"this was caused by a permissions problem." |
89 |
+msgstr "" |
90 |
+ |
91 |
+#: wordpress-importer.php:213 |
92 |
msgid "" |
93 |
"This WXR file (version %s) may not be supported by this version of the " |
94 |
"importer. Please consider updating." |
95 |
msgstr "" |
96 |
|
97 |
-#: wordpress-importer.php:235 |
98 |
+#: wordpress-importer.php:238 |
99 |
msgid "" |
100 |
"Failed to import author %s. Their posts will be attributed to the current " |
101 |
"user." |
102 |
msgstr "" |
103 |
|
104 |
-#: wordpress-importer.php:261 |
105 |
+#: wordpress-importer.php:264 |
106 |
msgid "Assign Authors" |
107 |
msgstr "" |
108 |
|
109 |
-#: wordpress-importer.php:262 |
110 |
+#: wordpress-importer.php:265 |
111 |
msgid "" |
112 |
"To make it easier for you to edit and save the imported content, you may " |
113 |
"want to reassign the author of the imported item to an existing user of this " |
114 |
@@ -72,137 +80,137 @@ msgid "" |
115 |
"code>s entries." |
116 |
msgstr "" |
117 |
|
118 |
-#: wordpress-importer.php:264 |
119 |
+#: wordpress-importer.php:267 |
120 |
msgid "" |
121 |
"If a new user is created by WordPress, a new password will be randomly " |
122 |
"generated and the new user’s role will be set as %s. Manually changing " |
123 |
"the new user’s details will be necessary." |
124 |
msgstr "" |
125 |
|
126 |
-#: wordpress-importer.php:274 |
127 |
+#: wordpress-importer.php:277 |
128 |
msgid "Import Attachments" |
129 |
msgstr "" |
130 |
|
131 |
-#: wordpress-importer.php:277 |
132 |
+#: wordpress-importer.php:280 |
133 |
msgid "Download and import file attachments" |
134 |
msgstr "" |
135 |
|
136 |
-#: wordpress-importer.php:281 |
137 |
+#: wordpress-importer.php:284 |
138 |
msgid "Submit" |
139 |
msgstr "" |
140 |
|
141 |
-#: wordpress-importer.php:294 |
142 |
+#: wordpress-importer.php:297 |
143 |
msgid "Import author:" |
144 |
msgstr "" |
145 |
|
146 |
-#: wordpress-importer.php:305 |
147 |
+#: wordpress-importer.php:308 |
148 |
msgid "or create new user with login name:" |
149 |
msgstr "" |
150 |
|
151 |
-#: wordpress-importer.php:308 |
152 |
+#: wordpress-importer.php:311 |
153 |
msgid "as a new user:" |
154 |
msgstr "" |
155 |
|
156 |
-#: wordpress-importer.php:316 |
157 |
+#: wordpress-importer.php:319 |
158 |
msgid "assign posts to an existing user:" |
159 |
msgstr "" |
160 |
|
161 |
-#: wordpress-importer.php:318 |
162 |
+#: wordpress-importer.php:321 |
163 |
msgid "or assign posts to an existing user:" |
164 |
msgstr "" |
165 |
|
166 |
-#: wordpress-importer.php:319 |
167 |
+#: wordpress-importer.php:322 |
168 |
msgid "- Select -" |
169 |
msgstr "" |
170 |
|
171 |
-#: wordpress-importer.php:369 |
172 |
+#: wordpress-importer.php:372 |
173 |
msgid "" |
174 |
"Failed to create new user for %s. Their posts will be attributed to the " |
175 |
"current user." |
176 |
msgstr "" |
177 |
|
178 |
-#: wordpress-importer.php:418 |
179 |
+#: wordpress-importer.php:424 |
180 |
msgid "Failed to import category %s" |
181 |
msgstr "" |
182 |
|
183 |
-#: wordpress-importer.php:456 |
184 |
+#: wordpress-importer.php:467 |
185 |
msgid "Failed to import post tag %s" |
186 |
msgstr "" |
187 |
|
188 |
-#: wordpress-importer.php:500 wordpress-importer.php:626 |
189 |
+#: wordpress-importer.php:516 wordpress-importer.php:738 |
190 |
msgid "Failed to import %s %s" |
191 |
msgstr "" |
192 |
|
193 |
-#: wordpress-importer.php:522 |
194 |
+#: wordpress-importer.php:605 |
195 |
msgid "Failed to import “%s”: Invalid post type %s" |
196 |
msgstr "" |
197 |
|
198 |
-#: wordpress-importer.php:543 |
199 |
+#: wordpress-importer.php:642 |
200 |
msgid "%s “%s” already exists." |
201 |
msgstr "" |
202 |
|
203 |
-#: wordpress-importer.php:598 |
204 |
+#: wordpress-importer.php:704 |
205 |
msgid "Failed to import %s “%s”" |
206 |
msgstr "" |
207 |
|
208 |
-#: wordpress-importer.php:744 |
209 |
+#: wordpress-importer.php:869 |
210 |
msgid "Menu item skipped due to missing menu slug" |
211 |
msgstr "" |
212 |
|
213 |
-#: wordpress-importer.php:751 |
214 |
+#: wordpress-importer.php:876 |
215 |
msgid "Menu item skipped due to invalid menu slug: %s" |
216 |
msgstr "" |
217 |
|
218 |
-#: wordpress-importer.php:814 |
219 |
+#: wordpress-importer.php:939 |
220 |
msgid "Fetching attachments is not enabled" |
221 |
msgstr "" |
222 |
|
223 |
-#: wordpress-importer.php:827 |
224 |
+#: wordpress-importer.php:952 |
225 |
msgid "Invalid file type" |
226 |
msgstr "" |
227 |
|
228 |
-#: wordpress-importer.php:871 |
229 |
+#: wordpress-importer.php:996 |
230 |
msgid "Remote server did not respond" |
231 |
msgstr "" |
232 |
|
233 |
-#: wordpress-importer.php:877 |
234 |
+#: wordpress-importer.php:1002 |
235 |
msgid "Remote server returned error response %1$d %2$s" |
236 |
msgstr "" |
237 |
|
238 |
-#: wordpress-importer.php:884 |
239 |
+#: wordpress-importer.php:1009 |
240 |
msgid "Remote file is incorrect size" |
241 |
msgstr "" |
242 |
|
243 |
-#: wordpress-importer.php:889 |
244 |
+#: wordpress-importer.php:1014 |
245 |
msgid "Zero size file downloaded" |
246 |
msgstr "" |
247 |
|
248 |
-#: wordpress-importer.php:895 |
249 |
+#: wordpress-importer.php:1020 |
250 |
msgid "Remote file is too large, limit is %s" |
251 |
msgstr "" |
252 |
|
253 |
-#: wordpress-importer.php:994 |
254 |
+#: wordpress-importer.php:1119 |
255 |
msgid "Import WordPress" |
256 |
msgstr "" |
257 |
|
258 |
-#: wordpress-importer.php:1001 |
259 |
+#: wordpress-importer.php:1126 |
260 |
msgid "" |
261 |
"A new version of this importer is available. Please update to version %s to " |
262 |
"ensure compatibility with newer export files." |
263 |
msgstr "" |
264 |
|
265 |
-#: wordpress-importer.php:1016 |
266 |
+#: wordpress-importer.php:1141 |
267 |
msgid "" |
268 |
"Howdy! Upload your WordPress eXtended RSS (WXR) file and we’ll import " |
269 |
"the posts, pages, comments, custom fields, categories, and tags into this " |
270 |
"site." |
271 |
msgstr "" |
272 |
|
273 |
-#: wordpress-importer.php:1017 |
274 |
+#: wordpress-importer.php:1142 |
275 |
msgid "Choose a WXR (.xml) file to upload, then click Upload file and import." |
276 |
msgstr "" |
277 |
|
278 |
-#: wordpress-importer.php:1091 |
279 |
+#: wordpress-importer.php:1216 |
280 |
msgid "" |
281 |
"Import <strong>posts, pages, comments, custom fields, categories, and tags</" |
282 |
"strong> from a WordPress export file." |
283 |
|
284 |
diff --git a/plugins/wordpress-importer/parsers.php b/plugins/wordpress-importer/parsers.php |
285 |
index f3cee6c..fab101e 100644 |
286 |
--- a/plugins/wordpress-importer/parsers.php |
287 |
+++ b/plugins/wordpress-importer/parsers.php |
288 |
@@ -114,28 +114,46 @@ class WXR_Parser_SimpleXML { |
289 |
// grab cats, tags and terms |
290 |
foreach ( $xml->xpath('/rss/channel/wp:category') as $term_arr ) { |
291 |
$t = $term_arr->children( $namespaces['wp'] ); |
292 |
- $categories[] = array( |
293 |
+ $category = array( |
294 |
'term_id' => (int) $t->term_id, |
295 |
'category_nicename' => (string) $t->category_nicename, |
296 |
'category_parent' => (string) $t->category_parent, |
297 |
'cat_name' => (string) $t->cat_name, |
298 |
'category_description' => (string) $t->category_description |
299 |
); |
300 |
+ |
301 |
+ foreach ( $t->termmeta as $meta ) { |
302 |
+ $category['termmeta'][] = array( |
303 |
+ 'key' => (string) $meta->meta_key, |
304 |
+ 'value' => (string) $meta->meta_value |
305 |
+ ); |
306 |
+ } |
307 |
+ |
308 |
+ $categories[] = $category; |
309 |
} |
310 |
|
311 |
foreach ( $xml->xpath('/rss/channel/wp:tag') as $term_arr ) { |
312 |
$t = $term_arr->children( $namespaces['wp'] ); |
313 |
- $tags[] = array( |
314 |
+ $tag = array( |
315 |
'term_id' => (int) $t->term_id, |
316 |
'tag_slug' => (string) $t->tag_slug, |
317 |
'tag_name' => (string) $t->tag_name, |
318 |
'tag_description' => (string) $t->tag_description |
319 |
); |
320 |
+ |
321 |
+ foreach ( $t->termmeta as $meta ) { |
322 |
+ $tag['termmeta'][] = array( |
323 |
+ 'key' => (string) $meta->meta_key, |
324 |
+ 'value' => (string) $meta->meta_value |
325 |
+ ); |
326 |
+ } |
327 |
+ |
328 |
+ $tags[] = $tag; |
329 |
} |
330 |
|
331 |
foreach ( $xml->xpath('/rss/channel/wp:term') as $term_arr ) { |
332 |
$t = $term_arr->children( $namespaces['wp'] ); |
333 |
- $terms[] = array( |
334 |
+ $term = array( |
335 |
'term_id' => (int) $t->term_id, |
336 |
'term_taxonomy' => (string) $t->term_taxonomy, |
337 |
'slug' => (string) $t->term_slug, |
338 |
@@ -143,6 +161,15 @@ class WXR_Parser_SimpleXML { |
339 |
'term_name' => (string) $t->term_name, |
340 |
'term_description' => (string) $t->term_description |
341 |
); |
342 |
+ |
343 |
+ foreach ( $t->termmeta as $meta ) { |
344 |
+ $term['termmeta'][] = array( |
345 |
+ 'key' => (string) $meta->meta_key, |
346 |
+ 'value' => (string) $meta->meta_value |
347 |
+ ); |
348 |
+ } |
349 |
+ |
350 |
+ $terms[] = $term; |
351 |
} |
352 |
|
353 |
// grab posts |
354 |
@@ -204,7 +231,7 @@ class WXR_Parser_SimpleXML { |
355 |
); |
356 |
} |
357 |
} |
358 |
- |
359 |
+ |
360 |
$post['comments'][] = array( |
361 |
'comment_id' => (int) $comment->comment_id, |
362 |
'comment_author' => (string) $comment->comment_author, |
363 |
@@ -324,7 +351,11 @@ class WXR_Parser_XML { |
364 |
if ( ! trim( $cdata ) ) |
365 |
return; |
366 |
|
367 |
- $this->cdata .= trim( $cdata ); |
368 |
+ if ( false !== $this->in_tag || false !== $this->in_sub_tag ) { |
369 |
+ $this->cdata .= $cdata; |
370 |
+ } else { |
371 |
+ $this->cdata .= trim( $cdata ); |
372 |
+ } |
373 |
} |
374 |
|
375 |
function tag_close( $parser, $tag ) { |
376 |
@@ -401,10 +432,6 @@ class WXR_Parser_Regex { |
377 |
var $terms = array(); |
378 |
var $base_url = ''; |
379 |
|
380 |
- function WXR_Parser_Regex() { |
381 |
- $this->__construct(); |
382 |
- } |
383 |
- |
384 |
function __construct() { |
385 |
$this->has_gzip = is_callable( 'gzopen' ); |
386 |
} |
387 |
|
388 |
diff --git a/plugins/wordpress-importer/readme.txt b/plugins/wordpress-importer/readme.txt |
389 |
index b326c82..3ad9c75 100644 |
390 |
--- a/plugins/wordpress-importer/readme.txt |
391 |
+++ b/plugins/wordpress-importer/readme.txt |
392 |
@@ -1,10 +1,9 @@ |
393 |
=== WordPress Importer === |
394 |
Contributors: wordpressdotorg |
395 |
-Donate link: |
396 |
Tags: importer, wordpress |
397 |
Requires at least: 3.0 |
398 |
-Tested up to: 3.6 |
399 |
-Stable tag: 0.6 |
400 |
+Tested up to: 4.6 |
401 |
+Stable tag: 0.6.3 |
402 |
License: GPLv2 or later |
403 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html |
404 |
|
405 |
@@ -39,6 +38,15 @@ If you would prefer to do things manually then follow these instructions: |
406 |
|
407 |
== Changelog == |
408 |
|
409 |
+= 0.6.3 = |
410 |
+* Add support for import term metadata. |
411 |
+* Fix bug that caused slashes to be stripped from imported content. |
412 |
+* Fix bug that caused characters to be stripped inside of CDATA in some cases. |
413 |
+* Fix PHP notices. |
414 |
+ |
415 |
+= 0.6.2 = |
416 |
+* Add wp_import_existing_post filter. See: https://core.trac.wordpress.org/ticket/33721 |
417 |
+ |
418 |
= 0.6 = |
419 |
* Support for WXR 1.2 and multiple CDATA sections |
420 |
* Post aren't duplicates if their post_type's are different |
421 |
|
422 |
diff --git a/plugins/wordpress-importer/wordpress-importer.php b/plugins/wordpress-importer/wordpress-importer.php |
423 |
index ab6814c..31b91b6 100644 |
424 |
--- a/plugins/wordpress-importer/wordpress-importer.php |
425 |
+++ b/plugins/wordpress-importer/wordpress-importer.php |
426 |
@@ -5,7 +5,7 @@ Plugin URI: http://wordpress.org/extend/plugins/wordpress-importer/ |
427 |
Description: Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file. |
428 |
Author: wordpressdotorg |
429 |
Author URI: http://wordpress.org/ |
430 |
-Version: 0.6.1 |
431 |
+Version: 0.6.3 |
432 |
Text Domain: wordpress-importer |
433 |
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
434 |
*/ |
435 |
@@ -63,8 +63,6 @@ class WP_Import extends WP_Importer { |
436 |
var $url_remap = array(); |
437 |
var $featured_images = array(); |
438 |
|
439 |
- function WP_Import() { /* nothing */ } |
440 |
- |
441 |
/** |
442 |
* Registered callback function for the WordPress Importer |
443 |
* |
444 |
@@ -416,6 +414,7 @@ class WP_Import extends WP_Importer { |
445 |
'cat_name' => $cat['cat_name'], |
446 |
'category_description' => $category_description |
447 |
); |
448 |
+ $catarr = wp_slash( $catarr ); |
449 |
|
450 |
$id = wp_insert_category( $catarr ); |
451 |
if ( ! is_wp_error( $id ) ) { |
452 |
@@ -428,6 +427,8 @@ class WP_Import extends WP_Importer { |
453 |
echo '<br />'; |
454 |
continue; |
455 |
} |
456 |
+ |
457 |
+ $this->process_termmeta( $cat, $id['term_id'] ); |
458 |
} |
459 |
|
460 |
unset( $this->categories ); |
461 |
@@ -454,6 +455,7 @@ class WP_Import extends WP_Importer { |
462 |
continue; |
463 |
} |
464 |
|
465 |
+ $tag = wp_slash( $tag ); |
466 |
$tag_desc = isset( $tag['tag_description'] ) ? $tag['tag_description'] : ''; |
467 |
$tagarr = array( 'slug' => $tag['tag_slug'], 'description' => $tag_desc ); |
468 |
|
469 |
@@ -468,6 +470,8 @@ class WP_Import extends WP_Importer { |
470 |
echo '<br />'; |
471 |
continue; |
472 |
} |
473 |
+ |
474 |
+ $this->process_termmeta( $tag, $id['term_id'] ); |
475 |
} |
476 |
|
477 |
unset( $this->tags ); |
478 |
@@ -500,6 +504,7 @@ class WP_Import extends WP_Importer { |
479 |
$parent = term_exists( $term['term_parent'], $term['term_taxonomy'] ); |
480 |
if ( is_array( $parent ) ) $parent = $parent['term_id']; |
481 |
} |
482 |
+ $term = wp_slash( $term ); |
483 |
$description = isset( $term['term_description'] ) ? $term['term_description'] : ''; |
484 |
$termarr = array( 'slug' => $term['slug'], 'description' => $description, 'parent' => intval($parent) ); |
485 |
|
486 |
@@ -514,12 +519,75 @@ class WP_Import extends WP_Importer { |
487 |
echo '<br />'; |
488 |
continue; |
489 |
} |
490 |
+ |
491 |
+ $this->process_termmeta( $term, $id['term_id'] ); |
492 |
} |
493 |
|
494 |
unset( $this->terms ); |
495 |
} |
496 |
|
497 |
/** |
498 |
+ * Add metadata to imported term. |
499 |
+ * |
500 |
+ * @since 0.6.2 |
501 |
+ * |
502 |
+ * @param array $term Term data from WXR import. |
503 |
+ * @param int $term_id ID of the newly created term. |
504 |
+ */ |
505 |
+ protected function process_termmeta( $term, $term_id ) { |
506 |
+ if ( ! isset( $term['termmeta'] ) ) { |
507 |
+ $term['termmeta'] = array(); |
508 |
+ } |
509 |
+ |
510 |
+ /** |
511 |
+ * Filters the metadata attached to an imported term. |
512 |
+ * |
513 |
+ * @since 0.6.2 |
514 |
+ * |
515 |
+ * @param array $termmeta Array of term meta. |
516 |
+ * @param int $term_id ID of the newly created term. |
517 |
+ * @param array $term Term data from the WXR import. |
518 |
+ */ |
519 |
+ $term['termmeta'] = apply_filters( 'wp_import_term_meta', $term['termmeta'], $term_id, $term ); |
520 |
+ |
521 |
+ if ( empty( $term['termmeta'] ) ) { |
522 |
+ return; |
523 |
+ } |
524 |
+ |
525 |
+ foreach ( $term['termmeta'] as $meta ) { |
526 |
+ /** |
527 |
+ * Filters the meta key for an imported piece of term meta. |
528 |
+ * |
529 |
+ * @since 0.6.2 |
530 |
+ * |
531 |
+ * @param string $meta_key Meta key. |
532 |
+ * @param int $term_id ID of the newly created term. |
533 |
+ * @param array $term Term data from the WXR import. |
534 |
+ */ |
535 |
+ $key = apply_filters( 'import_term_meta_key', $meta['key'], $term_id, $term ); |
536 |
+ if ( ! $key ) { |
537 |
+ continue; |
538 |
+ } |
539 |
+ |
540 |
+ // Export gets meta straight from the DB so could have a serialized string |
541 |
+ $value = maybe_unserialize( $meta['value'] ); |
542 |
+ |
543 |
+ add_term_meta( $term_id, $key, $value ); |
544 |
+ |
545 |
+ /** |
546 |
+ * Fires after term meta is imported. |
547 |
+ * |
548 |
+ * @since 0.6.2 |
549 |
+ * |
550 |
+ * @param int $term_id ID of the newly created term. |
551 |
+ * @param string $key Meta key. |
552 |
+ * @param mixed $value Meta value. |
553 |
+ */ |
554 |
+ do_action( 'import_term_meta', $term_id, $key, $value ); |
555 |
+ } |
556 |
+ } |
557 |
+ |
558 |
+ /** |
559 |
* Create new posts based on import information |
560 |
* |
561 |
* Posts marked as having a parent which doesn't exist will become top level items. |
562 |
@@ -555,10 +623,26 @@ class WP_Import extends WP_Importer { |
563 |
$post_type_object = get_post_type_object( $post['post_type'] ); |
564 |
|
565 |
$post_exists = post_exists( $post['post_title'], '', $post['post_date'] ); |
566 |
+ |
567 |
+ /** |
568 |
+ * Filter ID of the existing post corresponding to post currently importing. |
569 |
+ * |
570 |
+ * Return 0 to force the post to be imported. Filter the ID to be something else |
571 |
+ * to override which existing post is mapped to the imported post. |
572 |
+ * |
573 |
+ * @see post_exists() |
574 |
+ * @since 0.6.2 |
575 |
+ * |
576 |
+ * @param int $post_exists Post ID, or 0 if post did not exist. |
577 |
+ * @param array $post The post array to be inserted. |
578 |
+ */ |
579 |
+ $post_exists = apply_filters( 'wp_import_existing_post', $post_exists, $post ); |
580 |
+ |
581 |
if ( $post_exists && get_post_type( $post_exists ) == $post['post_type'] ) { |
582 |
printf( __('%s “%s” already exists.', 'wordpress-importer'), $post_type_object->labels->singular_name, esc_html($post['post_title']) ); |
583 |
echo '<br />'; |
584 |
$comment_post_ID = $post_id = $post_exists; |
585 |
+ $this->processed_posts[ intval( $post['post_id'] ) ] = intval( $post_exists ); |
586 |
} else { |
587 |
$post_parent = (int) $post['post_parent']; |
588 |
if ( $post_parent ) { |
589 |
@@ -592,6 +676,8 @@ class WP_Import extends WP_Importer { |
590 |
$original_post_ID = $post['post_id']; |
591 |
$postdata = apply_filters( 'wp_import_post_data_processed', $postdata, $post ); |
592 |
|
593 |
+ $postdata = wp_slash( $postdata ); |
594 |
+ |
595 |
if ( 'attachment' == $postdata['post_type'] ) { |
596 |
$remote_url = ! empty($post['attachment_url']) ? $post['attachment_url'] : $post['guid']; |
597 |
|
598 |
@@ -1107,7 +1193,7 @@ class WP_Import extends WP_Importer { |
599 |
* Added to http_request_timeout filter to force timeout at 60 seconds during import |
600 |
* @return int 60 |
601 |
*/ |
602 |
- function bump_request_timeout() { |
603 |
+ function bump_request_timeout( $val ) { |
604 |
return 60; |
605 |
} |