apps/dav/lib/CardDAV/AddressBookImpl.php
/**
	 * create array with all vCard properties
	 *
	 * @param string $uri
	 * @param VCard $vCard
	 * @return array
	 */
create array with all vCard properties
@param string $uri
@param VCard $vCard
@return array
create array with all vCard properties @param string $uri @param VCard $vCard @return array
protected function vCard2Array($uri, VCard $vCard) {
		$result = [
			'URI' => $uri,
		];
		foreach ($vCard->children() as $property) {
			if ($property->name === 'PHOTO' && $property->getValueType() === 'BINARY') {
				$url = $this->urlGenerator->getAbsoluteURL(
					$this->urlGenerator->linkTo('', 'remote.php') . '/dav/');
				$url .= implode('/', [
					'addressbooks',
					substr($this->addressBookInfo['principaluri'], 11), 
					$this->addressBookInfo['uri'],
					$uri
				]) . '?photo';
				$result['PHOTO'] = 'VALUE=uri:' . $url;
			} else if ($property->name === 'X-SOCIALPROFILE') {
				$type = $this->getTypeFromProperty($property);
				if ($type !== null) {
					if (!isset($result[$property->name])) {
						$result[$property->name] = [];
					}
					$result[$property->name][$type] = $property->getValue();
				}
			} else if (in_array($property->name, ['CLOUD', 'EMAIL', 'IMPP', 'TEL', 'URL'])) {
				if (!isset($result[$property->name])) {
					$result[$property->name] = [];
				}
				$result[$property->name][] = $property->getValue();
			} else {
				$result[$property->name] = $property->getValue();
			}
		}
		if ($this->addressBookInfo['principaluri'] === 'principals/system/system' &&
			$this->addressBookInfo['uri'] === 'system') {
			$result['isLocalSystemBook'] = true;
		}
		return $result;
	}
protected function vCard2Array ( $ uri , VCard $ vCard ) { $ result = [ 'URI' => $ uri , ] ; foreach ( $ vCard -> children ( ) as $ property ) { if ( $ property -> name === 'PHOTO' && $ property -> getValueType ( ) === 'BINARY' ) { $ url = $ this -> urlGenerator -> getAbsoluteURL ( $ this -> urlGenerator -> linkTo ( '' , 'remote.php' ) . '/dav/' ) ; $ url .= implode ( '/' , [ 'addressbooks' , substr ( $ this -> addressBookInfo [ 'principaluri' ] , 11 ) , $ this -> addressBookInfo [ 'uri' ] , $ uri ] ) . '?photo' ; $ result [ 'PHOTO' ] = 'VALUE=uri:' . $ url ; } else if ( $ property -> name === 'X-SOCIALPROFILE' ) { $ type = $ this -> getTypeFromProperty ( $ property ) ; if ( $ type !== null ) { if ( ! isset ( $ result [ $ property -> name ] ) ) { $ result [ $ property -> name ] = [ ] ; } $ result [ $ property -> name ] [ $ type ] = $ property -> getValue ( ) ; } } else if ( in_array ( $ property -> name , [ 'CLOUD' , 'EMAIL' , 'IMPP' , 'TEL' , 'URL' ] ) ) { if ( ! isset ( $ result [ $ property -> name ] ) ) { $ result [ $ property -> name ] = [ ] ; } $ result [ $ property -> name ] [ ] = $ property -> getValue ( ) ; } else { $ result [ $ property -> name ] = $ property -> getValue ( ) ; } } if ( $ this -> addressBookInfo [ 'principaluri' ] === 'principals/system/system' && $ this -> addressBookInfo [ 'uri' ] === 'system' ) { $ result [ 'isLocalSystemBook' ] = true ; } return $ result ; }
create array with all vCard properties
 @param string $uri
 @param VCard $vCard
 @return array
create array with all vCard properties @param string $uri @param VCard $vCard @return array
//cut off 'principals/' // Type is the social network, when it's empty we don't need this. // The following properties can be set multiple times