Docs For Class StringParser_BBCode

## StringParser_BBCode

Description

BB code string parser class

Located in /stringparser_bbcode.class.php (line 55)

    StringParser
       |
       --StringParser_BBCode

Variable Summary
bool $_caseSensitive
array $_codes
array $_maxOccurrences
bool $_mixedAttributeTypes
bool $_noOutput
array $_paragraphHandling
int $_parserMode
array $_parsers
string $_rootContentType
bool $_rootParagraphHandling
bool $_validateAgain
Method Summary
bool addCode (string $name, string $callback_type, string $callback_func, array $callback_params, string $content_type, array $allowed_within, array $not_allowed_within)
bool addParser (string $type, mixed $parser)
bool getCodeFlag (string $name, string $flag, [string $type = 'mixed'], [mixed $default = null])
bool globalCaseSensitive ()
bool mixedAttributeTypes ()
void removeAllCodes ()
bool removeCode ($name $name)
bool setCodeFlag (string $name, string $flag, mixed $value)
void setGlobalCaseSensitive (bool $caseSensitive)
bool setMaxOccurrences (string $type, int $count)
void setMixedAttributeTypes (bool $mixedAttributeTypes)
bool setOccurrenceType (string $code, string $type)
void setParagraphHandlingParameters (string $detect_string, string $start_tag, string $end_tag)
void setRootContentType (string $content_type)
void setRootParagraphHandling (bool $enabled)
void setValidateAgain (bool $validateAgain)
bool validateAgain ()
bool _appendText (string $text)
void _applyParsers ( $type, $text)
array &_breakupNodeByParagraphs ( &$node, object $node)
void _closeRemainingBlocks ()
mixed &_findNamedNode ( $name, [ $searchdeeper = false])
string _getCanonicalName (string $name)
bool _handleParagraphs ( &$node, object $node)
bool _handleStatus (int $status, string $needle)
bool _hasParagraphAncestor ( &$node, object $node)
bool _isCloseable ( $name, &$closecount)
bool _isOpenable ( $name, &$closecount)
bool _isOpenableWithClose ( $name, &$closecount)
bool _isUseContent ( &$node, [bool $check_attrs = false], object $node)
bool _modifyTree ()
bool _openElement ([ $type = 0])
bool _outputNode ( &$node)
bool _outputTree ()
bool _reparseAfterCurrentBlock ()
void _setStatus ( $status)
bool _validateCloseTags ( $closecount)
Variables
bool $_caseSensitive = true (line 115)

Global setting: case sensitive

- access: protected

array $_codes = array () (line 75)

Defined BB Codes

The registered BB codes

- access: protected

array $_maxOccurrences = array () (line 91)

Defined maximum occurrences

- access: protected

bool $_mixedAttributeTypes = false (line 141)

Allow mixed attribute types (e.g. [code=bla attr=blub])

- access: private

bool $_noOutput = false (line 107)

Do not output but return the tree

- access: protected

array $_paragraphHandling = array (
'detect_string' => "\n\n",
'start_tag' => '<p>',
'end_tag' => "</p>\n"
) (line 130)

Paragraph handling parameters

- access: protected

int $_parserMode = STRINGPARSER_MODE_SEARCH (line 65)

String parser mode

The BBCode string parser works in search mode

- see: STRINGPARSER_MODE_SEARCH, STRINGPARSER_MODE_LOOP
- access: protected

Redefinition of:

StringParser::$_parserMode
  String parser mode

array $_parsers = array () (line 83)

Registered parsers

- access: protected

string $_rootContentType = 'block' (line 99)

Root content type

- access: protected

bool $_rootParagraphHandling = false (line 123)

Root paragraph handling enabled

- access: protected

bool $_validateAgain = false (line 148)

Whether to call validation function again (with $action == 'validate_auto') when closetag comes

- access: protected

#### Inherited Variables

Inherited from StringParser

> StringParser::$strict
> StringParser::$_charactersAllowed
> StringParser::$_charactersSearch
> StringParser::$_cpos
> StringParser::$_length
> StringParser::$_parsing
> StringParser::$_postfilters
> StringParser::$_prefilters
> StringParser::$_recentlyReparsed
> StringParser::$_root
> StringParser::$_stack
> StringParser::$_status
> StringParser::$_text

Methods
addCode (line 163)

Add a code

- access: public

bool addCode (string $name, string $callback_type, string $callback_func, array $callback_params, string $content_type, array $allowed_within, array $not_allowed_within)

- string $name: The name of the code
- string $callback_type: See documentation
- string $callback_func: The callback function to call
- array $callback_params: The callback parameters
- string $content_type: See documentation
- array $allowed_within: See documentation
- array $not_allowed_within: See documentation

addParser (line 267)

Add a parser

- access: public

bool addParser (string $type, mixed $parser)

- string $type: The content type for which the parser is to add
- mixed $parser: The function to call

getCodeFlag (line 400)

Get a code flag

- access: public

bool getCodeFlag (string $name, string $flag, [string $type = 'mixed'], [mixed $default = null])

- string $name: The name of the code
- string $flag: The name of the flag to get
- string $type: The type of the return value
- mixed $default: The default return value

globalCaseSensitive (line 338)

Get global case sensitive flag

- access: public

bool globalCaseSensitive ()
mixedAttributeTypes (line 363)

Get mixed attribute types flag

- access: public

bool mixedAttributeTypes ()
removeAllCodes (line 203)

Remove all codes

- access: public

void removeAllCodes ()
removeCode (line 190)

Remove a code

- access: public

bool removeCode ($name $name)

- $name $name: The code to remove

setCodeFlag (line 216)

Set a code flag

- access: public

bool setCodeFlag (string $name, string $flag, mixed $value)

- string $name: The name of the code
- string $flag: The name of the flag to set
- mixed $value: The value of the flag to set

setGlobalCaseSensitive (line 328)

Set global case sensitive flag

If this is set to true, the class normally is case sensitive, but the case_sensitive code flag may override this for a single code.

If this is set to false, all codes are case insensitive.

- access: public

void setGlobalCaseSensitive (bool $caseSensitive)

- bool $caseSensitive

setMaxOccurrences (line 250)

Set maximum number of occurrences

- access: public

bool setMaxOccurrences (string $type, int $count)

- string $type: The name of the occurrence type
- int $count: The maximum number of occurrences

setMixedAttributeTypes (line 353)

Set mixed attribute types flag

If set, [code=val1 attr=val2] will cause 2 attributes to be parsed: 'default' will have value 'val1', 'attr' will have value 'val2'. If not set, only one attribute 'default' will have the value 'val1 attr=val2' (the default and original behaviour)

- access: public

void setMixedAttributeTypes (bool $mixedAttributeTypes)

- bool $mixedAttributeTypes

setOccurrenceType (line 238)

Set occurrence type

Example: $bbcode->setOccurrenceType ('url', 'link'); $bbcode->setMaxOccurrences ('link', 4); Would create the situation where a link may only occur four times in the hole text.

- access: public

bool setOccurrenceType (string $code, string $type)

- string $code: The name of the code
- string $type: The name of the occurrence type to set

setParagraphHandlingParameters (line 309)

Set paragraph handling parameters

- access: public

void setParagraphHandlingParameters (string $detect_string, string $start_tag, string $end_tag)

- string $detect_string: The string to detect
- string $start_tag: The replacement for the start tag (e.g. <p>)
- string $end_tag: The replacement for the start tag (e.g. </p>)

setRootContentType (line 287)

Set root content type

- access: public

void setRootContentType (string $content_type)

- string $content_type: The new root content type

setRootParagraphHandling (line 297)

Set paragraph handling on root element

- access: public

void setRootParagraphHandling (bool $enabled)

- bool $enabled: The new status of paragraph handling on root element

setValidateAgain (line 376)

Set validate again flag

If this is set to true, the class calls the validation function again with $action == 'validate_again' when closetag comes.

- access: public

void setValidateAgain (bool $validateAgain)

- bool $validateAgain

validateAgain (line 386)

Get validate again flag

- access: public

bool validateAgain ()
_appendText (line 484)

Abstract method Append text depending on current status

- return: On success, the function returns true, else false
- access: protected

bool _appendText (string $text)

- string $text: The text to append

Redefinition of:

StringParser::_appendText()
  Abstract method Append text depending on current status

_applyParsers (line 537)

Apply parsers

void _applyParsers ( $type, $text)

- $type
- $text

_breakupNodeByParagraphs (line 1257)

Break up nodes

- access: protected

array &_breakupNodeByParagraphs ( &$node, object $node)

- object $node: The node to break up
- &$node

_closeRemainingBlocks (line 956)

Abstract method: Close remaining blocks

- access: protected

void _closeRemainingBlocks ()

Redefinition of:

StringParser::_closeRemainingBlocks()
  Abstract method: Close remaining blocks

_findNamedNode (line 983)

Find a node with a specific name in stack

- access: protected

mixed &_findNamedNode ( $name, [ $searchdeeper = false])

- $name
- $searchdeeper

_getCanonicalName (line 1374)

Get canonical name of a code

- access: protected

string _getCanonicalName (string $name)

- string $name

_handleParagraphs (line 1192)

Handle paragraphs

- access: protected

bool _handleParagraphs ( &$node, object $node)

- object $node: The node to handle
- &$node

_handleStatus (line 559)

Handle status

- access: protected

bool _handleStatus (int $status, string $needle)

- int $status: The current status
- string $needle: The needle that was found

Redefinition of:

StringParser::_handleStatus()
  Abstract method: Handle status

_hasParagraphAncestor (line 1240)

Search for a paragraph node in tree in upward direction

- access: protected

bool _hasParagraphAncestor ( &$node, object $node)

- object $node: The node to analyze
- &$node

_isCloseable (line 843)

Is a node closeable?

- access: protected

bool _isCloseable ( $name, &$closecount)

- $name
- &$closecount

_isOpenable (line 885)

Is a node openable?

- access: protected

bool _isOpenable ( $name, &$closecount)

- $name
- &$closecount

_isOpenableWithClose (line 921)

Is a node openable by closing other nodes?

- access: protected

bool _isOpenableWithClose ( $name, &$closecount)

- $name
- &$closecount

_isUseContent (line 1333)

Is this node a usecontent node

- access: protected

bool _isUseContent ( &$node, [bool $check_attrs = false], object $node)

- object $node: The node to check
- bool $check_attrs: Also check whether 'usecontent?'-attributes exist
- &$node

_modifyTree (line 1109)

Abstract method: Manipulate the tree

- access: protected

bool _modifyTree ()

Redefinition of:

StringParser::_modifyTree()
  Abstract method: Manipulate the tree

_openElement (line 772)

Open the next element

- access: protected

bool _openElement ([ $type = 0])

- $type

_outputNode (line 1031)

Output a node

- access: protected

bool _outputNode ( &$node)

- &$node

_outputTree (line 1012)

Abstract method: Output tree

- access: protected

bool _outputTree ()

Redefinition of:

StringParser::_outputTree()
  Abstract method: Output tree

_reparseAfterCurrentBlock (line 517)

Restart parsing after current block

To achieve this the current top stack object is removed from the tree. Then the current item

- access: protected

bool _reparseAfterCurrentBlock ()

Redefinition of:

StringParser::_reparseAfterCurrentBlock()
  Restart parsing after current block

_setStatus (line 418)

Set a specific status

- access: protected

void _setStatus ( $status)

- $status

Redefinition of:

StringParser::_setStatus()
  Abstract method: Set a specific status

_validateCloseTags (line 867)

Revalidate codes when close tags appear

- access: protected

bool _validateCloseTags ( $closecount)

- $closecount

#### Inherited Methods

Inherited From StringParser

> StringParser::StringParser()
> StringParser::addFilter()
> StringParser::clearFilters()
> StringParser::parse()
> StringParser::_appendText()
> StringParser::_appendToLastTextChild()
> StringParser::_applyPostfilters()
> StringParser::_applyPrefilters()
> StringParser::_closeRemainingBlocks()
> StringParser::_handleStatus()
> StringParser::_loop()
> StringParser::_modifyTree()
> StringParser::_outputTree()
> StringParser::_parserInit()
> StringParser::_popNode()
> StringParser::_pushNode()
> StringParser::_reparseAfterCurrentBlock()
> StringParser::_searchLoop()
> StringParser::_setStatus()
> StringParser::_strDetect()
> StringParser::_strpos()
> StringParser::_topNode()
> StringParser::_topNodeVar()

Documentation generated on Mon, 10 Dec 2007 13:30:04 +0100 by phpDocumentor 1.4.0