Import any XML or CSV File to WordPress - Version 3.6.2

Version Description

  • improvement: add ability to control taxonomy mapping case sensitivity via filter wpai_is_case_insensitive_taxonomy_mapping
  • improvement: add ability to control uploads directory for single file/image via filters wp_all_import_single_image_uploads_dir and wp_all_import_single_attachment_uploads_dir
  • improvement: add missing options on confirm import step
  • bug fix
  • improvement: initial PHP 8 support
  • bugfix: manage_options capability check
Download this release

Release Info

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

Code changes from version 3.6.1 to 3.6.2

classes/PHPExcel/Calculation.php CHANGED
@@ -2548,7 +2548,7 @@ class PHPExcel_Calculation
2548
  public static function unwrapResult($value)
2549
  {
2550
  if (is_string($value)) {
2551
- if ((isset($value{0})) && ($value{0} == '"') && (substr($value, -1) == '"')) {
2552
  return substr($value, 1, -1);
2553
  }
2554
  // Convert numeric errors to NaN error
@@ -2669,11 +2669,11 @@ class PHPExcel_Calculation
2669
  // Basic validation that this is indeed a formula
2670
  // We return an empty array if not
2671
  $formula = trim($formula);
2672
- if ((!isset($formula{0})) || ($formula{0} != '=')) {
2673
  return array();
2674
  }
2675
  $formula = ltrim(substr($formula, 1));
2676
- if (!isset($formula{0})) {
2677
  return array();
2678
  }
2679
 
@@ -2761,11 +2761,11 @@ class PHPExcel_Calculation
2761
  // Basic validation that this is indeed a formula
2762
  // We simply return the cell value if not
2763
  $formula = trim($formula);
2764
- if ($formula{0} != '=') {
2765
  return self::wrapResult($formula);
2766
  }
2767
  $formula = ltrim(substr($formula, 1));
2768
- if (!isset($formula{0})) {
2769
  return self::wrapResult($formula);
2770
  }
2771
 
@@ -2777,7 +2777,7 @@ class PHPExcel_Calculation
2777
  return $cellValue;
2778
  }
2779
 
2780
- if (($wsTitle{0} !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) {
2781
  if ($this->cyclicFormulaCount <= 0) {
2782
  $this->cyclicFormulaCell = '';
2783
  return $this->raiseFormulaError('Cyclic Reference in Formula');
@@ -3031,7 +3031,7 @@ class PHPExcel_Calculation
3031
  } else {
3032
  if ($value == '') {
3033
  return 'an empty string';
3034
- } elseif ($value{0} == '#') {
3035
  return 'a '.$value.' error';
3036
  } else {
3037
  $typeString = 'a string';
@@ -3163,10 +3163,10 @@ class PHPExcel_Calculation
3163
  // Loop through the formula extracting each operator and operand in turn
3164
  while (true) {
3165
  //echo 'Assessing Expression '.substr($formula, $index), PHP_EOL;
3166
- $opCharacter = $formula{$index}; // Get the first character of the value at the current index position
3167
  //echo 'Initial character of expression block is '.$opCharacter, PHP_EOL;
3168
- if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula{$index+1}]))) {
3169
- $opCharacter .= $formula{++$index};
3170
  //echo 'Initial character of expression block is comparison operator '.$opCharacter.PHP_EOL;
3171
  }
3172
 
@@ -3454,11 +3454,11 @@ class PHPExcel_Calculation
3454
  }
3455
  }
3456
  // Ignore white space
3457
- while (($formula{$index} == "\n") || ($formula{$index} == "\r")) {
3458
  ++$index;
3459
  }
3460
- if ($formula{$index} == ' ') {
3461
- while ($formula{$index} == ' ') {
3462
  ++$index;
3463
  }
3464
  // If we're expecting an operator, but only have a space between the previous and next operands (and both are
@@ -3888,7 +3888,7 @@ class PHPExcel_Calculation
3888
  // echo 'Token is a PHPExcel constant: '.$excelConstant.'<br />';
3889
  $stack->push('Constant Value', self::$excelConstants[$excelConstant]);
3890
  $this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->showTypeDetails(self::$excelConstants[$excelConstant]));
3891
- } elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) {
3892
  // echo 'Token is a number, boolean, string, null or an Excel error<br />';
3893
  $stack->push('Value', $token);
3894
  // if the token is a named range, push the named range name onto the stack
@@ -3933,13 +3933,13 @@ class PHPExcel_Calculation
3933
  if (is_string($operand)) {
3934
  // We only need special validations for the operand if it is a string
3935
  // Start by stripping off the quotation marks we use to identify true excel string values internally
3936
- if ($operand > '' && $operand{0} == '"') {
3937
  $operand = self::unwrapResult($operand);
3938
  }
3939
  // If the string is a numeric value, we treat it as a numeric, so no further testing
3940
  if (!is_numeric($operand)) {
3941
  // If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations
3942
- if ($operand > '' && $operand{0} == '#') {
3943
  $stack->push('Value', $operand);
3944
  $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand));
3945
  return false;
@@ -3995,10 +3995,10 @@ class PHPExcel_Calculation
3995
  }
3996
 
3997
  // Simple validate the two operands if they are string values
3998
- if (is_string($operand1) && $operand1 > '' && $operand1{0} == '"') {
3999
  $operand1 = self::unwrapResult($operand1);
4000
  }
4001
- if (is_string($operand2) && $operand2 > '' && $operand2{0} == '"') {
4002
  $operand2 = self::unwrapResult($operand2);
4003
  }
4004
 
2548
  public static function unwrapResult($value)
2549
  {
2550
  if (is_string($value)) {
2551
+ if ((isset($value[0])) && ($value[0] == '"') && (substr($value, -1) == '"')) {
2552
  return substr($value, 1, -1);
2553
  }
2554
  // Convert numeric errors to NaN error
2669
  // Basic validation that this is indeed a formula
2670
  // We return an empty array if not
2671
  $formula = trim($formula);
2672
+ if ((!isset($formula[0])) || ($formula[0] != '=')) {
2673
  return array();
2674
  }
2675
  $formula = ltrim(substr($formula, 1));
2676
+ if (!isset($formula[0])) {
2677
  return array();
2678
  }
2679
 
2761
  // Basic validation that this is indeed a formula
2762
  // We simply return the cell value if not
2763
  $formula = trim($formula);
2764
+ if ($formula[0] != '=') {
2765
  return self::wrapResult($formula);
2766
  }
2767
  $formula = ltrim(substr($formula, 1));
2768
+ if (!isset($formula[0])) {
2769
  return self::wrapResult($formula);
2770
  }
2771
 
2777
  return $cellValue;
2778
  }
2779
 
2780
+ if (($wsTitle[0] !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) {
2781
  if ($this->cyclicFormulaCount <= 0) {
2782
  $this->cyclicFormulaCell = '';
2783
  return $this->raiseFormulaError('Cyclic Reference in Formula');
3031
  } else {
3032
  if ($value == '') {
3033
  return 'an empty string';
3034
+ } elseif ($value[0] == '#') {
3035
  return 'a '.$value.' error';
3036
  } else {
3037
  $typeString = 'a string';
3163
  // Loop through the formula extracting each operator and operand in turn
3164
  while (true) {
3165
  //echo 'Assessing Expression '.substr($formula, $index), PHP_EOL;
3166
+ $opCharacter = $formula[$index]; // Get the first character of the value at the current index position
3167
  //echo 'Initial character of expression block is '.$opCharacter, PHP_EOL;
3168
+ if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula[$index+1]]))) {
3169
+ $opCharacter .= $formula[++$index];
3170
  //echo 'Initial character of expression block is comparison operator '.$opCharacter.PHP_EOL;
3171
  }
3172
 
3454
  }
3455
  }
3456
  // Ignore white space
3457
+ while (($formula[$index] == "\n") || ($formula[$index] == "\r")) {
3458
  ++$index;
3459
  }
3460
+ if ($formula[$index] == ' ') {
3461
+ while ($formula[$index] == ' ') {
3462
  ++$index;
3463
  }
3464
  // If we're expecting an operator, but only have a space between the previous and next operands (and both are
3888
  // echo 'Token is a PHPExcel constant: '.$excelConstant.'<br />';
3889
  $stack->push('Constant Value', self::$excelConstants[$excelConstant]);
3890
  $this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->showTypeDetails(self::$excelConstants[$excelConstant]));
3891
+ } elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token[0] == '"') || ($token[0] == '#')) {
3892
  // echo 'Token is a number, boolean, string, null or an Excel error<br />';
3893
  $stack->push('Value', $token);
3894
  // if the token is a named range, push the named range name onto the stack
3933
  if (is_string($operand)) {
3934
  // We only need special validations for the operand if it is a string
3935
  // Start by stripping off the quotation marks we use to identify true excel string values internally
3936
+ if ($operand > '' && $operand[0] == '"') {
3937
  $operand = self::unwrapResult($operand);
3938
  }
3939
  // If the string is a numeric value, we treat it as a numeric, so no further testing
3940
  if (!is_numeric($operand)) {
3941
  // If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations
3942
+ if ($operand > '' && $operand[0] == '#') {
3943
  $stack->push('Value', $operand);
3944
  $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand));
3945
  return false;
3995
  }
3996
 
3997
  // Simple validate the two operands if they are string values
3998
+ if (is_string($operand1) && $operand1 > '' && $operand1[0] == '"') {
3999
  $operand1 = self::unwrapResult($operand1);
4000
  }
4001
+ if (is_string($operand2) && $operand2 > '' && $operand2[0] == '"') {
4002
  $operand2 = self::unwrapResult($operand2);
4003
  }
4004
 
classes/PHPExcel/Calculation/Engineering.php CHANGED
@@ -768,7 +768,7 @@ class PHPExcel_Calculation_Engineering
768
  // Split the input into its Real and Imaginary components
769
  $leadingSign = 0;
770
  if (strlen($workString) > 0) {
771
- $leadingSign = (($workString{0} == '+') || ($workString{0} == '-')) ? 1 : 0;
772
  }
773
  $power = '';
774
  $realNumber = strtok($workString, '+-');
@@ -809,16 +809,16 @@ class PHPExcel_Calculation_Engineering
809
  */
810
  private static function cleanComplex($complexNumber)
811
  {
812
- if ($complexNumber{0} == '+') {
813
  $complexNumber = substr($complexNumber, 1);
814
  }
815
- if ($complexNumber{0} == '0') {
816
  $complexNumber = substr($complexNumber, 1);
817
  }
818
- if ($complexNumber{0} == '.') {
819
  $complexNumber = '0'.$complexNumber;
820
  }
821
- if ($complexNumber{0} == '+') {
822
  $complexNumber = substr($complexNumber, 1);
823
  }
824
  return $complexNumber;
768
  // Split the input into its Real and Imaginary components
769
  $leadingSign = 0;
770
  if (strlen($workString) > 0) {
771
+ $leadingSign = (($workString[0] == '+') || ($workString[0] == '-')) ? 1 : 0;
772
  }
773
  $power = '';
774
  $realNumber = strtok($workString, '+-');
809
  */
810
  private static function cleanComplex($complexNumber)
811
  {
812
+ if ($complexNumber[0] == '+') {
813
  $complexNumber = substr($complexNumber, 1);
814
  }
815
+ if ($complexNumber[0] == '0') {
816
  $complexNumber = substr($complexNumber, 1);
817
  }
818
+ if ($complexNumber[0] == '.') {
819
  $complexNumber = '0'.$complexNumber;
820
  }
821
+ if ($complexNumber[0] == '+') {
822
  $complexNumber = substr($complexNumber, 1);
823
  }
824
  return $complexNumber;
classes/PHPExcel/Calculation/FormulaParser.php CHANGED
@@ -159,7 +159,7 @@ class PHPExcel_Calculation_FormulaParser
159
 
160
  // Check if the formula has a valid starting =
161
  $formulaLength = strlen($this->formula);
162
- if ($formulaLength < 2 || $this->formula{0} != '=') {
163
  return;
164
  }
165
 
@@ -181,8 +181,8 @@ class PHPExcel_Calculation_FormulaParser
181
  // embeds are doubled
182
  // end marks token
183
  if ($inString) {
184
- if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
185
- if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE)) {
186
  $value .= PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE;
187
  ++$index;
188
  } else {
@@ -191,7 +191,7 @@ class PHPExcel_Calculation_FormulaParser
191
  $value = "";
192
  }
193
  } else {
194
- $value .= $this->formula{$index};
195
  }
196
  ++$index;
197
  continue;
@@ -201,15 +201,15 @@ class PHPExcel_Calculation_FormulaParser
201
  // embeds are double
202
  // end does not mark a token
203
  if ($inPath) {
204
- if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
205
- if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE)) {
206
  $value .= PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE;
207
  ++$index;
208
  } else {
209
  $inPath = false;
210
  }
