Import any XML or CSV File to WordPress - Version 3.6.1

Version Description

  • bug fix: categories were imported despite the taxonomy option being disabled
  • improvement: add ability to filter csv escape symbol via wp_all_import_csv_parser_settings filter
Download this release

Release Info

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

Code changes from version 3.6.0 to 3.6.1

actions/admin_init.php CHANGED
@@ -5,5 +5,6 @@ function pmxi_admin_init(){
5
  wp_enqueue_script('wp-all-import-script', WP_ALL_IMPORT_ROOT_URL . '/static/js/wp-all-import.js', array('jquery'), PMXI_VERSION);
6
 
7
  @ini_set('mysql.connect_timeout', 300);
8
- @ini_set('default_socket_timeout', 300);
 
9
  }
5
  wp_enqueue_script('wp-all-import-script', WP_ALL_IMPORT_ROOT_URL . '/static/js/wp-all-import.js', array('jquery'), PMXI_VERSION);
6
 
7
  @ini_set('mysql.connect_timeout', 300);
8
+ @ini_set('default_socket_timeout', 300);
9
+
10
  }
actions/admin_menu.php CHANGED
@@ -5,6 +5,8 @@
5
 
6
  function pmxi_admin_menu() {
7
  global $menu, $submenu;
 
 
8
 
9
  if (current_user_can( PMXI_Plugin::$capabilities )) { // admin management options
10
 
@@ -18,7 +20,7 @@ function pmxi_admin_menu() {
18
 
19
  $wpai_menu = apply_filters('pmxi_admin_menu', $wpai_menu);
20
 
21
- add_menu_page(__('WP All Import', 'wp_all_import_plugin'), __('All Import', 'wp_all_import_plugin'), PMXI_Plugin::$capabilities, 'pmxi-admin-home', array(PMXI_Plugin::getInstance(), 'adminDispatcher'), PMXI_Plugin::ROOT_URL . '/static/img/xmlicon.png', 112);
22
  // workaround to rename 1st option to `Home`
23
  $submenu['pmxi-admin-home'] = array();
24
 
5
 
6
  function pmxi_admin_menu() {
7
  global $menu, $submenu;
8
+ $icon_base64 = "PHN2ZyBjbGFzcz0iaW1nLWZsdWlkIiBpZD0ib3V0cHV0c3ZnIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHdpZHRoPSIyMCIgdmlld0JveD0iMCAwIDQwIDQwIj48cGF0aCBmaWxsPSIjZjBmMGYxIiBzdHJva2U9Im5vbmUiIGQ9Ik0zNS40MjA4IDE5Ljk4NTNDMzUuMjI0NCAxOS44NTQyIDM0Ljk3MzUgMTkuODEwNSAzNC43NTU0IDE5Ljg4N0wzMC42ODY1IDIxLjIyQzMwLjI4MjkgMjEuMzUxMiAzMC4wNjQ3IDIxLjc4ODIgMzAuMTk1NiAyMi4xODE2QzMwLjMyNjUgMjIuNTg1OSAzMC43NjI5IDIyLjgwNDQgMzEuMTU1NiAyMi42NzMzTDMyLjc0ODIgMjIuMTQ4OEMzMS41NzAxIDIzLjg4NjIgMjguNjU3NSAyNy41NDY3IDI1LjM1MjMgMjYuOTg5NUMyNC43NTIzIDI2Ljg5MTEgMjQuMzA1MSAyNi41MTk2IDI0LjE4NTEgMjYuMDM4OEMyNC4wMTA1IDI1LjM3MjMgMjQuNDU3OCAyNC41NzQ2IDI1LjM5NTkgMjMuODIwNkMyOS4wMzkzIDIwLjkzNTkgMzEuMDM1NiAxNy4xMTE1IDMxLjAzNTYgMTMuMDU3NkMzMS4wMjQ3IDUuODU2ODIgMjUuMTc3NyAwIDE3Ljk3ODIgMEMxMC43Nzg2IDAgNC45NDI1NiA1Ljg1NjgyIDQuOTQyNTYgMTMuMDY4NkM0Ljk0MjU2IDE3LjEyMjUgNi45NDk3MiAyMC45NDY5IDEwLjU4MjIgMjMuODMxNkMxMS41MjA0IDI0LjU3NDYgMTEuOTU2NyAyNS4zODMyIDExLjc5MzEgMjYuMDQ5N0MxMS42NzMxIDI2LjUzMDUgMTEuMjE0OSAyNi45MDIgMTAuNjI1OSAyNy4wMDA0QzcuMzMxNTEgMjcuNTU3NiA0LjQwODA1IDIzLjg5NzEgMy4yMjk5MyAyMi4xNTk4TDQuODExNjYgMjIuNjg0MkM1LjIxNTI3IDIyLjgxNTQgNS42NDA3IDIyLjU5NjggNS43NzE2IDIyLjE5MjVDNS45MDI1MSAyMS43ODgyIDUuNjg0MzQgMjEuMzYyMSA1LjI4MDcyIDIxLjIzMUwxLjIxMTg3IDE5Ljg4N0MwLjk4Mjc5MiAxOS44MTA1IDAuNzQyODA2IDE5Ljg0MzMgMC41NDY0NTQgMTkuOTg1M0MwLjM1MDEwMSAyMC4xMTY0IDAuMjMwMTA4IDIwLjMzNSAwLjIxOTIgMjAuNTc1NEwwLjAwMTAzMDggMjUuMDAwOEMtMC4wMjA3ODYxIDI1LjQyNjkgMC4zMDY0NjggMjUuNzc2NiAwLjcyMDk4OSAyNS43OTg0SDAuNzY0NjIzQzEuMTY4MjQgMjUuNzk4NCAxLjUwNjQgMjUuNDgxNSAxLjUyODIxIDI1LjA2NjNMMS42MTU0OCAyMy4yNjM0QzIuOTEzNTkgMjUuMTY0NyA2LjAxMTU5IDI5IDkuOTM4NjMgMjlDMTAuMjY1OSAyOSAxMC42MDQxIDI4Ljk3ODEgMTAuOTUzMSAyOC45MTI2QzEyLjMyNzYgMjguNjgzMSAxMy4zNzQ4IDI3Ljc2NTMgMTMuNzAyMSAyNi41MDg3QzE0LjA3MjkgMjUuMDU1NCAxMy4zODU3IDIzLjUxNDcgMTEuODE0OSAyMi4yNjlDOS45ODIyNyAyMC44MTU4IDYuOTE2OTkgMTcuNjkwNyA2LjkxNjk5IDEzLjA0NjdDNi45MTY5OSA2LjkyNzY2IDExLjg5MTIgMS45NDQ5OSAxOCAxLjk0NDk5QzI0LjEwODcgMS45NDQ5OSAyOS4wODMgNi45Mjc2NiAyOS4wODMgMTMuMDQ2N0MyOS4wODMgMTcuNjkwNyAyNi4wMTc3IDIwLjgxNTggMjQuMTg1MSAyMi4yNjlDMjIuNjE0MyAyMy41MTQ3IDIxLjkxNjEgMjUuMDY2MyAyMi4yOTc5IDI2LjUwODdDMjIuNjE0MyAyNy43NTQzIDIzLjY3MjQgMjguNjcyMiAyNS4wNDY4IDI4LjkxMjZDMjkuNDUzOSAyOS42NTU2IDMyLjk3NzMgMjUuMzI4NiAzNC4zODQ1IDIzLjI2MzRMMzQuNDcxOCAyNS4wNTU0QzM0LjQ5MzYgMjUuNDU5NyAzNC44MzE3IDI1Ljc4NzUgMzUuMjM1MyAyNS43ODc1SDM1LjI3OUMzNS43MDQ0IDI1Ljc2NTYgMzYuMDIwOCAyNS40MDUgMzUuOTk4OSAyNC45ODk4TDM1Ljc4MDggMjAuNTY0NEMzNS43MzcxIDIwLjM0NTkgMzUuNjA2MiAyMC4xMTY0IDM1LjQyMDggMTkuOTg1M1pNMTMuNSAxOUMxNC4zMjg0IDE5IDE1IDE4LjMyODQgMTUgMTcuNUMxNSAxNi42NzE2IDE0LjMyODQgMTYgMTMuNSAxNkMxMi42NzE2IDE2IDEyIDE2LjY3MTYgMTIgMTcuNUMxMiAxOC4zMjg0IDEyLjY3MTYgMTkgMTMuNSAxOVpNMjIuNSAxOUMyMy4zMjg0IDE5IDI0IDE4LjMyODQgMjQgMTcuNUMyNCAxNi42NzE2IDIzLjMyODQgMTYgMjIuNSAxNkMyMS42NzE2IDE2IDIxIDE2LjY3MTYgMjEgMTcuNUMyMSAxOC4zMjg0IDIxLjY3MTYgMTkgMjIuNSAxOVpNMjQuMjM2NCAzMi40MzE2QzI0LjYxMTkgMzIuMjk0NyAyNS4wMjkyIDMyLjUwNTMgMjUuMTU0MyAzMi44OTQ3TDI2LjQ2ODcgMzYuODEwNUMyNi41MzEzIDM3LjAyMTEgMjYuNSAzNy4yNjMyIDI2LjM3NDggMzcuNDUyNkMyNi4yNDk2IDM3LjY0MjEgMjYuMDQxIDM3Ljc1NzkgMjUuODExNSAzNy43Njg0TDIxLjU4NjggMzhIMjEuNTQ1QzIxLjE1OTEgMzggMjAuODM1NyAzNy42OTQ3IDIwLjgxNDggMzcuMzA1M0MyMC43OTQgMzYuODk0NyAyMS4wOTY1IDM2LjU0NzQgMjEuNTAzMyAzNi41MjYzTDIzLjIzNDkgMzYuNDMxNkMyMC42NDc5IDM0Ljg2MzIgMTguOTQ3NiAzMi45NTc5IDE3Ljk5ODMgMzAuNTA1M0MxNy4wNDkgMzIuOTU3OSAxNS4zNDg3IDM0Ljg2MzIgMTIuNzYxNyAzNi40MzE2TDE0LjUwMzcgMzYuNTI2M0MxNC45MDAxIDM2LjU0NzQgMTUuMjEzMSAzNi44OTQ3IDE1LjE5MjIgMzcuMzA1M0MxNS4xNzE0IDM3LjY5NDcgMTQuODQ4IDM4IDE0LjQ2MiAzOEgxNC40MjAzTDEwLjE5NTUgMzcuNzY4NEM5Ljk2NjAzIDM3Ljc1NzkgOS43Njc4MyAzNy42NDIxIDkuNjMyMjIgMzcuNDUyNkM5LjQ5NjYxIDM3LjI2MzIgOS40NjUzMSAzNy4wMzE2IDkuNTM4MzQgMzYuODEwNUwxMC44MjE0IDMyLjg4NDJDMTAuOTQ2NiAzMi41MDUzIDExLjM1MzQgMzIuMjk0NyAxMS43Mzk0IDMyLjQyMTFDMTIuMTE0OSAzMi41NDc0IDEyLjMyMzYgMzIuOTU3OSAxMi4xOTg0IDMzLjM0NzRMMTEuNjAzOCAzNS4xNTc5QzE1Ljk1MzcgMzIuNjMxNiAxNi44NTA4IDI5LjUwNTMgMTcuMTQyOSAyNi43NTc5QzE3LjE5NTEgMjYuMzI2MyAxNy41NDk3IDI2IDE3Ljk3NzQgMjZDMTguNDA1MSAyNiAxOC43NzAyIDI2LjMyNjMgMTguODEyIDI2Ljc1NzlDMTkuMTA0IDI5LjUxNTggMjAuMDAxMiAzMi42NDIxIDI0LjM3MiAzNS4xNzg5TDIzLjc3NzQgMzMuMzU3OUMyMy42NDE4IDMyLjk3ODkgMjMuODUwNCAzMi41NTc5IDI0LjIzNjQgMzIuNDMxNloiLz48L3N2Zz4=";
9
+
10
 
11
  if (current_user_can( PMXI_Plugin::$capabilities )) { // admin management options
12
 
20
 
21
  $wpai_menu = apply_filters('pmxi_admin_menu', $wpai_menu);
22
 
23
+ add_menu_page(__('WP All Import', 'wp_all_import_plugin'), __('All Import', 'wp_all_import_plugin'), PMXI_Plugin::$capabilities, 'pmxi-admin-home', array(PMXI_Plugin::getInstance(), 'adminDispatcher'), 'data:image/svg+xml;base64,' . $icon_base64, 112);
24
  // workaround to rename 1st option to `Home`
25
  $submenu['pmxi-admin-home'] = array();
26
 
actions/pmxi_extend_options_custom_fields.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @param $post_type
4
+ * @param $post
5
+ */
6
+ function pmxi_pmxi_extend_options_custom_fields($post_type, $post) {
7
+ if ( ! is_plugin_active('wpai-acf-add-on/wpai-acf-add-on.php') ) {
8
+
9
+ global $acf;
10
+
11
+ $savedGroups = array();
12
+
13
+ if ( version_compare($acf->settings['version'], '5.0.0') >= 0 ) {
14
+ $savedGroups = get_posts(array(
15
+ 'posts_per_page' => -1,
16
+ 'post_type' => 'acf-field-group',
17
+ 'order' => 'ASC',
18
+ 'orderby' => 'title'
19
+ ));
20
+ $groups = [];
21
+ if (function_exists('acf_local')) {
22
+ $groups = acf_local()->groups;
23
+ }
24
+ if (empty($groups) && function_exists('acf_get_local_field_groups')) {
25
+ $groups = acf_get_local_field_groups();
26
+ }
27
+ } else {
28
+ $groups = apply_filters('acf/get_field_groups', array());
29
+ }
30
+
31
+ if (!empty($savedGroups)) {
32
+ foreach ($savedGroups as $key => $group) {
33
+ if ( version_compare($acf->settings['version'], '5.0.0') >= 0 ) {
34
+ $groupData = acf_get_field_group($group);
35
+ // Prepare validation rules.
36
+ if (!empty($groupData['location'])) {
37
+ foreach ($groupData['location'] as $i => $locations) {
38
+ foreach ($locations as $j => $location) {
39
+ if ($location['param'] !== 'post_type') {
40
+ unset($groupData['location'][$i][$j]);
41
+ }
42
+ }
43
+ }
44
+ }
45
+ // Only render visible field groups.
46
+ if (in_array($post_type, array('taxonomies', 'import_users')) || acf_get_field_group_visibility($groupData, array('post_type' => $post_type)) || empty($groupData['location'][0])) {
47
+ if (!isset($groups[$group->post_name])) {
48
+ $groups[] = array(
49
+ 'ID' => $group->ID,
50
+ 'title' => $group->post_title,
51
+ 'slug' => $group->post_excerpt
52
+ );
53
+ } else {
54
+ $groups[$group->post_name]['ID'] = $group->ID;
55
+ }
56
+ }
57
+ } else {
58
+ if (!isset($groups[$group->post_name])) {
59
+ $groups[] = array(
60
+ 'ID' => $group->ID,
61
+ 'title' => $group->post_title,
62
+ 'slug' => $group->post_excerpt
63
+ );
64
+ } else {
65
+ $groups[$group->post_name]['ID'] = $group->ID;
66
+ }
67
+ }
68
+ }
69
+ }
70
+
71
+ if (!empty($groups)) {
72
+ foreach ($groups as $key => $group) {
73
+ if (empty($group['ID']) && !empty($group['id'])) {
74
+ $groups[$key]['ID'] = $group['id'];
75
+ } elseif (empty($group['ID']) && !empty($group['key'])) {
76
+ $groups[$key]['ID'] = $group['key'];
77
+ }
78
+ }
79
+ }
80
+
81
+ require_once WP_ALL_IMPORT_ROOT_DIR . '/views/admin/promotion/acf.php';
82
+ }
83
+ }
banner-772x250.png CHANGED
Binary file
classes/api.php CHANGED
@@ -545,7 +545,7 @@ class PMXI_API
545
  } else {
546
 
547
  if ($file_type == 'images') {
548
- if ( preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath)) or $image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath) and in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP))) {
549
  $result = true;
550
  $logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
551
  }
@@ -568,7 +568,7 @@ class PMXI_API
568
  } else {
569
 
570
  if ($file_type == 'images') {
571
- if ( preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath)) or $image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath) and in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP))) {
572
  $result = true;
573
  $logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
574
  } else {
545
  } else {
546
 
547
  if ($file_type == 'images') {
548
+ if ( preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath)) or $image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath) and in_array($image_info[2], wp_all_import_supported_image_types())) {
549
  $result = true;
550
  $logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
551
  }
