addCode (
'acronym', // tag name: this will go between square brackets
'callback_replace', // type of action: we'll use a callback function
'plugin_custombbcode_acronym', // name of the callback function
array('usecontent_param' => array ('default')), // supported parameters: "default" is [acronym=valore]
'inline', // type of the tag, inline or block, etc
array ('listitem', 'block', 'inline', 'link'), // type of elements in which you can use this tag
array ()); // type of elements where this tag CAN'T go (in this case, none, so it can go everywhere)
$bbcode->setCodeFlag ('acronym', 'closetag', BBCODE_CLOSETAG_MUSTEXIST); // a closing tag is mandatory [/tag]
}
// $content is the text between the two tags, i.e. [tag]CONTAINED TEXT[/tag] $content='CONTAINED TEXT'
// $attributes is an associative array where keys are the tag properties. default is the [tagname=value] property
function plugin_custombbcode_acronym($action, $attributes, $content, $params, $node_object) {
if ($action == 'validate') {
// not used for now
return true;
}
// [acronym=css]Cascading Style Sheet[/acronym]
// will become css
return "{$attributes['default']}";
}
?>