PHP Class Horde_Compress_Zip, horde

The ZIP compression code is partially based on code from: Eric Mueller http://www.zend.com/codex.php?id=535&single=1 Deins125 http://www.zend.com/codex.php?id=470&single=1 The ZIP compression date code is partially based on code from Peter Listiak Copyright 2000-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Author: Chuck Hagenbuch ([email protected])
Author: Michael Cochrane ([email protected])
Author: Michael Slusarz ([email protected])
Inheritance: extends Horde_Compress_Base
ファイルを表示 Open project: horde/horde

Public Properties

Property Type Description
$canCompress
$canDecompress

Protected Properties

Property Type Description
$_ctrldir array Temporary data for compressing files.
$_methods array ZIP compression methods.
$_tmp resource Temporary contents for compressing files.

Public Methods

Method Description
checkZipData ( string $data ) : boolean Checks to see if the data is a valid ZIP file.
compress ( array $data, array $params = [] ) : mixed
decompress ( $data, array $params = [] ) : mixed

Protected Methods

Method Description
_addToZipFile ( array $file ) Adds a "file" to the ZIP archive.
_getZipData ( string $data, array $info, integer $key ) : string Returns the data for a specific archived file.
_getZipInfo ( string $data ) : array Get the list of files/data from the zip archive.
_unix2DOSTime ( integer $unixtime = null ) : integer Converts a UNIX timestamp to a 4-byte DOS date and time format (date in high 2-bytes, time in low 2-bytes allowing magnitude comparison).

Method Details

_addToZipFile() protected method

Adds a "file" to the ZIP archive.
protected _addToZipFile ( array $file )
$file array See self::createZipFile().

_getZipData() protected method

Returns the data for a specific archived file.
protected _getZipData ( string $data, array $info, integer $key ) : string
$data string The zip archive contents.
$info array The information array from _getZipInfo().
$key integer The position of the file in the archive.
return string The file data.

_getZipInfo() protected method

Get the list of files/data from the zip archive.
protected _getZipInfo ( string $data ) : array
$data string The zipfile data.
return array See decompress() for the format.

_unix2DOSTime() protected method

Converts a UNIX timestamp to a 4-byte DOS date and time format (date in high 2-bytes, time in low 2-bytes allowing magnitude comparison).
protected _unix2DOSTime ( integer $unixtime = null ) : integer
$unixtime integer The current UNIX timestamp.
return integer The current date in a 4-byte DOS format.

checkZipData() public method

Checks to see if the data is a valid ZIP file.
public checkZipData ( string $data ) : boolean
$data string The ZIP file data.
return boolean True if valid, false if invalid.

compress() public method

public compress ( array $data, array $params = [] ) : mixed
$data array The data to compress. Requires an array of arrays. Each subarray should contain these fields: - data: (string/resource) The data to compress. - name: (string) The pathname to the file. - time: (integer) [optional] The timestamp to use for the file.
$params array The parameter array. - stream: (boolean) If set, return a stream instead of a string. DEFAULT: Return string
return mixed The ZIP file as either a string or a stream resource.

decompress() public method

public decompress ( $data, array $params = [] ) : mixed
$params array The parameter array. - action: (integer) [REQUIRED] The action to take on the data. Either self::ZIP_LIST or self::ZIP_DATA. - info: (array) [REQUIRED for ZIP_DATA] The zipfile list. - key: (integer) [REQUIRED for ZIP_DATA] The position of the file in the archive list.
return mixed If action is self::ZIP_DATA, the uncompressed data. If action is self::ZIP_LIST, an array with the KEY as the position in the zipfile and these values: - attr: File attributes - crc: CRC checksum - csize: Compressed file size - date: File modification time - name: Filename - method: Compression method - size: Original file size - type: File type

Property Details

$_ctrldir protected_oe property

Temporary data for compressing files.
protected array $_ctrldir
return array

$_methods protected_oe property

ZIP compression methods.
protected array $_methods
return array

$_tmp protected_oe property

Temporary contents for compressing files.
protected resource $_tmp
return resource

$canCompress public_oe property

public $canCompress

$canDecompress public_oe property

public $canDecompress