211
  } else {
212
- $value .= $this->formula{$index};
213
  }
214
  ++$index;
215
  continue;
@@ -219,10 +219,10 @@ class PHPExcel_Calculation_FormulaParser
219
  // no embeds (changed to "()" by Excel)
220
  // end does not mark a token
221
  if ($inRange) {
222
- if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_CLOSE) {
223
  $inRange = false;
224
  }
225
- $value .= $this->formula{$index};
226
  ++$index;
227
  continue;
228
  }
@@ -230,7 +230,7 @@ class PHPExcel_Calculation_FormulaParser
230
  // error values
231
  // end marks a token, determined from absolute list of values
232
  if ($inError) {
233
- $value .= $this->formula{$index};
234
  ++$index;
235
  if (in_array($value, $ERRORS)) {
236
  $inError = false;
@@ -241,10 +241,10 @@ class PHPExcel_Calculation_FormulaParser
241
  }
242
 
243
  // scientific notation check
244
- if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_SN, $this->formula{$index}) !== false) {
245
  if (strlen($value) > 1) {
246
- if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula{$index}) != 0) {
247
- $value .= $this->formula{$index};
248
  ++$index;
249
  continue;
250
  }
@@ -254,7 +254,7 @@ class PHPExcel_Calculation_FormulaParser
254
  // independent character evaluation (order not important)
255
 
256
  // establish state-dependent character evaluations
257
- if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
258
  if (strlen($value > 0)) {
259
  // unexpected
260
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
@@ -265,7 +265,7 @@ class PHPExcel_Calculation_FormulaParser
265
  continue;
266
  }
267
 
268
- if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
269
  if (strlen($value) > 0) {
270
  // unexpected
271
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
@@ -276,14 +276,14 @@ class PHPExcel_Calculation_FormulaParser
276
  continue;
277
  }
278
 
279
- if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_OPEN) {
280
  $inRange = true;
281
  $value .= PHPExcel_Calculation_FormulaParser::BRACKET_OPEN;
282
  ++$index;
283
  continue;
284
  }
285
 
286
- if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::ERROR_START) {
287
  if (strlen($value) > 0) {
288
  // unexpected
289
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
@@ -296,7 +296,7 @@ class PHPExcel_Calculation_FormulaParser
296
  }
297
 
298
  // mark start and end of arrays and array rows
299
- if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_OPEN) {
300
  if (strlen($value) > 0) {
301
  // unexpected
302
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
@@ -315,7 +315,7 @@ class PHPExcel_Calculation_FormulaParser
315
  continue;
316
  }
317
 
318
- if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::SEMICOLON) {
319
  if (strlen($value) > 0) {
320
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
321
  $value = "";
@@ -337,7 +337,7 @@ class PHPExcel_Calculation_FormulaParser
337
  continue;
338
  }
339
 
340
- if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_CLOSE) {
341
  if (strlen($value) > 0) {
342
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
343
  $value = "";
@@ -358,14 +358,14 @@ class PHPExcel_Calculation_FormulaParser
358
  }
359
 
360
  // trim white-space
361
- if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) {
362
  if (strlen($value) > 0) {
363
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
364
  $value = "";
365
  }
366
  $tokens1[] = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE);
367
  ++$index;
368
- while (($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) {
369
  ++$index;
370
  }
371
  continue;
@@ -385,29 +385,29 @@ class PHPExcel_Calculation_FormulaParser
385
  }
386
 
387
  // standard infix operators
388
- if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_INFIX, $this->formula{$index}) !== false) {
389
  if (strlen($value) > 0) {
390
  $tokens1[] =new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
391
  $value = "";
392
  }
393
- $tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX);
394
  ++$index;
395
  continue;
396
  }
397
 
398
  // standard postfix operators (only one)
399
- if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_POSTFIX, $this->formula{$index}) !== false) {
400
  if (strlen($value) > 0) {
401
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
402
  $value = "";
403
  }
404
- $tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX);
405
  ++$index;
406
  continue;
407
  }
408
 
409
  // start subexpression or function
410
- if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_OPEN) {
411
  if (strlen($value) > 0) {
412
  $tmp = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
413
  $tokens1[] = $tmp;
@@ -423,7 +423,7 @@ class PHPExcel_Calculation_FormulaParser
423
  }
424
 
425
  // function, subexpression, or array parameters, or operand unions
426
- if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::COMMA) {
427
  if (strlen($value) > 0) {
428
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
429
  $value = "";
@@ -444,7 +444,7 @@ class PHPExcel_Calculation_FormulaParser
444
  }
445
 
446
  // stop subexpression
447
- if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_CLOSE) {
448
  if (strlen($value) > 0) {
449
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
450
  $value = "";
@@ -460,7 +460,7 @@ class PHPExcel_Calculation_FormulaParser
460
  }
461
 
462
  // token accumulation
463
- $value .= $this->formula{$index};
464
  ++$index;
465
  }
466
 
159
 
160
  // Check if the formula has a valid starting =
161
  $formulaLength = strlen($this->formula);
162
+ if ($formulaLength < 2 || $this->formula[0] != '=') {
163
  return;
164
  }
165
 
181
  // embeds are doubled
182
  // end marks token
183
  if ($inString) {
184
+ if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
185
+ if ((($index + 2) <= $formulaLength) && ($this->formula[$index + 1] == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE)) {
186
  $value .= PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE;
187
  ++$index;
188
  } else {
191
  $value = "";
192
  }
193
  } else {
194
+ $value .= $this->formula[$index];
195
  }
196
  ++$index;
197
  continue;
201
  // embeds are double
202
  // end does not mark a token
203
  if ($inPath) {
204
+ if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
205
+ if ((($index + 2) <= $formulaLength) && ($this->formula[$index + 1] == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE)) {
206
  $value .= PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE;
207
  ++$index;
208
  } else {
209
  $inPath = false;
210
  }
211
  } else {
212
+ $value .= $this->formula[$index];
213
  }
214
  ++$index;
215
  continue;
219
  // no embeds (changed to "()" by Excel)
220
  // end does not mark a token
221
  if ($inRange) {
222
+ if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::BRACKET_CLOSE) {
223
  $inRange = false;
224
  }
225
+ $value .= $this->formula[$index];
226
  ++$index;
227
  continue;
228
  }
230
  // error values
231
  // end marks a token, determined from absolute list of values
232
  if ($inError) {
233
+ $value .= $this->formula[$index];
234
  ++$index;
235
  if (in_array($value, $ERRORS)) {
236
  $inError = false;
241
  }
242
 
243
  // scientific notation check
244
+ if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_SN, $this->formula[$index]) !== false) {
245
  if (strlen($value) > 1) {
246
+ if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula[$index]) != 0) {
247
+ $value .= $this->formula[$index];
248
  ++$index;
249
  continue;
250
  }
254
  // independent character evaluation (order not important)
255
 
256
  // establish state-dependent character evaluations
257
+ if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
258
  if (strlen($value > 0)) {
259
  // unexpected
260
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
265
  continue;
266
  }
267
 
268
+ if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
269
  if (strlen($value) > 0) {
270
  // unexpected
271
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
276
  continue;
277
  }
278
 
279
+ if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::BRACKET_OPEN) {
280
  $inRange = true;
281
  $value .= PHPExcel_Calculation_FormulaParser::BRACKET_OPEN;
282
  ++$index;
283
  continue;
284
  }
285
 
286
+ if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::ERROR_START) {
287
  if (strlen($value) > 0) {
288
  // unexpected
289
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
296
  }
297
 
298
  // mark start and end of arrays and array rows
299
+ if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::BRACE_OPEN) {
300
  if (strlen($value) > 0) {
301
  // unexpected
302
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
315
  continue;
316
  }
317
 
318
+ if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::SEMICOLON) {
319
  if (strlen($value) > 0) {
320
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
321
  $value = "";
337
  continue;
338
  }
339
 
340
+ if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::BRACE_CLOSE) {
341
  if (strlen($value) > 0) {
342
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
343
  $value = "";
358
  }
359
 
360
  // trim white-space
361
+ if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::WHITESPACE) {
362
  if (strlen($value) > 0) {
363
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
364
  $value = "";
365
  }
366
  $tokens1[] = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE);
367
  ++$index;
368
+ while (($this->formula[$index] == PHPExcel_Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) {
369
  ++$index;
370
  }
371
  continue;
385
  }
386
 
387
  // standard infix operators
388
+ if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_INFIX, $this->formula[$index]) !== false) {
389
  if (strlen($value) > 0) {
390
  $tokens1[] =new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
391
  $value = "";
392
  }
393
+ $tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula[$index], PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX);
394
  ++$index;
395
  continue;
396
  }
397
 
398
  // standard postfix operators (only one)
399
+ if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_POSTFIX, $this->formula[$index]) !== false) {
400
  if (strlen($value) > 0) {
401
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
402
  $value = "";
403
  }
404
+ $tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula[$index], PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX);
405
  ++$index;
406
  continue;
407
  }
408
 
409
  // start subexpression or function
410
+ if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::PAREN_OPEN) {
411
  if (strlen($value) > 0) {
412
  $tmp = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
413
  $tokens1[] = $tmp;
423
  }
424
 
425
  // function, subexpression, or array parameters, or operand unions
426
+ if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::COMMA) {
427
  if (strlen($value) > 0) {
428
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
429
  $value = "";
444
  }
445
 
446
  // stop subexpression
447
+ if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::PAREN_CLOSE) {
448
  if (strlen($value) > 0) {
449
  $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
450
  $value = "";
460
  }
461
 
462
  // token accumulation
463
+ $value .= $this->formula[$index];
464
  ++$index;
465
  }
466
 
classes/PHPExcel/Calculation/Functions.php CHANGED
@@ -318,10 +318,10 @@ class PHPExcel_Calculation_Functions
318
  public static function ifCondition($condition)
