Creates vCards/hCards that can be downloaded and added to your addressbook
Compatible with DokuWiki
No compatibility info given!
Updated version by Tomáš Valenta below
Rewritten version by Bruno De Fraine further below
Updated version by Jürgen A.Lamers further further below
This 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 Kai Blankenhorn.
The output the plugin will produce looks like this:
Example:
{{vcard>[organisation] Full Name <email@host.com> 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:
You can see the plugin in action here.
/lib/plugins/vcard/.Tested with DokuWiki 2006-11-06 on Debian/GNU Linux.
{{vcard>[Kriminálka] Kapitán Dastych <kapitan@dastych.cz> http://www.dastych.cz 1997-2-11 # work & mobile & home & fax | Protiprávní 12, 11000 Praha, Czech replublic }}
Fields in first part (before #)
Second part (between # and |) are numbers separated by & in order
Third part is address; there are three field separated by commas
Install with plugin manager: vcard-plugin.zip
In “syntax.php” lines 180-182 should be changed, in order to function with the recent version of plugin:folded
$renderer->doc .= '<a class="folder" href="#folded_'.$plugin_folded_count.'">'; $renderer->doc .= '</a>'; $renderer->doc .= '<span class="folded hidden" id="folded_'.$plugin_folded_count.'" >';
regards, GA, 2009-05-22
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 <vcard> 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).
<vcard Bill Gates> 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/ </vcard>
For more fields, check the vCard specification.
$conf['plugin']['vcard']['secret'] to some secret string)To make it work, replace line 160 of syntax.php:
$renderer->doc .= '<a href="#" class="folder" onclick="fold(this, \'folded_'.$plugin_folded_count.'\');">';
by the following:
$renderer->doc .= '<a href="#" class="folder" onclick="fold(this, \'' . $plugin_folded_count . '\');">';
(the folded plugin's fold function automatically adds the string folded_ to the second parameter).
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
Hi, just installed the plugin. I realized two things , don't know if i would call them bugs:
Is it possible to change it so that the resulting overall filename: is <firstname_lastname.vcf> ? That would be great.
- Michael (keep up the good work , you create great plugins!)
- Tom
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 .= '<a href="#folded_'.$plugin_folded_count.'" class="folder"></a>'; $renderer->doc .= '<span class="folded hidden" id="folded_'.$plugin_folded_count.'">'; $renderer->doc .= $folded; $renderer->doc .= '</span>'; }
Cheers, — 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 spans mentioned above are added.
Hope it helps, — Georg Sorst 2008-03-12 22:06
It would be neat if you added 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
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 Kapitán Dastych-Version.
/lib/plugins/vcard/.Better way:
Install with plugin manager: http://jaloma.ac.googlepages.com/h_vcard.zip
Well, i get some differences between the export with the vcard-export-url and the Firefox-Extension operator. Some time i will fix this…
work, home etc. to your desired language.– Jürgen A.Lamers 2008/01/18