mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
'getSummary 개선' 추가 적용
This commit is contained in:
parent
855e4ce9f1
commit
eb339c8101
3 changed files with 45 additions and 53 deletions
|
|
@ -416,30 +416,22 @@ class commentItem extends Object
|
|||
*/
|
||||
function getSummary($str_size = 50, $tail = '...')
|
||||
{
|
||||
$content = $this->getContent(FALSE, FALSE);
|
||||
|
||||
// for newline, insert a blank.
|
||||
$content = preg_replace('!(<br[\s]*/{0,1}>[\s]*)+!is', ' ', $content);
|
||||
|
||||
// replace tags such as </p> , </div> , </li> by blanks.
|
||||
$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 blanks
|
||||
$content = preg_replace('/ ( +)/is', ' ', $content);
|
||||
|
||||
// truncate strings
|
||||
$content = trim(cut_str($content, $str_size, $tail));
|
||||
|
||||
// restore >, <, , "\
|
||||
$content = str_replace(array('<', '>', '"'), array('<', '>', '"'), $content);
|
||||
|
||||
return $content;
|
||||
$content = strip_tags($this->getContent(false, false));
|
||||
|
||||
// Convert temporarily html entity for truncate
|
||||
$content = html_entity_decode($content, ENT_QUOTES);
|
||||
|
||||
// Replace unicode whitespace characters (no-break space)
|
||||
$content = utf8_normalize_spaces($content);
|
||||
|
||||
// Replace all whitespaces to single space
|
||||
$content = trim(preg_replace('/\s+/', ' ', $content));
|
||||
|
||||
// Truncate string
|
||||
$content = cut_str($content, $str_size, $tail);
|
||||
|
||||
return escape($content);
|
||||
}
|
||||
|
||||
function getRegdate($format = 'Y.m.d H:i:s', $conversion = true)
|
||||
|
|
|
|||
|
|
@ -447,22 +447,22 @@ class content extends WidgetHandler
|
|||
|
||||
function _getSummary($content, $str_size = 50)
|
||||
{
|
||||
$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 Tag
|
||||
$content = preg_replace('!<([^>]*?)>!is','', $content);
|
||||
// Replace tags to <, >, " and whitespace
|
||||
$content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content);
|
||||
// Delete a series of whitespaces
|
||||
$content = preg_replace('/ ( +)/is', ' ', $content);
|
||||
// Remove tags
|
||||
$content = strip_tags($content);
|
||||
|
||||
// Convert temporarily html entity for truncate
|
||||
$content = html_entity_decode($content, ENT_QUOTES);
|
||||
|
||||
// Replace unicode whitespace characters (no-break space)
|
||||
$content = utf8_normalize_spaces($content);
|
||||
|
||||
// Replace all whitespaces to single space
|
||||
$content = trim(preg_replace('/\s+/', ' ', $content));
|
||||
|
||||
// Truncate string
|
||||
$content = trim(cut_str($content, $str_size, $tail));
|
||||
// Replace back <, >, " to the original tags
|
||||
$content = str_replace(array('<','>','"'),array('<','>','"'), $content);
|
||||
// Fixed to a newline bug for consecutive sets of English letters
|
||||
$content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$content);
|
||||
return $content;
|
||||
$content = cut_str($content, $str_size, '...');
|
||||
|
||||
return escape($content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -379,22 +379,22 @@ class mcontent extends WidgetHandler
|
|||
|
||||
function _getSummary($content, $str_size = 50)
|
||||
{
|
||||
$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 Tag
|
||||
$content = preg_replace('!<([^>]*?)>!is','', $content);
|
||||
// Replace tags to < , > , "
|
||||
$content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content);
|
||||
// Delete a series of whitespaces
|
||||
$content = preg_replace('/ ( +)/is', ' ', $content);
|
||||
// Remove tags
|
||||
$content = strip_tags($content);
|
||||
|
||||
// Convert temporarily html entity for truncate
|
||||
$content = html_entity_decode($content, ENT_QUOTES);
|
||||
|
||||
// Replace unicode whitespace characters (no-break space)
|
||||
$content = utf8_normalize_spaces($content);
|
||||
|
||||
// Replace all whitespaces to single space
|
||||
$content = trim(preg_replace('/\s+/', ' ', $content));
|
||||
|
||||
// Truncate string
|
||||
$content = trim(cut_str($content, $str_size, $tail));
|
||||
// Replace back < , > , " to theoriginal tags
|
||||
$content = str_replace(array('<','>','"'),array('<','>','"'), $content);
|
||||
// Fixed a newline bug on a set of consecutive English letters
|
||||
$content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$content);
|
||||
return $content;
|
||||
$content = cut_str($content, $str_size, '...');
|
||||
|
||||
return escape($content);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue