7namespace MediaWiki\Permissions;
9use MediaWiki\Html\Html;
10use MediaWiki\Language\Language;
11use MediaWiki\Language\LanguageFactory;
12use MediaWiki\Linker\LinkRenderer;
13use MediaWiki\SpecialPage\SpecialPage;
14use Wikimedia\HtmlArmor\HtmlArmor;
37 $this->grantsInfo = $grantsInfo;
38 $this->linkRenderer = $linkRenderer;
39 $this->languageFactory = $languageFactory;
40 $this->contentLanguage = $contentLanguage;
64 $msg->inLanguage( $lang );
67 if ( !$msg->exists() ) {
69 ? wfMessage(
'grant-generic', $grant )->inLanguage( $lang )
70 : wfMessage(
'grant-generic', $grant );
85 foreach ( $grants as $grant ) {
99 $riskGroupsByGrant = $this->grantsInfo->getRiskGroupsByGrant(
'unknown' );
102 foreach ( $grantDescriptions as $grant => $description ) {
103 $riskGroup = $riskGroupsByGrant[$grant] ??
'unknown';
106 $riskGroupMsg =
wfMessage(
"grantriskgroup-$riskGroup" );
108 $riskGroupMsg->inLanguage( $lang );
110 if ( $riskGroupMsg->exists() ) {
111 $riskDescription = $riskGroupMsg->text();
112 $riskDescriptionHTML =
' ' .
113 Html::element(
'span', [
'class' =>
"mw-grant mw-grantriskgroup-$riskGroup" ], $riskDescription );
115 $riskDescription =
'';
116 $riskDescriptionHTML =
'';
118 $results[] = htmlspecialchars( $description ) . $riskDescriptionHTML;
134 $riskGroupsByGrant = $this->grantsInfo->getRiskGroupsByGrant(
'unknown' );
135 $riskGroup = $riskGroupsByGrant[$grant] ??
'unknown';
136 return $this->linkRenderer->makeKnownLink(
155 if ( is_string( $lang ) ) {
156 $lang = $this->languageFactory->getLanguage( $lang );
157 } elseif ( $lang ===
null ) {
158 $lang = $this->contentLanguage;
162 foreach ( $this->grantsInfo->getGrantGroups( $grantsFilter ) as $group => $grants ) {
163 if ( $group ===
'hidden' ) {
166 $grantDescriptionsWithClasses = $this->getGrantDescriptionsWithClasses( $grants, $lang );
173 $s .=
"*<span class=\"mw-grantgroup\">" .
175 wfMessage(
"grant-group-$group" )->inLanguage( $lang )->text() .
"</span>\n";
176 $s .=
":" . $lang->semicolonList( $grantDescriptionsWithClasses ) .
"\n";
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
if(!defined('MW_SETUP_CALLBACK'))
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...