diff --git a/Classes/PHPExcel/Calculation.php b/Classes/PHPExcel/Calculation.php index b94841c8..e13b9358 100644 --- a/Classes/PHPExcel/Calculation.php +++ b/Classes/PHPExcel/Calculation.php @@ -2063,7 +2063,7 @@ class PHPExcel_Calculation private static $controlFunctions = array( 'MKMATRIX' => array( 'argumentCount' => '*', - 'functionCall' => 'self::_mkMatrix' + 'functionCall' => 'self::mkMatrix' ) ); @@ -2542,7 +2542,7 @@ class PHPExcel_Calculation * @param mixed $value * @return mixed */ - public static function _wrapResult($value) + public static function wrapResult($value) { if (is_string($value)) { // Error values cannot be "wrapped" @@ -2567,7 +2567,7 @@ class PHPExcel_Calculation * @param mixed $value * @return mixed */ - public static function _unwrapResult($value) + public static function unwrapResult($value) { if (is_string($value)) { if ((isset($value{0})) && ($value{0} == '"') && (substr($value, -1) == '"')) { @@ -2634,7 +2634,7 @@ class PHPExcel_Calculation 'cell' => $pCell->getCoordinate(), ); try { - $result = self::_unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell)); + $result = self::unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell)); $cellAddress = array_pop($this->cellStack); $this->workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']); } catch (PHPExcel_Exception $e) { @@ -2726,7 +2726,7 @@ class PHPExcel_Calculation $this->calculationCacheEnabled = false; // Execute the calculation try { - $result = self::_unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell)); + $result = self::unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell)); } catch (PHPExcel_Exception $e) { throw new PHPExcel_Calculation_Exception($e->getMessage()); } @@ -2776,11 +2776,11 @@ class PHPExcel_Calculation // We simply return the cell value if not $formula = trim($formula); if ($formula{0} != '=') { - return self::_wrapResult($formula); + return self::wrapResult($formula); } $formula = ltrim(substr($formula, 1)); if (!isset($formula{0})) { - return self::_wrapResult($formula); + return self::wrapResult($formula); } $pCellParent = ($pCell !== null) ? $pCell->getWorksheet() : null; @@ -2811,7 +2811,7 @@ class PHPExcel_Calculation // Parse the formula onto the token stack and calculate the value $this->cyclicReferenceStack->push($wsCellReference); - $cellValue = $this->_processTokenStack($this->_parseFormula($formula, $pCell), $cellID, $pCell); + $cellValue = $this->processTokenStack($this->_parseFormula($formula, $pCell), $cellID, $pCell); $this->cyclicReferenceStack->pop(); // Save to calculation cache @@ -3108,7 +3108,7 @@ class PHPExcel_Calculation } - private static function _mkMatrix() + private static function mkMatrix() { return func_get_args(); } @@ -3416,7 +3416,7 @@ class PHPExcel_Calculation if ($opCharacter == '"') { // echo 'Element is a String
'; // UnEscape any quotes within the string - $val = self::_wrapResult(str_replace('""', '"', self::_unwrapResult($val))); + $val = self::wrapResult(str_replace('""', '"', self::unwrapResult($val))); } elseif (is_numeric($val)) { // echo 'Element is a Number
'; if ((strpos($val, '.') !== false) || (stripos($val, 'e') !== false) || ($val > PHP_INT_MAX) || ($val < -PHP_INT_MAX)) { @@ -3519,7 +3519,7 @@ class PHPExcel_Calculation } // evaluate postfix notation - private function _processTokenStack($tokens, $cellID = null, PHPExcel_Cell $pCell = null) + private function processTokenStack($tokens, $cellID = null, PHPExcel_Cell $pCell = null) { if ($tokens == false) { return false; @@ -3659,7 +3659,7 @@ class PHPExcel_Calculation $result = '#VALUE!'; } } else { - $result = '"'.str_replace('""', '"', self::_unwrapResult($operand1, '"').self::_unwrapResult($operand2, '"')).'"'; + $result = '"'.str_replace('""', '"', self::unwrapResult($operand1, '"').self::unwrapResult($operand2, '"')).'"'; } $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result)); $stack->push('Value', $result); @@ -3832,7 +3832,7 @@ class PHPExcel_Calculation } } } else { - $args[] = self::_unwrapResult($arg['value']); + $args[] = self::unwrapResult($arg['value']); if ($functionName != 'MKMATRIX') { $argArrayVals[] = $this->showValue($arg['value']); } @@ -3892,7 +3892,7 @@ class PHPExcel_Calculation if ($functionName != 'MKMATRIX') { $this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->showTypeDetails($result)); } - $stack->push('Value', self::_wrapResult($result)); + $stack->push('Value', self::wrapResult($result)); } } else { @@ -3948,7 +3948,7 @@ class PHPExcel_Calculation // We only need special validations for the operand if it is a string // Start by stripping off the quotation marks we use to identify true excel string values internally if ($operand > '' && $operand{0} == '"') { - $operand = self::_unwrapResult($operand); + $operand = self::unwrapResult($operand); } // If the string is a numeric value, we treat it as a numeric, so no further testing if (!is_numeric($operand)) { @@ -4010,10 +4010,10 @@ class PHPExcel_Calculation // Simple validate the two operands if they are string values if (is_string($operand1) && $operand1 > '' && $operand1{0} == '"') { - $operand1 = self::_unwrapResult($operand1); + $operand1 = self::unwrapResult($operand1); } if (is_string($operand2) && $operand2 > '' && $operand2{0} == '"') { - $operand2 = self::_unwrapResult($operand2); + $operand2 = self::unwrapResult($operand2); } // Use case insensitive comparaison if not OpenOffice mode diff --git a/Classes/PHPExcel/Calculation/Database.php b/Classes/PHPExcel/Calculation/Database.php index af150fe0..b8d91cb6 100644 --- a/Classes/PHPExcel/Calculation/Database.php +++ b/Classes/PHPExcel/Calculation/Database.php @@ -126,7 +126,7 @@ class PHPExcel_Calculation_Database $k = array_search($criteriaName, $fieldNames); if (isset($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); } } diff --git a/Classes/PHPExcel/Calculation/Functions.php b/Classes/PHPExcel/Calculation/Functions.php index 4d1771b9..9e7a5db1 100644 --- a/Classes/PHPExcel/Calculation/Functions.php +++ b/Classes/PHPExcel/Calculation/Functions.php @@ -323,7 +323,7 @@ class PHPExcel_Calculation_Functions } if (!in_array($condition{0}, array('>', '<', '='))) { if (!is_numeric($condition)) { - $condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition)); + $condition = PHPExcel_Calculation::wrapResult(strtoupper($condition)); } return '=' . $condition; } else { @@ -332,7 +332,7 @@ class PHPExcel_Calculation_Functions if (!is_numeric($operand)) { $operand = str_replace('"', '""', $operand); - $operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand)); + $operand = PHPExcel_Calculation::wrapResult(strtoupper($operand)); } return $operator.$operand; diff --git a/Classes/PHPExcel/Calculation/MathTrig.php b/Classes/PHPExcel/Calculation/MathTrig.php index 9d5a439e..dae2aa1e 100644 --- a/Classes/PHPExcel/Calculation/MathTrig.php +++ b/Classes/PHPExcel/Calculation/MathTrig.php @@ -1206,7 +1206,7 @@ class PHPExcel_Calculation_MathTrig foreach ($aArgs as $key => $arg) { if (!is_numeric($arg)) { $arg = str_replace('"', '""', $arg); - $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); + $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg)); } $testCondition = '='.$arg.$condition; diff --git a/Classes/PHPExcel/Calculation/Statistical.php b/Classes/PHPExcel/Calculation/Statistical.php index cd43dd6c..500f9509 100644 --- a/Classes/PHPExcel/Calculation/Statistical.php +++ b/Classes/PHPExcel/Calculation/Statistical.php @@ -877,7 +877,7 @@ class PHPExcel_Calculation_Statistical $aCount = 0; foreach ($aArgs as $key => $arg) { if (!is_numeric($arg)) { - $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); + $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg)); } $testCondition = '='.$arg.$condition; if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { @@ -1298,7 +1298,7 @@ class PHPExcel_Calculation_Statistical // Loop through arguments foreach ($aArgs as $arg) { if (!is_numeric($arg)) { - $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); + $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg)); } $testCondition = '='.$arg.$condition; if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { @@ -2290,7 +2290,7 @@ class PHPExcel_Calculation_Statistical // Loop through arguments foreach ($aArgs as $key => $arg) { if (!is_numeric($arg)) { - $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); + $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg)); } $testCondition = '='.$arg.$condition; if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { @@ -2449,7 +2449,7 @@ class PHPExcel_Calculation_Statistical // Loop through arguments foreach ($aArgs as $key => $arg) { if (!is_numeric($arg)) { - $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); + $arg = PHPExcel_Calculation::wrapResult(strtoupper($arg)); } $testCondition = '='.$arg.$condition; if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { diff --git a/Classes/PHPExcel/Chart.php b/Classes/PHPExcel/Chart.php index 0cc22c14..d7799935 100644 --- a/Classes/PHPExcel/Chart.php +++ b/Classes/PHPExcel/Chart.php @@ -32,7 +32,7 @@ class PHPExcel_Chart * * @var string */ - private $_name = ''; + private $name = ''; /** * Worksheet @@ -171,7 +171,7 @@ 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) { - $this->_name = $name; + $this->name = $name; $this->title = $title; $this->legend = $legend; $this->xAxisLabel = $xAxisLabel; @@ -192,7 +192,7 @@ class PHPExcel_Chart */ public function getName() { - return $this->_name; + return $this->name; } /** diff --git a/Classes/PHPExcel/Chart/DataSeriesValues.php b/Classes/PHPExcel/Chart/DataSeriesValues.php index 23d185de..ea57e52a 100644 --- a/Classes/PHPExcel/Chart/DataSeriesValues.php +++ b/Classes/PHPExcel/Chart/DataSeriesValues.php @@ -288,7 +288,7 @@ class PHPExcel_Chart_DataSeriesValues { if ($this->dataSource !== null) { $calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent()); - $newDataValues = PHPExcel_Calculation::_unwrapResult( + $newDataValues = PHPExcel_Calculation::unwrapResult( $calcEngine->_calculateFormulaValue( '='.$this->dataSource, null, diff --git a/Classes/PHPExcel/IOFactory.php b/Classes/PHPExcel/IOFactory.php index bc1d99e3..3ecda177 100644 --- a/Classes/PHPExcel/IOFactory.php +++ b/Classes/PHPExcel/IOFactory.php @@ -43,7 +43,7 @@ class PHPExcel_IOFactory * @access private * @static */ - private static $_searchLocations = array( + private static $searchLocations = array( array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ), array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' ) ); @@ -55,7 +55,7 @@ class PHPExcel_IOFactory * @access private * @static */ - private static $_autoResolveClasses = array( + private static $autoResolveClasses = array( 'Excel2007', 'Excel5', 'Excel2003XML', @@ -82,7 +82,7 @@ class PHPExcel_IOFactory */ public static function getSearchLocations() { - return self::$_searchLocations; + return self::$searchLocations; } /** @@ -96,7 +96,7 @@ class PHPExcel_IOFactory public static function setSearchLocations($value) { if (is_array($value)) { - self::$_searchLocations = $value; + self::$searchLocations = $value; } else { throw new PHPExcel_Reader_Exception('Invalid parameter passed.'); } @@ -113,7 +113,7 @@ class PHPExcel_IOFactory */ 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'; // Include class - foreach (self::$_searchLocations as $searchLocation) { + foreach (self::$searchLocations as $searchLocation) { if ($searchLocation['type'] == $searchType) { $className = str_replace('{0}', $writerType, $searchLocation['class']); @@ -162,7 +162,7 @@ class PHPExcel_IOFactory $searchType = 'IReader'; // Include class - foreach (self::$_searchLocations as $searchLocation) { + foreach (self::$searchLocations as $searchLocation) { if ($searchLocation['type'] == $searchType) { $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 - // Try walking through all the options in self::$_autoResolveClasses - foreach (self::$_autoResolveClasses as $autoResolveClass) { + // Try walking through all the options in self::$autoResolveClasses + foreach (self::$autoResolveClasses as $autoResolveClass) { // Ignore our original guess, we know that won't work if ($autoResolveClass !== $extensionType) { $reader = self::createReader($autoResolveClass); diff --git a/Classes/PHPExcel/NamedRange.php b/Classes/PHPExcel/NamedRange.php index 318bcf3b..2848db83 100644 --- a/Classes/PHPExcel/NamedRange.php +++ b/Classes/PHPExcel/NamedRange.php @@ -32,35 +32,35 @@ class PHPExcel_NamedRange * * @var string */ - private $_name; + private $name; /** * Worksheet on which the named range can be resolved * * @var PHPExcel_Worksheet */ - private $_worksheet; + private $worksheet; /** * Range of the referenced cells * * @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 */ - private $_localOnly; + private $localOnly; /** * Scope * * @var PHPExcel_Worksheet */ - private $_scope; + private $scope; /** * Create a new NamedRange @@ -80,12 +80,11 @@ class PHPExcel_NamedRange } // Set local members - $this->_name = $pName; - $this->_worksheet = $pWorksheet; - $this->_range = $pRange; - $this->_localOnly = $pLocalOnly; - $this->_scope = ($pLocalOnly == true) ? - (($pScope == null) ? $pWorksheet : $pScope) : null; + $this->name = $pName; + $this->worksheet = $pWorksheet; + $this->range = $pRange; + $this->localOnly = $pLocalOnly; + $this->scope = ($pLocalOnly == true) ? (($pScope == null) ? $pWorksheet : $pScope) : null; } /** @@ -95,7 +94,7 @@ class PHPExcel_NamedRange */ public function getName() { - return $this->_name; + return $this->name; } /** @@ -108,21 +107,21 @@ class PHPExcel_NamedRange { if ($value !== null) { // Old title - $oldTitle = $this->_name; + $oldTitle = $this->name; // Re-attach - if ($this->_worksheet !== null) { - $this->_worksheet->getParent()->removeNamedRange($this->_name, $this->_worksheet); + if ($this->worksheet !== null) { + $this->worksheet->getParent()->removeNamedRange($this->name, $this->worksheet); } - $this->_name = $value; + $this->name = $value; - if ($this->_worksheet !== null) { - $this->_worksheet->getParent()->addNamedRange($this); + if ($this->worksheet !== null) { + $this->worksheet->getParent()->addNamedRange($this); } // New title - $newTitle = $this->_name; - PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_worksheet->getParent(), $oldTitle, $newTitle); + $newTitle = $this->name; + PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->worksheet->getParent(), $oldTitle, $newTitle); } return $this; } @@ -134,7 +133,7 @@ class PHPExcel_NamedRange */ public function getWorksheet() { - return $this->_worksheet; + return $this->worksheet; } /** @@ -146,7 +145,7 @@ class PHPExcel_NamedRange public function setWorksheet(PHPExcel_Worksheet $value = null) { if ($value !== null) { - $this->_worksheet = $value; + $this->worksheet = $value; } return $this; } @@ -158,7 +157,7 @@ class PHPExcel_NamedRange */ public function getRange() { - return $this->_range; + return $this->range; } /** @@ -170,7 +169,7 @@ class PHPExcel_NamedRange public function setRange($value = null) { if ($value !== null) { - $this->_range = $value; + $this->range = $value; } return $this; } @@ -182,7 +181,7 @@ class PHPExcel_NamedRange */ public function getLocalOnly() { - return $this->_localOnly; + return $this->localOnly; } /** @@ -193,8 +192,8 @@ class PHPExcel_NamedRange */ public function setLocalOnly($value = false) { - $this->_localOnly = $value; - $this->_scope = $value ? $this->_worksheet : null; + $this->localOnly = $value; + $this->scope = $value ? $this->worksheet : null; return $this; } @@ -205,7 +204,7 @@ class PHPExcel_NamedRange */ public function getScope() { - return $this->_scope; + return $this->scope; } /** @@ -216,8 +215,8 @@ class PHPExcel_NamedRange */ public function setScope(PHPExcel_Worksheet $value = null) { - $this->_scope = $value; - $this->_localOnly = ($value == null) ? false : true; + $this->scope = $value; + $this->localOnly = ($value == null) ? false : true; return $this; } diff --git a/Classes/PHPExcel/Reader/CSV.php b/Classes/PHPExcel/Reader/CSV.php index c168310e..65e2d3b6 100644 --- a/Classes/PHPExcel/Reader/CSV.php +++ b/Classes/PHPExcel/Reader/CSV.php @@ -50,7 +50,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R * @access private * @var string */ - private $_inputEncoding = 'UTF-8'; + private $inputEncoding = 'UTF-8'; /** * Delimiter @@ -58,7 +58,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R * @access private * @var string */ - private $_delimiter = ','; + private $delimiter = ','; /** * Enclosure @@ -66,7 +66,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R * @access private * @var string */ - private $_enclosure = '"'; + private $enclosure = '"'; /** * Sheet index to read @@ -74,7 +74,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R * @access private * @var int */ - private $_sheetIndex = 0; + private $sheetIndex = 0; /** * Load rows contiguously @@ -82,14 +82,14 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R * @access private * @var int */ - private $_contiguous = false; + private $contiguous = false; /** * Row counter for loading rows contiguously * * @var int */ - private $_contiguousRow = -1; + private $contiguousRow = -1; /** @@ -97,7 +97,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R */ public function __construct() { - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); } /** @@ -117,7 +117,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R */ public function setInputEncoding($pValue = 'UTF-8') { - $this->_inputEncoding = $pValue; + $this->inputEncoding = $pValue; return $this; } @@ -128,7 +128,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R */ public function getInputEncoding() { - return $this->_inputEncoding; + return $this->inputEncoding; } /** @@ -139,7 +139,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R { rewind($this->_fileHandle); - switch ($this->_inputEncoding) { + switch ($this->inputEncoding) { case 'UTF-8': fgets($this->_fileHandle, 4) == "\xEF\xBB\xBF" ? fseek($this->_fileHandle, 3) : fseek($this->_fileHandle, 0); @@ -184,7 +184,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R // Skip BOM, if any $this->_skipBOM(); - $escapeEnclosures = array( "\\" . $this->_enclosure, $this->_enclosure . $this->_enclosure ); + $escapeEnclosures = array( "\\" . $this->enclosure, $this->enclosure . $this->enclosure ); $worksheetInfo = array(); $worksheetInfo[0]['worksheetName'] = 'Worksheet'; @@ -194,7 +194,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R $worksheetInfo[0]['totalColumns'] = 0; // 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]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1); } @@ -249,32 +249,32 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R $this->_skipBOM(); // Create new PHPExcel object - while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { + while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) { $objPHPExcel->createSheet(); } - $sheet = $objPHPExcel->setActiveSheetIndex($this->_sheetIndex); + $sheet = $objPHPExcel->setActiveSheetIndex($this->sheetIndex); - $escapeEnclosures = array( "\\" . $this->_enclosure, - $this->_enclosure . $this->_enclosure + $escapeEnclosures = array( "\\" . $this->enclosure, + $this->enclosure . $this->enclosure ); // Set our starting row based on whether we're in contiguous mode or not $currentRow = 1; - if ($this->_contiguous) { - $currentRow = ($this->_contiguousRow == -1) ? $sheet->getHighestRow(): $this->_contiguousRow; + if ($this->contiguous) { + $currentRow = ($this->contiguousRow == -1) ? $sheet->getHighestRow(): $this->contiguousRow; } // 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'; foreach ($rowData as $rowDatum) { if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) { // Unescape enclosures - $rowDatum = str_replace($escapeEnclosures, $this->_enclosure, $rowDatum); + $rowDatum = str_replace($escapeEnclosures, $this->enclosure, $rowDatum); // Convert encoding if necessary - if ($this->_inputEncoding !== 'UTF-8') { - $rowDatum = PHPExcel_Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->_inputEncoding); + if ($this->inputEncoding !== 'UTF-8') { + $rowDatum = PHPExcel_Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->inputEncoding); } // Set cell value @@ -288,8 +288,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R // Close file fclose($fileHandle); - if ($this->_contiguous) { - $this->_contiguousRow = $currentRow; + if ($this->contiguous) { + $this->contiguousRow = $currentRow; } ini_set('auto_detect_line_endings', $lineEnding); @@ -305,7 +305,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R */ public function getDelimiter() { - return $this->_delimiter; + return $this->delimiter; } /** @@ -316,7 +316,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R */ public function setDelimiter($pValue = ',') { - $this->_delimiter = $pValue; + $this->delimiter = $pValue; return $this; } @@ -327,7 +327,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R */ public function getEnclosure() { - return $this->_enclosure; + return $this->enclosure; } /** @@ -341,7 +341,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R if ($pValue == '') { $pValue = '"'; } - $this->_enclosure = $pValue; + $this->enclosure = $pValue; return $this; } @@ -352,7 +352,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R */ public function getSheetIndex() { - return $this->_sheetIndex; + return $this->sheetIndex; } /** @@ -363,7 +363,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R */ public function setSheetIndex($pValue = 0) { - $this->_sheetIndex = $pValue; + $this->sheetIndex = $pValue; return $this; } @@ -374,9 +374,9 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R */ public function setContiguous($contiguous = false) { - $this->_contiguous = (bool) $contiguous; + $this->contiguous = (bool) $contiguous; if (!$contiguous) { - $this->_contiguousRow = -1; + $this->contiguousRow = -1; } return $this; @@ -389,6 +389,6 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R */ public function getContiguous() { - return $this->_contiguous; + return $this->contiguous; } } diff --git a/Classes/PHPExcel/Reader/Excel2003XML.php b/Classes/PHPExcel/Reader/Excel2003XML.php index f27c8c8a..feb0aaa0 100644 --- a/Classes/PHPExcel/Reader/Excel2003XML.php +++ b/Classes/PHPExcel/Reader/Excel2003XML.php @@ -1,6 +1,16 @@ _readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); } @@ -111,9 +103,9 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P // Retrieve charset encoding if (preg_match('//um', $data, $matches)) { - $this->_charSet = strtoupper($matches[1]); + $this->charSet = strtoupper($matches[1]); } -// echo 'Character Set is ', $this->_charSet,'
'; +// echo 'Character Set is ', $this->charSet,'
'; return $valid; } @@ -143,7 +135,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P $xml_ss = $xml->children($namespaces['ss']); foreach ($xml_ss->Worksheet as $worksheet) { $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; @@ -337,39 +329,39 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) { switch ($propertyName) { case 'Title': - $docProps->setTitle(self::_convertStringEncoding($propertyValue, $this->_charSet)); + $docProps->setTitle(self::_convertStringEncoding($propertyValue, $this->charSet)); break; case 'Subject': - $docProps->setSubject(self::_convertStringEncoding($propertyValue, $this->_charSet)); + $docProps->setSubject(self::_convertStringEncoding($propertyValue, $this->charSet)); break; case 'Author': - $docProps->setCreator(self::_convertStringEncoding($propertyValue, $this->_charSet)); + $docProps->setCreator(self::_convertStringEncoding($propertyValue, $this->charSet)); break; case 'Created': $creationDate = strtotime($propertyValue); $docProps->setCreated($creationDate); break; case 'LastAuthor': - $docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue, $this->_charSet)); + $docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue, $this->charSet)); break; case 'LastSaved': $lastSaveDate = strtotime($propertyValue); $docProps->setModified($lastSaveDate); break; case 'Company': - $docProps->setCompany(self::_convertStringEncoding($propertyValue, $this->_charSet)); + $docProps->setCompany(self::_convertStringEncoding($propertyValue, $this->charSet)); break; case 'Category': - $docProps->setCategory(self::_convertStringEncoding($propertyValue, $this->_charSet)); + $docProps->setCategory(self::_convertStringEncoding($propertyValue, $this->charSet)); break; case 'Manager': - $docProps->setManager(self::_convertStringEncoding($propertyValue, $this->_charSet)); + $docProps->setManager(self::_convertStringEncoding($propertyValue, $this->charSet)); break; case 'Keywords': - $docProps->setKeywords(self::_convertStringEncoding($propertyValue, $this->_charSet)); + $docProps->setKeywords(self::_convertStringEncoding($propertyValue, $this->charSet)); break; case 'Description': - $docProps->setDescription(self::_convertStringEncoding($propertyValue, $this->_charSet)); + $docProps->setDescription(self::_convertStringEncoding($propertyValue, $this->charSet)); break; } } @@ -410,9 +402,9 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P $styleID = (string) $style_ss['ID']; // echo 'Style ID = '.$styleID.'
'; if ($styleID == 'Default') { - $this->_styles['Default'] = array(); + $this->styles['Default'] = array(); } else { - $this->_styles[$styleID] = $this->_styles['Default']; + $this->styles[$styleID] = $this->styles['Default']; } foreach ($style as $styleType => $styleData) { $styleAttributes = $styleData->attributes($namespaces['ss']); @@ -425,16 +417,16 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P switch ($styleAttributeKey) { case 'Vertical': if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) { - $this->_styles[$styleID]['alignment']['vertical'] = $styleAttributeValue; + $this->styles[$styleID]['alignment']['vertical'] = $styleAttributeValue; } break; case 'Horizontal': if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) { - $this->_styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue; + $this->styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue; } break; case 'WrapText': - $this->_styles[$styleID]['alignment']['wrap'] = true; + $this->styles[$styleID]['alignment']['wrap'] = true; break; } } @@ -464,7 +456,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P } if (!empty($thisBorder)) { if (($borderPosition == 'left') || ($borderPosition == 'right') || ($borderPosition == 'top') || ($borderPosition == 'bottom')) { - $this->_styles[$styleID]['borders'][$borderPosition] = $thisBorder; + $this->styles[$styleID]['borders'][$borderPosition] = $thisBorder; } } } @@ -475,23 +467,23 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P $styleAttributeValue = (string) $styleAttributeValue; switch ($styleAttributeKey) { case 'FontName': - $this->_styles[$styleID]['font']['name'] = $styleAttributeValue; + $this->styles[$styleID]['font']['name'] = $styleAttributeValue; break; case 'Size': - $this->_styles[$styleID]['font']['size'] = $styleAttributeValue; + $this->styles[$styleID]['font']['size'] = $styleAttributeValue; break; case 'Color': - $this->_styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue, 1); + $this->styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue, 1); break; case 'Bold': - $this->_styles[$styleID]['font']['bold'] = true; + $this->styles[$styleID]['font']['bold'] = true; break; case 'Italic': - $this->_styles[$styleID]['font']['italic'] = true; + $this->styles[$styleID]['font']['italic'] = true; break; case 'Underline': if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) { - $this->_styles[$styleID]['font']['underline'] = $styleAttributeValue; + $this->styles[$styleID]['font']['underline'] = $styleAttributeValue; } break; } @@ -502,7 +494,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P // echo $styleAttributeKey.' = '.$styleAttributeValue.'
'; switch ($styleAttributeKey) { case 'Color': - $this->_styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue, 1); + $this->styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue, 1); break; } } @@ -517,7 +509,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P break; } if ($styleAttributeValue > '') { - $this->_styles[$styleID]['numberformat']['code'] = $styleAttributeValue; + $this->styles[$styleID]['numberformat']['code'] = $styleAttributeValue; } } break; @@ -528,7 +520,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P break; } } -// print_r($this->_styles[$styleID]); +// print_r($this->styles[$styleID]); // echo '
'; } // echo '
'; @@ -550,7 +542,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P $objPHPExcel->createSheet(); $objPHPExcel->setActiveSheetIndex($worksheetID); 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 // 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 @@ -640,7 +632,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P const TYPE_ERROR = 'e'; */ case 'String': - $cellValue = self::_convertStringEncoding($cellValue, $this->_charSet); + $cellValue = self::_convertStringEncoding($cellValue, $this->charSet); $type = PHPExcel_Cell_DataType::TYPE_STRING; break; case 'Number': @@ -748,20 +740,20 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P // echo $annotation,'
'; $annotation = strip_tags($node); // echo 'Annotation: ', $annotation,'
'; - $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']))) { $style = (string) $cell_ss['StyleID']; // echo 'Cell style for '.$columnID.$rowID.' is '.$style.'
'; - if ((isset($this->_styles[$style])) && (!empty($this->_styles[$style]))) { + if ((isset($this->styles[$style])) && (!empty($this->styles[$style]))) { // echo 'Cell '.$columnID.$rowID.'
'; -// print_r($this->_styles[$style]); +// print_r($this->styles[$style]); // echo '
'; if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) { $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(null); } - $objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->_styles[$style]); + $objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->styles[$style]); } } ++$columnID; @@ -806,7 +798,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P { $value = new PHPExcel_RichText(); - $value->createText(self::_convertStringEncoding($is, $this->_charSet)); + $value->createText(self::_convertStringEncoding($is, $this->charSet)); return $value; } diff --git a/Classes/PHPExcel/Reader/Excel2007.php b/Classes/PHPExcel/Reader/Excel2007.php index cc2616ae..47a130e3 100644 --- a/Classes/PHPExcel/Reader/Excel2007.php +++ b/Classes/PHPExcel/Reader/Excel2007.php @@ -1,6 +1,16 @@ _readFilter = new PHPExcel_Reader_DefaultReadFilter(); - $this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $this->referenceHelper = PHPExcel_ReferenceHelper::getInstance(); } /** @@ -239,7 +231,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE return $worksheetInfo; } - private static function _castToBool($c) + private static function castToBoolean($c) { // echo 'Initial Cast to Boolean', PHP_EOL; $value = isset($c->v) ? (string) $c->v : null; @@ -251,21 +243,21 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE return (bool)$c->v; } return $value; - } // function _castToBool() + } - private static function _castToError($c) + private static function castToError($c) { // echo 'Initial Cast to Error', PHP_EOL; return isset($c->v) ? (string) $c->v : null; - } // function _castToError() + } - private static function _castToString($c) + private static function castToString($c) { // echo 'Initial Cast to String, PHP_EOL; return isset($c->v) ? (string) $c->v : null; - } // function _castToString() + } - private function _castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType) + private function castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType) { // echo 'Formula', PHP_EOL; // echo '$c->f is ', $c->f, PHP_EOL; @@ -300,7 +292,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $difference[0] = PHPExcel_Cell::columnIndexFromString($current[0]) - PHPExcel_Cell::columnIndexFromString($master[0]); $difference[1] = $current[1] - $master[1]; - $value = $this->_referenceHelper->updateFormulaReferences($sharedFormulas[$instance]['formula'], 'A1', $difference[0], $difference[1]); + $value = $this->referenceHelper->updateFormulaReferences($sharedFormulas[$instance]['formula'], 'A1', $difference[0], $difference[1]); // echo 'Adjusted Formula is ', $value, PHP_EOL; } } @@ -384,7 +376,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $themeColours[$themePos] = $xmlColourData['val']; } } - self::$_theme = new PHPExcel_Reader_Excel2007_Theme($themeName, $colourSchemeName, $themeColours); + self::$theme = new PHPExcel_Reader_Excel2007_Theme($themeName, $colourSchemeName, $themeColours); } break; } @@ -445,7 +437,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE case "http://schemas.microsoft.com/office/2006/relationships/ui/extensibility": $customUI = $rel['Target']; if (!is_null($customUI)) { - $this->_readRibbon($excel, $customUI, $zip); + $this->readRibbon($excel, $customUI, $zip); } break; case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument": @@ -461,7 +453,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if (isset($val->t)) { $sharedStrings[] = PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $val->t); } elseif (isset($val->r)) { - $sharedStrings[] = $this->_parseRichText($val); + $sharedStrings[] = $this->parseRichText($val); } } } @@ -540,7 +532,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // add style to cellXf collection $objStyle = new PHPExcel_Style; - self::_readStyle($objStyle, $style); + self::readStyle($objStyle, $style); $excel->addCellXf($objStyle); } @@ -550,7 +542,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $tmpNumFmt = self::array_item($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]")); if (isset($tmpNumFmt["formatCode"])) { $numFmt = (string) $tmpNumFmt["formatCode"]; - } else if ((int)$xf["numFmtId"] < 165) { + } elseif ((int)$xf["numFmtId"] < 165) { $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); } } @@ -568,7 +560,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // add style to cellStyleXf collection $objStyle = new PHPExcel_Style; - self::_readStyle($objStyle, $cellStyle); + self::readStyle($objStyle, $cellStyle); $excel->addCellStyleXf($objStyle); } } @@ -579,7 +571,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if ($xmlStyles->dxfs) { foreach ($xmlStyles->dxfs->dxf as $dxf) { $style = new PHPExcel_Style(false, true); - self::_readStyle($style, $dxf); + self::readStyle($style, $dxf); $dxfs[] = $style; } } @@ -590,7 +582,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if (isset($cellStyles[intval($cellStyle['xfId'])])) { // Set default style $style = new PHPExcel_Style; - self::_readStyle($style, $cellStyles[intval($cellStyle['xfId'])]); + self::readStyle($style, $cellStyles[intval($cellStyle['xfId'])]); // normal style, currently not using it for anything } @@ -843,10 +835,10 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE case "b": // echo 'Boolean', PHP_EOL; if (!isset($c->f)) { - $value = self::_castToBool($c); + $value = self::castToBoolean($c); } else { // Formula - $this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, '_castToBool'); + $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToBoolean'); if (isset($c->f['t'])) { $att = array(); $att = $c->f; @@ -857,15 +849,15 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE break; case "inlineStr": // echo 'Inline String', PHP_EOL; - $value = $this->_parseRichText($c->is); + $value = $this->parseRichText($c->is); break; case "e": // echo 'Error', PHP_EOL; if (!isset($c->f)) { - $value = self::_castToError($c); + $value = self::castToError($c); } else { // Formula - $this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, '_castToError'); + $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToError'); // echo '$calculatedValue = ', $calculatedValue, PHP_EOL; } break; @@ -873,11 +865,11 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // echo 'Default', PHP_EOL; if (!isset($c->f)) { // echo 'Not a Formula', PHP_EOL; - $value = self::_castToString($c); + $value = self::castToString($c); } else { // echo 'Treat as Formula', PHP_EOL; // Formula - $this->_castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, '_castToString'); + $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToString'); // echo '$calculatedValue = ', $calculatedValue, PHP_EOL; } break; @@ -1280,7 +1272,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if (!empty($comment['authorId'])) { $docSheet->getComment((string)$comment['ref'])->setAuthor($authors[(string)$comment['authorId']]); } - $docSheet->getComment((string)$comment['ref'])->setText($this->_parseRichText($comment->text)); + $docSheet->getComment((string)$comment['ref'])->setText($this->parseRichText($comment->text)); } } @@ -1654,7 +1646,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } break; } - } else if (!isset($definedName['localSheetId'])) { + } elseif (!isset($definedName['localSheetId'])) { // "Global" definedNames $locatedSheet = null; $extractedSheetName = ''; @@ -1732,15 +1724,15 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE return $excel; } - private static function _readColor($color, $background = false) + private static function readColor($color, $background = false) { if (isset($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(); - } else if (isset($color["theme"])) { - if (self::$_theme !== null) { - $returnColour = self::$_theme->getColourByIndex((int)$color["theme"]); + } elseif (isset($color["theme"])) { + if (self::$theme !== null) { + $returnColour = self::$theme->getColourByIndex((int)$color["theme"]); if (isset($color["tint"])) { $tintAdjust = (float) $color["tint"]; $returnColour = PHPExcel_Style_Color::changeBrightness($returnColour, $tintAdjust); @@ -1755,7 +1747,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE return 'FF000000'; } - private static function _readStyle($docStyle, $style) + private static function readStyle($docStyle, $style) { // format code // if (isset($style->numFmt)) { @@ -1779,11 +1771,11 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if (isset($style->font->strike)) { $docStyle->getFont()->setStrikethrough(!isset($style->font->strike["val"]) || self::boolean((string) $style->font->strike["val"])); } - $docStyle->getFont()->getColor()->setARGB(self::_readColor($style->font->color)); + $docStyle->getFont()->getColor()->setARGB(self::readColor($style->font->color)); if (isset($style->font->u) && !isset($style->font->u["val"])) { $docStyle->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); - } else if (isset($style->font->u) && isset($style->font->u["val"])) { + } elseif (isset($style->font->u) && isset($style->font->u["val"])) { $docStyle->getFont()->setUnderline((string)$style->font->u["val"]); } @@ -1807,18 +1799,18 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } $docStyle->getFill()->setRotation(floatval($gradientFill["degree"])); $gradientFill->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); - $docStyle->getFill()->getStartColor()->setARGB(self::_readColor(self::array_item($gradientFill->xpath("sml:stop[@position=0]"))->color)); - $docStyle->getFill()->getEndColor()->setARGB(self::_readColor(self::array_item($gradientFill->xpath("sml:stop[@position=1]"))->color)); + $docStyle->getFill()->getStartColor()->setARGB(self::readColor(self::array_item($gradientFill->xpath("sml:stop[@position=0]"))->color)); + $docStyle->getFill()->getEndColor()->setARGB(self::readColor(self::array_item($gradientFill->xpath("sml:stop[@position=1]"))->color)); } elseif ($style->fill->patternFill) { $patternType = (string)$style->fill->patternFill["patternType"] != '' ? (string)$style->fill->patternFill["patternType"] : 'solid'; $docStyle->getFill()->setFillType($patternType); if ($style->fill->patternFill->fgColor) { - $docStyle->getFill()->getStartColor()->setARGB(self::_readColor($style->fill->patternFill->fgColor, true)); + $docStyle->getFill()->getStartColor()->setARGB(self::readColor($style->fill->patternFill->fgColor, true)); } else { $docStyle->getFill()->getStartColor()->setARGB('FF000000'); } if ($style->fill->patternFill->bgColor) { - $docStyle->getFill()->getEndColor()->setARGB(self::_readColor($style->fill->patternFill->bgColor, true)); + $docStyle->getFill()->getEndColor()->setARGB(self::readColor($style->fill->patternFill->bgColor, true)); } } } @@ -1836,11 +1828,11 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } else { $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_BOTH); } - self::_readBorder($docStyle->getBorders()->getLeft(), $style->border->left); - self::_readBorder($docStyle->getBorders()->getRight(), $style->border->right); - self::_readBorder($docStyle->getBorders()->getTop(), $style->border->top); - self::_readBorder($docStyle->getBorders()->getBottom(), $style->border->bottom); - self::_readBorder($docStyle->getBorders()->getDiagonal(), $style->border->diagonal); + self::readBorder($docStyle->getBorders()->getLeft(), $style->border->left); + self::readBorder($docStyle->getBorders()->getRight(), $style->border->right); + self::readBorder($docStyle->getBorders()->getTop(), $style->border->top); + self::readBorder($docStyle->getBorders()->getBottom(), $style->border->bottom); + self::readBorder($docStyle->getBorders()->getDiagonal(), $style->border->diagonal); } // alignment @@ -1851,7 +1843,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $textRotation = 0; if ((int)$style->alignment["textRotation"] <= 90) { $textRotation = (int)$style->alignment["textRotation"]; - } else if ((int)$style->alignment["textRotation"] > 90) { + } elseif ((int)$style->alignment["textRotation"] > 90) { $textRotation = 90 - (int)$style->alignment["textRotation"]; } @@ -1887,17 +1879,17 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } - private static function _readBorder($docBorder, $eleBorder) + private static function readBorder($docBorder, $eleBorder) { if (isset($eleBorder["style"])) { $docBorder->setBorderStyle((string) $eleBorder["style"]); } if (isset($eleBorder->color)) { - $docBorder->getColor()->setARGB(self::_readColor($eleBorder->color)); + $docBorder->getColor()->setARGB(self::readColor($eleBorder->color)); } } - private function _parseRichText($is = null) + private function parseRichText($is = null) { $value = new PHPExcel_RichText(); @@ -1919,7 +1911,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $objText->getFont()->setSize((string) $run->rPr->sz["val"]); } if (isset($run->rPr->color)) { - $objText->getFont()->setColor(new PHPExcel_Style_Color(self::_readColor($run->rPr->color))); + $objText->getFont()->setColor(new PHPExcel_Style_Color(self::readColor($run->rPr->color))); } if ((isset($run->rPr->b["val"]) && self::boolean((string) $run->rPr->b["val"])) || (isset($run->rPr->b) && !isset($run->rPr->b["val"]))) { @@ -1940,7 +1932,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } if (isset($run->rPr->u) && !isset($run->rPr->u["val"])) { $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); - } else if (isset($run->rPr->u) && isset($run->rPr->u["val"])) { + } elseif (isset($run->rPr->u) && isset($run->rPr->u["val"])) { $objText->getFont()->setUnderline((string)$run->rPr->u["val"]); } if ((isset($run->rPr->strike["val"]) && self::boolean((string) $run->rPr->strike["val"])) || @@ -1955,7 +1947,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE return $value; } - private function _readRibbon($excel, $customUITarget, $zip) + private function readRibbon($excel, $customUITarget, $zip) { $baseDir = dirname($customUITarget); $nameCustomUI = basename($customUITarget); diff --git a/Classes/PHPExcel/Reader/Excel2007/Chart.php b/Classes/PHPExcel/Reader/Excel2007/Chart.php index 4569f267..88f336b3 100644 --- a/Classes/PHPExcel/Reader/Excel2007/Chart.php +++ b/Classes/PHPExcel/Reader/Excel2007/Chart.php @@ -34,7 +34,7 @@ */ class PHPExcel_Reader_Excel2007_Chart { - private static function _getAttribute($component, $name, $format) + private static function getAttribute($component, $name, $format) { $attributes = $component->attributes(); if (isset($attributes[$name])) { @@ -49,14 +49,14 @@ class PHPExcel_Reader_Excel2007_Chart } } return null; - } // function _getAttribute() + } - private static function _readColor($color, $background = false) + private static function readColor($color, $background = false) { if (isset($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(); } } @@ -81,82 +81,82 @@ class PHPExcel_Reader_Excel2007_Chart foreach ($chartDetails as $chartDetailKey => $chartDetail) { switch ($chartDetailKey) { case "layout": - $plotAreaLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta, 'plotArea'); + $plotAreaLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta, 'plotArea'); break; case "catAx": 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; case "dateAx": 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; case "valAx": 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; case "barChart": case "bar3DChart": - $barDirection = self::_getAttribute($chartDetail->barDir, 'val', 'string'); - $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $barDirection = self::getAttribute($chartDetail->barDir, 'val', 'string'); + $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer->setPlotDirection($barDirection); $plotSeries[] = $plotSer; - $plotAttributes = self::_readChartAttributes($chartDetail); + $plotAttributes = self::readChartAttributes($chartDetail); break; case "lineChart": case "line3DChart": - $plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); - $plotAttributes = self::_readChartAttributes($chartDetail); + $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $plotAttributes = self::readChartAttributes($chartDetail); break; case "areaChart": case "area3DChart": - $plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); - $plotAttributes = self::_readChartAttributes($chartDetail); + $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $plotAttributes = self::readChartAttributes($chartDetail); break; case "doughnutChart": case "pieChart": case "pie3DChart": $explosion = isset($chartDetail->ser->explosion); - $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer->setPlotStyle($explosion); $plotSeries[] = $plotSer; - $plotAttributes = self::_readChartAttributes($chartDetail); + $plotAttributes = self::readChartAttributes($chartDetail); break; case "scatterChart": - $scatterStyle = self::_getAttribute($chartDetail->scatterStyle, 'val', 'string'); - $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $scatterStyle = self::getAttribute($chartDetail->scatterStyle, 'val', 'string'); + $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer->setPlotStyle($scatterStyle); $plotSeries[] = $plotSer; - $plotAttributes = self::_readChartAttributes($chartDetail); + $plotAttributes = self::readChartAttributes($chartDetail); break; case "bubbleChart": - $bubbleScale = self::_getAttribute($chartDetail->bubbleScale, 'val', 'integer'); - $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $bubbleScale = self::getAttribute($chartDetail->bubbleScale, 'val', 'integer'); + $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer->setPlotStyle($bubbleScale); $plotSeries[] = $plotSer; - $plotAttributes = self::_readChartAttributes($chartDetail); + $plotAttributes = self::readChartAttributes($chartDetail); break; case "radarChart": - $radarStyle = self::_getAttribute($chartDetail->radarStyle, 'val', 'string'); - $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $radarStyle = self::getAttribute($chartDetail->radarStyle, 'val', 'string'); + $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer->setPlotStyle($radarStyle); $plotSeries[] = $plotSer; - $plotAttributes = self::_readChartAttributes($chartDetail); + $plotAttributes = self::readChartAttributes($chartDetail); break; case "surfaceChart": case "surface3DChart": - $wireFrame = self::_getAttribute($chartDetail->wireframe, 'val', 'boolean'); - $plotSer = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $wireFrame = self::getAttribute($chartDetail->wireframe, 'val', 'boolean'); + $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); $plotSer->setPlotStyle($wireFrame); $plotSeries[] = $plotSer; - $plotAttributes = self::_readChartAttributes($chartDetail); + $plotAttributes = self::readChartAttributes($chartDetail); break; case "stockChart": - $plotSeries[] = self::_chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); - $plotAttributes = self::_readChartAttributes($plotAreaLayout); + $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $plotAttributes = self::readChartAttributes($plotAreaLayout); break; } } @@ -164,16 +164,16 @@ class PHPExcel_Reader_Excel2007_Chart $plotAreaLayout = new PHPExcel_Chart_Layout(); } $plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout, $plotSeries); - self::_setChartAttributes($plotAreaLayout, $plotAttributes); + self::setChartAttributes($plotAreaLayout, $plotAttributes); break; case "plotVisOnly": - $plotVisOnly = self::_getAttribute($chartDetails, 'val', 'string'); + $plotVisOnly = self::getAttribute($chartDetails, 'val', 'string'); break; case "dispBlanksAs": - $dispBlanksAs = self::_getAttribute($chartDetails, 'val', 'string'); + $dispBlanksAs = self::getAttribute($chartDetails, 'val', 'string'); break; case "title": - $title = self::_chartTitle($chartDetails, $namespacesChartMeta, 'title'); + $title = self::chartTitle($chartDetails, $namespacesChartMeta, 'title'); break; case "legend": $legendPos = 'r'; @@ -182,13 +182,13 @@ class PHPExcel_Reader_Excel2007_Chart foreach ($chartDetails as $chartDetailKey => $chartDetail) { switch ($chartDetailKey) { case "legendPos": - $legendPos = self::_getAttribute($chartDetail, 'val', 'string'); + $legendPos = self::getAttribute($chartDetail, 'val', 'string'); break; case "overlay": - $legendOverlay = self::_getAttribute($chartDetail, 'val', 'boolean'); + $legendOverlay = self::getAttribute($chartDetail, 'val', 'boolean'); break; case "layout": - $legendLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta, 'legend'); + $legendLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta, 'legend'); break; } } @@ -201,9 +201,9 @@ class PHPExcel_Reader_Excel2007_Chart $chart = new PHPExcel_Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel); return $chart; - } // function readChart() + } - private static function _chartTitle($titleDetails, $namespacesChartMeta, $type) + private static function chartTitle($titleDetails, $namespacesChartMeta, $type) { $caption = array(); $titleLayout = null; @@ -215,20 +215,20 @@ class PHPExcel_Reader_Excel2007_Chart switch ($titleKey) { case "p": $titleDetailPart = $titleDetail->children($namespacesChartMeta['a']); - $caption[] = self::_parseRichText($titleDetailPart); + $caption[] = self::parseRichText($titleDetailPart); } } break; case "layout": - $titleLayout = self::_chartLayoutDetails($chartDetail, $namespacesChartMeta); + $titleLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta); break; } } 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)) { return null; @@ -239,13 +239,13 @@ class PHPExcel_Reader_Excel2007_Chart } $layout = array(); foreach ($details as $detailKey => $detail) { -// echo $detailKey, ' => ',self::_getAttribute($detail, 'val', 'string'),PHP_EOL; - $layout[$detailKey] = self::_getAttribute($detail, 'val', 'string'); +// echo $detailKey, ' => ',self::getAttribute($detail, 'val', 'string'),PHP_EOL; + $layout[$detailKey] = self::getAttribute($detail, 'val', 'string'); } return new PHPExcel_Chart_Layout($layout); - } // function _chartLayoutDetails() + } - private static function _chartDataSeries($chartDetail, $namespacesChartMeta, $plotType) + private static function chartDataSeries($chartDetail, $namespacesChartMeta, $plotType) { $multiSeriesType = null; $smoothLine = false; @@ -255,76 +255,78 @@ class PHPExcel_Reader_Excel2007_Chart foreach ($seriesDetailSet as $seriesDetailKey => $seriesDetails) { switch ($seriesDetailKey) { case "grouping": - $multiSeriesType = self::_getAttribute($chartDetail->grouping, 'val', 'string'); + $multiSeriesType = self::getAttribute($chartDetail->grouping, 'val', 'string'); break; case "ser": $marker = null; foreach ($seriesDetails as $seriesKey => $seriesDetail) { switch ($seriesKey) { case "idx": - $seriesIndex = self::_getAttribute($seriesDetail, 'val', 'integer'); + $seriesIndex = self::getAttribute($seriesDetail, 'val', 'integer'); break; case "order": - $seriesOrder = self::_getAttribute($seriesDetail, 'val', 'integer'); + $seriesOrder = self::getAttribute($seriesDetail, 'val', 'integer'); $plotOrder[$seriesIndex] = $seriesOrder; break; case "tx": - $seriesLabel[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta); + $seriesLabel[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta); break; case "marker": - $marker = self::_getAttribute($seriesDetail->symbol, 'val', 'string'); + $marker = self::getAttribute($seriesDetail->symbol, 'val', 'string'); break; case "smooth": - $smoothLine = self::_getAttribute($seriesDetail, 'val', 'boolean'); + $smoothLine = self::getAttribute($seriesDetail, 'val', 'boolean'); break; case "cat": - $seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta); + $seriesCategory[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta); break; case "val": - $seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); + $seriesValues[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); break; case "xVal": - $seriesCategory[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); + $seriesCategory[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); break; case "yVal": - $seriesValues[$seriesIndex] = self::_chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); + $seriesValues[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); break; } } } } 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)) { $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); } elseif (isset($seriesDetail->numRef)) { $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); } elseif (isset($seriesDetail->multiLvlStrRef)) { $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']); return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); } elseif (isset($seriesDetail->multiLvlNumRef)) { $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']); return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine); } return null; - } // function _chartDataSeriesValueSet() + } - private static function _chartDataSeriesValues($seriesValueSet, $dataType = 'n') + + private static function chartDataSeriesValues($seriesValueSet, $dataType = 'n') { $seriesVal = array(); $formatCode = ''; @@ -333,13 +335,13 @@ class PHPExcel_Reader_Excel2007_Chart foreach ($seriesValueSet as $seriesValueIdx => $seriesValue) { switch ($seriesValueIdx) { case 'ptCount': - $pointCount = self::_getAttribute($seriesValue, 'val', 'integer'); + $pointCount = self::getAttribute($seriesValue, 'val', 'integer'); break; case 'formatCode': $formatCode = (string) $seriesValue; break; case 'pt': - $pointVal = self::_getAttribute($seriesValue, 'idx', 'integer'); + $pointVal = self::getAttribute($seriesValue, 'idx', 'integer'); if ($dataType == 's') { $seriesVal[$pointVal] = (string) $seriesValue->v; } else { @@ -358,9 +360,9 @@ class PHPExcel_Reader_Excel2007_Chart 'pointCount' => $pointCount, 'dataValues' => $seriesVal ); - } // function _chartDataSeriesValues() + } - private static function _chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType = 'n') + private static function chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType = 'n') { $seriesVal = array(); $formatCode = ''; @@ -370,13 +372,13 @@ class PHPExcel_Reader_Excel2007_Chart foreach ($seriesLevel as $seriesValueIdx => $seriesValue) { switch ($seriesValueIdx) { case 'ptCount': - $pointCount = self::_getAttribute($seriesValue, 'val', 'integer'); + $pointCount = self::getAttribute($seriesValue, 'val', 'integer'); break; case 'formatCode': $formatCode = (string) $seriesValue; break; case 'pt': - $pointVal = self::_getAttribute($seriesValue, 'idx', 'integer'); + $pointVal = self::getAttribute($seriesValue, 'idx', 'integer'); if ($dataType == 's') { $seriesVal[$pointVal][] = (string) $seriesValue->v; } else { @@ -392,9 +394,9 @@ class PHPExcel_Reader_Excel2007_Chart 'pointCount' => $pointCount, 'dataValues' => $seriesVal ); - } // function _chartDataSeriesValuesMultiLevel() + } - private static function _parseRichText($titleDetailPart = null) + private static function parseRichText($titleDetailPart = null) { $value = new PHPExcel_RichText(); @@ -407,27 +409,27 @@ class PHPExcel_Reader_Excel2007_Chart $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)) { $objText->getFont()->setSize(floor($fontSize / 100)); } - $fontColor = (self::_getAttribute($titleDetailElement->rPr, 'color', 'string')); + $fontColor = (self::getAttribute($titleDetailElement->rPr, 'color', 'string')); 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)) { $objText->getFont()->setBold($bold); } - $italic = self::_getAttribute($titleDetailElement->rPr, 'i', 'boolean'); + $italic = self::getAttribute($titleDetailElement->rPr, 'i', 'boolean'); if (!is_null($italic)) { $objText->getFont()->setItalic($italic); } - $baseline = self::_getAttribute($titleDetailElement->rPr, 'baseline', 'integer'); + $baseline = self::getAttribute($titleDetailElement->rPr, 'baseline', 'integer'); if (!is_null($baseline)) { if ($baseline > 0) { $objText->getFont()->setSuperScript(true); @@ -436,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 ($underscore == 'sng') { $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE); @@ -447,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 ($strikethrough == 'noStrike') { $objText->getFont()->setStrikethrough(false); @@ -461,37 +463,37 @@ class PHPExcel_Reader_Excel2007_Chart return $value; } - private static function _readChartAttributes($chartDetail) + private static function readChartAttributes($chartDetail) { $plotAttributes = array(); if (isset($chartDetail->dLbls)) { 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)) { - $plotAttributes['showVal'] = self::_getAttribute($chartDetail->dLbls->showVal, 'val', 'string'); + $plotAttributes['showVal'] = self::getAttribute($chartDetail->dLbls->showVal, 'val', 'string'); } 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)) { - $plotAttributes['showSerName'] = self::_getAttribute($chartDetail->dLbls->showSerName, 'val', 'string'); + $plotAttributes['showSerName'] = self::getAttribute($chartDetail->dLbls->showSerName, 'val', 'string'); } 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)) { - $plotAttributes['showBubbleSize'] = self::_getAttribute($chartDetail->dLbls->showBubbleSize, 'val', 'string'); + $plotAttributes['showBubbleSize'] = self::getAttribute($chartDetail->dLbls->showBubbleSize, 'val', 'string'); } 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; } - private static function _setChartAttributes($plotArea, $plotAttributes) + private static function setChartAttributes($plotArea, $plotAttributes) { foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) { switch ($plotAttributeKey) { diff --git a/Classes/PHPExcel/Reader/Excel2007/Theme.php b/Classes/PHPExcel/Reader/Excel2007/Theme.php index d5879ad4..134f4b60 100644 --- a/Classes/PHPExcel/Reader/Excel2007/Theme.php +++ b/Classes/PHPExcel/Reader/Excel2007/Theme.php @@ -40,21 +40,21 @@ class PHPExcel_Reader_Excel2007_Theme * * @var string */ - private $_themeName; + private $themeName; /** * Colour Scheme Name * * @var string */ - private $_colourSchemeName; + private $colourSchemeName; /** * Colour Map indexed by position * * @var array of string */ - private $_colourMapValues; + private $colourMapValues; /** @@ -62,7 +62,7 @@ class PHPExcel_Reader_Excel2007_Theme * * @var array of string */ - private $_colourMap; + private $colourMap; /** @@ -72,9 +72,9 @@ class PHPExcel_Reader_Excel2007_Theme public function __construct($themeName, $colourSchemeName, $colourMap) { // Initialise values - $this->_themeName = $themeName; - $this->_colourSchemeName = $colourSchemeName; - $this->_colourMap = $colourMap; + $this->themeName = $themeName; + $this->colourSchemeName = $colourSchemeName; + $this->colourMap = $colourMap; } /** @@ -84,7 +84,7 @@ class PHPExcel_Reader_Excel2007_Theme */ public function getThemeName() { - return $this->_themeName; + return $this->themeName; } /** @@ -94,7 +94,7 @@ class PHPExcel_Reader_Excel2007_Theme */ public function getColourSchemeName() { - return $this->_colourSchemeName; + return $this->colourSchemeName; } /** @@ -104,8 +104,8 @@ class PHPExcel_Reader_Excel2007_Theme */ 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; } diff --git a/Classes/PHPExcel/Reader/Excel5.php b/Classes/PHPExcel/Reader/Excel5.php index 2f8a2f8a..3728b6cc 100644 --- a/Classes/PHPExcel/Reader/Excel5.php +++ b/Classes/PHPExcel/Reader/Excel5.php @@ -2192,9 +2192,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $rotation = 0; if ($angle <= 90) { $rotation = $angle; - } else if ($angle <= 180) { + } elseif ($angle <= 180) { $rotation = 90 - $angle; - } else if ($angle == 255) { + } elseif ($angle == 255) { $rotation = -165; } $objStyle->getAlignment()->setTextRotation($rotation); @@ -4598,11 +4598,11 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce if ($isUNC) { $hyperlinkType = 'UNC'; - } else if (!$isFileLinkOrUrl) { + } elseif (!$isFileLinkOrUrl) { $hyperlinkType = 'workbook'; - } else if (ord($recordData{$offset}) == 0x03) { + } elseif (ord($recordData{$offset}) == 0x03) { $hyperlinkType = 'local'; - } else if (ord($recordData{$offset}) == 0xE0) { + } elseif (ord($recordData{$offset}) == 0xE0) { $hyperlinkType = 'URL'; } diff --git a/Classes/PHPExcel/Reader/Excel5/Escher.php b/Classes/PHPExcel/Reader/Excel5/Escher.php index f7f45dcd..b4575e6a 100644 --- a/Classes/PHPExcel/Reader/Excel5/Escher.php +++ b/Classes/PHPExcel/Reader/Excel5/Escher.php @@ -1,6 +1,7 @@ _object = $object; + $this->object = $object; } /** @@ -98,117 +91,117 @@ class PHPExcel_Reader_Excel5_Escher */ public function load($data) { - $this->_data = $data; + $this->data = $data; // 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 - while ($this->_pos < $this->_dataSize) { + while ($this->pos < $this->dataSize) { // 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) { case self::DGGCONTAINER: - $this->_readDggContainer(); + $this->readDggContainer(); break; case self::DGG: - $this->_readDgg(); + $this->readDgg(); break; case self::BSTORECONTAINER: - $this->_readBstoreContainer(); + $this->readBstoreContainer(); break; case self::BSE: - $this->_readBSE(); + $this->readBSE(); break; case self::BLIPJPEG: - $this->_readBlipJPEG(); + $this->readBlipJPEG(); break; case self::BLIPPNG: - $this->_readBlipPNG(); + $this->readBlipPNG(); break; case self::OPT: - $this->_readOPT(); + $this->readOPT(); break; case self::TERTIARYOPT: - $this->_readTertiaryOPT(); + $this->readTertiaryOPT(); break; case self::SPLITMENUCOLORS: - $this->_readSplitMenuColors(); + $this->readSplitMenuColors(); break; case self::DGCONTAINER: - $this->_readDgContainer(); + $this->readDgContainer(); break; case self::DG: - $this->_readDg(); + $this->readDg(); break; case self::SPGRCONTAINER: - $this->_readSpgrContainer(); + $this->readSpgrContainer(); break; case self::SPCONTAINER: - $this->_readSpContainer(); + $this->readSpContainer(); break; case self::SPGR: - $this->_readSpgr(); + $this->readSpgr(); break; case self::SP: - $this->_readSp(); + $this->readSp(); break; case self::CLIENTTEXTBOX: - $this->_readClientTextbox(); + $this->readClientTextbox(); break; case self::CLIENTANCHOR: - $this->_readClientAnchor(); + $this->readClientAnchor(); break; case self::CLIENTDATA: - $this->_readClientData(); + $this->readClientData(); break; default: - $this->_readDefault(); + $this->readDefault(); break; } } - return $this->_object; + return $this->object; } /** * Read a generic record */ - private function _readDefault() + private function readDefault() { // 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 - $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 $recVer = (0x000F & $verInstance) >> 0; - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; } /** * Read DggContainer record (Drawing Group Container) */ - private function _readDggContainer() + private function readDggContainer() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; // record is a container, read contents $dggContainer = new PHPExcel_Shared_Escher_DggContainer(); - $this->_object->setDggContainer($dggContainer); + $this->object->setDggContainer($dggContainer); $reader = new PHPExcel_Reader_Excel5_Escher($dggContainer); $reader->load($recordData); } @@ -216,29 +209,29 @@ class PHPExcel_Reader_Excel5_Escher /** * Read Dgg record (Drawing Group) */ - private function _readDgg() + private function readDgg() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; } /** * Read BstoreContainer record (Blip Store Container) */ - private function _readBstoreContainer() + private function readBstoreContainer() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; // record is a container, read contents $bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer(); - $this->_object->setBstoreContainer($bstoreContainer); + $this->object->setBstoreContainer($bstoreContainer); $reader = new PHPExcel_Reader_Excel5_Escher($bstoreContainer); $reader->load($recordData); } @@ -246,22 +239,22 @@ class PHPExcel_Reader_Excel5_Escher /** * Read BSE record */ - private function _readBSE() + private function readBSE() { // offset: 0; size: 2; recVer and 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); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; // add BSE to BstoreContainer $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE(); - $this->_object->addBSE($BSE); + $this->object->addBSE($BSE); $BSE->setBLIPType($recInstance); @@ -312,18 +305,18 @@ class PHPExcel_Reader_Excel5_Escher /** * Read BlipJPEG record. Holds raw JPEG image data */ - private function _readBlipJPEG() + private function readBlipJPEG() { // offset: 0; size: 2; recVer and 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); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; $pos = 0; @@ -347,24 +340,24 @@ class PHPExcel_Reader_Excel5_Escher $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); $blip->setData($data); - $this->_object->setBlip($blip); + $this->object->setBlip($blip); } /** * Read BlipPNG record. Holds raw PNG image data */ - private function _readBlipPNG() + private function readBlipPNG() { // offset: 0; size: 2; recVer and 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); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; $pos = 0; @@ -388,71 +381,71 @@ class PHPExcel_Reader_Excel5_Escher $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip(); $blip->setData($data); - $this->_object->setBlip($blip); + $this->object->setBlip($blip); } /** * 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 // 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); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // 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 */ - private function _readTertiaryOPT() + private function readTertiaryOPT() { // offset: 0; size: 2; recVer and 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); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; } /** * Read SplitMenuColors record */ - private function _readSplitMenuColors() + private function readSplitMenuColors() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; } /** * Read DgContainer record (Drawing Container) */ - private function _readDgContainer() + private function readDgContainer() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; // record is a container, read contents $dgContainer = new PHPExcel_Shared_Escher_DgContainer(); - $this->_object->setDgContainer($dgContainer); + $this->object->setDgContainer($dgContainer); $reader = new PHPExcel_Reader_Excel5_Escher($dgContainer); $escher = $reader->load($recordData); } @@ -460,37 +453,37 @@ class PHPExcel_Reader_Excel5_Escher /** * Read Dg record (Drawing) */ - private function _readDg() + private function readDg() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; } /** * Read SpgrContainer record (Shape Group Container) */ - private function _readSpgrContainer() + private function readSpgrContainer() { // context is either context DgContainer or SpgrContainer - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; // record is a container, read contents $spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer(); - if ($this->_object instanceof PHPExcel_Shared_Escher_DgContainer) { + if ($this->object instanceof PHPExcel_Shared_Escher_DgContainer) { // DgContainer - $this->_object->setSpgrContainer($spgrContainer); + $this->object->setSpgrContainer($spgrContainer); } else { // SpgrContainer - $this->_object->addChild($spgrContainer); + $this->object->addChild($spgrContainer); } $reader = new PHPExcel_Reader_Excel5_Escher($spgrContainer); @@ -500,17 +493,17 @@ class PHPExcel_Reader_Excel5_Escher /** * Read SpContainer record (Shape Container) */ - private function _readSpContainer() + private function readSpContainer() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // add spContainer to spgrContainer $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer(); - $this->_object->addChild($spContainer); + $this->object->addChild($spContainer); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; // record is a container, read contents $reader = new PHPExcel_Reader_Excel5_Escher($spContainer); @@ -520,59 +513,59 @@ class PHPExcel_Reader_Excel5_Escher /** * Read Spgr record (Shape Group) */ - private function _readSpgr() + private function readSpgr() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; } /** * Read Sp record (Shape) */ - private function _readSp() + private function readSp() { // offset: 0; size: 2; recVer and 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); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; } /** * Read ClientTextbox record */ - private function _readClientTextbox() + private function readClientTextbox() { // offset: 0; size: 2; recVer and 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); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // 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 */ - private function _readClientAnchor() + private function readClientAnchor() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // 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) $c1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 2); @@ -599,34 +592,34 @@ class PHPExcel_Reader_Excel5_Escher $endOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 16); // 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 - $this->_object->setStartOffsetX($startOffsetX); + $this->object->setStartOffsetX($startOffsetX); // set the start offsetY - $this->_object->setStartOffsetY($startOffsetY); + $this->object->setStartOffsetY($startOffsetY); // 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 - $this->_object->setEndOffsetX($endOffsetX); + $this->object->setEndOffsetX($endOffsetX); // set the end offsetY - $this->_object->setEndOffsetY($endOffsetY); + $this->object->setEndOffsetY($endOffsetY); } /** * Read ClientData record */ - private function _readClientData() + private function readClientData() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4); - $recordData = substr($this->_data, $this->_pos + 8, $length); + $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record - $this->_pos += 8 + $length; + $this->pos += 8 + $length; } /** @@ -635,7 +628,7 @@ class PHPExcel_Reader_Excel5_Escher * @param string $data Binary data * @param int $n Number of properties */ - private function _readOfficeArtRGFOPTE($data, $n) + private function readOfficeArtRGFOPTE($data, $n) { $splicedComplexData = substr($data, 6 * $n); @@ -670,7 +663,7 @@ class PHPExcel_Reader_Excel5_Escher $value = $op; } - $this->_object->setOPT($opidOpid, $value); + $this->object->setOPT($opidOpid, $value); } } } diff --git a/Classes/PHPExcel/Reader/Excel5/MD5.php b/Classes/PHPExcel/Reader/Excel5/MD5.php index 3570c52e..1141d43a 100644 --- a/Classes/PHPExcel/Reader/Excel5/MD5.php +++ b/Classes/PHPExcel/Reader/Excel5/MD5.php @@ -1,6 +1,7 @@ _readFilter = new PHPExcel_Reader_DefaultReadFilter(); - $this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $this->referenceHelper = PHPExcel_ReferenceHelper::getInstance(); } /** @@ -425,16 +417,16 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx $type = PHPExcel_Cell_DataType::TYPE_FORMULA; if ($ExprID > '') { if (((string) $cell) > '') { - $this->_expressions[$ExprID] = array( + $this->expressions[$ExprID] = array( 'column' => $cellAttributes->Col, 'row' => $cellAttributes->Row, 'formula' => (string) $cell ); // echo 'NEW EXPRESSION ', $ExprID,'
'; } else { - $expression = $this->_expressions[$ExprID]; + $expression = $this->expressions[$ExprID]; - $cell = $this->_referenceHelper->updateFormulaReferences($expression['formula'], 'A1', $cellAttributes->Col - $expression['column'], $cellAttributes->Row - $expression['row'], $worksheetName); + $cell = $this->referenceHelper->updateFormulaReferences($expression['formula'], 'A1', $cellAttributes->Col - $expression['column'], $cellAttributes->Row - $expression['row'], $worksheetName); // echo 'SHARED EXPRESSION ', $ExprID,'
'; // echo 'New Value is ', $cell,'
'; } diff --git a/Classes/PHPExcel/Reader/OOCalc.php b/Classes/PHPExcel/Reader/OOCalc.php index ea6d0805..66b7afe8 100644 --- a/Classes/PHPExcel/Reader/OOCalc.php +++ b/Classes/PHPExcel/Reader/OOCalc.php @@ -1,6 +1,16 @@ '; - $objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setText($this->_parseRichText($text)); + $objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setText($this->parseRichText($text)); // ->setAuthor( $author ) } @@ -693,7 +685,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce return $objPHPExcel; } - private function _parseRichText($is = '') + private function parseRichText($is = '') { $value = new PHPExcel_RichText(); diff --git a/Classes/PHPExcel/Reader/SYLK.php b/Classes/PHPExcel/Reader/SYLK.php index 2fc4967f..a7f3f172 100644 --- a/Classes/PHPExcel/Reader/SYLK.php +++ b/Classes/PHPExcel/Reader/SYLK.php @@ -49,28 +49,28 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ * * @var string */ - private $_inputEncoding = 'ANSI'; + private $inputEncoding = 'ANSI'; /** * Sheet index to read * * @var int */ - private $_sheetIndex = 0; + private $sheetIndex = 0; /** * Formats * * @var array */ - private $_formats = array(); + private $formats = array(); /** * Format Count * * @var int */ - private $_format = 0; + private $format = 0; /** * Create a new PHPExcel_Reader_SYLK @@ -112,7 +112,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ */ public function setInputEncoding($pValue = 'ANSI') { - $this->_inputEncoding = $pValue; + $this->inputEncoding = $pValue; return $this; } @@ -123,7 +123,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ */ public function getInputEncoding() { - return $this->_inputEncoding; + return $this->inputEncoding; } /** @@ -231,10 +231,10 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ rewind($fileHandle); // Create new PHPExcel - while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { + while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) { $objPHPExcel->createSheet(); } - $objPHPExcel->setActiveSheetIndex($this->_sheetIndex); + $objPHPExcel->setActiveSheetIndex($this->sheetIndex); $fromFormats = array('\-', '\ '); $toFormats = array('-', ' '); @@ -295,7 +295,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ break; } } - $this->_formats['P'.$this->_format++] = $formatArray; + $this->formats['P'.$this->format++] = $formatArray; // Read cell value data } elseif ($dataType == 'C') { $hasCalculatedValue = false; @@ -361,12 +361,12 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ } } $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1); - $cellData = PHPExcel_Calculation::_unwrapResult($cellData); + $cellData = PHPExcel_Calculation::unwrapResult($cellData); // Set cell value $objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData); if ($hasCalculatedValue) { - $cellData = PHPExcel_Calculation::_unwrapResult($cellData); + $cellData = PHPExcel_Calculation::unwrapResult($cellData); $objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData); } // Read cell formatting @@ -418,8 +418,8 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ } if (($formatStyle > '') && ($column > '') && ($row > '')) { $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1); - if (isset($this->_formats[$formatStyle])) { - $objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->_formats[$formatStyle]); + if (isset($this->formats[$formatStyle])) { + $objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->formats[$formatStyle]); } } if ((!empty($styleData)) && ($column > '') && ($row > '')) { @@ -469,7 +469,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ */ public function getSheetIndex() { - return $this->_sheetIndex; + return $this->sheetIndex; } /** @@ -480,7 +480,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ */ public function setSheetIndex($pValue = 0) { - $this->_sheetIndex = $pValue; + $this->sheetIndex = $pValue; return $this; } } diff --git a/Classes/PHPExcel/ReferenceHelper.php b/Classes/PHPExcel/ReferenceHelper.php index 2964131a..7d7de93b 100644 --- a/Classes/PHPExcel/ReferenceHelper.php +++ b/Classes/PHPExcel/ReferenceHelper.php @@ -39,7 +39,7 @@ class PHPExcel_ReferenceHelper * * @var PHPExcel_ReferenceHelper */ - private static $_instance; + private static $instance; /** * Get an instance of this class @@ -48,11 +48,11 @@ class PHPExcel_ReferenceHelper */ public static function getInstance() { - if (!isset(self::$_instance) || (self::$_instance === null)) { - self::$_instance = new PHPExcel_ReferenceHelper(); + if (!isset(self::$instance) || (self::$instance === null)) { + 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 $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(); ($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 $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(); $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 $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(); ($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 $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(); ($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 $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(); $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 $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(); ($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 $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); if (!empty($aColumnDimensions)) { @@ -343,7 +343,7 @@ class PHPExcel_ReferenceHelper * @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) */ - protected function _adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + protected function adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) { $aRowDimensions = array_reverse($pSheet->getRowDimensions(), true); if (!empty($aRowDimensions)) { @@ -513,28 +513,28 @@ class PHPExcel_ReferenceHelper } // Update worksheet: column dimensions - $this->_adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + $this->adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); // Update worksheet: row dimensions - $this->_adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + $this->adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); // Update worksheet: page breaks - $this->_adjustPageBreaks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + $this->adjustPageBreaks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); // Update worksheet: comments - $this->_adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + $this->adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); // Update worksheet: hyperlinks - $this->_adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + $this->adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); // Update worksheet: data validations - $this->_adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + $this->adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); // Update worksheet: merge cells - $this->_adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + $this->adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); // Update worksheet: protected cells - $this->_adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + $this->adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); // Update worksheet: autofilter $autoFilter = $pSheet->getAutoFilter(); @@ -785,10 +785,10 @@ class PHPExcel_ReferenceHelper // Is it a range or a single cell? } elseif (strpos($pCellRange, ':') === false && strpos($pCellRange, ',') === false) { // Single cell - return $this->_updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows); + return $this->updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows); } elseif (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) { // Range - return $this->_updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows); + return $this->updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows); } else { // Return original return $pCellRange; @@ -833,7 +833,7 @@ class PHPExcel_ReferenceHelper * @return string Updated cell range * @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) { // Update range @@ -843,13 +843,13 @@ class PHPExcel_ReferenceHelper $jc = count($range[$i]); for ($j = 0; $j < $jc; ++$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]; } 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]; } 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 * @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) { // Get coordinates of $pBefore diff --git a/Classes/PHPExcel/Shared/Escher.php b/Classes/PHPExcel/Shared/Escher.php index 948d409b..1aedb9d2 100644 --- a/Classes/PHPExcel/Shared/Escher.php +++ b/Classes/PHPExcel/Shared/Escher.php @@ -1,6 +1,7 @@ _dggContainer; + return $this->dggContainer; } /** @@ -65,7 +58,7 @@ class PHPExcel_Shared_Escher */ public function setDggContainer($dggContainer) { - return $this->_dggContainer = $dggContainer; + return $this->dggContainer = $dggContainer; } /** @@ -75,7 +68,7 @@ class PHPExcel_Shared_Escher */ public function getDgContainer() { - return $this->_dgContainer; + return $this->dgContainer; } /** @@ -85,6 +78,6 @@ class PHPExcel_Shared_Escher */ public function setDgContainer($dgContainer) { - return $this->_dgContainer = $dgContainer; + return $this->dgContainer = $dgContainer; } } diff --git a/Classes/PHPExcel/Shared/Escher/DgContainer.php b/Classes/PHPExcel/Shared/Escher/DgContainer.php index e4d17bc1..739cd902 100644 --- a/Classes/PHPExcel/Shared/Escher/DgContainer.php +++ b/Classes/PHPExcel/Shared/Escher/DgContainer.php @@ -1,6 +1,7 @@ _dgId; + return $this->dgId; } public function setDgId($value) { - $this->_dgId = $value; + $this->dgId = $value; } public function getLastSpId() { - return $this->_lastSpId; + return $this->lastSpId; } public function setLastSpId($value) { - $this->_lastSpId = $value; + $this->lastSpId = $value; } public function getSpgrContainer() { - return $this->_spgrContainer; + return $this->spgrContainer; } public function setSpgrContainer($spgrContainer) { - return $this->_spgrContainer = $spgrContainer; + return $this->spgrContainer = $spgrContainer; } } diff --git a/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php b/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php index efa1683f..49e7d685 100644 --- a/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php +++ b/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php @@ -1,6 +1,7 @@ _parent = $parent; + $this->parent = $parent; } /** @@ -65,7 +58,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer */ public function getParent() { - return $this->_parent; + return $this->parent; } /** @@ -75,7 +68,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer */ public function addChild($child) { - $this->_children[] = $child; + $this->children[] = $child; $child->setParent($this); } @@ -84,7 +77,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer */ public function getChildren() { - return $this->_children; + return $this->children; } /** @@ -96,7 +89,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer { $allSpContainers = array(); - foreach ($this->_children as $child) { + foreach ($this->children as $child) { if ($child instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) { $allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers()); } else { diff --git a/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php b/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php index 97136ee0..a1f1a460 100644 --- a/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php +++ b/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php @@ -1,6 +1,7 @@ _parent = $parent; + $this->parent = $parent; } /** @@ -135,7 +128,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ 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) { - $this->_spgr = $value; + $this->spgr = $value; } /** @@ -155,7 +148,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ public function getSpgr() { - return $this->_spgr; + return $this->spgr; } /** @@ -165,7 +158,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ public function setSpType($value) { - $this->_spType = $value; + $this->spType = $value; } /** @@ -175,7 +168,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ public function getSpType() { - return $this->_spType; + return $this->spType; } /** @@ -185,7 +178,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ public function setSpFlag($value) { - $this->_spFlag = $value; + $this->spFlag = $value; } /** @@ -195,7 +188,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ public function getSpFlag() { - return $this->_spFlag; + return $this->spFlag; } /** @@ -205,7 +198,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ public function setSpId($value) { - $this->_spId = $value; + $this->spId = $value; } /** @@ -215,7 +208,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ 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) { - $this->_OPT[$property] = $value; + $this->OPT[$property] = $value; } /** @@ -237,8 +230,8 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ public function getOPT($property) { - if (isset($this->_OPT[$property])) { - return $this->_OPT[$property]; + if (isset($this->OPT[$property])) { + return $this->OPT[$property]; } return null; } @@ -250,7 +243,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ 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') { - $this->_startCoordinates = $value; + $this->startCoordinates = $value; } /** @@ -270,7 +263,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ 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) { - $this->_startOffsetX = $startOffsetX; + $this->startOffsetX = $startOffsetX; } /** @@ -290,7 +283,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ 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) { - $this->_startOffsetY = $startOffsetY; + $this->startOffsetY = $startOffsetY; } /** @@ -310,7 +303,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ 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') { - $this->_endCoordinates = $value; + $this->endCoordinates = $value; } /** @@ -330,7 +323,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ 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) { - $this->_endOffsetX = $endOffsetX; + $this->endOffsetX = $endOffsetX; } /** @@ -350,7 +343,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ 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) { - $this->_endOffsetY = $endOffsetY; + $this->endOffsetY = $endOffsetY; } /** @@ -370,7 +363,7 @@ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */ public function getEndOffsetY() { - return $this->_endOffsetY; + return $this->endOffsetY; } /** diff --git a/Classes/PHPExcel/Shared/Escher/DggContainer.php b/Classes/PHPExcel/Shared/Escher/DggContainer.php index dae6a5a4..b116b1bd 100644 --- a/Classes/PHPExcel/Shared/Escher/DggContainer.php +++ b/Classes/PHPExcel/Shared/Escher/DggContainer.php @@ -1,6 +1,7 @@ _spIdMax; + return $this->spIdMax; } /** @@ -93,7 +86,7 @@ class PHPExcel_Shared_Escher_DggContainer */ public function setSpIdMax($value) { - $this->_spIdMax = $value; + $this->spIdMax = $value; } /** @@ -103,7 +96,7 @@ class PHPExcel_Shared_Escher_DggContainer */ public function getCDgSaved() { - return $this->_cDgSaved; + return $this->cDgSaved; } /** @@ -113,7 +106,7 @@ class PHPExcel_Shared_Escher_DggContainer */ public function setCDgSaved($value) { - $this->_cDgSaved = $value; + $this->cDgSaved = $value; } /** @@ -123,7 +116,7 @@ class PHPExcel_Shared_Escher_DggContainer */ public function getCSpSaved() { - return $this->_cSpSaved; + return $this->cSpSaved; } /** @@ -133,7 +126,7 @@ class PHPExcel_Shared_Escher_DggContainer */ public function setCSpSaved($value) { - $this->_cSpSaved = $value; + $this->cSpSaved = $value; } /** @@ -143,7 +136,7 @@ class PHPExcel_Shared_Escher_DggContainer */ public function getBstoreContainer() { - return $this->_bstoreContainer; + return $this->bstoreContainer; } /** @@ -153,7 +146,7 @@ class PHPExcel_Shared_Escher_DggContainer */ public function setBstoreContainer($bstoreContainer) { - $this->_bstoreContainer = $bstoreContainer; + $this->bstoreContainer = $bstoreContainer; } /** @@ -164,7 +157,7 @@ class PHPExcel_Shared_Escher_DggContainer */ 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) { - if (isset($this->_OPT[$property])) { - return $this->_OPT[$property]; + if (isset($this->OPT[$property])) { + return $this->OPT[$property]; } return null; } @@ -188,7 +181,7 @@ class PHPExcel_Shared_Escher_DggContainer */ public function getIDCLs() { - return $this->_IDCLs; + return $this->IDCLs; } /** @@ -198,6 +191,6 @@ class PHPExcel_Shared_Escher_DggContainer */ public function setIDCLs($pValue) { - $this->_IDCLs = $pValue; + $this->IDCLs = $pValue; } } diff --git a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php index 3f8f81da..1af2432b 100644 --- a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php +++ b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php @@ -1,6 +1,7 @@ _BSECollection[] = $BSE; + $this->BSECollection[] = $BSE; $BSE->setParent($this); } @@ -59,6 +52,6 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer */ public function getBSECollection() { - return $this->_BSECollection; + return $this->BSECollection; } } diff --git a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php index 1b0fbe2c..9f8afa5d 100644 --- a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php +++ b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php @@ -1,6 +1,7 @@ _blip; + return $this->blip; } /** @@ -93,7 +86,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE */ public function setBlip($blip) { - $this->_blip = $blip; + $this->blip = $blip; $blip->setParent($this); } @@ -104,7 +97,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE */ public function getBlipType() { - return $this->_blipType; + return $this->blipType; } /** @@ -114,6 +107,6 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE */ public function setBlipType($blipType) { - $this->_blipType = $blipType; + $this->blipType = $blipType; } } diff --git a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php index 172c03e2..3bcbbbe2 100644 --- a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php +++ b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php @@ -1,6 +1,7 @@ _data; + return $this->data; } /** @@ -65,7 +58,7 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip */ 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) { - $this->_parent = $parent; + $this->parent = $parent; } /** @@ -85,6 +78,6 @@ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip */ public function getParent() { - return $this->_parent; + return $this->parent; } } diff --git a/Classes/PHPExcel/Shared/Excel5.php b/Classes/PHPExcel/Shared/Excel5.php index 819092dd..c3ff209f 100644 --- a/Classes/PHPExcel/Shared/Excel5.php +++ b/Classes/PHPExcel/Shared/Excel5.php @@ -1,6 +1,7 @@ getWidth(); $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 $defaultColumnDimension = $sheet->getDefaultColumnDimension(); $width = $defaultColumnDimension->getWidth(); @@ -98,7 +91,7 @@ class PHPExcel_Shared_Excel5 $rowDimension = $rowDimensions[$row]; $rowHeight = $rowDimension->getRowHeight(); $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 $defaultRowDimension = $sheet->getDefaultRowDimension(); $rowHeight = $defaultRowDimension->getRowHeight(); diff --git a/Classes/PHPExcel/Shared/Font.php b/Classes/PHPExcel/Shared/Font.php index 23d087e7..7efb3c96 100644 --- a/Classes/PHPExcel/Shared/Font.php +++ b/Classes/PHPExcel/Shared/Font.php @@ -39,7 +39,7 @@ class PHPExcel_Shared_Font const AUTOSIZE_METHOD_APPROX = 'approx'; const AUTOSIZE_METHOD_EXACT = 'exact'; - private static $_autoSizeMethods = array( + private static $autoSizeMethods = array( self::AUTOSIZE_METHOD_APPROX, self::AUTOSIZE_METHOD_EXACT, ); @@ -196,7 +196,7 @@ class PHPExcel_Shared_Font */ public static function setAutoSizeMethod($pValue = self::AUTOSIZE_METHOD_APPROX) { - if (!in_array($pValue, self::$_autoSizeMethods)) { + if (!in_array($pValue, self::$autoSizeMethods)) { return false; } self::$autoSizeMethod = $pValue; diff --git a/Classes/PHPExcel/Shared/JAMA/EigenvalueDecomposition.php b/Classes/PHPExcel/Shared/JAMA/EigenvalueDecomposition.php index b8e42d23..d4ae3979 100644 --- a/Classes/PHPExcel/Shared/JAMA/EigenvalueDecomposition.php +++ b/Classes/PHPExcel/Shared/JAMA/EigenvalueDecomposition.php @@ -444,7 +444,7 @@ class EigenvalueDecomposition --$n; $iter = 0; // Two roots found - } else if ($l == $n-1) { + } elseif ($l == $n-1) { $w = $this->H[$n][$n-1] * $this->H[$n-1][$n]; $p = ($this->H[$n-1][$n-1] - $this->H[$n][$n]) / 2.0; $q = $p * $p + $w; @@ -687,7 +687,7 @@ class EigenvalueDecomposition } } // Complex vector - } else if ($q < 0) { + } elseif ($q < 0) { $l = $n-1; // Last vector component imaginary so matrix is triangular if (abs($this->H[$n][$n-1]) > abs($this->H[$n-1][$n])) { diff --git a/Classes/PHPExcel/Shared/JAMA/SingularValueDecomposition.php b/Classes/PHPExcel/Shared/JAMA/SingularValueDecomposition.php index 3d6aeb49..f57d122c 100644 --- a/Classes/PHPExcel/Shared/JAMA/SingularValueDecomposition.php +++ b/Classes/PHPExcel/Shared/JAMA/SingularValueDecomposition.php @@ -273,7 +273,7 @@ class SingularValueDecomposition } if ($ks == $k) { $kase = 3; - } else if ($ks == $p-1) { + } elseif ($ks == $p-1) { $kase = 1; } else { $kase = 2; diff --git a/Classes/PHPExcel/Shared/OLE/PPS/Root.php b/Classes/PHPExcel/Shared/OLE/PPS/Root.php index a36c4f97..c62399ba 100644 --- a/Classes/PHPExcel/Shared/OLE/PPS/Root.php +++ b/Classes/PHPExcel/Shared/OLE/PPS/Root.php @@ -72,7 +72,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS if (is_resource($filename)) { $this->_FILEH_ = $filename; - } else if ($filename == '-' || $filename == '') { + } elseif ($filename == '-' || $filename == '') { if ($this->_tmp_dir === null) { $this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir(); } diff --git a/Classes/PHPExcel/Shared/OLERead.php b/Classes/PHPExcel/Shared/OLERead.php index 54b0fadd..48b24eed 100644 --- a/Classes/PHPExcel/Shared/OLERead.php +++ b/Classes/PHPExcel/Shared/OLERead.php @@ -273,7 +273,7 @@ class PHPExcel_Shared_OLERead // Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook) if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) { $this->wrkbook = count($this->props) - 1; - } else if ($upName === 'ROOT ENTRY' || $upName === 'R') { + } elseif ($upName === 'ROOT ENTRY' || $upName === 'R') { // Root entry $this->rootentry = count($this->props) - 1; } diff --git a/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php b/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php index 78bed21f..8fa3db83 100644 --- a/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php +++ b/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php @@ -319,7 +319,7 @@ class PclZip // ----- Look for the optional second argument if ($v_size == 2) { $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"); return 0; } @@ -345,7 +345,7 @@ class PclZip // ----- The list is a list of string names $v_string_list = $p_filelist; } - } else if (is_string($p_filelist)) { + } elseif (is_string($p_filelist)) { // ----- Look if the $p_filelist is a string // ----- Create a list from the string $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); @@ -487,7 +487,7 @@ class PclZip // ----- Look for the optional second argument if ($v_size == 2) { $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; - } else if ($v_size > 2) { + } elseif ($v_size > 2) { // ----- Error log 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 $v_string_list = $p_filelist; } - } else if (is_string($p_filelist)) { + } elseif (is_string($p_filelist)) { // ----- Look if the $p_filelist is a string // ----- Create a list from the string $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); @@ -748,7 +748,7 @@ class PclZip // ----- Look for the optional second argument if ($v_size == 2) { $v_remove_path = $v_arg_list[1]; - } else if ($v_size > 2) { + } elseif ($v_size > 2) { // ----- Error log PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); @@ -903,7 +903,7 @@ class PclZip // ----- Look for the optional second argument if ($v_size == 2) { $v_remove_path = $v_arg_list[1]; - } else if ($v_size > 2) { + } elseif ($v_size > 2) { // ----- Error log 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')) { // ----- Duplicate the archive $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) // ----- Check that $p_archive is a valid zip file // 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')) { // ----- Merge the archive $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) // ----- Create a temporary archive $v_object_archive = new PclZip($p_archive_to_add); @@ -1466,7 +1466,7 @@ class PclZip // ----- Get the value if (is_string($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]; } else { // ----- Error log @@ -1548,9 +1548,9 @@ class PclZip // ----- Parse items $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]; - } 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]; } else { // ----- Error log @@ -1895,16 +1895,16 @@ class PclZip if (file_exists($v_descr['filename'])) { if (@is_file($v_descr['filename'])) { $v_descr['type'] = 'file'; - } else if (@is_dir($v_descr['filename'])) { + } elseif (@is_dir($v_descr['filename'])) { $v_descr['type'] = 'folder'; - } else if (@is_link($v_descr['filename'])) { + } elseif (@is_link($v_descr['filename'])) { // skip continue; } else { // skip continue; } - } else if (isset($v_descr['content'])) { + } elseif (isset($v_descr['content'])) { // ----- Look for string added as file $v_descr['type'] = 'virtual_file'; } else { @@ -2412,12 +2412,12 @@ class PclZip if ($p_filedescr['type']=='file') { $p_header['external'] = 0x00000000; $p_header['size'] = filesize($p_filename); - } else if ($p_filedescr['type']=='folder') { + } elseif ($p_filedescr['type']=='folder') { // ----- Look for regular folder $p_header['external'] = 0x00000010; $p_header['mtime'] = filemtime($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 $p_header['external'] = 0x00000000; $p_header['size'] = strlen($p_filedescr['content']); @@ -2426,7 +2426,7 @@ class PclZip // ----- Look for filetime if (isset($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(); } else { $p_header['mtime'] = filemtime($p_filename); @@ -2526,7 +2526,7 @@ class PclZip // ----- Write the compressed (or not) content @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) $v_content = $p_filedescr['content']; @@ -2556,7 +2556,7 @@ class PclZip // ----- Write the compressed (or not) content @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 directory last '/' if (@substr($p_header['stored_filename'], -1) != '/') { @@ -2761,7 +2761,7 @@ class PclZip // ----- Look for all path to remove if ($p_remove_all_dir) { $v_stored_filename = basename($p_filename); - } else if ($p_remove_dir != "") { + } elseif ($p_remove_dir != "") { // ----- Look for partial path remove if (substr($p_remove_dir, -1) != '/') { $p_remove_dir .= "/"; @@ -3136,12 +3136,12 @@ class PclZip $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 if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) { $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 if the index is in the list for ($j=$j_start; ($j $p_entry['mtime']) { + } elseif (filemtime($p_entry['filename']) > $p_entry['mtime']) { // ----- Look if the extracted file is older // ----- Change the file status if ((isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) && ($p_options[PCLZIP_OPT_REPLACE_NEWER] === true)) { @@ -3451,7 +3451,7 @@ class PclZip // ----- Check the directory availability and create it if necessary if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) { $v_dir_to_check = $p_entry['filename']; - } else if (!strstr($p_entry['filename'], "/")) { + } elseif (!strstr($p_entry['filename'], "/")) { $v_dir_to_check = ""; } else { $v_dir_to_check = dirname($p_entry['filename']); @@ -4334,12 +4334,12 @@ class PclZip $v_found = 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 if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { $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 if the index is in the list for ($j=$j_start; ($jprivCloseFd(); @@ -4915,9 +4915,9 @@ function PclZipUtilPathReduction($p_dir) if ($v_list[$i] == ".") { // ----- Ignore this directory // Should be the first $i=0, but no check is done - } else if ($v_list[$i] == "..") { + } elseif ($v_list[$i] == "..") { $v_skip++; - } else if ($v_list[$i] == "") { + } elseif ($v_list[$i] == "") { // ----- First '/' i.e. root slash if ($i == 0) { $v_result = "/".$v_result; @@ -4927,7 +4927,7 @@ function PclZipUtilPathReduction($p_dir) $v_result = $p_dir; $v_skip = 0; } - } else if ($i == (sizeof($v_list)-1)) { + } elseif ($i == (sizeof($v_list)-1)) { // ----- Last '/' i.e. indicates a directory $v_result = $v_list[$i]; } else { @@ -5029,7 +5029,7 @@ function PclZipUtilPathInclusion($p_dir, $p_path) if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) { // ----- There are exactly the same $v_result = 2; - } else if ($i < $v_list_dir_size) { + } elseif ($i < $v_list_dir_size) { // ----- The path is shorter than the dir $v_result = 0; } @@ -5062,21 +5062,21 @@ function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode = 0) @fwrite($p_dest, $v_buffer, $v_read_size); $p_size -= $v_read_size; } - } else if ($p_mode==1) { + } elseif ($p_mode==1) { while ($p_size != 0) { $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @gzread($p_src, $v_read_size); @fwrite($p_dest, $v_buffer, $v_read_size); $p_size -= $v_read_size; } - } else if ($p_mode==2) { + } elseif ($p_mode==2) { while ($p_size != 0) { $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($p_src, $v_read_size); @gzwrite($p_dest, $v_buffer, $v_read_size); $p_size -= $v_read_size; } - } else if ($p_mode==3) { + } elseif ($p_mode==3) { while ($p_size != 0) { $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @gzread($p_src, $v_read_size); @@ -5111,7 +5111,7 @@ function PclZipUtilRename($p_src, $p_dest) // ----- Try to copy & unlink the src if (!@copy($p_src, $p_dest)) { $v_result = 0; - } else if (!@unlink($p_src)) { + } elseif (!@unlink($p_src)) { $v_result = 0; } } diff --git a/Classes/PHPExcel/Shared/String.php b/Classes/PHPExcel/Shared/String.php index c32a3bb8..df8cdf2f 100644 --- a/Classes/PHPExcel/Shared/String.php +++ b/Classes/PHPExcel/Shared/String.php @@ -504,7 +504,7 @@ class PHPExcel_Shared_String if ($from == 'UTF-16LE') { return self::utf16_decode($value, false); - } else if ($from == 'UTF-16BE') { + } elseif ($from == 'UTF-16BE') { return self::utf16_decode($value); } // else, no conversion diff --git a/Classes/PHPExcel/Style.php b/Classes/PHPExcel/Style.php index 20f7236e..6b952ef9 100644 --- a/Classes/PHPExcel/Style.php +++ b/Classes/PHPExcel/Style.php @@ -358,7 +358,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp // Selection type, inspect if (preg_match('/^[A-Z]+1:[A-Z]+1048576$/', $pRange)) { $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'; } else { $selectionType = 'CELL'; diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index 0946c7cb..8004412d 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -2265,9 +2265,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable if (strpos($pCellCoordinate, ':') !== false || strpos($pCellCoordinate, ',') !== false) { 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.'); - } else if ($pCellCoordinate == '') { + } elseif ($pCellCoordinate == '') { throw new PHPExcel_Exception('Cell coordinate can not be zero-length string.'); } else { // Check if we already have a comment for this cell. diff --git a/Classes/PHPExcel/Writer/CSV.php b/Classes/PHPExcel/Writer/CSV.php index 1540a22b..90c5cc08 100644 --- a/Classes/PHPExcel/Writer/CSV.php +++ b/Classes/PHPExcel/Writer/CSV.php @@ -32,49 +32,49 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W * * @var PHPExcel */ - private $_phpExcel; + private $phpExcel; /** * Delimiter * * @var string */ - private $_delimiter = ','; + private $delimiter = ','; /** * Enclosure * * @var string */ - private $_enclosure = '"'; + private $enclosure = '"'; /** * Line ending * * @var string */ - private $_lineEnding = PHP_EOL; + private $lineEnding = PHP_EOL; /** * Sheet index to write * * @var int */ - private $_sheetIndex = 0; + private $sheetIndex = 0; /** * Whether to write a BOM (for UTF8). * * @var boolean */ - private $_useBOM = false; + private $useBOM = false; /** * Whether to write a fully Excel compatible CSV file. * * @var boolean */ - private $_excelCompatibility = false; + private $excelCompatibility = false; /** * 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) { - $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) { // Fetch sheet - $sheet = $this->_phpExcel->getSheet($this->_sheetIndex); + $sheet = $this->phpExcel->getSheet($this->sheetIndex); - $saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); - PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false); + $saveDebugLog = PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog(); + PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false); $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); 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."); } - if ($this->_excelCompatibility) { + if ($this->excelCompatibility) { fwrite($fileHandle, "\xEF\xBB\xBF"); // Enforce UTF-8 BOM Header $this->setEnclosure('"'); // Set enclosure to " $this->setDelimiter(";"); // Set delimiter to a semi-colon $this->setLineEnding("\r\n"); - fwrite($fileHandle, 'sep=' . $this->getDelimiter() . $this->_lineEnding); - } elseif ($this->_useBOM) { + fwrite($fileHandle, 'sep=' . $this->getDelimiter() . $this->lineEnding); + } elseif ($this->useBOM) { // Write the UTF-8 BOM code if required fwrite($fileHandle, "\xEF\xBB\xBF"); } @@ -135,7 +135,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W fclose($fileHandle); 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() { - 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 = ',') { - $this->_delimiter = $pValue; + $this->delimiter = $pValue; return $this; } @@ -167,7 +167,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W */ 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 == '') { $pValue = null; } - $this->_enclosure = $pValue; + $this->enclosure = $pValue; return $this; } @@ -192,7 +192,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W */ 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) { - $this->_lineEnding = $pValue; + $this->lineEnding = $pValue; return $this; } @@ -214,7 +214,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W */ 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) { - $this->_useBOM = $pValue; + $this->useBOM = $pValue; return $this; } @@ -236,7 +236,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W */ 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) { - $this->_excelCompatibility = $pValue; + $this->excelCompatibility = $pValue; return $this; } @@ -259,7 +259,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W */ 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) { - $this->_sheetIndex = $pValue; + $this->sheetIndex = $pValue; return $this; } @@ -292,21 +292,21 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W foreach ($pValues as $element) { // Escape enclosures - $element = str_replace($this->_enclosure, $this->_enclosure . $this->_enclosure, $element); + $element = str_replace($this->enclosure, $this->enclosure . $this->enclosure, $element); // Add delimiter if ($writeDelimiter) { - $line .= $this->_delimiter; + $line .= $this->delimiter; } else { $writeDelimiter = true; } // Add enclosed string - $line .= $this->_enclosure . $element . $this->_enclosure; + $line .= $this->enclosure . $element . $this->enclosure; } // Add line ending - $line .= $this->_lineEnding; + $line .= $this->lineEnding; // Write to file fwrite($pFileHandle, $line); diff --git a/Classes/PHPExcel/Writer/Excel2007.php b/Classes/PHPExcel/Writer/Excel2007.php index e7f26ff5..1b241018 100644 --- a/Classes/PHPExcel/Writer/Excel2007.php +++ b/Classes/PHPExcel/Writer/Excel2007.php @@ -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); - } else if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) { + } elseif ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) { ob_start(); call_user_func( $this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(), diff --git a/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php b/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php index 4f0b1eba..c441ef11 100644 --- a/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php +++ b/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php @@ -145,7 +145,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) { $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension()); $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 = explode('/', $extension); $extension = $extension[1]; diff --git a/Classes/PHPExcel/Writer/Excel2007/StringTable.php b/Classes/PHPExcel/Writer/Excel2007/StringTable.php index 4a28f13e..7976f7bb 100644 --- a/Classes/PHPExcel/Writer/Excel2007/StringTable.php +++ b/Classes/PHPExcel/Writer/Excel2007/StringTable.php @@ -123,7 +123,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr } $objWriter->writeRawData($textToWrite); $objWriter->endElement(); - } else if ($textElement instanceof PHPExcel_RichText) { + } elseif ($textElement instanceof PHPExcel_RichText) { $this->writeRichText($objWriter, $textElement); } @@ -184,7 +184,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr $objWriter->startElement($prefix.'vertAlign'); if ($element->getFont()->getSuperScript()) { $objWriter->writeAttribute('val', 'superscript'); - } else if ($element->getFont()->getSubScript()) { + } elseif ($element->getFont()->getSubScript()) { $objWriter->writeAttribute('val', 'subscript'); } $objWriter->endElement(); @@ -280,7 +280,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr // $objWriter->startElement($prefix.'vertAlign'); // if ($element->getFont()->getSuperScript()) { // $objWriter->writeAttribute('val', 'superscript'); -// } else if ($element->getFont()->getSubScript()) { +// } elseif ($element->getFont()->getSubScript()) { // $objWriter->writeAttribute('val', 'subscript'); // } // $objWriter->endElement(); @@ -313,7 +313,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr foreach ($stringTable as $key => $value) { if (! $value instanceof PHPExcel_RichText) { $returnValue[$value] = $key; - } else if ($value instanceof PHPExcel_RichText) { + } elseif ($value instanceof PHPExcel_RichText) { $returnValue[$value->getHashCode()] = $key; } } diff --git a/Classes/PHPExcel/Writer/Excel2007/Style.php b/Classes/PHPExcel/Writer/Excel2007/Style.php index d6cf8538..5ff56f33 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Style.php +++ b/Classes/PHPExcel/Writer/Excel2007/Style.php @@ -317,7 +317,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->startElement('vertAlign'); if ($pFont->getSuperScript() === true) { $objWriter->writeAttribute('val', 'superscript'); - } else if ($pFont->getSubScript() === true) { + } elseif ($pFont->getSubScript() === true) { $objWriter->writeAttribute('val', 'subscript'); } $objWriter->endElement(); @@ -428,7 +428,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa $textRotation = 0; if ($pStyle->getAlignment()->getTextRotation() >= 0) { $textRotation = $pStyle->getAlignment()->getTextRotation(); - } else if ($pStyle->getAlignment()->getTextRotation() < 0) { + } elseif ($pStyle->getAlignment()->getTextRotation() < 0) { $textRotation = 90 - $pStyle->getAlignment()->getTextRotation(); } $objWriter->writeAttribute('textRotation', $textRotation); @@ -493,7 +493,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa $textRotation = 0; if ($pStyle->getAlignment()->getTextRotation() >= 0) { $textRotation = $pStyle->getAlignment()->getTextRotation(); - } else if ($pStyle->getAlignment()->getTextRotation() < 0) { + } elseif ($pStyle->getAlignment()->getTextRotation() < 0) { $textRotation = 90 - $pStyle->getAlignment()->getTextRotation(); } $objWriter->writeAttribute('textRotation', $textRotation); diff --git a/Classes/PHPExcel/Writer/Excel2007/Worksheet.php b/Classes/PHPExcel/Writer/Excel2007/Worksheet.php index cb153f8a..492e0453 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Worksheet.php +++ b/Classes/PHPExcel/Writer/Excel2007/Worksheet.php @@ -506,19 +506,19 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT && !is_null($conditional->getText())) { $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 && !is_null($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 && !is_null($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 && !is_null($conditional->getText())) { $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_EXPRESSION) { 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) { if ($breakType == PHPExcel_Worksheet::BREAK_ROW) { $aRowBreaks[] = $cell; - } else if ($breakType == PHPExcel_Worksheet::BREAK_COLUMN) { + } elseif ($breakType == PHPExcel_Worksheet::BREAK_COLUMN) { $aColumnBreaks[] = $cell; } } @@ -1095,7 +1095,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ case 'inlinestr': // Inline string if (! $cellValue instanceof PHPExcel_RichText) { $objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML(htmlspecialchars($cellValue))); - } else if ($cellValue instanceof PHPExcel_RichText) { + } elseif ($cellValue instanceof PHPExcel_RichText) { $objWriter->startElement('is'); $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue); $objWriter->endElement(); @@ -1107,7 +1107,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ if (isset($pFlippedStringTable[$cellValue])) { $objWriter->writeElement('v', $pFlippedStringTable[$cellValue]); } - } else if ($cellValue instanceof PHPExcel_RichText) { + } elseif ($cellValue instanceof PHPExcel_RichText) { $objWriter->writeElement('v', $pFlippedStringTable[$cellValue->getHashCode()]); } diff --git a/Classes/PHPExcel/Writer/Excel5.php b/Classes/PHPExcel/Writer/Excel5.php index 024e7708..b1f49e09 100644 --- a/Classes/PHPExcel/Writer/Excel5.php +++ b/Classes/PHPExcel/Writer/Excel5.php @@ -32,63 +32,63 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce * * @var PHPExcel */ - private $_phpExcel; + private $phpExcel; /** * Total number of shared strings in workbook * * @var int */ - private $_str_total = 0; + private $strTotal = 0; /** * Number of unique shared strings in workbook * * @var int */ - private $_str_unique = 0; + private $strUnique = 0; /** * Array of unique shared strings in workbook * * @var array */ - private $_str_table = array(); + private $strTable = array(); /** * Color cache. Mapping between RGB value and color index. * * @var array */ - private $_colors; + private $colors; /** * Formula parser * * @var PHPExcel_Writer_Excel5_Parser */ - private $_parser; + private $parser; /** * Identifier clusters for drawings. Used in MSODRAWINGGROUP record. * * @var array */ - private $_IDCLs; + private $IDCLs; /** * Basic OLE object summary information * * @var array */ - private $_summaryInformation; + private $summaryInformation; /** * Extended OLE object document summary information * * @var array */ - private $_documentSummaryInformation; + private $documentSummaryInformation; /** * 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) { - $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 - $this->_phpExcel->garbageCollect(); + $this->phpExcel->garbageCollect(); - $saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); - PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false); + $saveDebugLog = PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog(); + PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false); $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType(); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); // initialize colors array - $this->_colors = array(); + $this->colors = array(); // 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 - $countSheets = $this->_phpExcel->getSheetCount(); + $countSheets = $this->phpExcel->getSheetCount(); 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. - $this->_buildWorksheetEschers(); - $this->_buildWorkbookEscher(); + $this->buildWorksheetEschers(); + $this->buildWorkbookEscher(); // add 15 identical cell style Xfs // for now, we use the first cellXf instead of cellStyleXf - $cellXfCollection = $this->_phpExcel->getCellXfCollection(); + $cellXfCollection = $this->phpExcel->getCellXfCollection(); for ($i = 0; $i < 15; ++$i) { $this->_writerWorkbook->addXfWriter($cellXfCollection[0], true); } // add all the cell Xfs - foreach ($this->_phpExcel->getCellXfCollection() as $style) { + foreach ($this->phpExcel->getCellXfCollection() as $style) { $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()); } - $this->_documentSummaryInformation = $this->_writeDocumentSummaryInformation(); + $this->documentSummaryInformation = $this->writeDocumentSummaryInformation(); // 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->append($this->_documentSummaryInformation); + $OLE_DocumentSummaryInformation->append($this->documentSummaryInformation); } - $this->_summaryInformation = $this->_writeSummaryInformation(); + $this->summaryInformation = $this->writeSummaryInformation(); // 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->append($this->_summaryInformation); + $OLE_SummaryInformation->append($this->summaryInformation); } // define OLE Parts @@ -214,7 +214,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $res = $root->save($pFilename); 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 * */ - private function _buildWorksheetEschers() + private function buildWorksheetEschers() { // 1-based index to BstoreContainer $blipIndex = 0; $lastReducedSpId = 0; $lastSpId = 0; - foreach ($this->_phpExcel->getAllsheets() as $sheet) { + foreach ($this->phpExcel->getAllsheets() as $sheet) { // sheet index $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 - $this->_IDCLs[$dgId] = $lastReducedSpId; + $this->IDCLs[$dgId] = $lastReducedSpId; // set last shape index $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 */ - private function _buildWorkbookEscher() + private function buildWorkbookEscher() { $escher = null; // any drawings in this workbook? $found = false; - foreach ($this->_phpExcel->getAllSheets() as $sheet) { + foreach ($this->phpExcel->getAllSheets() as $sheet) { if (count($sheet->getDrawingCollection()) > 0) { $found = true; break; @@ -424,14 +424,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $escher->setDggContainer($dggContainer); // set IDCLs (identifier clusters) - $dggContainer->setIDCLs($this->_IDCLs); + $dggContainer->setIDCLs($this->IDCLs); // this loop is for determining maximum shape identifier of all drawing $spIdMax = 0; $totalCountShapes = 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 if (count($sheet->getDrawingCollection()) > 0) { @@ -441,7 +441,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce ++$sheetCountShapes; ++$totalCountShapes; - $spId = $sheetCountShapes | ($this->_phpExcel->getIndex($sheet) + 1) << 10; + $spId = $sheetCountShapes | ($this->phpExcel->getIndex($sheet) + 1) << 10; $spIdMax = max($spId, $spIdMax); } } @@ -456,7 +456,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $dggContainer->setBstoreContainer($bstoreContainer); // the BSE's (all the images) - foreach ($this->_phpExcel->getAllsheets() as $sheet) { + foreach ($this->phpExcel->getAllsheets() as $sheet) { foreach ($sheet->getDrawingCollection() as $drawing) { if ($drawing instanceof PHPExcel_Worksheet_Drawing) { $filename = $drawing->getPath(); @@ -498,7 +498,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $BSE->setBlip($blip); $bstoreContainer->addBSE($BSE); - } else if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) { + } elseif ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) { switch ($drawing->getRenderingFunction()) { case PHPExcel_Worksheet_MemoryDrawing::RENDERING_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 * @return string */ - private function _writeDocumentSummaryInformation() + private function writeDocumentSummaryInformation() { // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark) $data = pack('v', 0xFFFE); @@ -571,8 +571,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $dataSection_NumProps++; // GKPIDDSI_CATEGORY : Category - if ($this->_phpExcel->getProperties()->getCategory()) { - $dataProp = $this->_phpExcel->getProperties()->getCategory(); + if ($this->phpExcel->getProperties()->getCategory()) { + $dataProp = $this->phpExcel->getProperties()->getCategory(); $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02), 'offset' => array('pack' => 'V'), '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 * @return string */ - private function _writeSummaryInformation() + private function writeSummaryInformation() { // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark) $data = pack('v', 0xFFFE); @@ -767,8 +767,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $dataSection_NumProps++; // Title - if ($this->_phpExcel->getProperties()->getTitle()) { - $dataProp = $this->_phpExcel->getProperties()->getTitle(); + if ($this->phpExcel->getProperties()->getTitle()) { + $dataProp = $this->phpExcel->getProperties()->getTitle(); $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02), 'offset' => array('pack' => 'V'), '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++; } // Subject - if ($this->_phpExcel->getProperties()->getSubject()) { - $dataProp = $this->_phpExcel->getProperties()->getSubject(); + if ($this->phpExcel->getProperties()->getSubject()) { + $dataProp = $this->phpExcel->getProperties()->getSubject(); $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x03), 'offset' => array('pack' => 'V'), '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++; } // Author (Creator) - if ($this->_phpExcel->getProperties()->getCreator()) { - $dataProp = $this->_phpExcel->getProperties()->getCreator(); + if ($this->phpExcel->getProperties()->getCreator()) { + $dataProp = $this->phpExcel->getProperties()->getCreator(); $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x04), 'offset' => array('pack' => 'V'), '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++; } // Keywords - if ($this->_phpExcel->getProperties()->getKeywords()) { - $dataProp = $this->_phpExcel->getProperties()->getKeywords(); + if ($this->phpExcel->getProperties()->getKeywords()) { + $dataProp = $this->phpExcel->getProperties()->getKeywords(); $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x05), 'offset' => array('pack' => 'V'), '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++; } // Comments (Description) - if ($this->_phpExcel->getProperties()->getDescription()) { - $dataProp = $this->_phpExcel->getProperties()->getDescription(); + if ($this->phpExcel->getProperties()->getDescription()) { + $dataProp = $this->phpExcel->getProperties()->getDescription(); $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x06), 'offset' => array('pack' => 'V'), '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++; } // Last Saved By (LastModifiedBy) - if ($this->_phpExcel->getProperties()->getLastModifiedBy()) { - $dataProp = $this->_phpExcel->getProperties()->getLastModifiedBy(); + if ($this->phpExcel->getProperties()->getLastModifiedBy()) { + $dataProp = $this->phpExcel->getProperties()->getLastModifiedBy(); $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x08), 'offset' => array('pack' => 'V'), '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++; } // Created Date/Time - if ($this->_phpExcel->getProperties()->getCreated()) { - $dataProp = $this->_phpExcel->getProperties()->getCreated(); + if ($this->phpExcel->getProperties()->getCreated()) { + $dataProp = $this->phpExcel->getProperties()->getCreated(); $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C), '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) @@ -830,8 +830,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $dataSection_NumProps++; } // Modified Date/Time - if ($this->_phpExcel->getProperties()->getModified()) { - $dataProp = $this->_phpExcel->getProperties()->getModified(); + if ($this->phpExcel->getProperties()->getModified()) { + $dataProp = $this->phpExcel->getProperties()->getModified(); $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D), '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) diff --git a/Classes/PHPExcel/Writer/Excel5/Escher.php b/Classes/PHPExcel/Writer/Excel5/Escher.php index fc0f10a7..e7e79a84 100644 --- a/Classes/PHPExcel/Writer/Excel5/Escher.php +++ b/Classes/PHPExcel/Writer/Excel5/Escher.php @@ -82,7 +82,7 @@ class PHPExcel_Writer_Excel5_Escher if ($dggContainer = $this->_object->getDggContainer()) { $writer = new PHPExcel_Writer_Excel5_Escher($dggContainer); $this->_data = $writer->close(); - } else if ($dgContainer = $this->_object->getDgContainer()) { + } elseif ($dgContainer = $this->_object->getDgContainer()) { $writer = new PHPExcel_Writer_Excel5_Escher($dgContainer); $this->_data = $writer->close(); $this->_spOffsets = $writer->getSpOffsets(); diff --git a/Classes/PHPExcel/Writer/Excel5/Font.php b/Classes/PHPExcel/Writer/Excel5/Font.php index a95e6455..e67562b8 100644 --- a/Classes/PHPExcel/Writer/Excel5/Font.php +++ b/Classes/PHPExcel/Writer/Excel5/Font.php @@ -83,7 +83,7 @@ class PHPExcel_Writer_Excel5_Font $icv = $this->_colorIndex; // Index to color palette if ($this->_font->getSuperScript()) { $sss = 1; - } else if ($this->_font->getSubScript()) { + } elseif ($this->_font->getSubScript()) { $sss = 2; } else { $sss = 0; diff --git a/Classes/PHPExcel/Writer/Excel5/Workbook.php b/Classes/PHPExcel/Writer/Excel5/Workbook.php index cd6bbd73..c5f827d5 100644 --- a/Classes/PHPExcel/Writer/Excel5/Workbook.php +++ b/Classes/PHPExcel/Writer/Excel5/Workbook.php @@ -610,7 +610,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter ); // (exclusive) either repeatColumns or repeatRows - } else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) { + } elseif ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) { // Columns to repeat if ($sheetSetup->isColumnsToRepeatAtLeftSet()) { $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)); // (exclusive) either repeatColumns or repeatRows - } else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) { + } elseif ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) { // Columns to repeat if ($sheetSetup->isColumnsToRepeatAtLeftSet()) { $repeat = $sheetSetup->getColumnsToRepeatAtLeft(); diff --git a/Classes/PHPExcel/Writer/Excel5/Worksheet.php b/Classes/PHPExcel/Writer/Excel5/Worksheet.php index 11e0e862..6949c172 100644 --- a/Classes/PHPExcel/Writer/Excel5/Worksheet.php +++ b/Classes/PHPExcel/Writer/Excel5/Worksheet.php @@ -504,7 +504,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // internal to current workbook $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; @@ -3048,7 +3048,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) { $type = 0x02; $operatorType = 0x00; - } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) { + } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) { $type = 0x01; switch ($conditional->getOperatorType()) { @@ -3089,7 +3089,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $szValue2 = 0x0000; $operand1 = pack('Cv', 0x1E, $arrConditions[0]); $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); $szValue2 = ($arrConditions[1] <= 65535 ? 3 : 0x0000); $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) { $dataBlockFont .= pack('v', 0x02); $fontEscapement = 0; - } else if ($conditional->getStyle()->getFont()->getSuperScript() == true) { + } elseif ($conditional->getStyle()->getFont()->getSuperScript() == true) { $dataBlockFont .= pack('v', 0x01); $fontEscapement = 0; } else { diff --git a/Classes/PHPExcel/Writer/Excel5/Xf.php b/Classes/PHPExcel/Writer/Excel5/Xf.php index dc185f00..61a42eb2 100644 --- a/Classes/PHPExcel/Writer/Excel5/Xf.php +++ b/Classes/PHPExcel/Writer/Excel5/Xf.php @@ -75,61 +75,61 @@ class PHPExcel_Writer_Excel5_Xf * * @var boolean */ - private $_isStyleXf; + private $isStyleXf; /** * Index to the FONT record. Index 4 does not exist * @var integer */ - private $_fontIndex; + private $fontIndex; /** * An index (2 bytes) to a FORMAT record (number format). * @var integer */ - public $_numberFormatIndex; + private $numberFormatIndex; /** * 1 bit, apparently not used. * @var integer */ - public $_text_justlast; + private $textJustLast; /** * The cell's foreground color. * @var integer */ - public $_fg_color; + private $foregroundColor; /** * The cell's background color. * @var integer */ - public $_bg_color; + private $backgroundColor; /** * Color of the bottom border of the cell. * @var integer */ - public $_bottom_color; + private $bottomBorderColor; /** * Color of the top border of the cell. * @var integer */ - public $_top_color; + private $topBorderColor; /** * Color of the left border of the cell. * @var integer */ - public $_left_color; + private $leftBorderColor; /** * Color of the right border of the cell. * @var integer */ - public $_right_color; + private $rightBorderColor; /** * Constructor @@ -139,22 +139,22 @@ class PHPExcel_Writer_Excel5_Xf */ public function __construct(PHPExcel_Style $style = null) { - $this->_isStyleXf = false; - $this->_fontIndex = 0; + $this->isStyleXf = false; + $this->fontIndex = 0; - $this->_numberFormatIndex = 0; + $this->numberFormatIndex = 0; - $this->_text_justlast = 0; + $this->textJustLast = 0; - $this->_fg_color = 0x40; - $this->_bg_color = 0x41; + $this->foregroundColor = 0x40; + $this->backgroundColor = 0x41; $this->_diag = 0; - $this->_bottom_color = 0x40; - $this->_top_color = 0x40; - $this->_left_color = 0x40; - $this->_right_color = 0x40; + $this->bottomBorderColor = 0x40; + $this->topBorderColor = 0x40; + $this->leftBorderColor = 0x40; + $this->rightBorderColor = 0x40; $this->_diag_color = 0x40; $this->_style = $style; @@ -169,94 +169,94 @@ class PHPExcel_Writer_Excel5_Xf public function writeXf() { // Set the type of the XF record and some of the attributes. - if ($this->_isStyleXf) { + if ($this->isStyleXf) { $style = 0xFFF5; } else { - $style = self::_mapLocked($this->_style->getProtection()->getLocked()); - $style |= self::_mapHidden($this->_style->getProtection()->getHidden()) << 1; + $style = self::mapLocked($this->_style->getProtection()->getLocked()); + $style |= self::mapHidden($this->_style->getProtection()->getHidden()) << 1; } // Flags to indicate if attributes have been set. - $atr_num = ($this->_numberFormatIndex != 0)?1:0; - $atr_fnt = ($this->_fontIndex != 0)?1:0; + $atr_num = ($this->numberFormatIndex != 0)?1:0; + $atr_fnt = ($this->fontIndex != 0)?1:0; $atr_alc = ((int) $this->_style->getAlignment()->getWrapText()) ? 1 : 0; - $atr_bdr = (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) || - self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) || - self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) || - self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0; - $atr_pat = (($this->_fg_color != 0x40) || - ($this->_bg_color != 0x41) || - self::_mapFillType($this->_style->getFill()->getFillType()))?1:0; - $atr_prot = self::_mapLocked($this->_style->getProtection()->getLocked()) - | self::_mapHidden($this->_style->getProtection()->getHidden()); + $atr_bdr = (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) || + self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) || + self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) || + self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0; + $atr_pat = (($this->foregroundColor != 0x40) || + ($this->backgroundColor != 0x41) || + self::mapFillType($this->_style->getFill()->getFillType()))?1:0; + $atr_prot = self::mapLocked($this->_style->getProtection()->getLocked()) + | self::mapHidden($this->_style->getProtection()->getHidden()); // Zero the default border colour if the border has not been set. - if (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) { - $this->_bottom_color = 0; + if (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) { + $this->bottomBorderColor = 0; } - if (self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) { - $this->_top_color = 0; + if (self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) { + $this->topBorderColor = 0; } - if (self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) { - $this->_right_color = 0; + if (self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) { + $this->rightBorderColor = 0; } - if (self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 0) { - $this->_left_color = 0; + if (self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 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; } - $record = 0x00E0; // Record identifier - $length = 0x0014; // Number of bytes to follow + $record = 0x00E0; // Record identifier + $length = 0x0014; // Number of bytes to follow - $ifnt = $this->_fontIndex; // Index to FONT record - $ifmt = $this->_numberFormatIndex; // Index to FORMAT record + $ifnt = $this->fontIndex; // Index to FONT record + $ifmt = $this->numberFormatIndex; // Index to FORMAT record - $align = $this->_mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment - $align |= (int) $this->_style->getAlignment()->getWrapText() << 3; - $align |= self::_mapVAlign($this->_style->getAlignment()->getVertical()) << 4; - $align |= $this->_text_justlast << 7; + $align = $this->mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment + $align |= (int) $this->_style->getAlignment()->getWrapText() << 3; + $align |= self::mapVAlign($this->_style->getAlignment()->getVertical()) << 4; + $align |= $this->textJustLast << 7; - $used_attrib = $atr_num << 2; - $used_attrib |= $atr_fnt << 3; - $used_attrib |= $atr_alc << 4; - $used_attrib |= $atr_bdr << 5; - $used_attrib |= $atr_pat << 6; - $used_attrib |= $atr_prot << 7; + $used_attrib = $atr_num << 2; + $used_attrib |= $atr_fnt << 3; + $used_attrib |= $atr_alc << 4; + $used_attrib |= $atr_bdr << 5; + $used_attrib |= $atr_pat << 6; + $used_attrib |= $atr_prot << 7; - $icv = $this->_fg_color; // fg and bg pattern colors - $icv |= $this->_bg_color << 7; + $icv = $this->foregroundColor; // fg and bg pattern colors + $icv |= $this->backgroundColor << 7; - $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()->getTop()->getBorderStyle()) << 8; - $border1 |= self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12; - $border1 |= $this->_left_color << 16; - $border1 |= $this->_right_color << 23; + $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()->getTop()->getBorderStyle()) << 8; + $border1 |= self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12; + $border1 |= $this->leftBorderColor << 16; + $border1 |= $this->rightBorderColor << 23; $diagonalDirection = $this->_style->getBorders()->getDiagonalDirection(); $diag_tl_to_rb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH || $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_DOWN; $diag_tr_to_lb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH || $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_UP; - $border1 |= $diag_tl_to_rb << 30; - $border1 |= $diag_tr_to_lb << 31; + $border1 |= $diag_tl_to_rb << 30; + $border1 |= $diag_tr_to_lb << 31; - $border2 = $this->_top_color; // Border color - $border2 |= $this->_bottom_color << 7; - $border2 |= $this->_diag_color << 14; - $border2 |= self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21; - $border2 |= self::_mapFillType($this->_style->getFill()->getFillType()) << 26; + $border2 = $this->topBorderColor; // Border color + $border2 |= $this->bottomBorderColor << 7; + $border2 |= $this->_diag_color << 14; + $border2 |= self::mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21; + $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 = $this->_style->getAlignment()->getIndent(); $biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4; $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); return($header . $data); @@ -269,7 +269,7 @@ class PHPExcel_Writer_Excel5_Xf */ public function setIsStyleXf($value) { - $this->_isStyleXf = $value; + $this->isStyleXf = $value; } /** @@ -280,7 +280,7 @@ class PHPExcel_Writer_Excel5_Xf */ public function setBottomColor($colorIndex) { - $this->_bottom_color = $colorIndex; + $this->bottomBorderColor = $colorIndex; } /** @@ -291,7 +291,7 @@ class PHPExcel_Writer_Excel5_Xf */ public function setTopColor($colorIndex) { - $this->_top_color = $colorIndex; + $this->topBorderColor = $colorIndex; } /** @@ -302,7 +302,7 @@ class PHPExcel_Writer_Excel5_Xf */ public function setLeftColor($colorIndex) { - $this->_left_color = $colorIndex; + $this->leftBorderColor = $colorIndex; } /** @@ -313,7 +313,7 @@ class PHPExcel_Writer_Excel5_Xf */ public function setRightColor($colorIndex) { - $this->_right_color = $colorIndex; + $this->rightBorderColor = $colorIndex; } /** @@ -336,7 +336,7 @@ class PHPExcel_Writer_Excel5_Xf */ public function setFgColor($colorIndex) { - $this->_fg_color = $colorIndex; + $this->foregroundColor = $colorIndex; } /** @@ -347,7 +347,7 @@ class PHPExcel_Writer_Excel5_Xf */ public function setBgColor($colorIndex) { - $this->_bg_color = $colorIndex; + $this->backgroundColor = $colorIndex; } /** @@ -359,7 +359,7 @@ class PHPExcel_Writer_Excel5_Xf */ public function setNumberFormatIndex($numberFormatIndex) { - $this->_numberFormatIndex = $numberFormatIndex; + $this->numberFormatIndex = $numberFormatIndex; } /** @@ -369,7 +369,7 @@ class PHPExcel_Writer_Excel5_Xf */ public function setFontIndex($value) { - $this->_fontIndex = $value; + $this->fontIndex = $value; } /** @@ -377,21 +377,22 @@ class PHPExcel_Writer_Excel5_Xf * @static array of int * */ - private static $_mapBorderStyle = array ( PHPExcel_Style_Border::BORDER_NONE => 0x00, - PHPExcel_Style_Border::BORDER_THIN => 0x01, - PHPExcel_Style_Border::BORDER_MEDIUM => 0x02, - PHPExcel_Style_Border::BORDER_DASHED => 0x03, - PHPExcel_Style_Border::BORDER_DOTTED => 0x04, - PHPExcel_Style_Border::BORDER_THICK => 0x05, - PHPExcel_Style_Border::BORDER_DOUBLE => 0x06, - PHPExcel_Style_Border::BORDER_HAIR => 0x07, - PHPExcel_Style_Border::BORDER_MEDIUMDASHED => 0x08, - PHPExcel_Style_Border::BORDER_DASHDOT => 0x09, - PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT => 0x0A, - PHPExcel_Style_Border::BORDER_DASHDOTDOT => 0x0B, - PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT => 0x0C, - PHPExcel_Style_Border::BORDER_SLANTDASHDOT => 0x0D, - ); + private static $mapBorderStyles = array( + PHPExcel_Style_Border::BORDER_NONE => 0x00, + PHPExcel_Style_Border::BORDER_THIN => 0x01, + PHPExcel_Style_Border::BORDER_MEDIUM => 0x02, + PHPExcel_Style_Border::BORDER_DASHED => 0x03, + PHPExcel_Style_Border::BORDER_DOTTED => 0x04, + PHPExcel_Style_Border::BORDER_THICK => 0x05, + PHPExcel_Style_Border::BORDER_DOUBLE => 0x06, + PHPExcel_Style_Border::BORDER_HAIR => 0x07, + PHPExcel_Style_Border::BORDER_MEDIUMDASHED => 0x08, + PHPExcel_Style_Border::BORDER_DASHDOT => 0x09, + PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT => 0x0A, + PHPExcel_Style_Border::BORDER_DASHDOTDOT => 0x0B, + PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT => 0x0C, + PHPExcel_Style_Border::BORDER_SLANTDASHDOT => 0x0D, + ); /** * Map border style @@ -399,10 +400,10 @@ class PHPExcel_Writer_Excel5_Xf * @param string $borderStyle * @return int */ - private static function _mapBorderStyle($borderStyle) + private static function mapBorderStyle($borderStyle) { - if (isset(self::$_mapBorderStyle[$borderStyle])) { - return self::$_mapBorderStyle[$borderStyle]; + if (isset(self::$mapBorderStyles[$borderStyle])) { + return self::$mapBorderStyles[$borderStyle]; } return 0x00; } @@ -412,38 +413,40 @@ class PHPExcel_Writer_Excel5_Xf * @static array of int * */ - private static $_mapFillType = array( PHPExcel_Style_Fill::FILL_NONE => 0x00, - PHPExcel_Style_Fill::FILL_SOLID => 0x01, - PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY => 0x02, - PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY => 0x03, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY => 0x04, - PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL => 0x05, - PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL => 0x06, - PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN => 0x07, - PHPExcel_Style_Fill::FILL_PATTERN_DARKUP => 0x08, - PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID => 0x09, - PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS => 0x0A, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL => 0x0B, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL => 0x0C, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN => 0x0D, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP => 0x0E, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID => 0x0F, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS => 0x10, - PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 => 0x11, - PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 => 0x12, - PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8 - PHPExcel_Style_Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8 - ); + private static $mapFillTypes = array( + PHPExcel_Style_Fill::FILL_NONE => 0x00, + PHPExcel_Style_Fill::FILL_SOLID => 0x01, + PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY => 0x02, + PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY => 0x03, + PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY => 0x04, + PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL => 0x05, + PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL => 0x06, + PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN => 0x07, + PHPExcel_Style_Fill::FILL_PATTERN_DARKUP => 0x08, + PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID => 0x09, + PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS => 0x0A, + PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL => 0x0B, + PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL => 0x0C, + PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN => 0x0D, + PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP => 0x0E, + PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID => 0x0F, + PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS => 0x10, + PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 => 0x11, + PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 => 0x12, + 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 * * @param string $fillType * @return int */ - private static function _mapFillType($fillType) + private static function mapFillType($fillType) { - if (isset(self::$_mapFillType[$fillType])) { - return self::$_mapFillType[$fillType]; + if (isset(self::$mapFillTypes[$fillType])) { + return self::$mapFillTypes[$fillType]; } return 0x00; } @@ -453,24 +456,26 @@ class PHPExcel_Writer_Excel5_Xf * @static array of int * */ - private static $_mapHAlign = array( PHPExcel_Style_Alignment::HORIZONTAL_GENERAL => 0, - PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1, - PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2, - PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3, - PHPExcel_Style_Alignment::HORIZONTAL_FILL => 4, - PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY => 5, - PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6, - ); + private static $mapHAlignments = array( + PHPExcel_Style_Alignment::HORIZONTAL_GENERAL => 0, + PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1, + PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2, + PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3, + PHPExcel_Style_Alignment::HORIZONTAL_FILL => 4, + PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY => 5, + PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6, + ); + /** * Map to BIFF2-BIFF8 codes for horizontal alignment * * @param string $hAlign * @return int */ - private function _mapHAlign($hAlign) + private function mapHAlign($hAlign) { - if (isset(self::$_mapHAlign[$hAlign])) { - return self::$_mapHAlign[$hAlign]; + if (isset(self::$mapHAlignments[$hAlign])) { + return self::$mapHAlignments[$hAlign]; } return 0; } @@ -480,21 +485,23 @@ class PHPExcel_Writer_Excel5_Xf * @static array of int * */ - private static $_mapVAlign = array( PHPExcel_Style_Alignment::VERTICAL_TOP => 0, - PHPExcel_Style_Alignment::VERTICAL_CENTER => 1, - PHPExcel_Style_Alignment::VERTICAL_BOTTOM => 2, - PHPExcel_Style_Alignment::VERTICAL_JUSTIFY => 3, - ); + private static $mapVAlignments = array( + PHPExcel_Style_Alignment::VERTICAL_TOP => 0, + PHPExcel_Style_Alignment::VERTICAL_CENTER => 1, + PHPExcel_Style_Alignment::VERTICAL_BOTTOM => 2, + PHPExcel_Style_Alignment::VERTICAL_JUSTIFY => 3, + ); + /** * Map to BIFF2-BIFF8 codes for vertical alignment * * @param string $vAlign * @return int */ - private static function _mapVAlign($vAlign) + private static function mapVAlign($vAlign) { - if (isset(self::$_mapVAlign[$vAlign])) { - return self::$_mapVAlign[$vAlign]; + if (isset(self::$mapVAlignments[$vAlign])) { + return self::$mapVAlignments[$vAlign]; } return 2; } @@ -505,15 +512,13 @@ class PHPExcel_Writer_Excel5_Xf * @param int $textRotation * @return int */ - private static function _mapTextRotation($textRotation) + private static function mapTextRotation($textRotation) { if ($textRotation >= 0) { return $textRotation; - } - if ($textRotation == -165) { + } elseif ($textRotation == -165) { return 255; - } - if ($textRotation < 0) { + } elseif ($textRotation < 0) { return 90 - $textRotation; } } @@ -524,7 +529,7 @@ class PHPExcel_Writer_Excel5_Xf * @param string * @return int */ - private static function _mapLocked($locked) + private static function mapLocked($locked) { switch ($locked) { case PHPExcel_Style_Protection::PROTECTION_INHERIT: @@ -544,7 +549,7 @@ class PHPExcel_Writer_Excel5_Xf * @param string * @return int */ - private static function _mapHidden($hidden) + private static function mapHidden($hidden) { switch ($hidden) { case PHPExcel_Style_Protection::PROTECTION_INHERIT: diff --git a/Classes/PHPExcel/Writer/PDF/Core.php b/Classes/PHPExcel/Writer/PDF/Core.php index 8075c555..ec3254b9 100644 --- a/Classes/PHPExcel/Writer/PDF/Core.php +++ b/Classes/PHPExcel/Writer/PDF/Core.php @@ -32,14 +32,14 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML * * @var string */ - protected $_tempDir = ''; + protected $tempDir = ''; /** * Font * * @var string */ - protected $_font = 'freesans'; + protected $font = 'freesans'; /** * Orientation (Over-ride) @@ -212,7 +212,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML { parent::__construct($phpExcel); $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() { - return $this->_font; + return $this->font; } /** @@ -236,7 +236,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML */ public function setFont($fontName) { - $this->_font = $fontName; + $this->font = $fontName; return $this; } @@ -291,7 +291,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML */ 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 = '') { if (is_dir($pValue)) { - $this->_tempDir = $pValue; + $this->tempDir = $pValue; } else { throw new PHPExcel_Writer_Exception("Directory does not exist: $pValue"); }