MediaWiki
master
|
A service class for getting formatted information about a block. More...
Public Member Functions | |
__construct (TitleFormatter $titleFormatter) | |
getMessage (Block $block, UserIdentity $user, Language $language, $ip) | |
Get a block error message. More... | |
Private Member Functions | |
formatBlockerLink (?UserIdentity $blocker, Language $language) | |
Create a link to the blocker's user page. More... | |
formatBlockReason (CommentStoreComment $reason, Language $language) | |
Format the block reason as plain wikitext in the specified language. More... | |
getBlockErrorInfo (Block $block) | |
Get a standard set of block details for building a block error message. More... | |
getBlockErrorMessageKey (Block $block) | |
Determine the block error message key by examining the block. More... | |
getBlockErrorMessageParams (Block $block, UserIdentity $user, Language $language, $ip) | |
Get the formatted parameters needed to build the block error messages handled by getBlockErrorMessageKey. More... | |
getFormattedBlockErrorInfo (Block $block, UserIdentity $user, Language $language) | |
Get a standard set of block details for building a block error message, formatted for a specified user and language. More... | |
Private Attributes | |
TitleFormatter | $titleFormatter |
A service class for getting formatted information about a block.
To obtain an instance, use MediaWikiServices::getInstance()->getBlockErrorFormatter().
Definition at line 36 of file BlockErrorFormatter.php.
MediaWiki\Block\BlockErrorFormatter::__construct | ( | TitleFormatter | $titleFormatter | ) |
TitleFormatter | $titleFormatter |
Definition at line 44 of file BlockErrorFormatter.php.
References MediaWiki\Block\BlockErrorFormatter\$titleFormatter.
|
private |
Create a link to the blocker's user page.
This must be done here rather than in the message translation, because the blocker may not be a local user, in which case their page cannot be linked.
?UserIdentity | $blocker | |
Language | $language |
Definition at line 147 of file BlockErrorFormatter.php.
References Language\embedBidi(), MediaWiki\User\UserIdentity\getId(), MediaWiki\User\UserIdentity\getName(), Page\PageReferenceValue\localReference(), and NS_USER.
Referenced by MediaWiki\Block\BlockErrorFormatter\getBlockErrorMessageParams().
|
private |
Format the block reason as plain wikitext in the specified language.
CommentStoreComment | $reason | |
Language | $language |
Definition at line 130 of file BlockErrorFormatter.php.
Referenced by MediaWiki\Block\BlockErrorFormatter\getFormattedBlockErrorInfo().
|
private |
Get a standard set of block details for building a block error message.
Block | $block |
Definition at line 84 of file BlockErrorFormatter.php.
References MediaWiki\Block\Block\getBlocker(), MediaWiki\Block\Block\getExpiry(), MediaWiki\Block\Block\getIdentifier(), MediaWiki\Block\Block\getReasonComment(), MediaWiki\Block\Block\getTargetName(), and MediaWiki\Block\Block\getTimestamp().
Referenced by MediaWiki\Block\BlockErrorFormatter\getFormattedBlockErrorInfo().
|
private |
Determine the block error message key by examining the block.
Block | $block |
Definition at line 176 of file BlockErrorFormatter.php.
References MediaWiki\Block\Block\getType(), MediaWiki\Block\Block\isSitewide(), and MediaWiki\Block\Block\TYPE_AUTO.
Referenced by MediaWiki\Block\BlockErrorFormatter\getMessage().
|
private |
Get the formatted parameters needed to build the block error messages handled by getBlockErrorMessageKey.
Definition at line 210 of file BlockErrorFormatter.php.
References Language\commaList(), MediaWiki\Block\BlockErrorFormatter\formatBlockerLink(), MediaWiki\Block\Block\getBlocker(), and MediaWiki\Block\BlockErrorFormatter\getFormattedBlockErrorInfo().
Referenced by MediaWiki\Block\BlockErrorFormatter\getMessage().
|
private |
Get a standard set of block details for building a block error message, formatted for a specified user and language.
Definition at line 106 of file BlockErrorFormatter.php.
References Language\embedBidi(), MediaWiki\Block\BlockErrorFormatter\formatBlockReason(), Language\formatExpiry(), MediaWiki\Block\BlockErrorFormatter\getBlockErrorInfo(), and Language\userTimeAndDate().
Referenced by MediaWiki\Block\BlockErrorFormatter\getBlockErrorMessageParams().
MediaWiki\Block\BlockErrorFormatter::getMessage | ( | Block | $block, |
UserIdentity | $user, | ||
Language | $language, | ||
$ip | |||
) |
Get a block error message.
Different message keys are chosen depending on the block features. Message parameters are formatted for the specified user and language.
Definition at line 61 of file BlockErrorFormatter.php.
References MediaWiki\Block\BlockErrorFormatter\getBlockErrorMessageKey(), and MediaWiki\Block\BlockErrorFormatter\getBlockErrorMessageParams().
|
private |
Definition at line 39 of file BlockErrorFormatter.php.
Referenced by MediaWiki\Block\BlockErrorFormatter\__construct().