Import any XML or CSV File to WordPress - Version 3.2.6

Version Description

  • Compatibility with 3rd party development: http://www.wpallimport.com/documentation/addon-dev/overview/
Download this release

Release Info

Developer soflyy
Plugin Icon 128x128 Import any XML or CSV File to WordPress
Version 3.2.6
Comparing to
See all releases

Code changes from version 3.2.5 to 3.2.6

Files changed (102) hide show
  1. actions/admin_head.php +0 -0
  2. actions/wp_ajax_auto_detect_cf.php +0 -0
  3. actions/wp_ajax_auto_detect_sf.php +0 -0
  4. actions/wp_ajax_import_failed.php +0 -0
  5. actions/wp_ajax_test_images.php +0 -0
  6. classes/api.php +345 -0
  7. classes/arraytoxml.php +0 -0
  8. classes/chunk.php +0 -0
  9. classes/config.php +0 -0
  10. classes/download.php +0 -0
  11. classes/handler.php +0 -0
  12. classes/helper.php +0 -0
  13. classes/input.php +0 -0
  14. classes/render.php +0 -0
  15. classes/session.php +0 -0
  16. classes/upload.php +0 -0
  17. controllers/admin/addons.php +0 -0
  18. controllers/admin/help.php +0 -0
  19. controllers/admin/history.php +0 -0
  20. controllers/admin/home.php +0 -0
  21. controllers/admin/manage.php +0 -0
  22. controllers/controller.php +0 -0
  23. controllers/controller/admin.php +0 -0
  24. helpers/backward.php +0 -0
  25. helpers/functions.php +0 -0
  26. helpers/get_file_curl.php +0 -0
  27. helpers/get_taxonomies_by_object_type.php +0 -0
  28. helpers/is_exists_term.php +0 -0
  29. helpers/pmxi_findDuplicates.php +0 -0
  30. helpers/pmxi_insert_attachment.php +0 -0
  31. helpers/pmxi_insert_post.php +0 -0
  32. helpers/pmxi_recursion_taxes.php +0 -0
  33. helpers/reverse_taxonomies_html.php +0 -0
  34. helpers/str_getcsv.php +0 -0
  35. helpers/wp_all_import_clear_directory.php +0 -0
  36. helpers/wp_all_import_ctx_mapping.php +0 -0
  37. helpers/wp_all_import_get_feed_type.php +0 -0
  38. helpers/wp_all_import_get_gz.php +0 -0
  39. helpers/wp_all_import_is_json.php +0 -0
  40. helpers/wp_all_import_json_to_xml.php +0 -0
  41. helpers/wp_all_import_rand_char.php +0 -0
  42. helpers/wp_all_import_remove_source.php +0 -0
  43. helpers/wp_all_import_rmdir.php +0 -0
  44. helpers/wp_all_import_secure_file.php +0 -0
  45. helpers/wp_all_import_strip_tags_content.php +0 -0
  46. helpers/wp_all_import_url_title.php +0 -0
  47. helpers/wp_delete_attachments.php +0 -0
  48. helpers/wp_redirect_or_javascript.php +0 -0
  49. helpers/wpai_util_map.php +0 -0
  50. libraries/XmlImportConfig.php +0 -0
  51. libraries/XmlImportCsvParse.php +0 -0
  52. libraries/XmlImportException.php +0 -0
  53. libraries/XmlImportParser.php +0 -0
  54. libraries/XmlImportReaderInterface.php +0 -0
  55. libraries/XmlImportSQLParse.php +0 -0
  56. libraries/XmlImportStringReader.php +0 -0
  57. libraries/XmlImportTemplate.php +0 -0
  58. libraries/XmlImportTemplateCodeGenerator.php +0 -0
  59. libraries/XmlImportTemplateParser.php +0 -0
  60. libraries/XmlImportTemplateScanner.php +0 -0
  61. libraries/XmlImportToken.php +0 -0
  62. libraries/ast/XmlImportAstElseif.php +0 -0
  63. libraries/ast/XmlImportAstExpression.php +0 -0
  64. libraries/ast/XmlImportAstFloat.php +0 -0
  65. libraries/ast/XmlImportAstForeach.php +0 -0
  66. libraries/ast/XmlImportAstFunction.php +0 -0
  67. libraries/ast/XmlImportAstIf.php +0 -0
  68. libraries/ast/XmlImportAstInteger.php +0 -0
  69. libraries/ast/XmlImportAstLiteral.php +0 -0
  70. libraries/ast/XmlImportAstMath.php +0 -0
  71. libraries/ast/XmlImportAstPrint.php +0 -0
  72. libraries/ast/XmlImportAstSequence.php +0 -0
  73. libraries/ast/XmlImportAstSpintax.php +0 -0
  74. libraries/ast/XmlImportAstStatement.php +0 -0
  75. libraries/ast/XmlImportAstString.php +0 -0
  76. libraries/ast/XmlImportAstText.php +0 -0
  77. libraries/ast/XmlImportAstWith.php +0 -0
  78. libraries/ast/XmlImportAstXPath.php +0 -0
  79. libraries/ast/XmlImportAstXpathClause.php +0 -0
  80. libraries/pclzip.lib.php +0 -0
  81. models/file/list.php +0 -0
  82. models/file/record.php +0 -0
  83. models/history/list.php +0 -0
  84. models/history/record.php +0 -0
  85. models/import/list.php +0 -0
  86. models/import/record.php +39 -10
  87. models/model.php +0 -0
  88. models/model/list.php +0 -0
  89. models/model/record.php +0 -0
  90. models/post/list.php +0 -0
  91. models/post/record.php +0 -0
  92. models/template/list.php +0 -0
  93. models/template/record.php +0 -0
  94. plugin.php +2 -2
  95. readme.txt +4 -1
  96. schema.php +1 -1
  97. views/admin/history/index.php +0 -0
  98. views/admin/home/index.php +0 -0
  99. views/admin/manage/bulk.php +0 -0
  100. views/admin/manage/delete.php +0 -0
  101. views/admin/manage/scheduling.php +0 -0
  102. views/admin/manage/update.php +0 -0
