Public Member Functions | |
__construct () | |
add_dir ($directory) | |
_get_mod_time ($dir) | |
_add_dir ($dir, $file_mtime, $file_mdate) | |
add_data ($filepath, $data=NULL) | |
_add_data ($filepath, $data, $file_mtime, $file_mdate) | |
read_file ($path, $preserve_filepath=FALSE) | |
read_dir ($path, $preserve_filepath=TRUE, $root_path=NULL) | |
get_zip () | |
archive ($filepath) | |
download ($filename= 'backup.zip') | |
clear_data () | |
Data Fields | |
$zipdata = '' | |
$directory = '' | |
$entries = 0 | |
$file_num = 0 | |
$offset = 0 | |
$now | |
__construct | ( | ) |
Constructor
_add_data | ( | $filepath, | |
$data, | |||
$file_mtime, | |||
$file_mdate | |||
) |
Add Data to Zip
private
string | the file name/path |
string | the data to be encoded |
_add_dir | ( | $dir, | |
$file_mtime, | |||
$file_mdate | |||
) |
Add Directory
private
string | the directory name |
_get_mod_time | ( | $dir) |
Get file/directory modification time
If this is a newly created file/dir, we will set the time to 'now'
string | path to file |
add_data | ( | $filepath, | |
$data = NULL |
|||
) |
Add Data to Zip
Lets you add files to the archive. If the path is included in the filename it will be placed within a directory. Make sure you use add_dir() first to create the folder.
public
mixed | |
string |
add_dir | ( | $directory) |
Add Directory
Lets you add a virtual directory into which you can place files.
public
mixed | the directory name. Can be string or array |
archive | ( | $filepath) |
Write File to the specified directory
Lets you write a file
public
string | the file name |
clear_data | ( | ) |
Initialize Data
Lets you clear current zip data. Useful if you need to create multiple zips with different data.
public
download | ( | $filename = 'backup.zip' ) |
get_zip | ( | ) |
Get the Zip file
public
read_dir | ( | $path, | |
$preserve_filepath = TRUE , |
|||
$root_path = NULL |
|||
) |
Read a directory and add it to the zip.
This function recursively reads a folder and everything it contains (including sub-folders) and creates a zip based on it. Whatever directory structure is in the original file path will be recreated in the zip file.
public
string | path to source |
read_file | ( | $path, | |
$preserve_filepath = FALSE |
|||
) |
Read the contents of a file and add it to the zip
public