// The lrm is needed to make sure that the number
// is shown on the correct side of the tooltip text.
$durationTooltip = '‎' . htmlspecialchars( $params[4] );
- $params[4] = Message::rawParam(
- "<span class=\"blockExpiry\" title=\"$durationTooltip\">" .
- $this->context->getLanguage()->translateBlockExpiry(
- $params[4],
- $this->context->getUser(),
- wfTimestamp( TS_UNIX, $this->entry->getTimestamp() )
- ) .
- '</span>'
+ $blockExpiry = $this->context->getLanguage()->translateBlockExpiry(
+ $params[4],
+ $this->context->getUser(),
+ wfTimestamp( TS_UNIX, $this->entry->getTimestamp() )
);
+ if ( $this->plaintext ) {
+ $params[4] = Message::rawParam( $blockExpiry );
+ } else {
+ $params[4] = Message::rawParam(
+ "<span class=\"blockExpiry\" title=\"$durationTooltip\">" .
+ $blockExpiry .
+ '</span>'
+ );
+ }
$params[5] = isset( $params[5] ) ?
self::formatBlockFlags( $params[5], $this->context->getLanguage() ) : '';
// block restrictions
if ( isset( $params[6] ) ) {
$pages = $params[6]['pages'] ?? [];
- $pages = array_map( function ( $page ){
- return $this->makePageLink( Title::newFromText( ( $page ) ) );
+ $pages = array_map( function ( $page ) {
+ return $this->makePageLink( Title::newFromText( $page ) );
}, $pages );
- $params[6] = Message::rawParam( $this->context->getLanguage()->listToText( $pages ) );
- $params[7] = count( $pages );
+ $namespaces = $params[6]['namespaces'] ?? [];
+ $namespaces = array_map( function ( $ns ) {
+ $text = (int)$ns === NS_MAIN
+ ? $this->msg( 'blanknamespace' )->text()
+ : $this->context->getLanguage()->getFormattedNsText( $ns );
+ $params = [ 'namespace' => $ns ];
+
+ return $this->makePageLink( SpecialPage::getTitleFor( 'Allpages' ), $params, $text );
+ }, $namespaces );
+
+ $restrictions = [];
+ if ( $pages ) {
+ $restrictions[] = $this->msg( 'logentry-partialblock-block-page' )
+ ->numParams( count( $pages ) )
+ ->rawParams( $this->context->getLanguage()->listToText( $pages ) )->text();
+ }
+
+ if ( $namespaces ) {
+ $restrictions[] = $this->msg( 'logentry-partialblock-block-ns' )
+ ->numParams( count( $namespaces ) )
+ ->rawParams( $this->context->getLanguage()->listToText( $namespaces ) )->text();
+ }
+
+ $params[6] = Message::rawParam( $this->context->getLanguage()->listToText( $restrictions ) );
}
}
ApiResult::setIndexedTagName( $ret['restrictions']['pages'], 'p' );
}
+ if ( isset( $ret['restrictions']['namespaces'] ) ) {
+ ApiResult::setIndexedTagName( $ret['restrictions']['namespaces'], 'ns' );
+ }
+
return $ret;
}