cvs: peardoc /en/package fileformats.xml /en/package/fileformats contact-vcard-build.xml contact-vcard-parse.xml contact-vcard.xml
/en/package/fileformats/contact-vcard components.xml contact-vcard.xml lines.xml projects.xml /en/package/fileformats/contact-vcard-build intro.xml
usage.xml /en/package/fileformats/contact-vcard-parse data.xml intro.xml knownissues.xml

From: Date: Fri, 10 Nov 2006 13:06:36 +0000
Subject: cvs: peardoc /en/package fileformats.xml /en/package/fileformats contact-vcard-build.xml contact-vcard-parse.xml contact-vcard.xml
/en/package/fileformats/contact-vcard components.xml contact-vcard.xml lines.xml projects.xml /en/package/fileformats/contact-vcard-build intro.xml
usage.xml /en/package/fileformats/contact-vcard-parse data.xml intro.xml knownissues.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-8752@lists.php.net to get a copy of this message
cweiske Fri Nov 10 13:06:36 2006 UTC Added files: /peardoc/en/package/fileformats contact-vcard.xml /peardoc/en/package/fileformats/contact-vcard components.xml contact-vcard.xml lines.xml projects.xml /peardoc/en/package/fileformats/contact-vcard-build usage.xml /peardoc/en/package/fileformats/contact-vcard-parse data.xml knownissues.xml Modified files: /peardoc/en/package fileformats.xml /peardoc/en/package/fileformats contact-vcard-build.xml contact-vcard-parse.xml /peardoc/en/package/fileformats/contact-vcard-build intro.xml /peardoc/en/package/fileformats/contact-vcard-parse intro.xml Log: Converted Paul Jones' Wiki documentation for Contact_Vcard* into peardoc.

http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats.xml?r1=1.12&r2=1.13&diff_format=u Index: peardoc/en/package/fileformats.xml diff -u peardoc/en/package/fileformats.xml:1.12 peardoc/en/package/fileformats.xml:1.13 --- peardoc/en/package/fileformats.xml:1.12 Fri Feb 17 16:04:31 2006 +++ peardoc/en/package/fileformats.xml Fri Nov 10 13:06:35 2006 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <chapter id="package.fileformats"> <title>File Formats</title> @@ -8,6 +8,7 @@ &blankpagehack; + &package.fileformats.contact-vcard; &package.fileformats.contact-vcard-build; &package.fileformats.contact-vcard-parse; &package.fileformats.file-archive; http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/contact-vcard-build.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/en/package/fileformats/contact-vcard-build.xml diff -u peardoc/en/package/fileformats/contact-vcard-build.xml:1.1 peardoc/en/package/fileformats/contact-vcard-build.xml:1.2 --- peardoc/en/package/fileformats/contact-vcard-build.xml:1.1 Wed Nov 8 12:39:03 2006 +++ peardoc/en/package/fileformats/contact-vcard-build.xml Fri Nov 10 13:06:35 2006 @@ -1,13 +1,18 @@ -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <sect1 id="package.fileformats.contact-vcard-build"> <title>Contact_Vcard_Build</title> <para> -Build (create) and fetch vCard 2.1 and 3.0 text blocks. - + Build (create) and fetch vCard 2.1 and 3.0 text blocks. + </para> + <para> + Please read + <link linkend="package.fileformats.contact-vcard">About Contact_Vcard</link> + first. </para> - + &package.fileformats.contact-vcard-build.intro; + &package.fileformats.contact-vcard-build.usage; </sect1> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/contact-vcard-parse.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/en/package/fileformats/contact-vcard-parse.xml diff -u peardoc/en/package/fileformats/contact-vcard-parse.xml:1.1 peardoc/en/package/fileformats/contact-vcard-parse.xml:1.2 --- peardoc/en/package/fileformats/contact-vcard-parse.xml:1.1 Wed Nov 8 12:39:03 2006 +++ peardoc/en/package/fileformats/contact-vcard-parse.xml Fri Nov 10 13:06:35 2006 @@ -1,12 +1,19 @@ -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <sect1 id="package.fileformats.contact-vcard-parse"> <title>Contact_Vcard_Parse</title> <para> -Parse vCard 2.1 and 3.0 files. + Parse vCard 2.1 and 3.0 files. </para> - + <para> + Please read + <link linkend="package.fileformats.contact-vcard">About Contact_Vcard</link> + first. + </para> + &package.fileformats.contact-vcard-parse.intro; + &package.fileformats.contact-vcard-parse.data; + &package.fileformats.contact-vcard-parse.knownissues; </sect1> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/contact-vcard-build/intro.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/en/package/fileformats/contact-vcard-build/intro.xml diff -u peardoc/en/package/fileformats/contact-vcard-build/intro.xml:1.1 peardoc/en/package/fileformats/contact-vcard-build/intro.xml:1.2 --- peardoc/en/package/fileformats/contact-vcard-build/intro.xml:1.1 Tue Apr 13 18:21:09 2004 +++ peardoc/en/package/fileformats/contact-vcard-build/intro.xml Fri Nov 10 13:06:35 2006 @@ -1,25 +1,515 @@ -<!-- $Revision: 1.1 $ --> - <refentry id="package.fileformats.contact-vcard-build.intro"> - <refnamediv> - <refname>Introduction</refname> - <refpurpose> -Build (create) and fetch vCard 2.1 and 3.0 text blocks. - </refpurpose> - </refnamediv> - <refsect1> -<title> Contact_Vcard_Build Description</title> - <para> -Allows you to programmatically create a vCard, version 2.1 or 3.0, and fetch the vCard text. - </para> - -<para> - <ulink url="http://wiki.ciaweb.net/yawiki/index.php?wiki=Contact_Vcard"> - The full online documentation is available here</ulink> - </para> - </refsect1> - </refentry> - - +<?xml version="1.0" encoding="iso-8859-1" ?> +<!-- $Revision: 1.2 $ --> +<refentry id="package.fileformats.contact-vcard-build.intro"> + <refnamediv> + <refname>Introduction</refname> + <refpurpose> + Build (create) and fetch vCard 2.1 and 3.0 text blocks. + </refpurpose> + </refnamediv> + <refsect1> + <title>Contact_Vcard_Build Description</title> + <para> + Allows you to programmatically create a vCard, + version 2.1 or 3.0, and fetch the vCard text. + </para> + </refsect1> + <refsect1> + <title>Quick Instructions</title> + <itemizedlist> + <listitem> + <para> + Download and un-compress Contact_Vcard_Build from the PEAR archive. + </para> + </listitem> + <listitem> + <para> + Include <filename>Contact_Vcard_Build.php</filename> in your PHP script. + </para> + </listitem> + <listitem> + <para> + Instantiate a new <classname>Contact_Vcard_Build</classname> object + (by default, the vCard version is 3.0, but 2.1 vCards are also supported). + </para> + </listitem> + <listitem> + <para> + Set or add values and parameters that you want in the vCard. + </para> + </listitem> + <listitem> + <para> + Fetch the completed vCard, then use <function>print_r</function> + to view the results. + </para> + </listitem> + </itemizedlist> + + <example> + <title>Example code:</title> + <programlisting role="php"><![CDATA[ +<?php + + // include the class file + require_once 'Contact_Vcard_Build.php'; + + // instantiate a builder object + // (defaults to version 3.0) + $vcard = new Contact_Vcard_Build(); + + // set a formatted name + $vcard->setFormattedName('Bolivar Shagnasty'); + + // set the structured name parts + $vcard->setName('Shagnasty', 'Bolivar', 'Odysseus', + 'Mr.', 'III'); + + // add a work email. note that we add the value + // first and the param after -- Contact_Vcard_Build + // is smart enough to add the param in the correct + // place. + $vcard->addEmail('boshag@example.com'); + $vcard->addParam('TYPE', 'WORK'); + + // add a home/preferred email + $vcard->addEmail('bolivar@example.net'); + $vcard->addParam('TYPE', 'HOME'); + $vcard->addParam('TYPE', 'PREF'); + + // add a work address + $vcard->addAddress('POB 101', 'Suite 202', '123 Main', + 'Beverly Hills', 'CA', '90210', 'US'); + $vcard->addParam('TYPE', 'WORK'); + + // get back the vCard and print it + $text = $vcard->fetch(); + echo '<pre>'; + print_r($text); + echo '</pre>'; +?> +]]></programlisting> + </example> + </refsect1> + + <refsect1> + <title>Differences Between vCard 2.1 and vCard 3.0</title> + <para> + The <literal>2.1</literal> specification uses CRLF to terminate lines + (<literal>\r\n</literal>). + It allows the following components and parameters: + </para> + + <itemizedlist> + <listitem> + <para> + Parameters: + </para> + <itemizedlist> + + <listitem> + <para> + <emphasis>TYPE</emphasis> of DOM, INTL, POSTAL, PARCEL, HOME, WORK, + PREF, VOICE, FAX, MSG, CELL, PAGER, BBS, MODEM, CAR, ISDN, VIDEO, + AOL, APPLELINK, ATTMAIL, CIS, EWORLD, INTERNET, IBMMAIL, MCIMAIL, + POWERSHARE, PRODIGY, TLX, X400, GIF, CGM, WMF, BMP, MET, PMB, DIB, + PICT, TIFF, PDF, PS, JPEG, QTIME, MPEG, MPEG2, AVI, WAVE, AIFF, + PCM, X509, or PGP. + </para> + </listitem> + + <listitem> + <para> + <emphasis>ENCODING</emphasis> of 7BIT, 8BIT, BASE64, QUOTED-PRINTABLE + </para> + </listitem> + + <listitem> + <para> + <emphasis>VALUE</emphasis> of INLINE, CONTENT-ID, CID, URL, VCARD + </para> + </listitem> + + <listitem> + <para> + <emphasis>CHARSET</emphasis> of any ISO charset specification. + </para> + </listitem> + + <listitem> + <para> + <emphasis>LANGUAGE</emphasis> is very lenient, basically anything + so long as it uses only the characters a-z, A-Z, 0-9, and dash (-). + </para> + </listitem> + + </itemizedlist> + </listitem> + + <listitem> + <para> + Components and methods + </para> + <itemizedlist> + <listitem> + <para> + VERSION (<function>setVersion</function>) + </para> + </listitem> + + <listitem> + <para> + FN (<function>setFormattedName</function>) + </para> + </listitem> + + <listitem> + <para> + N (<function>setName</function>) + </para> + </listitem> + + <listitem> + <para> + PHOTO (<function>setPhoto</function>) + </para> + </listitem> + + <listitem> + <para> + BDAY (<function>setBirthday</function>) + </para> + </listitem> + + <listitem> + <para> + ADR (<function>addAddress</function>) + </para> + </listitem> + + <listitem> + <para> + LABEL (<function>addLabel</function>) + </para> + </listitem> + + <listitem> + <para> + TEL (<function>addTelephone</function>) + </para> + </listitem> + + <listitem> + <para> + EMAIL (<function>addEmail</function>) + </para> + </listitem> + + <listitem> + <para> + MAILER (<function>setMailer</function>) + </para> + </listitem> + + <listitem> + <para> + TZ (<function>setTZ</function>) + </para> + </listitem> + + <listitem> + <para> + GEO (<function>setGeo</function>) + </para> + </listitem> + + <listitem> + <para> + TITLE (<function>setTitle</function>) + </para> + </listitem> + + <listitem> + <para> + ROLE (<function>setRole</function>) + </para> + </listitem> + + <listitem> + <para> + LOGO (<function>setLogo</function>) + </para> + </listitem> + + <listitem> + <para> + AGENT (<function>setAgent</function>) + </para> + </listitem> + + <listitem> + <para> + ORG (<function>addOrganization</function>) + </para> + </listitem> + + <listitem> + <para> + NOTE (<function>setNote</function>) + </para> + </listitem> + + <listitem> + <para> + REV (<function>setRevision</function>) + </para> + </listitem> + + <listitem> + <para> + SOUND (<function>setSound</function>) + </para> + </listitem> + + <listitem> + <para> + URL (<function>setURL</function>) + </para> + </listitem> + + <listitem> + <para> + KEY (<function>setKey</function>) + </para> + </listitem> + + </itemizedlist> + </listitem> + </itemizedlist> + + + + <para> + The <literal>3.0</literal> specification uses LF to terminate lines + (<literal>\n</literal>). + It allows the following components and parameters: + </para> + + <itemizedlist> + <listitem> + <para> + Parameters: + </para> + <itemizedlist> + <listitem> + <para> + TYPE of any of the 2.1 TYPE values, or any other value so long as it uses only the characters a-z, A-Z, 0-9, and dash (-). + </para> + </listitem> + + <listitem> + <para> + ENCODING of 8BIT and B ("binary"). + </para> + </listitem> + + <listitem> + <para> + VALUE of BINARY, PHONE-NUMBER, TEXT, URI, UTC-OFFSET, or VCARD. + </para> + </listitem> + </itemizedlist> + </listitem> + <listitem> + <para> + Components and Methods: + </para> + <itemizedlist> + <listitem> + <para> + VERSION (<function>setVersion</function>) + </para> + </listitem> + + <listitem> + <para> + FN (<function>setFormattedName</function>) + </para> + </listitem> + + <listitem> + <para> + N (<function>setName</function>) + </para> + </listitem> + + <listitem> + <para> + NAME (<function>setSourceName</function>) + </para> + </listitem> + + <listitem> + <para> + SOURCE (<function>setSource</function>) + </para> + </listitem> + + <listitem> + <para> + NICKNAME (<function>addNickname</function>) + </para> + </listitem> + + <listitem> + <para> + PHOTO (<function>setPhoto</function>) + </para> + </listitem> + + <listitem> + <para> + BDAY (<function>setBirthday</function>) + </para> + </listitem> + + <listitem> + <para> + ADR (<function>addAddress</function>) + </para> + </listitem> + + <listitem> + <para> + LABEL (<function>addLabel</function>) + </para> + </listitem> + + <listitem> + <para> + TEL (<function>addTelephone</function>) + </para> + </listitem> + + <listitem> + <para> + EMAIL (<function>addEmail</function>) + </para> + </listitem> + + <listitem> + <para> + MAILER (<function>setMailer</function>) + </para> + </listitem> + + <listitem> + <para> + TZ (<function>setTZ</function>) + </para> + </listitem> + + <listitem> + <para> + GEO (<function>setGeo</function>) + </para> + </listitem> + + <listitem> + <para> + TITLE (<function>setTitle</function>) + </para> + </listitem> + + <listitem> + <para> + ROLE (<function>setRole</function>) + </para> + </listitem> + + <listitem> + <para> + LOGO (<function>setLogo</function>) + </para> + </listitem> + + <listitem> + <para> + AGENT (<function>setAgent</function>) + </para> + </listitem> + + <listitem> + <para> + ORG (<function>addOrganization</function>) + </para> + </listitem> + + <listitem> + <para> + CATEGORIES (<function>addCategories</function>) + </para> + </listitem> + + <listitem> + <para> + NOTE (<function>setNote</function>) + </para> + </listitem> + + <listitem> + <para> + PRODID (<function>setProductID</function>) + </para> + </listitem> + + <listitem> + <para> + REV (<function>setRevision</function>) + </para> + </listitem> + + <listitem> + <para> + SORT-STRING (<function>setSortString</function>) + </para> + </listitem> + + <listitem> + <para> + SOUND (<function>setSound</function>) + </para> + </listitem> + + <listitem> + <para> + UID (<function>setUniqueID</function>) + </para> + </listitem> + + <listitem> + <para> + URL (<function>setURL</function>) + </para> + </listitem> + + <listitem> + <para> + CLASS (<function>setClass</function>) + </para> + </listitem> + + <listitem> + <para> + KEY (<function>setKey</function>) + </para> + </listitem> + </itemizedlist> + </listitem> + </itemizedlist> + + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/contact-vcard-parse/intro.xml?r1=1.2&r2=1.3&diff_format=u Index: peardoc/en/package/fileformats/contact-vcard-parse/intro.xml diff -u peardoc/en/package/fileformats/contact-vcard-parse/intro.xml:1.2 peardoc/en/package/fileformats/contact-vcard-parse/intro.xml:1.3 --- peardoc/en/package/fileformats/contact-vcard-parse/intro.xml:1.2 Wed Nov 8 08:33:21 2006 +++ peardoc/en/package/fileformats/contact-vcard-parse/intro.xml Fri Nov 10 13:06:36 2006 @@ -1,28 +1,80 @@ -<!-- $Revision: 1.2 $ --> - <refentry id="package.fileformats.contact-vcard-parse.intro"> - <refnamediv> - <refname>Introduction</refname> - <refpurpose> - Parse vCard 2.1 and 3.0 files. - </refpurpose> - </refnamediv> - <refsect1> -<title> Contact_Vcard_Parse Description</title> - <para> - - Allows you to parse vCard files and text blocks - and get back an array of the elements of each - vCard in the file or text. - - </para> -<para> - <ulink url="http://ciaweb.net/yawiki/index.php?area=Contact_Vcard"> - The full online documentation is available here</ulink> - </para> - </refsect1> - </refentry> - - +<?xml version="1.0" encoding="iso-8859-1" ?> +<!-- $Revision: 1.3 $ --> + +<refentry id="package.fileformats.contact-vcard-parse.intro"> + <refnamediv> + <refname>Introduction</refname> + <refpurpose> + Build (create) and fetch vCard 2.1 and 3.0 text blocks. + </refpurpose> + </refnamediv> + + <refsect1 id="package.fileformats.contact-vcard-parse.intro.desc"> + <title>Description</title> + <para> + Here are some quick instructions for the impatient. :-) + </para> + <itemizedlist> + <listitem> + <para> + Download and un-compress Contact_Vcard_Parse from the PEAR archive. + </para> + </listitem> + <listitem> + <para> + Include <filename>Contact_Vcard_Parse.php</filename> in your PHP script. + </para> + </listitem> + <listitem> + <para> + Instantiate a new <classname>Contact_Vcard_Parse</classname> object. + </para> + </listitem> + <listitem> + <para> + Use the <function>fromFile</function> method to parse any file which may + have one or more vCards in it; try the <filename>sample.vcf</filename> + file for a start. + <classname>Contact_Vcard_Parse</classname> should work with both + 2.1 and 3.0 vCard files. + </para> + </listitem> + <listitem> + <para> + Use <function>print_r</function> to view the resulting array of data + from the parsed file. + </para> + </listitem> + <listitem> + <para> + Do what you want with the data, such as insert into a table. + </para> + </listitem> + </itemizedlist> + <example> + <title>Example code</title> + <programlisting role="php"><![CDATA[ +<?php + // include the class file + require_once 'Contact_Vcard_Parse.php'; + + // instantiate a parser object + $parse = new Contact_Vcard_Parse(); + + // parse a vCard file and store the data + // in $cardinfo + $cardinfo = $parse->fromFile('sample.vcf'); + + // view the card info array + echo '<pre>'; + print_r($cardinfo); + echo '</pre>'; + +?>]]></programlisting> + </example> + + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: @@ -34,7 +86,7 @@ sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil -sgml-default-dtd-file:"../../../../manual.ced" +sgml-default-dtd-file:"../../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/contact-vcard.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/contact-vcard.xml +++ peardoc/en/package/fileformats/contact-vcard.xml <!-- $Revision: 1.1 $ --> <sect1 id="package.fileformats.contact-vcard"> <title>Contact_Vcard</title> <para> Parse and create vCards. </para> &package.fileformats.contact-vcard.contact-vcard; &package.fileformats.contact-vcard.components; &package.fileformats.contact-vcard.lines; &package.fileformats.contact-vcard.projects; </sect1> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/contact-vcard/components.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/contact-vcard/components.xml +++ peardoc/en/package/fileformats/contact-vcard/components.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <refentry id="package.fileformats.contact-vcard.components"> <refnamediv> <refname>Components</refname> <refpurpose> Data stored in a vCard </refpurpose> </refnamediv> <refsect1 id="package.fileformats.contact-vcard.components.desc"> <title>Description</title> <para> These are some, but not all, of the components of a vCard file: </para> <itemizedlist> <listitem> <para> <literal>N</literal>: The name of the person or organization represented by the vCard, in a structured format: family name, given name, additional (middle) names, any honorific prefixes (Mr., Dr., Miss, etc), and any honorific suffixes (Jr., III, Ph.D., etc). </para> </listitem> <listitem> <para> <literal>ADR</literal>: Physical address. There may be one or more addresses in a vCard; one for home, one for work, one for deliveries, and so on. The ADR element has structured components for p.o. box, extended information, street, city/locality, state/region, postal code, and country. </para> </listitem> <listitem> <para> <literal>TEL</literal>: Telephone. There may be one or more telephone numbers in a vCard; one for home, one for work, one for fax, and so on. The TEL element has a single text value indicating the phone number. </para> </listitem> <listitem> <para> <literal>EMAIL</literal>: Email address. There may be one or more email addresses in a vCard; one for home, one for work, and so on. The EMAIL element has a single text value indicating the email address. </para> </listitem> <listitem> <para> <literal>URL</literal>: One URL associated with this vCard; e.g., a personal or organizational home page. </para> </listitem> <listitem> <para> <literal>ORG</literal>: The organization in which this vCard is a part. There may be one or more suborgnizations as well. </para> </listitem> <listitem> <para> <literal>TITLE</literal>: A single job title. </para> </listitem> <listitem> <para> <literal>ROLE</literal>: A single, longer description of the job role. Whereas TITLE might be "Senior VP Of Custodial Enforcement" the ROLE might be "Sweep floors, empty trash, etc." </para> </listitem> <listitem> <para> <literal>CATEGORIES</literal>: The category or categories of this vCard: Personal, Business, Family, and so on. </para> </listitem> <listitem> <para> <literal>BDAY</literal>: Birthday in yyyy-mm-dd format. It might also have additional time and timezone information. </para> </listitem> <listitem> <para> <literal>PHOTO</literal>, <literal>LOGO</literal>, <literal>KEY</literal>, <literal>SOUND</literal>: Respectively, a binary-encoded file for a personal photo, corporate logo, encryption key, or name-pronounciation sound associated with the vCard. The information may also be a URI link to a binary file. </para> </listitem> <listitem> <para> <literal>NOTE</literal>: Any other arbitrary information you might want to keep with the vCard. </para> </listitem> </itemizedlist> </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/contact-vcard/contact-vcard.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/contact-vcard/contact-vcard.xml +++ peardoc/en/package/fileformats/contact-vcard/contact-vcard.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <refentry id="package.fileformats.contact-vcard.contact-vcard"> <refnamediv> <refname>Contact_VCard</refname> <refpurpose> About the classes </refpurpose> </refnamediv> <refsect1 id="package.fileformats.contact-vcard.contact-vcard.desc"> <title>Description</title> <para> The Contact_Vcard classes for PHP allow you to parse and build vCards that match the IMC standards. </para> <para> A vCard is a plain text file that contains an "electronic business card" of contact information suitable for including in an address book. The vCard format is a standardized way of trading personal and organizational contact information. </para> <para> For a full overview of the vCard 3.0 specification, refer to <ulink url="http://www.ietf.org/rfc/rfc2426.txt">Internet Engineering Task Force RFC 2426</ulink>. </para> <para> For a full overview of the vCard 2.1 specification (version 2.1), refer to the <ulink url="http://www.imc.org/pdi/pdiproddev.html">Internet Mail Consortium Product Developer Information</ulink> web page. </para> </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/contact-vcard/lines.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/contact-vcard/lines.xml +++ peardoc/en/package/fileformats/contact-vcard/lines.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <refentry id="package.fileformats.contact-vcard.lines"> <refnamediv> <refname>Lines</refname> <refpurpose> vCards internally </refpurpose> </refnamediv> <refsect1 id="package.fileformats.contact-vcard.lines.desc"> <title>Description</title> <para> Each line in a vCard is a separate component of the vCard. A component line consists of three things: </para> <itemizedlist> <listitem> <para> the component type-defnition (<literal>N</literal>, <literal>ADR</literal>, <literal>TEL</literal>, etc); </para> </listitem> <listitem> <para> optionally, parameters for the component, such as whether or not the data is binary-encoded, or the type of data (home/work/preferred/etc), and so on; and </para> </listitem> <listitem> <para> the component value (which may be a single text value, repeated text values, or a structured text value). </para> </listitem> </itemizedlist> <para> For example, consider the following component lines: </para> <screen><![CDATA[ ADR;TYPE=WORK,PREF:;;123 Main;Beverly Hills;CA;90210;US EMAIL;TYPE=HOME;TYPE=INTERNET:nobody@example.com CATEGORIES:Personal,Business,Family PHOTO;TYPE=JPEG;VALUE=URI:http://example.com/photo.jpg ]]></screen> <para> Component line 1 has an <literal>ADR</literal> type-definition (meaning a delivery address). It has a <literal>TYPE</literal> parameter of <literal>WORK</literal> and <literal>PREF</literal>, indicating that this a work address and is the preferred address for deliveries. Finally, the value of the component is a structured text value. Structured text value parts are delimited by semicolons; in the case of <literal>ADR</literal> components, the structured value parts are p.o. box, extended address, street address, city/locality, state/region, zip/postal code, and country. </para> <para> Component line 2 has an <literal>EMAIL</literal> type-definition (meaning an email address). It has a <literal>TYPE</literal> parameter of <literal>HOME</literal> and <literal>INTERNET</literal> (meaning an internet email address for home). The component value is a single text value indicating the email address. </para> <para> Component line 3 has a <literal>CATEGORIES</literal> type-definition (meaning the general categories of of this vCard). There are no parameters for this component. The component value is a repeating-text value. Repeated text values a delimited by commas. </para> <para> Component line 4 has a <literal>PHOTO</literal> type-definition (meaning a personal photograph). The parameters indicate that the photo <literal>TYPE</literal> is <literal>JPEG</literal> (giving a hint to vCard decoders how to handle the <literal>PHOTO</literal> value) and that the component <literal>VALUE</literal> will be a <literal>URI</literal> (that is, a link to an external photo file). Finally, the component value is a single text value, revealing in this case the <literal>URI</literal> of the photo. </para> </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/contact-vcard/projects.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/contact-vcard/projects.xml +++ peardoc/en/package/fileformats/contact-vcard/projects.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <refentry id="package.fileformats.contact-vcard.projects"> <refnamediv> <refname>Projects</refname> <refpurpose> Other vCard projects </refpurpose> </refnamediv> <refsect1 id="package.fileformats.contact-vcard.projects.desc"> <title>Description</title> <para> Frank Hellwig has a 2.1/3.0 parser and address-book page generator. See his site at <ulink url="http://vcardphp.sourceforge.net/">vcardphp.sf.net</ulink>. </para> <para> Kai Blankenhorn has a 2.1 card generator (not a parser). See his work at <ulink url="http://www.bitfolge.de/?s=phpvcard">www.bitfolge.de/?s=phpvcard</ulink>. </para> <para> Flaimo has a vCard generator, too, at <ulink url="http://flaimo.com/php_scripts.php">flaimo.com/php_scripts.php</ulink> (scroll down past the iCalendar stuff). </para> <para> HORDE has a vCard data element in their application framework, but I don't quite see how to use it outside that framework. The doc pages for it are at <ulink url="http://dev.horde.org/api/horde/dev-doxygen/html/classData__vcard.html">http://dev.horde.org/api/horde/dev-doxygen/html/classData__vcard.html</ulink> . </para> <para> Of course, you can always search for more vCard stuff under PHP, too: <ulink url="http://www.google.com/search?q=vcard+php">http://www.google.com/search?q=vcard+php</ulink>. </para> </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/contact-vcard-build/usage.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/contact-vcard-build/usage.xml +++ peardoc/en/package/fileformats/contact-vcard-build/usage.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <refentry id="package.fileformats.contact-vcard-build.usage"> <refnamediv> <refname>Usage</refname> <refpurpose> How to use Contact_VCard_Build </refpurpose> </refnamediv> <refsect1 id="package.fileformats.contact-vcard-build.usage.desc"> <title>Description</title> <para> The basic use of <classname>Contact_Vcard_Build</classname> is straightforward: instantiate a builder object, add values and parameters, then fetch the resulting vCard. </para> </refsect1> <refsect1 id="package.fileformats.contact-vcard-build.usage.instantiation"> <title>Instantiation</title> <para> To create an instance of a <classname>Contact_Vcard_Build</classname> ("builder") object, include the class file and issue a new directive: </para> <programlisting role="php"><![CDATA[ <?php require_once 'Contact_Vcard_Build.php'; $vcard =& new Contact_Vcard_Build(); ?> ]]></programlisting> <para> By default, this creates a builder object that will allow you to fetch a version 3.0 vCard. If you want to build a version 2.1 vCard, pass '<literal>2.1</literal>' as the only constructor argument: </para> <programlisting role="php"><![CDATA[ <?php $vcard =& new Contact_Vcard_Build('2.1'); ?> ]]></programlisting> </refsect1> <refsect1 id="package.fileformats.contact-vcard-build.usage.setcomponent"> <title>How To Set A Component Value</title> <para> There are two ways to set the value of a component: use the method specifically for the component you want to add, or use the generic <function>setValue</function> and <function>addValue</function> methods. While the generic methods allow you direct control over every individual component, iteration, structured part, and value repetition, the component-specific methods are often easier to use. </para> <note> <para> You must set the <literal>FN</literal> (formatted name) and <literal>N</literal> (personal name) components; these are required by both 2.1 and 3.0 version vCards. </para> </note> <para> For example, if you want to add two <literal>ADR</literal> components to the vCard, you can do it with the ADR-specific method... </para> <programlisting role="php"><![CDATA[ <?php // add first address iteration $vcard->addAddress($pobox0, $extend0, $street0, $city0, $state0, $zip0, $country0); // add second address iteration $vcard->addAddress($pobox1, $extend1, $street1, $city1, $state1, $zip1, $country1); ?> ]]></programlisting> <para> ...or you can use the generic methods: </para> <programlisting role="php"><![CDATA[ <?php // add first address (iteration = 0) $vcard->addValue('ADR', 0, VCARD_ADR_POB, $pobox0); $vcard->addValue('ADR', 0, VCARD_ADR_EXTEND, $extend0); $vcard->addValue('ADR', 0, VCARD_ADR_STREET, $street0); $vcard->addValue('ADR', 0, VCARD_ADR_LOCALITY, $city0); $vcard->addValue('ADR', 0, VCARD_ADR_REGION, $state0); $vcard->addValue('ADR', 0, VCARD_ADR_POSTCODE, $zip0); $vcard->addValue('ADR', 0, VCARD_ADR_COUNTRY, $country0); // add second address (iteration = 1) $vcard->addValue('ADR', 1, VCARD_ADR_POB, $pobox1); $vcard->addValue('ADR', 1, VCARD_ADR_EXTEND, $extend1); $vcard->addValue('ADR', 1, VCARD_ADR_STREET, $street1); $vcard->addValue('ADR', 1, VCARD_ADR_LOCALITY, $city1); $vcard->addValue('ADR', 1, VCARD_ADR_REGION, $state1); $vcard->addValue('ADR', 1, VCARD_ADR_POSTCODE, $zip1); $vcard->addValue('ADR', 1, VCARD_ADR_COUNTRY, $country1); ?> ]]></programlisting> <para> Please see the <filename>Contact_Vcard_Build.php</filename> inline comments for descriptions of how to use each component-specific method. </para> </refsect1> <refsect1 id="package.fileformats.contact-vcard-build.usage.setparameter"> <title>How To Set A Parameter Value</title> <para> There is only one way to add a parameter: use the <function>addParam</function> method. Unlike with adding values, there are no component-specifc methods to add parameters. </para> <para> In general, you should add the parameters of a component immediately after you add the complete value of a component, because the builder object keeps track of what was the last component value added. (This is why there are no component-specific add-parameter methods.) </para> <para> For example, we can set the params for the <literal>ADR</literal> components as in the above code: </para> <programlisting role="php"><![CDATA[ <?php // add first address iteration $vcard->addAddress($pobox0, $extend0, $street0, $city0, $state0, $zip0, $country0); // add parameters to the first address $vcard->addParam('TYPE', 'HOME'); $vcard->addParam('TYPE', 'PREF'); // add second address iteration $vcard->addAddress($pobox1, $extend1, $street1, $city1, $state1, $zip1, $country1); // add parameters to the second address $vcard->addParam('TYPE', 'WORK'); ?> ]]></programlisting> <para> Thus, the first address will have <literal>TYPE=HOME,PREF</literal> and the second will have <literal>TYPE=WORK</literal> as their parameters. </para> <para> Alternatively, you can add parameters directly using the same <function>addParam</function> method, with some additional arguments: </para> <programlisting role="php"><![CDATA[ <?php // add parameters to the first address iteration // (component = ADR, iteration = 0) $vcard->addParam('TYPE', 'HOME', 'ADR', 0); $vcard->addParam('TYPE', 'PREF', 'ADR', 0); // add parameters to the second address iteration // (component = ADR, iteration = 1) $vcard->addParam('TYPE', 'WORK', 'ADR', 1); ?> ]]></programlisting> <para> This does the same thing as the earlier <function>addParam</function> code. </para> <note> <para> Although the version 2.1 specification optionally allows parameter values to be indicated without without specified types (i.e, "<literal>HOME</literal>" instead of "<literal>TYPE=HOME</literal>") the <classname>Contact_Vcard_Build</classname> class is not so lenient. With Contact_Vcard_Builder, you must set both the parameter kind and parameter value. </para> </note> </refsect1> <refsect1 id="package.fileformats.contact-vcard-build.usage.fetch"> <title>How To Fetch A vCard</title> <para> After you have added all the values and parameters that you want, you get back the vCard using the <function >fetch</function> method. This will return the components, parameters, and values (including <literal>BEGIN:VCARD</literal> and <literal>END:VCARD</literal>) in proper format for the vCard version. </para> <programlisting role="php"><![CDATA[ <?php $text = $vcard->fetch(); ?> ]]></programlisting> <note> <para> If you set values and parameters for components that are not part of the selected vCard version, they will not be included in the fetched vCard text. </para> </note> <note> <para> You must have set the <literal>FN</literal> (formatted name) and <literal>N</literal> (personal name) components, or the <function>fetch</function> method will return a <classname>PEAR_Error</classname> object. The <literal>FN</literal> and <literal>N</literal> components are required by both 2.1 and 3.0 version vCards. </para> </note> </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/contact-vcard-parse/data.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/contact-vcard-parse/data.xml +++ peardoc/en/package/fileformats/contact-vcard-parse/data.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <refentry id="package.fileformats.contact-vcard-parse.data"> <refnamediv> <refname>How Data Is Returned</refname> <refpurpose> Getting data from the file </refpurpose> </refnamediv> <refsect1 id="package.fileformats.contact-vcard-parse.data.desc"> <title>Description</title> <para> <classname>Contact_Vcard_Parse</classname> reads a file or block of text for vCard data, then converts that data into a series of nested arrays. I used to present a detailed prose explanation of the array, but I think it's easier to just give a generic outline of the array: </para> <screen><![CDATA[ $parse_result = array ( [int_cardnumber] => array ( [string_datatype] => array ( ["param"] => array ( [string_paramname] => array ( [int_repetitionnumber] => string_paramtext ) ) ["value"] => array ( [int_partnumber] => array ( [int_repetitionnumber] => string_valuetext ) ) ) ) ) ]]></screen> <para> By way of example, let's take a look at the vCard of my friend Bolivar Shagnasty. </para> <screen><![CDATA[ BEGIN:VCARD VERSION:3.0 N:Shagnasty;Bolivar;Odysseus;Mr.;III,B.S. FN:Bolivar Shagnasty ADR;TYPE=HOME,WORK:;;123 Main,Apartment 101;Beverly Hills;CA;90210 EMAIL;TYPE=HOME;TYPE=WORK:boshag@example.com EMAIL;TYPE=PREF:boshag@ciaweb.net END:VCARD ]]></screen> <para> This is a pretty simple vCard: my buddy Bolivar's name, one address (looks like Bolivar works from home), two email addresses (one for work and home, and one as his "preferred" address). This simple vCard, when it gets parsed, looks like this: </para> <screen><![CDATA[ ( [0] => Array ( [VERSION] => Array ( [0] => Array ( [param] => Array ( ) [value] => Array ( [0] => Array ( [0] => 3.0 ) ) ) ) [N] => Array ( [0] => Array ( [param] => Array ( ) [value] => Array ( [0] => Array // family ( [0] => Shagnasty ) [1] => Array // first ( [0] => Bolivar ) [2] => Array // additional or middle ( [0] => Odysseus ) [3] => Array // honorifix prefix ( [0] => Mr. ) [4] => Array // honorifix suffix ( [0] => III [1] => B.S. ) ) ) ) [FN] => Array ( [0] => Array ( [param] => Array ( ) [value] => Array ( [0] => Array ( [0] => Bolivar Shagnasty ) ) ) ) [ADR] => Array ( [0] => Array ( [param] => Array ( [TYPE] => Array ( [0] => HOME [1] => WORK ) ) [value] => Array ( [0] => Array // p.o. box ( [0] => ) [1] => Array // extended ( [0] => ) [2] => Array // street ( [0] => 123 Main [1] => Apartment 101 ) [3] => Array // locality or city ( [0] => Beverly Hills ) [4] => Array // region, state, or province ( [0] => CA ) [5] => Array // postal code ( [0] => 90210 ) [6] => Array // country ( [0] => ) ) ) ) [EMAIL] => Array ( [0] => Array ( [param] => Array ( [TYPE] => Array ( [0] => HOME [1] => WORK ) ) [value] => Array ( [0] => Array ( [0] => boshag@example.com ) ) ) [1] => Array ( [param] => Array ( [TYPE] => Array ( [0] => PREF ) ) [value] => Array ( [0] => Array ( [0] => boshag@ciaweb.net ) ) ) ) ) ) ]]></screen> <para> Sweet Jebus! That's an ugly mess. But it retains every bit of info about the vCard so you can do what you like with it. It keeps (separately) every element and component so you can see the underlying structure of the vCard. </para> <para> Yes, I know it's a deeply-nested array set, and is ugly and probably inefficient. The problem (or genius?) of the vCard format is that just about every part of a vCard element can have multiple values. While this makes the vCard format very flexible, it makes it a little difficult to parse and interpret in a simple fashion. The easiest way I could think of was a series of nested arrays. An object-oriented approach might be better, but even then you're going to have nested objects or nested arrays within the vCard object to represent multiple values of a vCard data element. </para> </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/fileformats/contact-vcard-parse/knownissues.xml?view=markup&rev=1.1 Index: peardoc/en/package/fileformats/contact-vcard-parse/knownissues.xml +++ peardoc/en/package/fileformats/contact-vcard-parse/knownissues.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <refentry id="package.fileformats.contact-vcard-parse.knownissues"> <refnamediv> <refname>Known issues</refname> <refpurpose> Problems you might encounter </refpurpose> </refnamediv> <refsect1 id="package.fileformats.contact-vcard-parse.knownissues.desc"> <title>Description</title> <para> When I wrote this parser, my primary goal was to be able to read vCard files produced by the Mac OS X Address Book application. However, it looks like Address Book puts some weird character after every single text character in the output, in addition to some weird line endings. If you want to use <filename>.vcf</filename> files generated by the Mac OS X Address Book, you might need to massage the file in BBEdit or TextWrangler first; turn on "show invisibles" to see the offending characters, then do a search-and-replace to delete them all at once (or perhaps "Zap Gremlins"). </para> <para> UPDATE: David Weingart writes, <quote>That's probably Unicode. In my extremely limited testing, it looks like in some cases you get plain vanilla ISO Latin 1, but if there are any high ascii characters in the entry, they export UTF 16 (double-byte) Unicode.</quote> Thanks, David. (<classname>Contact_Vcard_Parse</classname> does not do Unicode at this time.) </para> <para> <classname>Contact_Vcard_Parse</classname> does not validate the information or formatting in the vCard (although it does decode quoted-printable text). In the spirit of "be lenient in what you accept and strict in what you produce", <classname>Contact_Vcard_Parse</classname> should be able to read just about anything from a vCard file, but it's up to you as the programmer to make sense of the data. </para> <para> Contact_Vcard_Parse should work on file with any kind of line endings (Mac \r, Unix \n, and DOS \r\n) automatically. It also unfolds lines automatically, so data elements spread across multiple lines should come through OK. </para> <para> If you discover a new bug or want to contribute code to <classname>Contact_Vcard_Parse</classname>, contact Paul M. Jones at <ulink url="mailto:pjones@ciaweb.net">pjones at ciaweb dot net</ulink>; the subject line should start with <literal>[VCARD]</literal>. </para> </refsect1> </refentry>
« previous php.pear.doc (#8752) next »