actions/admin_head.php CHANGED
File without changes
actions/wp_ajax_auto_detect_cf.php CHANGED
File without changes
actions/wp_ajax_auto_detect_sf.php CHANGED
File without changes
actions/wp_ajax_import_failed.php CHANGED
File without changes
actions/wp_ajax_test_images.php CHANGED
File without changes
classes/api.php ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * API
4
+ *
5
+ * Generates html code for fields
6
+ *
7
+ *
8
+ * @package default
9
+ * @author Max Tsiplyakov
10
+ */
11
+ class PMXI_API
12
+ {
13
+ /**
14
+ * Function for generating html code for fields
15
+ * @param string $field_type simple, enum or textarea
16
+ * @param string $label field label
17
+ * @param array $params contains field params like tooltip, enum_values, mapping, field_name, field_value
18
+ */
19
+ public static function add_field( $field_type = 'simple', $label = '', $params = array()){
20
+
21
+ $params += array(
22
+ 'tooltip' => '',
23
+ 'enum_values' => array(),
24
+ 'mapping' => false,
25
+ 'field_key' => '',
26
+ 'mapping_rules' => array(),
27
+ 'xpath' => '',
28
+ 'field_name' => '',
29
+ 'field_value' => '',
30
+ 'addon_prefix' => ''
31
+ );
32
+
33
+ ob_start();
34
+ if ($label != ""){
35
+ ?>
36
+ <label for="<?php echo sanitize_title($params['field_name']); ?>"><?php echo $label;?></label>
37
+ <?php
38
+ }
39
+ if ( ! empty($params['tooltip'])){
40
+ ?>
41
+ <a href="#help" class="wpallimport-help" title="<?php echo $params['tooltip']; ?>" style="position: relative; top: -2px;">?</a>
42
+ <?php
43
+ }
44
+ ?>
45
+ <div class="input">
46
+ <?php
47
+ switch ($field_type){
48
+ case 'simple':
49
+ ?>
50
+ <input type="text" name="<?php echo $params['field_name']; ?>" id="<?php echo sanitize_title($params['field_name']); ?>" value="<?php echo $params['field_value']; ?>" style="width:100%;"/>
51
+ <?php
52
+ break;
53
+ case 'enum':
54
+ ?>
55
+
56
+ <?php foreach ($params['enum_values'] as $key => $value):?>
57
+ <div class="form-field wpallimport-radio-field">
58
+ <input type="radio" id="<?php echo sanitize_title($params['field_name']); ?>_<?php echo $key; ?>" class="switcher" name="<?php echo $params['field_name']; ?>" value="<?php echo $key; ?>" <?php echo $key == $params['field_value'] ? 'checked="checked"': '' ?>/>
59
+ <label for="<?php echo sanitize_title($params['field_name']); ?>_<?php echo $key; ?>"><?php echo $value; ?></label>
60
+ </div>
61
+ <?php endforeach;?>
62
+ <div class="form-field wpallimport-radio-field">
63
+ <input type="radio" id="<?php echo sanitize_title($params['field_name']); ?>_xpath" class="switcher" name="<?php echo $params['field_name']; ?>" value="xpath" <?php echo 'xpath' == $params['field_value'] ? 'checked="checked"': '' ?>/>
64
+ <label for="<?php echo sanitize_title($params['field_name']); ?>_xpath"><?php _e('Set with XPath', 'wp_all_import_plugin' )?></label>
65
+ <span class="wpallimport-clear"></span>
66
+ <div class="switcher-target-<?php echo sanitize_title($params['field_name']); ?>_xpath set_with_xpath">
67
+ <span class="wpallimport-slide-content" style="padding-left:0px;">
68
+ <table class="form-table custom-params" style="max-width:none; border:none;">
69
+ <tr class="form-field">
70
+ <td class="wpallimport-enum-input-wrapper">
71
+ <input type="text" class="smaller-text" name="<?php echo $params['addon_prefix'];?>[xpaths][<?php echo $params['field_key']; ?>]" value="<?php echo esc_attr($params['xpath']) ?>"/>
72
+ </td>
73
+ <td class="action">
74
+ <?php if ($params['mapping']): ?>
75
+
76
+ <?php $custom_mapping_rules = (!empty($params['mapping_rules'])) ? json_decode($params['mapping_rules'], true) : false; ?>
77
+
78
+ <div class="input wpallimport-custom-fields-actions">
79
+ <a href="javascript:void(0);" class="wpallimport-cf-options"><?php _e('Field Options...', 'wp_all_import_plugin'); ?></a>
80
+ <ul id="wpallimport-cf-menu-<?php echo sanitize_title($params['field_name']);?>" class="wpallimport-cf-menu">
81
+ <li class="<?php echo ( ! empty($custom_mapping_rules) ) ? 'active' : ''; ?>">
82
+ <a href="javascript:void(0);" class="set_mapping pmxi_cf_mapping" rel="cf_mapping_<?php echo sanitize_title($params['field_name']); ?>"><?php _e('Mapping', 'wp_all_import_plugin'); ?></a>
83
+ </li>
84
+ </ul>
85
+ </div>
86
+ <div id="cf_mapping_<?php echo sanitize_title($params['field_name']); ?>" class="custom_type" rel="mapping" style="display:none;">
87
+ <fieldset>
88
+ <table cellpadding="0" cellspacing="5" class="cf-form-table" rel="cf_mapping_<?php echo sanitize_title($params['field_name']); ?>">
89
+ <thead>
90
+ <tr>
91
+ <td><?php _e('In Your File', 'wp_all_import_plugin') ?></td>
92
+ <td><?php _e('Translated To', 'wp_all_import_plugin') ?></td>
93
+ <td>&nbsp;</td>
94
+ </tr>
95
+ </thead>
96
+ <tbody>
97
+ <?php
98
+ if ( ! empty($custom_mapping_rules) and is_array($custom_mapping_rules)){
99
+
100
+ foreach ($custom_mapping_rules as $key => $value) {
101
+
102
+ $k = $key;
103
+
104
+ if (is_array($value)){
105
+ $keys = array_keys($value);
106
+ $k = $keys[0];
107
+ }
108
+
109
+ ?>
110
+ <tr class="form-field">
111
+ <td>
112
+ <input type="text" class="mapping_from widefat" value="<?php echo esc_textarea($k); ?>">
113
+ </td>
114
+ <td>
115
+ <input type="text" class="mapping_to widefat" value="<?php echo esc_textarea((is_array($value)) ? $value[$k] : $value); ?>">
116
+ </td>
117
+ <td class="action remove">
118
+ <a href="#remove" style="right:-10px;"></a>
119
+ </td>
120
+ </tr>
121
+ <?php
122
+ }
123
+ }
124
+ else{
125
+ if ( ! empty($params['enum_values']) and is_array($params['enum_values'])){
126
+ foreach ($params['enum_values'] as $key => $value){
127
+ ?>
128
+ <tr class="form-field">
129
+ <td>
130
+ <input type="text" class="mapping_from widefat">
131
+ </td>
132
+ <td>
133
+ <input type="text" class="mapping_to widefat" value="<?php echo $key; ?>">
134
+ </td>
135
+ <td class="action remove">
136
+ <a href="#remove" style="right:-10px;"></a>
137
+ </td>
138
+ </tr>
139
+ <?php
140
+ }
141
+ } else {
142
+ ?>
143
+ <tr class="form-field">
144
+ <td>
145
+ <input type="text" class="mapping_from widefat">
146
+ </td>
147
+ <td>
148
+ <input type="text" class="mapping_to widefat">
149
+ </td>
150
+ <td class="action remove">
151
+ <a href="#remove" style="right:-10px;"></a>
152
+ </td>
153
+ </tr>
154
+ <?php
155
+ }
156
+ }
157
+ ?>
158
+ <tr class="form-field template">
159
+ <td>
160
+ <input type="text" class="mapping_from widefat">
161
+ </td>
162
+ <td>
163
+ <input type="text" class="mapping_to widefat">
164
+ </td>
165
+ <td class="action remove">
166
+ <a href="#remove" style="right:-10px;"></a>
167
+ </td>
168
+ </tr>
169
+ <tr>
170
+ <td colspan="3">
171
+ <a href="javascript:void(0);" title="<?php _e('Add Another', 'wp_all_import_plugin')?>" class="action add-new-key add-new-entry"><?php _e('Add Another', 'wp_all_import_plugin') ?></a>
172
+ </td>
173
+ </tr>
174
+ <tr>
175
+ <td colspan="3">
176
+ <div class="wrap" style="position:relative;">
177
+ <a class="save_popup save_mr" href="javascript:void(0);"><?php _e('Save Rules', 'wp_all_import_plugin'); ?></a>
178
+ </div>
179
+ </td>
180
+ </tr>
181
+ </tbody>
182
+ </table>
183
+ <input type="hidden" class="pmre_mapping_rules" name="<?php echo $params['addon_prefix'];?>[mapping][<?php echo $params['field_key']; ?>]" value="<?php if (!empty($params['mapping_rules'])) echo esc_html($params['mapping_rules']); ?>"/>
184
+ </fieldset>
185
+ </div>
186
+ <?php endif; ?>
187
+ </td>
188
+ </tr>
189
+ </table>
190
+ </span>
191
+ </div>
192
+ </div>
193
+ <?php
194
+ break;
195
+ case 'textarea':
196
+ ?>
197
+ <textarea name="<?php echo $params['field_name']; ?>" id="<?php echo sanitize_title($params['field_name']); ?>" class="rad4 newline" style="height: 70px;margin: 5px 0;padding-top: 5px;width: 70%;"><?php echo $params['field_value']; ?></textarea>
198
+ <?php
199
+ break;
200
+ case 'image':
201
+ ?>
202
+ <div class="input">
203
+ <div class="input" style="margin: 0px;">
204
+ <input type="radio" name="<?php echo $params['addon_prefix'];?>[download_image][<?php echo $params['field_key'];?>]" value="yes" id="<?php echo sanitize_title($params['field_name']); ?>_yes" <?php echo ("yes" == $params['download_image']) ? 'checked="checked"' : '';?>/>
205
+ <label for="<?php echo sanitize_title($params['field_name']); ?>_yes"><?php _e('Download image hosted elsewhere'); ?></label>
206
+ <a href="#help" class="wpallimport-help" title="<?php _e('http:// or https://', 'wp_all_import_plugin') ?>" style="position: relative; top: -2px;">?</a>
207
+ </div>
208
+ <div class="input" style="margin: 0px;">
209
+ <?php $wp_uploads = wp_upload_dir(); ?>
210
+ <input type="radio" name="<?php echo $params['addon_prefix'];?>[download_image][<?php echo $params['field_key'];?>]" value="no" id="<?php echo sanitize_title($params['field_name']); ?>_no" <?php echo ("yes" != $params['download_image']) ? 'checked="checked"' : '';?>/>
211
+ <label for="<?php echo sanitize_title($params['field_name']); ?>_no"><?php printf(__('Use image(s) currently uploaded in %s', 'wp_all_import_plugin'), $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY . DIRECTORY_SEPARATOR); ?></label>
212
+ </div>
213
+ <div class="input">
214
+ <input type="text" name="<?php echo $params['field_name']; ?>" style="width:100%;" placeholder="" value="<?php echo esc_attr($params['field_value']); ?>"/>
215
+ </div>
216
+ </div>
217
+ <?php
218
+ break;
219
+ }
220
+ ?>
221
+ </div>
222
+ <?php
223
+ echo ob_get_clean();
224
+ }
225
+
226
+ public static function upload_image($pid, $img_url, $download_images, $logger, $create_image = false, $image_name = ""){
227
+
228
+ $url = str_replace(" ", "%20", trim($img_url));
229
+ $bn = preg_replace('/[\\?|&].*/', '', basename($url));
230
+
231
+ if ($image_name == ""){
232
+ $img_ext = pmxi_getExtensionFromStr($url);
233
+ $default_extension = pmxi_getExtension($bn);
234
+ if ($img_ext == "") $img_ext = pmxi_get_remote_image_ext($url);
235
+ $image_name = urldecode(sanitize_file_name(($img_ext) ? str_replace("." . $default_extension, "", $bn) : $bn)) . (("" != $img_ext) ? '.' . $img_ext : '');
236
+ }
237
+
238
+ $uploads = wp_upload_dir();
239
+ $targetDir = $uploads['path'];
240
+ $targetUrl = $uploads['url'];
241
+ $download_image = true;
242
+ $result = false;
243
+
244
+ global $wpdb;
245
+
246
+ $attch = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->posts . " WHERE (post_title = %s OR post_title = %s) AND post_type = %s;", $image_name, preg_replace('/\\.[^.\\s]{3,4}$/', '', $image_name), "attachment" ) );
247
+
248
+ if ( $attch != null ){
249
+
250
+ return $attch->ID;
251
+
252
+ }
253
+
254
+ $image_filename = wp_unique_filename($targetDir, $image_name);
255
+ $image_filepath = $targetDir . '/' . $image_filename;
256
+
257
+ // do not download images
258
+ if ( "yes" != $download_images ){
259
+
260
+ $image_filename = $image_name;
261
+ $image_filepath = $targetDir . '/' . $image_filename;
262
+
263
+ $wpai_uploads = $uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY . DIRECTORY_SEPARATOR;
264
+ $wpai_image_path = $wpai_uploads . str_replace('%20', ' ', $url);
265
+
266
+ $logger and call_user_func($logger, sprintf(__('- Searching for existing image `%s` in `%s` folder', 'wp_all_import_plugin'), $wpai_image_path, $wpai_uploads));
267
+
268
+ if ( @file_exists($wpai_image_path) and @copy( $wpai_image_path, $image_filepath )){
269
+ $download_image = false;
270
+ if( ! ($image_info = @getimagesize($image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
271
+ $logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'wp_all_import_plugin'), $image_filepath));
272
+ @unlink($image_filepath);
273
+ } else {
274
+ $logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully founded', 'wp_all_import_plugin'), $wpai_image_path));
275
+ $result = true;
276
+ }
277
+ }
278
+ }
279
+
280
+ if ($download_image){
281
+
282
+ $logger and call_user_func($logger, sprintf(__('- Downloading image from `%s`', 'wp_all_import_plugin'), $url));
283
+
284
+ $request = get_file_curl($url, $image_filepath);
285
+
286
+ if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($url))) {
287
+ @unlink($image_filepath); // delete file since failed upload may result in empty file created
288
+ } elseif( ($image_info = @getimagesize($image_filepath)) and in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
289
+ $logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
290
+ $result = true;
291
+ }
292
+
293
+ if (!$result){
294
+ $url = str_replace(" ", "%20", trim(pmxi_convert_encoding($img_url)));
295
+
296
+ $request = get_file_curl($url, $image_filepath);
297
+
298
+ if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($url))) {
299
+ $logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s cannot be saved locally as %s', 'wp_all_import_plugin'), $url, $image_filepath));
300
+ @unlink($image_filepath); // delete file since failed upload may result in empty file created
301
+ } elseif( ! ($image_info = @getimagesize($image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
302
+ $logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'wp_all_import_plugin'), $url));
303
+ @unlink($image_filepath);
304
+ } else {
305
+ $logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
306
+ $result = true;
307
+ }
308
+ }
309
+ }
310
+
311
+ if ($create_image and $result){
312
+
313
+ $logger and call_user_func($logger, sprintf(__('- Creating an attachment for image `%s`', 'wp_all_import_plugin'), $targetUrl . '/' . $image_filename));
314
+
315
+ $attachment = array(
316
+ 'post_mime_type' => image_type_to_mime_type($image_info[2]),
317
+ 'guid' => $targetUrl . '/' . $image_filename,
318
+ 'post_title' => $image_filename,
319
+ 'post_content' => '',
320
+ );
321
+ if (($image_meta = wp_read_image_metadata($image_filepath))) {
322
+ if (trim($image_meta['title']) && ! is_numeric(sanitize_title($image_meta['title'])))
323
+ $attachment['post_title'] = $image_meta['title'];
324
+ if (trim($image_meta['caption']))
325
+ $attachment['post_content'] = $image_meta['caption'];
326
+ }
327
+
328
+ $attid = wp_insert_attachment($attachment, $image_filepath, $pid);
329
+
330
+ if (is_wp_error($attid)) {
331
+ $logger and call_user_func($logger, __('- <b>WARNING</b>', 'wp_all_import_plugin') . ': ' . $attid->get_error_message());
332
+ return false;
333
+ } else {
334
+ // you must first include the image.php file
335
+ // for the function wp_generate_attachment_metadata() to work
336
+ require_once(ABSPATH . 'wp-admin/includes/image.php');
337
+ wp_update_attachment_metadata($attid, wp_generate_attachment_metadata($attid, $image_filepath));
338
+ $logger and call_user_func($logger, sprintf(__('- Attachment has been successfully created for image `%s`', 'wp_all_import_plugin'), $targetUrl . '/' . $image_filename));
339
+ return $attid;
340
+ }
341
+
342
+ }
343
+ else return $result;
344
+ }
345
+ }
classes/arraytoxml.php CHANGED
File without changes
classes/chunk.php CHANGED
File without changes
classes/config.php CHANGED
File without changes
classes/download.php CHANGED
File without changes
classes/handler.php CHANGED
File without changes
classes/helper.php CHANGED
File without changes
classes/input.php CHANGED
File without changes
classes/render.php CHANGED
File without changes
classes/session.php CHANGED
File without changes
classes/upload.php CHANGED
File without changes
controllers/admin/addons.php CHANGED
File without changes
controllers/admin/help.php CHANGED
File without changes
controllers/admin/history.php CHANGED
File without changes
controllers/admin/home.php CHANGED
File without changes
controllers/admin/manage.php CHANGED
File without changes
controllers/controller.php CHANGED
File without changes
controllers/controller/admin.php CHANGED
File without changes
helpers/backward.php CHANGED
File without changes
helpers/functions.php CHANGED
File without changes
helpers/get_file_curl.php CHANGED
File without changes
helpers/get_taxonomies_by_object_type.php CHANGED
File without changes
helpers/is_exists_term.php CHANGED
File without changes
helpers/pmxi_findDuplicates.php CHANGED
File without changes
helpers/pmxi_insert_attachment.php CHANGED
File without changes
helpers/pmxi_insert_post.php CHANGED
File without changes
helpers/pmxi_recursion_taxes.php CHANGED
File without changes
helpers/reverse_taxonomies_html.php CHANGED
File without changes
helpers/str_getcsv.php CHANGED
File without changes
helpers/wp_all_import_clear_directory.php CHANGED
File without changes
helpers/wp_all_import_ctx_mapping.php CHANGED
File without changes
helpers/wp_all_import_get_feed_type.php CHANGED
File without changes
helpers/wp_all_import_get_gz.php CHANGED
File without changes
helpers/wp_all_import_is_json.php CHANGED
File without changes
helpers/wp_all_import_json_to_xml.php CHANGED
File without changes
helpers/wp_all_import_rand_char.php CHANGED
File without changes
helpers/wp_all_import_remove_source.php CHANGED
File without changes
helpers/wp_all_import_rmdir.php CHANGED
File without changes
helpers/wp_all_import_secure_file.php CHANGED
File without changes
helpers/wp_all_import_strip_tags_content.php CHANGED
File without changes
helpers/wp_all_import_url_title.php CHANGED
File without changes
helpers/wp_delete_attachments.php CHANGED
File without changes
helpers/wp_redirect_or_javascript.php CHANGED
File without changes
helpers/wpai_util_map.php CHANGED
File without changes
libraries/XmlImportConfig.php CHANGED
File without changes
libraries/XmlImportCsvParse.php CHANGED
File without changes
libraries/XmlImportException.php CHANGED
File without changes
libraries/XmlImportParser.php CHANGED
File without changes
libraries/XmlImportReaderInterface.php CHANGED
File without changes
libraries/XmlImportSQLParse.php CHANGED
File without changes
libraries/XmlImportStringReader.php CHANGED
File without changes
libraries/XmlImportTemplate.php CHANGED
File without changes
libraries/XmlImportTemplateCodeGenerator.php CHANGED
File without changes
libraries/XmlImportTemplateParser.php CHANGED
File without changes
libraries/XmlImportTemplateScanner.php CHANGED
File without changes
libraries/XmlImportToken.php CHANGED
File without changes
libraries/ast/XmlImportAstElseif.php CHANGED
File without changes
libraries/ast/XmlImportAstExpression.php CHANGED
File without changes
libraries/ast/XmlImportAstFloat.php CHANGED
File without changes
libraries/ast/XmlImportAstForeach.php CHANGED
File without changes
libraries/ast/XmlImportAstFunction.php CHANGED
File without changes
libraries/ast/XmlImportAstIf.php CHANGED
File without changes
libraries/ast/XmlImportAstInteger.php CHANGED
File without changes
libraries/ast/XmlImportAstLiteral.php CHANGED
File without changes
libraries/ast/XmlImportAstMath.php CHANGED
File without changes
libraries/ast/XmlImportAstPrint.php CHANGED
File without changes
libraries/ast/XmlImportAstSequence.php CHANGED
File without changes
libraries/ast/XmlImportAstSpintax.php CHANGED
File without changes
libraries/ast/XmlImportAstStatement.php CHANGED
File without changes
libraries/ast/XmlImportAstString.php CHANGED
File without changes
libraries/ast/XmlImportAstText.php CHANGED
File without changes
libraries/ast/XmlImportAstWith.php CHANGED
File without changes
libraries/ast/XmlImportAstXPath.php CHANGED
File without changes
libraries/ast/XmlImportAstXpathClause.php CHANGED
File without changes
libraries/pclzip.lib.php CHANGED
File without changes
models/file/list.php CHANGED
File without changes
models/file/record.php CHANGED
File without changes
models/history/list.php CHANGED
File without changes
models/history/record.php CHANGED
File without changes
models/import/list.php CHANGED
File without changes
models/import/record.php CHANGED
@@ -634,16 +634,25 @@ class PMXI_Import_Record extends PMXI_Model_Record {
634
  'logger' => $logger,
635
  'chunk' => $chunk,
636
  'xpath_prefix' => $xpath_prefix
637
- );
 
 
 
