Partial revert of r37502, 37503: double-quoting of SQL strings
[lhc/web/wiklou.git] / includes / EditPage.php
index 3c0f2ae..98ab49f 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 /**
  * Contains the EditPage class
+ * @file
  */
 
 /**
@@ -153,39 +154,43 @@ class EditPage {
                                        $oldrev = $undorev ? $undorev->getPrevious() : null;
                                }
 
-                               #Sanity check, make sure it's the right page.
+                               # Sanity check, make sure it's the right page,
+                               # the revisions exist and they were not deleted.
                                # Otherwise, $text will be left as-is.
-                               if ( !is_null($undorev) && !is_null($oldrev) && $undorev->getPage()==$oldrev->getPage() && $undorev->getPage()==$this->mArticle->getID() ) {
+                               if( !is_null( $undorev ) && !is_null( $oldrev ) &&
+                                       $undorev->getPage() == $oldrev->getPage() &&
+                                       $undorev->getPage() == $this->mArticle->getID() &&
+                                       !$undorev->isDeleted( Revision::DELETED_TEXT ) &&
+                                       !$oldrev->isDeleted( Revision::DELETED_TEXT ) ) {
                                        $undorev_text = $undorev->getText();
                                        $oldrev_text = $oldrev->getText();
                                        $currev_text = $text;
 
-                                       #No use doing a merge if it's just a straight revert.
                                        if ( $currev_text != $undorev_text ) {
-                                               $result = wfMerge($undorev_text, $oldrev_text, $currev_text, $text);
+                                               $result = wfMerge( $undorev_text, $oldrev_text, $currev_text, $text );
                                        } else {
+                                               # No use doing a merge if it's just a straight revert.
                                                $text = $oldrev_text;
                                                $result = true;
                                        }
+                                       if( $result ) {
+                                               # Inform the user of our success and set an automatic edit summary
+                                               $this->editFormPageTop .= $wgOut->parse( wfMsgNoTrans( 'undo-success' ) );
+                                               $firstrev = $oldrev->getNext();
+                                               # If we just undid one rev, use an autosummary
+                                               if( $firstrev->mId == $undo ) {
+                                                       $this->summary = wfMsgForContent('undo-summary', $undo, $undorev->getUserText());
+                                               }
+                                               $this->formtype = 'diff';
+                                       } else {
+                                               # Warn the user that something went wrong
+                                               $this->editFormPageTop .= $wgOut->parse( wfMsgNoTrans( 'undo-failure' ) );
+                                       }
                                } else {
                                        // Failed basic sanity checks.
                                        // Older revisions may have been removed since the link
                                        // was created, or we may simply have got bogus input.
-                                       $result = false;
-                               }
-
-                               if( $result ) {
-                                       # Inform the user of our success and set an automatic edit summary
-                                       $this->editFormPageTop .= $wgOut->parse( wfMsgNoTrans( 'undo-success' ) );
-                                       $firstrev = $oldrev->getNext();
-                                       # If we just undid one rev, use an autosummary
-                                       if ( $firstrev->mId == $undo ) {
-                                               $this->summary = wfMsgForContent('undo-summary', $undo, $undorev->getUserText());
-                                       }
-                                       $this->formtype = 'diff';
-                               } else {
-                                       # Warn the user that something went wrong
-                                       $this->editFormPageTop .= $wgOut->parse( wfMsgNoTrans( 'undo-failure' ) );
+                                       $this->editFormPageTop .= $wgOut->parse( wfMsgNoTrans( 'undo-norev' ) );
                                }
                        } else if( $section != '' ) {
                                if( $section == 'new' ) {
@@ -374,6 +379,8 @@ class EditPage {
                        wfProfileOut( __METHOD__ );
                        return;
                }
+               
+               $wgOut->addScriptFile( 'edit.js' );
 
                if( wfReadOnly() ) {
                        $this->readOnlyPage( $this->getContent() );
@@ -382,6 +389,7 @@ class EditPage {
                }
 
                $permErrors = $this->mTitle->getUserPermissionsErrors('edit', $wgUser);
+               
                if( !$this->mTitle->exists() ) {
                        $permErrors = array_merge( $permErrors,
                                wfArrayDiff2( $this->mTitle->getUserPermissionsErrors('create', $wgUser), $permErrors ) );
@@ -407,10 +415,10 @@ class EditPage {
                        }
                }
                $permErrors = wfArrayDiff2( $permErrors, $remove );
-
+               
                if ( $permErrors ) {
                        wfDebug( __METHOD__.": User can't edit\n" );
-                       $this->readOnlyPage( $this->getContent(), true, $permErrors );
+                       $this->readOnlyPage( $this->getContent(), true, $permErrors, 'edit' );
                        wfProfileOut( __METHOD__ );
                        return;
                } else {
@@ -482,7 +490,7 @@ class EditPage {
         * Parameters are the same as OutputPage:readOnlyPage()
         * Redirect to the article page if redlink=1
         */
