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


PHP Status::isGood方法代码示例

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


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

示例1: onSuccess

 public function onSuccess()
 {
     if ($this->getUser()->isAllowed('passwordreset') && $this->email != null) {
         // @todo: Logging
         if ($this->result->isGood()) {
             $this->getOutput()->addWikiMsg('passwordreset-emailsent-capture');
         } else {
             $this->getOutput()->addWikiMsg('passwordreset-emailerror-capture', $this->result->getMessage());
         }
         $this->getOutput()->addHTML(Html::rawElement('pre', array(), $this->email->escaped()));
     }
     $this->getOutput()->addWikiMsg('passwordreset-emailsent');
     $this->getOutput()->returnToMain();
 }
开发者ID:laiello,项目名称:media-wiki-law,代码行数:14,代码来源:SpecialPasswordReset.php

示例2: endStage

 /**
  * @param string $step
  * @param Status $status
  */
 public function endStage($step, $status)
 {
     if ($step == 'extension-tables') {
         $this->endLiveBox();
     }
     $msg = $status->isOk() ? 'config-install-step-done' : 'config-install-step-failed';
     $html = wfMessage('word-separator')->escaped() . wfMessage($msg)->escaped();
     if (!$status->isOk()) {
         $html = "<span class=\"error\">{$html}</span>";
     }
     $this->addHTML($html . "</li>\n");
     if (!$status->isGood()) {
         $this->parent->showStatusBox($status);
     }
 }
开发者ID:Kaph-Noir,项目名称:mediawiki,代码行数:19,代码来源:WebInstallerInstall.php

示例3: onSuccess

 public function onSuccess()
 {
     if ($this->getUser()->isAllowed('passwordreset') && $this->email != null) {
         // @todo Logging
         if ($this->result->isGood()) {
             $this->getOutput()->addWikiMsg('passwordreset-emailsent-capture');
         } else {
             $this->getOutput()->addWikiMsg('passwordreset-emailerror-capture', $this->result->getMessage(), $this->firstUser->getName());
         }
         $this->getOutput()->addHTML(Html::rawElement('pre', [], $this->email->escaped()));
     }
     if ($this->method === 'email') {
         $this->getOutput()->addWikiMsg('passwordreset-emailsentemail');
     } else {
         $this->getOutput()->addWikiMsg('passwordreset-emailsentusername');
     }
     $this->getOutput()->returnToMain();
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:18,代码来源:SpecialPasswordReset.php

示例4: onSuccess

 public function onSuccess()
 {
     if ($this->getUser()->isAllowed('passwordreset') && $this->passwords) {
         // @todo Logging
         if ($this->result->isGood()) {
             $this->getOutput()->addWikiMsg('passwordreset-emailsent-capture2', count($this->passwords));
         } else {
             $this->getOutput()->addWikiMsg('passwordreset-emailerror-capture2', $this->result->getMessage(), key($this->passwords), count($this->passwords));
         }
         $this->getOutput()->addHTML(Html::openElement('ul'));
         foreach ($this->passwords as $username => $pwd) {
             $this->getOutput()->addHTML(Html::rawElement('li', [], htmlspecialchars($username, ENT_QUOTES) . $this->msg('colon-separator')->text() . htmlspecialchars($pwd, ENT_QUOTES)));
         }
         $this->getOutput()->addHTML(Html::closeElement('ul'));
     }
     if ($this->method === 'email') {
         $this->getOutput()->addWikiMsg('passwordreset-emailsentemail');
     } else {
         $this->getOutput()->addWikiMsg('passwordreset-emailsentusername');
     }
     $this->getOutput()->returnToMain();
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:22,代码来源:SpecialPasswordReset.php

示例5: convertStatusToArray

 /**
  * Converts a Status object to an array suitable for addValue
  * @param Status $status
  * @param string $errorType
  * @return array
  */
 public function convertStatusToArray($status, $errorType = 'error')
 {
     if ($status->isGood()) {
         return array();
     }
     $result = array();
     foreach ($status->getErrorsByType($errorType) as $error) {
         $this->setIndexedTagName($error['params'], 'param');
         $result[] = $error;
     }
     $this->setIndexedTagName($result, $errorType);
     return $result;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:19,代码来源:ApiResult.php

示例6: printStatus

/**
 * Print status
 * @global integer $failed
 * @param Status $status
 */
function printStatus($status)
{
    global $failed;
    if ($status->isGood()) {
        echo " ... DONE.\n";
    } else {
        $failed++;
        echo " ... FAILED (" . $status->getMessage() . ").\n";
    }
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:15,代码来源:updateWikiFactoryVariable.php

示例7: arrayFromStatus

 public function arrayFromStatus(Status $status, $type = 'error', $format = null)
 {
     if ($status->isGood() || !$status->errors) {
         return [];
     }
     $result = [];
     foreach ($status->getErrorsByType($type) as $error) {
         if ($error['message'] instanceof Message) {
             $error = ['message' => $error['message']->getKey(), 'params' => $error['message']->getParams()] + $error;
         }
         ApiResult::setIndexedTagName($error['params'], 'param');
         $result[] = $error;
     }
     ApiResult::setIndexedTagName($result, $type);
     return $result;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:16,代码来源:ApiErrorFormatter.php

示例8: testIsGood

 /**
  * @dataProvider provideIsGood
  * @covers Status::isGood
  */
 public function testIsGood($ok, $errors, $expected)
 {
     $status = new Status();
     $status->ok = $ok;
     foreach ($errors as $error) {
         $status->warning($error);
     }
     $this->assertEquals($expected, $status->isGood());
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:13,代码来源:StatusTest.php

示例9: showStatusBox

 /**
  * Output an error or warning box using a Status object.
  *
  * @param Status $status
  */
 public function showStatusBox($status)
 {
     if (!$status->isGood()) {
         $text = $status->getWikiText();
         if ($status->isOk()) {
             $box = $this->getWarningBox($text);
         } else {
             $box = $this->getErrorBox($text);
         }
         $this->output->addHTML($box);
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:17,代码来源:WebInstaller.php

示例10: leaveMessage

 /**
  * Leave a message on the user talk page or in the session according to
  * $params['leaveMessage'].
  *
  * @param Status $status
  */
 protected function leaveMessage($status)
 {
     if ($this->params['leaveMessage']) {
         if ($status->isGood()) {
             // @todo FIXME: user->leaveUserMessage does not exist.
             $this->user->leaveUserMessage(wfMessage('upload-success-subj')->text(), wfMessage('upload-success-msg', $this->upload->getTitle()->getText(), $this->params['url'])->text());
         } else {
             // @todo FIXME: user->leaveUserMessage does not exist.
             $this->user->leaveUserMessage(wfMessage('upload-failure-subj')->text(), wfMessage('upload-failure-msg', $status->getWikiText(), $this->params['url'])->text());
         }
     } else {
         $session = MediaWiki\Session\SessionManager::singleton()->getSessionById($this->params['sessionId']);
         if ($status->isOk()) {
             $this->storeResultInSession($session, 'Success', 'filename', $this->upload->getLocalFile()->getName());
         } else {
             $this->storeResultInSession($session, 'Failure', 'errors', $status->getErrorsArray());
         }
     }
 }
开发者ID:Gomyul,项目名称:mediawiki,代码行数:25,代码来源:UploadFromUrlJob.php

示例11: runPostMergeFilters

 /**
  * Run hooks that can filter edits just before they get saved.
  *
  * @param Content $content The Content to filter.
  * @param Status $status For reporting the outcome to the caller
  * @param User $user The user performing the edit
  *
  * @return bool
  */
 protected function runPostMergeFilters(Content $content, Status $status, User $user)
 {
     // Run old style post-section-merge edit filter
     if (!ContentHandler::runLegacyHooks('EditFilterMerged', array($this, $content, &$this->hookError, $this->summary))) {
         # Error messages etc. could be handled within the hook...
         $status->fatal('hookaborted');
         $status->value = self::AS_HOOK_ERROR;
         return false;
     } elseif ($this->hookError != '') {
         # ...or the hook could be expecting us to produce an error
         $status->fatal('hookaborted');
         $status->value = self::AS_HOOK_ERROR_EXPECTED;
         return false;
     }
     // Run new style post-section-merge edit filter
     if (!Hooks::run('EditFilterMergedContent', array($this->mArticle->getContext(), $content, $status, $this->summary, $user, $this->minoredit))) {
         # Error messages etc. could be handled within the hook...
         if ($status->isGood()) {
             $status->fatal('hookaborted');
             // Not setting $this->hookError here is a hack to allow the hook
             // to cause a return to the edit page without $this->hookError
             // being set. This is used by ConfirmEdit to display a captcha
             // without any error message cruft.
         } else {
             $this->hookError = $status->getWikiText();
         }
         // Use the existing $status->value if the hook set it
         if (!$status->value) {
             $status->value = self::AS_HOOK_ERROR;
         }
         return false;
     } elseif (!$status->isOK()) {
         # ...or the hook could be expecting us to produce an error
         // FIXME this sucks, we should just use the Status object throughout
         $this->hookError = $status->getWikiText();
         $status->fatal('hookaborted');
         $status->value = self::AS_HOOK_ERROR_EXPECTED;
         return false;
     }
     return true;
 }
开发者ID:OrBin,项目名称:mediawiki,代码行数:50,代码来源:EditPage.php

示例12: leaveMessage

 /**
  * Leave a message on the user talk page or in the session according to
  * $params['leaveMessage'].
  *
  * @param Status $status
  */
 protected function leaveMessage($status)
 {
     if ($this->params['leaveMessage']) {
         if ($status->isGood()) {
             // @todo FIXME: user->leaveUserMessage does not exist.
             $this->user->leaveUserMessage(wfMessage('upload-success-subj')->text(), wfMessage('upload-success-msg', $this->upload->getTitle()->getText(), $this->params['url'])->text());
         } else {
             // @todo FIXME: user->leaveUserMessage does not exist.
             $this->user->leaveUserMessage(wfMessage('upload-failure-subj')->text(), wfMessage('upload-failure-msg', $status->getWikiText(), $this->params['url'])->text());
         }
     } else {
         wfSetupSession($this->params['sessionId']);
         if ($status->isOk()) {
             $this->storeResultInSession('Success', 'filename', $this->upload->getLocalFile()->getName());
         } else {
             $this->storeResultInSession('Failure', 'errors', $status->getErrorsArray());
         }
         session_write_close();
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:26,代码来源:UploadFromUrlJob.php

示例13: getErrorFromStatus

 /**
  * Get error (as code, string) from a Status object.
  *
  * @since 1.23
  * @param Status $status
  * @param array|null &$extraData Set if extra data from IApiMessage is available (since 1.27)
  * @return array Array of code and error string
  * @throws MWException
  */
 public function getErrorFromStatus($status, &$extraData = null)
 {
     if ($status->isGood()) {
         throw new MWException('Successful status passed to ApiBase::dieStatus');
     }
     $errors = $status->getErrorsByType('error');
     if (!$errors) {
         // No errors? Assume the warnings should be treated as errors
         $errors = $status->getErrorsByType('warning');
     }
     if (!$errors) {
         // Still no errors? Punt
         $errors = [['message' => 'unknownerror-nocode', 'params' => []]];
     }
     // Cannot use dieUsageMsg() because extensions might return custom
     // error messages.
     if ($errors[0]['message'] instanceof Message) {
         $msg = $errors[0]['message'];
         if ($msg instanceof IApiMessage) {
             $extraData = $msg->getApiData();
             $code = $msg->getApiCode();
         } else {
             $code = $msg->getKey();
         }
     } else {
         $code = $errors[0]['message'];
         $msg = wfMessage($code, $errors[0]['params']);
     }
     if (isset(ApiBase::$messageMap[$code])) {
         // Translate message to code, for backwards compatibility
         $code = ApiBase::$messageMap[$code]['code'];
     }
     return [$code, $msg->inLanguage('en')->useDatabase(false)->plain()];
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:43,代码来源:ApiBase.php

示例14: getErrorsOrWarnings

 /**
  * @param string|array|Status $elements
  * @param string $elementsType
  * @return string
  */
 function getErrorsOrWarnings($elements, $elementsType)
 {
     if (!in_array($elementsType, ['error', 'warning'])) {
         throw new DomainException($elementsType . ' is not a valid type.');
     }
     if (!$elements) {
         $errors = [];
     } elseif ($elements instanceof Status) {
         if ($elements->isGood()) {
             $errors = [];
         } else {
             $errors = $elements->getErrorsByType($elementsType);
             foreach ($errors as &$error) {
                 // Input:  [ 'message' => 'foo', 'errors' => [ 'a', 'b', 'c' ] ]
                 // Output: [ 'foo', 'a', 'b', 'c' ]
                 $error = array_merge([$error['message']], $error['params']);
             }
         }
     } elseif ($elementsType === 'errors') {
         $errors = $elements;
         if (!is_array($errors)) {
             $errors = [$errors];
         }
     } else {
         $errors = [];
     }
     foreach ($errors as &$error) {
         $error = $this->getMessage($error)->parse();
         $error = new OOUI\HtmlSnippet($error);
     }
     // Used in getBody()
     if ($elementsType === 'error') {
         $this->oouiErrors = $errors;
     } else {
         $this->oouiWarnings = $errors;
     }
     return '';
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:43,代码来源:OOUIHTMLForm.php

示例15: assertGoodStatus

 public function assertGoodStatus(\Status $status)
 {
     if (!$status->isGood()) {
         $msg = wfMessage("email-error-bad-status", $status->getMessage())->escaped();
         throw new Fatal($msg);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:EmailController.class.php


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