X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=languages%2FLanguageConverter.php;h=f611358d94c09b5e2faa3d91b05b297cfccb397e;hb=079d64952ee14ce2bca89f00ebd2de0dbe4f62ae;hp=8e98abd618e4ffce26201919b1f0e7c38813f99c;hpb=f600b4ede9a6390cc5e929d2a48ed98af2edbc60;p=lhc%2Fweb%2Fwiklou.git diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index 8e98abd618..f611358d94 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -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 ) { @@ -353,7 +356,6 @@ class LanguageConverter { if ( $this->guessVariant( $text, $toVariant ) ) { return $text; } - /* we convert everything except: 1. HTML markups (anything between < and >) 2. HTML entities @@ -389,6 +391,7 @@ class LanguageConverter { // Guard against delimiter nulls in the input // (should never happen: see T159174) $text = str_replace( "\000", '', $text ); + $text = str_replace( "\004", '', $text ); $markupMatches = null; $elementMatches = null; @@ -403,6 +406,13 @@ class LanguageConverter { // We hit the end. $elementPos = strlen( $text ); $element = ''; + } elseif ( substr( $element, -1 ) === "\004" ) { + // This can sometimes happen if we have + // unclosed html tags (For example + // when converting a title attribute + // during a recursive call that contains + // a < e.g.