From 576cc9f029b967948abc9c8a92474c2c0c3c5347 Mon Sep 17 00:00:00 2001 From: zero Date: Tue, 19 May 2009 06:54:41 +0000 Subject: [PATCH] =?UTF-8?q?r6336=EA=B3=BC=20=EA=B4=80=EB=A0=A8=ED=95=98?= =?UTF-8?q?=EC=97=AC=20=EB=8C=93=EA=B8=80=EC=9D=98=20getSummary()=EC=97=90?= =?UTF-8?q?=EC=84=9C=EB=8F=84=20=EC=9C=88=EB=8F=84=EC=9A=B0=EC=84=9C?= =?UTF-8?q?=EB=B2=84=2064=EB=B9=84=ED=8A=B8=EC=97=90=EC=84=9C=20=EC=9E=98?= =?UTF-8?q?=EB=AA=BB=EB=90=9C=20=EB=AC=B8=EC=9E=90=EC=97=B4=EC=9D=84=20?= =?UTF-8?q?=EB=82=B4=EB=B3=B4=EB=82=B4=EB=8D=98=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6337 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/comment/comment.item.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/comment/comment.item.php b/modules/comment/comment.item.php index 39f3af6cd..943393f48 100644 --- a/modules/comment/comment.item.php +++ b/modules/comment/comment.item.php @@ -202,26 +202,33 @@ } function getSummary($str_size = 50, $tail = '...') { + $content = $this->getContent(false, false); + // 줄바꿈이 있을 때, 공백문자 삽입 - $content = preg_replace('!([\s]*)+!is', ' ', $this->getContent(false,false)); + $content = preg_replace('!([\s]*)+!is', ' ', $content); //

, , 등의 태그를 공백 문자로 치환 $content = str_replace(array('

', '', ''), ' ', $content); - // 먼저 태그들을 제거함 - $content = preg_replace('!<([^>]*?)>!is', '', $content); + // 태그 제거 + $content = preg_replace('!<([^>]*?)>!is','', $content); // < , > , " 를 치환 $content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content); // 연속된 공백문자 삭제 - $content = preg_replace('/([\s]{2,})/is', ' ', $content); + $content = preg_replace('/ ( +)/is', ' ', $content); // 문자열을 자름 $content = trim(cut_str($content, $str_size, $tail)); // >, <, "를 다시 복구 - return str_replace(array('<','>','"'),array('<','>','"'), $content); + $content = str_replace(array('<','>','"'),array('<','>','"'), $content); + + // 영문이 연결될 경우 개행이 안 되는 문제를 해결 + $content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$content); + + return $content; } function getRegdate($format = 'Y.m.d H:i:s') {