Platinum Partner

Ubbcode

a function to convert common used bbcode tags to html... as usually used in message boards and some blog software.

it handles img, email, link, b, u and i tags...

for example

[b]test[/b]
[url=http://blah.com]blah[/url]

will become:

test
blah



function ubbcode($posting) {
	$posting=eregi_replace("\[img\]([^\[]+)\[/img\]","",$posting);
	$posting=eregi_replace("\[email\]([^\[]+)\[/email\]","\\1",$posting);
	$posting=eregi_replace("\[email=([^\[]+)\]([^\[]+)\[/email\]","\\2",$posting);
	$posting=eregi_replace("\[url=([^\[]+)\]([^\[]+)\[/url\]","\\2",$posting);
	$posting=eregi_replace("\[url\]([^\[]+)\[/url\]","\\1",$posting);
    $posting=eregi_replace("\[b\]","",$posting);
    $posting=eregi_replace("\[/b\]","",$posting);
    $posting=eregi_replace("\[u\]","",$posting);
    $posting=eregi_replace("\[/u\]","",$posting);
    $posting=eregi_replace("\[i\]","",$posting);
    $posting=eregi_replace("\[/i\]","",$posting);

    return $posting;
}
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}