PHP Class Microweber\Utils\Unzip

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.
Author: Alexandre Tedeschi
Author: Phil Sturgeon
Show file Open project: microweber/microweber

Public Methods

Method Description
__construct ( ) : none Constructor.
__destroy ( ) : none Free the file resource Automatic destroy.
allow ( $ext = null ) : none What extensions do we want out of this ZIP.
close ( ) : none Free the file resource.
debug_string ( $open = '<p>', $close = '</p>' ) : string Show debug messages.
error_string ( $open = '<p>', $close = '</p>' ) : string Show error messages.
extract ( $zip_file, $target_dir = null, $preserve_filepath = true ) : none Unzip all files in archive.
native_unzip ( $zip_file, $target_dir = null, $preserve_filepath = true ) --------------------------------------------------------------------
old_____extract ( $zip_file, $target_dir = null, $preserve_filepath = true )
set_debug ( $string ) : none Save debug data.
set_error ( $string ) : none Save errors.

Private Methods

Method Description
_extract_file ( $compressed_file_name, $target_file_name = false, $underscore_case = false ) : Unziped Unzip file in archive.
_get_file_header ( &$fh, $start_offset = false ) --------------------------------------------------------------------
_list_files ( $stop_on_file = false ) : mixed List all files in archive.
_load_file_list_by_eof ( &$fh, $stop_on_file = false ) --------------------------------------------------------------------
_load_files_by_signatures ( &$fh, $stop_on_file = false ) --------------------------------------------------------------------
_uncompress ( $content, $mode, $uncompressed_size, $target_file_name = false ) : none Uncompress file. And save it to the targetFile.

Method Details

__construct() public method

Constructor.
public __construct ( ) : none
return none

__destroy() public method

Free the file resource Automatic destroy.
public __destroy ( ) : none
return none

allow() public method

What extensions do we want out of this ZIP.
public allow ( $ext = null ) : none
return none

close() public method

Free the file resource.
public close ( ) : none
return none

debug_string() public method

Show debug messages.
public debug_string ( $open = '<p>', $close = '</p>' ) : string
return string

error_string() public method

Show error messages.
public error_string ( $open = '<p>', $close = '</p>' ) : string
return string

extract() public method

Unzip all files in archive.
public extract ( $zip_file, $target_dir = null, $preserve_filepath = true ) : none
return none

native_unzip() public method

--------------------------------------------------------------------
public native_unzip ( $zip_file, $target_dir = null, $preserve_filepath = true )

old_____extract() public method

public old_____extract ( $zip_file, $target_dir = null, $preserve_filepath = true )

set_debug() public method

Save debug data.
public set_debug ( $string ) : none
return none

set_error() public method

Save errors.
public set_error ( $string ) : none
return none