OpenDocument
[ class tree: OpenDocument ] [ index: OpenDocument ] [ all elements ]

Class: OpenDocument_Storage_Zip

Source Location: /OpenDocument-0.2.1/OpenDocument/Storage/Zip.php

Class Overview


Zip storage - the default OpenDocument storage.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 29]
Zip storage - the default OpenDocument storage.

Creates one zip file containing several XML files.



[ Top ]


Class Variables

$contentDom =  null

[line 50]

DOM document containing the content
  • Access: protected

Type:   DOMDocument


[ Top ]

$file =  null

[line 36]

File name to store file as
  • Access: protected

Type:   string


[ Top ]

$metaDom =  null

[line 57]

DOM document containing the meta data
  • Access: protected

Type:   DOMDocument


[ Top ]

$settingsDom =  null

[line 64]

DOM document containing the settings
  • Access: protected

Type:   DOMDocument


[ Top ]

$stylesDom =  null

[line 71]

DOM document containing the styles
  • Access: protected

Type:   DOMDocument


[ Top ]

$zip =  null

[line 43]

Zip document
  • Access: protected

Type:   ZipArchive


[ Top ]



Method Detail

addFile   [line 444]

string addFile( string $path, [string $mimetype = null])

Adds a file to the document.

Returns the file name that has to be used to reference the file in the document content.


Parameters:

string   $path   —  File path
string   $mimetype   —  MIME type of the file. Leave it null for auto detection.

[ Top ]

checkReadability   [line 157]

void checkReadability( string $file)

Checks if the given file is readable
  • Throws: OpenDocument_Exception In case the file is not readable
  • Access: public

Parameters:

string   $file   —  Path of file

[ Top ]

checkWritability   [line 138]

void checkWritability( string $file)

Checks if the given file is writable
  • Throws: OpenDocument_Exception In case the file is not writable
  • Access: public

Parameters:

string   $file   —  Path of file

[ Top ]

create   [line 91]

void create( string $type, [string $file = null])

Creates a new file.

The file name may be passed, but can be omitted if the final storage location is not known yet.

Storage drivers may choose to create temporary files or directories in case no file name is given here.

  • Throws: OpenDocument_Exception In case creating the given file is not possible.
  • Access: public

Parameters:

string   $type   —  Document type ('text', 'spreadsheet')
string   $file   —  Name of the file to be created

[ Top ]

getContentDom   [line 250]

DOMDocument getContentDom( )

Returns the DOM object containing the content.
  • Access: public

[ Top ]

getMetaDom   [line 262]

DOMDocument getMetaDom( )

Returns the DOM object containing the meta data.
  • Access: public

[ Top ]

getMimeType   [line 227]

string getMimeType( )

Returns the MIME type of the opened file.
  • Return: MIME Type.
  • Access: public

[ Top ]

getMimeTypeFromContent   [line 362]

string getMimeTypeFromContent( DOMDocument $content)

Extracts the textual MIME type from the content DOM object
  • Return: MIME type
  • Access: protected

Parameters:

DOMDocument   $content   —  DOM object of content

[ Top ]

getSettingsDom   [line 274]

DOMDocument getSettingsDom( )

Returns the DOM object containing the settings.
  • Access: public

[ Top ]

getStylesDom   [line 286]

DOMDocument getStylesDom( )

Returns the DOM object containing the styles.
  • Access: public

[ Top ]

getTemplateFile   [line 475]

string getTemplateFile( string $type)

Returns the path of a template file for the given file type.
  • Return: Path of the file, null if there is no file for it
  • Access: public

Parameters:

string   $type   —  File type ('text', 'spreadsheet')

[ Top ]

import   [line 513]

void import( OpenDocument_Storage $storage)

Imports data from another storage object
  • Throws: OpenDocument_Exception In case something goes wrong
  • Access: public

Parameters:

OpenDocument_Storage   $storage   —  Storage object

[ Top ]

loadDomFromZip   [line 207]

DOMDocument loadDomFromZip( ZipArchive $zip, string $file)

Loads the DOM document of the given file name from the zip archive
  • Return: Document of XML file
  • Throws: OpenDocument_Exception In case the file does not exist in the zip.
  • Access: protected

Parameters:

ZipArchive   $zip   —  Opened ZIP file object
string   $file   —  Relative path of file to load from zip

[ Top ]

loadFile   [line 181]

void loadFile( string $file)

Loads content of the given file.

Sets $this->file to $file. One needs to make sure the file is readable before calling this method.

  • Throws: OpenDocument_Exception When the file is corrupt or does not exist.
  • Access: protected

Parameters:

string   $file   —  Filename

[ Top ]

open   [line 119]

void open( string $file)

Opens the given file, loading the XML into memory

Parameters:

string   $file   —  Path of the file to open.

[ Top ]

removeFile   [line 461]

void removeFile( string $relpath)

Removes an already added file from the document.

Parameters:

string   $relpath   —  Relative path that was returned by addFile()

[ Top ]

save   [line 306]

void save( [string $file = null])

Saves the file as the given file name.

Parameters:

string   $file   —  Path of the file to save.

[ Top ]

setContentDom   [line 378]

void setContentDom( DOMDocument $content)

Sets the DOM object containing the content.

<office:document-content>

  • Access: public

Parameters:

DOMDocument   $content   —  Content object

[ Top ]

setMetaDom   [line 393]

void setMetaDom( DOMDocument $meta)

Sets the DOM object containing the meta data.

<office:document-meta>

  • Access: public

Parameters:

DOMDocument   $meta   —  Meta object

[ Top ]

setSettingsDom   [line 408]

void setSettingsDom( DOMDocument $settings)

Sets the DOM object containing the settings.

<office:document-settings>

  • Access: public

Parameters:

DOMDocument   $settings   —  Settings object

[ Top ]

setStylesDom   [line 423]

void setStylesDom( DOMDocument $styles)

Sets the DOM object containing the styles.

<office:document-styles>

  • Access: public

Parameters:

DOMDocument   $styles   —  Styles object

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:51:02 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.