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

Class: OpenDocument_Storage_Single

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

Class Overview


Single XML file storage driver.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 30]
Single XML file storage driver.

Saves all information in one big XML file. May not contain any images or other files.



[ Top ]


Class Variables

$contentDom =  null

[line 44]

DOM document containing the content
  • Access: protected

Type:   DOMDocument


[ Top ]

$file =  null

[line 37]

File name to store file as
  • Access: protected

Type:   string


[ Top ]

$metaDom =  null

[line 51]

DOM document containing the meta data
  • Access: protected

Type:   DOMDocument


[ Top ]

$settingsDom =  null

[line 58]

DOM document containing the settings
  • Access: protected

Type:   DOMDocument


[ Top ]

$stylesDom =  null

[line 65]

DOM document containing the styles
  • Access: protected

Type:   DOMDocument


[ Top ]



Method Detail

addFile   [line 454]

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 153]

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 134]

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 85]

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 266]

DOMDocument getContentDom( )

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

[ Top ]

getMetaDom   [line 278]

DOMDocument getMetaDom( )

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

[ Top ]

getMimeType   [line 251]

string getMimeType( )

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

[ Top ]

getMimeTypeFromContent   [line 372]

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 290]

DOMDocument getSettingsDom( )

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

[ Top ]

getStylesDom   [line 302]

DOMDocument getStylesDom( )

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

[ Top ]

import   [line 487]

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 ]

loadFile   [line 177]

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 115]

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 471]

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 322]

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 388]

void setContentDom( DOMDocument $content)

Sets the DOM object containing the content.

<office:document-content>

  • Access: public

Parameters:

DOMDocument   $content   —  Content object

[ Top ]

setMetaDom   [line 403]

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 418]

void setSettingsDom( DOMDocument $settings)

Sets the DOM object containing the settings.

<office:document-settings>

  • Access: public

Parameters:

DOMDocument   $settings   —  Settings object

[ Top ]

setStylesDom   [line 433]

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 Wed, 09 Dec 2015 23:02:08 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.