From fc50073fb59cfaeb2ae8b443af30f7c418b82a04 Mon Sep 17 00:00:00 2001 From: thiemowmde Date: Mon, 13 May 2024 12:36:12 +0200 Subject: [PATCH] Fix missing and in various places This removes the last usages of the problematic open/closeElement from this codebase. One actual issue gets fixed: Some of the floated around without a . That's technically invalid. Luckily the browsers are flexible and show it correctly. Visually nothing changes. Similarly should be wrapped in a . This wasn't done before. Change-Id: Ia45096670888173e49f9c25e72f429f0961b75ae --- includes/Special/SpecialAbuseLog.php | 57 +++++++++++------------ includes/Variables/VariablesFormatter.php | 32 ++++++------- 2 files changed, 40 insertions(+), 49 deletions(-) diff --git a/includes/Special/SpecialAbuseLog.php b/includes/Special/SpecialAbuseLog.php index cdbf244ad..c7f653f9c 100644 --- a/includes/Special/SpecialAbuseLog.php +++ b/includes/Special/SpecialAbuseLog.php @@ -875,25 +875,7 @@ class SpecialAbuseLog extends AbuseFilterSpecialPage { * @return string The HTML output */ private function buildPrivateDetailsTable( $row ) { - $output = Html::element( - 'legend', - [], - $this->msg( 'abusefilter-log-details-privatedetails' )->text() - ); - - $header = - Html::element( 'th', [], $this->msg( 'abusefilter-log-details-var' )->text() ) . - Html::element( 'th', [], $this->msg( 'abusefilter-log-details-val' )->text() ); - - $output .= - Html::openElement( 'table', - [ - 'class' => 'wikitable mw-abuselog-private', - 'style' => 'width: 80%;' - ] - ) . - Html::openElement( 'tbody' ); - $output .= $header; + $output = ''; // Log ID $linkRenderer = $this->getLinkRenderer(); @@ -903,12 +885,10 @@ class SpecialAbuseLog extends AbuseFilterSpecialPage { [ 'style' => 'width: 30%;' ], $this->msg( 'abusefilter-log-details-id' )->text() ) . - Html::openElement( 'td' ) . - $linkRenderer->makeKnownLink( + Html::rawElement( 'td', [], $linkRenderer->makeKnownLink( $this->getPageTitle( $row->afl_id ), $this->getLanguage()->formatNum( $row->afl_id ) - ) . - Html::closeElement( 'td' ) + ) ) ); // Timestamp @@ -944,12 +924,10 @@ class SpecialAbuseLog extends AbuseFilterSpecialPage { [ 'style' => 'width: 30%;' ], $this->msg( 'abusefilter-list-id' )->text() ) . - Html::openElement( 'td' ) . - $linkRenderer->makeKnownLink( + Html::rawElement( 'td', [], $linkRenderer->makeKnownLink( SpecialPage::getTitleFor( 'AbuseFilter', $row->af_id ), $this->getLanguage()->formatNum( $row->af_id ) - ) . - Html::closeElement( 'td' ) + ) ) ); // Filter description @@ -1007,9 +985,28 @@ class SpecialAbuseLog extends AbuseFilterSpecialPage { ); } - $output .= Html::closeElement( 'tbody' ) . Html::closeElement( 'table' ); - - return Html::rawElement( 'fieldset', [], $output ); + return Html::rawElement( 'fieldset', [], + Html::element( 'legend', [], + $this->msg( 'abusefilter-log-details-privatedetails' )->text() + ) . + Html::rawElement( 'table', + [ + 'class' => 'wikitable mw-abuselog-private', + 'style' => 'width: 80%;' + ], + Html::rawElement( 'thead', [], + Html::rawElement( 'tr', [], + Html::element( 'th', [], + $this->msg( 'abusefilter-log-details-var' )->text() + ) . + Html::element( 'th', [], + $this->msg( 'abusefilter-log-details-val' )->text() + ) + ) + ) . + Html::rawElement( 'tbody', [], $output ) + ) + ); } /** diff --git a/includes/Variables/VariablesFormatter.php b/includes/Variables/VariablesFormatter.php index 0d21c380d..ba8da9e2c 100644 --- a/includes/Variables/VariablesFormatter.php +++ b/includes/Variables/VariablesFormatter.php @@ -50,22 +50,6 @@ class VariablesFormatter { $output = ''; - $output .= - Html::openElement( 'table', [ 'class' => 'mw-abuselog-details' ] ) . - Html::openElement( 'tbody' ) . - "\n"; - - $header = - Html::element( 'th', [], $this->messageLocalizer->msg( 'abusefilter-log-details-var' )->text() ) . - Html::element( 'th', [], $this->messageLocalizer->msg( 'abusefilter-log-details-val' )->text() ); - $output .= Html::rawElement( 'tr', [], $header ) . "\n"; - - if ( !count( $vars ) ) { - $output .= Html::closeElement( 'tbody' ) . Html::closeElement( 'table' ); - - return $output; - } - // Now, build the body of the table. foreach ( $vars as $key => $value ) { $key = strtolower( $key ); @@ -97,9 +81,19 @@ class VariablesFormatter { ) . "\n"; } - $output .= Html::closeElement( 'tbody' ) . Html::closeElement( 'table' ); - - return $output; + return Html::rawElement( 'table', [ 'class' => 'mw-abuselog-details' ], + Html::rawElement( 'thead', [], + Html::rawElement( 'tr', [], + Html::element( 'th', [], + $this->messageLocalizer->msg( 'abusefilter-log-details-var' )->text() + ) . + Html::element( 'th', [], + $this->messageLocalizer->msg( 'abusefilter-log-details-val' )->text() + ) + ) + ) . + Html::rawElement( 'tbody', [], $output ) + ); } /**