X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fbbcode.php;h=3697f1fc5d1dccbea26eb3c06f561e5e83edf60b;hb=a3d95f79f27ca73d657907ab42b51ecc50872089;hp=cff26f5c8ebf2864744db9fbc2c4f6866668f588;hpb=3d249f0eddb058f74b33d8205202b17ab7555aa6;p=friendica.git diff --git a/include/bbcode.php b/include/bbcode.php index cff26f5c8e..3697f1fc5d 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -189,8 +189,29 @@ function bbcode($Text,$preserve_nl = false) { // Check for [code] text $Text = preg_replace("/\[code\](.*?)\[\/code\]/ism","$CodeLayout", $Text); + // Declare the format for [spoiler] layout + $SpoilerLayout = '
$1'; + + // Check for [spoiler] text + // handle nested quotes + $endlessloop = 0; + 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", + "
$2", + $Text); + // Declare the format for [quote] layout $QuoteLayout = '
$1'; + // Check for [quote] text // handle nested quotes $endlessloop = 0; @@ -205,17 +226,21 @@ 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", + "
$2", $Text); // [img=widthxheight]image source[/img] - $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '