r111413 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111412‎ | r111413 | r111414 >
Date:20:26, 13 February 2012
Author:robin
Status:ok (Comments)
Tags:
Comment:
Remove all usage of wfUILang(), deprecated in 1.18. Also some other minor tweaks. Didn't remove wfUILang itself yet in case someone uses older versions of the extensions with trunk/1.20.
Modified paths:
  • /trunk/extensions/CodeReview/ui/CodeRevisionView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/frontend/specialpages/reports/ReviewedPages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/frontend/specialpages/reports/UnreviewedPages_body.php (modified) (history)
  • /trunk/extensions/GlobalUsage/SpecialGlobalUsage.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/TalkpageView.php (modified) (history)
  • /trunk/extensions/OggHandler/OggHandler_body.php (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -1282,7 +1282,7 @@
12831283
12841284 /**
12851285 * Old function when $wgBetterDirectionality existed
1286 - * Removed in core, kept in extensions for backwards compat.
 1286+ * All usage removed, wfUILang can be removed in near future
12871287 *
12881288 * @deprecated since 1.18
12891289 * @return Language
Index: trunk/extensions/LiquidThreads/pages/TalkpageView.php
@@ -286,7 +286,7 @@
287287 // This closes the div of mw-content-ltr/rtl containing lang and dir attributes
288288 $this->output->addHTML(
289289 Html::closeElement( 'div' ) . Html::openElement( 'div',
290 - array( 'class' => 'lqt-talkpage', 'lang' => $wgLang->getCode(), 'dir' => wfUILang()->getDir() )
 290+ array( 'class' => 'lqt-talkpage', 'lang' => $wgLang->getCode(), 'dir' => $wgLang->getDir() )
291291 ) );
292292 }
293293
@@ -560,11 +560,11 @@
561561 * Stolen from TablePager because it's pretty.
562562 */
563563 function getNavigationBar() {
564 - global $wgStylePath;
565 -
566564 if ( method_exists( $this, 'isNavigationBarShown' ) &&
567 - !$this->isNavigationBarShown() )
 565+ !$this->isNavigationBarShown() ) {
568566 return '';
 567+ }
 568+ global $wgStylePath, $wgLang;
569569
570570 $path = "$wgStylePath/common/images";
571571 $labels = array(
@@ -585,7 +585,7 @@
586586 'next' => 'arrow_disabled_right_25.png',
587587 'last' => 'arrow_disabled_last_25.png',
588588 );
589 - if( wfUILang()->isRTL() ) {
 589+ if( $wgLang->isRTL() ) {
590590 $keys = array_keys( $labels );
591591 $images = array_combine( $keys, array_reverse( $images ) );
592592 $disabledImages = array_combine( $keys, array_reverse( $disabledImages ) );
Index: trunk/extensions/OggHandler/OggHandler_body.php
@@ -443,12 +443,11 @@
444444 }
445445
446446 function setHeaders( $out ) {
447 - global $wgOggScriptVersion, $wgCortadoJarFile;
448 -
449447 if ( $out->hasHeadItem( 'OggHandlerScript' ) && $out->hasHeadItem( 'OggHandlerInlineScript' ) &&
450448 $out->hasHeadItem( 'OggHandlerInlineCSS' ) ) {
451449 return;
452450 }
 451+ global $wgOggScriptVersion, $wgCortadoJarFile, $wgLang;
453452
454453 $msgNames = array( 'ogg-play', 'ogg-pause', 'ogg-stop', 'ogg-no-player',
455454 'ogg-player-videoElement', 'ogg-player-oggPlugin', 'ogg-player-cortado', 'ogg-player-vlc-mozilla',
@@ -461,13 +460,12 @@
462461 $cortadoUrl = $wgCortadoJarFile;
463462 $scriptPath = self::getMyScriptPath();
464463 if( substr( $cortadoUrl, 0, 1 ) != '/'
465 - && substr( $cortadoUrl, 0, 4 ) != 'http' )
466 - {
 464+ && substr( $cortadoUrl, 0, 4 ) != 'http' ) {
467465 $cortadoUrl = wfExpandUrl( "$scriptPath/$cortadoUrl", PROTO_CURRENT );
468466 }
469467 $encCortadoUrl = Xml::encodeJsVar( $cortadoUrl );
470468 $encExtPathUrl = Xml::encodeJsVar( $scriptPath );
471 - $alignStart = wfUILang()->alignStart();
 469+ $alignStart = $wgLang->alignStart();
472470
473471 $out->addHeadItem( 'OggHandlerScript' , Html::linkedScript( "{$scriptPath}/OggPlayer.js?$wgOggScriptVersion" ) );
474472
Index: trunk/extensions/FlaggedRevs/frontend/specialpages/reports/UnreviewedPages_body.php
@@ -109,7 +109,7 @@
110110
111111 $stxt = $underReview = $watching = '';
112112 $link = Linker::link( $title, null, array(), 'redirect=no' );
113 - $dirmark = wfUILang()->getDirMark();
 113+ $dirmark = $this->getLang()->getDirMark();
114114 $hist = Linker::linkKnown( $title, wfMsgHtml( 'hist' ), array(), 'action=history' );
115115 if ( !is_null( $size = $row->page_len ) ) {
116116 $stxt = ( $size == 0 )
Index: trunk/extensions/FlaggedRevs/frontend/specialpages/reports/ReviewedPages_body.php
@@ -82,12 +82,9 @@
8383
8484 public function formatRow( $row ) {
8585 $title = Title::newFromRow( $row );
86 - # Link to page
87 - $link = Linker::link( $title );
88 - # Direction mark
89 - $dirmark = wfUILang()->getDirMark();
90 - # Size (bytes)
91 - $stxt = '';
 86+ $link = Linker::link( $title ); # Link to page
 87+ $dirmark = $this->getLang()->getDirMark(); # Direction mark
 88+ $stxt = ''; # Size (bytes)
9289 if ( !is_null( $size = $row->page_len ) ) {
9390 if ( $size == 0 ) {
9491 $stxt = ' <small>' . wfMsgHtml( 'historyempty' ) . '</small>';
Index: trunk/extensions/GlobalUsage/SpecialGlobalUsage.php
@@ -63,7 +63,7 @@
6464 $html .= Linker::makeThumbLinkObj( $this->target,
6565 wfFindFile( $this->target ),
6666 /* $label */ $this->target->getPrefixedText(),
67 - /* $alt */ '', /* $align */ wfUILang()->alignEnd(),
 67+ /* $alt */ '', /* $align */ $this->getLang()->alignEnd(),
6868 /* $handlerParams */ array(), /* $framed */ false,
6969 /* $manualThumb */ false );
7070 }
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php
@@ -231,7 +231,7 @@
232232 if ( $prev ) {
233233 $prevTarget = SpecialPage::getTitleFor( 'Code', "$repo/$prev" );
234234 $links[] = '&lt;&#160;' . $this->skin->link( $prevTarget, $this->mRev->getIdString( $prev ),
235 - array(), array( 'path' => $this->mPath ) ).wfUILang()->getDirMark();
 235+ array(), array( 'path' => $this->mPath ) ).$wgLang->getDirMark();
236236 }
237237
238238 $revText = "<b>" . $this->mRev->getIdString( $rev ) . "</b>";
@@ -239,7 +239,7 @@
240240 if ( $viewvc ) {
241241 $url = htmlspecialchars( "$viewvc/?view=rev&revision=$rev" );
242242 $viewvcTxt = wfMsgHtml( 'code-rev-rev-viewvc' );
243 - $revText .= " (<a href=\"$url\" title=\"revision $rev\">$viewvcTxt</a>)".wfUILang()->getDirMark();
 243+ $revText .= " (<a href=\"$url\" title=\"revision $rev\">$viewvcTxt</a>)".$wgLang->getDirMark();
244244 }
245245 $links[] = $revText;
246246
@@ -820,7 +820,8 @@
821821 * @return string
822822 */
823823 protected function commentStyle( $comment ) {
824 - $align = wfUILang()->AlignStart();
 824+ global $wgLang;
 825+ $align = $wgLang->AlignStart();
825826 $depth = $comment->threadDepth();
826827 $margin = ( $depth - 1 ) * 48;
827828 return "margin-$align: ${margin}px";

Comments

#Comment by Aaron Schulz (talk | contribs)   20:28, 13 February 2012

Why were global declaration moved down a few lines?

#Comment by SPQRobin (talk | contribs)   20:34, 13 February 2012

When there's an if() { return; } where globals aren't used, I'd say it's better to move them below that..

Status & tagging log