Import any XML or CSV File to WordPress - Version 3.5.5

Version Description

  • improvement: get rid of deprecated setting 'High Speed Small File Processing'
  • bug fix: chromium scroll anchoring caused screen jumping effect
  • bug fix: pagenum query argument caused broken link on import complete screen
Download this release

Release Info

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

Code changes from version 3.5.4 to 3.5.5

actions/delete_post.php CHANGED
@@ -10,5 +10,8 @@ function pmxi_delete_post($post_id) {
10
  $image = new PMXI_Image_Record();
11
  $image->getBy( 'attachment_id', $post_id )->isEmpty() or $image->delete();
12
  }
 
 
 
13
  }
14
  }
10
  $image = new PMXI_Image_Record();
11
  $image->getBy( 'attachment_id', $post_id )->isEmpty() or $image->delete();
12
  }
13
+ // Delete entries from the hash table when posts are deleted.
14
+ $hashRecord = new PMXI_Hash_Record();
15
+ $hashRecord->getBy(['post_id' => $post_id, 'post_type' => 'post'])->isEmpty() or $hashRecord->delete();
16
  }
17
  }
actions/pmxi_after_xml_import.php CHANGED
@@ -1,7 +1,36 @@
1
  <?php
2
  function pmxi_pmxi_after_xml_import( $import_id, $import )
3
- {
4
- if ( ! in_array($import->options['custom_type'], array('taxonomies', 'import_users', 'shop_customer')) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  $custom_type = get_post_type_object( $import->options['custom_type'] );
6
  if ( ! empty($custom_type) && $custom_type->hierarchical ){
7
  $parent_posts = get_option('wp_all_import_posts_hierarchy_' . $import_id);
@@ -44,6 +73,20 @@ function pmxi_pmxi_after_xml_import( $import_id, $import )
44
  }
45
  }
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  // Add removed action during import.
48
  add_action( 'transition_post_status', '_update_term_count_on_transition_post_status', 10, 3 );
49
  add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 3 );
1
  <?php
2
  function pmxi_pmxi_after_xml_import( $import_id, $import )
3
+ {
4
+ if ($import->options['custom_type'] == 'taxonomies') {
5
+ $parent_terms = get_option('wp_all_import_taxonomies_hierarchy_' . $import_id);
6
+ if (!empty($parent_terms)){
7
+ foreach ($parent_terms as $term_id => $pterm){
8
+ $parent_term = get_term_by('slug', $pterm, $import->options['taxonomy_type']) or $parent_term = get_term_by('name', $pterm, $import->options['taxonomy_type']) or ctype_digit($pterm) and $parent_term = get_term_by('id', $pterm, $import->options['taxonomy_type']);
9
+ if (!empty($parent_term) && !is_wp_error($parent_term)){
10
+ wp_update_term($term_id, $import->options['taxonomy_type'], array(
11
+ 'parent' => $parent_term->term_id,
12
+ ));
13
+ }
14
+ }
15
+ }
16
+ delete_option('wp_all_import_taxonomies_hierarchy_' . $import_id);
17
+ }
18
+ if (in_array($import->options['custom_type'], ['comments', 'woo_reviews'])) {
19
+ $parent_comments = get_option('wp_all_import_comments_hierarchy_' . $import_id);
20
+ if (!empty($parent_comments)){
21
+ foreach ($parent_comments as $comment_id => $pcomment){
22
+ $parent_comment = get_comment($pcomment);
23
+ if (!empty($parent_comment) && !is_wp_error($parent_comment)){
24
+ wp_update_comment(array(
25
+ 'comment_ID' => $comment_id,
26
+ 'comment_parent' => $parent_comment->comment_ID,
27
+ ));
28
+ }
29
+ }
30
+ }
31
+ delete_option('wp_all_import_taxonomies_hierarchy_' . $import_id);
32
+ }
33
+ if ( ! in_array($import->options['custom_type'], array('taxonomies', 'import_users', 'shop_customer', 'comments', 'woo_reviews')) ) {
34
  $custom_type = get_post_type_object( $import->options['custom_type'] );
35
  if ( ! empty($custom_type) && $custom_type->hierarchical ){
36
  $parent_posts = get_option('wp_all_import_posts_hierarchy_' . $import_id);
73
  }
74
  }
75
 
76
+ // Re-count post comments.
77
+ if ( in_array($import->options['custom_type'], array('comments', 'woo_reviews')) ) {
78
+ $recount_comments_after_import = TRUE;
79
+ $recount_comments_after_import = apply_filters('wp_all_import_recount_comments_after_import', $recount_comments_after_import, $import_id);
80
+ if ($recount_comments_after_import) {
81
+ $comment_posts = get_option('wp_all_import_comment_posts_' . $import_id);
82
+ if (!empty($comment_posts)) {
83
+ foreach ($comment_posts as $comment_post) {
84
+ wp_update_comment_count_now($comment_post);
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
  // Add removed action during import.
91
  add_action( 'transition_post_status', '_update_term_count_on_transition_post_status', 10, 3 );
92
  add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 3 );
actions/pmxi_before_xml_import.php CHANGED
@@ -7,4 +7,15 @@ function pmxi_pmxi_before_xml_import( $import_id )
7
  remove_action( 'transition_post_status', '_update_term_count_on_transition_post_status', 10 );
8
  remove_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10 );
9
  remove_action( 'post_updated', 'wp_save_post_revision', 10 );
 
 
 
 
 
 
 
 
 
 
 
10
  }
7
  remove_action( 'transition_post_status', '_update_term_count_on_transition_post_status', 10 );
8
  remove_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10 );
9
  remove_action( 'post_updated', 'wp_save_post_revision', 10 );
10
+
11
+ // Invalidate hashes if functions file has been changed.
12
+ $functions_hash = wp_all_import_generate_functions_hash();
13
+ if ($functions_hash) {
14
+ $current_hash = get_option('_wp_all_import_functions_hash_' . $import_id, false);
15
+ if ($functions_hash !== $current_hash) {
16
+ global $wpdb;
17
+ $wpdb->query( 'DELETE FROM ' . $wpdb->prefix . 'pmxi_hash WHERE import_id = ' . $import_id );
18
+ update_option('_wp_all_import_functions_hash_' . $import_id, $functions_hash);
19
+ }
20
+ }
21
  }
actions/wp_ajax_import_failed.php CHANGED
@@ -10,10 +10,10 @@ function pmxi_wp_ajax_import_failed(){
10
  }
11
 
12
  $result = false;
13
- if (!empty($_POST['id'])) {
14
  $import = new PMXI_Import_record();
15
  $import->getbyId($_POST['id']);
16
- if ( ! $import->isEmpty()){
17
  $import->set(array(
18
  'executing' => 0,
19
  'last_activity' => date('Y-m-d H:i:s'),
10
  }
11
 
12
  $result = false;
13
+ if (!empty($_POST['id'])) {
14
  $import = new PMXI_Import_record();
15
  $import->getbyId($_POST['id']);
16
+ if ( ! $import->isEmpty()) {
17
  $import->set(array(
18
  'executing' => 0,
19
  'last_activity' => date('Y-m-d H:i:s'),
classes/upload.php CHANGED
@@ -160,20 +160,15 @@ if ( ! class_exists('PMXI_Upload')){
160
  $this->root_element = 'node';
161
 
162
  } elseif(preg_match('%\W(gz)$%i', trim($this->file))){ // If gz file uploaded
163
-
164
  $fileInfo = wp_all_import_get_gz($this->file, 0, $this->uploadsPath);
165
-
166
  if ( ! is_wp_error($fileInfo) ){
167
-
168
- $filePath = $fileInfo['localPath'];
169
-
170
  // Detect if file is very large
171
  $source = array(
172
  'name' => basename($this->file),
173
  'type' => 'upload',
174
  'path' => $this->file,
175
  );
176
-
177
  // detect CSV or XML
178
  if ( $fileInfo['type'] == 'csv') { // it is CSV file
179
 
@@ -182,13 +177,10 @@ if ( ! class_exists('PMXI_Upload')){
182
  //@unlink($filePath);
183
  $filePath = $csv->xml_path;
184
  $this->is_csv = $csv->is_csv;
185
- $this->root_element = 'node';
186
-
187
  }
188
-
189
  }
190
  else $this->errors->add('form-validation', $fileInfo->get_error_message());
191
-
192
  } elseif (preg_match('%\W(json)$%i', trim($this->file))){
193
 
194
  // Detect if file is very large
@@ -204,15 +196,11 @@ if ( ! class_exists('PMXI_Upload')){
204
 
205
  if( is_wp_error($is_json)){
206
  $this->errors->add('form-validation', $is_json->get_error_message(), 'wp_all_import_plugin');
207
- }
208
- else{
209
-
210
  $xml_data = wp_all_import_json_to_xml( json_decode($json_str, true) );
211
-
212
  if ( empty($xml_data) ){
213
  $this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'wp_all_import_plugin'));
214
- }
215
- else{
216
  $jsontmpname = $this->uploadsPath .'/'. wp_all_import_url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($this->file))));
217
  //@unlink($this->file);
218
  file_put_contents($jsontmpname, $xml_data);
@@ -220,23 +208,16 @@ if ( ! class_exists('PMXI_Upload')){
220
 
221
  }
222
  }
223
-
224
- } elseif (preg_match('%\W(sql)$%i', trim($this->file))){
225
-
226
  $source = array(
227
  'name' => basename($this->file),
228
  'type' => 'upload',
229
  'path' => $this->file,
230
  );
231
-
232
- include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php' );
233
-
234
  $sql = new PMXI_SQLParser( $this->file, $this->uploadsPath );
235
- $filePath = $sql->parse();
236
- //@unlink($this->file);
237
-
238
  } elseif (preg_match('%\W(xls|xlsx)$%i', trim($this->file))){
239
-
240
  $source = array(
241
  'name' => basename($this->file),
242
  'type' => 'upload',
@@ -245,17 +226,14 @@ if ( ! class_exists('PMXI_Upload')){
245
 
246
  include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportXLSParse.php' );
247
  $xls = new PMXI_XLSParser( $this->file, $this->uploadsPath );
248
- $filePath = $xls->parse();
249
-
250
- } else { // If XML file uploaded
251
-
252
  $filePath = $this->file;
253
  $source = array(
254
  'name' => basename($this->file),
255
  'type' => 'upload',
256
  'path' => $filePath,
257
  );
258
-
259
  }
260
 
261
  if ( $this->errors->get_error_codes() ) return $this->errors;
@@ -266,8 +244,7 @@ if ( ! class_exists('PMXI_Upload')){
266
 
267
  $templateOptions = "";
268
 
269
- if ( is_array($decodedTemplates) )
270
- {
271
  $templateOptions = empty($decodedTemplates[0]) ? current($decodedTemplates) : $decodedTemplates;
272
  }
273
 
@@ -331,11 +308,8 @@ if ( ! class_exists('PMXI_Upload')){
331
  $archive = new PclZip($tmpname);
332
  if (($v_result_list = $archive->extract(PCLZIP_OPT_PATH, $this->uploadsPath, PCLZIP_OPT_REPLACE_NEWER)) == 0) {
333
  $this->errors->add('form-validation', __('WP All Import couldn\'t find a file to import inside your ZIP.<br/><br/>Either the .ZIP file is broken, or doesn\'t contain a file with an extension of XML, CSV, PSV, DAT, or TXT. <br/>Please attempt to unzip your .ZIP file on your computer to ensure it is a valid .ZIP file which can actually be unzipped, and that it contains a file which WP All Import can import.', 'wp_all_import_plugin'));
334
- }
335
- else {
336
-
337
  $filePath = '';
338
-
339
  if (!empty($v_result_list)) {
340
  foreach ($v_result_list as $unzipped_file) {
341
  if ($unzipped_file['status'] == 'ok' and preg_match('%\W(xml|csv|txt|dat|psv|json|xls|xlsx|gz)$%i', trim($unzipped_file['stored_filename'])) and strpos($unzipped_file['stored_filename'], 'readme.txt') === false ) {
@@ -384,56 +358,43 @@ if ( ! class_exists('PMXI_Upload')){
384
  }
385
  break;
386
  }
387
- zip_close($zip);
388
-
389
  } else {
390
  $this->errors->add('form-validation', __('WP All Import couldn\'t find a file to import inside your ZIP.<br/><br/>Either the .ZIP file is broken, or doesn\'t contain a file with an extension of XML, CSV, PSV, DAT, or TXT. <br/>Please attempt to unzip your .ZIP file on your computer to ensure it is a valid .ZIP file which can actually be unzipped, and that it contains a file which WP All Import can import.', 'wp_all_import_plugin'));
391
  }
392
- }
393
-
394
  // Detect if file is very large
395
  $source = array(
396
  'name' => basename(parse_url($this->file, PHP_URL_PATH)),
397
  'type' => 'url',
398
  'path' => $feed_xpath,
399
- );
400
-
401
- $fileFormats = $this->get_xml_file( $filePath );
402
-
403
  $csv_path = $fileFormats['csv'];
404
  $filePath = $fileFormats['xml'];
405
  }
406
-
407
  if (file_exists($tmpname)) wp_all_import_remove_source($tmpname, false);
408
-
409
  } elseif ('csv' == $feed_type or '' == $feed_type and preg_match('%\W(csv|txt|dat|psv|tsv)$%i', trim($this->file))) {
410
 
411
  $source = array(
412
  'name' => basename(parse_url($this->file, PHP_URL_PATH)),
413
  'type' => 'url',
414
  'path' => $feed_xpath,
415
- );
416
-
417
  // copy remote file in binary mode
418
  $filePath = wp_all_import_get_url($this->file, $this->uploadsPath, 'csv');
419
-
420
  if ( ! is_wp_error($filePath) ){
421
-
422
  if ( ! file_exists($filePath)) {
423
  $this->errors->add('form-validation', __('WP All Import was not able to download your file.<br/><br/>Please make sure the URL to your file is valid.<br/>You can test this by pasting it into your browser.<br/>Other reasons for this error can include some server setting on your host restricting access to this particular URL or external URLs in general, or some setting on the server hosting the file you are trying to access preventing your server from accessing it.', 'wp_all_import_plugin'));
424
  }
425
-
426
  // Detect if file is very large
427
  include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
428
  $csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targetDir' => $this->uploadsPath ) ); // create chunks
429
  //wp_all_import_remove_source($filePath, false);
430
-
431
  $csv_path = $filePath;
432
-
433
  $filePath = $csv->xml_path;
434
  $this->is_csv = $csv->is_csv;
435
- $this->root_element = 'node';
436
-
437
  }
438
  else $this->errors->add('form-validation', $filePath->get_error_message());
439
 
@@ -443,50 +404,37 @@ if ( ! class_exists('PMXI_Upload')){
443
  'name' => basename(parse_url($this->file, PHP_URL_PATH)),
444
  'type' => 'url',
445
  'path' => $feed_xpath,
446
- );
447
-
448
  // copy remote file in binary mode
449
  $filePath = wp_all_import_get_url($this->file, $this->uploadsPath, 'json');
450
-
451
  $json_str = file_get_contents($filePath);
452
  $json_str = str_replace("\xEF\xBB\xBF",'', $json_str);
453
  $is_json = wp_all_import_is_json($json_str);
454
-
455
- if( is_wp_error($is_json)){
456
  $this->errors->add('form-validation', $is_json->get_error_message(), 'wp_all_import_plugin');
457
- }
458
- else{
459
-
460
  $xml_data = wp_all_import_json_to_xml( json_decode($json_str, true) );
461
-
462
  if ( empty($xml_data) ){
463
  $this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'wp_all_import_plugin'));
464
- }
465
- else{
466
  $tmpname = $this->uploadsPath .'/'. wp_all_import_url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($filePath))));
467
  file_put_contents($tmpname, $xml_data);
468
  wp_all_import_remove_source($filePath, false);
469
  $filePath = $tmpname;
470
  }
471
  }
472
-
473
  } elseif ('sql' == $feed_type or preg_match('%\W(sql)$%i', trim($this->file))){
474
-
475
  $source = array(
476
  'name' => basename($this->file),
477
  'type' => 'url',
478
  'path' => $feed_xpath,
479
- );
480
-
481
  // copy remote file in binary mode
482
  $localSQLPath = wp_all_import_get_url($this->file, $this->uploadsPath, 'sql');
483
-
484
- include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php' );
485
-
486
  $sql = new PMXI_SQLParser( $localSQLPath, $this->uploadsPath );
487
  $filePath = $sql->parse();
488
  wp_all_import_remove_source($localSQLPath, false);
489
-
490
  } elseif (preg_match('%\W(xls|xlsx)$%i', $feed_type) || preg_match('%\W(xls|xlsx)$%i', strtok(trim($this->file), "?")) || preg_match('%\W(xls|xlsx)$%i', trim($this->file))) {
491
 
492
  $source = array(
@@ -494,57 +442,42 @@ if ( ! class_exists('PMXI_Upload')){
494
  'type' => 'url',
495
  'path' => $feed_xpath,
496
  );
497
-
498
  // copy remote file in binary mode
499
  $localXLSPath = wp_all_import_get_url($this->file, $this->uploadsPath, 'xls');
500
-
501
- include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportXLSParse.php' );
502
-
503
  $xls = new PMXI_XLSParser( $localXLSPath, $this->uploadsPath );
504
  $filePath = $xls->parse();
505
  wp_all_import_remove_source($localXLSPath, false);
506
-
507
  } else {
508
-
509
  if ('gz' == $feed_type or '' == $feed_type and preg_match('%\W(gz|gzip)$%i', trim($this->file))){
510
  $fileInfo = wp_all_import_get_gz($this->file, 0, $this->uploadsPath);
511
- }
512
- else{
513
- $headers = wp_all_import_get_feed_type($this->file);
514
-
515
  if ($headers['Content-Type'] and in_array($headers['Content-Type'], array('gz', 'gzip')) or $headers['Content-Encoding'] and in_array($headers['Content-Encoding'], array('gz', 'gzip'))){
516
  $fileInfo = wp_all_import_get_gz($this->file, 0, $this->uploadsPath, $headers);
517
- }
518
- else{
519
  $fileInfo = wp_all_import_get_url($this->file, $this->uploadsPath, $headers['Content-Type'], $headers['Content-Encoding'], true);
520
  }
521
  }
522
 
523
  if ( ! is_wp_error($fileInfo) ){
524
-
525
  $filePath = $fileInfo['localPath'];
526
-
527
  if ( ! file_exists($filePath)) {
528
  $this->errors->add('form-validation', __('WP All Import was not able to download your file.<br/><br/>Please make sure the URL to your file is valid.<br/>You can test this by pasting it into your browser.<br/>Other reasons for this error can include some server setting on your host restricting access to this particular URL or external URLs in general, or some setting on the server hosting the file you are trying to access preventing your server from accessing it.', 'wp_all_import_plugin'));
529
  }
530
-
531
  // Detect if file is very large
532
  $source = array(
533
  'name' => basename(parse_url($this->file, PHP_URL_PATH)),
534
  'type' => 'url',
535
  'path' => $feed_xpath,
536
- );
537
-
538
  $fileInfo['type'] = apply_filters('wp_all_import_feed_type', $fileInfo['type'], $this->file);
539
-
540
  // detect CSV or XML
541
  switch ($fileInfo['type']) {
542
  case 'csv':
543
  include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
544
  $csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targetDir' => $this->uploadsPath ) ); // create chunks
545
-
546
  $csv_path = $filePath;
547
-
548
  //wp_all_import_remove_source($filePath, false);
549
  $filePath = $csv->xml_path;
550
  $this->is_csv = $csv->is_csv;
@@ -557,15 +490,11 @@ if ( ! class_exists('PMXI_Upload')){
557
 
558
  if( is_wp_error($is_json)){
559
  $this->errors->add('form-validation', $is_json->get_error_message(), 'wp_all_import_plugin');
560
- }
561
- else{
562
-
563
  $xml_data = wp_all_import_json_to_xml( json_decode($json_str, true) );
564
-
565
- if ( empty($xml_data) ){
566
  $this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'wp_all_import_plugin'));
567
- }
568
- else{
569
  $tmpname = $this->uploadsPath .'/'. wp_all_import_url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($filePath))));
570
  file_put_contents($tmpname, $xml_data);
571
  wp_all_import_remove_source($filePath, false);
@@ -573,19 +502,15 @@ if ( ! class_exists('PMXI_Upload')){
573
  }
574
  }
575
  break;
576
- case 'sql':
577
-
578
- include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php' );
579
-
580
  $sql = new PMXI_SQLParser( $filePath, $this->uploadsPath );
581
- $filePath = $sql->parse();
582
-
583
  break;
584
  default:
585
  # code...
586
  break;
587
  }
588
-
589
  }
590
  else $this->errors->add('form-validation', $fileInfo->get_error_message());
591
  }
@@ -597,8 +522,7 @@ if ( ! class_exists('PMXI_Upload')){
597
 
598
  $templateOptions = "";
599
 
600
- if ( is_array($decodedTemplates) and ! empty($decodedTemplates))
601
- {
602
  $templateOptions = empty($decodedTemplates[0]) ? current($decodedTemplates) : $decodedTemplates;
603
  }
604
 
@@ -717,5 +641,5 @@ if ( ! class_exists('PMXI_Upload')){
717
  'xml' => $filePath
718
  );
719
  }
720
- }
721
  }
160
  $this->root_element = 'node';
161
 
162
  } elseif(preg_match('%\W(gz)$%i', trim($this->file))){ // If gz file uploaded
 
163
  $fileInfo = wp_all_import_get_gz($this->file, 0, $this->uploadsPath);
 
164
  if ( ! is_wp_error($fileInfo) ){
165
+ $filePath = $fileInfo['localPath'];
 
 
166
  // Detect if file is very large
167
  $source = array(
168
  'name' => basename($this->file),
169
  'type' => 'upload',
170
  'path' => $this->file,
171
  );
 
172
  // detect CSV or XML
173
  if ( $fileInfo['type'] == 'csv') { // it is CSV file
174
 
177
  //@unlink($filePath);
178
  $filePath = $csv->xml_path;
179
  $this->is_csv = $csv->is_csv;
180
+ $this->root_element = 'node';
 
181
  }
 
182
  }
183
  else $this->errors->add('form-validation', $fileInfo->get_error_message());
 
184
  } elseif (preg_match('%\W(json)$%i', trim($this->file))){
185
 
186
  // Detect if file is very large
196
 
197
  if( is_wp_error($is_json)){
198
  $this->errors->add('form-validation', $is_json->get_error_message(), 'wp_all_import_plugin');
199
+ } else {
 
 
200
  $xml_data = wp_all_import_json_to_xml( json_decode($json_str, true) );
 
201
  if ( empty($xml_data) ){
202
  $this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'wp_all_import_plugin'));
203
+ } else{
 
204
  $jsontmpname = $this->uploadsPath .'/'. wp_all_import_url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($this->file))));
205
  //@unlink($this->file);
206
  file_put_contents($jsontmpname, $xml_data);
208
 
209
  }
210
  }
211
+ } elseif (preg_match('%\W(sql)$%i', trim($this->file))) {
 
 
212
  $source = array(
213
  'name' => basename($this->file),
214
  'type' => 'upload',
215
  'path' => $this->file,
216
  );
217
+ include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php' );
 
 
218
  $sql = new PMXI_SQLParser( $this->file, $this->uploadsPath );
219
+ $filePath = $sql->parse();
 
 
220
  } elseif (preg_match('%\W(xls|xlsx)$%i', trim($this->file))){
 
221
  $source = array(
222
  'name' => basename($this->file),
223
  'type' => 'upload',
226
 
227
  include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportXLSParse.php' );
228
  $xls = new PMXI_XLSParser( $this->file, $this->uploadsPath );
229
+ $filePath = $xls->parse();
230
+ } else { // If XML file uploaded
 
 
231
  $filePath = $this->file;
232
  $source = array(
233
  'name' => basename($this->file),
234
  'type' => 'upload',
235
  'path' => $filePath,
236
  );
 
237
  }
238
 
239
  if ( $this->errors->get_error_codes() ) return $this->errors;
244
 
245
  $templateOptions = "";
246
 
247
+ if ( is_array($decodedTemplates) ) {
 
248
  $templateOptions = empty($decodedTemplates[0]) ? current($decodedTemplates) : $decodedTemplates;
249
  }
250
 
308
  $archive = new PclZip($tmpname);
309
  if (($v_result_list = $archive->extract(PCLZIP_OPT_PATH, $this->uploadsPath, PCLZIP_OPT_REPLACE_NEWER)) == 0) {
310
  $this->errors->add('form-validation', __('WP All Import couldn\'t find a file to import inside your ZIP.<br/><br/>Either the .ZIP file is broken, or doesn\'t contain a file with an extension of XML, CSV, PSV, DAT, or TXT. <br/>Please attempt to unzip your .ZIP file on your computer to ensure it is a valid .ZIP file which can actually be unzipped, and that it contains a file which WP All Import can import.', 'wp_all_import_plugin'));
311
+ } else {
 
 
312
  $filePath = '';
 
313
  if (!empty($v_result_list)) {
314
  foreach ($v_result_list as $unzipped_file) {
315
  if ($unzipped_file['status'] == 'ok' and preg_match('%\W(xml|csv|txt|dat|psv|json|xls|xlsx|gz)$%i', trim($unzipped_file['stored_filename'])) and strpos($unzipped_file['stored_filename'], 'readme.txt') === false ) {
358
  }
359
  break;
360
  }
361
+ zip_close($zip);
 
362
  } else {
363
  $this->errors->add('form-validation', __('WP All Import couldn\'t find a file to import inside your ZIP.<br/><br/>Either the .ZIP file is broken, or doesn\'t contain a file with an extension of XML, CSV, PSV, DAT, or TXT. <br/>Please attempt to unzip your .ZIP file on your computer to ensure it is a valid .ZIP file which can actually be unzipped, and that it contains a file which WP All Import can import.', 'wp_all_import_plugin'));
364
  }
365
+ }
 
366
  // Detect if file is very large
367
  $source = array(
368
  'name' => basename(parse_url($this->file, PHP_URL_PATH)),
369
  'type' => 'url',
370
  'path' => $feed_xpath,
371
+ );
372
+ $fileFormats = $this->get_xml_file( $filePath );
 
 
373
  $csv_path = $fileFormats['csv'];
374
  $filePath = $fileFormats['xml'];
375
  }
 
376
  if (file_exists($tmpname)) wp_all_import_remove_source($tmpname, false);
 
377
  } elseif ('csv' == $feed_type or '' == $feed_type and preg_match('%\W(csv|txt|dat|psv|tsv)$%i', trim($this->file))) {
378
 
379
  $source = array(
380
  'name' => basename(parse_url($this->file, PHP_URL_PATH)),
381
  'type' => 'url',
382
  'path' => $feed_xpath,
383
+ );
 
384
  // copy remote file in binary mode
385
  $filePath = wp_all_import_get_url($this->file, $this->uploadsPath, 'csv');
 
386
  if ( ! is_wp_error($filePath) ){
 
387
  if ( ! file_exists($filePath)) {
388
  $this->errors->add('form-validation', __('WP All Import was not able to download your file.<br/><br/>Please make sure the URL to your file is valid.<br/>You can test this by pasting it into your browser.<br/>Other reasons for this error can include some server setting on your host restricting access to this particular URL or external URLs in general, or some setting on the server hosting the file you are trying to access preventing your server from accessing it.', 'wp_all_import_plugin'));
389
  }
 
390
  // Detect if file is very large
391
  include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
392
  $csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targetDir' => $this->uploadsPath ) ); // create chunks
393
  //wp_all_import_remove_source($filePath, false);
 
394
  $csv_path = $filePath;
 
395
  $filePath = $csv->xml_path;
396
  $this->is_csv = $csv->is_csv;
397
+ $this->root_element = 'node';
 
398
  }
399
  else $this->errors->add('form-validation', $filePath->get_error_message());
400
 
404
  'name' => basename(parse_url($this->file, PHP_URL_PATH)),
405
  'type' => 'url',
406
  'path' => $feed_xpath,
407
+ );
 
408
  // copy remote file in binary mode
409
  $filePath = wp_all_import_get_url($this->file, $this->uploadsPath, 'json');
 
410
  $json_str = file_get_contents($filePath);
411
  $json_str = str_replace("\xEF\xBB\xBF",'', $json_str);
412
  $is_json = wp_all_import_is_json($json_str);
413
+ if ( is_wp_error($is_json)){
 
414
  $this->errors->add('form-validation', $is_json->get_error_message(), 'wp_all_import_plugin');
415
+ } else {
 
 
416
  $xml_data = wp_all_import_json_to_xml( json_decode($json_str, true) );
 
417
  if ( empty($xml_data) ){
418
  $this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'wp_all_import_plugin'));
419
+ } else {
 
420
  $tmpname = $this->uploadsPath .'/'. wp_all_import_url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($filePath))));
421
  file_put_contents($tmpname, $xml_data);
422
  wp_all_import_remove_source($filePath, false);
423
  $filePath = $tmpname;
424
  }
425
  }
 
426
  } elseif ('sql' == $feed_type or preg_match('%\W(sql)$%i', trim($this->file))){
 
427
  $source = array(
428
  'name' => basename($this->file),
429
  'type' => 'url',
430
  'path' => $feed_xpath,
431
+ );
 
432
  // copy remote file in binary mode
433
  $localSQLPath = wp_all_import_get_url($this->file, $this->uploadsPath, 'sql');
434
+ include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php' );
 
 
435
  $sql = new PMXI_SQLParser( $localSQLPath, $this->uploadsPath );
436
  $filePath = $sql->parse();
437
  wp_all_import_remove_source($localSQLPath, false);
 
438
  } elseif (preg_match('%\W(xls|xlsx)$%i', $feed_type) || preg_match('%\W(xls|xlsx)$%i', strtok(trim($this->file), "?")) || preg_match('%\W(xls|xlsx)$%i', trim($this->file))) {
439
 
440
  $source = array(
442
  'type' => 'url',
443
  'path' => $feed_xpath,
444
  );
 
445
  // copy remote file in binary mode
446
  $localXLSPath = wp_all_import_get_url($this->file, $this->uploadsPath, 'xls');
447
+ include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportXLSParse.php' );
 
 
448
  $xls = new PMXI_XLSParser( $localXLSPath, $this->uploadsPath );
449
  $filePath = $xls->parse();
450
  wp_all_import_remove_source($localXLSPath, false);
 
451
  } else {
 
452
  if ('gz' == $feed_type or '' == $feed_type and preg_match('%\W(gz|gzip)$%i', trim($this->file))){
453
  $fileInfo = wp_all_import_get_gz($this->file, 0, $this->uploadsPath);
454
+ } else {
455
+ $headers = wp_all_import_get_feed_type($this->file);
 
 
456
  if ($headers['Content-Type'] and in_array($headers['Content-Type'], array('gz', 'gzip')) or $headers['Content-Encoding'] and in_array($headers['Content-Encoding'], array('gz', 'gzip'))){
457
  $fileInfo = wp_all_import_get_gz($this->file, 0, $this->uploadsPath, $headers);
458
+ } else {
 
459
  $fileInfo = wp_all_import_get_url($this->file, $this->uploadsPath, $headers['Content-Type'], $headers['Content-Encoding'], true);
460
  }
461
  }
462
 
463
  if ( ! is_wp_error($fileInfo) ){
 
464
  $filePath = $fileInfo['localPath'];
 
465
  if ( ! file_exists($filePath)) {
466
  $this->errors->add('form-validation', __('WP All Import was not able to download your file.<br/><br/>Please make sure the URL to your file is valid.<br/>You can test this by pasting it into your browser.<br/>Other reasons for this error can include some server setting on your host restricting access to this particular URL or external URLs in general, or some setting on the server hosting the file you are trying to access preventing your server from accessing it.', 'wp_all_import_plugin'));
467
  }
 
468
  // Detect if file is very large
469
  $source = array(
470
  'name' => basename(parse_url($this->file, PHP_URL_PATH)),
471
  'type' => 'url',
472
  'path' => $feed_xpath,
473
+ );
 
474
  $fileInfo['type'] = apply_filters('wp_all_import_feed_type', $fileInfo['type'], $this->file);
 
475
  // detect CSV or XML
476
  switch ($fileInfo['type']) {
477
  case 'csv':
478
  include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
479
  $csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targetDir' => $this->uploadsPath ) ); // create chunks
 
480
  $csv_path = $filePath;
 
481
  //wp_all_import_remove_source($filePath, false);
482
  $filePath = $csv->xml_path;
483
  $this->is_csv = $csv->is_csv;
490
 
491
  if( is_wp_error($is_json)){
492
  $this->errors->add('form-validation', $is_json->get_error_message(), 'wp_all_import_plugin');
493
+ } else {
 
 
494
  $xml_data = wp_all_import_json_to_xml( json_decode($json_str, true) );
495
+ if ( empty($xml_data) ) {
 
496
  $this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'wp_all_import_plugin'));
497
+ } else {
 
498
  $tmpname = $this->uploadsPath .'/'. wp_all_import_url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($filePath))));
