From 0e336fc09258e255d8bc01daad703cde11dbcad2 Mon Sep 17 00:00:00 2001 From: Michael Johnston Date: Sat, 10 May 2014 00:54:59 -0400 Subject: add support for h1, h2, etc. to bbcode --- include/bbcode.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'include/bbcode.php') diff --git a/include/bbcode.php b/include/bbcode.php index 326676b72..17b25c206 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -507,6 +507,30 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { $Text = preg_replace("(\[size=(\d*?)\](.*?)\[\/size\])ism","$2",$Text); $Text = preg_replace("(\[size=(.*?)\](.*?)\[\/size\])ism","$2",$Text); } + // Check for h1 + if (strpos($Text,'[h1]') !== false) { + $Text = preg_replace("(\[h1\](.*?)\[\/h1\])ism",'

$1

',$Text); + } + // Check for h2 + if (strpos($Text,'[h2]') !== false) { + $Text = preg_replace("(\[h2\](.*?)\[\/h2\])ism",'

$1

',$Text); + } + // Check for h3 + if (strpos($Text,'[h3]') !== false) { + $Text = preg_replace("(\[h3\](.*?)\[\/h3\])ism",'

$1

',$Text); + } + // Check for h4 + if (strpos($Text,'[h4]') !== false) { + $Text = preg_replace("(\[h4\](.*?)\[\/h4\])ism",'

$1

',$Text); + } + // Check for h5 + if (strpos($Text,'[h5]') !== false) { + $Text = preg_replace("(\[h5\](.*?)\[\/h5\])ism",'
$1
',$Text); + } + // Check for h6 + if (strpos($Text,'[h6]') !== false) { + $Text = preg_replace("(\[h6\](.*?)\[\/h6\])ism",'
$1
',$Text); + } // Check for centered text if (strpos($Text,'[/center]') !== false) { $Text = preg_replace("(\[center\](.*?)\[\/center\])ism","
$1
",$Text); -- cgit v1.2.3