Index: trunk/phase3/languages/Language.php |
— | — | @@ -2669,7 +2669,7 @@ |
2670 | 2670 | * @param $nocommafy Bool: set to true for special numbers like dates |
2671 | 2671 | * @return string |
2672 | 2672 | */ |
2673 | | - function formatNum( $number, $nocommafy = false ) { |
| 2673 | + public function formatNum( $number, $nocommafy = false ) { |
2674 | 2674 | global $wgTranslateNumerals; |
2675 | 2675 | if ( !$nocommafy ) { |
2676 | 2676 | $number = $this->commafy( $number ); |
— | — | @@ -2814,7 +2814,7 @@ |
2815 | 2815 | * @return string |
2816 | 2816 | */ |
2817 | 2817 | function commaList( array $list ) { |
2818 | | - return implode( |
| 2818 | + return implode( |
2819 | 2819 | wfMsgExt( |
2820 | 2820 | 'comma-separator', |
2821 | 2821 | array( 'parsemag', 'escapenoentities', 'language' => $this ) |
— | — | @@ -2830,7 +2830,7 @@ |
2831 | 2831 | * @return string |
2832 | 2832 | */ |
2833 | 2833 | function semicolonList( array $list ) { |
2834 | | - return implode( |
| 2834 | + return implode( |
2835 | 2835 | wfMsgExt( |
2836 | 2836 | 'semicolon-separator', |
2837 | 2837 | array( 'parsemag', 'escapenoentities', 'language' => $this ) |
— | — | @@ -2845,7 +2845,7 @@ |
2846 | 2846 | * @return string |
2847 | 2847 | */ |
2848 | 2848 | function pipeList( array $list ) { |
2849 | | - return implode( |
| 2849 | + return implode( |
2850 | 2850 | wfMsgExt( |
2851 | 2851 | 'pipe-separator', |
2852 | 2852 | array( 'escapenoentities', 'language' => $this ) |
— | — | @@ -3245,7 +3245,7 @@ |
3246 | 3246 | * @param $text String |
3247 | 3247 | * @return String |
3248 | 3248 | */ |
3249 | | - function segmentForDiff( $text ) { |
| 3249 | + public function segmentForDiff( $text ) { |
3250 | 3250 | return $text; |
3251 | 3251 | } |
3252 | 3252 | |
— | — | @@ -3255,7 +3255,7 @@ |
3256 | 3256 | * @param $text String |
3257 | 3257 | * @return String |
3258 | 3258 | */ |
3259 | | - function unsegmentForDiff( $text ) { |
| 3259 | + public function unsegmentForDiff( $text ) { |
3260 | 3260 | return $text; |
3261 | 3261 | } |
3262 | 3262 | |
— | — | @@ -3263,7 +3263,7 @@ |
3264 | 3264 | * Return the LanguageConverter used in the Language |
3265 | 3265 | * @return LanguageConverter |
3266 | 3266 | */ |
3267 | | - function getConverter() { |
| 3267 | + public function getConverter() { |
3268 | 3268 | return $this->mConverter; |
3269 | 3269 | } |
3270 | 3270 | |
— | — | @@ -3273,7 +3273,7 @@ |
3274 | 3274 | * @param $text string |
3275 | 3275 | * @return array |
3276 | 3276 | */ |
3277 | | - function autoConvertToAllVariants( $text ) { |
| 3277 | + public function autoConvertToAllVariants( $text ) { |
3278 | 3278 | return $this->mConverter->autoConvertToAllVariants( $text ); |
3279 | 3279 | } |
3280 | 3280 | |
— | — | @@ -3283,18 +3283,17 @@ |
3284 | 3284 | * @param $text string |
3285 | 3285 | * @return string |
3286 | 3286 | */ |
3287 | | - function convert( $text ) { |
| 3287 | + public function convert( $text ) { |
3288 | 3288 | return $this->mConverter->convert( $text ); |
3289 | 3289 | } |
3290 | 3290 | |
3291 | | - |
3292 | 3291 | /** |
3293 | 3292 | * Convert a Title object to a string in the preferred variant |
3294 | 3293 | * |
3295 | 3294 | * @param $title Title |
3296 | 3295 | * @return string |
3297 | 3296 | */ |
3298 | | - function convertTitle( $title ) { |
| 3297 | + public function convertTitle( $title ) { |
3299 | 3298 | return $this->mConverter->convertTitle( $title ); |
3300 | 3299 | } |
3301 | 3300 | |
— | — | @@ -3303,15 +3302,16 @@ |
3304 | 3303 | * |
3305 | 3304 | * @return bool |
3306 | 3305 | */ |
3307 | | - function hasVariants() { |
| 3306 | + public function hasVariants() { |
3308 | 3307 | return sizeof( $this->getVariants() ) > 1; |
3309 | 3308 | } |
3310 | 3309 | |
3311 | 3310 | /** |
3312 | 3311 | * Check if the language has the specific variant |
| 3312 | + * @param $variant string |
3313 | 3313 | * @return bool |
3314 | 3314 | */ |
3315 | | - function hasVariant( $variant ) { |
| 3315 | + public function hasVariant( $variant ) { |
3316 | 3316 | return (bool)$this->mConverter->validateVariant( $variant ); |
3317 | 3317 | } |
3318 | 3318 | |
— | — | @@ -3321,7 +3321,7 @@ |
3322 | 3322 | * @param $text string |
3323 | 3323 | * @return string |
3324 | 3324 | */ |
3325 | | - function armourMath( $text ) { |
| 3325 | + public function armourMath( $text ) { |
3326 | 3326 | return $this->mConverter->armourMath( $text ); |
3327 | 3327 | } |
3328 | 3328 | |
— | — | @@ -3332,7 +3332,7 @@ |
3333 | 3333 | * @return string |
3334 | 3334 | * @todo this should get integrated somewhere sane |
3335 | 3335 | */ |
3336 | | - function convertHtml( $text, $isTitle = false ) { |
| 3336 | + public function convertHtml( $text, $isTitle = false ) { |
3337 | 3337 | return htmlspecialchars( $this->convert( $text, $isTitle ) ); |
3338 | 3338 | } |
3339 | 3339 | |
— | — | @@ -3340,7 +3340,7 @@ |
3341 | 3341 | * @param $key string |
3342 | 3342 | * @return string |
3343 | 3343 | */ |
3344 | | - function convertCategoryKey( $key ) { |
| 3344 | + public function convertCategoryKey( $key ) { |
3345 | 3345 | return $this->mConverter->convertCategoryKey( $key ); |
3346 | 3346 | } |
3347 | 3347 | |
— | — | @@ -3350,28 +3350,28 @@ |
3351 | 3351 | * |
3352 | 3352 | * @return array an array of language codes |
3353 | 3353 | */ |
3354 | | - function getVariants() { |
| 3354 | + public function getVariants() { |
3355 | 3355 | return $this->mConverter->getVariants(); |
3356 | 3356 | } |
3357 | 3357 | |
3358 | 3358 | /** |
3359 | 3359 | * @return string |
3360 | 3360 | */ |
3361 | | - function getPreferredVariant() { |
| 3361 | + public function getPreferredVariant() { |
3362 | 3362 | return $this->mConverter->getPreferredVariant(); |
3363 | 3363 | } |
3364 | 3364 | |
3365 | 3365 | /** |
3366 | 3366 | * @return string |
3367 | 3367 | */ |
3368 | | - function getDefaultVariant() { |
| 3368 | + public function getDefaultVariant() { |
3369 | 3369 | return $this->mConverter->getDefaultVariant(); |
3370 | 3370 | } |
3371 | 3371 | |
3372 | 3372 | /** |
3373 | 3373 | * @return string |
3374 | 3374 | */ |
3375 | | - function getURLVariant() { |
| 3375 | + public function getURLVariant() { |
3376 | 3376 | return $this->mConverter->getURLVariant(); |
3377 | 3377 | } |
3378 | 3378 | |
— | — | @@ -3387,7 +3387,7 @@ |
3388 | 3388 | * we need to transclude a template or update a category's link |
3389 | 3389 | * @return null the input parameters may be modified upon return |
3390 | 3390 | */ |
3391 | | - function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) { |
| 3391 | + public function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) { |
3392 | 3392 | $this->mConverter->findVariantLink( $link, $nt, $ignoreOtherCond ); |
3393 | 3393 | } |
3394 | 3394 | |
— | — | @@ -3402,7 +3402,7 @@ |
3403 | 3403 | * |
3404 | 3404 | * @return string |
3405 | 3405 | */ |
3406 | | - function convertLinkToAllVariants( $text ) { |
| 3406 | + public function convertLinkToAllVariants( $text ) { |
3407 | 3407 | return $this->mConverter->convertLinkToAllVariants( $text ); |
3408 | 3408 | } |
3409 | 3409 | |
— | — | @@ -3423,7 +3423,7 @@ |
3424 | 3424 | * |
3425 | 3425 | * @return string |
3426 | 3426 | */ |
3427 | | - function getParsedTitle() { |
| 3427 | + public function getParsedTitle() { |
3428 | 3428 | return $this->mConverter->getParsedTitle(); |
3429 | 3429 | } |
3430 | 3430 | |
— | — | @@ -3435,7 +3435,7 @@ |
3436 | 3436 | * @param $noParse bool |
3437 | 3437 | * @return string the tagged text |
3438 | 3438 | */ |
3439 | | - function markNoConversion( $text, $noParse = false ) { |
| 3439 | + public function markNoConversion( $text, $noParse = false ) { |
3440 | 3440 | return $this->mConverter->markNoConversion( $text, $noParse ); |
3441 | 3441 | } |
3442 | 3442 | |
— | — | @@ -3445,7 +3445,7 @@ |
3446 | 3446 | * |
3447 | 3447 | * @return string |
3448 | 3448 | */ |
3449 | | - function linkTrail() { |
| 3449 | + public function linkTrail() { |
3450 | 3450 | return self::$dataCache->getItem( $this->mCode, 'linkTrail' ); |
3451 | 3451 | } |
3452 | 3452 | |
— | — | @@ -3461,7 +3461,7 @@ |
3462 | 3462 | * |
3463 | 3463 | * @return string |
3464 | 3464 | */ |
3465 | | - function getCode() { |
| 3465 | + public function getCode() { |
3466 | 3466 | return $this->mCode; |
3467 | 3467 | } |
3468 | 3468 | |
— | — | @@ -3469,8 +3469,9 @@ |
3470 | 3470 | * Get the code in Bcp47 format which we can use |
3471 | 3471 | * inside of html lang="" tags. |
3472 | 3472 | * @since 1.19 |
| 3473 | + * @return string |
3473 | 3474 | */ |
3474 | | - function getHtmlCode() { |
| 3475 | + public function getHtmlCode() { |
3475 | 3476 | if ( is_null( $this->mHtmlCode ) ) { |
3476 | 3477 | $this->mHtmlCode = wfBCP47( $this->getCode() ); |
3477 | 3478 | } |
— | — | @@ -3480,7 +3481,7 @@ |
3481 | 3482 | /** |
3482 | 3483 | * @param $code string |
3483 | 3484 | */ |
3484 | | - function setCode( $code ) { |
| 3485 | + public function setCode( $code ) { |
3485 | 3486 | $this->mCode = $code; |
3486 | 3487 | // Ensure we don't leave an incorrect html code lying around |
3487 | 3488 | unset( $this->mHtmlCode ); |
— | — | @@ -3493,7 +3494,7 @@ |
3494 | 3495 | * @param $suffix string Append this to the filename |
3495 | 3496 | * @return string $prefix . $mangledCode . $suffix |
3496 | 3497 | */ |
3497 | | - static function getFileName( $prefix = 'Language', $code, $suffix = '.php' ) { |
| 3498 | + public static function getFileName( $prefix = 'Language', $code, $suffix = '.php' ) { |
3498 | 3499 | // Protect against path traversal |
3499 | 3500 | if ( !Language::isValidCode( $code ) |
3500 | 3501 | || strcspn( $code, ":/\\\000" ) !== strlen( $code ) ) |
— | — | @@ -3511,7 +3512,7 @@ |
3512 | 3513 | * @param $suffix string Suffix after the language code |
3513 | 3514 | * @return string Language code, or false if $prefix or $suffix isn't found |
3514 | 3515 | */ |
3515 | | - static function getCodeFromFileName( $filename, $prefix = 'Language', $suffix = '.php' ) { |
| 3516 | + public static function getCodeFromFileName( $filename, $prefix = 'Language', $suffix = '.php' ) { |
3516 | 3517 | $m = null; |
3517 | 3518 | preg_match( '/' . preg_quote( $prefix, '/' ) . '([A-Z][a-z_]+)' . |
3518 | 3519 | preg_quote( $suffix, '/' ) . '/', $filename, $m ); |
— | — | @@ -3525,7 +3526,7 @@ |
3526 | 3527 | * @param $code string |
3527 | 3528 | * @return string |
3528 | 3529 | */ |
3529 | | - static function getMessagesFileName( $code ) { |
| 3530 | + public static function getMessagesFileName( $code ) { |
3530 | 3531 | global $IP; |
3531 | 3532 | $file = self::getFileName( "$IP/languages/messages/Messages", $code, '.php' ); |
3532 | 3533 | wfRunHooks( 'Language::getMessagesFileName', array( $code, &$file ) ); |
— | — | @@ -3536,7 +3537,7 @@ |
3537 | 3538 | * @param $code string |
3538 | 3539 | * @return string |
3539 | 3540 | */ |
3540 | | - static function getClassFileName( $code ) { |
| 3541 | + public static function getClassFileName( $code ) { |
3541 | 3542 | global $IP; |
3542 | 3543 | return self::getFileName( "$IP/languages/classes/Language", $code, '.php' ); |
3543 | 3544 | } |
— | — | @@ -3548,7 +3549,7 @@ |
3549 | 3550 | * |
3550 | 3551 | * @return false|string |
3551 | 3552 | */ |
3552 | | - static function getFallbackFor( $code ) { |
| 3553 | + public static function getFallbackFor( $code ) { |
3553 | 3554 | if ( $code === 'en' || !Language::isValidBuiltInCode( $code ) ) { |
3554 | 3555 | return false; |
3555 | 3556 | } else { |
— | — | @@ -3565,7 +3566,7 @@ |
3566 | 3567 | * @param $code string Language code |
3567 | 3568 | * @return array |
3568 | 3569 | */ |
3569 | | - static function getFallbacksFor( $code ) { |
| 3570 | + public static function getFallbacksFor( $code ) { |
3570 | 3571 | if ( $code === 'en' || !Language::isValidBuiltInCode( $code ) ) { |
3571 | 3572 | return array(); |
3572 | 3573 | } else { |
— | — | @@ -3587,7 +3588,7 @@ |
3588 | 3589 | * |
3589 | 3590 | * @return array |
3590 | 3591 | */ |
3591 | | - static function getMessagesFor( $code ) { |
| 3592 | + public static function getMessagesFor( $code ) { |
3592 | 3593 | return self::getLocalisationCache()->getItem( $code, 'messages' ); |
3593 | 3594 | } |
3594 | 3595 | |
— | — | @@ -3599,7 +3600,7 @@ |
3600 | 3601 | * |
3601 | 3602 | * @return string |
3602 | 3603 | */ |
3603 | | - static function getMessageFor( $key, $code ) { |
| 3604 | + public static function getMessageFor( $key, $code ) { |
3604 | 3605 | return self::getLocalisationCache()->getSubitem( $code, 'messages', $key ); |
3605 | 3606 | } |
3606 | 3607 | |
— | — | @@ -3611,7 +3612,7 @@ |
3612 | 3613 | * @param $code string Language code |
3613 | 3614 | * @return array of message keys (strings) |
3614 | 3615 | */ |
3615 | | - static function getMessageKeysFor( $code ) { |
| 3616 | + public static function getMessageKeysFor( $code ) { |
3616 | 3617 | return self::getLocalisationCache()->getSubItemList( $code, 'messages' ); |
3617 | 3618 | } |
3618 | 3619 | |
— | — | @@ -3926,7 +3927,7 @@ |
3927 | 3928 | * |
3928 | 3929 | * @return string |
3929 | 3930 | */ |
3930 | | - function getConvRuleTitle() { |
| 3931 | + public function getConvRuleTitle() { |
3931 | 3932 | return $this->mConverter->getConvRuleTitle(); |
3932 | 3933 | } |
3933 | 3934 | } |