From 9e7167bbca031ab3df537dcd36204eb3d72e82f3 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 16 Jul 2011 19:19:01 +0000 Subject: [PATCH] * Use wfMessage() instead of OutputPage::addWikiMsgArray() with the third parameter * In EditPage.php: call Linker methods statically --- includes/EditPage.php | 49 ++++++++++++----------------- includes/OutputPage.php | 9 +++--- includes/actions/RollbackAction.php | 4 +-- 3 files changed, 26 insertions(+), 36 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 16fd9fa981..750771f5eb 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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 '
' . wfMsgExt( $key, 'parseinline', $username, "$comment" ) . 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' ) ) . '
' ); @@ -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( '
' ); - $wgOut->addWikiMsgArray( $msg, array() ); + $wgOut->addWikiMsg( $msg ); $wgOut->addHTML( '
' ); } } protected function showEditTools() { global $wgOut; - $wgOut->addHTML( '
' ); - $wgOut->addWikiMsgArray( 'edittools', array(), array( 'content' ) ); - $wgOut->addHTML( '
' ); + $wgOut->addHTML( '
' . + wfMessage( 'edittools' )->inContentLanguage()->parse() . + '
' ); } protected function getCopywarn() { @@ -1909,7 +1906,7 @@ HTML } protected function showStandardInputs( &$tabindex = 2 ) { - global $wgOut, $wgUser; + global $wgOut; $wgOut->addHTML( "
\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( "
" . implode( $checkboxes, "\n" ) . "
\n" ); $wgOut->addHTML( "
\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 ) . " "; } } @@ -2532,7 +2526,7 @@ HTML $checkboxes['watch'] = Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) . " "; } 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 ); } diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 9ea73ef55d..1aaf8eeee6 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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->addHTML( wfMessage( 'loginreqpagetext' )->rawParams( $loginLink )->parse() . + "\n' ); # Don't return to the main page if the user can't read it # otherwise we'll end up in a pointless loop diff --git a/includes/actions/RollbackAction.php b/includes/actions/RollbackAction.php index 485177c1b6..9036ebf5e6 100644 --- a/includes/actions/RollbackAction.php +++ b/includes/actions/RollbackAction.php @@ -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() ); } } -- 2.20.1