Ultimate CSV Importer - Version 1.0.2

Version Description

Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.2

Readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=fenzi
4
  Tags: batch, excel, import, spreadsheet, plugin, admin, csv, importer,
5
  Requires at least: 3.4
6
  Tested up to: 3.4.2
7
- Stable tag: 1.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -35,7 +35,7 @@ Please visit http://www.smackcoders.com/category/free-wordpress-plugins.html for
35
  1. Unzip the file 'wp-ultimate-csv-importer.zip'.
36
  2. Upload the ' wp-ultimate-csv-importer ' directory to '/wp-content/plugins/' directory using ftp client or upload and install
37
  wp-ultimate-csv-importer.zip through plugin install wizard in wp admin panel
38
- 3. Make /wp-content/plugins/wp-ultimate-csv-importer/imported_csv as writable (chmod 777) to import csv.
39
  4. Activate the plugin through the 'Plugins' menu in WordPress.
40
  5. After activating, you will see an option for 'Wp Ultimate CSV Importer' in the admin menu (left navigation) and you will import the csv files to import the data's.
41
 
@@ -45,17 +45,24 @@ wp-ultimate-csv-importer.zip through plugin install wizard in wp admin panel
45
  1. Admin settings for Wp Ultimate CSV Importer Plugin .
46
  2. Admin settings for Import Data and Header Mapping configutration to import data's from a csv file.
47
 
 
48
  == Changelog ==
49
- 1.0.0 Initial release version. Tested and found works well without any issues.
50
 
51
- 1.0.1 Added features to import multiple tags and categories with different delimiters.
 
 
 
 
 
52
 
53
 
54
  == Upgrade Notice ==
55
 
56
- v1.0.0 Initial release of plugin.
 
 
57
 
58
- v1.0.1 Added features to import multiple tags and categories with different delimiters.
59
 
60
 
61
  == Frequently Asked Questions ==
@@ -67,6 +74,7 @@ v1.0.1 Added features to import multiple tags and categories with different deli
67
  2. How to use the plugin?
68
 
69
  After plugin activation you can see the ' Wp Ultimate CSV Importer ' menu in admin backend.
 
70
  a. Browse csv file to import the data's.
71
  b. Select the post type or post / page to import as.
72
  b. Map each header to the relevant fields using the drop downs to import.
@@ -74,10 +82,12 @@ v1.0.1 Added features to import multiple tags and categories with different deli
74
 
75
  3. How to define the multiple tags and categories?
76
 
77
- In CSV, tags should be seperated by "," to import mutiple tags and categories should be seperated by "|" to import multiple categories.
 
78
 
79
  Configuring our plugin is as simple as that.
80
 
 
81
  Please use support section in wordpress itself for any further queries and feature request.
82
 
83
 
4
  Tags: batch, excel, import, spreadsheet, plugin, admin, csv, importer,
5
  Requires at least: 3.4
6
  Tested up to: 3.4.2
7
+ Stable tag: 1.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
35
  1. Unzip the file 'wp-ultimate-csv-importer.zip'.
36
  2. Upload the ' wp-ultimate-csv-importer ' directory to '/wp-content/plugins/' directory using ftp client or upload and install
37
  wp-ultimate-csv-importer.zip through plugin install wizard in wp admin panel
38
+ 3. Make /wp-content/plugins/wp-ultimate-csv-importer as writable (chmod 777) to import csv.
39
  4. Activate the plugin through the 'Plugins' menu in WordPress.
40
  5. After activating, you will see an option for 'Wp Ultimate CSV Importer' in the admin menu (left navigation) and you will import the csv files to import the data's.
41
 
45
  1. Admin settings for Wp Ultimate CSV Importer Plugin .
46
  2. Admin settings for Import Data and Header Mapping configutration to import data's from a csv file.
47
 
48
+
49
  == Changelog ==
 
50
 
51
+ 1.0.0 Initial release version. Tested and found works well without any issues.
52
+
53
+ 1.0.1 Added features to import multiple tags and categories with different delimiters.
54
+
55
+ 1.0.2 - Bug fixed to recognize the trimmed trailing space in the CSV file
56
+ - Added validation for the duplicate field mapping.
57
 
