mediawiki-extensions-Echo/formatters/EditFormatter.php
Siebrand Mazeland 69d91fa1b6 Update documentation and deprecated methods.
Basically having fun with the code analyzer.

Also:
* remove unused local variable assignments
* missing return values
* CSS optimizations.
* Initialize possible unset variables.

Change-Id: I77aa08ecb48eeda08f14dc38d7f35d57ea9fa110
2012-09-02 11:30:38 +02:00

43 lines
970 B
PHP

<?php
class EchoEditFormatter extends EchoBasicFormatter {
protected function processParam( EchoEvent $event, $param, $message, $user ) {
if ( $param === 'difflink' ) {
$eventData = $event->getExtra();
if ( !isset( $eventData['revid'] ) ) {
$message->params( '' );
return;
}
if ( !$event->getTitle() ) {
$message->params( wfMessage( 'echo-no-title' )->text() );
}
$revid = $eventData['revid'];
$title = $event->getTitle();
if ( $this->outputFormat === 'html' ) {
$link = Linker::link(
$title,
'(' . wfMessage( 'diff' )->escaped() . ')',
array(
'class' => 'mw-echo-diff',
),
array(
'oldid' => $revid,
'diff' => 'prev',
)
);
$message->rawParams( $link );
} else {
$link = $title->getFullURL(
array( 'oldid' => $revid, 'diff' => 'prev' ) );
$message->params( $link );
}
} else {
parent::processParam( $event, $param, $message, $user );
}
}
}