summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialNewpages.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialNewpages.php')
-rw-r--r--includes/specials/SpecialNewpages.php66
1 files changed, 39 insertions, 27 deletions
diff --git a/includes/specials/SpecialNewpages.php b/includes/specials/SpecialNewpages.php
index 54bcb97f..8e15d554 100644
--- a/includes/specials/SpecialNewpages.php
+++ b/includes/specials/SpecialNewpages.php
@@ -143,7 +143,9 @@ class SpecialNewpages extends IncludableSpecialPage {
return $this->feed( $feedType );
}
- $out->setFeedAppendQuery( wfArrayToCGI( $this->opts->getAllValues() ) );
+ $allValues = $this->opts->getAllValues();
+ unset( $allValues['feed'] );
+ $out->setFeedAppendQuery( wfArrayToCGI( $allValues ) );
}
$pager = new NewPagesPager( $this, $this->opts );
@@ -165,7 +167,7 @@ class SpecialNewpages extends IncludableSpecialPage {
global $wgGroupPermissions;
// show/hide links
- $showhide = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) );
+ $showhide = array( $this->msg( 'show' )->escaped(), $this->msg( 'hide' )->escaped() );
// Option value -> message mapping
$filters = array(
@@ -197,7 +199,7 @@ class SpecialNewpages extends IncludableSpecialPage {
$link = Linker::link( $self, $showhide[$onoff], array(),
array( $key => $onoff ) + $changed
);
- $links[$key] = wfMsgHtml( $msg, $link );
+ $links[$key] = $this->msg( $msg )->rawParams( $link )->escaped();
}
return $this->getLanguage()->pipeList( $links );
@@ -230,14 +232,23 @@ class SpecialNewpages extends IncludableSpecialPage {
$form = Xml::openElement( 'form', array( 'action' => $wgScript ) ) .
Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) .
- Xml::fieldset( wfMsg( 'newpages' ) ) .
+ Xml::fieldset( $this->msg( 'newpages' )->text() ) .
Xml::openElement( 'table', array( 'id' => 'mw-newpages-table' ) ) .
'<tr>
<td class="mw-label">' .
- Xml::label( wfMsg( 'namespace' ), 'namespace' ) .
+ Xml::label( $this->msg( 'namespace' )->text(), 'namespace' ) .
'</td>
<td class="mw-input">' .
- Xml::namespaceSelector( $namespace, 'all' ) .
+ Html::namespaceSelector(
+ array(
+ 'selected' => $namespace,
+ 'all' => 'all',
+ ), array(
+ 'name' => 'namespace',
+ 'id' => 'namespace',
+ 'class' => 'namespaceselector',
+ )
+ ) .
'</td>
</tr>' . ( $tagFilter ? (
'<tr>
@@ -251,7 +262,7 @@ class SpecialNewpages extends IncludableSpecialPage {
( $wgEnableNewpagesUserFilter ?
'<tr>
<td class="mw-label">' .
- Xml::label( wfMsg( 'newpages-username' ), 'mw-np-username' ) .
+ Xml::label( $this->msg( 'newpages-username' )->text(), 'mw-np-username' ) .
'</td>
<td class="mw-input">' .
Xml::input( 'username', 30, $userText, array( 'id' => 'mw-np-username' ) ) .
@@ -259,7 +270,7 @@ class SpecialNewpages extends IncludableSpecialPage {
</tr>' : '' ) .
'<tr> <td></td>
<td class="mw-submit">' .
- Xml::submitButton( wfMsg( 'allpagessubmit' ) ) .
+ Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) .
'</td>
</tr>' .
'<tr>
@@ -283,6 +294,8 @@ class SpecialNewpages extends IncludableSpecialPage {
* @return String
*/
public function formatRow( $result ) {
+ $title = Title::newFromRow( $result );
+
# Revision deletion works on revisions, so we should cast one
$row = array(
'comment' => $result->rc_comment,
@@ -291,15 +304,15 @@ class SpecialNewpages extends IncludableSpecialPage {
'user' => $result->rc_user,
);
$rev = new Revision( $row );
+ $rev->setTitle( $title );
$classes = array();
$lang = $this->getLanguage();
$dm = $lang->getDirMark();
- $title = Title::newFromRow( $result );
$spanTime = Html::element( 'span', array( 'class' => 'mw-newpages-time' ),
- $lang->timeanddate( $result->rc_timestamp, true )
+ $lang->userTimeAndDate( $result->rc_timestamp, $this->getUser() )
);
$time = Linker::linkKnown(
$title,
@@ -324,14 +337,15 @@ class SpecialNewpages extends IncludableSpecialPage {
);
$histLink = Linker::linkKnown(
$title,
- wfMsgHtml( 'hist' ),
+ $this->msg( 'hist' )->escaped(),
array(),
array( 'action' => 'history' )
);
- $hist = Html::rawElement( 'span', array( 'class' => 'mw-newpages-history' ), wfMsg( 'parentheses', $histLink ) );
+ $hist = Html::rawElement( 'span', array( 'class' => 'mw-newpages-history' ),
+ $this->msg( 'parentheses' )->rawParams( $histLink )->escaped() );
$length = Html::element( 'span', array( 'class' => 'mw-newpages-length' ),
- '[' . $this->msg( 'nbytes' )->numParams( $result->length )->text() . ']'
+ $this->msg( 'brackets' )->params( $this->msg( 'nbytes' )->numParams( $result->length )->text() )
);
$ulink = Linker::revUserTools( $rev );
@@ -346,8 +360,8 @@ class SpecialNewpages extends IncludableSpecialPage {
$classes[] = 'mw-newpages-zero-byte-page';
}
- # Tags, if any. check for including due to bug 23293
- if ( !$this->including() ) {
+ # Tags, if any.
+ if( isset( $result->ts_tags ) ) {
list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow( $result->ts_tags, 'newpages' );
$classes = array_merge( $classes, $newClasses );
} else {
@@ -356,11 +370,11 @@ class SpecialNewpages extends IncludableSpecialPage {
$css = count( $classes ) ? ' class="' . implode( ' ', $classes ) . '"' : '';
- # Display the old title if the namespace has been changed
+ # Display the old title if the namespace/title has been changed
$oldTitleText = '';
- if ( $result->page_namespace !== $result->rc_namespace ) {
- $oldTitleText = wfMessage( 'rc-old-title' )->params( Title::makeTitle( $result->rc_namespace, $result->rc_title )
- ->getPrefixedText() )->escaped();
+ $oldTitle = Title::makeTitle( $result->rc_namespace, $result->rc_title );
+ if ( !$title->equals( $oldTitle ) ) {
+ $oldTitleText = $this->msg( 'rc-old-title' )->params( $oldTitle->getPrefixedText() )->escaped();
}
return "<li{$css}>{$time} {$dm}{$plink} {$hist} {$dm}{$length} {$dm}{$ulink} {$comment} {$tagDisplay} {$oldTitleText}</li>\n";
@@ -396,7 +410,7 @@ class SpecialNewpages extends IncludableSpecialPage {
$feed = new $wgFeedClasses[$type](
$this->feedTitle(),
- wfMsgExt( 'tagline', 'parsemag' ),
+ $this->msg( 'tagline' )->text(),
$this->getTitle()->getFullUrl()
);
@@ -420,7 +434,7 @@ class SpecialNewpages extends IncludableSpecialPage {
}
protected function feedItem( $row ) {
- $title = Title::MakeTitle( intval( $row->rc_namespace ), $row->rc_title );
+ $title = Title::makeTitle( intval( $row->rc_namespace ), $row->rc_title );
if( $title ) {
$date = $row->rc_timestamp;
$comments = $title->getTalkPage()->getFullURL();
@@ -445,7 +459,8 @@ class SpecialNewpages extends IncludableSpecialPage {
protected function feedItemDesc( $row ) {
$revision = Revision::newFromId( $row->rev_id );
if( $revision ) {
- return '<p>' . htmlspecialchars( $revision->getUserText() ) . wfMsgForContent( 'colon-separator' ) .
+ return '<p>' . htmlspecialchars( $revision->getUserText() ) .
+ $this->msg( 'colon-separator' )->inContentLanguage()->escaped() .
htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) .
"</p>\n<hr />\n<div>" .
nl2br( htmlspecialchars( $revision->getText() ) ) . "</div>";
@@ -515,7 +530,7 @@ 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', 'rc_this_oldid',
+ 'length' => 'page_len', 'rev_id' => 'page_latest', 'rc_this_oldid',
'page_namespace', 'page_title'
);
$join_conds = array( 'page' => array( 'INNER JOIN', 'page_id=rc_cur_id' ) );
@@ -531,13 +546,10 @@ class NewPagesPager extends ReverseChronologicalPager {
'join_conds' => $join_conds
);
- // Empty array for fields, it'll be set by us anyway.
- $fields = array();
-
// Modify query for tags
ChangeTags::modifyDisplayQuery(
$info['tables'],
- $fields,
+ $info['fields'],
$info['conds'],
$info['join_conds'],
$info['options'],