Definition at line 41 of file ZipArchive.php.
◆ addFromString()
PHPExcel_Shared_ZipArchive::addFromString |
( |
|
$localname, |
|
|
|
$contents |
|
) |
| |
Add a new file to the zip archive from a string of raw data.
- Parameters
-
string | $localname | Directory/Name of the file to add to the zip archive |
string | $contents | String of data to add to the zip archive |
Definition at line 95 of file ZipArchive.php.
96 {
97 $filenameParts = pathinfo($localname);
98
99 $handle = fopen($this->_tempDir.'/'.$filenameParts["basename"], "wb");
101 fclose($handle);
102
103 $res = $this->_zip->add($this->_tempDir.
'/'.$filenameParts[
"basename"],
106 );
109 }
110
111 unlink($this->_tempDir.'/'.$filenameParts["basename"]);
112 }
const PCLZIP_OPT_ADD_PATH
const PCLZIP_OPT_REMOVE_PATH
foreach($_POST as $key=> $value) $res
References $contents, $res, PCLZIP_OPT_ADD_PATH, and PCLZIP_OPT_REMOVE_PATH.
◆ close()
PHPExcel_Shared_ZipArchive::close |
( |
| ) |
|
◆ getFromName()
PHPExcel_Shared_ZipArchive::getFromName |
( |
|
$fileName | ) |
|
Extract file from archive by given fileName (Emulate ZipArchive getFromName())
- Parameters
-
string | $fileName | Filename for the file in zip archive |
- Returns
- string $contents File string contents
Definition at line 141 of file ZipArchive.php.
142 {
143 $list = $this->_zip->listContent();
144 $listCount = count(
$list);
145 $list_index = -1;
146 for (
$i = 0;
$i < $listCount; ++
$i) {
147 if (strtolower(
$list[
$i][
"filename"]) == strtolower($fileName) ||
148 strtolower(
$list[
$i][
"stored_filename"]) == strtolower($fileName)) {
150 break;
151 }
152 }
153
154 $extracted = "";
155 if ($list_index != -1) {
157 } else {
159 $list_index = -1;
160 for (
$i = 0;
$i < $listCount; ++
$i) {
161 if (strtolower(
$list[
$i][
"filename"]) == strtolower($fileName) ||
162 strtolower(
$list[
$i][
"stored_filename"]) == strtolower($fileName)) {
164 break;
165 }
166 }
168 }
169 if ((is_array($extracted)) && ($extracted != 0)) {
171 }
172
174 }
const PCLZIP_OPT_EXTRACT_AS_STRING
if(isset($_REQUEST['delete'])) $list
References $contents, $filename, $i, $list, and PCLZIP_OPT_EXTRACT_AS_STRING.
◆ locateName()
PHPExcel_Shared_ZipArchive::locateName |
( |
|
$fileName | ) |
|
Find if given fileName exist in archive (Emulate ZipArchive locateName())
- Parameters
-
string | $fileName | Filename for the file in zip archive |
- Returns
- boolean
Definition at line 120 of file ZipArchive.php.
121 {
122 $list = $this->_zip->listContent();
123 $listCount = count(
$list);
124 $list_index = -1;
125 for (
$i = 0;
$i < $listCount; ++
$i) {
126 if (strtolower(
$list[
$i][
"filename"]) == strtolower($fileName) ||
127 strtolower(
$list[
$i][
"stored_filename"]) == strtolower($fileName)) {
129 break;
130 }
131 }
132 return ($list_index > -1);
133 }
References $i, and $list.
◆ open()
PHPExcel_Shared_ZipArchive::open |
( |
|
$fileName | ) |
|
Open a new zip archive.
- Parameters
-
string | $fileName | Filename for the zip archive |
- Returns
- boolean
Definition at line 70 of file ZipArchive.php.
71 {
73
74 $this->_zip =
new PclZip($fileName);
75
76 return true;
77 }
static sys_get_temp_dir()
Get the systems temporary directory.
References PHPExcel_Shared_File\sys_get_temp_dir().
◆ $_tempDir
PHPExcel_Shared_ZipArchive::$_tempDir |
|
private |
◆ $_zip
PHPExcel_Shared_ZipArchive::$_zip |
|
private |
◆ CREATE
const PHPExcel_Shared_ZipArchive::CREATE = 'CREATE' |
◆ OVERWRITE
const PHPExcel_Shared_ZipArchive::OVERWRITE = 'OVERWRITE' |
The documentation for this class was generated from the following file:
- libs/composer/vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/ZipArchive.php