From 0dbac3218130dfe418d6c7dc162f819c746bec2d Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Thu, 04 Sep 2008 14:20:27 -0400 Subject: [PATCH] Enable export of contacts as vCard + DRY --- program/include/rcube_vcard.php | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/program/include/rcube_vcard.php b/program/include/rcube_vcard.php index 560d37d..3ad47a5 100644 --- a/program/include/rcube_vcard.php +++ b/program/include/rcube_vcard.php @@ -28,7 +28,10 @@ */ class rcube_vcard { - private $raw = array(); + private $raw = array( + 'FN' => array(), + 'N' => array(array('','','','','')), + ); public $business = false; public $displayname; @@ -98,7 +101,7 @@ * @param string Field value * @param string Section name */ - public function set($field, $value, $section = 'home') + public function set($field, $value, $section = 'HOME') { switch ($field) { case 'name': @@ -222,7 +225,7 @@ private static function rfc2425_fold($val) { - return preg_replace('/:([^\n]{72,})/e', '":\n ".rtrim(chunk_split("\\1", 72, "\n "))', $val) . "\n\n"; + return preg_replace('/:([^\n]{72,})/e', '":\n ".rtrim(chunk_split("\\1", 72, "\n "))', $val) . "\n"; } @@ -325,7 +328,7 @@ } } - return "BEGIN:VCARD\nVERSION:3.0\n{$vcard}END:VCARD\n"; + return "BEGIN:VCARD\nVERSION:3.0\n{$vcard}END:VCARD"; } -- Gitblit v1.9.1