Ultimate CSV Importer - Version 3.6.77

Version Description

Download this release

Release Info

Developer smackcoders
Plugin Icon 128x128 Ultimate CSV Importer
Version 3.6.77
Comparing to
See all releases

Code changes from version 3.6.76 to 3.6.77

Readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: smackcoders
3
  Donate link: http://www.smackcoders.com/donate.html
4
  Tags: batch, csv, excel, import, spreadsheet, autoblog, Autoblogger, csvimporter, data, dataimport, importer, wpcsvimporter, wpimporter, acf, auto blog, csv import, csv to post, data import, Easy CSV Importer, eci, import plugin, admin, user, users, Advanced CSV Import, Advanced CSV Importer, affiliate, amazon, author, automatic, blog, bulk, bulk edit, bulk editor, categories, comments, content, csv file, csv format, csv importer, custom post, e-commerce, free, images, language, manage, media, meta, multisite, News, page, photos, pictures, plugin, Post, seo, shop, shortcode, tags, Taxonomy, text, title, video, eshop, woocommerce, wordpress, xml, youtube, export
5
  Requires at least: 3.9
6
- Tested up to: 4.1
7
- Stable tag: 3.6.76
8
- Version: 3.6.76
9
  Author: smackcoders
10
  Author URI: http://profiles.wordpress.org/smackcoders/
11
 
@@ -32,7 +32,7 @@ Wordpress Ultimate CSV Importer Pro V4.0 is available as live demo for users to
32
  * Mapping template feature with edit option.
33
  * Auto mapping and specific column update in Update feature.
34
 
