2012-12-26 22:05:29 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Formatter for 'article-linked' notifications
|
|
|
|
*/
|
|
|
|
class MWEchoArticleLinkedFormatter extends EchoEditFormatter {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $event EchoEvent
|
|
|
|
* @param $param string
|
|
|
|
* @param $message Message
|
|
|
|
* @param $user User
|
|
|
|
*/
|
|
|
|
protected function processParam( $event, $param, $message, $user ) {
|
|
|
|
$extra = $event->getExtra();
|
|
|
|
|
|
|
|
switch ( $param ) {
|
|
|
|
// title of the page that gets linked in other page
|
|
|
|
case 'title-linked':
|
2013-01-04 19:58:30 +00:00
|
|
|
if ( isset( $extra['notif-list'][$user->getID()] ) && $extra['notif-list'][$user->getID()] ) {
|
2012-12-26 22:05:29 +00:00
|
|
|
global $wgLang;
|
2013-01-04 19:58:30 +00:00
|
|
|
$list = array();
|
2012-12-26 22:05:29 +00:00
|
|
|
|
|
|
|
foreach ( $extra['notif-list'][$user->getID()] as $page ) {
|
|
|
|
$title = Title::makeTitle( $page['pl_namespace'], $page['pl_title'] );
|
2013-01-07 22:44:58 +00:00
|
|
|
if ( $this->outputFormat === 'html' ) {
|
2012-12-26 22:05:29 +00:00
|
|
|
$list[] = '[[' . $title->getPrefixedText() . ']]';
|
|
|
|
} else {
|
|
|
|
$list[] = $title->getPrefixedText();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$message->params( $wgLang->commaList( $list ) );
|
|
|
|
$message->params( count( $extra['notif-list'][$user->getID()] ) );
|
|
|
|
} else {
|
|
|
|
$message->params( '' );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
parent::processParam( $event, $param, $message, $user );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|