Fixes to ZipArchive cass when PCLZip being used

Fixes to default arguments when typehinted arguments in Chart writer are null values
Fix to gitignore for Examples folder/subfolders
This commit is contained in:
MarkBaker 2016-08-13 14:52:49 +01:00
parent 2da06e5b03
commit 8569f04090
9 changed files with 19 additions and 10 deletions

9
Examples/.gitignore vendored
View File

@ -2,4 +2,11 @@
*.xlsx
*.csv
*.jpg
*.pdf
*.pdf
*.htm
*.html
*.log
!.gitignore
!data/**
!images/**
!templates/**

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -76,7 +76,8 @@ class File
$zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6);
$archiveFile = substr($pFilename, strpos($pFilename, '#') + 1);
$zip = new ZipArchive();
$zipClass = \PHPExcel\Settings::getZipClass();
$zip = new $zipClass();
if ($zip->open($zipFile) === true) {
$returnValue = ($zip->getFromName($archiveFile) !== false);
$zip->close();

View File

@ -501,4 +501,3 @@ necessary. Here is a sample; alter the names:
That's all there is to it!

View File

@ -88,7 +88,8 @@ class ZipStreamWrapper
$url['fragment'] = substr($path, $pos + 1);
// Open archive
$this->archive = new ZipArchive();
$zipClass = \PHPExcel\Settings::getZipClass();
$this->archive = new $zipClass();
$this->archive->open($url['host']);
$this->fileNameInArchive = $url['fragment'];

View File

@ -351,7 +351,8 @@ class Excel2007 extends BaseWriter implements IWriter
$imagePath = substr($imagePath, 6);
$imagePathSplitted = explode('#', $imagePath);
$imageZip = new ZipArchive();
$zipClass = \PHPExcel\Settings::getZipClass();
$imageZip = new $zipClass();
$imageZip->open($imagePathSplitted[0]);
$imageContents = $imageZip->getFromName($imagePathSplitted[1]);
$imageZip->close();

View File

@ -126,7 +126,7 @@ class Chart extends WriterPart
*
* @throws \PHPExcel\Writer\Exception
*/
private function writeTitle(Title $title, $objWriter)
private function writeTitle(Title $title=null, $objWriter)
{
if (is_null($title)) {
return;
@ -171,7 +171,7 @@ class Chart extends WriterPart
*
* @throws \PHPExcel\Writer\Exception
*/
private function writeLegend(Legend $legend, $objWriter)
private function writeLegend(Legend $legend=null, $objWriter)
{
if (is_null($legend)) {
return;
@ -226,7 +226,7 @@ class Chart extends WriterPart
*
* @throws \PHPExcel\Writer\Exception
*/
private function writePlotArea(PlotArea $plotArea, Title $xAxisLabel, Title $yAxisLabel, $objWriter, \PHPExcel\Worksheet $pSheet, Axis $xAxis, Axis $yAxis, GridLines $majorGridlines, GridLines $minorGridlines)
private function writePlotArea(PlotArea $plotArea, Title $xAxisLabel=null, Title $yAxisLabel=null, $objWriter, \PHPExcel\Worksheet $pSheet, Axis $xAxis=null, Axis $yAxis=null, GridLines $majorGridlines=null, GridLines $minorGridlines=null)
{
if (is_null($plotArea)) {
return;
@ -361,7 +361,7 @@ class Chart extends WriterPart
*
* @throws \PHPExcel\Writer\Exception
*/
private function writeDataLabels($objWriter, $chartLayout)
private function writeDataLabels($objWriter, Layout $chartLayout=null)
{
$objWriter->startElement('c:dLbls');
@ -1404,7 +1404,7 @@ class Chart extends WriterPart
*
* @throws \PHPExcel\Writer\Exception
*/
private function writeLayout(Layout $layout, $objWriter)
private function writeLayout(Layout $layout=null, $objWriter)
{
$objWriter->startElement('c:layout');