Ejemplo n.º 1
0
function formatBlogContent($content, $attr, $logId, $statichtml = 0)
{
    global $settingInfo, $DMC;
    $content = str_replace("../attachments", "attachments", $content);
    $content = str_replace("../editor", "editor", $content);
    $content = preg_replace("/alt=\"open_img\\('(.+?)'\\)\"/is", "style=\"cursor:pointer;\" onclick=\"open_img('\\1')\" alt=\"\\1\"", $content);
    $content = preg_replace("/alt=\"open_img\\(&#39(.+?)&#39\\)\"/is", "style=\"cursor:pointer;\" onclick=\"open_img('\\1')\" alt=\"\\1\"", $content);
    $content = preg_replace("/alt=\"open_img\\('(.+?)'\\)\"/is", "style=\"cursor:pointer;\" onclick=\"open_img('\\1')\" alt=\"\\1\"", $content);
    if ($attr == 0) {
        //展开与隐藏,首页才隐藏,阅读的时候全展开。
        $content = preg_replace("/<!--hideBegin-->(.+?)<!--hideEnd-->/ie", "makeMoreLess('\\1')", $content);
    }
    if (preg_match("/\\[.+?\\]/i", $content)) {
        $content = ubb($content);
    }
    if (preg_match("/<!--(.*?)Begin-->(.+?)<!--(.*?)End-->/i", $content)) {
        $reg_search = array("/<!--musicBegin-->(.+?)<!--musicEnd-->/ie", "/<!--galleryBegin-->(.+?)<!--galleryEnd-->/ie", "/<!--mfileBegin-->(.+?)<!--mfileEnd-->/ie", "/<!--fileBegin-->(.+?)<!--fileEnd-->/ie", "/<!--fileBegin-->(.+?)<!--fileEnd-->/ie");
        $reg_replace = array("makemusic('\\1')", "makegallery('\\1')", "makemfile('\\1',{$statichtml})", "makefile('\\1',{$statichtml})");
        $content = preg_replace($reg_search, $reg_replace, $content);
    }
    //插件
    $content = do_filter("f2_content", $content, $logId);
    //自动转换连接,非常耗时
    if ($settingInfo['autoUrl'] == 1) {
        $content = preg_replace("/([^\\/\"\\'\\=\\>&#39;&quot;])(mms|http|ftp|telnet)\\:\\/\\/(.[^ \r\n\\<\"\\'\\)]+)/is", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $content);
    }
    //显示关键字,非常耗时
    if ($settingInfo['showKeyword'] == 1) {
        $content = repKeyword($content);
    }
    //mysql4.0下
    if ($DMC->getServerInfo() < '4.1') {
        $content = stripslashes($content);
    }
    return $content;
}
Ejemplo n.º 2
0
function formatBlogContent($content, $attr, $logId)
{
    global $plugins_path;
    $content = str_replace("../attachments", "attachments", $content);
    $content = str_replace("alt=\"open_img", "onclick=\"open_img", $content);
    $content = str_replace("../editor/plugins/", "editor/plugins/", $content);
    if ($attr == 0) {
        $content = preg_replace("/<!--hideBegin-->(.+?)<!--hideEnd-->/ie", "makeMoreLess('\\1')", $content);
    }
    $reg_search = array("/<!--musicBegin-->(.+?)<!--musicEnd-->/ie", "/<!--galleryBegin-->(.+?)<!--galleryEnd-->/ie", "/<!--fileBegin-->(.+?)<!--fileEnd-->/ie", "/([^\\/\"\\'\\=\\>&#39;&quot;])(mms|http|ftp|telnet)\\:\\/\\/(.[^ \r\n\\<\"\\'\\)]+)/is");
    $reg_replace = array("makemusic('\\1')", "makegallery('\\1')", "makefile('\\1')", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>");
    $content = preg_replace($reg_search, $reg_replace, $content);
    $content = repKeyword($content);
    //插件
    $content = do_filter("f2_content", $content, $logId);
    return $content;
}