当前位置: 首页>>代码示例>>PHP>>正文


PHP Linker::revDeleteLink方法代码示例

本文整理汇总了PHP中Linker::revDeleteLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Linker::revDeleteLink方法的具体用法?PHP Linker::revDeleteLink怎么用?PHP Linker::revDeleteLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Linker的用法示例。


在下文中一共展示了Linker::revDeleteLink方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: historyLine

 /**
  * Returns a row from the history printout.
  *
  * @todo document some more, and maybe clean up the code (some params redundant?)
  *
  * @param stdClass $row The database row corresponding to the previous line.
  * @param mixed $next The database row corresponding to the next line
  *   (chronologically previous)
  * @param bool|string $notificationtimestamp
  * @param bool $latest Whether this row corresponds to the page's latest revision.
  * @param bool $firstInList Whether this row corresponds to the first
  *   displayed on this history page.
  * @return string HTML output for the row
  */
 function historyLine($row, $next, $notificationtimestamp = false, $latest = false, $firstInList = false)
 {
     $rev = new Revision($row);
     $rev->setTitle($this->getTitle());
     if (is_object($next)) {
         $prevRev = new Revision($next);
         $prevRev->setTitle($this->getTitle());
     } else {
         $prevRev = null;
     }
     $curlink = $this->curLink($rev, $latest);
     $lastlink = $this->lastLink($rev, $next);
     $curLastlinks = $curlink . $this->historyPage->message['pipe-separator'] . $lastlink;
     $histLinks = Html::rawElement('span', array('class' => 'mw-history-histlinks'), $this->msg('parentheses')->rawParams($curLastlinks)->escaped());
     $diffButtons = $this->diffButtons($rev, $firstInList);
     $s = $histLinks . $diffButtons;
     $link = $this->revLink($rev);
     $classes = array();
     $del = '';
     $user = $this->getUser();
     // Show checkboxes for each revision
     if ($user->isAllowed('deleterevision')) {
         $this->preventClickjacking();
         // If revision was hidden from sysops, disable the checkbox
         if (!$rev->userCan(Revision::DELETED_RESTRICTED, $user)) {
             $del = Xml::check('deleterevisions', false, array('disabled' => 'disabled'));
             // Otherwise, enable the checkbox...
         } else {
             $del = Xml::check('showhiderevisions', false, array('name' => 'ids[' . $rev->getId() . ']'));
         }
         // User can only view deleted revisions...
     } elseif ($rev->getVisibility() && $user->isAllowed('deletedhistory')) {
         // If revision was hidden from sysops, disable the link
         if (!$rev->userCan(Revision::DELETED_RESTRICTED, $user)) {
             $del = Linker::revDeleteLinkDisabled(false);
             // Otherwise, show the link...
         } else {
             $query = array('type' => 'revision', 'target' => $this->getTitle()->getPrefixedDBkey(), 'ids' => $rev->getId());
             $del .= Linker::revDeleteLink($query, $rev->isDeleted(Revision::DELETED_RESTRICTED), false);
         }
     }
     if ($del) {
         $s .= " {$del} ";
     }
     $lang = $this->getLanguage();
     $dirmark = $lang->getDirMark();
     $s .= " {$link}";
     $s .= $dirmark;
     $s .= " <span class='history-user'>" . Linker::revUserTools($rev, true) . "</span>";
     $s .= $dirmark;
     if ($rev->isMinor()) {
         $s .= ' ' . ChangesList::flag('minor');
     }
     # Sometimes rev_len isn't populated
     if ($rev->getSize() !== null) {
         # Size is always public data
         $prevSize = isset($this->parentLens[$row->rev_parent_id]) ? $this->parentLens[$row->rev_parent_id] : 0;
         $sDiff = ChangesList::showCharacterDifference($prevSize, $rev->getSize());
         $fSize = Linker::formatRevisionSize($rev->getSize());
         $s .= ' <span class="mw-changeslist-separator">. .</span> ' . "{$fSize} {$sDiff}";
     }
     # Text following the character difference is added just before running hooks
     $s2 = Linker::revComment($rev, false, true);
     if ($notificationtimestamp && $row->rev_timestamp >= $notificationtimestamp) {
         $s2 .= ' <span class="updatedmarker">' . $this->msg('updatedmarker')->escaped() . '</span>';
         $classes[] = 'mw-history-line-updated';
     }
     $tools = array();
     # Rollback and undo links
     if ($prevRev && $this->getTitle()->quickUserCan('edit', $user)) {
         if ($latest && $this->getTitle()->quickUserCan('rollback', $user)) {
             // Get a rollback link without the brackets
             $rollbackLink = Linker::generateRollback($rev, $this->getContext(), array('verify', 'noBrackets'));
             if ($rollbackLink) {
                 $this->preventClickjacking();
                 $tools[] = $rollbackLink;
             }
         }
         if (!$rev->isDeleted(Revision::DELETED_TEXT) && !$prevRev->isDeleted(Revision::DELETED_TEXT)) {
             # Create undo tooltip for the first (=latest) line only
             $undoTooltip = $latest ? array('title' => $this->msg('tooltip-undo')->text()) : array();
             $undolink = Linker::linkKnown($this->getTitle(), $this->msg('editundo')->escaped(), $undoTooltip, array('action' => 'edit', 'undoafter' => $prevRev->getId(), 'undo' => $rev->getId()));
             $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
         }
     }
     // Allow extension to add their own links here
//.........这里部分代码省略.........
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:101,代码来源:HistoryAction.php

示例2: formatFileRow

 private function formatFileRow($row)
 {
     $file = ArchivedFile::newFromRow($row);
     $ts = wfTimestamp(TS_MW, $row->fa_timestamp);
     $user = $this->getUser();
     $checkBox = '';
     if ($this->mCanView && $row->fa_storage_key) {
         if ($this->mAllowed) {
             $checkBox = Xml::check('fileid' . $row->fa_id);
         }
         $key = urlencode($row->fa_storage_key);
         $pageLink = $this->getFileLink($file, $this->getPageTitle(), $ts, $key);
     } else {
         $pageLink = $this->getLanguage()->userTimeAndDate($ts, $user);
     }
     $userLink = $this->getFileUser($file);
     $data = $this->msg('widthheight')->numParams($row->fa_width, $row->fa_height)->text();
     $bytes = $this->msg('parentheses')->rawParams($this->msg('nbytes')->numParams($row->fa_size)->text())->plain();
     $data = htmlspecialchars($data . ' ' . $bytes);
     $comment = $this->getFileComment($file);
     // Add show/hide deletion links if available
     $canHide = $this->isAllowed('deleterevision');
     if ($canHide || $file->getVisibility() && $this->isAllowed('deletedhistory')) {
         if (!$file->userCan(File::DELETED_RESTRICTED, $user)) {
             // Revision was hidden from sysops
             $revdlink = Linker::revDeleteLinkDisabled($canHide);
         } else {
             $query = array('type' => 'filearchive', 'target' => $this->mTargetObj->getPrefixedDBkey(), 'ids' => $row->fa_id);
             $revdlink = Linker::revDeleteLink($query, $file->isDeleted(File::DELETED_RESTRICTED), $canHide);
         }
     } else {
         $revdlink = '';
     }
     return "<li>{$checkBox} {$revdlink} {$pageLink} . . {$userLink} {$data} {$comment}</li>\n";
 }
开发者ID:raymondzhangl,项目名称:mediawiki,代码行数:35,代码来源:SpecialUndelete.php

示例3: getRevDeleteLink

 /**
  * Get a revision-deletion link, or disabled link, or nothing, depending
  * on user permissions & the settings on the revision.
  *
  * Will use forward-compatible revision ID in the Special:RevDelete link
  * if possible, otherwise the timestamp-based ID which may break after
  * undeletion.
  *
  * @param User $user
  * @param Revision $rev
  * @param Revision $title
  * @return string HTML fragment
  */
 public static function getRevDeleteLink(User $user, Revision $rev, Title $title)
 {
     $canHide = $user->isAllowed('deleterevision');
     if (!$canHide && !($rev->getVisibility() && $user->isAllowed('deletedhistory'))) {
         return '';
     }
     if (!$rev->userCan(Revision::DELETED_RESTRICTED, $user)) {
         return Linker::revDeleteLinkDisabled($canHide);
         // revision was hidden from sysops
     } else {
         if ($rev->getId()) {
             // RevDelete links using revision ID are stable across
             // page deletion and undeletion; use when possible.
             $query = array('type' => 'revision', 'target' => $title->getPrefixedDBkey(), 'ids' => $rev->getId());
         } else {
             // Older deleted entries didn't save a revision ID.
             // We have to refer to these by timestamp, ick!
             $query = array('type' => 'archive', 'target' => $title->getPrefixedDBkey(), 'ids' => $rev->getTimestamp());
         }
         return Linker::revDeleteLink($query, $rev->isDeleted(Revision::DELETED_RESTRICTED), $canHide);
     }
 }
开发者ID:h4ck3rm1k3,项目名称:mediawiki,代码行数:35,代码来源:Linker.php

示例4: imageHistoryLine

 /**
  * @param $iscur
  * @param $file File
  * @return string
  */
 public function imageHistoryLine($iscur, $file)
 {
     global $wgContLang;
     $user = $this->getUser();
     $lang = $this->getLanguage();
     $timestamp = wfTimestamp(TS_MW, $file->getTimestamp());
     $img = $iscur ? $file->getName() : $file->getArchiveName();
     $userId = $file->getUser('id');
     $userText = $file->getUser('text');
     $description = $file->getDescription(File::FOR_THIS_USER, $user);
     $local = $this->current->isLocal();
     $row = $selected = '';
     // Deletion link
     if ($local && $user->isAllowedAny('delete', 'deletedhistory')) {
         $row .= '<td>';
         # Link to remove from history
         if ($user->isAllowed('delete')) {
             $q = array('action' => 'delete');
             if (!$iscur) {
                 $q['oldimage'] = $img;
             }
             $row .= Linker::linkKnown($this->title, $this->msg($iscur ? 'filehist-deleteall' : 'filehist-deleteone')->escaped(), array(), $q);
         }
         # Link to hide content. Don't show useless link to people who cannot hide revisions.
         $canHide = $user->isAllowed('deleterevision');
         if ($canHide || $user->isAllowed('deletedhistory') && $file->getVisibility()) {
             if ($user->isAllowed('delete')) {
                 $row .= '<br />';
             }
             // If file is top revision or locked from this user, don't link
             if ($iscur || !$file->userCan(File::DELETED_RESTRICTED, $user)) {
                 $del = Linker::revDeleteLinkDisabled($canHide);
             } else {
                 list($ts, ) = 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 .= $this->msg('filehist-current')->escaped();
     } elseif ($local && $this->title->quickUserCan('edit', $user) && $this->title->quickUserCan('upload', $user)) {
         if ($file->isDeleted(File::DELETED_FILE)) {
             $row .= $this->msg('filehist-revert')->escaped();
         } else {
             $row .= Linker::linkKnown($this->title, $this->msg('filehist-revert')->escaped(), array(), array('action' => 'revert', 'oldimage' => $img, 'wpEditToken' => $user->getEditToken($img)));
         }
     }
     $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, $user)) {
         # Don't link to unviewable files
         $row .= '<span class="history-deleted">' . $lang->userTimeAndDate($timestamp, $user) . '</span>';
     } elseif ($file->isDeleted(File::DELETED_FILE)) {
         if ($local) {
             $this->preventClickjacking();
             $revdel = SpecialPage::getTitleFor('Revisiondelete');
             # Make a link to review the image
             $url = Linker::linkKnown($revdel, $lang->userTimeAndDate($timestamp, $user), array(), array('target' => $this->title->getPrefixedText(), 'file' => $img, 'token' => $user->getEditToken($img)));
         } else {
             $url = $lang->userTimeAndDate($timestamp, $user);
         }
         $row .= '<span class="history-deleted">' . $url . '</span>';
     } else {
         $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl($img);
         $row .= Xml::element('a', array('href' => $url), $lang->userTimeAndDate($timestamp, $user));
     }
     $row .= "</td>";
     // Thumbnail
     if ($this->showThumb) {
         $row .= '<td>' . $this->getThumbForLine($file) . '</td>';
     }
     // Image dimensions + size
     $row .= '<td>';
     $row .= htmlspecialchars($file->getDimensionsString());
     $row .= $this->msg('word-separator')->plain();
     $row .= '<span style="white-space: nowrap;">';
     $row .= $this->msg('parentheses')->rawParams(Linker::formatSize($file->getSize()))->plain();
     $row .= '</span>';
     $row .= '</td>';
     // Uploading user
     $row .= '<td>';
     // Hide deleted usernames
     if ($file->isDeleted(File::DELETED_USER)) {
         $row .= '<span class="history-deleted">' . $this->msg('rev-deleted-user')->escaped() . '</span>';
     } else {
         if ($local) {
//.........这里部分代码省略.........
开发者ID:Tarendai,项目名称:spring-website,代码行数:101,代码来源:ImagePage.php

示例5: getShowHideLinks

 /**
  * @param $row Row
  * @return string
  */
 private function getShowHideLinks($row)
 {
     if ($this->flags == self::NO_ACTION_LINK || $row->log_type == 'suppress') {
         // no one can hide items from the suppress log
         return '';
     }
     $del = '';
     $user = $this->getUser();
     // Don't show useless checkbox to people who cannot hide log entries
     if ($user->isAllowed('deletedhistory')) {
         $canHide = $user->isAllowed('deletelogentry');
         if ($row->log_deleted || $canHide) {
             if ($canHide && $this->flags & self::USE_REVDEL_CHECKBOXES) {
                 // Show checkboxes instead of links.
                 if (!self::userCan($row, LogPage::DELETED_RESTRICTED, $user)) {
                     // If event was hidden from sysops
                     $del = Xml::check('deleterevisions', false, array('disabled' => 'disabled'));
                 } else {
                     $del = Xml::check('showhiderevisions', false, array('name' => 'ids[' . $row->log_id . ']'));
                 }
             } else {
                 if (!self::userCan($row, LogPage::DELETED_RESTRICTED, $user)) {
                     // If event was hidden from sysops
                     $del = Linker::revDeleteLinkDisabled($canHide);
                 } else {
                     $query = array('target' => SpecialPage::getTitleFor('Log', $row->log_type)->getPrefixedDBkey(), 'type' => 'logging', 'ids' => $row->log_id);
                     $del = Linker::revDeleteLink($query, self::isDeleted($row, LogPage::DELETED_RESTRICTED), $canHide);
                 }
             }
         }
     }
     return $del;
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:37,代码来源:LogEventsList.php

示例6: getShowHideLinks

 /**
  * @param stdClass $row Row
  * @return string
  */
 private function getShowHideLinks($row)
 {
     // We don't want to see the links and
     if ($this->flags == self::NO_ACTION_LINK) {
         return '';
     }
     $user = $this->getUser();
     // If change tag editing is available to this user, return the checkbox
     if ($this->flags & self::USE_CHECKBOXES && $this->showTagEditUI) {
         return Xml::check('showhiderevisions', false, array('name' => 'ids[' . $row->log_id . ']'));
     }
     // no one can hide items from the suppress log.
     if ($row->log_type == 'suppress') {
         return '';
     }
     $del = '';
     // Don't show useless checkbox to people who cannot hide log entries
     if ($user->isAllowed('deletedhistory')) {
         $canHide = $user->isAllowed('deletelogentry');
         $canViewSuppressedOnly = $user->isAllowed('viewsuppressed') && !$user->isAllowed('suppressrevision');
         $entryIsSuppressed = self::isDeleted($row, LogPage::DELETED_RESTRICTED);
         $canViewThisSuppressedEntry = $canViewSuppressedOnly && $entryIsSuppressed;
         if ($row->log_deleted || $canHide) {
             // Show checkboxes instead of links.
             if ($canHide && $this->flags & self::USE_CHECKBOXES && !$canViewThisSuppressedEntry) {
                 // If event was hidden from sysops
                 if (!self::userCan($row, LogPage::DELETED_RESTRICTED, $user)) {
                     $del = Xml::check('deleterevisions', false, array('disabled' => 'disabled'));
                 } else {
                     $del = Xml::check('showhiderevisions', false, array('name' => 'ids[' . $row->log_id . ']'));
                 }
             } else {
                 // If event was hidden from sysops
                 if (!self::userCan($row, LogPage::DELETED_RESTRICTED, $user)) {
                     $del = Linker::revDeleteLinkDisabled($canHide);
                 } else {
                     $query = array('target' => SpecialPage::getTitleFor('Log', $row->log_type)->getPrefixedDBkey(), 'type' => 'logging', 'ids' => $row->log_id);
                     $del = Linker::revDeleteLink($query, $entryIsSuppressed, $canHide && !$canViewThisSuppressedEntry);
                 }
             }
         }
     }
     return $del;
 }
开发者ID:OrBin,项目名称:mediawiki,代码行数:48,代码来源:LogEventsList.php

示例7: revDeleteLink

 public function revDeleteLink($query = [], $restricted = false, $delete = true)
 {
     return Linker::revDeleteLink($query, $restricted, $delete);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:4,代码来源:DummyLinker.php

示例8: getShowHideLinks

 /**
  * @param $row Row
  * @return string
  */
 private function getShowHideLinks($row)
 {
     global $wgUser;
     if ($this->flags & self::NO_ACTION_LINK || $row->log_type == 'suppress') {
         // no one can hide items from the suppress log
         return '';
     }
     $del = '';
     // Don't show useless link to people who cannot hide revisions
     if ($wgUser->isAllowed('deletedhistory')) {
         if ($row->log_deleted || $wgUser->isAllowed('deleterevision')) {
             $canHide = $wgUser->isAllowed('deleterevision');
             // If event was hidden from sysops
             if (!self::userCan($row, LogPage::DELETED_RESTRICTED)) {
                 $del = Linker::revDeleteLinkDisabled($canHide);
             } else {
                 $target = SpecialPage::getTitleFor('Log', $row->log_type);
                 $query = array('target' => $target->getPrefixedDBkey(), 'type' => 'logging', 'ids' => $row->log_id);
                 $del = Linker::revDeleteLink($query, self::isDeleted($row, LogPage::DELETED_RESTRICTED), $canHide);
             }
         }
     }
     return $del;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:28,代码来源:LogEventsList.php

示例9: historyLine

 /**
  * Returns a row from the history printout.
  *
  * @todo document some more, and maybe clean up the code (some params redundant?)
  *
  * @param $row Object: the database row corresponding to the previous line.
  * @param $next Mixed: the database row corresponding to the next line. (chronologically previous)
  * @param $notificationtimestamp
  * @param $latest Boolean: whether this row corresponds to the page's latest revision.
  * @param $firstInList Boolean: whether this row corresponds to the first displayed on this history page.
  * @return String: HTML output for the row
  */
 function historyLine($row, $next, $notificationtimestamp = false, $latest = false, $firstInList = false)
 {
     $rev = new Revision($row);
     $rev->setTitle($this->getTitle());
     if (is_object($next)) {
         $prevRev = new Revision($next);
         $prevRev->setTitle($this->getTitle());
     } else {
         $prevRev = null;
     }
     $curlink = $this->curLink($rev, $latest);
     $lastlink = $this->lastLink($rev, $next);
     $diffButtons = $this->diffButtons($rev, $firstInList);
     $histLinks = Html::rawElement('span', array('class' => 'mw-history-histlinks'), '(' . $curlink . $this->historyPage->message['pipe-separator'] . $lastlink . ') ');
     $s = $histLinks . $diffButtons;
     $link = $this->revLink($rev);
     $classes = array();
     $del = '';
     $user = $this->getUser();
     // Show checkboxes for each revision
     if ($user->isAllowed('deleterevision')) {
         $this->preventClickjacking();
         // If revision was hidden from sysops, disable the checkbox
         if (!$rev->userCan(Revision::DELETED_RESTRICTED, $user)) {
             $del = Xml::check('deleterevisions', false, array('disabled' => 'disabled'));
             // Otherwise, enable the checkbox...
         } else {
             $del = Xml::check('showhiderevisions', false, array('name' => 'ids[' . $rev->getId() . ']'));
         }
         // User can only view deleted revisions...
     } elseif ($rev->getVisibility() && $user->isAllowed('deletedhistory')) {
         // If revision was hidden from sysops, disable the link
         if (!$rev->userCan(Revision::DELETED_RESTRICTED, $user)) {
             $cdel = Linker::revDeleteLinkDisabled(false);
             // Otherwise, show the link...
         } else {
             $query = array('type' => 'revision', 'target' => $this->getTitle()->getPrefixedDbkey(), 'ids' => $rev->getId());
             $del .= Linker::revDeleteLink($query, $rev->isDeleted(Revision::DELETED_RESTRICTED), false);
         }
     }
     if ($del) {
         $s .= " {$del} ";
     }
     $lang = $this->getLanguage();
     $dirmark = $lang->getDirMark();
     $s .= " {$link}";
     $s .= $dirmark;
     $s .= " <span class='history-user'>" . Linker::revUserTools($rev, true) . "</span>";
     $s .= $dirmark;
     if ($rev->isMinor()) {
         $s .= ' ' . ChangesList::flag('minor');
     }
     # Size is always public data
     $prevSize = $prevRev ? $prevRev->getSize() : 0;
     $sDiff = ChangesList::showCharacterDifference($prevSize, $rev->getSize());
     $fSize = Linker::formatRevisionSize($rev->getSize());
     $s .= " . . {$fSize} {$sDiff} . . ";
     $s .= Linker::revComment($rev, false, true);
     if ($notificationtimestamp && $row->rev_timestamp >= $notificationtimestamp) {
         $s .= ' <span class="updatedmarker">' . $this->msg('updatedmarker')->escaped() . '</span>';
     }
     $tools = array();
     # Rollback and undo links
     if ($prevRev && !count($this->getTitle()->getUserPermissionsErrors('edit', $this->getUser()))) {
         if ($latest && !count($this->getTitle()->getUserPermissionsErrors('rollback', $this->getUser()))) {
             $this->preventClickjacking();
             $tools[] = '<span class="mw-rollback-link">' . Linker::buildRollbackLink($rev) . '</span>';
         }
         if (!$rev->isDeleted(Revision::DELETED_TEXT) && !$prevRev->isDeleted(Revision::DELETED_TEXT)) {
             # Create undo tooltip for the first (=latest) line only
             $undoTooltip = $latest ? array('title' => $this->msg('tooltip-undo')->text()) : array();
             $undolink = Linker::linkKnown($this->getTitle(), $this->msg('editundo')->escaped(), $undoTooltip, array('action' => 'edit', 'undoafter' => $prevRev->getId(), 'undo' => $rev->getId()));
             $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
         }
     }
     if ($tools) {
         $s .= ' (' . $lang->pipeList($tools) . ')';
     }
     # Tags
     list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow($row->ts_tags, 'history');
     $classes = array_merge($classes, $newClasses);
     $s .= " {$tagSummary}";
     wfRunHooks('PageHistoryLineEnding', array($this, &$row, &$s, &$classes));
     $attribs = array();
     if ($classes) {
         $attribs['class'] = implode(' ', $classes);
     }
     return Xml::tags('li', $attribs, $s) . "\n";
//.........这里部分代码省略.........
开发者ID:Tjorriemorrie,项目名称:app,代码行数:101,代码来源:HistoryAction.php

示例10: formatFileRow

 private function formatFileRow($row)
 {
     $file = ArchivedFile::newFromRow($row);
     $ts = wfTimestamp(TS_MW, $row->fa_timestamp);
     if ($this->mAllowed && $row->fa_storage_key) {
         $checkBox = Xml::check('fileid' . $row->fa_id);
         $key = urlencode($row->fa_storage_key);
         $pageLink = $this->getFileLink($file, $this->getTitle(), $ts, $key);
     } else {
         $checkBox = '';
         $pageLink = $this->getLang()->timeanddate($ts, true);
     }
     $userLink = $this->getFileUser($file);
     $data = wfMsg('widthheight', $this->getLang()->formatNum($row->fa_width), $this->getLang()->formatNum($row->fa_height)) . ' (' . wfMsg('nbytes', $this->getLang()->formatNum($row->fa_size)) . ')';
     $data = htmlspecialchars($data);
     $comment = $this->getFileComment($file);
     // Add show/hide deletion links if available
     $canHide = $this->getUser()->isAllowed('deleterevision');
     if ($canHide || $file->getVisibility() && $this->getUser()->isAllowed('deletedhistory')) {
         if (!$file->userCan(File::DELETED_RESTRICTED)) {
             $revdlink = Linker::revDeleteLinkDisabled($canHide);
             // revision was hidden from sysops
         } else {
             $query = array('type' => 'filearchive', 'target' => $this->mTargetObj->getPrefixedDBkey(), 'ids' => $row->fa_id);
             $revdlink = Linker::revDeleteLink($query, $file->isDeleted(File::DELETED_RESTRICTED), $canHide);
         }
     } else {
         $revdlink = '';
     }
     return "<li>{$checkBox} {$revdlink} {$pageLink} . . {$userLink} {$data} {$comment}</li>\n";
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:31,代码来源:SpecialUndelete.php

示例11: 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);
     $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 = '';
     // User can delete revisions or view deleted revisions...
     $canHide = $wgUser->isAllowed('deleterevision');
     if ($canHide || $revision->getVisibility() && $wgUser->isAllowed('deletedhistory')) {
         if (!$revision->userCan(Revision::DELETED_RESTRICTED)) {
             $cdel = Linker::revDeleteLinkDisabled($canHide);
             // rev was hidden from Sysops
         } else {
             $query = array('type' => 'revision', 'target' => $this->getTitle()->getPrefixedDbkey(), 'ids' => $oldid);
             $cdel = Linker::revDeleteLink($query, $revision->isDeleted(File::DELETED_RESTRICTED), $canHide);
         }
         $cdel .= ' ';
     }
     # 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';
     $r = "\n\t\t\t\t<div id=\"mw-{$infomsg}\">" . wfMsgExt($infomsg, array('parseinline', 'replaceafter'), $td, $userlinks, $revision->getID(), $tddate, $tdtime, $revision->getUser()) . "</div>\n" . "\n\t\t\t\t<div id=\"mw-revision-nav\">" . $cdel . wfMsgExt('revision-nav', array('escapenoentities', 'parsemag', 'replaceafter'), $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff) . "</div>\n\t\t\t";
     $wgOut->setSubtitle($r);
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:52,代码来源:Article.php


注:本文中的Linker::revDeleteLink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。