diff --git a/lib/connector/importvcardconnector.php b/lib/connector/importvcardconnector.php index 1bcc6174..998ffb08 100755 --- a/lib/connector/importvcardconnector.php +++ b/lib/connector/importvcardconnector.php @@ -191,20 +191,9 @@ class ImportVCardConnector extends ImportConnector{ // Doesn't look like a vcf file return 0; } else { - try { - $vcard = VObject\Reader::read($parts[0]); - } catch (VObject\ParseException $e) { - // error while parsing, doesn't look like a vcard - return 0; - } - $toTranslate=1; - foreach ($vcard->children() as $vcardProperty) { - $importEntry = $this->getImportEntry($vcardProperty, $vcard); - if ($importEntry) { - $toTranslate++; - } - } - return (1 - pow(0.5, $toTranslate)); + $element = $this->convertElementToVCard($parts[0]); + $unknownElements = $element->select("X-Unknown-Element"); + return (1 - (0.5 * count($unknownElements)/count($parts[0]))); } }