Welcome to Bruces Wiki on Thu 09 of Sep, 2010 [16:55 UTC]

Tiki Wiki XFN Plugin

print

Extending TikiWiki


My first try at a TikiWiki Plugin. This plugin used to create an anchor that contains the XFN Microformat.


XFN Plugin

<?php

/*
*
* XFN plugin. Create an XFN Microformated anchor
*
* Syntax:
*
* {XFN(href=>uri,rel=>relation)}text{XFN}
*
* relationship category XFN values
* friendship (at most one): friend acquaintance contact
* physical: met
* professional: co-worker colleague
* geographical (at most one): co-resident neighbor
* family (at most one): child parent sibling spouse kin
* romantic: muse crush date sweetheart
* identity: me
*
*/

function wikiplugin_xfm_help() {
return tra("Create an XFN Microformated anchor").":~np~{XFN(href=>uri,rel=>relation)}".tra("text")."{XFN}~/np~";
}

function wikiplugin_xfn($data,$params) {
$no_rel = "";
$no_href = "";
$ret = "";
extract($params, EXTR_SKIP);

if(!isset($href)) {
$no_href = ("<li>missing <var>href</var> parameter for plugin</li>\n");
}

if(!isset($rel)) {
$no_rel = ("<li>missing <var>rel</var> parameter for plugin</li>\n");
}

if(!isset($href) || !isset($rel)) {
$ret = "<h3>XFN wikiplugin errors</h3>\n";
$ret .= "<ol class='wikiplugin-xfn-errors'>" . $no_href . $no_rel . "</ol>\n";
} else {
$ret = "<a href='$href' rel='$rel' >$data</a>";
}

return $ret;
}

?>

Created by: admin last modification: Saturday 29 of March, 2008 [05:07:12 UTC] by admin


Login
 
Powered by Tikiwiki the ultimate CMS engine.