638
  foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
639
  $model_class = str_replace("_Plugin", "_Import_Record", $class);
640
  if (class_exists($model_class)){
641
  $addons[$class] = new $model_class();
642
  $addons_data[$class] = ( method_exists($addons[$class], 'parse') ) ? $addons[$class]->parse($parsingData) : false;
643
  }
644
- else{
645
- $parse_func = $class . '_parse';
646
- if (function_exists($parse_func)) $addons_data[$class] = call_user_func($parse_func, $parsingData);
 
 
 
 
 
 
647
  }
648
  }
649
 
@@ -1090,14 +1099,24 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1090
  'xpath_prefix' => $xpath_prefix
1091
  );
1092
 
 
 
1093
  // deligate operation to addons
1094
  foreach (PMXI_Admin_Addons::get_active_addons() as $class){
1095
  if (class_exists($class)){
1096
  if ( method_exists($addons[$class], 'import') ) $addons[$class]->import($importData);
1097
  }
1098
- else{
1099
- $import_func = $class . '_import';
1100
- if (function_exists($import_func)) call_user_func($import_func, $importData, $addons_data[$class]);
 
 
 
 
 
 
 
 
1101
  }
1102
  }
1103
 
@@ -1670,14 +1689,24 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1670
  'logger' => $logger
