时间:2021-07-01 10:21:17 帮助过:24人阅读
dddd
class BBCode {
public function __construct(){}
private function showBBcodes($text) {
// BBcode array
$find = array(
'~\[b\](.*?)\[/b\]~s',
'~\[i\](.*?)\[/i\]~s',
'~\[u\](.*?)\[/u\]~s',
'~\[quote\](.*?)\[/quote\]~s',
'~\[table\](.*?)\[/table\]~s',
'~\[tr\](.*?)\[/tr\]~s',
'~\[td\](.*?)\[/td\]~s',
'~\[justify\](.*?)\[/justify\]~s',
'~\[center\](.*?)\[/center\]~s',
'~\[right\](.*?)\[/right\]~s',
'~\[left\](.*?)\[/left\]~s',
'~\[size=(.*?)\](.*?)\[/size\]~s',
'~\[color=(.*?)\](.*?)\[/color\]~s',
'~\[font=(.*?)\](.*?)\[/font\]~s',
'~\[url=((?:ftp|https?)://.*?)\](.*?)\[/url\]~s',
'~\[img\](https?://.*?\.(?:jpg|jpeg|gif|png|bmp))\[/img\]~s',
'/\[img=(\d+)x(\d+)\](.*?)\[\/img\]/is',
'~\[youtube\](.*?)\[/youtube\]~s',
);
// HTML tags to replace BBcode
$replace = array(
'https://www.gxlcms.com/$1',
'https://www.gxlcms.com/$1',
'https://www.gxlcms.com/$1',
'https://www.gxlcms.com/$1'.'pre>',
'