Use "break" instead of "continue"
[lhc/web/wiklou.git] / languages / LanguageConverter.php
index 1f720af..24b1d0c 100644 (file)
@@ -39,6 +39,7 @@ class LanguageConverter {
         */
        static public $languagesWithVariants = [
                'en',
+               'crh',
                'gan',
                'iu',
                'kk',
@@ -162,6 +163,8 @@ class LanguageConverter {
 
                $req = $this->getURLVariant();
 
+               Hooks::run( 'GetLangPreferredVariant', [ &$req ] );
+
                if ( $wgUser->isSafeToLoad() && $wgUser->isLoggedIn() && !$req ) {
                        $req = $this->getUserVariant();
                } elseif ( !$req ) {
@@ -679,9 +682,8 @@ class LanguageConverter {
 
                $noScript = '<script.*?>.*?<\/script>(*SKIP)(*FAIL)';
                $noStyle = '<style.*?>.*?<\/style>(*SKIP)(*FAIL)';
-               // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong
+               // phpcs:ignore Generic.Files.LineLength
                $noHtml = '<(?:[^>=]*+(?>[^>=]*+=\s*+(?:"[^"]*"|\'[^\']*\'|[^\'">\s]*+))*+[^>=]*+>|.*+)(*SKIP)(*FAIL)';
-               // @codingStandardsIgnoreEnd
                while ( $startPos < $length && $continue ) {
                        $continue = preg_match(
                                // Only match -{ outside of html.
@@ -768,7 +770,7 @@ class LanguageConverter {
                                                        $warningDone = true;
                                                }
                                                $startPos += 2;
-                                               continue;
+                                               break;
                                        }
                                        // Recursively parse another rule
                                        $inner .= $this->recursiveConvertRule( $text, $variant, $startPos, $depth + 1 );