X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=blobdiff_plain;f=languages%2FLanguage.php;h=1b5580cada83a8b04a4bdc59b057a76c99077bd2;hb=d46835ef4f877b03a9d48aa392dc23ae37042756;hp=a9bbc20c1d490b667bd6958e7cc349600906cd89;hpb=8414e3c4d0c2a647f794e1e535e70f3a2abe6eb4;p=lhc%2Fweb%2Fwiklou.git diff --git a/languages/Language.php b/languages/Language.php index a9bbc20c1d..1b5580cada 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -2713,7 +2713,7 @@ class Language { public function uc( $str, $first = false ) { if ( $first ) { if ( $this->isMultibyte( $str ) ) { - return mb_strtoupper( mb_substr( $str, 0, 1 ) ) . mb_substr( $str, 1 ); + return $this->mbUpperChar( mb_substr( $str, 0, 1 ) ) . mb_substr( $str, 1 ); } else { return ucfirst( $str ); } @@ -2722,6 +2722,28 @@ class Language { } } + /** + * Convert character to uppercase, allowing overrides of the default mb_upper + * behaviour, which is buggy in many ways. Having a conversion table can be + * useful during transitions between PHP versions where unicode changes happen. + * This can make some resources unreachable on-wiki, see discussion at T219279. + * Providing such a conversion table can allow to manage the transition period. + * + * @since 1.34 + * + * @param string $char + * + * @return string + */ + protected function mbUpperChar( $char ) { + global $wgOverrideUcfirstCharacters; + if ( array_key_exists( $char, $wgOverrideUcfirstCharacters ) ) { + return $wgOverrideUcfirstCharacters[$char]; + } else { + return mb_strtoupper( $char ); + } + } + /** * @param string $str * @return mixed|string