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


PHP Revision::getTimestamp方法代码示例

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


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

示例1: showHeader

 /**
  * Render the header of a diff page including:
  * Name with url to page
  * Bytes added/removed
  * Day and time of edit
  * Edit Comment
  */
 function showHeader()
 {
     $title = $this->targetTitle;
     if ($this->prevRev) {
         $bytesChanged = $this->rev->getSize() - $this->prevRev->getSize();
     } else {
         $bytesChanged = $this->rev->getSize();
     }
     if ($bytesChanged > 0) {
         $changeMsg = 'mobile-frontend-diffview-bytesadded';
         $sizeClass = MobileUI::iconClass('bytesadded', 'before', 'icon-12px meta mw-mf-bytesadded');
     } elseif ($bytesChanged === 0) {
         $changeMsg = 'mobile-frontend-diffview-bytesnochange';
         $sizeClass = MobileUI::iconClass('bytesneutral', 'before', 'icon-12px meta mw-mf-bytesneutral');
     } else {
         $changeMsg = 'mobile-frontend-diffview-bytesremoved';
         $sizeClass = MobileUI::iconClass('bytesremoved', 'before', 'icon-12px meta mw-mf-bytesremoved');
         $bytesChanged = abs($bytesChanged);
     }
     if ($this->rev->isMinor()) {
         $minor = ChangesList::flag('minor');
     } else {
         $minor = '';
     }
     if ($this->rev->getComment() !== '') {
         $comment = Linker::formatComment($this->rev->getComment(), $title);
     } else {
         $comment = $this->msg('mobile-frontend-changeslist-nocomment')->escaped();
     }
     $ts = new MWTimestamp($this->rev->getTimestamp());
     $this->getOutput()->addHtml(Html::openElement('div', array('id' => 'mw-mf-diff-info', 'class' => 'page-summary')) . Html::openElement('h2', array()) . Html::element('a', array('href' => $title->getLocalURL()), $title->getPrefixedText()) . Html::closeElement('h2') . $this->msg('mobile-frontend-diffview-comma')->rawParams(Html::element('span', array('class' => $sizeClass), $this->msg($changeMsg)->numParams($bytesChanged)->text()), Html::element('span', array('class' => 'mw-mf-diff-date meta'), $ts->getHumanTimestamp()))->text() . Html::closeElement('div') . $minor . Html::rawElement('div', array('id' => 'mw-mf-diff-comment'), $comment));
 }
开发者ID:felixonmars,项目名称:mediawiki-extensions-MobileFrontend,代码行数:39,代码来源:SpecialMobileDiff.php

示例2: getRevisionLink

 /**
  * Get the HTML link to the revision text.
  * Overridden by RevDelArchiveItem.
  * @return string
  */
 protected function getRevisionLink()
 {
     $date = htmlspecialchars($this->list->getLanguage()->userTimeAndDate($this->revision->getTimestamp(), $this->list->getUser()));
     if ($this->isDeleted() && !$this->canViewContent()) {
         return $date;
     }
     return Linker::linkKnown($this->list->title, $date, array(), array('oldid' => $this->revision->getId(), 'unhide' => 1));
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:13,代码来源:RevDelRevisionItem.php

示例3: assertRevEquals

 protected function assertRevEquals(Revision $orig, Revision $rev = null)
 {
     $this->assertNotNull($rev, 'missing revision');
     $this->assertEquals($orig->getId(), $rev->getId());
     $this->assertEquals($orig->getPage(), $rev->getPage());
     $this->assertEquals($orig->getTimestamp(), $rev->getTimestamp());
     $this->assertEquals($orig->getUser(), $rev->getUser());
     $this->assertEquals($orig->getSha1(), $rev->getSha1());
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:9,代码来源:RevisionStorageTest.php

示例4: getTimestamp

 /**
  * @return String: timestamp
  */
 function getTimestamp()
 {
     if ($this->mRevision) {
         return $this->mRevision->getTimestamp();
     } elseif ($this->mImage) {
         return $this->mImage->getTimestamp();
     }
     return '';
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:12,代码来源:SearchResult.php

示例5: __construct

 /**
  * @param Title $pageTitle Title instance of the categorized page
  * @param Revision $revision Latest Revision instance of the categorized page
  *
  * @throws MWException
  */
 public function __construct(Title $pageTitle, Revision $revision = null)
 {
     $this->pageTitle = $pageTitle;
     if ($revision === null) {
         $this->timestamp = wfTimestampNow();
     } else {
         $this->timestamp = $revision->getTimestamp();
     }
     $this->revision = $revision;
     $this->newForCategorizationCallback = ['RecentChange', 'newForCategorization'];
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:17,代码来源:CategoryMembershipChange.php

示例6: updateRecentChangesEdits

 /**
  * Update the revision's recentchanges record if fields have been hidden
  * @param Revision $rev
  * @param int $bitfield new rev_deleted bitfield value
  */
 function updateRecentChangesEdits($rev, $bitfield)
 {
     $this->dbw->update('recentchanges', array('rc_deleted' => $bitfield, 'rc_patrolled' => 1), array('rc_this_oldid' => $rev->getId(), 'rc_timestamp' => $this->dbw->timestamp($rev->getTimestamp())), __METHOD__);
 }
开发者ID:ruizrube,项目名称:spdef,代码行数:9,代码来源:SpecialRevisiondelete.php

示例7: extractRowInfo

 private function extractRowInfo($row)
 {
     $revision = new Revision($row);
     $title = $revision->getTitle();
     $vals = array();
     if ($this->fld_ids) {
         $vals['revid'] = intval($revision->getId());
         // $vals['oldid'] = intval( $row->rev_text_id ); // todo: should this be exposed?
         if (!is_null($revision->getParentId())) {
             $vals['parentid'] = intval($revision->getParentId());
         }
     }
     if ($this->fld_flags && $revision->isMinor()) {
         $vals['minor'] = '';
     }
     if ($this->fld_user || $this->fld_userid) {
         if ($revision->isDeleted(Revision::DELETED_USER)) {
             $vals['userhidden'] = '';
         } else {
             if ($this->fld_user) {
                 $vals['user'] = $revision->getUserText();
             }
             $userid = $revision->getUser();
             if (!$userid) {
                 $vals['anon'] = '';
             }
             if ($this->fld_userid) {
                 $vals['userid'] = $userid;
             }
         }
     }
     if ($this->fld_timestamp) {
         $vals['timestamp'] = wfTimestamp(TS_ISO_8601, $revision->getTimestamp());
     }
     if ($this->fld_size) {
         if (!is_null($revision->getSize())) {
             $vals['size'] = intval($revision->getSize());
         } else {
             $vals['size'] = 0;
         }
     }
     if ($this->fld_sha1) {
         if ($revision->getSha1() != '') {
             $vals['sha1'] = wfBaseConvert($revision->getSha1(), 36, 16, 40);
         } else {
             $vals['sha1'] = '';
         }
     }
     if ($this->fld_comment || $this->fld_parsedcomment) {
         if ($revision->isDeleted(Revision::DELETED_COMMENT)) {
             $vals['commenthidden'] = '';
         } else {
             $comment = $revision->getComment();
             if ($this->fld_comment) {
                 $vals['comment'] = $comment;
             }
             if ($this->fld_parsedcomment) {
                 $vals['parsedcomment'] = Linker::formatComment($comment, $title);
             }
         }
     }
     if ($this->fld_tags) {
         if ($row->ts_tags) {
             $tags = explode(',', $row->ts_tags);
             $this->getResult()->setIndexedTagName($tags, 'tag');
             $vals['tags'] = $tags;
         } else {
             $vals['tags'] = array();
         }
     }
     if (!is_null($this->token)) {
         $tokenFunctions = $this->getTokenFunctions();
         foreach ($this->token as $t) {
             $val = call_user_func($tokenFunctions[$t], $title->getArticleID(), $title, $revision);
             if ($val === false) {
                 $this->setWarning("Action '{$t}' is not allowed for the current user");
             } else {
                 $vals[$t . 'token'] = $val;
             }
         }
     }
     $text = null;
     global $wgParser;
     if ($this->fld_content || !is_null($this->difftotext)) {
         $text = $revision->getText();
         // Expand templates after getting section content because
         // template-added sections don't count and Parser::preprocess()
         // will have less input
         if ($this->section !== false) {
             $text = $wgParser->getSection($text, $this->section, false);
             if ($text === false) {
                 $this->dieUsage("There is no section {$this->section} in r" . $revision->getId(), 'nosuchsection');
             }
         }
     }
     if ($this->fld_content && !$revision->isDeleted(Revision::DELETED_TEXT)) {
         if ($this->generateXML) {
             $wgParser->startExternalParse($title, ParserOptions::newFromContext($this->getContext()), OT_PREPROCESS);
             $dom = $wgParser->preprocessToDom($text);
             if (is_callable(array($dom, 'saveXML'))) {
//.........这里部分代码省略.........
开发者ID:seedbank,项目名称:old-repo,代码行数:101,代码来源:ApiQueryRevisions.php

示例8: getExplicitCategoriesChanges

 private function getExplicitCategoriesChanges(Title $title, Revision $newRev, Revision $oldRev = null)
 {
     // Inject the same timestamp for both revision parses to avoid seeing category changes
     // due to time-based parser functions. Inject the same page title for the parses too.
     // Note that REPEATABLE-READ makes template/file pages appear unchanged between parses.
     $parseTimestamp = $newRev->getTimestamp();
     // Parse the old rev and get the categories. Do not use link tables as that
     // assumes these updates are perfectly FIFO and that link tables are always
     // up to date, neither of which are true.
     $oldCategories = $oldRev ? $this->getCategoriesAtRev($title, $oldRev, $parseTimestamp) : [];
     // Parse the new revision and get the categories
     $newCategories = $this->getCategoriesAtRev($title, $newRev, $parseTimestamp);
     $categoryInserts = array_values(array_diff($newCategories, $oldCategories));
     $categoryDeletes = array_values(array_diff($oldCategories, $newCategories));
     return [$categoryInserts, $categoryDeletes];
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:16,代码来源:CategoryMembershipChangeJob.php

示例9: hrUndeleteShowRevisionHook

/**
 * Hook for deletion archive revision view, giving us a chance to
 * insert a removal tab for a deleted revision.
 *
 * @param $title
 * @param Revision $rev
 */
function hrUndeleteShowRevisionHook($title, $rev)
{
    hrInstallArchiveTab($title, $rev->getTimestamp());
    return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:12,代码来源:HideRevision.php

示例10: updateIfNewerOn

 /**
  * If the given revision is newer than the currently set page_latest,
  * update the page record. Otherwise, do nothing.
  *
  * @param Database $dbw
  * @param Revision $revision
  */
 function updateIfNewerOn(&$dbw, $revision)
 {
     $fname = 'Article::updateIfNewerOn';
     wfProfileIn($fname);
     $row = $dbw->selectRow(array('revision', 'page'), array('rev_id', 'rev_timestamp'), array('page_id' => $this->getId(), 'page_latest=rev_id'), $fname);
     if ($row) {
         if ($row->rev_timestamp >= $revision->getTimestamp()) {
             wfProfileOut($fname);
             return false;
         }
         $prev = $row->rev_id;
     } else {
         # No or missing previous revision; mark the page as new
         $prev = 0;
     }
     $ret = $this->updateRevisionOn($dbw, $revision, $prev);
     wfProfileOut($fname);
     return $ret;
 }
开发者ID:BackupTheBerlios,项目名称:enotifwiki,代码行数:26,代码来源:Article.php

示例11: getRevisionHeader

 /**
  * Get a header for a specified revision.
  *
  * @param Revision $rev
  * @param string $complete 'complete' to get the header wrapped depending
  *        the visibility of the revision and a link to edit the page.
  *
  * @return string HTML fragment
  */
 protected function getRevisionHeader(Revision $rev, $complete = '')
 {
     $lang = $this->getLanguage();
     $user = $this->getUser();
     $revtimestamp = $rev->getTimestamp();
     $timestamp = $lang->userTimeAndDate($revtimestamp, $user);
     $dateofrev = $lang->userDate($revtimestamp, $user);
     $timeofrev = $lang->userTime($revtimestamp, $user);
     $header = $this->msg($rev->isCurrent() ? 'currentrev-asof' : 'revisionasof', $timestamp, $dateofrev, $timeofrev)->escaped();
     if ($complete !== 'complete') {
         return $header;
     }
     $title = $rev->getTitle();
     $header = Linker::linkKnown($title, $header, array(), array('oldid' => $rev->getID()));
     if ($rev->userCan(Revision::DELETED_TEXT, $user)) {
         $editQuery = array('action' => 'edit');
         if (!$rev->isCurrent()) {
             $editQuery['oldid'] = $rev->getID();
         }
         $key = $title->quickUserCan('edit', $user) ? 'editold' : 'viewsourceold';
         $msg = $this->msg($key)->escaped();
         $editLink = $this->msg('parentheses')->rawParams(Linker::linkKnown($title, $msg, array(), $editQuery))->escaped();
         $header .= ' ' . Html::rawElement('span', array('class' => 'mw-diff-edit'), $editLink);
         if ($rev->isDeleted(Revision::DELETED_TEXT)) {
             $header = Html::rawElement('span', array('class' => 'history-deleted'), $header);
         }
     } else {
         $header = Html::rawElement('span', array('class' => 'history-deleted'), $header);
     }
     return $header;
 }
开发者ID:guochangjiang,项目名称:mediawiki,代码行数:40,代码来源:DifferenceEngine.php

示例12: showPatrolFooter

 /**
  * If patrol is possible, output a patrol UI box. This is called from the
  * footer section of ordinary page views. If patrol is not possible or not
  * desired, does nothing.
  * Side effect: When the patrol link is build, this method will call
  * OutputPage::preventClickjacking() and load mediawiki.page.patrol.ajax.
  *
  * @return bool
  */
 public function showPatrolFooter()
 {
     global $wgUseNPPatrol, $wgUseRCPatrol, $wgEnableAPI, $wgEnableWriteAPI;
     $outputPage = $this->getContext()->getOutput();
     $user = $this->getContext()->getUser();
     $cache = wfGetMainCache();
     $rc = false;
     if (!$this->getTitle()->quickUserCan('patrol', $user) || !($wgUseRCPatrol || $wgUseNPPatrol)) {
         // Patrolling is disabled or the user isn't allowed to
         return false;
     }
     wfProfileIn(__METHOD__);
     // New page patrol: Get the timestamp of the oldest revison which
     // the revision table holds for the given page. Then we look
     // whether it's within the RC lifespan and if it is, we try
     // to get the recentchanges row belonging to that entry
     // (with rc_new = 1).
     // Check for cached results
     if ($cache->get(wfMemcKey('NotPatrollablePage', $this->getTitle()->getArticleID()))) {
         wfProfileOut(__METHOD__);
         return false;
     }
     if ($this->mRevision && !RecentChange::isInRCLifespan($this->mRevision->getTimestamp(), 21600)) {
         // The current revision is already older than what could be in the RC table
         // 6h tolerance because the RC might not be cleaned out regularly
         wfProfileOut(__METHOD__);
         return false;
     }
     $dbr = wfGetDB(DB_SLAVE);
     $oldestRevisionTimestamp = $dbr->selectField('revision', 'MIN( rev_timestamp )', array('rev_page' => $this->getTitle()->getArticleID()), __METHOD__);
     if ($oldestRevisionTimestamp && RecentChange::isInRCLifespan($oldestRevisionTimestamp, 21600)) {
         // 6h tolerance because the RC might not be cleaned out regularly
         $rc = RecentChange::newFromConds(array('rc_new' => 1, 'rc_timestamp' => $oldestRevisionTimestamp, 'rc_namespace' => $this->getTitle()->getNamespace(), 'rc_cur_id' => $this->getTitle()->getArticleID(), 'rc_patrolled' => 0), __METHOD__, array('USE INDEX' => 'new_name_timestamp'));
     }
     if (!$rc) {
         // No RC entry around
         // Cache the information we gathered above in case we can't patrol
         // Don't cache in case we can patrol as this could change
         $cache->set(wfMemcKey('NotPatrollablePage', $this->getTitle()->getArticleID()), '1');
         wfProfileOut(__METHOD__);
         return false;
     }
     if ($rc->getPerformer()->getName() == $user->getName()) {
         // Don't show a patrol link for own creations. If the user could
         // patrol them, they already would be patrolled
         wfProfileOut(__METHOD__);
         return false;
     }
     $rcid = $rc->getAttribute('rc_id');
     $token = $user->getEditToken($rcid);
     $outputPage->preventClickjacking();
     if ($wgEnableAPI && $wgEnableWriteAPI && $user->isAllowed('writeapi')) {
         $outputPage->addModules('mediawiki.page.patrol.ajax');
     }
     $link = Linker::linkKnown($this->getTitle(), wfMessage('markaspatrolledtext')->escaped(), array('class' => 'mw-patrollink'), array('action' => 'markpatrolled', 'rcid' => $rcid, 'token' => $token));
     $outputPage->addHTML("<div class='patrollink'>" . wfMessage('markaspatrolledlink')->rawParams($link)->escaped() . '</div>');
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:spring,项目名称:spring-website,代码行数:68,代码来源:Article.php

示例13: revLink

 /**
  * Create a link to view this revision of the page
  *
  * @param Revision $rev
  * @return string
  */
 function revLink($rev)
 {
     $date = $this->getLanguage()->userTimeAndDate($rev->getTimestamp(), $this->getUser());
     $date = htmlspecialchars($date);
     if ($rev->userCan(Revision::DELETED_TEXT, $this->getUser())) {
         $link = Linker::linkKnown($this->getTitle(), $date, array('class' => 'mw-changeslist-date'), array('oldid' => $rev->getId()));
     } else {
         $link = $date;
     }
     if ($rev->isDeleted(Revision::DELETED_TEXT)) {
         $link = "<span class=\"history-deleted\">{$link}</span>";
     }
     return $link;
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:20,代码来源:HistoryAction.php

示例14: getDiffRevMsgAndClass

 protected static function getDiffRevMsgAndClass(Revision $rev, FlaggedRevision $srev = null)
 {
     $tier = FlaggedRevision::getRevQuality($rev->getId());
     if ($tier !== false) {
         $msg = $tier ? 'revreview-hist-quality' : 'revreview-hist-basic';
     } else {
         $msg = $srev && $rev->getTimestamp() > $srev->getRevTimestamp() ? 'revreview-hist-pending' : 'revreview-hist-draft';
     }
     $css = FlaggedRevsXML::getQualityColor($tier);
     return array($msg, $css);
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:11,代码来源:FlaggablePageView.php

示例15: 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.
  */
 function formatRow($row)
 {
     global $wgUser, $wgLang;
     wfProfileIn(__METHOD__);
     $sk = $this->getSkin();
     $rev = new Revision(array('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));
     $page = Title::makeTitle($row->ar_namespace, $row->ar_title);
     $undelete = SpecialPage::getTitleFor('Undelete');
     $logs = SpecialPage::getTitleFor('Log');
     $dellog = $sk->linkKnown($logs, $this->messages['deletionlog'], array(), array('type' => 'delete', 'page' => $page->getPrefixedText()));
     $reviewlink = $sk->linkKnown(SpecialPage::getTitleFor('Undelete', $page->getPrefixedDBkey()), $this->messages['undeleteviewlink']);
     if ($wgUser->isAllowed('deletedtext')) {
         $last = $sk->linkKnown($undelete, $this->messages['diff'], array(), array('target' => $page->getPrefixedText(), 'timestamp' => $rev->getTimestamp(), 'diff' => 'prev'));
     } else {
         $last = $this->messages['diff'];
     }
     $comment = $sk->revComment($rev);
     $date = htmlspecialchars($wgLang->timeanddate($rev->getTimestamp(), true));
     if (!$wgUser->isAllowed('undelete') || !$rev->userCan(Revision::DELETED_TEXT)) {
         $link = $date;
         // unusable link
     } else {
         $link = $sk->linkKnown($undelete, $date, array(), array('target' => $page->getPrefixedText(), 'timestamp' => $rev->getTimestamp()));
     }
     // Style deleted items
     if ($rev->isDeleted(Revision::DELETED_TEXT)) {
         $link = '<span class="history-deleted">' . $link . '</span>';
     }
     $pagelink = $sk->link($page);
     if ($rev->isMinor()) {
         $mflag = ChangesList::flag('minor');
     } else {
         $mflag = '';
     }
     // Revision delete link
     $canHide = $wgUser->isAllowed('deleterevision');
     if ($canHide || $rev->getVisibility() && $wgUser->isAllowed('deletedhistory')) {
         if (!$rev->userCan(Revision::DELETED_RESTRICTED)) {
             $del = $this->mSkin->revDeleteLinkDisabled($canHide);
             // revision was hidden from sysops
         } else {
             $query = array('type' => 'archive', 'target' => $page->getPrefixedDbkey(), 'ids' => $rev->getTimestamp());
             $del = $this->mSkin->revDeleteLink($query, $rev->isDeleted(Revision::DELETED_RESTRICTED), $canHide) . ' ';
         }
     } else {
         $del = '';
     }
     $tools = Html::rawElement('span', array('class' => 'mw-deletedcontribs-tools'), wfMsg('parentheses', $wgLang->pipeList(array($last, $dellog, $reviewlink))));
     $ret = "{$del}{$link} {$tools} . . {$mflag} {$pagelink} {$comment}";
     # Denote if username is redacted for this edit
     if ($rev->isDeleted(Revision::DELETED_USER)) {
         $ret .= " <strong>" . wfMsgHtml('rev-deleted-user-contribs') . "</strong>";
     }
     $ret = Html::rawElement('li', array(), $ret) . "\n";
     wfProfileOut(__METHOD__);
     return $ret;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:67,代码来源:SpecialDeletedContributions.php


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