319
  {
320
  $condition = PHPExcel_Calculation_Functions::flattenSingleValue($condition);
321
- if (!isset($condition{0})) {
322
  $condition = '=""';
323
  }
324
- if (!in_array($condition{0}, array('>', '<', '='))) {
325
  if (!is_numeric($condition)) {
326
  $condition = PHPExcel_Calculation::wrapResult(strtoupper($condition));
327
  }
@@ -559,7 +559,7 @@ class PHPExcel_Calculation_Functions
559
  return (integer) $value;
560
  case 'string':
561
  // Errors
562
- if ((strlen($value) > 0) && ($value{0} == '#')) {
563
  return $value;
564
  }
565
  break;
@@ -609,7 +609,7 @@ class PHPExcel_Calculation_Functions
609
  return 64;
610
  } elseif (is_string($value)) {
611
  // Errors
612
- if ((strlen($value) > 0) && ($value{0} == '#')) {
613
  return 16;
614
  }
615
  return 2;
318
  public static function ifCondition($condition)
319
  {
320
  $condition = PHPExcel_Calculation_Functions::flattenSingleValue($condition);
321
+ if (!isset($condition[0])) {
322
  $condition = '=""';
323
  }
324
+ if (!in_array($condition[0], array('>', '<', '='))) {
325
  if (!is_numeric($condition)) {
326
  $condition = PHPExcel_Calculation::wrapResult(strtoupper($condition));
327
  }
559
  return (integer) $value;
560
  case 'string':
561
  // Errors
562
+ if ((strlen($value) > 0) && ($value[0] == '#')) {
563
  return $value;
564
  }
565
  break;
609
  return 64;
610
  } elseif (is_string($value)) {
611
  // Errors
612
+ if ((strlen($value) > 0) && ($value[0] == '#')) {
613
  return 16;
614
  }
615
  return 2;
classes/PHPExcel/Calculation/TextData.php CHANGED
@@ -40,19 +40,19 @@ class PHPExcel_Calculation_TextData
40
 
41
  private static function unicodeToOrd($c)
42
  {
43
- if (ord($c{0}) >=0 && ord($c{0}) <= 127) {
44
- return ord($c{0});
45
- } elseif (ord($c{0}) >= 192 && ord($c{0}) <= 223) {
46
- return (ord($c{0})-192)*64 + (ord($c{1})-128);
47
- } elseif (ord($c{0}) >= 224 && ord($c{0}) <= 239) {
48
- return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128);
49
- } elseif (ord($c{0}) >= 240 && ord($c{0}) <= 247) {
50
- return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128);
51
- } elseif (ord($c{0}) >= 248 && ord($c{0}) <= 251) {
52
- return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128);
53
- } elseif (ord($c{0}) >= 252 && ord($c{0}) <= 253) {
54
- return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128);
55
- } elseif (ord($c{0}) >= 254 && ord($c{0}) <= 255) {
56
  // error
57
  return PHPExcel_Calculation_Functions::VALUE();
58
  }
@@ -509,7 +509,7 @@ class PHPExcel_Calculation_TextData
509
  * @param string $newText String to replace in defined position
510
  * @return string
511
  */
512
- public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText)
513
  {
514
  $oldText = PHPExcel_Calculation_Functions::flattenSingleValue($oldText);
515
  $start = PHPExcel_Calculation_Functions::flattenSingleValue($start);
40
 
41
  private static function unicodeToOrd($c)
42
  {
43
+ if (ord($c[0]) >=0 && ord($c[0]) <= 127) {
44
+ return ord($c[0]);
45
+ } elseif (ord($c[0]) >= 192 && ord($c[0]) <= 223) {
46
+ return (ord($c[0])-192)*64 + (ord($c[1])-128);
47
+ } elseif (ord($c[0]) >= 224 && ord($c[0]) <= 239) {
48
+ return (ord($c[0])-224)*4096 + (ord($c[1])-128)*64 + (ord($c[2])-128);
49
+ } elseif (ord($c[0]) >= 240 && ord($c[0]) <= 247) {
50
+ return (ord($c[0])-240)*262144 + (ord($c[1])-128)*4096 + (ord($c[2])-128)*64 + (ord($c[3])-128);
51
+ } elseif (ord($c[0]) >= 248 && ord($c[0]) <= 251) {
52
+ return (ord($c[0])-248)*16777216 + (ord($c[1])-128)*262144 + (ord($c[2])-128)*4096 + (ord($c[3])-128)*64 + (ord($c[4])-128);
53
+ } elseif (ord($c[0]) >= 252 && ord($c[0]) <= 253) {
54
+ return (ord($c[0])-252)*1073741824 + (ord($c[1])-128)*16777216 + (ord($c[2])-128)*262144 + (ord($c[3])-128)*4096 + (ord($c[4])-128)*64 + (ord($c[5])-128);
55
+ } elseif (ord($c[0]) >= 254 && ord($c[0]) <= 255) {
56
  // error
57
  return PHPExcel_Calculation_Functions::VALUE();
58
  }
509
  * @param string $newText String to replace in defined position
510
  * @return string
511
  */
512
+ public static function REPLACE($oldText, $start, $chars, $newText)
513
  {
514
  $oldText = PHPExcel_Calculation_Functions::flattenSingleValue($oldText);
515
  $start = PHPExcel_Calculation_Functions::flattenSingleValue($start);
classes/PHPExcel/Cell.php CHANGED
@@ -809,24 +809,24 @@ class PHPExcel_Cell
809
 
810
  // We also use the language construct isset() rather than the more costly strlen() function to match the length of $pString
811
  // for improved performance
812
- if (isset($pString{0})) {
813
- if (!isset($pString{1})) {
814
  $_indexCache[$pString] = $_columnLookup[$pString];
815
  return $_indexCache[$pString];
816
- } elseif (!isset($pString{2})) {
817
- if (!isset($_columnLookup[$pString{0}]) || !isset($_columnLookup[$pString{1}])){
818
  $_indexCache[$pString] = false;
819
  }
820
  else{
821
- $_indexCache[$pString] = $_columnLookup[$pString{0}] * 26 + $_columnLookup[$pString{1}];
822
  }
823
  return $_indexCache[$pString];
824
- } elseif (!isset($pString{3})) {
825
- $_indexCache[$pString] = $_columnLookup[$pString{0}] * 676 + $_columnLookup[$pString{1}] * 26 + $_columnLookup[$pString{2}];
826
  return $_indexCache[$pString];
827
  }
828
  }
829
- throw new PHPExcel_Exception("Column string index can not be " . ((isset($pString{0})) ? "longer than 3 characters" : "empty"));
830
  }
831
 
832
  /**
809
 
810
  // We also use the language construct isset() rather than the more costly strlen() function to match the length of $pString
811
  // for improved performance
812
+ if (isset($pString[0])) {
813
+ if (!isset($pString[1])) {
814
  $_indexCache[$pString] = $_columnLookup[$pString];
815
  return $_indexCache[$pString];
816
+ } elseif (!isset($pString[2])) {
817
+ if (!isset($_columnLookup[$pString[0]]) || !isset($_columnLookup[$pString[1]])){
818
  $_indexCache[$pString] = false;
819
  }
820
  else{
821
+ $_indexCache[$pString] = $_columnLookup[$pString[0]] * 26 + $_columnLookup[$pString[1]];
822
  }
823
  return $_indexCache[$pString];
824
+ } elseif (!isset($pString[3])) {
825
+ $_indexCache[$pString] = $_columnLookup[$pString[0]] * 676 + $_columnLookup[$pString[1]] * 26 + $_columnLookup[$pString[2]];
826
  return $_indexCache[$pString];
827
  }
828
  }
829
+ throw new PHPExcel_Exception("Column string index can not be " . ((isset($pString[0])) ? "longer than 3 characters" : "empty"));
830
  }
831
 
832
  /**
classes/PHPExcel/Cell/DefaultValueBinder.php CHANGED
@@ -79,7 +79,7 @@ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
79
  return PHPExcel_Cell_DataType::TYPE_STRING;
80
  } elseif ($pValue instanceof PHPExcel_RichText) {
81
  return PHPExcel_Cell_DataType::TYPE_INLINE;
82
- } elseif ($pValue{0} === '=' && strlen($pValue) > 1) {
83
  return PHPExcel_Cell_DataType::TYPE_FORMULA;
84
  } elseif (is_bool($pValue)) {
85
  return PHPExcel_Cell_DataType::TYPE_BOOL;
@@ -87,7 +87,7 @@ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
87
  return PHPExcel_Cell_DataType::TYPE_NUMERIC;
88
  } elseif (preg_match('/^[\+\-]?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) {
89
  $tValue = ltrim($pValue, '+-');
90
- if (is_string($pValue) && $tValue{0} === '0' && strlen($tValue) > 1 && $tValue{1} !== '.') {
91
  return PHPExcel_Cell_DataType::TYPE_STRING;
92
  } elseif ((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) {
93
  return PHPExcel_Cell_DataType::TYPE_STRING;
79
  return PHPExcel_Cell_DataType::TYPE_STRING;
80
  } elseif ($pValue instanceof PHPExcel_RichText) {
81
  return PHPExcel_Cell_DataType::TYPE_INLINE;
82
+ } elseif (isset($pValue[0]) && $pValue[0] === '=' && strlen($pValue) > 1) {
83
  return PHPExcel_Cell_DataType::TYPE_FORMULA;
84
  } elseif (is_bool($pValue)) {
85
  return PHPExcel_Cell_DataType::TYPE_BOOL;
87
  return PHPExcel_Cell_DataType::TYPE_NUMERIC;
88
  } elseif (preg_match('/^[\+\-]?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) {
89
  $tValue = ltrim($pValue, '+-');
90
+ if (is_string($pValue) && $tValue[0] === '0' && strlen($tValue) > 1 && $tValue[1] !== '.') {
91
  return PHPExcel_Cell_DataType::TYPE_STRING;
92
  } elseif ((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) {
93
  return PHPExcel_Cell_DataType::TYPE_STRING;
classes/PHPExcel/NamedRange.php CHANGED
@@ -72,7 +72,7 @@ class PHPExcel_NamedRange
72
  * @param PHPExcel_Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope.
73
  * @throws PHPExcel_Exception
74
  */
75
- public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
76
  {
77
  // Validate data
78
  if (($pName === null) || ($pWorksheet === null) || ($pRange === null)) {
@@ -227,7 +227,7 @@ class PHPExcel_NamedRange
227
  * @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
228
  * @return PHPExcel_NamedRange
229
  */
230
- public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet)
231
  {
232
  return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet);
233
  }
72
  * @param PHPExcel_Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope.
73
  * @throws PHPExcel_Exception
74
  */
75
+ public function __construct($pName, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
76
  {
77
  // Validate data
78
  if (($pName === null) || ($pWorksheet === null) || ($pRange === null)) {
227
  * @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
228
  * @return PHPExcel_NamedRange
229
  */
230
+ public static function resolveRange($pNamedRange, PHPExcel_Worksheet $pSheet)
231
  {
232
  return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet);
233
  }
classes/PHPExcel/Reader/Excel2003XML.php CHANGED
@@ -689,7 +689,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
689
  $rowReference = $rowID;
690
  }
691
  // Bracketed R references are relative to the current row
692
- if ($rowReference{0} == '[') {
693
  $rowReference = $rowID + trim($rowReference, '[]');
694
  }
695
  $columnReference = $cellReference[4][0];
@@ -698,7 +698,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
698
  $columnReference = $columnNumber;
699
  }
700
  // Bracketed C references are relative to the current column
701
- if ($columnReference{0} == '[') {
702
  $columnReference = $columnNumber + trim($columnReference, '[]');
703
  }
704
  $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
689
  $rowReference = $rowID;
690
  }
691
  // Bracketed R references are relative to the current row
692
+ if ($rowReference[0] == '[') {
693
  $rowReference = $rowID + trim($rowReference, '[]');
694
  }
695
  $columnReference = $cellReference[4][0];
698
  $columnReference = $columnNumber;
699
  }
