<?php
include "BBCode.class.php";
$bbtext = <<<BBTEXT
[b]bold[/b]
[i]italic[/i]
[u]underline[/u]
[s]strike through[/s]
[size=25px]size 25px[/size]
[color=red]color red[/color]
[center]center text[/center]
[font=monospace]monospace[/font]
[align=right]align right[/align]
Links:
[url]http://www.bbcode.org/[/url]
[url=http://www.bbcode.org/]Linking to a named site[/url]
[url]www.bbcode.org/[/url]
[url=www.bbcode.org/]Linking to a named site (no http)[/url]
[mail=mail@to.you]Mail to you[/mail]
[mail]mail@to.you[/mail]
[bull /][copyright /][registered /][tm /]
[img]http://www.bbcode.org/images/lubeck_small.jpg[/img]
Resized image:
[img=100x50]http://www.bbcode.org/images/lubeck_small.jpg[/img]
Clickable image:
[url=http://www.bbcode.org/images/lubeck.jpg][img]http://www.bbcode.org/images/lubeck_small.jpg[/img][/url]
Resized image with meta information:
[img width="100" height="50" alt="Lubeck city gate" title="This is one of the medieval city gates of Lubeck"]http://www.bbcode.org/images/lubeck_small.jpg[/img]
[quote]quote[/quote]
[quote=Quote]quote[/quote]
[code]
preformatted text
preformatted text
preformatted text
[/code]
Unordered list
[list]
[*]unordered item 1
[*]unordered item 2
[/list]
Ordered list
[list=decimal]
[*]Item1
[*]item2
[/list]
Another ordered list
[list=upper-roman]
[li]List item 1[/li]
[li]List item 2[/li]
[/list]
Normal text. [sub]subscript[/sub]
Normal text. [sup]superscript[/sup]
[p]paragraph[/p]
Youtube video
[youtube]uelHwf8o7_U[/youtube]
Google video
[gvideo]3425879595449788861[/gvideo]
BBTEXT;
echo BBCode::parse($bbtext);
//the output is:
/*
<strong>bold</strong><br />
<em>italic</em><br />
<u>underline</u><br />
<del>strike through</del><br />
<span style="font-size: 25px;">size 25px</span><br />
<span style="color: red;">color red</span><br />
<div style="text-align: center;">center text</div>
<span style="font-family: monospace;">monospace</span><br />
<div style="text-align: right;">align right</div>
Links:<br />
<a href="http://www.bbcode.org/">http://www.bbcode.org/</a><br />
<a href="http://www.bbcode.org/">Linking to a named site</a><br />
<a href="http://www.bbcode.org/">www.bbcode.org/</a><br />
<a href="http://www.bbcode.org/">Linking to a named site (no http)</a><br />
<a href="mailto:mail@to.you">Mail to you</a><br />
<a href="mailto:mail@to.you">mail@to.you</a><br />
<br />
•©®™<br />
<br />
<img src="http://www.bbcode.org/images/lubeck_small.jpg" alt="" /><br />
Resized image:<br />
<img height="50" width="100" alt="" src="http://www.bbcode.org/images/lubeck_small.jpg" /><br />
Clickable image:<br />
<a href="http://www.bbcode.org/images/lubeck.jpg"><img src="http://www.bbcode.org/images/lubeck_small.jpg" alt="" /></a><br />
Resized image with meta information:<br />
<img width="100" height="50" alt="Lubeck city gate" title="This is one of the medieval city gates of Lubeck" src="http://www.bbcode.org/images/lubeck_small.jpg" /><br />
<br />
<blockquote>quote</blockquote>
<blockquote><strong>Quote wrote:</strong> quote</blockquote>
<pre>
preformatted text
preformatted text
preformatted text
</pre>
<br />
Unordered list<br />
<ul>
<li>unordered item 1</li>
<li>unordered item 2</li>
</ul>
<br />
Ordered list<br />
<ol style="list-style-type: decimal;">
<li>Item1</li>
<li>item2</li>
</ol>
<br />
Another ordered list<br />
<ol style="list-style-type: upper-roman;">
<li>List item 1</li>
<li>List item 2</li>
</ol>
<br />
Normal text. <sub>subscript</sub><br />
Normal text. <sup>superscript</sup><br />
<p>paragraph</p>
Youtube video<br />
<object width="425" height="350"><embed src="http://www.youtube.com/v/uelHwf8o7_U" type="application/x-shockwave-flash" width="425" height="350"></embed></object><br />
Google video<br />
<embed src="http://video.google.com/googleplayer.swf?docId=3425879595449788861" type="application/x-shockwave-flash" style="width: 425px; height: 350px;"><br />
<br />
*/
?>
|