Custom derived ZipArchive class with convenience methods for zip archive handling.
This replaces the before-used PCLZip vendor library.
- Author
- Jan-Hendrik Willms tleil.nosp@m.ax+s.nosp@m.tudip.nosp@m.@gma.nosp@m.il.co.nosp@m.m @license GPL2 or any later version
- Since
- Stud.IP 4.0
◆ addFile()
| addFile |
( |
|
$filename, |
|
|
|
$localname = null, |
|
|
|
$start = 0, |
|
|
|
$length = 0 |
|
) |
| |
Adds a single file.
- Parameters
-
| String | $filename | Name of the file to add |
| String | $localname | Name of the file inside the archive, will default to $filename |
| int | $start | Unused but required (according to php doc) |
| int | $length | Unused but required (according to php doc) |
- Returns
- false on error, $localname otherwise
◆ addFromPath()
| addFromPath |
( |
|
$path, |
|
|
|
$folder = '' |
|
) |
| |
Adds all files from a certain path.
- Parameters
-
| String | $path | Path name to add |
- Returns
- Array of local filenames @uses Studip\ZipArchive::addFile
◆ convertArchiveFilename()
| convertArchiveFilename |
( |
|
$filename | ) |
|
Converts the filename from a format that a zip file should be able to handle.
- Parameters
-
| String | $filename | Name of the input file from the archive |
- Returns
- String containing the converted filename
◆ convertLocalFilename()
| convertLocalFilename |
( |
|
$filename | ) |
|
Converts the filename to a format that a zip file should be able to handle.
- Parameters
-
| String | $filename | Name of the input file |
- Returns
- String containing the converted filename
◆ create()
| static create |
( |
|
$filename | ) |
|
|
static |
Create and open an archive. Will add .zip extension if missing.
- Parameters
-
| String | $filename | Name of the zip archive |
- Returns
- Studip\ZipArchive
◆ extractToPath()
| static extractToPath |
( |
|
$filename, |
|
|
|
$path |
|
) |
| |
|
static |
Extracts a zip archive to a certain path. Filenames will be converted during this process. Malicious items containing ../ will be excluded.
- Parameters
-
| String | $filename | Name of the zip archive |
| String | $path | Local path to extract to |
- Returns
- bool indicating whether the archive could be extracted.
- Todo:
- A little more error checking would be nice.
◆ getOutputEncoding()
◆ setOutputEncoding()
| setOutputEncoding |
( |
|
$string | ) |
|
◆ test()
Tests whether a zip archive is not corrupted.
- Parameters
-
| String | $filename | Name of the zip archive |
- Returns
- bool indicating whether the archive is not corrupted
◆ $output_encoding
| $output_encoding = 'UTF-8' |
|
protected |
The documentation for this class was generated from the following file: