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

Documentation generated on Mon, 11 Mar 2019 15:32:03 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.