Upgraded PHPExcel to v1.8.1

Fixes issues with PHP 7
This commit is contained in:
Raphaël Doursenaud
2015-11-03 10:48:57 +01:00
parent 0e155be4e8
commit e5915ce8d9
146 changed files with 8438 additions and 2225 deletions

View File

@@ -403,7 +403,7 @@ class PHPExcel_Shared_String
* @return boolean
*/
public static function IsUTF8($value = '') {
return $string === '' || preg_match('/^./su', $string) === 1;
return $value === '' || preg_match('/^./su', $value) === 1;
}
/**
@@ -626,6 +626,41 @@ class PHPExcel_Shared_String
return ucwords($pValue);
}
public static function mb_is_upper($char)
{
return mb_strtolower($char, "UTF-8") != $char;
}
public static function mb_str_split($string)
{
# Split at all position not after the start: ^
# and not before the end: $
return preg_split('/(?<!^)(?!$)/u', $string );
}
/**
* Reverse the case of a string, so that all uppercase characters become lowercase
* and all lowercase characters become uppercase
*
* @param string $pValue UTF-8 encoded string
* @return string
*/
public static function StrCaseReverse($pValue = '')
{
if (self::getIsMbstringEnabled()) {
$characters = self::mb_str_split($pValue);
foreach($characters as &$character) {
if(self::mb_is_upper($character)) {
$character = mb_strtolower($character, 'UTF-8');
} else {
$character = mb_strtoupper($character, 'UTF-8');
}
}
return implode('', $characters);
}
return strtolower($pValue) ^ strtoupper($pValue) ^ $pValue;
}
/**
* Identify whether a string contains a fractional numeric value,
* and convert it to a numeric if it is
@@ -771,6 +806,6 @@ class PHPExcel_Shared_String
if (is_numeric($value))
return $value;
$v = floatval($value);
return (is_numeric(substr($value,0,strlen($v)))) ? $v : $value;
return (is_numeric(substr($value, 0, strlen($v)))) ? $v : $value;
}
}