mirror of
https://github.com/friendica/friendica
synced 2025-05-09 01:04:13 +02:00
Fix errors in Content namespace
This commit is contained in:
parent
3c84c21318
commit
caa826ca06
8 changed files with 28 additions and 16 deletions
|
@ -114,6 +114,8 @@ class Plaintext
|
|||
$post['text'] = trim($item['title']);
|
||||
}
|
||||
|
||||
$abstract = '';
|
||||
|
||||
// Fetch the abstract from the given target network
|
||||
switch ($htmlmode) {
|
||||
case BBCode::TWITTER:
|
||||
|
@ -123,7 +125,7 @@ class Plaintext
|
|||
case BBCode::BLUESKY:
|
||||
$abstract = BBCode::getAbstract($item['body'], Protocol::BLUESKY);
|
||||
break;
|
||||
|
||||
|
||||
default: // We don't know the exact target.
|
||||
// We fetch an abstract since there is a posting limit.
|
||||
if ($limit > 0) {
|
||||
|
@ -246,6 +248,9 @@ class Plaintext
|
|||
$limit = $baselimit;
|
||||
|
||||
while ($message) {
|
||||
$word = $message;
|
||||
$message = '';
|
||||
$pos = 0;
|
||||
$pos_word = mb_strpos($message, ' ');
|
||||
$pos_paragraph = mb_strpos($message, "\n");
|
||||
|
||||
|
@ -255,9 +260,6 @@ class Plaintext
|
|||
$pos = $pos_word + 1;
|
||||
} elseif ($pos_paragraph !== false) {
|
||||
$pos = $pos_paragraph + 1;
|
||||
} else {
|
||||
$word = $message;
|
||||
$message = '';
|
||||
}
|
||||
|
||||
if (trim($message)) {
|
||||
|
@ -272,7 +274,7 @@ class Plaintext
|
|||
$break = mb_strrpos($word, "\n") !== false;
|
||||
if (!$break && (mb_strrpos($word, '. ') !== false || mb_strrpos($word, '? ') !== false || mb_strrpos($word, '! ') !== false)) {
|
||||
$break = IntlChar::isupper(mb_substr($message, 0, 1));
|
||||
}
|
||||
}
|
||||
|
||||
$comma = (mb_strrpos($word, ', ') !== false) && IntlChar::isalpha(mb_substr($message, 0, 1));
|
||||
|
||||
|
@ -291,7 +293,7 @@ class Plaintext
|
|||
$break_pos = 0;
|
||||
$comma_pos = 0;
|
||||
} elseif ($break) {
|
||||
$break_pos = $pos + mb_strlen($part);
|
||||
$break_pos = $pos + mb_strlen($part);
|
||||
} elseif ($comma) {
|
||||
$comma_pos = $pos + mb_strlen($part);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue