Fix to inappropriate replacement of count() with empty().... there may be others I've not spotted yet.

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@85437 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2012-01-18 17:51:53 +00:00
parent 21cce674c8
commit 414209c03d
5 changed files with 13 additions and 13 deletions

View File

@ -288,7 +288,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
} }
// Add comment relationship parts // Add comment relationship parts
if (!empty($this->_spreadSheet->getSheet($i)->getComments())) { if (count($this->_spreadSheet->getSheet($i)->getComments()) > 0) {
// VML Comments // VML Comments
$objZip->addFromString('xl/drawings/vmlDrawing' . ($i + 1) . '.vml', $this->getWriterPart('Comments')->writeVMLComments($this->_spreadSheet->getSheet($i))); $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 // Add header/footer relationship parts
if (!empty($this->_spreadSheet->getSheet($i)->getHeaderFooter()->getImages())) { if (count($this->_spreadSheet->getSheet($i)->getHeaderFooter()->getImages()) > 0) {
// VML Drawings // VML Drawings
$objZip->addFromString('xl/drawings/vmlDrawingHF' . ($i + 1) . '.vml', $this->getWriterPart('Drawing')->writeVMLHeaderFooterImages($this->_spreadSheet->getSheet($i))); $objZip->addFromString('xl/drawings/vmlDrawingHF' . ($i + 1) . '.vml', $this->getWriterPart('Drawing')->writeVMLHeaderFooterImages($this->_spreadSheet->getSheet($i)));

View File

@ -129,7 +129,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
// Comments // Comments
for ($i = 0; $i < $sheetCount; ++$i) { for ($i = 0; $i < $sheetCount; ++$i) {
if (!empty($pPHPExcel->getSheet($i)->getComments())) { if (count($pPHPExcel->getSheet($i)->getComments()) > 0) {
$this->_writeOverrideContentType( $this->_writeOverrideContentType(
$objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml' $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(); $sheetCount = $pPHPExcel->getSheetCount();
for ($i = 0; $i < $sheetCount; ++$i) { for ($i = 0; $i < $sheetCount; ++$i) {
if (!empty($pPHPExcel->getSheet()->getHeaderFooter()->getImages())) { if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) {
foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) { foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) {
if (!isset( $aMediaContentTypes[strtolower($image->getExtension())]) ) { if (!isset( $aMediaContentTypes[strtolower($image->getExtension())]) ) {
$aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType( $image->getPath() ); $aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType( $image->getPath() );

View File

@ -223,7 +223,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
// Write comments relationship? // Write comments relationship?
$i = 1; $i = 1;
if (!empty($pWorksheet->getComments())) { if (count($pWorksheet->getComments()) > 0) {
$this->_writeRelationship( $this->_writeRelationship(
$objWriter, $objWriter,
'_comments_vml' . $i, '_comments_vml' . $i,
@ -241,7 +241,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
// Write header/footer relationship? // Write header/footer relationship?
$i = 1; $i = 1;
if (!empty($pWorksheet->getHeaderFooter()->getImages())) { if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) {
$this->_writeRelationship( $this->_writeRelationship(
$objWriter, $objWriter,
'_headerfooter_vml' . $i, '_headerfooter_vml' . $i,

View File

@ -265,7 +265,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
$objWriter->startElement('definedNames'); $objWriter->startElement('definedNames');
// Named ranges // Named ranges
if (!empty($pPHPExcel->getNamedRanges())) { if (count($pPHPExcel->getNamedRanges()) > 0) {
// Named ranges // Named ranges
$this->_writeNamedRanges($objWriter, $pPHPExcel); $this->_writeNamedRanges($objWriter, $pPHPExcel);
} }

View File

@ -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) private function _writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// cols // cols
if (!empty($pSheet->getColumnDimensions())) { if (count($pSheet->getColumnDimensions()) > 0) {
$objWriter->startElement('cols'); $objWriter->startElement('cols');
$pSheet->calculateColumnWidths(); $pSheet->calculateColumnWidths();
@ -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) private function _writeProtectedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
if (!empty($pSheet->getProtectedCells())) { if (count($pSheet->getProtectedCells()) > 0) {
// protectedRanges // protectedRanges
$objWriter->startElement('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) private function _writeMergeCells(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
if (!empty($pSheet->getMergeCells())) { if (count($pSheet->getMergeCells()) > 0) {
// mergeCells // mergeCells
$objWriter->startElement('mergeCells'); $objWriter->startElement('mergeCells');
@ -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) private function _writeLegacyDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// If sheet contains comments, add the relationships // If sheet contains comments, add the relationships
if (!empty($pSheet->getComments())) { if (count($pSheet->getComments()) > 0) {
$objWriter->startElement('legacyDrawing'); $objWriter->startElement('legacyDrawing');
$objWriter->writeAttribute('r:id', 'rId_comments_vml1'); $objWriter->writeAttribute('r:id', 'rId_comments_vml1');
$objWriter->endElement(); $objWriter->endElement();
@ -1109,8 +1109,8 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
*/ */
private function _writeLegacyDrawingHF(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function _writeLegacyDrawingHF(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// If sheet contains comments, add the relationships // If sheet contains images, add the relationships
if (!empty($pSheet->getHeaderFooter()->getImages())) { if (count($pSheet->getHeaderFooter()->getImages()) > 0) {
$objWriter->startElement('legacyDrawingHF'); $objWriter->startElement('legacyDrawingHF');
$objWriter->writeAttribute('r:id', 'rId_headerfooter_vml1'); $objWriter->writeAttribute('r:id', 'rId_headerfooter_vml1');
$objWriter->endElement(); $objWriter->endElement();