Пример #1
0
 protected function renderForm()
 {
     global $wgRequest;
     $preload = $wgRequest->getVal('preload', '');
     if (!empty($preload)) {
         $this->mEditPage->textbox1 = $this->getPreloadedText($preload);
     }
     $editintro = $wgRequest->getVal('editintro', '');
     if (!empty($editintro)) {
         $this->mEditIntro = $this->getPreloadedText($editintro);
     }
     // CategorySelect compatibility (restore categories from article body)
     if ($this->mCategorySelectEnabled) {
         CategorySelectReplaceContent($this->mEditPage, $this->mEditPage->textbox1);
     }
     $this->mEditPage->showEditForm(array($this, 'renderFormHeader'));
     return true;
 }
Пример #2
0
 private function parseArticle($sTitle)
 {
     global $wgParser, $wgContLang;
     $oTitle = Title::newFromText($sTitle, NS_BLOG_ARTICLE);
     $oArticle = new Article($oTitle, 0);
     // macbre: RT #37120
     $sArticleBody = $oTitle->exists() ? $oArticle->getContent() : '';
     $aPageProps = BlogArticle::getProps($oArticle->getId());
     $aTitleParts = explode('/', $oTitle->getText(), 2);
     $this->mFormData['postId'] = $oArticle->getId();
     $this->mFormData['postTitle'] = $aTitleParts[1];
     $this->mFormData['postBody'] = trim(preg_replace('/\\[\\[' . $wgContLang->getFormattedNsText(NS_CATEGORY) . ':(.*)\\]\\]/siU', '', $sArticleBody));
     $this->mFormData['postBody'] = $sArticleBody;
     $this->mFormData['isVotingEnabled'] = isset($aPageProps['voting']) ? $aPageProps['voting'] : 0;
     $this->mFormData['isCommentingEnabled'] = isset($aPageProps['commenting']) ? $aPageProps['commenting'] : 0;
     $this->mFormData['isExistingArticleEditAllowed'] = 1;
     //create EditPage object
     $this->createEditPage($this->mFormData['postBody']);
     // CategorySelect compatibility (restore categories from article body)
     if ($this->mCategorySelectEnabled) {
         CategorySelectReplaceContent($this->mEditPage, $this->mEditPage->textbox1);
     }
     return $oArticle;
 }