本文整理汇总了PHP中DifferenceEngine::showDiff方法的典型用法代码示例。如果您正苦于以下问题:PHP DifferenceEngine::showDiff方法的具体用法?PHP DifferenceEngine::showDiff怎么用?PHP DifferenceEngine::showDiff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DifferenceEngine
的用法示例。
在下文中一共展示了DifferenceEngine::showDiff方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editForm
//.........这里部分代码省略.........
if (count($articleTemplates) > 0) {
$templates = '<br />' . wfMsg('templatesused') . '<ul>';
foreach ($articleTemplates as $tpl) {
if ($titleObj = Title::makeTitle(NS_TEMPLATE, $tpl)) {
$templates .= '<li>' . $sk->makeLinkObj($titleObj) . '</li>';
}
}
$templates .= '</ul>';
}
global $wgLivePreview, $wgStylePath;
/**
* Live Preview lets us fetch rendered preview page content and
* add it to the page without refreshing the whole page.
* Set up the button for it; if not supported by the browser
* it will fall through to the normal form submission method.
*/
if ($wgLivePreview) {
global $wgJsMimeType;
$wgOut->addHTML('<script type="' . $wgJsMimeType . '" src="' . htmlspecialchars($wgStylePath . '/common/preview.js') . '"></script>' . "\n");
$liveAction = $wgTitle->getLocalUrl('action=submit&wpPreview=true&live=true');
$liveOnclick = 'onclick="return !livePreview(' . 'getElementById(\'wikiPreview\'),' . 'editform.wpTextbox1.value,' . htmlspecialchars('"' . $liveAction . '"') . ')"';
} else {
$liveOnclick = '';
}
global $wgUseMetadataEdit;
if ($wgUseMetadataEdit) {
$metadata = $this->mMetaData;
$metadata = htmlspecialchars($wgContLang->recodeForEdit($metadata));
$helppage = Title::newFromText(wfmsg("metadata_page"));
$top = str_replace("\$1", $helppage->getInternalURL(), wfmsg("metadata"));
$metadata = $top . "<textarea name='metadata' rows='3' cols='{$cols}'{$ew}>{$metadata}</textarea>";
} else {
$metadata = "";
}
$safemodehtml = $this->checkUnicodeCompliantBrowser() ? "" : "<input type='hidden' name=\"safemode\" value='1' />\n";
# Patch for FCKeditor
global $wgUseEditor, $wgEditorDir, $wgEditorToken, $wgScriptPath, $wgEditorToolbarSet, $wgEditorHeight;
$tbox = $wgContLang->recodeForEdit($this->textbox1);
if ($wgUseEditor || isset($wgEditorToken) && eregi($wgEditorToken, $tbox, $eregi_result)) {
$wgUseEditor = true;
$wgOut->addHTML("\n{$toolbar}\n<form id=\"editform\" name=\"editform\" method=\"post\" action=\"{$action}\"\nenctype=\"multipart/form-data\">\n{$commentsubject}");
require_once "{$wgEditorDir}/fckeditor.php";
$oFCKeditor = new FCKeditor('wpTextbox1');
$oFCKeditor->BasePath = $wgScriptPath . "/" . $wgEditorDir . "/";
$oFCKeditor->Value = $tbox;
$oFCKeditor->ToolbarSet = $wgEditorToolbarSet;
$oFCKeditor->Height = $wgEditorHeight;
$oFCKeditor->Width = '100%';
$wgOut->addHTML($oFCKeditor->CreateHtml());
/*
<textarea tabindex='1' accesskey="," name="wpTextbox1" rows='{$rows}'
cols='{$cols}'{$ew}>
END
. htmlspecialchars( $wgContLang->recodeForEdit( $this->textbox1 ) ) .
"
</textarea>
*/
$wgOut->addHTML("\n{$metadata}\n<br />{$editsummary}\n{$checkboxhtml}\n{$safemodehtml}\n<input tabindex='5' id='wpSave' type='submit' value=\"{$save}\" name=\"wpSave\" accesskey=\"" . wfMsg('accesskey-save') . "\"" . " title=\"" . wfMsg('tooltip-save') . "\"/>\n<input tabindex='6' id='wpPreview' type='submit' {$liveOnclick} value=\"{$prev}\" name=\"wpPreview\" accesskey=\"" . wfMsg('accesskey-preview') . "\"" . " title=\"" . wfMsg('tooltip-preview') . "\"/>\n<input tabindex='7' id='wpDiff' type='submit' value=\"{$diff}\" name=\"wpDiff\" accesskey=\"" . wfMsg('accesskey-diff') . "\"" . " title=\"" . wfMsg('tooltip-diff') . "\"/>\n<em>{$cancel}</em> | <em>{$edithelp}</em>{$templates}");
} else {
# end patch
$wgOut->addHTML(<<<END
{$toolbar}
<form id="editform" name="editform" method="post" action="{$action}"
enctype="multipart/form-data">
{$commentsubject}
<textarea tabindex='1' accesskey="," name="wpTextbox1" rows='{$rows}'
cols='{$cols}'{$ew}>
END
. htmlspecialchars($this->safeUnicodeOutput($this->textbox1)) . "\n</textarea>\n{$metadata}\n<br />{$editsummary}\n{$checkboxhtml}\n{$safemodehtml}\n<input tabindex='5' id='wpSave' type='submit' value=\"{$save}\" name=\"wpSave\" accesskey=\"" . wfMsg('accesskey-save') . "\"" . " title=\"" . wfMsg('tooltip-save') . "\"/>\n<input tabindex='6' id='wpPreview' type='submit' {$liveOnclick} value=\"{$prev}\" name=\"wpPreview\" accesskey=\"" . wfMsg('accesskey-preview') . "\"" . " title=\"" . wfMsg('tooltip-preview') . "\"/>\n<input tabindex='7' id='wpDiff' type='submit' value=\"{$diff}\" name=\"wpDiff\" accesskey=\"" . wfMsg('accesskey-diff') . "\"" . " title=\"" . wfMsg('tooltip-diff') . "\"/>\n<em>{$cancel}</em> | <em>{$edithelp}</em>{$templates}");
}
$wgOut->addWikiText($copywarn);
$wgOut->addHTML("\n<input type='hidden' value=\"" . htmlspecialchars($this->section) . "\" name=\"wpSection\" />\n<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n");
if ($wgUser->isLoggedIn()) {
/**
* To make it harder for someone to slip a user a page
* which submits an edit form to the wiki without their
* knowledge, a random token is associated with the login
* session. If it's not passed back with the submission,
* we won't save the page, or render user JavaScript and
* CSS previews.
*/
$token = htmlspecialchars($wgUser->editToken());
$wgOut->addHTML("\n<input type='hidden' value=\"{$token}\" name=\"wpEditToken\" />\n");
}
if ($isConflict) {
require_once "DifferenceEngine.php";
$wgOut->addWikiText('==' . wfMsg("yourdiff") . '==');
DifferenceEngine::showDiff($this->textbox2, $this->textbox1, wfMsg("yourtext"), wfMsg("storedversion"));
$wgOut->addWikiText('==' . wfMsg("yourtext") . '==');
$wgOut->addHTML("<textarea tabindex=6 id='wpTextbox2' name=\"wpTextbox2\" rows='{$rows}' cols='{$cols}' wrap='virtual'>" . htmlspecialchars($this->safeUnicodeOutput($this->textbox2)) . "\n</textarea>");
}
$wgOut->addHTML("</form>\n");
if ($formtype == 'preview' && !$wgUser->getOption('previewontop')) {
$wgOut->addHTML('<div id="wikiPreview">' . $previewOutput . '</div>');
}
if ($formtype == 'diff' && !$wgUser->getOption('previewontop')) {
#$wgOut->addHTML( '<div id="wikiPreview">' . $difftext . '</div>' );
$wgOut->addHTML($this->getDiff());
}
}
示例2: showEditForm
//.........这里部分代码省略.........
} else {
// Hide the toolbar and edit area, user can click preview to get it back
// Add an confirmation checkbox and explanation.
$toolbar = '';
$recreate = '<div class="mw-confirm-recreate">' . $wgOut->parse(wfMsg('confirmrecreate', $this->lastDelete->user_name, $this->lastDelete->log_comment)) . Xml::checkLabel(wfMsg('recreate'), 'wpRecreate', 'wpRecreate', false, array('title' => $sk->titleAttrib('recreate'), 'tabindex' => 1, 'id' => 'wpRecreate')) . '</div>';
}
}
$tabindex = 2;
$checkboxes = $this->getCheckboxes($tabindex, $sk, array('minor' => $this->minoredit, 'watch' => $this->watchthis, 'want_traditional_editor' => $this->userWantsTraditionalEditor));
$checkboxhtml = implode($checkboxes, "\n");
$buttons = $this->getEditButtons($tabindex);
$buttonshtml = implode($buttons, "\n");
$safemodehtml = $this->checkUnicodeCompliantBrowser() ? '' : Xml::hidden('safemode', '1');
$wgOut->addHTML(<<<END
{$toolbar}
<form id="editform" name="editform" method="post" action="{$action}" enctype="multipart/form-data">
END
);
if (is_callable($formCallback)) {
call_user_func_array($formCallback, array(&$wgOut));
}
wfRunHooks('EditPage::showEditForm:fields', array(&$this, &$wgOut));
// Put these up at the top to ensure they aren't lost on early form submission
$this->showFormBeforeText();
$wgOut->addHTML(<<<END
{$recreate}
{$commentsubject}
{$subjectpreview}
{$this->editFormTextBeforeContent}
END
);
if ($this->isConflict || $this->diff) {
# MeanEditor: should be redundant, but let's be sure
$this->noVisualEditor = true;
}
# MeanEditor: also apply htmlspecialchars? See $encodedtext
$html_text = $this->safeUnicodeOutput($this->textbox1);
if (!($this->noVisualEditor || $this->userWantsTraditionalEditor)) {
$this->noVisualEditor = wfRunHooks('EditPage::wiki2html', array($this->mArticle, $wgUser, &$this, &$html_text));
}
if (!$this->noVisualEditor && !$this->userWantsTraditionalEditor) {
$this->noVisualEditor = wfRunHooks('EditPage::showBox', array(&$this, $html_text, $rows, $cols, $ew));
}
if (!$this->noVisualEditor && !$this->userWantsTraditionalEditor) {
$wgOut->addHTML("<input type='hidden' value=\"0\" name=\"wpNoVisualEditor\" />\n");
} else {
$wgOut->addHTML("<input type='hidden' value=\"1\" name=\"wpNoVisualEditor\" />\n");
$this->showTextbox1($classes);
}
$wgOut->wrapWikiMsg("<div id=\"editpage-copywarn\">\n\$1\n</div>", $copywarnMsg);
$wgOut->addHTML(<<<END
{$this->editFormTextAfterWarn}
{$metadata}
{$editsummary}
{$summarypreview}
{$checkboxhtml}
{$safemodehtml}
END
);
$wgOut->addHTML("<div class='editButtons'>\n{$buttonshtml}\n\t<span class='editHelp'>{$cancel}{$separator}{$edithelp}</span>\n</div><!-- editButtons -->\n</div><!-- editOptions -->");
/**
* To make it harder for someone to slip a user a page
* which submits an edit form to the wiki without their
* knowledge, a random token is associated with the login
* session. If it's not passed back with the submission,
* we won't save the page, or render user JavaScript and
* CSS previews.
*
* For anon editors, who may not have a session, we just
* include the constant suffix to prevent editing from
* broken text-mangling proxies.
*/
$token = htmlspecialchars($wgUser->editToken());
$wgOut->addHTML("\n<input type='hidden' value=\"{$token}\" name=\"wpEditToken\" />\n");
$this->showEditTools();
$wgOut->addHTML(<<<END
{$this->editFormTextAfterTools}
<div class='templatesUsed'>
{$formattedtemplates}
</div>
<div class='hiddencats'>
{$formattedhiddencats}
</div>
END
);
if ($this->isConflict && wfRunHooks('EditPageBeforeConflictDiff', array(&$this, &$wgOut))) {
$wgOut->wrapWikiMsg('==$1==', "yourdiff");
$de = new DifferenceEngine($this->mTitle);
$de->setText($this->textbox2, $this->textbox1);
$de->showDiff(wfMsg("yourtext"), wfMsg("storedversion"));
$wgOut->wrapWikiMsg('==$1==', "yourtext");
$this->showTextbox2();
}
$wgOut->addHTML($this->editFormTextBottom);
$wgOut->addHTML("</form>\n");
if (!$wgUser->getOption('previewontop')) {
$this->displayPreviewArea($previewOutput, false);
}
wfProfileOut($fname);
}
示例3: onView
public function onView()
{
$details = null;
$request = $this->getRequest();
$result = $this->page->doRollback($request->getVal('from'), $request->getText('summary'), $request->getVal('token'), $request->getBool('bot'), $details, $this->getUser());
if (in_array(array('actionthrottledtext'), $result)) {
throw new ThrottledError();
}
if (isset($result[0][0]) && ($result[0][0] == 'alreadyrolled' || $result[0][0] == 'cantrollback')) {
$this->getOutput()->setPageTitle($this->msg('rollbackfailed'));
$errArray = $result[0];
$errMsg = array_shift($errArray);
$this->getOutput()->addWikiMsgArray($errMsg, $errArray);
if (isset($details['current'])) {
$current = $details['current'];
if ($current->getComment() != '') {
$this->getOutput()->addHTML($this->msg('editcomment')->rawParams(Linker::formatComment($current->getComment()))->parse());
}
}
return;
}
# Display permissions errors before read-only message -- there's no
# point in misleading the user into thinking the inability to rollback
# is only temporary.
if (!empty($result) && $result !== array(array('readonlytext'))) {
# array_diff is completely broken for arrays of arrays, sigh.
# Remove any 'readonlytext' error manually.
$out = array();
foreach ($result as $error) {
if ($error != array('readonlytext')) {
$out[] = $error;
}
}
throw new PermissionsError('rollback', $out);
}
if ($result == array(array('readonlytext'))) {
throw new ReadOnlyError();
}
$current = $details['current'];
$target = $details['target'];
$newId = $details['newid'];
$this->getOutput()->setPageTitle($this->msg('actioncomplete'));
$this->getOutput()->setRobotPolicy('noindex,nofollow');
if ($current->getUserText() === '') {
$old = $this->msg('rev-deleted-user')->escaped();
} else {
$old = Linker::userLink($current->getUser(), $current->getUserText()) . Linker::userToolLinks($current->getUser(), $current->getUserText());
}
$new = Linker::userLink($target->getUser(), $target->getUserText()) . Linker::userToolLinks($target->getUser(), $target->getUserText());
$this->getOutput()->addHTML($this->msg('rollback-success')->rawParams($old, $new)->parseAsBlock());
$this->getOutput()->returnToMain(false, $this->getTitle());
if (!$request->getBool('hidediff', false) && !$this->getUser()->getBoolOption('norollbackdiff', false)) {
$de = new DifferenceEngine($this->getContext(), $current->getId(), $newId, false, true);
$de->showDiff('', '');
}
}
示例4: spamPageWithContent
/**
* Show "your edit contains spam" page with your diff and text
*
* @param $match Text which triggered one or more filters
*/
public function spamPageWithContent($match = false)
{
global $wgOut;
$this->textbox2 = $this->textbox1;
$wgOut->prepareErrorPage(wfMessage('spamprotectiontitle'));
$wgOut->addHTML('<div id="spamprotected">');
$wgOut->addWikiMsg('spamprotectiontext');
if ($match) {
$wgOut->addWikiMsg('spamprotectionmatch', wfEscapeWikiText($match));
}
$wgOut->addHTML('</div>');
$wgOut->wrapWikiMsg('<h2>$1</h2>', "yourdiff");
$de = new DifferenceEngine($this->mArticle->getContext());
$de->setText($this->getCurrentText(), $this->textbox2);
$de->showDiff(wfMsg("storedversion"), wfMsgExt('yourtext', 'parseinline'));
$wgOut->wrapWikiMsg('<h2>$1</h2>', "yourtext");
$this->showTextbox2();
$wgOut->addReturnTo($this->getContextTitle(), array('action' => 'edit'));
}
示例5: rollback
/**
* User interface for rollback operations
*/
public function rollback()
{
global $wgUser, $wgOut, $wgRequest;
$details = null;
$result = $this->doRollback($wgRequest->getVal('from'), $wgRequest->getText('summary'), $wgRequest->getVal('token'), $wgRequest->getBool('bot'), $details);
if (in_array(array('actionthrottledtext'), $result)) {
$wgOut->rateLimited();
return;
}
if (isset($result[0][0]) && ($result[0][0] == 'alreadyrolled' || $result[0][0] == 'cantrollback')) {
$wgOut->setPageTitle(wfMsg('rollbackfailed'));
$errArray = $result[0];
$errMsg = array_shift($errArray);
$wgOut->addWikiMsgArray($errMsg, $errArray);
if (isset($details['current'])) {
$current = $details['current'];
if ($current->getComment() != '') {
$wgOut->addWikiMsgArray('editcomment', array($wgUser->getSkin()->formatComment($current->getComment())), array('replaceafter'));
}
}
return;
}
# Display permissions errors before read-only message -- there's no
# point in misleading the user into thinking the inability to rollback
# is only temporary.
if (!empty($result) && $result !== array(array('readonlytext'))) {
# array_diff is completely broken for arrays of arrays, sigh.
# Remove any 'readonlytext' error manually.
$out = array();
foreach ($result as $error) {
if ($error != array('readonlytext')) {
$out[] = $error;
}
}
$wgOut->showPermissionsErrorPage($out);
return;
}
if ($result == array(array('readonlytext'))) {
$wgOut->readOnlyPage();
return;
}
$current = $details['current'];
$target = $details['target'];
$newId = $details['newid'];
$wgOut->setPageTitle(wfMsg('actioncomplete'));
$wgOut->setRobotPolicy('noindex,nofollow');
if ($current->getUserText() === '') {
$old = wfMsg('rev-deleted-user');
} else {
$old = $wgUser->getSkin()->userLink($current->getUser(), $current->getUserText()) . $wgUser->getSkin()->userToolLinks($current->getUser(), $current->getUserText());
}
$new = $wgUser->getSkin()->userLink($target->getUser(), $target->getUserText()) . $wgUser->getSkin()->userToolLinks($target->getUser(), $target->getUserText());
$wgOut->addHTML(wfMsgExt('rollback-success', array('parse', 'replaceafter'), $old, $new));
$wgOut->returnToMain(false, $this->mTitle);
if (!$wgRequest->getBool('hidediff', false) && !$wgUser->getBoolOption('norollbackdiff', false)) {
$de = new DifferenceEngine($this->mTitle, $current->getId(), $newId, false, true);
$de->showDiff('', '');
}
}
示例6: showDiff
/**
* Output a trimmed down diff view corresponding to a particular change
*
* @param $edit Recent change to produce a diff. for
*/
private function showDiff( &$edit ) {
$diff = new DifferenceEngine( $edit->getTitle(), $edit->mAttribs['rc_last_oldid'], $edit->mAttribs['rc_this_oldid'] );
$diff->showDiff( '', '' );
}
示例7: showEditForm
//.........这里部分代码省略.........
$metadata = $top . "<textarea name='metadata' rows='3' cols='{$cols}'{$ew}>{$metadata}</textarea>";
} else {
$metadata = "";
}
$hidden = '';
$recreate = '';
if ($this->deletedSinceEdit) {
if ('save' != $this->formtype) {
$wgOut->addWikiText(wfMsg('deletedwhileediting'));
} else {
// Hide the toolbar and edit area, use can click preview to get it back
// Add an confirmation checkbox and explanation.
$toolbar = '';
$hidden = 'type="hidden" style="display:none;"';
$recreate = $wgOut->parse(wfMsg('confirmrecreate', $this->lastDelete->user_name, $this->lastDelete->log_comment));
$recreate .= "<br /><input tabindex='1' type='checkbox' value='1' name='wpRecreate' id='wpRecreate' />" . "<label for='wpRecreate' title='" . wfMsg('tooltip-recreate') . "'>" . wfMsg('recreate') . "</label>";
}
}
$temp = array('id' => 'wpSave', 'name' => 'wpSave', 'type' => 'submit', 'tabindex' => '5', 'value' => wfMsg('savearticle'), 'accesskey' => wfMsg('accesskey-save'), 'title' => wfMsg('tooltip-save'));
$buttons['save'] = wfElement('input', $temp, '');
$temp = array('id' => 'wpDiff', 'name' => 'wpDiff', 'type' => 'submit', 'tabindex' => '7', 'value' => wfMsg('showdiff'), 'accesskey' => wfMsg('accesskey-diff'), 'title' => wfMsg('tooltip-diff'));
$buttons['diff'] = wfElement('input', $temp, '');
global $wgLivePreview;
if ($wgLivePreview && $wgUser->getOption('uselivepreview')) {
$temp = array('id' => 'wpPreview', 'name' => 'wpPreview', 'type' => 'submit', 'tabindex' => '6', 'value' => wfMsg('showpreview'), 'accesskey' => '', 'title' => wfMsg('tooltip-preview'), 'style' => 'display: none;');
$buttons['preview'] = wfElement('input', $temp, '');
$temp = array('id' => 'wpLivePreview', 'name' => 'wpLivePreview', 'type' => 'submit', 'tabindex' => '6', 'value' => wfMsg('showlivepreview'), 'accesskey' => wfMsg('accesskey-preview'), 'title' => '', 'onclick' => $this->doLivePreviewScript());
$buttons['live'] = wfElement('input', $temp, '');
} else {
$temp = array('id' => 'wpPreview', 'name' => 'wpPreview', 'type' => 'submit', 'tabindex' => '6', 'value' => wfMsg('showpreview'), 'accesskey' => wfMsg('accesskey-preview'), 'title' => wfMsg('tooltip-preview'));
$buttons['preview'] = wfElement('input', $temp, '');
$buttons['live'] = '';
}
$safemodehtml = $this->checkUnicodeCompliantBrowser() ? "" : "<input type='hidden' name=\"safemode\" value='1' />\n";
$wgOut->addHTML(<<<END
{$toolbar}
<form id="editform" name="editform" method="post" action="{$action}" enctype="multipart/form-data">
END
);
if (is_callable($formCallback)) {
call_user_func_array($formCallback, array(&$wgOut));
}
// Put these up at the top to ensure they aren't lost on early form submission
$wgOut->addHTML("\n<input type='hidden' value=\"" . htmlspecialchars($this->section) . "\" name=\"wpSection\" />\n<input type='hidden' value=\"{$this->starttime}\" name=\"wpStarttime\" />\n\n<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n\n<input type='hidden' value=\"{$this->scrolltop}\" name=\"wpScrolltop\" id=\"wpScrolltop\" />\n");
$wgOut->addHTML(<<<END
{$recreate}
{$commentsubject}
<textarea tabindex='1' accesskey="," name="wpTextbox1" id="wpTextbox1" rows='{$rows}'
cols='{$cols}'{$ew} {$hidden}>
END
. htmlspecialchars($this->safeUnicodeOutput($this->textbox1)) . "\n</textarea>\n\t\t");
$wgOut->addWikiText($copywarn);
$wgOut->addHTML("\n{$metadata}\n{$editsummary}\n{$checkboxhtml}\n{$safemodehtml}\n");
$wgOut->addHTML("<div class='editButtons'>\n\t{$buttons['save']}\n\t{$buttons['preview']}\n\t{$buttons['live']}\n\t{$buttons['diff']}\n\t<span class='editHelp'>{$cancel} | {$edithelp}</span>\n</div><!-- editButtons -->\n</div><!-- editOptions -->");
$wgOut->addWikiText(wfMsgForContent('edittools'));
$wgOut->addHTML("\n<div class='templatesUsed'>\n{$templates}\n</div>\n");
if ($wgUser->isLoggedIn()) {
/**
* To make it harder for someone to slip a user a page
* which submits an edit form to the wiki without their
* knowledge, a random token is associated with the login
* session. If it's not passed back with the submission,
* we won't save the page, or render user JavaScript and
* CSS previews.
*/
$token = htmlspecialchars($wgUser->editToken());
$wgOut->addHTML("\n<input type='hidden' value=\"{$token}\" name=\"wpEditToken\" />\n");
}
# If a blank edit summary was previously provided, and the appropriate
# user preference is active, pass a hidden tag here. This will stop the
# user being bounced back more than once in the event that a summary
# is not required.
if ($this->missingSummary) {
$wgOut->addHTML("<input type=\"hidden\" name=\"wpIgnoreBlankSummary\" value=\"1\" />\n");
}
# For a bit more sophisticated detection of blank summaries, hash the
# automatic one and pass that in a hidden field.
$autosumm = $this->autoSumm ? $this->autoSumm : md5($this->summary);
$wgOut->addHtml(wfHidden('wpAutoSummary', $autosumm));
if ($this->isConflict) {
$wgOut->addWikiText('==' . wfMsg("yourdiff") . '==');
$de = new DifferenceEngine($this->mTitle);
$de->setText($this->textbox2, $this->textbox1);
$de->showDiff(wfMsg("yourtext"), wfMsg("storedversion"));
$wgOut->addWikiText('==' . wfMsg("yourtext") . '==');
$wgOut->addHTML("<textarea tabindex=6 id='wpTextbox2' name=\"wpTextbox2\" rows='{$rows}' cols='{$cols}' wrap='virtual'>" . htmlspecialchars($this->safeUnicodeOutput($this->textbox2)) . "\n</textarea>");
}
$wgOut->addHTML("</form>\n");
if (!$wgUser->getOption('previewontop')) {
if ($this->formtype == 'preview') {
$this->showPreview();
} else {
$wgOut->addHTML('<div id="wikiPreview"></div>');
}
if ($this->formtype == 'diff') {
$wgOut->addHTML($this->getDiff());
}
}
wfProfileOut($fname);
}
示例8: spamPageWithContent
/**
* Show "your edit contains spam" page with your diff and text
*
* @param $match Text which triggered one or more filters
*/
public function spamPageWithContent($match = false)
{
global $wgOut;
$this->textbox2 = $this->textbox1;
$wgOut->setPageTitle(wfMsg('spamprotectiontitle'));
$wgOut->setRobotPolicy('noindex,nofollow');
$wgOut->setArticleRelated(false);
$wgOut->addHTML('<div id="spamprotected">');
$wgOut->addWikiMsg('spamprotectiontext');
if ($match) {
$wgOut->addWikiMsg('spamprotectionmatch', wfEscapeWikiText($match));
}
$wgOut->addHTML('</div>');
$wgOut->wrapWikiMsg('<h2>$1</h2>', "yourdiff");
$de = new DifferenceEngine($this->mTitle);
$de->setText($this->getContent(), $this->textbox2);
$de->showDiff(wfMsg("storedversion"), wfMsg("yourtext"));
$wgOut->wrapWikiMsg('<h2>$1</h2>', "yourtext");
$this->showTextbox2();
$wgOut->addReturnTo($this->getContextTitle(), array('action' => 'edit'));
}
示例9: showEditForm
//.........这里部分代码省略.........
$copywarnMsg = array('copyrightwarning2', '[[' . wfMsgForContent('copyrightpage') . ']]');
}
if ($wgUser->getOption('showtoolbar') and !$this->isCssJsSubpage) {
# prepare toolbar for edit buttons
$toolbar = $this->getEditToolbar();
} else {
$toolbar = '';
}
// activate checkboxes if user wants them to be always active
if (!$this->preview && !$this->diff) {
# Sort out the "watch" checkbox
if ($wgUser->getOption('watchdefault')) {
# Watch all edits
$this->watchthis = true;
} elseif ($wgUser->getOption('watchcreations') && !$this->mTitle->exists()) {
# Watch creations
$this->watchthis = true;
} elseif ($this->mTitle->userIsWatching()) {
# Already watched
$this->watchthis = true;
}
if ($wgUser->getOption('minordefault')) {
$this->minoredit = true;
}
}
$wgOut->addHTML($this->editFormPageTop);
if ($wgUser->getOption('previewontop')) {
if ('preview' == $this->formtype) {
$this->showPreview($previewOutput);
} else {
$wgOut->addHTML('<div id="wikiPreview"></div>');
}
if ('diff' == $this->formtype) {
$this->showDiff();
}
}
$wgOut->addHTML($this->editFormTextTop);
# if this is a comment, show a subject line at the top, which is also the edit summary.
# Otherwise, show a summary field at the bottom
$summarytext = htmlspecialchars($wgContLang->recodeForEdit($this->summary));
# FIXME
if ($this->section == 'new') {
$commentsubject = "<span id='wpSummaryLabel'><label for='wpSummary'>{$subject}:</label></span>\n<div class='editOptions'>\n<input tabindex='1' type='text' value=\"{$summarytext}\" name='wpSummary' id='wpSummary' maxlength='200' size='60' /><br />";
$editsummary = '';
$subjectpreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">" . wfMsg('subject-preview') . ':' . $sk->commentBlock($this->summary, $this->mTitle) . "</div>\n" : '';
$summarypreview = '';
} else {
$commentsubject = '';
$editsummary = "<span id='wpSummaryLabel'><label for='wpSummary'>{$summary}:</label></span>\n<div class='editOptions'>\n<input tabindex='2' type='text' value=\"{$summarytext}\" name='wpSummary' id='wpSummary' maxlength='200' size='60' /><br />";
$summarypreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">" . wfMsg('summary-preview') . ':' . $sk->commentBlock($this->summary, $this->mTitle) . "</div>\n" : '';
$subjectpreview = '';
}
# Set focus to the edit box on load, except on preview or diff, where it would interfere with the display
if (!$this->preview && !$this->diff) {
$wgOut->setOnloadHandler('document.editform.wpTextbox1.focus()');
}
$templates = $this->preview || $this->section != '' ? $this->mPreviewTemplates : $this->mArticle->getUsedTemplates();
$formattedtemplates = $sk->formatTemplates($templates, $this->preview, $this->section != '');
global $wgUseMetadataEdit;
if ($wgUseMetadataEdit) {
$metadata = $this->mMetaData;
$metadata = htmlspecialchars($wgContLang->recodeForEdit($metadata));
$top = wfMsgWikiHtml('metadata_help');
$metadata = $top . "<textarea name='metadata' rows='3' cols='{$cols}'{$ew}>{$metadata}</textarea>";
} else {
$metadata = "";
示例10: showConflict
protected function showConflict()
{
if (wfRunHooks('EditPageBeforeConflictDiff', array(&$this, &$this->out))) {
// diff
$this->out->addHtml('<div id="diff">');
$this->out->wrapWikiMsg('<h2>$1</h2>', 'editpagelayout-diff-header');
$de = new DifferenceEngine($this->mTitle);
$de->setText($this->textbox2, $this->textbox1);
$de->showDiff(wfMsg("yourtext"), wfMsg("storedversion"));
$this->out->addHtml('</div>');
// user's edit
$this->out->addHtml('<div id="myedit">');
$this->out->wrapWikiMsg('<h2>$1</h2>', 'editpagelayout-myedit-header');
$this->showTextbox2();
$this->out->addHtml('</div>');
}
}
示例11: showEditForm
//.........这里部分代码省略.........
}
if ($this->mTitle->isCascadeProtected()) {
# Is this page under cascading protection from some source pages?
list($cascadeSources, ) = $this->mTitle->getCascadeProtectionSources();
if (count($cascadeSources) > 0) {
# Explain, and list the titles responsible
$notice = wfMsgExt('cascadeprotectedwarning', array('parsemag'), count($cascadeSources)) . "\n";
foreach ($cascadeSources as $id => $page) {
$notice .= '* [[:' . $page->getPrefixedText() . "]]\n";
}
}
$wgOut->addWikiText($notice);
}
if ($this->kblength === false) {
$this->kblength = (int) (strlen($this->stripped_edit_text) / 1024);
}
if ($this->tooBig || $this->kblength > $wgMaxArticleSize) {
$wgOut->addWikiText(wfMsg('longpageerror', $wgLang->formatNum($this->kblength), $wgMaxArticleSize));
} elseif ($this->kblength > 29) {
$wgOut->addWikiText(wfMsg('longpagewarning', $wgLang->formatNum($this->kblength)));
}
# need to parse the preview early so that we know which templates are used,
# otherwise users with "show preview after edit box" will get a blank list
if ($this->formtype == 'preview') {
$previewOutput = $this->getPreviewText();
}
if ($wgUser->getOption('previewontop')) {
if ('preview' == $this->formtype) {
$this->showPreview($previewOutput);
} else {
$wgOut->addHTML('<div id="wikiPreview_' . htmlspecialchars($this->mvd_id) . '"></div>');
}
if ('diff' == $this->formtype) {
$this->showDiff();
}
}
$wgOut->addHTML($this->basic_html);
$wgOut->addHTML('<div style="display:inline" class="mv_advanced_edit"><br>');
// $rows = $wgUser->getIntOption( 'rows' );
// $cols = $wgUser->getIntOption( 'cols' );
// for ajax short edit area:
$rows = 3;
$cols = 40;
$ew = $wgUser->getOption('editwidth');
if ($ew) {
$ew = " style=\"width:100%\"";
} else {
$ew = '';
}
// do ajax action:
// $q = 'action=ajax';
# if ( "no" == $redirect ) { $q .= "&redirect=no"; }
// $action = $this->mTitle->escapeLocalURL( $q );
if ($editFormType == 'seq') {
$summary = wfMsg('mv_seq_summary');
} else {
$summary = wfMsg('summary');
}
$subject = wfMsg('subject');
if ($this->mvd_id == 'seq') {
$cancel = $sk->makeKnownLinkObj($this->mTitle, wfMsgExt('cancel', array('parseinline')));
$edithelpurl = Skin::makeInternalOrExternalUrl(wfMsgForContent('mv_edithelpsequence'));
} else {
$cancel = '<a href="javascript:mv_disp_mvd(\'' . $this->mTitle->getDBkey() . '\',\'' . $this->mvd_id . '\');">' . wfMsgExt('cancel', array('parseinline')) . '</a>';
$edithelpurl = Skin::makeInternalOrExternalUrl(wfMsgForContent('edithelppage'));
}
示例12: showConflict
protected function showConflict()
{
global $wgOut;
$this->textbox2 = $this->textbox1;
$this->textbox1 = $this->getContent();
if (wfRunHooks('EditPageBeforeConflictDiff', array(&$this, &$wgOut))) {
$wgOut->wrapWikiMsg('<h2>$1</h2>', "yourdiff");
$de = new DifferenceEngine($this->mTitle);
$de->setText($this->textbox2, $this->textbox1);
$de->showDiff(wfMsg("yourtext"), wfMsg("storedversion"));
$wgOut->wrapWikiMsg('<h2>$1</h2>', "yourtext");
$this->showTextbox2();
}
}
示例13: showConflict
/**
* Show an edit conflict. textbox1 is already shown in showEditForm().
* If you want to use another entry point to this function, be careful.
*/
protected function showConflict()
{
global $wgOut;
if (wfRunHooks('EditPageBeforeConflictDiff', array(&$this, &$wgOut))) {
$wgOut->wrapWikiMsg('<h2>$1</h2>', "yourdiff");
$de = new DifferenceEngine($this->mArticle->getContext());
$de->setText($this->textbox2, $this->textbox1);
$de->showDiff(wfMessage('yourtext')->parse(), wfMessage('storedversion')->text());
$wgOut->wrapWikiMsg('<h2>$1</h2>', "yourtext");
$this->showTextbox2();
}
}
示例14: showDiffPage
function showDiffPage()
{
global $wgUser, $wgTitle, $wgOut, $wgContLang, $wgOnlySysopsCanPatrol, $wgUseExternalEditor, $wgUseRCPatrol;
$fname = 'DifferenceEngine::showDiffPage';
wfProfileIn($fname);
# If external diffs are enabled both globally and for the user,
# we'll use the application/x-external-editor interface to call
# an external diff tool like kompare, kdiff3, etc.
if ($wgUseExternalEditor && $wgUser->getOption('externaldiff')) {
global $wgInputEncoding, $wgServer, $wgScript, $wgLang;
$wgOut->disable();
header("Content-type: application/x-external-editor; charset=" . $wgInputEncoding);
$url1 = $wgTitle->getFullURL("action=raw&oldid=" . $this->mOldid);
$url2 = $wgTitle->getFullURL("action=raw&oldid=" . $this->mNewid);
$special = $wgLang->getNsText(NS_SPECIAL);
$control = <<<CONTROL
[Process]
Type=Diff text
Engine=MediaWiki
Script={$wgServer}{$wgScript}
Special namespace={$special}
[File]
Extension=wiki
URL={$url1}
[File 2]
Extension=wiki
URL={$url2}
CONTROL;
echo $control;
return;
}
# mOldid is false if the difference engine is called with a "vague" query for
# a diff between a version V and its previous version V' AND the version V
# is the first version of that article. In that case, V' does not exist.
if ($this->mOldid === false) {
$this->showFirstRevision();
wfProfileOut($fname);
return;
}
$t = $wgTitle->getPrefixedText() . " (Diff: {$this->mOldid}, " . "{$this->mNewid})";
$mtext = wfMsg('missingarticle', $t);
$wgOut->setArticleFlag(false);
if (!$this->loadText()) {
$wgOut->setPagetitle(wfMsg('errorpagetitle'));
$wgOut->addHTML($mtext);
wfProfileOut($fname);
return;
}
$wgOut->suppressQuickbar();
$oldTitle = $this->mOldPage->getPrefixedText();
$newTitle = $this->mNewPage->getPrefixedText();
if ($oldTitle == $newTitle) {
$wgOut->setPageTitle($newTitle);
} else {
$wgOut->setPageTitle($oldTitle . ', ' . $newTitle);
}
$wgOut->setSubtitle(wfMsg('difference'));
$wgOut->setRobotpolicy('noindex,follow');
if (!($this->mOldPage->userCanRead() && $this->mNewPage->userCanRead())) {
$wgOut->loginToUse();
$wgOut->output();
wfProfileOut($fname);
exit;
}
$sk = $wgUser->getSkin();
$talk = $wgContLang->getNsText(NS_TALK);
$contribs = wfMsg('contribslink');
$this->mOldComment = $sk->formatComment($this->mOldComment);
$this->mNewComment = $sk->formatComment($this->mNewComment);
$oldUserLink = $sk->makeLinkObj(Title::makeTitleSafe(NS_USER, $this->mOldUser), $this->mOldUser);
$newUserLink = $sk->makeLinkObj(Title::makeTitleSafe(NS_USER, $this->mNewUser), $this->mNewUser);
$oldUTLink = $sk->makeLinkObj(Title::makeTitleSafe(NS_USER_TALK, $this->mOldUser), $talk);
$newUTLink = $sk->makeLinkObj(Title::makeTitleSafe(NS_USER_TALK, $this->mNewUser), $talk);
$oldContribs = $sk->makeKnownLinkObj(Title::makeTitle(NS_SPECIAL, 'Contributions'), $contribs, 'target=' . urlencode($this->mOldUser));
$newContribs = $sk->makeKnownLinkObj(Title::makeTitle(NS_SPECIAL, 'Contributions'), $contribs, 'target=' . urlencode($this->mNewUser));
if ($this->newRev->isCurrent() && $wgUser->isAllowed('rollback')) {
$rollback = ' <strong>[' . $sk->makeKnownLinkObj($wgTitle, wfMsg('rollbacklink'), 'action=rollback&from=' . urlencode($this->mNewUser) . '&token=' . urlencode($wgUser->editToken(array($wgTitle->getPrefixedText(), $this->mNewUser)))) . ']</strong>';
} else {
$rollback = '';
}
if ($wgUseRCPatrol && $this->mRcidMarkPatrolled != 0 && $wgUser->isLoggedIn() && ($wgUser->isAllowed('rollback') || !$wgOnlySysopsCanPatrol)) {
$patrol = ' [' . $sk->makeKnownLinkObj($wgTitle, wfMsg('markaspatrolleddiff'), "action=markpatrolled&rcid={$this->mRcidMarkPatrolled}") . ']';
} else {
$patrol = '';
}
$prevlink = $sk->makeKnownLinkObj($wgTitle, wfMsg('previousdiff'), 'diff=prev&oldid=' . $this->mOldid);
if ($this->newRev->isCurrent()) {
$nextlink = '';
} else {
$nextlink = $sk->makeKnownLinkObj($wgTitle, wfMsg('nextdiff'), 'diff=next&oldid=' . $this->mNewid);
}
$oldHeader = "<strong>{$this->mOldtitle}</strong><br />{$oldUserLink} " . "({$oldUTLink} | {$oldContribs})<br />" . $this->mOldComment . '<br />' . $prevlink;
$newHeader = "<strong>{$this->mNewtitle}</strong><br />{$newUserLink} " . "({$newUTLink} | {$newContribs}) {$rollback}<br />" . $this->mNewComment . '<br />' . $nextlink . $patrol;
DifferenceEngine::showDiff($this->mOldtext, $this->mNewtext, $oldHeader, $newHeader);
$wgOut->addHTML("<hr /><h2>{$this->mPagetitle}</h2>\n");
if (!$this->newRev->isCurrent()) {
$oldEditSectionSetting = $wgOut->mParserOptions->setEditSection(false);
}
//.........这里部分代码省略.........