Просмотр файла clikus/smiles/bb.php

Размер файла: 937B
<?
function bbur($value)
{
if(!isset($value[3]))
return '<a href="'.$value[1].'">'.$value[2].'</a>';
else
return '<a href="'.$value[3].'">'.$value[3].'</a>';
}

function bb_code($bb)
{
//$bb = preg_replace_callback('~http://(www.)?[0-9a-z\.-]{2,30}+\.[0-9a-z]{2,6}~', 'bbur', $bb);
$bb=preg_replace("/http:\/\/(.\S+)/i","<a href=http://$1>http://$1</a>",$bb); 
$bb=preg_replace("/\[b\](.*?)\[\/b\]/i","<b>$1</b>",$bb); 
$bb=preg_replace("/\[i\](.*?)\[\/i\]/i","<i>$1</i>",$bb); 
$bb=preg_replace("/\[u\](.*?)\[\/u\]/i","<u>$1</u>",$bb);
$bb=preg_replace("/\[sub\](.*?)\[\/sub\]/i","<sub>$1</sub>",$bb); 
$bb=preg_replace("/\[sup\](.*?)\[\/sup\]/i","<sup>$1</sup>",$bb); 
$bb=preg_replace("/\[color=([0-9a-f]{6})\](.*?)\[\/color\]/i","<font color=\"#$1\">$2</font>",$bb);
$bb=preg_replace("#\[url\](http://)([a-z0-9._]*\.[a-z]{2,5})\/?([a-z_.=?&]*)\[\/url\]#i","<a href=\"$1$2/$3\">$2</a>",$bb);
return $bb;
}


?>