PSR2 Fixes
This commit is contained in:
parent
9140e3da2e
commit
6b1764f771
|
@ -209,7 +209,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
|
|
||||||
$xml = new XMLReader();
|
$xml = new XMLReader();
|
||||||
$res = $xml->xml($this->securityScanFile('zip://'.PHPExcel_Shared_File::realpath($pFilename).'#'."$dir/$fileWorksheet"), null, PHPExcel_Settings::getLibXmlLoaderOptions());
|
$res = $xml->xml($this->securityScanFile('zip://'.PHPExcel_Shared_File::realpath($pFilename).'#'."$dir/$fileWorksheet"), null, PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||||
$xml->setParserProperty(2,true);
|
$xml->setParserProperty(2, true);
|
||||||
|
|
||||||
$currCells = 0;
|
$currCells = 0;
|
||||||
while ($xml->read()) {
|
while ($xml->read()) {
|
||||||
|
@ -265,7 +265,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
return isset($c->v) ? (string) $c->v : null;
|
return isset($c->v) ? (string) $c->v : null;
|
||||||
} // function _castToString()
|
} // function _castToString()
|
||||||
|
|
||||||
private function _castToFormula($c, $r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas, $castBaseType)
|
private function _castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType)
|
||||||
{
|
{
|
||||||
// echo 'Formula', PHP_EOL;
|
// echo 'Formula', PHP_EOL;
|
||||||
// echo '$c->f is ', $c->f, PHP_EOL;
|
// echo '$c->f is ', $c->f, PHP_EOL;
|
||||||
|
@ -639,7 +639,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
// references in formula cells... during the load, all formulae should be correct,
|
// references in formula cells... during the load, all formulae should be correct,
|
||||||
// and we're simply bringing the worksheet name in line with the formula, not the
|
// and we're simply bringing the worksheet name in line with the formula, not the
|
||||||
// reverse
|
// reverse
|
||||||
$docSheet->setTitle((string) $eleSheet["name"],false);
|
$docSheet->setTitle((string) $eleSheet["name"], false);
|
||||||
$fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
$fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
||||||
$xmlSheet = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
$xmlSheet = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||||
|
|
||||||
|
@ -886,9 +886,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
|
|
||||||
// Check for numeric values
|
// Check for numeric values
|
||||||
if (is_numeric($value) && $cellDataType != 's') {
|
if (is_numeric($value) && $cellDataType != 's') {
|
||||||
if ($value == (int)$value) $value = (int)$value;
|
if ($value == (int)$value) {
|
||||||
elseif ($value == (float)$value) $value = (float)$value;
|
$value = (int)$value;
|
||||||
elseif ($value == (double)$value) $value = (double)$value;
|
} elseif ($value == (float)$value) {
|
||||||
|
$value = (float)$value;
|
||||||
|
} elseif ($value == (double)$value) {
|
||||||
|
$value = (double)$value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rich text?
|
// Rich text?
|
||||||
|
@ -921,14 +925,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) {
|
if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) {
|
||||||
foreach ($xmlSheet->conditionalFormatting as $conditional) {
|
foreach ($xmlSheet->conditionalFormatting as $conditional) {
|
||||||
foreach ($conditional->cfRule as $cfRule) {
|
foreach ($conditional->cfRule as $cfRule) {
|
||||||
if (
|
if (((string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) && isset($dxfs[intval($cfRule["dxfId"])])) {
|
||||||
(
|
|
||||||
(string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE ||
|
|
||||||
(string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS ||
|
|
||||||
(string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT ||
|
|
||||||
(string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_EXPRESSION
|
|
||||||
) && isset($dxfs[intval($cfRule["dxfId"])])
|
|
||||||
) {
|
|
||||||
$conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])] = $cfRule;
|
$conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])] = $cfRule;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -996,7 +993,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
$filters = $filterColumn->filters;
|
$filters = $filterColumn->filters;
|
||||||
if ((isset($filters["blank"])) && ($filters["blank"] == 1)) {
|
if ((isset($filters["blank"])) && ($filters["blank"] == 1)) {
|
||||||
$column->createRule()->setRule(
|
$column->createRule()->setRule(
|
||||||
null, // Operator is undefined, but always treated as EQUAL
|
null,// Operator is undefined, but always treated as EQUAL
|
||||||
''
|
''
|
||||||
)
|
)
|
||||||
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
|
||||||
|
@ -1005,7 +1002,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
// Entries can be either filter elements
|
// Entries can be either filter elements
|
||||||
foreach ($filters->filter as $filterRule) {
|
foreach ($filters->filter as $filterRule) {
|
||||||
$column->createRule()->setRule(
|
$column->createRule()->setRule(
|
||||||
null, // Operator is undefined, but always treated as EQUAL
|
null,// Operator is undefined, but always treated as EQUAL
|
||||||
(string) $filterRule["val"]
|
(string) $filterRule["val"]
|
||||||
)
|
)
|
||||||
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
|
||||||
|
@ -1013,7 +1010,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
// Or Date Group elements
|
// Or Date Group elements
|
||||||
foreach ($filters->dateGroupItem as $dateGroupItem) {
|
foreach ($filters->dateGroupItem as $dateGroupItem) {
|
||||||
$column->createRule()->setRule(
|
$column->createRule()->setRule(
|
||||||
null, // Operator is undefined, but always treated as EQUAL
|
null,// Operator is undefined, but always treated as EQUAL
|
||||||
array(
|
array(
|
||||||
'year' => (string) $dateGroupItem["year"],
|
'year' => (string) $dateGroupItem["year"],
|
||||||
'month' => (string) $dateGroupItem["month"],
|
'month' => (string) $dateGroupItem["month"],
|
||||||
|
@ -1050,16 +1047,16 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
// We should only ever have one dynamic filter
|
// We should only ever have one dynamic filter
|
||||||
foreach ($filterColumn->dynamicFilter as $filterRule) {
|
foreach ($filterColumn->dynamicFilter as $filterRule) {
|
||||||
$column->createRule()->setRule(
|
$column->createRule()->setRule(
|
||||||
null, // Operator is undefined, but always treated as EQUAL
|
null,// Operator is undefined, but always treated as EQUAL
|
||||||
(string) $filterRule["val"],
|
(string) $filterRule["val"],
|
||||||
(string) $filterRule["type"]
|
(string) $filterRule["type"]
|
||||||
)
|
)
|
||||||
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
|
||||||
if (isset($filterRule["val"])) {
|
if (isset($filterRule["val"])) {
|
||||||
$column->setAttribute('val',(string) $filterRule["val"]);
|
$column->setAttribute('val', (string) $filterRule["val"]);
|
||||||
}
|
}
|
||||||
if (isset($filterRule["maxVal"])) {
|
if (isset($filterRule["maxVal"])) {
|
||||||
$column->setAttribute('maxVal',(string) $filterRule["maxVal"]);
|
$column->setAttribute('maxVal', (string) $filterRule["maxVal"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1284,8 +1281,9 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
|
|
||||||
// Loop through contents
|
// Loop through contents
|
||||||
foreach ($commentsFile->commentList->comment as $comment) {
|
foreach ($commentsFile->commentList->comment as $comment) {
|
||||||
if (!empty($comment['authorId']))
|
if (!empty($comment['authorId'])) {
|
||||||
$docSheet->getComment((string)$comment['ref'])->setAuthor($authors[(string)$comment['authorId']]);
|
$docSheet->getComment((string)$comment['ref'])->setAuthor($authors[(string)$comment['authorId']]);
|
||||||
|
}
|
||||||
$docSheet->getComment((string)$comment['ref'])->setText($this->_parseRichText($comment->text));
|
$docSheet->getComment((string)$comment['ref'])->setText($this->_parseRichText($comment->text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1551,7 +1549,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
$extractedRange = (string)$definedName;
|
$extractedRange = (string)$definedName;
|
||||||
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
||||||
if (($spos = strpos($extractedRange, '!')) !== false) {
|
if (($spos = strpos($extractedRange, '!')) !== false) {
|
||||||
$extractedRange = substr($extractedRange,0, $spos).str_replace('$', '', substr($extractedRange, $spos));
|
$extractedRange = substr($extractedRange, 0, $spos).str_replace('$', '', substr($extractedRange, $spos));
|
||||||
} else {
|
} else {
|
||||||
$extractedRange = str_replace('$', '', $extractedRange);
|
$extractedRange = str_replace('$', '', $extractedRange);
|
||||||
}
|
}
|
||||||
|
@ -1588,9 +1586,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
// check for repeating columns, e g. 'A:A' or 'A:D'
|
// check for repeating columns, e g. 'A:A' or 'A:D'
|
||||||
if (preg_match('/!?([A-Z]+)\:([A-Z]+)$/', $range, $matches)) {
|
if (preg_match('/!?([A-Z]+)\:([A-Z]+)$/', $range, $matches)) {
|
||||||
$docSheet->getPageSetup()->setColumnsToRepeatAtLeft(array($matches[1], $matches[2]));
|
$docSheet->getPageSetup()->setColumnsToRepeatAtLeft(array($matches[1], $matches[2]));
|
||||||
}
|
} elseif (preg_match('/!?(\d+)\:(\d+)$/', $range, $matches)) {
|
||||||
// check for repeating rows, e.g. '1:1' or '1:5'
|
// check for repeating rows, e.g. '1:1' or '1:5'
|
||||||
elseif (preg_match('/!?(\d+)\:(\d+)$/', $range, $matches)) {
|
|
||||||
$docSheet->getPageSetup()->setRowsToRepeatAtTop(array($matches[1], $matches[2]));
|
$docSheet->getPageSetup()->setRowsToRepeatAtTop(array($matches[1], $matches[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1627,7 +1624,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
$extractedRange = (string)$definedName;
|
$extractedRange = (string)$definedName;
|
||||||
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
||||||
if (($spos = strpos($extractedRange, '!')) !== false) {
|
if (($spos = strpos($extractedRange, '!')) !== false) {
|
||||||
$extractedRange = substr($extractedRange,0, $spos).str_replace('$', '', substr($extractedRange, $spos));
|
$extractedRange = substr($extractedRange, 0, $spos).str_replace('$', '', substr($extractedRange, $spos));
|
||||||
} else {
|
} else {
|
||||||
$extractedRange = str_replace('$', '', $extractedRange);
|
$extractedRange = str_replace('$', '', $extractedRange);
|
||||||
}
|
}
|
||||||
|
@ -1712,7 +1709,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
if ($this->_includeCharts) {
|
if ($this->_includeCharts) {
|
||||||
$chartEntryRef = ltrim($contentType['PartName'], '/');
|
$chartEntryRef = ltrim($contentType['PartName'], '/');
|
||||||
$chartElements = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $chartEntryRef)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
$chartElements = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $chartEntryRef)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||||
$objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements,basename($chartEntryRef, '.xml'));
|
$objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements, basename($chartEntryRef, '.xml'));
|
||||||
|
|
||||||
// echo 'Chart ', $chartEntryRef, '<br />';
|
// echo 'Chart ', $chartEntryRef, '<br />';
|
||||||
// var_dump($charts[$chartEntryRef]);
|
// var_dump($charts[$chartEntryRef]);
|
||||||
|
@ -1820,12 +1817,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
$patternType = (string)$style->fill->patternFill["patternType"] != '' ? (string)$style->fill->patternFill["patternType"] : 'solid';
|
$patternType = (string)$style->fill->patternFill["patternType"] != '' ? (string)$style->fill->patternFill["patternType"] : 'solid';
|
||||||
$docStyle->getFill()->setFillType($patternType);
|
$docStyle->getFill()->setFillType($patternType);
|
||||||
if ($style->fill->patternFill->fgColor) {
|
if ($style->fill->patternFill->fgColor) {
|
||||||
$docStyle->getFill()->getStartColor()->setARGB(self::_readColor($style->fill->patternFill->fgColor,true));
|
$docStyle->getFill()->getStartColor()->setARGB(self::_readColor($style->fill->patternFill->fgColor, true));
|
||||||
} else {
|
} else {
|
||||||
$docStyle->getFill()->getStartColor()->setARGB('FF000000');
|
$docStyle->getFill()->getStartColor()->setARGB('FF000000');
|
||||||
}
|
}
|
||||||
if ($style->fill->patternFill->bgColor) {
|
if ($style->fill->patternFill->bgColor) {
|
||||||
$docStyle->getFill()->getEndColor()->setARGB(self::_readColor($style->fill->patternFill->bgColor,true));
|
$docStyle->getFill()->getEndColor()->setARGB(self::_readColor($style->fill->patternFill->bgColor, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,25 +112,63 @@ class PHPExcel_Reader_Excel5_Escher
|
||||||
$fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2);
|
$fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2);
|
||||||
|
|
||||||
switch ($fbt) {
|
switch ($fbt) {
|
||||||
case self::DGGCONTAINER: $this->_readDggContainer(); break;
|
case self::DGGCONTAINER:
|
||||||
case self::DGG: $this->_readDgg(); break;
|
$this->_readDggContainer();
|
||||||
case self::BSTORECONTAINER: $this->_readBstoreContainer(); break;
|
break;
|
||||||
case self::BSE: $this->_readBSE(); break;
|
case self::DGG:
|
||||||
case self::BLIPJPEG: $this->_readBlipJPEG(); break;
|
$this->_readDgg();
|
||||||
case self::BLIPPNG: $this->_readBlipPNG(); break;
|
break;
|
||||||
case self::OPT: $this->_readOPT(); break;
|
case self::BSTORECONTAINER:
|
||||||
case self::TERTIARYOPT: $this->_readTertiaryOPT(); break;
|
$this->_readBstoreContainer();
|
||||||
case self::SPLITMENUCOLORS: $this->_readSplitMenuColors(); break;
|
break;
|
||||||
case self::DGCONTAINER: $this->_readDgContainer(); break;
|
case self::BSE:
|
||||||
case self::DG: $this->_readDg(); break;
|
$this->_readBSE();
|
||||||
case self::SPGRCONTAINER: $this->_readSpgrContainer(); break;
|
break;
|
||||||
case self::SPCONTAINER: $this->_readSpContainer(); break;
|
case self::BLIPJPEG:
|
||||||
case self::SPGR: $this->_readSpgr(); break;
|
$this->_readBlipJPEG();
|
||||||
case self::SP: $this->_readSp(); break;
|
break;
|
||||||
case self::CLIENTTEXTBOX: $this->_readClientTextbox(); break;
|
case self::BLIPPNG:
|
||||||
case self::CLIENTANCHOR: $this->_readClientAnchor(); break;
|
$this->_readBlipPNG();
|
||||||
case self::CLIENTDATA: $this->_readClientData(); break;
|
break;
|
||||||
default: $this->_readDefault(); break;
|
case self::OPT:
|
||||||
|
$this->_readOPT();
|
||||||
|
break;
|
||||||
|
case self::TERTIARYOPT:
|
||||||
|
$this->_readTertiaryOPT();
|
||||||
|
break;
|
||||||
|
case self::SPLITMENUCOLORS:
|
||||||
|
$this->_readSplitMenuColors();
|
||||||
|
break;
|
||||||
|
case self::DGCONTAINER:
|
||||||
|
$this->_readDgContainer();
|
||||||
|
break;
|
||||||
|
case self::DG:
|
||||||
|
$this->_readDg();
|
||||||
|
break;
|
||||||
|
case self::SPGRCONTAINER:
|
||||||
|
$this->_readSpgrContainer();
|
||||||
|
break;
|
||||||
|
case self::SPCONTAINER:
|
||||||
|
$this->_readSpContainer();
|
||||||
|
break;
|
||||||
|
case self::SPGR:
|
||||||
|
$this->_readSpgr();
|
||||||
|
break;
|
||||||
|
case self::SP:
|
||||||
|
$this->_readSp();
|
||||||
|
break;
|
||||||
|
case self::CLIENTTEXTBOX:
|
||||||
|
$this->_readClientTextbox();
|
||||||
|
break;
|
||||||
|
case self::CLIENTANCHOR:
|
||||||
|
$this->_readClientAnchor();
|
||||||
|
break;
|
||||||
|
case self::CLIENTDATA:
|
||||||
|
$this->_readClientData();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->_readDefault();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,8 +636,8 @@ class PHPExcel_Reader_Excel5_Escher
|
||||||
* @param string $data Binary data
|
* @param string $data Binary data
|
||||||
* @param int $n Number of properties
|
* @param int $n Number of properties
|
||||||
*/
|
*/
|
||||||
private function _readOfficeArtRGFOPTE($data, $n) {
|
private function _readOfficeArtRGFOPTE($data, $n)
|
||||||
|
{
|
||||||
$splicedComplexData = substr($data, 6 * $n);
|
$splicedComplexData = substr($data, 6 * $n);
|
||||||
|
|
||||||
// loop through property-value pairs
|
// loop through property-value pairs
|
||||||
|
@ -636,5 +674,4 @@ class PHPExcel_Reader_Excel5_Escher
|
||||||
$this->_object->setOPT($opidOpid, $value);
|
$this->_object->setOPT($opidOpid, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@ class PHPExcel_Reader_Excel5_MD5
|
||||||
private $c;
|
private $c;
|
||||||
private $d;
|
private $d;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MD5 stream constructor
|
* MD5 stream constructor
|
||||||
*/
|
*/
|
||||||
|
@ -50,7 +49,6 @@ class PHPExcel_Reader_Excel5_MD5
|
||||||
$this->reset();
|
$this->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the MD5 stream context
|
* Reset the MD5 stream context
|
||||||
*/
|
*/
|
||||||
|
@ -62,7 +60,6 @@ class PHPExcel_Reader_Excel5_MD5
|
||||||
$this->d = 0x10325476;
|
$this->d = 0x10325476;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get MD5 stream context
|
* Get MD5 stream context
|
||||||
*
|
*
|
||||||
|
@ -82,7 +79,6 @@ class PHPExcel_Reader_Excel5_MD5
|
||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add data to context
|
* Add data to context
|
||||||
*
|
*
|
||||||
|
@ -180,31 +176,26 @@ class PHPExcel_Reader_Excel5_MD5
|
||||||
$this->d = ($this->d + $D) & 0xffffffff;
|
$this->d = ($this->d + $D) & 0xffffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function F($X, $Y, $Z)
|
private static function F($X, $Y, $Z)
|
||||||
{
|
{
|
||||||
return (($X & $Y) | ((~ $X) & $Z)); // X AND Y OR NOT X AND Z
|
return (($X & $Y) | ((~ $X) & $Z)); // X AND Y OR NOT X AND Z
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function G($X, $Y, $Z)
|
private static function G($X, $Y, $Z)
|
||||||
{
|
{
|
||||||
return (($X & $Z) | ($Y & (~ $Z))); // X AND Z OR Y AND NOT Z
|
return (($X & $Z) | ($Y & (~ $Z))); // X AND Z OR Y AND NOT Z
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function H($X, $Y, $Z)
|
private static function H($X, $Y, $Z)
|
||||||
{
|
{
|
||||||
return ($X ^ $Y ^ $Z); // X XOR Y XOR Z
|
return ($X ^ $Y ^ $Z); // X XOR Y XOR Z
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function I($X, $Y, $Z)
|
private static function I($X, $Y, $Z)
|
||||||
{
|
{
|
||||||
return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z)
|
return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function step($func, &$A, $B, $C, $D, $M, $s, $t)
|
private static function step($func, &$A, $B, $C, $D, $M, $s, $t)
|
||||||
{
|
{
|
||||||
$A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff;
|
$A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff;
|
||||||
|
@ -212,7 +203,6 @@ class PHPExcel_Reader_Excel5_MD5
|
||||||
$A = ($B + $A) & 0xffffffff;
|
$A = ($B + $A) & 0xffffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function rotate($decimal, $bits)
|
private static function rotate($decimal, $bits)
|
||||||
{
|
{
|
||||||
$binary = str_pad(decbin($decimal), 32, "0", STR_PAD_LEFT);
|
$binary = str_pad(decbin($decimal), 32, "0", STR_PAD_LEFT);
|
||||||
|
|
|
@ -92,16 +92,16 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
// Count delimiters in file
|
// Count delimiters in file
|
||||||
$delimiterCount = substr_count($data, ';');
|
$delimiterCount = substr_count($data, ';');
|
||||||
if ($delimiterCount < 1) {
|
if ($delimiterCount < 1) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Analyze first line looking for ID; signature
|
// Analyze first line looking for ID; signature
|
||||||
$lines = explode("\n", $data);
|
$lines = explode("\n", $data);
|
||||||
if (substr($lines[0],0,4) != 'ID;P') {
|
if (substr($lines[0],0,4) != 'ID;P') {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -154,7 +154,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
|
|
||||||
// loop through one row (line) at a time in the file
|
// loop through one row (line) at a time in the file
|
||||||
$rowIndex = 0;
|
$rowIndex = 0;
|
||||||
while (($rowData = fgets($fileHandle)) !== FALSE) {
|
while (($rowData = fgets($fileHandle)) !== false) {
|
||||||
$columnIndex = 0;
|
$columnIndex = 0;
|
||||||
|
|
||||||
// convert SYLK encoded $rowData to UTF-8
|
// convert SYLK encoded $rowData to UTF-8
|
||||||
|
@ -243,7 +243,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
$column = $row = '';
|
$column = $row = '';
|
||||||
|
|
||||||
// loop through one row (line) at a time in the file
|
// loop through one row (line) at a time in the file
|
||||||
while (($rowData = fgets($fileHandle)) !== FALSE) {
|
while (($rowData = fgets($fileHandle)) !== false) {
|
||||||
|
|
||||||
// convert SYLK encoded $rowData to UTF-8
|
// convert SYLK encoded $rowData to UTF-8
|
||||||
$rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData);
|
$rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData);
|
||||||
|
@ -258,27 +258,37 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
$formatArray = array();
|
$formatArray = array();
|
||||||
foreach ($rowData as $rowDatum) {
|
foreach ($rowData as $rowDatum) {
|
||||||
switch ($rowDatum{0}) {
|
switch ($rowDatum{0}) {
|
||||||
case 'P' : $formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats,substr($rowDatum,1));
|
case 'P':
|
||||||
|
$formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1));
|
||||||
break;
|
break;
|
||||||
case 'E' :
|
case 'E':
|
||||||
case 'F' : $formatArray['font']['name'] = substr($rowDatum,1);
|
case 'F':
|
||||||
|
$formatArray['font']['name'] = substr($rowDatum, 1);
|
||||||
break;
|
break;
|
||||||
case 'L' : $formatArray['font']['size'] = substr($rowDatum,1);
|
case 'L':
|
||||||
|
$formatArray['font']['size'] = substr($rowDatum, 1);
|
||||||
break;
|
break;
|
||||||
case 'S' : $styleSettings = substr($rowDatum,1);
|
case 'S':
|
||||||
|
$styleSettings = substr($rowDatum,1);
|
||||||
for ($i=0;$i<strlen($styleSettings);++$i) {
|
for ($i=0;$i<strlen($styleSettings);++$i) {
|
||||||
switch ($styleSettings{$i}) {
|
switch ($styleSettings{$i}) {
|
||||||
case 'I' : $formatArray['font']['italic'] = true;
|
case 'I':
|
||||||
|
$formatArray['font']['italic'] = true;
|
||||||
break;
|
break;
|
||||||
case 'D' : $formatArray['font']['bold'] = true;
|
case 'D':
|
||||||
|
$formatArray['font']['bold'] = true;
|
||||||
break;
|
break;
|
||||||
case 'T' : $formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
case 'T':
|
||||||
|
$formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
case 'B' : $formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
case 'B':
|
||||||
|
$formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
case 'L' : $formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
case 'L':
|
||||||
|
$formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
case 'R' : $formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
case 'R':
|
||||||
|
$formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,15 +302,19 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
$cellData = $cellDataFormula = '';
|
$cellData = $cellDataFormula = '';
|
||||||
foreach ($rowData as $rowDatum) {
|
foreach ($rowData as $rowDatum) {
|
||||||
switch ($rowDatum{0}) {
|
switch ($rowDatum{0}) {
|
||||||
case 'C' :
|
case 'C':
|
||||||
case 'X' : $column = substr($rowDatum,1);
|
case 'X':
|
||||||
|
$column = substr($rowDatum, 1);
|
||||||
break;
|
break;
|
||||||
case 'R' :
|
case 'R':
|
||||||
case 'Y' : $row = substr($rowDatum,1);
|
case 'Y':
|
||||||
|
$row = substr($rowDatum, 1);
|
||||||
break;
|
break;
|
||||||
case 'K' : $cellData = substr($rowDatum,1);
|
case 'K':
|
||||||
|
$cellData = substr($rowDatum, 1);
|
||||||
break;
|
break;
|
||||||
case 'E' : $cellDataFormula = '='.substr($rowDatum,1);
|
case 'E':
|
||||||
|
$cellDataFormula = '='.substr($rowDatum, 1);
|
||||||
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
||||||
$temp = explode('"', $cellDataFormula);
|
$temp = explode('"', $cellDataFormula);
|
||||||
$key = false;
|
$key = false;
|
||||||
|
@ -317,17 +331,25 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
foreach ($cellReferences as $cellReference) {
|
foreach ($cellReferences as $cellReference) {
|
||||||
$rowReference = $cellReference[2][0];
|
$rowReference = $cellReference[2][0];
|
||||||
// Empty R reference is the current row
|
// Empty R reference is the current row
|
||||||
if ($rowReference == '') $rowReference = $row;
|
if ($rowReference == '') {
|
||||||
|
$rowReference = $row;
|
||||||
|
}
|
||||||
// Bracketed R references are relative to the current row
|
// Bracketed R references are relative to the current row
|
||||||
if ($rowReference{0} == '[') $rowReference = $row + trim($rowReference,'[]');
|
if ($rowReference{0} == '[') {
|
||||||
|
$rowReference = $row + trim($rowReference, '[]');
|
||||||
|
}
|
||||||
$columnReference = $cellReference[4][0];
|
$columnReference = $cellReference[4][0];
|
||||||
// Empty C reference is the current column
|
// Empty C reference is the current column
|
||||||
if ($columnReference == '') $columnReference = $column;
|
if ($columnReference == '') {
|
||||||
|
$columnReference = $column;
|
||||||
|
}
|
||||||
// Bracketed C references are relative to the current column
|
// Bracketed C references are relative to the current column
|
||||||
if ($columnReference{0} == '[') $columnReference = $column + trim($columnReference,'[]');
|
if ($columnReference{0} == '[') {
|
||||||
|
$columnReference = $column + trim($columnReference,'[]');
|
||||||
|
}
|
||||||
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
|
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
|
||||||
|
|
||||||
$value = substr_replace($value, $A1CellReference, $cellReference[0][1],strlen($cellReference[0][0]));
|
$value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,30 +375,41 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
$styleData = array();
|
$styleData = array();
|
||||||
foreach ($rowData as $rowDatum) {
|
foreach ($rowData as $rowDatum) {
|
||||||
switch ($rowDatum{0}) {
|
switch ($rowDatum{0}) {
|
||||||
case 'C' :
|
case 'C':
|
||||||
case 'X' : $column = substr($rowDatum,1);
|
case 'X':
|
||||||
|
$column = substr($rowDatum, 1);
|
||||||
break;
|
break;
|
||||||
case 'R' :
|
case 'R':
|
||||||
case 'Y' : $row = substr($rowDatum,1);
|
case 'Y':
|
||||||
|
$row = substr($rowDatum, 1);
|
||||||
break;
|
break;
|
||||||
case 'P' : $formatStyle = $rowDatum;
|
case 'P':
|
||||||
|
$formatStyle = $rowDatum;
|
||||||
break;
|
break;
|
||||||
case 'W' : list($startCol, $endCol, $columnWidth) = explode(' ',substr($rowDatum,1));
|
case 'W':
|
||||||
|
list($startCol, $endCol, $columnWidth) = explode(' ', substr($rowDatum, 1));
|
||||||
break;
|
break;
|
||||||
case 'S' : $styleSettings = substr($rowDatum,1);
|
case 'S':
|
||||||
|
$styleSettings = substr($rowDatum,1);
|
||||||
for ($i=0;$i<strlen($styleSettings);++$i) {
|
for ($i=0;$i<strlen($styleSettings);++$i) {
|
||||||
switch ($styleSettings{$i}) {
|
switch ($styleSettings{$i}) {
|
||||||
case 'I' : $styleData['font']['italic'] = true;
|
case 'I':
|
||||||
|
$styleData['font']['italic'] = true;
|
||||||
break;
|
break;
|
||||||
case 'D' : $styleData['font']['bold'] = true;
|
case 'D':
|
||||||
|
$styleData['font']['bold'] = true;
|
||||||
break;
|
break;
|
||||||
case 'T' : $styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
case 'T':
|
||||||
|
$styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
case 'B' : $styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
case 'B':
|
||||||
|
$styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
case 'L' : $styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
case 'L':
|
||||||
|
$styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
case 'R' : $styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
case 'R':
|
||||||
|
$styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -409,11 +442,13 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
} else {
|
} else {
|
||||||
foreach ($rowData as $rowDatum) {
|
foreach ($rowData as $rowDatum) {
|
||||||
switch ($rowDatum{0}) {
|
switch ($rowDatum{0}) {
|
||||||
case 'C' :
|
case 'C':
|
||||||
case 'X' : $column = substr($rowDatum,1);
|
case 'X':
|
||||||
|
$column = substr($rowDatum,1);
|
||||||
break;
|
break;
|
||||||
case 'R' :
|
case 'R':
|
||||||
case 'Y' : $row = substr($rowDatum,1);
|
case 'Y':
|
||||||
|
$row = substr($rowDatum,1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -432,7 +467,8 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getSheetIndex() {
|
public function getSheetIndex()
|
||||||
|
{
|
||||||
return $this->_sheetIndex;
|
return $this->_sheetIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,9 +478,9 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
* @param int $pValue Sheet index
|
* @param int $pValue Sheet index
|
||||||
* @return PHPExcel_Reader_SYLK
|
* @return PHPExcel_Reader_SYLK
|
||||||
*/
|
*/
|
||||||
public function setSheetIndex($pValue = 0) {
|
public function setSheetIndex($pValue = 0)
|
||||||
|
{
|
||||||
$this->_sheetIndex = $pValue;
|
$this->_sheetIndex = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -662,7 +662,7 @@ class PHPExcel_ReferenceHelper
|
||||||
$toString .= $modified3.':'.$modified4;
|
$toString .= $modified3.':'.$modified4;
|
||||||
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
|
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
|
||||||
$column = 100000;
|
$column = 100000;
|
||||||
$row = 10000000 + trim($match[3],'$');
|
$row = 10000000 + trim($match[3], '$');
|
||||||
$cellIndex = $column.$row;
|
$cellIndex = $column.$row;
|
||||||
|
|
||||||
$newCellTokens[$cellIndex] = preg_quote($toString);
|
$newCellTokens[$cellIndex] = preg_quote($toString);
|
||||||
|
|
Loading…
Reference in New Issue