====== vCard Plugin ====== ---- plugin ---- description: Creates vCards/hCards that can be downloaded and added to your addressbook author : Esther Brunner email : wikidesign@gmail.com type : syntax lastupdate : compatible : depends : folded conflicts : similar : tags : vcard, address, hcard, users downloadurl: http://tomas.valenta.cz/dokuwiki/vcard-plugin.zip ---- By [[esther@kaffeehaus.ch|Esther Brunner]] Updated version by [[tomas@trustica.cz|Tomáš Valenta]] [[vcard#updated version|below]] Rewritten version by [[bruno@defraine.net|Bruno De Fraine]] [[vcard#rewritten version|further below]] Updated version by [[jaloma.ac@googlemail.de|Jürgen A.Lamers]] [[vcard#Doing hCard|further further below]] ===== Description ===== This [[plugins|plugin]] lets you create vCard files on the fly in your wiki, which other users can download and add to their addressbook. With the [[folded]] plugin installed, you can unfold information about the person right in your wiki. The vCard plugin uses the vCard PHP class by [[kaib@bitfolge.de|Kai Blankenhorn]]. The output the plugin will produce looks like this: {{http://qwik.kaffeehaus.ch/_media/dokuwiki/vcard.png}} {{http://qwik.kaffeehaus.ch/_media/dokuwiki/full_vcard.png}} ===== Usage ===== Example: {{vcard>[organisation] Full Name http://www.host.com 1976-05-03 # +41 43 534 0462 | Street Nr., ZIP City, Country}} All information besides the name is optional. Here are the parameters: - Name: space delimited words; the first is considered to be the first name, the last to be the last name; everything in between will be middle / additional name. - E-Mail: enclosed in < and > signs. - Website: only http is recognized. - Birthday: in format yyyy-mm-dd. - Phone Number(s): after a # sign; multiple numbers are delimited by an & sign; the first is considered as home phone, the second as cell phone, the third as work phone and the fourth as fax number. - Address: after a | sign; comma delimited with first street, then zip-code and city and finally country. You can see the plugin in action [[http://qwik.kaffeehaus.ch/playground|here]]. ===== Installation ===== - [[http://tomas.valenta.cz/dokuwiki/vcard-plugin.zip|Download the plugin from here]]. - Unzip the archive and put the files into ''/lib/plugins/vcard/''. ===== To Do ===== * There are some encoding problems with converting the vCard to quoted-printable and Apple Addressbook doesn't recognize UTF-8. ===== Updated version ===== Tested with DokuWiki 2006-11-06 on Debian/GNU Linux. ==== Preview ==== {{http://tomas.valenta.cz/dokuwiki/vcard-example.png|vCard plugin example}} ==== Usage ==== {{vcard>[Kriminálka] Kapitán Dastych http://www.dastych.cz 1997-2-11 # work & mobile & home & fax | Protiprávní 12, 11000 Praha, Czech replublic }} **Fields in first part (before #)** * [company] - company name * name - first name, middle name //optional// and surname * - email address * http://address.xy - website, must not have http prefix * yyyy-mm-dd - birthday **Second part (between # and |) are numbers separated by & in order** * work number * cell phone number (mobile phone) * home number * fax number **Third part is address; there are three field separated by commas** * street address * zip and city separated by space * country ==== Installation ==== Install with plugin manager: [[http://tomas.valenta.cz/dokuwiki/vcard-plugin.zip|vcard-plugin.zip]] ==== Changelog ==== === 2007-05-16 Changes from original === * mailguarding does not work, removed * fixed folding * fixed filename generation, space replaced with dash (-) * added company name support * reordered phone numbers * reordered folded details rendering ==== Recommended bugfix ==== In "syntax.php" lines 180-182 should be changed, in order to function with the recent version of plugin:folded $renderer->doc .= ''; $renderer->doc .= ''; $renderer->doc .= ' regards, GA, 2009-05-22 ===== Rewritten version ===== As an alternative to the //ad hoc// approach of the above versions, the vcard plugin was rewritten without hardcoding any vCard field names or field structures (so without Kai's PHP class). The idea is that you write the vcard record directly between '''' tags, but in a much nicer syntax. This allows you to put any (text-based) properties in the vCard. Main drawback: plain HTML presentation of the same data is no longer possible (fold or no fold). ==== Usage ==== N: Gates, William, Henry, , III Nickname: Bill Org: Microsoft Title: Co-founder Email, Internet, Work: billg@microsoft.com Adr, Work: , , 1 Microsoft Way, Redmond, Washington, 98052, United States Tel, Work: +1 425-882-8080 # General Microsoft number # Comments like these are not included in the vCard Bday: 1955-10-28 URL: http://www.microsoft.com/presspass/exec/billg/ For more fields, check the [[http://www.imc.org/pdi/vcard-21.txt|vCard specification]]. ==== Features ==== * Checksum to prevent cross-site scripting (configure ''$conf['plugin']['vcard']['secret']'' to some secret string) * UTF8 encoding of extended characters seems to work (tested with Mac OS X Address Book) ==== Download ==== SVN repository: [[http://ssel.vub.ac.be/svn-pub/dokuwiki/ssel/2007-06-26b/lib/plugins/vcard/]] ===== Discussion ===== ==== 'folding/unfolding' of the vcard doesn't work. ==== To make it work, replace line 160 of syntax.php: $renderer->doc .= ''; by the following: $renderer->doc .= ''; (the folded plugin's fold function automatically adds the string ''folded_'' to the second parameter). ==== syntax.php error ==== I'm running a slightly older version of PHP than is recommended (4.3.8), but this plugin doesn't work for me. When I paste in the above vcard example, I get the following error: ''Fatal error: Call to a member function on a non-object in /var/www/html/dokuwiki/lib/plugins/vcard/syntax.php on line 193'' It only works if I comment out line 193 of ''syntax.php'' --- //Aaron Hathaway 2006/02/07 10:48// ==== Note/Question regarding Filename & File Suffix ==== Hi, just installed the plugin. I realized two things , don't know if i would call them bugs: - If you click the vcard link the file which gets saved is only the firstname, not firstname_lastname as i think it should be. - There is no suffix @ the end of the filename. As far as I know, the standard suffix for vCards is ".vcf" Makes it easier for Applications. Is it possible to change it so that the resulting overall filename: is ? That would be great. - Michael (keep up the good work , you create great plugins!) - Is there a way to add job title? - Tom ==== folding/unfolding' of the vcard doesn't work again ==== Replace the if ( @file_exists(DOKU_INC.'lib/plugins/folded/closed.gif') && ($folded) ){ ... whatever is in here } with: if ( @file_exists(DOKU_INC.'lib/plugins/folded/closed.gif') && ($folded) ){ // folded plugin is installed: enables additional feature $renderer->doc .= ''; $renderer->doc .= ''; } Cheers, --- //[[primoz.verdnik@gmail.com|Drye Kindrew]] 2007-01-26 10:22// ---- It's not working for me with Dokuwiki 2008-05-05. The problem seems to be that ''span#folded_reveal'' and ''span#folded_hide'' are not found by the JavaScript from the folded plugin. This leads to the unfolding links not being initialized. A solution to this is to add the following lines to the end of ''function handle()'' in ''vcard/syntax.php'', just before the return call: } else { $first = $match; $middle = NULL; $last = NULL; } // snip if ($my =& plugin_load('syntax', 'folded_span')) { $handler->status['plugin_folded'] = true; if (!$this->register_hook) { global $EVENT_HANDLER; $EVENT_HANDLER->register_hook('PARSER_HANDLER_DONE','BEFORE', $my, 'add_writestrings'); $this->register_hook = true; } } // snip return array($first,$middle,$last,$email,$website,$birthday,$phones,trim($street),$zip,$city,trim($country),$company); They are taken from ''folded/syntax/span.php'' and make sure that the ''span''s mentioned above are added. Hope it helps, --- //[[georgsorst@gmx.de|Georg Sorst]] 2008-03-12 22:06// ==== Adding hCard ==== It would be neat if you added [[http://microformats.org/wiki/hcard|hCard]] to this plugin. It ought to be quite easy. (I might have a look at it in a while, if I can find the time for it...) -- //Wilhelm Raab// ===== Doing hCard ===== Well, I spent a little time to implement the hCard-Feature and update the **folded**-Feature (or Bug!?!). You can configure the feature to build the hCard-Tags and add an extra Buttons for EMail. If you do not configure the hCard-Feature, it should work like the //[[vcard#updated version|Kapitán Dastych]]//-Version. ==== Installation ==== - [[http://jaloma.ac.googlepages.com/h_vcard_0.0.1.zip|Download the plugin from here]]. - Unzip the archive and put the files into ''/lib/plugins/vcard/''. Better way: Install with plugin manager: [[http://jaloma.ac.googlepages.com/h_vcard_0.0.1.zip|http://jaloma.ac.googlepages.com/h_vcard.zip]] === Bugs === Well, i get some differences between the export with the vcard-export-url and the Firefox-Extension ''operator''. Some time i will fix this... === Hints === * Using the hCard-Feature, you can not change the text ''work'', ''home'' etc. to your desired language. * Test your tag-Environment... cause 'span-div-p' sequence maybe has some curious result to your layout. -- //Jürgen A.Lamers// 2008/01/18