r91135 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91134‎ | r91135 | r91136 >
Date:23:03, 29 June 2011
Author:krinkle
Status:ok
Tags:
Comment:
Use constants instead of meaningless values
Modified paths:
  • /trunk/tools/ToolserverI18N/Defines.php (added) (history)
  • /trunk/tools/ToolserverI18N/ToolStart.php (modified) (history)
  • /trunk/tools/ToolserverI18N/TsIntuition.php (modified) (history)

Diff [purge]

Index: trunk/tools/ToolserverI18N/TsIntuition.php
@@ -959,7 +959,7 @@
960960 * - false: Disable this message all together.
961961 * @return The HTML for the promo box.
962962 */
963 - public function getPromoBox( $imgSize = 28, $helpTranslateDomain = null ) {
 963+ public function getPromoBox( $imgSize = 28, $helpTranslateDomain = TSINT_HELP_CURRENT ) {
964964
965965 // Logo
966966 if ( is_int( $imgSize ) && $imgSize > 0 ) {
@@ -992,18 +992,24 @@
993993 $change = $this->msg( 'bl-changelanguage', 'tsintuition' );
994994
995995 // Help translation
996 - if ( $helpTranslateDomain === true ) {
 996+ if ( $helpTranslateDomain === TSINT_HELP_ALL ) {
997997 $helpTranslateDomain = '0-all';
998998 $twLinkText = $this->msg( 'help-translate-all', 'tsintuition' );
999 - } elseif ( is_null( $helpTranslateDomain ) ) {
 999+
 1000+ } elseif ( $helpTranslateDomain === TSINT_HELP_CURRENT ) {
10001001 $helpTranslateDomain = $this->getDomain();
10011002 $twLinkText = $this->msg( 'help-translate-tool', 'tsintuition' );
1002 - } else {
 1003+
 1004+ } else { // TSINT_HELP_NONE
10031005 $twLinkText = $this->msg( 'help-translate-tool', 'tsintuition' );
10041006 }
 1007+
10051008 $helpTranslateLink = '';
 1009+
10061010 if ( is_string( $helpTranslateDomain ) ) {
 1011+
10071012 $helpTranslateDomain = strtolower( $helpTranslateDomain );
 1013+
10081014 // http://translatewiki.net/w/i.php?language=nl&title=Special:Translate&group=tsint-0-all
10091015 $twParams = array(
10101016 'title' => 'Special:Translate',
@@ -1024,7 +1030,7 @@
10251031 * Show a typical "powered by .." footer line.
10261032 * Same as getPromoBox() but without the image.
10271033 */
1028 - public function getFooterLine( $helpTranslateDomain = null ) {
 1034+ public function getFooterLine( $helpTranslateDomain = TSINT_HELP_CURRENT ) {
10291035 return $this->getPromoBox( 'no-image', $helpTranslateDomain );
10301036 }
10311037
Index: trunk/tools/ToolserverI18N/ToolStart.php
@@ -20,5 +20,6 @@
2121
2222
2323 // Files
 24+require_once( __DIR__ . '/Defines.php' )
2425 require_once( __DIR__ . '/TsIntuitionUtil.php' );
2526 require_once( __DIR__ . '/TsIntuition.php' );
Index: trunk/tools/ToolserverI18N/Defines.php
@@ -0,0 +1,15 @@
 2+<?php
 3+/**
 4+ *
 5+ * Created on March 23, 2011
 6+ *
 7+ * @package TsIntuition
 8+ */
 9+
 10+/**
 11+ * This file defines constants for Toolserver Intuition.
 12+ */
 13+
 14+define( 'TSINT_HELP_ALL', true );
 15+define( 'TSINT_HELP_NONE', false );
 16+define( 'TSINT_HELP_CURRENT', null );
Property changes on: trunk/tools/ToolserverI18N/Defines.php
___________________________________________________________________
Added: svn:eol-style
117 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r91136follow-up r91135: update demoskrinkle23:06, 29 June 2011
r91139Oh, I know you did send me back to the future. But I'm back! I'm back from th...krinkle23:10, 29 June 2011

Status & tagging log