]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - includes/changetags/ChangeTagsRevisionItem.php
MediaWiki 1.30.2-scripts2
[autoinstalls/mediawiki.git] / includes / changetags / ChangeTagsRevisionItem.php
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 /**
23  * Item class for a live revision table row with its associated change tags.
24  * @since 1.25
25  */
26 class ChangeTagsRevisionItem extends RevisionItem {
27         /**
28          * @return string Comma-separated list of tags
29          */
30         public function getTags() {
31                 return $this->row->ts_tags;
32         }
33
34         /**
35          * @return string A HTML <li> element representing this revision, showing
36          * change tags and everything
37          */
38         public function getHTML() {
39                 $difflink = $this->list->msg( 'parentheses' )
40                         ->rawParams( $this->getDiffLink() )->escaped();
41                 $revlink = $this->getRevisionLink();
42                 $userlink = Linker::revUserLink( $this->revision );
43                 $comment = Linker::revComment( $this->revision );
44                 if ( $this->isDeleted() ) {
45                         $revlink = "<span class=\"history-deleted\">$revlink</span>";
46                 }
47
48                 $content = "$difflink $revlink $userlink $comment";
49                 $attribs = [];
50                 $tags = $this->getTags();
51                 if ( $tags ) {
52                         list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow(
53                                 $tags,
54                                 'edittags',
55                                 $this->list->getContext()
56                         );
57                         $content .= " $tagSummary";
58                         $attribs['class'] = implode( ' ', $classes );
59                 }
60                 return Xml::tags( 'li', $attribs, $content );
61         }
62 }