#401 : PHPCS (Shared\StringHelper)
This commit is contained in:
parent
c0fe7c275d
commit
69e168271a
|
@ -3929,7 +3929,7 @@ class Calculation
|
|||
$stack->push('Value', $operand);
|
||||
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand));
|
||||
return false;
|
||||
} elseif (!Shared\String::convertToNumberIfFraction($operand)) {
|
||||
} elseif (!Shared\StringHelper::convertToNumberIfFraction($operand)) {
|
||||
// If not a numeric or a fraction, then it's a text string, and so can't be used in mathematical binary operations
|
||||
$stack->push('Value', '#VALUE!');
|
||||
$this->_debugLog->writeDebugLog('Evaluation Result is a ', $this->showTypeDetails('#VALUE!'));
|
||||
|
@ -4071,8 +4071,8 @@ class Calculation
|
|||
*/
|
||||
private function strcmpLowercaseFirst($str1, $str2)
|
||||
{
|
||||
$inversedStr1 = Shared\String::StrCaseReverse($str1);
|
||||
$inversedStr2 = Shared\String::StrCaseReverse($str2);
|
||||
$inversedStr1 = Shared\StringHelper::strCaseReverse($str1);
|
||||
$inversedStr2 = Shared\StringHelper::strCaseReverse($str2);
|
||||
|
||||
return strcmp($inversedStr1, $inversedStr2);
|
||||
}
|
||||
|
|
|
@ -238,8 +238,8 @@ class TextData
|
|||
$haystack = ($haystack) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (($offset > 0) && (\PHPExcel\Shared\StringHelper::CountCharacters($haystack) > $offset)) {
|
||||
if (\PHPExcel\Shared\StringHelper::CountCharacters($needle) == 0) {
|
||||
if (($offset > 0) && (\PHPExcel\Shared\StringHelper::countCharacters($haystack) > $offset)) {
|
||||
if (\PHPExcel\Shared\StringHelper::countCharacters($needle) == 0) {
|
||||
return $offset;
|
||||
}
|
||||
if (function_exists('mb_strpos')) {
|
||||
|
@ -275,8 +275,8 @@ class TextData
|
|||
$haystack = ($haystack) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (($offset > 0) && (\PHPExcel\Shared\StringHelper::CountCharacters($haystack) > $offset)) {
|
||||
if (\PHPExcel\Shared\StringHelper::CountCharacters($needle) == 0) {
|
||||
if (($offset > 0) && (\PHPExcel\Shared\StringHelper::countCharacters($haystack) > $offset)) {
|
||||
if (\PHPExcel\Shared\StringHelper::countCharacters($needle) == 0) {
|
||||
return $offset;
|
||||
}
|
||||
if (function_exists('mb_stripos')) {
|
||||
|
@ -449,7 +449,7 @@ class TextData
|
|||
$mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
|
||||
}
|
||||
|
||||
return \PHPExcel\Shared\StringHelper::StrToLower($mixedCaseString);
|
||||
return \PHPExcel\Shared\StringHelper::strToLower($mixedCaseString);
|
||||
}
|
||||
|
||||
|
||||
|
@ -469,7 +469,7 @@ class TextData
|
|||
$mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
|
||||
}
|
||||
|
||||
return \PHPExcel\Shared\StringHelper::StrToUpper($mixedCaseString);
|
||||
return \PHPExcel\Shared\StringHelper::strToUpper($mixedCaseString);
|
||||
}
|
||||
|
||||
|
||||
|
@ -489,7 +489,7 @@ class TextData
|
|||
$mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
|
||||
}
|
||||
|
||||
return \PHPExcel\Shared\StringHelper::StrToTitle($mixedCaseString);
|
||||
return \PHPExcel\Shared\StringHelper::strToTitle($mixedCaseString);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder
|
|||
{
|
||||
// sanitize UTF-8 strings
|
||||
if (is_string($value)) {
|
||||
$value = \PHPExcel\Shared\StringHelper::SanitizeUTF8($value);
|
||||
$value = \PHPExcel\Shared\StringHelper::sanitizeUTF8($value);
|
||||
}
|
||||
|
||||
// Find out data type
|
||||
|
@ -165,7 +165,7 @@ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder
|
|||
|
||||
// Check for newline character "\n"
|
||||
if (strpos($value, "\n") !== false) {
|
||||
$value = \PHPExcel\Shared\StringHelper::SanitizeUTF8($value);
|
||||
$value = \PHPExcel\Shared\StringHelper::sanitizeUTF8($value);
|
||||
$cell->setValueExplicit($value, DataType::TYPE_STRING);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||
|
|
|
@ -90,7 +90,7 @@ class DataType
|
|||
}
|
||||
|
||||
// string must never be longer than 32,767 characters, truncate if necessary
|
||||
$pValue = \PHPExcel\Shared\StringHelper::Substring($pValue, 0, 32767);
|
||||
$pValue = \PHPExcel\Shared\StringHelper::substring($pValue, 0, 32767);
|
||||
|
||||
// we require that newline is represented as "\n" in core, not as "\r\n" or "\r"
|
||||
$pValue = str_replace(array("\r\n", "\r"), "\n", $pValue);
|
||||
|
|
|
@ -40,7 +40,7 @@ class DefaultValueBinder implements IValueBinder
|
|||
{
|
||||
// sanitize UTF-8 strings
|
||||
if (is_string($value)) {
|
||||
$value = \PHPExcel\Shared\StringHelper::SanitizeUTF8($value);
|
||||
$value = \PHPExcel\Shared\StringHelper::sanitizeUTF8($value);
|
||||
} elseif (is_object($value)) {
|
||||
// Handle any objects that might be injected
|
||||
if ($value instanceof \DateTime) {
|
||||
|
|
|
@ -281,7 +281,7 @@ class CSV extends BaseReader implements IReader
|
|||
|
||||
// Convert encoding if necessary
|
||||
if ($this->inputEncoding !== 'UTF-8') {
|
||||
$rowDatum = \PHPExcel\Shared\StringHelper::ConvertEncoding($rowDatum, 'UTF-8', $this->inputEncoding);
|
||||
$rowDatum = \PHPExcel\Shared\StringHelper::convertEncoding($rowDatum, 'UTF-8', $this->inputEncoding);
|
||||
}
|
||||
|
||||
// Set cell value
|
||||
|
|
|
@ -789,7 +789,7 @@ class Excel2003XML extends BaseReader implements IReader
|
|||
protected static function convertStringEncoding($string, $charset)
|
||||
{
|
||||
if ($charset != 'UTF-8') {
|
||||
return \PHPExcel\Shared\StringHelper::ConvertEncoding($string, 'UTF-8', $charset);
|
||||
return \PHPExcel\Shared\StringHelper::convertEncoding($string, 'UTF-8', $charset);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
|
|
@ -525,7 +525,7 @@ class Excel2007 extends BaseReader implements IReader
|
|||
if (isset($xmlStrings) && isset($xmlStrings->si)) {
|
||||
foreach ($xmlStrings->si as $val) {
|
||||
if (isset($val->t)) {
|
||||
$sharedStrings[] = \PHPExcel\Shared\StringHelper::ControlCharacterOOXML2PHP((string) $val->t);
|
||||
$sharedStrings[] = \PHPExcel\Shared\StringHelper::controlCharacterOOXML2PHP((string) $val->t);
|
||||
} elseif (isset($val->r)) {
|
||||
$sharedStrings[] = $this->parseRichText($val);
|
||||
}
|
||||
|
@ -2071,14 +2071,14 @@ class Excel2007 extends BaseReader implements IReader
|
|||
$value = new \PHPExcel\RichText();
|
||||
|
||||
if (isset($is->t)) {
|
||||
$value->createText(\PHPExcel\Shared\StringHelper::ControlCharacterOOXML2PHP((string) $is->t));
|
||||
$value->createText(\PHPExcel\Shared\StringHelper::controlCharacterOOXML2PHP((string) $is->t));
|
||||
} else {
|
||||
if (is_object($is->r)) {
|
||||
foreach ($is->r as $run) {
|
||||
if (!isset($run->rPr)) {
|
||||
$objText = $value->createText(\PHPExcel\Shared\StringHelper::ControlCharacterOOXML2PHP((string) $run->t));
|
||||
$objText = $value->createText(\PHPExcel\Shared\StringHelper::controlCharacterOOXML2PHP((string) $run->t));
|
||||
} else {
|
||||
$objText = $value->createTextRun(\PHPExcel\Shared\StringHelper::ControlCharacterOOXML2PHP((string) $run->t));
|
||||
$objText = $value->createTextRun(\PHPExcel\Shared\StringHelper::controlCharacterOOXML2PHP((string) $run->t));
|
||||
|
||||
if (isset($run->rPr->rFont["val"])) {
|
||||
$objText->getFont()->setName((string) $run->rPr->rFont["val"]);
|
||||
|
|
|
@ -1343,7 +1343,7 @@ class Excel5 extends BaseReader implements IReader
|
|||
case 0x1E: // null-terminated string prepended by dword string length
|
||||
$byteLength = self::getInt4d($this->summaryInformation, $secOffset + 4 + $offset);
|
||||
$value = substr($this->summaryInformation, $secOffset + 8 + $offset, $byteLength);
|
||||
$value = \PHPExcel\Shared\StringHelper::ConvertEncoding($value, 'UTF-8', $codePage);
|
||||
$value = \PHPExcel\Shared\StringHelper::convertEncoding($value, 'UTF-8', $codePage);
|
||||
$value = rtrim($value);
|
||||
break;
|
||||
case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
|
@ -1489,7 +1489,7 @@ class Excel5 extends BaseReader implements IReader
|
|||
case 0x1E: // null-terminated string prepended by dword string length
|
||||
$byteLength = self::getInt4d($this->documentSummaryInformation, $secOffset + 4 + $offset);
|
||||
$value = substr($this->documentSummaryInformation, $secOffset + 8 + $offset, $byteLength);
|
||||
$value = \PHPExcel\Shared\StringHelper::ConvertEncoding($value, 'UTF-8', $codePage);
|
||||
$value = \PHPExcel\Shared\StringHelper::convertEncoding($value, 'UTF-8', $codePage);
|
||||
$value = rtrim($value);
|
||||
break;
|
||||
case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
|
@ -3688,13 +3688,13 @@ class Excel5 extends BaseReader implements IReader
|
|||
$sstCount = count($this->sst[$index]['fmtRuns']);
|
||||
for ($i = 0; $i <= $sstCount; ++$i) {
|
||||
if (isset($fmtRuns[$i])) {
|
||||
$text = \PHPExcel\Shared\StringHelper::Substring($this->sst[$index]['value'], $charPos, $fmtRuns[$i]['charPos'] - $charPos);
|
||||
$text = \PHPExcel\Shared\StringHelper::substring($this->sst[$index]['value'], $charPos, $fmtRuns[$i]['charPos'] - $charPos);
|
||||
$charPos = $fmtRuns[$i]['charPos'];
|
||||
} else {
|
||||
$text = \PHPExcel\Shared\StringHelper::Substring($this->sst[$index]['value'], $charPos, \PHPExcel\Shared\StringHelper::CountCharacters($this->sst[$index]['value']));
|
||||
$text = \PHPExcel\Shared\StringHelper::substring($this->sst[$index]['value'], $charPos, \PHPExcel\Shared\StringHelper::countCharacters($this->sst[$index]['value']));
|
||||
}
|
||||
|
||||
if (\PHPExcel\Shared\StringHelper::CountCharacters($text) > 0) {
|
||||
if (\PHPExcel\Shared\StringHelper::countCharacters($text) > 0) {
|
||||
if ($i == 0) { // first text run, no style
|
||||
$richText->createText($text);
|
||||
} else {
|
||||
|
@ -7502,7 +7502,7 @@ class Excel5 extends BaseReader implements IReader
|
|||
$string = self::uncompressByteString($string);
|
||||
}
|
||||
|
||||
return \PHPExcel\Shared\StringHelper::ConvertEncoding($string, 'UTF-8', 'UTF-16LE');
|
||||
return \PHPExcel\Shared\StringHelper::convertEncoding($string, 'UTF-8', 'UTF-16LE');
|
||||
}
|
||||
|
||||
|
||||
|
@ -7532,7 +7532,7 @@ class Excel5 extends BaseReader implements IReader
|
|||
*/
|
||||
private function decodeCodepage($string)
|
||||
{
|
||||
return \PHPExcel\Shared\StringHelper::ConvertEncoding($string, 'UTF-8', $this->codepage);
|
||||
return \PHPExcel\Shared\StringHelper::convertEncoding($string, 'UTF-8', $this->codepage);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -340,27 +340,27 @@ class Font
|
|||
switch ($fontName) {
|
||||
case 'Calibri':
|
||||
// value 8.26 was found via interpolation by inspecting real Excel files with Calibri 11 font.
|
||||
$columnWidth = (int) (8.26 * String::CountCharacters($columnText));
|
||||
$columnWidth = (int) (8.26 * String::countCharacters($columnText));
|
||||
$columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size
|
||||
break;
|
||||
|
||||
case 'Arial':
|
||||
// value 7 was found via interpolation by inspecting real Excel files with Arial 10 font.
|
||||
// $columnWidth = (int) (7 * String::CountCharacters($columnText));
|
||||
// $columnWidth = (int) (7 * String::countCharacters($columnText));
|
||||
// value 8 was set because of experience in different exports at Arial 10 font.
|
||||
$columnWidth = (int) (8 * String::CountCharacters($columnText));
|
||||
$columnWidth = (int) (8 * String::countCharacters($columnText));
|
||||
$columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size
|
||||
break;
|
||||
|
||||
case 'Verdana':
|
||||
// value 8 was found via interpolation by inspecting real Excel files with Verdana 10 font.
|
||||
$columnWidth = (int) (8 * String::CountCharacters($columnText));
|
||||
$columnWidth = (int) (8 * String::countCharacters($columnText));
|
||||
$columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size
|
||||
break;
|
||||
|
||||
default:
|
||||
// just assume Calibri
|
||||
$columnWidth = (int) (8.26 * String::CountCharacters($columnText));
|
||||
$columnWidth = (int) (8.26 * String::countCharacters($columnText));
|
||||
$columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -345,7 +345,7 @@ class StringHelper
|
|||
* @param string $value Value to unescape
|
||||
* @return string
|
||||
*/
|
||||
public static function ControlCharacterOOXML2PHP($value = '')
|
||||
public static function controlCharacterOOXML2PHP($value = '')
|
||||
{
|
||||
return str_replace(array_keys(self::$controlCharacters), array_values(self::$controlCharacters), $value);
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ class StringHelper
|
|||
* @param string $value Value to escape
|
||||
* @return string
|
||||
*/
|
||||
public static function ControlCharacterPHP2OOXML($value = '')
|
||||
public static function controlCharacterPHP2OOXML($value = '')
|
||||
{
|
||||
return str_replace(array_values(self::$controlCharacters), array_keys(self::$controlCharacters), $value);
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ class StringHelper
|
|||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function SanitizeUTF8($value)
|
||||
public static function sanitizeUTF8($value)
|
||||
{
|
||||
if (self::getIsIconvEnabled()) {
|
||||
$value = @iconv('UTF-8', 'UTF-8', $value);
|
||||
|
@ -397,7 +397,7 @@ class StringHelper
|
|||
* @param string $value
|
||||
* @return boolean
|
||||
*/
|
||||
public static function IsUTF8($value = '')
|
||||
public static function isUTF8($value = '')
|
||||
{
|
||||
return $value === '' || preg_match('/^./su', $value) === 1;
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ class StringHelper
|
|||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
public static function FormatNumber($value)
|
||||
public static function formatNumber($value)
|
||||
{
|
||||
if (is_float($value)) {
|
||||
return str_replace(',', '.', $value);
|
||||
|
@ -431,19 +431,19 @@ class StringHelper
|
|||
public static function UTF8toBIFF8UnicodeShort($value, $arrcRuns = array())
|
||||
{
|
||||
// character count
|
||||
$ln = self::CountCharacters($value, 'UTF-8');
|
||||
$ln = self::countCharacters($value, 'UTF-8');
|
||||
// option flags
|
||||
if (empty($arrcRuns)) {
|
||||
$opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ?
|
||||
0x0001 : 0x0000;
|
||||
$data = pack('CC', $ln, $opt);
|
||||
// characters
|
||||
$data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
|
||||
$data .= self::convertEncoding($value, 'UTF-16LE', 'UTF-8');
|
||||
} else {
|
||||
$data = pack('vC', $ln, 0x09);
|
||||
$data .= pack('v', count($arrcRuns));
|
||||
// characters
|
||||
$data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
|
||||
$data .= self::convertEncoding($value, 'UTF-16LE', 'UTF-8');
|
||||
foreach ($arrcRuns as $cRun) {
|
||||
$data .= pack('v', $cRun['strlen']);
|
||||
$data .= pack('v', $cRun['fontidx']);
|
||||
|
@ -465,14 +465,14 @@ class StringHelper
|
|||
public static function UTF8toBIFF8UnicodeLong($value)
|
||||
{
|
||||
// character count
|
||||
$ln = self::CountCharacters($value, 'UTF-8');
|
||||
$ln = self::countCharacters($value, 'UTF-8');
|
||||
|
||||
// option flags
|
||||
$opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ?
|
||||
0x0001 : 0x0000;
|
||||
|
||||
// characters
|
||||
$chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
|
||||
$chars = self::convertEncoding($value, 'UTF-16LE', 'UTF-8');
|
||||
|
||||
$data = pack('vC', $ln, $opt) . $chars;
|
||||
return $data;
|
||||
|
@ -486,7 +486,7 @@ class StringHelper
|
|||
* @param string $from Encoding to convert from, e.g. 'UTF-16LE'
|
||||
* @return string
|
||||
*/
|
||||
public static function ConvertEncoding($value, $to, $from)
|
||||
public static function convertEncoding($value, $to, $from)
|
||||
{
|
||||
if (self::getIsIconvEnabled()) {
|
||||
return iconv($from, $to, $value);
|
||||
|
@ -497,9 +497,9 @@ class StringHelper
|
|||
}
|
||||
|
||||
if ($from == 'UTF-16LE') {
|
||||
return self::utf16_decode($value, false);
|
||||
return self::utf16Decode($value, false);
|
||||
} elseif ($from == 'UTF-16BE') {
|
||||
return self::utf16_decode($value);
|
||||
return self::utf16Decode($value);
|
||||
}
|
||||
// else, no conversion
|
||||
return $value;
|
||||
|
@ -520,7 +520,7 @@ class StringHelper
|
|||
* @author Rasmus Andersson {@link http://rasmusandersson.se/}
|
||||
* @author vadik56
|
||||
*/
|
||||
public static function utf16_decode($str, $bom_be = true)
|
||||
public static function utf16Decode($str, $bom_be = true)
|
||||
{
|
||||
if (strlen($str) < 2) {
|
||||
return $str;
|
||||
|
@ -555,7 +555,7 @@ class StringHelper
|
|||
* @param string $enc Encoding
|
||||
* @return int Character count
|
||||
*/
|
||||
public static function CountCharacters($value, $enc = 'UTF-8')
|
||||
public static function countCharacters($value, $enc = 'UTF-8')
|
||||
{
|
||||
if (self::getIsMbstringEnabled()) {
|
||||
return mb_strlen($value, $enc);
|
||||
|
@ -577,7 +577,7 @@ class StringHelper
|
|||
* @param int $pLength Maximum number of characters in substring
|
||||
* @return string
|
||||
*/
|
||||
public static function Substring($pValue = '', $pStart = 0, $pLength = 0)
|
||||
public static function substring($pValue = '', $pStart = 0, $pLength = 0)
|
||||
{
|
||||
if (self::getIsMbstringEnabled()) {
|
||||
return mb_substr($pValue, $pStart, $pLength, 'UTF-8');
|
||||
|
@ -597,7 +597,7 @@ class StringHelper
|
|||
* @param string $pValue UTF-8 encoded string
|
||||
* @return string
|
||||
*/
|
||||
public static function StrToUpper($pValue = '')
|
||||
public static function strToUpper($pValue = '')
|
||||
{
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($pValue, MB_CASE_UPPER, "UTF-8");
|
||||
|
@ -611,7 +611,7 @@ class StringHelper
|
|||
* @param string $pValue UTF-8 encoded string
|
||||
* @return string
|
||||
*/
|
||||
public static function StrToLower($pValue = '')
|
||||
public static function strToLower($pValue = '')
|
||||
{
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($pValue, MB_CASE_LOWER, "UTF-8");
|
||||
|
@ -626,7 +626,7 @@ class StringHelper
|
|||
* @param string $pValue UTF-8 encoded string
|
||||
* @return string
|
||||
*/
|
||||
public static function StrToTitle($pValue = '')
|
||||
public static function strToTitle($pValue = '')
|
||||
{
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($pValue, MB_CASE_TITLE, "UTF-8");
|
||||
|
@ -634,12 +634,12 @@ class StringHelper
|
|||
return ucwords($pValue);
|
||||
}
|
||||
|
||||
public static function mb_is_upper($char)
|
||||
public static function mbIsUpper($char)
|
||||
{
|
||||
return mb_strtolower($char, "UTF-8") != $char;
|
||||
}
|
||||
|
||||
public static function mb_str_split($string)
|
||||
public static function mbStrSplit($string)
|
||||
{
|
||||
# Split at all position not after the start: ^
|
||||
# and not before the end: $
|
||||
|
@ -653,12 +653,12 @@ class StringHelper
|
|||
* @param string $pValue UTF-8 encoded string
|
||||
* @return string
|
||||
*/
|
||||
public static function StrCaseReverse($pValue = '')
|
||||
public static function strCaseReverse($pValue = '')
|
||||
{
|
||||
if (self::getIsMbstringEnabled()) {
|
||||
$characters = self::mb_str_split($pValue);
|
||||
$characters = self::mbStrSplit($pValue);
|
||||
foreach ($characters as &$character) {
|
||||
if (self::mb_is_upper($character)) {
|
||||
if (self::mbIsUpper($character)) {
|
||||
$character = mb_strtolower($character, 'UTF-8');
|
||||
} else {
|
||||
$character = mb_strtoupper($character, 'UTF-8');
|
||||
|
|
|
@ -420,14 +420,14 @@ class Worksheet implements IComparable
|
|||
*/
|
||||
private static function checkSheetCodeName($pValue)
|
||||
{
|
||||
$CharCount = Shared\String::CountCharacters($pValue);
|
||||
$CharCount = Shared\StringHelper::countCharacters($pValue);
|
||||
if ($CharCount == 0) {
|
||||
throw new Exception('Sheet code name cannot be empty.');
|
||||
}
|
||||
// Some of the printable ASCII characters are invalid: * : / \ ? [ ] and first and last characters cannot be a "'"
|
||||
if ((str_replace(self::$invalidCharacters, '', $pValue) !== $pValue) ||
|
||||
(Shared\String::Substring($pValue, -1, 1)=='\'') ||
|
||||
(Shared\String::Substring($pValue, 0, 1)=='\'')) {
|
||||
(Shared\StringHelper::substring($pValue, -1, 1)=='\'') ||
|
||||
(Shared\StringHelper::substring($pValue, 0, 1)=='\'')) {
|
||||
throw new Exception('Invalid character found in sheet code name');
|
||||
}
|
||||
|
||||
|
@ -454,7 +454,7 @@ class Worksheet implements IComparable
|
|||
}
|
||||
|
||||
// Maximum 31 characters allowed for sheet title
|
||||
if (Shared\String::CountCharacters($pValue) > 31) {
|
||||
if (Shared\StringHelper::countCharacters($pValue) > 31) {
|
||||
throw new Exception('Maximum 31 characters allowed in sheet title.');
|
||||
}
|
||||
|
||||
|
@ -837,19 +837,19 @@ class Worksheet implements IComparable
|
|||
if ($this->parent->sheetNameExists($pValue)) {
|
||||
// Use name, but append with lowest possible integer
|
||||
|
||||
if (Shared\String::CountCharacters($pValue) > 29) {
|
||||
$pValue = Shared\String::Substring($pValue, 0, 29);
|
||||
if (Shared\StringHelper::countCharacters($pValue) > 29) {
|
||||
$pValue = Shared\StringHelper::substring($pValue, 0, 29);
|
||||
}
|
||||
$i = 1;
|
||||
while ($this->parent->sheetNameExists($pValue . ' ' . $i)) {
|
||||
++$i;
|
||||
if ($i == 10) {
|
||||
if (Shared\String::CountCharacters($pValue) > 28) {
|
||||
$pValue = Shared\String::Substring($pValue, 0, 28);
|
||||
if (Shared\StringHelper::countCharacters($pValue) > 28) {
|
||||
$pValue = Shared\StringHelper::substring($pValue, 0, 28);
|
||||
}
|
||||
} elseif ($i == 100) {
|
||||
if (Shared\String::CountCharacters($pValue) > 27) {
|
||||
$pValue = Shared\String::Substring($pValue, 0, 27);
|
||||
if (Shared\StringHelper::countCharacters($pValue) > 27) {
|
||||
$pValue = Shared\StringHelper::substring($pValue, 0, 27);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2924,19 +2924,19 @@ class Worksheet implements IComparable
|
|||
if ($this->getParent()->sheetCodeNameExists($pValue)) {
|
||||
// Use name, but append with lowest possible integer
|
||||
|
||||
if (Shared\String::CountCharacters($pValue) > 29) {
|
||||
$pValue = Shared\String::Substring($pValue, 0, 29);
|
||||
if (Shared\StringHelper::countCharacters($pValue) > 29) {
|
||||
$pValue = Shared\StringHelper::substring($pValue, 0, 29);
|
||||
}
|
||||
$i = 1;
|
||||
while ($this->getParent()->sheetCodeNameExists($pValue . '_' . $i)) {
|
||||
++$i;
|
||||
if ($i == 10) {
|
||||
if (Shared\String::CountCharacters($pValue) > 28) {
|
||||
$pValue = Shared\String::Substring($pValue, 0, 28);
|
||||
if (Shared\StringHelper::countCharacters($pValue) > 28) {
|
||||
$pValue = Shared\StringHelper::substring($pValue, 0, 28);
|
||||
}
|
||||
} elseif ($i == 100) {
|
||||
if (Shared\String::CountCharacters($pValue) > 27) {
|
||||
$pValue = Shared\String::Substring($pValue, 0, 27);
|
||||
if (Shared\StringHelper::countCharacters($pValue) > 27) {
|
||||
$pValue = Shared\StringHelper::substring($pValue, 0, 27);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -460,7 +460,7 @@ class Chart extends WriterPart
|
|||
}
|
||||
$objWriter->startElement('a:t');
|
||||
// $objWriter->writeAttribute('xml:space', 'preserve');
|
||||
$objWriter->writeRawData(\PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($caption));
|
||||
$objWriter->writeRawData(\PHPExcel\Shared\StringHelper::controlCharacterPHP2OOXML($caption));
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
@ -810,7 +810,7 @@ class Chart extends WriterPart
|
|||
|
||||
$objWriter->startElement('a:t');
|
||||
// $objWriter->writeAttribute('xml:space', 'preserve');
|
||||
$objWriter->writeRawData(\PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($caption));
|
||||
$objWriter->writeRawData(\PHPExcel\Shared\StringHelper::controlCharacterPHP2OOXML($caption));
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
|
|
@ -109,7 +109,7 @@ class StringTable extends WriterPart
|
|||
$objWriter->startElement('si');
|
||||
|
||||
if (! $textElement instanceof \PHPExcel\RichText) {
|
||||
$textToWrite = \PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($textElement);
|
||||
$textToWrite = \PHPExcel\Shared\StringHelper::controlCharacterPHP2OOXML($textElement);
|
||||
$objWriter->startElement('t');
|
||||
if ($textToWrite !== trim($textToWrite)) {
|
||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||
|
@ -208,7 +208,7 @@ class StringTable extends WriterPart
|
|||
// t
|
||||
$objWriter->startElement($prefix.'t');
|
||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||
$objWriter->writeRawData(\PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($element->getText()));
|
||||
$objWriter->writeRawData(\PHPExcel\Shared\StringHelper::controlCharacterPHP2OOXML($element->getText()));
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
@ -283,7 +283,7 @@ class StringTable extends WriterPart
|
|||
// t
|
||||
$objWriter->startElement($prefix.'t');
|
||||
// $objWriter->writeAttribute('xml:space', 'preserve'); // Excel2010 accepts, Excel2007 complains
|
||||
$objWriter->writeRawData(\PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($element->getText()));
|
||||
$objWriter->writeRawData(\PHPExcel\Shared\StringHelper::controlCharacterPHP2OOXML($element->getText()));
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
|
|
@ -327,7 +327,7 @@ class Worksheet extends WriterPart
|
|||
// Default row height
|
||||
if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) {
|
||||
$objWriter->writeAttribute('customHeight', 'true');
|
||||
$objWriter->writeAttribute('defaultRowHeight', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight()));
|
||||
$objWriter->writeAttribute('defaultRowHeight', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getDefaultRowDimension()->getRowHeight()));
|
||||
} else {
|
||||
$objWriter->writeAttribute('defaultRowHeight', '14.4');
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ class Worksheet extends WriterPart
|
|||
|
||||
// Default column width
|
||||
if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) {
|
||||
$objWriter->writeAttribute('defaultColWidth', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth()));
|
||||
$objWriter->writeAttribute('defaultColWidth', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getDefaultColumnDimension()->getWidth()));
|
||||
}
|
||||
|
||||
// Outline level - row
|
||||
|
@ -391,7 +391,7 @@ class Worksheet extends WriterPart
|
|||
$objWriter->writeAttribute('width', '9.10');
|
||||
} else {
|
||||
// Width set
|
||||
$objWriter->writeAttribute('width', \PHPExcel\Shared\StringHelper::FormatNumber($colDimension->getWidth()));
|
||||
$objWriter->writeAttribute('width', \PHPExcel\Shared\StringHelper::formatNumber($colDimension->getWidth()));
|
||||
}
|
||||
|
||||
// Column visibility
|
||||
|
@ -735,12 +735,12 @@ class Worksheet extends WriterPart
|
|||
{
|
||||
// pageMargins
|
||||
$objWriter->startElement('pageMargins');
|
||||
$objWriter->writeAttribute('left', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getLeft()));
|
||||
$objWriter->writeAttribute('right', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getRight()));
|
||||
$objWriter->writeAttribute('top', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getTop()));
|
||||
$objWriter->writeAttribute('bottom', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getBottom()));
|
||||
$objWriter->writeAttribute('header', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getHeader()));
|
||||
$objWriter->writeAttribute('footer', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getFooter()));
|
||||
$objWriter->writeAttribute('left', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getPageMargins()->getLeft()));
|
||||
$objWriter->writeAttribute('right', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getPageMargins()->getRight()));
|
||||
$objWriter->writeAttribute('top', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getPageMargins()->getTop()));
|
||||
$objWriter->writeAttribute('bottom', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getPageMargins()->getBottom()));
|
||||
$objWriter->writeAttribute('header', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getPageMargins()->getHeader()));
|
||||
$objWriter->writeAttribute('footer', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getPageMargins()->getFooter()));
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
|
@ -1001,7 +1001,7 @@ class Worksheet extends WriterPart
|
|||
// Row dimensions
|
||||
if ($rowDimension->getRowHeight() >= 0) {
|
||||
$objWriter->writeAttribute('customHeight', '1');
|
||||
$objWriter->writeAttribute('ht', \PHPExcel\Shared\StringHelper::FormatNumber($rowDimension->getRowHeight()));
|
||||
$objWriter->writeAttribute('ht', \PHPExcel\Shared\StringHelper::formatNumber($rowDimension->getRowHeight()));
|
||||
}
|
||||
|
||||
// Row visibility
|
||||
|
@ -1096,7 +1096,7 @@ class Worksheet extends WriterPart
|
|||
switch (strtolower($mappedType)) {
|
||||
case 'inlinestr': // Inline string
|
||||
if (! $cellValue instanceof \PHPExcel\RichText) {
|
||||
$objWriter->writeElement('t', \PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML(htmlspecialchars($cellValue)));
|
||||
$objWriter->writeElement('t', \PHPExcel\Shared\StringHelper::controlCharacterPHP2OOXML(htmlspecialchars($cellValue)));
|
||||
} elseif ($cellValue instanceof \PHPExcel\RichText) {
|
||||
$objWriter->startElement('is');
|
||||
$this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue);
|
||||
|
@ -1131,7 +1131,7 @@ class Worksheet extends WriterPart
|
|||
if ($this->getParentWriter()->getPreCalculateFormulas()) {
|
||||
// $calculatedValue = $pCell->getCalculatedValue();
|
||||
if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') {
|
||||
$objWriter->writeElement('v', \PHPExcel\Shared\StringHelper::FormatNumber($calculatedValue));
|
||||
$objWriter->writeElement('v', \PHPExcel\Shared\StringHelper::formatNumber($calculatedValue));
|
||||
} else {
|
||||
$objWriter->writeElement('v', '0');
|
||||
}
|
||||
|
|
|
@ -804,7 +804,7 @@ class Workbook extends BIFFwriter
|
|||
$options = $isBuiltIn ? 0x20 : 0x00;
|
||||
|
||||
// length of the name, character count
|
||||
$nlen = \PHPExcel\Shared\StringHelper::CountCharacters($name);
|
||||
$nlen = \PHPExcel\Shared\StringHelper::countCharacters($name);
|
||||
|
||||
// name with stripped length field
|
||||
$name = substr(\PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($name), 2);
|
||||
|
|
|
@ -403,7 +403,7 @@ class Worksheet extends BIFFwriter
|
|||
if ($cVal instanceof \PHPExcel\RichText) {
|
||||
// $this->writeString($row, $column, $cVal->getPlainText(), $xfIndex);
|
||||
$arrcRun = array();
|
||||
$str_len = \PHPExcel\Shared\StringHelper::CountCharacters($cVal->getPlainText(), 'UTF-8');
|
||||
$str_len = \PHPExcel\Shared\StringHelper::countCharacters($cVal->getPlainText(), 'UTF-8');
|
||||
$str_pos = 0;
|
||||
$elements = $cVal->getRichTextElements();
|
||||
foreach ($elements as $element) {
|
||||
|
@ -415,7 +415,7 @@ class Worksheet extends BIFFwriter
|
|||
}
|
||||
$arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx);
|
||||
// Position FROM
|
||||
$str_pos += \PHPExcel\Shared\StringHelper::CountCharacters($element->getText(), 'UTF-8');
|
||||
$str_pos += \PHPExcel\Shared\StringHelper::countCharacters($element->getText(), 'UTF-8');
|
||||
}
|
||||
$this->writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun);
|
||||
} else {
|
||||
|
@ -1054,10 +1054,10 @@ class Worksheet extends BIFFwriter
|
|||
$url .= "\0";
|
||||
|
||||
// character count
|
||||
$url_len = \PHPExcel\Shared\StringHelper::CountCharacters($url);
|
||||
$url_len = \PHPExcel\Shared\StringHelper::countCharacters($url);
|
||||
$url_len = pack('V', $url_len);
|
||||
|
||||
$url = \PHPExcel\Shared\StringHelper::ConvertEncoding($url, 'UTF-16LE', 'UTF-8');
|
||||
$url = \PHPExcel\Shared\StringHelper::convertEncoding($url, 'UTF-16LE', 'UTF-8');
|
||||
|
||||
// Calculate the data length
|
||||
$length = 0x24 + strlen($url);
|
||||
|
|
|
@ -1597,16 +1597,16 @@ class HTML extends BaseWriter implements IWriter
|
|||
$htmlPage = '@page { ';
|
||||
$htmlBody = 'body { ';
|
||||
|
||||
$left = String::FormatNumber($pSheet->getPageMargins()->getLeft()) . 'in; ';
|
||||
$left = StringHelper::formatNumber($pSheet->getPageMargins()->getLeft()) . 'in; ';
|
||||
$htmlPage .= 'margin-left: ' . $left;
|
||||
$htmlBody .= 'margin-left: ' . $left;
|
||||
$right = String::FormatNumber($pSheet->getPageMargins()->getRight()) . 'in; ';
|
||||
$right = StringHelper::formatNumber($pSheet->getPageMargins()->getRight()) . 'in; ';
|
||||
$htmlPage .= 'margin-right: ' . $right;
|
||||
$htmlBody .= 'margin-right: ' . $right;
|
||||
$top = String::FormatNumber($pSheet->getPageMargins()->getTop()) . 'in; ';
|
||||
$top = StringHelper::formatNumber($pSheet->getPageMargins()->getTop()) . 'in; ';
|
||||
$htmlPage .= 'margin-top: ' . $top;
|
||||
$htmlBody .= 'margin-top: ' . $top;
|
||||
$bottom = String::FormatNumber($pSheet->getPageMargins()->getBottom()) . 'in; ';
|
||||
$bottom = StringHelper::formatNumber($pSheet->getPageMargins()->getBottom()) . 'in; ';
|
||||
$htmlPage .= 'margin-bottom: ' . $bottom;
|
||||
$htmlBody .= 'margin-bottom: ' . $bottom;
|
||||
|
||||
|
|
Loading…
Reference in New Issue