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 GPL2 or any later version
- Since
- Stud.IP 4.0
◆ addFromPath()
addFromPath |
( |
|
$path, |
|
|
|
$folder = '' |
|
) |
| |
Adds all files from a certain path.
- Parameters
-
String | $path | Path name to add |
- Returns
- Array of local filenames Studip::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, |
|
|
|
$force_zip_extension = false |
|
) |
| |
|
static |
Create and open an archive. Will add .zip extension if missing.
- Parameters
-
String | $filename | Name of the zip archive |
bool | $force_zip_extension | Specifies whether the resulting ZIP file shall have the .zip file extension (true) or not (false). Defaults to false. |
- Returns
- Studip
◆ 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.
◆ 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: