From 0c177b5ea2ac2b87d6161d9a9acbdb95e222c879 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Wed, 20 May 2015 19:17:17 +0100 Subject: [PATCH] We modified another block of files to psr-2, and their jaws dropped when they saw what happened next --- Classes/PHPExcel/Reader/Abstract.php | 52 +- Classes/PHPExcel/Reader/CSV.php | 80 +- Classes/PHPExcel/Reader/DefaultReadFilter.php | 36 +- Classes/PHPExcel/Reader/Excel2003XML.php | 50 +- Classes/PHPExcel/Reader/Excel2007.php | 238 +- Classes/PHPExcel/Reader/Excel5.php | 2403 ++++++++--------- Classes/PHPExcel/Reader/Excel5/Escher.php | 86 +- Classes/PHPExcel/Reader/Exception.php | 12 +- Classes/PHPExcel/Reader/Gnumeric.php | 74 +- Classes/PHPExcel/Reader/HTML.php | 147 +- Classes/PHPExcel/Reader/IReadFilter.php | 6 +- Classes/PHPExcel/Reader/IReader.php | 12 +- Classes/PHPExcel/Reader/OOCalc.php | 8 +- Classes/PHPExcel/Reader/SYLK.php | 52 +- Classes/PHPExcel/Shared/CodePage.php | 149 +- Classes/PHPExcel/Shared/OLERead.php | 34 +- Classes/PHPExcel/Worksheet/AutoFilter.php | 134 +- .../PHPExcel/Worksheet/AutoFilter/Column.php | 104 +- .../Worksheet/AutoFilter/Column/Rule.php | 204 +- Classes/PHPExcel/Worksheet/BaseDrawing.php | 36 +- Classes/PHPExcel/Worksheet/Drawing.php | 32 +- Classes/PHPExcel/Worksheet/Drawing/Shadow.php | 100 +- Classes/PHPExcel/Worksheet/HeaderFooter.php | 120 +- .../Worksheet/HeaderFooterDrawing.php | 120 +- Classes/PHPExcel/Worksheet/MemoryDrawing.php | 80 +- Classes/PHPExcel/Worksheet/PageSetup.php | 124 +- Classes/PHPExcel/Writer/Abstract.php | 6 +- Classes/PHPExcel/Writer/Excel2007.php | 14 +- Classes/PHPExcel/Writer/HTML.php | 334 +-- Classes/PHPExcel/Writer/PDF/Core.php | 4 +- Classes/PHPExcel/Writer/PDF/DomPDF.php | 12 +- Classes/PHPExcel/Writer/PDF/mPDF.php | 22 +- Classes/PHPExcel/Writer/PDF/tcPDF.php | 22 +- .../Calculation/MathTrig/QUOTIENT.data | 2 +- 34 files changed, 2382 insertions(+), 2527 deletions(-) diff --git a/Classes/PHPExcel/Reader/Abstract.php b/Classes/PHPExcel/Reader/Abstract.php index 08f8dbd..5902574 100644 --- a/Classes/PHPExcel/Reader/Abstract.php +++ b/Classes/PHPExcel/Reader/Abstract.php @@ -1,6 +1,7 @@ _readDataOnly; + return $this->readDataOnly; } /** @@ -93,7 +85,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader */ public function setReadDataOnly($pValue = false) { - $this->_readDataOnly = $pValue; + $this->readDataOnly = $pValue; return $this; } @@ -107,7 +99,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader */ public function getIncludeCharts() { - return $this->_includeCharts; + return $this->includeCharts; } /** @@ -122,7 +114,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader */ public function setIncludeCharts($pValue = false) { - $this->_includeCharts = (boolean) $pValue; + $this->includeCharts = (boolean) $pValue; return $this; } @@ -135,7 +127,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader */ public function getLoadSheetsOnly() { - return $this->_loadSheetsOnly; + return $this->loadSheetsOnly; } /** @@ -153,7 +145,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader return $this->setLoadAllSheets(); } - $this->_loadSheetsOnly = is_array($value) ? $value : array($value); + $this->loadSheetsOnly = is_array($value) ? $value : array($value); return $this; } @@ -165,7 +157,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader */ public function setLoadAllSheets() { - $this->_loadSheetsOnly = null; + $this->loadSheetsOnly = null; return $this; } @@ -176,7 +168,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader */ public function getReadFilter() { - return $this->_readFilter; + return $this->readFilter; } /** @@ -187,7 +179,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader */ public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) { - $this->_readFilter = $pValue; + $this->readFilter = $pValue; return $this; } @@ -198,7 +190,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader * @throws PHPExcel_Reader_Exception * @return resource */ - protected function _openFile($pFilename) + protected function openFile($pFilename) { // Check if file exists if (!file_exists($pFilename) || !is_readable($pFilename)) { @@ -206,8 +198,8 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader } // Open file - $this->_fileHandle = fopen($pFilename, 'r'); - if ($this->_fileHandle === false) { + $this->fileHandle = fopen($pFilename, 'r'); + if ($this->fileHandle === false) { throw new PHPExcel_Reader_Exception("Could not open file " . $pFilename . " for reading."); } } @@ -223,13 +215,13 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader { // Check if file exists try { - $this->_openFile($pFilename); + $this->openFile($pFilename); } catch (Exception $e) { return false; } - $readable = $this->_isValidFormat(); - fclose($this->_fileHandle); + $readable = $this->isValidFormat(); + fclose($this->fileHandle); return $readable; } diff --git a/Classes/PHPExcel/Reader/CSV.php b/Classes/PHPExcel/Reader/CSV.php index 65e2d3b..db96b60 100644 --- a/Classes/PHPExcel/Reader/CSV.php +++ b/Classes/PHPExcel/Reader/CSV.php @@ -1,6 +1,16 @@ _readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->readFilter = new PHPExcel_Reader_DefaultReadFilter(); } /** @@ -105,7 +97,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R * * @return boolean */ - protected function _isValidFormat() + protected function isValidFormat() { return true; } @@ -135,30 +127,30 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R * Move filepointer past any BOM marker * */ - protected function _skipBOM() + protected function skipBOM() { - rewind($this->_fileHandle); + rewind($this->fileHandle); switch ($this->inputEncoding) { case 'UTF-8': - fgets($this->_fileHandle, 4) == "\xEF\xBB\xBF" ? - fseek($this->_fileHandle, 3) : fseek($this->_fileHandle, 0); + fgets($this->fileHandle, 4) == "\xEF\xBB\xBF" ? + fseek($this->fileHandle, 3) : fseek($this->fileHandle, 0); break; case 'UTF-16LE': - fgets($this->_fileHandle, 3) == "\xFF\xFE" ? - fseek($this->_fileHandle, 2) : fseek($this->_fileHandle, 0); + fgets($this->fileHandle, 3) == "\xFF\xFE" ? + fseek($this->fileHandle, 2) : fseek($this->fileHandle, 0); break; case 'UTF-16BE': - fgets($this->_fileHandle, 3) == "\xFE\xFF" ? - fseek($this->_fileHandle, 2) : fseek($this->_fileHandle, 0); + fgets($this->fileHandle, 3) == "\xFE\xFF" ? + fseek($this->fileHandle, 2) : fseek($this->fileHandle, 0); break; case 'UTF-32LE': - fgets($this->_fileHandle, 5) == "\xFF\xFE\x00\x00" ? - fseek($this->_fileHandle, 4) : fseek($this->_fileHandle, 0); + fgets($this->fileHandle, 5) == "\xFF\xFE\x00\x00" ? + fseek($this->fileHandle, 4) : fseek($this->fileHandle, 0); break; case 'UTF-32BE': - fgets($this->_fileHandle, 5) == "\x00\x00\xFE\xFF" ? - fseek($this->_fileHandle, 4) : fseek($this->_fileHandle, 0); + fgets($this->fileHandle, 5) == "\x00\x00\xFE\xFF" ? + fseek($this->fileHandle, 4) : fseek($this->fileHandle, 0); break; default: break; @@ -174,15 +166,15 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R public function listWorksheetInfo($pFilename) { // Open file - $this->_openFile($pFilename); - if (!$this->_isValidFormat()) { - fclose($this->_fileHandle); + $this->openFile($pFilename); + if (!$this->isValidFormat()) { + fclose($this->fileHandle); throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } - $fileHandle = $this->_fileHandle; + $fileHandle = $this->fileHandle; // Skip BOM, if any - $this->_skipBOM(); + $this->skipBOM(); $escapeEnclosures = array( "\\" . $this->enclosure, $this->enclosure . $this->enclosure ); @@ -238,15 +230,15 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R ini_set('auto_detect_line_endings', true); // Open file - $this->_openFile($pFilename); - if (!$this->_isValidFormat()) { - fclose($this->_fileHandle); + $this->openFile($pFilename); + if (!$this->isValidFormat()) { + fclose($this->fileHandle); throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } - $fileHandle = $this->_fileHandle; + $fileHandle = $this->fileHandle; // Skip BOM, if any - $this->_skipBOM(); + $this->skipBOM(); // Create new PHPExcel object while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) { @@ -268,7 +260,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R while (($rowData = fgetcsv($fileHandle, 0, $this->delimiter, $this->enclosure)) !== false) { $columnLetter = 'A'; foreach ($rowData as $rowDatum) { - if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) { + if ($rowDatum != '' && $this->readFilter->readCell($columnLetter, $currentRow)) { // Unescape enclosures $rowDatum = str_replace($escapeEnclosures, $this->enclosure, $rowDatum); diff --git a/Classes/PHPExcel/Reader/DefaultReadFilter.php b/Classes/PHPExcel/Reader/DefaultReadFilter.php index 2e06dcb..ea25f63 100644 --- a/Classes/PHPExcel/Reader/DefaultReadFilter.php +++ b/Classes/PHPExcel/Reader/DefaultReadFilter.php @@ -1,6 +1,16 @@ _readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->readFilter = new PHPExcel_Reader_DefaultReadFilter(); } @@ -85,8 +85,8 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P ); // Open file - $this->_openFile($pFilename); - $fileHandle = $this->_fileHandle; + $this->openFile($pFilename); + $fileHandle = $this->fileHandle; // Read sample data (first 2 KB will do) $data = fread($fileHandle, 2048); @@ -135,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; @@ -247,7 +247,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P * @param pxs * @return */ - protected static function _pixel2WidthUnits($pxs) + protected static function pixel2WidthUnits($pxs) { $UNIT_OFFSET_MAP = array(0, 36, 73, 109, 146, 182, 219); @@ -261,7 +261,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P * @param widthUnits * @return */ - protected static function _widthUnits2Pixel($widthUnits) + protected static function widthUnits2Pixel($widthUnits) { $pixels = ($widthUnits / 256) * 7; $offsetWidthUnits = $widthUnits % 256; @@ -269,7 +269,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P return $pixels; } - protected static function _hex2str($hex) + protected static function hex2str($hex) { return chr(hexdec($hex[1])); } @@ -329,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; } } @@ -369,7 +369,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P if (isset($xml->CustomDocumentProperties)) { foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) { $propertyAttributes = $propertyValue->attributes($namespaces['dt']); - $propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', 'PHPExcel_Reader_Excel2003XML::_hex2str', $propertyName); + $propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', 'PHPExcel_Reader_Excel2003XML::hex2str', $propertyName); $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN; switch ((string) $propertyAttributes) { case 'string': @@ -531,8 +531,8 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P foreach ($xml_ss->Worksheet as $worksheet) { $worksheet_ss = $worksheet->attributes($namespaces['ss']); - if ((isset($this->_loadSheetsOnly)) && (isset($worksheet_ss['Name'])) && - (!in_array($worksheet_ss['Name'], $this->_loadSheetsOnly))) { + if ((isset($this->loadSheetsOnly)) && (isset($worksheet_ss['Name'])) && + (!in_array($worksheet_ss['Name'], $this->loadSheetsOnly))) { continue; } @@ -542,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 @@ -632,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': @@ -740,7 +740,7 @@ 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']))) { @@ -785,7 +785,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P } - protected static function _convertStringEncoding($string, $charset) + protected static function convertStringEncoding($string, $charset) { if ($charset != 'UTF-8') { return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $charset); @@ -794,11 +794,11 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P } - protected function _parseRichText($is = '') + protected function parseRichText($is = '') { $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 47a130e..2903313 100644 --- a/Classes/PHPExcel/Reader/Excel2007.php +++ b/Classes/PHPExcel/Reader/Excel2007.php @@ -55,7 +55,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE */ public function __construct() { - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->referenceHelper = PHPExcel_ReferenceHelper::getInstance(); } @@ -85,7 +85,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $zip = new $zipClass; if ($zip->open($pFilename) === true) { // check if it is an OOXML archive - $rels = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "_rels/.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); + $rels = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "_rels/.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); if ($rels !== false) { foreach ($rels->Relationship as $rel) { switch ($rel["Type"]) { @@ -127,13 +127,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // The files we're looking at here are small enough that simpleXML is more efficient than XMLReader $rels = simplexml_load_string( - $this->securityScan($this->_getFromZipArchive($zip, "_rels/.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()) + $this->securityScan($this->getFromZipArchive($zip, "_rels/.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()) ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); foreach ($rels->Relationship as $rel) { switch ($rel["Type"]) { case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument": $xmlWorkbook = simplexml_load_string( - $this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()) + $this->securityScan($this->getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()) ); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); if ($xmlWorkbook->sheets) { @@ -171,11 +171,11 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $zip = new $zipClass; $zip->open($pFilename); - $rels = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "_rels/.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $rels = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "_rels/.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); foreach ($rels->Relationship as $rel) { if ($rel["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") { $dir = dirname($rel["Target"]); - $relsWorkbook = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsWorkbook = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); $relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships"); $worksheets = array(); @@ -185,7 +185,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } - $xmlWorkbook = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + $xmlWorkbook = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); if ($xmlWorkbook->sheets) { $dir = dirname($rel["Target"]); foreach ($xmlWorkbook->sheets->sheet as $eleSheet) { @@ -197,7 +197,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE 'totalColumns' => 0, ); - $fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; + $fileWorksheet = $worksheets[(string) self::getArrayItem($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; $xml = new XMLReader(); $res = $xml->xml($this->securityScanFile('zip://'.PHPExcel_Shared_File::realpath($pFilename).'#'."$dir/$fileWorksheet"), null, PHPExcel_Settings::getLibXmlLoaderOptions()); @@ -299,7 +299,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } - public function _getFromZipArchive($archive, $fileName = '') + private function getFromZipArchive($archive, $fileName = '') { // Root-relative paths if (strpos($fileName, '//') !== false) { @@ -334,7 +334,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // Initialisations $excel = new PHPExcel; $excel->removeSheetByIndex(0); - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { $excel->removeCellStyleXfByIndex(0); // remove the default style $excel->removeCellXfByIndex(0); // remove the default style } @@ -345,14 +345,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $zip->open($pFilename); // Read the theme first, because we need the colour scheme when reading the styles - $wbRels = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "xl/_rels/workbook.xml.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $wbRels = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "xl/_rels/workbook.xml.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); foreach ($wbRels->Relationship as $rel) { switch ($rel["Type"]) { case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme": $themeOrderArray = array('lt1', 'dk1', 'lt2', 'dk2'); $themeOrderAdditional = count($themeOrderArray); - $xmlTheme = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "xl/{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); + $xmlTheme = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "xl/{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); if (is_object($xmlTheme)) { $xmlThemeName = $xmlTheme->attributes(); $xmlTheme = $xmlTheme->children("http://schemas.openxmlformats.org/drawingml/2006/main"); @@ -382,29 +382,29 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } - $rels = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "_rels/.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $rels = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "_rels/.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); foreach ($rels->Relationship as $rel) { switch ($rel["Type"]) { case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties": - $xmlCore = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); + $xmlCore = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); if (is_object($xmlCore)) { $xmlCore->registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/"); $xmlCore->registerXPathNamespace("dcterms", "http://purl.org/dc/terms/"); $xmlCore->registerXPathNamespace("cp", "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"); $docProps = $excel->getProperties(); - $docProps->setCreator((string) self::array_item($xmlCore->xpath("dc:creator"))); - $docProps->setLastModifiedBy((string) self::array_item($xmlCore->xpath("cp:lastModifiedBy"))); - $docProps->setCreated(strtotime(self::array_item($xmlCore->xpath("dcterms:created")))); //! respect xsi:type - $docProps->setModified(strtotime(self::array_item($xmlCore->xpath("dcterms:modified")))); //! respect xsi:type - $docProps->setTitle((string) self::array_item($xmlCore->xpath("dc:title"))); - $docProps->setDescription((string) self::array_item($xmlCore->xpath("dc:description"))); - $docProps->setSubject((string) self::array_item($xmlCore->xpath("dc:subject"))); - $docProps->setKeywords((string) self::array_item($xmlCore->xpath("cp:keywords"))); - $docProps->setCategory((string) self::array_item($xmlCore->xpath("cp:category"))); + $docProps->setCreator((string) self::getArrayItem($xmlCore->xpath("dc:creator"))); + $docProps->setLastModifiedBy((string) self::getArrayItem($xmlCore->xpath("cp:lastModifiedBy"))); + $docProps->setCreated(strtotime(self::getArrayItem($xmlCore->xpath("dcterms:created")))); //! respect xsi:type + $docProps->setModified(strtotime(self::getArrayItem($xmlCore->xpath("dcterms:modified")))); //! respect xsi:type + $docProps->setTitle((string) self::getArrayItem($xmlCore->xpath("dc:title"))); + $docProps->setDescription((string) self::getArrayItem($xmlCore->xpath("dc:description"))); + $docProps->setSubject((string) self::getArrayItem($xmlCore->xpath("dc:subject"))); + $docProps->setKeywords((string) self::getArrayItem($xmlCore->xpath("cp:keywords"))); + $docProps->setCategory((string) self::getArrayItem($xmlCore->xpath("cp:category"))); } break; case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties": - $xmlCore = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); + $xmlCore = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); if (is_object($xmlCore)) { $docProps = $excel->getProperties(); if (isset($xmlCore->Company)) { @@ -416,7 +416,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } break; case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties": - $xmlCore = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); + $xmlCore = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); if (is_object($xmlCore)) { $docProps = $excel->getProperties(); foreach ($xmlCore as $xmlProperty) { @@ -442,12 +442,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE break; case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument": $dir = dirname($rel["Target"]); - $relsWorkbook = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsWorkbook = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); $relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships"); $sharedStrings = array(); - $xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']")); - $xmlStrings = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + $xpath = self::getArrayItem($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']")); + $xmlStrings = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "$dir/$xpath[Target]")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); if (isset($xmlStrings) && isset($xmlStrings->si)) { foreach ($xmlStrings->si as $val) { if (isset($val->t)) { @@ -473,12 +473,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } if (!is_null($macros)) { - $macrosCode = $this->_getFromZipArchive($zip, 'xl/vbaProject.bin');//vbaProject.bin always in 'xl' dir and always named vbaProject.bin + $macrosCode = $this->getFromZipArchive($zip, 'xl/vbaProject.bin');//vbaProject.bin always in 'xl' dir and always named vbaProject.bin if ($macrosCode !== false) { $excel->setMacrosCode($macrosCode); $excel->setHasMacros(true); //short-circuit : not reading vbaProject.bin.rel to get Signature =>allways vbaProjectSignature.bin in 'xl' dir - $Certificate = $this->_getFromZipArchive($zip, 'xl/vbaProjectSignature.bin'); + $Certificate = $this->getFromZipArchive($zip, 'xl/vbaProjectSignature.bin'); if ($Certificate !== false) { $excel->setMacrosCertificate($Certificate); } @@ -486,8 +486,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } $styles = array(); $cellStyles = array(); - $xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']")); - $xmlStyles = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + $xpath = self::getArrayItem($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']")); + $xmlStyles = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "$dir/$xpath[Target]")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); $numFmts = null; if ($xmlStyles && $xmlStyles->numFmts[0]) { $numFmts = $xmlStyles->numFmts[0]; @@ -495,13 +495,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if (isset($numFmts) && ($numFmts !== null)) { $numFmts->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); } - if (!$this->_readDataOnly && $xmlStyles) { + if (!$this->readDataOnly && $xmlStyles) { foreach ($xmlStyles->cellXfs->xf as $xf) { $numFmt = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; if ($xf["numFmtId"]) { if (isset($numFmts)) { - $tmpNumFmt = self::array_item($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]")); + $tmpNumFmt = self::getArrayItem($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]")); if (isset($tmpNumFmt["formatCode"])) { $numFmt = (string) $tmpNumFmt["formatCode"]; @@ -539,7 +539,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE foreach ($xmlStyles->cellStyleXfs->xf as $xf) { $numFmt = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; if ($numFmts && $xf["numFmtId"]) { - $tmpNumFmt = self::array_item($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]")); + $tmpNumFmt = self::getArrayItem($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]")); if (isset($tmpNumFmt["formatCode"])) { $numFmt = (string) $tmpNumFmt["formatCode"]; } elseif ((int)$xf["numFmtId"] < 165) { @@ -566,7 +566,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } $dxfs = array(); - if (!$this->_readDataOnly && $xmlStyles) { + if (!$this->readDataOnly && $xmlStyles) { // Conditional Styles if ($xmlStyles->dxfs) { foreach ($xmlStyles->dxfs->dxf as $dxf) { @@ -591,7 +591,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } - $xmlWorkbook = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + $xmlWorkbook = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); // Set base date if ($xmlWorkbook->workbookPr) { @@ -615,7 +615,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE ++$oldSheetId; // Check if sheet should be skipped - if (isset($this->_loadSheetsOnly) && !in_array((string) $eleSheet["name"], $this->_loadSheetsOnly)) { + if (isset($this->loadSheetsOnly) && !in_array((string) $eleSheet["name"], $this->loadSheetsOnly)) { ++$countSkippedSheets; $mapSheetId[$oldSheetId] = null; continue; @@ -632,8 +632,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // and we're simply bringing the worksheet name in line with the formula, not the // reverse $docSheet->setTitle((string) $eleSheet["name"], false); - $fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; - $xmlSheet = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + $fileWorksheet = $worksheets[(string) self::getArrayItem($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; + $xmlSheet = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "$dir/$fileWorksheet")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); $sharedFormulas = array(); @@ -737,10 +737,10 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } - if (isset($xmlSheet->cols) && !$this->_readDataOnly) { + if (isset($xmlSheet->cols) && !$this->readDataOnly) { foreach ($xmlSheet->cols->col as $col) { for ($i = intval($col["min"]) - 1; $i < intval($col["max"]); ++$i) { - if ($col["style"] && !$this->_readDataOnly) { + if ($col["style"] && !$this->readDataOnly) { $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setXfIndex(intval($col["style"])); } if (self::boolean($col["bestFit"])) { @@ -765,7 +765,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } - if (isset($xmlSheet->printOptions) && !$this->_readDataOnly) { + if (isset($xmlSheet->printOptions) && !$this->readDataOnly) { if (self::boolean((string) $xmlSheet->printOptions['gridLinesSet'])) { $docSheet->setShowGridlines(true); } @@ -782,10 +782,10 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if ($xmlSheet && $xmlSheet->sheetData && $xmlSheet->sheetData->row) { foreach ($xmlSheet->sheetData->row as $row) { - if ($row["ht"] && !$this->_readDataOnly) { + if ($row["ht"] && !$this->readDataOnly) { $docSheet->getRowDimension(intval($row["r"]))->setRowHeight(floatval($row["ht"])); } - if (self::boolean($row["hidden"]) && !$this->_readDataOnly) { + if (self::boolean($row["hidden"]) && !$this->readDataOnly) { $docSheet->getRowDimension(intval($row["r"]))->setVisible(false); } if (self::boolean($row["collapsed"])) { @@ -794,7 +794,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if ($row["outlineLevel"] > 0) { $docSheet->getRowDimension(intval($row["r"]))->setOutlineLevel(intval($row["outlineLevel"])); } - if ($row["s"] && !$this->_readDataOnly) { + if ($row["s"] && !$this->readDataOnly) { $docSheet->getRowDimension(intval($row["r"]))->setXfIndex(intval($row["s"])); } @@ -888,7 +888,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } // Rich text? - if ($value instanceof PHPExcel_RichText && $this->_readDataOnly) { + if ($value instanceof PHPExcel_RichText && $this->readDataOnly) { $value = $value->getPlainText(); } @@ -904,7 +904,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } // Style information? - if ($c["s"] && !$this->_readDataOnly) { + if ($c["s"] && !$this->readDataOnly) { // no style index means 0, it seems $cell->setXfIndex(isset($styles[intval($c["s"])]) ? intval($c["s"]) : 0); @@ -914,7 +914,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } $conditionals = array(); - if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) { + if (!$this->readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) { foreach ($xmlSheet->conditionalFormatting as $conditional) { foreach ($conditional->cfRule as $cfRule) { if (((string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) && isset($dxfs[intval($cfRule["dxfId"])])) { @@ -955,14 +955,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } $aKeys = array("sheet", "objects", "scenarios", "formatCells", "formatColumns", "formatRows", "insertColumns", "insertRows", "insertHyperlinks", "deleteColumns", "deleteRows", "selectLockedCells", "sort", "autoFilter", "pivotTables", "selectUnlockedCells"); - if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { + if (!$this->readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { foreach ($aKeys as $key) { $method = "set" . ucfirst($key); $docSheet->getProtection()->$method(self::boolean((string) $xmlSheet->sheetProtection[$key])); } } - if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { + if (!$this->readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { $docSheet->getProtection()->setPassword((string) $xmlSheet->sheetProtection["password"], true); if ($xmlSheet->protectedRanges->protectedRange) { foreach ($xmlSheet->protectedRanges->protectedRange as $protectedRange) { @@ -971,7 +971,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } - if ($xmlSheet && $xmlSheet->autoFilter && !$this->_readDataOnly) { + if ($xmlSheet && $xmlSheet->autoFilter && !$this->readDataOnly) { $autoFilterRange = (string) $xmlSheet->autoFilter["ref"]; if (strpos($autoFilterRange, ':') !== false) { $autoFilter = $docSheet->getAutoFilter(); @@ -1071,7 +1071,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } - if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && !$this->_readDataOnly) { + if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && !$this->readDataOnly) { foreach ($xmlSheet->mergeCells->mergeCell as $mergeCell) { $mergeRef = (string) $mergeCell["ref"]; if (strpos($mergeRef, ':') !== false) { @@ -1080,7 +1080,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } - if ($xmlSheet && $xmlSheet->pageMargins && !$this->_readDataOnly) { + if ($xmlSheet && $xmlSheet->pageMargins && !$this->readDataOnly) { $docPageMargins = $docSheet->getPageMargins(); $docPageMargins->setLeft(floatval($xmlSheet->pageMargins["left"])); $docPageMargins->setRight(floatval($xmlSheet->pageMargins["right"])); @@ -1090,7 +1090,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $docPageMargins->setFooter(floatval($xmlSheet->pageMargins["footer"])); } - if ($xmlSheet && $xmlSheet->pageSetup && !$this->_readDataOnly) { + if ($xmlSheet && $xmlSheet->pageSetup && !$this->readDataOnly) { $docPageSetup = $docSheet->getPageSetup(); if (isset($xmlSheet->pageSetup["orientation"])) { @@ -1114,7 +1114,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } - if ($xmlSheet && $xmlSheet->headerFooter && !$this->_readDataOnly) { + if ($xmlSheet && $xmlSheet->headerFooter && !$this->readDataOnly) { $docHeaderFooter = $docSheet->getHeaderFooter(); if (isset($xmlSheet->headerFooter["differentOddEven"]) && @@ -1150,14 +1150,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $docHeaderFooter->setFirstFooter((string) $xmlSheet->headerFooter->firstFooter); } - if ($xmlSheet && $xmlSheet->rowBreaks && $xmlSheet->rowBreaks->brk && !$this->_readDataOnly) { + if ($xmlSheet && $xmlSheet->rowBreaks && $xmlSheet->rowBreaks->brk && !$this->readDataOnly) { foreach ($xmlSheet->rowBreaks->brk as $brk) { if ($brk["man"]) { $docSheet->setBreak("A$brk[id]", PHPExcel_Worksheet::BREAK_ROW); } } } - if ($xmlSheet && $xmlSheet->colBreaks && $xmlSheet->colBreaks->brk && !$this->_readDataOnly) { + if ($xmlSheet && $xmlSheet->colBreaks && $xmlSheet->colBreaks->brk && !$this->readDataOnly) { foreach ($xmlSheet->colBreaks->brk as $brk) { if ($brk["man"]) { $docSheet->setBreak(PHPExcel_Cell::stringFromColumnIndex((string) $brk["id"]) . "1", PHPExcel_Worksheet::BREAK_COLUMN); @@ -1165,7 +1165,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } - if ($xmlSheet && $xmlSheet->dataValidations && !$this->_readDataOnly) { + if ($xmlSheet && $xmlSheet->dataValidations && !$this->readDataOnly) { foreach ($xmlSheet->dataValidations->dataValidation as $dataValidation) { // Uppercase coordinate $range = strtoupper($dataValidation["sqref"]); @@ -1198,10 +1198,10 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // Add hyperlinks $hyperlinks = array(); - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // Locate hyperlink relations if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { - $relsWorksheet = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsWorksheet = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); foreach ($relsWorksheet->Relationship as $ele) { if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") { $hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"]; @@ -1239,10 +1239,10 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // Add comments $comments = array(); $vmlComments = array(); - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // Locate comment relations if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { - $relsWorksheet = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsWorksheet = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); foreach ($relsWorksheet->Relationship as $ele) { if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") { $comments[(string)$ele["Id"]] = (string)$ele["Target"]; @@ -1257,7 +1257,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE foreach ($comments as $relName => $relPath) { // Load comments file $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); - $commentsFile = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $relPath)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); + $commentsFile = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, $relPath)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); // Utility variables $authors = array(); @@ -1280,7 +1280,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE foreach ($vmlComments as $relName => $relPath) { // Load VML comments file $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); - $vmlCommentsFile = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $relPath)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); + $vmlCommentsFile = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, $relPath)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); $vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); $shapes = $vmlCommentsFile->xpath('//v:shape'); @@ -1342,29 +1342,29 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } // Header/footer images - if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) { + if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->readDataOnly) { if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { - $relsWorksheet = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsWorksheet = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); $vmlRelationship = ''; foreach ($relsWorksheet->Relationship as $ele) { if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") { - $vmlRelationship = self::dir_add("$dir/$fileWorksheet", $ele["Target"]); + $vmlRelationship = self::dirAdd("$dir/$fileWorksheet", $ele["Target"]); } } if ($vmlRelationship != '') { // Fetch linked images - $relsVML = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels')), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsVML = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels')), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); $drawings = array(); foreach ($relsVML->Relationship as $ele) { if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") { - $drawings[(string) $ele["Id"]] = self::dir_add($vmlRelationship, $ele["Target"]); + $drawings[(string) $ele["Id"]] = self::dirAdd($vmlRelationship, $ele["Target"]); } } // Fetch VML document - $vmlDrawing = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $vmlRelationship)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); + $vmlDrawing = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, $vmlRelationship)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); $vmlDrawing->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); $hfImages = array(); @@ -1403,26 +1403,26 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE // TODO: Autoshapes from twoCellAnchors! if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { - $relsWorksheet = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsWorksheet = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); $drawings = array(); foreach ($relsWorksheet->Relationship as $ele) { if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") { - $drawings[(string) $ele["Id"]] = self::dir_add("$dir/$fileWorksheet", $ele["Target"]); + $drawings[(string) $ele["Id"]] = self::dirAdd("$dir/$fileWorksheet", $ele["Target"]); } } - if ($xmlSheet->drawing && !$this->_readDataOnly) { + if ($xmlSheet->drawing && !$this->readDataOnly) { foreach ($xmlSheet->drawing as $drawing) { - $fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; - $relsDrawing = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $fileDrawing = $drawings[(string) self::getArrayItem($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; + $relsDrawing = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); $images = array(); if ($relsDrawing && $relsDrawing->Relationship) { foreach ($relsDrawing->Relationship as $ele) { if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") { - $images[(string) $ele["Id"]] = self::dir_add($fileDrawing, $ele["Target"]); + $images[(string) $ele["Id"]] = self::dirAdd($fileDrawing, $ele["Target"]); } elseif ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart") { - if ($this->_includeCharts) { - $charts[self::dir_add($fileDrawing, $ele["Target"])] = array( + if ($this->includeCharts) { + $charts[self::dirAdd($fileDrawing, $ele["Target"])] = array( 'id' => (string) $ele["Id"], 'sheet' => $docSheet->getTitle() ); @@ -1430,7 +1430,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } } - $xmlDrawing = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $fileDrawing)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"); + $xmlDrawing = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, $fileDrawing)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"); if ($xmlDrawing->oneCellAnchor) { foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) { @@ -1439,27 +1439,27 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $xfrm = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm; $outerShdw = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw; $objDrawing = new PHPExcel_Worksheet_Drawing; - $objDrawing->setName((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); - $objDrawing->setDescription((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); - $objDrawing->setPath("zip://".PHPExcel_Shared_File::realpath($pFilename)."#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); + $objDrawing->setName((string) self::getArrayItem($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); + $objDrawing->setDescription((string) self::getArrayItem($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); + $objDrawing->setPath("zip://".PHPExcel_Shared_File::realpath($pFilename)."#" . $images[(string) self::getArrayItem($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1)); $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff)); $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff)); $objDrawing->setResizeProportional(false); - $objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx"))); - $objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy"))); + $objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::getArrayItem($oneCellAnchor->ext->attributes(), "cx"))); + $objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::getArrayItem($oneCellAnchor->ext->attributes(), "cy"))); if ($xfrm) { - $objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot"))); + $objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::getArrayItem($xfrm->attributes(), "rot"))); } if ($outerShdw) { $shadow = $objDrawing->getShadow(); $shadow->setVisible(true); - $shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "blurRad"))); - $shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "dist"))); - $shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes(), "dir"))); - $shadow->setAlignment((string) self::array_item($outerShdw->attributes(), "algn")); - $shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes(), "val")); - $shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000); + $shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::getArrayItem($outerShdw->attributes(), "blurRad"))); + $shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::getArrayItem($outerShdw->attributes(), "dist"))); + $shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::getArrayItem($outerShdw->attributes(), "dir"))); + $shadow->setAlignment((string) self::getArrayItem($outerShdw->attributes(), "algn")); + $shadow->getColor()->setRGB(self::getArrayItem($outerShdw->srgbClr->attributes(), "val")); + $shadow->setAlpha(self::getArrayItem($outerShdw->srgbClr->alpha->attributes(), "val") / 1000); } $objDrawing->setWorksheet($docSheet); } else { @@ -1467,8 +1467,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $coordinates = PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1); $offsetX = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff); $offsetY = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff); - $width = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx")); - $height = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy")); + $width = PHPExcel_Shared_Drawing::EMUToPixels(self::getArrayItem($oneCellAnchor->ext->attributes(), "cx")); + $height = PHPExcel_Shared_Drawing::EMUToPixels(self::getArrayItem($oneCellAnchor->ext->attributes(), "cy")); } } } @@ -1479,31 +1479,31 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $xfrm = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm; $outerShdw = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw; $objDrawing = new PHPExcel_Worksheet_Drawing; - $objDrawing->setName((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); - $objDrawing->setDescription((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); - $objDrawing->setPath("zip://".PHPExcel_Shared_File::realpath($pFilename)."#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); + $objDrawing->setName((string) self::getArrayItem($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); + $objDrawing->setDescription((string) self::getArrayItem($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); + $objDrawing->setPath("zip://".PHPExcel_Shared_File::realpath($pFilename)."#" . $images[(string) self::getArrayItem($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1)); $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff)); $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff)); $objDrawing->setResizeProportional(false); if ($xfrm) { - $objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cx"))); - $objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cy"))); - $objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot"))); + $objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::getArrayItem($xfrm->ext->attributes(), "cx"))); + $objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::getArrayItem($xfrm->ext->attributes(), "cy"))); + $objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::getArrayItem($xfrm->attributes(), "rot"))); } if ($outerShdw) { $shadow = $objDrawing->getShadow(); $shadow->setVisible(true); - $shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "blurRad"))); - $shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "dist"))); - $shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes(), "dir"))); - $shadow->setAlignment((string) self::array_item($outerShdw->attributes(), "algn")); - $shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes(), "val")); - $shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000); + $shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::getArrayItem($outerShdw->attributes(), "blurRad"))); + $shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::getArrayItem($outerShdw->attributes(), "dist"))); + $shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::getArrayItem($outerShdw->attributes(), "dir"))); + $shadow->setAlignment((string) self::getArrayItem($outerShdw->attributes(), "algn")); + $shadow->getColor()->setRGB(self::getArrayItem($outerShdw->srgbClr->attributes(), "val")); + $shadow->setAlpha(self::getArrayItem($outerShdw->srgbClr->alpha->attributes(), "val") / 1000); } $objDrawing->setWorksheet($docSheet); - } elseif (($this->_includeCharts) && ($twoCellAnchor->graphicFrame)) { + } elseif (($this->includeCharts) && ($twoCellAnchor->graphicFrame)) { $fromCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1); $fromOffsetX = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff); $fromOffsetY = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff); @@ -1671,7 +1671,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } - if ((!$this->_readDataOnly) || (!empty($this->_loadSheetsOnly))) { + if ((!$this->readDataOnly) || (!empty($this->loadSheetsOnly))) { // active sheet index $activeTab = intval($xmlWorkbook->bookViews->workbookView["activeTab"]); // refers to old sheet index @@ -1689,14 +1689,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } - if (!$this->_readDataOnly) { - $contentTypes = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "[Content_Types].xml")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); + if (!$this->readDataOnly) { + $contentTypes = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, "[Content_Types].xml")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); foreach ($contentTypes->Override as $contentType) { switch ($contentType["ContentType"]) { case "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": - if ($this->_includeCharts) { + if ($this->includeCharts) { $chartEntryRef = ltrim($contentType['PartName'], '/'); - $chartElements = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $chartEntryRef)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); + $chartElements = simplexml_load_string($this->securityScan($this->getFromZipArchive($zip, $chartEntryRef)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); $objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements, basename($chartEntryRef, '.xml')); // echo 'Chart ', $chartEntryRef, '
'; @@ -1799,8 +1799,8 @@ 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::getArrayItem($gradientFill->xpath("sml:stop[@position=0]"))->color)); + $docStyle->getFill()->getEndColor()->setARGB(self::readColor(self::getArrayItem($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); @@ -1952,12 +1952,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE $baseDir = dirname($customUITarget); $nameCustomUI = basename($customUITarget); // get the xml file (ribbon) - $localRibbon = $this->_getFromZipArchive($zip, $customUITarget); + $localRibbon = $this->getFromZipArchive($zip, $customUITarget); $customUIImagesNames = array(); $customUIImagesBinaries = array(); // something like customUI/_rels/customUI.xml.rels $pathRels = $baseDir . '/_rels/' . $nameCustomUI . '.rels'; - $dataRels = $this->_getFromZipArchive($zip, $pathRels); + $dataRels = $this->getFromZipArchive($zip, $pathRels); if ($dataRels) { // exists and not empty if the ribbon have some pictures (other than internal MSO) $UIRels = simplexml_load_string($this->securityScan($dataRels), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); @@ -1967,7 +1967,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE if ($ele["Type"] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image') { // an image ? $customUIImagesNames[(string) $ele['Id']] = (string)$ele['Target']; - $customUIImagesBinaries[(string)$ele['Target']] = $this->_getFromZipArchive($zip, $baseDir . '/' . (string) $ele['Target']); + $customUIImagesBinaries[(string)$ele['Target']] = $this->getFromZipArchive($zip, $baseDir . '/' . (string) $ele['Target']); } } } @@ -1985,12 +1985,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE } } - private static function array_item($array, $key = 0) + private static function getArrayItem($array, $key = 0) { return (isset($array[$key]) ? $array[$key] : null); } - private static function dir_add($base, $add) + private static function dirAdd($base, $add) { return preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add"); } diff --git a/Classes/PHPExcel/Reader/Excel5.php b/Classes/PHPExcel/Reader/Excel5.php index 3728b6c..50cc87e 100644 --- a/Classes/PHPExcel/Reader/Excel5.php +++ b/Classes/PHPExcel/Reader/Excel5.php @@ -1,6 +1,16 @@ _data + * Size in bytes of $this->data * * @var int */ - private $_dataSize; + private $dataSize; /** * Current position in stream * * @var integer */ - private $_pos; + private $pos; /** * Workbook to be returned by the reader. * * @var PHPExcel */ - private $_phpExcel; + private $phpExcel; /** * Worksheet that is currently being built by the reader. * * @var PHPExcel_Worksheet */ - private $_phpSheet; + private $phpSheet; /** * BIFF version * * @var int */ - private $_version; + private $version; /** * Codepage set in the Excel file being read. Only important for BIFF5 (Excel 5.0 - Excel 95) @@ -236,147 +226,147 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * * @var string */ - private $_codepage; + private $codepage; /** * Shared formats * * @var array */ - private $_formats; + private $formats; /** * Shared fonts * * @var array */ - private $_objFonts; + private $objFonts; /** * Color palette * * @var array */ - private $_palette; + private $palette; /** * Worksheets * * @var array */ - private $_sheets; + private $sheets; /** * External books * * @var array */ - private $_externalBooks; + private $externalBooks; /** * REF structures. Only applies to BIFF8. * * @var array */ - private $_ref; + private $ref; /** * External names * * @var array */ - private $_externalNames; + private $externalNames; /** * Defined names * * @var array */ - private $_definedname; + private $definedname; /** * Shared strings. Only applies to BIFF8. * * @var array */ - private $_sst; + private $sst; /** * Panes are frozen? (in sheet currently being read). See WINDOW2 record. * * @var boolean */ - private $_frozen; + private $frozen; /** * Fit printout to number of pages? (in sheet currently being read). See SHEETPR record. * * @var boolean */ - private $_isFitToPages; + private $isFitToPages; /** * Objects. One OBJ record contributes with one entry. * * @var array */ - private $_objs; + private $objs; /** * Text Objects. One TXO record corresponds with one entry. * * @var array */ - private $_textObjects; + private $textObjects; /** * Cell Annotations (BIFF8) * * @var array */ - private $_cellNotes; + private $cellNotes; /** * The combined MSODRAWINGGROUP data * * @var string */ - private $_drawingGroupData; + private $drawingGroupData; /** * The combined MSODRAWING data (per sheet) * * @var string */ - private $_drawingData; + private $drawingData; /** * Keep track of XF index * * @var int */ - private $_xfIndex; + private $xfIndex; /** * Mapping of XF index (that is a cell XF) to final index in cellXf collection * * @var array */ - private $_mapCellXfIndex; + private $mapCellXfIndex; /** * Mapping of XF index (that is a style XF) to final index in cellStyleXf collection * * @var array */ - private $_mapCellStyleXfIndex; + private $mapCellStyleXfIndex; /** * The shared formulas in a sheet. One SHAREDFMLA record contributes with one value. * * @var array */ - private $_sharedFormulas; + private $sharedFormulas; /** * The shared formula parts in a sheet. One FORMULA record contributes with one value if it @@ -384,49 +374,49 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * * @var array */ - private $_sharedFormulaParts; + private $sharedFormulaParts; /** * The type of encryption in use * * @var int */ - private $_encryption = 0; + private $encryption = 0; /** * The position in the stream after which contents are encrypted * * @var int */ - private $_encryptionStartPos = false; + private $encryptionStartPos = false; /** * The current RC4 decryption object * * @var PHPExcel_Reader_Excel5_RC4 */ - private $_rc4Key = null; + private $rc4Key = null; /** * The position in the stream that the RC4 decryption object was left at * * @var int */ - private $_rc4Pos = 0; + private $rc4Pos = 0; /** * The current MD5 context state * * @var string */ - private $_md5Ctxt = null; + private $md5Ctxt = null; /** * Create a new PHPExcel_Reader_Excel5 instance */ public function __construct() { - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->readFilter = new PHPExcel_Reader_DefaultReadFilter(); } /** @@ -471,35 +461,35 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $worksheetNames = array(); // Read the OLE file - $this->_loadOLE($pFilename); + $this->loadOLE($pFilename); // 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->_sheets = array(); + $this->pos = 0; + $this->sheets = array(); // Parse Workbook Global Substream - while ($this->_pos < $this->_dataSize) { - $code = self::_GetInt2d($this->_data, $this->_pos); + while ($this->pos < $this->dataSize) { + $code = self::getInt2d($this->data, $this->pos); switch ($code) { case self::XLS_Type_BOF: - $this->_readBof(); + $this->readBof(); break; case self::XLS_Type_SHEET: - $this->_readSheet(); + $this->readSheet(); break; case self::XLS_Type_EOF: - $this->_readDefault(); + $this->readDefault(); break 2; default: - $this->_readDefault(); + $this->readDefault(); break; } } - foreach ($this->_sheets as $sheet) { + foreach ($this->sheets as $sheet) { if ($sheet['sheetType'] != 0x00) { // 0x00: Worksheet, 0x02: Chart, 0x06: Visual Basic module continue; @@ -528,37 +518,37 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $worksheetInfo = array(); // Read the OLE file - $this->_loadOLE($pFilename); + $this->loadOLE($pFilename); // total byte size of Excel data (workbook global substream + sheet substreams) - $this->_dataSize = strlen($this->_data); + $this->dataSize = strlen($this->data); // initialize - $this->_pos = 0; - $this->_sheets = array(); + $this->pos = 0; + $this->sheets = array(); // Parse Workbook Global Substream - while ($this->_pos < $this->_dataSize) { - $code = self::_GetInt2d($this->_data, $this->_pos); + while ($this->pos < $this->dataSize) { + $code = self::getInt2d($this->data, $this->pos); switch ($code) { case self::XLS_Type_BOF: - $this->_readBof(); + $this->readBof(); break; case self::XLS_Type_SHEET: - $this->_readSheet(); + $this->readSheet(); break; case self::XLS_Type_EOF: - $this->_readDefault(); + $this->readDefault(); break 2; default: - $this->_readDefault(); + $this->readDefault(); break; } } // Parse the individual sheets - foreach ($this->_sheets as $sheet) { + foreach ($this->sheets as $sheet) { if ($sheet['sheetType'] != 0x00) { // 0x00: Worksheet // 0x02: Chart @@ -573,10 +563,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $tmpInfo['totalRows'] = 0; $tmpInfo['totalColumns'] = 0; - $this->_pos = $sheet['offset']; + $this->pos = $sheet['offset']; - while ($this->_pos <= $this->_dataSize - 4) { - $code = self::_GetInt2d($this->_data, $this->_pos); + while ($this->pos <= $this->dataSize - 4) { + $code = self::getInt2d($this->data, $this->pos); switch ($code) { case self::XLS_Type_RK: @@ -585,26 +575,26 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce case self::XLS_Type_FORMULA: case self::XLS_Type_BOOLERR: case self::XLS_Type_LABEL: - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - $rowIndex = self::_GetInt2d($recordData, 0) + 1; - $columnIndex = self::_GetInt2d($recordData, 2); + $rowIndex = self::getInt2d($recordData, 0) + 1; + $columnIndex = self::getInt2d($recordData, 2); $tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex); $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex); break; case self::XLS_Type_BOF: - $this->_readBof(); + $this->readBof(); break; case self::XLS_Type_EOF: - $this->_readDefault(); + $this->readDefault(); break 2; default: - $this->_readDefault(); + $this->readDefault(); break; } } @@ -629,126 +619,126 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce public function load($pFilename) { // Read the OLE file - $this->_loadOLE($pFilename); + $this->loadOLE($pFilename); // Initialisations - $this->_phpExcel = new PHPExcel; - $this->_phpExcel->removeSheetByIndex(0); // remove 1st sheet - if (!$this->_readDataOnly) { - $this->_phpExcel->removeCellStyleXfByIndex(0); // remove the default style - $this->_phpExcel->removeCellXfByIndex(0); // remove the default style + $this->phpExcel = new PHPExcel; + $this->phpExcel->removeSheetByIndex(0); // remove 1st sheet + if (!$this->readDataOnly) { + $this->phpExcel->removeCellStyleXfByIndex(0); // remove the default style + $this->phpExcel->removeCellXfByIndex(0); // remove the default style } // Read the summary information stream (containing meta data) - $this->_readSummaryInformation(); + $this->readSummaryInformation(); // Read the Additional document summary information stream (containing application-specific meta data) - $this->_readDocumentSummaryInformation(); + $this->readDocumentSummaryInformation(); // total byte size of Excel data (workbook global substream + sheet substreams) - $this->_dataSize = strlen($this->_data); + $this->dataSize = strlen($this->data); // initialize - $this->_pos = 0; - $this->_codepage = 'CP1252'; - $this->_formats = array(); - $this->_objFonts = array(); - $this->_palette = array(); - $this->_sheets = array(); - $this->_externalBooks = array(); - $this->_ref = array(); - $this->_definedname = array(); - $this->_sst = array(); - $this->_drawingGroupData = ''; - $this->_xfIndex = ''; - $this->_mapCellXfIndex = array(); - $this->_mapCellStyleXfIndex = array(); + $this->pos = 0; + $this->codepage = 'CP1252'; + $this->formats = array(); + $this->objFonts = array(); + $this->palette = array(); + $this->sheets = array(); + $this->externalBooks = array(); + $this->ref = array(); + $this->definedname = array(); + $this->sst = array(); + $this->drawingGroupData = ''; + $this->xfIndex = ''; + $this->mapCellXfIndex = array(); + $this->mapCellStyleXfIndex = array(); // Parse Workbook Global Substream - while ($this->_pos < $this->_dataSize) { - $code = self::_GetInt2d($this->_data, $this->_pos); + while ($this->pos < $this->dataSize) { + $code = self::getInt2d($this->data, $this->pos); switch ($code) { case self::XLS_Type_BOF: - $this->_readBof(); + $this->readBof(); break; case self::XLS_Type_FILEPASS: - $this->_readFilepass(); + $this->readFilepass(); break; case self::XLS_Type_CODEPAGE: - $this->_readCodepage(); + $this->readCodepage(); break; case self::XLS_Type_DATEMODE: - $this->_readDateMode(); + $this->readDateMode(); break; case self::XLS_Type_FONT: - $this->_readFont(); + $this->readFont(); break; case self::XLS_Type_FORMAT: - $this->_readFormat(); + $this->readFormat(); break; case self::XLS_Type_XF: - $this->_readXf(); + $this->readXf(); break; case self::XLS_Type_XFEXT: - $this->_readXfExt(); + $this->readXfExt(); break; case self::XLS_Type_STYLE: - $this->_readStyle(); + $this->readStyle(); break; case self::XLS_Type_PALETTE: - $this->_readPalette(); + $this->readPalette(); break; case self::XLS_Type_SHEET: - $this->_readSheet(); + $this->readSheet(); break; case self::XLS_Type_EXTERNALBOOK: - $this->_readExternalBook(); + $this->readExternalBook(); break; case self::XLS_Type_EXTERNNAME: - $this->_readExternName(); + $this->readExternName(); break; case self::XLS_Type_EXTERNSHEET: - $this->_readExternSheet(); + $this->readExternSheet(); break; case self::XLS_Type_DEFINEDNAME: - $this->_readDefinedName(); + $this->readDefinedName(); break; case self::XLS_Type_MSODRAWINGGROUP: - $this->_readMsoDrawingGroup(); + $this->readMsoDrawingGroup(); break; case self::XLS_Type_SST: - $this->_readSst(); + $this->readSst(); break; case self::XLS_Type_EOF: - $this->_readDefault(); + $this->readDefault(); break 2; default: - $this->_readDefault(); + $this->readDefault(); break; } } // Resolve indexed colors for font, fill, and border colors // Cannot be resolved already in XF record, because PALETTE record comes afterwards - if (!$this->_readDataOnly) { - foreach ($this->_objFonts as $objFont) { + if (!$this->readDataOnly) { + foreach ($this->objFonts as $objFont) { if (isset($objFont->colorIndex)) { - $color = self::_readColor($objFont->colorIndex, $this->_palette, $this->_version); + $color = self::readColor($objFont->colorIndex, $this->palette, $this->version); $objFont->getColor()->setRGB($color['rgb']); } } - foreach ($this->_phpExcel->getCellXfCollection() as $objStyle) { + foreach ($this->phpExcel->getCellXfCollection() as $objStyle) { // fill start and end color $fill = $objStyle->getFill(); if (isset($fill->startcolorIndex)) { - $startColor = self::_readColor($fill->startcolorIndex, $this->_palette, $this->_version); + $startColor = self::readColor($fill->startcolorIndex, $this->palette, $this->version); $fill->getStartColor()->setRGB($startColor['rgb']); } if (isset($fill->endcolorIndex)) { - $endColor = self::_readColor($fill->endcolorIndex, $this->_palette, $this->_version); + $endColor = self::readColor($fill->endcolorIndex, $this->palette, $this->version); $fill->getEndColor()->setRGB($endColor['rgb']); } @@ -760,267 +750,267 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $diagonal = $objStyle->getBorders()->getDiagonal(); if (isset($top->colorIndex)) { - $borderTopColor = self::_readColor($top->colorIndex, $this->_palette, $this->_version); + $borderTopColor = self::readColor($top->colorIndex, $this->palette, $this->version); $top->getColor()->setRGB($borderTopColor['rgb']); } if (isset($right->colorIndex)) { - $borderRightColor = self::_readColor($right->colorIndex, $this->_palette, $this->_version); + $borderRightColor = self::readColor($right->colorIndex, $this->palette, $this->version); $right->getColor()->setRGB($borderRightColor['rgb']); } if (isset($bottom->colorIndex)) { - $borderBottomColor = self::_readColor($bottom->colorIndex, $this->_palette, $this->_version); + $borderBottomColor = self::readColor($bottom->colorIndex, $this->palette, $this->version); $bottom->getColor()->setRGB($borderBottomColor['rgb']); } if (isset($left->colorIndex)) { - $borderLeftColor = self::_readColor($left->colorIndex, $this->_palette, $this->_version); + $borderLeftColor = self::readColor($left->colorIndex, $this->palette, $this->version); $left->getColor()->setRGB($borderLeftColor['rgb']); } if (isset($diagonal->colorIndex)) { - $borderDiagonalColor = self::_readColor($diagonal->colorIndex, $this->_palette, $this->_version); + $borderDiagonalColor = self::readColor($diagonal->colorIndex, $this->palette, $this->version); $diagonal->getColor()->setRGB($borderDiagonalColor['rgb']); } } } // treat MSODRAWINGGROUP records, workbook-level Escher - if (!$this->_readDataOnly && $this->_drawingGroupData) { + if (!$this->readDataOnly && $this->drawingGroupData) { $escherWorkbook = new PHPExcel_Shared_Escher(); $reader = new PHPExcel_Reader_Excel5_Escher($escherWorkbook); - $escherWorkbook = $reader->load($this->_drawingGroupData); + $escherWorkbook = $reader->load($this->drawingGroupData); // debug Escher stream //$debug = new Debug_Escher(new PHPExcel_Shared_Escher()); - //$debug->load($this->_drawingGroupData); + //$debug->load($this->drawingGroupData); } // Parse the individual sheets - foreach ($this->_sheets as $sheet) { + foreach ($this->sheets as $sheet) { if ($sheet['sheetType'] != 0x00) { // 0x00: Worksheet, 0x02: Chart, 0x06: Visual Basic module continue; } // check if sheet should be skipped - if (isset($this->_loadSheetsOnly) && !in_array($sheet['name'], $this->_loadSheetsOnly)) { + if (isset($this->loadSheetsOnly) && !in_array($sheet['name'], $this->loadSheetsOnly)) { continue; } // add sheet to PHPExcel object - $this->_phpSheet = $this->_phpExcel->createSheet(); + $this->phpSheet = $this->phpExcel->createSheet(); // 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 - $this->_phpSheet->setTitle($sheet['name'], false); - $this->_phpSheet->setSheetState($sheet['sheetState']); + $this->phpSheet->setTitle($sheet['name'], false); + $this->phpSheet->setSheetState($sheet['sheetState']); - $this->_pos = $sheet['offset']; + $this->pos = $sheet['offset']; // Initialize isFitToPages. May change after reading SHEETPR record. - $this->_isFitToPages = false; + $this->isFitToPages = false; // Initialize drawingData - $this->_drawingData = ''; + $this->drawingData = ''; // Initialize objs - $this->_objs = array(); + $this->objs = array(); // Initialize shared formula parts - $this->_sharedFormulaParts = array(); + $this->sharedFormulaParts = array(); // Initialize shared formulas - $this->_sharedFormulas = array(); + $this->sharedFormulas = array(); // Initialize text objs - $this->_textObjects = array(); + $this->textObjects = array(); // Initialize cell annotations - $this->_cellNotes = array(); + $this->cellNotes = array(); $this->textObjRef = -1; - while ($this->_pos <= $this->_dataSize - 4) { - $code = self::_GetInt2d($this->_data, $this->_pos); + while ($this->pos <= $this->dataSize - 4) { + $code = self::getInt2d($this->data, $this->pos); switch ($code) { case self::XLS_Type_BOF: - $this->_readBof(); + $this->readBof(); break; case self::XLS_Type_PRINTGRIDLINES: - $this->_readPrintGridlines(); + $this->readPrintGridlines(); break; case self::XLS_Type_DEFAULTROWHEIGHT: - $this->_readDefaultRowHeight(); + $this->readDefaultRowHeight(); break; case self::XLS_Type_SHEETPR: - $this->_readSheetPr(); + $this->readSheetPr(); break; case self::XLS_Type_HORIZONTALPAGEBREAKS: - $this->_readHorizontalPageBreaks(); + $this->readHorizontalPageBreaks(); break; case self::XLS_Type_VERTICALPAGEBREAKS: - $this->_readVerticalPageBreaks(); + $this->readVerticalPageBreaks(); break; case self::XLS_Type_HEADER: - $this->_readHeader(); + $this->readHeader(); break; case self::XLS_Type_FOOTER: - $this->_readFooter(); + $this->readFooter(); break; case self::XLS_Type_HCENTER: - $this->_readHcenter(); + $this->readHcenter(); break; case self::XLS_Type_VCENTER: - $this->_readVcenter(); + $this->readVcenter(); break; case self::XLS_Type_LEFTMARGIN: - $this->_readLeftMargin(); + $this->readLeftMargin(); break; case self::XLS_Type_RIGHTMARGIN: - $this->_readRightMargin(); + $this->readRightMargin(); break; case self::XLS_Type_TOPMARGIN: - $this->_readTopMargin(); + $this->readTopMargin(); break; case self::XLS_Type_BOTTOMMARGIN: - $this->_readBottomMargin(); + $this->readBottomMargin(); break; case self::XLS_Type_PAGESETUP: - $this->_readPageSetup(); + $this->readPageSetup(); break; case self::XLS_Type_PROTECT: - $this->_readProtect(); + $this->readProtect(); break; case self::XLS_Type_SCENPROTECT: - $this->_readScenProtect(); + $this->readScenProtect(); break; case self::XLS_Type_OBJECTPROTECT: - $this->_readObjectProtect(); + $this->readObjectProtect(); break; case self::XLS_Type_PASSWORD: - $this->_readPassword(); + $this->readPassword(); break; case self::XLS_Type_DEFCOLWIDTH: - $this->_readDefColWidth(); + $this->readDefColWidth(); break; case self::XLS_Type_COLINFO: - $this->_readColInfo(); + $this->readColInfo(); break; case self::XLS_Type_DIMENSION: - $this->_readDefault(); + $this->readDefault(); break; case self::XLS_Type_ROW: - $this->_readRow(); + $this->readRow(); break; case self::XLS_Type_DBCELL: - $this->_readDefault(); + $this->readDefault(); break; case self::XLS_Type_RK: - $this->_readRk(); + $this->readRk(); break; case self::XLS_Type_LABELSST: - $this->_readLabelSst(); + $this->readLabelSst(); break; case self::XLS_Type_MULRK: - $this->_readMulRk(); + $this->readMulRk(); break; case self::XLS_Type_NUMBER: - $this->_readNumber(); + $this->readNumber(); break; case self::XLS_Type_FORMULA: - $this->_readFormula(); + $this->readFormula(); break; case self::XLS_Type_SHAREDFMLA: - $this->_readSharedFmla(); + $this->readSharedFmla(); break; case self::XLS_Type_BOOLERR: - $this->_readBoolErr(); + $this->readBoolErr(); break; case self::XLS_Type_MULBLANK: - $this->_readMulBlank(); + $this->readMulBlank(); break; case self::XLS_Type_LABEL: - $this->_readLabel(); + $this->readLabel(); break; case self::XLS_Type_BLANK: - $this->_readBlank(); + $this->readBlank(); break; case self::XLS_Type_MSODRAWING: - $this->_readMsoDrawing(); + $this->readMsoDrawing(); break; case self::XLS_Type_OBJ: - $this->_readObj(); + $this->readObj(); break; case self::XLS_Type_WINDOW2: - $this->_readWindow2(); + $this->readWindow2(); break; case self::XLS_Type_PAGELAYOUTVIEW: - $this->_readPageLayoutView(); + $this->readPageLayoutView(); break; case self::XLS_Type_SCL: - $this->_readScl(); + $this->readScl(); break; case self::XLS_Type_PANE: - $this->_readPane(); + $this->readPane(); break; case self::XLS_Type_SELECTION: - $this->_readSelection(); + $this->readSelection(); break; case self::XLS_Type_MERGEDCELLS: - $this->_readMergedCells(); + $this->readMergedCells(); break; case self::XLS_Type_HYPERLINK: - $this->_readHyperLink(); + $this->readHyperLink(); break; case self::XLS_Type_DATAVALIDATIONS: - $this->_readDataValidations(); + $this->readDataValidations(); break; case self::XLS_Type_DATAVALIDATION: - $this->_readDataValidation(); + $this->readDataValidation(); break; case self::XLS_Type_SHEETLAYOUT: - $this->_readSheetLayout(); + $this->readSheetLayout(); break; case self::XLS_Type_SHEETPROTECTION: - $this->_readSheetProtection(); + $this->readSheetProtection(); break; case self::XLS_Type_RANGEPROTECTION: - $this->_readRangeProtection(); + $this->readRangeProtection(); break; case self::XLS_Type_NOTE: - $this->_readNote(); + $this->readNote(); break; - //case self::XLS_Type_IMDATA: $this->_readImData(); break; + //case self::XLS_Type_IMDATA: $this->readImData(); break; case self::XLS_Type_TXO: - $this->_readTextObject(); + $this->readTextObject(); break; case self::XLS_Type_CONTINUE: - $this->_readContinue(); + $this->readContinue(); break; case self::XLS_Type_EOF: - $this->_readDefault(); + $this->readDefault(); break 2; default: - $this->_readDefault(); + $this->readDefault(); break; } } // treat MSODRAWING records, sheet-level Escher - if (!$this->_readDataOnly && $this->_drawingData) { + if (!$this->readDataOnly && $this->drawingData) { $escherWorksheet = new PHPExcel_Shared_Escher(); $reader = new PHPExcel_Reader_Excel5_Escher($escherWorksheet); - $escherWorksheet = $reader->load($this->_drawingData); + $escherWorksheet = $reader->load($this->drawingData); // debug Escher stream //$debug = new Debug_Escher(new PHPExcel_Shared_Escher()); - //$debug->load($this->_drawingData); + //$debug->load($this->drawingData); // get all spContainers in one long array, so they can be mapped to OBJ records $allSpContainers = $escherWorksheet->getDgContainer()->getSpgrContainer()->getAllSpContainers(); } // treat OBJ records - foreach ($this->_objs as $n => $obj) { + foreach ($this->objs as $n => $obj) { // echo '
Object reference is ', $n,'
'; // var_dump($obj); // echo '
'; @@ -1043,24 +1033,24 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $endOffsetX = $spContainer->getEndOffsetX(); $endOffsetY = $spContainer->getEndOffsetY(); - $width = PHPExcel_Shared_Excel5::getDistanceX($this->_phpSheet, $startColumn, $startOffsetX, $endColumn, $endOffsetX); - $height = PHPExcel_Shared_Excel5::getDistanceY($this->_phpSheet, $startRow, $startOffsetY, $endRow, $endOffsetY); + $width = PHPExcel_Shared_Excel5::getDistanceX($this->phpSheet, $startColumn, $startOffsetX, $endColumn, $endOffsetX); + $height = PHPExcel_Shared_Excel5::getDistanceY($this->phpSheet, $startRow, $startOffsetY, $endRow, $endOffsetY); // calculate offsetX and offsetY of the shape - $offsetX = $startOffsetX * PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, $startColumn) / 1024; - $offsetY = $startOffsetY * PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $startRow) / 256; + $offsetX = $startOffsetX * PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, $startColumn) / 1024; + $offsetY = $startOffsetY * PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $startRow) / 256; switch ($obj['otObjType']) { case 0x19: // Note // echo 'Cell Annotation Object
'; // echo 'Object ID is ', $obj['idObjID'],'
'; - if (isset($this->_cellNotes[$obj['idObjID']])) { - $cellNote = $this->_cellNotes[$obj['idObjID']]; + if (isset($this->cellNotes[$obj['idObjID']])) { + $cellNote = $this->cellNotes[$obj['idObjID']]; - if (isset($this->_textObjects[$obj['idObjID']])) { - $textObject = $this->_textObjects[$obj['idObjID']]; - $this->_cellNotes[$obj['idObjID']]['objTextData'] = $textObject; + if (isset($this->textObjects[$obj['idObjID']])) { + $textObject = $this->textObjects[$obj['idObjID']]; + $this->cellNotes[$obj['idObjID']]['objTextData'] = $textObject; } } break; @@ -1097,7 +1087,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce break; } - $drawing->setWorksheet($this->_phpSheet); + $drawing->setWorksheet($this->phpSheet); $drawing->setCoordinates($spContainer->getStartCoordinates()); } break; @@ -1109,21 +1099,21 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } // treat SHAREDFMLA records - if ($this->_version == self::XLS_BIFF8) { - foreach ($this->_sharedFormulaParts as $cell => $baseCell) { + if ($this->version == self::XLS_BIFF8) { + foreach ($this->sharedFormulaParts as $cell => $baseCell) { list($column, $row) = PHPExcel_Cell::coordinateFromString($cell); - if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($column, $row, $this->_phpSheet->getTitle())) { - $formula = $this->_getFormulaFromStructure($this->_sharedFormulas[$baseCell], $cell); - $this->_phpSheet->getCell($cell)->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA); + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($column, $row, $this->phpSheet->getTitle())) { + $formula = $this->getFormulaFromStructure($this->sharedFormulas[$baseCell], $cell); + $this->phpSheet->getCell($cell)->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA); } } } - if (!empty($this->_cellNotes)) { - foreach ($this->_cellNotes as $note => $noteDetails) { + if (!empty($this->cellNotes)) { + foreach ($this->cellNotes as $note => $noteDetails) { if (!isset($noteDetails['objTextData'])) { - if (isset($this->_textObjects[$note])) { - $textObject = $this->_textObjects[$note]; + if (isset($this->textObjects[$note])) { + $textObject = $this->textObjects[$note]; $noteDetails['objTextData'] = $textObject; } else { $noteDetails['objTextData']['text'] = ''; @@ -1133,13 +1123,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // var_dump($noteDetails); // echo '
'; $cellAddress = str_replace('$', '', $noteDetails['cellRef']); - $this->_phpSheet->getComment($cellAddress)->setAuthor($noteDetails['author'])->setText($this->_parseRichText($noteDetails['objTextData']['text'])); + $this->phpSheet->getComment($cellAddress)->setAuthor($noteDetails['author'])->setText($this->parseRichText($noteDetails['objTextData']['text'])); } } } // add the named ranges (defined names) - foreach ($this->_definedname as $definedName) { + foreach ($this->definedname as $definedName) { if ($definedName['isBuiltInName']) { switch ($definedName['name']) { case pack('C', 0x06): @@ -1161,7 +1151,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $extractedRanges[] = str_replace('$', '', $explodes[1]); // C7:J66 } } - if ($docSheet = $this->_phpExcel->getSheetByName($sheetName)) { + if ($docSheet = $this->phpExcel->getSheetByName($sheetName)) { $docSheet->getPageSetup()->setPrintArea(implode(',', $extractedRanges)); // C7:J66,A1:IV2 } break; @@ -1183,7 +1173,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // Sheet!$A$1:$IV$2 $explodes = explode('!', $range); if (count($explodes) == 2) { - if ($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) { + if ($docSheet = $this->phpExcel->getSheetByName($explodes[0])) { $extractedRange = $explodes[1]; $extractedRange = str_replace('$', '', $extractedRange); @@ -1210,16 +1200,16 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $explodes = explode('!', $definedName['formula']); if (count($explodes) == 2) { - if (($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) || - ($docSheet = $this->_phpExcel->getSheetByName(trim($explodes[0], "'")))) { + if (($docSheet = $this->phpExcel->getSheetByName($explodes[0])) || + ($docSheet = $this->phpExcel->getSheetByName(trim($explodes[0], "'")))) { $extractedRange = $explodes[1]; $extractedRange = str_replace('$', '', $extractedRange); $localOnly = ($definedName['scope'] == 0) ? false : true; - $scope = ($definedName['scope'] == 0) ? null : $this->_phpExcel->getSheetByName($this->_sheets[$definedName['scope'] - 1]['name']); + $scope = ($definedName['scope'] == 0) ? null : $this->phpExcel->getSheetByName($this->sheets[$definedName['scope'] - 1]['name']); - $this->_phpExcel->addNamedRange(new PHPExcel_NamedRange((string)$definedName['name'], $docSheet, $extractedRange, $localOnly, $scope)); + $this->phpExcel->addNamedRange(new PHPExcel_NamedRange((string)$definedName['name'], $docSheet, $extractedRange, $localOnly, $scope)); } } else { // Named Value @@ -1227,9 +1217,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } } } - $this->_data = null; + $this->data = null; - return $this->_phpExcel; + return $this->phpExcel; } /** @@ -1241,47 +1231,47 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * * @return string Record data */ - private function _readRecordData($data, $pos, $len) + private function readRecordData($data, $pos, $len) { $data = substr($data, $pos, $len); // File not encrypted, or record before encryption start point - if ($this->_encryption == self::MS_BIFF_CRYPTO_NONE || $pos < $this->_encryptionStartPos) { + if ($this->encryption == self::MS_BIFF_CRYPTO_NONE || $pos < $this->encryptionStartPos) { return $data; } $recordData = ''; - if ($this->_encryption == self::MS_BIFF_CRYPTO_RC4) { - $oldBlock = floor($this->_rc4Pos / self::REKEY_BLOCK); + if ($this->encryption == self::MS_BIFF_CRYPTO_RC4) { + $oldBlock = floor($this->rc4Pos / self::REKEY_BLOCK); $block = floor($pos / self::REKEY_BLOCK); $endBlock = floor(($pos + $len) / self::REKEY_BLOCK); // Spin an RC4 decryptor to the right spot. If we have a decryptor sitting // at a point earlier in the current block, re-use it as we can save some time. - if ($block != $oldBlock || $pos < $this->_rc4Pos || !$this->_rc4Key) { - $this->_rc4Key = $this->_makeKey($block, $this->_md5Ctxt); + if ($block != $oldBlock || $pos < $this->rc4Pos || !$this->rc4Key) { + $this->rc4Key = $this->makeKey($block, $this->md5Ctxt); $step = $pos % self::REKEY_BLOCK; } else { - $step = $pos - $this->_rc4Pos; + $step = $pos - $this->rc4Pos; } - $this->_rc4Key->RC4(str_repeat("\0", $step)); + $this->rc4Key->RC4(str_repeat("\0", $step)); // Decrypt record data (re-keying at the end of every block) while ($block != $endBlock) { $step = self::REKEY_BLOCK - ($pos % self::REKEY_BLOCK); - $recordData .= $this->_rc4Key->RC4(substr($data, 0, $step)); + $recordData .= $this->rc4Key->RC4(substr($data, 0, $step)); $data = substr($data, $step); $pos += $step; $len -= $step; $block++; - $this->_rc4Key = $this->_makeKey($block, $this->_md5Ctxt); + $this->rc4Key = $this->makeKey($block, $this->md5Ctxt); } - $recordData .= $this->_rc4Key->RC4(substr($data, 0, $len)); + $recordData .= $this->rc4Key->RC4(substr($data, 0, $len)); // Keep track of the position of this decryptor. // We'll try and re-use it later if we can to speed things up - $this->_rc4Pos = $pos + $len; - } elseif ($this->_encryption == self::MS_BIFF_CRYPTO_XOR) { + $this->rc4Pos = $pos + $len; + } elseif ($this->encryption == self::MS_BIFF_CRYPTO_XOR) { throw new PHPExcel_Reader_Exception('XOr encryption not supported'); } return $recordData; @@ -1292,29 +1282,29 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * * @param string $pFilename */ - private function _loadOLE($pFilename) + private function loadOLE($pFilename) { // OLE reader $ole = new PHPExcel_Shared_OLERead(); // get excel data, $res = $ole->read($pFilename); // Get workbook data: workbook stream + sheet streams - $this->_data = $ole->getStream($ole->wrkbook); + $this->data = $ole->getStream($ole->wrkbook); // Get summary information data - $this->_summaryInformation = $ole->getStream($ole->summaryInformation); + $this->summaryInformation = $ole->getStream($ole->summaryInformation); // Get additional document summary information data - $this->_documentSummaryInformation = $ole->getStream($ole->documentSummaryInformation); + $this->documentSummaryInformation = $ole->getStream($ole->documentSummaryInformation); // Get user-defined property data -// $this->_userDefinedProperties = $ole->getUserDefinedProperties(); +// $this->userDefinedProperties = $ole->getUserDefinedProperties(); } /** * Read summary information */ - private function _readSummaryInformation() + private function readSummaryInformation() { - if (!isset($this->_summaryInformation)) { + if (!isset($this->summaryInformation)) { return; } @@ -1324,18 +1314,18 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 6; size: 2; OS indicator // offset: 8; size: 16 // offset: 24; size: 4; section count - $secCount = self::_GetInt4d($this->_summaryInformation, 24); + $secCount = self::getInt4d($this->summaryInformation, 24); // offset: 28; size: 16; first section's class id: e0 85 9f f2 f9 4f 68 10 ab 91 08 00 2b 27 b3 d9 // offset: 44; size: 4 - $secOffset = self::_GetInt4d($this->_summaryInformation, 44); + $secOffset = self::getInt4d($this->summaryInformation, 44); // section header // offset: $secOffset; size: 4; section length - $secLength = self::_GetInt4d($this->_summaryInformation, $secOffset); + $secLength = self::getInt4d($this->summaryInformation, $secOffset); // offset: $secOffset+4; size: 4; property count - $countProperties = self::_GetInt4d($this->_summaryInformation, $secOffset+4); + $countProperties = self::getInt4d($this->summaryInformation, $secOffset+4); // initialize code page (used to resolve string values) $codePage = 'CP1252'; @@ -1344,13 +1334,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // loop through property decarations and properties for ($i = 0; $i < $countProperties; ++$i) { // offset: ($secOffset+8) + (8 * $i); size: 4; property ID - $id = self::_GetInt4d($this->_summaryInformation, ($secOffset+8) + (8 * $i)); + $id = self::getInt4d($this->summaryInformation, ($secOffset+8) + (8 * $i)); // Use value of property id as appropriate // offset: ($secOffset+12) + (8 * $i); size: 4; offset from beginning of section (48) - $offset = self::_GetInt4d($this->_summaryInformation, ($secOffset+12) + (8 * $i)); + $offset = self::getInt4d($this->summaryInformation, ($secOffset+12) + (8 * $i)); - $type = self::_GetInt4d($this->_summaryInformation, $secOffset + $offset); + $type = self::getInt4d($this->summaryInformation, $secOffset + $offset); // initialize property value $value = null; @@ -1358,23 +1348,23 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // extract property value based on property type switch ($type) { case 0x02: // 2 byte signed integer - $value = self::_GetInt2d($this->_summaryInformation, $secOffset + 4 + $offset); + $value = self::getInt2d($this->summaryInformation, $secOffset + 4 + $offset); break; case 0x03: // 4 byte signed integer - $value = self::_GetInt4d($this->_summaryInformation, $secOffset + 4 + $offset); + $value = self::getInt4d($this->summaryInformation, $secOffset + 4 + $offset); break; case 0x13: // 4 byte unsigned integer // not needed yet, fix later if necessary break; case 0x1E: // null-terminated string prepended by dword string length - $byteLength = self::_GetInt4d($this->_summaryInformation, $secOffset + 4 + $offset); - $value = substr($this->_summaryInformation, $secOffset + 8 + $offset, $byteLength); + $byteLength = self::getInt4d($this->summaryInformation, $secOffset + 4 + $offset); + $value = substr($this->summaryInformation, $secOffset + 8 + $offset, $byteLength); $value = PHPExcel_Shared_String::ConvertEncoding($value, 'UTF-8', $codePage); $value = rtrim($value); break; case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) // PHP-time - $value = PHPExcel_Shared_OLE::OLE2LocalDate(substr($this->_summaryInformation, $secOffset + 4 + $offset, 8)); + $value = PHPExcel_Shared_OLE::OLE2LocalDate(substr($this->summaryInformation, $secOffset + 4 + $offset, 8)); break; case 0x47: // Clipboard format // not needed yet, fix later if necessary @@ -1386,25 +1376,25 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $codePage = PHPExcel_Shared_CodePage::NumberToName($value); break; case 0x02: // Title - $this->_phpExcel->getProperties()->setTitle($value); + $this->phpExcel->getProperties()->setTitle($value); break; case 0x03: // Subject - $this->_phpExcel->getProperties()->setSubject($value); + $this->phpExcel->getProperties()->setSubject($value); break; case 0x04: // Author (Creator) - $this->_phpExcel->getProperties()->setCreator($value); + $this->phpExcel->getProperties()->setCreator($value); break; case 0x05: // Keywords - $this->_phpExcel->getProperties()->setKeywords($value); + $this->phpExcel->getProperties()->setKeywords($value); break; case 0x06: // Comments (Description) - $this->_phpExcel->getProperties()->setDescription($value); + $this->phpExcel->getProperties()->setDescription($value); break; case 0x07: // Template // Not supported by PHPExcel break; case 0x08: // Last Saved By (LastModifiedBy) - $this->_phpExcel->getProperties()->setLastModifiedBy($value); + $this->phpExcel->getProperties()->setLastModifiedBy($value); break; case 0x09: // Revision // Not supported by PHPExcel @@ -1416,10 +1406,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // Not supported by PHPExcel break; case 0x0C: // Created Date/Time - $this->_phpExcel->getProperties()->setCreated($value); + $this->phpExcel->getProperties()->setCreated($value); break; case 0x0D: // Modified Date/Time - $this->_phpExcel->getProperties()->setModified($value); + $this->phpExcel->getProperties()->setModified($value); break; case 0x0E: // Number of Pages // Not supported by PHPExcel @@ -1447,9 +1437,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read additional document summary information */ - private function _readDocumentSummaryInformation() + private function readDocumentSummaryInformation() { - if (!isset($this->_documentSummaryInformation)) { + if (!isset($this->documentSummaryInformation)) { return; } @@ -1459,21 +1449,21 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 6; size: 2; OS indicator // offset: 8; size: 16 // offset: 24; size: 4; section count - $secCount = self::_GetInt4d($this->_documentSummaryInformation, 24); + $secCount = self::getInt4d($this->documentSummaryInformation, 24); // echo '$secCount = ', $secCount,'
'; // offset: 28; size: 16; first section's class id: 02 d5 cd d5 9c 2e 1b 10 93 97 08 00 2b 2c f9 ae // offset: 44; size: 4; first section offset - $secOffset = self::_GetInt4d($this->_documentSummaryInformation, 44); + $secOffset = self::getInt4d($this->documentSummaryInformation, 44); // echo '$secOffset = ', $secOffset,'
'; // section header // offset: $secOffset; size: 4; section length - $secLength = self::_GetInt4d($this->_documentSummaryInformation, $secOffset); + $secLength = self::getInt4d($this->documentSummaryInformation, $secOffset); // echo '$secLength = ', $secLength,'
'; // offset: $secOffset+4; size: 4; property count - $countProperties = self::_GetInt4d($this->_documentSummaryInformation, $secOffset+4); + $countProperties = self::getInt4d($this->documentSummaryInformation, $secOffset+4); // echo '$countProperties = ', $countProperties,'
'; // initialize code page (used to resolve string values) @@ -1484,14 +1474,14 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce for ($i = 0; $i < $countProperties; ++$i) { // echo 'Property ', $i,'
'; // offset: ($secOffset+8) + (8 * $i); size: 4; property ID - $id = self::_GetInt4d($this->_documentSummaryInformation, ($secOffset+8) + (8 * $i)); + $id = self::getInt4d($this->documentSummaryInformation, ($secOffset+8) + (8 * $i)); // echo 'ID is ', $id,'
'; // Use value of property id as appropriate // offset: 60 + 8 * $i; size: 4; offset from beginning of section (48) - $offset = self::_GetInt4d($this->_documentSummaryInformation, ($secOffset+12) + (8 * $i)); + $offset = self::getInt4d($this->documentSummaryInformation, ($secOffset+12) + (8 * $i)); - $type = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + $offset); + $type = self::getInt4d($this->documentSummaryInformation, $secOffset + $offset); // echo 'Type is ', $type,', '; // initialize property value @@ -1500,27 +1490,27 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // extract property value based on property type switch ($type) { case 0x02: // 2 byte signed integer - $value = self::_GetInt2d($this->_documentSummaryInformation, $secOffset + 4 + $offset); + $value = self::getInt2d($this->documentSummaryInformation, $secOffset + 4 + $offset); break; case 0x03: // 4 byte signed integer - $value = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + 4 + $offset); + $value = self::getInt4d($this->documentSummaryInformation, $secOffset + 4 + $offset); break; case 0x0B: // Boolean - $value = self::_GetInt2d($this->_documentSummaryInformation, $secOffset + 4 + $offset); + $value = self::getInt2d($this->documentSummaryInformation, $secOffset + 4 + $offset); $value = ($value == 0 ? false : true); break; case 0x13: // 4 byte unsigned integer // not needed yet, fix later if necessary break; case 0x1E: // null-terminated string prepended by dword string length - $byteLength = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + 4 + $offset); - $value = substr($this->_documentSummaryInformation, $secOffset + 8 + $offset, $byteLength); + $byteLength = self::getInt4d($this->documentSummaryInformation, $secOffset + 4 + $offset); + $value = substr($this->documentSummaryInformation, $secOffset + 8 + $offset, $byteLength); $value = PHPExcel_Shared_String::ConvertEncoding($value, 'UTF-8', $codePage); $value = rtrim($value); break; case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) // PHP-Time - $value = PHPExcel_Shared_OLE::OLE2LocalDate(substr($this->_documentSummaryInformation, $secOffset + 4 + $offset, 8)); + $value = PHPExcel_Shared_OLE::OLE2LocalDate(substr($this->documentSummaryInformation, $secOffset + 4 + $offset, 8)); break; case 0x47: // Clipboard format // not needed yet, fix later if necessary @@ -1532,7 +1522,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $codePage = PHPExcel_Shared_CodePage::NumberToName($value); break; case 0x02: // Category - $this->_phpExcel->getProperties()->setCategory($value); + $this->phpExcel->getProperties()->setCategory($value); break; case 0x03: // Presentation Target // Not supported by PHPExcel @@ -1568,10 +1558,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // Not supported by PHPExcel break; case 0x0E: // Manager - $this->_phpExcel->getProperties()->setManager($value); + $this->phpExcel->getProperties()->setManager($value); break; case 0x0F: // Company - $this->_phpExcel->getProperties()->setCompany($value); + $this->phpExcel->getProperties()->setCompany($value); break; case 0x10: // Links up-to-date // Not supported by PHPExcel @@ -1584,13 +1574,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Reads a general type of BIFF record. Does nothing except for moving stream pointer forward to next record. */ - private function _readDefault() + private function readDefault() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); -// $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); +// $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; } @@ -1598,29 +1588,29 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * The NOTE record specifies a comment associated with a particular cell. In Excel 95 (BIFF7) and earlier versions, * this record stores a note (cell note). This feature was significantly enhanced in Excel 97. */ - private function _readNote() + private function readNote() { // echo 'Read Cell Annotation
'; - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if ($this->_readDataOnly) { + if ($this->readDataOnly) { return; } - $cellAddress = $this->_readBIFF8CellAddress(substr($recordData, 0, 4)); - if ($this->_version == self::XLS_BIFF8) { - $noteObjID = self::_GetInt2d($recordData, 6); - $noteAuthor = self::_readUnicodeStringLong(substr($recordData, 8)); + $cellAddress = $this->readBIFF8CellAddress(substr($recordData, 0, 4)); + if ($this->version == self::XLS_BIFF8) { + $noteObjID = self::getInt2d($recordData, 6); + $noteAuthor = self::readUnicodeStringLong(substr($recordData, 8)); $noteAuthor = $noteAuthor['value']; // echo 'Note Address=', $cellAddress,'
'; // echo 'Note Object ID=', $noteObjID,'
'; // echo 'Note Author=', $noteAuthor,'
'; // - $this->_cellNotes[$noteObjID] = array( + $this->cellNotes[$noteObjID] = array( 'cellRef' => $cellAddress, 'objectID' => $noteObjID, 'author' => $noteAuthor @@ -1631,26 +1621,26 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // If the address row is -1 and the column is 0, (which translates as $B$65536) then this is a continuation // note from the previous cell annotation. We're not yet handling this, so annotations longer than the // max 2048 bytes will probably throw a wobbly. - $row = self::_GetInt2d($recordData, 0); + $row = self::getInt2d($recordData, 0); $extension = true; - $cellAddress = array_pop(array_keys($this->_phpSheet->getComments())); + $cellAddress = array_pop(array_keys($this->phpSheet->getComments())); } // echo 'Note Address=', $cellAddress,'
'; $cellAddress = str_replace('$', '', $cellAddress); - $noteLength = self::_GetInt2d($recordData, 4); + $noteLength = self::getInt2d($recordData, 4); $noteText = trim(substr($recordData, 6)); // echo 'Note Length=', $noteLength,'
'; // echo 'Note Text=', $noteText,'
'; if ($extension) { // Concatenate this extension with the currently set comment for the cell - $comment = $this->_phpSheet->getComment($cellAddress); + $comment = $this->phpSheet->getComment($cellAddress); $commentText = $comment->getText()->getPlainText(); - $comment->setText($this->_parseRichText($commentText.$noteText)); + $comment->setText($this->parseRichText($commentText.$noteText)); } else { // Set comment for the cell - $this->_phpSheet->getComment($cellAddress)->setText($this->_parseRichText($noteText)); + $this->phpSheet->getComment($cellAddress)->setText($this->parseRichText($noteText)); // ->setAuthor($author) } } @@ -1661,15 +1651,15 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * The TEXT Object record contains the text associated with a cell annotation. */ - private function _readTextObject() + private function readTextObject() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if ($this->_readDataOnly) { + if ($this->readDataOnly) { return; } @@ -1679,13 +1669,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // cchText: 2 bytes; length of the text (in the first continue record) // cbRuns: 2 bytes; length of the formatting (in the second continue record) // followed by the continuation records containing the actual text and formatting - $grbitOpts = self::_GetInt2d($recordData, 0); - $rot = self::_GetInt2d($recordData, 2); - $cchText = self::_GetInt2d($recordData, 10); - $cbRuns = self::_GetInt2d($recordData, 12); - $text = $this->_getSplicedRecordData(); + $grbitOpts = self::getInt2d($recordData, 0); + $rot = self::getInt2d($recordData, 2); + $cchText = self::getInt2d($recordData, 10); + $cbRuns = self::getInt2d($recordData, 12); + $text = $this->getSplicedRecordData(); - $this->_textObjects[$this->textObjRef] = array( + $this->textObjects[$this->textObjRef] = array( 'text' => substr($text["recordData"], $text["spliceOffsets"][0]+1, $cchText), 'format' => substr($text["recordData"], $text["spliceOffsets"][1], $cbRuns), 'alignment' => $grbitOpts, @@ -1693,7 +1683,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce ); // echo '_readTextObject()
'; -// var_dump($this->_textObjects[$this->textObjRef]); +// var_dump($this->textObjects[$this->textObjRef]); // echo '
'; } @@ -1701,24 +1691,24 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read BOF */ - private function _readBof() + private function readBof() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = substr($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 2; size: 2; type of the following data - $substreamType = self::_GetInt2d($recordData, 2); + $substreamType = self::getInt2d($recordData, 2); switch ($substreamType) { case self::XLS_WorkbookGlobals: - $version = self::_GetInt2d($recordData, 0); + $version = self::getInt2d($recordData, 0); if (($version != self::XLS_BIFF8) && ($version != self::XLS_BIFF7)) { throw new PHPExcel_Reader_Exception('Cannot read this Excel file. Version is too old.'); } - $this->_version = $version; + $this->version = $version; break; case self::XLS_Worksheet: // do not use this version information for anything @@ -1728,9 +1718,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // substream, e.g. chart // just skip the entire substream do { - $code = self::_GetInt2d($this->_data, $this->_pos); - $this->_readDefault(); - } while ($code != self::XLS_Type_EOF && $this->_pos < $this->_dataSize); + $code = self::getInt2d($this->data, $this->pos); + $this->readDefault(); + } while ($code != self::XLS_Type_EOF && $this->pos < $this->dataSize); break; } } @@ -1751,27 +1741,27 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * are based on the source of Spreadsheet-ParseExcel: * http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel/ */ - private function _readFilepass() + private function readFilepass() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); + $length = self::getInt2d($this->data, $this->pos + 2); if ($length != 54) { throw new PHPExcel_Reader_Exception('Unexpected file pass record length'); } - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_verifyPassword('VelvetSweatshop', substr($recordData, 6, 16), substr($recordData, 22, 16), substr($recordData, 38, 16), $this->_md5Ctxt)) { + if (!$this->verifyPassword('VelvetSweatshop', substr($recordData, 6, 16), substr($recordData, 22, 16), substr($recordData, 38, 16), $this->md5Ctxt)) { throw new PHPExcel_Reader_Exception('Decryption password incorrect'); } - $this->_encryption = self::MS_BIFF_CRYPTO_RC4; + $this->encryption = self::MS_BIFF_CRYPTO_RC4; // Decryption required from the record after next onwards - $this->_encryptionStartPos = $this->_pos + self::_GetInt2d($this->_data, $this->_pos + 2); + $this->encryptionStartPos = $this->pos + self::getInt2d($this->data, $this->pos + 2); } /** @@ -1782,7 +1772,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * * @return PHPExcel_Reader_Excel5_RC4 */ - private function _makeKey($block, $valContext) + private function makeKey($block, $valContext) { $pwarray = str_repeat("\0", 64); @@ -1816,7 +1806,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * * @return bool Success */ - private function _verifyPassword($password, $docid, $salt_data, $hashedsalt_data, &$valContext) + private function verifyPassword($password, $docid, $salt_data, $hashedsalt_data, &$valContext) { $pwarray = str_repeat("\0", 64); @@ -1874,7 +1864,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $md5->add($pwarray); $valContext = $md5->getContext(); - $key = $this->_makeKey(0, $valContext); + $key = $this->makeKey(0, $valContext); $salt = $key->RC4($salt_data); $hashedsalt = $key->RC4($hashedsalt_data); @@ -1898,18 +1888,18 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readCodepage() + private function readCodepage() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; code page identifier - $codepage = self::_GetInt2d($recordData, 0); + $codepage = self::getInt2d($recordData, 0); - $this->_codepage = PHPExcel_Shared_CodePage::NumberToName($codepage); + $this->codepage = PHPExcel_Shared_CodePage::NumberToName($codepage); } @@ -1925,13 +1915,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readDateMode() + private function readDateMode() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; 0 = base 1900, 1 = base 1904 PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); @@ -1944,42 +1934,42 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read a FONT record */ - private function _readFont() + private function readFont() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { $objFont = new PHPExcel_Style_Font(); // offset: 0; size: 2; height of the font (in twips = 1/20 of a point) - $size = self::_GetInt2d($recordData, 0); + $size = self::getInt2d($recordData, 0); $objFont->setSize($size / 20); // offset: 2; size: 2; option flags // bit: 0; mask 0x0001; bold (redundant in BIFF5-BIFF8) // bit: 1; mask 0x0002; italic - $isItalic = (0x0002 & self::_GetInt2d($recordData, 2)) >> 1; + $isItalic = (0x0002 & self::getInt2d($recordData, 2)) >> 1; if ($isItalic) { $objFont->setItalic(true); } // bit: 2; mask 0x0004; underlined (redundant in BIFF5-BIFF8) // bit: 3; mask 0x0008; strike - $isStrike = (0x0008 & self::_GetInt2d($recordData, 2)) >> 3; + $isStrike = (0x0008 & self::getInt2d($recordData, 2)) >> 3; if ($isStrike) { $objFont->setStrikethrough(true); } // offset: 4; size: 2; colour index - $colorIndex = self::_GetInt2d($recordData, 4); + $colorIndex = self::getInt2d($recordData, 4); $objFont->colorIndex = $colorIndex; // offset: 6; size: 2; font weight - $weight = self::_GetInt2d($recordData, 6); + $weight = self::getInt2d($recordData, 6); switch ($weight) { case 0x02BC: $objFont->setBold(true); @@ -1987,7 +1977,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } // offset: 8; size: 2; escapement type - $escapement = self::_GetInt2d($recordData, 8); + $escapement = self::getInt2d($recordData, 8); switch ($escapement) { case 0x0001: $objFont->setSuperScript(true); @@ -2020,14 +2010,14 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 12; size: 1; character set // offset: 13; size: 1; not used // offset: 14; size: var; font name - if ($this->_version == self::XLS_BIFF8) { - $string = self::_readUnicodeStringShort(substr($recordData, 14)); + if ($this->version == self::XLS_BIFF8) { + $string = self::readUnicodeStringShort(substr($recordData, 14)); } else { - $string = $this->_readByteStringShort(substr($recordData, 14)); + $string = $this->readByteStringShort(substr($recordData, 14)); } $objFont->setName($string['value']); - $this->_objFonts[] = $objFont; + $this->objFonts[] = $objFont; } } @@ -2046,26 +2036,26 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readFormat() + private function readFormat() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { - $indexCode = self::_GetInt2d($recordData, 0); + if (!$this->readDataOnly) { + $indexCode = self::getInt2d($recordData, 0); - if ($this->_version == self::XLS_BIFF8) { - $string = self::_readUnicodeStringLong(substr($recordData, 2)); + if ($this->version == self::XLS_BIFF8) { + $string = self::readUnicodeStringLong(substr($recordData, 2)); } else { // BIFF7 - $string = $this->_readByteStringShort(substr($recordData, 2)); + $string = $this->readByteStringShort(substr($recordData, 2)); } $formatString = $string['value']; - $this->_formats[$indexCode] = $formatString; + $this->formats[$indexCode] = $formatString; } } @@ -2084,32 +2074,32 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readXf() + private function readXf() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; $objStyle = new PHPExcel_Style(); - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 2; Index to FONT record - if (self::_GetInt2d($recordData, 0) < 4) { - $fontIndex = self::_GetInt2d($recordData, 0); + if (self::getInt2d($recordData, 0) < 4) { + $fontIndex = self::getInt2d($recordData, 0); } else { // this has to do with that index 4 is omitted in all BIFF versions for some strange reason // check the OpenOffice documentation of the FONT record - $fontIndex = self::_GetInt2d($recordData, 0) - 1; + $fontIndex = self::getInt2d($recordData, 0) - 1; } - $objStyle->setFont($this->_objFonts[$fontIndex]); + $objStyle->setFont($this->objFonts[$fontIndex]); // offset: 2; size: 2; Index to FORMAT record - $numberFormatIndex = self::_GetInt2d($recordData, 2); - if (isset($this->_formats[$numberFormatIndex])) { + $numberFormatIndex = self::getInt2d($recordData, 2); + if (isset($this->formats[$numberFormatIndex])) { // then we have user-defined format code - $numberformat = array('code' => $this->_formats[$numberFormatIndex]); + $numberformat = array('code' => $this->formats[$numberFormatIndex]); } elseif (($code = PHPExcel_Style_NumberFormat::builtInFormatCode($numberFormatIndex)) !== '') { // then we have built-in format code $numberformat = array('code' => $code); @@ -2121,7 +2111,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 4; size: 2; XF type, cell protection, and parent style XF // bit 2-0; mask 0x0007; XF_TYPE_PROT - $xfTypeProt = self::_GetInt2d($recordData, 4); + $xfTypeProt = self::getInt2d($recordData, 4); // bit 0; mask 0x01; 1 = cell is locked $isLocked = (0x01 & $xfTypeProt) >> 0; $objStyle->getProtection()->setLocked($isLocked ? PHPExcel_Style_Protection::PROTECTION_INHERIT : PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); @@ -2186,7 +2176,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce break; } - if ($this->_version == self::XLS_BIFF8) { + if ($this->version == self::XLS_BIFF8) { // offset: 7; size: 1; XF_ROTATION: Text rotation angle $angle = ord($recordData{7}); $rotation = 0; @@ -2219,32 +2209,32 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 10; size: 4; Cell border lines and background area // bit: 3-0; mask: 0x0000000F; left style - if ($bordersLeftStyle = self::_mapBorderStyle((0x0000000F & self::_GetInt4d($recordData, 10)) >> 0)) { + if ($bordersLeftStyle = self::mapBorderStyle((0x0000000F & self::getInt4d($recordData, 10)) >> 0)) { $objStyle->getBorders()->getLeft()->setBorderStyle($bordersLeftStyle); } // bit: 7-4; mask: 0x000000F0; right style - if ($bordersRightStyle = self::_mapBorderStyle((0x000000F0 & self::_GetInt4d($recordData, 10)) >> 4)) { + if ($bordersRightStyle = self::mapBorderStyle((0x000000F0 & self::getInt4d($recordData, 10)) >> 4)) { $objStyle->getBorders()->getRight()->setBorderStyle($bordersRightStyle); } // bit: 11-8; mask: 0x00000F00; top style - if ($bordersTopStyle = self::_mapBorderStyle((0x00000F00 & self::_GetInt4d($recordData, 10)) >> 8)) { + if ($bordersTopStyle = self::mapBorderStyle((0x00000F00 & self::getInt4d($recordData, 10)) >> 8)) { $objStyle->getBorders()->getTop()->setBorderStyle($bordersTopStyle); } // bit: 15-12; mask: 0x0000F000; bottom style - if ($bordersBottomStyle = self::_mapBorderStyle((0x0000F000 & self::_GetInt4d($recordData, 10)) >> 12)) { + if ($bordersBottomStyle = self::mapBorderStyle((0x0000F000 & self::getInt4d($recordData, 10)) >> 12)) { $objStyle->getBorders()->getBottom()->setBorderStyle($bordersBottomStyle); } // bit: 22-16; mask: 0x007F0000; left color - $objStyle->getBorders()->getLeft()->colorIndex = (0x007F0000 & self::_GetInt4d($recordData, 10)) >> 16; + $objStyle->getBorders()->getLeft()->colorIndex = (0x007F0000 & self::getInt4d($recordData, 10)) >> 16; // bit: 29-23; mask: 0x3F800000; right color - $objStyle->getBorders()->getRight()->colorIndex = (0x3F800000 & self::_GetInt4d($recordData, 10)) >> 23; + $objStyle->getBorders()->getRight()->colorIndex = (0x3F800000 & self::getInt4d($recordData, 10)) >> 23; // bit: 30; mask: 0x40000000; 1 = diagonal line from top left to right bottom - $diagonalDown = (0x40000000 & self::_GetInt4d($recordData, 10)) >> 30 ? true : false; + $diagonalDown = (0x40000000 & self::getInt4d($recordData, 10)) >> 30 ? true : false; // bit: 31; mask: 0x80000000; 1 = diagonal line from bottom left to top right - $diagonalUp = (0x80000000 & self::_GetInt4d($recordData, 10)) >> 31 ? true : false; + $diagonalUp = (0x80000000 & self::getInt4d($recordData, 10)) >> 31 ? true : false; if ($diagonalUp == false && $diagonalDown == false) { $objStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_NONE); @@ -2258,29 +2248,29 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 14; size: 4; // bit: 6-0; mask: 0x0000007F; top color - $objStyle->getBorders()->getTop()->colorIndex = (0x0000007F & self::_GetInt4d($recordData, 14)) >> 0; + $objStyle->getBorders()->getTop()->colorIndex = (0x0000007F & self::getInt4d($recordData, 14)) >> 0; // bit: 13-7; mask: 0x00003F80; bottom color - $objStyle->getBorders()->getBottom()->colorIndex = (0x00003F80 & self::_GetInt4d($recordData, 14)) >> 7; + $objStyle->getBorders()->getBottom()->colorIndex = (0x00003F80 & self::getInt4d($recordData, 14)) >> 7; // bit: 20-14; mask: 0x001FC000; diagonal color - $objStyle->getBorders()->getDiagonal()->colorIndex = (0x001FC000 & self::_GetInt4d($recordData, 14)) >> 14; + $objStyle->getBorders()->getDiagonal()->colorIndex = (0x001FC000 & self::getInt4d($recordData, 14)) >> 14; // bit: 24-21; mask: 0x01E00000; diagonal style - if ($bordersDiagonalStyle = self::_mapBorderStyle((0x01E00000 & self::_GetInt4d($recordData, 14)) >> 21)) { + if ($bordersDiagonalStyle = self::mapBorderStyle((0x01E00000 & self::getInt4d($recordData, 14)) >> 21)) { $objStyle->getBorders()->getDiagonal()->setBorderStyle($bordersDiagonalStyle); } // bit: 31-26; mask: 0xFC000000 fill pattern - if ($fillType = self::_mapFillPattern((0xFC000000 & self::_GetInt4d($recordData, 14)) >> 26)) { + if ($fillType = self::mapFillPattern((0xFC000000 & self::getInt4d($recordData, 14)) >> 26)) { $objStyle->getFill()->setFillType($fillType); } // offset: 18; size: 2; pattern and background colour // bit: 6-0; mask: 0x007F; color index for pattern color - $objStyle->getFill()->startcolorIndex = (0x007F & self::_GetInt2d($recordData, 18)) >> 0; + $objStyle->getFill()->startcolorIndex = (0x007F & self::getInt2d($recordData, 18)) >> 0; // bit: 13-7; mask: 0x3F80; color index for pattern background - $objStyle->getFill()->endcolorIndex = (0x3F80 & self::_GetInt2d($recordData, 18)) >> 7; + $objStyle->getFill()->endcolorIndex = (0x3F80 & self::getInt2d($recordData, 18)) >> 7; } else { // BIFF5 @@ -2305,7 +2295,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } // offset: 8; size: 4; cell border lines and background area - $borderAndBackground = self::_GetInt4d($recordData, 8); + $borderAndBackground = self::getInt4d($recordData, 8); // bit: 6-0; mask: 0x0000007F; color index for pattern color $objStyle->getFill()->startcolorIndex = (0x0000007F & $borderAndBackground) >> 0; @@ -2314,25 +2304,25 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $objStyle->getFill()->endcolorIndex = (0x00003F80 & $borderAndBackground) >> 7; // bit: 21-16; mask: 0x003F0000; fill pattern - $objStyle->getFill()->setFillType(self::_mapFillPattern((0x003F0000 & $borderAndBackground) >> 16)); + $objStyle->getFill()->setFillType(self::mapFillPattern((0x003F0000 & $borderAndBackground) >> 16)); // bit: 24-22; mask: 0x01C00000; bottom line style - $objStyle->getBorders()->getBottom()->setBorderStyle(self::_mapBorderStyle((0x01C00000 & $borderAndBackground) >> 22)); + $objStyle->getBorders()->getBottom()->setBorderStyle(self::mapBorderStyle((0x01C00000 & $borderAndBackground) >> 22)); // bit: 31-25; mask: 0xFE000000; bottom line color $objStyle->getBorders()->getBottom()->colorIndex = (0xFE000000 & $borderAndBackground) >> 25; // offset: 12; size: 4; cell border lines - $borderLines = self::_GetInt4d($recordData, 12); + $borderLines = self::getInt4d($recordData, 12); // bit: 2-0; mask: 0x00000007; top line style - $objStyle->getBorders()->getTop()->setBorderStyle(self::_mapBorderStyle((0x00000007 & $borderLines) >> 0)); + $objStyle->getBorders()->getTop()->setBorderStyle(self::mapBorderStyle((0x00000007 & $borderLines) >> 0)); // bit: 5-3; mask: 0x00000038; left line style - $objStyle->getBorders()->getLeft()->setBorderStyle(self::_mapBorderStyle((0x00000038 & $borderLines) >> 3)); + $objStyle->getBorders()->getLeft()->setBorderStyle(self::mapBorderStyle((0x00000038 & $borderLines) >> 3)); // bit: 8-6; mask: 0x000001C0; right line style - $objStyle->getBorders()->getRight()->setBorderStyle(self::_mapBorderStyle((0x000001C0 & $borderLines) >> 6)); + $objStyle->getBorders()->getRight()->setBorderStyle(self::mapBorderStyle((0x000001C0 & $borderLines) >> 6)); // bit: 15-9; mask: 0x0000FE00; top line color index $objStyle->getBorders()->getTop()->colorIndex = (0x0000FE00 & $borderLines) >> 9; @@ -2347,18 +2337,18 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // add cellStyleXf or cellXf and update mapping if ($isCellStyleXf) { // we only read one style XF record which is always the first - if ($this->_xfIndex == 0) { - $this->_phpExcel->addCellStyleXf($objStyle); - $this->_mapCellStyleXfIndex[$this->_xfIndex] = 0; + if ($this->xfIndex == 0) { + $this->phpExcel->addCellStyleXf($objStyle); + $this->mapCellStyleXfIndex[$this->xfIndex] = 0; } } else { // we read all cell XF records - $this->_phpExcel->addCellXf($objStyle); - $this->_mapCellXfIndex[$this->_xfIndex] = count($this->_phpExcel->getCellXfCollection()) - 1; + $this->phpExcel->addCellXf($objStyle); + $this->mapCellXfIndex[$this->xfIndex] = count($this->phpExcel->getCellXfCollection()) - 1; } // update XF index for when we read next record - ++$this->_xfIndex; + ++$this->xfIndex; } } @@ -2366,15 +2356,15 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * */ - private function _readXfExt() + private function readXfExt() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 2; 0x087D = repeated header // offset: 2; size: 2 @@ -2384,141 +2374,141 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 12; size: 2; record version // offset: 14; size: 2; index to XF record which this record modifies - $ixfe = self::_GetInt2d($recordData, 14); + $ixfe = self::getInt2d($recordData, 14); // offset: 16; size: 2; not used // offset: 18; size: 2; number of extension properties that follow - $cexts = self::_GetInt2d($recordData, 18); + $cexts = self::getInt2d($recordData, 18); // start reading the actual extension data $offset = 20; while ($offset < $length) { // extension type - $extType = self::_GetInt2d($recordData, $offset); + $extType = self::getInt2d($recordData, $offset); // extension length - $cb = self::_GetInt2d($recordData, $offset + 2); + $cb = self::getInt2d($recordData, $offset + 2); // extension data $extData = substr($recordData, $offset + 4, $cb); switch ($extType) { case 4: // fill start color - $xclfType = self::_GetInt2d($extData, 0); // color type + $xclfType = self::getInt2d($extData, 0); // color type $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); // modify the relevant style property - if (isset($this->_mapCellXfIndex[$ixfe])) { - $fill = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getFill(); + if (isset($this->mapCellXfIndex[$ixfe])) { + $fill = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFill(); $fill->getStartColor()->setRGB($rgb); unset($fill->startcolorIndex); // normal color index does not apply, discard } } break; case 5: // fill end color - $xclfType = self::_GetInt2d($extData, 0); // color type + $xclfType = self::getInt2d($extData, 0); // color type $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); // modify the relevant style property - if (isset($this->_mapCellXfIndex[$ixfe])) { - $fill = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getFill(); + if (isset($this->mapCellXfIndex[$ixfe])) { + $fill = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFill(); $fill->getEndColor()->setRGB($rgb); unset($fill->endcolorIndex); // normal color index does not apply, discard } } break; case 7: // border color top - $xclfType = self::_GetInt2d($extData, 0); // color type + $xclfType = self::getInt2d($extData, 0); // color type $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); // modify the relevant style property - if (isset($this->_mapCellXfIndex[$ixfe])) { - $top = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getBorders()->getTop(); + if (isset($this->mapCellXfIndex[$ixfe])) { + $top = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getTop(); $top->getColor()->setRGB($rgb); unset($top->colorIndex); // normal color index does not apply, discard } } break; case 8: // border color bottom - $xclfType = self::_GetInt2d($extData, 0); // color type + $xclfType = self::getInt2d($extData, 0); // color type $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); // modify the relevant style property - if (isset($this->_mapCellXfIndex[$ixfe])) { - $bottom = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getBorders()->getBottom(); + if (isset($this->mapCellXfIndex[$ixfe])) { + $bottom = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getBottom(); $bottom->getColor()->setRGB($rgb); unset($bottom->colorIndex); // normal color index does not apply, discard } } break; case 9: // border color left - $xclfType = self::_GetInt2d($extData, 0); // color type + $xclfType = self::getInt2d($extData, 0); // color type $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); // modify the relevant style property - if (isset($this->_mapCellXfIndex[$ixfe])) { - $left = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getBorders()->getLeft(); + if (isset($this->mapCellXfIndex[$ixfe])) { + $left = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getLeft(); $left->getColor()->setRGB($rgb); unset($left->colorIndex); // normal color index does not apply, discard } } break; case 10: // border color right - $xclfType = self::_GetInt2d($extData, 0); // color type + $xclfType = self::getInt2d($extData, 0); // color type $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); // modify the relevant style property - if (isset($this->_mapCellXfIndex[$ixfe])) { - $right = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getBorders()->getRight(); + if (isset($this->mapCellXfIndex[$ixfe])) { + $right = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getRight(); $right->getColor()->setRGB($rgb); unset($right->colorIndex); // normal color index does not apply, discard } } break; case 11: // border color diagonal - $xclfType = self::_GetInt2d($extData, 0); // color type + $xclfType = self::getInt2d($extData, 0); // color type $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); // modify the relevant style property - if (isset($this->_mapCellXfIndex[$ixfe])) { - $diagonal = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getBorders()->getDiagonal(); + if (isset($this->mapCellXfIndex[$ixfe])) { + $diagonal = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getDiagonal(); $diagonal->getColor()->setRGB($rgb); unset($diagonal->colorIndex); // normal color index does not apply, discard } } break; case 13: // font color - $xclfType = self::_GetInt2d($extData, 0); // color type + $xclfType = self::getInt2d($extData, 0); // color type $xclrValue = substr($extData, 4, 4); // color value (value based on color type) if ($xclfType == 2) { $rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); // modify the relevant style property - if (isset($this->_mapCellXfIndex[$ixfe])) { - $font = $this->_phpExcel->getCellXfByIndex($this->_mapCellXfIndex[$ixfe])->getFont(); + if (isset($this->mapCellXfIndex[$ixfe])) { + $font = $this->phpExcel->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFont(); $font->getColor()->setRGB($rgb); unset($font->colorIndex); // normal color index does not apply, discard } @@ -2536,17 +2526,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read STYLE record */ - private function _readStyle() + private function readStyle() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 2; index to XF record and flag for built-in style - $ixfe = self::_GetInt2d($recordData, 0); + $ixfe = self::getInt2d($recordData, 0); // bit: 11-0; mask 0x0FFF; index to XF record $xfIndex = (0x0FFF & $ixfe) >> 0; @@ -2575,22 +2565,22 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read PALETTE record */ - private function _readPalette() + private function readPalette() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 2; number of following colors - $nm = self::_GetInt2d($recordData, 0); + $nm = self::getInt2d($recordData, 0); // list of RGB colors for ($i = 0; $i < $nm; ++$i) { $rgb = substr($recordData, 2 + 4 * $i, 4); - $this->_palette[] = self::_readRGB($rgb); + $this->palette[] = self::readRGB($rgb); } } } @@ -2608,17 +2598,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readSheet() + private function readSheet() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // offset: 0; size: 4; absolute stream position of the BOF record of the sheet // NOTE: not encrypted - $rec_offset = self::_GetInt4d($this->_data, $this->_pos + 4); + $rec_offset = self::getInt4d($this->data, $this->pos + 4); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 4; size: 1; sheet state switch (ord($recordData{4})) { @@ -2640,15 +2630,15 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $sheetType = ord($recordData{5}); // offset: 6; size: var; sheet name - if ($this->_version == self::XLS_BIFF8) { - $string = self::_readUnicodeStringShort(substr($recordData, 6)); + if ($this->version == self::XLS_BIFF8) { + $string = self::readUnicodeStringShort(substr($recordData, 6)); $rec_name = $string['value']; - } elseif ($this->_version == self::XLS_BIFF7) { - $string = $this->_readByteStringShort(substr($recordData, 6)); + } elseif ($this->version == self::XLS_BIFF7) { + $string = $this->readByteStringShort(substr($recordData, 6)); $rec_name = $string['value']; } - $this->_sheets[] = array( + $this->sheets[] = array( 'name' => $rec_name, 'offset' => $rec_offset, 'sheetState' => $sheetState, @@ -2660,13 +2650,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read EXTERNALBOOK record */ - private function _readExternalBook() + private function readExternalBook() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset within record data $offset = 0; @@ -2675,23 +2665,23 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce if (strlen($recordData) > 4) { // external reference // offset: 0; size: 2; number of sheet names ($nm) - $nm = self::_GetInt2d($recordData, 0); + $nm = self::getInt2d($recordData, 0); $offset += 2; // offset: 2; size: var; encoded URL without sheet name (Unicode string, 16-bit length) - $encodedUrlString = self::_readUnicodeStringLong(substr($recordData, 2)); + $encodedUrlString = self::readUnicodeStringLong(substr($recordData, 2)); $offset += $encodedUrlString['size']; // offset: var; size: var; list of $nm sheet names (Unicode strings, 16-bit length) $externalSheetNames = array(); for ($i = 0; $i < $nm; ++$i) { - $externalSheetNameString = self::_readUnicodeStringLong(substr($recordData, $offset)); + $externalSheetNameString = self::readUnicodeStringLong(substr($recordData, $offset)); $externalSheetNames[] = $externalSheetNameString['value']; $offset += $externalSheetNameString['size']; } // store the record data - $this->_externalBooks[] = array( + $this->externalBooks[] = array( 'type' => 'external', 'encodedUrl' => $encodedUrlString['value'], 'externalSheetNames' => $externalSheetNames, @@ -2700,20 +2690,20 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // internal reference // offset: 0; size: 2; number of sheet in this document // offset: 2; size: 2; 0x01 0x04 - $this->_externalBooks[] = array( + $this->externalBooks[] = array( 'type' => 'internal', ); } elseif (substr($recordData, 0, 4) == pack('vCC', 0x0001, 0x01, 0x3A)) { // add-in function // offset: 0; size: 2; 0x0001 - $this->_externalBooks[] = array( + $this->externalBooks[] = array( 'type' => 'addInFunction', ); } elseif (substr($recordData, 0, 2) == pack('v', 0x0000)) { // DDE links, OLE links // offset: 0; size: 2; 0x0000 // offset: 2; size: var; encoded source document name - $this->_externalBooks[] = array( + $this->externalBooks[] = array( 'type' => 'DDEorOLE', ); } @@ -2723,31 +2713,31 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read EXTERNNAME record. */ - private function _readExternName() + private function readExternName() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // external sheet references provided for named cells - if ($this->_version == self::XLS_BIFF8) { + if ($this->version == self::XLS_BIFF8) { // offset: 0; size: 2; options - $options = self::_GetInt2d($recordData, 0); + $options = self::getInt2d($recordData, 0); // offset: 2; size: 2; // offset: 4; size: 2; not used // offset: 6; size: var - $nameString = self::_readUnicodeStringShort(substr($recordData, 6)); + $nameString = self::readUnicodeStringShort(substr($recordData, 6)); // offset: var; size: var; formula data $offset = 6 + $nameString['size']; - $formula = $this->_getFormulaFromStructure(substr($recordData, $offset)); + $formula = $this->getFormulaFromStructure(substr($recordData, $offset)); - $this->_externalNames[] = array( + $this->externalNames[] = array( 'name' => $nameString['value'], 'formula' => $formula, ); @@ -2758,26 +2748,26 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read EXTERNSHEET record */ - private function _readExternSheet() + private function readExternSheet() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // external sheet references provided for named cells - if ($this->_version == self::XLS_BIFF8) { + if ($this->version == self::XLS_BIFF8) { // offset: 0; size: 2; number of following ref structures - $nm = self::_GetInt2d($recordData, 0); + $nm = self::getInt2d($recordData, 0); for ($i = 0; $i < $nm; ++$i) { - $this->_ref[] = array( + $this->ref[] = array( // offset: 2 + 6 * $i; index to EXTERNALBOOK record - 'externalBookIndex' => self::_GetInt2d($recordData, 2 + 6 * $i), + 'externalBookIndex' => self::getInt2d($recordData, 2 + 6 * $i), // offset: 4 + 6 * $i; index to first sheet in EXTERNALBOOK record - 'firstSheetIndex' => self::_GetInt2d($recordData, 4 + 6 * $i), + 'firstSheetIndex' => self::getInt2d($recordData, 4 + 6 * $i), // offset: 6 + 6 * $i; index to last sheet in EXTERNALBOOK record - 'lastSheetIndex' => self::_GetInt2d($recordData, 6 + 6 * $i), + 'lastSheetIndex' => self::getInt2d($recordData, 6 + 6 * $i), ); } } @@ -2795,19 +2785,19 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readDefinedName() + private function readDefinedName() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if ($this->_version == self::XLS_BIFF8) { + if ($this->version == self::XLS_BIFF8) { // retrieves named cells // offset: 0; size: 2; option flags - $opts = self::_GetInt2d($recordData, 0); + $opts = self::getInt2d($recordData, 0); // bit: 5; mask: 0x0020; 0 = user-defined name, 1 = built-in-name $isBuiltInName = (0x0020 & $opts) >> 5; @@ -2819,25 +2809,25 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 4; size: 2; size of the formula data (it can happen that this is zero) // note: there can also be additional data, this is not included in $flen - $flen = self::_GetInt2d($recordData, 4); + $flen = self::getInt2d($recordData, 4); // offset: 8; size: 2; 0=Global name, otherwise index to sheet (1-based) - $scope = self::_GetInt2d($recordData, 8); + $scope = self::getInt2d($recordData, 8); // offset: 14; size: var; Name (Unicode string without length field) - $string = self::_readUnicodeString(substr($recordData, 14), $nlen); + $string = self::readUnicodeString(substr($recordData, 14), $nlen); // offset: var; size: $flen; formula data $offset = 14 + $string['size']; $formulaStructure = pack('v', $flen) . substr($recordData, $offset); try { - $formula = $this->_getFormulaFromStructure($formulaStructure); + $formula = $this->getFormulaFromStructure($formulaStructure); } catch (PHPExcel_Exception $e) { $formula = ''; } - $this->_definedname[] = array( + $this->definedname[] = array( 'isBuiltInName' => $isBuiltInName, 'name' => $string['value'], 'formula' => $formula, @@ -2850,15 +2840,15 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read MSODRAWINGGROUP record */ - private function _readMsoDrawingGroup() + private function readMsoDrawingGroup() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); + $length = self::getInt2d($this->data, $this->pos + 2); // get spliced record data - $splicedRecordData = $this->_getSplicedRecordData(); + $splicedRecordData = $this->getSplicedRecordData(); $recordData = $splicedRecordData['recordData']; - $this->_drawingGroupData .= $recordData; + $this->drawingGroupData .= $recordData; } @@ -2873,13 +2863,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" **/ - private function _readSst() + private function readSst() { // offset within (spliced) record data $pos = 0; // get spliced record data - $splicedRecordData = $this->_getSplicedRecordData(); + $splicedRecordData = $this->getSplicedRecordData(); $recordData = $splicedRecordData['recordData']; $spliceOffsets = $splicedRecordData['spliceOffsets']; @@ -2888,13 +2878,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $pos += 4; // offset: 4; size: 4; number of following strings ($nm) - $nm = self::_GetInt4d($recordData, 4); + $nm = self::getInt4d($recordData, 4); $pos += 4; // loop through the Unicode strings (16-bit length) for ($i = 0; $i < $nm; ++$i) { // number of characters in the Unicode string - $numChars = self::_GetInt2d($recordData, $pos); + $numChars = self::getInt2d($recordData, $pos); $pos += 2; // option flags @@ -2912,13 +2902,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce if ($hasRichText) { // number of Rich-Text formatting runs - $formattingRuns = self::_GetInt2d($recordData, $pos); + $formattingRuns = self::getInt2d($recordData, $pos); $pos += 2; } if ($hasAsian) { // size of Asian phonetic setting - $extendedRunLength = self::_GetInt4d($recordData, $pos); + $extendedRunLength = self::getInt4d($recordData, $pos); $pos += 4; } @@ -3010,7 +3000,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } // convert to UTF-8 - $retstr = self::_encodeUTF16($retstr, $isCompressed); + $retstr = self::encodeUTF16($retstr, $isCompressed); // read additional Rich-Text information, if any $fmtRuns = array(); @@ -3018,10 +3008,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // list of formatting runs for ($j = 0; $j < $formattingRuns; ++$j) { // first formatted character; zero-based - $charPos = self::_GetInt2d($recordData, $pos + $j * 4); + $charPos = self::getInt2d($recordData, $pos + $j * 4); // index to font record - $fontIndex = self::_GetInt2d($recordData, $pos + 2 + $j * 4); + $fontIndex = self::getInt2d($recordData, $pos + 2 + $j * 4); $fmtRuns[] = array( 'charPos' => $charPos, @@ -3038,31 +3028,31 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } // store the shared sting - $this->_sst[] = array( + $this->sst[] = array( 'value' => $retstr, 'fmtRuns' => $fmtRuns, ); } - // _getSplicedRecordData() takes care of moving current position in data stream + // getSplicedRecordData() takes care of moving current position in data stream } /** * Read PRINTGRIDLINES record */ - private function _readPrintGridlines() + private function readPrintGridlines() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) { + if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) { // offset: 0; size: 2; 0 = do not print sheet grid lines; 1 = print sheet gridlines - $printGridlines = (bool) self::_GetInt2d($recordData, 0); - $this->_phpSheet->setPrintGridlines($printGridlines); + $printGridlines = (bool) self::getInt2d($recordData, 0); + $this->phpSheet->setPrintGridlines($printGridlines); } } @@ -3070,71 +3060,71 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read DEFAULTROWHEIGHT record */ - private function _readDefaultRowHeight() + private function readDefaultRowHeight() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; option flags // offset: 2; size: 2; default height for unused rows, (twips 1/20 point) - $height = self::_GetInt2d($recordData, 2); - $this->_phpSheet->getDefaultRowDimension()->setRowHeight($height / 20); + $height = self::getInt2d($recordData, 2); + $this->phpSheet->getDefaultRowDimension()->setRowHeight($height / 20); } /** * Read SHEETPR record */ - private function _readSheetPr() + private function readSheetPr() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2 // bit: 6; mask: 0x0040; 0 = outline buttons above outline group - $isSummaryBelow = (0x0040 & self::_GetInt2d($recordData, 0)) >> 6; - $this->_phpSheet->setShowSummaryBelow($isSummaryBelow); + $isSummaryBelow = (0x0040 & self::getInt2d($recordData, 0)) >> 6; + $this->phpSheet->setShowSummaryBelow($isSummaryBelow); // bit: 7; mask: 0x0080; 0 = outline buttons left of outline group - $isSummaryRight = (0x0080 & self::_GetInt2d($recordData, 0)) >> 7; - $this->_phpSheet->setShowSummaryRight($isSummaryRight); + $isSummaryRight = (0x0080 & self::getInt2d($recordData, 0)) >> 7; + $this->phpSheet->setShowSummaryRight($isSummaryRight); // bit: 8; mask: 0x100; 0 = scale printout in percent, 1 = fit printout to number of pages // this corresponds to radio button setting in page setup dialog in Excel - $this->_isFitToPages = (bool) ((0x0100 & self::_GetInt2d($recordData, 0)) >> 8); + $this->isFitToPages = (bool) ((0x0100 & self::getInt2d($recordData, 0)) >> 8); } /** * Read HORIZONTALPAGEBREAKS record */ - private function _readHorizontalPageBreaks() + private function readHorizontalPageBreaks() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) { + if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) { // offset: 0; size: 2; number of the following row index structures - $nm = self::_GetInt2d($recordData, 0); + $nm = self::getInt2d($recordData, 0); // offset: 2; size: 6 * $nm; list of $nm row index structures for ($i = 0; $i < $nm; ++$i) { - $r = self::_GetInt2d($recordData, 2 + 6 * $i); - $cf = self::_GetInt2d($recordData, 2 + 6 * $i + 2); - $cl = self::_GetInt2d($recordData, 2 + 6 * $i + 4); + $r = self::getInt2d($recordData, 2 + 6 * $i); + $cf = self::getInt2d($recordData, 2 + 6 * $i + 2); + $cl = self::getInt2d($recordData, 2 + 6 * $i + 4); // not sure why two column indexes are necessary? - $this->_phpSheet->setBreakByColumnAndRow($cf, $r, PHPExcel_Worksheet::BREAK_ROW); + $this->phpSheet->setBreakByColumnAndRow($cf, $r, PHPExcel_Worksheet::BREAK_ROW); } } } @@ -3143,26 +3133,26 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read VERTICALPAGEBREAKS record */ - private function _readVerticalPageBreaks() + private function readVerticalPageBreaks() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) { + if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) { // offset: 0; size: 2; number of the following column index structures - $nm = self::_GetInt2d($recordData, 0); + $nm = self::getInt2d($recordData, 0); // offset: 2; size: 6 * $nm; list of $nm row index structures for ($i = 0; $i < $nm; ++$i) { - $c = self::_GetInt2d($recordData, 2 + 6 * $i); - $rf = self::_GetInt2d($recordData, 2 + 6 * $i + 2); - $rl = self::_GetInt2d($recordData, 2 + 6 * $i + 4); + $c = self::getInt2d($recordData, 2 + 6 * $i); + $rf = self::getInt2d($recordData, 2 + 6 * $i + 2); + $rl = self::getInt2d($recordData, 2 + 6 * $i + 4); // not sure why two row indexes are necessary? - $this->_phpSheet->setBreakByColumnAndRow($c, $rf, PHPExcel_Worksheet::BREAK_COLUMN); + $this->phpSheet->setBreakByColumnAndRow($c, $rf, PHPExcel_Worksheet::BREAK_COLUMN); } } } @@ -3171,26 +3161,26 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read HEADER record */ - private function _readHeader() + private function readHeader() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: var // realized that $recordData can be empty even when record exists if ($recordData) { - if ($this->_version == self::XLS_BIFF8) { - $string = self::_readUnicodeStringLong($recordData); + if ($this->version == self::XLS_BIFF8) { + $string = self::readUnicodeStringLong($recordData); } else { - $string = $this->_readByteStringShort($recordData); + $string = $this->readByteStringShort($recordData); } - $this->_phpSheet->getHeaderFooter()->setOddHeader($string['value']); - $this->_phpSheet->getHeaderFooter()->setEvenHeader($string['value']); + $this->phpSheet->getHeaderFooter()->setOddHeader($string['value']); + $this->phpSheet->getHeaderFooter()->setEvenHeader($string['value']); } } } @@ -3199,25 +3189,25 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read FOOTER record */ - private function _readFooter() + private function readFooter() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: var // realized that $recordData can be empty even when record exists if ($recordData) { - if ($this->_version == self::XLS_BIFF8) { - $string = self::_readUnicodeStringLong($recordData); + if ($this->version == self::XLS_BIFF8) { + $string = self::readUnicodeStringLong($recordData); } else { - $string = $this->_readByteStringShort($recordData); + $string = $this->readByteStringShort($recordData); } - $this->_phpSheet->getHeaderFooter()->setOddFooter($string['value']); - $this->_phpSheet->getHeaderFooter()->setEvenFooter($string['value']); + $this->phpSheet->getHeaderFooter()->setOddFooter($string['value']); + $this->phpSheet->getHeaderFooter()->setEvenFooter($string['value']); } } } @@ -3226,19 +3216,19 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read HCENTER record */ - private function _readHcenter() + private function readHcenter() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 2; 0 = print sheet left aligned, 1 = print sheet centered horizontally - $isHorizontalCentered = (bool) self::_GetInt2d($recordData, 0); + $isHorizontalCentered = (bool) self::getInt2d($recordData, 0); - $this->_phpSheet->getPageSetup()->setHorizontalCentered($isHorizontalCentered); + $this->phpSheet->getPageSetup()->setHorizontalCentered($isHorizontalCentered); } } @@ -3246,19 +3236,19 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read VCENTER record */ - private function _readVcenter() + private function readVcenter() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 2; 0 = print sheet aligned at top page border, 1 = print sheet vertically centered - $isVerticalCentered = (bool) self::_GetInt2d($recordData, 0); + $isVerticalCentered = (bool) self::getInt2d($recordData, 0); - $this->_phpSheet->getPageSetup()->setVerticalCentered($isVerticalCentered); + $this->phpSheet->getPageSetup()->setVerticalCentered($isVerticalCentered); } } @@ -3266,17 +3256,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read LEFTMARGIN record */ - private function _readLeftMargin() + private function readLeftMargin() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 8 - $this->_phpSheet->getPageMargins()->setLeft(self::_extractNumber($recordData)); + $this->phpSheet->getPageMargins()->setLeft(self::extractNumber($recordData)); } } @@ -3284,17 +3274,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read RIGHTMARGIN record */ - private function _readRightMargin() + private function readRightMargin() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 8 - $this->_phpSheet->getPageMargins()->setRight(self::_extractNumber($recordData)); + $this->phpSheet->getPageMargins()->setRight(self::extractNumber($recordData)); } } @@ -3302,17 +3292,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read TOPMARGIN record */ - private function _readTopMargin() + private function readTopMargin() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 8 - $this->_phpSheet->getPageMargins()->setTop(self::_extractNumber($recordData)); + $this->phpSheet->getPageMargins()->setTop(self::extractNumber($recordData)); } } @@ -3320,17 +3310,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read BOTTOMMARGIN record */ - private function _readBottomMargin() + private function readBottomMargin() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 8 - $this->_phpSheet->getPageMargins()->setBottom(self::_extractNumber($recordData)); + $this->phpSheet->getPageMargins()->setBottom(self::extractNumber($recordData)); } } @@ -3338,60 +3328,60 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read PAGESETUP record */ - private function _readPageSetup() + private function readPageSetup() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 2; paper size - $paperSize = self::_GetInt2d($recordData, 0); + $paperSize = self::getInt2d($recordData, 0); // offset: 2; size: 2; scaling factor - $scale = self::_GetInt2d($recordData, 2); + $scale = self::getInt2d($recordData, 2); // offset: 6; size: 2; fit worksheet width to this number of pages, 0 = use as many as needed - $fitToWidth = self::_GetInt2d($recordData, 6); + $fitToWidth = self::getInt2d($recordData, 6); // offset: 8; size: 2; fit worksheet height to this number of pages, 0 = use as many as needed - $fitToHeight = self::_GetInt2d($recordData, 8); + $fitToHeight = self::getInt2d($recordData, 8); // offset: 10; size: 2; option flags // bit: 1; mask: 0x0002; 0=landscape, 1=portrait - $isPortrait = (0x0002 & self::_GetInt2d($recordData, 10)) >> 1; + $isPortrait = (0x0002 & self::getInt2d($recordData, 10)) >> 1; // bit: 2; mask: 0x0004; 1= paper size, scaling factor, paper orient. not init // when this bit is set, do not use flags for those properties - $isNotInit = (0x0004 & self::_GetInt2d($recordData, 10)) >> 2; + $isNotInit = (0x0004 & self::getInt2d($recordData, 10)) >> 2; if (!$isNotInit) { - $this->_phpSheet->getPageSetup()->setPaperSize($paperSize); + $this->phpSheet->getPageSetup()->setPaperSize($paperSize); switch ($isPortrait) { case 0: - $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); + $this->phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); break; case 1: - $this->_phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT); + $this->phpSheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT); break; } - $this->_phpSheet->getPageSetup()->setScale($scale, false); - $this->_phpSheet->getPageSetup()->setFitToPage((bool) $this->_isFitToPages); - $this->_phpSheet->getPageSetup()->setFitToWidth($fitToWidth, false); - $this->_phpSheet->getPageSetup()->setFitToHeight($fitToHeight, false); + $this->phpSheet->getPageSetup()->setScale($scale, false); + $this->phpSheet->getPageSetup()->setFitToPage((bool) $this->isFitToPages); + $this->phpSheet->getPageSetup()->setFitToWidth($fitToWidth, false); + $this->phpSheet->getPageSetup()->setFitToHeight($fitToHeight, false); } // offset: 16; size: 8; header margin (IEEE 754 floating-point value) - $marginHeader = self::_extractNumber(substr($recordData, 16, 8)); - $this->_phpSheet->getPageMargins()->setHeader($marginHeader); + $marginHeader = self::extractNumber(substr($recordData, 16, 8)); + $this->phpSheet->getPageMargins()->setHeader($marginHeader); // offset: 24; size: 8; footer margin (IEEE 754 floating-point value) - $marginFooter = self::_extractNumber(substr($recordData, 24, 8)); - $this->_phpSheet->getPageMargins()->setFooter($marginFooter); + $marginFooter = self::extractNumber(substr($recordData, 24, 8)); + $this->phpSheet->getPageMargins()->setFooter($marginFooter); } } @@ -3400,89 +3390,89 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * PROTECT - Sheet protection (BIFF2 through BIFF8) * if this record is omitted, then it also means no sheet protection */ - private function _readProtect() + private function readProtect() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if ($this->_readDataOnly) { + if ($this->readDataOnly) { return; } // offset: 0; size: 2; // bit 0, mask 0x01; 1 = sheet is protected - $bool = (0x01 & self::_GetInt2d($recordData, 0)) >> 0; - $this->_phpSheet->getProtection()->setSheet((bool)$bool); + $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0; + $this->phpSheet->getProtection()->setSheet((bool)$bool); } /** * SCENPROTECT */ - private function _readScenProtect() + private function readScenProtect() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if ($this->_readDataOnly) { + if ($this->readDataOnly) { return; } // offset: 0; size: 2; // bit: 0, mask 0x01; 1 = scenarios are protected - $bool = (0x01 & self::_GetInt2d($recordData, 0)) >> 0; + $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0; - $this->_phpSheet->getProtection()->setScenarios((bool)$bool); + $this->phpSheet->getProtection()->setScenarios((bool)$bool); } /** * OBJECTPROTECT */ - private function _readObjectProtect() + private function readObjectProtect() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if ($this->_readDataOnly) { + if ($this->readDataOnly) { return; } // offset: 0; size: 2; // bit: 0, mask 0x01; 1 = objects are protected - $bool = (0x01 & self::_GetInt2d($recordData, 0)) >> 0; + $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0; - $this->_phpSheet->getProtection()->setObjects((bool)$bool); + $this->phpSheet->getProtection()->setObjects((bool)$bool); } /** * PASSWORD - Sheet protection (hashed) password (BIFF2 through BIFF8) */ - private function _readPassword() + private function readPassword() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 2; 16-bit hash value of password - $password = strtoupper(dechex(self::_GetInt2d($recordData, 0))); // the hashed password - $this->_phpSheet->getProtection()->setPassword($password, true); + $password = strtoupper(dechex(self::getInt2d($recordData, 0))); // the hashed password + $this->phpSheet->getProtection()->setPassword($password, true); } } @@ -3490,18 +3480,18 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read DEFCOLWIDTH record */ - private function _readDefColWidth() + private function readDefColWidth() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; default column width - $width = self::_GetInt2d($recordData, 0); + $width = self::getInt2d($recordData, 0); if ($width != 8) { - $this->_phpSheet->getDefaultColumnDimension()->setWidth($width); + $this->phpSheet->getDefaultColumnDimension()->setWidth($width); } } @@ -3509,49 +3499,49 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read COLINFO record */ - private function _readColInfo() + private function readColInfo() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 2; index to first column in range - $fc = self::_GetInt2d($recordData, 0); // first column index + $fc = self::getInt2d($recordData, 0); // first column index // offset: 2; size: 2; index to last column in range - $lc = self::_GetInt2d($recordData, 2); // first column index + $lc = self::getInt2d($recordData, 2); // first column index // offset: 4; size: 2; width of the column in 1/256 of the width of the zero character - $width = self::_GetInt2d($recordData, 4); + $width = self::getInt2d($recordData, 4); // offset: 6; size: 2; index to XF record for default column formatting - $xfIndex = self::_GetInt2d($recordData, 6); + $xfIndex = self::getInt2d($recordData, 6); // offset: 8; size: 2; option flags // bit: 0; mask: 0x0001; 1= columns are hidden - $isHidden = (0x0001 & self::_GetInt2d($recordData, 8)) >> 0; + $isHidden = (0x0001 & self::getInt2d($recordData, 8)) >> 0; // bit: 10-8; mask: 0x0700; outline level of the columns (0 = no outline) - $level = (0x0700 & self::_GetInt2d($recordData, 8)) >> 8; + $level = (0x0700 & self::getInt2d($recordData, 8)) >> 8; // bit: 12; mask: 0x1000; 1 = collapsed - $isCollapsed = (0x1000 & self::_GetInt2d($recordData, 8)) >> 12; + $isCollapsed = (0x1000 & self::getInt2d($recordData, 8)) >> 12; // offset: 10; size: 2; not used for ($i = $fc; $i <= $lc; ++$i) { if ($lc == 255 || $lc == 256) { - $this->_phpSheet->getDefaultColumnDimension()->setWidth($width / 256); + $this->phpSheet->getDefaultColumnDimension()->setWidth($width / 256); break; } - $this->_phpSheet->getColumnDimensionByColumn($i)->setWidth($width / 256); - $this->_phpSheet->getColumnDimensionByColumn($i)->setVisible(!$isHidden); - $this->_phpSheet->getColumnDimensionByColumn($i)->setOutlineLevel($level); - $this->_phpSheet->getColumnDimensionByColumn($i)->setCollapsed($isCollapsed); - $this->_phpSheet->getColumnDimensionByColumn($i)->setXfIndex($this->_mapCellXfIndex[$xfIndex]); + $this->phpSheet->getColumnDimensionByColumn($i)->setWidth($width / 256); + $this->phpSheet->getColumnDimensionByColumn($i)->setVisible(!$isHidden); + $this->phpSheet->getColumnDimensionByColumn($i)->setOutlineLevel($level); + $this->phpSheet->getColumnDimensionByColumn($i)->setCollapsed($isCollapsed); + $this->phpSheet->getColumnDimensionByColumn($i)->setXfIndex($this->mapCellXfIndex[$xfIndex]); } } } @@ -3567,17 +3557,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readRow() + private function readRow() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 2; index of this row - $r = self::_GetInt2d($recordData, 0); + $r = self::getInt2d($recordData, 0); // offset: 2; size: 2; index to column of the first cell which is described by a cell record @@ -3586,13 +3576,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 6; size: 2; // bit: 14-0; mask: 0x7FFF; height of the row, in twips = 1/20 of a point - $height = (0x7FFF & self::_GetInt2d($recordData, 6)) >> 0; + $height = (0x7FFF & self::getInt2d($recordData, 6)) >> 0; // bit: 15: mask: 0x8000; 0 = row has custom height; 1= row has default height - $useDefaultHeight = (0x8000 & self::_GetInt2d($recordData, 6)) >> 15; + $useDefaultHeight = (0x8000 & self::getInt2d($recordData, 6)) >> 15; if (!$useDefaultHeight) { - $this->_phpSheet->getRowDimension($r + 1)->setRowHeight($height / 20); + $this->phpSheet->getRowDimension($r + 1)->setRowHeight($height / 20); } // offset: 8; size: 2; not used @@ -3602,25 +3592,25 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 12; size: 4; option flags and default row formatting // bit: 2-0: mask: 0x00000007; outline level of the row - $level = (0x00000007 & self::_GetInt4d($recordData, 12)) >> 0; - $this->_phpSheet->getRowDimension($r + 1)->setOutlineLevel($level); + $level = (0x00000007 & self::getInt4d($recordData, 12)) >> 0; + $this->phpSheet->getRowDimension($r + 1)->setOutlineLevel($level); // bit: 4; mask: 0x00000010; 1 = outline group start or ends here... and is collapsed - $isCollapsed = (0x00000010 & self::_GetInt4d($recordData, 12)) >> 4; - $this->_phpSheet->getRowDimension($r + 1)->setCollapsed($isCollapsed); + $isCollapsed = (0x00000010 & self::getInt4d($recordData, 12)) >> 4; + $this->phpSheet->getRowDimension($r + 1)->setCollapsed($isCollapsed); // bit: 5; mask: 0x00000020; 1 = row is hidden - $isHidden = (0x00000020 & self::_GetInt4d($recordData, 12)) >> 5; - $this->_phpSheet->getRowDimension($r + 1)->setVisible(!$isHidden); + $isHidden = (0x00000020 & self::getInt4d($recordData, 12)) >> 5; + $this->phpSheet->getRowDimension($r + 1)->setVisible(!$isHidden); // bit: 7; mask: 0x00000080; 1 = row has explicit format - $hasExplicitFormat = (0x00000080 & self::_GetInt4d($recordData, 12)) >> 7; + $hasExplicitFormat = (0x00000080 & self::getInt4d($recordData, 12)) >> 7; // bit: 27-16; mask: 0x0FFF0000; only applies when hasExplicitFormat = 1; index to XF record - $xfIndex = (0x0FFF0000 & self::_GetInt4d($recordData, 12)) >> 16; + $xfIndex = (0x0FFF0000 & self::getInt4d($recordData, 12)) >> 16; if ($hasExplicitFormat) { - $this->_phpSheet->getRowDimension($r + 1)->setXfIndex($this->_mapCellXfIndex[$xfIndex]); + $this->phpSheet->getRowDimension($r + 1)->setXfIndex($this->mapCellXfIndex[$xfIndex]); } } } @@ -3637,34 +3627,34 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readRk() + private function readRk() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; index to row - $row = self::_GetInt2d($recordData, 0); + $row = self::getInt2d($recordData, 0); // offset: 2; size: 2; index to column - $column = self::_GetInt2d($recordData, 2); + $column = self::getInt2d($recordData, 2); $columnString = PHPExcel_Cell::stringFromColumnIndex($column); // Read cell? - if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { // offset: 4; size: 2; index to XF record - $xfIndex = self::_GetInt2d($recordData, 4); + $xfIndex = self::getInt2d($recordData, 4); // offset: 6; size: 4; RK value - $rknum = self::_GetInt4d($recordData, 6); - $numValue = self::_GetIEEE754($rknum); + $rknum = self::getInt4d($recordData, 6); + $numValue = self::getIEEE754($rknum); - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); - if (!$this->_readDataOnly) { + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); + if (!$this->readDataOnly) { // add style information - $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); + $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]); } // add cell @@ -3682,41 +3672,41 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readLabelSst() + private function readLabelSst() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; index to row - $row = self::_GetInt2d($recordData, 0); + $row = self::getInt2d($recordData, 0); // offset: 2; size: 2; index to column - $column = self::_GetInt2d($recordData, 2); + $column = self::getInt2d($recordData, 2); $columnString = PHPExcel_Cell::stringFromColumnIndex($column); // Read cell? - if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { // offset: 4; size: 2; index to XF record - $xfIndex = self::_GetInt2d($recordData, 4); + $xfIndex = self::getInt2d($recordData, 4); // offset: 6; size: 4; index to SST record - $index = self::_GetInt4d($recordData, 6); + $index = self::getInt4d($recordData, 6); // add cell - if (($fmtRuns = $this->_sst[$index]['fmtRuns']) && !$this->_readDataOnly) { + if (($fmtRuns = $this->sst[$index]['fmtRuns']) && !$this->readDataOnly) { // then we should treat as rich text $richText = new PHPExcel_RichText(); $charPos = 0; - $sstCount = count($this->_sst[$index]['fmtRuns']); + $sstCount = count($this->sst[$index]['fmtRuns']); for ($i = 0; $i <= $sstCount; ++$i) { if (isset($fmtRuns[$i])) { - $text = PHPExcel_Shared_String::Substring($this->_sst[$index]['value'], $charPos, $fmtRuns[$i]['charPos'] - $charPos); + $text = PHPExcel_Shared_String::Substring($this->sst[$index]['value'], $charPos, $fmtRuns[$i]['charPos'] - $charPos); $charPos = $fmtRuns[$i]['charPos']; } else { - $text = PHPExcel_Shared_String::Substring($this->_sst[$index]['value'], $charPos, PHPExcel_Shared_String::CountCharacters($this->_sst[$index]['value'])); + $text = PHPExcel_Shared_String::Substring($this->sst[$index]['value'], $charPos, PHPExcel_Shared_String::CountCharacters($this->sst[$index]['value'])); } if (PHPExcel_Shared_String::CountCharacters($text) > 0) { @@ -3732,21 +3722,21 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // check the OpenOffice documentation of the FONT record $fontIndex = $fmtRuns[$i - 1]['fontIndex'] - 1; } - $textRun->setFont(clone $this->_objFonts[$fontIndex]); + $textRun->setFont(clone $this->objFonts[$fontIndex]); } } } } - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); $cell->setValueExplicit($richText, PHPExcel_Cell_DataType::TYPE_STRING); } else { - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); - $cell->setValueExplicit($this->_sst[$index]['value'], PHPExcel_Cell_DataType::TYPE_STRING); + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); + $cell->setValueExplicit($this->sst[$index]['value'], PHPExcel_Cell_DataType::TYPE_STRING); } - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // add style information - $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); + $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]); } } } @@ -3760,22 +3750,22 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readMulRk() + private function readMulRk() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; index to row - $row = self::_GetInt2d($recordData, 0); + $row = self::getInt2d($recordData, 0); // offset: 2; size: 2; index to first column - $colFirst = self::_GetInt2d($recordData, 2); + $colFirst = self::getInt2d($recordData, 2); // offset: var; size: 2; index to last column - $colLast = self::_GetInt2d($recordData, $length - 2); + $colLast = self::getInt2d($recordData, $length - 2); $columns = $colLast - $colFirst + 1; // offset within record data @@ -3785,16 +3775,16 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $columnString = PHPExcel_Cell::stringFromColumnIndex($colFirst + $i); // Read cell? - if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { // offset: var; size: 2; index to XF record - $xfIndex = self::_GetInt2d($recordData, $offset); + $xfIndex = self::getInt2d($recordData, $offset); // offset: var; size: 4; RK value - $numValue = self::_GetIEEE754(self::_GetInt4d($recordData, $offset + 2)); - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); - if (!$this->_readDataOnly) { + $numValue = self::getIEEE754(self::getInt4d($recordData, $offset + 2)); + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); + if (!$this->readDataOnly) { // add style - $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); + $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]); } // add cell value @@ -3814,32 +3804,32 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readNumber() + private function readNumber() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; index to row - $row = self::_GetInt2d($recordData, 0); + $row = self::getInt2d($recordData, 0); // offset: 2; size 2; index to column - $column = self::_GetInt2d($recordData, 2); + $column = self::getInt2d($recordData, 2); $columnString = PHPExcel_Cell::stringFromColumnIndex($column); // Read cell? - if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { // offset 4; size: 2; index to XF record - $xfIndex = self::_GetInt2d($recordData, 4); + $xfIndex = self::getInt2d($recordData, 4); - $numValue = self::_extractNumber(substr($recordData, 6, 8)); + $numValue = self::extractNumber(substr($recordData, 6, 8)); - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); - if (!$this->_readDataOnly) { + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); + if (!$this->readDataOnly) { // add cell style - $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); + $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]); } // add cell value @@ -3856,26 +3846,26 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readFormula() + private function readFormula() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; row index - $row = self::_GetInt2d($recordData, 0); + $row = self::getInt2d($recordData, 0); // offset: 2; size: 2; col index - $column = self::_GetInt2d($recordData, 2); + $column = self::getInt2d($recordData, 2); $columnString = PHPExcel_Cell::stringFromColumnIndex($column); // offset: 20: size: variable; formula structure $formulaStructure = substr($recordData, 20); // offset: 14: size: 2; option flags, recalculate always, recalculate on open etc. - $options = self::_GetInt2d($recordData, 14); + $options = self::getInt2d($recordData, 14); // bit: 0; mask: 0x0001; 1 = recalculate always // bit: 1; mask: 0x0002; 1 = calculate on open @@ -3891,22 +3881,22 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce if ($isPartOfSharedFormula) { // part of shared formula which means there will be a formula with a tExp token and nothing else // get the base cell, grab tExp token - $baseRow = self::_GetInt2d($formulaStructure, 3); - $baseCol = self::_GetInt2d($formulaStructure, 5); + $baseRow = self::getInt2d($formulaStructure, 3); + $baseCol = self::getInt2d($formulaStructure, 5); $this->_baseCell = PHPExcel_Cell::stringFromColumnIndex($baseCol). ($baseRow + 1); } // Read cell? - if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { if ($isPartOfSharedFormula) { // formula is added to this cell after the sheet has been read - $this->_sharedFormulaParts[$columnString . ($row + 1)] = $this->_baseCell; + $this->sharedFormulaParts[$columnString . ($row + 1)] = $this->_baseCell; } // offset: 16: size: 4; not used // offset: 4; size: 2; XF index - $xfIndex = self::_GetInt2d($recordData, 4); + $xfIndex = self::getInt2d($recordData, 4); // offset: 6; size: 8; result of the formula if ((ord($recordData{6}) == 0) && (ord($recordData{12}) == 255) && (ord($recordData{13}) == 255)) { @@ -3914,13 +3904,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $dataType = PHPExcel_Cell_DataType::TYPE_STRING; // read possible SHAREDFMLA record - $code = self::_GetInt2d($this->_data, $this->_pos); + $code = self::getInt2d($this->data, $this->pos); if ($code == self::XLS_Type_SHAREDFMLA) { - $this->_readSharedFmla(); + $this->readSharedFmla(); } // read STRING record - $value = $this->_readString(); + $value = $this->readString(); } elseif ((ord($recordData{6}) == 1) && (ord($recordData{12}) == 255) && (ord($recordData{13}) == 255)) { @@ -3932,7 +3922,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce && (ord($recordData{13}) == 255)) { // Error formula. Error code is in +2 $dataType = PHPExcel_Cell_DataType::TYPE_ERROR; - $value = self::_mapErrorCode(ord($recordData{8})); + $value = self::mapErrorCode(ord($recordData{8})); } elseif ((ord($recordData{6}) == 3) && (ord($recordData{12}) == 255) && (ord($recordData{13}) == 255)) { @@ -3942,13 +3932,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } else { // forumla result is a number, first 14 bytes like _NUMBER record $dataType = PHPExcel_Cell_DataType::TYPE_NUMERIC; - $value = self::_extractNumber(substr($recordData, 6, 8)); + $value = self::extractNumber(substr($recordData, 6, 8)); } - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); - if (!$this->_readDataOnly) { + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); + if (!$this->readDataOnly) { // add cell style - $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); + $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]); } // store the formula @@ -3956,17 +3946,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // not part of shared formula // add cell value. If we can read formula, populate with formula, otherwise just used cached value try { - if ($this->_version != self::XLS_BIFF8) { + if ($this->version != self::XLS_BIFF8) { throw new PHPExcel_Reader_Exception('Not BIFF8. Can only read BIFF8 formulas'); } - $formula = $this->_getFormulaFromStructure($formulaStructure); // get formula in human language + $formula = $this->getFormulaFromStructure($formulaStructure); // get formula in human language $cell->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA); } catch (PHPExcel_Exception $e) { $cell->setValueExplicit($value, $dataType); } } else { - if ($this->_version == self::XLS_BIFF8) { + if ($this->version == self::XLS_BIFF8) { // do nothing at this point, formula id added later in the code } else { $cell->setValueExplicit($value, $dataType); @@ -3984,17 +3974,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * which usually contains relative references. * These will be used to construct the formula in each shared formula part after the sheet is read. */ - private function _readSharedFmla() + private function readSharedFmla() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0, size: 6; cell range address of the area used by the shared formula, not used for anything $cellRange = substr($recordData, 0, 6); - $cellRange = $this->_readBIFF5CellRangeAddressFixed($cellRange); // note: even BIFF8 uses BIFF5 syntax + $cellRange = $this->readBIFF5CellRangeAddressFixed($cellRange); // note: even BIFF8 uses BIFF5 syntax // offset: 6, size: 1; not used @@ -4005,7 +3995,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $formula = substr($recordData, 8); // at this point we only store the shared formula for later use - $this->_sharedFormulas[$this->_baseCell] = $formula; + $this->sharedFormulas[$this->_baseCell] = $formula; } @@ -4016,19 +4006,19 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * * @return string The string contents as UTF-8 */ - private function _readString() + private function readString() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if ($this->_version == self::XLS_BIFF8) { - $string = self::_readUnicodeStringLong($recordData); + if ($this->version == self::XLS_BIFF8) { + $string = self::readUnicodeStringLong($recordData); $value = $string['value']; } else { - $string = $this->_readByteStringLong($recordData); + $string = $this->readByteStringLong($recordData); $value = $string['value']; } @@ -4044,25 +4034,25 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readBoolErr() + private function readBoolErr() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; row index - $row = self::_GetInt2d($recordData, 0); + $row = self::getInt2d($recordData, 0); // offset: 2; size: 2; column index - $column = self::_GetInt2d($recordData, 2); + $column = self::getInt2d($recordData, 2); $columnString = PHPExcel_Cell::stringFromColumnIndex($column); // Read cell? - if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { // offset: 4; size: 2; index to XF record - $xfIndex = self::_GetInt2d($recordData, 4); + $xfIndex = self::getInt2d($recordData, 4); // offset: 6; size: 1; the boolean value or error value $boolErr = ord($recordData{6}); @@ -4070,7 +4060,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 7; size: 1; 0=boolean; 1=error $isError = ord($recordData{7}); - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); switch ($isError) { case 0: // boolean $value = (bool) $boolErr; @@ -4079,16 +4069,16 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_BOOL); break; case 1: // error type - $value = self::_mapErrorCode($boolErr); + $value = self::mapErrorCode($boolErr); // add cell value $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_ERROR); break; } - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // add cell style - $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); + $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]); } } } @@ -4102,30 +4092,30 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readMulBlank() + private function readMulBlank() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; index to row - $row = self::_GetInt2d($recordData, 0); + $row = self::getInt2d($recordData, 0); // offset: 2; size: 2; index to first column - $fc = self::_GetInt2d($recordData, 2); + $fc = self::getInt2d($recordData, 2); // offset: 4; size: 2 x nc; list of indexes to XF records // add style information - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { for ($i = 0; $i < $length / 2 - 3; ++$i) { $columnString = PHPExcel_Cell::stringFromColumnIndex($fc + $i); // Read cell? - if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { - $xfIndex = self::_GetInt2d($recordData, 4 + 2 * $i); - $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfIndex]); + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { + $xfIndex = self::getInt2d($recordData, 4 + 2 * $i); + $this->phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->mapCellXfIndex[$xfIndex]); } } } @@ -4144,41 +4134,41 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readLabel() + private function readLabel() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; index to row - $row = self::_GetInt2d($recordData, 0); + $row = self::getInt2d($recordData, 0); // offset: 2; size: 2; index to column - $column = self::_GetInt2d($recordData, 2); + $column = self::getInt2d($recordData, 2); $columnString = PHPExcel_Cell::stringFromColumnIndex($column); // Read cell? - if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { // offset: 4; size: 2; XF index - $xfIndex = self::_GetInt2d($recordData, 4); + $xfIndex = self::getInt2d($recordData, 4); // add cell value // todo: what if string is very long? continue record - if ($this->_version == self::XLS_BIFF8) { - $string = self::_readUnicodeStringLong(substr($recordData, 6)); + if ($this->version == self::XLS_BIFF8) { + $string = self::readUnicodeStringLong(substr($recordData, 6)); $value = $string['value']; } else { - $string = $this->_readByteStringLong(substr($recordData, 6)); + $string = $this->readByteStringLong(substr($recordData, 6)); $value = $string['value']; } - $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING); - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // add cell style - $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); + $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]); } } } @@ -4187,29 +4177,29 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read BLANK record */ - private function _readBlank() + private function readBlank() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; row index - $row = self::_GetInt2d($recordData, 0); + $row = self::getInt2d($recordData, 0); // offset: 2; size: 2; col index - $col = self::_GetInt2d($recordData, 2); + $col = self::getInt2d($recordData, 2); $columnString = PHPExcel_Cell::stringFromColumnIndex($col); // Read cell? - if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { // offset: 4; size: 2; XF index - $xfIndex = self::_GetInt2d($recordData, 4); + $xfIndex = self::getInt2d($recordData, 4); // add style information - if (!$this->_readDataOnly) { - $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfIndex]); + if (!$this->readDataOnly) { + $this->phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->mapCellXfIndex[$xfIndex]); } } @@ -4219,30 +4209,30 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read MSODRAWING record */ - private function _readMsoDrawing() + private function readMsoDrawing() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); + $length = self::getInt2d($this->data, $this->pos + 2); // get spliced record data - $splicedRecordData = $this->_getSplicedRecordData(); + $splicedRecordData = $this->getSplicedRecordData(); $recordData = $splicedRecordData['recordData']; - $this->_drawingData .= $recordData; + $this->drawingData .= $recordData; } /** * Read OBJ record */ - private function _readObj() + private function readObj() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if ($this->_readDataOnly || $this->_version != self::XLS_BIFF8) { + if ($this->readDataOnly || $this->version != self::XLS_BIFF8) { return; } @@ -4255,13 +4245,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // data: var; subrecord data // for now, we are just interested in the second subrecord containing the object type - $ftCmoType = self::_GetInt2d($recordData, 0); - $cbCmoSize = self::_GetInt2d($recordData, 2); - $otObjType = self::_GetInt2d($recordData, 4); - $idObjID = self::_GetInt2d($recordData, 6); - $grbitOpts = self::_GetInt2d($recordData, 6); + $ftCmoType = self::getInt2d($recordData, 0); + $cbCmoSize = self::getInt2d($recordData, 2); + $otObjType = self::getInt2d($recordData, 4); + $idObjID = self::getInt2d($recordData, 6); + $grbitOpts = self::getInt2d($recordData, 6); - $this->_objs[] = array( + $this->objs[] = array( 'ftCmoType' => $ftCmoType, 'cbCmoSize' => $cbCmoSize, 'otObjType' => $otObjType, @@ -4271,7 +4261,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $this->textObjRef = $idObjID; // echo '_readObj()
'; -// var_dump(end($this->_objs)); +// var_dump(end($this->objs)); // echo '
'; } @@ -4279,32 +4269,32 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read WINDOW2 record */ - private function _readWindow2() + private function readWindow2() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; option flags - $options = self::_GetInt2d($recordData, 0); + $options = self::getInt2d($recordData, 0); // offset: 2; size: 2; index to first visible row - $firstVisibleRow = self::_GetInt2d($recordData, 2); + $firstVisibleRow = self::getInt2d($recordData, 2); // offset: 4; size: 2; index to first visible colum - $firstVisibleColumn = self::_GetInt2d($recordData, 4); - if ($this->_version === self::XLS_BIFF8) { + $firstVisibleColumn = self::getInt2d($recordData, 4); + if ($this->version === self::XLS_BIFF8) { // offset: 8; size: 2; not used // offset: 10; size: 2; cached magnification factor in page break preview (in percent); 0 = Default (60%) // offset: 12; size: 2; cached magnification factor in normal view (in percent); 0 = Default (100%) // offset: 14; size: 4; not used - $zoomscaleInPageBreakPreview = self::_GetInt2d($recordData, 10); + $zoomscaleInPageBreakPreview = self::getInt2d($recordData, 10); if ($zoomscaleInPageBreakPreview === 0) { $zoomscaleInPageBreakPreview = 60; } - $zoomscaleInNormalView = self::_GetInt2d($recordData, 12); + $zoomscaleInNormalView = self::getInt2d($recordData, 12); if ($zoomscaleInNormalView === 0) { $zoomscaleInNormalView = 100; } @@ -4312,22 +4302,22 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // bit: 1; mask: 0x0002; 0 = do not show gridlines, 1 = show gridlines $showGridlines = (bool) ((0x0002 & $options) >> 1); - $this->_phpSheet->setShowGridlines($showGridlines); + $this->phpSheet->setShowGridlines($showGridlines); // bit: 2; mask: 0x0004; 0 = do not show headers, 1 = show headers $showRowColHeaders = (bool) ((0x0004 & $options) >> 2); - $this->_phpSheet->setShowRowColHeaders($showRowColHeaders); + $this->phpSheet->setShowRowColHeaders($showRowColHeaders); // bit: 3; mask: 0x0008; 0 = panes are not frozen, 1 = panes are frozen - $this->_frozen = (bool) ((0x0008 & $options) >> 3); + $this->frozen = (bool) ((0x0008 & $options) >> 3); // bit: 6; mask: 0x0040; 0 = columns from left to right, 1 = columns from right to left - $this->_phpSheet->setRightToLeft((bool)((0x0040 & $options) >> 6)); + $this->phpSheet->setRightToLeft((bool)((0x0040 & $options) >> 6)); // bit: 10; mask: 0x0400; 0 = sheet not active, 1 = sheet active $isActive = (bool) ((0x0400 & $options) >> 10); if ($isActive) { - $this->_phpExcel->setActiveSheetIndex($this->_phpExcel->getIndex($this->_phpSheet)); + $this->phpExcel->setActiveSheetIndex($this->phpExcel->getIndex($this->phpSheet)); } // bit: 11; mask: 0x0800; 0 = normal view, 1 = page break view @@ -4335,14 +4325,14 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce //FIXME: set $firstVisibleRow and $firstVisibleColumn - if ($this->_phpSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT) { + if ($this->phpSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT) { //NOTE: this setting is inferior to page layout view(Excel2007-) $view = $isPageBreakPreview ? PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW : PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL; - $this->_phpSheet->getSheetView()->setView($view); - if ($this->_version === self::XLS_BIFF8) { + $this->phpSheet->getSheetView()->setView($view); + if ($this->version === self::XLS_BIFF8) { $zoomScale = $isPageBreakPreview ? $zoomscaleInPageBreakPreview : $zoomscaleInNormalView; - $this->_phpSheet->getSheetView()->setZoomScale($zoomScale); - $this->_phpSheet->getSheetView()->setZoomScaleNormal($zoomscaleInNormalView); + $this->phpSheet->getSheetView()->setZoomScale($zoomScale); + $this->phpSheet->getSheetView()->setZoomScaleNormal($zoomscaleInNormalView); } } } @@ -4350,29 +4340,29 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read PLV Record(Created by Excel2007 or upper) */ - private function _readPageLayoutView() + private function readPageLayoutView() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; //var_dump(unpack("vrt/vgrbitFrt/V2reserved/vwScalePLV/vgrbit", $recordData)); // offset: 0; size: 2; rt //->ignore - $rt = self::_GetInt2d($recordData, 0); + $rt = self::getInt2d($recordData, 0); // offset: 2; size: 2; grbitfr //->ignore - $grbitFrt = self::_GetInt2d($recordData, 2); + $grbitFrt = self::getInt2d($recordData, 2); // offset: 4; size: 8; reserved //->ignore // offset: 12; size 2; zoom scale - $wScalePLV = self::_GetInt2d($recordData, 12); + $wScalePLV = self::getInt2d($recordData, 12); // offset: 14; size 2; grbit - $grbit = self::_GetInt2d($recordData, 14); + $grbit = self::getInt2d($recordData, 14); // decomprise grbit $fPageLayoutView = $grbit & 0x01; @@ -4380,8 +4370,8 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $fWhitespaceHidden = ($grbit >> 3) & 0x01; //no support if ($fPageLayoutView === 1) { - $this->_phpSheet->getSheetView()->setView(PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT); - $this->_phpSheet->getSheetView()->setZoomScale($wScalePLV); //set by Excel2007 only if SHEETVIEW_PAGE_LAYOUT + $this->phpSheet->getSheetView()->setView(PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT); + $this->phpSheet->getSheetView()->setZoomScale($wScalePLV); //set by Excel2007 only if SHEETVIEW_PAGE_LAYOUT } //otherwise, we cannot know whether SHEETVIEW_PAGE_LAYOUT or SHEETVIEW_PAGE_BREAK_PREVIEW. } @@ -4389,46 +4379,46 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read SCL record */ - private function _readScl() + private function readScl() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // offset: 0; size: 2; numerator of the view magnification - $numerator = self::_GetInt2d($recordData, 0); + $numerator = self::getInt2d($recordData, 0); // offset: 2; size: 2; numerator of the view magnification - $denumerator = self::_GetInt2d($recordData, 2); + $denumerator = self::getInt2d($recordData, 2); // set the zoom scale (in percent) - $this->_phpSheet->getSheetView()->setZoomScale($numerator * 100 / $denumerator); + $this->phpSheet->getSheetView()->setZoomScale($numerator * 100 / $denumerator); } /** * Read PANE record */ - private function _readPane() + private function readPane() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 2; position of vertical split - $px = self::_GetInt2d($recordData, 0); + $px = self::getInt2d($recordData, 0); // offset: 2; size: 2; position of horizontal split - $py = self::_GetInt2d($recordData, 2); + $py = self::getInt2d($recordData, 2); - if ($this->_frozen) { + if ($this->frozen) { // frozen panes - $this->_phpSheet->freezePane(PHPExcel_Cell::stringFromColumnIndex($px) . ($py + 1)); + $this->phpSheet->freezePane(PHPExcel_Cell::stringFromColumnIndex($px) . ($py + 1)); } else { // unfrozen panes; split windows; not supported by PHPExcel core } @@ -4439,31 +4429,31 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read SELECTION record. There is one such record for each pane in the sheet. */ - private function _readSelection() + private function readSelection() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 1; pane identifier $paneId = ord($recordData{0}); // offset: 1; size: 2; index to row of the active cell - $r = self::_GetInt2d($recordData, 1); + $r = self::getInt2d($recordData, 1); // offset: 3; size: 2; index to column of the active cell - $c = self::_GetInt2d($recordData, 3); + $c = self::getInt2d($recordData, 3); // offset: 5; size: 2; index into the following cell range list to the // entry that contains the active cell - $index = self::_GetInt2d($recordData, 5); + $index = self::getInt2d($recordData, 5); // offset: 7; size: var; cell range address list containing all selected cell ranges $data = substr($recordData, 7); - $cellRangeAddressList = $this->_readBIFF5CellRangeAddressList($data); // note: also BIFF8 uses BIFF5 syntax + $cellRangeAddressList = $this->readBIFF5CellRangeAddressList($data); // note: also BIFF8 uses BIFF5 syntax $selectedCells = $cellRangeAddressList['cellRangeAddresses'][0]; @@ -4482,12 +4472,12 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $selectedCells = preg_replace('/^(A[0-9]+\:)IV([0-9]+)$/', '${1}XFD${2}', $selectedCells); } - $this->_phpSheet->setSelectedCells($selectedCells); + $this->phpSheet->setSelectedCells($selectedCells); } } - private function _includeCellRangeFiltered($cellRangeAddress) + private function includeCellRangeFiltered($cellRangeAddress) { $includeCellRange = true; if ($this->getReadFilter() !== null) { @@ -4496,7 +4486,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $rangeBoundaries[1][0]++; for ($row = $rangeBoundaries[0][1]; $row <= $rangeBoundaries[1][1]; $row++) { for ($column = $rangeBoundaries[0][0]; $column != $rangeBoundaries[1][0]; $column++) { - if ($this->getReadFilter()->readCell($column, $row, $this->_phpSheet->getTitle())) { + if ($this->getReadFilter()->readCell($column, $row, $this->phpSheet->getTitle())) { $includeCellRange = true; break 2; } @@ -4516,20 +4506,20 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ - private function _readMergedCells() + private function readMergedCells() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) { - $cellRangeAddressList = $this->_readBIFF8CellRangeAddressList($recordData); + if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) { + $cellRangeAddressList = $this->readBIFF8CellRangeAddressList($recordData); foreach ($cellRangeAddressList['cellRangeAddresses'] as $cellRangeAddress) { if ((strpos($cellRangeAddress, ':') !== false) && - ($this->_includeCellRangeFiltered($cellRangeAddress))) { - $this->_phpSheet->mergeCells($cellRangeAddress); + ($this->includeCellRangeFiltered($cellRangeAddress))) { + $this->phpSheet->mergeCells($cellRangeAddress); } } } @@ -4539,18 +4529,18 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read HYPERLINK record */ - private function _readHyperLink() + private function readHyperLink() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer forward to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 8; cell range address of all cells containing this hyperlink try { - $cellRange = $this->_readBIFF8CellRangeAddressFixed($recordData, 0, 8); + $cellRange = $this->readBIFF8CellRangeAddressFixed($recordData, 0, 8); } catch (PHPExcel_Exception $e) { return; } @@ -4561,35 +4551,35 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 28, size: 4; option flags // bit: 0; mask: 0x00000001; 0 = no link or extant, 1 = file link or URL - $isFileLinkOrUrl = (0x00000001 & self::_GetInt2d($recordData, 28)) >> 0; + $isFileLinkOrUrl = (0x00000001 & self::getInt2d($recordData, 28)) >> 0; // bit: 1; mask: 0x00000002; 0 = relative path, 1 = absolute path or URL - $isAbsPathOrUrl = (0x00000001 & self::_GetInt2d($recordData, 28)) >> 1; + $isAbsPathOrUrl = (0x00000001 & self::getInt2d($recordData, 28)) >> 1; // bit: 2 (and 4); mask: 0x00000014; 0 = no description - $hasDesc = (0x00000014 & self::_GetInt2d($recordData, 28)) >> 2; + $hasDesc = (0x00000014 & self::getInt2d($recordData, 28)) >> 2; // bit: 3; mask: 0x00000008; 0 = no text, 1 = has text - $hasText = (0x00000008 & self::_GetInt2d($recordData, 28)) >> 3; + $hasText = (0x00000008 & self::getInt2d($recordData, 28)) >> 3; // bit: 7; mask: 0x00000080; 0 = no target frame, 1 = has target frame - $hasFrame = (0x00000080 & self::_GetInt2d($recordData, 28)) >> 7; + $hasFrame = (0x00000080 & self::getInt2d($recordData, 28)) >> 7; // bit: 8; mask: 0x00000100; 0 = file link or URL, 1 = UNC path (inc. server name) - $isUNC = (0x00000100 & self::_GetInt2d($recordData, 28)) >> 8; + $isUNC = (0x00000100 & self::getInt2d($recordData, 28)) >> 8; // offset within record data $offset = 32; if ($hasDesc) { // offset: 32; size: var; character count of description text - $dl = self::_GetInt4d($recordData, 32); + $dl = self::getInt4d($recordData, 32); // offset: 36; size: var; character array of description text, no Unicode string header, always 16-bit characters, zero terminated - $desc = self::_encodeUTF16(substr($recordData, 36, 2 * ($dl - 1)), false); + $desc = self::encodeUTF16(substr($recordData, 36, 2 * ($dl - 1)), false); $offset += 4 + 2 * $dl; } if ($hasFrame) { - $fl = self::_GetInt4d($recordData, $offset); + $fl = self::getInt4d($recordData, $offset); $offset += 4 + 2 * $fl; } @@ -4614,10 +4604,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: var; size: 16; GUID of URL Moniker $offset += 16; // offset: var; size: 4; size (in bytes) of character array of the URL including trailing zero word - $us = self::_GetInt4d($recordData, $offset); + $us = self::getInt4d($recordData, $offset); $offset += 4; // offset: var; size: $us; character array of the URL, no Unicode string header, always 16-bit characters, zero-terminated - $url = self::_encodeUTF16(substr($recordData, $offset, $us - 2), false); + $url = self::encodeUTF16(substr($recordData, $offset, $us - 2), false); $nullOffset = strpos($url, 0x00); if ($nullOffset) { $url = substr($url, 0, $nullOffset); @@ -4635,16 +4625,16 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $offset += 16; // offset: var; size: 2; directory up-level count. - $upLevelCount = self::_GetInt2d($recordData, $offset); + $upLevelCount = self::getInt2d($recordData, $offset); $offset += 2; // offset: var; size: 4; character count of the shortened file path and name, including trailing zero word - $sl = self::_GetInt4d($recordData, $offset); + $sl = self::getInt4d($recordData, $offset); $offset += 4; // offset: var; size: sl; character array of the shortened file path and name in 8.3-DOS-format (compressed Unicode string) $shortenedFilePath = substr($recordData, $offset, $sl); - $shortenedFilePath = self::_encodeUTF16($shortenedFilePath, true); + $shortenedFilePath = self::encodeUTF16($shortenedFilePath, true); $shortenedFilePath = substr($shortenedFilePath, 0, -1); // remove trailing zero $offset += $sl; @@ -4654,13 +4644,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // extended file path // offset: var; size: 4; size of the following file link field including string lenth mark - $sz = self::_GetInt4d($recordData, $offset); + $sz = self::getInt4d($recordData, $offset); $offset += 4; // only present if $sz > 0 if ($sz > 0) { // offset: var; size: 4; size of the character array of the extended file path and name - $xl = self::_GetInt4d($recordData, $offset); + $xl = self::getInt4d($recordData, $offset); $offset += 4; // offset: var; size 2; unknown @@ -4668,7 +4658,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: var; size $xl; character array of the extended file path and name. $extendedFilePath = substr($recordData, $offset, $xl); - $extendedFilePath = self::_encodeUTF16($extendedFilePath, false); + $extendedFilePath = self::encodeUTF16($extendedFilePath, false); $offset += $xl; } @@ -4693,16 +4683,16 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce if ($hasText) { // offset: var; size: 4; character count of text mark including trailing zero word - $tl = self::_GetInt4d($recordData, $offset); + $tl = self::getInt4d($recordData, $offset); $offset += 4; // offset: var; size: var; character array of the text mark without the # sign, no Unicode header, always 16-bit characters, zero-terminated - $text = self::_encodeUTF16(substr($recordData, $offset, 2 * ($tl - 1)), false); + $text = self::encodeUTF16(substr($recordData, $offset, 2 * ($tl - 1)), false); $url .= $text; } // apply the hyperlink to all the relevant cells foreach (PHPExcel_Cell::extractAllCellReferencesInRange($cellRange) as $coordinate) { - $this->_phpSheet->getCell($coordinate)->getHyperLink()->setUrl($url); + $this->phpSheet->getCell($coordinate)->getHyperLink()->setUrl($url); } } } @@ -4711,33 +4701,33 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read DATAVALIDATIONS record */ - private function _readDataValidations() + private function readDataValidations() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer forward to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; } /** * Read DATAVALIDATION record */ - private function _readDataValidation() + private function readDataValidation() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer forward to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if ($this->_readDataOnly) { + if ($this->readDataOnly) { return; } // offset: 0; size: 4; Options - $options = self::_GetInt4d($recordData, 0); + $options = self::getInt4d($recordData, 0); // bit: 0-3; mask: 0x0000000F; type $type = (0x0000000F & $options) >> 0; @@ -4829,27 +4819,27 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 4; size: var; title of the prompt box $offset = 4; - $string = self::_readUnicodeStringLong(substr($recordData, $offset)); + $string = self::readUnicodeStringLong(substr($recordData, $offset)); $promptTitle = $string['value'] !== chr(0) ? $string['value'] : ''; $offset += $string['size']; // offset: var; size: var; title of the error box - $string = self::_readUnicodeStringLong(substr($recordData, $offset)); + $string = self::readUnicodeStringLong(substr($recordData, $offset)); $errorTitle = $string['value'] !== chr(0) ? $string['value'] : ''; $offset += $string['size']; // offset: var; size: var; text of the prompt box - $string = self::_readUnicodeStringLong(substr($recordData, $offset)); + $string = self::readUnicodeStringLong(substr($recordData, $offset)); $prompt = $string['value'] !== chr(0) ? $string['value'] : ''; $offset += $string['size']; // offset: var; size: var; text of the error box - $string = self::_readUnicodeStringLong(substr($recordData, $offset)); + $string = self::readUnicodeStringLong(substr($recordData, $offset)); $error = $string['value'] !== chr(0) ? $string['value'] : ''; $offset += $string['size']; // offset: var; size: 2; size of the formula data for the first condition - $sz1 = self::_GetInt2d($recordData, $offset); + $sz1 = self::getInt2d($recordData, $offset); $offset += 2; // offset: var; size: 2; not used @@ -4859,7 +4849,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $formula1 = substr($recordData, $offset, $sz1); $formula1 = pack('v', $sz1) . $formula1; // prepend the length try { - $formula1 = $this->_getFormulaFromStructure($formula1); + $formula1 = $this->getFormulaFromStructure($formula1); // in list type validity, null characters are used as item separators if ($type == PHPExcel_Cell_DataValidation::TYPE_LIST) { @@ -4871,7 +4861,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $offset += $sz1; // offset: var; size: 2; size of the formula data for the first condition - $sz2 = self::_GetInt2d($recordData, $offset); + $sz2 = self::getInt2d($recordData, $offset); $offset += 2; // offset: var; size: 2; not used @@ -4881,21 +4871,21 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $formula2 = substr($recordData, $offset, $sz2); $formula2 = pack('v', $sz2) . $formula2; // prepend the length try { - $formula2 = $this->_getFormulaFromStructure($formula2); + $formula2 = $this->getFormulaFromStructure($formula2); } catch (PHPExcel_Exception $e) { return; } $offset += $sz2; // offset: var; size: var; cell range address list with - $cellRangeAddressList = $this->_readBIFF8CellRangeAddressList(substr($recordData, $offset)); + $cellRangeAddressList = $this->readBIFF8CellRangeAddressList(substr($recordData, $offset)); $cellRangeAddresses = $cellRangeAddressList['cellRangeAddresses']; foreach ($cellRangeAddresses as $cellRange) { - $stRange = $this->_phpSheet->shrinkRangeToFit($cellRange); + $stRange = $this->phpSheet->shrinkRangeToFit($cellRange); $stRange = PHPExcel_Cell::extractAllCellReferencesInRange($stRange); foreach ($stRange as $coordinate) { - $objValidation = $this->_phpSheet->getCell($coordinate)->getDataValidation(); + $objValidation = $this->phpSheet->getCell($coordinate)->getDataValidation(); $objValidation->setType($type); $objValidation->setErrorStyle($errorStyle); $objValidation->setAllowBlank((bool)$allowBlank); @@ -4916,32 +4906,32 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read SHEETLAYOUT record. Stores sheet tab color information. */ - private function _readSheetLayout() + private function readSheetLayout() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // local pointer in record data $offset = 0; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { // offset: 0; size: 2; repeated record identifier 0x0862 // offset: 2; size: 10; not used // offset: 12; size: 4; size of record data // Excel 2003 uses size of 0x14 (documented), Excel 2007 uses size of 0x28 (not documented?) - $sz = self::_GetInt4d($recordData, 12); + $sz = self::getInt4d($recordData, 12); switch ($sz) { case 0x14: // offset: 16; size: 2; color index for sheet tab - $colorIndex = self::_GetInt2d($recordData, 16); - $color = self::_readColor($colorIndex, $this->_palette, $this->_version); - $this->_phpSheet->getTabColor()->setRGB($color['rgb']); + $colorIndex = self::getInt2d($recordData, 16); + $color = self::readColor($colorIndex, $this->palette, $this->version); + $this->phpSheet->getTabColor()->setRGB($color['rgb']); break; case 0x28: // TODO: Investigate structure for .xls SHEETLAYOUT record as saved by MS Office Excel 2007 @@ -4955,15 +4945,15 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read SHEETPROTECTION record (FEATHEADR) */ - private function _readSheetProtection() + private function readSheetProtection() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; - if ($this->_readDataOnly) { + if ($this->readDataOnly) { return; } @@ -4974,7 +4964,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 4; size: 8; Currently not used and set to 0 // offset: 12; size: 2; Shared feature type index (2=Enhanced Protetion, 4=SmartTag) - $isf = self::_GetInt2d($recordData, 12); + $isf = self::getInt2d($recordData, 12); if ($isf != 2) { return; } @@ -4985,67 +4975,67 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // rgbHdrSData, assume "Enhanced Protection" // offset: 19; size: 2; option flags - $options = self::_GetInt2d($recordData, 19); + $options = self::getInt2d($recordData, 19); // bit: 0; mask 0x0001; 1 = user may edit objects, 0 = users must not edit objects $bool = (0x0001 & $options) >> 0; - $this->_phpSheet->getProtection()->setObjects(!$bool); + $this->phpSheet->getProtection()->setObjects(!$bool); // bit: 1; mask 0x0002; edit scenarios $bool = (0x0002 & $options) >> 1; - $this->_phpSheet->getProtection()->setScenarios(!$bool); + $this->phpSheet->getProtection()->setScenarios(!$bool); // bit: 2; mask 0x0004; format cells $bool = (0x0004 & $options) >> 2; - $this->_phpSheet->getProtection()->setFormatCells(!$bool); + $this->phpSheet->getProtection()->setFormatCells(!$bool); // bit: 3; mask 0x0008; format columns $bool = (0x0008 & $options) >> 3; - $this->_phpSheet->getProtection()->setFormatColumns(!$bool); + $this->phpSheet->getProtection()->setFormatColumns(!$bool); // bit: 4; mask 0x0010; format rows $bool = (0x0010 & $options) >> 4; - $this->_phpSheet->getProtection()->setFormatRows(!$bool); + $this->phpSheet->getProtection()->setFormatRows(!$bool); // bit: 5; mask 0x0020; insert columns $bool = (0x0020 & $options) >> 5; - $this->_phpSheet->getProtection()->setInsertColumns(!$bool); + $this->phpSheet->getProtection()->setInsertColumns(!$bool); // bit: 6; mask 0x0040; insert rows $bool = (0x0040 & $options) >> 6; - $this->_phpSheet->getProtection()->setInsertRows(!$bool); + $this->phpSheet->getProtection()->setInsertRows(!$bool); // bit: 7; mask 0x0080; insert hyperlinks $bool = (0x0080 & $options) >> 7; - $this->_phpSheet->getProtection()->setInsertHyperlinks(!$bool); + $this->phpSheet->getProtection()->setInsertHyperlinks(!$bool); // bit: 8; mask 0x0100; delete columns $bool = (0x0100 & $options) >> 8; - $this->_phpSheet->getProtection()->setDeleteColumns(!$bool); + $this->phpSheet->getProtection()->setDeleteColumns(!$bool); // bit: 9; mask 0x0200; delete rows $bool = (0x0200 & $options) >> 9; - $this->_phpSheet->getProtection()->setDeleteRows(!$bool); + $this->phpSheet->getProtection()->setDeleteRows(!$bool); // bit: 10; mask 0x0400; select locked cells $bool = (0x0400 & $options) >> 10; - $this->_phpSheet->getProtection()->setSelectLockedCells(!$bool); + $this->phpSheet->getProtection()->setSelectLockedCells(!$bool); // bit: 11; mask 0x0800; sort cell range $bool = (0x0800 & $options) >> 11; - $this->_phpSheet->getProtection()->setSort(!$bool); + $this->phpSheet->getProtection()->setSort(!$bool); // bit: 12; mask 0x1000; auto filter $bool = (0x1000 & $options) >> 12; - $this->_phpSheet->getProtection()->setAutoFilter(!$bool); + $this->phpSheet->getProtection()->setAutoFilter(!$bool); // bit: 13; mask 0x2000; pivot tables $bool = (0x2000 & $options) >> 13; - $this->_phpSheet->getProtection()->setPivotTables(!$bool); + $this->phpSheet->getProtection()->setPivotTables(!$bool); // bit: 14; mask 0x4000; select unlocked cells $bool = (0x4000 & $options) >> 14; - $this->_phpSheet->getProtection()->setSelectUnlockedCells(!$bool); + $this->phpSheet->getProtection()->setSelectUnlockedCells(!$bool); // offset: 21; size: 2; not used } @@ -5056,22 +5046,22 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * Reading of this record is based on Microsoft Office Excel 97-2000 Binary File Format Specification, * where it is referred to as FEAT record */ - private function _readRangeProtection() + private function readRangeProtection() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; // local pointer in record data $offset = 0; - if (!$this->_readDataOnly) { + if (!$this->readDataOnly) { $offset += 12; // offset: 12; size: 2; shared feature type, 2 = enhanced protection, 4 = smart tag - $isf = self::_GetInt2d($recordData, 12); + $isf = self::getInt2d($recordData, 12); if ($isf != 2) { // we only read FEAT records of type 2 return; @@ -5081,7 +5071,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $offset += 5; // offset: 19; size: 2; count of ref ranges this feature is on - $cref = self::_GetInt2d($recordData, 19); + $cref = self::getInt2d($recordData, 19); $offset += 2; $offset += 6; @@ -5090,7 +5080,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $cellRanges = array(); for ($i = 0; $i < $cref; ++$i) { try { - $cellRange = $this->_readBIFF8CellRangeAddressFixed(substr($recordData, 27 + 8 * $i, 8)); + $cellRange = $this->readBIFF8CellRangeAddressFixed(substr($recordData, 27 + 8 * $i, 8)); } catch (PHPExcel_Exception $e) { return; } @@ -5103,12 +5093,12 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $offset += 4; // offset: var; size: 4; the encrypted password (only 16-bit although field is 32-bit) - $wPassword = self::_GetInt4d($recordData, $offset); + $wPassword = self::getInt4d($recordData, $offset); $offset += 4; // Apply range protection to sheet if ($cellRanges) { - $this->_phpSheet->protectCells(implode(' ', $cellRanges), strtoupper(dechex($wPassword)), true); + $this->phpSheet->protectCells(implode(' ', $cellRanges), strtoupper(dechex($wPassword)), true); } } } @@ -5117,24 +5107,24 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce /** * Read IMDATA record */ - private function _readImData() + private function readImData() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); + $length = self::getInt2d($this->data, $this->pos + 2); // get spliced record data - $splicedRecordData = $this->_getSplicedRecordData(); + $splicedRecordData = $this->getSplicedRecordData(); $recordData = $splicedRecordData['recordData']; // UNDER CONSTRUCTION // offset: 0; size: 2; image format - $cf = self::_GetInt2d($recordData, 0); + $cf = self::getInt2d($recordData, 0); // offset: 2; size: 2; environment from which the file was written - $env = self::_GetInt2d($recordData, 2); + $env = self::getInt2d($recordData, 2); // offset: 4; size: 4; length of the image data - $lcb = self::_GetInt4d($recordData, 4); + $lcb = self::getInt4d($recordData, 4); // offset: 8; size: var; image data $iData = substr($recordData, 8); @@ -5144,22 +5134,22 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // BITMAPCOREINFO // 1. BITMAPCOREHEADER // offset: 0; size: 4; bcSize, Specifies the number of bytes required by the structure - $bcSize = self::_GetInt4d($iData, 0); + $bcSize = self::getInt4d($iData, 0); // var_dump($bcSize); // offset: 4; size: 2; bcWidth, specifies the width of the bitmap, in pixels - $bcWidth = self::_GetInt2d($iData, 4); + $bcWidth = self::getInt2d($iData, 4); // var_dump($bcWidth); // offset: 6; size: 2; bcHeight, specifies the height of the bitmap, in pixels. - $bcHeight = self::_GetInt2d($iData, 6); + $bcHeight = self::getInt2d($iData, 6); // var_dump($bcHeight); $ih = imagecreatetruecolor($bcWidth, $bcHeight); // offset: 8; size: 2; bcPlanes, specifies the number of planes for the target device. This value must be 1 // offset: 10; size: 2; bcBitCount specifies the number of bits-per-pixel. This value must be 1, 4, 8, or 24 - $bcBitCount = self::_GetInt2d($iData, 10); + $bcBitCount = self::getInt2d($iData, 10); // var_dump($bcBitCount); $rgbString = substr($iData, 12); @@ -5180,7 +5170,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $drawing = new PHPExcel_Worksheet_Drawing(); $drawing->setPath($filename); - $drawing->setWorksheet($this->_phpSheet); + $drawing->setWorksheet($this->phpSheet); break; case 0x02: // Windows metafile or Macintosh PICT format case 0x0e: // native format @@ -5188,7 +5178,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce break; } - // _getSplicedRecordData() takes care of moving current position in data stream + // getSplicedRecordData() takes care of moving current position in data stream } @@ -5197,16 +5187,16 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * When MSODRAWING data on a sheet exceeds 8224 bytes, CONTINUE records are used instead. Undocumented. * In this case, we must treat the CONTINUE record as a MSODRAWING record */ - private function _readContinue() + private function readContinue() { - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); // check if we are reading drawing data // this is in case a free CONTINUE record occurs in other circumstances we are unaware of - if ($this->_drawingData == '') { + if ($this->drawingData == '') { // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; return; } @@ -5214,7 +5204,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // check if record data is at least 4 bytes long, otherwise there is no chance this is MSODRAWING data if ($length < 4) { // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; return; } @@ -5227,17 +5217,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // 0xF00D MsofbtClientTextbox $validSplitPoints = array(0xF003, 0xF004, 0xF00D); // add identifiers if we find more - $splitPoint = self::_GetInt2d($recordData, 2); + $splitPoint = self::getInt2d($recordData, 2); if (in_array($splitPoint, $validSplitPoints)) { // get spliced record data (and move pointer to next record) - $splicedRecordData = $this->_getSplicedRecordData(); - $this->_drawingData .= $splicedRecordData['recordData']; + $splicedRecordData = $this->getSplicedRecordData(); + $this->drawingData .= $splicedRecordData['recordData']; return; } // move stream pointer to next record - $this->_pos += 4 + $length; + $this->pos += 4 + $length; } @@ -5249,7 +5239,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * * @return array */ - private function _getSplicedRecordData() + private function getSplicedRecordData() { $data = ''; $spliceOffsets = array(); @@ -5261,15 +5251,15 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce ++$i; // offset: 0; size: 2; identifier - $identifier = self::_GetInt2d($this->_data, $this->_pos); + $identifier = self::getInt2d($this->data, $this->pos); // offset: 2; size: 2; length - $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $data .= $this->_readRecordData($this->_data, $this->_pos + 4, $length); + $length = self::getInt2d($this->data, $this->pos + 2); + $data .= $this->readRecordData($this->data, $this->pos + 4, $length); $spliceOffsets[$i] = $spliceOffsets[$i - 1] + $length; - $this->_pos += 4 + $length; - $nextIdentifier = self::_GetInt2d($this->_data, $this->_pos); + $this->pos += 4 + $length; + $nextIdentifier = self::getInt2d($this->data, $this->pos); } while ($nextIdentifier == self::XLS_Type_CONTINUE); $splicedData = array( @@ -5289,10 +5279,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas * @return string Human readable formula */ - private function _getFormulaFromStructure($formulaStructure, $baseCell = 'A1') + private function getFormulaFromStructure($formulaStructure, $baseCell = 'A1') { // offset: 0; size: 2; size of the following formula data - $sz = self::_GetInt2d($formulaStructure, 0); + $sz = self::getInt2d($formulaStructure, 0); // offset: 2; size: sz $formulaData = substr($formulaStructure, 2, $sz); @@ -5316,7 +5306,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $additionalData = ''; } - return $this->_getFormulaFromData($formulaData, $additionalData, $baseCell); + return $this->getFormulaFromData($formulaData, $additionalData, $baseCell); } @@ -5328,12 +5318,12 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas * @return string Human readable formula */ - private function _getFormulaFromData($formulaData, $additionalData = '', $baseCell = 'A1') + private function getFormulaFromData($formulaData, $additionalData = '', $baseCell = 'A1') { // start parsing the formula data $tokens = array(); - while (strlen($formulaData) > 0 and $token = $this->_getNextToken($formulaData, $baseCell)) { + while (strlen($formulaData) > 0 and $token = $this->getNextToken($formulaData, $baseCell)) { $tokens[] = $token; $formulaData = substr($formulaData, $token['size']); @@ -5341,7 +5331,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce //var_dump($token); } - $formulaString = $this->_createFormulaFromTokens($tokens, $additionalData); + $formulaString = $this->createFormulaFromTokens($tokens, $additionalData); return $formulaString; } @@ -5355,7 +5345,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas * @return string Human readable formula */ - private function _createFormulaFromTokens($tokens, $additionalData) + private function createFormulaFromTokens($tokens, $additionalData) { // empty formula? if (empty($tokens)) { @@ -5475,7 +5465,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce break; case 'tMemArea': // bite off chunk of additional data - $cellRangeAddressList = $this->_readBIFF8CellRangeAddressList($additionalData); + $cellRangeAddressList = $this->readBIFF8CellRangeAddressList($additionalData); $additionalData = substr($additionalData, $cellRangeAddressList['size']); $formulaStrings[] = "$space1$space0{$token['data']}"; unset($space0, $space1); @@ -5519,7 +5509,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @return array * @throws PHPExcel_Reader_Exception */ - private function _getNextToken($formulaData, $baseCell = 'A1') + private function getNextToken($formulaData, $baseCell = 'A1') { // offset: 0; size: 1; token id $id = ord($formulaData[0]); // token id @@ -5629,9 +5619,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce case 0x17: // string $name = 'tStr'; // offset: 1; size: var; Unicode string, 8-bit string length - $string = self::_readUnicodeStringShort(substr($formulaData, 1)); + $string = self::readUnicodeStringShort(substr($formulaData, 1)); $size = 1 + $string['size']; - $data = self::_UTF8toExcelDoubleQuoted($string['value']); + $data = self::UTF8toExcelDoubleQuoted($string['value']); break; case 0x19: // Special attribute // offset: 1; size: 1; attribute type flags: @@ -5649,7 +5639,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce case 0x04: $name = 'tAttrChoose'; // offset: 2; size: 2; number of choices in the CHOOSE function ($nc, number of parameters decreased by 1) - $nc = self::_GetInt2d($formulaData, 2); + $nc = self::getInt2d($formulaData, 2); // offset: 4; size: 2 * $nc // offset: 4 + 2 * $nc; size: 2 $size = 2 * $nc + 6; @@ -5707,7 +5697,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 1; size: 1; error code $name = 'tErr'; $size = 2; - $data = self::_mapErrorCode(ord($formulaData[1])); + $data = self::mapErrorCode(ord($formulaData[1])); break; case 0x1D: // boolean // offset: 1; size: 1; 0 = false, 1 = true; @@ -5719,13 +5709,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 1; size: 2; unsigned 16-bit integer $name = 'tInt'; $size = 3; - $data = self::_GetInt2d($formulaData, 1); + $data = self::getInt2d($formulaData, 1); break; case 0x1F: // number // offset: 1; size: 8; $name = 'tNum'; $size = 9; - $data = self::_extractNumber(substr($formulaData, 1)); + $data = self::extractNumber(substr($formulaData, 1)); $data = str_replace(',', '.', (string)$data); // in case non-English locale break; case 0x20: // array constant @@ -5742,7 +5732,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $name = 'tFunc'; $size = 3; // offset: 1; size: 2; index to built-in sheet function - switch (self::_GetInt2d($formulaData, 1)) { + switch (self::getInt2d($formulaData, 1)) { case 2: $function = 'ISNA'; $args = 1; @@ -6397,7 +6387,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 1; size: 1; number of arguments $args = ord($formulaData[1]); // offset: 2: size: 2; index to built-in sheet function - $index = self::_GetInt2d($formulaData, 2); + $index = self::getInt2d($formulaData, 2); switch ($index) { case 0: $function = 'COUNT'; @@ -6675,23 +6665,23 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $name = 'tName'; $size = 5; // offset: 1; size: 2; one-based index to definedname record - $definedNameIndex = self::_GetInt2d($formulaData, 1) - 1; + $definedNameIndex = self::getInt2d($formulaData, 1) - 1; // offset: 2; size: 2; not used - $data = $this->_definedname[$definedNameIndex]['name']; + $data = $this->definedname[$definedNameIndex]['name']; break; case 0x24: // single cell reference e.g. A5 case 0x44: case 0x64: $name = 'tRef'; $size = 5; - $data = $this->_readBIFF8CellAddress(substr($formulaData, 1, 4)); + $data = $this->readBIFF8CellAddress(substr($formulaData, 1, 4)); break; case 0x25: // cell range reference to cells in the same sheet (2d) case 0x45: case 0x65: $name = 'tArea'; $size = 9; - $data = $this->_readBIFF8CellRangeAddress(substr($formulaData, 1, 8)); + $data = $this->readBIFF8CellRangeAddress(substr($formulaData, 1, 8)); break; case 0x26: // Constant reference sub-expression case 0x46: @@ -6699,9 +6689,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $name = 'tMemArea'; // offset: 1; size: 4; not used // offset: 5; size: 2; size of the following subexpression - $subSize = self::_GetInt2d($formulaData, 5); + $subSize = self::getInt2d($formulaData, 5); $size = 7 + $subSize; - $data = $this->_getFormulaFromData(substr($formulaData, 7, $subSize)); + $data = $this->getFormulaFromData(substr($formulaData, 7, $subSize)); break; case 0x27: // Deleted constant reference sub-expression case 0x47: @@ -6709,32 +6699,32 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $name = 'tMemErr'; // offset: 1; size: 4; not used // offset: 5; size: 2; size of the following subexpression - $subSize = self::_GetInt2d($formulaData, 5); + $subSize = self::getInt2d($formulaData, 5); $size = 7 + $subSize; - $data = $this->_getFormulaFromData(substr($formulaData, 7, $subSize)); + $data = $this->getFormulaFromData(substr($formulaData, 7, $subSize)); break; case 0x29: // Variable reference sub-expression case 0x49: case 0x69: $name = 'tMemFunc'; // offset: 1; size: 2; size of the following sub-expression - $subSize = self::_GetInt2d($formulaData, 1); + $subSize = self::getInt2d($formulaData, 1); $size = 3 + $subSize; - $data = $this->_getFormulaFromData(substr($formulaData, 3, $subSize)); + $data = $this->getFormulaFromData(substr($formulaData, 3, $subSize)); break; case 0x2C: // Relative 2d cell reference reference, used in shared formulas and some other places case 0x4C: case 0x6C: $name = 'tRefN'; $size = 5; - $data = $this->_readBIFF8CellAddressB(substr($formulaData, 1, 4), $baseCell); + $data = $this->readBIFF8CellAddressB(substr($formulaData, 1, 4), $baseCell); break; case 0x2D: // Relative 2d range reference case 0x4D: case 0x6D: $name = 'tAreaN'; $size = 9; - $data = $this->_readBIFF8CellRangeAddressB(substr($formulaData, 1, 8), $baseCell); + $data = $this->readBIFF8CellRangeAddressB(substr($formulaData, 1, 8), $baseCell); break; case 0x39: // External name case 0x59: @@ -6743,9 +6733,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce $size = 7; // offset: 1; size: 2; index to REF entry in EXTERNSHEET record // offset: 3; size: 2; one-based index to DEFINEDNAME or EXTERNNAME record - $index = self::_GetInt2d($formulaData, 3); + $index = self::getInt2d($formulaData, 3); // assume index is to EXTERNNAME record - $data = $this->_externalNames[$index - 1]['name']; + $data = $this->externalNames[$index - 1]['name']; // offset: 5; size: 2; not used break; case 0x3A: // 3d reference to cell @@ -6756,9 +6746,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce try { // offset: 1; size: 2; index to REF entry - $sheetRange = $this->_readSheetRangeByRefIndex(self::_GetInt2d($formulaData, 1)); + $sheetRange = $this->readSheetRangeByRefIndex(self::getInt2d($formulaData, 1)); // offset: 3; size: 4; cell address - $cellAddress = $this->_readBIFF8CellAddress(substr($formulaData, 3, 4)); + $cellAddress = $this->readBIFF8CellAddress(substr($formulaData, 3, 4)); $data = "$sheetRange!$cellAddress"; } catch (PHPExcel_Exception $e) { @@ -6774,9 +6764,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce try { // offset: 1; size: 2; index to REF entry - $sheetRange = $this->_readSheetRangeByRefIndex(self::_GetInt2d($formulaData, 1)); + $sheetRange = $this->readSheetRangeByRefIndex(self::getInt2d($formulaData, 1)); // offset: 3; size: 8; cell address - $cellRangeAddress = $this->_readBIFF8CellRangeAddress(substr($formulaData, 3, 8)); + $cellRangeAddress = $this->readBIFF8CellRangeAddress(substr($formulaData, 3, 8)); $data = "$sheetRange!$cellRangeAddress"; } catch (PHPExcel_Exception $e) { @@ -6806,21 +6796,21 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $cellAddressStructure * @return string */ - private function _readBIFF8CellAddress($cellAddressStructure) + private function readBIFF8CellAddress($cellAddressStructure) { // offset: 0; size: 2; index to row (0... 65535) (or offset (-32768... 32767)) - $row = self::_GetInt2d($cellAddressStructure, 0) + 1; + $row = self::getInt2d($cellAddressStructure, 0) + 1; // offset: 2; size: 2; index to column or column offset + relative flags // bit: 7-0; mask 0x00FF; column index - $column = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::_GetInt2d($cellAddressStructure, 2)); + $column = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::getInt2d($cellAddressStructure, 2)); // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) - if (!(0x4000 & self::_GetInt2d($cellAddressStructure, 2))) { + if (!(0x4000 & self::getInt2d($cellAddressStructure, 2))) { $column = '$' . $column; } // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) - if (!(0x8000 & self::_GetInt2d($cellAddressStructure, 2))) { + if (!(0x8000 & self::getInt2d($cellAddressStructure, 2))) { $row = '$' . $row; } @@ -6837,21 +6827,21 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas * @return string */ - private function _readBIFF8CellAddressB($cellAddressStructure, $baseCell = 'A1') + private function readBIFF8CellAddressB($cellAddressStructure, $baseCell = 'A1') { list($baseCol, $baseRow) = PHPExcel_Cell::coordinateFromString($baseCell); $baseCol = PHPExcel_Cell::columnIndexFromString($baseCol) - 1; // offset: 0; size: 2; index to row (0... 65535) (or offset (-32768... 32767)) - $rowIndex = self::_GetInt2d($cellAddressStructure, 0); - $row = self::_GetInt2d($cellAddressStructure, 0) + 1; + $rowIndex = self::getInt2d($cellAddressStructure, 0); + $row = self::getInt2d($cellAddressStructure, 0) + 1; // offset: 2; size: 2; index to column or column offset + relative flags // bit: 7-0; mask 0x00FF; column index - $colIndex = 0x00FF & self::_GetInt2d($cellAddressStructure, 2); + $colIndex = 0x00FF & self::getInt2d($cellAddressStructure, 2); // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) - if (!(0x4000 & self::_GetInt2d($cellAddressStructure, 2))) { + if (!(0x4000 & self::getInt2d($cellAddressStructure, 2))) { $column = PHPExcel_Cell::stringFromColumnIndex($colIndex); $column = '$' . $column; } else { @@ -6860,7 +6850,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) - if (!(0x8000 & self::_GetInt2d($cellAddressStructure, 2))) { + if (!(0x8000 & self::getInt2d($cellAddressStructure, 2))) { $row = '$' . $row; } else { $rowIndex = ($rowIndex <= 32767) ? $rowIndex : $rowIndex - 65536; @@ -6880,13 +6870,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @return string * @throws PHPExcel_Reader_Exception */ - private function _readBIFF5CellRangeAddressFixed($subData) + private function readBIFF5CellRangeAddressFixed($subData) { // offset: 0; size: 2; index to first row - $fr = self::_GetInt2d($subData, 0) + 1; + $fr = self::getInt2d($subData, 0) + 1; // offset: 2; size: 2; index to last row - $lr = self::_GetInt2d($subData, 2) + 1; + $lr = self::getInt2d($subData, 2) + 1; // offset: 4; size: 1; index to first column $fc = ord($subData{4}); @@ -6919,19 +6909,19 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @return string * @throws PHPExcel_Reader_Exception */ - private function _readBIFF8CellRangeAddressFixed($subData) + private function readBIFF8CellRangeAddressFixed($subData) { // offset: 0; size: 2; index to first row - $fr = self::_GetInt2d($subData, 0) + 1; + $fr = self::getInt2d($subData, 0) + 1; // offset: 2; size: 2; index to last row - $lr = self::_GetInt2d($subData, 2) + 1; + $lr = self::getInt2d($subData, 2) + 1; // offset: 4; size: 2; index to first column - $fc = self::_GetInt2d($subData, 4); + $fc = self::getInt2d($subData, 4); // offset: 6; size: 2; index to last column - $lc = self::_GetInt2d($subData, 6); + $lc = self::getInt2d($subData, 6); // check values if ($fr > $lr || $fc > $lc) { @@ -6957,44 +6947,44 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $subData * @return string */ - private function _readBIFF8CellRangeAddress($subData) + private function readBIFF8CellRangeAddress($subData) { // todo: if cell range is just a single cell, should this funciton // not just return e.g. 'A1' and not 'A1:A1' ? // offset: 0; size: 2; index to first row (0... 65535) (or offset (-32768... 32767)) - $fr = self::_GetInt2d($subData, 0) + 1; + $fr = self::getInt2d($subData, 0) + 1; // offset: 2; size: 2; index to last row (0... 65535) (or offset (-32768... 32767)) - $lr = self::_GetInt2d($subData, 2) + 1; + $lr = self::getInt2d($subData, 2) + 1; // offset: 4; size: 2; index to first column or column offset + relative flags // bit: 7-0; mask 0x00FF; column index - $fc = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::_GetInt2d($subData, 4)); + $fc = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::getInt2d($subData, 4)); // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) - if (!(0x4000 & self::_GetInt2d($subData, 4))) { + if (!(0x4000 & self::getInt2d($subData, 4))) { $fc = '$' . $fc; } // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) - if (!(0x8000 & self::_GetInt2d($subData, 4))) { + if (!(0x8000 & self::getInt2d($subData, 4))) { $fr = '$' . $fr; } // offset: 6; size: 2; index to last column or column offset + relative flags // bit: 7-0; mask 0x00FF; column index - $lc = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::_GetInt2d($subData, 6)); + $lc = PHPExcel_Cell::stringFromColumnIndex(0x00FF & self::getInt2d($subData, 6)); // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) - if (!(0x4000 & self::_GetInt2d($subData, 6))) { + if (!(0x4000 & self::getInt2d($subData, 6))) { $lc = '$' . $lc; } // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) - if (!(0x8000 & self::_GetInt2d($subData, 6))) { + if (!(0x8000 & self::getInt2d($subData, 6))) { $lr = '$' . $lr; } @@ -7011,7 +7001,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $baseCell Base cell * @return string Cell range address */ - private function _readBIFF8CellRangeAddressB($subData, $baseCell = 'A1') + private function readBIFF8CellRangeAddressB($subData, $baseCell = 'A1') { list($baseCol, $baseRow) = PHPExcel_Cell::coordinateFromString($baseCell); $baseCol = PHPExcel_Cell::columnIndexFromString($baseCol) - 1; @@ -7020,18 +7010,18 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // not just return e.g. 'A1' and not 'A1:A1' ? // offset: 0; size: 2; first row - $frIndex = self::_GetInt2d($subData, 0); // adjust below + $frIndex = self::getInt2d($subData, 0); // adjust below // offset: 2; size: 2; relative index to first row (0... 65535) should be treated as offset (-32768... 32767) - $lrIndex = self::_GetInt2d($subData, 2); // adjust below + $lrIndex = self::getInt2d($subData, 2); // adjust below // offset: 4; size: 2; first column with relative/absolute flags // bit: 7-0; mask 0x00FF; column index - $fcIndex = 0x00FF & self::_GetInt2d($subData, 4); + $fcIndex = 0x00FF & self::getInt2d($subData, 4); // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) - if (!(0x4000 & self::_GetInt2d($subData, 4))) { + if (!(0x4000 & self::getInt2d($subData, 4))) { // absolute column index $fc = PHPExcel_Cell::stringFromColumnIndex($fcIndex); $fc = '$' . $fc; @@ -7042,7 +7032,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) - if (!(0x8000 & self::_GetInt2d($subData, 4))) { + if (!(0x8000 & self::getInt2d($subData, 4))) { // absolute row index $fr = $frIndex + 1; $fr = '$' . $fr; @@ -7055,12 +7045,12 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 6; size: 2; last column with relative/absolute flags // bit: 7-0; mask 0x00FF; column index - $lcIndex = 0x00FF & self::_GetInt2d($subData, 6); + $lcIndex = 0x00FF & self::getInt2d($subData, 6); $lcIndex = ($lcIndex <= 127) ? $lcIndex : $lcIndex - 256; $lc = PHPExcel_Cell::stringFromColumnIndex($baseCol + $lcIndex); // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) - if (!(0x4000 & self::_GetInt2d($subData, 6))) { + if (!(0x4000 & self::getInt2d($subData, 6))) { // absolute column index $lc = PHPExcel_Cell::stringFromColumnIndex($lcIndex); $lc = '$' . $lc; @@ -7071,7 +7061,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) - if (!(0x8000 & self::_GetInt2d($subData, 6))) { + if (!(0x8000 & self::getInt2d($subData, 6))) { // absolute row index $lr = $lrIndex + 1; $lr = '$' . $lr; @@ -7092,17 +7082,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $subData * @return array */ - private function _readBIFF8CellRangeAddressList($subData) + private function readBIFF8CellRangeAddressList($subData) { $cellRangeAddresses = array(); // offset: 0; size: 2; number of the following cell range addresses - $nm = self::_GetInt2d($subData, 0); + $nm = self::getInt2d($subData, 0); $offset = 2; // offset: 2; size: 8 * $nm; list of $nm (fixed) cell range addresses for ($i = 0; $i < $nm; ++$i) { - $cellRangeAddresses[] = $this->_readBIFF8CellRangeAddressFixed(substr($subData, $offset, 8)); + $cellRangeAddresses[] = $this->readBIFF8CellRangeAddressFixed(substr($subData, $offset, 8)); $offset += 8; } @@ -7120,17 +7110,17 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $subData * @return array */ - private function _readBIFF5CellRangeAddressList($subData) + private function readBIFF5CellRangeAddressList($subData) { $cellRangeAddresses = array(); // offset: 0; size: 2; number of the following cell range addresses - $nm = self::_GetInt2d($subData, 0); + $nm = self::getInt2d($subData, 0); $offset = 2; // offset: 2; size: 6 * $nm; list of $nm (fixed) cell range addresses for ($i = 0; $i < $nm; ++$i) { - $cellRangeAddresses[] = $this->_readBIFF5CellRangeAddressFixed(substr($subData, $offset, 6)); + $cellRangeAddresses[] = $this->readBIFF5CellRangeAddressFixed(substr($subData, $offset, 6)); $offset += 6; } @@ -7151,21 +7141,21 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @return string|false * @throws PHPExcel_Reader_Exception */ - private function _readSheetRangeByRefIndex($index) + private function readSheetRangeByRefIndex($index) { - if (isset($this->_ref[$index])) { - $type = $this->_externalBooks[$this->_ref[$index]['externalBookIndex']]['type']; + if (isset($this->ref[$index])) { + $type = $this->externalBooks[$this->ref[$index]['externalBookIndex']]['type']; switch ($type) { case 'internal': // check if we have a deleted 3d reference - if ($this->_ref[$index]['firstSheetIndex'] == 0xFFFF or $this->_ref[$index]['lastSheetIndex'] == 0xFFFF) { + if ($this->ref[$index]['firstSheetIndex'] == 0xFFFF or $this->ref[$index]['lastSheetIndex'] == 0xFFFF) { throw new PHPExcel_Reader_Exception('Deleted sheet reference'); } // we have normal sheet range (collapsed or uncollapsed) - $firstSheetName = $this->_sheets[$this->_ref[$index]['firstSheetIndex']]['name']; - $lastSheetName = $this->_sheets[$this->_ref[$index]['lastSheetIndex']]['name']; + $firstSheetName = $this->sheets[$this->ref[$index]['firstSheetIndex']]['name']; + $lastSheetName = $this->sheets[$this->ref[$index]['lastSheetIndex']]['name']; if ($firstSheetName == $lastSheetName) { // collapsed sheet range @@ -7205,13 +7195,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $arrayData * @return array */ - private static function _readBIFF8ConstantArray($arrayData) + private static function readBIFF8ConstantArray($arrayData) { // offset: 0; size: 1; number of columns decreased by 1 $nc = ord($arrayData[0]); // offset: 1; size: 2; number of rows decreased by 1 - $nr = self::_GetInt2d($arrayData, 1); + $nr = self::getInt2d($arrayData, 1); $size = 3; // initialize $arrayData = substr($arrayData, 3); @@ -7244,7 +7234,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $valueData * @return array */ - private static function _readBIFF8Constant($valueData) + private static function readBIFF8Constant($valueData) { // offset: 0; size: 1; identifier for type of constant $identifier = ord($valueData[0]); @@ -7256,12 +7246,12 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce break; case 0x01: // number // offset: 1; size: 8; IEEE 754 floating-point value - $value = self::_extractNumber(substr($valueData, 1, 8)); + $value = self::extractNumber(substr($valueData, 1, 8)); $size = 9; break; case 0x02: // string value // offset: 1; size: var; Unicode string, 16-bit string length - $string = self::_readUnicodeStringLong(substr($valueData, 1)); + $string = self::readUnicodeStringLong(substr($valueData, 1)); $value = '"' . $string['value'] . '"'; $size = 1 + $string['size']; break; @@ -7276,7 +7266,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce break; case 0x10: // error code // offset: 1; size: 1; error code - $value = self::_mapErrorCode(ord($valueData[1])); + $value = self::mapErrorCode(ord($valueData[1])); $size = 9; break; } @@ -7294,7 +7284,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $rgb Encoded RGB value (4 bytes) * @return array */ - private static function _readRGB($rgb) + private static function readRGB($rgb) { // offset: 0; size 1; Red component $r = ord($rgb{0}); @@ -7319,13 +7309,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $subData * @return array */ - private function _readByteStringShort($subData) + private function readByteStringShort($subData) { // offset: 0; size: 1; length of the string (character count) $ln = ord($subData[0]); // offset: 1: size: var; character array (8-bit characters) - $value = $this->_decodeCodepage(substr($subData, 1, $ln)); + $value = $this->decodeCodepage(substr($subData, 1, $ln)); return array( 'value' => $value, @@ -7341,13 +7331,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $subData * @return array */ - private function _readByteStringLong($subData) + private function readByteStringLong($subData) { // offset: 0; size: 2; length of the string (character count) - $ln = self::_GetInt2d($subData, 0); + $ln = self::getInt2d($subData, 0); // offset: 2: size: var; character array (8-bit characters) - $value = $this->_decodeCodepage(substr($subData, 2)); + $value = $this->decodeCodepage(substr($subData, 2)); //return $string; return array( @@ -7365,14 +7355,14 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $subData * @return array */ - private static function _readUnicodeStringShort($subData) + private static function readUnicodeStringShort($subData) { $value = ''; // offset: 0: size: 1; length of the string (character count) $characterCount = ord($subData[0]); - $string = self::_readUnicodeString(substr($subData, 1), $characterCount); + $string = self::readUnicodeString(substr($subData, 1), $characterCount); // add 1 for the string length $string['size'] += 1; @@ -7389,14 +7379,14 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $subData * @return array */ - private static function _readUnicodeStringLong($subData) + private static function readUnicodeStringLong($subData) { $value = ''; // offset: 0: size: 2; length of the string (character count) - $characterCount = self::_GetInt2d($subData, 0); + $characterCount = self::getInt2d($subData, 0); - $string = self::_readUnicodeString(substr($subData, 2), $characterCount); + $string = self::readUnicodeString(substr($subData, 2), $characterCount); // add 2 for the string length $string['size'] += 2; @@ -7414,7 +7404,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param int $characterCount * @return array */ - private static function _readUnicodeString($subData, $characterCount) + private static function readUnicodeString($subData, $characterCount) { $value = ''; @@ -7431,7 +7421,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce // offset: 1: size: var; character array // this offset assumes richtext and Asian phonetic settings are off which is generally wrong // needs to be fixed - $value = self::_encodeUTF16(substr($subData, 1, $isCompressed ? $characterCount : 2 * $characterCount), $isCompressed); + $value = self::encodeUTF16(substr($subData, 1, $isCompressed ? $characterCount : 2 * $characterCount), $isCompressed); return array( 'value' => $value, @@ -7447,7 +7437,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $value UTF-8 encoded string * @return string */ - private static function _UTF8toExcelDoubleQuoted($value) + private static function UTF8toExcelDoubleQuoted($value) { return '"' . str_replace('"', '""', $value) . '"'; } @@ -7459,10 +7449,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $data Binary string that is at least 8 bytes long * @return float */ - private static function _extractNumber($data) + private static function extractNumber($data) { - $rknumhigh = self::_GetInt4d($data, 4); - $rknumlow = self::_GetInt4d($data, 0); + $rknumhigh = self::getInt4d($data, 4); + $rknumlow = self::getInt4d($data, 0); $sign = ($rknumhigh & 0x80000000) >> 31; $exp = (($rknumhigh & 0x7ff00000) >> 20) - 1023; $mantissa = (0x100000 | ($rknumhigh & 0x000fffff)); @@ -7483,7 +7473,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } - private static function _GetIEEE754($rknum) + private static function getIEEE754($rknum) { if (($rknum & 0x02) != 0) { $value = $rknum >> 2; @@ -7516,10 +7506,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param bool $compressed * @return string */ - private static function _encodeUTF16($string, $compressed = '') + private static function encodeUTF16($string, $compressed = '') { if ($compressed) { - $string = self::_uncompressByteString($string); + $string = self::uncompressByteString($string); } return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', 'UTF-16LE'); @@ -7532,7 +7522,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $string * @return string */ - private static function _uncompressByteString($string) + private static function uncompressByteString($string) { $uncompressedString = ''; $strLen = strlen($string); @@ -7550,9 +7540,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param string $string * @return string */ - private function _decodeCodepage($string) + private function decodeCodepage($string) { - return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $this->_codepage); + return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $this->codepage); } @@ -7563,7 +7553,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param int $pos * @return int */ - public static function _GetInt2d($data, $pos) + public static function getInt2d($data, $pos) { return ord($data[$pos]) | (ord($data[$pos+1]) << 8); } @@ -7576,7 +7566,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param int $pos * @return int */ - public static function _GetInt4d($data, $pos) + public static function getInt4d($data, $pos) { // FIX: represent numbers correctly on 64-bit system // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334 @@ -7599,21 +7589,21 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param array $palette Color palette * @return array RGB color value, example: array('rgb' => 'FF0000') */ - private static function _readColor($color, $palette, $version) + private static function readColor($color, $palette, $version) { if ($color <= 0x07 || $color >= 0x40) { // special built-in color - return self::_mapBuiltInColor($color); + return self::mapBuiltInColor($color); } elseif (isset($palette) && isset($palette[$color - 8])) { // palette color, color index 0x08 maps to pallete index 0 return $palette[$color - 8]; } else { // default color table if ($version == self::XLS_BIFF8) { - return self::_mapColor($color); + return self::mapColor($color); } else { // BIFF5 - return self::_mapColorBIFF5($color); + return self::mapColorBIFF5($color); } } @@ -7628,7 +7618,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param int $index * @return string */ - private static function _mapBorderStyle($index) + private static function mapBorderStyle($index) { switch ($index) { case 0x00: @@ -7672,7 +7662,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param int $index * @return string */ - private static function _mapFillPattern($index) + private static function mapFillPattern($index) { switch ($index) { case 0x00: @@ -7725,7 +7715,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param int $subData * @return string */ - private static function _mapErrorCode($subData) + private static function mapErrorCode($subData) { switch ($subData) { case 0x00: @@ -7761,7 +7751,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param int $color Indexed color * @return array */ - private static function _mapBuiltInColor($color) + private static function mapBuiltInColor($color) { switch ($color) { case 0x00: @@ -7796,7 +7786,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param int $subData * @return array */ - private static function _mapColorBIFF5($subData) + private static function mapColorBIFF5($subData) { switch ($subData) { case 0x08: @@ -7923,7 +7913,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @param int $subData * @return array */ - private static function _mapColor($subData) + private static function mapColor($subData) { switch ($subData) { case 0x08: @@ -8043,10 +8033,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce } } - private function _parseRichText($is = '') + private function parseRichText($is = '') { $value = new PHPExcel_RichText(); - $value->createText($is); return $value; diff --git a/Classes/PHPExcel/Reader/Excel5/Escher.php b/Classes/PHPExcel/Reader/Excel5/Escher.php index b4575e6..2b99e22 100644 --- a/Classes/PHPExcel/Reader/Excel5/Escher.php +++ b/Classes/PHPExcel/Reader/Excel5/Escher.php @@ -101,7 +101,7 @@ class PHPExcel_Reader_Excel5_Escher // Parse Escher stream 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: @@ -173,15 +173,15 @@ class PHPExcel_Reader_Excel5_Escher 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); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -193,7 +193,7 @@ class PHPExcel_Reader_Excel5_Escher */ private function readDggContainer() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -211,7 +211,7 @@ class PHPExcel_Reader_Excel5_Escher */ private function readDgg() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -223,7 +223,7 @@ class PHPExcel_Reader_Excel5_Escher */ private function readBstoreContainer() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -244,9 +244,9 @@ class PHPExcel_Reader_Excel5_Escher // 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); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -268,16 +268,16 @@ class PHPExcel_Reader_Excel5_Escher $rgbUid = substr($recordData, 2, 16); // offset: 18; size: 2; tag - $tag = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 18); + $tag = PHPExcel_Reader_Excel5::getInt2d($recordData, 18); // offset: 20; size: 4; size of BLIP in bytes - $size = PHPExcel_Reader_Excel5::_GetInt4d($recordData, 20); + $size = PHPExcel_Reader_Excel5::getInt4d($recordData, 20); // offset: 24; size: 4; number of references to this BLIP - $cRef = PHPExcel_Reader_Excel5::_GetInt4d($recordData, 24); + $cRef = PHPExcel_Reader_Excel5::getInt4d($recordData, 24); // offset: 28; size: 4; MSOFO file offset - $foDelay = PHPExcel_Reader_Excel5::_GetInt4d($recordData, 28); + $foDelay = PHPExcel_Reader_Excel5::getInt4d($recordData, 28); // offset: 32; size: 1; unused1 $unused1 = ord($recordData{32}); @@ -310,9 +310,9 @@ class PHPExcel_Reader_Excel5_Escher // 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); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -351,9 +351,9 @@ class PHPExcel_Reader_Excel5_Escher // 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); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -392,9 +392,9 @@ class PHPExcel_Reader_Excel5_Escher // 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); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -411,9 +411,9 @@ class PHPExcel_Reader_Excel5_Escher // 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); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -425,7 +425,7 @@ class PHPExcel_Reader_Excel5_Escher */ private function readSplitMenuColors() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -437,7 +437,7 @@ class PHPExcel_Reader_Excel5_Escher */ private function readDgContainer() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -455,7 +455,7 @@ class PHPExcel_Reader_Excel5_Escher */ private function readDg() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -469,7 +469,7 @@ class PHPExcel_Reader_Excel5_Escher { // context is either context DgContainer or SpgrContainer - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -495,7 +495,7 @@ class PHPExcel_Reader_Excel5_Escher */ private function readSpContainer() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // add spContainer to spgrContainer @@ -515,7 +515,7 @@ class PHPExcel_Reader_Excel5_Escher */ private function readSpgr() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -530,9 +530,9 @@ class PHPExcel_Reader_Excel5_Escher // 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); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -547,9 +547,9 @@ class PHPExcel_Reader_Excel5_Escher // 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); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -561,35 +561,35 @@ class PHPExcel_Reader_Excel5_Escher */ private function readClientAnchor() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record $this->pos += 8 + $length; // offset: 2; size: 2; upper-left corner column index (0-based) - $c1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 2); + $c1 = PHPExcel_Reader_Excel5::getInt2d($recordData, 2); // offset: 4; size: 2; upper-left corner horizontal offset in 1/1024 of column width - $startOffsetX = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 4); + $startOffsetX = PHPExcel_Reader_Excel5::getInt2d($recordData, 4); // offset: 6; size: 2; upper-left corner row index (0-based) - $r1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 6); + $r1 = PHPExcel_Reader_Excel5::getInt2d($recordData, 6); // offset: 8; size: 2; upper-left corner vertical offset in 1/256 of row height - $startOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 8); + $startOffsetY = PHPExcel_Reader_Excel5::getInt2d($recordData, 8); // offset: 10; size: 2; bottom-right corner column index (0-based) - $c2 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 10); + $c2 = PHPExcel_Reader_Excel5::getInt2d($recordData, 10); // offset: 12; size: 2; bottom-right corner horizontal offset in 1/1024 of column width - $endOffsetX = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 12); + $endOffsetX = PHPExcel_Reader_Excel5::getInt2d($recordData, 12); // offset: 14; size: 2; bottom-right corner row index (0-based) - $r2 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 14); + $r2 = PHPExcel_Reader_Excel5::getInt2d($recordData, 14); // offset: 16; size: 2; bottom-right corner vertical offset in 1/256 of row height - $endOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 16); + $endOffsetY = PHPExcel_Reader_Excel5::getInt2d($recordData, 16); // set the start coordinates $this->object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1)); @@ -615,7 +615,7 @@ class PHPExcel_Reader_Excel5_Escher */ private function readClientData() { - $length = PHPExcel_Reader_Excel5::_GetInt4d($this->data, $this->pos + 4); + $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4); $recordData = substr($this->data, $this->pos + 8, $length); // move stream pointer to next record @@ -638,7 +638,7 @@ class PHPExcel_Reader_Excel5_Escher $fopte = substr($data, 6 * $i, 6); // offset: 0; size: 2; opid - $opid = PHPExcel_Reader_Excel5::_GetInt2d($fopte, 0); + $opid = PHPExcel_Reader_Excel5::getInt2d($fopte, 0); // bit: 0-13; mask: 0x3FFF; opid.opid $opidOpid = (0x3FFF & $opid) >> 0; @@ -650,7 +650,7 @@ class PHPExcel_Reader_Excel5_Escher $opidFComplex = (0x8000 & $opid) >> 15; // offset: 2; size: 4; the value for this property - $op = PHPExcel_Reader_Excel5::_GetInt4d($fopte, 2); + $op = PHPExcel_Reader_Excel5::getInt4d($fopte, 2); if ($opidFComplex) { $complexData = substr($splicedComplexData, 0, $op); diff --git a/Classes/PHPExcel/Reader/Exception.php b/Classes/PHPExcel/Reader/Exception.php index 158b207..48b3f82 100644 --- a/Classes/PHPExcel/Reader/Exception.php +++ b/Classes/PHPExcel/Reader/Exception.php @@ -1,6 +1,7 @@ _readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->referenceHelper = PHPExcel_ReferenceHelper::getInstance(); } @@ -173,7 +173,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx return $worksheetInfo; } - private function _gzfileGetContents($filename) + private function gzfileGetContents($filename) { $file = @gzopen($filename, 'rb'); if ($file !== false) { @@ -220,7 +220,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx $timezoneObj = new DateTimeZone('Europe/London'); $GMT = new DateTimeZone('UTC'); - $gFileData = $this->_gzfileGetContents($pFilename); + $gFileData = $this->gzfileGetContents($pFilename); // echo '
';
 //        echo htmlentities($gFileData,ENT_QUOTES,'UTF-8');
@@ -340,7 +340,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
         foreach ($gnmXML->Sheets->Sheet as $sheet) {
             $worksheetName = (string) $sheet->Name;
 //            echo 'Worksheet: ', $worksheetName,'
'; - if ((isset($this->_loadSheetsOnly)) && (!in_array($worksheetName, $this->_loadSheetsOnly))) { + if ((isset($this->loadSheetsOnly)) && (!in_array($worksheetName, $this->loadSheetsOnly))) { continue; } @@ -354,7 +354,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx // name in line with the formula, not the reverse $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false); - if ((!$this->_readDataOnly) && (isset($sheet->PrintInformation))) { + if ((!$this->readDataOnly) && (isset($sheet->PrintInformation))) { if (isset($sheet->PrintInformation->Margins)) { foreach ($sheet->PrintInformation->Margins->children('gnm', true) as $key => $margin) { $marginAttributes = $margin->attributes(); @@ -441,6 +441,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx $cell = ($cell == 'TRUE') ? true: false; break; case '30': // Integer + // Excel 2007+ doesn't differentiate between integer and float, so set the value and dropthru to the next (numeric) case $cell = intval($cell); case '40': // Float $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; @@ -458,12 +459,12 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx $objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell, $type); } - if ((!$this->_readDataOnly) && (isset($sheet->Objects))) { + if ((!$this->readDataOnly) && (isset($sheet->Objects))) { foreach ($sheet->Objects->children('gnm', true) as $key => $comment) { $commentAttributes = $comment->attributes(); // Only comment objects are handled at the moment if ($commentAttributes->Text) { - $objPHPExcel->getActiveSheet()->getComment((string)$commentAttributes->ObjectBound)->setAuthor((string)$commentAttributes->Author)->setText($this->_parseRichText((string)$commentAttributes->Text)); + $objPHPExcel->getActiveSheet()->getComment((string)$commentAttributes->ObjectBound)->setAuthor((string)$commentAttributes->Author)->setText($this->parseRichText((string)$commentAttributes->Text)); } } } @@ -487,13 +488,13 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx // var_dump($styleAttributes); // echo '
'; - // We still set the number format mask for date/time values, even if _readDataOnly is true - if ((!$this->_readDataOnly) || + // We still set the number format mask for date/time values, even if readDataOnly is true + if ((!$this->readDataOnly) || (PHPExcel_Shared_Date::isDateTimeFormatCode((string) $styleAttributes['Format']))) { $styleArray = array(); $styleArray['numberformat']['code'] = (string) $styleAttributes['Format']; - // If _readDataOnly is false, we set all formatting information - if (!$this->_readDataOnly) { + // If readDataOnly is false, we set all formatting information + if (!$this->readDataOnly) { switch ($styleAttributes['HAlign']) { case '1': $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; @@ -535,13 +536,13 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx $styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? true : false; $styleArray['alignment']['indent'] = (intval($styleAttributes["Indent"]) > 0) ? $styleAttributes["indent"] : 0; - $RGB = self::_parseGnumericColour($styleAttributes["Fore"]); + $RGB = self::parseGnumericColour($styleAttributes["Fore"]); $styleArray['font']['color']['rgb'] = $RGB; - $RGB = self::_parseGnumericColour($styleAttributes["Back"]); + $RGB = self::parseGnumericColour($styleAttributes["Back"]); $shade = $styleAttributes["Shade"]; if (($RGB != '000000') || ($shade != '0')) { $styleArray['fill']['color']['rgb'] = $styleArray['fill']['startcolor']['rgb'] = $RGB; - $RGB2 = self::_parseGnumericColour($styleAttributes["PatternColor"]); + $RGB2 = self::parseGnumericColour($styleAttributes["PatternColor"]); $styleArray['fill']['endcolor']['rgb'] = $RGB2; switch ($shade) { case '1': @@ -643,25 +644,25 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx if (isset($styleRegion->Style->StyleBorder)) { if (isset($styleRegion->Style->StyleBorder->Top)) { - $styleArray['borders']['top'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Top->attributes()); + $styleArray['borders']['top'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Top->attributes()); } if (isset($styleRegion->Style->StyleBorder->Bottom)) { - $styleArray['borders']['bottom'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Bottom->attributes()); + $styleArray['borders']['bottom'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Bottom->attributes()); } if (isset($styleRegion->Style->StyleBorder->Left)) { - $styleArray['borders']['left'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Left->attributes()); + $styleArray['borders']['left'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Left->attributes()); } if (isset($styleRegion->Style->StyleBorder->Right)) { - $styleArray['borders']['right'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Right->attributes()); + $styleArray['borders']['right'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Right->attributes()); } if ((isset($styleRegion->Style->StyleBorder->Diagonal)) && (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}))) { - $styleArray['borders']['diagonal'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes()); + $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes()); $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_BOTH; } elseif (isset($styleRegion->Style->StyleBorder->Diagonal)) { - $styleArray['borders']['diagonal'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes()); + $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes()); $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_UP; } elseif (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'})) { - $styleArray['borders']['diagonal'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}->attributes()); + $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}->attributes()); $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_DOWN; } } @@ -677,7 +678,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx } } - if ((!$this->_readDataOnly) && (isset($sheet->Cols))) { + if ((!$this->readDataOnly) && (isset($sheet->Cols))) { // Column Widths $columnAttributes = $sheet->Cols->attributes(); $defaultWidth = $columnAttributes['DefaultSizePts'] / 5.4; @@ -706,7 +707,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx } } - if ((!$this->_readDataOnly) && (isset($sheet->Rows))) { + if ((!$this->readDataOnly) && (isset($sheet->Rows))) { // Row Heights $rowAttributes = $sheet->Rows->attributes(); $defaultHeight = $rowAttributes['DefaultSizePts']; @@ -770,13 +771,11 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx return $objPHPExcel; } - private static function _parseBorderAttributes($borderAttributes) + private static function parseBorderAttributes($borderAttributes) { $styleArray = array(); - if (isset($borderAttributes["Color"])) { - $RGB = self::_parseGnumericColour($borderAttributes["Color"]); - $styleArray['color']['rgb'] = $RGB; + $styleArray['color']['rgb'] = self::parseGnumericColour($borderAttributes["Color"]); } switch ($borderAttributes["Style"]) { @@ -789,6 +788,9 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx case '2': $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUM; break; + case '3': + $styleArray['style'] = PHPExcel_Style_Border::BORDER_SLANTDASHDOT; + break; case '4': $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHED; break; @@ -801,6 +803,9 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx case '7': $styleArray['style'] = PHPExcel_Style_Border::BORDER_DOTTED; break; + case '8': + $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHED; + break; case '9': $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOT; break; @@ -816,33 +821,24 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx case '13': $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT; break; - case '3': - $styleArray['style'] = PHPExcel_Style_Border::BORDER_SLANTDASHDOT; - break; - case '8': - $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHED; - break; } return $styleArray; } - private function _parseRichText($is = '') + private function parseRichText($is = '') { $value = new PHPExcel_RichText(); - $value->createText($is); return $value; } - private static function _parseGnumericColour($gnmColour) + private static function parseGnumericColour($gnmColour) { list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour); $gnmR = substr(str_pad($gnmR, 4, '0', STR_PAD_RIGHT), 0, 2); $gnmG = substr(str_pad($gnmG, 4, '0', STR_PAD_RIGHT), 0, 2); $gnmB = substr(str_pad($gnmB, 4, '0', STR_PAD_RIGHT), 0, 2); - $RGB = $gnmR.$gnmG.$gnmB; -// echo 'Excel Colour: ', $RGB,'
'; - return $RGB; + return $gnmR . $gnmG . $gnmB; } } diff --git a/Classes/PHPExcel/Reader/HTML.php b/Classes/PHPExcel/Reader/HTML.php index a7272e4..dedc1da 100644 --- a/Classes/PHPExcel/Reader/HTML.php +++ b/Classes/PHPExcel/Reader/HTML.php @@ -42,52 +42,71 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ * * @var string */ - protected $_inputEncoding = 'ANSI'; + protected $inputEncoding = 'ANSI'; /** * Sheet index to read * * @var int */ - protected $_sheetIndex = 0; + protected $sheetIndex = 0; /** * Formats * * @var array */ - protected $_formats = array( - 'h1' => array('font' => array('bold' => true, + protected $formats = array( + 'h1' => array( + 'font' => array( + 'bold' => true, 'size' => 24, ), ), // Bold, 24pt - 'h2' => array('font' => array('bold' => true, + 'h2' => array( + 'font' => array( + 'bold' => true, 'size' => 18, ), ), // Bold, 18pt - 'h3' => array('font' => array('bold' => true, + 'h3' => array( + 'font' => array( + 'bold' => true, 'size' => 13.5, ), ), // Bold, 13.5pt - 'h4' => array('font' => array('bold' => true, + 'h4' => array( + 'font' => array( + 'bold' => true, 'size' => 12, ), ), // Bold, 12pt - 'h5' => array('font' => array('bold' => true, + 'h5' => array( + 'font' => array( + 'bold' => true, 'size' => 10, ), ), // Bold, 10pt - 'h6' => array('font' => array('bold' => true, + 'h6' => array( + 'font' => array( + 'bold' => true, 'size' => 7.5, ), ), // Bold, 7.5pt - 'a' => array('font' => array('underline' => true, - 'color' => array('argb' => PHPExcel_Style_Color::COLOR_BLUE, + 'a' => array( + 'font' => array( + 'underline' => true, + 'color' => array( + 'argb' => PHPExcel_Style_Color::COLOR_BLUE, ), ), ), // Blue underlined - 'hr' => array('borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN, - 'color' => array(\PHPExcel_Style_Color::COLOR_BLACK, + 'hr' => array( + 'borders' => array( + 'bottom' => array( + 'style' => PHPExcel_Style_Border::BORDER_THIN, + 'color' => array( + PHPExcel_Style_Color::COLOR_BLACK, ), ), ), @@ -101,7 +120,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ */ public function __construct() { - $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->readFilter = new PHPExcel_Reader_DefaultReadFilter(); } /** @@ -109,10 +128,10 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ * * @return boolean */ - protected function _isValidFormat() + protected function isValidFormat() { // Reading 2048 bytes should be enough to validate that the format is HTML - $data = fread($this->_fileHandle, 2048); + $data = fread($this->fileHandle, 2048); if ((strpos($data, '<') !== false) && (strlen($data) !== strlen(strip_tags($data)))) { return true; @@ -144,7 +163,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ */ public function setInputEncoding($pValue = 'ANSI') { - $this->_inputEncoding = $pValue; + $this->inputEncoding = $pValue; return $this; } @@ -156,7 +175,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ */ public function getInputEncoding() { - return $this->_inputEncoding; + return $this->inputEncoding; } // Data Array used for testing only, should write to PHPExcel object on completion of tests @@ -164,7 +183,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ protected $_tableLevel = 0; protected $_nestedColumn = array('A'); - protected function _setTableStartColumn($column) + protected function setTableStartColumn($column) { if ($this->_tableLevel == 0) { $column = 'A'; @@ -175,19 +194,19 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ return $this->_nestedColumn[$this->_tableLevel]; } - protected function _getTableStartColumn() + protected function getTableStartColumn() { return $this->_nestedColumn[$this->_tableLevel]; } - protected function _releaseTableStartColumn() + protected function releaseTableStartColumn() { --$this->_tableLevel; return array_pop($this->_nestedColumn); } - protected function _flushCell($sheet, $column, $row, &$cellContent) + protected function flushCell($sheet, $column, $row, &$cellContent) { if (is_string($cellContent)) { // Simple String content @@ -207,7 +226,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ $cellContent = (string) ''; } - protected function _processDomElement(DOMNode $element, $sheet, &$row, &$column, &$cellContent, $format = null) + protected function processDomElement(DOMNode $element, $sheet, &$row, &$column, &$cellContent, $format = null) { foreach ($element->childNodes as $child) { if ($child instanceof DOMText) { @@ -238,10 +257,10 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ break; } } - $this->_processDomElement($child, $sheet, $row, $column, $cellContent); + $this->processDomElement($child, $sheet, $row, $column, $cellContent); break; case 'title': - $this->_processDomElement($child, $sheet, $row, $column, $cellContent); + $this->processDomElement($child, $sheet, $row, $column, $cellContent); $sheet->setTitle($cellContent); $cellContent = ''; break; @@ -256,20 +275,20 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ if ($cellContent > '') { $cellContent .= ' '; } - $this->_processDomElement($child, $sheet, $row, $column, $cellContent); + $this->processDomElement($child, $sheet, $row, $column, $cellContent); if ($cellContent > '') { $cellContent .= ' '; } // echo 'END OF STYLING, SPAN OR DIV
'; break; case 'hr': - $this->_flushCell($sheet, $column, $row, $cellContent); + $this->flushCell($sheet, $column, $row, $cellContent); ++$row; - if (isset($this->_formats[$child->nodeName])) { - $sheet->getStyle($column . $row)->applyFromArray($this->_formats[$child->nodeName]); + if (isset($this->formats[$child->nodeName])) { + $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]); } else { $cellContent = '----------'; - $this->_flushCell($sheet, $column, $row, $cellContent); + $this->flushCell($sheet, $column, $row, $cellContent); } ++$row; case 'br': @@ -278,7 +297,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ $cellContent .= "\n"; } else { // Otherwise flush our existing content and move the row cursor on - $this->_flushCell($sheet, $column, $row, $cellContent); + $this->flushCell($sheet, $column, $row, $cellContent); ++$row; } // echo 'HARD LINE BREAK: ' , '
'; @@ -290,14 +309,14 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ case 'href': // echo 'Link to ' , $attributeValue , '
'; $sheet->getCell($column . $row)->getHyperlink()->setUrl($attributeValue); - if (isset($this->_formats[$child->nodeName])) { - $sheet->getStyle($column . $row)->applyFromArray($this->_formats[$child->nodeName]); + if (isset($this->formats[$child->nodeName])) { + $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]); } break; } } $cellContent .= ' '; - $this->_processDomElement($child, $sheet, $row, $column, $cellContent); + $this->processDomElement($child, $sheet, $row, $column, $cellContent); // echo 'END OF HYPERLINK:' , '
'; break; case 'h1': @@ -313,20 +332,20 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ // If we're inside a table, replace with a \n $cellContent .= "\n"; // echo 'LIST ENTRY: ' , '
'; - $this->_processDomElement($child, $sheet, $row, $column, $cellContent); + $this->processDomElement($child, $sheet, $row, $column, $cellContent); // echo 'END OF LIST ENTRY:' , '
'; } else { if ($cellContent > '') { - $this->_flushCell($sheet, $column, $row, $cellContent); + $this->flushCell($sheet, $column, $row, $cellContent); $row++; } // echo 'START OF PARAGRAPH: ' , '
'; - $this->_processDomElement($child, $sheet, $row, $column, $cellContent); + $this->processDomElement($child, $sheet, $row, $column, $cellContent); // echo 'END OF PARAGRAPH:' , '
'; - $this->_flushCell($sheet, $column, $row, $cellContent); + $this->flushCell($sheet, $column, $row, $cellContent); - if (isset($this->_formats[$child->nodeName])) { - $sheet->getStyle($column . $row)->applyFromArray($this->_formats[$child->nodeName]); + if (isset($this->formats[$child->nodeName])) { + $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]); } $row++; @@ -338,30 +357,30 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ // If we're inside a table, replace with a \n $cellContent .= "\n"; // echo 'LIST ENTRY: ' , '
'; - $this->_processDomElement($child, $sheet, $row, $column, $cellContent); + $this->processDomElement($child, $sheet, $row, $column, $cellContent); // echo 'END OF LIST ENTRY:' , '
'; } else { if ($cellContent > '') { - $this->_flushCell($sheet, $column, $row, $cellContent); + $this->flushCell($sheet, $column, $row, $cellContent); } ++$row; // echo 'LIST ENTRY: ' , '
'; - $this->_processDomElement($child, $sheet, $row, $column, $cellContent); + $this->processDomElement($child, $sheet, $row, $column, $cellContent); // echo 'END OF LIST ENTRY:' , '
'; - $this->_flushCell($sheet, $column, $row, $cellContent); + $this->flushCell($sheet, $column, $row, $cellContent); $column = 'A'; } break; case 'table': - $this->_flushCell($sheet, $column, $row, $cellContent); - $column = $this->_setTableStartColumn($column); + $this->flushCell($sheet, $column, $row, $cellContent); + $column = $this->setTableStartColumn($column); // echo 'START OF TABLE LEVEL ' , $this->_tableLevel , '
'; if ($this->_tableLevel > 1) { --$row; } - $this->_processDomElement($child, $sheet, $row, $column, $cellContent); + $this->processDomElement($child, $sheet, $row, $column, $cellContent); // echo 'END OF TABLE LEVEL ' , $this->_tableLevel , '
'; - $column = $this->_releaseTableStartColumn(); + $column = $this->releaseTableStartColumn(); if ($this->_tableLevel > 1) { ++$column; } else { @@ -370,27 +389,27 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ break; case 'thead': case 'tbody': - $this->_processDomElement($child, $sheet, $row, $column, $cellContent); + $this->processDomElement($child, $sheet, $row, $column, $cellContent); break; case 'tr': - $column = $this->_getTableStartColumn(); + $column = $this->getTableStartColumn(); $cellContent = ''; // echo 'START OF TABLE ' , $this->_tableLevel , ' ROW
'; - $this->_processDomElement($child, $sheet, $row, $column, $cellContent); + $this->processDomElement($child, $sheet, $row, $column, $cellContent); ++$row; // echo 'END OF TABLE ' , $this->_tableLevel , ' ROW
'; break; case 'th': case 'td': // echo 'START OF TABLE ' , $this->_tableLevel , ' CELL
'; - $this->_processDomElement($child, $sheet, $row, $column, $cellContent); + $this->processDomElement($child, $sheet, $row, $column, $cellContent); // echo 'END OF TABLE ' , $this->_tableLevel , ' CELL
'; while (isset($this->rowspan[$column . $row])) { ++$column; } - $this->_flushCell($sheet, $column, $row, $cellContent); + $this->flushCell($sheet, $column, $row, $cellContent); // if (isset($attributeArray['style']) && !empty($attributeArray['style'])) { // $styleAry = $this->getPhpExcelStyleArray($attributeArray['style']); @@ -435,10 +454,10 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ $column = 'A'; $content = ''; $this->_tableLevel = 0; - $this->_processDomElement($child, $sheet, $row, $column, $cellContent); + $this->processDomElement($child, $sheet, $row, $column, $cellContent); break; default: - $this->_processDomElement($child, $sheet, $row, $column, $cellContent); + $this->processDomElement($child, $sheet, $row, $column, $cellContent); } } } @@ -455,19 +474,19 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) { // Open file to validate - $this->_openFile($pFilename); - if (!$this->_isValidFormat()) { - fclose($this->_fileHandle); + $this->openFile($pFilename); + if (!$this->isValidFormat()) { + fclose($this->fileHandle); throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid HTML file."); } // Close after validating - fclose($this->_fileHandle); + fclose($this->fileHandle); // Create new PHPExcel - while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { + while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) { $objPHPExcel->createSheet(); } - $objPHPExcel->setActiveSheetIndex($this->_sheetIndex); + $objPHPExcel->setActiveSheetIndex($this->sheetIndex); // Create a new DOM object $dom = new domDocument; @@ -483,7 +502,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ $row = 0; $column = 'A'; $content = ''; - $this->_processDomElement($dom, $objPHPExcel->getActiveSheet(), $row, $column, $content); + $this->processDomElement($dom, $objPHPExcel->getActiveSheet(), $row, $column, $content); // Return return $objPHPExcel; @@ -496,7 +515,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ */ public function getSheetIndex() { - return $this->_sheetIndex; + return $this->sheetIndex; } /** @@ -507,7 +526,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_ */ public function setSheetIndex($pValue = 0) { - $this->_sheetIndex = $pValue; + $this->sheetIndex = $pValue; return $this; } diff --git a/Classes/PHPExcel/Reader/IReadFilter.php b/Classes/PHPExcel/Reader/IReadFilter.php index 0006cf3..f7c852d 100644 --- a/Classes/PHPExcel/Reader/IReadFilter.php +++ b/Classes/PHPExcel/Reader/IReadFilter.php @@ -30,10 +30,10 @@ interface PHPExcel_Reader_IReadFilter /** * Should this cell be read? * - * @param $column String column index - * @param $row Row index + * @param $column Column address (as a string value like "A", or "IV") + * @param $row Row number * @param $worksheetName Optional worksheet name - * @return boolean + * @return boolean */ public function readCell($column, $row, $worksheetName = ''); } diff --git a/Classes/PHPExcel/Reader/IReader.php b/Classes/PHPExcel/Reader/IReader.php index 79d098f..9034546 100644 --- a/Classes/PHPExcel/Reader/IReader.php +++ b/Classes/PHPExcel/Reader/IReader.php @@ -1,6 +1,7 @@ _readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->readFilter = new PHPExcel_Reader_DefaultReadFilter(); } /** @@ -438,8 +438,8 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce $worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']); // print_r($worksheetDataAttributes); // echo '
'; - if ((isset($this->_loadSheetsOnly)) && (isset($worksheetDataAttributes['name'])) && - (!in_array($worksheetDataAttributes['name'], $this->_loadSheetsOnly))) { + if ((isset($this->loadSheetsOnly)) && (isset($worksheetDataAttributes['name'])) && + (!in_array($worksheetDataAttributes['name'], $this->loadSheetsOnly))) { continue; } @@ -657,7 +657,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce // Merged cells if ((isset($cellDataTableAttributes['number-columns-spanned'])) || (isset($cellDataTableAttributes['number-rows-spanned']))) { - if (($type !== PHPExcel_Cell_DataType::TYPE_NULL) || (!$this->_readDataOnly)) { + if (($type !== PHPExcel_Cell_DataType::TYPE_NULL) || (!$this->readDataOnly)) { $columnTo = $columnID; if (isset($cellDataTableAttributes['number-columns-spanned'])) { $columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cellDataTableAttributes['number-columns-spanned'] -2); diff --git a/Classes/PHPExcel/Reader/SYLK.php b/Classes/PHPExcel/Reader/SYLK.php index a7f3f17..eb7ef1a 100644 --- a/Classes/PHPExcel/Reader/SYLK.php +++ b/Classes/PHPExcel/Reader/SYLK.php @@ -1,6 +1,16 @@ _readFilter = new PHPExcel_Reader_DefaultReadFilter(); + $this->readFilter = new PHPExcel_Reader_DefaultReadFilter(); } /** @@ -85,10 +77,10 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ * * @return boolean */ - protected function _isValidFormat() + protected function isValidFormat() { // Read sample data (first 2 KB will do) - $data = fread($this->_fileHandle, 2048); + $data = fread($this->fileHandle, 2048); // Count delimiters in file $delimiterCount = substr_count($data, ';'); @@ -135,12 +127,12 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ public function listWorksheetInfo($pFilename) { // Open file - $this->_openFile($pFilename); - if (!$this->_isValidFormat()) { - fclose($this->_fileHandle); + $this->openFile($pFilename); + if (!$this->isValidFormat()) { + fclose($this->fileHandle); throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } - $fileHandle = $this->_fileHandle; + $fileHandle = $this->fileHandle; rewind($fileHandle); $worksheetInfo = array(); @@ -222,12 +214,12 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) { // Open file - $this->_openFile($pFilename); - if (!$this->_isValidFormat()) { - fclose($this->_fileHandle); + $this->openFile($pFilename); + if (!$this->isValidFormat()) { + fclose($this->fileHandle); throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } - $fileHandle = $this->_fileHandle; + $fileHandle = $this->fileHandle; rewind($fileHandle); // Create new PHPExcel diff --git a/Classes/PHPExcel/Shared/CodePage.php b/Classes/PHPExcel/Shared/CodePage.php index 13c166a..b9df3b4 100644 --- a/Classes/PHPExcel/Shared/CodePage.php +++ b/Classes/PHPExcel/Shared/CodePage.php @@ -39,154 +39,105 @@ class PHPExcel_Shared_CodePage { switch ($codePage) { case 367: - return 'ASCII'; - break; // ASCII + return 'ASCII'; // ASCII case 437: - return 'CP437'; - break; // OEM US + return 'CP437'; // OEM US case 720: - throw new PHPExcel_Exception('Code page 720 not supported.'); - break; // OEM Arabic + throw new PHPExcel_Exception('Code page 720 not supported.'); // OEM Arabic case 737: - return 'CP737'; - break; // OEM Greek + return 'CP737'; // OEM Greek case 775: - return 'CP775'; - break; // OEM Baltic + return 'CP775'; // OEM Baltic case 850: - return 'CP850'; - break; // OEM Latin I + return 'CP850'; // OEM Latin I case 852: - return 'CP852'; - break; // OEM Latin II (Central European) + return 'CP852'; // OEM Latin II (Central European) case 855: - return 'CP855'; - break; // OEM Cyrillic + return 'CP855'; // OEM Cyrillic case 857: - return 'CP857'; - break; // OEM Turkish + return 'CP857'; // OEM Turkish case 858: - return 'CP858'; - break; // OEM Multilingual Latin I with Euro + return 'CP858'; // OEM Multilingual Latin I with Euro case 860: - return 'CP860'; - break; // OEM Portugese + return 'CP860'; // OEM Portugese case 861: - return 'CP861'; - break; // OEM Icelandic + return 'CP861'; // OEM Icelandic case 862: - return 'CP862'; - break; // OEM Hebrew + return 'CP862'; // OEM Hebrew case 863: - return 'CP863'; - break; // OEM Canadian (French) + return 'CP863'; // OEM Canadian (French) case 864: - return 'CP864'; - break; // OEM Arabic + return 'CP864'; // OEM Arabic case 865: - return 'CP865'; - break; // OEM Nordic + return 'CP865'; // OEM Nordic case 866: - return 'CP866'; - break; // OEM Cyrillic (Russian) + return 'CP866'; // OEM Cyrillic (Russian) case 869: - return 'CP869'; - break; // OEM Greek (Modern) + return 'CP869'; // OEM Greek (Modern) case 874: - return 'CP874'; - break; // ANSI Thai + return 'CP874'; // ANSI Thai case 932: - return 'CP932'; - break; // ANSI Japanese Shift-JIS + return 'CP932'; // ANSI Japanese Shift-JIS case 936: - return 'CP936'; - break; // ANSI Chinese Simplified GBK + return 'CP936'; // ANSI Chinese Simplified GBK case 949: - return 'CP949'; - break; // ANSI Korean (Wansung) + return 'CP949'; // ANSI Korean (Wansung) case 950: - return 'CP950'; - break; // ANSI Chinese Traditional BIG5 + return 'CP950'; // ANSI Chinese Traditional BIG5 case 1200: - return 'UTF-16LE'; - break; // UTF-16 (BIFF8) + return 'UTF-16LE'; // UTF-16 (BIFF8) case 1250: - return 'CP1250'; - break; // ANSI Latin II (Central European) + return 'CP1250'; // ANSI Latin II (Central European) case 1251: - return 'CP1251'; - break; // ANSI Cyrillic + return 'CP1251'; // ANSI Cyrillic case 0: - // CodePage is not always correctly set when the xls file was saved by Apple's Numbers program + // CodePage is not always correctly set when the xls file was saved by Apple's Numbers program case 1252: - return 'CP1252'; - break; // ANSI Latin I (BIFF4-BIFF7) + return 'CP1252'; // ANSI Latin I (BIFF4-BIFF7) case 1253: - return 'CP1253'; - break; // ANSI Greek + return 'CP1253'; // ANSI Greek case 1254: - return 'CP1254'; - break; // ANSI Turkish + return 'CP1254'; // ANSI Turkish case 1255: - return 'CP1255'; - break; // ANSI Hebrew + return 'CP1255'; // ANSI Hebrew case 1256: - return 'CP1256'; - break; // ANSI Arabic + return 'CP1256'; // ANSI Arabic case 1257: - return 'CP1257'; - break; // ANSI Baltic + return 'CP1257'; // ANSI Baltic case 1258: - return 'CP1258'; - break; // ANSI Vietnamese + return 'CP1258'; // ANSI Vietnamese case 1361: - return 'CP1361'; - break; // ANSI Korean (Johab) + return 'CP1361'; // ANSI Korean (Johab) case 10000: - return 'MAC'; - break; // Apple Roman + return 'MAC'; // Apple Roman case 10001: - return 'CP932'; - break; // Macintosh Japanese + return 'CP932'; // Macintosh Japanese case 10002: - return 'CP950'; - break; // Macintosh Chinese Traditional + return 'CP950'; // Macintosh Chinese Traditional case 10003: - return 'CP1361'; - break; // Macintosh Korean + return 'CP1361'; // Macintosh Korean case 10006: - return 'MACGREEK'; - break; // Macintosh Greek + return 'MACGREEK'; // Macintosh Greek case 10007: - return 'MACCYRILLIC'; - break; // Macintosh Cyrillic + return 'MACCYRILLIC'; // Macintosh Cyrillic case 10008: - return 'CP936'; - break; // Macintosh - Simplified Chinese (GB 2312) + return 'CP936'; // Macintosh - Simplified Chinese (GB 2312) case 10029: - return 'MACCENTRALEUROPE'; - break; // Macintosh Central Europe + return 'MACCENTRALEUROPE'; // Macintosh Central Europe case 10079: - return 'MACICELAND'; - break; // Macintosh Icelandic + return 'MACICELAND'; // Macintosh Icelandic case 10081: - return 'MACTURKISH'; - break; // Macintosh Turkish + return 'MACTURKISH'; // Macintosh Turkish case 21010: - return 'UTF-16LE'; - break; // UTF-16 (BIFF8) This isn't correct, but some Excel writer libraries erroneously use Codepage 21010 for UTF-16LE + return 'UTF-16LE'; // UTF-16 (BIFF8) This isn't correct, but some Excel writer libraries erroneously use Codepage 21010 for UTF-16LE case 32768: - return 'MAC'; - break; // Apple Roman + return 'MAC'; // Apple Roman case 32769: - throw new PHPExcel_Exception('Code page 32769 not supported.'); - break; // ANSI Latin I (BIFF2-BIFF3) + throw new PHPExcel_Exception('Code page 32769 not supported.'); // ANSI Latin I (BIFF2-BIFF3) case 65000: - return 'UTF-7'; - break; // Unicode (UTF-7) + return 'UTF-7'; // Unicode (UTF-7) case 65001: - return 'UTF-8'; - break; // Unicode (UTF-8) + return 'UTF-8'; // Unicode (UTF-8) } throw new PHPExcel_Exception('Unknown codepage: ' . $codePage); } diff --git a/Classes/PHPExcel/Shared/OLERead.php b/Classes/PHPExcel/Shared/OLERead.php index 48b24ee..6b15d97 100644 --- a/Classes/PHPExcel/Shared/OLERead.php +++ b/Classes/PHPExcel/Shared/OLERead.php @@ -94,19 +94,19 @@ class PHPExcel_Shared_OLERead $this->data = file_get_contents($sFileName); // Total number of sectors used for the SAT - $this->numBigBlockDepotBlocks = self::_GetInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS); + $this->numBigBlockDepotBlocks = self::getInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS); // SecID of the first sector of the directory stream - $this->rootStartBlock = self::_GetInt4d($this->data, self::ROOT_START_BLOCK_POS); + $this->rootStartBlock = self::getInt4d($this->data, self::ROOT_START_BLOCK_POS); // SecID of the first sector of the SSAT (or -2 if not extant) - $this->sbdStartBlock = self::_GetInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS); + $this->sbdStartBlock = self::getInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS); // SecID of the first sector of the MSAT (or -2 if no additional sectors are used) - $this->extensionBlock = self::_GetInt4d($this->data, self::EXTENSION_BLOCK_POS); + $this->extensionBlock = self::getInt4d($this->data, self::EXTENSION_BLOCK_POS); // Total number of sectors used by MSAT - $this->numExtensionBlocks = self::_GetInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS); + $this->numExtensionBlocks = self::getInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS); $bigBlockDepotBlocks = array(); $pos = self::BIG_BLOCK_DEPOT_BLOCKS_POS; @@ -118,7 +118,7 @@ class PHPExcel_Shared_OLERead } for ($i = 0; $i < $bbdBlocks; ++$i) { - $bigBlockDepotBlocks[$i] = self::_GetInt4d($this->data, $pos); + $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos); $pos += 4; } @@ -127,13 +127,13 @@ class PHPExcel_Shared_OLERead $blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1); for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; ++$i) { - $bigBlockDepotBlocks[$i] = self::_GetInt4d($this->data, $pos); + $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos); $pos += 4; } $bbdBlocks += $blocksToRead; if ($bbdBlocks < $this->numBigBlockDepotBlocks) { - $this->extensionBlock = self::_GetInt4d($this->data, $pos); + $this->extensionBlock = self::getInt4d($this->data, $pos); } } @@ -156,14 +156,14 @@ class PHPExcel_Shared_OLERead $this->smallBlockChain .= substr($this->data, $pos, 4*$bbs); $pos += 4*$bbs; - $sbdBlock = self::_GetInt4d($this->bigBlockChain, $sbdBlock*4); + $sbdBlock = self::getInt4d($this->bigBlockChain, $sbdBlock*4); } // read the directory stream $block = $this->rootStartBlock; $this->entry = $this->_readData($block); - $this->_readPropertySets(); + $this->readPropertySets(); } /** @@ -188,7 +188,7 @@ class PHPExcel_Shared_OLERead $pos = $block * self::SMALL_BLOCK_SIZE; $streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE); - $block = self::_GetInt4d($this->smallBlockChain, $block*4); + $block = self::getInt4d($this->smallBlockChain, $block*4); } return $streamData; @@ -207,7 +207,7 @@ class PHPExcel_Shared_OLERead while ($block != -2) { $pos = ($block + 1) * self::BIG_BLOCK_SIZE; $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); - $block = self::_GetInt4d($this->bigBlockChain, $block*4); + $block = self::getInt4d($this->bigBlockChain, $block*4); } return $streamData; @@ -228,7 +228,7 @@ class PHPExcel_Shared_OLERead while ($block != -2) { $pos = ($block + 1) * self::BIG_BLOCK_SIZE; $data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); - $block = self::_GetInt4d($this->bigBlockChain, $block*4); + $block = self::getInt4d($this->bigBlockChain, $block*4); } return $data; } @@ -236,7 +236,7 @@ class PHPExcel_Shared_OLERead /** * Read entries in the directory stream. */ - private function _readPropertySets() + private function readPropertySets() { $offset = 0; @@ -254,9 +254,9 @@ class PHPExcel_Shared_OLERead // sectorID of first sector or short sector, if this entry refers to a stream (the case with workbook) // sectorID of first sector of the short-stream container stream, if this entry is root entry - $startBlock = self::_GetInt4d($d, self::START_BLOCK_POS); + $startBlock = self::getInt4d($d, self::START_BLOCK_POS); - $size = self::_GetInt4d($d, self::SIZE_POS); + $size = self::getInt4d($d, self::SIZE_POS); $name = str_replace("\x00", "", substr($d, 0, $nameSize)); @@ -301,7 +301,7 @@ class PHPExcel_Shared_OLERead * @param int $pos * @return int */ - private static function _GetInt4d($data, $pos) + private static function getInt4d($data, $pos) { // FIX: represent numbers correctly on 64-bit system // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334 diff --git a/Classes/PHPExcel/Worksheet/AutoFilter.php b/Classes/PHPExcel/Worksheet/AutoFilter.php index e86f978..6ec8a44 100644 --- a/Classes/PHPExcel/Worksheet/AutoFilter.php +++ b/Classes/PHPExcel/Worksheet/AutoFilter.php @@ -1,6 +1,7 @@ _range = $pRange; - $this->_workSheet = $pSheet; + $this->range = $pRange; + $this->workSheet = $pSheet; } /** @@ -78,7 +70,7 @@ class PHPExcel_Worksheet_AutoFilter */ public function getParent() { - return $this->_workSheet; + return $this->workSheet; } /** @@ -89,7 +81,7 @@ class PHPExcel_Worksheet_AutoFilter */ public function setParent(PHPExcel_Worksheet $pSheet = null) { - $this->_workSheet = $pSheet; + $this->workSheet = $pSheet; return $this; } @@ -101,7 +93,7 @@ class PHPExcel_Worksheet_AutoFilter */ public function getRange() { - return $this->_range; + return $this->range; } /** @@ -120,23 +112,23 @@ class PHPExcel_Worksheet_AutoFilter } if (strpos($pRange, ':') !== false) { - $this->_range = $pRange; + $this->range = $pRange; } elseif (empty($pRange)) { - $this->_range = ''; + $this->range = ''; } else { throw new PHPExcel_Exception('Autofilter must be set on a range of cells.'); } if (empty($pRange)) { // Discard all column rules - $this->_columns = array(); + $this->columns = array(); } else { // Discard any column rules that are no longer valid within this range - list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range); - foreach ($this->_columns as $key => $value) { + list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range); + foreach ($this->columns as $key => $value) { $colIndex = PHPExcel_Cell::columnIndexFromString($key); if (($rangeStart[0] > $colIndex) || ($rangeEnd[0] < $colIndex)) { - unset($this->_columns[$key]); + unset($this->columns[$key]); } } } @@ -152,7 +144,7 @@ class PHPExcel_Worksheet_AutoFilter */ public function getColumns() { - return $this->_columns; + return $this->columns; } /** @@ -164,12 +156,12 @@ class PHPExcel_Worksheet_AutoFilter */ public function testColumnInRange($column) { - if (empty($this->_range)) { + if (empty($this->range)) { throw new PHPExcel_Exception("No autofilter range is defined."); } $columnIndex = PHPExcel_Cell::columnIndexFromString($column); - list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range); + list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range); if (($rangeStart[0] > $columnIndex) || ($rangeEnd[0] < $columnIndex)) { throw new PHPExcel_Exception("Column is outside of current autofilter range."); } @@ -200,11 +192,11 @@ class PHPExcel_Worksheet_AutoFilter { $this->testColumnInRange($pColumn); - if (!isset($this->_columns[$pColumn])) { - $this->_columns[$pColumn] = new PHPExcel_Worksheet_AutoFilter_Column($pColumn, $this); + if (!isset($this->columns[$pColumn])) { + $this->columns[$pColumn] = new PHPExcel_Worksheet_AutoFilter_Column($pColumn, $this); } - return $this->_columns[$pColumn]; + return $this->columns[$pColumn]; } /** @@ -216,7 +208,7 @@ class PHPExcel_Worksheet_AutoFilter */ public function getColumnByOffset($pColumnOffset = 0) { - list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range); + list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range); $pColumn = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1); return $this->getColumn($pColumn); @@ -242,12 +234,12 @@ class PHPExcel_Worksheet_AutoFilter $this->testColumnInRange($column); if (is_string($pColumn)) { - $this->_columns[$pColumn] = new PHPExcel_Worksheet_AutoFilter_Column($pColumn, $this); + $this->columns[$pColumn] = new PHPExcel_Worksheet_AutoFilter_Column($pColumn, $this); } elseif (is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) { $pColumn->setParent($this); - $this->_columns[$column] = $pColumn; + $this->columns[$column] = $pColumn; } - ksort($this->_columns); + ksort($this->columns); return $this; } @@ -263,8 +255,8 @@ class PHPExcel_Worksheet_AutoFilter { $this->testColumnInRange($pColumn); - if (isset($this->_columns[$pColumn])) { - unset($this->_columns[$pColumn]); + if (isset($this->columns[$pColumn])) { + unset($this->columns[$pColumn]); } return $this; @@ -286,14 +278,14 @@ class PHPExcel_Worksheet_AutoFilter $fromColumn = strtoupper($fromColumn); $toColumn = strtoupper($toColumn); - if (($fromColumn !== null) && (isset($this->_columns[$fromColumn])) && ($toColumn !== null)) { - $this->_columns[$fromColumn]->setParent(); - $this->_columns[$fromColumn]->setColumnIndex($toColumn); - $this->_columns[$toColumn] = $this->_columns[$fromColumn]; - $this->_columns[$toColumn]->setParent($this); - unset($this->_columns[$fromColumn]); + if (($fromColumn !== null) && (isset($this->columns[$fromColumn])) && ($toColumn !== null)) { + $this->columns[$fromColumn]->setParent(); + $this->columns[$fromColumn]->setColumnIndex($toColumn); + $this->columns[$toColumn] = $this->columns[$fromColumn]; + $this->columns[$toColumn]->setParent($this); + unset($this->columns[$fromColumn]); - ksort($this->_columns); + ksort($this->columns); } return $this; @@ -307,7 +299,7 @@ class PHPExcel_Worksheet_AutoFilter * @param mixed[] $dataSet * @return boolean */ - private static function _filterTestInSimpleDataSet($cellValue, $dataSet) + private static function filterTestInSimpleDataSet($cellValue, $dataSet) { $dataSetValues = $dataSet['filterValues']; $blanks = $dataSet['blanks']; @@ -324,7 +316,7 @@ class PHPExcel_Worksheet_AutoFilter * @param mixed[] $dataSet * @return boolean */ - private static function _filterTestInDateGroupSet($cellValue, $dataSet) + private static function filterTestInDateGroupSet($cellValue, $dataSet) { $dateSet = $dataSet['filterValues']; $blanks = $dataSet['blanks']; @@ -364,7 +356,7 @@ class PHPExcel_Worksheet_AutoFilter * @param mixed[] $ruleSet * @return boolean */ - private static function _filterTestInCustomDataSet($cellValue, $ruleSet) + private static function filterTestInCustomDataSet($cellValue, $ruleSet) { $dataSet = $ruleSet['filterRules']; $join = $ruleSet['join']; @@ -442,7 +434,7 @@ class PHPExcel_Worksheet_AutoFilter * @param mixed[] $monthSet * @return boolean */ - private static function _filterTestInPeriodDateSet($cellValue, $monthSet) + private static function filterTestInPeriodDateSet($cellValue, $monthSet) { // Blank cells are always ignored, so return a FALSE if (($cellValue == '') || ($cellValue === null)) { @@ -464,8 +456,8 @@ class PHPExcel_Worksheet_AutoFilter * * @var array */ - private static $_fromReplace = array('\*', '\?', '~~', '~.*', '~.?'); - private static $_toReplace = array('.*', '.', '~', '\*', '\?'); + private static $fromReplace = array('\*', '\?', '~~', '~.*', '~.?'); + private static $toReplace = array('.*', '.', '~', '\*', '\?'); /** @@ -475,7 +467,7 @@ class PHPExcel_Worksheet_AutoFilter * @param PHPExcel_Worksheet_AutoFilter_Column &$filterColumn * @return mixed[] */ - private function _dynamicFilterDateRange($dynamicRuleType, &$filterColumn) + private function dynamicFilterDateRange($dynamicRuleType, &$filterColumn) { $rDateType = PHPExcel_Calculation_Functions::getReturnDateType(); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); @@ -574,13 +566,13 @@ class PHPExcel_Worksheet_AutoFilter $ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN, 'value' => $maxVal); PHPExcel_Calculation_Functions::setReturnDateType($rDateType); - return array('method' => '_filterTestInCustomDataSet', 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND)); + return array('method' => 'filterTestInCustomDataSet', 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND)); } - private function _calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue) + private function calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue) { $range = $columnID.$startRow.':'.$columnID.$endRow; - $dataValues = PHPExcel_Calculation_Functions::flattenArray($this->_workSheet->rangeToArray($range, null, true, false)); + $dataValues = PHPExcel_Calculation_Functions::flattenArray($this->workSheet->rangeToArray($range, null, true, false)); $dataValues = array_filter($dataValues); if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) { @@ -600,14 +592,14 @@ class PHPExcel_Worksheet_AutoFilter */ public function showHideRows() { - list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range); + list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range); // The heading row should always be visible // echo 'AutoFilter Heading Row ', $rangeStart[1],' is always SHOWN',PHP_EOL; - $this->_workSheet->getRowDimension($rangeStart[1])->setVisible(true); + $this->workSheet->getRowDimension($rangeStart[1])->setVisible(true); $columnFilterTests = array(); - foreach ($this->_columns as $columnID => $filterColumn) { + foreach ($this->columns as $columnID => $filterColumn) { $rules = $filterColumn->getRules(); switch ($filterColumn->getFilterType()) { case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER: @@ -626,7 +618,7 @@ class PHPExcel_Worksheet_AutoFilter if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER) { // Filter on absolute values $columnFilterTests[$columnID] = array( - 'method' => '_filterTestInSimpleDataSet', + 'method' => 'filterTestInSimpleDataSet', 'arguments' => array('filterValues' => $ruleDataSet, 'blanks' => $blanks) ); } else { @@ -672,7 +664,7 @@ class PHPExcel_Worksheet_AutoFilter $arguments['time'] = array_filter($arguments['time']); $arguments['dateTime'] = array_filter($arguments['dateTime']); $columnFilterTests[$columnID] = array( - 'method' => '_filterTestInDateGroupSet', + 'method' => 'filterTestInDateGroupSet', 'arguments' => array('filterValues' => $arguments, 'blanks' => $blanks) ); } @@ -687,7 +679,7 @@ class PHPExcel_Worksheet_AutoFilter if (!is_numeric($ruleValue)) { // Convert to a regexp allowing for regexp reserved characters, wildcards and escaped wildcards $ruleValue = preg_quote($ruleValue); - $ruleValue = str_replace(self::$_fromReplace, self::$_toReplace, $ruleValue); + $ruleValue = str_replace(self::$fromReplace, self::$toReplace, $ruleValue); if (trim($ruleValue) == '') { $customRuleForBlanks = true; $ruleValue = trim($ruleValue); @@ -697,7 +689,7 @@ class PHPExcel_Worksheet_AutoFilter } $join = $filterColumn->getJoin(); $columnFilterTests[$columnID] = array( - 'method' => '_filterTestInCustomDataSet', + 'method' => 'filterTestInCustomDataSet', 'arguments' => array('filterRules' => $ruleValues, 'join' => $join, 'customRuleForBlanks' => $customRuleForBlanks) ); break; @@ -711,7 +703,7 @@ class PHPExcel_Worksheet_AutoFilter // Number (Average) based // Calculate the average $averageFormula = '=AVERAGE('.$columnID.($rangeStart[1]+1).':'.$columnID.$rangeEnd[1].')'; - $average = PHPExcel_Calculation::getInstance()->calculateFormula($averageFormula, null, $this->_workSheet->getCell('A1')); + $average = PHPExcel_Calculation::getInstance()->calculateFormula($averageFormula, null, $this->workSheet->getCell('A1')); // Set above/below rule based on greaterThan or LessTan $operator = ($dynamicRuleType === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) ? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN @@ -720,7 +712,7 @@ class PHPExcel_Worksheet_AutoFilter 'value' => $average ); $columnFilterTests[$columnID] = array( - 'method' => '_filterTestInCustomDataSet', + 'method' => 'filterTestInCustomDataSet', 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR) ); } else { @@ -737,13 +729,13 @@ class PHPExcel_Worksheet_AutoFilter $ruleValues = range($periodStart, $periodEnd); } $columnFilterTests[$columnID] = array( - 'method' => '_filterTestInPeriodDateSet', + 'method' => 'filterTestInPeriodDateSet', 'arguments' => $ruleValues ); $filterColumn->setAttributes(array()); } else { // Date Range - $columnFilterTests[$columnID] = $this->_dynamicFilterDateRange($dynamicRuleType, $filterColumn); + $columnFilterTests[$columnID] = $this->dynamicFilterDateRange($dynamicRuleType, $filterColumn); break; } } @@ -768,14 +760,14 @@ class PHPExcel_Worksheet_AutoFilter $ruleValue = 500; } - $maxVal = $this->_calculateTopTenValue($columnID, $rangeStart[1]+1, $rangeEnd[1], $toptenRuleType, $ruleValue); + $maxVal = $this->calculateTopTenValue($columnID, $rangeStart[1]+1, $rangeEnd[1], $toptenRuleType, $ruleValue); $operator = ($toptenRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL : PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL; $ruleValues[] = array('operator' => $operator, 'value' => $maxVal); $columnFilterTests[$columnID] = array( - 'method' => '_filterTestInCustomDataSet', + 'method' => 'filterTestInCustomDataSet', 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR) ); $filterColumn->setAttributes(array('maxVal' => $maxVal)); @@ -792,7 +784,7 @@ class PHPExcel_Worksheet_AutoFilter $result = true; foreach ($columnFilterTests as $columnID => $columnFilterTest) { // echo 'Testing cell ', $columnID.$row,PHP_EOL; - $cellValue = $this->_workSheet->getCell($columnID.$row)->getCalculatedValue(); + $cellValue = $this->workSheet->getCell($columnID.$row)->getCalculatedValue(); // echo 'Value is ', $cellValue,PHP_EOL; // Execute the filter test $result = $result && @@ -808,7 +800,7 @@ class PHPExcel_Worksheet_AutoFilter } // Set show/hide for the row based on the result of the autoFilter result // echo (($result) ? 'SHOW' : 'HIDE'),PHP_EOL; - $this->_workSheet->getRowDimension($row)->setVisible($result); + $this->workSheet->getRowDimension($row)->setVisible($result); } return $this; @@ -823,13 +815,13 @@ class PHPExcel_Worksheet_AutoFilter $vars = get_object_vars($this); foreach ($vars as $key => $value) { if (is_object($value)) { - if ($key == '_workSheet') { + if ($key == 'workSheet') { // Detach from worksheet $this->{$key} = null; } else { $this->{$key} = clone $value; } - } elseif ((is_array($value)) && ($key == '_columns')) { + } elseif ((is_array($value)) && ($key == 'columns')) { // The columns array of PHPExcel_Worksheet_AutoFilter objects $this->{$key} = array(); foreach ($value as $k => $v) { @@ -849,6 +841,6 @@ class PHPExcel_Worksheet_AutoFilter */ public function __toString() { - return (string) $this->_range; + return (string) $this->range; } } diff --git a/Classes/PHPExcel/Worksheet/AutoFilter/Column.php b/Classes/PHPExcel/Worksheet/AutoFilter/Column.php index e30cb3c..d64fd81 100644 --- a/Classes/PHPExcel/Worksheet/AutoFilter/Column.php +++ b/Classes/PHPExcel/Worksheet/AutoFilter/Column.php @@ -1,6 +1,7 @@ _columnIndex = $pColumn; - $this->_parent = $pParent; + $this->columnIndex = $pColumn; + $this->parent = $pParent; } /** @@ -141,7 +133,7 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function getColumnIndex() { - return $this->_columnIndex; + return $this->columnIndex; } /** @@ -155,11 +147,11 @@ class PHPExcel_Worksheet_AutoFilter_Column { // Uppercase coordinate $pColumn = strtoupper($pColumn); - if ($this->_parent !== null) { - $this->_parent->testColumnInRange($pColumn); + if ($this->parent !== null) { + $this->parent->testColumnInRange($pColumn); } - $this->_columnIndex = $pColumn; + $this->columnIndex = $pColumn; return $this; } @@ -171,7 +163,7 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function getParent() { - return $this->_parent; + return $this->parent; } /** @@ -182,7 +174,7 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = null) { - $this->_parent = $pParent; + $this->parent = $pParent; return $this; } @@ -194,7 +186,7 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function getFilterType() { - return $this->_filterType; + return $this->filterType; } /** @@ -206,11 +198,11 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER) { - if (!in_array($pFilterType, self::$_filterTypes)) { + if (!in_array($pFilterType, self::$filterTypes)) { throw new PHPExcel_Exception('Invalid filter type for column AutoFilter.'); } - $this->_filterType = $pFilterType; + $this->filterType = $pFilterType; return $this; } @@ -222,7 +214,7 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function getJoin() { - return $this->_join; + return $this->join; } /** @@ -236,11 +228,11 @@ class PHPExcel_Worksheet_AutoFilter_Column { // Lowercase And/Or $pJoin = strtolower($pJoin); - if (!in_array($pJoin, self::$_ruleJoins)) { + if (!in_array($pJoin, self::$ruleJoins)) { throw new PHPExcel_Exception('Invalid rule connection for column AutoFilter.'); } - $this->_join = $pJoin; + $this->join = $pJoin; return $this; } @@ -254,7 +246,7 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function setAttributes($pAttributes = array()) { - $this->_attributes = $pAttributes; + $this->attributes = $pAttributes; return $this; } @@ -269,7 +261,7 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function setAttribute($pName, $pValue) { - $this->_attributes[$pName] = $pValue; + $this->attributes[$pName] = $pValue; return $this; } @@ -281,7 +273,7 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function getAttributes() { - return $this->_attributes; + return $this->attributes; } /** @@ -292,8 +284,8 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function getAttribute($pName) { - if (isset($this->_attributes[$pName])) { - return $this->_attributes[$pName]; + if (isset($this->attributes[$pName])) { + return $this->attributes[$pName]; } return null; } @@ -306,7 +298,7 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function getRules() { - return $this->_ruleset; + return $this->ruleset; } /** @@ -317,10 +309,10 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function getRule($pIndex) { - if (!isset($this->_ruleset[$pIndex])) { - $this->_ruleset[$pIndex] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this); + if (!isset($this->ruleset[$pIndex])) { + $this->ruleset[$pIndex] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this); } - return $this->_ruleset[$pIndex]; + return $this->ruleset[$pIndex]; } /** @@ -330,9 +322,9 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function createRule() { - $this->_ruleset[] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this); + $this->ruleset[] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this); - return end($this->_ruleset); + return end($this->ruleset); } /** @@ -345,7 +337,7 @@ class PHPExcel_Worksheet_AutoFilter_Column public function addRule(PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule, $returnRule = true) { $pRule->setParent($this); - $this->_ruleset[] = $pRule; + $this->ruleset[] = $pRule; return ($returnRule) ? $pRule : $this; } @@ -359,10 +351,10 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function deleteRule($pIndex) { - if (isset($this->_ruleset[$pIndex])) { - unset($this->_ruleset[$pIndex]); + if (isset($this->ruleset[$pIndex])) { + unset($this->ruleset[$pIndex]); // If we've just deleted down to a single rule, then reset And/Or joining to Or - if (count($this->_ruleset) <= 1) { + if (count($this->ruleset) <= 1) { $this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR); } } @@ -377,7 +369,7 @@ class PHPExcel_Worksheet_AutoFilter_Column */ public function clearRules() { - $this->_ruleset = array(); + $this->ruleset = array(); $this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR); return $this; @@ -391,13 +383,13 @@ class PHPExcel_Worksheet_AutoFilter_Column $vars = get_object_vars($this); foreach ($vars as $key => $value) { if (is_object($value)) { - if ($key == '_parent') { + if ($key == 'parent') { // Detach from autofilter parent $this->$key = null; } else { $this->$key = clone $value; } - } elseif ((is_array($value)) && ($key == '_ruleset')) { + } elseif ((is_array($value)) && ($key == 'ruleset')) { // The columns array of PHPExcel_Worksheet_AutoFilter objects $this->$key = array(); foreach ($value as $k => $v) { diff --git a/Classes/PHPExcel/Worksheet/AutoFilter/Column/Rule.php b/Classes/PHPExcel/Worksheet/AutoFilter/Column/Rule.php index 2250bcd..39ad18b 100644 --- a/Classes/PHPExcel/Worksheet/AutoFilter/Column/Rule.php +++ b/Classes/PHPExcel/Worksheet/AutoFilter/Column/Rule.php @@ -1,6 +1,7 @@ * */ - const AUTOFILTER_COLUMN_RULE_EQUAL = 'equal'; - const AUTOFILTER_COLUMN_RULE_NOTEQUAL = 'notEqual'; + const AUTOFILTER_COLUMN_RULE_EQUAL = 'equal'; + const AUTOFILTER_COLUMN_RULE_NOTEQUAL = 'notEqual'; const AUTOFILTER_COLUMN_RULE_GREATERTHAN = 'greaterThan'; - const AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL = 'greaterThanOrEqual'; - const AUTOFILTER_COLUMN_RULE_LESSTHAN = 'lessThan'; + const AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL = 'greaterThanOrEqual'; + const AUTOFILTER_COLUMN_RULE_LESSTHAN = 'lessThan'; const AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL = 'lessThanOrEqual'; - private static $_operators = array( + private static $operators = array( self::AUTOFILTER_COLUMN_RULE_EQUAL, self::AUTOFILTER_COLUMN_RULE_NOTEQUAL, self::AUTOFILTER_COLUMN_RULE_GREATERTHAN, @@ -178,18 +170,18 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule self::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL, ); - const AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE = 'byValue'; - const AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT = 'byPercent'; + const AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE = 'byValue'; + const AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT = 'byPercent'; - private static $_topTenValue = array( + private static $topTenValue = array( self::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE, self::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT, ); - const AUTOFILTER_COLUMN_RULE_TOPTEN_TOP = 'top'; - const AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM = 'bottom'; + const AUTOFILTER_COLUMN_RULE_TOPTEN_TOP = 'top'; + const AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM = 'bottom'; - private static $_topTenType = array( + private static $topTenType = array( self::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP, self::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM, ); @@ -234,7 +226,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule * * @var PHPExcel_Worksheet_AutoFilter_Column */ - private $_parent = null; + private $parent = null; /** @@ -242,7 +234,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule * * @var string */ - private $_ruleType = self::AUTOFILTER_RULETYPE_FILTER; + private $ruleType = self::AUTOFILTER_RULETYPE_FILTER; /** @@ -250,21 +242,21 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule * * @var string */ - private $_value = ''; + private $value = ''; /** * Autofilter Rule Operator * * @var string */ - private $_operator = self::AUTOFILTER_COLUMN_RULE_EQUAL; + private $operator = self::AUTOFILTER_COLUMN_RULE_EQUAL; /** * DateTimeGrouping Group Value * * @var string */ - private $_grouping = ''; + private $grouping = ''; /** @@ -274,7 +266,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule */ public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = null) { - $this->_parent = $pParent; + $this->parent = $pParent; } /** @@ -284,7 +276,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule */ public function getRuleType() { - return $this->_ruleType; + return $this->ruleType; } /** @@ -296,11 +288,11 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule */ public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER) { - if (!in_array($pRuleType, self::$_ruleTypes)) { + if (!in_array($pRuleType, self::$ruleTypes)) { throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.'); } - $this->_ruleType = $pRuleType; + $this->ruleType = $pRuleType; return $this; } @@ -312,7 +304,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule */ public function getValue() { - return $this->_value; + return $this->value; } /** @@ -328,21 +320,21 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule $grouping = -1; foreach ($pValue as $key => $value) { // Validate array entries - if (!in_array($key, self::$_dateTimeGroups)) { + if (!in_array($key, self::$dateTimeGroups)) { // Remove any invalid entries from the value array unset($pValue[$key]); } else { // Work out what the dateTime grouping will be - $grouping = max($grouping, array_search($key, self::$_dateTimeGroups)); + $grouping = max($grouping, array_search($key, self::$dateTimeGroups)); } } if (count($pValue) == 0) { throw new PHPExcel_Exception('Invalid rule value for column AutoFilter Rule.'); } // Set the dateTime grouping that we've anticipated - $this->setGrouping(self::$_dateTimeGroups[$grouping]); + $this->setGrouping(self::$dateTimeGroups[$grouping]); } - $this->_value = $pValue; + $this->value = $pValue; return $this; } @@ -354,7 +346,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule */ public function getOperator() { - return $this->_operator; + return $this->operator; } /** @@ -369,11 +361,11 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule if (empty($pOperator)) { $pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL; } - if ((!in_array($pOperator, self::$_operators)) && - (!in_array($pOperator, self::$_topTenValue))) { + if ((!in_array($pOperator, self::$operators)) && + (!in_array($pOperator, self::$topTenValue))) { throw new PHPExcel_Exception('Invalid operator for column AutoFilter Rule.'); } - $this->_operator = $pOperator; + $this->operator = $pOperator; return $this; } @@ -385,7 +377,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule */ public function getGrouping() { - return $this->_grouping; + return $this->grouping; } /** @@ -398,12 +390,12 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule public function setGrouping($pGrouping = null) { if (($pGrouping !== null) && - (!in_array($pGrouping, self::$_dateTimeGroups)) && - (!in_array($pGrouping, self::$_dynamicTypes)) && - (!in_array($pGrouping, self::$_topTenType))) { + (!in_array($pGrouping, self::$dateTimeGroups)) && + (!in_array($pGrouping, self::$dynamicTypes)) && + (!in_array($pGrouping, self::$topTenType))) { throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.'); } - $this->_grouping = $pGrouping; + $this->grouping = $pGrouping; return $this; } @@ -438,7 +430,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule */ public function getParent() { - return $this->_parent; + return $this->parent; } /** @@ -449,7 +441,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule */ public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = null) { - $this->_parent = $pParent; + $this->parent = $pParent; return $this; } @@ -462,7 +454,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule $vars = get_object_vars($this); foreach ($vars as $key => $value) { if (is_object($value)) { - if ($key == '_parent') { + if ($key == 'parent') { // Detach from autofilter column parent $this->$key = null; } else { diff --git a/Classes/PHPExcel/Worksheet/BaseDrawing.php b/Classes/PHPExcel/Worksheet/BaseDrawing.php index 9ae35ad..d63c282 100644 --- a/Classes/PHPExcel/Worksheet/BaseDrawing.php +++ b/Classes/PHPExcel/Worksheet/BaseDrawing.php @@ -1,6 +1,7 @@ _shadow = new PHPExcel_Worksheet_Drawing_Shadow(); // Set image index - self::$_imageCounter++; - $this->_imageIndex = self::$_imageCounter; + self::$imageCounter++; + $this->imageIndex = self::$imageCounter; } /** @@ -156,7 +148,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable */ public function getImageIndex() { - return $this->_imageIndex; + return $this->imageIndex; } /** @@ -483,7 +475,19 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable */ public function getHashCode() { - return md5($this->_name.$this->_description.$this->_worksheet->getHashCode().$this->_coordinates.$this->_offsetX.$this->_offsetY.$this->_width.$this->_height.$this->_rotation.$this->_shadow->getHashCode().__CLASS__); + return md5( + $this->_name . + $this->_description . + $this->_worksheet->getHashCode() . + $this->_coordinates . + $this->_offsetX . + $this->_offsetY . + $this->_width . + $this->_height . + $this->_rotation . + $this->_shadow->getHashCode() . + __CLASS__ + ); } /** diff --git a/Classes/PHPExcel/Worksheet/Drawing.php b/Classes/PHPExcel/Worksheet/Drawing.php index 983bda4..e259c3c 100644 --- a/Classes/PHPExcel/Worksheet/Drawing.php +++ b/Classes/PHPExcel/Worksheet/Drawing.php @@ -1,6 +1,7 @@ _path = ''; + $this->path = ''; // Initialize parent parent::__construct(); @@ -61,7 +53,7 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen */ public function getFilename() { - return basename($this->_path); + return basename($this->path); } /** @@ -83,7 +75,7 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen */ public function getExtension() { - $exploded = explode(".", basename($this->_path)); + $exploded = explode(".", basename($this->path)); return $exploded[count($exploded) - 1]; } @@ -94,7 +86,7 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen */ public function getPath() { - return $this->_path; + return $this->path; } /** @@ -109,7 +101,7 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen { if ($pVerifyFile) { if (file_exists($pValue)) { - $this->_path = $pValue; + $this->path = $pValue; if ($this->_width == 0 && $this->_height == 0) { // Get width/height @@ -119,7 +111,7 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen throw new PHPExcel_Exception("File $pValue not found!"); } } else { - $this->_path = $pValue; + $this->path = $pValue; } return $this; } @@ -132,9 +124,9 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen public function getHashCode() { return md5( - $this->_path - . parent::getHashCode() - . __CLASS__ + $this->path . + parent::getHashCode() . + __CLASS__ ); } diff --git a/Classes/PHPExcel/Worksheet/Drawing/Shadow.php b/Classes/PHPExcel/Worksheet/Drawing/Shadow.php index 9806bb9..84db91d 100644 --- a/Classes/PHPExcel/Worksheet/Drawing/Shadow.php +++ b/Classes/PHPExcel/Worksheet/Drawing/Shadow.php @@ -1,6 +1,7 @@ _visible = false; - $this->_blurRadius = 6; - $this->_distance = 2; - $this->_direction = 0; - $this->_alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT; - $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK); - $this->_alpha = 50; + $this->visible = false; + $this->blurRadius = 6; + $this->distance = 2; + $this->direction = 0; + $this->alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT; + $this->color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK); + $this->alpha = 50; } /** @@ -120,7 +112,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable */ public function getVisible() { - return $this->_visible; + return $this->visible; } /** @@ -131,7 +123,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable */ public function setVisible($pValue = false) { - $this->_visible = $pValue; + $this->visible = $pValue; return $this; } @@ -142,7 +134,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable */ public function getBlurRadius() { - return $this->_blurRadius; + return $this->blurRadius; } /** @@ -153,7 +145,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable */ public function setBlurRadius($pValue = 6) { - $this->_blurRadius = $pValue; + $this->blurRadius = $pValue; return $this; } @@ -164,7 +156,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable */ public function getDistance() { - return $this->_distance; + return $this->distance; } /** @@ -175,7 +167,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable */ public function setDistance($pValue = 2) { - $this->_distance = $pValue; + $this->distance = $pValue; return $this; } @@ -186,7 +178,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable */ public function getDirection() { - return $this->_direction; + return $this->direction; } /** @@ -197,7 +189,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable */ public function setDirection($pValue = 0) { - $this->_direction = $pValue; + $this->direction = $pValue; return $this; } @@ -208,7 +200,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable */ public function getAlignment() { - return $this->_alignment; + return $this->alignment; } /** @@ -219,7 +211,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable */ public function setAlignment($pValue = 0) { - $this->_alignment = $pValue; + $this->alignment = $pValue; return $this; } @@ -230,7 +222,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable */ public function getColor() { - return $this->_color; + return $this->color; } /** @@ -242,7 +234,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable */ public function setColor(PHPExcel_Style_Color $pValue = null) { - $this->_color = $pValue; + $this->color = $pValue; return $this; } @@ -253,7 +245,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable */ public function getAlpha() { - return $this->_alpha; + return $this->alpha; } /** @@ -264,7 +256,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable */ public function setAlpha($pValue = 0) { - $this->_alpha = $pValue; + $this->alpha = $pValue; return $this; } @@ -276,14 +268,14 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable public function getHashCode() { return md5( - ($this->_visible ? 't' : 'f') - . $this->_blurRadius - . $this->_distance - . $this->_direction - . $this->_alignment - . $this->_color->getHashCode() - . $this->_alpha - . __CLASS__ + ($this->visible ? 't' : 'f') . + $this->blurRadius . + $this->distance . + $this->direction . + $this->alignment . + $this->color->getHashCode() . + $this->alpha . + __CLASS__ ); } diff --git a/Classes/PHPExcel/Worksheet/HeaderFooter.php b/Classes/PHPExcel/Worksheet/HeaderFooter.php index 394baf7..3a88923 100644 --- a/Classes/PHPExcel/Worksheet/HeaderFooter.php +++ b/Classes/PHPExcel/Worksheet/HeaderFooter.php @@ -1,6 +1,6 @@ * Header/Footer Formatting Syntax taken from Office Open XML Part 4 - Markup Language Reference, page 1970: @@ -89,96 +84,93 @@ * &H - code for "shadow style" * * - * @category PHPExcel - * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_HeaderFooter { /* Header/footer image location */ - const IMAGE_HEADER_LEFT = 'LH'; - const IMAGE_HEADER_CENTER = 'CH'; - const IMAGE_HEADER_RIGHT = 'RH'; - const IMAGE_FOOTER_LEFT = 'LF'; - const IMAGE_FOOTER_CENTER = 'CF'; - const IMAGE_FOOTER_RIGHT = 'RF'; + const IMAGE_HEADER_LEFT = 'LH'; + const IMAGE_HEADER_CENTER = 'CH'; + const IMAGE_HEADER_RIGHT = 'RH'; + const IMAGE_FOOTER_LEFT = 'LF'; + const IMAGE_FOOTER_CENTER = 'CF'; + const IMAGE_FOOTER_RIGHT = 'RF'; /** * OddHeader * * @var string */ - private $_oddHeader = ''; + private $oddHeader = ''; /** * OddFooter * * @var string */ - private $_oddFooter = ''; + private $oddFooter = ''; /** * EvenHeader * * @var string */ - private $_evenHeader = ''; + private $evenHeader = ''; /** * EvenFooter * * @var string */ - private $_evenFooter = ''; + private $evenFooter = ''; /** * FirstHeader * * @var string */ - private $_firstHeader = ''; + private $firstHeader = ''; /** * FirstFooter * * @var string */ - private $_firstFooter = ''; + private $firstFooter = ''; /** * Different header for Odd/Even, defaults to false * * @var boolean */ - private $_differentOddEven = false; + private $differentOddEven = false; /** * Different header for first page, defaults to false * * @var boolean */ - private $_differentFirst = false; + private $differentFirst = false; /** * Scale with document, defaults to true * * @var boolean */ - private $_scaleWithDocument = true; + private $scaleWithDocument = true; /** * Align with margins, defaults to true * * @var boolean */ - private $_alignWithMargins = true; + private $alignWithMargins = true; /** * Header/footer images * * @var PHPExcel_Worksheet_HeaderFooterDrawing[] */ - private $_headerFooterImages = array(); + private $headerFooterImages = array(); /** * Create a new PHPExcel_Worksheet_HeaderFooter @@ -194,7 +186,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function getOddHeader() { - return $this->_oddHeader; + return $this->oddHeader; } /** @@ -205,7 +197,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function setOddHeader($pValue) { - $this->_oddHeader = $pValue; + $this->oddHeader = $pValue; return $this; } @@ -216,7 +208,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function getOddFooter() { - return $this->_oddFooter; + return $this->oddFooter; } /** @@ -227,7 +219,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function setOddFooter($pValue) { - $this->_oddFooter = $pValue; + $this->oddFooter = $pValue; return $this; } @@ -238,7 +230,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function getEvenHeader() { - return $this->_evenHeader; + return $this->evenHeader; } /** @@ -249,7 +241,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function setEvenHeader($pValue) { - $this->_evenHeader = $pValue; + $this->evenHeader = $pValue; return $this; } @@ -260,7 +252,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function getEvenFooter() { - return $this->_evenFooter; + return $this->evenFooter; } /** @@ -271,7 +263,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function setEvenFooter($pValue) { - $this->_evenFooter = $pValue; + $this->evenFooter = $pValue; return $this; } @@ -282,7 +274,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function getFirstHeader() { - return $this->_firstHeader; + return $this->firstHeader; } /** @@ -293,7 +285,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function setFirstHeader($pValue) { - $this->_firstHeader = $pValue; + $this->firstHeader = $pValue; return $this; } @@ -304,7 +296,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function getFirstFooter() { - return $this->_firstFooter; + return $this->firstFooter; } /** @@ -315,7 +307,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function setFirstFooter($pValue) { - $this->_firstFooter = $pValue; + $this->firstFooter = $pValue; return $this; } @@ -326,7 +318,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function getDifferentOddEven() { - return $this->_differentOddEven; + return $this->differentOddEven; } /** @@ -337,7 +329,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function setDifferentOddEven($pValue = false) { - $this->_differentOddEven = $pValue; + $this->differentOddEven = $pValue; return $this; } @@ -348,7 +340,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function getDifferentFirst() { - return $this->_differentFirst; + return $this->differentFirst; } /** @@ -359,7 +351,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function setDifferentFirst($pValue = false) { - $this->_differentFirst = $pValue; + $this->differentFirst = $pValue; return $this; } @@ -370,7 +362,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function getScaleWithDocument() { - return $this->_scaleWithDocument; + return $this->scaleWithDocument; } /** @@ -381,7 +373,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function setScaleWithDocument($pValue = true) { - $this->_scaleWithDocument = $pValue; + $this->scaleWithDocument = $pValue; return $this; } @@ -392,7 +384,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function getAlignWithMargins() { - return $this->_alignWithMargins; + return $this->alignWithMargins; } /** @@ -403,7 +395,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function setAlignWithMargins($pValue = true) { - $this->_alignWithMargins = $pValue; + $this->alignWithMargins = $pValue; return $this; } @@ -417,7 +409,7 @@ class PHPExcel_Worksheet_HeaderFooter */ public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT) { - $this->_headerFooterImages[$location] = $image; + $this->headerFooterImages[$location] = $image; return $this; } @@ -430,8 +422,8 @@ class PHPExcel_Worksheet_HeaderFooter */ public function removeImage($location = self::IMAGE_HEADER_LEFT) { - if (isset($this->_headerFooterImages[$location])) { - unset($this->_headerFooterImages[$location]); + if (isset($this->headerFooterImages[$location])) { + unset($this->headerFooterImages[$location]); } return $this; } @@ -449,7 +441,7 @@ class PHPExcel_Worksheet_HeaderFooter throw new PHPExcel_Exception('Invalid parameter!'); } - $this->_headerFooterImages = $images; + $this->headerFooterImages = $images; return $this; } @@ -462,27 +454,27 @@ class PHPExcel_Worksheet_HeaderFooter { // Sort array $images = array(); - if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) { - $images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT]; + if (isset($this->headerFooterImages[self::IMAGE_HEADER_LEFT])) { + $images[self::IMAGE_HEADER_LEFT] = $this->headerFooterImages[self::IMAGE_HEADER_LEFT]; } - if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) { - $images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER]; + if (isset($this->headerFooterImages[self::IMAGE_HEADER_CENTER])) { + $images[self::IMAGE_HEADER_CENTER] = $this->headerFooterImages[self::IMAGE_HEADER_CENTER]; } - if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) { - $images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT]; + if (isset($this->headerFooterImages[self::IMAGE_HEADER_RIGHT])) { + $images[self::IMAGE_HEADER_RIGHT] = $this->headerFooterImages[self::IMAGE_HEADER_RIGHT]; } - if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) { - $images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT]; + if (isset($this->headerFooterImages[self::IMAGE_FOOTER_LEFT])) { + $images[self::IMAGE_FOOTER_LEFT] = $this->headerFooterImages[self::IMAGE_FOOTER_LEFT]; } - if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) { - $images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER]; + if (isset($this->headerFooterImages[self::IMAGE_FOOTER_CENTER])) { + $images[self::IMAGE_FOOTER_CENTER] = $this->headerFooterImages[self::IMAGE_FOOTER_CENTER]; } - if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) { - $images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT]; + if (isset($this->headerFooterImages[self::IMAGE_FOOTER_RIGHT])) { + $images[self::IMAGE_FOOTER_RIGHT] = $this->headerFooterImages[self::IMAGE_FOOTER_RIGHT]; } - $this->_headerFooterImages = $images; + $this->headerFooterImages = $images; - return $this->_headerFooterImages; + return $this->headerFooterImages; } /** diff --git a/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php b/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php index 6c1fa1f..a491f4b 100644 --- a/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php +++ b/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php @@ -1,6 +1,7 @@ _path = ''; - $this->_name = ''; - $this->_offsetX = 0; - $this->_offsetY = 0; - $this->_width = 0; - $this->_height = 0; - $this->_resizeProportional = true; + $this->path = ''; + $this->name = ''; + $this->offsetX = 0; + $this->offsetY = 0; + $this->width = 0; + $this->height = 0; + $this->resizeProportional = true; } /** @@ -106,7 +98,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing */ public function getName() { - return $this->_name; + return $this->name; } /** @@ -117,7 +109,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing */ public function setName($pValue = '') { - $this->_name = $pValue; + $this->name = $pValue; return $this; } @@ -128,7 +120,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing */ public function getOffsetX() { - return $this->_offsetX; + return $this->offsetX; } /** @@ -139,7 +131,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing */ public function setOffsetX($pValue = 0) { - $this->_offsetX = $pValue; + $this->offsetX = $pValue; return $this; } @@ -150,7 +142,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing */ public function getOffsetY() { - return $this->_offsetY; + return $this->offsetY; } /** @@ -161,7 +153,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing */ public function setOffsetY($pValue = 0) { - $this->_offsetY = $pValue; + $this->offsetY = $pValue; return $this; } @@ -172,7 +164,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing */ public function getWidth() { - return $this->_width; + return $this->width; } /** @@ -184,13 +176,13 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing public function setWidth($pValue = 0) { // Resize proportional? - if ($this->_resizeProportional && $pValue != 0) { - $ratio = $this->_width / $this->_height; - $this->_height = round($ratio * $pValue); + if ($this->resizeProportional && $pValue != 0) { + $ratio = $this->width / $this->height; + $this->height = round($ratio * $pValue); } // Set width - $this->_width = $pValue; + $this->width = $pValue; return $this; } @@ -202,7 +194,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing */ public function getHeight() { - return $this->_height; + return $this->height; } /** @@ -214,13 +206,13 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing public function setHeight($pValue = 0) { // Resize proportional? - if ($this->_resizeProportional && $pValue != 0) { - $ratio = $this->_width / $this->_height; - $this->_width = round($ratio * $pValue); + if ($this->resizeProportional && $pValue != 0) { + $ratio = $this->width / $this->height; + $this->width = round($ratio * $pValue); } // Set height - $this->_height = $pValue; + $this->height = $pValue; return $this; } @@ -240,15 +232,15 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing */ public function setWidthAndHeight($width = 0, $height = 0) { - $xratio = $width / $this->_width; - $yratio = $height / $this->_height; - if ($this->_resizeProportional && !($width == 0 || $height == 0)) { - if (($xratio * $this->_height) < $height) { - $this->_height = ceil($xratio * $this->_height); - $this->_width = $width; + $xratio = $width / $this->width; + $yratio = $height / $this->height; + if ($this->resizeProportional && !($width == 0 || $height == 0)) { + if (($xratio * $this->height) < $height) { + $this->height = ceil($xratio * $this->height); + $this->width = $width; } else { - $this->_width = ceil($yratio * $this->_width); - $this->_height = $height; + $this->width = ceil($yratio * $this->width); + $this->height = $height; } } return $this; @@ -261,7 +253,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing */ public function getResizeProportional() { - return $this->_resizeProportional; + return $this->resizeProportional; } /** @@ -272,7 +264,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing */ public function setResizeProportional($pValue = true) { - $this->_resizeProportional = $pValue; + $this->resizeProportional = $pValue; return $this; } @@ -283,7 +275,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing */ public function getFilename() { - return basename($this->_path); + return basename($this->path); } /** @@ -293,7 +285,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing */ public function getExtension() { - $parts = explode(".", basename($this->_path)); + $parts = explode(".", basename($this->path)); return end($parts); } @@ -304,7 +296,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing */ public function getPath() { - return $this->_path; + return $this->path; } /** @@ -319,17 +311,17 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing { if ($pVerifyFile) { if (file_exists($pValue)) { - $this->_path = $pValue; + $this->path = $pValue; - if ($this->_width == 0 && $this->_height == 0) { + if ($this->width == 0 && $this->height == 0) { // Get width/height - list($this->_width, $this->_height) = getimagesize($pValue); + list($this->width, $this->height) = getimagesize($pValue); } } else { throw new PHPExcel_Exception("File $pValue not found!"); } } else { - $this->_path = $pValue; + $this->path = $pValue; } return $this; } @@ -342,13 +334,13 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing public function getHashCode() { return md5( - $this->_path - . $this->_name - . $this->_offsetX - . $this->_offsetY - . $this->_width - . $this->_height - . __CLASS__ + $this->path . + $this->name . + $this->offsetX . + $this->offsetY . + $this->width . + $this->height . + __CLASS__ ); } diff --git a/Classes/PHPExcel/Worksheet/MemoryDrawing.php b/Classes/PHPExcel/Worksheet/MemoryDrawing.php index 04f8d11..119a752 100644 --- a/Classes/PHPExcel/Worksheet/MemoryDrawing.php +++ b/Classes/PHPExcel/Worksheet/MemoryDrawing.php @@ -1,6 +1,7 @@ _imageResource = null; - $this->_renderingFunction = self::RENDERING_DEFAULT; - $this->_mimeType = self::MIMETYPE_DEFAULT; - $this->_uniqueName = md5(rand(0, 9999). time() . rand(0, 9999)); + $this->imageResource = null; + $this->renderingFunction = self::RENDERING_DEFAULT; + $this->mimeType = self::MIMETYPE_DEFAULT; + $this->uniqueName = md5(rand(0, 9999). time() . rand(0, 9999)); // Initialize parent parent::__construct(); @@ -97,7 +89,7 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im */ public function getImageResource() { - return $this->_imageResource; + return $this->imageResource; } /** @@ -108,12 +100,12 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im */ public function setImageResource($value = null) { - $this->_imageResource = $value; + $this->imageResource = $value; - if (!is_null($this->_imageResource)) { + if (!is_null($this->imageResource)) { // Get width/height - $this->_width = imagesx($this->_imageResource); - $this->_height = imagesy($this->_imageResource); + $this->_width = imagesx($this->imageResource); + $this->_height = imagesy($this->imageResource); } return $this; } @@ -125,7 +117,7 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im */ public function getRenderingFunction() { - return $this->_renderingFunction; + return $this->renderingFunction; } /** @@ -136,7 +128,7 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im */ public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT) { - $this->_renderingFunction = $value; + $this->renderingFunction = $value; return $this; } @@ -147,7 +139,7 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im */ public function getMimeType() { - return $this->_mimeType; + return $this->mimeType; } /** @@ -158,7 +150,7 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im */ public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT) { - $this->_mimeType = $value; + $this->mimeType = $value; return $this; } @@ -169,11 +161,11 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im */ public function getIndexedFilename() { - $extension = strtolower($this->getMimeType()); - $extension = explode('/', $extension); - $extension = $extension[1]; + $extension = strtolower($this->getMimeType()); + $extension = explode('/', $extension); + $extension = $extension[1]; - return $this->_uniqueName . $this->getImageIndex() . '.' . $extension; + return $this->uniqueName . $this->getImageIndex() . '.' . $extension; } /** @@ -184,11 +176,11 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im public function getHashCode() { return md5( - $this->_renderingFunction - . $this->_mimeType - . $this->_uniqueName - . parent::getHashCode() - . __CLASS__ + $this->renderingFunction . + $this->mimeType . + $this->uniqueName . + parent::getHashCode() . + __CLASS__ ); } diff --git a/Classes/PHPExcel/Worksheet/PageSetup.php b/Classes/PHPExcel/Worksheet/PageSetup.php index 1e9df19..c67053e 100644 --- a/Classes/PHPExcel/Worksheet/PageSetup.php +++ b/Classes/PHPExcel/Worksheet/PageSetup.php @@ -189,14 +189,14 @@ class PHPExcel_Worksheet_PageSetup * * @var int */ - private $_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER; + private $paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER; /** * Orientation * * @var string */ - private $_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT; + private $orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT; /** * Scale (Print Scale) @@ -206,7 +206,7 @@ class PHPExcel_Worksheet_PageSetup * * @var int? */ - private $_scale = 100; + private $scale = 100; /** * Fit To Page @@ -214,7 +214,7 @@ class PHPExcel_Worksheet_PageSetup * * @var boolean */ - private $_fitToPage = false; + private $fitToPage = false; /** * Fit To Height @@ -222,7 +222,7 @@ class PHPExcel_Worksheet_PageSetup * * @var int? */ - private $_fitToHeight = 1; + private $fitToHeight = 1; /** * Fit To Width @@ -230,49 +230,49 @@ class PHPExcel_Worksheet_PageSetup * * @var int? */ - private $_fitToWidth = 1; + private $fitToWidth = 1; /** * Columns to repeat at left * * @var array Containing start column and end column, empty array if option unset */ - private $_columnsToRepeatAtLeft = array('', ''); + private $columnsToRepeatAtLeft = array('', ''); /** * Rows to repeat at top * * @var array Containing start row number and end row number, empty array if option unset */ - private $_rowsToRepeatAtTop = array(0, 0); + private $rowsToRepeatAtTop = array(0, 0); /** * Center page horizontally * * @var boolean */ - private $_horizontalCentered = false; + private $horizontalCentered = false; /** * Center page vertically * * @var boolean */ - private $_verticalCentered = false; + private $verticalCentered = false; /** * Print area * * @var string */ - private $_printArea = null; + private $printArea = null; /** * First page number * * @var int */ - private $_firstPageNumber = null; + private $firstPageNumber = null; /** * Create a new PHPExcel_Worksheet_PageSetup @@ -288,7 +288,7 @@ class PHPExcel_Worksheet_PageSetup */ public function getPaperSize() { - return $this->_paperSize; + return $this->paperSize; } /** @@ -299,7 +299,7 @@ class PHPExcel_Worksheet_PageSetup */ public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER) { - $this->_paperSize = $pValue; + $this->paperSize = $pValue; return $this; } @@ -310,7 +310,7 @@ class PHPExcel_Worksheet_PageSetup */ public function getOrientation() { - return $this->_orientation; + return $this->orientation; } /** @@ -321,7 +321,7 @@ class PHPExcel_Worksheet_PageSetup */ public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) { - $this->_orientation = $pValue; + $this->orientation = $pValue; return $this; } @@ -332,7 +332,7 @@ class PHPExcel_Worksheet_PageSetup */ public function getScale() { - return $this->_scale; + return $this->scale; } /** @@ -351,9 +351,9 @@ class PHPExcel_Worksheet_PageSetup // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface, // but it is apparently still able to handle any scale >= 0, where 0 results in 100 if (($pValue >= 0) || is_null($pValue)) { - $this->_scale = $pValue; + $this->scale = $pValue; if ($pUpdate) { - $this->_fitToPage = false; + $this->fitToPage = false; } } else { throw new PHPExcel_Exception("Scale must not be negative"); @@ -368,7 +368,7 @@ class PHPExcel_Worksheet_PageSetup */ public function getFitToPage() { - return $this->_fitToPage; + return $this->fitToPage; } /** @@ -379,7 +379,7 @@ class PHPExcel_Worksheet_PageSetup */ public function setFitToPage($pValue = true) { - $this->_fitToPage = $pValue; + $this->fitToPage = $pValue; return $this; } @@ -390,7 +390,7 @@ class PHPExcel_Worksheet_PageSetup */ public function getFitToHeight() { - return $this->_fitToHeight; + return $this->fitToHeight; } /** @@ -402,9 +402,9 @@ class PHPExcel_Worksheet_PageSetup */ public function setFitToHeight($pValue = 1, $pUpdate = true) { - $this->_fitToHeight = $pValue; + $this->fitToHeight = $pValue; if ($pUpdate) { - $this->_fitToPage = true; + $this->fitToPage = true; } return $this; } @@ -416,7 +416,7 @@ class PHPExcel_Worksheet_PageSetup */ public function getFitToWidth() { - return $this->_fitToWidth; + return $this->fitToWidth; } /** @@ -428,9 +428,9 @@ class PHPExcel_Worksheet_PageSetup */ public function setFitToWidth($pValue = 1, $pUpdate = true) { - $this->_fitToWidth = $pValue; + $this->fitToWidth = $pValue; if ($pUpdate) { - $this->_fitToPage = true; + $this->fitToPage = true; } return $this; } @@ -442,8 +442,8 @@ class PHPExcel_Worksheet_PageSetup */ public function isColumnsToRepeatAtLeftSet() { - if (is_array($this->_columnsToRepeatAtLeft)) { - if ($this->_columnsToRepeatAtLeft[0] != '' && $this->_columnsToRepeatAtLeft[1] != '') { + if (is_array($this->columnsToRepeatAtLeft)) { + if ($this->columnsToRepeatAtLeft[0] != '' && $this->columnsToRepeatAtLeft[1] != '') { return true; } } @@ -458,7 +458,7 @@ class PHPExcel_Worksheet_PageSetup */ public function getColumnsToRepeatAtLeft() { - return $this->_columnsToRepeatAtLeft; + return $this->columnsToRepeatAtLeft; } /** @@ -470,7 +470,7 @@ class PHPExcel_Worksheet_PageSetup public function setColumnsToRepeatAtLeft($pValue = null) { if (is_array($pValue)) { - $this->_columnsToRepeatAtLeft = $pValue; + $this->columnsToRepeatAtLeft = $pValue; } return $this; } @@ -484,7 +484,7 @@ class PHPExcel_Worksheet_PageSetup */ public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A') { - $this->_columnsToRepeatAtLeft = array($pStart, $pEnd); + $this->columnsToRepeatAtLeft = array($pStart, $pEnd); return $this; } @@ -495,8 +495,8 @@ class PHPExcel_Worksheet_PageSetup */ public function isRowsToRepeatAtTopSet() { - if (is_array($this->_rowsToRepeatAtTop)) { - if ($this->_rowsToRepeatAtTop[0] != 0 && $this->_rowsToRepeatAtTop[1] != 0) { + if (is_array($this->rowsToRepeatAtTop)) { + if ($this->rowsToRepeatAtTop[0] != 0 && $this->rowsToRepeatAtTop[1] != 0) { return true; } } @@ -511,7 +511,7 @@ class PHPExcel_Worksheet_PageSetup */ public function getRowsToRepeatAtTop() { - return $this->_rowsToRepeatAtTop; + return $this->rowsToRepeatAtTop; } /** @@ -523,7 +523,7 @@ class PHPExcel_Worksheet_PageSetup public function setRowsToRepeatAtTop($pValue = null) { if (is_array($pValue)) { - $this->_rowsToRepeatAtTop = $pValue; + $this->rowsToRepeatAtTop = $pValue; } return $this; } @@ -537,7 +537,7 @@ class PHPExcel_Worksheet_PageSetup */ public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1) { - $this->_rowsToRepeatAtTop = array($pStart, $pEnd); + $this->rowsToRepeatAtTop = array($pStart, $pEnd); return $this; } @@ -548,7 +548,7 @@ class PHPExcel_Worksheet_PageSetup */ public function getHorizontalCentered() { - return $this->_horizontalCentered; + return $this->horizontalCentered; } /** @@ -559,7 +559,7 @@ class PHPExcel_Worksheet_PageSetup */ public function setHorizontalCentered($value = false) { - $this->_horizontalCentered = $value; + $this->horizontalCentered = $value; return $this; } @@ -570,7 +570,7 @@ class PHPExcel_Worksheet_PageSetup */ public function getVerticalCentered() { - return $this->_verticalCentered; + return $this->verticalCentered; } /** @@ -581,7 +581,7 @@ class PHPExcel_Worksheet_PageSetup */ public function setVerticalCentered($value = false) { - $this->_verticalCentered = $value; + $this->verticalCentered = $value; return $this; } @@ -598,9 +598,9 @@ class PHPExcel_Worksheet_PageSetup public function getPrintArea($index = 0) { if ($index == 0) { - return $this->_printArea; + return $this->printArea; } - $printAreas = explode(',', $this->_printArea); + $printAreas = explode(',', $this->printArea); if (isset($printAreas[$index-1])) { return $printAreas[$index-1]; } @@ -619,9 +619,9 @@ class PHPExcel_Worksheet_PageSetup public function isPrintAreaSet($index = 0) { if ($index == 0) { - return !is_null($this->_printArea); + return !is_null($this->printArea); } - $printAreas = explode(',', $this->_printArea); + $printAreas = explode(',', $this->printArea); return isset($printAreas[$index-1]); } @@ -637,12 +637,12 @@ class PHPExcel_Worksheet_PageSetup public function clearPrintArea($index = 0) { if ($index == 0) { - $this->_printArea = null; + $this->printArea = null; } else { - $printAreas = explode(',', $this->_printArea); + $printAreas = explode(',', $this->printArea); if (isset($printAreas[$index-1])) { unset($printAreas[$index-1]); - $this->_printArea = implode(',', $printAreas); + $this->printArea = implode(',', $printAreas); } } @@ -682,9 +682,9 @@ class PHPExcel_Worksheet_PageSetup if ($method == self::SETPRINTRANGE_OVERWRITE) { if ($index == 0) { - $this->_printArea = $value; + $this->printArea = $value; } else { - $printAreas = explode(',', $this->_printArea); + $printAreas = explode(',', $this->printArea); if ($index < 0) { $index = count($printAreas) - abs($index) + 1; } @@ -692,13 +692,13 @@ class PHPExcel_Worksheet_PageSetup throw new PHPExcel_Exception('Invalid index for setting print range.'); } $printAreas[$index-1] = $value; - $this->_printArea = implode(',', $printAreas); + $this->printArea = implode(',', $printAreas); } } elseif ($method == self::SETPRINTRANGE_INSERT) { if ($index == 0) { - $this->_printArea .= ($this->_printArea == '') ? $value : ','.$value; + $this->printArea .= ($this->printArea == '') ? $value : ','.$value; } else { - $printAreas = explode(',', $this->_printArea); + $printAreas = explode(',', $this->printArea); if ($index < 0) { $index = abs($index) - 1; } @@ -706,7 +706,7 @@ class PHPExcel_Worksheet_PageSetup throw new PHPExcel_Exception('Invalid index for setting print range.'); } $printAreas = array_merge(array_slice($printAreas, 0, $index), array($value), array_slice($printAreas, $index)); - $this->_printArea = implode(',', $printAreas); + $this->printArea = implode(',', $printAreas); } } else { throw new PHPExcel_Exception('Invalid method for setting print range.'); @@ -758,7 +758,11 @@ class PHPExcel_Worksheet_PageSetup */ public function setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) { - return $this->setPrintArea(PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2, $index, $method); + return $this->setPrintArea( + PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2, + $index, + $method + ); } /** @@ -779,7 +783,11 @@ class PHPExcel_Worksheet_PageSetup */ public function addPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = -1) { - return $this->setPrintArea(PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2, $index, self::SETPRINTRANGE_INSERT); + return $this->setPrintArea( + PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2, + $index, + self::SETPRINTRANGE_INSERT + ); } /** @@ -789,7 +797,7 @@ class PHPExcel_Worksheet_PageSetup */ public function getFirstPageNumber() { - return $this->_firstPageNumber; + return $this->firstPageNumber; } /** @@ -800,7 +808,7 @@ class PHPExcel_Worksheet_PageSetup */ public function setFirstPageNumber($value = null) { - $this->_firstPageNumber = $value; + $this->firstPageNumber = $value; return $this; } diff --git a/Classes/PHPExcel/Writer/Abstract.php b/Classes/PHPExcel/Writer/Abstract.php index a0f1410..e6e130d 100644 --- a/Classes/PHPExcel/Writer/Abstract.php +++ b/Classes/PHPExcel/Writer/Abstract.php @@ -33,7 +33,7 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter * * @var boolean */ - protected $_includeCharts = false; + protected $includeCharts = false; /** * Pre-calculate formulas @@ -67,7 +67,7 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter */ public function getIncludeCharts() { - return $this->_includeCharts; + return $this->includeCharts; } /** @@ -80,7 +80,7 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter */ public function setIncludeCharts($pValue = false) { - $this->_includeCharts = (boolean) $pValue; + $this->includeCharts = (boolean) $pValue; return $this; } diff --git a/Classes/PHPExcel/Writer/Excel2007.php b/Classes/PHPExcel/Writer/Excel2007.php index 1b24101..5b812cc 100644 --- a/Classes/PHPExcel/Writer/Excel2007.php +++ b/Classes/PHPExcel/Writer/Excel2007.php @@ -236,7 +236,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE } // Add [Content_Types].xml to ZIP file - $objZip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->_spreadSheet, $this->_includeCharts)); + $objZip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->_spreadSheet, $this->includeCharts)); //if hasMacros, add the vbaProject.bin file, Certificate file(if exists) if ($this->_spreadSheet->hasMacros()) { @@ -292,8 +292,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE $chartCount = 0; // Add worksheets for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) { - $objZip->addFromString('xl/worksheets/sheet' . ($i + 1) . '.xml', $this->getWriterPart('Worksheet')->writeWorksheet($this->_spreadSheet->getSheet($i), $this->_stringTable, $this->_includeCharts)); - if ($this->_includeCharts) { + $objZip->addFromString('xl/worksheets/sheet' . ($i + 1) . '.xml', $this->getWriterPart('Worksheet')->writeWorksheet($this->_spreadSheet->getSheet($i), $this->_stringTable, $this->includeCharts)); + if ($this->includeCharts) { $charts = $this->_spreadSheet->getSheet($i)->getChartCollection(); if (count($charts) > 0) { foreach ($charts as $chart) { @@ -308,21 +308,21 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE // Add worksheet relationships (drawings, ...) for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) { // Add relationships - $objZip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->_spreadSheet->getSheet($i), ($i + 1), $this->_includeCharts)); + $objZip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->_spreadSheet->getSheet($i), ($i + 1), $this->includeCharts)); $drawings = $this->_spreadSheet->getSheet($i)->getDrawingCollection(); $drawingCount = count($drawings); - if ($this->_includeCharts) { + if ($this->includeCharts) { $chartCount = $this->_spreadSheet->getSheet($i)->getChartCount(); } // Add drawing and image relationship parts if (($drawingCount > 0) || ($chartCount > 0)) { // Drawing relationships - $objZip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->_spreadSheet->getSheet($i), $chartRef1, $this->_includeCharts)); + $objZip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->_spreadSheet->getSheet($i), $chartRef1, $this->includeCharts)); // Drawings - $objZip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->_spreadSheet->getSheet($i), $chartRef2, $this->_includeCharts)); + $objZip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->_spreadSheet->getSheet($i), $chartRef2, $this->includeCharts)); } // Add comment relationship parts diff --git a/Classes/PHPExcel/Writer/HTML.php b/Classes/PHPExcel/Writer/HTML.php index eecc6ec..746ec55 100644 --- a/Classes/PHPExcel/Writer/HTML.php +++ b/Classes/PHPExcel/Writer/HTML.php @@ -32,98 +32,98 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * * @var PHPExcel */ - protected $_phpExcel; + protected $phpExcel; /** * Sheet index to write * * @var int */ - private $_sheetIndex = 0; + private $sheetIndex = 0; /** * Images root * * @var string */ - private $_imagesRoot = '.'; + private $imagesRoot = '.'; /** * embed images, or link to images * * @var boolean */ - private $_embedImages = false; + private $embedImages = false; /** * Use inline CSS? * * @var boolean */ - private $_useInlineCss = false; + private $useInlineCss = false; /** * Array of CSS styles * * @var array */ - private $_cssStyles = null; + private $cssStyles; /** * Array of column widths in points * * @var array */ - private $_columnWidths = null; + private $columnWidths; /** * Default font * * @var PHPExcel_Style_Font */ - private $_defaultFont; + private $defaultFont; /** * Flag whether spans have been calculated * * @var boolean */ - private $_spansAreCalculated = false; + private $spansAreCalculated = false; /** * Excel cells that should not be written as HTML cells * * @var array */ - private $_isSpannedCell = array(); + private $isSpannedCell = array(); /** * Excel cells that are upper-left corner in a cell merge * * @var array */ - private $_isBaseCell = array(); + private $isBaseCell = array(); /** * Excel rows that should not be written as HTML rows * * @var array */ - private $_isSpannedRow = array(); + private $isSpannedRow = array(); /** * Is the current writer creating PDF? * * @var boolean */ - protected $_isPdf = false; + protected $isPdf = false; /** * Generate the Navigation block * * @var boolean */ - private $_generateSheetNavigationBlock = true; + private $generateSheetNavigationBlock = true; /** * Create a new PHPExcel_Writer_HTML @@ -132,8 +132,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ */ public function __construct(PHPExcel $phpExcel) { - $this->_phpExcel = $phpExcel; - $this->_defaultFont = $this->_phpExcel->getDefaultStyle()->getFont(); + $this->phpExcel = $phpExcel; + $this->defaultFont = $this->phpExcel->getDefaultStyle()->getFont(); } /** @@ -145,15 +145,15 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ public function save($pFilename = null) { // 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); $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); // Build CSS - $this->buildCSS(!$this->_useInlineCss); + $this->buildCSS(!$this->useInlineCss); // Open file $fileHandle = fopen($pFilename, 'wb+'); @@ -162,10 +162,10 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } // Write headers - fwrite($fileHandle, $this->generateHTMLHeader(!$this->_useInlineCss)); + fwrite($fileHandle, $this->generateHTMLHeader(!$this->useInlineCss)); // Write navigation (tabs) - if ((!$this->_isPdf) && ($this->_generateSheetNavigationBlock)) { + if ((!$this->isPdf) && ($this->generateSheetNavigationBlock)) { fwrite($fileHandle, $this->generateNavigation()); } @@ -179,7 +179,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ fclose($fileHandle); PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); - PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); + PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); } /** @@ -188,7 +188,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * @param string $vAlign Vertical alignment * @return string */ - private function _mapVAlign($vAlign) + private function mapVAlign($vAlign) { switch ($vAlign) { case PHPExcel_Style_Alignment::VERTICAL_BOTTOM: @@ -209,7 +209,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * @param string $hAlign Horizontal alignment * @return string|false */ - private function _mapHAlign($hAlign) + private function mapHAlign($hAlign) { switch ($hAlign) { case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL: @@ -234,7 +234,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * @param int $borderStyle Sheet index * @return string */ - private function _mapBorderStyle($borderStyle) + private function mapBorderStyle($borderStyle) { switch ($borderStyle) { case PHPExcel_Style_Border::BORDER_NONE: @@ -278,7 +278,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ */ public function getSheetIndex() { - return $this->_sheetIndex; + return $this->sheetIndex; } /** @@ -289,7 +289,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ */ public function setSheetIndex($pValue = 0) { - $this->_sheetIndex = $pValue; + $this->sheetIndex = $pValue; return $this; } @@ -300,7 +300,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ */ public function getGenerateSheetNavigationBlock() { - return $this->_generateSheetNavigationBlock; + return $this->generateSheetNavigationBlock; } /** @@ -311,7 +311,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ */ public function setGenerateSheetNavigationBlock($pValue = true) { - $this->_generateSheetNavigationBlock = (bool) $pValue; + $this->generateSheetNavigationBlock = (bool) $pValue; return $this; } @@ -320,7 +320,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ */ public function writeAllSheets() { - $this->_sheetIndex = null; + $this->sheetIndex = null; return $this; } @@ -334,12 +334,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ public function generateHTMLHeader($pIncludeStyles = false) { // PHPExcel object known? - if (is_null($this->_phpExcel)) { + if (is_null($this->phpExcel)) { throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Construct HTML - $properties = $this->_phpExcel->getProperties(); + $properties = $this->phpExcel->getProperties(); $html = '' . PHP_EOL; $html .= '' . PHP_EOL; $html .= '' . PHP_EOL; @@ -393,21 +393,21 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ public function generateSheetData() { // PHPExcel object known? - if (is_null($this->_phpExcel)) { + if (is_null($this->phpExcel)) { throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Ensure that Spans have been calculated? - if (!$this->_spansAreCalculated) { - $this->_calculateSpans(); + if (!$this->spansAreCalculated) { + $this->calculateSpans(); } // Fetch sheets $sheets = array(); - if (is_null($this->_sheetIndex)) { - $sheets = $this->_phpExcel->getAllSheets(); + if (is_null($this->sheetIndex)) { + $sheets = $this->phpExcel->getAllSheets(); } else { - $sheets[] = $this->_phpExcel->getSheet($this->_sheetIndex); + $sheets[] = $this->phpExcel->getSheet($this->sheetIndex); } // Construct HTML @@ -417,7 +417,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ $sheetId = 0; foreach ($sheets as $sheet) { // Write table header - $html .= $this->_generateTableHeader($sheet); + $html .= $this->generateTableHeader($sheet); // Get worksheet dimension $dimension = explode(':', $sheet->calculateWorksheetDimension()); @@ -460,7 +460,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } // Write row if there are HTML table cells in it - if (!isset($this->_isSpannedRow[$sheet->getParent()->getIndex($sheet)][$row])) { + if (!isset($this->isSpannedRow[$sheet->getParent()->getIndex($sheet)][$row])) { // Start a new rowData $rowData = array(); // Loop through columns @@ -473,7 +473,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ $rowData[$column] = ''; } } - $html .= $this->_generateRow($sheet, $rowData, $row - 1, $cellType); + $html .= $this->generateRow($sheet, $rowData, $row - 1, $cellType); } // ? @@ -481,17 +481,17 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ $html .= ' ' . PHP_EOL; } } - $html .= $this->_extendRowsForChartsAndImages($sheet, $row); + $html .= $this->extendRowsForChartsAndImages($sheet, $row); // Close table body. $html .= ' ' . PHP_EOL; // Write table footer - $html .= $this->_generateTableFooter(); + $html .= $this->generateTableFooter(); // Writing PDF? - if ($this->_isPdf) { - if (is_null($this->_sheetIndex) && $sheetId + 1 < $this->_phpExcel->getSheetCount()) { + if ($this->isPdf) { + if (is_null($this->sheetIndex) && $sheetId + 1 < $this->phpExcel->getSheetCount()) { $html .= '
'; } } @@ -512,16 +512,16 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ public function generateNavigation() { // PHPExcel object known? - if (is_null($this->_phpExcel)) { + if (is_null($this->phpExcel)) { throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Fetch sheets $sheets = array(); - if (is_null($this->_sheetIndex)) { - $sheets = $this->_phpExcel->getAllSheets(); + if (is_null($this->sheetIndex)) { + $sheets = $this->phpExcel->getAllSheets(); } else { - $sheets[] = $this->_phpExcel->getSheet($this->_sheetIndex); + $sheets[] = $this->phpExcel->getSheet($this->sheetIndex); } // Construct HTML @@ -545,11 +545,11 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ return $html; } - private function _extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row) + private function extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row) { $rowMax = $row; $colMax = 'A'; - if ($this->_includeCharts) { + if ($this->includeCharts) { foreach ($pSheet->getChartCollection() as $chart) { if ($chart instanceof PHPExcel_Chart) { $chartCoordinates = $chart->getTopLeftPosition(); @@ -583,9 +583,9 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ $html .= ''; for ($col = 'A'; $col != $colMax; ++$col) { $html .= ''; - $html .= $this->_writeImageInCell($pSheet, $col.$row); - if ($this->_includeCharts) { - $html .= $this->_writeChartInCell($pSheet, $col.$row); + $html .= $this->writeImageInCell($pSheet, $col.$row); + if ($this->includeCharts) { + $html .= $this->writeChartInCell($pSheet, $col.$row); } $html .= ''; } @@ -604,7 +604,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * @return string * @throws PHPExcel_Writer_Exception */ - private function _writeImageInCell(PHPExcel_Worksheet $pSheet, $coordinates) + private function writeImageInCell(PHPExcel_Worksheet $pSheet, $coordinates) { // Construct HTML $html = ''; @@ -632,7 +632,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ $filename = htmlspecialchars($filename); $html .= PHP_EOL; - if ((!$this->_embedImages) || ($this->_isPdf)) { + if ((!$this->embedImages) || ($this->isPdf)) { $imageData = $filename; } else { $imageDetails = getimagesize($filename); @@ -669,7 +669,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * @return string * @throws PHPExcel_Writer_Exception */ - private function _writeChartInCell(PHPExcel_Worksheet $pSheet, $coordinates) + private function writeChartInCell(PHPExcel_Worksheet $pSheet, $coordinates) { // Construct HTML $html = ''; @@ -718,7 +718,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ public function generateStyles($generateSurroundingHTML = true) { // PHPExcel object known? - if (is_null($this->_phpExcel)) { + if (is_null($this->phpExcel)) { throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } @@ -731,13 +731,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // Start styles if ($generateSurroundingHTML) { $html .= '