Clean up search results if scrolled of the end
[lhc/web/wiklou.git] / languages / Language.php
index bf30455..8b41b4e 100644 (file)
@@ -339,7 +339,7 @@ class Language {
                        throw new MWException( __METHOD__ . " must be passed a string, $type given$addmsg" );
                }
 
-               return (bool)preg_match( '/^[a-z0-9-]{2,}$/i', $code );
+               return (bool)preg_match( '/^[a-z0-9-]{2,}$/', $code );
        }
 
        /**
@@ -443,17 +443,6 @@ class Language {
        function initContLang() {
        }
 
-       /**
-        * Same as getFallbacksFor for current language.
-        * @return array|bool
-        * @deprecated since 1.19
-        */
-       function getFallbackLanguageCode() {
-               wfDeprecated( __METHOD__, '1.19' );
-
-               return self::getFallbackFor( $this->mCode );
-       }
-
        /**
         * @return array
         * @since 1.19
@@ -857,6 +846,11 @@ class Language {
                        include "$IP/languages/Names.php";
                }
 
+               // If passed an invalid language code to use, fallback to en
+               if ( $inLanguage !== null && !Language::isValidCode( $inLanguage ) ) {
+                       $inLanguage = 'en';
+               }
+
                $names = array();
 
                if ( $inLanguage ) {
@@ -2402,7 +2396,7 @@ class Language {
                        // Timestamps are in different years: use full timestamp
                        // Also do full timestamp for future dates
                        /**
-                        * @FIXME Add better handling of future timestamps.
+                        * @todo FIXME: Add better handling of future timestamps.
                         */
                        $format = $this->getDateFormatString( 'both', $user->getDatePreference() ?: 'default' );
                        $ts = $this->sprintfDate( $format, $ts->getTimestamp( TS_MW ) );
@@ -3131,7 +3125,7 @@ class Language {
         */
        function getMagic( $mw ) {
                // Saves a function call
-               if ( ! $this->mMagicHookDone ) {
+               if ( !$this->mMagicHookDone ) {
                        $this->doMagicHook();
                }
 
@@ -3801,7 +3795,7 @@ class Language {
                foreach ( $forms as $index => $form ) {
                        if ( preg_match( '/\d+=/i', $form ) ) {
                                $pos = strpos( $form, '=' );
-                               if ( substr( $form, 0, $pos ) === (string) $count ) {
+                               if ( substr( $form, 0, $pos ) === (string)$count ) {
                                        return substr( $form, $pos + 1 );
                                }
                                unset( $forms[$index] );
@@ -4449,7 +4443,7 @@ class Language {
                if ( !isset( $format['avoid'] ) ) {
                        $format['avoid'] = false;
                }
-               if ( !isset( $format['noabbrevs' ] ) ) {
+               if ( !isset( $format['noabbrevs'] ) ) {
                        $format['noabbrevs'] = false;
                }
                $secondsMsg = wfMessage(