Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 22 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
ChangeTagsRevisionItem | |
0.00% |
0 / 22 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
getTags | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getHTML | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | /** |
3 | * This program is free software; you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation; either version 2 of the License, or |
6 | * (at your option) any later version. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License along |
14 | * with this program; if not, write to the Free Software Foundation, Inc., |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
16 | * http://www.gnu.org/copyleft/gpl.html |
17 | * |
18 | * @file |
19 | * @ingroup Change tagging |
20 | */ |
21 | |
22 | use MediaWiki\Html\Html; |
23 | use MediaWiki\Linker\Linker; |
24 | use MediaWiki\MediaWikiServices; |
25 | |
26 | /** |
27 | * Item class for a live revision table row with its associated change tags. |
28 | * @since 1.25 |
29 | */ |
30 | class ChangeTagsRevisionItem extends RevisionItem { |
31 | /** |
32 | * @return string Comma-separated list of tags |
33 | */ |
34 | public function getTags() { |
35 | return $this->row->ts_tags; |
36 | } |
37 | |
38 | /** |
39 | * @return string A HTML <li> element representing this revision, showing |
40 | * change tags and everything |
41 | */ |
42 | public function getHTML() { |
43 | $difflink = $this->list->msg( 'parentheses' ) |
44 | ->rawParams( $this->getDiffLink() )->escaped(); |
45 | $revlink = $this->getRevisionLink(); |
46 | $userlink = Linker::revUserLink( $this->getRevisionRecord() ); |
47 | $comment = MediaWikiServices::getInstance()->getCommentFormatter() |
48 | ->formatRevision( $this->getRevisionRecord(), $this->list->getAuthority() ); |
49 | if ( $this->isDeleted() ) { |
50 | $class = Linker::getRevisionDeletedClass( $this->getRevisionRecord() ); |
51 | $revlink = "<span class=\"$class\">$revlink</span>"; |
52 | } |
53 | |
54 | $content = "$difflink $revlink $userlink $comment"; |
55 | $attribs = []; |
56 | $tags = $this->getTags(); |
57 | if ( $tags ) { |
58 | [ $tagSummary, $classes ] = ChangeTags::formatSummaryRow( |
59 | $tags, |
60 | 'edittags', |
61 | $this->list->getContext() |
62 | ); |
63 | $content .= " $tagSummary"; |
64 | $attribs['class'] = implode( ' ', $classes ); |
65 | } |
66 | return Html::rawElement( 'li', $attribs, $content ); |
67 | } |
68 | } |