35
- ** Now stable version 3.6.76 available to download with hot security fix. Visit [www.wpultimatecsvimporter.com](http://www.wpultimatecsvimporter.com) for more news and future plans.
36
 
37
  WP Ultimate CSV Importer Plugin proven much effective advanced CSV File Importer With Ultimate User Friendly Features. It is much easy now even for newbies to import any csv file as any wordpress post type and associated fields by simple mapping feature. Now import any CSV file as thousands of post, page and custom post types. This is admin side free plugin helps you in bulk edit, create and import posts type for your blog or site.
38
 
@@ -195,6 +195,12 @@ This will solve your issue or get support from hosting if you dint have sufficie
195
 
196
  == Changelog ==
197
 
 
 
 
 
 
 
198
  = 3.6.76 =
199
  * Improved: Post Format.
200
  * Fixed: Export eshop data issue.
@@ -420,6 +426,9 @@ This will solve your issue or get support from hosting if you dint have sufficie
420
 
421
  == Upgrade Notice ==
422
 
 
 
 
423
  = 3.6.76 =
424
  * Upgrade now for more bug fixes.
425
 
3
  Donate link: http://www.smackcoders.com/donate.html
4
  Tags: batch, csv, excel, import, spreadsheet, autoblog, Autoblogger, csvimporter, data, dataimport, importer, wpcsvimporter, wpimporter, acf, auto blog, csv import, csv to post, data import, Easy CSV Importer, eci, import plugin, admin, user, users, Advanced CSV Import, Advanced CSV Importer, affiliate, amazon, author, automatic, blog, bulk, bulk edit, bulk editor, categories, comments, content, csv file, csv format, csv importer, custom post, e-commerce, free, images, language, manage, media, meta, multisite, News, page, photos, pictures, plugin, Post, seo, shop, shortcode, tags, Taxonomy, text, title, video, eshop, woocommerce, wordpress, xml, youtube, export
5
  Requires at least: 3.9
6
+ Tested up to: 4.1.1
7
+ Stable tag: 3.6.77
8
+ Version: 3.6.77
9
  Author: smackcoders
10
  Author URI: http://profiles.wordpress.org/smackcoders/
11
 
32
  * Mapping template feature with edit option.
33
  * Auto mapping and specific column update in Update feature.
34
 
35
+ ** Now stable version 3.6.77 available to download with minor fix on featured image naming issue. Visit [www.wpultimatecsvimporter.com](http://www.wpultimatecsvimporter.com) for more news and future plans.
36
 
37
  WP Ultimate CSV Importer Plugin proven much effective advanced CSV File Importer With Ultimate User Friendly Features. It is much easy now even for newbies to import any csv file as any wordpress post type and associated fields by simple mapping feature. Now import any CSV file as thousands of post, page and custom post types. This is admin side free plugin helps you in bulk edit, create and import posts type for your blog or site.
38
 
195
 
196
  == Changelog ==
197
 
198
+ = 3.6.77 =
199
+ * Added: WordPress 4.1.1 compatibility checked.
200
+ * Improved: Inline image import feature. Added recursive method to assign the image.
201
+ * Fixed: Featured image naming issue. [Solved](https://wordpress.org/support/topic/problem-in-import-with-the-image-name)
202
+ * Fixed: Removed unwanted warnings.
203
+
204
  = 3.6.76 =
205
  * Improved: Post Format.
206
  * Fixed: Export eshop data issue.
426
 
427
  == Upgrade Notice ==
428
 
429
+ = 3.6.77 =
430
+ * Upgrade now for WordPress 4.1.1 compatibility and minor bug fixes.
431
+
432
  = 3.6.76 =
433
  * Upgrade now for more bug fixes.
434
 
includes/WPImporter_includes_helper.php CHANGED
@@ -483,8 +483,9 @@ class WPImporter_includes_helper {
483
  $fimg_path = $full_path;
484
 
485
  $fimg_name = @basename($f_img);
486
- $fimg_name = preg_replace("/[^a-zA-Z0-9._\s]/", "", $fimg_name);
487
- $fimg_name = preg_replace('/\s/', '-', $fimg_name);
 
488
  $fimg_name = urlencode($fimg_name);
489
 
490
  $parseURL = parse_url($f_img);
@@ -492,13 +493,13 @@ class WPImporter_includes_helper {
492
  if(!isset($path_parts['extension']))
493
  $fimg_name = $fimg_name . '.jpg';
494
 
495
- $f_img_slug = preg_replace("/[^a-zA-Z0-9._\s]/", "", $new_post['post_title']);
496
- $f_img_slug = preg_replace('/\s/', '-', $f_img_slug);
497
 
498
  $post_slug_value = strtolower($f_img_slug);
499
- $fimg_name = wp_unique_filename($fimg_path, $fimg_name, $path_parts['extension']);
500
- $this->get_fimg_from_URL($f_img, $fimg_path, $fimg_name, $post_slug_value, $currentLimit, $this);
501
- $filepath = $fimg_path ."/" . $fimg_name;
502
 
503
  if(@getimagesize($filepath)){
504
  $img = wp_get_image_editor($filepath);
@@ -515,7 +516,7 @@ class WPImporter_includes_helper {
515
  );
516
  $resize = $img->multi_resize($sizes_array);
517
  }
518
- $file ['guid'] = $baseurl."/".$fimg_name;
519
  $file ['post_title'] = $fimg_name;
520
  $file ['post_content'] = '';
521
  $file ['post_status'] = 'attachment';
@@ -722,7 +723,7 @@ class WPImporter_includes_helper {
722
  }
723
  }
724
  if ($data_array) {
725
- if($this->MultiImages == 'true') {
726
  $inlineImagesObj = new WPImporter_inlineImages();
727
  $post_id = $inlineImagesObj->importwithInlineImages($data_array['ID'], $currentLimit, $data_array, $this, $importinlineimageoption, $extractedimagelocation, $sample_inlineimage_url);
728
  } else {
@@ -826,7 +827,7 @@ class WPImporter_includes_helper {
826
  $attachment = array(
827
  'guid' => $file ['guid'],
828
  'post_mime_type' => 'image/jpeg',
829
- 'post_title' => preg_replace('/\.[^.]+$/', '', @basename($file ['guid'])),
830
  'post_content' => '',
831
  'post_status' => 'inherit'
832
  );
483
  $fimg_path = $full_path;
484
 
485
  $fimg_name = @basename($f_img);
486
+ $featured_image = $fimg_name;
487
+ $fimg_name = preg_replace('/\.[^.]*$/', '', $fimg_name);
488
+ $fimg_name = strtolower(str_replace(' ','-',$fimg_name));
489
  $fimg_name = urlencode($fimg_name);
490
 
491
  $parseURL = parse_url($f_img);
493
  if(!isset($path_parts['extension']))
494
  $fimg_name = $fimg_name . '.jpg';
495
 
496
+ $f_img_slug = preg_replace('/\.[^.]*$/', '', $f_img_slug);
497
+ $f_img_slug = strtolower(str_replace(' ','-',$f_img_slug));
498
 
499
  $post_slug_value = strtolower($f_img_slug);
500
+ $fimg_name = wp_unique_filename($fimg_path, $featured_image, $path_parts['extension']);
501
+ $this->get_fimg_from_URL($f_img, $fimg_path, $featured_image, $post_slug_value, $currentLimit, $this);
502
+ $filepath = $fimg_path ."/" . $featured_image;
503
 
504
  if(@getimagesize($filepath)){
505
  $img = wp_get_image_editor($filepath);
516
  );
517
  $resize = $img->multi_resize($sizes_array);
518
  }
519
+ $file ['guid'] = $baseurl."/".$featured_image;
520
  $file ['post_title'] = $fimg_name;
521
  $file ['post_content'] = '';
522
  $file ['post_status'] = 'attachment';
723
  }
724
  }
725
  if ($data_array) {
726
+ if($this->MultiImages == 'true') { // Inline image import feature by fredrick marks
727
  $inlineImagesObj = new WPImporter_inlineImages();
728
  $post_id = $inlineImagesObj->importwithInlineImages($data_array['ID'], $currentLimit, $data_array, $this, $importinlineimageoption, $extractedimagelocation, $sample_inlineimage_url);
729
  } else {
827
  $attachment = array(
828
  'guid' => $file ['guid'],
829
  'post_mime_type' => 'image/jpeg',
830
+ 'post_title' => preg_replace('/\.[^.]*$/', '', @basename($file ['guid'])),
831
  'post_content' => '',
832
  'post_status' => 'inherit'
833
  );
index.php CHANGED
@@ -2,7 +2,7 @@
2
  /******************************
3
  * Plugin Name: WP Ultimate CSV Importer
4
  * Description: A plugin that helps to import the data's from a CSV file.
5
- * Version: 3.6.76
6
  * Author: smackcoders.com
7
  * Plugin URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
8
  * Author URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
@@ -75,7 +75,7 @@ define('WP_CONST_ULTIMATE_CSV_IMP_URL', 'http://www.smackcoders.com/wp-ultimate-
75
  define('WP_CONST_ULTIMATE_CSV_IMP_NAME', 'WP Ultimate CSV Importer');
76
  define('WP_CONST_ULTIMATE_CSV_IMP_SLUG', 'wp-ultimate-csv-importer');
77
  define('WP_CONST_ULTIMATE_CSV_IMP_SETTINGS', 'WP Ultimate CSV Importer');
78
- define('WP_CONST_ULTIMATE_CSV_IMP_VERSION', '3.6.76');
79
  define('WP_CONST_ULTIMATE_CSV_IMP_DIR', WP_PLUGIN_URL . '/' . WP_CONST_ULTIMATE_CSV_IMP_SLUG . '/');
80
  define('WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY', plugin_dir_path(__FILE__));
81
  define('WP_CSVIMP_PLUGIN_BASE', WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY);
2
  /******************************
3
  * Plugin Name: WP Ultimate CSV Importer
4
  * Description: A plugin that helps to import the data's from a CSV file.
5
+ * Version: 3.6.77
6
  * Author: smackcoders.com
7
  * Plugin URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
8
  * Author URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
75
  define('WP_CONST_ULTIMATE_CSV_IMP_NAME', 'WP Ultimate CSV Importer');
76
  define('WP_CONST_ULTIMATE_CSV_IMP_SLUG', 'wp-ultimate-csv-importer');
77
  define('WP_CONST_ULTIMATE_CSV_IMP_SETTINGS', 'WP Ultimate CSV Importer');
78
+ define('WP_CONST_ULTIMATE_CSV_IMP_VERSION', '3.6.77');
79
  define('WP_CONST_ULTIMATE_CSV_IMP_DIR', WP_PLUGIN_URL . '/' . WP_CONST_ULTIMATE_CSV_IMP_SLUG . '/');
80
  define('WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY', plugin_dir_path(__FILE__));
81
  define('WP_CSVIMP_PLUGIN_BASE', WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY);
js/ultimate-importer-free.js CHANGED
@@ -579,9 +579,9 @@ function importRecordsbySettings(siteurl)
579
  document.getElementById('terminatenow').style.display = "none";
580
  return false;
581
  }
582
-
583
  var postdata = new Array();
584
- postdata = {'dupContent':dupContent,'dupTitle':dupTitle,'importlimit':importlimit,'limit':currentlimit,'totRecords':tot_no_of_records,'selectedImporter':importas,'uploadedFile':uploadedFile,'tmpcount':tmpCnt,'importinlineimage':importinlineimage,'inlineimagehandling':imagehandling,'inline_image_location':inline_image_location,}
585
 
586
  var tmpLoc = document.getElementById('tmpLoc').value;
587
  jQuery.ajax({
579
  document.getElementById('terminatenow').style.display = "none";
580
  return false;
581
  }
582
+ var advancemedia = document.getElementById('advance_media_handling').checked;
583
  var postdata = new Array();
584
+ postdata = {'dupContent':dupContent,'dupTitle':dupTitle,'importlimit':importlimit,'limit':currentlimit,'totRecords':tot_no_of_records,'selectedImporter':importas,'uploadedFile':uploadedFile,'tmpcount':tmpCnt,'importinlineimage':importinlineimage,'inlineimagehandling':imagehandling,'inline_image_location':inline_image_location,'advance_media':advancemedia,}
585
 
586
  var tmpLoc = document.getElementById('tmpLoc').value;
587
  jQuery.ajax({
modules/custompost/templates/index.php CHANGED
@@ -182,11 +182,15 @@ $impCE = new WPImporter_includes_helper();
182
  <h2><div class="secondformheader">Import Data Configuration</div></h2>
183
  <?php
184
  if(isset($_FILES['inlineimages'])) {
 
 
 
 
185
  $uploaded_compressedFile = $_FILES['inlineimages']['tmp_name'];
186
  $get_basename_zipfile = explode('.', $_FILES['inlineimages']['name']);
187
  $basename_zipfile = $get_basename_zipfile[0];
188
- $location_to_extract = $uploadDir['basedir'] . '/smack_inline_images/' . $basename_zipfile;
189
- $extracted_image_location = $uploadDir['baseurl'] . '/smack_inline_images/' . $basename_zipfile;
190
  $zip = new ZipArchive;
191
  if ($zip->open($uploaded_compressedFile) === TRUE) {
192
  $zip->extractTo($location_to_extract);
182
  <h2><div class="secondformheader">Import Data Configuration</div></h2>
183
  <?php
184
  if(isset($_FILES['inlineimages'])) {
185
+ if(isset($_POST['uploadfilename']) && $_POST['uploadfilename'] != ''){
186
+ $get_file_name = $_POST['uploadfilename'];
187
+ $filehashkey = $impCE->convert_string2hash_key($get_file_name);
188
+ }
189
  $uploaded_compressedFile = $_FILES['inlineimages']['tmp_name'];
190
  $get_basename_zipfile = explode('.', $_FILES['inlineimages']['name']);
191
  $basename_zipfile = $get_basename_zipfile[0];
192
+ $location_to_extract = $uploadDir['basedir'] . '/smack_inline_images/' . $filehashkey;
193
+ $extracted_image_location = $uploadDir['baseurl'] . '/smack_inline_images/' . $filehashkey;
194
  $zip = new ZipArchive;
195
  if ($zip->open($uploaded_compressedFile) === TRUE) {
196
  $zip->extractTo($location_to_extract);
modules/eshop/templates/index.php CHANGED
@@ -222,11 +222,15 @@ if ($_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['isplugin_avail'] != 'not_avail'
222
  <h2><div class="secondformheader">Import Data Configuration</div></h2>
223
  <?php
224
  if(isset($_FILES['inlineimages'])) {
 
 
 
 
225
  $uploaded_compressedFile = $_FILES['inlineimages']['tmp_name'];
226
  $get_basename_zipfile = explode('.', $_FILES['inlineimages']['name']);
227
  $basename_zipfile = $get_basename_zipfile[0];
228
- $location_to_extract = $uploadDir['basedir'] . '/smack_inline_images/' . $basename_zipfile;
229
- $extracted_image_location = $uploadDir['baseurl'] . '/smack_inline_images/' . $basename_zipfile;
230
  $zip = new ZipArchive;
231
  if ($zip->open($uploaded_compressedFile) === TRUE) {
232
  $zip->extractTo($location_to_extract);
222
  <h2><div class="secondformheader">Import Data Configuration</div></h2>
223
  <?php
224
  if(isset($_FILES['inlineimages'])) {
225
+ if(isset($_POST['uploadfilename']) && $_POST['uploadfilename'] != ''){
226
+ $get_file_name = $_POST['uploadfilename'];
227
+ $filehashkey = $impCE->convert_string2hash_key($get_file_name);
228
+ }
229
  $uploaded_compressedFile = $_FILES['inlineimages']['tmp_name'];
230
  $get_basename_zipfile = explode('.', $_FILES['inlineimages']['name']);
231
  $basename_zipfile = $get_basename_zipfile[0];
232
+ $location_to_extract = $uploadDir['basedir'] . '/smack_inline_images/' . $filehashkey;
233
+ $extracted_image_location = $uploadDir['baseurl'] . '/smack_inline_images/' . $filehashkey;
234
  $zip = new ZipArchive;
235
  if ($zip->open($uploaded_compressedFile) === TRUE) {
236
  $zip->extractTo($location_to_extract);
modules/page/templates/index.php CHANGED
@@ -182,11 +182,15 @@ $impCE = new WPImporter_includes_helper();
182
  <h2><div class="secondformheader">Import Data Configuration</div></h2>
183
  <?php
184
  if(isset($_FILES['inlineimages'])) {
 
 
 
 
185
  $uploaded_compressedFile = $_FILES['inlineimages']['tmp_name'];
186
  $get_basename_zipfile = explode('.', $_FILES['inlineimages']['name']);
187
  $basename_zipfile = $get_basename_zipfile[0];
188
- $location_to_extract = $uploadDir['basedir'] . '/smack_inline_images/' . $basename_zipfile;
189
- $extracted_image_location = $uploadDir['baseurl'] . '/smack_inline_images/' . $basename_zipfile;
190
  $zip = new ZipArchive;
191
  if ($zip->open($uploaded_compressedFile) === TRUE) {
192
  $zip->extractTo($location_to_extract);
182
  <h2><div class="secondformheader">Import Data Configuration</div></h2>
183
  <?php
184
  if(isset($_FILES['inlineimages'])) {
185
+ if(isset($_POST['uploadfilename']) && $_POST['uploadfilename'] != ''){
186
+ $get_file_name = $_POST['uploadfilename'];
187
+ $filehashkey = $impCE->convert_string2hash_key($get_file_name);
188
+ }
189
  $uploaded_compressedFile = $_FILES['inlineimages']['tmp_name'];
190
  $get_basename_zipfile = explode('.', $_FILES['inlineimages']['name']);
191
  $basename_zipfile = $get_basename_zipfile[0];
192
+ $location_to_extract = $uploadDir['basedir'] . '/smack_inline_images/' . $filehashkey;
193
+ $extracted_image_location = $uploadDir['baseurl'] . '/smack_inline_images/' . $filehashkey;
194
  $zip = new ZipArchive;
195
  if ($zip->open($uploaded_compressedFile) === TRUE) {
196
  $zip->extractTo($location_to_extract);
modules/post/templates/index.php CHANGED
@@ -185,11 +185,15 @@ $impCE = new WPImporter_includes_helper();
185
  <h2><div class="secondformheader">Import Data Configuration</div></h2>
186
  <?php
187
  if(isset($_FILES['inlineimages'])) {
 
 
 
 
188
  $uploaded_compressedFile = $_FILES['inlineimages']['tmp_name'];
189
  $get_basename_zipfile = explode('.', $_FILES['inlineimages']['name']);
190
  $basename_zipfile = $get_basename_zipfile[0];
191
- $location_to_extract = $uploadDir['basedir'] . '/smack_inline_images/' . $basename_zipfile;
192
- $extracted_image_location = $uploadDir['baseurl'] . '/smack_inline_images/' . $basename_zipfile;
193
  $zip = new ZipArchive;
194
  if ($zip->open($uploaded_compressedFile) === TRUE) {
195
  $zip->extractTo($location_to_extract);
185
  <h2><div class="secondformheader">Import Data Configuration</div></h2>
186
  <?php
187
  if(isset($_FILES['inlineimages'])) {
188
+ if(isset($_POST['uploadfilename']) && $_POST['uploadfilename'] != ''){
189
+ $get_file_name = $_POST['uploadfilename'];
190
+ $filehashkey = $impCE->convert_string2hash_key($get_file_name);
191
+ }
192
  $uploaded_compressedFile = $_FILES['inlineimages']['tmp_name'];
193
  $get_basename_zipfile = explode('.', $_FILES['inlineimages']['name']);
194
  $basename_zipfile = $get_basename_zipfile[0];
195
+ $location_to_extract = $uploadDir['basedir'] . '/smack_inline_images/' . $filehashkey;
196
+ $extracted_image_location = $uploadDir['baseurl'] . '/smack_inline_images/' . $filehashkey;
197
  $zip = new ZipArchive;
198
  if ($zip->open($uploaded_compressedFile) === TRUE) {
199
  $zip->extractTo($location_to_extract);
plugins/class.inlineimages.php CHANGED
@@ -9,7 +9,7 @@ class WPImporter_inlineImages {
9
  function importwithInlineImages ($recordID, $currentLimit, $data_array, $impObj, $import_image_method, $imgLoc, $sampleURL) {
10
  $helperObj = new WPImporter_includes_helper();
11
  $res_array = $this->process_multi_images($data_array, $helperObj, $currentLimit, $impObj, $import_image_method, $imgLoc, $sampleURL);
12
- #print_r($res_array); die('am from importwithInlineImages function');
13
  $data_array['post_content'] = $res_array;
14
  $post_id = wp_insert_post($data_array);
15
  $impObj->insPostCount++;
@@ -32,10 +32,12 @@ class WPImporter_inlineImages {
32
  $get_name=explode('/',$img_path);
33
  $count=count($get_name);
34
  $img_real_name = $get_name[$count - 1];
35
- $inline_img_slug = preg_replace("/[^a-zA-Z0-9._\s]/", "", $data_array['post_title']);
36
- $inline_img_slug = preg_replace('/\s/', '-', $inline_img_slug);
37
  $post_slug_value = strtolower($inline_img_slug);
38
  $dir = wp_upload_dir();
 
 
39
  $media_location = $dir ['baseurl'];
40
  $get_media_settings = get_option('uploads_use_yearmonth_folders');
41
  if ($get_media_settings == 1) {
@@ -46,20 +48,38 @@ class WPImporter_inlineImages {
46
  $full_path = $dir ['basedir'];
47
  $baseurl = $dir ['baseurl'];
48
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  $inline_img_path = $full_path;
50
  #$img_real_name = wp_unique_filename($inline_img_path, $img_real_name, $unique_filename_callback = null);
51
  if($import_image_method == 'imagewithextension' && $count == 1 ) {
52
- $new_img_path = $imgLoc . '/' . $img_real_name;
53
- $inline = $helperObj->get_fimg_from_URL($new_img_path, $inline_img_path, $img_real_name, $post_slug_value, $currentLimit, $impObj);
54
  } else {
55
  if($sampleURL == null) {
56
  $inline = $helperObj->get_fimg_from_URL($img_path, $inline_img_path, $img_real_name, $post_slug_value, $currentLimit, $impObj);
57
  } else {
58
- $new_img_path = $sampleURL . '/' . $img_real_name;
59
- $inline = $helperObj->get_fimg_from_URL($new_img_path, $inline_img_path, $img_real_name, $post_slug_value, $currentLimit, $impObj);
60
  }
61
  }
62
- $inline_filepath = $inline_img_path . "/" . $inline;
63
  if (@getimagesize($inline_filepath)) {
64
  $img = wp_get_image_editor($inline_filepath);
65
  if (!is_wp_error($img)) {
@@ -75,12 +95,12 @@ class WPImporter_inlineImages {
75
  );
76
  $resize = $img->multi_resize($sizes_array);
77
  }
78
- $inline_file ['guid'] = $baseurl . "/" . $inline;
79
  $inline_file ['post_title'] = $inline;
80
  $inline_file ['post_content'] = '';
81
  $inline_file ['post_status'] = 'attachment';
82
  $wp_upload_dir = wp_upload_dir();
83
- $attachment = array('guid' => $inline_file ['guid'], 'post_mime_type' => 'image/jpg', 'post_title' => preg_replace('/\.[^.]+$/', '', @basename($inline_file ['guid'])), 'post_content' => '', 'post_status' => 'inherit');
84
  if ($get_media_settings == 1) {
85
  $generate_attachment = $dirname . '/' . $inline;
86
  } else {
@@ -145,3 +165,28 @@ class WPImporter_inlineImages {
145
  }
146
  }
147
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  function importwithInlineImages ($recordID, $currentLimit, $data_array, $impObj, $import_image_method, $imgLoc, $sampleURL) {
10
  $helperObj = new WPImporter_includes_helper();
11
  $res_array = $this->process_multi_images($data_array, $helperObj, $currentLimit, $impObj, $import_image_method, $imgLoc, $sampleURL);
12
+ # print_r($res_array); die('am from importwithInlineImages function');
13
  $data_array['post_content'] = $res_array;
14
  $post_id = wp_insert_post($data_array);
15
  $impObj->insPostCount++;
32
  $get_name=explode('/',$img_path);
33
  $count=count($get_name);
34
  $img_real_name = $get_name[$count - 1];
35
+ $inline_img_slug = preg_replace("/\.[^.]*$/", "", $data_array['post_title']);
36
+ $inline_img_slug = preg_replace(' ', '-', $inline_img_slug);
37
  $post_slug_value = strtolower($inline_img_slug);
38
  $dir = wp_upload_dir();
39
+ $inlineimageDir = $dir['basedir'] . '/smack_inline_images';
40
+ $inlineimageURL = $dir['baseurl'] . '/smack_inline_images';
41
  $media_location = $dir ['baseurl'];
42
  $get_media_settings = get_option('uploads_use_yearmonth_folders');
43
  if ($get_media_settings == 1) {
48
  $full_path = $dir ['basedir'];
49
  $baseurl = $dir ['baseurl'];
50
  }
51
+ $eventKey = $_POST['postdata']['uploadedFile'];
52
+
53
+ $inlineimageDirpath = $inlineimageDir . '/' . $eventKey;
54
+ $imagelist = scanDirectories($inlineimageDirpath);
55
+ if(!$imagelist) {
56
+ echo 'Images not available!'; die;
57
+ }
58
+ foreach($imagelist as $imgwithloc) {
59
+ if(strpos($imgwithloc, $img_real_name))
60
+ $currentLoc = $imgwithloc;
61
+ }
62
+
63
+ $exploded_currentLoc = explode("$eventKey", $currentLoc);
64
+ if(!empty($exploded_currentLoc))
65
+ $inlimg_curr_loc = $exploded_currentLoc[1];
66
+
67
+ $inlineimageURL = $inlineimageURL . '/' . $eventKey . $inlimg_curr_loc;
68
+
69
  $inline_img_path = $full_path;
70
  #$img_real_name = wp_unique_filename($inline_img_path, $img_real_name, $unique_filename_callback = null);
71
  if($import_image_method == 'imagewithextension' && $count == 1 ) {
72
+ # $new_img_path = $imgLoc . '/' . $img_real_name;
73
+ $inline = $helperObj->get_fimg_from_URL($inlineimageURL, $inline_img_path, $img_real_name, $post_slug_value, $currentLimit, $impObj);
74
  } else {
75
  if($sampleURL == null) {
76
  $inline = $helperObj->get_fimg_from_URL($img_path, $inline_img_path, $img_real_name, $post_slug_value, $currentLimit, $impObj);
77
  } else {
78
+ # $new_img_path = $sampleURL . '/' . $img_real_name;
79
+ $inline = $helperObj->get_fimg_from_URL($inlineimageURL, $inline_img_path, $img_real_name, $post_slug_value, $currentLimit, $impObj);
80
  }
81
  }
82
+ $inline_filepath = $inline_img_path . "/" . $img_real_name;
83
  if (@getimagesize($inline_filepath)) {
84
  $img = wp_get_image_editor($inline_filepath);
85
  if (!is_wp_error($img)) {
95
  );
96
  $resize = $img->multi_resize($sizes_array);
97
  }
98
+ $inline_file ['guid'] = $baseurl . "/" . $img_real_name;
99
  $inline_file ['post_title'] = $inline;
100
  $inline_file ['post_content'] = '';
101
  $inline_file ['post_status'] = 'attachment';
102
  $wp_upload_dir = wp_upload_dir();
103
+ $attachment = array('guid' => $inline_file ['guid'], 'post_mime_type' => 'image/jpg', 'post_title' => preg_replace('/\.[^.]*$/', '', @basename($inline_file ['guid'])), 'post_content' => '', 'post_status' => 'inherit');
104
  if ($get_media_settings == 1) {
105
  $generate_attachment = $dirname . '/' . $inline;
106
  } else {
165
  }
166
  }
167
  }
168
+
169
+ function scanDirectories($rootDir, $allData=array()) {
170
+ // set filenames invisible if you want
171
+ $invisibleFileNames = array(".", "..", ".htaccess", ".htpasswd");
172
+ // run through content of root directory
173
+ if(!is_dir($rootDir))
174
+ return false;
175
+ $dirContent = scandir($rootDir);
176
+ foreach($dirContent as $key => $content) {
177
+ // filter all files not accessible
178
+ $path = $rootDir.'/'.$content;
179
+ if(!in_array($content, $invisibleFileNames)) {
180
+ // if content is file & readable, add to array
181
+ if(is_file($path) && is_readable($path)) {
182
+ // save file name with path
183
+ $allData[] = $path;
184
+ // if content is a directory and readable, add path and name
185
+ }elseif(is_dir($path) && is_readable($path)) {
186
+ // recursive callback to open new directory
187
+ $allData = scanDirectories($path, $allData);
188
+ }
189
+ }
190
+ }
191
+ return $allData;
192
+ }
templates/import.php CHANGED
@@ -170,13 +170,16 @@ for ($i = $limit; $i < $count; $i++) {
170
  }
171
 
172
  if ($limit >= $totRecords) {
 
173
  $dir = $skinnyObj->getUploadDirectory();
174
  $get_inline_imageDir = explode('/', $extracted_image_location);
175
  $explodedCount = count($get_inline_imageDir);
176
  $inline_image_dirname = $get_inline_imageDir[$explodedCount - 1];
177
  $uploadDir = $skinnyObj->getUploadDirectory('inlineimages');
178
  $inline_images_dir = $uploadDir . '/smack_inline_images/' . $inline_image_dirname;
179
- $skinnyObj->deletefileafterprocesscomplete($inline_images_dir);
 
 
180
  $skinnyObj->deletefileafterprocesscomplete($dir);
181
  }
182
  if ($importObj->insPostCount != 0 || $importObj->dupPostCount != 0 || $importObj->updatedPostCount != 0) {
170
  }
171
 
172
  if ($limit >= $totRecords) {
173
+ $advancemedia = $_POST['postdata']['advance_media'];
174
  $dir = $skinnyObj->getUploadDirectory();
175
  $get_inline_imageDir = explode('/', $extracted_image_location);
176
  $explodedCount = count($get_inline_imageDir);
177
  $inline_image_dirname = $get_inline_imageDir[$explodedCount - 1];
178
  $uploadDir = $skinnyObj->getUploadDirectory('inlineimages');
179
  $inline_images_dir = $uploadDir . '/smack_inline_images/' . $inline_image_dirname;
180
+ if($advancemedia == 'true'){
181
+ $skinnyObj->deletefileafterprocesscomplete($inline_images_dir);
182
+ }
183
  $skinnyObj->deletefileafterprocesscomplete($dir);
184
  }
185
  if ($importObj->insPostCount != 0 || $importObj->dupPostCount != 0 || $importObj->updatedPostCount != 0) {