/** * @param $changeslist ChangesList * @param $s string * @param $rc RecentChange * @return bool */ static function customizeOldChangesList(&$changeslist, &$s, $rc, &$classes) { if ($rc->getTitle()->getNamespace() != NS_LQT_THREAD) { return true; } $thread = Threads::withRoot(new Article($rc->getTitle(), 0)); if (!$thread) { return true; } global $wgLang, $wgOut; $wgOut->addModules('ext.liquidThreads'); // Custom display for new posts. if ($rc->mAttribs['rc_new']) { // Article link, timestamp, user $s = ''; $s .= Linker::link($thread->getTitle()); $changeslist->insertTimestamp($s, $rc); $changeslist->insertUserRelatedLinks($s, $rc); // Action text $msg = $thread->isTopmostThread() ? 'lqt_rc_new_discussion' : 'lqt_rc_new_reply'; $link = LqtView::linkInContext($thread); $s .= ' ' . wfMessage($msg)->rawParams($link)->parse(); $s .= $wgLang->getDirMark(); // add the truncated post content $quote = $thread->root()->getContent(); $quote = $wgLang->truncate($quote, 200); $s .= ' ' . Linker::commentBlock($quote); $classes = array(); $changeslist->insertTags($s, $rc, $classes); $changeslist->insertExtra($s, $rc, $classes); } return true; }
function formatRow($row) { $comment = Linker::commentBlock($row->cw_comment); $user = Linker::userLink($row->cw_user, $row->user_name) . Linker::userToolLinks($row->cw_user, $row->user_name); $sitename = $row->cw_sitename; $status = $row->cw_status; $idlink = Linker::link(Title::newFromText('Special:RequestWikiQueue/' . $row->cw_id), "#{$row->cw_id}"); return '<li>' . $this->getLanguage()->timeanddate(wfTimestamp(TS_MW, $row->cw_timestamp), true) . ' ' . $this->msg('requestwikiqueue-logpagerentry', $user, htmlspecialchars($sitename), $idlink, $this->msg('requestwikiqueue-pager-status-' . $status))->text() . $comment . '</li>'; }
public function getComment() { $legacy = $this->entry->getParameters(); if (isset($legacy['reason'])) { $comment = Linker::commentBlock($legacy['reason']); // No hard coded spaces thanx return ltrim($comment); } return parent::getComment(); }
function formatRow($row) { if ($row->cul_reason === '') { $comment = ''; } else { $comment = Linker::commentBlock($row->cul_reason); } $user = Linker::userLink($row->cul_user, $row->user_name); if ($row->cul_type == 'userips' || $row->cul_type == 'useredits') { $target = Linker::userLink($row->cul_target_id, $row->cul_target_text) . Linker::userToolLinks($row->cul_target_id, $row->cul_target_text); } else { $target = $row->cul_target_text; } // Give grep a chance to find the usages: // checkuser-log-userips, checkuser-log-ipedits, checkuser-log-ipusers, // checkuser-log-ipedits-xff, checkuser-log-ipusers-xff, checkuser-log-useredits return '<li>' . $this->getLanguage()->timeanddate(wfTimestamp(TS_MW, $row->cul_timestamp), true) . $this->msg('comma-separator')->text() . $this->msg('checkuser-log-' . $row->cul_type, $user, $target)->text() . $comment . '</li>'; }
public function getHTML() { $date = htmlspecialchars($this->list->getLanguage()->userTimeAndDate($this->row->log_timestamp, $this->list->getUser())); $title = Title::makeTitle($this->row->log_namespace, $this->row->log_title); $formatter = LogFormatter::newFromRow($this->row); $formatter->setContext($this->list->getContext()); $formatter->setAudience(LogFormatter::FOR_THIS_USER); // Log link for this page $loglink = Linker::link(SpecialPage::getTitleFor('Log'), $this->list->msg('log')->escaped(), array(), array('page' => $title->getPrefixedText())); $loglink = $this->list->msg('parentheses')->rawParams($loglink)->escaped(); // User links and action text $action = $formatter->getActionText(); // Comment $comment = $this->list->getLanguage()->getDirMark() . Linker::commentBlock($this->row->log_comment); if (LogEventsList::isDeleted($this->row, LogPage::DELETED_COMMENT)) { $comment = '<span class="history-deleted">' . $comment . '</span>'; } return "<li>{$loglink} {$date} {$action} {$comment}</li>"; }
function formatValue($name, $value) { global $wgLang, $wgTitle; $row = $this->mCurrentRow; switch ($name) { case 'th_timestamp': $formatted = $wgLang->timeanddate($value, true); return Linker::link($wgTitle, $formatted, array(), array('lqt_oldid' => $row->th_id)); case 'th_user_text': return Linker::userLink($row->th_user, $row->th_user_text) . ' ' . Linker::userToolLinks($row->th_user, $row->th_user_text); case 'th_change_type': return $this->getActionDescription($value); case 'th_change_comment': return Linker::commentBlock($value); default: return "Unable to format {$name}"; break; } }
/** * Wrap and format the file's comment block, if the current * user is allowed to view it. * * @return string HTML */ protected function getComment() { if ($this->file->userCan(File::DELETED_COMMENT, $this->list->getUser())) { $block = Linker::commentBlock($this->file->getDescription()); } else { $block = ' ' . $this->list->msg('rev-deleted-comment')->escaped(); } if ($this->file->isDeleted(File::DELETED_COMMENT)) { return "<span class=\"history-deleted\">{$block}</span>"; } return $block; }
function formatValue($name, $value) { static $msg = null; if ($msg === null) { $msg = array('anononlyblock', 'createaccountblock', 'noautoblockblock', 'emailblock', 'blocklist-nousertalk', 'unblocklink', 'change-blocklink', 'infiniteblock'); $msg = array_combine($msg, array_map(array($this, 'msg'), $msg)); } /** @var $row object */ $row = $this->mCurrentRow; $formatted = ''; switch ($name) { case 'ipb_timestamp': $formatted = $this->getLanguage()->userTimeAndDate($value, $this->getUser()); break; case 'ipb_target': if ($row->ipb_auto) { $formatted = $this->msg('autoblockid', $row->ipb_id)->parse(); } else { list($target, $type) = Block::parseTarget($row->ipb_address); switch ($type) { case Block::TYPE_USER: case Block::TYPE_IP: $formatted = Linker::userLink($target->getId(), $target); $formatted .= Linker::userToolLinks($target->getId(), $target, false, Linker::TOOL_LINKS_NOBLOCK); break; case Block::TYPE_RANGE: $formatted = htmlspecialchars($target); } } break; case 'ipb_expiry': $formatted = $this->getLanguage()->formatExpiry($value, true); if ($this->getUser()->isAllowed('block')) { if ($row->ipb_auto) { $links[] = Linker::linkKnown(SpecialPage::getTitleFor('Unblock'), $msg['unblocklink'], array(), array('wpTarget' => "#{$row->ipb_id}")); } else { $links[] = Linker::linkKnown(SpecialPage::getTitleFor('Unblock', $row->ipb_address), $msg['unblocklink']); $links[] = Linker::linkKnown(SpecialPage::getTitleFor('Block', $row->ipb_address), $msg['change-blocklink']); } $formatted .= ' ' . Html::rawElement('span', array('class' => 'mw-blocklist-actions'), $this->msg('parentheses')->rawParams($this->getLanguage()->pipeList($links))->escaped()); } break; case 'ipb_by': if (isset($row->by_user_name)) { $formatted = Linker::userLink($value, $row->by_user_name); $formatted .= Linker::userToolLinks($value, $row->by_user_name); } else { $formatted = htmlspecialchars($row->ipb_by_text); // foreign user? } break; case 'ipb_reason': $formatted = Linker::commentBlock($value); break; case 'ipb_params': $properties = array(); if ($row->ipb_anon_only) { $properties[] = $msg['anononlyblock']; } if ($row->ipb_create_account) { $properties[] = $msg['createaccountblock']; } if ($row->ipb_user && !$row->ipb_enable_autoblock) { $properties[] = $msg['noautoblockblock']; } if ($row->ipb_block_email) { $properties[] = $msg['emailblock']; } if (!$row->ipb_allow_usertalk) { $properties[] = $msg['blocklist-nousertalk']; } $formatted = $this->getLanguage()->commaList($properties); break; default: $formatted = "Unable to format {$name}"; break; } return $formatted; }
public static function contributionsLineEndingProcess(ContribsPager &$contribsPager, &$ret, $row) { wfProfileIn(__METHOD__); $rev = new Revision($row); $page = $rev->getTitle(); $page->resetArticleId($row->rev_page); $wfMsgOptsBase = self::getMessageOptions(null, $row); $isThread = $wfMsgOptsBase['isThread']; $isNew = $wfMsgOptsBase['isNew']; // Don't show useless link to people who cannot hide revisions $del = Linker::getRevDeleteLink($contribsPager->getUser(), $rev, $page); if ($del !== '') { $del .= ' '; } else { $del = ''; } // VOLDEV-40: remove html messages $ret = $del; $ret .= Linker::linkKnown($page, $contribsPager->getLanguage()->userTimeAndDate($row->rev_timestamp, $contribsPager->getUser()), [], ['oldid' => $row->rev_id]) . ' ('; if ($isNew) { $ret .= $contribsPager->msg('diff')->escaped(); } else { $ret .= Linker::linkKnown($page, $contribsPager->msg('diff')->escaped(), [], ['diff' => 'prev', 'oldid' => $row->rev_id]); } $wallMessage = new WallMessage($page); $threadId = $wallMessage->getMessagePageId(); $threadTitle = Title::newFromText($threadId, NS_USER_WALL_MESSAGE); $ret .= ' | ' . Linker::linkKnown($threadTitle, $contribsPager->msg('hist')->escaped(), [], ['action' => 'history']) . ') '; if ($isThread && $isNew) { $ret .= ChangesList::flag('newpage') . ' '; } if (MWNamespace::getSubject($row->page_namespace) === NS_WIKIA_FORUM_BOARD && empty($wfMsgOptsBase['articleTitleVal'])) { $wfMsgOptsBase['articleTitleTxt'] = $contribsPager->msg('forum-recentchanges-deleted-reply-title')->text(); } $prefix = MWNamespace::getSubject($row->page_namespace) === NS_WIKIA_FORUM_BOARD ? 'forum' : 'wall'; $ret .= $contribsPager->msg($prefix . '-contributions-line')->params($wfMsgOptsBase['articleTitle'])->rawParams(htmlspecialchars($wfMsgOptsBase['articleTitleTxt']))->params($wfMsgOptsBase['wallTitleTxt'], $wfMsgOptsBase['wallPageName'])->parse(); if (!$isNew) { $summary = $rev->getComment(); if (empty($summary)) { $msg = Linker::commentBlock($contribsPager->msg(static::getMessagePrefix($row->page_namespace) . '-edit')->inContentLanguage()->text()); } else { $msg = Linker::revComment($rev, false, true); } $ret .= ' ' . $contribsPager->getLanguage()->getDirMark() . $msg; } wfProfileOut(__METHOD__); return true; }
/** * Build links to old version of the configuration */ protected function buildOldVersionSelect() { global $wgConf; $count = 0; $links = array(); $versions = $wgConf->getArchiveVersions(array('wiki' => $this->mWiki, 'limit' => 11)); $title = $this->getTitle(); $lang = $this->getLang(); $prev = null; ksort($versions); ## Put in ascending order for now. foreach ($versions as $data) { $ts = $data['timestamp']; $count++; $datetime = $this->msg('configure-old-summary-datetime', $lang->timeanddate($ts), $lang->date($ts), $lang->time($ts))->escaped(); $link = Linker::linkKnown($title, $datetime, array(), array('version' => $ts)); $diffLink = ''; if ($prev) { $diffLink = '(' . Linker::linkKnown(SpecialPage::getTitleFor('ViewConfig'), $this->msg('configure-old-changes')->escaped(), array(), array('version' => $ts, 'diff' => $prev)) . ')'; } ## Make user link... $userLink = ''; if (!$data['userwiki'] || !$data['username']) { $userLink = ''; $username = ''; } elseif ($data['userwiki'] == wfWikiId()) { $userLink = Linker::link(Title::makeTitle(NS_USER, $data['username']), htmlspecialchars($data['username'])); $username = $data['username']; } elseif ($wiki = WikiMap::getWiki($data['userwiki'])) { $userLink = Linker::makeExternalLink($wiki->getUrl('User:'******'username']), htmlspecialchars($data['username'] . '@' . $data['userwiki'])); $username = ''; } else { ## Last-ditch $userLink = htmlspecialchars($data['username'] . '@' . $data['userwiki']); $username = ''; } $comment = $data['reason'] ? Linker::commentBlock($data['reason']) : ''; $text = $this->msg('configure-old-summary')->rawParams($link, $userLink, $diffLink, $comment)->params($username)->parse(); $prev = $ts; $links[] = $text; } ## Reset into descending order $links = array_reverse($links); ## Take out the first ten... $links = array_slice($links, 0, 10); $text = Html::element('legend', null, $this->msg('configure-old')->text()); if (!count($links)) { $text .= $this->msg('configure-no-old')->parseAsBlock(); } else { $text .= $this->msg('configure-old-versions')->parseAsBlock(); $text .= "<ul>\n<li>"; $text .= implode("</li>\n<li>", $links); $text .= "</li>\n</ul>\n"; } $link = SpecialPage::getTitleFor('ViewConfig'); $text .= Html::rawElement('p', null, Linker::linkKnown($link, $this->msg('configure-view-all-versions')->escaped())); $text .= Html::rawElement('p', null, Linker::linkKnown($link, $this->msg('configure-view-default')->escaped(), array(), array('version' => 'default'))); return Html::rawElement('fieldset', null, $text); }
/** * Gets the user provided comment * @return string HTML */ public function getComment() { if ($this->canView(LogPage::DELETED_COMMENT)) { $comment = Linker::commentBlock($this->entry->getComment()); // No hard coded spaces thanx $element = ltrim($comment); if ($this->entry->isDeleted(LogPage::DELETED_COMMENT)) { $element = $this->styleRestricedElement($element); } } else { $element = $this->getRestrictedElement('rev-deleted-comment'); } return $element; }
/** * @covers LogFormatter::newFromEntry * @covers LogFormatter::getComment */ public function testLogComment() { $entry = $this->newLogEntry('test', array()); $formatter = LogFormatter::newFromEntry($entry); $formatter->setContext($this->context); $comment = ltrim(Linker::commentBlock($entry->getComment())); $this->assertEquals($comment, $formatter->getComment()); }
/** * @param $isSubjectPreview Boolean: true if this is the section subject/title * up top, or false if this is the comment summary * down below the textarea * @param $summary String: the text of the summary to display * @return String */ protected function getSummaryPreview($isSubjectPreview, $summary = "") { if (!$summary || !$this->preview && !$this->diff) { return ""; } global $wgParser; if ($isSubjectPreview) { $summary = wfMsgForContent('newsectionsummary', $wgParser->stripSectionName($summary)); } $message = $isSubjectPreview ? 'subject-preview' : 'summary-preview'; $summary = wfMsgExt($message, 'parseinline') . Linker::commentBlock($summary, $this->mTitle, $isSubjectPreview); return Xml::tags('div', array('class' => 'mw-summary-preview'), $summary); }
/** * Insert a formatted comment * @param RecentChange $rc * @return string */ public function insertComment($rc) { if ($this->isDeleted($rc, Revision::DELETED_COMMENT)) { return ' <span class="history-deleted">' . $this->msg('rev-deleted-comment')->escaped() . '</span>'; } else { return Linker::commentBlock($rc->mAttribs['rc_comment'], $rc->getTitle()); } }
/** * @param bool $isSubjectPreview True if this is the section subject/title * up top, or false if this is the comment summary * down below the textarea * @param string $summary The text of the summary to display * @return string */ protected function getSummaryPreview($isSubjectPreview, $summary = "") { // avoid spaces in preview, gets always trimmed on save $summary = trim($summary); if (!$summary || !$this->preview && !$this->diff) { return ""; } global $wgParser; if ($isSubjectPreview) { $summary = wfMessage('newsectionsummary')->rawParams($wgParser->stripSectionName($summary))->inContentLanguage()->text(); } $message = $isSubjectPreview ? 'subject-preview' : 'summary-preview'; $summary = wfMessage($message)->parse() . Linker::commentBlock($summary, $this->mTitle, $isSubjectPreview); return Xml::tags('div', array('class' => 'mw-summary-preview'), $summary); }
/** * Insert a formatted comment * @param $rc RecentChange */ public function insertComment($rc) { $comment = ''; if ($rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT) { if ($this->isDeleted($rc, Revision::DELETED_COMMENT)) { $comment = ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span>'; } else { $comment = Linker::commentBlock($rc->mAttribs['rc_comment'], $rc->getTitle()); } } // Start of Wikia change - @author nAndy // modified for MW1.19 by macbre wfRunHooks('ChangesListInsertComment', array($this, $rc, &$comment)); // End of Wikia change return $comment; }
function formatValue($field, $value) { switch ($field) { case 'thumb': $file = wfLocalFile($value); $thumb = $file->transform(array('width' => 180, 'height' => 360)); return $thumb->toHtml(array('desc-link' => true)); case 'img_timestamp': return htmlspecialchars($this->getLanguage()->timeanddate($value, true)); case 'img_name': static $imgfile = null; if ($imgfile === null) { $imgfile = wfMsg('imgfile'); } // Weird files can maybe exist? Bug 22227 $filePage = Title::makeTitleSafe(NS_FILE, $value); if ($filePage) { $link = Linker::linkKnown($filePage, htmlspecialchars($filePage->getText())); $download = Xml::element('a', array('href' => wfLocalFile($filePage)->getURL()), $imgfile); return "{$link} ({$download})"; } else { return htmlspecialchars($value); } case 'img_user_text': if ($this->mCurrentRow->img_user) { $link = Linker::link(Title::makeTitle(NS_USER, $value), htmlspecialchars($value)); } else { $link = htmlspecialchars($value); } return $link; case 'img_size': return htmlspecialchars($this->getLanguage()->formatSize($value)); case 'img_description': return Linker::commentBlock($value); case 'count': return intval($value) + 1; } }
/** @deprecated in 1.21 */ public function commentBlock($comment, $title = null, $local = false, $wikiId = null) { wfDeprecated(__METHOD__, '1.21'); return Linker::commentBlock($comment, $title, $local, $wikiId); }
/** * @param $iscur * @param $file File * @return string */ public function imageHistoryLine($iscur, $file) { global $wgUser, $wgLang, $wgContLang; $timestamp = wfTimestamp(TS_MW, $file->getTimestamp()); $img = $iscur ? $file->getName() : $file->getArchiveName(); $user = $file->getUser('id'); $usertext = $file->getUser('text'); $description = $file->getDescription(); $local = $this->current->isLocal(); $row = $selected = ''; // Deletion link if ($local && $wgUser->isAllowedAny('delete', 'deletedhistory')) { $row .= '<td>'; # Link to remove from history if ($wgUser->isAllowed('delete')) { $q = array('action' => 'delete'); if (!$iscur) { $q['oldimage'] = $img; } $row .= Linker::link($this->title, wfMsgHtml($iscur ? 'filehist-deleteall' : 'filehist-deleteone'), array(), $q, array('known')); } # Link to hide content. Don't show useless link to people who cannot hide revisions. $canHide = $wgUser->isAllowed('deleterevision'); if ($canHide || $wgUser->isAllowed('deletedhistory') && $file->getVisibility()) { if ($wgUser->isAllowed('delete')) { $row .= '<br />'; } // If file is top revision or locked from this user, don't link if ($iscur || !$file->userCan(File::DELETED_RESTRICTED)) { $del = Linker::revDeleteLinkDisabled($canHide); } else { list($ts, $name) = explode('!', $img, 2); $query = array('type' => 'oldimage', 'target' => $this->title->getPrefixedText(), 'ids' => $ts); $del = Linker::revDeleteLink($query, $file->isDeleted(File::DELETED_RESTRICTED), $canHide); } $row .= $del; } $row .= '</td>'; } // Reversion link/current indicator $row .= '<td>'; if ($iscur) { $row .= wfMsgHtml('filehist-current'); } elseif ($local && $wgUser->isLoggedIn() && $this->title->userCan('edit')) { if ($file->isDeleted(File::DELETED_FILE)) { $row .= wfMsgHtml('filehist-revert'); } else { $row .= Linker::link($this->title, wfMsgHtml('filehist-revert'), array(), array('action' => 'revert', 'oldimage' => $img, 'wpEditToken' => $wgUser->editToken($img)), array('known', 'noclasses')); } } $row .= '</td>'; // Date/time and image link if ($file->getTimestamp() === $this->img->getTimestamp()) { $selected = "class='filehistory-selected'"; } $row .= "<td {$selected} style='white-space: nowrap;'>"; if (!$file->userCan(File::DELETED_FILE)) { # Don't link to unviewable files $row .= '<span class="history-deleted">' . $wgLang->timeAndDate($timestamp, true) . '</span>'; } elseif ($file->isDeleted(File::DELETED_FILE)) { if ($local) { $this->preventClickjacking(); $revdel = SpecialPage::getTitleFor('Revisiondelete'); # Make a link to review the image $url = Linker::link($revdel, $wgLang->timeAndDate($timestamp, true), array(), array('target' => $this->title->getPrefixedText(), 'file' => $img, 'token' => $wgUser->editToken($img)), array('known', 'noclasses')); } else { $url = $wgLang->timeAndDate($timestamp, true); } $row .= '<span class="history-deleted">' . $url . '</span>'; } else { $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl($img); $row .= Xml::element('a', array('href' => $url), $wgLang->timeAndDate($timestamp, true)); } $row .= "</td>"; // Thumbnail if ($this->showThumb) { $row .= '<td>' . $this->getThumbForLine($file) . '</td>'; } // Image dimensions + size $row .= '<td>'; $row .= htmlspecialchars($file->getDimensionsString()); $row .= ' <span style="white-space: nowrap;">(' . Linker::formatSize($file->getSize()) . ')</span>'; $row .= '</td>'; // Uploading user $row .= '<td>'; // Hide deleted usernames if ($file->isDeleted(File::DELETED_USER)) { $row .= '<span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>'; } else { if ($local) { $row .= Linker::userLink($user, $usertext) . ' <span style="white-space: nowrap;">' . Linker::userToolLinks($user, $usertext) . '</span>'; } else { $row .= htmlspecialchars($usertext); } } $row .= '</td>'; // Don't show deleted descriptions if ($file->isDeleted(File::DELETED_COMMENT)) { $row .= '<td><span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span></td>'; } else { $row .= '<td dir="' . $wgContLang->getDir() . '">' . Linker::commentBlock($description, $this->title) . '</td>'; } $rowClass = null; wfRunHooks('ImagePageFileHistoryLine', array($this, $file, &$row, &$rowClass)); $classAttr = $rowClass ? " class='{$rowClass}'" : ''; return "<tr{$classAttr}>{$row}</tr>\n"; }
function formatValue($field, $value) { switch ($field) { case 'thumb': $file = wfLocalFile($value); $thumb = $file->transform(array('width' => 180, 'height' => 360)); return $thumb->toHtml(array('desc-link' => true)); case 'img_timestamp': return htmlspecialchars($this->getLanguage()->timeanddate($value, true)); case 'img_name': static $imgfile = null; if ($imgfile === null) { $imgfile = wfMsg('imgfile'); } // Weird files can maybe exist? Bug 22227 $filePage = Title::makeTitleSafe(NS_FILE, $value); if ($filePage) { $link = Linker::linkKnown($filePage, htmlspecialchars($filePage->getText())); $download = Xml::element('a', array('href' => wfLocalFile($filePage)->getURL()), $imgfile); // begin wikia change // @author Cqm // VOLDEV-65 if ($filePage->userCan('delete', $this->getUser())) { // convert message to lower case to match exisiting file link // do it like this so it works for non-english characters, such as accents, etc. $deleteMsg = $this->msg('delete')->escaped(); $deleteMsg = mb_strtolower($deleteMsg, mb_detect_encoding($deleteMsg)); $delete = Linker::linkKnown($filePage, $deleteMsg, array('title' => false), array('action' => 'delete')); return "{$link} ({$download}) ({$delete})"; } // end wikia change return "{$link} ({$download})"; } else { return htmlspecialchars($value); } case 'img_user_text': if ($this->mCurrentRow->img_user) { $link = Linker::link(Title::makeTitle(NS_USER, $value), htmlspecialchars($value)); } else { $link = htmlspecialchars($value); } return $link; case 'img_size': return htmlspecialchars($this->getLanguage()->formatSize($value)); case 'img_description': return Linker::commentBlock($value); case 'count': return intval($value) + 1; } }
/** * Fetch file upload comment if it's available to this user * * @param $file File * @return String: HTML fragment */ function getFileComment($file) { if (!$file->userCan(File::DELETED_COMMENT)) { return '<span class="history-deleted"><span class="comment">' . wfMsgHtml('rev-deleted-comment') . '</span></span>'; } else { $link = Linker::commentBlock($file->getRawDescription()); if ($file->isDeleted(File::DELETED_COMMENT)) { $link = '<span class="history-deleted">' . $link . '</span>'; } return $link; } }
private function logComment($row) { if (self::isDeleted($row, LogPage::DELETED_COMMENT)) { $comment = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span>'; } else { global $wgLang; $comment = $wgLang->getDirMark() . Linker::commentBlock($row->log_comment); } return $comment; }
/** * @param $row * @return string */ function listRow( $row ) { global $wgLang; $self = $this->getTitle(); $userPage = Title::makeTitle( NS_USER, $row->user_name ); $victim = Title::makeTitle( $row->page_namespace, $row->page_title ); return "<li>(" . Linker::makeKnownLinkObj( $self, wfMsgHTML( 'oversight-view' ), 'revision=' . $row->rev_id ) . ") " . "(" . Linker::makeKnownLinkObj( $self, wfMsgHTML( 'diff' ), 'revision=' . $row->rev_id . '&diff=1') . ") " . $wgLang->timeanddate( wfTimestamp( TS_MW, $row->hidden_on_timestamp ) ) . " " . Linker::makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) ) . " " . wfMsgHTML( 'oversight-log-hiderev', Linker::makeLinkObj( $victim ) ) . " " . Linker::commentBlock( $row->hidden_reason ) . "</li>\n"; }
public function commentBlock($comment, $title = null, $local = false, $wikiId = null) { return Linker::commentBlock($comment, $title, $local, $wikiId); }
public function getHTML() { $date = htmlspecialchars($this->list->getLang()->timeanddate($this->row->log_timestamp)); $paramArray = LogPage::extractParams($this->row->log_params); $title = Title::makeTitle($this->row->log_namespace, $this->row->log_title); // Log link for this page $loglink = Linker::link(SpecialPage::getTitleFor('Log'), wfMsgHtml('log'), array(), array('page' => $title->getPrefixedText())); // Action text if (!$this->canView()) { $action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>'; } else { $skin = $this->list->getUser()->getSkin(); $action = LogPage::actionText($this->row->log_type, $this->row->log_action, $title, $skin, $paramArray, true, true); if ($this->row->log_deleted & LogPage::DELETED_ACTION) { $action = '<span class="history-deleted">' . $action . '</span>'; } } // User links $userLink = Linker::userLink($this->row->log_user, User::WhoIs($this->row->log_user)); if (LogEventsList::isDeleted($this->row, LogPage::DELETED_USER)) { $userLink = '<span class="history-deleted">' . $userLink . '</span>'; } // Comment $comment = $this->list->getLang()->getDirMark() . Linker::commentBlock($this->row->log_comment); if (LogEventsList::isDeleted($this->row, LogPage::DELETED_COMMENT)) { $comment = '<span class="history-deleted">' . $comment . '</span>'; } return "<li>({$loglink}) {$date} {$userLink} {$action} {$comment}</li>"; }
/** * Fetch file upload comment if it's available to this user * * @param File|ArchivedFile $file * @return string HTML fragment */ function getFileComment($file) { if (!$file->userCan(File::DELETED_COMMENT, $this->getUser())) { return '<span class="history-deleted"><span class="comment">' . $this->msg('rev-deleted-comment')->escaped() . '</span></span>'; } $link = Linker::commentBlock($file->getRawDescription()); if ($file->isDeleted(File::DELETED_COMMENT)) { $link = '<span class="history-deleted">' . $link . '</span>'; } return $link; }
public function formatVersionRow($arr) { $ts = $arr['timestamp']; $wikis = $arr['wikis']; $c = $arr['count']; $hasSelf = in_array($this->mWiki, $wikis); extract($this->formatConf); $lang = $this->getLang(); $datime = $lang->timeanddate($ts); $date = $lang->date($ts); $time = $lang->time($ts); ## Make user link... $userLink = ''; if (!$arr['user_wiki'] && !$arr['user_name']) { $userLink = ''; # Nothing... $username = ''; } elseif ($arr['user_wiki'] == wfWikiId()) { $userLink = Linker::link(Title::makeTitle(NS_USER, $arr['user_name']), htmlspecialchars($arr['user_name'])); $username = $arr['user_name']; } elseif ($wiki = WikiMap::getWiki($arr['user_wiki'])) { $userLink = Linker::makeExternalLink($wiki->getUrl('User:'******'user_name']), htmlspecialchars($arr['user_name'] . '@' . $arr['user_wiki'])); $username = ''; } else { ## Last-ditch $userLink = htmlspecialchars($arr['user_name'] . '@' . $arr['user_wiki']); $username = ''; } $actions = array(); $view = ''; if ($hasSelf) { $view .= Linker::linkKnown($self, $this->msg('configure-view')->escaped(), array(), array('version' => $ts)); } elseif ($allowedAll) { $view .= $this->msg('configure-view')->escaped(); } if ($allowedAll) { $viewWikis = array(); foreach ($wikis as $wiki) { $viewWikis[] = Linker::linkKnown($self, htmlspecialchars($wiki), array(), array('version' => $ts, 'wiki' => $wiki)); } $view .= ' (' . $lang->commaList($viewWikis) . ')'; } if ($view) { $actions[] = $view; } $editDone = false; if ($allowedConfig) { if ($hasSelf) { $editCore = $editMsg . Linker::linkKnown($configTitle, $this->msg('configure-edit-core')->escaped(), array(), array('version' => $ts)); } elseif ($allowedConfigAll) { $editCore = $editMsg . $this->msg('configure-edit-core')->escaped(); } else { $editCore = $editMsg; } if ($allowedConfigAll) { $viewWikis = array(); foreach ($wikis as $wiki) { $viewWikis[] = Linker::linkKnown($configTitle, htmlspecialchars($wiki), array(), array('version' => $ts, 'wiki' => $wiki)); } $editCore .= ' (' . $lang->commaList($viewWikis) . ')'; } $actions[] = $editCore; } if ($allowedExtensions) { $editExt = ''; if (!$allowedConfig) { $editExt .= $editMsg; } if ($hasSelf) { $editExt .= Linker::linkKnown($extTitle, $this->msg('configure-edit-ext')->escaped(), array(), array('version' => $ts)); } elseif ($allowedExtensionsAll) { $editExt .= $this->msg('configure-edit-ext')->escaped(); } if ($allowedExtensionsAll) { $viewWikis = array(); foreach ($wikis as $wiki) { $viewWikis[] = Linker::linkKnown($extTitle, htmlspecialchars($wiki), array(), array('version' => $ts, 'wiki' => $wiki)); } $editExt .= ' (' . $lang->commaList($viewWikis) . ')'; } $actions[] = $editExt; } if ($showDiff) { $diffCheck = $c == 2 ? array('checked' => 'checked') : array(); $versionCheck = $c == 1 ? array('checked' => 'checked') : array(); $buttons = Xml::element('input', array_merge(array('type' => 'radio', 'name' => 'diff', 'value' => $ts), $diffCheck)) . Xml::element('input', array_merge(array('type' => 'radio', 'name' => 'version', 'value' => $ts), $versionCheck)); $actions[] = Linker::link($this->getTitle(), $this->msg('configure-viewconfig-default-diff')->escaped(), array(), array('version' => $ts, 'diff' => 'default')); } else { $buttons = ''; } $comment = $arr['reason'] ? Linker::commentBlock($arr['reason']) : ''; $action = $lang->commaList($actions); $msg = $this->msg('configure-viewconfig-line')->rawParams($buttons)->params($datime)->rawParams($userLink, $action, $comment)->params($date, $time, $username)->parse(); return Xml::tags('li', null, $msg) . "\n"; }
/** * Insert a formatted comment * @param $rc RecentChange */ public function insertComment($rc) { if ($rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT) { if ($this->isDeleted($rc, Revision::DELETED_COMMENT)) { return ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span>'; } else { return Linker::commentBlock($rc->mAttribs['rc_comment'], $rc->getTitle()); } } }
/** * @param Row $row * @param string $reason * @return a streamlined recent changes line with IP data */ protected function CUChangesLine($row, $reason) { static $cuTitle, $flagCache; $cuTitle = SpecialPage::getTitleFor('CheckUser'); # Add date headers as needed $date = $this->getLanguage()->date(wfTimestamp(TS_MW, $row->cuc_timestamp), true, true); if (!isset($this->lastdate)) { $this->lastdate = $date; $line = "\n<h4>{$date}</h4>\n<ul class=\"special\">"; } elseif ($date != $this->lastdate) { $line = "</ul>\n<h4>{$date}</h4>\n<ul class=\"special\">"; $this->lastdate = $date; } else { $line = ''; } $line .= '<li>'; # Create diff/hist/page links $line .= $this->getLinksFromRow($row); # Show date $line .= ' . . ' . $this->getLanguage()->time(wfTimestamp(TS_MW, $row->cuc_timestamp), true, true) . ' . . '; # Userlinks $line .= Linker::userLink($row->cuc_user, $row->cuc_user_text); $line .= Linker::userToolLinks($row->cuc_user, $row->cuc_user_text); # Get block info if (isset($flagCache[$row->cuc_user_text])) { $flags = $flagCache[$row->cuc_user_text]; } else { $user = User::newFromName($row->cuc_user_text, false); $ip = IP::isIPAddress($row->cuc_user_text) ? $row->cuc_user_text : ''; $flags = $this->userBlockFlags($ip, $row->cuc_user, $user); $flagCache[$row->cuc_user_text] = $flags; } # Add any block information if (count($flags)) { $line .= ' ' . implode(' ', $flags); } # Action text, hackish ... if ($row->cuc_actiontext) { $line .= ' ' . Linker::formatComment($row->cuc_actiontext) . ' '; } # Comment $line .= Linker::commentBlock($row->cuc_comment); $line .= '<br />        <small>'; # IP $line .= ' <strong>IP</strong>: ' . Linker::linkKnown($cuTitle, htmlspecialchars($row->cuc_ip), array(), array('user' => $row->cuc_ip, 'reason' => $reason)); # XFF if ($row->cuc_xff != null) { # Flag our trusted proxies list($client, $trusted) = CheckUserHooks::getClientIPfromXFF($row->cuc_xff, $row->cuc_ip); $c = $trusted ? '#F0FFF0' : '#FFFFCC'; $line .= '   <span class="mw-checkuser-xff" style="background-color: ' . $c . '">' . '<strong>XFF</strong>: '; $line .= Linker::linkKnown($cuTitle, htmlspecialchars($row->cuc_xff), array(), array('user' => $client . '/xff', 'reason' => $reason)) . '</span>'; } # User agent $line .= '   <span class="mw-checkuser-agent" style="color:#888;">' . htmlspecialchars($row->cuc_agent) . '</span>'; $line .= "</small></li>\n"; return $line; }