X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FStatus.php;h=877d2218a29e332ba52b330a41e6d9d1881bb962;hb=39e80cfc278f363a69c922a0ea91ac4eaefeee64;hp=5456ed06e34c9bb74a6553dc7ba2f1bab9184c45;hpb=f8e202e0fbd62ac26cfa9ae2695ebc081b08226f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Status.php b/includes/Status.php index 5456ed06e3..877d2218a2 100644 --- a/includes/Status.php +++ b/includes/Status.php @@ -153,9 +153,12 @@ class Status extends StatusValue { * @return Language */ protected function languageFromParam( $lang ) { + global $wgLang; + if ( $lang === null ) { - return RequestContext::getMain()->getLanguage(); - } elseif ( $lang instanceof Language ) { + // @todo: Use RequestContext::getMain()->getLanguage() instead + return $wgLang; + } elseif ( $lang instanceof Language || $lang instanceof StubUserLang ) { return $lang; } else { return Language::factory( $lang ); @@ -168,7 +171,7 @@ class Status extends StatusValue { * @param string|bool $shortContext A short enclosing context message name, to * be used when there is a single error * @param string|bool $longContext A long enclosing context message name, for a list - * @param string|Language $lang Language to use for processing messages + * @param string|Language|null $lang Language to use for processing messages * @return string */ public function getWikiText( $shortContext = false, $longContext = false, $lang = null ) { @@ -224,7 +227,7 @@ class Status extends StatusValue { * * @param string|string[]|bool $shortContext A message name or an array of message names. * @param string|string[]|bool $longContext A message name or an array of message names. - * @param string|Language $lang Language to use for processing messages + * @param string|Language|null $lang Language to use for processing messages * @return Message */ public function getMessage( $shortContext = false, $longContext = false, $lang = null ) { @@ -276,7 +279,7 @@ class Status extends StatusValue { * If $error is an array, the "params" field is a list of parameters for the message. * * @param array|string $error Code string or (key: code string, params: string[]) map - * @param string|Language $lang Language to use for processing messages + * @param string|Language|null $lang Language to use for processing messages * @return Message */ protected function getErrorMessage( $error, $lang = null ) { @@ -313,13 +316,15 @@ class Status extends StatusValue { $lang = $this->languageFromParam( $lang ); $text = $this->getWikiText( $shortContext, $longContext, $lang ); $out = MessageCache::singleton()->parse( $text, null, true, true, $lang ); - return $out instanceof ParserOutput ? $out->getText() : $out; + return $out instanceof ParserOutput + ? $out->getText( [ 'enableSectionEditLinks' => false ] ) + : $out; } /** * Return an array with a Message object for each error. * @param array $errors - * @param string|Language $lang Language to use for processing messages + * @param string|Language|null $lang Language to use for processing messages * @return Message[] */ protected function getErrorMessageArray( $errors, $lang = null ) { @@ -354,7 +359,7 @@ class Status extends StatusValue { /** * Returns a list of status messages of the given type (or all if false) * - * @note: this handles RawMessage poorly + * @note this handles RawMessage poorly * * @param string|bool $type * @return array