스마트에디터에서 굵게 설정한 글자가

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
스마트에디터에서 굵게 설정한 글자가

QA

스마트에디터에서 굵게 설정한 글자가

답변 1

본문

스마트에디터2 사용중이고,

글작성시 에디터 모드에서 글자를 굵게 하거나,

글머리기호(ul, li)를 적용해도

실제 글읽기에서는 적용안된 화면으로 나옵니다.

 

글색깔이나 배경색, 윗첨자, 아래첨자 등은 먹히구요,

 

아래 코드는 common.lib.php 설정 부분입니다.


// 내용을 변환
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 // text 이면
    {
        // & 처리 : &   등의 코드를 정상 출력함
        $content = html_symbol($content);
        // 공백 처리
        //$content = preg_replace("/  /", "  ", $content);
        $content = str_replace("  ", "  ", $content);
        $content = str_replace("\n ", "\n ", $content);
        $content = get_text($content, 1);
        $content = url_auto_link($content);
    }
    return $content;
}
function check_html_link_nofollow($type=''){
    return true;
}
// http://htmlpurifier.org/
// Standards-Compliant HTML Filtering
// Safe  : HTML Purifier defeats XSS with an audited whitelist
// Clean : HTML Purifier ensures standards-compliant output
// Open  : HTML Purifier is open-source and highly customizable
function html_purifier($html)
{
    $f = file(G5_PLUGIN_PATH.'/htmlpurifier/safeiframe.txt');
    $domains = array();
    foreach($f as $domain){
        // 첫행이 # 이면 주석 처리
        if (!preg_match("/^#/", $domain)) {
            $domain = trim($domain);
            if ($domain)
                array_push($domains, $domain);
        }
    }
    // 내 도메인도 추가
    array_push($domains, $_SERVER['HTTP_HOST'].'/');
    $safeiframe = implode('|', $domains);
    include_once(G5_PLUGIN_PATH.'/htmlpurifier/HTMLPurifier.standalone.php');
    include_once(G5_PLUGIN_PATH.'/htmlpurifier/extend.video.php');
    $config = HTMLPurifier_Config::createDefault();
    // data/cache 디렉토리에 CSS, HTML, URI 디렉토리 등을 만든다.
    $config->set('Cache.SerializerPath', G5_DATA_PATH.'/cache');
    $config->set('HTML.SafeEmbed', false);
    $config->set('HTML.SafeObject', false);
    $config->set('Output.FlashCompat', false);
    $config->set('HTML.SafeIframe', true);
    if( (function_exists('check_html_link_nofollow') && check_html_link_nofollow('html_purifier')) ){
        $config->set('HTML.Nofollow', true);    // rel=nofollow 으로 스팸유입을 줄임
    }
    $config->set('URI.SafeIframeRegexp','%^(https?:)?//('.$safeiframe.')%');
    $config->set('Attr.AllowedFrameTargets', array('_blank'));
    //유튜브, 비메오 전체화면 가능하게 하기
    $config->set('Filter.Custom', array(new HTMLPurifier_Filter_Iframevideo()));
    $purifier = new HTMLPurifier($config);
    return run_replace('html_purifier_result', $purifier->purify($html), $purifier, $html);
}

이 질문에 댓글 쓰기 :

답변 1

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
  • 질문이 없습니다.
전체 0
© SIRSOFT
현재 페이지 제일 처음으로