diff options
author | friendica <info@friendica.com> | 2012-03-28 15:08:15 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-03-28 15:08:15 -0700 |
commit | 75f3d41da2d85cb61ac627807011c312b96e3bb1 (patch) | |
tree | 2bee850bc2c4c8fcc3e5e53fd941dc77ecbf8d6d /include/bbcode.php | |
parent | a2b1aca27c936991d02ab10d97f1f7980500c460 (diff) | |
parent | bdd275474044152a5d9a33ea6b8a8071b931d27e (diff) | |
download | volse-hubzilla-75f3d41da2d85cb61ac627807011c312b96e3bb1.tar.gz volse-hubzilla-75f3d41da2d85cb61ac627807011c312b96e3bb1.tar.bz2 volse-hubzilla-75f3d41da2d85cb61ac627807011c312b96e3bb1.zip |
Merge pull request #184 from annando/master
Enhancing the API - Preparations for a better facebook export
Diffstat (limited to 'include/bbcode.php')
-rw-r--r-- | include/bbcode.php | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index d69cb263f..9befbd0f7 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 = '<blockquote class="spoiler">$1</blockquote>'; + + // 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", + "<br /><strong class=".'"spoiler"'.">" . $t_wrote . "</strong><blockquote class=".'"spoiler"'.">$2</blockquote>", + $Text); + // Declare the format for [quote] layout $QuoteLayout = '<blockquote>$1</blockquote>'; + // Check for [quote] text // handle nested quotes $endlessloop = 0; @@ -205,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", - "<blockquote><strong>" . $t_wrote . "</strong> $2</blockquote>", + "<br /><strong class=".'"author"'.">" . $t_wrote . "</strong><blockquote class=".'"author"'.">$2</blockquote>", $Text); // [img=widthxheight]image source[/img] |