You are here

README.txt in Extensible BBCode 5

Same filename and directory in other branches
  1. 8 README.txt
  2. 8.2 README.txt
  3. 6 README.txt
  4. 7 README.txt
Here's a brief description of the API hook that XBBCode provides. It will eventually become a proper
documentation page.

To provide custom BBCode tags, your module should implement a function similar to this:

---------

function hook_xbbcode($op,$delta=NULL,$tag=NULL) 
{
  switch($op) 
  {
  case 'list': return array('i','url','wordcount');
  case 'info':
    switch($delta)
    {
      case 'i': return array('replacewith'=>'<em>{content}</em>');
      case 'url': return array('replacewith'=>l('{content}','{option}'));
      case 'wordcount': return array('dynamic'=>'true');
    )
    return array();
  case 'render': 
    switch ($delta) 
    {
      case 'wordcount':
      return $tag-content . "<hr />".str_word_count($tag->content) . " words.";
    }
    return $tag->content;
  }
}

File

README.txt
View source
  1. Here's a brief description of the API hook that XBBCode provides. It will eventually become a proper
  2. documentation page.
  3. To provide custom BBCode tags, your module should implement a function similar to this:
  4. ---------
  5. function hook_xbbcode($op,$delta=NULL,$tag=NULL)
  6. {
  7. switch($op)
  8. {
  9. case 'list': return array('i','url','wordcount');
  10. case 'info':
  11. switch($delta)
  12. {
  13. case 'i': return array('replacewith'=>'{content}');
  14. case 'url': return array('replacewith'=>l('{content}','{option}'));
  15. case 'wordcount': return array('dynamic'=>'true');
  16. )
  17. return array();
  18. case 'render':
  19. switch ($delta)
  20. {
  21. case 'wordcount':
  22. return $tag-content . "
    ".str_word_count($tag->content) . " words.";
  23. }
  24. return $tag->content;
  25. }
  26. }