1671
  );
1672
 
 
 
1673
  // deligate operation to addons
1674
  foreach (PMXI_Admin_Addons::get_active_addons() as $class){
1675
  if (class_exists($class)){
1676
  if ( method_exists($addons[$class], 'saved_post') ) $addons[$class]->saved_post($importData);
1677
  }
1678
- else{
1679
- $saved_func = $class . '_saved_post';
1680
- if (function_exists($saved_func)) call_user_func($saved_func, $importData);
 
 
 
 
 
 
 
 
1681
  }
1682
  }
1683
 
634
  'logger' => $logger,
635
  'chunk' => $chunk,
636
  'xpath_prefix' => $xpath_prefix
637
+ );
638
+
639
+ $parse_functions = apply_filters('wp_all_import_addon_parse', array());
640
+
641
  foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
642
  $model_class = str_replace("_Plugin", "_Import_Record", $class);
643
  if (class_exists($model_class)){
644
  $addons[$class] = new $model_class();
645
  $addons_data[$class] = ( method_exists($addons[$class], 'parse') ) ? $addons[$class]->parse($parsingData) : false;
646
  }
647
+ else{
648
+ if ( ! empty($parse_functions[$class]) ){
649
+
650
+ if ( is_array($parse_functions[$class]) and is_callable($parse_functions[$class]) or ! is_array($parse_functions[$class]) and function_exists($parse_functions[$class]) ){
651
+
652
+ $addons_data[$class] = call_user_func($parse_functions[$class], $parsingData);
653
+ }
654
+
655
+ }
656
  }
