Public Member Functions | |
| CI_Zip () | |
| add_dir ($directory) | |
| _add_dir ($dir) | |
| add_data ($filepath, $data=NULL) | |
| _add_data ($filepath, $data) | |
| read_file ($path, $preserve_filepath=FALSE) | |
| read_dir ($path) | |
| get_zip () | |
| archive ($filepath) | |
| download ($filename= 'backup.zip') | |
| clear_data () | |
Public Attributes | |
| $zipdata = '' | |
| $directory = '' | |
| $entries = 0 | |
| $file_num = 0 | |
| $offset = 0 | |
| CI_Zip::_add_data | ( | $ | filepath, | |
| $ | data | |||
| ) |
Add Data to Zip
private
| string | the file name/path | |
| string | the data to be encoded |
| CI_Zip::_add_dir | ( | $ | dir | ) |
Add Directory
private
| string | the directory name |
| CI_Zip::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 |
| CI_Zip::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 |
| CI_Zip::archive | ( | $ | filepath | ) |
Write File to the specified directory
Lets you write a file
public
| string | the file name |
| CI_Zip::CI_Zip | ( | ) |
| CI_Zip::clear_data | ( | ) |
Initialize Data
Lets you clear current zip data. Useful if you need to create multiple zips with different data.
public
| CI_Zip::download | ( | $ | filename = 'backup.zip' |
) |
Download
public
| string | the file name | |
| string | the data to be encoded |
| CI_Zip::get_zip | ( | ) |
Get the Zip file
public
| CI_Zip::read_dir | ( | $ | path | ) |
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 |
| CI_Zip::read_file | ( | $ | path, | |
| $ | preserve_filepath = FALSE | |||
| ) |
Read the contents of a file and add it to the zip
public
| CI_Zip::$directory = '' |
| CI_Zip::$entries = 0 |
| CI_Zip::$file_num = 0 |
| CI_Zip::$offset = 0 |
| CI_Zip::$zipdata = '' |
1.5.7.1