700
  // Bracketed C references are relative to the current column
701
+ if ($columnReference[0] == '[') {
702
  $columnReference = $columnNumber + trim($columnReference, '[]');
703
  }
704
  $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
classes/PHPExcel/Reader/Excel5.php CHANGED
@@ -1623,7 +1623,8 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
1623
  // max 2048 bytes will probably throw a wobbly.
1624
  $row = self::getInt2d($recordData, 0);
1625
  $extension = true;
1626
- $cellAddress = array_pop(array_keys($this->phpSheet->getComments()));
 
1627
  }
1628
  // echo 'Note Address=', $cellAddress,'<br />';
1629
 
@@ -1925,7 +1926,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
1925
 
1926
  // offset: 0; size: 2; 0 = base 1900, 1 = base 1904
1927
  PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
1928
- if (ord($recordData{0}) == 1) {
1929
  PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
1930
  }
1931
  }
@@ -1988,7 +1989,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
1988
  }
1989
 
1990
  // offset: 10; size: 1; underline type
1991
- $underlineType = ord($recordData{10});
1992
  switch ($underlineType) {
1993
  case 0x00:
1994
  break; // no underline
@@ -2125,7 +2126,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2125
 
2126
  // offset: 6; size: 1; Alignment and text break
2127
  // bit 2-0, mask 0x07; horizontal alignment
2128
- $horAlign = (0x07 & ord($recordData{6})) >> 0;
2129
  switch ($horAlign) {
2130
  case 0:
2131
  $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_GENERAL);
@@ -2150,7 +2151,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2150
  break;
2151
  }
2152
  // bit 3, mask 0x08; wrap text
2153
- $wrapText = (0x08 & ord($recordData{6})) >> 3;
2154
  switch ($wrapText) {
2155
  case 0:
2156
  $objStyle->getAlignment()->setWrapText(false);
@@ -2160,7 +2161,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2160
  break;
2161
  }
2162
  // bit 6-4, mask 0x70; vertical alignment
