Skip to content

Commit 7e23484

Browse files
author
Roman Syroeshko
committed
#58 - fix for ZipArchive calls.
1 parent 0c449a6 commit 7e23484

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

src/Reader/Word2007.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function canRead($pFilename)
5555

5656
$return = false;
5757
// Load file
58-
$zip = new ZipArchive();
58+
$zip = new \ZipArchive();
5959
if ($zip->open($pFilename) === true) {
6060
// check if it is an OOXML archive
6161
$rels = simplexml_load_string($this->getFromZipArchive($zip, "_rels/.rels"));
@@ -120,7 +120,7 @@ public function load($pFilename)
120120

121121
// Initialisations
122122
$word = new PhpWord();
123-
$zip = new ZipArchive();
123+
$zip = new \ZipArchive();
124124
$zip->open($pFilename);
125125

126126
// Read properties and documents

src/Shared/ZipStreamWrapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function stream_open($path, $mode, $options, &$opened_path)
9999
}
100100

101101
// Open archive
102-
$this->_archive = new ZipArchive();
102+
$this->_archive = new \ZipArchive();
103103
$this->_archive->open($url['host']);
104104

105105
$this->_fileNameInArchive = $url['fragment'];

src/Template.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Template
3535
/**
3636
* ZipArchive
3737
*
38-
* @var ZipArchive
38+
* @var \ZipArchive
3939
*/
4040
private $_objZip;
4141

@@ -72,7 +72,7 @@ public function __construct($strFilename)
7272
throw new Exception("Could not copy the template from {$strFilename} to {$this->_tempFileName}.");
7373
}
7474

75-
$this->_objZip = new ZipArchive();
75+
$this->_objZip = new \ZipArchive();
7676
$this->_objZip->open($this->_tempFileName);
7777

7878
$this->_documentXML = $this->_objZip->getFromName('word/document.xml');

src/Writer/ODText.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,17 @@ public function save($pFilename = null)
115115
// Create drawing dictionary
116116

117117
// Create new ZIP file and open it for writing
118-
$objZip = new ZipArchive();
118+
$objZip = new \ZipArchive();
119119

120120
// Try opening the ZIP file
121-
if ($objZip->open($pFilename, ZIPARCHIVE::OVERWRITE) !== true) {
122-
if ($objZip->open($pFilename, ZIPARCHIVE::CREATE) !== true) {
121+
if ($objZip->open($pFilename, \ZipArchive::OVERWRITE) !== true) {
122+
if ($objZip->open($pFilename, \ZipArchive::CREATE) !== true) {
123123
throw new \Exception("Could not open " . $pFilename . " for writing.");
124124
}
125125
}
126126

127127
// Add mimetype to ZIP file
128-
//@todo Not in ZIPARCHIVE::CM_STORE mode
128+
//@todo Not in \ZipArchive::CM_STORE mode
129129
$objZip->addFromString('mimetype', $this->getWriterPart('mimetype')->writeMimetype($this->_document));
130130

131131
// Add content.xml to ZIP file
@@ -151,7 +151,7 @@ public function save($pFilename = null)
151151
$imagePath = substr($imagePath, 6);
152152
$imagePathSplitted = explode('#', $imagePath);
153153

154-
$imageZip = new ZipArchive();
154+
$imageZip = new \ZipArchive();
155155
$imageZip->open($imagePathSplitted[0]);
156156
$imageContents = $imageZip->getFromName($imagePathSplitted[1]);
157157
$imageZip->close();

src/Writer/Word2007.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ public function save($pFilename = null)
8686
}
8787

8888
// Create new ZIP file and open it for writing
89-
$objZip = new ZipArchive();
89+
$objZip = new \ZipArchive();
9090

9191
// Try opening the ZIP file
92-
if ($objZip->open($pFilename, ZIPARCHIVE::OVERWRITE) !== true) {
93-
if ($objZip->open($pFilename, ZIPARCHIVE::CREATE) !== true) {
92+
if ($objZip->open($pFilename, \ZipArchive::OVERWRITE) !== true) {
93+
if ($objZip->open($pFilename, \ZipArchive::CREATE) !== true) {
9494
throw new Exception("Could not open " . $pFilename . " for writing.");
9595
}
9696
}

0 commit comments

Comments
 (0)