mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 19:21:40 +09:00
getSummary 개선
No-break space 문자에 대한 처리가 제대로 되지 않아 띄워쓰기가 엉망으로 표시되었던 문제 수정
This commit is contained in:
parent
07ede48e7c
commit
f4db8adddb
1 changed files with 15 additions and 25 deletions
|
|
@ -630,37 +630,27 @@ class documentItem extends Object
|
|||
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
function getSummary($str_size = 50, $tail = '...')
|
||||
{
|
||||
$content = $this->getContent(FALSE, FALSE);
|
||||
// Remove tags
|
||||
$content = strip_tags($this->getContent(false, false));
|
||||
|
||||
// Remove html entity of No-break space
|
||||
$content = str_replace(' ', ' ', $content);
|
||||
|
||||
// Remove whitespaces and No-break space character
|
||||
$content = trim(preg_replace('/\s+|[\\pZ\\pC]+/u', ' ', $content));
|
||||
|
||||
// Convert temporarily html entity for truncate
|
||||
$content = htmlspecialchars_decode($content, ENT_QUOTES);
|
||||
|
||||
$content = nl2br($content);
|
||||
|
||||
// For a newlink, inert a whitespace
|
||||
$content = preg_replace('!(<br[\s]*/{0,1}>[\s]*)+!is', ' ', $content);
|
||||
|
||||
// Replace tags such as </p> , </div> , </li> and others to a whitespace
|
||||
$content = str_replace(array('</p>', '</div>', '</li>', '-->'), ' ', $content);
|
||||
|
||||
// Remove Tags
|
||||
$content = preg_replace('!<([^>]*?)>!is', '', $content);
|
||||
|
||||
// Replace < , >, "
|
||||
$content = str_replace(array('<', '>', '"', ' '), array('<', '>', '"', ' '), $content);
|
||||
|
||||
// Delete a series of whitespaces
|
||||
$content = preg_replace('/ ( +)/is', ' ', $content);
|
||||
|
||||
// Truncate string
|
||||
$content = trim(cut_str($content, $str_size, $tail));
|
||||
|
||||
// Replace back < , <, "
|
||||
$content = str_replace(array('<', '>', '"'),array('<', '>', '"'), $content);
|
||||
|
||||
return $content;
|
||||
|
||||
return escape($content, false);
|
||||
}
|
||||
|
||||
|
||||
function getRegdate($format = 'Y.m.d H:i:s', $conversion = true)
|
||||
{
|
||||
return zdate($this->get('regdate'), $format, $conversion);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue