sTEFANs Subversion Web Contol (SWC)
Inc
[ class tree: Swc ] [ index: Swc ] [ all elements ]

Class: zipfile

Source Location: /swc/inc/zip.inc.php

Class zipfile

Class Overview

Zip file creation class.

Zip file creation class. Makes zip files. Based on :
http://www.zend.com/codex.php?id=535&single=1 By Eric Mueller <eric@themepark.com>
http://www.zend.com/codex.php?id=470&single=1 by Denis125 <webmaster@atlant.ru>
http://www.traum-projekt.com/forum/sitemap/t-62354.html by Peter Listiak <mlady@users.sourceforge.net>, pathch for last modified date and time of the compressed file
Interface and public methods by Stefan Schraml
Official ZIP file format: http://www.pkware.com/appnote.txt

Located in /swc/inc/zip.inc.php [line 61]



		
				Author(s):
		
API Tags:
Access:  public

Information Tags:
Since:  v1.1.0
Version:  v1.1.0

Properties

Methods

[ Top ]
Property Summary
array   $ctrl_dir   Central directory
array   $datasec   Array to store compressed data
string   $eof_ctrl_dir   End of central directory record
integer   $old_offset   Last offset position

[ Top ]
Method Summary
void   addDir()   Don't really know what it does. to the archive, LINUX zip (Zip 2. is not able to extract the archive. of completness but it's not invoked anymore (and this works great!).
void   addFile()   Adds "file" to archive
string   encodeUnixTimestamp()   Returns timestamp in format needed by zip archive.
Binary   getFileContent()   Returns the archive file content.
void   store()   Writes the archive to the given path.
integer   unix2DosTime()   Converts an Unix timestamp to a four byte DOS date and time format (date in high two bytes, time in low two bytes allowing magnitude comparison).
boolean   zip()   Adds the given file or directory tree to the archive.
boolean   zipReplacePath()   Adds the given file or directory tree to the archive.

[ Top ]
Properties
array   $ctrl_dir = array() [line 75]

Central directory

Central directory

API Tags:
Access:  private

Information Tags:
Since:  v1.1.0

[ Top ]
array   $datasec = array() [line 68]

Array to store compressed data

Array to store compressed data

API Tags:
Access:  private

Information Tags:
Since:  v1.1.0

[ Top ]
string   $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00" [line 82]

End of central directory record

End of central directory record

API Tags:
Access:  private

Information Tags:
Since:  v1.1.0

[ Top ]
integer   $old_offset = 0 [line 89]

Last offset position

Last offset position

API Tags:
Access:  private

Information Tags:
Since:  v1.1.0

[ Top ]
Methods
addDir  [line 183]

  void addDir( mixed $name, [mixed $timestamp = 0]  )

Don't really know what it does. to the archive, LINUX zip (Zip 2. is not able to extract the archive. of completness but it's not invoked anymore (and this works great!).

Don't really know what it does. If method is invoked to add a directory to the archive, LINUX zip (Zip 2.3 (November 29th 1999), by Info-ZIP) is not able to extract the archive. I leave it for the reason of completness but it's not invoked anymore (and this works great!). Note: The following description is wrong!
Adds the given directory path into archive. Do this before putting any files in directory! E.g. add "path/" before adding file "path/file.txt".


API Tags:
Access:  private

Information Tags:
Since:  v1.1.0

[ Top ]
addFile  [line 259]

  void addFile( mixed $data, mixed $name, [mixed $timestamp = 0]  )

Adds "file" to archive

Adds "file" to archive


API Tags:
Access:  private

Information Tags:
Since:  v1.1.0

[ Top ]
encodeUnixTimestamp  [line 350]

  string encodeUnixTimestamp( int $timestamp  )

Returns timestamp in format needed by zip archive.

Returns timestamp in format needed by zip archive.

Parameters:
int   $timestamp:  UNIX timestamp.

API Tags:
Return:  Timestamp encoded to ZIP format.

Information Tags:
Since:  v1.1.0

[ Top ]
getFileContent  [line 329]

  Binary getFileContent( )

Returns the archive file content.

Returns the archive file content.


API Tags:
Return:  content of ZIP file.
Access:  private

Information Tags:
Since:  v1.1.0

[ Top ]
store  [line 160]

  void store( string $path  )

Writes the archive to the given path.

Writes the archive to the given path.

Parameters:
string   $path:  Path for the ZIP-File (e.g. /mydir/myfile.zip).

API Tags:
Access:  public

Information Tags:
Since:  v1.1.0

[ Top ]
unix2DosTime  [line 372]

  integer unix2DosTime( [mixed $unixtime = 0]  )

Converts an Unix timestamp to a four byte DOS date and time format (date in high two bytes, time in low two bytes allowing magnitude comparison).

Converts an Unix timestamp to a four byte DOS date and time format (date in high two bytes, time in low two bytes allowing magnitude comparison).


API Tags:
Return:  the current date in a four byte DOS format
Access:  private

Information Tags:
Since:  v1.1.0

[ Top ]
zip  [line 102]

  boolean zip( string $path, [boolean $recursive = true]  )

Adds the given file or directory tree to the archive.

Adds the given file or directory tree to the archive.

Parameters:
string   $path:  File or directory to zip. If a directory is given, the content (all the files and subdirectories) will be added to the archive.
boolean   $recursive:  If set to TRUE, content of the given directory and all its sub directories will be added to the archive. Otherwise only the content of directory is added. Has no effect $path is a file.

API Tags:
Return:  TRUE if zipping was successful.
Access:  public

Information Tags:
Since:  v1.1.0

[ Top ]
zipReplacePath  [line 121]

  boolean zipReplacePath( string $path, string $search_pattern, string $replace_pattern, [boolean $recursive = true]  )

Adds the given file or directory tree to the archive.

Adds the given file or directory tree to the archive.

Parameters:
string   $path:  File or directory to zip. If a directory is given, the content (all the files and subdirectories) will be added to the archive.
string   $search_pattern:  If it is not NULL, it defines the part of $path which will be replaced by $replace_pattern.
string   $replace_pattern:  Text which is substituted for $search_pattern. If it is set NULL, $search_pattern will be replaced by empty ("").
boolean   $recursive:  If set to TRUE, content of the given directory and all its sub directories will be added to the archive. Otherwise only the content of directory is added. Has no effect $path is a file.

API Tags:
Return:  TRUE if zipping was successful.
Access:  public

Information Tags:
Since:  v1.1.0

[ Top ]

Documentation generated on Fri, 03 Nov 2006 18:45:08 +0100 by phpDocumentor 1.3.0RC6
for sTEFANs POWERED BY eBC.bz