Exemple #1
0
function conv_content($content, $html, $filter = true)
{
    global $config, $board;
    if ($html) {
        $source = array();
        $target = array();
        $source[] = "//";
        $target[] = "";
        if ($html == 2) {
            // 자동 줄바꿈
            $source[] = "/\n/";
            $target[] = "<br/>";
        }
        // 테이블 태그의 개수를 세어 테이블이 깨지지 않도록 한다.
        $table_begin_count = substr_count(strtolower($content), "<table");
        $table_end_count = substr_count(strtolower($content), "</table");
        for ($i = $table_end_count; $i < $table_begin_count; $i++) {
            $content .= "</table>";
        }
        $content = preg_replace($source, $target, $content);
        if ($filter) {
            $content = html_purifier($content);
        }
    } else {
        // & 처리 : &amp; &nbsp; 등의 코드를 정상 출력함
        $content = html_symbol($content);
        // 공백 처리
        //$content = preg_replace("/  /", "&nbsp; ", $content);
        $content = str_replace("  ", "&nbsp; ", $content);
        $content = str_replace("\n ", "\n&nbsp;", $content);
        $content = get_text($content, 1);
        $content = url_auto_link($content);
    }
    return $content;
}
Exemple #2
0
function display_html_content($content = '', $html = '', $thumb_width = 700, $autolink = false, $popup = false, $writer_is_admin = false)
{
    if (empty($html)) {
        $content = nl2br(html_escape($content));
        if ($autolink) {
            $content = url_auto_link($content, $popup);
        }
        $content = preg_replace("/\\[<a\\s*href\\=\"(http|https|ftp)\\:\\/\\/([^[:space:]]+)\\.(gif|png|jpg|jpeg|bmp).*<\\/a>(\\s\\]|\\]|)/i", "<img src=\"\$1://\$2.\$3\" alt=\"\" style=\"max-width:100%;border:0;\">", $content);
        $content = preg_replace("/{지도\\:([^}]*)}/ie", "get_google_map('\\1', '{$thumb_width}')", $content);
        // Google Map
        return $content;
    }
    $source = array();
    $target = array();
    $source[] = '//';
    $target[] = '';
    $source[] = "/<\\?xml:namespace prefix = o ns = \"urn:schemas-microsoft-com:office:office\" \\/>/";
    $target[] = '';
    // 테이블 태그의 갯수를 세어 테이블이 깨지지 않도록 한다.
    $table_begin_count = substr_count(strtolower($content), '<table');
    $table_end_count = substr_count(strtolower($content), '</table');
    for ($i = $table_end_count; $i < $table_begin_count; $i++) {
        $content .= '</table>';
    }
    $content = preg_replace($source, $target, $content);
    if ($autolink) {
        $content = url_auto_link($content, $popup);
    }
    if ($writer_is_admin === false) {
        $content = html_purifier($content);
    }
    $content = get_view_thumbnail($content, $thumb_width);
    $content = preg_replace("/{&#51648;&#46020;\\:([^}]*)}/ie", "get_google_map('\\1', '{$thumb_width}')", $content);
    // Google Map
    return $content;
}