r6336과 관련하여 댓글의 getSummary()에서도 윈도우서버 64비트에서 잘못된 문자열을 내보내던 오류 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6337 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2009-05-19 06:54:41 +00:00
parent 16a354d8cb
commit 576cc9f029

View file

@ -202,26 +202,33 @@
} }
function getSummary($str_size = 50, $tail = '...') { function getSummary($str_size = 50, $tail = '...') {
$content = $this->getContent(false, false);
// 줄바꿈이 있을 때, 공백문자 삽입 // 줄바꿈이 있을 때, 공백문자 삽입
$content = preg_replace('!(<br[\s]*/{0,1}>[\s]*)+!is', ' ', $this->getContent(false,false)); $content = preg_replace('!(<br[\s]*/{0,1}>[\s]*)+!is', ' ', $content);
// </p>, </div>, </li> 등의 태그를 공백 문자로 치환 // </p>, </div>, </li> 등의 태그를 공백 문자로 치환
$content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content); $content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content);
// 먼저 태그들을 제거함 // 태그 제거
$content = preg_replace('!<([^>]*?)>!is', '', $content); $content = preg_replace('!<([^>]*?)>!is','', $content);
// < , > , " 를 치환 // < , > , " 를 치환
$content = str_replace(array('&lt;','&gt;','&quot;','&nbsp;'), array('<','>','"',' '), $content); $content = str_replace(array('&lt;','&gt;','&quot;','&nbsp;'), array('<','>','"',' '), $content);
// 연속된 공백문자 삭제 // 연속된 공백문자 삭제
$content = preg_replace('/([\s]{2,})/is', ' ', $content); $content = preg_replace('/ ( +)/is', ' ', $content);
// 문자열을 자름 // 문자열을 자름
$content = trim(cut_str($content, $str_size, $tail)); $content = trim(cut_str($content, $str_size, $tail));
// >, <, "를 다시 복구 // >, <, "를 다시 복구
return str_replace(array('<','>','"'),array('&lt;','&gt;','&quot;'), $content); $content = str_replace(array('<','>','"'),array('&lt;','&gt;','&quot;'), $content);
// 영문이 연결될 경우 개행이 안 되는 문제를 해결
$content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$content);
return $content;
} }
function getRegdate($format = 'Y.m.d H:i:s') { function getRegdate($format = 'Y.m.d H:i:s') {