Merge "wpUndidRevision should be passed along during 'preview' and 'diff'"
[lhc/web/wiklou.git] / includes / Status.php
index 5d6236f..7ec1b0f 100644 (file)
@@ -190,7 +190,7 @@ class Status {
                                $s = wfMessage( $longContext, "* $s\n" )->plain();
                        }
                } else {
-                       $s = '* '. implode( "\n* ",
+                       $s = '* ' . implode( "\n* ",
                                $this->getErrorMessageArray( $this->errors ) ) . "\n";
                        if ( $longContext ) {
                                $s = wfMessage( $longContext, $s )->plain();
@@ -212,7 +212,7 @@ class Status {
         */
        protected function getErrorMessage( $error ) {
                if ( is_array( $error ) ) {
-                       if( isset( $error['message'] ) && $error['message'] instanceof Message ) {
+                       if ( isset( $error['message'] ) && $error['message'] instanceof Message ) {
                                $msg = $error['message'];
                        } elseif ( isset( $error['message'] ) && isset( $error['params'] ) ) {
                                $msg = wfMessage( $error['message'],
@@ -234,7 +234,7 @@ class Status {
         *
         * @note: this does not perform a full wikitext to HTML conversion, it merely applies
         *        a message transformation.
-        * @todo: figure out whether that is actually The Right Thing.
+        * @todo figure out whether that is actually The Right Thing.
         */
        public function getHTML( $shortContext = false, $longContext = false ) {
                $text = $this->getWikiText( $shortContext, $longContext );
@@ -269,7 +269,8 @@ class Status {
        /**
         * Get the list of errors (but not warnings)
         *
-        * @return Array
+        * @return array A list in which each entry is an array with a message key as its first element.
+        *         The remaining array elements are the message parameters.
         */
        function getErrorsArray() {
                return $this->getStatusArray( "error" );
@@ -278,7 +279,8 @@ class Status {
        /**
         * Get the list of warnings (but not errors)
         *
-        * @return Array
+        * @return array A list in which each entry is an array with a message key as its first element.
+        *         The remaining array elements are the message parameters.
         */
        function getWarningsArray() {
                return $this->getStatusArray( "warning" );
@@ -294,9 +296,9 @@ class Status {
                $result = array();
                foreach ( $this->errors as $error ) {
                        if ( $error['type'] === $type ) {
-                               if( $error['message'] instanceof Message ) {
-                                       $result[] = $error['message'];
-                               } elseif( $error['params'] ) {
+                               if ( $error['message'] instanceof Message ) {
+                                       $result[] = array_merge( array( $error['message']->getKey() ), $error['message']->getParams() );
+                               } elseif ( $error['params'] ) {
                                        $result[] = array_merge( array( $error['message'] ), $error['params'] );
                                } else {
                                        $result[] = array( $error['message'] );