本文整理汇总了PHP中Linker::getRevDeleteLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Linker::getRevDeleteLink方法的具体用法?PHP Linker::getRevDeleteLink怎么用?PHP Linker::getRevDeleteLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Linker
的用法示例。
在下文中一共展示了Linker::getRevDeleteLink方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: revisionDeleteLink
/**
* @param Revision $rev
*
* @return string
*/
protected function revisionDeleteLink($rev)
{
$link = Linker::getRevDeleteLink($this->getUser(), $rev, $rev->getTitle());
if ($link !== '') {
$link = '   ' . $link . ' ';
}
return $link;
}
示例2: setOldSubtitle
/**
* Generate the navigation links when browsing through an article revisions
* It shows the information as:
* Revision as of \<date\>; view current revision
* \<- Previous version | Next Version -\>
*
* @param int $oldid Revision ID of this article revision
*/
public function setOldSubtitle($oldid = 0)
{
if (!Hooks::run('DisplayOldSubtitle', array(&$this, &$oldid))) {
return;
}
$context = $this->getContext();
$unhide = $context->getRequest()->getInt('unhide') == 1;
# Cascade unhide param in links for easy deletion browsing
$extraParams = array();
if ($unhide) {
$extraParams['unhide'] = 1;
}
if ($this->mRevision && $this->mRevision->getId() === $oldid) {
$revision = $this->mRevision;
} else {
$revision = Revision::newFromId($oldid);
}
$timestamp = $revision->getTimestamp();
$current = $oldid == $this->mPage->getLatest();
$language = $context->getLanguage();
$user = $context->getUser();
$td = $language->userTimeAndDate($timestamp, $user);
$tddate = $language->userDate($timestamp, $user);
$tdtime = $language->userTime($timestamp, $user);
# Show user links if allowed to see them. If hidden, then show them only if requested...
$userlinks = Linker::revUserTools($revision, !$unhide);
$infomsg = $current && !$context->msg('revision-info-current')->isDisabled() ? 'revision-info-current' : 'revision-info';
$outputPage = $context->getOutput();
$outputPage->addSubtitle("<div id=\"mw-{$infomsg}\">" . $context->msg($infomsg, $td)->rawParams($userlinks)->params($revision->getID(), $tddate, $tdtime, $revision->getUserText())->rawParams(Linker::revComment($revision, true, true))->parse() . "</div>");
$lnk = $current ? $context->msg('currentrevisionlink')->escaped() : Linker::linkKnown($this->getTitle(), $context->msg('currentrevisionlink')->escaped(), array(), $extraParams);
$curdiff = $current ? $context->msg('diff')->escaped() : Linker::linkKnown($this->getTitle(), $context->msg('diff')->escaped(), array(), array('diff' => 'cur', 'oldid' => $oldid) + $extraParams);
$prev = $this->getTitle()->getPreviousRevisionID($oldid);
$prevlink = $prev ? Linker::linkKnown($this->getTitle(), $context->msg('previousrevision')->escaped(), array(), array('direction' => 'prev', 'oldid' => $oldid) + $extraParams) : $context->msg('previousrevision')->escaped();
$prevdiff = $prev ? Linker::linkKnown($this->getTitle(), $context->msg('diff')->escaped(), array(), array('diff' => 'prev', 'oldid' => $oldid) + $extraParams) : $context->msg('diff')->escaped();
$nextlink = $current ? $context->msg('nextrevision')->escaped() : Linker::linkKnown($this->getTitle(), $context->msg('nextrevision')->escaped(), array(), array('direction' => 'next', 'oldid' => $oldid) + $extraParams);
$nextdiff = $current ? $context->msg('diff')->escaped() : Linker::linkKnown($this->getTitle(), $context->msg('diff')->escaped(), array(), array('diff' => 'next', 'oldid' => $oldid) + $extraParams);
$cdel = Linker::getRevDeleteLink($user, $revision, $this->getTitle());
if ($cdel !== '') {
$cdel .= ' ';
}
$outputPage->addSubtitle("<div id=\"mw-revision-nav\">" . $cdel . $context->msg('revision-nav')->rawParams($prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff)->escaped() . "</div>");
}
示例3: formatRevisionRow
protected function formatRevisionRow($row, $earliestLiveTime, $remaining)
{
$rev = Revision::newFromArchiveRow($row, array('title' => $this->mTargetObj));
$revTextSize = '';
$ts = wfTimestamp(TS_MW, $row->ar_timestamp);
// Build checkboxen...
if ($this->mAllowed) {
if ($this->mInvert) {
if (in_array($ts, $this->mTargetTimestamp)) {
$checkBox = Xml::check("ts{$ts}");
} else {
$checkBox = Xml::check("ts{$ts}", true);
}
} else {
$checkBox = Xml::check("ts{$ts}");
}
} else {
$checkBox = '';
}
// Build page & diff links...
$user = $this->getUser();
if ($this->mCanView) {
$titleObj = $this->getPageTitle();
# Last link
if (!$rev->userCan(Revision::DELETED_TEXT, $this->getUser())) {
$pageLink = htmlspecialchars($this->getLanguage()->userTimeAndDate($ts, $user));
$last = $this->msg('diff')->escaped();
} elseif ($remaining > 0 || $earliestLiveTime && $ts > $earliestLiveTime) {
$pageLink = $this->getPageLink($rev, $titleObj, $ts);
$last = Linker::linkKnown($titleObj, $this->msg('diff')->escaped(), array(), array('target' => $this->mTargetObj->getPrefixedText(), 'timestamp' => $ts, 'diff' => 'prev'));
} else {
$pageLink = $this->getPageLink($rev, $titleObj, $ts);
$last = $this->msg('diff')->escaped();
}
} else {
$pageLink = htmlspecialchars($this->getLanguage()->userTimeAndDate($ts, $user));
$last = $this->msg('diff')->escaped();
}
// User links
$userLink = Linker::revUserTools($rev);
// Minor edit
$minor = $rev->isMinor() ? ChangesList::flag('minor') : '';
// Revision text size
$size = $row->ar_len;
if (!is_null($size)) {
$revTextSize = Linker::formatRevisionSize($size);
}
// Edit summary
$comment = Linker::revComment($rev);
// Tags
$attribs = array();
list($tagSummary, $classes) = ChangeTags::formatSummaryRow($row->ts_tags, 'deletedhistory');
if ($classes) {
$attribs['class'] = implode(' ', $classes);
}
// Revision delete links
$revdlink = Linker::getRevDeleteLink($user, $rev, $this->mTargetObj);
$revisionRow = $this->msg('undelete-revision-row')->rawParams($checkBox, $revdlink, $last, $pageLink, $userLink, $minor, $revTextSize, $comment, $tagSummary)->escaped();
return Xml::tags('li', $attribs, $revisionRow) . "\n";
}
示例4: getRevDeleteLink
public function getRevDeleteLink(User $user, Revision $rev, Title $title)
{
return Linker::getRevDeleteLink($user, $rev, $title);
}
示例5: formatRow
/**
* Generates each row in the contributions list.
*
* Contributions which are marked "top" are currently on top of the history.
* For these contributions, a [rollback] link is shown for users with roll-
* back privileges. The rollback link restores the most recent version that
* was not written by the target user.
*
* @todo This would probably look a lot nicer in a table.
* @param $row
* @return string
*/
function formatRow($row)
{
wfProfileIn(__METHOD__);
$ret = '';
$classes = array();
/*
* There may be more than just revision rows. To make sure that we'll only be processing
* revisions here, let's _try_ to build a revision out of our row (without displaying
* notices though) and then trying to grab data from the built object. If we succeed,
* we're definitely dealing with revision data and we may proceed, if not, we'll leave it
* to extensions to subscribe to the hook to parse the row.
*/
wfSuppressWarnings();
$rev = new Revision($row);
$validRevision = $rev->getParentId() !== null;
wfRestoreWarnings();
if ($validRevision) {
$classes = array();
$page = Title::newFromRow($row);
$link = Linker::link($page, htmlspecialchars($page->getPrefixedText()), array('class' => 'mw-contributions-title'), $page->isRedirect() ? array('redirect' => 'no') : array());
# Mark current revisions
$topmarktext = '';
$user = $this->getUser();
if ($row->rev_id == $row->page_latest) {
$topmarktext .= '<span class="mw-uctop">' . $this->messages['uctop'] . '</span>';
# Add rollback link
if (!$row->page_is_new && $page->quickUserCan('rollback', $user) && $page->quickUserCan('edit', $user)) {
$this->preventClickjacking();
$topmarktext .= ' ' . Linker::generateRollback($rev, $this->getContext());
}
}
# Is there a visible previous revision?
if ($rev->userCan(Revision::DELETED_TEXT, $user) && $rev->getParentId() !== 0) {
$difftext = Linker::linkKnown($page, $this->messages['diff'], array(), array('diff' => 'prev', 'oldid' => $row->rev_id));
} else {
$difftext = $this->messages['diff'];
}
$histlink = Linker::linkKnown($page, $this->messages['hist'], array(), array('action' => 'history'));
if ($row->rev_parent_id === null) {
// For some reason rev_parent_id isn't populated for this row.
// Its rumoured this is true on wikipedia for some revisions (bug 34922).
// Next best thing is to have the total number of bytes.
$chardiff = ' <span class="mw-changeslist-separator">. .</span> ' . Linker::formatRevisionSize($row->rev_len) . ' <span class="mw-changeslist-separator">. .</span> ';
} else {
$parentLen = isset($this->mParentLens[$row->rev_parent_id]) ? $this->mParentLens[$row->rev_parent_id] : 0;
$chardiff = ' <span class="mw-changeslist-separator">. .</span> ' . ChangesList::showCharacterDifference($parentLen, $row->rev_len, $this->getContext()) . ' <span class="mw-changeslist-separator">. .</span> ';
}
$lang = $this->getLanguage();
$comment = $lang->getDirMark() . Linker::revComment($rev, false, true);
$date = $lang->userTimeAndDate($row->rev_timestamp, $user);
if ($rev->userCan(Revision::DELETED_TEXT, $user)) {
$d = Linker::linkKnown($page, htmlspecialchars($date), array('class' => 'mw-changeslist-date'), array('oldid' => intval($row->rev_id)));
} else {
$d = htmlspecialchars($date);
}
if ($rev->isDeleted(Revision::DELETED_TEXT)) {
$d = '<span class="history-deleted">' . $d . '</span>';
}
# Show user names for /newbies as there may be different users.
# Note that we already excluded rows with hidden user names.
if ($this->contribs == 'newbie') {
$userlink = ' . . ' . Linker::userLink($rev->getUser(), $rev->getUserText());
$userlink .= ' ' . $this->msg('parentheses')->rawParams(Linker::userTalkLink($rev->getUser(), $rev->getUserText()))->escaped() . ' ';
} else {
$userlink = '';
}
if ($rev->getParentId() === 0) {
$nflag = ChangesList::flag('newpage');
} else {
$nflag = '';
}
if ($rev->isMinor()) {
$mflag = ChangesList::flag('minor');
} else {
$mflag = '';
}
$del = Linker::getRevDeleteLink($user, $rev, $page);
if ($del !== '') {
$del .= ' ';
}
$diffHistLinks = $this->msg('parentheses')->rawParams($difftext . $this->messages['pipe-separator'] . $histlink)->escaped();
$ret = "{$del}{$d} {$diffHistLinks}{$chardiff}{$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
# Denote if username is redacted for this edit
if ($rev->isDeleted(Revision::DELETED_USER)) {
$ret .= " <strong>" . $this->msg('rev-deleted-user-contribs')->escaped() . "</strong>";
}
# Tags, if any.
list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow($row->ts_tags, 'contributions');
//.........这里部分代码省略.........
示例6: formatRow
/**
* Generates each row in the contributions list.
*
* Contributions which are marked "top" are currently on top of the history.
* For these contributions, a [rollback] link is shown for users with roll-
* back privileges. The rollback link restores the most recent version that
* was not written by the target user.
*
* @todo This would probably look a lot nicer in a table.
* @param object $row
* @return string
*/
function formatRow($row)
{
$ret = '';
$classes = [];
/*
* There may be more than just revision rows. To make sure that we'll only be processing
* revisions here, let's _try_ to build a revision out of our row (without displaying
* notices though) and then trying to grab data from the built object. If we succeed,
* we're definitely dealing with revision data and we may proceed, if not, we'll leave it
* to extensions to subscribe to the hook to parse the row.
*/
MediaWiki\suppressWarnings();
try {
$rev = new Revision($row);
$validRevision = (bool) $rev->getId();
} catch (Exception $e) {
$validRevision = false;
}
MediaWiki\restoreWarnings();
if ($validRevision) {
$classes = [];
$page = Title::newFromRow($row);
$link = Linker::link($page, htmlspecialchars($page->getPrefixedText()), ['class' => 'mw-contributions-title'], $page->isRedirect() ? ['redirect' => 'no'] : []);
# Mark current revisions
$topmarktext = '';
$user = $this->getUser();
if ($row->rev_id === $row->page_latest) {
$topmarktext .= '<span class="mw-uctop">' . $this->messages['uctop'] . '</span>';
$classes[] = 'mw-contributions-current';
# Add rollback link
if (!$row->page_is_new && $page->quickUserCan('rollback', $user) && $page->quickUserCan('edit', $user)) {
$this->preventClickjacking();
$topmarktext .= ' ' . Linker::generateRollback($rev, $this->getContext());
}
}
# Is there a visible previous revision?
if ($rev->userCan(Revision::DELETED_TEXT, $user) && $rev->getParentId() !== 0) {
$difftext = Linker::linkKnown($page, $this->messages['diff'], [], ['diff' => 'prev', 'oldid' => $row->rev_id]);
} else {
$difftext = $this->messages['diff'];
}
$histlink = Linker::linkKnown($page, $this->messages['hist'], [], ['action' => 'history']);
if ($row->rev_parent_id === null) {
// For some reason rev_parent_id isn't populated for this row.
// Its rumoured this is true on wikipedia for some revisions (bug 34922).
// Next best thing is to have the total number of bytes.
$chardiff = ' <span class="mw-changeslist-separator">. .</span> ';
$chardiff .= Linker::formatRevisionSize($row->rev_len);
$chardiff .= ' <span class="mw-changeslist-separator">. .</span> ';
} else {
$parentLen = 0;
if (isset($this->mParentLens[$row->rev_parent_id])) {
$parentLen = $this->mParentLens[$row->rev_parent_id];
}
$chardiff = ' <span class="mw-changeslist-separator">. .</span> ';
$chardiff .= ChangesList::showCharacterDifference($parentLen, $row->rev_len, $this->getContext());
$chardiff .= ' <span class="mw-changeslist-separator">. .</span> ';
}
$lang = $this->getLanguage();
$comment = $lang->getDirMark() . Linker::revComment($rev, false, true);
$date = $lang->userTimeAndDate($row->rev_timestamp, $user);
if ($rev->userCan(Revision::DELETED_TEXT, $user)) {
$d = Linker::linkKnown($page, htmlspecialchars($date), ['class' => 'mw-changeslist-date'], ['oldid' => intval($row->rev_id)]);
} else {
$d = htmlspecialchars($date);
}
if ($rev->isDeleted(Revision::DELETED_TEXT)) {
$d = '<span class="history-deleted">' . $d . '</span>';
}
# Show user names for /newbies as there may be different users.
# Note that we already excluded rows with hidden user names.
if ($this->contribs == 'newbie') {
$userlink = ' . . ' . $lang->getDirMark() . Linker::userLink($rev->getUser(), $rev->getUserText());
$userlink .= ' ' . $this->msg('parentheses')->rawParams(Linker::userTalkLink($rev->getUser(), $rev->getUserText()))->escaped() . ' ';
} else {
$userlink = '';
}
$flags = [];
if ($rev->getParentId() === 0) {
$flags[] = ChangesList::flag('newpage');
}
if ($rev->isMinor()) {
$flags[] = ChangesList::flag('minor');
}
$del = Linker::getRevDeleteLink($user, $rev, $page);
if ($del !== '') {
$del .= ' ';
}
//.........这里部分代码省略.........
示例7: formatRow
/**
* Generates each row in the contributions list.
*
* Contributions which are marked "top" are currently on top of the history.
* For these contributions, a [rollback] link is shown for users with sysop
* privileges. The rollback link restores the most recent version that was not
* written by the target user.
*
* @todo This would probably look a lot nicer in a table.
* @param $row
* @return string
*/
function formatRow( $row ) {
wfProfileIn( __METHOD__ );
$page = Title::makeTitle( $row->ar_namespace, $row->ar_title );
$rev = new Revision( array(
'title' => $page,
'id' => $row->ar_rev_id,
'comment' => $row->ar_comment,
'user' => $row->ar_user,
'user_text' => $row->ar_user_text,
'timestamp' => $row->ar_timestamp,
'minor_edit' => $row->ar_minor_edit,
'deleted' => $row->ar_deleted,
) );
$undelete = SpecialPage::getTitleFor( 'Undelete' );
$logs = SpecialPage::getTitleFor( 'Log' );
$dellog = Linker::linkKnown(
$logs,
$this->messages['deletionlog'],
array(),
array(
'type' => 'delete',
'page' => $page->getPrefixedText()
)
);
$reviewlink = Linker::linkKnown(
SpecialPage::getTitleFor( 'Undelete', $page->getPrefixedDBkey() ),
$this->messages['undeleteviewlink']
);
$user = $this->getUser();
if ( $user->isAllowed( 'deletedtext' ) ) {
$last = Linker::linkKnown(
$undelete,
$this->messages['diff'],
array(),
array(
'target' => $page->getPrefixedText(),
'timestamp' => $rev->getTimestamp(),
'diff' => 'prev'
)
);
} else {
$last = $this->messages['diff'];
}
$comment = Linker::revComment( $rev );
$date = $this->getLanguage()->userTimeAndDate( $rev->getTimestamp(), $user );
$date = htmlspecialchars( $date );
if ( !$user->isAllowed( 'undelete' ) || !$rev->userCan( Revision::DELETED_TEXT, $user ) ) {
$link = $date; // unusable link
} else {
$link = Linker::linkKnown(
$undelete,
$date,
array( 'class' => 'mw-changeslist-date' ),
array(
'target' => $page->getPrefixedText(),
'timestamp' => $rev->getTimestamp()
)
);
}
// Style deleted items
if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
$link = '<span class="history-deleted">' . $link . '</span>';
}
$pagelink = Linker::link(
$page,
null,
array( 'class' => 'mw-changeslist-title' )
);
if ( $rev->isMinor() ) {
$mflag = ChangesList::flag( 'minor' );
} else {
$mflag = '';
}
// Revision delete link
$del = Linker::getRevDeleteLink( $user, $rev, $page );
if ( $del ) {
//.........这里部分代码省略.........
示例8: setOldSubtitle
/**
* Sets the subtitle when viewing old revisions of a page.
* This function's code is mostly copied from Article::setOldSubtitle(),
* and it is meant to serve as a replacement for that function, using
* the 'DisplayOldSubtitle' hook.
* This display has the following differences from the standard one:
* - It includes a link to the approved revision, which goes to the
* default page.
* - It includes a "diff" link alongside it.
* - The "Latest revision" link points to the correct revision ID,
* instead of to the default page (unless the latest revision is also
* the approved one).
*
* @author Eli Handel
*/
static function setOldSubtitle($article, $revisionID)
{
$title = $article->getTitle();
# Added for ApprovedRevs - and removed hook
$unhide = $article->getContext()->getRequest()->getInt('unhide') == 1;
// Cascade unhide param in links for easy deletion browsing.
$extraParams = array();
if ($unhide) {
$extraParams['unhide'] = 1;
}
if ($article->mRevision && $article->mRevision->getId() === $revisionID) {
$revision = $article->mRevision;
} else {
$revision = Revision::newFromId($revisionID);
}
$timestamp = $revision->getTimestamp();
$latestID = $article->getLatest();
// Modified for Approved Revs
$current = $revisionID == $latestID;
$approvedID = ApprovedRevs::getApprovedRevID($title);
$language = $article->getContext()->getLanguage();
$user = $article->getContext()->getUser();
$td = $language->userTimeAndDate($timestamp, $user);
$tddate = $language->userDate($timestamp, $user);
$tdtime = $language->userTime($timestamp, $user);
// Show the user links if they're allowed to see them.
// If hidden, then show them only if requested...
$userlinks = Linker::revUserTools($revision, !$unhide);
$infomsg = $current && !wfMessage('revision-info-current')->isDisabled() ? 'revision-info-current' : 'revision-info';
$outputPage = $article->getContext()->getOutput();
$outputPage->addSubtitle("<div id=\"mw-{$infomsg}\">" . wfMessage($infomsg, $td)->rawParams($userlinks)->params($revision->getID(), $tddate, $tdtime, $revision->getUser())->parse() . "</div>");
// Created for Approved Revs
$latestLinkParams = array();
if ($latestID != $approvedID) {
$latestLinkParams['oldid'] = $latestID;
}
$lnk = $current ? wfMessage('currentrevisionlink')->escaped() : Linker::linkKnown($title, wfMessage('currentrevisionlink')->escaped(), array(), $latestLinkParams + $extraParams);
$curdiff = $current ? wfMessage('diff')->escaped() : Linker::linkKnown($title, wfMessage('diff')->escaped(), array(), array('diff' => 'cur', 'oldid' => $revisionID) + $extraParams);
$prev = $title->getPreviousRevisionID($revisionID);
$prevlink = $prev ? Linker::linkKnown($title, wfMessage('previousrevision')->escaped(), array(), array('direction' => 'prev', 'oldid' => $revisionID) + $extraParams) : wfMessage('previousrevision')->escaped();
$prevdiff = $prev ? Linker::linkKnown($title, wfMessage('diff')->escaped(), array(), array('diff' => 'prev', 'oldid' => $revisionID) + $extraParams) : wfMessage('diff')->escaped();
$nextlink = $current ? wfMessage('nextrevision')->escaped() : Linker::linkKnown($title, wfMessage('nextrevision')->escaped(), array(), array('direction' => 'next', 'oldid' => $revisionID) + $extraParams);
$nextdiff = $current ? wfMessage('diff')->escaped() : Linker::linkKnown($title, wfMessage('diff')->escaped(), array(), array('diff' => 'next', 'oldid' => $revisionID) + $extraParams);
// Added for Approved Revs
$approved = $approvedID != null && $revisionID == $approvedID;
$approvedlink = $approved ? wfMessage('approvedrevs-approvedrevision')->escaped() : Linker::linkKnown($title, wfMessage('approvedrevs-approvedrevision')->escaped(), array(), $extraParams);
$approveddiff = $approved ? wfMessage('diff')->escaped() : Linker::linkKnown($title, wfMessage('diff')->escaped(), array(), array('diff' => $approvedID, 'oldid' => $revisionID) + $extraParams);
$cdel = Linker::getRevDeleteLink($user, $revision, $title);
if ($cdel !== '') {
$cdel .= ' ';
}
// Modified for ApprovedRevs
$outputPage->addSubtitle("<div id=\"mw-revision-nav\">" . $cdel . wfMessage('approvedrevs-revision-nav')->rawParams($prevdiff, $prevlink, $approvedlink, $approveddiff, $lnk, $curdiff, $nextlink, $nextdiff)->escaped() . "</div>");
}
示例9: diffHeader
/**
* @param Revision $rev
* @param string $prefix
* @return string
*/
private function diffHeader($rev, $prefix)
{
$isDeleted = !($rev->getId() && $rev->getTitle());
if ($isDeleted) {
/// @todo FIXME: $rev->getTitle() is null for deleted revs...?
$targetPage = $this->getPageTitle();
$targetQuery = array('target' => $this->mTargetObj->getPrefixedText(), 'timestamp' => wfTimestamp(TS_MW, $rev->getTimestamp()));
} else {
/// @todo FIXME: getId() may return non-zero for deleted revs...
$targetPage = $rev->getTitle();
$targetQuery = array('oldid' => $rev->getId());
}
// Add show/hide deletion links if available
$user = $this->getUser();
$lang = $this->getLanguage();
$rdel = Linker::getRevDeleteLink($user, $rev, $this->mTargetObj);
if ($rdel) {
$rdel = " {$rdel}";
}
$minor = $rev->isMinor() ? ChangesList::flag('minor') : '';
$tags = wfGetDB(DB_SLAVE)->selectField('tag_summary', 'ts_tags', array('ts_rev_id' => $rev->getId()), __METHOD__);
$tagSummary = ChangeTags::formatSummaryRow($tags, 'deleteddiff', $this->getContext());
// FIXME This is reimplementing DifferenceEngine#getRevisionHeader
// and partially #showDiffPage, but worse
return '<div id="mw-diff-' . $prefix . 'title1"><strong>' . Linker::link($targetPage, $this->msg('revisionasof', $lang->userTimeAndDate($rev->getTimestamp(), $user), $lang->userDate($rev->getTimestamp(), $user), $lang->userTime($rev->getTimestamp(), $user))->escaped(), array(), $targetQuery) . '</strong></div>' . '<div id="mw-diff-' . $prefix . 'title2">' . Linker::revUserTools($rev) . '<br />' . '</div>' . '<div id="mw-diff-' . $prefix . 'title3">' . $minor . Linker::revComment($rev) . $rdel . '<br />' . '</div>' . '<div id="mw-diff-' . $prefix . 'title5">' . $tagSummary[0] . '<br />' . '</div>';
}
示例10: formatRevisionRow
private function formatRevisionRow($row, $earliestLiveTime, $remaining)
{
$rev = Revision::newFromArchiveRow($row, array('page' => $this->mTargetObj->getArticleId()));
$stxt = '';
$ts = wfTimestamp(TS_MW, $row->ar_timestamp);
// Build checkboxen...
if ($this->mAllowed) {
if ($this->mInvert) {
if (in_array($ts, $this->mTargetTimestamp)) {
$checkBox = Xml::check("ts{$ts}");
} else {
$checkBox = Xml::check("ts{$ts}", true);
}
} else {
$checkBox = Xml::check("ts{$ts}");
}
} else {
$checkBox = '';
}
$user = $this->getUser();
// Build page & diff links...
if ($this->mCanView) {
$titleObj = $this->getTitle();
# Last link
if (!$rev->userCan(Revision::DELETED_TEXT, $this->getUser())) {
$pageLink = htmlspecialchars($this->getLanguage()->userTimeAndDate($ts, $user));
$last = $this->msg('diff')->escaped();
} elseif ($remaining > 0 || $earliestLiveTime && $ts > $earliestLiveTime) {
$pageLink = $this->getPageLink($rev, $titleObj, $ts);
$last = Linker::linkKnown($titleObj, $this->msg('diff')->escaped(), array(), array('target' => $this->mTargetObj->getPrefixedText(), 'timestamp' => $ts, 'diff' => 'prev'));
} else {
$pageLink = $this->getPageLink($rev, $titleObj, $ts);
$last = $this->msg('diff')->escaped();
}
} else {
$pageLink = htmlspecialchars($this->getLanguage()->userTimeAndDate($ts, $user));
$last = $this->msg('diff')->escaped();
}
// User links
$userLink = Linker::revUserTools($rev);
// Revision text size
$size = $row->ar_len;
if (!is_null($size)) {
$stxt = Linker::formatRevisionSize($size);
}
// Edit summary
$comment = Linker::revComment($rev);
// Revision delete links
$revdlink = Linker::getRevDeleteLink($user, $rev, $this->mTargetObj);
return "<li>{$checkBox} {$revdlink} ({$last}) {$pageLink} . . {$userLink} {$stxt} {$comment}</li>";
}
示例11: contributionsLineEndingProcess
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;
}
示例12: setOldSubtitle
/**
* Generate the navigation links when browsing through an article revisions
* It shows the information as:
* Revision as of \<date\>; view current revision
* \<- Previous version | Next Version -\>
*
* @param $oldid String: revision ID of this article revision
*/
public function setOldSubtitle($oldid = 0)
{
global $wgLang, $wgOut, $wgUser, $wgRequest;
if (!wfRunHooks('DisplayOldSubtitle', array(&$this, &$oldid))) {
return;
}
$unhide = $wgRequest->getInt('unhide') == 1;
# Cascade unhide param in links for easy deletion browsing
$extraParams = array();
if ($wgRequest->getVal('unhide')) {
$extraParams['unhide'] = 1;
}
$revision = Revision::newFromId($oldid);
$timestamp = $revision->getTimestamp();
$current = $oldid == $this->mPage->getLatest();
$td = $wgLang->timeanddate($timestamp, true);
$tddate = $wgLang->date($timestamp, true);
$tdtime = $wgLang->time($timestamp, true);
# Show user links if allowed to see them. If hidden, then show them only if requested...
$userlinks = Linker::revUserTools($revision, !$unhide);
$infomsg = $current && !wfMessage('revision-info-current')->isDisabled() ? 'revision-info-current' : 'revision-info';
$wgOut->addSubtitle("<div id=\"mw-{$infomsg}\">" . wfMessage($infomsg, $td)->rawParams($userlinks)->params($revision->getID(), $tddate, $tdtime, $revision->getUser())->parse() . "</div>");
$lnk = $current ? wfMsgHtml('currentrevisionlink') : Linker::link($this->getTitle(), wfMsgHtml('currentrevisionlink'), array(), $extraParams, array('known', 'noclasses'));
$curdiff = $current ? wfMsgHtml('diff') : Linker::link($this->getTitle(), wfMsgHtml('diff'), array(), array('diff' => 'cur', 'oldid' => $oldid) + $extraParams, array('known', 'noclasses'));
$prev = $this->getTitle()->getPreviousRevisionID($oldid);
$prevlink = $prev ? Linker::link($this->getTitle(), wfMsgHtml('previousrevision'), array(), array('direction' => 'prev', 'oldid' => $oldid) + $extraParams, array('known', 'noclasses')) : wfMsgHtml('previousrevision');
$prevdiff = $prev ? Linker::link($this->getTitle(), wfMsgHtml('diff'), array(), array('diff' => 'prev', 'oldid' => $oldid) + $extraParams, array('known', 'noclasses')) : wfMsgHtml('diff');
$nextlink = $current ? wfMsgHtml('nextrevision') : Linker::link($this->getTitle(), wfMsgHtml('nextrevision'), array(), array('direction' => 'next', 'oldid' => $oldid) + $extraParams, array('known', 'noclasses'));
$nextdiff = $current ? wfMsgHtml('diff') : Linker::link($this->getTitle(), wfMsgHtml('diff'), array(), array('diff' => 'next', 'oldid' => $oldid) + $extraParams, array('known', 'noclasses'));
$cdel = Linker::getRevDeleteLink($wgUser, $revision, $this->getTitle());
if ($cdel !== '') {
$cdel .= ' ';
}
$wgOut->addSubtitle("<div id=\"mw-revision-nav\">" . $cdel . wfMsgExt('revision-nav', array('escapenoentities', 'parsemag', 'replaceafter'), $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff) . "</div>");
}