1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-11-29 11:24:11 +01:00

Update Contacts and Calendar with namespaces for Sabre 1.7.1

This commit is contained in:
Susinthiran Sithamparanathan 2012-10-17 14:32:18 +02:00
parent 015d58ba64
commit 9c3ba7bed0
5 changed files with 10 additions and 10 deletions

View File

@ -133,7 +133,7 @@ switch($name) {
$line = count($vcard->children) - 1;
// Apparently Sabre_VObject_Parameter doesn't do well with
// Apparently Sabre\VObject\Parameter doesn't do well with
// multiple values or I don't know how to do it. Tanghus.
foreach ($parameters as $key=>$element) {
if(is_array($element) /*&& strtoupper($key) == 'TYPE'*/) {
@ -142,13 +142,13 @@ foreach ($parameters as $key=>$element) {
foreach($element as $e) {
if($e != '' && !is_null($e)) {
if(trim($e)) {
$vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key, $e);
$vcard->children[$line]->parameters[] = new Sabre\VObject\Parameter($key, $e);
}
}
}
} else {
if(trim($element)) {
$vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key, $element);
$vcard->children[$line]->parameters[] = new Sabre\VObject\Parameter($key, $element);
}
}
}

View File

@ -112,7 +112,7 @@ if(!$value) {
$vcard->children[$line]->setValue($value);
$vcard->children[$line]->parameters = array();
$vcard->children[$line]->add(
new Sabre_VObject_Parameter('VALUE', 'DATE')
new Sabre\VObject\Parameter('VALUE', 'DATE')
);
debug('Setting value:'.$name.' '.$vcard->children[$line]);
break;
@ -135,7 +135,7 @@ if(!$value) {
foreach($parameter as $val) {
if(trim($val)) {
debug('Adding parameter: '.$key.'=>'.$val);
$vcard->children[$line]->add(new Sabre_VObject_Parameter(
$vcard->children[$line]->add(new Sabre\VObject\Parameter(
$key,
strtoupper(strip_tags($val)))
);
@ -143,7 +143,7 @@ if(!$value) {
}
} else {
if(trim($parameter)) {
$vcard->children[$line]->add(new Sabre_VObject_Parameter(
$vcard->children[$line]->add(new Sabre\VObject\Parameter(
$key,
strtoupper(strip_tags($parameter)))
);

View File

@ -80,9 +80,9 @@ if($data) {
}
$property->setValue($image->__toString());
$property->parameters[]
= new Sabre_VObject_Parameter('ENCODING', 'b');
= new Sabre\VObject\Parameter('ENCODING', 'b');
$property->parameters[]
= new Sabre_VObject_Parameter('TYPE', $image->mimeType());
= new Sabre\VObject\Parameter('TYPE', $image->mimeType());
$vcard->__set('PHOTO', $property);
} else {
OCP\Util::writeLog('contacts',

View File

@ -92,7 +92,7 @@ class OC_Contacts_Hooks{
$vevent = new OC_VObject('VEVENT');
//$vevent->setDateTime('LAST-MODIFIED', new DateTime($vcard->REV));
$vevent->setDateTime('DTSTART', $date,
Sabre_VObject_Element_DateTime::DATE);
Sabre\VObject\Property\DateTime::DATE);
$vevent->setString('DURATION', 'P1D');
$vevent->setString('UID', substr(md5(rand().time()), 0, 10));
// DESCRIPTION?

View File

@ -132,7 +132,7 @@ class OC_Contacts_VCard {
foreach($property->parameters as $key=>&$parameter) {
$types = OC_Contacts_App::getTypesOfProperty($property->name);
if(is_array($types) && in_array(strtoupper($parameter->name), array_keys($types)) || strtoupper($parameter->name) == 'PREF') {
$property->parameters[] = new Sabre_VObject_Parameter('TYPE', $parameter->name);
$property->parameters[] = new Sabre\VObject\Parameter('TYPE', $parameter->name);
}
unset($property->parameters[$key]);
}