657
  }
658
 
1099
  'xpath_prefix' => $xpath_prefix
1100
  );
1101
 
1102
+ $import_functions = apply_filters('wp_all_import_addon_import', array());
1103
+
1104
  // deligate operation to addons
1105
  foreach (PMXI_Admin_Addons::get_active_addons() as $class){
1106
  if (class_exists($class)){
1107
  if ( method_exists($addons[$class], 'import') ) $addons[$class]->import($importData);
1108
  }
1109
+ else{
1110
+
1111
+ if ( ! empty($import_functions[$class]) ){
1112
+
1113
+ if ( is_array($import_functions[$class]) and is_callable($import_functions[$class]) or ! is_array($import_functions[$class]) and function_exists($import_functions[$class]) ){
1114
+
1115
+ call_user_func($import_functions[$class], $importData, $addons_data[$class]);
1116
+ }
1117
+
1118
+ }
1119
+
1120
  }
1121
  }
1122
 
1689
  'logger' => $logger
1690
  );
1691
 
1692
+ $saved_functions = apply_filters('wp_all_import_addon_saved_post', array());
1693
+
1694
  // deligate operation to addons
1695
  foreach (PMXI_Admin_Addons::get_active_addons() as $class){
1696
  if (class_exists($class)){
1697
  if ( method_exists($addons[$class], 'saved_post') ) $addons[$class]->saved_post($importData);
1698
  }
1699
+ else{
1700
+
1701
+ if ( ! empty($saved_functions[$class]) ){
1702
+
1703
+ if ( is_array($saved_functions[$class]) and is_callable($saved_functions[$class]) or ! is_array($saved_functions[$class]) and function_exists($saved_functions[$class]) ){
1704
+
1705
+ call_user_func($saved_functions[$class], $importData);
1706
+ }
1707
+
1708
+ }
1709
+
1710
  }
1711
  }
