复制代码 代码如下:
class Day{
function ubb($Text) { /// UBB代码转换
//$Text=htmlspecialchars($Text);
//$Text=ereg_replace("\r\n","<br>",$Text);
$Text=ereg_replace("\[br\]","<br />",$Text);
$Text=nl2br($Text);
$Text=stripslashes($Text);
$Text=preg_replace("/\\t/is"," ",$Text);
$Text=preg_replace("/\[url\](http:\/\/.+?)\[\/url\]/is","<a href=https://www.jb51.net/article/\"\\1\" target=https://www.jb51.net/article/\"new\"><u>\\1</u></a>",$Text);
$Text=preg_replace("/\[url\](.+?)\[\/url\]/is","<a href=https://www.jb51.net/article/\"http://\\1\" target=https://www.jb51.net/article/\"new\"><u>\\1</u></a>",$Text);
$Text=preg_replace("/\[url=(http:\/\/.+?)\](.+?)\[\/url\]/is","<a href=https://www.jb51.net/article/\"\\1\" target=https://www.jb51.net/article/\"new\"><u>\\2</u></a>",$Text);
$Text=preg_replace("/\[url=(.+?)\](.+?)\[\/url\]/is","<a href=https://www.jb51.net/article/\"http://\\1\" target=https://www.jb51.net/article/\"new\"><u>\\2</u></a>",$Text);
$Text=preg_replace("/\[color=(.+?)\](.+?)\[\/color\]/is","<font color=https://www.jb51.net/article/\"\\1\">\\2</font>",$Text);
$Text=preg_replace("/\[font=(.+?)\](.+?)\[\/font\]/is","<font face=https://www.jb51.net/article/\"\\1\">\\2</font>",$Text);
$Text=preg_replace("/\[email=(.+?)\](.+?)\[\/email\]/is","<a href=https://www.jb51.net/article/\"mailto:\\1\"><u>\\2</u></a>",$Text);
$Text=preg_replace("/\[email\](.+?)\[\/email\]/is","<a href=https://www.jb51.net/article/\"mailto:\\1\"><u>\\1</u></a>",$Text);
$Text=preg_replace("/\[i\](.+?)\[\/i\]/is","<i>\\1</i>",$Text);
$Text=preg_replace("/\[u\](.+?)\[\/u\]/is","<u>\\1</u>",$Text);
$Text=preg_replace("/\[b\](.+?)\[\/b\]/is","<b>\\1</b>",$Text);
$Text=preg_replace("/\[fly\](.+?)\[\/fly\]/is","<marquee width=https://www.jb51.net/article/\"98%\" behavior=https://www.jb51.net/article/\"alternate\" scrollamount=https://www.jb51.net/article/\"3\">\\1</marquee>",$Text);
$Text=preg_replace("/\[move\](.+?)\[\/move\]/is","<marquee width=https://www.jb51.net/article/\"98%\" scrollamount=https://www.jb51.net/article/\"3\">\\1</marquee>",$Text);
$Text=preg_replace("/\[shadow=([#0-9a-z]{1,10})\,([0-9]{1,3})\,([0-9]{1,2})\](.+?)\[\/shadow\]/is","<table width=https://www.jb51.net/article/\"*\"><tr><td style=https://www.jb51.net/article/\"filter:shadow(color=https://www.jb51.net/article/\\1, direction=https://www.jb51.net/article/\\2 ,strength=https://www.jb51.net/article/\\3)\">\\4</td></tr></table>",$Text);
return $Text;
}
}