documentItem::getSummary() 함수에서 </p>, </div>, </li> 태그를 공백문자로 치환하도록 수정하고, tail 설정 가능하도록 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6163 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
mooo 2009-04-22 07:15:46 +00:00
parent 7cca63d922
commit 7a17619b13

View file

@ -308,13 +308,16 @@
return $content;
}
function getSummary($str_size = 50) {
function getSummary($str_size = 50, $tail = '...') {
// 영문이나 숫자가 연결되어서 20개 이상으로 연결시에 강제 띄움 시도 - {20,}으로 길이를 정하면, 20개 이상 문자열 맨 마지막에 스페이스를 추가할 뿐 원하는 의도는 달성되지 못함
$content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$this->getContent(false,false));
// 줄바꿈이 있을 때, 공백문자 삽입
$content = preg_replace('!(<br[\s]*/{0,1}>[\s]*)+!is', ' ', $content);
// </p>, </div>, </li> 등의 태그를 공백 문자로 치환
$content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content);
// 태그 제거
$content = preg_replace('!<([^>]*?)>!is','', $content);
@ -325,7 +328,7 @@
$content = preg_replace('/([\s]{2,})/is', ' ', $content);
// 문자열을 자름
$content = trim(cut_str($content, $str_size, '...'));
$content = trim(cut_str($content, $str_size, $tail));
// >, <, "를 다시 복구
return str_replace(array('<','>','"'),array('&lt;','&gt;','&quot;'), $content);