Contact_Vcard_Build
[ class tree: Contact_Vcard_Build ] [ index: Contact_Vcard_Build ] [ all elements ]

Source for file test.php

Documentation is available at test.php

  1. <?php
  2.     
  3.     // report all errors
  4.     error_reporting(E_ALL);
  5.     
  6.     // include the class file
  7.     require_once 'Contact_Vcard_Build.php';
  8.     
  9.     // instantiate a builder object
  10.     // (defaults to version 3.0)
  11.     $vcard = new Contact_Vcard_Build();
  12.     
  13.     // set a formatted name
  14.     $vcard->setFormattedName('Bolivar Shagnasty');
  15.     
  16.     // set the structured name parts
  17.     $vcard->setName('Shagnasty''Bolivar''Odysseus',
  18.         'Mr.''III');
  19.     
  20.     // add a work email.  note that we add the value
  21.     // first and the param after -- Contact_Vcard_Build
  22.     // is smart enough to add the param in the correct
  23.     // place.
  24.     $vcard->addEmail('boshag@example.com');
  25.     $vcard->addParam('TYPE''WORK');
  26.     
  27.     // add a home/preferred email
  28.     $vcard->addEmail('bolivar@example.net');
  29.     $vcard->addParam('TYPE''HOME');
  30.     $vcard->addParam('TYPE''PREF');
  31.     
  32.     // add a work address
  33.     $vcard->addAddress('POB 101''Suite 202''123 Main',
  34.         'Beverly Hills''CA''90210''US');
  35.     $vcard->addParam('TYPE''WORK');
  36.     
  37.     // set the title (checks for colon-escaping)
  38.     $vcard->setTitle('The Title: The Subtitle');
  39.     
  40.     // send the vcard
  41.     header('Content-Type: text/plain');
  42.     echo $vcard->fetch();
  43.     
  44. ?>

Documentation generated on Mon, 11 Mar 2019 14:19:47 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.