Import any XML or CSV File to WordPress - Version 3.3.2

Version Description

  • fixed fatal error on saving settings
Download this release

Release Info

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

Code changes from version 3.3.1 to 3.3.2

controllers/admin/import.php CHANGED
@@ -1723,7 +1723,11 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1723
  if ('' == $post['custom_duplicate_value'])
1724
  $this->errors->add('form-validation', __('Custom field value must be specified.', 'wp_all_import_plugin'));
1725
  }
1726
-
 
 
 
 
1727
  // Categories/taxonomies logic
1728
  if ($post['update_categories_logic'] == 'only' and ! empty($post['taxonomies_only_list'])){
1729
  $post['taxonomies_list'] = explode(",", $post['taxonomies_only_list']);
1723
  if ('' == $post['custom_duplicate_value'])
1724
  $this->errors->add('form-validation', __('Custom field value must be specified.', 'wp_all_import_plugin'));
1725
  }
1726
+ if ( 'manual' == $post['duplicate_matching'] and 'pid' == $post['duplicate_indicator']){
1727
+ if ('' == $post['pid_xpath'])
1728
+ $this->errors->add('form-validation', __('Post ID must be specified.', 'wp_all_import_plugin'));
1729
+ }
1730
+
1731
  // Categories/taxonomies logic
