本文整理汇总了PHP中WebRequest::getInt方法的典型用法代码示例。如果您正苦于以下问题:PHP WebRequest::getInt方法的具体用法?PHP WebRequest::getInt怎么用?PHP WebRequest::getInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebRequest
的用法示例。
在下文中一共展示了WebRequest::getInt方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(WebRequest $request)
{
$this->mType = $request->getText('type');
$this->mOid = preg_replace('/\\?.*$/', '', $request->getText('oid'));
parse_str(urldecode($request->getText('params')), $this->mParams);
$this->mCb = $request->getInt('cb');
if (!empty($this->mParams['noexternals'])) {
$this->mNoExternals = true;
}
if (!empty($this->mParams['forceprofile'])) {
$this->mForceProfile = true;
}
}
示例2: loadDataFromRequest
/**
* @param WebRequest $request
*
* @return string
*/
function loadDataFromRequest($request)
{
$size = $request->getInt($this->mName);
if (!$size) {
return $this->getDefault();
}
$size = abs($size);
// negative numbers represent "max", positive numbers represent "min"
if ($request->getVal($this->mName . '-mode') === 'max') {
return -$size;
} else {
return $size;
}
}
示例3: runPage
protected function runPage()
{
try {
$id = WebRequest::getInt("id");
$hash = WebRequest::get("hash");
// data validation
$customer = Customer::getById($id);
if ($customer == null) {
throw new NonexistantObjectException();
}
$customer->confirmEmail($hash);
// save
$customer->save();
Session::setLoggedInCustomer($id);
$this->mSmarty->assign("content", Message::getMessage("mail-confirmed"));
} catch (NonexistantObjectException $ex) {
global $cScriptPath;
$this->mHeaders[] = "Location: {$cScriptPath}";
}
}
示例4: 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;
}
示例5: 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;
}
}
}
示例6: createTitleFromRequest
/**
* Tries to create an existing title object for current request. Used for setting the title
* global during ajax requests. It uses title URL param to keep backward compatibility.
*
* @static
* @param WebRequest $request
* @return Title
*/
public static function createTitleFromRequest($request)
{
if ($request->getVal('title', '') === '') {
$title = Title::newMainPage();
} else {
$title = Title::newFromText($request->getVal('title', 'AJAX'), $request->getInt('namespace', NS_MAIN));
if (!$title instanceof Title) {
$title = Title::makeTitle(NS_MAIN, 'AJAX');
}
}
return $title;
}
示例7: 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;
}
示例8: doDeleteUserAction
private function doDeleteUserAction()
{
$userid = WebRequest::getInt("id");
if ($userid < 1) {
throw new Exception("UserID too small");
}
if (InternalUser::getById($userid) == null) {
throw new Exception("User does not exist");
}
InternalUser::getById($userid)->delete();
global $cScriptPath;
$this->mHeaders[] = "Location: {$cScriptPath}/SystemUsers";
}
示例9: doPayBillAction
private function doPayBillAction()
{
$id = WebRequest::getInt("id");
$items = Bill_item::getIdListByBooking($id);
$total = 0;
foreach ($items as $i) {
$bi = Bill_item::getById($i);
$total += $bi->getPrice();
}
$inv = new Bill_item();
$inv->setBooking(Booking::getById($id));
$inv->setName("Payment");
$inv->setPrice(-$total);
$inv->save();
global $cScriptPath;
$this->mHeaders[] = "Location: {$cScriptPath}/Billing?action=view&id=" . $id;
}
示例10: doResendCustomerAction
private function doResendCustomerAction()
{
$cid = WebRequest::getInt("id");
if ($cid < 1) {
throw new Exception("CustomerId too small");
}
$customer = Customer::getById($cid);
if ($customer == null) {
throw new Exception("CustomerId does not exist");
}
$customer->setEmail($customer->getEmail());
$customer->save();
$customer->sendMailConfirm();
global $cScriptPath;
$this->mHeaders[] = "Location: {$cScriptPath}/Customers";
}
示例11: doDeleteBookingAction
private function doDeleteBookingAction()
{
$bid = WebRequest::getInt("id");
if ($bid < 1) {
throw new Exception("BookingId too small");
}
if (Booking::getById($bid) == null) {
throw new Exception("Booking does not exist");
}
Booking::getById($bid)->delete();
global $cScriptPath;
$this->mHeaders[] = "Location: {$cScriptPath}/Bookings";
}
示例12: doDeleteRoomAction
private function doDeleteRoomAction()
{
$rid = WebRequest::getInt("id");
if ($rid < 1) {
throw new Exception("RoomId too small");
}
if (Room::getById($rid) == null) {
throw new Exception("Room does not exist");
}
Room::getById($rid)->delete();
global $cScriptPath;
$this->mHeaders[] = "Location: {$cScriptPath}/Rooms";
}