mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-12 09:26:05 +00:00
961f86bd33
Patch Set 6: 1. use 'linked' icron 2. update message from cross-referenced to cross referenced Change-Id: I8c70454e59b5f9f86f92825cfc75dcf5d9bcb336
48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?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':
|
|
// wikitext format of the title of the page that gets linked in other page
|
|
case 'title-linked-wiki-format':
|
|
$list = array();
|
|
if ( isset( $extra['notif-list'][$user->getID()] ) ) {
|
|
global $wgLang;
|
|
|
|
foreach ( $extra['notif-list'][$user->getID()] as $page ) {
|
|
$title = Title::makeTitle( $page['pl_namespace'], $page['pl_title'] );
|
|
if ( $param === 'title-linked-wiki-format' ) {
|
|
$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;
|
|
}
|
|
}
|
|
|
|
}
|