Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcWebdavPropertyHandler

Webdav::ezcWebdavPropertyHandler

Class ezcWebdavPropertyHandler

Handles the parsing and serailization of live and dead properties.

An instance of this class is used by ezcWebdavTransport and ezcWebdavFileBackend to parse ezcWebdavLiveProperty and ezcWebdavDeadProperty instances from XML content and to re-serialized instances of these classes back to XML.

ezcWebdavTransport might be configured to use a different property handler, to adjust the behavior of property handling to specific client needs. ezcWebdavFileBackend always uses this default implementation.

Source for this file: /Webdav/src/transports/property_handler.php

Version:   //autogen//

Descendants

Child Class Description
ezcWebdavNautilusPropertyHandler Property handler adjusted for the GNOME Nautilus client.

Constants

GETCONTENTTYPE_REGEX = '(^(?P<mime>\w+/\w+)\s*(?:;\s*charset\s*=\s*(?P<charset>.+)\s*)?$)i' Regedx to parse the <getcontenttype /> XML elemens content.

Example: 'text/html; charset=UTF-8'

Member Variables

protected ezcWebdavXmlTool $xmlTool
XML tool.

Method Summary

public void __construct( [ $xml = null] )
Creates a new property handler.
protected ezcWebdavDeadProperty extractDeadProperty( $domElement )
Extract a dead property from a DOMElement.
protected ezcWebdavSourcePropertyLink extractLinkContent( $domElement )
Extracts the <link /> XML elements.
protected ezcWebdavLiveProperty|null extractLiveProperty( $domElement )
Extracts a live property from a DOMElement.
public ezcWebdavBasicPropertyStorage extractProperties( $domNodes , $storage , [ $flag = null] )
Returns extracted properties in an ezcWebdavPropertyStorage.
protected ezcWebdavXmlTool getXmlTool( )
Returns the XML tool to work with.
protected DOMElement serializeDeadProperty( $property , $parentElement )
Returns the XML representation of a dead property.
protected array(DOMElement) serializeLinkContent( [ $links = null] , $dom )
Serializes an array of ezcWebdavSourcePropertyLink elements to XML.
protected DOMElement|null serializeLiveProperty( $property , $parentElement )
Returns the XML representation of a live property.
public void serializeProperties( $storage , $parentElement )
Serializes an object of new ezcWebdavPropertyStorage to XML.

Methods

__construct

void __construct( [ezcWebdavXmlTool $xml = null] )

Creates a new property handler.

An instance of this class is capable of handling live and dead WebDAV properties. It can extract properties from requests and generate response information for properties. If $xml is not specified, the instance in ezcWebdavServer will be used, which propably underlies client specific adjustments.

The ezcWebdavXmlTool instance of ezcWebdavServer can be configured using a ezcWebdavServerConfiguration in the ezcWebdavServerConfigurationManager of the ezcWebdavServer singleton instance. The XML instance is created as soon as the server is configured for a specific client.

Parameters:
Name Type Description
$xml ezcWebdavXmlTool

extractDeadProperty

ezcWebdavDeadProperty extractDeadProperty( $domElement )

Extract a dead property from a DOMElement.

This method is responsible for parsing a ezcWebdavDeadProperty (unknown) property from a $domElement.

Parameters:
Name Type Description
$domElement DOMElement

extractLinkContent

ezcWebdavSourcePropertyLink extractLinkContent( $domElement )

Extracts the <link /> XML elements.

This method extracts the <link /> XML elements from the <source /> element and returns the corresponding ezcWebdavSourcePropertyLink object to be used as the content of ezcWebdavSourceProperty.

Parameters:
Name Type Description
$domElement DOMElement

extractLiveProperty

ezcWebdavLiveProperty|null extractLiveProperty( $domElement )

Extracts a live property from a DOMElement.

This method is responsible for parsing WebDAV live properties. The DOMElement $domElement must be an XML element in the DAV: namepsace. If the received property is not defined in RFC 2518, null is returned.

Parameters:
Name Type Description
$domElement DOMElement

extractProperties

ezcWebdavBasicPropertyStorage extractProperties( $domNodes , ezcWebdavBasicPropertyStorage $storage , [int $flag = null] )

Returns extracted properties in an ezcWebdavPropertyStorage.

This method receives a DOMNodeList $domNodes which must contain a set of DOMElement objects, while each of those represents a WebDAV property.

The list may contain live properties as well as dead ones. Live properties (ezcWebdavLiveProperty) as defined in RFC 2518 are currently recognized, except for locking related properties. All other properties in the DAV: namespace are added as dead properties (ezcWebdavDeadProperty). Dead properties are parsed generally in any namespace.

The extracted properties are stored in the given ezcWebdavPropertyStorage $storage. If a $flag value is provided, this one is submitted as the second parameter to ezcWebdavFlaggedPropertyStorage->attach().

Parameters:
Name Type Description
$domNodes DOMNodeList
$storage ezcWebdavBasicPropertyStorage
$flag int

getXmlTool

ezcWebdavXmlTool getXmlTool( )

Returns the XML tool to work with.

This method either returns the internally ($xmlTool) instance of ezcWebdavXmlTool or, if this one is not available, the instance stored in the singleton of ezcWebdavServer. The latter instance might be an extended one, which is adjusted to the special needs of a certain client.

serializeDeadProperty

DOMElement serializeDeadProperty( ezcWebdavDeadProperty $property , $parentElement )

Returns the XML representation of a dead property.

Returns a DOMElement, representing the content of the given $property in XML. The newly created element is also appended as a child to the given $parentElement.

Parameters:
Name Type Description
$property ezcWebdavDeadProperty
$parentElement DOMElement

serializeLinkContent

array(DOMElement) serializeLinkContent( [ $links = null] , $dom )

Serializes an array of ezcWebdavSourcePropertyLink elements to XML.

This method takes an array of ezcWebdavSourcePropertyLink instances, which are serialized to DOMElement objects (using the given $dom) to be added to a ezcWebdavSourceProperty XML representation. The DOMElement instances are returned in an array.

Parameters:
Name Type Description
$links array(ezcWebdavSourcePropertyLink)
$dom DOMDocument To create the returned DOMElements.

serializeLiveProperty

DOMElement|null serializeLiveProperty( ezcWebdavLiveProperty $property , $parentElement )

Returns the XML representation of a live property.

Returns a DOMElement, representing the content of the given $property. The newly created element is also appended as a child to the given $parentElement.

In case the given property is not recodnized, null is returned to indicate that a plugin hook must be announced to see if a plugin can serialize the property.

Parameters:
Name Type Description
$property ezcWebdavLiveProperty
$parentElement DOMElement
Redefined in descendants as:
Method Description
ezcWebdavNautilusPropertyHandler::serializeLiveProperty() Returns the XML representation of a live property. 

serializeProperties

void serializeProperties( ezcWebdavPropertyStorage $storage , $parentElement )

Serializes an object of new ezcWebdavPropertyStorage to XML.

Attaches all properties of the $storage to the $parentElement XML element in their XML representation.

Parameters:
Name Type Description
$storage ezcWebdavPropertyStorage
$parentElement DOMElement
Documentation generated by phpDocumentor 1.4.3