Really Simple CSV Importer - Version 0.6.3

Version Description

  • Enhancement: Remove Byte Order Mark automatically (Thanks lucianosantana!)
Download this release

Release Info

Developer hissy
Plugin Icon wp plugin Really Simple CSV Importer
Version 0.6.3
Comparing to
See all releases

Code changes from version 0.6.2 to 0.6.3

Files changed (3) hide show
  1. readme.txt +5 -3
  2. rs-csv-helper.php +15 -10
  3. rs-csv-importer.php +1 -1
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: hissy, wokamoto
3
  Tags: importer, csv, acf, cfs
4
  Requires at least: 3.0
5
- Tested up to: 3.9.1
6
- Stable tag: 0.6.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -210,6 +210,8 @@ Example: [gist](https://gist.github.com/hissy/1ea54a46fd07be9f4334)
210
 
211
  == Changelog ==
212
 
 
 
213
  = 0.6.2 =
214
  * Fix error on PHP 5.2
215
  = 0.6.1 =
@@ -239,7 +241,7 @@ Example: [gist](https://gist.github.com/hissy/1ea54a46fd07be9f4334)
239
  = 0.4.1 =
240
  * Version fix
241
  = 0.4 =
242
- * New feature: Added custom taxonomy support. Thanks chuckhendo!
243
  = 0.3 =
244
  * New feature: Advanced Custom Fields integrate.
245
  * Enhancement: Use post_id if not already present when inserting post.
2
  Contributors: hissy, wokamoto
3
  Tags: importer, csv, acf, cfs
4
  Requires at least: 3.0
5
+ Tested up to: 4.0.1
6
+ Stable tag: 0.6.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
210
 
211
  == Changelog ==
212
 
213
+ = 0.6.3 =
214
+ * Enhancement: Remove Byte Order Mark automatically (Thanks lucianosantana!)
215
  = 0.6.2 =
216
  * Fix error on PHP 5.2
217
  = 0.6.1 =
241
  = 0.4.1 =
242
  * Version fix
243
  = 0.4 =
244
+ * New feature: Added custom taxonomy support. (Thanks chuckhendo!)
245
  = 0.3 =
246
  * New feature: Advanced Custom Fields integrate.
247
  * Enhancement: Use post_id if not already present when inserting post.
rs-csv-helper.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
 
3
  class RS_CSV_Helper {
4
-
5
  const DELIMITER = ",";
6
-
7
  // File utility functions
8
  public function fopen($filename, $mode='r') {
9
  return fopen($filename, $mode);
@@ -16,22 +16,27 @@ class RS_CSV_Helper {
16
  public function fclose($fp) {
17
  return fclose($fp);
18
  }
19
-
20
  public function parse_columns(&$obj, $array) {
21
  if (!is_array($array) || count($array) == 0)
22
  return false;
23
-
 
 
 
 
 
24
  $keys = array_keys($array);
25
  $values = array_values($array);
26
-
27
  $obj->column_indexes = array_combine($values, $keys);
28
  $obj->column_keys = array_combine($keys, $values);
29
  }
30
-
31
  public function get_data($obj, &$array, $key) {
32
  if (!isset($obj->column_indexes) || !is_array($array) || count($array) == 0)
33
  return false;
34
-
35
  if (isset($obj->column_indexes[$key])) {
36
  $index = $obj->column_indexes[$key];
37
  if (isset($array[$index]) && !empty($array[$index])) {
@@ -42,8 +47,8 @@ class RS_CSV_Helper {
42
  unset($array[$index]);
43
  }
44
  }
45
-
46
  return false;
47
  }
48
-
49
- }
1
  <?php
2
 
3
  class RS_CSV_Helper {
4
+
5
  const DELIMITER = ",";
6
+
7
  // File utility functions
8
  public function fopen($filename, $mode='r') {
9
  return fopen($filename, $mode);
16
  public function fclose($fp) {
17
  return fclose($fp);
18
  }
19
+
20
  public function parse_columns(&$obj, $array) {
21
  if (!is_array($array) || count($array) == 0)
22
  return false;
23
+
24
+ $bom = pack("CCC", 0xef, 0xbb, 0xbf);
25
+ if (0 == strncmp($array[0], $bom, 3)) {
26
+ $array[0] = substr($array[0], 3);
27
+ }
28
+
29
  $keys = array_keys($array);
30
  $values = array_values($array);
31
+
32
  $obj->column_indexes = array_combine($values, $keys);
33
  $obj->column_keys = array_combine($keys, $values);
34
  }
35
+
36
  public function get_data($obj, &$array, $key) {
37
  if (!isset($obj->column_indexes) || !is_array($array) || count($array) == 0)
38
  return false;
39
+
40
  if (isset($obj->column_indexes[$key])) {
41
  $index = $obj->column_indexes[$key];
42
  if (isset($array[$index]) && !empty($array[$index])) {
47
  unset($array[$index]);
48
  }
49
  }
50
+
51
  return false;
52
  }
53
+
54
+ }
rs-csv-importer.php CHANGED
@@ -7,7 +7,7 @@ Author: Takuro Hishikawa, wokamoto
7
  Author URI: https://en.digitalcube.jp/
8
  Text Domain: rs-csv-importer
9
  License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
- Version: 0.6.2
11
  */
12
 
13
  if ( !defined('WP_LOAD_IMPORTERS') )
7
  Author URI: https://en.digitalcube.jp/
8
  Text Domain: rs-csv-importer
9
  License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
+ Version: 0.6.3
11
  */
12
 
13
  if ( !defined('WP_LOAD_IMPORTERS') )