PHP 클래스 Horde_SyncMl_Device, horde

If a sync client needs any kind of special conversion of the data sent to it or received from it, this is done here. There are two sources of information to identify an device: The first (and better) one is the DevInf device info sent by the device during a request. If DevInf is not supported or sent by the client, the Source/LocURI of the device request might be sufficent to identify it. Copyright 2005-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
저자: Karsten Fourmont ([email protected])
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$requestedContentType string The original preferred content type of the client, if provided through DevInf.

공개 메소드들

메소드 설명
convertClient2Server ( string $content, string $contentType ) : array Converts the content received from the client for the backend.
convertServer2Client ( string $content, string $contentType, string $database ) : array Converts the content from the backend to a format suitable for the client device.
factory ( string $driver ) : Horde_SyncMl_Device Attempts to return a concrete Horde_SyncMl_Device instance based on $driver.
getPreferredContentType ( string $database ) : string Returns the guessed content type for a database URI.
getPreferredContentTypeClient ( string $serverSyncURI, string $sourceSyncURI ) Returns the preferrred MIME content type of the client for the given sync data type (contacts/tasks/notes/calendar).
handleTasksInCalendar ( ) : boolean Returns whether the device handles tasks and events in a single "calendar" sync.
omitIndividualSyncStatus ( ) : boolean Returns whether to send individual status response for each Add, Delete and Replace.
useCdataTag ( ) : boolean Returns whether the payload data should be enclosed in a [CDATA[ section when sending via XML.
useLocalTime ( ) : boolean Returns whether the device accepts datetimes only in local time format (DTSTART:20061222T130000) instead of the more robust UTC time (DTSTART:20061222T110000Z).

보호된 메소드들

메소드 설명
_convertUTC2LocalTime ( array $utc ) : string Converts an UTC timestamp like "20061222T110000Z" into a local timestamp like "20061222T130000" using the server timezone.

메소드 상세

_convertUTC2LocalTime() 보호된 메소드

Converts an UTC timestamp like "20061222T110000Z" into a local timestamp like "20061222T130000" using the server timezone.
protected _convertUTC2LocalTime ( array $utc ) : string
$utc array Array with a datetime string in UTC.
리턴 string The datetime string converted to the local timezone.

convertClient2Server() 공개 메소드

Currently strips UID (primary key) information as client and server might use different ones. Charset conversions might be added here too.
public convertClient2Server ( string $content, string $contentType ) : array
$content string The content to convert.
$contentType string The content type of the content.
리턴 array Two-element array with the converted content and the (possibly changed) new content type.

convertServer2Client() 공개 메소드

Strips the UID (primary key) information as client and server might use different ones. Charset conversions might be added here too.
public convertServer2Client ( string $content, string $contentType, string $database ) : array
$content string The content to convert
$contentType string The content type of content as returned from the backend
$database string The server database URI.
리턴 array Three-element array with the converted content, the (possibly changed) new content type, and encoding type (like b64 as used by Funambol).

factory() 공개 메소드

Attempts to return a concrete Horde_SyncMl_Device instance based on $driver.
public factory ( string $driver ) : Horde_SyncMl_Device
$driver string The type of concrete Horde_SyncMl_Device subclass to return.
리턴 Horde_SyncMl_Device The newly created concrete Horde_SyncMl_Device instance, or false on error.

getPreferredContentType() 공개 메소드

When a client sends data during a sync but does not provide information about the MIME content type with this individual item, this function returns the content type the item is supposed to be in.
public getPreferredContentType ( string $database ) : string
$database string A database URI.
리턴 string A MIME type that might match the database URI.

getPreferredContentTypeClient() 공개 메소드

The result is passed as an option to the backend export functions. This is not the content type ultimately passed to the client but rather the content type presented to the backend export functions. After the data is retrieved from the backend, convertServer2Client() can do some post-processing and set the correct content type acceptable for the client if necessary. The default implementation tries to extract the content type from the device info. If this does not work, some defaults are used. If the client does not provice proper DevInf data, this public function may have to be overwritten to return the correct values.
public getPreferredContentTypeClient ( string $serverSyncURI, string $sourceSyncURI )
$serverSyncURI string The URI for the server database: contacts, notes, calendar or tasks.
$sourceSyncURI string The URI for the client database. This is needed as the DevInf is grouped by sourceSyncURIs.

handleTasksInCalendar() 공개 메소드

This requires special actions on our side as we store this in different backend databases.
public handleTasksInCalendar ( ) : boolean
리턴 boolean True if tasks and events are processed in a single request.

omitIndividualSyncStatus() 공개 메소드

Returns whether to send individual status response for each Add, Delete and Replace.
public omitIndividualSyncStatus ( ) : boolean
리턴 boolean False if individual status responses should be send.

useCdataTag() 공개 메소드

The synchronized data may contain XML special characters like &, < or >. Clients might choke when sending these embedded in XML. The data should be enclosed in [CDATA[ in these cases. This applies only to XML, not to WBXML devices.
public useCdataTag ( ) : boolean
리턴 boolean True if the data should be enclosed in [CDATA[.

useLocalTime() 공개 메소드

Returns whether the device accepts datetimes only in local time format (DTSTART:20061222T130000) instead of the more robust UTC time (DTSTART:20061222T110000Z).
public useLocalTime ( ) : boolean
리턴 boolean True if the client doesn't accept UTC datetimes.

프로퍼티 상세

$requestedContentType 공개적으로 프로퍼티

The original preferred content type of the client, if provided through DevInf.
public string $requestedContentType
리턴 string