Stud.IP  5.4
ZipArchive Class Reference
Inheritance diagram for ZipArchive:

Public Member Functions

 getOutputEncoding ()
 
 setOutputEncoding ($string)
 
 addFromPath ($path, $folder='')
 
 convertLocalFilename ($filename)
 
 convertArchiveFilename ($filename)
 

Static Public Member Functions

static create ($filename, $force_zip_extension=false)
 
static test ($filename)
 
static extractToPath ($filename, $path)
 

Protected Attributes

 $output_encoding = 'UTF-8'
 

Detailed Description

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

Member Function Documentation

◆ addFromPath()

addFromPath (   $path,
  $folder = '' 
)

Adds all files from a certain path.

Parameters
String$pathPath 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$filenameName 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$filenameName 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$filenameName of the zip archive
bool$force_zip_extensionSpecifies 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$filenameName of the zip archive
String$pathLocal path to extract to
Returns
bool indicating whether the archive could be extracted.

◆ getOutputEncoding()

getOutputEncoding ( )

◆ setOutputEncoding()

setOutputEncoding (   $string)

◆ test()

static test (   $filename)
static

Tests whether a zip archive is not corrupted.

Parameters
String$filenameName of the zip archive
Returns
bool indicating whether the archive is not corrupted

Field Documentation

◆ $output_encoding

$output_encoding = 'UTF-8'
protected

The documentation for this class was generated from the following file: