Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
GlobalUserMergeLogFormatter | |
0.00% |
0 / 13 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
extractParameters | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
6 | |||
getCentralAuthLink | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\CentralAuth\LogFormatter; |
4 | |
5 | use LogFormatter; |
6 | use MediaWiki\Message\Message; |
7 | use MediaWiki\SpecialPage\SpecialPage; |
8 | |
9 | /** |
10 | * Format the gblrename/merge log entries |
11 | * |
12 | * phan-taint-check gets very confused by $this->plaintext changing expected taint types everywhere, |
13 | * so manual annotations are needed. They should be correct for the non-plaintext mode (HTML output). |
14 | */ |
15 | class GlobalUserMergeLogFormatter extends LogFormatter { |
16 | |
17 | protected function extractParameters() { |
18 | $lang = $this->context->getLanguage(); |
19 | $params = parent::extractParameters(); |
20 | |
21 | $from = []; |
22 | foreach ( explode( '|', $params[3] ) as $name ) { |
23 | $from[] = $this->getCentralAuthLink( $name ); |
24 | } |
25 | |
26 | return [ |
27 | 3 => Message::rawParam( $lang->commaList( $from ) ), |
28 | 4 => Message::rawParam( $this->getCentralAuthLink( $params[4] ) ), |
29 | ]; |
30 | } |
31 | |
32 | /** |
33 | * @param string $name |
34 | * @param-taint $name none |
35 | * @return string wikitext or html |
36 | * @return-taint onlysafefor_html |
37 | */ |
38 | protected function getCentralAuthLink( $name ) { |
39 | $title = SpecialPage::getTitleFor( 'CentralAuth', $name ); |
40 | if ( $this->plaintext ) { |
41 | return $title->getPrefixedText(); |
42 | } else { |
43 | return $this->getLinkRenderer()->makeKnownLink( $title, $name ); |
44 | } |
45 | } |
46 | } |