mirror of
https://github.com/friendica/friendica
synced 2025-04-24 01:50:17 +00:00
Improve BBCode:toPlaintext
- Fix issue where matching literal square brackets were removed with their content - Fix issue where content without line feeds between BBCode tags would end up compacted in plain text - Update extr calls to BBCode::toPlaintext in api
This commit is contained in:
parent
a0f77e1800
commit
c3e3e83a52
2 changed files with 3 additions and 6 deletions
|
@ -357,10 +357,7 @@ class BBCode extends BaseObject
|
|||
*/
|
||||
public static function toPlaintext($text, $keep_urls = true)
|
||||
{
|
||||
$naked_text = preg_replace('/\[.+?\]/','', $text);
|
||||
if (!$keep_urls) {
|
||||
$naked_text = preg_replace('#https?\://[^\s<]+[^\s\.\)]#i', '', $naked_text);
|
||||
}
|
||||
$naked_text = HTML::toPlaintext(BBCode::convert($text, false, 0, true), 0, !$keep_urls);
|
||||
|
||||
return $naked_text;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue