From 8fa9ddf642f69044990ef04cef60267bd53ad344 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Tue, 4 Oct 2011 20:30:37 +0000 Subject: [PATCH] * Use local context instead of global variables * Use Linker::linkKnown() where possible * Break long lines --- includes/specials/SpecialListgrouprights.php | 43 ++++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/includes/specials/SpecialListgrouprights.php b/includes/specials/SpecialListgrouprights.php index 07e08e77d9..00bab56859 100644 --- a/includes/specials/SpecialListgrouprights.php +++ b/includes/specials/SpecialListgrouprights.php @@ -44,10 +44,11 @@ class SpecialListGroupRights extends SpecialPage { global $wgImplicitGroups; global $wgGroupPermissions, $wgRevokePermissions, $wgAddGroups, $wgRemoveGroups; global $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf; - $out = $this->getOutput(); $this->setHeaders(); $this->outputHeader(); + + $out = $this->getOutput(); $out->addModuleStyles( 'mediawiki.special' ); $out->addHTML( @@ -96,20 +97,16 @@ class SpecialListGroupRights extends SpecialPage { if ( $group === 'user' ) { // Link to Special:listusers for implicit group 'user' - $grouplink = '
' . Linker::link( + $grouplink = '
' . Linker::linkKnown( SpecialPage::getTitleFor( 'Listusers' ), - wfMsgHtml( 'listgrouprights-members' ), - array(), - array(), - array( 'known', 'noclasses' ) + wfMsgHtml( 'listgrouprights-members' ) ); } elseif ( !in_array( $group, $wgImplicitGroups ) ) { - $grouplink = '
' . Linker::link( + $grouplink = '
' . Linker::linkKnown( SpecialPage::getTitleFor( 'Listusers' ), wfMsgHtml( 'listgrouprights-members' ), array(), - array( 'group' => $group ), - array( 'known', 'noclasses' ) + array( 'group' => $group ) ); } else { // No link to Special:listusers for other implicit groups as they are unlistable @@ -127,7 +124,8 @@ class SpecialListGroupRights extends SpecialPage { " $grouppage$grouplink " . - self::formatPermissions( $permissions, $revoke, $addgroups, $removegroups, $addgroupsSelf, $removegroupsSelf ) . + $this->formatPermissions( $permissions, $revoke, $addgroups, $removegroups, + $addgroupsSelf, $removegroupsSelf ) . ' ' ) ); @@ -149,9 +147,7 @@ class SpecialListGroupRights extends SpecialPage { * @param $removeSelf Array of group this group is allowed to remove from self or true * @return string List of all granted permissions, separated by comma separator */ - private static function formatPermissions( $permissions, $revoke, $add, $remove, $addSelf, $removeSelf ) { - global $wgLang; - + private function formatPermissions( $permissions, $revoke, $add, $remove, $addSelf, $removeSelf ) { $r = array(); foreach( $permissions as $permission => $granted ) { //show as granted only if it isn't revoked to prevent duplicate display of permissions @@ -173,29 +169,42 @@ class SpecialListGroupRights extends SpecialPage { } } sort( $r ); + $lang = $this->getLang(); if( $add === true ){ $r[] = wfMsgExt( 'listgrouprights-addgroup-all', array( 'escape' ) ); } elseif( is_array( $add ) && count( $add ) ) { $add = array_values( array_unique( $add ) ); - $r[] = wfMsgExt( 'listgrouprights-addgroup', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $add ) ), count( $add ) ); + $r[] = wfMsgExt( 'listgrouprights-addgroup', array( 'parseinline' ), + $lang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $add ) ), + count( $add ) + ); } if( $remove === true ){ $r[] = wfMsgExt( 'listgrouprights-removegroup-all', array( 'escape' ) ); } elseif( is_array( $remove ) && count( $remove ) ) { $remove = array_values( array_unique( $remove ) ); - $r[] = wfMsgExt( 'listgrouprights-removegroup', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $remove ) ), count( $remove ) ); + $r[] = wfMsgExt( 'listgrouprights-removegroup', array( 'parseinline' ), + $lang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $remove ) ), + count( $remove ) + ); } if( $addSelf === true ){ $r[] = wfMsgExt( 'listgrouprights-addgroup-self-all', array( 'escape' ) ); } elseif( is_array( $addSelf ) && count( $addSelf ) ) { $addSelf = array_values( array_unique( $addSelf ) ); - $r[] = wfMsgExt( 'listgrouprights-addgroup-self', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $addSelf ) ), count( $addSelf ) ); + $r[] = wfMsgExt( 'listgrouprights-addgroup-self', array( 'parseinline' ), + $lang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $addSelf ) ), + count( $addSelf ) + ); } if( $removeSelf === true ){ $r[] = wfMsgExt( 'listgrouprights-removegroup-self-all', array( 'escape' ) ); } elseif( is_array( $removeSelf ) && count( $removeSelf ) ) { $removeSelf = array_values( array_unique( $removeSelf ) ); - $r[] = wfMsgExt( 'listgrouprights-removegroup-self', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $removeSelf ) ), count( $removeSelf ) ); + $r[] = wfMsgExt( 'listgrouprights-removegroup-self', array( 'parseinline' ), + $lang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $removeSelf ) ), + count( $removeSelf ) + ); } if( empty( $r ) ) { return ''; -- 2.20.1