Use local context to get messages
[lhc/web/wiklou.git] / includes / specials / SpecialNewpages.php
index 5d4a245..ecec87d 100644 (file)
@@ -78,7 +78,6 @@ class SpecialNewpages extends IncludableSpecialPage {
        }
 
        protected function parseParams( $par ) {
-               global $wgLang;
                $bits = preg_split( '/\s*,\s*/', trim( $par ) );
                foreach ( $bits as $bit ) {
                        if ( 'shownav' == $bit ) {
@@ -112,7 +111,7 @@ class SpecialNewpages extends IncludableSpecialPage {
                                $this->opts->setValue( 'username', $m[1] );
                        }
                        if ( preg_match( '/^namespace=(.*)$/', $bit, $m ) ) {
-                               $ns = $wgLang->getNsIndex( $m[1] );
+                               $ns = $this->getLanguage()->getNsIndex( $m[1] );
                                if( $ns !== false ) {
                                        $this->opts->setValue( 'namespace',  $ns );
                                }
@@ -139,11 +138,12 @@ class SpecialNewpages extends IncludableSpecialPage {
                        // Settings
                        $this->form();
 
-                       $this->setSyndicated();
                        $feedType = $this->opts->getValue( 'feed' );
                        if( $feedType ) {
                                return $this->feed( $feedType );
                        }
+
+                       $out->setFeedAppendQuery( wfArrayToCGI( $this->opts->getAllValues() ) );
                }
 
                $pager = new NewPagesPager( $this, $this->opts );
@@ -162,7 +162,7 @@ class SpecialNewpages extends IncludableSpecialPage {
        }
 
        protected function filterLinks() {
-               global $wgGroupPermissions, $wgLang;
+               global $wgGroupPermissions;
 
                // show/hide links
                $showhide = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) );
@@ -200,7 +200,7 @@ class SpecialNewpages extends IncludableSpecialPage {
                        $links[$key] = wfMsgHtml( $msg, $link );
                }
 
-               return $wgLang->pipeList( $links );
+               return $this->getLanguage()->pipeList( $links );
        }
 
        protected function form() {
@@ -276,12 +276,6 @@ class SpecialNewpages extends IncludableSpecialPage {
                $this->getOutput()->addHTML( $form );
        }
 
-       protected function setSyndicated() {
-               $out = $this->getOutput();
-               $out->setSyndicated( true );
-               $out->setFeedAppendQuery( wfArrayToCGI( $this->opts->getAllValues() ) );
-       }
-
        /**
         * Format a row, providing the timestamp, links to the page/history, size, user links, and a comment
         *
@@ -289,8 +283,6 @@ class SpecialNewpages extends IncludableSpecialPage {
         * @return String
         */
        public function formatRow( $result ) {
-               global $wgLang;
-
                # Revision deletion works on revisions, so we should cast one
                $row = array(
                                          'comment' => $result->rc_comment,
@@ -302,11 +294,19 @@ class SpecialNewpages extends IncludableSpecialPage {
 
                $classes = array();
 
-               $dm = $wgLang->getDirMark();
+               $lang = $this->getLanguage();
+               $dm = $lang->getDirMark();
 
-               $title = Title::makeTitleSafe( $result->rc_namespace, $result->rc_title );
-               $time = Html::element( 'span', array( 'class' => 'mw-newpages-time' ),
-                       $wgLang->timeAndDate( $result->rc_timestamp, true )
+               $title = Title::newFromRow( $result );
+               $spanTime = Html::element( 'span', array( 'class' => 'mw-newpages-time' ),
+                       $lang->timeanddate( $result->rc_timestamp, true )
+               );
+               $time = Linker::linkKnown(
+                       $title,
+                       $spanTime,
+                       array(),
+                       array( 'oldid' => $result->rc_this_oldid ),
+                       array()
                );
 
                $query = array( 'redirect' => 'no' );
@@ -330,9 +330,8 @@ class SpecialNewpages extends IncludableSpecialPage {
                );
                $hist = Html::rawElement( 'span', array( 'class' => 'mw-newpages-history' ), wfMsg( 'parentheses', $histLink ) );
 
-               $length = Html::rawElement( 'span', array( 'class' => 'mw-newpages-length' ),
-                               '[' . wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ), $wgLang->formatNum( $result->length ) ) .
-                               ']'
+               $length = Html::element( 'span', array( 'class' => 'mw-newpages-length' ),
+                               '[' . $this->msg( 'nbytes' )->numParams( $result->length )->text() . ']'
                );
 
                $ulink = Linker::revUserTools( $rev );
@@ -509,7 +508,8 @@ class NewPagesPager extends ReverseChronologicalPager {
                $fields = array(
                        'rc_namespace', 'rc_title', 'rc_cur_id', 'rc_user', 'rc_user_text',
                        'rc_comment', 'rc_timestamp', 'rc_patrolled','rc_id', 'rc_deleted',
-                       'page_len AS length', 'page_latest AS rev_id', 'ts_tags'
+                       'page_len AS length', 'page_latest AS rev_id', 'ts_tags', 'rc_this_oldid',
+                       'page_namespace', 'page_title'
                );
                $join_conds = array( 'page' => array( 'INNER JOIN', 'page_id=rc_cur_id' ) );