fix: various small fixes (#3578)

This commit is contained in:
Dag 2023-07-29 00:14:30 +02:00 committed by GitHub
parent 11ce8b5dcd
commit 701fe3cfed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 87 additions and 39 deletions

View file

@ -80,10 +80,15 @@ class FilterBridge extends FeedExpander
// Generate title from first 50 characters of content?
if ($this->getInput('title_from_content') && array_key_exists('content', $item)) {
$content = str_get_html($item['content']);
$pos = strpos($item['content'], ' ', 50);
$item['title'] = substr($content->plaintext, 0, $pos);
if (strlen($content->plaintext) >= $pos) {
$item['title'] .= '...';
$plaintext = $content->plaintext;
if (mb_strlen($plaintext) < 51) {
$item['title'] = $plaintext;
} else {
$pos = strpos($item['content'], ' ', 50);
$item['title'] = substr($plaintext, 0, $pos);
if (strlen($plaintext) >= $pos) {
$item['title'] .= '...';
}
}
}