56 if ( $handler !==
'' && is_string( $handler ) && class_exists( $handler ) ) {
57 return new $handler(
$entry );
137 if ( $this->linkRenderer !==
null ) {
140 return MediaWikiServices::getInstance()->getLinkRenderer();
152 ? self::FOR_THIS_USER
163 $logRestrictions = $this->context->getConfig()->get(
'LogRestrictions' );
164 $type = $this->entry->getType();
165 return !isset( $logRestrictions[
$type] )
166 || MediaWikiServices::getInstance()
167 ->getPermissionManager()
168 ->userHasRight( $this->context->getUser(), $logRestrictions[
$type] );
177 if ( $this->audience == self::FOR_THIS_USER ) {
179 $this->entry->getDeleted(), $field, $this->context->getUser() ) &&
180 self::canViewLogType();
193 $this->linkFlood = $value;
205 $this->plaintext =
true;
207 $this->plaintext =
false;
220 $comment = $this->entry->getComment();
222 if ( $comment !=
'' ) {
223 if ( $actionComment ==
'' ) {
224 $actionComment = $comment;
226 $actionComment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() . $comment;
230 return $actionComment;
240 $this->plaintext =
true;
241 $this->irctext =
true;
249 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
254 $movesource = $parameters[
'4::target'];
256 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
259 $movesource = $parameters[
'4::target'];
261 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
263 case 'move-noredirect':
265 case 'move_redir-noredirect':
274 ->rawParams( $target )->inContentLanguage()->escaped();
278 ->rawParams( $target )->inContentLanguage()->escaped();
291 $diffLink = htmlspecialchars(
292 wfMessage(
'patrol-log-diff', $parameters[
'4::curid'] )
293 ->inContentLanguage()->text() );
294 $text =
wfMessage(
'patrol-log-line', $diffLink,
"[[$target]]",
"" )
295 ->inContentLanguage()->text();
305 ->rawParams( $target .
' ' . $parameters[
'4::description'] )->inContentLanguage()->escaped();
308 $text =
wfMessage(
'unprotectedarticle' )
309 ->rawParams( $target )->inContentLanguage()->escaped();
312 $text =
wfMessage(
'modifiedarticleprotection' )
313 ->rawParams( $target .
' ' . $parameters[
'4::description'] )->inContentLanguage()->escaped();
316 $text =
wfMessage(
'movedarticleprotection' )
317 ->rawParams( $target, $parameters[
'4::oldtitle'] )->inContentLanguage()->escaped();
326 $text =
wfMessage(
'newuserlog-create-entry' )
327 ->inContentLanguage()->escaped();
331 $text =
wfMessage(
'newuserlog-create2-entry' )
332 ->rawParams( $target )->inContentLanguage()->escaped();
335 $text =
wfMessage(
'newuserlog-autocreate-entry' )
336 ->inContentLanguage()->escaped();
345 ->rawParams( $target )->inContentLanguage()->escaped();
350 ->rawParams( $target )->inContentLanguage()->escaped();
356 if ( count( $parameters[
'4::oldgroups'] ) ) {
357 $oldgroups = implode(
', ', $parameters[
'4::oldgroups'] );
359 $oldgroups =
wfMessage(
'rightsnone' )->inContentLanguage()->escaped();
361 if ( count( $parameters[
'5::newgroups'] ) ) {
362 $newgroups = implode(
', ', $parameters[
'5::newgroups'] );
364 $newgroups =
wfMessage(
'rightsnone' )->inContentLanguage()->escaped();
369 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
372 $text =
wfMessage(
'rightslogentry-autopromote' )
373 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
379 $text =
wfMessage(
'pagemerge-logentry' )
380 ->rawParams( $target, $parameters[
'4::dest'], $parameters[
'5::mergepoint'] )
381 ->inContentLanguage()->escaped();
390 $rawDuration = $parameters[0];
391 $rawFlags = $parameters[1] ??
'';
393 $rawDuration = $parameters[
'5::duration'];
394 $rawFlags = $parameters[
'6::flags'];
396 $duration = $contLang->translateBlockExpiry(
403 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
407 ->rawParams( $target )->inContentLanguage()->escaped();
410 $duration = $contLang->translateBlockExpiry(
411 $parameters[
'5::duration'],
418 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
426 $text =
wfMessage(
'import-logentry-upload' )
427 ->rawParams( $target )->inContentLanguage()->escaped();
430 $text =
wfMessage(
'import-logentry-interwiki' )
431 ->rawParams( $target )->inContentLanguage()->escaped();
438 if ( is_null( $text ) ) {
442 $this->plaintext =
false;
443 $this->irctext =
false;
457 if ( $element instanceof
Message ) {
458 $element = $this->plaintext ? $element->text() : $element->escaped();
464 $sep = $this->
msg(
'word-separator' );
465 $sep = $this->plaintext ? $sep->text() : $sep->escaped();
494 $type = $this->entry->getType();
495 $subtype = $this->entry->getSubtype();
497 return "logentry-$type-$subtype";
520 $params[$index + 3] = $value;
526 if ( strpos( $key,
':' ) === false ) {
529 list( $index,
$type, ) = explode(
':', $key, 3 );
530 if ( ctype_digit( $index ) ) {
539 if ( count( $params ) ) {
540 $max = max( array_keys( $params ) );
542 for ( $i = 3; $i < $max; $i++ ) {
543 if ( !isset( $params[$i] ) ) {
562 if ( isset( $this->parsedParameters ) ) {
575 $this->parsedParameters = $params;
608 switch ( strtolower( trim(
$type ) ) ) {
610 $value = Message::rawParam( $value );
613 $value = $this->context->getLanguage()->commaList( $value );
616 $value = $this->
msg( $value )->text();
619 $value = $this->
msg( $value )->inContentLanguage()->text();
622 $value = Message::numParam( $value );
626 $value = $user->getName();
634 $value = $this->
msg(
'empty-username' )->text();
636 $value = Message::rawParam( $this->
makeUserLink( $user ) );
642 $value =
$title->getPrefixedText();
667 $msg = $this->
msg(
'invalidtitle' )->text();
668 if ( $this->plaintext ) {
671 return Html::element(
'span', [
'class' =>
'mw-invalidtitle' ], $msg );
675 if ( $this->plaintext ) {
676 $link =
'[[' .
$title->getPrefixedText() .
']]';
678 $html = $html !==
null ?
new HtmlArmor( $html ) : $html;
693 $performer = $this->entry->getPerformer();
713 $element = ltrim( $comment );
731 if ( $this->plaintext ) {
732 return $this->
msg( $message )->text();
736 $attribs = [
'class' =>
'history-deleted' ];
738 return Html::rawElement(
'span', $attribs,
$content );
747 if ( $this->plaintext ) {
750 $attribs = [
'class' =>
'history-deleted' ];
752 return Html::rawElement(
'span', $attribs,
$content );
761 protected function msg( $key, ...$params ) {
762 return $this->context->msg( $key, ...$params );
772 if ( $this->plaintext ) {
780 if ( $this->linkFlood ) {
819 return $this->entry->getParameters();
839 $vals = explode(
':', $key, 3 );
840 if ( count( $vals ) !== 3 ) {
841 if ( $value instanceof __PHP_Incomplete_Class ) {
842 wfLogWarning(
'Log entry of type ' . $this->entry->getFullType() .
843 ' contains unrecoverable extra parameters.' );
846 $logParams[$key] = $value;
870 $value = (bool)$value;
874 if ( ctype_digit( $value ) || is_int( $value ) ) {
875 $value = (int)$value;
877 $value = (float)$value;
884 if ( is_array( $value ) ) {
895 $msg = $this->
msg( $value );
896 if (
$type ===
'msg-content' ) {
897 $msg->inContentLanguage();
900 $value[
"{$name}_key"] = $msg->getKey();
901 if ( $msg->getParams() ) {
902 $value[
"{$name}_params"] = $msg->getParams();
904 $value[
"{$name}_text"] = $msg->text();
922 $value = $user->getName();
931 return [ $name => $value ];