X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fphone.php;h=21be6a67a863033e7688da1499f0f3e87d3535ec;hb=c90dde9391588ae99bd1852fa1e95f32b016e013;hp=be6f3ad80fbd432795e44739f2ddd42d0fefb454;hpb=ba1cbd51cd218c3a8caf6d9518df9d2367a9ae54;p=platal.git diff --git a/classes/phone.php b/classes/phone.php index be6f3ad..21be6a6 100644 --- a/classes/phone.php +++ b/classes/phone.php @@ -1,6 +1,6 @@ error && ($phone->format() || $phone->isEmpty()) && $success); - if (!$phone->isEmpty()) { - // Restrict phone visibility to $maxPublicity - if (!is_null($maxPublicity) && Visibility::isLessRestrictive($maxPublicity, $phone->pub)) { - $phone->pub = $maxPublicity; + if (!is_null($data)) { + foreach ($data as $item) { + $phone = new Phone($item); + $success = (!$phone->error && ($phone->format() || $phone->isEmpty()) && $success); + if (!$phone->isEmpty()) { + // Restrict phone visibility to $maxPublicity + if (!is_null($maxPublicity) && Visibility::isLessRestrictive($maxPublicity, $phone->pub)) { + $phone->pub = $maxPublicity; + } + $phones[] = call_user_func(array($phone, $function)); } - $phones[] = call_user_func(array($phone, $function)); } } if (count($phones) == 0 && $requiresEmptyPhone) {