58
 
59
  == Upgrade Notice ==
60
 
61
+ v1.0.0 Initial release of plugin.
62
+
63
+ v1.0.1 Added features to import multiple tags and categories with different delimiters.
64
 
65
+ v1.0.2 This version have important bug fixes and newly added features. Must upgrade immediately.
66
 
67
 
68
  == Frequently Asked Questions ==
74
  2. How to use the plugin?
75
 
76
  After plugin activation you can see the ' Wp Ultimate CSV Importer ' menu in admin backend.
77
+
78
  a. Browse csv file to import the data's.
79
  b. Select the post type or post / page to import as.
80
  b. Map each header to the relevant fields using the drop downs to import.
82
 
83
  3. How to define the multiple tags and categories?
84
 
85
+ In CSV, tags should be seperated by "," to import mutiple tags and categories should be seperated by "|" to import multiple categories.
86
+
87
 
88
  Configuring our plugin is as simple as that.
89
 
90
+
91
  Please use support section in wordpress itself for any further queries and feature request.
92
 
93
 
wp_ultimate_csv_importer.js CHANGED
@@ -1,10 +1,11 @@
1
 
2
  // Function for add customfield
3
 
4
- function addcustomfield(){
5
  var a = document.getElementById('h1').value;
6
  var aa = document.getElementById('h2').value;
7
- for(i=0;i<aa;i++){
 
8
  var b = document.getElementById('mapping'+i).value;
9
  if(b=='add_custom'+i){
10
  document.getElementById('textbox'+i).style.display="";
@@ -13,6 +14,19 @@ function addcustomfield(){
13
  document.getElementById('textbox'+i).style.display="none";
14
  }
15
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
17
 
18
  // Function for check file exist
@@ -26,3 +40,34 @@ function file_exist(){
26
  return true;
27
  }
28
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
  // Function for add customfield
3
 
4
+ function addcustomfield(myval,selected_id){
5
  var a = document.getElementById('h1').value;
6
  var aa = document.getElementById('h2').value;
7
+ var selected_value;// added at version 1.0.2 by fredrick
8
+ for(var i=0;i<aa;i++){
9
  var b = document.getElementById('mapping'+i).value;
10
  if(b=='add_custom'+i){
11
  document.getElementById('textbox'+i).style.display="";
14
  document.getElementById('textbox'+i).style.display="none";
15
  }
16
  }
17
+ // Code Added at version 1.0.2 by fredrick
18
+ var header_count = document.getElementById('h2').value;
19
+ for(var j=0;j<header_count;j++){
20
+ var selected_value = document.getElementById('mapping'+j);
21
+ var value1 = selected_value.options[selected_value.selectedIndex].value;
22
+ if(j != selected_id){
23
+ if(myval == value1 && myval != '-- Select --'){
24
+ var selected_dropdown = document.getElementById('mapping'+selected_id);
25
+ selected_dropdown.selectedIndex = '-- Select --';
26
+ alert(myval+' is already selected!');
27
+ }
28
+ }
29
+ }
30
  }
31
 
32
  // Function for check file exist
40
  return true;
41
  }
42
  }
43
+
44
+ // Code added at version 1.0.2 by fredrick
45
+
46
+ // Function for import csv
47
+
48
+ function import_csv(){
49
+ var header_count = document.getElementById('h2').value;
50
+ var array = new Array();
51
+ var val1,val2;
52
+ val1 = val2 = 'Off';
53
+ for(var i=0;i<header_count;i++){
54
+ var e = document.getElementById("mapping"+i);
55
+ var value = e.options[e.selectedIndex].value;
56
+ array[i] = value;
57
+ }
58
+ for(var j=0;j<array.length;j++){
59
+ if(array[j] == 'post_title'){
60
+ val1 = 'On';
61
+ }
62
+ if(array[j] == 'post_content'){
63
+ val2 = 'On';
64
+ }
65
+ }
66
+ if(val1 == 'On' && val2 == 'On') {
67
+ return true;
68
+ }
69
+ else{
70
+ alert('"post_type" and "post_content" should be mapped.');
71
+ return false;
72
+ }
73
+ }
wp_ultimate_csv_importer.php CHANGED
@@ -3,7 +3,7 @@
3
  *Plugin Name: Wp Ultimate CSV Importer
4
  *Plugin URI: http://www.smackcoders.com/category/free-wordpress-plugins.html
5
  *Description: A plugin that helps to import the data's from a CSV file.
6
- *Version: 1.0.1
7
  *Author: smackcoders.com
8
  *Author URI: http://www.smackcoders.com
9
  *
@@ -101,6 +101,7 @@ function description(){
101
  // CSV File Reader
102
  function csv_file_data($file,$delim)
103
  {
 
104
  global $data_rows;
105
  global $headers;
106
  global $delim;
@@ -114,6 +115,7 @@ function csv_file_data($file,$delim)
114
  $c ++;
115
  }
116
  fclose($resource);
 
117
  }
118
 
119
  // Move file
@@ -155,7 +157,7 @@ function upload_csv_file()
155
  <div style="background-color: #FFFFE0;border-color: #E6DB55;border-radius: 3px 3px 3px 3px;border-style: solid;border-width: 1px;margin: 5px 15px 2px; margin-top:15px;padding: 5px;text-align:center"> Please check out <a href="http://smackcoders.com/category/free-wordpress-plugins.html" target="_blank">www.smackcoders.com</a> for the latest news and details of other great plugins and tools. </div><br/>
156
  <?php if ( count($headers)>1 && count($data_rows)>1 ){?>
157
  <div style="float:left;min-width:45%">
158
- <form class="add:the-list: validate" method="post">
159
  <h3>Import Data Configuration</h3>
160
  <div style="margin-top:30px;>
161
  <input name="_csv_importer_import_as_draft" type="hidden" value="publish" />
@@ -189,7 +191,7 @@ function upload_csv_file()
189
  <label><?php print($value);?></label>
190
  </td>
191
  <td>
192
- <select name="mapping<?php print($count);?>" id="mapping<?php print($count);?>" class ='uiButton' onchange="addcustomfield();">
193
  <option id="select" name="select">-- Select --</option>
194
  <?php
195
  foreach($defaults as $key1=>$value1){
3
  *Plugin Name: Wp Ultimate CSV Importer
4
  *Plugin URI: http://www.smackcoders.com/category/free-wordpress-plugins.html
5
  *Description: A plugin that helps to import the data's from a CSV file.
6
+ *Version: 1.0.2
7
  *Author: smackcoders.com
8
  *Author URI: http://www.smackcoders.com
9
  *
101
  // CSV File Reader
102
  function csv_file_data($file,$delim)
103
  {
104
+ ini_set("auto_detect_line_endings", true); // added by fredrick at version 1.0.2
105
  global $data_rows;
106
  global $headers;
107
  global $delim;
115
  $c ++;
116
  }
117
  fclose($resource);
118
+ ini_set("auto_detect_line_endings", false); // added by fredrick at version 1.0.2
119
  }
120
 
121
  // Move file
157
  <div style="background-color: #FFFFE0;border-color: #E6DB55;border-radius: 3px 3px 3px 3px;border-style: solid;border-width: 1px;margin: 5px 15px 2px; margin-top:15px;padding: 5px;text-align:center"> Please check out <a href="http://smackcoders.com/category/free-wordpress-plugins.html" target="_blank">www.smackcoders.com</a> for the latest news and details of other great plugins and tools. </div><br/>
158
  <?php if ( count($headers)>1 && count($data_rows)>1 ){?>
159
  <div style="float:left;min-width:45%">
160
+ <form class="add:the-list: validate" method="post" onsubmit="return import_csv();">
161
  <h3>Import Data Configuration</h3>
162
  <div style="margin-top:30px;>
163
  <input name="_csv_importer_import_as_draft" type="hidden" value="publish" />
191
  <label><?php print($value);?></label>
192
  </td>
193
  <td>
194
+ <select name="mapping<?php print($count);?>" id="mapping<?php print($count);?>" class ='uiButton' onchange="addcustomfield(this.value,<?php echo $count; ?>);">
195
  <option id="select" name="select">-- Select --</option>
196
  <?php
197
  foreach($defaults as $key1=>$value1){