Merge "(bug 37755) Set robot meta tags for 'view source' pages"
[lhc/web/wiklou.git] / includes / logging / LogPage.php
index 2521ae8..07238a0 100644 (file)
@@ -133,7 +133,8 @@ class LogPage {
                        if ( $rcComment == '' ) {
                                $rcComment = $this->comment;
                        } else {
-                               $rcComment .= wfMsgForContent( 'colon-separator' ) . $this->comment;
+                               $rcComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() .
+                                       $this->comment;
                        }
                }
 
@@ -152,7 +153,8 @@ class LogPage {
                        if ( $rcComment == '' ) {
                                $rcComment = $this->comment;
                        } else {
-                               $rcComment .= wfMsgForContent( 'colon-separator' ) . $this->comment;
+                               $rcComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() .
+                                       $this->comment;
                        }
                }
 
@@ -197,7 +199,7 @@ class LogPage {
                global $wgLogNames;
 
                if( isset( $wgLogNames[$type] ) ) {
-                       return str_replace( '_', ' ', wfMsg( $wgLogNames[$type] ) );
+                       return str_replace( '_', ' ', wfMessage( $wgLogNames[$type] )->text() );
                } else {
                        // Bogus log types? Perhaps an extension was removed.
                        return $type;
@@ -214,11 +216,11 @@ class LogPage {
         */
        public static function logHeader( $type ) {
                global $wgLogHeaders;
-               return wfMsgExt( $wgLogHeaders[$type], array( 'parseinline' ) );
+               return wfMessage( $wgLogHeaders[$type] )->parse();
        }
 
        /**
-        * Generate text for a log entry. 
+        * Generate text for a log entry.
         * Only LogFormatter should call this function.
         *
         * @param $type String: log type
@@ -247,35 +249,12 @@ class LogPage {
 
                if( isset( $wgLogActions[$key] ) ) {
                        if( is_null( $title ) ) {
-                               $rv = wfMsgExt( $wgLogActions[$key], array( 'parsemag', 'escape', 'language' => $langObj ) );
+                               $rv = wfMessage( $wgLogActions[$key] )->inLanguage( $langObj )->escaped();
                        } else {
                                $titleLink = self::getTitleLink( $type, $langObjOrNull, $title, $params );
 
-                               if( preg_match( '/^rights\/(rights|autopromote)/', $key ) ) {
-                                       $rightsnone = wfMsgExt( 'rightsnone', array( 'parsemag', 'language' => $langObj ) );
-
-                                       if( $skin ) {
-                                               $username = $title->getText();
-                                               foreach ( $params as &$param ) {
-                                                       $groupArray = array_map( 'trim', explode( ',', $param ) );
-                                                       foreach( $groupArray as &$group ) {
-                                                               $group = User::getGroupMember( $group, $username );
-                                                       }
-                                                       $param = $wgLang->listToText( $groupArray );
-                                               }
-                                       }
-
-                                       if( !isset( $params[0] ) || trim( $params[0] ) == '' ) {
-                                               $params[0] = $rightsnone;
-                                       }
-
-                                       if( !isset( $params[1] ) || trim( $params[1] ) == '' ) {
-                                               $params[1] = $rightsnone;
-                                       }
-                               }
-
                                if( count( $params ) == 0 ) {
-                                       $rv = wfMsgExt( $wgLogActions[$key], array( 'parsemag', 'escape', 'replaceafter', 'language' => $langObj ), $titleLink );
+                                       $rv = wfMessage( $wgLogActions[$key] )->rawParams( $titleLink )->inLanguage( $langObj )->escaped();
                                } else {
                                        $details = '';
                                        array_unshift( $params, $titleLink );
@@ -302,11 +281,11 @@ class LogPage {
 
                                                // Cascading flag...
                                                if( $params[2] ) {
-                                                       $details .= ' [' . wfMsgExt( 'protect-summary-cascade', array( 'parsemag', 'language' => $langObj ) ) . ']';
+                                                       $details .= ' [' . wfMessage( 'protect-summary-cascade' )->inLanguage( $langObj )->text() . ']';
                                                }
                                        }
 
-                                       $rv = wfMsgExt( $wgLogActions[$key], array( 'parsemag', 'escape', 'replaceafter', 'language' => $langObj ), $params ) . $details;
+                                       $rv = wfMessage( $wgLogActions[$key] )->rawParams( $params )->inLanguage( $langObj )->escaped() . $details;
                                }
                        }
                } else {
@@ -348,8 +327,6 @@ class LogPage {
         * @return String
         */
        protected static function getTitleLink( $type, $lang, $title, &$params ) {
-               global $wgContLang, $wgUserrightsInterwikiDelimiter;
-
                if( !$lang ) {
                        return $title->getPrefixedText();
                }
@@ -386,20 +363,6 @@ class LogPage {
                                                . Linker::userToolLinks( $id, $title->getText(), false, Linker::TOOL_LINKS_NOBLOCK );
                                }
                                break;
-                       case 'rights':
-                               $text = $wgContLang->ucfirst( $title->getText() );
-                               $parts = explode( $wgUserrightsInterwikiDelimiter, $text, 2 );
-
-                               if ( count( $parts ) == 2 ) {
-                                       $titleLink = WikiMap::foreignUserLink( $parts[1], $parts[0],
-                                               htmlspecialchars( $title->getPrefixedText() ) );
-
-                                       if ( $titleLink !== false ) {
-                                               break;
-                                       }
-                               }
-                               $titleLink = Linker::link( Title::makeTitle( NS_USER, $text ) );
-                               break;
                        case 'merge':
                                $titleLink = Linker::link(
                                        $title,
@@ -442,7 +405,7 @@ class LogPage {
         * @param $action String: one of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move', 'move_redir'
         * @param $target Title object
         * @param $comment String: description associated
-        * @param $params Array: parameters passed later to wfMsg.* functions
+        * @param $params Array: parameters passed later to wfMessage function
         * @param $doer User object: the user doing the action
         *
         * @return int log_id of the inserted log entry