Original: https://www.mediawiki.org/wiki/Extension:Comments Das hier ist eine an https://znil.net angepasste Version.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

40 lines
1.2 KiB

<?php
/**
* Logging formatter for Comments' log entries.
*
* @file
* @date 28 July 2013
*/
class CommentsLogFormatter extends WikitextLogFormatter {
/**
* Formats parameters intented for action message from
* array of all parameters. There are three hardcoded
* parameters (array is zero-indexed, this list not):
* - 1: user name with premade link
* - 2: usable for gender magic function
* - 3: target page with premade link
* @return array
*/
protected function getMessageParameters() {
if ( isset( $this->parsedParameters ) ) {
return $this->parsedParameters;
}
$entry = $this->entry;
$params = $this->extractParameters();
$commentId = $params[3]; // = $4, because array numbering starts from 0
$params[0] = Message::rawParam( $this->getPerformerElement() );
$params[1] = $this->canView( LogPage::DELETED_USER ) ? $entry->getPerformer()->getName() : '';
$title = $entry->getTarget();
if ( $title instanceof Title ) { // healthy paranoia
$title->setFragment( '#comment-' . $commentId );
}
$params[2] = Message::rawParam( $this->makePageLink( $title ) );
// Bad things happens if the numbers are not in correct order
ksort( $params );
return $this->parsedParameters = $params;
}
}