-       function readOnlyPage( $source = null, $protected = false, $reasons = array() ) {
+       function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
                global $wgRequest, $wgOut;
                if ( $wgRequest->getBool( 'redlink' ) ) {
                        // The edit page was reached via a red link.
@@ -490,7 +498,7 @@ class EditPage {
                        // they really want a permission error.
                        $wgOut->redirect( $this->mTitle->getFullUrl() );
                } else {
-                       $wgOut->readOnlyPage( $source, $protected, $reasons );
+                       $wgOut->readOnlyPage( $source, $protected, $reasons, $action );
                }
        }
 
@@ -737,17 +745,21 @@ class EditPage {
                $matches = array();
                if ( $wgSpamRegex && preg_match( $wgSpamRegex, $this->textbox1, $matches ) ) {
                        $result['spam'] = $matches[0];
+                       $ip = wfGetIP();
+                       $pdbk = $this->mTitle->getPrefixedDBkey();
+                       $match = str_replace( "\n", '', $matches[0] );
+                       wfDebugLog( 'SpamRegex', "$ip spam regex hit [[$pdbk]]: \"$match\"" );
                        wfProfileOut( "$fname-checks" );
                        wfProfileOut( $fname );
                        return self::AS_SPAM_ERROR;
                }
-               if ( $wgFilterCallback && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section ) ) {
+               if ( $wgFilterCallback && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section, $this->hookError, $this->summary ) ) {
                        # Error messages or other handling should be performed by the filter function
                        wfProfileOut( "$fname-checks" );
                        wfProfileOut( $fname );
                        return self::AS_FILTERING;
                }
-               if ( !wfRunHooks( 'EditFilter', array( $this, $this->textbox1, $this->section, &$this->hookError ) ) ) {
+               if ( !wfRunHooks( 'EditFilter', array( $this, $this->textbox1, $this->section, &$this->hookError, $this->summary ) ) ) {
                        # Error messages etc. could be handled within the hook...
                        wfProfileOut( "$fname-checks" );
                        wfProfileOut( $fname );
@@ -825,7 +837,7 @@ class EditPage {
                        }
 
                        // Run post-section-merge edit filter
-                       if ( !wfRunHooks( 'EditFilterMerged', array( $this, $this->textbox1, &$this->hookError ) ) ) {
+                       if ( !wfRunHooks( 'EditFilterMerged', array( $this, $this->textbox1, &$this->hookError, $this->summary ) ) ) {
                                # Error messages etc. could be handled within the hook...
                                wfProfileOut( $fname );
                                return self::AS_HOOK_ERROR;
@@ -863,7 +875,7 @@ class EditPage {
                                }
                        }
                }
-               $userid = $wgUser->getID();
+               $userid = $wgUser->getId();
 
                if ( $this->isConflict) {
                        wfDebug( "EditPage::editForm conflict! getting section '$this->section' for time '$this->edittime' (article time '" .
@@ -908,15 +920,18 @@ class EditPage {
                $oldtext = $this->mArticle->getContent();
 
                // Run post-section-merge edit filter
-               if ( !wfRunHooks( 'EditFilterMerged', array( $this, $text, &$this->hookError ) ) ) {
+               if ( !wfRunHooks( 'EditFilterMerged', array( $this, $text, &$this->hookError, $this->summary ) ) ) {
                        # Error messages etc. could be handled within the hook...
                        wfProfileOut( $fname );
                        return self::AS_HOOK_ERROR;
                }
 
                # Handle the user preference to force summaries here, but not for null edits
-               if( $this->section != 'new' && !$this->allowBlankSummary && $wgUser->getOption( 'forceeditsummary')
-                       &&  0 != strcmp($oldtext, $text) && !Article::getRedirectAutosummary( $text )) {
+               if( $this->section != 'new' && !$this->allowBlankSummary &&  $wgUser->getOption( 'forceeditsummary') && 
+                       0 != strcmp($oldtext, $text) && 
+                       !is_object( Title::newFromRedirect( $text ) ) # check if it's not a redirect
+               ) {
+
                        if( md5( $this->summary ) == $this->autoSumm ) {
                                $this->missingSummary = true;
                                wfProfileOut( $fname );
@@ -1194,7 +1209,7 @@ class EditPage {
 
                if( $wgUser->getOption('showtoolbar') and !$this->isCssJsSubpage ) {
                        # prepare toolbar for edit buttons
-                       $toolbar = $this->getEditToolbar();
+                       $toolbar = EditPage::getEditToolbar();
                } else {
                        $toolbar = '';
                }
@@ -1250,15 +1265,15 @@ class EditPage {
                $autosumm = $this->autoSumm ? $this->autoSumm : md5( $this->summary );
                $summaryhiddens .= Xml::hidden( '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' />{$summaryhiddens}<br />";
-                       $editsummary = '';
+                       $commentsubject="<span id='wpSummaryLabel'><label for='wpSummary'>{$subject}:</label></span>\n<input tabindex='1' type='text' value=\"$summarytext\" name='wpSummary' id='wpSummary' maxlength='200' size='60' />{$summaryhiddens}<br />";
+                       $editsummary = "<div class='editOptions'>\n";
                        global $wgParser;
                        $formattedSummary = wfMsgForContent( 'newsectionsummary', $wgParser->stripSectionName( $this->summary ) );
                        $subjectpreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">".wfMsg('subject-preview').':'.$sk->commentBlock( $formattedSummary, $this->mTitle, true )."</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' />{$summaryhiddens}<br />";
+                       $editsummary="<div class='editOptions'>\n<span id='wpSummaryLabel'><label for='wpSummary'>{$summary}:</label></span>\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 = '';
                }
@@ -1331,18 +1346,24 @@ END
 <input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n
 <input type='hidden' value=\"{$this->scrolltop}\" name=\"wpScrolltop\" id=\"wpScrolltop\" />\n" );
 
+               $encodedtext = htmlspecialchars( $this->safeUnicodeOutput( $this->textbox1 ) );
+               if( $encodedtext !== '' ) {
+                       // Ensure there's a newline at the end, otherwise adding lines
+                       // is awkward.
+                       // But don't add a newline if the ext is empty, or Firefox in XHTML
+                       // mode will show an extra newline. A bit annoying.
+                       $encodedtext .= "\n";
+               }
+
                $wgOut->addHTML( <<<END
 $recreate
 {$commentsubject}
 {$subjectpreview}
 {$this->editFormTextBeforeContent}
 <textarea tabindex='1' accesskey="," name="wpTextbox1" id="wpTextbox1" rows='{$rows}'
-cols='{$cols}'{$ew} $hidden>
+cols='{$cols}'{$ew} $hidden>{$encodedtext}</textarea>
 END
-. htmlspecialchars( $this->safeUnicodeOutput( $this->textbox1 ) ) .
-"
-</textarea>
-               " );
+);
 
                $wgOut->wrapWikiMsg( "<div id=\"editpage-copywarn\">\n$1\n</div>", $copywarnMsg );
                $wgOut->addHTML( $this->editFormTextAfterWarn );
@@ -1391,7 +1412,7 @@ END
 </div>
 ");
 
-               if ( $this->isConflict ) {
+               if ( $this->isConflict && wfRunHooks( 'EditPageBeforeConflictDiff', array( &$this, &$wgOut ) ) ) {
                        $wgOut->wrapWikiMsg( '==$1==', "yourdiff" );
 
                        $de = new DifferenceEngine( $this->mTitle );
@@ -1453,10 +1474,8 @@ END
         * of the preview button
         */
        function doLivePreviewScript() {
-               global $wgStylePath, $wgJsMimeType, $wgStyleVersion, $wgOut, $wgTitle;
-               $wgOut->addHTML( '<script type="'.$wgJsMimeType.'" src="' .
-                       htmlspecialchars( "$wgStylePath/common/preview.js?$wgStyleVersion" ) .
-                       '"></script>' . "\n" );
+               global $wgOut, $wgTitle;
+               $wgOut->addScriptFile( 'preview.js' );
                $liveAction = $wgTitle->getLocalUrl( 'action=submit&wpPreview=true&live=true' );
                return "return !lpDoPreview(" .
                        "editform.wpTextbox1.value," .
@@ -1632,7 +1651,9 @@ END
                        $attribs = array( 'id' => 'wpTextbox1', 'name' => 'wpTextbox1', 'cols' => $cols, 'rows' => $rows, 'readonly' => 'readonly' );
                        $wgOut->addHtml( '<hr />' );
                        $wgOut->addWikiMsg( $first ? 'blockedoriginalsource' : 'blockededitsource', $this->mTitle->getPrefixedText() );
-                       $wgOut->addHtml( wfOpenElement( 'textarea', $attribs ) . htmlspecialchars( $source ) . wfCloseElement( 'textarea' ) );
+                       # Why we don't use Xml::element here?
+                       # Is it because if $source is '', it returns <textarea />?
+                       $wgOut->addHtml( Xml::openElement( 'textarea', $attribs ) . htmlspecialchars( $source ) . Xml::closeElement( 'textarea' ) );
                }
        }
 
@@ -1684,7 +1705,7 @@ END
                $wgOut->addHtml( '<div id="spamprotected">' );
                $wgOut->addWikiMsg( 'spamprotectiontext' );
                if ( $match )
-                       $wgOut->addWikiMsg( 'spamprotectionmatch',wfEscapeWikiText( $match ) );
+                       $wgOut->addWikiMsg( 'spamprotectionmatch', wfEscapeWikiText( $match ) );
                $wgOut->addHtml( '</div>' );
 
                $wgOut->returnToMain( false, $wgTitle );
@@ -1773,10 +1794,12 @@ END
        /**
         * Shows a bulletin board style toolbar for common editing functions.
         * It can be disabled in the user preferences.
-        * The necessary JavaScript code can be found in style/wikibits.js.
+        * The necessary JavaScript code can be found in skins/common/edit.js.
+        * 
+        * @return string
         */
-       function getEditToolbar() {
-               global $wgStylePath, $wgContLang, $wgJsMimeType;
+       static function getEditToolbar() {
+               global $wgStylePath, $wgContLang, $wgLang, $wgJsMimeType;
 
                /**
                 * toolarray an array of arrays which each include the filename of
@@ -1790,93 +1813,104 @@ END
                 * sure these keys are not defined on the edit page.
                 */
                $toolarray = array(
-                       array(  'image' => 'button_bold.png',
-                               'id'    => 'mw-editbutton-bold',
-                               'open'  => '\'\'\'',
-                               'close' => '\'\'\'',
-                               'sample'=> wfMsg('bold_sample'),
-                               'tip'   => wfMsg('bold_tip'),
-                               'key'   => 'B'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-bold'),
+                               'id'     => 'mw-editbutton-bold',
+                               'open'   => '\'\'\'',
+                               'close'  => '\'\'\'',
+                               'sample' => wfMsg('bold_sample'),
+                               'tip'    => wfMsg('bold_tip'),
+                               'key'    => 'B'
                        ),
-                       array(  'image' => 'button_italic.png',
-                               'id'    => 'mw-editbutton-italic',
-                               'open'  => '\'\'',
-                               'close' => '\'\'',
-                               'sample'=> wfMsg('italic_sample'),
-                               'tip'   => wfMsg('italic_tip'),
-                               'key'   => 'I'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-italic'),
+                               'id'     => 'mw-editbutton-italic',
+                               'open'   => '\'\'',
+                               'close'  => '\'\'',
+                               'sample' => wfMsg('italic_sample'),
+                               'tip'    => wfMsg('italic_tip'),
+                               'key'    => 'I'
                        ),
-                       array(  'image' => 'button_link.png',
-                               'id'    => 'mw-editbutton-link',
-                               'open'  => '[[',
-                               'close' => ']]',
-                               'sample'=> wfMsg('link_sample'),
-                               'tip'   => wfMsg('link_tip'),
-                               'key'   => 'L'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-link'),
+                               'id'     => 'mw-editbutton-link',
+                               'open'   => '[[',
+                               'close'  => ']]',
+                               'sample' => wfMsg('link_sample'),
+                               'tip'    => wfMsg('link_tip'),
+                               'key'    => 'L'
                        ),
-                       array(  'image' => 'button_extlink.png',
-                               'id'    => 'mw-editbutton-extlink',
-                               'open'  => '[',
-                               'close' => ']',
-                               'sample'=> wfMsg('extlink_sample'),
-                               'tip'   => wfMsg('extlink_tip'),
-                               'key'   => 'X'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-extlink'),
+                               'id'     => 'mw-editbutton-extlink',
+                               'open'   => '[',
+                               'close'  => ']',
+                               'sample' => wfMsg('extlink_sample'),
+                               'tip'    => wfMsg('extlink_tip'),
+                               'key'    => 'X'
                        ),
-                       array(  'image' => 'button_headline.png',
-                               'id'    => 'mw-editbutton-headline',
-                               'open'  => "\n== ",
-                               'close' => " ==\n",
-                               'sample'=> wfMsg('headline_sample'),
-                               'tip'   => wfMsg('headline_tip'),
-                               'key'   => 'H'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-headline'),
+                               'id'     => 'mw-editbutton-headline',
+                               'open'   => "\n== ",
+                               'close'  => " ==\n",
+                               'sample' => wfMsg('headline_sample'),
+                               'tip'    => wfMsg('headline_tip'),
+                               'key'    => 'H'
                        ),
-                       array(  'image' => 'button_image.png',
-                               'id'    => 'mw-editbutton-image',
-                               'open'  => '[['.$wgContLang->getNsText(NS_IMAGE).":",
-                               'close' => ']]',
-                               'sample'=> wfMsg('image_sample'),
-                               'tip'   => wfMsg('image_tip'),
-                               'key'   => 'D'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-image'),
+                               'id'     => 'mw-editbutton-image',
+                               'open'   => '[['.$wgContLang->getNsText(NS_IMAGE).':',
+                               'close'  => ']]',
+                               'sample' => wfMsg('image_sample'),
+                               'tip'    => wfMsg('image_tip'),
+                               'key'    => 'D'
                        ),
-                       array(  'image' => 'button_media.png',
-                               'id'    => 'mw-editbutton-media',
-                               'open'  => '[['.$wgContLang->getNsText(NS_MEDIA).':',
-                               'close' => ']]',
-                               'sample'=> wfMsg('media_sample'),
-                               'tip'   => wfMsg('media_tip'),
-                               'key'   => 'M'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-media'),
+                               'id'     => 'mw-editbutton-media',
+                               'open'   => '[['.$wgContLang->getNsText(NS_MEDIA).':',
+                               'close'  => ']]',
+                               'sample' => wfMsg('media_sample'),
+                               'tip'    => wfMsg('media_tip'),
+                               'key'    => 'M'
                        ),
-                       array(  'image' => 'button_math.png',
-                               'id'    => 'mw-editbutton-math',
-                               'open'  => "<math>",
-                               'close' => "</math>",
-                               'sample'=> wfMsg('math_sample'),
-                               'tip'   => wfMsg('math_tip'),
-                               'key'   => 'C'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-math'),
+                               'id'     => 'mw-editbutton-math',
+                               'open'   => "<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>",
-                               'sample'=> wfMsg('nowiki_sample'),
-                               'tip'   => wfMsg('nowiki_tip'),
-                               'key'   => 'N'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-nowiki'),
+                               'id'     => 'mw-editbutton-nowiki',
+                               'open'   => "<nowiki>",
+                               'close'  => "</nowiki>",
+                               'sample' => wfMsg('nowiki_sample'),
+                               'tip'    => wfMsg('nowiki_tip'),
+                               'key'    => 'N'
                        ),
-                       array(  'image' => 'button_sig.png',
-                               'id'    => 'mw-editbutton-signature',
-                               'open'  => '--~~~~',
-                               'close' => '',
-                               'sample'=> '',
-                               'tip'   => wfMsg('sig_tip'),
-                               'key'   => 'Y'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-sig'),
+                               'id'     => 'mw-editbutton-signature',
+                               'open'   => '--~~~~',
+                               'close'  => '',
+                               'sample' => '',
+                               'tip'    => wfMsg('sig_tip'),
+                               'key'    => 'Y'
                        ),
-                       array(  'image' => 'button_hr.png',
-                               'id'    => 'mw-editbutton-hr',
-                               'open'  => "\n----\n",
-                               'close' => '',
-                               'sample'=> '',
-                               'tip'   => wfMsg('hr_tip'),
-                               'key'   => 'R'
+                       array(
+                               'image'  => $wgLang->getImageFile('button-hr'),
+                               'id'     => 'mw-editbutton-hr',
+                               'open'   => "\n----\n",
+                               'close'  => '',
+                               'sample' => '',
+                               'tip'    => wfMsg('hr_tip'),
+                               'key'    => 'R'
                        )
                );
                $toolbar = "<div id='toolbar'>\n";
@@ -1972,7 +2006,7 @@ END
                        'accesskey' => wfMsg('accesskey-save'),
                        'title'     => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']',
                );
-               $buttons['save'] = wfElement('input', $temp, '');
+               $buttons['save'] = Xml::element('input', $temp, '');
 
                ++$tabindex; // use the same for preview and live preview
                if ( $wgLivePreview && $wgUser->getOption( 'uselivepreview' ) ) {
@@ -1986,7 +2020,7 @@ END
                                'title'     => wfMsg( 'tooltip-preview' ).' ['.wfMsg( 'accesskey-preview' ).']',
                                'style'     => 'display: none;',
                        );
-                       $buttons['preview'] = wfElement('input', $temp, '');
+                       $buttons['preview'] = Xml::element('input', $temp, '');
 
                        $temp = array(
                                'id'        => 'wpLivePreview',
@@ -1998,7 +2032,7 @@ END
                                'title'     => '',
                                'onclick'   => $this->doLivePreviewScript(),
                        );
-                       $buttons['live'] = wfElement('input', $temp, '');
+                       $buttons['live'] = Xml::element('input', $temp, '');
                } else {
                        $temp = array(
                                'id'        => 'wpPreview',
@@ -2009,7 +2043,7 @@ END
                                'accesskey' => wfMsg('accesskey-preview'),
                                'title'     => wfMsg( 'tooltip-preview' ).' ['.wfMsg( 'accesskey-preview' ).']',
                        );
-                       $buttons['preview'] = wfElement('input', $temp, '');
+                       $buttons['preview'] = Xml::element('input', $temp, '');
                        $buttons['live'] = '';
                }
 
@@ -2022,7 +2056,7 @@ END
                        'accesskey' => wfMsg('accesskey-diff'),
                        'title'     => wfMsg( 'tooltip-diff' ).' ['.wfMsg( 'accesskey-diff' ).']',
                );
-               $buttons['diff'] = wfElement('input', $temp, '');
+               $buttons['diff'] = Xml::element('input', $temp, '');
 
                wfRunHooks( 'EditPageBeforeEditButtons', array( &$this, &$buttons ) );
                return $buttons;