1
0
mirror of https://github.com/e107inc/e107.git synced 2025-06-05 10:25:17 +02:00

TinyMce html->bbcode cleanup

This commit is contained in:
CaMer0n 2012-07-11 05:14:09 +00:00
parent f67cfc40d9
commit ab11d260ee
2 changed files with 11 additions and 30 deletions

View File

@ -193,7 +193,7 @@ else
:-moz-placeholder { font-style:italic; color: #bbb; }
h2 { text-align: center; color: #FAAD3D; text-shadow: #000 1px 1px 1px; }
h2 { text-align: center; color: #FAAD3D; }
#username {background: url(".e_IMAGE."admin_images/admins_16.png) no-repeat scroll 7px 7px; padding-left:30px; }

View File

@ -552,63 +552,44 @@ class e_bbcode
$text = preg_replace('/<table([\w :\-_;="]*)?>/i', "[table]\n",$text);
$text = preg_replace('/<tbody([\w ="]*)?>/i', "[tbody]\n",$text);
$text = preg_replace('/<code([\w :\-_;="]*)?>/i', "[code]\n",$text);
$text = preg_replace('/<strong([\w :\-_;="]*)?>/i', "[b]",$text);
$text = preg_replace('/<em([\w :\-_;="]*)?>/i', "[i]",$text);
$text = preg_replace('/<li([\w :\-_;="]*)?>/i', "\n[*]",$text);
$text = preg_replace('/<ul([\w :\-_;="]*)?>/i', "[list]",$text);
$text = preg_replace('/<table([\w :\-_;="]*)?>/i', "[table]\n",$text);
$text = preg_replace('/<tbody([\w :\-_;="]*)?>/i', "[tbody]\n",$text);
$text = preg_replace('/<tr([\w :\-_;="]*)?>/i', "[tr]",$text);
$text = preg_replace('/<td([\w :\-_;="]*)?>/i', "\n\t[td]",$text);
$text = preg_replace('/<blockquote([\w :\-_;="]*)?>/i', "[blockquote]",$text);
$ehttp = str_replace("/",'\/',e_HTTP);
$text = preg_replace('/thumb.php\?src='.$ehttp.'([^&]*)([^\[]*)/i', "$1",$text);
$text = preg_replace('/thumb.php\?src=([^&]*)([^\[]*)/i', "$1",$text);
//return $text;
// Mostly closing tags.
$convert = array(
array( "\n", '<br />'),
array( "[list]", '<ul class="bbcode">'),
array( "[list]", '<ul>'),
array( "\n[/list]", '</ul>'),
array( "\n[*]", '<li>'),
array( "\n[*]", '<li class="bbcode bbcode-list">'),
array( "[h=2]", '<h2 class="bbcode-center" style="text-align: center;">'), // e107 bbcode markup
array( "[h=2]", '<h2>'),
array( "[/h]", '</h2>'),
array( "[h=3]", '<h3 class="bbcode-center" style="text-align: center;">'), // e107 bbcode markup
array( "[h=3]", '<h3>'),
array( "[/h]", '</h3>'),
array( "[b]", '<strong>'), // Tinymce markup
array( "[b]", '<strong class="bbcode bold bbcode-b">'), // e107 bbcode markup
array( "[/b]", '</strong>'),
array( "[i]", '<em class="bbcode italic bbcode-i">'), // e107 bbcode markup
array( "[i]", '<em>'),
array( "[/i]", '</em>'),
array( "[block]", '<div>'),
array( "[/block]", '</div>'),
array( "[table]\n", '<table>'),
array( "[/table]\n", '</table>'),
array( "[table]\n", '<table class="bbcode-table">'),
array( "[tbody]\n", '<tbody class="bbcode-tbody">'),
array( "[tr]", '<tr class="bbcode-tr">'),
array( "\n\t[td]", '<td class="bbcode-td">'),
array( "[tbody]\n", '<tbody>'),
array( "[/tbody]\n", '</tbody>'),
array( "[code]\n", '<code>'),
array( "[/code]\n", '</code>'),
array( "[tr]", '<tr>'),
array( "\n[/tr]\n", '</tr>'),
array( "\n\t[td]", '<td>'),
array( "[/td]", '</td>'),
array( "[blockquote]", '<blockquote>'),
array( "[blockquote]", '<blockquote class="indent bbcode-blockquote">'),
array( "[/blockquote]",'</blockquote>'),
array( "]", ' style=]')
);
// thumb.php?src
foreach($convert as $arr)
{
$repl[] = $arr[0];