PluginProbe
Import WP – CSV & XML Import Export for WordPress / 2.15.2
Import WP – CSV & XML Import Export for WordPress v2.15.2
2.15.2 2.15.1 2.15.0 2.14.24 2.14.23 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 All 145 releases
← All changes | class/Common/Importer/File/CSVFile.php +13 -2 2.8.3 → 2.15.2 View file →
@@ -9,8 +9,9 @@
9 9 {
10 10
11 11 protected $enclosure = '"';
12 12 protected $delimiter = ',';
13 + protected $escape = '\\';
13 14
14 15
15 16 /**
16 17 * Set Enclosure
@@ -31,8 +32,13 @@
31 32 {
32 33 $this->delimiter = $delimiter;
33 34 }
34 35
36 + public function setEscape($escape)
37 + {
38 + $this->escape = $escape;
39 + }
40 +
35 41 /**
36 42 * Get Delimiter
37 43 *
38 44 * @return string
@@ -51,8 +57,13 @@
51 57 {
52 58 return $this->enclosure;
53 59 }
54 60
61 + public function getEscape()
62 + {
63 + return $this->enclosure === $this->escape ? '' : $this->escape;
64 + }
65 +
55 66 /**
56 67 * Generate record file positions
57 68 *
58 69 * Loop through each record and save each position
@@ -68,9 +79,9 @@
68 79 rewind($this->getFileHandle());
69 80 while (!feof($this->getFileHandle())) {
70 81
71 82 $startIndex = ftell($this->getFileHandle());
72 - $row = fgetcsv($this->getFileHandle(), 0, $this->getDelimiter(), $this->getEnclosure());
83 + $row = fgetcsv($this->getFileHandle(), 0, $this->getDelimiter(), $this->getEnclosure(), $this->getEscape());
73 84
74 85 if (!empty($row)) {
75 86 $this->setIndex($record, $startIndex, ftell($this->getFileHandle()));
76 87 $record++;
@@ -75,9 +86,9 @@
75 86 $this->setIndex($record, $startIndex, ftell($this->getFileHandle()));
76 87 $record++;
77 88 }
78 89
79 - if ($this->is_processing && ($record >= 2 || $startIndex > $this->process_max_size)) {
90 + if ($this->is_processing && $startIndex > $this->process_max_size) {
80 91 break;
81 92 }
82 93
83 94 $current_pos = intval(ftell($this->getFileHandle()));