diff --git a/public/themes/bootstrap/scss/_common.scss b/public/themes/bootstrap/scss/_common.scss index 68dc6a7cce..59b371b8e3 100644 --- a/public/themes/bootstrap/scss/_common.scss +++ b/public/themes/bootstrap/scss/_common.scss @@ -1225,15 +1225,6 @@ input#auto_increment_opt { position: static; } - tbody td span { - display: block; - overflow: hidden; - - code span { - display: inline; - } - } - th.draggable { span { margin-right: 10px; @@ -2400,3 +2391,7 @@ body .ui-dialog { .table-responsive-md .data { z-index: 9; } + +pre { + margin: 0; +} diff --git a/public/themes/metro/scss/_common.scss b/public/themes/metro/scss/_common.scss index 61977561e0..5931e80b5c 100644 --- a/public/themes/metro/scss/_common.scss +++ b/public/themes/metro/scss/_common.scss @@ -1489,15 +1489,6 @@ input#auto_increment_opt { td { position: static; } - - tbody td span { - display: block; - overflow: hidden; - - code span { - display: inline; - } - } } .modal-copy input { @@ -2577,3 +2568,7 @@ body { .table-responsive-md .data { z-index: 9; } + +pre { + margin: 0; +} diff --git a/public/themes/original/scss/_common.scss b/public/themes/original/scss/_common.scss index 3be7de1598..7df89161dd 100644 --- a/public/themes/original/scss/_common.scss +++ b/public/themes/original/scss/_common.scss @@ -1229,15 +1229,6 @@ input#auto_increment_opt { td { position: static; } - - tbody td span { - display: block; - overflow: hidden; - - code span { - display: inline; - } - } } .modal-copy input { @@ -2402,3 +2393,7 @@ body { .table-responsive-md .data { z-index: 9; } + +pre { + margin: 0; +} diff --git a/public/themes/pmahomme/scss/_common.scss b/public/themes/pmahomme/scss/_common.scss index 65b2890cbe..f40decf86a 100644 --- a/public/themes/pmahomme/scss/_common.scss +++ b/public/themes/pmahomme/scss/_common.scss @@ -1432,15 +1432,6 @@ input#auto_increment_opt { position: static; } - tbody td span { - display: block; - overflow: hidden; - - code span { - display: inline; - } - } - th.draggable { span { margin-right: 10px; @@ -2553,3 +2544,7 @@ body .ui-dialog { .bg-secondary { color: #333; } + +pre { + margin: 0; +} diff --git a/resources/js/src/modules/sql-highlight.ts b/resources/js/src/modules/sql-highlight.ts index eb085e7da0..92cc0b21ad 100644 --- a/resources/js/src/modules/sql-highlight.ts +++ b/resources/js/src/modules/sql-highlight.ts @@ -459,15 +459,15 @@ export default function highlightSql ($base) { var $elm = $base.find('code.sql'); $elm.each(function () { var $sql = $(this); - var $pre = $sql.find('pre'); + var $pre = $sql.closest('pre'); /* We only care about visible elements to avoid double processing */ - if ($pre.is(':visible')) { + if ($sql.is(':visible')) { var $highlight = $('
'); - $sql.append($highlight); + $pre.append($highlight); if (typeof window.CodeMirror !== 'undefined') { // @ts-ignore window.CodeMirror.runMode($sql.text(), 'text/x-mysql', $highlight[0]); - $pre.hide(); + $sql.hide(); $highlight.find('.cm-keyword').each(documentationKeyword); $highlight.find('.cm-builtin').each(documentationBuiltin); } diff --git a/resources/js/src/transformations/json.ts b/resources/js/src/transformations/json.ts index 8c18dbe56b..e2df1dbf59 100644 --- a/resources/js/src/transformations/json.ts +++ b/resources/js/src/transformations/json.ts @@ -8,14 +8,14 @@ AJAX.registerOnload('transformations/json.js', function () { var $elm = $('#page_content').find('code.json'); $elm.each(function () { var $json = $(this); - var $pre = $json.find('pre'); + var $pre = $json.closest('pre'); /* We only care about visible elements to avoid double processing */ - if ($pre.is(':visible')) { + if ($json.is(':visible')) { var $highlight = $(''); - $json.append($highlight); + $pre.append($highlight); // @ts-ignore window.CodeMirror.runMode($json.text(), 'application/json', $highlight[0]); - $pre.hide(); + $json.hide(); } }); }); diff --git a/resources/js/src/transformations/xml.ts b/resources/js/src/transformations/xml.ts index c19ab11205..627fd9deb0 100644 --- a/resources/js/src/transformations/xml.ts +++ b/resources/js/src/transformations/xml.ts @@ -8,14 +8,14 @@ AJAX.registerOnload('transformations/xml.js', function () { var $elm = $('#page_content').find('code.xml'); $elm.each(function () { var $json = $(this); - var $pre = $json.find('pre'); + var $pre = $json.closest('pre'); /* We only care about visible elements to avoid double processing */ - if ($pre.is(':visible')) { + if ($json.is(':visible')) { var $highlight = $(''); - $json.append($highlight); + $pre.append($highlight); // @ts-ignore window.CodeMirror.runMode($json.text(), 'application/xml', $highlight[0]); - $pre.hide(); + $json.hide(); } }); }); diff --git a/src/Html/Generator.php b/src/Html/Generator.php index e8a7a89be3..d4b1dc3a0c 100644 --- a/src/Html/Generator.php +++ b/src/Html/Generator.php @@ -450,12 +450,12 @@ class Generator /* SQL-Parser-Analyzer */ if (Sql::$showAsPhp === true) { - $newLine = '\\n"' . "\n"
- . '$sql = "' . $queryBase . '";' . "\n"
- . '
';
+ $queryBase = ''
+ . '$sql = "' . $queryBase . '";'
+ . '';
} else {
$queryBase = self::formatSql($sqlQuery, true);
}
@@ -1072,9 +1072,9 @@ class Generator
$sqlQuery = mb_substr($sqlQuery, 0, $config->settings['MaxCharactersInDisplayedSQL']) . '[...]';
}
- return '' . "\n"
- . htmlspecialchars($sqlQuery, ENT_COMPAT) . "\n"
- . '
';
+ return ''
+ . htmlspecialchars($sqlQuery, ENT_COMPAT)
+ . '';
}
/**
diff --git a/src/Plugins/Transformations/Output/Text_Plain_Json.php b/src/Plugins/Transformations/Output/Text_Plain_Json.php
index f0ac9af633..73506f2aa6 100644
--- a/src/Plugins/Transformations/Output/Text_Plain_Json.php
+++ b/src/Plugins/Transformations/Output/Text_Plain_Json.php
@@ -52,9 +52,7 @@ class Text_Plain_Json extends TransformationsPlugin
*/
public function applyTransformation(string $buffer, array $options = [], FieldMetadata|null $meta = null): string
{
- return '' . "\n"
- . htmlspecialchars($buffer) . "\n"
- . '
';
+ return '' . htmlspecialchars($buffer) . '';
}
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
diff --git a/src/Plugins/Transformations/Output/Text_Plain_Xml.php b/src/Plugins/Transformations/Output/Text_Plain_Xml.php
index b44c917246..ac4b6d69e1 100644
--- a/src/Plugins/Transformations/Output/Text_Plain_Xml.php
+++ b/src/Plugins/Transformations/Output/Text_Plain_Xml.php
@@ -52,9 +52,7 @@ class Text_Plain_Xml extends TransformationsPlugin
*/
public function applyTransformation(string $buffer, array $options = [], FieldMetadata|null $meta = null): string
{
- return '' . "\n"
- . htmlspecialchars($buffer) . "\n"
- . '
';
+ return '' . htmlspecialchars($buffer) . '';
}
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
diff --git a/tests/unit/Controllers/Server/PrivilegesControllerTest.php b/tests/unit/Controllers/Server/PrivilegesControllerTest.php
index 787dfdad77..c1884cb30c 100644
--- a/tests/unit/Controllers/Server/PrivilegesControllerTest.php
+++ b/tests/unit/Controllers/Server/PrivilegesControllerTest.php
@@ -148,10 +148,10 @@ class PrivilegesControllerTest extends AbstractTestCase
self::assertStringContainsString("You have updated the privileges for 'pma_test'@'localhost'.", $output);
// phpcs:disable Generic.Files.LineLength.TooLong
- $expectedSql = '' . "\n" + $expectedSql = ''; // phpcs:enable self::assertStringContainsString($expectedSql, $output); diff --git a/tests/unit/Controllers/Table/FindReplaceControllerTest.php b/tests/unit/Controllers/Table/FindReplaceControllerTest.php index 8ba1840dfa..ff55100254 100644 --- a/tests/unit/Controllers/Table/FindReplaceControllerTest.php +++ b/tests/unit/Controllers/Table/FindReplaceControllerTest.php @@ -54,10 +54,10 @@ final class FindReplaceControllerTest extends AbstractTestCase $controller($request); self::assertStringContainsString( - ''; + . "REVOKE ALL PRIVILEGES ON `test_db_2`.* FROM 'pma_test'@'localhost'; REVOKE GRANT OPTION ON `test_db_2`.* FROM 'pma_test'@'localhost'; GRANT SELECT ON `test_db_2`.* TO 'pma_test'@'localhost'; " + . '' . "REVOKE ALL PRIVILEGES ON `test_db_1`.* FROM 'pma_test'@'localhost'; REVOKE GRANT OPTION ON `test_db_1`.* FROM 'pma_test'@'localhost'; GRANT SELECT ON `test_db_1`.* TO 'pma_test'@'localhost'; \n" - . "REVOKE ALL PRIVILEGES ON `test_db_2`.* FROM 'pma_test'@'localhost'; REVOKE GRANT OPTION ON `test_db_2`.* FROM 'pma_test'@'localhost'; GRANT SELECT ON `test_db_2`.* TO 'pma_test'@'localhost'; \n" - . '
' . "\n" + '', $responseRenderer->getHTMLResult(), ); self::assertSame([], $responseRenderer->getJSONResult()); @@ -102,9 +102,9 @@ final class FindReplaceControllerTest extends AbstractTestCase $controller($request); self::assertStringContainsString( - '', + . '' . 'UPDATE `test_table` SET `id` = REPLACE(`id`, \'Field\', \'Column\')' . ' WHERE `id` LIKE \'%Field%\' COLLATE utf8mb4_bin' - . "\n" . '
' . "\n" + '', $responseRenderer->getHTMLResult(), ); self::assertSame([], $responseRenderer->getJSONResult()); diff --git a/tests/unit/Controllers/Table/IndexRenameControllerTest.php b/tests/unit/Controllers/Table/IndexRenameControllerTest.php index 75979fa77c..eb11abe0e7 100644 --- a/tests/unit/Controllers/Table/IndexRenameControllerTest.php +++ b/tests/unit/Controllers/Table/IndexRenameControllerTest.php @@ -87,14 +87,14 @@ class IndexRenameControllerTest extends AbstractTestCase $dbi->setVersion(['@@version' => '5.5.0']); DatabaseInterface::$instance = $dbi; + // phpcs:disable Generic.Files.LineLength.TooLong $expected = <<<'HTML' -', + . '' . 'UPDATE `test_table` SET `id` = `id` WHERE `id` RLIKE \'Field\' COLLATE utf8mb4_bin' - . "\n" . '
-ALTER TABLE `test_db`.`test_table_index_rename` DROP INDEX `old_name`, ADD INDEX `new_name` (`name`) USING BTREE;
-
- ALTER TABLE `test_db`.`test_table_index_rename` DROP INDEX `old_name`, ADD INDEX `new_name` (`name`) USING BTREE;
+ ' . "\n"
- . 'SELECT 1 < 2' . "\n"
- . '
',
+ ''
+ . 'SELECT 1 < 2'
+ . '',
Generator::formatSql('SELECT 1 < 2'),
);
Config::getInstance()->settings['MaxCharactersInDisplayedSQL'] = 6;
self::assertSame(
- '' . "\n"
- . 'SELECT[...]' . "\n"
- . '
',
+ ''
+ . 'SELECT[...]'
+ . '',
Generator::formatSql('SELECT 1 < 2', true),
);
}
@@ -486,9 +486,7 @@ class GeneratorTest extends AbstractTestCase
Message one.
-SELECT 1;
-
SELECT 1;