[MediaWiki-commits] [Gerrit] Refactoring SpecialGlobalUsers.php and SpecialMergeAccount.p... - change (mediawiki...CentralAuth)
jenkins-bot has submitted this change and it was merged. Change subject: Refactoring SpecialGlobalUsers.php and SpecialMergeAccount.php to use XML and HTML forms. .. Refactoring SpecialGlobalUsers.php and SpecialMergeAccount.php to use XML and HTML forms. Change-Id: I36267e0df681f50e004ae08629aa5cfa204379b1 --- M specials/SpecialGlobalUsers.php M specials/SpecialMergeAccount.php 2 files changed, 70 insertions(+), 66 deletions(-) Approvals: Reedy: Looks good to me, approved jenkins-bot: Verified diff --git a/specials/SpecialGlobalUsers.php b/specials/SpecialGlobalUsers.php index 638ffed..45d5fc8 100644 --- a/specials/SpecialGlobalUsers.php +++ b/specials/SpecialGlobalUsers.php @@ -34,7 +34,7 @@ $this-getOutput()-addModuleStyles( 'ext.centralauth.globalusers' ); $this-getOutput()-addHTML( $pg-getPageHeader() ); $this-getOutput()-addHTML( $pg-getNavigationBar() ); - $this-getOutput()-addHTML( 'ul' . $pg-getBody() . '/ul' ); + $this-getOutput()-addHTML( Html::rawElement( 'ul', null, $pg-getBody() ) ); $this-getOutput()-addHTML( $pg-getNavigationBar() ); } } diff --git a/specials/SpecialMergeAccount.php b/specials/SpecialMergeAccount.php index dd2592a..84bc2d6 100644 --- a/specials/SpecialMergeAccount.php +++ b/specials/SpecialMergeAccount.php @@ -210,7 +210,7 @@ // Show wiki list if required if ( $status-hasMessage( 'centralauth-merge-home-password' ) ) { - $out = 'h2' . $this-msg( 'centralauth-list-home-title' )-escaped() . '/h2'; + $out = Html::rawElement( 'h2', null, $this-msg( 'centralauth-list-home-title' )-escaped() ); $out .= $this-msg( 'centralauth-list-home-dryrun' )-parseAsBlock(); $out .= $this-listAttached( array( $home ), array( $home = 'primary' ) ); $this-getOutput()-addHTML( $out ); @@ -301,10 +301,9 @@ $this-showCleanupForm(); } else { $this-getOutput()-addHTML( - 'div class=errorbox' . - $this-msg( 'wrongpassword' )-escaped() . - '/div' . - $this-attachActionForm() ); + Html::rawElement( 'div', array( class = errorbox ), + $this-msg( 'wrongpassword' )-escaped() + ) . $this-attachActionForm() ); } } @@ -359,14 +358,14 @@ $this-getOutput()-addWikiMsg( 'centralauth-readmore-text' ); if ( $merged ) { - $this-getOutput()-addHTML( 'hr /' ); + $this-getOutput()-addHTML( Xml::element( 'hr' ) ); $this-getOutput()-addWikiMsg( 'centralauth-list-attached', $this-mUserName ); $this-getOutput()-addHTML( $this-listAttached( $merged ) ); } if ( $remainder ) { - $this-getOutput()-addHTML( 'hr /' ); + $this-getOutput()-addHTML( Xml::element( 'hr' ) ); $this-getOutput()-addWikiMsg( 'centralauth-list-unattached', $this-mUserName ); $this-getOutput()-addHTML( $this-listUnattached( $remainder ) ); @@ -416,16 +415,21 @@ function formatList( $items, $methods, $callback ) { if ( !$items ) { return ''; - } else { - $itemMethods = array(); - foreach ( $items as $item ) { - $itemMethods[] = isset( $methods[$item] ) ? $methods[$item] : ''; - } - return ul\nli . - implode( /li\nli, - array_map( $callback, $items, $itemMethods ) ) . - /li\n/ul\n; } + + $itemMethods = array(); + foreach ( $items as $item ) { + $itemMethods[] = isset( $methods[$item] ) ? $methods[$item] : ''; + } + + $html = Xml::openElement( 'ul' ) . \n; + $list = array_map( $callback, $items, $itemMethods ); + foreach ( $list as $item ) { + $html .= Html::rawElement( 'li', array(), $item ) . \n; + } + $html .= Xml::closeElement( 'ul' ) . \n; + + return $html; } /** @@ -459,11 +463,10 @@ } $hostname = $wiki-getDisplayName(); -
[MediaWiki-commits] [Gerrit] Refactoring SpecialGlobalUsers.php and SpecialMergeAccount.p... - change (mediawiki...CentralAuth)
Pgehres has uploaded a new change for review. https://gerrit.wikimedia.org/r/52337 Change subject: Refactoring SpecialGlobalUsers.php and SpecialMergeAccount.php to use XML and HTML forms. .. Refactoring SpecialGlobalUsers.php and SpecialMergeAccount.php to use XML and HTML forms. Change-Id: I36267e0df681f50e004ae08629aa5cfa204379b1 --- M specials/SpecialGlobalUsers.php M specials/SpecialMergeAccount.php 2 files changed, 69 insertions(+), 64 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth refs/changes/37/52337/1 diff --git a/specials/SpecialGlobalUsers.php b/specials/SpecialGlobalUsers.php index 63f7a9e..710002f 100644 --- a/specials/SpecialGlobalUsers.php +++ b/specials/SpecialGlobalUsers.php @@ -31,7 +31,7 @@ $this-getOutput()-addModuleStyles( 'ext.centralauth.globalusers' ); $this-getOutput()-addHTML( $pg-getPageHeader() ); $this-getOutput()-addHTML( $pg-getNavigationBar() ); - $this-getOutput()-addHTML( 'ul' . $pg-getBody() . '/ul' ); + $this-getOutput()-addHTML( Html::rawElement( 'ul', null, $pg-getBody() ) ); $this-getOutput()-addHTML( $pg-getNavigationBar() ); } } diff --git a/specials/SpecialMergeAccount.php b/specials/SpecialMergeAccount.php index add62f9..54a7382 100644 --- a/specials/SpecialMergeAccount.php +++ b/specials/SpecialMergeAccount.php @@ -210,7 +210,7 @@ // Show wiki list if required if ( $status-hasMessage( 'centralauth-merge-home-password' ) ) { - $out = 'h2' . $this-msg( 'centralauth-list-home-title' )-escaped() . '/h2'; + $out = Html::rawElement( 'h2', null, $this-msg( 'centralauth-list-home-title' )-escaped() ); $out .= $this-msg( 'centralauth-list-home-dryrun' )-parseAsBlock(); $out .= $this-listAttached( array( $home ), array( $home = 'primary' ) ); $this-getOutput()-addHTML( $out ); @@ -301,10 +301,9 @@ $this-showCleanupForm(); } else { $this-getOutput()-addHTML( - 'div class=errorbox' . - $this-msg( 'wrongpassword' )-escaped() . - '/div' . - $this-attachActionForm() ); + Html::rawElement( 'div', array( class = errorbox ), + $this-msg( 'wrongpassword' )-escaped() + ) . $this-attachActionForm() ); } } @@ -359,14 +358,14 @@ $this-getOutput()-addWikiMsg( 'centralauth-readmore-text' ); if ( $merged ) { - $this-getOutput()-addHTML( 'hr /' ); + $this-getOutput()-addHTML( Xml::element( 'hr' ) ); $this-getOutput()-addWikiMsg( 'centralauth-list-attached', $this-mUserName ); $this-getOutput()-addHTML( $this-listAttached( $merged ) ); } if ( $remainder ) { - $this-getOutput()-addHTML( 'hr /' ); + $this-getOutput()-addHTML( Xml::element( 'hr' ) ); $this-getOutput()-addWikiMsg( 'centralauth-list-unattached', $this-mUserName ); $this-getOutput()-addHTML( $this-listUnattached( $remainder ) ); @@ -416,16 +415,21 @@ function formatList( $items, $methods, $callback ) { if ( !$items ) { return ''; - } else { - $itemMethods = array(); - foreach ( $items as $item ) { - $itemMethods[] = isset( $methods[$item] ) ? $methods[$item] : ''; - } - return ul\nli . - implode( /li\nli, - array_map( $callback, $items, $itemMethods ) ) . - /li\n/ul\n; } + + $itemMethods = array(); + foreach ( $items as $item ) { + $itemMethods[] = isset( $methods[$item] ) ? $methods[$item] : ''; + } + + $html = Xml::openElement( 'ul' ) . \n; + $list = array_map( $callback, $items, $itemMethods ); + foreach ( $list as $item ){ + $html .= Html::rawElement( 'li', array(), $item ) . \n; + } + $html .= Xml::closeElement( 'ul' ) . \n; + + return $html; } /** @@ -454,7 +458,7 @@ }