function doTagRow($tag, $hitcount, $showManageActions, $showDeleteActions, $showEditLinks) { $newRow = ''; $newRow .= Xml::tags('td', null, Xml::element('code', null, $tag)); $disp = ChangeTags::tagDescription($tag); if ($showEditLinks) { $disp .= ' '; $editLink = Linker::link($this->msg("tag-{$tag}")->inContentLanguage()->getTitle(), $this->msg('tags-edit')->escaped()); $disp .= $this->msg('parentheses')->rawParams($editLink)->escaped(); } $newRow .= Xml::tags('td', null, $disp); $msg = $this->msg("tag-{$tag}-description"); $desc = !$msg->exists() ? '' : $msg->parse(); if ($showEditLinks) { $desc .= ' '; $editDescLink = Linker::link($this->msg("tag-{$tag}-description")->inContentLanguage()->getTitle(), $this->msg('tags-edit')->escaped()); $desc .= $this->msg('parentheses')->rawParams($editDescLink)->escaped(); } $newRow .= Xml::tags('td', null, $desc); $sourceMsgs = []; $isExtension = isset($this->extensionDefinedTags[$tag]); $isExplicit = isset($this->explicitlyDefinedTags[$tag]); if ($isExtension) { $sourceMsgs[] = $this->msg('tags-source-extension')->escaped(); } if ($isExplicit) { $sourceMsgs[] = $this->msg('tags-source-manual')->escaped(); } if (!$sourceMsgs) { $sourceMsgs[] = $this->msg('tags-source-none')->escaped(); } $newRow .= Xml::tags('td', null, implode(Xml::element('br'), $sourceMsgs)); $isActive = $isExplicit || isset($this->extensionActivatedTags[$tag]); $activeMsg = $isActive ? 'tags-active-yes' : 'tags-active-no'; $newRow .= Xml::tags('td', null, $this->msg($activeMsg)->escaped()); $hitcountLabel = $this->msg('tags-hitcount')->numParams($hitcount)->escaped(); if ($this->getConfig()->get('UseTagFilter')) { $hitcountLabel = Linker::link(SpecialPage::getTitleFor('Recentchanges'), $hitcountLabel, [], ['tagfilter' => $tag]); } // add raw $hitcount for sorting, because tags-hitcount contains numbers and letters $newRow .= Xml::tags('td', ['data-sort-value' => $hitcount], $hitcountLabel); // actions $actionLinks = []; // delete if ($showDeleteActions && ChangeTags::canDeleteTag($tag)->isOK()) { $actionLinks[] = Linker::linkKnown($this->getPageTitle('delete'), $this->msg('tags-delete')->escaped(), [], ['tag' => $tag]); } if ($showManageActions) { // we've already checked that the user had the requisite userright // activate if (ChangeTags::canActivateTag($tag)->isOK()) { $actionLinks[] = Linker::linkKnown($this->getPageTitle('activate'), $this->msg('tags-activate')->escaped(), [], ['tag' => $tag]); } // deactivate if (ChangeTags::canDeactivateTag($tag)->isOK()) { $actionLinks[] = Linker::linkKnown($this->getPageTitle('deactivate'), $this->msg('tags-deactivate')->escaped(), [], ['tag' => $tag]); } } if ($actionLinks) { $newRow .= Xml::tags('td', null, $this->getLanguage()->pipeList($actionLinks)); } return Xml::tags('tr', null, $newRow) . "\n"; }
function doTagRow($tag, $hitcount, $showActions) { $user = $this->getUser(); $newRow = ''; $newRow .= Xml::tags('td', null, Xml::element('code', null, $tag)); $disp = ChangeTags::tagDescription($tag); if ($user->isAllowed('editinterface')) { $disp .= ' '; $editLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), $this->msg('tags-edit')->escaped()); $disp .= $this->msg('parentheses')->rawParams($editLink)->escaped(); } $newRow .= Xml::tags('td', null, $disp); $msg = $this->msg("tag-{$tag}-description"); $desc = !$msg->exists() ? '' : $msg->parse(); if ($user->isAllowed('editinterface')) { $desc .= ' '; $editDescLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), $this->msg('tags-edit')->escaped()); $desc .= $this->msg('parentheses')->rawParams($editDescLink)->escaped(); } $newRow .= Xml::tags('td', null, $desc); $sourceMsgs = array(); $isExtension = isset($this->extensionDefinedTags[$tag]); $isExplicit = isset($this->explicitlyDefinedTags[$tag]); if ($isExtension) { $sourceMsgs[] = $this->msg('tags-source-extension')->escaped(); } if ($isExplicit) { $sourceMsgs[] = $this->msg('tags-source-manual')->escaped(); } if (!$sourceMsgs) { $sourceMsgs[] = $this->msg('tags-source-none')->escaped(); } $newRow .= Xml::tags('td', null, implode(Xml::element('br'), $sourceMsgs)); $isActive = $isExplicit || isset($this->extensionActivatedTags[$tag]); $activeMsg = $isActive ? 'tags-active-yes' : 'tags-active-no'; $newRow .= Xml::tags('td', null, $this->msg($activeMsg)->escaped()); $hitcountLabel = $this->msg('tags-hitcount')->numParams($hitcount)->escaped(); $hitcountLink = Linker::link(SpecialPage::getTitleFor('Recentchanges'), $hitcountLabel, array(), array('tagfilter' => $tag)); // add raw $hitcount for sorting, because tags-hitcount contains numbers and letters $newRow .= Xml::tags('td', array('data-sort-value' => $hitcount), $hitcountLink); // actions $actionLinks = array(); if ($showActions) { // delete if (ChangeTags::canDeleteTag($tag, $user)->isOK()) { $actionLinks[] = Linker::linkKnown($this->getPageTitle('delete'), $this->msg('tags-delete')->escaped(), array(), array('tag' => $tag)); } // activate if (ChangeTags::canActivateTag($tag, $user)->isOK()) { $actionLinks[] = Linker::linkKnown($this->getPageTitle('activate'), $this->msg('tags-activate')->escaped(), array(), array('tag' => $tag)); } // deactivate if (ChangeTags::canDeactivateTag($tag, $user)->isOK()) { $actionLinks[] = Linker::linkKnown($this->getPageTitle('deactivate'), $this->msg('tags-deactivate')->escaped(), array(), array('tag' => $tag)); } $newRow .= Xml::tags('td', null, $this->getLanguage()->pipeList($actionLinks)); } return Xml::tags('tr', null, $newRow) . "\n"; }