Only add spaces in getContentText() before complete </p> and </div> tags, not </pre>

https://xetown.com/questions/1817630
This commit is contained in:
Kijin Sung 2024-04-08 22:43:15 +09:00
parent 1bb0123e59
commit 41f4eada9d
2 changed files with 2 additions and 2 deletions

View file

@ -504,7 +504,7 @@ class CommentItem extends BaseObject
$content = $this->get('content');
}
$content = preg_replace('!(</p|</div|<br)!i', ' $1', $content);
$content = preg_replace('!(</p>|</div>|<br)!i', ' $1', $content);
$content = trim(utf8_normalize_spaces(html_entity_decode(strip_tags($content))));
if($strlen)
{

View file

@ -648,7 +648,7 @@ class DocumentItem extends BaseObject
return lang('msg_is_secret');
}
$content = preg_replace('!(</p|</div|<br)!i', ' $1', $this->get('content'));
$content = preg_replace('!(</p>|</div>|<br)!i', ' $1', $this->get('content'));
$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
if($strlen)