HTML_BBCodeParser
[ class tree: HTML_BBCodeParser ] [ index: HTML_BBCodeParser ] [ all elements ]

File: BBCodeParser.php

Source Location: /HTML_BBCodeParser-1.2.4/HTML/BBCodeParser.php

Page Details:

  • Author:

    Stijn de Reede <sjr@gmx.co.uk>

    This is a parser to replace UBB style tags with their html equivalents. It does not simply do some regex calls, but is complete stack based parse engine. This ensures that all tags are properly nested, if not, extra tags are added to maintain the nesting. This parser should only produce xhtml 1.0 compliant code. All tags are validated and so are all their attributes. It should be easy to extend this parser with your own tags, see the _definedTags format description below.

    Usage: $parser = new HTML_BBCodeParser(); $parser->setText('normal [b]bold[/b] and normal again'); $parser->parse(); echo $parser->getParsed(); or: $parser = new HTML_BBCodeParser(); echo $parser->qparse('normal [b]bold[/b] and normal again'); or: echo HTML_BBCodeParser::staticQparse('normal [b]bold[/b] and normal again');

    Setting the options from the ini file: $config = parse_ini_file('BBCodeParser.ini', true); $options = &PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); $options = $config['HTML_BBCodeParser']; unset($options);

    The _definedTags variables should be in this format: array('tag' // the actual tag used => array('htmlopen' => 'open', // the opening tag in html 'htmlclose' => 'close', // the closing tag in html, can be set to an empty string if no closing tag is present in html (like <img>) 'allowed' => 'allow', // tags that are allowed inside this tag. Values can be all or none, or either of these two, followed by a ^ and then followed by a comma seperated list of exceptions on this 'attributes' => array() // an associative array containing the tag attributes and their printf() html equivalents, to which the first argument is the value, and the second is the quote. Default would be something like this: 'attr' => 'attr=%2$s%1$s%2$s' ), 'etc' => (...) )

  • Filesource: Source Code for this file

Includes:

require_once('PEAR.php') [line 81]

Documentation generated on Tue, 23 Oct 2012 22:30:02 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.