499
  file_put_contents($tmpname, $xml_data);
500
  wp_all_import_remove_source($filePath, false);
502
  }
503
  }
504
  break;
505
+ case 'sql':
506
+ include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php' );
 
 
507
  $sql = new PMXI_SQLParser( $filePath, $this->uploadsPath );
508
+ $filePath = $sql->parse();
 
509
  break;
510
  default:
511
  # code...
512
  break;
513
  }
 
514
  }
515
  else $this->errors->add('form-validation', $fileInfo->get_error_message());
516
  }
522
 
523
  $templateOptions = "";
524
 
525
+ if ( is_array($decodedTemplates) and ! empty($decodedTemplates)) {
 
526
  $templateOptions = empty($decodedTemplates[0]) ? current($decodedTemplates) : $decodedTemplates;
527
  }
528
 
641
  'xml' => $filePath
642
  );
643
  }
644
+ }
645
  }
config/options.php CHANGED
@@ -25,8 +25,7 @@ $config = array(
25
  "session_mode" => 'default',
26
  "enable_ftp_import" => 0,
27
  "large_feed_limit" => 1000,
28
- //"enable_cron_processing_time_limit" => 0,
29
- "cron_processing_time_limit" => 120,
30
  "secure" => 1,
31
  "log_storage" => 5,
32
  "cron_sleep" => "",
25
  "session_mode" => 'default',
26
  "enable_ftp_import" => 0,
27
  "large_feed_limit" => 1000,
28
+ "cron_processing_time_limit" => 59,
 
29
  "secure" => 1,
30
  "log_storage" => 5,
31
  "cron_sleep" => "",
controllers/admin/import.php CHANGED
@@ -121,7 +121,12 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
121
  'show_hidden_cpt' => 0,
122
  'feed_type' => '',
123
  'url' => '',
124
- 'ftp' => array('url' => 'ftp://'),
 
 
 
 
 
125
  'file' => '',
126
  'reimport' => '',
127
  'is_update_previous' => $id ? 1 : 0,
@@ -131,7 +136,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
131
  'root_element' => '',
132
  'downloaded' => '',
133
  'auto_generate' => 0,
134
- 'template' => false
 
135
  );
136
 
137
  if ($parent_import and ! $parent_import_record->getById($parent_import)->isEmpty()){
121
  'show_hidden_cpt' => 0,
122
  'feed_type' => '',
123
  'url' => '',
124
+ 'ftp_host' => '',
125
+ 'ftp_path' => '',
126
+ 'ftp_port' => '21',
127
+ 'ftp_username' => '',
128
+ 'ftp_password' => '',
129
+ 'ftp_private_key' => '',
130
  'file' => '',
131
  'reimport' => '',
132
  'is_update_previous' => $id ? 1 : 0,
136
  'root_element' => '',
137
  'downloaded' => '',
138
  'auto_generate' => 0,
139
+ 'template' => false ,
140
+ 'taxonomy_type' => ''
141
  );
142
 
143
  if ($parent_import and ! $parent_import_record->getById($parent_import)->isEmpty()){
controllers/admin/manage.php CHANGED
@@ -36,7 +36,11 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
36
 
37
  if ( ! in_array($order, array('DESC', 'ASC'))){
38
  $order = 'DESC';
39
- }
 
 
 
 
40
 
41
  $list = new PMXI_Import_List();
42
  $post = new PMXI_Post_Record();
@@ -70,22 +74,18 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
70
  /**
71
  * delete all posts, media, files, and whatever value was in the 'Unique ID' field
72
  */
73
- public function delete_and_edit()
74
- {
75
  $get = $this->input->get(array(
76
  'id' => '',
77
  ));
78
- if ( ! empty($get['id']) )
79
- {
80
  $import = new PMXI_Import_Record();
81
  $import->getById($get['id']);
82
- if ( ! $import->isEmpty() )
83
- {
84
  $import->deletePosts(false);
85
  $options = $import->options;
86
- if ( empty($import->options['custom_type']) || $import->options['custom_type'] != 'shop_order')
87
- {
88
- $options['unique_key'] = '';
89
  }
90
  $import->set(array(
91
  'options' => $options,
@@ -94,19 +94,42 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
94
  'updated' => 0,
95
  'skipped' => 0,
96
  'deleted' => 0
97
- ))->save();
98
  }
99
  }
100
- if ( ! empty($import->options['custom_type']) && $import->options['custom_type'] == 'shop_order')
101
- {
102
  wp_redirect(add_query_arg(array('id' => $import->id, 'action' => 'edit'), $this->baseUrl)); die();
 
 
103
  }
104
- else
105
- {
106
- wp_redirect(add_query_arg(array('id' => $import->id, 'action' => 'options'), $this->baseUrl)); die();
107
- }
108
  }
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  /**
111
  * Edit Template
112
  */
@@ -267,7 +290,7 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
267
 
268
  }
269
  }
270
-
271
  /**
272
  * Cron Scheduling
273
  */
@@ -351,7 +374,7 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
351
  $history->setColumns('id', 'name', 'registered_on', 'path')->getBy(array('import_id' => $item->id), 'id DESC');
352
  if ($history->count()){
353
  foreach ($history as $file){
354
- if (@file_exists(wp_all_import_get_absolute_path($file['path']))) {
355
  $this->data['locfilePath'] = wp_all_import_get_absolute_path($file['path']);
356
  break;
357
  }
36
 
37
  if ( ! in_array($order, array('DESC', 'ASC'))){
38
  $order = 'DESC';
39
+ }
40
+
41
+ if ( in_array($order_by, array('name'))){
42
+ $order_by = 'friendly_name ' . $order . ', name';
43
+ }
44
 
45
  $list = new PMXI_Import_List();
46
  $post = new PMXI_Post_Record();
74
  /**
75
  * delete all posts, media, files, and whatever value was in the 'Unique ID' field
76
  */
77
+ public function delete_and_edit() {
 
78
  $get = $this->input->get(array(
79
  'id' => '',
80
  ));
81
+ if ( ! empty($get['id']) ) {
 
82
  $import = new PMXI_Import_Record();
83
  $import->getById($get['id']);
84
+ if ( ! $import->isEmpty() ) {
 
85
  $import->deletePosts(false);
86
  $options = $import->options;
87
+ if ( empty($import->options['custom_type']) || $import->options['custom_type'] != 'shop_order') {
88
+ $options['unique_key'] = '';
 
89
  }
90
  $import->set(array(
91
  'options' => $options,
94
  'updated' => 0,
95
  'skipped' => 0,
96
  'deleted' => 0
97
+ ))->save();
98
  }
99
  }
100
+ if ( ! empty($import->options['custom_type']) && $import->options['custom_type'] == 'shop_order') {
 
101
  wp_redirect(add_query_arg(array('id' => $import->id, 'action' => 'edit'), $this->baseUrl)); die();
102
+ } else {
103
+ wp_redirect(add_query_arg(array('id' => $import->id, 'action' => 'options'), $this->baseUrl)); die();
104
  }
 
 
 
 
105
  }
106
 
107
+ /**
108
+ * Disable `Skip posts if their data in your file has not changed` option.
109
+ */
110
+ public function disable_skip_posts() {
111
+ $get = $this->input->get(array(
112
+ 'id' => '',
113
+ ));
114
+ if ( ! empty($get['id']) ) {
115
+ $import = new PMXI_Import_Record();
116
+ $import->getById($get['id']);
117
+ if ( ! $import->isEmpty() ) {
118
+ $options = $import->options;
119
+ $options['is_selective_hashing'] = 0;
120
+ $import->set(array(
121
+ 'options' => $options,
122
+ 'imported' => 0,
123
+ 'created' => 0,
124
+ 'updated' => 0,
125
+ 'skipped' => 0,
126
+ 'deleted' => 0
127
+ ))->save();
128
+ }
129
+ wp_redirect(add_query_arg(array('id' => $import->id, 'action' => 'update'), $this->baseUrl)); die();
130
+ }
131
+ }
132
+
133
  /**
134
  * Edit Template
135
  */
290
 
291
  }
292
  }
293
+
294
  /**
295
  * Cron Scheduling
296
  */
374
  $history->setColumns('id', 'name', 'registered_on', 'path')->getBy(array('import_id' => $item->id), 'id DESC');
375
  if ($history->count()){
376
  foreach ($history as $file){
377
+ if (@file_exists(wp_all_import_get_absolute_path($file['path']))) {
378
  $this->data['locfilePath'] = wp_all_import_get_absolute_path($file['path']);
379
  break;
380
  }
controllers/admin/settings.php CHANGED
@@ -476,7 +476,7 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
476
  // Clean the fileName for security reasons
477
  $fileName = preg_replace('/[^\w\._]+/', '_', $fileName);
478
 
479
- if ( ! preg_match('%\W(xml|gzip|zip|csv|gz|json|txt|dat|psv|sql|xls|xlsx)$%i', trim(basename($fileName)))) {
480
  exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 100, "message" => __("Uploaded file must be XML, CSV, ZIP, GZIP, GZ, JSON, SQL, TXT, DAT or PSV", "wp_all_import_plugin")), "id" => "id")));
481
  }
482
 
476
  // Clean the fileName for security reasons
477
  $fileName = preg_replace('/[^\w\._]+/', '_', $fileName);
478
 
479
+ if ( ! preg_match('%\W(xml|gzip|zip|csv|tsv|gz|json|txt|dat|psv|sql|xls|xlsx)$%i', trim(basename($fileName)))) {
480
  exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 100, "message" => __("Uploaded file must be XML, CSV, ZIP, GZIP, GZ, JSON, SQL, TXT, DAT or PSV", "wp_all_import_plugin")), "id" => "id")));
481
  }
482
 
