Overview

Packages

  • Compress

Classes

  • Horde_Compress
  • Horde_Compress_Base
  • Horde_Compress_Dbx
  • Horde_Compress_Exception
  • Horde_Compress_Gzip
  • Horde_Compress_Rar
  • Horde_Compress_Tar
  • Horde_Compress_Tnef
  • Horde_Compress_Translation
  • Horde_Compress_Zip
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Compress_Zip

The Horde_Compress_zip class allows ZIP files to be created and read.

The ZIP compression code is partially based on code from: Eric Mueller eric@themepark.com http://www.zend.com/codex.php?id=535&single=1 Deins125 webmaster@atlant.ru http://www.zend.com/codex.php?id=470&single=1

The ZIP compression date code is partially based on code from Peter Listiak mlady@users.sourceforge.net

Copyright 2000-2012 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.

Horde_Compress_Base
Extended by Horde_Compress_Zip
Package: Compress
Category: Horde
License: LGPL 2.1
Author: Chuck Hagenbuch chuck@horde.org
Author: Michael Cochrane mike@graftonhall.co.nz
Author: Michael Slusarz slusarz@horde.org
Located at Horde/Compress/Zip.php
Methods summary
public mixed
# compress( array $data, array $params = array() )

Parameters

$data
The data to compress. <pre>Requires an <span class="php-keyword1">array</span> of arrays - <span class="php-keyword2">each</span> subarray should contain the following fields: data - (string/resource) The data to compress. name - (string) The pathname to the <span class="php-keyword2">file</span>. <span class="php-keyword2">time</span> - (integer) [optional] The timestamp to <span class="php-keyword1">use</span> <span class="php-keyword1">for</span> the <span class="php-keyword2">file</span>.</pre>
$params
The parameter array. <pre>stream - (boolean) <span class="php-keyword1">If</span> set, <span class="php-keyword1">return</span> a stream instead of a string. <span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">Return</span> string</pre>

Returns

mixed
The ZIP file as either a string or a stream resource.

Throws

Horde_Compress_Exception

Overrides

Horde_Compress_Base::compress()
public mixed
# decompress( array $data, array $params = array() )

Parameters

$data
$params The parameter array. <pre>The following parameters are REQUIRED: <span class="php-quote">'action'</span> - (integer) The action to take on the data. Either self::ZIP_LIST <span class="php-keyword1">or</span> self::ZIP_DATA. The following parameters are REQUIRED <span class="php-keyword1">for</span> self::ZIP_DATA also: <span class="php-quote">'info'</span> - (<span class="php-keyword1">array</span>) The zipfile <span class="php-keyword1">list</span>. <span class="php-quote">'key'</span> - (integer) The position of the <span class="php-keyword2">file</span> in the archive <span class="php-keyword1">list</span>.</pre>
$params
<p>An array of arguments needed to decompress the data.</p>

Returns

mixed

If action is self::ZIP_DATA, the uncompressed data. If action is self::ZIP_LIST, the following data:

KEY: Position in zipfile
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

Throws

Horde_Compress_Exception

Overrides

Horde_Compress_Base::decompress()
public boolean
# checkZipData( string $data )

Checks to see if the data is a valid ZIP file.

Checks to see if the data is a valid ZIP file.

Parameters

$data
The ZIP file data.

Returns

boolean
True if valid, false if invalid.
Constants summary
integer ZIP_LIST
# 1
integer ZIP_DATA
# 2
string CTRL_DIR_HEADER
# "\x50\x4b\x01\x02"
string CTRL_DIR_END
# "\x50\x4b\x05\x06\x00\x00\x00\x00"
string FILE_HEADER
# "\x50\x4b\x03\x04"
Properties summary
public boolean $canCompress
# true
public boolean $canDecompress
# true
API documentation generated by ApiGen