From c034fa7baa30e10ebbc6974aea58966ae983a5bb Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 12 Sep 2019 22:17:55 -0400 Subject: [PATCH 1/2] Use
tag for spoilers BCode --- src/Content/Text/BBCode.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 65d037b83..02c955102 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1475,24 +1475,22 @@ class BBCode extends BaseObject $text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/sm", "$2", $text); // Declare the format for [spoiler] layout - $SpoilerLayout = '
$1
'; + $SpoilerLayout = '
' . L10n::t('Click to open/close') . '$1
'; // Check for [spoiler] text // handle nested quotes $endlessloop = 0; while ((strpos($text, "[/spoiler]") !== false) && (strpos($text, "[spoiler]") !== false) && (++$endlessloop < 20)) { - $text = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/ism", "$SpoilerLayout", $text); + $text = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/ism", $SpoilerLayout, $text); } - // Check for [spoiler=Author] text - - $t_wrote = L10n::t('$1 wrote:'); + // Check for [spoiler=Title] text // handle nested quotes $endlessloop = 0; while ((strpos($text, "[/spoiler]")!== false) && (strpos($text, "[spoiler=") !== false) && (++$endlessloop < 20)) { $text = preg_replace("/\[spoiler=[\"\']*(.*?)[\"\']*\](.*?)\[\/spoiler\]/ism", - "
" . $t_wrote . "
$2
", + '
$1$2
', $text); } From f5eb8e88f17e0f252f2d9b59410754cd18362a58 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 12 Sep 2019 22:18:46 -0400 Subject: [PATCH 2/2] Remove obsolete blockquote replacement in Item::prepareBody --- src/Model/Item.php | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 22859f76b..b5c68d9ab 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -3509,37 +3509,6 @@ class Item extends BaseObject } } - - // Look for spoiler. - $spoilersearch = '
'; - - // Remove line breaks before the spoiler. - while ((strpos($s, "\n" . $spoilersearch) !== false)) { - $s = str_replace("\n" . $spoilersearch, $spoilersearch, $s); - } - while ((strpos($s, "
" . $spoilersearch) !== false)) { - $s = str_replace("
" . $spoilersearch, $spoilersearch, $s); - } - - while ((strpos($s, $spoilersearch) !== false)) { - $pos = strpos($s, $spoilersearch); - $rnd = Strings::getRandomHex(8); - $spoilerreplace = '
' . L10n::t('Click to open/close') . ''. - '