diff --git a/e107_core/bbcodes/table.bb b/e107_core/bbcodes/table.bb index efe0f5f58..6762e613f 100644 --- a/e107_core/bbcodes/table.bb +++ b/e107_core/bbcodes/table.bb @@ -1,4 +1,10 @@ //getClass('table'); -return "".$code_text."
"; +if($parm) +{ + return "".trim($code_text)."
"; +} + +return "".trim($code_text)."
"; diff --git a/e107_core/bbcodes/tbody.bb b/e107_core/bbcodes/tbody.bb index c027d4571..2a366d6d3 100644 --- a/e107_core/bbcodes/tbody.bb +++ b/e107_core/bbcodes/tbody.bb @@ -1,4 +1,4 @@ //getClass('tbody'); -return "".$code_text."\n"; +return "".trim($code_text).""; diff --git a/e107_handlers/bbcode_handler.php b/e107_handlers/bbcode_handler.php index 43276ee48..8f949ca81 100644 --- a/e107_handlers/bbcode_handler.php +++ b/e107_handlers/bbcode_handler.php @@ -44,7 +44,7 @@ class e_bbcode 'b', 'justify', 'file', 'stream', 'textarea', 'list', 'php', 'time', 'spoiler', 'hide', 'youtube', 'sanitised', - 'p', 'h', 'nobr', 'block', + 'p', 'h', 'nobr', 'block','table','tr','tbody','td' ); foreach($this->core_bb as $c) @@ -507,7 +507,7 @@ class e_bbcode /** * Convert HTML to bbcode. */ - function htmltoBbcode($text) + function htmltoBBcode($text) { //return $text; $convert = array( @@ -525,7 +525,22 @@ class e_bbcode array( "[/b]", ''), array( "[i]", ''), // e107 bbcode markup array( "[i]", ''), - array( "[/i]", ''), + array( "[/i]", ''), + array( "[block]", '
'), + array( "[/block]", '
'), + array( "[table]\n", ''), + array( "[/table]", '
'), + array( "[table]\n", ''), + array( "[tbody]\n", ''), + array( "[tr]", ''), + array( "\n\t[td]", ''), + array( "[/tbody]\n", ''), + array( "[tr]", ''), + array( "\n[/tr]\n", ''), + array( "\n\t[td]", ''), ); foreach($convert as $arr) @@ -541,6 +556,9 @@ class e_bbcode $text = preg_replace('//i',"[img style=width:$4px;height:$5px;$1]$2[/img]",$text ); $text = preg_replace('/(.*?)<\/span>/i',"[color=$1]$2[/color]",$text); $text = preg_replace('/(.*?)<\/span>/i',"[u]$1[/u]",$text); + // $text = preg_replace('//i', "[table $1]",$text); + $text = preg_replace('/
'), + + array( "[tbody]\n", '
'), + array( "[/td]", '
/i', "[tbody]\n",$text); $blank = array('','width:px;height:px;'); diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 676a6ce09..b2995a7d6 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -1333,7 +1333,7 @@ class e_parse { // Split each text block into bits which are either within one of the 'key' bbcodes, or outside them // (Because we have to match end words, the 'extra' capturing subpattern gets added to output array. We strip it later) - $content = preg_split('#(\[(html|php|code|scode|hide).*?\[/(?:\\2)\])#mis', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); + $content = preg_split('#(\[(table|html|php|code|scode|hide).*?\[/(?:\\2)\])#mis', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); } @@ -1357,7 +1357,7 @@ class e_parse // Have to have a good test in case a 'non-key' bbcode starts the block // - so pull out the bbcode parameters while we're there - if (($parseBB !== FALSE) && preg_match('#(^\[(html|php|code|scode|hide)(.*?)\])(.*?)(\[/\\2\]$)#is', $full_text, $matches )) + if (($parseBB !== FALSE) && preg_match('#(^\[(table|html|php|code|scode|hide)(.*?)\])(.*?)(\[/\\2\]$)#is', $full_text, $matches )) { // It's one of the 'key' bbcodes // Usually don't want 'normal' processing if its a 'special' bbcode @@ -1402,6 +1402,11 @@ class e_parse $proc_funcs = TRUE; $convertNL = FALSE; break; + + case 'table' : // strip
from end of
+ + $convertNL = FALSE; + // break; case 'hide' : $proc_funcs = TRUE; @@ -1473,7 +1478,7 @@ class e_parse // Could put tag stripping in here - + /* // Line break compression - filter white space after HTML tags - among other things, ensures HTML tables display properly // Hopefully now achieved by other means @@ -1665,7 +1670,6 @@ class e_parse } } - if ($convertNL) { // Default replaces all \n with
for HTML display diff --git a/e107_plugins/tinymce/plugins/e107bbcode/parser.php b/e107_plugins/tinymce/plugins/e107bbcode/parser.php index caf464ee5..560aea73e 100644 --- a/e107_plugins/tinymce/plugins/e107bbcode/parser.php +++ b/e107_plugins/tinymce/plugins/e107bbcode/parser.php @@ -20,7 +20,7 @@ if($_POST['mode'] == 'tohtml') if($_POST['mode'] == 'tobbcode') { //echo $_POST['content']; - echo e107::getBB()->htmltoBbcode($_POST['content']); + echo e107::getBB()->htmltoBBcode($_POST['content']); }