34 $params = parent::getMessageParameters();
36 $title = $this->entry->getTarget();
37 if ( substr(
$title->getText(), 0, 1 ) ===
'#' ) {
39 $params[2] =
$title->getText();
43 $username =
$title->getText();
48 $params[3] = $username;
51 $subtype = $this->entry->getSubtype();
52 if ( $subtype ===
'block' || $subtype ===
'reblock' ) {
53 if ( !isset( $params[4] ) ) {
55 $params[4] =
'infinity';
62 $durationTooltip =
'‎' . htmlspecialchars( $params[4] );
63 $blockExpiry = $this->context->getLanguage()->translateBlockExpiry(
65 $this->context->getUser(),
66 (
int)
wfTimestamp( TS_UNIX, $this->entry->getTimestamp() )
68 if ( $this->plaintext ) {
72 "<span class=\"blockExpiry\" title=\"$durationTooltip\">" .
74 htmlspecialchars( $blockExpiry ) .
78 $params[5] = isset( $params[5] ) ?
79 self::formatBlockFlags( $params[5], $this->context->getLanguage() ) :
'';
82 if ( isset( $params[6] ) ) {
83 $pages = $params[6][
'pages'] ?? [];
84 $pages = array_map(
function ( $page ) {
85 return $this->
makePageLink( Title::newFromText( $page ) );
88 $namespaces = $params[6][
'namespaces'] ?? [];
89 $namespaces = array_map(
function ( $ns ) {
91 ? $this->
msg(
'blanknamespace' )->escaped()
92 : htmlspecialchars( $this->context->getLanguage()->getFormattedNsText( $ns ) );
93 if ( $this->plaintext ) {
101 [
'namespace' => $ns ],
107 $actions = $params[6][
'actions'] ?? [];
108 $actions = array_map(
function ( $actions ) {
109 return $this->
msg(
'ipb-action-' . $actions )->escaped();
114 $restrictions[] = $this->
msg(
'logentry-partialblock-block-page' )
115 ->numParams( count( $pages ) )
116 ->rawParams( $this->context->getLanguage()->listToText( $pages ) )->escaped();
120 $restrictions[] = $this->
msg(
'logentry-partialblock-block-ns' )
121 ->numParams( count( $namespaces ) )
122 ->rawParams( $this->context->getLanguage()->listToText( $namespaces ) )->escaped();
124 $enablePartialActionBlocks = $this->context->getConfig()
125 ->get( MainConfigNames::EnablePartialActionBlocks );
126 if ( $actions && $enablePartialActionBlocks ) {
127 $restrictions[] = $this->
msg(
'logentry-partialblock-block-action' )
128 ->numParams( count( $actions ) )
129 ->rawParams( $this->context->getLanguage()->listToText( $actions ) )->escaped();
132 $params[6] =
Message::rawParam( $this->context->getLanguage()->listToText( $restrictions ) );
140 $params = parent::extractParameters();
142 if ( $this->entry->isLegacy() && isset( $params[3] ) ) {
143 if ( isset( $params[4] ) ) {
144 $params[5] = $params[4];
146 $params[4] = $params[3];
153 $title = $this->entry->getTarget();
156 if ( substr(
$title->getText(), 0, 1 ) !==
'#' &&
$title->canExist() ) {
157 $preload[] =
$title->getTalkPage();
161 if ( isset( $params[6][
'pages'] ) ) {
162 foreach ( $params[6][
'pages'] as $page ) {
163 $preload[] = Title::newFromText( $page );
170 $subtype = $this->entry->getSubtype();
173 || !( $subtype ===
'block' || $subtype ===
'reblock' )
174 || !$this->context->getAuthority()->isAllowed(
'block' )
180 $title = $this->entry->getTarget();
182 $linkRenderer->makeKnownLink(
184 $this->msg(
'unblocklink' )->text()
186 $linkRenderer->makeKnownLink(
188 $this->msg(
'change-blocklink' )->text()
192 return $this->
msg(
'parentheses' )->rawParams(
193 $this->context->getLanguage()->pipeList( $links ) )->escaped();
205 $flags = trim( $flags );
206 if ( $flags ===
'' ) {
209 $flags = explode(
',', $flags );
210 $flagsCount = count( $flags );
212 for ( $i = 0; $i < $flagsCount; $i++ ) {
213 $flags[$i] = self::formatBlockFlag( $flags[$i],
$lang );
217 ->rawParams(
$lang->commaList( $flags ) )->escaped();
228 static $messages = [];
230 if ( !isset( $messages[$flag] ) ) {
231 $messages[$flag] = htmlspecialchars( $flag );
241 $msg =
wfMessage(
'block-log-flags-' . $flag )->inLanguage(
$lang );
243 if ( $msg->exists() ) {
244 $messages[$flag] = $msg->escaped();
248 return $messages[$flag];
260 '6::flags' =>
'6:array:flags',
263 foreach ( $map as $index => $key ) {
264 if ( isset( $params[$index] ) ) {
265 $params[$key] = $params[$index];
266 unset( $params[$index] );
273 if ( $subtype ===
'block' || $subtype ===
'reblock' ) {
276 '5::duration' =>
'infinity',
277 '6:array:flags' => [],
280 if ( !is_array( $params[
'6:array:flags'] ) ) {
282 $params[
'6:array:flags'] = $params[
'6:array:flags'] ===
''
284 : explode(
',', $params[
'6:array:flags'] );
289 $params[
'5::duration'] =
'infinity';
292 $expiry = strtotime( $params[
'5::duration'], $ts );
293 if ( $expiry !==
false && $expiry > 0 ) {
294 $params[
':timestamp:expiry'] = $expiry;
307 $ret = parent::formatParametersForApi();
308 if ( isset( $ret[
'flags'] ) ) {
309 ApiResult::setIndexedTagName( $ret[
'flags'],
'f' );
312 if ( isset( $ret[
'restrictions'][
'pages'] ) ) {
313 $ret[
'restrictions'][
'pages'] = array_map(
function (
$title ) {
315 }, $ret[
'restrictions'][
'pages'] );
316 ApiResult::setIndexedTagName( $ret[
'restrictions'][
'pages'],
'p' );
319 if ( isset( $ret[
'restrictions'][
'namespaces'] ) ) {
321 ApiResult::setIndexedTagName( $ret[
'restrictions'][
'namespaces'],
'ns' );
328 $type = $this->entry->getType();
329 $subtype = $this->entry->getSubtype();
330 $sitewide = $this->entry->getParameters()[
'sitewide'] ??
true;
332 $key =
"logentry-$type-$subtype";
333 if ( ( $subtype ===
'block' || $subtype ===
'reblock' ) && !$sitewide ) {
337 $params = parent::getMessageParameters();
340 if ( isset( $params[6] ) ) {
341 $key =
"logentry-partial$type-$subtype";
343 $key =
"logentry-non-editing-$type-$subtype";
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.
Base class for language-specific code.
const TOOL_LINKS_NOBLOCK
Flags for userToolLinks()
A class containing constants representing the names of configuration variables.
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,...
static newFromName( $name, $validate='valid')
getParameters()
Get the extra parameters stored for this message.
getTimestamp()
Get the timestamp when the action was executed.
getSubtype()
The log subtype.
if(!isset( $args[0])) $lang