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


PHP EditPage::initialiseForm方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:42,代码来源:SpecialCreatePage.class.php

示例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;
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:37,代码来源:SpecialCreatePage.class.php


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