568
  } else {
569
 
570
  if ($file_type == 'images') {
571
+ if ( preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath)) or $image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath) and in_array($image_info[2], wp_all_import_supported_image_types())) {
572
  $result = true;
573
  $logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
574
  } else {
classes/upload.php CHANGED
@@ -49,6 +49,8 @@ if ( ! class_exists('PMXI_Upload')){
49
 
50
  $bundleFiles = array();
51
 
 
 
52
  if (empty($this->file)) {
53
  $this->errors->add('form-validation', __('Please specify a file to import.<br/><br/>If you are uploading the file from your computer, please wait for it to finish uploading (progress bar at 100%), before trying to continue.', 'wp_all_import_plugin'));
54
  } elseif (!is_file($this->file)) {
@@ -137,8 +139,8 @@ if ( ! class_exists('PMXI_Upload')){
137
  );
138
  $fileFormats = $this->get_xml_file( $filePath );
139
  $filePath = $fileFormats['xml'];
 
140
  }
141
-
142
  } elseif ( preg_match('%\W(csv|txt|dat|psv|tsv)$%i', trim($this->file))) { // If CSV file uploaded
143
 
144
  if ( $this->uploadsPath === false ){
@@ -154,7 +156,8 @@ if ( ! class_exists('PMXI_Upload')){
154
  include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
155
 
156
  $csv = new PMXI_CsvParser( array( 'filename' => $this->file, 'targetDir' => $this->uploadsPath ) );
157
- //@unlink($filePath);
 
158
  $filePath = $csv->xml_path;
159
  $this->is_csv = $csv->is_csv;
160
  $this->root_element = 'node';
@@ -175,6 +178,7 @@ if ( ! class_exists('PMXI_Upload')){
175
  include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
176
  $csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targeDir' => $this->uploadsPath ) ); // create chunks
177
  //@unlink($filePath);
 
178
  $filePath = $csv->xml_path;
179
  $this->is_csv = $csv->is_csv;
180
  $this->root_element = 'node';
@@ -258,6 +262,7 @@ if ( ! class_exists('PMXI_Upload')){
258
  'source' => $source,
259
  'root_element' => $this->root_element,
260
  'is_csv' => $this->is_csv,
 
261
  'template' => empty($templateOptions) ? "" : json_encode($templateOptions),
262
  'templates' => $templates,
263
  'post_type' => (!empty($options)) ? $options['custom_type'] : false,
49
 
50
  $bundleFiles = array();
51
 
52
+ $csv_path = '';
53
+
54
  if (empty($this->file)) {
55
  $this->errors->add('form-validation', __('Please specify a file to import.<br/><br/>If you are uploading the file from your computer, please wait for it to finish uploading (progress bar at 100%), before trying to continue.', 'wp_all_import_plugin'));
56
  } elseif (!is_file($this->file)) {
139
  );
140
  $fileFormats = $this->get_xml_file( $filePath );
141
  $filePath = $fileFormats['xml'];
142
+ $csv_path = $fileFormats['csv'];
143
  }
 
144
  } elseif ( preg_match('%\W(csv|txt|dat|psv|tsv)$%i', trim($this->file))) { // If CSV file uploaded
145
 
146
  if ( $this->uploadsPath === false ){
156
  include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
157
 
158
  $csv = new PMXI_CsvParser( array( 'filename' => $this->file, 'targetDir' => $this->uploadsPath ) );
159
+ //@unlink($filePath);
160
+ $csv_path = $filePath;
161
  $filePath = $csv->xml_path;
162
  $this->is_csv = $csv->is_csv;
163
  $this->root_element = 'node';
178
  include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
179
  $csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targeDir' => $this->uploadsPath ) ); // create chunks
180
  //@unlink($filePath);
181
+ $csv_path = $filePath;
182
  $filePath = $csv->xml_path;
183
  $this->is_csv = $csv->is_csv;
184
  $this->root_element = 'node';
262
  'source' => $source,
263
  'root_element' => $this->root_element,
264
  'is_csv' => $this->is_csv,
265
+ 'csv_path' => $csv_path,
266
  'template' => empty($templateOptions) ? "" : json_encode($templateOptions),
267
  'templates' => $templates,
268
  'post_type' => (!empty($options)) ? $options['custom_type'] : false,
controllers/admin/import.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
  /**
3
  * Import configuration wizard
4
- *
5
- * @author Maksym Tsypliakov <maksym.tsypliakov@gmail.com>
6
  */
7
 
8
  class PMXI_Admin_Import extends PMXI_Controller_Admin {
@@ -124,6 +124,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
124
  'url' => '',
125
  'ftp_host' => '',
126
  'ftp_path' => '',
 
127
  'ftp_port' => '21',
128
  'ftp_username' => '',
129
  'ftp_password' => '',
@@ -164,7 +165,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
164
  } else {
165
  $DefaultOptions = (PMXI_Plugin::$session->has_session() && !empty(PMXI_Plugin::$session->first_step) ? PMXI_Plugin::$session->first_step : array()) + $DefaultOptions;
166
  }
167
-
168
  $this->data['post'] = $post = $this->input->post( $DefaultOptions );
169
 
170
  if ( ! class_exists('DOMDocument') or ! class_exists('XMLReader') ) {
@@ -177,15 +178,12 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
177
 
178
  check_admin_referer('choose-file', '_wpnonce_choose-file');
179
 
180
- if ('upload' == $this->input->post('type')) {
181
-
182
  $uploader = new PMXI_Upload($post['filepath'], $this->errors, rtrim(str_replace(basename($post['filepath']), '', $post['filepath']), '/'));
183
- $upload_result = $uploader->upload();
184
-
185
- if ($upload_result instanceof WP_Error){
186
  $this->errors = $upload_result;
187
- }
188
- else{
189
  $source = $upload_result['source'];
190
  $filePath = $upload_result['filePath'];
191
  $post['template'] = $upload_result['template'];
@@ -193,68 +191,123 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
193
  if ( ! empty($upload_result['root_element']))
194
  $post['root_element'] = $upload_result['root_element'];
195
  }
196
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
 
198
  if ($this->input->post('is_submitted') and '' == $this->input->post('custom_type')) {
199
  $this->errors->add('form-validation', __('Select an item type to import the data', 'wp_all_import_plugin'));
200
  }
201
-
202
  if ($post['is_update_previous'] and empty($post['update_previous'])) {
203
  $this->errors->add('form-validation', __('Previous import for update must be selected to proceed with a new one', 'wp_all_import_plugin'));
204
  }
205
-
206
- $this->data['detection_feed_extension'] = false;
207
-
 
208
  $elements_cloud = array();
209
 
210
- @set_time_limit(0);
211
-
212
- $table = PMXI_Plugin::getInstance()->getTablePrefix() . 'imports';
213
-
214
- $deligate = $this->input->get('deligate', false);
215
-
216
  $redirect_to_template = false;
217
-
218
  $importRecord = new PMXI_Import_Record();
219
 
220
  switch ( $deligate ) {
221
-
222
  case 'wpallexport':
223
-
224
- global $wpdb;
225
-
226
  $import_id = $this->input->get('id', 0);
227
-
228
  $importRecord->clear();
229
  $importRecord->getById($import_id);
230
-
231
- if ( ! $importRecord->isEmpty() and ! empty($importRecord->options['unique_key']))
232
- {
233
  $importRecord->set(array(
234
  'path' => wp_all_import_get_relative_path($filePath),
235
  'parent_import_id' => 0
236
  ))->save();
237
-
238
  $post['is_update_previous'] = 1;
239
  $post['update_previous'] = $importRecord->id;
240
- //$chunks = $importRecord->count;
241
-
242
  $redirect_to_template = true;
243
  }
244
 
245
  if ( $importRecord->isEmpty() ){
246
  $this->errors->add('form-validation', __('File is no longer in the correct format', 'wp_all_import_plugin'));
247
- }
248
- elseif (empty($importRecord->options['unique_key'])) {
249
  $this->errors->add('form-validation', __('Certain columns are required to be present in your file to enable it to be re-imported with WP All Import. These columns are missing. Re-export your file using WP All Export, and don\'t delete any of the columns when editing it. Then, re-import will work correctly.', 'wp_all_import_plugin'));
 
 
 
 
250
  }
251
- elseif($importRecord->options['custom_type'] == 'import_users' && ! class_exists('PMUI_Plugin')){
252
- $this->errors->add('form-validation', __('<p>The import template you are using requires the User Add-On.</p><a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707221&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-users" target="_blank">Purchase the User Add-On</a>', 'wp_all_import_plugin'));
253
- }
254
- elseif($importRecord->options['custom_type'] == 'shop_customer' && ! class_exists('PMUI_Plugin')){
255
- $this->errors->add('form-validation', __('<p>The import template you are using requires the User Add-On.</p><a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707221&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-users" target="_blank">Purchase the User Add-On</a>', 'wp_all_import_plugin'));
256
- }
257
-
258
  break;
259
 
260
  default:
@@ -262,78 +315,48 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
262
  break;
263
  }
264
 
265
- $local_paths = !empty($local_paths) ? $local_paths : array($filePath);
266
-
267
- // if ( 'file' == $this->input->post('type') ){
268
-
269
- // $root_element = wp_all_import_get_reader_engine( $local_paths, $post );
270
-
271
- // if ( empty($post['root_element']) and ! empty($root_element))
272
- // {
273
- // $post['root_element'] = $root_element;
274
- // }
275
- // }
276
 
277
- foreach ($local_paths as $key => $path) {
278
-
279
  if ( @file_exists($path) ){
280
-
281
  $file = new PMXI_Chunk($path, array('element' => $post['root_element'], 'get_cloud' => true));
282
-
283
- if ( ! empty($file->options['element']) ) {
284
-
285
  $xpath = "/" . $file->options['element'];
286
-
287
- $elements_cloud = $file->cloud;
288
-
289
- if ( ! empty($elements_cloud) and class_exists('PMXE_Plugin') and ! $importRecord->isEmpty() ){
290
-
291
  $is_file_valid = apply_filters('wp_all_import_is_exported_file_valid', true, $importRecord->options['export_id'], $elements_cloud);
292
-
293
- if ( ! $is_file_valid )
294
- {
295
  $this->errors->add('form-validation', __('Certain columns are required to be present in your file to enable it to be re-imported with WP All Import. These columns are missing. Re-export your file using WP All Export, and don\'t delete any of the columns when editing it. Then, re-import will work correctly.', 'wp_all_import_plugin'));
296
  }
297
-
298
  }
299
-
300
- if ( ($redirect_to_template or $post['auto_generate']) and ! $this->errors->get_error_codes() ){
301
-
302
  // loop through the file until all lines are read
303
  while ($xml = $file->read()) {
304
-
305
- if ( ! empty($xml) )
306
- {
307
  //PMXI_Import_Record::preprocessXml($xml);
308
  $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" . "\n" . $xml;
309
-
310
  $dom = new DOMDocument('1.0', 'UTF-8');
311
  $old = libxml_use_internal_errors(true);
312
  $dom->loadXML($xml);
313
  libxml_use_internal_errors($old);
314
  $dxpath = new DOMXPath($dom);
315
 
316
- if (($elements = @$dxpath->query($xpath)) and $elements->length){
317
-
318
  if ( empty($chunks) ) {
319
  $chunks = 0;
320
  }
321
-
322
  $chunks += $elements->length;
323
-
324
  unset($dom, $dxpath, $elements);
325
-
326
  }
327
  }
328
  }
329
  //unset($file);
330
  }
331
-
332
  break;
333
- }
334
-
335
- }
336
- else $this->errors->add('form-validation', __('Unable to download feed resource.', 'wp_all_import_plugin'));
337
  }
338
 
339
  if ( ! $this->errors->get_error_codes() ) {
@@ -351,7 +374,15 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
351
  'feed_type' => $post['feed_type'],
352
  'wizard_type' => $post['wizard_type'],
353
  'custom_type' => $post['custom_type'],
354
- 'source' => $source,
 
 
 
 
 
 
 
 
355
  'encoding' => 'UTF-8',
356
  'is_csv' => PMXI_Plugin::$is_csv,
357
  'csv_path' => PMXI_Plugin::$csv_path,
@@ -373,20 +404,16 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
373
  );
374
 
375
  // apply options from WP All Export bundle
376
- if ( ! empty($post['template']))
377
- {
378
  $templates = json_decode($post['template'], true);
379
  $template_options = maybe_unserialize($templates[0]['options']);
380
  $template_options['type'] = ($post['custom_type'] == 'page') ? 'page' : 'post';
381
  $template_options['custom_type'] = $post['custom_type'];
382
- $template_options['wizard_type'] = $post['wizard_type'];
383
-
384
  if ($post['wizard_type'] == 'new') {
385
  $template_options['create_new_records'] = 1;
386
  }
387
-
388
  $this->data['post'] = $template_options;
389
-
390
  PMXI_Plugin::$session->set('options', $template_options);
391
  }
392
 
@@ -401,62 +428,46 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
401
  PMXI_Plugin::$session->set('options', $update_previous->options);
402
  } else {
403
  PMXI_Plugin::$session->set('update_previous', '');
404
- }
405
 
406
  PMXI_Plugin::$session->save_data();
407
 
408
  $xml = $this->get_xml();
409
 
410
- if ( empty($xml) )
411
- {
412
  $this->errors->add('upload-validation', __('Please confirm you are importing a valid feed.<br/> Often, feed providers distribute feeds with invalid data, improperly wrapped HTML, line breaks where they should not be, faulty character encodings, syntax errors in the XML, and other issues.<br/><br/>WP All Import has checks in place to automatically fix some of the most common problems, but we can’t catch every single one.<br/><br/>It is also possible that there is a bug in WP All Import, and the problem is not with the feed.<br/><br/>If you need assistance, please contact support – <a href="mailto:support@wpallimport.com">support@wpallimport.com</a> – with your XML/CSV file. We will identify the problem and release a bug fix if necessary.', 'wp_all_import_plugin'));
413
  $this->data['upload_validation'] = true;
414
- }
415
- elseif( $redirect_to_template )
416
- {
417
  wp_redirect(add_query_arg('action', 'template', $this->baseUrl)); die();
418
- }
419
- elseif( $post['auto_generate'] )
420
- {
421
  wp_redirect(add_query_arg('action', 'options', $this->baseUrl)); die();
422
- }
423
- else
424
- {
425
  wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
426
  }
427
-
428
- }
429
- else if ('url' == $this->input->post('type') and !empty($this->errors))
430
- {
431
  $this->errors->add('form-validation', __('WP All Import unable to detect file type.<br/><br/>WP All Import not able to determine what type of file you are importing. Make sure your file extension is correct for the file type you are importing.<br/> Please choose the correct file type from the dropdown below, or try adding &type=xml or &type=csv to the end of the URL, for example http://example.com/export-products.php?&type=xml', 'wp_all_import_plugin'));
432
  $this->data['detection_feed_extension'] = true;
433
- }
434
- else
435
- {
436
  $this->errors->add('upload-validation', __('Please confirm you are importing a valid feed.<br/> Often, feed providers distribute feeds with invalid data, improperly wrapped HTML, line breaks where they should not be, faulty character encodings, syntax errors in the XML, and other issues.<br/><br/>WP All Import has checks in place to automatically fix some of the most common problems, but we can’t catch every single one.<br/><br/>It is also possible that there is a bug in WP All Import, and the problem is not with the feed.<br/><br/>If you need assistance, please contact support – <a href="mailto:support@wpallimport.com">support@wpallimport.com</a> – with your XML/CSV file. We will identify the problem and release a bug fix if necessary.', 'wp_all_import_plugin'));
437
  $this->data['upload_validation'] = true;
438
  }
439
-
440
  do_action("pmxi_get_file", $filePath);
441
  }
442
-
443
- if ($this->input->post('is_submitted') and $this->errors->get_error_codes()) PMXI_Plugin::$session->clean_session();
444
-
445
  $this->render();
446
  }
447
 
448
  /**
449
  * Step #2: Choose elements
450
  */
451
- public function element()
452
- {
453
  $xpath = new DOMXPath($this->data['dom']);
454
  $post = $this->input->post(array('xpath' => ''));
455
  $this->data['post'] =& $post;
456
  $this->data['elements_cloud'] = PMXI_Plugin::$session->elements_cloud;
457
  $this->data['is_csv'] = PMXI_Plugin::$session->is_csv;
458
-
459
- $wp_uploads = wp_upload_dir();
460
 
461
  if ($this->input->post('is_submitted')) {
462
  check_admin_referer('choose-elements', '_wpnonce_choose-elements');
@@ -464,7 +475,6 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
464
  $this->errors->add('form-validation', __('No elements selected', 'wp_all_import_plugin'));
465
  } else {
466
  $node_list = @ $xpath->query($post['xpath']); // make sure only element selection is allowed; prevent parsing warning to be displayed
467
-
468
  if (FALSE === $node_list) {
469
  $this->errors->add('form-validation', __('Your XPath is not valid.', 'wp_all_import_plugin'));
470
  } else {
@@ -476,15 +486,10 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
476
  }
477
  }
478
  }
479
-
480
  if ( ! $this->errors->get_error_codes()) {
481
-
482
  wp_redirect(apply_filters('pmxi_element_redirect' , add_query_arg('action', 'template', $this->baseUrl))); die();
483
-
484
  }
485
-
486
  } else {
487
-
488
  if ( PMXI_Plugin::$session->xpath ) {
489
  $post['xpath'] = PMXI_Plugin::$session->xpath;
490
  $this->data['elements'] = $elements = $xpath->query($post['xpath']);
@@ -509,19 +514,15 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
509
  $this->data['elements'] = $elements = $xpath->query($post['xpath']);
510
  }
511
  }
512
-
513
  }
514
-
515
  // workaround to prevent rendered XML representation to eat memory since it has to be stored in memory when output is bufferred
516
  $this->render();
517
-
518
  }
519
 
520
  /**
521
  * Helper to evaluate xpath and return matching elements as direct paths for javascript side to highlight them
522
  */
523
- public function evaluate()
524
- {
525
 
526
  if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
527
  wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
@@ -730,15 +731,11 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
730
  /**
731
  * Preview selected xml tag (called with ajax from `template` step)
732
  */
733
- public function tag( $is_json = true )
734
- {
735
 
736
  if ($is_json) check_ajax_referer( 'wp_all_import_secure', 'security' );
737
 
738
- $wp_uploads = wp_upload_dir();
739
-
740
- if (empty($this->data['elements']->length))
741
- {
742
  $update_previous = new PMXI_Import_Record();
743
  $id = $this->input->get('id');
744
  if ($id and $update_previous->getById($id)) {
@@ -758,8 +755,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
758
  PMXI_Plugin::$session->set('encoding', ( ! empty($update_previous->options['encoding'])) ? $update_previous->options['encoding'] : 'UTF-8');
759
  PMXI_Plugin::$session->save_data();
760
  }
761
- }
762
-
763
  } else {
764
  unset(PMXI_Plugin::$session->update_previous);
765
  }
@@ -769,31 +765,21 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
769
 
770
  $this->data['import_action'] = $this->input->getpost('import_action', false);
771
 
772
- if ($this->data['tagno']){
773
-
774
- $local_paths = ( ! empty(PMXI_Plugin::$session->local_paths) ) ? PMXI_Plugin::$session->local_paths : array(PMXI_Plugin::$session->filePath);
775
-
776
  PMXI_Plugin::$session->set('local_paths', $local_paths);
777
-
778
  $loop = 0;
779
-
780
- foreach ($local_paths as $key => $path) {
781
-
782
- if (@file_exists($path)){
783
-
784
  $file = new PMXI_Chunk($path, array(
785
  'element' => PMXI_Plugin::$session->source['root_element'],
786
  'encoding' => PMXI_Plugin::$session->encoding
787
  ));
788
-
789
  // loop through the file until all lines are read
790
- while ($xml = $file->read()) {
791
-
792
- if ( ! empty($xml) )
793
- {
794
  //PMXI_Import_Record::preprocessXml($xml);
795
- $xml = "<?xml version=\"1.0\" encoding=\"". PMXI_Plugin::$session->encoding ."\"?>" . "\n" . $xml;
796
-
797
  $dom = new DOMDocument('1.0', PMXI_Plugin::$session->encoding);
798
  $old = libxml_use_internal_errors(true);
799
  $dom->loadXML($xml);
@@ -835,8 +821,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
835
  /**
836
  * Preview future post based on current template and tag (called with ajax from `template` step)
837
  */
838
- public function preview()
839
- {
840
 
841
  if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
842
  exit('Nice try!');
@@ -870,8 +855,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
870
 
871
  if (PMXI_Plugin::$session->encoding != $post['import_encoding'] and ! empty(PMXI_Plugin::$session->csv_paths[$key])){
872
  // conver CSV to XML with selected encoding
873
- include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
874
-
875
  $csv = new PMXI_CsvParser(array(
876
  'filename' => PMXI_Plugin::$session->csv_paths[$key],
877
  'xpath' => '',
@@ -889,8 +873,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
889
  // loop through the file until all lines are read
890
  while ($xml = $file->read()) {
891
 
892
- if ( ! empty($xml) )
893
- {
894
  //PMXI_Import_Record::preprocessXml($xml);
895
  $xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
896
 
@@ -899,34 +882,46 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
899
  $dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
900
  libxml_use_internal_errors($old);
901
  $xpath = new DOMXPath($dom);
902
- if (($this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->xpath)) and $elements->length){
903
-
904
- if ( $loop == $tagno ){
905
- /* Merge nested XML/CSV files */
906
- /*$nested_files = json_decode(PMXI_Plugin::$session->options['nested_files'], true);
907
- if ( ! empty($nested_files) ){
908
- $merger = new PMXI_Nested($dom, $nested_files, $xml, PMXI_Plugin::$session->xpath);
909
- $merger->merge();
910
- $xml = $merger->get_xml();
911
- unset($merger);
912
- }*/
913
- unset($dom, $xpath, $elements);
914
- break(2);
915
- }
916
- unset($dom, $xpath, $elements);
917
- $loop++;
918
  }
919
  }
920
  }
921
  unset($file);
922
  }
923
- //$this->data['tagno'] = $tagno = 1;
924
-
925
- $xpath = "(" . PMXI_Plugin::$session->xpath . ")[1]";
926
-
 
 
 
 
 
 
 
927
  PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
928
- PMXI_Plugin::$session->save_data();
929
-
 
 
 
 
 
930
  // validate
931
  try {
932
  if (empty($xml)){
@@ -970,8 +965,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
970
  /**
971
  * Preview future post images based on current template and tag (called with ajax from `template` step)
972
  */
973
- public function preview_images()
974
- {
975
  if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
976
  exit('Nice try!');
977
  }
@@ -1010,26 +1004,22 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1010
  foreach ($local_paths as $key => $path) {
1011
 
1012
  if (PMXI_Plugin::$session->encoding != $post['import_encoding'] and ! empty(PMXI_Plugin::$session->csv_paths[$key])){
1013
-
1014
- // conver CSV to XML with selected encoding
1015
- include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
1016
-
1017
  $csv = new PMXI_CsvParser(array(
1018
  'filename' => PMXI_Plugin::$session->csv_paths[$key],
1019
  'xpath' => '',
1020
  'delimiter' => PMXI_Plugin::$is_csv,
1021
  'encoding' => $post['import_encoding'],
1022
  'xml_path' => $path
1023
- ));
1024
-
1025
  }
1026
 
1027
  $file = new PMXI_Chunk($path, array('element' => (!empty($this->data['update_previous']->root_element)) ? $this->data['update_previous']->root_element : PMXI_Plugin::$session->source['root_element'], 'encoding' => $post['import_encoding']));
1028
 
1029
  // loop through the file until all lines are read
1030
  while ($xml = $file->read()) {
1031
- if (!empty($xml))
1032
- {
1033
  //PMXI_Import_Record::preprocessXml($xml);
1034
  $xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
1035
 
@@ -1064,20 +1054,20 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1064
  $xpath = "(" . PMXI_Plugin::$session->xpath . ")[1]";
1065
 
1066
  PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
1067
- PMXI_Plugin::$session->save_data();
 
 
 
 
 
1068
 
1069
  // validate
1070
- try {
1071
-
1072
  $this->data['featured_images'] = false;
1073
-
1074
  if (empty($xml)){
1075
- $this->errors->add('form-validation', __('WP All Import lost track of where you are.<br/><br/>Maybe you cleared your cookies or maybe it is just a temporary issue on your web host\'s end.<br/>If you can\'t do an import without seeing this error, change your session settings on the All Import -> Settings page.', 'wp_all_import_plugin'));
1076
- }
1077
- else
1078
- {
1079
- switch ($post[$get['slug'] . 'download_images'])
1080
- {
1081
  case 'no':
1082
  $featured_image = $post[$get['slug'] . 'featured_image'];
1083
  break;
@@ -1091,12 +1081,10 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1091
 
1092
  if (empty($featured_image)){
1093
  $this->data['featured_images'] = '';
1094
- }
1095
- else{
1096
  list($this->data['featured_images']) = XmlImportParser::factory($xml, $xpath, $featured_image, $file)->parse(); unlink($file);
1097
  }
1098
- }
1099
-
1100
  } catch (XmlImportException $e) {
1101
  $this->errors->add('form-validation', sprintf(__('Error parsing: %s', 'wp_all_import_plugin'), $e->getMessage()));
1102
  }
@@ -1110,8 +1098,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1110
  /**
1111
  * Preview taxonomies hierarchy based on current template and tag (called with ajax from `template` step)
1112
  */
1113
- public function preview_taxonomies()
1114
- {
1115
 
1116
  if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
1117
  exit('Nice try!');
@@ -1145,11 +1132,9 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1145
 
1146
  $loop = 1;
1147
  foreach ($local_paths as $key => $path) {
1148
-
1149
  if (PMXI_Plugin::$session->encoding != $post['import_encoding'] and ! empty(PMXI_Plugin::$session->csv_paths[$key])){
1150
  // conver CSV to XML with selected encoding
1151
- include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
1152
-
1153
  $csv = new PMXI_CsvParser(array(
1154
  'filename' => PMXI_Plugin::$session->csv_paths[$key],
1155
  'xpath' => '',
@@ -1158,16 +1143,12 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1158
  'xml_path' => $path
1159
  ));
1160
  }
1161
-
1162
  $file = new PMXI_Chunk($path, array('element' => (!empty($this->data['update_previous']->root_element)) ? $this->data['update_previous']->root_element : PMXI_Plugin::$session->source['root_element'], 'encoding' => $post['import_encoding']));
1163
-
1164
  // loop through the file until all lines are read
1165
  while ($xml = $file->read()) {
1166
- if (!empty($xml))
1167
- {
1168
  //PMXI_Import_Record::preprocessXml($xml);
1169
- $xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
1170
-
1171
  $dom = new DOMDocument('1.0', $post['import_encoding']);
1172
  $old = libxml_use_internal_errors(true);
1173
  $dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
@@ -1201,7 +1182,11 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1201
  PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
1202
  PMXI_Plugin::$session->save_data();
1203
 
1204
- $wp_uploads = wp_upload_dir();
 
 
 
 
1205
 
1206
  // validate
1207
  try {
@@ -1215,14 +1200,13 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1215
  foreach ($post['tax_hierarchical_xpath'][$ctx] as $ctx_path) { if (empty($ctx_path)) continue;
1216
  list($d) = XmlImportParser::factory($xml, $xpath, $ctx_path, $file)->parse(); unlink($file);
1217
  if ($post['is_tax_hierarchical_group_delim'][$ctx] and !empty($post['tax_hierarchical_group_delim'][$ctx])){
1218
-
1219
  // apply mapping rules before splitting via separator symbol
1220
- if ( ! empty($post['tax_enable_mapping'][$ctx]) and ! empty($post['tax_logic_mapping'][$ctx]) ){
1221
- if ( ! empty($post['tax_mapping'][$ctx])){
1222
- $mapping_rules = json_decode($post['tax_mapping'][$ctx], true);
1223
- if ( ! empty( $mapping_rules) ){
1224
  foreach ($mapping_rules as $rule) {
1225
- if ( ! empty($rule[trim($d)])){
1226
  $d = trim($rule[trim($d)]);
1227
  break;
1228
  }
@@ -1230,7 +1214,6 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1230
  }
1231
  }
1232
  }
1233
-
1234
  $hierarchy_groups = explode($post['tax_hierarchical_group_delim'][$ctx], $d);
1235
  if (!empty($hierarchy_groups) and is_array($hierarchy_groups)){
1236
  foreach ($hierarchy_groups as $key => $group) {
@@ -1242,7 +1225,6 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1242
  $this->data['tax_hierarchical'][$ctx][] = $d;
1243
  }
1244
  }
1245
-
1246
  $data_to_preview = true;
1247
  }
1248
  }
@@ -1262,8 +1244,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1262
  /**
1263
  * Preview prices based on current template and tag (called with ajax from `template` step)
1264
  */
1265
- public function preview_prices()
1266
- {
1267
 
1268
  if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
1269
  exit('Nice try!');
@@ -1353,7 +1334,11 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1353
  PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
1354
  PMXI_Plugin::$session->save_data();
1355
 
1356
- $wp_uploads = wp_upload_dir();
 
 
 
 
1357
 
1358
  // validate
1359
  try {
@@ -1391,8 +1376,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1391
  /**
1392
  * Step #3: Choose template
1393
  */
1394
- public function template()
1395
- {
1396
 
1397
  $template = new PMXI_Template_Record();
1398
 
@@ -1402,42 +1386,43 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1402
  $this->data['source_type'] = PMXI_Plugin::$session->source['type'];
1403
 
1404
  foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
1405
- if (class_exists($class)) $default += call_user_func(array($class, "get_default_import_options"));
1406
  }
1407
  $default['wizard_type'] = PMXI_Plugin::$session->wizard_type;
1408
- if (empty($default['custom_type'])) $default['custom_type'] = PMXI_Plugin::$session->custom_type;
1409
- if (empty($default['delimiter'])) $default['delimiter'] = PMXI_Plugin::$session->is_csv;
 
 
 
 
 
 
 
 
1410
 
1411
  $DefaultOptions = (isset(PMXI_Plugin::$session->options)) ? array_replace_recursive($default, PMXI_Plugin::$session->options) : $default;
1412
 
1413
  $post = $this->input->post( apply_filters('pmxi_options_options', $DefaultOptions, $this->isWizard) );
1414
 
1415
  } else {
1416
- $this->data['source_type'] = $this->data['import']->type;
1417
-
1418
  foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
1419
  if (class_exists($class)) $default += call_user_func(array($class, "get_default_import_options"));
1420
  }
1421
-
1422
- $DefaultOptions = (is_array($this->data['import']->options)) ? array_replace_recursive($default, $this->data['import']->options) : $default;
1423
-
1424
  $source = array(
1425
  'name' => $this->data['import']->name,
1426
  'type' => $this->data['import']->type,
1427
  'path' => wp_all_import_get_relative_path($this->data['import']->path),
1428
  'root_element' => $this->data['import']->root_element,
1429
  );
1430
-
1431
- PMXI_Plugin::$session->set('source', $source);
1432
-
1433
  $post = $this->input->post( apply_filters('pmxi_options_options', $DefaultOptions, $this->isWizard) );
1434
-
1435
  }
1436
 
1437
  $max_input_vars = @ini_get('max_input_vars');
1438
 
1439
- if(ctype_digit($max_input_vars) && count($_POST, COUNT_RECURSIVE) >= $max_input_vars)
1440
- {
1441
  $this->errors->add('form-validation', sprintf(__('You\'ve reached your max_input_vars limit of %d. Please increase this.', 'wp_all_export_plugin'), $max_input_vars));
1442
  }
1443
 
@@ -1452,13 +1437,21 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1452
  $template_options = $template->options;
1453
  $template_options['type'] = $post['type'];
1454
  $template_options['custom_type'] = $post['custom_type'];
 
1455
  $template_options['wizard_type'] = $post['wizard_type'];
1456
  $template_options['delimiter'] = $post['delimiter'];
 
 
 
 
 
 
 
1457
 
1458
  if ($this->isWizard and $post['wizard_type'] == 'new') {
1459
  $template_options['create_new_records'] = 1;
1460
  }
1461
- if ($this->isWizard) {
1462
  $template_options['delimiter'] = PMXI_Plugin::$session->is_csv;
1463
  }
1464
 
@@ -1469,26 +1462,32 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1469
 
1470
  } elseif ($this->input->post('is_submitted')) { // save template submission
1471
 
1472
- check_admin_referer('template', '_wpnonce_template');
 
 
 
 
 
 
1473
 
1474
  if (!empty($post['title'])) {
1475
  $this->_validate_template($post['title'], 'Post title');
1476
  }
1477
- elseif ( ! in_array($post['custom_type'], array('shop_order', 'import_users', 'shop_customer')) ){
1478
  $this->warnings->add('1', __('<strong>Warning:</strong> your title is blank.', 'wp_all_import_plugin'));
1479
  }
1480
 
1481
  if (!empty($post['content'])) {
1482
  $this->_validate_template($post['content'], 'Post content');
1483
  }
1484
- elseif ( ! in_array($post['custom_type'], array('shop_order', 'import_users', 'shop_customer')) ){
1485
  $this->warnings->add('2', __('<strong>Warning:</strong> your content is blank.', 'wp_all_import_plugin'));
1486
  }
1487
 
1488
  if ( ! $this->errors->get_error_codes()) {
1489
 
1490
  // Attributes fields logic
1491
- $post = apply_filters('pmxi_save_options', $post);
1492
 
1493
  // validate post excerpt
1494
  if ( ! empty($post['post_excerpt'])) $this->_validate_template($post['post_excerpt'], __('Excerpt', 'wp_all_import_plugin'));
@@ -1513,21 +1512,20 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1513
  $post['custom_value'] = array_intersect_key($post['custom_value'], $not_empty);
1514
 
1515
  // validate
1516
- foreach ($post['custom_name'] as $custom_name) {
1517
- $this->_validate_template($custom_name, __('Custom Field Name', 'wp_all_import_plugin'));
1518
- }
1519
- foreach ($post['custom_value'] as $key => $custom_value) {
1520
- if ( empty($post['custom_format'][$key]) )
1521
- $this->_validate_template($custom_value, __('Custom Field Value', 'wp_all_import_plugin'));
1522
- }
 
1523
 
1524
  if ( $post['type'] == "post" and $post['custom_type'] == "product" and class_exists('PMWI_Plugin')){
1525
  // remove entires where both custom_name and custom_value are empty
1526
  $not_empty = array_flip(array_values(array_merge(array_keys(array_filter($post['attribute_name'], 'strlen')), array_keys(array_filter($post['attribute_value'], 'strlen')))));
1527
-
1528
  $post['attribute_name'] = array_intersect_key($post['attribute_name'], $not_empty);
1529
  $post['attribute_value'] = array_intersect_key($post['attribute_value'], $not_empty);
1530
-
1531
  // validate
1532
  if (array_keys(array_filter($post['attribute_name'], 'strlen')) != array_keys(array_filter($post['attribute_value'], 'strlen'))) {
1533
  $this->errors->add('form-validation', __('Both name and value must be set for all woocommerce attributes', 'wp_all_import_plugin'));
@@ -1539,12 +1537,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1539
  $this->_validate_template($custom_value, __('Attribute Field Value', 'wp_all_import_plugin'));
1540
  }
1541
  }
1542
-
1543
  }
1544
 
1545
- /*if ('page' == $post['type'] and ! preg_match('%^(-?\d+)?$%', $post['order'])) {
1546
- $this->errors->add('form-validation', __('Order must be an integer number', 'wp_all_import_plugin'));
1547
- }*/
1548
  if ('post' == $post['type'] && isset($post['tags'])) {
1549
  /*'' == $post['categories'] or $this->_validate_template($post['categories'], __('Categories', 'wp_all_import_plugin'));*/
1550
  '' == $post['tags'] or $this->_validate_template($post['tags'], __('Tags', 'wp_all_import_plugin'));
@@ -1554,10 +1548,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1554
  } else {
1555
  '' == $post['date_start'] or $this->_validate_template($post['date_start'], __('Start Date', 'wp_all_import_plugin'));
1556
  '' == $post['date_end'] or $this->_validate_template($post['date_end'], __('Start Date', 'wp_all_import_plugin'));
1557
- }
1558
- /*if ('' == $post['tags_delim']) {
1559
- $this->errors->add('form-validation', __('Tag list delimiter must cannot be empty', 'wp_all_import_plugin'));
1560
- }*/
1561
 
1562
  $this->errors = apply_filters('pmxi_options_validation', $this->errors, $post, isset($this->data['import']) ? $this->data['import'] : false);
1563
 
@@ -1578,12 +1569,52 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1578
  PMXI_Plugin::$session->set('saved_template', $template->id);
1579
  }
1580
 
1581
- if ($this->isWizard) {
1582
- PMXI_Plugin::$session->set('options', $post);
1583
- PMXI_Plugin::$session->save_data();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1584
  wp_redirect(add_query_arg('action', 'options', $this->baseUrl)); die();
1585
 
1586
- } else {
1587
  $this->data['import']->set(array( 'options' => $post, 'settings_update_on' => date('Y-m-d H:i:s')))->update();
1588
  $args = array(
1589
  'page' => 'pmxi-admin-manage',
@@ -1603,52 +1634,98 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1603
 
1604
  PMXI_Plugin::$session->save_data();
1605
 
1606
- global $wpdb;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1607
 
1608
- if ( ! in_array($post['custom_type'], array('import_users', 'shop_customer')) ){
 
 
 
 
 
 
 
 
 
 
 
 
1609
 
1610
- // Get all meta keys for requested post type
1611
- $this->data['meta_keys'] = array();
1612
- $hide_fields = array('_wp_page_template', '_edit_lock', '_edit_last', '_wp_trash_meta_status', '_wp_trash_meta_time');
1613
- $records = get_posts( array('post_type' => $post['custom_type'], 'post_status' => 'any') );
1614
- if ( ! empty($records)){
1615
- foreach ($records as $record) {
1616
- $record_meta = get_post_meta($record->ID, '');
1617
- if ( ! empty($record_meta)){
1618
- foreach ($record_meta as $record_meta_key => $record_meta_value) {
1619
- if ( ! in_array($record_meta_key, $this->data['meta_keys']) and ! in_array($record_meta_key, $hide_fields)) $this->data['meta_keys'][] = $record_meta_key;
1620
- }
1621
- }
1622
- }
1623
- }
1624
 
1625
- // Get existing product attributes
1626
- $existing_attributes = $wpdb->get_results("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '_product_attributes' LIMIT 0 , 50" );
1627
- $this->data['existing_attributes'] = array();
1628
- if ( ! empty($existing_attributes)){
1629
- foreach ($existing_attributes as $key => $existing_attribute) {
1630
- $existing_attribute = maybe_unserialize($existing_attribute->meta_value);
1631
- if (!empty($existing_attribute) and is_array($existing_attribute)):
1632
- foreach ($existing_attribute as $key => $value) {
1633
- if (strpos($key, "pa_") === false and ! in_array($key, $this->data['existing_attributes'])) $this->data['existing_attributes'][] = $key;
1634
- }
1635
- endif;
1636
- }
1637
- }
1638
- }
1639
- else {
1640
- // Get All meta keys in the system
1641
- $this->data['meta_keys'] = array();
1642
- $meta_keys = new PMXI_Model_List();
1643
- $meta_keys->setTable($wpdb->usermeta);
1644
- $meta_keys->setColumns('umeta_id', 'meta_key')->getBy(NULL, "umeta_id", NULL, NULL, "meta_key");
1645
- $hide_fields = array('first_name', 'last_name', 'nickname', 'description', PMXI_Plugin::getInstance()->getWPPrefix() . 'capabilities');
1646
- if ( ! empty($meta_keys) and $meta_keys->count() ){
1647
- foreach ($meta_keys as $meta_key) { if (in_array($meta_key['meta_key'], $hide_fields) or strpos($meta_key['meta_key'], '_wp') === 0) continue;
1648
- $this->data['meta_keys'][] = $meta_key['meta_key'];
1649
- }
1650
- }
1651
- }
1652
 
1653
  if (user_can_richedit()) {
1654
  wp_enqueue_script('editor');
@@ -1681,7 +1758,46 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1681
 
1682
  $default = PMXI_Plugin::get_default_import_options();
1683
 
1684
- if ($this->isWizard) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1685
  $this->data['source_type'] = PMXI_Plugin::$session->source['type'];
1686
 
1687
  foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
@@ -1690,57 +1806,30 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1690
 
1691
  $DefaultOptions = array_replace_recursive($default, (isset(PMXI_Plugin::$session->options) ? PMXI_Plugin::$session->options : array()));
1692
 
1693
- if ( ! in_array(PMXI_Plugin::$session->options['custom_type'], array('import_users', 'shop_order')) ){
1694
  if (empty(PMXI_Plugin::$session->options['title']))
1695
- $this->warnings->add('form-validation', __('<strong>Warning:</strong> your title is blank.'));
1696
- }
1697
-
1698
- if (empty(PMXI_Plugin::$session->options['unique_key'])){
1699
-
1700
- $keys_black_list = array('programurl');
1701
-
1702
- if ( empty(PMXI_Plugin::$session->deligate) )
1703
- $DefaultOptions['unique_key'] = PMXI_Plugin::$session->options['title'];
1704
-
1705
- // auto searching ID element
1706
- if ( ! empty($this->data['dom']) and empty(PMXI_Plugin::$session->deligate) ){
1707
- $dom = empty($this->data['dom']->documentElement) ? $this->data['dom'] : $this->data['dom']->documentElement;
1708
- $this->find_unique_key($dom);
1709
- if (!empty($this->_unique_key)){
1710
- foreach ($keys_black_list as $key => $value) {
1711
- $DefaultOptions['unique_key'] = str_replace('{' . $value . '[1]}', "", $DefaultOptions['unique_key']);
1712
- }
1713
- foreach ($this->_unique_key as $key) {
1714
- if (stripos($key, 'id') !== false) {
1715
- $DefaultOptions['unique_key'] .= ' - {'.$key.'[1]}';
1716
- break;
1717
- }
1718
- }
1719
- foreach ($this->_unique_key as $key) {
1720
- if (stripos($key, 'url') !== false or stripos($key, 'sku') !== false or stripos($key, 'ref') !== false) {
1721
- if ( ! in_array($key, $keys_black_list) ){
1722
- $DefaultOptions['unique_key'] .= ' - {'.$key.'[1]}';
1723
- break;
1724
- }
1725
- }
1726
- }
1727
- }
1728
- $DefaultOptions['unique_key'] = apply_filters('pmxi_unique_key', $DefaultOptions['unique_key'], PMXI_Plugin::$session->options);
1729
- }
1730
- }
1731
- else{
1732
- $DefaultOptions['unique_key'] = PMXI_Plugin::$session->options['unique_key'];
1733
  }
1734
 
 
 
1735
  if ($DefaultOptions['custom_type'] == "product" and class_exists('PMWI_Plugin') and $DefaultOptions['wizard_type'] != 'new'){
1736
  $DefaultOptions['duplicate_indicator'] = empty($DefaultOptions['duplicate_indicator']) ? 'custom field' : $DefaultOptions['duplicate_indicator'];
1737
  $DefaultOptions['custom_duplicate_name'] = empty($DefaultOptions['custom_duplicate_name']) ? '_sku' : $DefaultOptions['custom_duplicate_name'];
1738
  }
1739
 
1740
  $DefaultOptions['wizard_type'] = PMXI_Plugin::$session->wizard_type;
1741
- if (empty($DefaultOptions['custom_type'])) $DefaultOptions['custom_type'] = PMXI_Plugin::$session->custom_type;
1742
- if (empty($DefaultOptions['delimiter'])) $DefaultOptions['delimiter'] = PMXI_Plugin::$session->is_csv;
1743
-
 
 
 
 
 
 
 
 
1744
  $post = $this->input->post( $DefaultOptions );
1745
 
1746
  } else {
@@ -1771,7 +1860,13 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1771
 
1772
  if ($this->input->post('is_submitted')) {
1773
 
1774
- check_admin_referer('options', '_wpnonce_options');
 
 
 
 
 
 
1775
 
1776
  if ($post['is_import_specified']) {
1777
  if (empty($post['import_specified'])) {
@@ -1802,9 +1897,22 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1802
  if ('' == $post['custom_duplicate_value'])
1803
  $this->errors->add('form-validation', __('Custom field value must be specified.', 'wp_all_import_plugin'));
1804
  }
1805
- if ( 'manual' == $post['duplicate_matching'] and 'pid' == $post['duplicate_indicator']){
1806
- if ('' == $post['pid_xpath'])
1807
- $this->errors->add('form-validation', __('Post ID must be specified.', 'wp_all_import_plugin'));
 
 
 
 
 
 
 
 
 
 
 
 
 
1808
  }
1809
 
1810
  // Categories/taxonomies logic
@@ -1827,7 +1935,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1827
 
1828
  if ( ! $this->isWizard) {
1829
 
1830
- // updating csv delimiter
1831
  if ( $post['delimiter'] != $this->data['import']->options['delimiter'] ){
1832
  $import_options = $this->data['import']->options;
1833
  $import_options['delimiter'] = $post['delimiter'];
@@ -1838,27 +1946,84 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1838
  switch ($this->input->post('new_type')){
1839
  case 'upload':
1840
  $filePath = $this->input->post('filepath');
1841
-
1842
  if ($this->data['import']['path'] != $filePath){
1843
  $uploader = new PMXI_Upload($filePath, $this->errors);
1844
  $upload_result = $uploader->upload();
1845
  }
 
 
 
1846
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1847
  break;
1848
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1849
  default:
1850
-
1851
  $this->errors->add('form-validation', __('WP All Import doesn\'t support this import type.', 'wp_all_import_plugin'));
1852
-
1853
  break;
1854
  }
1855
 
1856
  $is_validate_file = apply_filters('wp_all_import_is_validate_file_options_update', true, $this->data['import']->id);
1857
 
1858
- if ($upload_result instanceof WP_Error){
1859
- $this->errors = $upload_result;
1860
- }
1861
- elseif ($upload_result !== false and $this->data['import']['path'] != $filePath and $is_validate_file) {
1862
 
1863
  $file = new PMXI_Chunk($upload_result['filePath'], array('element' => ( ! empty($this->data['import']->root_element)) ? $this->data['import']->root_element : ''));
1864
 
@@ -1926,18 +2091,11 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1926
  if ($loop) $this->data['import']->set(array('count' => $loop))->save();
1927
  }
1928
  }
1929
-
1930
- $upload_result['root_element'] = $root_element;
1931
-
1932
- $post['delimiter'] = ( ! empty($upload_result['is_csv']) ) ? $upload_result['is_csv'] : '';
1933
-
1934
- }
1935
- else{
1936
  $this->warnings->add('root-element-validation', __('Root element not found for uploaded feed.', 'wp_all_import_plugin'));
1937
  }
1938
-
1939
  }
1940
-
1941
  }
1942
 
1943
  $this->errors = apply_filters('pmxi_options_validation', $this->errors, $post, isset($this->data['import']) ? $this->data['import'] : false);
@@ -1953,7 +2111,11 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1953
 
1954
  PMXI_Plugin::$session->save_data();
1955
 
1956
- // update import template with final settings
 
 
 
 
1957
  if ( PMXI_Plugin::$session->saved_template ){
1958
  $template = new PMXI_Template_Record();
1959
  $template->getById(PMXI_Plugin::$session->saved_template)->set(array(
@@ -1975,15 +2137,6 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
1975
  'friendly_name' => wp_all_import_clear_xss($this->data['post']['friendly_name']),
1976
  )
1977
  )->save();
1978
-
1979
- $history_file = new PMXI_File_Record();
1980
- $history_file->set(array(
1981
- 'name' => $import->name,
1982
- 'import_id' => $import->id,
1983
- 'path' => wp_all_import_get_relative_path(PMXI_Plugin::$session->filePath),
1984
- //'contents' => $this->get_xml(),
1985
- 'registered_on' => date('Y-m-d H:i:s'),
1986
- ))->save();
1987
 
1988
  wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmxi_nt' => urlencode($is_update ? __('Import updated', 'wp_all_import_plugin') : __('Import created', 'wp_all_import_plugin'))), admin_url('admin.php'))); die();
1989
  }
@@ -2018,11 +2171,34 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2018
  'path' => $filePath,
2019
  );
2020
  break;
2021
- default:
 
2022
 
2023
- $this->errors->add('form-validation', __('WP All Import doesn\'t support this import type.', 'wp_all_import_plugin'));
2024
-
2025
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2026
  }
2027
 
2028
  $source['path'] = wp_all_import_get_relative_path($source['path']);
@@ -2052,69 +2228,107 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2052
  'name' => $this->data['import']->name,
2053
  'import_id' => $this->data['import']->id,
2054
  'path' => wp_all_import_get_relative_path($upload_result['filePath']),
2055
- //'contents' => $this->get_xml(),
2056
  'registered_on' => date('Y-m-d H:i:s')
2057
- ))->save();
2058
-
2059
  }
2060
 
2061
  if ( ! $this->warnings->get_error_codes()) {
2062
-
2063
- $this->data['import']->set($source)->save();
2064
-
2065
  wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmxi_nt' => urlencode(__('Configuration updated', 'wp_all_import_plugin'))) + array_intersect_key($_GET, array_flip($this->baseUrlParamNames)), admin_url('admin.php'))); die();
2066
- }
2067
- else{
2068
-
2069
  $source['root_element'] = $upload_result['root_element'];
2070
-
2071
- PMXI_Plugin::$session->set('source', $source);
2072
-
2073
  $this->data['import']->set( array_merge($source, array('xpath' => '/' . $upload_result['root_element'])) )->save();
2074
-
2075
  }
2076
  }
2077
  }
2078
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2079
 
2080
- PMXI_Plugin::$session->save_data();
 
 
 
 
2081
 
2082
- $this->data['existing_meta_keys'] = array();
2083
-
2084
- if ( ! in_array($post['custom_type'], array('import_users', 'shop_customer'))){
2085
-
2086
- global $wpdb;
2087
-
2088
- // Get all meta keys for requested post type
2089
- $hide_fields = array('_edit_lock', '_edit_last', '_wp_trash_meta_status', '_wp_trash_meta_time');
2090
- $records = get_posts( array('post_type' => $post['custom_type']) );
2091
- if ( ! empty($records)){
2092
- foreach ($records as $record) {
2093
- $record_meta = get_post_meta($record->ID, '');
2094
- if ( ! empty($record_meta)){
2095
- foreach ($record_meta as $record_meta_key => $record_meta_value) {
2096
- if ( ! in_array($record_meta_key, $this->data['existing_meta_keys']) and ! in_array($record_meta_key, $hide_fields)) $this->data['existing_meta_keys'][] = $record_meta_key;
2097
  }
2098
  }
2099
  }
2100
- }
2101
 
2102
- $this->data['existing_meta_keys'] = apply_filters('wp_all_import_existing_meta_keys', $this->data['existing_meta_keys'], $post['custom_type']);
2103
-
2104
- // Get existing product attributes
2105
- $existing_attributes = $wpdb->get_results("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '_product_attributes' LIMIT 0 , 50" );
2106
- $this->data['existing_attributes'] = array();
2107
- if ( ! empty($existing_attributes)){
2108
- foreach ($existing_attributes as $key => $existing_attribute) {
2109
- $existing_attribute = maybe_unserialize($existing_attribute->meta_value);
2110
- if (!empty($existing_attribute) and is_array($existing_attribute)):
2111
- foreach ($existing_attribute as $key => $value) {
2112
- if (strpos($key, "pa_") === false and ! in_array($key, $this->data['existing_attributes'])) $this->data['existing_attributes'][] = $key;
2113
- }
2114
- endif;
 
2115
  }
2116
- }
2117
- }
2118
 
2119
  $this->render();
2120
  }
@@ -2126,21 +2340,23 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2126
 
2127
  $default = PMXI_Plugin::get_default_import_options();
2128
 
2129
- $this->data['source'] = PMXI_Plugin::$session->source;
2130
- $this->data['locfilePath'] = PMXI_Plugin::$session->filePath;
2131
  $this->data['count'] = PMXI_Plugin::$session->count;
2132
  $this->data['xpath'] = PMXI_Plugin::$session->xpath;
 
 
 
 
2133
  $this->data['isWizard'] = true;
2134
  $DefaultOptions = (isset(PMXI_Plugin::$session->options) ? PMXI_Plugin::$session->options : array()) + $default;
2135
  foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
2136
  if (class_exists($class)) $DefaultOptions += call_user_func(array($class, "get_default_import_options"));
2137
  }
2138
 
2139
- if ($this->isWizard and ! in_array(PMXI_Plugin::$session->options['custom_type'], array('import_users', 'shop_order'))){
2140
  if (empty(PMXI_Plugin::$session->options['title']))
2141
- $this->warnings->add('form-validation', __('<strong>Warning:</strong> your title is blank.'));
2142
- if (empty(PMXI_Plugin::$session->options['content']))
2143
- $this->warnings->add('form-validation', __('<strong>Warning:</strong> your content is blank.'));
2144
  }
2145
 
2146
  $this->data['post'] =& $DefaultOptions;
@@ -2211,8 +2427,29 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2211
  ))->update();
2212
  }
2213
 
2214
- // add history log
2215
- $custom_type = get_post_type_object( $import->options['custom_type'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2216
 
2217
  // Unlink previous logs.
2218
  $by = array();
@@ -2239,8 +2476,14 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2239
 
2240
  PMXI_Plugin::$session->set('history_id', $history_log->id);
2241
 
2242
- foreach ( get_taxonomies() as $tax )
2243
- delete_transient("pmxi_{$tax}_terms");
 
 
 
 
 
 
2244
 
2245
  do_action( 'pmxi_before_xml_import', $import->id );
2246
 
@@ -2289,7 +2532,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2289
  Splitting the file into pieces means that, for example, instead of having to read 19000 records into a 20000 record file when importing the last 1000 records,
2290
  WP All Import will just split it into 20 chunks, and then read the last chunk from the beginning.
2291
  */
2292
- if ( "ajax" == $import->options['import_processing'] and $import->count > PMXI_Plugin::getInstance()->getOption('large_feed_limit') and $import->options['chuncking'] ){
2293
 
2294
  $chunk_files = array();
2295
 
@@ -2348,7 +2591,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2348
  }
2349
  }
2350
 
2351
- $this->data['ajax_processing'] = ("ajax" == $import->options['import_processing']) ? true : false;
2352
 
2353
  $this->render();
2354
  wp_ob_end_flush_all(); flush();
@@ -2356,7 +2599,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2356
 
2357
  $import_id = $input->get('id', 0);
2358
 
2359
- if ( "ajax" == $import->options['import_processing'] and ! $import_id){
2360
  PMXI_Plugin::$session->convertData($import->id);
2361
  }
2362
  }
@@ -2366,7 +2609,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2366
  $import->getById($import_id);
2367
  }
2368
 
2369
- $ajax_processing = ("ajax" == $import->options['import_processing']) ? true : false;
2370
 
2371
  if ( PMXI_Plugin::is_ajax() and $ajax_processing and ! check_ajax_referer( 'wp_all_import_secure', 'security', false )){
2372
  exit( __('Security check', 'wp_all_import_plugin') );
@@ -2374,8 +2617,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2374
 
2375
  if ($ajax_processing) {
2376
  $logger = function($m) {echo "<div class='progress-msg'>[". date("H:i:s") ."] $m</div>\n";flush();};
2377
- }
2378
- else {
2379
  $logger = function($m) {echo "<div class='progress-msg'>$m</div>\n"; if ( "" != strip_tags(wp_all_import_strip_tags_content($m))) { PMXI_Plugin::$session->log .= "<p>".strip_tags(wp_all_import_strip_tags_content($m))."</p>"; flush(); }};
2380
  }
2381
 
@@ -2392,7 +2634,12 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2392
  wp_defer_term_counting(true);
2393
  wp_defer_comment_counting(true);
2394
 
2395
- if ( PMXI_Plugin::is_ajax() or ! $ajax_processing ) {
 
 
 
 
 
2396
 
2397
  $iteration_start_time = time();
2398
 
@@ -2436,7 +2683,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2436
  }
2437
 
2438
  $records_per_request = ( ! $ajax_processing and $import->options['records_per_request'] < 50 ) ? 50 : $import->options['records_per_request'];
2439
-
2440
  if (!empty(PMXI_Plugin::$session->local_paths)) {
2441
 
2442
  if (!empty($records) && $import->queue_chunk_number < $records[0] && strpos($import->xpath, "[") === false && ! $import->options['is_delete_missing']) {
@@ -2519,9 +2766,29 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2519
  $feed = "<?xml version=\"1.0\" encoding=\"". $import->options['encoding'] ."\"?>" . "\n" . "<pmxi_records>";
2520
  $loop = 0;
2521
  } else {
2522
-
2523
- if ( ! $history_log->isEmpty()){
2524
- $custom_type = get_post_type_object( $import->options['custom_type'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2525
  $history_log->set(array(
2526
  'time_run' => time() - strtotime($history_log->date),
2527
  'summary' => sprintf(__("%d %s created %d updated %d deleted %d skipped", "wp_all_import_plugin"), $import->created, ( ($import->created == 1) ? $custom_type->labels->singular_name : $custom_type->labels->name ), $import->updated, $import->deleted, $import->skipped)
@@ -2593,7 +2860,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2593
  'updated' => $import->updated,
2594
  'skipped' => $import->skipped,
2595
  'skipped_by_hash' => PMXI_Plugin::$session->skipped,
2596
- 'deleted' => $import->deleted,
2597
  'percentage' => 99,
2598
  'warnings' => PMXI_Plugin::$session->warnings,
2599
  'errors' => PMXI_Plugin::$session->errors,
@@ -2612,19 +2879,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2612
  'queue_chunk_number' => 0,
2613
  'registered_on' => date('Y-m-d H:i:s'),
2614
  'iteration' => ++$import->iteration
2615
- ))->update();
2616
-
2617
- if ("ajax" != $import->options['import_processing'] and $log_storage ){
2618
- $log_file = wp_all_import_secure_file( $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::LOGS_DIRECTORY, $history_log->id ) . DIRECTORY_SEPARATOR . $history_log->id . '.html';
2619
- if (PMXI_Plugin::$session->action != 'continue'){
2620
- @file_put_contents($log_file, PMXI_Plugin::$session->log);
2621
- }
2622
- else{
2623
- $log = @fopen($log_file, 'a+');
2624
- @fwrite($log, PMXI_Plugin::$session->log);
2625
- @fclose($log);
2626
- }
2627
- }
2628
 
2629
  foreach ( get_taxonomies() as $tax ) {
2630
  delete_option( "{$tax}_children" );
@@ -2639,8 +2894,29 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
2639
  wp_defer_term_counting(false);
2640
  wp_defer_comment_counting(false);
2641
 
2642
- // add history log
2643
- $custom_type = get_post_type_object( $import->options['custom_type'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2644
  $history_log->set(array(
2645
  'time_run' => time() - strtotime($history_log->date),
2646
  'summary' => sprintf(__("%d %s created %d updated %d deleted %d skipped", "pmxi_plugin"), $import->created, ( ($import->created == 1) ? $custom_type->labels->singular_name : $custom_type->labels->name ), $import->updated, $import->deleted, $import->skipped)
@@ -2761,7 +3037,7 @@ COMPLETE;
2761
  return $xml;
2762
  }
2763
 
2764
- /**
2765
  * @return string
2766
  */
2767
  private function findUniqueKey()
1
  <?php
2
  /**
3
  * Import configuration wizard
4
+ *
5
+ * @author Pavel Kulbakin <p.kulbakin@gmail.com>
6
  */
7
 
8
  class PMXI_Admin_Import extends PMXI_Controller_Admin {
124
  'url' => '',
125
  'ftp_host' => '',
126
  'ftp_path' => '',
127
+ 'ftp_root' => '/',
128
  'ftp_port' => '21',
129
  'ftp_username' => '',
130
  'ftp_password' => '',
165
  } else {
166
  $DefaultOptions = (PMXI_Plugin::$session->has_session() && !empty(PMXI_Plugin::$session->first_step) ? PMXI_Plugin::$session->first_step : array()) + $DefaultOptions;
167
  }
168
+
169
  $this->data['post'] = $post = $this->input->post( $DefaultOptions );
170
 
171
  if ( ! class_exists('DOMDocument') or ! class_exists('XMLReader') ) {
178
 
179
  check_admin_referer('choose-file', '_wpnonce_choose-file');
180
 
181
+ if ('upload' == $this->input->post('type')) {
 
182
  $uploader = new PMXI_Upload($post['filepath'], $this->errors, rtrim(str_replace(basename($post['filepath']), '', $post['filepath']), '/'));
183
+ $upload_result = $uploader->upload();
184
+ if ($upload_result instanceof WP_Error) {
 
185
  $this->errors = $upload_result;
186
+ } else {
 
187
  $source = $upload_result['source'];
188
  $filePath = $upload_result['filePath'];
189
  $post['template'] = $upload_result['template'];
191
  if ( ! empty($upload_result['root_element']))
192
  $post['root_element'] = $upload_result['root_element'];
193
  }
194
+ } elseif ('url' == $this->input->post('type')) {
195
+ $post['url'] = trim($post['url']);
196
+ if ( ! empty($post['downloaded']) ){
197
+ $downloaded = json_decode($post['downloaded'], true);
198
+ $source = $downloaded['source'];
199
+ $filePath = $downloaded['filePath'];
200
+ $post['template'] = $downloaded['template'];
201
+ PMXI_Plugin::$csv_path = $downloaded['csv_path'];
202
+ PMXI_Plugin::$is_csv = $downloaded['is_csv'];
203
+ if ( ! empty($downloaded['root_element']))
204
+ $post['root_element'] = $downloaded['root_element'];
205
+ $post['feed_type'] = $downloaded['feed_type'];
206
+ } else {
207
+ $uploader = new PMXI_Upload($post['url'], $this->errors);
208
+ $upload_result = $uploader->url($post['feed_type']);
209
+ if ($upload_result instanceof WP_Error) {
210
+ $this->errors = $upload_result;
211
+ } else {
212
+ $source = $upload_result['source'];
213
+ $filePath = $upload_result['filePath'];
214
+ $post['template'] = $upload_result['template'];
215
+ PMXI_Plugin::$csv_path = $upload_result['csv_path'];
216
+ PMXI_Plugin::$is_csv = $upload_result['is_csv'];
217
+ if ( ! empty($upload_result['root_element']))
218
+ $post['root_element'] = $upload_result['root_element'];
219
+ $post['feed_type'] = $upload_result['feed_type'];
220
+ }
221
+ }
222
+ } elseif ( 'ftp' == $this->input->post('type')) {
223
+ if ( ! empty($post['downloaded']) ){
224
+ $downloaded = json_decode($post['downloaded'], true);
225
+ $source = $downloaded['source'];
226
+
227
+ $filePath = $downloaded['filePath'];
228
+ $post['template'] = $downloaded['template'];
229
+ PMXI_Plugin::$csv_path = $downloaded['csv_path'];
230
+ PMXI_Plugin::$is_csv = $downloaded['is_csv'];
231
+ if ( ! empty($downloaded['root_element']))
232
+ $post['root_element'] = $downloaded['root_element'];
233
+ $post['feed_type'] = $downloaded['feed_type'];
234
+ } else {
235
+ try {
236
+ $files = PMXI_FTPFetcher::fetch($post);
237
+ $uploader = new PMXI_Upload($files[0], $this->errors, rtrim(str_replace(basename($files[0]), '', $files[0]), '/'));
238
+ $upload_result = $uploader->upload();
239
+ if (!$this->errors->get_error_codes()) {
240
+ $source = $upload_result['source'];
241
+ $filePath = $upload_result['filePath'];
242
+ $post['template'] = $upload_result['template'];
243
+ PMXI_Plugin::$csv_path = $upload_result['csv_path'];
244
+ PMXI_Plugin::$is_csv = $upload_result['is_csv'];
245
+ if ( ! empty($upload_result['root_element']))
246
+ $post['root_element'] = $upload_result['root_element'];
247
+ $post['feed_type'] = $upload_result['feed_type'];
248
+ }
249
+ } catch (Exception $e) {
250
+ $this->errors->add('form-validation', $e->getMessage());
251
+ }
252
+ }
253
+ $source['type'] = 'ftp';
254
+ } elseif ('file' == $this->input->post('type')) {
255
+
256
+ $uploader = new PMXI_Upload($post['file'], $this->errors);
257
+ $upload_result = $uploader->file();
258
+ if ($upload_result instanceof WP_Error) {
259
+ $this->errors = $upload_result;
260
+ } else {
261
+ $source = $upload_result['source'];
262
+ $filePath = $upload_result['filePath'];
263
+ $post['template'] = $upload_result['template'];
264
+ PMXI_Plugin::$is_csv = $upload_result['is_csv'];
265
+ if ( ! empty($upload_result['root_element']))
266
+ $post['root_element'] = $upload_result['root_element'];
267
+ }
268
+ }
269
 
270
  if ($this->input->post('is_submitted') and '' == $this->input->post('custom_type')) {
271
  $this->errors->add('form-validation', __('Select an item type to import the data', 'wp_all_import_plugin'));
272
  }
 
273
  if ($post['is_update_previous'] and empty($post['update_previous'])) {
274
  $this->errors->add('form-validation', __('Previous import for update must be selected to proceed with a new one', 'wp_all_import_plugin'));
275
  }
276
+ if ( 'taxonomies' == $this->input->post('custom_type') and '' == $this->input->post('taxonomy_type')){
277
+ $this->errors->add('form-validation', __('Select a taxonomy to import the data', 'wp_all_import_plugin'));
278
+ }
279
+ $this->data['detection_feed_extension'] = false;
280
  $elements_cloud = array();
281
 
282
+ @set_time_limit(0);
283
+ $deligate = $this->input->get('deligate', false);
 
 
 
 
284
  $redirect_to_template = false;
 
285
  $importRecord = new PMXI_Import_Record();
286
 
287
  switch ( $deligate ) {
 
288
  case 'wpallexport':
 
 
 
289
  $import_id = $this->input->get('id', 0);
 
290
  $importRecord->clear();
291
  $importRecord->getById($import_id);
292
+ if ( ! $importRecord->isEmpty() and ! empty($importRecord->options['unique_key'])) {
 
 
293
  $importRecord->set(array(
294
  'path' => wp_all_import_get_relative_path($filePath),
295
  'parent_import_id' => 0
296
  ))->save();
 
297
  $post['is_update_previous'] = 1;
298
  $post['update_previous'] = $importRecord->id;
 
 
299
  $redirect_to_template = true;
300
  }
301
 
302
  if ( $importRecord->isEmpty() ){
303
  $this->errors->add('form-validation', __('File is no longer in the correct format', 'wp_all_import_plugin'));
304
+ } elseif (empty($importRecord->options['unique_key'])) {
 
305
  $this->errors->add('form-validation', __('Certain columns are required to be present in your file to enable it to be re-imported with WP All Import. These columns are missing. Re-export your file using WP All Export, and don\'t delete any of the columns when editing it. Then, re-import will work correctly.', 'wp_all_import_plugin'));
306
+ } elseif($importRecord->options['custom_type'] == 'import_users' && ! class_exists('PMUI_Plugin')){
307
+ $this->errors->add('form-validation', __('<p>The import template you are using requires the User Add-On.</p><a href="http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin" target="_blank">Purchase the User Add-On</a>', 'wp_all_import_plugin'));
308
+ } elseif($importRecord->options['custom_type'] == 'shop_customer' && ! class_exists('PMUI_Plugin')){
309
+ $this->errors->add('form-validation', __('<p>The import template you are using requires the User Add-On.</p><a href="http://www.wpallimport.com/add-ons/user-import/?utm_source=wordpress.org&utm_medium=wpai-import-template&utm_campaign=free+wp+all+export+plugin" target="_blank">Purchase the User Add-On</a>', 'wp_all_import_plugin'));
310
  }
 
 
 
 
 
 
 
311
  break;
312
 
313
  default:
315
  break;
316
  }
317
 
318
+ $local_paths = !empty($local_paths) ? $local_paths : array($filePath);
 
 
 
 
 
 
 
 
 
 
319
 
320
+ foreach ($local_paths as $key => $path) {
 
321
  if ( @file_exists($path) ){
 
322
  $file = new PMXI_Chunk($path, array('element' => $post['root_element'], 'get_cloud' => true));
323
+ if ( ! empty($file->options['element']) ) {
 
 
324
  $xpath = "/" . $file->options['element'];
325
+ $elements_cloud = $file->cloud;
326
+ if ( ! empty($elements_cloud) and class_exists('PMXE_Plugin') and ! $importRecord->isEmpty() ) {
 
 
 
327
  $is_file_valid = apply_filters('wp_all_import_is_exported_file_valid', true, $importRecord->options['export_id'], $elements_cloud);
328
+ if ( ! $is_file_valid ) {
 
 
329
  $this->errors->add('form-validation', __('Certain columns are required to be present in your file to enable it to be re-imported with WP All Import. These columns are missing. Re-export your file using WP All Export, and don\'t delete any of the columns when editing it. Then, re-import will work correctly.', 'wp_all_import_plugin'));
330
  }
 
331
  }
332
+ if ( ($redirect_to_template or $post['auto_generate']) and ! $this->errors->get_error_codes() ) {
 
 
333
  // loop through the file until all lines are read
334
  while ($xml = $file->read()) {
335
+ if ( ! empty($xml) ) {
 
 
336
  //PMXI_Import_Record::preprocessXml($xml);
337
  $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" . "\n" . $xml;
 
338
  $dom = new DOMDocument('1.0', 'UTF-8');
339
  $old = libxml_use_internal_errors(true);
340
  $dom->loadXML($xml);
341
  libxml_use_internal_errors($old);
342
  $dxpath = new DOMXPath($dom);
343
 
344
+ if (($elements = @$dxpath->query($xpath)) and $elements->length) {
 
345
  if ( empty($chunks) ) {
346
  $chunks = 0;
347
  }
 
348
  $chunks += $elements->length;
 
349
  unset($dom, $dxpath, $elements);
 
350
  }
351
  }
352
  }
353
  //unset($file);
354
  }
 
355
  break;
356
+ }
357
+ } else {
358
+ $this->errors->add('form-validation', __('Unable to download feed resource.', 'wp_all_import_plugin'));
359
+ }
360
  }
361
 
362
  if ( ! $this->errors->get_error_codes() ) {
374
  'feed_type' => $post['feed_type'],
375
  'wizard_type' => $post['wizard_type'],
376
  'custom_type' => $post['custom_type'],
377
+ 'taxonomy_type' => $post['taxonomy_type'],
378
+ 'ftp_host' => $post['ftp_host'],
379
+ 'ftp_path' => $post['ftp_path'],
380
+ 'ftp_root' => $post['ftp_root'],
381
+ 'ftp_port' => $post['ftp_port'],
382
+ 'ftp_username' => $post['ftp_username'],
383
+ 'ftp_password' => $post['ftp_password'],
384
+ 'ftp_private_key' => $post['ftp_private_key'],
385
+ 'source' => $source,
386
  'encoding' => 'UTF-8',
387
  'is_csv' => PMXI_Plugin::$is_csv,
388
  'csv_path' => PMXI_Plugin::$csv_path,
404
  );
405
 
406
  // apply options from WP All Export bundle
407
+ if ( ! empty($post['template'])) {
 
408
  $templates = json_decode($post['template'], true);
409
  $template_options = maybe_unserialize($templates[0]['options']);
410
  $template_options['type'] = ($post['custom_type'] == 'page') ? 'page' : 'post';
411
  $template_options['custom_type'] = $post['custom_type'];
412
+ $template_options['wizard_type'] = $post['wizard_type'];
 
413
  if ($post['wizard_type'] == 'new') {
414
  $template_options['create_new_records'] = 1;
415
  }
 
416
  $this->data['post'] = $template_options;
 
417
  PMXI_Plugin::$session->set('options', $template_options);
418
  }
419
 
428
  PMXI_Plugin::$session->set('options', $update_previous->options);
429
  } else {
430
  PMXI_Plugin::$session->set('update_previous', '');
431
+ }
432
 
433
  PMXI_Plugin::$session->save_data();
434
 
435
  $xml = $this->get_xml();
436
 
437
+ if ( empty($xml) ) {
 
438
  $this->errors->add('upload-validation', __('Please confirm you are importing a valid feed.<br/> Often, feed providers distribute feeds with invalid data, improperly wrapped HTML, line breaks where they should not be, faulty character encodings, syntax errors in the XML, and other issues.<br/><br/>WP All Import has checks in place to automatically fix some of the most common problems, but we can’t catch every single one.<br/><br/>It is also possible that there is a bug in WP All Import, and the problem is not with the feed.<br/><br/>If you need assistance, please contact support – <a href="mailto:support@wpallimport.com">support@wpallimport.com</a> – with your XML/CSV file. We will identify the problem and release a bug fix if necessary.', 'wp_all_import_plugin'));
439
  $this->data['upload_validation'] = true;
440
+ } elseif( $redirect_to_template ) {
 
 
441
  wp_redirect(add_query_arg('action', 'template', $this->baseUrl)); die();
442
+ } elseif( $post['auto_generate'] ) {
 
 
443
  wp_redirect(add_query_arg('action', 'options', $this->baseUrl)); die();
444
+ } else {
 
 
445
  wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
446
  }
447
+ } else if ('url' == $this->input->post('type') and !empty($this->errors)) {
 
 
 
448
  $this->errors->add('form-validation', __('WP All Import unable to detect file type.<br/><br/>WP All Import not able to determine what type of file you are importing. Make sure your file extension is correct for the file type you are importing.<br/> Please choose the correct file type from the dropdown below, or try adding &type=xml or &type=csv to the end of the URL, for example http://example.com/export-products.php?&type=xml', 'wp_all_import_plugin'));
449
  $this->data['detection_feed_extension'] = true;
450
+ } else {
 
 
451
  $this->errors->add('upload-validation', __('Please confirm you are importing a valid feed.<br/> Often, feed providers distribute feeds with invalid data, improperly wrapped HTML, line breaks where they should not be, faulty character encodings, syntax errors in the XML, and other issues.<br/><br/>WP All Import has checks in place to automatically fix some of the most common problems, but we can’t catch every single one.<br/><br/>It is also possible that there is a bug in WP All Import, and the problem is not with the feed.<br/><br/>If you need assistance, please contact support – <a href="mailto:support@wpallimport.com">support@wpallimport.com</a> – with your XML/CSV file. We will identify the problem and release a bug fix if necessary.', 'wp_all_import_plugin'));
452
  $this->data['upload_validation'] = true;
453
  }
 
454
  do_action("pmxi_get_file", $filePath);
455
  }
456
+ if ($this->input->post('is_submitted') and $this->errors->get_error_codes()) {
457
+ PMXI_Plugin::$session->clean_session();
458
+ }
459
  $this->render();
460
  }
461
 
462
  /**
463
  * Step #2: Choose elements
464
  */
465
+ public function element() {
 
466
  $xpath = new DOMXPath($this->data['dom']);
467
  $post = $this->input->post(array('xpath' => ''));
468
  $this->data['post'] =& $post;
469
  $this->data['elements_cloud'] = PMXI_Plugin::$session->elements_cloud;
470
  $this->data['is_csv'] = PMXI_Plugin::$session->is_csv;
 
 
471
 
472
  if ($this->input->post('is_submitted')) {
473
  check_admin_referer('choose-elements', '_wpnonce_choose-elements');
475
  $this->errors->add('form-validation', __('No elements selected', 'wp_all_import_plugin'));
476
  } else {
477
  $node_list = @ $xpath->query($post['xpath']); // make sure only element selection is allowed; prevent parsing warning to be displayed
 
478
  if (FALSE === $node_list) {
479
  $this->errors->add('form-validation', __('Your XPath is not valid.', 'wp_all_import_plugin'));
480
  } else {
486
  }
487
  }
488
  }
 
489
  if ( ! $this->errors->get_error_codes()) {
 
490
  wp_redirect(apply_filters('pmxi_element_redirect' , add_query_arg('action', 'template', $this->baseUrl))); die();
 
491
  }
 
492
  } else {
 
493
  if ( PMXI_Plugin::$session->xpath ) {
494
  $post['xpath'] = PMXI_Plugin::$session->xpath;
495
  $this->data['elements'] = $elements = $xpath->query($post['xpath']);
514
  $this->data['elements'] = $elements = $xpath->query($post['xpath']);
515
  }
516
  }
 
517
  }
 
518
  // workaround to prevent rendered XML representation to eat memory since it has to be stored in memory when output is bufferred
519
  $this->render();
 
520
  }
521
 
522
  /**
523
  * Helper to evaluate xpath and return matching elements as direct paths for javascript side to highlight them
524
  */
525
+ public function evaluate() {
 
526
 
527
  if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
528
  wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
731
  /**
732
  * Preview selected xml tag (called with ajax from `template` step)
733
  */
734
+ public function tag( $is_json = true ) {
 
735
 
736
  if ($is_json) check_ajax_referer( 'wp_all_import_secure', 'security' );
737
 
738
+ if (empty($this->data['elements']->length)) {
 
 
 
739
  $update_previous = new PMXI_Import_Record();
740
  $id = $this->input->get('id');
741
  if ($id and $update_previous->getById($id)) {
755
  PMXI_Plugin::$session->set('encoding', ( ! empty($update_previous->options['encoding'])) ? $update_previous->options['encoding'] : 'UTF-8');
756
  PMXI_Plugin::$session->save_data();
757
  }
758
+ }
 
759
  } else {
760
  unset(PMXI_Plugin::$session->update_previous);
761
  }
765
 
766
  $this->data['import_action'] = $this->input->getpost('import_action', false);
767
 
768
+ if ($this->data['tagno']) {
769
+ $local_paths = ( ! empty(PMXI_Plugin::$session->local_paths) ) ? PMXI_Plugin::$session->local_paths : array(PMXI_Plugin::$session->filePath);
 
 
770
  PMXI_Plugin::$session->set('local_paths', $local_paths);
 
771
  $loop = 0;
772
+ foreach ($local_paths as $key => $path) {
773
+ if (@file_exists($path)){
 
 
 
774
  $file = new PMXI_Chunk($path, array(
775
  'element' => PMXI_Plugin::$session->source['root_element'],
776
  'encoding' => PMXI_Plugin::$session->encoding
777
  ));
 
778
  // loop through the file until all lines are read
779
+ while ($xml = $file->read()) {
780
+ if ( ! empty($xml) ) {
 
 
781
  //PMXI_Import_Record::preprocessXml($xml);
782
+ $xml = "<?xml version=\"1.0\" encoding=\"". PMXI_Plugin::$session->encoding ."\"?>" . "\n" . $xml;
 
783
  $dom = new DOMDocument('1.0', PMXI_Plugin::$session->encoding);
784
  $old = libxml_use_internal_errors(true);
785
  $dom->loadXML($xml);
821
  /**
822
  * Preview future post based on current template and tag (called with ajax from `template` step)
823
  */
824
+ public function preview() {
 
825
 
826
  if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
827
  exit('Nice try!');
855
 
856
  if (PMXI_Plugin::$session->encoding != $post['import_encoding'] and ! empty(PMXI_Plugin::$session->csv_paths[$key])){
857
  // conver CSV to XML with selected encoding
858
+ include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
 
859
  $csv = new PMXI_CsvParser(array(
860
  'filename' => PMXI_Plugin::$session->csv_paths[$key],
861
  'xpath' => '',
873
  // loop through the file until all lines are read
874
  while ($xml = $file->read()) {
875
 
876
+ if ( ! empty($xml) ) {
 
877
  //PMXI_Import_Record::preprocessXml($xml);
878
  $xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
879
 
882
  $dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
883
  libxml_use_internal_errors($old);
884
  $xpath = new DOMXPath($dom);
885
+ if (($this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->xpath)) and $elements->length){
886
+
887
+ if ( $loop == $tagno ){
888
+ /* Merge nested XML/CSV files */
889
+ /*$nested_files = json_decode(PMXI_Plugin::$session->options['nested_files'], true);
890
+ if ( ! empty($nested_files) ){
891
+ $merger = new PMXI_Nested($dom, $nested_files, $xml, PMXI_Plugin::$session->xpath);
892
+ $merger->merge();
893
+ $xml = $merger->get_xml();
894
+ unset($merger);
895
+ }*/
896
+ unset($dom, $xpath, $elements);
897
+ break(2);
898
+ }
899
+ unset($dom, $xpath, $elements);
900
+ $loop++;
901
  }
902
  }
903
  }
904
  unset($file);
905
  }
906
+
907
+ $xpath = "(" . PMXI_Plugin::$session->xpath . ")[1]";
908
+
909
+ // validate root XPath
910
+ try{
911
+ list($this->data['title']) = XmlImportParser::factory($xml, $xpath, $post['title'], $file)->parse(); unlink($file);
912
+ }
913
+ catch(XmlImportException $e){
914
+ $xpath = PMXI_Plugin::$session->xpath;
915
+ }
916
+
917
  PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
918
+ PMXI_Plugin::$session->save_data();
919
+
920
+ $functions = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php';
921
+ $functions = apply_filters( 'import_functions_file_path', $functions );
922
+ if ( @file_exists($functions) && PMXI_Plugin::$is_php_allowed)
923
+ require_once $functions;
924
+
925
  // validate
926
  try {
927
  if (empty($xml)){
965
  /**
966
  * Preview future post images based on current template and tag (called with ajax from `template` step)
967
  */
968
+ public function preview_images() {
 
969
  if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
970
  exit('Nice try!');
971
  }
1004
  foreach ($local_paths as $key => $path) {
1005
 
1006
  if (PMXI_Plugin::$session->encoding != $post['import_encoding'] and ! empty(PMXI_Plugin::$session->csv_paths[$key])){
1007
+ // convert CSV to XML with selected encoding
1008
+ include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
 
 
1009
  $csv = new PMXI_CsvParser(array(
1010
  'filename' => PMXI_Plugin::$session->csv_paths[$key],
1011
  'xpath' => '',
1012
  'delimiter' => PMXI_Plugin::$is_csv,
1013
  'encoding' => $post['import_encoding'],
1014
  'xml_path' => $path
1015
+ ));
 
1016
  }
1017
 
1018
  $file = new PMXI_Chunk($path, array('element' => (!empty($this->data['update_previous']->root_element)) ? $this->data['update_previous']->root_element : PMXI_Plugin::$session->source['root_element'], 'encoding' => $post['import_encoding']));
1019
 
1020
  // loop through the file until all lines are read
1021
  while ($xml = $file->read()) {
1022
+ if (!empty($xml)) {
 
1023
  //PMXI_Import_Record::preprocessXml($xml);
1024
  $xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
1025
 
1054
  $xpath = "(" . PMXI_Plugin::$session->xpath . ")[1]";
1055
 
1056
  PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
1057
+ PMXI_Plugin::$session->save_data();
1058
+
1059
+ $functions = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php';
1060
+ $functions = apply_filters( 'import_functions_file_path', $functions );
1061
+ if ( @file_exists($functions) && PMXI_Plugin::$is_php_allowed)
1062
+ require_once $functions;
1063
 
1064
  // validate
1065
+ try {
 
1066
  $this->data['featured_images'] = false;
 
1067
  if (empty($xml)){
1068
+ $this->errors->add('form-validation', __('WP All Import lost track of where you are.<br/><br/>Maybe you cleared your cookies or maybe it is just a temporary issue on your web host\'s end.', 'wp_all_import_plugin'));
1069
+ } else {
1070
+ switch ($post[$get['slug'] . 'download_images']) {
 
 
 
1071
  case 'no':
1072
  $featured_image = $post[$get['slug'] . 'featured_image'];
1073
  break;
1081
 
1082
  if (empty($featured_image)){
1083
  $this->data['featured_images'] = '';
1084
+ } else {
 
1085
  list($this->data['featured_images']) = XmlImportParser::factory($xml, $xpath, $featured_image, $file)->parse(); unlink($file);
1086
  }
1087
+ }
 
1088
  } catch (XmlImportException $e) {
1089
  $this->errors->add('form-validation', sprintf(__('Error parsing: %s', 'wp_all_import_plugin'), $e->getMessage()));
1090
  }
1098
  /**
1099
  * Preview taxonomies hierarchy based on current template and tag (called with ajax from `template` step)
1100
  */
1101
+ public function preview_taxonomies() {
 
1102
 
1103
  if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
1104
  exit('Nice try!');
1132
 
1133
  $loop = 1;
1134
  foreach ($local_paths as $key => $path) {
 
1135
  if (PMXI_Plugin::$session->encoding != $post['import_encoding'] and ! empty(PMXI_Plugin::$session->csv_paths[$key])){
1136
  // conver CSV to XML with selected encoding
1137
+ include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
 
1138
  $csv = new PMXI_CsvParser(array(
1139
  'filename' => PMXI_Plugin::$session->csv_paths[$key],
1140
  'xpath' => '',
1143
  'xml_path' => $path
1144
  ));
1145
  }
 
1146
  $file = new PMXI_Chunk($path, array('element' => (!empty($this->data['update_previous']->root_element)) ? $this->data['update_previous']->root_element : PMXI_Plugin::$session->source['root_element'], 'encoding' => $post['import_encoding']));
 
1147
  // loop through the file until all lines are read
1148
  while ($xml = $file->read()) {
1149
+ if (!empty($xml)) {
 
1150
  //PMXI_Import_Record::preprocessXml($xml);
1151
+ $xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
 
1152
  $dom = new DOMDocument('1.0', $post['import_encoding']);
1153
  $old = libxml_use_internal_errors(true);
1154
  $dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
1182
  PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
1183
  PMXI_Plugin::$session->save_data();
1184
 
1185
+ $wp_uploads = wp_upload_dir();
1186
+ $functions = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php';
1187
+ $functions = apply_filters( 'import_functions_file_path', $functions );
1188
+ if ( @file_exists($functions) && PMXI_Plugin::$is_php_allowed)
1189
+ require_once $functions;
1190
 
1191
  // validate
1192
  try {
1200
  foreach ($post['tax_hierarchical_xpath'][$ctx] as $ctx_path) { if (empty($ctx_path)) continue;
1201
  list($d) = XmlImportParser::factory($xml, $xpath, $ctx_path, $file)->parse(); unlink($file);
1202
  if ($post['is_tax_hierarchical_group_delim'][$ctx] and !empty($post['tax_hierarchical_group_delim'][$ctx])){
 
1203
  // apply mapping rules before splitting via separator symbol
1204
+ if ( ! empty($post['tax_enable_mapping'][$ctx]) and ! empty($post['tax_logic_mapping'][$ctx]) ){
1205
+ if ( ! empty($post['tax_mapping'][$ctx])){
1206
+ $mapping_rules = json_decode($post['tax_mapping'][$ctx], true);
1207
+ if ( ! empty( $mapping_rules) ){
1208
  foreach ($mapping_rules as $rule) {
1209
+ if ( ! empty($rule[trim($d)])){
1210
  $d = trim($rule[trim($d)]);
1211
  break;
1212
  }
1214
  }
1215
  }
1216
  }
 
1217
  $hierarchy_groups = explode($post['tax_hierarchical_group_delim'][$ctx], $d);
1218
  if (!empty($hierarchy_groups) and is_array($hierarchy_groups)){
1219
  foreach ($hierarchy_groups as $key => $group) {
1225
  $this->data['tax_hierarchical'][$ctx][] = $d;
1226
  }
1227
  }
 
1228
  $data_to_preview = true;
1229
  }
1230
  }
1244
  /**
1245
  * Preview prices based on current template and tag (called with ajax from `template` step)
1246
  */
1247
+ public function preview_prices() {
 
1248
 
1249
  if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
1250
  exit('Nice try!');
1334
  PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
1335
  PMXI_Plugin::$session->save_data();
1336
 
1337
+ $wp_uploads = wp_upload_dir();
1338
+ $functions = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php';
1339
+ $functions = apply_filters( 'import_functions_file_path', $functions );
1340
+ if ( @file_exists($functions) && PMXI_Plugin::$is_php_allowed)
1341
+ require_once $functions;
1342
 
1343
  // validate
1344
  try {
1376
  /**
1377
  * Step #3: Choose template
1378
  */
1379
+ public function template() {
 
1380
 
1381
  $template = new PMXI_Template_Record();
1382
 
1386
  $this->data['source_type'] = PMXI_Plugin::$session->source['type'];
1387
 
1388
  foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
1389
+ if (class_exists($class)) $default += call_user_func(array($class, "get_default_import_options"));
1390
  }
1391
  $default['wizard_type'] = PMXI_Plugin::$session->wizard_type;
1392
+ if (empty($default['custom_type'])) $default['custom_type'] = PMXI_Plugin::$session->custom_type;
1393
+ if (empty($default['taxonomy_type'])) $default['taxonomy_type'] = PMXI_Plugin::$session->taxonomy_type;
1394
+ if (empty($default['delimiter'])) $default['delimiter'] = PMXI_Plugin::$session->is_csv;
1395
+ if (empty($default['ftp_host'])) $default['ftp_host'] = PMXI_Plugin::$session->ftp_host;
1396
+ if (empty($default['ftp_path'])) $default['ftp_path'] = PMXI_Plugin::$session->ftp_path;
1397
+ $default['ftp_root'] = PMXI_Plugin::$session->ftp_root;
1398
+ if (empty($default['ftp_username'])) $default['ftp_username'] = PMXI_Plugin::$session->ftp_username;
1399
+ if (empty($default['ftp_password'])) $default['ftp_password'] = PMXI_Plugin::$session->ftp_password;
1400
+ if (empty($default['ftp_private_key'])) $default['ftp_private_key'] = PMXI_Plugin::$session->ftp_private_key;
1401
+ $default['ftp_port'] = PMXI_Plugin::$session->ftp_port;
1402
 
1403
  $DefaultOptions = (isset(PMXI_Plugin::$session->options)) ? array_replace_recursive($default, PMXI_Plugin::$session->options) : $default;
1404
 
1405
  $post = $this->input->post( apply_filters('pmxi_options_options', $DefaultOptions, $this->isWizard) );
1406
 
1407
  } else {
1408
+ $this->data['source_type'] = $this->data['import']->type;
 
1409
  foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
1410
  if (class_exists($class)) $default += call_user_func(array($class, "get_default_import_options"));
1411
  }
1412
+ $DefaultOptions = (is_array($this->data['import']->options)) ? array_replace_recursive($default, $this->data['import']->options) : $default;
 
 
1413
  $source = array(
1414
  'name' => $this->data['import']->name,
1415
  'type' => $this->data['import']->type,
1416
  'path' => wp_all_import_get_relative_path($this->data['import']->path),
1417
  'root_element' => $this->data['import']->root_element,
1418
  );
1419
+ PMXI_Plugin::$session->set('source', $source);
 
 
1420
  $post = $this->input->post( apply_filters('pmxi_options_options', $DefaultOptions, $this->isWizard) );
 
1421
  }
1422
 
1423
  $max_input_vars = @ini_get('max_input_vars');
1424
 
1425
+ if(ctype_digit($max_input_vars) && count($_POST, COUNT_RECURSIVE) >= $max_input_vars) {
 
1426
  $this->errors->add('form-validation', sprintf(__('You\'ve reached your max_input_vars limit of %d. Please increase this.', 'wp_all_export_plugin'), $max_input_vars));
1427
  }
1428
 
1437
  $template_options = $template->options;
1438
  $template_options['type'] = $post['type'];
1439
  $template_options['custom_type'] = $post['custom_type'];
1440
+ $template_options['taxonomy_type'] = $post['taxonomy_type'];
1441
  $template_options['wizard_type'] = $post['wizard_type'];
1442
  $template_options['delimiter'] = $post['delimiter'];
1443
+ $template_options['ftp_host'] = $post['ftp_host'];
1444
+ $template_options['ftp_path'] = $post['ftp_path'];
1445
+ $template_options['ftp_root'] = $post['ftp_root'];
1446
+ $template_options['ftp_port'] = $post['ftp_port'];
1447
+ $template_options['ftp_username'] = $post['ftp_username'];
1448
+ $template_options['ftp_password'] = $post['ftp_password'];
1449
+ $template_options['ftp_private_key'] = $post['ftp_private_key'];
1450
 
1451
  if ($this->isWizard and $post['wizard_type'] == 'new') {
1452
  $template_options['create_new_records'] = 1;
1453
  }
1454
+ if ($this->isWizard) {
1455
  $template_options['delimiter'] = PMXI_Plugin::$session->is_csv;
1456
  }
1457
 
1462
 
1463
  } elseif ($this->input->post('is_submitted')) { // save template submission
1464
 
1465
+ check_admin_referer('template', '_wpnonce_template');
1466
+
1467
+ $wp_uploads = wp_upload_dir();
1468
+ $functions = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php';
1469
+ $functions = apply_filters( 'import_functions_file_path', $functions );
1470
+ if ( @file_exists($functions) && PMXI_Plugin::$is_php_allowed)
1471
+ require_once $functions;
1472
 
1473
  if (!empty($post['title'])) {
1474
  $this->_validate_template($post['title'], 'Post title');
1475
  }
1476
+ elseif ( ! in_array($post['custom_type'], array('shop_order', 'taxonomies', 'import_users', 'shop_customer', 'comments', 'woo_reviews', 'gf_entries')) ){
1477
  $this->warnings->add('1', __('<strong>Warning:</strong> your title is blank.', 'wp_all_import_plugin'));
1478
  }
1479
 
1480
  if (!empty($post['content'])) {
1481
  $this->_validate_template($post['content'], 'Post content');
1482
  }
1483
+ elseif ( ! in_array($post['custom_type'], array('shop_order', 'taxonomies', 'import_users', 'shop_customer', 'comments', 'woo_reviews', 'gf_entries')) ){
1484
  $this->warnings->add('2', __('<strong>Warning:</strong> your content is blank.', 'wp_all_import_plugin'));
1485
  }
1486
 
1487
  if ( ! $this->errors->get_error_codes()) {
1488
 
1489
  // Attributes fields logic
1490
+ $post = apply_filters('pmxi_save_options', $post);
1491
 
1492
  // validate post excerpt
1493
  if ( ! empty($post['post_excerpt'])) $this->_validate_template($post['post_excerpt'], __('Excerpt', 'wp_all_import_plugin'));
1512
  $post['custom_value'] = array_intersect_key($post['custom_value'], $not_empty);
1513
 
1514
  // validate
1515
+ foreach ($post['custom_name'] as $custom_name) {
1516
+ $this->_validate_template($custom_name, __('Custom Field Name', 'wp_all_import_plugin'));
1517
+ }
1518
+ foreach ($post['custom_value'] as $key => $custom_value) {
1519
+ if ( empty($post['custom_format'][$key]) ) {
1520
+ $this->_validate_template($custom_value, __('Custom Field Value', 'wp_all_import_plugin'));
1521
+ }
1522
+ }
1523
 
1524
  if ( $post['type'] == "post" and $post['custom_type'] == "product" and class_exists('PMWI_Plugin')){
1525
  // remove entires where both custom_name and custom_value are empty
1526
  $not_empty = array_flip(array_values(array_merge(array_keys(array_filter($post['attribute_name'], 'strlen')), array_keys(array_filter($post['attribute_value'], 'strlen')))));
 
1527
  $post['attribute_name'] = array_intersect_key($post['attribute_name'], $not_empty);
1528
  $post['attribute_value'] = array_intersect_key($post['attribute_value'], $not_empty);
 
1529
  // validate
1530
  if (array_keys(array_filter($post['attribute_name'], 'strlen')) != array_keys(array_filter($post['attribute_value'], 'strlen'))) {
1531
  $this->errors->add('form-validation', __('Both name and value must be set for all woocommerce attributes', 'wp_all_import_plugin'));
1537
  $this->_validate_template($custom_value, __('Attribute Field Value', 'wp_all_import_plugin'));
1538
  }
1539
  }
 
1540
  }
1541
 
 
 
 
1542
  if ('post' == $post['type'] && isset($post['tags'])) {
1543
  /*'' == $post['categories'] or $this->_validate_template($post['categories'], __('Categories', 'wp_all_import_plugin'));*/
1544
  '' == $post['tags'] or $this->_validate_template($post['tags'], __('Tags', 'wp_all_import_plugin'));
1548
  } else {
1549
  '' == $post['date_start'] or $this->_validate_template($post['date_start'], __('Start Date', 'wp_all_import_plugin'));
1550
  '' == $post['date_end'] or $this->_validate_template($post['date_end'], __('Start Date', 'wp_all_import_plugin'));
1551
+ }
 
 
 
1552
 
1553
  $this->errors = apply_filters('pmxi_options_validation', $this->errors, $post, isset($this->data['import']) ? $this->data['import'] : false);
1554
 
1569
  PMXI_Plugin::$session->set('saved_template', $template->id);
1570
  }
1571
 
1572
+ if ($this->isWizard) {
1573
+ PMXI_Plugin::$session->set('options', $post);
1574
+ PMXI_Plugin::$session->save_data();
1575
+
1576
+ $DefaultOptions = array();
1577
+ $DefaultOptions['tmp_unique_key'] = $this->findUniqueKey();
1578
+
1579
+
1580
+ if(!PMXI_Plugin::$session->get('update_previous')) {
1581
+ $import = new PMXI_Import_Record();
1582
+ $import->set(
1583
+ (empty(PMXI_Plugin::$session->source) ? array() : PMXI_Plugin::$session->source)
1584
+ + array(
1585
+ 'xpath' => PMXI_Plugin::$session->xpath,
1586
+ 'options' => $DefaultOptions + PMXI_Plugin::$session->options,
1587
+ 'count' => PMXI_Plugin::$session->count,
1588
+ 'friendly_name' => wp_all_import_clear_xss(PMXI_Plugin::$session->options['friendly_name']),
1589
+ 'feed_type' => PMXI_Plugin::$session->feed_type,
1590
+ 'parent_import_id' => ($this->data['update_previous']->isEmpty()) ? PMXI_Plugin::$session->parent_import_id : $this->data['update_previous']->parent_import_id,
1591
+ 'queue_chunk_number' => 0,
1592
+ 'triggered' => 0,
1593
+ 'processing' => 0,
1594
+ 'executing' => 0,
1595
+ 'iteration' => (!empty($import->iteration)) ? $import->iteration : 0
1596
+ )
1597
+ )->save();
1598
+
1599
+ $history_file = new PMXI_File_Record();
1600
+ $history_file->set(array(
1601
+ 'name' => $import->name,
1602
+ 'import_id' => $import->id,
1603
+ 'path' => wp_all_import_get_relative_path(PMXI_Plugin::$session->filePath),
1604
+ 'registered_on' => date('Y-m-d H:i:s'),
1605
+ ))->save();
1606
+
1607
+
1608
+ $this->data['update_previous'] = $import;
1609
+ PMXI_Plugin::$session->set('update_previous', $import->id);
1610
+ PMXI_Plugin::$session->set('import_id', $import->id);
1611
+ PMXI_Plugin::$session->set('import', $import);
1612
+ PMXI_Plugin::$session->save_data();
1613
+ }
1614
+
1615
  wp_redirect(add_query_arg('action', 'options', $this->baseUrl)); die();
1616
 
1617
+ } else {
1618
  $this->data['import']->set(array( 'options' => $post, 'settings_update_on' => date('Y-m-d H:i:s')))->update();
1619
  $args = array(
1620
  'page' => 'pmxi-admin-manage',
1634
 
1635
  PMXI_Plugin::$session->save_data();
1636
 
1637
+ global $wpdb;
1638
+
1639
+ switch ($post['custom_type']){
1640
+ case 'import_users':
1641
+ case 'shop_customer':
1642
+ // Get All meta keys in the system
1643
+ $this->data['meta_keys'] = array();
1644
+ $meta_keys = new PMXI_Model_List();
1645
+ $meta_keys->setTable($wpdb->usermeta);
1646
+ $meta_keys->setColumns('umeta_id', 'meta_key')->getBy(NULL, "umeta_id", NULL, NULL, "meta_key");
1647
+ $hide_fields = array('first_name', 'last_name', 'nickname', 'description', PMXI_Plugin::getInstance()->getWPPrefix() . 'capabilities');
1648
+ if ( ! empty($meta_keys) and $meta_keys->count() ){
1649
+ foreach ($meta_keys as $meta_key) { if (in_array($meta_key['meta_key'], $hide_fields) or strpos($meta_key['meta_key'], '_wp') === 0) continue;
1650
+ $this->data['meta_keys'][] = $meta_key['meta_key'];
1651
+ }
1652
+ }
1653
+ break;
1654
+ case 'taxonomies':
1655
+ // Get All meta keys in the system
1656
+ $this->data['meta_keys'] = array();
1657
+ $meta_keys = new PMXI_Model_List();
1658
+ $meta_keys->setTable(PMXI_Plugin::getInstance()->getWPPrefix() . 'termmeta');
1659
+ $meta_keys->setColumns('meta_id', 'meta_key')->getBy(NULL, "meta_id", NULL, NULL, "meta_key");
1660
+ $hide_fields = array();
1661
+ if ( ! empty($meta_keys) and $meta_keys->count() ){
1662
+ foreach ($meta_keys as $meta_key) { if (in_array($meta_key['meta_key'], $hide_fields)) continue;
1663
+ $this->data['meta_keys'][] = $meta_key['meta_key'];
1664
+ }
1665
+ }
1666
+ break;
1667
+ case 'woo_reviews':
1668
+ case 'comments':
1669
+ // Get All meta keys in the system
1670
+ $this->data['meta_keys'] = array();
1671
+ $meta_keys = new PMXI_Model_List();
1672
+ $meta_keys->setTable(PMXI_Plugin::getInstance()->getWPPrefix() . 'commentmeta');
1673
+ $meta_keys->setColumns('meta_id', 'meta_key')->getBy(NULL, "meta_id", NULL, NULL, "meta_key");
1674
+ $hide_fields = array();
1675
+ if ( ! empty($meta_keys) and $meta_keys->count() ){
1676
+ foreach ($meta_keys as $meta_key) { if (in_array($meta_key['meta_key'], $hide_fields)) continue;
1677
+ $this->data['meta_keys'][] = $meta_key['meta_key'];
1678
+ }
1679
+ }
1680
+ break;
1681
+ default:
1682
+
1683
+ // Get all meta keys for requested post type
1684
+ $this->data['meta_keys'] = array();
1685
+ $hide_fields = array('_edit_lock', '_edit_last', '_wp_trash_meta_status', '_wp_trash_meta_time');
1686
+
1687
+ $records = get_posts( array('post_type' => $post['custom_type'], 'post_status' => 'any') );
1688
+ if ( ! empty($records)){
1689
+ foreach ($records as $record) {
1690
+ $record_meta = get_post_meta($record->ID, '');
1691
+ if ( ! empty($record_meta)){
1692
+ foreach ($record_meta as $record_meta_key => $record_meta_value) {
1693
+ if ( ! in_array($record_meta_key, $this->data['meta_keys']) and ! in_array($record_meta_key, $hide_fields)) $this->data['meta_keys'][] = $record_meta_key;
1694
+ }
1695
+ }
1696
+ }
1697
+ }
1698
 
1699
+ if ($post['custom_type'] == 'product') {
1700
+ $records = get_posts( array('post_type' => 'product_variation', 'post_status' => 'any') );
1701
+ if ( ! empty($records)){
1702
+ foreach ($records as $record) {
1703
+ $record_meta = get_post_meta($record->ID, '');
1704
+ if ( ! empty($record_meta)){
1705
+ foreach ($record_meta as $record_meta_key => $record_meta_value) {
1706
+ if ( ! in_array($record_meta_key, $this->data['meta_keys']) and ! in_array($record_meta_key, $hide_fields)) $this->data['meta_keys'][] = $record_meta_key;
1707
+ }
1708
+ }
1709
+ }
1710
+ }
1711
+ }
1712
 
1713
+ // Get existing product attributes
1714
+ $existing_attributes = $wpdb->get_results("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '_product_attributes' LIMIT 0 , 50" );
1715
+ $this->data['existing_attributes'] = array();
1716
+ if ( ! empty($existing_attributes)){
1717
+ foreach ($existing_attributes as $key => $existing_attribute) {
1718
+ $existing_attribute = maybe_unserialize($existing_attribute->meta_value);
1719
+ if (!empty($existing_attribute) and is_array($existing_attribute)):
1720
+ foreach ($existing_attribute as $key => $value) {
1721
+ if (strpos($key, "pa_") === false and ! in_array($key, $this->data['existing_attributes'])) $this->data['existing_attributes'][] = $key;
1722
+ }
1723
+ endif;
1724
+ }
1725
+ }
 
1726
 
1727
+ break;
1728
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1729
 
1730
  if (user_can_richedit()) {
1731
  wp_enqueue_script('editor');
1758
 
1759
  $default = PMXI_Plugin::get_default_import_options();
1760
 
1761
+ if ($this->isWizard) {
1762
+ if (!PMXI_Plugin::$session->get('update_previous')) {
1763
+
1764
+ $import = new PMXI_Import_Record();
1765
+
1766
+ $friendly_name = ( ! empty(PMXI_Plugin::$session->options['friendly_name']) ) ? PMXI_Plugin::$session->options['friendly_name'] : '';
1767
+
1768
+ $import->set(
1769
+ (empty(PMXI_Plugin::$session->source) ? array() : PMXI_Plugin::$session->source)
1770
+ + array(
1771
+ 'xpath' => PMXI_Plugin::$session->xpath,
1772
+ 'options' => PMXI_Plugin::$session->options,
1773
+ 'count' => PMXI_Plugin::$session->count,
1774
+ 'friendly_name' => wp_all_import_clear_xss($friendly_name),
1775
+ 'feed_type' => PMXI_Plugin::$session->feed_type,
1776
+ 'parent_import_id' => ($this->data['update_previous']->isEmpty()) ? PMXI_Plugin::$session->parent_import_id : $this->data['update_previous']->parent_import_id,
1777
+ 'queue_chunk_number' => 0,
1778
+ 'triggered' => 0,
1779
+ 'processing' => 0,
1780
+ 'executing' => 0,
1781
+ 'iteration' => (!empty($import->iteration)) ? $import->iteration : 0
1782
+ )
1783
+ )->save();
1784
+
1785
+ $history_file = new PMXI_File_Record();
1786
+ $history_file->set(array(
1787
+ 'name' => $import->name,
1788
+ 'import_id' => $import->id,
1789
+ 'path' => wp_all_import_get_relative_path(PMXI_Plugin::$session->filePath),
1790
+ 'registered_on' => date('Y-m-d H:i:s'),
1791
+ ))->save();
1792
+
1793
+
1794
+ $this->data['update_previous'] = $import;
1795
+
1796
+ PMXI_Plugin::$session->set('update_previous', $import->id);
1797
+ PMXI_Plugin::$session->set('import_id', $import->id);
1798
+ PMXI_Plugin::$session->set('import', $import);
1799
+ PMXI_Plugin::$session->save_data();
1800
+ }
1801
  $this->data['source_type'] = PMXI_Plugin::$session->source['type'];
1802
 
1803
  foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
1806
 
1807
  $DefaultOptions = array_replace_recursive($default, (isset(PMXI_Plugin::$session->options) ? PMXI_Plugin::$session->options : array()));
1808
 
1809
+ if ( ! in_array(PMXI_Plugin::$session->options['custom_type'], array('import_users', 'shop_customer', 'shop_order', 'comments', 'woo_reviews', 'gf_entries')) ){
1810
  if (empty(PMXI_Plugin::$session->options['title']))
1811
+ $this->warnings->add('form-validation', __('<strong>Warning:</strong> your title is blank.'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1812
  }
1813
 
1814
+ $DefaultOptions['tmp_unique_key'] = $this->findUniqueKey();
1815
+
1816
  if ($DefaultOptions['custom_type'] == "product" and class_exists('PMWI_Plugin') and $DefaultOptions['wizard_type'] != 'new'){
1817
  $DefaultOptions['duplicate_indicator'] = empty($DefaultOptions['duplicate_indicator']) ? 'custom field' : $DefaultOptions['duplicate_indicator'];
1818
  $DefaultOptions['custom_duplicate_name'] = empty($DefaultOptions['custom_duplicate_name']) ? '_sku' : $DefaultOptions['custom_duplicate_name'];
1819
  }
1820
 
1821
  $DefaultOptions['wizard_type'] = PMXI_Plugin::$session->wizard_type;
1822
+ if (empty($DefaultOptions['custom_type'])) $DefaultOptions['custom_type'] = PMXI_Plugin::$session->custom_type;
1823
+ if (empty($DefaultOptions['taxonomy_type'])) $DefaultOptions['taxonomy_type'] = PMXI_Plugin::$session->taxonomy_type;
1824
+ if (empty($DefaultOptions['delimiter'])) $DefaultOptions['delimiter'] = PMXI_Plugin::$session->is_csv;
1825
+ if (empty($DefaultOptions['ftp_host'])) $DefaultOptions['ftp_host'] = PMXI_Plugin::$session->ftp_host;
1826
+ if (empty($DefaultOptions['ftp_path'])) $DefaultOptions['ftp_path'] = PMXI_Plugin::$session->ftp_path;
1827
+ if (empty($DefaultOptions['ftp_root'])) $DefaultOptions['ftp_root'] = PMXI_Plugin::$session->ftp_root;
1828
+ if (empty($DefaultOptions['ftp_port'])) $DefaultOptions['ftp_port'] = PMXI_Plugin::$session->ftp_port;
1829
+ if (empty($DefaultOptions['ftp_username'])) $DefaultOptions['ftp_username'] = PMXI_Plugin::$session->ftp_username;
1830
+ if (empty($DefaultOptions['ftp_password'])) $DefaultOptions['ftp_password'] = PMXI_Plugin::$session->ftp_password;
1831
+ if (empty($DefaultOptions['ftp_private_key'])) $DefaultOptions['ftp_private_key'] = PMXI_Plugin::$session->ftp_private_key;
1832
+
1833
  $post = $this->input->post( $DefaultOptions );
1834
 
1835
  } else {
1860
 
1861
  if ($this->input->post('is_submitted')) {
1862
 
1863
+ check_admin_referer('options', '_wpnonce_options');
1864
+
1865
+ $wp_uploads = wp_upload_dir();
1866
+ $functions = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php';
1867
+ $functions = apply_filters( 'import_functions_file_path', $functions );
1868
+ if ( @file_exists($functions) && PMXI_Plugin::$is_php_allowed)
1869
+ require_once $functions;
1870
 
1871
  if ($post['is_import_specified']) {
1872
  if (empty($post['import_specified'])) {
1897
  if ('' == $post['custom_duplicate_value'])
1898
  $this->errors->add('form-validation', __('Custom field value must be specified.', 'wp_all_import_plugin'));
1899
  }
1900
+ if ( 'manual' == $post['duplicate_matching'] ){
1901
+ if ( 'pid' == $post['duplicate_indicator'] && '' == $post['pid_xpath'] ){
1902
+ if ($post['custom_type'] == 'gf_entries') {
1903
+ $this->errors->add('form-validation', __('Entry ID must be specified.', 'wp_all_import_plugin'));
1904
+ } else {
1905
+ $this->errors->add('form-validation', __('Post ID must be specified.', 'wp_all_import_plugin'));
1906
+ }
1907
+ }
1908
+ if ( 'taxonomies' == $post['custom_type'] ){
1909
+ if ( 'title' == $post['duplicate_indicator'] && '' == $post['title_xpath'] ){
1910
+ $this->errors->add('form-validation', __('Term name must be specified.', 'wp_all_import_plugin'));
1911
+ }
1912
+ if ( 'slug' == $post['duplicate_indicator'] && '' == $post['slug_xpath'] ){
1913
+ $this->errors->add('form-validation', __('Term slug must be specified.', 'wp_all_import_plugin'));
1914
+ }
1915
+ }
1916
  }
1917
 
1918
  // Categories/taxonomies logic
1935
 
1936
  if ( ! $this->isWizard) {
1937
 
1938
+ // updating csv delimiter
1939
  if ( $post['delimiter'] != $this->data['import']->options['delimiter'] ){
1940
  $import_options = $this->data['import']->options;
1941
  $import_options['delimiter'] = $post['delimiter'];
1946
  switch ($this->input->post('new_type')){
1947
  case 'upload':
1948
  $filePath = $this->input->post('filepath');
 
1949
  if ($this->data['import']['path'] != $filePath){
1950
  $uploader = new PMXI_Upload($filePath, $this->errors);
1951
  $upload_result = $uploader->upload();
1952
  }
1953
+ break;
1954
+ case 'url':
1955
+ $filePath = $this->input->post('url');
1956
 
1957
+ if ($this->data['import']['path'] != $filePath){
1958
+
1959
+ $filesXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<data><node></node></data>";
1960
+
1961
+ $filePath = apply_filters('wp_all_import_feed_url', wp_all_import_sanitize_url($filePath));
1962
+
1963
+ $filePaths = XmlImportParser::factory($filesXML, '/data/node', $filePath, $file)->parse(); $tmp_files[] = $file;
1964
+
1965
+ foreach ($tmp_files as $tmp_file) { // remove all temporary files created
1966
+ @unlink($tmp_file);
1967
+ }
1968
+
1969
+ $file_to_import = $filePath;
1970
+
1971
+ if ( ! empty($filePaths) and is_array($filePaths) ) {
1972
+ $file_to_import = array_shift($filePaths);
1973
+ }
1974
+
1975
+ $uploader = new PMXI_Upload($file_to_import, $this->errors);
1976
+ $upload_result = $uploader->url($this->data['import']->feed_type, $filePath);
1977
+ }
1978
+
1979
  break;
1980
+ case 'file':
1981
+ $filePath = $this->input->post('file');
1982
+ if ($this->data['import']['path'] != $filePath){
1983
+ $uploader = new PMXI_Upload($filePath, $this->errors);
1984
+ $upload_result = $uploader->file();
1985
+ }
1986
+ break;
1987
+ case 'ftp':
1988
+ $filePath = $this->data['import']['path'];
1989
+ $ftp_host = $this->input->post('ftp_host');
1990
+ $ftp_port = $this->input->post('ftp_port');
1991
+ $ftp_path = $this->input->post('ftp_path');
1992
+ $ftp_root = $this->input->post('ftp_root');
1993
+ $ftp_username = $this->input->post('ftp_username');
1994
+ $ftp_password = $this->input->post('ftp_password');
1995
+ $ftp_private_key = $this->input->post('ftp_private_key');
1996
+ if ($ftp_host !== $this->data['import']['options']['ftp_host'] ||
1997
+ $ftp_path !== $this->data['import']['options']['ftp_path'] ||
1998
+ $ftp_root !== $this->data['import']['options']['ftp_root'] ||
1999
+ $ftp_port !== $this->data['import']['options']['ftp_port'] ||
2000
+ $ftp_username !== $this->data['import']['options']['ftp_username'] ||
2001
+ $ftp_password !== $this->data['import']['options']['ftp_password'] || $ftp_private_key !== $this->data['import']['options']['ftp_private_key']) {
2002
+ try {
2003
+ $files = PMXI_FTPFetcher::fetch([
2004
+ 'ftp_host' => $ftp_host,
2005
+ 'ftp_path' => $ftp_path,
2006
+ 'ftp_root' => $ftp_root,
2007
+ 'ftp_port' => $ftp_port,
2008
+ 'ftp_username' => $ftp_username,
2009
+ 'ftp_password' => $ftp_password,
2010
+ 'ftp_private_key' => $ftp_private_key,
2011
+ ]);
2012
+ $uploader = new PMXI_Upload($files[0], $this->errors, rtrim(str_replace(basename($files[0]), '', $files[0]), '/'));
2013
+ $upload_result = $uploader->upload();
2014
+ } catch (Exception $e) {
2015
+ $this->errors->add('form-validation', $e->getMessage());
2016
+ }
2017
+ }
2018
+ break;
2019
  default:
 
2020
  $this->errors->add('form-validation', __('WP All Import doesn\'t support this import type.', 'wp_all_import_plugin'));
 
2021
  break;
2022
  }
2023
 
2024
  $is_validate_file = apply_filters('wp_all_import_is_validate_file_options_update', true, $this->data['import']->id);
2025
 
2026
+ if (!$this->errors->get_error_codes() && $upload_result !== false and $this->data['import']['path'] != $filePath and $is_validate_file) {
 
 
 
2027
 
2028
  $file = new PMXI_Chunk($upload_result['filePath'], array('element' => ( ! empty($this->data['import']->root_element)) ? $this->data['import']->root_element : ''));
2029
 
2091
  if ($loop) $this->data['import']->set(array('count' => $loop))->save();
2092
  }
2093
  }
2094
+ $upload_result['root_element'] = $root_element;
2095
+ } else {
 
 
 
 
 
2096
  $this->warnings->add('root-element-validation', __('Root element not found for uploaded feed.', 'wp_all_import_plugin'));
2097
  }
 
2098
  }
 
2099
  }
2100
 
2101
  $this->errors = apply_filters('pmxi_options_validation', $this->errors, $post, isset($this->data['import']) ? $this->data['import'] : false);
2111
 
2112
  PMXI_Plugin::$session->save_data();
2113
 
2114
+ if($this->data['update_previous']) {
2115
+ $this->data['update_previous']->set('options', $post)->save();
2116
+ }
2117
+
2118
+ // update import template with final settings
2119
  if ( PMXI_Plugin::$session->saved_template ){
2120
  $template = new PMXI_Template_Record();
2121
  $template->getById(PMXI_Plugin::$session->saved_template)->set(array(
2137
  'friendly_name' => wp_all_import_clear_xss($this->data['post']['friendly_name']),
2138
  )
2139
  )->save();
 
 
 
 
 
 
 
 
 
2140
 
2141
  wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmxi_nt' => urlencode($is_update ? __('Import updated', 'wp_all_import_plugin') : __('Import created', 'wp_all_import_plugin'))), admin_url('admin.php'))); die();
2142
  }
2171
  'path' => $filePath,
2172
  );
2173
  break;
2174
+ case 'url':
2175
+ $filePath = $this->input->post('url');
2176
 
2177
+ $filePath = apply_filters('wp_all_import_feed_url', wp_all_import_sanitize_url($filePath));
2178
+
2179
+ $source = array(
2180
+ 'name' => basename(parse_url($filePath, PHP_URL_PATH)),
2181
+ 'type' => 'url',
2182
+ 'path' => $filePath,
2183
+ );
2184
+ break;
2185
+ case 'file':
2186
+ $wp_uploads = wp_upload_dir();
2187
+ $filePath = $this->input->post('file');
2188
+ $source = array(
2189
+ 'name' => basename($filePath),
2190
+ 'type' => 'file',
2191
+ 'path' => $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY . DIRECTORY_SEPARATOR . $filePath,
2192
+ );
2193
+ break;
2194
+ case 'ftp':
2195
+ $filePath = empty($upload_result) ? $filePath : $upload_result['filePath'];
2196
+ $source = array(
2197
+ 'name' => basename($filePath),
2198
+ 'type' => 'ftp',
2199
+ 'path' => $filePath,
2200
+ );
2201
+ break;
2202
  }
2203
 
2204
  $source['path'] = wp_all_import_get_relative_path($source['path']);
2228
  'name' => $this->data['import']->name,
2229
  'import_id' => $this->data['import']->id,
2230
  'path' => wp_all_import_get_relative_path($upload_result['filePath']),
 
2231
  'registered_on' => date('Y-m-d H:i:s')
2232
+ ))->save();
 
2233
  }
2234
 
2235
  if ( ! $this->warnings->get_error_codes()) {
2236
+ $this->data['import']->set($source)->save();
 
 
2237
  wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmxi_nt' => urlencode(__('Configuration updated', 'wp_all_import_plugin'))) + array_intersect_key($_GET, array_flip($this->baseUrlParamNames)), admin_url('admin.php'))); die();
2238
+ } else {
 
 
2239
  $source['root_element'] = $upload_result['root_element'];
2240
+ PMXI_Plugin::$session->set('source', $source);
 
 
2241
  $this->data['import']->set( array_merge($source, array('xpath' => '/' . $upload_result['root_element'])) )->save();
 
2242
  }
2243
  }
2244
  }
2245
  }
2246
+
2247
+ global $wpdb;
2248
+
2249
+ $this->data['existing_meta_keys'] = array();
2250
+
2251
+ switch ($post['custom_type']){
2252
+ case 'import_users':
2253
+ case 'shop_customer':
2254
+ // Get All meta keys in the system
2255
+ $this->data['meta_keys'] = array();
2256
+ $meta_keys = new PMXI_Model_List();
2257
+ $meta_keys->setTable($wpdb->usermeta);
2258
+ $meta_keys->setColumns('umeta_id', 'meta_key')->getBy(NULL, "umeta_id", NULL, NULL, "meta_key");
2259
+ $hide_fields = array('first_name', 'last_name', 'nickname', 'description', PMXI_Plugin::getInstance()->getWPPrefix() . 'capabilities');
2260
+ if ( ! empty($meta_keys) and $meta_keys->count() ){
2261
+ foreach ($meta_keys as $meta_key) { if (in_array($meta_key['meta_key'], $hide_fields) or strpos($meta_key['meta_key'], '_wp') === 0) continue;
2262
+ $this->data['existing_meta_keys'][] = $meta_key['meta_key'];
2263
+ }
2264
+ }
2265
+ break;
2266
+ case 'taxonomies':
2267
+ // Get All meta keys in the system
2268
+ $this->data['meta_keys'] = array();
2269
+ $meta_keys = new PMXI_Model_List();
2270
+ $meta_keys->setTable(PMXI_Plugin::getInstance()->getWPPrefix() . 'termmeta');
2271
+ $meta_keys->setColumns('meta_id', 'meta_key')->getBy(NULL, "meta_id", NULL, NULL, "meta_key");
2272
+ $hide_fields = array();
2273
+ if ( ! empty($meta_keys) and $meta_keys->count() ){
2274
+ foreach ($meta_keys as $meta_key) { if (in_array($meta_key['meta_key'], $hide_fields)) continue;
2275
+ $this->data['existing_meta_keys'][] = $meta_key['meta_key'];
2276
+ }
2277
+ }
2278
+ break;
2279
+ case 'comments':
2280
+ case 'woo_reviews':
2281
+ // Get All meta keys in the system
2282
+ $this->data['meta_keys'] = array();
2283
+ $meta_keys = new PMXI_Model_List();
2284
+ $meta_keys->setTable(PMXI_Plugin::getInstance()->getWPPrefix() . 'commentmeta');
2285
+ $meta_keys->setColumns('meta_id', 'meta_key')->getBy(NULL, "meta_id", NULL, NULL, "meta_key");
2286
+ $hide_fields = array();
2287
+ if ( ! empty($meta_keys) and $meta_keys->count() ){
2288
+ foreach ($meta_keys as $meta_key) { if (in_array($meta_key['meta_key'], $hide_fields)) continue;
2289
+ $this->data['existing_meta_keys'][] = $meta_key['meta_key'];
2290
+ }
2291
+ }
2292
+ break;
2293
+ default:
2294
+
2295
+ // Get all meta keys for requested post type
2296
+ $hide_fields = array('_edit_lock', '_edit_last', '_wp_trash_meta_status', '_wp_trash_meta_time');
2297
 
2298
+ if ( $post['custom_type'] == 'product' ) {
2299
+ $records = get_posts( array('post_type' => array('product', 'product_variation')) );
2300
+ } else {
2301
+ $records = get_posts( array('post_type' => $post['custom_type']) );
2302
+ }
2303
 
2304
+ if ( ! empty($records)){
2305
+ foreach ($records as $record) {
2306
+ $record_meta = get_post_meta($record->ID, '');
2307
+ if ( ! empty($record_meta)){
2308
+ foreach ($record_meta as $record_meta_key => $record_meta_value) {
2309
+ if ( ! in_array($record_meta_key, $this->data['existing_meta_keys']) and ! in_array($record_meta_key, $hide_fields)) $this->data['existing_meta_keys'][] = $record_meta_key;
2310
+ }
 
 
 
 
 
 
 
 
2311
  }
2312
  }
2313
  }
 
2314
 
2315
+ $this->data['existing_meta_keys'] = apply_filters('wp_all_import_existing_meta_keys', $this->data['existing_meta_keys'], $post['custom_type']);
2316
+
2317
+ // Get existing product attributes
2318
+ $existing_attributes = $wpdb->get_results("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '_product_attributes' LIMIT 0 , 50" );
2319
+ $this->data['existing_attributes'] = array();
2320
+ if ( ! empty($existing_attributes)){
2321
+ foreach ($existing_attributes as $key => $existing_attribute) {
2322
+ $existing_attribute = maybe_unserialize($existing_attribute->meta_value);
2323
+ if (!empty($existing_attribute) and is_array($existing_attribute)):
2324
+ foreach ($existing_attribute as $key => $value) {
2325
+ if (strpos($key, "pa_") === false and ! in_array($key, $this->data['existing_attributes'])) $this->data['existing_attributes'][] = $key;
2326
+ }
2327
+ endif;
2328
+ }
2329
  }
2330
+ break;
2331
+ }
2332
 
2333
  $this->render();
2334
  }
2340
 
2341
  $default = PMXI_Plugin::get_default_import_options();
2342
 
2343
+ $this->data['source'] = PMXI_Plugin::$session->source;
2344
+ $this->data['locfilePath'] = PMXI_Plugin::$session->filePath;
2345
  $this->data['count'] = PMXI_Plugin::$session->count;
2346
  $this->data['xpath'] = PMXI_Plugin::$session->xpath;
2347
+ if (empty($this->data['import'])){
2348
+ $this->data['import'] = $this->data['update_previous'];
2349
+ }
2350
+ $this->data['import_id_val'] = PMXI_Plugin::$session->update_previous;
2351
  $this->data['isWizard'] = true;
2352
  $DefaultOptions = (isset(PMXI_Plugin::$session->options) ? PMXI_Plugin::$session->options : array()) + $default;
2353
  foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
2354
  if (class_exists($class)) $DefaultOptions += call_user_func(array($class, "get_default_import_options"));
2355
  }
2356
 
2357
+ if ($this->isWizard and ! in_array(PMXI_Plugin::$session->options['custom_type'], array('import_users', 'shop_customer', 'shop_order', 'comments', 'woo_reviews', 'gf_entries'))){
2358
  if (empty(PMXI_Plugin::$session->options['title']))
2359
+ $this->warnings->add('form-validation', __('<strong>Warning:</strong> your title is blank.', 'wp_all_import_plugin'));
 
 
2360
  }
2361
 
2362
  $this->data['post'] =& $DefaultOptions;
2427
  ))->update();
2428
  }
2429
 
2430
+ // Add history log.
2431
+ if ($import->options['custom_type'] == 'taxonomies') {
2432
+ $tx = get_taxonomy($import->options['taxonomy_type']);
2433
+ $custom_type = new stdClass();
2434
+ $custom_type->labels = new stdClass();
2435
+ $custom_type->labels->name = empty($tx->labels->name) ? __('Taxonomy Terms', 'wp_all_import_plugin') : $tx->labels->name;
2436
+ $custom_type->labels->singular_name = empty($tx->labels->singular_name) ? __('Taxonomy Term', 'wp_all_import_plugin') : $tx->labels->singular_name;
2437
+ }
2438
+ elseif ($import->options['custom_type'] == 'comments'){
2439
+ $custom_type = new stdClass();
2440
+ $custom_type->labels = new stdClass();
2441
+ $custom_type->labels->name = __('Comments', 'wp_all_import_plugin');
2442
+ $custom_type->labels->singular_name = __('Comment', 'wp_all_import_plugin');
2443
+ }
2444
+ elseif ($import->options['custom_type'] == 'woo_reviews'){
2445
+ $custom_type = new stdClass();
2446
+ $custom_type->labels = new stdClass();
2447
+ $custom_type->labels->name = __('Reviews', 'wp_all_import_plugin');
2448
+ $custom_type->labels->singular_name = __('Review', 'wp_all_import_plugin');
2449
+ }
2450
+ else{
2451
+ $custom_type = get_post_type_object( $import->options['custom_type'] );
2452
+ }
2453
 
2454
  // Unlink previous logs.
2455
  $by = array();
2476
 
2477
  PMXI_Plugin::$session->set('history_id', $history_log->id);
2478
 
2479
+ foreach ( get_taxonomies() as $tax ) {
2480
+ delete_transient("pmxi_{$tax}_terms");
2481
+ }
2482
+
2483
+ $functions = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php';
2484
+ $functions = apply_filters( 'import_functions_file_path', $functions );
2485
+ if ( @file_exists($functions) && PMXI_Plugin::$is_php_allowed)
2486
+ require_once $functions;
2487
 
2488
  do_action( 'pmxi_before_xml_import', $import->id );
2489
 
2532
  Splitting the file into pieces means that, for example, instead of having to read 19000 records into a 20000 record file when importing the last 1000 records,
2533
  WP All Import will just split it into 20 chunks, and then read the last chunk from the beginning.
2534
  */
2535
+ if ( $import->count > PMXI_Plugin::getInstance()->getOption('large_feed_limit') and $import->options['chuncking'] ){
2536
 
2537
  $chunk_files = array();
2538
 
2591
  }
2592
  }
2593
 
2594
+ $this->data['ajax_processing'] = true;
2595
 
2596
  $this->render();
2597
  wp_ob_end_flush_all(); flush();
2599
 
2600
  $import_id = $input->get('id', 0);
2601
 
2602
+ if ( ! $import_id ) {
2603
  PMXI_Plugin::$session->convertData($import->id);
2604
  }
2605
  }
2609
  $import->getById($import_id);
2610
  }
2611
 
2612
+ $ajax_processing = true;
2613
 
2614
  if ( PMXI_Plugin::is_ajax() and $ajax_processing and ! check_ajax_referer( 'wp_all_import_secure', 'security', false )){
2615
  exit( __('Security check', 'wp_all_import_plugin') );
2617
 
2618
  if ($ajax_processing) {
2619
  $logger = function($m) {echo "<div class='progress-msg'>[". date("H:i:s") ."] $m</div>\n";flush();};
2620
+ } else {
 
2621
  $logger = function($m) {echo "<div class='progress-msg'>$m</div>\n"; if ( "" != strip_tags(wp_all_import_strip_tags_content($m))) { PMXI_Plugin::$session->log .= "<p>".strip_tags(wp_all_import_strip_tags_content($m))."</p>"; flush(); }};
2622
  }
2623
 
2634
  wp_defer_term_counting(true);
2635
  wp_defer_comment_counting(true);
2636
 
2637
+ if ( PMXI_Plugin::is_ajax() or ! $ajax_processing ) {
2638
+
2639
+ $functions = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php';
2640
+ $functions = apply_filters( 'import_functions_file_path', $functions );
2641
+ if ( @file_exists($functions) && PMXI_Plugin::$is_php_allowed)
2642
+ require_once $functions;
2643
 
2644
  $iteration_start_time = time();
2645
 
2683
  }
2684
 
2685
  $records_per_request = ( ! $ajax_processing and $import->options['records_per_request'] < 50 ) ? 50 : $import->options['records_per_request'];
2686
+
2687
  if (!empty(PMXI_Plugin::$session->local_paths)) {
2688
 
2689
  if (!empty($records) && $import->queue_chunk_number < $records[0] && strpos($import->xpath, "[") === false && ! $import->options['is_delete_missing']) {
2766
  $feed = "<?xml version=\"1.0\" encoding=\"". $import->options['encoding'] ."\"?>" . "\n" . "<pmxi_records>";
2767
  $loop = 0;
2768
  } else {
2769
+ if ( ! $history_log->isEmpty()) {
2770
+ if ($import->options['custom_type'] == 'taxonomies') {
2771
+ $tx = get_taxonomy($import->options['taxonomy_type']);
2772
+ $custom_type = new stdClass();
2773
+ $custom_type->labels = new stdClass();
2774
+ $custom_type->labels->name = empty($tx->labels->name) ? __('Taxonomy Terms', 'wp_all_import_plugin') : $tx->labels->name;
2775
+ $custom_type->labels->singular_name = empty($tx->labels->singular_name) ? __('Taxonomy Term', 'wp_all_import_plugin') : $tx->labels->singular_name;
2776
+ }
2777
+ elseif ($import->options['custom_type'] == 'comments'){
2778
+ $custom_type = new stdClass();
2779
+ $custom_type->labels = new stdClass();
2780
+ $custom_type->labels->name = __('Comments', 'wp_all_import_plugin');
2781
+ $custom_type->labels->singular_name = __('Comment', 'wp_all_import_plugin');
2782
+ }
2783
+ elseif ($import->options['custom_type'] == 'woo_reviews'){
2784
+ $custom_type = new stdClass();
2785
+ $custom_type->labels = new stdClass();
2786
+ $custom_type->labels->name = __('Reviews', 'wp_all_import_plugin');
2787
+ $custom_type->labels->singular_name = __('Review', 'wp_all_import_plugin');
2788
+ }
2789
+ else{
2790
+ $custom_type = get_post_type_object( $import->options['custom_type'] );
2791
+ }
2792
  $history_log->set(array(
2793
  'time_run' => time() - strtotime($history_log->date),
2794
  'summary' => sprintf(__("%d %s created %d updated %d deleted %d skipped", "wp_all_import_plugin"), $import->created, ( ($import->created == 1) ? $custom_type->labels->singular_name : $custom_type->labels->name ), $import->updated, $import->deleted, $import->skipped)
2860
  'updated' => $import->updated,
2861
  'skipped' => $import->skipped,
2862
  'skipped_by_hash' => PMXI_Plugin::$session->skipped,
2863
+ 'deleted' => $import->deleted,
2864
  'percentage' => 99,
2865
  'warnings' => PMXI_Plugin::$session->warnings,
2866
  'errors' => PMXI_Plugin::$session->errors,
2879
  'queue_chunk_number' => 0,
2880
  'registered_on' => date('Y-m-d H:i:s'),
2881
  'iteration' => ++$import->iteration
2882
+ ))->update();
 
 
 
 
 
 
 
 
 
 
 
 
2883
 
2884
  foreach ( get_taxonomies() as $tax ) {
2885
  delete_option( "{$tax}_children" );
2894
  wp_defer_term_counting(false);
2895
  wp_defer_comment_counting(false);
2896
 
2897
+ // add history log
2898
+ if ($import->options['custom_type'] == 'taxonomies'){
2899
+ $tx = get_taxonomy($import->options['taxonomy_type']);
2900
+ $custom_type = new stdClass();
2901
+ $custom_type->labels = new stdClass();
2902
+ $custom_type->labels->name = empty($tx->labels->name) ? __('Taxonomy Terms', 'wp_all_import_plugin') : $tx->labels->name;
2903
+ $custom_type->labels->singular_name = empty($tx->labels->singular_name) ? __('Taxonomy Term', 'wp_all_import_plugin') : $tx->labels->singular_name;
2904
+ }
2905
+ elseif ($import->options['custom_type'] == 'comments'){
2906
+ $custom_type = new stdClass();
2907
+ $custom_type->labels = new stdClass();
2908
+ $custom_type->labels->name = __('Comments', 'wp_all_import_plugin');
2909
+ $custom_type->labels->singular_name = __('Comment', 'wp_all_import_plugin');
2910
+ }
2911
+ elseif ($import->options['custom_type'] == 'woo_reviews'){
2912
+ $custom_type = new stdClass();
2913
+ $custom_type->labels = new stdClass();
2914
+ $custom_type->labels->name = __('Reviews', 'wp_all_import_plugin');
2915
+ $custom_type->labels->singular_name = __('Review', 'wp_all_import_plugin');
2916
+ }
2917
+ else{
2918
+ $custom_type = get_post_type_object( $import->options['custom_type'] );
2919
+ }
2920
  $history_log->set(array(
2921
  'time_run' => time() - strtotime($history_log->date),
2922
  'summary' => sprintf(__("%d %s created %d updated %d deleted %d skipped", "pmxi_plugin"), $import->created, ( ($import->created == 1) ? $custom_type->labels->singular_name : $custom_type->labels->name ), $import->updated, $import->deleted, $import->skipped)
3037
  return $xml;
3038
  }
3039
 
3040
+ /**
3041
  * @return string
3042
  */
3043
  private function findUniqueKey()
controllers/admin/manage.php CHANGED
@@ -460,13 +460,11 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
460
  ))->update();
461
  $this->errors->add('root-element-validation', __('No matching elements found for Root element and XPath expression specified', 'wp_all_import_plugin'));
462
  }
463
- }
464
-
465
  }
466
-
467
- if ( $chunks ) { // xml is valid
468
-
469
- if ( ! PMXI_Plugin::is_ajax() and empty(PMXI_Plugin::$session->chunk_number)){
470
  // compose data to look like result of wizard steps
471
  $sesson_data = array(
472
  'filePath' => $filePath,
@@ -495,26 +493,20 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
495
  'action' => (!empty($action_type) and $action_type == 'continue') ? 'continue' : 'update',
496
  'nonce' => wp_create_nonce( 'import' ),
497
  'deligate' => false
498
- );
499
-
500
  foreach ($sesson_data as $key => $value) {
501
  PMXI_Plugin::$session->set($key, $value);
502
  }
503
-
504
  PMXI_Plugin::$session->save_data();
505
-
506
  }
507
-
508
  $item->set(array('canceled' => 0, 'failed' => 0))->update();
509
-
510
  // deligate operation to other controller
511
  $controller = new PMXI_Admin_Import();
512
  $controller->data['update_previous'] = $item;
513
  $controller->process();
514
  return;
515
  }
516
- }
517
-
518
  $this->render('admin/import/confirm');
519
  }
520
 
460
  ))->update();
461
  $this->errors->add('root-element-validation', __('No matching elements found for Root element and XPath expression specified', 'wp_all_import_plugin'));
462
  }
463
+ }
 
464
  }
465
+
466
+ if ( $chunks ) { // xml is valid
467
+ if ( ! PMXI_Plugin::is_ajax() and empty(PMXI_Plugin::$session->chunk_number)) {
 
468
  // compose data to look like result of wizard steps
469
  $sesson_data = array(
470
  'filePath' => $filePath,
493
  'action' => (!empty($action_type) and $action_type == 'continue') ? 'continue' : 'update',
494
  'nonce' => wp_create_nonce( 'import' ),
495
  'deligate' => false
496
+ );
 
497
  foreach ($sesson_data as $key => $value) {
498
  PMXI_Plugin::$session->set($key, $value);
499
  }
 
500
  PMXI_Plugin::$session->save_data();
 
501
  }
 
502
  $item->set(array('canceled' => 0, 'failed' => 0))->update();
 
503
  // deligate operation to other controller
504
  $controller = new PMXI_Admin_Import();
505
  $controller->data['update_previous'] = $item;
506
  $controller->process();
507
  return;
508
  }
509
+ }
 
510
  $this->render('admin/import/confirm');
511
  }
512
 
controllers/controller/admin.php CHANGED
@@ -99,7 +99,7 @@ abstract class PMXI_Controller_Admin extends PMXI_Controller {
99
 
100
  wp_enqueue_script('jquery-ui-datepicker', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/ui.datepicker.js', 'jquery-ui-core');
101
  //wp_enqueue_script('wp-all-import-autocomplete', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/ui.autocomplete.js', array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position'));
102
- wp_enqueue_script('tipsy', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/jquery.tipsy.js', 'jquery');
103
  wp_enqueue_script('jquery-nestable', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/jquery.mjs.nestedSortable.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-tabs', 'jquery-ui-progressbar'));
104
  wp_enqueue_script('jquery-moment', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/moment.js', 'jquery', PMXI_VERSION);
105
  wp_enqueue_script('jquery-select2', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/select2.min.js', 'jquery');
99
 
100
  wp_enqueue_script('jquery-ui-datepicker', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/ui.datepicker.js', 'jquery-ui-core');
101
  //wp_enqueue_script('wp-all-import-autocomplete', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/ui.autocomplete.js', array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position'));
102
+ wp_enqueue_script('tipsy', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/jquery.tipsy.js', 'jquery', PMXI_VERSION);
103
  wp_enqueue_script('jquery-nestable', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/jquery.mjs.nestedSortable.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-tabs', 'jquery-ui-progressbar'));
104
  wp_enqueue_script('jquery-moment', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/moment.js', 'jquery', PMXI_VERSION);
105
  wp_enqueue_script('jquery-select2', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/select2.min.js', 'jquery');
helpers/wp_all_import_get_import_id.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! function_exists( 'wp_all_import_get_import_id' ) ) {
4
+ function wp_all_import_get_import_id() {
5
+ global $argv;
6
+ $import_id = 'new';
7
+
8
+ if ( ! empty( $argv ) ) {
9
+ $import_id_arr = array_filter( $argv, function( $a ) {
10
+ return ( is_numeric( $a ) ) ? true : false;
11
+ });
12
+
13
+ if ( ! empty( $import_id_arr ) ) {
14
+ $import_id = reset( $import_id_arr );
15
+ }
16
+ }
17
+
18
+ if ( $import_id == 'new' ) {
19
+ if ( isset( $_GET['import_id'] ) ) {
20
+ $import_id = $_GET['import_id'];
21
+ } elseif ( isset( $_GET['id'] ) ) {
22
+ $import_id = $_GET['id'];
23
+ }
24
+ }
25
+
26
+ return $import_id;
27
+ }
28
+ }
helpers/wp_all_import_get_import_post_type.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! function_exists( 'wp_all_import_get_import_post_type' ) ) {
3
+ function wp_all_import_get_import_post_type( $import_id = 'new' ) {
4
+ $custom_type = false;
5
+ // Declaring $wpdb as global to access database
6
+ global $wpdb;
7
+ if ( $import_id == 'new' ) {
8
+ // Attempt to get import ID
9
+ $import_id = wp_all_import_get_import_id();
10
+ }
11
+
12
+ // Get values from import data table
13
+ $imports_table = $wpdb->prefix . 'pmxi_imports';
14
+
15
+ // Get import session from database based on import ID or 'new'
16
+ $import_options = $wpdb->get_row( $wpdb->prepare("SELECT options FROM $imports_table WHERE id = %d", $import_id), ARRAY_A );
17
+
18
+ // If this is an existing import load the custom post type from the array
19
+ if ( ! empty($import_options) ) {
20
+ $import_options_arr = unserialize($import_options['options']);
21
+ $custom_type = $import_options_arr['custom_type'];
22
+ } else {
23
+ // If this is a new import get the custom post type data from the current session
24
+ $import_options = $wpdb->get_row( $wpdb->prepare("SELECT option_name, option_value FROM $wpdb->options WHERE option_name = %s", '_wpallimport_session_' . $import_id . '_'), ARRAY_A );
25
+ $import_options_arr = empty($import_options) ? array() : unserialize($import_options['option_value']);
26
+ $custom_type = empty($import_options_arr['custom_type']) ? '' : $import_options_arr['custom_type'];
27
+ }
28
+ return $custom_type;
29
+ }
30
+ }
helpers/wp_all_import_get_parent_terms.php CHANGED
@@ -7,7 +7,7 @@ function wp_all_import_get_parent_terms( $term_id, $taxonomy ){
7
  $parent = get_term_by( 'id', $term_id, $taxonomy );
8
 
9
  // climb up the hierarchy until we reach a term with parent = '0'
10
- while ( $parent->parent != '0' ){
11
 
12
  $term_id = $parent->parent;
13
 
7
  $parent = get_term_by( 'id', $term_id, $taxonomy );
8
 
9
  // climb up the hierarchy until we reach a term with parent = '0'
10
+ while ( (int) $parent->parent != 0 ){
11
 
12
  $term_id = $parent->parent;
13
 
libraries/XmlImportCsvParse.php CHANGED
@@ -11,10 +11,11 @@ class PMXI_CsvParser
11
  * @access public
12
  */
13
  $settings = array(
14
- 'delimiter' => ',',
15
  'eol' => '',
16
  'length' => 999999,
17
- 'escape' => '"'
 
18
  ),
19
 
20
  $tmp_files = array(),
@@ -936,8 +937,9 @@ class PMXI_CsvParser
936
 
937
  $c = 0;
938
  $d = ( "" != $this->delimiter ) ? $this->delimiter : $this->settings['delimiter'];
 
939
  $e = $this->settings['escape'];
940
- $l = $this->settings['length'];
941
 
942
  $this->is_csv = $d;
943
 
@@ -969,7 +971,7 @@ class PMXI_CsvParser
969
  $create_new_headers = false;
970
  $skip_x_rows = apply_filters('wp_all_import_skip_x_csv_rows', false, $import_id);
971
  $headers = array();
972
- while ($keys = fgetcsv($res, $l, $d, $e)) {
973
 
974
  if ($skip_x_rows !== false && $skip_x_rows > $c) {
975
  $c++;
11
  * @access public
12
  */
13
  $settings = array(
14
+ 'delimiter' => ",",
15
  'eol' => '',
16
  'length' => 999999,
17
+ 'enclosure' => '"',
18
+ 'escape' => "\\",
19
  ),
20
 
21
  $tmp_files = array(),
937
 
938
  $c = 0;
939
  $d = ( "" != $this->delimiter ) ? $this->delimiter : $this->settings['delimiter'];
940
+ $en = $this->settings['enclosure'];
941
  $e = $this->settings['escape'];
942
+ $l = $this->settings['length'];
943
 
944
  $this->is_csv = $d;
945
 
971
  $create_new_headers = false;
972
  $skip_x_rows = apply_filters('wp_all_import_skip_x_csv_rows', false, $import_id);
973
  $headers = array();
974
+ while ($keys = fgetcsv($res, $l, $d, $en, $e)) {
975
 
976
  if ($skip_x_rows !== false && $skip_x_rows > $c) {
977
  $c++;
models/image/list.php CHANGED
@@ -50,8 +50,7 @@ class PMXI_Image_List extends PMXI_Model_List {
50
  $attch = get_post($attid);
51
  if ($attch) {
52
  break;
53
- }
54
- else{
55
  $imageRecord->delete();
56
  }
57
  }
50
  $attch = get_post($attid);
51
  if ($attch) {
52
  break;
53
+ } else {
 
54
  $imageRecord->delete();
55
  }
56
  }
models/import/record.php CHANGED
@@ -86,6 +86,583 @@ class PMXI_Import_Record extends PMXI_Model_Record {
86
  $this->errors = new WP_Error();
87
  }
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  protected function update_meta( $pid, $key, $value ){
90
 
91
  $meta_table = _get_meta_table( 'post' );
@@ -417,7 +994,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
417
  $tx_name = $ctx->name;
418
  $mapping_rules = ( ! empty($this->options['tax_mapping'][$tx_name])) ? json_decode($this->options['tax_mapping'][$tx_name], true) : false;
419
  $taxonomies[$tx_name] = array();
420
- if ( ! empty($this->options['tax_logic'][$tx_name]) ) {
421
  switch ($this->options['tax_logic'][$tx_name]){
422
  case 'single':
423
  if ( isset($this->options['tax_single_xpath'][$tx_name]) && $this->options['tax_single_xpath'][$tx_name] !== "" ){
@@ -1267,7 +1844,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1267
  $logger and call_user_func($logger, sprintf(__('Preserve status of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1268
  }
1269
  if ( ! $this->options['is_update_content']){
1270
- $articleData['post_content'] = $post_to_update->post_content;
1271
  $logger and call_user_func($logger, sprintf(__('Preserve content of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1272
  }
1273
  if ( ! $this->options['is_update_title']){
@@ -1824,10 +2401,24 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1824
  $attid = false;
1825
 
1826
  if ($this->options['search_existing_images']) {
1827
- // trying to find existing image in images table
1828
- $logger and call_user_func($logger, sprintf(__('- Searching for existing image `%s` by URL...', 'wp_all_import_plugin'), rawurldecode($image)));
1829
- $imageList = new PMXI_Image_List();
1830
- $attch = $imageList->getExistingImageByUrl($image);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1831
  }
1832
 
1833
  // exisitng image founded
@@ -2776,7 +3367,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2776
  $is_update = ! empty($articleData['ID']);
2777
 
2778
  // fire important hooks after custom fields are added
2779
- if ( ! $this->options['is_fast_mode'] and ! in_array($this->options['custom_type'], array('import_users', 'shop_customer', 'taxonomies', 'comments', 'woo_reviews'))){
2780
  $_post = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM {$this->wpdb->posts} WHERE ID = %d LIMIT 1", $pid ) );
2781
  $_post = sanitize_post( $_post, 'raw' );
2782
  $post_object = new WP_Post( $_post );
@@ -2849,7 +3440,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2849
  $is_import_complete = ($records_count == $records_to_import);
2850
 
2851
  // Set out of stock status for missing records [Woocommerce add-on option]
2852
- if ( $is_import_complete and empty($this->options['is_delete_missing']) and $post_type[$i] == "product" and class_exists('PMWI_Plugin') and !empty($this->options['missing_records_stock_status']) and "manual" != $this->options['duplicate_matching']) {
2853
 
2854
  $logger and call_user_func($logger, __('Update stock status previously imported posts which are no longer actual...', 'wp_all_import_plugin'));
2855
  $args = array('import_id' => $this->id, 'iteration !=' => $this->iteration);
@@ -3156,7 +3747,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
3156
  do_action('pmxi_delete_post', $ids, $this);
3157
  // delete_user action
3158
  foreach( $ids as $id) {
3159
- do_action( 'delete_user', $id, $reassign = null );
3160
  }
3161
  $sql = "delete a,b
3162
  FROM ".$this->wpdb->users." a
@@ -3164,7 +3755,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
3164
  WHERE a.ID IN (" . implode(',', $ids) . ");";
3165
  // deleted_user action
3166
  foreach( $ids as $id) {
3167
- do_action( 'deleted_user', $id, $reassign = null );
3168
  }
3169
  $this->wpdb->query( $sql );
3170
  break;
@@ -3398,7 +3989,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
3398
  do_action('pmxi_delete_post', $ids, $this);
3399
  // delete_user action
3400
  foreach( $ids as $id) {
3401
- do_action( 'delete_user', $id, $reassign = null );
3402
  }
3403
  $sql = "delete a,b
3404
  FROM ".$this->wpdb->users." a
@@ -3406,7 +3997,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
3406
  WHERE a.ID IN (".implode(',', $ids).");";
3407
  // deleted_user action
3408
  foreach( $ids as $id) {
3409
- do_action( 'deleted_user', $id, $reassign = null );
3410
  }
3411
  $this->wpdb->query($sql);
3412
  break;
86
  $this->errors = new WP_Error();
87
  }
88
 
89
+ /**
90
+ * Import all files matched by path
91
+ * @param callback[optional] $logger Method where progress messages are submmitted
92
+ * @return PMXI_Import_Record
93
+ * @chainable
94
+ */
95
+ public function execute($logger = NULL, $cron = true, $history_log_id = false) {
96
+
97
+ $uploads = wp_upload_dir();
98
+
99
+ if ($this->path) {
100
+ $files = array($this->path);
101
+ foreach ($files as $ind => $path) {
102
+ $filePath = '';
103
+ if ( $this->queue_chunk_number == 0 and $this->processing == 0 ) {
104
+
105
+ $this->set(array('processing' => 1))->update(); // lock cron requests
106
+
107
+ $upload_result = FALSE;
108
+
109
+ if ($this->type == 'ftp'){
110
+ try {
111
+ $files = PMXI_FTPFetcher::fetch($this->options);
112
+ $uploader = new PMXI_Upload($files[0], $this->errors, rtrim(str_replace(basename($files[0]), '', $files[0]), '/'));
113
+ $upload_result = $uploader->upload();
114
+ } catch (Exception $e) {
115
+ $this->errors->add('form-validation', $e->getMessage());
116
+ }
117
+ } elseif ($this->type == 'url') {
118
+ $filesXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<data><node></node></data>";
119
+ $filePaths = XmlImportParser::factory($filesXML, '/data/node', $this->path, $file)->parse(); $tmp_files[] = $file;
120
+ foreach ($tmp_files as $tmp_file) { // remove all temporary files created
121
+ @unlink($tmp_file);
122
+ }
123
+ $file_to_import = $this->path;
124
+ if ( ! empty($filePaths) and is_array($filePaths) ) {
125
+ $file_to_import = array_shift($filePaths);
126
+ }
127
+ $uploader = new PMXI_Upload(trim($file_to_import), $this->errors);
128
+ $upload_result = $uploader->url($this->feed_type, $this->path);
129
+ } elseif ( $this->type == 'file') {
130
+ $uploader = new PMXI_Upload(trim($this->path), $this->errors);
131
+ $upload_result = $uploader->file();
132
+ } else { // retrieve already uploaded file
133
+ $uploader = new PMXI_Upload(trim($this->path), $this->errors, rtrim(str_replace(wp_all_import_basename($this->path), '', $this->path), '/'));
134
+ $upload_result = $uploader->upload();
135
+ }
136
+
137
+ if (!count($this->errors->errors)) {
138
+ $filePath = $upload_result['filePath'];
139
+ }
140
+
141
+ if ( ! $this->errors->get_error_codes() and "" != $filePath ) {
142
+ $this->set(array('queue_chunk_number' => 1))->update();
143
+ } elseif ( $this->errors->get_error_codes() ){
144
+ $msgs = $this->errors->get_error_messages();
145
+ if ( ! is_array($msgs)) {
146
+ $msgs = array($msgs);
147
+ }
148
+ $this->set(array('processing' => 0))->update();
149
+ return array(
150
+ 'status' => 500,
151
+ 'message' => $msgs
152
+ );
153
+ }
154
+ $this->set(array('processing' => 0))->update(); // unlock cron requests
155
+ }
156
+
157
+ // if empty file path, than it's mean feed in cron process. Take feed path from history.
158
+ if (empty($filePath)){
159
+ $history = new PMXI_File_List();
160
+ $history->setColumns('id', 'name', 'registered_on', 'path')->getBy(array('import_id' => $this->id), 'id DESC');
161
+ if ($history->count()){
162
+ $history_file = new PMXI_File_Record();
163
+ $history_file->getBy('id', $history[0]['id']);
164
+ $filePath = wp_all_import_get_absolute_path($history_file->path);
165
+ }
166
+ }
167
+
168
+ // if feed path found
169
+ if ( ! empty($filePath) and @file_exists($filePath) ) {
170
+
171
+ $functions = $uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php';
172
+ $functions = apply_filters( 'import_functions_file_path', $functions );
173
+ if ( @file_exists($functions) && PMXI_Plugin::$is_php_allowed)
174
+ require_once $functions;
175
+
176
+ if ( $this->queue_chunk_number === 1 and $this->processing == 0 ){ // import first cron request
177
+
178
+ $this->set(array('processing' => 1))->update(); // lock cron requests
179
+
180
+ if (empty($this->options['encoding'])){
181
+ $currentOptions = $this->options;
182
+ $currentOptions['encoding'] = 'UTF-8';
183
+ $this->set(array(
184
+ 'options' => $currentOptions
185
+ ))->update();
186
+ }
187
+
188
+ set_time_limit(0);
189
+
190
+ // wp_all_import_get_reader_engine( array($filePath), array('root_element' => $this->root_element), $this->id );
191
+
192
+ $file = new PMXI_Chunk($filePath, array('element' => $this->root_element, 'encoding' => $this->options['encoding']));
193
+
194
+ // chunks counting
195
+ $chunks = 0; $history_xml = '';
196
+ while ($xml = $file->read()) {
197
+ if (!empty($xml)) {
198
+ //PMXI_Import_Record::preprocessXml($xml);
199
+ $xml = "<?xml version=\"1.0\" encoding=\"". $this->options['encoding'] ."\"?>" . "\n" . $xml;
200
+
201
+ $dom = new DOMDocument('1.0', ( ! empty($this->options['encoding']) ) ? $this->options['encoding'] : 'UTF-8');
202
+ $old = libxml_use_internal_errors(true);
203
+ $dom->loadXML($xml);
204
+ libxml_use_internal_errors($old);
205
+ $xpath = new DOMXPath($dom);
206
+ if (($elements = @$xpath->query($this->xpath)) and $elements->length){
207
+ $chunks += $elements->length;
208
+ if ("" == $history_xml) $history_xml = $xml;
209
+ }
210
+ unset($dom, $xpath, $elements);
211
+ }
212
+ }
213
+ unset($file);
214
+
215
+ if ( ! $chunks ){
216
+
217
+ $this->set(array(
218
+ 'queue_chunk_number' => 0,
219
+ 'processing' => 0,
220
+ 'imported' => 0,
221
+ 'created' => 0,
222
+ 'updated' => 0,
223
+ 'skipped' => 0,
224
+ 'deleted' => 0,
225
+ 'triggered' => 0,
226
+ 'registered_on' => date('Y-m-d H:i:s')
227
+ ))->update();
228
+
229
+ $force_cron_processing = apply_filters('wp_all_import_force_cron_processing_on_empty_feed', false, $this->id);
230
+ if ( ! $force_cron_processing ){
231
+ return array(
232
+ 'status' => 500,
233
+ 'message' => sprintf(__('#%s No matching elements found for Root element and XPath expression specified', 'wp_all_import_plugin'), $this->id)
234
+ );
235
+ }
236
+ }
237
+
238
+ // unlick previous files
239
+ $history = new PMXI_File_List();
240
+ $history->setColumns('id', 'name', 'registered_on', 'path')->getBy(array('import_id' => $this->id), 'id DESC');
241
+ if ($history->count()){
242
+ foreach ($history as $file){
243
+ $history_file_path = wp_all_import_get_absolute_path($file['path']);
244
+ if (@file_exists($history_file_path) and $history_file_path != $filePath){
245
+ if (in_array($this->type, array('upload')))
246
+ wp_all_import_remove_source($history_file_path, false);
247
+ else
248
+ wp_all_import_remove_source($history_file_path);
249
+ }
250
+ $history_file = new PMXI_File_Record();
251
+ $history_file->getBy('id', $file['id']);
252
+ if ( ! $history_file->isEmpty()) $history_file->delete( $history_file_path != $filePath );
253
+ }
254
+ }
255
+
256
+ // update history
257
+ $history_file = new PMXI_File_Record();
258
+ $history_file->set(array(
259
+ 'name' => $this->name,
260
+ 'import_id' => $this->id,
261
+ 'path' => wp_all_import_get_relative_path($filePath),
262
+ //'contents' => (isset($history_xml)) ? $history_xml : '',
263
+ 'registered_on' => date('Y-m-d H:i:s')
264
+ ))->insert();
265
+
266
+ $this->set(array('count' => $chunks, 'processing' => 0))->update(); // set pointer to the first chunk, updates feed elements count and unlock cron process
267
+
268
+ do_action( 'pmxi_before_xml_import', $this->id );
269
+
270
+ }
271
+
272
+ // compose data to look like result of wizard steps
273
+ if( ($this->queue_chunk_number or !empty($force_cron_processing)) and $this->processing == 0 ) {
274
+
275
+ $records = array();
276
+
277
+ if ($this->options['is_import_specified']) {
278
+ $import_specified_option = apply_filters('wp_all_import_specified_records', $this->options['import_specified'], $this->id, false);
279
+ foreach (preg_split('% *, *%', $import_specified_option, -1, PREG_SPLIT_NO_EMPTY) as $chank) {
280
+ if (preg_match('%^(\d+)-(\d+)$%', $chank, $mtch)) {
281
+ $records = array_merge($records, range(intval($mtch[1]), intval($mtch[2])));
282
+ } else {
283
+ $records = array_merge($records, array(intval($chank)));
284
+ }
285
+ }
286
+ }
287
+
288
+ $records_to_import = (int) ((empty($records)) ? $this->count : $records[count($records) -1]);
289
+
290
+ // Lock cron requests.
291
+ $this->set(array(
292
+ 'processing' => 1,
293
+ 'registered_on' => date('Y-m-d H:i:s')
294
+ ))->update();
295
+
296
+ @set_time_limit(0);
297
+
298
+ $processing_time_limit = (PMXI_Plugin::getInstance()->getOption('cron_processing_time_limit')) ? PMXI_Plugin::getInstance()->getOption('cron_processing_time_limit') : 59;
299
+ // Do not limit process time on command line.
300
+ if (PMXI_Plugin::getInstance()->isCli()) {
301
+ $processing_time_limit = time();
302
+ }
303
+ $start_processing_time = time();
304
+ $progress = NULL;
305
+ if (PMXI_Plugin::getInstance()->isCli() && class_exists('WP_CLI')) {
306
+ $custom_type = get_post_type_object( $this->options['custom_type'] );
307
+ $progress = \WP_CLI\Utils\make_progress_bar( 'Importing ' . $custom_type->labels->name, $records_to_import );
308
+ }
309
+ if ( (int) $this->imported + (int) $this->skipped <= (int) $records_to_import ) {
310
+ $file = new PMXI_Chunk($filePath, array('element' => $this->root_element, 'encoding' => $this->options['encoding'], 'pointer' => $this->queue_chunk_number));
311
+ $feed = "<?xml version=\"1.0\" encoding=\"". $this->options['encoding'] ."\"?>" . "\n" . "<pmxi_records>";
312
+ $loop = 0;
313
+ $chunk_number = $this->queue_chunk_number;
314
+ while ($xml = $file->read() and $this->processing == 1 and (time() - $start_processing_time) <= $processing_time_limit ) {
315
+ if (!empty($xml)) {
316
+ $chunk_number++;
317
+ $xml_chunk = "<?xml version=\"1.0\" encoding=\"". $this->options['encoding'] ."\"?>" . "\n" . $xml;
318
+ $dom = new DOMDocument('1.0', ( ! empty($this->options['encoding']) ) ? $this->options['encoding'] : 'UTF-8');
319
+ $old = libxml_use_internal_errors(true);
320
+ $dom->loadXML($xml_chunk);
321
+ libxml_use_internal_errors($old);
322
+ $xpath = new DOMXPath($dom);
323
+
324
+ if (($elements = @$xpath->query($this->xpath)) && $elements->length && $records_to_import > $loop + (int) $this->imported + (int) $this->skipped){
325
+ $feed .= $xml;
326
+ $loop += $elements->length;
327
+ }
328
+ unset($dom, $xpath, $elements);
329
+ }
330
+
331
+ if ( $loop > 0 and ( $loop == (int) $this->options['records_per_request'] or $records_to_import == (int) $this->imported + (int) $this->skipped or $records_to_import == $loop + (int) $this->imported + (int) $this->skipped or $records_to_import == $chunk_number) ) { // skipping scheduled imports if any for the next hit
332
+ $feed .= "</pmxi_records>";
333
+ $this->process($feed, $logger, $chunk_number, $cron, '/pmxi_records', $loop, $progress);
334
+
335
+ // set last update
336
+ $this->set(array(
337
+ 'registered_on' => date('Y-m-d H:i:s'),
338
+ 'queue_chunk_number' => $chunk_number
339
+ ))->update();
340
+
341
+ $loop = 0;
342
+ $feed = "<?xml version=\"1.0\" encoding=\"". $this->options['encoding'] ."\"?>" . "\n" . "<pmxi_records>";
343
+ }
344
+
345
+ if ( $records_to_import < $loop + (int) $this->imported + (int) $this->skipped ){
346
+ break;
347
+ }
348
+ }
349
+
350
+ unset($file);
351
+ }
352
+
353
+ // detect, if cron process if finished
354
+ if ( (int) $records_to_import <= (int) $this->imported + (int) $this->skipped or $records_to_import == $this->queue_chunk_number){
355
+
356
+ $this->delete_source( $logger );
357
+
358
+ // Delete posts that are no longer present in your file
359
+ if (! empty($this->options['is_delete_missing']) and $this->options['duplicate_matching'] == 'auto'){
360
+
361
+ $postList = new PMXI_Post_List();
362
+ $args = array('import_id' => $this->id, 'iteration !=' => $this->iteration);
363
+ if ( ! empty($this->options['is_import_specified']) ) $args['specified'] = 1;
364
+ $missing_ids = array();
365
+ $missingPosts = $postList->getBy($args);
366
+
367
+ if (!$missingPosts->isEmpty()) {
368
+ foreach ($missingPosts as $missingPost) {
369
+ $missing_ids[] = $missingPost;
370
+ }
371
+ }
372
+
373
+ // Delete posts from database.
374
+ if (!empty($missing_ids) && is_array($missing_ids)) {
375
+ $missing_ids_arr = array_chunk($missing_ids, $this->options['records_per_request']);
376
+ $count_deleted_missing_records = 0;
377
+ foreach ($missing_ids_arr as $key => $missingPostRecords) {
378
+ if (!empty($missingPostRecords)){
379
+ foreach ( $missingPostRecords as $k => $missingPostRecord ) {
380
+ $to_delete = true;
381
+ // Instead of deletion, set Custom Field.
382
+ if ($this->options['is_update_missing_cf']){
383
+ switch ($this->options['custom_type']){
384
+ case 'import_users':
385
+ update_user_meta( $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
386
+ $logger and call_user_func($logger, sprintf(__('Instead of deletion user with ID `%s`, set Custom Field `%s` to value `%s`', 'wp_all_import_plugin'), $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
387
+ break;
388
+ case 'shop_customer':
389
+ update_user_meta( $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
390
+ $logger and call_user_func($logger, sprintf(__('Instead of deletion customer with ID `%s`, set Custom Field `%s` to value `%s`', 'wp_all_import_plugin'), $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
391
+ break;
392
+ case 'taxonomies':
393
+ update_term_meta( $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
394
+ $logger and call_user_func($logger, sprintf(__('Instead of deletion taxonomy term with ID `%s`, set Custom Field `%s` to value `%s`', 'wp_all_import_plugin'), $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
395
+ break;
396
+ case 'woo_reviews':
397
+ case 'comments':
398
+ update_comment_meta( $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
399
+ $logger and call_user_func($logger, sprintf(__('Instead of deletion comment with ID `%s`, set Custom Field `%s` to value `%s`', 'wp_all_import_plugin'), $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
400
+ break;
401
+ default:
402
+ update_post_meta( $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
403
+ $logger and call_user_func($logger, sprintf(__('Instead of deletion post with ID `%s`, set Custom Field `%s` to value `%s`', 'wp_all_import_plugin'), $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
404
+ break;
405
+ }
406
+ $to_delete = false;
407
+ }
408
+
409
+ // Instead of deletion, change post status to Draft
410
+ $final_post_type = get_post_type($missingPostRecord['post_id']);
411
+ if ($this->options['set_missing_to_draft']){
412
+ if ($final_post_type != 'product_variation' and 'draft' != get_post_status($missingPostRecord['post_id'])){
413
+ $this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $missingPostRecord['post_id']) );
414
+ $this->recount_terms($missingPostRecord['post_id'], $final_post_type);
415
+ }
416
+ $to_delete = false;
417
+ }
418
+
419
+ $to_delete = apply_filters('wp_all_import_is_post_to_delete', $to_delete, $missingPostRecord['post_id'], $this);
420
+
421
+ // Delete posts that are no longer present in your file
422
+ if ($to_delete) {
423
+ if (!in_array($this->options['custom_type'], array("import_users", "taxonomies", "shop_customer"))) {
424
+ // Remove attachments
425
+ empty($this->options['is_keep_attachments']) and wp_delete_attachments($missingPostRecord['post_id'], true, 'files');
426
+ // Remove images
427
+ empty($this->options['is_keep_imgs']) and wp_delete_attachments($missingPostRecord['post_id'], true, 'images');
428
+ // Clear post's relationships
429
+ wp_delete_object_term_relationships($missingPostRecord['post_id'], get_object_taxonomies('' != $this->options['custom_type'] ? $this->options['custom_type'] : 'post'));
430
+ }
431
+ }
432
+ else {
433
+ $postRecord = new PMXI_Post_Record();
434
+ $postRecord->getBy(array(
435
+ 'post_id' => $missingPostRecord['post_id'],
436
+ 'import_id' => $this->id,
437
+ ));
438
+
439
+ if (!$postRecord->isEmpty()) {
440
+ $is_unlink_missing_posts = apply_filters('wp_all_import_is_unlink_missing_posts', false, $this->id, $missingPostRecord['post_id']);
441
+ if ( $is_unlink_missing_posts ){
442
+ $postRecord->delete();
443
+ }
444
+ else {
445
+ $postRecord->set(array(
446
+ 'iteration' => $this->iteration
447
+ ))->save();
448
+ }
449
+ }
450
+ do_action('pmxi_missing_post', $missingPostRecord['post_id']);
451
+ unset($missingPostRecords[$k]);
452
+ }
453
+ }
454
+
455
+ $ids = array();
456
+
457
+ if (!empty( $missingPostRecords)) {
458
+ foreach ($missingPostRecords as $k => $missingPostRecord) {
459
+ $ids[] = $missingPostRecord['post_id'];
460
+ }
461
+
462
+ switch ($this->options['custom_type']) {
463
+ case 'import_users':
464
+ case 'shop_customer':
465
+ do_action('pmxi_delete_post', $ids, $this);
466
+ // delete_user action
467
+ foreach( $ids as $id) {
468
+ do_action( 'delete_user', $id, $reassign = null );
469
+ }
470
+ $sql = "delete a,b
471
+ FROM ".$this->wpdb->users." a
472
+ LEFT JOIN ".$this->wpdb->usermeta." b ON ( a.ID = b.user_id )
473
+ WHERE a.ID IN (" . implode(',', $ids) . ");";
474
+ // deleted_user action
475
+ foreach( $ids as $id) {
476
+ do_action( 'deleted_user', $id, $reassign = null );
477
+ }
478
+ $this->wpdb->query( $sql );
479
+ break;
480
+ case 'taxonomies':
481
+ do_action('pmxi_delete_taxonomies', $ids);
482
+ foreach ($ids as $term_id){
483
+ wp_delete_term( $term_id, $this->options['taxonomy_type'] );
484
+ }
485
+ break;
486
+ case 'woo_reviews':
487
+ case 'comments':
488
+ do_action('pmxi_delete_comments', $ids);
489
+ foreach ($ids as $comment_id){
490
+ wp_delete_comment( $comment_id, TRUE );
491
+ }
492
+ break;
493
+ default:
494
+ do_action('pmxi_delete_post', $ids, $this);
495
+ foreach ($ids as $id) {
496
+ wp_delete_post($id, TRUE);
497
+ }
498
+ break;
499
+ }
500
+
501
+ // Delete record form pmxi_posts
502
+ $sql = "DELETE FROM " . PMXI_Plugin::getInstance()->getTablePrefix() . "posts WHERE post_id IN (".implode(',', $ids).") AND import_id = %d";
503
+ $this->wpdb->query(
504
+ $this->wpdb->prepare($sql, $this->id)
505
+ );
506
+
507
+ $this->set(array('deleted' => $this->deleted + count($ids)))->update();
508
+
509
+ $logger and call_user_func($logger, sprintf(__('%d Posts deleted from database. IDs (%s)', 'wp_all_import_plugin'), $this->deleted, implode(",", $ids)));
510
+ }
511
+
512
+ $count_deleted_missing_records += count($ids);
513
+
514
+ if ( (time() - $start_processing_time) > $processing_time_limit ) {
515
+ $this->set(array(
516
+ 'processing' => 0
517
+ ))->update();
518
+
519
+ return array(
520
+ 'status' => 200,
521
+ 'message' => sprintf(__('Deleted missing records %s for import #%s', 'wp_all_import_plugin'), $count_deleted_missing_records, $this->id)
522
+ );
523
+ }
524
+ }
525
+ }
526
+ }
527
+ }
528
+
529
+ // Set out of stock status for missing records [Woocommerce add-on option]
530
+ if ((empty($this->options['is_delete_missing']) || $this->options['is_update_missing_cf'] || $this->options['set_missing_to_draft']) and $this->options['custom_type'] == "product" and class_exists('PMWI_Plugin') and !empty($this->options['missing_records_stock_status']) and "manual" != $this->options['duplicate_matching']) {
531
+
532
+ $postList = new PMXI_Post_List();
533
+ $args = array('import_id' => $this->id, 'iteration !=' => $this->iteration);
534
+ if ( ! empty($this->options['is_import_specified']) ) $args['specified'] = 1;
535
+ $missing_ids = array();
536
+ $missingPosts = $postList->getBy($args);
537
+
538
+ if (!$missingPosts->isEmpty()) {
539
+ foreach ($missingPosts as $missingPost) {
540
+ $missing_ids[] = $missingPost;
541
+ }
542
+ }
543
+ // Delete posts from database.
544
+ if (!empty($missing_ids) && is_array($missing_ids)) {
545
+ $missing_ids_arr = array_chunk($missing_ids, 50);
546
+ foreach ($missing_ids_arr as $key => $missingPostRecords) {
547
+ if (!empty($missingPostRecords)) {
548
+ foreach ( $missingPostRecords as $k => $missingPostRecord ) {
549
+ $this->update_meta( $missingPostRecord['post_id'], '_stock_status', 'outofstock' );
550
+ $this->update_meta( $missingPostRecord['post_id'], '_stock', 0 );
551
+ $term_ids = wp_get_object_terms($missingPostRecord['post_id'], 'product_visibility', array('fields' => 'ids'));
552
+ $outofstock_term = get_term_by( 'name', 'outofstock', 'product_visibility' );
553
+ if (!empty($outofstock_term) && !is_wp_error($outofstock_term) && !in_array($outofstock_term->term_taxonomy_id, $term_ids)){
554
+ $term_ids[] = $outofstock_term->term_taxonomy_id;
555
+ }
556
+ $this->associate_terms( $missingPostRecord['post_id'], $term_ids, 'product_visibility', $logger );
557
+
558
+ $postRecord = new PMXI_Post_Record();
559
+ $postRecord->getBy(array(
560
+ 'post_id' => $missingPostRecord['post_id'],
561
+ 'import_id' => $this->id,
562
+ ));
563
+ if (!$postRecord->isEmpty() && empty($this->options['is_delete_missing'])) {
564
+ $postRecord->set(array(
565
+ 'iteration' => $this->iteration
566
+ ))->save();
567
+ }
568
+ unset($postRecord);
569
+ }
570
+
571
+ $this->set(array(
572
+ 'processing' => 0
573
+ ))->update();
574
+
575
+ return array(
576
+ 'status' => 200,
577
+ 'message' => sprintf(__('Updating stock status for missing records %s for import #%s', 'wp_all_import_plugin'), count($missing_ids), $this->id)
578
+ );
579
+ }
580
+ }
581
+ }
582
+ }
583
+
584
+ $this->set(array(
585
+ 'processing' => 0,
586
+ 'triggered' => 0,
587
+ 'queue_chunk_number' => 0,
588
+ 'registered_on' => date('Y-m-d H:i:s'), // update registered_on to indicated that job has been executed even if no files are going to be imported by the rest of the method
589
+ 'iteration' => ++$this->iteration
590
+ ))->update();
591
+
592
+ foreach ( get_taxonomies() as $tax ) {
593
+ delete_option( "{$tax}_children" );
594
+ _get_term_hierarchy( $tax );
595
+ }
596
+
597
+ if ( $history_log_id ){
598
+ $history_log = new PMXI_History_Record();
599
+ $history_log->getById( $history_log_id );
600
+ if ( ! $history_log->isEmpty() ){
601
+ $custom_type = get_post_type_object( $this->options['custom_type'] );
602
+ $history_log->set(array(
603
+ 'time_run' => time() - strtotime($history_log->date),
604
+ 'summary' => sprintf(__("import finished & cron un-triggered<br>%s %s created %s updated %s deleted %s skipped", "pmxi_plugin"), $this->created, ( ($this->created == 1) ? $custom_type->labels->singular_name : $custom_type->labels->name ), $this->updated, $this->deleted, $this->skipped)
605
+ ))->save();
606
+ }
607
+ }
608
+ do_action( 'pmxi_after_xml_import', $this->id, $this );
609
+ return array(
610
+ 'status' => 200,
611
+ 'message' => sprintf(__('Import #%s complete', 'wp_all_import_plugin'), $this->id)
612
+ );
613
+ }
614
+ else {
615
+ $this->set(array(
616
+ 'processing' => 0
617
+ ))->update();
618
+ if ( $history_log_id ) {
619
+ $history_log = new PMXI_History_Record();
620
+ $history_log->getById( $history_log_id );
621
+ if ( ! $history_log->isEmpty() ){
622
+ $custom_type = get_post_type_object( $this->options['custom_type'] );
623
+ $history_log->set(array(
624
+ 'time_run' => time() - strtotime($history_log->date),
625
+ 'summary' => sprintf(__("%d %s created %d updated %d deleted %d skipped", "pmxi_plugin"), $this->created, ( ($this->created == 1) ? $custom_type->labels->singular_name : $custom_type->labels->name ), $this->updated, $this->deleted, $this->skipped)
626
+ ))->save();
627
+ }
628
+ }
629
+ return array(
630
+ 'status' => 200,
631
+ 'message' => sprintf(__('Records Processed %s. Records imported %s of %s.', 'wp_all_import_plugin'), (int) $this->queue_chunk_number, (int) $this->imported, (int) $this->count)
632
+ );
633
+ }
634
+ }
635
+ }
636
+ else {
637
+ $this->set(array(
638
+ 'processing' => 0,
639
+ 'triggered' => 0,
640
+ 'queue_chunk_number' => 0,
641
+ 'imported' => 0,
642
+ 'created' => 0,
643
+ 'updated' => 0,
644
+ 'skipped' => 0,
645
+ 'deleted' => 0,
646
+ 'registered_on' => date('Y-m-d H:i:s'), // update registered_on to indicated that job has been executed even if no files are going to be imported by the rest of the method
647
+ ))->update();
648
+
649
+ if ( $history_log_id ){
650
+ $history_log = new PMXI_History_Record();
651
+ $history_log->getById( $history_log_id );
652
+ if ( ! $history_log->isEmpty() ){
653
+ $history_log->delete();
654
+ }
655
+ }
656
+ return array(
657
+ 'status' => 500,
658
+ 'message' => sprintf(__('#%s source file not found', 'wp_all_import_plugin'), $this->id)
659
+ );
660
+ }
661
+ }
662
+ }
663
+ return $this;
664
+ }
665
+
666
  protected function update_meta( $pid, $key, $value ){
667
 
668
  $meta_table = _get_meta_table( 'post' );
994
  $tx_name = $ctx->name;
995
  $mapping_rules = ( ! empty($this->options['tax_mapping'][$tx_name])) ? json_decode($this->options['tax_mapping'][$tx_name], true) : false;
996
  $taxonomies[$tx_name] = array();
997
+ if ( ! empty($this->options['tax_logic'][$tx_name]) and ! empty($this->options['tax_assing'][$tx_name]) ){
998
  switch ($this->options['tax_logic'][$tx_name]){
999
  case 'single':
1000
  if ( isset($this->options['tax_single_xpath'][$tx_name]) && $this->options['tax_single_xpath'][$tx_name] !== "" ){
1844
  $logger and call_user_func($logger, sprintf(__('Preserve status of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1845
  }
1846
  if ( ! $this->options['is_update_content']){
1847
+ unset($articleData['post_content']);
1848
  $logger and call_user_func($logger, sprintf(__('Preserve content of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1849
  }
1850
  if ( ! $this->options['is_update_title']){
2401
  $attid = false;
2402
 
2403
  if ($this->options['search_existing_images']) {
2404
+ $imageList = new PMXI_Image_List();
2405
+ switch ($this->options['search_existing_images_logic']) {
2406
+ case 'by_url':
2407
+ // trying to find existing image in images table
2408
+ $logger and call_user_func($logger, sprintf(__('- Searching for existing image `%s` by URL...', 'wp_all_import_plugin'), rawurldecode($image)));
2409
+ $attch = $imageList->getExistingImageByUrl($image);
2410
+ break;
2411
+ default:
2412
+ // trying to find existing image in images table
2413
+ $logger and call_user_func($logger, sprintf(__('- Searching for existing image `%s` by filename...', 'wp_all_import_plugin'), basename($image)));
2414
+ $attch = $imageList->getExistingImageByFilename(basename($image));
2415
+ // Search for existing images for new imports only using old logic.
2416
+ if (empty($attch)) {
2417
+ $logger and call_user_func($logger, sprintf(__('- Search for existing image `%s` by `_wp_attached_file` ...', 'wp_all_import_plugin'), basename($image)));
2418
+ $attch = wp_all_import_get_image_from_gallery(basename($image), $targetDir, 'images', $logger);
2419
+ }
2420
+ break;
2421
+ }
2422
  }
2423
 
2424
  // exisitng image founded
3367
  $is_update = ! empty($articleData['ID']);
3368
 
3369
  // fire important hooks after custom fields are added
3370
+ if ( ! $this->options['is_fast_mode'] and ! in_array($this->options['custom_type'], array('import_users', 'shop_customer', 'taxonomies', 'comments', 'woo_reviews', 'gf_entries'))){
3371
  $_post = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM {$this->wpdb->posts} WHERE ID = %d LIMIT 1", $pid ) );
3372
  $_post = sanitize_post( $_post, 'raw' );
3373
  $post_object = new WP_Post( $_post );
3440
  $is_import_complete = ($records_count == $records_to_import);
3441
 
3442
  // Set out of stock status for missing records [Woocommerce add-on option]
3443
+ if ( $is_import_complete and (empty($this->options['is_delete_missing']) || $this->options['is_update_missing_cf'] || $this->options['set_missing_to_draft']) and $post_type[$i] == "product" and class_exists('PMWI_Plugin') and !empty($this->options['missing_records_stock_status']) and "manual" != $this->options['duplicate_matching']) {
3444
 
3445
  $logger and call_user_func($logger, __('Update stock status previously imported posts which are no longer actual...', 'wp_all_import_plugin'));
3446
  $args = array('import_id' => $this->id, 'iteration !=' => $this->iteration);
3747
  do_action('pmxi_delete_post', $ids, $this);
3748
  // delete_user action
3749
  foreach( $ids as $id) {
3750
+ do_action( 'delete_user', $id, $reassign = null, new WP_User($id) );
3751
  }
3752
  $sql = "delete a,b
3753
  FROM ".$this->wpdb->users." a
3755
  WHERE a.ID IN (" . implode(',', $ids) . ");";
3756
  // deleted_user action
3757
  foreach( $ids as $id) {
3758
+ do_action( 'deleted_user', $id, $reassign = null, new WP_User($id) );
3759
  }
3760
  $this->wpdb->query( $sql );
3761
  break;
3989
  do_action('pmxi_delete_post', $ids, $this);
3990
  // delete_user action
3991
  foreach( $ids as $id) {
3992
+ do_action( 'delete_user', $id, $reassign = null, new WP_User($id) );
3993
  }
3994
  $sql = "delete a,b
3995
  FROM ".$this->wpdb->users." a
3997
  WHERE a.ID IN (".implode(',', $ids).");";
3998
  // deleted_user action
3999
  foreach( $ids as $id) {
4000
+ do_action( 'deleted_user', $id, $reassign = null, new WP_User($id) );
4001
  }
4002
  $this->wpdb->query($sql);
4003
  break;
plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP All Import
4
  Plugin URI: http://www.wpallimport.com/wordpress-xml-csv-import/?utm_source=import-plugin-free&utm_medium=wp-plugins-page&utm_campaign=upgrade-to-pro
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.6.0
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.6.0');
29
 
30
  define('PMXI_EDITION', 'free');
31
 
@@ -116,7 +116,7 @@ final class PMXI_Plugin {
116
  */
117
  public static $is_php_allowed = true;
118
 
119
- public static $capabilities = 'manage_options';
120
 
121
  /**
122
  * WP All Import logs folder
@@ -145,7 +145,10 @@ final class PMXI_Plugin {
145
  */
146
  const HISTORY_DIRECTORY = WP_ALL_IMPORT_HISTORY_DIRECTORY;
147
 
148
- const LANGUAGE_DOMAIN = 'wp_all_import_plugin';
 
 
 
149
 
150
  /**
151
  * Return singletone instance
@@ -259,9 +262,9 @@ final class PMXI_Plugin {
259
  $this->options['cron_job_key'] = wp_all_import_url_title(wp_all_import_rand_char(12));
260
  }
261
 
262
- if ($current_options !== $this->options) {
263
- update_option($option_name, $this->options);
264
- }
265
 
266
  register_activation_hook(self::FILE, array($this, 'activation'));
267
 
@@ -1106,183 +1109,251 @@ final class PMXI_Plugin {
1106
  return true;
1107
  }
1108
 
1109
- /**
1110
- * Method returns default import options, main utility of the method is to avoid warnings when new
1111
- * option is introduced but already registered imports don't have it
1112
- */
1113
- public static function get_default_import_options() {
1114
- return array(
1115
- 'type' => 'post',
1116
- 'is_override_post_type' => 0,
1117
- 'post_type_xpath' => '',
1118
- 'deligate' => '',
1119
- 'wizard_type' => 'new',
1120
- 'custom_type' => '',
1121
- 'featured_delim' => ',',
1122
- 'atch_delim' => ',',
1123
- 'is_search_existing_attach' => 0,
1124
- 'post_taxonomies' => array(),
1125
- 'parent' => 0,
1126
- 'is_multiple_page_parent' => 'yes',
1127
- 'single_page_parent' => '',
1128
- 'order' => 0,
1129
- 'status' => 'publish',
1130
- 'page_template' => 'default',
1131
- 'is_multiple_page_template' => 'yes',
1132
- 'single_page_template' => '',
1133
- 'page_taxonomies' => array(),
1134
- 'date_type' => 'specific',
1135
- 'date' => 'now',
1136
- 'date_start' => 'now',
1137
- 'date_end' => 'now',
1138
- 'custom_name' => array(),
1139
- 'custom_value' => array(),
1140
- 'custom_format' => array(),
1141
- 'custom_mapping' => array(),
1142
- 'serialized_values' => array(),
1143
- 'custom_mapping_rules' => array(),
1144
- 'comment_status' => 'open',
1145
- 'comment_status_xpath' => '',
1146
- 'ping_status' => 'open',
1147
- 'ping_status_xpath' => '',
1148
- 'create_draft' => 'no',
1149
- 'author' => '',
1150
- 'post_excerpt' => '',
1151
- 'post_slug' => '',
1152
- 'attachments' => '',
1153
- 'is_import_specified' => 0,
1154
- 'import_specified' => '',
1155
- 'is_delete_source' => 0,
1156
- 'is_cloak' => 0,
1157
- 'unique_key' => '',
1158
- 'tmp_unique_key' => '',
1159
- 'feed_type' => 'auto',
1160
- 'search_existing_images' => 1,
1161
-
1162
- 'create_new_records' => 1,
1163
- 'is_delete_missing' => 0,
1164
- 'set_missing_to_draft' => 0,
1165
- 'is_update_missing_cf' => 0,
1166
- 'update_missing_cf_name' => '',
1167
- 'update_missing_cf_value' => '',
1168
-
1169
- 'is_keep_former_posts' => 'no',
1170
- 'is_update_status' => 1,
1171
- 'is_update_content' => 1,
1172
- 'is_update_title' => 1,
1173
- 'is_update_slug' => 1,
1174
- 'is_update_excerpt' => 1,
1175
- 'is_update_categories' => 1,
1176
- 'is_update_author' => 1,
1177
- 'is_update_comment_status' => 1,
1178
- 'is_update_ping_status' => 1,
1179
- 'is_update_post_type' => 1,
1180
- 'update_categories_logic' => 'full_update',
1181
- 'taxonomies_list' => array(),
1182
- 'taxonomies_only_list' => array(),
1183
- 'taxonomies_except_list' => array(),
1184
- 'is_update_attachments' => 1,
1185
- 'is_update_images' => 1,
1186
- 'update_images_logic' => 'full_update',
1187
- 'is_update_dates' => 1,
1188
- 'is_update_menu_order' => 1,
1189
- 'is_update_parent' => 1,
1190
- 'is_keep_attachments' => 0,
1191
- 'is_keep_imgs' => 0,
1192
- 'do_not_remove_images' => 1,
1193
-
1194
- 'is_update_custom_fields' => 1,
1195
- 'update_custom_fields_logic' => 'full_update',
1196
- 'custom_fields_list' => array(),
1197
- 'custom_fields_only_list' => array(),
1198
- 'custom_fields_except_list' => array(),
1199
-
1200
- 'duplicate_matching' => 'auto',
1201
- 'duplicate_indicator' => 'title',
1202
- 'custom_duplicate_name' => '',
1203
- 'custom_duplicate_value' => '',
1204
- 'is_update_previous' => 0,
1205
- 'is_scheduled' => '',
1206
- 'scheduled_period' => '',
1207
- 'friendly_name' => '',
1208
- 'records_per_request' => 20,
1209
- 'auto_rename_images' => 0,
1210
- 'auto_rename_images_suffix' => '',
1211
- 'images_name' => 'filename',
1212
- 'post_format' => 'standard',
1213
- 'post_format_xpath' => '',
1214
- 'encoding' => 'UTF-8',
1215
- 'delimiter' => '',
1216
- 'image_meta_title' => '',
1217
- 'image_meta_title_delim' => ',',
1218
- 'image_meta_caption' => '',
1219
- 'image_meta_caption_delim' => ',',
1220
- 'image_meta_alt' => '',
1221
- 'image_meta_alt_delim' => ',',
1222
- 'image_meta_description' => '',
1223
- 'image_meta_description_delim' => ',',
1224
- 'image_meta_description_delim_logic' => 'separate',
1225
- 'status_xpath' => '',
1226
- 'download_images' => 'yes',
1227
- 'converted_options' => 0,
1228
- 'update_all_data' => 'yes',
1229
- 'is_fast_mode' => 0,
1230
- 'chuncking' => 1,
1231
- 'import_processing' => 'ajax',
1232
- 'save_template_as' => 0,
1233
-
1234
- 'title' => '',
1235
- 'content' => '',
1236
- 'name' => '',
1237
- 'is_keep_linebreaks' => 1,
1238
- 'is_leave_html' => 0,
1239
- 'fix_characters' => 0,
1240
- 'pid_xpath' => '',
1241
-
1242
- 'featured_image' => '',
1243
- 'download_featured_image' => '',
1244
- 'download_featured_delim' => ',',
1245
- 'gallery_featured_image' => '',
1246
- 'gallery_featured_delim' => ',',
1247
- 'is_featured' => 1,
1248
- 'is_featured_xpath' => '',
1249
- 'set_image_meta_title' => 0,
1250
- 'set_image_meta_caption' => 0,
1251
- 'set_image_meta_alt' => 0,
1252
- 'set_image_meta_description' => 0,
1253
- 'auto_set_extension' => 0,
1254
- 'new_extension' => '',
1255
- 'tax_logic' => array(),
1256
- 'tax_assing' => array(),
1257
- 'term_assing' => array(),
1258
- 'multiple_term_assing' => array(),
1259
- 'tax_hierarchical_assing' => array(),
1260
- 'tax_hierarchical_last_level_assign' => array(),
1261
- 'tax_single_xpath' => array(),
1262
- 'tax_multiple_xpath' => array(),
1263
- 'tax_hierarchical_xpath' => array(),
1264
- 'tax_multiple_delim' => array(),
1265
- 'tax_hierarchical_delim' => array(),
1266
- 'tax_manualhierarchy_delim' => array(),
1267
- 'tax_hierarchical_logic_entire' => array(),
1268
- 'tax_hierarchical_logic_manual' => array(),
1269
- 'tax_enable_mapping' => array(),
1270
- 'tax_is_full_search_single' => array(),
1271
- 'tax_is_full_search_multiple' => array(),
1272
- 'tax_assign_to_one_term_single' => array(),
1273
- 'tax_assign_to_one_term_multiple' => array(),
1274
- 'tax_mapping' => array(),
1275
- 'tax_logic_mapping' => array(),
1276
- 'is_tax_hierarchical_group_delim' => array(),
1277
- 'tax_hierarchical_group_delim' => array(),
1278
- 'tax_hierarchical_group_delim' => array(),
1279
- 'nested_files' => array(),
1280
- 'xml_reader_engine' => 0,
1281
- 'import_img_tags' => 0,
1282
- 'search_existing_images_logic' => 'by_url',
1283
- 'is_update_post_format' => 1
1284
- );
1285
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1286
 
1287
  /*
1288
  * Convert csv to xml
@@ -1301,9 +1372,12 @@ final class PMXI_Plugin {
1301
 
1302
  }
1303
 
1304
- public static function is_ajax(){
1305
- return strpos($_SERVER["HTTP_ACCEPT"], 'json') !== false;
1306
- }
 
 
 
1307
 
1308
  /**
1309
  * Returns ID of current import.
3
  Plugin Name: WP All Import
4
  Plugin URI: http://www.wpallimport.com/wordpress-xml-csv-import/?utm_source=import-plugin-free&utm_medium=wp-plugins-page&utm_campaign=upgrade-to-pro
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.6.1
7
  Author: Soflyy
8
  */
9
 
25
  */
26
  define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
27
 
28
+ define('PMXI_VERSION', '3.6.1');
29
 
30
  define('PMXI_EDITION', 'free');
31
 
116
  */
117
  public static $is_php_allowed = true;
118
 
119
+ public static $capabilities = 'install_plugins';
120
 
121
  /**
122
  * WP All Import logs folder
145
  */
146
  const HISTORY_DIRECTORY = WP_ALL_IMPORT_HISTORY_DIRECTORY;
147
 
148
+ /**
149
+ * Language domain key.
150
+ */
151
+ const LANGUAGE_DOMAIN = 'wp_all_import_plugin';
152
 
153
  /**
154
  * Return singletone instance
262
  $this->options['cron_job_key'] = wp_all_import_url_title(wp_all_import_rand_char(12));
263
  }
264
 
265
+ if ($current_options !== $this->options) {
266
+ update_option($option_name, $this->options, false);
267
+ }
268
 
269
  register_activation_hook(self::FILE, array($this, 'activation'));
270
 
1109
  return true;
1110
  }
1111
 
1112
+ /**
1113
+ * Method returns default import options, main utility of the method is to avoid warnings when new
1114
+ * option is introduced but already registered imports don't have it
1115
+ */
1116
+ public static function get_default_import_options() {
1117
+ return array(
1118
+ 'type' => 'post',
1119
+ 'is_override_post_type' => 0,
1120
+ 'post_type_xpath' => '',
1121
+ 'deligate' => '',
1122
+ 'wizard_type' => 'new',
1123
+ 'ftp_host' => '',
1124
+ 'ftp_path' => '',
1125
+ 'ftp_root' => '/',
1126
+ 'ftp_port' => 21,
1127
+ 'ftp_username' => '',
1128
+ 'ftp_password' => '',
1129
+ 'ftp_private_key' => '',
1130
+ 'custom_type' => '',
1131
+ 'featured_delim' => ',',
1132
+ 'atch_delim' => ',',
1133
+ 'is_search_existing_attach' => 0,
1134
+ 'post_taxonomies' => array(),
1135
+ 'parent' => 0,
1136
+ 'is_multiple_page_parent' => 'yes',
1137
+ 'single_page_parent' => '',
1138
+ 'order' => 0,
1139
+ 'status' => 'publish',
1140
+ 'page_template' => 'default',
1141
+ 'is_multiple_page_template' => 'yes',
1142
+ 'single_page_template' => '',
1143
+ 'page_taxonomies' => array(),
1144
+ 'date_type' => 'specific',
1145
+ 'date' => 'now',
1146
+ 'date_start' => 'now',
1147
+ 'date_end' => 'now',
1148
+ 'custom_name' => array(),
1149
+ 'custom_value' => array(),
1150
+ 'custom_format' => array(),
1151
+ 'custom_mapping' => array(),
1152
+ 'serialized_values' => array(),
1153
+ 'custom_mapping_rules' => array(),
1154
+ 'comment_status' => 'open',
1155
+ 'comment_status_xpath' => '',
1156
+ 'ping_status' => 'open',
1157
+ 'ping_status_xpath' => '',
1158
+ 'create_draft' => 'no',
1159
+ 'author' => '',
1160
+ 'post_excerpt' => '',
1161
+ 'post_slug' => '',
1162
+ 'attachments' => '',
1163
+ 'is_import_specified' => 0,
1164
+ 'import_specified' => '',
1165
+ 'is_delete_source' => 0,
1166
+ 'is_cloak' => 0,
1167
+ 'unique_key' => '',
1168
+ 'tmp_unique_key' => '',
1169
+ 'feed_type' => 'auto',
1170
+ 'search_existing_images' => 1,
1171
+
1172
+ 'create_new_records' => 1,
1173
+ 'is_selective_hashing' => 1,
1174
+ 'is_delete_missing' => 0,
1175
+ 'set_missing_to_draft' => 0,
1176
+ 'is_update_missing_cf' => 0,
1177
+ 'update_missing_cf_name' => '',
1178
+ 'update_missing_cf_value' => '',
1179
+
1180
+ 'is_keep_former_posts' => 'no',
1181
+ 'is_update_status' => 1,
1182
+ 'is_update_content' => 1,
1183
+ 'is_update_title' => 1,
1184
+ 'is_update_slug' => 1,
1185
+ 'is_update_excerpt' => 1,
1186
+ 'is_update_categories' => 1,
1187
+ 'is_update_author' => 1,
1188
+ 'is_update_comment_status' => 1,
1189
+ 'is_update_ping_status' => 1,
1190
+ 'is_update_post_type' => 1,
1191
+ 'is_update_post_format' => 1,
1192
+ 'update_categories_logic' => 'full_update',
1193
+ 'taxonomies_list' => array(),
1194
+ 'taxonomies_only_list' => array(),
1195
+ 'taxonomies_except_list' => array(),
1196
+ 'is_update_attachments' => 1,
1197
+ 'is_update_images' => 1,
1198
+ 'update_images_logic' => 'full_update',
1199
+ 'is_update_dates' => 1,
1200
+ 'is_update_menu_order' => 1,
1201
+ 'is_update_parent' => 1,
1202
+ 'is_keep_attachments' => 0,
1203
+ 'is_keep_imgs' => 0,
1204
+ 'do_not_remove_images' => 1,
1205
+
1206
+ 'is_update_custom_fields' => 1,
1207
+ 'update_custom_fields_logic' => 'full_update',
1208
+ 'custom_fields_list' => array(),
1209
+ 'custom_fields_only_list' => array(),
1210
+ 'custom_fields_except_list' => array(),
1211
+
1212
+ 'duplicate_matching' => 'auto',
1213
+ 'duplicate_indicator' => 'title',
1214
+ 'custom_duplicate_name' => '',
1215
+ 'custom_duplicate_value' => '',
1216
+ 'is_update_previous' => 0,
1217
+ 'is_scheduled' => '',
1218
+ 'scheduled_period' => '',
1219
+ 'friendly_name' => '',
1220
+ 'records_per_request' => 20,
1221
+ 'auto_rename_images' => 0,
1222
+ 'auto_rename_images_suffix' => '',
1223
+ 'images_name' => 'filename',
1224
+ 'post_format' => 'standard',
1225
+ 'post_format_xpath' => '',
1226
+ 'encoding' => 'UTF-8',
1227
+ 'delimiter' => '',
1228
+ 'image_meta_title' => '',
1229
+ 'image_meta_title_delim' => ',',
1230
+ 'image_meta_caption' => '',
1231
+ 'image_meta_caption_delim' => ',',
1232
+ 'image_meta_alt' => '',
1233
+ 'image_meta_alt_delim' => ',',
1234
+ 'image_meta_description' => '',
1235
+ 'image_meta_description_delim' => ',',
1236
+ 'image_meta_description_delim_logic' => 'separate',
1237
+ 'status_xpath' => '',
1238
+ 'download_images' => 'yes',
1239
+ 'converted_options' => 0,
1240
+ 'update_all_data' => 'yes',
1241
+ 'is_fast_mode' => 0,
1242
+ 'chuncking' => 1,
1243
+ 'import_processing' => 'ajax',
1244
+ 'processing_iteration_logic' => 'auto',
1245
+ 'save_template_as' => 0,
1246
+
1247
+ 'title' => '',
1248
+ 'content' => '',
1249
+ 'name' => '',
1250
+ 'is_keep_linebreaks' => 1,
1251
+ 'is_leave_html' => 0,
1252
+ 'fix_characters' => 0,
1253
+ 'pid_xpath' => '',
1254
+ 'slug_xpath' => '',
1255
+ 'title_xpath' => '',
1256
+
1257
+ 'featured_image' => '',
1258
+ 'download_featured_image' => '',
1259
+ 'download_featured_delim' => ',',
1260
+ 'gallery_featured_image' => '',
1261
+ 'gallery_featured_delim' => ',',
1262
+ 'is_featured' => 1,
1263
+ 'is_featured_xpath' => '',
1264
+ 'set_image_meta_title' => 0,
1265
+ 'set_image_meta_caption' => 0,
1266
+ 'set_image_meta_alt' => 0,
1267
+ 'set_image_meta_description' => 0,
1268
+ 'auto_set_extension' => 0,
1269
+ 'new_extension' => '',
1270
+ 'tax_logic' => array(),
1271
+ 'tax_assing' => array(),
1272
+ 'term_assing' => array(),
1273
+ 'multiple_term_assing' => array(),
1274
+ 'tax_hierarchical_assing' => array(),
1275
+ 'tax_hierarchical_last_level_assign' => array(),
1276
+ 'tax_single_xpath' => array(),
1277
+ 'tax_multiple_xpath' => array(),
1278
+ 'tax_hierarchical_xpath' => array(),
1279
+ 'tax_multiple_delim' => array(),
1280
+ 'tax_hierarchical_delim' => array(),
1281
+ 'tax_manualhierarchy_delim' => array(),
1282
+ 'tax_hierarchical_logic_entire' => array(),
1283
+ 'tax_hierarchical_logic_manual' => array(),
1284
+ 'tax_enable_mapping' => array(),
1285
+ 'tax_is_full_search_single' => array(),
1286
+ 'tax_is_full_search_multiple' => array(),
1287
+ 'tax_assign_to_one_term_single' => array(),
1288
+ 'tax_assign_to_one_term_multiple' => array(),
1289
+ 'tax_mapping' => array(),
1290
+ 'tax_logic_mapping' => array(),
1291
+ 'is_tax_hierarchical_group_delim' => array(),
1292
+ 'tax_hierarchical_group_delim' => array(),
1293
+ 'nested_files' => array(),
1294
+ 'xml_reader_engine' => 0,
1295
+ 'taxonomy_type' => '',
1296
+ 'taxonomy_parent' => '',
1297
+ 'taxonomy_slug' => 'auto',
1298
+ 'taxonomy_slug_xpath' => '',
1299
+ 'taxonomy_display_type' => '',
1300
+ 'taxonomy_display_type_xpath' => '',
1301
+ 'import_img_tags' => 0,
1302
+ 'search_existing_images_logic' => 'by_url',
1303
+ 'enable_import_scheduling' => 'false',
1304
+ 'scheduling_enable' => false,
1305
+ 'scheduling_weekly_days' => '',
1306
+ 'scheduling_run_on' => 'weekly',
1307
+ 'scheduling_monthly_day' => '',
1308
+ 'scheduling_times' => array(),
1309
+ 'scheduling_timezone' => 'UTC',
1310
+ 'is_update_comment_post_id' => 1,
1311
+ 'is_update_comment_author' => 1,
1312
+ 'is_update_comment_author_email' => 1,
1313
+ 'is_update_comment_author_url' => 1,
1314
+ 'is_update_comment_author_IP' => 1,
1315
+ 'is_update_comment_karma' => 1,
1316
+ 'is_update_comment_approved' => 1,
1317
+ 'is_update_comment_verified' => 1,
1318
+ 'is_update_comment_rating' => 1,
1319
+ 'is_update_comment_agent' => 1,
1320
+ 'is_update_comment_user_id' => 1,
1321
+ 'is_update_comment_type' => 1,
1322
+ 'is_update_comments' => 1,
1323
+ 'update_comments_logic' => 'full_update',
1324
+ 'comment_author' => '',
1325
+ 'comment_author_email' => '',
1326
+ 'comment_author_url' => '',
1327
+ 'comment_author_IP' => '',
1328
+ 'comment_karma' => '',
1329
+ 'comment_parent' => '',
1330
+ 'comment_approved' => '1',
1331
+ 'comment_approved_xpath' => '',
1332
+ 'comment_verified' => '1',
1333
+ 'comment_verified_xpath' => '',
1334
+ 'comment_agent' => '',
1335
+ 'comment_type' => '',
1336
+ 'comment_type_xpath' => '',
1337
+ 'comment_user_id' => 'email',
1338
+ 'comment_user_id_xpath' => '',
1339
+ 'comment_post' => '',
1340
+ 'comment_rating' => '',
1341
+ 'comments_repeater_mode' => 'csv',
1342
+ 'comments_repeater_mode_separator' => '|',
1343
+ 'comments_repeater_mode_foreach' => '',
1344
+ 'comments' => array(
1345
+ 'content' => '',
1346
+ 'author' => '',
1347
+ 'author_email' => '',
1348
+ 'author_url' => '',
1349
+ 'author_ip' => '',
1350
+ 'karma' => '',
1351
+ 'approved' => '',
1352
+ 'type' => '',
1353
+ 'date' => 'now'
1354
+ )
1355
+ );
1356
+ }
1357
 
1358
  /*
1359
  * Convert csv to xml
1372
 
1373
  }
1374
 
1375
+ /**
1376
+ * @return bool
1377
+ */
1378
+ public static function is_ajax(){
1379
+ return (isset($_SERVER["HTTP_ACCEPT"]) && strpos($_SERVER["HTTP_ACCEPT"], 'json')) !== false;
1380
+ }
1381
 
1382
  /**
1383
  * Returns ID of current import.
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
  Tested up to: 5.8
5
- Stable tag: 3.6.0
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.
@@ -105,6 +105,10 @@ Does it work with special character encoding like Hebrew, Arabic, Chinese, etc?
105
 
106
  == Changelog ==
107
 
 
 
 
 
108
  = 3.6.0 =
109
  * maintenance: compatibility with Elementor v3.3 JavaScript changes
110
 
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
  Tested up to: 5.8
5
+ Stable tag: 3.6.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.
105
 
106
  == Changelog ==
107
 
108
+ = 3.6.1 =
109
+ * bug fix: categories were imported despite the taxonomy option being disabled
110
+ * improvement: add ability to filter csv escape symbol via wp_all_import_csv_parser_settings filter
111
+
112
  = 3.6.0 =
113
  * maintenance: compatibility with Elementor v3.3 JavaScript changes
114
 
static/css/admin.css CHANGED
@@ -139,11 +139,23 @@ body.wpallimport-plugin {
139
 
140
  /*@+ header */
141
  .wpallimport-plugin .wpallimport-logo{
142
- background: url('../img/ui_4.0/logo.png');
143
- width: 60px;
144
- height: 51px;
145
- float: left;
146
- margin-right: 10px;
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
148
  .wpallimport-plugin .wpallimport-title{
149
  float: left;
@@ -164,9 +176,10 @@ body.wpallimport-plugin {
164
  padding-right: 0;
165
  margin-left: 2px;
166
  }
167
- .wpallimport-plugin .wpallimport-title h3{
168
- margin: 5px 0;
169
- }
 
170
  .wpallimport-plugin .wpallimport-links{
171
  float: right;
172
  margin-right: 3px;
@@ -934,7 +947,7 @@ p.upgrade_link {
934
  font-size: 12px;
935
  }
936
  .wpallimport-plugin .wpallimport-created-by span{
937
- background: url('../img/soflyy-logo.png') no-repeat;
938
  display: block;
939
  float: right;
940
  width: 72px;
@@ -1060,7 +1073,7 @@ p.upgrade_link {
1060
  .wpallimport-plugin .wpallimport-step-4,
1061
  .wpallimport-plugin .wpallimport-step-5,
1062
  .wpallimport-plugin .wpallimport-step-6{
1063
- margin: 20px 0 0 0px;
1064
  }
1065
  .wpallimport-plugin table.wpallimport-layout td {
1066
  vertical-align: top;
@@ -2643,8 +2656,10 @@ p.upgrade_link {
2643
  .wpallimport-plugin .post_taxonomy ol.ui-sortable .drag-element{
2644
  background-position: 0 10px;
2645
  }
2646
- .wpallimport-plugin .post_taxonomy ol.ui-sortable .remove-ico{
 
2647
  top: 8px;
 
2648
  }
2649
 
2650
  .wpallimport-plugin .separated_by{
@@ -2778,6 +2793,20 @@ p.upgrade_link {
2778
  top: -2px;
2779
  right: 30px;
2780
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2781
  /*--------------------------------------------------------------------------
2782
  *
2783
  * Step 4 - Import Options
@@ -2890,13 +2919,22 @@ p.upgrade_link {
2890
  padding-top: 10px;
2891
  }
2892
  .wpallimport-plugin .wpallimport-step-5 .wpallimport-section .wpallimport-collapsed-content p{
2893
- color: #777;
2894
- background: url('../img/ui_4.0/logo_small.png') no-repeat;
2895
- padding-left: 35px;
2896
- min-height: 26px;
2897
- line-height: 28px;
2898
  }
2899
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2900
  .wpallimport-plugin form.confirm{
2901
  margin-bottom: 20px;
2902
  margin-top: 20px;
@@ -3496,7 +3534,7 @@ p.upgrade_link {
3496
  }
3497
  .wpallimport-plugin form.settings .wpallimport-header{
3498
  overflow: hidden;
3499
- height: 60px;
3500
  padding-top: 10px;
3501
  }
3502
 
139
 
140
  /*@+ header */
141
  .wpallimport-plugin .wpallimport-logo{
142
+ background: url(../img/logo.svg) no-repeat;
143
+ background-size: 55px 55px;
144
+ width: 55px;
145
+ height: 55px;
146
+ margin-top: 8px;
147
+ margin-bottom: 8px;
148
+ float: left;
149
+ margin-right: 8px;
150
+ }
151
+ .wpallimport-plugin .wpallimport-title > h2:before,
152
+ .wpallimport-plugin .wpallimport-title > h3:before {
153
+ content: '';
154
+ background: url(../img/wpallimport.svg) no-repeat;
155
+ background-size: 134px 14px;
156
+ width: 134px;
157
+ height: 25px;
158
+ display: block;
159
  }
160
  .wpallimport-plugin .wpallimport-title{
161
  float: left;
176
  padding-right: 0;
177
  margin-left: 2px;
178
  }
179
+ .wpallimport-plugin .wpallimport-title h2,
180
+ .wpallimport-plugin .wpallimport-title h3{
181
+ margin: 8px 0 !important;
182
+ }
183
  .wpallimport-plugin .wpallimport-links{
184
  float: right;
185
  margin-right: 3px;
947
  font-size: 12px;
948
  }
949
  .wpallimport-plugin .wpallimport-created-by span{
950
+ background: url('../img/soflyy-logo.svg') no-repeat;
951
  display: block;
952
  float: right;
953
  width: 72px;
1073
  .wpallimport-plugin .wpallimport-step-4,
1074
  .wpallimport-plugin .wpallimport-step-5,
1075
  .wpallimport-plugin .wpallimport-step-6{
1076
+ margin: 10px 0 0 0px;
1077
  }
1078
  .wpallimport-plugin table.wpallimport-layout td {
1079
  vertical-align: top;
2656
  .wpallimport-plugin .post_taxonomy ol.ui-sortable .drag-element{
2657
  background-position: 0 10px;
2658
  }
2659
+ .wpallimport-plugin .post_taxonomy ol.ui-sortable .remove-ico,
2660
+ .wpallimport-plugin .post_taxonomy ul.tax_hierarchical_logic .remove-ico {
2661
  top: 8px;
2662
+ right: 8px;
2663
  }
2664
 
2665
  .wpallimport-plugin .separated_by{
2793
  top: -2px;
2794
  right: 30px;
2795
  }
2796
+ .wpallimport-plugin .load-template-container {
2797
+ display: flex;
2798
+ align-items: center;
2799
+ }
2800
+ .wpallimport-plugin form.wpallimport-template .load-template select {
2801
+ width: auto;
2802
+ padding: 4px 25px 4px 12px;
2803
+ /*
2804
+ * Overwrite previous !important rule required for the rest of the pulldowns
2805
+ */
2806
+ font-size: 12px !important;
2807
+ height: 34px;
2808
+ background-size: 14px 14px;
2809
+ }
2810
  /*--------------------------------------------------------------------------
2811
  *
2812
  * Step 4 - Import Options
2919
  padding-top: 10px;
2920
  }
2921
  .wpallimport-plugin .wpallimport-step-5 .wpallimport-section .wpallimport-collapsed-content p{
2922
+ margin: 1.4em 0;
 
 
 
 
2923
  }
2924
 
2925
+ .wpallimport-plugin .wpallimport-step-5 .wpallimport-section .wpallimport-collapsed-content p:before {
2926
+ content: '';
2927
+ width: 24px;
2928
+ background: url(../img/s-check.png) no-repeat;
2929
+ background-size: auto;
2930
+ background-size: auto;
2931
+ background-size: 24px;
2932
+ height: 24px;
2933
+ margin-right: 10px;
2934
+ vertical-align: -42%;
2935
+ display: inline-block;
2936
+ }
2937
+
2938
  .wpallimport-plugin form.confirm{
2939
  margin-bottom: 20px;
2940
  margin-top: 20px;
3534
  }
3535
  .wpallimport-plugin form.settings .wpallimport-header{
3536
  overflow: hidden;
3537
+ height: 70px;
3538
  padding-top: 10px;
3539
  }
3540
 
static/img/logo.svg ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid meet" viewBox="0 0 38 38" width="38" height="38"><defs><path d="M35.76 20.19C35.35 20.32 32.09 21.39 31.69 21.52C31.28 21.65 31.06 22.09 31.2 22.48C31.33 22.89 31.76 23.1 32.16 22.97C32.31 22.92 33.59 22.5 33.75 22.45C32.57 24.19 29.66 27.85 26.35 27.29C25.75 27.19 25.31 26.82 25.19 26.34C25.01 25.67 25.46 24.87 26.4 24.12C30.04 21.24 32.04 17.41 32.04 13.36C32.02 6.16 26.18 0.3 18.98 0.3C11.78 0.3 5.94 6.16 5.94 13.37C5.94 17.42 7.95 21.25 11.58 24.13C12.52 24.87 12.96 25.68 12.79 26.35C12.67 26.83 12.21 27.2 11.63 27.3C8.33 27.86 5.41 24.2 4.23 22.46C4.39 22.51 5.65 22.93 5.81 22.98C6.22 23.12 6.64 22.9 6.77 22.49C6.9 22.09 6.68 21.66 6.28 21.53C5.87 21.4 2.62 20.32 2.21 20.19C1.98 20.11 1.74 20.14 1.55 20.29C1.35 20.42 1.23 20.64 1.22 20.88C1.2 21.32 1.02 24.86 1 25.3C0.98 25.73 1.31 26.08 1.72 26.1C1.73 26.1 1.76 26.1 1.76 26.1C2.17 26.1 2.51 25.78 2.53 25.37C2.54 25.19 2.61 23.74 2.62 23.56C3.91 25.46 7.01 29.3 10.94 29.3C11.27 29.3 11.6 29.28 11.95 29.21C13.33 28.98 14.37 28.07 14.7 26.81C15.07 25.36 14.39 23.81 12.81 22.57C10.98 21.12 7.92 17.99 7.92 13.35C7.92 7.23 12.89 2.24 19 2.24C25.11 2.24 30.08 7.23 30.08 13.35C30.08 17.99 27.02 21.12 25.19 22.57C23.61 23.81 22.92 25.37 23.3 26.81C23.61 28.05 24.67 28.97 26.05 29.21C30.45 29.96 33.98 25.63 35.38 23.56C35.39 23.74 35.46 25.18 35.47 25.36C35.49 25.76 35.83 26.09 36.24 26.09C36.24 26.09 36.27 26.09 36.28 26.09C36.7 26.07 37.02 25.71 37 25.29C36.98 24.85 36.8 21.31 36.78 20.86C36.74 20.65 36.61 20.42 36.42 20.29C36.22 20.15 35.97 20.11 35.76 20.19ZM16 17.8C16 16.97 15.33 16.3 14.5 16.3C13.67 16.3 13 16.97 13 17.8C13 18.63 13.67 19.3 14.5 19.3C15.33 19.3 16 18.63 16 17.8ZM25 17.8C25 16.97 24.33 16.3 23.5 16.3C22.67 16.3 22 16.97 22 17.8C22 18.63 22.67 19.3 23.5 19.3C24.33 19.3 25 18.63 25 17.8ZM26.15 33.19C26.29 33.59 27.34 36.72 27.47 37.11C27.53 37.32 27.5 37.56 27.37 37.75C27.25 37.94 27.04 38.06 26.81 38.07C26.53 38.08 25.12 38.16 22.59 38.3C22.56 38.3 22.55 38.3 22.55 38.3C22.16 38.3 21.84 37.99 21.81 37.61C21.79 37.19 22.1 36.85 22.5 36.83C22.68 36.82 24.06 36.74 24.23 36.73C21.65 35.16 19.95 33.26 19 30.81C18.05 33.26 16.35 35.16 13.76 36.73C13.94 36.74 15.33 36.82 15.5 36.83C15.9 36.85 16.21 37.19 16.19 37.61C16.17 37.99 15.85 38.3 15.46 38.3C15.46 38.3 15.45 38.3 15.42 38.3C12.89 38.16 11.48 38.08 11.2 38.07C10.97 38.06 10.77 37.94 10.63 37.75C10.5 37.56 10.47 37.33 10.54 37.11C10.67 36.72 11.69 33.58 11.82 33.18C11.95 32.81 12.35 32.59 12.74 32.72C13.11 32.85 13.32 33.26 13.2 33.65C13.14 33.83 12.66 35.28 12.6 35.46C16.95 32.93 17.85 29.81 18.14 27.06C18.2 26.63 18.55 26.3 18.98 26.3C19.41 26.3 19.77 26.63 19.81 27.06C20.1 29.82 21 32.94 25.37 35.48C25.31 35.3 24.84 33.84 24.78 33.66C24.64 33.28 24.85 32.86 25.24 32.73C25.61 32.59 26.03 32.81 26.15 33.19Z" id="cDEo3EUV"></path><path d="M59.71 26.03C59.9 26.74 60.41 27.13 61.14 27.13C61.88 27.13 62.37 26.74 62.57 26.03C63.8 21.68 65.1 17.32 66.35 12.96C66.39 12.81 66.42 12.66 66.42 12.52C66.42 11.93 65.89 11.47 65.21 11.47C64.63 11.47 64.24 11.75 64.08 12.33C63.88 13.03 62.88 16.54 61.07 22.86C59.25 16.7 58.24 13.27 58.03 12.59C57.84 11.89 57.35 11.49 56.6 11.49C55.86 11.49 55.37 11.89 55.17 12.59C54.97 13.27 53.96 16.7 52.14 22.86C50.33 16.54 49.32 13.03 49.12 12.33C48.97 11.75 48.57 11.47 48 11.47C47.32 11.47 46.79 11.93 46.79 12.52C46.79 12.66 46.81 12.81 46.86 12.96C48.11 17.32 49.41 21.68 50.64 26.03C50.84 26.74 51.32 27.13 52.07 27.13C52.8 27.13 53.3 26.74 53.5 26.03C53.71 25.33 54.74 21.83 56.6 15.52C58.47 21.83 59.5 25.33 59.71 26.03ZM74.31 21.41C77.44 21.41 79.59 19.56 79.59 16.51C79.59 13.45 77.44 11.6 74.31 11.6C73.89 11.6 70.55 11.6 70.13 11.6C69.47 11.6 68.94 12.02 68.94 12.68C68.94 14.02 68.94 24.72 68.94 26.05C68.94 26.71 69.47 27.13 70.13 27.13C70.79 27.13 71.32 26.71 71.32 26.05C71.32 25.74 71.32 24.2 71.32 21.41C73.11 21.41 74.11 21.41 74.31 21.41ZM74.14 13.71C75.96 13.71 77.17 14.79 77.17 16.51C77.17 18.22 75.96 19.3 74.14 19.3C73.95 19.3 73.01 19.3 71.32 19.3L71.32 13.71C73.01 13.71 73.95 13.71 74.14 13.71ZM97.75 27.13C98.41 27.13 98.98 26.69 98.98 26.08C98.98 25.94 98.96 25.79 98.89 25.64C98.4 24.33 94.51 13.87 94.03 12.57C93.79 11.89 93.35 11.47 92.6 11.47C91.85 11.47 91.41 11.89 91.17 12.57C90.68 13.87 86.79 24.33 86.31 25.64C86.24 25.79 86.22 25.94 86.22 26.08C86.22 26.69 86.79 27.13 87.45 27.13C88.02 27.13 88.37 26.82 88.57 26.27C88.64 26.08 88.99 25.09 89.63 23.3L95.55 23.3L96.62 26.27C96.99 26.85 97.36 27.13 97.75 27.13ZM94.8 21.24L90.38 21.24L92.6 15.1L94.8 21.24ZM102.54 11.47C101.88 11.47 101.35 11.89 101.35 12.55C101.35 13.88 101.35 24.58 101.35 25.92C101.35 26.58 101.88 27 102.54 27C103.3 27 109.43 27 110.19 27C110.79 27 111.16 26.54 111.16 25.94C111.16 25.35 110.79 24.89 110.19 24.89C109.76 24.89 107.6 24.89 103.72 24.89L103.72 12.55C103.37 11.83 102.98 11.47 102.54 11.47ZM114.15 11.47C113.49 11.47 112.97 11.89 112.97 12.55C112.97 13.88 112.97 24.58 112.97 25.92C112.97 26.58 113.49 27 114.15 27C114.92 27 121.04 27 121.81 27C122.4 27 122.78 26.54 122.78 25.94C122.78 25.35 122.4 24.89 121.81 24.89C121.38 24.89 119.22 24.89 115.34 24.89L115.34 12.55C114.99 11.83 114.59 11.47 114.15 11.47ZM131.29 11.47C130.63 11.47 130.1 11.89 130.1 12.55C130.1 13.9 130.1 24.7 130.1 26.05C130.1 26.71 130.63 27.13 131.29 27.13C131.95 27.13 132.48 26.71 132.48 26.05C132.48 25.15 132.48 20.65 132.48 12.55C132.13 11.83 131.73 11.47 131.29 11.47ZM145.48 23.94C145.75 23.43 147.1 20.84 149.55 16.2C149.88 22.02 150.06 25.25 150.1 25.9C150.14 26.54 150.54 27 151.29 27C151.92 27 152.47 26.65 152.47 25.99C152.47 25.5 152.43 24.87 151.64 12.66C151.59 11.97 151.18 11.47 150.41 11.47C149.66 11.47 149.28 11.93 148.89 12.7C148.58 13.29 147.02 16.26 144.22 21.61C141.42 16.26 139.87 13.29 139.56 12.7C139.16 11.93 138.79 11.47 138.04 11.47C137.27 11.47 136.85 11.97 136.81 12.66C136.02 24.87 135.97 25.5 135.97 25.99C135.97 26.65 136.52 27 137.16 27C137.91 27 138.31 26.54 138.35 25.9C138.39 25.25 138.57 22.02 138.9 16.2C141.34 20.84 142.7 23.43 142.97 23.94C143.23 24.45 143.59 24.76 144.22 24.76C144.86 24.76 145.21 24.45 145.48 23.94ZM161.24 21.41C164.36 21.41 166.52 19.56 166.52 16.51C166.52 13.45 164.36 11.6 161.24 11.6C160.82 11.6 157.48 11.6 157.06 11.6C156.4 11.6 155.87 12.02 155.87 12.68C155.87 14.02 155.87 24.72 155.87 26.05C155.87 26.71 156.4 27.13 157.06 27.13C157.72 27.13 158.25 26.71 158.25 26.05C158.25 25.74 158.25 24.2 158.25 21.41C160.04 21.41 161.04 21.41 161.24 21.41ZM161.06 13.71C162.89 13.71 164.1 14.79 164.1 16.51C164.1 18.22 162.89 19.3 161.06 19.3C160.88 19.3 159.94 19.3 158.25 19.3L158.25 13.71C159.94 13.71 160.88 13.71 161.06 13.71ZM175.13 11.34C170.66 11.34 168.42 14.79 168.42 19.3C168.42 23.81 170.66 27.26 175.13 27.26C179.59 27.26 181.84 23.81 181.84 19.3C181.84 14.79 179.59 11.34 175.13 11.34ZM175.13 13.49C178.03 13.49 179.42 16.02 179.42 19.3C179.42 22.58 178.03 25.11 175.13 25.11C172.22 25.11 170.84 22.58 170.84 19.3C170.84 16.02 172.22 13.49 175.13 13.49ZM195.29 16.31C195.29 13.27 193.07 11.6 189.97 11.6C189.58 11.6 186.42 11.6 186.03 11.6C185.37 11.6 184.84 12.02 184.84 12.68C184.84 14.02 184.84 24.72 184.84 26.05C184.84 26.71 185.37 27.13 186.03 27.13C186.69 27.13 187.22 26.71 187.22 26.05C187.22 25.72 187.22 24.04 187.22 21.02L189.57 21.02C191.57 24.29 192.67 26.11 192.9 26.47C193.2 26.98 193.47 27.13 193.89 27.13C194.52 27.13 195.12 26.63 195.12 26.03C195.12 25.83 195.01 25.57 194.9 25.39C194.7 25.08 193.74 23.52 192.02 20.71C194.2 19.33 195.29 17.86 195.29 16.31ZM189.75 18.9C189.58 18.9 188.74 18.9 187.22 18.9L187.22 13.71C188.74 13.71 189.58 13.71 189.75 13.71C191.6 13.71 192.85 14.57 192.85 16.31C192.85 18.05 191.6 18.9 189.75 18.9ZM202.19 27.13C202.85 27.13 203.38 26.71 203.38 26.05C203.38 25.23 203.38 21.12 203.38 13.71C205.6 13.71 206.83 13.71 207.07 13.71C207.67 13.71 208.04 13.25 208.04 12.66C208.04 12.06 207.67 11.6 207.07 11.6C206.1 11.6 198.28 11.6 197.31 11.6C196.71 11.6 196.34 12.06 196.34 12.66C196.34 13.25 196.71 13.71 197.31 13.71C197.55 13.71 198.78 13.71 201 13.71L201 26.05C201.35 26.77 201.75 27.13 202.19 27.13Z" id="bdrFXV3V5"></path></defs><g><g><g><use xlink:href="#cDEo3EUV" opacity="1" fill="#02b3b6" fill-opacity="1"></use><g><use xlink:href="#cDEo3EUV" opacity="1" fill-opacity="0" stroke="#000000" stroke-width="1" stroke-opacity="0"></use></g></g><g><use xlink:href="#bdrFXV3V5" opacity="1" fill="#02182b" fill-opacity="1"></use><g><use xlink:href="#bdrFXV3V5" opacity="1" fill-opacity="0" stroke="#000000" stroke-width="1" stroke-opacity="0"></use></g></g></g></g></svg>
static/img/logo_small.png ADDED
Binary file
static/img/soflyy-logo.svg ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ viewBox="0 0 1125.1 503.6" enable-background="new 0 0 1125.1 503.6" xml:space="preserve">
6
+ <g>
7
+ <g>
8
+ <path fill="#212221" d="M503.9,274.6c0,14.1-4.9,24.8-14.7,32.2c-9.8,7.4-24.5,11.1-44,11.1c-10,0-18.5-0.7-25.6-2
9
+ c-7.1-1.4-13.6-3.3-19.8-6v-31c7,3.3,14.8,6,23.5,8.2s16.4,3.3,23.1,3.3c13.6,0,20.4-3.9,20.4-11.8c0-3-0.9-5.3-2.7-7.2
10
+ c-1.8-1.8-4.9-3.9-9.3-6.3c-4.4-2.3-10.3-5.1-17.7-8.2c-10.6-4.4-18.3-8.5-23.3-12.3c-5-3.8-8.6-8.1-10.8-13
11
+ c-2.3-4.9-3.4-10.9-3.4-18c0-12.2,4.7-21.7,14.2-28.3c9.5-6.7,22.9-10,40.3-10c16.6,0,32.7,3.6,48.3,10.8l-11.3,27.1
12
+ c-6.9-3-13.3-5.4-19.3-7.3c-6-1.9-12.1-2.8-18.3-2.8c-11.1,0-16.6,3-16.6,9c0,3.4,1.8,6.3,5.3,8.7c3.6,2.5,11.4,6.1,23.4,10.9
13
+ c10.7,4.3,18.6,8.4,23.6,12.2c5,3.8,8.7,8.1,11.1,13C502.7,262,503.9,267.8,503.9,274.6z"/>
14
+ <path fill="#212221" d="M651.8,246.5c0,22.4-5.9,39.9-17.7,52.5c-11.8,12.6-28.2,18.9-49.3,18.9c-13.2,0-24.8-2.9-34.9-8.7
15
+ c-10.1-5.8-17.8-14.1-23.2-24.9c-5.4-10.8-8.1-23.4-8.1-37.9c0-22.5,5.9-39.9,17.6-52.4c11.7-12.5,28.2-18.7,49.4-18.7
16
+ c13.2,0,24.8,2.9,34.9,8.6c10.1,5.7,17.8,14,23.2,24.7C649.1,219.5,651.8,232.1,651.8,246.5z M556.7,246.5
17
+ c0,13.6,2.2,23.9,6.7,30.9c4.5,7,11.7,10.5,21.8,10.5c10,0,17.2-3.5,21.6-10.4c4.4-6.9,6.6-17.2,6.6-30.9
18
+ c0-13.6-2.2-23.8-6.6-30.6c-4.4-6.8-11.7-10.2-21.8-10.2c-10,0-17.2,3.4-21.6,10.1S556.7,232.8,556.7,246.5z"/>
19
+ <path d="M752.5,206.1H720v109.3h-37.5V206.1h-20.7v-18.1l20.7-10.1v-10.1c0-15.7,3.9-27.1,11.6-34.3c7.7-7.2,20-10.8,37-10.8
20
+ c13,0,24.5,1.9,34.6,5.8l-9.6,27.5c-7.5-2.4-14.5-3.6-20.9-3.6c-5.3,0-9.2,1.6-11.6,4.7c-2.4,3.2-3.6,7.2-3.6,12.1v8.6h32.5V206.1
21
+ z M811.5,315.5H774V124.1h37.5V315.5z"/>
22
+ <path d="M827.3,178h41.1l25.9,77.3c2.2,6.7,3.7,14.7,4.5,23.9h0.7c0.9-8.4,2.7-16.4,5.3-23.9l25.5-77.3h40.2L912.3,333
23
+ c-5.3,14.3-12.9,25.1-22.8,32.2c-9.9,7.1-21.4,10.7-34.6,10.7c-6.5,0-12.8-0.7-19.1-2.1v-29.8c4.5,1.1,9.4,1.6,14.8,1.6
24
+ c6.6,0,12.4-2,17.4-6.1c5-4.1,8.8-10.2,11.6-18.4l2.2-6.8L827.3,178z"/>
25
+ <path d="M975.3,178h41.1l25.9,77.3c2.2,6.7,3.7,14.7,4.5,23.9h0.7c0.9-8.4,2.7-16.4,5.3-23.9l25.5-77.3h40.2L1060.4,333
26
+ c-5.3,14.3-12.9,25.1-22.8,32.2c-9.9,7.1-21.4,10.7-34.6,10.7c-6.5,0-12.8-0.7-19.1-2.1v-29.8c4.5,1.1,9.4,1.6,14.8,1.6
27
+ c6.6,0,12.4-2,17.4-6.1c5-4.1,8.8-10.2,11.6-18.4l2.2-6.8L975.3,178z"/>
28
+ </g>
29
+ <g>
30
+ <g>
31
+ <linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="81.0017" y1="427.3257" x2="241.8481" y2="334.4609">
32
+ <stop offset="0" style="stop-color:#7ABC57"/>
33
+ <stop offset="0.6" style="stop-color:#7ABC57"/>
34
+ <stop offset="0.8285" style="stop-color:#5CAF57"/>
35
+ <stop offset="1" style="stop-color:#2DA657"/>
36
+ </linearGradient>
37
+ <path fill="url(#SVGID_1_)" d="M196.5,266.3c0.6,0.9,1.2,1.9,1.7,2.8c28.5,55.3-175.2,119.2-72.9,227l0,0h0l104.6-105.9
38
+ C243.1,365.1,257.9,340,196.5,266.3z"/>
39
+ <linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="335.9252" y1="340.5559" x2="94.3999" y2="201.1112">
40
+ <stop offset="0" style="stop-color:#82C241"/>
41
+ <stop offset="0.6187" style="stop-color:#409A3C"/>
42
+ <stop offset="1" style="stop-color:#509074"/>
43
+ </linearGradient>
44
+ <path fill="url(#SVGID_2_)" d="M220.1,163.1c0,0-5.9-6.4-12.9,0.6c0,0-22.5,24.1-22.6,24.1l-25,24.5c-2.1,2.1-3.2,4.9-2.8,7.9
45
+ c0.4,3.2,2.5,5.4,4.6,7.6c5.6,5.9,11.2,11.8,16.6,17.8c3.1,3.4,6.1,6.7,9.2,10.1c2.8,3.1,6,6.1,8.5,9.5c0.3,0.4,0.6,0.8,0.8,1.2
46
+ c61.4,73.7,46.5,98.8,33.2,123.9c0,0,37.2-37.8,37.2-37.8l18.5-19.6C340.3,273.6,263,204.7,220.1,163.1z"/>
47
+ <linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="335.9252" y1="340.5559" x2="94.3999" y2="201.1112">
48
+ <stop offset="0" style="stop-color:#FFFFFF;stop-opacity:0.2"/>
49
+ <stop offset="0.3742" style="stop-color:#309A3C"/>
50
+ <stop offset="0.5015" style="stop-color:#30523C"/>
51
+ </linearGradient>
52
+ <path opacity="0.25" fill="url(#SVGID_3_)" d="M220.1,163.1c0,0-5.9-6.4-12.9,0.6c0,0-22.5,24.1-22.6,24.1l-25,24.5
53
+ c-2.1,2.1-3.2,4.9-2.8,7.9c0.4,3.2,2.5,5.4,4.6,7.6c5.6,5.9,11.2,11.8,16.6,17.8c3.1,3.4,6.1,6.7,9.2,10.1c2.8,3.1,6,6.1,8.5,9.5
54
+ c0.3,0.4,0.6,0.8,0.8,1.2c61.4,73.7,46.5,98.8,33.2,123.9c0,0,37.2-37.8,37.2-37.8l18.5-19.6C340.3,273.6,263,204.7,220.1,163.1z
55
+ "/>
56
+ </g>
57
+ <g>
58
+
59
+ <linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="-123.1832" y1="1380.6824" x2="37.5825" y2="1287.8643" gradientTransform="matrix(-1 0 0 -1 106.4607 1451.8229)">
60
+ <stop offset="0" style="stop-color:#FACC24"/>
61
+ <stop offset="0.5216" style="stop-color:#F1B61B"/>
62
+ <stop offset="1" style="stop-color:#F98726"/>
63
+ </linearGradient>
64
+ <path fill="url(#SVGID_4_)" d="M114.3,232.3c-0.6-0.9-1.3-2-1.8-3C84,174.1,287.7,110.1,185.3,2.2l0,0l0.1,0.1l-104.5,106
65
+ C67.7,133.4,52.9,158.6,114.3,232.3z"/>
66
+
67
+ <linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="131.559" y1="1293.7916" x2="-109.9663" y2="1154.3469" gradientTransform="matrix(-1 0 0 -1 106.4607 1451.8229)">
68
+ <stop offset="0" style="stop-color:#F1881B"/>
69
+ <stop offset="0.5813" style="stop-color:#F1881B"/>
70
+ <stop offset="1" style="stop-color:#FA2524"/>
71
+ </linearGradient>
72
+ <path fill="url(#SVGID_5_)" d="M90.7,335.5c0,0,5.9,6.4,12.9-0.6c0,0,22.5-24.1,22.6-24.1c0,0,25-24.5,25-24.5
73
+ c2.1-2.1,3.2-4.9,2.8-7.9c-0.4-3.2-2.5-5.4-4.6-7.6c-5.6-5.9-11.2-11.8-16.6-17.8c-3.1-3.4-6.1-6.7-9.2-10.1
74
+ c-2.8-3.1-6-6.1-8.5-9.5c-0.3-0.4-0.6-0.8-0.8-1.2c-61.4-73.7-46.5-98.8-33.2-123.9c0,0-37.2,37.8-37.2,37.8l-18.5,19.6
75
+ C-29.5,225,47.9,293.9,90.7,335.5z"/>
76
+
77
+ <linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="131.559" y1="1293.7916" x2="-109.9663" y2="1154.3469" gradientTransform="matrix(-1 0 0 -1 106.4607 1451.8229)">
78
+ <stop offset="0" style="stop-color:#FFFFFF;stop-opacity:0.2"/>
79
+ <stop offset="0.2369" style="stop-color:#F1881B"/>
80
+ <stop offset="0.4276" style="stop-color:#F1731B"/>
81
+ </linearGradient>
82
+ <path opacity="0.4" fill="url(#SVGID_6_)" d="M90.7,335.5c0,0,5.9,6.4,12.9-0.6c0,0,22.5-24.1,22.6-24.1c0,0,25-24.5,25-24.5
83
+ c2.1-2.1,3.2-4.9,2.8-7.9c-0.4-3.2-2.5-5.4-4.6-7.6c-5.6-5.9-11.2-11.8-16.6-17.8c-3.1-3.4-6.1-6.7-9.2-10.1
84
+ c-2.8-3.1-6-6.1-8.5-9.5c-0.3-0.4-0.6-0.8-0.8-1.2c-61.4-73.7-46.5-98.8-33.2-123.9c0,0-37.2,37.8-37.2,37.8l-18.5,19.6
85
+ C-29.5,225,47.9,293.9,90.7,335.5z"/>
86
+ </g>
87
+ </g>
88
+ </g>
89
+ </svg>
static/img/wpallimport.svg ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="799.972" height="77.721" viewBox="0 0 1863 181">
2
+ <defs>
3
+ <style>
4
+ .cls-1 {
5
+ fill: #777;
6
+ fill-rule: evenodd;
7
+ }
8
+ </style>
9
+ </defs>
10
+ <path id="WP_ALL_IMPORT" data-name="WP ALL IMPORT" class="cls-1" d="M111.5,47.5L146.75,167c2.25,8,8,12.5,16.25,12.5,8.5,0,14-4.5,16.25-12.5,14-49.5,28.75-99,43-148.5a18.673,18.673,0,0,0,.75-5c0-6.75-6-12-13.75-12-6.5,0-11,3.25-12.75,9.75L162.25,131,127.75,14.25c-2.25-8-7.75-12.5-16.25-12.5s-14,4.5-16.25,12.5L60.75,131,26.5,11.25C24.75,4.75,20.25,1.5,13.75,1.5,6,1.5,0,6.75,0,13.5a18.673,18.673,0,0,0,.75,5c14.25,49.5,29,99,43,148.5C46,175,51.5,179.5,60,179.5c8.25,0,14-4.5,16.25-12.5Zm169.747,67h34c35.5,0,60-21,60-55.75S350.747,3,315.247,3h-47.5c-7.5,0-13.5,4.75-13.5,12.25v152c0,7.5,6,12.25,13.5,12.25s13.5-4.75,13.5-12.25V114.5Zm0-87.5h32c20.75,0,34.5,12.25,34.5,31.75S334,90.5,313.247,90.5h-32V27Zm292.5,142.75C576,176,580,179.5,586.5,179.5c7.5,0,14-5,14-12a12.714,12.714,0,0,0-1-5L544.245,14C541.5,6.25,536.5,1.5,528,1.5S514.5,6.25,511.745,14L456.5,162.5a12.714,12.714,0,0,0-1,5c0,7,6.5,12,14,12,6.5,0,10.5-3.5,12.75-9.75l12-33.75H561.5ZM528,42.75l25,69.75h-50.25Zm129-29c0-7.5-6-12.25-13.5-12.25s-13.5,4.75-13.5,12.25v152c0,7.5,6,12.25,13.5,12.25h87c6.75,0,11-5.25,11-12s-4.25-12-11-12h-73.5V13.75Zm134.5,0c0-7.5-6-12.25-13.5-12.25s-13.5,4.75-13.5,12.25v152c0,7.5,6,12.25,13.5,12.25h87c6.75,0,11-5.25,11-12s-4.25-12-11-12h-73.5V13.75Zm199.748,0c0-7.5-6-12.25-13.5-12.25s-13.5,4.75-13.5,12.25v153.5c0,7.5,6,12.25,13.5,12.25s13.5-4.75,13.5-12.25V13.75ZM1127.23,152.5c7.25,0,11.25-3.5,14.25-9.25l46.25-88,6.25,110.25c0.5,7.25,5,12.5,13.5,12.5,7.25,0,13.5-4,13.5-11.5,0-5.5-.5-12.75-9.5-151.5-0.5-7.75-5.25-13.5-14-13.5-8.5,0-12.75,5.25-17.25,14l-53,101.25-53-101.25c-4.5-8.75-8.75-14-17.25-14-8.75,0-13.5,5.75-14,13.5-9,138.75-9.5,146-9.5,151.5,0,7.5,6.25,11.5,13.5,11.5,8.5,0,13-5.25,13.5-12.5l6.25-110.25,46.25,88C1115.98,149,1119.98,152.5,1127.23,152.5Zm161.75-38h34c35.5,0,60-21,60-55.75S1358.48,3,1322.98,3h-47.5c-7.5,0-13.5,4.75-13.5,12.25v152c0,7.5,6,12.25,13.5,12.25s13.5-4.75,13.5-12.25V114.5Zm0-87.5h32c20.75,0,34.5,12.25,34.5,31.75s-13.75,31.75-34.5,31.75h-32V27Zm270.5,63.5c0-51.25-25.5-90.5-76.25-90.5s-76.25,39.25-76.25,90.5,25.5,90.5,76.25,90.5S1559.48,141.75,1559.48,90.5Zm-125,0c0-37.25,15.75-66,48.75-66s48.75,28.75,48.75,66-15.75,66-48.75,66S1434.48,127.75,1434.48,90.5Zm243.25,16c22.75-6.75,37.25-23.5,37.25-50,0-34.5-25.25-53.5-60.5-53.5h-44.75c-7.5,0-13.5,4.75-13.5,12.25v152c0,7.5,6,12.25,13.5,12.25s13.5-4.75,13.5-12.25V110h26.75l37.75,62c3.5,5.75,6.5,7.5,11.25,7.5,7.25,0,14-5.75,14-12.5a15.752,15.752,0,0,0-2.5-7.25Zm9.5-50c0,19.75-14.25,29.5-35.25,29.5h-28.75V27h28.75C1672.98,27,1687.23,36.75,1687.23,56.5Zm95,110.75c0,7.5,6,12.25,13.5,12.25s13.5-4.75,13.5-12.25V27h42c6.75,0,11-5.25,11-12s-4.25-12-11-12h-111c-6.75,0-11,5.25-11,12s4.25,12,11,12h42V167.25Z"/>
11
+ </svg>
views/admin/import/confirm.php CHANGED
@@ -8,8 +8,7 @@
8
  <div class="wpallimport-header">
9
  <div class="wpallimport-logo"></div>
10
  <div class="wpallimport-title">
11
- <p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
12
- <h2><?php _e('Import XML / CSV', 'wp_all_import_plugin'); ?></h2>
13
  </div>
14
  <div class="wpallimport-links">
15
  <a href="http://www.wpallimport.com/support/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=premium-support" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=docs" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
8
  <div class="wpallimport-header">
9
  <div class="wpallimport-logo"></div>
10
  <div class="wpallimport-title">
11
+ <h2><?php _e('Confirm & Run', 'wp_all_import_plugin'); ?></h2>
 
12
  </div>
13
  <div class="wpallimport-links">
14
  <a href="http://www.wpallimport.com/support/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=premium-support" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=docs" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
views/admin/import/element.php CHANGED
@@ -5,8 +5,7 @@
5
  <div class="wpallimport-header">
6
  <div class="wpallimport-logo"></div>
7
  <div class="wpallimport-title">
8
- <p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
9
- <h2><?php _e('Import XML / CSV', 'wp_all_import_plugin'); ?></h2>
10
  </div>
11
  <div class="wpallimport-links">
12
  <a href="http://www.wpallimport.com/support/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=premium-support" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=premium-docs" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
5
  <div class="wpallimport-header">
6
  <div class="wpallimport-logo"></div>
7
  <div class="wpallimport-title">
8
+ <h2><?php _e('Review Import File', 'wp_all_import_plugin'); ?></h2>
 
9
  </div>
10
  <div class="wpallimport-links">
11
  <a href="http://www.wpallimport.com/support/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=premium-support" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=premium-docs" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
views/admin/import/index.php CHANGED
@@ -1,6 +1,6 @@
1
  <!-- Preload Images -->
2
 
3
- <img src="<?php echo PMXI_Plugin::ROOT_URL . '/static/img/soflyy-logo.png'; ?>" class="wpallimport-preload-image"/>
4
 
5
  <script type="text/javascript">
6
  var plugin_url = '<?php echo WP_ALL_IMPORT_ROOT_URL; ?>';
@@ -14,8 +14,7 @@
14
  <div class="wpallimport-header">
15
  <div class="wpallimport-logo"></div>
16
  <div class="wpallimport-title">
17
- <p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
18
- <h2><?php _e('Import XML / CSV', 'wp_all_import_plugin'); ?></h2>
19
  </div>
20
  <div class="wpallimport-links">
21
  <a href="http://www.wpallimport.com/support/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=premium-support" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=docs" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
1
  <!-- Preload Images -->
2
 
3
+ <img src="<?php echo PMXI_Plugin::ROOT_URL . '/static/img/soflyy-logo.svg'; ?>" class="wpallimport-preload-image"/>
4
 
5
  <script type="text/javascript">
6
  var plugin_url = '<?php echo WP_ALL_IMPORT_ROOT_URL; ?>';
14
  <div class="wpallimport-header">
15
  <div class="wpallimport-logo"></div>
16
  <div class="wpallimport-title">
17
+ <h2><?php _e('New Import', 'wp_all_import_plugin'); ?></h2>
 
18
  </div>
19
  <div class="wpallimport-links">
20
  <a href="http://www.wpallimport.com/support/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=premium-support" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=docs" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
views/admin/import/options.php CHANGED
@@ -15,8 +15,7 @@
15
  <div class="wpallimport-header">
16
  <div class="wpallimport-logo"></div>
17
  <div class="wpallimport-title">
18
- <p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
19
- <h2><?php _e('Import XML / CSV', 'wp_all_import_plugin'); ?></h2>
20
  </div>
21
  <div class="wpallimport-links">
22
  <a href="http://www.wpallimport.com/support/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=premium-support" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=docs" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
15
  <div class="wpallimport-header">
16
  <div class="wpallimport-logo"></div>
17
  <div class="wpallimport-title">
18
+ <h2><?php _e('Import Settings', 'wp_all_import_plugin'); ?></h2>
 
19
  </div>
20
  <div class="wpallimport-links">
21
  <a href="http://www.wpallimport.com/support/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=premium-support" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=docs" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
views/admin/import/process.php CHANGED
@@ -5,8 +5,7 @@
5
  <div class="wpallimport-header">
6
  <div class="wpallimport-logo"></div>
7
  <div class="wpallimport-title">
8
- <p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
9
- <h2><?php _e('Import XML / CSV', 'wp_all_import_plugin'); ?></h2>
10
  </div>
11
  <div class="wpallimport-links">
12
  <a href="http://www.wpallimport.com/support/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=premium-support" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=docs" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
5
  <div class="wpallimport-header">
6
  <div class="wpallimport-logo"></div>
7
  <div class="wpallimport-title">
8
+ <h2><?php _e('Confirm & Run', 'wp_all_import_plugin'); ?></h2>
 
9
  </div>
10
  <div class="wpallimport-links">
11
  <a href="http://www.wpallimport.com/support/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=premium-support" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=docs" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
views/admin/import/template.php CHANGED
@@ -6,8 +6,7 @@
6
  <div class="wpallimport-header">
7
  <div class="wpallimport-logo"></div>
8
  <div class="wpallimport-title">
9
- <p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
10
- <h2><?php _e('Import XML / CSV', 'wp_all_import_plugin'); ?></h2>
11
  </div>
12
  <div class="wpallimport-links">
13
  <a href="http://www.wpallimport.com/support/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=premium-support" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=docs" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
@@ -185,7 +184,7 @@
185
 
186
  <hr>
187
 
188
- <div class="input wpallimport-section" style="padding-bottom: 8px; padding-left: 8px;">
189
 
190
  <?php
191
  wp_all_import_template_notifications( $post, 'notice' );
6
  <div class="wpallimport-header">
7
  <div class="wpallimport-logo"></div>
8
  <div class="wpallimport-title">
9
+ <h2><?php _e('Drag & Drop', 'wp_all_import_plugin'); ?></h2>
 
10
  </div>
11
  <div class="wpallimport-links">
12
  <a href="http://www.wpallimport.com/support/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=premium-support" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/?utm_source=import-plugin-free&utm_medium=help&utm_campaign=docs" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
184
 
185
  <hr>
186
 
187
+ <div class="input wpallimport-section load-template-container" style="padding-bottom: 8px; padding-left: 8px;">
188
 
189
  <?php
190
  wp_all_import_template_notifications( $post, 'notice' );
views/admin/import/template/_taxonomies_template.php CHANGED
@@ -94,7 +94,7 @@ if ( ! empty($post_taxonomies)):
94
  <div style="position:relative;">
95
  <input type="hidden" class="assign_term" name="tax_hierarchical_assing[<?php echo $ctx->name;?>][<?php echo $k;?>]" value="1"/>
96
  <input type="text" class="widefat hierarchical_xpath_field" name="tax_hierarchical_xpath[<?php echo $ctx->name; ?>][]" value="<?php echo esc_textarea($path); ?>"/>
97
- <a href="javascript:void(0);" class="icon-item remove-ico" style="top:8px;"></a>
98
  </div>
99
  </li>
100
  <?php $txes_count++; endforeach; endif; ?>
@@ -103,7 +103,7 @@ if ( ! empty($post_taxonomies)):
103
  <div style="position:relative;">
104
  <input type="hidden" class="assign_term" name="tax_hierarchical_assing[<?php echo $ctx->name;?>][0]" value="1"/>
105
  <input type="text" class="widefat hierarchical_xpath_field" name="tax_hierarchical_xpath[<?php echo $ctx->name; ?>][]" value=""/>
106
- <a href="javascript:void(0);" class="icon-item remove-ico" style="top:8px;"></a>
107
  </div>
108
  </li>
109
  <?php endif; ?>
@@ -111,7 +111,7 @@ if ( ! empty($post_taxonomies)):
111
  <div style="position:relative;">
112
  <input type="hidden" class="assign_term" name="tax_hierarchical_assing[<?php echo $ctx->name;?>][NUMBER]" value="1"/>
113
  <input type="text" class="widefat hierarchical_xpath_field" name="tax_hierarchical_xpath[<?php echo $ctx->name; ?>][]" value=""/>
114
- <a href="javascript:void(0);" class="icon-item remove-ico" style="top:8px;"></a>
115
  </div>
116
  </li>
117
  </ul>
94
  <div style="position:relative;">
95
  <input type="hidden" class="assign_term" name="tax_hierarchical_assing[<?php echo $ctx->name;?>][<?php echo $k;?>]" value="1"/>
96
  <input type="text" class="widefat hierarchical_xpath_field" name="tax_hierarchical_xpath[<?php echo $ctx->name; ?>][]" value="<?php echo esc_textarea($path); ?>"/>
97
+ <a href="javascript:void(0);" class="icon-item remove-ico"></a>
98
  </div>
99
  </li>
100
  <?php $txes_count++; endforeach; endif; ?>
103
  <div style="position:relative;">
104
  <input type="hidden" class="assign_term" name="tax_hierarchical_assing[<?php echo $ctx->name;?>][0]" value="1"/>
105
  <input type="text" class="widefat hierarchical_xpath_field" name="tax_hierarchical_xpath[<?php echo $ctx->name; ?>][]" value=""/>
106
+ <a href="javascript:void(0);" class="icon-item remove-ico"></a>
107
  </div>
108
  </li>
109
  <?php endif; ?>
111
  <div style="position:relative;">
112
  <input type="hidden" class="assign_term" name="tax_hierarchical_assing[<?php echo $ctx->name;?>][NUMBER]" value="1"/>
113
  <input type="text" class="widefat hierarchical_xpath_field" name="tax_hierarchical_xpath[<?php echo $ctx->name; ?>][]" value=""/>
114
+ <a href="javascript:void(0);" class="icon-item remove-ico"></a>
115
  </div>
116
  </li>
117
  </ul>
views/admin/manage/index.php CHANGED
@@ -1,13 +1,12 @@
1
- <div class="wpallimport-header" style="overflow:hidden; height: 65px; padding-top: 10px; margin-bottom: -20px;">
 
 
2
  <div class="wpallimport-logo"></div>
3
  <div class="wpallimport-title">
4
- <p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
5
- <h3><?php _e('Manage Imports', 'wp_all_import_plugin'); ?></h3>
6
  </div>
7
  </div>
8
 
9
- <h2></h2> <!-- Do not remove -->
10
-
11
  <?php if ($this->errors->get_error_codes()): ?>
12
  <?php $this->error() ?>
13
  <?php endif ?>
1
+ <h2></h2> <!-- Do not remove -->
2
+
3
+ <div class="wpallimport-header" style="overflow:hidden; height: 70px; padding-top: 10px; margin-bottom: -15px;">
4
  <div class="wpallimport-logo"></div>
5
  <div class="wpallimport-title">
6
+ <h3><?php _e('Manage Imports', 'wp_all_import_plugin'); ?></h3>
 
7
  </div>
8
  </div>
9
 
 
 
10
  <?php if ($this->errors->get_error_codes()): ?>
11
  <?php $this->error() ?>
12
  <?php endif ?>
views/admin/promotion/acf.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpallimport-collapsed closed pmai_options">
2
+ <div class="wpallimport-content-section">
3
+ <div class="wpallimport-collapsed-header">
4
+ <h3><?php _e('Advanced Custom Fields Add-On','wp_all_import_acf_add_on');?></h3>
5
+ </div>
6
+ <div class="wpallimport-collapsed-content" style="padding: 0;">
7
+ <div class="wpallimport-collapsed-content-inner">
8
+ <div class="wpallimport-free-edition-notice" style="text-align:center; margin-top:0; margin-bottom: 40px;">
9
+ <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707192&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-acf" target="_blank" class="upgrade_link"><?php _e('ACF Import Add-On required to Import Advanced Custom Fields', 'pmxi_plugin');?></a>
10
+ </div>
11
+ <table class="form-table" style="max-width:none;">
12
+ <tr>
13
+ <td colspan="3">
14
+ <?php if (!empty($groups)): ?>
15
+ <p><strong><?php _e("Please choose your Field Groups.",'wp_all_import_acf_add_on');?></strong></p>
16
+ <ul>
17
+ <?php
18
+ foreach ($groups as $key => $group) {
19
+ $is_show_acf_group = apply_filters('wp_all_import_acf_is_show_group', true, $group);
20
+ ?>
21
+ <li>
22
+ <input type="hidden" name="acf[<?php echo $group['ID'];?>]" value="<?php echo $is_show_acf_group ? '0' : '1'?>"/>
23
+ <?php if ($is_show_acf_group): ?>
24
+ <input id="acf_<?php echo $post_type . '_' . $group['ID'];?>" type="checkbox" name="acf[<?php echo $group['ID'];?>]" disabled="disabled" value="1" rel="<?php echo $group['ID'];?>" class="pmai_acf_group"/>
25
+ <label for="acf_<?php echo $post_type . '_' . $group['ID']; ?>"><?php echo $group['title']; ?></label>
26
+ <?php endif; ?>
27
+ </li>
28
+ <?php
29
+ }
30
+ ?>
31
+ </ul>
32
+ <div class="acf_groups"></div>
33
+ <?php
34
+ else:
35
+ ?>
36
+ <p><strong><?php _e("Please create Field Groups.",'wp_all_import_acf_add_on');?></strong></p>
37
+ <?php
38
+ endif;
39
+ ?>
40
+ </td>
41
+ </tr>
42
+ </table>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </div>
views/admin/settings/index.php CHANGED
@@ -3,7 +3,6 @@
3
  <div class="wpallimport-header">
4
  <div class="wpallimport-logo"></div>
5
  <div class="wpallimport-title">
6
- <p style="font-size:18px !important;"><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
7
  <h3><?php _e('Settings', 'wp_all_import_plugin'); ?></h3>
8
  </div>
9
  </div>
3
  <div class="wpallimport-header">
4
  <div class="wpallimport-logo"></div>
5
  <div class="wpallimport-title">
 
6
  <h3><?php _e('Settings', 'wp_all_import_plugin'); ?></h3>
7
  </div>
8
  </div>