Document that wfParseUrl() can also return false
[lhc/web/wiklou.git] / languages / Language.php
index 0a6ccd3..d96710a 100644 (file)
@@ -30,8 +30,6 @@ if ( !defined( 'MEDIAWIKI' ) ) {
        exit( 1 );
 }
 
-mb_internal_encoding( 'UTF-8' );
-
 use CLDRPluralRuleParser\Evaluator;
 
 /**
@@ -1089,7 +1087,7 @@ class Language {
         * @throws MWException
         * @return string
         */
-       public function sprintfDate( $format, $ts, DateTimeZone $zone = null, &$ttl = null ) {
+       public function sprintfDate( $format, $ts, DateTimeZone $zone = null, &$ttl = 'unused' ) {
                $s = '';
                $raw = false;
                $roman = false;
@@ -1454,7 +1452,9 @@ class Language {
                        }
                }
 
-               if ( $usedSecond ) {
+               if ( $ttl === 'unused' ) {
+                       // No need to calculate the TTL, the caller wont use it anyway.
+               } elseif ( $usedSecond ) {
                        $ttl = 1;
                } elseif ( $usedMinute ) {
                        $ttl = 60 - substr( $ts, 12, 2 );
@@ -2577,9 +2577,6 @@ class Language {
         * @return string
         */
        public function iconv( $in, $out, $string ) {
-               # This is a wrapper for iconv in all languages except esperanto,
-               # which does some nasty x-conversions beforehand
-
                # Even with //IGNORE iconv can whine about illegal characters in
                # *input* string. We just ignore those too.
                # REF: http://bugs.php.net/bug.php?id=37166
@@ -2929,46 +2926,29 @@ class Language {
                }
        }
 
+       /**
+        * @deprecated No-op since 1.28
+        */
        function initEncoding() {
-               # Some languages may have an alternate char encoding option
-               # (Esperanto X-coding, Japanese furigana conversion, etc)
-               # If this language is used as the primary content language,
-               # an override to the defaults can be set here on startup.
+               // No-op.
        }
 
        /**
         * @param string $s
         * @return string
+        * @deprecated No-op since 1.28
         */
        function recodeForEdit( $s ) {
-               # For some languages we'll want to explicitly specify
-               # which characters make it into the edit box raw
-               # or are converted in some way or another.
-               global $wgEditEncoding;
-               if ( $wgEditEncoding == '' || $wgEditEncoding == 'UTF-8' ) {
-                       return $s;
-               } else {
-                       return $this->iconv( 'UTF-8', $wgEditEncoding, $s );
-               }
+               return $s;
        }
 
        /**
         * @param string $s
         * @return string
+        * @deprecated No-op since 1.28
         */
        function recodeInput( $s ) {
-               # Take the previous into account.
-               global $wgEditEncoding;
-               if ( $wgEditEncoding != '' ) {
-                       $enc = $wgEditEncoding;
-               } else {
-                       $enc = 'UTF-8';
-               }
-               if ( $enc == 'UTF-8' ) {
-                       return $s;
-               } else {
-                       return $this->iconv( $enc, 'UTF-8', $s );
-               }
+               return $s;
        }
 
        /**