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