MediaWiki
master
|
A service class for getting formatted information about a block. More...
Public Member Functions | |
__construct (UserFactory $userFactory) | |
getMessage (AbstractBlock $block, UserIdentity $user, Language $language, $ip) | |
Get a block error message. More... | |
Private Member Functions | |
formatBlockerLink ( $blockerName, $blockerId, 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 (AbstractBlock $block) | |
Get a standard set of block details for building a block error message. More... | |
getBlockErrorMessageKey (AbstractBlock $block) | |
Determine the block error message key by examining the block. More... | |
getBlockErrorMessageParams (AbstractBlock $block, UserIdentity $user, Language $language, $ip) | |
Get the formatted parameters needed to build the block error messages handled by getBlockErrorMessageKey. More... | |
getFormattedBlockErrorInfo (AbstractBlock $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 | |
UserFactory | $userFactory |
A service class for getting formatted information about a block.
To obtain an instance, use MediaWikiServices::getInstance()->getBlockErrorFormatter().
Definition at line 35 of file BlockErrorFormatter.php.
MediaWiki\Block\BlockErrorFormatter::__construct | ( | UserFactory | $userFactory | ) |
UserFactory | $userFactory |
Definition at line 43 of file BlockErrorFormatter.php.
References MediaWiki\Block\BlockErrorFormatter\$userFactory.
|
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.
string | $blockerName | Formatted blocker name |
int | $blockerId | |
Language | $language |
Definition at line 146 of file BlockErrorFormatter.php.
References Language\embedBidi().
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 128 of file BlockErrorFormatter.php.
Referenced by MediaWiki\Block\BlockErrorFormatter\getFormattedBlockErrorInfo().
|
private |
Get a standard set of block details for building a block error message.
AbstractBlock | $block |
Definition at line 82 of file BlockErrorFormatter.php.
References MediaWiki\Block\AbstractBlock\getBy(), MediaWiki\Block\AbstractBlock\getByName(), MediaWiki\Block\AbstractBlock\getExpiry(), MediaWiki\Block\AbstractBlock\getIdentifier(), MediaWiki\Block\AbstractBlock\getReasonComment(), MediaWiki\Block\AbstractBlock\getTarget(), and MediaWiki\Block\AbstractBlock\getTimestamp().
Referenced by MediaWiki\Block\BlockErrorFormatter\getFormattedBlockErrorInfo().
|
private |
Determine the block error message key by examining the block.
AbstractBlock | $block |
Definition at line 164 of file BlockErrorFormatter.php.
References MediaWiki\Block\AbstractBlock\getType(), MediaWiki\Block\AbstractBlock\isSitewide(), and MediaWiki\Block\AbstractBlock\TYPE_AUTO.
Referenced by MediaWiki\Block\BlockErrorFormatter\getMessage().
|
private |
Get the formatted parameters needed to build the block error messages handled by getBlockErrorMessageKey.
AbstractBlock | $block | |
UserIdentity | $user | |
Language | $language | |
string | $ip |
Definition at line 198 of file BlockErrorFormatter.php.
References Language\commaList(), MediaWiki\Block\BlockErrorFormatter\formatBlockerLink(), 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.
AbstractBlock | $block | |
UserIdentity | $user | |
Language | $language |
Definition at line 104 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 | ( | AbstractBlock | $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.
AbstractBlock | $block | |
UserIdentity | $user | |
Language | $language | |
string | $ip |
Definition at line 58 of file BlockErrorFormatter.php.
References MediaWiki\Block\BlockErrorFormatter\getBlockErrorMessageKey(), and MediaWiki\Block\BlockErrorFormatter\getBlockErrorMessageParams().
|
private |
Definition at line 38 of file BlockErrorFormatter.php.
Referenced by MediaWiki\Block\BlockErrorFormatter\__construct().