1712
 
models/model.php CHANGED
File without changes
models/model/list.php CHANGED
File without changes
models/model/record.php CHANGED
File without changes
models/post/list.php CHANGED
File without changes
models/post/record.php CHANGED
File without changes
models/template/list.php CHANGED
File without changes
models/template/record.php CHANGED
File without changes
plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP All Import
4
  Plugin URI: http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=plugins-page&utm_campaign=free+plugin
5
  Description: The most powerful solution for importing XML and CSV files to WordPress. Create Posts and Pages with content from any XML or CSV file. A paid upgrade to WP All Import Pro is available for support and additional features.
6
- Version: 3.2.5
7
  Author: Soflyy
8
  */
9
 
@@ -25,7 +25,7 @@ define('WP_ALL_IMPORT_ROOT_URL', rtrim(plugin_dir_url(__FILE__), '/'));
25
  */
26
  define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
27
 
28
- define('PMXI_VERSION', '3.2.5');
29
 
30
  define('PMXI_EDITION', 'free');
31
 
3
  Plugin Name: WP All Import
4
  Plugin URI: http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=plugins-page&utm_campaign=free+plugin
5
  Description: The most powerful solution for importing XML and CSV files to WordPress. Create Posts and Pages with content from any XML or CSV file. A paid upgrade to WP All Import Pro is available for support and additional features.
