Use of empty() rather than count() to test if arrays are empty or not - simple performance tweak... empty() is over twice as fast as count()
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@85344 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
ac37b8ae8d
commit
24a9eb285c
|
@ -767,7 +767,7 @@ class PHPExcel
|
|||
}
|
||||
|
||||
// make sure there is always at least one cellXf (there should be)
|
||||
if (count($this->_cellXfCollection) == 0) {
|
||||
if (empty($this->_cellXfCollection)) {
|
||||
$this->_cellXfCollection[] = new PHPExcel_Style();
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ class PHPExcel_CachedObjectStorage_CacheBase {
|
|||
$row[$r] = $r;
|
||||
$col[$c] = strlen($c).$c;
|
||||
}
|
||||
if (count($row) > 0) {
|
||||
if (!empty($row)) {
|
||||
// Determine highest column and row
|
||||
$highestRow = max($row);
|
||||
$highestColumn = substr(max($col),1);
|
||||
|
|
|
@ -789,7 +789,7 @@ class PHPExcel_Calculation_DateTime {
|
|||
}
|
||||
|
||||
// Test any extra holiday parameters
|
||||
if (count($dateArgs) > 0) {
|
||||
if (!empty($dateArgs)) {
|
||||
$holidayCountedArray = $holidayDates = array();
|
||||
foreach ($dateArgs as $holidayDate) {
|
||||
if ((!is_null($holidayDate)) && (trim($holidayDate) > '')) {
|
||||
|
|
|
@ -555,7 +555,7 @@ class PHPExcel_Calculation_Functions {
|
|||
} elseif (self::isMatrixValue($a)) {
|
||||
return 64;
|
||||
}
|
||||
} elseif(count($value) == 0) {
|
||||
} elseif(empty($value)) {
|
||||
// Empty Cell
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -697,7 +697,7 @@ class PHPExcel_Calculation_LookupRef {
|
|||
}
|
||||
|
||||
// index_number must be less than or equal to the number of columns in lookup_array
|
||||
if ((!is_array($lookup_array)) || (count($lookup_array) < 1)) {
|
||||
if ((!is_array($lookup_array)) || (empty($lookup_array))) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
} else {
|
||||
$f = array_keys($lookup_array);
|
||||
|
|
|
@ -61,7 +61,7 @@ class PHPExcel_Calculation_MathTrig {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (count($factorArray) > 0) {
|
||||
if (!empty($factorArray)) {
|
||||
rsort($factorArray);
|
||||
return $factorArray;
|
||||
} else {
|
||||
|
@ -1040,7 +1040,7 @@ class PHPExcel_Calculation_MathTrig {
|
|||
|
||||
$aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs);
|
||||
$sumArgs = PHPExcel_Calculation_Functions::flattenArray($sumArgs);
|
||||
if (count($sumArgs) == 0) {
|
||||
if (empty($sumArgs)) {
|
||||
$sumArgs = $aArgs;
|
||||
}
|
||||
$condition = PHPExcel_Calculation_Functions::_ifCondition($condition);
|
||||
|
|
|
@ -841,7 +841,7 @@ class PHPExcel_Calculation_Statistical {
|
|||
|
||||
$aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs);
|
||||
$averageArgs = PHPExcel_Calculation_Functions::flattenArray($averageArgs);
|
||||
if (count($averageArgs) == 0) {
|
||||
if (empty($averageArgs)) {
|
||||
$averageArgs = $aArgs;
|
||||
}
|
||||
$condition = PHPExcel_Calculation_Functions::_ifCondition($condition);
|
||||
|
@ -1734,7 +1734,7 @@ class PHPExcel_Calculation_Statistical {
|
|||
$const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const);
|
||||
|
||||
$bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL,$yValues,$xValues,$const);
|
||||
if (count($newValues) == 0) {
|
||||
if (empty($newValues)) {
|
||||
$newValues = $bestFitExponential->getXValues();
|
||||
}
|
||||
|
||||
|
@ -2202,7 +2202,7 @@ class PHPExcel_Calculation_Statistical {
|
|||
|
||||
$aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs);
|
||||
$sumArgs = PHPExcel_Calculation_Functions::flattenArray($sumArgs);
|
||||
if (count($sumArgs) == 0) {
|
||||
if (empty($sumArgs)) {
|
||||
$sumArgs = $aArgs;
|
||||
}
|
||||
$condition = PHPExcel_Calculation_Functions::_ifCondition($condition);
|
||||
|
@ -2364,7 +2364,7 @@ class PHPExcel_Calculation_Statistical {
|
|||
|
||||
$aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs);
|
||||
$sumArgs = PHPExcel_Calculation_Functions::flattenArray($sumArgs);
|
||||
if (count($sumArgs) == 0) {
|
||||
if (empty($sumArgs)) {
|
||||
$sumArgs = $aArgs;
|
||||
}
|
||||
$condition = PHPExcel_Calculation_Functions::_ifCondition($condition);
|
||||
|
@ -2446,7 +2446,7 @@ class PHPExcel_Calculation_Statistical {
|
|||
}
|
||||
}
|
||||
|
||||
if (count($mArgs) > 0) {
|
||||
if (!empty($mArgs)) {
|
||||
return self::_modeCalc($mArgs);
|
||||
}
|
||||
|
||||
|
@ -3332,7 +3332,7 @@ class PHPExcel_Calculation_Statistical {
|
|||
$const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const);
|
||||
|
||||
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues,$const);
|
||||
if (count($newValues) == 0) {
|
||||
if (empty($newValues)) {
|
||||
$newValues = $bestFitLinear->getXValues();
|
||||
}
|
||||
|
||||
|
|
|
@ -581,7 +581,7 @@ class PHPExcel_Cell
|
|||
public static function buildRange($pRange)
|
||||
{
|
||||
// Verify range
|
||||
if (!is_array($pRange) || count($pRange) == 0 || !is_array($pRange[0])) {
|
||||
if (!is_array($pRange) || empty($pRange) || !is_array($pRange[0])) {
|
||||
throw new Exception('Range does not contain any information.');
|
||||
}
|
||||
|
||||
|
|
|
@ -482,7 +482,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (count($thisBorder) > 0) {
|
||||
if (!empty($thisBorder)) {
|
||||
if (($borderPosition == 'left') || ($borderPosition == 'right') || ($borderPosition == 'top') || ($borderPosition == 'bottom')) {
|
||||
$this->_styles[$styleID]['borders'][$borderPosition] = $thisBorder;
|
||||
}
|
||||
|
@ -767,7 +767,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||
if (($cellIsSet) && (isset($cell_ss['StyleID']))) {
|
||||
$style = (string) $cell_ss['StyleID'];
|
||||
// echo 'Cell style for '.$columnID.$rowID.' is '.$style.'<br />';
|
||||
if ((isset($this->_styles[$style])) && (count($this->_styles[$style]) > 0)) {
|
||||
if ((isset($this->_styles[$style])) && (!empty($this->_styles[$style]))) {
|
||||
// echo 'Cell '.$columnID.$rowID.'<br />';
|
||||
// print_r($this->_styles[$style]);
|
||||
// echo '<br />';
|
||||
|
|
|
@ -1186,7 +1186,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||
$row = null;
|
||||
|
||||
$clientData = $shape->xpath('.//x:ClientData');
|
||||
if (is_array($clientData) && count($clientData) > 0) {
|
||||
if (is_array($clientData) && !empty($clientData)) {
|
||||
$clientData = $clientData[0];
|
||||
|
||||
if ( isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note' ) {
|
||||
|
|
|
@ -949,7 +949,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||
}
|
||||
}
|
||||
|
||||
if (count($this->_cellNotes) > 0) {
|
||||
if (!empty($this->_cellNotes)) {
|
||||
foreach($this->_cellNotes as $note => $noteDetails) {
|
||||
// echo '<b>Cell annotation ',$note,'</b><br />';
|
||||
// var_dump($noteDetails);
|
||||
|
@ -4903,7 +4903,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||
private function _createFormulaFromTokens($tokens, $additionalData)
|
||||
{
|
||||
// empty formula?
|
||||
if (count($tokens) == 0) {
|
||||
if (empty($tokens)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -354,7 +354,7 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
||||
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->_formats[$formatStyle]);
|
||||
}
|
||||
if ((count($styleData) > 0) && ($column > '') && ($row > '')) {
|
||||
if ((!empty($styleData)) && ($column > '') && ($row > '')) {
|
||||
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
||||
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($styleData);
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ class PHPExcel_ReferenceHelper
|
|||
|
||||
// Update worksheet: column dimensions
|
||||
$aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true);
|
||||
if (count($aColumnDimensions) > 0) {
|
||||
if (!empty($aColumnDimensions)) {
|
||||
foreach ($aColumnDimensions as $objColumnDimension) {
|
||||
$newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows);
|
||||
list($newReference) = PHPExcel_Cell::coordinateFromString($newReference);
|
||||
|
@ -228,7 +228,7 @@ class PHPExcel_ReferenceHelper
|
|||
|
||||
// Update worksheet: row dimensions
|
||||
$aRowDimensions = array_reverse($pSheet->getRowDimensions(), true);
|
||||
if (count($aRowDimensions) > 0) {
|
||||
if (!empty($aRowDimensions)) {
|
||||
foreach ($aRowDimensions as $objRowDimension) {
|
||||
$newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows);
|
||||
list(, $newReference) = PHPExcel_Cell::coordinateFromString($newReference);
|
||||
|
@ -340,7 +340,7 @@ class PHPExcel_ReferenceHelper
|
|||
|
||||
|
||||
// Update workbook: named ranges
|
||||
if (count($pSheet->getParent()->getNamedRanges()) > 0) {
|
||||
if (!empty($pSheet->getParent()->getNamedRanges())) {
|
||||
foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) {
|
||||
if ($namedRange->getWorksheet()->getHashCode() == $pSheet->getHashCode()) {
|
||||
$namedRange->setRange(
|
||||
|
|
|
@ -202,7 +202,7 @@ class PHPExcel_Shared_OLE_PPS
|
|||
*/
|
||||
public static function _savePpsSetPnt(&$raList, $to_save, $depth = 0)
|
||||
{
|
||||
if ( !is_array($to_save) || (count($to_save) == 0) ) {
|
||||
if ( !is_array($to_save) || (empty($to_save)) ) {
|
||||
return 0xFFFFFFFF;
|
||||
} elseif( count($to_save) == 1 ) {
|
||||
$cnt = count($raList);
|
||||
|
|
|
@ -288,7 +288,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
|
|||
}
|
||||
|
||||
// Add comment relationship parts
|
||||
if (count($this->_spreadSheet->getSheet($i)->getComments()) > 0) {
|
||||
if (!empty($this->_spreadSheet->getSheet($i)->getComments())) {
|
||||
// VML Comments
|
||||
$objZip->addFromString('xl/drawings/vmlDrawing' . ($i + 1) . '.vml', $this->getWriterPart('Comments')->writeVMLComments($this->_spreadSheet->getSheet($i)));
|
||||
|
||||
|
@ -297,7 +297,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
|
|||
}
|
||||
|
||||
// Add header/footer relationship parts
|
||||
if (count($this->_spreadSheet->getSheet($i)->getHeaderFooter()->getImages()) > 0) {
|
||||
if (!empty($this->_spreadSheet->getSheet($i)->getHeaderFooter()->getImages())) {
|
||||
// VML Drawings
|
||||
$objZip->addFromString('xl/drawings/vmlDrawingHF' . ($i + 1) . '.vml', $this->getWriterPart('Drawing')->writeVMLHeaderFooterImages($this->_spreadSheet->getSheet($i)));
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
|||
);
|
||||
|
||||
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
|
||||
if (count($customPropertyList) > 0) {
|
||||
if (!empty($customPropertyList)) {
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml'
|
||||
);
|
||||
|
@ -129,7 +129,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
|||
|
||||
// Comments
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
if (count($pPHPExcel->getSheet($i)->getComments()) > 0) {
|
||||
if (!empty($pPHPExcel->getSheet($i)->getComments())) {
|
||||
$this->_writeOverrideContentType(
|
||||
$objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml'
|
||||
);
|
||||
|
@ -165,7 +165,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
|||
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) {
|
||||
if (!empty($pPHPExcel->getSheet()->getHeaderFooter()->getImages())) {
|
||||
foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) {
|
||||
if (!isset( $aMediaContentTypes[strtolower($image->getExtension())]) ) {
|
||||
$aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType( $image->getPath() );
|
||||
|
|
|
@ -209,7 +209,7 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
|
|||
public function writeDocPropsCustom(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
|
||||
if (count($customPropertyList) == 0) {
|
||||
if (empty($customPropertyList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
|||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
||||
|
||||
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
|
||||
if (count($customPropertyList) > 0) {
|
||||
if (!empty($customPropertyList)) {
|
||||
// Relationship docProps/app.xml
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
|
@ -223,7 +223,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
|||
|
||||
// Write comments relationship?
|
||||
$i = 1;
|
||||
if (count($pWorksheet->getComments()) > 0) {
|
||||
if (!empty($pWorksheet->getComments())) {
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
'_comments_vml' . $i,
|
||||
|
@ -241,7 +241,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
|||
|
||||
// Write header/footer relationship?
|
||||
$i = 1;
|
||||
if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) {
|
||||
if (!empty($pWorksheet->getHeaderFooter()->getImages())) {
|
||||
$this->_writeRelationship(
|
||||
$objWriter,
|
||||
'_headerfooter_vml' . $i,
|
||||
|
|
|
@ -265,7 +265,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
|||
$objWriter->startElement('definedNames');
|
||||
|
||||
// Named ranges
|
||||
if (count($pPHPExcel->getNamedRanges()) > 0) {
|
||||
if (!empty($pPHPExcel->getNamedRanges())) {
|
||||
// Named ranges
|
||||
$this->_writeNamedRanges($objWriter, $pPHPExcel);
|
||||
}
|
||||
|
|
|
@ -342,7 +342,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||
private function _writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
|
||||
{
|
||||
// cols
|
||||
if (count($pSheet->getColumnDimensions()) > 0) {
|
||||
if (!empty($pSheet->getColumnDimensions())) {
|
||||
$objWriter->startElement('cols');
|
||||
|
||||
$pSheet->calculateColumnWidths();
|
||||
|
@ -521,7 +521,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||
$dataValidationCollection = $pSheet->getDataValidationCollection();
|
||||
|
||||
// Write data validations?
|
||||
if (count($dataValidationCollection) > 0) {
|
||||
if (!empty($dataValidationCollection)) {
|
||||
$objWriter->startElement('dataValidations');
|
||||
$objWriter->writeAttribute('count', count($dataValidationCollection));
|
||||
|
||||
|
@ -590,7 +590,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||
$relationId = 1;
|
||||
|
||||
// Write hyperlinks?
|
||||
if (count($hyperlinkCollection) > 0) {
|
||||
if (!empty($hyperlinkCollection)) {
|
||||
$objWriter->startElement('hyperlinks');
|
||||
|
||||
foreach ($hyperlinkCollection as $coordinate => $hyperlink) {
|
||||
|
@ -624,7 +624,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||
*/
|
||||
private function _writeProtectedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
|
||||
{
|
||||
if (count($pSheet->getProtectedCells()) > 0) {
|
||||
if (!empty($pSheet->getProtectedCells())) {
|
||||
// protectedRanges
|
||||
$objWriter->startElement('protectedRanges');
|
||||
|
||||
|
@ -651,7 +651,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||
*/
|
||||
private function _writeMergeCells(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
|
||||
{
|
||||
if (count($pSheet->getMergeCells()) > 0) {
|
||||
if (!empty($pSheet->getMergeCells())) {
|
||||
// mergeCells
|
||||
$objWriter->startElement('mergeCells');
|
||||
|
||||
|
@ -811,7 +811,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||
}
|
||||
|
||||
// rowBreaks
|
||||
if (count($aRowBreaks) > 0) {
|
||||
if (!empty($aRowBreaks)) {
|
||||
$objWriter->startElement('rowBreaks');
|
||||
$objWriter->writeAttribute('count', count($aRowBreaks));
|
||||
$objWriter->writeAttribute('manualBreakCount', count($aRowBreaks));
|
||||
|
@ -829,7 +829,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||
}
|
||||
|
||||
// Second, write column breaks
|
||||
if (count($aColumnBreaks) > 0) {
|
||||
if (!empty($aColumnBreaks)) {
|
||||
$objWriter->startElement('colBreaks');
|
||||
$objWriter->writeAttribute('count', count($aColumnBreaks));
|
||||
$objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks));
|
||||
|
@ -1093,7 +1093,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||
private function _writeLegacyDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
|
||||
{
|
||||
// If sheet contains comments, add the relationships
|
||||
if (count($pSheet->getComments()) > 0) {
|
||||
if (!empty($pSheet->getComments())) {
|
||||
$objWriter->startElement('legacyDrawing');
|
||||
$objWriter->writeAttribute('r:id', 'rId_comments_vml1');
|
||||
$objWriter->endElement();
|
||||
|
@ -1110,7 +1110,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||
private function _writeLegacyDrawingHF(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
|
||||
{
|
||||
// If sheet contains comments, add the relationships
|
||||
if (count($pSheet->getHeaderFooter()->getImages()) > 0) {
|
||||
if (!empty($pSheet->getHeaderFooter()->getImages())) {
|
||||
$objWriter->startElement('legacyDrawingHF');
|
||||
$objWriter->writeAttribute('r:id', 'rId_headerfooter_vml1');
|
||||
$objWriter->endElement();
|
||||
|
|
|
@ -223,7 +223,7 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter
|
|||
$escher = null;
|
||||
|
||||
// check if there are any shapes for this sheet
|
||||
if (count($sheet->getDrawingCollection()) == 0) {
|
||||
if (empty($sheet->getDrawingCollection())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter
|
|||
// any drawings in this workbook?
|
||||
$found = false;
|
||||
foreach ($this->_phpExcel->getAllSheets() as $sheet) {
|
||||
if (count($sheet->getDrawingCollection()) > 0) {
|
||||
if (!empty($sheet->getDrawingCollection())) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter
|
|||
foreach ($this->_phpExcel->getAllsheets() as $sheet) {
|
||||
$sheetCountShapes = 0; // count number of shapes (minus group shape), in sheet
|
||||
|
||||
if (count($sheet->getDrawingCollection()) > 0) {
|
||||
if (!empty($sheet->getDrawingCollection())) {
|
||||
++$countDrawings;
|
||||
|
||||
foreach ($sheet->getDrawingCollection() as $drawing) {
|
||||
|
|
|
@ -643,7 +643,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$chunk = '';
|
||||
|
||||
// Named ranges
|
||||
if (count($this->_phpExcel->getNamedRanges()) > 0) {
|
||||
if (!empty($this->_phpExcel->getNamedRanges())) {
|
||||
// Loop named ranges
|
||||
$namedRanges = $this->_phpExcel->getNamedRanges();
|
||||
foreach ($namedRanges as $namedRange) {
|
||||
|
|
|
@ -2104,7 +2104,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
}
|
||||
|
||||
//horizontal page breaks
|
||||
if (count($hbreaks) > 0) {
|
||||
if (!empty($hbreaks)) {
|
||||
|
||||
// Sort and filter array of page breaks
|
||||
sort($hbreaks, SORT_NUMERIC);
|
||||
|
@ -2128,7 +2128,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
}
|
||||
|
||||
// vertical page breaks
|
||||
if (count($vbreaks) > 0) {
|
||||
if (!empty($vbreaks)) {
|
||||
|
||||
// 1000 vertical pagebreaks appears to be an internal Excel 5 limit.
|
||||
// It is slightly higher in Excel 97/200, approx. 1026
|
||||
|
@ -2691,21 +2691,21 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$dataValidationCollection = $this->_phpSheet->getDataValidationCollection();
|
||||
|
||||
// Write data validations?
|
||||
if (count($dataValidationCollection) > 0) {
|
||||
if (!empty($dataValidationCollection)) {
|
||||
|
||||
// DATAVALIDATIONS record
|
||||
$record = 0x01B2; // Record identifier
|
||||
$length = 0x0012; // Bytes to follow
|
||||
$length = 0x0012; // Bytes to follow
|
||||
|
||||
$grbit = 0x0000; // Prompt box at cell, no cached validity data at DV records
|
||||
$horPos = 0x00000000; // Horizontal position of prompt box, if fixed position
|
||||
$verPos = 0x00000000; // Vertical position of prompt box, if fixed position
|
||||
$horPos = 0x00000000; // Horizontal position of prompt box, if fixed position
|
||||
$verPos = 0x00000000; // Vertical position of prompt box, if fixed position
|
||||
$objId = 0xFFFFFFFF; // Object identifier of drop down arrow object, or -1 if not visible
|
||||
|
||||
$header = pack('vv', $record, $length);
|
||||
$data = pack('vVVVV', $grbit, $horPos, $verPos, $objId,
|
||||
$header = pack('vv', $record, $length);
|
||||
$data = pack('vVVVV', $grbit, $horPos, $verPos, $objId,
|
||||
count($dataValidationCollection));
|
||||
$this->_append($header.$data);
|
||||
$this->_append($header.$data);
|
||||
|
||||
// DATAVALIDATION records
|
||||
$record = 0x01BE; // Record identifier
|
||||
|
|
Loading…
Reference in New Issue