StringParser_BBCode class documentation

10. Miscellaneous

10.1 Frequently asked questions

How can I get the class to be case insensitive?

The global flag caseSensitive dictates the behaviour of the whole class. If you set it to false the case will be ignored for all codes:

$bbcode->setGlobalCaseSensitive (false);

If you just want to make a single code case insensitive, you can set the code flag 'case_sensitive' to false. Example for the code [b]:

$bbcode->setCodeFlag ('b', 'case_sensitive', false);

In a callback function, how can I determine if an element is direct descendant of the root element?

The best possibility is to use this condition:

if ($node_object->_parent->type() == STRINGPARSER_NODE_ROOT) {
  // direkt descendant of the root element
} else {
  // indirekt descendant of the root element
}

What meaning does the _id attribute of a node have?
The attribute is only used to check if a node is identical with another node. Every node object posesses the functionequals. $node1->equals ($node2); is true only if both nodes are identical. In no case you may draw any other conclusions from this attribute, especially does the root element not always have the _id 0.

10.1 Useful internals

In this chapter useful things about internals of the class are to be documented. At the moment it is still a very large construction site.

One can cause the class to not reconvert the tree structure but instead return a reference to the root element. To achieve this set the _noOutput variable of the class:

$bbcode->_noOutput = true;