2012-04-27 15:14:24 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class EchoEditFormatter extends EchoBasicFormatter {
|
2012-05-17 15:36:18 +00:00
|
|
|
protected function processParam( $event, $param, $message, $user ) {
|
2012-04-27 15:14:24 +00:00
|
|
|
if ( $param === 'difflink' ) {
|
|
|
|
$eventData = $event->getExtra();
|
2012-07-26 17:23:18 +00:00
|
|
|
if ( !isset( $eventData['revid'] ) ) {
|
2012-08-30 16:04:39 +00:00
|
|
|
$message->params( '' );
|
2012-04-27 15:14:24 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !$event->getTitle() ) {
|
2012-07-26 17:23:18 +00:00
|
|
|
$message->params( wfMessage( 'echo-no-title' )->text() );
|
2012-04-27 15:14:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$revid = $eventData['revid'];
|
|
|
|
$title = $event->getTitle();
|
|
|
|
|
|
|
|
if ( $this->outputFormat === 'html' ) {
|
|
|
|
$link = Linker::link(
|
|
|
|
$title,
|
2012-07-26 17:23:18 +00:00
|
|
|
'(' . wfMessage( 'diff' )->escaped() . ')',
|
2012-04-27 15:14:24 +00:00
|
|
|
array(
|
|
|
|
'class' => 'mw-echo-diff',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'oldid' => $revid,
|
|
|
|
'diff' => 'prev',
|
|
|
|
)
|
|
|
|
);
|
2012-07-26 17:23:18 +00:00
|
|
|
$message->rawParams( $link );
|
2012-04-27 15:14:24 +00:00
|
|
|
} else {
|
2012-05-17 15:36:18 +00:00
|
|
|
$link = $title->getFullURL(
|
2012-04-27 15:14:24 +00:00
|
|
|
array( 'oldid' => $revid, 'diff' => 'prev' ) );
|
|
|
|
|
2012-07-26 17:23:18 +00:00
|
|
|
$message->params( $link );
|
2012-04-27 15:14:24 +00:00
|
|
|
}
|
2012-05-17 15:36:18 +00:00
|
|
|
} else {
|
|
|
|
parent::processParam( $event, $param, $message, $user );
|
2012-04-27 15:14:24 +00:00
|
|
|
}
|
|
|
|
}
|
2012-07-26 17:23:18 +00:00
|
|
|
}
|