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

Source for file vcard_build_example.php

Documentation is available at vcard_build_example.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP version 5                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2002 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Paul M. Jones <pmjones@ciaweb.net>                          |
  17. // |          Marshall Roch <mroch@php.net>                               |
  18. // +----------------------------------------------------------------------+
  19. //
  20. // $Id$
  21.  
  22. // include the class file
  23. require_once 'File/IMC.php';
  24.  
  25. // instantiate a builder object
  26. // (defaults to version 3.0)
  27. $vcard File_IMC::build('vCard');
  28.  
  29. // set a formatted name
  30. $vcard->setFormattedName('Bolivar Shagnasty');
  31.  
  32. // set the structured name parts
  33. $vcard->setName('Shagnasty''Bolivar''Odysseus''Mr.''III');
  34.  
  35. // add a work email.  note that we add the value
  36. // first and the param after -- Contact_Vcard_Build
  37. // is smart enough to add the param in the correct
  38. // place.
  39. $vcard->addEmail('boshag@example.com');
  40. $vcard->addParam('TYPE''WORK');
  41.  
  42. // add a home/preferred email
  43. $vcard->addEmail('bolivar@example.net');
  44. $vcard->addParam('TYPE''HOME');
  45. $vcard->addParam('TYPE''PREF');
  46.  
  47. // add a work address
  48. $vcard->addAddress('POB 101''Suite 202''123 Main',
  49.                    'Beverly Hills''CA''90210''US');
  50. $vcard->addParam('TYPE''WORK');
  51.  
  52. // get back the vCard and print it
  53. $text $vcard->fetch();
  54. echo '<pre>';
  55. print_r($text);
  56. echo '</pre>';
  57.     
  58. ?>

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