https://github.com/PHPOffice/PHPWord/issues/58 - fix for ZipArchive calls.
This commit is contained in:
parent
0c449a6a0c
commit
7e23484619
@ -55,7 +55,7 @@ class Word2007 extends AbstractReader implements IReader
|
||||
|
||||
$return = false;
|
||||
// Load file
|
||||
$zip = new ZipArchive();
|
||||
$zip = new \ZipArchive();
|
||||
if ($zip->open($pFilename) === true) {
|
||||
// check if it is an OOXML archive
|
||||
$rels = simplexml_load_string($this->getFromZipArchive($zip, "_rels/.rels"));
|
||||
@ -120,7 +120,7 @@ class Word2007 extends AbstractReader implements IReader
|
||||
|
||||
// Initialisations
|
||||
$word = new PhpWord();
|
||||
$zip = new ZipArchive();
|
||||
$zip = new \ZipArchive();
|
||||
$zip->open($pFilename);
|
||||
|
||||
// Read properties and documents
|
||||
|
||||
@ -99,7 +99,7 @@ class ZipStreamWrapper
|
||||
}
|
||||
|
||||
// Open archive
|
||||
$this->_archive = new ZipArchive();
|
||||
$this->_archive = new \ZipArchive();
|
||||
$this->_archive->open($url['host']);
|
||||
|
||||
$this->_fileNameInArchive = $url['fragment'];
|
||||
|
||||
@ -35,7 +35,7 @@ class Template
|
||||
/**
|
||||
* ZipArchive
|
||||
*
|
||||
* @var ZipArchive
|
||||
* @var \ZipArchive
|
||||
*/
|
||||
private $_objZip;
|
||||
|
||||
@ -72,7 +72,7 @@ class Template
|
||||
throw new Exception("Could not copy the template from {$strFilename} to {$this->_tempFileName}.");
|
||||
}
|
||||
|
||||
$this->_objZip = new ZipArchive();
|
||||
$this->_objZip = new \ZipArchive();
|
||||
$this->_objZip->open($this->_tempFileName);
|
||||
|
||||
$this->_documentXML = $this->_objZip->getFromName('word/document.xml');
|
||||
|
||||
@ -115,17 +115,17 @@ class ODText implements IWriter
|
||||
// Create drawing dictionary
|
||||
|
||||
// Create new ZIP file and open it for writing
|
||||
$objZip = new ZipArchive();
|
||||
$objZip = new \ZipArchive();
|
||||
|
||||
// Try opening the ZIP file
|
||||
if ($objZip->open($pFilename, ZIPARCHIVE::OVERWRITE) !== true) {
|
||||
if ($objZip->open($pFilename, ZIPARCHIVE::CREATE) !== true) {
|
||||
if ($objZip->open($pFilename, \ZipArchive::OVERWRITE) !== true) {
|
||||
if ($objZip->open($pFilename, \ZipArchive::CREATE) !== true) {
|
||||
throw new \Exception("Could not open " . $pFilename . " for writing.");
|
||||
}
|
||||
}
|
||||
|
||||
// Add mimetype to ZIP file
|
||||
//@todo Not in ZIPARCHIVE::CM_STORE mode
|
||||
//@todo Not in \ZipArchive::CM_STORE mode
|
||||
$objZip->addFromString('mimetype', $this->getWriterPart('mimetype')->writeMimetype($this->_document));
|
||||
|
||||
// Add content.xml to ZIP file
|
||||
@ -151,7 +151,7 @@ class ODText implements 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();
|
||||
|
||||
@ -86,11 +86,11 @@ class Word2007 implements IWriter
|
||||
}
|
||||
|
||||
// Create new ZIP file and open it for writing
|
||||
$objZip = new ZipArchive();
|
||||
$objZip = new \ZipArchive();
|
||||
|
||||
// Try opening the ZIP file
|
||||
if ($objZip->open($pFilename, ZIPARCHIVE::OVERWRITE) !== true) {
|
||||
if ($objZip->open($pFilename, ZIPARCHIVE::CREATE) !== true) {
|
||||
if ($objZip->open($pFilename, \ZipArchive::OVERWRITE) !== true) {
|
||||
if ($objZip->open($pFilename, \ZipArchive::CREATE) !== true) {
|
||||
throw new Exception("Could not open " . $pFilename . " for writing.");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user