diff --git a/include/bbcode.php b/include/bbcode.php index 9fce895b8d..9befbd0f79 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -198,6 +198,17 @@ function bbcode($Text,$preserve_nl = false) { while ((strpos($Text, "[/spoiler]") !== false) and (strpos($Text, "[spoiler]") !== false) and (++$endlessloop < 20)) $Text = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/ism","$SpoilerLayout", $Text); + // Check for [spoiler=Author] text + + $t_wrote = t('$1 wrote:'); + + // handle nested quotes + $endlessloop = 0; + while ((strpos($Text, "[/spoiler]")!== false) and (strpos($Text, "[spoiler=") !== false) and (++$endlessloop < 20)) + $Text = preg_replace("/\[spoiler=[\"\']*(.*?)[\"\']*\](.*?)\[\/spoiler\]/ism", + "
" . $t_wrote . "
$2
", + $Text); + // Declare the format for [quote] layout $QuoteLayout = '
$1
'; @@ -215,7 +226,7 @@ function bbcode($Text,$preserve_nl = false) { $endlessloop = 0; while ((strpos($Text, "[/quote]")!== false) and (strpos($Text, "[quote=") !== false) and (++$endlessloop < 20)) $Text = preg_replace("/\[quote=[\"\']*(.*?)[\"\']*\](.*?)\[\/quote\]/ism", - "
" . $t_wrote . " $2
", + "
" . $t_wrote . "
$2
", $Text); // [img=widthxheight]image source[/img] diff --git a/include/text.php b/include/text.php index bcd567a154..0497719498 100644 --- a/include/text.php +++ b/include/text.php @@ -968,12 +968,23 @@ function prepare_body($item,$attach = false) { $pos = strpos($s, $spoilersearch); $rnd = random_string(8); - $spoilerreplace = ''.sprintf(t('Click to open/close')).''. + $spoilerreplace = '
'.sprintf(t('Click to open/close')).''. '