phpDocumentor OpenDocumentPHP
[ class tree: OpenDocumentPHP ] [ index: OpenDocumentPHP ] [ all elements ]

Class: OpenDocumentArchive

Source Location: /OpenDocumentArchive.php

Class OpenDocumentArchive

Class Overview

OpenDocumentArchive class.

This is a extension of the class ZipArchive to handle OpenDocumentArchives. That is a file that, like jar archives in java, have meta informations. Unlike in jar files, this meta informations are stored in a XML file named 'manifest.xml' in the 'META-INF' directory of the ZIP archive.

This class will handle everything needed.

But be aware, that you have at least PHP 5.2.0 and enabled zip support.

Linux systems (general)

In order to use these functions you must compile PHP with zip support by using the --with-zip[=DIR] configure option, where [DIR] is the prefix of the ZZIPlib library install.

Linux systems (debian)

The easiest way is to use apt-get install php5-zip on command line. This will do it in most cases. Please ensure that you run PHP 5.2.1 (or better) on your linux box.

Windows systems Windows users need to enable php_zip.dll inside of php.ini in order to use the ZipArchive class.

YOU NEED AT LEAST PHP 5.2.0 !!!

Located in /OpenDocumentArchive.php [line 110]

ZipArchive
   |
   --OpenDocumentArchive
Author(s):
  • Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
Information Tags:
Version:  Release: @package_version@
Copyright:  Copyright in 2006, 2007 by The OpenDocumentPHP Team
Link:  http://php.net/zip
Link:  http://opendocumentphp.org
Since:  0.5.0 - 08. Feb. 2007
License:  GNU General Public License 2.0.

Methods

[ Top ]
Direct descendents
Child Class Description
OpenDocumentAbstract OpenDocumentAbstract class.

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From ZipArchive (Internal Class)

addEmptyDir ( )
addFile ( )
addFromString ( )
close ( )
deleteIndex ( )
deleteName ( )
extractTo ( )
getArchiveComment ( )
getCommentIndex ( )
getCommentName ( )
getFromIndex ( )
getFromName ( )
getNameIndex ( )
getStream ( )
locateName ( )
open ( )
renameIndex ( )
renameName ( )
setArchiveComment ( )
setCommentIndex ( )
setCommentName ( )
statIndex ( )
statName ( )
unchangeAll ( )
unchangeArchive ( )
unchangeIndex ( )
unchangeName ( )

Inherited From ZipArchive (Internal Class)

CHECKCONS = 4
CM_DEFAULT = -1
CM_DEFLATE = 8
CM_DEFLATE64 = 9
CM_IMPLODE = 6
CM_PKWARE_IMPLODE = 10
CM_REDUCE_1 = 2
CM_REDUCE_2 = 3
CM_REDUCE_3 = 4
CM_REDUCE_4 = 5
CM_SHRINK = 1
CM_STORE = 0
CREATE = 1
ER_CHANGED = 15
ER_CLOSE = 3
ER_COMPNOTSUPP = 16
ER_CRC = 7
ER_DELETED = 23
ER_EOF = 17
ER_EXISTS = 10
ER_INCONS = 21
ER_INTERNAL = 20
ER_INVAL = 18
ER_MEMORY = 14
ER_MULTIDISK = 1
ER_NOENT = 9
ER_NOZIP = 19
ER_OK = 0
ER_OPEN = 11
ER_READ = 5
ER_REMOVE = 22
ER_RENAME = 2
ER_SEEK = 4
ER_TMPOPEN = 12
ER_WRITE = 6
ER_ZIPCLOSED = 8
ER_ZLIB = 13
EXCL = 2
FL_COMPRESSED = 4
FL_NOCASE = 1
FL_NODIR = 2
FL_UNCHANGED = 8
OVERWRITE = 8

[ Top ]
Constant Summary
NOMANIFEST   No Manifest was found in Archive that where opened.
PathToManifestXml   Full path to manifest xml in the OpenDocument archive.

[ Top ]
Method Summary
void   addFile()   Adds a file to a ZIP archive from the given path.
void   addFromString()   Add a file to a ZIP archive using its contents.
void   close()   Close opened or created archive and save changes. This method is automatically called at the end of the script.
void   deleteIndex()   Delete an entry in the archive using its index.
void   deleteName()   Delete an entry in the archive using its name.
DOMDocument   getDOMFromName()   Retrieve file from archive as a DOM document.
void   getFilelist()   Retrieve file list.
ManifestDocument   getManifest()   Retreive the manifest document as a ManifestDocument object.
string   getMimeType()   Retrieve mime type of the OpenDocument archive.
OpenDocumentArchive   __construct()   Constructor method.
mixed   open()   Opens a new zip archive for reading, writing or modifying.
void   renameIndex()   Renames an entry defined by its index.
void   renameName()   Renames an entry defined by its name.
void   setMimeType()   Set mime type of the OpenDocument archive.
array|bool   statName()   Get the details of an entry defined by its name.
boolean   unchangeAll()   Undo all changes done in the archive. Always returns false!
boolean   unchangeIndex()   Revert all changes done to an entry at the given index.
boolean   unchangeName()   Revert all changes done to an entry with the given name.

[ Top ]
Methods
addFile  [line 144]

  void addFile( string $filename, [string $localname = ''], [string $mimetype = 'text/text']  )

Adds a file to a ZIP archive from the given path.

Parameters:
string   $localname:  The name of the entry to create.
string   $filename:  The path to the file to add.
string   $mimetype:  Mime type of the file.

API Tags:
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

Redefinition of:
ZipArchive::addFile ( )

[ Top ]
addFromString  [line 175]

  void addFromString( string $localname, string $contents, [string $mimetype = 'text/text']  )