1732
  if ($post['update_categories_logic'] == 'only' and ! empty($post['taxonomies_only_list'])){
1733
  $post['taxonomies_list'] = explode(",", $post['taxonomies_only_list']);
controllers/admin/manage.php CHANGED
@@ -226,7 +226,7 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
226
 
227
  if ( in_array($item->type, array('upload'))){ // retrieve already uploaded file
228
 
229
- $uploader = new PMXI_Upload(trim($item->path), $this->errors, rtrim(str_replace(basename($item->path), '', $item->path), '/'));
230
  $upload_result = $uploader->upload();
231
  if ($upload_result instanceof WP_Error)
232
  $this->errors = $upload_result;
226
 
227
  if ( in_array($item->type, array('upload'))){ // retrieve already uploaded file
228
 
229
+ $uploader = new PMXI_Upload(trim($item->path), $this->errors, rtrim(str_replace(basename($item->path), '', wp_all_import_get_absolute_path($item->path)), '/'));
230
  $upload_result = $uploader->upload();
231
  if ($upload_result instanceof WP_Error)
232
  $this->errors = $upload_result;
controllers/admin/settings.php CHANGED
@@ -40,18 +40,7 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
40
 
41
  public function index() {
42
 
43
- $this->data['post'] = $post = $this->input->post(PMXI_Plugin::getInstance()->getOption());
44
-
45
- /*$addons = new PMXI_Admin_Addons();
46
-
47
- $this->data['addons'] = $addons->get_premium_addons();*/
48
-
49
- $this->data['addons']['PMXI_Plugin'] = array(
50
- 'title' => __('WP All Import', 'wp_all_import_plugin'),
51
- 'active' => (class_exists('PMXI_Plugin') and defined('PMXI_EDITION') and PMXI_EDITION == 'paid')
52
- );
53
-
54
- $this->data['addons'] = array_reverse($this->data['addons']);
55
 
56
  if ($this->input->post('is_settings_submitted')) { // save settings form
57
  check_admin_referer('edit-settings', '_wpnonce_edit-settings');
40
 
41
  public function index() {
42
 
43
+ $this->data['post'] = $post = $this->input->post(PMXI_Plugin::getInstance()->getOption());
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  if ($this->input->post('is_settings_submitted')) { // save settings form
46
  check_admin_referer('edit-settings', '_wpnonce_edit-settings');
models/import/record.php CHANGED
@@ -909,21 +909,26 @@ class PMXI_Import_Record extends PMXI_Model_Record {
909
  }
910
 
911
  $logger and call_user_func($logger, sprintf(__('Find corresponding article among database for post `%s`...', 'wp_all_import_plugin'), $articleData['post_title']));
 
 
 
 
912
  // handle duplicates according to import settings
913
- if ($duplicates = pmxi_findDuplicates($articleData, $custom_duplicate_name[$i], $custom_duplicate_value[$i], $this->options['duplicate_indicator'])) {
914
- $duplicate_id = array_shift($duplicates);
915
- if ($duplicate_id) {
916
- $logger and call_user_func($logger, sprintf(__('Duplicate post was found for post `%s`...', 'wp_all_import_plugin'), $articleData['post_title']));
917
- if ( $this->options['custom_type'] == 'import_users'){
918
- $post_to_update = get_user_by('id', $post_to_update_id = $duplicate_id);
919
- }
920
- else{
921
- $post_to_update = get_post($post_to_update_id = $duplicate_id);
922
- }
923
- }
924
  else{
925
- $logger and call_user_func($logger, sprintf(__('Duplicate post wasn\'n found for post `%s`...', 'wp_all_import_plugin'), $articleData['post_title']));
926
- }
 
 
 
927
  }
928
  }
929
 
@@ -1027,6 +1032,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1027
  $articleData['post_name'] = $post_to_update->post_name;
1028
  $logger and call_user_func($logger, sprintf(__('Preserve slug of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1029
  }
 
 
 
 
1030
  if ( ! $this->options['is_update_excerpt']){
1031
  $articleData['post_excerpt'] = $post_to_update->post_excerpt;
1032
  $logger and call_user_func($logger, sprintf(__('Preserve excerpt of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
@@ -1039,6 +1048,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1039
  $articleData['post_parent'] = $post_to_update->post_parent;
1040
  $logger and call_user_func($logger, sprintf(__('Preserve post parent of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1041
  }
 
 
 
 
1042
  if ( ! $this->options['is_update_author']){
1043
  $articleData['post_author'] = $post_to_update->post_author;
1044
  $logger and call_user_func($logger, sprintf(__('Preserve post author of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
909
  }
910
 
911
  $logger and call_user_func($logger, sprintf(__('Find corresponding article among database for post `%s`...', 'wp_all_import_plugin'), $articleData['post_title']));
912
+
913
+ if ('pid' == $this->options['duplicate_indicator']) {
914
+ $duplicate_id = $post_ids[$i];
915
+ }
916
  // handle duplicates according to import settings
917
+ elseif ($duplicates = pmxi_findDuplicates($articleData, $custom_duplicate_name[$i], $custom_duplicate_value[$i], $this->options['duplicate_indicator'])) {
918
+ $duplicate_id = array_shift($duplicates);
919
+ }
920
+
921
+ if ( ! empty($duplicate_id)) {
922
+ $logger and call_user_func($logger, sprintf(__('Duplicate post was found for post `%s`...', 'wp_all_import_plugin'), $articleData['post_title']));
923
+ if ( $this->options['custom_type'] == 'import_users'){
924
+ $post_to_update = get_user_by('id', $post_to_update_id = $duplicate_id);
925
+ }
 
 
926
  else{
927
+ $post_to_update = get_post($post_to_update_id = $duplicate_id);
928
+ }
929
+ }
930
+ else{
931
+ $logger and call_user_func($logger, sprintf(__('Duplicate post wasn\'n found for post `%s`...', 'wp_all_import_plugin'), $articleData['post_title']));
932
  }
933
  }
934
 
1032
  $articleData['post_name'] = $post_to_update->post_name;
1033
  $logger and call_user_func($logger, sprintf(__('Preserve slug of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1034
  }
1035
+ elseif( ! empty($articleData['post_name']) and $articleData['post_name'] != $post_to_update->post_name)
1036
+ {
1037
+ update_post_meta($pid, '_wp_old_slug', $post_to_update->post_name);
1038
+ }
1039
  if ( ! $this->options['is_update_excerpt']){
1040
  $articleData['post_excerpt'] = $post_to_update->post_excerpt;
1041
  $logger and call_user_func($logger, sprintf(__('Preserve excerpt of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1048
  $articleData['post_parent'] = $post_to_update->post_parent;
1049
  $logger and call_user_func($logger, sprintf(__('Preserve post parent of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1050
  }
1051
+ if ( ! $this->options['is_update_comment_status']){
1052
+ $articleData['comment_status'] = $post_to_update->comment_status;
1053
+ $logger and call_user_func($logger, sprintf(__('Preserve comment status of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1054
+ }
1055
  if ( ! $this->options['is_update_author']){
1056
  $articleData['post_author'] = $post_to_update->post_author;
1057
  $logger and call_user_func($logger, sprintf(__('Preserve post author of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
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.3.1
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.3.1');
29
 
30
  define('PMXI_EDITION', 'free');
31
 
@@ -1021,6 +1021,7 @@ final class PMXI_Plugin {
1021
  'is_update_excerpt' => 1,
1022
  'is_update_categories' => 1,
1023
  'is_update_author' => 1,
 
1024
  'update_categories_logic' => 'full_update',
1025
  'taxonomies_list' => array(),
1026
  'taxonomies_only_list' => array(),
@@ -1080,6 +1081,7 @@ final class PMXI_Plugin {
1080
  'is_keep_linebreaks' => 0,
1081
  'is_leave_html' => 0,
1082
  'fix_characters' => 0,
 
1083
 
1084
  'featured_image' => '',
1085
  'download_featured_image' => '',
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.3.2
7
  Author: Soflyy
8
  */
9
 
25
  */
26
  define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
27
 
28
+ define('PMXI_VERSION', '3.3.2');
29
 
30
  define('PMXI_EDITION', 'free');
31
 
1021
  'is_update_excerpt' => 1,
1022
  'is_update_categories' => 1,
1023
  'is_update_author' => 1,
1024
+ 'is_update_comment_status' => 1,
1025
  'update_categories_logic' => 'full_update',
1026
  'taxonomies_list' => array(),
1027
  'taxonomies_only_list' => array(),
1081
  'is_keep_linebreaks' => 0,
1082
  'is_leave_html' => 0,
1083
  'fix_characters' => 0,
1084
+ 'pid_xpath' => '',
1085
 
1086
  'featured_image' => '',
1087
  'download_featured_image' => '',
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
  Tested up to: 4.3
5
- Stable tag: 3.3.1
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.3.1 =
107
  * fixed parsing CSV with empty lines
108
  * fixed parsing multiple IF statements
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
  Tested up to: 4.3
5
+ Stable tag: 3.3.2
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.3.2 =
107
+ * fixed fatal error on saving settings
108
+
109
  = 3.3.1 =
110
  * fixed parsing CSV with empty lines
111
  * fixed parsing multiple IF statements
views/admin/import/confirm.php CHANGED
@@ -161,6 +161,7 @@
161
 
162
  <?php
163
  $criteria = '';
 
164
  if ( 'title' == $post['duplicate_indicator']) $criteria = 'has the same Title';
165
  if ( 'content' == $post['duplicate_indicator']) $criteria = 'has the same Content';
166
  if ( 'custom field' == $post['duplicate_indicator']) $criteria = 'has Custom Field named "'. $post['custom_duplicate_name'] .'" with value = ' . $post['custom_duplicate_value'];
161
 
162
  <?php
163
  $criteria = '';
164
+ if ( 'pid' == $post['duplicate_indicator']) $criteria = 'has the same ID';
165
  if ( 'title' == $post['duplicate_indicator']) $criteria = 'has the same Title';
166
  if ( 'content' == $post['duplicate_indicator']) $criteria = 'has the same Content';
167
  if ( 'custom field' == $post['duplicate_indicator']) $criteria = 'has Custom Field named "'. $post['custom_duplicate_name'] .'" with value = ' . $post['custom_duplicate_value'];
views/admin/import/options/_reimport_options.php CHANGED
@@ -105,6 +105,11 @@
105
  <input type="checkbox" id="is_update_parent" name="is_update_parent" value="1" <?php echo $post['is_update_parent'] ? 'checked="checked"': '' ?> />
106
  <label for="is_update_parent"><?php _e('Parent post', 'wp_all_import_plugin') ?></label>
107
  </div>
 
 
 
 
 
108
  <div class="input">
109
  <input type="hidden" name="is_update_attachments" value="0" />
110
  <input type="checkbox" id="is_update_attachments" name="is_update_attachments" value="1" <?php echo $post['is_update_attachments'] ? 'checked="checked"': '' ?> />
105
  <input type="checkbox" id="is_update_parent" name="is_update_parent" value="1" <?php echo $post['is_update_parent'] ? 'checked="checked"': '' ?> />
106
  <label for="is_update_parent"><?php _e('Parent post', 'wp_all_import_plugin') ?></label>
107
  </div>
108
+ <div class="input">
109
+ <input type="hidden" name="is_update_comment_status" value="0" />
110
+ <input type="checkbox" id="is_update_comment_status" name="is_update_comment_status" value="1" <?php echo $post['is_update_comment_status'] ? 'checked="checked"': '' ?> />
111
+ <label for="is_update_comment_status"><?php _e('Comment status', 'wp_all_import_plugin') ?></label>
112
+ </div>
113
  <div class="input">
114
  <input type="hidden" name="is_update_attachments" value="0" />
115
  <input type="checkbox" id="is_update_attachments" name="is_update_attachments" value="1" <?php echo $post['is_update_attachments'] ? 'checked="checked"': '' ?> />
views/admin/import/options/_reimport_template.php CHANGED
@@ -99,15 +99,24 @@
99
  <input type="radio" id="duplicate_indicator_title" class="switcher" name="duplicate_indicator" value="title" <?php echo 'title' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
100
  <label for="duplicate_indicator_title"><?php _e('Title', 'wp_all_import_plugin' )?></label><br>
101
  <input type="radio" id="duplicate_indicator_content" class="switcher" name="duplicate_indicator" value="content" <?php echo 'content' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
102
- <label for="duplicate_indicator_content"><?php _e('Content', 'wp_all_import_plugin' )?></label><br>
103
- <input type="radio" id="duplicate_indicator_custom_field" class="switcher" name="duplicate_indicator" value="custom field" <?php echo 'custom field' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
104
- <label for="duplicate_indicator_custom_field"><?php _e('Custom field', 'wp_all_import_plugin' )?></label><br>
105
- <span class="switcher-target-duplicate_indicator_custom_field" style="vertical-align:middle; padding-left:17px;">
106
- <?php _e('Name', 'wp_all_import_plugin') ?>
107
- <input type="text" name="custom_duplicate_name" value="<?php echo esc_attr($post['custom_duplicate_name']) ?>" />
108
- <?php _e('Value', 'wp_all_import_plugin') ?>
109
- <input type="text" name="custom_duplicate_value" value="<?php echo esc_attr($post['custom_duplicate_value']) ?>" />
110
- </span>
 
 
 
 
 
 
 
 
 
111
  </div>
112
  </div>
113
  </div>
99
  <input type="radio" id="duplicate_indicator_title" class="switcher" name="duplicate_indicator" value="title" <?php echo 'title' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
100
  <label for="duplicate_indicator_title"><?php _e('Title', 'wp_all_import_plugin' )?></label><br>
101
  <input type="radio" id="duplicate_indicator_content" class="switcher" name="duplicate_indicator" value="content" <?php echo 'content' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
102
+ <label for="duplicate_indicator_content"><?php _e('Content', 'wp_all_import_plugin' )?></label><br>
103
+ <div class="input">
104
+ <input type="radio" id="duplicate_indicator_custom_field" class="switcher" name="duplicate_indicator" value="custom field" <?php echo 'custom field' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
105
+ <label for="duplicate_indicator_custom_field"><?php _e('Custom field', 'wp_all_import_plugin' )?></label><br>
106
+ <span class="switcher-target-duplicate_indicator_custom_field" style="vertical-align:middle; padding-left:17px;">
107
+ <?php _e('Name', 'wp_all_import_plugin') ?>
108
+ <input type="text" name="custom_duplicate_name" value="<?php echo esc_attr($post['custom_duplicate_name']) ?>" />
109
+ <?php _e('Value', 'wp_all_import_plugin') ?>
110
+ <input type="text" name="custom_duplicate_value" value="<?php echo esc_attr($post['custom_duplicate_value']) ?>" />
111
+ </span>
112
+ </div>
113
+ <div class="input">
114
+ <input type="radio" id="duplicate_indicator_pid" class="switcher" name="duplicate_indicator" value="pid" <?php echo 'pid' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
115
+ <label for="duplicate_indicator_pid"><?php _e('Post ID', 'wp_all_import_plugin' )?></label><br>
116
+ <span class="switcher-target-duplicate_indicator_pid" style="vertical-align:middle; padding-left:17px;">
117
+ <input type="text" name="pid_xpath" value="<?php echo esc_attr($post['pid_xpath']) ?>" />
118
+ </span>
119
+ </div>
120
  </div>
121
  </div>
122
  </div>