6
+ Version: 3.2.6
7
  Author: Soflyy
8
  */
9
 
25
  */
26
  define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
27
 
28
+ define('PMXI_VERSION', '3.2.6');
29
 
30
  define('PMXI_EDITION', 'free');
31
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 3.6.1
4
  Tested up to: 4.1
5
- Stable tag: 3.2.5
6
  Tags: wordpress csv import, wordpress xml import, xml, csv, datafeed, import, migrate, import csv to wordpress, import xml to wordpress, advanced xml import, advanced csv import, bulk csv import, bulk xml import, bulk data import, xml to custom post type, csv to custom post type, woocommerce csv import, woocommerce xml import, csv import, import csv, xml import, import xml, csv importer
7
 
8
  WP All Import is an extremely powerful importer that makes it easy to import any XML or CSV file to WordPress.
@@ -103,6 +103,9 @@ Does it work with special character encoding like Hebrew, Arabic, Chinese, etc?
103
 
104
  == Changelog ==
105
 
 
 
 
106
  = 3.2.5 =
107
  * Important security fixes - additional hardening, prevention of blind SQL injection and reflected XSS attacks
108
 
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 3.6.1
4
  Tested up to: 4.1
5
+ Stable tag: 3.2.6
6
  Tags: wordpress csv import, wordpress xml import, xml, csv, datafeed, import, migrate, import csv to wordpress, import xml to wordpress, advanced xml import, advanced csv import, bulk csv import, bulk xml import, bulk data import, xml to custom post type, csv to custom post type, woocommerce csv import, woocommerce xml import, csv import, import csv, xml import, import xml, csv importer
