Merge branch 'psr2' into develop

This commit is contained in:
MarkBaker 2015-05-18 18:57:39 +01:00
commit f94dcb9852
119 changed files with 16343 additions and 15205 deletions

File diff suppressed because it is too large Load Diff

View File

@ -126,7 +126,7 @@ class PHPExcel_Calculation_Database
$k = array_search($criteriaName, $fieldNames); $k = array_search($criteriaName, $fieldNames);
if (isset($dataValues[$k])) { if (isset($dataValues[$k])) {
$dataValue = $dataValues[$k]; $dataValue = $dataValues[$k];
$dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::_wrapResult(strtoupper($dataValue)) : $dataValue; $dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::wrapResult(strtoupper($dataValue)) : $dataValue;
$testConditionList = str_replace('[:' . $criteriaName . ']', $dataValue, $testConditionList); $testConditionList = str_replace('[:' . $criteriaName . ']', $dataValue, $testConditionList);
} }
} }

View File

@ -323,7 +323,7 @@ class PHPExcel_Calculation_Functions
} }
if (!in_array($condition{0}, array('>', '<', '='))) { if (!in_array($condition{0}, array('>', '<', '='))) {
if (!is_numeric($condition)) { if (!is_numeric($condition)) {
$condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition)); $condition = PHPExcel_Calculation::wrapResult(strtoupper($condition));
} }
return '=' . $condition; return '=' . $condition;
} else { } else {
@ -332,7 +332,7 @@ class PHPExcel_Calculation_Functions
if (!is_numeric($operand)) { if (!is_numeric($operand)) {
$operand = str_replace('"', '""', $operand); $operand = str_replace('"', '""', $operand);
$operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand)); $operand = PHPExcel_Calculation::wrapResult(strtoupper($operand));
} }
return $operator.$operand; return $operator.$operand;

View File

@ -1206,7 +1206,7 @@ class PHPExcel_Calculation_MathTrig
foreach ($aArgs as $key => $arg) { foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = str_replace('"', '""', $arg); $arg = str_replace('"', '""', $arg);
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;

View File

@ -877,7 +877,7 @@ class PHPExcel_Calculation_Statistical
$aCount = 0; $aCount = 0;
foreach ($aArgs as $key => $arg) { foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
@ -1298,7 +1298,7 @@ class PHPExcel_Calculation_Statistical
// Loop through arguments // Loop through arguments
foreach ($aArgs as $arg) { foreach ($aArgs as $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
@ -2290,7 +2290,7 @@ class PHPExcel_Calculation_Statistical
// Loop through arguments // Loop through arguments
foreach ($aArgs as $key => $arg) { foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
@ -2449,7 +2449,7 @@ class PHPExcel_Calculation_Statistical
// Loop through arguments // Loop through arguments
foreach ($aArgs as $key => $arg) { foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) { if (!is_numeric($arg)) {
$arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg));
} }
$testCondition = '='.$arg.$condition; $testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {

View File

@ -27,7 +27,6 @@
*/ */
class PHPExcel_Cell class PHPExcel_Cell
{ {
/** /**
* Default range variable constant * Default range variable constant
* *
@ -227,6 +226,7 @@ class PHPExcel_Cell
break; break;
case PHPExcel_Cell_DataType::TYPE_STRING2: case PHPExcel_Cell_DataType::TYPE_STRING2:
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING; $pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
// no break
case PHPExcel_Cell_DataType::TYPE_STRING: case PHPExcel_Cell_DataType::TYPE_STRING:
// Synonym for string // Synonym for string
case PHPExcel_Cell_DataType::TYPE_INLINE: case PHPExcel_Cell_DataType::TYPE_INLINE:

View File

@ -32,98 +32,98 @@ class PHPExcel_Chart
* *
* @var string * @var string
*/ */
private $_name = ''; private $name = '';
/** /**
* Worksheet * Worksheet
* *
* @var PHPExcel_Worksheet * @var PHPExcel_Worksheet
*/ */
private $_worksheet = null; private $worksheet;
/** /**
* Chart Title * Chart Title
* *
* @var PHPExcel_Chart_Title * @var PHPExcel_Chart_Title
*/ */
private $_title = null; private $title;
/** /**
* Chart Legend * Chart Legend
* *
* @var PHPExcel_Chart_Legend * @var PHPExcel_Chart_Legend
*/ */
private $_legend = null; private $legend;
/** /**
* X-Axis Label * X-Axis Label
* *
* @var PHPExcel_Chart_Title * @var PHPExcel_Chart_Title
*/ */
private $_xAxisLabel = null; private $xAxisLabel;
/** /**
* Y-Axis Label * Y-Axis Label
* *
* @var PHPExcel_Chart_Title * @var PHPExcel_Chart_Title
*/ */
private $_yAxisLabel = null; private $yAxisLabel;
/** /**
* Chart Plot Area * Chart Plot Area
* *
* @var PHPExcel_Chart_PlotArea * @var PHPExcel_Chart_PlotArea
*/ */
private $_plotArea = null; private $plotArea;
/** /**
* Plot Visible Only * Plot Visible Only
* *
* @var boolean * @var boolean
*/ */
private $_plotVisibleOnly = true; private $plotVisibleOnly = true;
/** /**
* Display Blanks as * Display Blanks as
* *
* @var string * @var string
*/ */
private $_displayBlanksAs = '0'; private $displayBlanksAs = '0';
/** /**
* Chart Asix Y as * Chart Asix Y as
* *
* @var PHPExcel_Chart_Axis * @var PHPExcel_Chart_Axis
*/ */
private $_yAxis = null; private $yAxis;
/** /**
* Chart Asix X as * Chart Asix X as
* *
* @var PHPExcel_Chart_Axis * @var PHPExcel_Chart_Axis
*/ */
private $_xAxis = null; private $xAxis;
/** /**
* Chart Major Gridlines as * Chart Major Gridlines as
* *
* @var PHPExcel_Chart_GridLines * @var PHPExcel_Chart_GridLines
*/ */
private $_majorGridlines = null; private $majorGridlines;
/** /**
* Chart Minor Gridlines as * Chart Minor Gridlines as
* *
* @var PHPExcel_Chart_GridLines * @var PHPExcel_Chart_GridLines
*/ */
private $_minorGridlines = null; private $minorGridlines;
/** /**
* Top-Left Cell Position * Top-Left Cell Position
* *
* @var string * @var string
*/ */
private $_topLeftCellRef = 'A1'; private $topLeftCellRef = 'A1';
/** /**
@ -131,7 +131,7 @@ class PHPExcel_Chart
* *
* @var integer * @var integer
*/ */
private $_topLeftXOffset = 0; private $topLeftXOffset = 0;
/** /**
@ -139,7 +139,7 @@ class PHPExcel_Chart
* *
* @var integer * @var integer
*/ */
private $_topLeftYOffset = 0; private $topLeftYOffset = 0;
/** /**
@ -147,7 +147,7 @@ class PHPExcel_Chart
* *
* @var string * @var string
*/ */
private $_bottomRightCellRef = 'A1'; private $bottomRightCellRef = 'A1';
/** /**
@ -155,7 +155,7 @@ class PHPExcel_Chart
* *
* @var integer * @var integer
*/ */
private $_bottomRightXOffset = 10; private $bottomRightXOffset = 10;
/** /**
@ -163,7 +163,7 @@ class PHPExcel_Chart
* *
* @var integer * @var integer
*/ */
private $_bottomRightYOffset = 10; private $bottomRightYOffset = 10;
/** /**
@ -171,18 +171,18 @@ class PHPExcel_Chart
*/ */
public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, PHPExcel_Chart_Axis $xAxis = null, PHPExcel_Chart_Axis $yAxis = null, PHPExcel_Chart_GridLines $majorGridlines = null, PHPExcel_Chart_GridLines $minorGridlines = null) public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, PHPExcel_Chart_Axis $xAxis = null, PHPExcel_Chart_Axis $yAxis = null, PHPExcel_Chart_GridLines $majorGridlines = null, PHPExcel_Chart_GridLines $minorGridlines = null)
{ {
$this->_name = $name; $this->name = $name;
$this->_title = $title; $this->title = $title;
$this->_legend = $legend; $this->legend = $legend;
$this->_xAxisLabel = $xAxisLabel; $this->xAxisLabel = $xAxisLabel;
$this->_yAxisLabel = $yAxisLabel; $this->yAxisLabel = $yAxisLabel;
$this->_plotArea = $plotArea; $this->plotArea = $plotArea;
$this->_plotVisibleOnly = $plotVisibleOnly; $this->plotVisibleOnly = $plotVisibleOnly;
$this->_displayBlanksAs = $displayBlanksAs; $this->displayBlanksAs = $displayBlanksAs;
$this->_xAxis = $xAxis; $this->xAxis = $xAxis;
$this->_yAxis = $yAxis; $this->yAxis = $yAxis;
$this->_majorGridlines = $majorGridlines; $this->majorGridlines = $majorGridlines;
$this->_minorGridlines = $minorGridlines; $this->minorGridlines = $minorGridlines;
} }
/** /**
@ -192,7 +192,7 @@ class PHPExcel_Chart
*/ */
public function getName() public function getName()
{ {
return $this->_name; return $this->name;
} }
/** /**
@ -202,7 +202,7 @@ class PHPExcel_Chart
*/ */
public function getWorksheet() public function getWorksheet()
{ {
return $this->_worksheet; return $this->worksheet;
} }
/** /**
@ -214,7 +214,7 @@ class PHPExcel_Chart
*/ */
public function setWorksheet(PHPExcel_Worksheet $pValue = null) public function setWorksheet(PHPExcel_Worksheet $pValue = null)
{ {
$this->_worksheet = $pValue; $this->worksheet = $pValue;
return $this; return $this;
} }
@ -226,7 +226,7 @@ class PHPExcel_Chart
*/ */
public function getTitle() public function getTitle()
{ {
return $this->_title; return $this->title;
} }
/** /**
@ -237,7 +237,7 @@ class PHPExcel_Chart
*/ */
public function setTitle(PHPExcel_Chart_Title $title) public function setTitle(PHPExcel_Chart_Title $title)
{ {
$this->_title = $title; $this->title = $title;
return $this; return $this;
} }
@ -249,7 +249,7 @@ class PHPExcel_Chart
*/ */
public function getLegend() public function getLegend()
{ {
return $this->_legend; return $this->legend;
} }
/** /**
@ -260,7 +260,7 @@ class PHPExcel_Chart
*/ */
public function setLegend(PHPExcel_Chart_Legend $legend) public function setLegend(PHPExcel_Chart_Legend $legend)
{ {
$this->_legend = $legend; $this->legend = $legend;
return $this; return $this;
} }
@ -272,7 +272,7 @@ class PHPExcel_Chart
*/ */
public function getXAxisLabel() public function getXAxisLabel()
{ {
return $this->_xAxisLabel; return $this->xAxisLabel;
} }
/** /**
@ -283,7 +283,7 @@ class PHPExcel_Chart
*/ */
public function setXAxisLabel(PHPExcel_Chart_Title $label) public function setXAxisLabel(PHPExcel_Chart_Title $label)
{ {
$this->_xAxisLabel = $label; $this->xAxisLabel = $label;
return $this; return $this;
} }
@ -295,7 +295,7 @@ class PHPExcel_Chart
*/ */
public function getYAxisLabel() public function getYAxisLabel()
{ {
return $this->_yAxisLabel; return $this->yAxisLabel;
} }
/** /**
@ -306,7 +306,7 @@ class PHPExcel_Chart
*/ */
public function setYAxisLabel(PHPExcel_Chart_Title $label) public function setYAxisLabel(PHPExcel_Chart_Title $label)
{ {
$this->_yAxisLabel = $label; $this->yAxisLabel = $label;
return $this; return $this;
} }
@ -318,7 +318,7 @@ class PHPExcel_Chart
*/ */
public function getPlotArea() public function getPlotArea()
{ {
return $this->_plotArea; return $this->plotArea;
} }
/** /**
@ -328,7 +328,7 @@ class PHPExcel_Chart
*/ */
public function getPlotVisibleOnly() public function getPlotVisibleOnly()
{ {
return $this->_plotVisibleOnly; return $this->plotVisibleOnly;
} }
/** /**
@ -339,7 +339,7 @@ class PHPExcel_Chart
*/ */
public function setPlotVisibleOnly($plotVisibleOnly = true) public function setPlotVisibleOnly($plotVisibleOnly = true)
{ {
$this->_plotVisibleOnly = $plotVisibleOnly; $this->plotVisibleOnly = $plotVisibleOnly;
return $this; return $this;
} }
@ -351,7 +351,7 @@ class PHPExcel_Chart
*/ */
public function getDisplayBlanksAs() public function getDisplayBlanksAs()
{ {
return $this->_displayBlanksAs; return $this->displayBlanksAs;
} }
/** /**
@ -362,7 +362,7 @@ class PHPExcel_Chart
*/ */
public function setDisplayBlanksAs($displayBlanksAs = '0') public function setDisplayBlanksAs($displayBlanksAs = '0')
{ {
$this->_displayBlanksAs = $displayBlanksAs; $this->displayBlanksAs = $displayBlanksAs;
} }
@ -373,8 +373,8 @@ class PHPExcel_Chart
*/ */
public function getChartAxisY() public function getChartAxisY()
{ {
if ($this->_yAxis !== null) { if ($this->yAxis !== null) {
return $this->_yAxis; return $this->yAxis;
} }
return new PHPExcel_Chart_Axis(); return new PHPExcel_Chart_Axis();
@ -387,8 +387,8 @@ class PHPExcel_Chart
*/ */
public function getChartAxisX() public function getChartAxisX()
{ {
if ($this->_xAxis !== null) { if ($this->xAxis !== null) {
return $this->_xAxis; return $this->xAxis;
} }
return new PHPExcel_Chart_Axis(); return new PHPExcel_Chart_Axis();
@ -401,8 +401,8 @@ class PHPExcel_Chart
*/ */
public function getMajorGridlines() public function getMajorGridlines()
{ {
if ($this->_majorGridlines !== null) { if ($this->majorGridlines !== null) {
return $this->_majorGridlines; return $this->majorGridlines;
} }
return new PHPExcel_Chart_GridLines(); return new PHPExcel_Chart_GridLines();
@ -415,8 +415,8 @@ class PHPExcel_Chart
*/ */
public function getMinorGridlines() public function getMinorGridlines()
{ {
if ($this->_minorGridlines !== null) { if ($this->minorGridlines !== null) {
return $this->_minorGridlines; return $this->minorGridlines;
} }
return new PHPExcel_Chart_GridLines(); return new PHPExcel_Chart_GridLines();
@ -433,7 +433,7 @@ class PHPExcel_Chart
*/ */
public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null) public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null)
{ {
$this->_topLeftCellRef = $cell; $this->topLeftCellRef = $cell;
if (!is_null($xOffset)) { if (!is_null($xOffset)) {
$this->setTopLeftXOffset($xOffset); $this->setTopLeftXOffset($xOffset);
} }
@ -452,9 +452,9 @@ class PHPExcel_Chart
public function getTopLeftPosition() public function getTopLeftPosition()
{ {
return array( return array(
'cell' => $this->_topLeftCellRef, 'cell' => $this->topLeftCellRef,
'xOffset' => $this->_topLeftXOffset, 'xOffset' => $this->topLeftXOffset,
'yOffset' => $this->_topLeftYOffset 'yOffset' => $this->topLeftYOffset
); );
} }
@ -465,7 +465,7 @@ class PHPExcel_Chart
*/ */
public function getTopLeftCell() public function getTopLeftCell()
{ {
return $this->_topLeftCellRef; return $this->topLeftCellRef;
} }
/** /**
@ -476,7 +476,7 @@ class PHPExcel_Chart
*/ */
public function setTopLeftCell($cell) public function setTopLeftCell($cell)
{ {
$this->_topLeftCellRef = $cell; $this->topLeftCellRef = $cell;
return $this; return $this;
} }
@ -508,33 +508,33 @@ class PHPExcel_Chart
public function getTopLeftOffset() public function getTopLeftOffset()
{ {
return array( return array(
'X' => $this->_topLeftXOffset, 'X' => $this->topLeftXOffset,
'Y' => $this->_topLeftYOffset 'Y' => $this->topLeftYOffset
); );
} }
public function setTopLeftXOffset($xOffset) public function setTopLeftXOffset($xOffset)
{ {
$this->_topLeftXOffset = $xOffset; $this->topLeftXOffset = $xOffset;
return $this; return $this;
} }
public function getTopLeftXOffset() public function getTopLeftXOffset()
{ {
return $this->_topLeftXOffset; return $this->topLeftXOffset;
} }
public function setTopLeftYOffset($yOffset) public function setTopLeftYOffset($yOffset)
{ {
$this->_topLeftYOffset = $yOffset; $this->topLeftYOffset = $yOffset;
return $this; return $this;
} }
public function getTopLeftYOffset() public function getTopLeftYOffset()
{ {
return $this->_topLeftYOffset; return $this->topLeftYOffset;
} }
/** /**
@ -547,7 +547,7 @@ class PHPExcel_Chart
*/ */
public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null) public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null)
{ {
$this->_bottomRightCellRef = $cell; $this->bottomRightCellRef = $cell;
if (!is_null($xOffset)) { if (!is_null($xOffset)) {
$this->setBottomRightXOffset($xOffset); $this->setBottomRightXOffset($xOffset);
} }
@ -566,15 +566,15 @@ class PHPExcel_Chart
public function getBottomRightPosition() public function getBottomRightPosition()
{ {
return array( return array(
'cell' => $this->_bottomRightCellRef, 'cell' => $this->bottomRightCellRef,
'xOffset' => $this->_bottomRightXOffset, 'xOffset' => $this->bottomRightXOffset,
'yOffset' => $this->_bottomRightYOffset 'yOffset' => $this->bottomRightYOffset
); );
} }
public function setBottomRightCell($cell) public function setBottomRightCell($cell)
{ {
$this->_bottomRightCellRef = $cell; $this->bottomRightCellRef = $cell;
return $this; return $this;
} }
@ -586,7 +586,7 @@ class PHPExcel_Chart
*/ */
public function getBottomRightCell() public function getBottomRightCell()
{ {
return $this->_bottomRightCellRef; return $this->bottomRightCellRef;
} }
/** /**
@ -616,40 +616,40 @@ class PHPExcel_Chart
public function getBottomRightOffset() public function getBottomRightOffset()
{ {
return array( return array(
'X' => $this->_bottomRightXOffset, 'X' => $this->bottomRightXOffset,
'Y' => $this->_bottomRightYOffset 'Y' => $this->bottomRightYOffset
); );
} }
public function setBottomRightXOffset($xOffset) public function setBottomRightXOffset($xOffset)
{ {
$this->_bottomRightXOffset = $xOffset; $this->bottomRightXOffset = $xOffset;
return $this; return $this;
} }
public function getBottomRightXOffset() public function getBottomRightXOffset()
{ {
return $this->_bottomRightXOffset; return $this->bottomRightXOffset;
} }
public function setBottomRightYOffset($yOffset) public function setBottomRightYOffset($yOffset)
{ {
$this->_bottomRightYOffset = $yOffset; $this->bottomRightYOffset = $yOffset;
return $this; return $this;
} }
public function getBottomRightYOffset() public function getBottomRightYOffset()
{ {
return $this->_bottomRightYOffset; return $this->bottomRightYOffset;
} }
public function refresh() public function refresh()
{ {
if ($this->_worksheet !== null) { if ($this->worksheet !== null) {
$this->_plotArea->refresh($this->_worksheet); $this->plotArea->refresh($this->worksheet);
} }
} }

View File

@ -288,7 +288,7 @@ class PHPExcel_Chart_DataSeriesValues
{ {
if ($this->dataSource !== null) { if ($this->dataSource !== null) {
$calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent()); $calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
$newDataValues = PHPExcel_Calculation::_unwrapResult( $newDataValues = PHPExcel_Calculation::unwrapResult(
$calcEngine->_calculateFormulaValue( $calcEngine->_calculateFormulaValue(
'='.$this->dataSource, '='.$this->dataSource,
null, null,

View File

@ -32,63 +32,63 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* *
* @var string * @var string
*/ */
private $_author; private $author;
/** /**
* Rich text comment * Rich text comment
* *
* @var PHPExcel_RichText * @var PHPExcel_RichText
*/ */
private $_text; private $text;
/** /**
* Comment width (CSS style, i.e. XXpx or YYpt) * Comment width (CSS style, i.e. XXpx or YYpt)
* *
* @var string * @var string
*/ */
private $_width = '96pt'; private $width = '96pt';
/** /**
* Left margin (CSS style, i.e. XXpx or YYpt) * Left margin (CSS style, i.e. XXpx or YYpt)
* *
* @var string * @var string
*/ */
private $_marginLeft = '59.25pt'; private $marginLeft = '59.25pt';
/** /**
* Top margin (CSS style, i.e. XXpx or YYpt) * Top margin (CSS style, i.e. XXpx or YYpt)
* *
* @var string * @var string
*/ */
private $_marginTop = '1.5pt'; private $marginTop = '1.5pt';
/** /**
* Visible * Visible
* *
* @var boolean * @var boolean
*/ */
private $_visible = false; private $visible = false;
/** /**
* Comment height (CSS style, i.e. XXpx or YYpt) * Comment height (CSS style, i.e. XXpx or YYpt)
* *
* @var string * @var string
*/ */
private $_height = '55.5pt'; private $height = '55.5pt';
/** /**
* Comment fill color * Comment fill color
* *
* @var PHPExcel_Style_Color * @var PHPExcel_Style_Color
*/ */
private $_fillColor; private $fillColor;
/** /**
* Alignment * Alignment
* *
* @var string * @var string
*/ */
private $_alignment; private $alignment;
/** /**
* Create a new PHPExcel_Comment * Create a new PHPExcel_Comment
@ -98,10 +98,10 @@ class PHPExcel_Comment implements PHPExcel_IComparable
public function __construct() public function __construct()
{ {
// Initialise variables // Initialise variables
$this->_author = 'Author'; $this->author = 'Author';
$this->_text = new PHPExcel_RichText(); $this->text = new PHPExcel_RichText();
$this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1'); $this->fillColor = new PHPExcel_Style_Color('FFFFFFE1');
$this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; $this->alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
} }
/** /**
@ -111,7 +111,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getAuthor() public function getAuthor()
{ {
return $this->_author; return $this->author;
} }
/** /**
@ -122,7 +122,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setAuthor($pValue = '') public function setAuthor($pValue = '')
{ {
$this->_author = $pValue; $this->author = $pValue;
return $this; return $this;
} }
@ -133,7 +133,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getText() public function getText()
{ {
return $this->_text; return $this->text;
} }
/** /**
@ -144,7 +144,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setText(PHPExcel_RichText $pValue) public function setText(PHPExcel_RichText $pValue)
{ {
$this->_text = $pValue; $this->text = $pValue;
return $this; return $this;
} }
@ -155,7 +155,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getWidth() public function getWidth()
{ {
return $this->_width; return $this->width;
} }
/** /**
@ -166,7 +166,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setWidth($value = '96pt') public function setWidth($value = '96pt')
{ {
$this->_width = $value; $this->width = $value;
return $this; return $this;
} }
@ -177,7 +177,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getHeight() public function getHeight()
{ {
return $this->_height; return $this->height;
} }
/** /**
@ -188,7 +188,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setHeight($value = '55.5pt') public function setHeight($value = '55.5pt')
{ {
$this->_height = $value; $this->height = $value;
return $this; return $this;
} }
@ -199,7 +199,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getMarginLeft() public function getMarginLeft()
{ {
return $this->_marginLeft; return $this->marginLeft;
} }
/** /**
@ -210,7 +210,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setMarginLeft($value = '59.25pt') public function setMarginLeft($value = '59.25pt')
{ {
$this->_marginLeft = $value; $this->marginLeft = $value;
return $this; return $this;
} }
@ -221,7 +221,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getMarginTop() public function getMarginTop()
{ {
return $this->_marginTop; return $this->marginTop;
} }
/** /**
@ -232,7 +232,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setMarginTop($value = '1.5pt') public function setMarginTop($value = '1.5pt')
{ {
$this->_marginTop = $value; $this->marginTop = $value;
return $this; return $this;
} }
@ -243,7 +243,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getVisible() public function getVisible()
{ {
return $this->_visible; return $this->visible;
} }
/** /**
@ -254,7 +254,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setVisible($value = false) public function setVisible($value = false)
{ {
$this->_visible = $value; $this->visible = $value;
return $this; return $this;
} }
@ -265,7 +265,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getFillColor() public function getFillColor()
{ {
return $this->_fillColor; return $this->fillColor;
} }
/** /**
@ -276,7 +276,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
{ {
$this->_alignment = $pValue; $this->alignment = $pValue;
return $this; return $this;
} }
@ -287,7 +287,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function getAlignment() public function getAlignment()
{ {
return $this->_alignment; return $this->alignment;
} }
/** /**
@ -298,16 +298,16 @@ class PHPExcel_Comment implements PHPExcel_IComparable
public function getHashCode() public function getHashCode()
{ {
return md5( return md5(
$this->_author $this->author .
. $this->_text->getHashCode() $this->text->getHashCode() .
. $this->_width $this->width .
. $this->_height $this->height .
. $this->_marginLeft $this->marginLeft .
. $this->_marginTop $this->marginTop .
. ($this->_visible ? 1 : 0) ($this->visible ? 1 : 0) .
. $this->_fillColor->getHashCode() $this->fillColor->getHashCode() .
. $this->_alignment $this->alignment .
. __CLASS__ __CLASS__
); );
} }
@ -333,6 +333,6 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*/ */
public function __toString() public function __toString()
{ {
return $this->_text->getPlainText(); return $this->text->getPlainText();
} }
} }

View File

@ -40,84 +40,84 @@ class PHPExcel_DocumentProperties
* *
* @var string * @var string
*/ */
private $_creator = 'Unknown Creator'; private $creator = 'Unknown Creator';
/** /**
* LastModifiedBy * LastModifiedBy
* *
* @var string * @var string
*/ */
private $_lastModifiedBy; private $lastModifiedBy;
/** /**
* Created * Created
* *
* @var datetime * @var datetime
*/ */
private $_created; private $created;
/** /**
* Modified * Modified
* *
* @var datetime * @var datetime
*/ */
private $_modified; private $modified;
/** /**
* Title * Title
* *
* @var string * @var string
*/ */
private $_title = 'Untitled Spreadsheet'; private $title = 'Untitled Spreadsheet';
/** /**
* Description * Description
* *
* @var string * @var string
*/ */
private $_description = ''; private $description = '';
/** /**
* Subject * Subject
* *
* @var string * @var string
*/ */
private $_subject = ''; private $subject = '';
/** /**
* Keywords * Keywords
* *
* @var string * @var string
*/ */
private $_keywords = ''; private $keywords = '';
/** /**
* Category * Category
* *
* @var string * @var string
*/ */
private $_category = ''; private $category = '';
/** /**
* Manager * Manager
* *
* @var string * @var string
*/ */
private $_manager = ''; private $manager = '';
/** /**
* Company * Company
* *
* @var string * @var string
*/ */
private $_company = 'Microsoft Corporation'; private $company = 'Microsoft Corporation';
/** /**
* Custom Properties * Custom Properties
* *
* @var string * @var string
*/ */
private $_customProperties = array(); private $customProperties = array();
/** /**
@ -126,9 +126,9 @@ class PHPExcel_DocumentProperties
public function __construct() public function __construct()
{ {
// Initialise values // Initialise values
$this->_lastModifiedBy = $this->_creator; $this->lastModifiedBy = $this->creator;
$this->_created = time(); $this->created = time();
$this->_modified = time(); $this->modified = time();
} }
/** /**
@ -138,7 +138,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getCreator() public function getCreator()
{ {
return $this->_creator; return $this->creator;
} }
/** /**
@ -149,7 +149,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setCreator($pValue = '') public function setCreator($pValue = '')
{ {
$this->_creator = $pValue; $this->creator = $pValue;
return $this; return $this;
} }
@ -160,7 +160,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getLastModifiedBy() public function getLastModifiedBy()
{ {
return $this->_lastModifiedBy; return $this->lastModifiedBy;
} }
/** /**
@ -171,7 +171,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setLastModifiedBy($pValue = '') public function setLastModifiedBy($pValue = '')
{ {
$this->_lastModifiedBy = $pValue; $this->lastModifiedBy = $pValue;
return $this; return $this;
} }
@ -182,7 +182,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getCreated() public function getCreated()
{ {
return $this->_created; return $this->created;
} }
/** /**
@ -203,7 +203,7 @@ class PHPExcel_DocumentProperties
} }
} }
$this->_created = $pValue; $this->created = $pValue;
return $this; return $this;
} }
@ -214,7 +214,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getModified() public function getModified()
{ {
return $this->_modified; return $this->modified;
} }
/** /**
@ -235,7 +235,7 @@ class PHPExcel_DocumentProperties
} }
} }
$this->_modified = $pValue; $this->modified = $pValue;
return $this; return $this;
} }
@ -246,7 +246,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getTitle() public function getTitle()
{ {
return $this->_title; return $this->title;
} }
/** /**
@ -257,7 +257,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setTitle($pValue = '') public function setTitle($pValue = '')
{ {
$this->_title = $pValue; $this->title = $pValue;
return $this; return $this;
} }
@ -268,7 +268,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getDescription() public function getDescription()
{ {
return $this->_description; return $this->description;
} }
/** /**
@ -279,7 +279,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setDescription($pValue = '') public function setDescription($pValue = '')
{ {
$this->_description = $pValue; $this->description = $pValue;
return $this; return $this;
} }
@ -290,7 +290,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getSubject() public function getSubject()
{ {
return $this->_subject; return $this->subject;
} }
/** /**
@ -301,7 +301,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setSubject($pValue = '') public function setSubject($pValue = '')
{ {
$this->_subject = $pValue; $this->subject = $pValue;
return $this; return $this;
} }
@ -312,7 +312,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getKeywords() public function getKeywords()
{ {
return $this->_keywords; return $this->keywords;
} }
/** /**
@ -323,7 +323,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setKeywords($pValue = '') public function setKeywords($pValue = '')
{ {
$this->_keywords = $pValue; $this->keywords = $pValue;
return $this; return $this;
} }
@ -334,7 +334,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getCategory() public function getCategory()
{ {
return $this->_category; return $this->category;
} }
/** /**
@ -345,7 +345,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setCategory($pValue = '') public function setCategory($pValue = '')
{ {
$this->_category = $pValue; $this->category = $pValue;
return $this; return $this;
} }
@ -356,7 +356,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getCompany() public function getCompany()
{ {
return $this->_company; return $this->company;
} }
/** /**
@ -367,7 +367,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setCompany($pValue = '') public function setCompany($pValue = '')
{ {
$this->_company = $pValue; $this->company = $pValue;
return $this; return $this;
} }
@ -378,7 +378,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getManager() public function getManager()
{ {
return $this->_manager; return $this->manager;
} }
/** /**
@ -389,7 +389,7 @@ class PHPExcel_DocumentProperties
*/ */
public function setManager($pValue = '') public function setManager($pValue = '')
{ {
$this->_manager = $pValue; $this->manager = $pValue;
return $this; return $this;
} }
@ -400,7 +400,7 @@ class PHPExcel_DocumentProperties
*/ */
public function getCustomProperties() public function getCustomProperties()
{ {
return array_keys($this->_customProperties); return array_keys($this->customProperties);
} }
/** /**
@ -411,7 +411,7 @@ class PHPExcel_DocumentProperties
*/ */
public function isCustomPropertySet($propertyName) public function isCustomPropertySet($propertyName)
{ {
return isset($this->_customProperties[$propertyName]); return isset($this->customProperties[$propertyName]);
} }
/** /**
@ -422,8 +422,8 @@ class PHPExcel_DocumentProperties
*/ */
public function getCustomPropertyValue($propertyName) public function getCustomPropertyValue($propertyName)
{ {
if (isset($this->_customProperties[$propertyName])) { if (isset($this->customProperties[$propertyName])) {
return $this->_customProperties[$propertyName]['value']; return $this->customProperties[$propertyName]['value'];
} }
} }
@ -436,8 +436,8 @@ class PHPExcel_DocumentProperties
*/ */
public function getCustomPropertyType($propertyName) public function getCustomPropertyType($propertyName)
{ {
if (isset($this->_customProperties[$propertyName])) { if (isset($this->customProperties[$propertyName])) {
return $this->_customProperties[$propertyName]['type']; return $this->customProperties[$propertyName]['type'];
} }
} }
@ -475,7 +475,7 @@ class PHPExcel_DocumentProperties
} }
} }
$this->_customProperties[$propertyName] = array( $this->customProperties[$propertyName] = array(
'value' => $propertyValue, 'value' => $propertyValue,
'type' => $propertyType 'type' => $propertyType
); );

View File

@ -32,14 +32,14 @@ class PHPExcel_HashTable
* *
* @var array * @var array
*/ */
public $_items = array(); protected $items = array();
/** /**
* HashTable key map * HashTable key map
* *
* @var array * @var array
*/ */
public $_keyMap = array(); protected $keyMap = array();
/** /**
* Create a new PHPExcel_HashTable * Create a new PHPExcel_HashTable
@ -84,9 +84,9 @@ class PHPExcel_HashTable
public function add(PHPExcel_IComparable $pSource = null) public function add(PHPExcel_IComparable $pSource = null)
{ {
$hash = $pSource->getHashCode(); $hash = $pSource->getHashCode();
if (!isset($this->_items[$hash])) { if (!isset($this->items[$hash])) {
$this->_items[$hash] = $pSource; $this->items[$hash] = $pSource;
$this->_keyMap[count($this->_items) - 1] = $hash; $this->keyMap[count($this->items) - 1] = $hash;
} }
} }
@ -99,20 +99,20 @@ class PHPExcel_HashTable
public function remove(PHPExcel_IComparable $pSource = null) public function remove(PHPExcel_IComparable $pSource = null)
{ {
$hash = $pSource->getHashCode(); $hash = $pSource->getHashCode();
if (isset($this->_items[$hash])) { if (isset($this->items[$hash])) {
unset($this->_items[$hash]); unset($this->items[$hash]);
$deleteKey = -1; $deleteKey = -1;
foreach ($this->_keyMap as $key => $value) { foreach ($this->keyMap as $key => $value) {
if ($deleteKey >= 0) { if ($deleteKey >= 0) {
$this->_keyMap[$key - 1] = $value; $this->keyMap[$key - 1] = $value;
} }
if ($value == $hash) { if ($value == $hash) {
$deleteKey = $key; $deleteKey = $key;
} }
} }
unset($this->_keyMap[count($this->_keyMap) - 1]); unset($this->keyMap[count($this->keyMap) - 1]);
} }
} }
@ -122,8 +122,8 @@ class PHPExcel_HashTable
*/ */
public function clear() public function clear()
{ {
$this->_items = array(); $this->items = array();
$this->_keyMap = array(); $this->keyMap = array();
} }
/** /**
@ -133,7 +133,7 @@ class PHPExcel_HashTable
*/ */
public function count() public function count()
{ {
return count($this->_items); return count($this->items);
} }
/** /**
@ -144,7 +144,7 @@ class PHPExcel_HashTable
*/ */
public function getIndexForHashCode($pHashCode = '') public function getIndexForHashCode($pHashCode = '')
{ {
return array_search($pHashCode, $this->_keyMap); return array_search($pHashCode, $this->keyMap);
} }
/** /**
@ -156,8 +156,8 @@ class PHPExcel_HashTable
*/ */
public function getByIndex($pIndex = 0) public function getByIndex($pIndex = 0)
{ {
if (isset($this->_keyMap[$pIndex])) { if (isset($this->keyMap[$pIndex])) {
return $this->getByHashCode($this->_keyMap[$pIndex]); return $this->getByHashCode($this->keyMap[$pIndex]);
} }
return null; return null;
@ -172,8 +172,8 @@ class PHPExcel_HashTable
*/ */
public function getByHashCode($pHashCode = '') public function getByHashCode($pHashCode = '')
{ {
if (isset($this->_items[$pHashCode])) { if (isset($this->items[$pHashCode])) {
return $this->_items[$pHashCode]; return $this->items[$pHashCode];
} }
return null; return null;
@ -186,7 +186,7 @@ class PHPExcel_HashTable
*/ */
public function toArray() public function toArray()
{ {
return $this->_items; return $this->items;
} }
/** /**

View File

@ -43,7 +43,7 @@ class PHPExcel_IOFactory
* @access private * @access private
* @static * @static
*/ */
private static $_searchLocations = array( private static $searchLocations = array(
array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ), array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ),
array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' ) array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' )
); );
@ -55,7 +55,7 @@ class PHPExcel_IOFactory
* @access private * @access private
* @static * @static
*/ */
private static $_autoResolveClasses = array( private static $autoResolveClasses = array(
'Excel2007', 'Excel2007',
'Excel5', 'Excel5',
'Excel2003XML', 'Excel2003XML',
@ -82,7 +82,7 @@ class PHPExcel_IOFactory
*/ */
public static function getSearchLocations() public static function getSearchLocations()
{ {
return self::$_searchLocations; return self::$searchLocations;
} }
/** /**
@ -96,7 +96,7 @@ class PHPExcel_IOFactory
public static function setSearchLocations($value) public static function setSearchLocations($value)
{ {
if (is_array($value)) { if (is_array($value)) {
self::$_searchLocations = $value; self::$searchLocations = $value;
} else { } else {
throw new PHPExcel_Reader_Exception('Invalid parameter passed.'); throw new PHPExcel_Reader_Exception('Invalid parameter passed.');
} }
@ -113,7 +113,7 @@ class PHPExcel_IOFactory
*/ */
public static function addSearchLocation($type = '', $location = '', $classname = '') public static function addSearchLocation($type = '', $location = '', $classname = '')
{ {
self::$_searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname ); self::$searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname );
} }
/** /**
@ -132,7 +132,7 @@ class PHPExcel_IOFactory
$searchType = 'IWriter'; $searchType = 'IWriter';
// Include class // Include class
foreach (self::$_searchLocations as $searchLocation) { foreach (self::$searchLocations as $searchLocation) {
if ($searchLocation['type'] == $searchType) { if ($searchLocation['type'] == $searchType) {
$className = str_replace('{0}', $writerType, $searchLocation['class']); $className = str_replace('{0}', $writerType, $searchLocation['class']);
@ -162,7 +162,7 @@ class PHPExcel_IOFactory
$searchType = 'IReader'; $searchType = 'IReader';
// Include class // Include class
foreach (self::$_searchLocations as $searchLocation) { foreach (self::$searchLocations as $searchLocation) {
if ($searchLocation['type'] == $searchType) { if ($searchLocation['type'] == $searchType) {
$className = str_replace('{0}', $readerType, $searchLocation['class']); $className = str_replace('{0}', $readerType, $searchLocation['class']);
@ -273,8 +273,8 @@ class PHPExcel_IOFactory
} }
// If we reach here then "lucky guess" didn't give any result // If we reach here then "lucky guess" didn't give any result
// Try walking through all the options in self::$_autoResolveClasses // Try walking through all the options in self::$autoResolveClasses
foreach (self::$_autoResolveClasses as $autoResolveClass) { foreach (self::$autoResolveClasses as $autoResolveClass) {
// Ignore our original guess, we know that won't work // Ignore our original guess, we know that won't work
if ($autoResolveClass !== $extensionType) { if ($autoResolveClass !== $extensionType) {
$reader = self::createReader($autoResolveClass); $reader = self::createReader($autoResolveClass);

View File

@ -32,35 +32,35 @@ class PHPExcel_NamedRange
* *
* @var string * @var string
*/ */
private $_name; private $name;
/** /**
* Worksheet on which the named range can be resolved * Worksheet on which the named range can be resolved
* *
* @var PHPExcel_Worksheet * @var PHPExcel_Worksheet
*/ */
private $_worksheet; private $worksheet;
/** /**
* Range of the referenced cells * Range of the referenced cells
* *
* @var string * @var string
*/ */
private $_range; private $range;
/** /**
* Is the named range local? (i.e. can only be used on $this->_worksheet) * Is the named range local? (i.e. can only be used on $this->worksheet)
* *
* @var bool * @var bool
*/ */
private $_localOnly; private $localOnly;
/** /**
* Scope * Scope
* *
* @var PHPExcel_Worksheet * @var PHPExcel_Worksheet
*/ */
private $_scope; private $scope;
/** /**
* Create a new NamedRange * Create a new NamedRange
@ -80,12 +80,11 @@ class PHPExcel_NamedRange
} }
// Set local members // Set local members
$this->_name = $pName; $this->name = $pName;
$this->_worksheet = $pWorksheet; $this->worksheet = $pWorksheet;
$this->_range = $pRange; $this->range = $pRange;
$this->_localOnly = $pLocalOnly; $this->localOnly = $pLocalOnly;
$this->_scope = ($pLocalOnly == true) ? $this->scope = ($pLocalOnly == true) ? (($pScope == null) ? $pWorksheet : $pScope) : null;
(($pScope == null) ? $pWorksheet : $pScope) : null;
} }
/** /**
@ -95,7 +94,7 @@ class PHPExcel_NamedRange
*/ */
public function getName() public function getName()
{ {
return $this->_name; return $this->name;
} }
/** /**
@ -108,21 +107,21 @@ class PHPExcel_NamedRange
{ {
if ($value !== null) { if ($value !== null) {
// Old title // Old title
$oldTitle = $this->_name; $oldTitle = $this->name;
// Re-attach // Re-attach
if ($this->_worksheet !== null) { if ($this->worksheet !== null) {
$this->_worksheet->getParent()->removeNamedRange($this->_name, $this->_worksheet); $this->worksheet->getParent()->removeNamedRange($this->name, $this->worksheet);
} }
$this->_name = $value; $this->name = $value;
if ($this->_worksheet !== null) { if ($this->worksheet !== null) {
$this->_worksheet->getParent()->addNamedRange($this); $this->worksheet->getParent()->addNamedRange($this);
} }
// New title // New title
$newTitle = $this->_name; $newTitle = $this->name;
PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_worksheet->getParent(), $oldTitle, $newTitle); PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->worksheet->getParent(), $oldTitle, $newTitle);
} }
return $this; return $this;
} }
@ -134,7 +133,7 @@ class PHPExcel_NamedRange
*/ */
public function getWorksheet() public function getWorksheet()
{ {
return $this->_worksheet; return $this->worksheet;
} }
/** /**
@ -146,7 +145,7 @@ class PHPExcel_NamedRange
public function setWorksheet(PHPExcel_Worksheet $value = null) public function setWorksheet(PHPExcel_Worksheet $value = null)
{ {
if ($value !== null) { if ($value !== null) {
$this->_worksheet = $value; $this->worksheet = $value;
} }
return $this; return $this;
} }
@ -158,7 +157,7 @@ class PHPExcel_NamedRange
*/ */
public function getRange() public function getRange()
{ {
return $this->_range; return $this->range;
} }
/** /**
@ -170,7 +169,7 @@ class PHPExcel_NamedRange
public function setRange($value = null) public function setRange($value = null)
{ {
if ($value !== null) { if ($value !== null) {
$this->_range = $value; $this->range = $value;
} }
return $this; return $this;
} }
@ -182,7 +181,7 @@ class PHPExcel_NamedRange
*/ */
public function getLocalOnly() public function getLocalOnly()
{ {
return $this->_localOnly; return $this->localOnly;
} }
/** /**
@ -193,8 +192,8 @@ class PHPExcel_NamedRange
*/ */
public function setLocalOnly($value = false) public function setLocalOnly($value = false)
{ {
$this->_localOnly = $value; $this->localOnly = $value;
$this->_scope = $value ? $this->_worksheet : null; $this->scope = $value ? $this->worksheet : null;
return $this; return $this;
} }
@ -205,7 +204,7 @@ class PHPExcel_NamedRange
*/ */
public function getScope() public function getScope()
{ {
return $this->_scope; return $this->scope;
} }
/** /**
@ -216,8 +215,8 @@ class PHPExcel_NamedRange
*/ */
public function setScope(PHPExcel_Worksheet $value = null) public function setScope(PHPExcel_Worksheet $value = null)
{ {
$this->_scope = $value; $this->scope = $value;
$this->_localOnly = ($value == null) ? false : true; $this->localOnly = ($value == null) ? false : true;
return $this; return $this;
} }

View File

@ -50,7 +50,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private * @access private
* @var string * @var string
*/ */
private $_inputEncoding = 'UTF-8'; private $inputEncoding = 'UTF-8';
/** /**
* Delimiter * Delimiter
@ -58,7 +58,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private * @access private
* @var string * @var string
*/ */
private $_delimiter = ','; private $delimiter = ',';
/** /**
* Enclosure * Enclosure
@ -66,7 +66,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private * @access private
* @var string * @var string
*/ */
private $_enclosure = '"'; private $enclosure = '"';
/** /**
* Sheet index to read * Sheet index to read
@ -74,7 +74,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private * @access private
* @var int * @var int
*/ */
private $_sheetIndex = 0; private $sheetIndex = 0;
/** /**
* Load rows contiguously * Load rows contiguously
@ -82,21 +82,22 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @access private * @access private
* @var int * @var int
*/ */
private $_contiguous = false; private $contiguous = false;
/** /**
* Row counter for loading rows contiguously * Row counter for loading rows contiguously
* *
* @var int * @var int
*/ */
private $_contiguousRow = -1; private $contiguousRow = -1;
/** /**
* Create a new PHPExcel_Reader_CSV * Create a new PHPExcel_Reader_CSV
*/ */
public function __construct() { public function __construct()
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); {
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
} }
/** /**
@ -106,7 +107,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*/ */
protected function _isValidFormat() protected function _isValidFormat()
{ {
return TRUE; return true;
} }
/** /**
@ -116,7 +117,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*/ */
public function setInputEncoding($pValue = 'UTF-8') public function setInputEncoding($pValue = 'UTF-8')
{ {
$this->_inputEncoding = $pValue; $this->inputEncoding = $pValue;
return $this; return $this;
} }
@ -127,7 +128,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*/ */
public function getInputEncoding() public function getInputEncoding()
{ {
return $this->_inputEncoding; return $this->inputEncoding;
} }
/** /**
@ -138,7 +139,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
{ {
rewind($this->_fileHandle); rewind($this->_fileHandle);
switch ($this->_inputEncoding) { switch ($this->inputEncoding) {
case 'UTF-8': case 'UTF-8':
fgets($this->_fileHandle, 4) == "\xEF\xBB\xBF" ? fgets($this->_fileHandle, 4) == "\xEF\xBB\xBF" ?
fseek($this->_fileHandle, 3) : fseek($this->_fileHandle, 0); fseek($this->_fileHandle, 3) : fseek($this->_fileHandle, 0);
@ -175,7 +176,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
// Open file // Open file
$this->_openFile($pFilename); $this->_openFile($pFilename);
if (!$this->_isValidFormat()) { if (!$this->_isValidFormat()) {
fclose ($this->_fileHandle); fclose($this->_fileHandle);
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
} }
$fileHandle = $this->_fileHandle; $fileHandle = $this->_fileHandle;
@ -183,7 +184,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
// Skip BOM, if any // Skip BOM, if any
$this->_skipBOM(); $this->_skipBOM();
$escapeEnclosures = array( "\\" . $this->_enclosure, $this->_enclosure . $this->_enclosure ); $escapeEnclosures = array( "\\" . $this->enclosure, $this->enclosure . $this->enclosure );
$worksheetInfo = array(); $worksheetInfo = array();
$worksheetInfo[0]['worksheetName'] = 'Worksheet'; $worksheetInfo[0]['worksheetName'] = 'Worksheet';
@ -193,7 +194,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
$worksheetInfo[0]['totalColumns'] = 0; $worksheetInfo[0]['totalColumns'] = 0;
// Loop through each line of the file in turn // Loop through each line of the file in turn
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) { while (($rowData = fgetcsv($fileHandle, 0, $this->delimiter, $this->enclosure)) !== false) {
$worksheetInfo[0]['totalRows']++; $worksheetInfo[0]['totalRows']++;
$worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1); $worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1);
} }
@ -239,7 +240,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
// Open file // Open file
$this->_openFile($pFilename); $this->_openFile($pFilename);
if (!$this->_isValidFormat()) { if (!$this->_isValidFormat()) {
fclose ($this->_fileHandle); fclose($this->_fileHandle);
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
} }
$fileHandle = $this->_fileHandle; $fileHandle = $this->_fileHandle;
@ -248,32 +249,32 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
$this->_skipBOM(); $this->_skipBOM();
// Create new PHPExcel object // Create new PHPExcel object
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) {
$objPHPExcel->createSheet(); $objPHPExcel->createSheet();
} }
$sheet = $objPHPExcel->setActiveSheetIndex($this->_sheetIndex); $sheet = $objPHPExcel->setActiveSheetIndex($this->sheetIndex);
$escapeEnclosures = array( "\\" . $this->_enclosure, $escapeEnclosures = array( "\\" . $this->enclosure,
$this->_enclosure . $this->_enclosure $this->enclosure . $this->enclosure
); );
// Set our starting row based on whether we're in contiguous mode or not // Set our starting row based on whether we're in contiguous mode or not
$currentRow = 1; $currentRow = 1;
if ($this->_contiguous) { if ($this->contiguous) {
$currentRow = ($this->_contiguousRow == -1) ? $sheet->getHighestRow(): $this->_contiguousRow; $currentRow = ($this->contiguousRow == -1) ? $sheet->getHighestRow(): $this->contiguousRow;
} }
// Loop through each line of the file in turn // Loop through each line of the file in turn
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) { while (($rowData = fgetcsv($fileHandle, 0, $this->delimiter, $this->enclosure)) !== false) {
$columnLetter = 'A'; $columnLetter = 'A';
foreach ($rowData as $rowDatum) { foreach ($rowData as $rowDatum) {
if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) { if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) {
// Unescape enclosures // Unescape enclosures
$rowDatum = str_replace($escapeEnclosures, $this->_enclosure, $rowDatum); $rowDatum = str_replace($escapeEnclosures, $this->enclosure, $rowDatum);
// Convert encoding if necessary // Convert encoding if necessary
if ($this->_inputEncoding !== 'UTF-8') { if ($this->inputEncoding !== 'UTF-8') {
$rowDatum = PHPExcel_Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->_inputEncoding); $rowDatum = PHPExcel_Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->inputEncoding);
} }
// Set cell value // Set cell value
@ -287,8 +288,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
// Close file // Close file
fclose($fileHandle); fclose($fileHandle);
if ($this->_contiguous) { if ($this->contiguous) {
$this->_contiguousRow = $currentRow; $this->contiguousRow = $currentRow;
} }
ini_set('auto_detect_line_endings', $lineEnding); ini_set('auto_detect_line_endings', $lineEnding);
@ -302,8 +303,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @return string * @return string
*/ */
public function getDelimiter() { public function getDelimiter()
return $this->_delimiter; {
return $this->delimiter;
} }
/** /**
@ -312,8 +314,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @param string $pValue Delimiter, defaults to , * @param string $pValue Delimiter, defaults to ,
* @return PHPExcel_Reader_CSV * @return PHPExcel_Reader_CSV
*/ */
public function setDelimiter($pValue = ',') { public function setDelimiter($pValue = ',')
$this->_delimiter = $pValue; {
$this->delimiter = $pValue;
return $this; return $this;
} }
@ -322,8 +325,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @return string * @return string
*/ */
public function getEnclosure() { public function getEnclosure()
return $this->_enclosure; {
return $this->enclosure;
} }
/** /**
@ -332,11 +336,12 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @param string $pValue Enclosure, defaults to " * @param string $pValue Enclosure, defaults to "
* @return PHPExcel_Reader_CSV * @return PHPExcel_Reader_CSV
*/ */
public function setEnclosure($pValue = '"') { public function setEnclosure($pValue = '"')
{
if ($pValue == '') { if ($pValue == '') {
$pValue = '"'; $pValue = '"';
} }
$this->_enclosure = $pValue; $this->enclosure = $pValue;
return $this; return $this;
} }
@ -345,8 +350,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @return integer * @return integer
*/ */
public function getSheetIndex() { public function getSheetIndex()
return $this->_sheetIndex; {
return $this->sheetIndex;
} }
/** /**
@ -355,8 +361,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @param integer $pValue Sheet index * @param integer $pValue Sheet index
* @return PHPExcel_Reader_CSV * @return PHPExcel_Reader_CSV
*/ */
public function setSheetIndex($pValue = 0) { public function setSheetIndex($pValue = 0)
$this->_sheetIndex = $pValue; {
$this->sheetIndex = $pValue;
return $this; return $this;
} }
@ -365,11 +372,11 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @param boolean $contiguous * @param boolean $contiguous
*/ */
public function setContiguous($contiguous = FALSE) public function setContiguous($contiguous = false)
{ {
$this->_contiguous = (bool) $contiguous; $this->contiguous = (bool) $contiguous;
if (!$contiguous) { if (!$contiguous) {
$this->_contiguousRow = -1; $this->contiguousRow = -1;
} }
return $this; return $this;
@ -380,8 +387,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @return boolean * @return boolean
*/ */
public function getContiguous() { public function getContiguous()
return $this->_contiguous; {
return $this->contiguous;
} }
} }

View File

@ -52,7 +52,8 @@ class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter
* @param $worksheetName Optional worksheet name * @param $worksheetName Optional worksheet name
* @return boolean * @return boolean
*/ */
public function readCell($column, $row, $worksheetName = '') { public function readCell($column, $row, $worksheetName = '')
{
return true; return true;
} }
} }

View File

@ -1,6 +1,16 @@
<?php <?php
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/** /**
* PHPExcel * PHPExcel_Reader_Excel2003XML
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,24 +34,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_Excel2003XML
*
* @category PHPExcel
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
{ {
/** /**
@ -49,22 +41,21 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
* *
* @var array * @var array
*/ */
protected $_styles = array(); protected $styles = array();
/** /**
* Character set used in the file * Character set used in the file
* *
* @var string * @var string
*/ */
protected $_charSet = 'UTF-8'; protected $charSet = 'UTF-8';
/** /**
* Create a new PHPExcel_Reader_Excel2003XML * Create a new PHPExcel_Reader_Excel2003XML
*/ */
public function __construct() public function __construct()
{ {
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
} }
@ -112,9 +103,9 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
// Retrieve charset encoding // Retrieve charset encoding
if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um', $data, $matches)) { if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um', $data, $matches)) {
$this->_charSet = strtoupper($matches[1]); $this->charSet = strtoupper($matches[1]);
} }
// echo 'Character Set is ', $this->_charSet,'<br />'; // echo 'Character Set is ', $this->charSet,'<br />';
return $valid; return $valid;
} }
@ -144,7 +135,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
$xml_ss = $xml->children($namespaces['ss']); $xml_ss = $xml->children($namespaces['ss']);
foreach ($xml_ss->Worksheet as $worksheet) { foreach ($xml_ss->Worksheet as $worksheet) {
$worksheet_ss = $worksheet->attributes($namespaces['ss']); $worksheet_ss = $worksheet->attributes($namespaces['ss']);
$worksheetNames[] = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->_charSet); $worksheetNames[] = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->charSet);
} }
return $worksheetNames; return $worksheetNames;
@ -239,7 +230,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
return $this->loadIntoExisting($pFilename, $objPHPExcel); return $this->loadIntoExisting($pFilename, $objPHPExcel);
} }
protected static function identifyFixedStyleValue($styleList,&$styleAttributeValue) protected static function identifyFixedStyleValue($styleList, &$styleAttributeValue)
{ {
$styleAttributeValue = strtolower($styleAttributeValue); $styleAttributeValue = strtolower($styleAttributeValue);
foreach ($styleList as $style) { foreach ($styleList as $style) {
@ -251,13 +242,13 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
return false; return false;
} }
/** /**
* pixel units to excel width units(units of 1/256th of a character width) * pixel units to excel width units(units of 1/256th of a character width)
* @param pxs * @param pxs
* @return * @return
*/ */
protected static function _pixel2WidthUnits($pxs) protected static function _pixel2WidthUnits($pxs)
{ {
$UNIT_OFFSET_MAP = array(0, 36, 73, 109, 146, 182, 219); $UNIT_OFFSET_MAP = array(0, 36, 73, 109, 146, 182, 219);
$widthUnits = 256 * ($pxs / 7); $widthUnits = 256 * ($pxs / 7);
@ -337,40 +328,40 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
if (isset($xml->DocumentProperties[0])) { if (isset($xml->DocumentProperties[0])) {
foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) { foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) {
switch ($propertyName) { switch ($propertyName) {
case 'Title' : case 'Title':
$docProps->setTitle(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setTitle(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'Subject' : case 'Subject':
$docProps->setSubject(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setSubject(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'Author' : case 'Author':
$docProps->setCreator(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setCreator(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'Created' : case 'Created':
$creationDate = strtotime($propertyValue); $creationDate = strtotime($propertyValue);
$docProps->setCreated($creationDate); $docProps->setCreated($creationDate);
break; break;
case 'LastAuthor' : case 'LastAuthor':
$docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'LastSaved' : case 'LastSaved':
$lastSaveDate = strtotime($propertyValue); $lastSaveDate = strtotime($propertyValue);
$docProps->setModified($lastSaveDate); $docProps->setModified($lastSaveDate);
break; break;
case 'Company' : case 'Company':
$docProps->setCompany(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setCompany(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'Category' : case 'Category':
$docProps->setCategory(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setCategory(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'Manager' : case 'Manager':
$docProps->setManager(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setManager(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'Keywords' : case 'Keywords':
$docProps->setKeywords(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setKeywords(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
case 'Description' : case 'Description':
$docProps->setDescription(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setDescription(self::_convertStringEncoding($propertyValue, $this->charSet));
break; break;
} }
} }
@ -378,26 +369,26 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
if (isset($xml->CustomDocumentProperties)) { if (isset($xml->CustomDocumentProperties)) {
foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) { foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) {
$propertyAttributes = $propertyValue->attributes($namespaces['dt']); $propertyAttributes = $propertyValue->attributes($namespaces['dt']);
$propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/','PHPExcel_Reader_Excel2003XML::_hex2str', $propertyName); $propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', 'PHPExcel_Reader_Excel2003XML::_hex2str', $propertyName);
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN; $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN;
switch ((string) $propertyAttributes) { switch ((string) $propertyAttributes) {
case 'string' : case 'string':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
$propertyValue = trim($propertyValue); $propertyValue = trim($propertyValue);
break; break;
case 'boolean' : case 'boolean':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN; $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN;
$propertyValue = (bool) $propertyValue; $propertyValue = (bool) $propertyValue;
break; break;
case 'integer' : case 'integer':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_INTEGER; $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_INTEGER;
$propertyValue = intval($propertyValue); $propertyValue = intval($propertyValue);
break; break;
case 'float' : case 'float':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT; $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT;
$propertyValue = floatval($propertyValue); $propertyValue = floatval($propertyValue);
break; break;
case 'dateTime.tz' : case 'dateTime.tz':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE; $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE;
$propertyValue = strtotime(trim($propertyValue)); $propertyValue = strtotime(trim($propertyValue));
break; break;
@ -411,125 +402,125 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
$styleID = (string) $style_ss['ID']; $styleID = (string) $style_ss['ID'];
// echo 'Style ID = '.$styleID.'<br />'; // echo 'Style ID = '.$styleID.'<br />';
if ($styleID == 'Default') { if ($styleID == 'Default') {
$this->_styles['Default'] = array(); $this->styles['Default'] = array();
} else { } else {
$this->_styles[$styleID] = $this->_styles['Default']; $this->styles[$styleID] = $this->styles['Default'];
} }
foreach ($style as $styleType => $styleData) { foreach ($style as $styleType => $styleData) {
$styleAttributes = $styleData->attributes($namespaces['ss']); $styleAttributes = $styleData->attributes($namespaces['ss']);
// echo $styleType.'<br />'; // echo $styleType.'<br />';
switch ($styleType) { switch ($styleType) {
case 'Alignment' : case 'Alignment':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
$styleAttributeValue = (string) $styleAttributeValue; $styleAttributeValue = (string) $styleAttributeValue;
switch ($styleAttributeKey) { switch ($styleAttributeKey) {
case 'Vertical' : case 'Vertical':
if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) { if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) {
$this->_styles[$styleID]['alignment']['vertical'] = $styleAttributeValue; $this->styles[$styleID]['alignment']['vertical'] = $styleAttributeValue;
} }
break; break;
case 'Horizontal' : case 'Horizontal':
if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) { if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) {
$this->_styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue; $this->styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue;
} }
break; break;
case 'WrapText' : case 'WrapText':
$this->_styles[$styleID]['alignment']['wrap'] = true; $this->styles[$styleID]['alignment']['wrap'] = true;
break; break;
} }
} }
break; break;
case 'Borders' : case 'Borders':
foreach ($styleData->Border as $borderStyle) { foreach ($styleData->Border as $borderStyle) {
$borderAttributes = $borderStyle->attributes($namespaces['ss']); $borderAttributes = $borderStyle->attributes($namespaces['ss']);
$thisBorder = array(); $thisBorder = array();
foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) { foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) {
// echo $borderStyleKey.' = '.$borderStyleValue.'<br />'; // echo $borderStyleKey.' = '.$borderStyleValue.'<br />';
switch ($borderStyleKey) { switch ($borderStyleKey) {
case 'LineStyle' : case 'LineStyle':
$thisBorder['style'] = PHPExcel_Style_Border::BORDER_MEDIUM; $thisBorder['style'] = PHPExcel_Style_Border::BORDER_MEDIUM;
// $thisBorder['style'] = $borderStyleValue; // $thisBorder['style'] = $borderStyleValue;
break; break;
case 'Weight' : case 'Weight':
// $thisBorder['style'] = $borderStyleValue; // $thisBorder['style'] = $borderStyleValue;
break; break;
case 'Position' : case 'Position':
$borderPosition = strtolower($borderStyleValue); $borderPosition = strtolower($borderStyleValue);
break; break;
case 'Color' : case 'Color':
$borderColour = substr($borderStyleValue,1); $borderColour = substr($borderStyleValue, 1);
$thisBorder['color']['rgb'] = $borderColour; $thisBorder['color']['rgb'] = $borderColour;
break; break;
} }
} }
if (!empty($thisBorder)) { if (!empty($thisBorder)) {
if (($borderPosition == 'left') || ($borderPosition == 'right') || ($borderPosition == 'top') || ($borderPosition == 'bottom')) { if (($borderPosition == 'left') || ($borderPosition == 'right') || ($borderPosition == 'top') || ($borderPosition == 'bottom')) {
$this->_styles[$styleID]['borders'][$borderPosition] = $thisBorder; $this->styles[$styleID]['borders'][$borderPosition] = $thisBorder;
} }
} }
} }
break; break;
case 'Font' : case 'Font':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
$styleAttributeValue = (string) $styleAttributeValue; $styleAttributeValue = (string) $styleAttributeValue;
switch ($styleAttributeKey) { switch ($styleAttributeKey) {
case 'FontName' : case 'FontName':
$this->_styles[$styleID]['font']['name'] = $styleAttributeValue; $this->styles[$styleID]['font']['name'] = $styleAttributeValue;
break; break;
case 'Size' : case 'Size':
$this->_styles[$styleID]['font']['size'] = $styleAttributeValue; $this->styles[$styleID]['font']['size'] = $styleAttributeValue;
break; break;
case 'Color' : case 'Color':
$this->_styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue,1); $this->styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue, 1);
break; break;
case 'Bold' : case 'Bold':
$this->_styles[$styleID]['font']['bold'] = true; $this->styles[$styleID]['font']['bold'] = true;
break; break;
case 'Italic' : case 'Italic':
$this->_styles[$styleID]['font']['italic'] = true; $this->styles[$styleID]['font']['italic'] = true;
break; break;
case 'Underline' : case 'Underline':
if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) { if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) {
$this->_styles[$styleID]['font']['underline'] = $styleAttributeValue; $this->styles[$styleID]['font']['underline'] = $styleAttributeValue;
} }
break; break;
} }
} }
break; break;
case 'Interior' : case 'Interior':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
switch ($styleAttributeKey) { switch ($styleAttributeKey) {
case 'Color' : case 'Color':
$this->_styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue,1); $this->styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue, 1);
break; break;
} }
} }
break; break;
case 'NumberFormat' : case 'NumberFormat':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
$styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue); $styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue);
switch ($styleAttributeValue) { switch ($styleAttributeValue) {
case 'Short Date' : case 'Short Date':
$styleAttributeValue = 'dd/mm/yyyy'; $styleAttributeValue = 'dd/mm/yyyy';
break; break;
} }
if ($styleAttributeValue > '') { if ($styleAttributeValue > '') {
$this->_styles[$styleID]['numberformat']['code'] = $styleAttributeValue; $this->styles[$styleID]['numberformat']['code'] = $styleAttributeValue;
} }
} }
break; break;
case 'Protection' : case 'Protection':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
} }
break; break;
} }
} }
// print_r($this->_styles[$styleID]); // print_r($this->styles[$styleID]);
// echo '<hr />'; // echo '<hr />';
} }
// echo '<hr />'; // echo '<hr />';
@ -551,11 +542,11 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
$objPHPExcel->createSheet(); $objPHPExcel->createSheet();
$objPHPExcel->setActiveSheetIndex($worksheetID); $objPHPExcel->setActiveSheetIndex($worksheetID);
if (isset($worksheet_ss['Name'])) { if (isset($worksheet_ss['Name'])) {
$worksheetName = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->_charSet); $worksheetName = self::_convertStringEncoding((string) $worksheet_ss['Name'], $this->charSet);
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in
// formula cells... during the load, all formulae should be correct, and we're simply bringing // 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 reverse // the worksheet name in line with the formula, not the reverse
$objPHPExcel->getActiveSheet()->setTitle($worksheetName,false); $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
} }
$columnID = 'A'; $columnID = 'A';
@ -640,26 +631,26 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
const TYPE_INLINE = 'inlineStr'; const TYPE_INLINE = 'inlineStr';
const TYPE_ERROR = 'e'; const TYPE_ERROR = 'e';
*/ */
case 'String' : case 'String':
$cellValue = self::_convertStringEncoding($cellValue, $this->_charSet); $cellValue = self::_convertStringEncoding($cellValue, $this->charSet);
$type = PHPExcel_Cell_DataType::TYPE_STRING; $type = PHPExcel_Cell_DataType::TYPE_STRING;
break; break;
case 'Number' : case 'Number':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$cellValue = (float) $cellValue; $cellValue = (float) $cellValue;
if (floor($cellValue) == $cellValue) { if (floor($cellValue) == $cellValue) {
$cellValue = (integer) $cellValue; $cellValue = (integer) $cellValue;
} }
break; break;
case 'Boolean' : case 'Boolean':
$type = PHPExcel_Cell_DataType::TYPE_BOOL; $type = PHPExcel_Cell_DataType::TYPE_BOOL;
$cellValue = ($cellValue != 0); $cellValue = ($cellValue != 0);
break; break;
case 'DateTime' : case 'DateTime':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$cellValue = PHPExcel_Shared_Date::PHPToExcel(strtotime($cellValue)); $cellValue = PHPExcel_Shared_Date::PHPToExcel(strtotime($cellValue));
break; break;
case 'Error' : case 'Error':
$type = PHPExcel_Cell_DataType::TYPE_ERROR; $type = PHPExcel_Cell_DataType::TYPE_ERROR;
break; break;
} }
@ -669,15 +660,15 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
// echo 'FORMULA<br />'; // echo 'FORMULA<br />';
$type = PHPExcel_Cell_DataType::TYPE_FORMULA; $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
$columnNumber = PHPExcel_Cell::columnIndexFromString($columnID); $columnNumber = PHPExcel_Cell::columnIndexFromString($columnID);
if (substr($cellDataFormula,0,3) == 'of:') { if (substr($cellDataFormula, 0, 3) == 'of:') {
$cellDataFormula = substr($cellDataFormula,3); $cellDataFormula = substr($cellDataFormula, 3);
// echo 'Before: ', $cellDataFormula,'<br />'; // echo 'Before: ', $cellDataFormula,'<br />';
$temp = explode('"', $cellDataFormula); $temp = explode('"', $cellDataFormula);
$key = false; $key = false;
foreach ($temp as &$value) { foreach ($temp as &$value) {
// Only replace in alternate array entries (i.e. non-quoted blocks) // Only replace in alternate array entries (i.e. non-quoted blocks)
if ($key = !$key) { if ($key = !$key) {
$value = str_replace(array('[.','.',']'),'', $value); $value = str_replace(array('[.', '.', ']'), '', $value);
} }
} }
} else { } else {
@ -688,7 +679,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
foreach ($temp as &$value) { foreach ($temp as &$value) {
// Only replace in alternate array entries (i.e. non-quoted blocks) // Only replace in alternate array entries (i.e. non-quoted blocks)
if ($key = !$key) { if ($key = !$key) {
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE); preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER + PREG_OFFSET_CAPTURE);
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way // Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
// through the formula from left to right. Reversing means that we work right to left.through // through the formula from left to right. Reversing means that we work right to left.through
// the formula // the formula
@ -703,7 +694,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
} }
// Bracketed R references are relative to the current row // Bracketed R references are relative to the current row
if ($rowReference{0} == '[') { if ($rowReference{0} == '[') {
$rowReference = $rowID + trim($rowReference,'[]'); $rowReference = $rowID + trim($rowReference, '[]');
} }
$columnReference = $cellReference[4][0]; $columnReference = $cellReference[4][0];
// Empty C reference is the current column // Empty C reference is the current column
@ -712,10 +703,10 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
} }
// Bracketed C references are relative to the current column // Bracketed C references are relative to the current column
if ($columnReference{0} == '[') { if ($columnReference{0} == '[') {
$columnReference = $columnNumber + trim($columnReference,'[]'); $columnReference = $columnNumber + 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]));
} }
} }
} }
@ -749,20 +740,20 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
// echo $annotation,'<br />'; // echo $annotation,'<br />';
$annotation = strip_tags($node); $annotation = strip_tags($node);
// echo 'Annotation: ', $annotation,'<br />'; // echo 'Annotation: ', $annotation,'<br />';
$objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setAuthor(self::_convertStringEncoding($author , $this->_charSet))->setText($this->_parseRichText($annotation) ); $objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setAuthor(self::_convertStringEncoding($author, $this->charSet))->setText($this->_parseRichText($annotation));
} }
if (($cellIsSet) && (isset($cell_ss['StyleID']))) { if (($cellIsSet) && (isset($cell_ss['StyleID']))) {
$style = (string) $cell_ss['StyleID']; $style = (string) $cell_ss['StyleID'];
// echo 'Cell style for '.$columnID.$rowID.' is '.$style.'<br />'; // echo 'Cell style for '.$columnID.$rowID.' is '.$style.'<br />';
if ((isset($this->_styles[$style])) && (!empty($this->_styles[$style]))) { if ((isset($this->styles[$style])) && (!empty($this->styles[$style]))) {
// echo 'Cell '.$columnID.$rowID.'<br />'; // echo 'Cell '.$columnID.$rowID.'<br />';
// print_r($this->_styles[$style]); // print_r($this->styles[$style]);
// echo '<br />'; // echo '<br />';
if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) { if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) {
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(null); $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(null);
} }
$objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->_styles[$style]); $objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->styles[$style]);
} }
} }
++$columnID; ++$columnID;
@ -807,7 +798,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
{ {
$value = new PHPExcel_RichText(); $value = new PHPExcel_RichText();
$value->createText(self::_convertStringEncoding($is, $this->_charSet)); $value->createText(self::_convertStringEncoding($is, $this->charSet));
return $value; return $value;
} }

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,8 @@
*/ */
class PHPExcel_Reader_Excel2007_Chart class PHPExcel_Reader_Excel2007_Chart
{ {
private static function _getAttribute($component, $name, $format) { private static function getAttribute($component, $name, $format)
{
$attributes = $component->attributes(); $attributes = $component->attributes();
if (isset($attributes[$name])) { if (isset($attributes[$name])) {
if ($format == 'string') { if ($format == 'string') {
@ -48,24 +49,25 @@ class PHPExcel_Reader_Excel2007_Chart
} }
} }
return null; return null;
} // function _getAttribute() }
private static function _readColor($color, $background=false) { private static function readColor($color, $background = false)
{
if (isset($color["rgb"])) { if (isset($color["rgb"])) {
return (string)$color["rgb"]; return (string)$color["rgb"];
} else if (isset($color["indexed"])) { } elseif (isset($color["indexed"])) {
return PHPExcel_Style_Color::indexedColor($color["indexed"]-7, $background)->getARGB(); return PHPExcel_Style_Color::indexedColor($color["indexed"]-7, $background)->getARGB();
} }
} }
public static function readChart($chartElements, $chartName)
public static function readChart($chartElements, $chartName) { {
$namespacesChartMeta = $chartElements->getNamespaces(true); $namespacesChartMeta = $chartElements->getNamespaces(true);
$chartElementsC = $chartElements->children($namespacesChartMeta['c']); $chartElementsC = $chartElements->children($namespacesChartMeta['c']);
$XaxisLabel = $YaxisLabel = $legend = $title = NULL; $XaxisLabel = $YaxisLabel = $legend = $title = null;
$dispBlanksAs = $plotVisOnly = NULL; $dispBlanksAs = $plotVisOnly = null;
foreach ($chartElementsC as $chartElementKey => $chartElement) { foreach ($chartElementsC as $chartElementKey => $chartElement) {
switch ($chartElementKey) { switch ($chartElementKey) {
@ -74,124 +76,124 @@ class PHPExcel_Reader_Excel2007_Chart
$chartDetailsC = $chartDetails->children($namespacesChartMeta['c']); $chartDetailsC = $chartDetails->children($namespacesChartMeta['c']);
switch ($chartDetailsKey) { switch ($chartDetailsKey) {
case "plotArea": case "plotArea":
$plotAreaLayout = $XaxisLable = $YaxisLable = null; $plotAreaLayout = $XaxisLable = $YaxisLable = null;
$plotSeries = $plotAttributes = array(); $plotSeries = $plotAttributes = array();
foreach ($chartDetails as $chartDetailKey => $chartDetail) { foreach ($chartDetails as $chartDetailKey => $chartDetail) {
switch ($chartDetailKey) { switch ($chartDetailKey) {
case "layout": case "layout":
$plotAreaLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta,'plotArea'); $plotAreaLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta, 'plotArea');
break; break;
case "catAx": case "catAx":
if (isset($chartDetail->title)) { if (isset($chartDetail->title)) {
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat'); $XaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
} }
break; break;
case "dateAx": case "dateAx":
if (isset($chartDetail->title)) { if (isset($chartDetail->title)) {
$XaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat'); $XaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
} }
break; break;
case "valAx": case "valAx":
if (isset($chartDetail->title)) { if (isset($chartDetail->title)) {
$YaxisLabel = self::_chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta,'cat'); $YaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
} }
break; break;
case "barChart": case "barChart":
case "bar3DChart": case "bar3DChart":
$barDirection = self::_getAttribute($chartDetail->barDir, 'val', 'string'); $barDirection = self::getAttribute($chartDetail->barDir, 'val', 'string');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotDirection($barDirection); $plotSer->setPlotDirection($barDirection);
$plotSeries[] = $plotSer; $plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "lineChart": case "lineChart":
case "line3DChart": case "line3DChart":
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "areaChart": case "areaChart":
case "area3DChart": case "area3DChart":
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "doughnutChart": case "doughnutChart":
case "pieChart": case "pieChart":
case "pie3DChart": case "pie3DChart":
$explosion = isset($chartDetail->ser->explosion); $explosion = isset($chartDetail->ser->explosion);
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($explosion); $plotSer->setPlotStyle($explosion);
$plotSeries[] = $plotSer; $plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "scatterChart": case "scatterChart":
$scatterStyle = self::_getAttribute($chartDetail->scatterStyle, 'val', 'string'); $scatterStyle = self::getAttribute($chartDetail->scatterStyle, 'val', 'string');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($scatterStyle); $plotSer->setPlotStyle($scatterStyle);
$plotSeries[] = $plotSer; $plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "bubbleChart": case "bubbleChart":
$bubbleScale = self::_getAttribute($chartDetail->bubbleScale, 'val', 'integer'); $bubbleScale = self::getAttribute($chartDetail->bubbleScale, 'val', 'integer');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($bubbleScale); $plotSer->setPlotStyle($bubbleScale);
$plotSeries[] = $plotSer; $plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "radarChart": case "radarChart":
$radarStyle = self::_getAttribute($chartDetail->radarStyle, 'val', 'string'); $radarStyle = self::getAttribute($chartDetail->radarStyle, 'val', 'string');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($radarStyle); $plotSer->setPlotStyle($radarStyle);
$plotSeries[] = $plotSer; $plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "surfaceChart": case "surfaceChart":
case "surface3DChart": case "surface3DChart":
$wireFrame = self::_getAttribute($chartDetail->wireframe, 'val', 'boolean'); $wireFrame = self::getAttribute($chartDetail->wireframe, 'val', 'boolean');
$plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotSer->setPlotStyle($wireFrame); $plotSer->setPlotStyle($wireFrame);
$plotSeries[] = $plotSer; $plotSeries[] = $plotSer;
$plotAttributes = self::_readChartAttributes($chartDetail); $plotAttributes = self::readChartAttributes($chartDetail);
break; break;
case "stockChart": case "stockChart":
$plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
$plotAttributes = self::_readChartAttributes($plotAreaLayout); $plotAttributes = self::readChartAttributes($plotAreaLayout);
break; break;
}
} }
if ($plotAreaLayout == NULL) { }
$plotAreaLayout = new PHPExcel_Chart_Layout(); if ($plotAreaLayout == null) {
} $plotAreaLayout = new PHPExcel_Chart_Layout();
$plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout, $plotSeries); }
self::_setChartAttributes($plotAreaLayout, $plotAttributes); $plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout, $plotSeries);
break; self::setChartAttributes($plotAreaLayout, $plotAttributes);
break;
case "plotVisOnly": case "plotVisOnly":
$plotVisOnly = self::_getAttribute($chartDetails, 'val', 'string'); $plotVisOnly = self::getAttribute($chartDetails, 'val', 'string');
break; break;
case "dispBlanksAs": case "dispBlanksAs":
$dispBlanksAs = self::_getAttribute($chartDetails, 'val', 'string'); $dispBlanksAs = self::getAttribute($chartDetails, 'val', 'string');
break; break;
case "title": case "title":
$title = self::_chartTitle($chartDetails, $namespacesChartMeta,'title'); $title = self::chartTitle($chartDetails, $namespacesChartMeta, 'title');
break; break;
case "legend": case "legend":
$legendPos = 'r'; $legendPos = 'r';
$legendLayout = null; $legendLayout = null;
$legendOverlay = false; $legendOverlay = false;
foreach ($chartDetails as $chartDetailKey => $chartDetail) { foreach ($chartDetails as $chartDetailKey => $chartDetail) {
switch ($chartDetailKey) { switch ($chartDetailKey) {
case "legendPos": case "legendPos":
$legendPos = self::_getAttribute($chartDetail, 'val', 'string'); $legendPos = self::getAttribute($chartDetail, 'val', 'string');
break; break;
case "overlay": case "overlay":
$legendOverlay = self::_getAttribute($chartDetail, 'val', 'boolean'); $legendOverlay = self::getAttribute($chartDetail, 'val', 'boolean');
break; break;
case "layout": case "layout":
$legendLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta,'legend'); $legendLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta, 'legend');
break; break;
}
} }
$legend = new PHPExcel_Chart_Legend($legendPos, $legendLayout, $legendOverlay); }
break; $legend = new PHPExcel_Chart_Legend($legendPos, $legendLayout, $legendOverlay);
break;
} }
} }
} }
@ -199,10 +201,10 @@ class PHPExcel_Reader_Excel2007_Chart
$chart = new PHPExcel_Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel); $chart = new PHPExcel_Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel);
return $chart; return $chart;
} // function readChart() }
private static function chartTitle($titleDetails, $namespacesChartMeta, $type)
private static function _chartTitle($titleDetails, $namespacesChartMeta, $type) { {
$caption = array(); $caption = array();
$titleLayout = null; $titleLayout = null;
foreach ($titleDetails as $titleDetailKey => $chartDetail) { foreach ($titleDetails as $titleDetailKey => $chartDetail) {
@ -213,21 +215,21 @@ class PHPExcel_Reader_Excel2007_Chart
switch ($titleKey) { switch ($titleKey) {
case "p": case "p":
$titleDetailPart = $titleDetail->children($namespacesChartMeta['a']); $titleDetailPart = $titleDetail->children($namespacesChartMeta['a']);
$caption[] = self::_parseRichText($titleDetailPart); $caption[] = self::parseRichText($titleDetailPart);
} }
} }
break; break;
case "layout": case "layout":
$titleLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta); $titleLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta);
break; break;
} }
} }
return new PHPExcel_Chart_Title($caption, $titleLayout); return new PHPExcel_Chart_Title($caption, $titleLayout);
} // function _chartTitle() }
private static function chartLayoutDetails($chartDetail, $namespacesChartMeta)
private static function _chartLayoutDetails($chartDetail, $namespacesChartMeta) { {
if (!isset($chartDetail->manualLayout)) { if (!isset($chartDetail->manualLayout)) {
return null; return null;
} }
@ -237,15 +239,15 @@ class PHPExcel_Reader_Excel2007_Chart
} }
$layout = array(); $layout = array();
foreach ($details as $detailKey => $detail) { foreach ($details as $detailKey => $detail) {
// echo $detailKey,' => ',self::_getAttribute($detail, 'val', 'string'),PHP_EOL; // echo $detailKey, ' => ',self::getAttribute($detail, 'val', 'string'),PHP_EOL;
$layout[$detailKey] = self::_getAttribute($detail, 'val', 'string'); $layout[$detailKey] = self::getAttribute($detail, 'val', 'string');
} }
return new PHPExcel_Chart_Layout($layout); return new PHPExcel_Chart_Layout($layout);
} // function _chartLayoutDetails() }
private static function chartDataSeries($chartDetail, $namespacesChartMeta, $plotType)
private static function _chartDataSeries($chartDetail, $namespacesChartMeta, $plotType) { {
$multiSeriesType = NULL; $multiSeriesType = null;
$smoothLine = false; $smoothLine = false;
$seriesLabel = $seriesCategory = $seriesValues = $plotOrder = array(); $seriesLabel = $seriesCategory = $seriesValues = $plotOrder = array();
@ -253,77 +255,79 @@ class PHPExcel_Reader_Excel2007_Chart
foreach ($seriesDetailSet as $seriesDetailKey => $seriesDetails) { foreach ($seriesDetailSet as $seriesDetailKey => $seriesDetails) {
switch ($seriesDetailKey) { switch ($seriesDetailKey) {
case "grouping": case "grouping":
$multiSeriesType = self::_getAttribute($chartDetail->grouping, 'val', 'string'); $multiSeriesType = self::getAttribute($chartDetail->grouping, 'val', 'string');
break; break;
case "ser": case "ser":
$marker = NULL; $marker = null;
foreach ($seriesDetails as $seriesKey => $seriesDetail) { foreach ($seriesDetails as $seriesKey => $seriesDetail) {
switch ($seriesKey) { switch ($seriesKey) {
case "idx": case "idx":
$seriesIndex = self::_getAttribute($seriesDetail, 'val', 'integer'); $seriesIndex = self::getAttribute($seriesDetail, 'val', 'integer');
break; break;
case "order": case "order":
$seriesOrder = self::_getAttribute($seriesDetail, 'val', 'integer'); $seriesOrder = self::getAttribute($seriesDetail, 'val', 'integer');
$plotOrder[$seriesIndex] = $seriesOrder; $plotOrder[$seriesIndex] = $seriesOrder;
break; break;
case "tx": case "tx":
$seriesLabel[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta); $seriesLabel[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
break; break;
case "marker": case "marker":
$marker = self::_getAttribute($seriesDetail->symbol, 'val', 'string'); $marker = self::getAttribute($seriesDetail->symbol, 'val', 'string');
break; break;
case "smooth": case "smooth":
$smoothLine = self::_getAttribute($seriesDetail, 'val', 'boolean'); $smoothLine = self::getAttribute($seriesDetail, 'val', 'boolean');
break; break;
case "cat": case "cat":
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta); $seriesCategory[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
break; break;
case "val": case "val":
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); $seriesValues[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
break; break;
case "xVal": case "xVal":
$seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); $seriesCategory[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
break; break;
case "yVal": case "yVal":
$seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); $seriesValues[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
break; break;
} }
} }
} }
} }
return new PHPExcel_Chart_DataSeries($plotType, $multiSeriesType, $plotOrder, $seriesLabel, $seriesCategory, $seriesValues, $smoothLine); return new PHPExcel_Chart_DataSeries($plotType, $multiSeriesType, $plotOrder, $seriesLabel, $seriesCategory, $seriesValues, $smoothLine);
} // function _chartDataSeries() }
private static function _chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker = null, $smoothLine = false) { private static function chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker = null, $smoothLine = false)
{
if (isset($seriesDetail->strRef)) { if (isset($seriesDetail->strRef)) {
$seriesSource = (string) $seriesDetail->strRef->f; $seriesSource = (string) $seriesDetail->strRef->f;
$seriesData = self::_chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']),'s'); $seriesData = self::chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']), 's');
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->numRef)) { } elseif (isset($seriesDetail->numRef)) {
$seriesSource = (string) $seriesDetail->numRef->f; $seriesSource = (string) $seriesDetail->numRef->f;
$seriesData = self::_chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c'])); $seriesData = self::chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c']));
return new PHPExcel_Chart_DataSeriesValues('Number', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); return new PHPExcel_Chart_DataSeriesValues('Number', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->multiLvlStrRef)) { } elseif (isset($seriesDetail->multiLvlStrRef)) {
$seriesSource = (string) $seriesDetail->multiLvlStrRef->f; $seriesSource = (string) $seriesDetail->multiLvlStrRef->f;
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']),'s'); $seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']), 's');
$seriesData['pointCount'] = count($seriesData['dataValues']); $seriesData['pointCount'] = count($seriesData['dataValues']);
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} elseif (isset($seriesDetail->multiLvlNumRef)) { } elseif (isset($seriesDetail->multiLvlNumRef)) {
$seriesSource = (string) $seriesDetail->multiLvlNumRef->f; $seriesSource = (string) $seriesDetail->multiLvlNumRef->f;
$seriesData = self::_chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']),'s'); $seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']), 's');
$seriesData['pointCount'] = count($seriesData['dataValues']); $seriesData['pointCount'] = count($seriesData['dataValues']);
return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
} }
return null; return null;
} // function _chartDataSeriesValueSet() }
private static function _chartDataSeriesValues($seriesValueSet, $dataType='n') { private static function chartDataSeriesValues($seriesValueSet, $dataType = 'n')
{
$seriesVal = array(); $seriesVal = array();
$formatCode = ''; $formatCode = '';
$pointCount = 0; $pointCount = 0;
@ -331,13 +335,13 @@ class PHPExcel_Reader_Excel2007_Chart
foreach ($seriesValueSet as $seriesValueIdx => $seriesValue) { foreach ($seriesValueSet as $seriesValueIdx => $seriesValue) {
switch ($seriesValueIdx) { switch ($seriesValueIdx) {
case 'ptCount': case 'ptCount':
$pointCount = self::_getAttribute($seriesValue, 'val', 'integer'); $pointCount = self::getAttribute($seriesValue, 'val', 'integer');
break; break;
case 'formatCode': case 'formatCode':
$formatCode = (string) $seriesValue; $formatCode = (string) $seriesValue;
break; break;
case 'pt': case 'pt':
$pointVal = self::_getAttribute($seriesValue, 'idx', 'integer'); $pointVal = self::getAttribute($seriesValue, 'idx', 'integer');
if ($dataType == 's') { if ($dataType == 's') {
$seriesVal[$pointVal] = (string) $seriesValue->v; $seriesVal[$pointVal] = (string) $seriesValue->v;
} else { } else {
@ -348,17 +352,18 @@ class PHPExcel_Reader_Excel2007_Chart
} }
if (empty($seriesVal)) { if (empty($seriesVal)) {
$seriesVal = NULL; $seriesVal = null;
} }
return array( 'formatCode' => $formatCode, return array(
'pointCount' => $pointCount, 'formatCode' => $formatCode,
'dataValues' => $seriesVal 'pointCount' => $pointCount,
); 'dataValues' => $seriesVal
} // function _chartDataSeriesValues() );
}
private static function chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType = 'n')
private static function _chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType='n') { {
$seriesVal = array(); $seriesVal = array();
$formatCode = ''; $formatCode = '';
$pointCount = 0; $pointCount = 0;
@ -367,13 +372,13 @@ class PHPExcel_Reader_Excel2007_Chart
foreach ($seriesLevel as $seriesValueIdx => $seriesValue) { foreach ($seriesLevel as $seriesValueIdx => $seriesValue) {
switch ($seriesValueIdx) { switch ($seriesValueIdx) {
case 'ptCount': case 'ptCount':
$pointCount = self::_getAttribute($seriesValue, 'val', 'integer'); $pointCount = self::getAttribute($seriesValue, 'val', 'integer');
break; break;
case 'formatCode': case 'formatCode':
$formatCode = (string) $seriesValue; $formatCode = (string) $seriesValue;
break; break;
case 'pt': case 'pt':
$pointVal = self::_getAttribute($seriesValue, 'idx', 'integer'); $pointVal = self::getAttribute($seriesValue, 'idx', 'integer');
if ($dataType == 's') { if ($dataType == 's') {
$seriesVal[$pointVal][] = (string) $seriesValue->v; $seriesVal[$pointVal][] = (string) $seriesValue->v;
} else { } else {
@ -384,45 +389,47 @@ class PHPExcel_Reader_Excel2007_Chart
} }
} }
return array( 'formatCode' => $formatCode, return array(
'pointCount' => $pointCount, 'formatCode' => $formatCode,
'dataValues' => $seriesVal 'pointCount' => $pointCount,
); 'dataValues' => $seriesVal
} // function _chartDataSeriesValuesMultiLevel() );
}
private static function _parseRichText($titleDetailPart = null) { private static function parseRichText($titleDetailPart = null)
{
$value = new PHPExcel_RichText(); $value = new PHPExcel_RichText();
foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) { foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
if (isset($titleDetailElement->t)) { if (isset($titleDetailElement->t)) {
$objText = $value->createTextRun( (string) $titleDetailElement->t ); $objText = $value->createTextRun((string) $titleDetailElement->t);
} }
if (isset($titleDetailElement->rPr)) { if (isset($titleDetailElement->rPr)) {
if (isset($titleDetailElement->rPr->rFont["val"])) { if (isset($titleDetailElement->rPr->rFont["val"])) {
$objText->getFont()->setName((string) $titleDetailElement->rPr->rFont["val"]); $objText->getFont()->setName((string) $titleDetailElement->rPr->rFont["val"]);
} }
$fontSize = (self::_getAttribute($titleDetailElement->rPr, 'sz', 'integer')); $fontSize = (self::getAttribute($titleDetailElement->rPr, 'sz', 'integer'));
if (!is_null($fontSize)) { if (!is_null($fontSize)) {
$objText->getFont()->setSize(floor($fontSize / 100)); $objText->getFont()->setSize(floor($fontSize / 100));
} }
$fontColor = (self::_getAttribute($titleDetailElement->rPr, 'color', 'string')); $fontColor = (self::getAttribute($titleDetailElement->rPr, 'color', 'string'));
if (!is_null($fontColor)) { if (!is_null($fontColor)) {
$objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($fontColor) ) ); $objText->getFont()->setColor(new PHPExcel_Style_Color(self::readColor($fontColor)));
} }
$bold = self::_getAttribute($titleDetailElement->rPr, 'b', 'boolean'); $bold = self::getAttribute($titleDetailElement->rPr, 'b', 'boolean');
if (!is_null($bold)) { if (!is_null($bold)) {
$objText->getFont()->setBold($bold); $objText->getFont()->setBold($bold);
} }
$italic = self::_getAttribute($titleDetailElement->rPr, 'i', 'boolean'); $italic = self::getAttribute($titleDetailElement->rPr, 'i', 'boolean');
if (!is_null($italic)) { if (!is_null($italic)) {
$objText->getFont()->setItalic($italic); $objText->getFont()->setItalic($italic);
} }
$baseline = self::_getAttribute($titleDetailElement->rPr, 'baseline', 'integer'); $baseline = self::getAttribute($titleDetailElement->rPr, 'baseline', 'integer');
if (!is_null($baseline)) { if (!is_null($baseline)) {
if ($baseline > 0) { if ($baseline > 0) {
$objText->getFont()->setSuperScript(true); $objText->getFont()->setSuperScript(true);
@ -431,7 +438,7 @@ class PHPExcel_Reader_Excel2007_Chart
} }
} }
$underscore = (self::_getAttribute($titleDetailElement->rPr, 'u', 'string')); $underscore = (self::getAttribute($titleDetailElement->rPr, 'u', 'string'));
if (!is_null($underscore)) { if (!is_null($underscore)) {
if ($underscore == 'sng') { if ($underscore == 'sng') {
$objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
@ -442,7 +449,7 @@ class PHPExcel_Reader_Excel2007_Chart
} }
} }
$strikethrough = (self::_getAttribute($titleDetailElement->rPr, 's', 'string')); $strikethrough = (self::getAttribute($titleDetailElement->rPr, 's', 'string'));
if (!is_null($strikethrough)) { if (!is_null($strikethrough)) {
if ($strikethrough == 'noStrike') { if ($strikethrough == 'noStrike') {
$objText->getFont()->setStrikethrough(false); $objText->getFont()->setStrikethrough(false);
@ -456,62 +463,62 @@ class PHPExcel_Reader_Excel2007_Chart
return $value; return $value;
} }
private static function _readChartAttributes($chartDetail) { private static function readChartAttributes($chartDetail)
{
$plotAttributes = array(); $plotAttributes = array();
if (isset($chartDetail->dLbls)) { if (isset($chartDetail->dLbls)) {
if (isset($chartDetail->dLbls->howLegendKey)) { if (isset($chartDetail->dLbls->howLegendKey)) {
$plotAttributes['showLegendKey'] = self::_getAttribute($chartDetail->dLbls->showLegendKey, 'val', 'string'); $plotAttributes['showLegendKey'] = self::getAttribute($chartDetail->dLbls->showLegendKey, 'val', 'string');
} }
if (isset($chartDetail->dLbls->showVal)) { if (isset($chartDetail->dLbls->showVal)) {
$plotAttributes['showVal'] = self::_getAttribute($chartDetail->dLbls->showVal, 'val', 'string'); $plotAttributes['showVal'] = self::getAttribute($chartDetail->dLbls->showVal, 'val', 'string');
} }
if (isset($chartDetail->dLbls->showCatName)) { if (isset($chartDetail->dLbls->showCatName)) {
$plotAttributes['showCatName'] = self::_getAttribute($chartDetail->dLbls->showCatName, 'val', 'string'); $plotAttributes['showCatName'] = self::getAttribute($chartDetail->dLbls->showCatName, 'val', 'string');
} }
if (isset($chartDetail->dLbls->showSerName)) { if (isset($chartDetail->dLbls->showSerName)) {
$plotAttributes['showSerName'] = self::_getAttribute($chartDetail->dLbls->showSerName, 'val', 'string'); $plotAttributes['showSerName'] = self::getAttribute($chartDetail->dLbls->showSerName, 'val', 'string');
} }
if (isset($chartDetail->dLbls->showPercent)) { if (isset($chartDetail->dLbls->showPercent)) {
$plotAttributes['showPercent'] = self::_getAttribute($chartDetail->dLbls->showPercent, 'val', 'string'); $plotAttributes['showPercent'] = self::getAttribute($chartDetail->dLbls->showPercent, 'val', 'string');
} }
if (isset($chartDetail->dLbls->showBubbleSize)) { if (isset($chartDetail->dLbls->showBubbleSize)) {
$plotAttributes['showBubbleSize'] = self::_getAttribute($chartDetail->dLbls->showBubbleSize, 'val', 'string'); $plotAttributes['showBubbleSize'] = self::getAttribute($chartDetail->dLbls->showBubbleSize, 'val', 'string');
} }
if (isset($chartDetail->dLbls->showLeaderLines)) { if (isset($chartDetail->dLbls->showLeaderLines)) {
$plotAttributes['showLeaderLines'] = self::_getAttribute($chartDetail->dLbls->showLeaderLines, 'val', 'string'); $plotAttributes['showLeaderLines'] = self::getAttribute($chartDetail->dLbls->showLeaderLines, 'val', 'string');
} }
} }
return $plotAttributes; return $plotAttributes;
} }
private static function _setChartAttributes($plotArea, $plotAttributes) private static function setChartAttributes($plotArea, $plotAttributes)
{ {
foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) { foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) {
switch ($plotAttributeKey) { switch ($plotAttributeKey) {
case 'showLegendKey' : case 'showLegendKey':
$plotArea->setShowLegendKey($plotAttributeValue); $plotArea->setShowLegendKey($plotAttributeValue);
break; break;
case 'showVal' : case 'showVal':
$plotArea->setShowVal($plotAttributeValue); $plotArea->setShowVal($plotAttributeValue);
break; break;
case 'showCatName' : case 'showCatName':
$plotArea->setShowCatName($plotAttributeValue); $plotArea->setShowCatName($plotAttributeValue);
break; break;
case 'showSerName' : case 'showSerName':
$plotArea->setShowSerName($plotAttributeValue); $plotArea->setShowSerName($plotAttributeValue);
break; break;
case 'showPercent' : case 'showPercent':
$plotArea->setShowPercent($plotAttributeValue); $plotArea->setShowPercent($plotAttributeValue);
break; break;
case 'showBubbleSize' : case 'showBubbleSize':
$plotArea->setShowBubbleSize($plotAttributeValue); $plotArea->setShowBubbleSize($plotAttributeValue);
break; break;
case 'showLeaderLines' : case 'showLeaderLines':
$plotArea->setShowLeaderLines($plotAttributeValue); $plotArea->setShowLeaderLines($plotAttributeValue);
break; break;
} }
} }
} }
} }

View File

@ -40,21 +40,21 @@ class PHPExcel_Reader_Excel2007_Theme
* *
* @var string * @var string
*/ */
private $_themeName; private $themeName;
/** /**
* Colour Scheme Name * Colour Scheme Name
* *
* @var string * @var string
*/ */
private $_colourSchemeName; private $colourSchemeName;
/** /**
* Colour Map indexed by position * Colour Map indexed by position
* *
* @var array of string * @var array of string
*/ */
private $_colourMapValues; private $colourMapValues;
/** /**
@ -62,7 +62,7 @@ class PHPExcel_Reader_Excel2007_Theme
* *
* @var array of string * @var array of string
*/ */
private $_colourMap; private $colourMap;
/** /**
@ -72,9 +72,9 @@ class PHPExcel_Reader_Excel2007_Theme
public function __construct($themeName, $colourSchemeName, $colourMap) public function __construct($themeName, $colourSchemeName, $colourMap)
{ {
// Initialise values // Initialise values
$this->_themeName = $themeName; $this->themeName = $themeName;
$this->_colourSchemeName = $colourSchemeName; $this->colourSchemeName = $colourSchemeName;
$this->_colourMap = $colourMap; $this->colourMap = $colourMap;
} }
/** /**
@ -84,7 +84,7 @@ class PHPExcel_Reader_Excel2007_Theme
*/ */
public function getThemeName() public function getThemeName()
{ {
return $this->_themeName; return $this->themeName;
} }
/** /**
@ -92,8 +92,9 @@ class PHPExcel_Reader_Excel2007_Theme
* *
* @return string * @return string
*/ */
public function getColourSchemeName() { public function getColourSchemeName()
return $this->_colourSchemeName; {
return $this->colourSchemeName;
} }
/** /**
@ -101,9 +102,10 @@ class PHPExcel_Reader_Excel2007_Theme
* *
* @return string * @return string
*/ */
public function getColourByIndex($index=0) { public function getColourByIndex($index = 0)
if (isset($this->_colourMap[$index])) { {
return $this->_colourMap[$index]; if (isset($this->colourMap[$index])) {
return $this->colourMap[$index];
} }
return null; return null;
} }
@ -111,7 +113,8 @@ class PHPExcel_Reader_Excel2007_Theme
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if ((is_object($value)) && ($key != '_parent')) { if ((is_object($value)) && ($key != '_parent')) {

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Reader_Excel5_Escher
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,62 +25,54 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Reader_Excel5_Escher
*
* @category PHPExcel
* @package PHPExcel_Reader_Excel5
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel5_Escher class PHPExcel_Reader_Excel5_Escher
{ {
const DGGCONTAINER = 0xF000; const DGGCONTAINER = 0xF000;
const BSTORECONTAINER = 0xF001; const BSTORECONTAINER = 0xF001;
const DGCONTAINER = 0xF002; const DGCONTAINER = 0xF002;
const SPGRCONTAINER = 0xF003; const SPGRCONTAINER = 0xF003;
const SPCONTAINER = 0xF004; const SPCONTAINER = 0xF004;
const DGG = 0xF006; const DGG = 0xF006;
const BSE = 0xF007; const BSE = 0xF007;
const DG = 0xF008; const DG = 0xF008;
const SPGR = 0xF009; const SPGR = 0xF009;
const SP = 0xF00A; const SP = 0xF00A;
const OPT = 0xF00B; const OPT = 0xF00B;
const CLIENTTEXTBOX = 0xF00D; const CLIENTTEXTBOX = 0xF00D;
const CLIENTANCHOR = 0xF010; const CLIENTANCHOR = 0xF010;
const CLIENTDATA = 0xF011; const CLIENTDATA = 0xF011;
const BLIPJPEG = 0xF01D; const BLIPJPEG = 0xF01D;
const BLIPPNG = 0xF01E; const BLIPPNG = 0xF01E;
const SPLITMENUCOLORS = 0xF11E; const SPLITMENUCOLORS = 0xF11E;
const TERTIARYOPT = 0xF122; const TERTIARYOPT = 0xF122;
/** /**
* Escher stream data (binary) * Escher stream data (binary)
* *
* @var string * @var string
*/ */
private $_data; private $data;
/** /**
* Size in bytes of the Escher stream data * Size in bytes of the Escher stream data
* *
* @var int * @var int
*/ */
private $_dataSize; private $dataSize;
/** /**
* Current position of stream pointer in Escher stream data * Current position of stream pointer in Escher stream data
* *
* @var int * @var int
*/ */
private $_pos; private $pos;
/** /**
* The object to be returned by the reader. Modified during load. * The object to be returned by the reader. Modified during load.
* *
* @var mixed * @var mixed
*/ */
private $_object; private $object;
/** /**
* Create a new PHPExcel_Reader_Excel5_Escher instance * Create a new PHPExcel_Reader_Excel5_Escher instance
@ -88,7 +81,7 @@ class PHPExcel_Reader_Excel5_Escher
*/ */
public function __construct($object) public function __construct($object)
{ {
$this->_object = $object; $this->object = $object;
} }
/** /**
@ -98,80 +91,117 @@ class PHPExcel_Reader_Excel5_Escher
*/ */
public function load($data) public function load($data)
{ {
$this->_data = $data; $this->data = $data;
// total byte size of Excel data (workbook global substream + sheet substreams) // total byte size of Excel data (workbook global substream + sheet substreams)
$this->_dataSize = strlen($this->_data); $this->dataSize = strlen($this->data);
$this->_pos = 0; $this->pos = 0;
// Parse Escher stream // Parse Escher stream
while ($this->_pos < $this->_dataSize) { while ($this->pos < $this->dataSize) {
// offset: 2; size: 2: Record Type // offset: 2; size: 2: Record Type
$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;
} }
} }
return $this->_object; return $this->object;
} }
/** /**
* Read a generic record * Read a generic record
*/ */
private function _readDefault() private function readDefault()
{ {
// offset 0; size: 2; recVer and recInstance // offset 0; size: 2; recVer and recInstance
$verInstance = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos); $verInstance = PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos);
// offset: 2; size: 2: Record Type // offset: 2; size: 2: Record Type
$fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2); $fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos + 2);
// bit: 0-3; mask: 0x000F; recVer // bit: 0-3; mask: 0x000F; recVer
$recVer = (0x000F & $verInstance) >> 0; $recVer = (0x000F & $verInstance) >> 0;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read DggContainer record (Drawing Group Container) * Read DggContainer record (Drawing Group Container)
*/ */
private function _readDggContainer() private function readDggContainer()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$dggContainer = new PHPExcel_Shared_Escher_DggContainer(); $dggContainer = new PHPExcel_Shared_Escher_DggContainer();
$this->_object->setDggContainer($dggContainer); $this->object->setDggContainer($dggContainer);
$reader = new PHPExcel_Reader_Excel5_Escher($dggContainer); $reader = new PHPExcel_Reader_Excel5_Escher($dggContainer);
$reader->load($recordData); $reader->load($recordData);
} }
@ -179,29 +209,29 @@ class PHPExcel_Reader_Excel5_Escher
/** /**
* Read Dgg record (Drawing Group) * Read Dgg record (Drawing Group)
*/ */
private function _readDgg() private function readDgg()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read BstoreContainer record (Blip Store Container) * Read BstoreContainer record (Blip Store Container)
*/ */
private function _readBstoreContainer() private function readBstoreContainer()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer(); $bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer();
$this->_object->setBstoreContainer($bstoreContainer); $this->object->setBstoreContainer($bstoreContainer);
$reader = new PHPExcel_Reader_Excel5_Escher($bstoreContainer); $reader = new PHPExcel_Reader_Excel5_Escher($bstoreContainer);
$reader->load($recordData); $reader->load($recordData);
} }
@ -209,22 +239,22 @@ class PHPExcel_Reader_Excel5_Escher
/** /**
* Read BSE record * Read BSE record
*/ */
private function _readBSE() private function readBSE()
{ {
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
// add BSE to BstoreContainer // add BSE to BstoreContainer
$BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE(); $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE();
$this->_object->addBSE($BSE); $this->object->addBSE($BSE);
$BSE->setBLIPType($recInstance); $BSE->setBLIPType($recInstance);
@ -275,18 +305,18 @@ class PHPExcel_Reader_Excel5_Escher
/** /**
* Read BlipJPEG record. Holds raw JPEG image data * Read BlipJPEG record. Holds raw JPEG image data
*/ */
private function _readBlipJPEG() private function readBlipJPEG()
{ {
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
$pos = 0; $pos = 0;
@ -310,24 +340,24 @@ class PHPExcel_Reader_Excel5_Escher
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
$blip->setData($data); $blip->setData($data);
$this->_object->setBlip($blip); $this->object->setBlip($blip);
} }
/** /**
* Read BlipPNG record. Holds raw PNG image data * Read BlipPNG record. Holds raw PNG image data
*/ */
private function _readBlipPNG() private function readBlipPNG()
{ {
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
$pos = 0; $pos = 0;
@ -351,71 +381,71 @@ class PHPExcel_Reader_Excel5_Escher
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
$blip->setData($data); $blip->setData($data);
$this->_object->setBlip($blip); $this->object->setBlip($blip);
} }
/** /**
* Read OPT record. This record may occur within DggContainer record or SpContainer * Read OPT record. This record may occur within DggContainer record or SpContainer
*/ */
private function _readOPT() private function readOPT()
{ {
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
$this->_readOfficeArtRGFOPTE($recordData, $recInstance); $this->readOfficeArtRGFOPTE($recordData, $recInstance);
} }
/** /**
* Read TertiaryOPT record * Read TertiaryOPT record
*/ */
private function _readTertiaryOPT() private function readTertiaryOPT()
{ {
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read SplitMenuColors record * Read SplitMenuColors record
*/ */
private function _readSplitMenuColors() private function readSplitMenuColors()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read DgContainer record (Drawing Container) * Read DgContainer record (Drawing Container)
*/ */
private function _readDgContainer() private function readDgContainer()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$dgContainer = new PHPExcel_Shared_Escher_DgContainer(); $dgContainer = new PHPExcel_Shared_Escher_DgContainer();
$this->_object->setDgContainer($dgContainer); $this->object->setDgContainer($dgContainer);
$reader = new PHPExcel_Reader_Excel5_Escher($dgContainer); $reader = new PHPExcel_Reader_Excel5_Escher($dgContainer);
$escher = $reader->load($recordData); $escher = $reader->load($recordData);
} }
@ -423,37 +453,37 @@ class PHPExcel_Reader_Excel5_Escher
/** /**
* Read Dg record (Drawing) * Read Dg record (Drawing)
*/ */
private function _readDg() private function readDg()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read SpgrContainer record (Shape Group Container) * Read SpgrContainer record (Shape Group Container)
*/ */
private function _readSpgrContainer() private function readSpgrContainer()
{ {
// context is either context DgContainer or SpgrContainer // context is either context DgContainer or SpgrContainer
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer(); $spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer();
if ($this->_object instanceof PHPExcel_Shared_Escher_DgContainer) { if ($this->object instanceof PHPExcel_Shared_Escher_DgContainer) {
// DgContainer // DgContainer
$this->_object->setSpgrContainer($spgrContainer); $this->object->setSpgrContainer($spgrContainer);
} else { } else {
// SpgrContainer // SpgrContainer
$this->_object->addChild($spgrContainer); $this->object->addChild($spgrContainer);
} }
$reader = new PHPExcel_Reader_Excel5_Escher($spgrContainer); $reader = new PHPExcel_Reader_Excel5_Escher($spgrContainer);
@ -463,17 +493,17 @@ class PHPExcel_Reader_Excel5_Escher
/** /**
* Read SpContainer record (Shape Container) * Read SpContainer record (Shape Container)
*/ */
private function _readSpContainer() private function readSpContainer()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// add spContainer to spgrContainer // add spContainer to spgrContainer
$spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer(); $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
$this->_object->addChild($spContainer); $this->object->addChild($spContainer);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
// record is a container, read contents // record is a container, read contents
$reader = new PHPExcel_Reader_Excel5_Escher($spContainer); $reader = new PHPExcel_Reader_Excel5_Escher($spContainer);
@ -483,59 +513,59 @@ class PHPExcel_Reader_Excel5_Escher
/** /**
* Read Spgr record (Shape Group) * Read Spgr record (Shape Group)
*/ */
private function _readSpgr() private function readSpgr()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read Sp record (Shape) * Read Sp record (Shape)
*/ */
private function _readSp() private function readSp()
{ {
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read ClientTextbox record * Read ClientTextbox record
*/ */
private function _readClientTextbox() private function readClientTextbox()
{ {
// offset: 0; size: 2; recVer and recInstance // offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance // bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4; $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->data, $this->pos)) >> 4;
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
* Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet * Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet
*/ */
private function _readClientAnchor() private function readClientAnchor()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
// offset: 2; size: 2; upper-left corner column index (0-based) // offset: 2; size: 2; upper-left corner column index (0-based)
$c1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 2); $c1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 2);
@ -562,34 +592,34 @@ class PHPExcel_Reader_Excel5_Escher
$endOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 16); $endOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 16);
// set the start coordinates // set the start coordinates
$this->_object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1)); $this->object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1));
// set the start offsetX // set the start offsetX
$this->_object->setStartOffsetX($startOffsetX); $this->object->setStartOffsetX($startOffsetX);
// set the start offsetY // set the start offsetY
$this->_object->setStartOffsetY($startOffsetY); $this->object->setStartOffsetY($startOffsetY);
// set the end coordinates // set the end coordinates
$this->_object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1)); $this->object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1));
// set the end offsetX // set the end offsetX
$this->_object->setEndOffsetX($endOffsetX); $this->object->setEndOffsetX($endOffsetX);
// set the end offsetY // set the end offsetY
$this->_object->setEndOffsetY($endOffsetY); $this->object->setEndOffsetY($endOffsetY);
} }
/** /**
* Read ClientData record * Read ClientData record
*/ */
private function _readClientData() private function readClientData()
{ {
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length); $recordData = substr($this->data, $this->pos + 8, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 8 + $length; $this->pos += 8 + $length;
} }
/** /**
@ -598,8 +628,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
@ -633,8 +663,7 @@ class PHPExcel_Reader_Excel5_Escher
$value = $op; $value = $op;
} }
$this->_object->setOPT($opidOpid, $value); $this->object->setOPT($opidOpid, $value);
} }
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Reader_Excel5_MD5
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Reader_Excel5_MD5
*
* @category PHPExcel
* @package PHPExcel_Reader_Excel5
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel5_MD5 class PHPExcel_Reader_Excel5_MD5
{ {
// Context // Context
@ -41,7 +33,6 @@ class PHPExcel_Reader_Excel5_MD5
private $c; private $c;
private $d; private $d;
/** /**
* MD5 stream constructor * MD5 stream constructor
*/ */
@ -50,7 +41,6 @@ class PHPExcel_Reader_Excel5_MD5
$this->reset(); $this->reset();
} }
/** /**
* Reset the MD5 stream context * Reset the MD5 stream context
*/ */
@ -62,7 +52,6 @@ class PHPExcel_Reader_Excel5_MD5
$this->d = 0x10325476; $this->d = 0x10325476;
} }
/** /**
* Get MD5 stream context * Get MD5 stream context
* *
@ -82,7 +71,6 @@ class PHPExcel_Reader_Excel5_MD5
return $s; return $s;
} }
/** /**
* Add data to context * Add data to context
* *
@ -180,31 +168,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 +195,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);

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Reader_Excel5_RC4
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,20 +25,12 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Reader_Excel5_RC4
*
* @category PHPExcel
* @package PHPExcel_Reader_Excel5
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Excel5_RC4 class PHPExcel_Reader_Excel5_RC4
{ {
// Context // Context
var $s = array(); protected $s = array();
var $i = 0; protected $i = 0;
var $j = 0; protected $j = 0;
/** /**
* RC4 stream decryption/encryption constrcutor * RC4 stream decryption/encryption constrcutor

View File

@ -1,6 +1,16 @@
<?php <?php
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/** /**
* PHPExcel * PHPExcel_Reader_Gnumeric
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,24 +34,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_Gnumeric
*
* @category PHPExcel
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
{ {
/** /**
@ -49,27 +41,26 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
* *
* @var array * @var array
*/ */
private $_styles = array(); private $styles = array();
/** /**
* Shared Expressions * Shared Expressions
* *
* @var array * @var array
*/ */
private $_expressions = array(); private $expressions = array();
private $_referenceHelper = null;
private $referenceHelper = null;
/** /**
* Create a new PHPExcel_Reader_Gnumeric * Create a new PHPExcel_Reader_Gnumeric
*/ */
public function __construct() { public function __construct()
{
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
$this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance(); $this->referenceHelper = PHPExcel_ReferenceHelper::getInstance();
} }
/** /**
* Can the current PHPExcel_Reader_IReader read the file? * Can the current PHPExcel_Reader_IReader read the file?
* *
@ -101,7 +92,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return true; return true;
} }
/** /**
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
* *
@ -116,10 +106,8 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
} }
$xml = new XMLReader(); $xml = new XMLReader();
$xml->xml( $xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions());
$this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions() $xml->setParserProperty(2, true);
);
$xml->setParserProperty(2,true);
$worksheetNames = array(); $worksheetNames = array();
while ($xml->read()) { while ($xml->read()) {
@ -135,7 +123,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $worksheetNames; return $worksheetNames;
} }
/** /**
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
* *
@ -150,10 +137,8 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
} }
$xml = new XMLReader(); $xml = new XMLReader();
$xml->xml( $xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions());
$this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions() $xml->setParserProperty(2, true);
);
$xml->setParserProperty(2,true);
$worksheetInfo = array(); $worksheetInfo = array();
while ($xml->read()) { while ($xml->read()) {
@ -188,8 +173,8 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $worksheetInfo; return $worksheetInfo;
} }
private function _gzfileGetContents($filename)
private function _gzfileGetContents($filename) { {
$file = @gzopen($filename, 'rb'); $file = @gzopen($filename, 'rb');
if ($file !== false) { if ($file !== false) {
$data = ''; $data = '';
@ -201,7 +186,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $data; return $data;
} }
/** /**
* Loads PHPExcel from file * Loads PHPExcel from file
* *
@ -218,7 +202,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $this->loadIntoExisting($pFilename, $objPHPExcel); return $this->loadIntoExisting($pFilename, $objPHPExcel);
} }
/** /**
* Loads PHPExcel from file into PHPExcel instance * Loads PHPExcel from file into PHPExcel instance
* *
@ -258,7 +241,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$officeDocMetaXML = $officeDocXML->meta; $officeDocMetaXML = $officeDocXML->meta;
foreach ($officeDocMetaXML as $officePropertyData) { foreach ($officeDocMetaXML as $officePropertyData) {
$officePropertyDC = array(); $officePropertyDC = array();
if (isset($namespacesMeta['dc'])) { if (isset($namespacesMeta['dc'])) {
$officePropertyDC = $officePropertyData->children($namespacesMeta['dc']); $officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
@ -266,24 +248,24 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
foreach ($officePropertyDC as $propertyName => $propertyValue) { foreach ($officePropertyDC as $propertyName => $propertyValue) {
$propertyValue = (string) $propertyValue; $propertyValue = (string) $propertyValue;
switch ($propertyName) { switch ($propertyName) {
case 'title' : case 'title':
$docProps->setTitle(trim($propertyValue)); $docProps->setTitle(trim($propertyValue));
break; break;
case 'subject' : case 'subject':
$docProps->setSubject(trim($propertyValue)); $docProps->setSubject(trim($propertyValue));
break; break;
case 'creator' : case 'creator':
$docProps->setCreator(trim($propertyValue)); $docProps->setCreator(trim($propertyValue));
$docProps->setLastModifiedBy(trim($propertyValue)); $docProps->setLastModifiedBy(trim($propertyValue));
break; break;
case 'date' : case 'date':
$creationDate = strtotime(trim($propertyValue)); $creationDate = strtotime(trim($propertyValue));
$docProps->setCreated($creationDate); $docProps->setCreated($creationDate);
$docProps->setModified($creationDate); $docProps->setModified($creationDate);
break; break;
case 'description' : case 'description':
$docProps->setDescription(trim($propertyValue)); $docProps->setDescription(trim($propertyValue));
break; break;
} }
} }
$officePropertyMeta = array(); $officePropertyMeta = array();
@ -294,32 +276,32 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$attributes = $propertyValue->attributes($namespacesMeta['meta']); $attributes = $propertyValue->attributes($namespacesMeta['meta']);
$propertyValue = (string) $propertyValue; $propertyValue = (string) $propertyValue;
switch ($propertyName) { switch ($propertyName) {
case 'keyword' : case 'keyword':
$docProps->setKeywords(trim($propertyValue)); $docProps->setKeywords(trim($propertyValue));
break; break;
case 'initial-creator' : case 'initial-creator':
$docProps->setCreator(trim($propertyValue)); $docProps->setCreator(trim($propertyValue));
$docProps->setLastModifiedBy(trim($propertyValue)); $docProps->setLastModifiedBy(trim($propertyValue));
break; break;
case 'creation-date' : case 'creation-date':
$creationDate = strtotime(trim($propertyValue)); $creationDate = strtotime(trim($propertyValue));
$docProps->setCreated($creationDate); $docProps->setCreated($creationDate);
$docProps->setModified($creationDate); $docProps->setModified($creationDate);
break; break;
case 'user-defined' : case 'user-defined':
list(, $attrName) = explode(':', $attributes['name']); list(, $attrName) = explode(':', $attributes['name']);
switch ($attrName) { switch ($attrName) {
case 'publisher' : case 'publisher':
$docProps->setCompany(trim($propertyValue)); $docProps->setCompany(trim($propertyValue));
break; break;
case 'category' : case 'category':
$docProps->setCategory(trim($propertyValue)); $docProps->setCategory(trim($propertyValue));
break; break;
case 'manager' : case 'manager':
$docProps->setManager(trim($propertyValue)); $docProps->setManager(trim($propertyValue));
break; break;
} }
break; break;
} }
} }
} }
@ -328,26 +310,26 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$propertyName = $summaryItem->name; $propertyName = $summaryItem->name;
$propertyValue = $summaryItem->{'val-string'}; $propertyValue = $summaryItem->{'val-string'};
switch ($propertyName) { switch ($propertyName) {
case 'title' : case 'title':
$docProps->setTitle(trim($propertyValue)); $docProps->setTitle(trim($propertyValue));
break; break;
case 'comments' : case 'comments':
$docProps->setDescription(trim($propertyValue)); $docProps->setDescription(trim($propertyValue));
break; break;
case 'keywords' : case 'keywords':
$docProps->setKeywords(trim($propertyValue)); $docProps->setKeywords(trim($propertyValue));
break; break;
case 'category' : case 'category':
$docProps->setCategory(trim($propertyValue)); $docProps->setCategory(trim($propertyValue));
break; break;
case 'manager' : case 'manager':
$docProps->setManager(trim($propertyValue)); $docProps->setManager(trim($propertyValue));
break; break;
case 'author' : case 'author':
$docProps->setCreator(trim($propertyValue)); $docProps->setCreator(trim($propertyValue));
$docProps->setLastModifiedBy(trim($propertyValue)); $docProps->setLastModifiedBy(trim($propertyValue));
break; break;
case 'company' : case 'company':
$docProps->setCompany(trim($propertyValue)); $docProps->setCompany(trim($propertyValue));
break; break;
} }
@ -370,35 +352,35 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in formula // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in formula
// cells... during the load, all formulae should be correct, and we're simply bringing the worksheet // cells... during the load, all formulae should be correct, and we're simply bringing the worksheet
// name in line with the formula, not the reverse // name in line with the formula, not the reverse
$objPHPExcel->getActiveSheet()->setTitle($worksheetName,false); $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
if ((!$this->_readDataOnly) && (isset($sheet->PrintInformation))) { if ((!$this->_readDataOnly) && (isset($sheet->PrintInformation))) {
if (isset($sheet->PrintInformation->Margins)) { if (isset($sheet->PrintInformation->Margins)) {
foreach ($sheet->PrintInformation->Margins->children('gnm',TRUE) as $key => $margin) { foreach ($sheet->PrintInformation->Margins->children('gnm', true) as $key => $margin) {
$marginAttributes = $margin->attributes(); $marginAttributes = $margin->attributes();
$marginSize = 72 / 100; // Default $marginSize = 72 / 100; // Default
switch ($marginAttributes['PrefUnit']) { switch ($marginAttributes['PrefUnit']) {
case 'mm' : case 'mm':
$marginSize = intval($marginAttributes['Points']) / 100; $marginSize = intval($marginAttributes['Points']) / 100;
break; break;
} }
switch ($key) { switch ($key) {
case 'top' : case 'top':
$objPHPExcel->getActiveSheet()->getPageMargins()->setTop($marginSize); $objPHPExcel->getActiveSheet()->getPageMargins()->setTop($marginSize);
break; break;
case 'bottom' : case 'bottom':
$objPHPExcel->getActiveSheet()->getPageMargins()->setBottom($marginSize); $objPHPExcel->getActiveSheet()->getPageMargins()->setBottom($marginSize);
break; break;
case 'left' : case 'left':
$objPHPExcel->getActiveSheet()->getPageMargins()->setLeft($marginSize); $objPHPExcel->getActiveSheet()->getPageMargins()->setLeft($marginSize);
break; break;
case 'right' : case 'right':
$objPHPExcel->getActiveSheet()->getPageMargins()->setRight($marginSize); $objPHPExcel->getActiveSheet()->getPageMargins()->setRight($marginSize);
break; break;
case 'header' : case 'header':
$objPHPExcel->getActiveSheet()->getPageMargins()->setHeader($marginSize); $objPHPExcel->getActiveSheet()->getPageMargins()->setHeader($marginSize);
break; break;
case 'footer' : case 'footer':
$objPHPExcel->getActiveSheet()->getPageMargins()->setFooter($marginSize); $objPHPExcel->getActiveSheet()->getPageMargins()->setFooter($marginSize);
break; break;
} }
@ -411,13 +393,17 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$row = (int) $cellAttributes->Row + 1; $row = (int) $cellAttributes->Row + 1;
$column = (int) $cellAttributes->Col; $column = (int) $cellAttributes->Col;
if ($row > $maxRow) $maxRow = $row; if ($row > $maxRow) {
if ($column > $maxCol) $maxCol = $column; $maxRow = $row;
}
if ($column > $maxCol) {
$maxCol = $column;
}
$column = PHPExcel_Cell::stringFromColumnIndex($column); $column = PHPExcel_Cell::stringFromColumnIndex($column);
// Read cell? // Read cell?
if ($this->getReadFilter() !== NULL) { if ($this->getReadFilter() !== null) {
if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) { if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) {
continue; continue;
} }
@ -431,60 +417,53 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$type = PHPExcel_Cell_DataType::TYPE_FORMULA; $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
if ($ExprID > '') { if ($ExprID > '') {
if (((string) $cell) > '') { if (((string) $cell) > '') {
$this->expressions[$ExprID] = array(
$this->_expressions[$ExprID] = array( 'column' => $cellAttributes->Col, 'column' => $cellAttributes->Col,
'row' => $cellAttributes->Row, 'row' => $cellAttributes->Row,
'formula' => (string) $cell 'formula' => (string) $cell
); );
// echo 'NEW EXPRESSION ', $ExprID,'<br />'; // echo 'NEW EXPRESSION ', $ExprID,'<br />';
} else { } else {
$expression = $this->_expressions[$ExprID]; $expression = $this->expressions[$ExprID];
$cell = $this->_referenceHelper->updateFormulaReferences( $expression['formula'], $cell = $this->referenceHelper->updateFormulaReferences($expression['formula'], 'A1', $cellAttributes->Col - $expression['column'], $cellAttributes->Row - $expression['row'], $worksheetName);
'A1',
$cellAttributes->Col - $expression['column'],
$cellAttributes->Row - $expression['row'],
$worksheetName
);
// echo 'SHARED EXPRESSION ', $ExprID,'<br />'; // echo 'SHARED EXPRESSION ', $ExprID,'<br />';
// echo 'New Value is ', $cell,'<br />'; // echo 'New Value is ', $cell,'<br />';
} }
$type = PHPExcel_Cell_DataType::TYPE_FORMULA; $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
} else { } else {
switch ($ValueType) { switch ($ValueType) {
case '10' : // NULL case '10': // NULL
$type = PHPExcel_Cell_DataType::TYPE_NULL; $type = PHPExcel_Cell_DataType::TYPE_NULL;
break; break;
case '20' : // Boolean case '20': // Boolean
$type = PHPExcel_Cell_DataType::TYPE_BOOL; $type = PHPExcel_Cell_DataType::TYPE_BOOL;
$cell = ($cell == 'TRUE') ? True : False; $cell = ($cell == 'TRUE') ? true: false;
break; break;
case '30' : // Integer case '30': // Integer
$cell = intval($cell); $cell = intval($cell);
case '40' : // Float case '40': // Float
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
break; break;
case '50' : // Error case '50': // Error
$type = PHPExcel_Cell_DataType::TYPE_ERROR; $type = PHPExcel_Cell_DataType::TYPE_ERROR;
break; break;
case '60' : // String case '60': // String
$type = PHPExcel_Cell_DataType::TYPE_STRING; $type = PHPExcel_Cell_DataType::TYPE_STRING;
break; break;
case '70' : // Cell Range case '70': // Cell Range
case '80' : // Array case '80': // Array
} }
} }
$objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell, $type); $objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell, $type);
} }
if ((!$this->_readDataOnly) && (isset($sheet->Objects))) { if ((!$this->_readDataOnly) && (isset($sheet->Objects))) {
foreach ($sheet->Objects->children('gnm',TRUE) as $key => $comment) { foreach ($sheet->Objects->children('gnm', true) as $key => $comment) {
$commentAttributes = $comment->attributes(); $commentAttributes = $comment->attributes();
// Only comment objects are handled at the moment // Only comment objects are handled at the moment
if ($commentAttributes->Text) { if ($commentAttributes->Text) {
$objPHPExcel->getActiveSheet()->getComment( (string)$commentAttributes->ObjectBound ) $objPHPExcel->getActiveSheet()->getComment((string)$commentAttributes->ObjectBound)->setAuthor((string)$commentAttributes->Author)->setText($this->_parseRichText((string)$commentAttributes->Text));
->setAuthor( (string)$commentAttributes->Author )
->setText($this->_parseRichText((string)$commentAttributes->Text) );
} }
} }
} }
@ -494,7 +473,6 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$styleAttributes = $styleRegion->attributes(); $styleAttributes = $styleRegion->attributes();
if (($styleAttributes['startRow'] <= $maxRow) && if (($styleAttributes['startRow'] <= $maxRow) &&
($styleAttributes['startCol'] <= $maxCol)) { ($styleAttributes['startCol'] <= $maxCol)) {
$startColumn = PHPExcel_Cell::stringFromColumnIndex((int) $styleAttributes['startCol']); $startColumn = PHPExcel_Cell::stringFromColumnIndex((int) $styleAttributes['startCol']);
$startRow = $styleAttributes['startRow'] + 1; $startRow = $styleAttributes['startRow'] + 1;
@ -517,44 +495,44 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
// If _readDataOnly is false, we set all formatting information // If _readDataOnly is false, we set all formatting information
if (!$this->_readDataOnly) { if (!$this->_readDataOnly) {
switch ($styleAttributes['HAlign']) { switch ($styleAttributes['HAlign']) {
case '1' : case '1':
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
break; break;
case '2' : case '2':
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_LEFT; $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_LEFT;
break; break;
case '4' : case '4':
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_RIGHT; $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_RIGHT;
break; break;
case '8' : case '8':
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER; $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER;
break; break;
case '16' : case '16':
case '64' : case '64':
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS; $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS;
break; break;
case '32' : case '32':
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY; $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY;
break; break;
} }
switch ($styleAttributes['VAlign']) { switch ($styleAttributes['VAlign']) {
case '1' : case '1':
$styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_TOP; $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_TOP;
break; break;
case '2' : case '2':
$styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
break; break;
case '4' : case '4':
$styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_CENTER; $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_CENTER;
break; break;
case '8' : case '8':
$styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_JUSTIFY; $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_JUSTIFY;
break; break;
} }
$styleArray['alignment']['wrap'] = ($styleAttributes['WrapText'] == '1') ? True : False; $styleArray['alignment']['wrap'] = ($styleAttributes['WrapText'] == '1') ? true : false;
$styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? True : False; $styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? true : false;
$styleArray['alignment']['indent'] = (intval($styleAttributes["Indent"]) > 0) ? $styleAttributes["indent"] : 0; $styleArray['alignment']['indent'] = (intval($styleAttributes["Indent"]) > 0) ? $styleAttributes["indent"] : 0;
$RGB = self::_parseGnumericColour($styleAttributes["Fore"]); $RGB = self::_parseGnumericColour($styleAttributes["Fore"]);
@ -566,64 +544,64 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$RGB2 = self::_parseGnumericColour($styleAttributes["PatternColor"]); $RGB2 = self::_parseGnumericColour($styleAttributes["PatternColor"]);
$styleArray['fill']['endcolor']['rgb'] = $RGB2; $styleArray['fill']['endcolor']['rgb'] = $RGB2;
switch ($shade) { switch ($shade) {
case '1' : case '1':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_SOLID; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_SOLID;
break; break;
case '2' : case '2':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR;
break; break;
case '3' : case '3':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_PATH; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_PATH;
break; break;
case '4' : case '4':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN;
break; break;
case '5' : case '5':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY;
break; break;
case '6' : case '6':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID;
break; break;
case '7' : case '7':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL;
break; break;
case '8' : case '8':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS;
break; break;
case '9' : case '9':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKUP; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKUP;
break; break;
case '10' : case '10':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL;
break; break;
case '11' : case '11':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625;
break; break;
case '12' : case '12':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY125; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY125;
break; break;
case '13' : case '13':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN;
break; break;
case '14' : case '14':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY;
break; break;
case '15' : case '15':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID;
break; break;
case '16' : case '16':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL;
break; break;
case '17' : case '17':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS;
break; break;
case '18' : case '18':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP;
break; break;
case '19' : case '19':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL;
break; break;
case '20' : case '20':
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY; $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY;
break; break;
} }
@ -634,32 +612,32 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
// echo '<br />'; // echo '<br />';
$styleArray['font']['name'] = (string) $styleRegion->Style->Font; $styleArray['font']['name'] = (string) $styleRegion->Style->Font;
$styleArray['font']['size'] = intval($fontAttributes['Unit']); $styleArray['font']['size'] = intval($fontAttributes['Unit']);
$styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? True : False; $styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? true : false;
$styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? True : False; $styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? true : false;
$styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? True : False; $styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? true : false;
switch ($fontAttributes['Underline']) { switch ($fontAttributes['Underline']) {
case '1' : case '1':
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLE; $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLE;
break; break;
case '2' : case '2':
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLE; $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLE;
break; break;
case '3' : case '3':
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING; $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING;
break; break;
case '4' : case '4':
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING; $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING;
break; break;
default : default:
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_NONE; $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_NONE;
break; break;
} }
switch ($fontAttributes['Script']) { switch ($fontAttributes['Script']) {
case '1' : case '1':
$styleArray['font']['superScript'] = True; $styleArray['font']['superScript'] = true;
break; break;
case '-1' : case '-1':
$styleArray['font']['subScript'] = True; $styleArray['font']['subScript'] = true;
break; break;
} }
@ -761,7 +739,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
// Handle Merged Cells in this worksheet // Handle Merged Cells in this worksheet
if (isset($sheet->MergedRegions)) { if (isset($sheet->MergedRegions)) {
foreach ($sheet->MergedRegions->Merge as $mergeCells) { foreach ($sheet->MergedRegions->Merge as $mergeCells) {
if (strpos($mergeCells,':') !== FALSE) { if (strpos($mergeCells, ':') !== false) {
$objPHPExcel->getActiveSheet()->mergeCells($mergeCells); $objPHPExcel->getActiveSheet()->mergeCells($mergeCells);
} }
} }
@ -780,20 +758,18 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
} }
$range = explode('!', $range); $range = explode('!', $range);
$range[0] = trim($range[0],"'");; $range[0] = trim($range[0], "'");
if ($worksheet = $objPHPExcel->getSheetByName($range[0])) { if ($worksheet = $objPHPExcel->getSheetByName($range[0])) {
$extractedRange = str_replace('$', '', $range[1]); $extractedRange = str_replace('$', '', $range[1]);
$objPHPExcel->addNamedRange( new PHPExcel_NamedRange($name, $worksheet, $extractedRange) ); $objPHPExcel->addNamedRange(new PHPExcel_NamedRange($name, $worksheet, $extractedRange));
} }
} }
} }
// Return // Return
return $objPHPExcel; return $objPHPExcel;
} }
private static function _parseBorderAttributes($borderAttributes) private static function _parseBorderAttributes($borderAttributes)
{ {
$styleArray = array(); $styleArray = array();
@ -804,54 +780,54 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
} }
switch ($borderAttributes["Style"]) { switch ($borderAttributes["Style"]) {
case '0' : case '0':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_NONE; $styleArray['style'] = PHPExcel_Style_Border::BORDER_NONE;
break; break;
case '1' : case '1':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_THIN; $styleArray['style'] = PHPExcel_Style_Border::BORDER_THIN;
break; break;
case '2' : case '2':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUM; $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUM;
break; break;
case '4' : case '4':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHED; $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHED;
break; break;
case '5' : case '5':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_THICK; $styleArray['style'] = PHPExcel_Style_Border::BORDER_THICK;
break; break;
case '6' : case '6':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DOUBLE; $styleArray['style'] = PHPExcel_Style_Border::BORDER_DOUBLE;
break; break;
case '7' : case '7':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DOTTED; $styleArray['style'] = PHPExcel_Style_Border::BORDER_DOTTED;
break; break;
case '9' : case '9':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOT; $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOT;
break; break;
case '10' : case '10':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT; $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT;
break; break;
case '11' : case '11':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOTDOT; $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOTDOT;
break; break;
case '12' : case '12':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT; $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT;
break; break;
case '13' : case '13':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT; $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT;
break; break;
case '3' : case '3':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_SLANTDASHDOT; $styleArray['style'] = PHPExcel_Style_Border::BORDER_SLANTDASHDOT;
break; break;
case '8' : case '8':
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHED; $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHED;
break; break;
} }
return $styleArray; return $styleArray;
} }
private function _parseRichText($is = '')
private function _parseRichText($is = '') { {
$value = new PHPExcel_RichText(); $value = new PHPExcel_RichText();
$value->createText($is); $value->createText($is);
@ -859,15 +835,14 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
return $value; return $value;
} }
private static function _parseGnumericColour($gnmColour)
private static function _parseGnumericColour($gnmColour) { {
list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour); list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour);
$gnmR = substr(str_pad($gnmR,4,'0',STR_PAD_RIGHT),0,2); $gnmR = substr(str_pad($gnmR, 4, '0', STR_PAD_RIGHT), 0, 2);
$gnmG = substr(str_pad($gnmG,4,'0',STR_PAD_RIGHT),0,2); $gnmG = substr(str_pad($gnmG, 4, '0', STR_PAD_RIGHT), 0, 2);
$gnmB = substr(str_pad($gnmB,4,'0',STR_PAD_RIGHT),0,2); $gnmB = substr(str_pad($gnmB, 4, '0', STR_PAD_RIGHT), 0, 2);
$RGB = $gnmR.$gnmG.$gnmB; $RGB = $gnmR.$gnmG.$gnmB;
// echo 'Excel Colour: ', $RGB,'<br />'; // echo 'Excel Colour: ', $RGB,'<br />';
return $RGB; return $RGB;
} }
} }

View File

@ -1,6 +1,16 @@
<?php <?php
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/** /**
* PHPExcel * PHPExcel_Reader_OOCalc
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,24 +34,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_Reader_OOCalc
*
* @category PHPExcel
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
{ {
/** /**
@ -49,17 +41,16 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
* *
* @var array * @var array
*/ */
private $_styles = array(); private $styles = array();
/** /**
* Create a new PHPExcel_Reader_OOCalc * Create a new PHPExcel_Reader_OOCalc
*/ */
public function __construct() { public function __construct()
{
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
} }
/** /**
* Can the current PHPExcel_Reader_IReader read the file? * Can the current PHPExcel_Reader_IReader read the file?
* *
@ -77,7 +68,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$zipClass = PHPExcel_Settings::getZipClass(); $zipClass = PHPExcel_Settings::getZipClass();
// Check if zip class exists // Check if zip class exists
// if (!class_exists($zipClass, FALSE)) { // if (!class_exists($zipClass, false)) {
// throw new PHPExcel_Reader_Exception($zipClass . " library is not enabled"); // throw new PHPExcel_Reader_Exception($zipClass . " library is not enabled");
// } // }
@ -109,7 +100,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return ($mimeType === 'application/vnd.oasis.opendocument.spreadsheet'); return ($mimeType === 'application/vnd.oasis.opendocument.spreadsheet');
} }
return FALSE; return false;
} }
@ -137,17 +128,18 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$xml = new XMLReader(); $xml = new XMLReader();
$res = $xml->xml($this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'), null, PHPExcel_Settings::getLibXmlLoaderOptions()); $res = $xml->xml($this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'), null, PHPExcel_Settings::getLibXmlLoaderOptions());
$xml->setParserProperty(2,true); $xml->setParserProperty(2, true);
// Step into the first level of content of the XML // Step into the first level of content of the XML
$xml->read(); $xml->read();
while ($xml->read()) { while ($xml->read()) {
// Quickly jump through to the office:body node // Quickly jump through to the office:body node
while ($xml->name !== 'office:body') { while ($xml->name !== 'office:body') {
if ($xml->isEmptyElement) if ($xml->isEmptyElement) {
$xml->read(); $xml->read();
else } else {
$xml->next(); $xml->next();
}
} }
// Now read each node until we find our first table:table node // Now read each node until we find our first table:table node
while ($xml->read()) { while ($xml->read()) {
@ -164,7 +156,6 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return $worksheetNames; return $worksheetNames;
} }
/** /**
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
* *
@ -189,17 +180,18 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$xml = new XMLReader(); $xml = new XMLReader();
$res = $xml->xml($this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'), null, PHPExcel_Settings::getLibXmlLoaderOptions()); $res = $xml->xml($this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'), null, PHPExcel_Settings::getLibXmlLoaderOptions());
$xml->setParserProperty(2,true); $xml->setParserProperty(2, true);
// Step into the first level of content of the XML // Step into the first level of content of the XML
$xml->read(); $xml->read();
while ($xml->read()) { while ($xml->read()) {
// Quickly jump through to the office:body node // Quickly jump through to the office:body node
while ($xml->name !== 'office:body') { while ($xml->name !== 'office:body') {
if ($xml->isEmptyElement) if ($xml->isEmptyElement) {
$xml->read(); $xml->read();
else } else {
$xml->next(); $xml->next();
}
} }
// Now read each node until we find our first table:table node // Now read each node until we find our first table:table node
while ($xml->read()) { while ($xml->read()) {
@ -289,7 +281,6 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return $worksheetInfo; return $worksheetInfo;
} }
/** /**
* Loads PHPExcel from file * Loads PHPExcel from file
* *
@ -306,8 +297,8 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return $this->loadIntoExisting($pFilename, $objPHPExcel); return $this->loadIntoExisting($pFilename, $objPHPExcel);
} }
private static function identifyFixedStyleValue($styleList, &$styleAttributeValue)
private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) { {
$styleAttributeValue = strtolower($styleAttributeValue); $styleAttributeValue = strtolower($styleAttributeValue);
foreach ($styleList as $style) { foreach ($styleList as $style) {
if ($styleAttributeValue == strtolower($style)) { if ($styleAttributeValue == strtolower($style)) {
@ -318,7 +309,6 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return false; return false;
} }
/** /**
* Loads PHPExcel from file into PHPExcel instance * Loads PHPExcel from file into PHPExcel instance
* *
@ -361,24 +351,24 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
foreach ($officePropertyDC as $propertyName => $propertyValue) { foreach ($officePropertyDC as $propertyName => $propertyValue) {
$propertyValue = (string) $propertyValue; $propertyValue = (string) $propertyValue;
switch ($propertyName) { switch ($propertyName) {
case 'title' : case 'title':
$docProps->setTitle($propertyValue); $docProps->setTitle($propertyValue);
break; break;
case 'subject' : case 'subject':
$docProps->setSubject($propertyValue); $docProps->setSubject($propertyValue);
break; break;
case 'creator' : case 'creator':
$docProps->setCreator($propertyValue); $docProps->setCreator($propertyValue);
$docProps->setLastModifiedBy($propertyValue); $docProps->setLastModifiedBy($propertyValue);
break; break;
case 'date' : case 'date':
$creationDate = strtotime($propertyValue); $creationDate = strtotime($propertyValue);
$docProps->setCreated($creationDate); $docProps->setCreated($creationDate);
$docProps->setModified($creationDate); $docProps->setModified($creationDate);
break; break;
case 'description' : case 'description':
$docProps->setDescription($propertyValue); $docProps->setDescription($propertyValue);
break; break;
} }
} }
$officePropertyMeta = array(); $officePropertyMeta = array();
@ -389,42 +379,42 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
$propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']); $propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']);
$propertyValue = (string) $propertyValue; $propertyValue = (string) $propertyValue;
switch ($propertyName) { switch ($propertyName) {
case 'initial-creator' : case 'initial-creator':
$docProps->setCreator($propertyValue); $docProps->setCreator($propertyValue);
break; break;
case 'keyword' : case 'keyword':
$docProps->setKeywords($propertyValue); $docProps->setKeywords($propertyValue);
break; break;
case 'creation-date' : case 'creation-date':
$creationDate = strtotime($propertyValue); $creationDate = strtotime($propertyValue);
$docProps->setCreated($creationDate); $docProps->setCreated($creationDate);
break; break;
case 'user-defined' : case 'user-defined':
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
foreach ($propertyValueAttributes as $key => $value) { foreach ($propertyValueAttributes as $key => $value) {
if ($key == 'name') { if ($key == 'name') {
$propertyValueName = (string) $value; $propertyValueName = (string) $value;
} elseif ($key == 'value-type') { } elseif ($key == 'value-type') {
switch ($value) { switch ($value) {
case 'date' : case 'date':
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'date'); $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'date');
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE; $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE;
break; break;
case 'boolean' : case 'boolean':
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'bool'); $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'bool');
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN; $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN;
break; break;
case 'float' : case 'float':
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'r4'); $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue, 'r4');
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT; $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT;
break; break;
default : default:
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
}
} }
} }
$docProps->setCustomProperty($propertyValueName, $propertyValue, $propertyValueType); }
break; $docProps->setCustomProperty($propertyValueName, $propertyValue, $propertyValueType);
break;
} }
} }
} }
@ -462,7 +452,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in
// formula cells... during the load, all formulae should be correct, and we're simply // 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 reverse // bringing the worksheet name in line with the formula, not the reverse
$objPHPExcel->getActiveSheet()->setTitle($worksheetName,false); $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
} }
$rowID = 1; $rowID = 1;
@ -470,26 +460,23 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
// echo '<b>'.$key.'</b><br />'; // echo '<b>'.$key.'</b><br />';
switch ($key) { switch ($key) {
case 'table-header-rows': case 'table-header-rows':
foreach ($rowData as $key=>$cellData) { foreach ($rowData as $key => $cellData) {
$rowData = $cellData; $rowData = $cellData;
break; break;
} }
case 'table-row' : case 'table-row':
$rowDataTableAttributes = $rowData->attributes($namespacesContent['table']); $rowDataTableAttributes = $rowData->attributes($namespacesContent['table']);
$rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ? $rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ? $rowDataTableAttributes['number-rows-repeated'] : 1;
$rowDataTableAttributes['number-rows-repeated'] : 1;
$columnID = 'A'; $columnID = 'A';
foreach ($rowData as $key => $cellData) { foreach ($rowData as $key => $cellData) {
if ($this->getReadFilter() !== NULL) { if ($this->getReadFilter() !== null) {
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) { if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
continue; continue;
} }
} }
// echo '<b>'.$columnID.$rowID.'</b><br />'; // echo '<b>'.$columnID.$rowID.'</b><br />';
$cellDataText = (isset($namespacesContent['text'])) ? $cellDataText = (isset($namespacesContent['text'])) ? $cellData->children($namespacesContent['text']) : '';
$cellData->children($namespacesContent['text']) :
'';
$cellDataOffice = $cellData->children($namespacesContent['office']); $cellDataOffice = $cellData->children($namespacesContent['office']);
$cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']); $cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']);
$cellDataTableAttributes = $cellData->attributes($namespacesContent['table']); $cellDataTableAttributes = $cellData->attributes($namespacesContent['table']);
@ -524,13 +511,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
} }
} }
$text = implode("\n", $textArray); $text = implode("\n", $textArray);
// echo $text,'<br />'; // echo $text, '<br />';
$objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID ) $objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setText($this->parseRichText($text));
// ->setAuthor( $author ) // ->setAuthor( $author )
->setText($this->_parseRichText($text) );
} }
if (isset($cellDataText->p)) { if (isset($cellDataText->p)) {
// Consolidate if there are multiple p records (maybe with spans as well) // Consolidate if there are multiple p records (maybe with spans as well)
$dataArray = array(); $dataArray = array();
// Text can have multiple text:p and within those, multiple text:span. // Text can have multiple text:p and within those, multiple text:span.
@ -553,86 +539,87 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
// echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />'; // echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />';
switch ($cellDataOfficeAttributes['value-type']) { switch ($cellDataOfficeAttributes['value-type']) {
case 'string' : case 'string':
$type = PHPExcel_Cell_DataType::TYPE_STRING; $type = PHPExcel_Cell_DataType::TYPE_STRING;
$dataValue = $allCellDataText; $dataValue = $allCellDataText;
if (isset($dataValue->a)) { if (isset($dataValue->a)) {
$dataValue = $dataValue->a; $dataValue = $dataValue->a;
$cellXLinkAttributes = $dataValue->attributes($namespacesContent['xlink']); $cellXLinkAttributes = $dataValue->attributes($namespacesContent['xlink']);
$hyperlink = $cellXLinkAttributes['href']; $hyperlink = $cellXLinkAttributes['href'];
} }
break; break;
case 'boolean' : case 'boolean':
$type = PHPExcel_Cell_DataType::TYPE_BOOL; $type = PHPExcel_Cell_DataType::TYPE_BOOL;
$dataValue = ($allCellDataText == 'TRUE') ? True : False; $dataValue = ($allCellDataText == 'TRUE') ? true : false;
break; break;
case 'percentage' : case 'percentage':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = (float) $cellDataOfficeAttributes['value']; $dataValue = (float) $cellDataOfficeAttributes['value'];
if (floor($dataValue) == $dataValue) { if (floor($dataValue) == $dataValue) {
$dataValue = (integer) $dataValue;
}
$formatting = PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00;
break;
case 'currency':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = (float) $cellDataOfficeAttributes['value'];
if (floor($dataValue) == $dataValue) {
$dataValue = (integer) $dataValue;
}
$formatting = PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
break;
case 'float':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = (float) $cellDataOfficeAttributes['value'];
if (floor($dataValue) == $dataValue) {
if ($dataValue == (integer) $dataValue) {
$dataValue = (integer) $dataValue; $dataValue = (integer) $dataValue;
}
$formatting = PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00;
break;
case 'currency' :
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = (float) $cellDataOfficeAttributes['value'];
if (floor($dataValue) == $dataValue) {
$dataValue = (integer) $dataValue;
}
$formatting = PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
break;
case 'float' :
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = (float) $cellDataOfficeAttributes['value'];
if (floor($dataValue) == $dataValue) {
if ($dataValue == (integer) $dataValue)
$dataValue = (integer) $dataValue;
else
$dataValue = (float) $dataValue;
}
break;
case 'date' :
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dateObj = new DateTime($cellDataOfficeAttributes['date-value'], $GMT);
$dateObj->setTimeZone($timezoneObj);
list($year, $month, $day, $hour, $minute, $second) = explode(' ', $dateObj->format('Y m d H i s'));
$dataValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year, $month, $day, $hour, $minute, $second);
if ($dataValue != floor($dataValue)) {
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15.' '.PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
} else { } else {
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15; $dataValue = (float) $dataValue;
} }
break; }
case 'time' : break;
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; case 'date':
$dataValue = PHPExcel_Shared_Date::PHPToExcel(strtotime('01-01-1970 '.implode(':',sscanf($cellDataOfficeAttributes['time-value'],'PT%dH%dM%dS')))); $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4; $dateObj = new DateTime($cellDataOfficeAttributes['date-value'], $GMT);
break; $dateObj->setTimeZone($timezoneObj);
list($year, $month, $day, $hour, $minute, $second) = explode(' ', $dateObj->format('Y m d H i s'));
$dataValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year, $month, $day, $hour, $minute, $second);
if ($dataValue != floor($dataValue)) {
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15.' '.PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
} else {
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15;
}
break;
case 'time':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = PHPExcel_Shared_Date::PHPToExcel(strtotime('01-01-1970 '.implode(':', sscanf($cellDataOfficeAttributes['time-value'], 'PT%dH%dM%dS'))));
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
break;
} }
// echo 'Data value is '.$dataValue.'<br />'; // echo 'Data value is '.$dataValue.'<br />';
// if ($hyperlink !== NULL) { // if ($hyperlink !== null) {
// echo 'Hyperlink is '.$hyperlink.'<br />'; // echo 'Hyperlink is '.$hyperlink.'<br />';
// } // }
} else { } else {
$type = PHPExcel_Cell_DataType::TYPE_NULL; $type = PHPExcel_Cell_DataType::TYPE_NULL;
$dataValue = NULL; $dataValue = null;
} }
if ($hasCalculatedValue) { if ($hasCalculatedValue) {
$type = PHPExcel_Cell_DataType::TYPE_FORMULA; $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
// echo 'Formula: ', $cellDataFormula, PHP_EOL; // echo 'Formula: ', $cellDataFormula, PHP_EOL;
$cellDataFormula = substr($cellDataFormula,strpos($cellDataFormula,':=')+1); $cellDataFormula = substr($cellDataFormula, strpos($cellDataFormula, ':=')+1);
$temp = explode('"', $cellDataFormula); $temp = explode('"', $cellDataFormula);
$tKey = false; $tKey = false;
foreach ($temp as &$value) { foreach ($temp as &$value) {
// Only replace in alternate array entries (i.e. non-quoted blocks) // Only replace in alternate array entries (i.e. non-quoted blocks)
if ($tKey = !$tKey) { if ($tKey = !$tKey) {
$value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui','$1!$2:$3', $value); // Cell range reference in another sheet $value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui', '$1!$2:$3', $value); // Cell range reference in another sheet
$value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui','$1!$2', $value); // Cell reference in another sheet $value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui', '$1!$2', $value); // Cell reference in another sheet
$value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui','$1:$2', $value); // Cell range reference $value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui', '$1:$2', $value); // Cell range reference
$value = preg_replace('/\[\.([^\.]+)\]/Ui','$1', $value); // Simple cell reference $value = preg_replace('/\[\.([^\.]+)\]/Ui', '$1', $value); // Simple cell reference
$value = PHPExcel_Calculation::_translateSeparator(';',',', $value, $inBraces); $value = PHPExcel_Calculation::_translateSeparator(';', ',', $value, $inBraces);
} }
} }
unset($value); unset($value);
@ -641,9 +628,8 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
// echo 'Adjusted Formula: ', $cellDataFormula, PHP_EOL; // echo 'Adjusted Formula: ', $cellDataFormula, PHP_EOL;
} }
$colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ? $colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ? $cellDataTableAttributes['number-columns-repeated'] : 1;
$cellDataTableAttributes['number-columns-repeated'] : 1; if ($type !== null) {
if ($type !== NULL) {
for ($i = 0; $i < $colRepeats; ++$i) { for ($i = 0; $i < $colRepeats; ++$i) {
if ($i > 0) { if ($i > 0) {
++$columnID; ++$columnID;
@ -656,12 +642,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
// echo 'Forumla result is '.$dataValue.'<br />'; // echo 'Forumla result is '.$dataValue.'<br />';
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setCalculatedValue($dataValue); $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setCalculatedValue($dataValue);
} }
if ($formatting !== NULL) { if ($formatting !== null) {
$objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode($formatting); $objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode($formatting);
} else { } else {
$objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_GENERAL); $objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_GENERAL);
} }
if ($hyperlink !== NULL) { if ($hyperlink !== null) {
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->getHyperlink()->setUrl($hyperlink); $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->getHyperlink()->setUrl($hyperlink);
} }
} }
@ -699,13 +685,12 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce
return $objPHPExcel; return $objPHPExcel;
} }
private function parseRichText($is = '')
private function _parseRichText($is = '') { {
$value = new PHPExcel_RichText(); $value = new PHPExcel_RichText();
$value->createText($is); $value->createText($is);
return $value; return $value;
} }
} }

View File

@ -49,33 +49,34 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
* *
* @var string * @var string
*/ */
private $_inputEncoding = 'ANSI'; private $inputEncoding = 'ANSI';
/** /**
* Sheet index to read * Sheet index to read
* *
* @var int * @var int
*/ */
private $_sheetIndex = 0; private $sheetIndex = 0;
/** /**
* Formats * Formats
* *
* @var array * @var array
*/ */
private $_formats = array(); private $formats = array();
/** /**
* Format Count * Format Count
* *
* @var int * @var int
*/ */
private $_format = 0; private $format = 0;
/** /**
* Create a new PHPExcel_Reader_SYLK * Create a new PHPExcel_Reader_SYLK
*/ */
public function __construct() { public function __construct()
{
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
} }
@ -92,16 +93,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;
} }
/** /**
@ -111,7 +112,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
*/ */
public function setInputEncoding($pValue = 'ANSI') public function setInputEncoding($pValue = 'ANSI')
{ {
$this->_inputEncoding = $pValue; $this->inputEncoding = $pValue;
return $this; return $this;
} }
@ -122,7 +123,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
*/ */
public function getInputEncoding() public function getInputEncoding()
{ {
return $this->_inputEncoding; return $this->inputEncoding;
} }
/** /**
@ -136,7 +137,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
// Open file // Open file
$this->_openFile($pFilename); $this->_openFile($pFilename);
if (!$this->_isValidFormat()) { if (!$this->_isValidFormat()) {
fclose ($this->_fileHandle); fclose($this->_fileHandle);
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
} }
$fileHandle = $this->_fileHandle; $fileHandle = $this->_fileHandle;
@ -154,7 +155,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
@ -162,20 +163,20 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
// explode each row at semicolons while taking into account that literal semicolon (;) // explode each row at semicolons while taking into account that literal semicolon (;)
// is escaped like this (;;) // is escaped like this (;;)
$rowData = explode("\t",str_replace('¤',';',str_replace(';',"\t",str_replace(';;','¤',rtrim($rowData))))); $rowData = explode("\t", str_replace('¤', ';', str_replace(';', "\t", str_replace(';;', '¤', rtrim($rowData)))));
$dataType = array_shift($rowData); $dataType = array_shift($rowData);
if ($dataType == 'C') { if ($dataType == 'C') {
// Read cell value data // Read cell value data
foreach ($rowData as $rowDatum) { foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) { switch ($rowDatum{0}) {
case 'C' : case 'C':
case 'X' : case 'X':
$columnIndex = substr($rowDatum,1) - 1; $columnIndex = substr($rowDatum, 1) - 1;
break; break;
case 'R' : case 'R':
case 'Y' : case 'Y':
$rowIndex = substr($rowDatum,1); $rowIndex = substr($rowDatum, 1);
break; break;
} }
@ -223,17 +224,17 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
// Open file // Open file
$this->_openFile($pFilename); $this->_openFile($pFilename);
if (!$this->_isValidFormat()) { if (!$this->_isValidFormat()) {
fclose ($this->_fileHandle); fclose($this->_fileHandle);
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
} }
$fileHandle = $this->_fileHandle; $fileHandle = $this->_fileHandle;
rewind($fileHandle); rewind($fileHandle);
// Create new PHPExcel // Create new PHPExcel
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) {
$objPHPExcel->createSheet(); $objPHPExcel->createSheet();
} }
$objPHPExcel->setActiveSheetIndex( $this->_sheetIndex ); $objPHPExcel->setActiveSheetIndex($this->sheetIndex);
$fromFormats = array('\-', '\ '); $fromFormats = array('\-', '\ ');
$toFormats = array('-', ' '); $toFormats = array('-', ' ');
@ -243,14 +244,13 @@ 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);
// explode each row at semicolons while taking into account that literal semicolon (;) // explode each row at semicolons while taking into account that literal semicolon (;)
// is escaped like this (;;) // is escaped like this (;;)
$rowData = explode("\t",str_replace('¤',';',str_replace(';',"\t",str_replace(';;','¤',rtrim($rowData))))); $rowData = explode("\t", str_replace('¤', ';', str_replace(';', "\t", str_replace(';;', '¤', rtrim($rowData)))));
$dataType = array_shift($rowData); $dataType = array_shift($rowData);
// Read shared styles // Read shared styles
@ -258,93 +258,115 @@ 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':
break; $formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1));
case 'E' : break;
case 'F' : $formatArray['font']['name'] = substr($rowDatum,1); case 'E':
break; case 'F':
case 'L' : $formatArray['font']['size'] = substr($rowDatum,1); $formatArray['font']['name'] = substr($rowDatum, 1);
break; break;
case 'S' : $styleSettings = substr($rowDatum,1); case 'L':
for ($i=0;$i<strlen($styleSettings);++$i) { $formatArray['font']['size'] = substr($rowDatum, 1);
switch ($styleSettings{$i}) { break;
case 'I' : $formatArray['font']['italic'] = true; case 'S':
break; $styleSettings = substr($rowDatum, 1);
case 'D' : $formatArray['font']['bold'] = true; for ($i=0; $i<strlen($styleSettings); ++$i) {
break; switch ($styleSettings{$i}) {
case 'T' : $formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN; case 'I':
break; $formatArray['font']['italic'] = true;
case 'B' : $formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN; break;
break; case 'D':
case 'L' : $formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN; $formatArray['font']['bold'] = true;
break; break;
case 'R' : $formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN; case 'T':
break; $formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
} break;
} case 'B':
break; $formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
case 'L':
$formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
case 'R':
$formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
}
}
break;
} }
} }
$this->_formats['P'.$this->_format++] = $formatArray; $this->formats['P'.$this->format++] = $formatArray;
// Read cell value data // Read cell value data
} elseif ($dataType == 'C') { } elseif ($dataType == 'C') {
$hasCalculatedValue = false; $hasCalculatedValue = false;
$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':
break; $column = substr($rowDatum, 1);
case 'R' : break;
case 'Y' : $row = substr($rowDatum,1); case 'R':
break; case 'Y':
case 'K' : $cellData = substr($rowDatum,1); $row = substr($rowDatum, 1);
break; break;
case 'E' : $cellDataFormula = '='.substr($rowDatum,1); case 'K':
// Convert R1C1 style references to A1 style references (but only when not quoted) $cellData = substr($rowDatum, 1);
$temp = explode('"', $cellDataFormula); break;
$key = false; case 'E':
foreach ($temp as &$value) { $cellDataFormula = '='.substr($rowDatum, 1);
// Only count/replace in alternate array entries // Convert R1C1 style references to A1 style references (but only when not quoted)
if ($key = !$key) { $temp = explode('"', $cellDataFormula);
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE); $key = false;
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way foreach ($temp as &$value) {
// through the formula from left to right. Reversing means that we work right to left.through // Only count/replace in alternate array entries
// the formula if ($key = !$key) {
$cellReferences = array_reverse($cellReferences); preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
// Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent, // Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
// then modify the formula to use that new reference // through the formula from left to right. Reversing means that we work right to left.through
foreach ($cellReferences as $cellReference) { // the formula
$rowReference = $cellReference[2][0]; $cellReferences = array_reverse($cellReferences);
// Empty R reference is the current row // Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
if ($rowReference == '') $rowReference = $row; // then modify the formula to use that new reference
// Bracketed R references are relative to the current row foreach ($cellReferences as $cellReference) {
if ($rowReference{0} == '[') $rowReference = $row + trim($rowReference,'[]'); $rowReference = $cellReference[2][0];
$columnReference = $cellReference[4][0]; // Empty R reference is the current row
// Empty C reference is the current column if ($rowReference == '') {
if ($columnReference == '') $columnReference = $column; $rowReference = $row;
// Bracketed C references are relative to the current column
if ($columnReference{0} == '[') $columnReference = $column + trim($columnReference,'[]');
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
$value = substr_replace($value, $A1CellReference, $cellReference[0][1],strlen($cellReference[0][0]));
}
} }
// Bracketed R references are relative to the current row
if ($rowReference{0} == '[') {
$rowReference = $row + trim($rowReference, '[]');
}
$columnReference = $cellReference[4][0];
// Empty C reference is the current column
if ($columnReference == '') {
$columnReference = $column;
}
// Bracketed C references are relative to the current column
if ($columnReference{0} == '[') {
$columnReference = $column + trim($columnReference, '[]');
}
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
$value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
} }
unset($value); }
// Then rebuild the formula string }
$cellDataFormula = implode('"', $temp); unset($value);
$hasCalculatedValue = true; // Then rebuild the formula string
break; $cellDataFormula = implode('"', $temp);
$hasCalculatedValue = true;
break;
} }
} }
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1); $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
$cellData = PHPExcel_Calculation::_unwrapResult($cellData); $cellData = PHPExcel_Calculation::unwrapResult($cellData);
// Set cell value // Set cell value
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData); $objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData);
if ($hasCalculatedValue) { if ($hasCalculatedValue) {
$cellData = PHPExcel_Calculation::_unwrapResult($cellData); $cellData = PHPExcel_Calculation::unwrapResult($cellData);
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData); $objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData);
} }
// Read cell formatting // Read cell formatting
@ -353,40 +375,51 @@ 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':
break; $column = substr($rowDatum, 1);
case 'R' : break;
case 'Y' : $row = substr($rowDatum,1); case 'R':
break; case 'Y':
case 'P' : $formatStyle = $rowDatum; $row = substr($rowDatum, 1);
break; break;
case 'W' : list($startCol, $endCol, $columnWidth) = explode(' ',substr($rowDatum,1)); case 'P':
break; $formatStyle = $rowDatum;
case 'S' : $styleSettings = substr($rowDatum,1); break;
for ($i=0;$i<strlen($styleSettings);++$i) { case 'W':
switch ($styleSettings{$i}) { list($startCol, $endCol, $columnWidth) = explode(' ', substr($rowDatum, 1));
case 'I' : $styleData['font']['italic'] = true; break;
break; case 'S':
case 'D' : $styleData['font']['bold'] = true; $styleSettings = substr($rowDatum, 1);
break; for ($i=0; $i<strlen($styleSettings); ++$i) {
case 'T' : $styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN; switch ($styleSettings{$i}) {
break; case 'I':
case 'B' : $styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN; $styleData['font']['italic'] = true;
break; break;
case 'L' : $styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN; case 'D':
break; $styleData['font']['bold'] = true;
case 'R' : $styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN; break;
break; case 'T':
} $styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
} break;
break; case 'B':
$styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
case 'L':
$styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
case 'R':
$styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
break;
}
}
break;
} }
} }
if (($formatStyle > '') && ($column > '') && ($row > '')) { if (($formatStyle > '') && ($column > '') && ($row > '')) {
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1); $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
if (isset($this->_formats[$formatStyle])) { if (isset($this->formats[$formatStyle])) {
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->_formats[$formatStyle]); $objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->formats[$formatStyle]);
} }
} }
if ((!empty($styleData)) && ($column > '') && ($row > '')) { if ((!empty($styleData)) && ($column > '') && ($row > '')) {
@ -409,12 +442,14 @@ 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':
break; $column = substr($rowDatum, 1);
case 'R' : break;
case 'Y' : $row = substr($rowDatum,1); case 'R':
break; case 'Y':
$row = substr($rowDatum, 1);
break;
} }
} }
} }
@ -432,8 +467,9 @@ 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;
} }
} }

View File

@ -39,7 +39,7 @@ class PHPExcel_ReferenceHelper
* *
* @var PHPExcel_ReferenceHelper * @var PHPExcel_ReferenceHelper
*/ */
private static $_instance; private static $instance;
/** /**
* Get an instance of this class * Get an instance of this class
@ -48,11 +48,11 @@ class PHPExcel_ReferenceHelper
*/ */
public static function getInstance() public static function getInstance()
{ {
if (!isset(self::$_instance) || (self::$_instance === null)) { if (!isset(self::$instance) || (self::$instance === null)) {
self::$_instance = new PHPExcel_ReferenceHelper(); self::$instance = new PHPExcel_ReferenceHelper();
} }
return self::$_instance; return self::$instance;
} }
/** /**
@ -163,7 +163,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustPageBreaks(PHPExcel_Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustPageBreaks(PHPExcel_Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aBreaks = $pSheet->getBreaks(); $aBreaks = $pSheet->getBreaks();
($pNumCols > 0 || $pNumRows > 0) ? ($pNumCols > 0 || $pNumRows > 0) ?
@ -197,7 +197,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aComments = $pSheet->getComments(); $aComments = $pSheet->getComments();
$aNewComments = array(); // the new array of all comments $aNewComments = array(); // the new array of all comments
@ -224,7 +224,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aHyperlinkCollection = $pSheet->getHyperlinkCollection(); $aHyperlinkCollection = $pSheet->getHyperlinkCollection();
($pNumCols > 0 || $pNumRows > 0) ? uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort')); ($pNumCols > 0 || $pNumRows > 0) ? uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
@ -248,7 +248,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aDataValidationCollection = $pSheet->getDataValidationCollection(); $aDataValidationCollection = $pSheet->getDataValidationCollection();
($pNumCols > 0 || $pNumRows > 0) ? uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort')); ($pNumCols > 0 || $pNumRows > 0) ? uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
@ -272,7 +272,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aMergeCells = $pSheet->getMergeCells(); $aMergeCells = $pSheet->getMergeCells();
$aNewMergeCells = array(); // the new array of all merge cells $aNewMergeCells = array(); // the new array of all merge cells
@ -293,7 +293,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aProtectedCells = $pSheet->getProtectedCells(); $aProtectedCells = $pSheet->getProtectedCells();
($pNumCols > 0 || $pNumRows > 0) ? ($pNumCols > 0 || $pNumRows > 0) ?
@ -318,7 +318,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true); $aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true);
if (!empty($aColumnDimensions)) { if (!empty($aColumnDimensions)) {
@ -343,7 +343,7 @@ class PHPExcel_ReferenceHelper
* @param integer $beforeRow Number of the row we're inserting/deleting before * @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/ */
protected function _adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) protected function adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{ {
$aRowDimensions = array_reverse($pSheet->getRowDimensions(), true); $aRowDimensions = array_reverse($pSheet->getRowDimensions(), true);
if (!empty($aRowDimensions)) { if (!empty($aRowDimensions)) {
@ -513,28 +513,28 @@ class PHPExcel_ReferenceHelper
} }
// Update worksheet: column dimensions // Update worksheet: column dimensions
$this->_adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: row dimensions // Update worksheet: row dimensions
$this->_adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: page breaks // Update worksheet: page breaks
$this->_adjustPageBreaks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustPageBreaks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: comments // Update worksheet: comments
$this->_adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: hyperlinks // Update worksheet: hyperlinks
$this->_adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: data validations // Update worksheet: data validations
$this->_adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: merge cells // Update worksheet: merge cells
$this->_adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: protected cells // Update worksheet: protected cells
$this->_adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); $this->adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: autofilter // Update worksheet: autofilter
$autoFilter = $pSheet->getAutoFilter(); $autoFilter = $pSheet->getAutoFilter();
@ -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);
@ -785,10 +785,10 @@ class PHPExcel_ReferenceHelper
// Is it a range or a single cell? // Is it a range or a single cell?
} elseif (strpos($pCellRange, ':') === false && strpos($pCellRange, ',') === false) { } elseif (strpos($pCellRange, ':') === false && strpos($pCellRange, ',') === false) {
// Single cell // Single cell
return $this->_updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows); return $this->updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows);
} elseif (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) { } elseif (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) {
// Range // Range
return $this->_updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows); return $this->updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows);
} else { } else {
// Return original // Return original
return $pCellRange; return $pCellRange;
@ -833,7 +833,7 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell range * @return string Updated cell range
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) private function updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{ {
if (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) { if (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) {
// Update range // Update range
@ -843,13 +843,13 @@ class PHPExcel_ReferenceHelper
$jc = count($range[$i]); $jc = count($range[$i]);
for ($j = 0; $j < $jc; ++$j) { for ($j = 0; $j < $jc; ++$j) {
if (ctype_alpha($range[$i][$j])) { if (ctype_alpha($range[$i][$j])) {
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows)); $r = PHPExcel_Cell::coordinateFromString($this->updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows));
$range[$i][$j] = $r[0]; $range[$i][$j] = $r[0];
} elseif (ctype_digit($range[$i][$j])) { } elseif (ctype_digit($range[$i][$j])) {
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows)); $r = PHPExcel_Cell::coordinateFromString($this->updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows));
$range[$i][$j] = $r[1]; $range[$i][$j] = $r[1];
} else { } else {
$range[$i][$j] = $this->_updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows); $range[$i][$j] = $this->updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows);
} }
} }
} }
@ -871,7 +871,7 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell reference * @return string Updated cell reference
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) private function updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{ {
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) { if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
// Get coordinates of $pBefore // Get coordinates of $pBefore

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher class PHPExcel_Shared_Escher
{ {
/** /**
@ -39,14 +32,14 @@ class PHPExcel_Shared_Escher
* *
* @var PHPExcel_Shared_Escher_DggContainer * @var PHPExcel_Shared_Escher_DggContainer
*/ */
private $_dggContainer; private $dggContainer;
/** /**
* Drawing Container * Drawing Container
* *
* @var PHPExcel_Shared_Escher_DgContainer * @var PHPExcel_Shared_Escher_DgContainer
*/ */
private $_dgContainer; private $dgContainer;
/** /**
* Get Drawing Group Container * Get Drawing Group Container
@ -55,7 +48,7 @@ class PHPExcel_Shared_Escher
*/ */
public function getDggContainer() public function getDggContainer()
{ {
return $this->_dggContainer; return $this->dggContainer;
} }
/** /**
@ -65,7 +58,7 @@ class PHPExcel_Shared_Escher
*/ */
public function setDggContainer($dggContainer) public function setDggContainer($dggContainer)
{ {
return $this->_dggContainer = $dggContainer; return $this->dggContainer = $dggContainer;
} }
/** /**
@ -75,7 +68,7 @@ class PHPExcel_Shared_Escher
*/ */
public function getDgContainer() public function getDgContainer()
{ {
return $this->_dgContainer; return $this->dgContainer;
} }
/** /**
@ -85,6 +78,6 @@ class PHPExcel_Shared_Escher
*/ */
public function setDgContainer($dgContainer) public function setDgContainer($dgContainer)
{ {
return $this->_dgContainer = $dgContainer; return $this->dgContainer = $dgContainer;
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher_DgContainer
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher_DgContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DgContainer class PHPExcel_Shared_Escher_DgContainer
{ {
/** /**
@ -39,44 +32,44 @@ class PHPExcel_Shared_Escher_DgContainer
* *
* @var int * @var int
*/ */
private $_dgId; private $dgId;
/** /**
* Last shape index in this drawing * Last shape index in this drawing
* *
* @var int * @var int
*/ */
private $_lastSpId; private $lastSpId;
private $_spgrContainer = null; private $spgrContainer = null;
public function getDgId() public function getDgId()
{ {
return $this->_dgId; return $this->dgId;
} }
public function setDgId($value) public function setDgId($value)
{ {
$this->_dgId = $value; $this->dgId = $value;
} }
public function getLastSpId() public function getLastSpId()
{ {
return $this->_lastSpId; return $this->lastSpId;
} }
public function setLastSpId($value) public function setLastSpId($value)
{ {
$this->_lastSpId = $value; $this->lastSpId = $value;
} }
public function getSpgrContainer() public function getSpgrContainer()
{ {
return $this->_spgrContainer; return $this->spgrContainer;
} }
public function setSpgrContainer($spgrContainer) public function setSpgrContainer($spgrContainer)
{ {
return $this->_spgrContainer = $spgrContainer; return $this->spgrContainer = $spgrContainer;
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher_DgContainer_SpgrContainer
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
{ {
/** /**
@ -39,14 +32,14 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
* *
* @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer * @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/ */
private $_parent; private $parent;
/** /**
* Shape Container collection * Shape Container collection
* *
* @var array * @var array
*/ */
private $_children = array(); private $children = array();
/** /**
* Set parent Shape Group Container * Set parent Shape Group Container
@ -55,7 +48,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/ */
public function setParent($parent) public function setParent($parent)
{ {
$this->_parent = $parent; $this->parent = $parent;
} }
/** /**
@ -65,7 +58,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/ */
public function getParent() public function getParent()
{ {
return $this->_parent; return $this->parent;
} }
/** /**
@ -75,7 +68,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/ */
public function addChild($child) public function addChild($child)
{ {
$this->_children[] = $child; $this->children[] = $child;
$child->setParent($this); $child->setParent($this);
} }
@ -84,7 +77,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/ */
public function getChildren() public function getChildren()
{ {
return $this->_children; return $this->children;
} }
/** /**
@ -96,7 +89,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
{ {
$allSpContainers = array(); $allSpContainers = array();
foreach ($this->_children as $child) { foreach ($this->children as $child) {
if ($child instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) { if ($child instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) {
$allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers()); $allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers());
} else { } else {

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
{ {
/** /**
@ -39,84 +32,84 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
* *
* @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer * @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/ */
private $_parent; private $parent;
/** /**
* Is this a group shape? * Is this a group shape?
* *
* @var boolean * @var boolean
*/ */
private $_spgr = false; private $spgr = false;
/** /**
* Shape type * Shape type
* *
* @var int * @var int
*/ */
private $_spType; private $spType;
/** /**
* Shape flag * Shape flag
* *
* @var int * @var int
*/ */
private $_spFlag; private $spFlag;
/** /**
* Shape index (usually group shape has index 0, and the rest: 1,2,3...) * Shape index (usually group shape has index 0, and the rest: 1,2,3...)
* *
* @var boolean * @var boolean
*/ */
private $_spId; private $spId;
/** /**
* Array of options * Array of options
* *
* @var array * @var array
*/ */
private $_OPT; private $OPT;
/** /**
* Cell coordinates of upper-left corner of shape, e.g. 'A1' * Cell coordinates of upper-left corner of shape, e.g. 'A1'
* *
* @var string * @var string
*/ */
private $_startCoordinates; private $startCoordinates;
/** /**
* Horizontal offset of upper-left corner of shape measured in 1/1024 of column width * Horizontal offset of upper-left corner of shape measured in 1/1024 of column width
* *
* @var int * @var int
*/ */
private $_startOffsetX; private $startOffsetX;
/** /**
* Vertical offset of upper-left corner of shape measured in 1/256 of row height * Vertical offset of upper-left corner of shape measured in 1/256 of row height
* *
* @var int * @var int
*/ */
private $_startOffsetY; private $startOffsetY;
/** /**
* Cell coordinates of bottom-right corner of shape, e.g. 'B2' * Cell coordinates of bottom-right corner of shape, e.g. 'B2'
* *
* @var string * @var string
*/ */
private $_endCoordinates; private $endCoordinates;
/** /**
* Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width * Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width
* *
* @var int * @var int
*/ */
private $_endOffsetX; private $endOffsetX;
/** /**
* Vertical offset of bottom-right corner of shape measured in 1/256 of row height * Vertical offset of bottom-right corner of shape measured in 1/256 of row height
* *
* @var int * @var int
*/ */
private $_endOffsetY; private $endOffsetY;
/** /**
* Set parent Shape Group Container * Set parent Shape Group Container
@ -125,7 +118,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setParent($parent) public function setParent($parent)
{ {
$this->_parent = $parent; $this->parent = $parent;
} }
/** /**
@ -135,7 +128,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getParent() public function getParent()
{ {
return $this->_parent; return $this->parent;
} }
/** /**
@ -145,7 +138,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setSpgr($value = false) public function setSpgr($value = false)
{ {
$this->_spgr = $value; $this->spgr = $value;
} }
/** /**
@ -155,7 +148,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getSpgr() public function getSpgr()
{ {
return $this->_spgr; return $this->spgr;
} }
/** /**
@ -165,7 +158,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setSpType($value) public function setSpType($value)
{ {
$this->_spType = $value; $this->spType = $value;
} }
/** /**
@ -175,7 +168,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getSpType() public function getSpType()
{ {
return $this->_spType; return $this->spType;
} }
/** /**
@ -185,7 +178,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setSpFlag($value) public function setSpFlag($value)
{ {
$this->_spFlag = $value; $this->spFlag = $value;
} }
/** /**
@ -195,7 +188,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getSpFlag() public function getSpFlag()
{ {
return $this->_spFlag; return $this->spFlag;
} }
/** /**
@ -205,7 +198,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setSpId($value) public function setSpId($value)
{ {
$this->_spId = $value; $this->spId = $value;
} }
/** /**
@ -215,7 +208,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getSpId() public function getSpId()
{ {
return $this->_spId; return $this->spId;
} }
/** /**
@ -226,7 +219,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setOPT($property, $value) public function setOPT($property, $value)
{ {
$this->_OPT[$property] = $value; $this->OPT[$property] = $value;
} }
/** /**
@ -237,8 +230,8 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getOPT($property) public function getOPT($property)
{ {
if (isset($this->_OPT[$property])) { if (isset($this->OPT[$property])) {
return $this->_OPT[$property]; return $this->OPT[$property];
} }
return null; return null;
} }
@ -250,7 +243,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getOPTCollection() public function getOPTCollection()
{ {
return $this->_OPT; return $this->OPT;
} }
/** /**
@ -260,7 +253,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setStartCoordinates($value = 'A1') public function setStartCoordinates($value = 'A1')
{ {
$this->_startCoordinates = $value; $this->startCoordinates = $value;
} }
/** /**
@ -270,7 +263,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getStartCoordinates() public function getStartCoordinates()
{ {
return $this->_startCoordinates; return $this->startCoordinates;
} }
/** /**
@ -280,7 +273,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setStartOffsetX($startOffsetX = 0) public function setStartOffsetX($startOffsetX = 0)
{ {
$this->_startOffsetX = $startOffsetX; $this->startOffsetX = $startOffsetX;
} }
/** /**
@ -290,7 +283,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getStartOffsetX() public function getStartOffsetX()
{ {
return $this->_startOffsetX; return $this->startOffsetX;
} }
/** /**
@ -300,7 +293,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setStartOffsetY($startOffsetY = 0) public function setStartOffsetY($startOffsetY = 0)
{ {
$this->_startOffsetY = $startOffsetY; $this->startOffsetY = $startOffsetY;
} }
/** /**
@ -310,7 +303,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getStartOffsetY() public function getStartOffsetY()
{ {
return $this->_startOffsetY; return $this->startOffsetY;
} }
/** /**
@ -320,7 +313,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setEndCoordinates($value = 'A1') public function setEndCoordinates($value = 'A1')
{ {
$this->_endCoordinates = $value; $this->endCoordinates = $value;
} }
/** /**
@ -330,7 +323,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getEndCoordinates() public function getEndCoordinates()
{ {
return $this->_endCoordinates; return $this->endCoordinates;
} }
/** /**
@ -340,7 +333,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setEndOffsetX($endOffsetX = 0) public function setEndOffsetX($endOffsetX = 0)
{ {
$this->_endOffsetX = $endOffsetX; $this->endOffsetX = $endOffsetX;
} }
/** /**
@ -350,7 +343,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getEndOffsetX() public function getEndOffsetX()
{ {
return $this->_endOffsetX; return $this->endOffsetX;
} }
/** /**
@ -360,7 +353,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function setEndOffsetY($endOffsetY = 0) public function setEndOffsetY($endOffsetY = 0)
{ {
$this->_endOffsetY = $endOffsetY; $this->endOffsetY = $endOffsetY;
} }
/** /**
@ -370,7 +363,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*/ */
public function getEndOffsetY() public function getEndOffsetY()
{ {
return $this->_endOffsetY; return $this->endOffsetY;
} }
/** /**

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher_DggContainer
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher_DggContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DggContainer class PHPExcel_Shared_Escher_DggContainer
{ {
/** /**
@ -39,42 +32,42 @@ class PHPExcel_Shared_Escher_DggContainer
* *
* @var int * @var int
*/ */
private $_spIdMax; private $spIdMax;
/** /**
* Total number of drawings saved * Total number of drawings saved
* *
* @var int * @var int
*/ */
private $_cDgSaved; private $cDgSaved;
/** /**
* Total number of shapes saved (including group shapes) * Total number of shapes saved (including group shapes)
* *
* @var int * @var int
*/ */
private $_cSpSaved; private $cSpSaved;
/** /**
* BLIP Store Container * BLIP Store Container
* *
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer * @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*/ */
private $_bstoreContainer; private $bstoreContainer;
/** /**
* Array of options for the drawing group * Array of options for the drawing group
* *
* @var array * @var array
*/ */
private $_OPT = array(); private $OPT = array();
/** /**
* Array of identifier clusters containg information about the maximum shape identifiers * Array of identifier clusters containg information about the maximum shape identifiers
* *
* @var array * @var array
*/ */
private $_IDCLs = array(); private $IDCLs = array();
/** /**
* Get maximum shape index of all shapes in all drawings (plus one) * Get maximum shape index of all shapes in all drawings (plus one)
@ -83,7 +76,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function getSpIdMax() public function getSpIdMax()
{ {
return $this->_spIdMax; return $this->spIdMax;
} }
/** /**
@ -93,7 +86,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function setSpIdMax($value) public function setSpIdMax($value)
{ {
$this->_spIdMax = $value; $this->spIdMax = $value;
} }
/** /**
@ -103,7 +96,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function getCDgSaved() public function getCDgSaved()
{ {
return $this->_cDgSaved; return $this->cDgSaved;
} }
/** /**
@ -113,7 +106,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function setCDgSaved($value) public function setCDgSaved($value)
{ {
$this->_cDgSaved = $value; $this->cDgSaved = $value;
} }
/** /**
@ -123,7 +116,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function getCSpSaved() public function getCSpSaved()
{ {
return $this->_cSpSaved; return $this->cSpSaved;
} }
/** /**
@ -133,7 +126,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function setCSpSaved($value) public function setCSpSaved($value)
{ {
$this->_cSpSaved = $value; $this->cSpSaved = $value;
} }
/** /**
@ -143,7 +136,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function getBstoreContainer() public function getBstoreContainer()
{ {
return $this->_bstoreContainer; return $this->bstoreContainer;
} }
/** /**
@ -153,7 +146,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function setBstoreContainer($bstoreContainer) public function setBstoreContainer($bstoreContainer)
{ {
$this->_bstoreContainer = $bstoreContainer; $this->bstoreContainer = $bstoreContainer;
} }
/** /**
@ -164,7 +157,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function setOPT($property, $value) public function setOPT($property, $value)
{ {
$this->_OPT[$property] = $value; $this->OPT[$property] = $value;
} }
/** /**
@ -175,8 +168,8 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function getOPT($property) public function getOPT($property)
{ {
if (isset($this->_OPT[$property])) { if (isset($this->OPT[$property])) {
return $this->_OPT[$property]; return $this->OPT[$property];
} }
return null; return null;
} }
@ -188,7 +181,7 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function getIDCLs() public function getIDCLs()
{ {
return $this->_IDCLs; return $this->IDCLs;
} }
/** /**
@ -198,6 +191,6 @@ class PHPExcel_Shared_Escher_DggContainer
*/ */
public function setIDCLs($pValue) public function setIDCLs($pValue)
{ {
$this->_IDCLs = $pValue; $this->IDCLs = $pValue;
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher_DggContainer_BstoreContainer
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
{ {
/** /**
@ -39,7 +32,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
* *
* @var array * @var array
*/ */
private $_BSECollection = array(); private $BSECollection = array();
/** /**
* Add a BLIP Store Entry * Add a BLIP Store Entry
@ -48,7 +41,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*/ */
public function addBSE($BSE) public function addBSE($BSE)
{ {
$this->_BSECollection[] = $BSE; $this->BSECollection[] = $BSE;
$BSE->setParent($this); $BSE->setParent($this);
} }
@ -59,6 +52,6 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*/ */
public function getBSECollection() public function getBSECollection()
{ {
return $this->_BSECollection; return $this->BSECollection;
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,26 +25,18 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
{ {
const BLIPTYPE_ERROR = 0x00; const BLIPTYPE_ERROR = 0x00;
const BLIPTYPE_UNKNOWN = 0x01; const BLIPTYPE_UNKNOWN = 0x01;
const BLIPTYPE_EMF = 0x02; const BLIPTYPE_EMF = 0x02;
const BLIPTYPE_WMF = 0x03; const BLIPTYPE_WMF = 0x03;
const BLIPTYPE_PICT = 0x04; const BLIPTYPE_PICT = 0x04;
const BLIPTYPE_JPEG = 0x05; const BLIPTYPE_JPEG = 0x05;
const BLIPTYPE_PNG = 0x06; const BLIPTYPE_PNG = 0x06;
const BLIPTYPE_DIB = 0x07; const BLIPTYPE_DIB = 0x07;
const BLIPTYPE_TIFF = 0x11; const BLIPTYPE_TIFF = 0x11;
const BLIPTYPE_CMYKJPEG = 0x12; const BLIPTYPE_CMYKJPEG = 0x12;
/** /**
* The parent BLIP Store Entry Container * The parent BLIP Store Entry Container
@ -57,14 +50,14 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
* *
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip * @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/ */
private $_blip; private $blip;
/** /**
* The BLIP type * The BLIP type
* *
* @var int * @var int
*/ */
private $_blipType; private $blipType;
/** /**
* Set parent BLIP Store Entry Container * Set parent BLIP Store Entry Container
@ -83,7 +76,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/ */
public function getBlip() public function getBlip()
{ {
return $this->_blip; return $this->blip;
} }
/** /**
@ -93,7 +86,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/ */
public function setBlip($blip) public function setBlip($blip)
{ {
$this->_blip = $blip; $this->blip = $blip;
$blip->setParent($this); $blip->setParent($this);
} }
@ -104,7 +97,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/ */
public function getBlipType() public function getBlipType()
{ {
return $this->_blipType; return $this->blipType;
} }
/** /**
@ -114,6 +107,6 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/ */
public function setBlipType($blipType) public function setBlipType($blipType)
{ {
$this->_blipType = $blipType; $this->blipType = $blipType;
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
{ {
/** /**
@ -39,14 +32,14 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
* *
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE * @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/ */
private $_parent; private $parent;
/** /**
* Raw image data * Raw image data
* *
* @var string * @var string
*/ */
private $_data; private $data;
/** /**
* Get the raw image data * Get the raw image data
@ -55,7 +48,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/ */
public function getData() public function getData()
{ {
return $this->_data; return $this->data;
} }
/** /**
@ -65,7 +58,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/ */
public function setData($data) public function setData($data)
{ {
$this->_data = $data; $this->data = $data;
} }
/** /**
@ -75,7 +68,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/ */
public function setParent($parent) public function setParent($parent)
{ {
$this->_parent = $parent; $this->parent = $parent;
} }
/** /**
@ -85,6 +78,6 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/ */
public function getParent() public function getParent()
{ {
return $this->_parent; return $this->parent;
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Shared_Excel5
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Shared_Excel5
*
* @category PHPExcel
* @package PHPExcel_Shared
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Shared_Excel5 class PHPExcel_Shared_Excel5
{ {
/** /**
@ -56,7 +49,7 @@ class PHPExcel_Shared_Excel5
$columnDimension = $columnDimensions[$col]; $columnDimension = $columnDimensions[$col];
$width = $columnDimension->getWidth(); $width = $columnDimension->getWidth();
$pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font); $pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font);
} else if ($sheet->getDefaultColumnDimension()->getWidth() != -1) { } elseif ($sheet->getDefaultColumnDimension()->getWidth() != -1) {
// then we have default column dimension with explicit width // then we have default column dimension with explicit width
$defaultColumnDimension = $sheet->getDefaultColumnDimension(); $defaultColumnDimension = $sheet->getDefaultColumnDimension();
$width = $defaultColumnDimension->getWidth(); $width = $defaultColumnDimension->getWidth();
@ -98,7 +91,7 @@ class PHPExcel_Shared_Excel5
$rowDimension = $rowDimensions[$row]; $rowDimension = $rowDimensions[$row];
$rowHeight = $rowDimension->getRowHeight(); $rowHeight = $rowDimension->getRowHeight();
$pixelRowHeight = (int) ceil(4 * $rowHeight / 3); // here we assume Arial 10 $pixelRowHeight = (int) ceil(4 * $rowHeight / 3); // here we assume Arial 10
} else if ($sheet->getDefaultRowDimension()->getRowHeight() != -1) { } elseif ($sheet->getDefaultRowDimension()->getRowHeight() != -1) {
// then we have a default row dimension with explicit height // then we have a default row dimension with explicit height
$defaultRowDimension = $sheet->getDefaultRowDimension(); $defaultRowDimension = $sheet->getDefaultRowDimension();
$rowHeight = $defaultRowDimension->getRowHeight(); $rowHeight = $defaultRowDimension->getRowHeight();

View File

@ -39,7 +39,7 @@ class PHPExcel_Shared_Font
const AUTOSIZE_METHOD_APPROX = 'approx'; const AUTOSIZE_METHOD_APPROX = 'approx';
const AUTOSIZE_METHOD_EXACT = 'exact'; const AUTOSIZE_METHOD_EXACT = 'exact';
private static $_autoSizeMethods = array( private static $autoSizeMethods = array(
self::AUTOSIZE_METHOD_APPROX, self::AUTOSIZE_METHOD_APPROX,
self::AUTOSIZE_METHOD_EXACT, self::AUTOSIZE_METHOD_EXACT,
); );
@ -196,7 +196,7 @@ class PHPExcel_Shared_Font
*/ */
public static function setAutoSizeMethod($pValue = self::AUTOSIZE_METHOD_APPROX) public static function setAutoSizeMethod($pValue = self::AUTOSIZE_METHOD_APPROX)
{ {
if (!in_array($pValue, self::$_autoSizeMethods)) { if (!in_array($pValue, self::$autoSizeMethods)) {
return false; return false;
} }
self::$autoSizeMethod = $pValue; self::$autoSizeMethod = $pValue;

View File

@ -15,8 +15,8 @@
* @author Michael Bommarito * @author Michael Bommarito
* @version 1.2 * @version 1.2
*/ */
class CholeskyDecomposition { class CholeskyDecomposition
{
/** /**
* Decomposition storage * Decomposition storage
* @var array * @var array
@ -38,21 +38,21 @@ class CholeskyDecomposition {
*/ */
private $isspd = true; private $isspd = true;
/** /**
* CholeskyDecomposition * CholeskyDecomposition
* *
* Class constructor - decomposes symmetric positive definite matrix * Class constructor - decomposes symmetric positive definite matrix
* @param mixed Matrix square symmetric positive definite matrix * @param mixed Matrix square symmetric positive definite matrix
*/ */
public function __construct($A = null) { public function __construct($A = null)
{
if ($A instanceof Matrix) { if ($A instanceof Matrix) {
$this->L = $A->getArray(); $this->L = $A->getArray();
$this->m = $A->getRowDimension(); $this->m = $A->getRowDimension();
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = $i; $j < $this->m; ++$j) { for ($j = $i; $j < $this->m; ++$j) {
for($sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; --$k) { for ($sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; --$k) {
$sum -= $this->L[$i][$k] * $this->L[$j][$k]; $sum -= $this->L[$i][$k] * $this->L[$j][$k];
} }
if ($i == $j) { if ($i == $j) {
@ -77,35 +77,35 @@ class CholeskyDecomposition {
} }
} // function __construct() } // function __construct()
/** /**
* Is the matrix symmetric and positive definite? * Is the matrix symmetric and positive definite?
* *
* @return boolean * @return boolean
*/ */
public function isSPD() { public function isSPD()
{
return $this->isspd; return $this->isspd;
} // function isSPD() } // function isSPD()
/** /**
* getL * getL
* *
* Return triangular factor. * Return triangular factor.
* @return Matrix Lower triangular matrix * @return Matrix Lower triangular matrix
*/ */
public function getL() { public function getL()
{
return new Matrix($this->L); return new Matrix($this->L);
} // function getL() } // function getL()
/** /**
* Solve A*X = B * Solve A*X = B
* *
* @param $B Row-equal matrix * @param $B Row-equal matrix
* @return Matrix L * L' * X = B * @return Matrix L * L' * X = B
*/ */
public function solve($B = null) { public function solve($B = null)
{
if ($B instanceof Matrix) { if ($B instanceof Matrix) {
if ($B->getRowDimension() == $this->m) { if ($B->getRowDimension() == $this->m) {
if ($this->isspd) { if ($this->isspd) {
@ -145,5 +145,4 @@ class CholeskyDecomposition {
throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException)); throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
} }
} // function solve() } // function solve()
}
} // class CholeskyDecomposition

View File

@ -21,8 +21,8 @@
* @license PHP v3.0 * @license PHP v3.0
* @version 1.1 * @version 1.1
*/ */
class EigenvalueDecomposition { class EigenvalueDecomposition
{
/** /**
* Row and column dimension (square matrix). * Row and column dimension (square matrix).
* @var int * @var int
@ -67,13 +67,13 @@ class EigenvalueDecomposition {
private $cdivr; private $cdivr;
private $cdivi; private $cdivi;
/** /**
* Symmetric Householder reduction to tridiagonal form. * Symmetric Householder reduction to tridiagonal form.
* *
* @access private * @access private
*/ */
private function tred2 () { private function tred2()
{
// This is derived from the Algol procedures tred2 by // This is derived from the Algol procedures tred2 by
// Bowdler, Martin, Reinsch, and Wilkinson, Handbook for // Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
// Auto. Comp., Vol.ii-Linear Algebra, and the corresponding // Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
@ -171,7 +171,6 @@ class EigenvalueDecomposition {
$this->e[0] = 0.0; $this->e[0] = 0.0;
} }
/** /**
* Symmetric tridiagonal QL algorithm. * Symmetric tridiagonal QL algorithm.
* *
@ -182,22 +181,24 @@ class EigenvalueDecomposition {
* *
* @access private * @access private
*/ */
private function tql2() { private function tql2()
{
for ($i = 1; $i < $this->n; ++$i) { for ($i = 1; $i < $this->n; ++$i) {
$this->e[$i-1] = $this->e[$i]; $this->e[$i-1] = $this->e[$i];
} }
$this->e[$this->n-1] = 0.0; $this->e[$this->n-1] = 0.0;
$f = 0.0; $f = 0.0;
$tst1 = 0.0; $tst1 = 0.0;
$eps = pow(2.0,-52.0); $eps = pow(2.0, -52.0);
for ($l = 0; $l < $this->n; ++$l) { for ($l = 0; $l < $this->n; ++$l) {
// Find small subdiagonal element // Find small subdiagonal element
$tst1 = max($tst1, abs($this->d[$l]) + abs($this->e[$l])); $tst1 = max($tst1, abs($this->d[$l]) + abs($this->e[$l]));
$m = $l; $m = $l;
while ($m < $this->n) { while ($m < $this->n) {
if (abs($this->e[$m]) <= $eps * $tst1) if (abs($this->e[$m]) <= $eps * $tst1) {
break; break;
}
++$m; ++$m;
} }
// If m == l, $this->d[l] is an eigenvalue, // If m == l, $this->d[l] is an eigenvalue,
@ -211,14 +212,16 @@ class EigenvalueDecomposition {
$g = $this->d[$l]; $g = $this->d[$l];
$p = ($this->d[$l+1] - $g) / (2.0 * $this->e[$l]); $p = ($this->d[$l+1] - $g) / (2.0 * $this->e[$l]);
$r = hypo($p, 1.0); $r = hypo($p, 1.0);
if ($p < 0) if ($p < 0) {
$r *= -1; $r *= -1;
}
$this->d[$l] = $this->e[$l] / ($p + $r); $this->d[$l] = $this->e[$l] / ($p + $r);
$this->d[$l+1] = $this->e[$l] * ($p + $r); $this->d[$l+1] = $this->e[$l] * ($p + $r);
$dl1 = $this->d[$l+1]; $dl1 = $this->d[$l+1];
$h = $g - $this->d[$l]; $h = $g - $this->d[$l];
for ($i = $l + 2; $i < $this->n; ++$i) for ($i = $l + 2; $i < $this->n; ++$i) {
$this->d[$i] -= $h; $this->d[$i] -= $h;
}
$f += $h; $f += $h;
// Implicit QL transformation. // Implicit QL transformation.
$p = $this->d[$m]; $p = $this->d[$m];
@ -277,7 +280,6 @@ class EigenvalueDecomposition {
} }
} }
/** /**
* Nonsymmetric reduction to Hessenberg form. * Nonsymmetric reduction to Hessenberg form.
* *
@ -288,7 +290,8 @@ class EigenvalueDecomposition {
* *
* @access private * @access private
*/ */
private function orthes () { private function orthes()
{
$low = 0; $low = 0;
$high = $this->n-1; $high = $this->n-1;
@ -364,13 +367,13 @@ class EigenvalueDecomposition {
} }
} }
/** /**
* Performs complex division. * Performs complex division.
* *
* @access private * @access private
*/ */
private function cdiv($xr, $xi, $yr, $yi) { private function cdiv($xr, $xi, $yr, $yi)
{
if (abs($yr) > abs($yi)) { if (abs($yr) > abs($yi)) {
$r = $yi / $yr; $r = $yi / $yr;
$d = $yr + $r * $yi; $d = $yr + $r * $yi;
@ -384,7 +387,6 @@ class EigenvalueDecomposition {
} }
} }
/** /**
* Nonsymmetric reduction from Hessenberg to real Schur form. * Nonsymmetric reduction from Hessenberg to real Schur form.
* *
@ -395,7 +397,8 @@ class EigenvalueDecomposition {
* *
* @access private * @access private
*/ */
private function hqr2 () { private function hqr2()
{
// Initialize // Initialize
$nn = $this->n; $nn = $this->n;
$n = $nn - 1; $n = $nn - 1;
@ -408,7 +411,7 @@ class EigenvalueDecomposition {
$norm = 0.0; $norm = 0.0;
for ($i = 0; $i < $nn; ++$i) { for ($i = 0; $i < $nn; ++$i) {
if (($i < $low) OR ($i > $high)) { if (($i < $low) or ($i > $high)) {
$this->d[$i] = $this->H[$i][$i]; $this->d[$i] = $this->H[$i][$i];
$this->e[$i] = 0.0; $this->e[$i] = 0.0;
} }
@ -441,7 +444,7 @@ class EigenvalueDecomposition {
--$n; --$n;
$iter = 0; $iter = 0;
// Two roots found // Two roots found
} else if ($l == $n-1) { } elseif ($l == $n-1) {
$w = $this->H[$n][$n-1] * $this->H[$n-1][$n]; $w = $this->H[$n][$n-1] * $this->H[$n-1][$n];
$p = ($this->H[$n-1][$n-1] - $this->H[$n][$n]) / 2.0; $p = ($this->H[$n-1][$n-1] - $this->H[$n][$n]) / 2.0;
$q = $p * $p + $w; $q = $p * $p + $w;
@ -477,7 +480,7 @@ class EigenvalueDecomposition {
$this->H[$n][$j] = $q * $this->H[$n][$j] - $p * $z; $this->H[$n][$j] = $q * $this->H[$n][$j] - $p * $z;
} }
// Column modification // Column modification
for ($i = 0; $i <= n; ++$i) { for ($i = 0; $i <= $n; ++$i) {
$z = $this->H[$i][$n-1]; $z = $this->H[$i][$n-1];
$this->H[$i][$n-1] = $q * $z + $p * $this->H[$i][$n]; $this->H[$i][$n-1] = $q * $z + $p * $this->H[$i][$n];
$this->H[$i][$n] = $q * $this->H[$i][$n] - $p * $z; $this->H[$i][$n] = $q * $this->H[$i][$n] - $p * $z;
@ -684,7 +687,7 @@ class EigenvalueDecomposition {
} }
} }
// Complex vector // Complex vector
} else if ($q < 0) { } elseif ($q < 0) {
$l = $n-1; $l = $n-1;
// Last vector component imaginary so matrix is triangular // Last vector component imaginary so matrix is triangular
if (abs($this->H[$n][$n-1]) > abs($this->H[$n-1][$n])) { if (abs($this->H[$n][$n-1]) > abs($this->H[$n-1][$n])) {
@ -738,7 +741,7 @@ class EigenvalueDecomposition {
} }
} }
// Overflow control // Overflow control
$t = max(abs($this->H[$i][$n-1]),abs($this->H[$i][$n])); $t = max(abs($this->H[$i][$n-1]), abs($this->H[$i][$n]));
if (($eps * $t) * $t > 1) { if (($eps * $t) * $t > 1) {
for ($j = $i; $j <= $n; ++$j) { for ($j = $i; $j <= $n; ++$j) {
$this->H[$j][$n-1] = $this->H[$j][$n-1] / $t; $this->H[$j][$n-1] = $this->H[$j][$n-1] / $t;
@ -771,7 +774,6 @@ class EigenvalueDecomposition {
} }
} // end hqr2 } // end hqr2
/** /**
* Constructor: Check for symmetry, then construct the eigenvalue decomposition * Constructor: Check for symmetry, then construct the eigenvalue decomposition
* *
@ -779,7 +781,8 @@ class EigenvalueDecomposition {
* @param A Square matrix * @param A Square matrix
* @return Structure to access D and V. * @return Structure to access D and V.
*/ */
public function __construct($Arg) { public function __construct($Arg)
{
$this->A = $Arg->getArray(); $this->A = $Arg->getArray();
$this->n = $Arg->getColumnDimension(); $this->n = $Arg->getColumnDimension();
@ -806,47 +809,47 @@ class EigenvalueDecomposition {
} }
} }
/** /**
* Return the eigenvector matrix * Return the eigenvector matrix
* *
* @access public * @access public
* @return V * @return V
*/ */
public function getV() { public function getV()
{
return new Matrix($this->V, $this->n, $this->n); return new Matrix($this->V, $this->n, $this->n);
} }
/** /**
* Return the real parts of the eigenvalues * Return the real parts of the eigenvalues
* *
* @access public * @access public
* @return real(diag(D)) * @return real(diag(D))
*/ */
public function getRealEigenvalues() { public function getRealEigenvalues()
{
return $this->d; return $this->d;
} }
/** /**
* Return the imaginary parts of the eigenvalues * Return the imaginary parts of the eigenvalues
* *
* @access public * @access public
* @return imag(diag(D)) * @return imag(diag(D))
*/ */
public function getImagEigenvalues() { public function getImagEigenvalues()
{
return $this->e; return $this->e;
} }
/** /**
* Return the block diagonal eigenvalue matrix * Return the block diagonal eigenvalue matrix
* *
* @access public * @access public
* @return D * @return D
*/ */
public function getD() { public function getD()
{
for ($i = 0; $i < $this->n; ++$i) { for ($i = 0; $i < $this->n; ++$i) {
$D[$i] = array_fill(0, $this->n, 0.0); $D[$i] = array_fill(0, $this->n, 0.0);
$D[$i][$i] = $this->d[$i]; $D[$i][$i] = $this->d[$i];
@ -858,5 +861,4 @@ class EigenvalueDecomposition {
} }
return new Matrix($D); return new Matrix($D);
} }
}
} // class EigenvalueDecomposition

View File

@ -18,8 +18,8 @@
* @version 1.1 * @version 1.1
* @license PHP v3.0 * @license PHP v3.0
*/ */
class PHPExcel_Shared_JAMA_LUDecomposition { class PHPExcel_Shared_JAMA_LUDecomposition
{
const MatrixSingularException = "Can only perform operation on singular matrix."; const MatrixSingularException = "Can only perform operation on singular matrix.";
const MatrixSquareException = "Mismatched Row dimension"; const MatrixSquareException = "Mismatched Row dimension";
@ -53,14 +53,14 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
*/ */
private $piv = array(); private $piv = array();
/** /**
* LU Decomposition constructor. * LU Decomposition constructor.
* *
* @param $A Rectangular matrix * @param $A Rectangular matrix
* @return Structure to access L, U and piv. * @return Structure to access L, U and piv.
*/ */
public function __construct($A) { public function __construct($A)
{
if ($A instanceof PHPExcel_Shared_JAMA_Matrix) { if ($A instanceof PHPExcel_Shared_JAMA_Matrix) {
// Use a "left-looking", dot-product, Crout/Doolittle algorithm. // Use a "left-looking", dot-product, Crout/Doolittle algorithm.
$this->LU = $A->getArray(); $this->LU = $A->getArray();
@ -119,13 +119,13 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
} }
} // function __construct() } // function __construct()
/** /**
* Get lower triangular factor. * Get lower triangular factor.
* *
* @return array Lower triangular factor * @return array Lower triangular factor
*/ */
public function getL() { public function getL()
{
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($i > $j) { if ($i > $j) {
@ -140,13 +140,13 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($L); return new PHPExcel_Shared_JAMA_Matrix($L);
} // function getL() } // function getL()
/** /**
* Get upper triangular factor. * Get upper triangular factor.
* *
* @return array Upper triangular factor * @return array Upper triangular factor
*/ */
public function getU() { public function getU()
{
for ($i = 0; $i < $this->n; ++$i) { for ($i = 0; $i < $this->n; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($i <= $j) { if ($i <= $j) {
@ -159,33 +159,33 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($U); return new PHPExcel_Shared_JAMA_Matrix($U);
} // function getU() } // function getU()
/** /**
* Return pivot permutation vector. * Return pivot permutation vector.
* *
* @return array Pivot vector * @return array Pivot vector
*/ */
public function getPivot() { public function getPivot()
{
return $this->piv; return $this->piv;
} // function getPivot() } // function getPivot()
/** /**
* Alias for getPivot * Alias for getPivot
* *
* @see getPivot * @see getPivot
*/ */
public function getDoublePivot() { public function getDoublePivot()
{
return $this->getPivot(); return $this->getPivot();
} // function getDoublePivot() } // function getDoublePivot()
/** /**
* Is the matrix nonsingular? * Is the matrix nonsingular?
* *
* @return true if U, and hence A, is nonsingular. * @return true if U, and hence A, is nonsingular.
*/ */
public function isNonsingular() { public function isNonsingular()
{
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($this->LU[$j][$j] == 0) { if ($this->LU[$j][$j] == 0) {
return false; return false;
@ -194,13 +194,13 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
return true; return true;
} // function isNonsingular() } // function isNonsingular()
/** /**
* Count determinants * Count determinants
* *
* @return array d matrix deterninat * @return array d matrix deterninat
*/ */
public function det() { public function det()
{
if ($this->m == $this->n) { if ($this->m == $this->n) {
$d = $this->pivsign; $d = $this->pivsign;
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
@ -212,7 +212,6 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
} }
} // function det() } // function det()
/** /**
* Solve A*X = B * Solve A*X = B
* *
@ -221,7 +220,8 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
* @PHPExcel_Calculation_Exception IllegalArgumentException Matrix row dimensions must agree. * @PHPExcel_Calculation_Exception IllegalArgumentException Matrix row dimensions must agree.
* @PHPExcel_Calculation_Exception RuntimeException Matrix is singular. * @PHPExcel_Calculation_Exception RuntimeException Matrix is singular.
*/ */
public function solve($B) { public function solve($B)
{
if ($B->getRowDimension() == $this->m) { if ($B->getRowDimension() == $this->m) {
if ($this->isNonsingular()) { if ($this->isNonsingular()) {
// Copy right hand side with pivoting // Copy right hand side with pivoting
@ -254,5 +254,4 @@ class PHPExcel_Shared_JAMA_LUDecomposition {
throw new PHPExcel_Calculation_Exception(self::MatrixSquareException); throw new PHPExcel_Calculation_Exception(self::MatrixSquareException);
} }
} // function solve() } // function solve()
}
} // class PHPExcel_Shared_JAMA_LUDecomposition

File diff suppressed because it is too large Load Diff

View File

@ -16,8 +16,8 @@
* @license PHP v3.0 * @license PHP v3.0
* @version 1.1 * @version 1.1
*/ */
class PHPExcel_Shared_JAMA_QRDecomposition { class PHPExcel_Shared_JAMA_QRDecomposition
{
const MatrixRankException = "Can only perform operation on full-rank matrix."; const MatrixRankException = "Can only perform operation on full-rank matrix.";
/** /**
@ -51,7 +51,8 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
* @param matrix $A Rectangular matrix * @param matrix $A Rectangular matrix
* @return Structure to access R and the Householder vectors and compute Q. * @return Structure to access R and the Householder vectors and compute Q.
*/ */
public function __construct($A) { public function __construct($A)
{
if ($A instanceof PHPExcel_Shared_JAMA_Matrix) { if ($A instanceof PHPExcel_Shared_JAMA_Matrix) {
// Initialize. // Initialize.
$this->QR = $A->getArrayCopy(); $this->QR = $A->getArrayCopy();
@ -98,7 +99,8 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
* *
* @return boolean true if R, and hence A, has full rank, else false. * @return boolean true if R, and hence A, has full rank, else false.
*/ */
public function isFullRank() { public function isFullRank()
{
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($this->Rdiag[$j] == 0) { if ($this->Rdiag[$j] == 0) {
return false; return false;
@ -107,13 +109,13 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
return true; return true;
} // function isFullRank() } // function isFullRank()
/** /**
* Return the Householder vectors * Return the Householder vectors
* *
* @return Matrix Lower trapezoidal matrix whose columns define the reflections * @return Matrix Lower trapezoidal matrix whose columns define the reflections
*/ */
public function getH() { public function getH()
{
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($i >= $j) { if ($i >= $j) {
@ -126,13 +128,13 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($H); return new PHPExcel_Shared_JAMA_Matrix($H);
} // function getH() } // function getH()
/** /**
* Return the upper triangular factor * Return the upper triangular factor
* *
* @return Matrix upper triangular factor * @return Matrix upper triangular factor
*/ */
public function getR() { public function getR()
{
for ($i = 0; $i < $this->n; ++$i) { for ($i = 0; $i < $this->n; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($i < $j) { if ($i < $j) {
@ -147,13 +149,13 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($R); return new PHPExcel_Shared_JAMA_Matrix($R);
} // function getR() } // function getR()
/** /**
* Generate and return the (economy-sized) orthogonal factor * Generate and return the (economy-sized) orthogonal factor
* *
* @return Matrix orthogonal factor * @return Matrix orthogonal factor
*/ */
public function getQ() { public function getQ()
{
for ($k = $this->n-1; $k >= 0; --$k) { for ($k = $this->n-1; $k >= 0; --$k) {
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
$Q[$i][$k] = 0.0; $Q[$i][$k] = 0.0;
@ -184,14 +186,14 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
return new PHPExcel_Shared_JAMA_Matrix($Q); return new PHPExcel_Shared_JAMA_Matrix($Q);
} // function getQ() } // function getQ()
/** /**
* Least squares solution of A*X = B * Least squares solution of A*X = B
* *
* @param Matrix $B A Matrix with as many rows as A and any number of columns. * @param Matrix $B A Matrix with as many rows as A and any number of columns.
* @return Matrix Matrix that minimizes the two norm of Q*R*X-B. * @return Matrix Matrix that minimizes the two norm of Q*R*X-B.
*/ */
public function solve($B) { public function solve($B)
{
if ($B->getRowDimension() == $this->m) { if ($B->getRowDimension() == $this->m) {
if ($this->isFullRank()) { if ($this->isFullRank()) {
// Copy right hand side // Copy right hand side
@ -230,5 +232,4 @@ class PHPExcel_Shared_JAMA_QRDecomposition {
throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException); throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
} }
} // function solve() } // function solve()
}
} // PHPExcel_Shared_JAMA_class QRDecomposition

View File

@ -17,8 +17,8 @@
* @license PHP v3.0 * @license PHP v3.0
* @version 1.1 * @version 1.1
*/ */
class SingularValueDecomposition { class SingularValueDecomposition
{
/** /**
* Internal storage of U. * Internal storage of U.
* @var array * @var array
@ -49,7 +49,6 @@ class SingularValueDecomposition {
*/ */
private $n; private $n;
/** /**
* Construct the singular value decomposition * Construct the singular value decomposition
* *
@ -58,8 +57,8 @@ class SingularValueDecomposition {
* @param $A Rectangular matrix * @param $A Rectangular matrix
* @return Structure to access U, S and V. * @return Structure to access U, S and V.
*/ */
public function __construct($Arg) { public function __construct($Arg)
{
// Initialize. // Initialize.
$A = $Arg->getArrayCopy(); $A = $Arg->getArrayCopy();
$this->m = $Arg->getRowDimension(); $this->m = $Arg->getRowDimension();
@ -75,7 +74,6 @@ class SingularValueDecomposition {
// Reduce A to bidiagonal form, storing the diagonal elements // Reduce A to bidiagonal form, storing the diagonal elements
// in s and the super-diagonal elements in e. // in s and the super-diagonal elements in e.
for ($k = 0; $k < max($nct, $nrt); ++$k) { for ($k = 0; $k < max($nct, $nrt); ++$k) {
if ($k < $nct) { if ($k < $nct) {
// Compute the transformation for the k-th column and // Compute the transformation for the k-th column and
// place the k-th diagonal in s[$k]. // place the k-th diagonal in s[$k].
@ -113,7 +111,7 @@ class SingularValueDecomposition {
} }
} }
if ($wantu AND ($k < $nct)) { if ($wantu and ($k < $nct)) {
// Place the transformation in U for subsequent back // Place the transformation in U for subsequent back
// multiplication. // multiplication.
for ($i = $k; $i < $this->m; ++$i) { for ($i = $k; $i < $this->m; ++$i) {
@ -139,7 +137,7 @@ class SingularValueDecomposition {
$e[$k+1] += 1.0; $e[$k+1] += 1.0;
} }
$e[$k] = -$e[$k]; $e[$k] = -$e[$k];
if (($k+1 < $this->m) AND ($e[$k] != 0.0)) { if (($k+1 < $this->m) and ($e[$k] != 0.0)) {
// Apply the transformation. // Apply the transformation.
for ($i = $k+1; $i < $this->m; ++$i) { for ($i = $k+1; $i < $this->m; ++$i) {
$work[$i] = 0.0; $work[$i] = 0.0;
@ -198,7 +196,7 @@ class SingularValueDecomposition {
$this->U[$i][$j] += $t * $this->U[$i][$k]; $this->U[$i][$j] += $t * $this->U[$i][$k];
} }
} }
for ($i = $k; $i < $this->m; ++$i ) { for ($i = $k; $i < $this->m; ++$i) {
$this->U[$i][$k] = -$this->U[$i][$k]; $this->U[$i][$k] = -$this->U[$i][$k];
} }
$this->U[$k][$k] = 1.0 + $this->U[$k][$k]; $this->U[$k][$k] = 1.0 + $this->U[$k][$k];
@ -217,7 +215,7 @@ class SingularValueDecomposition {
// If required, generate V. // If required, generate V.
if ($wantv) { if ($wantv) {
for ($k = $this->n - 1; $k >= 0; --$k) { for ($k = $this->n - 1; $k >= 0; --$k) {
if (($k < $nrt) AND ($e[$k] != 0.0)) { if (($k < $nrt) and ($e[$k] != 0.0)) {
for ($j = $k + 1; $j < $nu; ++$j) { for ($j = $k + 1; $j < $nu; ++$j) {
$t = 0; $t = 0;
for ($i = $k + 1; $i < $this->n; ++$i) { for ($i = $k + 1; $i < $this->n; ++$i) {
@ -268,14 +266,14 @@ class SingularValueDecomposition {
break; break;
} }
$t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks-1]) : 0.); $t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks-1]) : 0.);
if (abs($this->s[$ks]) <= $eps * $t) { if (abs($this->s[$ks]) <= $eps * $t) {
$this->s[$ks] = 0.0; $this->s[$ks] = 0.0;
break; break;
} }
} }
if ($ks == $k) { if ($ks == $k) {
$kase = 3; $kase = 3;
} else if ($ks == $p-1) { } elseif ($ks == $p-1) {
$kase = 1; $kase = 1;
} else { } else {
$kase = 2; $kase = 2;
@ -288,145 +286,143 @@ class SingularValueDecomposition {
switch ($kase) { switch ($kase) {
// Deflate negligible s(p). // Deflate negligible s(p).
case 1: case 1:
$f = $e[$p-2]; $f = $e[$p-2];
$e[$p-2] = 0.0; $e[$p-2] = 0.0;
for ($j = $p - 2; $j >= $k; --$j) { for ($j = $p - 2; $j >= $k; --$j) {
$t = hypo($this->s[$j], $f); $t = hypo($this->s[$j], $f);
$cs = $this->s[$j] / $t; $cs = $this->s[$j] / $t;
$sn = $f / $t; $sn = $f / $t;
$this->s[$j] = $t; $this->s[$j] = $t;
if ($j != $k) { if ($j != $k) {
$f = -$sn * $e[$j-1]; $f = -$sn * $e[$j-1];
$e[$j-1] = $cs * $e[$j-1]; $e[$j-1] = $cs * $e[$j-1];
} }
if ($wantv) { if ($wantv) {
for ($i = 0; $i < $this->n; ++$i) { for ($i = 0; $i < $this->n; ++$i) {
$t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$p-1]; $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$p-1];
$this->V[$i][$p-1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$p-1]; $this->V[$i][$p-1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$p-1];
$this->V[$i][$j] = $t; $this->V[$i][$j] = $t;
}
} }
} }
break; }
break;
// Split at negligible s(k). // Split at negligible s(k).
case 2: case 2:
$f = $e[$k-1]; $f = $e[$k-1];
$e[$k-1] = 0.0; $e[$k-1] = 0.0;
for ($j = $k; $j < $p; ++$j) { for ($j = $k; $j < $p; ++$j) {
$t = hypo($this->s[$j], $f); $t = hypo($this->s[$j], $f);
$cs = $this->s[$j] / $t; $cs = $this->s[$j] / $t;
$sn = $f / $t; $sn = $f / $t;
$this->s[$j] = $t; $this->s[$j] = $t;
$f = -$sn * $e[$j]; $f = -$sn * $e[$j];
$e[$j] = $cs * $e[$j]; $e[$j] = $cs * $e[$j];
if ($wantu) { if ($wantu) {
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
$t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$k-1]; $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$k-1];
$this->U[$i][$k-1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$k-1]; $this->U[$i][$k-1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$k-1];
$this->U[$i][$j] = $t; $this->U[$i][$j] = $t;
}
} }
} }
break; }
break;
// Perform one qr step. // Perform one qr step.
case 3: case 3:
// Calculate the shift. // Calculate the shift.
$scale = max(max(max(max( $scale = max(max(max(max(abs($this->s[$p-1]), abs($this->s[$p-2])), abs($e[$p-2])), abs($this->s[$k])), abs($e[$k]));
abs($this->s[$p-1]),abs($this->s[$p-2])),abs($e[$p-2])), $sp = $this->s[$p-1] / $scale;
abs($this->s[$k])), abs($e[$k])); $spm1 = $this->s[$p-2] / $scale;
$sp = $this->s[$p-1] / $scale; $epm1 = $e[$p-2] / $scale;
$spm1 = $this->s[$p-2] / $scale; $sk = $this->s[$k] / $scale;
$epm1 = $e[$p-2] / $scale; $ek = $e[$k] / $scale;
$sk = $this->s[$k] / $scale; $b = (($spm1 + $sp) * ($spm1 - $sp) + $epm1 * $epm1) / 2.0;
$ek = $e[$k] / $scale; $c = ($sp * $epm1) * ($sp * $epm1);
$b = (($spm1 + $sp) * ($spm1 - $sp) + $epm1 * $epm1) / 2.0; $shift = 0.0;
$c = ($sp * $epm1) * ($sp * $epm1); if (($b != 0.0) || ($c != 0.0)) {
$shift = 0.0; $shift = sqrt($b * $b + $c);
if (($b != 0.0) || ($c != 0.0)) { if ($b < 0.0) {
$shift = sqrt($b * $b + $c); $shift = -$shift;
if ($b < 0.0) {
$shift = -$shift;
}
$shift = $c / ($b + $shift);
} }
$f = ($sk + $sp) * ($sk - $sp) + $shift; $shift = $c / ($b + $shift);
$g = $sk * $ek; }
// Chase zeros. $f = ($sk + $sp) * ($sk - $sp) + $shift;
for ($j = $k; $j < $p-1; ++$j) { $g = $sk * $ek;
$t = hypo($f, $g); // Chase zeros.
$cs = $f/$t; for ($j = $k; $j < $p-1; ++$j) {
$sn = $g/$t; $t = hypo($f, $g);
if ($j != $k) { $cs = $f/$t;
$e[$j-1] = $t; $sn = $g/$t;
} if ($j != $k) {
$f = $cs * $this->s[$j] + $sn * $e[$j]; $e[$j-1] = $t;
$e[$j] = $cs * $e[$j] - $sn * $this->s[$j]; }
$g = $sn * $this->s[$j+1]; $f = $cs * $this->s[$j] + $sn * $e[$j];
$this->s[$j+1] = $cs * $this->s[$j+1]; $e[$j] = $cs * $e[$j] - $sn * $this->s[$j];
if ($wantv) { $g = $sn * $this->s[$j+1];
for ($i = 0; $i < $this->n; ++$i) { $this->s[$j+1] = $cs * $this->s[$j+1];
$t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$j+1]; if ($wantv) {
$this->V[$i][$j+1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$j+1]; for ($i = 0; $i < $this->n; ++$i) {
$this->V[$i][$j] = $t; $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$j+1];
} $this->V[$i][$j+1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$j+1];
} $this->V[$i][$j] = $t;
$t = hypo($f, $g);
$cs = $f/$t;
$sn = $g/$t;
$this->s[$j] = $t;
$f = $cs * $e[$j] + $sn * $this->s[$j+1];
$this->s[$j+1] = -$sn * $e[$j] + $cs * $this->s[$j+1];
$g = $sn * $e[$j+1];
$e[$j+1] = $cs * $e[$j+1];
if ($wantu && ($j < $this->m - 1)) {
for ($i = 0; $i < $this->m; ++$i) {
$t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$j+1];
$this->U[$i][$j+1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$j+1];
$this->U[$i][$j] = $t;
}
} }
} }
$e[$p-2] = $f; $t = hypo($f, $g);
$iter = $iter + 1; $cs = $f/$t;
break; $sn = $g/$t;
$this->s[$j] = $t;
$f = $cs * $e[$j] + $sn * $this->s[$j+1];
$this->s[$j+1] = -$sn * $e[$j] + $cs * $this->s[$j+1];
$g = $sn * $e[$j+1];
$e[$j+1] = $cs * $e[$j+1];
if ($wantu && ($j < $this->m - 1)) {
for ($i = 0; $i < $this->m; ++$i) {
$t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$j+1];
$this->U[$i][$j+1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$j+1];
$this->U[$i][$j] = $t;
}
}
}
$e[$p-2] = $f;
$iter = $iter + 1;
break;
// Convergence. // Convergence.
case 4: case 4:
// Make the singular values positive. // Make the singular values positive.
if ($this->s[$k] <= 0.0) { if ($this->s[$k] <= 0.0) {
$this->s[$k] = ($this->s[$k] < 0.0 ? -$this->s[$k] : 0.0); $this->s[$k] = ($this->s[$k] < 0.0 ? -$this->s[$k] : 0.0);
if ($wantv) { if ($wantv) {
for ($i = 0; $i <= $pp; ++$i) { for ($i = 0; $i <= $pp; ++$i) {
$this->V[$i][$k] = -$this->V[$i][$k]; $this->V[$i][$k] = -$this->V[$i][$k];
}
} }
} }
// Order the singular values. }
while ($k < $pp) { // Order the singular values.
if ($this->s[$k] >= $this->s[$k+1]) { while ($k < $pp) {
break; if ($this->s[$k] >= $this->s[$k+1]) {
} break;
$t = $this->s[$k];
$this->s[$k] = $this->s[$k+1];
$this->s[$k+1] = $t;
if ($wantv AND ($k < $this->n - 1)) {
for ($i = 0; $i < $this->n; ++$i) {
$t = $this->V[$i][$k+1];
$this->V[$i][$k+1] = $this->V[$i][$k];
$this->V[$i][$k] = $t;
}
}
if ($wantu AND ($k < $this->m-1)) {
for ($i = 0; $i < $this->m; ++$i) {
$t = $this->U[$i][$k+1];
$this->U[$i][$k+1] = $this->U[$i][$k];
$this->U[$i][$k] = $t;
}
}
++$k;
} }
$iter = 0; $t = $this->s[$k];
--$p; $this->s[$k] = $this->s[$k+1];
break; $this->s[$k+1] = $t;
if ($wantv and ($k < $this->n - 1)) {
for ($i = 0; $i < $this->n; ++$i) {
$t = $this->V[$i][$k+1];
$this->V[$i][$k+1] = $this->V[$i][$k];
$this->V[$i][$k] = $t;
}
}
if ($wantu and ($k < $this->m-1)) {
for ($i = 0; $i < $this->m; ++$i) {
$t = $this->U[$i][$k+1];
$this->U[$i][$k+1] = $this->U[$i][$k];
$this->U[$i][$k] = $t;
}
}
++$k;
}
$iter = 0;
--$p;
break;
} // end switch } // end switch
} // end while } // end while
@ -439,7 +435,8 @@ class SingularValueDecomposition {
* @access public * @access public
* @return U * @return U
*/ */
public function getU() { public function getU()
{
return new Matrix($this->U, $this->m, min($this->m + 1, $this->n)); return new Matrix($this->U, $this->m, min($this->m + 1, $this->n));
} }
@ -450,7 +447,8 @@ class SingularValueDecomposition {
* @access public * @access public
* @return V * @return V
*/ */
public function getV() { public function getV()
{
return new Matrix($this->V); return new Matrix($this->V);
} }
@ -461,7 +459,8 @@ class SingularValueDecomposition {
* @access public * @access public
* @return diagonal of S. * @return diagonal of S.
*/ */
public function getSingularValues() { public function getSingularValues()
{
return $this->s; return $this->s;
} }
@ -472,7 +471,8 @@ class SingularValueDecomposition {
* @access public * @access public
* @return S * @return S
*/ */
public function getS() { public function getS()
{
for ($i = 0; $i < $this->n; ++$i) { for ($i = 0; $i < $this->n; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
$S[$i][$j] = 0.0; $S[$i][$j] = 0.0;
@ -489,7 +489,8 @@ class SingularValueDecomposition {
* @access public * @access public
* @return max(S) * @return max(S)
*/ */
public function norm2() { public function norm2()
{
return $this->s[0]; return $this->s[0];
} }
@ -500,7 +501,8 @@ class SingularValueDecomposition {
* @access public * @access public
* @return max(S)/min(S) * @return max(S)/min(S)
*/ */
public function cond() { public function cond()
{
return $this->s[0] / $this->s[min($this->m, $this->n) - 1]; return $this->s[0] / $this->s[min($this->m, $this->n) - 1];
} }
@ -511,7 +513,8 @@ class SingularValueDecomposition {
* @access public * @access public
* @return Number of nonnegligible singular values. * @return Number of nonnegligible singular values.
*/ */
public function rank() { public function rank()
{
$eps = pow(2.0, -52.0); $eps = pow(2.0, -52.0);
$tol = max($this->m, $this->n) * $this->s[0] * $eps; $tol = max($this->m, $this->n) * $this->s[0] * $eps;
$r = 0; $r = 0;
@ -522,5 +525,4 @@ class SingularValueDecomposition {
} }
return $r; return $r;
} }
}
} // class SingularValueDecomposition

View File

@ -67,7 +67,8 @@ $error['EN'][RowLengthException] = "All rows must have the same length.";
* Custom error handler * Custom error handler
* @param int $num Error number * @param int $num Error number
*/ */
function JAMAError($errorNumber = null) { function JAMAError($errorNumber = null)
{
global $error; global $error;
if (isset($errorNumber)) { if (isset($errorNumber)) {

View File

@ -11,7 +11,8 @@
* *
* r = sqrt(a^2 + b^2) without under/overflow. * r = sqrt(a^2 + b^2) without under/overflow.
*/ */
function hypo($a, $b) { function hypo($a, $b)
{
if (abs($a) > abs($b)) { if (abs($a) > abs($b)) {
$r = $b / $a; $r = $b / $a;
$r = abs($a) * sqrt(1 + $r * $r); $r = abs($a) * sqrt(1 + $r * $r);

View File

@ -72,11 +72,12 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
if (is_resource($filename)) { if (is_resource($filename)) {
$this->_FILEH_ = $filename; $this->_FILEH_ = $filename;
} else if ($filename == '-' || $filename == '') { } elseif ($filename == '-' || $filename == '') {
if ($this->_tmp_dir === null) if ($this->_tmp_dir === null) {
$this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir(); $this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir();
}
$this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root"); $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root");
$this->_FILEH_ = fopen($this->_tmp_filename,"w+b"); $this->_FILEH_ = fopen($this->_tmp_filename, "w+b");
if ($this->_FILEH_ == false) { if ($this->_FILEH_ == false) {
throw new PHPExcel_Writer_Exception("Can't create temporary file."); throw new PHPExcel_Writer_Exception("Can't create temporary file.");
} }
@ -105,8 +106,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
$this->_saveBbd($iSBDcnt, $iBBcnt, $iPPScnt); $this->_saveBbd($iSBDcnt, $iBBcnt, $iPPScnt);
if (!is_resource($filename)) { if (!is_resource($filename)) {
fclose($this->_FILEH_); fclose($this->_FILEH_);
} }
return true; return true;
} }
@ -199,33 +200,35 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
} }
// Save Header // Save Header
fwrite($FILE, fwrite(
"\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" $FILE,
. "\x00\x00\x00\x00" "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
. "\x00\x00\x00\x00" . "\x00\x00\x00\x00"
. "\x00\x00\x00\x00" . "\x00\x00\x00\x00"
. "\x00\x00\x00\x00" . "\x00\x00\x00\x00"
. pack("v", 0x3b) . "\x00\x00\x00\x00"
. pack("v", 0x03) . pack("v", 0x3b)
. pack("v", -2) . pack("v", 0x03)
. pack("v", 9) . pack("v", -2)
. pack("v", 6) . pack("v", 9)
. pack("v", 0) . pack("v", 6)
. "\x00\x00\x00\x00" . pack("v", 0)
. "\x00\x00\x00\x00" . "\x00\x00\x00\x00"
. pack("V", $iBdCnt) . "\x00\x00\x00\x00"
. pack("V", $iBBcnt+$iSBDcnt) //ROOT START . pack("V", $iBdCnt)
. pack("V", 0) . pack("V", $iBBcnt+$iSBDcnt) //ROOT START
. pack("V", 0x1000) . pack("V", 0)
. pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot . pack("V", 0x1000)
. pack("V", $iSBDcnt) . pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot
); . pack("V", $iSBDcnt)
);
// Extra BDList Start, Count // Extra BDList Start, Count
if ($iBdCnt < $i1stBdL) { if ($iBdCnt < $i1stBdL) {
fwrite($FILE, fwrite(
pack("V", -2) // Extra BDList Start $FILE,
. pack("V", 0) // Extra BDList Count pack("V", -2) // Extra BDList Start
); . pack("V", 0)// Extra BDList Count
);
} else { } else {
fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL)); fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL));
} }
@ -258,9 +261,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
for ($i = 0; $i < $iCount; ++$i) { for ($i = 0; $i < $iCount; ++$i) {
if ($raList[$i]->Type != PHPExcel_Shared_OLE::OLE_PPS_TYPE_DIR) { if ($raList[$i]->Type != PHPExcel_Shared_OLE::OLE_PPS_TYPE_DIR) {
$raList[$i]->Size = $raList[$i]->_DataLen(); $raList[$i]->Size = $raList[$i]->_DataLen();
if (($raList[$i]->Size >= PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) || if (($raList[$i]->Size >= PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) || (($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data))) {
(($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data)))
{
// Write Data // Write Data
//if (isset($raList[$i]->_PPS_FILE)) { //if (isset($raList[$i]->_PPS_FILE)) {
// $iLen = 0; // $iLen = 0;
@ -366,7 +367,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
$iCnt = count($raList); $iCnt = count($raList);
$iBCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE; $iBCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE;
if ($iCnt % $iBCnt) { if ($iCnt % $iBCnt) {
fwrite($this->_FILEH_, str_repeat("\x00",($iBCnt - ($iCnt % $iBCnt)) * PHPExcel_Shared_OLE::OLE_PPS_SIZE)); fwrite($this->_FILEH_, str_repeat("\x00", ($iBCnt - ($iCnt % $iBCnt)) * PHPExcel_Shared_OLE::OLE_PPS_SIZE));
} }
} }

View File

@ -28,7 +28,8 @@
defined('IDENTIFIER_OLE') || defined('IDENTIFIER_OLE') ||
define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1)); define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1));
class PHPExcel_Shared_OLERead { class PHPExcel_Shared_OLERead
{
private $data = ''; private $data = '';
// OLE identifier // OLE identifier
@ -272,7 +273,7 @@ class PHPExcel_Shared_OLERead {
// Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook) // Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook)
if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) { if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) {
$this->wrkbook = count($this->props) - 1; $this->wrkbook = count($this->props) - 1;
} else if ($upName === 'ROOT ENTRY' || $upName === 'R') { } elseif ($upName === 'ROOT ENTRY' || $upName === 'R') {
// Root entry // Root entry
$this->rootentry = count($this->props) - 1; $this->rootentry = count($this->props) - 1;
} }

View File

@ -319,7 +319,7 @@ class PclZip
// ----- Look for the optional second argument // ----- Look for the optional second argument
if ($v_size == 2) { if ($v_size == 2) {
$v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
} else if ($v_size > 2) { } elseif ($v_size > 2) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
return 0; return 0;
} }
@ -345,7 +345,7 @@ class PclZip
// ----- The list is a list of string names // ----- The list is a list of string names
$v_string_list = $p_filelist; $v_string_list = $p_filelist;
} }
} else if (is_string($p_filelist)) { } elseif (is_string($p_filelist)) {
// ----- Look if the $p_filelist is a string // ----- Look if the $p_filelist is a string
// ----- Create a list from the string // ----- Create a list from the string
$v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
@ -487,7 +487,7 @@ class PclZip
// ----- Look for the optional second argument // ----- Look for the optional second argument
if ($v_size == 2) { if ($v_size == 2) {
$v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
} else if ($v_size > 2) { } elseif ($v_size > 2) {
// ----- Error log // ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
@ -516,7 +516,7 @@ class PclZip
// ----- The list is a list of string names // ----- The list is a list of string names
$v_string_list = $p_filelist; $v_string_list = $p_filelist;
} }
} else if (is_string($p_filelist)) { } elseif (is_string($p_filelist)) {
// ----- Look if the $p_filelist is a string // ----- Look if the $p_filelist is a string
// ----- Create a list from the string // ----- Create a list from the string
$v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
@ -748,7 +748,7 @@ class PclZip
// ----- Look for the optional second argument // ----- Look for the optional second argument
if ($v_size == 2) { if ($v_size == 2) {
$v_remove_path = $v_arg_list[1]; $v_remove_path = $v_arg_list[1];
} else if ($v_size > 2) { } elseif ($v_size > 2) {
// ----- Error log // ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
@ -903,7 +903,7 @@ class PclZip
// ----- Look for the optional second argument // ----- Look for the optional second argument
if ($v_size == 2) { if ($v_size == 2) {
$v_remove_path = $v_arg_list[1]; $v_remove_path = $v_arg_list[1];
} else if ($v_size > 2) { } elseif ($v_size > 2) {
// ----- Error log // ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
@ -1122,7 +1122,7 @@ class PclZip
if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) { if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) {
// ----- Duplicate the archive // ----- Duplicate the archive
$v_result = $this->privDuplicate($p_archive->zipname); $v_result = $this->privDuplicate($p_archive->zipname);
} else if (is_string($p_archive)) { } elseif (is_string($p_archive)) {
// ----- Look if the $p_archive is a string (so a filename) // ----- Look if the $p_archive is a string (so a filename)
// ----- Check that $p_archive is a valid zip file // ----- Check that $p_archive is a valid zip file
// TBC : Should also check the archive format // TBC : Should also check the archive format
@ -1176,7 +1176,7 @@ class PclZip
if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip')) { if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip')) {
// ----- Merge the archive // ----- Merge the archive
$v_result = $this->privMerge($p_archive_to_add); $v_result = $this->privMerge($p_archive_to_add);
} else if (is_string($p_archive_to_add)) { } elseif (is_string($p_archive_to_add)) {
// ----- Look if the $p_archive_to_add is a string (so a filename) // ----- Look if the $p_archive_to_add is a string (so a filename)
// ----- Create a temporary archive // ----- Create a temporary archive
$v_object_archive = new PclZip($p_archive_to_add); $v_object_archive = new PclZip($p_archive_to_add);
@ -1466,7 +1466,7 @@ class PclZip
// ----- Get the value // ----- Get the value
if (is_string($p_options_list[$i+1])) { if (is_string($p_options_list[$i+1])) {
$v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1]; $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
} else if (is_array($p_options_list[$i+1])) { } elseif (is_array($p_options_list[$i+1])) {
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
} else { } else {
// ----- Error log // ----- Error log
@ -1548,9 +1548,9 @@ class PclZip
// ----- Parse items // ----- Parse items
$v_work_list = explode(",", $p_options_list[$i+1]); $v_work_list = explode(",", $p_options_list[$i+1]);
} else if (is_integer($p_options_list[$i+1])) { } elseif (is_integer($p_options_list[$i+1])) {
$v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1]; $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
} else if (is_array($p_options_list[$i+1])) { } elseif (is_array($p_options_list[$i+1])) {
$v_work_list = $p_options_list[$i+1]; $v_work_list = $p_options_list[$i+1];
} else { } else {
// ----- Error log // ----- Error log
@ -1895,16 +1895,16 @@ class PclZip
if (file_exists($v_descr['filename'])) { if (file_exists($v_descr['filename'])) {
if (@is_file($v_descr['filename'])) { if (@is_file($v_descr['filename'])) {
$v_descr['type'] = 'file'; $v_descr['type'] = 'file';
} else if (@is_dir($v_descr['filename'])) { } elseif (@is_dir($v_descr['filename'])) {
$v_descr['type'] = 'folder'; $v_descr['type'] = 'folder';
} else if (@is_link($v_descr['filename'])) { } elseif (@is_link($v_descr['filename'])) {
// skip // skip
continue; continue;
} else { } else {
// skip // skip
continue; continue;
} }
} else if (isset($v_descr['content'])) { } elseif (isset($v_descr['content'])) {
// ----- Look for string added as file // ----- Look for string added as file
$v_descr['type'] = 'virtual_file'; $v_descr['type'] = 'virtual_file';
} else { } else {
@ -2412,12 +2412,12 @@ class PclZip
if ($p_filedescr['type']=='file') { if ($p_filedescr['type']=='file') {
$p_header['external'] = 0x00000000; $p_header['external'] = 0x00000000;
$p_header['size'] = filesize($p_filename); $p_header['size'] = filesize($p_filename);
} else if ($p_filedescr['type']=='folder') { } elseif ($p_filedescr['type']=='folder') {
// ----- Look for regular folder // ----- Look for regular folder
$p_header['external'] = 0x00000010; $p_header['external'] = 0x00000010;
$p_header['mtime'] = filemtime($p_filename); $p_header['mtime'] = filemtime($p_filename);
$p_header['size'] = filesize($p_filename); $p_header['size'] = filesize($p_filename);
} else if ($p_filedescr['type'] == 'virtual_file') { } elseif ($p_filedescr['type'] == 'virtual_file') {
// ----- Look for virtual file // ----- Look for virtual file
$p_header['external'] = 0x00000000; $p_header['external'] = 0x00000000;
$p_header['size'] = strlen($p_filedescr['content']); $p_header['size'] = strlen($p_filedescr['content']);
@ -2426,7 +2426,7 @@ class PclZip
// ----- Look for filetime // ----- Look for filetime
if (isset($p_filedescr['mtime'])) { if (isset($p_filedescr['mtime'])) {
$p_header['mtime'] = $p_filedescr['mtime']; $p_header['mtime'] = $p_filedescr['mtime'];
} else if ($p_filedescr['type'] == 'virtual_file') { } elseif ($p_filedescr['type'] == 'virtual_file') {
$p_header['mtime'] = time(); $p_header['mtime'] = time();
} else { } else {
$p_header['mtime'] = filemtime($p_filename); $p_header['mtime'] = filemtime($p_filename);
@ -2526,7 +2526,7 @@ class PclZip
// ----- Write the compressed (or not) content // ----- Write the compressed (or not) content
@fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']);
} }
} else if ($p_filedescr['type'] == 'virtual_file') { } elseif ($p_filedescr['type'] == 'virtual_file') {
// ----- Look for a virtual file (a file from string) // ----- Look for a virtual file (a file from string)
$v_content = $p_filedescr['content']; $v_content = $p_filedescr['content'];
@ -2556,7 +2556,7 @@ class PclZip
// ----- Write the compressed (or not) content // ----- Write the compressed (or not) content
@fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']);
} else if ($p_filedescr['type'] == 'folder') { } elseif ($p_filedescr['type'] == 'folder') {
// ----- Look for a directory // ----- Look for a directory
// ----- Look for directory last '/' // ----- Look for directory last '/'
if (@substr($p_header['stored_filename'], -1) != '/') { if (@substr($p_header['stored_filename'], -1) != '/') {
@ -2761,7 +2761,7 @@ class PclZip
// ----- Look for all path to remove // ----- Look for all path to remove
if ($p_remove_all_dir) { if ($p_remove_all_dir) {
$v_stored_filename = basename($p_filename); $v_stored_filename = basename($p_filename);
} else if ($p_remove_dir != "") { } elseif ($p_remove_dir != "") {
// ----- Look for partial path remove // ----- Look for partial path remove
if (substr($p_remove_dir, -1) != '/') { if (substr($p_remove_dir, -1) != '/') {
$p_remove_dir .= "/"; $p_remove_dir .= "/";
@ -3136,12 +3136,12 @@ class PclZip
$v_extract = true; $v_extract = true;
} }
} }
}else if ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { } elseif ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
// ----- Look for extract by preg rule // ----- Look for extract by preg rule
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) { if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
$v_extract = true; $v_extract = true;
} }
} else if ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { } elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
// ----- Look for extract by index rule // ----- Look for extract by index rule
// ----- Look if the index is in the list // ----- Look if the index is in the list
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) { for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
@ -3167,7 +3167,6 @@ class PclZip
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) {
$this->privSwapBackMagicQuotes(); $this->privSwapBackMagicQuotes();
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, "Filename '".$v_header['stored_filename']."' is compressed by an unsupported compression method (".$v_header['compression'].") "); PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, "Filename '".$v_header['stored_filename']."' is compressed by an unsupported compression method (".$v_header['compression'].") ");
@ -3249,9 +3248,8 @@ class PclZip
if ($v_result1 == 2) { if ($v_result1 == 2) {
break; break;
} }
} } elseif ((isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
// ----- Look for extraction in standard output // ----- Look for extraction in standard output
elseif ((isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
// ----- Extracting the file in standard output // ----- Extracting the file in standard output
$v_result1 = $this->privExtractFileInOutput($v_header, $p_options); $v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
if ($v_result1 < 1) { if ($v_result1 < 1) {
@ -3343,7 +3341,7 @@ class PclZip
// ----- Get the basename of the path // ----- Get the basename of the path
$p_entry['filename'] = basename($p_entry['filename']); $p_entry['filename'] = basename($p_entry['filename']);
} else if ($p_remove_path != "") { } elseif ($p_remove_path != "") {
// ----- Look for path to remove // ----- Look for path to remove
if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2) { if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2) {
// ----- Change the file status // ----- Change the file status
@ -3369,7 +3367,7 @@ class PclZip
if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
$v_inclusion = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], $p_entry['filename']); $v_inclusion = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], $p_entry['filename']);
if ($v_inclusion == 0) { if ($v_inclusion == 0) {
PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,"Filename '".$p_entry['filename']."' is outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION"); PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, "Filename '".$p_entry['filename']."' is outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
return PclZip::errorCode(); return PclZip::errorCode();
} }
@ -3410,7 +3408,6 @@ class PclZip
if (file_exists($p_entry['filename'])) { if (file_exists($p_entry['filename'])) {
// ----- Look if file is a directory // ----- Look if file is a directory
if (is_dir($p_entry['filename'])) { if (is_dir($p_entry['filename'])) {
// ----- Change the file status // ----- Change the file status
$p_entry['status'] = "already_a_directory"; $p_entry['status'] = "already_a_directory";
@ -3421,7 +3418,7 @@ class PclZip
PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, "Filename '".$p_entry['filename']."' is already used by an existing directory"); PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, "Filename '".$p_entry['filename']."' is already used by an existing directory");
return PclZip::errorCode(); return PclZip::errorCode();
} }
} else if (!is_writeable($p_entry['filename'])) { } elseif (!is_writeable($p_entry['filename'])) {
// ----- Look if file is write protected // ----- Look if file is write protected
// ----- Change the file status // ----- Change the file status
$p_entry['status'] = "write_protected"; $p_entry['status'] = "write_protected";
@ -3433,7 +3430,7 @@ class PclZip
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Filename '".$p_entry['filename']."' exists and is write protected"); PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Filename '".$p_entry['filename']."' exists and is write protected");
return PclZip::errorCode(); return PclZip::errorCode();
} }
} else if (filemtime($p_entry['filename']) > $p_entry['mtime']) { } elseif (filemtime($p_entry['filename']) > $p_entry['mtime']) {
// ----- Look if the extracted file is older // ----- Look if the extracted file is older
// ----- Change the file status // ----- Change the file status
if ((isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) && ($p_options[PCLZIP_OPT_REPLACE_NEWER] === true)) { if ((isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) && ($p_options[PCLZIP_OPT_REPLACE_NEWER] === true)) {
@ -3444,26 +3441,23 @@ class PclZip
// For historical reason first PclZip implementation does not stop // For historical reason first PclZip implementation does not stop
// when this kind of error occurs. // when this kind of error occurs.
if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) {
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Newer version of '".$p_entry['filename']."' exists and option PCLZIP_OPT_REPLACE_NEWER is not selected"); PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Newer version of '".$p_entry['filename']."' exists and option PCLZIP_OPT_REPLACE_NEWER is not selected");
return PclZip::errorCode(); return PclZip::errorCode();
} }
} }
} else { } else {
} }
} else { } else {
// ----- Check the directory availability and create it if necessary // ----- Check the directory availability and create it if necessary
if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) { if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) {
$v_dir_to_check = $p_entry['filename']; $v_dir_to_check = $p_entry['filename'];
} } elseif (!strstr($p_entry['filename'], "/")) {
else if (!strstr($p_entry['filename'], "/")) {
$v_dir_to_check = ""; $v_dir_to_check = "";
} } else {
else {
$v_dir_to_check = dirname($p_entry['filename']); $v_dir_to_check = dirname($p_entry['filename']);
} }
if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
// ----- Change the file status // ----- Change the file status
$p_entry['status'] = "path_creation_fail"; $p_entry['status'] = "path_creation_fail";
@ -3530,7 +3524,6 @@ class PclZip
$v_file_content = @gzinflate($v_buffer); $v_file_content = @gzinflate($v_buffer);
unset($v_buffer); unset($v_buffer);
if ($v_file_content === false) { if ($v_file_content === false) {
// ----- Change the file status // ----- Change the file status
// TBC // TBC
$p_entry['status'] = "error"; $p_entry['status'] = "error";
@ -3540,7 +3533,6 @@ class PclZip
// ----- Opening destination file // ----- Opening destination file
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
// ----- Change the file status // ----- Change the file status
$p_entry['status'] = "write_error"; $p_entry['status'] = "write_error";
@ -3723,7 +3715,6 @@ class PclZip
if (!(($p_entry['external']&0x00000010)==0x00000010)) { if (!(($p_entry['external']&0x00000010)==0x00000010)) {
// ----- Look for not compressed file // ----- Look for not compressed file
if ($p_entry['compressed_size'] == $p_entry['size']) { if ($p_entry['compressed_size'] == $p_entry['size']) {
// ----- Read the file in a buffer (one shot) // ----- Read the file in a buffer (one shot)
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
@ -3731,7 +3722,6 @@ class PclZip
echo $v_buffer; echo $v_buffer;
unset($v_buffer); unset($v_buffer);
} else { } else {
// ----- Read the compressed file in a buffer (one shot) // ----- Read the compressed file in a buffer (one shot)
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
@ -3791,7 +3781,7 @@ class PclZip
// ----- Check that the file header is coherent with $p_entry info // ----- Check that the file header is coherent with $p_entry info
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
// TBC // TBC
} }
// ----- Look for pre-extract callback // ----- Look for pre-extract callback
@ -3830,17 +3820,15 @@ class PclZip
// ----- Look for not compressed file // ----- Look for not compressed file
// if ($p_entry['compressed_size'] == $p_entry['size']) // if ($p_entry['compressed_size'] == $p_entry['size'])
if ($p_entry['compression'] == 0) { if ($p_entry['compression'] == 0) {
// ----- Reading the file // ----- Reading the file
$p_string = @fread($this->zip_fd, $p_entry['compressed_size']); $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
} else { } else {
// ----- Reading the file // ----- Reading the file
$v_data = @fread($this->zip_fd, $p_entry['compressed_size']); $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
// ----- Decompress the file // ----- Decompress the file
if (($p_string = @gzinflate($v_data)) === false) { if (($p_string = @gzinflate($v_data)) === false) {
// TBC // TBC
} }
} }
// ----- Trace // ----- Trace
@ -4037,8 +4025,7 @@ class PclZip
// ----- Get comment // ----- Get comment
if ($p_header['comment_len'] != 0) { if ($p_header['comment_len'] != 0) {
$p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']); $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
} } else {
else {
$p_header['comment'] = ''; $p_header['comment'] = '';
} }
@ -4112,9 +4099,9 @@ class PclZip
// ----- Look for flag bit 3 // ----- Look for flag bit 3
if (($p_local_header['flag'] & 8) == 8) { if (($p_local_header['flag'] & 8) == 8) {
$p_local_header['size'] = $p_central_header['size']; $p_local_header['size'] = $p_central_header['size'];
$p_local_header['compressed_size'] = $p_central_header['compressed_size']; $p_local_header['compressed_size'] = $p_central_header['compressed_size'];
$p_local_header['crc'] = $p_central_header['crc']; $p_local_header['crc'] = $p_central_header['crc'];
} }
// ----- Return // ----- Return
@ -4171,8 +4158,9 @@ class PclZip
// ----- Go back to the maximum possible size of the Central Dir End Record // ----- Go back to the maximum possible size of the Central Dir End Record
if (!$v_found) { if (!$v_found) {
$v_maximum_size = 65557; // 0xFFFF + 22; $v_maximum_size = 65557; // 0xFFFF + 22;
if ($v_maximum_size > $v_size) if ($v_maximum_size > $v_size) {
$v_maximum_size = $v_size; $v_maximum_size = $v_size;
}
@fseek($this->zip_fd, $v_size-$v_maximum_size); @fseek($this->zip_fd, $v_size-$v_maximum_size);
if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) { if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) {
// ----- Error log // ----- Error log
@ -4196,8 +4184,7 @@ class PclZip
$v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); $v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
// ----- Compare the bytes // ----- Compare the bytes
if ($v_bytes == 0x504b0506) if ($v_bytes == 0x504b0506) {
{
$v_pos++; $v_pos++;
break; break;
} }
@ -4342,43 +4329,28 @@ class PclZip
} elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) { } elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
$v_found = true; $v_found = true;
} }
} } elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
// ----- Look for a filename // ----- Look for a filename
elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
$v_found = true; $v_found = true;
} }
} }
} } elseif ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
// ----- Look for extract by ereg rule // ----- Look for extract by preg rule
// ereg() is deprecated with PHP 5.3
/*
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
$v_found = true;
}
}
*/
else if ((isset($p_options[PCLZIP_OPT_BY_PREG]))
// ----- Look for extract by preg rule
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
$v_found = true; $v_found = true;
} }
} else if ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { } elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
// ----- Look for extract by index rule // ----- Look for extract by index rule
// ----- Look if the index is in the list // ----- Look if the index is in the list
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) { for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
$v_found = true; $v_found = true;
} }
if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
$j_start = $j+1; $j_start = $j+1;
} }
if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
break; break;
} }
} }
} else { } else {
@ -4523,7 +4495,7 @@ class PclZip
// ----- Destroy the temporary archive // ----- Destroy the temporary archive
unset($v_temp_zip); unset($v_temp_zip);
} else if ($v_central_dir['entries'] != 0) { } elseif ($v_central_dir['entries'] != 0) {
// ----- Remove every files : reset the file // ----- Remove every files : reset the file
$this->privCloseFd(); $this->privCloseFd();
@ -4608,7 +4580,6 @@ class PclZip
// ----- Look if the archive_to_add exists // ----- Look if the archive_to_add exists
if (!is_file($p_archive_to_add->zipname)) { if (!is_file($p_archive_to_add->zipname)) {
// ----- Nothing to merge, so merge is a success // ----- Nothing to merge, so merge is a success
$v_result = 1; $v_result = 1;
@ -4618,7 +4589,6 @@ class PclZip
// ----- Look if the archive exists // ----- Look if the archive exists
if (!is_file($this->zipname)) { if (!is_file($this->zipname)) {
// ----- Do a duplicate // ----- Do a duplicate
$v_result = $this->privDuplicate($p_archive_to_add->zipname); $v_result = $this->privDuplicate($p_archive_to_add->zipname);
@ -4781,7 +4751,6 @@ class PclZip
// ----- Look if the $p_archive_filename exists // ----- Look if the $p_archive_filename exists
if (!is_file($p_archive_filename)) { if (!is_file($p_archive_filename)) {
// ----- Nothing to duplicate, so duplicate is a success. // ----- Nothing to duplicate, so duplicate is a success.
$v_result = 1; $v_result = 1;
@ -4946,9 +4915,9 @@ function PclZipUtilPathReduction($p_dir)
if ($v_list[$i] == ".") { if ($v_list[$i] == ".") {
// ----- Ignore this directory // ----- Ignore this directory
// Should be the first $i=0, but no check is done // Should be the first $i=0, but no check is done
} else if ($v_list[$i] == "..") { } elseif ($v_list[$i] == "..") {
$v_skip++; $v_skip++;
} else if ($v_list[$i] == "") { } elseif ($v_list[$i] == "") {
// ----- First '/' i.e. root slash // ----- First '/' i.e. root slash
if ($i == 0) { if ($i == 0) {
$v_result = "/".$v_result; $v_result = "/".$v_result;
@ -4958,7 +4927,7 @@ function PclZipUtilPathReduction($p_dir)
$v_result = $p_dir; $v_result = $p_dir;
$v_skip = 0; $v_skip = 0;
} }
} else if ($i == (sizeof($v_list)-1)) { } elseif ($i == (sizeof($v_list)-1)) {
// ----- Last '/' i.e. indicates a directory // ----- Last '/' i.e. indicates a directory
$v_result = $v_list[$i]; $v_result = $v_list[$i];
} else { } else {
@ -4970,8 +4939,7 @@ function PclZipUtilPathReduction($p_dir)
// ----- Look for item to skip // ----- Look for item to skip
if ($v_skip > 0) { if ($v_skip > 0) {
$v_skip--; $v_skip--;
} } else {
else {
$v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
} }
} }
@ -5051,13 +5019,17 @@ function PclZipUtilPathInclusion($p_dir, $p_path)
// ----- Look if everything seems to be the same // ----- Look if everything seems to be the same
if ($v_result) { if ($v_result) {
// ----- Skip all the empty items // ----- Skip all the empty items
while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++; while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) {
while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++; $j++;
}
while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) {
$i++;
}
if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) { if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
// ----- There are exactly the same // ----- There are exactly the same
$v_result = 2; $v_result = 2;
} else if ($i < $v_list_dir_size) { } elseif ($i < $v_list_dir_size) {
// ----- The path is shorter than the dir // ----- The path is shorter than the dir
$v_result = 0; $v_result = 0;
} }
@ -5090,21 +5062,21 @@ function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode = 0)
@fwrite($p_dest, $v_buffer, $v_read_size); @fwrite($p_dest, $v_buffer, $v_read_size);
$p_size -= $v_read_size; $p_size -= $v_read_size;
} }
} else if ($p_mode==1) { } elseif ($p_mode==1) {
while ($p_size != 0) { while ($p_size != 0) {
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
$v_buffer = @gzread($p_src, $v_read_size); $v_buffer = @gzread($p_src, $v_read_size);
@fwrite($p_dest, $v_buffer, $v_read_size); @fwrite($p_dest, $v_buffer, $v_read_size);
$p_size -= $v_read_size; $p_size -= $v_read_size;
} }
} else if ($p_mode==2) { } elseif ($p_mode==2) {
while ($p_size != 0) { while ($p_size != 0) {
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
$v_buffer = @fread($p_src, $v_read_size); $v_buffer = @fread($p_src, $v_read_size);
@gzwrite($p_dest, $v_buffer, $v_read_size); @gzwrite($p_dest, $v_buffer, $v_read_size);
$p_size -= $v_read_size; $p_size -= $v_read_size;
} }
} else if ($p_mode==3) { } elseif ($p_mode==3) {
while ($p_size != 0) { while ($p_size != 0) {
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
$v_buffer = @gzread($p_src, $v_read_size); $v_buffer = @gzread($p_src, $v_read_size);
@ -5139,7 +5111,7 @@ function PclZipUtilRename($p_src, $p_dest)
// ----- Try to copy & unlink the src // ----- Try to copy & unlink the src
if (!@copy($p_src, $p_dest)) { if (!@copy($p_src, $p_dest)) {
$v_result = 0; $v_result = 0;
} else if (!@unlink($p_src)) { } elseif (!@unlink($p_src)) {
$v_result = 0; $v_result = 0;
} }
} }
@ -5160,7 +5132,6 @@ function PclZipUtilRename($p_src, $p_dest)
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
function PclZipUtilOptionText($p_option) function PclZipUtilOptionText($p_option)
{ {
$v_list = get_defined_constants(); $v_list = get_defined_constants();
for (reset($v_list); $v_key = key($v_list); next($v_list)) { for (reset($v_list); $v_key = key($v_list); next($v_list)) {
$v_prefix = substr($v_key, 0, 10); $v_prefix = substr($v_key, 0, 10);
@ -5191,13 +5162,12 @@ function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter = true)
if (stristr(php_uname(), 'windows')) { if (stristr(php_uname(), 'windows')) {
// ----- Look for potential disk letter // ----- Look for potential disk letter
if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) { if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
$p_path = substr($p_path, $v_position+1); $p_path = substr($p_path, $v_position+1);
} }
// ----- Change potential windows directory separator // ----- Change potential windows directory separator
if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) { if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) {
$p_path = strtr($p_path, '\\', '/'); $p_path = strtr($p_path, '\\', '/');
} }
} }
return $p_path; return $p_path;
} }
// --------------------------------------------------------------------------------

View File

@ -504,7 +504,7 @@ class PHPExcel_Shared_String
if ($from == 'UTF-16LE') { if ($from == 'UTF-16LE') {
return self::utf16_decode($value, false); return self::utf16_decode($value, false);
} else if ($from == 'UTF-16BE') { } elseif ($from == 'UTF-16BE') {
return self::utf16_decode($value); return self::utf16_decode($value);
} }
// else, no conversion // else, no conversion

View File

@ -131,7 +131,7 @@ class PHPExcel_Shared_ZipStreamWrapper
* @param int $count maximum number of bytes to read * @param int $count maximum number of bytes to read
* @return string * @return string
*/ */
function stream_read($count) public function stream_read($count)
{ {
$ret = substr($this->_data, $this->_position, $count); $ret = substr($this->_data, $this->_position, $count);
$this->_position += strlen($ret); $this->_position += strlen($ret);

View File

@ -138,7 +138,7 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression * @param float[] $xValues The set of X-values for this regression
* @param boolean $const * @param boolean $const
*/ */
function __construct($yValues, $xValues = array(), $const = true) public function __construct($yValues, $xValues = array(), $const = true)
{ {
if (parent::__construct($yValues, $xValues) !== false) { if (parent::__construct($yValues, $xValues) !== false) {
$this->_exponential_regression($yValues, $xValues, $const); $this->_exponential_regression($yValues, $xValues, $const);

View File

@ -100,7 +100,7 @@ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression * @param float[] $xValues The set of X-values for this regression
* @param boolean $const * @param boolean $const
*/ */
function __construct($yValues, $xValues = array(), $const = true) public function __construct($yValues, $xValues = array(), $const = true)
{ {
if (parent::__construct($yValues, $xValues) !== false) { if (parent::__construct($yValues, $xValues) !== false) {
$this->_linear_regression($yValues, $xValues, $const); $this->_linear_regression($yValues, $xValues, $const);

View File

@ -108,7 +108,7 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression * @param float[] $xValues The set of X-values for this regression
* @param boolean $const * @param boolean $const
*/ */
function __construct($yValues, $xValues = array(), $const = true) public function __construct($yValues, $xValues = array(), $const = true)
{ {
if (parent::__construct($yValues, $xValues) !== false) { if (parent::__construct($yValues, $xValues) !== false) {
$this->_logarithmic_regression($yValues, $xValues, $const); $this->_logarithmic_regression($yValues, $xValues, $const);

View File

@ -213,7 +213,7 @@ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression * @param float[] $xValues The set of X-values for this regression
* @param boolean $const * @param boolean $const
*/ */
function __construct($order, $yValues, $xValues = array(), $const = true) public function __construct($order, $yValues, $xValues = array(), $const = true)
{ {
if (parent::__construct($yValues, $xValues) !== false) { if (parent::__construct($yValues, $xValues) !== false) {
if ($order < $this->_valueCount) { if ($order < $this->_valueCount) {

View File

@ -138,7 +138,7 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
* @param float[] $xValues The set of X-values for this regression * @param float[] $xValues The set of X-values for this regression
* @param boolean $const * @param boolean $const
*/ */
function __construct($yValues, $xValues = array(), $const = true) public function __construct($yValues, $xValues = array(), $const = true)
{ {
if (parent::__construct($yValues, $xValues) !== false) { if (parent::__construct($yValues, $xValues) !== false) {
$this->_power_regression($yValues, $xValues, $const); $this->_power_regression($yValues, $xValues, $const);

View File

@ -153,4 +153,4 @@ class trendClass
return false; return false;
} }
} // function calculate() } // function calculate()
} // class trendClass }

View File

@ -358,7 +358,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
// Selection type, inspect // Selection type, inspect
if (preg_match('/^[A-Z]+1:[A-Z]+1048576$/', $pRange)) { if (preg_match('/^[A-Z]+1:[A-Z]+1048576$/', $pRange)) {
$selectionType = 'COLUMN'; $selectionType = 'COLUMN';
} else if (preg_match('/^A[0-9]+:XFD[0-9]+$/', $pRange)) { } elseif (preg_match('/^A[0-9]+:XFD[0-9]+$/', $pRange)) {
$selectionType = 'ROW'; $selectionType = 'ROW';
} else { } else {
$selectionType = 'CELL'; $selectionType = 'CELL';

View File

@ -391,7 +391,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* Code to execute when this worksheet is unset() * Code to execute when this worksheet is unset()
* *
*/ */
function __destruct() public function __destruct()
{ {
PHPExcel_Calculation::getInstance($this->_parent)->clearCalculationCacheForWorksheet($this->_title); PHPExcel_Calculation::getInstance($this->_parent)->clearCalculationCacheForWorksheet($this->_title);
@ -2265,9 +2265,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
if (strpos($pCellCoordinate, ':') !== false || strpos($pCellCoordinate, ',') !== false) { if (strpos($pCellCoordinate, ':') !== false || strpos($pCellCoordinate, ',') !== false) {
throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells.'); throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells.');
} else if (strpos($pCellCoordinate, '$') !== false) { } elseif (strpos($pCellCoordinate, '$') !== false) {
throw new PHPExcel_Exception('Cell coordinate string must not be absolute.'); throw new PHPExcel_Exception('Cell coordinate string must not be absolute.');
} else if ($pCellCoordinate == '') { } elseif ($pCellCoordinate == '') {
throw new PHPExcel_Exception('Cell coordinate can not be zero-length string.'); throw new PHPExcel_Exception('Cell coordinate can not be zero-length string.');
} else { } else {
// Check if we already have a comment for this cell. // Check if we already have a comment for this cell.

View File

@ -25,14 +25,14 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
class PHPExcel_Worksheet_ColumnDimension class PHPExcel_Worksheet_ColumnDimension extends PHPExcel_Worksheet_Dimension
{ {
/** /**
* Column index * Column index
* *
* @var int * @var int
*/ */
private $_columnIndex; private $columnIndex;
/** /**
* Column width * Column width
@ -41,42 +41,14 @@ class PHPExcel_Worksheet_ColumnDimension
* *
* @var double * @var double
*/ */
private $_width = -1; private $width = -1;
/** /**
* Auto size? * Auto size?
* *
* @var bool * @var bool
*/ */
private $_autoSize = false; private $autoSize = false;
/**
* Visible?
*
* @var bool
*/
private $_visible = true;
/**
* Outline level
*
* @var int
*/
private $_outlineLevel = 0;
/**
* Collapsed
*
* @var bool
*/
private $_collapsed = false;
/**
* Index to cellXf
*
* @var int
*/
private $_xfIndex;
/** /**
* Create a new PHPExcel_Worksheet_ColumnDimension * Create a new PHPExcel_Worksheet_ColumnDimension
@ -86,10 +58,10 @@ class PHPExcel_Worksheet_ColumnDimension
public function __construct($pIndex = 'A') public function __construct($pIndex = 'A')
{ {
// Initialise values // Initialise values
$this->_columnIndex = $pIndex; $this->columnIndex = $pIndex;
// set default index to cellXf // set dimension as unformatted by default
$this->_xfIndex = 0; parent::__construct(0);
} }
/** /**
@ -99,7 +71,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/ */
public function getColumnIndex() public function getColumnIndex()
{ {
return $this->_columnIndex; return $this->columnIndex;
} }
/** /**
@ -110,7 +82,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/ */
public function setColumnIndex($pValue) public function setColumnIndex($pValue)
{ {
$this->_columnIndex = $pValue; $this->columnIndex = $pValue;
return $this; return $this;
} }
@ -121,7 +93,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/ */
public function getWidth() public function getWidth()
{ {
return $this->_width; return $this->width;
} }
/** /**
@ -132,7 +104,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/ */
public function setWidth($pValue = -1) public function setWidth($pValue = -1)
{ {
$this->_width = $pValue; $this->width = $pValue;
return $this; return $this;
} }
@ -143,7 +115,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/ */
public function getAutoSize() public function getAutoSize()
{ {
return $this->_autoSize; return $this->autoSize;
} }
/** /**
@ -154,117 +126,7 @@ class PHPExcel_Worksheet_ColumnDimension
*/ */
public function setAutoSize($pValue = false) public function setAutoSize($pValue = false)
{ {
$this->_autoSize = $pValue; $this->autoSize = $pValue;
return $this; return $this;
} }
/**
* Get Visible
*
* @return bool
*/
public function getVisible()
{
return $this->_visible;
}
/**
* Set Visible
*
* @param bool $pValue
* @return PHPExcel_Worksheet_ColumnDimension
*/
public function setVisible($pValue = true)
{
$this->_visible = $pValue;
return $this;
}
/**
* Get Outline Level
*
* @return int
*/
public function getOutlineLevel()
{
return $this->_outlineLevel;
}
/**
* Set Outline Level
*
* Value must be between 0 and 7
*
* @param int $pValue
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_ColumnDimension
*/
public function setOutlineLevel($pValue)
{
if ($pValue < 0 || $pValue > 7) {
throw new PHPExcel_Exception("Outline level must range between 0 and 7.");
}
$this->_outlineLevel = $pValue;
return $this;
}
/**
* Get Collapsed
*
* @return bool
*/
public function getCollapsed()
{
return $this->_collapsed;
}
/**
* Set Collapsed
*
* @param bool $pValue
* @return PHPExcel_Worksheet_ColumnDimension
*/
public function setCollapsed($pValue = true)
{
$this->_collapsed = $pValue;
return $this;
}
/**
* Get index to cellXf
*
* @return int
*/
public function getXfIndex()
{
return $this->_xfIndex;
}
/**
* Set index to cellXf
*
* @param int $pValue
* @return PHPExcel_Worksheet_ColumnDimension
*/
public function setXfIndex($pValue = 0)
{
$this->_xfIndex = $pValue;
return $this;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
} }

View File

@ -0,0 +1,178 @@
<?php
/**
* PHPExcel_Worksheet_Dimension
*
* Copyright (c) 2006 - 2015 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
abstract class PHPExcel_Worksheet_Dimension
{
/**
* Visible?
*
* @var bool
*/
private $visible = true;
/**
* Outline level
*
* @var int
*/
private $outlineLevel = 0;
/**
* Collapsed
*
* @var bool
*/
private $collapsed = false;
/**
* Index to cellXf. Null value means row has no explicit cellXf format.
*
* @var int|null
*/
private $xfIndex;
/**
* Create a new PHPExcel_Worksheet_Dimension
*
* @param int $pIndex Numeric row index
*/
public function __construct($initialValue = null)
{
// set dimension as unformatted by default
$this->xfIndex = $initialValue;
}
/**
* Get Visible
*
* @return bool
*/
public function getVisible()
{
return $this->visible;
}
/**
* Set Visible
*
* @param bool $pValue
* @return PHPExcel_Worksheet_Dimension
*/
public function setVisible($pValue = true)
{
$this->visible = $pValue;
return $this;
}
/**
* Get Outline Level
*
* @return int
*/
public function getOutlineLevel()
{
return $this->outlineLevel;
}
/**
* Set Outline Level
*
* Value must be between 0 and 7
*
* @param int $pValue
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_Dimension
*/
public function setOutlineLevel($pValue)
{
if ($pValue < 0 || $pValue > 7) {
throw new PHPExcel_Exception("Outline level must range between 0 and 7.");
}
$this->outlineLevel = $pValue;
return $this;
}
/**
* Get Collapsed
*
* @return bool
*/
public function getCollapsed()
{
return $this->collapsed;
}
/**
* Set Collapsed
*
* @param bool $pValue
* @return PHPExcel_Worksheet_Dimension
*/
public function setCollapsed($pValue = true)
{
$this->collapsed = $pValue;
return $this;
}
/**
* Get index to cellXf
*
* @return int
*/
public function getXfIndex()
{
return $this->xfIndex;
}
/**
* Set index to cellXf
*
* @param int $pValue
* @return PHPExcel_Worksheet_Dimension
*/
public function setXfIndex($pValue = 0)
{
$this->xfIndex = $pValue;
return $this;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
}

View File

@ -166,7 +166,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function isProtectionEnabled() public function isProtectionEnabled()
{ {
return $this->_sheet || return $this->_sheet ||
$this->_objects || $this->_objects ||
@ -191,7 +191,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSheet() public function getSheet()
{ {
return $this->_sheet; return $this->_sheet;
} }
@ -202,7 +202,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSheet($pValue = false) public function setSheet($pValue = false)
{ {
$this->_sheet = $pValue; $this->_sheet = $pValue;
return $this; return $this;
@ -213,7 +213,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getObjects() public function getObjects()
{ {
return $this->_objects; return $this->_objects;
} }
@ -224,7 +224,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setObjects($pValue = false) public function setObjects($pValue = false)
{ {
$this->_objects = $pValue; $this->_objects = $pValue;
return $this; return $this;
@ -235,7 +235,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getScenarios() public function getScenarios()
{ {
return $this->_scenarios; return $this->_scenarios;
} }
@ -246,7 +246,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setScenarios($pValue = false) public function setScenarios($pValue = false)
{ {
$this->_scenarios = $pValue; $this->_scenarios = $pValue;
return $this; return $this;
@ -257,7 +257,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getFormatCells() public function getFormatCells()
{ {
return $this->_formatCells; return $this->_formatCells;
} }
@ -268,7 +268,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setFormatCells($pValue = false) public function setFormatCells($pValue = false)
{ {
$this->_formatCells = $pValue; $this->_formatCells = $pValue;
return $this; return $this;
@ -279,7 +279,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getFormatColumns() public function getFormatColumns()
{ {
return $this->_formatColumns; return $this->_formatColumns;
} }
@ -290,7 +290,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setFormatColumns($pValue = false) public function setFormatColumns($pValue = false)
{ {
$this->_formatColumns = $pValue; $this->_formatColumns = $pValue;
return $this; return $this;
@ -301,7 +301,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getFormatRows() public function getFormatRows()
{ {
return $this->_formatRows; return $this->_formatRows;
} }
@ -312,7 +312,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setFormatRows($pValue = false) public function setFormatRows($pValue = false)
{ {
$this->_formatRows = $pValue; $this->_formatRows = $pValue;
return $this; return $this;
@ -323,7 +323,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getInsertColumns() public function getInsertColumns()
{ {
return $this->_insertColumns; return $this->_insertColumns;
} }
@ -334,7 +334,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setInsertColumns($pValue = false) public function setInsertColumns($pValue = false)
{ {
$this->_insertColumns = $pValue; $this->_insertColumns = $pValue;
return $this; return $this;
@ -345,7 +345,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getInsertRows() public function getInsertRows()
{ {
return $this->_insertRows; return $this->_insertRows;
} }
@ -356,7 +356,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setInsertRows($pValue = false) public function setInsertRows($pValue = false)
{ {
$this->_insertRows = $pValue; $this->_insertRows = $pValue;
return $this; return $this;
@ -367,7 +367,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getInsertHyperlinks() public function getInsertHyperlinks()
{ {
return $this->_insertHyperlinks; return $this->_insertHyperlinks;
} }
@ -378,7 +378,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setInsertHyperlinks($pValue = false) public function setInsertHyperlinks($pValue = false)
{ {
$this->_insertHyperlinks = $pValue; $this->_insertHyperlinks = $pValue;
return $this; return $this;
@ -389,7 +389,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getDeleteColumns() public function getDeleteColumns()
{ {
return $this->_deleteColumns; return $this->_deleteColumns;
} }
@ -400,7 +400,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setDeleteColumns($pValue = false) public function setDeleteColumns($pValue = false)
{ {
$this->_deleteColumns = $pValue; $this->_deleteColumns = $pValue;
return $this; return $this;
@ -411,7 +411,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getDeleteRows() public function getDeleteRows()
{ {
return $this->_deleteRows; return $this->_deleteRows;
} }
@ -422,7 +422,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setDeleteRows($pValue = false) public function setDeleteRows($pValue = false)
{ {
$this->_deleteRows = $pValue; $this->_deleteRows = $pValue;
return $this; return $this;
@ -433,7 +433,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSelectLockedCells() public function getSelectLockedCells()
{ {
return $this->_selectLockedCells; return $this->_selectLockedCells;
} }
@ -444,7 +444,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSelectLockedCells($pValue = false) public function setSelectLockedCells($pValue = false)
{ {
$this->_selectLockedCells = $pValue; $this->_selectLockedCells = $pValue;
return $this; return $this;
@ -455,7 +455,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSort() public function getSort()
{ {
return $this->_sort; return $this->_sort;
} }
@ -466,7 +466,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSort($pValue = false) public function setSort($pValue = false)
{ {
$this->_sort = $pValue; $this->_sort = $pValue;
return $this; return $this;
@ -477,7 +477,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getAutoFilter() public function getAutoFilter()
{ {
return $this->_autoFilter; return $this->_autoFilter;
} }
@ -488,7 +488,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setAutoFilter($pValue = false) public function setAutoFilter($pValue = false)
{ {
$this->_autoFilter = $pValue; $this->_autoFilter = $pValue;
return $this; return $this;
@ -499,7 +499,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getPivotTables() public function getPivotTables()
{ {
return $this->_pivotTables; return $this->_pivotTables;
} }
@ -510,7 +510,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setPivotTables($pValue = false) public function setPivotTables($pValue = false)
{ {
$this->_pivotTables = $pValue; $this->_pivotTables = $pValue;
return $this; return $this;
@ -521,7 +521,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSelectUnlockedCells() public function getSelectUnlockedCells()
{ {
return $this->_selectUnlockedCells; return $this->_selectUnlockedCells;
} }
@ -532,7 +532,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSelectUnlockedCells($pValue = false) public function setSelectUnlockedCells($pValue = false)
{ {
$this->_selectUnlockedCells = $pValue; $this->_selectUnlockedCells = $pValue;
return $this; return $this;
@ -543,7 +543,7 @@ class PHPExcel_Worksheet_Protection
* *
* @return string * @return string
*/ */
function getPassword() public function getPassword()
{ {
return $this->_password; return $this->_password;
} }
@ -555,7 +555,7 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setPassword($pValue = '', $pAlreadyHashed = false) public function setPassword($pValue = '', $pAlreadyHashed = false)
{ {
if (!$pAlreadyHashed) { if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);

View File

@ -25,14 +25,14 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
class PHPExcel_Worksheet_RowDimension class PHPExcel_Worksheet_RowDimension extends PHPExcel_Worksheet_Dimension
{ {
/** /**
* Row index * Row index
* *
* @var int * @var int
*/ */
private $_rowIndex; private $rowIndex;
/** /**
* Row height (in pt) * Row height (in pt)
@ -41,42 +41,14 @@ class PHPExcel_Worksheet_RowDimension
* *
* @var double * @var double
*/ */
private $_rowHeight = -1; private $height = -1;
/** /**
* ZeroHeight for Row? * ZeroHeight for Row?
* *
* @var bool * @var bool
*/ */
private $_zeroHeight = false; private $zeroHeight = false;
/**
* Visible?
*
* @var bool
*/
private $_visible = true;
/**
* Outline level
*
* @var int
*/
private $_outlineLevel = 0;
/**
* Collapsed
*
* @var bool
*/
private $_collapsed = false;
/**
* Index to cellXf. Null value means row has no explicit cellXf format.
*
* @var int|null
*/
private $_xfIndex;
/** /**
* Create a new PHPExcel_Worksheet_RowDimension * Create a new PHPExcel_Worksheet_RowDimension
@ -86,10 +58,10 @@ class PHPExcel_Worksheet_RowDimension
public function __construct($pIndex = 0) public function __construct($pIndex = 0)
{ {
// Initialise values // Initialise values
$this->_rowIndex = $pIndex; $this->rowIndex = $pIndex;
// set row dimension as unformatted by default // set dimension as unformatted by default
$this->_xfIndex = null; parent::__construct(null);
} }
/** /**
@ -99,7 +71,7 @@ class PHPExcel_Worksheet_RowDimension
*/ */
public function getRowIndex() public function getRowIndex()
{ {
return $this->_rowIndex; return $this->rowIndex;
} }
/** /**
@ -110,7 +82,7 @@ class PHPExcel_Worksheet_RowDimension
*/ */
public function setRowIndex($pValue) public function setRowIndex($pValue)
{ {
$this->_rowIndex = $pValue; $this->rowIndex = $pValue;
return $this; return $this;
} }
@ -121,7 +93,7 @@ class PHPExcel_Worksheet_RowDimension
*/ */
public function getRowHeight() public function getRowHeight()
{ {
return $this->_rowHeight; return $this->height;
} }
/** /**
@ -132,7 +104,7 @@ class PHPExcel_Worksheet_RowDimension
*/ */
public function setRowHeight($pValue = -1) public function setRowHeight($pValue = -1)
{ {
$this->_rowHeight = $pValue; $this->height = $pValue;
return $this; return $this;
} }
@ -143,7 +115,7 @@ class PHPExcel_Worksheet_RowDimension
*/ */
public function getZeroHeight() public function getZeroHeight()
{ {
return $this->_zeroHeight; return $this->zeroHeight;
} }
/** /**
@ -154,117 +126,7 @@ class PHPExcel_Worksheet_RowDimension
*/ */
public function setZeroHeight($pValue = false) public function setZeroHeight($pValue = false)
{ {
$this->_zeroHeight = $pValue; $this->zeroHeight = $pValue;
return $this; return $this;
} }
/**
* Get Visible
*
* @return bool
*/
public function getVisible()
{
return $this->_visible;
}
/**
* Set Visible
*
* @param bool $pValue
* @return PHPExcel_Worksheet_RowDimension
*/
public function setVisible($pValue = true)
{
$this->_visible = $pValue;
return $this;
}
/**
* Get Outline Level
*
* @return int
*/
public function getOutlineLevel()
{
return $this->_outlineLevel;
}
/**
* Set Outline Level
*
* Value must be between 0 and 7
*
* @param int $pValue
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_RowDimension
*/
public function setOutlineLevel($pValue)
{
if ($pValue < 0 || $pValue > 7) {
throw new PHPExcel_Exception("Outline level must range between 0 and 7.");
}
$this->_outlineLevel = $pValue;
return $this;
}
/**
* Get Collapsed
*
* @return bool
*/
public function getCollapsed()
{
return $this->_collapsed;
}
/**
* Set Collapsed
*
* @param bool $pValue
* @return PHPExcel_Worksheet_RowDimension
*/
public function setCollapsed($pValue = true)
{
$this->_collapsed = $pValue;
return $this;
}
/**
* Get index to cellXf
*
* @return int
*/
public function getXfIndex()
{
return $this->_xfIndex;
}
/**
* Set index to cellXf
*
* @param int $pValue
* @return PHPExcel_Worksheet_RowDimension
*/
public function setXfIndex($pValue = 0)
{
$this->_xfIndex = $pValue;
return $this;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Worksheet_SheetView
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,22 +25,13 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Worksheet_SheetView
*
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Worksheet_SheetView class PHPExcel_Worksheet_SheetView
{ {
/* Sheet View types */ /* Sheet View types */
const SHEETVIEW_NORMAL = 'normal'; const SHEETVIEW_NORMAL = 'normal';
const SHEETVIEW_PAGE_LAYOUT = 'pageLayout'; const SHEETVIEW_PAGE_LAYOUT = 'pageLayout';
const SHEETVIEW_PAGE_BREAK_PREVIEW = 'pageBreakPreview'; const SHEETVIEW_PAGE_BREAK_PREVIEW = 'pageBreakPreview';
private static $_sheetViewTypes = array( private static $_sheetViewTypes = array(
self::SHEETVIEW_NORMAL, self::SHEETVIEW_NORMAL,
@ -54,7 +46,7 @@ class PHPExcel_Worksheet_SheetView
* *
* @var int * @var int
*/ */
private $_zoomScale = 100; private $zoomScale = 100;
/** /**
* ZoomScaleNormal * ZoomScaleNormal
@ -63,7 +55,7 @@ class PHPExcel_Worksheet_SheetView
* *
* @var int * @var int
*/ */
private $_zoomScaleNormal = 100; private $zoomScaleNormal = 100;
/** /**
* View * View
@ -72,7 +64,7 @@ class PHPExcel_Worksheet_SheetView
* *
* @var string * @var string
*/ */
private $_sheetviewType = self::SHEETVIEW_NORMAL; private $sheetviewType = self::SHEETVIEW_NORMAL;
/** /**
* Create a new PHPExcel_Worksheet_SheetView * Create a new PHPExcel_Worksheet_SheetView
@ -88,7 +80,7 @@ class PHPExcel_Worksheet_SheetView
*/ */
public function getZoomScale() public function getZoomScale()
{ {
return $this->_zoomScale; return $this->zoomScale;
} }
/** /**
@ -105,7 +97,7 @@ class PHPExcel_Worksheet_SheetView
// Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface, // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
// but it is apparently still able to handle any scale >= 1 // but it is apparently still able to handle any scale >= 1
if (($pValue >= 1) || is_null($pValue)) { if (($pValue >= 1) || is_null($pValue)) {
$this->_zoomScale = $pValue; $this->zoomScale = $pValue;
} else { } else {
throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
} }
@ -119,7 +111,7 @@ class PHPExcel_Worksheet_SheetView
*/ */
public function getZoomScaleNormal() public function getZoomScaleNormal()
{ {
return $this->_zoomScaleNormal; return $this->zoomScaleNormal;
} }
/** /**
@ -134,7 +126,7 @@ class PHPExcel_Worksheet_SheetView
public function setZoomScaleNormal($pValue = 100) public function setZoomScaleNormal($pValue = 100)
{ {
if (($pValue >= 1) || is_null($pValue)) { if (($pValue >= 1) || is_null($pValue)) {
$this->_zoomScaleNormal = $pValue; $this->zoomScaleNormal = $pValue;
} else { } else {
throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
} }
@ -148,7 +140,7 @@ class PHPExcel_Worksheet_SheetView
*/ */
public function getView() public function getView()
{ {
return $this->_sheetviewType; return $this->sheetviewType;
} }
/** /**
@ -157,7 +149,7 @@ class PHPExcel_Worksheet_SheetView
* Valid values are * Valid values are
* 'normal' self::SHEETVIEW_NORMAL * 'normal' self::SHEETVIEW_NORMAL
* 'pageLayout' self::SHEETVIEW_PAGE_LAYOUT * 'pageLayout' self::SHEETVIEW_PAGE_LAYOUT
* 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW * 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW
* *
* @param string $pValue * @param string $pValue
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
@ -170,7 +162,7 @@ class PHPExcel_Worksheet_SheetView
$pValue = self::SHEETVIEW_NORMAL; $pValue = self::SHEETVIEW_NORMAL;
} }
if (in_array($pValue, self::$_sheetViewTypes)) { if (in_array($pValue, self::$_sheetViewTypes)) {
$this->_sheetviewType = $pValue; $this->sheetviewType = $pValue;
} else { } else {
throw new PHPExcel_Exception("Invalid sheetview layout type."); throw new PHPExcel_Exception("Invalid sheetview layout type.");
} }

View File

@ -32,49 +32,49 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* *
* @var PHPExcel * @var PHPExcel
*/ */
private $_phpExcel; private $phpExcel;
/** /**
* Delimiter * Delimiter
* *
* @var string * @var string
*/ */
private $_delimiter = ','; private $delimiter = ',';
/** /**
* Enclosure * Enclosure
* *
* @var string * @var string
*/ */
private $_enclosure = '"'; private $enclosure = '"';
/** /**
* Line ending * Line ending
* *
* @var string * @var string
*/ */
private $_lineEnding = PHP_EOL; private $lineEnding = PHP_EOL;
/** /**
* Sheet index to write * Sheet index to write
* *
* @var int * @var int
*/ */
private $_sheetIndex = 0; private $sheetIndex = 0;
/** /**
* Whether to write a BOM (for UTF8). * Whether to write a BOM (for UTF8).
* *
* @var boolean * @var boolean
*/ */
private $_useBOM = false; private $useBOM = false;
/** /**
* Whether to write a fully Excel compatible CSV file. * Whether to write a fully Excel compatible CSV file.
* *
* @var boolean * @var boolean
*/ */
private $_excelCompatibility = false; private $excelCompatibility = false;
/** /**
* Create a new PHPExcel_Writer_CSV * Create a new PHPExcel_Writer_CSV
@ -83,7 +83,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function __construct(PHPExcel $phpExcel) public function __construct(PHPExcel $phpExcel)
{ {
$this->_phpExcel = $phpExcel; $this->phpExcel = $phpExcel;
} }
/** /**
@ -95,10 +95,10 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
public function save($pFilename = null) public function save($pFilename = null)
{ {
// Fetch sheet // Fetch sheet
$sheet = $this->_phpExcel->getSheet($this->_sheetIndex); $sheet = $this->phpExcel->getSheet($this->sheetIndex);
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); $saveDebugLog = PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false); PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false);
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
@ -108,13 +108,13 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing."); throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing.");
} }
if ($this->_excelCompatibility) { if ($this->excelCompatibility) {
fwrite($fileHandle, "\xEF\xBB\xBF"); // Enforce UTF-8 BOM Header fwrite($fileHandle, "\xEF\xBB\xBF"); // Enforce UTF-8 BOM Header
$this->setEnclosure('"'); // Set enclosure to " $this->setEnclosure('"'); // Set enclosure to "
$this->setDelimiter(";"); // Set delimiter to a semi-colon $this->setDelimiter(";"); // Set delimiter to a semi-colon
$this->setLineEnding("\r\n"); $this->setLineEnding("\r\n");
fwrite($fileHandle, 'sep=' . $this->getDelimiter() . $this->_lineEnding); fwrite($fileHandle, 'sep=' . $this->getDelimiter() . $this->lineEnding);
} elseif ($this->_useBOM) { } elseif ($this->useBOM) {
// Write the UTF-8 BOM code if required // Write the UTF-8 BOM code if required
fwrite($fileHandle, "\xEF\xBB\xBF"); fwrite($fileHandle, "\xEF\xBB\xBF");
} }
@ -135,7 +135,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
fclose($fileHandle); fclose($fileHandle);
PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType);
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
} }
/** /**
@ -145,7 +145,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function getDelimiter() public function getDelimiter()
{ {
return $this->_delimiter; return $this->delimiter;
} }
/** /**
@ -156,7 +156,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function setDelimiter($pValue = ',') public function setDelimiter($pValue = ',')
{ {
$this->_delimiter = $pValue; $this->delimiter = $pValue;
return $this; return $this;
} }
@ -167,7 +167,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function getEnclosure() public function getEnclosure()
{ {
return $this->_enclosure; return $this->enclosure;
} }
/** /**
@ -181,7 +181,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
if ($pValue == '') { if ($pValue == '') {
$pValue = null; $pValue = null;
} }
$this->_enclosure = $pValue; $this->enclosure = $pValue;
return $this; return $this;
} }
@ -192,7 +192,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function getLineEnding() public function getLineEnding()
{ {
return $this->_lineEnding; return $this->lineEnding;
} }
/** /**
@ -203,7 +203,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function setLineEnding($pValue = PHP_EOL) public function setLineEnding($pValue = PHP_EOL)
{ {
$this->_lineEnding = $pValue; $this->lineEnding = $pValue;
return $this; return $this;
} }
@ -214,7 +214,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function getUseBOM() public function getUseBOM()
{ {
return $this->_useBOM; return $this->useBOM;
} }
/** /**
@ -225,7 +225,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function setUseBOM($pValue = false) public function setUseBOM($pValue = false)
{ {
$this->_useBOM = $pValue; $this->useBOM = $pValue;
return $this; return $this;
} }
@ -236,7 +236,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function getExcelCompatibility() public function getExcelCompatibility()
{ {
return $this->_excelCompatibility; return $this->excelCompatibility;
} }
/** /**
@ -248,7 +248,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function setExcelCompatibility($pValue = false) public function setExcelCompatibility($pValue = false)
{ {
$this->_excelCompatibility = $pValue; $this->excelCompatibility = $pValue;
return $this; return $this;
} }
@ -259,7 +259,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function getSheetIndex() public function getSheetIndex()
{ {
return $this->_sheetIndex; return $this->sheetIndex;
} }
/** /**
@ -270,7 +270,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
*/ */
public function setSheetIndex($pValue = 0) public function setSheetIndex($pValue = 0)
{ {
$this->_sheetIndex = $pValue; $this->sheetIndex = $pValue;
return $this; return $this;
} }
@ -292,21 +292,21 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
foreach ($pValues as $element) { foreach ($pValues as $element) {
// Escape enclosures // Escape enclosures
$element = str_replace($this->_enclosure, $this->_enclosure . $this->_enclosure, $element); $element = str_replace($this->enclosure, $this->enclosure . $this->enclosure, $element);
// Add delimiter // Add delimiter
if ($writeDelimiter) { if ($writeDelimiter) {
$line .= $this->_delimiter; $line .= $this->delimiter;
} else { } else {
$writeDelimiter = true; $writeDelimiter = true;
} }
// Add enclosed string // Add enclosed string
$line .= $this->_enclosure . $element . $this->_enclosure; $line .= $this->enclosure . $element . $this->enclosure;
} }
// Add line ending // Add line ending
$line .= $this->_lineEnding; $line .= $this->lineEnding;
// Write to file // Write to file
fwrite($pFileHandle, $line); fwrite($pFileHandle, $line);

View File

@ -368,7 +368,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
} }
$objZip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents); $objZip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents);
} else if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) { } elseif ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
ob_start(); ob_start();
call_user_func( call_user_func(
$this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(), $this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(),

View File

@ -145,7 +145,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) { if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension()); $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension());
$mimeType = $this->_getImageMimeType($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath()); $mimeType = $this->_getImageMimeType($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath());
} else if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) { } elseif ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType()); $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType());
$extension = explode('/', $extension); $extension = explode('/', $extension);
$extension = $extension[1]; $extension = $extension[1];

View File

@ -123,7 +123,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
} }
$objWriter->writeRawData($textToWrite); $objWriter->writeRawData($textToWrite);
$objWriter->endElement(); $objWriter->endElement();
} else if ($textElement instanceof PHPExcel_RichText) { } elseif ($textElement instanceof PHPExcel_RichText) {
$this->writeRichText($objWriter, $textElement); $this->writeRichText($objWriter, $textElement);
} }
@ -184,7 +184,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
$objWriter->startElement($prefix.'vertAlign'); $objWriter->startElement($prefix.'vertAlign');
if ($element->getFont()->getSuperScript()) { if ($element->getFont()->getSuperScript()) {
$objWriter->writeAttribute('val', 'superscript'); $objWriter->writeAttribute('val', 'superscript');
} else if ($element->getFont()->getSubScript()) { } elseif ($element->getFont()->getSubScript()) {
$objWriter->writeAttribute('val', 'subscript'); $objWriter->writeAttribute('val', 'subscript');
} }
$objWriter->endElement(); $objWriter->endElement();
@ -280,7 +280,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
// $objWriter->startElement($prefix.'vertAlign'); // $objWriter->startElement($prefix.'vertAlign');
// if ($element->getFont()->getSuperScript()) { // if ($element->getFont()->getSuperScript()) {
// $objWriter->writeAttribute('val', 'superscript'); // $objWriter->writeAttribute('val', 'superscript');
// } else if ($element->getFont()->getSubScript()) { // } elseif ($element->getFont()->getSubScript()) {
// $objWriter->writeAttribute('val', 'subscript'); // $objWriter->writeAttribute('val', 'subscript');
// } // }
// $objWriter->endElement(); // $objWriter->endElement();
@ -313,7 +313,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
foreach ($stringTable as $key => $value) { foreach ($stringTable as $key => $value) {
if (! $value instanceof PHPExcel_RichText) { if (! $value instanceof PHPExcel_RichText) {
$returnValue[$value] = $key; $returnValue[$value] = $key;
} else if ($value instanceof PHPExcel_RichText) { } elseif ($value instanceof PHPExcel_RichText) {
$returnValue[$value->getHashCode()] = $key; $returnValue[$value->getHashCode()] = $key;
} }
} }

View File

@ -317,7 +317,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->startElement('vertAlign'); $objWriter->startElement('vertAlign');
if ($pFont->getSuperScript() === true) { if ($pFont->getSuperScript() === true) {
$objWriter->writeAttribute('val', 'superscript'); $objWriter->writeAttribute('val', 'superscript');
} else if ($pFont->getSubScript() === true) { } elseif ($pFont->getSubScript() === true) {
$objWriter->writeAttribute('val', 'subscript'); $objWriter->writeAttribute('val', 'subscript');
} }
$objWriter->endElement(); $objWriter->endElement();
@ -428,7 +428,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
$textRotation = 0; $textRotation = 0;
if ($pStyle->getAlignment()->getTextRotation() >= 0) { if ($pStyle->getAlignment()->getTextRotation() >= 0) {
$textRotation = $pStyle->getAlignment()->getTextRotation(); $textRotation = $pStyle->getAlignment()->getTextRotation();
} else if ($pStyle->getAlignment()->getTextRotation() < 0) { } elseif ($pStyle->getAlignment()->getTextRotation() < 0) {
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation(); $textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
} }
$objWriter->writeAttribute('textRotation', $textRotation); $objWriter->writeAttribute('textRotation', $textRotation);
@ -493,7 +493,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
$textRotation = 0; $textRotation = 0;
if ($pStyle->getAlignment()->getTextRotation() >= 0) { if ($pStyle->getAlignment()->getTextRotation() >= 0) {
$textRotation = $pStyle->getAlignment()->getTextRotation(); $textRotation = $pStyle->getAlignment()->getTextRotation();
} else if ($pStyle->getAlignment()->getTextRotation() < 0) { } elseif ($pStyle->getAlignment()->getTextRotation() < 0) {
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation(); $textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
} }
$objWriter->writeAttribute('textRotation', $textRotation); $objWriter->writeAttribute('textRotation', $textRotation);

View File

@ -506,19 +506,19 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT
&& !is_null($conditional->getText())) { && !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))'); $objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH
&& !is_null($conditional->getText())) { && !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"'); $objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH
&& !is_null($conditional->getText())) { && !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"'); $objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS
&& !is_null($conditional->getText())) { && !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))'); $objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) { || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
foreach ($conditional->getConditions() as $formula) { foreach ($conditional->getConditions() as $formula) {
@ -910,7 +910,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
foreach ($pSheet->getBreaks() as $cell => $breakType) { foreach ($pSheet->getBreaks() as $cell => $breakType) {
if ($breakType == PHPExcel_Worksheet::BREAK_ROW) { if ($breakType == PHPExcel_Worksheet::BREAK_ROW) {
$aRowBreaks[] = $cell; $aRowBreaks[] = $cell;
} else if ($breakType == PHPExcel_Worksheet::BREAK_COLUMN) { } elseif ($breakType == PHPExcel_Worksheet::BREAK_COLUMN) {
$aColumnBreaks[] = $cell; $aColumnBreaks[] = $cell;
} }
} }
@ -1095,7 +1095,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
case 'inlinestr': // Inline string case 'inlinestr': // Inline string
if (! $cellValue instanceof PHPExcel_RichText) { if (! $cellValue instanceof PHPExcel_RichText) {
$objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML(htmlspecialchars($cellValue))); $objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML(htmlspecialchars($cellValue)));
} else if ($cellValue instanceof PHPExcel_RichText) { } elseif ($cellValue instanceof PHPExcel_RichText) {
$objWriter->startElement('is'); $objWriter->startElement('is');
$this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue); $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue);
$objWriter->endElement(); $objWriter->endElement();
@ -1107,7 +1107,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
if (isset($pFlippedStringTable[$cellValue])) { if (isset($pFlippedStringTable[$cellValue])) {
$objWriter->writeElement('v', $pFlippedStringTable[$cellValue]); $objWriter->writeElement('v', $pFlippedStringTable[$cellValue]);
} }
} else if ($cellValue instanceof PHPExcel_RichText) { } elseif ($cellValue instanceof PHPExcel_RichText) {
$objWriter->writeElement('v', $pFlippedStringTable[$cellValue->getHashCode()]); $objWriter->writeElement('v', $pFlippedStringTable[$cellValue->getHashCode()]);
} }

View File

@ -32,63 +32,63 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* *
* @var PHPExcel * @var PHPExcel
*/ */
private $_phpExcel; private $phpExcel;
/** /**
* Total number of shared strings in workbook * Total number of shared strings in workbook
* *
* @var int * @var int
*/ */
private $_str_total = 0; private $strTotal = 0;
/** /**
* Number of unique shared strings in workbook * Number of unique shared strings in workbook
* *
* @var int * @var int
*/ */
private $_str_unique = 0; private $strUnique = 0;
/** /**
* Array of unique shared strings in workbook * Array of unique shared strings in workbook
* *
* @var array * @var array
*/ */
private $_str_table = array(); private $strTable = array();
/** /**
* Color cache. Mapping between RGB value and color index. * Color cache. Mapping between RGB value and color index.
* *
* @var array * @var array
*/ */
private $_colors; private $colors;
/** /**
* Formula parser * Formula parser
* *
* @var PHPExcel_Writer_Excel5_Parser * @var PHPExcel_Writer_Excel5_Parser
*/ */
private $_parser; private $parser;
/** /**
* Identifier clusters for drawings. Used in MSODRAWINGGROUP record. * Identifier clusters for drawings. Used in MSODRAWINGGROUP record.
* *
* @var array * @var array
*/ */
private $_IDCLs; private $IDCLs;
/** /**
* Basic OLE object summary information * Basic OLE object summary information
* *
* @var array * @var array
*/ */
private $_summaryInformation; private $summaryInformation;
/** /**
* Extended OLE object document summary information * Extended OLE object document summary information
* *
* @var array * @var array
*/ */
private $_documentSummaryInformation; private $documentSummaryInformation;
/** /**
* Create a new PHPExcel_Writer_Excel5 * Create a new PHPExcel_Writer_Excel5
@ -97,9 +97,9 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
*/ */
public function __construct(PHPExcel $phpExcel) public function __construct(PHPExcel $phpExcel)
{ {
$this->_phpExcel = $phpExcel; $this->phpExcel = $phpExcel;
$this->_parser = new PHPExcel_Writer_Excel5_Parser(); $this->parser = new PHPExcel_Writer_Excel5_Parser();
} }
/** /**
@ -112,38 +112,38 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
{ {
// garbage collect // garbage collect
$this->_phpExcel->garbageCollect(); $this->phpExcel->garbageCollect();
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); $saveDebugLog = PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false); PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false);
$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType(); $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// initialize colors array // initialize colors array
$this->_colors = array(); $this->colors = array();
// Initialise workbook writer // Initialise workbook writer
$this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, $this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser); $this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->phpExcel, $this->strTotal, $this->strUnique, $this->strTable, $this->colors, $this->parser);
// Initialise worksheet writers // Initialise worksheet writers
$countSheets = $this->_phpExcel->getSheetCount(); $countSheets = $this->phpExcel->getSheetCount();
for ($i = 0; $i < $countSheets; ++$i) { for ($i = 0; $i < $countSheets; ++$i) {
$this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser, $this->_preCalculateFormulas, $this->_phpExcel->getSheet($i)); $this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->strTotal, $this->strUnique, $this->strTable, $this->colors, $this->parser, $this->_preCalculateFormulas, $this->phpExcel->getSheet($i));
} }
// build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook. // build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook.
$this->_buildWorksheetEschers(); $this->buildWorksheetEschers();
$this->_buildWorkbookEscher(); $this->buildWorkbookEscher();
// add 15 identical cell style Xfs // add 15 identical cell style Xfs
// for now, we use the first cellXf instead of cellStyleXf // for now, we use the first cellXf instead of cellStyleXf
$cellXfCollection = $this->_phpExcel->getCellXfCollection(); $cellXfCollection = $this->phpExcel->getCellXfCollection();
for ($i = 0; $i < 15; ++$i) { for ($i = 0; $i < 15; ++$i) {
$this->_writerWorkbook->addXfWriter($cellXfCollection[0], true); $this->_writerWorkbook->addXfWriter($cellXfCollection[0], true);
} }
// add all the cell Xfs // add all the cell Xfs
foreach ($this->_phpExcel->getCellXfCollection() as $style) { foreach ($this->phpExcel->getCellXfCollection() as $style) {
$this->_writerWorkbook->addXfWriter($style, false); $this->_writerWorkbook->addXfWriter($style, false);
} }
@ -184,18 +184,18 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$OLE->append($this->_writerWorksheets[$i]->getData()); $OLE->append($this->_writerWorksheets[$i]->getData());
} }
$this->_documentSummaryInformation = $this->_writeDocumentSummaryInformation(); $this->documentSummaryInformation = $this->writeDocumentSummaryInformation();
// initialize OLE Document Summary Information // initialize OLE Document Summary Information
if (isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)) { if (isset($this->documentSummaryInformation) && !empty($this->documentSummaryInformation)) {
$OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation')); $OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation'));
$OLE_DocumentSummaryInformation->append($this->_documentSummaryInformation); $OLE_DocumentSummaryInformation->append($this->documentSummaryInformation);
} }
$this->_summaryInformation = $this->_writeSummaryInformation(); $this->summaryInformation = $this->writeSummaryInformation();
// initialize OLE Summary Information // initialize OLE Summary Information
if (isset($this->_summaryInformation) && !empty($this->_summaryInformation)) { if (isset($this->summaryInformation) && !empty($this->summaryInformation)) {
$OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation')); $OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation'));
$OLE_SummaryInformation->append($this->_summaryInformation); $OLE_SummaryInformation->append($this->summaryInformation);
} }
// define OLE Parts // define OLE Parts
@ -214,7 +214,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$res = $root->save($pFilename); $res = $root->save($pFilename);
PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType); PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType);
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
} }
/** /**
@ -234,14 +234,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* Build the Worksheet Escher objects * Build the Worksheet Escher objects
* *
*/ */
private function _buildWorksheetEschers() private function buildWorksheetEschers()
{ {
// 1-based index to BstoreContainer // 1-based index to BstoreContainer
$blipIndex = 0; $blipIndex = 0;
$lastReducedSpId = 0; $lastReducedSpId = 0;
$lastSpId = 0; $lastSpId = 0;
foreach ($this->_phpExcel->getAllsheets() as $sheet) { foreach ($this->phpExcel->getAllsheets() as $sheet) {
// sheet index // sheet index
$sheetIndex = $sheet->getParent()->getIndex($sheet); $sheetIndex = $sheet->getParent()->getIndex($sheet);
@ -385,7 +385,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
} }
// identifier clusters, used for workbook Escher object // identifier clusters, used for workbook Escher object
$this->_IDCLs[$dgId] = $lastReducedSpId; $this->IDCLs[$dgId] = $lastReducedSpId;
// set last shape index // set last shape index
$dgContainer->setLastSpId($lastSpId); $dgContainer->setLastSpId($lastSpId);
@ -398,13 +398,13 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
/** /**
* Build the Escher object corresponding to the MSODRAWINGGROUP record * Build the Escher object corresponding to the MSODRAWINGGROUP record
*/ */
private function _buildWorkbookEscher() private function buildWorkbookEscher()
{ {
$escher = null; $escher = null;
// any drawings in this workbook? // any drawings in this workbook?
$found = false; $found = false;
foreach ($this->_phpExcel->getAllSheets() as $sheet) { foreach ($this->phpExcel->getAllSheets() as $sheet) {
if (count($sheet->getDrawingCollection()) > 0) { if (count($sheet->getDrawingCollection()) > 0) {
$found = true; $found = true;
break; break;
@ -424,14 +424,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$escher->setDggContainer($dggContainer); $escher->setDggContainer($dggContainer);
// set IDCLs (identifier clusters) // set IDCLs (identifier clusters)
$dggContainer->setIDCLs($this->_IDCLs); $dggContainer->setIDCLs($this->IDCLs);
// this loop is for determining maximum shape identifier of all drawing // this loop is for determining maximum shape identifier of all drawing
$spIdMax = 0; $spIdMax = 0;
$totalCountShapes = 0; $totalCountShapes = 0;
$countDrawings = 0; $countDrawings = 0;
foreach ($this->_phpExcel->getAllsheets() as $sheet) { foreach ($this->phpExcel->getAllsheets() as $sheet) {
$sheetCountShapes = 0; // count number of shapes (minus group shape), in sheet $sheetCountShapes = 0; // count number of shapes (minus group shape), in sheet
if (count($sheet->getDrawingCollection()) > 0) { if (count($sheet->getDrawingCollection()) > 0) {
@ -441,7 +441,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
++$sheetCountShapes; ++$sheetCountShapes;
++$totalCountShapes; ++$totalCountShapes;
$spId = $sheetCountShapes | ($this->_phpExcel->getIndex($sheet) + 1) << 10; $spId = $sheetCountShapes | ($this->phpExcel->getIndex($sheet) + 1) << 10;
$spIdMax = max($spId, $spIdMax); $spIdMax = max($spId, $spIdMax);
} }
} }
@ -456,7 +456,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dggContainer->setBstoreContainer($bstoreContainer); $dggContainer->setBstoreContainer($bstoreContainer);
// the BSE's (all the images) // the BSE's (all the images)
foreach ($this->_phpExcel->getAllsheets() as $sheet) { foreach ($this->phpExcel->getAllsheets() as $sheet) {
foreach ($sheet->getDrawingCollection() as $drawing) { foreach ($sheet->getDrawingCollection() as $drawing) {
if ($drawing instanceof PHPExcel_Worksheet_Drawing) { if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
$filename = $drawing->getPath(); $filename = $drawing->getPath();
@ -498,7 +498,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$BSE->setBlip($blip); $BSE->setBlip($blip);
$bstoreContainer->addBSE($BSE); $bstoreContainer->addBSE($BSE);
} else if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) { } elseif ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) {
switch ($drawing->getRenderingFunction()) { switch ($drawing->getRenderingFunction()) {
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG: case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG:
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG; $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
@ -537,7 +537,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* Build the OLE Part for DocumentSummary Information * Build the OLE Part for DocumentSummary Information
* @return string * @return string
*/ */
private function _writeDocumentSummaryInformation() private function writeDocumentSummaryInformation()
{ {
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark) // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
$data = pack('v', 0xFFFE); $data = pack('v', 0xFFFE);
@ -571,8 +571,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
// GKPIDDSI_CATEGORY : Category // GKPIDDSI_CATEGORY : Category
if ($this->_phpExcel->getProperties()->getCategory()) { if ($this->phpExcel->getProperties()->getCategory()) {
$dataProp = $this->_phpExcel->getProperties()->getCategory(); $dataProp = $this->phpExcel->getProperties()->getCategory();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), 'type' => array('pack' => 'V', 'data' => 0x1E),
@ -733,7 +733,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* Build the OLE Part for Summary Information * Build the OLE Part for Summary Information
* @return string * @return string
*/ */
private function _writeSummaryInformation() private function writeSummaryInformation()
{ {
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark) // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
$data = pack('v', 0xFFFE); $data = pack('v', 0xFFFE);
@ -767,8 +767,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
// Title // Title
if ($this->_phpExcel->getProperties()->getTitle()) { if ($this->phpExcel->getProperties()->getTitle()) {
$dataProp = $this->_phpExcel->getProperties()->getTitle(); $dataProp = $this->phpExcel->getProperties()->getTitle();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -776,8 +776,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
} }
// Subject // Subject
if ($this->_phpExcel->getProperties()->getSubject()) { if ($this->phpExcel->getProperties()->getSubject()) {
$dataProp = $this->_phpExcel->getProperties()->getSubject(); $dataProp = $this->phpExcel->getProperties()->getSubject();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x03), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x03),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -785,8 +785,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
} }
// Author (Creator) // Author (Creator)
if ($this->_phpExcel->getProperties()->getCreator()) { if ($this->phpExcel->getProperties()->getCreator()) {
$dataProp = $this->_phpExcel->getProperties()->getCreator(); $dataProp = $this->phpExcel->getProperties()->getCreator();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x04), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x04),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -794,8 +794,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
} }
// Keywords // Keywords
if ($this->_phpExcel->getProperties()->getKeywords()) { if ($this->phpExcel->getProperties()->getKeywords()) {
$dataProp = $this->_phpExcel->getProperties()->getKeywords(); $dataProp = $this->phpExcel->getProperties()->getKeywords();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x05), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x05),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -803,8 +803,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
} }
// Comments (Description) // Comments (Description)
if ($this->_phpExcel->getProperties()->getDescription()) { if ($this->phpExcel->getProperties()->getDescription()) {
$dataProp = $this->_phpExcel->getProperties()->getDescription(); $dataProp = $this->phpExcel->getProperties()->getDescription();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x06), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x06),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -812,8 +812,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
} }
// Last Saved By (LastModifiedBy) // Last Saved By (LastModifiedBy)
if ($this->_phpExcel->getProperties()->getLastModifiedBy()) { if ($this->phpExcel->getProperties()->getLastModifiedBy()) {
$dataProp = $this->_phpExcel->getProperties()->getLastModifiedBy(); $dataProp = $this->phpExcel->getProperties()->getLastModifiedBy();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x08), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x08),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
@ -821,8 +821,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
} }
// Created Date/Time // Created Date/Time
if ($this->_phpExcel->getProperties()->getCreated()) { if ($this->phpExcel->getProperties()->getCreated()) {
$dataProp = $this->_phpExcel->getProperties()->getCreated(); $dataProp = $this->phpExcel->getProperties()->getCreated();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) 'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
@ -830,8 +830,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++; $dataSection_NumProps++;
} }
// Modified Date/Time // Modified Date/Time
if ($this->_phpExcel->getProperties()->getModified()) { if ($this->phpExcel->getProperties()->getModified()) {
$dataProp = $this->_phpExcel->getProperties()->getModified(); $dataProp = $this->phpExcel->getProperties()->getModified();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D), $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D),
'offset' => array('pack' => 'V'), 'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) 'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)

View File

@ -82,7 +82,7 @@ class PHPExcel_Writer_Excel5_Escher
if ($dggContainer = $this->_object->getDggContainer()) { if ($dggContainer = $this->_object->getDggContainer()) {
$writer = new PHPExcel_Writer_Excel5_Escher($dggContainer); $writer = new PHPExcel_Writer_Excel5_Escher($dggContainer);
$this->_data = $writer->close(); $this->_data = $writer->close();
} else if ($dgContainer = $this->_object->getDgContainer()) { } elseif ($dgContainer = $this->_object->getDgContainer()) {
$writer = new PHPExcel_Writer_Excel5_Escher($dgContainer); $writer = new PHPExcel_Writer_Excel5_Escher($dgContainer);
$this->_data = $writer->close(); $this->_data = $writer->close();
$this->_spOffsets = $writer->getSpOffsets(); $this->_spOffsets = $writer->getSpOffsets();

View File

@ -83,7 +83,7 @@ class PHPExcel_Writer_Excel5_Font
$icv = $this->_colorIndex; // Index to color palette $icv = $this->_colorIndex; // Index to color palette
if ($this->_font->getSuperScript()) { if ($this->_font->getSuperScript()) {
$sss = 1; $sss = 1;
} else if ($this->_font->getSubScript()) { } elseif ($this->_font->getSubScript()) {
$sss = 2; $sss = 2;
} else { } else {
$sss = 0; $sss = 0;

View File

@ -610,7 +610,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
); );
// (exclusive) either repeatColumns or repeatRows // (exclusive) either repeatColumns or repeatRows
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) { } elseif ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
// Columns to repeat // Columns to repeat
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) { if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
$repeat = $sheetSetup->getColumnsToRepeatAtLeft(); $repeat = $sheetSetup->getColumnsToRepeatAtLeft();
@ -717,7 +717,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$chunk .= $this->writeData($this->_writeDefinedNameBiff8(pack('C', 0x07), $formulaData, $i + 1, true)); $chunk .= $this->writeData($this->_writeDefinedNameBiff8(pack('C', 0x07), $formulaData, $i + 1, true));
// (exclusive) either repeatColumns or repeatRows // (exclusive) either repeatColumns or repeatRows
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) { } elseif ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
// Columns to repeat // Columns to repeat
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) { if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
$repeat = $sheetSetup->getColumnsToRepeatAtLeft(); $repeat = $sheetSetup->getColumnsToRepeatAtLeft();

View File

@ -504,7 +504,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// internal to current workbook // internal to current workbook
$url = str_replace('sheet://', 'internal:', $url); $url = str_replace('sheet://', 'internal:', $url);
} else if (preg_match('/^(http:|https:|ftp:|mailto:)/', $url)) { } elseif (preg_match('/^(http:|https:|ftp:|mailto:)/', $url)) {
// URL // URL
// $url = $url; // $url = $url;
@ -3048,7 +3048,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) { if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
$type = 0x02; $type = 0x02;
$operatorType = 0x00; $operatorType = 0x00;
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) { } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) {
$type = 0x01; $type = 0x01;
switch ($conditional->getOperatorType()) { switch ($conditional->getOperatorType()) {
@ -3089,7 +3089,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$szValue2 = 0x0000; $szValue2 = 0x0000;
$operand1 = pack('Cv', 0x1E, $arrConditions[0]); $operand1 = pack('Cv', 0x1E, $arrConditions[0]);
$operand2 = null; $operand2 = null;
} else if ($numConditions == 2 && ($conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN)) { } elseif ($numConditions == 2 && ($conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN)) {
$szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000); $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000);
$szValue2 = ($arrConditions[1] <= 65535 ? 3 : 0x0000); $szValue2 = ($arrConditions[1] <= 65535 ? 3 : 0x0000);
$operand1 = pack('Cv', 0x1E, $arrConditions[0]); $operand1 = pack('Cv', 0x1E, $arrConditions[0]);
@ -3226,7 +3226,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
if ($conditional->getStyle()->getFont()->getSubScript() == true) { if ($conditional->getStyle()->getFont()->getSubScript() == true) {
$dataBlockFont .= pack('v', 0x02); $dataBlockFont .= pack('v', 0x02);
$fontEscapement = 0; $fontEscapement = 0;
} else if ($conditional->getStyle()->getFont()->getSuperScript() == true) { } elseif ($conditional->getStyle()->getFont()->getSuperScript() == true) {
$dataBlockFont .= pack('v', 0x01); $dataBlockFont .= pack('v', 0x01);
$fontEscapement = 0; $fontEscapement = 0;
} else { } else {

View File

@ -75,61 +75,61 @@ class PHPExcel_Writer_Excel5_Xf
* *
* @var boolean * @var boolean
*/ */
private $_isStyleXf; private $isStyleXf;
/** /**
* Index to the FONT record. Index 4 does not exist * Index to the FONT record. Index 4 does not exist
* @var integer * @var integer
*/ */
private $_fontIndex; private $fontIndex;
/** /**
* An index (2 bytes) to a FORMAT record (number format). * An index (2 bytes) to a FORMAT record (number format).
* @var integer * @var integer
*/ */
public $_numberFormatIndex; private $numberFormatIndex;
/** /**
* 1 bit, apparently not used. * 1 bit, apparently not used.
* @var integer * @var integer
*/ */
public $_text_justlast; private $textJustLast;
/** /**
* The cell's foreground color. * The cell's foreground color.
* @var integer * @var integer
*/ */
public $_fg_color; private $foregroundColor;
/** /**
* The cell's background color. * The cell's background color.
* @var integer * @var integer
*/ */
public $_bg_color; private $backgroundColor;
/** /**
* Color of the bottom border of the cell. * Color of the bottom border of the cell.
* @var integer * @var integer
*/ */
public $_bottom_color; private $bottomBorderColor;
/** /**
* Color of the top border of the cell. * Color of the top border of the cell.
* @var integer * @var integer
*/ */
public $_top_color; private $topBorderColor;
/** /**
* Color of the left border of the cell. * Color of the left border of the cell.
* @var integer * @var integer
*/ */
public $_left_color; private $leftBorderColor;
/** /**
* Color of the right border of the cell. * Color of the right border of the cell.
* @var integer * @var integer
*/ */
public $_right_color; private $rightBorderColor;
/** /**
* Constructor * Constructor
@ -139,22 +139,22 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function __construct(PHPExcel_Style $style = null) public function __construct(PHPExcel_Style $style = null)
{ {
$this->_isStyleXf = false; $this->isStyleXf = false;
$this->_fontIndex = 0; $this->fontIndex = 0;
$this->_numberFormatIndex = 0; $this->numberFormatIndex = 0;
$this->_text_justlast = 0; $this->textJustLast = 0;
$this->_fg_color = 0x40; $this->foregroundColor = 0x40;
$this->_bg_color = 0x41; $this->backgroundColor = 0x41;
$this->_diag = 0; $this->_diag = 0;
$this->_bottom_color = 0x40; $this->bottomBorderColor = 0x40;
$this->_top_color = 0x40; $this->topBorderColor = 0x40;
$this->_left_color = 0x40; $this->leftBorderColor = 0x40;
$this->_right_color = 0x40; $this->rightBorderColor = 0x40;
$this->_diag_color = 0x40; $this->_diag_color = 0x40;
$this->_style = $style; $this->_style = $style;
@ -169,94 +169,94 @@ class PHPExcel_Writer_Excel5_Xf
public function writeXf() public function writeXf()
{ {
// Set the type of the XF record and some of the attributes. // Set the type of the XF record and some of the attributes.
if ($this->_isStyleXf) { if ($this->isStyleXf) {
$style = 0xFFF5; $style = 0xFFF5;
} else { } else {
$style = self::_mapLocked($this->_style->getProtection()->getLocked()); $style = self::mapLocked($this->_style->getProtection()->getLocked());
$style |= self::_mapHidden($this->_style->getProtection()->getHidden()) << 1; $style |= self::mapHidden($this->_style->getProtection()->getHidden()) << 1;
} }
// Flags to indicate if attributes have been set. // Flags to indicate if attributes have been set.
$atr_num = ($this->_numberFormatIndex != 0)?1:0; $atr_num = ($this->numberFormatIndex != 0)?1:0;
$atr_fnt = ($this->_fontIndex != 0)?1:0; $atr_fnt = ($this->fontIndex != 0)?1:0;
$atr_alc = ((int) $this->_style->getAlignment()->getWrapText()) ? 1 : 0; $atr_alc = ((int) $this->_style->getAlignment()->getWrapText()) ? 1 : 0;
$atr_bdr = (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) || $atr_bdr = (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) ||
self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) || self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) ||
self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) || self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) ||
self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0; self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0;
$atr_pat = (($this->_fg_color != 0x40) || $atr_pat = (($this->foregroundColor != 0x40) ||
($this->_bg_color != 0x41) || ($this->backgroundColor != 0x41) ||
self::_mapFillType($this->_style->getFill()->getFillType()))?1:0; self::mapFillType($this->_style->getFill()->getFillType()))?1:0;
$atr_prot = self::_mapLocked($this->_style->getProtection()->getLocked()) $atr_prot = self::mapLocked($this->_style->getProtection()->getLocked())
| self::_mapHidden($this->_style->getProtection()->getHidden()); | self::mapHidden($this->_style->getProtection()->getHidden());
// Zero the default border colour if the border has not been set. // Zero the default border colour if the border has not been set.
if (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) { if (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) {
$this->_bottom_color = 0; $this->bottomBorderColor = 0;
} }
if (self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) { if (self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) {
$this->_top_color = 0; $this->topBorderColor = 0;
} }
if (self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) { if (self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) {
$this->_right_color = 0; $this->rightBorderColor = 0;
} }
if (self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 0) { if (self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 0) {
$this->_left_color = 0; $this->leftBorderColor = 0;
} }
if (self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) == 0) { if (self::mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) == 0) {
$this->_diag_color = 0; $this->_diag_color = 0;
} }
$record = 0x00E0; // Record identifier $record = 0x00E0; // Record identifier
$length = 0x0014; // Number of bytes to follow $length = 0x0014; // Number of bytes to follow
$ifnt = $this->_fontIndex; // Index to FONT record $ifnt = $this->fontIndex; // Index to FONT record
$ifmt = $this->_numberFormatIndex; // Index to FORMAT record $ifmt = $this->numberFormatIndex; // Index to FORMAT record
$align = $this->_mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment $align = $this->mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment
$align |= (int) $this->_style->getAlignment()->getWrapText() << 3; $align |= (int) $this->_style->getAlignment()->getWrapText() << 3;
$align |= self::_mapVAlign($this->_style->getAlignment()->getVertical()) << 4; $align |= self::mapVAlign($this->_style->getAlignment()->getVertical()) << 4;
$align |= $this->_text_justlast << 7; $align |= $this->textJustLast << 7;
$used_attrib = $atr_num << 2; $used_attrib = $atr_num << 2;
$used_attrib |= $atr_fnt << 3; $used_attrib |= $atr_fnt << 3;
$used_attrib |= $atr_alc << 4; $used_attrib |= $atr_alc << 4;
$used_attrib |= $atr_bdr << 5; $used_attrib |= $atr_bdr << 5;
$used_attrib |= $atr_pat << 6; $used_attrib |= $atr_pat << 6;
$used_attrib |= $atr_prot << 7; $used_attrib |= $atr_prot << 7;
$icv = $this->_fg_color; // fg and bg pattern colors $icv = $this->foregroundColor; // fg and bg pattern colors
$icv |= $this->_bg_color << 7; $icv |= $this->backgroundColor << 7;
$border1 = self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color $border1 = self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color
$border1 |= self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4; $border1 |= self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4;
$border1 |= self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8; $border1 |= self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8;
$border1 |= self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12; $border1 |= self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12;
$border1 |= $this->_left_color << 16; $border1 |= $this->leftBorderColor << 16;
$border1 |= $this->_right_color << 23; $border1 |= $this->rightBorderColor << 23;
$diagonalDirection = $this->_style->getBorders()->getDiagonalDirection(); $diagonalDirection = $this->_style->getBorders()->getDiagonalDirection();
$diag_tl_to_rb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH $diag_tl_to_rb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH
|| $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_DOWN; || $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_DOWN;
$diag_tr_to_lb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH $diag_tr_to_lb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH
|| $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_UP; || $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_UP;
$border1 |= $diag_tl_to_rb << 30; $border1 |= $diag_tl_to_rb << 30;
$border1 |= $diag_tr_to_lb << 31; $border1 |= $diag_tr_to_lb << 31;
$border2 = $this->_top_color; // Border color $border2 = $this->topBorderColor; // Border color
$border2 |= $this->_bottom_color << 7; $border2 |= $this->bottomBorderColor << 7;
$border2 |= $this->_diag_color << 14; $border2 |= $this->_diag_color << 14;
$border2 |= self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21; $border2 |= self::mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21;
$border2 |= self::_mapFillType($this->_style->getFill()->getFillType()) << 26; $border2 |= self::mapFillType($this->_style->getFill()->getFillType()) << 26;
$header = pack("vv", $record, $length); $header = pack("vv", $record, $length);
//BIFF8 options: identation, shrinkToFit and text direction //BIFF8 options: identation, shrinkToFit and text direction
$biff8_options = $this->_style->getAlignment()->getIndent(); $biff8_options = $this->_style->getAlignment()->getIndent();
$biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4; $biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4;
$data = pack("vvvC", $ifnt, $ifmt, $style, $align); $data = pack("vvvC", $ifnt, $ifmt, $style, $align);
$data .= pack("CCC", self::_mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib); $data .= pack("CCC", self::mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib);
$data .= pack("VVv", $border1, $border2, $icv); $data .= pack("VVv", $border1, $border2, $icv);
return($header . $data); return($header . $data);
@ -269,7 +269,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setIsStyleXf($value) public function setIsStyleXf($value)
{ {
$this->_isStyleXf = $value; $this->isStyleXf = $value;
} }
/** /**
@ -280,7 +280,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setBottomColor($colorIndex) public function setBottomColor($colorIndex)
{ {
$this->_bottom_color = $colorIndex; $this->bottomBorderColor = $colorIndex;
} }
/** /**
@ -291,7 +291,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setTopColor($colorIndex) public function setTopColor($colorIndex)
{ {
$this->_top_color = $colorIndex; $this->topBorderColor = $colorIndex;
} }
/** /**
@ -302,7 +302,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setLeftColor($colorIndex) public function setLeftColor($colorIndex)
{ {
$this->_left_color = $colorIndex; $this->leftBorderColor = $colorIndex;
} }
/** /**
@ -313,7 +313,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setRightColor($colorIndex) public function setRightColor($colorIndex)
{ {
$this->_right_color = $colorIndex; $this->rightBorderColor = $colorIndex;
} }
/** /**
@ -336,7 +336,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setFgColor($colorIndex) public function setFgColor($colorIndex)
{ {
$this->_fg_color = $colorIndex; $this->foregroundColor = $colorIndex;
} }
/** /**
@ -347,7 +347,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setBgColor($colorIndex) public function setBgColor($colorIndex)
{ {
$this->_bg_color = $colorIndex; $this->backgroundColor = $colorIndex;
} }
/** /**
@ -359,7 +359,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setNumberFormatIndex($numberFormatIndex) public function setNumberFormatIndex($numberFormatIndex)
{ {
$this->_numberFormatIndex = $numberFormatIndex; $this->numberFormatIndex = $numberFormatIndex;
} }
/** /**
@ -369,7 +369,7 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
public function setFontIndex($value) public function setFontIndex($value)
{ {
$this->_fontIndex = $value; $this->fontIndex = $value;
} }
/** /**
@ -377,21 +377,22 @@ class PHPExcel_Writer_Excel5_Xf
* @static array of int * @static array of int
* *
*/ */
private static $_mapBorderStyle = array ( PHPExcel_Style_Border::BORDER_NONE => 0x00, private static $mapBorderStyles = array(
PHPExcel_Style_Border::BORDER_THIN => 0x01, PHPExcel_Style_Border::BORDER_NONE => 0x00,
PHPExcel_Style_Border::BORDER_MEDIUM => 0x02, PHPExcel_Style_Border::BORDER_THIN => 0x01,
PHPExcel_Style_Border::BORDER_DASHED => 0x03, PHPExcel_Style_Border::BORDER_MEDIUM => 0x02,
PHPExcel_Style_Border::BORDER_DOTTED => 0x04, PHPExcel_Style_Border::BORDER_DASHED => 0x03,
PHPExcel_Style_Border::BORDER_THICK => 0x05, PHPExcel_Style_Border::BORDER_DOTTED => 0x04,
PHPExcel_Style_Border::BORDER_DOUBLE => 0x06, PHPExcel_Style_Border::BORDER_THICK => 0x05,
PHPExcel_Style_Border::BORDER_HAIR => 0x07, PHPExcel_Style_Border::BORDER_DOUBLE => 0x06,
PHPExcel_Style_Border::BORDER_MEDIUMDASHED => 0x08, PHPExcel_Style_Border::BORDER_HAIR => 0x07,
PHPExcel_Style_Border::BORDER_DASHDOT => 0x09, PHPExcel_Style_Border::BORDER_MEDIUMDASHED => 0x08,
PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT => 0x0A, PHPExcel_Style_Border::BORDER_DASHDOT => 0x09,
PHPExcel_Style_Border::BORDER_DASHDOTDOT => 0x0B, PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT => 0x0A,
PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT => 0x0C, PHPExcel_Style_Border::BORDER_DASHDOTDOT => 0x0B,
PHPExcel_Style_Border::BORDER_SLANTDASHDOT => 0x0D, PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT => 0x0C,
); PHPExcel_Style_Border::BORDER_SLANTDASHDOT => 0x0D,
);
/** /**
* Map border style * Map border style
@ -399,10 +400,10 @@ class PHPExcel_Writer_Excel5_Xf
* @param string $borderStyle * @param string $borderStyle
* @return int * @return int
*/ */
private static function _mapBorderStyle($borderStyle) private static function mapBorderStyle($borderStyle)
{ {
if (isset(self::$_mapBorderStyle[$borderStyle])) { if (isset(self::$mapBorderStyles[$borderStyle])) {
return self::$_mapBorderStyle[$borderStyle]; return self::$mapBorderStyles[$borderStyle];
} }
return 0x00; return 0x00;
} }
@ -412,38 +413,40 @@ class PHPExcel_Writer_Excel5_Xf
* @static array of int * @static array of int
* *
*/ */
private static $_mapFillType = array( PHPExcel_Style_Fill::FILL_NONE => 0x00, private static $mapFillTypes = array(
PHPExcel_Style_Fill::FILL_SOLID => 0x01, PHPExcel_Style_Fill::FILL_NONE => 0x00,
PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY => 0x02, PHPExcel_Style_Fill::FILL_SOLID => 0x01,
PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY => 0x03, PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY => 0x02,
PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY => 0x04, PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY => 0x03,
PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL => 0x05, PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY => 0x04,
PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL => 0x06, PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL => 0x05,
PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN => 0x07, PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL => 0x06,
PHPExcel_Style_Fill::FILL_PATTERN_DARKUP => 0x08, PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN => 0x07,
PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID => 0x09, PHPExcel_Style_Fill::FILL_PATTERN_DARKUP => 0x08,
PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS => 0x0A, PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID => 0x09,
PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL => 0x0B, PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS => 0x0A,
PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL => 0x0C, PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL => 0x0B,
PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN => 0x0D, PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL => 0x0C,
PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP => 0x0E, PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN => 0x0D,
PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID => 0x0F, PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP => 0x0E,
PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS => 0x10, PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID => 0x0F,
PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 => 0x11, PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS => 0x10,
PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 => 0x12, PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 => 0x11,
PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8 PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 => 0x12,
PHPExcel_Style_Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8 PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8
); PHPExcel_Style_Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8
);
/** /**
* Map fill type * Map fill type
* *
* @param string $fillType * @param string $fillType
* @return int * @return int
*/ */
private static function _mapFillType($fillType) private static function mapFillType($fillType)
{ {
if (isset(self::$_mapFillType[$fillType])) { if (isset(self::$mapFillTypes[$fillType])) {
return self::$_mapFillType[$fillType]; return self::$mapFillTypes[$fillType];
} }
return 0x00; return 0x00;
} }
@ -453,24 +456,26 @@ class PHPExcel_Writer_Excel5_Xf
* @static array of int * @static array of int
* *
*/ */
private static $_mapHAlign = array( PHPExcel_Style_Alignment::HORIZONTAL_GENERAL => 0, private static $mapHAlignments = array(
PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1, PHPExcel_Style_Alignment::HORIZONTAL_GENERAL => 0,
PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2, PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1,
PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3, PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2,
PHPExcel_Style_Alignment::HORIZONTAL_FILL => 4, PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3,
PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY => 5, PHPExcel_Style_Alignment::HORIZONTAL_FILL => 4,
PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6, PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY => 5,
); PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6,
);
/** /**
* Map to BIFF2-BIFF8 codes for horizontal alignment * Map to BIFF2-BIFF8 codes for horizontal alignment
* *
* @param string $hAlign * @param string $hAlign
* @return int * @return int
*/ */
private function _mapHAlign($hAlign) private function mapHAlign($hAlign)
{ {
if (isset(self::$_mapHAlign[$hAlign])) { if (isset(self::$mapHAlignments[$hAlign])) {
return self::$_mapHAlign[$hAlign]; return self::$mapHAlignments[$hAlign];
} }
return 0; return 0;
} }
@ -480,21 +485,23 @@ class PHPExcel_Writer_Excel5_Xf
* @static array of int * @static array of int
* *
*/ */
private static $_mapVAlign = array( PHPExcel_Style_Alignment::VERTICAL_TOP => 0, private static $mapVAlignments = array(
PHPExcel_Style_Alignment::VERTICAL_CENTER => 1, PHPExcel_Style_Alignment::VERTICAL_TOP => 0,
PHPExcel_Style_Alignment::VERTICAL_BOTTOM => 2, PHPExcel_Style_Alignment::VERTICAL_CENTER => 1,
PHPExcel_Style_Alignment::VERTICAL_JUSTIFY => 3, PHPExcel_Style_Alignment::VERTICAL_BOTTOM => 2,
); PHPExcel_Style_Alignment::VERTICAL_JUSTIFY => 3,
);
/** /**
* Map to BIFF2-BIFF8 codes for vertical alignment * Map to BIFF2-BIFF8 codes for vertical alignment
* *
* @param string $vAlign * @param string $vAlign
* @return int * @return int
*/ */
private static function _mapVAlign($vAlign) private static function mapVAlign($vAlign)
{ {
if (isset(self::$_mapVAlign[$vAlign])) { if (isset(self::$mapVAlignments[$vAlign])) {
return self::$_mapVAlign[$vAlign]; return self::$mapVAlignments[$vAlign];
} }
return 2; return 2;
} }
@ -505,15 +512,13 @@ class PHPExcel_Writer_Excel5_Xf
* @param int $textRotation * @param int $textRotation
* @return int * @return int
*/ */
private static function _mapTextRotation($textRotation) private static function mapTextRotation($textRotation)
{ {
if ($textRotation >= 0) { if ($textRotation >= 0) {
return $textRotation; return $textRotation;
} } elseif ($textRotation == -165) {
if ($textRotation == -165) {
return 255; return 255;
} } elseif ($textRotation < 0) {
if ($textRotation < 0) {
return 90 - $textRotation; return 90 - $textRotation;
} }
} }
@ -524,7 +529,7 @@ class PHPExcel_Writer_Excel5_Xf
* @param string * @param string
* @return int * @return int
*/ */
private static function _mapLocked($locked) private static function mapLocked($locked)
{ {
switch ($locked) { switch ($locked) {
case PHPExcel_Style_Protection::PROTECTION_INHERIT: case PHPExcel_Style_Protection::PROTECTION_INHERIT:
@ -544,7 +549,7 @@ class PHPExcel_Writer_Excel5_Xf
* @param string * @param string
* @return int * @return int
*/ */
private static function _mapHidden($hidden) private static function mapHidden($hidden)
{ {
switch ($hidden) { switch ($hidden) {
case PHPExcel_Style_Protection::PROTECTION_INHERIT: case PHPExcel_Style_Protection::PROTECTION_INHERIT:

View File

@ -32,14 +32,14 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
* *
* @var string * @var string
*/ */
protected $_tempDir = ''; protected $tempDir = '';
/** /**
* Font * Font
* *
* @var string * @var string
*/ */
protected $_font = 'freesans'; protected $font = 'freesans';
/** /**
* Orientation (Over-ride) * Orientation (Over-ride)
@ -212,7 +212,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
{ {
parent::__construct($phpExcel); parent::__construct($phpExcel);
$this->setUseInlineCss(true); $this->setUseInlineCss(true);
$this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir(); $this->tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
} }
/** /**
@ -222,7 +222,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
*/ */
public function getFont() public function getFont()
{ {
return $this->_font; return $this->font;
} }
/** /**
@ -236,7 +236,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
*/ */
public function setFont($fontName) public function setFont($fontName)
{ {
$this->_font = $fontName; $this->font = $fontName;
return $this; return $this;
} }
@ -291,7 +291,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
*/ */
public function getTempDir() public function getTempDir()
{ {
return $this->_tempDir; return $this->tempDir;
} }
/** /**
@ -304,7 +304,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
public function setTempDir($pValue = '') public function setTempDir($pValue = '')
{ {
if (is_dir($pValue)) { if (is_dir($pValue)) {
$this->_tempDir = $pValue; $this->tempDir = $pValue;
} else { } else {
throw new PHPExcel_Writer_Exception("Directory does not exist: $pValue"); throw new PHPExcel_Writer_Exception("Directory does not exist: $pValue");
} }

View File

@ -6,8 +6,7 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
@ -46,11 +45,10 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase
public function testAutoloadInstantiateSuccess() public function testAutoloadInstantiateSuccess()
{ {
$result = new PHPExcel_Calculation_Function(1,2,3); $result = new PHPExcel_Calculation_Function(1, 2, 3);
// Must return an object... // Must return an object...
$this->assertTrue(is_object($result)); $this->assertTrue(is_object($result));
// ... of the correct type // ... of the correct type
$this->assertTrue(is_a($result,'PHPExcel_Calculation_Function')); $this->assertTrue(is_a($result, 'PHPExcel_Calculation_Function'));
} }
} }

View File

@ -8,459 +8,457 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
} }
/** /**
* @dataProvider providerDATE * @dataProvider providerDATE
*/ */
public function testDATE() public function testDATE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDATE() public function providerDATE()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/DATE.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/DATE.data');
} }
public function testDATEtoPHP() public function testDATEtoPHP()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::DATE(2012,1,31); $result = PHPExcel_Calculation_DateTime::DATE(2012, 1, 31);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1327968000, $result, NULL, 1E-8); $this->assertEquals(1327968000, $result, null, 1E-8);
} }
public function testDATEtoPHPObject() public function testDATEtoPHPObject()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::DATE(2012,1,31); $result = PHPExcel_Calculation_DateTime::DATE(2012, 1, 31);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object... // Must return an object...
$this->assertTrue(is_object($result)); $this->assertTrue(is_object($result));
// ... of the correct type // ... of the correct type
$this->assertTrue(is_a($result,'DateTime')); $this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value // ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'31-Jan-2012'); $this->assertEquals($result->format('d-M-Y'), '31-Jan-2012');
} }
public function testDATEwith1904Calendar() public function testDATEwith1904Calendar()
{ {
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
$result = PHPExcel_Calculation_DateTime::DATE(1918,11,11); $result = PHPExcel_Calculation_DateTime::DATE(1918, 11, 11);
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
$this->assertEquals($result,5428); $this->assertEquals($result, 5428);
} }
public function testDATEwith1904CalendarError() public function testDATEwith1904CalendarError()
{ {
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
$result = PHPExcel_Calculation_DateTime::DATE(1901,1,31); $result = PHPExcel_Calculation_DateTime::DATE(1901, 1, 31);
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
$this->assertEquals($result,'#NUM!'); $this->assertEquals($result, '#NUM!');
} }
/** /**
* @dataProvider providerDATEVALUE * @dataProvider providerDATEVALUE
*/ */
public function testDATEVALUE() public function testDATEVALUE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEVALUE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATEVALUE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDATEVALUE() public function providerDATEVALUE()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/DATEVALUE.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/DATEVALUE.data');
} }
public function testDATEVALUEtoPHP() public function testDATEVALUEtoPHP()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31'); $result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31');
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1327968000, $result, NULL, 1E-8); $this->assertEquals(1327968000, $result, null, 1E-8);
} }
public function testDATEVALUEtoPHPObject() public function testDATEVALUEtoPHPObject()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31'); $result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31');
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object... // Must return an object...
$this->assertTrue(is_object($result)); $this->assertTrue(is_object($result));
// ... of the correct type // ... of the correct type
$this->assertTrue(is_a($result,'DateTime')); $this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value // ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'31-Jan-2012'); $this->assertEquals($result->format('d-M-Y'), '31-Jan-2012');
} }
/** /**
* @dataProvider providerYEAR * @dataProvider providerYEAR
*/ */
public function testYEAR() public function testYEAR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEAR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'YEAR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerYEAR() public function providerYEAR()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/YEAR.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/YEAR.data');
} }
/** /**
* @dataProvider providerMONTH * @dataProvider providerMONTH
*/ */
public function testMONTH() public function testMONTH()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MONTHOFYEAR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'MONTHOFYEAR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerMONTH() public function providerMONTH()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/MONTH.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/MONTH.data');
} }
/** /**
* @dataProvider providerWEEKNUM * @dataProvider providerWEEKNUM
*/ */
public function testWEEKNUM() public function testWEEKNUM()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WEEKOFYEAR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'WEEKOFYEAR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerWEEKNUM() public function providerWEEKNUM()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/WEEKNUM.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/WEEKNUM.data');
} }
/** /**
* @dataProvider providerWEEKDAY * @dataProvider providerWEEKDAY
*/ */
public function testWEEKDAY() public function testWEEKDAY()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFWEEK'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYOFWEEK'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerWEEKDAY() public function providerWEEKDAY()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/WEEKDAY.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/WEEKDAY.data');
} }
/** /**
* @dataProvider providerDAY * @dataProvider providerDAY
*/ */
public function testDAY() public function testDAY()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFMONTH'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYOFMONTH'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDAY() public function providerDAY()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/DAY.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/DAY.data');
} }
/** /**
* @dataProvider providerTIME * @dataProvider providerTIME
*/ */
public function testTIME() public function testTIME()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIME'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'TIME'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerTIME() public function providerTIME()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/TIME.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/TIME.data');
} }
public function testTIMEtoPHP() public function testTIMEtoPHP()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::TIME(7,30,20); $result = PHPExcel_Calculation_DateTime::TIME(7, 30, 20);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(27020, $result, NULL, 1E-8); $this->assertEquals(27020, $result, null, 1E-8);
} }
public function testTIMEtoPHPObject() public function testTIMEtoPHPObject()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::TIME(7,30,20); $result = PHPExcel_Calculation_DateTime::TIME(7, 30, 20);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object... // Must return an object...
$this->assertTrue(is_object($result)); $this->assertTrue(is_object($result));
// ... of the correct type // ... of the correct type
$this->assertTrue(is_a($result,'DateTime')); $this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value // ... with the correct value
$this->assertEquals($result->format('H:i:s'),'07:30:20'); $this->assertEquals($result->format('H:i:s'), '07:30:20');
} }
/** /**
* @dataProvider providerTIMEVALUE * @dataProvider providerTIMEVALUE
*/ */
public function testTIMEVALUE() public function testTIMEVALUE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIMEVALUE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'TIMEVALUE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerTIMEVALUE() public function providerTIMEVALUE()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/TIMEVALUE.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/TIMEVALUE.data');
} }
public function testTIMEVALUEtoPHP() public function testTIMEVALUEtoPHP()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20'); $result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20');
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(23420, $result, NULL, 1E-8); $this->assertEquals(23420, $result, null, 1E-8);
} }
public function testTIMEVALUEtoPHPObject() public function testTIMEVALUEtoPHPObject()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20'); $result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20');
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object... // Must return an object...
$this->assertTrue(is_object($result)); $this->assertTrue(is_object($result));
// ... of the correct type // ... of the correct type
$this->assertTrue(is_a($result,'DateTime')); $this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value // ... with the correct value
$this->assertEquals($result->format('H:i:s'),'07:30:20'); $this->assertEquals($result->format('H:i:s'), '07:30:20');
} }
/** /**
* @dataProvider providerHOUR * @dataProvider providerHOUR
*/ */
public function testHOUR() public function testHOUR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','HOUROFDAY'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'HOUROFDAY'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerHOUR() public function providerHOUR()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/HOUR.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/HOUR.data');
} }
/** /**
* @dataProvider providerMINUTE * @dataProvider providerMINUTE
*/ */
public function testMINUTE() public function testMINUTE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MINUTEOFHOUR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'MINUTEOFHOUR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerMINUTE() public function providerMINUTE()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/MINUTE.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/MINUTE.data');
} }
/** /**
* @dataProvider providerSECOND * @dataProvider providerSECOND
*/ */
public function testSECOND() public function testSECOND()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','SECONDOFMINUTE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'SECONDOFMINUTE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerSECOND() public function providerSECOND()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/SECOND.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/SECOND.data');
} }
/** /**
* @dataProvider providerNETWORKDAYS * @dataProvider providerNETWORKDAYS
*/ */
public function testNETWORKDAYS() public function testNETWORKDAYS()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','NETWORKDAYS'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'NETWORKDAYS'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerNETWORKDAYS() public function providerNETWORKDAYS()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/NETWORKDAYS.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/NETWORKDAYS.data');
} }
/** /**
* @dataProvider providerWORKDAY * @dataProvider providerWORKDAY
*/ */
public function testWORKDAY() public function testWORKDAY()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WORKDAY'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'WORKDAY'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerWORKDAY() public function providerWORKDAY()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/WORKDAY.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/WORKDAY.data');
} }
/** /**
* @dataProvider providerEDATE * @dataProvider providerEDATE
*/ */
public function testEDATE() public function testEDATE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EDATE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'EDATE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerEDATE() public function providerEDATE()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/EDATE.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/EDATE.data');
} }
public function testEDATEtoPHP() public function testEDATEtoPHP()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26',-1); $result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26', -1);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1324857600, $result, NULL, 1E-8); $this->assertEquals(1324857600, $result, null, 1E-8);
} }
public function testEDATEtoPHPObject() public function testEDATEtoPHPObject()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26',-1); $result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26', -1);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object... // Must return an object...
$this->assertTrue(is_object($result)); $this->assertTrue(is_object($result));
// ... of the correct type // ... of the correct type
$this->assertTrue(is_a($result,'DateTime')); $this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value // ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'26-Dec-2011'); $this->assertEquals($result->format('d-M-Y'), '26-Dec-2011');
} }
/** /**
* @dataProvider providerEOMONTH * @dataProvider providerEOMONTH
*/ */
public function testEOMONTH() public function testEOMONTH()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EOMONTH'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'EOMONTH'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerEOMONTH() public function providerEOMONTH()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/EOMONTH.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/EOMONTH.data');
} }
public function testEOMONTHtoPHP() public function testEOMONTHtoPHP()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26',-1); $result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26', -1);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1325289600, $result, NULL, 1E-8); $this->assertEquals(1325289600, $result, null, 1E-8);
} }
public function testEOMONTHtoPHPObject() public function testEOMONTHtoPHPObject()
{ {
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26',-1); $result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26', -1);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object... // Must return an object...
$this->assertTrue(is_object($result)); $this->assertTrue(is_object($result));
// ... of the correct type // ... of the correct type
$this->assertTrue(is_a($result,'DateTime')); $this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value // ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'31-Dec-2011'); $this->assertEquals($result->format('d-M-Y'), '31-Dec-2011');
} }
/** /**
* @dataProvider providerDATEDIF * @dataProvider providerDATEDIF
*/ */
public function testDATEDIF() public function testDATEDIF()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEDIF'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATEDIF'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDATEDIF() public function providerDATEDIF()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/DATEDIF.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/DATEDIF.data');
} }
/** /**
* @dataProvider providerDAYS360 * @dataProvider providerDAYS360
*/ */
public function testDAYS360() public function testDAYS360()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYS360'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYS360'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDAYS360() public function providerDAYS360()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/DAYS360.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/DAYS360.data');
} }
/** /**
* @dataProvider providerYEARFRAC * @dataProvider providerYEARFRAC
*/ */
public function testYEARFRAC() public function testYEARFRAC()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEARFRAC'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'YEARFRAC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerYEARFRAC() public function providerYEARFRAC()
{ {
return new testDataFileIterator('rawTestData/Calculation/DateTime/YEARFRAC.data'); return new testDataFileIterator('rawTestData/Calculation/DateTime/YEARFRAC.data');
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -8,509 +8,507 @@ class FinancialTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
} }
/** /**
* @dataProvider providerACCRINT * @dataProvider providerACCRINT
*/ */
public function testACCRINT() public function testACCRINT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerACCRINT() public function providerACCRINT()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/ACCRINT.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/ACCRINT.data');
} }
/** /**
* @dataProvider providerACCRINTM * @dataProvider providerACCRINTM
*/ */
public function testACCRINTM() public function testACCRINTM()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINTM'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINTM'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerACCRINTM() public function providerACCRINTM()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/ACCRINTM.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/ACCRINTM.data');
} }
/** /**
* @dataProvider providerAMORDEGRC * @dataProvider providerAMORDEGRC
*/ */
public function testAMORDEGRC() public function testAMORDEGRC()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORDEGRC'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORDEGRC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerAMORDEGRC() public function providerAMORDEGRC()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/AMORDEGRC.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/AMORDEGRC.data');
} }
/** /**
* @dataProvider providerAMORLINC * @dataProvider providerAMORLINC
*/ */
public function testAMORLINC() public function testAMORLINC()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORLINC'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORLINC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerAMORLINC() public function providerAMORLINC()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/AMORLINC.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/AMORLINC.data');
} }
/** /**
* @dataProvider providerCOUPDAYBS * @dataProvider providerCOUPDAYBS
*/ */
public function testCOUPDAYBS() public function testCOUPDAYBS()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYBS'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYBS'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPDAYBS() public function providerCOUPDAYBS()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYBS.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYBS.data');
} }
/** /**
* @dataProvider providerCOUPDAYS * @dataProvider providerCOUPDAYS
*/ */
public function testCOUPDAYS() public function testCOUPDAYS()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYS'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYS'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPDAYS() public function providerCOUPDAYS()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYS.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYS.data');
} }
/** /**
* @dataProvider providerCOUPDAYSNC * @dataProvider providerCOUPDAYSNC
*/ */
public function testCOUPDAYSNC() public function testCOUPDAYSNC()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYSNC'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYSNC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPDAYSNC() public function providerCOUPDAYSNC()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYSNC.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/COUPDAYSNC.data');
} }
/** /**
* @dataProvider providerCOUPNCD * @dataProvider providerCOUPNCD
*/ */
public function testCOUPNCD() public function testCOUPNCD()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNCD'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNCD'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPNCD() public function providerCOUPNCD()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPNCD.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/COUPNCD.data');
} }
/** /**
* @dataProvider providerCOUPNUM * @dataProvider providerCOUPNUM
*/ */
public function testCOUPNUM() public function testCOUPNUM()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNUM'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNUM'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPNUM() public function providerCOUPNUM()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPNUM.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/COUPNUM.data');
} }
/** /**
* @dataProvider providerCOUPPCD * @dataProvider providerCOUPPCD
*/ */
public function testCOUPPCD() public function testCOUPPCD()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPPCD'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPPCD'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCOUPPCD() public function providerCOUPPCD()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/COUPPCD.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/COUPPCD.data');
} }
/** /**
* @dataProvider providerCUMIPMT * @dataProvider providerCUMIPMT
*/ */
public function testCUMIPMT() public function testCUMIPMT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMIPMT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMIPMT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCUMIPMT() public function providerCUMIPMT()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/CUMIPMT.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/CUMIPMT.data');
} }
/** /**
* @dataProvider providerCUMPRINC * @dataProvider providerCUMPRINC
*/ */
public function testCUMPRINC() public function testCUMPRINC()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMPRINC'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMPRINC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerCUMPRINC() public function providerCUMPRINC()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/CUMPRINC.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/CUMPRINC.data');
} }
/** /**
* @dataProvider providerDB * @dataProvider providerDB
*/ */
public function testDB() public function testDB()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DB'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DB'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDB() public function providerDB()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/DB.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/DB.data');
} }
/** /**
* @dataProvider providerDDB * @dataProvider providerDDB
*/ */
public function testDDB() public function testDDB()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DDB'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DDB'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDDB() public function providerDDB()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/DDB.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/DDB.data');
} }
/** /**
* @dataProvider providerDISC * @dataProvider providerDISC
*/ */
public function testDISC() public function testDISC()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DISC'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DISC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDISC() public function providerDISC()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/DISC.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/DISC.data');
} }
/** /**
* @dataProvider providerDOLLARDE * @dataProvider providerDOLLARDE
*/ */
public function testDOLLARDE() public function testDOLLARDE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARDE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARDE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDOLLARDE() public function providerDOLLARDE()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/DOLLARDE.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/DOLLARDE.data');
} }
/** /**
* @dataProvider providerDOLLARFR * @dataProvider providerDOLLARFR
*/ */
public function testDOLLARFR() public function testDOLLARFR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARFR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARFR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerDOLLARFR() public function providerDOLLARFR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/DOLLARFR.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/DOLLARFR.data');
} }
/** /**
* @dataProvider providerEFFECT * @dataProvider providerEFFECT
*/ */
public function testEFFECT() public function testEFFECT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','EFFECT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','EFFECT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerEFFECT() public function providerEFFECT()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/EFFECT.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/EFFECT.data');
} }
/** /**
* @dataProvider providerFV * @dataProvider providerFV
*/ */
public function testFV() public function testFV()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','FV'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','FV'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerFV() public function providerFV()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/FV.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/FV.data');
} }
/** /**
* @dataProvider providerFVSCHEDULE * @dataProvider providerFVSCHEDULE
*/ */
public function testFVSCHEDULE() public function testFVSCHEDULE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','FVSCHEDULE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','FVSCHEDULE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerFVSCHEDULE() public function providerFVSCHEDULE()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/FVSCHEDULE.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/FVSCHEDULE.data');
} }
/** /**
* @dataProvider providerINTRATE * @dataProvider providerINTRATE
*/ */
public function testINTRATE() public function testINTRATE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','INTRATE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','INTRATE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerINTRATE() public function providerINTRATE()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/INTRATE.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/INTRATE.data');
} }
/** /**
* @dataProvider providerIPMT * @dataProvider providerIPMT
*/ */
public function testIPMT() public function testIPMT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','IPMT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','IPMT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIPMT() public function providerIPMT()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/IPMT.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/IPMT.data');
} }
/** /**
* @dataProvider providerIRR * @dataProvider providerIRR
*/ */
public function testIRR() public function testIRR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','IRR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','IRR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIRR() public function providerIRR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/IRR.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/IRR.data');
} }
/** /**
* @dataProvider providerISPMT * @dataProvider providerISPMT
*/ */
public function testISPMT() public function testISPMT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','ISPMT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','ISPMT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerISPMT() public function providerISPMT()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/ISPMT.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/ISPMT.data');
} }
/** /**
* @dataProvider providerMIRR * @dataProvider providerMIRR
*/ */
public function testMIRR() public function testMIRR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','MIRR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','MIRR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerMIRR() public function providerMIRR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/MIRR.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/MIRR.data');
} }
/** /**
* @dataProvider providerNOMINAL * @dataProvider providerNOMINAL
*/ */
public function testNOMINAL() public function testNOMINAL()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NOMINAL'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','NOMINAL'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerNOMINAL() public function providerNOMINAL()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/NOMINAL.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/NOMINAL.data');
} }
/** /**
* @dataProvider providerNPER * @dataProvider providerNPER
*/ */
public function testNPER() public function testNPER()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPER'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPER'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerNPER() public function providerNPER()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/NPER.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/NPER.data');
} }
/** /**
* @dataProvider providerNPV * @dataProvider providerNPV
*/ */
public function testNPV() public function testNPV()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPV'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPV'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerNPV() public function providerNPV()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/NPV.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/NPV.data');
} }
/** /**
* @dataProvider providerPRICE * @dataProvider providerPRICE
*/ */
public function testPRICE() public function testPRICE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','PRICE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','PRICE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerPRICE() public function providerPRICE()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/PRICE.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/PRICE.data');
} }
/** /**
* @dataProvider providerRATE * @dataProvider providerRATE
*/ */
public function testRATE() public function testRATE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','RATE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','RATE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerRATE() public function providerRATE()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/RATE.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/RATE.data');
} }
/** /**
* @dataProvider providerXIRR * @dataProvider providerXIRR
*/ */
public function testXIRR() public function testXIRR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Financial','XIRR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Financial','XIRR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerXIRR() public function providerXIRR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Financial/XIRR.data'); return new testDataFileIterator('rawTestData/Calculation/Financial/XIRR.data');
} }
} }

View File

@ -8,269 +8,267 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
} }
public function testDUMMY() public function testDUMMY()
{ {
$result = PHPExcel_Calculation_Functions::DUMMY(); $result = PHPExcel_Calculation_Functions::DUMMY();
$this->assertEquals('#Not Yet Implemented', $result); $this->assertEquals('#Not Yet Implemented', $result);
} }
public function testDIV0() public function testDIV0()
{ {
$result = PHPExcel_Calculation_Functions::DIV0(); $result = PHPExcel_Calculation_Functions::DIV0();
$this->assertEquals('#DIV/0!', $result); $this->assertEquals('#DIV/0!', $result);
} }
public function testNA() public function testNA()
{ {
$result = PHPExcel_Calculation_Functions::NA(); $result = PHPExcel_Calculation_Functions::NA();
$this->assertEquals('#N/A', $result); $this->assertEquals('#N/A', $result);
} }
public function testNaN() public function testNaN()
{ {
$result = PHPExcel_Calculation_Functions::NaN(); $result = PHPExcel_Calculation_Functions::NaN();
$this->assertEquals('#NUM!', $result); $this->assertEquals('#NUM!', $result);
} }
public function testNAME() public function testNAME()
{ {
$result = PHPExcel_Calculation_Functions::NAME(); $result = PHPExcel_Calculation_Functions::NAME();
$this->assertEquals('#NAME?', $result); $this->assertEquals('#NAME?', $result);
} }
public function testREF() public function testREF()
{ {
$result = PHPExcel_Calculation_Functions::REF(); $result = PHPExcel_Calculation_Functions::REF();
$this->assertEquals('#REF!', $result); $this->assertEquals('#REF!', $result);
} }
public function testNULL() public function testNULL()
{ {
$result = PHPExcel_Calculation_Functions::NULL(); $result = PHPExcel_Calculation_Functions::null();
$this->assertEquals('#NULL!', $result); $this->assertEquals('#NULL!', $result);
} }
public function testVALUE() public function testVALUE()
{ {
$result = PHPExcel_Calculation_Functions::VALUE(); $result = PHPExcel_Calculation_Functions::VALUE();
$this->assertEquals('#VALUE!', $result); $this->assertEquals('#VALUE!', $result);
} }
/** /**
* @dataProvider providerIS_BLANK * @dataProvider providerIS_BLANK
*/ */
public function testIS_BLANK() public function testIS_BLANK()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_BLANK'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_BLANK'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_BLANK() public function providerIS_BLANK()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_BLANK.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/IS_BLANK.data');
} }
/** /**
* @dataProvider providerIS_ERR * @dataProvider providerIS_ERR
*/ */
public function testIS_ERR() public function testIS_ERR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_ERR() public function providerIS_ERR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_ERR.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/IS_ERR.data');
} }
/** /**
* @dataProvider providerIS_ERROR * @dataProvider providerIS_ERROR
*/ */
public function testIS_ERROR() public function testIS_ERROR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERROR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERROR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_ERROR() public function providerIS_ERROR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_ERROR.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/IS_ERROR.data');
} }
/** /**
* @dataProvider providerERROR_TYPE * @dataProvider providerERROR_TYPE
*/ */
public function testERROR_TYPE() public function testERROR_TYPE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','ERROR_TYPE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','ERROR_TYPE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerERROR_TYPE() public function providerERROR_TYPE()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/ERROR_TYPE.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/ERROR_TYPE.data');
} }
/** /**
* @dataProvider providerIS_LOGICAL * @dataProvider providerIS_LOGICAL
*/ */
public function testIS_LOGICAL() public function testIS_LOGICAL()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_LOGICAL'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_LOGICAL'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_LOGICAL() public function providerIS_LOGICAL()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_LOGICAL.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/IS_LOGICAL.data');
} }
/** /**
* @dataProvider providerIS_NA * @dataProvider providerIS_NA
*/ */
public function testIS_NA() public function testIS_NA()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NA'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NA'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_NA() public function providerIS_NA()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_NA.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/IS_NA.data');
} }
/** /**
* @dataProvider providerIS_NUMBER * @dataProvider providerIS_NUMBER
*/ */
public function testIS_NUMBER() public function testIS_NUMBER()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NUMBER'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NUMBER'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_NUMBER() public function providerIS_NUMBER()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_NUMBER.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/IS_NUMBER.data');
} }
/** /**
* @dataProvider providerIS_TEXT * @dataProvider providerIS_TEXT
*/ */
public function testIS_TEXT() public function testIS_TEXT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_TEXT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_TEXT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_TEXT() public function providerIS_TEXT()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_TEXT.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/IS_TEXT.data');
} }
/** /**
* @dataProvider providerIS_NONTEXT * @dataProvider providerIS_NONTEXT
*/ */
public function testIS_NONTEXT() public function testIS_NONTEXT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NONTEXT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NONTEXT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_NONTEXT() public function providerIS_NONTEXT()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_NONTEXT.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/IS_NONTEXT.data');
} }
/** /**
* @dataProvider providerIS_EVEN * @dataProvider providerIS_EVEN
*/ */
public function testIS_EVEN() public function testIS_EVEN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_EVEN'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_EVEN'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_EVEN() public function providerIS_EVEN()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_EVEN.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/IS_EVEN.data');
} }
/** /**
* @dataProvider providerIS_ODD * @dataProvider providerIS_ODD
*/ */
public function testIS_ODD() public function testIS_ODD()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ODD'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ODD'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerIS_ODD() public function providerIS_ODD()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/IS_ODD.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/IS_ODD.data');
} }
/** /**
* @dataProvider providerTYPE * @dataProvider providerTYPE
*/ */
public function testTYPE() public function testTYPE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','TYPE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','TYPE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerTYPE() public function providerTYPE()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/TYPE.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/TYPE.data');
} }
/** /**
* @dataProvider providerN * @dataProvider providerN
*/ */
public function testN() public function testN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Functions','N'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Functions','N'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerN() public function providerN()
{ {
return new testDataFileIterator('rawTestData/Calculation/Functions/N.data'); return new testDataFileIterator('rawTestData/Calculation/Functions/N.data');
} }
} }

View File

@ -8,105 +8,103 @@ class LogicalTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
} }
public function testTRUE() public function testTRUE()
{ {
$result = PHPExcel_Calculation_Logical::TRUE(); $result = PHPExcel_Calculation_Logical::TRUE();
$this->assertEquals(TRUE, $result); $this->assertEquals(true, $result);
} }
public function testFALSE() public function testFALSE()
{ {
$result = PHPExcel_Calculation_Logical::FALSE(); $result = PHPExcel_Calculation_Logical::FALSE();
$this->assertEquals(FALSE, $result); $this->assertEquals(false, $result);
} }
/** /**
* @dataProvider providerAND * @dataProvider providerAND
*/ */
public function testAND() public function testAND()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_AND'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_AND'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerAND() public function providerAND()
{ {
return new testDataFileIterator('rawTestData/Calculation/Logical/AND.data'); return new testDataFileIterator('rawTestData/Calculation/Logical/AND.data');
} }
/** /**
* @dataProvider providerOR * @dataProvider providerOR
*/ */
public function testOR() public function testOR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_OR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_OR'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerOR() public function providerOR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Logical/OR.data'); return new testDataFileIterator('rawTestData/Calculation/Logical/OR.data');
} }
/** /**
* @dataProvider providerNOT * @dataProvider providerNOT
*/ */
public function testNOT() public function testNOT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','NOT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Logical','NOT'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerNOT() public function providerNOT()
{ {
return new testDataFileIterator('rawTestData/Calculation/Logical/NOT.data'); return new testDataFileIterator('rawTestData/Calculation/Logical/NOT.data');
} }
/** /**
* @dataProvider providerIF * @dataProvider providerIF
*/ */
public function testIF() public function testIF()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','STATEMENT_IF'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Logical','STATEMENT_IF'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerIF() public function providerIF()
{ {
return new testDataFileIterator('rawTestData/Calculation/Logical/IF.data'); return new testDataFileIterator('rawTestData/Calculation/Logical/IF.data');
} }
/** /**
* @dataProvider providerIFERROR * @dataProvider providerIFERROR
*/ */
public function testIFERROR() public function testIFERROR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Logical','IFERROR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_Logical','IFERROR'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerIFERROR() public function providerIFERROR()
{ {
return new testDataFileIterator('rawTestData/Calculation/Logical/IFERROR.data'); return new testDataFileIterator('rawTestData/Calculation/Logical/IFERROR.data');
} }
} }

View File

@ -8,45 +8,43 @@ class LookupRefTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
} }
/** /**
* @dataProvider providerHLOOKUP * @dataProvider providerHLOOKUP
*/ */
public function testHLOOKUP() public function testHLOOKUP()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','HLOOKUP'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','HLOOKUP'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerHLOOKUP() public function providerHLOOKUP()
{ {
return new testDataFileIterator('rawTestData/Calculation/LookupRef/HLOOKUP.data'); return new testDataFileIterator('rawTestData/Calculation/LookupRef/HLOOKUP.data');
} }
/** /**
* @dataProvider providerVLOOKUP * @dataProvider providerVLOOKUP
*/ */
public function testVLOOKUP() public function testVLOOKUP()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','VLOOKUP'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','VLOOKUP'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerVLOOKUP() public function providerVLOOKUP()
{ {
return new testDataFileIterator('rawTestData/Calculation/LookupRef/VLOOKUP.data'); return new testDataFileIterator('rawTestData/Calculation/LookupRef/VLOOKUP.data');
} }
} }

View File

@ -8,479 +8,478 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
} }
/** /**
* @dataProvider providerATAN2 * @dataProvider providerATAN2
*/ */
public function testATAN2() public function testATAN2()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ATAN2'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ATAN2'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerATAN2() public function providerATAN2()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ATAN2.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/ATAN2.data');
} }
/** /**
* @dataProvider providerCEILING * @dataProvider providerCEILING
*/ */
public function testCEILING() public function testCEILING()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','CEILING'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','CEILING'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerCEILING() public function providerCEILING()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/CEILING.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/CEILING.data');
} }
/** /**
* @dataProvider providerCOMBIN * @dataProvider providerCOMBIN
*/ */
public function testCOMBIN() public function testCOMBIN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','COMBIN'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','COMBIN'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerCOMBIN() public function providerCOMBIN()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/COMBIN.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/COMBIN.data');
} }
/** /**
* @dataProvider providerEVEN * @dataProvider providerEVEN
*/ */
public function testEVEN() public function testEVEN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','EVEN'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','EVEN'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerEVEN() public function providerEVEN()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/EVEN.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/EVEN.data');
} }
/** /**
* @dataProvider providerODD * @dataProvider providerODD
*/ */
public function testODD() public function testODD()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ODD'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ODD'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerODD() public function providerODD()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ODD.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/ODD.data');
} }
/** /**
* @dataProvider providerFACT * @dataProvider providerFACT
*/ */
public function testFACT() public function testFACT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerFACT() public function providerFACT()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/FACT.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/FACT.data');
} }
/** /**
* @dataProvider providerFACTDOUBLE * @dataProvider providerFACTDOUBLE
*/ */
public function testFACTDOUBLE() public function testFACTDOUBLE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACTDOUBLE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACTDOUBLE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerFACTDOUBLE() public function providerFACTDOUBLE()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/FACTDOUBLE.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/FACTDOUBLE.data');
} }
/** /**
* @dataProvider providerFLOOR * @dataProvider providerFLOOR
*/ */
public function testFLOOR() public function testFLOOR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FLOOR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FLOOR'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerFLOOR() public function providerFLOOR()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/FLOOR.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/FLOOR.data');
} }
/** /**
* @dataProvider providerGCD * @dataProvider providerGCD
*/ */
public function testGCD() public function testGCD()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','GCD'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','GCD'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerGCD() public function providerGCD()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/GCD.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/GCD.data');
} }
/** /**
* @dataProvider providerLCM * @dataProvider providerLCM
*/ */
public function testLCM() public function testLCM()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LCM'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LCM'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerLCM() public function providerLCM()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/LCM.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/LCM.data');
} }
/** /**
* @dataProvider providerINT * @dataProvider providerINT
*/ */
public function testINT() public function testINT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','INT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','INT'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerINT() public function providerINT()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/INT.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/INT.data');
} }
/** /**
* @dataProvider providerSIGN * @dataProvider providerSIGN
*/ */
public function testSIGN() public function testSIGN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SIGN'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SIGN'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerSIGN() public function providerSIGN()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SIGN.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/SIGN.data');
} }
/** /**
* @dataProvider providerPOWER * @dataProvider providerPOWER
*/ */
public function testPOWER() public function testPOWER()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','POWER'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','POWER'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerPOWER() public function providerPOWER()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/POWER.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/POWER.data');
} }
/** /**
* @dataProvider providerLOG * @dataProvider providerLOG
*/ */
public function testLOG() public function testLOG()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LOG_BASE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LOG_BASE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerLOG() public function providerLOG()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/LOG.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/LOG.data');
} }
/** /**
* @dataProvider providerMOD * @dataProvider providerMOD
*/ */
public function testMOD() public function testMOD()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MOD'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MOD'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMOD() public function providerMOD()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MOD.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/MOD.data');
} }
/** /**
* @dataProvider providerMDETERM * @dataProvider providerMDETERM
*/ */
public function testMDETERM() public function testMDETERM()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MDETERM'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MDETERM'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMDETERM() public function providerMDETERM()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MDETERM.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/MDETERM.data');
} }
/** /**
* @dataProvider providerMINVERSE * @dataProvider providerMINVERSE
*/ */
public function testMINVERSE() public function testMINVERSE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MINVERSE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MINVERSE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMINVERSE() public function providerMINVERSE()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MINVERSE.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/MINVERSE.data');
} }
/** /**
* @dataProvider providerMMULT * @dataProvider providerMMULT
*/ */
public function testMMULT() public function testMMULT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MMULT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MMULT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMMULT() public function providerMMULT()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MMULT.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/MMULT.data');
} }
/** /**
* @dataProvider providerMULTINOMIAL * @dataProvider providerMULTINOMIAL
*/ */
public function testMULTINOMIAL() public function testMULTINOMIAL()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MULTINOMIAL'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MULTINOMIAL'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMULTINOMIAL() public function providerMULTINOMIAL()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MULTINOMIAL.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/MULTINOMIAL.data');
} }
/** /**
* @dataProvider providerMROUND * @dataProvider providerMROUND
*/ */
public function testMROUND() public function testMROUND()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MROUND'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MROUND'), $args);
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_ARRAY); PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_ARRAY);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerMROUND() public function providerMROUND()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/MROUND.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/MROUND.data');
} }
/** /**
* @dataProvider providerPRODUCT * @dataProvider providerPRODUCT
*/ */
public function testPRODUCT() public function testPRODUCT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','PRODUCT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','PRODUCT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerPRODUCT() public function providerPRODUCT()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/PRODUCT.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/PRODUCT.data');
} }
/** /**
* @dataProvider providerQUOTIENT * @dataProvider providerQUOTIENT
*/ */
public function testQUOTIENT() public function testQUOTIENT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','QUOTIENT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','QUOTIENT'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerQUOTIENT() public function providerQUOTIENT()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/QUOTIENT.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/QUOTIENT.data');
} }
/** /**
* @dataProvider providerROUNDUP * @dataProvider providerROUNDUP
*/ */
public function testROUNDUP() public function testROUNDUP()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDUP'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDUP'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerROUNDUP() public function providerROUNDUP()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROUNDUP.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROUNDUP.data');
} }
/** /**
* @dataProvider providerROUNDDOWN * @dataProvider providerROUNDDOWN
*/ */
public function testROUNDDOWN() public function testROUNDDOWN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDDOWN'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDDOWN'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerROUNDDOWN() public function providerROUNDDOWN()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROUNDDOWN.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROUNDDOWN.data');
} }
/** /**
* @dataProvider providerSERIESSUM * @dataProvider providerSERIESSUM
*/ */
public function testSERIESSUM() public function testSERIESSUM()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SERIESSUM'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SERIESSUM'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerSERIESSUM() public function providerSERIESSUM()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SERIESSUM.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/SERIESSUM.data');
} }
/** /**
* @dataProvider providerSUMSQ * @dataProvider providerSUMSQ
*/ */
public function testSUMSQ() public function testSUMSQ()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SUMSQ'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SUMSQ'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerSUMSQ() public function providerSUMSQ()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SUMSQ.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/SUMSQ.data');
} }
/** /**
* @dataProvider providerTRUNC * @dataProvider providerTRUNC
*/ */
public function testTRUNC() public function testTRUNC()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','TRUNC'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','TRUNC'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerTRUNC() public function providerTRUNC()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/TRUNC.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/TRUNC.data');
} }
/** /**
* @dataProvider providerROMAN * @dataProvider providerROMAN
*/ */
public function testROMAN() public function testROMAN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROMAN'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROMAN'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerROMAN() public function providerROMAN()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROMAN.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROMAN.data');
} }
/** /**
* @dataProvider providerSQRTPI * @dataProvider providerSQRTPI
*/ */
public function testSQRTPI() public function testSQRTPI()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SQRTPI'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SQRTPI'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerSQRTPI() public function providerSQRTPI()
{ {
return new testDataFileIterator('rawTestData/Calculation/MathTrig/SQRTPI.data'); return new testDataFileIterator('rawTestData/Calculation/MathTrig/SQRTPI.data');
} }
/** /**
@ -491,7 +490,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_MathTrig', 'SUMIF'), $args); $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig', 'SUMIF'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12); $this->assertEquals($expectedResult, $result, null, 1E-12);
} }
public function providerSUMIF() public function providerSUMIF()
@ -555,6 +554,5 @@ class MathTrigTest extends PHPUnit_Framework_TestCase
100 100
), ),
); );
} }
} }

View File

@ -8,358 +8,356 @@ class TextDataTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
} }
/** /**
* @dataProvider providerCHAR * @dataProvider providerCHAR
*/ */
public function testCHAR() public function testCHAR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','CHARACTER'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','CHARACTER'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerCHAR() public function providerCHAR()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/CHAR.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/CHAR.data');
} }
/** /**
* @dataProvider providerCODE * @dataProvider providerCODE
*/ */
public function testCODE() public function testCODE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','ASCIICODE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','ASCIICODE'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerCODE() public function providerCODE()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/CODE.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/CODE.data');
} }
/** /**
* @dataProvider providerCONCATENATE * @dataProvider providerCONCATENATE
*/ */
public function testCONCATENATE() public function testCONCATENATE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','CONCATENATE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','CONCATENATE'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerCONCATENATE() public function providerCONCATENATE()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/CONCATENATE.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/CONCATENATE.data');
} }
/** /**
* @dataProvider providerLEFT * @dataProvider providerLEFT
*/ */
public function testLEFT() public function testLEFT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','LEFT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','LEFT'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerLEFT() public function providerLEFT()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/LEFT.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/LEFT.data');
} }
/** /**
* @dataProvider providerMID * @dataProvider providerMID
*/ */
public function testMID() public function testMID()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','MID'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','MID'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerMID() public function providerMID()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/MID.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/MID.data');
} }
/** /**
* @dataProvider providerRIGHT * @dataProvider providerRIGHT
*/ */
public function testRIGHT() public function testRIGHT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','RIGHT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','RIGHT'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerRIGHT() public function providerRIGHT()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/RIGHT.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/RIGHT.data');
} }
/** /**
* @dataProvider providerLOWER * @dataProvider providerLOWER
*/ */
public function testLOWER() public function testLOWER()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','LOWERCASE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','LOWERCASE'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerLOWER() public function providerLOWER()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/LOWER.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/LOWER.data');
} }
/** /**
* @dataProvider providerUPPER * @dataProvider providerUPPER
*/ */
public function testUPPER() public function testUPPER()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','UPPERCASE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','UPPERCASE'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerUPPER() public function providerUPPER()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/UPPER.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/UPPER.data');
} }
/** /**
* @dataProvider providerPROPER * @dataProvider providerPROPER
*/ */
public function testPROPER() public function testPROPER()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','PROPERCASE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','PROPERCASE'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerPROPER() public function providerPROPER()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/PROPER.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/PROPER.data');
} }
/** /**
* @dataProvider providerLEN * @dataProvider providerLEN
*/ */
public function testLEN() public function testLEN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','STRINGLENGTH'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','STRINGLENGTH'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerLEN() public function providerLEN()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/LEN.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/LEN.data');
} }
/** /**
* @dataProvider providerSEARCH * @dataProvider providerSEARCH
*/ */
public function testSEARCH() public function testSEARCH()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHINSENSITIVE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHINSENSITIVE'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerSEARCH() public function providerSEARCH()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/SEARCH.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/SEARCH.data');
} }
/** /**
* @dataProvider providerFIND * @dataProvider providerFIND
*/ */
public function testFIND() public function testFIND()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHSENSITIVE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHSENSITIVE'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerFIND() public function providerFIND()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/FIND.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/FIND.data');
} }
/** /**
* @dataProvider providerREPLACE * @dataProvider providerREPLACE
*/ */
public function testREPLACE() public function testREPLACE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','REPLACE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','REPLACE'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerREPLACE() public function providerREPLACE()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/REPLACE.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/REPLACE.data');
} }
/** /**
* @dataProvider providerSUBSTITUTE * @dataProvider providerSUBSTITUTE
*/ */
public function testSUBSTITUTE() public function testSUBSTITUTE()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','SUBSTITUTE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','SUBSTITUTE'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerSUBSTITUTE() public function providerSUBSTITUTE()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/SUBSTITUTE.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/SUBSTITUTE.data');
} }
/** /**
* @dataProvider providerTRIM * @dataProvider providerTRIM
*/ */
public function testTRIM() public function testTRIM()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMSPACES'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMSPACES'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerTRIM() public function providerTRIM()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/TRIM.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/TRIM.data');
} }
/** /**
* @dataProvider providerCLEAN * @dataProvider providerCLEAN
*/ */
public function testCLEAN() public function testCLEAN()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMNONPRINTABLE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMNONPRINTABLE'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerCLEAN() public function providerCLEAN()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/CLEAN.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/CLEAN.data');
} }
/** /**
* @dataProvider providerDOLLAR * @dataProvider providerDOLLAR
*/ */
public function testDOLLAR() public function testDOLLAR()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','DOLLAR'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','DOLLAR'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerDOLLAR() public function providerDOLLAR()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/DOLLAR.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/DOLLAR.data');
} }
/** /**
* @dataProvider providerFIXED * @dataProvider providerFIXED
*/ */
public function testFIXED() public function testFIXED()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','FIXEDFORMAT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','FIXEDFORMAT'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerFIXED() public function providerFIXED()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/FIXED.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/FIXED.data');
} }
/** /**
* @dataProvider providerT * @dataProvider providerT
*/ */
public function testT() public function testT()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','RETURNSTRING'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData','RETURNSTRING'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerT() public function providerT()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/T.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/T.data');
} }
/** /**
* @dataProvider providerTEXT * @dataProvider providerTEXT
*/ */
public function testTEXT() public function testTEXT()
{ {
// Enforce decimal and thousands separator values to UK/US, and currency code to USD // Enforce decimal and thousands separator values to UK/US, and currency code to USD
call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),'.'); call_user_func(array('PHPExcel_Shared_String', 'setDecimalSeparator'), '.');
call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),','); call_user_func(array('PHPExcel_Shared_String', 'setThousandsSeparator'), ',');
call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$'); call_user_func(array('PHPExcel_Shared_String', 'setCurrencyCode'), '$');
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TEXTFORMAT'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData', 'TEXTFORMAT'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerTEXT() public function providerTEXT()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/TEXT.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/TEXT.data');
} }
/** /**
* @dataProvider providerVALUE * @dataProvider providerVALUE
*/ */
public function testVALUE() public function testVALUE()
{ {
call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),'.'); call_user_func(array('PHPExcel_Shared_String', 'setDecimalSeparator'), '.');
call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),' '); call_user_func(array('PHPExcel_Shared_String', 'setThousandsSeparator'), ' ');
call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$'); call_user_func(array('PHPExcel_Shared_String', 'setCurrencyCode'), '$');
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','VALUE'),$args); $result = call_user_func_array(array('PHPExcel_Calculation_TextData', 'VALUE'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8); $this->assertEquals($expectedResult, $result, null, 1E-8);
} }
public function providerVALUE() public function providerVALUE()
{ {
return new testDataFileIterator('rawTestData/Calculation/TextData/VALUE.data'); return new testDataFileIterator('rawTestData/Calculation/TextData/VALUE.data');
} }
} }

View File

@ -4,7 +4,6 @@ require_once 'testDataFileIterator.php';
class CalculationTest extends PHPUnit_Framework_TestCase class CalculationTest extends PHPUnit_Framework_TestCase
{ {
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) { if (!defined('PHPEXCEL_ROOT')) {
@ -33,5 +32,4 @@ class CalculationTest extends PHPUnit_Framework_TestCase
{ {
return new testDataFileIterator('rawTestData/CalculationBinaryComparisonOperation.data'); return new testDataFileIterator('rawTestData/CalculationBinaryComparisonOperation.data');
} }
} }

View File

@ -13,20 +13,20 @@ class AdvancedValueBinderTest extends PHPUnit_Framework_TestCase
public function provider() public function provider()
{ {
if (!class_exists('PHPExcel_Style_NumberFormat')) { if (!class_exists('PHPExcel_Style_NumberFormat')) {
$this->setUp(); $this->setUp();
} }
$currencyUSD = PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE; $currencyUSD = PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
$currencyEURO = str_replace('$', '€', PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); $currencyEURO = str_replace('$', '€', PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
return array( return array(
array('10%', 0.1, PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00, ',', '.', '$'), array('10%', 0.1, PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00, ',', '.', '$'),
array('$10.11', 10.11, $currencyUSD, ',', '.', '$'), array('$10.11', 10.11, $currencyUSD, ',', '.', '$'),
array('$1,010.12', 1010.12, $currencyUSD, ',', '.', '$'), array('$1,010.12', 1010.12, $currencyUSD, ',', '.', '$'),
array('$20,20', 20.2, $currencyUSD, '.', ',', '$'), array('$20,20', 20.2, $currencyUSD, '.', ',', '$'),
array('$2.020,20', 2020.2, $currencyUSD, '.', ',', '$'), array('$2.020,20', 2020.2, $currencyUSD, '.', ',', '$'),
array('€2.020,20', 2020.2, $currencyEURO, '.', ',', '€'), array('€2.020,20', 2020.2, $currencyEURO, '.', ',', '€'),
array('€ 2.020,20', 2020.2, $currencyEURO, '.', ',', '€'), array('€ 2.020,20', 2020.2, $currencyEURO, '.', ',', '€'),
array('€2,020.22', 2020.22, $currencyEURO, ',', '.', '€'), array('€2,020.22', 2020.22, $currencyEURO, ',', '.', '€'),
); );
} }
@ -36,12 +36,12 @@ class AdvancedValueBinderTest extends PHPUnit_Framework_TestCase
public function testCurrency($value, $valueBinded, $format, $thousandsSeparator, $decimalSeparator, $currencyCode) public function testCurrency($value, $valueBinded, $format, $thousandsSeparator, $decimalSeparator, $currencyCode)
{ {
$sheet = $this->getMock( $sheet = $this->getMock(
'PHPExcel_Worksheet', 'PHPExcel_Worksheet',
array('getStyle', 'getNumberFormat', 'setFormatCode','getCellCacheController') array('getStyle', 'getNumberFormat', 'setFormatCode','getCellCacheController')
); );
$cache = $this->getMockBuilder('PHPExcel_CachedObjectStorage_Memory') $cache = $this->getMockBuilder('PHPExcel_CachedObjectStorage_Memory')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$cache->expects($this->any()) $cache->expects($this->any())
->method('getParent') ->method('getParent')
->will($this->returnValue($sheet)); ->will($this->returnValue($sheet));
@ -64,7 +64,7 @@ class AdvancedValueBinderTest extends PHPUnit_Framework_TestCase
PHPExcel_Shared_String::setDecimalSeparator($decimalSeparator); PHPExcel_Shared_String::setDecimalSeparator($decimalSeparator);
PHPExcel_Shared_String::setThousandsSeparator($thousandsSeparator); PHPExcel_Shared_String::setThousandsSeparator($thousandsSeparator);
$cell = new PHPExcel_Cell(NULL, PHPExcel_Cell_DataType::TYPE_STRING, $sheet); $cell = new PHPExcel_Cell(null, PHPExcel_Cell_DataType::TYPE_STRING, $sheet);
$binder = new PHPExcel_Cell_AdvancedValueBinder(); $binder = new PHPExcel_Cell_AdvancedValueBinder();
$binder->bindValue($cell, $value); $binder->bindValue($cell, $value);

View File

@ -6,19 +6,17 @@ class DataTypeTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testGetErrorCodes()
{
$result = call_user_func(array('PHPExcel_Cell_DataType','getErrorCodes'));
$this->assertInternalType('array', $result);
$this->assertGreaterThan(0, count($result));
$this->assertArrayHasKey('#NULL!', $result);
}
public function testGetErrorCodes()
{
$result = call_user_func(array('PHPExcel_Cell_DataType','getErrorCodes'));
$this->assertInternalType('array', $result);
$this->assertGreaterThan(0, count($result));
$this->assertArrayHasKey('#NULL!', $result);
}
} }

View File

@ -8,12 +8,11 @@ class DefaultValueBinderTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
protected function createCellStub() protected function createCellStub()
{ {
@ -32,12 +31,12 @@ class DefaultValueBinderTest extends PHPUnit_Framework_TestCase
* @dataProvider binderProvider * @dataProvider binderProvider
*/ */
public function testBindValue($value) public function testBindValue($value)
{ {
$this->createCellStub(); $this->createCellStub();
$binder = new PHPExcel_Cell_DefaultValueBinder(); $binder = new PHPExcel_Cell_DefaultValueBinder();
$result = $binder->bindValue($this->cellStub, $value); $result = $binder->bindValue($this->cellStub, $value);
$this->assertTrue($result); $this->assertTrue($result);
} }
public function binderProvider() public function binderProvider()
{ {
@ -60,26 +59,26 @@ class DefaultValueBinderTest extends PHPUnit_Framework_TestCase
/** /**
* @dataProvider providerDataTypeForValue * @dataProvider providerDataTypeForValue
*/ */
public function testDataTypeForValue() public function testDataTypeForValue()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell_DefaultValueBinder','dataTypeForValue'), $args); $result = call_user_func_array(array('PHPExcel_Cell_DefaultValueBinder','dataTypeForValue'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerDataTypeForValue() public function providerDataTypeForValue()
{ {
return new testDataFileIterator('rawTestData/Cell/DefaultValueBinder.data'); return new testDataFileIterator('rawTestData/Cell/DefaultValueBinder.data');
} }
public function testDataTypeForRichTextObject() public function testDataTypeForRichTextObject()
{ {
$objRichText = new PHPExcel_RichText(); $objRichText = new PHPExcel_RichText();
$objRichText->createText('Hello World'); $objRichText->createText('Hello World');
$expectedResult = PHPExcel_Cell_DataType::TYPE_INLINE; $expectedResult = PHPExcel_Cell_DataType::TYPE_INLINE;
$result = call_user_func(array('PHPExcel_Cell_DefaultValueBinder','dataTypeForValue'), $objRichText); $result = call_user_func(array('PHPExcel_Cell_DefaultValueBinder','dataTypeForValue'), $objRichText);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
} }

View File

@ -6,83 +6,81 @@ class HyperlinkTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testGetUrl() public function testGetUrl()
{ {
$urlValue = 'http://www.phpexcel.net'; $urlValue = 'http://www.phpexcel.net';
$testInstance = new PHPExcel_Cell_Hyperlink($urlValue); $testInstance = new PHPExcel_Cell_Hyperlink($urlValue);
$result = $testInstance->getUrl(); $result = $testInstance->getUrl();
$this->assertEquals($urlValue,$result); $this->assertEquals($urlValue, $result);
} }
public function testSetUrl() public function testSetUrl()
{ {
$initialUrlValue = 'http://www.phpexcel.net'; $initialUrlValue = 'http://www.phpexcel.net';
$newUrlValue = 'http://github.com/PHPOffice/PHPExcel'; $newUrlValue = 'http://github.com/PHPOffice/PHPExcel';
$testInstance = new PHPExcel_Cell_Hyperlink($initialUrlValue); $testInstance = new PHPExcel_Cell_Hyperlink($initialUrlValue);
$result = $testInstance->setUrl($newUrlValue); $result = $testInstance->setUrl($newUrlValue);
$this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink); $this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink);
$result = $testInstance->getUrl(); $result = $testInstance->getUrl();
$this->assertEquals($newUrlValue,$result); $this->assertEquals($newUrlValue, $result);
} }
public function testGetTooltip() public function testGetTooltip()
{ {
$tooltipValue = 'PHPExcel Web Site'; $tooltipValue = 'PHPExcel Web Site';
$testInstance = new PHPExcel_Cell_Hyperlink(NULL, $tooltipValue); $testInstance = new PHPExcel_Cell_Hyperlink(null, $tooltipValue);
$result = $testInstance->getTooltip(); $result = $testInstance->getTooltip();
$this->assertEquals($tooltipValue,$result); $this->assertEquals($tooltipValue, $result);
} }
public function testSetTooltip() public function testSetTooltip()
{ {
$initialTooltipValue = 'PHPExcel Web Site'; $initialTooltipValue = 'PHPExcel Web Site';
$newTooltipValue = 'PHPExcel Repository on Github'; $newTooltipValue = 'PHPExcel Repository on Github';
$testInstance = new PHPExcel_Cell_Hyperlink(NULL, $initialTooltipValue); $testInstance = new PHPExcel_Cell_Hyperlink(null, $initialTooltipValue);
$result = $testInstance->setTooltip($newTooltipValue); $result = $testInstance->setTooltip($newTooltipValue);
$this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink); $this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink);
$result = $testInstance->getTooltip(); $result = $testInstance->getTooltip();
$this->assertEquals($newTooltipValue,$result); $this->assertEquals($newTooltipValue, $result);
} }
public function testIsInternal() public function testIsInternal()
{ {
$initialUrlValue = 'http://www.phpexcel.net'; $initialUrlValue = 'http://www.phpexcel.net';
$newUrlValue = 'sheet://Worksheet1!A1'; $newUrlValue = 'sheet://Worksheet1!A1';
$testInstance = new PHPExcel_Cell_Hyperlink($initialUrlValue); $testInstance = new PHPExcel_Cell_Hyperlink($initialUrlValue);
$result = $testInstance->isInternal(); $result = $testInstance->isInternal();
$this->assertFalse($result); $this->assertFalse($result);
$testInstance->setUrl($newUrlValue); $testInstance->setUrl($newUrlValue);
$result = $testInstance->isInternal(); $result = $testInstance->isInternal();
$this->assertTrue($result); $this->assertTrue($result);
} }
public function testGetHashCode() public function testGetHashCode()
{ {
$urlValue = 'http://www.phpexcel.net'; $urlValue = 'http://www.phpexcel.net';
$tooltipValue = 'PHPExcel Web Site'; $tooltipValue = 'PHPExcel Web Site';
$initialExpectedHash = 'd84d713aed1dbbc8a7c5af183d6c7dbb'; $initialExpectedHash = 'd84d713aed1dbbc8a7c5af183d6c7dbb';
$testInstance = new PHPExcel_Cell_Hyperlink($urlValue, $tooltipValue); $testInstance = new PHPExcel_Cell_Hyperlink($urlValue, $tooltipValue);
$result = $testInstance->getHashCode();
$this->assertEquals($initialExpectedHash,$result);
}
$result = $testInstance->getHashCode();
$this->assertEquals($initialExpectedHash, $result);
}
} }

View File

@ -12,284 +12,283 @@ class CellTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
/** /**
* @dataProvider providerColumnString * @dataProvider providerColumnString
*/ */
public function testColumnIndexFromString() public function testColumnIndexFromString()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','columnIndexFromString'),$args); $result = call_user_func_array(array('PHPExcel_Cell','columnIndexFromString'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerColumnString() public function providerColumnString()
{ {
return new testDataFileIterator('rawTestData/ColumnString.data'); return new testDataFileIterator('rawTestData/ColumnString.data');
} }
public function testColumnIndexFromStringTooLong() public function testColumnIndexFromStringTooLong()
{ {
$cellAddress = 'ABCD'; $cellAddress = 'ABCD';
try { try {
$result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'),$cellAddress); $result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'), $cellAddress);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Column string index can not be longer than 3 characters'); $this->assertEquals($e->getMessage(), 'Column string index can not be longer than 3 characters');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
public function testColumnIndexFromStringTooShort() public function testColumnIndexFromStringTooShort()
{ {
$cellAddress = ''; $cellAddress = '';
try { try {
$result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'),$cellAddress); $result = call_user_func(array('PHPExcel_Cell','columnIndexFromString'), $cellAddress);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Column string index can not be empty'); $this->assertEquals($e->getMessage(), 'Column string index can not be empty');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
/** /**
* @dataProvider providerColumnIndex * @dataProvider providerColumnIndex
*/ */
public function testStringFromColumnIndex() public function testStringFromColumnIndex()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','stringFromColumnIndex'),$args); $result = call_user_func_array(array('PHPExcel_Cell','stringFromColumnIndex'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerColumnIndex() public function providerColumnIndex()
{ {
return new testDataFileIterator('rawTestData/ColumnIndex.data'); return new testDataFileIterator('rawTestData/ColumnIndex.data');
} }
/** /**
* @dataProvider providerCoordinates * @dataProvider providerCoordinates
*/ */
public function testCoordinateFromString() public function testCoordinateFromString()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','coordinateFromString'),$args); $result = call_user_func_array(array('PHPExcel_Cell','coordinateFromString'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerCoordinates() public function providerCoordinates()
{ {
return new testDataFileIterator('rawTestData/CellCoordinates.data'); return new testDataFileIterator('rawTestData/CellCoordinates.data');
} }
public function testCoordinateFromStringWithRangeAddress() public function testCoordinateFromStringWithRangeAddress()
{ {
$cellAddress = 'A1:AI2012'; $cellAddress = 'A1:AI2012';
try { try {
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress); $result = call_user_func(array('PHPExcel_Cell','coordinateFromString'), $cellAddress);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells'); $this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
public function testCoordinateFromStringWithEmptyAddress() public function testCoordinateFromStringWithEmptyAddress()
{ {
$cellAddress = ''; $cellAddress = '';
try { try {
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress); $result = call_user_func(array('PHPExcel_Cell','coordinateFromString'), $cellAddress);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Cell coordinate can not be zero-length string'); $this->assertEquals($e->getMessage(), 'Cell coordinate can not be zero-length string');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
public function testCoordinateFromStringWithInvalidAddress() public function testCoordinateFromStringWithInvalidAddress()
{ {
$cellAddress = 'AI'; $cellAddress = 'AI';
try { try {
$result = call_user_func(array('PHPExcel_Cell','coordinateFromString'),$cellAddress); $result = call_user_func(array('PHPExcel_Cell','coordinateFromString'), $cellAddress);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Invalid cell coordinate '.$cellAddress); $this->assertEquals($e->getMessage(), 'Invalid cell coordinate '.$cellAddress);
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
/** /**
* @dataProvider providerAbsoluteCoordinates * @dataProvider providerAbsoluteCoordinates
*/ */
public function testAbsoluteCoordinateFromString() public function testAbsoluteCoordinateFromString()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','absoluteCoordinate'),$args); $result = call_user_func_array(array('PHPExcel_Cell','absoluteCoordinate'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerAbsoluteCoordinates() public function providerAbsoluteCoordinates()
{ {
return new testDataFileIterator('rawTestData/CellAbsoluteCoordinate.data'); return new testDataFileIterator('rawTestData/CellAbsoluteCoordinate.data');
} }
public function testAbsoluteCoordinateFromStringWithRangeAddress() public function testAbsoluteCoordinateFromStringWithRangeAddress()
{ {
$cellAddress = 'A1:AI2012'; $cellAddress = 'A1:AI2012';
try { try {
$result = call_user_func(array('PHPExcel_Cell','absoluteCoordinate'),$cellAddress); $result = call_user_func(array('PHPExcel_Cell','absoluteCoordinate'), $cellAddress);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells'); $this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
/** /**
* @dataProvider providerAbsoluteReferences * @dataProvider providerAbsoluteReferences
*/ */
public function testAbsoluteReferenceFromString() public function testAbsoluteReferenceFromString()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','absoluteReference'),$args); $result = call_user_func_array(array('PHPExcel_Cell','absoluteReference'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerAbsoluteReferences() public function providerAbsoluteReferences()
{ {
return new testDataFileIterator('rawTestData/CellAbsoluteReference.data'); return new testDataFileIterator('rawTestData/CellAbsoluteReference.data');
} }
public function testAbsoluteReferenceFromStringWithRangeAddress() public function testAbsoluteReferenceFromStringWithRangeAddress()
{ {
$cellAddress = 'A1:AI2012'; $cellAddress = 'A1:AI2012';
try { try {
$result = call_user_func(array('PHPExcel_Cell','absoluteReference'),$cellAddress); $result = call_user_func(array('PHPExcel_Cell','absoluteReference'), $cellAddress);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells'); $this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
/** /**
* @dataProvider providerSplitRange * @dataProvider providerSplitRange
*/ */
public function testSplitRange() public function testSplitRange()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','splitRange'),$args); $result = call_user_func_array(array('PHPExcel_Cell','splitRange'), $args);
foreach($result as $key => $split) { foreach ($result as $key => $split) {
if (!is_array($expectedResult[$key])) { if (!is_array($expectedResult[$key])) {
$this->assertEquals($expectedResult[$key], $split[0]); $this->assertEquals($expectedResult[$key], $split[0]);
} else { } else {
$this->assertEquals($expectedResult[$key], $split); $this->assertEquals($expectedResult[$key], $split);
} }
} }
} }
public function providerSplitRange() public function providerSplitRange()
{ {
return new testDataFileIterator('rawTestData/CellSplitRange.data'); return new testDataFileIterator('rawTestData/CellSplitRange.data');
} }
/** /**
* @dataProvider providerBuildRange * @dataProvider providerBuildRange
*/ */
public function testBuildRange() public function testBuildRange()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','buildRange'),$args); $result = call_user_func_array(array('PHPExcel_Cell','buildRange'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerBuildRange() public function providerBuildRange()
{ {
return new testDataFileIterator('rawTestData/CellBuildRange.data'); return new testDataFileIterator('rawTestData/CellBuildRange.data');
} }
public function testBuildRangeInvalid() public function testBuildRangeInvalid()
{ {
$cellRange = ''; $cellRange = '';
try { try {
$result = call_user_func(array('PHPExcel_Cell','buildRange'),$cellRange); $result = call_user_func(array('PHPExcel_Cell','buildRange'), $cellRange);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$this->assertEquals($e->getMessage(), 'Range does not contain any information'); $this->assertEquals($e->getMessage(), 'Range does not contain any information');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
/** /**
* @dataProvider providerRangeBoundaries * @dataProvider providerRangeBoundaries
*/ */
public function testRangeBoundaries() public function testRangeBoundaries()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','rangeBoundaries'),$args); $result = call_user_func_array(array('PHPExcel_Cell','rangeBoundaries'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerRangeBoundaries() public function providerRangeBoundaries()
{ {
return new testDataFileIterator('rawTestData/CellRangeBoundaries.data'); return new testDataFileIterator('rawTestData/CellRangeBoundaries.data');
} }
/** /**
* @dataProvider providerRangeDimension * @dataProvider providerRangeDimension
*/ */
public function testRangeDimension() public function testRangeDimension()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','rangeDimension'),$args); $result = call_user_func_array(array('PHPExcel_Cell','rangeDimension'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerRangeDimension() public function providerRangeDimension()
{ {
return new testDataFileIterator('rawTestData/CellRangeDimension.data'); return new testDataFileIterator('rawTestData/CellRangeDimension.data');
} }
/** /**
* @dataProvider providerGetRangeBoundaries * @dataProvider providerGetRangeBoundaries
*/ */
public function testGetRangeBoundaries() public function testGetRangeBoundaries()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','getRangeBoundaries'),$args); $result = call_user_func_array(array('PHPExcel_Cell','getRangeBoundaries'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerGetRangeBoundaries() public function providerGetRangeBoundaries()
{ {
return new testDataFileIterator('rawTestData/CellGetRangeBoundaries.data'); return new testDataFileIterator('rawTestData/CellGetRangeBoundaries.data');
} }
/** /**
* @dataProvider providerExtractAllCellReferencesInRange * @dataProvider providerExtractAllCellReferencesInRange
*/ */
public function testExtractAllCellReferencesInRange() public function testExtractAllCellReferencesInRange()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Cell','extractAllCellReferencesInRange'),$args); $result = call_user_func_array(array('PHPExcel_Cell','extractAllCellReferencesInRange'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerExtractAllCellReferencesInRange() public function providerExtractAllCellReferencesInRange()
{ {
return new testDataFileIterator('rawTestData/CellExtractAllCellReferencesInRange.data'); return new testDataFileIterator('rawTestData/CellExtractAllCellReferencesInRange.data');
} }
} }

View File

@ -6,50 +6,48 @@ class DataSeriesValuesTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testSetDataType() public function testSetDataType()
{ {
$dataTypeValues = array( $dataTypeValues = array(
'Number', 'Number',
'String' 'String'
); );
$testInstance = new PHPExcel_Chart_DataSeriesValues; $testInstance = new PHPExcel_Chart_DataSeriesValues;
foreach($dataTypeValues as $dataTypeValue) { foreach ($dataTypeValues as $dataTypeValue) {
$result = $testInstance->setDataType($dataTypeValue); $result = $testInstance->setDataType($dataTypeValue);
$this->assertTrue($result instanceof PHPExcel_Chart_DataSeriesValues); $this->assertTrue($result instanceof PHPExcel_Chart_DataSeriesValues);
} }
} }
public function testSetInvalidDataTypeThrowsException() public function testSetInvalidDataTypeThrowsException()
{ {
$testInstance = new PHPExcel_Chart_DataSeriesValues; $testInstance = new PHPExcel_Chart_DataSeriesValues;
try { try {
$result = $testInstance->setDataType('BOOLEAN'); $result = $testInstance->setDataType('BOOLEAN');
} catch (Exception $e) { } catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'Invalid datatype for chart data series values'); $this->assertEquals($e->getMessage(), 'Invalid datatype for chart data series values');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
public function testGetDataType() public function testGetDataType()
{ {
$dataTypeValue = 'String'; $dataTypeValue = 'String';
$testInstance = new PHPExcel_Chart_DataSeriesValues; $testInstance = new PHPExcel_Chart_DataSeriesValues;
$setValue = $testInstance->setDataType($dataTypeValue); $setValue = $testInstance->setDataType($dataTypeValue);
$result = $testInstance->getDataType();
$this->assertEquals($dataTypeValue,$result);
}
$result = $testInstance->getDataType();
$this->assertEquals($dataTypeValue, $result);
}
} }

View File

@ -6,32 +6,30 @@ class LayoutTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testSetLayoutTarget() public function testSetLayoutTarget()
{ {
$LayoutTargetValue = 'String'; $LayoutTargetValue = 'String';
$testInstance = new PHPExcel_Chart_Layout; $testInstance = new PHPExcel_Chart_Layout;
$result = $testInstance->setLayoutTarget($LayoutTargetValue); $result = $testInstance->setLayoutTarget($LayoutTargetValue);
$this->assertTrue($result instanceof PHPExcel_Chart_Layout); $this->assertTrue($result instanceof PHPExcel_Chart_Layout);
} }
public function testGetLayoutTarget() public function testGetLayoutTarget()
{ {
$LayoutTargetValue = 'String'; $LayoutTargetValue = 'String';
$testInstance = new PHPExcel_Chart_Layout; $testInstance = new PHPExcel_Chart_Layout;
$setValue = $testInstance->setLayoutTarget($LayoutTargetValue); $setValue = $testInstance->setLayoutTarget($LayoutTargetValue);
$result = $testInstance->getLayoutTarget();
$this->assertEquals($LayoutTargetValue,$result);
}
$result = $testInstance->getLayoutTarget();
$this->assertEquals($LayoutTargetValue, $result);
}
} }

View File

@ -6,129 +6,127 @@ class LegendTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!defined('PHPEXCEL_ROOT')) if (!defined('PHPEXCEL_ROOT')) {
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testSetPosition() public function testSetPosition()
{ {
$positionValues = array( $positionValues = array(
PHPExcel_Chart_Legend::POSITION_RIGHT, PHPExcel_Chart_Legend::POSITION_RIGHT,
PHPExcel_Chart_Legend::POSITION_LEFT, PHPExcel_Chart_Legend::POSITION_LEFT,
PHPExcel_Chart_Legend::POSITION_TOP, PHPExcel_Chart_Legend::POSITION_TOP,
PHPExcel_Chart_Legend::POSITION_BOTTOM, PHPExcel_Chart_Legend::POSITION_BOTTOM,
PHPExcel_Chart_Legend::POSITION_TOPRIGHT, PHPExcel_Chart_Legend::POSITION_TOPRIGHT,
); );
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
foreach($positionValues as $positionValue) { foreach ($positionValues as $positionValue) {
$result = $testInstance->setPosition($positionValue); $result = $testInstance->setPosition($positionValue);
$this->assertTrue($result); $this->assertTrue($result);
} }
} }
public function testSetInvalidPositionReturnsFalse() public function testSetInvalidPositionReturnsFalse()
{ {
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
$result = $testInstance->setPosition('BottomLeft'); $result = $testInstance->setPosition('BottomLeft');
$this->assertFalse($result); $this->assertFalse($result);
// Ensure that value is unchanged // Ensure that value is unchanged
$result = $testInstance->getPosition(); $result = $testInstance->getPosition();
$this->assertEquals(PHPExcel_Chart_Legend::POSITION_RIGHT,$result); $this->assertEquals(PHPExcel_Chart_Legend::POSITION_RIGHT, $result);
} }
public function testGetPosition() public function testGetPosition()
{ {
$PositionValue = PHPExcel_Chart_Legend::POSITION_BOTTOM; $PositionValue = PHPExcel_Chart_Legend::POSITION_BOTTOM;
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
$setValue = $testInstance->setPosition($PositionValue); $setValue = $testInstance->setPosition($PositionValue);
$result = $testInstance->getPosition(); $result = $testInstance->getPosition();
$this->assertEquals($PositionValue,$result); $this->assertEquals($PositionValue, $result);
} }
public function testSetPositionXL() public function testSetPositionXL()
{ {
$positionValues = array( $positionValues = array(
PHPExcel_Chart_Legend::xlLegendPositionBottom, PHPExcel_Chart_Legend::xlLegendPositionBottom,
PHPExcel_Chart_Legend::xlLegendPositionCorner, PHPExcel_Chart_Legend::xlLegendPositionCorner,
PHPExcel_Chart_Legend::xlLegendPositionCustom, PHPExcel_Chart_Legend::xlLegendPositionCustom,
PHPExcel_Chart_Legend::xlLegendPositionLeft, PHPExcel_Chart_Legend::xlLegendPositionLeft,
PHPExcel_Chart_Legend::xlLegendPositionRight, PHPExcel_Chart_Legend::xlLegendPositionRight,
PHPExcel_Chart_Legend::xlLegendPositionTop, PHPExcel_Chart_Legend::xlLegendPositionTop,
); );
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
foreach($positionValues as $positionValue) { foreach ($positionValues as $positionValue) {
$result = $testInstance->setPositionXL($positionValue); $result = $testInstance->setPositionXL($positionValue);
$this->assertTrue($result); $this->assertTrue($result);
} }
} }
public function testSetInvalidXLPositionReturnsFalse() public function testSetInvalidXLPositionReturnsFalse()
{ {
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
$result = $testInstance->setPositionXL(999); $result = $testInstance->setPositionXL(999);
$this->assertFalse($result); $this->assertFalse($result);
// Ensure that value is unchanged // Ensure that value is unchanged
$result = $testInstance->getPositionXL(); $result = $testInstance->getPositionXL();
$this->assertEquals(PHPExcel_Chart_Legend::xlLegendPositionRight,$result); $this->assertEquals(PHPExcel_Chart_Legend::xlLegendPositionRight, $result);
} }
public function testGetPositionXL() public function testGetPositionXL()
{ {
$PositionValue = PHPExcel_Chart_Legend::xlLegendPositionCorner; $PositionValue = PHPExcel_Chart_Legend::xlLegendPositionCorner;
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
$setValue = $testInstance->setPositionXL($PositionValue); $setValue = $testInstance->setPositionXL($PositionValue);
$result = $testInstance->getPositionXL(); $result = $testInstance->getPositionXL();
$this->assertEquals($PositionValue,$result); $this->assertEquals($PositionValue, $result);
} }
public function testSetOverlay() public function testSetOverlay()
{ {
$overlayValues = array( $overlayValues = array(
TRUE, true,
FALSE, false,
); );
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
foreach($overlayValues as $overlayValue) { foreach ($overlayValues as $overlayValue) {
$result = $testInstance->setOverlay($overlayValue); $result = $testInstance->setOverlay($overlayValue);
$this->assertTrue($result); $this->assertTrue($result);
} }
} }
public function testSetInvalidOverlayReturnsFalse() public function testSetInvalidOverlayReturnsFalse()
{ {
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
$result = $testInstance->setOverlay('INVALID'); $result = $testInstance->setOverlay('INVALID');
$this->assertFalse($result); $this->assertFalse($result);
$result = $testInstance->getOverlay(); $result = $testInstance->getOverlay();
$this->assertFalse($result); $this->assertFalse($result);
} }
public function testGetOverlay() public function testGetOverlay()
{ {
$OverlayValue = TRUE; $OverlayValue = true;
$testInstance = new PHPExcel_Chart_Legend; $testInstance = new PHPExcel_Chart_Legend;
$setValue = $testInstance->setOverlay($OverlayValue); $setValue = $testInstance->setOverlay($OverlayValue);
$result = $testInstance->getOverlay();
$this->assertEquals($OverlayValue,$result);
}
$result = $testInstance->getOverlay();
$this->assertEquals($OverlayValue, $result);
}
} }

View File

@ -10,46 +10,45 @@ class XEEValidatorTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
/** /**
* @dataProvider providerInvalidXML * @dataProvider providerInvalidXML
* @expectedException PHPExcel_Reader_Exception * @expectedException PHPExcel_Reader_Exception
*/ */
public function testInvalidXML($filename) public function testInvalidXML($filename)
{ {
$reader = $this->getMockForAbstractClass('PHPExcel_Reader_Abstract'); $reader = $this->getMockForAbstractClass('PHPExcel_Reader_Abstract');
$expectedResult = 'FAILURE: Should throw an Exception rather than return a value'; $expectedResult = 'FAILURE: Should throw an Exception rather than return a value';
$result = $reader->securityScanFile($filename); $result = $reader->securityScanFile($filename);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerInvalidXML() public function providerInvalidXML()
{ {
$tests = []; $tests = [];
foreach(glob('rawTestData/Reader/XEETestInvalid*.xml') as $file) { foreach (glob('rawTestData/Reader/XEETestInvalid*.xml') as $file) {
$tests[] = [realpath($file), true]; $tests[] = [realpath($file), true];
} }
return $tests; return $tests;
} }
/** /**
* @dataProvider providerValidXML * @dataProvider providerValidXML
*/ */
public function testValidXML($filename, $expectedResult) public function testValidXML($filename, $expectedResult)
{ {
$reader = $this->getMockForAbstractClass('PHPExcel_Reader_Abstract'); $reader = $this->getMockForAbstractClass('PHPExcel_Reader_Abstract');
$result = $reader->securityScanFile($filename); $result = $reader->securityScanFile($filename);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerValidXML() public function providerValidXML()
{ {
$tests = []; $tests = [];
foreach(glob('rawTestData/Reader/XEETestValid*.xml') as $file) { foreach (glob('rawTestData/Reader/XEETestValid*.xml') as $file) {
$tests[] = [realpath($file), file_get_contents($file)]; $tests[] = [realpath($file), file_get_contents($file)];
} }
return $tests; return $tests;
} }
} }

View File

@ -10,49 +10,48 @@ class ReferenceHelperTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testColumnSort() public function testColumnSort()
{ {
$columnBase = $columnExpectedResult = array( $columnBase = $columnExpectedResult = array(
'A','B','Z', 'A','B','Z',
'AA','AB','AZ', 'AA','AB','AZ',
'BA','BB','BZ', 'BA','BB','BZ',
'ZA','ZB','ZZ', 'ZA','ZB','ZZ',
'AAA','AAB','AAZ', 'AAA','AAB','AAZ',
'ABA','ABB','ABZ', 'ABA','ABB','ABZ',
'AZA','AZB','AZZ', 'AZA','AZB','AZZ',
'BAA','BAB','BAZ', 'BAA','BAB','BAZ',
'BBA','BBB','BBZ', 'BBA','BBB','BBZ',
'BZA','BZB','BZZ' 'BZA','BZB','BZZ'
); );
shuffle($columnBase); shuffle($columnBase);
usort($columnBase, array('PHPExcel_ReferenceHelper','columnSort')); usort($columnBase, array('PHPExcel_ReferenceHelper','columnSort'));
foreach($columnBase as $key => $value) { foreach ($columnBase as $key => $value) {
$this->assertEquals($columnExpectedResult[$key], $value); $this->assertEquals($columnExpectedResult[$key], $value);
} }
} }
public function testColumnReverseSort()
{
$columnBase = $columnExpectedResult = array(
'A','B','Z',
'AA','AB','AZ',
'BA','BB','BZ',
'ZA','ZB','ZZ',
'AAA','AAB','AAZ',
'ABA','ABB','ABZ',
'AZA','AZB','AZZ',
'BAA','BAB','BAZ',
'BBA','BBB','BBZ',
'BZA','BZB','BZZ'
);
shuffle($columnBase);
$columnExpectedResult = array_reverse($columnExpectedResult);
usort($columnBase, array('PHPExcel_ReferenceHelper','columnReverseSort'));
foreach($columnBase as $key => $value) {
$this->assertEquals($columnExpectedResult[$key], $value);
}
}
public function testColumnReverseSort()
{
$columnBase = $columnExpectedResult = array(
'A','B','Z',
'AA','AB','AZ',
'BA','BB','BZ',
'ZA','ZB','ZZ',
'AAA','AAB','AAZ',
'ABA','ABB','ABZ',
'AZA','AZB','AZZ',
'BAA','BAB','BAZ',
'BBA','BBB','BBZ',
'BZA','BZB','BZZ'
);
shuffle($columnBase);
$columnExpectedResult = array_reverse($columnExpectedResult);
usort($columnBase, array('PHPExcel_ReferenceHelper','columnReverseSort'));
foreach ($columnBase as $key => $value) {
$this->assertEquals($columnExpectedResult[$key], $value);
}
}
} }

View File

@ -12,46 +12,45 @@ class CodePageTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
/** /**
* @dataProvider providerCodePage * @dataProvider providerCodePage
*/ */
public function testCodePageNumberToName() public function testCodePageNumberToName()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_CodePage','NumberToName'),$args); $result = call_user_func_array(array('PHPExcel_Shared_CodePage','NumberToName'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerCodePage() public function providerCodePage()
{ {
return new testDataFileIterator('rawTestData/Shared/CodePage.data'); return new testDataFileIterator('rawTestData/Shared/CodePage.data');
} }
public function testNumberToNameWithInvalidCodePage() public function testNumberToNameWithInvalidCodePage()
{ {
$invalidCodePage = 12345; $invalidCodePage = 12345;
try { try {
$result = call_user_func(array('PHPExcel_Shared_CodePage','NumberToName'),$invalidCodePage); $result = call_user_func(array('PHPExcel_Shared_CodePage','NumberToName'), $invalidCodePage);
} catch (Exception $e) { } catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'Unknown codepage: 12345'); $this->assertEquals($e->getMessage(), 'Unknown codepage: 12345');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
public function testNumberToNameWithUnsupportedCodePage() public function testNumberToNameWithUnsupportedCodePage()
{ {
$unsupportedCodePage = 720; $unsupportedCodePage = 720;
try { try {
$result = call_user_func(array('PHPExcel_Shared_CodePage','NumberToName'),$unsupportedCodePage); $result = call_user_func(array('PHPExcel_Shared_CodePage','NumberToName'), $unsupportedCodePage);
} catch (Exception $e) { } catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'Code page 720 not supported.'); $this->assertEquals($e->getMessage(), 'Code page 720 not supported.');
return; return;
} }
$this->fail('An expected exception has not been raised.'); $this->fail('An expected exception has not been raised.');
} }
} }

View File

@ -12,177 +12,176 @@ class DateTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testSetExcelCalendar() public function testSetExcelCalendar()
{ {
$calendarValues = array( $calendarValues = array(
PHPExcel_Shared_Date::CALENDAR_MAC_1904, PHPExcel_Shared_Date::CALENDAR_MAC_1904,
PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900, PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900,
); );
foreach($calendarValues as $calendarValue) { foreach ($calendarValues as $calendarValue) {
$result = call_user_func(array('PHPExcel_Shared_Date','setExcelCalendar'),$calendarValue); $result = call_user_func(array('PHPExcel_Shared_Date','setExcelCalendar'), $calendarValue);
$this->assertTrue($result); $this->assertTrue($result);
} }
} }
public function testSetExcelCalendarWithInvalidValue() public function testSetExcelCalendarWithInvalidValue()
{ {
$unsupportedCalendar = '2012'; $unsupportedCalendar = '2012';
$result = call_user_func(array('PHPExcel_Shared_Date','setExcelCalendar'),$unsupportedCalendar); $result = call_user_func(array('PHPExcel_Shared_Date','setExcelCalendar'), $unsupportedCalendar);
$this->assertFalse($result); $this->assertFalse($result);
} }
/** /**
* @dataProvider providerDateTimeExcelToPHP1900 * @dataProvider providerDateTimeExcelToPHP1900
*/ */
public function testDateTimeExcelToPHP1900() public function testDateTimeExcelToPHP1900()
{ {
$result = call_user_func( $result = call_user_func(
array('PHPExcel_Shared_Date','setExcelCalendar'), array('PHPExcel_Shared_Date','setExcelCalendar'),
PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900 PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900
); );
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
if ($args[0] < 1) { if ($args[0] < 1) {
$expectedResult += gmmktime(0,0,0); $expectedResult += gmmktime(0, 0, 0);
} }
$result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'),$args); $result = call_user_func_array(array('PHPExcel_Shared_Date', 'ExcelToPHP'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerDateTimeExcelToPHP1900() public function providerDateTimeExcelToPHP1900()
{ {
return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1900.data'); return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1900.data');
} }
/** /**
* @dataProvider providerDateTimePHPToExcel1900 * @dataProvider providerDateTimePHPToExcel1900
*/ */
public function testDateTimePHPToExcel1900() public function testDateTimePHPToExcel1900()
{ {
$result = call_user_func( $result = call_user_func(
array('PHPExcel_Shared_Date','setExcelCalendar'), array('PHPExcel_Shared_Date','setExcelCalendar'),
PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900 PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900
); );
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'),$args); $result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-5); $this->assertEquals($expectedResult, $result, null, 1E-5);
} }
public function providerDateTimePHPToExcel1900() public function providerDateTimePHPToExcel1900()
{ {
return new testDataFileIterator('rawTestData/Shared/DateTimePHPToExcel1900.data'); return new testDataFileIterator('rawTestData/Shared/DateTimePHPToExcel1900.data');
} }
/** /**
* @dataProvider providerDateTimeFormattedPHPToExcel1900 * @dataProvider providerDateTimeFormattedPHPToExcel1900
*/ */
public function testDateTimeFormattedPHPToExcel1900() public function testDateTimeFormattedPHPToExcel1900()
{ {
$result = call_user_func( $result = call_user_func(
array('PHPExcel_Shared_Date','setExcelCalendar'), array('PHPExcel_Shared_Date','setExcelCalendar'),
PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900 PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900
); );
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','FormattedPHPToExcel'),$args); $result = call_user_func_array(array('PHPExcel_Shared_Date','FormattedPHPToExcel'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-5); $this->assertEquals($expectedResult, $result, null, 1E-5);
} }
public function providerDateTimeFormattedPHPToExcel1900() public function providerDateTimeFormattedPHPToExcel1900()
{ {
return new testDataFileIterator('rawTestData/Shared/DateTimeFormattedPHPToExcel1900.data'); return new testDataFileIterator('rawTestData/Shared/DateTimeFormattedPHPToExcel1900.data');
} }
/** /**
* @dataProvider providerDateTimeExcelToPHP1904 * @dataProvider providerDateTimeExcelToPHP1904
*/ */
public function testDateTimeExcelToPHP1904() public function testDateTimeExcelToPHP1904()
{ {
$result = call_user_func( $result = call_user_func(
array('PHPExcel_Shared_Date','setExcelCalendar'), array('PHPExcel_Shared_Date','setExcelCalendar'),
PHPExcel_Shared_Date::CALENDAR_MAC_1904 PHPExcel_Shared_Date::CALENDAR_MAC_1904
); );
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
if ($args[0] < 1) { if ($args[0] < 1) {
$expectedResult += gmmktime(0,0,0); $expectedResult += gmmktime(0, 0, 0);
} }
$result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'),$args); $result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerDateTimeExcelToPHP1904() public function providerDateTimeExcelToPHP1904()
{ {
return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1904.data'); return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1904.data');
} }
/** /**
* @dataProvider providerDateTimePHPToExcel1904 * @dataProvider providerDateTimePHPToExcel1904
*/ */
public function testDateTimePHPToExcel1904() public function testDateTimePHPToExcel1904()
{ {
$result = call_user_func( $result = call_user_func(
array('PHPExcel_Shared_Date','setExcelCalendar'), array('PHPExcel_Shared_Date','setExcelCalendar'),
PHPExcel_Shared_Date::CALENDAR_MAC_1904 PHPExcel_Shared_Date::CALENDAR_MAC_1904
); );
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'),$args); $result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'), $args);
$this->assertEquals($expectedResult, $result, NULL, 1E-5); $this->assertEquals($expectedResult, $result, null, 1E-5);
} }
public function providerDateTimePHPToExcel1904() public function providerDateTimePHPToExcel1904()
{ {
return new testDataFileIterator('rawTestData/Shared/DateTimePHPToExcel1904.data'); return new testDataFileIterator('rawTestData/Shared/DateTimePHPToExcel1904.data');
} }
/** /**
* @dataProvider providerIsDateTimeFormatCode * @dataProvider providerIsDateTimeFormatCode
*/ */
public function testIsDateTimeFormatCode() public function testIsDateTimeFormatCode()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Date','isDateTimeFormatCode'),$args); $result = call_user_func_array(array('PHPExcel_Shared_Date','isDateTimeFormatCode'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerIsDateTimeFormatCode() public function providerIsDateTimeFormatCode()
{ {
return new testDataFileIterator('rawTestData/Shared/DateTimeFormatCodes.data'); return new testDataFileIterator('rawTestData/Shared/DateTimeFormatCodes.data');
} }
/** /**
* @dataProvider providerDateTimeExcelToPHP1900Timezone * @dataProvider providerDateTimeExcelToPHP1900Timezone
*/ */
public function testDateTimeExcelToPHP1900Timezone() public function testDateTimeExcelToPHP1900Timezone()
{ {
$result = call_user_func( $result = call_user_func(
array('PHPExcel_Shared_Date','setExcelCalendar'), array('PHPExcel_Shared_Date','setExcelCalendar'),
PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900 PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900
); );
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
if ($args[0] < 1) { if ($args[0] < 1) {
$expectedResult += gmmktime(0,0,0); $expectedResult += gmmktime(0, 0, 0);
} }
$result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'),$args); $result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerDateTimeExcelToPHP1900Timezone() public function providerDateTimeExcelToPHP1900Timezone()
{ {
return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1900Timezone.data'); return new testDataFileIterator('rawTestData/Shared/DateTimeExcelToPHP1900Timezone.data');
} }
} }

View File

@ -12,28 +12,28 @@ class FileTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testGetUseUploadTempDirectory() public function testGetUseUploadTempDirectory()
{ {
$expectedResult = FALSE; $expectedResult = false;
$result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory')); $result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory'));
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testSetUseUploadTempDirectory() public function testSetUseUploadTempDirectory()
{ {
$useUploadTempDirectoryValues = array( $useUploadTempDirectoryValues = array(
TRUE, true,
FALSE, false,
); );
foreach($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) { foreach ($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) {
call_user_func(array('PHPExcel_Shared_File','setUseUploadTempDirectory'),$useUploadTempDirectoryValue); call_user_func(array('PHPExcel_Shared_File','setUseUploadTempDirectory'), $useUploadTempDirectoryValue);
$result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory')); $result = call_user_func(array('PHPExcel_Shared_File','getUseUploadTempDirectory'));
$this->assertEquals($useUploadTempDirectoryValue, $result); $this->assertEquals($useUploadTempDirectoryValue, $result);
} }
} }
} }

View File

@ -12,83 +12,82 @@ class FontTest extends PHPUnit_Framework_TestCase
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
} }
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
} }
public function testGetAutoSizeMethod() public function testGetAutoSizeMethod()
{ {
$expectedResult = PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX; $expectedResult = PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX;
$result = call_user_func(array('PHPExcel_Shared_Font','getAutoSizeMethod')); $result = call_user_func(array('PHPExcel_Shared_Font','getAutoSizeMethod'));
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function testSetAutoSizeMethod() public function testSetAutoSizeMethod()
{ {
$autosizeMethodValues = array( $autosizeMethodValues = array(
PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT, PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT,
PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX, PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX,
); );
foreach($autosizeMethodValues as $autosizeMethodValue) { foreach ($autosizeMethodValues as $autosizeMethodValue) {
$result = call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'),$autosizeMethodValue); $result = call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'), $autosizeMethodValue);
$this->assertTrue($result); $this->assertTrue($result);
} }
} }
public function testSetAutoSizeMethodWithInvalidValue() public function testSetAutoSizeMethodWithInvalidValue()
{ {
$unsupportedAutosizeMethod = 'guess'; $unsupportedAutosizeMethod = 'guess';
$result = call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'),$unsupportedAutosizeMethod); $result = call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'), $unsupportedAutosizeMethod);
$this->assertFalse($result); $this->assertFalse($result);
} }
/** /**
* @dataProvider providerFontSizeToPixels * @dataProvider providerFontSizeToPixels
*/ */
public function testFontSizeToPixels() public function testFontSizeToPixels()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Font','fontSizeToPixels'),$args); $result = call_user_func_array(array('PHPExcel_Shared_Font','fontSizeToPixels'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerFontSizeToPixels() public function providerFontSizeToPixels()
{ {
return new testDataFileIterator('rawTestData/Shared/FontSizeToPixels.data'); return new testDataFileIterator('rawTestData/Shared/FontSizeToPixels.data');
} }
/** /**
* @dataProvider providerInchSizeToPixels * @dataProvider providerInchSizeToPixels
*/ */
public function testInchSizeToPixels() public function testInchSizeToPixels()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Font','inchSizeToPixels'),$args); $result = call_user_func_array(array('PHPExcel_Shared_Font','inchSizeToPixels'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerInchSizeToPixels() public function providerInchSizeToPixels()
{ {
return new testDataFileIterator('rawTestData/Shared/InchSizeToPixels.data'); return new testDataFileIterator('rawTestData/Shared/InchSizeToPixels.data');
} }
/** /**
* @dataProvider providerCentimeterSizeToPixels * @dataProvider providerCentimeterSizeToPixels
*/ */
public function testCentimeterSizeToPixels() public function testCentimeterSizeToPixels()
{ {
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Shared_Font','centimeterSizeToPixels'),$args); $result = call_user_func_array(array('PHPExcel_Shared_Font','centimeterSizeToPixels'), $args);
$this->assertEquals($expectedResult, $result); $this->assertEquals($expectedResult, $result);
} }
public function providerCentimeterSizeToPixels() public function providerCentimeterSizeToPixels()
{ {
return new testDataFileIterator('rawTestData/Shared/CentimeterSizeToPixels.data'); return new testDataFileIterator('rawTestData/Shared/CentimeterSizeToPixels.data');
} }
} }

Some files were not shown because too many files have changed in this diff Show More