Файл: sys/s-fnc/bbcode.php
Строк: 63
<?
function bbcodehightlight($arr)
{
$arr[0]=html_entity_decode($arr[0], ENT_QUOTES, 'UTF-8');
return '<div class="cit" style="overflow:scroll;clip:auto;max-width:480px;">'.preg_replace('#<code>(.*?)</code>#si', '\1' ,highlight_string($arr[0],1)).'</div>'."n";
}
function BBcode($msg)
{
global $set;
$bbcode=array();
if ($set['bb_i'])
{
$bbcode['/[i](.+)[/i]/isU']='<em>$1</em>';
}
if ($set['bb_b'])
{
$bbcode['/[b](.+)[/b]/isU']='<strong>$1</strong>';
}
if ($set['bb_u'])
{
$bbcode['/[u](.+)[/u]/isU']='<span style="text-decoration:underline;">$1</span>';
}
if ($set['bb_big'])
{
$bbcode['/[big](.+)[/big]/isU']='<span style="font-size:large;">$1</span>';
}
if ($set['bb_s'])
{
$bbcode['/[s](.+)[/s]/isU']='<span style="text-decoration:line-through;">$1</span>';
}
if ($set['bb_small'])
{
$bbcode['/[small](.+)[/small]/isU']='<span style="font-size:small;">$1</span>';
}
if ($set['bb_red'])
{
$bbcode['/[red](.+)[/red]/isU']='<span style="color:#ff0000;">$1</span>';
}
if ($set['bb_yellow'])
{
$bbcode['/[yellow](.+)[/yellow]/isU']='<span style="color:#ffff22;">$1</span>';
}
if ($set['bb_green'])
{
$bbcode['/[green](.+)[/green]/isU']='<span style="color:#00bb00;">$1</span>';
}
if ($set['bb_blue'])
{
$bbcode['/[blue](.+)[/blue]/isU']='<span style="color:#0000bb;">$1</span>';
}
if ($set['bb_white'])
{
$bbcode['/[white](.+)[/white]/isU']='<span style="color:#ffffff;">$1</span>';
}
if ($set['bb_size'])
{
$bbcode['/[size=([0-9]+)](.+)[/size]/isU']='<span style="font-size:$1px;">$2</span>';
}
if ($set['bb_code'])
{
$bbcode['/[code](.+)[/code]/isU']='<div class="cit" style="overflow:scroll;clip:auto;max-width:480px;">$1</div>';
}
if (count($bbcode))
{
$msg=preg_replace(array_keys($bbcode), array_values($bbcode), $msg);
}
if ($set['bb_code'])
{
$msg=preg_replace_callback('#<?(.*?)?>#sui', 'bbcodehightlight', $msg);
$msg=preg_replace('#[code](.*?)[/code]#si', '1', $msg);
}
return $msg;
}
function bb_panel()
{
echo "<script src='/s-klub/js/bb_code.js'></script>";
?>
<a href="javascript:tag('[b]', '[/b]')"><img src="/s-klub/bb_code/b.png" alt="b" title="Жирный"/></a>
<a href="javascript:tag('[i]', '[/i]')"><img src="/s-klub/bb_code/i.png" alt="i" title="Наклонный"/></a>
<a href="javascript:tag('[u]', '[/u]')"><img src="/s-klub/bb_code/u.png" alt="u" title="Подчёркнутый"/></a>
<a href="javascript:tag('[s]', '[/s]')"><img src="/s-klub/bb_code/s.png" alt="s" title="Перечёркнутый"/></a>
<a href="javascript:tag('[code]', '[/code]')"><img src="/s-klub/bb_code/code.png" alt="code" title="Подсветка PHP"/></a>
<a href="javascript:tag('[url=]', '[/url]')"><img src="/s-klub/bb_code/url.png" alt="url" title="Ссылка" /></a>
<a href="javascript:tag('[red]', '[/red]')"><img src="/s-klub/bb_code/red.png" alt="red" title="Красный"/></a>
<a href="javascript:tag('[yellow]', '[/yellow]')"><img src="/s-klub/bb_code/yellow.png" alt="yellow" title="Желтый"/></a>
<a href="javascript:tag('[green]', '[/green]')"><img src="/s-klub/bb_code/green.png" alt="green" title="Зелёный"/></a>
<a href="javascript:tag('[blue]', '[/blue]')"><img src="/s-klub/bb_code/blue.png" alt="blue" title="Синий"/></a><br />
<a href="javascript:tag('', ':-)')"><img src="/s-klub/smiles/smile.gif" alt="smile"/></a>
<a href="javascript:tag('', ':-(')"><img src="/s-klub/smiles/sad.gif" alt="smile"/></a>
<a href="javascript:tag('', ':-D')"><img src="/s-klub/smiles/biggrin.gif" alt="smile"/></a>
<a href="javascript:tag('', ':good:')"><img src="/s-klub/smiles/good.gif" alt="smile"/></a>
<a href="javascript:tag('', ':bad:')"><img src="/s-klub/smiles/bad.gif" alt="smile"/></a>
<a href="javascript:tag('', '*SCRATCH*')"><img src="/s-klub/smiles/scratch_one-s_head.gif" alt="smile"/></a>
<a href="javascript:tag('', ':sorry:')"><img src="/s-klub/smiles/sorry.gif" alt="smile"/></a><br />
<?
}
?>