#374 문자열 자를때 html코드에 대한 대비를 하고 자르게 하여 가능한 정상적으로 노출되도록 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3517 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-01-09 07:25:55 +00:00
parent bfeaa26f77
commit 756d83e349
2 changed files with 21 additions and 5 deletions

View file

@ -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('&lt;','&gt;','&quot;','&nbsp;'), array('<','>','"',' '), $content);
// 문자열을 자름
$content = cut_str($content, $str_size, '...');
// >, <, "를 다시 복구
return str_replace(array('<','>','"',' '),array('&lt;','&gt;','&quot;','&nbsp;'), $content);
}
function getRegdate($format = 'Y.m.d H:i:s') {