Import any XML or CSV File to WordPress - Version 3.4.2

Version Description

  • bug fix: conflict with the event calendar plugin
  • bug fix: import images for newly created products
Download this release

Release Info

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

Code changes from version 3.4.1 to 3.4.2

Files changed (3) hide show
  1. models/import/record.php +106 -104
  2. plugin.php +2 -2
  3. readme.txt +5 -1
models/import/record.php CHANGED
@@ -602,111 +602,111 @@ class PMXI_Import_Record extends PMXI_Model_Record {
602
  $image_meta_alts_bundle = array();
603
  $image_meta_descriptions_bundle = array();
604
 
605
- if ( $this->options['update_all_data'] == 'yes' || $this->options['is_update_images'] ){
606
- foreach ($image_sections as $section) {
607
- $chunk == 1 and $logger and call_user_func($logger, __('Composing URLs for ' . strtolower($section['title']) . '...', 'wp_all_import_plugin'));
608
- $featured_images = array();
609
- if ( "no" == $this->options[$section['slug'] . 'download_images']){
610
- if ($this->options[$section['slug'] . 'featured_image']) {
611
- $featured_images = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'featured_image'], $file)->parse($records); $tmp_files[] = $file;
612
- } else {
613
- count($titles) and $featured_images = array_fill(0, count($titles), '');
614
- }
615
- }
616
- elseif ("gallery" == $this->options[$section['slug'] . 'download_images']) {
617
- if ($this->options[$section['slug'] . 'gallery_featured_image']) {
618
- $featured_images = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'gallery_featured_image'], $file)->parse($records); $tmp_files[] = $file;
619
- } else {
620
- count($titles) and $featured_images = array_fill(0, count($titles), '');
621
- }
622
- }
623
- else{
624
- if ($this->options[$section['slug'] . 'download_featured_image']) {
625
- $featured_images = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'download_featured_image'], $file)->parse($records); $tmp_files[] = $file;
626
- } else {
627
- count($titles) and $featured_images = array_fill(0, count($titles), '');
628
- }
629
- }
630
-
631
- $images_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = array(
632
- 'type' => $section['type'],
633
- 'files' => $featured_images
634
- );
635
-
636
- // Composing images meta titles
637
- if ( $this->options[$section['slug'] . 'set_image_meta_title'] ){
638
- $chunk == 1 and $logger and call_user_func($logger, __('Composing ' . strtolower($section['title']) . ' meta data (titles)...', 'wp_all_import_plugin'));
639
- $image_meta_titles = array();
640
- if ($this->options[$section['slug'] . 'image_meta_title']) {
641
- $image_meta_titles = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'image_meta_title'], $file)->parse($records); $tmp_files[] = $file;
642
- } else {
643
- count($titles) and $image_meta_titles = array_fill(0, count($titles), '');
644
- }
645
- $image_meta_titles_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $image_meta_titles;
646
- }
647
-
648
- // Composing images meta captions
649
- if ( $this->options[$section['slug'] . 'set_image_meta_caption'] ){
650
- $chunk == 1 and $logger and call_user_func($logger, __('Composing ' . strtolower($section['title']) . ' meta data (captions)...', 'wp_all_import_plugin'));
651
- $image_meta_captions = array();
652
- if ($this->options[$section['slug'] . 'image_meta_caption']) {
653
- $image_meta_captions = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'image_meta_caption'], $file)->parse($records); $tmp_files[] = $file;
654
- } else {
655
- count($titles) and $image_meta_captions = array_fill(0, count($titles), '');
656
- }
657
- $image_meta_captions_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $image_meta_captions;
658
- }
659
-
660
- // Composing images meta alt text
661
- if ( $this->options[$section['slug'] . 'set_image_meta_alt'] ){
662
- $chunk == 1 and $logger and call_user_func($logger, __('Composing ' . strtolower($section['title']) . ' meta data (alt text)...', 'wp_all_import_plugin'));
663
- $image_meta_alts = array();
664
- if ($this->options[$section['slug'] . 'image_meta_alt']) {
665
- $image_meta_alts = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'image_meta_alt'], $file)->parse($records); $tmp_files[] = $file;
666
- } else {
667
- count($titles) and $image_meta_alts = array_fill(0, count($titles), '');
668
- }
669
- $image_meta_alts_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $image_meta_alts;
670
- }
671
-
672
- // Composing images meta description
673
- if ( $this->options[$section['slug'] . 'set_image_meta_description'] ){
674
- $chunk == 1 and $logger and call_user_func($logger, __('Composing ' . strtolower($section['title']) . ' meta data (description)...', 'wp_all_import_plugin'));
675
- $image_meta_descriptions = array();
676
- if ($this->options[$section['slug'] . 'image_meta_description']) {
677
- $image_meta_descriptions = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'image_meta_description'], $file)->parse($records); $tmp_files[] = $file;
678
- } else {
679
- count($titles) and $image_meta_descriptions = array_fill(0, count($titles), '');
680
- }
681
- $image_meta_descriptions_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $image_meta_descriptions;
682
- }
683
-
684
- if ( "yes" == $this->options[$section['slug'] . 'download_images'] ){
685
- // Composing images suffix
686
- $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'));
687
- $auto_rename_images = array();
688
- if ( $this->options[$section['slug'] . 'auto_rename_images'] and ! empty($this->options[$section['slug'] . 'auto_rename_images_suffix'])){
689
- $auto_rename_images = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'auto_rename_images_suffix'], $file)->parse($records); $tmp_files[] = $file;
690
- }
691
- else{
692
- count($titles) and $auto_rename_images = array_fill(0, count($titles), '');
693
- }
694
- $auto_rename_images_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $auto_rename_images;
695
 
