53 parent::__construct(
$entry );
54 $this->titleParser = $titleParser;
55 $this->namespaceInfo = $namespaceInfo;
59 $params = parent::getMessageParameters();
61 $title = $this->entry->getTarget();
62 if ( substr( $title->getText(), 0, 1 ) ===
'#' ) {
64 $params[2] = $title->getText();
68 $username = $title->getText();
71 $targetUser = User::newFromName( $username,
false );
73 $params[3] = $username;
76 $subtype = $this->entry->getSubtype();
77 if ( $subtype ===
'block' || $subtype ===
'reblock' ) {
78 if ( !isset( $params[4] ) ) {
80 $params[4] =
'infinity';
87 $durationTooltip =
'‎' . htmlspecialchars( $params[4] );
88 $blockExpiry = $this->context->getLanguage()->translateBlockExpiry(
90 $this->context->getUser(),
91 (
int)
wfTimestamp( TS_UNIX, $this->entry->getTimestamp() )
93 if ( $this->plaintext ) {
98 "<span class=\"blockExpiry\" title=\"$durationTooltip\">" .
100 htmlspecialchars( $blockExpiry ) .
104 $params[5] = isset( $params[5] ) ?
108 if ( isset( $params[6] ) ) {
109 $pages = $params[6][
'pages'] ?? [];
111 foreach ( $pages as $page ) {
112 $pageLinks[] = $this->
makePageLink( Title::newFromText( $page ) );
115 $rawNamespaces = $params[6][
'namespaces'] ?? [];
117 foreach ( $rawNamespaces as $ns ) {
119 ? $this->
msg(
'blanknamespace' )->escaped()
120 : htmlspecialchars( $this->context->getLanguage()->getFormattedNsText( $ns ) );
121 if ( $this->plaintext ) {
125 $namespaces[] = $text;
129 [
'namespace' => $ns ],
135 $rawActions = $params[6][
'actions'] ?? [];
137 foreach ( $rawActions as $action ) {
138 $actions[] = $this->
msg(
'ipb-action-' . $action )->escaped();
143 $restrictions[] = $this->
msg(
'logentry-partialblock-block-page' )
144 ->numParams( count( $pageLinks ) )
145 ->rawParams( $this->context->getLanguage()->listToText( $pageLinks ) )->escaped();
149 $restrictions[] = $this->
msg(
'logentry-partialblock-block-ns' )
150 ->numParams( count( $namespaces ) )
151 ->rawParams( $this->context->getLanguage()->listToText( $namespaces ) )->escaped();
153 $enablePartialActionBlocks = $this->context->getConfig()
155 if ( $actions && $enablePartialActionBlocks ) {
156 $restrictions[] = $this->
msg(
'logentry-partialblock-block-action' )
157 ->numParams( count( $actions ) )
158 ->rawParams( $this->context->getLanguage()->listToText( $actions ) )->escaped();
161 $params[6] =
Message::rawParam( $this->context->getLanguage()->listToText( $restrictions ) );
169 $params = parent::extractParameters();
171 if ( $this->entry->isLegacy() && isset( $params[3] ) ) {
172 if ( isset( $params[4] ) ) {
173 $params[5] = $params[4];
175 $params[4] = $params[3];
182 $title = $this->entry->getTarget();
185 if ( substr( $title->getText(), 0, 1 ) !==
'#' && $title->canExist() ) {
186 $preload[] = $this->namespaceInfo->getTalkPage( $title );
190 if ( isset( $params[6][
'pages'] ) ) {
191 foreach ( $params[6][
'pages'] as $page ) {
193 $preload[] = $this->titleParser->parseTitle( $page );
202 $subtype = $this->entry->getSubtype();
207 || !( $subtype ===
'block' || $subtype ===
'reblock' )
208 || !$this->context->getAuthority()->isAllowed(
'block' )
213 $title = $this->entry->getTarget();
215 $params = $this->entry->getParameters();
216 if ( isset( $params[
'blockId'] ) ) {
218 $query = isset( $params[
'blockId'] ) ? [
'id' => $params[
'blockId'] ] : [];
220 $linkRenderer->makeKnownLink(
222 $this->msg(
'remove-blocklink' )->text(),
224 $query + [
'remove' =>
'1' ]
226 $linkRenderer->makeKnownLink(
228 $this->msg(
'change-blocklink' )->text(),
237 $linkRenderer->makeKnownLink(
239 $this->msg(
'manage-blocklink' )->text(),
246 $linkRenderer->makeKnownLink(
248 $this->msg(
'unblocklink' )->text()
250 $linkRenderer->makeKnownLink(
252 $this->msg(
'change-blocklink' )->text()
257 return $this->
msg(
'parentheses' )->rawParams(
258 $this->context->getLanguage()->pipeList( $links ) )->escaped();
270 $flags = trim( $flags );
271 if ( $flags ===
'' ) {
274 $flags = explode(
',', $flags );
275 $flagsCount = count( $flags );
277 for ( $i = 0; $i < $flagsCount; $i++ ) {
281 return wfMessage(
'parentheses' )->inLanguage( $lang )
282 ->rawParams( $lang->
commaList( $flags ) )->escaped();
293 static $messages = [];
295 if ( !isset( $messages[$flag] ) ) {
296 $messages[$flag] = htmlspecialchars( $flag );
306 $msg =
wfMessage(
'block-log-flags-' . $flag )->inLanguage( $lang );
308 if ( $msg->exists() ) {
309 $messages[$flag] = $msg->escaped();
313 return $messages[$flag];
325 '6::flags' =>
'6:array:flags',
328 foreach ( $map as $index => $key ) {
329 if ( isset( $params[$index] ) ) {
330 $params[$key] = $params[$index];
331 unset( $params[$index] );
338 if ( $subtype ===
'block' || $subtype ===
'reblock' ) {
341 '5::duration' =>
'infinity',
342 '6:array:flags' => [],
345 if ( !is_array( $params[
'6:array:flags'] ) ) {
347 $params[
'6:array:flags'] = $params[
'6:array:flags'] ===
''
349 : explode(
',', $params[
'6:array:flags'] );
354 $params[
'5::duration'] =
'infinity';
355 $params[
':plain:duration-l10n'] = $this->
msg(
'infiniteblock' )->plain();
358 $expiry = strtotime( $params[
'5::duration'], $ts );
359 if ( $expiry !==
false && $expiry > 0 ) {
360 $params[
':timestamp:expiry'] = $expiry;
362 $params[
':plain:duration-l10n'] = $this->context->getLanguage()
363 ->formatDurationBetweenTimestamps( $ts, $expiry );
375 $ret = parent::formatParametersForApi();
376 if ( isset( $ret[
'flags'] ) ) {
377 ApiResult::setIndexedTagName( $ret[
'flags'],
'f' );
380 if ( isset( $ret[
'restrictions'][
'pages'] ) ) {
381 $ret[
'restrictions'][
'pages'] = array_map(
function ( $title ) {
383 }, $ret[
'restrictions'][
'pages'] );
384 ApiResult::setIndexedTagName( $ret[
'restrictions'][
'pages'],
'p' );
387 if ( isset( $ret[
'restrictions'][
'namespaces'] ) ) {
389 ApiResult::setIndexedTagName( $ret[
'restrictions'][
'namespaces'],
'ns' );
396 $type = $this->entry->getType();
397 $subtype = $this->entry->getSubtype();
398 $params = $this->entry->getParameters();
399 $sitewide = $params[
'sitewide'] ??
true;
400 $count = $params[
'finalTargetCount'] ?? 0;
402 $key =
"logentry-$type-$subtype";
403 if ( ( $subtype ===
'block' || $subtype ===
'reblock' ) && !$sitewide ) {
407 $params = parent::getMessageParameters();
410 if ( isset( $params[6] ) ) {
411 $key =
"logentry-partial$type-$subtype";
413 $key =
"logentry-non-editing-$type-$subtype";
416 if ( $subtype ===
'block' && $count > 1 ) {
427class_alias( BlockLogFormatter::class,
'BlockLogFormatter' );
wfIsInfinity( $str)
Determine input string is represents as infinity.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
A class containing constants representing the names of configuration variables.
const UseCodexSpecialBlock
Name constant for the UseCodexSpecialBlock setting, for use with Config::get()
const EnablePartialActionBlocks
Name constant for the EnablePartialActionBlocks setting, for use with Config::get()
Parent class for all special pages.
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,...
getTimestamp()
Get the timestamp when the action was executed.
getParameters()
Get the extra parameters stored for this message.
getSubtype()
The log subtype.