UnZip Class

This class is based on a library I found at PHPClasses: http://phpclasses.org/package/2495-PHP-Pack-and-unpack-files-packed-in-ZIP-archives.html

The original library is a little rough around the edges so I refactored it and added several additional methods -- Phil Sturgeon

This class requires extension ZLib Enabled.

package Fuel
subpackage Core
category Encryption
author Alexandre Tedeschi
author Phil Sturgeon
license
version 1.0.0

 Methods

Free the file resource Automatic destroy.

__destroy() 

What extensions do we want out of this ZIP

allow(string $ext) 

Parameters

$ext

string

Free the file resource.

close() 

Show debug messages

debug_string(string $open, string $close) : string

Parameters

$open

string

$close

string

Returns

string

Show error messages

error_string(string $open, string $close) : string

Parameters

$open

string

$close

string

Returns

string

Unzip all files in archive.

extract(string $zip_file, string $target_dir, string $preserve_filepath) : array

Parameters

$zip_file

string

$target_dir

string

$preserve_filepath

string

Exceptions

\FuelException

Returns

array

Save debug data

set_debug($string) 

Parameters

$string

Save errors

set_error($string) 

Parameters

$string

Unzip file in archive.

_extract_file(string $compressed_file_name, string $target_file_name) : int | string | bool

Parameters

$compressed_file_name

string

$target_file_name

string

Exceptions

\FuelException

Returns

intstringbool

_get_file_header()

_get_file_header($fh, $start_offset) 

Parameters

$fh

$start_offset

List all files in archive.

_list_files(bool $stop_on_file) : array

Parameters

$stop_on_file

bool

Exceptions

\FuelException

Returns

array

_load_file_list_by_eof()

_load_file_list_by_eof($fh, $stop_on_file) 

Parameters

$fh

$stop_on_file

_load_files_by_signatures()

_load_files_by_signatures($fh, $stop_on_file) 

Parameters

$fh

$stop_on_file

Uncompress file.

_uncompress(mixed $content, int $mode, int $uncompressed_size, string $target_file_name) : int | string | bool

And save it to the targetFile.

Parameters

$content

mixed

$mode

int

$uncompressed_size

int

$target_file_name

string

Exceptions

\FuelException

Returns

intstringbool

 Properties

 

$_allow_extensions

$_allow_extensions 

 

$_skip_dirs

$_skip_dirs 

 

$_target_dir

$_target_dir 

 

$_zip_file

$_zip_file 

 

$apply_chmod

$apply_chmod 

 

$central_dir_list

$central_dir_list 

 

$central_signature_end

$central_signature_end 

 

$compressed_list

$compressed_list 

 

$dir_signature

$dir_signature 

 

$end_of_central

$end_of_central 

 

$error

$error 

 

$fh

$fh 

 

$info

$info 

 

$zip_signature

$zip_signature