Atualizado em 01 dez 2009 18h10
Venda: Ssd Sata Wd Green 240gb - Para Notebook, Mini Pc - 2.5
Venda: Memoria Corsair 8gb (2 X 4gb) Ddr3 Notebook, Mini Pc
Venda: Injetor Poe Eap225 24v Passivo - Tl-poe2412g - Tp-link
Venda: Injetor Poe Ubiquiti 802.3at 48v 30w Gigabit U-poe-at
<?php
function bbcode($texto) {
$tags = array(
//Básicos
"/(?<!)[color(?::w+)?=(.*?)](.*?)[/color(?::w+)?]/si" => "<span style="color:1;">2</span>",
'/(?<!)[size(?::w+)?=(.*?)](.*?)[/size(?::w+)?]/si' => "<span style="font-size:1;">2</span>",
'/(?<!)[b(?::w+)?](.*?)[/b(?::w+)?]/si' => "<span style="font-weight:bold;">1</span>",
'/(?<!)[code(?::w+)?](.*?)[/code(?::w+)?]/si' => "<span class="barra-code">CÓDIGO</span><code class="code">1</code>",
'/(?<!)[i(?::w+)?](.*?)[/i(?::w+)?]/si' => "<span style="font-style:italic;">1</span>",
'/(?<!)[u(?::w+)?](.*?)[/u(?::w+)?]/si' => "<span style="text-decoration: underline;">1</span>",
'/(?<!)[align(?::w+)?=(.*?)](.*?)[/align(?::w+)?]/si' => "<span style="display:block;text-align:1">2</span>",
// Smilies
'/:ang:/' => "<img src="img/smilies/angry.png" alt="Angry" />",
'/:!!:/' => "<img src="img/smilies/attention.png" alt="Angry" />",
'/:big:/' => "<img src="img/smilies/biggrin.png" alt="Angry" />",
'/:Ooo:/' => "<img src="img/smilies/blink.png" alt="Angry" />",
'/:con:/' => "<img src="img/smilies/confused.png" alt="Angry" />",
'/:col:/' => "<img src="img/smilies/cool.png" alt="Angry" />",
'/:cry:/' => "<img src="img/smilies/crying.png" alt="Angry" />",
'/:cur:/' => "<img src="img/smilies/cursing.png" alt="Angry" />",
'/:evi:/' => "<img src="img/smilies/evil.png" alt="Angry" />",
'/:huh:/' => "<img src="img/smilies/huh.png" alt="Angry" />",
'/:lov:/' => "<img src="img/smilies/love.png" alt="Angry" />",
'/:mel:/' => "<img src="img/smilies/mellow.png" alt="Angry" />",
'/:pin:/' => "<img src="img/smilies/pinch.png" alt="Angry" />",
'/:que:/' => "<img src="img/smilies/question.png" alt="Angry" />",
'/:rol:/' => "<img src="img/smilies/rolleyes.png" alt="Angry" />",
'/:sad:/' => "<img src="img/smilies/sad.png" alt="Angry" />",
'/:sle:/' => "<img src="img/smilies/sleeping.png" alt="Angry" />",
'/:smi:/' => "<img src="img/smilies/smile.png" alt="Angry" />",
'/:squ:/' => "<img src="img/smilies/squint.png" alt="Angry" />",
'/:thd:/' => "<img src="img/smilies/thumbdown.png" alt="Angry" />",
'/:thu:/' => "<img src="img/smilies/thumbsup.png" alt="Angry" />",
'/:thm:/' => "<img src="img/smilies/thumbup.png" alt="Angry" />",
'/:ton:/' => "<img src="img/smilies/tongue.png" alt="Angry" />",
'/:uns:/' => "<img src="img/smilies/unsure.png" alt="Angry" />",
'/:w00:/' => "<img src="img/smilies/w00t.png" alt="Angry" />",
'/:wac:/' => "<img src="img/smilies/wacko.png" alt="Angry" />",
'/:whi:/' => "<img src="img/smilies/whistling.png" alt="Angry" />",
'/:win:/' => "<img src="img/smilies/wink.png" alt="Angry" />",
// BBCode [url]
'/(?<!)[url(?::w+)?]www.(.*?)[/url(?::w+)?]/si' => "<a href="http://www.1" onclick="window.open(this.href); return false;">1</a>",
'/(?<!)[url(?::w+)?](.*?)[/url(?::w+)?]/si' => "<a href="1" onclick="window.open(this.href); return false;">1</a>",
'/(?<!)[url(?::w+)?=(.*?)?](.*?)[/url(?::w+)?]/si' => "<a href="1" onclick="window.open(this.href); return false;">2</a>",
// Download
'/(?<!)[down(?::w+)?=(.*?)?](.*?)[/down(?::w+)?]/si' => "<img class="down" src="".BASE_URL."img/download.gif" alt="" /> <a href="1" onclick="window.open(this.href); return false;">2</a>",
// BBCode Imagem
'/(?<!)[img(?::w+)?](.*?)[/img(?::w+)?]/si' => "<a href="1" title="Ampliar" class="highslide" onclick="return hs.expand (this)"><img src="1" alt="Imagem" /></a>",
'/([/?w+(?::w+)*])/' => "1"
);
$texto = preg_replace(array_keys($tags), array_values($tags), $texto);
return nl2br($texto);
}
?>
$tags = array('[tag]texto[/tag]' => "<span style="color:red">texto</span>");
require_once('bbcode.php');
echo bbcode("texto negrito");
© MNDTI - Tecnologia e Informação. Todos Direitos Reservados. Política de privacidade.