35 $params = parent::getMessageParameters();
37 $title = $this->entry->getTarget();
38 if ( substr(
$title->getText(), 0, 1 ) ===
'#' ) {
40 $params[2] =
$title->getText();
44 $username =
$title->getText();
49 $params[3] = $username;
52 $subtype = $this->entry->getSubtype();
53 if ( $subtype ===
'block' || $subtype ===
'reblock' ) {
54 if ( !isset( $params[4] ) ) {
56 $params[4] =
'infinity';
63 $durationTooltip =
'‎' . htmlspecialchars( $params[4] );
64 $blockExpiry = $this->context->getLanguage()->translateBlockExpiry(
66 $this->context->getUser(),
67 (
int)
wfTimestamp( TS_UNIX, $this->entry->getTimestamp() )
69 if ( $this->plaintext ) {
74 "<span class=\"blockExpiry\" title=\"$durationTooltip\">" .
76 htmlspecialchars( $blockExpiry ) .
80 $params[5] = isset( $params[5] ) ?
84 if ( isset( $params[6] ) ) {
85 $pages = $params[6][
'pages'] ?? [];
86 $pages = array_map(
function ( $page ) {
90 $namespaces = $params[6][
'namespaces'] ?? [];
91 $namespaces = array_map(
function ( $ns ) {
93 ? $this->
msg(
'blanknamespace' )->escaped()
94 : htmlspecialchars( $this->context->getLanguage()->getFormattedNsText( $ns ) );
95 if ( $this->plaintext ) {
103 [
'namespace' => $ns ],
109 $actions = $params[6][
'actions'] ?? [];
110 $actions = array_map(
function ( $actions ) {
111 return $this->
msg(
'ipb-action-' . $actions )->text();
116 $restrictions[] = $this->
msg(
'logentry-partialblock-block-page' )
117 ->numParams( count( $pages ) )
118 ->rawParams( $this->context->getLanguage()->listToText( $pages ) )->text();
122 $restrictions[] = $this->
msg(
'logentry-partialblock-block-ns' )
123 ->numParams( count( $namespaces ) )
124 ->rawParams( $this->context->getLanguage()->listToText( $namespaces ) )->text();
126 $enablePartialActionBlocks = $this->context->getConfig()
127 ->get( MainConfigNames::EnablePartialActionBlocks );
128 if ( $actions && $enablePartialActionBlocks ) {
129 $restrictions[] = $this->
msg(
'logentry-partialblock-block-action' )
130 ->numParams( count( $actions ) )
131 ->rawParams( $this->context->getLanguage()->listToText( $actions ) )->text();
134 $params[6] =
Message::rawParam( $this->context->getLanguage()->listToText( $restrictions ) );
142 $params = parent::extractParameters();
144 if ( $this->entry->isLegacy() && isset( $params[3] ) ) {
145 if ( isset( $params[4] ) ) {
146 $params[5] = $params[4];
148 $params[4] = $params[3];
155 $title = $this->entry->getTarget();
158 if ( substr(
$title->getText(), 0, 1 ) !==
'#' &&
$title->canExist() ) {
159 $preload[] =
$title->getTalkPage();
163 if ( isset( $params[6][
'pages'] ) ) {
164 foreach ( $params[6][
'pages'] as $page ) {
172 $subtype = $this->entry->getSubtype();
175 || !( $subtype ===
'block' || $subtype ===
'reblock' )
176 || !$this->context->getAuthority()->isAllowed(
'block' )
182 $title = $this->entry->getTarget();
184 $linkRenderer->makeKnownLink(
186 $this->msg(
'unblocklink' )->text()
188 $linkRenderer->makeKnownLink(
190 $this->msg(
'change-blocklink' )->text()
194 return $this->
msg(
'parentheses' )->rawParams(
195 $this->context->getLanguage()->pipeList( $links ) )->escaped();
207 $flags = trim( $flags );
208 if ( $flags ===
'' ) {
211 $flags = explode(
',', $flags );
212 $flagsCount = count( $flags );
214 for ( $i = 0; $i < $flagsCount; $i++ ) {
219 ->rawParams(
$lang->commaList( $flags ) )->escaped();
230 static $messages = [];
232 if ( !isset( $messages[$flag] ) ) {
233 $messages[$flag] = htmlspecialchars( $flag );
243 $msg =
wfMessage(
'block-log-flags-' . $flag )->inLanguage(
$lang );
245 if ( $msg->exists() ) {
246 $messages[$flag] = $msg->escaped();
250 return $messages[$flag];
262 '6::flags' =>
'6:array:flags',
265 foreach ( $map as $index => $key ) {
266 if ( isset( $params[$index] ) ) {
267 $params[$key] = $params[$index];
268 unset( $params[$index] );
275 if ( $subtype ===
'block' || $subtype ===
'reblock' ) {
278 '5::duration' =>
'infinity',
279 '6:array:flags' => [],
282 if ( !is_array( $params[
'6:array:flags'] ) ) {
284 $params[
'6:array:flags'] = $params[
'6:array:flags'] ===
''
286 : explode(
',', $params[
'6:array:flags'] );
291 $params[
'5::duration'] =
'infinity';
294 $expiry = strtotime( $params[
'5::duration'], $ts );
295 if ( $expiry !==
false && $expiry > 0 ) {
296 $params[
':timestamp:expiry'] = $expiry;
309 $ret = parent::formatParametersForApi();
310 if ( isset( $ret[
'flags'] ) ) {
314 if ( isset( $ret[
'restrictions'][
'pages'] ) ) {
315 $ret[
'restrictions'][
'pages'] = array_map(
function (
$title ) {
317 }, $ret[
'restrictions'][
'pages'] );
321 if ( isset( $ret[
'restrictions'][
'namespaces'] ) ) {
330 $type = $this->entry->getType();
331 $subtype = $this->entry->getSubtype();
332 $sitewide = $this->entry->getParameters()[
'sitewide'] ??
true;
334 $key =
"logentry-$type-$subtype";
335 if ( ( $subtype ===
'block' || $subtype ===
'reblock' ) && !$sitewide ) {
339 $params = parent::getMessageParameters();
342 if ( isset( $params[6] ) ) {
343 $key =
"logentry-partial$type-$subtype";
345 $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.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Base class for language-specific code.
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 newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
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