[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 3 require_once PHPGW_SERVER_ROOT.'/phpgwapi/inc/horde/Horde/iCalendar.php'; 4 5 6 // The following were shamelessly yoinked from Contact_Vcard_Build 7 // Part numbers for N components. 8 define('VCARD_N_FAMILY', 0); 9 define('VCARD_N_GIVEN', 1); 10 define('VCARD_N_ADDL', 2); 11 define('VCARD_N_PREFIX', 3); 12 define('VCARD_N_SUFFIX', 4); 13 14 // Part numbers for ADR components. 15 define('VCARD_ADR_POB', 0); 16 define('VCARD_ADR_EXTEND', 1); 17 define('VCARD_ADR_STREET', 2); 18 define('VCARD_ADR_LOCALITY', 3); 19 define('VCARD_ADR_REGION', 4); 20 define('VCARD_ADR_POSTCODE', 5); 21 define('VCARD_ADR_COUNTRY', 6); 22 23 // Part numbers for GEO components. 24 define('VCARD_GEO_LAT', 0); 25 define('VCARD_GEO_LON', 1); 26 27 /** 28 * Class representing vCard entries. 29 * 30 * $Horde: framework/iCalendar/iCalendar/vcard.php,v 1.2 2004/08/18 03:16:24 chuck Exp $ 31 * 32 * Copyright 2003-2004 Karsten Fourmont (karsten@horde.org) 33 * 34 * See the enclosed file COPYING for license information (LGPL). If you 35 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 36 * 37 * @author Karsten Fourmont <karsten@horde.org> 38 * @version $Revision: 18844 $ 39 * @package Horde_iCalendar 40 */ 41 class Horde_iCalendar_vcard extends Horde_iCalendar { 42 43 function getType() 44 { 45 return 'vcard'; 46 } 47 48 function parsevCalendar($data) 49 { 50 return parent::parsevCalendar($data, 'vcard'); 51 } 52 53 /** 54 * Unlike vevent and vtodo, a vcard is normally not enclosed in an 55 * iCalendar container. (BEGIN..END) 56 */ 57 function exportvCalendar() 58 { 59 #$requiredAttributes['BODY'] = ''; 60 $requiredAttributes['VERSION'] = '2.1'; 61 62 foreach ($requiredAttributes as $name => $default_value) { 63 if (is_a($this->getattribute($name), 'PEAR_Error')) { 64 $this->setAttribute($name, $default_value); 65 } 66 } 67 68 return $this->_exportvData('VCARD') . $this->_newline; 69 } 70 71 /** 72 * Returns the contents of the "N" tag as a printable Name: 73 * i.e. converts: 74 * 75 * N:Duck;Dagobert;T;Professor;Sen. 76 * to 77 * "Professor Dagobert T Duck Sen" 78 * 79 * @return string Full name of vcard "N" tag 80 * or null if no N tag. 81 */ 82 function printableName() 83 { 84 $name_parts = $this->getAttributeValues('N'); 85 if (is_a($name_parts, 'PEAR_Error')) { 86 return null; 87 } 88 89 if (!empty($name_parts[VCARD_N_PREFIX])) { 90 $name_arr[] = $name_parts[VCARD_N_PREFIX]; 91 } 92 if (!empty($name_parts[VCARD_N_GIVEN])) { 93 $name_arr[] = $name_parts[VCARD_N_GIVEN]; 94 } 95 if (!empty($name_parts[VCARD_N_ADDL])) { 96 $name_arr[] = $name_parts[VCARD_N_ADDL]; 97 } 98 if (!empty($name_parts[VCARD_N_FAMILY])) { 99 $name_arr[] = $name_parts[VCARD_N_FAMILY]; 100 } 101 if (!empty($name_parts[VCARD_N_SUFFIX])) { 102 $name_arr[] = $name_parts[VCARD_N_SUFFIX]; 103 } 104 105 return implode(' ', $name_arr); 106 } 107 108 /** 109 * Static function to make a given email address rfc822 compliant. 110 * 111 * @param string $address An email address. 112 * 113 * @return string The RFC822-formatted email address. 114 */ 115 function getBareEmail($address) 116 { 117 require_once 'Mail/RFC822.php'; 118 require_once 'Horde/MIME.php'; 119 120 static $rfc822; 121 if (is_null($rfc822)) { 122 $rfc822 = &new Mail_RFC822(); 123 } 124 125 $rfc822->validateMailbox($address); 126 127 return MIME::rfc822WriteAddress($address->mailbox, $address->host); 128 } 129 130 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |