* @author Petr Kadlec <mormegil@centrum.cz>
*/
class SpecialListGroupRights extends SpecialPage {
- function __construct() {
+ public function __construct() {
parent::__construct( 'Listgrouprights' );
}
? 'all'
: $group;
- $msg = $this->msg( 'group-' . $groupname );
- $groupnameLocalized = !$msg->isBlank() ? $msg->text() : $groupname;
+ $groupnameLocalized = UserGroupMembership::getGroupName( $groupname );
- $msg = $this->msg( 'grouppage-' . $groupname )->inContentLanguage();
- $grouppageLocalized = !$msg->isBlank() ?
- $msg->text() :
- MWNamespace::getCanonicalName( NS_PROJECT ) . ':' . $groupname;
- $grouppageLocalizedTitle = Title::newFromText( $grouppageLocalized );
+ $grouppageLocalizedTitle = UserGroupMembership::getGroupPage( $groupname )
+ ?: Title::newFromText( MWNamespace::getCanonicalName( NS_PROJECT ) . ':' . $groupname );
if ( $group == '*' || !$grouppageLocalizedTitle ) {
// Do not make a link for the generic * group or group with invalid group page
? $groupsRemoveFromSelf[$group]
: [];
- $id = $group == '*' ? false : Sanitizer::escapeId( $group );
+ $id = $group == '*' ? false : Sanitizer::escapeIdForAttribute( $group );
$out->addHTML( Html::rawElement( 'tr', [ 'id' => $id ], "
<td>$grouppage$grouplink</td>
<td>" .
* @param array $remove Array of groups this group is allowed to remove or true
* @param array $addSelf Array of groups this group is allowed to add to self or true
* @param array $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
+ * @return string HTML list of all granted permissions
*/
private function formatPermissions( $permissions, $revoke, $add, $remove, $addSelf, $removeSelf ) {
$r = [];
} elseif ( is_array( $changeGroup ) ) {
$changeGroup = array_intersect( array_values( array_unique( $changeGroup ) ), $allGroups );
if ( count( $changeGroup ) ) {
+ $groupLinks = [];
+ foreach ( $changeGroup as $group ) {
+ $groupLinks[] = UserGroupMembership::getLink( $group, $this->getContext(), 'wiki' );
+ }
// For grep: listgrouprights-addgroup, listgrouprights-removegroup,
// listgrouprights-addgroup-self, listgrouprights-removegroup-self
$r[] = $this->msg( 'listgrouprights-' . $messageKey,
- $lang->listToText( array_map( [ 'User', 'makeGroupLinkWiki' ], $changeGroup ) ),
- count( $changeGroup )
- )->parse();
+ $lang->listToText( $groupLinks ), count( $changeGroup ) )->parse();
}
}
}