Property | Type | Description | |
---|---|---|---|
$canCompress | |||
$canDecompress |
Property | Type | Description | |
---|---|---|---|
$_ctrldir | array | Temporary data for compressing files. | |
$_methods | array | ZIP compression methods. | |
$_tmp | resource | Temporary contents for compressing files. |
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 |
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). |
protected _addToZipFile ( array $file ) | ||
$file | array | See self::createZipFile(). |
protected _getZipInfo ( string $data ) : array | ||
$data | string | The zipfile data. |
return | array | See decompress() for the format. |
protected _unix2DOSTime ( integer $unixtime = null ) : integer | ||
$unixtime | integer | The current UNIX timestamp. |
return | integer | The current date in a 4-byte DOS format. |
public checkZipData ( string $data ) : boolean | ||
$data | string | The ZIP file data. |
return | boolean | True if valid, false if invalid. |
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. |
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 |
protected array $_ctrldir | ||
return | array |
protected resource $_tmp | ||
return | resource |