本文整理汇总了PHP中Status::getWikiText方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::getWikiText方法的具体用法?PHP Status::getWikiText怎么用?PHP Status::getWikiText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::getWikiText方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: failure
/**
* Report that the submit operation failed
* @param Status $status
*/
protected function failure($status)
{
// Messages: revdelete-failure, logdelete-failure
$this->getOutput()->setPageTitle($this->msg('actionfailed'));
$this->getOutput()->addWikiText('<div class="errorbox">' . $status->getWikiText($this->typeLabels['failure']) . '</div>');
$this->showForm();
}
示例2: failure
/**
* Report that the submit operation failed
* @param Status $status
*/
protected function failure($status)
{
$this->getOutput()->setPageTitle($this->msg('actionfailed'));
$this->getOutput()->addWikiText('<div class="errorbox">' . $status->getWikiText('tags-edit-failure') . '</div>');
$this->showForm();
}
示例3: testGetWikiText
/**
* @dataProvider provideGetWikiTextAndHtml
* @covers Status::getWikiText
* @todo test long and short context messages generated through this method
* this can not really be done now due to use of wfMessage()->plain()
* It is possible to mock such methods but only if namespaces are used
*/
public function testGetWikiText(Status $status, $wikitext, $html)
{
$this->assertEquals($wikitext, $status->getWikiText());
}
示例4: 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);
}
}
示例5: getErrors
/**
* Format and display an error message stack.
*
* @param string|array|Status $errors
*
* @return string
*/
function getErrors($errors)
{
if ($errors instanceof Status) {
if ($errors->isOK()) {
$errorstr = '';
} else {
$errorstr = $this->getOutput()->parse($errors->getWikiText());
}
} elseif (is_array($errors)) {
$errorstr = $this->formatErrors($errors);
} else {
$errorstr = $errors;
}
return $errorstr ? Html::rawElement('div', array('class' => 'error'), $errorstr) : '';
}
示例6: 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;
}
示例7: 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 (!wfRunHooks('EditFilterMergedContent', array($this->mArticle->getContext(), $content, $status, $this->summary, $user, $this->minoredit))) {
# Error messages etc. could be handled within the hook...
// XXX: $status->value may already be something informative...
$this->hookError = $status->getWikiText();
$status->fatal('hookaborted');
$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;
}
示例8: 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();
}
}
示例9: handleStatus
/**
* Handle status, such as after attempt save
*
* @param Status $status
* @param array|bool $resultDetails
*
* @throws ErrorPageError
* @return bool False, if output is done, true if rest of the form should be displayed
*/
private function handleStatus(Status $status, $resultDetails)
{
global $wgUser, $wgOut;
/**
* @todo FIXME: once the interface for internalAttemptSave() is made
* nicer, this should use the message in $status
*/
if ($status->value == self::AS_SUCCESS_UPDATE || $status->value == self::AS_SUCCESS_NEW_ARTICLE) {
$this->didSave = true;
if (!$resultDetails['nullEdit']) {
$this->setPostEditCookie($status->value);
}
}
// "wpExtraQueryRedirect" is a hidden input to modify
// after save URL and is not used by actual edit form
$request = RequestContext::getMain()->getRequest();
$extraQueryRedirect = $request->getVal('wpExtraQueryRedirect');
switch ($status->value) {
case self::AS_HOOK_ERROR_EXPECTED:
case self::AS_CONTENT_TOO_BIG:
case self::AS_ARTICLE_WAS_DELETED:
case self::AS_CONFLICT_DETECTED:
case self::AS_SUMMARY_NEEDED:
case self::AS_TEXTBOX_EMPTY:
case self::AS_MAX_ARTICLE_SIZE_EXCEEDED:
case self::AS_END:
case self::AS_BLANK_ARTICLE:
case self::AS_SELF_REDIRECT:
return true;
case self::AS_HOOK_ERROR:
return false;
case self::AS_CANNOT_USE_CUSTOM_MODEL:
case self::AS_PARSE_ERROR:
$wgOut->addWikiText('<div class="error">' . "\n" . $status->getWikiText() . '</div>');
return true;
case self::AS_SUCCESS_NEW_ARTICLE:
$query = $resultDetails['redirect'] ? 'redirect=no' : '';
if ($extraQueryRedirect) {
if ($query === '') {
$query = $extraQueryRedirect;
} else {
$query = $query . '&' . $extraQueryRedirect;
}
}
$anchor = isset($resultDetails['sectionanchor']) ? $resultDetails['sectionanchor'] : '';
$wgOut->redirect($this->mTitle->getFullURL($query) . $anchor);
return false;
case self::AS_SUCCESS_UPDATE:
$extraQuery = '';
$sectionanchor = $resultDetails['sectionanchor'];
// Give extensions a chance to modify URL query on update
Hooks::run('ArticleUpdateBeforeRedirect', [$this->mArticle, &$sectionanchor, &$extraQuery]);
if ($resultDetails['redirect']) {
if ($extraQuery == '') {
$extraQuery = 'redirect=no';
} else {
$extraQuery = 'redirect=no&' . $extraQuery;
}
}
if ($extraQueryRedirect) {
if ($extraQuery === '') {
$extraQuery = $extraQueryRedirect;
} else {
$extraQuery = $extraQuery . '&' . $extraQueryRedirect;
}
}
$wgOut->redirect($this->mTitle->getFullURL($extraQuery) . $sectionanchor);
return false;
case self::AS_SPAM_ERROR:
$this->spamPageWithContent($resultDetails['spam']);
return false;
case self::AS_BLOCKED_PAGE_FOR_USER:
throw new UserBlockedError($wgUser->getBlock());
case self::AS_IMAGE_REDIRECT_ANON:
case self::AS_IMAGE_REDIRECT_LOGGED:
throw new PermissionsError('upload');
case self::AS_READ_ONLY_PAGE_ANON:
case self::AS_READ_ONLY_PAGE_LOGGED:
throw new PermissionsError('edit');
case self::AS_READ_ONLY_PAGE:
throw new ReadOnlyError();
case self::AS_RATE_LIMITED:
throw new ThrottledError();
case self::AS_NO_CREATE_PERMISSION:
$permission = $this->mTitle->isTalkPage() ? 'createtalk' : 'createpage';
throw new PermissionsError($permission);
case self::AS_NO_CHANGE_CONTENT_MODEL:
throw new PermissionsError('editcontentmodel');
default:
// We don't recognize $status->value. The only way that can happen
// is if an extension hook aborted from inside ArticleSave.
//.........这里部分代码省略.........
示例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());
}
}
}
示例11: testGetWikiText
/**
* @dataProvider provideGetWikiTextAndHtml
* @covers Status::getWikiText
*/
public function testGetWikiText(Status $status, $wikitext, $wrappedWikitext, $html, $wrappedHtml)
{
$this->assertEquals($wikitext, $status->getWikiText());
$this->assertEquals($wrappedWikitext, $status->getWikiText('wrap-short', 'wrap-long', 'qqx'));
}
示例12: showStatusMessage
/**
* @param $status Status
*/
public function showStatusMessage(Status $status)
{
$text = $status->getWikiText();
$this->output->addWikiText("<div class=\"config-message\">\n" . $text . "</div>");
}