Overview

Packages

  • None
  • SyncMl

Classes

  • Horde_SyncMl
  • Horde_SyncMl_Backend
  • Horde_SyncMl_Backend_Horde
  • Horde_SyncMl_Command
  • Horde_SyncMl_Command_Alert
  • Horde_SyncMl_Command_Final
  • Horde_SyncMl_Command_Get
  • Horde_SyncMl_Command_Map
  • Horde_SyncMl_Command_Put
  • Horde_SyncMl_Command_Replace
  • Horde_SyncMl_Command_Results
  • Horde_SyncMl_Command_Status
  • Horde_SyncMl_Command_Sync
  • Horde_SyncMl_Command_SyncHdr
  • Horde_SyncMl_ContentHandler
  • Horde_SyncMl_DataStore
  • Horde_SyncMl_Device
  • Horde_SyncMl_Device_Nokia
  • Horde_SyncMl_Device_P800
  • Horde_SyncMl_Device_sync4j
  • Horde_SyncMl_Device_Sync4JMozilla
  • Horde_SyncMl_Device_Synthesis
  • Horde_SyncMl_DeviceInfo
  • Horde_SyncMl_Property
  • Horde_SyncMl_PropertyParameter
  • Horde_SyncMl_State
  • Horde_SyncMl_Sync
  • Horde_SyncMl_SyncElement
  • Horde_SyncMl_Translation
  • Horde_SyncMl_XmlOutput
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * The Horde_SyncMl_Device_Sync4JMozilla:: class provides functionality that is
 4:  * specific to the Sync4JMozilla Plugin. See
 5:  * http://sourceforge.net/projects/sync4jmozilla/
 6:  *
 7:  * Copyright 2007-2012 Horde LLC (http://www.horde.org/)
 8:  *
 9:  * See the enclosed file COPYING for license information (LGPL). If you
10:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
11:  *
12:  * @author  Karsten Fourmont <karsten@horde.org>
13:  * @package SyncMl
14:  */
15: class Horde_SyncMl_Device_Sync4JMozilla extends Horde_SyncMl_Device
16: {
17:     /**
18:      * Converts the content from the backend to a format suitable for the
19:      * client device.
20:      *
21:      * Strips the uid (primary key) information as client and server might use
22:      * different ones.
23:      *
24:      * @param string $content      The content to convert
25:      * @param string $contentType  The content type of content as returned
26:      *                             from the backend
27:      * @param string $database     The server database URI.
28:      *
29:      * @return array  Three-element array with the converted content, the
30:      *                (possibly changed) new content type, and encoding type
31:      *                (like b64 as used by Funambol).
32:      */
33:     public function convertServer2Client($content, $contentType, $database)
34:     {
35:         list($content, $contentType, $encodingType) =
36:             parent::convertServer2Client($content, $contentType, $database);
37: 
38: 
39:         /* The plugin does currently not handle lines that are both folded
40:          * and QUOTED-PRINTABLE encoded. Like this one with a note "abc":
41:          * NOTE;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:=
42:          * a=
43:          * bc
44:          */
45: 
46:         if (preg_match_all('/\r\n[^:]*ENCODING=QUOTED-PRINTABLE[^:]*:.*?=\r\n.*?[^=](?=\r\n)/mis', $content, $m)) {
47:             foreach($m[0] as $v) {
48:                 /* Remove line folding */
49:                 $content = str_replace($v,str_replace("=\r\n", '', $v), $content);
50:             }
51:         }
52:         $l = "\noutput converted for client ($contentType):\n" . $content . "\n";
53:         $GLOBALS['backend']->logFile(Horde_SyncMl_Backend::LOGFILE_DATA, $l);
54: 
55:         return array($content, $contentType, $encodingType);
56:     }
57: }
58: 
API documentation generated by ApiGen