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


PHP WebRequest::getIntOrNull方法代码示例

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


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

示例1: fetchValuesFromRequest

 public function fetchValuesFromRequest(WebRequest $r, $values = false)
 {
     if (!$values) {
         $values = array_keys($this->options);
     }
     foreach ($values as $name) {
         $default = $this->options[$name]['default'];
         $type = $this->options[$name]['type'];
         switch ($type) {
             case self::BOOL:
                 $value = $r->getBool($name, $default);
                 break;
             case self::INT:
                 $value = $r->getInt($name, $default);
                 break;
             case self::STRING:
                 $value = $r->getText($name, $default);
                 break;
             case self::INTNULL:
                 $value = $r->getIntOrNull($name);
                 break;
             default:
                 throw new MWException('Unsupported datatype');
         }
         if ($value !== null) {
             $this->options[$name]['value'] = $value === $default ? null : $value;
         }
     }
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:29,代码来源:FormOptions.php

示例2: getBaseRevId

 /**
  * Guess the rev ID the text of this form is based off
  * Note: baseRevId trusted for Reviewers - check text for others.
  * @return int
  */
 protected static function getBaseRevId(EditPage $editPage, WebRequest $request)
 {
     if (!isset($editPage->fr_baseRevId)) {
         $article = $editPage->getArticle();
         // convenience
         $latestId = $article->getLatest();
         // current rev
         $undo = $request->getIntOrNull('undo');
         # Undoing consecutive top edits...
         if ($undo && $undo === $latestId) {
             # Treat this like a revert to a base revision.
             # We are undoing all edits *after* some rev ID (undoafter).
             # If undoafter is not given, then it is the previous rev ID.
             $revId = $request->getInt('undoafter', $article->getTitle()->getPreviousRevisionID($latestId, Title::GAID_FOR_UPDATE));
             # Undoing other edits...
         } elseif ($undo) {
             $revId = $latestId;
             // current rev is the base rev
             # Other edits...
         } else {
             # If we are editing via oldid=X, then use that rev ID.
             # Otherwise, check if the client specified the ID (bug 23098).
             $revId = $article->getOldID() ? $article->getOldID() : $request->getInt('baseRevId');
             // e.g. "show changes"/"preview"
         }
         # Zero oldid => draft revision
         if (!$revId) {
             $revId = $latestId;
         }
         $editPage->fr_baseRevId = $revId;
     }
     return $editPage->fr_baseRevId;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:38,代码来源:FlaggablePageView.php

示例3: getAltBaseRevId

 /**
  * Guess the alternative rev ID the text of this form is based off.
  * When undoing the top X edits, the base can be though of as either
  * the current or the edit X edits prior to the latest.
  * Note: baseRevId trusted for Reviewers - check text for others.
  * @param EditPage $editPage
  * @param WebRequest $request
  * @return int
  */
 protected static function getAltBaseRevId(EditPage $editPage, WebRequest $request)
 {
     if ($editPage->isConflict) {
         return 0;
         // throw away these values (bug 33481)
     }
     if (!isset($editPage->fr_altBaseRevId)) {
         $article = $editPage->getArticle();
         // convenience
         $latestId = $article->getLatest();
         // current rev
         $undo = $request->getIntOrNull('undo');
         # Undoing consecutive top edits...
         if ($undo && $undo === $latestId) {
             # Treat this like a revert to a base revision.
             # We are undoing all edits *after* some rev ID (undoafter).
             # If undoafter is not given, then it is the previous rev ID.
             $revId = $request->getInt('undoafter', $article->getTitle()->getPreviousRevisionID($latestId, Title::GAID_FOR_UPDATE));
         } else {
             $revId = $request->getInt('altBaseRevId');
         }
         $editPage->fr_altBaseRevId = $revId;
     }
     return $editPage->fr_altBaseRevId;
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:34,代码来源:FlaggablePageView.php


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