⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 func_ubb.php

📁 采用模块化设计,自由组合文章,软件,论坛等模块,安装方便快捷 模板支持Dreamweaver可视化编辑,创建风格更为容易,专业
💻 PHP
字号:
<?php

if (!defined('ROOT'))
    exit('Access Denied');
function ubb($str, $e = true)
{ 
	if($str=='') return false; 
    $str = html($str);
    if ($e)
    {
        $codes['s'] = array("/\[url\]\s*(www.|https?:\/\/|ftp:\/\/|gopher:\/\/|news:\/\/|telnet:\/\/|rtsp:\/\/|mms:\/\/|callto:\/\/|bctp:\/\/|ed2k:\/\/|thunder:\/\/|synacast:\/\/){1}([^\[\"']+?)\s*\[\/url\]/ie",
            "/\[url=www.([^\[\"']+?)\](.+?)\[\/url\]/is", "/\[url=(https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k|thunder|synacast){1}:\/\/([^\[\"']+?)\](.+?)\[\/url\]/is",
            "/\[color=([#\w]+?)\]/i", "/\[size=(\d+?)\]/i", "/\[size=(\d+(\.\d+)?(px|pt|in|cm|mm|pc|em|ex|%)+?)\]/i",
            "/\[font=([^\[\<]+?)\]/i");
        $codes['r'] = array("str_cuturl('\\1\\2')", "<a href=\"http://www.\\1\" target=\"_blank\">\\2</a>",
            "<font color=\"\\1\">", "<font size=\"\\1\">", "<font style=\"font-size: \\1\">",
            "<font face=\"\\1 \">");
        $codes['s2'] = array('[/color]', '[/size]', '[/font]', '[b]', '[/b]', '[i]',
            '[/i]', '[u]', '[/u]');
        $codes['r2'] = array('</font>', '</font>', '</font>', '<strong>', '</strong>',
            '<i>', '</i>', '<u>', '</u>');
        $str = preg_replace($codes['s'], $codes['r'], $str);
        $str = str_replace($codes['s2'], $codes['r2'], $str);
        $str = preg_replace(array("/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies", "/\[img=(\d{1,4})[x|\,](\d{1,4})\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies"),
            array("str_codeurl('\\1', '<img src=\"%s\" border=\"0\" alt=\"\" />')",
            "str_codeurl('\\3', '<img width=\"\\1\" height=\"\\2\" src=\"%s\" border=\"0\" alt=\"\" />')"),
            $str);
    }
    return nl2br(str_replace(array("\t", '   ', '  '), array('&nbsp; &nbsp; &nbsp; &nbsp; ',
        '&nbsp; &nbsp;', '&nbsp;&nbsp;'), $str));
}
function str_codeurl($url, $tags)
{
    if (!preg_match("/<.+?>/s", $url))
    {
        if (!in_array(strtolower(substr($url, 0, 6)), array('http:/', 'https:', 'ftp://',
            'rtsp:/', 'mms://')))
        {
            $url = 'http://' . $url;
        }
        return str_replace(array('submit', 'logging.php'), array('', ''), sprintf($tags,
            $url, addslashes($url)));
    } else
    {
        return '&nbsp;' . $url;
    }
}
function str_cuturl($url)
{
    $length = 30;
    $urllink = "<a href=\"" . (substr(strtolower($url), 0, 4) == 'www.' ? "http://$url" :
        $url) . '" target="_blank">';
    if (strlen($url) > $length)
    {
        $url = substr($url, 0, intval($length * 0.5)) . ' ... ' . substr($url, -intval($length *
            0.3));
    }
    $urllink .= $url . '</a>';
    return $urllink;
}

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -