$geo = null;
foreach ($hash as $key => $val) {
- if (!strlen($val)) {
- continue;
- }
if ($version != '2.1') {
$val = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'utf-8');
}
case 'businessCategory':
case 'category':
- if (!empty($val)) {
- $vcard->setAttribute('CATEGORIES', $val);
- }
+ $vcard->setAttribute('CATEGORIES', $val);
break;
case 'anniversary':
}
$org = array();
- if (isset($hash['company'])) {
+ if (array_key_exists('company', $hash)) {
$org[] = $hash['company'];
}
- if (isset($hash['department'])) {
+ if (array_key_exists('department', $hash)) {
$org[] = $hash['department'];
}
if (count($org)) {
$vcard->setAttribute('ORG', $val, Horde_Mime::is8bit($val) ? $charset : array(), false, $org);
}
- if (isset($hash['commonAddress']) || isset($hash['commonStreet']) ||
- isset($hash['commonPOBox']) || isset($hash['commonExtended']) ||
- isset($hash['commonStreet']) || isset($hash['commonCity']) ||
- isset($hash['commonProvince']) ||
- isset($hash['commonPostalCode']) || isset($hash['commonCountry'])) {
+ if (array_key_exists('commonAddress', $hash) ||
+ array_key_exists('commonStreet', $hash) ||
+ array_key_exists('commonPOBox', $hash) ||
+ array_key_exists('commonExtended', $hash) ||
+ array_key_exists('commonCity', $hash) ||
+ array_key_exists('commonProvince', $hash) ||
+ array_key_exists('commonPostalCode', $hash) ||
+ array_key_exists('commonCountry', $hash)) {
/* We can't know if this particular Turba source uses a single
* address field or multiple for
* street/city/province/postcode/country. Try to deal with
$vcard->setAttribute('ADR', $val, $params, true, $a);
}
- if (isset($hash['homeAddress']) || isset($hash['homeStreet']) ||
- isset($hash['homePOBox']) || isset($hash['homeExtended']) ||
- isset($hash['homeStreet']) || isset($hash['homeCity']) ||
- isset($hash['homeProvince']) || isset($hash['homePostalCode']) ||
- isset($hash['homeCountry'])) {
+ if (array_key_exists('homeAddress', $hash) ||
+ array_key_exists('homeStreet', $hash) ||
+ array_key_exists('homePOBox', $hash) ||
+ array_key_exists('homeExtended', $hash) ||
+ array_key_exists('homeCity', $hash) ||
+ array_key_exists('homeProvince', $hash) ||
+ array_key_exists('homePostalCode', $hash) ||
+ array_key_exists('homeCountry', $hash)) {
if (isset($hash['homeAddress']) && !isset($hash['homeStreet'])) {
$hash['homeStreet'] = $hash['homeAddress'];
}
$vcard->setAttribute('ADR', $val, $params, true, $a);
}
- if (isset($hash['workAddress']) || isset($hash['workStreet']) ||
- isset($hash['workPOBox']) || isset($hash['workExtended']) ||
- isset($hash['workStreet']) || isset($hash['workCity']) ||
- isset($hash['workProvince']) || isset($hash['workPostalCode']) ||
- isset($hash['workCountry'])) {
+ if (array_key_exists('workAddress', $hash) ||
+ array_key_exists('workStreet', $hash) ||
+ array_key_exists('workPOBox', $hash) ||
+ array_key_exists('workExtended', $hash) ||
+ array_key_exists('workCity', $hash) ||
+ array_key_exists('workProvince', $hash) ||
+ array_key_exists('workPostalCode', $hash) ||
+ array_key_exists('workCountry', $hash)) {
if (isset($hash['workAddress']) && !isset($hash['workStreet'])) {
$hash['workStreet'] = $hash['workAddress'];
}
$hash = array();
$attr = $vcard->getAllAttributes();
foreach ($attr as $item) {
- if (empty($item['value'])) {
- continue;
- }
-
switch ($item['name']) {
case 'FN':
$hash['name'] = $item['value'];