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\SpecialPage\SpecialPage; |
7 | use Message; |
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 | protected function extractParameters() { |
17 | $lang = $this->context->getLanguage(); |
18 | $params = parent::extractParameters(); |
19 | |
20 | $from = []; |
21 | foreach ( explode( '|', $params[3] ) as $name ) { |
22 | $from[] = $this->getCentralAuthLink( $name ); |
23 | } |
24 | |
25 | return [ |
26 | 3 => Message::rawParam( $lang->commaList( $from ) ), |
27 | 4 => Message::rawParam( $this->getCentralAuthLink( $params[4] ) ), |
28 | ]; |
29 | } |
30 | |
31 | /** |
32 | * @param string $name |
33 | * @param-taint $name none |
34 | * @return string wikitext or html |
35 | * @return-taint onlysafefor_html |
36 | */ |
37 | protected function getCentralAuthLink( $name ) { |
38 | $title = SpecialPage::getTitleFor( 'CentralAuth', $name ); |
39 | if ( $this->plaintext ) { |
40 | return $title->getPrefixedText(); |
41 | } else { |
42 | return $this->getLinkRenderer()->makeKnownLink( $title, $name ); |
43 | } |
44 | } |
45 | } |