/**
  * @dataProvider VCardTestSuite::validVCardProvider
  */
 public function testOutputReturnsOnlyExpectedFieldSubsetForEveryone($input)
 {
     if (!file_exists($input['filename'])) {
         $this->markTestSkipped('File: ' . $input['filename'] . "does not exist.");
     }
     $obj = new VCard($input['filename']);
     $obj->setLevel(VCard::LEVEL_ALL);
     $output = $obj->toVCard();
     $aOutput = explode("\n", $output);
     $prevLine = false;
     $inImage = false;
     foreach ($aOutput as $line => $item) {
         if ($prevLine) {
             $posPrev = mb_strpos($prevLine, '.');
             $posCur = mb_strpos($item, '.');
             if ($posPrev && $posCur && mb_substr($prevLine, 0, $posPrev) == mb_substr($item, 0, $posCur)) {
                 continue;
             }
         }
         $prevLine = $item;
         $foundField = false;
         foreach ($obj->aFilters['boilerplate'] as $rule) {
             if (mb_strstr($item, $rule)) {
                 $foundField = true;
                 continue;
             }
         }
         if ('' == trim($item)) {
             $foundField = true;
         }
         foreach ($obj->aFilters['everyone'] as $rule) {
             if (mb_strstr($item, $rule)) {
                 $foundField = true;
                 if ('PHOTO;BASE64' == $rule) {
                     $inImage = true;
                 } else {
                     $inImage = false;
                 }
                 continue;
             }
         }
         if ($inImage && !$foundField) {
             // do a regex to see if this is an image line
             // 78 chars of characters preceeded by two spaces
             if (preg_match('/^\\s\\s.*$/', $item)) {
                 $foundField = true;
             }
             if ('==' == substr($item, -2)) {
                 $inImage = false;
             }
         }
         $this->assertTrue($foundField, "Line {$line}: {$item}");
     }
 }
    {
        $userLevel = $this->getUserLevel($userPasscode);
        $vCard = new VCard('vcard.vcf');
        $vCard->setLevel($userLevel);
        return $vCard->toHCard();
    }
}
$hCard = new hCardWithLevels(array('artichoke' => hCardWithLevels::ACQUAINTANCE, 'melon' => hCardWithLevels::FRIEND));
if (isset($_GET['vcf'])) {
    if (hCardWithLevels::BAD_CODE != $hCard->getUserLevel(isset($_GET['passcode']) ? $_GET['passcode'] : null)) {
        $userLevel = $hCard->getUserLevel($_GET['passcode']);
        $vCard = new VCard('vcard.vcf');
        $vCard->setLevel($userLevel);
        header('Content-type: text/x-vcard');
        header('Content-Disposition: attachment; filename="NeilCrosby.vcf"');
        echo $vCard->toVCard();
        exit;
    }
}
$server = $_SERVER['SERVER_NAME'];
$port = isset($_SERVER['SERVER_PORT']) && 80 != $_SERVER['SERVER_PORT'] ? ':' . $_SERVER['SERVER_PORT'] : '';
$page = $_SERVER['REQUEST_URI'];
$joiner = '/' == substr($page, -1) ? '?' : '&';
// if we're on the iPhone go to the email page
if (false !== strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
    if ('/' == substr($page, -1)) {
        $newPage = $page . 'via-email/';
    } else {
        $bits = explode('/', $page);
        $queryString = array_pop($bits);
        $newPage = implode('/', $bits) . '/via-email/' . $queryString;