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

Class: HTML_BBCodeParser2_Filter_Images

Source Location: /HTML_BBCodeParser2-0.1.0/HTML/BBCodeParser2/Filter/Images.php

Class Overview

HTML_BBCodeParser2
   |
   --HTML_BBCodeParser2_Filter
      |
      --HTML_BBCodeParser2_Filter_Images

Dummy class that filters need to extend from.


Author(s):

  • Stijn de Reede <sjr at 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_BBCodeParser2($options = array(...)); $parser->setText('normal [b]bold[/b] and normal again'); $parser->parse(); echo $parser->getParsed(); or: $parser = new HTML_BBCodeParser2($options = array(...)); echo $parser->qparse('normal [b]bold[/b] and normal again'); or: echo HTML_BBCodeParser2::staticQparse('normal [b]bold[/b] and normal again');

    Setting the options from the ini file: $config = parse_ini_file('BBCodeParser.ini', true); $options = $config['HTML_BBCodeParser2'];

    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' => (...) )


Inherited Variables

Inherited Methods

Class: HTML_BBCodeParser2

HTML_BBCodeParser2::__construct()
Constructor, initialises the options and filters
HTML_BBCodeParser2::addFilter()
Add a new filter
HTML_BBCodeParser2::addFilters()
Add new filters
HTML_BBCodeParser2::getParsed()
Gets the parsed text from the object
HTML_BBCodeParser2::getPreparsed()
Gets the preparsed text from the object
HTML_BBCodeParser2::getText()
Gets the unparsed text from the object
HTML_BBCodeParser2::parse()
Parses the text set in the object
HTML_BBCodeParser2::qparse()
Quick method to do setText(), parse() and getParsed at once
HTML_BBCodeParser2::removeFilter()
Remove an existing filter
HTML_BBCodeParser2::setOption()
Option setter
HTML_BBCodeParser2::setText()
Sets text in the object to be parsed
HTML_BBCodeParser2::staticQparse()
Quick static method to do setText(), parse() and getParsed at once

Class Details

[line 28]
Dummy class that filters need to extend from.
  • 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_BBCodeParser2($options = array(...)); $parser->setText('normal [b]bold[/b] and normal again'); $parser->parse(); echo $parser->getParsed(); or: $parser = new HTML_BBCodeParser2($options = array(...)); echo $parser->qparse('normal [b]bold[/b] and normal again'); or: echo HTML_BBCodeParser2::staticQparse('normal [b]bold[/b] and normal again');

    Setting the options from the ini file: $config = parse_ini_file('BBCodeParser.ini', true); $options = $config['HTML_BBCodeParser2'];

    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' => (...) )



[ Top ]


Documentation generated on Sat, 03 Nov 2012 14:30:03 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.