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] =
'infinite';
62 $durationTooltip =
'‎' . htmlspecialchars( $params[4] );
63 $blockExpiry = $this->context->getLanguage()->translateBlockExpiry(
65 $this->context->getUser(),
66 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] ) ?
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 $params = [
'namespace' => $ns ];
98 $actions = $params[6][
'actions'] ?? [];
99 $actions = array_map(
function ( $actions ) {
100 return $this->
msg(
'ipb-action-' . $actions )->text();
105 $restrictions[] = $this->
msg(
'logentry-partialblock-block-page' )
106 ->numParams( count( $pages ) )
107 ->rawParams( $this->context->getLanguage()->listToText( $pages ) )->text();
111 $restrictions[] = $this->
msg(
'logentry-partialblock-block-ns' )
112 ->numParams( count( $namespaces ) )
113 ->rawParams( $this->context->getLanguage()->listToText( $namespaces ) )->text();
115 $enablePartialActionBlocks = MediaWikiServices::getInstance()
116 ->getMainConfig()->get(
'EnablePartialActionBlocks' );
117 if ( $actions && $enablePartialActionBlocks ) {
118 $restrictions[] = $this->
msg(
'logentry-partialblock-block-action' )
119 ->numParams( count( $actions ) )
120 ->rawParams( $this->context->getLanguage()->listToText( $actions ) )->text();
123 $params[6] =
Message::rawParam( $this->context->getLanguage()->listToText( $restrictions ) );
131 $params = parent::extractParameters();
133 if ( $this->entry->isLegacy() && isset( $params[3] ) ) {
134 if ( isset( $params[4] ) ) {
135 $params[5] = $params[4];
137 $params[4] = $params[3];
144 $title = $this->entry->getTarget();
147 if ( substr(
$title->getText(), 0, 1 ) !==
'#' &&
$title->canExist() ) {
148 $preload[] =
$title->getTalkPage();
152 if ( isset( $params[6][
'pages'] ) ) {
153 foreach ( $params[6][
'pages'] as $page ) {
154 $preload[] = Title::newFromText( $page );
161 $subtype = $this->entry->getSubtype();
164 || !( $subtype ===
'block' || $subtype ===
'reblock' )
165 || !$this->context->getAuthority()->isAllowed(
'block' )
171 $title = $this->entry->getTarget();
175 $this->msg(
'unblocklink' )->text()
179 $this->msg(
'change-blocklink' )->text()
183 return $this->
msg(
'parentheses' )->rawParams(
184 $this->context->getLanguage()->pipeList( $links ) )->escaped();
196 $flags = trim( $flags );
197 if ( $flags ===
'' ) {
200 $flags = explode(
',', $flags );
201 $flagsCount = count( $flags );
203 for ( $i = 0; $i < $flagsCount; $i++ ) {
208 ->rawParams(
$lang->commaList( $flags ) )->escaped();
219 static $messages = [];
221 if ( !isset( $messages[$flag] ) ) {
222 $messages[$flag] = htmlspecialchars( $flag );
232 $msg =
wfMessage(
'block-log-flags-' . $flag )->inLanguage(
$lang );
234 if ( $msg->exists() ) {
235 $messages[$flag] = $msg->escaped();
239 return $messages[$flag];
251 '6::flags' =>
'6:array:flags',
254 foreach ( $map as $index => $key ) {
255 if ( isset( $params[$index] ) ) {
256 $params[$key] = $params[$index];
257 unset( $params[$index] );
264 if ( $subtype ===
'block' || $subtype ===
'reblock' ) {
267 '5::duration' =>
'infinite',
268 '6:array:flags' => [],
271 if ( !is_array( $params[
'6:array:flags'] ) ) {
273 $params[
'6:array:flags'] = $params[
'6:array:flags'] ===
''
275 : explode(
',', $params[
'6:array:flags'] );
280 $expiry = strtotime( $params[
'5::duration'], $ts );
281 if ( $expiry !==
false && $expiry > 0 ) {
282 $params[
':timestamp:expiry'] = $expiry;
295 $ret = parent::formatParametersForApi();
296 if ( isset( $ret[
'flags'] ) ) {
297 ApiResult::setIndexedTagName( $ret[
'flags'],
'f' );
300 if ( isset( $ret[
'restrictions'][
'pages'] ) ) {
301 $ret[
'restrictions'][
'pages'] = array_map(
function (
$title ) {
303 }, $ret[
'restrictions'][
'pages'] );
304 ApiResult::setIndexedTagName( $ret[
'restrictions'][
'pages'],
'p' );
307 if ( isset( $ret[
'restrictions'][
'namespaces'] ) ) {
308 ApiResult::setIndexedTagName( $ret[
'restrictions'][
'namespaces'],
'ns' );
315 $type = $this->entry->getType();
316 $subtype = $this->entry->getSubtype();
317 $sitewide = $this->entry->getParameters()[
'sitewide'] ??
true;
319 $key =
"logentry-$type-$subtype";
320 if ( ( $subtype ===
'block' || $subtype ===
'reblock' ) && !$sitewide ) {
324 $params = parent::getMessageParameters();
327 if ( isset( $params[6] ) ) {
328 $key =
"logentry-partial$type-$subtype";
330 $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.
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
const TOOL_LINKS_NOBLOCK
Flags for userToolLinks()
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