Restructured replacements

This commit is contained in:
Michael 2023-03-20 04:10:35 +00:00
parent 12d2de2c93
commit f65c71a25b

View File

@ -1312,7 +1312,8 @@ class BBCode
"\n[tr]", "[tr]\n", " [tr]", "[tr] ", "\n[/tr]", "[/tr]\n", " [/tr]", "[/tr] ",
"\n[hr]", "[hr]\n", " [hr]", "[hr] ",
"\n[attachment ", " [attachment ", "\n[/attachment]", "[/attachment]\n", " [/attachment]", "[/attachment] ",
"[table]\n", "[table] ", " [table]", "\n[/table]", " [/table]", "[/table] "
"[table]\n", "[table] ", " [table]", "\n[/table]", " [/table]", "[/table] ",
" \n", "\t\n", "[/li]\n", "\n[li]", "\n[*]",
];
$replace = [
"[th]", "[th]", "[th]", "[/th]", "[/th]", "[/th]",
@ -1320,7 +1321,8 @@ class BBCode
"[tr]", "[tr]", "[tr]", "[tr]", "[/tr]", "[/tr]", "[/tr]", "[/tr]",
"[hr]", "[hr]", "[hr]", "[hr]",
"[attachment ", "[attachment ", "[/attachment]", "[/attachment]", "[/attachment]", "[/attachment]",
"[table]", "[table]", "[table]", "[/table]", "[/table]", "[/table]"
"[table]", "[table]", "[table]", "[/table]", "[/table]", "[/table]",
"\n", "\n", "[/li]", "[li]", "[*]",
];
do {
$oldtext = $text;
@ -1338,11 +1340,11 @@ class BBCode
// removing multiplicated newlines
if (DI::config()->get('system', 'remove_multiplicated_lines')) {
$search = [
"\n\n\n", "\n ", " \n", "\n\t", "\t\n", "\n\r", "\r\n", "[/quote]\n\n", "\n[/quote]", "[/li]\n", "\n[li]", "\n[*]", "\n[ul]", "[/ul]\n", "\n\n[share ", "[/attachment]\n",
"\n\n\n", "[/quote]\n\n", "\n[/quote]", "\n[ul]", "[/ul]\n", "\n[ol]", "[/ol]\n", "\n\n[share ", "[/attachment]\n",
"\n[h1]", "[/h1]\n", "\n[h2]", "[/h2]\n", "\n[h3]", "[/h3]\n", "\n[h4]", "[/h4]\n", "\n[h5]", "[/h5]\n", "\n[h6]", "[/h6]\n"
];
$replace = [
"\n\n", "\n", "\n", "\n", "\n", "\n", "\n", "[/quote]\n", "[/quote]", "[/li]", "[li]", "[*]", "[ul]", "[/ul]", "\n[share ", "[/attachment]",
"\n\n", "[/quote]\n", "[/quote]", "[ul]", "[/ul]", "[ol]", "[/ol]", "\n[share ", "[/attachment]",
"[h1]", "[/h1]", "[h2]", "[/h2]", "[h3]", "[/h3]", "[h4]", "[/h4]", "[h5]", "[/h5]", "[h6]", "[/h6]"
];
do {