2163
- $vertAlign = (0x70 & ord($recordData{6})) >> 4;
2164
  switch ($vertAlign) {
2165
  case 0:
2166
  $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
@@ -2178,7 +2179,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2178
 
2179
  if ($this->version == self::XLS_BIFF8) {
2180
  // offset: 7; size: 1; XF_ROTATION: Text rotation angle
2181
- $angle = ord($recordData{7});
2182
  $rotation = 0;
2183
  if ($angle <= 90) {
2184
  $rotation = $angle;
@@ -2191,11 +2192,11 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2191
 
2192
  // offset: 8; size: 1; Indentation, shrink to cell size, and text direction
2193
  // bit: 3-0; mask: 0x0F; indent level
2194
- $indent = (0x0F & ord($recordData{8})) >> 0;
2195
  $objStyle->getAlignment()->setIndent($indent);
2196
 
2197
  // bit: 4; mask: 0x10; 1 = shrink content to fit into cell
2198
- $shrinkToFit = (0x10 & ord($recordData{8})) >> 4;
2199
  switch ($shrinkToFit) {
2200
  case 0:
2201
  $objStyle->getAlignment()->setShrinkToFit(false);
@@ -2275,7 +2276,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2275
  // BIFF5
2276
 
2277
  // offset: 7; size: 1; Text orientation and flags
2278
- $orientationAndFlags = ord($recordData{7});
2279
 
2280
  // bit: 1-0; mask: 0x03; XF_ORIENTATION: Text orientation
2281
  $xfOrientation = (0x03 & $orientationAndFlags) >> 0;
@@ -2399,7 +2400,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2399
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2400
 
2401
  if ($xclfType == 2) {
2402
- $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
2403
 
2404
  // modify the relevant style property
2405
  if (isset($this->mapCellXfIndex[$ixfe])) {
@@ -2414,7 +2415,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2414
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2415
 
2416
  if ($xclfType == 2) {
2417
- $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
2418
 
2419
  // modify the relevant style property
2420
  if (isset($this->mapCellXfIndex[$ixfe])) {
@@ -2429,7 +2430,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2429
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2430
 
2431
  if ($xclfType == 2) {
2432
- $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
2433
 
2434
  // modify the relevant style property
2435
  if (isset($this->mapCellXfIndex[$ixfe])) {
@@ -2444,7 +2445,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2444
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2445
 
2446
  if ($xclfType == 2) {
2447
- $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
2448
 
2449
  // modify the relevant style property
2450
  if (isset($this->mapCellXfIndex[$ixfe])) {
@@ -2459,7 +2460,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2459
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2460
 
2461
  if ($xclfType == 2) {
2462
- $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
2463
 
2464
  // modify the relevant style property
2465
  if (isset($this->mapCellXfIndex[$ixfe])) {
@@ -2474,7 +2475,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2474
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2475
 
2476
  if ($xclfType == 2) {
2477
- $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
2478
 
2479
  // modify the relevant style property
2480
  if (isset($this->mapCellXfIndex[$ixfe])) {
@@ -2489,7 +2490,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2489
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2490
 
2491
  if ($xclfType == 2) {
2492
- $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
2493
 
2494
  // modify the relevant style property
2495
  if (isset($this->mapCellXfIndex[$ixfe])) {
@@ -2504,7 +2505,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2504
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2505
 
2506
  if ($xclfType == 2) {
2507
- $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2}));
2508
 
2509
  // modify the relevant style property
2510
  if (isset($this->mapCellXfIndex[$ixfe])) {
@@ -2546,7 +2547,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2546
 
2547
  if ($isBuiltIn) {
2548
  // offset: 2; size: 1; identifier for built-in style
2549
- $builtInId = ord($recordData{2});
2550
 
2551
  switch ($builtInId) {
2552
  case 0x00:
@@ -2611,7 +2612,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2611
  $this->pos += 4 + $length;
2612
 
2613
  // offset: 4; size: 1; sheet state
2614
- switch (ord($recordData{4})) {
2615
  case 0x00:
2616
  $sheetState = PHPExcel_Worksheet::SHEETSTATE_VISIBLE;
2617
  break;
@@ -2627,7 +2628,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2627
  }
2628
 
2629
  // offset: 5; size: 1; sheet type
2630
- $sheetType = ord($recordData{5});
2631
 
2632
  // offset: 6; size: var; sheet name
2633
  if ($this->version == self::XLS_BIFF8) {
@@ -2805,7 +2806,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2805
  // offset: 2; size: 1; keyboard shortcut
2806
 
2807
  // offset: 3; size: 1; length of the name (character count)
2808
- $nlen = ord($recordData{3});
2809
 
2810
  // offset: 4; size: 2; size of the formula data (it can happen that this is zero)
2811
  // note: there can also be additional data, this is not included in $flen
@@ -2888,7 +2889,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2888
  $pos += 2;
2889
 
2890
  // option flags
2891
- $optionFlags = ord($recordData{$pos});
2892
  ++$pos;
2893
 
2894
  // bit: 0; mask: 0x01; 0 = compressed; 1 = uncompressed
@@ -2955,7 +2956,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2955
 
2956
  // repeated option flags
2957
  // OpenOffice.org documentation 5.21
2958
- $option = ord($recordData{$pos});
2959
  ++$pos;
2960
 
2961
  if ($isCompressed && ($option == 0)) {
@@ -2977,7 +2978,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
2977
  // this fragment compressed
2978
  $len = min($charsLeft, $limitpos - $pos);
2979
  for ($j = 0; $j < $len; ++$j) {
2980
- $retstr .= $recordData{$pos + $j} . chr(0);
2981
  }
2982
  $charsLeft -= $len;
2983
  $isCompressed = false;
@@ -3883,7 +3884,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
3883
  // We can apparently not rely on $isPartOfSharedFormula. Even when $isPartOfSharedFormula = true
3884
  // the formula data may be ordinary formula data, therefore we need to check
3885
  // explicitly for the tExp token (0x01)
3886
- $isPartOfSharedFormula = $isPartOfSharedFormula && ord($formulaStructure{2}) == 0x01;
3887
 
3888
  if ($isPartOfSharedFormula) {
3889
  // part of shared formula which means there will be a formula with a tExp token and nothing else
@@ -3906,7 +3907,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
3906
  $xfIndex = self::getInt2d($recordData, 4);
3907
 
3908
  // offset: 6; size: 8; result of the formula
3909
- if ((ord($recordData{6}) == 0) && (ord($recordData{12}) == 255) && (ord($recordData{13}) == 255)) {
3910
  // String formula. Result follows in appended STRING record
3911
  $dataType = PHPExcel_Cell_DataType::TYPE_STRING;
3912
 
@@ -3918,21 +3919,21 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
3918
 
3919
  // read STRING record
3920
  $value = $this->readString();
3921
- } elseif ((ord($recordData{6}) == 1)
3922
- && (ord($recordData{12}) == 255)
3923
- && (ord($recordData{13}) == 255)) {
3924
  // Boolean formula. Result is in +2; 0=false, 1=true
3925
  $dataType = PHPExcel_Cell_DataType::TYPE_BOOL;
3926
- $value = (bool) ord($recordData{8});
3927
- } elseif ((ord($recordData{6}) == 2)
3928
- && (ord($recordData{12}) == 255)
3929
- && (ord($recordData{13}) == 255)) {
3930
  // Error formula. Error code is in +2
3931
  $dataType = PHPExcel_Cell_DataType::TYPE_ERROR;
3932
- $value = PHPExcel_Reader_Excel5_ErrorCode::lookup(ord($recordData{8}));
3933
- } elseif ((ord($recordData{6}) == 3)
3934
- && (ord($recordData{12}) == 255)
3935
- && (ord($recordData{13}) == 255)) {
3936
  // Formula result is a null string
3937
  $dataType = PHPExcel_Cell_DataType::TYPE_NULL;
3938
  $value = '';
@@ -3996,7 +3997,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
3996
  // offset: 6, size: 1; not used
3997
 
3998
  // offset: 7, size: 1; number of existing FORMULA records for this shared formula
3999
- $no = ord($recordData{7});
4000
 
4001
  // offset: 8, size: var; Binary token array of the shared formula
4002
  $formula = substr($recordData, 8);
@@ -4062,10 +4063,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
4062
  $xfIndex = self::getInt2d($recordData, 4);
4063
 
4064
  // offset: 6; size: 1; the boolean value or error value
4065
- $boolErr = ord($recordData{6});
4066
 
4067
  // offset: 7; size: 1; 0=boolean; 1=error
4068
- $isError = ord($recordData{7});
4069
 
4070
  $cell = $this->phpSheet->getCell($columnString . ($row + 1));
4071
  switch ($isError) {
@@ -4447,7 +4448,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
4447
 
4448
  if (!$this->readDataOnly) {
4449
  // offset: 0; size: 1; pane identifier
4450
- $paneId = ord($recordData{0});
4451
 
4452
  // offset: 1; size: 2; index to row of the active cell
4453
  $r = self::getInt2d($recordData, 1);
@@ -4598,9 +4599,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
4598
  $hyperlinkType = 'UNC';
4599
  } elseif (!$isFileLinkOrUrl) {
4600
  $hyperlinkType = 'workbook';
4601
- } elseif (ord($recordData{$offset}) == 0x03) {
4602
  $hyperlinkType = 'local';
4603
- } elseif (ord($recordData{$offset}) == 0xE0) {
4604
  $hyperlinkType = 'URL';
4605
  }
4606
 
@@ -5175,6 +5176,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
5175
  }
5176
  //imagepng($ih, 'image.png');
5177
 
 
 
 
5178
  $drawing = new PHPExcel_Worksheet_Drawing();
5179
  $drawing->setPath($filename);
5180
  $drawing->setWorksheet($this->phpSheet);
@@ -6886,10 +6890,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
6886
  $lr = self::getInt2d($subData, 2) + 1;
6887
 
6888
  // offset: 4; size: 1; index to first column
6889
- $fc = ord($subData{4});
6890
 
6891
  // offset: 5; size: 1; index to last column
6892
- $lc = ord($subData{5});
6893
 
6894
  // check values
6895
  if ($fr > $lr || $fc > $lc) {
@@ -7294,13 +7298,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
7294
  private static function readRGB($rgb)
7295
  {
7296
  // offset: 0; size 1; Red component
7297
- $r = ord($rgb{0});
7298
 
7299
  // offset: 1; size: 1; Green component
7300
- $g = ord($rgb{1});
7301
 
7302
  // offset: 2; size: 1; Blue component
7303
- $b = ord($rgb{2});
7304
 
7305
  // HEX notation, e.g. 'FF00FC'
7306
  $rgb = sprintf('%02X%02X%02X', $r, $g, $b);
1623
  // max 2048 bytes will probably throw a wobbly.
1624
  $row = self::getInt2d($recordData, 0);
1625
  $extension = true;
1626
+ $comments = array_keys($this->phpSheet->getComments());
1627
+ $cellAddress = array_pop($comments);
1628
  }
1629
  // echo 'Note Address=', $cellAddress,'<br />';
1630
 
1926
 
1927
  // offset: 0; size: 2; 0 = base 1900, 1 = base 1904
1928
  PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
1929
+ if (ord($recordData[0]) == 1) {
1930
  PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
1931
  }
1932
  }
1989
  }
1990
 
1991
  // offset: 10; size: 1; underline type
1992
+ $underlineType = ord($recordData[10]);
1993
  switch ($underlineType) {
1994
  case 0x00:
1995
  break; // no underline
2126
 
2127
  // offset: 6; size: 1; Alignment and text break
2128
  // bit 2-0, mask 0x07; horizontal alignment
2129
+ $horAlign = (0x07 & ord($recordData[6])) >> 0;
2130
  switch ($horAlign) {
2131
  case 0:
2132
  $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_GENERAL);
2151
  break;
2152
  }
2153
  // bit 3, mask 0x08; wrap text
2154
+ $wrapText = (0x08 & ord($recordData[6])) >> 3;
2155
  switch ($wrapText) {
2156
  case 0:
2157
  $objStyle->getAlignment()->setWrapText(false);
2161
  break;
2162
  }
2163
  // bit 6-4, mask 0x70; vertical alignment
2164
+ $vertAlign = (0x70 & ord($recordData[6])) >> 4;
2165
  switch ($vertAlign) {
2166
  case 0:
2167
  $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
2179
 
2180
  if ($this->version == self::XLS_BIFF8) {
2181
  // offset: 7; size: 1; XF_ROTATION: Text rotation angle
2182
+ $angle = ord($recordData[7]);
2183
  $rotation = 0;
2184
  if ($angle <= 90) {
2185
  $rotation = $angle;
2192
 
2193
  // offset: 8; size: 1; Indentation, shrink to cell size, and text direction
2194
  // bit: 3-0; mask: 0x0F; indent level
2195
+ $indent = (0x0F & ord($recordData[8])) >> 0;
2196
  $objStyle->getAlignment()->setIndent($indent);
2197
 
2198
  // bit: 4; mask: 0x10; 1 = shrink content to fit into cell
2199
+ $shrinkToFit = (0x10 & ord($recordData[8])) >> 4;
2200
  switch ($shrinkToFit) {
2201
  case 0:
2202
  $objStyle->getAlignment()->setShrinkToFit(false);
2276
  // BIFF5
2277
 
2278
  // offset: 7; size: 1; Text orientation and flags
2279
+ $orientationAndFlags = ord($recordData[7]);
2280
 
2281
  // bit: 1-0; mask: 0x03; XF_ORIENTATION: Text orientation
2282
  $xfOrientation = (0x03 & $orientationAndFlags) >> 0;
2400
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2401
 
2402
  if ($xclfType == 2) {
2403
+ $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
2404
 
2405
  // modify the relevant style property
2406
  if (isset($this->mapCellXfIndex[$ixfe])) {
2415
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2416
 
2417
  if ($xclfType == 2) {
2418
+ $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
2419
 
2420
  // modify the relevant style property
2421
  if (isset($this->mapCellXfIndex[$ixfe])) {
2430
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2431
 
2432
  if ($xclfType == 2) {
2433
+ $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
2434
 
2435
  // modify the relevant style property
2436
  if (isset($this->mapCellXfIndex[$ixfe])) {
2445
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2446
 
2447
  if ($xclfType == 2) {
2448
+ $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
2449
 
2450
  // modify the relevant style property
2451
  if (isset($this->mapCellXfIndex[$ixfe])) {
2460
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2461
 
2462
  if ($xclfType == 2) {
2463
+ $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
2464
 
2465
  // modify the relevant style property
2466
  if (isset($this->mapCellXfIndex[$ixfe])) {
2475
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2476
 
2477
  if ($xclfType == 2) {
2478
+ $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
2479
 
2480
  // modify the relevant style property
2481
  if (isset($this->mapCellXfIndex[$ixfe])) {
2490
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2491
 
2492
  if ($xclfType == 2) {
2493
+ $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
2494
 
2495
  // modify the relevant style property
2496
  if (isset($this->mapCellXfIndex[$ixfe])) {
2505
  $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
2506
 
2507
  if ($xclfType == 2) {
2508
+ $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
2509
 
2510
  // modify the relevant style property
2511
  if (isset($this->mapCellXfIndex[$ixfe])) {
2547
 
2548
  if ($isBuiltIn) {
2549
  // offset: 2; size: 1; identifier for built-in style
2550
+ $builtInId = ord($recordData[2]);
2551
 
2552
  switch ($builtInId) {
2553
  case 0x00:
2612
  $this->pos += 4 + $length;
2613
 
2614
  // offset: 4; size: 1; sheet state
2615
+ switch (ord($recordData[4])) {
2616
  case 0x00:
2617
  $sheetState = PHPExcel_Worksheet::SHEETSTATE_VISIBLE;
2618
  break;
2628
  }
2629
 
2630
  // offset: 5; size: 1; sheet type
2631
+ $sheetType = ord($recordData[5]);
2632
 
2633
  // offset: 6; size: var; sheet name
2634
  if ($this->version == self::XLS_BIFF8) {
2806
  // offset: 2; size: 1; keyboard shortcut
2807
 
2808
  // offset: 3; size: 1; length of the name (character count)
2809
+ $nlen = ord($recordData[3]);
2810
 
2811
  // offset: 4; size: 2; size of the formula data (it can happen that this is zero)
2812
  // note: there can also be additional data, this is not included in $flen
2889
  $pos += 2;
2890
 
2891
  // option flags
2892
+ $optionFlags = ord($recordData[$pos]);
2893
  ++$pos;
2894
 
2895
  // bit: 0; mask: 0x01; 0 = compressed; 1 = uncompressed
2956
 
2957
  // repeated option flags
2958
  // OpenOffice.org documentation 5.21
2959
+ $option = isset($recordData[$pos]) ? ord($recordData[$pos]) : 0;
2960
  ++$pos;
2961
 
2962
  if ($isCompressed && ($option == 0)) {
2978
  // this fragment compressed
2979
  $len = min($charsLeft, $limitpos - $pos);
2980
  for ($j = 0; $j < $len; ++$j) {
2981
+ $retstr .= $recordData[$pos + $j] . chr(0);
2982
  }
2983
  $charsLeft -= $len;
2984
  $isCompressed = false;
3884
  // We can apparently not rely on $isPartOfSharedFormula. Even when $isPartOfSharedFormula = true
3885
  // the formula data may be ordinary formula data, therefore we need to check
3886
  // explicitly for the tExp token (0x01)
3887
+ $isPartOfSharedFormula = $isPartOfSharedFormula && ord($formulaStructure[2]) == 0x01;
3888
 
3889
  if ($isPartOfSharedFormula) {
3890
  // part of shared formula which means there will be a formula with a tExp token and nothing else
3907
  $xfIndex = self::getInt2d($recordData, 4);
3908
 
3909
  // offset: 6; size: 8; result of the formula
3910
+ if ((ord($recordData[6]) == 0) && (ord($recordData[12]) == 255) && (ord($recordData[13]) == 255)) {
3911
  // String formula. Result follows in appended STRING record
3912
  $dataType = PHPExcel_Cell_DataType::TYPE_STRING;
3913
 
3919
 
3920
  // read STRING record
3921
  $value = $this->readString();
3922
+ } elseif ((ord($recordData[6]) == 1)
3923
+ && (ord($recordData[12]) == 255)
3924
+ && (ord($recordData[13]) == 255)) {
3925
  // Boolean formula. Result is in +2; 0=false, 1=true
3926
  $dataType = PHPExcel_Cell_DataType::TYPE_BOOL;
3927
+ $value = (bool) ord($recordData[8]);
3928
+ } elseif ((ord($recordData[6]) == 2)
3929
+ && (ord($recordData[12]) == 255)
3930
+ && (ord($recordData[13]) == 255)) {
3931
  // Error formula. Error code is in +2
3932
  $dataType = PHPExcel_Cell_DataType::TYPE_ERROR;
3933
+ $value = PHPExcel_Reader_Excel5_ErrorCode::lookup(ord($recordData[8]));
3934
+ } elseif ((ord($recordData[6]) == 3)
3935
+ && (ord($recordData[12]) == 255)
3936
+ && (ord($recordData[13]) == 255)) {
3937
  // Formula result is a null string
3938
  $dataType = PHPExcel_Cell_DataType::TYPE_NULL;
3939
  $value = '';
3997
  // offset: 6, size: 1; not used
3998
 
3999
  // offset: 7, size: 1; number of existing FORMULA records for this shared formula
4000
+ $no = ord($recordData[7]);
4001
 
4002
  // offset: 8, size: var; Binary token array of the shared formula
4003
  $formula = substr($recordData, 8);
4063
  $xfIndex = self::getInt2d($recordData, 4);
4064
 
4065
  // offset: 6; size: 1; the boolean value or error value
4066
+ $boolErr = ord($recordData[6]);
4067
 
4068
  // offset: 7; size: 1; 0=boolean; 1=error
4069
+ $isError = ord($recordData[7]);
4070
 
4071
  $cell = $this->phpSheet->getCell($columnString . ($row + 1));
4072
  switch ($isError) {
4448
 
4449
  if (!$this->readDataOnly) {
4450
  // offset: 0; size: 1; pane identifier
4451
+ $paneId = ord($recordData[0]);
4452
 
4453
  // offset: 1; size: 2; index to row of the active cell
4454
  $r = self::getInt2d($recordData, 1);
4599
  $hyperlinkType = 'UNC';
4600
  } elseif (!$isFileLinkOrUrl) {
4601
  $hyperlinkType = 'workbook';
4602
+ } elseif (ord($recordData[$offset]) == 0x03) {
4603
  $hyperlinkType = 'local';
4604
+ } elseif (ord($recordData[$offset]) == 0xE0) {
4605
  $hyperlinkType = 'URL';
4606
  }
4607
 
5176
  }
5177
  //imagepng($ih, 'image.png');
5178
 
5179
+ if(!isset($filename))
5180
+ $filename = null;
5181
+
5182
  $drawing = new PHPExcel_Worksheet_Drawing();
5183
  $drawing->setPath($filename);
5184
  $drawing->setWorksheet($this->phpSheet);
6890
  $lr = self::getInt2d($subData, 2) + 1;
6891
 
6892
  // offset: 4; size: 1; index to first column
6893
+ $fc = ord($subData[4]);
6894
 
6895
  // offset: 5; size: 1; index to last column
6896
+ $lc = ord($subData[5]);
6897
 
6898
  // check values
6899
  if ($fr > $lr || $fc > $lc) {
7298
  private static function readRGB($rgb)
7299
  {
7300
  // offset: 0; size 1; Red component
7301
+ $r = ord($rgb[0]);
7302
 
7303
  // offset: 1; size: 1; Green component
7304
+ $g = ord($rgb[1]);
7305
 
7306
  // offset: 2; size: 1; Blue component
7307
+ $b = ord($rgb[2]);
7308
 
7309
  // HEX notation, e.g. 'FF00FC'
7310
  $rgb = sprintf('%02X%02X%02X', $r, $g, $b);
classes/PHPExcel/Reader/Excel5/Escher.php CHANGED
@@ -280,16 +280,16 @@ class PHPExcel_Reader_Excel5_Escher
280
  $foDelay = PHPExcel_Reader_Excel5::getInt4d($recordData, 28);
281
 
282
  // offset: 32; size: 1; unused1
283
- $unused1 = ord($recordData{32});
284
 
285
  // offset: 33; size: 1; size of nameData in bytes (including null terminator)
286
- $cbName = ord($recordData{33});
287
 
288
  // offset: 34; size: 1; unused2
289
- $unused2 = ord($recordData{34});
290
 
291
  // offset: 35; size: 1; unused3
292
- $unused3 = ord($recordData{35});
293
 
294
  // offset: 36; size: $cbName; nameData
295
  $nameData = substr($recordData, 36, $cbName);
@@ -331,7 +331,7 @@ class PHPExcel_Reader_Excel5_Escher
331
  }
332
 
333
  // offset: var; size: 1; tag
334
- $tag = ord($recordData{$pos});
335
  $pos += 1;
336
 
337
  // offset: var; size: var; the raw image data
@@ -372,7 +372,7 @@ class PHPExcel_Reader_Excel5_Escher
372
  }
373
 
374
  // offset: var; size: 1; tag
375
- $tag = ord($recordData{$pos});
376
  $pos += 1;
377
 
378
  // offset: var; size: var; the raw image data
280
  $foDelay = PHPExcel_Reader_Excel5::getInt4d($recordData, 28);
281
 
282
  // offset: 32; size: 1; unused1
283
+ $unused1 = ord($recordData[32]);
284
 
285
  // offset: 33; size: 1; size of nameData in bytes (including null terminator)
286
+ $cbName = ord($recordData[33]);
287
 
288
  // offset: 34; size: 1; unused2
289
+ $unused2 = ord($recordData[34]);
290
 
291
  // offset: 35; size: 1; unused3
292
+ $unused3 = ord($recordData[35]);
293
 
294
  // offset: 36; size: $cbName; nameData
295
  $nameData = substr($recordData, 36, $cbName);
331
  }
332
 
333
  // offset: var; size: 1; tag
334
+ $tag = ord($recordData[$pos]);
335
  $pos += 1;
336
 
337
  // offset: var; size: var; the raw image data
372
  }
373
 
374
  // offset: var; size: 1; tag
375
+ $tag = ord($recordData[$pos]);
376
  $pos += 1;
377
 
378
  // offset: var; size: var; the raw image data
classes/PHPExcel/Reader/OOCalc.php CHANGED
@@ -535,7 +535,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
535
  array_push($dataArray, $pData);
536
  }
537
  }
538
- $allCellDataText = implode($dataArray, "\n");
539
 
540
  // echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />';
541
  switch ($cellDataOfficeAttributes['value-type']) {
535
  array_push($dataArray, $pData);
536
  }
537
  }
538
+ $allCellDataText = implode( "\n", $dataArray );
539
 
540
  // echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />';
541
  switch ($cellDataOfficeAttributes['value-type']) {
classes/PHPExcel/Reader/SYLK.php CHANGED
@@ -161,7 +161,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
161
  if ($dataType == 'C') {
162
  // Read cell value data
163
  foreach ($rowData as $rowDatum) {
164
- switch ($rowDatum{0}) {
165
  case 'C':
166
  case 'X':
167
  $columnIndex = substr($rowDatum, 1) - 1;
@@ -249,7 +249,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
249
  if ($dataType == 'P') {
250
  $formatArray = array();
251
  foreach ($rowData as $rowDatum) {
252
- switch ($rowDatum{0}) {
253
  case 'P':
254
  $formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1));
255
  break;
@@ -263,7 +263,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
263
  case 'S':
264
  $styleSettings = substr($rowDatum, 1);
265
  for ($i=0; $i<strlen($styleSettings); ++$i) {
266
- switch ($styleSettings{$i}) {
267
  case 'I':
268
  $formatArray['font']['italic'] = true;
269
  break;
@@ -293,7 +293,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
293
  $hasCalculatedValue = false;
294
  $cellData = $cellDataFormula = '';
295
  foreach ($rowData as $rowDatum) {
296
- switch ($rowDatum{0}) {
297
  case 'C':
298
  case 'X':
299
  $column = substr($rowDatum, 1);
@@ -327,7 +327,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
327
  $rowReference = $row;
328
  }
329
  // Bracketed R references are relative to the current row
330
- if ($rowReference{0} == '[') {
331
  $rowReference = $row + trim($rowReference, '[]');
332
  }
333
  $columnReference = $cellReference[4][0];
@@ -336,7 +336,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
336
  $columnReference = $column;
337
  }
338
  // Bracketed C references are relative to the current column
339
- if ($columnReference{0} == '[') {
340
  $columnReference = $column + trim($columnReference, '[]');
341
  }
342
  $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
@@ -366,7 +366,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
366
  $formatStyle = $columnWidth = $styleSettings = '';
367
  $styleData = array();
368
  foreach ($rowData as $rowDatum) {
369
- switch ($rowDatum{0}) {
370
  case 'C':
371
  case 'X':
372
  $column = substr($rowDatum, 1);
@@ -384,7 +384,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
384
  case 'S':
385
  $styleSettings = substr($rowDatum, 1);
386
  for ($i=0; $i<strlen($styleSettings); ++$i) {
387
- switch ($styleSettings{$i}) {
388
  case 'I':
389
  $styleData['font']['italic'] = true;
390
  break;
@@ -433,7 +433,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
433
  }
434
  } else {
435
  foreach ($rowData as $rowDatum) {
436
- switch ($rowDatum{0}) {
437
  case 'C':
438
  case 'X':
439
  $column = substr($rowDatum, 1);
161
  if ($dataType == 'C') {
162
  // Read cell value data
163
  foreach ($rowData as $rowDatum) {
164
+ switch ($rowDatum[0]) {
165
  case 'C':
166
  case 'X':
167
  $columnIndex = substr($rowDatum, 1) - 1;
249
  if ($dataType == 'P') {
250
  $formatArray = array();
251
  foreach ($rowData as $rowDatum) {
252
+ switch ($rowDatum[0]) {
253
  case 'P':
254
  $formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1));
255
  break;
263
  case 'S':
264
  $styleSettings = substr($rowDatum, 1);
265
  for ($i=0; $i<strlen($styleSettings); ++$i) {
266
+ switch ($styleSettings[$i]) {
267
  case 'I':
268
  $formatArray['font']['italic'] = true;
269
  break;
293
  $hasCalculatedValue = false;
294
  $cellData = $cellDataFormula = '';
295
  foreach ($rowData as $rowDatum) {
296
+ switch ($rowDatum[0]) {
297
  case 'C':
298
  case 'X':
299
  $column = substr($rowDatum, 1);
327
  $rowReference = $row;
328
  }
329
  // Bracketed R references are relative to the current row
330
+ if ($rowReference[0] == '[') {
331
  $rowReference = $row + trim($rowReference, '[]');
332
  }
333
  $columnReference = $cellReference[4][0];
336
  $columnReference = $column;
337
  }
338
  // Bracketed C references are relative to the current column
339
+ if ($columnReference[0] == '[') {
340
  $columnReference = $column + trim($columnReference, '[]');
341
  }
342
  $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
366
  $formatStyle = $columnWidth = $styleSettings = '';
367
  $styleData = array();
368
  foreach ($rowData as $rowDatum) {
369
+ switch ($rowDatum[0]) {
370
  case 'C':
371
  case 'X':
372
  $column = substr($rowDatum, 1);
384
  case 'S':
385
  $styleSettings = substr($rowDatum, 1);
386
  for ($i=0; $i<strlen($styleSettings); ++$i) {
387
+ switch ($styleSettings[$i]) {
388
  case 'I':
389
  $styleData['font']['italic'] = true;
390
  break;
433
  }
434
  } else {
435
  foreach ($rowData as $rowDatum) {
436
+ switch ($rowDatum[0]) {
437
  case 'C':
438
  case 'X':
439
  $column = substr($rowDatum, 1);
classes/PHPExcel/ReferenceHelper.php CHANGED
@@ -881,8 +881,8 @@ class PHPExcel_ReferenceHelper
881
  list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString($pCellReference);
882
 
883
  // Verify which parts should be updated
884
- $updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') && (PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)));
885
- $updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') && $newRow >= $beforeRow);
886
 
887
  // Create new column reference
888
  if ($updateColumn) {
881
  list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString($pCellReference);
882
 
883
  // Verify which parts should be updated
884
+ $updateColumn = (($newColumn[0] != '$') && ($beforeColumn[0] != '$') && (PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)));
885
+ $updateRow = (($newRow[0] != '$') && ($beforeRow[0] != '$') && $newRow >= $beforeRow);
886
 
887
  // Create new column reference
888
  if ($updateColumn) {
classes/PHPExcel/Shared/Drawing.php CHANGED
@@ -70,7 +70,7 @@ class PHPExcel_Shared_Drawing
70
  * @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
71
  * @return int Value in cell dimension
72
  */
73
- public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont)
74
  {
75
  // Font name and size
76
  $name = $pDefaultFont->getName();
@@ -95,7 +95,7 @@ class PHPExcel_Shared_Drawing
95
  * @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
96
  * @return int Value in pixels
97
  */
98
- public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont)
99
  {
100
  // Font name and size
101
  $name = $pDefaultFont->getName();
70
  * @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
71
  * @return int Value in cell dimension
72
  */
73
+ public static function pixelsToCellDimension($pValue, PHPExcel_Style_Font $pDefaultFont)
74
  {
75
  // Font name and size
76
  $name = $pDefaultFont->getName();
95
  * @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
96
  * @return int Value in pixels
97
  */
98
+ public static function cellDimensionToPixels($pValue, PHPExcel_Style_Font $pDefaultFont)
99
  {
100
  // Font name and size
101
  $name = $pDefaultFont->getName();
classes/PHPExcel/Shared/OLE.php CHANGED
@@ -206,7 +206,8 @@ class PHPExcel_Shared_OLE
206
  // in OLE_ChainedBlockStream::stream_open().
207
  // Object is removed from self::$instances in OLE_Stream::close().
208
  $GLOBALS['_OLE_INSTANCES'][] = $this;
209
- $instanceId = end(array_keys($GLOBALS['_OLE_INSTANCES']));
 
210
 
211
  $path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId;
212
  if ($blockIdOrPps instanceof PHPExcel_Shared_OLE_PPS) {
@@ -443,7 +444,7 @@ class PHPExcel_Shared_OLE
443
  {
444
  $rawname = '';
445
  for ($i = 0; $i < strlen($ascii); ++$i) {
446
- $rawname .= $ascii{$i} . "\x00";
447
  }
448
  return $rawname;
449
  }
206
  // in OLE_ChainedBlockStream::stream_open().
207
  // Object is removed from self::$instances in OLE_Stream::close().
208
  $GLOBALS['_OLE_INSTANCES'][] = $this;
209
+ $_ole_instances = array_keys($GLOBALS['_OLE_INSTANCES']);
210
+ $instanceId = end($_ole_instances);
211
 
212
  $path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId;
213
  if ($blockIdOrPps instanceof PHPExcel_Shared_OLE_PPS) {
444
  {
445
  $rawname = '';
446
  for ($i = 0; $i < strlen($ascii); ++$i) {
447
+ $rawname .= $ascii[$i] . "\x00";
448
  }
449
  return $rawname;
450
  }
classes/PHPExcel/Shared/String.php CHANGED
@@ -523,8 +523,8 @@ class PHPExcel_Shared_String
523
  if (strlen($str) < 2) {
524
  return $str;
525
  }
526
- $c0 = ord($str{0});
527
- $c1 = ord($str{1});
528
  if ($c0 == 0xfe && $c1 == 0xff) {
529
  $str = substr($str, 2);
530
  } elseif ($c0 == 0xff && $c1 == 0xfe) {
@@ -535,11 +535,11 @@ class PHPExcel_Shared_String
535
  $newstr = '';
536
  for ($i=0; $i<$len; $i+=2) {
537
  if ($bom_be) {
538
- $val = ord($str{$i}) << 4;
539
- $val += ord($str{$i+1});
540
  } else {
541
- $val = ord($str{$i+1}) << 4;
542
- $val += ord($str{$i});
543
  }
544
  $newstr .= ($val == 0x228) ? "\n" : chr($val);
545
  }
523
  if (strlen($str) < 2) {
524
  return $str;
525
  }
526
+ $c0 = ord($str[0]);
527
+ $c1 = ord($str[1]);
528
  if ($c0 == 0xfe && $c1 == 0xff) {
529
  $str = substr($str, 2);
530
  } elseif ($c0 == 0xff && $c1 == 0xfe) {
535
  $newstr = '';
536
  for ($i=0; $i<$len; $i+=2) {
537
  if ($bom_be) {
538
+ $val = ord($str[$i]) << 4;
539
+ $val += ord($str[$i+1]);
540
  } else {
541
+ $val = ord($str[$i+1]) << 4;
542
+ $val += ord($str[$i]);
543
  }
544
  $newstr .= ($val == 0x228) ? "\n" : chr($val);
545
  }
classes/PHPExcel/Shared/ZipStreamWrapper.php CHANGED
@@ -76,7 +76,7 @@ class PHPExcel_Shared_ZipStreamWrapper
76
  public function stream_open($path, $mode, $options, &$opened_path)
77
  {
78
  // Check for mode
79
- if ($mode{0} != 'r') {
80
  throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.');
81
  }
82
 
76
  public function stream_open($path, $mode, $options, &$opened_path)
77
  {
78
  // Check for mode
79
+ if ($mode[0] != 'r') {
80
  throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.');
81
  }
82
 
classes/PHPExcel/Shared/trend/trendClass.php CHANGED
@@ -78,7 +78,7 @@ class trendClass
78
  private static $trendCache = array();
79
 
80
 
81
- public static function calculate($trendType = self::TREND_BEST_FIT, $yValues, $xValues = array(), $const = true)
82
  {
83
  // Calculate number of points in each dataset
84
  $nY = count($yValues);
78
  private static $trendCache = array();
79
 
80
 
81
+ public static function calculate($trendType, $yValues, $xValues = array(), $const = true)
82
  {
83
  // Calculate number of points in each dataset
84
  $nY = count($yValues);
classes/PHPExcel/Worksheet.php CHANGED
@@ -1474,7 +1474,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
1474
  * @param $pValue PHPExcel_Style_Conditional[]
1475
  * @return PHPExcel_Worksheet
1476
  */
1477
- public function setConditionalStyles($pCoordinate = 'A1', $pValue)
1478
  {
1479
  $this->conditionalStylesCollection[strtoupper($pCoordinate)] = $pValue;
1480
  return $this;
1474
  * @param $pValue PHPExcel_Style_Conditional[]
1475
  * @return PHPExcel_Worksheet
1476
  */
1477
+ public function setConditionalStyles($pCoordinate, $pValue)
1478
  {
1479
  $this->conditionalStylesCollection[strtoupper($pCoordinate)] = $pValue;
1480
  return $this;
classes/PHPExcel/Worksheet/AutoFilter.php CHANGED
@@ -580,8 +580,8 @@ class PHPExcel_Worksheet_AutoFilter
580
  } else {
581
  sort($dataValues);
582
  }
583
-
584
- return array_pop(array_slice($dataValues, 0, $ruleValue));
585
  }
586
 
587
  /**
@@ -717,7 +717,7 @@ class PHPExcel_Worksheet_AutoFilter
717
  );
718
  } else {
719
  // Date based
720
- if ($dynamicRuleType{0} == 'M' || $dynamicRuleType{0} == 'Q') {
721
  // Month or Quarter
722
  sscanf($dynamicRuleType, '%[A-Z]%d', $periodType, $period);
723
  if ($periodType == 'M') {
580
  } else {
581
  sort($dataValues);
582
  }
583
+ $dataValues = array_slice($dataValues, 0, $ruleValue);
584
+ return array_pop($dataValues);
585
  }
586
 
587
  /**
717
  );
718
  } else {
719
  // Date based
720
+ if ( $dynamicRuleType[0] == 'M' || $dynamicRuleType[0] == 'Q') {
721
  // Month or Quarter
722
  sscanf($dynamicRuleType, '%[A-Z]%d', $periodType, $period);
723
  if ($periodType == 'M') {
classes/nested.php CHANGED
@@ -23,7 +23,8 @@ if ( ! class_exists('PMXI_Nested')){
23
  if ( ! empty($this->nested_files) ){
24
  $tmp_files = array();
25
  foreach ($this->nested_files as $key => $nfile) {
26
- $nested_fileURL = array_shift(XmlImportParser::factory($this->xml, $this->xpath, $nfile, $tmp_file)->parse()); $tmp_files[] = $tmp_file;
 
27
  if ( ! empty($nested_fileURL) ){
28
  $errors = new WP_Error();
29
 
23
  if ( ! empty($this->nested_files) ){
24
  $tmp_files = array();
25
  foreach ($this->nested_files as $key => $nfile) {
26
+ $factory = XmlImportParser::factory($this->xml, $this->xpath, $nfile, $tmp_file)->parse();
27
+ $nested_fileURL = array_shift($factory); $tmp_files[] = $tmp_file;
28
  if ( ! empty($nested_fileURL) ){
29
  $errors = new WP_Error();
30
 
config/options.php CHANGED
@@ -3,7 +3,8 @@
3
  * List of plugin optins, contains only default values, actual values are stored in database
4
  * and can be changed by corresponding wordpress function calls
5
  */
6
- $config = array(
 
7
  "history_file_count" => 10000,
8
  "history_file_age" => 365,
9
  "highlight_limit" => 10000,
3
  * List of plugin optins, contains only default values, actual values are stored in database
4
  * and can be changed by corresponding wordpress function calls
5
  */
6
+ $config = array(
7
+ "info_api_url" => "https://www.wpallimport.com",
8
  "history_file_count" => 10000,
9
  "history_file_age" => 365,
10
  "highlight_limit" => 10000,
helpers/functions.php CHANGED
@@ -75,7 +75,7 @@ function wpai_wp_enqueue_code_editor( $args ) {
75
  }
76
 
77
  if ( ! function_exists('pmxi_if') ) {
78
- function pmxi_if( $left_condition, $operand = '', $right_condition = '', $then, $else = '' ) {
79
  $str = trim(implode(' ', array($left_condition, html_entity_decode($operand), $right_condition)));
80
  return (eval ("return ($str);")) ? $then : $else;
81
  }
75
  }
76
 
77
  if ( ! function_exists('pmxi_if') ) {
78
+ function pmxi_if( $left_condition, $operand, $right_condition, $then, $else = '' ) {
79
  $str = trim(implode(' ', array($left_condition, html_entity_decode($operand), $right_condition)));
80
  return (eval ("return ($str);")) ? $then : $else;
81
  }
helpers/wp_all_import_ctx_mapping.php CHANGED
@@ -1,17 +1,25 @@
1
  <?php
2
 
3
  if ( ! function_exists('wp_all_import_ctx_mapping')){
4
- function wp_all_import_ctx_mapping( $ctx, $mapping_rules, $tx_name ){
5
- if ( ! empty( $mapping_rules) and $ctx['is_mapping']){
6
  foreach ($mapping_rules as $rule) {
7
- foreach ($rule as $key => $value) {
8
- if ( trim($ctx['name']) == trim($key) || str_replace("&amp;", "&", trim($ctx['name'])) == str_replace("&amp;", "&", trim($key)) ){
 
 
 
 
 
 
 
 
9
  $ctx['name'] = trim($value);
10
  break;
11
  }
12
- }
13
- }
14
- }
15
  return apply_filters('pmxi_single_category', $ctx, $tx_name);
16
  }
17
  }
1
  <?php
2
 
3
  if ( ! function_exists('wp_all_import_ctx_mapping')){
4
+ function wp_all_import_ctx_mapping( $ctx, $mapping_rules, $tx_name ){
5
+ if ( ! empty( $mapping_rules) and $ctx['is_mapping']){
6
  foreach ($mapping_rules as $rule) {
7
+ foreach ($rule as $key => $value) {
8
+ // Modify the values used to check if something should be mapped by checking the name and key with both being lowercase
9
+ $mappingCheckName = $ctx["name"];
10
+ $mappingCheckKey = $key;
11
+ $mappingCheckLowercase = apply_filters("wpai_is_case_insensitive_taxonomy_mapping", false, $tx_name);
12
+ if ($mappingCheckLowercase) {
13
+ $mappingCheckName = strtolower($mappingCheckName);
14
+ $mappingCheckKey = strtolower($mappingCheckKey);
15
+ }
16
+ if ( trim($mappingCheckName) == trim($mappingCheckKey) || str_replace("&amp;", "&", trim($mappingCheckName)) == str_replace("&amp;", "&", trim($mappingCheckKey)) ){
17
  $ctx['name'] = trim($value);
18
  break;
19
  }
20
+ }
21
+ }
22
+ }
23
  return apply_filters('pmxi_single_category', $ctx, $tx_name);
24
  }
25
  }
models/import/record.php CHANGED
@@ -1612,7 +1612,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1612
  }
1613
  }
1614
  if ($post_to_update){
1615
- $logger and call_user_func($logger, sprintf(__('Duplicate post was found for post %s with unique key `%s`...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData), $unique_keys[$i]));
1616
  break;
1617
  } else {
1618
  $postRecord->delete();
@@ -1620,7 +1620,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
1620
  }
1621
 
1622
  if (empty($post_to_update)) {
1623
- $logger and call_user_func($logger, sprintf(__('Duplicate post wasn\'t found with unique key `%s`...', 'wp_all_import_plugin'), $unique_keys[$i]));
1624
  }
1625
 
1626
  // if Manual Matching re-import option seleted
@@ -2370,6 +2370,21 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2370
 
2371
  foreach ( $images as $image ){
2372
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2373
  if ($source_type == 'gallery'){
2374
  $image_data = $image;
2375
  $image = $image_data['url'];
@@ -2649,7 +2664,22 @@ class PMXI_Import_Record extends PMXI_Model_Record {
2649
 
2650
  $is_keep_existing_images = ( ! empty($articleData['ID']) and $this->options['is_update_images'] and $this->options['update_images_logic'] == "add_new" and $this->options['update_all_data'] == "no" and $is_show_add_new_images);
2651
 
2652
- foreach ($imgs as $k => $img_url) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2653
 
2654
  $attid = false;
2655
 
@@ -3085,13 +3115,32 @@ class PMXI_Import_Record extends PMXI_Model_Record {
3085
 
3086
  $logger and call_user_func($logger, sprintf(__('- Importing attachments for `%s` ...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
3087
 
3088
- foreach ($attachments[$i] as $attachment) { if ("" == $attachment) continue;
 
 
3089
 
3090
  $atchs = str_getcsv($attachment, $this->options['atch_delim']);
3091
 
3092
  if ( ! empty($atchs) ) {
3093
 
3094
- foreach ($atchs as $atch_url) { if (empty($atch_url)) continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3095
 
3096
  $download_file = true;
3097
  $create_file = false;
@@ -3499,7 +3548,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
3499
  $title = $articleData['post_title'];
3500
  break;
3501
  }
3502
- return $title;
3503
  }
3504
 
3505
  public function downloadFile($url, $image_filepath, $is_cron = false, $logger, $type = 'images'){
1612
  }
1613
  }
1614
  if ($post_to_update){
1615
+ $logger and call_user_func($logger, sprintf(__('Duplicate post was found for post %s with unique key `%s`...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData), wp_all_import_clear_xss($unique_keys[$i])));
1616
  break;
1617
  } else {
1618
  $postRecord->delete();
1620
  }
1621
 
1622
  if (empty($post_to_update)) {
1623
+ $logger and call_user_func($logger, sprintf(__('Duplicate post wasn\'t found with unique key `%s`...', 'wp_all_import_plugin'), wp_all_import_clear_xss($unique_keys[$i])));
1624
  }
1625
 
1626
  // if Manual Matching re-import option seleted
2370
 
2371
  foreach ( $images as $image ){
2372
 
2373
+ $image_uploads = apply_filters('wp_all_import_single_image_uploads_dir', $images_uploads, $image, $articleData, $current_xml_node, $this->id, $pid);
2374
+
2375
+ if (empty($image_uploads)) {
2376
+ $logger and call_user_func($logger, __('<b>ERROR</b>: Target directory is not defined', 'wp_all_import_plugin'));
2377
+ continue;
2378
+ }
2379
+
2380
+ $targetDir = $image_uploads['path'];
2381
+ $targetUrl = $image_uploads['url'];
2382
+
2383
+ if ( ! @is_writable($targetDir) ){
2384
+ $logger and call_user_func($logger, sprintf(__('<b>ERROR</b>: Target directory %s is not writable', 'wp_all_import_plugin'), $targetDir));
2385
+ continue;
2386
+ }
2387
+
2388
  if ($source_type == 'gallery'){
2389
  $image_data = $image;
2390
  $image = $image_data['url'];
2664
 
2665
  $is_keep_existing_images = ( ! empty($articleData['ID']) and $this->options['is_update_images'] and $this->options['update_images_logic'] == "add_new" and $this->options['update_all_data'] == "no" and $is_show_add_new_images);
2666
 
2667
+ foreach ($imgs as $k => $img_url) {
2668
+
2669
+ $image_uploads = apply_filters('wp_all_import_single_image_uploads_dir', $images_uploads, $img_url, $articleData, $current_xml_node, $this->id, $pid);
2670
+
2671
+ if (empty($image_uploads)) {
2672
+ $logger and call_user_func($logger, __('<b>ERROR</b>: Target directory is not defined', 'wp_all_import_plugin'));
2673
+ continue;
2674
+ }
2675
+
2676
+ $targetDir = $image_uploads['path'];
2677
+ $targetUrl = $image_uploads['url'];
2678
+
2679
+ if ( ! @is_writable($targetDir) ){
2680
+ $logger and call_user_func($logger, sprintf(__('<b>ERROR</b>: Target directory %s is not writable', 'wp_all_import_plugin'), $targetDir));
2681
+ continue;
2682
+ }
2683
 
2684
  $attid = false;
2685
 
3115
 
3116
  $logger and call_user_func($logger, sprintf(__('- Importing attachments for `%s` ...', 'wp_all_import_plugin'), $this->getRecordTitle($articleData)));
3117
 
3118
+ foreach ($attachments[$i] as $attachment) {
3119
+
3120
+ if ("" == $attachment) continue;
3121
 
3122
  $atchs = str_getcsv($attachment, $this->options['atch_delim']);
3123
 
3124
  if ( ! empty($atchs) ) {
3125
 
3126
+ foreach ($atchs as $atch_url) {
3127
+
3128
+ if (empty($atch_url)) continue;
3129
+
3130
+ $attachments_uploads = apply_filters('wp_all_import_single_attachment_uploads_dir', $attachments_uploads, $atch_url, $articleData, $current_xml_node, $this->id);
3131
+
3132
+ if (empty($attachments_uploads)) {
3133
+ $logger and call_user_func($logger, __('- <b>ERROR</b>: Target directory is not defined', 'wp_all_import_plugin'));
3134
+ continue;
3135
+ }
3136
+
3137
+ $targetDir = $attachments_uploads['path'];
3138
+ $targetUrl = $attachments_uploads['url'];
3139
+
3140
+ if ( ! @is_writable($targetDir) ){
3141
+ $logger and call_user_func($logger, sprintf(__('- <b>ERROR</b>: Target directory %s is not writable', 'wp_all_import_plugin'), trim($targetDir)));
3142
+ continue;
3143
+ }
3144
 
3145
  $download_file = true;
3146
  $create_file = false;
3548
  $title = $articleData['post_title'];
3549
  break;
3550
  }
3551
+ return wp_all_import_clear_xss($title);
3552
  }
3553
 
3554
  public function downloadFile($url, $image_filepath, $is_cron = false, $logger, $type = 'images'){
plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP All Import
4
  Plugin URI: http://www.wpallimport.com/wordpress-xml-csv-import/?utm_source=import-plugin-free&utm_medium=wp-plugins-page&utm_campaign=upgrade-to-pro
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.6.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.6.1');
29
 
30
  define('PMXI_EDITION', 'free');
31
 
@@ -116,7 +116,7 @@ final class PMXI_Plugin {
116
  */
117
  public static $is_php_allowed = true;
118
 
119
- public static $capabilities = 'install_plugins';
120
 
121
  /**
122
  * WP All Import logs folder
3
  Plugin Name: WP All Import
4
  Plugin URI: http://www.wpallimport.com/wordpress-xml-csv-import/?utm_source=import-plugin-free&utm_medium=wp-plugins-page&utm_campaign=upgrade-to-pro
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.6.2
7
  Author: Soflyy
8
  */
9
 
25
  */
26
  define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
27
 
28
+ define('PMXI_VERSION', '3.6.2');
29
 
30
  define('PMXI_EDITION', 'free');
31
 
116
  */
117
  public static $is_php_allowed = true;
118
 
119
+ public static $capabilities = 'manage_options';
120
 
121
  /**
122
  * WP All Import logs folder
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
  Tested up to: 5.8
5
- Stable tag: 3.6.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,14 @@ Does it work with special character encoding like Hebrew, Arabic, Chinese, etc?
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
 
 
 
108
  = 3.6.1 =
109
  * bug fix: categories were imported despite the taxonomy option being disabled
110
  * improvement: add ability to filter csv escape symbol via wp_all_import_csv_parser_settings filter
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
  Tested up to: 5.8
5
+ Stable tag: 3.6.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.6.2 =
109
+ * improvement: add ability to control taxonomy mapping case sensitivity via filter wpai_is_case_insensitive_taxonomy_mapping
110
+ * improvement: add ability to control uploads directory for single file/image via filters wp_all_import_single_image_uploads_dir and wp_all_import_single_attachment_uploads_dir
111
+ * improvement: add missing options on confirm import step
112
+ * bug fix
113
+ * improvement: initial PHP 8 support
114
+ * bugfix: manage_options capability check
115
+
116
  = 3.6.1 =
117
  * bug fix: categories were imported despite the taxonomy option being disabled
118
  * improvement: add ability to filter csv escape symbol via wp_all_import_csv_parser_settings filter
views/admin/import/confirm.php CHANGED
@@ -156,7 +156,7 @@
156
 
157
  <?php if ( "new" == $post['wizard_type']): ?>
158
 
159
- <p><?php printf(__('Your unique key is <span style="color:#000; font-weight:bold;">%s</span>', 'wp_all_import_plugin'), $post['unique_key']); ?></p>
160
 
161
  <?php if ( ! $isWizard and !empty($custom_type)): ?>
162
 
@@ -225,7 +225,16 @@
225
  <?php endif; ?>
226
  <?php if ( $post['is_update_content']): ?>
227
  <li> <?php _e('content', 'wp_all_import_plugin'); ?></li>
228
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
229
  <?php if ( $post['is_update_excerpt']): ?>
230
  <li> <?php _e('excerpt', 'wp_all_import_plugin'); ?></li>
231
  <?php endif; ?>
156
 
157
  <?php if ( "new" == $post['wizard_type']): ?>
158
 
159
+ <p><?php printf(__('Your unique key is <span style="color:#000; font-weight:bold;">%s</span>', 'wp_all_import_plugin'), wp_all_import_clear_xss($post['unique_key'])); ?></p>
160
 
161
  <?php if ( ! $isWizard and !empty($custom_type)): ?>
162
 
225
  <?php endif; ?>
226
  <?php if ( $post['is_update_content']): ?>
227
  <li> <?php _e('content', 'wp_all_import_plugin'); ?></li>
228
+ <?php endif; ?>
229
+ <?php if ( $post['is_update_author']): ?>
230
+ <li> <?php _e('author', 'wp_all_import_plugin'); ?></li>
231
+ <?php endif; ?>
232
+ <?php if ( $post['is_update_comment_status']): ?>
233
+ <li> <?php _e('comment status', 'wp_all_import_plugin'); ?></li>
234
+ <?php endif; ?>
235
+ <?php if ( $post['is_update_post_format']): ?>
236
+ <li> <?php _e('post format', 'wp_all_import_plugin'); ?></li>
237
+ <?php endif; ?>
238
  <?php if ( $post['is_update_excerpt']): ?>
239
  <li> <?php _e('excerpt', 'wp_all_import_plugin'); ?></li>
240
  <?php endif; ?>