From be4a1b9dca0955bfd6580e3f7d2972893e54539a Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Thu, 20 Jun 2013 10:11:36 +0100 Subject: [PATCH] Namespacing for ZipArchive for readers --- Classes/PHPExcel/Reader/OOCalc.php | 10 +++++----- Classes/PHPExcel/Shared/File.php | 2 +- Classes/PHPExcel/Shared/ZipStreamWrapper.php | 2 +- Classes/PHPExcel/Writer/Excel2007.php | 2 +- install.txt | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Classes/PHPExcel/Reader/OOCalc.php b/Classes/PHPExcel/Reader/OOCalc.php index 4f11a7f..767920b 100644 --- a/Classes/PHPExcel/Reader/OOCalc.php +++ b/Classes/PHPExcel/Reader/OOCalc.php @@ -68,13 +68,13 @@ class Reader_OOCalc extends Reader_Abstract implements Reader_IReader } // Check if zip class exists - if (!class_exists('ZipArchive',FALSE)) { + if (!class_exists('\ZipArchive',FALSE)) { throw new Reader_Exception("ZipArchive library is not enabled"); } $mimeType = 'UNKNOWN'; // Load file - $zip = new ZipArchive; + $zip = new \ZipArchive; if ($zip->open($pFilename) === true) { // check if it is an OOXML archive $stat = $zip->statName('mimetype'); @@ -117,7 +117,7 @@ class Reader_OOCalc extends Reader_Abstract implements Reader_IReader throw new Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } - $zip = new ZipArchive; + $zip = new \ZipArchive; if (!$zip->open($pFilename)) { throw new Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file."); } @@ -169,7 +169,7 @@ class Reader_OOCalc extends Reader_Abstract implements Reader_IReader $worksheetInfo = array(); - $zip = new ZipArchive; + $zip = new \ZipArchive; if (!$zip->open($pFilename)) { throw new Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file."); } @@ -324,7 +324,7 @@ class Reader_OOCalc extends Reader_Abstract implements Reader_IReader $timezoneObj = new DateTimeZone('Europe/London'); $GMT = new DateTimeZone('UTC'); - $zip = new ZipArchive; + $zip = new \ZipArchive; if (!$zip->open($pFilename)) { throw new Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file."); } diff --git a/Classes/PHPExcel/Shared/File.php b/Classes/PHPExcel/Shared/File.php index 69998d4..4d8e168 100644 --- a/Classes/PHPExcel/Shared/File.php +++ b/Classes/PHPExcel/Shared/File.php @@ -81,7 +81,7 @@ class Shared_File $zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6); $archiveFile = substr($pFilename, strpos($pFilename, '#') + 1); - $zip = new ZipArchive(); + $zip = new \ZipArchive(); if ($zip->open($zipFile) === true) { $returnValue = ($zip->getFromName($archiveFile) !== false); $zip->close(); diff --git a/Classes/PHPExcel/Shared/ZipStreamWrapper.php b/Classes/PHPExcel/Shared/ZipStreamWrapper.php index 1ce89e1..98cfd0f 100644 --- a/Classes/PHPExcel/Shared/ZipStreamWrapper.php +++ b/Classes/PHPExcel/Shared/ZipStreamWrapper.php @@ -92,7 +92,7 @@ class Shared_ZipStreamWrapper { $url['fragment'] = substr($path, $pos + 1); // Open archive - $this->_archive = new ZipArchive(); + $this->_archive = new \ZipArchive(); $this->_archive->open($url['host']); $this->_fileNameInArchive = $url['fragment']; diff --git a/Classes/PHPExcel/Writer/Excel2007.php b/Classes/PHPExcel/Writer/Excel2007.php index 42ccfcd..ba5ab1e 100644 --- a/Classes/PHPExcel/Writer/Excel2007.php +++ b/Classes/PHPExcel/Writer/Excel2007.php @@ -319,7 +319,7 @@ class Writer_Excel2007 extends Writer_Abstract implements Writer_IWriter $imagePath = substr($imagePath, 6); $imagePathSplitted = explode('#', $imagePath); - $imageZip = new ZipArchive(); + $imageZip = new \ZipArchive(); $imageZip->open($imagePathSplitted[0]); $imageContents = $imageZip->getFromName($imagePathSplitted[1]); $imageZip->close(); diff --git a/install.txt b/install.txt index 1a999d2..926df78 100644 --- a/install.txt +++ b/install.txt @@ -26,7 +26,7 @@ Requirements ------------ The following requirements should be met prior to using PHPExcel: -* PHP version 5.2.0 or higher +* PHP version 5.3.0 or higher * PHP extension php_zip enabled *) * PHP extension php_xml enabled * PHP extension php_gd2 enabled (if not compiled in)