Add a file to a ZIP archive using its contents.

Parameters:
string   $localname:  The name of the entry to create.
string   $contents:  The contents to use to create the entry. It is used in a binary safe mode.
string   $mimetype:  Mime type of the file.

API Tags:
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

Redefinition of:
ZipArchive::addFromString ( )

[ Top ]
close  [line 418]

  void close( [boolean $write = true]  )

Close opened or created archive and save changes. This method is automatically called at the end of the script.

Parameters:
boolean   $write:  Should we write to archive? - Default is true.

API Tags:
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

Redefinition of:
ZipArchive::close ( )

Redefined in descendants as:

[ Top ]
deleteIndex  [line 277]

  void deleteIndex( int $index  )

Delete an entry in the archive using its index.

Parameters:
int   $index:  Index of the entry to delete.

API Tags:
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

Redefinition of:
ZipArchive::deleteIndex ( )

[ Top ]
deleteName  [line 261]

  void deleteName( string $name  )

Delete an entry in the archive using its name.

Parameters:
string   $name:  Name of the entry to delete.

API Tags:
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

Redefinition of:
ZipArchive::deleteName ( )

[ Top ]
getDOMFromName  [line 361]

  DOMDocument getDOMFromName( string $filename  )

Retrieve file from archive as a DOM document.

Parameters:
string   $filename: 

API Tags:
Return:  The file as a DOM document.
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

[ Top ]
getFilelist  [line 350]

  void getFilelist( )

Retrieve file list.


API Tags:
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

[ Top ]
getManifest  [line 373]

  ManifestDocument getManifest( )

Retreive the manifest document as a ManifestDocument object.


API Tags:
Return:  The manifest document.
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

[ Top ]
getMimeType  [line 195]

  string getMimeType( )

Retrieve mime type of the OpenDocument archive.


API Tags:
Return:  Current mime type of the OpenDocument archive.
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

[ Top ]
Constructor __construct  [line 132]

  OpenDocumentArchive __construct( [string $mimetype = '']  )

Constructor method.

Parameters:
string   $mimetype:  Mime type of the achrive

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

Redefined in descendants as:

[ Top ]
open  [line 232]

  mixed open( string $filename, [int $flags = 0], [ $mimetype = '']  )

Opens a new zip archive for reading, writing or modifying.

If we create a new archive, we add to files. First the manifest document stored in the ManifestDocument and second the file 'mimetype' which only include the

Parameters:
string   $filename:  The file name of the ZIP archive to open.
int   $flags:  The mode to use to open the archive.
   $mimetype: 

API Tags:
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

Redefinition of:
ZipArchive::open ( )

Redefined in descendants as:
  • OpenDocumentAbstract::open() : Open an OpenDocument and read the meta, settings, content and styles data out of the ususal xml files and stores them into their attributes.

[ Top ]
renameIndex  [line 294]

  void renameIndex( int $index, string $newname  )

Renames an entry defined by its index.

Parameters:
int   $index:  Index of the entry to rename.
string   $newname:  New name.

API Tags:
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

Redefinition of:
ZipArchive::renameIndex ( )

[ Top ]
renameName  [line 311]

  void renameName( string $name, string $newname  )

Renames an entry defined by its name.

Parameters:
string   $name:  Name of the entry to rename.
string   $newname:  New name.

API Tags:
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

Redefinition of:
ZipArchive::renameName ( )

[ Top ]
setMimeType  [line 208]

  void setMimeType( string $mimetype  )

Set mime type of the OpenDocument archive.

Therefor we delete the file 'mimetype' in the current OpenDocument archive and add a new file 'mimetype' with the new mime type given as parameter $mimetype.

Parameters:
string   $mimetype:  New mime type of the OpenDocument archive.

API Tags:
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

[ Top ]
statName  [line 329]

  array|bool statName( string $name, [int $flags = 0]  )

Get the details of an entry defined by its name.

The function obtains information about the entry defined by its name.

Parameters:
string   $name:  Name of the entry.
int   $flags:  The flags argument specifies how the name lookup should be done. Also, ZIPARCHIVE::FL_UNCHANGED may be ORed to it to request information about the original file in the archive, ignoring any changes made.

API Tags:
Return:  Returns an array containing the entry details or FALSE on failure.
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

Redefinition of:
ZipArchive::statName ( )

[ Top ]
unchangeAll  [line 407]

  boolean unchangeAll( )

Undo all changes done in the archive. Always returns false!


API Tags:
Return:  Returns true if success, false if not.
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

Redefinition of:
ZipArchive::unchangeAll ( )

[ Top ]
unchangeIndex  [line 397]

  boolean unchangeIndex( int $index  )

Revert all changes done to an entry at the given index.

Always returns false!

Parameters:
int   $index:  Index of the entry.

API Tags:
Return:  Returns true if success, false if not.
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

Redefinition of:
ZipArchive::unchangeIndex ( )

[ Top ]
unchangeName  [line 385]

  boolean unchangeName( string $index  )

Revert all changes done to an entry with the given name.

Always returns false!

Parameters:
string   $index:  Name of the entry.

API Tags:
Return:  Returns true if success, false if not.
Access:  public

Information Tags:
Since:  0.5.0 - 08. Feb. 2007

Redefinition of:
ZipArchive::unchangeName ( )

[ Top ]
Constants
NOMANIFEST = 1024 [line 118]

No Manifest was found in Archive that where opened.


[ Top ]
PathToManifestXml = 'META-INF/manifest.xml' [line 114]

Full path to manifest xml in the OpenDocument archive.


[ Top ]

Documentation generated on Wed, 18 Jun 2008 06:30:55 +0200 by phpDocumentor 1.3.2