Horde_SyncMl_Device_sync4j
extends Horde_SyncMl_Device
in package
Sync4j (www.sync4j.org)
The Sync4J outlook converter uses its native SIF format for data
exchange. Conversion to text/vcalendar etc. is done by SifConverter.php The
connector seems not support DevInf information, so Horde_SyncMl_Device can
only detect it by the decice ID: so in the connector configuration the
device ID must be set to 'sc-pim-
Copyright 2005-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Tags
Table of Contents
- $requestedContentType : string
- The original preferred content type of the client, if provided through DevInf.
- array2sif() : string
- Converts a hash to a SIF XML structure.
- convertClient2Server() : array<string|int, mixed>
- Convert the content.
- convertServer2Client() : array<string|int, mixed>
- Converts the content from the backend to a format suitable for the client device.
- factory() : Horde_SyncMl_Device
- Attempts to return a concrete Horde_SyncMl_Device instance based on $driver.
- getPreferredContentType() : string
- Returns the guessed content type for a database URI.
- getPreferredContentTypeClient() : mixed
- Returns the preferrred MIME content type of the client for the given sync data type (contacts/tasks/notes/calendar).
- handleTasksInCalendar() : bool
- Returns whether the device handles tasks and events in a single "calendar" sync.
- omitIndividualSyncStatus() : bool
- Returns whether to send individual status response for each Add, Delete and Replace.
- sif2array() : array<string|int, mixed>
- Decodes a sif xml string to an associative array.
- sif2vcard() : mixed
- sif2vevent() : mixed
- sif2vnote() : mixed
- sif2vtodo() : mixed
- useCdataTag() : bool
- Sync4j as of Funambol Outlook connector 3.0.15 can't deal with <![CDATA[ so omit it.
- useLocalTime() : bool
- Returns whether the device accepts datetimes only in local time format (DTSTART:20061222T130000) instead of the more robust UTC time (DTSTART:20061222T110000Z).
- vcard2sif() : mixed
- vevent2sif() : mixed
- vnote2sif() : mixed
- vtodo2sif() : mixed
- _convertUTC2LocalTime() : string
- Converts an UTC timestamp like "20061222T110000Z" into a local timestamp like "20061222T130000" using the server timezone.
Properties
$requestedContentType
The original preferred content type of the client, if provided through DevInf.
public
string
$requestedContentType
Methods
array2sif()
Converts a hash to a SIF XML structure.
public
array2sif(array<string|int, mixed> $array[, string $pre = '' ][, string $post = '' ]) : string
Parameters
- $array : array<string|int, mixed>
-
A hash.
- $pre : string = ''
-
A prefix string for the XML result.
- $post : string = ''
-
A suffix string for the XML result.
Return values
string —The resulting XML string.
convertClient2Server()
Convert the content.
public
convertClient2Server(mixed $content, mixed $contentType) : array<string|int, mixed>
Parameters
- $content : mixed
-
The content to convert.
- $contentType : mixed
-
The content type of the content.
Return values
array<string|int, mixed> —Two-element array with the converted content and the (possibly changed) new content type.
convertServer2Client()
Converts the content from the backend to a format suitable for the client device.
public
convertServer2Client(string $content, string $contentType, string $database) : array<string|int, mixed>
Strips the uid (primary key) information as client and server might use different ones.
Parameters
- $content : string
-
The content to convert
- $contentType : string
-
The content type of content as returned from the backend
- $database : string
-
The server database URI.
Return values
array<string|int, mixed> —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
Parameters
- $driver : string
-
The type of concrete Horde_SyncMl_Device subclass to return.
Return values
Horde_SyncMl_Device —The newly created concrete Horde_SyncMl_Device instance, or false on error.
getPreferredContentType()
Returns the guessed content type for a database URI.
public
getPreferredContentType(string $database) : string
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.
Parameters
- $database : string
-
A database URI.
Return values
string —A MIME type that might match the database URI.
getPreferredContentTypeClient()
Returns the preferrred MIME content type of the client for the given sync data type (contacts/tasks/notes/calendar).
public
getPreferredContentTypeClient(mixed $serverSyncURI, mixed $sourceSyncURI) : mixed
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.
Parameters
- $serverSyncURI : mixed
-
The URI for the server database: contacts, notes, calendar or tasks.
- $sourceSyncURI : mixed
-
The URI for the client database. This is needed as the DevInf is grouped by sourceSyncURIs.
Return values
mixed —handleTasksInCalendar()
Returns whether the device handles tasks and events in a single "calendar" sync.
public
handleTasksInCalendar() : bool
This requires special actions on our side as we store this in different backend databases.
Return values
bool —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() : bool
Return values
bool —False if individual status responses should be send.
sif2array()
Decodes a sif xml string to an associative array.
public
sif2array(string $sif) : array<string|int, mixed>
Quick hack to convert from text/vcard and text/vcalendar to Sync4J's proprietery sif datatypes and vice versa. For details about the sif format see the appendix of the developer guide on www.sync4j.org.
Parameters
- $sif : string
-
A sif string like
v1> v2
Tags
Return values
array<string|int, mixed> —Assoc array in utf8 like array ('k1' => 'v1>', 'k2' => 'v2');
sif2vcard()
public
sif2vcard(mixed $sif) : mixed
Parameters
- $sif : mixed
Return values
mixed —sif2vevent()
public
sif2vevent(mixed $sif) : mixed
Parameters
- $sif : mixed
Return values
mixed —sif2vnote()
public
sif2vnote(mixed $sif) : mixed
Parameters
- $sif : mixed
Return values
mixed —sif2vtodo()
public
sif2vtodo(mixed $sif) : mixed
Parameters
- $sif : mixed
Return values
mixed —useCdataTag()
Sync4j as of Funambol Outlook connector 3.0.15 can't deal with <![CDATA[ so omit it.
public
useCdataTag() : bool
The Funambol Sync4j client chokes on the cdata so for this device it has to be set to false. Syn4j uses base64 encoding and so the problems with escaping does not occur.
Return values
bool —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() : bool
Return values
bool —True if the client doesn't accept UTC datetimes.
vcard2sif()
public
vcard2sif(mixed $vcard) : mixed
Parameters
- $vcard : mixed
Return values
mixed —vevent2sif()
public
vevent2sif(mixed $vcard) : mixed
Parameters
- $vcard : mixed
Return values
mixed —vnote2sif()
public
vnote2sif(mixed $vnote) : mixed
Parameters
- $vnote : mixed
Return values
mixed —vtodo2sif()
public
vtodo2sif(mixed $vcard) : mixed
Parameters
- $vcard : mixed
Return values
mixed —_convertUTC2LocalTime()
Converts an UTC timestamp like "20061222T110000Z" into a local timestamp like "20061222T130000" using the server timezone.
protected
_convertUTC2LocalTime(array<string|int, mixed> $utc) : string
Parameters
- $utc : array<string|int, mixed>
-
Array with a datetime string in UTC.
Return values
string —The datetime string converted to the local timezone.