696
- // Composing images extensions
697
- $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'));
698
- $auto_extensions = array();
699
- if ( $this->options[$section['slug'] . 'auto_set_extension'] and ! empty($this->options[$section['slug'] . 'new_extension'])){
700
- $auto_extensions = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'new_extension'], $file)->parse($records); $tmp_files[] = $file;
701
- }
702
- else{
703
- count($titles) and $auto_extensions = array_fill(0, count($titles), '');
704
- }
705
- $auto_extensions_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $auto_extensions;
706
- }
707
 
708
- }
709
- }
710
  }
711
 
712
  // Composing attachments
@@ -2284,7 +2284,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2284
 
2285
  // fire important hooks after custom fields are added
2286
  if ( ! $this->options['is_fast_mode'] and ! in_array($this->options['custom_type'], array('import_users', 'taxonomies'))){
2287
- $post_object = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM {$this->wpdb->posts} WHERE ID = %d", $pid) );
 
 
2288
  do_action( "save_post_" . $articleData['post_type'], $pid, $post_object, $is_update );
2289
  do_action( 'save_post', $pid, $post_object, $is_update );
2290
  do_action( 'wp_insert_post', $pid, $post_object, $is_update );
602
  $image_meta_alts_bundle = array();
603
  $image_meta_descriptions_bundle = array();
604
 
605
+ if ( $this->is_parsing_required('is_update_images') ){
606
+ foreach ($image_sections as $section) {
607
+ $chunk == 1 and $logger and call_user_func($logger, __('Composing URLs for ' . strtolower($section['title']) . '...', 'wp_all_import_plugin'));
608
+ $featured_images = array();
609
+ if ( "no" == $this->options[$section['slug'] . 'download_images']){
610
+ if ($this->options[$section['slug'] . 'featured_image']) {
611
+ $featured_images = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'featured_image'], $file)->parse($records); $tmp_files[] = $file;
612
+ } else {
613
+ count($titles) and $featured_images = array_fill(0, count($titles), '');
614
+ }
615
+ }
616
+ elseif ("gallery" == $this->options[$section['slug'] . 'download_images']) {
617
+ if ($this->options[$section['slug'] . 'gallery_featured_image']) {
618
+ $featured_images = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'gallery_featured_image'], $file)->parse($records); $tmp_files[] = $file;
619
+ } else {
620
+ count($titles) and $featured_images = array_fill(0, count($titles), '');
621
+ }
622
+ }
623
+ else{
624
+ if ($this->options[$section['slug'] . 'download_featured_image']) {
625
+ $featured_images = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'download_featured_image'], $file)->parse($records); $tmp_files[] = $file;
626
+ } else {
627
+ count($titles) and $featured_images = array_fill(0, count($titles), '');
628
+ }
629
+ }
630
+
631
+ $images_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = array(
632
+ 'type' => $section['type'],
633
+ 'files' => $featured_images
634
+ );
635
+
636
+ // Composing images meta titles
637
+ if ( $this->options[$section['slug'] . 'set_image_meta_title'] ){
638
+ $chunk == 1 and $logger and call_user_func($logger, __('Composing ' . strtolower($section['title']) . ' meta data (titles)...', 'wp_all_import_plugin'));
639
+ $image_meta_titles = array();
640
+ if ($this->options[$section['slug'] . 'image_meta_title']) {
641
+ $image_meta_titles = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'image_meta_title'], $file)->parse($records); $tmp_files[] = $file;
642
+ } else {
643
+ count($titles) and $image_meta_titles = array_fill(0, count($titles), '');
644
+ }
645
+ $image_meta_titles_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $image_meta_titles;
646
+ }
647
+
648
+ // Composing images meta captions
649
+ if ( $this->options[$section['slug'] . 'set_image_meta_caption'] ){
650
+ $chunk == 1 and $logger and call_user_func($logger, __('Composing ' . strtolower($section['title']) . ' meta data (captions)...', 'wp_all_import_plugin'));
651
+ $image_meta_captions = array();
652
+ if ($this->options[$section['slug'] . 'image_meta_caption']) {
653
+ $image_meta_captions = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'image_meta_caption'], $file)->parse($records); $tmp_files[] = $file;
654
+ } else {
655
+ count($titles) and $image_meta_captions = array_fill(0, count($titles), '');
656
+ }
657
+ $image_meta_captions_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $image_meta_captions;
658
+ }
659
+
660
+ // Composing images meta alt text
661
+ if ( $this->options[$section['slug'] . 'set_image_meta_alt'] ){
662
+ $chunk == 1 and $logger and call_user_func($logger, __('Composing ' . strtolower($section['title']) . ' meta data (alt text)...', 'wp_all_import_plugin'));
663
+ $image_meta_alts = array();
664
+ if ($this->options[$section['slug'] . 'image_meta_alt']) {
665
+ $image_meta_alts = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'image_meta_alt'], $file)->parse($records); $tmp_files[] = $file;
666
+ } else {
667
+ count($titles) and $image_meta_alts = array_fill(0, count($titles), '');
668
+ }
669
+ $image_meta_alts_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $image_meta_alts;
670
+ }
671
+
672
+ // Composing images meta description
673
+ if ( $this->options[$section['slug'] . 'set_image_meta_description'] ){
674
+ $chunk == 1 and $logger and call_user_func($logger, __('Composing ' . strtolower($section['title']) . ' meta data (description)...', 'wp_all_import_plugin'));
675
+ $image_meta_descriptions = array();
676
+ if ($this->options[$section['slug'] . 'image_meta_description']) {
677
+ $image_meta_descriptions = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'image_meta_description'], $file)->parse($records); $tmp_files[] = $file;
678
+ } else {
679
+ count($titles) and $image_meta_descriptions = array_fill(0, count($titles), '');
680
+ }
681
+ $image_meta_descriptions_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $image_meta_descriptions;
682
+ }
683
+
684
+ if ( "yes" == $this->options[$section['slug'] . 'download_images'] ){
685
+ // Composing images suffix
686
+ $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'));
687
+ $auto_rename_images = array();
688
+ if ( $this->options[$section['slug'] . 'auto_rename_images'] and ! empty($this->options[$section['slug'] . 'auto_rename_images_suffix'])){
689
+ $auto_rename_images = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'auto_rename_images_suffix'], $file)->parse($records); $tmp_files[] = $file;
690
+ }
691
+ else{
692
+ count($titles) and $auto_rename_images = array_fill(0, count($titles), '');
693
+ }
694
+ $auto_rename_images_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $auto_rename_images;
695
 