7
 
8
  WP All Import is an extremely powerful importer that makes it easy to import any XML or CSV file to WordPress.
103
 
104
  == Changelog ==
105
 
106
+ = 3.2.6 =
107
+ * Compatibility with 3rd party development: http://www.wpallimport.com/documentation/addon-dev/overview/
108
+
109
  = 3.2.5 =
110
  * Important security fixes - additional hardening, prevention of blind SQL injection and reflected XSS attacks
111
 
schema.php CHANGED
@@ -47,7 +47,7 @@ CREATE TABLE {$table_prefix}imports (
47
  feed_type ENUM('xml','csv','zip','gz','') NOT NULL DEFAULT '',
48
  path TEXT,
49
  xpath TEXT,
50
- options TEXT,
51
  registered_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
52
  root_element VARCHAR(255) DEFAULT '',
53
  processing BOOL NOT NULL DEFAULT 0,
47
  feed_type ENUM('xml','csv','zip','gz','') NOT NULL DEFAULT '',
48
  path TEXT,
49
  xpath TEXT,
50
+ options LONGTEXT,
51
  registered_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
52
  root_element VARCHAR(255) DEFAULT '',
53
  processing BOOL NOT NULL DEFAULT 0,
views/admin/history/index.php CHANGED
File without changes
views/admin/home/index.php CHANGED
File without changes
views/admin/manage/bulk.php CHANGED
File without changes
views/admin/manage/delete.php CHANGED
File without changes
views/admin/manage/scheduling.php CHANGED
File without changes
views/admin/manage/update.php CHANGED
File without changes