controllers/controller/admin.php CHANGED
@@ -30,17 +30,17 @@ abstract class PMXI_Controller_Admin extends PMXI_Controller {
30
 
31
  $url = $p_url['scheme'] . '://' . $p_url['host'];
32
 
33
- if (!empty($_POST['is_settings_submitted'])) { // save settings form
34
  $input = new PMXI_Input();
35
  $post = $input->post(array(
36
  'port' => ''
37
- ));
38
  PMXI_Plugin::getInstance()->updateOption($post);
39
  }
40
 
41
  $port = PMXI_Plugin::getInstance()->getOption('port');
42
 
43
- if ( ! empty($port) and is_numeric($port) ){
44
  $url .= ':' . $port;
45
  }
46
  else{
@@ -126,6 +126,11 @@ abstract class PMXI_Controller_Admin extends PMXI_Controller {
126
 
127
  public function add_admin_scripts() {
128
  $cm_settings['codeEditor'] = wp_enqueue_code_editor(['type' => 'php']);
 
 
 
 
 
129
  wp_localize_script('pmxi-admin-script', 'wpai_cm_settings', $cm_settings);
130
  }
131
 
30
 
31
  $url = $p_url['scheme'] . '://' . $p_url['host'];
32
 
33
+ if (!empty($_POST['is_settings_submitted'])) { // save settings form
34
  $input = new PMXI_Input();
35
  $post = $input->post(array(
36
  'port' => ''
37
+ ));
38
  PMXI_Plugin::getInstance()->updateOption($post);
39
  }
40
 
41
  $port = PMXI_Plugin::getInstance()->getOption('port');
42
 
43
+ if ( ! empty($port) and is_numeric($port) ){
44
  $url .= ':' . $port;
45
  }
46
  else{
126
 
127
  public function add_admin_scripts() {
128
  $cm_settings['codeEditor'] = wp_enqueue_code_editor(['type' => 'php']);
129
+
130
+ // Use our modified function if user has disabled the syntax editor.
131
+ if(false === $cm_settings['codeEditor']){
132
+ $cm_settings['codeEditor'] = wpai_wp_enqueue_code_editor(['type' => 'php']);
133
+ }
134
  wp_localize_script('pmxi-admin-script', 'wpai_cm_settings', $cm_settings);
135
  }
136
 
filters/pmxi_custom_types.php CHANGED
@@ -1,28 +1,27 @@
1
  <?php
2
-
 
 
 
3
  function pmxi_pmxi_custom_types($custom_types) {
4
  if ( class_exists('WooCommerce') ) {
5
- $custom_types['reviews'] = new stdClass();
6
- $custom_types['reviews']->labels = new stdClass();
7
- $custom_types['reviews']->labels->name = __('WooCommerce Reviews', PMXI_Plugin::LANGUAGE_DOMAIN);
8
  }
9
  if ( class_exists('WooCommerce') && ! class_exists('PMWI_Plugin') ) {
10
  if ( ! empty($custom_types['product']) ) $custom_types['product']->labels->name = __('WooCommerce Products','wp_all_import_plugin');
11
  if ( ! empty($custom_types['shop_order']) ) $custom_types['shop_order']->labels->name = __('WooCommerce Orders','wp_all_import_plugin');
12
- if ( ! empty($custom_types['shop_coupon'])) $custom_types['shop_coupon']->labels->name = __('WooCommerce Coupons','wp_all_import_plugin');
13
- if ( ! empty($custom_types['product_variation'])) unset($custom_types['product_variation']);
14
- if ( ! empty($custom_types['shop_order_refund'])) unset($custom_types['shop_order_refund']);
15
-
16
- $order = array('shop_order', 'shop_coupon', 'product');
17
-
18
- $ordered_custom_types = array();
19
 
 
 
20
  foreach ($order as $type) {
21
  if (isset($ordered_custom_types[$type])) continue;
22
-
23
  foreach ($custom_types as $key => $custom_type) {
24
  if (isset($ordered_custom_types[$key])) continue;
25
-
26
  if (in_array($key, $order)) {
27
  if ($key == $type) {
28
  $ordered_custom_types[$key] = $custom_type;
@@ -34,6 +33,5 @@ function pmxi_pmxi_custom_types($custom_types) {
34
  }
35
  return $ordered_custom_types;
36
  }
37
-
38
  return $custom_types;
39
  }
1
  <?php
2
+ /**
3
+ * @param $custom_types
4
+ * @return array
5
+ */
6
  function pmxi_pmxi_custom_types($custom_types) {
7
  if ( class_exists('WooCommerce') ) {
8
+ $custom_types['woo_reviews'] = new stdClass();
9
+ $custom_types['woo_reviews']->labels = new stdClass();
10
+ $custom_types['woo_reviews']->labels->name = __('WooCommerce Reviews', PMXI_Plugin::LANGUAGE_DOMAIN);
11
  }
12
  if ( class_exists('WooCommerce') && ! class_exists('PMWI_Plugin') ) {
13
  if ( ! empty($custom_types['product']) ) $custom_types['product']->labels->name = __('WooCommerce Products','wp_all_import_plugin');
14
  if ( ! empty($custom_types['shop_order']) ) $custom_types['shop_order']->labels->name = __('WooCommerce Orders','wp_all_import_plugin');
15
+ if ( ! empty($custom_types['shop_coupon']) ) $custom_types['shop_coupon']->labels->name = __('WooCommerce Coupons','wp_all_import_plugin');
16
+ if ( ! empty($custom_types['product_variation']) ) unset($custom_types['product_variation']);
17
+ if ( ! empty($custom_types['shop_order_refund']) ) unset($custom_types['shop_order_refund']);
 
 
 
 
18
 
19
+ $order = [ 'shop_order', 'shop_coupon', 'product' ];
20
+ $ordered_custom_types = [];
21
  foreach ($order as $type) {
22
  if (isset($ordered_custom_types[$type])) continue;
 
23
  foreach ($custom_types as $key => $custom_type) {
24
  if (isset($ordered_custom_types[$key])) continue;
 
25
  if (in_array($key, $order)) {
26
  if ($key == $type) {
27
  $ordered_custom_types[$key] = $custom_type;
33
  }
34
  return $ordered_custom_types;
35
  }
 
36
  return $custom_types;
37
  }
helpers/functions.php CHANGED
@@ -1,5 +1,79 @@
1
  <?php
2
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  if ( ! function_exists('pmxi_if') ) {
4
  function pmxi_if( $left_condition, $operand = '', $right_condition = '', $then, $else = '' ) {
5
  $str = trim(implode(' ', array($left_condition, html_entity_decode($operand), $right_condition)));
@@ -213,3 +287,22 @@
213
  }
214
  }
215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ if( !function_exists('wpai_wp_enqueue_code_editor')){
3
+ function wpai_wp_enqueue_code_editor( $args ) {
4
+
5
+ // We need syntax highlighting to work in the plugin regardless of user setting.
6
+ // Function matches https://developer.wordpress.org/reference/functions/wp_enqueue_code_editor/ otherwise.
7
+ /*if ( is_user_logged_in() && 'false' === wp_get_current_user()->syntax_highlighting ) {
8
+ return false;
9
+ }*/
10
+
11
+ $settings = wp_get_code_editor_settings( $args );
12
+
13
+ if ( empty( $settings ) || empty( $settings['codemirror'] ) ) {
14
+ return false;
15
+ }
16
+
17
+ wp_enqueue_script( 'code-editor' );
18
+ wp_enqueue_style( 'code-editor' );
19
+
20
+ if ( isset( $settings['codemirror']['mode'] ) ) {
21
+ $mode = $settings['codemirror']['mode'];
22
+ if ( is_string( $mode ) ) {
23
+ $mode = array(
24
+ 'name' => $mode,
25
+ );
26
+ }
27
+
28
+ if ( ! empty( $settings['codemirror']['lint'] ) ) {
29
+ switch ( $mode['name'] ) {
30
+ case 'css':
31
+ case 'text/css':
32
+ case 'text/x-scss':
33
+ case 'text/x-less':
34
+ wp_enqueue_script( 'csslint' );
35
+ break;
36
+ case 'htmlmixed':
37
+ case 'text/html':
38
+ case 'php':
39
+ case 'application/x-httpd-php':
40
+ case 'text/x-php':
41
+ wp_enqueue_script( 'htmlhint' );
42
+ wp_enqueue_script( 'csslint' );
43
+ wp_enqueue_script( 'jshint' );
44
+ if ( ! current_user_can( 'unfiltered_html' ) ) {
45
+ wp_enqueue_script( 'htmlhint-kses' );
46
+ }
47
+ break;
48
+ case 'javascript':
49
+ case 'application/ecmascript':
50
+ case 'application/json':
51
+ case 'application/javascript':
52
+ case 'application/ld+json':
53
+ case 'text/typescript':
54
+ case 'application/typescript':
55
+ wp_enqueue_script( 'jshint' );
56
+ wp_enqueue_script( 'jsonlint' );
57
+ break;
58
+ }
59
+ }
60
+ }
61
+
62
+ wp_add_inline_script( 'code-editor', sprintf( 'jQuery.extend( wp.codeEditor.defaultSettings, %s );', wp_json_encode( $settings ) ) );
63
+
64
+ /**
65
+ * Fires when scripts and styles are enqueued for the code editor.
66
+ *
67
+ * @since 4.9.0
68
+ *
69
+ * @param array $settings Settings for the enqueued code editor.
70
+ */
71
+ do_action( 'wp_enqueue_code_editor', $settings );
72
+
73
+ return $settings;
74
+ }
75
+ }
76
+
77
  if ( ! function_exists('pmxi_if') ) {
78
  function pmxi_if( $left_condition, $operand = '', $right_condition = '', $then, $else = '' ) {
79
  $str = trim(implode(' ', array($left_condition, html_entity_decode($operand), $right_condition)));
287
  }
288
  }
289
 
290
+ if ( ! function_exists('wp_all_import_generate_functions_hash') ) {
291
+ function wp_all_import_generate_functions_hash() {
292
+ $uploads = wp_upload_dir();
293
+ $functions_hash = false;
294
+ $functions_file = $uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php';
295
+ if (@file_exists($functions_file)) {
296
+ $functions_hash = hash_file('md5', $functions_file);
297
+ // Check functions file from current theme.
298
+ $theme_functions_file = get_template_directory() . '/functions.php';
299
+ if (@file_exists($theme_functions_file)) {
300
+ $functions_hash .= hash_file('md5', $theme_functions_file);
301
+ }
302
+ }
303
+ return $functions_hash;
304
+ }
305
+ }
306
+
307
+
308
+
helpers/pmxi_findDuplicates.php CHANGED
@@ -4,104 +4,112 @@
4
  * Find duplicates according to settings
5
  */
6
  function pmxi_findDuplicates($articleData, $custom_duplicate_name = '', $custom_duplicate_value = '', $duplicate_indicator = 'title', $indicator_value = '') {
 
7
  global $wpdb;
8
 
9
  if ('custom field' == $duplicate_indicator) {
10
-
11
- $duplicate_ids = array();
12
-
13
  if (!empty($articleData['post_type'])) {
14
-
15
  switch ($articleData['post_type']) {
16
-
17
  case 'taxonomies':
18
- $args = array(
19
  'hide_empty' => FALSE,
20
  // also retrieve terms which are not used yet
21
- 'meta_query' => array(
22
- array(
23
  'key' => $custom_duplicate_name,
24
  'value' => $custom_duplicate_value,
25
  'compare' => '='
26
- )
27
- )
28
- );
29
-
30
  $terms = get_terms($articleData['taxonomy'], $args);
31
-
32
  if (!empty($terms) && !is_wp_error($terms)) {
33
  foreach ($terms as $term) {
34
  $duplicate_ids[] = $term->term_id;
35
  }
36
  }
37
-
38
  break;
39
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  default:
41
-
42
- $post_types = (class_exists('PMWI_Plugin') and $articleData['post_type'] == 'product') ? array(
43
  'product',
44
  'product_variation'
45
- ) : array($articleData['post_type']);
46
-
47
- $sql = $wpdb->prepare("SELECT " . $wpdb->posts . ".ID FROM " . $wpdb->posts . " INNER JOIN " . $wpdb->postmeta . " ON ( " . $wpdb->posts . ".ID = " . $wpdb->postmeta . ".post_id ) WHERE 1=1 AND ( ( " . $wpdb->postmeta . ".meta_key = %s AND (" . $wpdb->postmeta . ".meta_value = %s OR " . $wpdb->postmeta . ".meta_value = %s OR REPLACE(REPLACE(REPLACE(" . $wpdb->postmeta . ".meta_value, ' ', ''), '\\t', ''), '\\n', '') = %s) ) ) AND " . $wpdb->posts . ".post_type IN ('" . implode("','", $post_types) . "') AND ((" . $wpdb->posts . ".post_status <> 'trash' AND " . $wpdb->posts . ".post_status <> 'auto-draft')) GROUP BY " . $wpdb->posts . ".ID ORDER BY " . $wpdb->posts . ".ID ASC LIMIT 0, 15", trim($custom_duplicate_name), trim($custom_duplicate_value), htmlspecialchars(trim($custom_duplicate_value)), preg_replace('%[ \\t\\n]%', '', trim($custom_duplicate_value)));
48
-
49
- $query = $wpdb->get_results($sql);
50
-
51
- if (!empty($query)) {
52
- foreach ($query as $p) {
53
- $duplicate_ids[] = $p->ID;
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
55
  }
56
 
57
- if (empty($duplicate_ids)) {
58
-
59
- $query = $wpdb->get_results($wpdb->prepare("SELECT " . $wpdb->posts . ".ID FROM " . $wpdb->posts . " INNER JOIN " . $wpdb->postmeta . " ON (" . $wpdb->posts . ".ID = " . $wpdb->postmeta . ".post_id) WHERE 1=1 AND " . $wpdb->posts . ".post_type IN ('" . implode("','", $post_types) . "') AND (" . $wpdb->posts . ".post_status = 'publish' OR " . $wpdb->posts . ".post_status = 'future' OR " . $wpdb->posts . ".post_status = 'draft' OR " . $wpdb->posts . ".post_status = 'pending' OR " . $wpdb->posts . ".post_status = 'trash' OR " . $wpdb->posts . ".post_status = 'private') AND ( (" . $wpdb->postmeta . ".meta_key = '%s' AND (" . $wpdb->postmeta . ".meta_value = '%s' OR " . $wpdb->postmeta . ".meta_value = '%s' OR " . $wpdb->postmeta . ".meta_value = '%s') ) ) GROUP BY " . $wpdb->posts . ".ID ORDER BY " . $wpdb->posts . ".ID ASC LIMIT 0, 20", trim($custom_duplicate_name), trim($custom_duplicate_value), htmlspecialchars(trim($custom_duplicate_value)), esc_attr(trim($custom_duplicate_value))));
60
-
61
- if (!empty($query)) {
62
- foreach ($query as $p) {
63
- $duplicate_ids[] = $p->ID;
64
- }
65
- }
66
  }
67
  break;
68
  }
69
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  }
71
- else {
72
-
73
- $args = array(
74
- 'meta_query' => array(
75
- 0 => array(
76
- 'key' => $custom_duplicate_name,
77
- 'value' => $custom_duplicate_value,
78
- 'compare' => '='
79
- )
80
- )
81
- );
82
- $user_query = new WP_User_Query($args);
83
-
84
- if (!empty($user_query->results)) {
85
- foreach ($user_query->results as $user) {
86
- $duplicate_ids[] = $user->ID;
87
- }
88
- }
89
- else {
90
- $query = $wpdb->get_results($wpdb->prepare("SELECT SQL_CALC_FOUND_ROWS " . $wpdb->users . ".ID FROM " . $wpdb->users . " INNER JOIN " . $wpdb->usermeta . " ON (" . $wpdb->users . ".ID = " . $wpdb->usermeta . ".user_id) WHERE 1=1 AND ( (" . $wpdb->usermeta . ".meta_key = '%s' AND " . $wpdb->usermeta . ".meta_value = '%s') ) GROUP BY " . $wpdb->users . ".ID ORDER BY " . $wpdb->users . ".ID ASC LIMIT 0, 20", $custom_duplicate_name, $custom_duplicate_value));
91
-
92
- if (!empty($query)) {
93
- foreach ($query as $p) {
94
- $duplicate_ids[] = $p->ID;
95
- }
96
- }
97
- }
98
- }
99
-
100
  return $duplicate_ids;
101
-
102
- }
103
- elseif ('parent' == $duplicate_indicator) {
104
-
105
  $field = 'post_title'; // post_title or post_content
106
  return $wpdb->get_col($wpdb->prepare("
107
  SELECT ID FROM " . $wpdb->posts . "
@@ -116,9 +124,7 @@ function pmxi_findDuplicates($articleData, $custom_duplicate_name = '', $custom_
116
  (!empty($articleData['post_parent'])) ? $articleData['post_parent'] : 0,
117
  preg_replace('%[ \\t\\n]%', '', $articleData[$field])
118
  ));
119
- }
120
- else {
121
-
122
  if (!empty($articleData['post_type'])) {
123
  switch ($articleData['post_type']) {
124
  case 'taxonomies':
@@ -143,6 +149,18 @@ function pmxi_findDuplicates($articleData, $custom_duplicate_name = '', $custom_
143
  preg_replace('%[ \\t\\n]%', '', $indicator_value)
144
  ));
145
  break;
 
 
 
 
 
 
 
 
 
 
 
 
146
  default:
147
  $field = 'post_' . $duplicate_indicator; // post_title or post_content
148
  return $wpdb->get_col($wpdb->prepare("
@@ -158,14 +176,12 @@ function pmxi_findDuplicates($articleData, $custom_duplicate_name = '', $custom_
158
  ));
159
  break;
160
  }
161
- }
162
- else {
163
  if ($duplicate_indicator == 'title') {
164
  $field = 'user_login';
165
  $u = get_user_by('login', $articleData[$field]);
166
  return (!empty($u)) ? array($u->ID) : FALSE;
167
- }
168
- else {
169
  $field = 'user_email';
170
  $u = get_user_by('email', $articleData[$field]);
171
  return (!empty($u)) ? array($u->ID) : FALSE;
4
  * Find duplicates according to settings
5
  */
6
  function pmxi_findDuplicates($articleData, $custom_duplicate_name = '', $custom_duplicate_value = '', $duplicate_indicator = 'title', $indicator_value = '') {
7
+
8
  global $wpdb;
9
 
10
  if ('custom field' == $duplicate_indicator) {
11
+ $duplicate_ids = [];
 
 
12
  if (!empty($articleData['post_type'])) {
 
13
  switch ($articleData['post_type']) {
 
14
  case 'taxonomies':
15
+ $args = [
16
  'hide_empty' => FALSE,
17
  // also retrieve terms which are not used yet
18
+ 'meta_query' => [
19
+ [
20
  'key' => $custom_duplicate_name,
21
  'value' => $custom_duplicate_value,
22
  'compare' => '='
23
+ ]
24
+ ]
25
+ ];
 
26
  $terms = get_terms($articleData['taxonomy'], $args);
 
27
  if (!empty($terms) && !is_wp_error($terms)) {
28
  foreach ($terms as $term) {
29
  $duplicate_ids[] = $term->term_id;
30
  }
31
  }
 
32
  break;
33
+ case 'woo_reviews':
34
+ case 'comments':
35
+ $args = [
36
+ 'hide_empty' => FALSE,
37
+ // also retrieve terms which are not used yet
38
+ 'meta_query' => [
39
+ [
40
+ 'key' => $custom_duplicate_name,
41
+ 'value' => $custom_duplicate_value,
42
+ 'compare' => '='
43
+ ]
44
+ ]
45
+ ];
46
+ $comments = get_comments($args);
47
+ if (!empty($comments) && !is_wp_error($comments)) {
48
+ foreach ($comments as $comment) {
49
+ $duplicate_ids[] = $comment->comment_ID;
50
+ }
51
+ }
52
+ break;
53
  default:
54
+ $post_types = (class_exists('PMWI_Plugin') and $articleData['post_type'] == 'product') ? [
 
55
  'product',
56
  'product_variation'
57
+ ] : [$articleData['post_type']];
58
+
59
+ // We should search for the product ID to update using the native WooCommerce function.
60
+ if (trim($custom_duplicate_name) == '_sku' && function_exists('wc_get_product_id_by_sku')) {
61
+ $id = wc_get_product_id_by_sku(trim($custom_duplicate_value));
62
+ } else {
63
+ $id = $wpdb->get_var(
64
+ $wpdb->prepare(
65
+ "
66
+ SELECT posts.ID
67
+ FROM {$wpdb->posts} as posts
68
+ INNER JOIN {$wpdb->postmeta} AS lookup ON posts.ID = lookup.post_id
69
+ WHERE
70
+ posts.post_type IN ( '" . implode("','", $post_types) . "' )
71
+ AND lookup.meta_key = %s
72
+ AND lookup.meta_value = %s
73
+ LIMIT 1
74
+ ",
75
+ trim($custom_duplicate_name),
76
+ trim($custom_duplicate_value)
77
+ )
78
+ );
79
  }
80
 
81
+ if ($id) {
82
+ $duplicate_ids[] = $id;
 
 
 
 
 
 
 
83
  }
84
  break;
85
  }
86
+ } else {
87
+ $args = [
88
+ 'meta_query' => [
89
+ 0 => [
90
+ 'key' => $custom_duplicate_name,
91
+ 'value' => $custom_duplicate_value,
92
+ 'compare' => '='
93
+ ]
94
+ ]
95
+ ];
96
+ $user_query = new WP_User_Query($args);
97
+
98
+ if (!empty($user_query->results)) {
99
+ foreach ($user_query->results as $user) {
100
+ $duplicate_ids[] = $user->ID;
101
+ }
102
+ } else {
103
+ $query = $wpdb->get_results($wpdb->prepare("SELECT SQL_CALC_FOUND_ROWS " . $wpdb->users . ".ID FROM " . $wpdb->users . " INNER JOIN " . $wpdb->usermeta . " ON (" . $wpdb->users . ".ID = " . $wpdb->usermeta . ".user_id) WHERE 1=1 AND ( (" . $wpdb->usermeta . ".meta_key = '%s' AND " . $wpdb->usermeta . ".meta_value = '%s') ) GROUP BY " . $wpdb->users . ".ID ORDER BY " . $wpdb->users . ".ID ASC LIMIT 0, 20", $custom_duplicate_name, $custom_duplicate_value));
104
+ if (!empty($query)) {
105
+ foreach ($query as $p) {
106
+ $duplicate_ids[] = $p->ID;
107
+ }
108
+ }
109
+ }
110
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  return $duplicate_ids;
112
+ } elseif ('parent' == $duplicate_indicator) {
 
 
 
113
  $field = 'post_title'; // post_title or post_content
114
  return $wpdb->get_col($wpdb->prepare("
115
  SELECT ID FROM " . $wpdb->posts . "
124
  (!empty($articleData['post_parent'])) ? $articleData['post_parent'] : 0,
125
  preg_replace('%[ \\t\\n]%', '', $articleData[$field])
126
  ));
127
+ } else {
 
 
128
  if (!empty($articleData['post_type'])) {
129
  switch ($articleData['post_type']) {
130
  case 'taxonomies':
149
  preg_replace('%[ \\t\\n]%', '', $indicator_value)
150
  ));
151
  break;
152
+ case 'comments':
153
+ $field = 'comment_' . $duplicate_indicator; // post_title or post_content
154
+ return $wpdb->get_col($wpdb->prepare("
155
+ SELECT comment_ID FROM " . $wpdb->comments . "
156
+ WHERE
157
+ AND comment_ID != %s
158
+ AND REPLACE(REPLACE(REPLACE($field, ' ', ''), '\\t', ''), '\\n', '') = %s
159
+ ",
160
+ isset($articleData['ID']) ? $articleData['ID'] : 0,
161
+ preg_replace('%[ \\t\\n]%', '', $articleData[$field])
162
+ ));
163
+ break;
164
  default:
165
  $field = 'post_' . $duplicate_indicator; // post_title or post_content
166
  return $wpdb->get_col($wpdb->prepare("
176
  ));
177
  break;
178
  }
179
+ } else {
 
180
  if ($duplicate_indicator == 'title') {
181
  $field = 'user_login';
182
  $u = get_user_by('login', $articleData[$field]);
183
  return (!empty($u)) ? array($u->ID) : FALSE;
184
+ } else {
 
185
  $field = 'user_email';
186
  $u = get_user_by('email', $articleData[$field]);
187
  return (!empty($u)) ? array($u->ID) : FALSE;
helpers/wp_all_import_get_image_from_gallery.php CHANGED
@@ -76,9 +76,6 @@ function wp_all_import_get_image_from_gallery($image_name, $targetDir = FALSE, $
76
  }
77
  }
78
  }
79
- if (empty($attch)) {
80
- @unlink($targetDir . DIRECTORY_SEPARATOR . $original_image_name);
81
- }
82
  }
83
 
84
  return apply_filters('wp_all_import_get_image_from_gallery', $attch, $original_image_name, $targetDir);
76
  }
77
  }
78
  }
 
 
 
79
  }
80
 
81
  return apply_filters('wp_all_import_get_image_from_gallery', $attch, $original_image_name, $targetDir);
helpers/wp_all_import_rmdir.php CHANGED
@@ -1,13 +1,15 @@
1
  <?php
2
  function wp_all_import_rmdir($dir) {
3
- $scanned_files = @scandir($dir);
4
- if (!empty($scanned_files) and is_array($scanned_files)){
5
- $files = array_diff($scanned_files, array('.','..'));
6
- if (!empty($files)){
7
- foreach ($files as $file) {
8
- (is_dir("$dir/$file")) ? wp_all_import_rmdir("$dir/$file") : @unlink("$dir/$file");
9
- }
10
- }
11
- return @rmdir($dir);
12
- }
 
 
13
  }
1
  <?php
2
  function wp_all_import_rmdir($dir) {
3
+ if (@file_exists($dir)) {
4
+ $scanned_files = @scandir($dir);
5
+ if (!empty($scanned_files) and is_array($scanned_files)){
6
+ $files = array_diff($scanned_files, array('.','..'));
7
+ if (!empty($files)){
8
+ foreach ($files as $file) {
9
+ (is_dir("$dir/$file")) ? wp_all_import_rmdir("$dir/$file") : @unlink("$dir/$file");
10
+ }
11
+ }
12
+ return @rmdir($dir);
13
+ }
14
+ }
15
  }
helpers/wp_all_import_url_title.php CHANGED
@@ -1,15 +1,11 @@
1
  <?php
2
  if ( ! function_exists('wp_all_import_url_title')){
3
 
4
- function wp_all_import_url_title($str, $separator = 'dash', $lowercase = FALSE)
5
- {
6
- if ($separator == 'dash')
7
- {
8
  $search = '_';
9
  $replace = '-';
10
- }
11
- else
12
- {
13
  $search = '-';
14
  $replace = '_';
15
  }
@@ -27,13 +23,11 @@ if ( ! function_exists('wp_all_import_url_title')){
27
 
28
  $str = strip_tags($str);
29
 
30
- foreach ($trans as $key => $val)
31
- {
32
  $str = preg_replace("#".$key."#i", $val, $str);
33
  }
34
 
35
- if ($lowercase === TRUE)
36
- {
37
  $str = strtolower($str);
38
  }
39
 
1
  <?php
2
  if ( ! function_exists('wp_all_import_url_title')){
3
 
4
+ function wp_all_import_url_title($str, $separator = 'dash', $lowercase = FALSE) {
5
+ if ($separator == 'dash') {
 
 
6
  $search = '_';
7
  $replace = '-';
8
+ } else {
 
 
9
  $search = '-';
10
  $replace = '_';
11
  }
23
 
24
  $str = strip_tags($str);
25
 
26
+ foreach ($trans as $key => $val) {
 
27
  $str = preg_replace("#".$key."#i", $val, $str);
28
  }
29
 
30
+ if ($lowercase === TRUE) {
 
31
  $str = strtolower($str);
32
  }
33
 
helpers/wp_delete_attachments.php CHANGED
@@ -3,7 +3,7 @@
3
  * Delete attachments linked to a specified post
4
  * @param int $parent_id Parent id of post to delete attachments for
5
  */
6
- function wp_delete_attachments($parent_id, $unlink = true, $type = 'images') {
7
 
8
  $ids = array();
9
 
3
  * Delete attachments linked to a specified post
4
  * @param int $parent_id Parent id of post to delete attachments for
5
  */
6
+ function wp_delete_attachments($parent_id, $unlink = true, $type = 'images') {
7
 
8
  $ids = array();
9
 
libraries/XmlImportCsvParse.php CHANGED
@@ -72,16 +72,15 @@ class PMXI_CsvParser
72
  * @see load()
73
  * @return void
74
  */
75
- public function __construct( $options = array('filename' => null, 'xpath' => '', 'delimiter' => '', 'encoding' => '', 'xml_path' => '', 'targetDir' => false) )
76
- {
77
  PMXI_Plugin::$csv_path = $options['filename'];
78
 
79
  $this->xpath = (!empty($options['xpath']) ? $options['xpath'] : ((!empty($_POST['xpath'])) ? $_POST['xpath'] : '/node'));
80
 
81
  if ( ! empty($options['delimiter']) ){
82
  $this->delimiter = $options['delimiter'];
83
- }
84
- else{
85
  $input = new PMXI_Input();
86
  $id = $input->get('id', 0);
87
  if (!$id){
@@ -91,7 +90,7 @@ class PMXI_CsvParser
91
  $import = new PMXI_Import_Record();
92
  $import->getbyId($id);
93
  if ( ! $import->isEmpty() ){
94
- $this->delimiter = $import->options['delimiter'];
95
  }
96
  }
97
  }
@@ -1021,7 +1020,9 @@ class PMXI_CsvParser
1021
  if (!empty($keys)) {
1022
  $chunk = array();
1023
  foreach ($this->headers as $key => $header) {
1024
- $chunk[$header] = $this->fixEncoding( $keys[$key] );
 
 
1025
  }
1026
  if ( ! empty($chunk) ) {
1027
  $xmlWriter->startElement('node');
72
  * @see load()
73
  * @return void
74
  */
75
+ public function __construct( $options = array('filename' => null, 'xpath' => '', 'delimiter' => '', 'encoding' => '', 'xml_path' => '', 'targetDir' => false) ) {
76
+
77
  PMXI_Plugin::$csv_path = $options['filename'];
78
 
79
  $this->xpath = (!empty($options['xpath']) ? $options['xpath'] : ((!empty($_POST['xpath'])) ? $_POST['xpath'] : '/node'));
80
 
81
  if ( ! empty($options['delimiter']) ){
82
  $this->delimiter = $options['delimiter'];
83
+ } else {
 
84
  $input = new PMXI_Input();
85
  $id = $input->get('id', 0);
86
  if (!$id){
90
  $import = new PMXI_Import_Record();
91
  $import->getbyId($id);
92
  if ( ! $import->isEmpty() ){
93
+ $this->delimiter = empty($import->options['delimiter']) ? '' : $import->options['delimiter'];
94
  }
95
  }
96
  }
1020
  if (!empty($keys)) {
1021
  $chunk = array();
1022
  foreach ($this->headers as $key => $header) {
1023
+ if(isset($keys[$key])) {
1024
+ $chunk[ $header ] = $this->fixEncoding( $keys[ $key ] );
1025
+ }
1026
  }
1027
  if ( ! empty($chunk) ) {
1028
  $xmlWriter->startElement('node');
models/import/record.php CHANGED
@@ -289,17 +289,14 @@ class PMXI_Import_Record extends PMXI_Model_Record {
289
  $post_author = XmlImportParser::factory($xml, $cxpath, $this->options['author'], $file)->parse($records); $tmp_files[] = $file;
290
  foreach ($post_author as $key => $author) {
291
  $user = get_user_by('login', $author) or $user = get_user_by('slug', $author) or $user = get_user_by('email', $author) or ctype_digit($author) and $user = get_user_by('id', $author);
292
- if (!empty($user))
293
- {
294
  $post_author[$key] = $user->ID;
295
- }
296
- else{
297
  if ($current_user->ID){
298
  $post_author[$key] = $current_user->ID;
299
- }
300
- else{
301
  $super_admins = get_super_admins();
302
- if ( ! empty($super_admins)){
303
  $sauthor = array_shift($super_admins);
304
  $user = get_user_by('login', $sauthor) or $user = get_user_by('slug', $sauthor) or $user = get_user_by('email', $sauthor) or ctype_digit($sauthor) and $user = get_user_by('id', $sauthor);
305
  $post_author[$key] = (!empty($user)) ? $user->ID : $current_user->ID;
@@ -307,22 +304,19 @@ class PMXI_Import_Record extends PMXI_Model_Record {
307
  }
308
  }
309
  }
310
- }
311
- else{
312
- if ($current_user->ID){
313
  count($titles) and $post_author = array_fill(0, count($titles), $current_user->ID);
314
- }
315
- else{
316
  $super_admins = get_super_admins();
317
- if ( ! empty($super_admins)){
318
  $author = array_shift($super_admins);
319
  $user = get_user_by('login', $author) or $user = get_user_by('slug', $author) or $user = get_user_by('email', $author) or ctype_digit($author) and $user = get_user_by('id', $author);
320
  count($titles) and $post_author = array_fill(0, count($titles), (!empty($user)) ? $user->ID : $current_user->ID);
321
  }
322
  }
323
  }
324
- }
325
- else{
326
  $current_user = wp_get_current_user();
327
  count($titles) and $post_author = array_fill(0, count($titles), $current_user->ID);
328
  }
@@ -412,7 +406,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
412
  $taxonomies = array();
413
  $exclude_taxonomies = apply_filters('pmxi_exclude_taxonomies', (class_exists('PMWI_Plugin')) ? array('post_format', 'product_type', 'product_shipping_class', 'product_visibility') : array('post_format'));
414
  $post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($this->options['custom_type']), 'object'), array_flip($exclude_taxonomies));
415
- if ( $this->is_parsing_required('is_update_categories') && ! empty($post_taxonomies) && ! in_array($this->options['custom_type'], array('import_users', 'taxonomies', 'shop_customer')) ):
416
  foreach ($post_taxonomies as $ctx): if ("" == $ctx->labels->name or (class_exists('PMWI_Plugin') and strpos($ctx->name, "pa_") === 0 and $this->options['custom_type'] == "product")) continue;
417
  $chunk == 1 and $logger and call_user_func($logger, sprintf(__('Composing terms for `%s` taxonomy...', 'wp_all_import_plugin'), $ctx->labels->name));
418
  $tx_name = $ctx->name;
@@ -625,7 +619,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
625
  }
626
  endforeach;
627
  endif;
628
- // [/custom taxonomies]
629
 
630
  // Composing featured images
631
  $image_sections = apply_filters('wp_all_import_image_sections', array(
@@ -732,10 +726,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
732
  // Composing images suffix
733
  $chunk == 1 and $this->options[$section['slug'] . 'auto_rename_images'] and $logger and call_user_func($logger, __('Composing ' . strtolower($section['title']) . ' suffix...', 'wp_all_import_plugin'));
734
  $auto_rename_images = array();
735
- if ( $this->options[$section['slug'] . 'auto_rename_images'] and ! empty($this->options[$section['slug'] . 'auto_rename_images_suffix'])){
736
  $auto_rename_images = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'auto_rename_images_suffix'], $file)->parse($records); $tmp_files[] = $file;
737
- }
738
- else{
739
  count($titles) and $auto_rename_images = array_fill(0, count($titles), '');
740
  }
741
  $auto_rename_images_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $auto_rename_images;
@@ -743,10 +736,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
743
  // Composing images extensions
744
  $chunk == 1 and $this->options[$section['slug'] . 'auto_set_extension'] and $logger and call_user_func($logger, __('Composing ' . strtolower($section['title']) . ' extensions...', 'wp_all_import_plugin'));
745
  $auto_extensions = array();
746
- if ( $this->options[$section['slug'] . 'auto_set_extension'] and ! empty($this->options[$section['slug'] . 'new_extension'])){
747
  $auto_extensions = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'new_extension'], $file)->parse($records); $tmp_files[] = $file;
748
- }
749
- else{
750
  count($titles) and $auto_extensions = array_fill(0, count($titles), '');
751
  }
752
  $auto_extensions_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $auto_extensions;
@@ -769,26 +761,21 @@ class PMXI_Import_Record extends PMXI_Model_Record {
769
  $atchs = empty($this->options['atch_delim']) ? explode(',', $this->options['attachments']) : explode($this->options['atch_delim'], $this->options['attachments']);
770
  if (!empty($atchs)){
771
  $parse_multiple = true;
772
- foreach($atchs as $atch) if (!preg_match("/{.*}/", trim($atch))) $parse_multiple = false;
773
-
774
- if ($parse_multiple)
775
- {
776
- foreach($atchs as $atch)
777
- {
778
  $posts_attachments = XmlImportParser::factory($xml, $cxpath, trim($atch), $file)->parse($records); $tmp_files[] = $file;
779
  foreach($posts_attachments as $i => $val) $attachments[$i][] = $val;
780
  }
781
  }
782
- else
783
- {
784
  $attachments = XmlImportParser::factory($xml, $cxpath, $this->options['attachments'], $file)->parse($records); $tmp_files[] = $file;
785
  }
786
  }
787
-
788
  } else {
789
  count($titles) and $attachments = array_fill(0, count($titles), '');
790
  }
791
- }
792
 
793
  $chunk == 1 and $logger and call_user_func($logger, __('Composing unique keys...', 'wp_all_import_plugin'));
794
  if (!empty($this->options['unique_key'])){
@@ -812,10 +799,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
812
  'logger' => $logger,
813
  'chunk' => $chunk,
814
  'xpath_prefix' => $xpath_prefix
815
- );
816
-
817
  $parse_functions = apply_filters('wp_all_import_addon_parse', array());
818
-
819
  foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
820
  $model_class = str_replace("_Plugin", "_Import_Record", $class);
821
  if (class_exists($model_class)){
@@ -895,7 +880,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
895
  do_action( "pmxi_before_post_import_{$addon}", $data, $i, $this->id );
896
  }
897
 
898
- if ( empty($titles[$i]) && !in_array($this->options['custom_type'], array('shop_order', 'import_users', 'shop_customer')) ) {
899
  if ( ! empty($addons_data['PMWI_Plugin']) and !empty($addons_data['PMWI_Plugin']['single_product_parent_ID'][$i]) ){
900
  $titles[$i] = $addons_data['PMWI_Plugin']['single_product_parent_ID'][$i] . ' Product Variation';
901
  }
@@ -999,7 +984,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
999
  if ( 'shop_coupon' == $post_type[$i] ){
1000
  $articleData['post_excerpt'] = $articleData['post_content'];
1001
  }
1002
- $logger and call_user_func($logger, sprintf(__('Combine all data for post `%s`...', 'wp_all_import_plugin'), $articleData['post_title']));
1003
  // if ( "xpath" == $this->options['status'] )
1004
  // {
1005
  // $status_object = get_post_status_object($post_status[$i]);
@@ -1077,7 +1062,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1077
  $duplicates = array();
1078
  if ('pid' == $this->options['duplicate_indicator']) {
1079
  $duplicate_id = $duplicate_indicator_values[$i];
1080
- if ($duplicate_id && !in_array($this->options['custom_type'], array('import_users', 'shop_customer', 'taxonomies'))) {
1081
  $duplicate_post_type = get_post_type($duplicate_id);
1082
  if ($articleData['post_type'] == 'product' && $duplicate_post_type == 'product_variation') {
1083
  $duplicate_post_type = 'product';
@@ -1106,7 +1091,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1106
  default:
1107
  if (class_exists('WPAI_WPML') && ! empty($this->options['wpml_addon']['lng'])){
1108
  // trying to find needed translation for update
1109
- $duplicate_id = apply_filters('wpml_object_id', $duplicate_id, get_post_type($duplicate_id), true, $this->options['wpml_addon']['lng']);
1110
  }
1111
  $post_to_update = get_post($post_to_update_id = $duplicate_id);
1112
  break;
@@ -1176,13 +1161,13 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1176
  do_action('pmxi_do_not_update_existing', $post_to_update_id, $this->id, $this->iteration, $xml, $i);
1177
 
1178
  $skipped++;
1179
- $logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: Previously imported record found for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1180
  $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
1181
  $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
1182
  $logger and !$is_cron and PMXI_Plugin::$session->save_data();
1183
  do_action('wp_all_import_post_skipped', $post_to_update_id, $this->id, $current_xml_node);
1184
  continue;
1185
- }
1186
 
1187
  // This action fires just before preserving data from previously imported post.
1188
  do_action('wp_all_import_before_preserve_post_data', $this, $post_to_update_id, $articleData);
@@ -1255,7 +1240,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1255
  default:
1256
  // preserve date of already existing article when duplicate is found
1257
  if ( ( ! $this->options['is_update_categories'] and ( is_object_in_taxonomy( $post_type[$i], 'category' ) or is_object_in_taxonomy( $post_type[$i], 'post_tag' ) ) ) or ($this->options['is_update_categories'] and $this->options['update_categories_logic'] != "full_update")) {
1258
- $logger and call_user_func($logger, sprintf(__('Preserve taxonomies of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1259
  $existing_taxonomies = array();
1260
  foreach (array_keys($taxonomies) as $tx_name) {
1261
  $txes_list = get_the_terms($articleData['ID'], $tx_name);
@@ -1277,23 +1262,23 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1277
  if ( ! $this->options['is_update_dates']) { // preserve date of already existing article when duplicate is found
1278
  $articleData['post_date'] = $post_to_update->post_date;
1279
  $articleData['post_date_gmt'] = $post_to_update->post_date_gmt;
1280
- $logger and call_user_func($logger, sprintf(__('Preserve date of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1281
  }
1282
  if ( ! $this->options['is_update_status']) { // preserve status and trashed flag
1283
  $articleData['post_status'] = $post_to_update->post_status;
1284
- $logger and call_user_func($logger, sprintf(__('Preserve status of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1285
  }
1286
  if ( ! $this->options['is_update_content']){
1287
  $articleData['post_content'] = $post_to_update->post_content;
1288
- $logger and call_user_func($logger, sprintf(__('Preserve content of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1289
  }
1290
  if ( ! $this->options['is_update_title']){
1291
  $articleData['post_title'] = $post_to_update->post_title;
1292
- $logger and call_user_func($logger, sprintf(__('Preserve title of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1293
  }
1294
  if ( ! $this->options['is_update_slug']){
1295
  $articleData['post_name'] = $post_to_update->post_name;
1296
- $logger and call_user_func($logger, sprintf(__('Preserve slug of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1297
  }
1298
  // Check for changed slugs for published post objects and save the old slug.
1299
  if( ! empty($articleData['post_name']) and $articleData['post_name'] != $post_to_update->post_name)
@@ -1313,31 +1298,31 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1313
 
1314
  if ( ! $this->options['is_update_excerpt']){
1315
  $articleData['post_excerpt'] = $post_to_update->post_excerpt;
1316
- $logger and call_user_func($logger, sprintf(__('Preserve excerpt of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1317
  }
1318
  if ( ! $this->options['is_update_menu_order']){
1319
  $articleData['menu_order'] = $post_to_update->menu_order;
1320
- $logger and call_user_func($logger, sprintf(__('Preserve menu order of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1321
  }
1322
  if ( ! $this->options['is_update_parent']){
1323
  $articleData['post_parent'] = $post_to_update->post_parent;
1324
- $logger and call_user_func($logger, sprintf(__('Preserve post parent of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1325
  }
1326
  if ( ! $this->options['is_update_post_type']){
1327
  $articleData['post_type'] = $post_to_update->post_type;
1328
- $logger and call_user_func($logger, sprintf(__('Preserve post type of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1329
  }
1330
  if ( ! $this->options['is_update_comment_status']){
1331
  $articleData['comment_status'] = $post_to_update->comment_status;
1332
- $logger and call_user_func($logger, sprintf(__('Preserve comment status of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1333
  }
1334
  if ( ! $this->options['is_update_ping_status']){
1335
  $articleData['ping_status'] = $post_to_update->ping_status;
1336
- $logger and call_user_func($logger, sprintf(__('Preserve ping status of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1337
  }
1338
  if ( ! $this->options['is_update_author']){
1339
  $articleData['post_author'] = $post_to_update->post_author;
1340
- $logger and call_user_func($logger, sprintf(__('Preserve post author of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1341
  }
1342
  if ( ! wp_all_import_is_update_cf('_wp_page_template', $this->options) ){
1343
  $articleData['page_template'] = get_post_meta($post_to_update_id, '_wp_page_template', true);
@@ -1380,15 +1365,14 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1380
  case 'shop_customer':
1381
 
1382
  break;
1383
-
1384
  default:
1385
  if ($this->options['update_all_data'] == 'yes' or ($this->options['update_all_data'] == 'no' and $this->options['is_update_attachments'])) {
1386
- $logger and call_user_func($logger, sprintf(__('Deleting attachments for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1387
  wp_delete_attachments($articleData['ID'], ! $this->options['is_search_existing_attach'], 'files');
1388
  }
1389
  // handle obsolete attachments (i.e. delete or keep) according to import settings
1390
  if ($this->options['update_all_data'] == 'yes' or ($this->options['update_all_data'] == 'no' and $this->options['is_update_images'] and $this->options['update_images_logic'] == "full_update")) {
1391
- $logger and call_user_func($logger, sprintf(__('Deleting images for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1392
  if (!empty($images_bundle)) {
1393
  foreach ($images_bundle as $slug => $bundle_data) {
1394
  $option_slug = ($slug == 'pmxi_gallery_image') ? '' : $slug;
@@ -1519,7 +1503,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1519
 
1520
  if ( ! $continue_import ){
1521
  $skipped++;
1522
- $logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: By filter wp_all_import_is_post_to_create `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
1523
  $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
1524
  $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
1525
  $logger and !$is_cron and PMXI_Plugin::$session->save_data();
@@ -1639,13 +1623,12 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1639
  $articleData['post_title'] = $articleData['user_login'];
1640
 
1641
  break;
1642
-
1643
  default:
1644
  if (empty($articleData['ID'])){
1645
- $logger and call_user_func($logger, sprintf(__('<b>CREATING</b> `%s` `%s`', 'wp_all_import_plugin'), $articleData['post_title'], $custom_type_details->labels->singular_name));
1646
  }
1647
  else{
1648
- $logger and call_user_func($logger, sprintf(__('<b>UPDATING</b> `%s` `%s`', 'wp_all_import_plugin'), $articleData['post_title'], $custom_type_details->labels->singular_name));
1649
  }
1650
  $pid = (empty($articleData['ID'])) ? wp_insert_post($articleData, true) : wp_update_post($articleData, true);
1651
  break;
@@ -1695,13 +1678,13 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1695
 
1696
  $postRecord->set($postRecordData)->update();
1697
 
1698
- $logger and call_user_func($logger, sprintf(__('Associate post `%s` with current import ...', 'wp_all_import_plugin'), $articleData['post_title']));
1699
  }
1700
 
1701
  // [post format]
1702
  if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type[$i], 'post-formats' ) ){
1703
  set_post_format($pid, ("xpath" == $this->options['post_format']) ? $post_format[$i] : $this->options['post_format'] );
1704
- $logger and call_user_func($logger, sprintf(__('Associate post `%s` with post format %s ...', 'wp_all_import_plugin'), $articleData['post_title'], ("xpath" == $this->options['post_format']) ? $post_format[$i] : $this->options['post_format']));
1705
  }
1706
  // [/post format]
1707
 
@@ -1717,7 +1700,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1717
  'is_cron' => $is_cron,
1718
  'logger' => $logger,
1719
  'xpath_prefix' => $xpath_prefix,
1720
- 'post_type' => $post_type[$i]
 
1721
  );
1722
 
1723
  $import_functions = apply_filters('wp_all_import_addon_import', array());
@@ -1740,11 +1724,11 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1740
 
1741
  // Page Template
1742
  global $wp_version;
1743
- if ( ! empty($articleData['post_type']) && !in_array($articleData['post_type'], array('taxonomies', 'comments', 'reviews')) && ('page' == $articleData['post_type'] || version_compare($wp_version, '4.7.0', '>=')) && wp_all_import_is_update_cf('_wp_page_template', $this->options) && ( !empty($this->options['page_template']) || "no" == $this->options['is_multiple_page_template']) ){
1744
  update_post_meta($pid, '_wp_page_template', ("no" == $this->options['is_multiple_page_template']) ? $page_template[$i] : $this->options['page_template']);
1745
  }
1746
 
1747
- // [featured image]
1748
 
1749
  $featuredImage = false;
1750
  $is_allow_import_images = apply_filters('wp_all_import_is_allow_import_images', false, empty($articleData['post_type']) ? '' : $articleData['post_type']);
@@ -1849,8 +1833,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1849
  if ($attch) {
1850
  $attid = $attch->ID;
1851
  $logger and call_user_func($logger, sprintf(__('- Existing image was found for post content `%s`...', 'wp_all_import_plugin'), rawurldecode($image)));
1852
- }
1853
- else {
1854
 
1855
  if ($this->options['search_existing_images']) {
1856
  $logger and call_user_func($logger, sprintf(__('- Image `%s` was not found...', 'wp_all_import_plugin'), rawurldecode($image)));
@@ -2097,7 +2080,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2097
  if ($img_ext == "") $img_ext = pmxi_get_remote_image_ext($url);
2098
  }
2099
 
2100
- $logger and call_user_func($logger, sprintf(__('- Importing image `%s` for `%s` ...', 'wp_all_import_plugin'), $img_url, $articleData['post_title']));
2101
 
2102
  // generate local file name
2103
  $image_name = urldecode(($this->options[$option_slug . 'auto_rename_images'] and !empty($auto_rename_images_bundle[$slug][$i])) ? sanitize_file_name(($img_ext) ? str_replace("." . $default_extension, "", $auto_rename_images_bundle[$slug][$i]) : $auto_rename_images_bundle[$slug][$i]) : (($img_ext) ? str_replace("." . $default_extension, "", $bn) : $bn)) . (("" != $img_ext) ? '.' . $img_ext : '');
@@ -2127,7 +2110,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2127
  $logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: Image %s not found in media gallery.', 'wp_all_import_plugin'), trim($image_name)));
2128
  }
2129
  else {
2130
- $logger and call_user_func($logger, sprintf(__('- Using existing image `%s` for post `%s` ...', 'wp_all_import_plugin'), trim($image_name), $articleData['post_title']));
2131
  $download_image = false;
2132
  $create_image = false;
2133
  $attid = $attch->ID;
@@ -2310,7 +2293,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2310
  $file_mime_type = '';
2311
 
2312
  if ($bundle_data['type'] == 'images') {
2313
- if ( ! empty($image_info) ) {
2314
  $file_mime_type = image_type_to_mime_type($image_info[2]);
2315
  }
2316
  $file_mime_type = apply_filters('wp_all_import_image_mime_type', $file_mime_type, $image_filepath);
@@ -2324,7 +2307,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2324
  'url' => $targetUrl . '/' . $image_filename,
2325
  'type' => $file_mime_type
2326
  ));
2327
-
2328
  $attid = $this->createAttachment($pid, $handle_image, $image_name, $post_author[$i], $post_type[$i], $is_cron, $logger, $bundle_data['type']);
2329
 
2330
  // save image into images table
@@ -2425,30 +2408,29 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2425
 
2426
  // Create entry as Draft if no images are downloaded successfully
2427
  $final_post_type = get_post_type($pid);
2428
- if ( ! $success_images and "yes" == $this->options[$option_slug . 'create_draft'] and $final_post_type != 'product_variation' and ! in_array($post_type[$i], array('taxonomies', 'comments', 'reviews'))) {
2429
  $this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $pid) );
2430
- $logger and call_user_func($logger, sprintf(__('- Post `%s` saved as Draft, because no images are downloaded successfully', 'wp_all_import_plugin'), $articleData['post_title']));
2431
  }
2432
  }
2433
  }
2434
  else{
2435
  // Create entry as Draft if no images are downloaded successfully
2436
  $final_post_type = get_post_type($pid);
2437
- if ( "yes" == $this->options[$option_slug . 'create_draft'] and $final_post_type != 'product_variation' and ! in_array($post_type[$i], array('taxonomies', 'comments', 'reviews'))){
2438
  $this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $pid) );
2439
- $logger and call_user_func($logger, sprintf(__('Post `%s` saved as Draft, because no images are downloaded successfully', 'wp_all_import_plugin'), $articleData['post_title']));
2440
  }
2441
  }
2442
 
2443
- if ( $this->options[$option_slug . "do_not_remove_images"] ){
2444
  do_action("wpallimport_after_images_import", $pid, $gallery_attachment_ids, $missing_images);
2445
  }
2446
  }
2447
  }
2448
- }
2449
- else
2450
- {
2451
- if ( ! empty($images_bundle) ){
2452
 
2453
  foreach ($images_bundle as $slug => $bundle_data) {
2454
 
@@ -2483,7 +2465,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2483
 
2484
  if ( ! $is_images_to_update )
2485
  {
2486
- $logger and call_user_func($logger, sprintf(__('Images import skipped for post `%s` according to \'pmxi_is_images_to_update\' filter...', 'wp_all_import_plugin'), $articleData['post_title']));
2487
  }
2488
  // [/featured image]
2489
 
@@ -2509,7 +2491,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2509
 
2510
  if ( ! is_array($attachments[$i]) ) $attachments[$i] = array($attachments[$i]);
2511
 
2512
- $logger and call_user_func($logger, sprintf(__('- Importing attachments for `%s` ...', 'wp_all_import_plugin'), $articleData['post_title']));
2513
 
2514
  foreach ($attachments[$i] as $attachment) { if ("" == $attachment) continue;
2515
 
@@ -2537,7 +2519,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2537
  $download_file = false;
2538
  $create_file = false;
2539
  $attach_id = $attch->ID;
2540
- $logger and call_user_func($logger, sprintf(__('- Using existing file `%s` for post `%s` ...', 'wp_all_import_plugin'), trim($attachment_filename), $articleData['post_title']));
2541
  }
2542
 
2543
  // search existing attachment in files folder
@@ -2611,7 +2593,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2611
  $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
2612
  } else {
2613
  wp_update_attachment_metadata($attach_id, wp_generate_attachment_metadata($attach_id, $handle_attachment['file']));
2614
- $logger and call_user_func($logger, sprintf(__('- Attachment has been successfully created for post `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
2615
  $logger and call_user_func($logger, __('- <b>ACTION</b>: pmxi_attachment_uploaded', 'wp_all_import_plugin'));
2616
  do_action( 'pmxi_attachment_uploaded', $pid, $attach_id, $handle_attachment['file']);
2617
  }
@@ -2647,7 +2629,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2647
 
2648
  if ( ! $is_attachments_to_update )
2649
  {
2650
- $logger and call_user_func($logger, sprintf(__('Attachments import skipped for post `%s` according to \'pmxi_is_attachments_to_update\' filter...', 'wp_all_import_plugin'), $articleData['post_title']));
2651
  }
2652
  // [/attachments]
2653
 
@@ -2785,15 +2767,15 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2785
  // [/custom taxonomies]
2786
 
2787
  if (empty($articleData['ID'])) {
2788
- $logger and call_user_func($logger, sprintf(__('<b>CREATED</b> `%s` `%s` (ID: %s)', 'wp_all_import_plugin'), $articleData['post_title'], $custom_type_details->labels->singular_name, $pid));
2789
  } else {
2790
- $logger and call_user_func($logger, sprintf(__('<b>UPDATED</b> `%s` `%s` (ID: %s)', 'wp_all_import_plugin'), $articleData['post_title'], $custom_type_details->labels->singular_name, $pid));
2791
  }
2792
 
2793
  $is_update = ! empty($articleData['ID']);
2794
 
2795
  // fire important hooks after custom fields are added
2796
- if ( ! $this->options['is_fast_mode'] and ! in_array($this->options['custom_type'], array('import_users', 'shop_customer', 'taxonomies', 'comments', 'reviews'))){
2797
  $_post = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM {$this->wpdb->posts} WHERE ID = %d LIMIT 1", $pid ) );
2798
  $_post = sanitize_post( $_post, 'raw' );
2799
  $post_object = new WP_Post( $_post );
@@ -2921,7 +2903,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2921
  $title = $articleData['user_login'];
2922
  break;
2923
  case 'comments':
2924
- case 'reviews':
2925
  $title = wp_trim_words($articleData['comment_content'], 10);
2926
  break;
2927
  default:
@@ -2946,23 +2928,20 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2946
  if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($url, false, $get_ctx))) {
2947
  $logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s can not be downloaded, response %s', 'wp_all_import_plugin'), $url, maybe_serialize($request)));
2948
  @unlink($image_filepath); // delete file since failed upload may result in empty file created
2949
- } else{
2950
-
2951
- if($type == 'images'){
2952
- if( preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath)) or $file_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath) and in_array($file_info[2], wp_all_import_supported_image_types())) {
2953
  $downloaded = true;
2954
  if (preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath))){
2955
  $file_info = true;
2956
  }
2957
  $logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
2958
- }
2959
- else
2960
- {
2961
  $logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'wp_all_import_plugin'), $url));
2962
  $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
 
2963
  }
2964
- }
2965
- elseif($type == 'files'){
2966
  if( $file_info = wp_check_filetype(wp_all_import_basename($image_filepath), null )) {
2967
  $downloaded = true;
2968
  $logger and call_user_func($logger, sprintf(__('- File `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
@@ -2996,7 +2975,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2996
 
2997
  remove_all_actions('add_attachment');
2998
 
2999
- if ( in_array($post_type, array('taxonomies', 'comments', 'reviews')) ){
3000
  $attid = wp_insert_attachment($attachment, $handle_image['file'], 0);
3001
  }
3002
  else{
@@ -3211,12 +3190,12 @@ class PMXI_Import_Record extends PMXI_Model_Record {
3211
  }
3212
  }
3213
 
3214
- if ( PMXI_Plugin::is_ajax() and "ajax" == $this->options['import_processing']) break;
3215
  }
3216
 
3217
  do_action('wp_all_import_skipped_from_deleted', $skipp_from_deletion, $this);
3218
 
3219
- return (count($missing_ids_arr) > 1 and "ajax" == $this->options['import_processing']) ? false : true;
3220
  }
3221
  }
3222
 
@@ -3394,7 +3373,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
3394
 
3395
  protected function deleteRecords( $is_delete_attachments, $is_deleted_images, $ids = array() ) {
3396
  foreach ( $ids as $k => $id ) {
3397
- if ( ! in_array($this->options['custom_type'], array('import_users', 'taxonomies', 'shop_customer', 'comments', 'reviews')) ){
3398
  do_action('pmxi_before_delete_post', $id, $this);
3399
  // Remove attachments.
3400
  if ($is_delete_attachments == 'yes' or $is_delete_attachments == 'auto' and empty($this->options['is_keep_attachments'])) {
289
  $post_author = XmlImportParser::factory($xml, $cxpath, $this->options['author'], $file)->parse($records); $tmp_files[] = $file;
290
  foreach ($post_author as $key => $author) {
291
  $user = get_user_by('login', $author) or $user = get_user_by('slug', $author) or $user = get_user_by('email', $author) or ctype_digit($author) and $user = get_user_by('id', $author);
292
+ if (!empty($user)) {
 
293
  $post_author[$key] = $user->ID;
294
+ } else {
 
295
  if ($current_user->ID){
296
  $post_author[$key] = $current_user->ID;
297
+ } else {
 
298
  $super_admins = get_super_admins();
299
+ if ( ! empty($super_admins) ) {
300
  $sauthor = array_shift($super_admins);
301
  $user = get_user_by('login', $sauthor) or $user = get_user_by('slug', $sauthor) or $user = get_user_by('email', $sauthor) or ctype_digit($sauthor) and $user = get_user_by('id', $sauthor);
302
  $post_author[$key] = (!empty($user)) ? $user->ID : $current_user->ID;
304
  }
305
  }
306
  }
307
+ } else {
308
+ if ($current_user->ID) {
 
309
  count($titles) and $post_author = array_fill(0, count($titles), $current_user->ID);
310
+ } else {
 
311
  $super_admins = get_super_admins();
312
+ if ( ! empty($super_admins) ) {
313
  $author = array_shift($super_admins);
314
  $user = get_user_by('login', $author) or $user = get_user_by('slug', $author) or $user = get_user_by('email', $author) or ctype_digit($author) and $user = get_user_by('id', $author);
315
  count($titles) and $post_author = array_fill(0, count($titles), (!empty($user)) ? $user->ID : $current_user->ID);
316
  }
317
  }
318
  }
319
+ } else {
 
320
  $current_user = wp_get_current_user();
321
  count($titles) and $post_author = array_fill(0, count($titles), $current_user->ID);
322
  }
406
  $taxonomies = array();
407
  $exclude_taxonomies = apply_filters('pmxi_exclude_taxonomies', (class_exists('PMWI_Plugin')) ? array('post_format', 'product_type', 'product_shipping_class', 'product_visibility') : array('post_format'));
408
  $post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($this->options['custom_type']), 'object'), array_flip($exclude_taxonomies));
409
+ if ( $this->is_parsing_required('is_update_categories') && ! empty($post_taxonomies) && ! in_array($this->options['custom_type'], array('import_users', 'taxonomies', 'shop_customer', 'comments', 'woo_reviews')) ):
410
  foreach ($post_taxonomies as $ctx): if ("" == $ctx->labels->name or (class_exists('PMWI_Plugin') and strpos($ctx->name, "pa_") === 0 and $this->options['custom_type'] == "product")) continue;
411
  $chunk == 1 and $logger and call_user_func($logger, sprintf(__('Composing terms for `%s` taxonomy...', 'wp_all_import_plugin'), $ctx->labels->name));
412
  $tx_name = $ctx->name;
619
  }
620
  endforeach;
621
  endif;
622
+ // [/custom taxonomies]
623
 
624
  // Composing featured images
625
  $image_sections = apply_filters('wp_all_import_image_sections', array(
726
  // Composing images suffix
727
  $chunk == 1 and $this->options[$section['slug'] . 'auto_rename_images'] and $logger and call_user_func($logger, __('Composing ' . strtolower($section['title']) . ' suffix...', 'wp_all_import_plugin'));
728
  $auto_rename_images = array();
729
+ if ( $this->options[$section['slug'] . 'auto_rename_images'] and ! empty($this->options[$section['slug'] . 'auto_rename_images_suffix']) && $this->options['download_images'] !== 'gallery') {
730
  $auto_rename_images = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'auto_rename_images_suffix'], $file)->parse($records); $tmp_files[] = $file;
731
+ } else {
 
732
  count($titles) and $auto_rename_images = array_fill(0, count($titles), '');
733
  }
734
  $auto_rename_images_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $auto_rename_images;
736
  // Composing images extensions
737
  $chunk == 1 and $this->options[$section['slug'] . 'auto_set_extension'] and $logger and call_user_func($logger, __('Composing ' . strtolower($section['title']) . ' extensions...', 'wp_all_import_plugin'));
738
  $auto_extensions = array();
739
+ if ( $this->options[$section['slug'] . 'auto_set_extension'] and ! empty($this->options[$section['slug'] . 'new_extension']) && $this->options['download_images'] !== 'gallery') {
740
  $auto_extensions = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'new_extension'], $file)->parse($records); $tmp_files[] = $file;
741
+ } else {
 
742
  count($titles) and $auto_extensions = array_fill(0, count($titles), '');
743
  }
744
  $auto_extensions_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $auto_extensions;
761
  $atchs = empty($this->options['atch_delim']) ? explode(',', $this->options['attachments']) : explode($this->options['atch_delim'], $this->options['attachments']);
762
  if (!empty($atchs)){
763
  $parse_multiple = true;
764
+ foreach($atchs as $atch) if (!preg_match("/{.*}/", trim($atch))) $parse_multiple = false;
765
+ if ($parse_multiple) {
766
+ foreach($atchs as $atch) {
 
 
 
767
  $posts_attachments = XmlImportParser::factory($xml, $cxpath, trim($atch), $file)->parse($records); $tmp_files[] = $file;
768
  foreach($posts_attachments as $i => $val) $attachments[$i][] = $val;
769
  }
770
  }
771
+ else {
 
772
  $attachments = XmlImportParser::factory($xml, $cxpath, $this->options['attachments'], $file)->parse($records); $tmp_files[] = $file;
773
  }
774
  }
 
775
  } else {
776
  count($titles) and $attachments = array_fill(0, count($titles), '');
777
  }
778
+ }
779
 
780
  $chunk == 1 and $logger and call_user_func($logger, __('Composing unique keys...', 'wp_all_import_plugin'));
781
  if (!empty($this->options['unique_key'])){
799
  'logger' => $logger,
800
  'chunk' => $chunk,
801
  'xpath_prefix' => $xpath_prefix
802
+ );
 
803
  $parse_functions = apply_filters('wp_all_import_addon_parse', array());
 
804
  foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
805
  $model_class = str_replace("_Plugin", "_Import_Record", $class);
806
  if (class_exists($model_class)){
880
  do_action( "pmxi_before_post_import_{$addon}", $data, $i, $this->id );
881
  }
882
 
883
+ if ( empty($titles[$i]) && !in_array($this->options['custom_type'], array('shop_order', 'import_users', 'shop_customer', 'comments', 'woo_reviews')) ) {
884
  if ( ! empty($addons_data['PMWI_Plugin']) and !empty($addons_data['PMWI_Plugin']['single_product_parent_ID'][$i]) ){
885
  $titles[$i] = $addons_data['PMWI_Plugin']['single_product_parent_ID'][$i] . ' Product Variation';
886
  }
984
  if ( 'shop_coupon' == $post_type[$i] ){
985
  $articleData['post_excerpt'] = $articleData['post_content'];
986
  }
987
+ $logger and call_user_func($logger, sprintf(__('Combine all data for post `%s`...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
988
  // if ( "xpath" == $this->options['status'] )
989
  // {
990
  // $status_object = get_post_status_object($post_status[$i]);
1062
  $duplicates = array();
1063
  if ('pid' == $this->options['duplicate_indicator']) {
1064
  $duplicate_id = $duplicate_indicator_values[$i];
1065
+ if ($duplicate_id && !in_array($this->options['custom_type'], array('import_users', 'shop_customer', 'taxonomies', 'comments', 'woo_reviews'))) {
1066
  $duplicate_post_type = get_post_type($duplicate_id);
1067
  if ($articleData['post_type'] == 'product' && $duplicate_post_type == 'product_variation') {
1068
  $duplicate_post_type = 'product';
1091
  default:
1092
  if (class_exists('WPAI_WPML') && ! empty($this->options['wpml_addon']['lng'])){
1093
  // trying to find needed translation for update
1094
+ $duplicate_id = apply_filters('wpml_object_id', $duplicate_id, get_post_type($duplicate_id), false, $this->options['wpml_addon']['lng']);
1095
  }
1096
  $post_to_update = get_post($post_to_update_id = $duplicate_id);
1097
  break;
1161
  do_action('pmxi_do_not_update_existing', $post_to_update_id, $this->id, $this->iteration, $xml, $i);
1162
 
1163
  $skipped++;
1164
+ $logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: Previously imported record found for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1165
  $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
1166
  $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
1167
  $logger and !$is_cron and PMXI_Plugin::$session->save_data();
1168
  do_action('wp_all_import_post_skipped', $post_to_update_id, $this->id, $current_xml_node);
1169
  continue;
1170
+ }
1171
 
1172
  // This action fires just before preserving data from previously imported post.
1173
  do_action('wp_all_import_before_preserve_post_data', $this, $post_to_update_id, $articleData);
1240
  default:
1241
  // preserve date of already existing article when duplicate is found
1242
  if ( ( ! $this->options['is_update_categories'] and ( is_object_in_taxonomy( $post_type[$i], 'category' ) or is_object_in_taxonomy( $post_type[$i], 'post_tag' ) ) ) or ($this->options['is_update_categories'] and $this->options['update_categories_logic'] != "full_update")) {
1243
+ $logger and call_user_func($logger, sprintf(__('Preserve taxonomies of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1244
  $existing_taxonomies = array();
1245
  foreach (array_keys($taxonomies) as $tx_name) {
1246
  $txes_list = get_the_terms($articleData['ID'], $tx_name);
1262
  if ( ! $this->options['is_update_dates']) { // preserve date of already existing article when duplicate is found
1263
  $articleData['post_date'] = $post_to_update->post_date;
1264
  $articleData['post_date_gmt'] = $post_to_update->post_date_gmt;
1265
+ $logger and call_user_func($logger, sprintf(__('Preserve date of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1266
  }
1267
  if ( ! $this->options['is_update_status']) { // preserve status and trashed flag
1268
  $articleData['post_status'] = $post_to_update->post_status;
1269
+ $logger and call_user_func($logger, sprintf(__('Preserve status of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1270
  }
1271
  if ( ! $this->options['is_update_content']){
1272
  $articleData['post_content'] = $post_to_update->post_content;
1273
+ $logger and call_user_func($logger, sprintf(__('Preserve content of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1274
  }
1275
  if ( ! $this->options['is_update_title']){
1276
  $articleData['post_title'] = $post_to_update->post_title;
1277
+ $logger and call_user_func($logger, sprintf(__('Preserve title of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1278
  }
1279
  if ( ! $this->options['is_update_slug']){
1280
  $articleData['post_name'] = $post_to_update->post_name;
1281
+ $logger and call_user_func($logger, sprintf(__('Preserve slug of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1282
  }
1283
  // Check for changed slugs for published post objects and save the old slug.
1284
  if( ! empty($articleData['post_name']) and $articleData['post_name'] != $post_to_update->post_name)
1298
 
1299
  if ( ! $this->options['is_update_excerpt']){
1300
  $articleData['post_excerpt'] = $post_to_update->post_excerpt;
1301
+ $logger and call_user_func($logger, sprintf(__('Preserve excerpt of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1302
  }
1303
  if ( ! $this->options['is_update_menu_order']){
1304
  $articleData['menu_order'] = $post_to_update->menu_order;
1305
+ $logger and call_user_func($logger, sprintf(__('Preserve menu order of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1306
  }
1307
  if ( ! $this->options['is_update_parent']){
1308
  $articleData['post_parent'] = $post_to_update->post_parent;
1309
+ $logger and call_user_func($logger, sprintf(__('Preserve post parent of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1310
  }
1311
  if ( ! $this->options['is_update_post_type']){
1312
  $articleData['post_type'] = $post_to_update->post_type;
1313
+ $logger and call_user_func($logger, sprintf(__('Preserve post type of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1314
  }
1315
  if ( ! $this->options['is_update_comment_status']){
1316
  $articleData['comment_status'] = $post_to_update->comment_status;
1317
+ $logger and call_user_func($logger, sprintf(__('Preserve comment status of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1318
  }
1319
  if ( ! $this->options['is_update_ping_status']){
1320
  $articleData['ping_status'] = $post_to_update->ping_status;
1321
+ $logger and call_user_func($logger, sprintf(__('Preserve ping status of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1322
  }
1323
  if ( ! $this->options['is_update_author']){
1324
  $articleData['post_author'] = $post_to_update->post_author;
1325
+ $logger and call_user_func($logger, sprintf(__('Preserve post author of already existing article for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1326
  }
1327
  if ( ! wp_all_import_is_update_cf('_wp_page_template', $this->options) ){
1328
  $articleData['page_template'] = get_post_meta($post_to_update_id, '_wp_page_template', true);
1365
  case 'shop_customer':
1366
 
1367
  break;
 
1368
  default:
1369
  if ($this->options['update_all_data'] == 'yes' or ($this->options['update_all_data'] == 'no' and $this->options['is_update_attachments'])) {
1370
+ $logger and call_user_func($logger, sprintf(__('Deleting attachments for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1371
  wp_delete_attachments($articleData['ID'], ! $this->options['is_search_existing_attach'], 'files');
1372
  }
1373
  // handle obsolete attachments (i.e. delete or keep) according to import settings
1374
  if ($this->options['update_all_data'] == 'yes' or ($this->options['update_all_data'] == 'no' and $this->options['is_update_images'] and $this->options['update_images_logic'] == "full_update")) {
1375
+ $logger and call_user_func($logger, sprintf(__('Deleting images for `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1376
  if (!empty($images_bundle)) {
1377
  foreach ($images_bundle as $slug => $bundle_data) {
1378
  $option_slug = ($slug == 'pmxi_gallery_image') ? '' : $slug;
1503
 
1504
  if ( ! $continue_import ){
1505
  $skipped++;
1506
+ $logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: By filter wp_all_import_is_post_to_create `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1507
  $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
1508
  $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
1509
  $logger and !$is_cron and PMXI_Plugin::$session->save_data();
1623
  $articleData['post_title'] = $articleData['user_login'];
1624
 
1625
  break;
 
1626
  default:
1627
  if (empty($articleData['ID'])){
1628
+ $logger and call_user_func($logger, sprintf(__('<b>CREATING</b> `%s` `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData), $custom_type_details->labels->singular_name));
1629
  }
1630
  else{
1631
+ $logger and call_user_func($logger, sprintf(__('<b>UPDATING</b> `%s` `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData), $custom_type_details->labels->singular_name));
1632
  }
1633
  $pid = (empty($articleData['ID'])) ? wp_insert_post($articleData, true) : wp_update_post($articleData, true);
1634
  break;
1678
 
1679
  $postRecord->set($postRecordData)->update();
1680
 
1681
+ $logger and call_user_func($logger, sprintf(__('Associate post `%s` with current import ...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
1682
  }
1683
 
1684
  // [post format]
1685
  if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type[$i], 'post-formats' ) ){
1686
  set_post_format($pid, ("xpath" == $this->options['post_format']) ? $post_format[$i] : $this->options['post_format'] );
1687
+ $logger and call_user_func($logger, sprintf(__('Associate post `%s` with post format %s ...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData), ("xpath" == $this->options['post_format']) ? $post_format[$i] : $this->options['post_format']));
1688
  }
1689
  // [/post format]
1690
 
1700
  'is_cron' => $is_cron,
1701
  'logger' => $logger,
1702
  'xpath_prefix' => $xpath_prefix,
1703
+ 'post_type' => $post_type[$i],
1704
+ 'current_xml_node' => $current_xml_node
1705
  );
1706
 
1707
  $import_functions = apply_filters('wp_all_import_addon_import', array());
1724
 
1725
  // Page Template
1726
  global $wp_version;
1727
+ if ( ! empty($articleData['post_type']) && !in_array($articleData['post_type'], array('taxonomies', 'comments', 'woo_reviews')) && ('page' == $articleData['post_type'] || version_compare($wp_version, '4.7.0', '>=')) && wp_all_import_is_update_cf('_wp_page_template', $this->options) && ( !empty($this->options['page_template']) || "no" == $this->options['is_multiple_page_template']) ){
1728
  update_post_meta($pid, '_wp_page_template', ("no" == $this->options['is_multiple_page_template']) ? $page_template[$i] : $this->options['page_template']);
1729
  }
1730
 
1731
+ // [featured image]
1732
 
1733
  $featuredImage = false;
1734
  $is_allow_import_images = apply_filters('wp_all_import_is_allow_import_images', false, empty($articleData['post_type']) ? '' : $articleData['post_type']);
1833
  if ($attch) {
1834
  $attid = $attch->ID;
1835
  $logger and call_user_func($logger, sprintf(__('- Existing image was found for post content `%s`...', 'wp_all_import_plugin'), rawurldecode($image)));
1836
+ } else {
 
1837
 
1838
  if ($this->options['search_existing_images']) {
1839
  $logger and call_user_func($logger, sprintf(__('- Image `%s` was not found...', 'wp_all_import_plugin'), rawurldecode($image)));
2080
  if ($img_ext == "") $img_ext = pmxi_get_remote_image_ext($url);
2081
  }
2082
 
2083
+ $logger and call_user_func($logger, sprintf(__('- Importing image `%s` for `%s` ...', 'wp_all_import_plugin'), $img_url, $this->getRecordTitle($articleData)));
2084
 
2085
  // generate local file name
2086
  $image_name = urldecode(($this->options[$option_slug . 'auto_rename_images'] and !empty($auto_rename_images_bundle[$slug][$i])) ? sanitize_file_name(($img_ext) ? str_replace("." . $default_extension, "", $auto_rename_images_bundle[$slug][$i]) : $auto_rename_images_bundle[$slug][$i]) : (($img_ext) ? str_replace("." . $default_extension, "", $bn) : $bn)) . (("" != $img_ext) ? '.' . $img_ext : '');
2110
  $logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: Image %s not found in media gallery.', 'wp_all_import_plugin'), trim($image_name)));
2111
  }
2112
  else {
2113
+ $logger and call_user_func($logger, sprintf(__('- Using existing image `%s` for post `%s` ...', 'wp_all_import_plugin'), trim($image_name), $this->getRecordTitle($articleData)));
2114
  $download_image = false;
2115
  $create_image = false;
2116
  $attid = $attch->ID;
2293
  $file_mime_type = '';
2294
 
2295
  if ($bundle_data['type'] == 'images') {
2296
+ if ( ! empty($image_info) && is_array($image_info) ) {
2297
  $file_mime_type = image_type_to_mime_type($image_info[2]);
2298
  }
2299
  $file_mime_type = apply_filters('wp_all_import_image_mime_type', $file_mime_type, $image_filepath);
2307
  'url' => $targetUrl . '/' . $image_filename,
2308
  'type' => $file_mime_type
2309
  ));
2310
+
2311
  $attid = $this->createAttachment($pid, $handle_image, $image_name, $post_author[$i], $post_type[$i], $is_cron, $logger, $bundle_data['type']);
2312
 
2313
  // save image into images table
2408
 
2409
  // Create entry as Draft if no images are downloaded successfully
2410
  $final_post_type = get_post_type($pid);
2411
+ if ( ! $success_images and "yes" == $this->options[$option_slug . 'create_draft'] and $final_post_type != 'product_variation' and ! in_array($post_type[$i], array('taxonomies', 'comments', 'woo_reviews'))) {
2412
  $this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $pid) );
2413
+ $logger and call_user_func($logger, sprintf(__('- Post `%s` saved as Draft, because no images are downloaded successfully', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
2414
  }
2415
  }
2416
  }
2417
  else{
2418
  // Create entry as Draft if no images are downloaded successfully
2419
  $final_post_type = get_post_type($pid);
2420
+ if ( "yes" == $this->options[$option_slug . 'create_draft'] and $final_post_type != 'product_variation' and ! in_array($post_type[$i], array('taxonomies', 'comments', 'woo_reviews'))){
2421
  $this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $pid) );
2422
+ $logger and call_user_func($logger, sprintf(__('Post `%s` saved as Draft, because no images are downloaded successfully', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
2423
  }
2424
  }
2425
 
2426
+ if ( $this->options[$option_slug . "download_images"] == 'gallery' or $this->options[$option_slug . "do_not_remove_images"] ){
2427
  do_action("wpallimport_after_images_import", $pid, $gallery_attachment_ids, $missing_images);
2428
  }
2429
  }
2430
  }
2431
+ } else {
2432
+
2433
+ if ( ! empty($images_bundle) ) {
 
2434
 
2435
  foreach ($images_bundle as $slug => $bundle_data) {
2436
 
2465
 
2466
  if ( ! $is_images_to_update )
2467
  {
2468
+ $logger and call_user_func($logger, sprintf(__('Images import skipped for post `%s` according to \'pmxi_is_images_to_update\' filter...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
2469
  }
2470
  // [/featured image]
2471
 
2491
 
2492
  if ( ! is_array($attachments[$i]) ) $attachments[$i] = array($attachments[$i]);
2493
 
2494
+ $logger and call_user_func($logger, sprintf(__('- Importing attachments for `%s` ...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
2495
 
2496
  foreach ($attachments[$i] as $attachment) { if ("" == $attachment) continue;
2497
 
2519
  $download_file = false;
2520
  $create_file = false;
2521
  $attach_id = $attch->ID;
2522
+ $logger and call_user_func($logger, sprintf(__('- Using existing file `%s` for post `%s` ...', 'wp_all_import_plugin'), trim($attachment_filename), $this->getRecordTitle($articleData)));
2523
  }
2524
 
2525
  // search existing attachment in files folder
2593
  $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
2594
  } else {
2595
  wp_update_attachment_metadata($attach_id, wp_generate_attachment_metadata($attach_id, $handle_attachment['file']));
2596
+ $logger and call_user_func($logger, sprintf(__('- Attachment has been successfully created for post `%s`', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
2597
  $logger and call_user_func($logger, __('- <b>ACTION</b>: pmxi_attachment_uploaded', 'wp_all_import_plugin'));
2598
  do_action( 'pmxi_attachment_uploaded', $pid, $attach_id, $handle_attachment['file']);
2599
  }
2629
 
2630
  if ( ! $is_attachments_to_update )
2631
  {
2632
+ $logger and call_user_func($logger, sprintf(__('Attachments import skipped for post `%s` according to \'pmxi_is_attachments_to_update\' filter...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
2633
  }
2634
  // [/attachments]
2635
 
2767
  // [/custom taxonomies]
2768
 
2769
  if (empty($articleData['ID'])) {
2770
+ $logger and call_user_func($logger, sprintf(__('<b>CREATED</b> `%s` `%s` (ID: %s)', 'wp_all_import_plugin'), $this->getRecordTitle($articleData), $custom_type_details->labels->singular_name, $pid));
2771
  } else {
2772
+ $logger and call_user_func($logger, sprintf(__('<b>UPDATED</b> `%s` `%s` (ID: %s)', 'wp_all_import_plugin'), $this->getRecordTitle($articleData), $custom_type_details->labels->singular_name, $pid));
2773
  }
2774
 
2775
  $is_update = ! empty($articleData['ID']);
2776
 
2777
  // fire important hooks after custom fields are added
2778
+ if ( ! $this->options['is_fast_mode'] and ! in_array($this->options['custom_type'], array('import_users', 'shop_customer', 'taxonomies', 'comments', 'woo_reviews'))){
2779
  $_post = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM {$this->wpdb->posts} WHERE ID = %d LIMIT 1", $pid ) );
2780
  $_post = sanitize_post( $_post, 'raw' );
2781
  $post_object = new WP_Post( $_post );
2903
  $title = $articleData['user_login'];
2904
  break;
2905
  case 'comments':
2906
+ case 'woo_reviews':
2907
  $title = wp_trim_words($articleData['comment_content'], 10);
2908
  break;
2909
  default:
2928
  if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($url, false, $get_ctx))) {
2929
  $logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s can not be downloaded, response %s', 'wp_all_import_plugin'), $url, maybe_serialize($request)));
2930
  @unlink($image_filepath); // delete file since failed upload may result in empty file created
2931
+ } else {
2932
+ if ($type == 'images') {
2933
+ if ( preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath)) or $file_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath) and in_array($file_info[2], wp_all_import_supported_image_types())) {
 
2934
  $downloaded = true;
2935
  if (preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath))){
2936
  $file_info = true;
2937
  }
2938
  $logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
2939
+ } else {
 
 
2940
  $logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'wp_all_import_plugin'), $url));
2941
  $logger and !$is_cron and PMXI_Plugin::$session->warnings++;
2942
+ @unlink($image_filepath); // delete file since failed upload may result in empty file created
2943
  }
2944
+ } elseif($type == 'files') {
 
2945
  if( $file_info = wp_check_filetype(wp_all_import_basename($image_filepath), null )) {
2946
  $downloaded = true;
2947
  $logger and call_user_func($logger, sprintf(__('- File `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
2975
 
2976
  remove_all_actions('add_attachment');
2977
 
2978
+ if ( in_array($post_type, array('taxonomies', 'comments', 'woo_reviews')) ){
2979
  $attid = wp_insert_attachment($attachment, $handle_image['file'], 0);
2980
  }
2981
  else{
3190
  }
3191
  }
3192
 
3193
+ if ( PMXI_Plugin::is_ajax() ) break;
3194
  }
3195
 
3196
  do_action('wp_all_import_skipped_from_deleted', $skipp_from_deletion, $this);
3197
 
3198
+ return (count($missing_ids_arr) > 1) ? false : true;
3199
  }
3200
  }
3201
 
3373
 
3374
  protected function deleteRecords( $is_delete_attachments, $is_deleted_images, $ids = array() ) {
3375
  foreach ( $ids as $k => $id ) {
3376
+ if ( ! in_array($this->options['custom_type'], array('import_users', 'taxonomies', 'shop_customer', 'comments', 'woo_reviews')) ){
3377
  do_action('pmxi_before_delete_post', $id, $this);
3378
  // Remove attachments.
3379
  if ($is_delete_attachments == 'yes' or $is_delete_attachments == 'auto' and empty($this->options['is_keep_attachments'])) {
plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP All Import
4
  Plugin URI: http://www.wpallimport.com/upgrade-to-pro/?utm_source=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.5.4
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.5.4');
29
 
30
  define('PMXI_EDITION', 'free');
31
 
3
  Plugin Name: WP All Import
4
  Plugin URI: http://www.wpallimport.com/upgrade-to-pro/?utm_source=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.5.5
7
  Author: Soflyy
8
  */
9
 
25
  */
26
  define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
27
 
28
+ define('PMXI_VERSION', '3.5.5');
29
 
30
  define('PMXI_EDITION', 'free');
31
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
  Tested up to: 5.5
5
- Stable tag: 3.5.4
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,11 @@ Does it work with special character encoding like Hebrew, Arabic, Chinese, etc?
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
108
  = 3.5.4 =
109
  * improvement: compatibility with WordPress 5.5
110
  * API: added helper function wp_all_import_get_import_id()
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
  Tested up to: 5.5
5
+ Stable tag: 3.5.5
6
  Tags: wordpress csv import, wordpress xml import, xml, csv, datafeed, import, migrate, import csv to wordpress, import xml to wordpress, advanced xml import, advanced csv import, bulk csv import, bulk xml import, bulk data import, xml to custom post type, csv to custom post type, woocommerce csv import, woocommerce xml import, csv import, import csv, xml import, import xml, csv importer
7
 
8
  WP All Import is an extremely powerful importer that makes it easy to import any XML or CSV file to WordPress.
105
 
106
  == Changelog ==
107
 
108
+ = 3.5.5 =
109
+ * improvement: get rid of deprecated setting 'High Speed Small File Processing'
110
+ * bug fix: chromium scroll anchoring caused screen jumping effect
111
+ * bug fix: pagenum query argument caused broken link on import complete screen
112
+
113
  = 3.5.4 =
114
  * improvement: compatibility with WordPress 5.5
115
  * API: added helper function wp_all_import_get_import_id()
schema.php CHANGED
@@ -106,4 +106,11 @@ CREATE TABLE {$table_prefix}history (
106
  summary TEXT,
107
  PRIMARY KEY (id)
108
  ) $charset_collate;
 
 
 
 
 
 
 
109
  SCHEMA;
106
  summary TEXT,
107
  PRIMARY KEY (id)
108
  ) $charset_collate;
109
+ CREATE TABLE {$table_prefix}hash (
110
+ hash BINARY(16) NOT NULL,
111
+ post_id BIGINT(20) UNSIGNED NOT NULL,
112
+ import_id SMALLINT(5) UNSIGNED NOT NULL,
113
+ post_type VARCHAR(32) NOT NULL DEFAULT '',
114
+ PRIMARY KEY (hash)
115
+ ) $charset_collate;
116
  SCHEMA;
static/css/admin.css CHANGED
@@ -3,7 +3,9 @@
3
  * Basic rules
4
  *
5
  *-------------------------------------------------------------------------*/
6
-
 
 
7
  .wpallimport-plugin hr {
8
  height: 1px;
9
  border-width: 0px;
@@ -223,7 +225,16 @@
223
  .wpallimport-plugin .wpallimport-file-upload-result a:last-child{
224
  margin-left: 0 !important;
225
  }
226
- .wpallimport-plugin .wpallimport-download-from-url{
 
 
 
 
 
 
 
 
 
227
  background: none repeat scroll 0 0 #46ba69;
228
  color: #fff;
229
  display: inline-block;
@@ -234,6 +245,29 @@
234
  text-decoration: none;
235
  vertical-align: bottom;
236
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  .wpallimport-plugin .wpallimport-file-upload-result .wpallimport-change-uploaded-file{
238
  color:#40acad;
239
  }
@@ -599,6 +633,25 @@ p.upgrade_link {
599
  display: none;
600
  background: #fff;
601
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
602
  .wpallimport-plugin .first-step-errors .exclamation{
603
  margin-top: 20px !important;
604
  }
@@ -1208,7 +1261,8 @@ p.upgrade_link {
1208
  vertical-align: top;
1209
  padding-top: 10px;
1210
  }
1211
- .wpallimport-plugin a.wpallimport-import-from.bind{
 
1212
  color: #888;
1213
  border-color: #cfceca;
1214
  }
@@ -1464,8 +1518,8 @@ p.upgrade_link {
1464
  width: 24px;
1465
  }
1466
  .wpallimport-plugin .wpallimport-import-to.wpallimport-import-to-checked{
1467
- background: #38A659;
1468
- border: 1px solid #3da55c;
1469
  color: #fff;
1470
  }
1471
  .wpallimport-plugin .wpallimport-import-to.wpallimport-to-new-items span.wpallimport-import-to-title:before{
@@ -1492,6 +1546,58 @@ p.upgrade_link {
1492
  position: absolute;
1493
  top: 33px;
1494
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1495
  .wpallimport-plugin #custom_type_selector .dd-option .dashicon:before,
1496
  .wpallimport-plugin #custom_type_selector .dd-selected .dashicon:before {
1497
  font-family: "dashicons";
@@ -1548,8 +1654,8 @@ p.upgrade_link {
1548
  content: "\f101";
1549
  color: #555;
1550
  }
1551
- .wpallimport-plugin #custom_type_selector .dd-option .dashicon-reviews:before,
1552
- .wpallimport-plugin #custom_type_selector .dd-selected .dashicon-reviews:before{
1553
  font-family: "dashicons";
1554
  content: "\f155";
1555
  color: #555;
@@ -1568,25 +1674,34 @@ p.upgrade_link {
1568
  color:#46ba69;
1569
  line-height: 24px;
1570
  }
1571
- .wpallimport-plugin input[name=url]{
 
 
 
 
1572
  font-size: 18px !important;
1573
  height: 49px;
1574
- margin-top: 20px;
1575
- padding: 5px;
1576
  width: 75% !important;
1577
- /*background: url('../img/ui_4.0/url.png') 10px -42px no-repeat;*/
1578
- padding-left: 60px;
1579
  border: 1px solid #ddd;
1580
  border-radius: 4px;
1581
  -moz-border-radius: 4px;
1582
  -khtml-border-radius: 4px;
1583
  -webkit-border-radius: 4px;
1584
- color: #cfceca;
1585
  margin-bottom: 0;
1586
  }
1587
- .wpallimport-plugin .wpallimport-url-icon:before{
 
 
 
 
 
 
 
 
1588
  color: #cfceca;
1589
- content: "\f103";
1590
  font-family: "dashicons";
1591
  font-size: 30px;
1592
  left: 45px;
@@ -1594,8 +1709,102 @@ p.upgrade_link {
1594
  top: -14px;
1595
  vertical-align: bottom;
1596
  }
1597
- .wpallimport-plugin .wpallimport-url-icon.focus:before{
1598
- color: #333;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1599
  }
1600
  .wpallimport-plugin input[name=url].focus{
1601
  background-position: 10px 8px;
@@ -3261,6 +3470,52 @@ p.upgrade_link {
3261
  right: 5%;
3262
  top: 42px;
3263
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3264
  /*--------------------------------------------------------------------------
3265
  *
3266
  * RTL
@@ -3566,7 +3821,8 @@ body.rtl.wpallimport-plugin .show_hints
3566
  .wpallimport-plugin .wpallimport-upload-type-container{
3567
  padding: 0 40px;
3568
  }
3569
- .wpallimport-plugin .wpallimport-import-to{
 
3570
  width: 330px;
3571
  }
3572
  .wpallimport-plugin .ajax-console .found_records h4{
@@ -3604,10 +3860,12 @@ body.rtl.wpallimport-plugin .show_hints
3604
  .wpallimport-plugin .change_file #select-files{
3605
  font-size: 14px;
3606
  }
3607
- .wpallimport-plugin .wpallimport-import-to.wpallimport-to-new-items span.wpallimport-import-to-title:before{
 
3608
  left: 25%;
3609
  }
3610
- .wpallimport-plugin .wpallimport-import-to.wpallimport-to-existing-items span.wpallimport-import-to-title:before{
 
3611
  left: 20%;
3612
  }
3613
  .wpallimport-plugin .wpallimport-custom-fields textarea{
3
  * Basic rules
4
  *
5
  *-------------------------------------------------------------------------*/
6
+ body.wpallimport-plugin {
7
+ overflow-anchor: none;
8
+ }
9
  .wpallimport-plugin hr {
10
  height: 1px;
11
  border-width: 0px;
225
  .wpallimport-plugin .wpallimport-file-upload-result a:last-child{
226
  margin-left: 0 !important;
227
  }
228
+ .wpallimport-plugin .wpallimport-download-resource {
229
+ display: none;
230
+ text-align: center;
231
+ }
232
+ .wpallimport-download-from-ftp-builder-title{
233
+ font-size: 16px;
234
+ line-height: 2.9;
235
+ }
236
+ .wpallimport-plugin .wpallimport-download-from-url,
237
+ .wpallimport-plugin .wpallimport-download-from-ftp{
238
  background: none repeat scroll 0 0 #46ba69;
239
  color: #fff;
240
  display: inline-block;
245
  text-decoration: none;
246
  vertical-align: bottom;
247
  }
248
+ .wpallimport-ftp-builder{
249
+ background: none repeat scroll 0 0 #46ba69;
250
+ color: #fff !important;
251
+ display: inline-block;
252
+ font-size: 14px;
253
+ height: 19px;
254
+ padding: 8px 15px 8px 15px;
255
+ position: relative;
256
+ text-decoration: none;
257
+ bottom: 2px;
258
+ }
259
+ .ftp_path {
260
+ display: flex;
261
+ width: 75%;
262
+ height: 49px;
263
+ margin: 6px auto 0 auto;
264
+ left: 3px;
265
+ position: relative;
266
+ }
267
+ .wpallimport-ftp-builder-wrap {
268
+ position: relative;
269
+ right: 150px;
270
+ }
271
  .wpallimport-plugin .wpallimport-file-upload-result .wpallimport-change-uploaded-file{
272
  color:#40acad;
273
  }
633
  display: none;
634
  background: #fff;
635
  }
636
+ .wpallimport-plugin .wpai-ftp-connection-error{
637
+ width:75%;
638
+ margin-right:auto;
639
+ margin-left:auto;
640
+ left:5px;
641
+ margin-top:50px;
642
+ font-size: 18px !important;
643
+ color: #888;
644
+ text-align:left;
645
+ padding-top:0px;
646
+ }
647
+ .wpallimport-plugin .wpai-ftp-connection-error .wpallimport-notify-wrapper .error-headers {
648
+ background-position-y: top !important;
649
+ }
650
+ .wpallimport-plugin .wpai-ftp-connection-error .wpallimport-notify-wrapper .error-headers h3,
651
+ .wpallimport-plugin .wpai-ftp-connection-error .wpallimport-notify-wrapper .error-headers span {
652
+ top: 8px;
653
+ position:relative;
654
+ }
655
  .wpallimport-plugin .first-step-errors .exclamation{
656
  margin-top: 20px !important;
657
  }
1261
  vertical-align: top;
1262
  padding-top: 10px;
1263
  }
1264
+ .wpallimport-plugin a.wpallimport-import-from.bind,
1265
+ .wpallimport-plugin a.wpallimport-download-from {
1266
  color: #888;
1267
  border-color: #cfceca;
1268
  }
1518
  width: 24px;
1519
  }
1520
  .wpallimport-plugin .wpallimport-import-to.wpallimport-import-to-checked{
1521
+ background: #46BA69;
1522
+ border: 1px solid #46BA69;
1523
  color: #fff;
1524
  }
1525
  .wpallimport-plugin .wpallimport-import-to.wpallimport-to-new-items span.wpallimport-import-to-title:before{
1546
  position: absolute;
1547
  top: 33px;
1548
  }
1549
+ .wpallimport-plugin .wpallimport-download-from{
1550
+ background: none repeat scroll 0 0 #f6f5f1;
1551
+ border: 1px solid #ddd;
1552
+ color: #888;
1553
+ display: inline-block;
1554
+ font-size: 18px;
1555
+ height: 50px;
1556
+ line-height: 24px;
1557
+ padding-top: 25px;
1558
+ text-align: center;
1559
+ text-decoration: none;
1560
+ width: 360px;
1561
+ margin-right: 10px;
1562
+ position: relative;
1563
+ }
1564
+ .wpallimport-plugin .wpallimport-download-from span.wpallimport-download-from-arrow{
1565
+ display: none;
1566
+ }
1567
+ .wpallimport-plugin .wpallimport-download-from.wpallimport-download-from-checked span.wpallimport-download-from-arrow{
1568
+ background: url('../img/ui_4.0/bottom_arrow.png') no-repeat;
1569
+ position: absolute;
1570
+ bottom: -12px;
1571
+ left: 48%;
1572
+ display: block;
1573
+ height: 14px;
1574
+ width: 24px;
1575
+ }
1576
+ .wpallimport-plugin .wpallimport-download-from.wpallimport-download-from-checked{
1577
+ background: #46BA69;
1578
+ border: 1px solid #46BA69;
1579
+ color: #fff;
1580
+ }
1581
+ .wpallimport-plugin .wpallimport-download-from.wpallimport-download-file-from-url span.wpallimport-download-from-title:before{
1582
+
1583
+ font-size: 33px;
1584
+ left: 27%;
1585
+ line-height: 10px;
1586
+ position: absolute;
1587
+ top: 33px;
1588
+ }
1589
+ .wpallimport-plugin .wpallimport-download-from.wpallimport-download-file-from-url.wpallimport-download-from-checked span.wpallimport-download-from-title:before,
1590
+ .wpallimport-plugin .wpallimport-download-from.wpallimport-download-file-from-ftp.wpallimport-download-from-checked span.wpallimport-download-from-title:before{
1591
+ color: #46BA69;
1592
+ }
1593
+ .wpallimport-plugin .wpallimport-download-from.wpallimport-download-file-from-ftp span.wpallimport-download-from-title:before{
1594
+
1595
+ font-size: 33px;
1596
+ left: 23%;
1597
+ line-height: 10px;
1598
+ position: absolute;
1599
+ top: 33px;
1600
+ }
1601
  .wpallimport-plugin #custom_type_selector .dd-option .dashicon:before,
1602
  .wpallimport-plugin #custom_type_selector .dd-selected .dashicon:before {
1603
  font-family: "dashicons";
1654
  content: "\f101";
1655
  color: #555;
1656
  }
1657
+ .wpallimport-plugin #custom_type_selector .dd-option .dashicon-woo_reviews:before,
1658
+ .wpallimport-plugin #custom_type_selector .dd-selected .dashicon-woo_reviews:before{
1659
  font-family: "dashicons";
1660
  content: "\f155";
1661
  color: #555;
1674
  color:#46ba69;
1675
  line-height: 24px;
1676
  }
1677
+ .wpallimport-plugin .wpallimport-download-resource-step-two {
1678
+ padding: 0 55px;
1679
+ }
1680
+ .wpallimport-plugin input[name=url],
1681
+ .wpallimport-plugin .wpallimport-download-resource-step-two-ftp input{
1682
  font-size: 18px !important;
1683
  height: 49px;
1684
+ /*margin-top: 20px;*/
 
1685
  width: 75% !important;
1686
+ padding: 0 5px 0 60px;
 
1687
  border: 1px solid #ddd;
1688
  border-radius: 4px;
1689
  -moz-border-radius: 4px;
1690
  -khtml-border-radius: 4px;
1691
  -webkit-border-radius: 4px;
1692
+ color: #888;
1693
  margin-bottom: 0;
1694
  }
1695
+ .wpallimport-plugin .wpallimport-download-resource-step-two-ftp input,
1696
+ .wpallimport-plugin .wpallimport-download-resource-step-two-ftp textarea{
1697
+ margin-top: 10px;
1698
+ margin-bottom: 0px !important;
1699
+ }
1700
+ .wpallimport-plugin .wpallimport-download-resource-step-two-ftp input::placeholder {
1701
+ color: #cfceca;
1702
+ }
1703
+ .wpallimport-plugin .wpallimport-input-icon{
1704
  color: #cfceca;
 
1705
  font-family: "dashicons";
1706
  font-size: 30px;
1707
  left: 45px;
1709
  top: -14px;
1710
  vertical-align: bottom;
1711
  }
1712
+ .wpallimport-plugin .wpallimport-url-icon {
1713
+ display: -webkit-inline-box;
1714
+ }
1715
+ .wpallimport-plugin .wpallimport-url-icon:before{
1716
+ content: "\f103";
1717
+ }
1718
+ .wpallimport-plugin .wpallimport-ftp-host-icon {
1719
+ display: -webkit-inline-box;
1720
+ }
1721
+ .wpallimport-plugin .wpallimport-ftp-host-icon:before{
1722
+ content: "\f319";
1723
+ }
1724
+ .wpallimport-plugin .wpallimport-ftp-path-icon {
1725
+ top: -33px;
1726
+ float: left;
1727
+ z-index: 1;
1728
+ left: 17px;
1729
+ position: absolute;
1730
+ }
1731
+ .wpallimport-plugin .wpallimport-ftp-path-icon:before{
1732
+ content: "\f123";
1733
+ }
1734
+ .wpallimport-plugin .wpallimport-file-type-options .wpai-ftp-path-input {
1735
+ display:block;
1736
+ padding-right:50px;
1737
+ top: -2px;
1738
+ position: relative;
1739
+ }
1740
+ .wpai-ftp-path-button {
1741
+ float:right;
1742
+ }
1743
+ .wpallimport-plugin .ftp_path .wpai-ftp-select-file-button {
1744
+ background-image: none;
1745
+ text-align: center;
1746
+ background-color: rgb(70, 186, 105);
1747
+ width: 175px;
1748
+ border: none;
1749
+ height: 49px;
1750
+ top: 0.5px;
1751
+ font-size: 16px;
1752
+ padding: 0 50px;
1753
+ }
1754
+ .wpallimport-plugin input[name=ftp_path] {
1755
+ float: left;
1756
+ position: relative;
1757
+ width: 100% !important;
1758
+ top: -10px;
1759
+ margin-right: 10px;
1760
+ }
1761
+ .wpallimport-plugin .wpallimport-ftp-port-icon {
1762
+ display: -webkit-inline-box;
1763
+ }
1764
+ .wpallimport-plugin .wpallimport-ftp-port-icon:before{
1765
+ content: "\f106";
1766
+ }
1767
+ .wpallimport-plugin .wpallimport-ftp-username-icon {
1768
+ display: -webkit-inline-box;
1769
+ }
1770
+ .wpallimport-plugin .wpallimport-ftp-username-icon:before{
1771
+ content: "\f110";
1772
+ }
1773
+ .wpallimport-plugin .wpallimport-ftp-password-icon {
1774
+ display: -webkit-inline-box;
1775
+ }
1776
+ .wpallimport-plugin .wpallimport-ftp-password-icon:before{
1777
+ content: "\f112";
1778
+ }
1779
+ .wpallimport-plugin .wpallimport-ftp-private-key-icon:before{
1780
+ content: "\f313";
1781
+ }
1782
+ .wpallimport-plugin .wpallimport-ftp-private-key-icon {
1783
+ display: -webkit-inline-box;
1784
+ top: -72px;
1785
+ }
1786
+ .wpai-ftp-text-area {
1787
+ font-size: 18px !important;
1788
+ height: 100px;
1789
+ margin-top: 20px;
1790
+ padding: 5px;
1791
+ width: 75% !important;
1792
+ padding-left: 60px;
1793
+ border: 1px solid #ddd;
1794
+ border-radius: 4px;
1795
+ -moz-border-radius: 4px;
1796
+ -khtml-border-radius: 4px;
1797
+ -webkit-border-radius: 4px;
1798
+ color: #888;
1799
+ margin-bottom: 0;
1800
+ resize: none;
1801
+ }
1802
+ .wpai-ftp-text-area::placeholder {
1803
+ color: #cfceca !important;
1804
+ font-size: 18px;
1805
+ }
1806
+ #wpai-ftp-text-area-help {
1807
+ top:-46px !important;
1808
  }
1809
  .wpallimport-plugin input[name=url].focus{
1810
  background-position: 10px 8px;
3470
  right: 5%;
3471
  top: 42px;
3472
  }
3473
+ .wpallimport-plugin .ftp-connection-builder-dialog .ui-dialog-buttonset {
3474
+ width: 100%;
3475
+ }
3476
+ .wpallimport-plugin .ftp-connection-builder-dialog .ui-button {
3477
+ color: #0071a1;
3478
+ border-color: #0071a1;
3479
+ background: #f3f5f6;
3480
+ display: inline-block;
3481
+ text-decoration: none;
3482
+ font-size: 13px;
3483
+ line-height: 2.15384615;
3484
+ min-height: 30px;
3485
+ padding: 0 10px;
3486
+ cursor: pointer;
3487
+ border-width: 1px;
3488
+ border-style: solid;
3489
+ -webkit-appearance: none;
3490
+ border-radius: 3px;
3491
+ white-space: nowrap;
3492
+ box-sizing: border-box;
3493
+ }
3494
+ .wpallimport-plugin .ftp-connection-builder-dialog .ui-button:hover {
3495
+ background: #f1f1f1;
3496
+ border-color: #016087;
3497
+ color: #016087;
3498
+ }
3499
+ .wpallimport-plugin .ftp-connection-builder-dialog .ui-button span {
3500
+ font-weight: normal;
3501
+ }
3502
+ .wpallimport-plugin .ftp-connection-builder-dialog .ui-button:nth-child(3){
3503
+ float: right;
3504
+ }
3505
+ .wpallimport-plugin .ftp-connection-builder-dialog .ui-button:nth-child(4){
3506
+ float: right;
3507
+ display: none;
3508
+ background: #007cba;
3509
+ border-color: #007cba;
3510
+ color: #fff;
3511
+ text-decoration: none;
3512
+ text-shadow: none;
3513
+ }
3514
+ .wpallimport-plugin .ftp-connection-builder-dialog .ui-button:nth-child(4):hover {
3515
+ background: #0071a1;
3516
+ border-color: #0071a1;
3517
+ color: #fff;
3518
+ }
3519
  /*--------------------------------------------------------------------------
3520
  *
3521
  * RTL
3821
  .wpallimport-plugin .wpallimport-upload-type-container{
3822
  padding: 0 40px;
3823
  }
3824
+ .wpallimport-plugin .wpallimport-import-to,
3825
+ .wpallimport-plugin .wpallimport-download-from {
3826
  width: 330px;
3827
  }
3828
  .wpallimport-plugin .ajax-console .found_records h4{
3860
  .wpallimport-plugin .change_file #select-files{
3861
  font-size: 14px;
3862
  }
3863
+ .wpallimport-plugin .wpallimport-import-to.wpallimport-to-new-items span.wpallimport-import-to-title:before,
3864
+ .wpallimport-plugin .wpallimport-download-from.wpallimport-download-file-from-url span.download-from-title:before{
3865
  left: 25%;
3866
  }
3867
+ .wpallimport-plugin .wpallimport-import-to.wpallimport-to-existing-items span.wpallimport-import-to-title:before,
3868
+ .wpallimport-plugin .wpallimport-download-from.wpallimport-download-file-from-ftp span.wpallimport-download-from-title:before{
3869
  left: 20%;
3870
  }
3871
  .wpallimport-plugin .wpallimport-custom-fields textarea{
static/js/admin.js CHANGED
@@ -250,26 +250,25 @@
250
  var fixWrapHeight = false;
251
 
252
  $('#custom_type_selector').ddslick({
253
- width: 590,
254
- onSlideDownOptions: function(o){
255
- formHeight = $wrap.height();
256
- $wrap.css({'height': formHeight + $('#custom_type_selector').find('.dd-options').height() + 'px'});
257
  },
258
- onSlideUpOptions: function(o){
259
- $wrap.css({'height': formHeight + 'px'});
260
  },
261
- onSelected: function(selectedData){
262
- if (fixWrapHeight){
263
- $wrap.css({'height': formHeight + 'px'});
264
- }
265
- else{
266
  fixWrapHeight = true;
267
  }
268
 
269
  $('.wpallimport-upgrade-notice').hide();
270
 
271
- $('input[name=custom_type]').val(selectedData.selectedData.value);
272
- $('#custom_type_selector').find('.dd-selected').css({'color':'#555'});
273
 
274
  var is_import_denied = $('.wpallimport-upgrade-notice[rel='+ selectedData.selectedData.value +']').length;
275
 
@@ -285,14 +284,40 @@
285
  });
286
 
287
  $('.wpallimport-import-from').click(function(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  $('.wpallimport-import-from').removeClass('selected').addClass('bind');
289
  $(this).addClass('selected').removeClass('bind');
290
  $('.change_file').find('.wpallimport-upload-type-container').hide();
291
  $('.change_file').find('.wpallimport-file-upload-result').attr('rel', $(this).attr('rel'));
292
  $('.change_file').find('.wpallimport-upload-type-container[rel=' + $(this).attr('rel') + ']').show();
293
  $('.change_file').find('#wpallimport-url-upload-status').html('');
294
- //$('.change_file').find('input[name=new_type]').val( $(this).attr('rel').replace('_type', '') );
295
- $('.first-step-errors').hide();
296
 
297
  if ($(this).attr('rel') == 'upload_type'){
298
  $('input[type=file]').click();
@@ -300,6 +325,20 @@
300
  });
301
  $('.wpallimport-import-from.selected').click();
302
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  });
304
 
305
  $('input[name=url]').change(function(){
@@ -339,26 +378,32 @@
339
 
340
  var $wrap = $('.wrap');
341
 
342
- var formHeight = $wrap.height();
343
 
344
  $('.wpallimport-import-from').click(function(){
345
 
346
  var showImportType = false;
347
-
348
  switch ($(this).attr('rel')){
349
  case 'upload_type':
350
- if ($('input[name=filepath]').val() != '')
351
- showImportType = true;
352
- break;
 
 
353
  case 'url_type':
354
- if ($('input[name=url]').val() != '')
355
- showImportType = false;
 
 
356
  break;
357
- case 'file_type':
358
- if ($('input[name=file]').val() != '')
359
- showImportType = false;
 
 
360
  break;
361
- }
362
 
363
  $('.wpallimport-import-from').removeClass('selected').addClass('bind');
364
  $('.wpallimport-import-types').find('h2').slideUp();
@@ -391,10 +436,14 @@
391
 
392
  $('.wpallimport-download-from-url').click(function(){
393
 
394
- $(this).parents('.wpallimport-upload-type-container').find('.wpallimport-free-edition-notice').slideDown();
395
  $('.auto-generate-template').hide();
396
 
397
- });
 
 
 
 
398
 
399
  var fixWrapHeight = false;
400
 
@@ -465,9 +514,24 @@
465
  $('.dd-container').fadeIn();
466
  });
467
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
468
  $('#custom_type_selector').hide();
469
 
470
  $('.wpallimport-import-to.wpallimport-import-to-checked').click();
 
471
 
472
  $('a.auto-generate-template').click(function(){
473
  $('input[name^=auto_generate]').val('1');
@@ -1481,7 +1545,7 @@
1481
  if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
1482
  });
1483
 
1484
- $('.drag-element').find('input').on('hover', function(){},function(){
1485
  $(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify($(this).parents('.ui-sortable:first').pmxi_nestedSortable('toArray', {startDepthCount: 0})));
1486
  if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
1487
  });
@@ -1553,7 +1617,7 @@
1553
 
1554
  $('input[name^=in_variations], input[name^=is_visible], input[name^=is_taxonomy], input[name^=create_taxonomy_in_not_exists], input[name^=variable_create_taxonomy_in_not_exists], input[name^=variable_in_variations], input[name^=variable_is_visible], input[name^=variable_is_taxonomy]').each(function(){
1555
  if ( ! $(this).is(':checked') && ! $(this).parents('.form-field:first').hasClass('template')){
1556
- $(this).val('0').prop('checked', true);
1557
  }
1558
  });
1559
 
@@ -1987,6 +2051,19 @@
1987
  $(this).html($newtitle);
1988
  });
1989
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1990
  var fix_tag_position = function(){
1991
  if ($('.wpallimport-layout').length && $('.tag').length){
1992
  var offset = $('.wpallimport-layout').offset();
250
  var fixWrapHeight = false;
251
 
252
  $('#custom_type_selector').ddslick({
253
+ width: 590,
254
+ onSlideDownOptions: function(o){
255
+ formHeight = ($('.wpallimport-layout').height() < 730) ? 730 : $('.wpallimport-layout').height();
256
+ $wrap.css({'height': formHeight + $('#custom_type_selector').find('.dd-options').height() + 'px'});
257
  },
258
+ onSlideUpOptions: function(o){
259
+ $wrap.css({'height': 'auto'});
260
  },
261
+ onSelected: function(selectedData){
262
+ if (fixWrapHeight) {
263
+ $wrap.css({'height': 'auto'});
264
+ } else {
 
265
  fixWrapHeight = true;
266
  }
267
 
268
  $('.wpallimport-upgrade-notice').hide();
269
 
270
+ $('input[name=custom_type]').val(selectedData.selectedData.value);
271
+ $('#custom_type_selector').find('.dd-selected').css({'color':'#555'});
272
 
273
  var is_import_denied = $('.wpallimport-upgrade-notice[rel='+ selectedData.selectedData.value +']').length;
274
 
284
  });
285
 
286
  $('.wpallimport-import-from').click(function(){
287
+
288
+ var showImportType = false;
289
+
290
+ switch ($(this).attr('rel')){
291
+ case 'upload_type':
292
+ if ($('input[name=filepath]').val() != '') {
293
+ showImportType = true;
294
+ }
295
+ $('.wpallimport-download-resource').hide();
296
+ break;
297
+ case 'url_type':
298
+ if ($('input[name=url]').val() != '') {
299
+ showImportType = true;
300
+ }
301
+ $('.wpallimport-download-from-checked').click();
302
+ break;
303
+ case 'file_type':
304
+ if ($('input[name=file]').val() != '') {
305
+ showImportType = true;
306
+ }
307
+ $('.wpallimport-download-resource').hide();
308
+ break;
309
+ }
310
+
311
+ $('.wpallimport-import-from').removeClass('selected').addClass('bind');
312
+ $(this).addClass('selected').removeClass('bind');
313
  $('.wpallimport-import-from').removeClass('selected').addClass('bind');
314
  $(this).addClass('selected').removeClass('bind');
315
  $('.change_file').find('.wpallimport-upload-type-container').hide();
316
  $('.change_file').find('.wpallimport-file-upload-result').attr('rel', $(this).attr('rel'));
317
  $('.change_file').find('.wpallimport-upload-type-container[rel=' + $(this).attr('rel') + ']').show();
318
  $('.change_file').find('#wpallimport-url-upload-status').html('');
319
+ $('.change_file').find('input[name=new_type]').val( $(this).attr('rel').replace('_type', '') );
320
+ //$('.first-step-errors').hide();
321
 
322
  if ($(this).attr('rel') == 'upload_type'){
323
  $('input[type=file]').click();
325
  });
326
  $('.wpallimport-import-from.selected').click();
327
 
328
+ $('.wpallimport-download-from').click(function(){
329
+ if ($(this).attr('rel') === 'url') {
330
+ $('.wpallimport-download-resource-step-two-url').show();
331
+ $('.wpallimport-download-resource-step-two-ftp').hide();
332
+ } else {
333
+ $('.wpallimport-download-resource-step-two-url').hide();
334
+ $('.wpallimport-download-resource-step-two-ftp').show();
335
+ }
336
+ $('.wpallimport-download-from').removeClass('wpallimport-download-from-checked');
337
+ $(this).addClass('wpallimport-download-from-checked');
338
+ $('.change_file').find('input[name=new_type]').val( $(this).attr('rel') );
339
+ });
340
+ $('.wpallimport-download-from.wpallimport-download-from-checked').click();
341
+
342
  });
343
 
344
  $('input[name=url]').change(function(){
378
 
379
  var $wrap = $('.wrap');
380
 
381
+ var formHeight = ($('.wpallimport-layout').height() < 730) ? 730 : $('.wpallimport-layout').height();
382
 
383
  $('.wpallimport-import-from').click(function(){
384
 
385
  var showImportType = false;
386
+
387
  switch ($(this).attr('rel')){
388
  case 'upload_type':
389
+ if ($('input[name=filepath]').val() != '') {
390
+ showImportType = true;
391
+ }
392
+ $('.wpallimport-download-resource').hide();
393
+ break;
394
  case 'url_type':
395
+ if ($('input[name=url]').val() != '') {
396
+ showImportType = true;
397
+ }
398
+ $('.wpallimport-download-from-checked').click();
399
  break;
400
+ case 'file_type':
401
+ if ($('input[name=file]').val() != '') {
402
+ showImportType = true;
403
+ }
404
+ $('.wpallimport-download-resource').hide();
405
  break;
406
+ }
407
 
408
  $('.wpallimport-import-from').removeClass('selected').addClass('bind');
409
  $('.wpallimport-import-types').find('h2').slideUp();
436
 
437
  $('.wpallimport-download-from-url').click(function(){
438
 
439
+ $(this).parents('.wpallimport-download-resource').find('.wpallimport-free-edition-notice').slideDown();
440
  $('.auto-generate-template').hide();
441
 
442
+ });
443
+
444
+ $('.wpai-ftp-select-file-button').click(function () {
445
+ $(this).parents('.wpallimport-download-resource').find('.wpallimport-free-edition-notice').slideDown();
446
+ });
447
 
448
  var fixWrapHeight = false;
449
 
514
  $('.dd-container').fadeIn();
515
  });
516
 
517
+ $('.wpallimport-download-from').click(function(){
518
+ if ($(this).attr('rel') === 'url') {
519
+ $('.wpallimport-download-resource-step-two-url').show();
520
+ $('.wpallimport-download-resource-step-two-ftp').hide();
521
+ } else {
522
+ $('.wpallimport-download-resource-step-two-url').hide();
523
+ $('.wpallimport-download-resource-step-two-ftp').show();
524
+ }
525
+ $('.wpallimport-download-from').removeClass('wpallimport-download-from-checked');
526
+ $(this).addClass('wpallimport-download-from-checked');
527
+ $('.wpallimport-choose-file').find('input[name=type]').val( $(this).attr('rel') );
528
+ $('.dd-container').fadeIn();
529
+ });
530
+
531
  $('#custom_type_selector').hide();
532
 
533
  $('.wpallimport-import-to.wpallimport-import-to-checked').click();
534
+ $('.wpallimport-download-from.wpallimport-download-from-checked').click();
535
 
536
  $('a.auto-generate-template').click(function(){
537
  $('input[name^=auto_generate]').val('1');
1545
  if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
1546
  });
1547
 
1548
+ $('.drag-element').find('input').on('mouseenter', function(){},function(){
1549
  $(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify($(this).parents('.ui-sortable:first').pmxi_nestedSortable('toArray', {startDepthCount: 0})));
1550
  if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
1551
  });
1617
 
1618
  $('input[name^=in_variations], input[name^=is_visible], input[name^=is_taxonomy], input[name^=create_taxonomy_in_not_exists], input[name^=variable_create_taxonomy_in_not_exists], input[name^=variable_in_variations], input[name^=variable_is_visible], input[name^=variable_is_taxonomy]').each(function(){
1619
  if ( ! $(this).is(':checked') && ! $(this).parents('.form-field:first').hasClass('template')){
1620
+ $(this).val('0').prop('checked', true);
1621
  }
1622
  });
1623
 
2051
  $(this).html($newtitle);
2052
  });
2053
 
2054
+ $('table.pmxi-admin-imports').each(function () {
2055
+ let manage_table = $(this);
2056
+ $(this).find('thead tr th.check-column :checkbox, tfoot tr th.check-column :checkbox').click(function () {
2057
+ let is_checked = $(this).is(':checked');
2058
+ manage_table.find('tbody tr th.check-column :checkbox').prop('checked', function () {
2059
+ if (is_checked) {
2060
+ return true;
2061
+ }
2062
+ return false;
2063
+ });
2064
+ });
2065
+ });
2066
+
2067
  var fix_tag_position = function(){
2068
  if ($('.wpallimport-layout').length && $('.tag').length){
2069
  var offset = $('.wpallimport-layout').offset();
static/js/jquery/jquery.tipsy.js CHANGED
File without changes
static/js/plupload/wplupload.js CHANGED
@@ -46,7 +46,7 @@ $.fn.wplupload = function($options) {
46
  //$('.auto-generate-template').removeAttr('rel').hide();
47
 
48
  $('.wpallimport-upload-type-container[rel=upload_type]').find('.wpallimport-note').hide();
49
-
50
  $up.start();
51
  });
52
 
46
  //$('.auto-generate-template').removeAttr('rel').hide();
47
 
48
  $('.wpallimport-upload-type-container[rel=upload_type]').find('.wpallimport-note').hide();
49
+
50
  $up.start();
51
  });
52
 
views/admin/import/index.php CHANGED
@@ -49,10 +49,10 @@
49
  <span class="wpallimport-icon"></span>
50
  <span class="wpallimport-icon-label"><?php _e('Upload a file', 'wp_all_import_plugin'); ?></span>
51
  </a>
52
- <a class="wpallimport-import-from wpallimport-url-type <?php echo 'url' == $post['type'] ? 'selected' : '' ?>" rel="url_type" href="javascript:void(0);">
53
- <span class="wpallimport-icon"></span>
54
- <span class="wpallimport-icon-label"><?php _e('Download from URL', 'wp_all_import_plugin'); ?></span>
55
- </a>
56
  <a class="wpallimport-import-from wpallimport-file-type <?php echo 'file' == $post['type'] ? 'selected' : '' ?>" rel="file_type" href="javascript:void(0);">
57
  <span class="wpallimport-icon"></span>
58
  <span class="wpallimport-icon-label"><?php _e('Use existing file', 'wp_all_import_plugin'); ?></span>
@@ -82,22 +82,18 @@
82
  </div>
83
  <div class="wpallimport-note" style="margin: 0 auto; font-size: 13px;"><span></span></div>
84
  </div>
85
- <div class="wpallimport-upload-type-container" rel="url_type">
86
- <div class="wpallimport-file-type-options">
87
- <span class="wpallimport-url-icon"></span>
88
- <input type="text" class="regular-text" name="url" value="<?php echo ( ! empty($post['url'])) ? esc_attr($post['url']) : ''; ?>" placeholder="Enter a web address to download the file from..."/>
89
- <a class="wpallimport-download-from-url rad4" href="javascript:void(0);"><?php _e('Download', 'wp_all_import_plugin'); ?></a>
90
- <span class="img_preloader" style="top:0; left: 5px; visibility: hidden; display: inline;"></span>
91
- </div>
92
- <div class="wpallimport-note" style="margin: 20px auto 0; font-size: 13px;">
93
- <?php _e('<strong>Hint:</strong> After you create this import, you can schedule it to run automatically, on a pre-defined schedule, with cron jobs.', 'wp_all_import_plugin'); ?>
94
- <div class="wpallimport-free-edition-notice" style="display:none;">
95
- <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707176&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=download-from-url" target="_blank" class="upgrade_link"><?php _e('Upgrade to the Pro edition of WP All Import to Download from URL', 'wp_all_import_plugin');?></a>
96
- <p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
97
- </div>
98
- </div>
99
- <input type="hidden" name="downloaded" value="<?php echo $post['downloaded']; ?>"/>
100
- </div>
101
  <div class="wpallimport-upload-type-container" rel="file_type">
102
  <?php $upload_dir = wp_upload_dir(); ?>
103
  <div class="wpallimport-file-type-options">
@@ -125,240 +121,339 @@
125
  </div>
126
  <div id="wpallimport-url-upload-status"></div>
127
 
128
- <?php if (empty($_GET['deligate'])): ?>
129
-
130
- <div class="wpallimport-upload-resource-step-two">
131
-
132
- <div class="wpallimport-choose-post-type">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
- <input type="hidden" name="wizard_type" value="<?php echo $post['wizard_type']; ?>"/>
 
 
 
 
 
 
135
 
136
- <h2 style="margin-top:0;"><?php _e('Import data from this file into...', 'wp_all_import_plugin'); ?></h2>
137
-
138
- <div class="wpallimport-choose-data-type">
139
- <a class="wpallimport-import-to rad4 wpallimport-to-new-items <?php if ($post['wizard_type'] == 'new') echo 'wpallimport-import-to-checked'; ?>" rel="new" href="javascript:void(0);">
140
- <span class="wpallimport-import-to-title"><?php _e('New Items', 'wp_all_import_plugin'); ?></span>
141
- <span class="wpallimport-import-to-arrow"></span>
142
- </a>
143
- <a class="wpallimport-import-to rad4 wpallimport-to-existing-items <?php if ($post['wizard_type'] == 'matching') echo 'wpallimport-import-to-checked'; ?>" rel="matching" href="javascript:void(0);">
144
- <span class="wpallimport-import-to-title"><?php _e('Existing Items', 'wp_all_import_plugin'); ?></span>
145
- <span class="wpallimport-import-to-arrow"></span>
146
- </a>
147
- </div>
 
 
148
 
149
- <?php
150
-
151
- $all_types = array();
152
- $sort_order = array();
153
-
154
- $hiddenPosts = array(
155
- 'attachment',
156
- 'revision',
157
- 'nav_menu_item',
158
- 'shop_webhook',
159
- 'import_users',
160
- 'wp-types-group',
161
- 'wp-types-user-group',
162
- 'wp-types-term-group',
163
- 'acf-field',
164
- 'acf-field-group',
165
- 'custom_css',
166
- 'customize_changeset',
167
- 'oembed_cache'
168
- );
169
-
170
- $custom_types = get_post_types(array('_builtin' => true), 'objects') + get_post_types(array('_builtin' => false, 'show_ui' => true), 'objects');
171
- foreach ($custom_types as $key => $ct) {
172
- if (in_array($key, $hiddenPosts)) unset($custom_types[$key]);
173
- }
174
-
175
- //$custom_types = apply_filters( 'pmxi_custom_types', $custom_types, 'custom_types' );
176
-
177
- $sorted_cpt = array();
178
- foreach ($custom_types as $key => $cpt){
179
-
180
- $sorted_cpt[$key] = $cpt;
181
-
182
- // Put users & comments & taxonomies after Pages
183
- if ( ! empty($custom_types['page']) && $key == 'page' || empty($custom_types['page']) && $key == 'post' ){
184
-
185
- $sorted_cpt['taxonomies'] = new stdClass();
186
- $sorted_cpt['taxonomies']->labels = new stdClass();
187
- $sorted_cpt['taxonomies']->labels->name = __('Taxonomies','wp_all_export_plugin');
188
-
189
- $sorted_cpt['import_users'] = new stdClass();
190
- $sorted_cpt['import_users']->labels = new stdClass();
191
- $sorted_cpt['import_users']->labels->name = __('Users','wp_all_export_plugin');
192
-
193
- $sorted_cpt['comments'] = new stdClass();
194
- $sorted_cpt['comments']->labels = new stdClass();
195
- $sorted_cpt['comments']->labels->name = __('Comments','wp_all_export_plugin');
196
-
197
- break;
198
- }
199
- }
200
- $order = array('shop_order', 'shop_coupon', 'shop_customer', 'product');
201
- foreach ($order as $cpt){
202
- if (!empty($custom_types[$cpt])) $sorted_cpt[$cpt] = $custom_types[$cpt];
203
- }
204
-
205
- uasort($custom_types, "wp_all_import_cmp_custom_types");
206
-
207
- foreach ($custom_types as $key => $cpt) {
208
- if (empty($sorted_cpt[$key])){
209
- $sorted_cpt[$key] = $cpt;
210
- }
211
- }
212
-
213
- $hidden_post_types = get_post_types(array('_builtin' => false, 'show_ui' => false), 'objects');
214
- foreach ($hidden_post_types as $key => $ct) {
215
- if (in_array($key, $hiddenPosts)) unset($hidden_post_types[$key]);
216
- }
217
- //$hidden_post_types = apply_filters( 'pmxi_custom_types', $hidden_post_types, 'hidden_post_types' );
218
-
219
- ?>
220
- <div class="wpallimport-choose-import-direction">
221
- <div class="wpallimport-extra-text-left">
222
- <div class="wpallimport-new-records"><?php _e('Create new', 'wp_all_import_plugin'); ?></div>
223
- <div class="wpallimport-existing-records"><?php _e('Import to existing', 'wp_all_import_plugin'); ?></div>
224
- </div>
225
- <div class="wpallimport-extra-text-right">
226
- <div class="wpallimport-new-records"><?php _e('for each record in my data file.', 'wp_all_import_plugin'); ?>
227
- <a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" title="The New Items option is commonly used to import new posts or products to your site without touching the existing records.<br/><br/>If the import is later run again with modified data, WP All Import will only update/remove posts created by this import.">?</a>
228
- </div>
229
- <div class="wpallimport-existing-records"><?php _e('and update some or all of their data.', 'wp_all_import_plugin'); ?>
230
- <a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" title="The Existing Items option is commonly used to update existing products with new stock quantities while leaving all their other data alone, update properties on your site with new pricing, etc. <br/><br/> In Step 4, you will map the records in your file to the existing items on your site and specify which data points will be updated and which will be left alone.">?</a>
231
- </div>
232
- </div>
233
- <select name="custom_type_selector" id="custom_type_selector" class="wpallimport-post-types">
234
 
235
- <?php
236
- // *****************************************************
237
- // **************** START CPT LOOP *********************
238
- // *****************************************************
239
- ?>
 
240
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
 
242
  <?php
243
- $known_imgs = array( 'post', 'page', 'product', 'import_users', 'shop_order', 'shop_coupon', 'shop_customer', 'users', 'comments', 'taxonomies', 'reviews' );
244
- $all_posts = array_merge( $sorted_cpt, $hidden_post_types );
245
- $all_posts = apply_filters( 'pmxi_custom_types', $all_posts );
246
- $ordered_posts = array( 'post', 'page', 'taxonomies', 'comments', 'import_users', 'shop_order', 'shop_coupon', 'product', 'reviews', 'shop_customer');
247
-
248
- foreach ( $all_posts as $key => $post_obj ) {
249
- if ( ! in_array( $key, $ordered_posts ) ) {
250
- array_push( $ordered_posts, $key );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  }
252
- }
253
 
254
- $order_arr = apply_filters( 'pmxi_post_list_order', $ordered_posts );
255
- $image_data = apply_filters( 'wp_all_import_post_type_image', array() );
 
 
 
 
 
 
 
256
 
257
- foreach ( $order_arr as $key => $post_name ) {
258
- if ( array_key_exists( $post_name, $all_posts ) ) {
259
- $post_obj = $all_posts[ $post_name ];
260
 
261
- if ( in_array( $post_name, $known_imgs ) ) {
262
- $image_src = 'dashicon-' . $post_name;
263
- } else {
264
- $image_src = 'dashicon-cpt';
 
 
 
 
 
265
  }
266
- if ( ! empty( $image_data ) && array_key_exists( $post_name, $image_data ) ) {
267
- $custom_img_defined = true;
268
- } else {
269
- $custom_img_defined = false;
 
 
 
 
 
 
 
270
  }
 
271
 
272
- $original_image_src = $image_src;
273
- $cpt = $post_name;
274
- $cpt_label = $post_obj->labels->name;
 
 
275
 
276
- $custom_selected_post = apply_filters( 'wpai_custom_selected_post', false, $post, $cpt, 'step1' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
 
278
- $img_to_echo = 'dashicon ';
 
 
 
 
279
 
280
- if ( $custom_img_defined === true ) {
281
- $img_to_echo .= $image_data[ $cpt ]['image'];
282
- } else {
283
- $img_to_echo .= $image_src;
284
- }
285
 
286
- ?>
 
 
 
 
287
 
288
- <option value="<?php echo $cpt; ?>" data-imagesrc="<?php echo $img_to_echo; ?>" <?php if ( $custom_selected_post === true ):?>selected="selected"<?php else: if ( $cpt == $post['custom_type'] ):?>selected="selected"<?php endif; endif; ?>><?php echo $cpt_label; ?></option>
289
- <?php
 
 
290
  }
291
 
292
- }
293
- ?>
294
 
295
- </select>
 
 
296
 
297
- <?php
298
- // *****************************************************
299
- // **************** FINISH CPT LOOP ********************
300
- // *****************************************************
301
- ?>
 
 
 
 
 
302
 
303
- <?php if ( ! class_exists('PMUI_Plugin') ): ?>
304
- <div class="wpallimport-upgrade-notice" rel="import_users">
305
- <p><?php _e('The User Add-On is Required to Import Users', 'wp_all_import_plugin'); ?></p>
306
- <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" class="upgrade_link"><?php _e('Purchase the User Add-On', 'wp_all_import_plugin');?></a>
307
- </div>
308
- <?php endif; ?>
309
- <?php if ( class_exists('WooCommerce') && ! class_exists('PMWI_Plugin') ): ?>
310
- <div class="wpallimport-upgrade-notice" rel="product">
311
- <p><?php _e('The WooCommerce Add-On is Required to Import Products', 'wp_all_import_plugin'); ?></p>
312
- <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707227&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-wooco-products" target="_blank" class="upgrade_link"><?php _e('Purchase the WooCommerce Add-On', 'wp_all_import_plugin');?></a>
313
- </div>
314
- <?php endif; ?>
315
- <?php if ( class_exists('WooCommerce') && ( ! class_exists('PMWI_Plugin') || class_exists('PMWI_Plugin') && PMWI_EDITION == 'free') ): ?>
316
- <div class="wpallimport-upgrade-notice" rel="shop_order">
317
- <?php if (class_exists('PMWI_Plugin') && PMWI_EDITION == 'free'): ?>
318
- <p><?php _e('The Pro version of the WooCommerce Add-On is required to Import Orders, but you have the free version installed.', 'wp_all_import_plugin'); ?></p>
319
- <?php else: ?>
320
- <p><?php _e('The WooCommerce Add-On Pro is Required to Import Orders', 'wp_all_import_plugin'); ?></p>
321
- <?php endif; ?>
322
- <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707227&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-wooco-orders" target="_blank" class="upgrade_link"><?php _e('Purchase the WooCommerce Add-On', 'wp_all_import_plugin');?></a>
323
- </div>
324
- <div class="wpallimport-upgrade-notice" rel="shop_coupon">
325
- <?php if (class_exists('PMWI_Plugin') && PMWI_EDITION == 'free'): ?>
326
- <p><?php _e('The Pro version of the WooCommerce Add-On is required to Import Coupons, but you have the free version installed.', 'wp_all_import_plugin'); ?></p>
327
- <?php else: ?>
328
- <p><?php _e('The WooCommerce Add-On Pro is Required to Import Coupons', 'wp_all_import_plugin'); ?></p>
329
- <?php endif; ?>
330
- <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707227&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-wooco-coupons" target="_blank" class="upgrade_link"><?php _e('Purchase the WooCommerce Add-On', 'wp_all_import_plugin');?></a>
331
- </div>
332
- <?php endif; ?>
333
- <div class="wpallimport-upgrade-notice" rel="taxonomies">
334
- <p><?php _e('WP All Import Pro is Required to Import Taxonomies', 'wp_all_import_plugin'); ?></p>
335
- <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707176&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-taxonomies" target="_blank" class="upgrade_link"><?php _e('Purchase WP All Import Pro', 'wp_all_import_plugin');?></a>
336
- </div>
337
- <div class="wpallimport-upgrade-notice" rel="comments">
338
- <p><?php _e('WP All Import Pro is Required to Import Comments', 'wp_all_import_plugin'); ?></p>
339
- <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707176&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-comments" target="_blank" class="upgrade_link"><?php _e('Purchase WP All Import Pro', 'wp_all_import_plugin');?></a>
340
- </div>
341
- <div class="wpallimport-upgrade-notice" rel="reviews">
342
- <p><?php _e('The WooCommerce Import Package is Required to Import Reviews', 'wp_all_import_plugin'); ?></p>
343
- <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707227&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-reviews" target="_blank" class="upgrade_link"><?php _e('Purchase the WooCommerce Import Package', 'wp_all_import_plugin');?></a>
344
- </div>
345
- <?php if ( class_exists('WooCommerce') && ! class_exists('PMUI_Plugin') ): ?>
346
- <div class="wpallimport-upgrade-notice" rel="shop_customer">
347
- <p><?php _e('The User Add-On is Required to Import Customers', 'wp_all_import_plugin'); ?></p>
348
- <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"><?php _e('Purchase the User Add-On', 'wp_all_import_plugin');?></a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
  </div>
350
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
351
 
352
 
353
- </div>
354
- <div class="clear wpallimport-extra-text-below">
355
- <!--div class="wpallimport-existing-records">
356
- <p><?php _e('In Step 4, you will map the records in your file to the existing items on your site and specify which data points will be updated and which will be left alone.', 'wp_all_import_plugin'); ?></p>
357
- <p><?php _e('The Existing Items option is commonly used to update existing products with new stock quantities while leaving all their other data alone, update properties on your site with new pricing, etc.', 'wp_all_import_plugin'); ?></p>
358
- </div-->
359
- </div>
360
- </div>
361
- </div>
362
  <?php endif; ?>
363
  </div>
364
 
49
  <span class="wpallimport-icon"></span>
50
  <span class="wpallimport-icon-label"><?php _e('Upload a file', 'wp_all_import_plugin'); ?></span>
51
  </a>
52
+ <a class="wpallimport-import-from wpallimport-url-type <?php echo ('url' == $post['type'] || 'ftp' == $post['type']) ? 'selected' : '' ?>" rel="url_type" href="javascript:void(0);">
53
+ <span class="wpallimport-icon"></span>
54
+ <span class="wpallimport-icon-label"><?php _e('Download a file', 'wp_all_import_plugin'); ?></span>
55
+ </a>
56
  <a class="wpallimport-import-from wpallimport-file-type <?php echo 'file' == $post['type'] ? 'selected' : '' ?>" rel="file_type" href="javascript:void(0);">
57
  <span class="wpallimport-icon"></span>
58
  <span class="wpallimport-icon-label"><?php _e('Use existing file', 'wp_all_import_plugin'); ?></span>
82
  </div>
83
  <div class="wpallimport-note" style="margin: 0 auto; font-size: 13px;"><span></span></div>
84
  </div>
85
+ <div class="wpallimport-upload-type-container" rel="url_type">
86
+ <div class="wpallimport-choose-data-type">
87
+ <a class="wpallimport-download-from rad4 wpallimport-download-file-from-url <?php if ($post['type'] == 'url') echo 'wpallimport-download-from-checked'; ?>" rel="url" href="javascript:void(0);">
88
+ <span class="wpallimport-download-from-title"><?php _e('From URL', 'wp_all_import_plugin'); ?></span>
89
+ <span class="wpallimport-download-from-arrow"></span>
90
+ </a>
91
+ <a class="wpallimport-download-from rad4 wpallimport-download-file-from-ftp <?php if ($post['type'] == 'ftp') echo 'wpallimport-download-from-checked'; ?>" rel="ftp" href="javascript:void(0);">
92
+ <span class="wpallimport-download-from-title"><?php _e('From FTP/SFTP', 'wp_all_import_plugin'); ?></span>
93
+ <span class="wpallimport-download-from-arrow"></span>
94
+ </a>
95
+ </div>
96
+ </div>
 
 
 
 
97
  <div class="wpallimport-upload-type-container" rel="file_type">
98
  <?php $upload_dir = wp_upload_dir(); ?>
99
  <div class="wpallimport-file-type-options">
121
  </div>
122
  <div id="wpallimport-url-upload-status"></div>
123
 
124
+ <?php if (empty($_GET['deligate'])): ?>
125
+ <div class="wpallimport-download-resource-step-two">
126
+ <div class="wpallimport-download-resource wpallimport-download-resource-step-two-url">
127
+ <div class="wpallimport-file-type-options">
128
+ <span class="wpallimport-input-icon wpallimport-url-icon"></span>
129
+ <input type="text" class="regular-text" name="url" value="<?php echo ( ! empty($post['url'])) ? esc_attr($post['url']) : ''; ?>" placeholder="Enter a web address to download the file from..."/>
130
+ <a class="wpallimport-download-from-url rad4" href="javascript:void(0);"><?php _e('Download', 'wp_all_import_plugin'); ?></a>
131
+ <span class="img_preloader" style="top:0; left: 5px; visibility: hidden; display: inline;"></span>
132
+ </div>
133
+ <div class="wpallimport-note" style="margin: 20px auto 0; font-size: 13px;">
134
+ <?php _e('<strong>Hint:</strong> After you create this import, you can schedule it to run automatically, on a pre-defined schedule, with cron jobs.', 'wp_all_import_plugin'); ?>
135
+ <div class="wpallimport-free-edition-notice" style="display:none;">
136
+ <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707176&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=download-from-url" target="_blank" class="upgrade_link"><?php _e('Upgrade to the Pro edition of WP All Import to Download from URL', 'wp_all_import_plugin');?></a>
137
+ <p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
138
+ </div>
139
+ </div>
140
+ <input type="hidden" name="downloaded" value="<?php echo esc_attr($post['downloaded']); ?>"/>
141
+ <input type="hidden" name="template" value="<?php echo esc_attr($post['template']); ?>"/>
142
+ </div>
143
+ <div class="wpallimport-download-resource wpallimport-download-resource-step-two-ftp">
144
+ <div class="wpallimport-file-type-options">
145
+ <span class="wpallimport-input-icon wpallimport-ftp-host-icon"></span>
146
+ <input type="text" class="regular-text" name="ftp_host" value="<?php echo ( ! empty($post['ftp_host'])) ? esc_attr($post['ftp_host']) : ''; ?>" placeholder="FTP server address"/>
147
+ <a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" title="<?php _e('The server address of your FTP/SFTP server. This can be an IP address or domain name. You do not need to include the connection protocol. For example, files.example.com or 127.0.0.1', PMXI_Plugin::LANGUAGE_DOMAIN); ?>">?</a>
148
+ </div>
149
+ <div class="wpallimport-file-type-options">
150
+ <span class="wpallimport-input-icon wpallimport-ftp-port-icon"></span>
151
+ <input type="text" class="regular-text" name="ftp_port" value="<?php echo ( ! empty($post['ftp_port'])) ? esc_attr($post['ftp_port']) : ''; ?>" placeholder="FTP port"/>
152
+ <a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" title="<?php _e('The port that your server uses. FTP usually uses port 21, SFTP usually uses port 22', PMXI_Plugin::LANGUAGE_DOMAIN); ?>">?</a>
153
+ </div>
154
+ <div class="wpallimport-file-type-options">
155
+ <span class="wpallimport-input-icon wpallimport-ftp-username-icon"></span>
156
+ <input type="text" class="regular-text" name="ftp_username" value="<?php echo ( ! empty($post['ftp_username'])) ? esc_attr($post['ftp_username']) : ''; ?>" placeholder="FTP username"/>
157
+ <a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" title="<?php _e('If you don\'t know your FTP/SFTP username, contact the host of the server.', PMXI_Plugin::LANGUAGE_DOMAIN); ?>">?</a>
158
+ </div>
159
+ <div class="wpallimport-file-type-options">
160
+ <span class="wpallimport-input-icon wpallimport-ftp-password-icon"></span>
161
+ <input type="text" class="regular-text" name="ftp_password" value="<?php echo ( ! empty($post['ftp_password'])) ? esc_attr($post['ftp_password']) : ''; ?>" placeholder="FTP password"/>
162
+ <a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" title="<?php _e('These passwords are stored in plaintext in your WordPress database. Ideally, the user account should only have read access to the files that you are importing.
163
+ <br/><br/>Even if the password is correct, sometimes your host will require SFTP connections to use an SSH key and will deny connection attempts using passwords. If you\'re unable to login and you are sure the password is correct, contact the host of the server.', PMXI_Plugin::LANGUAGE_DOMAIN); ?>">?</a>
164
+ </div>
165
+ <div class="wpallimport-file-type-options">
166
+ <span class="wpallimport-input-icon wpallimport-ftp-private-key-icon"></span>
167
+ <textarea class="wpai-ftp-text-area" name="ftp_private_key" value="<?php echo ( ! empty($post['ftp_private_key'])) ? esc_attr($post['ftp_private_key']) : ''; ?>" placeholder="SFTP Private Key"></textarea>
168
+ <a class="wpallimport-help" id="wpai-ftp-text-area-help" href="#help" style="position: relative; top: -2px;" title="<?php _e('If you don\'t know if you need an SFTP Private Key, contact the host of the server.', PMXI_Plugin::LANGUAGE_DOMAIN); ?>">?</a>
169
+ </div>
170
+ <div class="wpallimport-file-type-options ftp_path">
171
+
172
+ <input type="text" class="regular-text" name="ftp_path"
173
+ value="<?php echo ( ! empty( $post['ftp_path'] ) ) ? esc_attr( $post['ftp_path'] ) : ''; ?>"
174
+ placeholder="FTP file path"/>
175
+
176
+ <a class="wpallimport-ftp-builder rad4 button button-primary button-hero wpallimport-large-button wpai-ftp-select-file-button"
177
+ href="javascript:void(0);">
178
+ <div class="easing-spinner"
179
+ style="display: none; left: 36px !important; top: 2px;">
180
+ <div class="double-bounce1"></div>
181
+ <div class="double-bounce2"></div>
182
+ </div>
183
+ <?php _e( 'Select File', 'wp_all_import_plugin' ); ?>
184
+ </a>
185
 
186
+ </div>
187
+ <div style="display:block;position:relative;width:75%;margin:auto;">
188
+ <span class="wpallimport-input-icon wpallimport-ftp-path-icon"></span>
189
+ <a class="wpallimport-help" href="#help"
190
+ style="position: absolute;top: -32px;right: -30px;"
191
+ title="<?php _e( 'The path to the file you want to import. In case multiple files are found, only the first will be downloaded. Examples: /home/ftpuser/import.csv or import-files/*.csv', PMXI_Plugin::LANGUAGE_DOMAIN ); ?>">?</a>
192
+ </div>
193
 
194
+ <span class="wpallimport-ftp-builder-wrap">
195
+ <div class="wpallimport-ftp-connection-builder" id="wpallimport-ftp-connection-builder"></div>
196
+ <input type="hidden" id="wpai-ftp-browser-nonce" value="<?php echo wp_create_nonce( 'wpai-ftp-browser' ); ?>"/>
197
+ </span>
198
+
199
+ <div class="rad4 first-step-errors wpai-ftp-connection-error">
200
+ <div class="wpallimport-notify-wrapper">
201
+ <div class="error-headers exclamation">
202
+ <h3><?php _e('Unable to Connect', 'wp_all_import_plugin');?></h3>
203
+ <br/>
204
+ <span id="wpai-ftp-connection-error-message"></span>
205
+ </div>
206
+ </div>
207
+ </div>
208
 
209
+ <br/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
 
211
+ <div class="wpallimport-note" style="margin: 20px auto 0; font-size: 13px;">
212
+ <div class="wpallimport-free-edition-notice" style="display:none;">
213
+ <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707176&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=download-from-url" target="_blank" class="upgrade_link"><?php _e('Upgrade to the Pro edition of WP All Import to Download from FTP/SFTP', 'wp_all_import_plugin');?></a>
214
+ <p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
215
+ </div>
216
+ </div>
217
 
218
+ <div class="input" style="display:none;">
219
+ <a class="wpallimport-download-from-url rad4" href="javascript:void(0);"><?php _e('Download', 'wp_all_import_plugin'); ?></a>
220
+ <span class="img_preloader" style="top:0; left: 5px; visibility: hidden; display: inline;"></span>
221
+ </div>
222
+ </div>
223
+ </div>
224
+ <div class="wpallimport-upload-resource-step-two">
225
+ <div class="wpallimport-choose-post-type">
226
+
227
+ <input type="hidden" name="wizard_type" value="<?php echo $post['wizard_type']; ?>"/>
228
+
229
+ <h2 style="margin-top:0;"><?php _e('Import data from this file into...', 'wp_all_import_plugin'); ?></h2>
230
+
231
+ <div class="wpallimport-choose-data-type">
232
+ <a class="wpallimport-import-to rad4 wpallimport-to-new-items <?php if ($post['wizard_type'] == 'new') echo 'wpallimport-import-to-checked'; ?>" rel="new" href="javascript:void(0);">
233
+ <span class="wpallimport-import-to-title"><?php _e('New Items', 'wp_all_import_plugin'); ?></span>
234
+ <span class="wpallimport-import-to-arrow"></span>
235
+ </a>
236
+ <a class="wpallimport-import-to rad4 wpallimport-to-existing-items <?php if ($post['wizard_type'] == 'matching') echo 'wpallimport-import-to-checked'; ?>" rel="matching" href="javascript:void(0);">
237
+ <span class="wpallimport-import-to-title"><?php _e('Existing Items', 'wp_all_import_plugin'); ?></span>
238
+ <span class="wpallimport-import-to-arrow"></span>
239
+ </a>
240
+ </div>
241
 
242
  <?php
243
+
244
+ $all_types = array();
245
+ $sort_order = array();
246
+
247
+ $hiddenPosts = array(
248
+ 'attachment',
249
+ 'revision',
250
+ 'nav_menu_item',
251
+ 'shop_webhook',
252
+ 'import_users',
253
+ 'wp-types-group',
254
+ 'wp-types-user-group',
255
+ 'wp-types-term-group',
256
+ 'acf-field',
257
+ 'acf-field-group',
258
+ 'custom_css',
259
+ 'customize_changeset',
260
+ 'oembed_cache',
261
+ 'wp_block',
262
+ 'user_request',
263
+ 'scheduled-action'
264
+ );
265
+
266
+ $custom_types = get_post_types(array('_builtin' => true), 'objects') + get_post_types(array('_builtin' => false, 'show_ui' => true), 'objects');
267
+ foreach ($custom_types as $key => $ct) {
268
+ if (in_array($key, $hiddenPosts)) unset($custom_types[$key]);
269
  }
 
270
 
271
+ $custom_types = apply_filters( 'pmxi_custom_types', $custom_types, 'custom_types' );
272
+
273
+ $sorted_cpt = array();
274
+ foreach ($custom_types as $key => $cpt){
275
+
276
+ $sorted_cpt[$key] = $cpt;
277
+
278
+ // Put users & comments & taxonomies after Pages
279
+ if ( ! empty($custom_types['page']) && $key == 'page' || empty($custom_types['page']) && $key == 'post' ){
280
 
281
+ $sorted_cpt['taxonomies'] = new stdClass();
282
+ $sorted_cpt['taxonomies']->labels = new stdClass();
283
+ $sorted_cpt['taxonomies']->labels->name = __('Taxonomies','wp_all_export_plugin');
284
 
285
+ $sorted_cpt['import_users'] = new stdClass();
286
+ $sorted_cpt['import_users']->labels = new stdClass();
287
+ $sorted_cpt['import_users']->labels->name = __('Users','wp_all_export_plugin');
288
+
289
+ $sorted_cpt['comments'] = new stdClass();
290
+ $sorted_cpt['comments']->labels = new stdClass();
291
+ $sorted_cpt['comments']->labels->name = __('Comments','wp_all_export_plugin');
292
+
293
+ break;
294
  }
295
+ }
296
+ $order = array('shop_order', 'shop_coupon', 'shop_customer', 'product');
297
+ foreach ($order as $cpt){
298
+ if (!empty($custom_types[$cpt])) $sorted_cpt[$cpt] = $custom_types[$cpt];
299
+ }
300
+
301
+ uasort($custom_types, "wp_all_import_cmp_custom_types");
302
+
303
+ foreach ($custom_types as $key => $cpt) {
304
+ if (empty($sorted_cpt[$key])){
305
+ $sorted_cpt[$key] = $cpt;
306
  }
307
+ }
308
 
309
+ $hidden_post_types = get_post_types(array('_builtin' => false, 'show_ui' => false), 'objects');
310
+ foreach ($hidden_post_types as $key => $ct) {
311
+ if (in_array($key, $hiddenPosts)) unset($hidden_post_types[$key]);
312
+ }
313
+ $hidden_post_types = apply_filters( 'pmxi_custom_types', $hidden_post_types, 'hidden_post_types' );
314
 
315
+ ?>
316
+ <div class="wpallimport-choose-import-direction">
317
+ <div class="wpallimport-extra-text-left">
318
+ <div class="wpallimport-new-records"><?php _e('Create new', 'wp_all_import_plugin'); ?></div>
319
+ <div class="wpallimport-existing-records"><?php _e('Import to existing', 'wp_all_import_plugin'); ?></div>
320
+ </div>
321
+ <div class="wpallimport-extra-text-right">
322
+ <div class="wpallimport-new-records"><?php _e('for each record in my data file.', 'wp_all_import_plugin'); ?>
323
+ <a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" title="The New Items option is commonly used to import new posts or products to your site without touching the existing records.<br/><br/>If the import is later run again with modified data, WP All Import will only update/remove posts created by this import.">?</a>
324
+ </div>
325
+ <div class="wpallimport-existing-records"><?php _e('and update some or all of their data.', 'wp_all_import_plugin'); ?>
326
+ <a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" title="The Existing Items option is commonly used to update existing products with new stock quantities while leaving all their other data alone, update properties on your site with new pricing, etc. <br/><br/> In Step 4, you will map the records in your file to the existing items on your site and specify which data points will be updated and which will be left alone.">?</a>
327
+ </div>
328
+ </div>
329
+ <select name="custom_type_selector" id="custom_type_selector" class="wpallimport-post-types">
330
 
331
+ <?php
332
+ // *****************************************************
333
+ // **************** START CPT LOOP *********************
334
+ // *****************************************************
335
+ ?>
336
 
 
 
 
 
 
337
 
338
+ <?php
339
+ $known_imgs = array( 'post', 'page', 'product', 'import_users', 'shop_order', 'shop_coupon', 'shop_customer', 'users', 'comments', 'taxonomies', 'woo_reviews' );
340
+ $all_posts = array_merge( $sorted_cpt, $hidden_post_types );
341
+ $all_posts = apply_filters( 'pmxi_custom_types', $all_posts, 'all_types' );
342
+ $ordered_posts = array( 'post', 'page', 'taxonomies', 'comments', 'import_users', 'shop_order', 'shop_coupon', 'product', 'woo_reviews', 'shop_customer');
343
 
344
+ foreach ( $all_posts as $key => $post_obj ) {
345
+ if ( ! in_array( $key, $ordered_posts ) ) {
346
+ array_push( $ordered_posts, $key );
347
+ }
348
  }
349
 
350
+ $order_arr = apply_filters( 'pmxi_post_list_order', $ordered_posts );
351
+ $image_data = apply_filters( 'wp_all_import_post_type_image', array() );
352
 
353
+ foreach ( $order_arr as $key => $post_name ) {
354
+ if ( array_key_exists( $post_name, $all_posts ) ) {
355
+ $post_obj = $all_posts[ $post_name ];
356
 
357
+ if ( in_array( $post_name, $known_imgs ) ) {
358
+ $image_src = 'dashicon-' . $post_name;
359
+ } else {
360
+ $image_src = 'dashicon-cpt';
361
+ }
362
+ if ( ! empty( $image_data ) && array_key_exists( $post_name, $image_data ) ) {
363
+ $custom_img_defined = true;
364
+ } else {
365
+ $custom_img_defined = false;
366
+ }
367
 
368
+ $original_image_src = $image_src;
369
+ $cpt = $post_name;
370
+ $cpt_label = $post_obj->labels->name;
371
+
372
+ $custom_selected_post = apply_filters( 'wpai_custom_selected_post', false, $post, $cpt, 'step1' );
373
+
374
+ $img_to_echo = 'dashicon ';
375
+
376
+ if ( $custom_img_defined === true ) {
377
+ $img_to_echo .= $image_data[ $cpt ]['image'];
378
+ } else {
379
+ $img_to_echo .= $image_src;
380
+ }
381
+
382
+ ?>
383
+
384
+ <option value="<?php echo $cpt; ?>" data-imagesrc="<?php echo $img_to_echo; ?>" <?php if ( $custom_selected_post === true ):?>selected="selected"<?php else: if ( $cpt == $post['custom_type'] ):?>selected="selected"<?php endif; endif; ?>><?php echo $cpt_label; ?></option>
385
+ <?php
386
+ }
387
+ }
388
+ ?>
389
+
390
+ </select>
391
+
392
+ <?php
393
+ // *****************************************************
394
+ // **************** FINISH CPT LOOP ********************
395
+ // *****************************************************
396
+ ?>
397
+
398
+ <?php if ( ! class_exists('PMUI_Plugin') ): ?>
399
+ <div class="wpallimport-upgrade-notice" rel="import_users">
400
+ <p><?php _e('The User Add-On is Required to Import Users', 'wp_all_import_plugin'); ?></p>
401
+ <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" class="upgrade_link"><?php _e('Purchase the User Add-On', 'wp_all_import_plugin');?></a>
402
+ </div>
403
+ <?php endif; ?>
404
+ <?php if ( class_exists('WooCommerce') && ! class_exists('PMWI_Plugin') ): ?>
405
+ <div class="wpallimport-upgrade-notice" rel="product">
406
+ <p><?php _e('The WooCommerce Add-On is Required to Import Products', 'wp_all_import_plugin'); ?></p>
407
+ <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707227&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-wooco-products" target="_blank" class="upgrade_link"><?php _e('Purchase the WooCommerce Add-On', 'wp_all_import_plugin');?></a>
408
+ </div>
409
+ <?php endif; ?>
410
+ <?php if ( class_exists('WooCommerce') && ( ! class_exists('PMWI_Plugin') || class_exists('PMWI_Plugin') && PMWI_EDITION == 'free') ): ?>
411
+ <div class="wpallimport-upgrade-notice" rel="shop_order">
412
+ <?php if (class_exists('PMWI_Plugin') && PMWI_EDITION == 'free'): ?>
413
+ <p><?php _e('The Pro version of the WooCommerce Add-On is required to Import Orders, but you have the free version installed.', 'wp_all_import_plugin'); ?></p>
414
+ <?php else: ?>
415
+ <p><?php _e('The WooCommerce Add-On Pro is Required to Import Orders', 'wp_all_import_plugin'); ?></p>
416
+ <?php endif; ?>
417
+ <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707227&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-wooco-orders" target="_blank" class="upgrade_link"><?php _e('Purchase the WooCommerce Add-On', 'wp_all_import_plugin');?></a>
418
+ </div>
419
+ <div class="wpallimport-upgrade-notice" rel="shop_coupon">
420
+ <?php if (class_exists('PMWI_Plugin') && PMWI_EDITION == 'free'): ?>
421
+ <p><?php _e('The Pro version of the WooCommerce Add-On is required to Import Coupons, but you have the free version installed.', 'wp_all_import_plugin'); ?></p>
422
+ <?php else: ?>
423
+ <p><?php _e('The WooCommerce Add-On Pro is Required to Import Coupons', 'wp_all_import_plugin'); ?></p>
424
+ <?php endif; ?>
425
+ <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707227&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-wooco-coupons" target="_blank" class="upgrade_link"><?php _e('Purchase the WooCommerce Add-On', 'wp_all_import_plugin');?></a>
426
+ </div>
427
+ <?php endif; ?>
428
+ <div class="wpallimport-upgrade-notice" rel="taxonomies">
429
+ <p><?php _e('WP All Import Pro is Required to Import Taxonomies', 'wp_all_import_plugin'); ?></p>
430
+ <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707176&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-taxonomies" target="_blank" class="upgrade_link"><?php _e('Purchase WP All Import Pro', 'wp_all_import_plugin');?></a>
431
  </div>
432
+ <div class="wpallimport-upgrade-notice" rel="comments">
433
+ <p><?php _e('WP All Import Pro is Required to Import Comments', 'wp_all_import_plugin'); ?></p>
434
+ <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707176&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-comments" target="_blank" class="upgrade_link"><?php _e('Purchase WP All Import Pro', 'wp_all_import_plugin');?></a>
435
+ </div>
436
+ <div class="wpallimport-upgrade-notice" rel="woo_reviews">
437
+ <p><?php _e('The WooCommerce Import Package is Required to Import Reviews', 'wp_all_import_plugin'); ?></p>
438
+ <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707227&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=import-reviews" target="_blank" class="upgrade_link"><?php _e('Purchase the WooCommerce Import Package', 'wp_all_import_plugin');?></a>
439
+ </div>
440
+ <?php if ( class_exists('WooCommerce') && ! class_exists('PMUI_Plugin') ): ?>
441
+ <div class="wpallimport-upgrade-notice" rel="shop_customer">
442
+ <p><?php _e('The User Add-On is Required to Import Customers', 'wp_all_import_plugin'); ?></p>
443
+ <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"><?php _e('Purchase the User Add-On', 'wp_all_import_plugin');?></a>
444
+ </div>
445
+ <?php endif; ?>
446
 
447
 
448
+ </div>
449
+ <div class="clear wpallimport-extra-text-below">
450
+ <!--div class="wpallimport-existing-records">
451
+ <p><?php _e('In Step 4, you will map the records in your file to the existing items on your site and specify which data points will be updated and which will be left alone.', 'wp_all_import_plugin'); ?></p>
452
+ <p><?php _e('The Existing Items option is commonly used to update existing products with new stock quantities while leaving all their other data alone, update properties on your site with new pricing, etc.', 'wp_all_import_plugin'); ?></p>
453
+ </div-->
454
+ </div>
455
+ </div>
456
+ </div>
457
  <?php endif; ?>
458
  </div>
459
 
views/admin/import/options/_import_file.php CHANGED
@@ -47,9 +47,9 @@
47
  <span class="wpallimport-icon"></span>
48
  <span class="wpallimport-icon-label"><?php _e('Upload a file', 'wp_all_import_plugin'); ?></span>
49
  </a>
50
- <a class="wpallimport-import-from wpallimport-url-type <?php echo 'url' == $import->type ? 'selected' : '' ?>" rel="url_type" href="javascript:void(0);">
51
  <span class="wpallimport-icon"></span>
52
- <span class="wpallimport-icon-label"><?php _e('Download from URL', 'wp_all_import_plugin'); ?></span>
53
  </a>
54
  <a class="wpallimport-import-from wpallimport-file-type <?php echo 'file' == $import->type ? 'selected' : '' ?>" rel="file_type" href="javascript:void(0);">
55
  <span class="wpallimport-icon"></span>
@@ -73,17 +73,18 @@
73
  </div>
74
  </div>
75
  </div>
76
- <div class="wpallimport-upload-type-container" rel="url_type">
77
- <div class="wpallimport-file-type-options">
78
- <span class="wpallimport-url-icon"></span>
79
- <input type="text" class="regular-text" name="url" value="<?php echo ('url' == $import->type) ? esc_attr($import->path) : 'Enter a web address to download the file from...'; ?>"/>
80
- <div class="wpallimport-free-edition-notice">
81
- <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707176&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=download-from-url" target="_blank" class="upgrade_link"><?php _e('Upgrade to the Pro edition of WP All Import to Download from URL', 'wp_all_import_plugin');?></a>
82
- <p style="margin-top:16px;"><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
83
- </div>
84
- </div>
85
- <input type="hidden" name="downloaded"/>
86
- </div>
 
87
  <div class="wpallimport-upload-type-container" rel="file_type">
88
  <?php $upload_dir = wp_upload_dir(); ?>
89
  <div class="wpallimport-file-type-options">
@@ -108,7 +109,92 @@
108
  <p style="margin-top:16px;"><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
109
  </div>
110
  </div>
111
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  </td>
113
  </tr>
114
  </table>
47
  <span class="wpallimport-icon"></span>
48
  <span class="wpallimport-icon-label"><?php _e('Upload a file', 'wp_all_import_plugin'); ?></span>
49
  </a>
50
+ <a class="wpallimport-import-from wpallimport-url-type <?php echo ('url' == $import->type || 'ftp' == $import->type) ? 'selected' : '' ?>" rel="url_type" href="javascript:void(0);">
51
  <span class="wpallimport-icon"></span>
52
+ <span class="wpallimport-icon-label"><?php _e('Download a file', 'wp_all_import_plugin'); ?></span>
53
  </a>
54
  <a class="wpallimport-import-from wpallimport-file-type <?php echo 'file' == $import->type ? 'selected' : '' ?>" rel="file_type" href="javascript:void(0);">
55
  <span class="wpallimport-icon"></span>
73
  </div>
74
  </div>
75
  </div>
76
+ <div class="wpallimport-upload-type-container" rel="url_type">
77
+ <div class="wpallimport-choose-data-type">
78
+ <a class="wpallimport-download-from rad4 wpallimport-download-file-from-url <?php if ($import->type == 'url') echo 'wpallimport-download-from-checked'; ?>" rel="url" href="javascript:void(0);">
79
+ <span class="wpallimport-download-from-title"><?php _e('From URL', 'wp_all_import_plugin'); ?></span>
80
+ <span class="wpallimport-download-from-arrow"></span>
81
+ </a>
82
+ <a class="wpallimport-download-from rad4 wpallimport-download-file-from-ftp <?php if ($import->type == 'ftp') echo 'wpallimport-download-from-checked'; ?>" rel="ftp" href="javascript:void(0);">
83
+ <span class="wpallimport-download-from-title"><?php _e('From FTP/SFTP', 'wp_all_import_plugin'); ?></span>
84
+ <span class="wpallimport-download-from-arrow"></span>
85
+ </a>
86
+ </div>
87
+ </div>
88
  <div class="wpallimport-upload-type-container" rel="file_type">
89
  <?php $upload_dir = wp_upload_dir(); ?>
90
  <div class="wpallimport-file-type-options">
109
  <p style="margin-top:16px;"><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
110
  </div>
111
  </div>
112
+ </div>
113
+ <div class="wpallimport-download-resource-step-two">
114
+ <div class="wpallimport-download-resource wpallimport-download-resource-step-two-url">
115
+ <div class="wpallimport-file-type-options">
116
+ <span class="wpallimport-input-icon wpallimport-url-icon"></span>
117
+ <input type="text" class="regular-text" name="url" value="<?php echo ('url' == $import->type) ? esc_attr($import->path) : 'Enter a web address to download the file from...'; ?>"/>
118
+ <!--a href="javascript:void(0);" class="wpallimport-download-from-url"><?php _e('Upload', 'wp_all_import_plugin'); ?></a-->
119
+ </div>
120
+ <div class="wpallimport-free-edition-notice">
121
+ <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707176&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=download-from-url" target="_blank" class="upgrade_link"><?php _e('Upgrade to the Pro edition of WP All Import to Download from URL', 'wp_all_import_plugin');?></a>
122
+ <p style="margin-top:16px;"><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
123
+ </div>
124
+ <input type="hidden" name="downloaded"/>
125
+ </div>
126
+ <div class="wpallimport-download-resource wpallimport-download-resource-step-two-ftp">
127
+ <div class="wpallimport-file-type-options">
128
+ <span class="wpallimport-input-icon wpallimport-ftp-host-icon"></span>
129
+ <input type="text" class="regular-text" name="ftp_host" value="<?php echo ( ! empty($import->options['ftp_host'])) ? esc_attr($import->options['ftp_host']) : ''; ?>" placeholder="Enter FTP server address"/>
130
+ <a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" title="<?php _e('The server address of your FTP/SFTP server. This can be an IP address or domain name. You do not need to include the connection protocol. For example, files.example.com or 127.0.0.1', PMXI_Plugin::LANGUAGE_DOMAIN); ?>">?</a>
131
+ </div>
132
+ <div class="wpallimport-file-type-options">
133
+ <span class="wpallimport-input-icon wpallimport-ftp-port-icon"></span>
134
+ <input type="text" class="regular-text" name="ftp_port" value="<?php echo ( ! empty($import->options['ftp_port'])) ? esc_attr($import->options['ftp_port']) : ''; ?>" placeholder="Enter FTP port"/>
135
+ <a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" title="<?php _e('The port that your server uses. FTP usually uses port 21, SFTP usually uses port 22', PMXI_Plugin::LANGUAGE_DOMAIN); ?>">?</a>
136
+ </div>
137
+ <div class="wpallimport-file-type-options">
138
+ <span class="wpallimport-input-icon wpallimport-ftp-username-icon"></span>
139
+ <input type="text" class="regular-text" name="ftp_username" value="<?php echo ( ! empty($import->options['ftp_username'])) ? esc_attr($import->options['ftp_username']) : ''; ?>" placeholder="Enter FTP username"/>
140
+ <a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" title="<?php _e('If you don\'t know your FTP/SFTP username, contact the host of the server.', PMXI_Plugin::LANGUAGE_DOMAIN); ?>">?</a>
141
+ </div>
142
+ <div class="wpallimport-file-type-options">
143
+ <span class="wpallimport-input-icon wpallimport-ftp-password-icon"></span>
144
+ <input type="text" class="regular-text" name="ftp_password" value="<?php echo ( ! empty($import->options['ftp_password'])) ? esc_attr($import->options['ftp_password']) : ''; ?>" placeholder="Enter FTP password"/>
145
+ <a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" title="<?php _e('These passwords are stored in plaintext in your WordPress database. Ideally, the user account should only have read access to the files that you are importing.
146
+ <br/><br/>Even if the password is correct, sometimes your host will require SFTP connections to use an SSH key and will deny connection attempts using passwords. If you\'re unable to login, you don\'t have a SSH/SFTP Private Key, and you are sure the password is correct, contact the host of the server.', PMXI_Plugin::LANGUAGE_DOMAIN); ?>">?</a>
147
+ </div>
148
+ <div class="wpallimport-file-type-options">
149
+ <span class="wpallimport-input-icon wpallimport-ftp-private-key-icon"></span>
150
+ <textarea class="wpai-ftp-text-area" name="ftp_private_key" placeholder="SFTP Private Key"><?php echo ( ! empty($import->options['ftp_private_key'])) ? esc_attr($import->options['ftp_private_key']) : ''; ?></textarea>
151
+ <a class="wpallimport-help" id="wpai-ftp-text-area-help" href="#help" style="position: relative; top: -2px;" title="<?php _e('If you don\'t know if you need an SFTP Private Key, contact the host of the server.', PMXI_Plugin::LANGUAGE_DOMAIN); ?>">?</a>
152
+ </div>
153
+ <div class="wpallimport-file-type-options ftp_path">
154
+
155
+ <input type="text" class="regular-text" name="ftp_path"
156
+ value="<?php echo ( ! empty($import->options['ftp_path'])) ? esc_attr($import->options['ftp_path']) : ''; ?>"
157
+ placeholder="FTP file path"/>
158
+
159
+ <a class="wpallimport-ftp-builder rad4 button button-primary button-hero wpallimport-large-button wpai-ftp-select-file-button"
160
+ href="javascript:void(0);">
161
+ <div class="easing-spinner"
162
+ style="display: none; left: 36px !important; top: 2px;">
163
+ <div class="double-bounce1"></div>
164
+ <div class="double-bounce2"></div>
165
+ </div>
166
+ <?php _e( 'Select File', 'wp_all_import_plugin' ); ?>
167
+ </a>
168
+
169
+ </div>
170
+ <div style="display:block;position:relative;width:75%;margin:auto;">
171
+ <span class="wpallimport-input-icon wpallimport-ftp-path-icon"></span>
172
+ <a class="wpallimport-help" href="#help"
173
+ style="position: absolute;top: -32px;right: -30px;"
174
+ title="<?php _e( 'The path to the file you want to import. In case multiple files are found, only the first will be downloaded. Examples: /home/ftpuser/import.csv or import-files/*.csv', PMXI_Plugin::LANGUAGE_DOMAIN ); ?>">?</a>
175
+ </div>
176
+
177
+ <span class="wpallimport-ftp-builder-wrap">
178
+ <div class="wpallimport-ftp-connection-builder" id="wpallimport-ftp-connection-builder"></div>
179
+ <input type="hidden" id="wpai-ftp-browser-nonce" value="<?php echo wp_create_nonce( 'wpai-ftp-browser' ); ?>"/>
180
+ </span>
181
+
182
+ <div class="rad4 first-step-errors wpai-ftp-connection-error">
183
+ <div class="wpallimport-notify-wrapper">
184
+ <div class="error-headers exclamation">
185
+ <h3><?php _e('Unable to Connect', 'wp_all_import_plugin');?></h3>
186
+ <br/>
187
+ <span id="wpai-ftp-connection-error-message"></span>
188
+ </div>
189
+ </div>
190
+ </div>
191
+
192
+ <div class="wpallimport-free-edition-notice">
193
+ <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=2707176&edd_options%5Bprice_id%5D=1&utm_source=import-plugin-free&utm_medium=upgrade-notice&utm_campaign=download-from-url" target="_blank" class="upgrade_link"><?php _e('Upgrade to the Pro edition of WP All Import to Download from FTP/SFTP', 'wp_all_import_plugin');?></a>
194
+ <p style="margin-top:16px;"><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
195
+ </div>
196
+ </div>
197
+ </div>
198
  </td>
199
  </tr>
200
  </table>
views/admin/import/options/_settings_template.php CHANGED
@@ -9,27 +9,16 @@
9
  <tr>
10
  <td colspan="3">
11
  <h4><?php _e('Import Speed Optimization', 'wp_all_import_plugin'); ?></h4>
12
- <div class="input">
13
- <div class="input">
14
- <input type="radio" id="import_default_processing" class="switcher" name="import_processing" value="default" <?php echo ('ajax' != $post['import_processing']) ? 'checked="checked"': '' ?> style="margin-left:0;"/>
15
- <label for="import_default_processing"><?php _e('High Speed Small File Processing', 'wp_all_import_plugin' )?> <a href="#help" class="wpallimport-help" style="position:relative; top:0;" title="<?php _e('If the import takes longer than your server\'s timeout settings (max_execution_time, mod_fcgid read data timeout, etc.) it will fail.', 'wp_all_import_plugin'); ?>">?</a></label>
16
- </div>
17
-
18
- <input type="radio" id="import_ajax_processing" class="switcher" name="import_processing" value="ajax" <?php echo 'ajax' == $post['import_processing'] ? 'checked="checked"': '' ?> style="margin-left:0;"/>
19
- <label for="import_ajax_processing"><?php _e('Iterative, Piece-by-Piece Processing', 'wp_all_import_plugin' )?></label>
20
-
21
- <span class="switcher-target-import_ajax_processing pl17" style="display:block; clear: both; width: 100%;">
22
- <div class="pl17" style="margin:5px 0px;">
23
- <label for="records_per_request"><?php _e('In each iteration, process', 'wp_all_import_plugin');?></label> <input type="text" name="records_per_request" style="vertical-align:middle; font-size:11px; background:#fff !important; width: 40px; text-align:center;" value="<?php echo esc_attr($post['records_per_request']) ?>" /> <?php _e('records', 'wp_all_import_plugin'); ?>
24
- <a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('WP All Import must be able to process this many records in less than your server\'s timeout settings. If your import fails before completion, to troubleshoot you should lower this number. If you are importing images, especially high resolution images, high numbers here are probably a bad idea, since downloading the images can take lots of time - for example, 20 posts with 5 images each = 100 images. At 500Kb per image that\'s 50Mb that needs to be downloaded. Can your server download that before timing out? If not, the import will fail.', 'wp_all_import_plugin'); ?>">?</a>
25
- </div>
26
- <div class="input pl17" style="margin:5px 0px;">
27
- <input type="hidden" name="chuncking" value="0" />
28
- <input type="checkbox" id="chuncking" name="chuncking" value="1" class="fix_checkbox" <?php echo $post['chuncking'] ? 'checked="checked"': '' ?>/>
29
- <label for="chuncking"><?php _e('Split file up into <strong>' . PMXI_Plugin::getInstance()->getOption('large_feed_limit') . '</strong> record chunks.', 'wp_all_import_plugin');?></label>
30
- <a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('This option will decrease the amount of slowdown experienced at the end of large imports. The slowdown is partially caused by the need for WP All Import to read deeper and deeper into the file on each successive iteration. 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, WP All Import will just split it into 20 chunks, and then read the last chunk from the beginning.','wp_all_import_plugin'); ?>">?</a>
31
- </div>
32
- </span>
33
  </div>
34
  <div class="input">
35
  <input type="hidden" name="is_fast_mode" value="0" />
@@ -39,33 +28,52 @@
39
  </div>
40
  <?php if ( ! $this->isWizard ): ?>
41
 
42
- <h4><?php _e('Post Type', 'wp_all_import_plugin'); ?></h4>
43
- <p><?php _e('Editing this will change the post type of the posts processed by this import. Re-run the import for the changes to take effect.', 'wp_all_import_plugin');?></p> <br>
44
-
 
 
 
 
45
 
46
- <input type="hidden" name="custom_type" value="<?php echo $post['custom_type'];?>">
47
-
 
 
 
 
 
 
 
 
 
 
 
 
48
  <?php
49
  $hiddenPosts = array(
50
- 'attachment',
51
- 'revision',
52
- 'nav_menu_item',
53
- 'shop_webhook',
54
- 'import_users',
55
- 'wp-types-group',
56
- 'wp-types-user-group',
57
- 'wp-types-term-group',
58
- 'acf-field',
59
- 'acf-field-group',
60
- 'custom_css',
61
- 'customize_changeset',
62
- 'oembed_cache'
63
- );
 
 
 
64
  $custom_types = get_post_types(array('_builtin' => true), 'objects') + get_post_types(array('_builtin' => false, 'show_ui' => true), 'objects');
65
  foreach ($custom_types as $key => $ct) {
66
  if (in_array($key, $hiddenPosts)) unset($custom_types[$key]);
67
  }
68
- $custom_types = apply_filters( 'pmxi_custom_types', $custom_types );
69
 
70
  $sorted_cpt = array();
71
  foreach ($custom_types as $key => $cpt){
@@ -74,15 +82,18 @@
74
 
75
  // Put users & comments & taxonomies after Pages
76
  if ( ! empty($custom_types['page']) && $key == 'page' || empty($custom_types['page']) && $key == 'post' ){
 
 
 
 
 
77
  $sorted_cpt['import_users'] = new stdClass();
78
  $sorted_cpt['import_users']->labels = new stdClass();
79
  $sorted_cpt['import_users']->labels->name = __('Users','wp_all_export_plugin');
80
 
81
- // if ( class_exists('WooCommerce') ) {
82
- // $sorted_cpt['shop_customer'] = new stdClass();
83
- // $sorted_cpt['shop_customer']->labels = new stdClass();
84
- // $sorted_cpt['shop_customer']->labels->name = __('WooCommerce Customers','wp_all_export_plugin');
85
- // }
86
 
87
  break;
88
  }
@@ -108,20 +119,20 @@
108
 
109
  ?>
110
  <div class="wpallimport-change-custom-type">
111
- <select name="custom_type_selector" id="custom_type_selector" class="wpallimport-post-types">
112
 
113
 
114
- <?php
115
  // *****************************************************
116
  // **************** START CPT LOOP *********************
117
  // *****************************************************
118
  ?>
119
 
120
- <?php
121
- $known_imgs = array( 'post', 'page', 'product', 'import_users', 'shop_order', 'shop_coupon', 'shop_customer', 'users', 'comments', 'taxonomies' );
122
  $all_posts = array_merge( $sorted_cpt, $hidden_post_types );
123
  $all_posts = apply_filters( 'pmxi_custom_types', $all_posts, 'all_types' );
124
- $ordered_posts = array( 0 => 'post', 1 => 'page', 2 => 'taxonomies', 3 => 'import_users', 4 => 'shop_order', 5 => 'shop_coupon', 6 => 'product', 7 => 'shop_customer' );
125
 
126
  foreach ( $all_posts as $key => $post_obj ) {
127
  if ( ! in_array( $key, $ordered_posts ) ) {
@@ -139,7 +150,7 @@
139
  if ( in_array( $post_name, $known_imgs ) ) {
140
  $image_src = 'dashicon-' . $post_name;
141
  } else {
142
- $image_src = 'dashicon-cpt';
143
  }
144
  if ( ! empty( $image_data ) && array_key_exists( $post_name, $image_data ) ) {
145
  $custom_img_defined = true;
@@ -162,14 +173,14 @@
162
  $img_to_echo .= $image_src;
163
  }
164
 
165
- ?>
166
  <option value="<?php echo $cpt; ?>" data-imagesrc="<?php echo $img_to_echo; ?>" <?php if ( $custom_selected_post === true ):?>selected="selected"<?php else: if ( $cpt == $post['custom_type'] ):?>selected="selected"<?php endif; endif; ?>><?php echo $cpt_label; ?></option>
167
- <?php
168
  }
169
 
170
  }
171
- ?>
172
- </select>
173
 
174
  <?php
175
  // *****************************************************
@@ -223,12 +234,12 @@
223
  </div>
224
 
225
  </div>
226
-
227
  <h4><?php _e('XPath', 'wp_all_import_plugin'); ?></h4>
228
  <p><?php _e('Editing this can break your entire import. You will have to re-create it from scratch.', 'wp_all_import_plugin');?></p> <br>
229
  <div class="input">
230
  <input type="text" name="xpath" value="<?php echo esc_attr($import->xpath) ?>" style="width: 50%; font-size: 18px; color: #555; height: 50px; padding: 10px;"/>
231
- </div>
232
  <?php if ( ! empty($post['delimiter']) ): ?>
233
  <h4><?php _e('CSV Delimiter', 'wp_all_import_plugin'); ?></h4>
234
  <div class="input">
@@ -238,8 +249,8 @@
238
  <h4><?php _e('Downloads', 'wp_all_import_plugin'); ?></h4>
239
 
240
  <div class="input">
241
- <button class="button button-primary download_import_template" rel="<?php echo add_query_arg(array('page' => 'pmxi-admin-manage', 'id' => $_GET['id'], 'action' => 'get_template', '_wpnonce' => wp_create_nonce( '_wpnonce-download_template' )), $this->baseUrl); ?>" style="background-image: none;"><?php _e('Import Template', 'wp_all_import_plugin'); ?></button>
242
- <button class="button button-primary download_import_bundle" rel="<?php echo add_query_arg(array('page' => 'pmxi-admin-manage', 'id' => $_GET['id'], 'action' => 'bundle', '_wpnonce' => wp_create_nonce( '_wpnonce-download_bundle' )), $this->baseUrl); ?>" style="background-image: none;"><?php _e('Import Bundle', 'wp_all_import_plugin'); ?></button>
243
  </div>
244
  <?php endif; ?>
245
  <h4><?php _e('Other', 'wp_all_import_plugin'); ?></h4>
@@ -252,7 +263,7 @@
252
  <input type="text" name="import_specified" value="<?php echo esc_attr($post['import_specified']) ?>" style="width:320px;"/>
253
  </div>
254
  </div>
255
- </div>
256
  <?php if (isset($source_type) and in_array($source_type, array('ftp', 'file'))): ?>
257
  <div class="input">
258
  <input type="hidden" name="is_delete_source" value="0" />
@@ -266,7 +277,7 @@
266
  <input type="checkbox" id="is_cloak" class="fix_checkbox" name="is_cloak" value="1" <?php echo $post['is_cloak'] ? 'checked="checked"': '' ?>/>
267
  <label for="is_cloak"><?php _e('Auto-Cloak Links', 'wp_all_import_plugin') ?> <a href="#help" class="wpallimport-help" style="position:relative; top:0;" title="<?php printf(__('Automatically process all links present in body of created post or page with <b>%s</b> plugin', 'wp_all_import_plugin'), PMLC_Plugin::getInstance()->getName()) ?>">?</a></label>
268
  </div>
269
- <?php endif; ?>
270
  <div class="input">
271
  <input type="hidden" name="xml_reader_engine" value="0" />
272
 
@@ -277,7 +288,7 @@
277
  <input type="checkbox" id="xml_reader_engine" class="fix_checkbox" name="xml_reader_engine" value="1" <?php echo $post['xml_reader_engine'] ? 'checked="checked"': '' ?>/>
278
  <label for="xml_reader_engine"><?php _e('Use StreamReader instead of XMLReader to parse import file', 'wp_all_import_plugin') ?> <a href="#help" class="wpallimport-help" style="position:relative; top:0;" title="<?php _e('XMLReader is much faster, but has a bug that sometimes prevents certain records from being imported with import files that contain special cases.', 'wp_all_import_plugin'); ?>">?</a></label>
279
  <?php endif; ?>
280
- </div>
281
 
282
  <div class="input" style="margin-top: 15px;">
283
  <p><?php _e('Friendly Name','wp_all_import_plugin');?></p> <br>
9
  <tr>
10
  <td colspan="3">
11
  <h4><?php _e('Import Speed Optimization', 'wp_all_import_plugin'); ?></h4>
12
+ <div class="input">
13
+ <label for="processing_iteration_logic_custom"><?php _e('In each iteration, process', 'wp_all_import_plugin');?></label> <input type="text" name="records_per_request" style="vertical-align:middle; font-size:11px; background:#fff !important; width: 40px; text-align:center;" value="<?php echo esc_attr($post['records_per_request']) ?>" /> <?php _e('records', 'wp_all_import_plugin'); ?>
14
+ <a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('WP All Import must be able to process this many records in less than your server\'s timeout settings. If your import fails before completion, to troubleshoot you should lower this number. If you are importing images, especially high resolution images, high numbers here are probably a bad idea, since downloading the images can take lots of time - for example, 20 posts with 5 images each = 100 images. At 500Kb per image that\'s 50Mb that needs to be downloaded. Can your server download that before timing out? If not, the import will fail.', 'wp_all_import_plugin'); ?>">?</a>
15
+
16
+ <div class="input" style="margin:5px 0px;">
17
+ <input type="hidden" name="chuncking" value="0" />
18
+ <input type="checkbox" id="chuncking" name="chuncking" value="1" class="fix_checkbox" <?php echo $post['chuncking'] ? 'checked="checked"': '' ?>/>
19
+ <label for="chuncking"><?php _e('Split file up into <strong>' . PMXI_Plugin::getInstance()->getOption('large_feed_limit') . '</strong> record chunks.', 'wp_all_import_plugin');?></label>
20
+ <a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('This option will decrease the amount of slowdown experienced at the end of large imports. The slowdown is partially caused by the need for WP All Import to read deeper and deeper into the file on each successive iteration. 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, WP All Import will just split it into 20 chunks, and then read the last chunk from the beginning.','wp_all_import_plugin'); ?>">?</a>
21
+ </div>
 
 
 
 
 
 
 
 
 
 
 
22
  </div>
23
  <div class="input">
24
  <input type="hidden" name="is_fast_mode" value="0" />
28
  </div>
29
  <?php if ( ! $this->isWizard ): ?>
30
 
31
+ <?php if ( 'taxonomies' == $post['custom_type'] ):?>
32
+ <h4><?php _e('Taxonomy Type', 'wp_all_import_plugin'); ?></h4>
33
+ <p><?php _e('Editing this will change the taxonomy type of the taxonomies processed by this import. Re-run the import for the changes to take effect.', 'wp_all_import_plugin');?></p> <br>
34
+ <?php else: ?>
35
+ <h4><?php _e('Post Type', 'wp_all_import_plugin'); ?></h4>
36
+ <p><?php _e('Editing this will change the post type of the posts processed by this import. Re-run the import for the changes to take effect.', 'wp_all_import_plugin');?></p> <br>
37
+ <?php endif; ?>
38
 
39
+ <input type="hidden" name="custom_type" value="<?php echo $post['custom_type'];?>">
40
+
41
+ <?php if ( 'taxonomies' == $post['custom_type'] ):?>
42
+ <div class="wp_all_import_change_taxonomy_type">
43
+ <input type="hidden" name="taxonomy_type" value="<?php echo $post['taxonomy_type'];?>">
44
+ <select id="taxonomy_to_import">
45
+ <option value=""><?php _e('Select Taxonomy', 'wp_all_export_plugin'); ?></option>
46
+ <?php $options = wp_all_import_get_taxonomies(); ?>
47
+ <?php foreach ($options as $slug => $name):?>
48
+ <option value="<?php echo $slug;?>" <?php if ($post['taxonomy_type'] == $slug):?>selected="selected"<?php endif;?>><?php echo $name;?></option>
49
+ <?php endforeach;?>
50
+ </select>
51
+ </div>
52
+ <?php else: ?>
53
  <?php
54
  $hiddenPosts = array(
55
+ 'attachment',
56
+ 'revision',
57
+ 'nav_menu_item',
58
+ 'shop_webhook',
59
+ 'import_users',
60
+ 'wp-types-group',
61
+ 'wp-types-user-group',
62
+ 'wp-types-term-group',
63
+ 'acf-field',
64
+ 'acf-field-group',
65
+ 'custom_css',
66
+ 'customize_changeset',
67
+ 'oembed_cache',
68
+ 'wp_block',
69
+ 'user_request',
70
+ 'scheduled-action'
71
+ );
72
  $custom_types = get_post_types(array('_builtin' => true), 'objects') + get_post_types(array('_builtin' => false, 'show_ui' => true), 'objects');
73
  foreach ($custom_types as $key => $ct) {
74
  if (in_array($key, $hiddenPosts)) unset($custom_types[$key]);
75
  }
76
+ $custom_types = apply_filters( 'pmxi_custom_types', $custom_types, 'custom_types' );
77
 
78
  $sorted_cpt = array();
79
  foreach ($custom_types as $key => $cpt){
82
 
83
  // Put users & comments & taxonomies after Pages
84
  if ( ! empty($custom_types['page']) && $key == 'page' || empty($custom_types['page']) && $key == 'post' ){
85
+
86
+ $sorted_cpt['taxonomies'] = new stdClass();
87
+ $sorted_cpt['taxonomies']->labels = new stdClass();
88
+ $sorted_cpt['taxonomies']->labels->name = __('Taxonomies','wp_all_export_plugin');
89
+
90
  $sorted_cpt['import_users'] = new stdClass();
91
  $sorted_cpt['import_users']->labels = new stdClass();
92
  $sorted_cpt['import_users']->labels->name = __('Users','wp_all_export_plugin');
93
 
94
+ $sorted_cpt['comments'] = new stdClass();
95
+ $sorted_cpt['comments']->labels = new stdClass();
96
+ $sorted_cpt['comments']->labels->name = __('Comments','wp_all_export_plugin');
 
 
97
 
98
  break;
99
  }
119
 
120
  ?>
121
  <div class="wpallimport-change-custom-type">
122
+ <select name="custom_type_selector" id="custom_type_selector" class="wpallimport-post-types">
123
 
124
 
125
+ <?php
126
  // *****************************************************
127
  // **************** START CPT LOOP *********************
128
  // *****************************************************
129
  ?>
130
 
131
+ <?php
132
+ $known_imgs = array( 'post', 'page', 'product', 'import_users', 'shop_order', 'shop_coupon', 'shop_customer', 'users', 'comments', 'taxonomies', 'woo_reviews' );
133
  $all_posts = array_merge( $sorted_cpt, $hidden_post_types );
134
  $all_posts = apply_filters( 'pmxi_custom_types', $all_posts, 'all_types' );
135
+ $ordered_posts = array( 'post', 'page', 'taxonomies', 'comments', 'import_users', 'shop_order', 'shop_coupon', 'product', 'woo_reviews', 'shop_customer' );
136
 
137
  foreach ( $all_posts as $key => $post_obj ) {
138
  if ( ! in_array( $key, $ordered_posts ) ) {
150
  if ( in_array( $post_name, $known_imgs ) ) {
151
  $image_src = 'dashicon-' . $post_name;
152
  } else {
153
+ $image_src = 'dashicon-cpt';
154
  }
155
  if ( ! empty( $image_data ) && array_key_exists( $post_name, $image_data ) ) {
156
  $custom_img_defined = true;
173
  $img_to_echo .= $image_src;
174
  }
175
 
176
+ ?>
177
  <option value="<?php echo $cpt; ?>" data-imagesrc="<?php echo $img_to_echo; ?>" <?php if ( $custom_selected_post === true ):?>selected="selected"<?php else: if ( $cpt == $post['custom_type'] ):?>selected="selected"<?php endif; endif; ?>><?php echo $cpt_label; ?></option>
178
+ <?php
179
  }
180
 
181
  }
182
+ ?>
183
+ </select>
184
 
185
  <?php
186
  // *****************************************************
234
  </div>
235
 
236
  </div>
237
+ <?php endif; ?>
238
  <h4><?php _e('XPath', 'wp_all_import_plugin'); ?></h4>
239
  <p><?php _e('Editing this can break your entire import. You will have to re-create it from scratch.', 'wp_all_import_plugin');?></p> <br>
240
  <div class="input">
241
  <input type="text" name="xpath" value="<?php echo esc_attr($import->xpath) ?>" style="width: 50%; font-size: 18px; color: #555; height: 50px; padding: 10px;"/>
242
+ </div>
243
  <?php if ( ! empty($post['delimiter']) ): ?>
244
  <h4><?php _e('CSV Delimiter', 'wp_all_import_plugin'); ?></h4>
245
  <div class="input">
249
  <h4><?php _e('Downloads', 'wp_all_import_plugin'); ?></h4>
250
 
251
  <div class="input">
252
+ <button class="button button-primary download_import_template" rel="<?php echo add_query_arg(array('page' => 'pmxi-admin-manage', 'id' => intval($_GET['id']), 'action' => 'get_template', '_wpnonce' => wp_create_nonce( '_wpnonce-download_template' )), $this->baseUrl); ?>" style="background-image: none;"><?php _e('Import Template', 'wp_all_import_plugin'); ?></button>
253
+ <button class="button button-primary download_import_bundle" rel="<?php echo add_query_arg(array('page' => 'pmxi-admin-manage', 'id' => intval($_GET['id']), 'action' => 'bundle', '_wpnonce' => wp_create_nonce( '_wpnonce-download_bundle' )), $this->baseUrl); ?>" style="background-image: none;"><?php _e('Import Bundle', 'wp_all_import_plugin'); ?></button>
254
  </div>
255
  <?php endif; ?>
256
  <h4><?php _e('Other', 'wp_all_import_plugin'); ?></h4>
263
  <input type="text" name="import_specified" value="<?php echo esc_attr($post['import_specified']) ?>" style="width:320px;"/>
264
  </div>
265
  </div>
266
+ </div>
267
  <?php if (isset($source_type) and in_array($source_type, array('ftp', 'file'))): ?>
268
  <div class="input">
269
  <input type="hidden" name="is_delete_source" value="0" />
277
  <input type="checkbox" id="is_cloak" class="fix_checkbox" name="is_cloak" value="1" <?php echo $post['is_cloak'] ? 'checked="checked"': '' ?>/>
278
  <label for="is_cloak"><?php _e('Auto-Cloak Links', 'wp_all_import_plugin') ?> <a href="#help" class="wpallimport-help" style="position:relative; top:0;" title="<?php printf(__('Automatically process all links present in body of created post or page with <b>%s</b> plugin', 'wp_all_import_plugin'), PMLC_Plugin::getInstance()->getName()) ?>">?</a></label>
279
  </div>
280
+ <?php endif; ?>
281
  <div class="input">
282
  <input type="hidden" name="xml_reader_engine" value="0" />
283
 
288
  <input type="checkbox" id="xml_reader_engine" class="fix_checkbox" name="xml_reader_engine" value="1" <?php echo $post['xml_reader_engine'] ? 'checked="checked"': '' ?>/>
289
  <label for="xml_reader_engine"><?php _e('Use StreamReader instead of XMLReader to parse import file', 'wp_all_import_plugin') ?> <a href="#help" class="wpallimport-help" style="position:relative; top:0;" title="<?php _e('XMLReader is much faster, but has a bug that sometimes prevents certain records from being imported with import files that contain special cases.', 'wp_all_import_plugin'); ?>">?</a></label>
290
  <?php endif; ?>
291
+ </div>
292
 
293
  <div class="input" style="margin-top: 15px;">
294
  <p><?php _e('Friendly Name','wp_all_import_plugin');?></p> <br>
views/admin/import/template/_custom_fields_template.php CHANGED
@@ -50,7 +50,7 @@
50
  <?php $custom_mapping_rules = (!empty($post['custom_mapping_rules'][$i])) ? json_decode($post['custom_mapping_rules'][$i], true) : false; ?>
51
  <tr class="form-field">
52
  <td style="width: 45%;">
53
- <input type="text" name="custom_name[]" value="<?php echo esc_attr($name) ?>" class="widefat autocomplete" style="margin-bottom:10px;"/>
54
  <input type="hidden" name="custom_format[]" value="<?php echo ( ! empty($post['custom_format'][$i]) ) ? '1' : '0'; ?>"/>
55
  </td>
56
  <td class="action">
@@ -259,7 +259,7 @@
259
  <?php else: ?>
260
  <tr class="form-field">
261
  <td style="width: 45%;">
262
- <input type="text" name="custom_name[]" value="" class="widefat autocomplete" style="margin-bottom:10px;"/>
263
  <input type="hidden" name="custom_format[]" value="0"/>
264
  </td>
265
  <td class="action">
@@ -393,7 +393,7 @@
393
  <?php endif;?>
394
  <tr class="form-field template">
395
  <td style="width: 45%;">
396
- <input type="text" name="custom_name[]" value="" class="widefat autocomplete" style="margin-bottom:10px;"/>
397
  <input type="hidden" name="custom_format[]" value="0"/>
398
  </td>
399
  <td class="action">
50
  <?php $custom_mapping_rules = (!empty($post['custom_mapping_rules'][$i])) ? json_decode($post['custom_mapping_rules'][$i], true) : false; ?>
51
  <tr class="form-field">
52
  <td style="width: 45%;">
53
+ <input type="text" name="custom_name[]" value="<?php echo esc_attr($name) ?>" class="widefat wp_all_import_autocomplete" style="margin-bottom:10px;"/>
54
  <input type="hidden" name="custom_format[]" value="<?php echo ( ! empty($post['custom_format'][$i]) ) ? '1' : '0'; ?>"/>
55
  </td>
56
  <td class="action">
259
  <?php else: ?>
260
  <tr class="form-field">
261
  <td style="width: 45%;">
262
+ <input type="text" name="custom_name[]" value="" class="widefat wp_all_import_autocomplete" style="margin-bottom:10px;"/>
263
  <input type="hidden" name="custom_format[]" value="0"/>
264
  </td>
265
  <td class="action">
393
  <?php endif;?>
394
  <tr class="form-field template">
395
  <td style="width: 45%;">
396
+ <input type="text" name="custom_name[]" value="" class="widefat wp_all_import_autocomplete" style="margin-bottom:10px;"/>
397
  <input type="hidden" name="custom_format[]" value="0"/>
398
  </td>
399
  <td class="action">
views/admin/import/template/_featured_template.php CHANGED
@@ -58,11 +58,11 @@
58
  <div class="switcher-target-<?php echo $section_slug; ?>search_existing_images" style="padding-left:23px;">
59
  <div class="search_through_the_media_library_logic">
60
  <div class="input">
61
- <input type="radio" id="<?php echo $section_slug; ?>search_existing_images_logic_url" name="<?php echo $section_slug; ?>search_existing_images_logic" value="by_url" <?php echo ( "by_url" == $post['search_existing_images_logic'] ) ? 'checked="checked"': '' ?>/>
62
  <label for="<?php echo $section_slug; ?>search_existing_images_logic_url"><?php _e('Match image by URL', 'wp_all_import_plugin') ?></label>
63
  </div>
64
  <div class="input">
65
- <input type="radio" id="<?php echo $section_slug; ?>search_existing_images_logic_filename" name="<?php echo $section_slug; ?>search_existing_images_logic" value="by_filename" <?php echo ( "by_filename" == $post['search_existing_images_logic'] ) ? 'checked="checked"': '' ?>/>
66
  <label for="<?php echo $section_slug; ?>search_existing_images_logic_filename"><?php _e('Match image by filename', 'wp_all_import_plugin') ?></label>
67
  </div>
68
  </div>
@@ -77,7 +77,7 @@
77
  <?php if ($section_type == 'images'): ?>
78
  <div class="input" style="margin: 3px;">
79
  <input type="hidden" name="<?php echo $section_slug; ?>import_img_tags" value="0" />
80
- <input type="checkbox" id="<?php echo $section_slug; ?>import_img_tags" name="<?php echo $section_slug; ?>import_img_tags" value="1" <?php echo ($post[$section_slug . 'import_img_tags']) ? 'checked="checked"': '' ?> />
81
  <label for="<?php echo $section_slug; ?>import_img_tags"><?php _e('Scan through post content and import images wrapped in &lt;img&gt; tags', 'wp_all_import_plugin') ?></label>
82
  <a href="#help" class="wpallimport-help" title="<?php _e('Only images hosted on other sites will be imported. Images will be imported to WordPress and the <img> tag updated with the new image URL.', 'wp_all_import_plugin') ?>" style="position:relative; top: -2px;">?</a>
83
  </div>
@@ -197,4 +197,12 @@
197
  </div>
198
  </div>
199
  </div>
200
- </div>
 
 
 
 
 
 
 
 
58
  <div class="switcher-target-<?php echo $section_slug; ?>search_existing_images" style="padding-left:23px;">
59
  <div class="search_through_the_media_library_logic">
60
  <div class="input">
61
+ <input type="radio" id="<?php echo $section_slug; ?>search_existing_images_logic_url" name="<?php echo $section_slug; ?>search_existing_images_logic" value="by_url" <?php echo ( "by_url" == $post[$section_slug . 'search_existing_images_logic'] ) ? 'checked="checked"': '' ?>/>
62
  <label for="<?php echo $section_slug; ?>search_existing_images_logic_url"><?php _e('Match image by URL', 'wp_all_import_plugin') ?></label>
63
  </div>
64
  <div class="input">
65
+ <input type="radio" id="<?php echo $section_slug; ?>search_existing_images_logic_filename" name="<?php echo $section_slug; ?>search_existing_images_logic" value="by_filename" <?php echo ( "by_filename" == $post[$section_slug . 'search_existing_images_logic'] ) ? 'checked="checked"': '' ?>/>
66
  <label for="<?php echo $section_slug; ?>search_existing_images_logic_filename"><?php _e('Match image by filename', 'wp_all_import_plugin') ?></label>
67
  </div>
68
  </div>
77
  <?php if ($section_type == 'images'): ?>
78
  <div class="input" style="margin: 3px;">
79
  <input type="hidden" name="<?php echo $section_slug; ?>import_img_tags" value="0" />
80
+ <input type="checkbox" id="<?php echo $section_slug; ?>import_img_tags" name="<?php echo $section_slug; ?>import_img_tags" value="1" <?php echo (isset($post[$section_slug . 'import_img_tags']) && $post[$section_slug . 'import_img_tags']) ? 'checked="checked"': '' ?> />
81
  <label for="<?php echo $section_slug; ?>import_img_tags"><?php _e('Scan through post content and import images wrapped in &lt;img&gt; tags', 'wp_all_import_plugin') ?></label>
82
  <a href="#help" class="wpallimport-help" title="<?php _e('Only images hosted on other sites will be imported. Images will be imported to WordPress and the <img> tag updated with the new image URL.', 'wp_all_import_plugin') ?>" style="position:relative; top: -2px;">?</a>
83
  </div>
197
  </div>
198
  </div>
199
  </div>
200
+ </div>
201
+ <div id="images_hints" style="display:none;">
202
+ <ul>
203
+ <li><?php _e('WP All Import will automatically ignore elements with blank image URLs/filenames.', 'wp_all_import_plugin'); ?></li>
204
+ <li><?php _e('WP All Import must download the images to your server. You can\'t have images in a Gallery that are referenced by external URL. That\'s just how WordPress works.', 'wp_all_import_plugin'); ?></li>
205
+ <li><?php printf(__('Importing a variable number of images can be done using a <a href="%s" target="_blank">FOREACH LOOP</a>', 'wp_all_import_plugin'), 'https://www.wpallimport.com/documentation/developers/custom-code/foreach-loops/'); ?></li>
206
+ <li><?php printf(__('For more information check out our <a href="%s" target="_blank">comprehensive documentation</a>', 'wp_all_import_plugin'), 'http://www.wpallimport.com/documentation/'); ?></li>
207
+ </ul>
208
+ </div>
views/admin/import/template/_other_template.php CHANGED
@@ -1,4 +1,7 @@
1
- <?php $custom_type = get_post_type_object( $post_type ); ?>
 
 
 
2
  <div class="wpallimport-collapsed closed wpallimport-section ">
3
  <div class="wpallimport-content-section ">
4
  <div class="wpallimport-collapsed-header">
@@ -61,29 +64,29 @@
61
  </div>
62
  </td>
63
  </tr>
64
- <tr>
65
- <td>
66
- <h4><?php _e('Comments', 'wp_all_import_plugin'); ?></h4>
67
- <div class="input">
68
- <input type="radio" id="comment_status_open" name="comment_status" value="open" <?php echo 'open' == $post['comment_status'] ? 'checked="checked"' : '' ?> class="switcher"/>
69
- <label for="comment_status_open"><?php _e('Open', 'wp_all_import_plugin') ?></label>
70
- </div>
71
- <div class="input">
72
- <input type="radio" id="comment_status_closed" name="comment_status" value="closed" <?php echo 'closed' == $post['comment_status'] ? 'checked="checked"' : '' ?> class="switcher"/>
73
- <label for="comment_status_closed"><?php _e('Closed', 'wp_all_import_plugin') ?></label>
74
- </div>
75
- <div class="input fleft" style="position:relative;width:220px;">
76
- <input type="radio" id="comment_status_xpath" class="switcher" name="comment_status" value="xpath" <?php echo 'xpath' == $post['comment_status'] ? 'checked="checked"': '' ?>/>
77
- <label for="comment_status_xpath"><?php _e('Set with XPath', 'wp_all_import_plugin' )?></label> <br>
78
- <div class="switcher-target-comment_status_xpath">
79
- <div class="input">
80
- &nbsp;<input type="text" class="smaller-text" name="comment_status_xpath" style="width:190px;" value="<?php echo esc_attr($post['comment_status_xpath']) ?>"/>
81
- <a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'open\', \'closed\').', 'wp_all_import_plugin') ?>" style="position:relative; top:13px; float: right;">?</a>
82
- </div>
83
- </div>
84
- </div>
85
- </td>
86
- </tr>
87
  <tr>
88
  <td>
89
  <h4><?php _e('Trackbacks and Pingbacks', 'wp_all_import_plugin'); ?></h4>
@@ -126,9 +129,8 @@
126
  <tr>
127
  <td>
128
  <h4 style="float:left;"><?php _e('Download & Import Attachments', 'wp_all_import_plugin') ?></h4>
129
- <span class="separated_by" style="position:relative; top:15px; margin-right:0px;"><?php _e('Separated by','wp_all_import_plugin');?></span>
130
- <div>
131
- <input type="text" name="attachments" style="width:93%;" value="<?php echo esc_attr($post['attachments']) ?>" />
132
  <input type="text" class="small" name="atch_delim" value="<?php echo esc_attr($post['atch_delim']) ?>" style="width:5%; text-align:center; float:right;"/>
133
  </div>
134
  <div class="input" style="margin:3px;">
@@ -210,7 +212,7 @@
210
  <td>
211
  <?php if ( 'page' == $post_type ):?>
212
 
213
- <h4><?php _e('Page Parent', 'wp_all_import_plugin') ?><a href="#help" class="wpallimport-help" title="<?php _e('Enter the slug of the desired page parent. If adding the child and parent pages in the same import, set \'Records per Iteration\' to 1, run the import twice, or run separate imports for child and parent pages.', 'wp_all_import_plugin') ?>" style="position:relative; top:-1px;">?</a></h4>
214
 
215
  <div class="input">
216
  <input type="radio" id="is_multiple_page_parent_yes" name="is_multiple_page_parent" value="yes" <?php echo 'yes' == $post['is_multiple_page_parent'] ? 'checked="checked"' : '' ?> class="switcher" style="margin-left:0;"/>
@@ -236,7 +238,7 @@
236
 
237
  <?php if ( 'page' != $post_type && $custom_type->hierarchical ): ?>
238
 
239
- <h4><?php _e('Post Parent', 'wp_all_import_plugin') ?><a href="#help" class="wpallimport-help" title="<?php _e('Enter the slug of the desired post parent. If adding the child and parent posts in the same import, set \'Records per Iteration\' to 1, run the import twice, or run separate imports for child and parent posts.', 'wp_all_import_plugin') ?>" style="position:relative; top:-1px;">?</a></h4>
240
 
241
  <div class="input">
242
  <input type="radio" id="is_multiple_page_parent_yes" name="is_multiple_page_parent" value="yes" <?php echo 'yes' == $post['is_multiple_page_parent'] ? 'checked="checked"' : '' ?> class="switcher" style="margin-left:0;"/>
@@ -293,4 +295,4 @@
293
  </div>
294
  </div>
295
  </div>
296
- </div>
1
+ <?php
2
+ $custom_type = get_post_type_object( $post_type );
3
+ ?>
4
+
5
  <div class="wpallimport-collapsed closed wpallimport-section ">
6
  <div class="wpallimport-content-section ">
7
  <div class="wpallimport-collapsed-header">
64
  </div>
65
  </td>
66
  </tr>
67
+ <tr>
68
+ <td>
69
+ <h4><?php _e('Comments', 'wp_all_import_plugin'); ?></h4>
70
+ <div class="input">
71
+ <input type="radio" id="comment_status_open" name="comment_status" value="open" <?php echo 'open' == $post['comment_status'] ? 'checked="checked"' : '' ?> class="switcher"/>
72
+ <label for="comment_status_open"><?php _e('Open', 'wp_all_import_plugin') ?></label>
73
+ </div>
74
+ <div class="input">
75
+ <input type="radio" id="comment_status_closed" name="comment_status" value="closed" <?php echo 'closed' == $post['comment_status'] ? 'checked="checked"' : '' ?> class="switcher"/>
76
+ <label for="comment_status_closed"><?php _e('Closed', 'wp_all_import_plugin') ?></label>
77
+ </div>
78
+ <div class="input fleft" style="position:relative;width:220px;">
79
+ <input type="radio" id="comment_status_xpath" class="switcher" name="comment_status" value="xpath" <?php echo 'xpath' == $post['comment_status'] ? 'checked="checked"': '' ?>/>
80
+ <label for="comment_status_xpath"><?php _e('Set with XPath', 'wp_all_import_plugin' )?></label> <br>
81
+ <div class="switcher-target-comment_status_xpath">
82
+ <div class="input">
83
+ &nbsp;<input type="text" class="smaller-text" name="comment_status_xpath" style="width:190px;" value="<?php echo esc_attr($post['comment_status_xpath']) ?>"/>
84
+ <a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'open\', \'closed\').', 'wp_all_import_plugin') ?>" style="position:relative; top:13px; float: right;">?</a>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ </td>
89
+ </tr>
90
  <tr>
91
  <td>
92
  <h4><?php _e('Trackbacks and Pingbacks', 'wp_all_import_plugin'); ?></h4>
129
  <tr>
130
  <td>
131
  <h4 style="float:left;"><?php _e('Download & Import Attachments', 'wp_all_import_plugin') ?></h4>
132
+ <div style="clear:both;">
133
+ <input type="text" name="attachments" style="width:87%;" value="<?php echo esc_attr($post['attachments']) ?>" />
 
134
  <input type="text" class="small" name="atch_delim" value="<?php echo esc_attr($post['atch_delim']) ?>" style="width:5%; text-align:center; float:right;"/>
135
  </div>
136
  <div class="input" style="margin:3px;">
212
  <td>
213
  <?php if ( 'page' == $post_type ):?>
214
 
215
+ <h4><?php _e('Page Parent', 'wp_all_import_plugin') ?><a href="#help" class="wpallimport-help" title="<?php _e('Enter the ID, title, or slug of the desired page parent. If adding the child and parent pages in the same import, set \'Records per Iteration\' to 1, run the import twice, or run separate imports for child and parent pages.', 'wp_all_import_plugin') ?>" style="position:relative; top:-1px;">?</a></h4>
216
 
217
  <div class="input">
218
  <input type="radio" id="is_multiple_page_parent_yes" name="is_multiple_page_parent" value="yes" <?php echo 'yes' == $post['is_multiple_page_parent'] ? 'checked="checked"' : '' ?> class="switcher" style="margin-left:0;"/>
238
 
239
  <?php if ( 'page' != $post_type && $custom_type->hierarchical ): ?>
240
 
241
+ <h4><?php _e('Post Parent', 'wp_all_import_plugin') ?><a href="#help" class="wpallimport-help" title="<?php _e('Enter the ID, title, or slug of the desired post parent. If adding the child and parent posts in the same import, set \'Records per Iteration\' to 1, run the import twice, or run separate imports for child and parent posts.', 'wp_all_import_plugin') ?>" style="position:relative; top:-1px;">?</a></h4>
242
 
243
  <div class="input">
244
  <input type="radio" id="is_multiple_page_parent_yes" name="is_multiple_page_parent" value="yes" <?php echo 'yes' == $post['is_multiple_page_parent'] ? 'checked="checked"' : '' ?> class="switcher" style="margin-left:0;"/>
295
  </div>
296
  </div>
297
  </div>
298
+ </div>
views/admin/manage/delete.php CHANGED
@@ -74,7 +74,7 @@ else{
74
  <input type="hidden" name="is_confirmed" value="1" />
75
  <input type="hidden" name="import_ids[]" value="<?php echo esc_attr($item->id); ?>" />
76
  <input type="hidden" name="base_url" value="<?php echo $this->baseUrl; ?>">
77
- <input type="submit" class="button-primary delete-single-import <?php echo ("ajax" == $item->options['import_processing']) ? 'wp_all_import_ajax_deletion' : '';?>" value="Delete" />
78
  <div class="wp_all_import_functions_preloader"></div>
79
  </div>
80
  <div class="wp_all_import_deletion_log"></div>
74
  <input type="hidden" name="is_confirmed" value="1" />
75
  <input type="hidden" name="import_ids[]" value="<?php echo esc_attr($item->id); ?>" />
76
  <input type="hidden" name="base_url" value="<?php echo $this->baseUrl; ?>">
77
+ <input type="submit" class="button-primary delete-single-import wp_all_import_ajax_deletion" value="Delete" />
78
  <div class="wp_all_import_functions_preloader"></div>
79
  </div>
80
  <div class="wp_all_import_deletion_log"></div>
views/admin/manage/index.php CHANGED
@@ -155,10 +155,8 @@ $columns = apply_filters('pmxi_manage_imports_columns', $columns);
155
  if ( ! empty($path_parts['dirname'])){
156
  $path_all_parts = explode('/', $path_parts['dirname']);
157
  $dirname = array_pop($path_all_parts);
158
- if ( wp_all_import_isValidMd5($dirname)){
159
-
160
  $path = str_replace($dirname, preg_replace('%^(.{3}).*(.{3})$%', '$1***$2', $dirname), str_replace('temp/', '', $item['path']));
161
-
162
  }
163
  }
164
  ?>
@@ -171,11 +169,8 @@ $columns = apply_filters('pmxi_manage_imports_columns', $columns);
171
  <?php endif; ?>
172
  <?php endif ?>
173
  <div class="row-actions">
174
-
175
  <?php do_action('pmxi_import_menu', $item['id'], $this->baseUrl); ?>
176
-
177
  <?php
178
-
179
  $import_actions = array(
180
  'import_template' => array(
181
  'url' => ( ! $item['processing'] and ! $item['executing'] ) ? add_query_arg(array('id' => $item['id'], 'action' => 'edit'), $this->baseUrl) : '',
@@ -212,8 +207,7 @@ $columns = apply_filters('pmxi_manage_imports_columns', $columns);
212
  break;
213
  }
214
  $ai++;
215
- }
216
-
217
  ?>
218
 
219
  </div>
@@ -314,12 +308,11 @@ $columns = apply_filters('pmxi_manage_imports_columns', $columns);
314
  ?>
315
  <td style="width: 130px;">
316
  <?php if ( ! $item['processing'] and ! $item['executing'] ): ?>
317
- <!--h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'edit'), $this->baseUrl); ?>"><?php _e('Edit', 'wp_all_import_plugin'); ?></a></h2-->
318
- <h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'update'), $this->baseUrl); ?>"><?php _e('Run Import', 'wp_all_import_plugin'); ?></a></h2>
319
  <?php elseif ($item['processing']) : ?>
320
- <h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'cancel', '_wpnonce' => wp_create_nonce( '_wpnonce-cancel_import' )), $this->baseUrl); ?>"><?php _e('Cancel Cron', 'wp_all_import_plugin'); ?></a></h2>
321
  <?php elseif ($item['executing']) : ?>
322
- <h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'cancel', '_wpnonce' => wp_create_nonce( '_wpnonce-cancel_import' )), $this->baseUrl); ?>"><?php _e('Cancel', 'wp_all_import_plugin'); ?></a></h2>
323
  <?php endif; ?>
324
  </td>
325
  <?php
155
  if ( ! empty($path_parts['dirname'])){
156
  $path_all_parts = explode('/', $path_parts['dirname']);
157
  $dirname = array_pop($path_all_parts);
158
+ if ( wp_all_import_isValidMd5($dirname)){
 
159
  $path = str_replace($dirname, preg_replace('%^(.{3}).*(.{3})$%', '$1***$2', $dirname), str_replace('temp/', '', $item['path']));
 
160
  }
161
  }
162
  ?>
169
  <?php endif; ?>
170
  <?php endif ?>
171
  <div class="row-actions">
 
172
  <?php do_action('pmxi_import_menu', $item['id'], $this->baseUrl); ?>
 
173
  <?php
 
174
  $import_actions = array(
175
  'import_template' => array(
176
  'url' => ( ! $item['processing'] and ! $item['executing'] ) ? add_query_arg(array('id' => $item['id'], 'action' => 'edit'), $this->baseUrl) : '',
207
  break;
208
  }
209
  $ai++;
210
+ }
 
211
  ?>
212
 
213
  </div>
308
  ?>
309
  <td style="width: 130px;">
310
  <?php if ( ! $item['processing'] and ! $item['executing'] ): ?>
311
+ <h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'update'), remove_query_arg('pagenum', $this->baseUrl)); ?>"><?php _e('Run Import', 'wp_all_import_plugin'); ?></a></h2>
 
312
  <?php elseif ($item['processing']) : ?>
313
+ <h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'cancel', '_wpnonce' => wp_create_nonce( '_wpnonce-cancel_import' )), remove_query_arg('pagenum', $this->baseUrl)); ?>"><?php _e('Cancel Cron', 'wp_all_import_plugin'); ?></a></h2>
314
  <?php elseif ($item['executing']) : ?>
315
+ <h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'cancel', '_wpnonce' => wp_create_nonce( '_wpnonce-cancel_import' )), remove_query_arg('pagenum', $this->baseUrl)); ?>"><?php _e('Cancel', 'wp_all_import_plugin'); ?></a></h2>
316
  <?php endif; ?>
317
  </td>
318
  <?php