696
+ // Composing images extensions
697
+ $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'));
698
+ $auto_extensions = array();
699
+ if ( $this->options[$section['slug'] . 'auto_set_extension'] and ! empty($this->options[$section['slug'] . 'new_extension'])){
700
+ $auto_extensions = XmlImportParser::factory($xml, $cxpath, $this->options[$section['slug'] . 'new_extension'], $file)->parse($records); $tmp_files[] = $file;
701
+ }
702
+ else{
703
+ count($titles) and $auto_extensions = array_fill(0, count($titles), '');
704
+ }
705
+ $auto_extensions_bundle[ empty($section['slug']) ? 'pmxi_gallery_image' : $section['slug']] = $auto_extensions;
706
+ }
707
 
708
+ }
709
+ }
710
  }
711
 
712
  // Composing attachments
2284
 
2285
  // fire important hooks after custom fields are added
2286
  if ( ! $this->options['is_fast_mode'] and ! in_array($this->options['custom_type'], array('import_users', 'taxonomies'))){
2287
+ $_post = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM {$this->wpdb->posts} WHERE ID = %d LIMIT 1", $pid ) );
2288
+ $_post = sanitize_post( $_post, 'raw' );
2289
+ $post_object = new WP_Post( $_post );
2290
  do_action( "save_post_" . $articleData['post_type'], $pid, $post_object, $is_update );
2291
  do_action( 'save_post', $pid, $post_object, $is_update );
2292
  do_action( 'wp_insert_post', $pid, $post_object, $is_update );
plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP All Import
4
  Plugin URI: http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=plugins-page&utm_campaign=free+plugin
5
  Description: The most powerful solution for importing XML and CSV files to WordPress. Create Posts and Pages with content from any XML or CSV file. A paid upgrade to WP All Import Pro is available for support and additional features.
6
- Version: 3.4.1
7
  Author: Soflyy
8
  */
9
 
@@ -25,7 +25,7 @@ define('WP_ALL_IMPORT_ROOT_URL', rtrim(plugin_dir_url(__FILE__), '/'));
25
  */
26
  define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
27
 
28
- define('PMXI_VERSION', '3.4.1');
29
 
30
  define('PMXI_EDITION', 'free');
31
 
3
  Plugin Name: WP All Import
4
  Plugin URI: http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=plugins-page&utm_campaign=free+plugin
5
  Description: The most powerful solution for importing XML and CSV files to WordPress. Create Posts and Pages with content from any XML or CSV file. A paid upgrade to WP All Import Pro is available for support and additional features.
6
+ Version: 3.4.2
7
  Author: Soflyy
8
  */
9
 
25
  */
26
  define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
27
 
28
+ define('PMXI_VERSION', '3.4.2');
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: 4.7.2
5
- Stable tag: 3.4.1
6
  Tags: wordpress csv import, wordpress xml import, xml, csv, datafeed, import, migrate, import csv to wordpress, import xml to wordpress, advanced xml import, advanced csv import, bulk csv import, bulk xml import, bulk data import, xml to custom post type, csv to custom post type, woocommerce csv import, woocommerce xml import, csv import, import csv, xml import, import xml, csv importer
7
 
8
  WP All Import is an extremely powerful importer that makes it easy to import any XML or CSV file to WordPress.
@@ -105,6 +105,10 @@ Does it work with special character encoding like Hebrew, Arabic, Chinese, etc?
105
 
106
  == Changelog ==
107
 
 
 
 
 
108
  = 3.4.1 =
109
  * improvement: Stop parsing data which is not going to be updated
110
  * improvement: added new filter wp_all_import_phpexcel_object to modify excel data before import
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
  Tested up to: 4.7.2
5
+ Stable tag: 3.4.2
6
  Tags: wordpress csv import, wordpress xml import, xml, csv, datafeed, import, migrate, import csv to wordpress, import xml to wordpress, advanced xml import, advanced csv import, bulk csv import, bulk xml import, bulk data import, xml to custom post type, csv to custom post type, woocommerce csv import, woocommerce xml import, csv import, import csv, xml import, import xml, csv importer
7
 
8
  WP All Import is an extremely powerful importer that makes it easy to import any XML or CSV file to WordPress.
105
 
106
  == Changelog ==
107
 
108
+ = 3.4.2 =
109
+ * bug fix: conflict with the event calendar plugin
110
+ * bug fix: import images for newly created products
111
+
112
  = 3.4.1 =
113
  * improvement: Stop parsing data which is not going to be updated
114
  * improvement: added new filter wp_all_import_phpexcel_object to modify excel data before import