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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user