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


PHP Status::wrap方法代码示例

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


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

示例1: execute

 public function execute()
 {
     if (!$this->hasAnyRoutes()) {
         $this->dieUsage('No password reset routes are available.', 'moduledisabled');
     }
     $params = $this->extractRequestParams() + ['user' => null, 'email' => null];
     $this->requireOnlyOneParameter($params, 'user', 'email');
     $passwordReset = new PasswordReset($this->getConfig(), AuthManager::singleton());
     $status = $passwordReset->isAllowed($this->getUser(), $params['capture']);
     if (!$status->isOK()) {
         $this->dieStatus(Status::wrap($status));
     }
     $status = $passwordReset->execute($this->getUser(), $params['user'], $params['email'], $params['capture']);
     if (!$status->isOK()) {
         $status->value = null;
         $this->dieStatus(Status::wrap($status));
     }
     $result = $this->getResult();
     $result->addValue(['resetpassword'], 'status', 'success');
     if ($params['capture']) {
         $passwords = $status->getValue() ?: [];
         ApiResult::setArrayType($passwords, 'kvp', 'user');
         ApiResult::setIndexedTagName($passwords, 'p');
         $result->addValue(['resetpassword'], 'passwords', $passwords);
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:26,代码来源:ApiResetPassword.php

示例2: getByStatus

		public static function getByStatus($status)
		{
			global $db;
			$sql = "SELECT * FROM statuses WHERE LOWER(status)=?";
			$values = array(strtolower($status));
			$stat = $db->qwv($sql, $values);
			
			return Status::wrap($stat);
		}
开发者ID:rockerest,项目名称:capstone,代码行数:9,代码来源:Status.php

示例3: showSuccessPage

 /**
  * Show the success page.
  *
  * @param string $type Condition of return to; see `executeReturnTo`
  * @param string|Message $title Page's title
  * @param string $msgname
  * @param string $injected_html
  * @param StatusValue|null $extraMessages
  */
 protected function showSuccessPage($type, $title, $msgname, $injected_html, $extraMessages)
 {
     $out = $this->getOutput();
     $out->setPageTitle($title);
     if ($msgname) {
         $out->addWikiMsg($msgname, wfEscapeWikiText($this->getUser()->getName()));
     }
     if ($extraMessages) {
         $extraMessages = Status::wrap($extraMessages);
         $out->addWikiText($extraMessages->getWikiText());
     }
     $out->addHTML($injected_html);
     $helper = new LoginHelper($this->getContext());
     $helper->showReturnToPage($type, $this->mReturnTo, $this->mReturnToQuery, $this->mStickHTTPS);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:24,代码来源:LoginSignupSpecialPage.php

示例4: displayForm

 /**
  * Display the form.
  * @param false|Status|StatusValue $status A form submit status, as in HTMLForm::trySubmit()
  */
 protected function displayForm($status)
 {
     if ($status instanceof StatusValue) {
         $status = Status::wrap($status);
     }
     $form = $this->getAuthForm($this->authRequests, $this->authAction);
     $form->prepareForm()->displayForm($status);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:12,代码来源:AuthManagerSpecialPage.php

示例5: provideAllowsAuthenticationDataChange

 public static function provideAllowsAuthenticationDataChange()
 {
     $ignored = \Status::newGood('ignored');
     $ignored->warning('authmanager-change-not-supported');
     $okFromPrimary = StatusValue::newGood();
     $okFromPrimary->warning('warning-from-primary');
     $okFromSecondary = StatusValue::newGood();
     $okFromSecondary->warning('warning-from-secondary');
     return [[StatusValue::newGood(), StatusValue::newGood(), \Status::newGood()], [StatusValue::newGood(), StatusValue::newGood('ignore'), \Status::newGood()], [StatusValue::newGood('ignored'), StatusValue::newGood(), \Status::newGood()], [StatusValue::newGood('ignored'), StatusValue::newGood('ignored'), $ignored], [StatusValue::newFatal('fail from primary'), StatusValue::newGood(), \Status::newFatal('fail from primary')], [$okFromPrimary, StatusValue::newGood(), \Status::wrap($okFromPrimary)], [StatusValue::newGood(), StatusValue::newFatal('fail from secondary'), \Status::newFatal('fail from secondary')], [StatusValue::newGood(), $okFromSecondary, \Status::wrap($okFromSecondary)]];
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:10,代码来源:AuthManagerTest.php

示例6: provideProviderAllowsAuthenticationDataChange

 public static function provideProviderAllowsAuthenticationDataChange()
 {
     $err = \StatusValue::newGood();
     $err->error('arbitrary-warning');
     return [[AuthenticationRequest::class, 'UTSysop', \Status::newGood(), \StatusValue::newGood('ignored'), \StatusValue::newGood('ignored')], [PasswordAuthenticationRequest::class, 'UTSysop', \Status::newGood(), \StatusValue::newGood('ignored'), \StatusValue::newGood('ignored')], [TemporaryPasswordAuthenticationRequest::class, 'UTSysop', \Status::newGood(), \StatusValue::newGood(), \StatusValue::newGood()], [TemporaryPasswordAuthenticationRequest::class, 'uTSysop', \Status::newGood(), \StatusValue::newGood(), \StatusValue::newGood()], [TemporaryPasswordAuthenticationRequest::class, 'UTSysop', \Status::wrap($err), \StatusValue::newGood(), $err], [TemporaryPasswordAuthenticationRequest::class, 'UTSysop', \Status::newFatal('arbitrary-error'), \StatusValue::newGood(), \StatusValue::newFatal('arbitrary-error')], [TemporaryPasswordAuthenticationRequest::class, 'DoesNotExist', \Status::newGood(), \StatusValue::newGood(), \StatusValue::newGood('ignored')], [TemporaryPasswordAuthenticationRequest::class, '<invalid>', \Status::newGood(), \StatusValue::newGood(), \StatusValue::newGood('ignored')]];
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:6,代码来源:TemporaryPasswordPrimaryAuthenticationProviderTest.php

示例7: onSubmit

 /**
  * Process the form.  At this point we know that the user passes all the criteria in
  * userCanExecute(), and if the data array contains 'Username', etc, then Username
  * resets are allowed.
  * @param array $data
  * @throws MWException
  * @throws ThrottledError|PermissionsError
  * @return Status
  */
 public function onSubmit(array $data)
 {
     if (isset($data['Capture']) && !$this->getUser()->isAllowed('passwordreset')) {
         // The user knows they don't have the passwordreset permission,
         // but they tried to spoof the form. That's naughty
         throw new PermissionsError('passwordreset');
     }
     $username = isset($data['Username']) ? $data['Username'] : null;
     $email = isset($data['Email']) ? $data['Email'] : null;
     $capture = !empty($data['Capture']);
     $this->method = $username ? 'username' : 'email';
     $this->result = Status::wrap($this->passwordReset->execute($this->getUser(), $username, $email, $capture));
     if ($capture && $this->result->isOK()) {
         $this->passwords = $this->result->getValue();
     }
     if ($this->result->hasMessage('actionthrottledtext')) {
         throw new ThrottledError();
     }
     return $this->result;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:29,代码来源:SpecialPasswordReset.php


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