diff --git a/modules/comment/comment.item.php b/modules/comment/comment.item.php index a4b852181..5b89f67cd 100644 --- a/modules/comment/comment.item.php +++ b/modules/comment/comment.item.php @@ -186,8 +186,17 @@ } function getSummary($str_size = 50) { - $content = htmlspecialchars(strip_tags(str_replace(" "," ",$this->getContent(false)))); - return cut_str($content, $str_size, '...'); + // 먼저 태그들을 제거함 + $content = preg_replace('!<([^>]*?)>!is','', $this->getContent(false,false)); + + // < , > , " 를 치환 + $content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content); + + // 문자열을 자름 + $content = cut_str($content, $str_size, '...'); + + // >, <, "를 다시 복구 + return str_replace(array('<','>','"',' '),array('<','>','"',' '), $content); } function getRegdate($format = 'Y.m.d H:i:s') { diff --git a/modules/document/document.item.php b/modules/document/document.item.php index 8809228f7..cb71adde2 100644 --- a/modules/document/document.item.php +++ b/modules/document/document.item.php @@ -274,10 +274,17 @@ } function getSummary($str_size = 50) { - if(!$this->document_srl) return; + // 먼저 태그들을 제거함 + $content = preg_replace('!<([^>]*?)>!is','', $this->getContent(false,false)); - $content = htmlspecialchars(strip_tags(str_replace(" "," ",$this->getContent(false)))); - return cut_str($content, $str_size, '...'); + // < , > , " 를 치환 + $content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content); + + // 문자열을 자름 + $content = cut_str($content, $str_size, '...'); + + // >, <, "를 다시 복구 + return str_replace(array('<','>','"',' '),array('<','>','"',' '), $content); } function getRegdate($format = 'Y.m.d H:i:s') {