X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FStatus.php;h=763c95cd2cd21cfd030d46f49190f0c7afec4dd4;hb=f9a243582f98d0a53262e739f1f65de047fbc46f;hp=a2df380924a3350747875a9c2874540e8c415cd3;hpb=060ba3cb682d3aa1059895f6abda14b4dd842ad5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Status.php b/includes/Status.php index a2df380924..763c95cd2c 100644 --- a/includes/Status.php +++ b/includes/Status.php @@ -164,35 +164,6 @@ class Status { return $cleanParams; } - /** - * @param $item - * @return string - */ - protected function getItemXML( $item ) { - $params = $this->cleanParams( $item['params'] ); - $xml = "<{$item['type']}>\n" . - Xml::element( 'message', null, $item['message'] ) . "\n" . - Xml::element( 'text', null, wfMsg( $item['message'], $params ) ) ."\n"; - foreach ( $params as $param ) { - $xml .= Xml::element( 'param', null, $param ); - } - $xml .= "\n"; - return $xml; - } - - /** - * Get the error list as XML - * @return string - */ - function getXML() { - $xml = "\n"; - foreach ( $this->errors as $error ) { - $xml .= $this->getItemXML( $error ); - } - $xml .= "\n"; - return $xml; - } - /** * Get the error list as a wikitext formatted list * @@ -214,17 +185,17 @@ class Status { if ( count( $this->errors ) == 1 ) { $s = $this->getWikiTextForError( $this->errors[0], $this->errors[0] ); if ( $shortContext ) { - $s = wfMsgNoTrans( $shortContext, $s ); + $s = wfMessage( $shortContext, $s )->plain(); } elseif ( $longContext ) { - $s = wfMsgNoTrans( $longContext, "* $s\n" ); + $s = wfMessage( $longContext, "* $s\n" )->plain(); } } else { $s = '* '. implode("\n* ", $this->getWikiTextArray( $this->errors ) ) . "\n"; if ( $longContext ) { - $s = wfMsgNoTrans( $longContext, $s ); + $s = wfMessage( $longContext, $s )->plain(); } elseif ( $shortContext ) { - $s = wfMsgNoTrans( $shortContext, "\n$s\n" ); + $s = wfMessage( $shortContext, "\n$s\n" )->plain(); } } return $s; @@ -242,18 +213,27 @@ class Status { protected function getWikiTextForError( $error ) { if ( is_array( $error ) ) { if ( isset( $error['message'] ) && isset( $error['params'] ) ) { - return wfMsgNoTrans( $error['message'], - array_map( 'wfEscapeWikiText', $this->cleanParams( $error['params'] ) ) ); + return wfMessage( $error['message'], + array_map( 'wfEscapeWikiText', $this->cleanParams( $error['params'] ) ) )->plain(); } else { $message = array_shift($error); - return wfMsgNoTrans( $message, - array_map( 'wfEscapeWikiText', $this->cleanParams( $error ) ) ); + return wfMessage( $message, + array_map( 'wfEscapeWikiText', $this->cleanParams( $error ) ) )->plain(); } } else { - return wfMsgNoTrans( $error ); + return wfMessage( $error )->plain(); } } + /** + * Get the error message as HTML. This is done by parsing the wikitext error + * message. + */ + public function getHTML( $shortContext = false, $longContext = false ) { + $text = $this->getWikiText( $shortContext, $longContext ); + return MessageCache::singleton()->transform( $text, true ); + } + /** * Return an array with the wikitext for each item in the array. * @param $errors Array