\Unzip

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.

Summary

Methods
Properties
Constants
__construct()
extract()
allow()
error_string()
debug_string()
set_error()
set_debug()
close()
__destroy()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
_reinit()
_list_files()
_extract_file()
_uncompress()
_load_file_list_by_eof()
_load_files_by_signatures()
_get_file_header()
$compressed_list
$central_dir_list
$end_of_central
$info
$error
$_zip_file
$_target_dir
$apply_chmod
$fh
$zip_signature
$dir_signature
$central_signature_end
$_skip_dirs
$_allow_extensions
N/A

Properties

$compressed_list

$compressed_list : 

Type

$central_dir_list

$central_dir_list : 

Type

$end_of_central

$end_of_central : 

Type

$info

$info : 

Type

$error

$error : 

Type

$_zip_file

$_zip_file : 

Type

$_target_dir

$_target_dir : 

Type

$apply_chmod

$apply_chmod : 

Type

$fh

$fh : 

Type

$zip_signature

$zip_signature : 

Type

$dir_signature

$dir_signature : 

Type

$central_signature_end

$central_signature_end : 

Type

$_skip_dirs

$_skip_dirs : 

Type

$_allow_extensions

$_allow_extensions : 

Type

Methods

__construct()

__construct() : \none

Constructor

Returns

\none

extract()

extract(  $zip_file,   $target_dir = NULL,   $preserve_filepath = TRUE) : \none

Unzip all files in archive.

Parameters

$zip_file
$target_dir
$preserve_filepath

Returns

\none

allow()

allow(  $ext = NULL) : \none

What extensions do we want out of this ZIP

Parameters

$ext

Returns

\none

error_string()

error_string(  $open = '<p>',   $close = '</p>') : string

Show error messages

Parameters

$open
$close

Returns

string

debug_string()

debug_string(  $open = '<p>',   $close = '</p>') : string

Show debug messages

Parameters

$open
$close

Returns

string

set_error()

set_error(  $string) : \none

Save errors

Parameters

$string

Returns

\none

set_debug()

set_debug(  $string) : \none

Save debug data

Parameters

$string

Returns

\none

close()

close() : \none

Free the file resource.

Returns

\none

__destroy()

__destroy() : \none

Free the file resource Automatic destroy.

Returns

\none

_reinit()

_reinit() : \none

re inizilize all variables

Returns

\none

_list_files()

_list_files(  $stop_on_file = FALSE) : mixed

List all files in archive.

Parameters

$stop_on_file

Returns

mixed

_extract_file()

_extract_file(  $compressed_file_name,   $target_file_name = FALSE) : \Unziped

Unzip file in archive.

Parameters

$compressed_file_name
$target_file_name

Returns

\Unziped —

file.

_uncompress()

_uncompress(  $content,   $mode,   $uncompressed_size,   $target_file_name = FALSE) : \none

Uncompress file. And save it to the targetFile.

Parameters

$content
$mode
$uncompressed_size
$target_file_name

Returns

\none

_load_file_list_by_eof()

_load_file_list_by_eof(  $fh,   $stop_on_file = FALSE) 

Parameters

$fh
$stop_on_file

_load_files_by_signatures()

_load_files_by_signatures(  $fh,   $stop_on_file = FALSE) 

Parameters

$fh
$stop_on_file

_get_file_header()

_get_file_header(  $fh,   $start_offset = FALSE) 

Parameters

$fh
$start_offset