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';
61 $durationTooltip =
'‎' . htmlspecialchars( $params[4] );
62 $blockExpiry = $this->context->getLanguage()->translateBlockExpiry(
64 $this->context->getUser(),
65 wfTimestamp( TS_UNIX, $this->entry->getTimestamp() )
67 if ( $this->plaintext ) {
71 "<span class=\"blockExpiry\" title=\"$durationTooltip\">" .
72 htmlspecialchars( $blockExpiry ) .
76 $params[5] = isset( $params[5] ) ?
80 if ( isset( $params[6] ) ) {
81 $pages = $params[6][
'pages'] ?? [];
82 $pages = array_map(
function ( $page ) {
83 return $this->
makePageLink( Title::newFromText( $page ) );
86 $namespaces = $params[6][
'namespaces'] ?? [];
87 $namespaces = array_map(
function ( $ns ) {
89 ? $this->
msg(
'blanknamespace' )->escaped()
90 : htmlspecialchars( $this->context->getLanguage()->getFormattedNsText( $ns ) );
91 $params = [
'namespace' => $ns ];
98 $restrictions[] = $this->
msg(
'logentry-partialblock-block-page' )
99 ->numParams( count( $pages ) )
100 ->rawParams( $this->context->getLanguage()->listToText( $pages ) )->escaped();
104 $restrictions[] = $this->
msg(
'logentry-partialblock-block-ns' )
105 ->numParams( count( $namespaces ) )
106 ->rawParams( $this->context->getLanguage()->listToText( $namespaces ) )->escaped();
109 $params[6] =
Message::rawParam( $this->context->getLanguage()->listToText( $restrictions ) );
117 $params = parent::extractParameters();
119 if ( $this->entry->isLegacy() && isset( $params[3] ) ) {
120 if ( isset( $params[4] ) ) {
121 $params[5] = $params[4];
123 $params[4] = $params[3];
130 $title = $this->entry->getTarget();
133 if ( substr(
$title->getText(), 0, 1 ) !==
'#' &&
$title->canExist() ) {
134 $preload[] =
$title->getTalkPage();
138 if ( isset( $params[6][
'pages'] ) ) {
139 foreach ( $params[6][
'pages'] as $page ) {
140 $preload[] = Title::newFromText( $page );
147 $subtype = $this->entry->getSubtype();
150 || !( $subtype ===
'block' || $subtype ===
'reblock' )
151 || !MediaWikiServices::getInstance()
152 ->getPermissionManager()
153 ->userHasRight( $this->context->getUser(),
'block' )
159 $title = $this->entry->getTarget();
163 $this->msg(
'unblocklink' )->text()
167 $this->msg(
'change-blocklink' )->text()
171 return $this->
msg(
'parentheses' )->rawParams(
172 $this->context->getLanguage()->pipeList( $links ) )->escaped();
184 $flags = trim( $flags );
185 if ( $flags ===
'' ) {
188 $flags = explode(
',', $flags );
189 $flagsCount = count( $flags );
191 for ( $i = 0; $i < $flagsCount; $i++ ) {
196 ->rawParams(
$lang->commaList( $flags ) )->escaped();
207 static $messages = [];
209 if ( !isset( $messages[$flag] ) ) {
210 $messages[$flag] = htmlspecialchars( $flag );
220 $msg =
wfMessage(
'block-log-flags-' . $flag )->inLanguage(
$lang );
222 if ( $msg->exists() ) {
223 $messages[$flag] = $msg->escaped();
227 return $messages[$flag];
239 '6::flags' =>
'6:array:flags',
242 foreach ( $map as $index => $key ) {
243 if ( isset( $params[$index] ) ) {
244 $params[$key] = $params[$index];
245 unset( $params[$index] );
252 if ( $subtype ===
'block' || $subtype ===
'reblock' ) {
255 '5::duration' =>
'infinite',
256 '6:array:flags' => [],
259 if ( !is_array( $params[
'6:array:flags'] ) ) {
261 $params[
'6:array:flags'] = $params[
'6:array:flags'] ===
''
263 : explode(
',', $params[
'6:array:flags'] );
268 $expiry = strtotime( $params[
'5::duration'], $ts );
269 if ( $expiry !==
false && $expiry > 0 ) {
270 $params[
':timestamp:expiry'] = $expiry;
283 $ret = parent::formatParametersForApi();
284 if ( isset( $ret[
'flags'] ) ) {
285 ApiResult::setIndexedTagName( $ret[
'flags'],
'f' );
288 if ( isset( $ret[
'restrictions'][
'pages'] ) ) {
289 $ret[
'restrictions'][
'pages'] = array_map(
function (
$title ) {
291 }, $ret[
'restrictions'][
'pages'] );
292 ApiResult::setIndexedTagName( $ret[
'restrictions'][
'pages'],
'p' );
295 if ( isset( $ret[
'restrictions'][
'namespaces'] ) ) {
296 ApiResult::setIndexedTagName( $ret[
'restrictions'][
'namespaces'],
'ns' );
303 $type = $this->entry->getType();
304 $subtype = $this->entry->getSubtype();
305 $sitewide = $this->entry->getParameters()[
'sitewide'] ??
true;
307 $key =
"logentry-$type-$subtype";
308 if ( ( $subtype ===
'block' || $subtype ===
'reblock' ) && !$sitewide ) {
312 $params = parent::getMessageParameters();
315 if ( isset( $params[6] ) ) {
316 $key =
"logentry-partial$type-$subtype";
318 $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')
Static factory method for creation from username.
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