* @private
*/
function getContent( $def_text = '' ) {
- global $wgOut, $wgRequest, $wgParser;
+ global $wgOut, $wgRequest, $wgParser, $wgMessageCache;
# Get variables from query string :P
$section = $wgRequest->getVal( 'section' );
$text = '';
if( !$this->mTitle->exists() ) {
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
+ $wgMessageCache->loadAllMessages();
# If this is a system message, get the default text.
$text = wfMsgWeirdKey ( $this->mTitle->getText() ) ;
} else {
$this->mArticle->mContent = $t ;
$this->mMetaData = $s ;
}
+
+ protected function wasDeletedSinceLastEdit() {
+ /* Note that we rely on the logging table, which hasn't been always there,
+ * but that doesn't matter, because this only applies to brand new
+ * deletes.
+ */
+ if ( $this->deletedSinceEdit )
+ return true;
+ if ( $this->mTitle->isDeleted() ) {
+ $this->lastDelete = $this->getLastDelete();
+ if ( !is_null($this->lastDelete) ) {
+ $deletetime = $this->lastDelete->log_timestamp;
+ if ( ($deletetime - $this->starttime) > 0 ) {
+ $this->deletedSinceEdit = true;
+ }
+ }
+ }
+ return $this->deletedSinceEdit;
+ }
function submit() {
$this->edit();
}
if( wfReadOnly() ) {
- $wgOut->readOnlyPage( $this->getContent() );
+ $this->readOnlyPage( $this->getContent() );
wfProfileOut( __METHOD__ );
return;
}
$permErrors = $this->mTitle->getUserPermissionsErrors('edit', $wgUser);
if( !$this->mTitle->exists() ) {
- # We can't use array_diff here, because that considers ANY TWO
- # ARRAYS TO BE EQUAL. Thanks, PHP.
- $createErrors = $this->mTitle->getUserPermissionsErrors('create', $wgUser);
- foreach( $createErrors as $error ) {
- # in_array() actually *does* work as expected.
- if( !in_array( $error, $permErrors ) ) {
- $permErrors[] = $error;
- }
- }
+ $permErrors = array_merge( $permErrors,
+ wfArrayDiff2( $this->mTitle->getUserPermissionsErrors('create', $wgUser), $permErrors ) );
}
# Ignore some permissions errors.
$remove = array();
foreach( $permErrors as $error ) {
- if ($this->preview || $this->diff &&
+ if ( ( $this->preview || $this->diff ) &&
($error[0] == 'blockedtext' || $error[0] == 'autoblockedtext'))
{
// Don't worry about blocks when previewing/diffing
}
}
}
- $permErrors = array_diff( $permErrors, $remove );
+ $permErrors = wfArrayDiff2( $permErrors, $remove );
- if ( !empty($permErrors) ) {
+ if ( $permErrors ) {
wfDebug( __METHOD__.": User can't edit\n" );
- $wgOut->readOnlyPage( $this->getContent(), true, $permErrors );
+ $this->readOnlyPage( $this->getContent(), true, $permErrors );
wfProfileOut( __METHOD__ );
return;
} else {
$this->isCssJsSubpage = $this->mTitle->isCssJsSubpage();
$this->isValidCssJsSubpage = $this->mTitle->isValidCssJsSubpage();
- /* Notice that we can't use isDeleted, because it returns true if article is ever deleted
- * no matter it's current state
- */
- $this->deletedSinceEdit = false;
- if ( $this->edittime != '' ) {
- /* Note that we rely on logging table, which hasn't been always there,
- * but that doesn't matter, because this only applies to brand new
- * deletes. This is done on every preview and save request. Move it further down
- * to only perform it on saves
- */
- if ( $this->mTitle->isDeleted() ) {
- $this->lastDelete = $this->getLastDelete();
- if ( !is_null($this->lastDelete) ) {
- $deletetime = $this->lastDelete->log_timestamp;
- if ( ($deletetime - $this->starttime) > 0 ) {
- $this->deletedSinceEdit = true;
- }
- }
- }
- }
-
# Show applicable editing introductions
if( $this->formtype == 'initial' || $this->firsttime )
$this->showIntro();
if( $this->mTitle->isTalkPage() ) {
- $wgOut->addWikiText( wfMsg( 'talkpagetext' ) );
+ $wgOut->addWikiMsg( 'talkpagetext' );
}
# Attempt submission here. This will check for edit conflicts,
wfProfileOut( __METHOD__ );
}
+ /**
+ * Show a read-only error
+ * Parameters are the same as OutputPage:readOnlyPage()
+ * Redirect to the article page if redlink=1
+ */
+ function readOnlyPage( $source = null, $protected = false, $reasons = array() ) {
+ global $wgRequest, $wgOut;
+ if ( $wgRequest->getBool( 'redlink' ) ) {
+ // The edit page was reached via a red link.
+ // Redirect to the article page and let them click the edit tab if
+ // they really want a permission error.
+ $wgOut->redirect( $this->mTitle->getFullUrl() );
+ } else {
+ $wgOut->readOnlyPage( $source, $protected, $reasons );
+ }
+ }
+
/**
* Should we show a preview when the edit form is first shown?
*
$fname = 'EditPage::importFormData';
wfProfileIn( $fname );
+ # Section edit can come from either the form or a link
+ $this->section = $request->getVal( 'wpSection', $request->getVal( 'section' ) );
+
if( $request->wasPosted() ) {
# These fields need to be checked for encoding.
# Also remove trailing whitespace, but don't remove _initial_
$this->minoredit = false;
$this->watchthis = false;
$this->recreate = false;
+
+ if ( $this->section == 'new' && $request->getVal( 'preloadtitle' ) ) {
+ $this->summary = $request->getVal( 'preloadtitle' );
+ }
}
$this->oldid = $request->getInt( 'oldid' );
- # Section edit can come from either the form or a link
- $this->section = $request->getVal( 'wpSection', $request->getVal( 'section' ) );
-
$this->live = $request->getCheck( 'live' );
$this->editintro = $request->getText( 'editintro' );
$ip = User::isIP( $username );
if ( $id == 0 && !$ip ) {
- $wgOut->addWikiText( '<div class="mw-userpage-userdoesnotexist error">' . wfMsg( 'userpage-userdoesnotexist', $username ) . '</div>' );
+ $wgOut->wrapWikiMsg( '<div class="mw-userpage-userdoesnotexist error">$1</div>',
+ array( 'userpage-userdoesnotexist', $username ) );
}
}
if( !$this->showCustomIntro() && !$this->mTitle->exists() ) {
if( $wgUser->isLoggedIn() ) {
- $wgOut->addWikiText( '<div class="mw-newarticletext">' . wfMsg( 'newarticletext' ) . '</div>' );
+ $wgOut->wrapWikiMsg( '<div class="mw-newarticletext">$1</div>', 'newarticletext' );
} else {
- $wgOut->addWikiText( '<div class="mw-newarticletextanon">' . wfMsg( 'newarticletextanon' ) . '</div>' );
+ $wgOut->wrapWikiMsg( '<div class="mw-newarticletextanon">$1</div>', 'newarticletextanon' );
}
$this->showDeletionLog( $wgOut );
}
# If the article has been deleted while editing, don't save it without
# confirmation
- if ( $this->deletedSinceEdit && !$this->recreate ) {
+ if ( $this->wasDeletedSinceLastEdit() && !$this->recreate ) {
wfProfileOut( "$fname-checks" );
wfProfileOut( $fname );
return self::AS_ARTICLE_WAS_DELETED;
*/
function initialiseForm() {
$this->edittime = $this->mArticle->getTimestamp();
- $this->summary = '';
$this->textbox1 = $this->getContent(false);
if ($this->textbox1 === false) return false;
*/
function showEditForm( $formCallback=null ) {
global $wgOut, $wgUser, $wgLang, $wgContLang, $wgMaxArticleSize, $wgTitle;
+
+ # If $wgTitle is null, that means we're in API mode.
+ # Some hook probably called this function without checking
+ # for is_null($wgTitle) first. Bail out right here so we don't
+ # do lots of work just to discard it right after.
+ if(is_null($wgTitle))
+ return;
$fname = 'EditPage::showEditForm';
wfProfileIn( $fname );
if ( $this->isConflict ) {
$s = wfMsg( 'editconflict', $wgTitle->getPrefixedText() );
$wgOut->setPageTitle( $s );
- $wgOut->addWikiText( wfMsg( 'explainconflict' ) );
+ $wgOut->addWikiMsg( 'explainconflict' );
$this->textbox2 = $this->textbox1;
$this->textbox1 = $this->getContent();
$wgOut->setPageTitle( $s );
if ( $this->missingComment ) {
- $wgOut->addWikiText( '<div id="mw-missingcommenttext">' . wfMsg( 'missingcommenttext' ) . '</div>' );
+ $wgOut->wrapWikiMsg( '<div id="mw-missingcommenttext">$1</div>', 'missingcommenttext' );
}
if( $this->missingSummary && $this->section != 'new' ) {
- $wgOut->addWikiText( '<div id="mw-missingsummary">' . wfMsg( 'missingsummary' ) . '</div>' );
+ $wgOut->wrapWikiMsg( '<div id="mw-missingsummary">$1</div>', 'missingsummary' );
}
if( $this->missingSummary && $this->section == 'new' ) {
- $wgOut->addWikiText( '<div id="mw-missingcommentheader">' . wfMsg( 'missingcommentheader' ) . '</div>' );
+ $wgOut->wrapWikiMsg( '<div id="mw-missingcommentheader">$1</div>', 'missingcommentheader' );
}
if( $this->hookError !== '' ) {
}
if ( !$this->checkUnicodeCompliantBrowser() ) {
- $wgOut->addWikiText( wfMsg( 'nonunicodebrowser') );
+ $wgOut->addWikiMsg( 'nonunicodebrowser' );
}
if ( isset( $this->mArticle ) && isset( $this->mArticle->mRevision ) ) {
// Let sysop know that this will make private content public if saved
if( !$this->mArticle->mRevision->userCan( Revision::DELETED_TEXT ) ) {
- $wgOut->addWikiText( wfMsg( 'rev-deleted-text-permission' ) );
+ $wgOut->addWikiMsg( 'rev-deleted-text-permission' );
} else if( $this->mArticle->mRevision->isDeleted( Revision::DELETED_TEXT ) ) {
- $wgOut->addWikiText( wfMsg( 'rev-deleted-text-view' ) );
+ $wgOut->addWikiMsg( 'rev-deleted-text-view' );
}
if( !$this->mArticle->mRevision->isCurrent() ) {
$this->mArticle->setOldSubtitle( $this->mArticle->mRevision->getId() );
- $wgOut->addWikiText( wfMsg( 'editingold' ) );
+ $wgOut->addWikiMsg( 'editingold' );
}
}
}
if( $this->isCssJsSubpage && $this->formtype != 'preview' ) {
# Check the skin exists
if( $this->isValidCssJsSubpage ) {
- $wgOut->addWikiText( wfMsg( 'usercssjsyoucanpreview' ) );
+ $wgOut->addWikiMsg( 'usercssjsyoucanpreview' );
} else {
- $wgOut->addWikiText( wfMsg( 'userinvalidcssjstitle', $wgTitle->getSkinFromCssJsSubpage() ) );
+ $wgOut->addWikiMsg( 'userinvalidcssjstitle', $wgTitle->getSkinFromCssJsSubpage() );
}
}
}
if( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
# Show a warning if editing an interface message
- $wgOut->addWikiText( wfMsg( 'editinginterface' ) );
+ $wgOut->addWikiMsg( 'editinginterface' );
} elseif( $this->mTitle->isProtected( 'edit' ) ) {
# Is the title semi-protected?
if( $this->mTitle->isSemiProtected() ) {
- $notice = wfMsg( 'semiprotectedpagewarning' );
- if( wfEmptyMsg( 'semiprotectedpagewarning', $notice ) || $notice == '-' )
- $notice = '';
+ $noticeMsg = 'semiprotectedpagewarning';
} else {
# Then it must be protected based on static groups (regular)
- $notice = wfMsg( 'protectedpagewarning' );
+ $noticeMsg = 'protectedpagewarning';
}
- $wgOut->addWikiText( $notice );
+ $wgOut->addWikiMsg( $noticeMsg );
}
if ( $this->mTitle->isCascadeProtected() ) {
# Is this page under cascading protection from some source pages?
list($cascadeSources, /* $restrictions */) = $this->mTitle->getCascadeProtectionSources();
+ $notice = "$1\n";
if ( count($cascadeSources) > 0 ) {
# Explain, and list the titles responsible
- $notice = wfMsgExt( 'cascadeprotectedwarning', array('parsemag'), count($cascadeSources) ) . "\n";
foreach( $cascadeSources as $page ) {
$notice .= '* [[:' . $page->getPrefixedText() . "]]\n";
}
}
- $wgOut->addWikiText( $notice );
+ $wgOut->wrapWikiMsg( $notice, array( 'cascadeprotectedwarning', count($cascadeSources) ) );
}
if( !$this->mTitle->exists() && $this->mTitle->getRestrictions( 'create' ) != array() ){
- $wgOut->addWikiText( wfMsg( 'titleprotectedwarning' ) );
+ $wgOut->addWikiMsg( 'titleprotectedwarning' );
}
if ( $this->kblength === false ) {
$this->kblength = (int)(strlen( $this->textbox1 ) / 1024);
}
if ( $this->tooBig || $this->kblength > $wgMaxArticleSize ) {
- $wgOut->addWikiText( wfMsg( 'longpageerror', $wgLang->formatNum( $this->kblength ), $wgMaxArticleSize ) );
+ $wgOut->addWikiMsg( 'longpageerror', $wgLang->formatNum( $this->kblength ), $wgMaxArticleSize );
} elseif( $this->kblength > 29 ) {
- $wgOut->addWikiText( wfMsg( 'longpagewarning', $wgLang->formatNum( $this->kblength ) ) );
+ $wgOut->addWikiMsg( 'longpagewarning', $wgLang->formatNum( $this->kblength ) );
}
#need to parse the preview early so that we know which templates are used,
htmlspecialchars( wfMsg( 'newwindow' ) );
global $wgRightsText;
- $copywarn = "<div id=\"editpage-copywarn\">\n" .
- wfMsg( $wgRightsText ? 'copyrightwarning' : 'copyrightwarning2',
+ if ( $wgRightsText ) {
+ $copywarnMsg = array( 'copyrightwarning',
'[[' . wfMsgForContent( 'copyrightpage' ) . ']]',
- $wgRightsText ) . "\n</div>";
+ $wgRightsText );
+ } else {
+ $copywarnMsg = array( 'copyrightwarning2',
+ '[[' . wfMsgForContent( 'copyrightpage' ) . ']]' );
+ }
if( $wgUser->getOption('showtoolbar') and !$this->isCssJsSubpage ) {
# prepare toolbar for edit buttons
# 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 a blank edit summary was previously provided, and the appropriate
+ # user preference is active, pass a hidden tag as wpIgnoreBlankSummary. This will stop the
+ # user being bounced back more than once in the event that a summary
+ # is not required.
+ #####
+ # For a bit more sophisticated detection of blank summaries, hash the
+ # automatic one and pass that in the hidden field wpAutoSummary.
+ $summaryhiddens = '';
+ if( $this->missingSummary ) $summaryhiddens .= wfHidden( 'wpIgnoreBlankSummary', true );
+ $autosumm = $this->autoSumm ? $this->autoSumm : md5( $this->summary );
+ $summaryhiddens .= wfHidden( 'wpAutoSummary', $autosumm );
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 />";
+ $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' />{$summaryhiddens}<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 />";
+ $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' />{$summaryhiddens}<br />";
$summarypreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">".wfMsg('summary-preview').':'.$sk->commentBlock( $this->summary, $this->mTitle )."</div>\n" : '';
$subjectpreview = '';
}
$templates = ($this->preview || $this->section != '') ? $this->mPreviewTemplates : $this->mArticle->getUsedTemplates();
$formattedtemplates = $sk->formatTemplates( $templates, $this->preview, $this->section != '');
+ $hiddencats = $this->mArticle->getHiddenCategories();
+ $formattedhiddencats = $sk->formatHiddenCategories( $hiddencats );
+
global $wgUseMetadataEdit ;
if ( $wgUseMetadataEdit ) {
$metadata = $this->mMetaData ;
$hidden = '';
$recreate = '';
- if ($this->deletedSinceEdit) {
+ if ($this->wasDeletedSinceLastEdit()) {
if ( 'save' != $this->formtype ) {
- $wgOut->addWikiText( wfMsg('deletedwhileediting'));
+ $wgOut->addWikiMsg('deletedwhileediting');
} else {
// Hide the toolbar and edit area, use can click preview to get it back
// Add an confirmation checkbox and explanation.
</textarea>
" );
- $wgOut->addWikiText( $copywarn );
+ $wgOut->wrapWikiMsg( "<div id=\"editpage-copywarn\">\n$1\n</div>", $copywarnMsg );
$wgOut->addHTML( $this->editFormTextAfterWarn );
$wgOut->addHTML( "
{$metadata}
</div><!-- editButtons -->
</div><!-- editOptions -->");
- $wgOut->addHtml( '<div class="mw-editTools">' );
- $wgOut->addWikiText( wfMsgForContent( 'edittools' ) );
- $wgOut->addHtml( '</div>' );
-
- $wgOut->addHTML( $this->editFormTextAfterTools );
-
- $wgOut->addHTML( "
-<div class='templatesUsed'>
-{$formattedtemplates}
-</div>
-" );
-
/**
* To make it harder for someone to slip a user a page
* which submits an edit form to the wiki without their
$token = htmlspecialchars( $wgUser->editToken() );
$wgOut->addHTML( "\n<input type='hidden' value=\"$token\" name=\"wpEditToken\" />\n" );
+ $wgOut->addHtml( '<div class="mw-editTools">' );
+ $wgOut->addWikiMsgArray( 'edittools', array(), array( 'content' ) );
+ $wgOut->addHtml( '</div>' );
- # 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" );
- }
+ $wgOut->addHTML( $this->editFormTextAfterTools );
- # 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 ) );
+ $wgOut->addHTML( "
+<div class='templatesUsed'>
+{$formattedtemplates}
+</div>
+<div class='hiddencats'>
+{$formattedhiddencats}
+</div>
+");
if ( $this->isConflict ) {
- $wgOut->addWikiText( '==' . wfMsg( "yourdiff" ) . '==' );
+ $wgOut->wrapWikiMsg( '==$1==', "yourdiff" );
$de = new DifferenceEngine( $this->mTitle );
$de->setText( $this->textbox2, $this->textbox1 );
$de->showDiff( wfMsg( "yourtext" ), wfMsg( "storedversion" ) );
- $wgOut->addWikiText( '==' . wfMsg( "yourtext" ) . '==' );
+ $wgOut->wrapWikiMsg( '==$1==', "yourtext" );
$wgOut->addHTML( "<textarea tabindex='6' id='wpTextbox2' name=\"wpTextbox2\" rows='{$rows}' cols='{$cols}'>"
. htmlspecialchars( $this->safeUnicodeOutput( $this->textbox2 ) ) . "\n</textarea>" );
}
* @todo document
*/
function getPreviewText() {
- global $wgOut, $wgUser, $wgTitle, $wgParser;
+ global $wgOut, $wgUser, $wgTitle, $wgParser, $wgLang, $wgContLang;
$fname = 'EditPage::getPreviewText';
wfProfileIn( $fname );
$toparse="== {$this->summary} ==\n\n".$toparse;
}
- if ( $this->mMetaData != "" ) $toparse .= "\n" . $this->mMetaData ;
+ if ( $this->mMetaData != "" ) $toparse .= "\n" . $this->mMetaData;
+
+ // Parse mediawiki messages with correct target language
+ if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
+ $pos = strrpos( $this->mTitle->getText(), '/' );
+ if ( $pos !== false ) {
+ $code = substr( $this->mTitle->getText(), $pos+1 );
+ switch ($code) {
+ case $wgLang->getCode():
+ $obj = $wgLang; break;
+ case $wgContLang->getCode():
+ $obj = $wgContLang; break;
+ default:
+ $obj = Language::factory( $code );
+ }
+ $parserOptions->setTargetLanguage( $obj );
+ }
+ }
+
+
$parserOptions->setTidy(true);
$parserOptions->enableLimitReport();
$parserOutput = $wgParser->parse( $this->mArticle->preSaveTransform( $toparse ) ."\n\n",
$wgOut->addParserOutputNoText( $parserOutput );
# ParserOutput might have altered the page title, so reset it
- $wgOut->setPageTitle( wfMsg( 'editing', $wgTitle->getPrefixedText() ) );
+ # Also, use the title defined by DISPLAYTITLE magic word when present
+ if( ( $dt = $parserOutput->getDisplayTitle() ) !== false ) {
+ $wgOut->setPageTitle( wfMsg( 'editing', $dt ) );
+ } else {
+ $wgOut->setPageTitle( wfMsg( 'editing', $wgTitle->getPrefixedText() ) );
+ }
foreach ( $parserOutput->getTemplates() as $ns => $template)
foreach ( array_keys( $template ) as $dbk)
$cols = $wgUser->getOption( 'cols' );
$attribs = array( 'id' => 'wpTextbox1', 'name' => 'wpTextbox1', 'cols' => $cols, 'rows' => $rows, 'readonly' => 'readonly' );
$wgOut->addHtml( '<hr />' );
- $wgOut->addWikiText( wfMsg( $first ? 'blockedoriginalsource' : 'blockededitsource', $this->mTitle->getPrefixedText() ) );
+ $wgOut->addWikiMsg( $first ? 'blockedoriginalsource' : 'blockededitsource', $this->mTitle->getPrefixedText() );
$wgOut->addHtml( wfOpenElement( 'textarea', $attribs ) . htmlspecialchars( $source ) . wfCloseElement( 'textarea' ) );
}
}
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->setArticleRelated( false );
- $wgOut->addWikiText( wfMsg( 'nosuchsectiontext', $this->section ) );
+ $wgOut->addWikiMsg( 'nosuchsectiontext', $this->section );
$wgOut->returnToMain( false, $wgTitle );
}
$wgOut->setArticleRelated( false );
$wgOut->addHtml( '<div id="spamprotected">' );
- $wgOut->addWikiText( wfMsg( 'spamprotectiontext' ) );
+ $wgOut->addWikiMsg( 'spamprotectiontext' );
if ( $match )
- $wgOut->addWikiText( wfMsg( 'spamprotectionmatch',wfEscapeWikiText( $match ) ) );
+ $wgOut->addWikiMsg( 'spamprotectionmatch',wfEscapeWikiText( $match ) );
$wgOut->addHtml( '</div>' );
$wgOut->returnToMain( false, $wgTitle );
$toolarray = array(
array( 'image' => 'button_bold.png',
'id' => 'mw-editbutton-bold',
- 'open' => '\\\'\\\'\\\'',
- 'close' => '\\\'\\\'\\\'',
+ 'open' => '\'\'\'',
+ 'close' => '\'\'\'',
'sample'=> wfMsg('bold_sample'),
'tip' => wfMsg('bold_tip'),
'key' => 'B'
),
array( 'image' => 'button_italic.png',
'id' => 'mw-editbutton-italic',
- 'open' => '\\\'\\\'',
- 'close' => '\\\'\\\'',
+ 'open' => '\'\'',
+ 'close' => '\'\'',
'sample'=> wfMsg('italic_sample'),
'tip' => wfMsg('italic_tip'),
'key' => 'I'
),
array( 'image' => 'button_headline.png',
'id' => 'mw-editbutton-headline',
- 'open' => "\\n== ",
- 'close' => " ==\\n",
+ 'open' => "\n== ",
+ 'close' => " ==\n",
'sample'=> wfMsg('headline_sample'),
'tip' => wfMsg('headline_tip'),
'key' => 'H'
array( 'image' => 'button_math.png',
'id' => 'mw-editbutton-math',
'open' => "<math>",
- 'close' => "<\\/math>",
+ 'close' => "</math>",
'sample'=> wfMsg('math_sample'),
'tip' => wfMsg('math_tip'),
'key' => 'C'
array( 'image' => 'button_nowiki.png',
'id' => 'mw-editbutton-nowiki',
'open' => "<nowiki>",
- 'close' => "<\\/nowiki>",
+ 'close' => "</nowiki>",
'sample'=> wfMsg('nowiki_sample'),
'tip' => wfMsg('nowiki_tip'),
'key' => 'N'
),
array( 'image' => 'button_hr.png',
'id' => 'mw-editbutton-hr',
- 'open' => "\\n----\\n",
+ 'open' => "\n----\n",
'close' => '',
'sample'=> '',
'tip' => wfMsg('hr_tip'),
$toolbar.="<script type='$wgJsMimeType'>\n/*<![CDATA[*/\n";
foreach($toolarray as $tool) {
-
- $cssId = $tool['id'];
- $image=$wgStylePath.'/common/images/'.$tool['image'];
- $open=$tool['open'];
- $close=$tool['close'];
- $sample = wfEscapeJsString( $tool['sample'] );
-
- // Note that we use the tip both for the ALT tag and the TITLE tag of the image.
- // Older browsers show a "speedtip" type message only for ALT.
- // Ideally these should be different, realistically they
- // probably don't need to be.
- $tip = wfEscapeJsString( $tool['tip'] );
-
- #$key = $tool["key"];
-
- $toolbar.="addButton('$image','$tip','$open','$close','$sample','$cssId');\n";
+ $params = array(
+ $image = $wgStylePath.'/common/images/'.$tool['image'],
+ // Note that we use the tip both for the ALT tag and the TITLE tag of the image.
+ // Older browsers show a "speedtip" type message only for ALT.
+ // Ideally these should be different, realistically they
+ // probably don't need to be.
+ $tip = $tool['tip'],
+ $open = $tool['open'],
+ $close = $tool['close'],
+ $sample = $tool['sample'],
+ $cssId = $tool['id'],
+ );
+
+ $paramList = implode( ',',
+ array_map( array( 'Xml', 'encodeJsVar' ), $params ) );
+ $toolbar.="addButton($paramList);\n";
}
$toolbar.="/*]]>*/\n</script>";
'title' => wfMsg( 'tooltip-diff' ).' ['.wfMsg( 'accesskey-diff' ).']',
);
$buttons['diff'] = wfElement('input', $temp, '');
-
+
+ wfRunHooks( 'EditPageBeforeEditButtons', array( &$this, &$buttons ) );
return $buttons;
}
function noCreatePermission() {
global $wgOut;
$wgOut->setPageTitle( wfMsg( 'nocreatetitle' ) );
- $wgOut->addWikiText( wfMsg( 'nocreatetext' ) );
+ $wgOut->addWikiMsg( 'nocreatetext' );
}
/**
);
if( $reader->hasRows() ) {
$out->addHtml( '<div id="mw-recreate-deleted-warn">' );
- $out->addWikiText( wfMsg( 'recreate-deleted-warn' ) );
+ $out->addWikiMsg( 'recreate-deleted-warn' );
$viewer = new LogViewer( $reader );
$viewer->showList( $out );
$out->addHtml( '</div>' );