PHP Class PHPZip\Zip\File\Zip

Inheritance: extends PHPZip\Zip\Core\AbstractZipArchive
Show file Open project: Grandt/PHPZip Class Usage Examples

Public Methods

Method Description
__construct ( boolean $useZipFile = false ) Constructor.
__destruct ( ) Destructor.
getArchiveSize ( ) : integer Return the current size of the archive
getZipData ( ) : string Get the zip file contents If the zip haven't been finalized yet, this will cause it to become finalized
getZipFile ( ) : resource Get the handle resource for the archive zip file.
onBeginAddFile ( array $params ) Called by superclass when specialised action is needed at the start of adding a file to the archive.
onBeginBuildResponseHeader ( ) Called by superclass when specialised action is needed at the start of sending the zip file response header.
onBuildZipEntry ( array $params ) Called by superclass when specialised action is needed while building a zip entry.
onEndAddFile ( array $params ) Called by superclass when specialised action is needed at the end of adding a file to the archive.
onEndBuildResponseHeader ( ) Called by superclass when specialised action is needed at the end of sending the zip file response header.
onOpenStream ( ) Called by superclass when specialised action is needed while opening a stream.
onProcessFile ( array $params ) Called by superclass when specialised action is needed while processing a file.
saveZipFile ( $fileName ) : boolean Alias for setZipFile
sendZip ( String $fileName = null, String $contentType = self::CONTENT_TYPE, String $utf8FileName = null, boolean $inline = false ) : boolean Send the archive as a zip download
setZipFile ( string $fileName ) : boolean Set zip file to write zip data to.
zipFlush ( ) Flush Zip Data stored in memory, to a temp file.
zipFlushBuffer ( )
zipVerifyMemBuffer ( integer $gzLength ) Verify if the memory buffer is about to be exceeded.
zipWrite ( string $data )

Method Details

__construct() public method

Constructor.
Author: A. Grandt ([email protected])
Author: Greg Kappatos
public __construct ( boolean $useZipFile = false )
$useZipFile boolean Write temp zip data to tempFile? Default FALSE

__destruct() public method

Perform clean up actions.
Author: A. Grandt ([email protected])
public __destruct ( )

getArchiveSize() public method

Return the current size of the archive
Author: A. Grandt ([email protected])
public getArchiveSize ( ) : integer
return integer Size of the archive

getZipData() public method

Get the zip file contents If the zip haven't been finalized yet, this will cause it to become finalized
Author: A. Grandt ([email protected])
Author: Greg Kappatos
public getZipData ( ) : string
return string zip data

getZipFile() public method

If the zip haven't been finalized yet, this will cause it to become finalized
Author: A. Grandt ([email protected])
public getZipFile ( ) : resource
return resource zip file handle

onBeginAddFile() public method

Called by superclass when specialised action is needed at the start of adding a file to the archive.
Author: A. Grandt ([email protected])
Author: Greg Kappatos
public onBeginAddFile ( array $params )
$params array Array that contains gzLength.

onBeginBuildResponseHeader() public method

Called by superclass when specialised action is needed at the start of sending the zip file response header.
Author: A. Grandt ([email protected])
Author: Greg Kappatos

onBuildZipEntry() public method

Called by superclass when specialised action is needed while building a zip entry.
Author: A. Grandt ([email protected])
Author: Greg Kappatos
public onBuildZipEntry ( array $params )
$params array Array that contains zipEntry.

onEndAddFile() public method

Called by superclass when specialised action is needed at the end of adding a file to the archive.
Author: A. Grandt ([email protected])
Author: Greg Kappatos
public onEndAddFile ( array $params )
$params array Array that contains gzData.

onEndBuildResponseHeader() public method

Called by superclass when specialised action is needed at the end of sending the zip file response header.
Author: A. Grandt ([email protected])
Author: Greg Kappatos

onOpenStream() public method

Called by superclass when specialised action is needed while opening a stream.
Author: A. Grandt ([email protected])
Author: Greg Kappatos
public onOpenStream ( )

onProcessFile() public method

Called by superclass when specialised action is needed while processing a file.
Author: A. Grandt ([email protected])
Author: Greg Kappatos
public onProcessFile ( array $params )
$params array Array that contains data.

saveZipFile() public method

Alias for setZipFile
public saveZipFile ( $fileName ) : boolean
$fileName
return boolean

sendZip() public method

Send the archive as a zip download
Author: A. Grandt ([email protected])
public sendZip ( String $fileName = null, String $contentType = self::CONTENT_TYPE, String $utf8FileName = null, boolean $inline = false ) : boolean
$fileName String The name of the Zip archive, in ISO-8859-1 (or ASCII) encoding, ie. "archive.zip". Optional, defaults to null, which means that no ISO-8859-1 encoded file name will be specified.
$contentType String Content mime type. Optional, defaults to "application/zip".
$utf8FileName String The name of the Zip archive, in UTF-8 encoding. Optional, defaults to null, which means that no UTF-8 encoded file name will be specified.
$inline boolean Use Content-Disposition with "inline" instead of "attachment". Optional, defaults to false.
return boolean $success

setZipFile() public method

This will cause all present and future data written to this class to be written to this file. This can be used at any time, even after the Zip Archive have been finalized. Any previous file will be closed. Warning: If the given file already exists, it will be overwritten.
Author: A. Grandt ([email protected])
public setZipFile ( string $fileName ) : boolean
$fileName string
return boolean Success

zipFlush() public method

Flush Zip Data stored in memory, to a temp file.
Author: A. Grandt ([email protected])
public zipFlush ( )

zipFlushBuffer() public method

Author: A. Grandt ([email protected])
public zipFlushBuffer ( )

zipVerifyMemBuffer() public method

Verify if the memory buffer is about to be exceeded.
Author: A. Grandt ([email protected])
public zipVerifyMemBuffer ( integer $gzLength )
$gzLength integer length of the pending data.

zipWrite() public method

Author: A. Grandt ([email protected])
public zipWrite ( string $data )
$data string