r106029 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106028‎ | r106029 | r106030 >
Date:15:40, 13 December 2011
Author:reedy
Status:ok
Tags:
Comment:
Public for all
Modified paths:
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/Language.php
@@ -2669,7 +2669,7 @@
26702670 * @param $nocommafy Bool: set to true for special numbers like dates
26712671 * @return string
26722672 */
2673 - function formatNum( $number, $nocommafy = false ) {
 2673+ public function formatNum( $number, $nocommafy = false ) {
26742674 global $wgTranslateNumerals;
26752675 if ( !$nocommafy ) {
26762676 $number = $this->commafy( $number );
@@ -2814,7 +2814,7 @@
28152815 * @return string
28162816 */
28172817 function commaList( array $list ) {
2818 - return implode(
 2818+ return implode(
28192819 wfMsgExt(
28202820 'comma-separator',
28212821 array( 'parsemag', 'escapenoentities', 'language' => $this )
@@ -2830,7 +2830,7 @@
28312831 * @return string
28322832 */
28332833 function semicolonList( array $list ) {
2834 - return implode(
 2834+ return implode(
28352835 wfMsgExt(
28362836 'semicolon-separator',
28372837 array( 'parsemag', 'escapenoentities', 'language' => $this )
@@ -2845,7 +2845,7 @@
28462846 * @return string
28472847 */
28482848 function pipeList( array $list ) {
2849 - return implode(
 2849+ return implode(
28502850 wfMsgExt(
28512851 'pipe-separator',
28522852 array( 'escapenoentities', 'language' => $this )
@@ -3245,7 +3245,7 @@
32463246 * @param $text String
32473247 * @return String
32483248 */
3249 - function segmentForDiff( $text ) {
 3249+ public function segmentForDiff( $text ) {
32503250 return $text;
32513251 }
32523252
@@ -3255,7 +3255,7 @@
32563256 * @param $text String
32573257 * @return String
32583258 */
3259 - function unsegmentForDiff( $text ) {
 3259+ public function unsegmentForDiff( $text ) {
32603260 return $text;
32613261 }
32623262
@@ -3263,7 +3263,7 @@
32643264 * Return the LanguageConverter used in the Language
32653265 * @return LanguageConverter
32663266 */
3267 - function getConverter() {
 3267+ public function getConverter() {
32683268 return $this->mConverter;
32693269 }
32703270
@@ -3273,7 +3273,7 @@
32743274 * @param $text string
32753275 * @return array
32763276 */
3277 - function autoConvertToAllVariants( $text ) {
 3277+ public function autoConvertToAllVariants( $text ) {
32783278 return $this->mConverter->autoConvertToAllVariants( $text );
32793279 }
32803280
@@ -3283,18 +3283,17 @@
32843284 * @param $text string
32853285 * @return string
32863286 */
3287 - function convert( $text ) {
 3287+ public function convert( $text ) {
32883288 return $this->mConverter->convert( $text );
32893289 }
32903290
3291 -
32923291 /**
32933292 * Convert a Title object to a string in the preferred variant
32943293 *
32953294 * @param $title Title
32963295 * @return string
32973296 */
3298 - function convertTitle( $title ) {
 3297+ public function convertTitle( $title ) {
32993298 return $this->mConverter->convertTitle( $title );
33003299 }
33013300
@@ -3303,15 +3302,16 @@
33043303 *
33053304 * @return bool
33063305 */
3307 - function hasVariants() {
 3306+ public function hasVariants() {
33083307 return sizeof( $this->getVariants() ) > 1;
33093308 }
33103309
33113310 /**
33123311 * Check if the language has the specific variant
 3312+ * @param $variant string
33133313 * @return bool
33143314 */
3315 - function hasVariant( $variant ) {
 3315+ public function hasVariant( $variant ) {
33163316 return (bool)$this->mConverter->validateVariant( $variant );
33173317 }
33183318
@@ -3321,7 +3321,7 @@
33223322 * @param $text string
33233323 * @return string
33243324 */
3325 - function armourMath( $text ) {
 3325+ public function armourMath( $text ) {
33263326 return $this->mConverter->armourMath( $text );
33273327 }
33283328
@@ -3332,7 +3332,7 @@
33333333 * @return string
33343334 * @todo this should get integrated somewhere sane
33353335 */
3336 - function convertHtml( $text, $isTitle = false ) {
 3336+ public function convertHtml( $text, $isTitle = false ) {
33373337 return htmlspecialchars( $this->convert( $text, $isTitle ) );
33383338 }
33393339
@@ -3340,7 +3340,7 @@
33413341 * @param $key string
33423342 * @return string
33433343 */
3344 - function convertCategoryKey( $key ) {
 3344+ public function convertCategoryKey( $key ) {
33453345 return $this->mConverter->convertCategoryKey( $key );
33463346 }
33473347
@@ -3350,28 +3350,28 @@
33513351 *
33523352 * @return array an array of language codes
33533353 */
3354 - function getVariants() {
 3354+ public function getVariants() {
33553355 return $this->mConverter->getVariants();
33563356 }
33573357
33583358 /**
33593359 * @return string
33603360 */
3361 - function getPreferredVariant() {
 3361+ public function getPreferredVariant() {
33623362 return $this->mConverter->getPreferredVariant();
33633363 }
33643364
33653365 /**
33663366 * @return string
33673367 */
3368 - function getDefaultVariant() {
 3368+ public function getDefaultVariant() {
33693369 return $this->mConverter->getDefaultVariant();
33703370 }
33713371
33723372 /**
33733373 * @return string
33743374 */
3375 - function getURLVariant() {
 3375+ public function getURLVariant() {
33763376 return $this->mConverter->getURLVariant();
33773377 }
33783378
@@ -3387,7 +3387,7 @@
33883388 * we need to transclude a template or update a category's link
33893389 * @return null the input parameters may be modified upon return
33903390 */
3391 - function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) {
 3391+ public function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) {
33923392 $this->mConverter->findVariantLink( $link, $nt, $ignoreOtherCond );
33933393 }
33943394
@@ -3402,7 +3402,7 @@
34033403 *
34043404 * @return string
34053405 */
3406 - function convertLinkToAllVariants( $text ) {
 3406+ public function convertLinkToAllVariants( $text ) {
34073407 return $this->mConverter->convertLinkToAllVariants( $text );
34083408 }
34093409
@@ -3423,7 +3423,7 @@
34243424 *
34253425 * @return string
34263426 */
3427 - function getParsedTitle() {
 3427+ public function getParsedTitle() {
34283428 return $this->mConverter->getParsedTitle();
34293429 }
34303430
@@ -3435,7 +3435,7 @@
34363436 * @param $noParse bool
34373437 * @return string the tagged text
34383438 */
3439 - function markNoConversion( $text, $noParse = false ) {
 3439+ public function markNoConversion( $text, $noParse = false ) {
34403440 return $this->mConverter->markNoConversion( $text, $noParse );
34413441 }
34423442
@@ -3445,7 +3445,7 @@
34463446 *
34473447 * @return string
34483448 */
3449 - function linkTrail() {
 3449+ public function linkTrail() {
34503450 return self::$dataCache->getItem( $this->mCode, 'linkTrail' );
34513451 }
34523452
@@ -3461,7 +3461,7 @@
34623462 *
34633463 * @return string
34643464 */
3465 - function getCode() {
 3465+ public function getCode() {
34663466 return $this->mCode;
34673467 }
34683468
@@ -3469,8 +3469,9 @@
34703470 * Get the code in Bcp47 format which we can use
34713471 * inside of html lang="" tags.
34723472 * @since 1.19
 3473+ * @return string
34733474 */
3474 - function getHtmlCode() {
 3475+ public function getHtmlCode() {
34753476 if ( is_null( $this->mHtmlCode ) ) {
34763477 $this->mHtmlCode = wfBCP47( $this->getCode() );
34773478 }
@@ -3480,7 +3481,7 @@
34813482 /**
34823483 * @param $code string
34833484 */
3484 - function setCode( $code ) {
 3485+ public function setCode( $code ) {
34853486 $this->mCode = $code;
34863487 // Ensure we don't leave an incorrect html code lying around
34873488 unset( $this->mHtmlCode );
@@ -3493,7 +3494,7 @@
34943495 * @param $suffix string Append this to the filename
34953496 * @return string $prefix . $mangledCode . $suffix
34963497 */
3497 - static function getFileName( $prefix = 'Language', $code, $suffix = '.php' ) {
 3498+ public static function getFileName( $prefix = 'Language', $code, $suffix = '.php' ) {
34983499 // Protect against path traversal
34993500 if ( !Language::isValidCode( $code )
35003501 || strcspn( $code, ":/\\\000" ) !== strlen( $code ) )
@@ -3511,7 +3512,7 @@
35123513 * @param $suffix string Suffix after the language code
35133514 * @return string Language code, or false if $prefix or $suffix isn't found
35143515 */
3515 - static function getCodeFromFileName( $filename, $prefix = 'Language', $suffix = '.php' ) {
 3516+ public static function getCodeFromFileName( $filename, $prefix = 'Language', $suffix = '.php' ) {
35163517 $m = null;
35173518 preg_match( '/' . preg_quote( $prefix, '/' ) . '([A-Z][a-z_]+)' .
35183519 preg_quote( $suffix, '/' ) . '/', $filename, $m );
@@ -3525,7 +3526,7 @@
35263527 * @param $code string
35273528 * @return string
35283529 */
3529 - static function getMessagesFileName( $code ) {
 3530+ public static function getMessagesFileName( $code ) {
35303531 global $IP;
35313532 $file = self::getFileName( "$IP/languages/messages/Messages", $code, '.php' );
35323533 wfRunHooks( 'Language::getMessagesFileName', array( $code, &$file ) );
@@ -3536,7 +3537,7 @@
35373538 * @param $code string
35383539 * @return string
35393540 */
3540 - static function getClassFileName( $code ) {
 3541+ public static function getClassFileName( $code ) {
35413542 global $IP;
35423543 return self::getFileName( "$IP/languages/classes/Language", $code, '.php' );
35433544 }
@@ -3548,7 +3549,7 @@
35493550 *
35503551 * @return false|string
35513552 */
3552 - static function getFallbackFor( $code ) {
 3553+ public static function getFallbackFor( $code ) {
35533554 if ( $code === 'en' || !Language::isValidBuiltInCode( $code ) ) {
35543555 return false;
35553556 } else {
@@ -3565,7 +3566,7 @@
35663567 * @param $code string Language code
35673568 * @return array
35683569 */
3569 - static function getFallbacksFor( $code ) {
 3570+ public static function getFallbacksFor( $code ) {
35703571 if ( $code === 'en' || !Language::isValidBuiltInCode( $code ) ) {
35713572 return array();
35723573 } else {
@@ -3587,7 +3588,7 @@
35883589 *
35893590 * @return array
35903591 */
3591 - static function getMessagesFor( $code ) {
 3592+ public static function getMessagesFor( $code ) {
35923593 return self::getLocalisationCache()->getItem( $code, 'messages' );
35933594 }
35943595
@@ -3599,7 +3600,7 @@
36003601 *
36013602 * @return string
36023603 */
3603 - static function getMessageFor( $key, $code ) {
 3604+ public static function getMessageFor( $key, $code ) {
36043605 return self::getLocalisationCache()->getSubitem( $code, 'messages', $key );
36053606 }
36063607
@@ -3611,7 +3612,7 @@
36123613 * @param $code string Language code
36133614 * @return array of message keys (strings)
36143615 */
3615 - static function getMessageKeysFor( $code ) {
 3616+ public static function getMessageKeysFor( $code ) {
36163617 return self::getLocalisationCache()->getSubItemList( $code, 'messages' );
36173618 }
36183619
@@ -3926,7 +3927,7 @@
39273928 *
39283929 * @return string
39293930 */
3930 - function getConvRuleTitle() {
 3931+ public function getConvRuleTitle() {
39313932 return $this->mConverter->getConvRuleTitle();
39323933 }
39333934 }

Status & tagging log