I. Introduction
[ Next: B. Why BBCode? ]
A. Overview
The New BBCode Parser
Version 1.4.5
Copyright © 2008-10, the Phantom Inker. All rights reserved.
The New BBCode Parser (NBBC) is a fully-validating, high-speed, extensible parser
for the BBCode document language, written in PHP, compatible with PHP 4.0.5+ and PHP 5.
It converts BBCode input into HTML output, and can guarantee that the output will be
fully conformant to the XHTML 1.0 Strict standard no matter how badly-mangled the BBCode
input is.
What is BBCode? BBCode is a document-formatting language, similar to HTML,
only designed to be much simpler to use. BBCode was popularized by various forum and
bulletin-board services throughout the late 1990s and early 2000s, and is now a
de-facto standard; however, most BBCode parsers, which convert that BBCode into
displayable HTML, are non-validating, meaning that they do not guarantee that their
output will necessarily be "good" HTML. Some are so over-simplified that
they are vulnerable to a number of security attacks. NBBC is designed to be an easy
drop-in replacement for most existing BBCode parsers, and is designed to be both
validating and secure.
NBBC comes built-in with a number of useful features:
- Output is always XHTML 1.0 Strict conformant.
- Output is protected against many common user-input attacks, such as XSS attacks.
- Smileys, such as :-), are converted into <img> tags,
and a large library of common smiley images is included.
- Includes a library supporting all the standard BBCode codes found on most
popular bulletin boards and web forums.
- Supports "wiki links," which can be an easy way for users to reference wiki
pages on your site if you also have a wiki installed.
- The list of codes is fully extensible; you can add and remove codes at any time.
- Tightly encapsulated in classes and doesn't pollute the global namespace,
so it's easy to drop into existing environments.
- The entire parser consists of only four files, only one of which you ever need
to include directly, which also makes it easy to drop into existing environments.
- The standard library includes support for not only extremely common tags like [b]
and [i], but also supports nearly all the tags found on most major forums and
bulletin boards: [center], [list], [code], and [quote], among others, with all
their various flags and parameters.
- Best of all, it's free! NBBC is covered under the
New BSD Open-Source License,
so it can be used anywhere, anywhen, in any project, for any reason.
[ Next: B. Why BBCode? ]
Copyright © 2010, the Phantom Inker. All rights reserved.