Adjust banner, cleanup formatting and use foreach() where possible

This commit is contained in:
Miles Lott 2004-01-31 19:48:34 +00:00
parent a7b2645694
commit 6024c9331b

View File

@ -1,12 +1,9 @@
<?php
/**************************************************************************\
* phpGroupWare API - VCard import/export class *
* This file written by Miles Lott <milosch@phpgroupware.org> *
* eGroupWare API - VCard import/export class *
* This file written by Miles Lott <milos@groupwhere.org> *
* Parse vcards->contacts class fields, and vice-versa *
* Copyright (C) 2001 Miles Lott *
* -------------------------------------------------------------------------*
* This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/api *
* Copyright (C) 2001-2004 Miles Lott *
* ------------------------------------------------------------------------ *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
@ -133,8 +130,7 @@
}
if($name && $value)
{
reset($this->import);
while ( list($fname,$fvalue) = each($this->import) )
foreach($this->import as $fname => $fvalue)
{
if(strstr(strtolower($name), $this->import[$fname]))
{
@ -198,7 +194,7 @@
'address3' => 'address3'
);
while (list($fname,$fvalue) = each($all_fields))
foreach($all_fields as $fname => $fvalue)
{
if($buffer[$fname])
{
@ -217,7 +213,8 @@
function _parse_in($buffer)
{
/* Following is a lot of pain and little magic */
while ( list($name,$value) = @each($buffer) )
settype($buffer,'array');
foreach($buffer as $name => $value)
{
$field = split(';',$name);
$field[0] = ereg_replace("A\.",'',$field[0]);
@ -417,7 +414,6 @@
case 'TEL': // RB 2001/05/07 added for Lotus Organizer ueses TEL;{WORK|HOME};{VOICE|FAX}[;PREF]
if($field[2] == 'FAX' && ($field[1] == 'WORK' || $field[i] == 'HOME'))
{
/* TODO This is PHP4 only */
array_shift($field); // --> ignore the WORK or HOME if FAX follows, HOME;FAX and HOME;TEL are maped later
}
switch($field[1])
@ -559,9 +555,8 @@
switch($field[0])
{
case 'N':
reset($this->names);
$j=0;
while(list($myname,$myval) = each($this->names) )
foreach($this->names as $myname => $myval)
{
$namel = 'n_' . $myname;
$entry[$namel] = $values[$j];
@ -629,7 +624,8 @@
// Takes an array of contacts class fields/values, turns it into a vcard string:
//
// for ($i=0;$i<count($buffer);$i++) {
// for($i=0;$i<count($buffer);$i++)
// {
// $vcards .= $this->vcard->out($buffer[$i]);
// }
//
@ -640,8 +636,7 @@
$header .= 'VERSION:2.1' . "\n";
$header .= 'X-EGROUPWARE-FILE-AS:eGroupWare.org' . "\n";
reset($this->export);
while ( list($name,$value) = each($this->export) )
foreach($this->export as $name => $value)
{
if(!empty($buffer[$value]))
{