1
0
Fork 0

Simplify BBCode::toPlaintext

- Keep white spaces after tags
This commit is contained in:
Hypolite Petovan 2019-05-27 12:02:12 -04:00
parent 596b5b0982
commit 5f9fb1f14f

View file

@ -355,7 +355,7 @@ class BBCode extends BaseObject
*/ */
public static function toPlaintext($text, $keep_urls = true) public static function toPlaintext($text, $keep_urls = true)
{ {
$naked_text = preg_replace('/\[(.+?)\]\s*/','', $text); $naked_text = preg_replace('/\[.+?\]/','', $text);
if (!$keep_urls) { if (!$keep_urls) {
$naked_text = preg_replace('#https?\://[^\s<]+[^\s\.\)]#i', '', $naked_text); $naked_text = preg_replace('#https?\://[^\s<]+[^\s\.\)]#i', '', $naked_text);
} }