From 051771c4e28723208384db0b15f40905323e14ee Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 27 Dec 2019 06:09:09 +0000 Subject: [PATCH] Standards --- markdown/markdown.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/markdown/markdown.php b/markdown/markdown.php index 9bebf64f..bd0e022c 100644 --- a/markdown/markdown.php +++ b/markdown/markdown.php @@ -53,21 +53,21 @@ function markdown_post_local_start(App $a, &$request) { $elements = ['code', 'noparse', 'nobb', 'pre']; foreach ($elements as $element) { $request['body'] = preg_replace_callback("/\[" . $element . "\](.*?)\[\/" . $element . "\]/ism", - function ($match) use ($element) { - return '[base64' . $element . ']' . base64_encode($match[1]) . '[/base64' . $element . ']'; - }, - $request['body'] - ); + function ($match) use ($element) { + return '[base64' . $element . ']' . base64_encode($match[1]) . '[/base64' . $element . ']'; + }, + $request['body'] + ); } $request['body'] = Markdown::toBBCode($request['body']); - foreach ($elements as $element) { + foreach (array_reverse($elements) as $element) { $request['body'] = preg_replace_callback("/\[base64" . $element . "\](.*?)\[\/base64" . $element . "\]/ism", - function ($match) use ($element) { - return '[' . $element . ']' . base64_decode($match[1]) . '[/' . $element . ']'; - }, - $request['body'] - ); + function ($match) use ($element) { + return '[' . $element . ']' . base64_decode($match[1]) . '[/' . $element . ']'; + }, + $request['body'] + ); } } -- 2.39.5