function axMultiEditParse() { global $wgRequest; $me = ''; $template = $wgRequest->getVal('template'); $title = Title::newFromText("Createplate-{$template}", NS_MEDIAWIKI); // transfer optional sections data $optionalSections = array(); foreach ($_POST as $key => $value) { if (strpos($key, 'wpOptionalInput') !== false) { $optionalSections = str_replace('wpOptionalInput', '', $key); } } if ($title->exists()) { $rev = Revision::newFromTitle($title); $me = CreateMultiPage::multiEditParse(10, 10, '?', $rev->getText(), $optionalSections); } else { $me = CreateMultiPage::multiEditParse(10, 10, '?', '<!---blanktemplate--->'); } return json_encode($me); }
function generateForm($content = false) { global $wgOut, $wgUser, $wgRequest; $optional_sections = array(); foreach ($_POST as $key => $value) { if (strpos($key, 'wpOptionalInput') !== false) { $optional_sections[] = str_replace('wpOptionalInput', '', $key); } } if (!$content) { $title = Title::newFromText('Createplate-' . $this->mTemplate, NS_MEDIAWIKI); if ($title->exists()) { $rev = Revision::newFromTitle($title); $me = CreateMultiPage::multiEditParse(10, 10, '?', $rev->getText(), $optional_sections); } else { $me = CreateMultiPage::multiEditParse(10, 10, '?', '<!---blanktemplate--->'); } } else { $me = CreateMultiPage::multiEditParse(10, 10, '?', $content, $optional_sections); } $wgOut->addHTML(' <div id="cp-restricted"> <div id="createpageoverlay"> <div class="hd"></div> <div class="bd"></div> <div class="ft"></div> </div> '); $wgOut->addHTML("<div id=\"cp-multiedit\">{$me}</div>"); // check for already submitted values - for a preview, for example $summaryval = ''; if ($wgRequest->getVal('wpSummary') != '') { $summaryval = $wgRequest->getVal('wpSummary'); } if ($this->mInitial) { if ($wgUser->getOption('watchcreations')) { $watchthischeck = 'checked="checked"'; } else { $watchthischeck = ''; } if ($wgUser->getOption('minordefault')) { $minoreditcheck = 'checked="checked"'; } else { $minoreditcheck = ''; } } else { $watchthischeck = ''; $minoreditcheck = ''; if ($wgRequest->getCheck('wpWatchthis')) { $watchthischeck = 'checked="checked"'; } if ($wgRequest->getCheck('wpMinoredit')) { $minoreditcheck = 'checked="checked"'; } } global $wgRightsText; $copywarn = "<div id=\"editpage-copywarn\">\n" . wfMsg($wgRightsText ? 'copyrightwarning' : 'copyrightwarning2', '[[' . wfMsgForContent('copyrightpage') . ']]', $wgRightsText) . "\n</div>"; $wgOut->addWikiText($copywarn); $editsummary = '<span id="wpSummaryLabel"><label for="wpSummary">' . wfMsg('summary') . "</label></span>\n<input type='text' value=\"" . $summaryval . '" name="wpSummary" id="wpSummary" maxlength="200" size="60" /><br />'; $checkboxhtml = '<input id="wpMinoredit" type="checkbox" accesskey="i" value="1" name="wpMinoredit" ' . $minoreditcheck . '/>' . "\n" . '<label accesskey="i" title="' . wfMsg('tooltip-minoredit') . ' [alt-shift-i]" for="wpMinoredit">' . wfMsg('minoredit') . '</label>'; $checkboxhtml .= '<input id="wpWatchthis" type="checkbox" accesskey="w" value="1" name="wpWatchthis" ' . $watchthischeck . '/>' . "\n" . '<label accesskey="w" title="' . wfMsg('tooltip-watch') . ' [alt-shift-w]" for="wpWatchthis">' . wfMsg('watchthis') . '</label>'; $wgOut->addHTML('<div id="createpagebottom">' . $editsummary . $checkboxhtml . '</div>'); $wgOut->addHTML(' <div class="actionBar buttonBar"> <input type="submit" id="wpSave" name="wpSave" value="' . wfMsg('createpage-save') . '" class="button color1" /> <input type="submit" id="wpPreview" name="wpPreview" value="' . wfMsg('preview') . '" class="button color1" /> <input type="submit" id="wpCancel" name="wpCancel" value="' . wfMsg('cancel') . '" class="button color1" /> </div>'); // stuff for red links - bottom edittools, to be more precise if ($this->mRedLinked && $this->mTemplate == 'Blank') { $wgOut->addHTML('<div id="createpage_editTools" class="mw-editTools">'); $wgOut->addWikiText(wfMsgForContent('edittools')); $wgOut->addHTML('</div>'); } $wgOut->addHTML('</form></div>'); }