本文整理汇总了PHP中EditPage::initialiseForm方法的典型用法代码示例。如果您正苦于以下问题:PHP EditPage::initialiseForm方法的具体用法?PHP EditPage::initialiseForm怎么用?PHP EditPage::initialiseForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EditPage
的用法示例。
在下文中一共展示了EditPage::initialiseForm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
protected function save()
{
global $wgOut, $wgUser, $wgContLang, $wgRequest;
// CategorySelect compatibility (add categories to article body)
if ($this->mCategorySelectEnabled) {
CategorySelectHooksHelper::onEditPageImportFormData($this->mEditPage, $wgRequest);
}
$sPostBody = $this->mEditPage->textbox1;
$editPage = new EditPage($this->mPostArticle);
$editPage->initialiseForm();
$editPage->textbox1 = $sPostBody;
$editPage->summary = isset($this->mFormData['postEditSummary']) ? $this->mFormData['postEditSummary'] : '';
$editPage->recreate = true;
$result = false;
$status = $editPage->internalAttemptSave($result);
switch ($status->value) {
case EditPage::AS_SUCCESS_UPDATE:
case EditPage::AS_SUCCESS_NEW_ARTICLE:
case EditPage::AS_ARTICLE_WAS_DELETED:
$wgOut->redirect($this->mPostArticle->getTitle()->getFullUrl());
break;
default:
/**
* PLATFORM-1160: Log the entire $status to ELK
*
* Recommendation: use $status->value for comparisons and messages rather than $status in the following block.
*/
Wikia\Logger\WikiaLogger::instance()->warning('PLATFORM-1160', ['method' => __METHOD__, 'status_object' => $status]);
if ($status->value == EditPage::AS_READ_ONLY_PAGE_LOGGED || $status->value == EditPage::AS_READ_ONLY_PAGE_ANON) {
$sMsg = wfMsg('createpage_cant_edit');
} else {
$sMsg = wfMsg('createpage_spam');
}
$this->mFormErrors[] = $sMsg . " ({$status->value})";
global $wgCreatePageCaptchaTriggered;
// do not display form - there is already one invoked from Captcha [RT#21902] - Marooned
if (empty($wgCreatePageCaptchaTriggered)) {
$this->renderForm();
}
break;
}
}
示例2: save
protected function save()
{
global $wgOut, $wgUser, $wgContLang, $wgRequest;
// CategorySelect compatibility (add categories to article body)
if ($this->mCategorySelectEnabled) {
CategorySelectImportFormData($this->mEditPage, $wgRequest);
}
$sPostBody = $this->mEditPage->textbox1;
$editPage = new EditPage($this->mPostArticle);
$editPage->initialiseForm();
$editPage->textbox1 = $sPostBody;
$editPage->summary = isset($this->mFormData['postEditSummary']) ? $this->mFormData['postEditSummary'] : '';
$editPage->recreate = true;
$result = false;
$status = $editPage->internalAttemptSave($result);
switch ($status->value) {
case EditPage::AS_SUCCESS_UPDATE:
case EditPage::AS_SUCCESS_NEW_ARTICLE:
case EditPage::AS_ARTICLE_WAS_DELETED:
$wgOut->redirect($this->mPostArticle->getTitle()->getFullUrl());
break;
default:
Wikia::log(__METHOD__, "createpage", $status);
if ($status == EditPage::AS_READ_ONLY_PAGE_LOGGED || $status == EditPage::AS_READ_ONLY_PAGE_ANON) {
$sMsg = wfMsg('createpage_cant_edit');
} else {
$sMsg = wfMsg('createpage_spam');
}
$this->mFormErrors[] = $sMsg . " ({$status})";
global $wgCreatePageCaptchaTriggered;
// do not display form - there is already one invoked from Captcha [RT#21902] - Marooned
if (empty($wgCreatePageCaptchaTriggered)) {
$this->renderForm();
}
break;
}
}