From b12d4c03cbc2627774b279f17a413860d868e854 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 4 Dec 2016 12:51:23 +0100 Subject: fixes for toc bbcode and bbcode wiki toc --- include/bbcode.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 6794fca96..396cbcb29 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -824,12 +824,14 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) $Text = preg_replace("(\[h6\](.*?)\[\/h6\])ism",'
$1
',$Text); } // Check for table of content without params - if (strpos($Text,'[toc]') !== false) { - $Text = preg_replace("/\[toc\]/ism",'',$Text); + while(strpos($Text,'[toc]') !== false) { + $toc_id = 'toc-' . random_string(10); + $Text = preg_replace("/\[toc\]/ism", '' . t('Contents:') . '', $Text, 1); } // Check for table of content with params - if (strpos($Text,'[toc') !== false) { - $Text = preg_replace("/\[toc([^\]]+?)\]/ism",'',$Text); + while(strpos($Text,'[toc') !== false) { + $toc_id = 'toc-' . random_string(10); + $Text = preg_replace("/\[toc([^\]]+?)\]/ism", '' . t('Contents:') . '', $Text, 1); } // Check for centered text if (strpos($Text,'[/center]') !== false) { -- cgit v1.2.3