/usr/portage

bbcode.class.php - An advanced implementation of bbCode 2

Today I implemented a class for bbCode. I was too frustrated about the current state of such implementations and as a result I began to code one by myself. Currently it’s completely working and I can suggest using it.

<strong>The features:</strong><ul><li>Define new tags in a smart way</li>
<li>All semantic XHTML-tags are implemented</li>
<li>XHTML 1.1 ready</li>
<li>Adding tag-definitions without editing the class (e.g. from a database table)</li>
<li>PHP 5.x compatible <strong>and:</strong> PHP 4.x and lower incompatible</li>
<li>Licensed under GPL</li>
<li>Mostly compatible with the existing implementations</li>
<li>[img] provides an alignment attribute</li>
</ul>

<strong>Disadvantages:</strong><ul><li>Completely undocumented</li></ul>

<strong>Todo:</strong><ul><li>Get rid of the FIXME’s</li><li>Comment it, comment it, comment it</li><li>Implement <em>rel=”“</em>-attribute</li><li>Implement [nobbcode]-tag to make sure that it is possible to have a post like this in bbcode</li></ul>

Patches are always welcome, feel free to propose some suggestions to make it better.

<strong>How to use:</strong>
<pre class=“ng_code”>$string = ‘A strong word makes sense.
Do you want to help me finding the missing link?‘;
$bbcode = new bbCode ( $string );
echo $bbcode->Out ();</pre>

Displaying a HTML-formated help:
<pre class=“ng_code”>$bbcode = new bbCode;
$bbcode = Help ();</pre>

<a href=“https://www.schokokeks.org/~lars/testbed/classed/bbcode/bbcode.class.phps”>Enjoy bbcode.class.php!</a>

Filed under & two comments & one trackback

Trackbacks

Trackback specific URI for this entry

No Trackbacks

Comments

  1. Tres says:
    published on October 2nd 2005, 07:56:00 pm *

    Your class looks great. I tried it on my site, I’m running PHP 4.4. However, I received the following error…

    Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /home/telcon/public_html/cms/classes/bbcode.php on line 35

    Reply

  2. Bernd returns:
    published on October 2nd 2005, 08:13:47 pm *

    Look what’s written up there:

    > PHP 5.x compatible and: PHP 4.x and lower incompatible

    So if you’re running PHP 4.4, this code will not run. PHP 5 has completely new object-orientated possibilities that were used in this class. No chance to get this running on PHP 4.x without rewriting half of it! :)

    Reply

Add a Comment & let me know what you think