public function testSerializeUTF8LineFold() { $value = str_repeat('!', 65) . "äbla"; // inserted umlaut-a $property = new Property('propname', $value); $expected = "PROPNAME:" . str_repeat('!', 65) . "\r\n äbla\r\n"; $this->assertEquals($expected, $property->serialize()); }
/** * @brief transform finds the ldif entries associated with the property * @param Property $property * @return array|false */ public function getLdifProperty($property) { $ldifReturn = array(); // Only one value per property, so we loop into types // then for each one, look into config xml if there are ldif entries matching $ldifEntries = self::getLdifEntry($property->name, $property['TYPE']); // If one is found, create a tab entry like tab['ldif_entry'] if ($ldifEntries != null && count($ldifEntries) > 0) { foreach ($ldifEntries as $ldifEntry) { if (isset($ldifEntry['unassigned'])) { if (strcasecmp($property->name, "REV") != 0 && strcasecmp($property->name, "VERSION") != 0 && strcasecmp($property->name, "X-LDAP-DN") != 0) { // The unassigned properties are set in the ldap unassignedVCardProperty $ldifReturn[(string) $this->getUnassignedVCardProperty()] = array($property->serialize()); } } else { // Last, if the ldif entry has a vcard_position set, take only the value in the position index $value = $property->value; if (isset($ldifEntry['vcard_position'])) { //\OC_Log::write('ldapconnector', __METHOD__." position set ".$ldifEntry['vcard_position'], \OC_Log::DEBUG); $tmpValues = explode(";", $property->value); $value = $tmpValues[$ldifEntry['vcard_position']]; } //\OC_Log::write('ldapconnector', __METHOD__.__METHOD__." entry : ".$ldifEntry['name']." - value : $value", \OC_Log::DEBUG); // finally, sets tab['ldif_entry'][] with the value if (strcmp($value, "") != 0) { if ($ldifEntry['image']) { $ldifReturn[(string) $ldifEntry['name']] = array(base64_decode($value)); } else { $ldifReturn[(string) $ldifEntry['name']] = array($value); } } } } } return $ldifReturn; }