Файл: sys/fnc/bbcode.php
Строк: 103
<?
function bbcodehightlight($arr)
{
$arr[0]=html_entity_decode($arr[0], ENT_QUOTES, 'UTF-8');
$arr[0] = stripslashes($arr[0]);
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();
$bbcode['/[br]/isU']='<br />';
$bbcode['/[PluginSvid](.+)[/PluginSvid]/isU']='<video width="400" height="300" controls="controls" poster="http://dcms-social.ru/style/PluginS_FoN.png">
<source src="$1">
Смените браузер для просмотра видео .<a href="$1">Load</a>.</video> ';
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_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_size'])$bbcode['/[u=([0-9]+)](.+)[/u]/isU'] = '<span class="nick"><a href="/id$1">$2</a></span>';
$bbcode['/[color=([#0-9a-zA-Z]+)](.+)[/color]/isU']='<span style="color:$1;">$2</span>';
$bbcode['/[PluginSaud](.+)[/PluginSaud]/isU']=' <audio controls>
<source src="$1" type="audio/ogg; codecs=vorbis">
<source src="$1" type="audio/mpeg">
<a href="$">Скачать музыку</a>.
</audio>';
$msg=preg_replace('#[you100](.*?)[/you100]#si', '
<object width="100" height="80">
<param name="movie" value="http://www.youtube.com/v/1?version=3">
</param>
<param name="allowFullScreen" value="true">
</param>
<embed src="http://www.youtube.com/v/1?version=3" type="application/x-shockwave-flash" width="100" height="80" allowfullscreen="true">
</embed></object>', $msg);#
$msg=preg_replace('#[you150](.*?)[/you150]#si', '
<object width="150" height="100">
<param name="movie" value="http://www.youtube.com/v/1?version=3">
</param>
<param name="allowFullScreen" value="true">
</param>
<embed src="http://www.youtube.com/v/1?version=3" type="application/x-shockwave-flash" width="150" height="100" allowfullscreen="true">
</embed></object>', $msg);#
$msg=preg_replace('#[you300](.*?)[/you300]#si', '
<object width="300" height="300">
<param name="movie" value="http://www.youtube.com/v/1?version=3">
</param>
<param name="allowFullScreen" value="true">
</param>
<embed src="http://www.youtube.com/v/1?version=3" type="application/x-shockwave-flash" width="300" height="300" allowfullscreen="true">
</embed></object>', $msg);#
$msg=preg_replace('#[you250](.*?)[/you250]#si', '
<object width="250" height="200">
<param name="movie" value="http://www.youtube.com/v/1?version=3">
</param>
<param name="allowFullScreen" value="true">
</param>
<embed src="http://www.youtube.com/v/1?version=3" type="application/x-shockwave-flash" width="250" height="200" allowfullscreen="true">
</embed></object>', $msg);#
$msg=preg_replace('#[you400](.*?)[/you400]#si', '
<object width="400" height="250">
<param name="movie" value="http://www.youtube.com/v/1?version=3">
</param>
<param name="allowFullScreen" value="true">
</param>
<embed src="http://www.youtube.com/v/1?version=3" type="application/x-shockwave-flash" width="400" height="250" allowfullscreen="true">
</embed></object>', $msg);#
$msg=preg_replace('#[you500](.*?)[/you500]#si', '
<object width="500" height="340">
<param name="movie" value="http://www.youtube.com/v/1?version=3">
</param>
<param name="allowFullScreen" value="true">
</param>
<embed src="http://www.youtube.com/v/1?version=3" type="application/x-shockwave-flash" width="500" height="340" allowfullscreen="true">
</embed></object>', $msg);#
$msg=preg_replace('#[you250](.*?)[/you250]#si', '
<object width="250" height="150">
<param name="movie" value="http://www.youtube.com/v/1?version=3">
</param>
<param name="allowFullScreen" value="true">
</param>
<embed src="http://www.youtube.com/v/1?version=3" type="application/x-shockwave-flash" width="250" height="150" allowfullscreen="true">
</embed></object>', $msg);#
if (count($bbcode))$msg = preg_replace(array_keys($bbcode), array_values($bbcode), $msg);
if ($set['bb_code'])
{
$msg = preg_replace_callback('#<?(.*?)?>#sui', 'php_2html', $msg);
$msg = preg_replace('#[code](.*?)[/code]#si', '1', $msg);
$msg = preg_replace('#[quote]#', '<div class="cit quote">', $msg);
$msg = preg_replace('#[/quote]#', '</div>', $msg);
}
return $msg;
}
?>