* Use wfMessage() instead of OutputPage::addWikiMsgArray() with the third parameter
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 16 Jul 2011 19:19:01 +0000 (19:19 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 16 Jul 2011 19:19:01 +0000 (19:19 +0000)
* In EditPage.php: call Linker methods statically

includes/EditPage.php
includes/OutputPage.php
includes/actions/RollbackAction.php

index 16fd9fa..750771f 100644 (file)
@@ -1324,8 +1324,6 @@ class EditPage {
 
                wfProfileIn( __METHOD__ );
 
-               $sk = $wgUser->getSkin();
-
                #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
                #we parse this near the beginning so that setHeaders can do the title
@@ -1366,10 +1364,10 @@ class EditPage {
                $wgOut->addHTML( $this->editFormTextTop );
 
                $templates = $this->getTemplates();
-               $formattedtemplates = $sk->formatTemplates( $templates, $this->preview, $this->section != '');
+               $formattedtemplates = Linker::formatTemplates( $templates, $this->preview, $this->section != '');
 
                $hiddencats = $this->mArticle->getHiddenCategories();
-               $formattedhiddencats = $sk->formatHiddenCategories( $hiddencats );
+               $formattedhiddencats = Linker::formatHiddenCategories( $hiddencats );
 
                if ( $this->wasDeletedSinceLastEdit() && 'save' != $this->formtype ) {
                        $wgOut->wrapWikiMsg(
@@ -1408,7 +1406,7 @@ HTML
                                '<div class="mw-confirm-recreate">' .
                                wfMsgExt( $key, 'parseinline', $username, "<nowiki>$comment</nowiki>" ) .
                                Xml::checkLabel( wfMsg( 'recreate' ), 'wpRecreate', 'wpRecreate', false,
-                                       array( 'title' => $sk->titleAttrib( 'recreate' ), 'tabindex' => 1, 'id' => 'wpRecreate' )
+                                       array( 'title' => Linker::titleAttrib( 'recreate' ), 'tabindex' => 1, 'id' => 'wpRecreate' )
                                ) .
                                '</div>'
                        );
@@ -1696,15 +1694,14 @@ HTML
                if ( !$summary || ( !$this->preview && !$this->diff ) )
                        return "";
 
-               global $wgParser, $wgUser;
-               $sk = $wgUser->getSkin();
+               global $wgParser;
 
                if ( $isSubjectPreview )
                        $summary = wfMsgForContent( 'newsectionsummary', $wgParser->stripSectionName( $summary ) );
 
                $message = $isSubjectPreview ? 'subject-preview' : 'summary-preview';
 
-               $summary = wfMsgExt( $message, 'parseinline' ) . $sk->commentBlock( $summary, $this->mTitle, $isSubjectPreview );
+               $summary = wfMsgExt( $message, 'parseinline' ) . Linker::commentBlock( $summary, $this->mTitle, $isSubjectPreview );
                return Xml::tags( 'div', array( 'class' => 'mw-summary-preview' ), $summary );
        }
 
@@ -1879,16 +1876,16 @@ HTML
                if( !wfMessage( $msg )->isDisabled() ) {
                        global $wgOut;
                        $wgOut->addHTML( '<div class="mw-tos-summary">' );
-                       $wgOut->addWikiMsgArray( $msg, array() );
+                       $wgOut->addWikiMsg( $msg );
                        $wgOut->addHTML( '</div>' );
                }
        }
 
        protected function showEditTools() {
                global $wgOut;
-               $wgOut->addHTML( '<div class="mw-editTools">' );
-               $wgOut->addWikiMsgArray( 'edittools', array(), array( 'content' ) );
-               $wgOut->addHTML( '</div>' );
+               $wgOut->addHTML( '<div class="mw-editTools">' .
+                       wfMessage( 'edittools' )->inContentLanguage()->parse() .
+                       '</div>' );
        }
 
        protected function getCopywarn() {
@@ -1909,7 +1906,7 @@ HTML
        }
 
        protected function showStandardInputs( &$tabindex = 2 ) {
-               global $wgOut, $wgUser;
+               global $wgOut;
                $wgOut->addHTML( "<div class='editOptions'>\n" );
 
                if ( $this->section != 'new' ) {
@@ -1917,7 +1914,7 @@ HTML
                        $wgOut->addHTML( $this->getSummaryPreview( false, $this->summary ) );
                }
 
-               $checkboxes = $this->getCheckboxes( $tabindex, $wgUser->getSkin(),
+               $checkboxes = $this->getCheckboxes( $tabindex,
                        array( 'minor' => $this->minoredit, 'watch' => $this->watchthis ) );
                $wgOut->addHTML( "<div class='editCheckboxes'>" . implode( $checkboxes, "\n" ) . "</div>\n" );
                $wgOut->addHTML( "<div class='editButtons'>\n" );
@@ -2151,23 +2148,21 @@ HTML
         * Produce the stock "please login to edit pages" page
         */
        function userNotLoggedInPage() {
-               global $wgUser, $wgOut;
-               $skin = $wgUser->getSkin();
+               global $wgOut;
 
                $loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
-               $loginLink = $skin->link(
+               $loginLink = Linker::linkKnown(
                        $loginTitle,
                        wfMsgHtml( 'loginreqlink' ),
                        array(),
-                       array( 'returnto' => $this->getContextTitle()->getPrefixedText() ),
-                       array( 'known', 'noclasses' )
+                       array( 'returnto' => $this->getContextTitle()->getPrefixedText() )
                );
 
                $wgOut->setPageTitle( wfMsg( 'whitelistedittitle' ) );
                $wgOut->setRobotPolicy( 'noindex,nofollow' );
                $wgOut->setArticleRelated( false );
 
-               $wgOut->addWikiMsgArray( 'whitelistedittext', array( $loginLink ), array( 'replaceafter' ) );
+               $wgOut->addHTML( wfMessage( 'whitelistedittext' )->rawParams( $loginLink )->parse() );
                $wgOut->returnToMain( false, $this->getContextTitle() );
        }
 
@@ -2492,13 +2487,12 @@ HTML
         * minor and watch
         *
         * @param $tabindex Current tabindex
-        * @param $skin Skin object
         * @param $checked Array of checkbox => bool, where bool indicates the checked
         *                 status of the checkbox
         *
         * @return array
         */
-       public function getCheckboxes( &$tabindex, $skin, $checked ) {
+       public function getCheckboxes( &$tabindex, $checked ) {
                global $wgUser;
 
                $checkboxes = array();
@@ -2516,7 +2510,7 @@ HTML
                                $checkboxes['minor'] =
                                        Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) .
                                        "&#160;<label for='wpMinoredit' id='mw-editpage-minoredit'" .
-                                       Xml::expandAttributes( array( 'title' => $skin->titleAttrib( 'minoredit', 'withaccess' ) ) ) .
+                                       Xml::expandAttributes( array( 'title' => Linker::titleAttrib( 'minoredit', 'withaccess' ) ) ) .
                                        ">{$minorLabel}</label>";
                        }
                }
@@ -2532,7 +2526,7 @@ HTML
                        $checkboxes['watch'] =
                                Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) .
                                "&#160;<label for='wpWatchthis' id='mw-editpage-watch'" .
-                               Xml::expandAttributes( array( 'title' => $skin->titleAttrib( 'watch', 'withaccess' ) ) ) .
+                               Xml::expandAttributes( array( 'title' => Linker::titleAttrib( 'watch', 'withaccess' ) ) ) .
                                ">{$watchLabel}</label>";
                }
                wfRunHooks( 'EditPageBeforeEditChecks', array( &$this, &$checkboxes, &$tabindex ) );
@@ -2623,19 +2617,16 @@ HTML
         * @return string
         */
        public function getCancelLink() {
-               global $wgUser;
-
                $cancelParams = array();
                if ( !$this->isConflict && $this->mArticle->getOldID() > 0 ) {
                        $cancelParams['oldid'] = $this->mArticle->getOldID();
                }
 
-               return $wgUser->getSkin()->link(
+               return Linker::linkKnown(
                        $this->getContextTitle(),
                        wfMsgExt( 'cancel', array( 'parseinline' ) ),
                        array( 'id' => 'mw-editform-cancel' ),
-                       $cancelParams,
-                       array( 'known', 'noclasses' )
+                       $cancelParams
                );
        }
 
index 9ea73ef..1aaf8ee 100644 (file)
@@ -2019,15 +2019,14 @@ class OutputPage {
                $this->setArticleRelated( false );
 
                $loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
-               $loginLink = Linker::link(
+               $loginLink = Linker::linkKnown(
                        $loginTitle,
                        wfMsgHtml( 'loginreqlink' ),
                        array(),
-                       array( 'returnto' => $this->getTitle()->getPrefixedText() ),
-                       array( 'known', 'noclasses' )
+                       array( 'returnto' => $this->getTitle()->getPrefixedText() )
                );
-               $this->addWikiMsgArray( 'loginreqpagetext', array( $loginLink ), array( 'replaceafter' ) );
-               $this->addHTML( "\n<!--" . $this->getTitle()->getPrefixedUrl() . '-->' );
+               $this->addHTML( wfMessage( 'loginreqpagetext' )->rawParams( $loginLink )->parse() .
+                       "\n<!--" . $this->getTitle()->getPrefixedUrl() . '-->' );
 
                # Don't return to the main page if the user can't read it
                # otherwise we'll end up in a pointless loop
index 485177c..9036ebf 100644 (file)
@@ -63,8 +63,8 @@ class RollbackAction extends FormlessAction {
                                $current = $details['current'];
 
                                if ( $current->getComment() != '' ) {
-                                       $this->getOutput()->addWikiMsgArray( 'editcomment', array(
-                                               Linker::formatComment( $current->getComment() ) ), array( 'replaceafter' ) );
+                                       $this->getOutput()->addHTML( wfMessage( 'editcomment' )->rawParams(
+                                               Linker::formatComment( $current->getComment() ) )->parse() );
                                }
                        }