1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 01:24:17 +02:00

Use less brackets

This commit is contained in:
Jakub Vrana
2025-02-23 17:04:43 +01:00
parent 3ad62d55c8
commit 004ac1c782

View File

@@ -94,12 +94,12 @@ if ($in) {
function pre_tr($s) {
return preg_replace('~^~m', '<tr>', preg_replace('~\|~', '<td>', preg_replace('~\|$~m', "", rtrim($s))));
}
$table = '(?:\+--[-+]+\+\n)';
$row = '(?:\| .* \|\n)';
$table = '(\+--[-+]+\+\n)';
$row = '(\| .* \|\n)';
echo
preg_replace_callback("~^($table?)($row)$table?($row*)$table?~m", function ($match) {
preg_replace_callback("~^$table?$row$table?($row*)$table?~m", function ($match) {
$first_row = pre_tr($match[2]);
return "<table>\n" . ($match[1] ? "<thead>$first_row</thead>\n" : $first_row) . pre_tr($match[3]) . "\n</table>";
return "<table>\n" . ($match[1] ? "<thead>$first_row</thead>\n" : $first_row) . pre_tr($match[4]) . "\n</table>";
},
preg_replace('~(\n( -|mysql)&gt; )(.+)~', "\\1<code class='jush-sql'>\\3</code>",
preg_replace('~(.+)\n---+\n~', "<b>\\1</b>\n",