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


PHP Revision::getID方法代码示例

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


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

示例1: onRevisionRestore

 /**
  * Update flaggedrevs table on revision restore
  */
 public static function onRevisionRestore($title, Revision $revision, $oldPageID)
 {
     $dbw = wfGetDB(DB_MASTER);
     # Some revisions may have had null rev_id values stored when deleted.
     # This hook is called after insertOn() however, in which case it is set
     # as a new one.
     $dbw->update('flaggedrevs', array('fr_page_id' => $revision->getPage()), array('fr_page_id' => $oldPageID, 'fr_rev_id' => $revision->getID()), __METHOD__);
     return true;
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:12,代码来源:FlaggedRevs.hooks.php

示例2: 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

示例3: extractRevisionInfo


//.........这里部分代码省略.........
             $anyHidden = true;
         } elseif (!$content) {
             $vals['textmissing'] = true;
         }
     }
     if ($this->fld_content && $content) {
         $text = null;
         if ($this->generateXML) {
             if ($content->getModel() === CONTENT_MODEL_WIKITEXT) {
                 $t = $content->getNativeData();
                 # note: don't set $text
                 $wgParser->startExternalParse($title, ParserOptions::newFromContext($this->getContext()), Parser::OT_PREPROCESS);
                 $dom = $wgParser->preprocessToDom($t);
                 if (is_callable(array($dom, 'saveXML'))) {
                     $xml = $dom->saveXML();
                 } else {
                     $xml = $dom->__toString();
                 }
                 $vals['parsetree'] = $xml;
             } else {
                 $vals['badcontentformatforparsetree'] = true;
                 $this->setWarning("Conversion to XML is supported for wikitext only, " . $title->getPrefixedDBkey() . " uses content model " . $content->getModel());
             }
         }
         if ($this->expandTemplates && !$this->parseContent) {
             #XXX: implement template expansion for all content types in ContentHandler?
             if ($content->getModel() === CONTENT_MODEL_WIKITEXT) {
                 $text = $content->getNativeData();
                 $text = $wgParser->preprocess($text, $title, ParserOptions::newFromContext($this->getContext()));
             } else {
                 $this->setWarning("Template expansion is supported for wikitext only, " . $title->getPrefixedDBkey() . " uses content model " . $content->getModel());
                 $vals['badcontentformat'] = true;
                 $text = false;
             }
         }
         if ($this->parseContent) {
             $po = $content->getParserOutput($title, $revision->getId(), ParserOptions::newFromContext($this->getContext()));
             $text = $po->getText();
         }
         if ($text === null) {
             $format = $this->contentFormat ? $this->contentFormat : $content->getDefaultFormat();
             $model = $content->getModel();
             if (!$content->isSupportedFormat($format)) {
                 $name = $title->getPrefixedDBkey();
                 $this->setWarning("The requested format {$this->contentFormat} is not " . "supported for content model {$model} used by {$name}");
                 $vals['badcontentformat'] = true;
                 $text = false;
             } else {
                 $text = $content->serialize($format);
                 // always include format and model.
                 // Format is needed to deserialize, model is needed to interpret.
                 $vals['contentformat'] = $format;
                 $vals['contentmodel'] = $model;
             }
         }
         if ($text !== false) {
             ApiResult::setContentValue($vals, 'content', $text);
         }
     }
     if ($content && (!is_null($this->diffto) || !is_null($this->difftotext))) {
         static $n = 0;
         // Number of uncached diffs we've had
         if ($n < $this->getConfig()->get('APIMaxUncachedDiffs')) {
             $vals['diff'] = array();
             $context = new DerivativeContext($this->getContext());
             $context->setTitle($title);
             $handler = $revision->getContentHandler();
             if (!is_null($this->difftotext)) {
                 $model = $title->getContentModel();
                 if ($this->contentFormat && !ContentHandler::getForModelID($model)->isSupportedFormat($this->contentFormat)) {
                     $name = $title->getPrefixedDBkey();
                     $this->setWarning("The requested format {$this->contentFormat} is not " . "supported for content model {$model} used by {$name}");
                     $vals['diff']['badcontentformat'] = true;
                     $engine = null;
                 } else {
                     $difftocontent = ContentHandler::makeContent($this->difftotext, $title, $model, $this->contentFormat);
                     $engine = $handler->createDifferenceEngine($context);
                     $engine->setContent($content, $difftocontent);
                 }
             } else {
                 $engine = $handler->createDifferenceEngine($context, $revision->getID(), $this->diffto);
                 $vals['diff']['from'] = $engine->getOldid();
                 $vals['diff']['to'] = $engine->getNewid();
             }
             if ($engine) {
                 $difftext = $engine->getDiffBody();
                 ApiResult::setContentValue($vals['diff'], 'body', $difftext);
                 if (!$engine->wasCacheHit()) {
                     $n++;
                 }
             }
         } else {
             $vals['diff']['notcached'] = true;
         }
     }
     if ($anyHidden && $revision->isDeleted(Revision::DELETED_RESTRICTED)) {
         $vals['suppressed'] = true;
     }
     return $vals;
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:101,代码来源:ApiQueryRevisionsBase.php

示例4: getRevisionHeader

 /**
  * Get a header for a specified revision.
  *
  * @param $rev Revision
  * @param $complete String: 'complete' to get the header wrapped depending
  *        the visibility of the revision and a link to edit the page.
  * @return String HTML fragment
  */
 private 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();
         }
         $msg = $this->msg($title->userCan('edit', $user) ? 'editold' : 'viewsourceold')->escaped();
         /* Wikia Change begin */
         $header .= ' <span class="mw-rev-head-action">(' . Linker::linkKnown($title, $msg, array(), $editQuery) . ')</span>';
         /* Wikia Change end */
         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:schwarer2006,项目名称:wikia,代码行数:39,代码来源:DifferenceEngine.php

示例5: formatRevisionRow

 function formatRevisionRow($row)
 {
     global $wgUser, $wgLang;
     $rev = new Revision($row);
     $stxt = '';
     $last = $this->message['last'];
     $ts = wfTimestamp(TS_MW, $row->rev_timestamp);
     $checkBox = wfRadio("mergepoint", $ts, false);
     $pageLink = $this->sk->makeKnownLinkObj($rev->getTitle(), htmlspecialchars($wgLang->timeanddate($ts)), 'oldid=' . $rev->getID());
     if ($rev->isDeleted(Revision::DELETED_TEXT)) {
         $pageLink = '<span class="history-deleted">' . $pageLink . '</span>';
     }
     # Last link
     if (!$rev->userCan(Revision::DELETED_TEXT)) {
         $last = $this->message['last'];
     } else {
         if (isset($this->prevId[$row->rev_id])) {
             $last = $this->sk->makeKnownLinkObj($rev->getTitle(), $this->message['last'], "&diff=" . $row->rev_id . "&oldid=" . $this->prevId[$row->rev_id]);
         }
     }
     $userLink = $this->sk->revUserTools($rev);
     if (!is_null($size = $row->rev_len)) {
         if ($size == 0) {
             $stxt = wfMsgHtml('historyempty');
         } else {
             $stxt = wfMsgHtml('historysize', $wgLang->formatNum($size));
         }
     }
     $comment = $this->sk->revComment($rev);
     return "<li>{$checkBox} ({$last}) {$pageLink} . . {$userLink} {$stxt} {$comment}</li>";
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:31,代码来源:SpecialMergeHistory.php


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